[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241122-tcan-standby-v3-2-90bafaf5eccd@geanix.com>
Date: Fri, 22 Nov 2024 15:52:23 +0100
From: Sean Nyekjaer <sean@...nix.com>
To: Chandrasekar Ramakrishnan <rcsekar@...sung.com>,
Marc Kleine-Budde <mkl@...gutronix.de>,
Vincent Mailhol <mailhol.vincent@...adoo.fr>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>
Cc: linux-can@...r.kernel.org, linux-kernel@...r.kernel.org,
Sean Nyekjaer <sean@...nix.com>
Subject: [PATCH can-next v3 2/3] can: tcan4x5x: add deinit callback to set
standby mode
At Vsup 12V, standby mode will save 7-8mA, when the interface is
down.
Signed-off-by: Sean Nyekjaer <sean@...nix.com>
---
drivers/net/can/m_can/tcan4x5x-core.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/net/can/m_can/tcan4x5x-core.c b/drivers/net/can/m_can/tcan4x5x-core.c
index 7213d9894c82d079bf92f1ec62d4eebb500cdfa4..13014be4ab37d24680d25806de642a9c5c197020 100644
--- a/drivers/net/can/m_can/tcan4x5x-core.c
+++ b/drivers/net/can/m_can/tcan4x5x-core.c
@@ -279,6 +279,14 @@ static int tcan4x5x_init(struct m_can_classdev *cdev)
return ret;
}
+static int tcan4x5x_deinit(struct m_can_classdev *cdev)
+{
+ struct tcan4x5x_priv *tcan4x5x = cdev_to_priv(cdev);
+
+ return regmap_update_bits(tcan4x5x->regmap, TCAN4X5X_CONFIG,
+ TCAN4X5X_MODE_SEL_MASK, TCAN4X5X_MODE_STANDBY);
+};
+
static int tcan4x5x_disable_wake(struct m_can_classdev *cdev)
{
struct tcan4x5x_priv *tcan4x5x = cdev_to_priv(cdev);
@@ -377,6 +385,7 @@ static int tcan4x5x_get_gpios(struct m_can_classdev *cdev,
static const struct m_can_ops tcan4x5x_ops = {
.init = tcan4x5x_init,
+ .deinit = tcan4x5x_deinit,
.read_reg = tcan4x5x_read_reg,
.write_reg = tcan4x5x_write_reg,
.write_fifo = tcan4x5x_write_fifo,
--
2.46.2
Powered by blists - more mailing lists