mpc8610_hpcd.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621
  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_machine 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. guts_set_pmuxcr_dma(machine_data->guts, 1, 0, 0);
  65. guts_set_pmuxcr_dma(machine_data->guts, 1, 3, 0);
  66. guts_set_pmuxcr_dma(machine_data->guts, 0, 3, 0);
  67. switch (machine_data->ssi_id) {
  68. case 0:
  69. clrsetbits_be32(&machine_data->guts->pmuxcr,
  70. CCSR_GUTS_PMUXCR_SSI1_MASK, CCSR_GUTS_PMUXCR_SSI1_SSI);
  71. break;
  72. case 1:
  73. clrsetbits_be32(&machine_data->guts->pmuxcr,
  74. CCSR_GUTS_PMUXCR_SSI2_MASK, CCSR_GUTS_PMUXCR_SSI2_SSI);
  75. break;
  76. }
  77. return 0;
  78. }
  79. /**
  80. * mpc8610_hpcd_startup: program the board with various hardware parameters
  81. *
  82. * This function takes board-specific information, like clock frequencies
  83. * and serial data formats, and passes that information to the codec and
  84. * transport drivers.
  85. */
  86. static int mpc8610_hpcd_startup(struct snd_pcm_substream *substream)
  87. {
  88. struct snd_soc_pcm_runtime *rtd = substream->private_data;
  89. struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;
  90. struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
  91. struct mpc8610_hpcd_data *machine_data =
  92. rtd->socdev->dev->platform_data;
  93. int ret = 0;
  94. /* Tell the CPU driver what the serial protocol is. */
  95. ret = snd_soc_dai_set_fmt(cpu_dai, machine_data->dai_format);
  96. if (ret < 0) {
  97. dev_err(substream->pcm->card->dev,
  98. "could not set CPU driver audio format\n");
  99. return ret;
  100. }
  101. /* Tell the codec driver what the serial protocol is. */
  102. ret = snd_soc_dai_set_fmt(codec_dai, machine_data->dai_format);
  103. if (ret < 0) {
  104. dev_err(substream->pcm->card->dev,
  105. "could not set codec driver audio format\n");
  106. return ret;
  107. }
  108. /*
  109. * Tell the CPU driver what the clock frequency is, and whether it's a
  110. * slave or master.
  111. */
  112. ret = snd_soc_dai_set_sysclk(cpu_dai, 0,
  113. machine_data->clk_frequency,
  114. machine_data->cpu_clk_direction);
  115. if (ret < 0) {
  116. dev_err(substream->pcm->card->dev,
  117. "could not set CPU driver clock parameters\n");
  118. return ret;
  119. }
  120. /*
  121. * Tell the codec driver what the MCLK frequency is, and whether it's
  122. * a slave or master.
  123. */
  124. ret = snd_soc_dai_set_sysclk(codec_dai, 0,
  125. machine_data->clk_frequency,
  126. machine_data->codec_clk_direction);
  127. if (ret < 0) {
  128. dev_err(substream->pcm->card->dev,
  129. "could not set codec driver clock params\n");
  130. return ret;
  131. }
  132. return 0;
  133. }
  134. /**
  135. * mpc8610_hpcd_machine_remove: Remove the sound device
  136. *
  137. * This function is called to remove the sound device for one SSI. We
  138. * de-program the DMACR and PMUXCR register.
  139. */
  140. int mpc8610_hpcd_machine_remove(struct platform_device *sound_device)
  141. {
  142. struct mpc8610_hpcd_data *machine_data =
  143. sound_device->dev.platform_data;
  144. /* Restore the signal routing */
  145. guts_set_dmacr(machine_data->guts, machine_data->dma_id,
  146. machine_data->dma_channel_id[0], 0);
  147. guts_set_dmacr(machine_data->guts, machine_data->dma_id,
  148. machine_data->dma_channel_id[1], 0);
  149. switch (machine_data->ssi_id) {
  150. case 0:
  151. clrsetbits_be32(&machine_data->guts->pmuxcr,
  152. CCSR_GUTS_PMUXCR_SSI1_MASK, CCSR_GUTS_PMUXCR_SSI1_LA);
  153. break;
  154. case 1:
  155. clrsetbits_be32(&machine_data->guts->pmuxcr,
  156. CCSR_GUTS_PMUXCR_SSI2_MASK, CCSR_GUTS_PMUXCR_SSI2_LA);
  157. break;
  158. }
  159. return 0;
  160. }
  161. /**
  162. * mpc8610_hpcd_ops: ASoC fabric driver operations
  163. */
  164. static struct snd_soc_ops mpc8610_hpcd_ops = {
  165. .startup = mpc8610_hpcd_startup,
  166. };
  167. /**
  168. * mpc8610_hpcd_machine: ASoC machine data
  169. */
  170. static struct snd_soc_machine mpc8610_hpcd_machine = {
  171. .probe = mpc8610_hpcd_machine_probe,
  172. .remove = mpc8610_hpcd_machine_remove,
  173. .name = "MPC8610 HPCD",
  174. .num_links = 1,
  175. };
  176. /**
  177. * mpc8610_hpcd_probe: OF probe function for the fabric driver
  178. *
  179. * This function gets called when an SSI node is found in the device tree.
  180. *
  181. * Although this is a fabric driver, the SSI node is the "master" node with
  182. * respect to audio hardware connections. Therefore, we create a new ASoC
  183. * device for each new SSI node that has a codec attached.
  184. *
  185. * FIXME: Currently, we only support one DMA controller, so if there are
  186. * multiple SSI nodes with codecs, only the first will be supported.
  187. *
  188. * FIXME: Even if we did support multiple DMA controllers, we have no
  189. * mechanism for assigning DMA controllers and channels to the individual
  190. * SSI devices. We also probably aren't compatible with the generic Elo DMA
  191. * device driver.
  192. */
  193. static int mpc8610_hpcd_probe(struct of_device *ofdev,
  194. const struct of_device_id *match)
  195. {
  196. struct device_node *np = ofdev->node;
  197. struct device_node *codec_np = NULL;
  198. struct device_node *guts_np = NULL;
  199. struct device_node *dma_np = NULL;
  200. struct device_node *dma_channel_np = NULL;
  201. const phandle *codec_ph;
  202. const char *sprop;
  203. const u32 *iprop;
  204. struct resource res;
  205. struct platform_device *sound_device = NULL;
  206. struct mpc8610_hpcd_data *machine_data;
  207. struct fsl_ssi_info ssi_info;
  208. struct fsl_dma_info dma_info;
  209. int ret = -ENODEV;
  210. machine_data = kzalloc(sizeof(struct mpc8610_hpcd_data), GFP_KERNEL);
  211. if (!machine_data)
  212. return -ENOMEM;
  213. memset(&ssi_info, 0, sizeof(ssi_info));
  214. memset(&dma_info, 0, sizeof(dma_info));
  215. ssi_info.dev = &ofdev->dev;
  216. /*
  217. * We are only interested in SSIs with a codec phandle in them, so let's
  218. * make sure this SSI has one.
  219. */
  220. codec_ph = of_get_property(np, "codec-handle", NULL);
  221. if (!codec_ph)
  222. goto error;
  223. codec_np = of_find_node_by_phandle(*codec_ph);
  224. if (!codec_np)
  225. goto error;
  226. /* The MPC8610 HPCD only knows about the CS4270 codec, so reject
  227. anything else. */
  228. if (!of_device_is_compatible(codec_np, "cirrus,cs4270"))
  229. goto error;
  230. /* Get the device ID */
  231. iprop = of_get_property(np, "cell-index", NULL);
  232. if (!iprop) {
  233. dev_err(&ofdev->dev, "cell-index property not found\n");
  234. ret = -EINVAL;
  235. goto error;
  236. }
  237. machine_data->ssi_id = *iprop;
  238. ssi_info.id = *iprop;
  239. /* Get the serial format and clock direction. */
  240. sprop = of_get_property(np, "fsl,mode", NULL);
  241. if (!sprop) {
  242. dev_err(&ofdev->dev, "fsl,mode property not found\n");
  243. ret = -EINVAL;
  244. goto error;
  245. }
  246. if (strcasecmp(sprop, "i2s-slave") == 0) {
  247. machine_data->dai_format = SND_SOC_DAIFMT_I2S;
  248. machine_data->codec_clk_direction = SND_SOC_CLOCK_OUT;
  249. machine_data->cpu_clk_direction = SND_SOC_CLOCK_IN;
  250. /*
  251. * In i2s-slave mode, the codec has its own clock source, so we
  252. * need to get the frequency from the device tree and pass it to
  253. * the codec driver.
  254. */
  255. iprop = of_get_property(codec_np, "clock-frequency", NULL);
  256. if (!iprop || !*iprop) {
  257. dev_err(&ofdev->dev, "codec bus-frequency property "
  258. "is missing or invalid\n");
  259. ret = -EINVAL;
  260. goto error;
  261. }
  262. machine_data->clk_frequency = *iprop;
  263. } else if (strcasecmp(sprop, "i2s-master") == 0) {
  264. machine_data->dai_format = SND_SOC_DAIFMT_I2S;
  265. machine_data->codec_clk_direction = SND_SOC_CLOCK_IN;
  266. machine_data->cpu_clk_direction = SND_SOC_CLOCK_OUT;
  267. } else if (strcasecmp(sprop, "lj-slave") == 0) {
  268. machine_data->dai_format = SND_SOC_DAIFMT_LEFT_J;
  269. machine_data->codec_clk_direction = SND_SOC_CLOCK_OUT;
  270. machine_data->cpu_clk_direction = SND_SOC_CLOCK_IN;
  271. } else if (strcasecmp(sprop, "lj-master") == 0) {
  272. machine_data->dai_format = SND_SOC_DAIFMT_LEFT_J;
  273. machine_data->codec_clk_direction = SND_SOC_CLOCK_IN;
  274. machine_data->cpu_clk_direction = SND_SOC_CLOCK_OUT;
  275. } else if (strcasecmp(sprop, "rj-slave") == 0) {
  276. machine_data->dai_format = SND_SOC_DAIFMT_RIGHT_J;
  277. machine_data->codec_clk_direction = SND_SOC_CLOCK_OUT;
  278. machine_data->cpu_clk_direction = SND_SOC_CLOCK_IN;
  279. } else if (strcasecmp(sprop, "rj-master") == 0) {
  280. machine_data->dai_format = SND_SOC_DAIFMT_RIGHT_J;
  281. machine_data->codec_clk_direction = SND_SOC_CLOCK_IN;
  282. machine_data->cpu_clk_direction = SND_SOC_CLOCK_OUT;
  283. } else if (strcasecmp(sprop, "ac97-slave") == 0) {
  284. machine_data->dai_format = SND_SOC_DAIFMT_AC97;
  285. machine_data->codec_clk_direction = SND_SOC_CLOCK_OUT;
  286. machine_data->cpu_clk_direction = SND_SOC_CLOCK_IN;
  287. } else if (strcasecmp(sprop, "ac97-master") == 0) {
  288. machine_data->dai_format = SND_SOC_DAIFMT_AC97;
  289. machine_data->codec_clk_direction = SND_SOC_CLOCK_IN;
  290. machine_data->cpu_clk_direction = SND_SOC_CLOCK_OUT;
  291. } else {
  292. dev_err(&ofdev->dev,
  293. "unrecognized fsl,mode property \"%s\"\n", sprop);
  294. ret = -EINVAL;
  295. goto error;
  296. }
  297. if (!machine_data->clk_frequency) {
  298. dev_err(&ofdev->dev, "unknown clock frequency\n");
  299. ret = -EINVAL;
  300. goto error;
  301. }
  302. /* Read the SSI information from the device tree */
  303. ret = of_address_to_resource(np, 0, &res);
  304. if (ret) {
  305. dev_err(&ofdev->dev, "could not obtain SSI address\n");
  306. goto error;
  307. }
  308. if (!res.start) {
  309. dev_err(&ofdev->dev, "invalid SSI address\n");
  310. goto error;
  311. }
  312. ssi_info.ssi_phys = res.start;
  313. machine_data->ssi = ioremap(ssi_info.ssi_phys, sizeof(struct ccsr_ssi));
  314. if (!machine_data->ssi) {
  315. dev_err(&ofdev->dev, "could not map SSI address %x\n",
  316. ssi_info.ssi_phys);
  317. ret = -EINVAL;
  318. goto error;
  319. }
  320. ssi_info.ssi = machine_data->ssi;
  321. /* Get the IRQ of the SSI */
  322. machine_data->ssi_irq = irq_of_parse_and_map(np, 0);
  323. if (!machine_data->ssi_irq) {
  324. dev_err(&ofdev->dev, "could not get SSI IRQ\n");
  325. ret = -EINVAL;
  326. goto error;
  327. }
  328. ssi_info.irq = machine_data->ssi_irq;
  329. /* Map the global utilities registers. */
  330. guts_np = of_find_compatible_node(NULL, NULL, "fsl,mpc8610-guts");
  331. if (!guts_np) {
  332. dev_err(&ofdev->dev, "could not obtain address of GUTS\n");
  333. ret = -EINVAL;
  334. goto error;
  335. }
  336. machine_data->guts = of_iomap(guts_np, 0);
  337. of_node_put(guts_np);
  338. if (!machine_data->guts) {
  339. dev_err(&ofdev->dev, "could not map GUTS\n");
  340. ret = -EINVAL;
  341. goto error;
  342. }
  343. /* Find the DMA channels to use. For now, we always use the first DMA
  344. controller. */
  345. for_each_compatible_node(dma_np, NULL, "fsl,mpc8610-dma") {
  346. iprop = of_get_property(dma_np, "cell-index", NULL);
  347. if (iprop && (*iprop == 0)) {
  348. of_node_put(dma_np);
  349. break;
  350. }
  351. }
  352. if (!dma_np) {
  353. dev_err(&ofdev->dev, "could not find DMA node\n");
  354. ret = -EINVAL;
  355. goto error;
  356. }
  357. machine_data->dma_id = *iprop;
  358. /*
  359. * Find the DMA channels to use. For now, we always use DMA channel 0
  360. * for playback, and DMA channel 1 for capture.
  361. */
  362. while ((dma_channel_np = of_get_next_child(dma_np, dma_channel_np))) {
  363. iprop = of_get_property(dma_channel_np, "cell-index", NULL);
  364. /* Is it DMA channel 0? */
  365. if (iprop && (*iprop == 0)) {
  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 == 1)) {
  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. mpc8610_hpcd_machine.dai_link = &machine_data->dai;
  408. /* Allocate a new audio platform device structure */
  409. sound_device = platform_device_alloc("soc-audio", -1);
  410. if (!sound_device) {
  411. dev_err(&ofdev->dev, "platform device allocation failed\n");
  412. ret = -ENOMEM;
  413. goto error;
  414. }
  415. machine_data->sound_devdata.machine = &mpc8610_hpcd_machine;
  416. machine_data->sound_devdata.codec_dev = &soc_codec_device_cs4270;
  417. machine_data->sound_devdata.platform = &fsl_soc_platform;
  418. sound_device->dev.platform_data = machine_data;
  419. /* Set the platform device and ASoC device to point to each other */
  420. platform_set_drvdata(sound_device, &machine_data->sound_devdata);
  421. machine_data->sound_devdata.dev = &sound_device->dev;
  422. /* Tell ASoC to probe us. This will call mpc8610_hpcd_machine.probe(),
  423. if it exists. */
  424. ret = platform_device_add(sound_device);
  425. if (ret) {
  426. dev_err(&ofdev->dev, "platform device add failed\n");
  427. goto error;
  428. }
  429. dev_set_drvdata(&ofdev->dev, sound_device);
  430. return 0;
  431. error:
  432. of_node_put(codec_np);
  433. of_node_put(guts_np);
  434. of_node_put(dma_np);
  435. of_node_put(dma_channel_np);
  436. if (sound_device)
  437. platform_device_unregister(sound_device);
  438. if (machine_data->dai.cpu_dai)
  439. fsl_ssi_destroy_dai(machine_data->dai.cpu_dai);
  440. if (ssi_info.ssi)
  441. iounmap(ssi_info.ssi);
  442. if (ssi_info.irq)
  443. irq_dispose_mapping(ssi_info.irq);
  444. if (dma_info.dma_channel[0])
  445. iounmap(dma_info.dma_channel[0]);
  446. if (dma_info.dma_channel[1])
  447. iounmap(dma_info.dma_channel[1]);
  448. if (dma_info.dma_irq[0])
  449. irq_dispose_mapping(dma_info.dma_irq[0]);
  450. if (dma_info.dma_irq[1])
  451. irq_dispose_mapping(dma_info.dma_irq[1]);
  452. if (machine_data->guts)
  453. iounmap(machine_data->guts);
  454. kfree(machine_data);
  455. return ret;
  456. }
  457. /**
  458. * mpc8610_hpcd_remove: remove the OF device
  459. *
  460. * This function is called when the OF device is removed.
  461. */
  462. static int mpc8610_hpcd_remove(struct of_device *ofdev)
  463. {
  464. struct platform_device *sound_device = dev_get_drvdata(&ofdev->dev);
  465. struct mpc8610_hpcd_data *machine_data =
  466. sound_device->dev.platform_data;
  467. platform_device_unregister(sound_device);
  468. if (machine_data->dai.cpu_dai)
  469. fsl_ssi_destroy_dai(machine_data->dai.cpu_dai);
  470. if (machine_data->ssi)
  471. iounmap(machine_data->ssi);
  472. if (machine_data->dma[0])
  473. iounmap(machine_data->dma[0]);
  474. if (machine_data->dma[1])
  475. iounmap(machine_data->dma[1]);
  476. if (machine_data->dma_irq[0])
  477. irq_dispose_mapping(machine_data->dma_irq[0]);
  478. if (machine_data->dma_irq[1])
  479. irq_dispose_mapping(machine_data->dma_irq[1]);
  480. if (machine_data->guts)
  481. iounmap(machine_data->guts);
  482. kfree(machine_data);
  483. sound_device->dev.platform_data = NULL;
  484. dev_set_drvdata(&ofdev->dev, NULL);
  485. return 0;
  486. }
  487. static struct of_device_id mpc8610_hpcd_match[] = {
  488. {
  489. .compatible = "fsl,mpc8610-ssi",
  490. },
  491. {}
  492. };
  493. MODULE_DEVICE_TABLE(of, mpc8610_hpcd_match);
  494. static struct of_platform_driver mpc8610_hpcd_of_driver = {
  495. .owner = THIS_MODULE,
  496. .name = "mpc8610_hpcd",
  497. .match_table = mpc8610_hpcd_match,
  498. .probe = mpc8610_hpcd_probe,
  499. .remove = mpc8610_hpcd_remove,
  500. };
  501. /**
  502. * mpc8610_hpcd_init: fabric driver initialization.
  503. *
  504. * This function is called when this module is loaded.
  505. */
  506. static int __init mpc8610_hpcd_init(void)
  507. {
  508. int ret;
  509. printk(KERN_INFO "Freescale MPC8610 HPCD ALSA SoC fabric driver\n");
  510. ret = of_register_platform_driver(&mpc8610_hpcd_of_driver);
  511. if (ret)
  512. printk(KERN_ERR
  513. "mpc8610-hpcd: failed to register platform driver\n");
  514. return ret;
  515. }
  516. /**
  517. * mpc8610_hpcd_exit: fabric driver exit
  518. *
  519. * This function is called when this driver is unloaded.
  520. */
  521. static void __exit mpc8610_hpcd_exit(void)
  522. {
  523. of_unregister_platform_driver(&mpc8610_hpcd_of_driver);
  524. }
  525. module_init(mpc8610_hpcd_init);
  526. module_exit(mpc8610_hpcd_exit);
  527. MODULE_AUTHOR("Timur Tabi <timur@freescale.com>");
  528. MODULE_DESCRIPTION("Freescale MPC8610 HPCD ALSA SoC fabric driver");
  529. MODULE_LICENSE("GPL");