bxt_da7219_max98357a.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616
  1. /*
  2. * Intel Broxton-P I2S Machine Driver
  3. *
  4. * Copyright (C) 2016, Intel Corporation. All rights reserved.
  5. *
  6. * Modified from:
  7. * Intel Skylake I2S Machine driver
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License version
  11. * 2 as published by the Free Software Foundation.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. */
  18. #include <linux/module.h>
  19. #include <linux/platform_device.h>
  20. #include <sound/core.h>
  21. #include <sound/jack.h>
  22. #include <sound/pcm.h>
  23. #include <sound/pcm_params.h>
  24. #include <sound/soc.h>
  25. #include "../../codecs/hdac_hdmi.h"
  26. #include "../../codecs/da7219.h"
  27. #include "../../codecs/da7219-aad.h"
  28. #define BXT_DIALOG_CODEC_DAI "da7219-hifi"
  29. #define BXT_MAXIM_CODEC_DAI "HiFi"
  30. #define DUAL_CHANNEL 2
  31. #define QUAD_CHANNEL 4
  32. static struct snd_soc_jack broxton_headset;
  33. static struct snd_soc_jack broxton_hdmi[3];
  34. struct bxt_hdmi_pcm {
  35. struct list_head head;
  36. struct snd_soc_dai *codec_dai;
  37. int device;
  38. };
  39. struct bxt_card_private {
  40. struct list_head hdmi_pcm_list;
  41. };
  42. enum {
  43. BXT_DPCM_AUDIO_PB = 0,
  44. BXT_DPCM_AUDIO_CP,
  45. BXT_DPCM_AUDIO_REF_CP,
  46. BXT_DPCM_AUDIO_DMIC_CP,
  47. BXT_DPCM_AUDIO_HDMI1_PB,
  48. BXT_DPCM_AUDIO_HDMI2_PB,
  49. BXT_DPCM_AUDIO_HDMI3_PB,
  50. };
  51. static int platform_clock_control(struct snd_soc_dapm_widget *w,
  52. struct snd_kcontrol *k, int event)
  53. {
  54. int ret = 0;
  55. struct snd_soc_dapm_context *dapm = w->dapm;
  56. struct snd_soc_card *card = dapm->card;
  57. struct snd_soc_dai *codec_dai;
  58. codec_dai = snd_soc_card_get_codec_dai(card, BXT_DIALOG_CODEC_DAI);
  59. if (!codec_dai) {
  60. dev_err(card->dev, "Codec dai not found; Unable to set/unset codec pll\n");
  61. return -EIO;
  62. }
  63. if (SND_SOC_DAPM_EVENT_OFF(event)) {
  64. ret = snd_soc_dai_set_pll(codec_dai, 0,
  65. DA7219_SYSCLK_MCLK, 0, 0);
  66. if (ret)
  67. dev_err(card->dev, "failed to stop PLL: %d\n", ret);
  68. } else if(SND_SOC_DAPM_EVENT_ON(event)) {
  69. ret = snd_soc_dai_set_pll(codec_dai, 0,
  70. DA7219_SYSCLK_PLL_SRM, 0, DA7219_PLL_FREQ_OUT_98304);
  71. if (ret)
  72. dev_err(card->dev, "failed to start PLL: %d\n", ret);
  73. }
  74. return ret;
  75. }
  76. static const struct snd_kcontrol_new broxton_controls[] = {
  77. SOC_DAPM_PIN_SWITCH("Headphone Jack"),
  78. SOC_DAPM_PIN_SWITCH("Headset Mic"),
  79. SOC_DAPM_PIN_SWITCH("Spk"),
  80. };
  81. static const struct snd_soc_dapm_widget broxton_widgets[] = {
  82. SND_SOC_DAPM_HP("Headphone Jack", NULL),
  83. SND_SOC_DAPM_MIC("Headset Mic", NULL),
  84. SND_SOC_DAPM_SPK("Spk", NULL),
  85. SND_SOC_DAPM_MIC("SoC DMIC", NULL),
  86. SND_SOC_DAPM_SPK("HDMI1", NULL),
  87. SND_SOC_DAPM_SPK("HDMI2", NULL),
  88. SND_SOC_DAPM_SPK("HDMI3", NULL),
  89. SND_SOC_DAPM_SUPPLY("Platform Clock", SND_SOC_NOPM, 0, 0,
  90. platform_clock_control, SND_SOC_DAPM_POST_PMD|SND_SOC_DAPM_PRE_PMU),
  91. };
  92. static const struct snd_soc_dapm_route broxton_map[] = {
  93. /* HP jack connectors - unknown if we have jack detection */
  94. {"Headphone Jack", NULL, "HPL"},
  95. {"Headphone Jack", NULL, "HPR"},
  96. /* speaker */
  97. {"Spk", NULL, "Speaker"},
  98. /* other jacks */
  99. {"MIC", NULL, "Headset Mic"},
  100. /* digital mics */
  101. {"DMic", NULL, "SoC DMIC"},
  102. /* CODEC BE connections */
  103. {"HiFi Playback", NULL, "ssp5 Tx"},
  104. {"ssp5 Tx", NULL, "codec0_out"},
  105. {"Playback", NULL, "ssp1 Tx"},
  106. {"ssp1 Tx", NULL, "codec1_out"},
  107. {"codec0_in", NULL, "ssp1 Rx"},
  108. {"ssp1 Rx", NULL, "Capture"},
  109. {"HDMI1", NULL, "hif5-0 Output"},
  110. {"HDMI2", NULL, "hif6-0 Output"},
  111. {"HDMI2", NULL, "hif7-0 Output"},
  112. {"hifi3", NULL, "iDisp3 Tx"},
  113. {"iDisp3 Tx", NULL, "iDisp3_out"},
  114. {"hifi2", NULL, "iDisp2 Tx"},
  115. {"iDisp2 Tx", NULL, "iDisp2_out"},
  116. {"hifi1", NULL, "iDisp1 Tx"},
  117. {"iDisp1 Tx", NULL, "iDisp1_out"},
  118. /* DMIC */
  119. {"dmic01_hifi", NULL, "DMIC01 Rx"},
  120. {"DMIC01 Rx", NULL, "DMIC AIF"},
  121. { "Headphone Jack", NULL, "Platform Clock" },
  122. { "Headset Mic", NULL, "Platform Clock" },
  123. };
  124. static int broxton_ssp_fixup(struct snd_soc_pcm_runtime *rtd,
  125. struct snd_pcm_hw_params *params)
  126. {
  127. struct snd_interval *rate = hw_param_interval(params,
  128. SNDRV_PCM_HW_PARAM_RATE);
  129. struct snd_interval *channels = hw_param_interval(params,
  130. SNDRV_PCM_HW_PARAM_CHANNELS);
  131. struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
  132. /* The ADSP will convert the FE rate to 48k, stereo */
  133. rate->min = rate->max = 48000;
  134. channels->min = channels->max = DUAL_CHANNEL;
  135. /* set SSP to 24 bit */
  136. snd_mask_none(fmt);
  137. snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE);
  138. return 0;
  139. }
  140. static int broxton_da7219_codec_init(struct snd_soc_pcm_runtime *rtd)
  141. {
  142. int ret;
  143. struct snd_soc_dai *codec_dai = rtd->codec_dai;
  144. struct snd_soc_component *component = rtd->codec_dai->component;
  145. /* Configure sysclk for codec */
  146. ret = snd_soc_dai_set_sysclk(codec_dai, DA7219_CLKSRC_MCLK, 19200000,
  147. SND_SOC_CLOCK_IN);
  148. if (ret) {
  149. dev_err(rtd->dev, "can't set codec sysclk configuration\n");
  150. return ret;
  151. }
  152. /*
  153. * Headset buttons map to the google Reference headset.
  154. * These can be configured by userspace.
  155. */
  156. ret = snd_soc_card_jack_new(rtd->card, "Headset Jack",
  157. SND_JACK_HEADSET | SND_JACK_BTN_0 | SND_JACK_BTN_1 |
  158. SND_JACK_BTN_2 | SND_JACK_BTN_3 | SND_JACK_LINEOUT,
  159. &broxton_headset, NULL, 0);
  160. if (ret) {
  161. dev_err(rtd->dev, "Headset Jack creation failed: %d\n", ret);
  162. return ret;
  163. }
  164. da7219_aad_jack_det(component, &broxton_headset);
  165. snd_soc_dapm_ignore_suspend(&rtd->card->dapm, "SoC DMIC");
  166. return ret;
  167. }
  168. static int broxton_hdmi_init(struct snd_soc_pcm_runtime *rtd)
  169. {
  170. struct bxt_card_private *ctx = snd_soc_card_get_drvdata(rtd->card);
  171. struct snd_soc_dai *dai = rtd->codec_dai;
  172. struct bxt_hdmi_pcm *pcm;
  173. pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
  174. if (!pcm)
  175. return -ENOMEM;
  176. pcm->device = BXT_DPCM_AUDIO_HDMI1_PB + dai->id;
  177. pcm->codec_dai = dai;
  178. list_add_tail(&pcm->head, &ctx->hdmi_pcm_list);
  179. return 0;
  180. }
  181. static int broxton_da7219_fe_init(struct snd_soc_pcm_runtime *rtd)
  182. {
  183. struct snd_soc_dapm_context *dapm;
  184. struct snd_soc_component *component = rtd->cpu_dai->component;
  185. dapm = snd_soc_component_get_dapm(component);
  186. snd_soc_dapm_ignore_suspend(dapm, "Reference Capture");
  187. return 0;
  188. }
  189. static const unsigned int rates[] = {
  190. 48000,
  191. };
  192. static const struct snd_pcm_hw_constraint_list constraints_rates = {
  193. .count = ARRAY_SIZE(rates),
  194. .list = rates,
  195. .mask = 0,
  196. };
  197. static const unsigned int channels[] = {
  198. DUAL_CHANNEL,
  199. };
  200. static const struct snd_pcm_hw_constraint_list constraints_channels = {
  201. .count = ARRAY_SIZE(channels),
  202. .list = channels,
  203. .mask = 0,
  204. };
  205. static const unsigned int channels_quad[] = {
  206. QUAD_CHANNEL,
  207. };
  208. static const struct snd_pcm_hw_constraint_list constraints_channels_quad = {
  209. .count = ARRAY_SIZE(channels_quad),
  210. .list = channels_quad,
  211. .mask = 0,
  212. };
  213. static int bxt_fe_startup(struct snd_pcm_substream *substream)
  214. {
  215. struct snd_pcm_runtime *runtime = substream->runtime;
  216. /*
  217. * On this platform for PCM device we support,
  218. * 48Khz
  219. * stereo
  220. * 16 bit audio
  221. */
  222. runtime->hw.channels_max = DUAL_CHANNEL;
  223. snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
  224. &constraints_channels);
  225. runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE;
  226. snd_pcm_hw_constraint_msbits(runtime, 0, 16, 16);
  227. snd_pcm_hw_constraint_list(runtime, 0,
  228. SNDRV_PCM_HW_PARAM_RATE, &constraints_rates);
  229. return 0;
  230. }
  231. static const struct snd_soc_ops broxton_da7219_fe_ops = {
  232. .startup = bxt_fe_startup,
  233. };
  234. static int broxton_dmic_fixup(struct snd_soc_pcm_runtime *rtd,
  235. struct snd_pcm_hw_params *params)
  236. {
  237. struct snd_interval *channels = hw_param_interval(params,
  238. SNDRV_PCM_HW_PARAM_CHANNELS);
  239. if (params_channels(params) == 2)
  240. channels->min = channels->max = 2;
  241. else
  242. channels->min = channels->max = 4;
  243. return 0;
  244. }
  245. static int broxton_dmic_startup(struct snd_pcm_substream *substream)
  246. {
  247. struct snd_pcm_runtime *runtime = substream->runtime;
  248. runtime->hw.channels_min = runtime->hw.channels_max = QUAD_CHANNEL;
  249. snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
  250. &constraints_channels_quad);
  251. return snd_pcm_hw_constraint_list(substream->runtime, 0,
  252. SNDRV_PCM_HW_PARAM_RATE, &constraints_rates);
  253. }
  254. static const struct snd_soc_ops broxton_dmic_ops = {
  255. .startup = broxton_dmic_startup,
  256. };
  257. static const unsigned int rates_16000[] = {
  258. 16000,
  259. };
  260. static const struct snd_pcm_hw_constraint_list constraints_16000 = {
  261. .count = ARRAY_SIZE(rates_16000),
  262. .list = rates_16000,
  263. };
  264. static const unsigned int ch_mono[] = {
  265. 1,
  266. };
  267. static const struct snd_pcm_hw_constraint_list constraints_refcap = {
  268. .count = ARRAY_SIZE(ch_mono),
  269. .list = ch_mono,
  270. };
  271. static int broxton_refcap_startup(struct snd_pcm_substream *substream)
  272. {
  273. substream->runtime->hw.channels_max = 1;
  274. snd_pcm_hw_constraint_list(substream->runtime, 0,
  275. SNDRV_PCM_HW_PARAM_CHANNELS,
  276. &constraints_refcap);
  277. return snd_pcm_hw_constraint_list(substream->runtime, 0,
  278. SNDRV_PCM_HW_PARAM_RATE,
  279. &constraints_16000);
  280. };
  281. static const struct snd_soc_ops broxton_refcap_ops = {
  282. .startup = broxton_refcap_startup,
  283. };
  284. /* broxton digital audio interface glue - connects codec <--> CPU */
  285. static struct snd_soc_dai_link broxton_dais[] = {
  286. /* Front End DAI links */
  287. [BXT_DPCM_AUDIO_PB] =
  288. {
  289. .name = "Bxt Audio Port",
  290. .stream_name = "Audio",
  291. .cpu_dai_name = "System Pin",
  292. .platform_name = "0000:00:0e.0",
  293. .dynamic = 1,
  294. .codec_name = "snd-soc-dummy",
  295. .codec_dai_name = "snd-soc-dummy-dai",
  296. .nonatomic = 1,
  297. .init = broxton_da7219_fe_init,
  298. .trigger = {
  299. SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
  300. .dpcm_playback = 1,
  301. .ops = &broxton_da7219_fe_ops,
  302. },
  303. [BXT_DPCM_AUDIO_CP] =
  304. {
  305. .name = "Bxt Audio Capture Port",
  306. .stream_name = "Audio Record",
  307. .cpu_dai_name = "System Pin",
  308. .platform_name = "0000:00:0e.0",
  309. .dynamic = 1,
  310. .codec_name = "snd-soc-dummy",
  311. .codec_dai_name = "snd-soc-dummy-dai",
  312. .nonatomic = 1,
  313. .trigger = {
  314. SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
  315. .dpcm_capture = 1,
  316. .ops = &broxton_da7219_fe_ops,
  317. },
  318. [BXT_DPCM_AUDIO_REF_CP] =
  319. {
  320. .name = "Bxt Audio Reference cap",
  321. .stream_name = "Refcap",
  322. .cpu_dai_name = "Reference Pin",
  323. .codec_name = "snd-soc-dummy",
  324. .codec_dai_name = "snd-soc-dummy-dai",
  325. .platform_name = "0000:00:0e.0",
  326. .init = NULL,
  327. .dpcm_capture = 1,
  328. .nonatomic = 1,
  329. .dynamic = 1,
  330. .ops = &broxton_refcap_ops,
  331. },
  332. [BXT_DPCM_AUDIO_DMIC_CP] =
  333. {
  334. .name = "Bxt Audio DMIC cap",
  335. .stream_name = "dmiccap",
  336. .cpu_dai_name = "DMIC Pin",
  337. .codec_name = "snd-soc-dummy",
  338. .codec_dai_name = "snd-soc-dummy-dai",
  339. .platform_name = "0000:00:0e.0",
  340. .init = NULL,
  341. .dpcm_capture = 1,
  342. .nonatomic = 1,
  343. .dynamic = 1,
  344. .ops = &broxton_dmic_ops,
  345. },
  346. [BXT_DPCM_AUDIO_HDMI1_PB] =
  347. {
  348. .name = "Bxt HDMI Port1",
  349. .stream_name = "Hdmi1",
  350. .cpu_dai_name = "HDMI1 Pin",
  351. .codec_name = "snd-soc-dummy",
  352. .codec_dai_name = "snd-soc-dummy-dai",
  353. .platform_name = "0000:00:0e.0",
  354. .dpcm_playback = 1,
  355. .init = NULL,
  356. .nonatomic = 1,
  357. .dynamic = 1,
  358. },
  359. [BXT_DPCM_AUDIO_HDMI2_PB] =
  360. {
  361. .name = "Bxt HDMI Port2",
  362. .stream_name = "Hdmi2",
  363. .cpu_dai_name = "HDMI2 Pin",
  364. .codec_name = "snd-soc-dummy",
  365. .codec_dai_name = "snd-soc-dummy-dai",
  366. .platform_name = "0000:00:0e.0",
  367. .dpcm_playback = 1,
  368. .init = NULL,
  369. .nonatomic = 1,
  370. .dynamic = 1,
  371. },
  372. [BXT_DPCM_AUDIO_HDMI3_PB] =
  373. {
  374. .name = "Bxt HDMI Port3",
  375. .stream_name = "Hdmi3",
  376. .cpu_dai_name = "HDMI3 Pin",
  377. .codec_name = "snd-soc-dummy",
  378. .codec_dai_name = "snd-soc-dummy-dai",
  379. .platform_name = "0000:00:0e.0",
  380. .dpcm_playback = 1,
  381. .init = NULL,
  382. .nonatomic = 1,
  383. .dynamic = 1,
  384. },
  385. /* Back End DAI links */
  386. {
  387. /* SSP5 - Codec */
  388. .name = "SSP5-Codec",
  389. .id = 0,
  390. .cpu_dai_name = "SSP5 Pin",
  391. .platform_name = "0000:00:0e.0",
  392. .no_pcm = 1,
  393. .codec_name = "MX98357A:00",
  394. .codec_dai_name = BXT_MAXIM_CODEC_DAI,
  395. .dai_fmt = SND_SOC_DAIFMT_I2S |
  396. SND_SOC_DAIFMT_NB_NF |
  397. SND_SOC_DAIFMT_CBS_CFS,
  398. .ignore_pmdown_time = 1,
  399. .be_hw_params_fixup = broxton_ssp_fixup,
  400. .dpcm_playback = 1,
  401. },
  402. {
  403. /* SSP1 - Codec */
  404. .name = "SSP1-Codec",
  405. .id = 1,
  406. .cpu_dai_name = "SSP1 Pin",
  407. .platform_name = "0000:00:0e.0",
  408. .no_pcm = 1,
  409. .codec_name = "i2c-DLGS7219:00",
  410. .codec_dai_name = BXT_DIALOG_CODEC_DAI,
  411. .init = broxton_da7219_codec_init,
  412. .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
  413. SND_SOC_DAIFMT_CBS_CFS,
  414. .ignore_pmdown_time = 1,
  415. .be_hw_params_fixup = broxton_ssp_fixup,
  416. .dpcm_playback = 1,
  417. .dpcm_capture = 1,
  418. },
  419. {
  420. .name = "dmic01",
  421. .id = 2,
  422. .cpu_dai_name = "DMIC01 Pin",
  423. .codec_name = "dmic-codec",
  424. .codec_dai_name = "dmic-hifi",
  425. .platform_name = "0000:00:0e.0",
  426. .ignore_suspend = 1,
  427. .be_hw_params_fixup = broxton_dmic_fixup,
  428. .dpcm_capture = 1,
  429. .no_pcm = 1,
  430. },
  431. {
  432. .name = "iDisp1",
  433. .id = 3,
  434. .cpu_dai_name = "iDisp1 Pin",
  435. .codec_name = "ehdaudio0D2",
  436. .codec_dai_name = "intel-hdmi-hifi1",
  437. .platform_name = "0000:00:0e.0",
  438. .init = broxton_hdmi_init,
  439. .dpcm_playback = 1,
  440. .no_pcm = 1,
  441. },
  442. {
  443. .name = "iDisp2",
  444. .id = 4,
  445. .cpu_dai_name = "iDisp2 Pin",
  446. .codec_name = "ehdaudio0D2",
  447. .codec_dai_name = "intel-hdmi-hifi2",
  448. .platform_name = "0000:00:0e.0",
  449. .init = broxton_hdmi_init,
  450. .dpcm_playback = 1,
  451. .no_pcm = 1,
  452. },
  453. {
  454. .name = "iDisp3",
  455. .id = 5,
  456. .cpu_dai_name = "iDisp3 Pin",
  457. .codec_name = "ehdaudio0D2",
  458. .codec_dai_name = "intel-hdmi-hifi3",
  459. .platform_name = "0000:00:0e.0",
  460. .init = broxton_hdmi_init,
  461. .dpcm_playback = 1,
  462. .no_pcm = 1,
  463. },
  464. };
  465. #define NAME_SIZE 32
  466. static int bxt_card_late_probe(struct snd_soc_card *card)
  467. {
  468. struct bxt_card_private *ctx = snd_soc_card_get_drvdata(card);
  469. struct bxt_hdmi_pcm *pcm;
  470. struct snd_soc_component *component = NULL;
  471. int err, i = 0;
  472. char jack_name[NAME_SIZE];
  473. list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) {
  474. component = pcm->codec_dai->component;
  475. snprintf(jack_name, sizeof(jack_name),
  476. "HDMI/DP, pcm=%d Jack", pcm->device);
  477. err = snd_soc_card_jack_new(card, jack_name,
  478. SND_JACK_AVOUT, &broxton_hdmi[i],
  479. NULL, 0);
  480. if (err)
  481. return err;
  482. err = hdac_hdmi_jack_init(pcm->codec_dai, pcm->device,
  483. &broxton_hdmi[i]);
  484. if (err < 0)
  485. return err;
  486. i++;
  487. }
  488. if (!component)
  489. return -EINVAL;
  490. return hdac_hdmi_jack_port_init(component, &card->dapm);
  491. }
  492. /* broxton audio machine driver for SPT + da7219 */
  493. static struct snd_soc_card broxton_audio_card = {
  494. .name = "bxtda7219max",
  495. .owner = THIS_MODULE,
  496. .dai_link = broxton_dais,
  497. .num_links = ARRAY_SIZE(broxton_dais),
  498. .controls = broxton_controls,
  499. .num_controls = ARRAY_SIZE(broxton_controls),
  500. .dapm_widgets = broxton_widgets,
  501. .num_dapm_widgets = ARRAY_SIZE(broxton_widgets),
  502. .dapm_routes = broxton_map,
  503. .num_dapm_routes = ARRAY_SIZE(broxton_map),
  504. .fully_routed = true,
  505. .late_probe = bxt_card_late_probe,
  506. };
  507. static int broxton_audio_probe(struct platform_device *pdev)
  508. {
  509. struct bxt_card_private *ctx;
  510. ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
  511. if (!ctx)
  512. return -ENOMEM;
  513. INIT_LIST_HEAD(&ctx->hdmi_pcm_list);
  514. broxton_audio_card.dev = &pdev->dev;
  515. snd_soc_card_set_drvdata(&broxton_audio_card, ctx);
  516. return devm_snd_soc_register_card(&pdev->dev, &broxton_audio_card);
  517. }
  518. static struct platform_driver broxton_audio = {
  519. .probe = broxton_audio_probe,
  520. .driver = {
  521. .name = "bxt_da7219_max98357a",
  522. .pm = &snd_soc_pm_ops,
  523. },
  524. };
  525. module_platform_driver(broxton_audio)
  526. /* Module information */
  527. MODULE_DESCRIPTION("Audio Machine driver-DA7219 & MAX98357A in I2S mode");
  528. MODULE_AUTHOR("Sathyanarayana Nujella <sathyanarayana.nujella@intel.com>");
  529. MODULE_AUTHOR("Rohit Ainapure <rohit.m.ainapure@intel.com>");
  530. MODULE_AUTHOR("Harsha Priya <harshapriya.n@intel.com>");
  531. MODULE_AUTHOR("Conrad Cooke <conrad.cooke@intel.com>");
  532. MODULE_LICENSE("GPL v2");
  533. MODULE_ALIAS("platform:bxt_da7219_max98357a");