Merge branch 'asoc-4.19' into asoc-4.20 tas dependency
authorMark Brown <broonie@kernel.org>
Fri, 31 Aug 2018 15:23:43 +0000 (16:23 +0100)
committerMark Brown <broonie@kernel.org>
Fri, 31 Aug 2018 15:23:43 +0000 (16:23 +0100)
1  2 
sound/soc/codecs/rt5682.c
sound/soc/codecs/tas6424.c

@@@ -750,8 -750,8 +750,8 @@@ static bool rt5682_readable_register(st
  }
  
  static const DECLARE_TLV_DB_SCALE(hp_vol_tlv, -2250, 150, 0);
- static const DECLARE_TLV_DB_SCALE(dac_vol_tlv, -65625, 375, 0);
- static const DECLARE_TLV_DB_SCALE(adc_vol_tlv, -17625, 375, 0);
+ static const DECLARE_TLV_DB_SCALE(dac_vol_tlv, -6525, 75, 0);
+ static const DECLARE_TLV_DB_SCALE(adc_vol_tlv, -1725, 75, 0);
  static const DECLARE_TLV_DB_SCALE(adc_bst_tlv, 0, 1200, 0);
  
  /* {0, +20, +24, +30, +35, +40, +44, +50, +52} dB */
@@@ -1114,7 -1114,7 +1114,7 @@@ static const struct snd_kcontrol_new rt
  
        /* DAC Digital Volume */
        SOC_DOUBLE_TLV("DAC1 Playback Volume", RT5682_DAC1_DIG_VOL,
-               RT5682_L_VOL_SFT, RT5682_R_VOL_SFT, 175, 0, dac_vol_tlv),
+               RT5682_L_VOL_SFT + 1, RT5682_R_VOL_SFT + 1, 86, 0, dac_vol_tlv),
  
        /* IN Boost Volume */
        SOC_SINGLE_TLV("CBJ Boost Volume", RT5682_CBJ_BST_CTRL,
        SOC_DOUBLE("STO1 ADC Capture Switch", RT5682_STO1_ADC_DIG_VOL,
                RT5682_L_MUTE_SFT, RT5682_R_MUTE_SFT, 1, 1),
        SOC_DOUBLE_TLV("STO1 ADC Capture Volume", RT5682_STO1_ADC_DIG_VOL,
-               RT5682_L_VOL_SFT, RT5682_R_VOL_SFT, 127, 0, adc_vol_tlv),
+               RT5682_L_VOL_SFT + 1, RT5682_R_VOL_SFT + 1, 63, 0, adc_vol_tlv),
  
        /* ADC Boost Volume Control */
        SOC_DOUBLE_TLV("STO1 ADC Boost Gain Volume", RT5682_STO1_ADC_BOOST,
@@@ -2454,15 -2454,27 +2454,15 @@@ static void rt5682_calibrate(struct rt5
        regmap_write(rt5682->regmap, RT5682_PWR_ANLG_1, 0xa2bf);
        usleep_range(15000, 20000);
        regmap_write(rt5682->regmap, RT5682_PWR_ANLG_1, 0xf2bf);
 -      regmap_write(rt5682->regmap, RT5682_MICBIAS_2, 0x0380);
 -      regmap_write(rt5682->regmap, RT5682_PWR_DIG_1, 0x8001);
 -      regmap_write(rt5682->regmap, RT5682_TEST_MODE_CTRL_1, 0x0000);
 -      regmap_write(rt5682->regmap, RT5682_STO1_DAC_MIXER, 0x2080);
 -      regmap_write(rt5682->regmap, RT5682_STO1_ADC_MIXER, 0x4040);
 -      regmap_write(rt5682->regmap, RT5682_DEPOP_1, 0x0069);
 +      regmap_write(rt5682->regmap, RT5682_MICBIAS_2, 0x0300);
 +      regmap_write(rt5682->regmap, RT5682_GLB_CLK, 0x8000);
 +      regmap_write(rt5682->regmap, RT5682_PWR_DIG_1, 0x0100);
        regmap_write(rt5682->regmap, RT5682_CHOP_DAC, 0x3000);
 -      regmap_write(rt5682->regmap, RT5682_HP_CTRL_2, 0x6000);
 -      regmap_write(rt5682->regmap, RT5682_HP_CHARGE_PUMP_1, 0x0f26);
 -      regmap_write(rt5682->regmap, RT5682_CALIB_ADC_CTRL, 0x7f05);
 -      regmap_write(rt5682->regmap, RT5682_STO1_ADC_MIXER, 0x686c);
 -      regmap_write(rt5682->regmap, RT5682_CAL_REC, 0x0d0d);
 -      regmap_write(rt5682->regmap, RT5682_HP_CALIB_CTRL_9, 0x000f);
 -      regmap_write(rt5682->regmap, RT5682_PWR_DIG_1, 0x8d01);
        regmap_write(rt5682->regmap, RT5682_HP_CALIB_CTRL_2, 0x0321);
        regmap_write(rt5682->regmap, RT5682_HP_LOGIC_CTRL_2, 0x0004);
        regmap_write(rt5682->regmap, RT5682_HP_CALIB_CTRL_1, 0x7c00);
        regmap_write(rt5682->regmap, RT5682_HP_CALIB_CTRL_3, 0x06a1);
 -      regmap_write(rt5682->regmap, RT5682_A_DAC1_MUX, 0x0311);
 -      regmap_write(rt5682->regmap, RT5682_RESET_HPF_CTRL, 0x0000);
 -      regmap_write(rt5682->regmap, RT5682_ADC_STO1_HP_CTRL_1, 0x3320);
 +      regmap_write(rt5682->regmap, RT5682_HP_CALIB_CTRL_1, 0x7c00);
  
        regmap_write(rt5682->regmap, RT5682_HP_CALIB_CTRL_1, 0xfc00);
  
                pr_err("HP Calibration Failure\n");
  
        /* restore settings */
 -      regmap_write(rt5682->regmap, RT5682_STO1_ADC_MIXER, 0xc0c4);
 +      regmap_write(rt5682->regmap, RT5682_GLB_CLK, 0x0000);
        regmap_write(rt5682->regmap, RT5682_PWR_DIG_1, 0x0000);
  
        mutex_unlock(&rt5682->calibrate_mutex);
@@@ -408,7 -408,7 +408,7 @@@ static void tas6424_fault_check_work(st
  
        ret = regmap_read(tas6424->regmap, TAS6424_GLOB_FAULT1, &reg);
        if (ret < 0) {
 -              dev_err(dev, "failed to read FAULT1 register: %d\n", ret);
 +              dev_err(dev, "failed to read GLOB_FAULT1 register: %d\n", ret);
                goto out;
        }
  
               TAS6424_FAULT_PVDD_UV |
               TAS6424_FAULT_VBAT_UV;
  
-       if (reg)
+       if (!reg) {
+               tas6424->last_fault1 = reg;
                goto check_global_fault2_reg;
+       }
  
        /*
         * Only flag errors once for a given occurrence. This is needed as
  check_global_fault2_reg:
        ret = regmap_read(tas6424->regmap, TAS6424_GLOB_FAULT2, &reg);
        if (ret < 0) {
 -              dev_err(dev, "failed to read FAULT2 register: %d\n", ret);
 +              dev_err(dev, "failed to read GLOB_FAULT2 register: %d\n", ret);
                goto out;
        }
  
               TAS6424_FAULT_OTSD_CH3 |
               TAS6424_FAULT_OTSD_CH4;
  
-       if (!reg)
+       if (!reg) {
+               tas6424->last_fault2 = reg;
                goto check_warn_reg;
+       }
  
        if ((reg & TAS6424_FAULT_OTSD) && !(tas6424->last_fault2 & TAS6424_FAULT_OTSD))
                dev_crit(dev, "experienced a global overtemp shutdown\n");
@@@ -497,8 -501,10 +501,10 @@@ check_warn_reg
               TAS6424_WARN_VDD_OTW_CH3 |
               TAS6424_WARN_VDD_OTW_CH4;
  
-       if (!reg)
+       if (!reg) {
+               tas6424->last_warn = reg;
                goto out;
+       }
  
        if ((reg & TAS6424_WARN_VDD_UV) && !(tas6424->last_warn & TAS6424_WARN_VDD_UV))
                dev_warn(dev, "experienced a VDD under voltage condition\n");
        /* Store current warn value so we can detect any changes next time */
        tas6424->last_warn = reg;
  
 -      /* Clear any faults by toggling the CLEAR_FAULT control bit */
 +      /* Clear any warnings by toggling the CLEAR_FAULT control bit */
        ret = regmap_write_bits(tas6424->regmap, TAS6424_MISC_CTRL3,
                                TAS6424_CLEAR_FAULT, TAS6424_CLEAR_FAULT);
        if (ret < 0)