Skip to content

Commit b35a9ab

Browse files
jwrdegoedebroonie
authored andcommitted
ASoC: rt5640: Allow snd_soc_component_set_jack() to override the codec IRQ
On some boards where the firmware/fwnode information is in essence read-only (x86 + ACPI boards) the i2c_client for the codec may contain the wrong IRQ or no IRQ at all. Since we only request the IRQ once snd_soc_component_set_jack() gets called, allow machine drivers to override the IRQ with the proper one through the data parameter to snd_soc_component_set_jack(). Signed-off-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent a3b1aaf commit b35a9ab

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

sound/soc/codecs/rt5640.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2452,7 +2452,8 @@ static void rt5640_disable_jack_detect(struct snd_soc_component *component)
24522452
}
24532453

24542454
static void rt5640_enable_jack_detect(struct snd_soc_component *component,
2455-
struct snd_soc_jack *jack)
2455+
struct snd_soc_jack *jack,
2456+
struct rt5640_set_jack_data *jack_data)
24562457
{
24572458
struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component);
24582459
int ret;
@@ -2496,6 +2497,9 @@ static void rt5640_enable_jack_detect(struct snd_soc_component *component,
24962497
rt5640_enable_micbias1_ovcd_irq(component);
24972498
}
24982499

2500+
if (jack_data && jack_data->codec_irq_override)
2501+
rt5640->irq = jack_data->codec_irq_override;
2502+
24992503
ret = request_irq(rt5640->irq, rt5640_irq,
25002504
IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
25012505
"rt5640", rt5640);
@@ -2558,7 +2562,7 @@ static int rt5640_set_jack(struct snd_soc_component *component,
25582562
if (rt5640->jd_src == RT5640_JD_SRC_HDA_HEADER)
25592563
rt5640_enable_hda_jack_detect(component, jack);
25602564
else
2561-
rt5640_enable_jack_detect(component, jack);
2565+
rt5640_enable_jack_detect(component, jack, data);
25622566
} else {
25632567
rt5640_disable_jack_detect(component);
25642568
}

sound/soc/codecs/rt5640.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2153,6 +2153,10 @@ struct rt5640_priv {
21532153
unsigned int ovcd_sf;
21542154
};
21552155

2156+
struct rt5640_set_jack_data {
2157+
int codec_irq_override;
2158+
};
2159+
21562160
int rt5640_dmic_enable(struct snd_soc_component *component,
21572161
bool dmic1_data_pin, bool dmic2_data_pin);
21582162
int rt5640_sel_asrc_clk_src(struct snd_soc_component *component,

0 commit comments

Comments
 (0)