@@ -2403,13 +2403,11 @@ static irqreturn_t rt5640_irq(int irq, void *data)
24032403 struct rt5640_priv * rt5640 = data ;
24042404 int delay = 0 ;
24052405
2406- if (rt5640 -> jd_src == RT5640_JD_SRC_HDA_HEADER ) {
2407- cancel_delayed_work_sync (& rt5640 -> jack_work );
2406+ if (rt5640 -> jd_src == RT5640_JD_SRC_HDA_HEADER )
24082407 delay = 100 ;
2409- }
24102408
24112409 if (rt5640 -> jack )
2412- queue_delayed_work (system_long_wq , & rt5640 -> jack_work , delay );
2410+ mod_delayed_work (system_long_wq , & rt5640 -> jack_work , delay );
24132411
24142412 return IRQ_HANDLED ;
24152413}
@@ -2565,10 +2563,9 @@ static void rt5640_enable_jack_detect(struct snd_soc_component *component,
25652563 if (jack_data && jack_data -> use_platform_clock )
25662564 rt5640 -> use_platform_clock = jack_data -> use_platform_clock ;
25672565
2568- ret = devm_request_threaded_irq (component -> dev , rt5640 -> irq ,
2569- NULL , rt5640_irq ,
2570- IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT ,
2571- "rt5640" , rt5640 );
2566+ ret = request_irq (rt5640 -> irq , rt5640_irq ,
2567+ IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT ,
2568+ "rt5640" , rt5640 );
25722569 if (ret ) {
25732570 dev_warn (component -> dev , "Failed to request IRQ %d: %d\n" , rt5640 -> irq , ret );
25742571 rt5640_disable_jack_detect (component );
@@ -2621,14 +2618,14 @@ static void rt5640_enable_hda_jack_detect(
26212618
26222619 rt5640 -> jack = jack ;
26232620
2624- ret = devm_request_threaded_irq (component -> dev , rt5640 -> irq ,
2625- NULL , rt5640_irq , IRQF_TRIGGER_RISING | IRQF_ONESHOT ,
2626- "rt5640" , rt5640 );
2621+ ret = request_irq (rt5640 -> irq , rt5640_irq ,
2622+ IRQF_TRIGGER_RISING | IRQF_ONESHOT , "rt5640" , rt5640 );
26272623 if (ret ) {
26282624 dev_warn (component -> dev , "Failed to request IRQ %d: %d\n" , rt5640 -> irq , ret );
2629- rt5640 -> irq = - ENXIO ;
2625+ rt5640 -> jack = NULL ;
26302626 return ;
26312627 }
2628+ rt5640 -> irq_requested = true;
26322629
26332630 /* sync initial jack state */
26342631 queue_delayed_work (system_long_wq , & rt5640 -> jack_work , 0 );
@@ -2801,12 +2798,12 @@ static int rt5640_suspend(struct snd_soc_component *component)
28012798{
28022799 struct rt5640_priv * rt5640 = snd_soc_component_get_drvdata (component );
28032800
2804- if (rt5640 -> irq ) {
2801+ if (rt5640 -> jack ) {
28052802 /* disable jack interrupts during system suspend */
28062803 disable_irq (rt5640 -> irq );
2804+ rt5640_cancel_work (rt5640 );
28072805 }
28082806
2809- rt5640_cancel_work (rt5640 );
28102807 snd_soc_component_force_bias_level (component , SND_SOC_BIAS_OFF );
28112808 rt5640_reset (component );
28122809 regcache_cache_only (rt5640 -> regmap , true);
@@ -2829,9 +2826,6 @@ static int rt5640_resume(struct snd_soc_component *component)
28292826 regcache_cache_only (rt5640 -> regmap , false);
28302827 regcache_sync (rt5640 -> regmap );
28312828
2832- if (rt5640 -> irq )
2833- enable_irq (rt5640 -> irq );
2834-
28352829 if (rt5640 -> jack ) {
28362830 if (rt5640 -> jd_src == RT5640_JD_SRC_HDA_HEADER ) {
28372831 snd_soc_component_update_bits (component ,
@@ -2859,6 +2853,7 @@ static int rt5640_resume(struct snd_soc_component *component)
28592853 }
28602854 }
28612855
2856+ enable_irq (rt5640 -> irq );
28622857 queue_delayed_work (system_long_wq , & rt5640 -> jack_work , 0 );
28632858 }
28642859
0 commit comments