Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: cs35l56: Change hibernate sequence to use allow auto hibernate

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 <simont@opensource.cirrus.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20231006111039.101914-2-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Simon Trimmer and committed by
Mark Brown
a47cf4da c98a0a83

+5 -10
+5 -10
sound/soc/codecs/cs35l56-shared.c
··· 439 439 440 440 static const struct reg_sequence cs35l56_hibernate_seq[] = { 441 441 /* This must be the last register access */ 442 - REG_SEQ0(CS35L56_DSP_VIRTUAL1_MBOX_1, CS35L56_MBOX_CMD_HIBERNATE_NOW), 442 + REG_SEQ0(CS35L56_DSP_VIRTUAL1_MBOX_1, CS35L56_MBOX_CMD_ALLOW_AUTO_HIBERNATE), 443 443 }; 444 444 445 445 static const struct reg_sequence cs35l56_hibernate_wake_seq[] = { ··· 472 472 473 473 return 0; 474 474 } 475 - 476 - /* 477 - * Enable auto-hibernate. If it is woken by some other wake source 478 - * it will automatically return to hibernate. 479 - */ 480 - cs35l56_mbox_send(cs35l56_base, CS35L56_MBOX_CMD_ALLOW_AUTO_HIBERNATE); 481 475 482 476 /* 483 477 * Must enter cache-only first so there can't be any more register ··· 539 545 return 0; 540 546 541 547 err: 542 - regmap_write(cs35l56_base->regmap, CS35L56_DSP_VIRTUAL1_MBOX_1, 543 - CS35L56_MBOX_CMD_HIBERNATE_NOW); 544 - 545 548 regcache_cache_only(cs35l56_base->regmap, true); 549 + 550 + regmap_multi_reg_write_bypassed(cs35l56_base->regmap, 551 + cs35l56_hibernate_seq, 552 + ARRAY_SIZE(cs35l56_hibernate_seq)); 546 553 547 554 return ret; 548 555 }