[v3 2/3] ASoC: mediatek: mt8186: correct the HDMI widgets

Jiaxin Yu (俞家鑫) Jiaxin.Yu at mediatek.com
Wed Aug 2 07:52:57 PDT 2023


On Mon, 2023-07-31 at 12:50 +0100, Mark Brown wrote:
> On Mon, Jul 31, 2023 at 02:08:02AM +0800, Jiaxin Yu wrote:
> 
> > Use SND_SOC_DAPM_LINE instead of SND_SOC_DAPM_OUTPUT to trigger
> > DAPM events to hdmi-codec when userspace control the DPAM pin.
> 
> Why?

I have defined an SOC_DAPM_PIN_SWITCH that named as "HDMI1", if I use
SND_SOC_DAPM_OUTPUT, it can't be controlled by HDMI1's PIN_SWITCH.

 994 static const struct snd_kcontrol_new
 995 mt8186_mt6366_da7219_max98357_controls[] = {
 996         SOC_DAPM_PIN_SWITCH("Speakers"),
 997         SOC_DAPM_PIN_SWITCH("Headphones"),
 998         SOC_DAPM_PIN_SWITCH("Headset Mic"),
 999         SOC_DAPM_PIN_SWITCH("HDMI1"),

I think SND_SOC_DAPM_OUTPUT must be judged as ep, so I want to define
HDMI1 as a snd_soc_dapm_spk's widget.
From the perspective of hardware connection, their relationship is
indeed equal, so I find SOC_SOC_DAPM_LINE to define HDMI1.


                       ==> hdmi-codec ==> it6505(HDMI output)
DL1(FE) ==> I2S3(BE)
                       ==> rt1015p(SPEAKER output)

2738 static void dapm_update_widget_flags(struct snd_soc_dapm_widget
*w)
2739 {
2740         enum snd_soc_dapm_direction dir;
2741         struct snd_soc_dapm_path *p;
2742         unsigned int ep;
2743         ...
2760         case snd_soc_dapm_output:
2761                 /* On a fully routed card a output is never a sink
*/
2762                 if (w->dapm->card->fully_routed)
2763                         return;
2764                 ep = SND_SOC_DAPM_EP_SINK;
2765                 snd_soc_dapm_widget_for_each_sink_path(w, p) {
2766                         if (p->sink->id == snd_soc_dapm_spk ||
2767                                 p->sink->id == snd_soc_dapm_hp ||
2768                                 p->sink->id == snd_soc_dapm_line
||
2769                                 p->sink->id == snd_soc_dapm_input)
{
2770                                         ep = 0;
2771                                         break;
2772                         }
2773                 }
2774                 break;


More information about the Linux-mediatek mailing list