msm-dai-slim.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663
  1. /*
  2. * Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 and
  6. * only version 2 as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. */
  13. #include <linux/init.h>
  14. #include <linux/module.h>
  15. #include <linux/of.h>
  16. #include <linux/bitops.h>
  17. #include <linux/slimbus/slimbus.h>
  18. #include <sound/soc.h>
  19. #include <sound/pcm.h>
  20. #include <sound/pcm_params.h>
  21. #include "msm-slim-dma.h"
  22. #define SLIM_DEV_NAME "msm-dai-slim"
  23. #define SLIM_DAI_RATES (SNDRV_PCM_RATE_48000 | \
  24. SNDRV_PCM_RATE_8000 | \
  25. SNDRV_PCM_RATE_16000 | \
  26. SNDRV_PCM_RATE_96000 | \
  27. SNDRV_PCM_RATE_192000 | \
  28. SNDRV_PCM_RATE_384000)
  29. #define SLIM_DAI_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | \
  30. SNDRV_PCM_FMTBIT_S24_LE | \
  31. SNDRV_PCM_FMTBIT_S32_LE)
  32. #define DAI_STATE_INITIALIZED (0x01 << 0)
  33. #define DAI_STATE_PREPARED (0x01 << 1)
  34. #define DAI_STATE_RUNNING (0x01 << 2)
  35. #define SET_DAI_STATE(status, state) \
  36. (status |= state)
  37. #define CLR_DAI_STATE(status, state) \
  38. (status = status & (~state))
  39. enum {
  40. MSM_DAI_SLIM0 = 0,
  41. NUM_SLIM_DAIS,
  42. };
  43. struct msm_slim_dai_data {
  44. unsigned int dai_id;
  45. u16 *chan_h;
  46. u16 *sh_ch;
  47. u16 grph;
  48. u32 rate;
  49. u16 bits;
  50. u16 ch_cnt;
  51. u8 status;
  52. struct snd_soc_dai_driver *dai_drv;
  53. struct msm_slim_dma_data dma_data;
  54. struct slim_port_cfg port_cfg;
  55. };
  56. struct msm_dai_slim_drv_data {
  57. struct slim_device *sdev;
  58. u16 num_dais;
  59. struct msm_slim_dai_data slim_dai_data[NUM_SLIM_DAIS];
  60. };
  61. struct msm_slim_dai_data *msm_slim_get_dai_data(
  62. struct msm_dai_slim_drv_data *drv_data,
  63. struct snd_soc_dai *dai)
  64. {
  65. struct msm_slim_dai_data *dai_data_t;
  66. int i;
  67. for (i = 0; i < drv_data->num_dais; i++) {
  68. dai_data_t = &drv_data->slim_dai_data[i];
  69. if (dai_data_t->dai_id == dai->id)
  70. return dai_data_t;
  71. }
  72. dev_err(dai->dev,
  73. "%s: no dai data found for dai_id %d\n",
  74. __func__, dai->id);
  75. return NULL;
  76. }
  77. static int msm_dai_slim_ch_ctl(struct msm_slim_dma_data *dma_data,
  78. struct snd_soc_dai *dai, bool enable)
  79. {
  80. struct slim_device *sdev;
  81. struct msm_dai_slim_drv_data *drv_data;
  82. struct msm_slim_dai_data *dai_data;
  83. int rc, rc1, i;
  84. if (!dma_data || !dma_data->sdev) {
  85. pr_err("%s: Invalid %s\n", __func__,
  86. (!dma_data) ? "dma_data" : "slim_device");
  87. return -EINVAL;
  88. }
  89. sdev = dma_data->sdev;
  90. drv_data = dev_get_drvdata(&sdev->dev);
  91. dai_data = msm_slim_get_dai_data(drv_data, dai);
  92. if (!dai_data) {
  93. dev_err(dai->dev,
  94. "%s: Invalid dai_data for dai_id %d\n",
  95. __func__, dai->id);
  96. return -EINVAL;
  97. }
  98. dev_dbg(&sdev->dev,
  99. "%s: enable = %s, rate = %u\n", __func__,
  100. enable ? "true" : "false",
  101. dai_data->rate);
  102. if (enable) {
  103. if (!(dai_data->status & DAI_STATE_PREPARED)) {
  104. dev_err(&sdev->dev,
  105. "%s: dai id (%d) has invalid state 0x%x\n",
  106. __func__, dai->id, dai_data->status);
  107. return -EINVAL;
  108. }
  109. rc = slim_alloc_mgrports(sdev,
  110. SLIM_REQ_DEFAULT, dai_data->ch_cnt,
  111. &(dma_data->ph),
  112. sizeof(dma_data->ph));
  113. if (rc < 0) {
  114. dev_err(&sdev->dev,
  115. "%s:alloc mgrport failed rc %d\n",
  116. __func__, rc);
  117. goto done;
  118. }
  119. rc = slim_config_mgrports(sdev, &(dma_data->ph),
  120. dai_data->ch_cnt,
  121. &(dai_data->port_cfg));
  122. if (rc < 0) {
  123. dev_err(&sdev->dev,
  124. "%s: config mgrport failed rc %d\n",
  125. __func__, rc);
  126. goto err_done;
  127. }
  128. for (i = 0; i < dai_data->ch_cnt; i++) {
  129. rc = slim_connect_sink(sdev,
  130. &dma_data->ph, 1,
  131. dai_data->chan_h[i]);
  132. if (rc < 0) {
  133. dev_err(&sdev->dev,
  134. "%s: slim_connect_sink failed, ch = %d, err = %d\n",
  135. __func__, i, rc);
  136. goto err_done;
  137. }
  138. }
  139. rc = slim_control_ch(sdev,
  140. dai_data->grph,
  141. SLIM_CH_ACTIVATE, true);
  142. if (rc < 0) {
  143. dev_err(&sdev->dev,
  144. "%s: slim activate ch failed, err = %d\n",
  145. __func__, rc);
  146. goto err_done;
  147. }
  148. /* Mark dai status as running */
  149. SET_DAI_STATE(dai_data->status, DAI_STATE_RUNNING);
  150. } else {
  151. if (!(dai_data->status & DAI_STATE_RUNNING)) {
  152. dev_err(&sdev->dev,
  153. "%s: dai id (%d) has invalid state 0x%x\n",
  154. __func__, dai->id, dai_data->status);
  155. return -EINVAL;
  156. }
  157. rc = slim_control_ch(sdev,
  158. dai_data->grph,
  159. SLIM_CH_REMOVE, true);
  160. if (rc < 0) {
  161. dev_err(&sdev->dev,
  162. "%s: slim activate ch failed, err = %d\n",
  163. __func__, rc);
  164. goto done;
  165. }
  166. rc = slim_dealloc_mgrports(sdev,
  167. &dma_data->ph, 1);
  168. if (rc < 0) {
  169. dev_err(&sdev->dev,
  170. "%s: dealloc mgrport failed, err = %d\n",
  171. __func__, rc);
  172. goto done;
  173. }
  174. /* clear running state for dai*/
  175. CLR_DAI_STATE(dai_data->status, DAI_STATE_RUNNING);
  176. }
  177. return rc;
  178. err_done:
  179. rc1 = slim_dealloc_mgrports(sdev,
  180. &dma_data->ph, 1);
  181. if (rc1 < 0)
  182. dev_err(&sdev->dev,
  183. "%s: dealloc mgrport failed, err = %d\n",
  184. __func__, rc1);
  185. done:
  186. return rc;
  187. }
  188. static int msm_dai_slim_hw_params(
  189. struct snd_pcm_substream *substream,
  190. struct snd_pcm_hw_params *params,
  191. struct snd_soc_dai *dai)
  192. {
  193. struct msm_dai_slim_drv_data *drv_data = dev_get_drvdata(dai->dev);
  194. struct msm_slim_dai_data *dai_data;
  195. int rc = 0;
  196. dai_data = msm_slim_get_dai_data(drv_data, dai);
  197. if (!dai_data) {
  198. dev_err(dai->dev,
  199. "%s: Invalid dai_data for dai_id %d\n",
  200. __func__, dai->id);
  201. rc = -EINVAL;
  202. goto done;
  203. }
  204. if (!dai_data->ch_cnt || dai_data->ch_cnt != params_channels(params)) {
  205. dev_err(dai->dev, "%s: invalid ch_cnt %d %d\n",
  206. __func__, dai_data->ch_cnt, params_channels(params));
  207. rc = -EINVAL;
  208. goto done;
  209. }
  210. dai_data->rate = params_rate(params);
  211. dai_data->port_cfg.port_opts = SLIM_OPT_NONE;
  212. if (dai_data->rate >= SNDRV_PCM_RATE_48000)
  213. dai_data->port_cfg.watermark = 16;
  214. else
  215. dai_data->port_cfg.watermark = 8;
  216. switch (params_format(params)) {
  217. case SNDRV_PCM_FORMAT_S16_LE:
  218. dai_data->bits = 16;
  219. break;
  220. case SNDRV_PCM_FORMAT_S24_LE:
  221. dai_data->bits = 24;
  222. break;
  223. case SNDRV_PCM_FORMAT_S32_LE:
  224. dai_data->bits = 32;
  225. break;
  226. default:
  227. dev_err(dai->dev, "%s: invalid format %d\n", __func__,
  228. params_format(params));
  229. rc = -EINVAL;
  230. goto done;
  231. }
  232. dev_dbg(dai->dev, "%s: ch_cnt=%u rate=%u, bit_width = %u\n",
  233. __func__, dai_data->ch_cnt, dai_data->rate,
  234. dai_data->bits);
  235. done:
  236. return rc;
  237. }
  238. static int msm_dai_slim_set_channel_map(struct snd_soc_dai *dai,
  239. unsigned int tx_num, unsigned int *tx_slot,
  240. unsigned int rx_num, unsigned int *rx_slot)
  241. {
  242. struct msm_dai_slim_drv_data *drv_data = dev_get_drvdata(dai->dev);
  243. struct msm_slim_dai_data *dai_data;
  244. struct snd_soc_dai_driver *dai_drv;
  245. u8 i = 0;
  246. dev_dbg(dai->dev,
  247. "%s: tx_num=%u, rx_num=%u\n",
  248. __func__, tx_num, rx_num);
  249. dai_data = msm_slim_get_dai_data(drv_data, dai);
  250. if (!dai_data) {
  251. dev_err(dai->dev,
  252. "%s: Invalid dai_data for dai_id %d\n",
  253. __func__, dai->id);
  254. return -EINVAL;
  255. }
  256. dai_drv = dai_data->dai_drv;
  257. if (tx_num > dai_drv->capture.channels_max) {
  258. dev_err(dai->dev, "%s: tx_num %u max out master port cnt\n",
  259. __func__, tx_num);
  260. return -EINVAL;
  261. }
  262. for (i = 0; i < tx_num; i++)
  263. dai_data->sh_ch[i] = tx_slot[i];
  264. dai_data->ch_cnt = tx_num;
  265. return 0;
  266. }
  267. static int msm_dai_slim_prepare(struct snd_pcm_substream *substream,
  268. struct snd_soc_dai *dai)
  269. {
  270. struct msm_dai_slim_drv_data *drv_data = dev_get_drvdata(dai->dev);
  271. struct msm_slim_dma_data *dma_data;
  272. struct msm_slim_dai_data *dai_data = NULL;
  273. struct slim_ch prop;
  274. int rc;
  275. u8 i, j;
  276. dai_data = msm_slim_get_dai_data(drv_data, dai);
  277. if (!dai_data) {
  278. dev_err(dai->dev,
  279. "%s: Invalid dai_data for dai %d\n",
  280. __func__, dai->id);
  281. return -EINVAL;
  282. }
  283. if (!(dai_data->status & DAI_STATE_INITIALIZED)) {
  284. dev_err(dai->dev,
  285. "%s: dai id (%d) has invalid state 0x%x\n",
  286. __func__, dai->id, dai_data->status);
  287. return -EINVAL;
  288. }
  289. if (dai_data->status & DAI_STATE_PREPARED) {
  290. dev_dbg(dai->dev,
  291. "%s: dai id (%d) has already prepared.\n",
  292. __func__, dai->id);
  293. return 0;
  294. }
  295. dma_data = &dai_data->dma_data;
  296. snd_soc_dai_set_dma_data(dai, substream, dma_data);
  297. for (i = 0; i < dai_data->ch_cnt; i++) {
  298. rc = slim_query_ch(drv_data->sdev, dai_data->sh_ch[i],
  299. &dai_data->chan_h[i]);
  300. if (rc) {
  301. dev_err(dai->dev, "%s:query chan handle failed rc %d\n",
  302. __func__, rc);
  303. goto error_chan_query;
  304. }
  305. }
  306. prop.prot = SLIM_AUTO_ISO;
  307. prop.baser = SLIM_RATE_4000HZ;
  308. prop.dataf = SLIM_CH_DATAF_NOT_DEFINED;
  309. prop.auxf = SLIM_CH_AUXF_NOT_APPLICABLE;
  310. prop.ratem = (dai_data->rate/4000);
  311. prop.sampleszbits = dai_data->bits;
  312. rc = slim_define_ch(drv_data->sdev, &prop, dai_data->chan_h,
  313. dai_data->ch_cnt, true, &dai_data->grph);
  314. if (rc) {
  315. dev_err(dai->dev, "%s:define chan failed rc %d\n",
  316. __func__, rc);
  317. goto error_define_chan;
  318. }
  319. /* Mark stream status as prepared */
  320. SET_DAI_STATE(dai_data->status, DAI_STATE_PREPARED);
  321. return rc;
  322. error_define_chan:
  323. error_chan_query:
  324. for (j = 0; j < i; j++)
  325. slim_dealloc_ch(drv_data->sdev, dai_data->chan_h[j]);
  326. return rc;
  327. }
  328. static void msm_dai_slim_shutdown(struct snd_pcm_substream *stream,
  329. struct snd_soc_dai *dai)
  330. {
  331. struct msm_dai_slim_drv_data *drv_data = dev_get_drvdata(dai->dev);
  332. struct msm_slim_dma_data *dma_data = NULL;
  333. struct msm_slim_dai_data *dai_data;
  334. int i, rc = 0;
  335. dai_data = msm_slim_get_dai_data(drv_data, dai);
  336. dma_data = snd_soc_dai_get_dma_data(dai, stream);
  337. if (!dma_data || !dai_data) {
  338. dev_err(dai->dev,
  339. "%s: Invalid %s\n", __func__,
  340. (!dma_data) ? "dma_data" : "dai_data");
  341. return;
  342. }
  343. if ((!(dai_data->status & DAI_STATE_PREPARED)) ||
  344. dai_data->status & DAI_STATE_RUNNING) {
  345. dev_err(dai->dev,
  346. "%s: dai id (%d) has invalid state 0x%x\n",
  347. __func__, dai->id, dai_data->status);
  348. return;
  349. }
  350. for (i = 0; i < dai_data->ch_cnt; i++) {
  351. rc = slim_dealloc_ch(drv_data->sdev, dai_data->chan_h[i]);
  352. if (rc) {
  353. dev_err(dai->dev,
  354. "%s: dealloc_ch failed, err = %d\n",
  355. __func__, rc);
  356. }
  357. }
  358. snd_soc_dai_set_dma_data(dai, stream, NULL);
  359. /* clear prepared state for the dai */
  360. CLR_DAI_STATE(dai_data->status, DAI_STATE_PREPARED);
  361. }
  362. static const struct snd_soc_component_driver msm_dai_slim_component = {
  363. .name = "msm-dai-slim-cmpnt",
  364. };
  365. static struct snd_soc_dai_ops msm_dai_slim_ops = {
  366. .prepare = msm_dai_slim_prepare,
  367. .hw_params = msm_dai_slim_hw_params,
  368. .shutdown = msm_dai_slim_shutdown,
  369. .set_channel_map = msm_dai_slim_set_channel_map,
  370. };
  371. static struct snd_soc_dai_driver msm_slim_dais[] = {
  372. {
  373. /*
  374. * The first dai name should be same as device name
  375. * to support registering single and multile dais.
  376. */
  377. .name = SLIM_DEV_NAME,
  378. .id = MSM_DAI_SLIM0,
  379. .capture = {
  380. .rates = SLIM_DAI_RATES,
  381. .formats = SLIM_DAI_FORMATS,
  382. .channels_min = 1,
  383. /*
  384. * max channels allowed is
  385. * dependent on platform and
  386. * will be updated before this
  387. * dai driver is registered.
  388. */
  389. .channels_max = 1,
  390. .rate_min = 8000,
  391. .rate_max = 384000,
  392. .stream_name = "SLIM_DAI0 Capture",
  393. },
  394. .ops = &msm_dai_slim_ops,
  395. },
  396. /*
  397. * If multiple dais are needed,
  398. * add dais here and update the
  399. * dai_id enum.
  400. */
  401. };
  402. static void msm_dai_slim_remove_dai_data(
  403. struct device *dev,
  404. struct msm_dai_slim_drv_data *drv_data)
  405. {
  406. int i;
  407. struct msm_slim_dai_data *dai_data_t;
  408. for (i = 0; i < drv_data->num_dais; i++) {
  409. dai_data_t = &drv_data->slim_dai_data[i];
  410. kfree(dai_data_t->chan_h);
  411. dai_data_t->chan_h = NULL;
  412. kfree(dai_data_t->sh_ch);
  413. dai_data_t->sh_ch = NULL;
  414. }
  415. }
  416. static int msm_dai_slim_populate_dai_data(struct device *dev,
  417. struct msm_dai_slim_drv_data *drv_data)
  418. {
  419. struct snd_soc_dai_driver *dai_drv;
  420. struct msm_slim_dai_data *dai_data_t;
  421. u8 num_ch;
  422. int i, j, rc;
  423. for (i = 0; i < drv_data->num_dais; i++) {
  424. num_ch = 0;
  425. dai_drv = &msm_slim_dais[i];
  426. num_ch += dai_drv->capture.channels_max;
  427. num_ch += dai_drv->playback.channels_max;
  428. dai_data_t = &drv_data->slim_dai_data[i];
  429. dai_data_t->dai_drv = dai_drv;
  430. dai_data_t->dai_id = dai_drv->id;
  431. dai_data_t->dma_data.sdev = drv_data->sdev;
  432. dai_data_t->dma_data.dai_channel_ctl =
  433. msm_dai_slim_ch_ctl;
  434. SET_DAI_STATE(dai_data_t->status,
  435. DAI_STATE_INITIALIZED);
  436. dai_data_t->chan_h = devm_kzalloc(dev,
  437. sizeof(u16) * num_ch,
  438. GFP_KERNEL);
  439. if (!dai_data_t->chan_h) {
  440. dev_err(dev,
  441. "%s: DAI ID %d, Failed to alloc channel handles\n",
  442. __func__, i);
  443. rc = -ENOMEM;
  444. goto err_mem_alloc;
  445. }
  446. dai_data_t->sh_ch = devm_kzalloc(dev,
  447. sizeof(u16) * num_ch,
  448. GFP_KERNEL);
  449. if (!dai_data_t->sh_ch) {
  450. dev_err(dev,
  451. "%s: DAI ID %d, Failed to alloc sh_ch\n",
  452. __func__, i);
  453. rc = -ENOMEM;
  454. goto err_mem_alloc;
  455. }
  456. }
  457. return 0;
  458. err_mem_alloc:
  459. for (j = 0; j < i; j++) {
  460. dai_data_t = &drv_data->slim_dai_data[i];
  461. devm_kfree(dev, dai_data_t->chan_h);
  462. dai_data_t->chan_h = NULL;
  463. devm_kfree(dev, dai_data_t->sh_ch);
  464. dai_data_t->sh_ch = NULL;
  465. }
  466. return rc;
  467. }
  468. static int msm_dai_slim_dev_probe(struct slim_device *sdev)
  469. {
  470. int rc, i;
  471. u8 max_channels;
  472. u32 apps_ch_pipes;
  473. struct msm_dai_slim_drv_data *drv_data;
  474. struct device *dev = &sdev->dev;
  475. struct snd_soc_dai_driver *dai_drv;
  476. if (!dev->of_node ||
  477. !dev->of_node->parent) {
  478. dev_err(dev,
  479. "%s: Invalid %s\n", __func__,
  480. (!dev->of_node) ? "of_node" : "parent_of_node");
  481. return -EINVAL;
  482. }
  483. rc = of_property_read_u32(dev->of_node->parent,
  484. "qcom,apps-ch-pipes",
  485. &apps_ch_pipes);
  486. if (rc) {
  487. dev_err(dev,
  488. "%s: Failed to lookup property %s in node %s, err = %d\n",
  489. __func__, "qcom,apps-ch-pipes",
  490. dev->of_node->parent->full_name, rc);
  491. goto err_ret;
  492. }
  493. max_channels = hweight_long(apps_ch_pipes);
  494. if (max_channels <= 0) {
  495. dev_err(dev,
  496. "%s: Invalid apps owned ports %d\n",
  497. __func__, max_channels);
  498. goto err_ret;
  499. }
  500. dev_dbg(dev, "%s: max channels = %u\n",
  501. __func__, max_channels);
  502. for (i = 0; i < ARRAY_SIZE(msm_slim_dais); i++) {
  503. dai_drv = &msm_slim_dais[i];
  504. dai_drv->capture.channels_max = max_channels;
  505. dai_drv->playback.channels_max = max_channels;
  506. }
  507. drv_data = devm_kzalloc(dev, sizeof(*drv_data),
  508. GFP_KERNEL);
  509. if (!drv_data) {
  510. rc = -ENOMEM;
  511. goto err_ret;
  512. }
  513. drv_data->sdev = sdev;
  514. drv_data->num_dais = NUM_SLIM_DAIS;
  515. rc = msm_dai_slim_populate_dai_data(dev, drv_data);
  516. if (rc) {
  517. dev_err(dev,
  518. "%s: failed to setup dai_data, err = %d\n",
  519. __func__, rc);
  520. goto err_populate_dai;
  521. }
  522. rc = snd_soc_register_component(&sdev->dev, &msm_dai_slim_component,
  523. msm_slim_dais, NUM_SLIM_DAIS);
  524. if (rc < 0) {
  525. dev_err(dev, "%s: failed to register DAI, err = %d\n",
  526. __func__, rc);
  527. goto err_reg_comp;
  528. }
  529. dev_set_drvdata(dev, drv_data);
  530. return rc;
  531. err_reg_comp:
  532. msm_dai_slim_remove_dai_data(dev, drv_data);
  533. err_populate_dai:
  534. devm_kfree(dev, drv_data);
  535. err_ret:
  536. return rc;
  537. }
  538. static int msm_dai_slim_dev_remove(struct slim_device *sdev)
  539. {
  540. snd_soc_unregister_component(&sdev->dev);
  541. return 0;
  542. }
  543. static const struct slim_device_id msm_dai_slim_dt_match[] = {
  544. {SLIM_DEV_NAME, 0 },
  545. {}
  546. };
  547. static struct slim_driver msm_dai_slim_driver = {
  548. .driver = {
  549. .name = SLIM_DEV_NAME,
  550. .owner = THIS_MODULE,
  551. },
  552. .probe = msm_dai_slim_dev_probe,
  553. .remove = msm_dai_slim_dev_remove,
  554. .id_table = msm_dai_slim_dt_match,
  555. };
  556. int __init msm_dai_slim_init(void)
  557. {
  558. int rc;
  559. rc = slim_driver_register(&msm_dai_slim_driver);
  560. if (rc)
  561. pr_err("%s: failed to register with slimbus driver rc = %d",
  562. __func__, rc);
  563. return rc;
  564. }
  565. void msm_dai_slim_exit(void)
  566. {
  567. slim_driver_unregister(&msm_dai_slim_driver);
  568. }
  569. /* Module information */
  570. MODULE_DESCRIPTION("Slimbus apps-owned channel handling driver");
  571. MODULE_LICENSE("GPL v2");