1 // SPDX-License-Identifier: GPL-2.0-only
3 * bytcht_es8316.c - ASoc Machine driver for Intel Baytrail/Cherrytrail
4 * platforms with Everest ES8316 SoC
6 * Copyright (C) 2017 Endless Mobile, Inc.
7 * Authors: David Yang <yangxiaohua@everest-semi.com>,
8 * Daniel Drake <drake@endlessm.com>
10 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14 #include <linux/acpi.h>
15 #include <linux/clk.h>
16 #include <linux/device.h>
17 #include <linux/dmi.h>
18 #include <linux/gpio/consumer.h>
19 #include <linux/i2c.h>
20 #include <linux/init.h>
21 #include <linux/input.h>
22 #include <linux/module.h>
23 #include <linux/platform_device.h>
24 #include <linux/slab.h>
25 #include <sound/jack.h>
26 #include <sound/pcm.h>
27 #include <sound/pcm_params.h>
28 #include <sound/soc.h>
29 #include <sound/soc-acpi.h>
30 #include "../atom/sst-atom-controls.h"
31 #include "../common/soc-intel-quirks.h"
33 /* jd-inv + terminating entry */
34 #define MAX_NO_PROPS 2
36 struct byt_cht_es8316_private
{
38 struct snd_soc_jack jack
;
39 struct gpio_desc
*speaker_en_gpio
;
44 BYT_CHT_ES8316_INTMIC_IN1_MAP
,
45 BYT_CHT_ES8316_INTMIC_IN2_MAP
,
48 #define BYT_CHT_ES8316_MAP(quirk) ((quirk) & GENMASK(3, 0))
49 #define BYT_CHT_ES8316_SSP0 BIT(16)
50 #define BYT_CHT_ES8316_MONO_SPEAKER BIT(17)
51 #define BYT_CHT_ES8316_JD_INVERTED BIT(18)
53 static unsigned long quirk
;
55 static int quirk_override
= -1;
56 module_param_named(quirk
, quirk_override
, int, 0444);
57 MODULE_PARM_DESC(quirk
, "Board-specific quirk override");
59 static void log_quirks(struct device
*dev
)
61 if (BYT_CHT_ES8316_MAP(quirk
) == BYT_CHT_ES8316_INTMIC_IN1_MAP
)
62 dev_info(dev
, "quirk IN1_MAP enabled");
63 if (BYT_CHT_ES8316_MAP(quirk
) == BYT_CHT_ES8316_INTMIC_IN2_MAP
)
64 dev_info(dev
, "quirk IN2_MAP enabled");
65 if (quirk
& BYT_CHT_ES8316_SSP0
)
66 dev_info(dev
, "quirk SSP0 enabled");
67 if (quirk
& BYT_CHT_ES8316_MONO_SPEAKER
)
68 dev_info(dev
, "quirk MONO_SPEAKER enabled\n");
69 if (quirk
& BYT_CHT_ES8316_JD_INVERTED
)
70 dev_info(dev
, "quirk JD_INVERTED enabled\n");
73 static int byt_cht_es8316_speaker_power_event(struct snd_soc_dapm_widget
*w
,
74 struct snd_kcontrol
*kcontrol
, int event
)
76 struct snd_soc_card
*card
= w
->dapm
->card
;
77 struct byt_cht_es8316_private
*priv
= snd_soc_card_get_drvdata(card
);
79 if (SND_SOC_DAPM_EVENT_ON(event
))
80 priv
->speaker_en
= true;
82 priv
->speaker_en
= false;
84 gpiod_set_value_cansleep(priv
->speaker_en_gpio
, priv
->speaker_en
);
89 static const struct snd_soc_dapm_widget byt_cht_es8316_widgets
[] = {
90 SND_SOC_DAPM_SPK("Speaker", NULL
),
91 SND_SOC_DAPM_HP("Headphone", NULL
),
92 SND_SOC_DAPM_MIC("Headset Mic", NULL
),
93 SND_SOC_DAPM_MIC("Internal Mic", NULL
),
95 SND_SOC_DAPM_SUPPLY("Speaker Power", SND_SOC_NOPM
, 0, 0,
96 byt_cht_es8316_speaker_power_event
,
97 SND_SOC_DAPM_PRE_PMD
| SND_SOC_DAPM_POST_PMU
),
100 static const struct snd_soc_dapm_route byt_cht_es8316_audio_map
[] = {
101 {"Headphone", NULL
, "HPOL"},
102 {"Headphone", NULL
, "HPOR"},
105 * There is no separate speaker output instead the speakers are muxed to
106 * the HP outputs. The mux is controlled by the "Speaker Power" supply.
108 {"Speaker", NULL
, "HPOL"},
109 {"Speaker", NULL
, "HPOR"},
110 {"Speaker", NULL
, "Speaker Power"},
113 static const struct snd_soc_dapm_route byt_cht_es8316_intmic_in1_map
[] = {
114 {"MIC1", NULL
, "Internal Mic"},
115 {"MIC2", NULL
, "Headset Mic"},
118 static const struct snd_soc_dapm_route byt_cht_es8316_intmic_in2_map
[] = {
119 {"MIC2", NULL
, "Internal Mic"},
120 {"MIC1", NULL
, "Headset Mic"},
123 static const struct snd_soc_dapm_route byt_cht_es8316_ssp0_map
[] = {
124 {"Playback", NULL
, "ssp0 Tx"},
125 {"ssp0 Tx", NULL
, "modem_out"},
126 {"modem_in", NULL
, "ssp0 Rx"},
127 {"ssp0 Rx", NULL
, "Capture"},
130 static const struct snd_soc_dapm_route byt_cht_es8316_ssp2_map
[] = {
131 {"Playback", NULL
, "ssp2 Tx"},
132 {"ssp2 Tx", NULL
, "codec_out0"},
133 {"ssp2 Tx", NULL
, "codec_out1"},
134 {"codec_in0", NULL
, "ssp2 Rx" },
135 {"codec_in1", NULL
, "ssp2 Rx" },
136 {"ssp2 Rx", NULL
, "Capture"},
139 static const struct snd_kcontrol_new byt_cht_es8316_controls
[] = {
140 SOC_DAPM_PIN_SWITCH("Speaker"),
141 SOC_DAPM_PIN_SWITCH("Headphone"),
142 SOC_DAPM_PIN_SWITCH("Headset Mic"),
143 SOC_DAPM_PIN_SWITCH("Internal Mic"),
146 static struct snd_soc_jack_pin byt_cht_es8316_jack_pins
[] = {
149 .mask
= SND_JACK_HEADPHONE
,
152 .pin
= "Headset Mic",
153 .mask
= SND_JACK_MICROPHONE
,
157 static int byt_cht_es8316_init(struct snd_soc_pcm_runtime
*runtime
)
159 struct snd_soc_component
*codec
= asoc_rtd_to_codec(runtime
, 0)->component
;
160 struct snd_soc_card
*card
= runtime
->card
;
161 struct byt_cht_es8316_private
*priv
= snd_soc_card_get_drvdata(card
);
162 const struct snd_soc_dapm_route
*custom_map
;
166 card
->dapm
.idle_bias_off
= true;
168 switch (BYT_CHT_ES8316_MAP(quirk
)) {
169 case BYT_CHT_ES8316_INTMIC_IN1_MAP
:
171 custom_map
= byt_cht_es8316_intmic_in1_map
;
172 num_routes
= ARRAY_SIZE(byt_cht_es8316_intmic_in1_map
);
174 case BYT_CHT_ES8316_INTMIC_IN2_MAP
:
175 custom_map
= byt_cht_es8316_intmic_in2_map
;
176 num_routes
= ARRAY_SIZE(byt_cht_es8316_intmic_in2_map
);
179 ret
= snd_soc_dapm_add_routes(&card
->dapm
, custom_map
, num_routes
);
183 if (quirk
& BYT_CHT_ES8316_SSP0
) {
184 custom_map
= byt_cht_es8316_ssp0_map
;
185 num_routes
= ARRAY_SIZE(byt_cht_es8316_ssp0_map
);
187 custom_map
= byt_cht_es8316_ssp2_map
;
188 num_routes
= ARRAY_SIZE(byt_cht_es8316_ssp2_map
);
190 ret
= snd_soc_dapm_add_routes(&card
->dapm
, custom_map
, num_routes
);
195 * The firmware might enable the clock at boot (this information
196 * may or may not be reflected in the enable clock register).
197 * To change the rate we must disable the clock first to cover these
198 * cases. Due to common clock framework restrictions that do not allow
199 * to disable a clock that has not been enabled, we need to enable
202 ret
= clk_prepare_enable(priv
->mclk
);
204 clk_disable_unprepare(priv
->mclk
);
206 ret
= clk_set_rate(priv
->mclk
, 19200000);
208 dev_err(card
->dev
, "unable to set MCLK rate\n");
210 ret
= clk_prepare_enable(priv
->mclk
);
212 dev_err(card
->dev
, "unable to enable MCLK\n");
214 ret
= snd_soc_dai_set_sysclk(asoc_rtd_to_codec(runtime
, 0), 0, 19200000,
217 dev_err(card
->dev
, "can't set codec clock %d\n", ret
);
221 ret
= snd_soc_card_jack_new(card
, "Headset",
222 SND_JACK_HEADSET
| SND_JACK_BTN_0
,
223 &priv
->jack
, byt_cht_es8316_jack_pins
,
224 ARRAY_SIZE(byt_cht_es8316_jack_pins
));
226 dev_err(card
->dev
, "jack creation failed %d\n", ret
);
230 snd_jack_set_key(priv
->jack
.jack
, SND_JACK_BTN_0
, KEY_PLAYPAUSE
);
231 snd_soc_component_set_jack(codec
, &priv
->jack
, NULL
);
236 static int byt_cht_es8316_codec_fixup(struct snd_soc_pcm_runtime
*rtd
,
237 struct snd_pcm_hw_params
*params
)
239 struct snd_interval
*rate
= hw_param_interval(params
,
240 SNDRV_PCM_HW_PARAM_RATE
);
241 struct snd_interval
*channels
= hw_param_interval(params
,
242 SNDRV_PCM_HW_PARAM_CHANNELS
);
245 /* The DSP will covert the FE rate to 48k, stereo */
246 rate
->min
= rate
->max
= 48000;
247 channels
->min
= channels
->max
= 2;
249 if (quirk
& BYT_CHT_ES8316_SSP0
) {
250 /* set SSP0 to 16-bit */
251 params_set_format(params
, SNDRV_PCM_FORMAT_S16_LE
);
254 /* set SSP2 to 24-bit */
255 params_set_format(params
, SNDRV_PCM_FORMAT_S24_LE
);
260 * Default mode for SSP configuration is TDM 4 slot, override config
261 * with explicit setting to I2S 2ch 24-bit. The word length is set with
262 * dai_set_tdm_slot() since there is no other API exposed
264 ret
= snd_soc_dai_set_fmt(asoc_rtd_to_cpu(rtd
, 0),
266 SND_SOC_DAIFMT_NB_NF
|
267 SND_SOC_DAIFMT_CBS_CFS
270 dev_err(rtd
->dev
, "can't set format to I2S, err %d\n", ret
);
274 ret
= snd_soc_dai_set_tdm_slot(asoc_rtd_to_cpu(rtd
, 0), 0x3, 0x3, 2, bits
);
276 dev_err(rtd
->dev
, "can't set I2S config, err %d\n", ret
);
283 static int byt_cht_es8316_aif1_startup(struct snd_pcm_substream
*substream
)
285 return snd_pcm_hw_constraint_single(substream
->runtime
,
286 SNDRV_PCM_HW_PARAM_RATE
, 48000);
289 static const struct snd_soc_ops byt_cht_es8316_aif1_ops
= {
290 .startup
= byt_cht_es8316_aif1_startup
,
293 SND_SOC_DAILINK_DEF(dummy
,
294 DAILINK_COMP_ARRAY(COMP_DUMMY()));
296 SND_SOC_DAILINK_DEF(media
,
297 DAILINK_COMP_ARRAY(COMP_CPU("media-cpu-dai")));
299 SND_SOC_DAILINK_DEF(deepbuffer
,
300 DAILINK_COMP_ARRAY(COMP_CPU("deepbuffer-cpu-dai")));
302 SND_SOC_DAILINK_DEF(ssp2_port
,
303 DAILINK_COMP_ARRAY(COMP_CPU("ssp2-port")));
304 SND_SOC_DAILINK_DEF(ssp2_codec
,
305 DAILINK_COMP_ARRAY(COMP_CODEC("i2c-ESSX8316:00", "ES8316 HiFi")));
307 SND_SOC_DAILINK_DEF(platform
,
308 DAILINK_COMP_ARRAY(COMP_PLATFORM("sst-mfld-platform")));
310 static struct snd_soc_dai_link byt_cht_es8316_dais
[] = {
311 [MERR_DPCM_AUDIO
] = {
312 .name
= "Audio Port",
313 .stream_name
= "Audio",
318 .ops
= &byt_cht_es8316_aif1_ops
,
319 SND_SOC_DAILINK_REG(media
, dummy
, platform
),
322 [MERR_DPCM_DEEP_BUFFER
] = {
323 .name
= "Deep-Buffer Audio Port",
324 .stream_name
= "Deep-Buffer Audio",
328 .ops
= &byt_cht_es8316_aif1_ops
,
329 SND_SOC_DAILINK_REG(deepbuffer
, dummy
, platform
),
334 /* Only SSP2 has been tested here, so BYT-CR platforms that
335 * require SSP0 will not work.
337 .name
= "SSP2-Codec",
340 .dai_fmt
= SND_SOC_DAIFMT_I2S
| SND_SOC_DAIFMT_NB_NF
341 | SND_SOC_DAIFMT_CBS_CFS
,
342 .be_hw_params_fixup
= byt_cht_es8316_codec_fixup
,
346 .init
= byt_cht_es8316_init
,
347 SND_SOC_DAILINK_REG(ssp2_port
, ssp2_codec
, platform
),
353 static char codec_name
[SND_ACPI_I2C_ID_LEN
];
354 #if !IS_ENABLED(CONFIG_SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES)
355 static char long_name
[50]; /* = "bytcht-es8316-*-spk-*-mic" */
357 static char components_string
[32]; /* = "cfg-spk:* cfg-mic:* */
359 static int byt_cht_es8316_suspend(struct snd_soc_card
*card
)
361 struct snd_soc_component
*component
;
363 for_each_card_components(card
, component
) {
364 if (!strcmp(component
->name
, codec_name
)) {
365 dev_dbg(component
->dev
, "disabling jack detect before suspend\n");
366 snd_soc_component_set_jack(component
, NULL
, NULL
);
374 static int byt_cht_es8316_resume(struct snd_soc_card
*card
)
376 struct byt_cht_es8316_private
*priv
= snd_soc_card_get_drvdata(card
);
377 struct snd_soc_component
*component
;
379 for_each_card_components(card
, component
) {
380 if (!strcmp(component
->name
, codec_name
)) {
381 dev_dbg(component
->dev
, "re-enabling jack detect after resume\n");
382 snd_soc_component_set_jack(component
, &priv
->jack
, NULL
);
388 * Some Cherry Trail boards with an ES8316 codec have a bug in their
389 * ACPI tables where the MSSL1680 touchscreen's _PS0 and _PS3 methods
390 * wrongly also set the speaker-enable GPIO to 1/0. Testing has shown
391 * that this really is a bug and the GPIO has no influence on the
392 * touchscreen at all.
394 * The silead.c touchscreen driver does not support runtime suspend, so
395 * the GPIO can only be changed underneath us during a system suspend.
396 * This resume() function runs from a pm complete() callback, and thus
397 * is guaranteed to run after the touchscreen driver/ACPI-subsys has
398 * brought the touchscreen back up again (and thus changed the GPIO).
400 * So to work around this we pass GPIOD_FLAGS_BIT_NONEXCLUSIVE when
401 * requesting the GPIO and we set its value here to undo any changes
402 * done by the touchscreen's broken _PS0 ACPI method.
404 gpiod_set_value_cansleep(priv
->speaker_en_gpio
, priv
->speaker_en
);
409 /* use space before codec name to simplify card ID, and simplify driver name */
410 #define SOF_CARD_NAME "bytcht es8316" /* card name will be 'sof-bytcht es8316' */
411 #define SOF_DRIVER_NAME "SOF"
413 #define CARD_NAME "bytcht-es8316"
414 #define DRIVER_NAME NULL /* card name will be used for driver name */
416 static struct snd_soc_card byt_cht_es8316_card
= {
417 .owner
= THIS_MODULE
,
418 .dai_link
= byt_cht_es8316_dais
,
419 .num_links
= ARRAY_SIZE(byt_cht_es8316_dais
),
420 .dapm_widgets
= byt_cht_es8316_widgets
,
421 .num_dapm_widgets
= ARRAY_SIZE(byt_cht_es8316_widgets
),
422 .dapm_routes
= byt_cht_es8316_audio_map
,
423 .num_dapm_routes
= ARRAY_SIZE(byt_cht_es8316_audio_map
),
424 .controls
= byt_cht_es8316_controls
,
425 .num_controls
= ARRAY_SIZE(byt_cht_es8316_controls
),
426 .fully_routed
= true,
427 .suspend_pre
= byt_cht_es8316_suspend
,
428 .resume_post
= byt_cht_es8316_resume
,
431 static const struct acpi_gpio_params first_gpio
= { 0, 0, false };
433 static const struct acpi_gpio_mapping byt_cht_es8316_gpios
[] = {
434 { "speaker-enable-gpios", &first_gpio
, 1 },
438 /* Please keep this list alphabetically sorted */
439 static const struct dmi_system_id byt_cht_es8316_quirk_table
[] = {
442 DMI_MATCH(DMI_SYS_VENDOR
, "IRBIS"),
443 DMI_MATCH(DMI_PRODUCT_NAME
, "NB41"),
445 .driver_data
= (void *)(BYT_CHT_ES8316_SSP0
446 | BYT_CHT_ES8316_INTMIC_IN2_MAP
447 | BYT_CHT_ES8316_JD_INVERTED
),
449 { /* Teclast X98 Plus II */
451 DMI_MATCH(DMI_SYS_VENDOR
, "TECLAST"),
452 DMI_MATCH(DMI_PRODUCT_NAME
, "X98 Plus II"),
454 .driver_data
= (void *)(BYT_CHT_ES8316_INTMIC_IN1_MAP
455 | BYT_CHT_ES8316_JD_INVERTED
),
460 static int snd_byt_cht_es8316_mc_probe(struct platform_device
*pdev
)
462 static const char * const mic_name
[] = { "in1", "in2" };
463 struct property_entry props
[MAX_NO_PROPS
] = {};
464 struct byt_cht_es8316_private
*priv
;
465 const struct dmi_system_id
*dmi_id
;
466 struct device
*dev
= &pdev
->dev
;
467 struct snd_soc_acpi_mach
*mach
;
468 const char *platform_name
;
469 struct acpi_device
*adev
;
470 struct device
*codec_dev
;
472 unsigned int cnt
= 0;
477 priv
= devm_kzalloc(dev
, sizeof(*priv
), GFP_KERNEL
);
481 mach
= dev
->platform_data
;
482 /* fix index of codec dai */
483 for (i
= 0; i
< ARRAY_SIZE(byt_cht_es8316_dais
); i
++) {
484 if (!strcmp(byt_cht_es8316_dais
[i
].codecs
->name
,
485 "i2c-ESSX8316:00")) {
491 /* fixup codec name based on HID */
492 adev
= acpi_dev_get_first_match_dev(mach
->id
, NULL
, -1);
494 snprintf(codec_name
, sizeof(codec_name
),
495 "i2c-%s", acpi_dev_name(adev
));
496 put_device(&adev
->dev
);
497 byt_cht_es8316_dais
[dai_index
].codecs
->name
= codec_name
;
500 /* override plaform name, if required */
501 byt_cht_es8316_card
.dev
= dev
;
502 platform_name
= mach
->mach_params
.platform
;
504 ret
= snd_soc_fixup_dai_links_platform_name(&byt_cht_es8316_card
,
509 /* Check for BYTCR or other platform and setup quirks */
510 dmi_id
= dmi_first_match(byt_cht_es8316_quirk_table
);
512 quirk
= (unsigned long)dmi_id
->driver_data
;
513 } else if (soc_intel_is_byt() &&
514 mach
->mach_params
.acpi_ipc_irq_index
== 0) {
515 /* On BYTCR default to SSP0, internal-mic-in2-map, mono-spk */
516 quirk
= BYT_CHT_ES8316_SSP0
| BYT_CHT_ES8316_INTMIC_IN2_MAP
|
517 BYT_CHT_ES8316_MONO_SPEAKER
;
519 /* Others default to internal-mic-in1-map, mono-speaker */
520 quirk
= BYT_CHT_ES8316_INTMIC_IN1_MAP
|
521 BYT_CHT_ES8316_MONO_SPEAKER
;
523 if (quirk_override
!= -1) {
524 dev_info(dev
, "Overriding quirk 0x%lx => 0x%x\n",
525 quirk
, quirk_override
);
526 quirk
= quirk_override
;
530 if (quirk
& BYT_CHT_ES8316_SSP0
)
531 byt_cht_es8316_dais
[dai_index
].cpus
->dai_name
= "ssp0-port";
534 priv
->mclk
= devm_clk_get(dev
, "pmc_plt_clk_3");
535 if (IS_ERR(priv
->mclk
)) {
536 ret
= PTR_ERR(priv
->mclk
);
537 dev_err(dev
, "clk_get pmc_plt_clk_3 failed: %d\n", ret
);
541 /* get speaker enable GPIO */
542 codec_dev
= bus_find_device_by_name(&i2c_bus_type
, NULL
, codec_name
);
544 return -EPROBE_DEFER
;
546 if (quirk
& BYT_CHT_ES8316_JD_INVERTED
)
547 props
[cnt
++] = PROPERTY_ENTRY_BOOL("everest,jack-detect-inverted");
550 ret
= device_add_properties(codec_dev
, props
);
552 put_device(codec_dev
);
557 devm_acpi_dev_add_driver_gpios(codec_dev
, byt_cht_es8316_gpios
);
558 priv
->speaker_en_gpio
=
559 gpiod_get_index(codec_dev
, "speaker-enable", 0,
560 /* see comment in byt_cht_es8316_resume */
561 GPIOD_OUT_LOW
| GPIOD_FLAGS_BIT_NONEXCLUSIVE
);
562 put_device(codec_dev
);
564 if (IS_ERR(priv
->speaker_en_gpio
)) {
565 ret
= PTR_ERR(priv
->speaker_en_gpio
);
568 priv
->speaker_en_gpio
= NULL
;
571 dev_err(dev
, "get speaker GPIO failed: %d\n", ret
);
578 snprintf(components_string
, sizeof(components_string
),
579 "cfg-spk:%s cfg-mic:%s",
580 (quirk
& BYT_CHT_ES8316_MONO_SPEAKER
) ? "1" : "2",
581 mic_name
[BYT_CHT_ES8316_MAP(quirk
)]);
582 byt_cht_es8316_card
.components
= components_string
;
583 #if !IS_ENABLED(CONFIG_SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES)
584 snprintf(long_name
, sizeof(long_name
), "bytcht-es8316-%s-spk-%s-mic",
585 (quirk
& BYT_CHT_ES8316_MONO_SPEAKER
) ? "mono" : "stereo",
586 mic_name
[BYT_CHT_ES8316_MAP(quirk
)]);
587 byt_cht_es8316_card
.long_name
= long_name
;
590 sof_parent
= snd_soc_acpi_sof_parent(&pdev
->dev
);
592 /* set card and driver name */
594 byt_cht_es8316_card
.name
= SOF_CARD_NAME
;
595 byt_cht_es8316_card
.driver_name
= SOF_DRIVER_NAME
;
597 byt_cht_es8316_card
.name
= CARD_NAME
;
598 byt_cht_es8316_card
.driver_name
= DRIVER_NAME
;
603 dev
->driver
->pm
= &snd_soc_pm_ops
;
605 /* register the soc card */
606 snd_soc_card_set_drvdata(&byt_cht_es8316_card
, priv
);
608 ret
= devm_snd_soc_register_card(dev
, &byt_cht_es8316_card
);
610 gpiod_put(priv
->speaker_en_gpio
);
611 dev_err(dev
, "snd_soc_register_card failed: %d\n", ret
);
614 platform_set_drvdata(pdev
, &byt_cht_es8316_card
);
618 static int snd_byt_cht_es8316_mc_remove(struct platform_device
*pdev
)
620 struct snd_soc_card
*card
= platform_get_drvdata(pdev
);
621 struct byt_cht_es8316_private
*priv
= snd_soc_card_get_drvdata(card
);
623 gpiod_put(priv
->speaker_en_gpio
);
627 static struct platform_driver snd_byt_cht_es8316_mc_driver
= {
629 .name
= "bytcht_es8316",
631 .probe
= snd_byt_cht_es8316_mc_probe
,
632 .remove
= snd_byt_cht_es8316_mc_remove
,
635 module_platform_driver(snd_byt_cht_es8316_mc_driver
);
636 MODULE_DESCRIPTION("ASoC Intel(R) Baytrail/Cherrytrail Machine driver");
637 MODULE_AUTHOR("David Yang <yangxiaohua@everest-semi.com>");
638 MODULE_LICENSE("GPL v2");
639 MODULE_ALIAS("platform:bytcht_es8316");