<pre>
On Thu, 2022-12-01 at 15:23 +0000, Mark Brown wrote:
> On Thu, Dec 01, 2022 at 03:06:04PM +0000, Jiaxin Yu (俞家鑫) wrote:
> > On Tue, 2022-11-29 at 17:22 +0000, Mark Brown wrote:
> > > static const struct snd_kcontrol_new
> > > mt8186_mt6366_rt1019_rt5682s_controls[] = {
> > > SOC_DAPM_PIN_SWITCH("Speakers"),
> > > SOC_DAPM_PIN_SWITCH("Headphone"),
> > > SOC_DAPM_PIN_SWITCH("Headset Mic"),
> > > SOC_DAPM_PIN_SWITCH("HDMI1"),
> > > };
> > Which operation should I use to inform bridge driver to control
> > audio
> > on or off? I'm curious why I don't see .trigger in the structure
> > hdmi_codec_ops compared to the structure snd_soc_dai_ops?
>
> You'd need to add a callback that the user of hdmi-codec passes in
> which
> would be triggered by an event on a DAPM widget added in the audio
> path
> rather than trying to shoehorn this into a PCM operation - a big part
> of
> the problem here is that you're trying to add something that doesn't
> fit
> into a PCM operation.
Dear Mark,
1. I have added a DAPM widget that is "SDB", when we open or close HDMI
PIN_SWITCH, the callback 'hdmi_tx_event' registered in the widget will
be triggered. Maybe you mean I shouldn't use SNDRV_PCM_TRIGGER_START
and SNDRV_PCM_TRIGGER_STOP?
2. If I don't use hcd.ops->trigger notifies the bridge ic driver to
switch the audio, which ops should I use?
I actually want to know hdmi-codec.c and it6505.c except
hdmi_codec_ops, is there any other way to communicate?
My understanding is not deep enough, so please help explain more in
detail, thank you very much!
+static int hdmi_tx_event(struct snd_soc_dapm_widget *w,
+ struct snd_kcontrol *kcontrol, int event)
+{
+ struct snd_soc_component *component =
snd_soc_dapm_to_component(w->dapm);
+ struct hdmi_codec_priv *hcp =
snd_soc_component_get_drvdata(component);
+
+ switch (event) {
+ case SND_SOC_DAPM_PRE_PMU:
+ if (hcp->hcd.ops->trigger)
+ hcp->hcd.ops->trigger(component->dev->parent,
SNDRV_PCM_TRIGGER_START);
+ break;
+ case SND_SOC_DAPM_POST_PMD:
+ if (hcp->hcd.ops->trigger)
+ hcp->hcd.ops->trigger(component->dev->parent,
SNDRV_PCM_TRIGGER_STOP);
+ break;
+ default:
+ break;
+ }
+
+ return 0;
+}
+
static const struct snd_soc_dapm_widget hdmi_widgets[] = {
+ SND_SOC_DAPM_OUT_DRV_E("SDB", SND_SOC_NOPM, 0, 0, NULL, 0,
hdmi_tx_event,
+ SND_SOC_DAPM_POST_PMD |
SND_SOC_DAPM_PRE_PMU),
SND_SOC_DAPM_OUTPUT("TX"),
SND_SOC_DAPM_OUTPUT("RX"),
};
</pre><!--type:text--><!--{--><pre>************* MEDIATEK Confidentiality Notice ********************
The information contained in this e-mail message (including any
attachments) may be confidential, proprietary, privileged, or otherwise
exempt from disclosure under applicable laws. It is intended to be
conveyed only to the designated recipient(s). Any use, dissemination,
distribution, printing, retaining or copying of this e-mail (including its
attachments) by unintended recipient(s) is strictly prohibited and may
be unlawful. If you are not an intended recipient of this e-mail, or believe
that you have received this e-mail in error, please notify the sender
immediately (by replying to this e-mail), delete any and all copies of
this e-mail (including any attachments) from your system, and do not
disclose the content of this e-mail to any other person. Thank you!
</pre><!--}-->