Re: [PATCH] can: tcan4x5x: put tcan into sleep when removing driver

Marc Kleine-Budde <[email protected]> Mon, 27 Jul 2026 12:40:00 +0200
Newsgroups org.kernel.vger.linux-can,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On 27.07.2026 10:34:06, Sean Nyekjaer wrote:
> > Does it still work, if you move the regmap_update_bits() to
> > tcan4x5x_power_enable()?
>
> In our use-case, we don't have control over Vsup. It's directly wired
> to 12V from the car. But toggling Vsup will get the tcan4x5x into
> standby mode again.
>
> Maybe:
> if (priv->reset_gpio && priv->power == NULL) ?

Yes, something like:

 static int tcan4x5x_power_enable(struct regulator *reg, int enable)
 {
-        if (IS_ERR_OR_NULL(reg))
+        if (IS_ERR_OR_NULL(reg)) {
+                if (priv->reset_gpio && !enable)
+                        return regmap_update_bits();
+
                 return 0;
+        }

         if (enable)
                 return regulator_enable(reg);

Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde          |
Embedded Linux                   | https://www.pengutronix.de |
Vertretung Nürnberg              | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-9   |
signature.asc (application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE-----

iHUEABYKAB0WIQSl+MghEFFAdY3pYJLMOmT6rpmt0gUCamc1fgAKCRDMOmT6rpmt
0qmvAQDk9pFCmPFfZ+teG6ZrBqAx8gJEunLO1cBcNLxA7jI6lQD+LY6n2yw5TDs8
4b68P4abMTOBiAKs5ZF1WWIEDLRfgA8=
=QiJo
-----END PGP SIGNATURE-----