pcm5102a.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Driver for the PCM5102A codec
  4. *
  5. * Author: Florian Meier <florian.meier@koalo.de>
  6. * Copyright 2013
  7. */
  8. #include <linux/init.h>
  9. #include <linux/module.h>
  10. #include <linux/platform_device.h>
  11. #include <sound/soc.h>
  12. static struct snd_soc_dai_driver pcm5102a_dai = {
  13. .name = "pcm5102a-hifi",
  14. .playback = {
  15. .channels_min = 2,
  16. .channels_max = 2,
  17. .rates = SNDRV_PCM_RATE_8000_192000,
  18. .formats = SNDRV_PCM_FMTBIT_S16_LE |
  19. SNDRV_PCM_FMTBIT_S24_LE |
  20. SNDRV_PCM_FMTBIT_S32_LE
  21. },
  22. };
  23. static struct snd_soc_component_driver soc_component_dev_pcm5102a = {
  24. .idle_bias_on = 1,
  25. .use_pmdown_time = 1,
  26. .endianness = 1,
  27. .non_legacy_dai_naming = 1,
  28. };
  29. static int pcm5102a_probe(struct platform_device *pdev)
  30. {
  31. return devm_snd_soc_register_component(&pdev->dev, &soc_component_dev_pcm5102a,
  32. &pcm5102a_dai, 1);
  33. }
  34. static const struct of_device_id pcm5102a_of_match[] = {
  35. { .compatible = "ti,pcm5102a", },
  36. { }
  37. };
  38. MODULE_DEVICE_TABLE(of, pcm5102a_of_match);
  39. static struct platform_driver pcm5102a_codec_driver = {
  40. .probe = pcm5102a_probe,
  41. .driver = {
  42. .name = "pcm5102a-codec",
  43. .of_match_table = pcm5102a_of_match,
  44. },
  45. };
  46. module_platform_driver(pcm5102a_codec_driver);
  47. MODULE_DESCRIPTION("ASoC PCM5102A codec driver");
  48. MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>");
  49. MODULE_LICENSE("GPL v2");