18e8e69d6SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only
2a03bdaa5SDaniel Drake /*
3a03bdaa5SDaniel Drake * bytcht_es8316.c - ASoc Machine driver for Intel Baytrail/Cherrytrail
4a03bdaa5SDaniel Drake * platforms with Everest ES8316 SoC
5a03bdaa5SDaniel Drake *
6a03bdaa5SDaniel Drake * Copyright (C) 2017 Endless Mobile, Inc.
7a03bdaa5SDaniel Drake * Authors: David Yang <yangxiaohua@everest-semi.com>,
8a03bdaa5SDaniel Drake * Daniel Drake <drake@endlessm.com>
9a03bdaa5SDaniel Drake *
10a03bdaa5SDaniel Drake * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11a03bdaa5SDaniel Drake *
12a03bdaa5SDaniel Drake * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13a03bdaa5SDaniel Drake */
140d3e91daSHans de Goede #include <linux/acpi.h>
156ca382c4SHans de Goede #include <linux/clk.h>
166ca382c4SHans de Goede #include <linux/device.h>
17a8d218f4SPaul Cercueil #include <linux/dmi.h>
180d3e91daSHans de Goede #include <linux/gpio/consumer.h>
190d3e91daSHans de Goede #include <linux/i2c.h>
20a03bdaa5SDaniel Drake #include <linux/init.h>
214bf538b4SHans de Goede #include <linux/input.h>
22a03bdaa5SDaniel Drake #include <linux/module.h>
23a03bdaa5SDaniel Drake #include <linux/platform_device.h>
24a03bdaa5SDaniel Drake #include <linux/slab.h>
254bf538b4SHans de Goede #include <sound/jack.h>
26a03bdaa5SDaniel Drake #include <sound/pcm.h>
27a03bdaa5SDaniel Drake #include <sound/pcm_params.h>
28a03bdaa5SDaniel Drake #include <sound/soc.h>
297feb2f78SPierre-Louis Bossart #include <sound/soc-acpi.h>
30a03bdaa5SDaniel Drake #include "../atom/sst-atom-controls.h"
31536cfd2fSPierre-Louis Bossart #include "../common/soc-intel-quirks.h"
32a03bdaa5SDaniel Drake
33ba49cf6fSPaul Cercueil /* jd-inv + terminating entry */
34ba49cf6fSPaul Cercueil #define MAX_NO_PROPS 2
35ba49cf6fSPaul Cercueil
36a03bdaa5SDaniel Drake struct byt_cht_es8316_private {
37a03bdaa5SDaniel Drake struct clk *mclk;
384bf538b4SHans de Goede struct snd_soc_jack jack;
390d3e91daSHans de Goede struct gpio_desc *speaker_en_gpio;
40c50f126bSPierre-Louis Bossart struct device *codec_dev;
410d3e91daSHans de Goede bool speaker_en;
42a03bdaa5SDaniel Drake };
43a03bdaa5SDaniel Drake
44730501a9SHans de Goede enum {
45730501a9SHans de Goede BYT_CHT_ES8316_INTMIC_IN1_MAP,
46730501a9SHans de Goede BYT_CHT_ES8316_INTMIC_IN2_MAP,
47730501a9SHans de Goede };
48730501a9SHans de Goede
49730501a9SHans de Goede #define BYT_CHT_ES8316_MAP(quirk) ((quirk) & GENMASK(3, 0))
50349e1386SHans de Goede #define BYT_CHT_ES8316_SSP0 BIT(16)
51249d2fc9SHans de Goede #define BYT_CHT_ES8316_MONO_SPEAKER BIT(17)
52ba49cf6fSPaul Cercueil #define BYT_CHT_ES8316_JD_INVERTED BIT(18)
53349e1386SHans de Goede
541fb1e93aSPierre-Louis Bossart static unsigned long quirk;
55349e1386SHans de Goede
56349e1386SHans de Goede static int quirk_override = -1;
57349e1386SHans de Goede module_param_named(quirk, quirk_override, int, 0444);
58349e1386SHans de Goede MODULE_PARM_DESC(quirk, "Board-specific quirk override");
59349e1386SHans de Goede
log_quirks(struct device * dev)60349e1386SHans de Goede static void log_quirks(struct device *dev)
61349e1386SHans de Goede {
62730501a9SHans de Goede if (BYT_CHT_ES8316_MAP(quirk) == BYT_CHT_ES8316_INTMIC_IN1_MAP)
63730501a9SHans de Goede dev_info(dev, "quirk IN1_MAP enabled");
64730501a9SHans de Goede if (BYT_CHT_ES8316_MAP(quirk) == BYT_CHT_ES8316_INTMIC_IN2_MAP)
65730501a9SHans de Goede dev_info(dev, "quirk IN2_MAP enabled");
66349e1386SHans de Goede if (quirk & BYT_CHT_ES8316_SSP0)
67349e1386SHans de Goede dev_info(dev, "quirk SSP0 enabled");
68249d2fc9SHans de Goede if (quirk & BYT_CHT_ES8316_MONO_SPEAKER)
69249d2fc9SHans de Goede dev_info(dev, "quirk MONO_SPEAKER enabled\n");
70ba49cf6fSPaul Cercueil if (quirk & BYT_CHT_ES8316_JD_INVERTED)
71ba49cf6fSPaul Cercueil dev_info(dev, "quirk JD_INVERTED enabled\n");
72349e1386SHans de Goede }
73349e1386SHans de Goede
byt_cht_es8316_speaker_power_event(struct snd_soc_dapm_widget * w,struct snd_kcontrol * kcontrol,int event)740d3e91daSHans de Goede static int byt_cht_es8316_speaker_power_event(struct snd_soc_dapm_widget *w,
750d3e91daSHans de Goede struct snd_kcontrol *kcontrol, int event)
760d3e91daSHans de Goede {
770d3e91daSHans de Goede struct snd_soc_card *card = w->dapm->card;
780d3e91daSHans de Goede struct byt_cht_es8316_private *priv = snd_soc_card_get_drvdata(card);
790d3e91daSHans de Goede
800d3e91daSHans de Goede if (SND_SOC_DAPM_EVENT_ON(event))
810d3e91daSHans de Goede priv->speaker_en = true;
820d3e91daSHans de Goede else
830d3e91daSHans de Goede priv->speaker_en = false;
840d3e91daSHans de Goede
850d3e91daSHans de Goede gpiod_set_value_cansleep(priv->speaker_en_gpio, priv->speaker_en);
860d3e91daSHans de Goede
870d3e91daSHans de Goede return 0;
880d3e91daSHans de Goede }
890d3e91daSHans de Goede
90a03bdaa5SDaniel Drake static const struct snd_soc_dapm_widget byt_cht_es8316_widgets[] = {
910d3e91daSHans de Goede SND_SOC_DAPM_SPK("Speaker", NULL),
92a03bdaa5SDaniel Drake SND_SOC_DAPM_HP("Headphone", NULL),
934bf538b4SHans de Goede SND_SOC_DAPM_MIC("Headset Mic", NULL),
94730501a9SHans de Goede SND_SOC_DAPM_MIC("Internal Mic", NULL),
950d3e91daSHans de Goede
960d3e91daSHans de Goede SND_SOC_DAPM_SUPPLY("Speaker Power", SND_SOC_NOPM, 0, 0,
970d3e91daSHans de Goede byt_cht_es8316_speaker_power_event,
980d3e91daSHans de Goede SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
99a03bdaa5SDaniel Drake };
100a03bdaa5SDaniel Drake
101a03bdaa5SDaniel Drake static const struct snd_soc_dapm_route byt_cht_es8316_audio_map[] = {
102a03bdaa5SDaniel Drake {"Headphone", NULL, "HPOL"},
103a03bdaa5SDaniel Drake {"Headphone", NULL, "HPOR"},
1040d3e91daSHans de Goede
1050d3e91daSHans de Goede /*
1060d3e91daSHans de Goede * There is no separate speaker output instead the speakers are muxed to
1070d3e91daSHans de Goede * the HP outputs. The mux is controlled by the "Speaker Power" supply.
1080d3e91daSHans de Goede */
1090d3e91daSHans de Goede {"Speaker", NULL, "HPOL"},
1100d3e91daSHans de Goede {"Speaker", NULL, "HPOR"},
1110d3e91daSHans de Goede {"Speaker", NULL, "Speaker Power"},
112349e1386SHans de Goede };
113a03bdaa5SDaniel Drake
114730501a9SHans de Goede static const struct snd_soc_dapm_route byt_cht_es8316_intmic_in1_map[] = {
115730501a9SHans de Goede {"MIC1", NULL, "Internal Mic"},
116730501a9SHans de Goede {"MIC2", NULL, "Headset Mic"},
117730501a9SHans de Goede };
118730501a9SHans de Goede
119730501a9SHans de Goede static const struct snd_soc_dapm_route byt_cht_es8316_intmic_in2_map[] = {
120730501a9SHans de Goede {"MIC2", NULL, "Internal Mic"},
121730501a9SHans de Goede {"MIC1", NULL, "Headset Mic"},
122730501a9SHans de Goede };
123730501a9SHans de Goede
124349e1386SHans de Goede static const struct snd_soc_dapm_route byt_cht_es8316_ssp0_map[] = {
125349e1386SHans de Goede {"Playback", NULL, "ssp0 Tx"},
126349e1386SHans de Goede {"ssp0 Tx", NULL, "modem_out"},
127349e1386SHans de Goede {"modem_in", NULL, "ssp0 Rx"},
128349e1386SHans de Goede {"ssp0 Rx", NULL, "Capture"},
129349e1386SHans de Goede };
130349e1386SHans de Goede
131349e1386SHans de Goede static const struct snd_soc_dapm_route byt_cht_es8316_ssp2_map[] = {
132a03bdaa5SDaniel Drake {"Playback", NULL, "ssp2 Tx"},
133a03bdaa5SDaniel Drake {"ssp2 Tx", NULL, "codec_out0"},
134a03bdaa5SDaniel Drake {"ssp2 Tx", NULL, "codec_out1"},
135a03bdaa5SDaniel Drake {"codec_in0", NULL, "ssp2 Rx" },
136a03bdaa5SDaniel Drake {"codec_in1", NULL, "ssp2 Rx" },
137a03bdaa5SDaniel Drake {"ssp2 Rx", NULL, "Capture"},
138a03bdaa5SDaniel Drake };
139a03bdaa5SDaniel Drake
140a03bdaa5SDaniel Drake static const struct snd_kcontrol_new byt_cht_es8316_controls[] = {
1410d3e91daSHans de Goede SOC_DAPM_PIN_SWITCH("Speaker"),
142a03bdaa5SDaniel Drake SOC_DAPM_PIN_SWITCH("Headphone"),
1434bf538b4SHans de Goede SOC_DAPM_PIN_SWITCH("Headset Mic"),
144730501a9SHans de Goede SOC_DAPM_PIN_SWITCH("Internal Mic"),
145a03bdaa5SDaniel Drake };
146a03bdaa5SDaniel Drake
1474bf538b4SHans de Goede static struct snd_soc_jack_pin byt_cht_es8316_jack_pins[] = {
1484bf538b4SHans de Goede {
1494bf538b4SHans de Goede .pin = "Headphone",
1504bf538b4SHans de Goede .mask = SND_JACK_HEADPHONE,
1514bf538b4SHans de Goede },
1524bf538b4SHans de Goede {
1534bf538b4SHans de Goede .pin = "Headset Mic",
1544bf538b4SHans de Goede .mask = SND_JACK_MICROPHONE,
1554bf538b4SHans de Goede },
1564bf538b4SHans de Goede };
1574bf538b4SHans de Goede
byt_cht_es8316_init(struct snd_soc_pcm_runtime * runtime)158a03bdaa5SDaniel Drake static int byt_cht_es8316_init(struct snd_soc_pcm_runtime *runtime)
159a03bdaa5SDaniel Drake {
1600d1571c1SKuninori Morimoto struct snd_soc_component *codec = asoc_rtd_to_codec(runtime, 0)->component;
161a03bdaa5SDaniel Drake struct snd_soc_card *card = runtime->card;
162a03bdaa5SDaniel Drake struct byt_cht_es8316_private *priv = snd_soc_card_get_drvdata(card);
163349e1386SHans de Goede const struct snd_soc_dapm_route *custom_map;
164349e1386SHans de Goede int num_routes;
165a03bdaa5SDaniel Drake int ret;
166a03bdaa5SDaniel Drake
167a03bdaa5SDaniel Drake card->dapm.idle_bias_off = true;
168a03bdaa5SDaniel Drake
169730501a9SHans de Goede switch (BYT_CHT_ES8316_MAP(quirk)) {
170730501a9SHans de Goede case BYT_CHT_ES8316_INTMIC_IN1_MAP:
171730501a9SHans de Goede default:
172730501a9SHans de Goede custom_map = byt_cht_es8316_intmic_in1_map;
173730501a9SHans de Goede num_routes = ARRAY_SIZE(byt_cht_es8316_intmic_in1_map);
174730501a9SHans de Goede break;
175730501a9SHans de Goede case BYT_CHT_ES8316_INTMIC_IN2_MAP:
176730501a9SHans de Goede custom_map = byt_cht_es8316_intmic_in2_map;
177730501a9SHans de Goede num_routes = ARRAY_SIZE(byt_cht_es8316_intmic_in2_map);
178730501a9SHans de Goede break;
179730501a9SHans de Goede }
180730501a9SHans de Goede ret = snd_soc_dapm_add_routes(&card->dapm, custom_map, num_routes);
181730501a9SHans de Goede if (ret)
182730501a9SHans de Goede return ret;
183730501a9SHans de Goede
184349e1386SHans de Goede if (quirk & BYT_CHT_ES8316_SSP0) {
185349e1386SHans de Goede custom_map = byt_cht_es8316_ssp0_map;
186349e1386SHans de Goede num_routes = ARRAY_SIZE(byt_cht_es8316_ssp0_map);
187349e1386SHans de Goede } else {
188349e1386SHans de Goede custom_map = byt_cht_es8316_ssp2_map;
189349e1386SHans de Goede num_routes = ARRAY_SIZE(byt_cht_es8316_ssp2_map);
190349e1386SHans de Goede }
191349e1386SHans de Goede ret = snd_soc_dapm_add_routes(&card->dapm, custom_map, num_routes);
192349e1386SHans de Goede if (ret)
193349e1386SHans de Goede return ret;
194349e1386SHans de Goede
195a03bdaa5SDaniel Drake /*
196a03bdaa5SDaniel Drake * The firmware might enable the clock at boot (this information
197a03bdaa5SDaniel Drake * may or may not be reflected in the enable clock register).
198a03bdaa5SDaniel Drake * To change the rate we must disable the clock first to cover these
199a03bdaa5SDaniel Drake * cases. Due to common clock framework restrictions that do not allow
200a03bdaa5SDaniel Drake * to disable a clock that has not been enabled, we need to enable
201a03bdaa5SDaniel Drake * the clock first.
202a03bdaa5SDaniel Drake */
203a03bdaa5SDaniel Drake ret = clk_prepare_enable(priv->mclk);
204a03bdaa5SDaniel Drake if (!ret)
205a03bdaa5SDaniel Drake clk_disable_unprepare(priv->mclk);
206a03bdaa5SDaniel Drake
207a03bdaa5SDaniel Drake ret = clk_set_rate(priv->mclk, 19200000);
208a03bdaa5SDaniel Drake if (ret)
209a03bdaa5SDaniel Drake dev_err(card->dev, "unable to set MCLK rate\n");
210a03bdaa5SDaniel Drake
211a03bdaa5SDaniel Drake ret = clk_prepare_enable(priv->mclk);
212a03bdaa5SDaniel Drake if (ret)
213a03bdaa5SDaniel Drake dev_err(card->dev, "unable to enable MCLK\n");
214a03bdaa5SDaniel Drake
2150d1571c1SKuninori Morimoto ret = snd_soc_dai_set_sysclk(asoc_rtd_to_codec(runtime, 0), 0, 19200000,
216a03bdaa5SDaniel Drake SND_SOC_CLOCK_IN);
217a03bdaa5SDaniel Drake if (ret < 0) {
218a03bdaa5SDaniel Drake dev_err(card->dev, "can't set codec clock %d\n", ret);
219a03bdaa5SDaniel Drake return ret;
220a03bdaa5SDaniel Drake }
221a03bdaa5SDaniel Drake
22219aed2d6SAkihiko Odaki ret = snd_soc_card_jack_new_pins(card, "Headset",
2234bf538b4SHans de Goede SND_JACK_HEADSET | SND_JACK_BTN_0,
2244bf538b4SHans de Goede &priv->jack, byt_cht_es8316_jack_pins,
2254bf538b4SHans de Goede ARRAY_SIZE(byt_cht_es8316_jack_pins));
2264bf538b4SHans de Goede if (ret) {
2274bf538b4SHans de Goede dev_err(card->dev, "jack creation failed %d\n", ret);
2284bf538b4SHans de Goede return ret;
2294bf538b4SHans de Goede }
2304bf538b4SHans de Goede
2314bf538b4SHans de Goede snd_jack_set_key(priv->jack.jack, SND_JACK_BTN_0, KEY_PLAYPAUSE);
2324bf538b4SHans de Goede snd_soc_component_set_jack(codec, &priv->jack, NULL);
2334bf538b4SHans de Goede
234a03bdaa5SDaniel Drake return 0;
235a03bdaa5SDaniel Drake }
236a03bdaa5SDaniel Drake
byt_cht_es8316_codec_fixup(struct snd_soc_pcm_runtime * rtd,struct snd_pcm_hw_params * params)237a03bdaa5SDaniel Drake static int byt_cht_es8316_codec_fixup(struct snd_soc_pcm_runtime *rtd,
238a03bdaa5SDaniel Drake struct snd_pcm_hw_params *params)
239a03bdaa5SDaniel Drake {
240a03bdaa5SDaniel Drake struct snd_interval *rate = hw_param_interval(params,
241a03bdaa5SDaniel Drake SNDRV_PCM_HW_PARAM_RATE);
242a03bdaa5SDaniel Drake struct snd_interval *channels = hw_param_interval(params,
243a03bdaa5SDaniel Drake SNDRV_PCM_HW_PARAM_CHANNELS);
244349e1386SHans de Goede int ret, bits;
245a03bdaa5SDaniel Drake
2464088355aSAmadeusz Sławiński /* The DSP will convert the FE rate to 48k, stereo */
247a03bdaa5SDaniel Drake rate->min = rate->max = 48000;
248a03bdaa5SDaniel Drake channels->min = channels->max = 2;
249a03bdaa5SDaniel Drake
250349e1386SHans de Goede if (quirk & BYT_CHT_ES8316_SSP0) {
251349e1386SHans de Goede /* set SSP0 to 16-bit */
252349e1386SHans de Goede params_set_format(params, SNDRV_PCM_FORMAT_S16_LE);
253349e1386SHans de Goede bits = 16;
254349e1386SHans de Goede } else {
255a03bdaa5SDaniel Drake /* set SSP2 to 24-bit */
256a03bdaa5SDaniel Drake params_set_format(params, SNDRV_PCM_FORMAT_S24_LE);
257349e1386SHans de Goede bits = 24;
258349e1386SHans de Goede }
259a03bdaa5SDaniel Drake
260a03bdaa5SDaniel Drake /*
261a03bdaa5SDaniel Drake * Default mode for SSP configuration is TDM 4 slot, override config
262a03bdaa5SDaniel Drake * with explicit setting to I2S 2ch 24-bit. The word length is set with
263a03bdaa5SDaniel Drake * dai_set_tdm_slot() since there is no other API exposed
264a03bdaa5SDaniel Drake */
2650d1571c1SKuninori Morimoto ret = snd_soc_dai_set_fmt(asoc_rtd_to_cpu(rtd, 0),
266a03bdaa5SDaniel Drake SND_SOC_DAIFMT_I2S |
267a03bdaa5SDaniel Drake SND_SOC_DAIFMT_NB_NF |
268add9ee8cSCharles Keepax SND_SOC_DAIFMT_BP_FP
269a03bdaa5SDaniel Drake );
270a03bdaa5SDaniel Drake if (ret < 0) {
271a03bdaa5SDaniel Drake dev_err(rtd->dev, "can't set format to I2S, err %d\n", ret);
272a03bdaa5SDaniel Drake return ret;
273a03bdaa5SDaniel Drake }
274a03bdaa5SDaniel Drake
2750d1571c1SKuninori Morimoto ret = snd_soc_dai_set_tdm_slot(asoc_rtd_to_cpu(rtd, 0), 0x3, 0x3, 2, bits);
276a03bdaa5SDaniel Drake if (ret < 0) {
277a03bdaa5SDaniel Drake dev_err(rtd->dev, "can't set I2S config, err %d\n", ret);
278a03bdaa5SDaniel Drake return ret;
279a03bdaa5SDaniel Drake }
280a03bdaa5SDaniel Drake
281a03bdaa5SDaniel Drake return 0;
282a03bdaa5SDaniel Drake }
283a03bdaa5SDaniel Drake
byt_cht_es8316_aif1_startup(struct snd_pcm_substream * substream)284a03bdaa5SDaniel Drake static int byt_cht_es8316_aif1_startup(struct snd_pcm_substream *substream)
285a03bdaa5SDaniel Drake {
286a03bdaa5SDaniel Drake return snd_pcm_hw_constraint_single(substream->runtime,
287a03bdaa5SDaniel Drake SNDRV_PCM_HW_PARAM_RATE, 48000);
288a03bdaa5SDaniel Drake }
289a03bdaa5SDaniel Drake
290a03bdaa5SDaniel Drake static const struct snd_soc_ops byt_cht_es8316_aif1_ops = {
291a03bdaa5SDaniel Drake .startup = byt_cht_es8316_aif1_startup,
292a03bdaa5SDaniel Drake };
293a03bdaa5SDaniel Drake
294143029dbSKuninori Morimoto SND_SOC_DAILINK_DEF(dummy,
295143029dbSKuninori Morimoto DAILINK_COMP_ARRAY(COMP_DUMMY()));
296143029dbSKuninori Morimoto
297143029dbSKuninori Morimoto SND_SOC_DAILINK_DEF(media,
298143029dbSKuninori Morimoto DAILINK_COMP_ARRAY(COMP_CPU("media-cpu-dai")));
299143029dbSKuninori Morimoto
300143029dbSKuninori Morimoto SND_SOC_DAILINK_DEF(deepbuffer,
301143029dbSKuninori Morimoto DAILINK_COMP_ARRAY(COMP_CPU("deepbuffer-cpu-dai")));
302143029dbSKuninori Morimoto
303143029dbSKuninori Morimoto SND_SOC_DAILINK_DEF(ssp2_port,
304143029dbSKuninori Morimoto DAILINK_COMP_ARRAY(COMP_CPU("ssp2-port")));
305143029dbSKuninori Morimoto SND_SOC_DAILINK_DEF(ssp2_codec,
306143029dbSKuninori Morimoto DAILINK_COMP_ARRAY(COMP_CODEC("i2c-ESSX8316:00", "ES8316 HiFi")));
307143029dbSKuninori Morimoto
308143029dbSKuninori Morimoto SND_SOC_DAILINK_DEF(platform,
309143029dbSKuninori Morimoto DAILINK_COMP_ARRAY(COMP_PLATFORM("sst-mfld-platform")));
310143029dbSKuninori Morimoto
311a03bdaa5SDaniel Drake static struct snd_soc_dai_link byt_cht_es8316_dais[] = {
312a03bdaa5SDaniel Drake [MERR_DPCM_AUDIO] = {
313a03bdaa5SDaniel Drake .name = "Audio Port",
314a03bdaa5SDaniel Drake .stream_name = "Audio",
315a03bdaa5SDaniel Drake .nonatomic = true,
316a03bdaa5SDaniel Drake .dynamic = 1,
317a03bdaa5SDaniel Drake .dpcm_playback = 1,
318a03bdaa5SDaniel Drake .dpcm_capture = 1,
319a03bdaa5SDaniel Drake .ops = &byt_cht_es8316_aif1_ops,
320143029dbSKuninori Morimoto SND_SOC_DAILINK_REG(media, dummy, platform),
321a03bdaa5SDaniel Drake },
322a03bdaa5SDaniel Drake
323a03bdaa5SDaniel Drake [MERR_DPCM_DEEP_BUFFER] = {
324a03bdaa5SDaniel Drake .name = "Deep-Buffer Audio Port",
325a03bdaa5SDaniel Drake .stream_name = "Deep-Buffer Audio",
326a03bdaa5SDaniel Drake .nonatomic = true,
327a03bdaa5SDaniel Drake .dynamic = 1,
328a03bdaa5SDaniel Drake .dpcm_playback = 1,
329a03bdaa5SDaniel Drake .ops = &byt_cht_es8316_aif1_ops,
330143029dbSKuninori Morimoto SND_SOC_DAILINK_REG(deepbuffer, dummy, platform),
331a03bdaa5SDaniel Drake },
332a03bdaa5SDaniel Drake
333a03bdaa5SDaniel Drake /* back ends */
334a03bdaa5SDaniel Drake {
335a03bdaa5SDaniel Drake .name = "SSP2-Codec",
336149f7757SPierre-Louis Bossart .id = 0,
337a03bdaa5SDaniel Drake .no_pcm = 1,
338a03bdaa5SDaniel Drake .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
3395374b921SPeter Ujfalusi | SND_SOC_DAIFMT_CBC_CFC,
340a03bdaa5SDaniel Drake .be_hw_params_fixup = byt_cht_es8316_codec_fixup,
341a03bdaa5SDaniel Drake .dpcm_playback = 1,
342a03bdaa5SDaniel Drake .dpcm_capture = 1,
343a03bdaa5SDaniel Drake .init = byt_cht_es8316_init,
344143029dbSKuninori Morimoto SND_SOC_DAILINK_REG(ssp2_port, ssp2_codec, platform),
345a03bdaa5SDaniel Drake },
346a03bdaa5SDaniel Drake };
347a03bdaa5SDaniel Drake
348a03bdaa5SDaniel Drake
349a03bdaa5SDaniel Drake /* SoC card */
3504bf538b4SHans de Goede static char codec_name[SND_ACPI_I2C_ID_LEN];
351b5706f8eSJaroslav Kysela #if !IS_ENABLED(CONFIG_SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES)
352249d2fc9SHans de Goede static char long_name[50]; /* = "bytcht-es8316-*-spk-*-mic" */
353b5706f8eSJaroslav Kysela #endif
3540d5c8187SJaroslav Kysela static char components_string[32]; /* = "cfg-spk:* cfg-mic:* */
3554bf538b4SHans de Goede
byt_cht_es8316_suspend(struct snd_soc_card * card)3564bf538b4SHans de Goede static int byt_cht_es8316_suspend(struct snd_soc_card *card)
3574bf538b4SHans de Goede {
3584bf538b4SHans de Goede struct snd_soc_component *component;
3594bf538b4SHans de Goede
3604bf538b4SHans de Goede for_each_card_components(card, component) {
3614bf538b4SHans de Goede if (!strcmp(component->name, codec_name)) {
3624bf538b4SHans de Goede dev_dbg(component->dev, "disabling jack detect before suspend\n");
3634bf538b4SHans de Goede snd_soc_component_set_jack(component, NULL, NULL);
3644bf538b4SHans de Goede break;
3654bf538b4SHans de Goede }
3664bf538b4SHans de Goede }
3674bf538b4SHans de Goede
3684bf538b4SHans de Goede return 0;
3694bf538b4SHans de Goede }
3704bf538b4SHans de Goede
byt_cht_es8316_resume(struct snd_soc_card * card)3714bf538b4SHans de Goede static int byt_cht_es8316_resume(struct snd_soc_card *card)
3724bf538b4SHans de Goede {
3734bf538b4SHans de Goede struct byt_cht_es8316_private *priv = snd_soc_card_get_drvdata(card);
3744bf538b4SHans de Goede struct snd_soc_component *component;
3754bf538b4SHans de Goede
3764bf538b4SHans de Goede for_each_card_components(card, component) {
3774bf538b4SHans de Goede if (!strcmp(component->name, codec_name)) {
3784bf538b4SHans de Goede dev_dbg(component->dev, "re-enabling jack detect after resume\n");
3794bf538b4SHans de Goede snd_soc_component_set_jack(component, &priv->jack, NULL);
3804bf538b4SHans de Goede break;
3814bf538b4SHans de Goede }
3824bf538b4SHans de Goede }
3834bf538b4SHans de Goede
3840d3e91daSHans de Goede /*
3850d3e91daSHans de Goede * Some Cherry Trail boards with an ES8316 codec have a bug in their
3860d3e91daSHans de Goede * ACPI tables where the MSSL1680 touchscreen's _PS0 and _PS3 methods
3870d3e91daSHans de Goede * wrongly also set the speaker-enable GPIO to 1/0. Testing has shown
3880d3e91daSHans de Goede * that this really is a bug and the GPIO has no influence on the
3890d3e91daSHans de Goede * touchscreen at all.
3900d3e91daSHans de Goede *
3910d3e91daSHans de Goede * The silead.c touchscreen driver does not support runtime suspend, so
3920d3e91daSHans de Goede * the GPIO can only be changed underneath us during a system suspend.
3930d3e91daSHans de Goede * This resume() function runs from a pm complete() callback, and thus
3940d3e91daSHans de Goede * is guaranteed to run after the touchscreen driver/ACPI-subsys has
3950d3e91daSHans de Goede * brought the touchscreen back up again (and thus changed the GPIO).
3960d3e91daSHans de Goede *
3970d3e91daSHans de Goede * So to work around this we pass GPIOD_FLAGS_BIT_NONEXCLUSIVE when
3980d3e91daSHans de Goede * requesting the GPIO and we set its value here to undo any changes
3990d3e91daSHans de Goede * done by the touchscreen's broken _PS0 ACPI method.
4000d3e91daSHans de Goede */
4010d3e91daSHans de Goede gpiod_set_value_cansleep(priv->speaker_en_gpio, priv->speaker_en);
4020d3e91daSHans de Goede
4034bf538b4SHans de Goede return 0;
4044bf538b4SHans de Goede }
4054bf538b4SHans de Goede
406b4ecd58bSPierre-Louis Bossart /* use space before codec name to simplify card ID, and simplify driver name */
40741656c3dSPierre-Louis Bossart #define SOF_CARD_NAME "bytcht es8316" /* card name will be 'sof-bytcht es8316' */
40841656c3dSPierre-Louis Bossart #define SOF_DRIVER_NAME "SOF"
40941656c3dSPierre-Louis Bossart
410b4ecd58bSPierre-Louis Bossart #define CARD_NAME "bytcht-es8316"
411b4ecd58bSPierre-Louis Bossart #define DRIVER_NAME NULL /* card name will be used for driver name */
412b4ecd58bSPierre-Louis Bossart
413a03bdaa5SDaniel Drake static struct snd_soc_card byt_cht_es8316_card = {
414a03bdaa5SDaniel Drake .owner = THIS_MODULE,
415a03bdaa5SDaniel Drake .dai_link = byt_cht_es8316_dais,
416a03bdaa5SDaniel Drake .num_links = ARRAY_SIZE(byt_cht_es8316_dais),
417a03bdaa5SDaniel Drake .dapm_widgets = byt_cht_es8316_widgets,
418a03bdaa5SDaniel Drake .num_dapm_widgets = ARRAY_SIZE(byt_cht_es8316_widgets),
419a03bdaa5SDaniel Drake .dapm_routes = byt_cht_es8316_audio_map,
420a03bdaa5SDaniel Drake .num_dapm_routes = ARRAY_SIZE(byt_cht_es8316_audio_map),
421a03bdaa5SDaniel Drake .controls = byt_cht_es8316_controls,
422a03bdaa5SDaniel Drake .num_controls = ARRAY_SIZE(byt_cht_es8316_controls),
423a03bdaa5SDaniel Drake .fully_routed = true,
4244bf538b4SHans de Goede .suspend_pre = byt_cht_es8316_suspend,
4254bf538b4SHans de Goede .resume_post = byt_cht_es8316_resume,
426a03bdaa5SDaniel Drake };
427a03bdaa5SDaniel Drake
4280d3e91daSHans de Goede static const struct acpi_gpio_params first_gpio = { 0, 0, false };
4290d3e91daSHans de Goede
4300d3e91daSHans de Goede static const struct acpi_gpio_mapping byt_cht_es8316_gpios[] = {
4310d3e91daSHans de Goede { "speaker-enable-gpios", &first_gpio, 1 },
4320d3e91daSHans de Goede { },
4330d3e91daSHans de Goede };
4340d3e91daSHans de Goede
435a8d218f4SPaul Cercueil /* Please keep this list alphabetically sorted */
436a8d218f4SPaul Cercueil static const struct dmi_system_id byt_cht_es8316_quirk_table[] = {
437aa2ba991SHans de Goede { /* Irbis NB41 */
438aa2ba991SHans de Goede .matches = {
439aa2ba991SHans de Goede DMI_MATCH(DMI_SYS_VENDOR, "IRBIS"),
440aa2ba991SHans de Goede DMI_MATCH(DMI_PRODUCT_NAME, "NB41"),
441aa2ba991SHans de Goede },
442869bced7SHans de Goede .driver_data = (void *)(BYT_CHT_ES8316_SSP0
443869bced7SHans de Goede | BYT_CHT_ES8316_INTMIC_IN2_MAP
444aa2ba991SHans de Goede | BYT_CHT_ES8316_JD_INVERTED),
445aa2ba991SHans de Goede },
4468bb0ac0eSHans de Goede { /* Nanote UMPC-01 */
4478bb0ac0eSHans de Goede .matches = {
4488bb0ac0eSHans de Goede DMI_MATCH(DMI_SYS_VENDOR, "RWC CO.,LTD"),
4498bb0ac0eSHans de Goede DMI_MATCH(DMI_PRODUCT_NAME, "UMPC-01"),
4508bb0ac0eSHans de Goede },
4518bb0ac0eSHans de Goede .driver_data = (void *)BYT_CHT_ES8316_INTMIC_IN1_MAP,
4528bb0ac0eSHans de Goede },
453a8d218f4SPaul Cercueil { /* Teclast X98 Plus II */
454a8d218f4SPaul Cercueil .matches = {
455a8d218f4SPaul Cercueil DMI_MATCH(DMI_SYS_VENDOR, "TECLAST"),
456a8d218f4SPaul Cercueil DMI_MATCH(DMI_PRODUCT_NAME, "X98 Plus II"),
457a8d218f4SPaul Cercueil },
458a8d218f4SPaul Cercueil .driver_data = (void *)(BYT_CHT_ES8316_INTMIC_IN1_MAP
459a8d218f4SPaul Cercueil | BYT_CHT_ES8316_JD_INVERTED),
460a8d218f4SPaul Cercueil },
461a8d218f4SPaul Cercueil {}
462a8d218f4SPaul Cercueil };
463a8d218f4SPaul Cercueil
snd_byt_cht_es8316_mc_probe(struct platform_device * pdev)464a03bdaa5SDaniel Drake static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
465a03bdaa5SDaniel Drake {
4665f6c1341SAndy Shevchenko struct device *dev = &pdev->dev;
4674ffdca62SColin Ian King static const char * const mic_name[] = { "in1", "in2" };
4685f6c1341SAndy Shevchenko struct snd_soc_acpi_mach *mach = dev_get_platdata(dev);
469ba49cf6fSPaul Cercueil struct property_entry props[MAX_NO_PROPS] = {};
470a03bdaa5SDaniel Drake struct byt_cht_es8316_private *priv;
471a8d218f4SPaul Cercueil const struct dmi_system_id *dmi_id;
4720bd3c071SHeikki Krogerus struct fwnode_handle *fwnode;
473e4bc6b11SPierre-Louis Bossart const char *platform_name;
474645056daSAndy Shevchenko struct acpi_device *adev;
4750d3e91daSHans de Goede struct device *codec_dev;
47641656c3dSPierre-Louis Bossart bool sof_parent;
477ba49cf6fSPaul Cercueil unsigned int cnt = 0;
4783c22a73fSPierre-Louis Bossart int dai_index = 0;
4793c22a73fSPierre-Louis Bossart int i;
4803c22a73fSPierre-Louis Bossart int ret = 0;
481a03bdaa5SDaniel Drake
48286909c8fSHans de Goede priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
483a03bdaa5SDaniel Drake if (!priv)
484a03bdaa5SDaniel Drake return -ENOMEM;
485a03bdaa5SDaniel Drake
4863c22a73fSPierre-Louis Bossart /* fix index of codec dai */
4873c22a73fSPierre-Louis Bossart for (i = 0; i < ARRAY_SIZE(byt_cht_es8316_dais); i++) {
488143029dbSKuninori Morimoto if (!strcmp(byt_cht_es8316_dais[i].codecs->name,
4893c22a73fSPierre-Louis Bossart "i2c-ESSX8316:00")) {
4903c22a73fSPierre-Louis Bossart dai_index = i;
4913c22a73fSPierre-Louis Bossart break;
4923c22a73fSPierre-Louis Bossart }
4933c22a73fSPierre-Louis Bossart }
4943c22a73fSPierre-Louis Bossart
4953c22a73fSPierre-Louis Bossart /* fixup codec name based on HID */
496645056daSAndy Shevchenko adev = acpi_dev_get_first_match_dev(mach->id, NULL, -1);
497645056daSAndy Shevchenko if (adev) {
4983c22a73fSPierre-Louis Bossart snprintf(codec_name, sizeof(codec_name),
499645056daSAndy Shevchenko "i2c-%s", acpi_dev_name(adev));
500143029dbSKuninori Morimoto byt_cht_es8316_dais[dai_index].codecs->name = codec_name;
50169efe3b8SPierre-Louis Bossart } else {
502e8ccf82bSAndy Shevchenko dev_err(dev, "Error cannot find '%s' dev\n", mach->id);
50369efe3b8SPierre-Louis Bossart return -ENXIO;
5043c22a73fSPierre-Louis Bossart }
5053c22a73fSPierre-Louis Bossart
5066b1c0bd6SAndy Shevchenko codec_dev = acpi_get_first_physical_node(adev);
5076b1c0bd6SAndy Shevchenko acpi_dev_put(adev);
5086b1c0bd6SAndy Shevchenko if (!codec_dev)
5096b1c0bd6SAndy Shevchenko return -EPROBE_DEFER;
5106b1c0bd6SAndy Shevchenko priv->codec_dev = get_device(codec_dev);
5116b1c0bd6SAndy Shevchenko
512f1eebb3bSPierre-Louis Bossart /* override platform name, if required */
51379136a01SPierre-Louis Bossart byt_cht_es8316_card.dev = dev;
514e4bc6b11SPierre-Louis Bossart platform_name = mach->mach_params.platform;
515e4bc6b11SPierre-Louis Bossart
516e4bc6b11SPierre-Louis Bossart ret = snd_soc_fixup_dai_links_platform_name(&byt_cht_es8316_card,
517e4bc6b11SPierre-Louis Bossart platform_name);
5186b1c0bd6SAndy Shevchenko if (ret) {
5196b1c0bd6SAndy Shevchenko put_device(codec_dev);
520e4bc6b11SPierre-Louis Bossart return ret;
5216b1c0bd6SAndy Shevchenko }
522e4bc6b11SPierre-Louis Bossart
523349e1386SHans de Goede /* Check for BYTCR or other platform and setup quirks */
524a8d218f4SPaul Cercueil dmi_id = dmi_first_match(byt_cht_es8316_quirk_table);
525a8d218f4SPaul Cercueil if (dmi_id) {
5261fb1e93aSPierre-Louis Bossart quirk = (unsigned long)dmi_id->driver_data;
527536cfd2fSPierre-Louis Bossart } else if (soc_intel_is_byt() &&
528349e1386SHans de Goede mach->mach_params.acpi_ipc_irq_index == 0) {
529249d2fc9SHans de Goede /* On BYTCR default to SSP0, internal-mic-in2-map, mono-spk */
530249d2fc9SHans de Goede quirk = BYT_CHT_ES8316_SSP0 | BYT_CHT_ES8316_INTMIC_IN2_MAP |
531249d2fc9SHans de Goede BYT_CHT_ES8316_MONO_SPEAKER;
532349e1386SHans de Goede } else {
533249d2fc9SHans de Goede /* Others default to internal-mic-in1-map, mono-speaker */
534249d2fc9SHans de Goede quirk = BYT_CHT_ES8316_INTMIC_IN1_MAP |
535249d2fc9SHans de Goede BYT_CHT_ES8316_MONO_SPEAKER;
536349e1386SHans de Goede }
537349e1386SHans de Goede if (quirk_override != -1) {
5382697f3afSPierre-Louis Bossart dev_info(dev, "Overriding quirk 0x%lx => 0x%x\n",
5392697f3afSPierre-Louis Bossart quirk, quirk_override);
540349e1386SHans de Goede quirk = quirk_override;
541349e1386SHans de Goede }
542349e1386SHans de Goede log_quirks(dev);
543349e1386SHans de Goede
544349e1386SHans de Goede if (quirk & BYT_CHT_ES8316_SSP0)
545143029dbSKuninori Morimoto byt_cht_es8316_dais[dai_index].cpus->dai_name = "ssp0-port";
546349e1386SHans de Goede
54786909c8fSHans de Goede /* get the clock */
54886909c8fSHans de Goede priv->mclk = devm_clk_get(dev, "pmc_plt_clk_3");
5496b1c0bd6SAndy Shevchenko if (IS_ERR(priv->mclk)) {
5506b1c0bd6SAndy Shevchenko put_device(codec_dev);
551bea03a32SAndy Shevchenko return dev_err_probe(dev, PTR_ERR(priv->mclk), "clk_get pmc_plt_clk_3 failed\n");
5526b1c0bd6SAndy Shevchenko }
5530d3e91daSHans de Goede
554ba49cf6fSPaul Cercueil if (quirk & BYT_CHT_ES8316_JD_INVERTED)
555ba49cf6fSPaul Cercueil props[cnt++] = PROPERTY_ENTRY_BOOL("everest,jack-detect-inverted");
556ba49cf6fSPaul Cercueil
557ba49cf6fSPaul Cercueil if (cnt) {
5580bd3c071SHeikki Krogerus fwnode = fwnode_create_software_node(props, NULL);
5590bd3c071SHeikki Krogerus if (IS_ERR(fwnode)) {
5600bd3c071SHeikki Krogerus put_device(codec_dev);
5610bd3c071SHeikki Krogerus return PTR_ERR(fwnode);
5620bd3c071SHeikki Krogerus }
5630bd3c071SHeikki Krogerus
5640bd3c071SHeikki Krogerus ret = device_add_software_node(codec_dev, to_software_node(fwnode));
5650bd3c071SHeikki Krogerus
5660bd3c071SHeikki Krogerus fwnode_handle_put(fwnode);
5670bd3c071SHeikki Krogerus
568b3df80abSJing Xiangfeng if (ret) {
569b3df80abSJing Xiangfeng put_device(codec_dev);
570ba49cf6fSPaul Cercueil return ret;
571ba49cf6fSPaul Cercueil }
572b3df80abSJing Xiangfeng }
573ba49cf6fSPaul Cercueil
574fe0596a0SPierre-Louis Bossart /* get speaker enable GPIO */
5750d3e91daSHans de Goede devm_acpi_dev_add_driver_gpios(codec_dev, byt_cht_es8316_gpios);
5760d3e91daSHans de Goede priv->speaker_en_gpio =
5774e03b1b7SAndy Shevchenko gpiod_get_optional(codec_dev, "speaker-enable",
5784e03b1b7SAndy Shevchenko /* see comment in byt_cht_es8316_resume() */
5790d3e91daSHans de Goede GPIOD_OUT_LOW | GPIOD_FLAGS_BIT_NONEXCLUSIVE);
5800d3e91daSHans de Goede if (IS_ERR(priv->speaker_en_gpio)) {
581bea03a32SAndy Shevchenko ret = dev_err_probe(dev, PTR_ERR(priv->speaker_en_gpio),
582bea03a32SAndy Shevchenko "get speaker GPIO failed\n");
583c50f126bSPierre-Louis Bossart goto err_put_codec;
5840d3e91daSHans de Goede }
5850d3e91daSHans de Goede
5860d5c8187SJaroslav Kysela snprintf(components_string, sizeof(components_string),
5870d5c8187SJaroslav Kysela "cfg-spk:%s cfg-mic:%s",
5880d5c8187SJaroslav Kysela (quirk & BYT_CHT_ES8316_MONO_SPEAKER) ? "1" : "2",
5890d5c8187SJaroslav Kysela mic_name[BYT_CHT_ES8316_MAP(quirk)]);
5900d5c8187SJaroslav Kysela byt_cht_es8316_card.components = components_string;
591b5706f8eSJaroslav Kysela #if !IS_ENABLED(CONFIG_SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES)
592249d2fc9SHans de Goede snprintf(long_name, sizeof(long_name), "bytcht-es8316-%s-spk-%s-mic",
593249d2fc9SHans de Goede (quirk & BYT_CHT_ES8316_MONO_SPEAKER) ? "mono" : "stereo",
594249d2fc9SHans de Goede mic_name[BYT_CHT_ES8316_MAP(quirk)]);
595249d2fc9SHans de Goede byt_cht_es8316_card.long_name = long_name;
596b5706f8eSJaroslav Kysela #endif
5970d5c8187SJaroslav Kysela
598e8ccf82bSAndy Shevchenko sof_parent = snd_soc_acpi_sof_parent(dev);
59941656c3dSPierre-Louis Bossart
60041656c3dSPierre-Louis Bossart /* set card and driver name */
60141656c3dSPierre-Louis Bossart if (sof_parent) {
60241656c3dSPierre-Louis Bossart byt_cht_es8316_card.name = SOF_CARD_NAME;
60341656c3dSPierre-Louis Bossart byt_cht_es8316_card.driver_name = SOF_DRIVER_NAME;
60441656c3dSPierre-Louis Bossart } else {
60541656c3dSPierre-Louis Bossart byt_cht_es8316_card.name = CARD_NAME;
60641656c3dSPierre-Louis Bossart byt_cht_es8316_card.driver_name = DRIVER_NAME;
60741656c3dSPierre-Louis Bossart }
60841656c3dSPierre-Louis Bossart
60905ff312bSPierre-Louis Bossart /* set pm ops */
61005ff312bSPierre-Louis Bossart if (sof_parent)
61105ff312bSPierre-Louis Bossart dev->driver->pm = &snd_soc_pm_ops;
61205ff312bSPierre-Louis Bossart
6130d5c8187SJaroslav Kysela /* register the soc card */
61486909c8fSHans de Goede snd_soc_card_set_drvdata(&byt_cht_es8316_card, priv);
61586909c8fSHans de Goede
61686909c8fSHans de Goede ret = devm_snd_soc_register_card(dev, &byt_cht_es8316_card);
617a03bdaa5SDaniel Drake if (ret) {
6180d3e91daSHans de Goede gpiod_put(priv->speaker_en_gpio);
61986909c8fSHans de Goede dev_err(dev, "snd_soc_register_card failed: %d\n", ret);
620c50f126bSPierre-Louis Bossart goto err_put_codec;
621a03bdaa5SDaniel Drake }
622a03bdaa5SDaniel Drake platform_set_drvdata(pdev, &byt_cht_es8316_card);
62386909c8fSHans de Goede return 0;
624c50f126bSPierre-Louis Bossart
625c50f126bSPierre-Louis Bossart err_put_codec:
6260bd3c071SHeikki Krogerus device_remove_software_node(priv->codec_dev);
627c50f126bSPierre-Louis Bossart put_device(priv->codec_dev);
628c50f126bSPierre-Louis Bossart return ret;
629a03bdaa5SDaniel Drake }
630a03bdaa5SDaniel Drake
snd_byt_cht_es8316_mc_remove(struct platform_device * pdev)631*9c5b13d5SUwe Kleine-König static void snd_byt_cht_es8316_mc_remove(struct platform_device *pdev)
6320d3e91daSHans de Goede {
633f833fe20SWei Yongjun struct snd_soc_card *card = platform_get_drvdata(pdev);
634f833fe20SWei Yongjun struct byt_cht_es8316_private *priv = snd_soc_card_get_drvdata(card);
6350d3e91daSHans de Goede
6360d3e91daSHans de Goede gpiod_put(priv->speaker_en_gpio);
6370bd3c071SHeikki Krogerus device_remove_software_node(priv->codec_dev);
638c50f126bSPierre-Louis Bossart put_device(priv->codec_dev);
6390d3e91daSHans de Goede }
6400d3e91daSHans de Goede
641a03bdaa5SDaniel Drake static struct platform_driver snd_byt_cht_es8316_mc_driver = {
642a03bdaa5SDaniel Drake .driver = {
643a03bdaa5SDaniel Drake .name = "bytcht_es8316",
644a03bdaa5SDaniel Drake },
645a03bdaa5SDaniel Drake .probe = snd_byt_cht_es8316_mc_probe,
646*9c5b13d5SUwe Kleine-König .remove_new = snd_byt_cht_es8316_mc_remove,
647a03bdaa5SDaniel Drake };
648a03bdaa5SDaniel Drake
649a03bdaa5SDaniel Drake module_platform_driver(snd_byt_cht_es8316_mc_driver);
650a03bdaa5SDaniel Drake MODULE_DESCRIPTION("ASoC Intel(R) Baytrail/Cherrytrail Machine driver");
651a03bdaa5SDaniel Drake MODULE_AUTHOR("David Yang <yangxiaohua@everest-semi.com>");
652a03bdaa5SDaniel Drake MODULE_LICENSE("GPL v2");
653a03bdaa5SDaniel Drake MODULE_ALIAS("platform:bytcht_es8316");
654