Re: [PATCH 4/4] ASoC: sun8i-codec: Implement jack and accessory detection

From: Ondřej Jirman
Date: Thu Feb 22 2024 - 15:18:27 EST


Hello Mark,

On Thu, Feb 22, 2024 at 06:41:13PM +0000, Mark Brown wrote:
> On Thu, Feb 22, 2024 at 07:18:47PM +0100, Ondřej Jirman wrote:
>
> > +static struct snd_soc_jack_pin sun8i_codec_jack_pins[] = {
> > + {
> > + .pin = "Headphone Jack",
> > + .mask = SND_JACK_HEADPHONE,
> > + },
> > + {
> > + .pin = "Headset Microphone",
> > + .mask = SND_JACK_MICROPHONE,
> > + },
> > +};
> > +
>
> The jack being a headset jack is going to be system specific isn't it?
> Some systems might have separate headphone and microphone jacks. I'd
> not expect to see any pin handling code at all in a CODEC driver, that
> belongs in the machine driver.

Yeah, the only reason this and the card reference seems to be here is to
check whether jack detection should be enabled and in what capacity.

Looks like there's some set_jack component callback for that. :)

I'll look into that.

kind regards,
o.

> > static int sun8i_codec_component_probe(struct snd_soc_component *component)
> > {
> > struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
> > struct sun8i_codec *scodec = snd_soc_component_get_drvdata(component);
> > int ret;
> >
> > + scodec->card = component->card;
> > +
>
> The fact that you're needing to look at the card here should be a bit of
> a warning sign there.