mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Jiaxin Yu (俞家鑫)" <Jiaxin.Yu@mediatek.com>
To: "broonie@kernel.org" <broonie@kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"ajye_huang@compal.corp-partner.google.com"
	<ajye_huang@compal.corp-partner.google.com>,
	"Chunxu Li (李春旭)" <Chunxu.Li@mediatek.com>,
	"Allen-KH Cheng (程冠勳)" <Allen-KH.Cheng@mediatek.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"kuninori.morimoto.gx@renesas.com"
	<kuninori.morimoto.gx@renesas.com>,
	"andrzej.hajda@intel.com" <andrzej.hajda@intel.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	Project_Global_Chrome_Upstream_Group
	<Project_Global_Chrome_Upstream_Group@mediatek.com>,
	"robert.foss@linaro.org" <robert.foss@linaro.org>,
	"Laurent.pinchart@ideasonboard.com"
	<Laurent.pinchart@ideasonboard.com>,
	"neil.armstrong@linaro.org" <neil.armstrong@linaro.org>,
	"angelogioacchino.delregno@collabora.com"
	<angelogioacchino.delregno@collabora.com>,
	"nfraprado@collabora.com" <nfraprado@collabora.com>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>
Subject: Re: [PATCH v2 1/3] ASoC: hdmi-codec: Add event handler for hdmi TX
Date: Mon, 5 Dec 2022 09:34:17 +0000	[thread overview]
Message-ID: <7023a2c7b471d6888d9079563a6c01f22599201f.camel@mediatek.com> (raw)
In-Reply-To: <Y4jHAJgmz/P58Q/C@sirena.org.uk>

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"),
 };

  reply	other threads:[~2022-12-05  9:35 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-25  9:44 [PATCH v2 0/3] ASoC: mediatek:mt8186: fix both the speaker and hdmi Jiaxin Yu
2022-11-25  9:44 ` [PATCH v2 1/3] ASoC: hdmi-codec: Add event handler for hdmi TX Jiaxin Yu
2022-11-25 12:18   ` Mark Brown
2022-11-28 15:07     ` Jiaxin Yu (俞家鑫)
2022-11-29 17:22       ` Mark Brown
2022-12-01 15:06         ` Jiaxin Yu (俞家鑫)
2022-12-01 15:23           ` Mark Brown
2022-12-05  9:34             ` Jiaxin Yu (俞家鑫) [this message]
2022-12-05 12:07               ` Mark Brown
2022-12-13 14:23                 ` Jiaxin Yu (俞家鑫)
2022-12-13 16:35                   ` Mark Brown
2024-12-01 17:15                     ` Jiaxin Yu (俞家鑫)
2024-12-02 13:16                       ` Mark Brown
2024-12-06 15:39                         ` Jiaxin Yu (俞家鑫)
2024-12-06 16:06                           ` Mark Brown
2022-11-25  9:44 ` [PATCH v2 2/3] ASoC: mediatek: mt8186: correct the HDMI widgets Jiaxin Yu
2022-11-25  9:44 ` [PATCH v2 3/3] drm/bridge: it6505: Add audio support Jiaxin Yu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7023a2c7b471d6888d9079563a6c01f22599201f.camel@mediatek.com \
    --to=jiaxin.yu@mediatek.com \
    --cc=Allen-KH.Cheng@mediatek.com \
    --cc=Chunxu.Li@mediatek.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
    --cc=ajye_huang@compal.corp-partner.google.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=andrzej.hajda@intel.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=broonie@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=neil.armstrong@linaro.org \
    --cc=nfraprado@collabora.com \
    --cc=robert.foss@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®