Commit a60e654b authored by Peter Ujfalusi's avatar Peter Ujfalusi Committed by Mark Brown

ASoC: tlv320aic3x: Convert SOC_ENUM_SINGLE/DOUBLE arrays to individual

It is easier to find the relevant enums in the code. Use the
SOC_ENUM_*_DECL macro for the individual items.
Signed-off-by: default avatarPeter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 36849409
...@@ -216,61 +216,68 @@ static int mic_bias_event(struct snd_soc_dapm_widget *w, ...@@ -216,61 +216,68 @@ static int mic_bias_event(struct snd_soc_dapm_widget *w,
return 0; return 0;
} }
static const char *aic3x_left_dac_mux[] = { "DAC_L1", "DAC_L3", "DAC_L2" }; static const char * const aic3x_left_dac_mux[] = {
static const char *aic3x_right_dac_mux[] = { "DAC_R1", "DAC_R3", "DAC_R2" }; "DAC_L1", "DAC_L3", "DAC_L2" };
static const char *aic3x_left_hpcom_mux[] = static SOC_ENUM_SINGLE_DECL(aic3x_left_dac_enum, DAC_LINE_MUX, 6,
{ "differential of HPLOUT", "constant VCM", "single-ended" }; aic3x_left_dac_mux);
static const char *aic3x_right_hpcom_mux[] =
{ "differential of HPROUT", "constant VCM", "single-ended", static const char * const aic3x_right_dac_mux[] = {
"differential of HPLCOM", "external feedback" }; "DAC_R1", "DAC_R3", "DAC_R2" };
static const char *aic3x_linein_mode_mux[] = { "single-ended", "differential" }; static SOC_ENUM_SINGLE_DECL(aic3x_right_dac_enum, DAC_LINE_MUX, 4,
static const char *aic3x_adc_hpf[] = aic3x_right_dac_mux);
{ "Disabled", "0.0045xFs", "0.0125xFs", "0.025xFs" };
static const char * const aic3x_left_hpcom_mux[] = {
#define LDAC_ENUM 0 "differential of HPLOUT", "constant VCM", "single-ended" };
#define RDAC_ENUM 1 static SOC_ENUM_SINGLE_DECL(aic3x_left_hpcom_enum, HPLCOM_CFG, 4,
#define LHPCOM_ENUM 2 aic3x_left_hpcom_mux);
#define RHPCOM_ENUM 3
#define LINE1L_2_L_ENUM 4 static const char * const aic3x_right_hpcom_mux[] = {
#define LINE1L_2_R_ENUM 5 "differential of HPROUT", "constant VCM", "single-ended",
#define LINE1R_2_L_ENUM 6 "differential of HPLCOM", "external feedback" };
#define LINE1R_2_R_ENUM 7 static SOC_ENUM_SINGLE_DECL(aic3x_right_hpcom_enum, HPRCOM_CFG, 3,
#define LINE2L_ENUM 8 aic3x_right_hpcom_mux);
#define LINE2R_ENUM 9
#define ADC_HPF_ENUM 10 static const char * const aic3x_linein_mode_mux[] = {
"single-ended", "differential" };
static const struct soc_enum aic3x_enum[] = { static SOC_ENUM_SINGLE_DECL(aic3x_line1l_2_l_enum, LINE1L_2_LADC_CTRL, 7,
SOC_ENUM_SINGLE(DAC_LINE_MUX, 6, 3, aic3x_left_dac_mux), aic3x_linein_mode_mux);
SOC_ENUM_SINGLE(DAC_LINE_MUX, 4, 3, aic3x_right_dac_mux), static SOC_ENUM_SINGLE_DECL(aic3x_line1l_2_r_enum, LINE1L_2_RADC_CTRL, 7,
SOC_ENUM_SINGLE(HPLCOM_CFG, 4, 3, aic3x_left_hpcom_mux), aic3x_linein_mode_mux);
SOC_ENUM_SINGLE(HPRCOM_CFG, 3, 5, aic3x_right_hpcom_mux), static SOC_ENUM_SINGLE_DECL(aic3x_line1r_2_l_enum, LINE1R_2_LADC_CTRL, 7,
SOC_ENUM_SINGLE(LINE1L_2_LADC_CTRL, 7, 2, aic3x_linein_mode_mux), aic3x_linein_mode_mux);
SOC_ENUM_SINGLE(LINE1L_2_RADC_CTRL, 7, 2, aic3x_linein_mode_mux), static SOC_ENUM_SINGLE_DECL(aic3x_line1r_2_r_enum, LINE1R_2_RADC_CTRL, 7,
SOC_ENUM_SINGLE(LINE1R_2_LADC_CTRL, 7, 2, aic3x_linein_mode_mux), aic3x_linein_mode_mux);
SOC_ENUM_SINGLE(LINE1R_2_RADC_CTRL, 7, 2, aic3x_linein_mode_mux), static SOC_ENUM_SINGLE_DECL(aic3x_line2l_2_ldac_enum, LINE2L_2_LADC_CTRL, 7,
SOC_ENUM_SINGLE(LINE2L_2_LADC_CTRL, 7, 2, aic3x_linein_mode_mux), aic3x_linein_mode_mux);
SOC_ENUM_SINGLE(LINE2R_2_RADC_CTRL, 7, 2, aic3x_linein_mode_mux), static SOC_ENUM_SINGLE_DECL(aic3x_line2r_2_rdac_enum, LINE2R_2_RADC_CTRL, 7,
SOC_ENUM_DOUBLE(AIC3X_CODEC_DFILT_CTRL, 6, 4, 4, aic3x_adc_hpf), aic3x_linein_mode_mux);
};
static const char * const aic3x_adc_hpf[] = {
static const char *aic3x_agc_level[] = "Disabled", "0.0045xFs", "0.0125xFs", "0.025xFs" };
{ "-5.5dB", "-8dB", "-10dB", "-12dB", "-14dB", "-17dB", "-20dB", "-24dB" }; static SOC_ENUM_DOUBLE_DECL(aic3x_adc_hpf_enum, AIC3X_CODEC_DFILT_CTRL, 6, 4,
static const struct soc_enum aic3x_agc_level_enum[] = { aic3x_adc_hpf);
SOC_ENUM_SINGLE(LAGC_CTRL_A, 4, 8, aic3x_agc_level),
SOC_ENUM_SINGLE(RAGC_CTRL_A, 4, 8, aic3x_agc_level), static const char * const aic3x_agc_level[] = {
}; "-5.5dB", "-8dB", "-10dB", "-12dB",
"-14dB", "-17dB", "-20dB", "-24dB" };
static const char *aic3x_agc_attack[] = { "8ms", "11ms", "16ms", "20ms" }; static SOC_ENUM_SINGLE_DECL(aic3x_lagc_level_enum, LAGC_CTRL_A, 4,
static const struct soc_enum aic3x_agc_attack_enum[] = { aic3x_agc_level);
SOC_ENUM_SINGLE(LAGC_CTRL_A, 2, 4, aic3x_agc_attack), static SOC_ENUM_SINGLE_DECL(aic3x_ragc_level_enum, RAGC_CTRL_A, 4,
SOC_ENUM_SINGLE(RAGC_CTRL_A, 2, 4, aic3x_agc_attack), aic3x_agc_level);
};
static const char * const aic3x_agc_attack[] = {
static const char *aic3x_agc_decay[] = { "100ms", "200ms", "400ms", "500ms" }; "8ms", "11ms", "16ms", "20ms" };
static const struct soc_enum aic3x_agc_decay_enum[] = { static SOC_ENUM_SINGLE_DECL(aic3x_lagc_attack_enum, LAGC_CTRL_A, 2,
SOC_ENUM_SINGLE(LAGC_CTRL_A, 0, 4, aic3x_agc_decay), aic3x_agc_attack);
SOC_ENUM_SINGLE(RAGC_CTRL_A, 0, 4, aic3x_agc_decay), static SOC_ENUM_SINGLE_DECL(aic3x_ragc_attack_enum, RAGC_CTRL_A, 2,
}; aic3x_agc_attack);
static const char * const aic3x_agc_decay[] = {
"100ms", "200ms", "400ms", "500ms" };
static SOC_ENUM_SINGLE_DECL(aic3x_lagc_decay_enum, LAGC_CTRL_A, 0,
aic3x_agc_decay);
static SOC_ENUM_SINGLE_DECL(aic3x_ragc_decay_enum, RAGC_CTRL_A, 0,
aic3x_agc_decay);
/* /*
* DAC digital volumes. From -63.5 to 0 dB in 0.5 dB steps * DAC digital volumes. From -63.5 to 0 dB in 0.5 dB steps
...@@ -385,12 +392,12 @@ static const struct snd_kcontrol_new aic3x_snd_controls[] = { ...@@ -385,12 +392,12 @@ static const struct snd_kcontrol_new aic3x_snd_controls[] = {
* adjust PGA to max value when ADC is on and will never go back. * adjust PGA to max value when ADC is on and will never go back.
*/ */
SOC_DOUBLE_R("AGC Switch", LAGC_CTRL_A, RAGC_CTRL_A, 7, 0x01, 0), SOC_DOUBLE_R("AGC Switch", LAGC_CTRL_A, RAGC_CTRL_A, 7, 0x01, 0),
SOC_ENUM("Left AGC Target level", aic3x_agc_level_enum[0]), SOC_ENUM("Left AGC Target level", aic3x_lagc_level_enum),
SOC_ENUM("Right AGC Target level", aic3x_agc_level_enum[1]), SOC_ENUM("Right AGC Target level", aic3x_ragc_level_enum),
SOC_ENUM("Left AGC Attack time", aic3x_agc_attack_enum[0]), SOC_ENUM("Left AGC Attack time", aic3x_lagc_attack_enum),
SOC_ENUM("Right AGC Attack time", aic3x_agc_attack_enum[1]), SOC_ENUM("Right AGC Attack time", aic3x_ragc_attack_enum),
SOC_ENUM("Left AGC Decay time", aic3x_agc_decay_enum[0]), SOC_ENUM("Left AGC Decay time", aic3x_lagc_decay_enum),
SOC_ENUM("Right AGC Decay time", aic3x_agc_decay_enum[1]), SOC_ENUM("Right AGC Decay time", aic3x_ragc_decay_enum),
/* De-emphasis */ /* De-emphasis */
SOC_DOUBLE("De-emphasis Switch", AIC3X_CODEC_DFILT_CTRL, 2, 0, 0x01, 0), SOC_DOUBLE("De-emphasis Switch", AIC3X_CODEC_DFILT_CTRL, 2, 0, 0x01, 0),
...@@ -400,7 +407,7 @@ static const struct snd_kcontrol_new aic3x_snd_controls[] = { ...@@ -400,7 +407,7 @@ static const struct snd_kcontrol_new aic3x_snd_controls[] = {
0, 119, 0, adc_tlv), 0, 119, 0, adc_tlv),
SOC_DOUBLE_R("PGA Capture Switch", LADC_VOL, RADC_VOL, 7, 0x01, 1), SOC_DOUBLE_R("PGA Capture Switch", LADC_VOL, RADC_VOL, 7, 0x01, 1),
SOC_ENUM("ADC HPF Cut-off", aic3x_enum[ADC_HPF_ENUM]), SOC_ENUM("ADC HPF Cut-off", aic3x_adc_hpf_enum),
}; };
static const struct snd_kcontrol_new aic3x_mono_controls[] = { static const struct snd_kcontrol_new aic3x_mono_controls[] = {
...@@ -427,19 +434,19 @@ static const struct snd_kcontrol_new aic3x_classd_amp_gain_ctrl = ...@@ -427,19 +434,19 @@ static const struct snd_kcontrol_new aic3x_classd_amp_gain_ctrl =
/* Left DAC Mux */ /* Left DAC Mux */
static const struct snd_kcontrol_new aic3x_left_dac_mux_controls = static const struct snd_kcontrol_new aic3x_left_dac_mux_controls =
SOC_DAPM_ENUM("Route", aic3x_enum[LDAC_ENUM]); SOC_DAPM_ENUM("Route", aic3x_left_dac_enum);
/* Right DAC Mux */ /* Right DAC Mux */
static const struct snd_kcontrol_new aic3x_right_dac_mux_controls = static const struct snd_kcontrol_new aic3x_right_dac_mux_controls =
SOC_DAPM_ENUM("Route", aic3x_enum[RDAC_ENUM]); SOC_DAPM_ENUM("Route", aic3x_right_dac_enum);
/* Left HPCOM Mux */ /* Left HPCOM Mux */
static const struct snd_kcontrol_new aic3x_left_hpcom_mux_controls = static const struct snd_kcontrol_new aic3x_left_hpcom_mux_controls =
SOC_DAPM_ENUM("Route", aic3x_enum[LHPCOM_ENUM]); SOC_DAPM_ENUM("Route", aic3x_left_hpcom_enum);
/* Right HPCOM Mux */ /* Right HPCOM Mux */
static const struct snd_kcontrol_new aic3x_right_hpcom_mux_controls = static const struct snd_kcontrol_new aic3x_right_hpcom_mux_controls =
SOC_DAPM_ENUM("Route", aic3x_enum[RHPCOM_ENUM]); SOC_DAPM_ENUM("Route", aic3x_right_hpcom_enum);
/* Left Line Mixer */ /* Left Line Mixer */
static const struct snd_kcontrol_new aic3x_left_line_mixer_controls[] = { static const struct snd_kcontrol_new aic3x_left_line_mixer_controls[] = {
...@@ -531,23 +538,23 @@ static const struct snd_kcontrol_new aic3x_right_pga_mixer_controls[] = { ...@@ -531,23 +538,23 @@ static const struct snd_kcontrol_new aic3x_right_pga_mixer_controls[] = {
/* Left Line1 Mux */ /* Left Line1 Mux */
static const struct snd_kcontrol_new aic3x_left_line1l_mux_controls = static const struct snd_kcontrol_new aic3x_left_line1l_mux_controls =
SOC_DAPM_ENUM("Route", aic3x_enum[LINE1L_2_L_ENUM]); SOC_DAPM_ENUM("Route", aic3x_line1l_2_l_enum);
static const struct snd_kcontrol_new aic3x_right_line1l_mux_controls = static const struct snd_kcontrol_new aic3x_right_line1l_mux_controls =
SOC_DAPM_ENUM("Route", aic3x_enum[LINE1L_2_R_ENUM]); SOC_DAPM_ENUM("Route", aic3x_line1l_2_r_enum);
/* Right Line1 Mux */ /* Right Line1 Mux */
static const struct snd_kcontrol_new aic3x_right_line1r_mux_controls = static const struct snd_kcontrol_new aic3x_right_line1r_mux_controls =
SOC_DAPM_ENUM("Route", aic3x_enum[LINE1R_2_R_ENUM]); SOC_DAPM_ENUM("Route", aic3x_line1r_2_r_enum);
static const struct snd_kcontrol_new aic3x_left_line1r_mux_controls = static const struct snd_kcontrol_new aic3x_left_line1r_mux_controls =
SOC_DAPM_ENUM("Route", aic3x_enum[LINE1R_2_L_ENUM]); SOC_DAPM_ENUM("Route", aic3x_line1r_2_l_enum);
/* Left Line2 Mux */ /* Left Line2 Mux */
static const struct snd_kcontrol_new aic3x_left_line2_mux_controls = static const struct snd_kcontrol_new aic3x_left_line2_mux_controls =
SOC_DAPM_ENUM("Route", aic3x_enum[LINE2L_ENUM]); SOC_DAPM_ENUM("Route", aic3x_line2l_2_ldac_enum);
/* Right Line2 Mux */ /* Right Line2 Mux */
static const struct snd_kcontrol_new aic3x_right_line2_mux_controls = static const struct snd_kcontrol_new aic3x_right_line2_mux_controls =
SOC_DAPM_ENUM("Route", aic3x_enum[LINE2R_ENUM]); SOC_DAPM_ENUM("Route", aic3x_line2r_2_rdac_enum);
static const struct snd_soc_dapm_widget aic3x_dapm_widgets[] = { static const struct snd_soc_dapm_widget aic3x_dapm_widgets[] = {
/* Left DAC to Left Outputs */ /* Left DAC to Left Outputs */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment