[alsa-devel] [PATCH 2/2] ASoC: rt1011: ADCDAT pin config modification
shumingf at realtek.com
shumingf at realtek.com
Mon Aug 26 11:01:20 CEST 2019
From: Shuming Fan <shumingf at realtek.com>
ADCDAT pin config sets to output mode in default.
And the driver creates the kcontrol to control ADCDAT pin configuration.
Signed-off-by: Shuming Fan <shumingf at realtek.com>
---
sound/soc/codecs/rt1011.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/sound/soc/codecs/rt1011.c b/sound/soc/codecs/rt1011.c
index f9235764ad32..52c17450d5a0 100644
--- a/sound/soc/codecs/rt1011.c
+++ b/sound/soc/codecs/rt1011.c
@@ -1029,6 +1029,14 @@ static SOC_ENUM_SINGLE_DECL(rt1011_tdm_adc1_1_enum, RT1011_TDM1_SET_3, 6,
static SOC_ENUM_SINGLE_DECL(rt1011_tdm_adc2_1_enum, RT1011_TDM1_SET_3, 4,
rt1011_tdm_adc_swap_select);
+static const char * const rt1011_adcdat_pin_config_select[] = {
+ "Output", "Input"
+};
+static SOC_ENUM_SINGLE_DECL(rt1011_adcdat1_pin_config_enum, RT1011_TDM_TOTAL_SET, 4,
+ rt1011_adcdat_pin_config_select);
+static SOC_ENUM_SINGLE_DECL(rt1011_adcdat2_pin_config_enum, RT1011_TDM_TOTAL_SET, 3,
+ rt1011_adcdat_pin_config_select);
+
static void rt1011_reset(struct regmap *regmap)
{
regmap_write(regmap, RT1011_RESET, 0);
@@ -1343,6 +1351,8 @@ static const struct snd_kcontrol_new rt1011_snd_controls[] = {
SOC_ENUM("I2S ADC DOUT Mode", rt1011_adc_dout_mode_enum),
SOC_ENUM("TDM1 DOUT Length", rt1011_tdm1_dout_len_enum),
SOC_ENUM("TDM2 DOUT Length", rt1011_tdm2_dout_len_enum),
+ SOC_ENUM("ADCDAT1 Pin Config", rt1011_adcdat1_pin_config_enum),
+ SOC_ENUM("ADCDAT2 Pin Config", rt1011_adcdat2_pin_config_enum),
/* Speaker/Receiver Mode */
SOC_SINGLE_EXT("RECV SPK Mode", SND_SOC_NOPM, 0, 1, 0,
@@ -1859,9 +1869,6 @@ static int rt1011_set_tdm_slot(struct snd_soc_dai *dai,
RT1011_TDM_I2S_DOCK_EN_1_MASK, tdm_en);
snd_soc_component_update_bits(component, RT1011_TDM2_SET_2,
RT1011_TDM_I2S_DOCK_EN_2_MASK, tdm_en);
- snd_soc_component_update_bits(component, RT1011_TDM_TOTAL_SET,
- RT1011_ADCDAT1_PIN_CONFIG | RT1011_ADCDAT2_PIN_CONFIG,
- RT1011_ADCDAT1_OUTPUT | RT1011_ADCDAT2_OUTPUT);
snd_soc_dapm_mutex_unlock(dapm);
return ret;
@@ -2207,6 +2214,11 @@ static void rt1011_calibration_work(struct work_struct *work)
/* initial */
rt1011_reg_init(component);
+
+ /* set ADCDAT to output mode */
+ snd_soc_component_update_bits(component, RT1011_TDM_TOTAL_SET,
+ RT1011_ADCDAT1_PIN_CONFIG | RT1011_ADCDAT2_PIN_CONFIG,
+ RT1011_ADCDAT1_OUTPUT | RT1011_ADCDAT2_OUTPUT);
}
static int rt1011_i2c_probe(struct i2c_client *i2c,
--
2.23.0
More information about the Alsa-devel
mailing list