diff mbox series

[2/5] ASoC: rt5640: Allow snd_soc_component_set_jack() to override the codec IRQ

Message ID 20211227153344.155803-2-hdegoede@redhat.com (mailing list archive)
State New, archived
Headers show
Series [1/5] ASoC: rt5640: Change jack_work to a delayed_work | expand

Commit Message

Hans de Goede Dec. 27, 2021, 3:33 p.m. UTC
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 <hdegoede@redhat.com>
---
 sound/soc/codecs/rt5640.c | 8 ++++++--
 sound/soc/codecs/rt5640.h | 4 ++++
 2 files changed, 10 insertions(+), 2 deletions(-)

Comments

Mark Brown Dec. 31, 2021, 1:22 p.m. UTC | #1
On Mon, Dec 27, 2021 at 04:33:41PM +0100, Hans de Goede wrote:
> 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.

This doesn't apply against current code, please check and resend.
Hans de Goede Jan. 5, 2022, 12:22 p.m. UTC | #2
Hi,

On 12/31/21 14:22, Mark Brown wrote:
> On Mon, Dec 27, 2021 at 04:33:41PM +0100, Hans de Goede wrote:
>> 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.
> 
> This doesn't apply against current code, please check and resend.

Ok, I will send a v2 rebased on top of broonie/sound.git/for-next

Regards,

Hans
diff mbox series

Patch

diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c
index 36c00ad17182..5244b6f7de84 100644
--- a/sound/soc/codecs/rt5640.c
+++ b/sound/soc/codecs/rt5640.c
@@ -2419,7 +2419,8 @@  static void rt5640_disable_jack_detect(struct snd_soc_component *component)
 }
 
 static void rt5640_enable_jack_detect(struct snd_soc_component *component,
-				      struct snd_soc_jack *jack)
+				      struct snd_soc_jack *jack,
+				      struct rt5640_set_jack_data *jack_data)
 {
 	struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component);
 	int ret;
@@ -2463,6 +2464,9 @@  static void rt5640_enable_jack_detect(struct snd_soc_component *component,
 		rt5640_enable_micbias1_ovcd_irq(component);
 	}
 
+	if (jack_data && jack_data->codec_irq_override)
+		rt5640->irq = jack_data->codec_irq_override;
+
 	ret = request_irq(rt5640->irq, rt5640_irq,
 			  IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
 			  "rt5640", rt5640);
@@ -2482,7 +2486,7 @@  static int rt5640_set_jack(struct snd_soc_component *component,
 			   struct snd_soc_jack *jack, void *data)
 {
 	if (jack)
-		rt5640_enable_jack_detect(component, jack);
+		rt5640_enable_jack_detect(component, jack, data);
 	else
 		rt5640_disable_jack_detect(component);
 
diff --git a/sound/soc/codecs/rt5640.h b/sound/soc/codecs/rt5640.h
index 7ab930def8dd..2f4da5a8ecb2 100644
--- a/sound/soc/codecs/rt5640.h
+++ b/sound/soc/codecs/rt5640.h
@@ -2153,6 +2153,10 @@  struct rt5640_priv {
 	unsigned int ovcd_sf;
 };
 
+struct rt5640_set_jack_data {
+	int codec_irq_override;
+};
+
 int rt5640_dmic_enable(struct snd_soc_component *component,
 		       bool dmic1_data_pin, bool dmic2_data_pin);
 int rt5640_sel_asrc_clk_src(struct snd_soc_component *component,