[PATCH can-next v3 0/3] can: tcan4x5x/m_can: use standby mode when down and in suspend

Sean Nyekjaer posted 3 patches 1 year, 2 months ago
drivers/net/can/m_can/m_can.c         | 22 ++++++++++++++++++----
drivers/net/can/m_can/m_can.h         |  1 +
drivers/net/can/m_can/tcan4x5x-core.c |  9 +++++++++
3 files changed, 28 insertions(+), 4 deletions(-)
[PATCH can-next v3 0/3] can: tcan4x5x/m_can: use standby mode when down and in suspend
Posted by Sean Nyekjaer 1 year, 2 months ago
When downing the tcan4x5x there is no reason to keep the tcan4x5x in
"normal" mode and waste power.
So set standby mode when the interface is down and normal mode when
interface is up.

Also when going into suspend, set the tcan4x5x into standby mode. The
tcan4x5x can still be used as a wake-source when in standby as low power
rx is enabled.

Signed-off-by: Sean Nyekjaer <sean@geanix.com>
---
Changes in v3:
- Run deinit in m_can_stop() in any case even if m_can_cccr_update_bits() fails
- Link to v2: https://lore.kernel.org/r/20241115-tcan-standby-v2-0-4eb02026b237@geanix.com

Changes in v2:
- Reduced code in tcan4x5x_deinit()
- Taken care of return values from deinit callback
- Link to v1: https://lore.kernel.org/r/20241111-tcan-standby-v1-0-f9337ebaceea@geanix.com

---
Sean Nyekjaer (3):
      can: m_can: add deinit callback
      can: tcan4x5x: add deinit callback to set standby mode
      can: m_can: call deinit/init callback when going into suspend/resume

 drivers/net/can/m_can/m_can.c         | 22 ++++++++++++++++++----
 drivers/net/can/m_can/m_can.h         |  1 +
 drivers/net/can/m_can/tcan4x5x-core.c |  9 +++++++++
 3 files changed, 28 insertions(+), 4 deletions(-)
---
base-commit: e0b741bc53c94f9ae25d4140202557a0aa51b5a0
change-id: 20241107-tcan-standby-def358771b2b

Best regards,
-- 
Sean Nyekjaer <sean@geanix.com>
Re: [PATCH can-next v3 0/3] can: tcan4x5x/m_can: use standby mode when down and in suspend
Posted by Sean Nyekjaer 1 year, 1 month ago
On Fri, Nov 22, 2024 at 03:52:21PM +0100, Sean Nyekjaer wrote:
> When downing the tcan4x5x there is no reason to keep the tcan4x5x in
> "normal" mode and waste power.
> So set standby mode when the interface is down and normal mode when
> interface is up.
> 
> Also when going into suspend, set the tcan4x5x into standby mode. The
> tcan4x5x can still be used as a wake-source when in standby as low power
> rx is enabled.
> 
> Signed-off-by: Sean Nyekjaer <sean@geanix.com>
> ---
> Changes in v3:
> - Run deinit in m_can_stop() in any case even if m_can_cccr_update_bits() fails
> - Link to v2: https://lore.kernel.org/r/20241115-tcan-standby-v2-0-4eb02026b237@geanix.com
> 
> Changes in v2:
> - Reduced code in tcan4x5x_deinit()
> - Taken care of return values from deinit callback
> - Link to v1: https://lore.kernel.org/r/20241111-tcan-standby-v1-0-f9337ebaceea@geanix.com
> 
> ---

Hi,

Anything needed from my side on this?

/Sean
Re: [PATCH can-next v3 0/3] can: tcan4x5x/m_can: use standby mode when down and in suspend
Posted by Marc Kleine-Budde 1 year ago
On 03.01.2025 13:37:19, Sean Nyekjaer wrote:
> On Fri, Nov 22, 2024 at 03:52:21PM +0100, Sean Nyekjaer wrote:
> > When downing the tcan4x5x there is no reason to keep the tcan4x5x in
> > "normal" mode and waste power.
> > So set standby mode when the interface is down and normal mode when
> > interface is up.
> > 
> > Also when going into suspend, set the tcan4x5x into standby mode. The
> > tcan4x5x can still be used as a wake-source when in standby as low power
> > rx is enabled.
> > 
> > Signed-off-by: Sean Nyekjaer <sean@geanix.com>
> > ---
> > Changes in v3:
> > - Run deinit in m_can_stop() in any case even if m_can_cccr_update_bits() fails
> > - Link to v2: https://lore.kernel.org/r/20241115-tcan-standby-v2-0-4eb02026b237@geanix.com
> > 
> > Changes in v2:
> > - Reduced code in tcan4x5x_deinit()
> > - Taken care of return values from deinit callback
> > - Link to v1: https://lore.kernel.org/r/20241111-tcan-standby-v1-0-f9337ebaceea@geanix.com
> > 
> > ---
> 
> Hi,
> 
> Anything needed from my side on this?

I think this all could be hidden behind runtime PM, but that would mean
a bigger re-write and a lot of testing. So applied to linux-can-next as
is.

regards,
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   |