@@ -3244,49 +3244,107 @@ static int tegra210_sfc_init(struct snd_soc_dapm_widget *w,
32443244 return tegra210_sfc_write_coeff_ram (cmpnt );
32453245}
32463246
3247- static int tegra210_sfc_get_control (struct snd_kcontrol * kcontrol ,
3247+ static int tegra210_sfc_iget_stereo_to_mono (struct snd_kcontrol * kcontrol ,
32483248 struct snd_ctl_elem_value * ucontrol )
32493249{
32503250 struct snd_soc_component * cmpnt = snd_soc_kcontrol_component (kcontrol );
32513251 struct tegra210_sfc * sfc = snd_soc_component_get_drvdata (cmpnt );
32523252
3253- if (strstr (kcontrol -> id .name , "Input Stereo To Mono" ))
3254- ucontrol -> value .enumerated .item [0 ] =
3255- sfc -> stereo_to_mono [SFC_RX_PATH ];
3256- else if (strstr (kcontrol -> id .name , "Input Mono To Stereo" ))
3257- ucontrol -> value .enumerated .item [0 ] =
3258- sfc -> mono_to_stereo [SFC_RX_PATH ];
3259- else if (strstr (kcontrol -> id .name , "Output Stereo To Mono" ))
3260- ucontrol -> value .enumerated .item [0 ] =
3261- sfc -> stereo_to_mono [SFC_TX_PATH ];
3262- else if (strstr (kcontrol -> id .name , "Output Mono To Stereo" ))
3263- ucontrol -> value .enumerated .item [0 ] =
3264- sfc -> mono_to_stereo [SFC_TX_PATH ];
3253+ ucontrol -> value .enumerated .item [0 ] = sfc -> stereo_to_mono [SFC_RX_PATH ];
32653254
32663255 return 0 ;
32673256}
32683257
3269- static int tegra210_sfc_put_control (struct snd_kcontrol * kcontrol ,
3258+ static int tegra210_sfc_iput_stereo_to_mono (struct snd_kcontrol * kcontrol ,
32703259 struct snd_ctl_elem_value * ucontrol )
32713260{
32723261 struct snd_soc_component * cmpnt = snd_soc_kcontrol_component (kcontrol );
32733262 struct tegra210_sfc * sfc = snd_soc_component_get_drvdata (cmpnt );
3263+ unsigned int value = ucontrol -> value .enumerated .item [0 ];
32743264
3275- if (strstr (kcontrol -> id .name , "Input Stereo To Mono" ))
3276- sfc -> stereo_to_mono [SFC_RX_PATH ] =
3277- ucontrol -> value .enumerated .item [0 ];
3278- else if (strstr (kcontrol -> id .name , "Input Mono To Stereo" ))
3279- sfc -> mono_to_stereo [SFC_RX_PATH ] =
3280- ucontrol -> value .enumerated .item [0 ];
3281- else if (strstr (kcontrol -> id .name , "Output Stereo To Mono" ))
3282- sfc -> stereo_to_mono [SFC_TX_PATH ] =
3283- ucontrol -> value .enumerated .item [0 ];
3284- else if (strstr (kcontrol -> id .name , "Output Mono To Stereo" ))
3285- sfc -> mono_to_stereo [SFC_TX_PATH ] =
3286- ucontrol -> value .enumerated .item [0 ];
3287- else
3265+ if (value == sfc -> stereo_to_mono [SFC_RX_PATH ])
3266+ return 0 ;
3267+
3268+ sfc -> stereo_to_mono [SFC_RX_PATH ] = value ;
3269+
3270+ return 1 ;
3271+ }
3272+
3273+ static int tegra210_sfc_iget_mono_to_stereo (struct snd_kcontrol * kcontrol ,
3274+ struct snd_ctl_elem_value * ucontrol )
3275+ {
3276+ struct snd_soc_component * cmpnt = snd_soc_kcontrol_component (kcontrol );
3277+ struct tegra210_sfc * sfc = snd_soc_component_get_drvdata (cmpnt );
3278+
3279+ ucontrol -> value .enumerated .item [0 ] = sfc -> mono_to_stereo [SFC_RX_PATH ];
3280+
3281+ return 0 ;
3282+ }
3283+
3284+ static int tegra210_sfc_iput_mono_to_stereo (struct snd_kcontrol * kcontrol ,
3285+ struct snd_ctl_elem_value * ucontrol )
3286+ {
3287+ struct snd_soc_component * cmpnt = snd_soc_kcontrol_component (kcontrol );
3288+ struct tegra210_sfc * sfc = snd_soc_component_get_drvdata (cmpnt );
3289+ unsigned int value = ucontrol -> value .enumerated .item [0 ];
3290+
3291+ if (value == sfc -> mono_to_stereo [SFC_RX_PATH ])
3292+ return 0 ;
3293+
3294+ sfc -> mono_to_stereo [SFC_RX_PATH ] = value ;
3295+
3296+ return 1 ;
3297+ }
3298+
3299+ static int tegra210_sfc_oget_stereo_to_mono (struct snd_kcontrol * kcontrol ,
3300+ struct snd_ctl_elem_value * ucontrol )
3301+ {
3302+ struct snd_soc_component * cmpnt = snd_soc_kcontrol_component (kcontrol );
3303+ struct tegra210_sfc * sfc = snd_soc_component_get_drvdata (cmpnt );
3304+
3305+ ucontrol -> value .enumerated .item [0 ] = sfc -> stereo_to_mono [SFC_TX_PATH ];
3306+
3307+ return 0 ;
3308+ }
3309+
3310+ static int tegra210_sfc_oput_stereo_to_mono (struct snd_kcontrol * kcontrol ,
3311+ struct snd_ctl_elem_value * ucontrol )
3312+ {
3313+ struct snd_soc_component * cmpnt = snd_soc_kcontrol_component (kcontrol );
3314+ struct tegra210_sfc * sfc = snd_soc_component_get_drvdata (cmpnt );
3315+ unsigned int value = ucontrol -> value .enumerated .item [0 ];
3316+
3317+ if (value == sfc -> stereo_to_mono [SFC_TX_PATH ])
32883318 return 0 ;
32893319
3320+ sfc -> stereo_to_mono [SFC_TX_PATH ] = value ;
3321+
3322+ return 1 ;
3323+ }
3324+
3325+ static int tegra210_sfc_oget_mono_to_stereo (struct snd_kcontrol * kcontrol ,
3326+ struct snd_ctl_elem_value * ucontrol )
3327+ {
3328+ struct snd_soc_component * cmpnt = snd_soc_kcontrol_component (kcontrol );
3329+ struct tegra210_sfc * sfc = snd_soc_component_get_drvdata (cmpnt );
3330+
3331+ ucontrol -> value .enumerated .item [0 ] = sfc -> mono_to_stereo [SFC_TX_PATH ];
3332+
3333+ return 0 ;
3334+ }
3335+
3336+ static int tegra210_sfc_oput_mono_to_stereo (struct snd_kcontrol * kcontrol ,
3337+ struct snd_ctl_elem_value * ucontrol )
3338+ {
3339+ struct snd_soc_component * cmpnt = snd_soc_kcontrol_component (kcontrol );
3340+ struct tegra210_sfc * sfc = snd_soc_component_get_drvdata (cmpnt );
3341+ unsigned int value = ucontrol -> value .enumerated .item [0 ];
3342+
3343+ if (value == sfc -> mono_to_stereo [SFC_TX_PATH ])
3344+ return 0 ;
3345+
3346+ sfc -> mono_to_stereo [SFC_TX_PATH ] = value ;
3347+
32903348 return 1 ;
32913349}
32923350
@@ -3387,13 +3445,17 @@ static const struct soc_enum tegra210_sfc_mono_conv_enum =
33873445
33883446static const struct snd_kcontrol_new tegra210_sfc_controls [] = {
33893447 SOC_ENUM_EXT ("Input Stereo To Mono" , tegra210_sfc_stereo_conv_enum ,
3390- tegra210_sfc_get_control , tegra210_sfc_put_control ),
3448+ tegra210_sfc_iget_stereo_to_mono ,
3449+ tegra210_sfc_iput_stereo_to_mono ),
33913450 SOC_ENUM_EXT ("Input Mono To Stereo" , tegra210_sfc_mono_conv_enum ,
3392- tegra210_sfc_get_control , tegra210_sfc_put_control ),
3451+ tegra210_sfc_iget_mono_to_stereo ,
3452+ tegra210_sfc_iput_mono_to_stereo ),
33933453 SOC_ENUM_EXT ("Output Stereo To Mono" , tegra210_sfc_stereo_conv_enum ,
3394- tegra210_sfc_get_control , tegra210_sfc_put_control ),
3454+ tegra210_sfc_oget_stereo_to_mono ,
3455+ tegra210_sfc_oput_stereo_to_mono ),
33953456 SOC_ENUM_EXT ("Output Mono To Stereo" , tegra210_sfc_mono_conv_enum ,
3396- tegra210_sfc_get_control , tegra210_sfc_put_control ),
3457+ tegra210_sfc_oget_mono_to_stereo ,
3458+ tegra210_sfc_oput_mono_to_stereo ),
33973459};
33983460
33993461static const struct snd_soc_component_driver tegra210_sfc_cmpnt = {
0 commit comments