@@ -3377,7 +3377,7 @@ static int wm8962_probe(struct snd_soc_codec *codec)
3377
3377
int ret ;
3378
3378
struct wm8962_priv * wm8962 = snd_soc_codec_get_drvdata (codec );
3379
3379
struct wm8962_pdata * pdata = & wm8962 -> pdata ;
3380
- int i , trigger , irq_pol ;
3380
+ int i ;
3381
3381
bool dmicclk , dmicdat ;
3382
3382
3383
3383
wm8962 -> codec = codec ;
@@ -3506,36 +3506,6 @@ static int wm8962_probe(struct snd_soc_codec *codec)
3506
3506
wm8962_init_beep (codec );
3507
3507
wm8962_init_gpio (codec );
3508
3508
3509
- if (wm8962 -> irq ) {
3510
- if (pdata -> irq_active_low ) {
3511
- trigger = IRQF_TRIGGER_LOW ;
3512
- irq_pol = WM8962_IRQ_POL ;
3513
- } else {
3514
- trigger = IRQF_TRIGGER_HIGH ;
3515
- irq_pol = 0 ;
3516
- }
3517
-
3518
- snd_soc_update_bits (codec , WM8962_INTERRUPT_CONTROL ,
3519
- WM8962_IRQ_POL , irq_pol );
3520
-
3521
- ret = request_threaded_irq (wm8962 -> irq , NULL , wm8962_irq ,
3522
- trigger | IRQF_ONESHOT ,
3523
- "wm8962" , codec -> dev );
3524
- if (ret != 0 ) {
3525
- dev_err (codec -> dev , "Failed to request IRQ %d: %d\n" ,
3526
- wm8962 -> irq , ret );
3527
- wm8962 -> irq = 0 ;
3528
- /* Non-fatal */
3529
- } else {
3530
- /* Enable some IRQs by default */
3531
- snd_soc_update_bits (codec ,
3532
- WM8962_INTERRUPT_STATUS_2_MASK ,
3533
- WM8962_FLL_LOCK_EINT |
3534
- WM8962_TEMP_SHUT_EINT |
3535
- WM8962_FIFOS_ERR_EINT , 0 );
3536
- }
3537
- }
3538
-
3539
3509
return 0 ;
3540
3510
}
3541
3511
@@ -3544,9 +3514,6 @@ static int wm8962_remove(struct snd_soc_codec *codec)
3544
3514
struct wm8962_priv * wm8962 = snd_soc_codec_get_drvdata (codec );
3545
3515
int i ;
3546
3516
3547
- if (wm8962 -> irq )
3548
- free_irq (wm8962 -> irq , codec );
3549
-
3550
3517
cancel_delayed_work_sync (& wm8962 -> mic_work );
3551
3518
3552
3519
wm8962_free_gpio (codec );
@@ -3619,7 +3586,7 @@ static int wm8962_i2c_probe(struct i2c_client *i2c,
3619
3586
struct wm8962_pdata * pdata = dev_get_platdata (& i2c -> dev );
3620
3587
struct wm8962_priv * wm8962 ;
3621
3588
unsigned int reg ;
3622
- int ret , i ;
3589
+ int ret , i , irq_pol , trigger ;
3623
3590
3624
3591
wm8962 = devm_kzalloc (& i2c -> dev , sizeof (struct wm8962_priv ),
3625
3592
GFP_KERNEL );
@@ -3714,6 +3681,37 @@ static int wm8962_i2c_probe(struct i2c_client *i2c,
3714
3681
ret );
3715
3682
}
3716
3683
3684
+ if (wm8962 -> irq ) {
3685
+ if (pdata -> irq_active_low ) {
3686
+ trigger = IRQF_TRIGGER_LOW ;
3687
+ irq_pol = WM8962_IRQ_POL ;
3688
+ } else {
3689
+ trigger = IRQF_TRIGGER_HIGH ;
3690
+ irq_pol = 0 ;
3691
+ }
3692
+
3693
+ regmap_update_bits (wm8962 -> regmap , WM8962_INTERRUPT_CONTROL ,
3694
+ WM8962_IRQ_POL , irq_pol );
3695
+
3696
+ ret = devm_request_threaded_irq (& i2c -> dev , wm8962 -> irq , NULL ,
3697
+ wm8962_irq ,
3698
+ trigger | IRQF_ONESHOT ,
3699
+ "wm8962" , & i2c -> dev );
3700
+ if (ret != 0 ) {
3701
+ dev_err (& i2c -> dev , "Failed to request IRQ %d: %d\n" ,
3702
+ wm8962 -> irq , ret );
3703
+ wm8962 -> irq = 0 ;
3704
+ /* Non-fatal */
3705
+ } else {
3706
+ /* Enable some IRQs by default */
3707
+ regmap_update_bits (wm8962 -> regmap ,
3708
+ WM8962_INTERRUPT_STATUS_2_MASK ,
3709
+ WM8962_FLL_LOCK_EINT |
3710
+ WM8962_TEMP_SHUT_EINT |
3711
+ WM8962_FIFOS_ERR_EINT , 0 );
3712
+ }
3713
+ }
3714
+
3717
3715
pm_runtime_enable (& i2c -> dev );
3718
3716
pm_request_idle (& i2c -> dev );
3719
3717
0 commit comments