siu_pcm.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615
  1. /*
  2. * siu_pcm.c - ALSA driver for Renesas SH7343, SH7722 SIU peripheral.
  3. *
  4. * Copyright (C) 2009-2010 Guennadi Liakhovetski <g.liakhovetski@gmx.de>
  5. * Copyright (C) 2006 Carlos Munoz <carlos@kenati.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20. */
  21. #include <linux/delay.h>
  22. #include <linux/dma-mapping.h>
  23. #include <linux/dmaengine.h>
  24. #include <linux/interrupt.h>
  25. #include <linux/module.h>
  26. #include <linux/platform_device.h>
  27. #include <sound/control.h>
  28. #include <sound/core.h>
  29. #include <sound/pcm.h>
  30. #include <sound/pcm_params.h>
  31. #include <sound/soc-dai.h>
  32. #include <asm/dmaengine.h>
  33. #include <asm/siu.h>
  34. #include "siu.h"
  35. #define GET_MAX_PERIODS(buf_bytes, period_bytes) \
  36. ((buf_bytes) / (period_bytes))
  37. #define PERIOD_OFFSET(buf_addr, period_num, period_bytes) \
  38. ((buf_addr) + ((period_num) * (period_bytes)))
  39. #define RWF_STM_RD 0x01 /* Read in progress */
  40. #define RWF_STM_WT 0x02 /* Write in progress */
  41. struct siu_port *siu_ports[SIU_PORT_NUM];
  42. /* transfersize is number of u32 dma transfers per period */
  43. static int siu_pcm_stmwrite_stop(struct siu_port *port_info)
  44. {
  45. struct siu_info *info = siu_i2s_dai.private_data;
  46. u32 __iomem *base = info->reg;
  47. struct siu_stream *siu_stream = &port_info->playback;
  48. u32 stfifo;
  49. if (!siu_stream->rw_flg)
  50. return -EPERM;
  51. /* output FIFO disable */
  52. stfifo = siu_read32(base + SIU_STFIFO);
  53. siu_write32(base + SIU_STFIFO, stfifo & ~0x0c180c18);
  54. pr_debug("%s: STFIFO %x -> %x\n", __func__,
  55. stfifo, stfifo & ~0x0c180c18);
  56. /* during stmwrite clear */
  57. siu_stream->rw_flg = 0;
  58. return 0;
  59. }
  60. static int siu_pcm_stmwrite_start(struct siu_port *port_info)
  61. {
  62. struct siu_stream *siu_stream = &port_info->playback;
  63. if (siu_stream->rw_flg)
  64. return -EPERM;
  65. /* Current period in buffer */
  66. port_info->playback.cur_period = 0;
  67. /* during stmwrite flag set */
  68. siu_stream->rw_flg = RWF_STM_WT;
  69. /* DMA transfer start */
  70. tasklet_schedule(&siu_stream->tasklet);
  71. return 0;
  72. }
  73. static void siu_dma_tx_complete(void *arg)
  74. {
  75. struct siu_stream *siu_stream = arg;
  76. if (!siu_stream->rw_flg)
  77. return;
  78. /* Update completed period count */
  79. if (++siu_stream->cur_period >=
  80. GET_MAX_PERIODS(siu_stream->buf_bytes,
  81. siu_stream->period_bytes))
  82. siu_stream->cur_period = 0;
  83. pr_debug("%s: done period #%d (%u/%u bytes), cookie %d\n",
  84. __func__, siu_stream->cur_period,
  85. siu_stream->cur_period * siu_stream->period_bytes,
  86. siu_stream->buf_bytes, siu_stream->cookie);
  87. tasklet_schedule(&siu_stream->tasklet);
  88. /* Notify alsa: a period is done */
  89. snd_pcm_period_elapsed(siu_stream->substream);
  90. }
  91. static int siu_pcm_wr_set(struct siu_port *port_info,
  92. dma_addr_t buff, u32 size)
  93. {
  94. struct siu_info *info = siu_i2s_dai.private_data;
  95. u32 __iomem *base = info->reg;
  96. struct siu_stream *siu_stream = &port_info->playback;
  97. struct snd_pcm_substream *substream = siu_stream->substream;
  98. struct device *dev = substream->pcm->card->dev;
  99. struct dma_async_tx_descriptor *desc;
  100. dma_cookie_t cookie;
  101. struct scatterlist sg;
  102. u32 stfifo;
  103. sg_init_table(&sg, 1);
  104. sg_set_page(&sg, pfn_to_page(PFN_DOWN(buff)),
  105. size, offset_in_page(buff));
  106. sg_dma_address(&sg) = buff;
  107. desc = siu_stream->chan->device->device_prep_slave_sg(siu_stream->chan,
  108. &sg, 1, DMA_TO_DEVICE, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
  109. if (!desc) {
  110. dev_err(dev, "Failed to allocate a dma descriptor\n");
  111. return -ENOMEM;
  112. }
  113. desc->callback = siu_dma_tx_complete;
  114. desc->callback_param = siu_stream;
  115. cookie = desc->tx_submit(desc);
  116. if (cookie < 0) {
  117. dev_err(dev, "Failed to submit a dma transfer\n");
  118. return cookie;
  119. }
  120. siu_stream->tx_desc = desc;
  121. siu_stream->cookie = cookie;
  122. dma_async_issue_pending(siu_stream->chan);
  123. /* only output FIFO enable */
  124. stfifo = siu_read32(base + SIU_STFIFO);
  125. siu_write32(base + SIU_STFIFO, stfifo | (port_info->stfifo & 0x0c180c18));
  126. dev_dbg(dev, "%s: STFIFO %x -> %x\n", __func__,
  127. stfifo, stfifo | (port_info->stfifo & 0x0c180c18));
  128. return 0;
  129. }
  130. static int siu_pcm_rd_set(struct siu_port *port_info,
  131. dma_addr_t buff, size_t size)
  132. {
  133. struct siu_info *info = siu_i2s_dai.private_data;
  134. u32 __iomem *base = info->reg;
  135. struct siu_stream *siu_stream = &port_info->capture;
  136. struct snd_pcm_substream *substream = siu_stream->substream;
  137. struct device *dev = substream->pcm->card->dev;
  138. struct dma_async_tx_descriptor *desc;
  139. dma_cookie_t cookie;
  140. struct scatterlist sg;
  141. u32 stfifo;
  142. dev_dbg(dev, "%s: %u@%llx\n", __func__, size, (unsigned long long)buff);
  143. sg_init_table(&sg, 1);
  144. sg_set_page(&sg, pfn_to_page(PFN_DOWN(buff)),
  145. size, offset_in_page(buff));
  146. sg_dma_address(&sg) = buff;
  147. desc = siu_stream->chan->device->device_prep_slave_sg(siu_stream->chan,
  148. &sg, 1, DMA_FROM_DEVICE, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
  149. if (!desc) {
  150. dev_err(dev, "Failed to allocate dma descriptor\n");
  151. return -ENOMEM;
  152. }
  153. desc->callback = siu_dma_tx_complete;
  154. desc->callback_param = siu_stream;
  155. cookie = desc->tx_submit(desc);
  156. if (cookie < 0) {
  157. dev_err(dev, "Failed to submit dma descriptor\n");
  158. return cookie;
  159. }
  160. siu_stream->tx_desc = desc;
  161. siu_stream->cookie = cookie;
  162. dma_async_issue_pending(siu_stream->chan);
  163. /* only input FIFO enable */
  164. stfifo = siu_read32(base + SIU_STFIFO);
  165. siu_write32(base + SIU_STFIFO, siu_read32(base + SIU_STFIFO) |
  166. (port_info->stfifo & 0x13071307));
  167. dev_dbg(dev, "%s: STFIFO %x -> %x\n", __func__,
  168. stfifo, stfifo | (port_info->stfifo & 0x13071307));
  169. return 0;
  170. }
  171. static void siu_io_tasklet(unsigned long data)
  172. {
  173. struct siu_stream *siu_stream = (struct siu_stream *)data;
  174. struct snd_pcm_substream *substream = siu_stream->substream;
  175. struct device *dev = substream->pcm->card->dev;
  176. struct snd_pcm_runtime *rt = substream->runtime;
  177. struct siu_port *port_info = siu_port_info(substream);
  178. dev_dbg(dev, "%s: flags %x\n", __func__, siu_stream->rw_flg);
  179. if (!siu_stream->rw_flg) {
  180. dev_dbg(dev, "%s: stream inactive\n", __func__);
  181. return;
  182. }
  183. if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
  184. dma_addr_t buff;
  185. size_t count;
  186. u8 *virt;
  187. buff = (dma_addr_t)PERIOD_OFFSET(rt->dma_addr,
  188. siu_stream->cur_period,
  189. siu_stream->period_bytes);
  190. virt = PERIOD_OFFSET(rt->dma_area,
  191. siu_stream->cur_period,
  192. siu_stream->period_bytes);
  193. count = siu_stream->period_bytes;
  194. /* DMA transfer start */
  195. siu_pcm_rd_set(port_info, buff, count);
  196. } else {
  197. siu_pcm_wr_set(port_info,
  198. (dma_addr_t)PERIOD_OFFSET(rt->dma_addr,
  199. siu_stream->cur_period,
  200. siu_stream->period_bytes),
  201. siu_stream->period_bytes);
  202. }
  203. }
  204. /* Capture */
  205. static int siu_pcm_stmread_start(struct siu_port *port_info)
  206. {
  207. struct siu_stream *siu_stream = &port_info->capture;
  208. if (siu_stream->xfer_cnt > 0x1000000)
  209. return -EINVAL;
  210. if (siu_stream->rw_flg)
  211. return -EPERM;
  212. /* Current period in buffer */
  213. siu_stream->cur_period = 0;
  214. /* during stmread flag set */
  215. siu_stream->rw_flg = RWF_STM_RD;
  216. tasklet_schedule(&siu_stream->tasklet);
  217. return 0;
  218. }
  219. static int siu_pcm_stmread_stop(struct siu_port *port_info)
  220. {
  221. struct siu_info *info = siu_i2s_dai.private_data;
  222. u32 __iomem *base = info->reg;
  223. struct siu_stream *siu_stream = &port_info->capture;
  224. struct device *dev = siu_stream->substream->pcm->card->dev;
  225. u32 stfifo;
  226. if (!siu_stream->rw_flg)
  227. return -EPERM;
  228. /* input FIFO disable */
  229. stfifo = siu_read32(base + SIU_STFIFO);
  230. siu_write32(base + SIU_STFIFO, stfifo & ~0x13071307);
  231. dev_dbg(dev, "%s: STFIFO %x -> %x\n", __func__,
  232. stfifo, stfifo & ~0x13071307);
  233. /* during stmread flag clear */
  234. siu_stream->rw_flg = 0;
  235. return 0;
  236. }
  237. static int siu_pcm_hw_params(struct snd_pcm_substream *ss,
  238. struct snd_pcm_hw_params *hw_params)
  239. {
  240. struct siu_info *info = siu_i2s_dai.private_data;
  241. struct device *dev = ss->pcm->card->dev;
  242. int ret;
  243. dev_dbg(dev, "%s: port=%d\n", __func__, info->port_id);
  244. ret = snd_pcm_lib_malloc_pages(ss, params_buffer_bytes(hw_params));
  245. if (ret < 0)
  246. dev_err(dev, "snd_pcm_lib_malloc_pages() failed\n");
  247. return ret;
  248. }
  249. static int siu_pcm_hw_free(struct snd_pcm_substream *ss)
  250. {
  251. struct siu_info *info = siu_i2s_dai.private_data;
  252. struct siu_port *port_info = siu_port_info(ss);
  253. struct device *dev = ss->pcm->card->dev;
  254. struct siu_stream *siu_stream;
  255. if (ss->stream == SNDRV_PCM_STREAM_PLAYBACK)
  256. siu_stream = &port_info->playback;
  257. else
  258. siu_stream = &port_info->capture;
  259. dev_dbg(dev, "%s: port=%d\n", __func__, info->port_id);
  260. return snd_pcm_lib_free_pages(ss);
  261. }
  262. static bool filter(struct dma_chan *chan, void *slave)
  263. {
  264. struct sh_dmae_slave *param = slave;
  265. pr_debug("%s: slave ID %d\n", __func__, param->slave_id);
  266. if (unlikely(param->dma_dev != chan->device->dev))
  267. return false;
  268. chan->private = param;
  269. return true;
  270. }
  271. static int siu_pcm_open(struct snd_pcm_substream *ss)
  272. {
  273. /* Playback / Capture */
  274. struct siu_info *info = siu_i2s_dai.private_data;
  275. struct siu_port *port_info = siu_port_info(ss);
  276. struct siu_stream *siu_stream;
  277. u32 port = info->port_id;
  278. struct siu_platform *pdata = siu_i2s_dai.dev->platform_data;
  279. struct device *dev = ss->pcm->card->dev;
  280. dma_cap_mask_t mask;
  281. struct sh_dmae_slave *param;
  282. dma_cap_zero(mask);
  283. dma_cap_set(DMA_SLAVE, mask);
  284. dev_dbg(dev, "%s, port=%d@%p\n", __func__, port, port_info);
  285. if (ss->stream == SNDRV_PCM_STREAM_PLAYBACK) {
  286. siu_stream = &port_info->playback;
  287. param = &siu_stream->param;
  288. param->slave_id = port ? SHDMA_SLAVE_SIUB_TX :
  289. SHDMA_SLAVE_SIUA_TX;
  290. } else {
  291. siu_stream = &port_info->capture;
  292. param = &siu_stream->param;
  293. param->slave_id = port ? SHDMA_SLAVE_SIUB_RX :
  294. SHDMA_SLAVE_SIUA_RX;
  295. }
  296. param->dma_dev = pdata->dma_dev;
  297. /* Get DMA channel */
  298. siu_stream->chan = dma_request_channel(mask, filter, param);
  299. if (!siu_stream->chan) {
  300. dev_err(dev, "DMA channel allocation failed!\n");
  301. return -EBUSY;
  302. }
  303. siu_stream->substream = ss;
  304. return 0;
  305. }
  306. static int siu_pcm_close(struct snd_pcm_substream *ss)
  307. {
  308. struct siu_info *info = siu_i2s_dai.private_data;
  309. struct device *dev = ss->pcm->card->dev;
  310. struct siu_port *port_info = siu_port_info(ss);
  311. struct siu_stream *siu_stream;
  312. dev_dbg(dev, "%s: port=%d\n", __func__, info->port_id);
  313. if (ss->stream == SNDRV_PCM_STREAM_PLAYBACK)
  314. siu_stream = &port_info->playback;
  315. else
  316. siu_stream = &port_info->capture;
  317. dma_release_channel(siu_stream->chan);
  318. siu_stream->chan = NULL;
  319. siu_stream->substream = NULL;
  320. return 0;
  321. }
  322. static int siu_pcm_prepare(struct snd_pcm_substream *ss)
  323. {
  324. struct siu_info *info = siu_i2s_dai.private_data;
  325. struct siu_port *port_info = siu_port_info(ss);
  326. struct device *dev = ss->pcm->card->dev;
  327. struct snd_pcm_runtime *rt = ss->runtime;
  328. struct siu_stream *siu_stream;
  329. snd_pcm_sframes_t xfer_cnt;
  330. if (ss->stream == SNDRV_PCM_STREAM_PLAYBACK)
  331. siu_stream = &port_info->playback;
  332. else
  333. siu_stream = &port_info->capture;
  334. rt = siu_stream->substream->runtime;
  335. siu_stream->buf_bytes = snd_pcm_lib_buffer_bytes(ss);
  336. siu_stream->period_bytes = snd_pcm_lib_period_bytes(ss);
  337. dev_dbg(dev, "%s: port=%d, %d channels, period=%u bytes\n", __func__,
  338. info->port_id, rt->channels, siu_stream->period_bytes);
  339. /* We only support buffers that are multiples of the period */
  340. if (siu_stream->buf_bytes % siu_stream->period_bytes) {
  341. dev_err(dev, "%s() - buffer=%d not multiple of period=%d\n",
  342. __func__, siu_stream->buf_bytes,
  343. siu_stream->period_bytes);
  344. return -EINVAL;
  345. }
  346. xfer_cnt = bytes_to_frames(rt, siu_stream->period_bytes);
  347. if (!xfer_cnt || xfer_cnt > 0x1000000)
  348. return -EINVAL;
  349. siu_stream->format = rt->format;
  350. siu_stream->xfer_cnt = xfer_cnt;
  351. dev_dbg(dev, "port=%d buf=%lx buf_bytes=%d period_bytes=%d "
  352. "format=%d channels=%d xfer_cnt=%d\n", info->port_id,
  353. (unsigned long)rt->dma_addr, siu_stream->buf_bytes,
  354. siu_stream->period_bytes,
  355. siu_stream->format, rt->channels, (int)xfer_cnt);
  356. return 0;
  357. }
  358. static int siu_pcm_trigger(struct snd_pcm_substream *ss, int cmd)
  359. {
  360. struct siu_info *info = siu_i2s_dai.private_data;
  361. struct device *dev = ss->pcm->card->dev;
  362. struct siu_port *port_info = siu_port_info(ss);
  363. int ret;
  364. dev_dbg(dev, "%s: port=%d@%p, cmd=%d\n", __func__,
  365. info->port_id, port_info, cmd);
  366. switch (cmd) {
  367. case SNDRV_PCM_TRIGGER_START:
  368. if (ss->stream == SNDRV_PCM_STREAM_PLAYBACK)
  369. ret = siu_pcm_stmwrite_start(port_info);
  370. else
  371. ret = siu_pcm_stmread_start(port_info);
  372. if (ret < 0)
  373. dev_warn(dev, "%s: start failed on port=%d\n",
  374. __func__, info->port_id);
  375. break;
  376. case SNDRV_PCM_TRIGGER_STOP:
  377. if (ss->stream == SNDRV_PCM_STREAM_PLAYBACK)
  378. siu_pcm_stmwrite_stop(port_info);
  379. else
  380. siu_pcm_stmread_stop(port_info);
  381. ret = 0;
  382. break;
  383. default:
  384. dev_err(dev, "%s() unsupported cmd=%d\n", __func__, cmd);
  385. ret = -EINVAL;
  386. }
  387. return ret;
  388. }
  389. /*
  390. * So far only resolution of one period is supported, subject to extending the
  391. * dmangine API
  392. */
  393. static snd_pcm_uframes_t siu_pcm_pointer_dma(struct snd_pcm_substream *ss)
  394. {
  395. struct device *dev = ss->pcm->card->dev;
  396. struct siu_info *info = siu_i2s_dai.private_data;
  397. u32 __iomem *base = info->reg;
  398. struct siu_port *port_info = siu_port_info(ss);
  399. struct snd_pcm_runtime *rt = ss->runtime;
  400. size_t ptr;
  401. struct siu_stream *siu_stream;
  402. if (ss->stream == SNDRV_PCM_STREAM_PLAYBACK)
  403. siu_stream = &port_info->playback;
  404. else
  405. siu_stream = &port_info->capture;
  406. /*
  407. * ptr is the offset into the buffer where the dma is currently at. We
  408. * check if the dma buffer has just wrapped.
  409. */
  410. ptr = PERIOD_OFFSET(rt->dma_addr,
  411. siu_stream->cur_period,
  412. siu_stream->period_bytes) - rt->dma_addr;
  413. dev_dbg(dev,
  414. "%s: port=%d, events %x, FSTS %x, xferred %u/%u, cookie %d\n",
  415. __func__, info->port_id, siu_read32(base + SIU_EVNTC),
  416. siu_read32(base + SIU_SBFSTS), ptr, siu_stream->buf_bytes,
  417. siu_stream->cookie);
  418. if (ptr >= siu_stream->buf_bytes)
  419. ptr = 0;
  420. return bytes_to_frames(ss->runtime, ptr);
  421. }
  422. static int siu_pcm_new(struct snd_card *card, struct snd_soc_dai *dai,
  423. struct snd_pcm *pcm)
  424. {
  425. /* card->dev == socdev->dev, see snd_soc_new_pcms() */
  426. struct siu_info *info = siu_i2s_dai.private_data;
  427. struct platform_device *pdev = to_platform_device(card->dev);
  428. int ret;
  429. int i;
  430. /* pdev->id selects between SIUA and SIUB */
  431. if (pdev->id < 0 || pdev->id >= SIU_PORT_NUM)
  432. return -EINVAL;
  433. info->port_id = pdev->id;
  434. /*
  435. * While the siu has 2 ports, only one port can be on at a time (only 1
  436. * SPB). So far all the boards using the siu had only one of the ports
  437. * wired to a codec. To simplify things, we only register one port with
  438. * alsa. In case both ports are needed, it should be changed here
  439. */
  440. for (i = pdev->id; i < pdev->id + 1; i++) {
  441. struct siu_port **port_info = &siu_ports[i];
  442. ret = siu_init_port(i, port_info, card);
  443. if (ret < 0)
  444. return ret;
  445. ret = snd_pcm_lib_preallocate_pages_for_all(pcm,
  446. SNDRV_DMA_TYPE_DEV, NULL,
  447. SIU_BUFFER_BYTES_MAX, SIU_BUFFER_BYTES_MAX);
  448. if (ret < 0) {
  449. dev_err(card->dev,
  450. "snd_pcm_lib_preallocate_pages_for_all() err=%d",
  451. ret);
  452. goto fail;
  453. }
  454. (*port_info)->pcm = pcm;
  455. /* IO tasklets */
  456. tasklet_init(&(*port_info)->playback.tasklet, siu_io_tasklet,
  457. (unsigned long)&(*port_info)->playback);
  458. tasklet_init(&(*port_info)->capture.tasklet, siu_io_tasklet,
  459. (unsigned long)&(*port_info)->capture);
  460. }
  461. dev_info(card->dev, "SuperH SIU driver initialized.\n");
  462. return 0;
  463. fail:
  464. siu_free_port(siu_ports[pdev->id]);
  465. dev_err(card->dev, "SIU: failed to initialize.\n");
  466. return ret;
  467. }
  468. static void siu_pcm_free(struct snd_pcm *pcm)
  469. {
  470. struct platform_device *pdev = to_platform_device(pcm->card->dev);
  471. struct siu_port *port_info = siu_ports[pdev->id];
  472. tasklet_kill(&port_info->capture.tasklet);
  473. tasklet_kill(&port_info->playback.tasklet);
  474. siu_free_port(port_info);
  475. snd_pcm_lib_preallocate_free_for_all(pcm);
  476. dev_dbg(pcm->card->dev, "%s\n", __func__);
  477. }
  478. static struct snd_pcm_ops siu_pcm_ops = {
  479. .open = siu_pcm_open,
  480. .close = siu_pcm_close,
  481. .ioctl = snd_pcm_lib_ioctl,
  482. .hw_params = siu_pcm_hw_params,
  483. .hw_free = siu_pcm_hw_free,
  484. .prepare = siu_pcm_prepare,
  485. .trigger = siu_pcm_trigger,
  486. .pointer = siu_pcm_pointer_dma,
  487. };
  488. struct snd_soc_platform siu_platform = {
  489. .name = "siu-audio",
  490. .pcm_ops = &siu_pcm_ops,
  491. .pcm_new = siu_pcm_new,
  492. .pcm_free = siu_pcm_free,
  493. };
  494. EXPORT_SYMBOL_GPL(siu_platform);