acp3x-rt5682-max9836.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  1. // SPDX-License-Identifier: GPL-2.0+
  2. //
  3. // Machine driver for AMD ACP Audio engine using DA7219 & MAX98357 codec.
  4. //
  5. //Copyright 2016 Advanced Micro Devices, Inc.
  6. #include <sound/core.h>
  7. #include <sound/soc.h>
  8. #include <sound/pcm.h>
  9. #include <sound/pcm_params.h>
  10. #include <sound/soc-dapm.h>
  11. #include <sound/jack.h>
  12. #include <linux/clk.h>
  13. #include <linux/gpio.h>
  14. #include <linux/gpio/consumer.h>
  15. #include <linux/module.h>
  16. #include <linux/i2c.h>
  17. #include <linux/input.h>
  18. #include <linux/io.h>
  19. #include <linux/acpi.h>
  20. #include "raven/acp3x.h"
  21. #include "../codecs/rt5682.h"
  22. #include "../codecs/rt1015.h"
  23. #define PCO_PLAT_CLK 48000000
  24. #define RT5682_PLL_FREQ (48000 * 512)
  25. #define DUAL_CHANNEL 2
  26. static struct snd_soc_jack pco_jack;
  27. static struct clk *rt5682_dai_wclk;
  28. static struct clk *rt5682_dai_bclk;
  29. static struct gpio_desc *dmic_sel;
  30. void *soc_is_rltk_max(struct device *dev);
  31. enum {
  32. RT5682 = 0,
  33. MAX,
  34. EC,
  35. };
  36. static int acp3x_5682_init(struct snd_soc_pcm_runtime *rtd)
  37. {
  38. int ret;
  39. struct snd_soc_card *card = rtd->card;
  40. struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
  41. struct snd_soc_component *component = codec_dai->component;
  42. dev_info(rtd->dev, "codec dai name = %s\n", codec_dai->name);
  43. /* set rt5682 dai fmt */
  44. ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S
  45. | SND_SOC_DAIFMT_NB_NF
  46. | SND_SOC_DAIFMT_CBP_CFP);
  47. if (ret < 0) {
  48. dev_err(rtd->card->dev,
  49. "Failed to set rt5682 dai fmt: %d\n", ret);
  50. return ret;
  51. }
  52. /* set codec PLL */
  53. ret = snd_soc_dai_set_pll(codec_dai, RT5682_PLL2, RT5682_PLL2_S_MCLK,
  54. PCO_PLAT_CLK, RT5682_PLL_FREQ);
  55. if (ret < 0) {
  56. dev_err(rtd->dev, "can't set rt5682 PLL: %d\n", ret);
  57. return ret;
  58. }
  59. /* Set codec sysclk */
  60. ret = snd_soc_dai_set_sysclk(codec_dai, RT5682_SCLK_S_PLL2,
  61. RT5682_PLL_FREQ, SND_SOC_CLOCK_IN);
  62. if (ret < 0) {
  63. dev_err(rtd->dev,
  64. "Failed to set rt5682 SYSCLK: %d\n", ret);
  65. return ret;
  66. }
  67. /* Set tdm/i2s1 master bclk ratio */
  68. ret = snd_soc_dai_set_bclk_ratio(codec_dai, 64);
  69. if (ret < 0) {
  70. dev_err(rtd->dev,
  71. "Failed to set rt5682 tdm bclk ratio: %d\n", ret);
  72. return ret;
  73. }
  74. rt5682_dai_wclk = clk_get(component->dev, "rt5682-dai-wclk");
  75. rt5682_dai_bclk = clk_get(component->dev, "rt5682-dai-bclk");
  76. ret = snd_soc_card_jack_new(card, "Headset Jack",
  77. SND_JACK_HEADSET | SND_JACK_LINEOUT |
  78. SND_JACK_BTN_0 | SND_JACK_BTN_1 |
  79. SND_JACK_BTN_2 | SND_JACK_BTN_3,
  80. &pco_jack);
  81. if (ret) {
  82. dev_err(card->dev, "HP jack creation failed %d\n", ret);
  83. return ret;
  84. }
  85. snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_0, KEY_PLAYPAUSE);
  86. snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_1, KEY_VOICECOMMAND);
  87. snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_2, KEY_VOLUMEUP);
  88. snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN);
  89. ret = snd_soc_component_set_jack(component, &pco_jack, NULL);
  90. if (ret) {
  91. dev_err(rtd->dev, "Headset Jack call-back failed: %d\n", ret);
  92. return ret;
  93. }
  94. return ret;
  95. }
  96. static int rt5682_clk_enable(struct snd_pcm_substream *substream)
  97. {
  98. int ret = 0;
  99. struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
  100. /* RT5682 will support only 48K output with 48M mclk */
  101. clk_set_rate(rt5682_dai_wclk, 48000);
  102. clk_set_rate(rt5682_dai_bclk, 48000 * 64);
  103. ret = clk_prepare_enable(rt5682_dai_wclk);
  104. if (ret < 0) {
  105. dev_err(rtd->dev, "can't enable wclk %d\n", ret);
  106. return ret;
  107. }
  108. return ret;
  109. }
  110. static int acp3x_1015_hw_params(struct snd_pcm_substream *substream,
  111. struct snd_pcm_hw_params *params)
  112. {
  113. struct snd_soc_pcm_runtime *rtd = substream->private_data;
  114. struct snd_soc_dai *codec_dai;
  115. int srate, i, ret;
  116. ret = 0;
  117. srate = params_rate(params);
  118. for_each_rtd_codec_dais(rtd, i, codec_dai) {
  119. if (strcmp(codec_dai->name, "rt1015-aif"))
  120. continue;
  121. ret = snd_soc_dai_set_pll(codec_dai, 0, RT1015_PLL_S_BCLK,
  122. 64 * srate, 256 * srate);
  123. if (ret < 0)
  124. return ret;
  125. ret = snd_soc_dai_set_sysclk(codec_dai, RT1015_SCLK_S_PLL,
  126. 256 * srate, SND_SOC_CLOCK_IN);
  127. if (ret < 0)
  128. return ret;
  129. }
  130. return ret;
  131. }
  132. static void rt5682_clk_disable(void)
  133. {
  134. clk_disable_unprepare(rt5682_dai_wclk);
  135. }
  136. static const unsigned int channels[] = {
  137. DUAL_CHANNEL,
  138. };
  139. static const unsigned int rates[] = {
  140. 48000,
  141. };
  142. static const struct snd_pcm_hw_constraint_list constraints_rates = {
  143. .count = ARRAY_SIZE(rates),
  144. .list = rates,
  145. .mask = 0,
  146. };
  147. static const struct snd_pcm_hw_constraint_list constraints_channels = {
  148. .count = ARRAY_SIZE(channels),
  149. .list = channels,
  150. .mask = 0,
  151. };
  152. static int acp3x_5682_startup(struct snd_pcm_substream *substream)
  153. {
  154. struct snd_pcm_runtime *runtime = substream->runtime;
  155. struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
  156. struct snd_soc_card *card = rtd->card;
  157. struct acp3x_platform_info *machine = snd_soc_card_get_drvdata(card);
  158. machine->play_i2s_instance = I2S_SP_INSTANCE;
  159. machine->cap_i2s_instance = I2S_SP_INSTANCE;
  160. runtime->hw.channels_max = DUAL_CHANNEL;
  161. snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
  162. &constraints_channels);
  163. snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
  164. &constraints_rates);
  165. return rt5682_clk_enable(substream);
  166. }
  167. static int acp3x_max_startup(struct snd_pcm_substream *substream)
  168. {
  169. struct snd_pcm_runtime *runtime = substream->runtime;
  170. struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
  171. struct snd_soc_card *card = rtd->card;
  172. struct acp3x_platform_info *machine = snd_soc_card_get_drvdata(card);
  173. machine->play_i2s_instance = I2S_BT_INSTANCE;
  174. runtime->hw.channels_max = DUAL_CHANNEL;
  175. snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
  176. &constraints_channels);
  177. snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
  178. &constraints_rates);
  179. return rt5682_clk_enable(substream);
  180. }
  181. static int acp3x_ec_dmic0_startup(struct snd_pcm_substream *substream)
  182. {
  183. struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
  184. struct snd_soc_card *card = rtd->card;
  185. struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
  186. struct acp3x_platform_info *machine = snd_soc_card_get_drvdata(card);
  187. machine->cap_i2s_instance = I2S_BT_INSTANCE;
  188. snd_soc_dai_set_bclk_ratio(codec_dai, 64);
  189. return rt5682_clk_enable(substream);
  190. }
  191. static int dmic_switch;
  192. static int dmic_get(struct snd_kcontrol *kcontrol,
  193. struct snd_ctl_elem_value *ucontrol)
  194. {
  195. ucontrol->value.integer.value[0] = dmic_switch;
  196. return 0;
  197. }
  198. static int dmic_set(struct snd_kcontrol *kcontrol,
  199. struct snd_ctl_elem_value *ucontrol)
  200. {
  201. if (dmic_sel) {
  202. dmic_switch = ucontrol->value.integer.value[0];
  203. gpiod_set_value(dmic_sel, dmic_switch);
  204. }
  205. return 0;
  206. }
  207. static void rt5682_shutdown(struct snd_pcm_substream *substream)
  208. {
  209. rt5682_clk_disable();
  210. }
  211. static const struct snd_soc_ops acp3x_5682_ops = {
  212. .startup = acp3x_5682_startup,
  213. .shutdown = rt5682_shutdown,
  214. };
  215. static const struct snd_soc_ops acp3x_max_play_ops = {
  216. .startup = acp3x_max_startup,
  217. .shutdown = rt5682_shutdown,
  218. .hw_params = acp3x_1015_hw_params,
  219. };
  220. static const struct snd_soc_ops acp3x_ec_cap0_ops = {
  221. .startup = acp3x_ec_dmic0_startup,
  222. .shutdown = rt5682_shutdown,
  223. };
  224. SND_SOC_DAILINK_DEF(acp3x_i2s,
  225. DAILINK_COMP_ARRAY(COMP_CPU("acp3x_i2s_playcap.0")));
  226. SND_SOC_DAILINK_DEF(acp3x_bt,
  227. DAILINK_COMP_ARRAY(COMP_CPU("acp3x_i2s_playcap.2")));
  228. SND_SOC_DAILINK_DEF(rt5682,
  229. DAILINK_COMP_ARRAY(COMP_CODEC("i2c-10EC5682:00", "rt5682-aif1")));
  230. SND_SOC_DAILINK_DEF(max,
  231. DAILINK_COMP_ARRAY(COMP_CODEC("MX98357A:00", "HiFi")));
  232. SND_SOC_DAILINK_DEF(rt1015p,
  233. DAILINK_COMP_ARRAY(COMP_CODEC("RTL1015:00", "HiFi")));
  234. SND_SOC_DAILINK_DEF(rt1015,
  235. DAILINK_COMP_ARRAY(COMP_CODEC("i2c-10EC1015:00", "rt1015-aif"),
  236. COMP_CODEC("i2c-10EC1015:01", "rt1015-aif")));
  237. SND_SOC_DAILINK_DEF(cros_ec,
  238. DAILINK_COMP_ARRAY(COMP_CODEC("GOOG0013:00", "EC Codec I2S RX")));
  239. SND_SOC_DAILINK_DEF(platform,
  240. DAILINK_COMP_ARRAY(COMP_PLATFORM("acp3x_rv_i2s_dma.0")));
  241. static struct snd_soc_codec_conf rt1015_conf[] = {
  242. {
  243. .dlc = COMP_CODEC_CONF("i2c-10EC1015:00"),
  244. .name_prefix = "Left",
  245. },
  246. {
  247. .dlc = COMP_CODEC_CONF("i2c-10EC1015:01"),
  248. .name_prefix = "Right",
  249. },
  250. };
  251. static struct snd_soc_dai_link acp3x_dai[] = {
  252. [RT5682] = {
  253. .name = "acp3x-5682-play",
  254. .stream_name = "Playback",
  255. .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
  256. | SND_SOC_DAIFMT_CBP_CFP,
  257. .init = acp3x_5682_init,
  258. .dpcm_playback = 1,
  259. .dpcm_capture = 1,
  260. .ops = &acp3x_5682_ops,
  261. SND_SOC_DAILINK_REG(acp3x_i2s, rt5682, platform),
  262. },
  263. [MAX] = {
  264. .name = "acp3x-max98357-play",
  265. .stream_name = "HiFi Playback",
  266. .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
  267. | SND_SOC_DAIFMT_CBC_CFC,
  268. .dpcm_playback = 1,
  269. .ops = &acp3x_max_play_ops,
  270. .cpus = acp3x_bt,
  271. .num_cpus = ARRAY_SIZE(acp3x_bt),
  272. .platforms = platform,
  273. .num_platforms = ARRAY_SIZE(platform),
  274. },
  275. [EC] = {
  276. .name = "acp3x-ec-dmic0-capture",
  277. .stream_name = "Capture DMIC0",
  278. .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
  279. | SND_SOC_DAIFMT_CBC_CFC,
  280. .dpcm_capture = 1,
  281. .ops = &acp3x_ec_cap0_ops,
  282. SND_SOC_DAILINK_REG(acp3x_bt, cros_ec, platform),
  283. },
  284. };
  285. static const char * const dmic_mux_text[] = {
  286. "Front Mic",
  287. "Rear Mic",
  288. };
  289. static SOC_ENUM_SINGLE_DECL(
  290. acp3x_dmic_enum, SND_SOC_NOPM, 0, dmic_mux_text);
  291. static const struct snd_kcontrol_new acp3x_dmic_mux_control =
  292. SOC_DAPM_ENUM_EXT("DMIC Select Mux", acp3x_dmic_enum,
  293. dmic_get, dmic_set);
  294. static const struct snd_soc_dapm_widget acp3x_5682_widgets[] = {
  295. SND_SOC_DAPM_HP("Headphone Jack", NULL),
  296. SND_SOC_DAPM_SPK("Spk", NULL),
  297. SND_SOC_DAPM_MIC("Headset Mic", NULL),
  298. SND_SOC_DAPM_MUX("Dmic Mux", SND_SOC_NOPM, 0, 0,
  299. &acp3x_dmic_mux_control),
  300. };
  301. static const struct snd_soc_dapm_route acp3x_5682_audio_route[] = {
  302. {"Headphone Jack", NULL, "HPOL"},
  303. {"Headphone Jack", NULL, "HPOR"},
  304. {"IN1P", NULL, "Headset Mic"},
  305. {"Spk", NULL, "Speaker"},
  306. {"Dmic Mux", "Front Mic", "DMIC"},
  307. {"Dmic Mux", "Rear Mic", "DMIC"},
  308. };
  309. static const struct snd_kcontrol_new acp3x_5682_mc_controls[] = {
  310. SOC_DAPM_PIN_SWITCH("Headphone Jack"),
  311. SOC_DAPM_PIN_SWITCH("Spk"),
  312. SOC_DAPM_PIN_SWITCH("Headset Mic"),
  313. };
  314. static struct snd_soc_card acp3x_5682 = {
  315. .name = "acp3xalc5682m98357",
  316. .owner = THIS_MODULE,
  317. .dai_link = acp3x_dai,
  318. .num_links = ARRAY_SIZE(acp3x_dai),
  319. .dapm_widgets = acp3x_5682_widgets,
  320. .num_dapm_widgets = ARRAY_SIZE(acp3x_5682_widgets),
  321. .dapm_routes = acp3x_5682_audio_route,
  322. .num_dapm_routes = ARRAY_SIZE(acp3x_5682_audio_route),
  323. .controls = acp3x_5682_mc_controls,
  324. .num_controls = ARRAY_SIZE(acp3x_5682_mc_controls),
  325. };
  326. static const struct snd_soc_dapm_widget acp3x_1015_widgets[] = {
  327. SND_SOC_DAPM_HP("Headphone Jack", NULL),
  328. SND_SOC_DAPM_MIC("Headset Mic", NULL),
  329. SND_SOC_DAPM_MUX("Dmic Mux", SND_SOC_NOPM, 0, 0,
  330. &acp3x_dmic_mux_control),
  331. SND_SOC_DAPM_SPK("Left Spk", NULL),
  332. SND_SOC_DAPM_SPK("Right Spk", NULL),
  333. };
  334. static const struct snd_soc_dapm_route acp3x_1015_route[] = {
  335. {"Headphone Jack", NULL, "HPOL"},
  336. {"Headphone Jack", NULL, "HPOR"},
  337. {"IN1P", NULL, "Headset Mic"},
  338. {"Dmic Mux", "Front Mic", "DMIC"},
  339. {"Dmic Mux", "Rear Mic", "DMIC"},
  340. {"Left Spk", NULL, "Left SPO"},
  341. {"Right Spk", NULL, "Right SPO"},
  342. };
  343. static const struct snd_kcontrol_new acp3x_mc_1015_controls[] = {
  344. SOC_DAPM_PIN_SWITCH("Headphone Jack"),
  345. SOC_DAPM_PIN_SWITCH("Headset Mic"),
  346. SOC_DAPM_PIN_SWITCH("Left Spk"),
  347. SOC_DAPM_PIN_SWITCH("Right Spk"),
  348. };
  349. static struct snd_soc_card acp3x_1015 = {
  350. .name = "acp3xalc56821015",
  351. .owner = THIS_MODULE,
  352. .dai_link = acp3x_dai,
  353. .num_links = ARRAY_SIZE(acp3x_dai),
  354. .dapm_widgets = acp3x_1015_widgets,
  355. .num_dapm_widgets = ARRAY_SIZE(acp3x_1015_widgets),
  356. .dapm_routes = acp3x_1015_route,
  357. .num_dapm_routes = ARRAY_SIZE(acp3x_1015_route),
  358. .codec_conf = rt1015_conf,
  359. .num_configs = ARRAY_SIZE(rt1015_conf),
  360. .controls = acp3x_mc_1015_controls,
  361. .num_controls = ARRAY_SIZE(acp3x_mc_1015_controls),
  362. };
  363. static const struct snd_soc_dapm_widget acp3x_1015p_widgets[] = {
  364. SND_SOC_DAPM_HP("Headphone Jack", NULL),
  365. SND_SOC_DAPM_MIC("Headset Mic", NULL),
  366. SND_SOC_DAPM_MUX("Dmic Mux", SND_SOC_NOPM, 0, 0,
  367. &acp3x_dmic_mux_control),
  368. SND_SOC_DAPM_SPK("Speakers", NULL),
  369. };
  370. static const struct snd_soc_dapm_route acp3x_1015p_route[] = {
  371. {"Headphone Jack", NULL, "HPOL"},
  372. {"Headphone Jack", NULL, "HPOR"},
  373. {"IN1P", NULL, "Headset Mic"},
  374. {"Dmic Mux", "Front Mic", "DMIC"},
  375. {"Dmic Mux", "Rear Mic", "DMIC"},
  376. /* speaker */
  377. { "Speakers", NULL, "Speaker" },
  378. };
  379. static const struct snd_kcontrol_new acp3x_mc_1015p_controls[] = {
  380. SOC_DAPM_PIN_SWITCH("Speakers"),
  381. SOC_DAPM_PIN_SWITCH("Headphone Jack"),
  382. SOC_DAPM_PIN_SWITCH("Headset Mic"),
  383. };
  384. static struct snd_soc_card acp3x_1015p = {
  385. .name = "acp3xalc56821015p",
  386. .owner = THIS_MODULE,
  387. .dai_link = acp3x_dai,
  388. .num_links = ARRAY_SIZE(acp3x_dai),
  389. .dapm_widgets = acp3x_1015p_widgets,
  390. .num_dapm_widgets = ARRAY_SIZE(acp3x_1015p_widgets),
  391. .dapm_routes = acp3x_1015p_route,
  392. .num_dapm_routes = ARRAY_SIZE(acp3x_1015p_route),
  393. .controls = acp3x_mc_1015p_controls,
  394. .num_controls = ARRAY_SIZE(acp3x_mc_1015p_controls),
  395. };
  396. void *soc_is_rltk_max(struct device *dev)
  397. {
  398. const struct acpi_device_id *match;
  399. match = acpi_match_device(dev->driver->acpi_match_table, dev);
  400. if (!match)
  401. return NULL;
  402. return (void *)match->driver_data;
  403. }
  404. static void card_spk_dai_link_present(struct snd_soc_dai_link *links,
  405. const char *card_name)
  406. {
  407. if (!strcmp(card_name, "acp3xalc56821015")) {
  408. links[1].codecs = rt1015;
  409. links[1].num_codecs = ARRAY_SIZE(rt1015);
  410. } else if (!strcmp(card_name, "acp3xalc56821015p")) {
  411. links[1].codecs = rt1015p;
  412. links[1].num_codecs = ARRAY_SIZE(rt1015p);
  413. } else {
  414. links[1].codecs = max;
  415. links[1].num_codecs = ARRAY_SIZE(max);
  416. }
  417. }
  418. static int acp3x_probe(struct platform_device *pdev)
  419. {
  420. int ret;
  421. struct snd_soc_card *card;
  422. struct acp3x_platform_info *machine;
  423. struct device *dev = &pdev->dev;
  424. card = (struct snd_soc_card *)soc_is_rltk_max(dev);
  425. if (!card)
  426. return -ENODEV;
  427. machine = devm_kzalloc(&pdev->dev, sizeof(*machine), GFP_KERNEL);
  428. if (!machine)
  429. return -ENOMEM;
  430. card_spk_dai_link_present(card->dai_link, card->name);
  431. card->dev = &pdev->dev;
  432. platform_set_drvdata(pdev, card);
  433. snd_soc_card_set_drvdata(card, machine);
  434. dmic_sel = devm_gpiod_get(&pdev->dev, "dmic", GPIOD_OUT_LOW);
  435. if (IS_ERR(dmic_sel)) {
  436. dev_err(&pdev->dev, "DMIC gpio failed err=%ld\n",
  437. PTR_ERR(dmic_sel));
  438. return PTR_ERR(dmic_sel);
  439. }
  440. ret = devm_snd_soc_register_card(&pdev->dev, card);
  441. if (ret) {
  442. return dev_err_probe(&pdev->dev, ret,
  443. "devm_snd_soc_register_card(%s) failed\n",
  444. card->name);
  445. }
  446. return 0;
  447. }
  448. static const struct acpi_device_id acp3x_audio_acpi_match[] = {
  449. { "AMDI5682", (unsigned long)&acp3x_5682},
  450. { "AMDI1015", (unsigned long)&acp3x_1015},
  451. { "10021015", (unsigned long)&acp3x_1015p},
  452. {},
  453. };
  454. MODULE_DEVICE_TABLE(acpi, acp3x_audio_acpi_match);
  455. static struct platform_driver acp3x_audio = {
  456. .driver = {
  457. .name = "acp3x-alc5682-max98357",
  458. .acpi_match_table = ACPI_PTR(acp3x_audio_acpi_match),
  459. .pm = &snd_soc_pm_ops,
  460. },
  461. .probe = acp3x_probe,
  462. };
  463. module_platform_driver(acp3x_audio);
  464. MODULE_AUTHOR("[email protected]");
  465. MODULE_AUTHOR("[email protected]");
  466. MODULE_AUTHOR("[email protected]");
  467. MODULE_DESCRIPTION("ALC5682 ALC1015, ALC1015P & MAX98357 audio support");
  468. MODULE_LICENSE("GPL v2");