mpc8610_hpcd.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624
  1. /**
  2. * Freescale MPC8610HPCD ALSA SoC Fabric driver
  3. *
  4. * Author: Timur Tabi <timur@freescale.com>
  5. *
  6. * Copyright 2007-2008 Freescale Semiconductor, Inc. This file is licensed
  7. * under the terms of the GNU General Public License version 2. This
  8. * program is licensed "as is" without any warranty of any kind, whether
  9. * express or implied.
  10. */
  11. #include <linux/module.h>
  12. #include <linux/interrupt.h>
  13. #include <linux/of_device.h>
  14. #include <linux/of_platform.h>
  15. #include <sound/soc.h>
  16. #include <asm/immap_86xx.h>
  17. #include "../codecs/cs4270.h"
  18. #include "fsl_dma.h"
  19. #include "fsl_ssi.h"
  20. /**
  21. * mpc8610_hpcd_data: fabric-specific ASoC device data
  22. *
  23. * This structure contains data for a single sound platform device on an
  24. * MPC8610 HPCD. Some of the data is taken from the device tree.
  25. */
  26. struct mpc8610_hpcd_data {
  27. struct snd_soc_device sound_devdata;
  28. struct snd_soc_dai_link dai;
  29. struct snd_soc_card machine;
  30. unsigned int dai_format;
  31. unsigned int codec_clk_direction;
  32. unsigned int cpu_clk_direction;
  33. unsigned int clk_frequency;
  34. struct ccsr_guts __iomem *guts;
  35. struct ccsr_ssi __iomem *ssi;
  36. unsigned int ssi_id; /* 0 = SSI1, 1 = SSI2, etc */
  37. unsigned int ssi_irq;
  38. unsigned int dma_id; /* 0 = DMA1, 1 = DMA2, etc */
  39. unsigned int dma_irq[2];
  40. struct ccsr_dma_channel __iomem *dma[2];
  41. unsigned int dma_channel_id[2]; /* 0 = ch 0, 1 = ch 1, etc*/
  42. };
  43. /**
  44. * mpc8610_hpcd_machine_probe: initalize the board
  45. *
  46. * This function is called when platform_device_add() is called. It is used
  47. * to initialize the board-specific hardware.
  48. *
  49. * Here we program the DMACR and PMUXCR registers.
  50. */
  51. static int mpc8610_hpcd_machine_probe(struct platform_device *sound_device)
  52. {
  53. struct mpc8610_hpcd_data *machine_data =
  54. sound_device->dev.platform_data;
  55. /* Program the signal routing between the SSI and the DMA */
  56. guts_set_dmacr(machine_data->guts, machine_data->dma_id,
  57. machine_data->dma_channel_id[0], CCSR_GUTS_DMACR_DEV_SSI);
  58. guts_set_dmacr(machine_data->guts, machine_data->dma_id,
  59. machine_data->dma_channel_id[1], CCSR_GUTS_DMACR_DEV_SSI);
  60. guts_set_pmuxcr_dma(machine_data->guts, machine_data->dma_id,
  61. machine_data->dma_channel_id[0], 0);
  62. guts_set_pmuxcr_dma(machine_data->guts, machine_data->dma_id,
  63. machine_data->dma_channel_id[1], 0);
  64. switch (machine_data->ssi_id) {
  65. case 0:
  66. clrsetbits_be32(&machine_data->guts->pmuxcr,
  67. CCSR_GUTS_PMUXCR_SSI1_MASK, CCSR_GUTS_PMUXCR_SSI1_SSI);
  68. break;
  69. case 1:
  70. clrsetbits_be32(&machine_data->guts->pmuxcr,
  71. CCSR_GUTS_PMUXCR_SSI2_MASK, CCSR_GUTS_PMUXCR_SSI2_SSI);
  72. break;
  73. }
  74. return 0;
  75. }
  76. /**
  77. * mpc8610_hpcd_startup: program the board with various hardware parameters
  78. *
  79. * This function takes board-specific information, like clock frequencies
  80. * and serial data formats, and passes that information to the codec and
  81. * transport drivers.
  82. */
  83. static int mpc8610_hpcd_startup(struct snd_pcm_substream *substream)
  84. {
  85. struct snd_soc_pcm_runtime *rtd = substream->private_data;
  86. struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;
  87. struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
  88. struct mpc8610_hpcd_data *machine_data =
  89. rtd->socdev->dev->platform_data;
  90. int ret = 0;
  91. /* Tell the CPU driver what the serial protocol is. */
  92. ret = snd_soc_dai_set_fmt(cpu_dai, machine_data->dai_format);
  93. if (ret < 0) {
  94. dev_err(substream->pcm->card->dev,
  95. "could not set CPU driver audio format\n");
  96. return ret;
  97. }
  98. /* Tell the codec driver what the serial protocol is. */
  99. ret = snd_soc_dai_set_fmt(codec_dai, machine_data->dai_format);
  100. if (ret < 0) {
  101. dev_err(substream->pcm->card->dev,
  102. "could not set codec driver audio format\n");
  103. return ret;
  104. }
  105. /*
  106. * Tell the CPU driver what the clock frequency is, and whether it's a
  107. * slave or master.
  108. */
  109. ret = snd_soc_dai_set_sysclk(cpu_dai, 0,
  110. machine_data->clk_frequency,
  111. machine_data->cpu_clk_direction);
  112. if (ret < 0) {
  113. dev_err(substream->pcm->card->dev,
  114. "could not set CPU driver clock parameters\n");
  115. return ret;
  116. }
  117. /*
  118. * Tell the codec driver what the MCLK frequency is, and whether it's
  119. * a slave or master.
  120. */
  121. ret = snd_soc_dai_set_sysclk(codec_dai, 0,
  122. machine_data->clk_frequency,
  123. machine_data->codec_clk_direction);
  124. if (ret < 0) {
  125. dev_err(substream->pcm->card->dev,
  126. "could not set codec driver clock params\n");
  127. return ret;
  128. }
  129. return 0;
  130. }
  131. /**
  132. * mpc8610_hpcd_machine_remove: Remove the sound device
  133. *
  134. * This function is called to remove the sound device for one SSI. We
  135. * de-program the DMACR and PMUXCR register.
  136. */
  137. int mpc8610_hpcd_machine_remove(struct platform_device *sound_device)
  138. {
  139. struct mpc8610_hpcd_data *machine_data =
  140. sound_device->dev.platform_data;
  141. /* Restore the signal routing */
  142. guts_set_dmacr(machine_data->guts, machine_data->dma_id,
  143. machine_data->dma_channel_id[0], 0);
  144. guts_set_dmacr(machine_data->guts, machine_data->dma_id,
  145. machine_data->dma_channel_id[1], 0);
  146. switch (machine_data->ssi_id) {
  147. case 0:
  148. clrsetbits_be32(&machine_data->guts->pmuxcr,
  149. CCSR_GUTS_PMUXCR_SSI1_MASK, CCSR_GUTS_PMUXCR_SSI1_LA);
  150. break;
  151. case 1:
  152. clrsetbits_be32(&machine_data->guts->pmuxcr,
  153. CCSR_GUTS_PMUXCR_SSI2_MASK, CCSR_GUTS_PMUXCR_SSI2_LA);
  154. break;
  155. }
  156. return 0;
  157. }
  158. /**
  159. * mpc8610_hpcd_ops: ASoC fabric driver operations
  160. */
  161. static struct snd_soc_ops mpc8610_hpcd_ops = {
  162. .startup = mpc8610_hpcd_startup,
  163. };
  164. /**
  165. * mpc8610_hpcd_probe: OF probe function for the fabric driver
  166. *
  167. * This function gets called when an SSI node is found in the device tree.
  168. *
  169. * Although this is a fabric driver, the SSI node is the "master" node with
  170. * respect to audio hardware connections. Therefore, we create a new ASoC
  171. * device for each new SSI node that has a codec attached.
  172. *
  173. * FIXME: Currently, we only support one DMA controller, so if there are
  174. * multiple SSI nodes with codecs, only the first will be supported.
  175. *
  176. * FIXME: Even if we did support multiple DMA controllers, we have no
  177. * mechanism for assigning DMA controllers and channels to the individual
  178. * SSI devices. We also probably aren't compatible with the generic Elo DMA
  179. * device driver.
  180. */
  181. static int mpc8610_hpcd_probe(struct of_device *ofdev,
  182. const struct of_device_id *match)
  183. {
  184. struct device_node *np = ofdev->node;
  185. struct device_node *codec_np = NULL;
  186. struct device_node *guts_np = NULL;
  187. struct device_node *dma_np = NULL;
  188. struct device_node *dma_channel_np = NULL;
  189. const phandle *codec_ph;
  190. const char *sprop;
  191. const u32 *iprop;
  192. struct resource res;
  193. struct platform_device *sound_device = NULL;
  194. struct mpc8610_hpcd_data *machine_data;
  195. struct fsl_ssi_info ssi_info;
  196. struct fsl_dma_info dma_info;
  197. int ret = -ENODEV;
  198. unsigned int playback_dma_channel;
  199. unsigned int capture_dma_channel;
  200. machine_data = kzalloc(sizeof(struct mpc8610_hpcd_data), GFP_KERNEL);
  201. if (!machine_data)
  202. return -ENOMEM;
  203. memset(&ssi_info, 0, sizeof(ssi_info));
  204. memset(&dma_info, 0, sizeof(dma_info));
  205. ssi_info.dev = &ofdev->dev;
  206. /*
  207. * We are only interested in SSIs with a codec phandle in them, so let's
  208. * make sure this SSI has one.
  209. */
  210. codec_ph = of_get_property(np, "codec-handle", NULL);
  211. if (!codec_ph)
  212. goto error;
  213. codec_np = of_find_node_by_phandle(*codec_ph);
  214. if (!codec_np)
  215. goto error;
  216. /* The MPC8610 HPCD only knows about the CS4270 codec, so reject
  217. anything else. */
  218. if (!of_device_is_compatible(codec_np, "cirrus,cs4270"))
  219. goto error;
  220. /* Get the device ID */
  221. iprop = of_get_property(np, "cell-index", NULL);
  222. if (!iprop) {
  223. dev_err(&ofdev->dev, "cell-index property not found\n");
  224. ret = -EINVAL;
  225. goto error;
  226. }
  227. machine_data->ssi_id = *iprop;
  228. ssi_info.id = *iprop;
  229. /* Get the serial format and clock direction. */
  230. sprop = of_get_property(np, "fsl,mode", NULL);
  231. if (!sprop) {
  232. dev_err(&ofdev->dev, "fsl,mode property not found\n");
  233. ret = -EINVAL;
  234. goto error;
  235. }
  236. if (strcasecmp(sprop, "i2s-slave") == 0) {
  237. machine_data->dai_format = SND_SOC_DAIFMT_I2S;
  238. machine_data->codec_clk_direction = SND_SOC_CLOCK_OUT;
  239. machine_data->cpu_clk_direction = SND_SOC_CLOCK_IN;
  240. /*
  241. * In i2s-slave mode, the codec has its own clock source, so we
  242. * need to get the frequency from the device tree and pass it to
  243. * the codec driver.
  244. */
  245. iprop = of_get_property(codec_np, "clock-frequency", NULL);
  246. if (!iprop || !*iprop) {
  247. dev_err(&ofdev->dev, "codec bus-frequency property "
  248. "is missing or invalid\n");
  249. ret = -EINVAL;
  250. goto error;
  251. }
  252. machine_data->clk_frequency = *iprop;
  253. } else if (strcasecmp(sprop, "i2s-master") == 0) {
  254. machine_data->dai_format = SND_SOC_DAIFMT_I2S;
  255. machine_data->codec_clk_direction = SND_SOC_CLOCK_IN;
  256. machine_data->cpu_clk_direction = SND_SOC_CLOCK_OUT;
  257. } else if (strcasecmp(sprop, "lj-slave") == 0) {
  258. machine_data->dai_format = SND_SOC_DAIFMT_LEFT_J;
  259. machine_data->codec_clk_direction = SND_SOC_CLOCK_OUT;
  260. machine_data->cpu_clk_direction = SND_SOC_CLOCK_IN;
  261. } else if (strcasecmp(sprop, "lj-master") == 0) {
  262. machine_data->dai_format = SND_SOC_DAIFMT_LEFT_J;
  263. machine_data->codec_clk_direction = SND_SOC_CLOCK_IN;
  264. machine_data->cpu_clk_direction = SND_SOC_CLOCK_OUT;
  265. } else if (strcasecmp(sprop, "rj-slave") == 0) {
  266. machine_data->dai_format = SND_SOC_DAIFMT_RIGHT_J;
  267. machine_data->codec_clk_direction = SND_SOC_CLOCK_OUT;
  268. machine_data->cpu_clk_direction = SND_SOC_CLOCK_IN;
  269. } else if (strcasecmp(sprop, "rj-master") == 0) {
  270. machine_data->dai_format = SND_SOC_DAIFMT_RIGHT_J;
  271. machine_data->codec_clk_direction = SND_SOC_CLOCK_IN;
  272. machine_data->cpu_clk_direction = SND_SOC_CLOCK_OUT;
  273. } else if (strcasecmp(sprop, "ac97-slave") == 0) {
  274. machine_data->dai_format = SND_SOC_DAIFMT_AC97;
  275. machine_data->codec_clk_direction = SND_SOC_CLOCK_OUT;
  276. machine_data->cpu_clk_direction = SND_SOC_CLOCK_IN;
  277. } else if (strcasecmp(sprop, "ac97-master") == 0) {
  278. machine_data->dai_format = SND_SOC_DAIFMT_AC97;
  279. machine_data->codec_clk_direction = SND_SOC_CLOCK_IN;
  280. machine_data->cpu_clk_direction = SND_SOC_CLOCK_OUT;
  281. } else {
  282. dev_err(&ofdev->dev,
  283. "unrecognized fsl,mode property \"%s\"\n", sprop);
  284. ret = -EINVAL;
  285. goto error;
  286. }
  287. if (!machine_data->clk_frequency) {
  288. dev_err(&ofdev->dev, "unknown clock frequency\n");
  289. ret = -EINVAL;
  290. goto error;
  291. }
  292. /* Read the SSI information from the device tree */
  293. ret = of_address_to_resource(np, 0, &res);
  294. if (ret) {
  295. dev_err(&ofdev->dev, "could not obtain SSI address\n");
  296. goto error;
  297. }
  298. if (!res.start) {
  299. dev_err(&ofdev->dev, "invalid SSI address\n");
  300. goto error;
  301. }
  302. ssi_info.ssi_phys = res.start;
  303. machine_data->ssi = ioremap(ssi_info.ssi_phys, sizeof(struct ccsr_ssi));
  304. if (!machine_data->ssi) {
  305. dev_err(&ofdev->dev, "could not map SSI address %x\n",
  306. ssi_info.ssi_phys);
  307. ret = -EINVAL;
  308. goto error;
  309. }
  310. ssi_info.ssi = machine_data->ssi;
  311. /* Get the IRQ of the SSI */
  312. machine_data->ssi_irq = irq_of_parse_and_map(np, 0);
  313. if (!machine_data->ssi_irq) {
  314. dev_err(&ofdev->dev, "could not get SSI IRQ\n");
  315. ret = -EINVAL;
  316. goto error;
  317. }
  318. ssi_info.irq = machine_data->ssi_irq;
  319. /* Do we want to use asynchronous mode? */
  320. ssi_info.asynchronous =
  321. of_find_property(np, "fsl,ssi-asynchronous", NULL) ? 1 : 0;
  322. if (ssi_info.asynchronous)
  323. dev_info(&ofdev->dev, "using asynchronous mode\n");
  324. /* Map the global utilities registers. */
  325. guts_np = of_find_compatible_node(NULL, NULL, "fsl,mpc8610-guts");
  326. if (!guts_np) {
  327. dev_err(&ofdev->dev, "could not obtain address of GUTS\n");
  328. ret = -EINVAL;
  329. goto error;
  330. }
  331. machine_data->guts = of_iomap(guts_np, 0);
  332. of_node_put(guts_np);
  333. if (!machine_data->guts) {
  334. dev_err(&ofdev->dev, "could not map GUTS\n");
  335. ret = -EINVAL;
  336. goto error;
  337. }
  338. /* Find the DMA channels to use. Both SSIs need to use the same DMA
  339. * controller, so let's use DMA#1.
  340. */
  341. for_each_compatible_node(dma_np, NULL, "fsl,mpc8610-dma") {
  342. iprop = of_get_property(dma_np, "cell-index", NULL);
  343. if (iprop && (*iprop == 0)) {
  344. of_node_put(dma_np);
  345. break;
  346. }
  347. }
  348. if (!dma_np) {
  349. dev_err(&ofdev->dev, "could not find DMA node\n");
  350. ret = -EINVAL;
  351. goto error;
  352. }
  353. machine_data->dma_id = *iprop;
  354. /* SSI1 needs to use DMA Channels 0 and 1, and SSI2 needs to use DMA
  355. * channels 2 and 3. This is just how the MPC8610 is wired
  356. * internally.
  357. */
  358. playback_dma_channel = (machine_data->ssi_id == 0) ? 0 : 2;
  359. capture_dma_channel = (machine_data->ssi_id == 0) ? 1 : 3;
  360. /*
  361. * Find the DMA channels to use.
  362. */
  363. while ((dma_channel_np = of_get_next_child(dma_np, dma_channel_np))) {
  364. iprop = of_get_property(dma_channel_np, "cell-index", NULL);
  365. if (iprop && (*iprop == playback_dma_channel)) {
  366. /* dma_channel[0] and dma_irq[0] are for playback */
  367. dma_info.dma_channel[0] = of_iomap(dma_channel_np, 0);
  368. dma_info.dma_irq[0] =
  369. irq_of_parse_and_map(dma_channel_np, 0);
  370. machine_data->dma_channel_id[0] = *iprop;
  371. continue;
  372. }
  373. if (iprop && (*iprop == capture_dma_channel)) {
  374. /* dma_channel[1] and dma_irq[1] are for capture */
  375. dma_info.dma_channel[1] = of_iomap(dma_channel_np, 0);
  376. dma_info.dma_irq[1] =
  377. irq_of_parse_and_map(dma_channel_np, 0);
  378. machine_data->dma_channel_id[1] = *iprop;
  379. continue;
  380. }
  381. }
  382. if (!dma_info.dma_channel[0] || !dma_info.dma_channel[1] ||
  383. !dma_info.dma_irq[0] || !dma_info.dma_irq[1]) {
  384. dev_err(&ofdev->dev, "could not find DMA channels\n");
  385. ret = -EINVAL;
  386. goto error;
  387. }
  388. dma_info.ssi_stx_phys = ssi_info.ssi_phys +
  389. offsetof(struct ccsr_ssi, stx0);
  390. dma_info.ssi_srx_phys = ssi_info.ssi_phys +
  391. offsetof(struct ccsr_ssi, srx0);
  392. /* We have the DMA information, so tell the DMA driver what it is */
  393. if (!fsl_dma_configure(&dma_info)) {
  394. dev_err(&ofdev->dev, "could not instantiate DMA device\n");
  395. ret = -EBUSY;
  396. goto error;
  397. }
  398. /*
  399. * Initialize our DAI data structure. We should probably get this
  400. * information from the device tree.
  401. */
  402. machine_data->dai.name = "CS4270";
  403. machine_data->dai.stream_name = "CS4270";
  404. machine_data->dai.cpu_dai = fsl_ssi_create_dai(&ssi_info);
  405. machine_data->dai.codec_dai = &cs4270_dai; /* The codec_dai we want */
  406. machine_data->dai.ops = &mpc8610_hpcd_ops;
  407. machine_data->machine.probe = mpc8610_hpcd_machine_probe;
  408. machine_data->machine.remove = mpc8610_hpcd_machine_remove;
  409. machine_data->machine.name = "MPC8610 HPCD";
  410. machine_data->machine.num_links = 1;
  411. machine_data->machine.dai_link = &machine_data->dai;
  412. /* Allocate a new audio platform device structure */
  413. sound_device = platform_device_alloc("soc-audio", -1);
  414. if (!sound_device) {
  415. dev_err(&ofdev->dev, "platform device allocation failed\n");
  416. ret = -ENOMEM;
  417. goto error;
  418. }
  419. machine_data->sound_devdata.card = &machine_data->machine;
  420. machine_data->sound_devdata.codec_dev = &soc_codec_device_cs4270;
  421. machine_data->machine.platform = &fsl_soc_platform;
  422. sound_device->dev.platform_data = machine_data;
  423. /* Set the platform device and ASoC device to point to each other */
  424. platform_set_drvdata(sound_device, &machine_data->sound_devdata);
  425. machine_data->sound_devdata.dev = &sound_device->dev;
  426. /* Tell ASoC to probe us. This will call mpc8610_hpcd_machine.probe(),
  427. if it exists. */
  428. ret = platform_device_add(sound_device);
  429. if (ret) {
  430. dev_err(&ofdev->dev, "platform device add failed\n");
  431. goto error;
  432. }
  433. dev_set_drvdata(&ofdev->dev, sound_device);
  434. return 0;
  435. error:
  436. of_node_put(codec_np);
  437. of_node_put(guts_np);
  438. of_node_put(dma_np);
  439. of_node_put(dma_channel_np);
  440. if (sound_device)
  441. platform_device_unregister(sound_device);
  442. if (machine_data->dai.cpu_dai)
  443. fsl_ssi_destroy_dai(machine_data->dai.cpu_dai);
  444. if (ssi_info.ssi)
  445. iounmap(ssi_info.ssi);
  446. if (ssi_info.irq)
  447. irq_dispose_mapping(ssi_info.irq);
  448. if (dma_info.dma_channel[0])
  449. iounmap(dma_info.dma_channel[0]);
  450. if (dma_info.dma_channel[1])
  451. iounmap(dma_info.dma_channel[1]);
  452. if (dma_info.dma_irq[0])
  453. irq_dispose_mapping(dma_info.dma_irq[0]);
  454. if (dma_info.dma_irq[1])
  455. irq_dispose_mapping(dma_info.dma_irq[1]);
  456. if (machine_data->guts)
  457. iounmap(machine_data->guts);
  458. kfree(machine_data);
  459. return ret;
  460. }
  461. /**
  462. * mpc8610_hpcd_remove: remove the OF device
  463. *
  464. * This function is called when the OF device is removed.
  465. */
  466. static int mpc8610_hpcd_remove(struct of_device *ofdev)
  467. {
  468. struct platform_device *sound_device = dev_get_drvdata(&ofdev->dev);
  469. struct mpc8610_hpcd_data *machine_data =
  470. sound_device->dev.platform_data;
  471. platform_device_unregister(sound_device);
  472. if (machine_data->dai.cpu_dai)
  473. fsl_ssi_destroy_dai(machine_data->dai.cpu_dai);
  474. if (machine_data->ssi)
  475. iounmap(machine_data->ssi);
  476. if (machine_data->dma[0])
  477. iounmap(machine_data->dma[0]);
  478. if (machine_data->dma[1])
  479. iounmap(machine_data->dma[1]);
  480. if (machine_data->dma_irq[0])
  481. irq_dispose_mapping(machine_data->dma_irq[0]);
  482. if (machine_data->dma_irq[1])
  483. irq_dispose_mapping(machine_data->dma_irq[1]);
  484. if (machine_data->guts)
  485. iounmap(machine_data->guts);
  486. kfree(machine_data);
  487. sound_device->dev.platform_data = NULL;
  488. dev_set_drvdata(&ofdev->dev, NULL);
  489. return 0;
  490. }
  491. static struct of_device_id mpc8610_hpcd_match[] = {
  492. {
  493. .compatible = "fsl,mpc8610-ssi",
  494. },
  495. {}
  496. };
  497. MODULE_DEVICE_TABLE(of, mpc8610_hpcd_match);
  498. static struct of_platform_driver mpc8610_hpcd_of_driver = {
  499. .owner = THIS_MODULE,
  500. .name = "mpc8610_hpcd",
  501. .match_table = mpc8610_hpcd_match,
  502. .probe = mpc8610_hpcd_probe,
  503. .remove = mpc8610_hpcd_remove,
  504. };
  505. /**
  506. * mpc8610_hpcd_init: fabric driver initialization.
  507. *
  508. * This function is called when this module is loaded.
  509. */
  510. static int __init mpc8610_hpcd_init(void)
  511. {
  512. int ret;
  513. printk(KERN_INFO "Freescale MPC8610 HPCD ALSA SoC fabric driver\n");
  514. ret = of_register_platform_driver(&mpc8610_hpcd_of_driver);
  515. if (ret)
  516. printk(KERN_ERR
  517. "mpc8610-hpcd: failed to register platform driver\n");
  518. return ret;
  519. }
  520. /**
  521. * mpc8610_hpcd_exit: fabric driver exit
  522. *
  523. * This function is called when this driver is unloaded.
  524. */
  525. static void __exit mpc8610_hpcd_exit(void)
  526. {
  527. of_unregister_platform_driver(&mpc8610_hpcd_of_driver);
  528. }
  529. module_init(mpc8610_hpcd_init);
  530. module_exit(mpc8610_hpcd_exit);
  531. MODULE_AUTHOR("Timur Tabi <timur@freescale.com>");
  532. MODULE_DESCRIPTION("Freescale MPC8610 HPCD ALSA SoC fabric driver");
  533. MODULE_LICENSE("GPL");