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

From: Mark Brown
Date: Thu Feb 22 2024 - 13:51:49 EST


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.

> 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.

Attachment: signature.asc
Description: PGP signature