kbl_rt5660.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. // Copyright(c) 2018-19 Canonical Corporation.
  3. /*
  4. * Intel Kabylake I2S Machine Driver with RT5660 Codec
  5. *
  6. * Modified from:
  7. * Intel Kabylake I2S Machine driver supporting MAXIM98357a and
  8. * DA7219 codecs
  9. * Also referred to:
  10. * Intel Broadwell I2S Machine driver supporting RT5677 codec
  11. */
  12. #include <linux/module.h>
  13. #include <linux/platform_device.h>
  14. #include <linux/gpio/consumer.h>
  15. #include <linux/acpi.h>
  16. #include <sound/core.h>
  17. #include <sound/jack.h>
  18. #include <sound/pcm.h>
  19. #include <sound/pcm_params.h>
  20. #include <sound/soc.h>
  21. #include "../../codecs/hdac_hdmi.h"
  22. #include "../../codecs/rt5660.h"
  23. #define KBL_RT5660_CODEC_DAI "rt5660-aif1"
  24. #define DUAL_CHANNEL 2
  25. static struct snd_soc_card *kabylake_audio_card;
  26. static struct snd_soc_jack skylake_hdmi[3];
  27. static struct snd_soc_jack lineout_jack;
  28. static struct snd_soc_jack mic_jack;
  29. struct kbl_hdmi_pcm {
  30. struct list_head head;
  31. struct snd_soc_dai *codec_dai;
  32. int device;
  33. };
  34. struct kbl_codec_private {
  35. struct gpio_desc *gpio_lo_mute;
  36. struct list_head hdmi_pcm_list;
  37. };
  38. enum {
  39. KBL_DPCM_AUDIO_PB = 0,
  40. KBL_DPCM_AUDIO_CP,
  41. KBL_DPCM_AUDIO_HDMI1_PB,
  42. KBL_DPCM_AUDIO_HDMI2_PB,
  43. KBL_DPCM_AUDIO_HDMI3_PB,
  44. };
  45. #define GPIO_LINEOUT_MUTE_INDEX 0
  46. #define GPIO_LINEOUT_DET_INDEX 3
  47. #define GPIO_LINEIN_DET_INDEX 4
  48. static const struct acpi_gpio_params lineout_mute_gpio = { GPIO_LINEOUT_MUTE_INDEX, 0, true };
  49. static const struct acpi_gpio_params lineout_det_gpio = { GPIO_LINEOUT_DET_INDEX, 0, false };
  50. static const struct acpi_gpio_params mic_det_gpio = { GPIO_LINEIN_DET_INDEX, 0, false };
  51. static const struct acpi_gpio_mapping acpi_rt5660_gpios[] = {
  52. { "lineout-mute-gpios", &lineout_mute_gpio, 1 },
  53. { "lineout-det-gpios", &lineout_det_gpio, 1 },
  54. { "mic-det-gpios", &mic_det_gpio, 1 },
  55. { NULL },
  56. };
  57. static struct snd_soc_jack_pin lineout_jack_pin = {
  58. .pin = "Line Out",
  59. .mask = SND_JACK_LINEOUT,
  60. };
  61. static struct snd_soc_jack_pin mic_jack_pin = {
  62. .pin = "Line In",
  63. .mask = SND_JACK_MICROPHONE,
  64. };
  65. static struct snd_soc_jack_gpio lineout_jack_gpio = {
  66. .name = "lineout-det",
  67. .report = SND_JACK_LINEOUT,
  68. .debounce_time = 200,
  69. };
  70. static struct snd_soc_jack_gpio mic_jack_gpio = {
  71. .name = "mic-det",
  72. .report = SND_JACK_MICROPHONE,
  73. .debounce_time = 200,
  74. };
  75. static int kabylake_5660_event_lineout(struct snd_soc_dapm_widget *w,
  76. struct snd_kcontrol *k, int event)
  77. {
  78. struct snd_soc_dapm_context *dapm = w->dapm;
  79. struct kbl_codec_private *priv = snd_soc_card_get_drvdata(dapm->card);
  80. gpiod_set_value_cansleep(priv->gpio_lo_mute,
  81. !(SND_SOC_DAPM_EVENT_ON(event)));
  82. return 0;
  83. }
  84. static const struct snd_kcontrol_new kabylake_rt5660_controls[] = {
  85. SOC_DAPM_PIN_SWITCH("Line In"),
  86. SOC_DAPM_PIN_SWITCH("Line Out"),
  87. };
  88. static const struct snd_soc_dapm_widget kabylake_rt5660_widgets[] = {
  89. SND_SOC_DAPM_MIC("Line In", NULL),
  90. SND_SOC_DAPM_LINE("Line Out", kabylake_5660_event_lineout),
  91. };
  92. static const struct snd_soc_dapm_route kabylake_rt5660_map[] = {
  93. /* other jacks */
  94. {"IN1P", NULL, "Line In"},
  95. {"IN2P", NULL, "Line In"},
  96. {"Line Out", NULL, "LOUTR"},
  97. {"Line Out", NULL, "LOUTL"},
  98. /* CODEC BE connections */
  99. { "AIF1 Playback", NULL, "ssp0 Tx"},
  100. { "ssp0 Tx", NULL, "codec0_out"},
  101. { "codec0_in", NULL, "ssp0 Rx" },
  102. { "ssp0 Rx", NULL, "AIF1 Capture" },
  103. { "hifi1", NULL, "iDisp1 Tx"},
  104. { "iDisp1 Tx", NULL, "iDisp1_out"},
  105. { "hifi2", NULL, "iDisp2 Tx"},
  106. { "iDisp2 Tx", NULL, "iDisp2_out"},
  107. { "hifi3", NULL, "iDisp3 Tx"},
  108. { "iDisp3 Tx", NULL, "iDisp3_out"},
  109. };
  110. static int kabylake_ssp0_fixup(struct snd_soc_pcm_runtime *rtd,
  111. struct snd_pcm_hw_params *params)
  112. {
  113. struct snd_interval *rate = hw_param_interval(params,
  114. SNDRV_PCM_HW_PARAM_RATE);
  115. struct snd_interval *chan = hw_param_interval(params,
  116. SNDRV_PCM_HW_PARAM_CHANNELS);
  117. struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
  118. /* The ADSP will convert the FE rate to 48k, stereo */
  119. rate->min = rate->max = 48000;
  120. chan->min = chan->max = DUAL_CHANNEL;
  121. /* set SSP0 to 24 bit */
  122. snd_mask_none(fmt);
  123. snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE);
  124. return 0;
  125. }
  126. static int kabylake_rt5660_codec_init(struct snd_soc_pcm_runtime *rtd)
  127. {
  128. int ret;
  129. struct kbl_codec_private *ctx = snd_soc_card_get_drvdata(rtd->card);
  130. struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component;
  131. struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
  132. ret = devm_acpi_dev_add_driver_gpios(component->dev, acpi_rt5660_gpios);
  133. if (ret)
  134. dev_warn(component->dev, "Failed to add driver gpios\n");
  135. /* Request rt5660 GPIO for lineout mute control, return if fails */
  136. ctx->gpio_lo_mute = gpiod_get(component->dev, "lineout-mute",
  137. GPIOD_OUT_HIGH);
  138. if (IS_ERR(ctx->gpio_lo_mute)) {
  139. dev_err(component->dev, "Can't find GPIO_MUTE# gpio\n");
  140. return PTR_ERR(ctx->gpio_lo_mute);
  141. }
  142. /* Create and initialize headphone jack, this jack is not mandatory, don't return if fails */
  143. ret = snd_soc_card_jack_new_pins(rtd->card, "Lineout Jack",
  144. SND_JACK_LINEOUT, &lineout_jack,
  145. &lineout_jack_pin, 1);
  146. if (ret)
  147. dev_warn(component->dev, "Can't create Lineout jack\n");
  148. else {
  149. lineout_jack_gpio.gpiod_dev = component->dev;
  150. ret = snd_soc_jack_add_gpios(&lineout_jack, 1,
  151. &lineout_jack_gpio);
  152. if (ret)
  153. dev_warn(component->dev, "Can't add Lineout jack gpio\n");
  154. }
  155. /* Create and initialize mic jack, this jack is not mandatory, don't return if fails */
  156. ret = snd_soc_card_jack_new_pins(rtd->card, "Mic Jack",
  157. SND_JACK_MICROPHONE, &mic_jack,
  158. &mic_jack_pin, 1);
  159. if (ret)
  160. dev_warn(component->dev, "Can't create mic jack\n");
  161. else {
  162. mic_jack_gpio.gpiod_dev = component->dev;
  163. ret = snd_soc_jack_add_gpios(&mic_jack, 1, &mic_jack_gpio);
  164. if (ret)
  165. dev_warn(component->dev, "Can't add mic jack gpio\n");
  166. }
  167. /* Here we enable some dapms in advance to reduce the pop noise for recording via line-in */
  168. snd_soc_dapm_force_enable_pin(dapm, "MICBIAS1");
  169. snd_soc_dapm_force_enable_pin(dapm, "BST1");
  170. snd_soc_dapm_force_enable_pin(dapm, "BST2");
  171. return 0;
  172. }
  173. static void kabylake_rt5660_codec_exit(struct snd_soc_pcm_runtime *rtd)
  174. {
  175. struct kbl_codec_private *ctx = snd_soc_card_get_drvdata(rtd->card);
  176. /*
  177. * The .exit() can be reached without going through the .init()
  178. * so explicitly test if the gpiod is valid
  179. */
  180. if (!IS_ERR_OR_NULL(ctx->gpio_lo_mute))
  181. gpiod_put(ctx->gpio_lo_mute);
  182. }
  183. static int kabylake_hdmi_init(struct snd_soc_pcm_runtime *rtd, int device)
  184. {
  185. struct kbl_codec_private *ctx = snd_soc_card_get_drvdata(rtd->card);
  186. struct snd_soc_dai *dai = asoc_rtd_to_codec(rtd, 0);
  187. struct kbl_hdmi_pcm *pcm;
  188. pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
  189. if (!pcm)
  190. return -ENOMEM;
  191. pcm->device = device;
  192. pcm->codec_dai = dai;
  193. list_add_tail(&pcm->head, &ctx->hdmi_pcm_list);
  194. return 0;
  195. }
  196. static int kabylake_hdmi1_init(struct snd_soc_pcm_runtime *rtd)
  197. {
  198. return kabylake_hdmi_init(rtd, KBL_DPCM_AUDIO_HDMI1_PB);
  199. }
  200. static int kabylake_hdmi2_init(struct snd_soc_pcm_runtime *rtd)
  201. {
  202. return kabylake_hdmi_init(rtd, KBL_DPCM_AUDIO_HDMI2_PB);
  203. }
  204. static int kabylake_hdmi3_init(struct snd_soc_pcm_runtime *rtd)
  205. {
  206. return kabylake_hdmi_init(rtd, KBL_DPCM_AUDIO_HDMI3_PB);
  207. }
  208. static int kabylake_rt5660_hw_params(struct snd_pcm_substream *substream,
  209. struct snd_pcm_hw_params *params)
  210. {
  211. struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
  212. struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
  213. int ret;
  214. ret = snd_soc_dai_set_sysclk(codec_dai,
  215. RT5660_SCLK_S_PLL1, params_rate(params) * 512,
  216. SND_SOC_CLOCK_IN);
  217. if (ret < 0) {
  218. dev_err(rtd->dev, "snd_soc_dai_set_sysclk err = %d\n", ret);
  219. return ret;
  220. }
  221. ret = snd_soc_dai_set_pll(codec_dai, 0,
  222. RT5660_PLL1_S_BCLK,
  223. params_rate(params) * 50,
  224. params_rate(params) * 512);
  225. if (ret < 0)
  226. dev_err(codec_dai->dev, "can't set codec pll: %d\n", ret);
  227. return ret;
  228. }
  229. static struct snd_soc_ops kabylake_rt5660_ops = {
  230. .hw_params = kabylake_rt5660_hw_params,
  231. };
  232. static const unsigned int rates[] = {
  233. 48000,
  234. };
  235. static const struct snd_pcm_hw_constraint_list constraints_rates = {
  236. .count = ARRAY_SIZE(rates),
  237. .list = rates,
  238. .mask = 0,
  239. };
  240. static const unsigned int channels[] = {
  241. DUAL_CHANNEL,
  242. };
  243. static const struct snd_pcm_hw_constraint_list constraints_channels = {
  244. .count = ARRAY_SIZE(channels),
  245. .list = channels,
  246. .mask = 0,
  247. };
  248. static int kbl_fe_startup(struct snd_pcm_substream *substream)
  249. {
  250. struct snd_pcm_runtime *runtime = substream->runtime;
  251. /*
  252. * On this platform for PCM device we support,
  253. * 48Khz
  254. * stereo
  255. * 16 bit audio
  256. */
  257. runtime->hw.channels_max = DUAL_CHANNEL;
  258. snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
  259. &constraints_channels);
  260. runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE;
  261. snd_pcm_hw_constraint_msbits(runtime, 0, 16, 16);
  262. snd_pcm_hw_constraint_list(runtime, 0,
  263. SNDRV_PCM_HW_PARAM_RATE, &constraints_rates);
  264. return 0;
  265. }
  266. static const struct snd_soc_ops kabylake_rt5660_fe_ops = {
  267. .startup = kbl_fe_startup,
  268. };
  269. SND_SOC_DAILINK_DEF(dummy,
  270. DAILINK_COMP_ARRAY(COMP_DUMMY()));
  271. SND_SOC_DAILINK_DEF(system,
  272. DAILINK_COMP_ARRAY(COMP_CPU("System Pin")));
  273. SND_SOC_DAILINK_DEF(hdmi1,
  274. DAILINK_COMP_ARRAY(COMP_CPU("HDMI1 Pin")));
  275. SND_SOC_DAILINK_DEF(hdmi2,
  276. DAILINK_COMP_ARRAY(COMP_CPU("HDMI2 Pin")));
  277. SND_SOC_DAILINK_DEF(hdmi3,
  278. DAILINK_COMP_ARRAY(COMP_CPU("HDMI3 Pin")));
  279. SND_SOC_DAILINK_DEF(ssp0_pin,
  280. DAILINK_COMP_ARRAY(COMP_CPU("SSP0 Pin")));
  281. SND_SOC_DAILINK_DEF(ssp0_codec,
  282. DAILINK_COMP_ARRAY(COMP_CODEC("i2c-10EC3277:00", KBL_RT5660_CODEC_DAI)));
  283. SND_SOC_DAILINK_DEF(idisp1_pin,
  284. DAILINK_COMP_ARRAY(COMP_CPU("iDisp1 Pin")));
  285. SND_SOC_DAILINK_DEF(idisp1_codec,
  286. DAILINK_COMP_ARRAY(COMP_CODEC("ehdaudio0D2", "intel-hdmi-hifi1")));
  287. SND_SOC_DAILINK_DEF(idisp2_pin,
  288. DAILINK_COMP_ARRAY(COMP_CPU("iDisp2 Pin")));
  289. SND_SOC_DAILINK_DEF(idisp2_codec,
  290. DAILINK_COMP_ARRAY(COMP_CODEC("ehdaudio0D2", "intel-hdmi-hifi2")));
  291. SND_SOC_DAILINK_DEF(idisp3_pin,
  292. DAILINK_COMP_ARRAY(COMP_CPU("iDisp3 Pin")));
  293. SND_SOC_DAILINK_DEF(idisp3_codec,
  294. DAILINK_COMP_ARRAY(COMP_CODEC("ehdaudio0D2", "intel-hdmi-hifi3")));
  295. SND_SOC_DAILINK_DEF(platform,
  296. DAILINK_COMP_ARRAY(COMP_PLATFORM("0000:00:1f.3")));
  297. /* kabylake digital audio interface glue - connects rt5660 codec <--> CPU */
  298. static struct snd_soc_dai_link kabylake_rt5660_dais[] = {
  299. /* Front End DAI links */
  300. [KBL_DPCM_AUDIO_PB] = {
  301. .name = "Kbl Audio Port",
  302. .stream_name = "Audio",
  303. .dynamic = 1,
  304. .nonatomic = 1,
  305. .trigger = {
  306. SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
  307. .dpcm_playback = 1,
  308. .ops = &kabylake_rt5660_fe_ops,
  309. SND_SOC_DAILINK_REG(system, dummy, platform),
  310. },
  311. [KBL_DPCM_AUDIO_CP] = {
  312. .name = "Kbl Audio Capture Port",
  313. .stream_name = "Audio Record",
  314. .dynamic = 1,
  315. .nonatomic = 1,
  316. .trigger = {
  317. SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
  318. .dpcm_capture = 1,
  319. .ops = &kabylake_rt5660_fe_ops,
  320. SND_SOC_DAILINK_REG(system, dummy, platform),
  321. },
  322. [KBL_DPCM_AUDIO_HDMI1_PB] = {
  323. .name = "Kbl HDMI Port1",
  324. .stream_name = "Hdmi1",
  325. .dpcm_playback = 1,
  326. .init = NULL,
  327. .trigger = {
  328. SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
  329. .nonatomic = 1,
  330. .dynamic = 1,
  331. SND_SOC_DAILINK_REG(hdmi1, dummy, platform),
  332. },
  333. [KBL_DPCM_AUDIO_HDMI2_PB] = {
  334. .name = "Kbl HDMI Port2",
  335. .stream_name = "Hdmi2",
  336. .dpcm_playback = 1,
  337. .init = NULL,
  338. .trigger = {
  339. SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
  340. .nonatomic = 1,
  341. .dynamic = 1,
  342. SND_SOC_DAILINK_REG(hdmi2, dummy, platform),
  343. },
  344. [KBL_DPCM_AUDIO_HDMI3_PB] = {
  345. .name = "Kbl HDMI Port3",
  346. .stream_name = "Hdmi3",
  347. .trigger = {
  348. SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
  349. .dpcm_playback = 1,
  350. .init = NULL,
  351. .nonatomic = 1,
  352. .dynamic = 1,
  353. SND_SOC_DAILINK_REG(hdmi3, dummy, platform),
  354. },
  355. /* Back End DAI links */
  356. {
  357. /* SSP0 - Codec */
  358. .name = "SSP0-Codec",
  359. .id = 0,
  360. .no_pcm = 1,
  361. .init = kabylake_rt5660_codec_init,
  362. .exit = kabylake_rt5660_codec_exit,
  363. .dai_fmt = SND_SOC_DAIFMT_I2S |
  364. SND_SOC_DAIFMT_NB_NF |
  365. SND_SOC_DAIFMT_CBC_CFC,
  366. .ignore_pmdown_time = 1,
  367. .be_hw_params_fixup = kabylake_ssp0_fixup,
  368. .ops = &kabylake_rt5660_ops,
  369. .dpcm_playback = 1,
  370. .dpcm_capture = 1,
  371. SND_SOC_DAILINK_REG(ssp0_pin, ssp0_codec, platform),
  372. },
  373. {
  374. .name = "iDisp1",
  375. .id = 1,
  376. .dpcm_playback = 1,
  377. .init = kabylake_hdmi1_init,
  378. .no_pcm = 1,
  379. SND_SOC_DAILINK_REG(idisp1_pin, idisp1_codec, platform),
  380. },
  381. {
  382. .name = "iDisp2",
  383. .id = 2,
  384. .init = kabylake_hdmi2_init,
  385. .dpcm_playback = 1,
  386. .no_pcm = 1,
  387. SND_SOC_DAILINK_REG(idisp2_pin, idisp2_codec, platform),
  388. },
  389. {
  390. .name = "iDisp3",
  391. .id = 3,
  392. .init = kabylake_hdmi3_init,
  393. .dpcm_playback = 1,
  394. .no_pcm = 1,
  395. SND_SOC_DAILINK_REG(idisp3_pin, idisp3_codec, platform),
  396. },
  397. };
  398. #define NAME_SIZE 32
  399. static int kabylake_card_late_probe(struct snd_soc_card *card)
  400. {
  401. struct kbl_codec_private *ctx = snd_soc_card_get_drvdata(card);
  402. struct kbl_hdmi_pcm *pcm;
  403. struct snd_soc_component *component = NULL;
  404. int err, i = 0;
  405. char jack_name[NAME_SIZE];
  406. list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) {
  407. component = pcm->codec_dai->component;
  408. snprintf(jack_name, sizeof(jack_name),
  409. "HDMI/DP, pcm=%d Jack", pcm->device);
  410. err = snd_soc_card_jack_new(card, jack_name,
  411. SND_JACK_AVOUT, &skylake_hdmi[i]);
  412. if (err)
  413. return err;
  414. err = hdac_hdmi_jack_init(pcm->codec_dai, pcm->device,
  415. &skylake_hdmi[i]);
  416. if (err < 0)
  417. return err;
  418. i++;
  419. }
  420. if (!component)
  421. return -EINVAL;
  422. return hdac_hdmi_jack_port_init(component, &card->dapm);
  423. }
  424. /* kabylake audio machine driver for rt5660 */
  425. static struct snd_soc_card kabylake_audio_card_rt5660 = {
  426. .name = "kblrt5660",
  427. .owner = THIS_MODULE,
  428. .dai_link = kabylake_rt5660_dais,
  429. .num_links = ARRAY_SIZE(kabylake_rt5660_dais),
  430. .controls = kabylake_rt5660_controls,
  431. .num_controls = ARRAY_SIZE(kabylake_rt5660_controls),
  432. .dapm_widgets = kabylake_rt5660_widgets,
  433. .num_dapm_widgets = ARRAY_SIZE(kabylake_rt5660_widgets),
  434. .dapm_routes = kabylake_rt5660_map,
  435. .num_dapm_routes = ARRAY_SIZE(kabylake_rt5660_map),
  436. .fully_routed = true,
  437. .late_probe = kabylake_card_late_probe,
  438. };
  439. static int kabylake_audio_probe(struct platform_device *pdev)
  440. {
  441. struct kbl_codec_private *ctx;
  442. ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
  443. if (!ctx)
  444. return -ENOMEM;
  445. INIT_LIST_HEAD(&ctx->hdmi_pcm_list);
  446. kabylake_audio_card =
  447. (struct snd_soc_card *)pdev->id_entry->driver_data;
  448. kabylake_audio_card->dev = &pdev->dev;
  449. snd_soc_card_set_drvdata(kabylake_audio_card, ctx);
  450. return devm_snd_soc_register_card(&pdev->dev, kabylake_audio_card);
  451. }
  452. static const struct platform_device_id kbl_board_ids[] = {
  453. {
  454. .name = "kbl_rt5660",
  455. .driver_data =
  456. (kernel_ulong_t)&kabylake_audio_card_rt5660,
  457. },
  458. { }
  459. };
  460. MODULE_DEVICE_TABLE(platform, kbl_board_ids);
  461. static struct platform_driver kabylake_audio = {
  462. .probe = kabylake_audio_probe,
  463. .driver = {
  464. .name = "kbl_rt5660",
  465. .pm = &snd_soc_pm_ops,
  466. },
  467. .id_table = kbl_board_ids,
  468. };
  469. module_platform_driver(kabylake_audio)
  470. /* Module information */
  471. MODULE_DESCRIPTION("Audio Machine driver-RT5660 in I2S mode");
  472. MODULE_AUTHOR("Hui Wang <[email protected]>");
  473. MODULE_LICENSE("GPL v2");