From: sashiko-bot@kernel.org
To: "Sean Nyekjaer" <sean@geanix.com>
Cc: "Oliver Hartkopp" <socketcan@hartkopp.net>,
"Oleksij Rempel" <o.rempel@pengutronix.de>,
linux-can@vger.kernel.org, "Vincent Mailhol" <mailhol@kernel.org>,
"Marc Kleine-Budde" <mkl@pengutronix.de>
Subject: Re: [PATCH v3] can: tcan4x5x: put tcan into sleep when removing driver
Date: Mon, 03 Aug 2026 14:09:16 +0000 [thread overview]
Message-ID: <20260803140917.6A3661F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260803135011.230006-1-sean@geanix.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The transceiver is not put into sleep mode if a regulator is configured, defeating the power-saving goal for shared or always-on regulators.
--
--- Patch [1]: [PATCH v3] can: tcan4x5x: put tcan into sleep when removing driver ---
commit 153dfa0940acefa28cd89e367eedf818096ade5b
Author: Sean Nyekjaer <sean@geanix.com>
can: tcan4x5x: put tcan into sleep when removing driver
This commit attempts to put the tcan4x5x transceiver into sleep mode when
the driver is removed to reduce power consumption. It updates
tcan4x5x_power_enable to send the sleep command via SPI if the RST pin is
available and no regulator is present.
> diff --git a/drivers/net/can/m_can/tcan4x5x-core.c b/drivers/net/can/m_can/tcan4x5x-core.c
> index 31cc9d0abd453..a318f1874b351 100644
> --- a/drivers/net/can/m_can/tcan4x5x-core.c
> +++ b/drivers/net/can/m_can/tcan4x5x-core.c
> @@ -211,10 +211,26 @@ static int tcan4x5x_write_fifo(struct m_can_classdev *cdev,
> return regmap_bulk_write(priv->regmap, TCAN4X5X_MRAM_START + addr_offset, val, val_count);
> }
>
> -static int tcan4x5x_power_enable(struct regulator *reg, int enable)
> +static int tcan4x5x_power_enable(struct tcan4x5x_priv *priv, int enable)
> {
> - if (IS_ERR_OR_NULL(reg))
> + struct regulator *reg = priv->power;
> +
> + /*
> + * Check if the power regulator is configured. If it is, just power
> + * the device on/off. If not, put the device into sleep mode here if
> + * the RST pin is available, since a wake-up event, RST pin toggle,
> + * or power cycle are the only ways to exit sleep mode.
> + * Datasheet: TCAN4550, section "8.4.3 Sleep Mode"
> + * https://www.ti.com/lit/gpn/tcan4550
> + */
> + if (IS_ERR_OR_NULL(reg)) {
> + if (priv->reset_gpio && !enable)
> + return regmap_update_bits(priv->regmap, TCAN4X5X_CONFIG,
> + TCAN4X5X_MODE_SEL_MASK,
> + TCAN4X5X_MODE_SLEEP);
> +
> return 0;
> + }
[Severity: Medium]
Will this miss the power savings if the regulator is shared or marked as
always-on?
Because the sleep command is nested inside the IS_ERR_OR_NULL(reg) check,
the device is not put into sleep mode if a regulator is configured. Instead,
the function continues to the else block and calls regulator_disable().
If the regulator is shared with other active devices or is marked always-on in
the device tree, regulator_disable() will only decrement the reference count
without physically turning off the power. The transceiver will stay fully
powered in its active operating mode.
Should the driver issue the sleep command via SPI whenever priv->reset_gpio
is available, before disabling the regulator, to ensure power is saved regardless
of the physical regulator state?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260803135011.230006-1-sean@geanix.com?part=1
next prev parent reply other threads:[~2026-08-03 14:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-03 13:50 [PATCH v3] can: tcan4x5x: put tcan into sleep when removing driver Sean Nyekjaer
2026-08-03 14:09 ` sashiko-bot [this message]
2026-08-03 14:11 ` Marc Kleine-Budde
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260803140917.6A3661F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-can@vger.kernel.org \
--cc=mailhol@kernel.org \
--cc=mkl@pengutronix.de \
--cc=o.rempel@pengutronix.de \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sean@geanix.com \
--cc=socketcan@hartkopp.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox