ASoC: rt1011: Add R0 temperature and TDM1 ADC2DAT Swap control
authorShuming Fan <shumingf@realtek.com>
Tue, 6 Aug 2019 09:14:35 +0000 (17:14 +0800)
committerMark Brown <broonie@kernel.org>
Wed, 7 Aug 2019 13:18:55 +0000 (14:18 +0100)
- The user level application could set the R0 temperature after booting system.
  The degree Celsius of R0 temperature store in the non-volatile space
  when doing R0 calibration.
- TDM1 ADC2DAT Swap controls use to control TDM slot2/3 data

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20190806091435.14329-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/rt1011.c
sound/soc/codecs/rt1011.h

index 0a6ff13d76e136fd6b3e130899ee75b81e09fa16..b25b4c1127ca548808dccf698f5d805e8fccf735 100644 (file)
@@ -1029,6 +1029,8 @@ static const char * const rt1011_tdm_adc_swap_select[] = {
 
 static SOC_ENUM_SINGLE_DECL(rt1011_tdm_adc1_1_enum,    RT1011_TDM1_SET_3, 6,
        rt1011_tdm_adc_swap_select);
+static SOC_ENUM_SINGLE_DECL(rt1011_tdm_adc2_1_enum,    RT1011_TDM1_SET_3, 4,
+       rt1011_tdm_adc_swap_select);
 
 static void rt1011_reset(struct regmap *regmap)
 {
@@ -1333,7 +1335,8 @@ static const struct snd_kcontrol_new rt1011_snd_controls[] = {
        /* TDM1 Data Out Selection */
        SOC_ENUM("TDM1 DOUT Source", rt1011_tdm1_adc1_dat_enum),
        SOC_ENUM("TDM1 DOUT Location", rt1011_tdm1_adc1_loc_enum),
-       SOC_ENUM("TDM1 ADCDAT Swap Select", rt1011_tdm_adc1_1_enum),
+       SOC_ENUM("TDM1 ADC1DAT Swap Select", rt1011_tdm_adc1_1_enum),
+       SOC_ENUM("TDM1 ADC2DAT Swap Select", rt1011_tdm_adc2_1_enum),
 
        /* Data Out Mode */
        SOC_ENUM("I2S ADC DOUT Mode", rt1011_adc_dout_mode_enum),
@@ -1355,6 +1358,10 @@ static const struct snd_kcontrol_new rt1011_snd_controls[] = {
        SOC_SINGLE_EXT("R0 Calibration", SND_SOC_NOPM, 0, 1, 0,
                rt1011_r0_cali_get, rt1011_r0_cali_put),
        RT1011_R0_LOAD("R0 Load Mode"),
+
+       /* R0 temperature */
+       SOC_SINGLE("R0 Temperature", RT1011_STP_INITIAL_RESISTANCE_TEMP,
+               2, 255, 0),
 };
 
 static int rt1011_is_sys_clk_from_pll(struct snd_soc_dapm_widget *source,
index 98a38800c4df0c09a277e13166cd89ea7767fc69..5d431d7f1d16700f2c5401cac6052f18f8a4edf3 100644 (file)
 #define RT1011_STP_CALIB_RS_TEMP                       0x152a
 #define RT1011_INIT_RECIPROCAL_REG_24_16                               0x1538
 #define RT1011_INIT_RECIPROCAL_REG_15_0                                0x1539
+#define RT1011_STP_INITIAL_RESISTANCE_TEMP                             0x153c
 #define RT1011_STP_ALPHA_RECIPROCAL_MSB                                0x153e
 #define RT1011_SPK_RESISTANCE_1                                0x1544
 #define RT1011_SPK_RESISTANCE_2                                0x1546