[PATCH] ASoC: ts3a227e: allow enabling the jack detect in driver

Mark Brown broonie at kernel.org
Fri Sep 9 19:45:25 CEST 2022


On Fri, Sep 09, 2022 at 11:30:01AM +0200, Astrid Rost wrote:

> ti,jack-detect enables the jack detection input device

New properties need to be documented, I'm happy for that to be in the
existing document though obviously a conversion to YAML would be very
much appreciated.  However...

> +	if (enable) {
> +		/* Enable Headset and 4 Buttons Jack detection */
> +		ts3a227e->jack = devm_kzalloc(component->dev,
> +				sizeof(struct snd_soc_jack), GFP_KERNEL);
> +
> +		ret = snd_soc_card_jack_new_pins(card, "Headset Jack",
> +					    SND_JACK_HEADSET |
> +					    SND_JACK_BTN_0 | SND_JACK_BTN_1 |
> +					    SND_JACK_BTN_2 | SND_JACK_BTN_3,
> +					    ts3a227e->jack,
> +					    ts3a227e_jack_pins,
> +					    ARRAY_SIZE(ts3a227e_jack_pins));
> +		if (ret)
> +			return ret;
> +
> +		ret = ts3a227e_enable_jack_detect(component, ts3a227e->jack);
> +	}

...this is something that should be done in the machine driver rather
than the CODEC, the way the device is wired up in an individual system
may be surprising or the system may have some more specific labelling
that can be usefully applied so this is all deferred to the card.

It would sense to convert ts3a277e_enable_jack_detect() to be a
component set_jack() operation, that'd enable it to be used more easily
with generic cards (though I see that it's not yet wired up for
audio-graph-card unfortunately).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20220909/311741b5/attachment.sig>


More information about the Alsa-devel mailing list