pcm5102a.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * Driver for the PCM5102A codec
  3. *
  4. * Author: Florian Meier <florian.meier@koalo.de>
  5. * Copyright 2013
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * version 2 as published by the Free Software Foundation.
  10. *
  11. * This program is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. */
  16. #include <linux/init.h>
  17. #include <linux/module.h>
  18. #include <linux/platform_device.h>
  19. #include <sound/soc.h>
  20. static struct snd_soc_dai_driver pcm5102a_dai = {
  21. .name = "pcm5102a-hifi",
  22. .playback = {
  23. .channels_min = 2,
  24. .channels_max = 2,
  25. .rates = SNDRV_PCM_RATE_8000_192000,
  26. .formats = SNDRV_PCM_FMTBIT_S16_LE |
  27. SNDRV_PCM_FMTBIT_S24_LE |
  28. SNDRV_PCM_FMTBIT_S32_LE
  29. },
  30. };
  31. static struct snd_soc_codec_driver soc_codec_dev_pcm5102a;
  32. static int pcm5102a_probe(struct platform_device *pdev)
  33. {
  34. return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_pcm5102a,
  35. &pcm5102a_dai, 1);
  36. }
  37. static int pcm5102a_remove(struct platform_device *pdev)
  38. {
  39. snd_soc_unregister_codec(&pdev->dev);
  40. return 0;
  41. }
  42. static const struct of_device_id pcm5102a_of_match[] = {
  43. { .compatible = "ti,pcm5102a", },
  44. { }
  45. };
  46. MODULE_DEVICE_TABLE(of, pcm5102a_of_match);
  47. static struct platform_driver pcm5102a_codec_driver = {
  48. .probe = pcm5102a_probe,
  49. .remove = pcm5102a_remove,
  50. .driver = {
  51. .name = "pcm5102a-codec",
  52. .of_match_table = pcm5102a_of_match,
  53. },
  54. };
  55. module_platform_driver(pcm5102a_codec_driver);
  56. MODULE_DESCRIPTION("ASoC PCM5102A codec driver");
  57. MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>");
  58. MODULE_LICENSE("GPL v2");