1 // SPDX-License-Identifier: GPL-2.0-only
3 * byt_cr_dpcm_rt5640.c - ASoc Machine driver for Intel Byt CR platform
5 * Copyright (C) 2014 Intel Corp
6 * Author: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
7 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12 #include <linux/i2c.h>
13 #include <linux/init.h>
14 #include <linux/module.h>
15 #include <linux/moduleparam.h>
16 #include <linux/platform_device.h>
17 #include <linux/acpi.h>
18 #include <linux/clk.h>
19 #include <linux/device.h>
20 #include <linux/dmi.h>
21 #include <linux/gpio/consumer.h>
22 #include <linux/gpio/machine.h>
23 #include <linux/input.h>
24 #include <linux/slab.h>
25 #include <sound/pcm.h>
26 #include <sound/pcm_params.h>
27 #include <sound/soc.h>
28 #include <sound/jack.h>
29 #include <sound/soc-acpi.h>
30 #include <dt-bindings/sound/rt5640.h>
31 #include "../../codecs/rt5640.h"
32 #include "../atom/sst-atom-controls.h"
33 #include "../common/soc-intel-quirks.h"
40 BYT_RT5640_NO_INTERNAL_MIC_MAP,
44 BYT_RT5640_JD_SRC_GPIO1 = (RT5640_JD_SRC_GPIO1 << 4),
45 BYT_RT5640_JD_SRC_JD1_IN4P = (RT5640_JD_SRC_JD1_IN4P << 4),
46 BYT_RT5640_JD_SRC_JD2_IN4N = (RT5640_JD_SRC_JD2_IN4N << 4),
47 BYT_RT5640_JD_SRC_GPIO2 = (RT5640_JD_SRC_GPIO2 << 4),
48 BYT_RT5640_JD_SRC_GPIO3 = (RT5640_JD_SRC_GPIO3 << 4),
49 BYT_RT5640_JD_SRC_GPIO4 = (RT5640_JD_SRC_GPIO4 << 4),
53 BYT_RT5640_OVCD_TH_600UA = (6 << 8),
54 BYT_RT5640_OVCD_TH_1500UA = (15 << 8),
55 BYT_RT5640_OVCD_TH_2000UA = (20 << 8),
59 BYT_RT5640_OVCD_SF_0P5 = (RT5640_OVCD_SF_0P5 << 13),
60 BYT_RT5640_OVCD_SF_0P75 = (RT5640_OVCD_SF_0P75 << 13),
61 BYT_RT5640_OVCD_SF_1P0 = (RT5640_OVCD_SF_1P0 << 13),
62 BYT_RT5640_OVCD_SF_1P5 = (RT5640_OVCD_SF_1P5 << 13),
65 #define BYT_RT5640_MAP(quirk) ((quirk) & GENMASK(3, 0))
66 #define BYT_RT5640_JDSRC(quirk) (((quirk) & GENMASK(7, 4)) >> 4)
67 #define BYT_RT5640_OVCD_TH(quirk) (((quirk) & GENMASK(12, 8)) >> 8)
68 #define BYT_RT5640_OVCD_SF(quirk) (((quirk) & GENMASK(14, 13)) >> 13)
69 #define BYT_RT5640_JD_NOT_INV BIT(16)
70 #define BYT_RT5640_MONO_SPEAKER BIT(17)
71 #define BYT_RT5640_DIFF_MIC BIT(18) /* default is single-ended */
72 #define BYT_RT5640_SSP2_AIF2 BIT(19) /* default is using AIF1 */
73 #define BYT_RT5640_SSP0_AIF1 BIT(20)
74 #define BYT_RT5640_SSP0_AIF2 BIT(21)
75 #define BYT_RT5640_MCLK_EN BIT(22)
76 #define BYT_RT5640_MCLK_25MHZ BIT(23)
77 #define BYT_RT5640_NO_SPEAKERS BIT(24)
78 #define BYT_RT5640_LINEOUT BIT(25)
79 #define BYT_RT5640_LINEOUT_AS_HP2 BIT(26)
80 #define BYT_RT5640_HSMIC2_ON_IN1 BIT(27)
81 #define BYT_RT5640_JD_HP_ELITEP_1000G2 BIT(28)
83 #define BYTCR_INPUT_DEFAULTS \
84 (BYT_RT5640_IN3_MAP | \
85 BYT_RT5640_JD_SRC_JD1_IN4P | \
86 BYT_RT5640_OVCD_TH_2000UA | \
87 BYT_RT5640_OVCD_SF_0P75 | \
90 /* in-diff or dmic-pin + jdsrc + ovcd-th + -sf + jd-inv + terminating entry */
91 #define MAX_NO_PROPS 6
93 struct byt_rt5640_private {
94 struct snd_soc_jack jack;
95 struct snd_soc_jack jack2;
96 struct gpio_desc *hsmic_detect;
98 struct device *codec_dev;
100 static bool is_bytcr;
102 static unsigned long byt_rt5640_quirk = BYT_RT5640_MCLK_EN;
103 static int quirk_override = -1;
104 module_param_named(quirk, quirk_override, int, 0444);
105 MODULE_PARM_DESC(quirk, "Board-specific quirk override");
107 static void log_quirks(struct device *dev)
110 bool has_mclk = false;
111 bool has_ssp0 = false;
112 bool has_ssp0_aif1 = false;
113 bool has_ssp0_aif2 = false;
114 bool has_ssp2_aif2 = false;
116 map = BYT_RT5640_MAP(byt_rt5640_quirk);
118 case BYT_RT5640_DMIC1_MAP:
119 dev_info(dev, "quirk DMIC1_MAP enabled\n");
121 case BYT_RT5640_DMIC2_MAP:
122 dev_info(dev, "quirk DMIC2_MAP enabled\n");
124 case BYT_RT5640_IN1_MAP:
125 dev_info(dev, "quirk IN1_MAP enabled\n");
127 case BYT_RT5640_IN3_MAP:
128 dev_info(dev, "quirk IN3_MAP enabled\n");
130 case BYT_RT5640_NO_INTERNAL_MIC_MAP:
131 dev_info(dev, "quirk NO_INTERNAL_MIC_MAP enabled\n");
134 dev_err(dev, "quirk map 0x%x is not supported, microphone input will not work\n", map);
137 if (byt_rt5640_quirk & BYT_RT5640_HSMIC2_ON_IN1)
138 dev_info(dev, "quirk HSMIC2_ON_IN1 enabled\n");
139 if (BYT_RT5640_JDSRC(byt_rt5640_quirk)) {
140 dev_info(dev, "quirk realtek,jack-detect-source %ld\n",
141 BYT_RT5640_JDSRC(byt_rt5640_quirk));
142 dev_info(dev, "quirk realtek,over-current-threshold-microamp %ld\n",
143 BYT_RT5640_OVCD_TH(byt_rt5640_quirk) * 100);
144 dev_info(dev, "quirk realtek,over-current-scale-factor %ld\n",
145 BYT_RT5640_OVCD_SF(byt_rt5640_quirk));
147 if (byt_rt5640_quirk & BYT_RT5640_JD_NOT_INV)
148 dev_info(dev, "quirk JD_NOT_INV enabled\n");
149 if (byt_rt5640_quirk & BYT_RT5640_JD_HP_ELITEP_1000G2)
150 dev_info(dev, "quirk JD_HP_ELITEPAD_1000G2 enabled\n");
151 if (byt_rt5640_quirk & BYT_RT5640_MONO_SPEAKER)
152 dev_info(dev, "quirk MONO_SPEAKER enabled\n");
153 if (byt_rt5640_quirk & BYT_RT5640_NO_SPEAKERS)
154 dev_info(dev, "quirk NO_SPEAKERS enabled\n");
155 if (byt_rt5640_quirk & BYT_RT5640_LINEOUT)
156 dev_info(dev, "quirk LINEOUT enabled\n");
157 if (byt_rt5640_quirk & BYT_RT5640_LINEOUT_AS_HP2)
158 dev_info(dev, "quirk LINEOUT_AS_HP2 enabled\n");
159 if (byt_rt5640_quirk & BYT_RT5640_DIFF_MIC)
160 dev_info(dev, "quirk DIFF_MIC enabled\n");
161 if (byt_rt5640_quirk & BYT_RT5640_SSP0_AIF1) {
162 dev_info(dev, "quirk SSP0_AIF1 enabled\n");
164 has_ssp0_aif1 = true;
166 if (byt_rt5640_quirk & BYT_RT5640_SSP0_AIF2) {
167 dev_info(dev, "quirk SSP0_AIF2 enabled\n");
169 has_ssp0_aif2 = true;
171 if (byt_rt5640_quirk & BYT_RT5640_SSP2_AIF2) {
172 dev_info(dev, "quirk SSP2_AIF2 enabled\n");
173 has_ssp2_aif2 = true;
175 if (is_bytcr && !has_ssp0)
176 dev_err(dev, "Invalid routing, bytcr detected but no SSP0-based quirk, audio cannot work with SSP2 on bytcr\n");
177 if (has_ssp0_aif1 && has_ssp0_aif2)
178 dev_err(dev, "Invalid routing, SSP0 cannot be connected to both AIF1 and AIF2\n");
179 if (has_ssp0 && has_ssp2_aif2)
180 dev_err(dev, "Invalid routing, cannot have both SSP0 and SSP2 connected to codec\n");
182 if (byt_rt5640_quirk & BYT_RT5640_MCLK_EN) {
183 dev_info(dev, "quirk MCLK_EN enabled\n");
186 if (byt_rt5640_quirk & BYT_RT5640_MCLK_25MHZ) {
188 dev_info(dev, "quirk MCLK_25MHZ enabled\n");
190 dev_err(dev, "quirk MCLK_25MHZ enabled but quirk MCLK not selected, will be ignored\n");
194 static int byt_rt5640_prepare_and_enable_pll1(struct snd_soc_dai *codec_dai,
199 /* Configure the PLL before selecting it */
200 if (!(byt_rt5640_quirk & BYT_RT5640_MCLK_EN)) {
201 /* use bitclock as PLL input */
202 if ((byt_rt5640_quirk & BYT_RT5640_SSP0_AIF1) ||
203 (byt_rt5640_quirk & BYT_RT5640_SSP0_AIF2)) {
204 /* 2x16 bit slots on SSP0 */
205 ret = snd_soc_dai_set_pll(codec_dai, 0,
207 rate * 32, rate * 512);
209 /* 2x15 bit slots on SSP2 */
210 ret = snd_soc_dai_set_pll(codec_dai, 0,
212 rate * 50, rate * 512);
215 if (byt_rt5640_quirk & BYT_RT5640_MCLK_25MHZ) {
216 ret = snd_soc_dai_set_pll(codec_dai, 0,
218 25000000, rate * 512);
220 ret = snd_soc_dai_set_pll(codec_dai, 0,
222 19200000, rate * 512);
227 dev_err(codec_dai->component->dev, "can't set pll: %d\n", ret);
231 ret = snd_soc_dai_set_sysclk(codec_dai, RT5640_SCLK_S_PLL1,
232 rate * 512, SND_SOC_CLOCK_IN);
234 dev_err(codec_dai->component->dev, "can't set clock %d\n", ret);
241 #define BYT_CODEC_DAI1 "rt5640-aif1"
242 #define BYT_CODEC_DAI2 "rt5640-aif2"
244 static struct snd_soc_dai *byt_rt5640_get_codec_dai(struct snd_soc_dapm_context *dapm)
246 struct snd_soc_card *card = dapm->card;
247 struct snd_soc_dai *codec_dai;
249 codec_dai = snd_soc_card_get_codec_dai(card, BYT_CODEC_DAI1);
251 codec_dai = snd_soc_card_get_codec_dai(card, BYT_CODEC_DAI2);
253 dev_err(card->dev, "Error codec dai not found\n");
258 static int platform_clock_control(struct snd_soc_dapm_widget *w,
259 struct snd_kcontrol *k, int event)
261 struct snd_soc_dapm_context *dapm = w->dapm;
262 struct snd_soc_card *card = dapm->card;
263 struct snd_soc_dai *codec_dai;
264 struct byt_rt5640_private *priv = snd_soc_card_get_drvdata(card);
267 codec_dai = byt_rt5640_get_codec_dai(dapm);
271 if (SND_SOC_DAPM_EVENT_ON(event)) {
272 if (byt_rt5640_quirk & BYT_RT5640_MCLK_EN) {
273 ret = clk_prepare_enable(priv->mclk);
276 "could not configure MCLK state\n");
280 ret = byt_rt5640_prepare_and_enable_pll1(codec_dai, 48000);
283 * Set codec clock source to internal clock before
284 * turning off the platform clock. Codec needs clock
285 * for Jack detection and button press
287 ret = snd_soc_dai_set_sysclk(codec_dai, RT5640_SCLK_S_RCCLK,
291 if (byt_rt5640_quirk & BYT_RT5640_MCLK_EN)
292 clk_disable_unprepare(priv->mclk);
297 dev_err(card->dev, "can't set codec sysclk: %d\n", ret);
304 static int byt_rt5640_event_lineout(struct snd_soc_dapm_widget *w,
305 struct snd_kcontrol *k, int event)
307 unsigned int gpio_ctrl3_val = RT5640_GP1_PF_OUT;
308 struct snd_soc_dai *codec_dai;
310 if (!(byt_rt5640_quirk & BYT_RT5640_LINEOUT_AS_HP2))
314 * On devices which use line-out as a second headphones output,
315 * the codec's GPIO1 pin is used to enable an external HP-amp.
318 codec_dai = byt_rt5640_get_codec_dai(w->dapm);
322 if (SND_SOC_DAPM_EVENT_ON(event))
323 gpio_ctrl3_val |= RT5640_GP1_OUT_HI;
325 snd_soc_component_update_bits(codec_dai->component, RT5640_GPIO_CTRL3,
326 RT5640_GP1_PF_MASK | RT5640_GP1_OUT_MASK, gpio_ctrl3_val);
331 static const struct snd_soc_dapm_widget byt_rt5640_widgets[] = {
332 SND_SOC_DAPM_HP("Headphone", NULL),
333 SND_SOC_DAPM_MIC("Headset Mic", NULL),
334 SND_SOC_DAPM_MIC("Headset Mic 2", NULL),
335 SND_SOC_DAPM_MIC("Internal Mic", NULL),
336 SND_SOC_DAPM_SPK("Speaker", NULL),
337 SND_SOC_DAPM_LINE("Line Out", byt_rt5640_event_lineout),
338 SND_SOC_DAPM_SUPPLY("Platform Clock", SND_SOC_NOPM, 0, 0,
339 platform_clock_control, SND_SOC_DAPM_PRE_PMU |
340 SND_SOC_DAPM_POST_PMD),
343 static const struct snd_soc_dapm_route byt_rt5640_audio_map[] = {
344 {"Headphone", NULL, "Platform Clock"},
345 {"Headset Mic", NULL, "Platform Clock"},
346 {"Headset Mic", NULL, "MICBIAS1"},
347 {"IN2P", NULL, "Headset Mic"},
348 {"Headphone", NULL, "HPOL"},
349 {"Headphone", NULL, "HPOR"},
352 static const struct snd_soc_dapm_route byt_rt5640_intmic_dmic1_map[] = {
353 {"Internal Mic", NULL, "Platform Clock"},
354 {"DMIC1", NULL, "Internal Mic"},
357 static const struct snd_soc_dapm_route byt_rt5640_intmic_dmic2_map[] = {
358 {"Internal Mic", NULL, "Platform Clock"},
359 {"DMIC2", NULL, "Internal Mic"},
362 static const struct snd_soc_dapm_route byt_rt5640_intmic_in1_map[] = {
363 {"Internal Mic", NULL, "Platform Clock"},
364 {"Internal Mic", NULL, "MICBIAS1"},
365 {"IN1P", NULL, "Internal Mic"},
368 static const struct snd_soc_dapm_route byt_rt5640_intmic_in3_map[] = {
369 {"Internal Mic", NULL, "Platform Clock"},
370 {"Internal Mic", NULL, "MICBIAS1"},
371 {"IN3P", NULL, "Internal Mic"},
374 static const struct snd_soc_dapm_route byt_rt5640_hsmic2_in1_map[] = {
375 {"Headset Mic 2", NULL, "Platform Clock"},
376 {"Headset Mic 2", NULL, "MICBIAS1"},
377 {"IN1P", NULL, "Headset Mic 2"},
380 static const struct snd_soc_dapm_route byt_rt5640_ssp2_aif1_map[] = {
381 {"ssp2 Tx", NULL, "codec_out0"},
382 {"ssp2 Tx", NULL, "codec_out1"},
383 {"codec_in0", NULL, "ssp2 Rx"},
384 {"codec_in1", NULL, "ssp2 Rx"},
386 {"AIF1 Playback", NULL, "ssp2 Tx"},
387 {"ssp2 Rx", NULL, "AIF1 Capture"},
390 static const struct snd_soc_dapm_route byt_rt5640_ssp2_aif2_map[] = {
391 {"ssp2 Tx", NULL, "codec_out0"},
392 {"ssp2 Tx", NULL, "codec_out1"},
393 {"codec_in0", NULL, "ssp2 Rx"},
394 {"codec_in1", NULL, "ssp2 Rx"},
396 {"AIF2 Playback", NULL, "ssp2 Tx"},
397 {"ssp2 Rx", NULL, "AIF2 Capture"},
400 static const struct snd_soc_dapm_route byt_rt5640_ssp0_aif1_map[] = {
401 {"ssp0 Tx", NULL, "modem_out"},
402 {"modem_in", NULL, "ssp0 Rx"},
404 {"AIF1 Playback", NULL, "ssp0 Tx"},
405 {"ssp0 Rx", NULL, "AIF1 Capture"},
408 static const struct snd_soc_dapm_route byt_rt5640_ssp0_aif2_map[] = {
409 {"ssp0 Tx", NULL, "modem_out"},
410 {"modem_in", NULL, "ssp0 Rx"},
412 {"AIF2 Playback", NULL, "ssp0 Tx"},
413 {"ssp0 Rx", NULL, "AIF2 Capture"},
416 static const struct snd_soc_dapm_route byt_rt5640_stereo_spk_map[] = {
417 {"Speaker", NULL, "Platform Clock"},
418 {"Speaker", NULL, "SPOLP"},
419 {"Speaker", NULL, "SPOLN"},
420 {"Speaker", NULL, "SPORP"},
421 {"Speaker", NULL, "SPORN"},
424 static const struct snd_soc_dapm_route byt_rt5640_mono_spk_map[] = {
425 {"Speaker", NULL, "Platform Clock"},
426 {"Speaker", NULL, "SPOLP"},
427 {"Speaker", NULL, "SPOLN"},
430 static const struct snd_soc_dapm_route byt_rt5640_lineout_map[] = {
431 {"Line Out", NULL, "Platform Clock"},
432 {"Line Out", NULL, "LOUTR"},
433 {"Line Out", NULL, "LOUTL"},
436 static const struct snd_kcontrol_new byt_rt5640_controls[] = {
437 SOC_DAPM_PIN_SWITCH("Headphone"),
438 SOC_DAPM_PIN_SWITCH("Headset Mic"),
439 SOC_DAPM_PIN_SWITCH("Headset Mic 2"),
440 SOC_DAPM_PIN_SWITCH("Internal Mic"),
441 SOC_DAPM_PIN_SWITCH("Speaker"),
442 SOC_DAPM_PIN_SWITCH("Line Out"),
445 static struct snd_soc_jack_pin rt5640_pins[] = {
448 .mask = SND_JACK_HEADPHONE,
451 .pin = "Headset Mic",
452 .mask = SND_JACK_MICROPHONE,
456 static struct snd_soc_jack_pin rt5640_pins2[] = {
458 /* The 2nd headset jack uses lineout with an external HP-amp */
460 .mask = SND_JACK_HEADPHONE,
463 .pin = "Headset Mic 2",
464 .mask = SND_JACK_MICROPHONE,
468 static struct snd_soc_jack_gpio rt5640_jack_gpio = {
470 .report = SND_JACK_HEADSET,
472 .debounce_time = 200,
475 static struct snd_soc_jack_gpio rt5640_jack2_gpio = {
476 .name = "hp2-detect",
477 .report = SND_JACK_HEADSET,
479 .debounce_time = 200,
482 static const struct acpi_gpio_params acpi_gpio0 = { 0, 0, false };
483 static const struct acpi_gpio_params acpi_gpio1 = { 1, 0, false };
484 static const struct acpi_gpio_params acpi_gpio2 = { 2, 0, false };
486 static const struct acpi_gpio_mapping byt_rt5640_hp_elitepad_1000g2_gpios[] = {
487 { "hp-detect-gpios", &acpi_gpio0, 1, },
488 { "headset-mic-detect-gpios", &acpi_gpio1, 1, },
489 { "hp2-detect-gpios", &acpi_gpio2, 1, },
493 static int byt_rt5640_hp_elitepad_1000g2_jack1_check(void *data)
495 struct byt_rt5640_private *priv = data;
496 int jack_status, mic_status;
498 jack_status = gpiod_get_value_cansleep(rt5640_jack_gpio.desc);
502 mic_status = gpiod_get_value_cansleep(priv->hsmic_detect);
504 return SND_JACK_HEADPHONE;
506 return SND_JACK_HEADSET;
509 static int byt_rt5640_hp_elitepad_1000g2_jack2_check(void *data)
511 struct snd_soc_component *component = data;
512 int jack_status, report;
514 jack_status = gpiod_get_value_cansleep(rt5640_jack2_gpio.desc);
518 rt5640_enable_micbias1_for_ovcd(component);
519 report = rt5640_detect_headset(component, rt5640_jack2_gpio.desc);
520 rt5640_disable_micbias1_for_ovcd(component);
525 static int byt_rt5640_aif1_hw_params(struct snd_pcm_substream *substream,
526 struct snd_pcm_hw_params *params)
528 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
529 struct snd_soc_dai *dai = asoc_rtd_to_codec(rtd, 0);
531 return byt_rt5640_prepare_and_enable_pll1(dai, params_rate(params));
534 /* Please keep this list alphabetically sorted */
535 static const struct dmi_system_id byt_rt5640_quirk_table[] = {
536 { /* Acer Iconia Tab 8 W1-810 */
538 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Acer"),
539 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Iconia W1-810"),
541 .driver_data = (void *)(BYT_RT5640_DMIC1_MAP |
542 BYT_RT5640_JD_SRC_JD1_IN4P |
543 BYT_RT5640_OVCD_TH_1500UA |
544 BYT_RT5640_OVCD_SF_0P75 |
545 BYT_RT5640_SSP0_AIF1 |
548 { /* Acer One 10 S1002 */
550 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
551 DMI_MATCH(DMI_PRODUCT_NAME, "One S1002"),
553 .driver_data = (void *)(BYT_RT5640_IN1_MAP |
554 BYT_RT5640_JD_SRC_JD2_IN4N |
555 BYT_RT5640_OVCD_TH_2000UA |
556 BYT_RT5640_OVCD_SF_0P75 |
557 BYT_RT5640_DIFF_MIC |
558 BYT_RT5640_SSP0_AIF2 |
563 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
564 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire SW5-012"),
566 .driver_data = (void *)(BYT_RT5640_DMIC1_MAP |
567 BYT_RT5640_JD_SRC_JD2_IN4N |
568 BYT_RT5640_OVCD_TH_2000UA |
569 BYT_RT5640_OVCD_SF_0P75 |
570 BYT_RT5640_SSP0_AIF1 |
575 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ARCHOS"),
576 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "ARCHOS 80 Cesium"),
578 .driver_data = (void *)(BYTCR_INPUT_DEFAULTS |
579 BYT_RT5640_MONO_SPEAKER |
580 BYT_RT5640_SSP0_AIF1 |
585 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ARCHOS"),
586 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "ARCHOS 140 CESIUM"),
588 .driver_data = (void *)(BYT_RT5640_IN1_MAP |
589 BYT_RT5640_JD_SRC_JD2_IN4N |
590 BYT_RT5640_OVCD_TH_2000UA |
591 BYT_RT5640_OVCD_SF_0P75 |
592 BYT_RT5640_SSP0_AIF1 |
597 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
598 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "ME176C"),
600 .driver_data = (void *)(BYT_RT5640_IN1_MAP |
601 BYT_RT5640_JD_SRC_JD2_IN4N |
602 BYT_RT5640_OVCD_TH_2000UA |
603 BYT_RT5640_OVCD_SF_0P75 |
604 BYT_RT5640_SSP0_AIF1 |
609 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
610 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T100TA"),
612 .driver_data = (void *)(BYT_RT5640_IN1_MAP |
613 BYT_RT5640_JD_SRC_JD2_IN4N |
614 BYT_RT5640_OVCD_TH_2000UA |
615 BYT_RT5640_OVCD_SF_0P75 |
620 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
621 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T100TAF"),
623 .driver_data = (void *)(BYT_RT5640_IN1_MAP |
624 BYT_RT5640_JD_SRC_JD2_IN4N |
625 BYT_RT5640_OVCD_TH_2000UA |
626 BYT_RT5640_OVCD_SF_0P75 |
627 BYT_RT5640_MONO_SPEAKER |
628 BYT_RT5640_DIFF_MIC |
629 BYT_RT5640_SSP0_AIF2 |
632 { /* Chuwi Vi8 (CWI506) */
634 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Insyde"),
635 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "i86"),
636 /* The above are too generic, also match BIOS info */
637 DMI_MATCH(DMI_BIOS_VERSION, "CHUWI.D86JLBNR"),
639 .driver_data = (void *)(BYTCR_INPUT_DEFAULTS |
640 BYT_RT5640_MONO_SPEAKER |
641 BYT_RT5640_SSP0_AIF1 |
645 /* Chuwi Vi10 (CWI505) */
647 DMI_MATCH(DMI_BOARD_VENDOR, "Hampoo"),
648 DMI_MATCH(DMI_BOARD_NAME, "BYT-PF02"),
649 DMI_MATCH(DMI_SYS_VENDOR, "ilife"),
650 DMI_MATCH(DMI_PRODUCT_NAME, "S165"),
652 .driver_data = (void *)(BYT_RT5640_IN1_MAP |
653 BYT_RT5640_JD_SRC_JD2_IN4N |
654 BYT_RT5640_OVCD_TH_2000UA |
655 BYT_RT5640_OVCD_SF_0P75 |
656 BYT_RT5640_DIFF_MIC |
657 BYT_RT5640_SSP0_AIF1 |
661 /* Chuwi Hi8 (CWI509) */
663 DMI_MATCH(DMI_BOARD_VENDOR, "Hampoo"),
664 DMI_MATCH(DMI_BOARD_NAME, "BYT-PA03C"),
665 DMI_MATCH(DMI_SYS_VENDOR, "ilife"),
666 DMI_MATCH(DMI_PRODUCT_NAME, "S806"),
668 .driver_data = (void *)(BYT_RT5640_IN1_MAP |
669 BYT_RT5640_JD_SRC_JD2_IN4N |
670 BYT_RT5640_OVCD_TH_2000UA |
671 BYT_RT5640_OVCD_SF_0P75 |
672 BYT_RT5640_MONO_SPEAKER |
673 BYT_RT5640_DIFF_MIC |
674 BYT_RT5640_SSP0_AIF1 |
679 DMI_MATCH(DMI_SYS_VENDOR, "Circuitco"),
680 DMI_MATCH(DMI_PRODUCT_NAME, "Minnowboard Max B3 PLATFORM"),
682 .driver_data = (void *)(BYT_RT5640_DMIC1_MAP),
684 { /* Connect Tablet 9 */
686 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Connect"),
687 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Tablet 9"),
689 .driver_data = (void *)(BYTCR_INPUT_DEFAULTS |
690 BYT_RT5640_MONO_SPEAKER |
691 BYT_RT5640_SSP0_AIF1 |
696 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
697 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Venue 8 Pro 5830"),
699 .driver_data = (void *)(BYT_RT5640_DMIC1_MAP |
700 BYT_RT5640_JD_SRC_JD2_IN4N |
701 BYT_RT5640_OVCD_TH_2000UA |
702 BYT_RT5640_OVCD_SF_0P75 |
703 BYT_RT5640_MONO_SPEAKER |
706 { /* Estar Beauty HD MID 7316R */
708 DMI_MATCH(DMI_SYS_VENDOR, "Estar"),
709 DMI_MATCH(DMI_PRODUCT_NAME, "eSTAR BEAUTY HD Intel Quad core"),
711 .driver_data = (void *)(BYTCR_INPUT_DEFAULTS |
712 BYT_RT5640_MONO_SPEAKER |
713 BYT_RT5640_SSP0_AIF1 |
716 { /* Glavey TM800A550L */
718 DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
719 DMI_MATCH(DMI_BOARD_NAME, "Aptio CRB"),
720 /* Above strings are too generic, also match on BIOS version */
721 DMI_MATCH(DMI_BIOS_VERSION, "ZY-8-BI-PX4S70VTR400-X423B-005-D"),
723 .driver_data = (void *)(BYTCR_INPUT_DEFAULTS |
724 BYT_RT5640_SSP0_AIF1 |
729 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
730 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "HP ElitePad 1000 G2"),
732 .driver_data = (void *)(BYT_RT5640_DMIC2_MAP |
735 BYT_RT5640_LINEOUT_AS_HP2 |
736 BYT_RT5640_HSMIC2_ON_IN1 |
737 BYT_RT5640_JD_HP_ELITEP_1000G2),
739 { /* HP Pavilion x2 10-k0XX, 10-n0XX */
741 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
742 DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion x2 Detachable"),
744 .driver_data = (void *)(BYT_RT5640_DMIC1_MAP |
745 BYT_RT5640_JD_SRC_JD2_IN4N |
746 BYT_RT5640_OVCD_TH_1500UA |
747 BYT_RT5640_OVCD_SF_0P75 |
748 BYT_RT5640_SSP0_AIF1 |
751 { /* HP Pavilion x2 10-p0XX */
753 DMI_MATCH(DMI_SYS_VENDOR, "HP"),
754 DMI_MATCH(DMI_PRODUCT_NAME, "HP x2 Detachable 10-p0XX"),
756 .driver_data = (void *)(BYT_RT5640_DMIC1_MAP |
757 BYT_RT5640_JD_SRC_JD1_IN4P |
758 BYT_RT5640_OVCD_TH_2000UA |
759 BYT_RT5640_OVCD_SF_0P75 |
764 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
765 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "HP Stream 7 Tablet"),
767 .driver_data = (void *)(BYTCR_INPUT_DEFAULTS |
768 BYT_RT5640_MONO_SPEAKER |
769 BYT_RT5640_JD_NOT_INV |
770 BYT_RT5640_SSP0_AIF1 |
773 { /* I.T.Works TW891 */
775 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "To be filled by O.E.M."),
776 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "TW891"),
777 DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "To be filled by O.E.M."),
778 DMI_EXACT_MATCH(DMI_BOARD_NAME, "TW891"),
780 .driver_data = (void *)(BYTCR_INPUT_DEFAULTS |
781 BYT_RT5640_MONO_SPEAKER |
782 BYT_RT5640_SSP0_AIF1 |
785 { /* Lamina I8270 / T701BR.SE */
787 DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Lamina"),
788 DMI_EXACT_MATCH(DMI_BOARD_NAME, "T701BR.SE"),
790 .driver_data = (void *)(BYTCR_INPUT_DEFAULTS |
791 BYT_RT5640_MONO_SPEAKER |
792 BYT_RT5640_JD_NOT_INV |
793 BYT_RT5640_SSP0_AIF1 |
796 { /* Lenovo Miix 2 8 */
798 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"),
799 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "20326"),
800 DMI_EXACT_MATCH(DMI_BOARD_NAME, "Hiking"),
802 .driver_data = (void *)(BYT_RT5640_DMIC1_MAP |
803 BYT_RT5640_JD_SRC_JD2_IN4N |
804 BYT_RT5640_OVCD_TH_2000UA |
805 BYT_RT5640_OVCD_SF_0P75 |
806 BYT_RT5640_MONO_SPEAKER |
809 { /* Lenovo Miix 3-830 */
811 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"),
812 DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 3-830"),
814 .driver_data = (void *)(BYT_RT5640_IN1_MAP |
815 BYT_RT5640_JD_SRC_JD2_IN4N |
816 BYT_RT5640_OVCD_TH_2000UA |
817 BYT_RT5640_OVCD_SF_0P75 |
818 BYT_RT5640_MONO_SPEAKER |
819 BYT_RT5640_DIFF_MIC |
820 BYT_RT5640_SSP0_AIF1 |
823 { /* Linx Linx7 tablet */
825 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LINX"),
826 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "LINX7"),
828 .driver_data = (void *)(BYTCR_INPUT_DEFAULTS |
829 BYT_RT5640_MONO_SPEAKER |
830 BYT_RT5640_JD_NOT_INV |
831 BYT_RT5640_SSP0_AIF1 |
834 { /* Mele PCG03 Mini PC */
836 DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Mini PC"),
837 DMI_EXACT_MATCH(DMI_BOARD_NAME, "Mini PC"),
839 .driver_data = (void *)(BYT_RT5640_NO_INTERNAL_MIC_MAP |
840 BYT_RT5640_NO_SPEAKERS |
841 BYT_RT5640_SSP0_AIF1),
843 { /* MPMAN Converter 9, similar hw as the I.T.Works TW891 2-in-1 */
845 DMI_MATCH(DMI_SYS_VENDOR, "MPMAN"),
846 DMI_MATCH(DMI_PRODUCT_NAME, "Converter9"),
848 .driver_data = (void *)(BYTCR_INPUT_DEFAULTS |
849 BYT_RT5640_MONO_SPEAKER |
850 BYT_RT5640_SSP0_AIF1 |
854 /* MPMAN MPWIN895CL */
856 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "MPMAN"),
857 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "MPWIN8900CL"),
859 .driver_data = (void *)(BYTCR_INPUT_DEFAULTS |
860 BYT_RT5640_MONO_SPEAKER |
861 BYT_RT5640_SSP0_AIF1 |
864 { /* MSI S100 tablet */
866 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Micro-Star International Co., Ltd."),
867 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "S100"),
869 .driver_data = (void *)(BYT_RT5640_IN1_MAP |
870 BYT_RT5640_JD_SRC_JD2_IN4N |
871 BYT_RT5640_OVCD_TH_2000UA |
872 BYT_RT5640_OVCD_SF_0P75 |
873 BYT_RT5640_MONO_SPEAKER |
874 BYT_RT5640_DIFF_MIC |
877 { /* Nuvison/TMax TM800W560 */
879 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "TMAX"),
880 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "TM800W560L"),
882 .driver_data = (void *)(BYT_RT5640_IN1_MAP |
883 BYT_RT5640_JD_SRC_JD2_IN4N |
884 BYT_RT5640_OVCD_TH_2000UA |
885 BYT_RT5640_OVCD_SF_0P75 |
886 BYT_RT5640_JD_NOT_INV |
887 BYT_RT5640_DIFF_MIC |
888 BYT_RT5640_SSP0_AIF1 |
893 DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
894 DMI_EXACT_MATCH(DMI_BOARD_NAME, "Aptio CRB"),
895 /* The above are too generic, also match BIOS info */
896 DMI_EXACT_MATCH(DMI_BIOS_VERSION, "5.6.5"),
897 DMI_EXACT_MATCH(DMI_BIOS_DATE, "07/25/2014"),
899 .driver_data = (void *)(BYT_RT5640_IN1_MAP |
900 BYT_RT5640_JD_SRC_JD2_IN4N |
901 BYT_RT5640_OVCD_TH_2000UA |
902 BYT_RT5640_OVCD_SF_0P75 |
903 BYT_RT5640_DIFF_MIC |
908 DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
909 DMI_EXACT_MATCH(DMI_BOARD_NAME, "Aptio CRB"),
910 /* The above are too generic, also match BIOS info */
911 DMI_MATCH(DMI_BIOS_VERSION, "V8L_WIN32_CHIPHD"),
913 .driver_data = (void *)(BYTCR_INPUT_DEFAULTS |
914 BYT_RT5640_MONO_SPEAKER |
915 BYT_RT5640_SSP0_AIF1 |
918 { /* Point of View Mobii TAB-P800W (V2.0) */
920 DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
921 DMI_EXACT_MATCH(DMI_BOARD_NAME, "Aptio CRB"),
922 /* The above are too generic, also match BIOS info */
923 DMI_EXACT_MATCH(DMI_BIOS_VERSION, "3BAIR1014"),
924 DMI_EXACT_MATCH(DMI_BIOS_DATE, "10/24/2014"),
926 .driver_data = (void *)(BYT_RT5640_IN1_MAP |
927 BYT_RT5640_JD_SRC_JD2_IN4N |
928 BYT_RT5640_OVCD_TH_2000UA |
929 BYT_RT5640_OVCD_SF_0P75 |
930 BYT_RT5640_MONO_SPEAKER |
931 BYT_RT5640_DIFF_MIC |
932 BYT_RT5640_SSP0_AIF2 |
935 { /* Point of View Mobii TAB-P800W (V2.1) */
937 DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
938 DMI_EXACT_MATCH(DMI_BOARD_NAME, "Aptio CRB"),
939 /* The above are too generic, also match BIOS info */
940 DMI_EXACT_MATCH(DMI_BIOS_VERSION, "3BAIR1013"),
941 DMI_EXACT_MATCH(DMI_BIOS_DATE, "08/22/2014"),
943 .driver_data = (void *)(BYT_RT5640_IN1_MAP |
944 BYT_RT5640_JD_SRC_JD2_IN4N |
945 BYT_RT5640_OVCD_TH_2000UA |
946 BYT_RT5640_OVCD_SF_0P75 |
947 BYT_RT5640_MONO_SPEAKER |
948 BYT_RT5640_DIFF_MIC |
949 BYT_RT5640_SSP0_AIF2 |
952 { /* Point of View Mobii TAB-P1005W-232 (V2.0) */
954 DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "POV"),
955 DMI_EXACT_MATCH(DMI_BOARD_NAME, "I102A"),
957 .driver_data = (void *)(BYT_RT5640_IN1_MAP |
958 BYT_RT5640_JD_SRC_JD2_IN4N |
959 BYT_RT5640_OVCD_TH_2000UA |
960 BYT_RT5640_OVCD_SF_0P75 |
961 BYT_RT5640_DIFF_MIC |
962 BYT_RT5640_SSP0_AIF1 |
968 DMI_MATCH(DMI_SYS_VENDOR, "Prowise"),
969 DMI_MATCH(DMI_PRODUCT_NAME, "PT301"),
971 .driver_data = (void *)(BYT_RT5640_IN1_MAP |
972 BYT_RT5640_JD_SRC_JD2_IN4N |
973 BYT_RT5640_OVCD_TH_2000UA |
974 BYT_RT5640_OVCD_SF_0P75 |
975 BYT_RT5640_DIFF_MIC |
976 BYT_RT5640_SSP0_AIF1 |
982 DMI_MATCH(DMI_BOARD_VENDOR, "TECLAST"),
983 DMI_MATCH(DMI_BOARD_NAME, "tPAD"),
985 .driver_data = (void *)(BYT_RT5640_IN3_MAP |
986 BYT_RT5640_JD_SRC_JD1_IN4P |
987 BYT_RT5640_OVCD_TH_2000UA |
988 BYT_RT5640_OVCD_SF_1P0 |
989 BYT_RT5640_SSP0_AIF1 |
992 { /* Toshiba Satellite Click Mini L9W-B */
994 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
995 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "SATELLITE Click Mini L9W-B"),
997 .driver_data = (void *)(BYT_RT5640_DMIC1_MAP |
998 BYT_RT5640_JD_SRC_JD2_IN4N |
999 BYT_RT5640_OVCD_TH_1500UA |
1000 BYT_RT5640_OVCD_SF_0P75 |
1001 BYT_RT5640_SSP0_AIF1 |
1002 BYT_RT5640_MCLK_EN),
1004 { /* Toshiba Encore WT8-A */
1006 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
1007 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "TOSHIBA WT8-A"),
1009 .driver_data = (void *)(BYT_RT5640_DMIC1_MAP |
1010 BYT_RT5640_JD_SRC_JD2_IN4N |
1011 BYT_RT5640_OVCD_TH_2000UA |
1012 BYT_RT5640_OVCD_SF_0P75 |
1013 BYT_RT5640_JD_NOT_INV |
1014 BYT_RT5640_MCLK_EN),
1016 { /* Toshiba Encore WT10-A */
1018 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
1019 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "TOSHIBA WT10-A-103"),
1021 .driver_data = (void *)(BYT_RT5640_DMIC1_MAP |
1022 BYT_RT5640_JD_SRC_JD1_IN4P |
1023 BYT_RT5640_OVCD_TH_2000UA |
1024 BYT_RT5640_OVCD_SF_0P75 |
1025 BYT_RT5640_SSP0_AIF2 |
1026 BYT_RT5640_MCLK_EN),
1028 { /* Voyo Winpad A15 */
1030 DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
1031 DMI_MATCH(DMI_BOARD_NAME, "Aptio CRB"),
1032 /* Above strings are too generic, also match on BIOS date */
1033 DMI_MATCH(DMI_BIOS_DATE, "11/20/2014"),
1035 .driver_data = (void *)(BYT_RT5640_IN1_MAP |
1036 BYT_RT5640_JD_SRC_JD2_IN4N |
1037 BYT_RT5640_OVCD_TH_2000UA |
1038 BYT_RT5640_OVCD_SF_0P75 |
1039 BYT_RT5640_DIFF_MIC |
1040 BYT_RT5640_MCLK_EN),
1042 { /* Catch-all for generic Insyde tablets, must be last */
1044 DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
1046 .driver_data = (void *)(BYTCR_INPUT_DEFAULTS |
1047 BYT_RT5640_MCLK_EN |
1048 BYT_RT5640_SSP0_AIF1),
1055 * Note this MUST be called before snd_soc_register_card(), so that the props
1056 * are in place before the codec component driver's probe function parses them.
1058 static int byt_rt5640_add_codec_device_props(struct device *i2c_dev,
1059 struct byt_rt5640_private *priv)
1061 struct property_entry props[MAX_NO_PROPS] = {};
1062 struct fwnode_handle *fwnode;
1066 switch (BYT_RT5640_MAP(byt_rt5640_quirk)) {
1067 case BYT_RT5640_DMIC1_MAP:
1068 props[cnt++] = PROPERTY_ENTRY_U32("realtek,dmic1-data-pin",
1069 RT5640_DMIC1_DATA_PIN_IN1P);
1071 case BYT_RT5640_DMIC2_MAP:
1072 props[cnt++] = PROPERTY_ENTRY_U32("realtek,dmic2-data-pin",
1073 RT5640_DMIC2_DATA_PIN_IN1N);
1075 case BYT_RT5640_IN1_MAP:
1076 if (byt_rt5640_quirk & BYT_RT5640_DIFF_MIC)
1078 PROPERTY_ENTRY_BOOL("realtek,in1-differential");
1080 case BYT_RT5640_IN3_MAP:
1081 if (byt_rt5640_quirk & BYT_RT5640_DIFF_MIC)
1083 PROPERTY_ENTRY_BOOL("realtek,in3-differential");
1087 if (BYT_RT5640_JDSRC(byt_rt5640_quirk)) {
1088 props[cnt++] = PROPERTY_ENTRY_U32(
1089 "realtek,jack-detect-source",
1090 BYT_RT5640_JDSRC(byt_rt5640_quirk));
1092 props[cnt++] = PROPERTY_ENTRY_U32(
1093 "realtek,over-current-threshold-microamp",
1094 BYT_RT5640_OVCD_TH(byt_rt5640_quirk) * 100);
1096 props[cnt++] = PROPERTY_ENTRY_U32(
1097 "realtek,over-current-scale-factor",
1098 BYT_RT5640_OVCD_SF(byt_rt5640_quirk));
1101 if (byt_rt5640_quirk & BYT_RT5640_JD_NOT_INV)
1102 props[cnt++] = PROPERTY_ENTRY_BOOL("realtek,jack-detect-not-inverted");
1104 fwnode = fwnode_create_software_node(props, NULL);
1105 if (IS_ERR(fwnode)) {
1106 /* put_device() is handled in caller */
1107 return PTR_ERR(fwnode);
1110 ret = device_add_software_node(i2c_dev, to_software_node(fwnode));
1112 fwnode_handle_put(fwnode);
1117 static int byt_rt5640_init(struct snd_soc_pcm_runtime *runtime)
1119 struct snd_soc_card *card = runtime->card;
1120 struct byt_rt5640_private *priv = snd_soc_card_get_drvdata(card);
1121 struct snd_soc_component *component = asoc_rtd_to_codec(runtime, 0)->component;
1122 const struct snd_soc_dapm_route *custom_map = NULL;
1126 card->dapm.idle_bias_off = true;
1128 /* Start with RC clk for jack-detect (we disable MCLK below) */
1129 if (byt_rt5640_quirk & BYT_RT5640_MCLK_EN)
1130 snd_soc_component_update_bits(component, RT5640_GLB_CLK,
1131 RT5640_SCLK_SRC_MASK, RT5640_SCLK_SRC_RCCLK);
1133 rt5640_sel_asrc_clk_src(component,
1134 RT5640_DA_STEREO_FILTER |
1135 RT5640_DA_MONO_L_FILTER |
1136 RT5640_DA_MONO_R_FILTER |
1137 RT5640_AD_STEREO_FILTER |
1138 RT5640_AD_MONO_L_FILTER |
1139 RT5640_AD_MONO_R_FILTER,
1140 RT5640_CLK_SEL_ASRC);
1142 ret = snd_soc_add_card_controls(card, byt_rt5640_controls,
1143 ARRAY_SIZE(byt_rt5640_controls));
1145 dev_err(card->dev, "unable to add card controls\n");
1149 switch (BYT_RT5640_MAP(byt_rt5640_quirk)) {
1150 case BYT_RT5640_IN1_MAP:
1151 custom_map = byt_rt5640_intmic_in1_map;
1152 num_routes = ARRAY_SIZE(byt_rt5640_intmic_in1_map);
1154 case BYT_RT5640_IN3_MAP:
1155 custom_map = byt_rt5640_intmic_in3_map;
1156 num_routes = ARRAY_SIZE(byt_rt5640_intmic_in3_map);
1158 case BYT_RT5640_DMIC1_MAP:
1159 custom_map = byt_rt5640_intmic_dmic1_map;
1160 num_routes = ARRAY_SIZE(byt_rt5640_intmic_dmic1_map);
1162 case BYT_RT5640_DMIC2_MAP:
1163 custom_map = byt_rt5640_intmic_dmic2_map;
1164 num_routes = ARRAY_SIZE(byt_rt5640_intmic_dmic2_map);
1168 ret = snd_soc_dapm_add_routes(&card->dapm, custom_map, num_routes);
1172 if (byt_rt5640_quirk & BYT_RT5640_HSMIC2_ON_IN1) {
1173 ret = snd_soc_dapm_add_routes(&card->dapm,
1174 byt_rt5640_hsmic2_in1_map,
1175 ARRAY_SIZE(byt_rt5640_hsmic2_in1_map));
1180 if (byt_rt5640_quirk & BYT_RT5640_SSP2_AIF2) {
1181 ret = snd_soc_dapm_add_routes(&card->dapm,
1182 byt_rt5640_ssp2_aif2_map,
1183 ARRAY_SIZE(byt_rt5640_ssp2_aif2_map));
1184 } else if (byt_rt5640_quirk & BYT_RT5640_SSP0_AIF1) {
1185 ret = snd_soc_dapm_add_routes(&card->dapm,
1186 byt_rt5640_ssp0_aif1_map,
1187 ARRAY_SIZE(byt_rt5640_ssp0_aif1_map));
1188 } else if (byt_rt5640_quirk & BYT_RT5640_SSP0_AIF2) {
1189 ret = snd_soc_dapm_add_routes(&card->dapm,
1190 byt_rt5640_ssp0_aif2_map,
1191 ARRAY_SIZE(byt_rt5640_ssp0_aif2_map));
1193 ret = snd_soc_dapm_add_routes(&card->dapm,
1194 byt_rt5640_ssp2_aif1_map,
1195 ARRAY_SIZE(byt_rt5640_ssp2_aif1_map));
1200 if (byt_rt5640_quirk & BYT_RT5640_MONO_SPEAKER) {
1201 ret = snd_soc_dapm_add_routes(&card->dapm,
1202 byt_rt5640_mono_spk_map,
1203 ARRAY_SIZE(byt_rt5640_mono_spk_map));
1204 } else if (!(byt_rt5640_quirk & BYT_RT5640_NO_SPEAKERS)) {
1205 ret = snd_soc_dapm_add_routes(&card->dapm,
1206 byt_rt5640_stereo_spk_map,
1207 ARRAY_SIZE(byt_rt5640_stereo_spk_map));
1212 if (byt_rt5640_quirk & BYT_RT5640_LINEOUT) {
1213 ret = snd_soc_dapm_add_routes(&card->dapm,
1214 byt_rt5640_lineout_map,
1215 ARRAY_SIZE(byt_rt5640_lineout_map));
1220 if (byt_rt5640_quirk & BYT_RT5640_MCLK_EN) {
1222 * The firmware might enable the clock at
1223 * boot (this information may or may not
1224 * be reflected in the enable clock register).
1225 * To change the rate we must disable the clock
1226 * first to cover these cases. Due to common
1227 * clock framework restrictions that do not allow
1228 * to disable a clock that has not been enabled,
1229 * we need to enable the clock first.
1231 ret = clk_prepare_enable(priv->mclk);
1233 clk_disable_unprepare(priv->mclk);
1235 if (byt_rt5640_quirk & BYT_RT5640_MCLK_25MHZ)
1236 ret = clk_set_rate(priv->mclk, 25000000);
1238 ret = clk_set_rate(priv->mclk, 19200000);
1241 dev_err(card->dev, "unable to set MCLK rate\n");
1246 if (BYT_RT5640_JDSRC(byt_rt5640_quirk)) {
1247 ret = snd_soc_card_jack_new(card, "Headset",
1248 SND_JACK_HEADSET | SND_JACK_BTN_0,
1249 &priv->jack, rt5640_pins,
1250 ARRAY_SIZE(rt5640_pins));
1252 dev_err(card->dev, "Jack creation failed %d\n", ret);
1255 snd_jack_set_key(priv->jack.jack, SND_JACK_BTN_0,
1257 snd_soc_component_set_jack(component, &priv->jack, NULL);
1260 if (byt_rt5640_quirk & BYT_RT5640_JD_HP_ELITEP_1000G2) {
1261 ret = snd_soc_card_jack_new(card, "Headset",
1263 &priv->jack, rt5640_pins,
1264 ARRAY_SIZE(rt5640_pins));
1268 ret = snd_soc_card_jack_new(card, "Headset 2",
1270 &priv->jack2, rt5640_pins2,
1271 ARRAY_SIZE(rt5640_pins2));
1275 rt5640_jack_gpio.data = priv;
1276 rt5640_jack_gpio.gpiod_dev = priv->codec_dev;
1277 rt5640_jack_gpio.jack_status_check = byt_rt5640_hp_elitepad_1000g2_jack1_check;
1278 ret = snd_soc_jack_add_gpios(&priv->jack, 1, &rt5640_jack_gpio);
1282 rt5640_set_ovcd_params(component);
1283 rt5640_jack2_gpio.data = component;
1284 rt5640_jack2_gpio.gpiod_dev = priv->codec_dev;
1285 rt5640_jack2_gpio.jack_status_check = byt_rt5640_hp_elitepad_1000g2_jack2_check;
1286 ret = snd_soc_jack_add_gpios(&priv->jack2, 1, &rt5640_jack2_gpio);
1288 snd_soc_jack_free_gpios(&priv->jack, 1, &rt5640_jack_gpio);
1296 static void byt_rt5640_exit(struct snd_soc_pcm_runtime *runtime)
1298 struct snd_soc_card *card = runtime->card;
1299 struct byt_rt5640_private *priv = snd_soc_card_get_drvdata(card);
1301 if (byt_rt5640_quirk & BYT_RT5640_JD_HP_ELITEP_1000G2) {
1302 snd_soc_jack_free_gpios(&priv->jack2, 1, &rt5640_jack2_gpio);
1303 snd_soc_jack_free_gpios(&priv->jack, 1, &rt5640_jack_gpio);
1307 static int byt_rt5640_codec_fixup(struct snd_soc_pcm_runtime *rtd,
1308 struct snd_pcm_hw_params *params)
1310 struct snd_interval *rate = hw_param_interval(params,
1311 SNDRV_PCM_HW_PARAM_RATE);
1312 struct snd_interval *channels = hw_param_interval(params,
1313 SNDRV_PCM_HW_PARAM_CHANNELS);
1316 /* The DSP will covert the FE rate to 48k, stereo */
1317 rate->min = rate->max = 48000;
1318 channels->min = channels->max = 2;
1320 if ((byt_rt5640_quirk & BYT_RT5640_SSP0_AIF1) ||
1321 (byt_rt5640_quirk & BYT_RT5640_SSP0_AIF2)) {
1322 /* set SSP0 to 16-bit */
1323 params_set_format(params, SNDRV_PCM_FORMAT_S16_LE);
1326 /* set SSP2 to 24-bit */
1327 params_set_format(params, SNDRV_PCM_FORMAT_S24_LE);
1332 * Default mode for SSP configuration is TDM 4 slot, override config
1333 * with explicit setting to I2S 2ch. The word length is set with
1334 * dai_set_tdm_slot() since there is no other API exposed
1336 ret = snd_soc_dai_set_fmt(asoc_rtd_to_cpu(rtd, 0),
1337 SND_SOC_DAIFMT_I2S |
1338 SND_SOC_DAIFMT_NB_NF |
1339 SND_SOC_DAIFMT_CBS_CFS);
1341 dev_err(rtd->dev, "can't set format to I2S, err %d\n", ret);
1345 ret = snd_soc_dai_set_tdm_slot(asoc_rtd_to_cpu(rtd, 0), 0x3, 0x3, 2, bits);
1347 dev_err(rtd->dev, "can't set I2S config, err %d\n", ret);
1354 static int byt_rt5640_aif1_startup(struct snd_pcm_substream *substream)
1356 return snd_pcm_hw_constraint_single(substream->runtime,
1357 SNDRV_PCM_HW_PARAM_RATE, 48000);
1360 static const struct snd_soc_ops byt_rt5640_aif1_ops = {
1361 .startup = byt_rt5640_aif1_startup,
1364 static const struct snd_soc_ops byt_rt5640_be_ssp2_ops = {
1365 .hw_params = byt_rt5640_aif1_hw_params,
1368 SND_SOC_DAILINK_DEF(dummy,
1369 DAILINK_COMP_ARRAY(COMP_DUMMY()));
1371 SND_SOC_DAILINK_DEF(media,
1372 DAILINK_COMP_ARRAY(COMP_CPU("media-cpu-dai")));
1374 SND_SOC_DAILINK_DEF(deepbuffer,
1375 DAILINK_COMP_ARRAY(COMP_CPU("deepbuffer-cpu-dai")));
1377 SND_SOC_DAILINK_DEF(ssp2_port,
1378 /* overwritten for ssp0 routing */
1379 DAILINK_COMP_ARRAY(COMP_CPU("ssp2-port")));
1380 SND_SOC_DAILINK_DEF(ssp2_codec,
1381 DAILINK_COMP_ARRAY(COMP_CODEC(
1382 /* overwritten with HID */ "i2c-10EC5640:00",
1383 /* changed w/ quirk */ "rt5640-aif1")));
1385 SND_SOC_DAILINK_DEF(platform,
1386 DAILINK_COMP_ARRAY(COMP_PLATFORM("sst-mfld-platform")));
1388 static struct snd_soc_dai_link byt_rt5640_dais[] = {
1389 [MERR_DPCM_AUDIO] = {
1390 .name = "Baytrail Audio Port",
1391 .stream_name = "Baytrail Audio",
1396 .ops = &byt_rt5640_aif1_ops,
1397 SND_SOC_DAILINK_REG(media, dummy, platform),
1399 [MERR_DPCM_DEEP_BUFFER] = {
1400 .name = "Deep-Buffer Audio Port",
1401 .stream_name = "Deep-Buffer Audio",
1405 .ops = &byt_rt5640_aif1_ops,
1406 SND_SOC_DAILINK_REG(deepbuffer, dummy, platform),
1410 .name = "SSP2-Codec",
1413 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
1414 | SND_SOC_DAIFMT_CBS_CFS,
1415 .be_hw_params_fixup = byt_rt5640_codec_fixup,
1418 .init = byt_rt5640_init,
1419 .exit = byt_rt5640_exit,
1420 .ops = &byt_rt5640_be_ssp2_ops,
1421 SND_SOC_DAILINK_REG(ssp2_port, ssp2_codec, platform),
1426 static char byt_rt5640_codec_name[SND_ACPI_I2C_ID_LEN];
1427 #if !IS_ENABLED(CONFIG_SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES)
1428 static char byt_rt5640_long_name[40]; /* = "bytcr-rt5640-*-spk-*-mic" */
1430 static char byt_rt5640_components[64]; /* = "cfg-spk:* cfg-mic:* ..." */
1432 static int byt_rt5640_suspend(struct snd_soc_card *card)
1434 struct snd_soc_component *component;
1436 if (!BYT_RT5640_JDSRC(byt_rt5640_quirk))
1439 for_each_card_components(card, component) {
1440 if (!strcmp(component->name, byt_rt5640_codec_name)) {
1441 dev_dbg(component->dev, "disabling jack detect before suspend\n");
1442 snd_soc_component_set_jack(component, NULL, NULL);
1450 static int byt_rt5640_resume(struct snd_soc_card *card)
1452 struct byt_rt5640_private *priv = snd_soc_card_get_drvdata(card);
1453 struct snd_soc_component *component;
1455 if (!BYT_RT5640_JDSRC(byt_rt5640_quirk))
1458 for_each_card_components(card, component) {
1459 if (!strcmp(component->name, byt_rt5640_codec_name)) {
1460 dev_dbg(component->dev, "re-enabling jack detect after resume\n");
1461 snd_soc_component_set_jack(component, &priv->jack, NULL);
1469 /* use space before codec name to simplify card ID, and simplify driver name */
1470 #define SOF_CARD_NAME "bytcht rt5640" /* card name will be 'sof-bytcht rt5640' */
1471 #define SOF_DRIVER_NAME "SOF"
1473 #define CARD_NAME "bytcr-rt5640"
1474 #define DRIVER_NAME NULL /* card name will be used for driver name */
1476 static struct snd_soc_card byt_rt5640_card = {
1477 .owner = THIS_MODULE,
1478 .dai_link = byt_rt5640_dais,
1479 .num_links = ARRAY_SIZE(byt_rt5640_dais),
1480 .dapm_widgets = byt_rt5640_widgets,
1481 .num_dapm_widgets = ARRAY_SIZE(byt_rt5640_widgets),
1482 .dapm_routes = byt_rt5640_audio_map,
1483 .num_dapm_routes = ARRAY_SIZE(byt_rt5640_audio_map),
1484 .fully_routed = true,
1485 .suspend_pre = byt_rt5640_suspend,
1486 .resume_post = byt_rt5640_resume,
1489 struct acpi_chan_package { /* ACPICA seems to require 64 bit integers */
1490 u64 aif_value; /* 1: AIF1, 2: AIF2 */
1491 u64 mclock_value; /* usually 25MHz (0x17d7940), ignored */
1494 static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
1496 struct device *dev = &pdev->dev;
1497 static const char * const map_name[] = { "dmic1", "dmic2", "in1", "in3", "none" };
1498 __maybe_unused const char *spk_type;
1499 const struct dmi_system_id *dmi_id;
1500 const char *headset2_string = "";
1501 const char *lineout_string = "";
1502 struct byt_rt5640_private *priv;
1503 struct snd_soc_acpi_mach *mach;
1504 const char *platform_name;
1505 struct acpi_device *adev;
1506 struct device *codec_dev;
1514 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
1518 /* register the soc card */
1519 byt_rt5640_card.dev = &pdev->dev;
1520 mach = byt_rt5640_card.dev->platform_data;
1521 snd_soc_card_set_drvdata(&byt_rt5640_card, priv);
1523 /* fix index of codec dai */
1524 for (i = 0; i < ARRAY_SIZE(byt_rt5640_dais); i++) {
1525 if (!strcmp(byt_rt5640_dais[i].codecs->name,
1526 "i2c-10EC5640:00")) {
1532 /* fixup codec name based on HID */
1533 adev = acpi_dev_get_first_match_dev(mach->id, NULL, -1);
1535 snprintf(byt_rt5640_codec_name, sizeof(byt_rt5640_codec_name),
1536 "i2c-%s", acpi_dev_name(adev));
1537 put_device(&adev->dev);
1538 byt_rt5640_dais[dai_index].codecs->name = byt_rt5640_codec_name;
1540 dev_err(&pdev->dev, "Error cannot find '%s' dev\n", mach->id);
1545 * swap SSP0 if bytcr is detected
1546 * (will be overridden if DMI quirk is detected)
1548 if (soc_intel_is_byt()) {
1549 if (mach->mach_params.acpi_ipc_irq_index == 0)
1555 * Baytrail CR platforms may have CHAN package in BIOS, try
1556 * to find relevant routing quirk based as done on Windows
1557 * platforms. We have to read the information directly from the
1558 * BIOS, at this stage the card is not created and the links
1559 * with the codec driver/pdata are non-existent
1562 struct acpi_chan_package chan_package;
1564 /* format specified: 2 64-bit integers */
1565 struct acpi_buffer format = {sizeof("NN"), "NN"};
1566 struct acpi_buffer state = {0, NULL};
1567 struct snd_soc_acpi_package_context pkg_ctx;
1568 bool pkg_found = false;
1570 state.length = sizeof(chan_package);
1571 state.pointer = &chan_package;
1573 pkg_ctx.name = "CHAN";
1575 pkg_ctx.format = &format;
1576 pkg_ctx.state = &state;
1577 pkg_ctx.data_valid = false;
1579 pkg_found = snd_soc_acpi_find_package_from_hid(mach->id,
1582 if (chan_package.aif_value == 1) {
1583 dev_info(&pdev->dev, "BIOS Routing: AIF1 connected\n");
1584 byt_rt5640_quirk |= BYT_RT5640_SSP0_AIF1;
1585 } else if (chan_package.aif_value == 2) {
1586 dev_info(&pdev->dev, "BIOS Routing: AIF2 connected\n");
1587 byt_rt5640_quirk |= BYT_RT5640_SSP0_AIF2;
1589 dev_info(&pdev->dev, "BIOS Routing isn't valid, ignored\n");
1595 /* no BIOS indications, assume SSP0-AIF2 connection */
1596 byt_rt5640_quirk |= BYT_RT5640_SSP0_AIF2;
1599 /* change defaults for Baytrail-CR capture */
1600 byt_rt5640_quirk |= BYTCR_INPUT_DEFAULTS;
1602 byt_rt5640_quirk |= BYT_RT5640_DMIC1_MAP |
1603 BYT_RT5640_JD_SRC_JD2_IN4N |
1604 BYT_RT5640_OVCD_TH_2000UA |
1605 BYT_RT5640_OVCD_SF_0P75;
1608 /* check quirks before creating card */
1609 dmi_id = dmi_first_match(byt_rt5640_quirk_table);
1611 byt_rt5640_quirk = (unsigned long)dmi_id->driver_data;
1612 if (quirk_override != -1) {
1613 dev_info(&pdev->dev, "Overriding quirk 0x%lx => 0x%x\n",
1614 byt_rt5640_quirk, quirk_override);
1615 byt_rt5640_quirk = quirk_override;
1618 codec_dev = acpi_get_first_physical_node(adev);
1620 return -EPROBE_DEFER;
1621 priv->codec_dev = get_device(codec_dev);
1623 if (byt_rt5640_quirk & BYT_RT5640_JD_HP_ELITEP_1000G2) {
1624 acpi_dev_add_driver_gpios(ACPI_COMPANION(priv->codec_dev),
1625 byt_rt5640_hp_elitepad_1000g2_gpios);
1627 priv->hsmic_detect = devm_fwnode_gpiod_get(&pdev->dev, codec_dev->fwnode,
1628 "headset-mic-detect", GPIOD_IN,
1629 "headset-mic-detect");
1630 if (IS_ERR(priv->hsmic_detect)) {
1631 ret_val = PTR_ERR(priv->hsmic_detect);
1632 dev_err_probe(&pdev->dev, ret_val, "getting hsmic-detect GPIO\n");
1637 /* Must be called before register_card, also see declaration comment. */
1638 ret_val = byt_rt5640_add_codec_device_props(codec_dev, priv);
1640 goto err_remove_gpios;
1642 log_quirks(&pdev->dev);
1644 if ((byt_rt5640_quirk & BYT_RT5640_SSP2_AIF2) ||
1645 (byt_rt5640_quirk & BYT_RT5640_SSP0_AIF2)) {
1646 byt_rt5640_dais[dai_index].codecs->dai_name = "rt5640-aif2";
1652 if ((byt_rt5640_quirk & BYT_RT5640_SSP0_AIF1) ||
1653 (byt_rt5640_quirk & BYT_RT5640_SSP0_AIF2))
1654 byt_rt5640_dais[dai_index].cpus->dai_name = "ssp0-port";
1656 if (byt_rt5640_quirk & BYT_RT5640_MCLK_EN) {
1657 priv->mclk = devm_clk_get(&pdev->dev, "pmc_plt_clk_3");
1658 if (IS_ERR(priv->mclk)) {
1659 ret_val = PTR_ERR(priv->mclk);
1662 "Failed to get MCLK from pmc_plt_clk_3: %d\n",
1666 * Fall back to bit clock usage for -ENOENT (clock not
1667 * available likely due to missing dependencies), bail
1668 * for all other errors, including -EPROBE_DEFER
1670 if (ret_val != -ENOENT)
1672 byt_rt5640_quirk &= ~BYT_RT5640_MCLK_EN;
1676 if (byt_rt5640_quirk & BYT_RT5640_NO_SPEAKERS) {
1679 } else if (byt_rt5640_quirk & BYT_RT5640_MONO_SPEAKER) {
1684 spk_type = "stereo";
1687 if (byt_rt5640_quirk & BYT_RT5640_LINEOUT) {
1688 if (byt_rt5640_quirk & BYT_RT5640_LINEOUT_AS_HP2)
1689 lineout_string = " cfg-hp2:lineout";
1691 lineout_string = " cfg-lineout:2";
1694 if (byt_rt5640_quirk & BYT_RT5640_HSMIC2_ON_IN1)
1695 headset2_string = " cfg-hs2:in1";
1697 snprintf(byt_rt5640_components, sizeof(byt_rt5640_components),
1698 "cfg-spk:%d cfg-mic:%s aif:%d%s%s", cfg_spk,
1699 map_name[BYT_RT5640_MAP(byt_rt5640_quirk)], aif,
1700 lineout_string, headset2_string);
1701 byt_rt5640_card.components = byt_rt5640_components;
1702 #if !IS_ENABLED(CONFIG_SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES)
1703 snprintf(byt_rt5640_long_name, sizeof(byt_rt5640_long_name),
1704 "bytcr-rt5640-%s-spk-%s-mic", spk_type,
1705 map_name[BYT_RT5640_MAP(byt_rt5640_quirk)]);
1706 byt_rt5640_card.long_name = byt_rt5640_long_name;
1709 /* override plaform name, if required */
1710 platform_name = mach->mach_params.platform;
1712 ret_val = snd_soc_fixup_dai_links_platform_name(&byt_rt5640_card,
1717 sof_parent = snd_soc_acpi_sof_parent(&pdev->dev);
1719 /* set card and driver name */
1721 byt_rt5640_card.name = SOF_CARD_NAME;
1722 byt_rt5640_card.driver_name = SOF_DRIVER_NAME;
1724 byt_rt5640_card.name = CARD_NAME;
1725 byt_rt5640_card.driver_name = DRIVER_NAME;
1730 dev->driver->pm = &snd_soc_pm_ops;
1732 ret_val = devm_snd_soc_register_card(&pdev->dev, &byt_rt5640_card);
1735 dev_err(&pdev->dev, "devm_snd_soc_register_card failed %d\n",
1739 platform_set_drvdata(pdev, &byt_rt5640_card);
1743 device_remove_software_node(priv->codec_dev);
1745 if (byt_rt5640_quirk & BYT_RT5640_JD_HP_ELITEP_1000G2)
1746 acpi_dev_remove_driver_gpios(ACPI_COMPANION(priv->codec_dev));
1748 put_device(priv->codec_dev);
1752 static int snd_byt_rt5640_mc_remove(struct platform_device *pdev)
1754 struct snd_soc_card *card = platform_get_drvdata(pdev);
1755 struct byt_rt5640_private *priv = snd_soc_card_get_drvdata(card);
1757 if (byt_rt5640_quirk & BYT_RT5640_JD_HP_ELITEP_1000G2)
1758 acpi_dev_remove_driver_gpios(ACPI_COMPANION(priv->codec_dev));
1760 device_remove_software_node(priv->codec_dev);
1761 put_device(priv->codec_dev);
1765 static struct platform_driver snd_byt_rt5640_mc_driver = {
1767 .name = "bytcr_rt5640",
1769 .probe = snd_byt_rt5640_mc_probe,
1770 .remove = snd_byt_rt5640_mc_remove,
1773 module_platform_driver(snd_byt_rt5640_mc_driver);
1775 MODULE_DESCRIPTION("ASoC Intel(R) Baytrail CR Machine driver");
1776 MODULE_AUTHOR("Subhransu S. Prusty <subhransu.s.prusty@intel.com>");
1777 MODULE_LICENSE("GPL v2");
1778 MODULE_ALIAS("platform:bytcr_rt5640");