@@ -38,11 +38,16 @@ struct byt_wm5102_private {
38
38
int mclk_freq ;
39
39
};
40
40
41
- /* Bits 0-3 are reserved for the input-map */
41
+ #define BYT_WM5102_IN_MAP GENMASK(3, 0)
42
42
#define BYT_WM5102_OUT_MAP GENMASK(7, 4)
43
43
#define BYT_WM5102_SSP2 BIT(16)
44
44
#define BYT_WM5102_MCLK_19_2MHZ BIT(17)
45
45
46
+ enum {
47
+ BYT_WM5102_INTMIC_IN3L_HSMIC_IN1L ,
48
+ BYT_WM5102_INTMIC_IN1L_HSMIC_IN2L ,
49
+ };
50
+
46
51
/* Note these values are pre-shifted for easy use of setting quirks */
47
52
enum {
48
53
BYT_WM5102_SPK_SPK_MAP = FIELD_PREP_CONST (BYT_WM5102_OUT_MAP , 0 ),
@@ -57,6 +62,20 @@ MODULE_PARM_DESC(quirk, "Board-specific quirk override");
57
62
58
63
static void log_quirks (struct device * dev )
59
64
{
65
+ switch (quirk & BYT_WM5102_IN_MAP ) {
66
+ case BYT_WM5102_INTMIC_IN3L_HSMIC_IN1L :
67
+ dev_info_once (dev , "quirk INTMIC_IN3L_HSMIC_IN1L enabled\n" );
68
+ break ;
69
+ case BYT_WM5102_INTMIC_IN1L_HSMIC_IN2L :
70
+ dev_info_once (dev , "quirk INTMIC_IN1L_HSMIC_IN2L enabled\n" );
71
+ break ;
72
+ default :
73
+ dev_warn_once (dev , "quirk sets invalid input map: 0x%lx, defaulting to INTMIC_IN3L_HSMIC_IN1L\n" ,
74
+ quirk & BYT_WM5102_IN_MAP );
75
+ quirk &= ~BYT_WM5102_IN_MAP ;
76
+ quirk |= BYT_WM5102_INTMIC_IN3L_HSMIC_IN1L ;
77
+ break ;
78
+ }
60
79
switch (quirk & BYT_WM5102_OUT_MAP ) {
61
80
case BYT_WM5102_SPK_SPK_MAP :
62
81
dev_info_once (dev , "quirk SPK_SPK_MAP enabled\n" );
@@ -191,16 +210,13 @@ static const struct snd_soc_dapm_route byt_wm5102_audio_map[] = {
191
210
{"Headphone" , NULL , "HPOUT1L" },
192
211
{"Headphone" , NULL , "HPOUT1R" },
193
212
194
- {"Internal Mic" , NULL , "MICBIAS3" },
195
- {"IN3L" , NULL , "Internal Mic" },
196
-
197
213
/*
198
214
* The Headset Mix uses MICBIAS1 or 2 depending on if a CTIA/OMTP Headset
199
215
* is connected, as the MICBIAS is applied after the CTIA/OMTP cross-switch.
200
216
*/
201
217
{"Headset Mic" , NULL , "MICBIAS1" },
202
218
{"Headset Mic" , NULL , "MICBIAS2" },
203
- {"IN1L " , NULL , "Headset Mic " },
219
+ {"Internal Mic " , NULL , "MICBIAS3 " },
204
220
};
205
221
206
222
static const struct snd_soc_dapm_route bytcr_wm5102_ssp0_map [] = {
@@ -231,6 +247,16 @@ static const struct snd_soc_dapm_route byt_wm5102_spk_hpout2_map[] = {
231
247
{"Speaker" , NULL , "HPOUT2R" },
232
248
};
233
249
250
+ static const struct snd_soc_dapm_route byt_wm5102_intmic_in3l_hsmic_in1l_map [] = {
251
+ {"IN3L" , NULL , "Internal Mic" },
252
+ {"IN1L" , NULL , "Headset Mic" },
253
+ };
254
+
255
+ static const struct snd_soc_dapm_route byt_wm5102_intmic_in1l_hsmic_in2l_map [] = {
256
+ {"IN1L" , NULL , "Internal Mic" },
257
+ {"IN2L" , NULL , "Headset Mic" },
258
+ };
259
+
234
260
static const struct snd_kcontrol_new byt_wm5102_controls [] = {
235
261
SOC_DAPM_PIN_SWITCH ("Headphone" ),
236
262
SOC_DAPM_PIN_SWITCH ("Headset Mic" ),
@@ -271,6 +297,20 @@ static int byt_wm5102_init(struct snd_soc_pcm_runtime *runtime)
271
297
return ret ;
272
298
}
273
299
300
+ switch (quirk & BYT_WM5102_IN_MAP ) {
301
+ case BYT_WM5102_INTMIC_IN3L_HSMIC_IN1L :
302
+ custom_map = byt_wm5102_intmic_in3l_hsmic_in1l_map ;
303
+ num_routes = ARRAY_SIZE (byt_wm5102_intmic_in3l_hsmic_in1l_map );
304
+ break ;
305
+ case BYT_WM5102_INTMIC_IN1L_HSMIC_IN2L :
306
+ custom_map = byt_wm5102_intmic_in1l_hsmic_in2l_map ;
307
+ num_routes = ARRAY_SIZE (byt_wm5102_intmic_in1l_hsmic_in2l_map );
308
+ break ;
309
+ }
310
+ ret = snd_soc_dapm_add_routes (& card -> dapm , custom_map , num_routes );
311
+ if (ret )
312
+ return ret ;
313
+
274
314
switch (quirk & BYT_WM5102_OUT_MAP ) {
275
315
case BYT_WM5102_SPK_SPK_MAP :
276
316
custom_map = byt_wm5102_spk_spk_map ;
@@ -481,6 +521,8 @@ static char byt_wm5102_components[64]; /* = "cfg-spk:* cfg-int-mic:* cfg-hs-mic:
481
521
static int snd_byt_wm5102_mc_probe (struct platform_device * pdev )
482
522
{
483
523
static const char * const out_map_name [] = { "spk" , "hpout2" };
524
+ static const char * const intmic_map_name [] = { "in3l" , "in1l" };
525
+ static const char * const hsmic_map_name [] = { "in1l" , "in2l" };
484
526
char codec_name [SND_ACPI_I2C_ID_LEN ];
485
527
struct device * dev = & pdev -> dev ;
486
528
struct byt_wm5102_private * priv ;
@@ -541,9 +583,10 @@ static int snd_byt_wm5102_mc_probe(struct platform_device *pdev)
541
583
/*
542
584
* CHT always uses SSP2 and 19.2 MHz; and
543
585
* the one currently supported CHT design uses HPOUT2 as
544
- * speaker output.
586
+ * speaker output and has the intmic on IN1L + hsmic on IN2L .
545
587
*/
546
588
quirk = BYT_WM5102_SSP2 | BYT_WM5102_MCLK_19_2MHZ |
589
+ BYT_WM5102_INTMIC_IN1L_HSMIC_IN2L |
547
590
BYT_WM5102_SPK_HPOUT2_MAP ;
548
591
}
549
592
if (quirk_override != -1 ) {
@@ -554,7 +597,10 @@ static int snd_byt_wm5102_mc_probe(struct platform_device *pdev)
554
597
log_quirks (dev );
555
598
556
599
snprintf (byt_wm5102_components , sizeof (byt_wm5102_components ),
557
- "cfg-spk:%s" , out_map_name [FIELD_GET (BYT_WM5102_OUT_MAP , quirk )]);
600
+ "cfg-spk:%s cfg-intmic:%s cfg-hsmic:%s" ,
601
+ out_map_name [FIELD_GET (BYT_WM5102_OUT_MAP , quirk )],
602
+ intmic_map_name [FIELD_GET (BYT_WM5102_IN_MAP , quirk )],
603
+ hsmic_map_name [FIELD_GET (BYT_WM5102_IN_MAP , quirk )]);
558
604
byt_wm5102_card .components = byt_wm5102_components ;
559
605
560
606
/* find index of codec dai */
0 commit comments