[alsa-devel] [PATCH] ASoC: max98357a: add speaker switch

Tzung-Bi Shih tzungbi at google.com
Tue Feb 11 11:32:20 CET 2020


On Tue, Feb 11, 2020 at 2:38 AM Mark Brown <broonie at kernel.org> wrote:
>
> On Tue, Feb 04, 2020 at 11:04:06AM +0800, Tzung-Bi Shih wrote:
>
> > Some machine may share the same I2S lines for multiple codecs. For
> > example, mediatek/mt8183/mt8183-da7219-max98357 shares the same lines
> > between max98357a and da7219.  When writing audio data through the I2S
> > lines, all codecs on the lines would try to generate sound if they
> > accepts DO line.  As a result, multiple codecs generate sound at a
> > time.
>
> Rather than adding this in the driver it would be better to add some
> _PIN_SWITCH() widgets to the speaker outputs, those exist for
> essentially this purpose.

(We take rockchip/rk3399_gru_sound.c as a reference to use SOC_DAPM_PIN_SWITCH.)

Did you mean (in machine driver):
- Add SND_SOC_DAPM_SPK("Speakers", NULL)
- Add SOC_DAPM_PIN_SWITCH("Speakers")
- Add DAPM route "Speaker" (from max98357a) to "Speakers"
User space program controls "Speakers Switch" to toggle the switch?

We found the method cannot avoid max98357a->sdmode being set.  As a
result, max98357a consumes power even if we don't switch on it.


More information about the Alsa-devel mailing list