Patch "ASoC: rt5640: Do not disable/enable IRQ twice on suspend/resume" has been added to the 6.5-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ASoC: rt5640: Do not disable/enable IRQ twice on suspend/resume

to the 6.5-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     asoc-rt5640-do-not-disable-enable-irq-twice-on-suspe.patch
and it can be found in the queue-6.5 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 50decf700276dadc233c02ede3f10481cb27f8c0
Author: Hans de Goede <hdegoede@xxxxxxxxxx>
Date:   Tue Sep 12 13:32:42 2023 +0200

    ASoC: rt5640: Do not disable/enable IRQ twice on suspend/resume
    
    [ Upstream commit 786120ebb649b166021f0212250e8627e53d068a ]
    
    When jack-detect was originally added disabling the IRQ during suspend
    was done by the sound/soc/intel/boards/bytcr_rt5640.c driver
    calling snd_soc_component_set_jack(NULL) on suspend, which calls
    rt5640_disable_jack_detect(), which calls free_irq() which also
    disables it.
    
    Commit 5fabcc90e79b ("ASoC: rt5640: Fix Jack work after system suspend")
    added disable_irq() / enable_irq() calls on suspend/resume for machine
    drivers which do not call snd_soc_component_set_jack(NULL) on suspend.
    
    The new disable_irq() / enable_irq() are made conditional by
    "if (rt5640->irq)" statements, but this is true for the machine drivers
    which do call snd_soc_component_set_jack(NULL) on suspend too, causing
    a disable_irq() call there on the already free-ed IRQ.
    
    Change the "if (rt5640->irq)" condition to "if (rt5640->jack)" to fix this,
    rt5640->jack is only set if the jack-detect IRQ handler is still active
    when rt5640_suspend() runs.
    
    And adjust rt5640_enable_hda_jack_detect()'s request_irq() error handling
    to set rt5640->jack to NULL to match (note that the old setting of irq to
    -ENOXIO still resulted in disable_irq(-ENOXIO) calls on suspend).
    
    Fixes: 5fabcc90e79b ("ASoC: rt5640: Fix Jack work after system suspend")
    Cc: Oder Chiou <oder_chiou@xxxxxxxxxxx>
    Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230912113245.320159-4-hdegoede@xxxxxxxxxx
    Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c
index 10086755ae82c..c2c82da36c625 100644
--- a/sound/soc/codecs/rt5640.c
+++ b/sound/soc/codecs/rt5640.c
@@ -2623,7 +2623,7 @@ static void rt5640_enable_hda_jack_detect(
 			  IRQF_TRIGGER_RISING | IRQF_ONESHOT, "rt5640", rt5640);
 	if (ret) {
 		dev_warn(component->dev, "Failed to request IRQ %d: %d\n", rt5640->irq, ret);
-		rt5640->irq = -ENXIO;
+		rt5640->jack = NULL;
 		return;
 	}
 
@@ -2798,7 +2798,7 @@ static int rt5640_suspend(struct snd_soc_component *component)
 {
 	struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component);
 
-	if (rt5640->irq) {
+	if (rt5640->jack) {
 		/* disable jack interrupts during system suspend */
 		disable_irq(rt5640->irq);
 	}
@@ -2826,10 +2826,9 @@ static int rt5640_resume(struct snd_soc_component *component)
 	regcache_cache_only(rt5640->regmap, false);
 	regcache_sync(rt5640->regmap);
 
-	if (rt5640->irq)
+	if (rt5640->jack) {
 		enable_irq(rt5640->irq);
 
-	if (rt5640->jack) {
 		if (rt5640->jd_src == RT5640_JD_SRC_HDA_HEADER) {
 			snd_soc_component_update_bits(component,
 				RT5640_DUMMY2, 0x1100, 0x1100);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux