[alsa-devel] [PATCH 000/102 - chunk#5] Add SOC_ENUM_SINGLE_CONST() & co
This is the last chunk of patch series, which introduces two new macros, SOC_ENUM_SINGLE_CONST() and SOC_ENUM_DOUBLE_CONST() in order to simplify the codes without ARRAY_SIZE() in the caller side.
Takashi
Add new helper macros for defining the enum elements with a constant array. With these macros, redundant ARRAY_SIZE() can be removed in the code.
Signed-off-by: Takashi Iwai tiwai@suse.de --- include/sound/soc.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/include/sound/soc.h b/include/sound/soc.h index cc891387e7ac..11966c1cd33a 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -285,9 +285,13 @@ * Simplified versions of above macros, declaring a struct and calculating * ARRAY_SIZE internally */ +#define SOC_ENUM_DOUBLE_CONST(xreg, xshift_l, xshift_r, xtexts) \ + SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, ARRAY_SIZE(xtexts), xtexts) +#define SOC_ENUM_SINGLE_CONST(xreg, xshift, xtexts) \ + SOC_ENUM_DOUBLE_CONST(xreg, xshift, xshift, xtexts) + #define SOC_ENUM_DOUBLE_DECL(name, xreg, xshift_l, xshift_r, xtexts) \ - const struct soc_enum name = SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, \ - ARRAY_SIZE(xtexts), xtexts) + const struct soc_enum name = SOC_ENUM_DOUBLE_CONST(xreg, xshift_l, xshift_r, xtexts) #define SOC_ENUM_SINGLE_DECL(name, xreg, xshift, xtexts) \ SOC_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xtexts) #define SOC_ENUM_SINGLE_EXT_DECL(name, xtexts) \
On Tue, Feb 18, 2014 at 12:51:28PM +0100, Takashi Iwai wrote:
Add new helper macros for defining the enum elements with a constant array. With these macros, redundant ARRAY_SIZE() can be removed in the code.
So, this doesn't seem like the best way to do things. For one thing it's not really that the arrays are const, it's the fact that they are a fixed size that makes the difference with these macros. An array where we fill in a fixed number of strings at runtime would work just as well for this. I'd also expect this to be more what the default naming does since we want to try to steer people towards using the simplest and least error prone mechanism for doing this.
At Thu, 20 Feb 2014 11:33:39 +0900, Mark Brown wrote:
On Tue, Feb 18, 2014 at 12:51:28PM +0100, Takashi Iwai wrote:
Add new helper macros for defining the enum elements with a constant array. With these macros, redundant ARRAY_SIZE() can be removed in the code.
So, this doesn't seem like the best way to do things. For one thing it's not really that the arrays are const, it's the fact that they are a fixed size that makes the difference with these macros. An array where we fill in a fixed number of strings at runtime would work just as well for this.
Hm, in theory, yes. I thought of _FIXED instead of _CONST, too, but the former sounds also obscure, so I picked the latter in the end.
I'd also expect this to be more what the default naming does since we want to try to steer people towards using the simplest and least error prone mechanism for doing this.
If changing the existing API is fine for you (not adding the new one), it's trivial to convert the patches to do so. Looking at the end result, all SOC_ENUM_SINGLE() and SOC_ENUM_DOUBLE() usages are covered. For any specific usage in future, we may provide lowlevel macros, __SOC_ENUM_SINGLE() with the number of items, too.
Takashi
At Thu, 20 Feb 2014 08:08:51 +0100, Takashi Iwai wrote:
At Thu, 20 Feb 2014 11:33:39 +0900, Mark Brown wrote:
On Tue, Feb 18, 2014 at 12:51:28PM +0100, Takashi Iwai wrote:
Add new helper macros for defining the enum elements with a constant array. With these macros, redundant ARRAY_SIZE() can be removed in the code.
So, this doesn't seem like the best way to do things. For one thing it's not really that the arrays are const, it's the fact that they are a fixed size that makes the difference with these macros. An array where we fill in a fixed number of strings at runtime would work just as well for this.
Hm, in theory, yes. I thought of _FIXED instead of _CONST, too, but the former sounds also obscure, so I picked the latter in the end.
I'd also expect this to be more what the default naming does since we want to try to steer people towards using the simplest and least error prone mechanism for doing this.
If changing the existing API is fine for you (not adding the new one), it's trivial to convert the patches to do so. Looking at the end result, all SOC_ENUM_SINGLE() and SOC_ENUM_DOUBLE() usages are covered. For any specific usage in future, we may provide lowlevel macros, __SOC_ENUM_SINGLE() with the number of items, too.
OTOH, changing the API means that we need to fix all callers at one shot. (Otherwise you'll hit bisection problems.) The volume would become big as a single patch.
If you prefer this way, let me know.
Takashi
On Thu, Feb 20, 2014 at 08:08:51AM +0100, Takashi Iwai wrote:
Mark Brown wrote:
I'd also expect this to be more what the default naming does since we want to try to steer people towards using the simplest and least error prone mechanism for doing this.
If changing the existing API is fine for you (not adding the new one), it's trivial to convert the patches to do so. Looking at the end
Yes, I think that's a better approach. It's fairly obvious that the existing interface isn't awesome so it shouldn't be the default one.
result, all SOC_ENUM_SINGLE() and SOC_ENUM_DOUBLE() usages are covered. For any specific usage in future, we may provide lowlevel macros, __SOC_ENUM_SINGLE() with the number of items, too.
Indeed, I was intending to go through and look at renaming the legacy macros so they're implementaton details once I'd got through all the patches.
At Thu, 20 Feb 2014 18:09:38 +0900, Mark Brown wrote:
On Thu, Feb 20, 2014 at 08:08:51AM +0100, Takashi Iwai wrote:
Mark Brown wrote:
I'd also expect this to be more what the default naming does since we want to try to steer people towards using the simplest and least error prone mechanism for doing this.
If changing the existing API is fine for you (not adding the new one), it's trivial to convert the patches to do so. Looking at the end
Yes, I think that's a better approach. It's fairly obvious that the existing interface isn't awesome so it shouldn't be the default one.
result, all SOC_ENUM_SINGLE() and SOC_ENUM_DOUBLE() usages are covered. For any specific usage in future, we may provide lowlevel macros, __SOC_ENUM_SINGLE() with the number of items, too.
Indeed, I was intending to go through and look at renaming the legacy macros so they're implementaton details once I'd got through all the patches.
OK, but still a question is whether to split patches or not. By splitting patches, we'll break the build in between, so the bisection won't work well. OTOH, a big single patch would be too big. I myself am inclined to have split patches despite bisection breakage in this case.
Takashi
On Thu, Feb 20, 2014 at 03:56:11PM +0100, Takashi Iwai wrote:
OK, but still a question is whether to split patches or not. By splitting patches, we'll break the build in between, so the bisection won't work well. OTOH, a big single patch would be too big. I myself am inclined to have split patches despite bisection breakage in this case.
I'd go with a single patch - if it's big and repetitive it's not going to be that hard to review - but I think either way is probably OK in the end so whatever you feel comfortable with.
... for improving readability and maintainability.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/codecs/ak4535.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/sound/soc/codecs/ak4535.c b/sound/soc/codecs/ak4535.c index 684fe910669f..143ef8a309dc 100644 --- a/sound/soc/codecs/ak4535.c +++ b/sound/soc/codecs/ak4535.c @@ -72,11 +72,11 @@ static const char *ak4535_deemp[] = {"44.1kHz", "Off", "48kHz", "32kHz"}; static const char *ak4535_mic_select[] = {"Internal", "External"};
static const struct soc_enum ak4535_enum[] = { - SOC_ENUM_SINGLE(AK4535_SIG1, 7, 2, ak4535_mono_gain), - SOC_ENUM_SINGLE(AK4535_SIG1, 6, 2, ak4535_mono_out), - SOC_ENUM_SINGLE(AK4535_MODE2, 2, 2, ak4535_hp_out), - SOC_ENUM_SINGLE(AK4535_DAC, 0, 4, ak4535_deemp), - SOC_ENUM_SINGLE(AK4535_MIC, 1, 2, ak4535_mic_select), + SOC_ENUM_SINGLE_CONST(AK4535_SIG1, 7, ak4535_mono_gain), + SOC_ENUM_SINGLE_CONST(AK4535_SIG1, 6, ak4535_mono_out), + SOC_ENUM_SINGLE_CONST(AK4535_MODE2, 2, ak4535_hp_out), + SOC_ENUM_SINGLE_CONST(AK4535_DAC, 0, ak4535_deemp), + SOC_ENUM_SINGLE_CONST(AK4535_MIC, 1, ak4535_mic_select), };
static const struct snd_kcontrol_new ak4535_snd_controls[] = {
... for improving readability and maintainability.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/codecs/arizona.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c index a32b84ac03f6..53812c5a3d51 100644 --- a/sound/soc/codecs/arizona.c +++ b/sound/soc/codecs/arizona.c @@ -619,18 +619,14 @@ static const char * const arizona_in_dmic_osr_text[] = { };
const struct soc_enum arizona_in_dmic_osr[] = { - SOC_ENUM_SINGLE(ARIZONA_IN1L_CONTROL, ARIZONA_IN1_OSR_SHIFT, - ARRAY_SIZE(arizona_in_dmic_osr_text), - arizona_in_dmic_osr_text), - SOC_ENUM_SINGLE(ARIZONA_IN2L_CONTROL, ARIZONA_IN2_OSR_SHIFT, - ARRAY_SIZE(arizona_in_dmic_osr_text), - arizona_in_dmic_osr_text), - SOC_ENUM_SINGLE(ARIZONA_IN3L_CONTROL, ARIZONA_IN3_OSR_SHIFT, - ARRAY_SIZE(arizona_in_dmic_osr_text), - arizona_in_dmic_osr_text), - SOC_ENUM_SINGLE(ARIZONA_IN4L_CONTROL, ARIZONA_IN4_OSR_SHIFT, - ARRAY_SIZE(arizona_in_dmic_osr_text), - arizona_in_dmic_osr_text), + SOC_ENUM_SINGLE_CONST(ARIZONA_IN1L_CONTROL, ARIZONA_IN1_OSR_SHIFT, + arizona_in_dmic_osr_text), + SOC_ENUM_SINGLE_CONST(ARIZONA_IN2L_CONTROL, ARIZONA_IN2_OSR_SHIFT, + arizona_in_dmic_osr_text), + SOC_ENUM_SINGLE_CONST(ARIZONA_IN3L_CONTROL, ARIZONA_IN3_OSR_SHIFT, + arizona_in_dmic_osr_text), + SOC_ENUM_SINGLE_CONST(ARIZONA_IN4L_CONTROL, ARIZONA_IN4_OSR_SHIFT, + arizona_in_dmic_osr_text), }; EXPORT_SYMBOL_GPL(arizona_in_dmic_osr);
... for improving readability and maintainability.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/codecs/isabelle.c | 52 +++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 28 deletions(-)
diff --git a/sound/soc/codecs/isabelle.c b/sound/soc/codecs/isabelle.c index cb736ddc446d..3814719a9cc1 100644 --- a/sound/soc/codecs/isabelle.c +++ b/sound/soc/codecs/isabelle.c @@ -140,17 +140,17 @@ static const char *isabelle_rx1_texts[] = {"VRX1", "ARX1"}; static const char *isabelle_rx2_texts[] = {"VRX2", "ARX2"};
static const struct soc_enum isabelle_rx1_enum[] = { - SOC_ENUM_SINGLE(ISABELLE_VOICE_HPF_CFG_REG, 3, - ARRAY_SIZE(isabelle_rx1_texts), isabelle_rx1_texts), - SOC_ENUM_SINGLE(ISABELLE_AUDIO_HPF_CFG_REG, 5, - ARRAY_SIZE(isabelle_rx1_texts), isabelle_rx1_texts), + SOC_ENUM_SINGLE_CONST(ISABELLE_VOICE_HPF_CFG_REG, 3, + isabelle_rx1_texts), + SOC_ENUM_SINGLE_CONST(ISABELLE_AUDIO_HPF_CFG_REG, 5, + isabelle_rx1_texts), };
static const struct soc_enum isabelle_rx2_enum[] = { - SOC_ENUM_SINGLE(ISABELLE_VOICE_HPF_CFG_REG, 2, - ARRAY_SIZE(isabelle_rx2_texts), isabelle_rx2_texts), - SOC_ENUM_SINGLE(ISABELLE_AUDIO_HPF_CFG_REG, 4, - ARRAY_SIZE(isabelle_rx2_texts), isabelle_rx2_texts), + SOC_ENUM_SINGLE_CONST(ISABELLE_VOICE_HPF_CFG_REG, 2, + isabelle_rx2_texts), + SOC_ENUM_SINGLE_CONST(ISABELLE_AUDIO_HPF_CFG_REG, 4, + isabelle_rx2_texts), };
/* Headset DAC playback switches */ @@ -165,17 +165,17 @@ static const char *isabelle_atx_texts[] = {"AMIC1", "DMIC"}; static const char *isabelle_vtx_texts[] = {"AMIC2", "DMIC"};
static const struct soc_enum isabelle_atx_enum[] = { - SOC_ENUM_SINGLE(ISABELLE_AMIC_CFG_REG, 7, - ARRAY_SIZE(isabelle_atx_texts), isabelle_atx_texts), - SOC_ENUM_SINGLE(ISABELLE_DMIC_CFG_REG, 0, - ARRAY_SIZE(isabelle_atx_texts), isabelle_atx_texts), + SOC_ENUM_SINGLE_CONST(ISABELLE_AMIC_CFG_REG, 7, + isabelle_atx_texts), + SOC_ENUM_SINGLE_CONST(ISABELLE_DMIC_CFG_REG, 0, + isabelle_atx_texts), };
static const struct soc_enum isabelle_vtx_enum[] = { - SOC_ENUM_SINGLE(ISABELLE_AMIC_CFG_REG, 6, - ARRAY_SIZE(isabelle_vtx_texts), isabelle_vtx_texts), - SOC_ENUM_SINGLE(ISABELLE_DMIC_CFG_REG, 0, - ARRAY_SIZE(isabelle_vtx_texts), isabelle_vtx_texts), + SOC_ENUM_SINGLE_CONST(ISABELLE_AMIC_CFG_REG, 6, + isabelle_vtx_texts), + SOC_ENUM_SINGLE_CONST(ISABELLE_DMIC_CFG_REG, 0, + isabelle_vtx_texts), };
static const struct snd_kcontrol_new atx_mux_controls = @@ -210,21 +210,17 @@ static const char *isabelle_st_audio_texts[] = {"ATX1", "ATX2"}; static const char *isabelle_st_voice_texts[] = {"VTX1", "VTX2"};
static const struct soc_enum isabelle_st_audio_enum[] = { - SOC_ENUM_SINGLE(ISABELLE_ATX_STPGA1_CFG_REG, 7, - ARRAY_SIZE(isabelle_st_audio_texts), - isabelle_st_audio_texts), - SOC_ENUM_SINGLE(ISABELLE_ATX_STPGA2_CFG_REG, 7, - ARRAY_SIZE(isabelle_st_audio_texts), - isabelle_st_audio_texts), + SOC_ENUM_SINGLE_CONST(ISABELLE_ATX_STPGA1_CFG_REG, 7, + isabelle_st_audio_texts), + SOC_ENUM_SINGLE_CONST(ISABELLE_ATX_STPGA2_CFG_REG, 7, + isabelle_st_audio_texts), };
static const struct soc_enum isabelle_st_voice_enum[] = { - SOC_ENUM_SINGLE(ISABELLE_VTX_STPGA1_CFG_REG, 7, - ARRAY_SIZE(isabelle_st_voice_texts), - isabelle_st_voice_texts), - SOC_ENUM_SINGLE(ISABELLE_VTX2_STPGA2_CFG_REG, 7, - ARRAY_SIZE(isabelle_st_voice_texts), - isabelle_st_voice_texts), + SOC_ENUM_SINGLE_CONST(ISABELLE_VTX_STPGA1_CFG_REG, 7, + isabelle_st_voice_texts), + SOC_ENUM_SINGLE_CONST(ISABELLE_VTX2_STPGA2_CFG_REG, 7, + isabelle_st_voice_texts), };
static const struct snd_kcontrol_new st_audio_control =
... for improving readability and maintainability.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/codecs/max9877.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/soc/codecs/max9877.c b/sound/soc/codecs/max9877.c index 29549cdbf4c1..8702bc69a449 100644 --- a/sound/soc/codecs/max9877.c +++ b/sound/soc/codecs/max9877.c @@ -63,10 +63,10 @@ static const char *max9877_osc_mode[] = { };
static const struct soc_enum max9877_enum[] = { - SOC_ENUM_SINGLE(MAX9877_OUTPUT_MODE, 0, ARRAY_SIZE(max9877_out_mode), - max9877_out_mode), - SOC_ENUM_SINGLE(MAX9877_OUTPUT_MODE, MAX9877_OSC_OFFSET, - ARRAY_SIZE(max9877_osc_mode), max9877_osc_mode), + SOC_ENUM_SINGLE_CONST(MAX9877_OUTPUT_MODE, 0, + max9877_out_mode), + SOC_ENUM_SINGLE_CONST(MAX9877_OUTPUT_MODE, MAX9877_OSC_OFFSET, + max9877_osc_mode), };
static const struct snd_kcontrol_new max9877_controls[] = {
... for improving readability and maintainability.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/codecs/ssm2602.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/sound/soc/codecs/ssm2602.c b/sound/soc/codecs/ssm2602.c index e32b82ff6304..f85aef825965 100644 --- a/sound/soc/codecs/ssm2602.c +++ b/sound/soc/codecs/ssm2602.c @@ -81,10 +81,8 @@ static const char *ssm2602_input_select[] = { static const char *ssm2602_deemph[] = {"None", "32Khz", "44.1Khz", "48Khz"};
static const struct soc_enum ssm2602_enum[] = { - SOC_ENUM_SINGLE(SSM2602_APANA, 2, ARRAY_SIZE(ssm2602_input_select), - ssm2602_input_select), - SOC_ENUM_SINGLE(SSM2602_APDIGI, 1, ARRAY_SIZE(ssm2602_deemph), - ssm2602_deemph), + SOC_ENUM_SINGLE_CONST(SSM2602_APANA, 2, ssm2602_input_select), + SOC_ENUM_SINGLE_CONST(SSM2602_APDIGI, 1, ssm2602_deemph), };
static const unsigned int ssm260x_outmix_tlv[] = {
... for improving readability and maintainability.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/codecs/tas5086.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/sound/soc/codecs/tas5086.c b/sound/soc/codecs/tas5086.c index a895a5e4bdf2..15600aef08ee 100644 --- a/sound/soc/codecs/tas5086.c +++ b/sound/soc/codecs/tas5086.c @@ -555,12 +555,12 @@ static const char *tas5086_dapm_sdin_texts[] = };
static const struct soc_enum tas5086_dapm_input_mux_enum[] = { - SOC_ENUM_SINGLE(TAS5086_INPUT_MUX, 20, 8, tas5086_dapm_sdin_texts), - SOC_ENUM_SINGLE(TAS5086_INPUT_MUX, 16, 8, tas5086_dapm_sdin_texts), - SOC_ENUM_SINGLE(TAS5086_INPUT_MUX, 12, 8, tas5086_dapm_sdin_texts), - SOC_ENUM_SINGLE(TAS5086_INPUT_MUX, 8, 8, tas5086_dapm_sdin_texts), - SOC_ENUM_SINGLE(TAS5086_INPUT_MUX, 4, 8, tas5086_dapm_sdin_texts), - SOC_ENUM_SINGLE(TAS5086_INPUT_MUX, 0, 8, tas5086_dapm_sdin_texts), + SOC_ENUM_SINGLE_CONST(TAS5086_INPUT_MUX, 20, tas5086_dapm_sdin_texts), + SOC_ENUM_SINGLE_CONST(TAS5086_INPUT_MUX, 16, tas5086_dapm_sdin_texts), + SOC_ENUM_SINGLE_CONST(TAS5086_INPUT_MUX, 12, tas5086_dapm_sdin_texts), + SOC_ENUM_SINGLE_CONST(TAS5086_INPUT_MUX, 8, tas5086_dapm_sdin_texts), + SOC_ENUM_SINGLE_CONST(TAS5086_INPUT_MUX, 4, tas5086_dapm_sdin_texts), + SOC_ENUM_SINGLE_CONST(TAS5086_INPUT_MUX, 0, tas5086_dapm_sdin_texts), };
static const struct snd_kcontrol_new tas5086_dapm_input_mux_controls[] = { @@ -578,12 +578,12 @@ static const char *tas5086_dapm_channel_texts[] = "Channel 4 Mux", "Channel 5 Mux", "Channel 6 Mux" };
static const struct soc_enum tas5086_dapm_output_mux_enum[] = { - SOC_ENUM_SINGLE(TAS5086_PWM_OUTPUT_MUX, 20, 6, tas5086_dapm_channel_texts), - SOC_ENUM_SINGLE(TAS5086_PWM_OUTPUT_MUX, 16, 6, tas5086_dapm_channel_texts), - SOC_ENUM_SINGLE(TAS5086_PWM_OUTPUT_MUX, 12, 6, tas5086_dapm_channel_texts), - SOC_ENUM_SINGLE(TAS5086_PWM_OUTPUT_MUX, 8, 6, tas5086_dapm_channel_texts), - SOC_ENUM_SINGLE(TAS5086_PWM_OUTPUT_MUX, 4, 6, tas5086_dapm_channel_texts), - SOC_ENUM_SINGLE(TAS5086_PWM_OUTPUT_MUX, 0, 6, tas5086_dapm_channel_texts), + SOC_ENUM_SINGLE_CONST(TAS5086_PWM_OUTPUT_MUX, 20, tas5086_dapm_channel_texts), + SOC_ENUM_SINGLE_CONST(TAS5086_PWM_OUTPUT_MUX, 16, tas5086_dapm_channel_texts), + SOC_ENUM_SINGLE_CONST(TAS5086_PWM_OUTPUT_MUX, 12, tas5086_dapm_channel_texts), + SOC_ENUM_SINGLE_CONST(TAS5086_PWM_OUTPUT_MUX, 8, tas5086_dapm_channel_texts), + SOC_ENUM_SINGLE_CONST(TAS5086_PWM_OUTPUT_MUX, 4, tas5086_dapm_channel_texts), + SOC_ENUM_SINGLE_CONST(TAS5086_PWM_OUTPUT_MUX, 0, tas5086_dapm_channel_texts), };
static const struct snd_kcontrol_new tas5086_dapm_output_mux_controls[] = {
... for improving readability and maintainability.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/codecs/tlv320aic3x.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c index 470fbfb4b386..a874f53da37e 100644 --- a/sound/soc/codecs/tlv320aic3x.c +++ b/sound/soc/codecs/tlv320aic3x.c @@ -238,36 +238,36 @@ static const char *aic3x_adc_hpf[] = #define ADC_HPF_ENUM 10
static const struct soc_enum aic3x_enum[] = { - SOC_ENUM_SINGLE(DAC_LINE_MUX, 6, 3, aic3x_left_dac_mux), - SOC_ENUM_SINGLE(DAC_LINE_MUX, 4, 3, aic3x_right_dac_mux), - SOC_ENUM_SINGLE(HPLCOM_CFG, 4, 3, aic3x_left_hpcom_mux), - SOC_ENUM_SINGLE(HPRCOM_CFG, 3, 5, aic3x_right_hpcom_mux), - SOC_ENUM_SINGLE(LINE1L_2_LADC_CTRL, 7, 2, aic3x_linein_mode_mux), - SOC_ENUM_SINGLE(LINE1L_2_RADC_CTRL, 7, 2, aic3x_linein_mode_mux), - SOC_ENUM_SINGLE(LINE1R_2_LADC_CTRL, 7, 2, aic3x_linein_mode_mux), - SOC_ENUM_SINGLE(LINE1R_2_RADC_CTRL, 7, 2, aic3x_linein_mode_mux), - SOC_ENUM_SINGLE(LINE2L_2_LADC_CTRL, 7, 2, aic3x_linein_mode_mux), - SOC_ENUM_SINGLE(LINE2R_2_RADC_CTRL, 7, 2, aic3x_linein_mode_mux), - SOC_ENUM_DOUBLE(AIC3X_CODEC_DFILT_CTRL, 6, 4, 4, aic3x_adc_hpf), + SOC_ENUM_SINGLE_CONST(DAC_LINE_MUX, 6, aic3x_left_dac_mux), + SOC_ENUM_SINGLE_CONST(DAC_LINE_MUX, 4, aic3x_right_dac_mux), + SOC_ENUM_SINGLE_CONST(HPLCOM_CFG, 4, aic3x_left_hpcom_mux), + SOC_ENUM_SINGLE_CONST(HPRCOM_CFG, 3, aic3x_right_hpcom_mux), + SOC_ENUM_SINGLE_CONST(LINE1L_2_LADC_CTRL, 7, aic3x_linein_mode_mux), + SOC_ENUM_SINGLE_CONST(LINE1L_2_RADC_CTRL, 7, aic3x_linein_mode_mux), + SOC_ENUM_SINGLE_CONST(LINE1R_2_LADC_CTRL, 7, aic3x_linein_mode_mux), + SOC_ENUM_SINGLE_CONST(LINE1R_2_RADC_CTRL, 7, aic3x_linein_mode_mux), + SOC_ENUM_SINGLE_CONST(LINE2L_2_LADC_CTRL, 7, aic3x_linein_mode_mux), + SOC_ENUM_SINGLE_CONST(LINE2R_2_RADC_CTRL, 7, aic3x_linein_mode_mux), + SOC_ENUM_DOUBLE_CONST(AIC3X_CODEC_DFILT_CTRL, 6, 4, aic3x_adc_hpf), };
static const char *aic3x_agc_level[] = { "-5.5dB", "-8dB", "-10dB", "-12dB", "-14dB", "-17dB", "-20dB", "-24dB" }; static const struct soc_enum aic3x_agc_level_enum[] = { - SOC_ENUM_SINGLE(LAGC_CTRL_A, 4, 8, aic3x_agc_level), - SOC_ENUM_SINGLE(RAGC_CTRL_A, 4, 8, aic3x_agc_level), + SOC_ENUM_SINGLE_CONST(LAGC_CTRL_A, 4, aic3x_agc_level), + SOC_ENUM_SINGLE_CONST(RAGC_CTRL_A, 4, aic3x_agc_level), };
static const char *aic3x_agc_attack[] = { "8ms", "11ms", "16ms", "20ms" }; static const struct soc_enum aic3x_agc_attack_enum[] = { - SOC_ENUM_SINGLE(LAGC_CTRL_A, 2, 4, aic3x_agc_attack), - SOC_ENUM_SINGLE(RAGC_CTRL_A, 2, 4, aic3x_agc_attack), + SOC_ENUM_SINGLE_CONST(LAGC_CTRL_A, 2, aic3x_agc_attack), + SOC_ENUM_SINGLE_CONST(RAGC_CTRL_A, 2, aic3x_agc_attack), };
static const char *aic3x_agc_decay[] = { "100ms", "200ms", "400ms", "500ms" }; static const struct soc_enum aic3x_agc_decay_enum[] = { - SOC_ENUM_SINGLE(LAGC_CTRL_A, 0, 4, aic3x_agc_decay), - SOC_ENUM_SINGLE(RAGC_CTRL_A, 0, 4, aic3x_agc_decay), + SOC_ENUM_SINGLE_CONST(LAGC_CTRL_A, 0, aic3x_agc_decay), + SOC_ENUM_SINGLE_CONST(RAGC_CTRL_A, 0, aic3x_agc_decay), };
/*
... for improving readability and maintainability.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/codecs/twl6040.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-)
diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c index bd3a20647fdf..f50dbd7dc4b2 100644 --- a/sound/soc/codecs/twl6040.c +++ b/sound/soc/codecs/twl6040.c @@ -392,10 +392,8 @@ static const char *twl6040_amicr_texts[] = {"Headset Mic", "Sub Mic", "Aux/FM Right", "Off"};
static const struct soc_enum twl6040_enum[] = { - SOC_ENUM_SINGLE(TWL6040_REG_MICLCTL, 3, - ARRAY_SIZE(twl6040_amicl_texts), twl6040_amicl_texts), - SOC_ENUM_SINGLE(TWL6040_REG_MICRCTL, 3, - ARRAY_SIZE(twl6040_amicr_texts), twl6040_amicr_texts), + SOC_ENUM_SINGLE_CONST(TWL6040_REG_MICLCTL, 3, twl6040_amicl_texts), + SOC_ENUM_SINGLE_CONST(TWL6040_REG_MICRCTL, 3, twl6040_amicr_texts), };
static const char *twl6040_hs_texts[] = { @@ -403,10 +401,8 @@ static const char *twl6040_hs_texts[] = { };
static const struct soc_enum twl6040_hs_enum[] = { - SOC_ENUM_SINGLE(TWL6040_REG_HSLCTL, 5, ARRAY_SIZE(twl6040_hs_texts), - twl6040_hs_texts), - SOC_ENUM_SINGLE(TWL6040_REG_HSRCTL, 5, ARRAY_SIZE(twl6040_hs_texts), - twl6040_hs_texts), + SOC_ENUM_SINGLE_CONST(TWL6040_REG_HSLCTL, 5, twl6040_hs_texts), + SOC_ENUM_SINGLE_CONST(TWL6040_REG_HSRCTL, 5, twl6040_hs_texts), };
static const char *twl6040_hf_texts[] = { @@ -414,10 +410,8 @@ static const char *twl6040_hf_texts[] = { };
static const struct soc_enum twl6040_hf_enum[] = { - SOC_ENUM_SINGLE(TWL6040_REG_HFLCTL, 2, ARRAY_SIZE(twl6040_hf_texts), - twl6040_hf_texts), - SOC_ENUM_SINGLE(TWL6040_REG_HFRCTL, 2, ARRAY_SIZE(twl6040_hf_texts), - twl6040_hf_texts), + SOC_ENUM_SINGLE_CONST(TWL6040_REG_HFLCTL, 2, twl6040_hf_texts), + SOC_ENUM_SINGLE_CONST(TWL6040_REG_HFRCTL, 2, twl6040_hf_texts), };
static const char *twl6040_vibrapath_texts[] = { @@ -425,12 +419,8 @@ static const char *twl6040_vibrapath_texts[] = { };
static const struct soc_enum twl6040_vibra_enum[] = { - SOC_ENUM_SINGLE(TWL6040_REG_VIBCTLL, 1, - ARRAY_SIZE(twl6040_vibrapath_texts), - twl6040_vibrapath_texts), - SOC_ENUM_SINGLE(TWL6040_REG_VIBCTLR, 1, - ARRAY_SIZE(twl6040_vibrapath_texts), - twl6040_vibrapath_texts), + SOC_ENUM_SINGLE_CONST(TWL6040_REG_VIBCTLL, 1, twl6040_vibrapath_texts), + SOC_ENUM_SINGLE_CONST(TWL6040_REG_VIBCTLR, 1, twl6040_vibrapath_texts), };
static const struct snd_kcontrol_new amicl_control =
... for improving readability and maintainability.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/codecs/uda134x.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/codecs/uda134x.c b/sound/soc/codecs/uda134x.c index c94d4c1e3dac..cce7adf35531 100644 --- a/sound/soc/codecs/uda134x.c +++ b/sound/soc/codecs/uda134x.c @@ -362,9 +362,9 @@ static const char *uda134x_mixmode[] = {"Differential", "Analog1", "Analog2", "Both"};
static const struct soc_enum uda134x_mixer_enum[] = { -SOC_ENUM_SINGLE(UDA134X_DATA010, 0, 0x04, uda134x_dsp_setting), -SOC_ENUM_SINGLE(UDA134X_DATA010, 3, 0x04, uda134x_deemph), -SOC_ENUM_SINGLE(UDA134X_EA010, 0, 0x04, uda134x_mixmode), +SOC_ENUM_SINGLE_CONST(UDA134X_DATA010, 0, uda134x_dsp_setting), +SOC_ENUM_SINGLE_CONST(UDA134X_DATA010, 3, uda134x_deemph), +SOC_ENUM_SINGLE_CONST(UDA134X_EA010, 0, uda134x_mixmode), };
static const struct snd_kcontrol_new uda1341_snd_controls[] = {
... for improving readability and maintainability.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/codecs/uda1380.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/sound/soc/codecs/uda1380.c b/sound/soc/codecs/uda1380.c index 72ee8e1838e5..9f112c41325e 100644 --- a/sound/soc/codecs/uda1380.c +++ b/sound/soc/codecs/uda1380.c @@ -237,10 +237,8 @@ static const char *uda1380_os_setting[] = { };
static const struct soc_enum uda1380_deemp_enum[] = { - SOC_ENUM_SINGLE(UDA1380_DEEMP, 8, ARRAY_SIZE(uda1380_deemp), - uda1380_deemp), - SOC_ENUM_SINGLE(UDA1380_DEEMP, 0, ARRAY_SIZE(uda1380_deemp), - uda1380_deemp), + SOC_ENUM_SINGLE_CONST(UDA1380_DEEMP, 8, uda1380_deemp), + SOC_ENUM_SINGLE_CONST(UDA1380_DEEMP, 0, uda1380_deemp), }; static SOC_ENUM_SINGLE_DECL(uda1380_input_sel_enum, UDA1380_ADC, 2, uda1380_input_sel); /* SEL_MIC, SEL_LNA */
... for improving readability and maintainability.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/codecs/wm8350.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c index a183dcf3d5c1..1d8d1424264a 100644 --- a/sound/soc/codecs/wm8350.c +++ b/sound/soc/codecs/wm8350.c @@ -381,14 +381,14 @@ static const char *wm8350_adchp[] = { "44.1kHz", "8kHz", "16kHz", "32kHz" }; static const char *wm8350_lr[] = { "Left", "Right" };
static const struct soc_enum wm8350_enum[] = { - SOC_ENUM_SINGLE(WM8350_DAC_CONTROL, 4, 4, wm8350_deemp), - SOC_ENUM_SINGLE(WM8350_DAC_CONTROL, 0, 4, wm8350_pol), - SOC_ENUM_SINGLE(WM8350_DAC_MUTE_VOLUME, 14, 2, wm8350_dacmutem), - SOC_ENUM_SINGLE(WM8350_DAC_MUTE_VOLUME, 13, 2, wm8350_dacmutes), - SOC_ENUM_SINGLE(WM8350_ADC_CONTROL, 15, 2, wm8350_adcfilter), - SOC_ENUM_SINGLE(WM8350_ADC_CONTROL, 8, 4, wm8350_adchp), - SOC_ENUM_SINGLE(WM8350_ADC_CONTROL, 0, 4, wm8350_pol), - SOC_ENUM_SINGLE(WM8350_INPUT_MIXER_VOLUME, 15, 2, wm8350_lr), + SOC_ENUM_SINGLE_CONST(WM8350_DAC_CONTROL, 4, wm8350_deemp), + SOC_ENUM_SINGLE_CONST(WM8350_DAC_CONTROL, 0, wm8350_pol), + SOC_ENUM_SINGLE_CONST(WM8350_DAC_MUTE_VOLUME, 14, wm8350_dacmutem), + SOC_ENUM_SINGLE_CONST(WM8350_DAC_MUTE_VOLUME, 13, wm8350_dacmutes), + SOC_ENUM_SINGLE_CONST(WM8350_ADC_CONTROL, 15, wm8350_adcfilter), + SOC_ENUM_SINGLE_CONST(WM8350_ADC_CONTROL, 8, wm8350_adchp), + SOC_ENUM_SINGLE_CONST(WM8350_ADC_CONTROL, 0, wm8350_pol), + SOC_ENUM_SINGLE_CONST(WM8350_INPUT_MIXER_VOLUME, 15, wm8350_lr), };
static DECLARE_TLV_DB_SCALE(pre_amp_tlv, -1200, 3525, 0);
... for improving readability and maintainability.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/codecs/wm8510.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/soc/codecs/wm8510.c b/sound/soc/codecs/wm8510.c index 7df7d4572755..0195765aaa86 100644 --- a/sound/soc/codecs/wm8510.c +++ b/sound/soc/codecs/wm8510.c @@ -118,10 +118,10 @@ static const char *wm8510_deemp[] = { "None", "32kHz", "44.1kHz", "48kHz" }; static const char *wm8510_alc[] = { "ALC", "Limiter" };
static const struct soc_enum wm8510_enum[] = { - SOC_ENUM_SINGLE(WM8510_COMP, 1, 4, wm8510_companding), /* adc */ - SOC_ENUM_SINGLE(WM8510_COMP, 3, 4, wm8510_companding), /* dac */ - SOC_ENUM_SINGLE(WM8510_DAC, 4, 4, wm8510_deemp), - SOC_ENUM_SINGLE(WM8510_ALC3, 8, 2, wm8510_alc), + SOC_ENUM_SINGLE_CONST(WM8510_COMP, 1, wm8510_companding), /* adc */ + SOC_ENUM_SINGLE_CONST(WM8510_COMP, 3, wm8510_companding), /* dac */ + SOC_ENUM_SINGLE_CONST(WM8510_DAC, 4, wm8510_deemp), + SOC_ENUM_SINGLE_CONST(WM8510_ALC3, 8, wm8510_alc), };
static const struct snd_kcontrol_new wm8510_snd_controls[] = {
... for improving readability and maintainability.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/codecs/wm8750.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/sound/soc/codecs/wm8750.c b/sound/soc/codecs/wm8750.c index 78616a638a55..c824c43fe7a5 100644 --- a/sound/soc/codecs/wm8750.c +++ b/sound/soc/codecs/wm8750.c @@ -114,23 +114,23 @@ static const char *wm8750_mono_mux[] = {"Stereo", "Mono (Left)", "Mono (Right)", "Digital Mono"};
static const struct soc_enum wm8750_enum[] = { -SOC_ENUM_SINGLE(WM8750_BASS, 7, 2, wm8750_bass), -SOC_ENUM_SINGLE(WM8750_BASS, 6, 2, wm8750_bass_filter), -SOC_ENUM_SINGLE(WM8750_TREBLE, 6, 2, wm8750_treble), -SOC_ENUM_SINGLE(WM8750_3D, 5, 2, wm8750_3d_lc), -SOC_ENUM_SINGLE(WM8750_3D, 6, 2, wm8750_3d_uc), -SOC_ENUM_SINGLE(WM8750_3D, 7, 2, wm8750_3d_func), -SOC_ENUM_SINGLE(WM8750_ALC1, 7, 4, wm8750_alc_func), -SOC_ENUM_SINGLE(WM8750_NGATE, 1, 2, wm8750_ng_type), -SOC_ENUM_SINGLE(WM8750_LOUTM1, 0, 5, wm8750_line_mux), -SOC_ENUM_SINGLE(WM8750_ROUTM1, 0, 5, wm8750_line_mux), -SOC_ENUM_SINGLE(WM8750_LADCIN, 6, 4, wm8750_pga_sel), /* 10 */ -SOC_ENUM_SINGLE(WM8750_RADCIN, 6, 4, wm8750_pga_sel), -SOC_ENUM_SINGLE(WM8750_ADCTL2, 7, 4, wm8750_out3), -SOC_ENUM_SINGLE(WM8750_ADCIN, 8, 2, wm8750_diff_sel), -SOC_ENUM_SINGLE(WM8750_ADCDAC, 5, 4, wm8750_adcpol), -SOC_ENUM_SINGLE(WM8750_ADCDAC, 1, 4, wm8750_deemph), -SOC_ENUM_SINGLE(WM8750_ADCIN, 6, 4, wm8750_mono_mux), /* 16 */ +SOC_ENUM_SINGLE_CONST(WM8750_BASS, 7, wm8750_bass), +SOC_ENUM_SINGLE_CONST(WM8750_BASS, 6, wm8750_bass_filter), +SOC_ENUM_SINGLE_CONST(WM8750_TREBLE, 6, wm8750_treble), +SOC_ENUM_SINGLE_CONST(WM8750_3D, 5, wm8750_3d_lc), +SOC_ENUM_SINGLE_CONST(WM8750_3D, 6, wm8750_3d_uc), +SOC_ENUM_SINGLE_CONST(WM8750_3D, 7, wm8750_3d_func), +SOC_ENUM_SINGLE_CONST(WM8750_ALC1, 7, wm8750_alc_func), +SOC_ENUM_SINGLE_CONST(WM8750_NGATE, 1, wm8750_ng_type), +SOC_ENUM_SINGLE_CONST(WM8750_LOUTM1, 0, wm8750_line_mux), +SOC_ENUM_SINGLE_CONST(WM8750_ROUTM1, 0, wm8750_line_mux), +SOC_ENUM_SINGLE_CONST(WM8750_LADCIN, 6, wm8750_pga_sel), /* 10 */ +SOC_ENUM_SINGLE_CONST(WM8750_RADCIN, 6, wm8750_pga_sel), +SOC_ENUM_SINGLE_CONST(WM8750_ADCTL2, 7, wm8750_out3), +SOC_ENUM_SINGLE_CONST(WM8750_ADCIN, 8, wm8750_diff_sel), +SOC_ENUM_SINGLE_CONST(WM8750_ADCDAC, 5, wm8750_adcpol), +SOC_ENUM_SINGLE_CONST(WM8750_ADCDAC, 1, wm8750_deemph), +SOC_ENUM_SINGLE_CONST(WM8750_ADCIN, 6, wm8750_mono_mux), /* 16 */
};
... for improving readability and maintainability.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/codecs/wm8753.c | 58 +++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 29 deletions(-)
diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c index be85da93a268..39abbdadcfb7 100644 --- a/sound/soc/codecs/wm8753.c +++ b/sound/soc/codecs/wm8753.c @@ -199,35 +199,35 @@ static const char *wm8753_dat_sel[] = {"Stereo", "Left ADC", "Right ADC", static const char *wm8753_rout2_phase[] = {"Non Inverted", "Inverted"};
static const struct soc_enum wm8753_enum[] = { -SOC_ENUM_SINGLE(WM8753_BASS, 7, 2, wm8753_base), -SOC_ENUM_SINGLE(WM8753_BASS, 4, 6, wm8753_base_filter), -SOC_ENUM_SINGLE(WM8753_TREBLE, 6, 2, wm8753_treble), -SOC_ENUM_SINGLE(WM8753_ALC1, 7, 4, wm8753_alc_func), -SOC_ENUM_SINGLE(WM8753_NGATE, 1, 2, wm8753_ng_type), -SOC_ENUM_SINGLE(WM8753_3D, 7, 2, wm8753_3d_func), -SOC_ENUM_SINGLE(WM8753_3D, 6, 2, wm8753_3d_uc), -SOC_ENUM_SINGLE(WM8753_3D, 5, 2, wm8753_3d_lc), -SOC_ENUM_SINGLE(WM8753_DAC, 1, 4, wm8753_deemp), -SOC_ENUM_SINGLE(WM8753_DAC, 4, 4, wm8753_mono_mix), -SOC_ENUM_SINGLE(WM8753_DAC, 6, 2, wm8753_dac_phase), -SOC_ENUM_SINGLE(WM8753_INCTL1, 3, 4, wm8753_line_mix), -SOC_ENUM_SINGLE(WM8753_INCTL1, 2, 2, wm8753_mono_mux), -SOC_ENUM_SINGLE(WM8753_INCTL1, 1, 2, wm8753_right_mux), -SOC_ENUM_SINGLE(WM8753_INCTL1, 0, 2, wm8753_left_mux), -SOC_ENUM_SINGLE(WM8753_INCTL2, 6, 4, wm8753_rxmsel), -SOC_ENUM_SINGLE(WM8753_INCTL2, 4, 4, wm8753_sidetone_mux), -SOC_ENUM_SINGLE(WM8753_OUTCTL, 7, 4, wm8753_mono2_src), -SOC_ENUM_SINGLE(WM8753_OUTCTL, 0, 3, wm8753_out3), -SOC_ENUM_SINGLE(WM8753_ADCTL2, 7, 3, wm8753_out4), -SOC_ENUM_SINGLE(WM8753_ADCIN, 2, 3, wm8753_radcsel), -SOC_ENUM_SINGLE(WM8753_ADCIN, 0, 3, wm8753_ladcsel), -SOC_ENUM_SINGLE(WM8753_ADCIN, 4, 4, wm8753_mono_adc), -SOC_ENUM_SINGLE(WM8753_ADC, 2, 4, wm8753_adc_hp), -SOC_ENUM_SINGLE(WM8753_ADC, 4, 2, wm8753_adc_filter), -SOC_ENUM_SINGLE(WM8753_MICBIAS, 6, 3, wm8753_mic_sel), -SOC_ENUM_SINGLE(WM8753_IOCTL, 2, 4, wm8753_dai_mode), -SOC_ENUM_SINGLE(WM8753_ADC, 7, 4, wm8753_dat_sel), -SOC_ENUM_SINGLE(WM8753_OUTCTL, 2, 2, wm8753_rout2_phase), +SOC_ENUM_SINGLE_CONST(WM8753_BASS, 7, wm8753_base), +SOC_ENUM_SINGLE_CONST(WM8753_BASS, 4, wm8753_base_filter), +SOC_ENUM_SINGLE_CONST(WM8753_TREBLE, 6, wm8753_treble), +SOC_ENUM_SINGLE_CONST(WM8753_ALC1, 7, wm8753_alc_func), +SOC_ENUM_SINGLE_CONST(WM8753_NGATE, 1, wm8753_ng_type), +SOC_ENUM_SINGLE_CONST(WM8753_3D, 7, wm8753_3d_func), +SOC_ENUM_SINGLE_CONST(WM8753_3D, 6, wm8753_3d_uc), +SOC_ENUM_SINGLE_CONST(WM8753_3D, 5, wm8753_3d_lc), +SOC_ENUM_SINGLE_CONST(WM8753_DAC, 1, wm8753_deemp), +SOC_ENUM_SINGLE_CONST(WM8753_DAC, 4, wm8753_mono_mix), +SOC_ENUM_SINGLE_CONST(WM8753_DAC, 6, wm8753_dac_phase), +SOC_ENUM_SINGLE_CONST(WM8753_INCTL1, 3, wm8753_line_mix), +SOC_ENUM_SINGLE_CONST(WM8753_INCTL1, 2, wm8753_mono_mux), +SOC_ENUM_SINGLE_CONST(WM8753_INCTL1, 1, wm8753_right_mux), +SOC_ENUM_SINGLE_CONST(WM8753_INCTL1, 0, wm8753_left_mux), +SOC_ENUM_SINGLE_CONST(WM8753_INCTL2, 6, wm8753_rxmsel), +SOC_ENUM_SINGLE_CONST(WM8753_INCTL2, 4, wm8753_sidetone_mux), +SOC_ENUM_SINGLE_CONST(WM8753_OUTCTL, 7, wm8753_mono2_src), +SOC_ENUM_SINGLE_CONST(WM8753_OUTCTL, 0, wm8753_out3), +SOC_ENUM_SINGLE_CONST(WM8753_ADCTL2, 7, wm8753_out4), +SOC_ENUM_SINGLE_CONST(WM8753_ADCIN, 2, wm8753_radcsel), +SOC_ENUM_SINGLE_CONST(WM8753_ADCIN, 0, wm8753_ladcsel), +SOC_ENUM_SINGLE_CONST(WM8753_ADCIN, 4, wm8753_mono_adc), +SOC_ENUM_SINGLE_CONST(WM8753_ADC, 2, wm8753_adc_hp), +SOC_ENUM_SINGLE_CONST(WM8753_ADC, 4, wm8753_adc_filter), +SOC_ENUM_SINGLE_CONST(WM8753_MICBIAS, 6, wm8753_mic_sel), +SOC_ENUM_SINGLE_CONST(WM8753_IOCTL, 2, wm8753_dai_mode), +SOC_ENUM_SINGLE_CONST(WM8753_ADC, 7, wm8753_dat_sel), +SOC_ENUM_SINGLE_CONST(WM8753_OUTCTL, 2, wm8753_rout2_phase), };
... for improving readability and maintainability.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/codecs/wm8960.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c index f156010e52bc..79cf2d6c459e 100644 --- a/sound/soc/codecs/wm8960.c +++ b/sound/soc/codecs/wm8960.c @@ -138,12 +138,12 @@ static const char *wm8960_alcfunc[] = {"Off", "Right", "Left", "Stereo"}; static const char *wm8960_alcmode[] = {"ALC", "Limiter"};
static const struct soc_enum wm8960_enum[] = { - SOC_ENUM_SINGLE(WM8960_DACCTL1, 5, 4, wm8960_polarity), - SOC_ENUM_SINGLE(WM8960_DACCTL2, 5, 4, wm8960_polarity), - SOC_ENUM_SINGLE(WM8960_3D, 6, 2, wm8960_3d_upper_cutoff), - SOC_ENUM_SINGLE(WM8960_3D, 5, 2, wm8960_3d_lower_cutoff), - SOC_ENUM_SINGLE(WM8960_ALC1, 7, 4, wm8960_alcfunc), - SOC_ENUM_SINGLE(WM8960_ALC3, 8, 2, wm8960_alcmode), + SOC_ENUM_SINGLE_CONST(WM8960_DACCTL1, 5, wm8960_polarity), + SOC_ENUM_SINGLE_CONST(WM8960_DACCTL2, 5, wm8960_polarity), + SOC_ENUM_SINGLE_CONST(WM8960_3D, 6, wm8960_3d_upper_cutoff), + SOC_ENUM_SINGLE_CONST(WM8960_3D, 5, wm8960_3d_lower_cutoff), + SOC_ENUM_SINGLE_CONST(WM8960_ALC1, 7, wm8960_alcfunc), + SOC_ENUM_SINGLE_CONST(WM8960_ALC3, 8, wm8960_alcmode), };
static const int deemph_settings[] = { 0, 32000, 44100, 48000 };
... for improving readability and maintainability.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/codecs/wm8971.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/sound/soc/codecs/wm8971.c b/sound/soc/codecs/wm8971.c index 67aba78a7ca5..54fda9dc434d 100644 --- a/sound/soc/codecs/wm8971.c +++ b/sound/soc/codecs/wm8971.c @@ -113,20 +113,20 @@ static const char *wm8971_adcpol[] = {"Normal", "L Invert", "R Invert", "L + R Invert"};
static const struct soc_enum wm8971_enum[] = { - SOC_ENUM_SINGLE(WM8971_BASS, 7, 2, wm8971_bass), /* 0 */ - SOC_ENUM_SINGLE(WM8971_BASS, 6, 2, wm8971_bass_filter), - SOC_ENUM_SINGLE(WM8971_TREBLE, 6, 2, wm8971_treble), - SOC_ENUM_SINGLE(WM8971_ALC1, 7, 4, wm8971_alc_func), - SOC_ENUM_SINGLE(WM8971_NGATE, 1, 2, wm8971_ng_type), /* 4 */ - SOC_ENUM_SINGLE(WM8971_ADCDAC, 1, 4, wm8971_deemp), - SOC_ENUM_SINGLE(WM8971_ADCTL1, 4, 4, wm8971_mono_mux), - SOC_ENUM_SINGLE(WM8971_ADCTL1, 1, 2, wm8971_dac_phase), - SOC_ENUM_SINGLE(WM8971_LOUTM1, 0, 5, wm8971_lline_mux), /* 8 */ - SOC_ENUM_SINGLE(WM8971_ROUTM1, 0, 5, wm8971_rline_mux), - SOC_ENUM_SINGLE(WM8971_LADCIN, 6, 4, wm8971_lpga_sel), - SOC_ENUM_SINGLE(WM8971_RADCIN, 6, 4, wm8971_rpga_sel), - SOC_ENUM_SINGLE(WM8971_ADCDAC, 5, 4, wm8971_adcpol), /* 12 */ - SOC_ENUM_SINGLE(WM8971_ADCIN, 6, 4, wm8971_mono_mux), + SOC_ENUM_SINGLE_CONST(WM8971_BASS, 7, wm8971_bass), /* 0 */ + SOC_ENUM_SINGLE_CONST(WM8971_BASS, 6, wm8971_bass_filter), + SOC_ENUM_SINGLE_CONST(WM8971_TREBLE, 6, wm8971_treble), + SOC_ENUM_SINGLE_CONST(WM8971_ALC1, 7, wm8971_alc_func), + SOC_ENUM_SINGLE_CONST(WM8971_NGATE, 1, wm8971_ng_type), /* 4 */ + SOC_ENUM_SINGLE_CONST(WM8971_ADCDAC, 1, wm8971_deemp), + SOC_ENUM_SINGLE_CONST(WM8971_ADCTL1, 4, wm8971_mono_mux), + SOC_ENUM_SINGLE_CONST(WM8971_ADCTL1, 1, wm8971_dac_phase), + SOC_ENUM_SINGLE_CONST(WM8971_LOUTM1, 0, wm8971_lline_mux), /* 8 */ + SOC_ENUM_SINGLE_CONST(WM8971_ROUTM1, 0, wm8971_rline_mux), + SOC_ENUM_SINGLE_CONST(WM8971_LADCIN, 6, wm8971_lpga_sel), + SOC_ENUM_SINGLE_CONST(WM8971_RADCIN, 6, wm8971_rpga_sel), + SOC_ENUM_SINGLE_CONST(WM8971_ADCDAC, 5, wm8971_adcpol), /* 12 */ + SOC_ENUM_SINGLE_CONST(WM8971_ADCIN, 6, wm8971_mono_mux), };
static const struct snd_kcontrol_new wm8971_snd_controls[] = {
... for improving readability and maintainability.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/codecs/wm8974.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/sound/soc/codecs/wm8974.c b/sound/soc/codecs/wm8974.c index 6e16c4306461..cc30ec5b844d 100644 --- a/sound/soc/codecs/wm8974.c +++ b/sound/soc/codecs/wm8974.c @@ -63,23 +63,23 @@ static const char *wm8974_eq5[] = {"5.3kHz", "6.9kHz", "9kHz", "11.7kHz" }; static const char *wm8974_alc[] = {"ALC", "Limiter" };
static const struct soc_enum wm8974_enum[] = { - SOC_ENUM_SINGLE(WM8974_COMP, 1, 4, wm8974_companding), /* adc */ - SOC_ENUM_SINGLE(WM8974_COMP, 3, 4, wm8974_companding), /* dac */ - SOC_ENUM_SINGLE(WM8974_DAC, 4, 4, wm8974_deemp), - SOC_ENUM_SINGLE(WM8974_EQ1, 8, 2, wm8974_eqmode), - - SOC_ENUM_SINGLE(WM8974_EQ1, 5, 4, wm8974_eq1), - SOC_ENUM_SINGLE(WM8974_EQ2, 8, 2, wm8974_bw), - SOC_ENUM_SINGLE(WM8974_EQ2, 5, 4, wm8974_eq2), - SOC_ENUM_SINGLE(WM8974_EQ3, 8, 2, wm8974_bw), - - SOC_ENUM_SINGLE(WM8974_EQ3, 5, 4, wm8974_eq3), - SOC_ENUM_SINGLE(WM8974_EQ4, 8, 2, wm8974_bw), - SOC_ENUM_SINGLE(WM8974_EQ4, 5, 4, wm8974_eq4), - SOC_ENUM_SINGLE(WM8974_EQ5, 8, 2, wm8974_bw), - - SOC_ENUM_SINGLE(WM8974_EQ5, 5, 4, wm8974_eq5), - SOC_ENUM_SINGLE(WM8974_ALC3, 8, 2, wm8974_alc), + SOC_ENUM_SINGLE_CONST(WM8974_COMP, 1, wm8974_companding), /* adc */ + SOC_ENUM_SINGLE_CONST(WM8974_COMP, 3, wm8974_companding), /* dac */ + SOC_ENUM_SINGLE_CONST(WM8974_DAC, 4, wm8974_deemp), + SOC_ENUM_SINGLE_CONST(WM8974_EQ1, 8, wm8974_eqmode), + + SOC_ENUM_SINGLE_CONST(WM8974_EQ1, 5, wm8974_eq1), + SOC_ENUM_SINGLE_CONST(WM8974_EQ2, 8, wm8974_bw), + SOC_ENUM_SINGLE_CONST(WM8974_EQ2, 5, wm8974_eq2), + SOC_ENUM_SINGLE_CONST(WM8974_EQ3, 8, wm8974_bw), + + SOC_ENUM_SINGLE_CONST(WM8974_EQ3, 5, wm8974_eq3), + SOC_ENUM_SINGLE_CONST(WM8974_EQ4, 8, wm8974_bw), + SOC_ENUM_SINGLE_CONST(WM8974_EQ4, 5, wm8974_eq4), + SOC_ENUM_SINGLE_CONST(WM8974_EQ5, 8, wm8974_bw), + + SOC_ENUM_SINGLE_CONST(WM8974_EQ5, 5, wm8974_eq5), + SOC_ENUM_SINGLE_CONST(WM8974_ALC3, 8, wm8974_alc), };
static const char *wm8974_auxmode_text[] = { "Buffer", "Mixer" };
... for improving readability and maintainability.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/codecs/wm9712.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c index c5eb746087b4..0327fff492bb 100644 --- a/sound/soc/codecs/wm9712.c +++ b/sound/soc/codecs/wm9712.c @@ -74,18 +74,18 @@ static const DECLARE_TLV_DB_SCALE(main_tlv, -3450, 150, 0); static const DECLARE_TLV_DB_SCALE(boost_tlv, 0, 2000, 0);
static const struct soc_enum wm9712_enum[] = { -SOC_ENUM_SINGLE(AC97_PCI_SVID, 14, 4, wm9712_alc_select), -SOC_ENUM_SINGLE(AC97_VIDEO, 12, 4, wm9712_alc_mux), -SOC_ENUM_SINGLE(AC97_AUX, 9, 4, wm9712_out3_src), -SOC_ENUM_SINGLE(AC97_AUX, 8, 2, wm9712_spk_src), -SOC_ENUM_SINGLE(AC97_REC_SEL, 12, 4, wm9712_rec_adc), -SOC_ENUM_SINGLE(AC97_MASTER_TONE, 15, 2, wm9712_base), -SOC_ENUM_DOUBLE(AC97_REC_GAIN, 14, 6, 2, wm9712_rec_gain), -SOC_ENUM_SINGLE(AC97_MIC, 5, 4, wm9712_mic), -SOC_ENUM_SINGLE(AC97_REC_SEL, 8, 8, wm9712_rec_sel), -SOC_ENUM_SINGLE(AC97_REC_SEL, 0, 8, wm9712_rec_sel), -SOC_ENUM_SINGLE(AC97_PCI_SVID, 5, 2, wm9712_ng_type), -SOC_ENUM_SINGLE(0x5c, 8, 2, wm9712_diff_sel), +SOC_ENUM_SINGLE_CONST(AC97_PCI_SVID, 14, wm9712_alc_select), +SOC_ENUM_SINGLE_CONST(AC97_VIDEO, 12, wm9712_alc_mux), +SOC_ENUM_SINGLE_CONST(AC97_AUX, 9, wm9712_out3_src), +SOC_ENUM_SINGLE_CONST(AC97_AUX, 8, wm9712_spk_src), +SOC_ENUM_SINGLE_CONST(AC97_REC_SEL, 12, wm9712_rec_adc), +SOC_ENUM_SINGLE_CONST(AC97_MASTER_TONE, 15, wm9712_base), +SOC_ENUM_DOUBLE_CONST(AC97_REC_GAIN, 14, 6, wm9712_rec_gain), +SOC_ENUM_SINGLE_CONST(AC97_MIC, 5, wm9712_mic), +SOC_ENUM_SINGLE_CONST(AC97_REC_SEL, 8, wm9712_rec_sel), +SOC_ENUM_SINGLE_CONST(AC97_REC_SEL, 0, wm9712_rec_sel), +SOC_ENUM_SINGLE_CONST(AC97_PCI_SVID, 5, wm9712_ng_type), +SOC_ENUM_SINGLE_CONST(0x5c, 8, wm9712_diff_sel), };
static const struct snd_kcontrol_new wm9712_snd_ac97_controls[] = {
... for improving readability and maintainability.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/codecs/wm9713.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c index acea8927905b..87a520727429 100644 --- a/sound/soc/codecs/wm9713.c +++ b/sound/soc/codecs/wm9713.c @@ -92,26 +92,26 @@ static const char *wm9713_mic_select[] = {"Mic 1", "Mic 2 A", "Mic 2 B"}; static const char *wm9713_micb_select[] = {"MPB", "MPA"};
static const struct soc_enum wm9713_enum[] = { -SOC_ENUM_SINGLE(AC97_LINE, 3, 4, wm9713_mic_mixer), /* record mic mixer 0 */ -SOC_ENUM_SINGLE(AC97_VIDEO, 14, 4, wm9713_rec_mux), /* record mux hp 1 */ -SOC_ENUM_SINGLE(AC97_VIDEO, 9, 4, wm9713_rec_mux), /* record mux mono 2 */ -SOC_ENUM_SINGLE(AC97_VIDEO, 3, 8, wm9713_rec_src), /* record mux left 3 */ -SOC_ENUM_SINGLE(AC97_VIDEO, 0, 8, wm9713_rec_src), /* record mux right 4*/ -SOC_ENUM_DOUBLE(AC97_CD, 14, 6, 2, wm9713_rec_gain), /* record step size 5 */ -SOC_ENUM_SINGLE(AC97_PCI_SVID, 14, 4, wm9713_alc_select), /* alc source select 6*/ -SOC_ENUM_SINGLE(AC97_REC_GAIN, 14, 4, wm9713_mono_pga), /* mono input select 7 */ -SOC_ENUM_SINGLE(AC97_REC_GAIN, 11, 8, wm9713_spk_pga), /* speaker left input select 8 */ -SOC_ENUM_SINGLE(AC97_REC_GAIN, 8, 8, wm9713_spk_pga), /* speaker right input select 9 */ -SOC_ENUM_SINGLE(AC97_REC_GAIN, 6, 3, wm9713_hp_pga), /* headphone left input 10 */ -SOC_ENUM_SINGLE(AC97_REC_GAIN, 4, 3, wm9713_hp_pga), /* headphone right input 11 */ -SOC_ENUM_SINGLE(AC97_REC_GAIN, 2, 4, wm9713_out3_pga), /* out 3 source 12 */ -SOC_ENUM_SINGLE(AC97_REC_GAIN, 0, 4, wm9713_out4_pga), /* out 4 source 13 */ -SOC_ENUM_SINGLE(AC97_REC_GAIN_MIC, 13, 8, wm9713_dac_inv), /* dac invert 1 14 */ -SOC_ENUM_SINGLE(AC97_REC_GAIN_MIC, 10, 8, wm9713_dac_inv), /* dac invert 2 15 */ -SOC_ENUM_SINGLE(AC97_GENERAL_PURPOSE, 15, 2, wm9713_bass), /* bass control 16 */ -SOC_ENUM_SINGLE(AC97_PCI_SVID, 5, 2, wm9713_ng_type), /* noise gate type 17 */ -SOC_ENUM_SINGLE(AC97_3D_CONTROL, 12, 3, wm9713_mic_select), /* mic selection 18 */ -SOC_ENUM_SINGLE(MICB_MUX, 0, 2, wm9713_micb_select), /* mic selection 19 */ +SOC_ENUM_SINGLE_CONST(AC97_LINE, 3, wm9713_mic_mixer), /* record mic mixer 0 */ +SOC_ENUM_SINGLE_CONST(AC97_VIDEO, 14, wm9713_rec_mux), /* record mux hp 1 */ +SOC_ENUM_SINGLE_CONST(AC97_VIDEO, 9, wm9713_rec_mux), /* record mux mono 2 */ +SOC_ENUM_SINGLE_CONST(AC97_VIDEO, 3, wm9713_rec_src), /* record mux left 3 */ +SOC_ENUM_SINGLE_CONST(AC97_VIDEO, 0, wm9713_rec_src), /* record mux right 4*/ +SOC_ENUM_DOUBLE_CONST(AC97_CD, 14, 6, wm9713_rec_gain), /* record step size 5 */ +SOC_ENUM_SINGLE_CONST(AC97_PCI_SVID, 14, wm9713_alc_select), /* alc source select 6*/ +SOC_ENUM_SINGLE_CONST(AC97_REC_GAIN, 14, wm9713_mono_pga), /* mono input select 7 */ +SOC_ENUM_SINGLE_CONST(AC97_REC_GAIN, 11, wm9713_spk_pga), /* speaker left input select 8 */ +SOC_ENUM_SINGLE_CONST(AC97_REC_GAIN, 8, wm9713_spk_pga), /* speaker right input select 9 */ +SOC_ENUM_SINGLE_CONST(AC97_REC_GAIN, 6, wm9713_hp_pga), /* headphone left input 10 */ +SOC_ENUM_SINGLE_CONST(AC97_REC_GAIN, 4, wm9713_hp_pga), /* headphone right input 11 */ +SOC_ENUM_SINGLE_CONST(AC97_REC_GAIN, 2, wm9713_out3_pga), /* out 3 source 12 */ +SOC_ENUM_SINGLE_CONST(AC97_REC_GAIN, 0, wm9713_out4_pga), /* out 4 source 13 */ +SOC_ENUM_SINGLE_CONST(AC97_REC_GAIN_MIC, 13, wm9713_dac_inv), /* dac invert 1 14 */ +SOC_ENUM_SINGLE_CONST(AC97_REC_GAIN_MIC, 10, wm9713_dac_inv), /* dac invert 2 15 */ +SOC_ENUM_SINGLE_CONST(AC97_GENERAL_PURPOSE, 15, wm9713_bass), /* bass control 16 */ +SOC_ENUM_SINGLE_CONST(AC97_PCI_SVID, 5, wm9713_ng_type), /* noise gate type 17 */ +SOC_ENUM_SINGLE_CONST(AC97_3D_CONTROL, 12, wm9713_mic_select), /* mic selection 18 */ +SOC_ENUM_SINGLE_CONST(MICB_MUX, 0, wm9713_micb_select), /* mic selection 19 */ };
static const DECLARE_TLV_DB_SCALE(out_tlv, -4650, 150, 0);
... for improving readability and maintainability.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/codecs/wm_adsp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c index f9fd56444a14..34e79d26922b 100644 --- a/sound/soc/codecs/wm_adsp.c +++ b/sound/soc/codecs/wm_adsp.c @@ -273,10 +273,10 @@ static int wm_adsp_fw_put(struct snd_kcontrol *kcontrol, }
static const struct soc_enum wm_adsp_fw_enum[] = { - SOC_ENUM_SINGLE(0, 0, ARRAY_SIZE(wm_adsp_fw_text), wm_adsp_fw_text), - SOC_ENUM_SINGLE(0, 1, ARRAY_SIZE(wm_adsp_fw_text), wm_adsp_fw_text), - SOC_ENUM_SINGLE(0, 2, ARRAY_SIZE(wm_adsp_fw_text), wm_adsp_fw_text), - SOC_ENUM_SINGLE(0, 3, ARRAY_SIZE(wm_adsp_fw_text), wm_adsp_fw_text), + SOC_ENUM_SINGLE_CONST(0, 0, wm_adsp_fw_text), + SOC_ENUM_SINGLE_CONST(0, 1, wm_adsp_fw_text), + SOC_ENUM_SINGLE_CONST(0, 2, wm_adsp_fw_text), + SOC_ENUM_SINGLE_CONST(0, 3, wm_adsp_fw_text), };
const struct snd_kcontrol_new wm_adsp1_fw_controls[] = {
On Tue, Feb 18, 2014 at 12:51:27PM +0100, Takashi Iwai wrote:
This is the last chunk of patch series, which introduces two new macros, SOC_ENUM_SINGLE_CONST() and SOC_ENUM_DOUBLE_CONST() in order to simplify the codes without ARRAY_SIZE() in the caller side.
Please don't send multiple hundred patch serieses at once via e-mail - it's very painful to work with long serieses at the best of times and having several of them at once magnifies the problem and causes problems with other traffic. Please at least try to split things over multiple days, and for something like this one looking at the new macros first would have been good. I've not actually got everything downloaded yet, will look when I do.
At Wed, 19 Feb 2014 10:43:13 +0900, Mark Brown wrote:
On Tue, Feb 18, 2014 at 12:51:27PM +0100, Takashi Iwai wrote:
This is the last chunk of patch series, which introduces two new macros, SOC_ENUM_SINGLE_CONST() and SOC_ENUM_DOUBLE_CONST() in order to simplify the codes without ARRAY_SIZE() in the caller side.
Please don't send multiple hundred patch serieses at once via e-mail - it's very painful to work with long serieses at the best of times and having several of them at once magnifies the problem and causes problems with other traffic. Please at least try to split things over multiple days, and for something like this one looking at the new macros first would have been good. I've not actually got everything downloaded yet, will look when I do.
OK, we should have worked on git for this from the beginning, then.
All patches are found in topic/asoc-enum-fixes branch of sound git tree. Now they include acks of several people.
Feel free to go through there, either cherry-pick or just merge as you like.
thanks,
Takashi
On Wed, Feb 19, 2014 at 07:48:51AM +0100, Takashi Iwai wrote:
All patches are found in topic/asoc-enum-fixes branch of sound git tree. Now they include acks of several people.
Feel free to go through there, either cherry-pick or just merge as you like.
Well, I've got them now so it's a bit late - I'll just work through the e-mails. But yeah, in general if the patch series is more than say 20 mails (or you feel the need to split it up like you did with this one) then breaking it down into smaller chunks is going to help a lot. It's the volume as much as the format, it's an awful lot of patches to look through at once.
participants (2)
-
Mark Brown
-
Takashi Iwai