Re: [PATCH v2] mux: mmio: Add suspend and resume support

From: Andrew Davis
Date: Wed Dec 04 2024 - 10:02:15 EST


On 12/4/24 8:14 AM, Thomas Richard wrote:
On 12/4/24 14:53, Andrew Davis wrote:
On 9/11/24 3:53 AM, Thomas Richard wrote:
The status of each mux is read during suspend and stored in the private
memory of the mux_chip.
Then the state is restored during the resume.

Signed-off-by: Thomas Richard <thomas.richard@xxxxxxxxxxx>
---
In this second version, as discussed with Peter, everything is done in
the
mmio-mux driver.
A mux_mmio_set() function was added, and used during suspend stage to get
the status of the of the muxes.
This status is stored in the private memory of the mux_chip.
---
Changes in v2:
- Remove all modifications done in the mux subsystem
- Add a mux_mmio_set()
- Read the status of muxes during suspend and store in the private memory
   of the mux_chip.

Do you need this private memory? Since this is already using regmap, why
not use the regmap cache, then you can restore all the values on resume
with a simple call to regcache_sync().
The regmap can be set without cache.
As you inherit the regmap, you cannot assume that the cache is enabled.


Fair point, we don't really know much about the underlying registers.
One thing we don't know is if they are retained during suspend, so
saving and restoring might be unneeded in some cases. Maybe that isn't
something we can solve at this point, could be something that should
be done in the regmap framework instead..

For now, the rest of this patch seems good to me,

Reviewed-by: Andrew Davis <afd@xxxxxx>