2023-10-06 11:11:39

by Richard Fitzgerald

[permalink] [raw]
Subject: [PATCH 0/4] ASoC: cs35l56: Update hibernate/wake sequences and enable hibernation

Update the hibernate and wake command sequences to meet the latest
datasheet specification and enable hibernation for I2C and SPI control
interfaces.

Richard Fitzgerald (1):
ASoC: cs35l56: Enable low-power hibernation mode on SPI

Simon Trimmer (3):
ASoC: cs35l56: Change hibernate sequence to use allow auto hibernate
ASoC: cs35l56: Wake transactions need to be issued twice
ASoC: cs35l56: Enable low-power hibernation mode on i2c

include/sound/cs35l56.h | 1 +
sound/soc/codecs/cs35l56-i2c.c | 1 +
sound/soc/codecs/cs35l56-shared.c | 66 +++++++++++++++++++------------
sound/soc/codecs/cs35l56-spi.c | 1 +
4 files changed, 43 insertions(+), 26 deletions(-)

--
2.30.2


2023-10-06 11:11:42

by Richard Fitzgerald

[permalink] [raw]
Subject: [PATCH 1/4] ASoC: cs35l56: Change hibernate sequence to use allow auto hibernate

From: Simon Trimmer <[email protected]>

If the hardware uses SPI_MOSI, I2C_SCL or I2C_SDA as the wake source
the bus activity of sending HIBERNATE_NOW will wake up the amps that
were already put into hibernate.

ALLOW_AUTO_HIBERNATE tells the firmware to hibernate itself after a
timeout of a few seconds, giving the driver instances time to send this
before any amps have gone into hibernate.

Signed-off-by: Simon Trimmer <[email protected]>
Signed-off-by: Richard Fitzgerald <[email protected]>
---
sound/soc/codecs/cs35l56-shared.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/sound/soc/codecs/cs35l56-shared.c b/sound/soc/codecs/cs35l56-shared.c
index 01b6fa97b36b..68dc93b82789 100644
--- a/sound/soc/codecs/cs35l56-shared.c
+++ b/sound/soc/codecs/cs35l56-shared.c
@@ -439,7 +439,7 @@ EXPORT_SYMBOL_NS_GPL(cs35l56_is_fw_reload_needed, SND_SOC_CS35L56_SHARED);

static const struct reg_sequence cs35l56_hibernate_seq[] = {
/* This must be the last register access */
- REG_SEQ0(CS35L56_DSP_VIRTUAL1_MBOX_1, CS35L56_MBOX_CMD_HIBERNATE_NOW),
+ REG_SEQ0(CS35L56_DSP_VIRTUAL1_MBOX_1, CS35L56_MBOX_CMD_ALLOW_AUTO_HIBERNATE),
};

static const struct reg_sequence cs35l56_hibernate_wake_seq[] = {
@@ -473,12 +473,6 @@ int cs35l56_runtime_suspend_common(struct cs35l56_base *cs35l56_base)
return 0;
}

- /*
- * Enable auto-hibernate. If it is woken by some other wake source
- * it will automatically return to hibernate.
- */
- cs35l56_mbox_send(cs35l56_base, CS35L56_MBOX_CMD_ALLOW_AUTO_HIBERNATE);
-
/*
* Must enter cache-only first so there can't be any more register
* accesses other than the controlled hibernate sequence below.
@@ -545,11 +539,12 @@ int cs35l56_runtime_resume_common(struct cs35l56_base *cs35l56_base, bool is_sou
return 0;

err:
- regmap_write(cs35l56_base->regmap, CS35L56_DSP_VIRTUAL1_MBOX_1,
- CS35L56_MBOX_CMD_HIBERNATE_NOW);
-
regcache_cache_only(cs35l56_base->regmap, true);

+ regmap_multi_reg_write_bypassed(cs35l56_base->regmap,
+ cs35l56_hibernate_seq,
+ ARRAY_SIZE(cs35l56_hibernate_seq));
+
return ret;
}
EXPORT_SYMBOL_NS_GPL(cs35l56_runtime_resume_common, SND_SOC_CS35L56_SHARED);
--
2.30.2

2023-10-06 11:12:31

by Richard Fitzgerald

[permalink] [raw]
Subject: [PATCH 4/4] ASoC: cs35l56: Enable low-power hibernation mode on SPI

Hibernation can be enabled on SPI-connected devices now that
the hibernate and wake sequences have been updated to work
with wake-on-MOSI.

Signed-off-by: Richard Fitzgerald <[email protected]>
---
sound/soc/codecs/cs35l56-spi.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/sound/soc/codecs/cs35l56-spi.c b/sound/soc/codecs/cs35l56-spi.c
index 768ffe8213dc..b07b798b0b45 100644
--- a/sound/soc/codecs/cs35l56-spi.c
+++ b/sound/soc/codecs/cs35l56-spi.c
@@ -32,6 +32,7 @@ static int cs35l56_spi_probe(struct spi_device *spi)
}

cs35l56->base.dev = &spi->dev;
+ cs35l56->base.can_hibernate = true;

ret = cs35l56_common_probe(cs35l56);
if (ret != 0)
--
2.30.2

2023-10-06 17:45:57

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH 0/4] ASoC: cs35l56: Update hibernate/wake sequences and enable hibernation

On Fri, 06 Oct 2023 12:10:35 +0100, Richard Fitzgerald wrote:
> Update the hibernate and wake command sequences to meet the latest
> datasheet specification and enable hibernation for I2C and SPI control
> interfaces.
>
> Richard Fitzgerald (1):
> ASoC: cs35l56: Enable low-power hibernation mode on SPI
>
> [...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/4] ASoC: cs35l56: Change hibernate sequence to use allow auto hibernate
commit: a47cf4dac7dcc43ef25d009ca0ad28fc86ba0eef
[2/4] ASoC: cs35l56: Wake transactions need to be issued twice
commit: 3df761bdbc8bc1bb679b5a4d4e068728d930a552
[3/4] ASoC: cs35l56: Enable low-power hibernation mode on i2c
commit: 79b101947a829a1c4c3eca4b6365093d2b534cf4
[4/4] ASoC: cs35l56: Enable low-power hibernation mode on SPI
commit: 634ed138d80b1cc8a903edb226458ea203c44abd

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark