Re: [PATCH v2 1/3] ASoC: hdmi-codec: Add event handler for hdmi TX

From: Jiaxin Yu (俞家鑫)
Date: Mon Nov 28 2022 - 10:08:24 EST


On Fri, 2022-11-25 at 12:18 +0000, Mark Brown wrote:
> On Fri, Nov 25, 2022 at 05:44:11PM +0800, Jiaxin Yu wrote:
>
> > + /*
> > + * PCM trigger callback.
> > + * Mandatory
> > + */
> > + int (*trigger)(struct device *dev, int cmd);
> > +
>
> Making this mandatory would break all existing users, though...
>
Yes, it should be described as optional.

> > + switch (event) {
> > + case SND_SOC_DAPM_PRE_PMU:
> > + if (hcp->hcd.ops->trigger)
> > + hcp->hcd.ops->trigger(component->dev->parent,
> > SNDRV_PCM_TRIGGER_START);
>
> ..it's not actually mandatory so it's just the comment that's wrong.

Agreed.

> I'm a little unclear why this is being implemented as a DAPM
> operation
> rather than having the driver forward the PCM trigger op if it's
> needed?
> Or alternatively if a DAPM callback is needed why not provide one
> directly rather than hooking into the trigger function - that's going
> to
> be called out of sequence with the rest of DAPM and be potentially
> confusing given the very different environments that trigger and DAPM
> operations run in. A quick glance at the it6505 driver suggests it'd
> be
> happier with a DAPM callback.

Let me describe the hardware connection about mt8186 with it6505(hdmi)
and rt1015p(speakers).

==>it6505
=
DL1(FE) ==>I2S3(BE) =
=
==>rt1015p

They shared the same one i2s port, but we'd like to control them
separately. So if hdmi-codec use the PCM trigger op, whne we turn on
the speaker, hdmi-codec's PCM trigger op is also executed, resulting in
sound on both devices.
Is there another way to control them separately? Thank you.