mop500.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /*
  2. * Copyright (C) ST-Ericsson SA 2012
  3. *
  4. * Author: Ola Lilja (ola.o.lilja@stericsson.com)
  5. * for ST-Ericsson.
  6. *
  7. * License terms:
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as published
  11. * by the Free Software Foundation.
  12. */
  13. #include <asm/mach-types.h>
  14. #include <linux/module.h>
  15. #include <linux/io.h>
  16. #include <linux/spi/spi.h>
  17. #include <sound/soc.h>
  18. #include <sound/initval.h>
  19. #include "ux500_pcm.h"
  20. #include "ux500_msp_dai.h"
  21. #include <mop500_ab8500.h>
  22. /* Define the whole MOP500 soundcard, linking platform to the codec-drivers */
  23. struct snd_soc_dai_link mop500_dai_links[] = {
  24. {
  25. .name = "ab8500_0",
  26. .stream_name = "ab8500_0",
  27. .cpu_dai_name = "ux500-msp-i2s.1",
  28. .codec_dai_name = "ab8500-codec-dai.0",
  29. .platform_name = "ux500-pcm.0",
  30. .codec_name = "ab8500-codec.0",
  31. .init = mop500_ab8500_machine_init,
  32. .ops = mop500_ab8500_ops,
  33. },
  34. {
  35. .name = "ab8500_1",
  36. .stream_name = "ab8500_1",
  37. .cpu_dai_name = "ux500-msp-i2s.3",
  38. .codec_dai_name = "ab8500-codec-dai.1",
  39. .platform_name = "ux500-pcm.0",
  40. .codec_name = "ab8500-codec.0",
  41. .init = NULL,
  42. .ops = mop500_ab8500_ops,
  43. },
  44. };
  45. static struct snd_soc_card mop500_card = {
  46. .name = "MOP500-card",
  47. .probe = NULL,
  48. .dai_link = mop500_dai_links,
  49. .num_links = ARRAY_SIZE(mop500_dai_links),
  50. };
  51. static int __devinit mop500_probe(struct platform_device *pdev)
  52. {
  53. int ret;
  54. pr_debug("%s: Enter.\n", __func__);
  55. dev_dbg(&pdev->dev, "%s: Enter.\n", __func__);
  56. mop500_card.dev = &pdev->dev;
  57. dev_dbg(&pdev->dev, "%s: Card %s: Set platform drvdata.\n",
  58. __func__, mop500_card.name);
  59. platform_set_drvdata(pdev, &mop500_card);
  60. snd_soc_card_set_drvdata(&mop500_card, NULL);
  61. dev_dbg(&pdev->dev, "%s: Card %s: num_links = %d\n",
  62. __func__, mop500_card.name, mop500_card.num_links);
  63. dev_dbg(&pdev->dev, "%s: Card %s: DAI-link 0: name = %s\n",
  64. __func__, mop500_card.name, mop500_card.dai_link[0].name);
  65. dev_dbg(&pdev->dev, "%s: Card %s: DAI-link 0: stream_name = %s\n",
  66. __func__, mop500_card.name,
  67. mop500_card.dai_link[0].stream_name);
  68. ret = snd_soc_register_card(&mop500_card);
  69. if (ret)
  70. dev_err(&pdev->dev,
  71. "Error: snd_soc_register_card failed (%d)!\n",
  72. ret);
  73. return ret;
  74. }
  75. static int __devexit mop500_remove(struct platform_device *pdev)
  76. {
  77. struct snd_soc_card *mop500_card = platform_get_drvdata(pdev);
  78. pr_debug("%s: Enter.\n", __func__);
  79. snd_soc_unregister_card(mop500_card);
  80. mop500_ab8500_remove(mop500_card);
  81. return 0;
  82. }
  83. static struct platform_driver snd_soc_mop500_driver = {
  84. .driver = {
  85. .owner = THIS_MODULE,
  86. .name = "snd-soc-mop500",
  87. },
  88. .probe = mop500_probe,
  89. .remove = __devexit_p(mop500_remove),
  90. };
  91. module_platform_driver(snd_soc_mop500_driver);