提交 c1bef204 编写于 作者: A Amadeusz Sławiński 提交者: Greg Kroah-Hartman

SoC: rt274: Fix internal jack assignment in set_jack callback

[ Upstream commit 04268bf2757a125616b6c2140e6250f43b7b737a ]

When we call snd_soc_component_set_jack(component, NULL, NULL) we should
set rt274->jack to passed jack, so when interrupt is triggered it calls
snd_soc_jack_report(rt274->jack, ...) with proper value.

This fixes problem in machine where in register, we call
snd_soc_register(component, &headset, NULL), which just calls
rt274_mic_detect via callback.
Now when machine driver is removed "headset" will be gone, so we
need to tell codec driver that it's gone with:
snd_soc_register(component, NULL, NULL), but we also need to be able
to handle NULL jack argument here gracefully.
If we don't set it to NULL, next time the rt274_irq runs it will call
snd_soc_jack_report with first argument being invalid pointer and there
will be Oops.
Signed-off-by: NAmadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: NMark Brown <broonie@kernel.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
上级 1023af0c
...@@ -398,6 +398,8 @@ static int rt274_mic_detect(struct snd_soc_component *component, ...@@ -398,6 +398,8 @@ static int rt274_mic_detect(struct snd_soc_component *component,
{ {
struct rt274_priv *rt274 = snd_soc_component_get_drvdata(component); struct rt274_priv *rt274 = snd_soc_component_get_drvdata(component);
rt274->jack = jack;
if (jack == NULL) { if (jack == NULL) {
/* Disable jack detection */ /* Disable jack detection */
regmap_update_bits(rt274->regmap, RT274_EAPD_GPIO_IRQ_CTRL, regmap_update_bits(rt274->regmap, RT274_EAPD_GPIO_IRQ_CTRL,
...@@ -405,7 +407,6 @@ static int rt274_mic_detect(struct snd_soc_component *component, ...@@ -405,7 +407,6 @@ static int rt274_mic_detect(struct snd_soc_component *component,
return 0; return 0;
} }
rt274->jack = jack;
regmap_update_bits(rt274->regmap, RT274_EAPD_GPIO_IRQ_CTRL, regmap_update_bits(rt274->regmap, RT274_EAPD_GPIO_IRQ_CTRL,
RT274_IRQ_EN, RT274_IRQ_EN); RT274_IRQ_EN, RT274_IRQ_EN);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册