simone.c 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * simone.c -- ASoC audio for Simplemachines Sim.One board
  4. *
  5. * Copyright (c) 2010 Mika Westerberg
  6. *
  7. * Based on snappercl15 machine driver by Ryan Mallon.
  8. */
  9. #include <linux/init.h>
  10. #include <linux/module.h>
  11. #include <linux/platform_device.h>
  12. #include <linux/soc/cirrus/ep93xx.h>
  13. #include <sound/core.h>
  14. #include <sound/pcm.h>
  15. #include <sound/soc.h>
  16. #include <asm/mach-types.h>
  17. SND_SOC_DAILINK_DEFS(hifi,
  18. DAILINK_COMP_ARRAY(COMP_CPU("ep93xx-ac97")),
  19. DAILINK_COMP_ARRAY(COMP_CODEC("ac97-codec", "ac97-hifi")),
  20. DAILINK_COMP_ARRAY(COMP_PLATFORM("ep93xx-ac97")));
  21. static struct snd_soc_dai_link simone_dai = {
  22. .name = "AC97",
  23. .stream_name = "AC97 HiFi",
  24. SND_SOC_DAILINK_REG(hifi),
  25. };
  26. static struct snd_soc_card snd_soc_simone = {
  27. .name = "Sim.One",
  28. .owner = THIS_MODULE,
  29. .dai_link = &simone_dai,
  30. .num_links = 1,
  31. };
  32. static struct platform_device *simone_snd_ac97_device;
  33. static int simone_probe(struct platform_device *pdev)
  34. {
  35. struct snd_soc_card *card = &snd_soc_simone;
  36. int ret;
  37. simone_snd_ac97_device = platform_device_register_simple("ac97-codec",
  38. -1, NULL, 0);
  39. if (IS_ERR(simone_snd_ac97_device))
  40. return PTR_ERR(simone_snd_ac97_device);
  41. card->dev = &pdev->dev;
  42. ret = snd_soc_register_card(card);
  43. if (ret) {
  44. dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
  45. ret);
  46. platform_device_unregister(simone_snd_ac97_device);
  47. }
  48. return ret;
  49. }
  50. static int simone_remove(struct platform_device *pdev)
  51. {
  52. struct snd_soc_card *card = platform_get_drvdata(pdev);
  53. snd_soc_unregister_card(card);
  54. platform_device_unregister(simone_snd_ac97_device);
  55. return 0;
  56. }
  57. static struct platform_driver simone_driver = {
  58. .driver = {
  59. .name = "simone-audio",
  60. },
  61. .probe = simone_probe,
  62. .remove = simone_remove,
  63. };
  64. module_platform_driver(simone_driver);
  65. MODULE_DESCRIPTION("ALSA SoC Simplemachines Sim.One");
  66. MODULE_AUTHOR("Mika Westerberg <[email protected]>");
  67. MODULE_LICENSE("GPL");
  68. MODULE_ALIAS("platform:simone-audio");