mpc8610_hpcd.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619
  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. /* Map the global utilities registers. */
  320. guts_np = of_find_compatible_node(NULL, NULL, "fsl,mpc8610-guts");
  321. if (!guts_np) {
  322. dev_err(&ofdev->dev, "could not obtain address of GUTS\n");
  323. ret = -EINVAL;
  324. goto error;
  325. }
  326. machine_data->guts = of_iomap(guts_np, 0);
  327. of_node_put(guts_np);
  328. if (!machine_data->guts) {
  329. dev_err(&ofdev->dev, "could not map GUTS\n");
  330. ret = -EINVAL;
  331. goto error;
  332. }
  333. /* Find the DMA channels to use. Both SSIs need to use the same DMA
  334. * controller, so let's use DMA#1.
  335. */
  336. for_each_compatible_node(dma_np, NULL, "fsl,mpc8610-dma") {
  337. iprop = of_get_property(dma_np, "cell-index", NULL);
  338. if (iprop && (*iprop == 0)) {
  339. of_node_put(dma_np);
  340. break;
  341. }
  342. }
  343. if (!dma_np) {
  344. dev_err(&ofdev->dev, "could not find DMA node\n");
  345. ret = -EINVAL;
  346. goto error;
  347. }
  348. machine_data->dma_id = *iprop;
  349. /* SSI1 needs to use DMA Channels 0 and 1, and SSI2 needs to use DMA
  350. * channels 2 and 3. This is just how the MPC8610 is wired
  351. * internally.
  352. */
  353. playback_dma_channel = (machine_data->ssi_id == 0) ? 0 : 2;
  354. capture_dma_channel = (machine_data->ssi_id == 0) ? 1 : 3;
  355. /*
  356. * Find the DMA channels to use.
  357. */
  358. while ((dma_channel_np = of_get_next_child(dma_np, dma_channel_np))) {
  359. iprop = of_get_property(dma_channel_np, "cell-index", NULL);
  360. if (iprop && (*iprop == playback_dma_channel)) {
  361. /* dma_channel[0] and dma_irq[0] are for playback */
  362. dma_info.dma_channel[0] = of_iomap(dma_channel_np, 0);
  363. dma_info.dma_irq[0] =
  364. irq_of_parse_and_map(dma_channel_np, 0);
  365. machine_data->dma_channel_id[0] = *iprop;
  366. continue;
  367. }
  368. if (iprop && (*iprop == capture_dma_channel)) {
  369. /* dma_channel[1] and dma_irq[1] are for capture */
  370. dma_info.dma_channel[1] = of_iomap(dma_channel_np, 0);
  371. dma_info.dma_irq[1] =
  372. irq_of_parse_and_map(dma_channel_np, 0);
  373. machine_data->dma_channel_id[1] = *iprop;
  374. continue;
  375. }
  376. }
  377. if (!dma_info.dma_channel[0] || !dma_info.dma_channel[1] ||
  378. !dma_info.dma_irq[0] || !dma_info.dma_irq[1]) {
  379. dev_err(&ofdev->dev, "could not find DMA channels\n");
  380. ret = -EINVAL;
  381. goto error;
  382. }
  383. dma_info.ssi_stx_phys = ssi_info.ssi_phys +
  384. offsetof(struct ccsr_ssi, stx0);
  385. dma_info.ssi_srx_phys = ssi_info.ssi_phys +
  386. offsetof(struct ccsr_ssi, srx0);
  387. /* We have the DMA information, so tell the DMA driver what it is */
  388. if (!fsl_dma_configure(&dma_info)) {
  389. dev_err(&ofdev->dev, "could not instantiate DMA device\n");
  390. ret = -EBUSY;
  391. goto error;
  392. }
  393. /*
  394. * Initialize our DAI data structure. We should probably get this
  395. * information from the device tree.
  396. */
  397. machine_data->dai.name = "CS4270";
  398. machine_data->dai.stream_name = "CS4270";
  399. machine_data->dai.cpu_dai = fsl_ssi_create_dai(&ssi_info);
  400. machine_data->dai.codec_dai = &cs4270_dai; /* The codec_dai we want */
  401. machine_data->dai.ops = &mpc8610_hpcd_ops;
  402. machine_data->machine.probe = mpc8610_hpcd_machine_probe;
  403. machine_data->machine.remove = mpc8610_hpcd_machine_remove;
  404. machine_data->machine.name = "MPC8610 HPCD";
  405. machine_data->machine.num_links = 1;
  406. machine_data->machine.dai_link = &machine_data->dai;
  407. /* Allocate a new audio platform device structure */
  408. sound_device = platform_device_alloc("soc-audio", -1);
  409. if (!sound_device) {
  410. dev_err(&ofdev->dev, "platform device allocation failed\n");
  411. ret = -ENOMEM;
  412. goto error;
  413. }
  414. machine_data->sound_devdata.card = &machine_data->machine;
  415. machine_data->sound_devdata.codec_dev = &soc_codec_device_cs4270;
  416. machine_data->machine.platform = &fsl_soc_platform;
  417. sound_device->dev.platform_data = machine_data;
  418. /* Set the platform device and ASoC device to point to each other */
  419. platform_set_drvdata(sound_device, &machine_data->sound_devdata);
  420. machine_data->sound_devdata.dev = &sound_device->dev;
  421. /* Tell ASoC to probe us. This will call mpc8610_hpcd_machine.probe(),
  422. if it exists. */
  423. ret = platform_device_add(sound_device);
  424. if (ret) {
  425. dev_err(&ofdev->dev, "platform device add failed\n");
  426. goto error;
  427. }
  428. dev_set_drvdata(&ofdev->dev, sound_device);
  429. return 0;
  430. error:
  431. of_node_put(codec_np);
  432. of_node_put(guts_np);
  433. of_node_put(dma_np);
  434. of_node_put(dma_channel_np);
  435. if (sound_device)
  436. platform_device_unregister(sound_device);
  437. if (machine_data->dai.cpu_dai)
  438. fsl_ssi_destroy_dai(machine_data->dai.cpu_dai);
  439. if (ssi_info.ssi)
  440. iounmap(ssi_info.ssi);
  441. if (ssi_info.irq)
  442. irq_dispose_mapping(ssi_info.irq);
  443. if (dma_info.dma_channel[0])
  444. iounmap(dma_info.dma_channel[0]);
  445. if (dma_info.dma_channel[1])
  446. iounmap(dma_info.dma_channel[1]);
  447. if (dma_info.dma_irq[0])
  448. irq_dispose_mapping(dma_info.dma_irq[0]);
  449. if (dma_info.dma_irq[1])
  450. irq_dispose_mapping(dma_info.dma_irq[1]);
  451. if (machine_data->guts)
  452. iounmap(machine_data->guts);
  453. kfree(machine_data);
  454. return ret;
  455. }
  456. /**
  457. * mpc8610_hpcd_remove: remove the OF device
  458. *
  459. * This function is called when the OF device is removed.
  460. */
  461. static int mpc8610_hpcd_remove(struct of_device *ofdev)
  462. {
  463. struct platform_device *sound_device = dev_get_drvdata(&ofdev->dev);
  464. struct mpc8610_hpcd_data *machine_data =
  465. sound_device->dev.platform_data;
  466. platform_device_unregister(sound_device);
  467. if (machine_data->dai.cpu_dai)
  468. fsl_ssi_destroy_dai(machine_data->dai.cpu_dai);
  469. if (machine_data->ssi)
  470. iounmap(machine_data->ssi);
  471. if (machine_data->dma[0])
  472. iounmap(machine_data->dma[0]);
  473. if (machine_data->dma[1])
  474. iounmap(machine_data->dma[1]);
  475. if (machine_data->dma_irq[0])
  476. irq_dispose_mapping(machine_data->dma_irq[0]);
  477. if (machine_data->dma_irq[1])
  478. irq_dispose_mapping(machine_data->dma_irq[1]);
  479. if (machine_data->guts)
  480. iounmap(machine_data->guts);
  481. kfree(machine_data);
  482. sound_device->dev.platform_data = NULL;
  483. dev_set_drvdata(&ofdev->dev, NULL);
  484. return 0;
  485. }
  486. static struct of_device_id mpc8610_hpcd_match[] = {
  487. {
  488. .compatible = "fsl,mpc8610-ssi",
  489. },
  490. {}
  491. };
  492. MODULE_DEVICE_TABLE(of, mpc8610_hpcd_match);
  493. static struct of_platform_driver mpc8610_hpcd_of_driver = {
  494. .owner = THIS_MODULE,
  495. .name = "mpc8610_hpcd",
  496. .match_table = mpc8610_hpcd_match,
  497. .probe = mpc8610_hpcd_probe,
  498. .remove = mpc8610_hpcd_remove,
  499. };
  500. /**
  501. * mpc8610_hpcd_init: fabric driver initialization.
  502. *
  503. * This function is called when this module is loaded.
  504. */
  505. static int __init mpc8610_hpcd_init(void)
  506. {
  507. int ret;
  508. printk(KERN_INFO "Freescale MPC8610 HPCD ALSA SoC fabric driver\n");
  509. ret = of_register_platform_driver(&mpc8610_hpcd_of_driver);
  510. if (ret)
  511. printk(KERN_ERR
  512. "mpc8610-hpcd: failed to register platform driver\n");
  513. return ret;
  514. }
  515. /**
  516. * mpc8610_hpcd_exit: fabric driver exit
  517. *
  518. * This function is called when this driver is unloaded.
  519. */
  520. static void __exit mpc8610_hpcd_exit(void)
  521. {
  522. of_unregister_platform_driver(&mpc8610_hpcd_of_driver);
  523. }
  524. module_init(mpc8610_hpcd_init);
  525. module_exit(mpc8610_hpcd_exit);
  526. MODULE_AUTHOR("Timur Tabi <timur@freescale.com>");
  527. MODULE_DESCRIPTION("Freescale MPC8610 HPCD ALSA SoC fabric driver");
  528. MODULE_LICENSE("GPL");