ASoC: cs35l56: ASP1 DOUT must default to Hi-Z when not transmitting

Message ID 20231009153412.30380-1-rf@opensource.cirrus.com
State New
Headers
Series ASoC: cs35l56: ASP1 DOUT must default to Hi-Z when not transmitting |

Commit Message

Richard Fitzgerald Oct. 9, 2023, 3:34 p.m. UTC
  The ASP1 DOUT line must be defaulted to be high-impedance when
it is not actually transmitting data for an active channel.

In non-SoundWire modes ASP1 will usually be shared by multiple
amps so each amp must only drive the line during the slot for
an enabled TX channel.

In SoundWire mode a custom firmware can use ASP1 as a secondary
chip-to-chip audio link or as GPIO. It should be defaulted to
high-impedance since by default the purpose of this pin is not
known.

Backport note:
On kernel versions before 6.6 the cs35l56->base.regmap argument
to regmap_set_bits() must be changed to cs35l56->regmap.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Fixes: e49611252900 ("ASoC: cs35l56: Add driver for Cirrus Logic CS35L56")
---
 sound/soc/codecs/cs35l56.c | 6 ++++++
 1 file changed, 6 insertions(+)
  

Comments

Mark Brown Oct. 10, 2023, 6:33 p.m. UTC | #1
On Mon, 09 Oct 2023 16:34:12 +0100, Richard Fitzgerald wrote:
> The ASP1 DOUT line must be defaulted to be high-impedance when
> it is not actually transmitting data for an active channel.
> 
> In non-SoundWire modes ASP1 will usually be shared by multiple
> amps so each amp must only drive the line during the slot for
> an enabled TX channel.
> 
> [...]

Applied to

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

Thanks!

[1/1] ASoC: cs35l56: ASP1 DOUT must default to Hi-Z when not transmitting
      commit: 1bba0badff0ede8dc51641cff4b153422baa3369

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
  

Patch

diff --git a/sound/soc/codecs/cs35l56.c b/sound/soc/codecs/cs35l56.c
index 8ccdd3f134a5..45b4de3eff94 100644
--- a/sound/soc/codecs/cs35l56.c
+++ b/sound/soc/codecs/cs35l56.c
@@ -1197,6 +1197,12 @@  int cs35l56_init(struct cs35l56_private *cs35l56)
 	/* Registers could be dirty after soft reset or SoundWire enumeration */
 	regcache_sync(cs35l56->base.regmap);
 
+	/* Set ASP1 DOUT to high-impedance when it is not transmitting audio data. */
+	ret = regmap_set_bits(cs35l56->base.regmap, CS35L56_ASP1_CONTROL3,
+			      CS35L56_ASP1_DOUT_HIZ_CTRL_MASK);
+	if (ret)
+		return dev_err_probe(cs35l56->base.dev, ret, "Failed to write ASP1_CONTROL3\n");
+
 	cs35l56->base.init_done = true;
 	complete(&cs35l56->init_completion);