auto_spf_dummy.c 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (c) 2014-2021, The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  5. */
  6. #include <linux/clk.h>
  7. #include <linux/delay.h>
  8. #include <linux/gpio.h>
  9. #include <linux/of_gpio.h>
  10. #include <linux/platform_device.h>
  11. #include <linux/slab.h>
  12. #include <linux/io.h>
  13. #include <linux/module.h>
  14. #include <linux/input.h>
  15. #include <linux/of_device.h>
  16. #include <linux/pm_qos.h>
  17. #include <sound/core.h>
  18. #include <sound/soc.h>
  19. #include <sound/soc-dapm.h>
  20. #include <sound/pcm.h>
  21. #include <sound/pcm_params.h>
  22. #include <sound/info.h>
  23. #include <dsp/audio_notifier.h>
  24. #include <dsp/audio_prm.h>
  25. #include <soc/snd_event.h>
  26. #include "msm_dailink.h"
  27. #include "msm_common.h"
  28. #define DRV_NAME "spf-asoc-snd"
  29. #define DRV_PINCTRL_NAME "audio-pcm-pinctrl"
  30. #define __CHIPSET__ "SA8xx5 "
  31. #define MSM_DAILINK_NAME(name) (__CHIPSET__#name)
  32. #ifdef CONFIG_MSM_COUPLED_SSR
  33. enum subsys_state {
  34. SUBSYS_DOWN = 0,
  35. SUBSYS_UP = 1
  36. };
  37. enum subsys_doamin {
  38. SUBSYS_DOMAIN_ADSP = 0,
  39. SUBSYS_DOMAIN_MDSP,
  40. SUBSYS_DOMAIN_MAX
  41. };
  42. static struct dsps_state_t {
  43. struct mutex lock;
  44. enum subsys_state states[SUBSYS_DOMAIN_MAX];
  45. } dsps_state;
  46. #endif
  47. enum pinctrl_pin_state {
  48. STATE_SLEEP = 0, /* All pins are in sleep state */
  49. STATE_ACTIVE, /* TDM = active */
  50. };
  51. struct msm_pinctrl_info {
  52. struct pinctrl *pinctrl;
  53. struct pinctrl_state *sleep;
  54. struct pinctrl_state *active;
  55. enum pinctrl_pin_state curr_state;
  56. };
  57. static const char *const pin_states[] = {"sleep", "active"};
  58. static const char *const tdm_gpio_phandle[] = {"qcom,pri-tdm-gpios",
  59. "qcom,sec-tdm-gpios",
  60. "qcom,tert-tdm-gpios",
  61. "qcom,quat-tdm-gpios",
  62. "qcom,quin-tdm-gpios",
  63. "qcom,sen-tdm-gpios",
  64. "qcom,sep-tdm-gpios",
  65. "qcom,oct-tdm-gpios",
  66. "qcom,hsif0-tdm-gpios",
  67. "qcom,hsif1-tdm-gpios",
  68. "qcom,hsif2-tdm-gpios",
  69. };
  70. static const char *const mclk_gpio_phandle[] = { "qcom,internal-mclk1-gpios" };
  71. enum {
  72. TDM_PRI = 0,
  73. TDM_SEC,
  74. TDM_TERT,
  75. TDM_QUAT,
  76. TDM_QUIN,
  77. TDM_SEN,
  78. TDM_SEP,
  79. TDM_OCT,
  80. TDM_HSIF0,
  81. TDM_HSIF1,
  82. TDM_HSIF2,
  83. TDM_INTERFACE_MAX,
  84. };
  85. enum {
  86. IDX_PRIMARY_TDM_RX_0,
  87. IDX_PRIMARY_TDM_TX_0,
  88. IDX_SECONDARY_TDM_RX_0,
  89. IDX_SECONDARY_TDM_TX_0,
  90. IDX_TERTIARY_TDM_RX_0,
  91. IDX_TERTIARY_TDM_TX_0,
  92. IDX_QUATERNARY_TDM_RX_0,
  93. IDX_QUATERNARY_TDM_TX_0,
  94. IDX_QUINARY_TDM_RX_0,
  95. IDX_QUINARY_TDM_TX_0,
  96. IDX_SENARY_TDM_RX_0,
  97. IDX_SENARY_TDM_TX_0,
  98. IDX_SEPTENARY_TDM_RX_0,
  99. IDX_SEPTENARY_TDM_TX_0,
  100. IDX_OCTONARY_TDM_RX_0,
  101. IDX_OCTONARY_TDM_TX_0,
  102. IDX_HSIF0_TDM_RX_0,
  103. IDX_HSIF0_TDM_TX_0,
  104. IDX_HSIF1_TDM_RX_0,
  105. IDX_HSIF1_TDM_TX_0,
  106. IDX_HSIF2_TDM_RX_0,
  107. IDX_HSIF2_TDM_TX_0,
  108. IDX_HSIF3_TDM_RX_0,
  109. IDX_HSIF3_TDM_TX_0,
  110. IDX_HSIF4_TDM_RX_0,
  111. IDX_HSIF4_TDM_TX_0,
  112. IDX_QUATERNARY_TDM_RX_DUMMY_0,
  113. IDX_QUATERNARY_TDM_TX_DUMMY_0,
  114. IDX_QUINARY_TDM_RX_DUMMY_0,
  115. IDX_QUINARY_TDM_TX_DUMMY_0,
  116. IDX_GROUP_TDM_MAX,
  117. };
  118. enum msm_mclk_index {
  119. MCLK_NONE = -1,
  120. MCLK1 = 0,
  121. MCLK_MAX,
  122. };
  123. enum msm_mclk_status {
  124. MCLK_DISABLED = 0,
  125. MCLK_ENABLED,
  126. };
  127. struct msm_mclk_conf {
  128. struct mutex lock;
  129. enum msm_mclk_status mclk_status;
  130. };
  131. struct tdm_conf {
  132. struct mutex lock;
  133. u32 ref_cnt;
  134. };
  135. struct msm_asoc_mach_data {
  136. struct msm_common_pdata *common_pdata;
  137. struct tdm_conf tdm_intf_conf[TDM_INTERFACE_MAX];
  138. struct msm_pinctrl_info pinctrl_info[TDM_INTERFACE_MAX];
  139. bool mclk_used;
  140. struct msm_pinctrl_info mclk_pinctrl_info[MCLK_MAX];
  141. struct msm_mclk_conf mclk_conf[MCLK_MAX];
  142. struct snd_pcm_hardware hw_params;
  143. };
  144. static struct platform_device *spdev;
  145. static struct clk_cfg internal_mclk[MCLK_MAX] = {
  146. {
  147. CLOCK_ID_MCLK_1,
  148. IBIT_CLOCK_12_P288_MHZ,
  149. CLOCK_ATTRIBUTE_COUPLE_NO,
  150. CLOCK_ROOT_DEFAULT,
  151. }
  152. };
  153. struct snd_soc_card sa8155_snd_soc_card_auto_msm = {
  154. .name = "sa8155-adp-star-snd-card",
  155. };
  156. struct snd_soc_card sa8295_snd_soc_card_auto_msm = {
  157. .name = "sa8295-adp-star-snd-card",
  158. };
  159. struct snd_soc_card sa8255_snd_soc_card_auto_msm = {
  160. .name = "sa8255-adp-star-snd-card",
  161. };
  162. struct snd_soc_card sa7255_snd_soc_card_auto_msm = {
  163. .name = "sa7255-adp-star-snd-card",
  164. };
  165. /* FIXME: it may various on different platform,
  166. * better to move to dt configuration in future
  167. */
  168. static enum msm_mclk_index msm_get_mclk_index(int intf_idx)
  169. {
  170. switch (intf_idx) {
  171. /* for sa8255 */
  172. case TDM_HSIF2:
  173. return MCLK1;
  174. default: return MCLK_NONE;
  175. }
  176. }
  177. static int msm_tdm_get_intf_idx(u16 id)
  178. {
  179. switch (id) {
  180. case IDX_PRIMARY_TDM_RX_0:
  181. case IDX_PRIMARY_TDM_TX_0:
  182. return TDM_PRI;
  183. case IDX_SECONDARY_TDM_RX_0:
  184. case IDX_SECONDARY_TDM_TX_0:
  185. return TDM_SEC;
  186. case IDX_TERTIARY_TDM_RX_0:
  187. case IDX_TERTIARY_TDM_TX_0:
  188. return TDM_TERT;
  189. case IDX_QUATERNARY_TDM_RX_0:
  190. case IDX_QUATERNARY_TDM_TX_0:
  191. case IDX_QUATERNARY_TDM_RX_DUMMY_0:
  192. case IDX_QUATERNARY_TDM_TX_DUMMY_0:
  193. return TDM_QUAT;
  194. case IDX_QUINARY_TDM_RX_0:
  195. case IDX_QUINARY_TDM_TX_0:
  196. case IDX_QUINARY_TDM_RX_DUMMY_0:
  197. case IDX_QUINARY_TDM_TX_DUMMY_0:
  198. return TDM_QUIN;
  199. case IDX_SENARY_TDM_RX_0:
  200. case IDX_SENARY_TDM_TX_0:
  201. return TDM_SEN;
  202. case IDX_SEPTENARY_TDM_RX_0:
  203. case IDX_SEPTENARY_TDM_TX_0:
  204. return TDM_SEP;
  205. case IDX_OCTONARY_TDM_RX_0:
  206. case IDX_OCTONARY_TDM_TX_0:
  207. return TDM_OCT;
  208. case IDX_HSIF0_TDM_RX_0:
  209. case IDX_HSIF0_TDM_TX_0:
  210. return TDM_HSIF0;
  211. case IDX_HSIF1_TDM_RX_0:
  212. case IDX_HSIF1_TDM_TX_0:
  213. return TDM_HSIF1;
  214. case IDX_HSIF2_TDM_RX_0:
  215. case IDX_HSIF2_TDM_TX_0:
  216. return TDM_HSIF2;
  217. case IDX_HSIF3_TDM_RX_0:
  218. case IDX_HSIF3_TDM_TX_0:
  219. return TDM_SEC; //muxed
  220. case IDX_HSIF4_TDM_RX_0:
  221. case IDX_HSIF4_TDM_TX_0:
  222. return TDM_TERT; //muxed
  223. default: return -EINVAL;
  224. }
  225. }
  226. #ifdef CONFIG_MSM_COUPLED_SSR
  227. static void set_subsys_state_l(enum subsys_doamin subsys,
  228. enum subsys_state state)
  229. {
  230. dsps_state.states[subsys] = state;
  231. }
  232. static void set_combined_subsystem_state_l(enum subsys_state state)
  233. {
  234. int i;
  235. for (i = 0; i < SUBSYS_DOMAIN_MAX; i++)
  236. dsps_state.states[i] = state;
  237. }
  238. static enum subsys_state get_combined_dsps_state_l(void)
  239. {
  240. int i;
  241. for (i = 0; i < SUBSYS_DOMAIN_MAX; i++) {
  242. if (!dsps_state.states[i])
  243. return SUBSYS_DOWN;
  244. }
  245. return SUBSYS_UP;
  246. }
  247. static int modem_notifier_service_cb(struct notifier_block *this,
  248. unsigned long opcode, void *data)
  249. {
  250. pr_info("%s: modem pdr service opcode 0x%lx\n", __func__, opcode);
  251. switch (opcode) {
  252. case AUDIO_NOTIFIER_SERVICE_DOWN:
  253. mutex_lock(&dsps_state.lock);
  254. if (get_combined_dsps_state_l() == SUBSYS_UP) {
  255. set_combined_subsystem_state_l(SUBSYS_DOWN);
  256. pr_info("%s: setting snd_card to ONLINE\n", __func__);
  257. snd_card_notify_user(SND_CARD_STATUS_OFFLINE);
  258. }
  259. mutex_unlock(&dsps_state.lock);
  260. break;
  261. case AUDIO_NOTIFIER_SERVICE_UP:
  262. mutex_lock(&dsps_state.lock);
  263. set_subsys_state_l(SUBSYS_DOMAIN_MDSP, SUBSYS_UP);
  264. if (get_combined_dsps_state_l() == SUBSYS_UP) {
  265. pr_info("%s: setting snd_card to ONLINE\n", __func__);
  266. snd_card_notify_user(SND_CARD_STATUS_ONLINE);
  267. }
  268. mutex_unlock(&dsps_state.lock);
  269. break;
  270. default:
  271. break;
  272. }
  273. return NOTIFY_OK;
  274. }
  275. static struct notifier_block modem_service_nb = {
  276. .notifier_call = modem_notifier_service_cb,
  277. .priority = 0,
  278. };
  279. #endif
  280. static int auto_adsp_ssr_enable(struct device *dev, void *data)
  281. {
  282. struct platform_device *pdev = to_platform_device(dev);
  283. struct snd_soc_card *card = platform_get_drvdata(pdev);
  284. int ret = 0;
  285. if (!card) {
  286. dev_err(dev, "%s: card is NULL\n", __func__);
  287. ret = -EINVAL;
  288. goto err;
  289. }
  290. #ifdef CONFIG_MSM_COUPLED_SSR
  291. mutex_lock(&dsps_state.lock);
  292. set_subsys_state_l(SUBSYS_DOMAIN_ADSP, SUBSYS_UP);
  293. if (get_combined_dsps_state_l() == SUBSYS_UP) {
  294. dev_dbg(dev, "%s: setting snd_card to ONLINE\n", __func__);
  295. snd_card_notify_user(SND_CARD_STATUS_ONLINE);
  296. }
  297. mutex_unlock(&dsps_state.lock);
  298. #else
  299. dev_dbg(dev, "%s: setting snd_card to ONLINE\n", __func__);
  300. snd_card_notify_user(SND_CARD_STATUS_ONLINE);
  301. #endif
  302. err:
  303. return ret;
  304. }
  305. static void auto_adsp_ssr_disable(struct device *dev, void *data)
  306. {
  307. struct platform_device *pdev = to_platform_device(dev);
  308. struct snd_soc_card *card = platform_get_drvdata(pdev);
  309. if (!card) {
  310. dev_err(dev, "%s: card is NULL\n", __func__);
  311. return;
  312. }
  313. #ifdef CONFIG_MSM_COUPLED_SSR
  314. mutex_lock(&dsps_state.lock);
  315. if (get_combined_dsps_state_l() == SUBSYS_UP) {
  316. set_combined_subsystem_state_l(SUBSYS_DOWN);
  317. dev_dbg(dev, "%s: setting snd_card to OFFLINE\n", __func__);
  318. snd_card_notify_user(SND_CARD_STATUS_OFFLINE);
  319. }
  320. mutex_unlock(&dsps_state.lock);
  321. #else
  322. dev_dbg(dev, "%s: setting snd_card to OFFLINE\n", __func__);
  323. snd_card_notify_user(SND_CARD_STATUS_OFFLINE);
  324. #endif
  325. }
  326. static const struct snd_event_ops auto_adsp_ssr_ops = {
  327. .enable = auto_adsp_ssr_enable,
  328. .disable = auto_adsp_ssr_disable,
  329. };
  330. static int msm_audio_ssr_compare(struct device *dev, void *data)
  331. {
  332. struct device_node *node = data;
  333. dev_dbg(dev, "%s: dev->of_node = 0x%p, node = 0x%p\n",
  334. __func__, dev->of_node, node);
  335. return (dev->of_node && dev->of_node == node);
  336. }
  337. static int msm_audio_adsp_ssr_register(struct device *dev)
  338. {
  339. struct device_node *np = dev->of_node;
  340. struct snd_event_clients *ssr_clients = NULL;
  341. struct device_node *node = NULL;
  342. int ret = 0;
  343. int i = 0;
  344. for (i = 0; ; i++) {
  345. node = of_parse_phandle(np, "qcom,msm_audio_ssr_devs", i);
  346. if (!node)
  347. break;
  348. snd_event_mstr_add_client(&ssr_clients,
  349. msm_audio_ssr_compare, node);
  350. }
  351. ret = snd_event_master_register(dev, &auto_adsp_ssr_ops,
  352. ssr_clients, NULL);
  353. if (!ret)
  354. snd_event_notify(dev, SND_EVENT_UP);
  355. return ret;
  356. }
  357. static int msm_set_pinctrl(struct msm_pinctrl_info *pinctrl_info,
  358. enum pinctrl_pin_state new_state)
  359. {
  360. int ret = 0;
  361. int curr_state = 0;
  362. if (pinctrl_info == NULL) {
  363. pr_err("%s: pinctrl info is NULL\n", __func__);
  364. ret = -EINVAL;
  365. goto err;
  366. }
  367. if (pinctrl_info->pinctrl == NULL) {
  368. pr_err("%s: pinctrl handle is NULL\n", __func__);
  369. ret = -EINVAL;
  370. goto err;
  371. }
  372. curr_state = pinctrl_info->curr_state;
  373. pinctrl_info->curr_state = new_state;
  374. pr_debug("%s: curr_state = %s new_state = %s\n", __func__,
  375. pin_states[curr_state], pin_states[pinctrl_info->curr_state]);
  376. if (curr_state == pinctrl_info->curr_state) {
  377. pr_err("%s: pin already in same state\n", __func__);
  378. goto err;
  379. }
  380. if (curr_state != STATE_SLEEP &&
  381. pinctrl_info->curr_state != STATE_SLEEP) {
  382. pr_err("%s: pin state is already active, cannot switch\n",
  383. __func__);
  384. ret = -EIO;
  385. goto err;
  386. }
  387. switch (pinctrl_info->curr_state) {
  388. case STATE_ACTIVE:
  389. ret = pinctrl_select_state(pinctrl_info->pinctrl,
  390. pinctrl_info->active);
  391. if (ret) {
  392. pr_err("%s: state select to active failed with %d\n",
  393. __func__, ret);
  394. ret = -EIO;
  395. goto err;
  396. }
  397. break;
  398. case STATE_SLEEP:
  399. ret = pinctrl_select_state(pinctrl_info->pinctrl,
  400. pinctrl_info->sleep);
  401. if (ret) {
  402. pr_err("%s: state select to sleep failed with %d\n",
  403. __func__, ret);
  404. ret = -EIO;
  405. goto err;
  406. }
  407. break;
  408. default:
  409. pr_err("%s: pin state is invalid\n", __func__);
  410. return -EINVAL;
  411. }
  412. err:
  413. return ret;
  414. }
  415. static int msm_mclk_disable(struct snd_soc_card *card,
  416. enum msm_mclk_index index)
  417. {
  418. struct msm_asoc_mach_data *pdata = NULL;
  419. struct msm_pinctrl_info *pinctrl_info = NULL;
  420. int ret = 0;
  421. if (!card) {
  422. pr_err("%s: failed to get snd card!\n", __func__);
  423. return -EINVAL;
  424. }
  425. pdata = snd_soc_card_get_drvdata(card);
  426. if (!pdata) {
  427. pr_err("%s: no pdata\n", __func__);
  428. return -EINVAL;
  429. }
  430. if (!pdata->mclk_used) {
  431. pr_info("%s: mclk is not used\n", __func__);
  432. return 0;
  433. }
  434. mutex_lock(&pdata->mclk_conf[index].lock);
  435. pinctrl_info = &pdata->mclk_pinctrl_info[index];
  436. if (pinctrl_info && pinctrl_info->pinctrl) {
  437. ret = msm_set_pinctrl(pinctrl_info, STATE_SLEEP);
  438. if (ret != 0) {
  439. pr_err("%s: set pin state to sleep for mclk[%d], failed with %d\n",
  440. __func__, index, ret);
  441. }
  442. pinctrl_info->curr_state = STATE_SLEEP;
  443. }
  444. if (pdata->mclk_conf[index].mclk_status == MCLK_ENABLED) {
  445. ret = audio_prm_set_lpass_clk_cfg(&internal_mclk[index], 0);
  446. if (ret < 0) {
  447. pr_err("%s: audio_prm_set_lpass_clk_cfg failed to disable mclk[%d], err:%d\n",
  448. __func__, index, ret);
  449. }
  450. pdata->mclk_conf[index].mclk_status = MCLK_DISABLED;
  451. } else {
  452. pr_info("%s: mclk[%d] already disabled\n", __func__, index);
  453. }
  454. mutex_unlock(&pdata->mclk_conf[index].lock);
  455. return ret;
  456. }
  457. static int msm_mclk_enable(struct snd_soc_card *card,
  458. enum msm_mclk_index index)
  459. {
  460. struct msm_asoc_mach_data *pdata = NULL;
  461. struct msm_pinctrl_info *pinctrl_info = NULL;
  462. int ret = 0;
  463. if (!card) {
  464. pr_err("%s: failed to get snd card!\n", __func__);
  465. return -EINVAL;
  466. }
  467. pdata = snd_soc_card_get_drvdata(card);
  468. if (!pdata) {
  469. pr_err("%s: no pdata\n", __func__);
  470. return -EINVAL;
  471. }
  472. if (!pdata->mclk_used) {
  473. pr_info("%s: mclk is not used\n", __func__);
  474. return 0;
  475. }
  476. mutex_lock(&pdata->mclk_conf[index].lock);
  477. if (pdata->mclk_conf[index].mclk_status == MCLK_DISABLED) {
  478. ret = audio_prm_set_lpass_clk_cfg(&internal_mclk[index], 1);
  479. if (ret < 0) {
  480. pr_err("%s: audio_prm_set_lpass_clk_cfg failed to enable mclk[%d], err:%d\n",
  481. __func__, index, ret);
  482. } else {
  483. pdata->mclk_conf[index].mclk_status = MCLK_ENABLED;
  484. }
  485. } else {
  486. pr_info("%s: mclk[%d] already enabled\n", __func__, index);
  487. }
  488. pinctrl_info = &pdata->mclk_pinctrl_info[index];
  489. if (pinctrl_info && pinctrl_info->pinctrl) {
  490. ret = msm_set_pinctrl(pinctrl_info, STATE_ACTIVE);
  491. if (ret != 0) {
  492. pr_err("%s: set pin state to active for mclk[%d], failed with %d\n",
  493. __func__, index, ret);
  494. }
  495. pinctrl_info->curr_state = STATE_ACTIVE;
  496. }
  497. mutex_unlock(&pdata->mclk_conf[index].lock);
  498. return ret;
  499. }
  500. static int tdm_snd_startup(struct snd_pcm_substream *substream)
  501. {
  502. int ret = 0;
  503. struct snd_soc_pcm_runtime *rtd = substream->private_data;
  504. struct snd_soc_card *card = rtd->card;
  505. struct snd_soc_dai_link *dai_link = rtd->dai_link;
  506. struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
  507. struct tdm_conf *intf_conf = NULL;
  508. struct msm_pinctrl_info *pinctrl_info = NULL;
  509. int ret_pinctrl = 0;
  510. int index, mclk_index;
  511. if (!dai_link->no_pcm)
  512. snd_soc_set_runtime_hwparams(substream, &pdata->hw_params);
  513. index = msm_tdm_get_intf_idx(dai_link->id);
  514. if (index < 0) {
  515. ret = -EINVAL;
  516. pr_err("%s: DAI link id (%d) out of range\n",
  517. __func__, dai_link->id);
  518. goto err;
  519. }
  520. if (pdata->mclk_used) {
  521. mclk_index = msm_get_mclk_index(index);
  522. if (mclk_index != MCLK_NONE)
  523. msm_mclk_enable(card, mclk_index);
  524. }
  525. /*
  526. * Mutex protection in case the same TDM
  527. * interface using for both TX and RX so
  528. * that the same clock won't be enable twice.
  529. */
  530. intf_conf = &pdata->tdm_intf_conf[index];
  531. mutex_lock(&intf_conf->lock);
  532. if (++intf_conf->ref_cnt == 1) {
  533. pinctrl_info = &pdata->pinctrl_info[index];
  534. if (pinctrl_info->pinctrl) {
  535. ret_pinctrl = msm_set_pinctrl(pinctrl_info,
  536. STATE_ACTIVE);
  537. if (ret_pinctrl)
  538. pr_err("%s: TDM TLMM pinctrl set failed with %d\n",
  539. __func__, ret_pinctrl);
  540. }
  541. }
  542. mutex_unlock(&intf_conf->lock);
  543. err:
  544. return ret;
  545. }
  546. static void tdm_snd_shutdown(struct snd_pcm_substream *substream)
  547. {
  548. struct snd_soc_pcm_runtime *rtd = substream->private_data;
  549. struct snd_soc_card *card = rtd->card;
  550. struct snd_soc_dai_link *dai_link = rtd->dai_link;
  551. struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
  552. struct msm_pinctrl_info *pinctrl_info = NULL;
  553. struct tdm_conf *intf_conf = NULL;
  554. int ret_pinctrl = 0;
  555. int index, mclk_index;
  556. pr_debug("%s: substream = %s, stream = %d\n", __func__,
  557. substream->name, substream->stream);
  558. index = msm_tdm_get_intf_idx(dai_link->id);
  559. if (index < 0) {
  560. pr_err("%s: DAI link id (%d) out of range\n",
  561. __func__, dai_link->id);
  562. return;
  563. }
  564. if (pdata->mclk_used) {
  565. mclk_index = msm_get_mclk_index(index);
  566. if (mclk_index != MCLK_NONE)
  567. msm_mclk_disable(card, mclk_index);
  568. }
  569. intf_conf = &pdata->tdm_intf_conf[index];
  570. mutex_lock(&intf_conf->lock);
  571. if (--intf_conf->ref_cnt == 0) {
  572. pinctrl_info = &pdata->pinctrl_info[index];
  573. if (pinctrl_info->pinctrl) {
  574. ret_pinctrl = msm_set_pinctrl(pinctrl_info,
  575. STATE_SLEEP);
  576. if (ret_pinctrl)
  577. pr_err("%s: TDM TLMM pinctrl set failed with %d\n",
  578. __func__, ret_pinctrl);
  579. }
  580. }
  581. mutex_unlock(&intf_conf->lock);
  582. }
  583. static const struct snd_soc_ops tdm_be_ops = {
  584. .startup = tdm_snd_startup,
  585. .shutdown = tdm_snd_shutdown
  586. };
  587. /* Digital audio interface glue - connects codec <---> CPU */
  588. static struct snd_soc_dai_link msm_common_dai_links[] = {
  589. /* BackEnd DAI Links */
  590. {
  591. .name = "LPASS_BE_AUXPCM_RX_DUMMY",
  592. .stream_name = "AUXPCM-LPAIF-RX-PRIMARY",
  593. .dpcm_playback = 1,
  594. .ops = &tdm_be_ops,
  595. .trigger = {SND_SOC_DPCM_TRIGGER_POST,
  596. SND_SOC_DPCM_TRIGGER_POST},
  597. .ignore_suspend = 1,
  598. .ignore_pmdown_time = 1,
  599. .id = IDX_PRIMARY_TDM_RX_0,
  600. SND_SOC_DAILINK_REG(lpass_be_auxpcm_rx_dummy),
  601. },
  602. {
  603. .name = "LPASS_BE_AUXPCM_TX_DUMMY",
  604. .stream_name = "AUXPCM-LPAIF-TX-PRIMARY",
  605. .dpcm_capture = 1,
  606. .ops = &tdm_be_ops,
  607. .trigger = {SND_SOC_DPCM_TRIGGER_POST,
  608. SND_SOC_DPCM_TRIGGER_POST},
  609. .ignore_suspend = 1,
  610. .ignore_pmdown_time = 1,
  611. .id = IDX_PRIMARY_TDM_TX_0,
  612. SND_SOC_DAILINK_REG(lpass_be_auxpcm_tx_dummy),
  613. },
  614. {
  615. .name = "SEC_TDM_RX_0",
  616. .stream_name = "TDM-LPAIF-RX-SECONDARY",
  617. .dpcm_playback = 1,
  618. .ops = &tdm_be_ops,
  619. .trigger = {SND_SOC_DPCM_TRIGGER_POST,
  620. SND_SOC_DPCM_TRIGGER_POST},
  621. .ignore_suspend = 1,
  622. .ignore_pmdown_time = 1,
  623. .id = IDX_SECONDARY_TDM_RX_0,
  624. SND_SOC_DAILINK_REG(sec_tdm_rx_0),
  625. },
  626. {
  627. .name = "SEC_TDM_TX_0",
  628. .stream_name = "TDM-LPAIF-TX-SECONDARY",
  629. .dpcm_capture = 1,
  630. .trigger = {SND_SOC_DPCM_TRIGGER_POST,
  631. SND_SOC_DPCM_TRIGGER_POST},
  632. .ops = &tdm_be_ops,
  633. .ignore_suspend = 1,
  634. .ignore_pmdown_time = 1,
  635. .id = IDX_SECONDARY_TDM_TX_0,
  636. SND_SOC_DAILINK_REG(sec_tdm_tx_0),
  637. },
  638. {
  639. .name = "TERT_TDM_RX_0",
  640. .stream_name = "TDM-LPAIF-RX-TERTIARY",
  641. .dpcm_playback = 1,
  642. .trigger = {SND_SOC_DPCM_TRIGGER_POST,
  643. SND_SOC_DPCM_TRIGGER_POST},
  644. .ops = &tdm_be_ops,
  645. .ignore_suspend = 1,
  646. .ignore_pmdown_time = 1,
  647. .id = IDX_TERTIARY_TDM_RX_0,
  648. SND_SOC_DAILINK_REG(tert_tdm_rx_0),
  649. },
  650. {
  651. .name = "TERT_TDM_TX_0",
  652. .stream_name = "TDM-LPAIF-TX-TERTIARY",
  653. .dpcm_capture = 1,
  654. .trigger = {SND_SOC_DPCM_TRIGGER_POST,
  655. SND_SOC_DPCM_TRIGGER_POST},
  656. .ops = &tdm_be_ops,
  657. .ignore_suspend = 1,
  658. .ignore_pmdown_time = 1,
  659. .id = IDX_TERTIARY_TDM_TX_0,
  660. SND_SOC_DAILINK_REG(tert_tdm_tx_0),
  661. },
  662. {
  663. .name = "QUAT_TDM_RX_0",
  664. .stream_name = "TDM-LPAIF_RXTX-RX-PRIMARY",
  665. .dpcm_playback = 1,
  666. .trigger = {SND_SOC_DPCM_TRIGGER_POST,
  667. SND_SOC_DPCM_TRIGGER_POST},
  668. .ops = &tdm_be_ops,
  669. .ignore_suspend = 1,
  670. .ignore_pmdown_time = 1,
  671. .id = IDX_QUATERNARY_TDM_RX_0,
  672. SND_SOC_DAILINK_REG(quat_tdm_rx_0),
  673. },
  674. {
  675. .name = "QUAT_TDM_TX_0",
  676. .stream_name = "TDM-LPAIF_RXTX-TX-PRIMARY",
  677. .dpcm_capture = 1,
  678. .trigger = {SND_SOC_DPCM_TRIGGER_POST,
  679. SND_SOC_DPCM_TRIGGER_POST},
  680. .ops = &tdm_be_ops,
  681. .ignore_suspend = 1,
  682. .ignore_pmdown_time = 1,
  683. .id = IDX_QUATERNARY_TDM_TX_0,
  684. SND_SOC_DAILINK_REG(quat_tdm_tx_0),
  685. },
  686. {
  687. .name = "QUIN_TDM_RX_0",
  688. .stream_name = "TDM-LPAIF_VA-RX-PRIMARY",
  689. .dpcm_playback = 1,
  690. .trigger = {SND_SOC_DPCM_TRIGGER_POST,
  691. SND_SOC_DPCM_TRIGGER_POST},
  692. .ops = &tdm_be_ops,
  693. .ignore_suspend = 1,
  694. .ignore_pmdown_time = 1,
  695. .id = IDX_QUINARY_TDM_RX_0,
  696. SND_SOC_DAILINK_REG(quin_tdm_rx_0),
  697. },
  698. {
  699. .name = "QUIN_TDM_TX_0",
  700. .stream_name = "TDM-LPAIF_VA-TX-PRIMARY",
  701. .dpcm_capture = 1,
  702. .trigger = {SND_SOC_DPCM_TRIGGER_POST,
  703. SND_SOC_DPCM_TRIGGER_POST},
  704. .ops = &tdm_be_ops,
  705. .ignore_suspend = 1,
  706. .ignore_pmdown_time = 1,
  707. .id = IDX_QUINARY_TDM_TX_0,
  708. SND_SOC_DAILINK_REG(quin_tdm_tx_0),
  709. },
  710. {
  711. .name = "SEN_TDM_RX_0",
  712. .stream_name = "TDM-LPAIF_WSA-RX-PRIMARY",
  713. .dpcm_playback = 1,
  714. .trigger = {SND_SOC_DPCM_TRIGGER_POST,
  715. SND_SOC_DPCM_TRIGGER_POST},
  716. .ops = &tdm_be_ops,
  717. .ignore_suspend = 1,
  718. .ignore_pmdown_time = 1,
  719. .id = IDX_SENARY_TDM_RX_0,
  720. SND_SOC_DAILINK_REG(sen_tdm_rx_0),
  721. },
  722. {
  723. .name = "SEN_TDM_TX_0",
  724. .stream_name = "TDM-LPAIF_WSA-TX-PRIMARY",
  725. .dpcm_capture = 1,
  726. .trigger = {SND_SOC_DPCM_TRIGGER_POST,
  727. SND_SOC_DPCM_TRIGGER_POST},
  728. .ops = &tdm_be_ops,
  729. .ignore_suspend = 1,
  730. .ignore_pmdown_time = 1,
  731. .id = IDX_SENARY_TDM_TX_0,
  732. SND_SOC_DAILINK_REG(sen_tdm_tx_0),
  733. },
  734. {
  735. .name = "SEP_TDM_RX_0",
  736. .stream_name = "TDM-LPAIF_AUD-RX-PRIMARY",
  737. .dpcm_playback = 1,
  738. .trigger = {SND_SOC_DPCM_TRIGGER_POST,
  739. SND_SOC_DPCM_TRIGGER_POST},
  740. .ops = &tdm_be_ops,
  741. .ignore_suspend = 1,
  742. .ignore_pmdown_time = 1,
  743. .id = IDX_SEPTENARY_TDM_RX_0,
  744. SND_SOC_DAILINK_REG(sep_tdm_rx_0),
  745. },
  746. {
  747. .name = "SEP_TDM_TX_0",
  748. .stream_name = "TDM-LPAIF_AUD-TX-PRIMARY",
  749. .dpcm_capture = 1,
  750. .trigger = {SND_SOC_DPCM_TRIGGER_POST,
  751. SND_SOC_DPCM_TRIGGER_POST},
  752. .ops = &tdm_be_ops,
  753. .ignore_suspend = 1,
  754. .ignore_pmdown_time = 1,
  755. .id = IDX_SEPTENARY_TDM_TX_0,
  756. SND_SOC_DAILINK_REG(sep_tdm_tx_0),
  757. },
  758. {
  759. .name = "OCT_TDM_RX_0",
  760. .stream_name = "TDM-LPAIF_WSA2-RX-PRIMARY",
  761. .dpcm_playback = 1,
  762. .trigger = {SND_SOC_DPCM_TRIGGER_POST,
  763. SND_SOC_DPCM_TRIGGER_POST},
  764. .ops = &tdm_be_ops,
  765. .ignore_suspend = 1,
  766. .ignore_pmdown_time = 1,
  767. .id = IDX_OCTONARY_TDM_RX_0,
  768. SND_SOC_DAILINK_REG(oct_tdm_rx_0),
  769. },
  770. {
  771. .name = "OCT_TDM_TX_0",
  772. .stream_name = "TDM-LPAIF_WSA2-TX-PRIMARY",
  773. .dpcm_capture = 1,
  774. .trigger = {SND_SOC_DPCM_TRIGGER_POST,
  775. SND_SOC_DPCM_TRIGGER_POST},
  776. .ops = &tdm_be_ops,
  777. .ignore_suspend = 1,
  778. .ignore_pmdown_time = 1,
  779. .id = IDX_OCTONARY_TDM_TX_0,
  780. SND_SOC_DAILINK_REG(oct_tdm_tx_0),
  781. },
  782. {
  783. .name = "HS_IF0_TDM_RX_0",
  784. .stream_name = "TDM-LPAIF_SDR-RX-PRIMARY",
  785. .dpcm_playback = 1,
  786. .trigger = {SND_SOC_DPCM_TRIGGER_POST,
  787. SND_SOC_DPCM_TRIGGER_POST},
  788. .ops = &tdm_be_ops,
  789. .ignore_suspend = 1,
  790. .ignore_pmdown_time = 1,
  791. .id = IDX_HSIF0_TDM_RX_0,
  792. SND_SOC_DAILINK_REG(hs_if0_tdm_rx_0),
  793. },
  794. {
  795. .name = "HS_IF0_TDM_TX_0",
  796. .stream_name = "TDM-LPAIF_SDR-TX-PRIMARY",
  797. .dpcm_capture = 1,
  798. .trigger = {SND_SOC_DPCM_TRIGGER_POST,
  799. SND_SOC_DPCM_TRIGGER_POST},
  800. .ops = &tdm_be_ops,
  801. .ignore_suspend = 1,
  802. .ignore_pmdown_time = 1,
  803. .id = IDX_HSIF0_TDM_TX_0,
  804. SND_SOC_DAILINK_REG(hs_if0_tdm_tx_0),
  805. },
  806. {
  807. .name = "HS_IF1_TDM_RX_0",
  808. .stream_name = "TDM-LPAIF_SDR-RX-SECONDARY",
  809. .dpcm_playback = 1,
  810. .trigger = {SND_SOC_DPCM_TRIGGER_POST,
  811. SND_SOC_DPCM_TRIGGER_POST},
  812. .ops = &tdm_be_ops,
  813. .ignore_suspend = 1,
  814. .ignore_pmdown_time = 1,
  815. .id = IDX_HSIF1_TDM_RX_0,
  816. SND_SOC_DAILINK_REG(hs_if1_tdm_rx_0),
  817. },
  818. {
  819. .name = "HS_IF1_TDM_TX_0",
  820. .stream_name = "TDM-LPAIF_SDR-TX-SECONDARY",
  821. .dpcm_capture = 1,
  822. .trigger = {SND_SOC_DPCM_TRIGGER_POST,
  823. SND_SOC_DPCM_TRIGGER_POST},
  824. .ops = &tdm_be_ops,
  825. .ignore_suspend = 1,
  826. .ignore_pmdown_time = 1,
  827. .id = IDX_HSIF1_TDM_TX_0,
  828. SND_SOC_DAILINK_REG(hs_if1_tdm_tx_0),
  829. },
  830. {
  831. .name = "HS_IF2_TDM_RX_0",
  832. .stream_name = "TDM-LPAIF_SDR-RX-TERTIARY",
  833. .dpcm_playback = 1,
  834. .trigger = {SND_SOC_DPCM_TRIGGER_POST,
  835. SND_SOC_DPCM_TRIGGER_POST},
  836. .ops = &tdm_be_ops,
  837. .ignore_suspend = 1,
  838. .ignore_pmdown_time = 1,
  839. .id = IDX_HSIF2_TDM_RX_0,
  840. SND_SOC_DAILINK_REG(hs_if2_tdm_rx_0),
  841. },
  842. {
  843. .name = "HS_IF2_TDM_TX_0",
  844. .stream_name = "TDM-LPAIF_SDR-TX-TERTIARY",
  845. .dpcm_capture = 1,
  846. .trigger = {SND_SOC_DPCM_TRIGGER_POST,
  847. SND_SOC_DPCM_TRIGGER_POST},
  848. .ops = &tdm_be_ops,
  849. .ignore_suspend = 1,
  850. .ignore_pmdown_time = 1,
  851. .id = IDX_HSIF2_TDM_TX_0,
  852. SND_SOC_DAILINK_REG(hs_if2_tdm_tx_0),
  853. },
  854. {
  855. .name = "HS_IF3_TDM_RX_0",
  856. .stream_name = "TDM-LPAIF_SDR-RX-QUATERNARY",
  857. .dpcm_playback = 1,
  858. .trigger = {SND_SOC_DPCM_TRIGGER_POST,
  859. SND_SOC_DPCM_TRIGGER_POST},
  860. .ops = &tdm_be_ops,
  861. .ignore_suspend = 1,
  862. .ignore_pmdown_time = 1,
  863. .id = IDX_HSIF3_TDM_RX_0,
  864. SND_SOC_DAILINK_REG(hs_if3_tdm_rx_0),
  865. },
  866. {
  867. .name = "HS_IF3_TDM_TX_0",
  868. .stream_name = "TDM-LPAIF_SDR-TX-QUATERNARY",
  869. .dpcm_capture = 1,
  870. .trigger = {SND_SOC_DPCM_TRIGGER_POST,
  871. SND_SOC_DPCM_TRIGGER_POST},
  872. .ops = &tdm_be_ops,
  873. .ignore_suspend = 1,
  874. .ignore_pmdown_time = 1,
  875. .id = IDX_HSIF3_TDM_TX_0,
  876. SND_SOC_DAILINK_REG(hs_if3_tdm_tx_0),
  877. },
  878. {
  879. .name = "HS_IF4_TDM_RX_0",
  880. .stream_name = "TDM-LPAIF_SDR-RX-QUINARY",
  881. .dpcm_playback = 1,
  882. .trigger = {SND_SOC_DPCM_TRIGGER_POST,
  883. SND_SOC_DPCM_TRIGGER_POST},
  884. .ops = &tdm_be_ops,
  885. .ignore_suspend = 1,
  886. .ignore_pmdown_time = 1,
  887. .id = IDX_HSIF4_TDM_RX_0,
  888. SND_SOC_DAILINK_REG(hs_if4_tdm_rx_0),
  889. },
  890. {
  891. .name = "HS_IF4_TDM_TX_0",
  892. .stream_name = "TDM-LPAIF_SDR-TX-QUINARY",
  893. .dpcm_capture = 1,
  894. .trigger = {SND_SOC_DPCM_TRIGGER_POST,
  895. SND_SOC_DPCM_TRIGGER_POST},
  896. .ops = &tdm_be_ops,
  897. .ignore_suspend = 1,
  898. .ignore_pmdown_time = 1,
  899. .id = IDX_HSIF4_TDM_TX_0,
  900. SND_SOC_DAILINK_REG(hs_if4_tdm_tx_0),
  901. },
  902. {
  903. .name = "QUAT_TDM_RX_0_DUMMY",
  904. .stream_name = "TDM-LPAIF-RX-QUATERNARY",
  905. .dpcm_playback = 1,
  906. .trigger = {SND_SOC_DPCM_TRIGGER_POST,
  907. SND_SOC_DPCM_TRIGGER_POST},
  908. .ops = &tdm_be_ops,
  909. .ignore_suspend = 1,
  910. .ignore_pmdown_time = 1,
  911. .id = IDX_QUATERNARY_TDM_RX_DUMMY_0,
  912. SND_SOC_DAILINK_REG(quat_tdm_rx_0_dummy),
  913. },
  914. {
  915. .name = "QUAT_TDM_TX_0_DUMMY",
  916. .stream_name = "TDM-LPAIF-TX-QUATERNARY",
  917. .dpcm_capture = 1,
  918. .trigger = {SND_SOC_DPCM_TRIGGER_POST,
  919. SND_SOC_DPCM_TRIGGER_POST},
  920. .ops = &tdm_be_ops,
  921. .ignore_suspend = 1,
  922. .ignore_pmdown_time = 1,
  923. .id = IDX_QUATERNARY_TDM_TX_DUMMY_0,
  924. SND_SOC_DAILINK_REG(quat_tdm_tx_0_dummy),
  925. },
  926. {
  927. .name = "QUIN_TDM_RX_0_DUMMY",
  928. .stream_name = "TDM-LPAIF-RX-QUINARY",
  929. .dpcm_playback = 1,
  930. .trigger = {SND_SOC_DPCM_TRIGGER_POST,
  931. SND_SOC_DPCM_TRIGGER_POST},
  932. .ops = &tdm_be_ops,
  933. .ignore_suspend = 1,
  934. .ignore_pmdown_time = 1,
  935. .id = IDX_QUINARY_TDM_RX_DUMMY_0,
  936. SND_SOC_DAILINK_REG(quin_tdm_rx_0_dummy),
  937. },
  938. {
  939. .name = "QUIN_TDM_TX_0_DUMMY",
  940. .stream_name = "TDM-LPAIF-TX-QUINARY",
  941. .dpcm_capture = 1,
  942. .trigger = {SND_SOC_DPCM_TRIGGER_POST,
  943. SND_SOC_DPCM_TRIGGER_POST},
  944. .ops = &tdm_be_ops,
  945. .ignore_suspend = 1,
  946. .ignore_pmdown_time = 1,
  947. .id = IDX_QUINARY_TDM_TX_DUMMY_0,
  948. SND_SOC_DAILINK_REG(quin_tdm_tx_0_dummy),
  949. },
  950. };
  951. static int msm_populate_dai_link_component_of_node(
  952. struct snd_soc_card *card)
  953. {
  954. int i, j, index, ret = 0;
  955. struct device *cdev = card->dev;
  956. struct snd_soc_dai_link *dai_link = card->dai_link;
  957. struct device_node *np;
  958. if (!cdev) {
  959. pr_err("%s: Sound card device memory NULL\n", __func__);
  960. return -ENODEV;
  961. }
  962. for (i = 0; i < card->num_links; i++) {
  963. if (dai_link[i].platforms->of_node && dai_link[i].cpus->of_node)
  964. continue;
  965. /* populate platform_of_node for snd card dai links
  966. * Skip this part for dummy snd card
  967. */
  968. if (0) {
  969. if (dai_link[i].platforms->name &&
  970. !dai_link[i].platforms->of_node) {
  971. index = of_property_match_string(cdev->of_node,
  972. "asoc-platform-names",
  973. dai_link[i].platforms->name);
  974. if (index < 0) {
  975. pr_err("%s: No match found for platform name: %s\n index: %i cdev_of_node: %s\n",
  976. __func__,
  977. dai_link[i].platforms->name,
  978. index,
  979. cdev->of_node);
  980. ret = index;
  981. goto err;
  982. }
  983. np = of_parse_phandle(cdev->of_node, "asoc-platform",
  984. index);
  985. if (!np) {
  986. pr_err("%s: retrieving phandle for platform %s, index %d failed\n",
  987. __func__, dai_link[i].platforms->name,
  988. index);
  989. ret = -ENODEV;
  990. goto err;
  991. }
  992. dai_link[i].platforms->of_node = np;
  993. dai_link[i].platforms->name = NULL;
  994. }
  995. }
  996. /* populate cpu_of_node for snd card dai links */
  997. if (dai_link[i].cpus->dai_name && !dai_link[i].cpus->of_node) {
  998. index = of_property_match_string(cdev->of_node,
  999. "asoc-cpu-names",
  1000. dai_link[i].cpus->dai_name);
  1001. pr_err("%s: retrieving cpu_of_node for %s\n",
  1002. __func__,
  1003. dai_link[i].cpus->dai_name);
  1004. if (index >= 0) {
  1005. np = of_parse_phandle(cdev->of_node, "asoc-cpu",
  1006. index);
  1007. if (!np) {
  1008. pr_err("%s: retrieving phandle for cpu dai %s failed\n",
  1009. __func__,
  1010. dai_link[i].cpus->dai_name);
  1011. ret = -ENODEV;
  1012. goto err;
  1013. }
  1014. dai_link[i].cpus->of_node = np;
  1015. dai_link[i].cpus->dai_name = NULL;
  1016. }
  1017. }
  1018. /* populate codec_of_node for snd card dai links */
  1019. if (dai_link[i].num_codecs > 0) {
  1020. for (j = 0; j < dai_link[i].num_codecs; j++) {
  1021. if (dai_link[i].codecs[j].of_node ||
  1022. !dai_link[i].codecs[j].name)
  1023. continue;
  1024. index = of_property_match_string(cdev->of_node,
  1025. "asoc-codec-names",
  1026. dai_link[i].codecs[j].name);
  1027. if (index < 0)
  1028. continue;
  1029. np = of_parse_phandle(cdev->of_node,
  1030. "asoc-codec",
  1031. index);
  1032. if (!np) {
  1033. pr_err("%s: retrieving phandle for codec %s failed\n",
  1034. __func__,
  1035. dai_link[i].codecs[j].name);
  1036. ret = -ENODEV;
  1037. goto err;
  1038. }
  1039. dai_link[i].codecs[j].of_node = np;
  1040. dai_link[i].codecs[j].name = NULL;
  1041. }
  1042. }
  1043. }
  1044. err:
  1045. return ret;
  1046. }
  1047. static const struct of_device_id asoc_machine_of_match[] = {
  1048. { .compatible = "qcom,sa8295-asoc-snd-adp-star",
  1049. .data = "adp_star_codec"},
  1050. { .compatible = "qcom,sa8155-asoc-snd-adp-star",
  1051. .data = "adp_star_codec"},
  1052. { .compatible = "qcom,sa8255-asoc-snd-adp-star",
  1053. .data = "adp_star_codec"},
  1054. { .compatible = "qcom,sa7255-asoc-snd-adp-star",
  1055. .data = "adp_star_codec"},
  1056. {},
  1057. };
  1058. static const struct of_device_id audio_pinctrl_dummy_match[] = {
  1059. { .compatible = "qcom,msm-pcm-pinctrl" },
  1060. { },
  1061. };
  1062. static struct snd_soc_dai_link msm_auto_dai_links[
  1063. ARRAY_SIZE(msm_common_dai_links)];
  1064. static struct snd_soc_card *populate_snd_card_dailinks(struct device *dev)
  1065. {
  1066. struct snd_soc_card *card = NULL;
  1067. struct snd_soc_dai_link *dailink;
  1068. int total_links;
  1069. const struct of_device_id *match;
  1070. match = of_match_node(asoc_machine_of_match, dev->of_node);
  1071. if (!match) {
  1072. dev_err(dev, "%s: No DT match found for sound card\n",
  1073. __func__);
  1074. return NULL;
  1075. }
  1076. if (!strcmp(match->compatible, "qcom,sa8155-asoc-snd-adp-star"))
  1077. card = &sa8155_snd_soc_card_auto_msm;
  1078. else if (!strcmp(match->compatible, "qcom,sa8295-asoc-snd-adp-star"))
  1079. card = &sa8295_snd_soc_card_auto_msm;
  1080. else if (!strcmp(match->compatible, "qcom,sa8255-asoc-snd-adp-star"))
  1081. card = &sa8255_snd_soc_card_auto_msm;
  1082. else if (!strcmp(match->compatible, "qcom,sa7255-asoc-snd-adp-star"))
  1083. card = &sa7255_snd_soc_card_auto_msm;
  1084. total_links = ARRAY_SIZE(msm_common_dai_links);
  1085. memcpy(msm_auto_dai_links,
  1086. msm_common_dai_links,
  1087. sizeof(msm_common_dai_links));
  1088. dailink = msm_auto_dai_links;
  1089. if (card) {
  1090. card->dai_link = dailink;
  1091. card->num_links = total_links;
  1092. }
  1093. return card;
  1094. }
  1095. static int msm_get_hwparams(struct platform_device *pdev)
  1096. {
  1097. struct snd_soc_card *card = NULL;
  1098. struct msm_asoc_mach_data *pdata = NULL;
  1099. u32 pcm_info = 0;
  1100. u32 buffer_bytes_max = 0;
  1101. u32 periods_bytes[2] = {0};
  1102. u32 periods_count[2] = {0};
  1103. int ret = 0;
  1104. card = platform_get_drvdata(pdev);
  1105. if (!card) {
  1106. pr_err("%s: card is NULL\n",
  1107. __func__);
  1108. return -EINVAL;
  1109. }
  1110. pdata = snd_soc_card_get_drvdata(card);
  1111. if (!pdata) {
  1112. pr_err("%s: pdata is NULL\n",
  1113. __func__);
  1114. return -EINVAL;
  1115. }
  1116. ret = of_property_read_u32(pdev->dev.of_node,
  1117. "qcom,hw_pcm_info",
  1118. &pcm_info);
  1119. if (ret) {
  1120. pr_err("%s: read pcm info failed\n",
  1121. __func__);
  1122. return ret;
  1123. }
  1124. ret = of_property_read_u32(pdev->dev.of_node,
  1125. "qcom,hw_buffer_size_max",
  1126. &buffer_bytes_max);
  1127. if (ret) {
  1128. pr_err("%s: read buffer size max failed\n",
  1129. __func__);
  1130. return ret;
  1131. }
  1132. ret = of_property_read_u32_array(pdev->dev.of_node,
  1133. "qcom,hw_period_byte_size",
  1134. periods_bytes, 2);
  1135. if (ret) {
  1136. pr_err("%s: read period byte size failed\n",
  1137. __func__);
  1138. return ret;
  1139. }
  1140. ret = of_property_read_u32_array(pdev->dev.of_node,
  1141. "qcom,hw_period_count_size",
  1142. periods_count, 2);
  1143. if (ret) {
  1144. pr_err("%s: read period count size failed\n",
  1145. __func__);
  1146. return ret;
  1147. }
  1148. pdata->hw_params.info = pcm_info;
  1149. pdata->hw_params.buffer_bytes_max = buffer_bytes_max;
  1150. pdata->hw_params.period_bytes_min = periods_bytes[0];
  1151. pdata->hw_params.period_bytes_max = periods_bytes[1];
  1152. pdata->hw_params.periods_min = periods_count[0];
  1153. pdata->hw_params.periods_max = periods_count[1];
  1154. return ret;
  1155. }
  1156. struct msm_common_pdata *msm_common_get_pdata(struct snd_soc_card *card)
  1157. {
  1158. struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
  1159. if (!pdata)
  1160. return NULL;
  1161. return pdata->common_pdata;
  1162. }
  1163. void msm_common_set_pdata(struct snd_soc_card *card,
  1164. struct msm_common_pdata *common_pdata)
  1165. {
  1166. struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
  1167. if (!pdata)
  1168. return;
  1169. pdata->common_pdata = common_pdata;
  1170. }
  1171. /*****************************************************************************
  1172. * pinctrl
  1173. *****************************************************************************/
  1174. static void msm_release_pinctrl(struct platform_device *pdev)
  1175. {
  1176. struct snd_soc_card *card = platform_get_drvdata(pdev);
  1177. struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
  1178. struct msm_pinctrl_info *pinctrl_info = NULL;
  1179. int i;
  1180. for (i = TDM_PRI; i < TDM_INTERFACE_MAX; i++) {
  1181. pinctrl_info = &pdata->pinctrl_info[i];
  1182. if (pinctrl_info == NULL)
  1183. continue;
  1184. if (pinctrl_info->pinctrl) {
  1185. devm_pinctrl_put(pinctrl_info->pinctrl);
  1186. pinctrl_info->pinctrl = NULL;
  1187. }
  1188. }
  1189. }
  1190. static void msm_release_mclk_pinctrl(struct platform_device *pdev)
  1191. {
  1192. struct snd_soc_card *card = platform_get_drvdata(pdev);
  1193. struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
  1194. struct msm_pinctrl_info *pinctrl_info = NULL;
  1195. int i;
  1196. for (i = 0; i < MCLK_MAX; i++) {
  1197. pinctrl_info = &pdata->mclk_pinctrl_info[i];
  1198. if (pinctrl_info == NULL)
  1199. continue;
  1200. if (pinctrl_info->pinctrl) {
  1201. devm_pinctrl_put(pinctrl_info->pinctrl);
  1202. pinctrl_info->pinctrl = NULL;
  1203. }
  1204. }
  1205. }
  1206. static int msm_get_pinctrl(struct platform_device *pdev)
  1207. {
  1208. struct snd_soc_card *card = platform_get_drvdata(pdev);
  1209. struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
  1210. struct msm_pinctrl_info *pinctrl_info = NULL;
  1211. struct pinctrl *pinctrl = NULL;
  1212. int i, j;
  1213. struct device_node *np = NULL;
  1214. struct platform_device *pdev_np = NULL;
  1215. int ret = 0;
  1216. for (i = TDM_PRI; i < TDM_INTERFACE_MAX; i++) {
  1217. np = of_parse_phandle(pdev->dev.of_node,
  1218. tdm_gpio_phandle[i], 0);
  1219. if (!np) {
  1220. pr_debug("%s: device node %s is null\n",
  1221. __func__, tdm_gpio_phandle[i]);
  1222. continue;
  1223. }
  1224. pdev_np = of_find_device_by_node(np);
  1225. if (!pdev_np) {
  1226. pr_err("%s: platform device not found\n",
  1227. __func__);
  1228. continue;
  1229. }
  1230. pinctrl_info = &pdata->pinctrl_info[i];
  1231. if (pinctrl_info == NULL) {
  1232. pr_err("%s: pinctrl info is null\n",
  1233. __func__);
  1234. continue;
  1235. }
  1236. pinctrl = devm_pinctrl_get(&pdev_np->dev);
  1237. if (IS_ERR_OR_NULL(pinctrl)) {
  1238. pr_err("%s: fail to get pinctrl handle\n",
  1239. __func__);
  1240. goto err;
  1241. }
  1242. pinctrl_info->pinctrl = pinctrl;
  1243. /* get all the states handles from Device Tree */
  1244. pinctrl_info->sleep = pinctrl_lookup_state(pinctrl,
  1245. "default");
  1246. if (IS_ERR(pinctrl_info->sleep)) {
  1247. pr_err("%s: could not get sleep pin state\n",
  1248. __func__);
  1249. goto err;
  1250. }
  1251. pinctrl_info->active = pinctrl_lookup_state(pinctrl,
  1252. "active");
  1253. if (IS_ERR(pinctrl_info->active)) {
  1254. pr_err("%s: could not get active pin state\n",
  1255. __func__);
  1256. goto err;
  1257. }
  1258. /* Reset the TLMM pins to a sleep state */
  1259. ret = pinctrl_select_state(pinctrl_info->pinctrl,
  1260. pinctrl_info->sleep);
  1261. if (ret != 0) {
  1262. pr_err("%s: set pin state to sleep failed with %d\n",
  1263. __func__, ret);
  1264. ret = -EIO;
  1265. goto err;
  1266. }
  1267. pinctrl_info->curr_state = STATE_SLEEP;
  1268. }
  1269. return 0;
  1270. err:
  1271. for (j = i; j >= 0; j--) {
  1272. pinctrl_info = &pdata->pinctrl_info[j];
  1273. if (pinctrl_info == NULL)
  1274. continue;
  1275. if (pinctrl_info->pinctrl) {
  1276. devm_pinctrl_put(pinctrl_info->pinctrl);
  1277. pinctrl_info->pinctrl = NULL;
  1278. }
  1279. }
  1280. return -EINVAL;
  1281. }
  1282. static int msm_get_mclk_pinctrl(struct platform_device *pdev)
  1283. {
  1284. struct snd_soc_card *card = platform_get_drvdata(pdev);
  1285. struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
  1286. struct msm_pinctrl_info *pinctrl_info = NULL;
  1287. struct pinctrl *pinctrl = NULL;
  1288. int i, j;
  1289. struct device_node *np = NULL;
  1290. struct platform_device *pdev_np = NULL;
  1291. int ret = 0;
  1292. for (i = 0; i < MCLK_MAX; i++) {
  1293. np = of_parse_phandle(pdev->dev.of_node,
  1294. mclk_gpio_phandle[i],
  1295. 0);
  1296. if (!np) {
  1297. pr_err("%s: device node %s is null\n",
  1298. __func__, mclk_gpio_phandle[i]);
  1299. continue;
  1300. }
  1301. pdev_np = of_find_device_by_node(np);
  1302. if (!pdev_np) {
  1303. pr_err("%s: platform device not found\n",
  1304. __func__);
  1305. continue;
  1306. }
  1307. pinctrl_info = &pdata->mclk_pinctrl_info[i];
  1308. if (pinctrl_info == NULL) {
  1309. pr_err("%s: pinctrl info is null\n",
  1310. __func__);
  1311. continue;
  1312. }
  1313. pinctrl = devm_pinctrl_get(&pdev_np->dev);
  1314. if (IS_ERR_OR_NULL(pinctrl)) {
  1315. pr_err("%s: fail to get pinctrl handle\n",
  1316. __func__);
  1317. goto err;
  1318. }
  1319. pinctrl_info->pinctrl = pinctrl;
  1320. /* get all the states handles from Device Tree */
  1321. pinctrl_info->sleep = pinctrl_lookup_state(pinctrl,
  1322. "default");
  1323. if (IS_ERR(pinctrl_info->sleep)) {
  1324. pr_err("%s: could not get sleep pin state\n",
  1325. __func__);
  1326. goto err;
  1327. }
  1328. pinctrl_info->active = pinctrl_lookup_state(pinctrl,
  1329. "active");
  1330. if (IS_ERR(pinctrl_info->active)) {
  1331. pr_err("%s: could not get active pin state\n",
  1332. __func__);
  1333. goto err;
  1334. }
  1335. /* Reset the mclk pins to a sleep state */
  1336. ret = pinctrl_select_state(pinctrl_info->pinctrl,
  1337. pinctrl_info->sleep);
  1338. if (ret != 0) {
  1339. pr_err("%s: set pin state to sleep failed with %d\n",
  1340. __func__, ret);
  1341. ret = -EIO;
  1342. goto err;
  1343. }
  1344. pinctrl_info->curr_state = STATE_SLEEP;
  1345. }
  1346. return 0;
  1347. err:
  1348. for (j = i; j >= 0; j--) {
  1349. pinctrl_info = &pdata->mclk_pinctrl_info[i];
  1350. if (pinctrl_info == NULL)
  1351. continue;
  1352. if (pinctrl_info->pinctrl) {
  1353. devm_pinctrl_put(pinctrl_info->pinctrl);
  1354. pinctrl_info->pinctrl = NULL;
  1355. }
  1356. }
  1357. return -EINVAL;
  1358. }
  1359. static int msm_asoc_machine_probe(struct platform_device *pdev)
  1360. {
  1361. struct snd_soc_card *card = NULL;
  1362. struct msm_asoc_mach_data *pdata = NULL;
  1363. int ret = 0;
  1364. const struct of_device_id *match = NULL;
  1365. dev_err(&pdev->dev, "%s: audio_reach\n",
  1366. __func__);
  1367. match = of_match_node(asoc_machine_of_match, pdev->dev.of_node);
  1368. if (!match) {
  1369. dev_err(&pdev->dev, "%s: No DT match found for sound card\n",
  1370. __func__);
  1371. return -EINVAL;
  1372. }
  1373. if (!pdev->dev.of_node) {
  1374. dev_err(&pdev->dev, "No platform supplied from device tree\n");
  1375. return -EINVAL;
  1376. }
  1377. pdata = devm_kzalloc(&pdev->dev,
  1378. sizeof(struct msm_asoc_mach_data), GFP_KERNEL);
  1379. if (!pdata)
  1380. return -ENOMEM;
  1381. card = populate_snd_card_dailinks(&pdev->dev);
  1382. if (!card) {
  1383. dev_err(&pdev->dev, "%s: Card uninitialized\n",
  1384. __func__);
  1385. ret = -EINVAL;
  1386. goto err;
  1387. }
  1388. card->dev = &pdev->dev;
  1389. platform_set_drvdata(pdev, card);
  1390. snd_soc_card_set_drvdata(card, pdata);
  1391. ret = snd_soc_of_parse_card_name(card, "qcom,model");
  1392. if (ret) {
  1393. dev_err(&pdev->dev, "parse card name failed, err:%d\n",
  1394. ret);
  1395. pr_err("%s: parse card name failed with err:%d\n",
  1396. __func__, ret);
  1397. goto err;
  1398. }
  1399. ret = msm_populate_dai_link_component_of_node(card);
  1400. if (ret) {
  1401. ret = -EPROBE_DEFER;
  1402. goto err;
  1403. }
  1404. ret = devm_snd_soc_register_card(&pdev->dev, card);
  1405. if (ret == -EPROBE_DEFER) {
  1406. goto err;
  1407. } else if (ret) {
  1408. dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
  1409. ret);
  1410. pr_err("snd_soc_register_card failed (%d)\n",
  1411. ret);
  1412. goto err;
  1413. }
  1414. msm_common_snd_init(pdev, card);
  1415. /* Parse pinctrl info from devicetree */
  1416. ret = msm_get_pinctrl(pdev);
  1417. if (!ret) {
  1418. pr_err("%s: pinctrl parsing successful\n",
  1419. __func__);
  1420. } else {
  1421. dev_dbg(&pdev->dev,
  1422. "%s: pinctrl parsing failed with %d\n",
  1423. __func__, ret);
  1424. ret = 0;
  1425. }
  1426. pdata->mclk_used = false;
  1427. if (strnstr(match->compatible, "sa8295",
  1428. sizeof(match->compatible)) ||
  1429. strnstr(match->compatible, "sa8255",
  1430. sizeof(match->compatible)) ||
  1431. strnstr(match->compatible, "sa7255",
  1432. sizeof(match->compatible))) {
  1433. /* get mclk pinctrl info from devicetree */
  1434. ret = msm_get_mclk_pinctrl(pdev);
  1435. if (!ret) {
  1436. pr_debug("%s: pinctrl mclk parsing successful\n",
  1437. __func__);
  1438. pdata->mclk_used = true;
  1439. } else {
  1440. dev_err(&pdev->dev,
  1441. "%s: pinctrl mclk parsing failed with %d\n",
  1442. __func__, ret);
  1443. ret = 0;
  1444. }
  1445. }
  1446. ret = msm_get_hwparams(pdev);
  1447. if (ret) {
  1448. dev_err(&pdev->dev,
  1449. "%s: hwparams get failed with %d\n",
  1450. __func__, ret);
  1451. goto err;
  1452. }
  1453. dev_info(&pdev->dev, "Sound card %s registered\n",
  1454. card->name);
  1455. pr_err("Sound card %s registered\n",
  1456. card->name);
  1457. spdev = pdev;
  1458. #ifdef CONFIG_MSM_COUPLED_SSR
  1459. mutex_init(&dsps_state.lock);
  1460. ret = audio_notifier_register("auto_modem",
  1461. AUDIO_NOTIFIER_MODEM_ROOT_DOMAIN,
  1462. &modem_service_nb);
  1463. if (ret < 0)
  1464. pr_err("%s: Registration with modem PDR failed ret = %d\n",
  1465. __func__, ret);
  1466. #endif
  1467. ret = msm_audio_adsp_ssr_register(&pdev->dev);
  1468. if (ret)
  1469. pr_err("%s: Registration with SND event FWK failed ret = %d\n",
  1470. __func__, ret);
  1471. snd_card_notify_user(SND_CARD_STATUS_ONLINE);
  1472. return 0;
  1473. err:
  1474. msm_release_mclk_pinctrl(pdev);
  1475. msm_release_pinctrl(pdev);
  1476. return ret;
  1477. }
  1478. static int msm_asoc_machine_remove(struct platform_device *pdev)
  1479. {
  1480. msm_release_mclk_pinctrl(pdev);
  1481. msm_release_pinctrl(pdev);
  1482. snd_event_master_deregister(&pdev->dev);
  1483. #ifdef CONFIG_MSM_COUPLED_SSR
  1484. audio_notifier_deregister("auto_modem");
  1485. mutex_destroy(&dsps_state.lock);
  1486. #endif
  1487. return 0;
  1488. }
  1489. static int audio_pinctrl_dummy_probe(struct platform_device *pdev)
  1490. {
  1491. return 0;
  1492. }
  1493. static int audio_pinctrl_dummy_remove(struct platform_device *pdev)
  1494. {
  1495. return 0;
  1496. }
  1497. static struct platform_driver audio_pinctrl_dummy_driver = {
  1498. .driver = {
  1499. .name = DRV_PINCTRL_NAME,
  1500. .of_match_table = audio_pinctrl_dummy_match,
  1501. .suppress_bind_attrs = true,
  1502. },
  1503. .probe = audio_pinctrl_dummy_probe,
  1504. .remove = audio_pinctrl_dummy_remove,
  1505. };
  1506. static struct platform_driver asoc_machine_driver = {
  1507. .driver = {
  1508. .name = DRV_NAME,
  1509. .pm = &snd_soc_pm_ops,
  1510. .of_match_table = asoc_machine_of_match,
  1511. .suppress_bind_attrs = true,
  1512. },
  1513. .probe = msm_asoc_machine_probe,
  1514. .remove = msm_asoc_machine_remove,
  1515. };
  1516. int __init auto_spf_init(void)
  1517. {
  1518. snd_card_sysfs_init();
  1519. platform_driver_register(&audio_pinctrl_dummy_driver);
  1520. return platform_driver_register(&asoc_machine_driver);
  1521. }
  1522. void auto_spf_exit(void)
  1523. {
  1524. platform_driver_unregister(&audio_pinctrl_dummy_driver);
  1525. platform_driver_unregister(&asoc_machine_driver);
  1526. }
  1527. module_init(auto_spf_init);
  1528. module_exit(auto_spf_exit);
  1529. MODULE_DESCRIPTION("ALSA SoC Machine Driver for SPF");
  1530. MODULE_LICENSE("GPL");
  1531. MODULE_ALIAS("platform:" DRV_NAME);
  1532. MODULE_ALIAS("platform:" DRV_PINCTRL_NAME);
  1533. MODULE_DEVICE_TABLE(of, asoc_machine_of_match);
  1534. MODULE_DEVICE_TABLE(of, audio_pinctrl_dummy_match);