@@ -67,6 +67,7 @@ struct fsl_micfil_soc_data {
67
67
bool imx ;
68
68
bool use_edma ;
69
69
bool use_verid ;
70
+ bool volume_sx ;
70
71
u64 formats ;
71
72
};
72
73
@@ -76,6 +77,7 @@ static struct fsl_micfil_soc_data fsl_micfil_imx8mm = {
76
77
.fifo_depth = 8 ,
77
78
.dataline = 0xf ,
78
79
.formats = SNDRV_PCM_FMTBIT_S16_LE ,
80
+ .volume_sx = true,
79
81
};
80
82
81
83
static struct fsl_micfil_soc_data fsl_micfil_imx8mp = {
@@ -84,6 +86,7 @@ static struct fsl_micfil_soc_data fsl_micfil_imx8mp = {
84
86
.fifo_depth = 32 ,
85
87
.dataline = 0xf ,
86
88
.formats = SNDRV_PCM_FMTBIT_S32_LE ,
89
+ .volume_sx = false,
87
90
};
88
91
89
92
static struct fsl_micfil_soc_data fsl_micfil_imx93 = {
@@ -94,6 +97,7 @@ static struct fsl_micfil_soc_data fsl_micfil_imx93 = {
94
97
.formats = SNDRV_PCM_FMTBIT_S32_LE ,
95
98
.use_edma = true,
96
99
.use_verid = true,
100
+ .volume_sx = false,
97
101
};
98
102
99
103
static const struct of_device_id fsl_micfil_dt_ids [] = {
@@ -317,7 +321,26 @@ static int hwvad_detected(struct snd_kcontrol *kcontrol,
317
321
return 0 ;
318
322
}
319
323
320
- static const struct snd_kcontrol_new fsl_micfil_snd_controls [] = {
324
+ static const struct snd_kcontrol_new fsl_micfil_volume_controls [] = {
325
+ SOC_SINGLE_TLV ("CH0 Volume" , REG_MICFIL_OUT_CTRL ,
326
+ MICFIL_OUTGAIN_CHX_SHIFT (0 ), 0xF , 0 , gain_tlv ),
327
+ SOC_SINGLE_TLV ("CH1 Volume" , REG_MICFIL_OUT_CTRL ,
328
+ MICFIL_OUTGAIN_CHX_SHIFT (1 ), 0xF , 0 , gain_tlv ),
329
+ SOC_SINGLE_TLV ("CH2 Volume" , REG_MICFIL_OUT_CTRL ,
330
+ MICFIL_OUTGAIN_CHX_SHIFT (2 ), 0xF , 0 , gain_tlv ),
331
+ SOC_SINGLE_TLV ("CH3 Volume" , REG_MICFIL_OUT_CTRL ,
332
+ MICFIL_OUTGAIN_CHX_SHIFT (3 ), 0xF , 0 , gain_tlv ),
333
+ SOC_SINGLE_TLV ("CH4 Volume" , REG_MICFIL_OUT_CTRL ,
334
+ MICFIL_OUTGAIN_CHX_SHIFT (4 ), 0xF , 0 , gain_tlv ),
335
+ SOC_SINGLE_TLV ("CH5 Volume" , REG_MICFIL_OUT_CTRL ,
336
+ MICFIL_OUTGAIN_CHX_SHIFT (5 ), 0xF , 0 , gain_tlv ),
337
+ SOC_SINGLE_TLV ("CH6 Volume" , REG_MICFIL_OUT_CTRL ,
338
+ MICFIL_OUTGAIN_CHX_SHIFT (6 ), 0xF , 0 , gain_tlv ),
339
+ SOC_SINGLE_TLV ("CH7 Volume" , REG_MICFIL_OUT_CTRL ,
340
+ MICFIL_OUTGAIN_CHX_SHIFT (7 ), 0xF , 0 , gain_tlv ),
341
+ };
342
+
343
+ static const struct snd_kcontrol_new fsl_micfil_volume_sx_controls [] = {
321
344
SOC_SINGLE_SX_TLV ("CH0 Volume" , REG_MICFIL_OUT_CTRL ,
322
345
MICFIL_OUTGAIN_CHX_SHIFT (0 ), 0x8 , 0xF , gain_tlv ),
323
346
SOC_SINGLE_SX_TLV ("CH1 Volume" , REG_MICFIL_OUT_CTRL ,
@@ -334,6 +357,9 @@ static const struct snd_kcontrol_new fsl_micfil_snd_controls[] = {
334
357
MICFIL_OUTGAIN_CHX_SHIFT (6 ), 0x8 , 0xF , gain_tlv ),
335
358
SOC_SINGLE_SX_TLV ("CH7 Volume" , REG_MICFIL_OUT_CTRL ,
336
359
MICFIL_OUTGAIN_CHX_SHIFT (7 ), 0x8 , 0xF , gain_tlv ),
360
+ };
361
+
362
+ static const struct snd_kcontrol_new fsl_micfil_snd_controls [] = {
337
363
SOC_ENUM_EXT ("MICFIL Quality Select" ,
338
364
fsl_micfil_quality_enum ,
339
365
micfil_quality_get , micfil_quality_set ),
@@ -801,6 +827,20 @@ static int fsl_micfil_dai_probe(struct snd_soc_dai *cpu_dai)
801
827
return 0 ;
802
828
}
803
829
830
+ static int fsl_micfil_component_probe (struct snd_soc_component * component )
831
+ {
832
+ struct fsl_micfil * micfil = snd_soc_component_get_drvdata (component );
833
+
834
+ if (micfil -> soc -> volume_sx )
835
+ snd_soc_add_component_controls (component , fsl_micfil_volume_sx_controls ,
836
+ ARRAY_SIZE (fsl_micfil_volume_sx_controls ));
837
+ else
838
+ snd_soc_add_component_controls (component , fsl_micfil_volume_controls ,
839
+ ARRAY_SIZE (fsl_micfil_volume_controls ));
840
+
841
+ return 0 ;
842
+ }
843
+
804
844
static const struct snd_soc_dai_ops fsl_micfil_dai_ops = {
805
845
.probe = fsl_micfil_dai_probe ,
806
846
.startup = fsl_micfil_startup ,
@@ -821,6 +861,7 @@ static struct snd_soc_dai_driver fsl_micfil_dai = {
821
861
822
862
static const struct snd_soc_component_driver fsl_micfil_component = {
823
863
.name = "fsl-micfil-dai" ,
864
+ .probe = fsl_micfil_component_probe ,
824
865
.controls = fsl_micfil_snd_controls ,
825
866
.num_controls = ARRAY_SIZE (fsl_micfil_snd_controls ),
826
867
.legacy_dai_naming = 1 ,
0 commit comments