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

From: Marc Kleine-Budde

Date: Mon Jul 27 2026 - 06:51:36 EST


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 |

Attachment: signature.asc
Description: PGP signature