treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / sound / soc / intel / boards / glk_rt5682_max98357a.c
blob4a6d117ea7af766d5dbcf1fb3132a6a3cb5ae507
1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright(c) 2018 Intel Corporation.
4 /*
5 * Intel Geminilake I2S Machine Driver with MAX98357A & RT5682 Codecs
7 * Modified from:
8 * Intel Apollolake I2S Machine driver
9 */
11 #include <linux/input.h>
12 #include <linux/module.h>
13 #include <linux/platform_device.h>
14 #include <sound/core.h>
15 #include <sound/jack.h>
16 #include <sound/pcm.h>
17 #include <sound/pcm_params.h>
18 #include <sound/soc.h>
19 #include <sound/soc-acpi.h>
20 #include "../../codecs/rt5682.h"
21 #include "../../codecs/hdac_hdmi.h"
22 #include "hda_dsp_common.h"
24 /* The platform clock outputs 19.2Mhz clock to codec as I2S MCLK */
25 #define GLK_PLAT_CLK_FREQ 19200000
26 #define RT5682_PLL_FREQ (48000 * 512)
27 #define GLK_REALTEK_CODEC_DAI "rt5682-aif1"
28 #define GLK_MAXIM_CODEC_DAI "HiFi"
29 #define MAXIM_DEV0_NAME "MX98357A:00"
30 #define DUAL_CHANNEL 2
31 #define QUAD_CHANNEL 4
32 #define NAME_SIZE 32
34 static struct snd_soc_jack geminilake_hdmi[3];
36 struct glk_hdmi_pcm {
37 struct list_head head;
38 struct snd_soc_dai *codec_dai;
39 int device;
42 struct glk_card_private {
43 struct snd_soc_jack geminilake_headset;
44 struct list_head hdmi_pcm_list;
45 bool common_hdmi_codec_drv;
48 enum {
49 GLK_DPCM_AUDIO_PB = 0,
50 GLK_DPCM_AUDIO_CP,
51 GLK_DPCM_AUDIO_HS_PB,
52 GLK_DPCM_AUDIO_ECHO_REF_CP,
53 GLK_DPCM_AUDIO_REF_CP,
54 GLK_DPCM_AUDIO_DMIC_CP,
55 GLK_DPCM_AUDIO_HDMI1_PB,
56 GLK_DPCM_AUDIO_HDMI2_PB,
57 GLK_DPCM_AUDIO_HDMI3_PB,
60 static const struct snd_kcontrol_new geminilake_controls[] = {
61 SOC_DAPM_PIN_SWITCH("Headphone Jack"),
62 SOC_DAPM_PIN_SWITCH("Headset Mic"),
63 SOC_DAPM_PIN_SWITCH("Spk"),
66 static const struct snd_soc_dapm_widget geminilake_widgets[] = {
67 SND_SOC_DAPM_HP("Headphone Jack", NULL),
68 SND_SOC_DAPM_MIC("Headset Mic", NULL),
69 SND_SOC_DAPM_SPK("Spk", NULL),
70 SND_SOC_DAPM_MIC("SoC DMIC", NULL),
71 SND_SOC_DAPM_SPK("HDMI1", NULL),
72 SND_SOC_DAPM_SPK("HDMI2", NULL),
73 SND_SOC_DAPM_SPK("HDMI3", NULL),
76 static const struct snd_soc_dapm_route geminilake_map[] = {
77 /* HP jack connectors - unknown if we have jack detection */
78 { "Headphone Jack", NULL, "HPOL" },
79 { "Headphone Jack", NULL, "HPOR" },
81 /* speaker */
82 { "Spk", NULL, "Speaker" },
84 /* other jacks */
85 { "IN1P", NULL, "Headset Mic" },
87 /* digital mics */
88 { "DMic", NULL, "SoC DMIC" },
90 /* CODEC BE connections */
91 { "HiFi Playback", NULL, "ssp1 Tx" },
92 { "ssp1 Tx", NULL, "codec0_out" },
94 { "AIF1 Playback", NULL, "ssp2 Tx" },
95 { "ssp2 Tx", NULL, "codec1_out" },
97 { "codec0_in", NULL, "ssp2 Rx" },
98 { "ssp2 Rx", NULL, "AIF1 Capture" },
100 { "HDMI1", NULL, "hif5-0 Output" },
101 { "HDMI2", NULL, "hif6-0 Output" },
102 { "HDMI2", NULL, "hif7-0 Output" },
104 { "hifi3", NULL, "iDisp3 Tx" },
105 { "iDisp3 Tx", NULL, "iDisp3_out" },
106 { "hifi2", NULL, "iDisp2 Tx" },
107 { "iDisp2 Tx", NULL, "iDisp2_out" },
108 { "hifi1", NULL, "iDisp1 Tx" },
109 { "iDisp1 Tx", NULL, "iDisp1_out" },
111 /* DMIC */
112 { "dmic01_hifi", NULL, "DMIC01 Rx" },
113 { "DMIC01 Rx", NULL, "DMIC AIF" },
116 static int geminilake_ssp_fixup(struct snd_soc_pcm_runtime *rtd,
117 struct snd_pcm_hw_params *params)
119 struct snd_interval *rate = hw_param_interval(params,
120 SNDRV_PCM_HW_PARAM_RATE);
121 struct snd_interval *chan = hw_param_interval(params,
122 SNDRV_PCM_HW_PARAM_CHANNELS);
123 struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
125 /* The ADSP will convert the FE rate to 48k, stereo */
126 rate->min = rate->max = 48000;
127 chan->min = chan->max = DUAL_CHANNEL;
129 /* set SSP to 24 bit */
130 snd_mask_none(fmt);
131 snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE);
133 return 0;
136 static int geminilake_rt5682_codec_init(struct snd_soc_pcm_runtime *rtd)
138 struct glk_card_private *ctx = snd_soc_card_get_drvdata(rtd->card);
139 struct snd_soc_component *component = rtd->codec_dai->component;
140 struct snd_soc_dai *codec_dai = rtd->codec_dai;
141 struct snd_soc_jack *jack;
142 int ret;
144 ret = snd_soc_dai_set_pll(codec_dai, 0, RT5682_PLL1_S_MCLK,
145 GLK_PLAT_CLK_FREQ, RT5682_PLL_FREQ);
146 if (ret < 0) {
147 dev_err(rtd->dev, "can't set codec pll: %d\n", ret);
148 return ret;
151 /* Configure sysclk for codec */
152 ret = snd_soc_dai_set_sysclk(codec_dai, RT5682_SCLK_S_PLL1,
153 RT5682_PLL_FREQ, SND_SOC_CLOCK_IN);
154 if (ret < 0)
155 dev_err(rtd->dev, "snd_soc_dai_set_sysclk err = %d\n", ret);
158 * Headset buttons map to the google Reference headset.
159 * These can be configured by userspace.
161 ret = snd_soc_card_jack_new(rtd->card, "Headset Jack",
162 SND_JACK_HEADSET | SND_JACK_BTN_0 | SND_JACK_BTN_1 |
163 SND_JACK_BTN_2 | SND_JACK_BTN_3 | SND_JACK_LINEOUT,
164 &ctx->geminilake_headset, NULL, 0);
165 if (ret) {
166 dev_err(rtd->dev, "Headset Jack creation failed: %d\n", ret);
167 return ret;
170 jack = &ctx->geminilake_headset;
172 snd_jack_set_key(jack->jack, SND_JACK_BTN_0, KEY_PLAYPAUSE);
173 snd_jack_set_key(jack->jack, SND_JACK_BTN_1, KEY_VOICECOMMAND);
174 snd_jack_set_key(jack->jack, SND_JACK_BTN_2, KEY_VOLUMEUP);
175 snd_jack_set_key(jack->jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN);
177 ret = snd_soc_component_set_jack(component, jack, NULL);
179 if (ret) {
180 dev_err(rtd->dev, "Headset Jack call-back failed: %d\n", ret);
181 return ret;
184 return ret;
187 static int geminilake_rt5682_hw_params(struct snd_pcm_substream *substream,
188 struct snd_pcm_hw_params *params)
190 struct snd_soc_pcm_runtime *rtd = substream->private_data;
191 struct snd_soc_dai *codec_dai = rtd->codec_dai;
192 int ret;
194 /* Set valid bitmask & configuration for I2S in 24 bit */
195 ret = snd_soc_dai_set_tdm_slot(codec_dai, 0x0, 0x0, 2, 24);
196 if (ret < 0) {
197 dev_err(rtd->dev, "set TDM slot err:%d\n", ret);
198 return ret;
201 return ret;
204 static struct snd_soc_ops geminilake_rt5682_ops = {
205 .hw_params = geminilake_rt5682_hw_params,
208 static int geminilake_hdmi_init(struct snd_soc_pcm_runtime *rtd)
210 struct glk_card_private *ctx = snd_soc_card_get_drvdata(rtd->card);
211 struct snd_soc_dai *dai = rtd->codec_dai;
212 struct glk_hdmi_pcm *pcm;
214 pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
215 if (!pcm)
216 return -ENOMEM;
218 pcm->device = GLK_DPCM_AUDIO_HDMI1_PB + dai->id;
219 pcm->codec_dai = dai;
221 list_add_tail(&pcm->head, &ctx->hdmi_pcm_list);
223 return 0;
226 static int geminilake_rt5682_fe_init(struct snd_soc_pcm_runtime *rtd)
228 struct snd_soc_component *component = rtd->cpu_dai->component;
229 struct snd_soc_dapm_context *dapm;
230 int ret;
232 dapm = snd_soc_component_get_dapm(component);
233 ret = snd_soc_dapm_ignore_suspend(dapm, "Reference Capture");
234 if (ret) {
235 dev_err(rtd->dev, "Ref Cap ignore suspend failed %d\n", ret);
236 return ret;
239 return ret;
242 static const unsigned int rates[] = {
243 48000,
246 static const struct snd_pcm_hw_constraint_list constraints_rates = {
247 .count = ARRAY_SIZE(rates),
248 .list = rates,
249 .mask = 0,
252 static unsigned int channels_quad[] = {
253 QUAD_CHANNEL,
256 static struct snd_pcm_hw_constraint_list constraints_channels_quad = {
257 .count = ARRAY_SIZE(channels_quad),
258 .list = channels_quad,
259 .mask = 0,
262 static int geminilake_dmic_fixup(struct snd_soc_pcm_runtime *rtd,
263 struct snd_pcm_hw_params *params)
265 struct snd_interval *chan = hw_param_interval(params,
266 SNDRV_PCM_HW_PARAM_CHANNELS);
269 * set BE channel constraint as user FE channels
271 chan->min = chan->max = 4;
273 return 0;
276 static int geminilake_dmic_startup(struct snd_pcm_substream *substream)
278 struct snd_pcm_runtime *runtime = substream->runtime;
280 runtime->hw.channels_min = runtime->hw.channels_max = QUAD_CHANNEL;
281 snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
282 &constraints_channels_quad);
284 return snd_pcm_hw_constraint_list(substream->runtime, 0,
285 SNDRV_PCM_HW_PARAM_RATE, &constraints_rates);
288 static const struct snd_soc_ops geminilake_dmic_ops = {
289 .startup = geminilake_dmic_startup,
292 static const unsigned int rates_16000[] = {
293 16000,
296 static const struct snd_pcm_hw_constraint_list constraints_16000 = {
297 .count = ARRAY_SIZE(rates_16000),
298 .list = rates_16000,
301 static int geminilake_refcap_startup(struct snd_pcm_substream *substream)
303 return snd_pcm_hw_constraint_list(substream->runtime, 0,
304 SNDRV_PCM_HW_PARAM_RATE,
305 &constraints_16000);
308 static const struct snd_soc_ops geminilake_refcap_ops = {
309 .startup = geminilake_refcap_startup,
312 SND_SOC_DAILINK_DEF(dummy,
313 DAILINK_COMP_ARRAY(COMP_DUMMY()));
315 SND_SOC_DAILINK_DEF(system,
316 DAILINK_COMP_ARRAY(COMP_CPU("System Pin")));
318 SND_SOC_DAILINK_DEF(system2,
319 DAILINK_COMP_ARRAY(COMP_CPU("System Pin2")));
321 SND_SOC_DAILINK_DEF(echoref,
322 DAILINK_COMP_ARRAY(COMP_CPU("Echoref Pin")));
324 SND_SOC_DAILINK_DEF(reference,
325 DAILINK_COMP_ARRAY(COMP_CPU("Reference Pin")));
327 SND_SOC_DAILINK_DEF(dmic,
328 DAILINK_COMP_ARRAY(COMP_CPU("DMIC Pin")));
330 SND_SOC_DAILINK_DEF(hdmi1,
331 DAILINK_COMP_ARRAY(COMP_CPU("HDMI1 Pin")));
333 SND_SOC_DAILINK_DEF(hdmi2,
334 DAILINK_COMP_ARRAY(COMP_CPU("HDMI2 Pin")));
336 SND_SOC_DAILINK_DEF(hdmi3,
337 DAILINK_COMP_ARRAY(COMP_CPU("HDMI3 Pin")));
339 SND_SOC_DAILINK_DEF(ssp1_pin,
340 DAILINK_COMP_ARRAY(COMP_CPU("SSP1 Pin")));
341 SND_SOC_DAILINK_DEF(ssp1_codec,
342 DAILINK_COMP_ARRAY(COMP_CODEC(MAXIM_DEV0_NAME,
343 GLK_MAXIM_CODEC_DAI)));
345 SND_SOC_DAILINK_DEF(ssp2_pin,
346 DAILINK_COMP_ARRAY(COMP_CPU("SSP2 Pin")));
347 SND_SOC_DAILINK_DEF(ssp2_codec,
348 DAILINK_COMP_ARRAY(COMP_CODEC("i2c-10EC5682:00",
349 GLK_REALTEK_CODEC_DAI)));
351 SND_SOC_DAILINK_DEF(dmic_pin,
352 DAILINK_COMP_ARRAY(COMP_CPU("DMIC01 Pin")));
353 SND_SOC_DAILINK_DEF(dmic_codec,
354 DAILINK_COMP_ARRAY(COMP_CODEC("dmic-codec", "dmic-hifi")));
356 SND_SOC_DAILINK_DEF(idisp1_pin,
357 DAILINK_COMP_ARRAY(COMP_CPU("iDisp1 Pin")));
358 SND_SOC_DAILINK_DEF(idisp1_codec,
359 DAILINK_COMP_ARRAY(COMP_CODEC("ehdaudio0D2", "intel-hdmi-hifi1")));
361 SND_SOC_DAILINK_DEF(idisp2_pin,
362 DAILINK_COMP_ARRAY(COMP_CPU("iDisp2 Pin")));
363 SND_SOC_DAILINK_DEF(idisp2_codec,
364 DAILINK_COMP_ARRAY(COMP_CODEC("ehdaudio0D2", "intel-hdmi-hifi2")));
366 SND_SOC_DAILINK_DEF(idisp3_pin,
367 DAILINK_COMP_ARRAY(COMP_CPU("iDisp3 Pin")));
368 SND_SOC_DAILINK_DEF(idisp3_codec,
369 DAILINK_COMP_ARRAY(COMP_CODEC("ehdaudio0D2", "intel-hdmi-hifi3")));
371 SND_SOC_DAILINK_DEF(platform,
372 DAILINK_COMP_ARRAY(COMP_PLATFORM("0000:00:0e.0")));
374 /* geminilake digital audio interface glue - connects codec <--> CPU */
375 static struct snd_soc_dai_link geminilake_dais[] = {
376 /* Front End DAI links */
377 [GLK_DPCM_AUDIO_PB] = {
378 .name = "Glk Audio Port",
379 .stream_name = "Audio",
380 .dynamic = 1,
381 .nonatomic = 1,
382 .init = geminilake_rt5682_fe_init,
383 .trigger = {
384 SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
385 .dpcm_playback = 1,
386 SND_SOC_DAILINK_REG(system, dummy, platform),
388 [GLK_DPCM_AUDIO_CP] = {
389 .name = "Glk Audio Capture Port",
390 .stream_name = "Audio Record",
391 .dynamic = 1,
392 .nonatomic = 1,
393 .trigger = {
394 SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
395 .dpcm_capture = 1,
396 SND_SOC_DAILINK_REG(system, dummy, platform),
398 [GLK_DPCM_AUDIO_HS_PB] = {
399 .name = "Glk Audio Headset Playback",
400 .stream_name = "Headset Audio",
401 .dpcm_playback = 1,
402 .nonatomic = 1,
403 .dynamic = 1,
404 SND_SOC_DAILINK_REG(system2, dummy, platform),
406 [GLK_DPCM_AUDIO_ECHO_REF_CP] = {
407 .name = "Glk Audio Echo Reference cap",
408 .stream_name = "Echoreference Capture",
409 .init = NULL,
410 .capture_only = 1,
411 .nonatomic = 1,
412 SND_SOC_DAILINK_REG(echoref, dummy, platform),
414 [GLK_DPCM_AUDIO_REF_CP] = {
415 .name = "Glk Audio Reference cap",
416 .stream_name = "Refcap",
417 .init = NULL,
418 .dpcm_capture = 1,
419 .nonatomic = 1,
420 .dynamic = 1,
421 .ops = &geminilake_refcap_ops,
422 SND_SOC_DAILINK_REG(reference, dummy, platform),
424 [GLK_DPCM_AUDIO_DMIC_CP] = {
425 .name = "Glk Audio DMIC cap",
426 .stream_name = "dmiccap",
427 .init = NULL,
428 .dpcm_capture = 1,
429 .nonatomic = 1,
430 .dynamic = 1,
431 .ops = &geminilake_dmic_ops,
432 SND_SOC_DAILINK_REG(dmic, dummy, platform),
434 [GLK_DPCM_AUDIO_HDMI1_PB] = {
435 .name = "Glk HDMI Port1",
436 .stream_name = "Hdmi1",
437 .dpcm_playback = 1,
438 .init = NULL,
439 .trigger = {
440 SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
441 .nonatomic = 1,
442 .dynamic = 1,
443 SND_SOC_DAILINK_REG(hdmi1, dummy, platform),
445 [GLK_DPCM_AUDIO_HDMI2_PB] = {
446 .name = "Glk HDMI Port2",
447 .stream_name = "Hdmi2",
448 .dpcm_playback = 1,
449 .init = NULL,
450 .trigger = {
451 SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
452 .nonatomic = 1,
453 .dynamic = 1,
454 SND_SOC_DAILINK_REG(hdmi2, dummy, platform),
456 [GLK_DPCM_AUDIO_HDMI3_PB] = {
457 .name = "Glk HDMI Port3",
458 .stream_name = "Hdmi3",
459 .trigger = {
460 SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
461 .dpcm_playback = 1,
462 .init = NULL,
463 .nonatomic = 1,
464 .dynamic = 1,
465 SND_SOC_DAILINK_REG(hdmi3, dummy, platform),
467 /* Back End DAI links */
469 /* SSP1 - Codec */
470 .name = "SSP1-Codec",
471 .id = 0,
472 .no_pcm = 1,
473 .dai_fmt = SND_SOC_DAIFMT_I2S |
474 SND_SOC_DAIFMT_NB_NF |
475 SND_SOC_DAIFMT_CBS_CFS,
476 .ignore_pmdown_time = 1,
477 .be_hw_params_fixup = geminilake_ssp_fixup,
478 .dpcm_playback = 1,
479 SND_SOC_DAILINK_REG(ssp1_pin, ssp1_codec, platform),
482 /* SSP2 - Codec */
483 .name = "SSP2-Codec",
484 .id = 1,
485 .no_pcm = 1,
486 .init = geminilake_rt5682_codec_init,
487 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
488 SND_SOC_DAIFMT_CBS_CFS,
489 .ignore_pmdown_time = 1,
490 .be_hw_params_fixup = geminilake_ssp_fixup,
491 .ops = &geminilake_rt5682_ops,
492 .dpcm_playback = 1,
493 .dpcm_capture = 1,
494 SND_SOC_DAILINK_REG(ssp2_pin, ssp2_codec, platform),
497 .name = "dmic01",
498 .id = 2,
499 .ignore_suspend = 1,
500 .be_hw_params_fixup = geminilake_dmic_fixup,
501 .dpcm_capture = 1,
502 .no_pcm = 1,
503 SND_SOC_DAILINK_REG(dmic_pin, dmic_codec, platform),
506 .name = "iDisp1",
507 .id = 3,
508 .init = geminilake_hdmi_init,
509 .dpcm_playback = 1,
510 .no_pcm = 1,
511 SND_SOC_DAILINK_REG(idisp1_pin, idisp1_codec, platform),
514 .name = "iDisp2",
515 .id = 4,
516 .init = geminilake_hdmi_init,
517 .dpcm_playback = 1,
518 .no_pcm = 1,
519 SND_SOC_DAILINK_REG(idisp2_pin, idisp2_codec, platform),
522 .name = "iDisp3",
523 .id = 5,
524 .init = geminilake_hdmi_init,
525 .dpcm_playback = 1,
526 .no_pcm = 1,
527 SND_SOC_DAILINK_REG(idisp3_pin, idisp3_codec, platform),
531 static int glk_card_late_probe(struct snd_soc_card *card)
533 struct glk_card_private *ctx = snd_soc_card_get_drvdata(card);
534 struct snd_soc_component *component = NULL;
535 char jack_name[NAME_SIZE];
536 struct glk_hdmi_pcm *pcm;
537 int err = 0;
538 int i = 0;
540 pcm = list_first_entry(&ctx->hdmi_pcm_list, struct glk_hdmi_pcm,
541 head);
542 component = pcm->codec_dai->component;
544 if (ctx->common_hdmi_codec_drv)
545 return hda_dsp_hdmi_build_controls(card, component);
547 list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) {
548 component = pcm->codec_dai->component;
549 snprintf(jack_name, sizeof(jack_name),
550 "HDMI/DP, pcm=%d Jack", pcm->device);
551 err = snd_soc_card_jack_new(card, jack_name,
552 SND_JACK_AVOUT, &geminilake_hdmi[i],
553 NULL, 0);
555 if (err)
556 return err;
558 err = hdac_hdmi_jack_init(pcm->codec_dai, pcm->device,
559 &geminilake_hdmi[i]);
560 if (err < 0)
561 return err;
563 i++;
566 if (!component)
567 return -EINVAL;
569 return hdac_hdmi_jack_port_init(component, &card->dapm);
572 /* geminilake audio machine driver for SPT + RT5682 */
573 static struct snd_soc_card glk_audio_card_rt5682_m98357a = {
574 .name = "glkrt5682max",
575 .owner = THIS_MODULE,
576 .dai_link = geminilake_dais,
577 .num_links = ARRAY_SIZE(geminilake_dais),
578 .controls = geminilake_controls,
579 .num_controls = ARRAY_SIZE(geminilake_controls),
580 .dapm_widgets = geminilake_widgets,
581 .num_dapm_widgets = ARRAY_SIZE(geminilake_widgets),
582 .dapm_routes = geminilake_map,
583 .num_dapm_routes = ARRAY_SIZE(geminilake_map),
584 .fully_routed = true,
585 .late_probe = glk_card_late_probe,
588 static int geminilake_audio_probe(struct platform_device *pdev)
590 struct glk_card_private *ctx;
591 struct snd_soc_acpi_mach *mach;
592 const char *platform_name;
593 struct snd_soc_card *card;
594 int ret;
596 ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
597 if (!ctx)
598 return -ENOMEM;
600 INIT_LIST_HEAD(&ctx->hdmi_pcm_list);
602 card = &glk_audio_card_rt5682_m98357a;
603 card->dev = &pdev->dev;
604 snd_soc_card_set_drvdata(card, ctx);
606 /* override plaform name, if required */
607 mach = (&pdev->dev)->platform_data;
608 platform_name = mach->mach_params.platform;
610 ret = snd_soc_fixup_dai_links_platform_name(card, platform_name);
611 if (ret)
612 return ret;
614 ctx->common_hdmi_codec_drv = mach->mach_params.common_hdmi_codec_drv;
616 return devm_snd_soc_register_card(&pdev->dev, card);
619 static const struct platform_device_id glk_board_ids[] = {
621 .name = "glk_rt5682_max98357a",
622 .driver_data =
623 (kernel_ulong_t)&glk_audio_card_rt5682_m98357a,
628 static struct platform_driver geminilake_audio = {
629 .probe = geminilake_audio_probe,
630 .driver = {
631 .name = "glk_rt5682_max98357a",
632 .pm = &snd_soc_pm_ops,
634 .id_table = glk_board_ids,
636 module_platform_driver(geminilake_audio)
638 /* Module information */
639 MODULE_DESCRIPTION("Geminilake Audio Machine driver-RT5682 & MAX98357A in I2S mode");
640 MODULE_AUTHOR("Naveen Manohar <naveen.m@intel.com>");
641 MODULE_AUTHOR("Harsha Priya <harshapriya.n@intel.com>");
642 MODULE_LICENSE("GPL v2");
643 MODULE_ALIAS("platform:glk_rt5682_max98357a");