@@ -523,7 +523,8 @@ static int es8326_mute(struct snd_soc_dai *dai, int mute, int direction)
523
523
regmap_write (es8326 -> regmap , ES8326_HP_CAL , ES8326_HP_OFF );
524
524
regmap_update_bits (es8326 -> regmap , ES8326_DAC_MUTE ,
525
525
ES8326_MUTE_MASK , ES8326_MUTE );
526
- regmap_write (es8326 -> regmap , ES8326_HP_DRIVER , 0xf0 );
526
+ regmap_update_bits (es8326 -> regmap , ES8326_HP_DRIVER_REF ,
527
+ 0x30 , 0x00 );
527
528
} else {
528
529
if (!es8326 -> calibrated ) {
529
530
regmap_write (es8326 -> regmap , ES8326_HP_CAL , ES8326_HP_FORCE_CAL );
@@ -536,8 +537,13 @@ static int es8326_mute(struct snd_soc_dai *dai, int mute, int direction)
536
537
regmap_write (es8326 -> regmap , ES8326_HPR_OFFSET_INI , offset_r );
537
538
es8326 -> calibrated = true;
538
539
}
540
+ regmap_update_bits (es8326 -> regmap , ES8326_DAC_DSM , 0x01 , 0x01 );
541
+ usleep_range (1000 , 5000 );
542
+ regmap_update_bits (es8326 -> regmap , ES8326_DAC_DSM , 0x01 , 0x00 );
543
+ usleep_range (1000 , 5000 );
544
+ regmap_update_bits (es8326 -> regmap , ES8326_HP_DRIVER_REF , 0x30 , 0x20 );
545
+ regmap_update_bits (es8326 -> regmap , ES8326_HP_DRIVER_REF , 0x30 , 0x30 );
539
546
regmap_write (es8326 -> regmap , ES8326_HP_DRIVER , 0xa1 );
540
- regmap_write (es8326 -> regmap , ES8326_HP_VOL , 0x91 );
541
547
regmap_write (es8326 -> regmap , ES8326_HP_CAL , ES8326_HP_ON );
542
548
regmap_update_bits (es8326 -> regmap , ES8326_DAC_MUTE ,
543
549
ES8326_MUTE_MASK , ~(ES8326_MUTE ));
@@ -557,23 +563,20 @@ static int es8326_set_bias_level(struct snd_soc_component *codec,
557
563
if (ret )
558
564
return ret ;
559
565
560
- regmap_update_bits (es8326 -> regmap , ES8326_DAC_DSM , 0x01 , 0x00 );
566
+ regmap_update_bits (es8326 -> regmap , ES8326_RESET , 0x02 , 0x02 );
567
+ usleep_range (5000 , 10000 );
561
568
regmap_write (es8326 -> regmap , ES8326_INTOUT_IO , es8326 -> interrupt_clk );
562
569
regmap_write (es8326 -> regmap , ES8326_SDINOUT1_IO ,
563
570
(ES8326_IO_DMIC_CLK << ES8326_SDINOUT1_SHIFT ));
564
- regmap_write (es8326 -> regmap , ES8326_VMIDSEL , 0x0E );
565
571
regmap_write (es8326 -> regmap , ES8326_PGA_PDN , 0x40 );
566
572
regmap_write (es8326 -> regmap , ES8326_ANA_PDN , 0x00 );
567
573
regmap_update_bits (es8326 -> regmap , ES8326_CLK_CTL , 0x20 , 0x20 );
568
-
569
- regmap_update_bits (es8326 -> regmap , ES8326_RESET ,
570
- ES8326_CSM_ON , ES8326_CSM_ON );
574
+ regmap_update_bits (es8326 -> regmap , ES8326_RESET , 0x02 , 0x00 );
571
575
break ;
572
576
case SND_SOC_BIAS_PREPARE :
573
577
break ;
574
578
case SND_SOC_BIAS_STANDBY :
575
579
regmap_write (es8326 -> regmap , ES8326_ANA_PDN , 0x3b );
576
- regmap_write (es8326 -> regmap , ES8326_VMIDSEL , 0x00 );
577
580
regmap_update_bits (es8326 -> regmap , ES8326_CLK_CTL , 0x20 , 0x00 );
578
581
regmap_write (es8326 -> regmap , ES8326_SDINOUT1_IO , ES8326_IO_INPUT );
579
582
break ;
@@ -777,6 +780,7 @@ static void es8326_jack_detect_handler(struct work_struct *work)
777
780
* Don't report jack status.
778
781
*/
779
782
regmap_update_bits (es8326 -> regmap , ES8326_HPDET_TYPE , 0x03 , 0x01 );
783
+ es8326_enable_micbias (es8326 -> component );
780
784
usleep_range (50000 , 70000 );
781
785
regmap_update_bits (es8326 -> regmap , ES8326_HPDET_TYPE , 0x03 , 0x00 );
782
786
regmap_write (es8326 -> regmap , ES8326_SYS_BIAS , 0x1f );
@@ -820,13 +824,10 @@ static void es8326_jack_detect_handler(struct work_struct *work)
820
824
static irqreturn_t es8326_irq (int irq , void * dev_id )
821
825
{
822
826
struct es8326_priv * es8326 = dev_id ;
823
- struct snd_soc_component * comp = es8326 -> component ;
824
827
825
828
if (!es8326 -> jack )
826
829
goto out ;
827
830
828
- es8326_enable_micbias (comp );
829
-
830
831
if (es8326 -> jack -> status & SND_JACK_HEADSET )
831
832
queue_delayed_work (system_wq , & es8326 -> jack_detect_work ,
832
833
msecs_to_jiffies (10 ));
@@ -943,6 +944,14 @@ static int es8326_resume(struct snd_soc_component *component)
943
944
regmap_write (es8326 -> regmap , ES8326_DAC_DSM , 0x08 );
944
945
regmap_write (es8326 -> regmap , ES8326_DAC_VPPSCALE , 0x15 );
945
946
947
+ regmap_write (es8326 -> regmap , ES8326_HPDET_TYPE , 0x80 |
948
+ ((es8326 -> version == ES8326_VERSION_B ) ?
949
+ (ES8326_HP_DET_SRC_PIN9 | es8326 -> jack_pol ) :
950
+ (ES8326_HP_DET_SRC_PIN9 | es8326 -> jack_pol | 0x04 )));
951
+ usleep_range (5000 , 10000 );
952
+ es8326_enable_micbias (es8326 -> component );
953
+ usleep_range (50000 , 70000 );
954
+ regmap_update_bits (es8326 -> regmap , ES8326_HPDET_TYPE , 0x03 , 0x00 );
946
955
regmap_write (es8326 -> regmap , ES8326_INT_SOURCE ,
947
956
(ES8326_INT_SRC_PIN9 | ES8326_INT_SRC_BUTTON ));
948
957
regmap_write (es8326 -> regmap , ES8326_INTOUT_IO ,
@@ -959,11 +968,6 @@ static int es8326_resume(struct snd_soc_component *component)
959
968
regmap_update_bits (es8326 -> regmap , ES8326_DAC_MUTE , ES8326_MUTE_MASK ,
960
969
ES8326_MUTE );
961
970
962
- regmap_write (es8326 -> regmap , ES8326_HPDET_TYPE , 0x80 |
963
- ((es8326 -> version == ES8326_VERSION_B ) ?
964
- (ES8326_HP_DET_SRC_PIN9 | es8326 -> jack_pol ) :
965
- (ES8326_HP_DET_SRC_PIN9 | es8326 -> jack_pol | 0x04 )));
966
- regmap_write (es8326 -> regmap , ES8326_HP_VOL , 0x11 );
967
971
968
972
es8326 -> jack_remove_retry = 0 ;
969
973
es8326 -> hp = 0 ;
0 commit comments