[PATCH] can: tcan4x5x: put tcan into sleep when removing driver
Sean Nyekjaer <[email protected]> Mon, 27 Jul 2026 11:48:59 +0200
| Newsgroups | org.kernel.vger.linux-can,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
Put the tcan4x5x transceiver into sleep mode when the driver is removed, instead of leaving it in its current operating mode. This reduces power consumption(3mA@12V) once the driver is no longer bound to the device. Note that the reset pin is needed to bring the device out of sleep and back into standby mode again. Signed-off-by: Sean Nyekjaer <[email protected]> --- I havn't come across any drivers that leaves the devices in the lowest power mode when unbinded. But we need this to enter our lowest power mode in suspend. If it doesn't fit in, I'm happy to carry this out of tree... drivers/net/can/m_can/tcan4x5x-core.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/can/m_can/tcan4x5x-core.c b/drivers/net/can/m_can/tcan4x5x-core.c index 734b34b28291..b1b4db9990dc 100644 --- a/drivers/net/can/m_can/tcan4x5x-core.c +++ b/drivers/net/can/m_can/tcan4x5x-core.c @@ -565,6 +565,10 @@ static void tcan4x5x_can_remove(struct spi_device *spi) { struct tcan4x5x_priv *priv = spi_get_drvdata(spi); + if (priv->reset_gpio) + regmap_update_bits(priv->regmap, TCAN4X5X_CONFIG, + TCAN4X5X_MODE_SEL_MASK, TCAN4X5X_MODE_SLEEP); + m_can_class_unregister(&priv->cdev); tcan4x5x_hc_free(priv); -- 2.52.0