@@ -3244,49 +3244,107 @@ static int tegra210_sfc_init(struct snd_soc_dapm_widget *w,
3244
3244
return tegra210_sfc_write_coeff_ram (cmpnt );
3245
3245
}
3246
3246
3247
- static int tegra210_sfc_get_control (struct snd_kcontrol * kcontrol ,
3247
+ static int tegra210_sfc_iget_stereo_to_mono (struct snd_kcontrol * kcontrol ,
3248
3248
struct snd_ctl_elem_value * ucontrol )
3249
3249
{
3250
3250
struct snd_soc_component * cmpnt = snd_soc_kcontrol_component (kcontrol );
3251
3251
struct tegra210_sfc * sfc = snd_soc_component_get_drvdata (cmpnt );
3252
3252
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 ];
3265
3254
3266
3255
return 0 ;
3267
3256
}
3268
3257
3269
- static int tegra210_sfc_put_control (struct snd_kcontrol * kcontrol ,
3258
+ static int tegra210_sfc_iput_stereo_to_mono (struct snd_kcontrol * kcontrol ,
3270
3259
struct snd_ctl_elem_value * ucontrol )
3271
3260
{
3272
3261
struct snd_soc_component * cmpnt = snd_soc_kcontrol_component (kcontrol );
3273
3262
struct tegra210_sfc * sfc = snd_soc_component_get_drvdata (cmpnt );
3263
+ unsigned int value = ucontrol -> value .enumerated .item [0 ];
3274
3264
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 ])
3288
3318
return 0 ;
3289
3319
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
+
3290
3348
return 1 ;
3291
3349
}
3292
3350
@@ -3387,13 +3445,17 @@ static const struct soc_enum tegra210_sfc_mono_conv_enum =
3387
3445
3388
3446
static const struct snd_kcontrol_new tegra210_sfc_controls [] = {
3389
3447
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 ),
3391
3450
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 ),
3393
3453
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 ),
3395
3456
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 ),
3397
3459
};
3398
3460
3399
3461
static const struct snd_soc_component_driver tegra210_sfc_cmpnt = {
0 commit comments