ASoC: imx-es8328: Map missing jack kcontrols
This driver does not properly map jack pins to kcontrols that PulseAudio and PipeWire need to handle jack detection events. It seems to have a single detection GPIO pin used to report everything as a Headset. But it has widgets for Headphone and Mic Jack, so expose both to userspace as kcontrols. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Link: https://lore.kernel.org/r/20230802175737.263412-12-alpernebiyasak@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
7265089ade
commit
105e84586b
@ -37,6 +37,16 @@ static struct snd_soc_jack_gpio headset_jack_gpios[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static struct snd_soc_jack headset_jack;
|
static struct snd_soc_jack headset_jack;
|
||||||
|
static struct snd_soc_jack_pin headset_jack_pins[] = {
|
||||||
|
{
|
||||||
|
.pin = "Headphone",
|
||||||
|
.mask = SND_JACK_HEADPHONE,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.pin = "Mic Jack",
|
||||||
|
.mask = SND_JACK_MICROPHONE,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
static int imx_es8328_dai_init(struct snd_soc_pcm_runtime *rtd)
|
static int imx_es8328_dai_init(struct snd_soc_pcm_runtime *rtd)
|
||||||
{
|
{
|
||||||
@ -46,9 +56,11 @@ static int imx_es8328_dai_init(struct snd_soc_pcm_runtime *rtd)
|
|||||||
|
|
||||||
/* Headphone jack detection */
|
/* Headphone jack detection */
|
||||||
if (gpio_is_valid(data->jack_gpio)) {
|
if (gpio_is_valid(data->jack_gpio)) {
|
||||||
ret = snd_soc_card_jack_new(rtd->card, "Headphone",
|
ret = snd_soc_card_jack_new_pins(rtd->card, "Headphone",
|
||||||
SND_JACK_HEADPHONE | SND_JACK_BTN_0,
|
SND_JACK_HEADSET | SND_JACK_BTN_0,
|
||||||
&headset_jack);
|
&headset_jack,
|
||||||
|
headset_jack_pins,
|
||||||
|
ARRAY_SIZE(headset_jack_pins));
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
@ -68,6 +80,11 @@ static const struct snd_soc_dapm_widget imx_es8328_dapm_widgets[] = {
|
|||||||
SND_SOC_DAPM_REGULATOR_SUPPLY("audio-amp", 1, 0),
|
SND_SOC_DAPM_REGULATOR_SUPPLY("audio-amp", 1, 0),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const struct snd_kcontrol_new imx_es8328_controls[] = {
|
||||||
|
SOC_DAPM_PIN_SWITCH("Headphone"),
|
||||||
|
SOC_DAPM_PIN_SWITCH("Mic Jack"),
|
||||||
|
};
|
||||||
|
|
||||||
static int imx_es8328_probe(struct platform_device *pdev)
|
static int imx_es8328_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct device_node *np = pdev->dev.of_node;
|
struct device_node *np = pdev->dev.of_node;
|
||||||
@ -183,6 +200,8 @@ static int imx_es8328_probe(struct platform_device *pdev)
|
|||||||
data->card.dev = dev;
|
data->card.dev = dev;
|
||||||
data->card.dapm_widgets = imx_es8328_dapm_widgets;
|
data->card.dapm_widgets = imx_es8328_dapm_widgets;
|
||||||
data->card.num_dapm_widgets = ARRAY_SIZE(imx_es8328_dapm_widgets);
|
data->card.num_dapm_widgets = ARRAY_SIZE(imx_es8328_dapm_widgets);
|
||||||
|
data->card.controls = imx_es8328_controls;
|
||||||
|
data->card.num_controls = ARRAY_SIZE(imx_es8328_controls);
|
||||||
ret = snd_soc_of_parse_card_name(&data->card, "model");
|
ret = snd_soc_of_parse_card_name(&data->card, "model");
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(dev, "Unable to parse card name\n");
|
dev_err(dev, "Unable to parse card name\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user