0031-ASoC-Add-support-for-PCM5102A-codec.patch 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. From c3294683a11a781ec75c31d0717bee4f6438c6e6 Mon Sep 17 00:00:00 2001
  2. From: Florian Meier <florian.meier@koalo.de>
  3. Date: Fri, 22 Nov 2013 14:59:51 +0100
  4. Subject: [PATCH 031/114] ASoC: Add support for PCM5102A codec
  5. Some definitions to support the PCM5102A codec
  6. by Texas Instruments.
  7. Signed-off-by: Florian Meier <florian.meier@koalo.de>
  8. ---
  9. sound/soc/codecs/Kconfig | 4 +++
  10. sound/soc/codecs/Makefile | 2 ++
  11. sound/soc/codecs/pcm5102a.c | 63 +++++++++++++++++++++++++++++++++++++++++++++
  12. 3 files changed, 69 insertions(+)
  13. create mode 100644 sound/soc/codecs/pcm5102a.c
  14. --- a/sound/soc/codecs/Kconfig
  15. +++ b/sound/soc/codecs/Kconfig
  16. @@ -80,6 +80,7 @@ config SND_SOC_ALL_CODECS
  17. select SND_SOC_PCM512x_I2C if I2C
  18. select SND_SOC_PCM512x_SPI if SPI_MASTER
  19. select SND_SOC_RT286 if I2C
  20. + select SND_SOC_PCM5102A if I2C
  21. select SND_SOC_RT5631 if I2C
  22. select SND_SOC_RT5640 if I2C
  23. select SND_SOC_RT5645 if I2C
  24. @@ -486,6 +487,9 @@ config SND_SOC_RT286
  25. tristate
  26. depends on I2C
  27. +config SND_SOC_PCM5102A
  28. + tristate
  29. +
  30. config SND_SOC_RT5631
  31. tristate
  32. --- a/sound/soc/codecs/Makefile
  33. +++ b/sound/soc/codecs/Makefile
  34. @@ -74,6 +74,7 @@ snd-soc-pcm512x-i2c-objs := pcm512x-i2c.
  35. snd-soc-pcm512x-spi-objs := pcm512x-spi.o
  36. snd-soc-rl6231-objs := rl6231.o
  37. snd-soc-rt286-objs := rt286.o
  38. +snd-soc-pcm5102a-objs := pcm5102a.o
  39. snd-soc-rt5631-objs := rt5631.o
  40. snd-soc-rt5640-objs := rt5640.o
  41. snd-soc-rt5645-objs := rt5645.o
  42. @@ -250,6 +251,7 @@ obj-$(CONFIG_SND_SOC_PCM512x_I2C) += snd
  43. obj-$(CONFIG_SND_SOC_PCM512x_SPI) += snd-soc-pcm512x-spi.o
  44. obj-$(CONFIG_SND_SOC_RL6231) += snd-soc-rl6231.o
  45. obj-$(CONFIG_SND_SOC_RT286) += snd-soc-rt286.o
  46. +obj-$(CONFIG_SND_SOC_PCM5102A) += snd-soc-pcm5102a.o
  47. obj-$(CONFIG_SND_SOC_RT5631) += snd-soc-rt5631.o
  48. obj-$(CONFIG_SND_SOC_RT5640) += snd-soc-rt5640.o
  49. obj-$(CONFIG_SND_SOC_RT5645) += snd-soc-rt5645.o
  50. --- /dev/null
  51. +++ b/sound/soc/codecs/pcm5102a.c
  52. @@ -0,0 +1,63 @@
  53. +/*
  54. + * Driver for the PCM5102A codec
  55. + *
  56. + * Author: Florian Meier <florian.meier@koalo.de>
  57. + * Copyright 2013
  58. + *
  59. + * This program is free software; you can redistribute it and/or
  60. + * modify it under the terms of the GNU General Public License
  61. + * version 2 as published by the Free Software Foundation.
  62. + *
  63. + * This program is distributed in the hope that it will be useful, but
  64. + * WITHOUT ANY WARRANTY; without even the implied warranty of
  65. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  66. + * General Public License for more details.
  67. + */
  68. +
  69. +
  70. +#include <linux/init.h>
  71. +#include <linux/module.h>
  72. +#include <linux/platform_device.h>
  73. +
  74. +#include <sound/soc.h>
  75. +
  76. +static struct snd_soc_dai_driver pcm5102a_dai = {
  77. + .name = "pcm5102a-hifi",
  78. + .playback = {
  79. + .channels_min = 2,
  80. + .channels_max = 2,
  81. + .rates = SNDRV_PCM_RATE_8000_192000,
  82. + .formats = SNDRV_PCM_FMTBIT_S16_LE |
  83. + SNDRV_PCM_FMTBIT_S24_LE |
  84. + SNDRV_PCM_FMTBIT_S32_LE
  85. + },
  86. +};
  87. +
  88. +static struct snd_soc_codec_driver soc_codec_dev_pcm5102a;
  89. +
  90. +static int pcm5102a_probe(struct platform_device *pdev)
  91. +{
  92. + return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_pcm5102a,
  93. + &pcm5102a_dai, 1);
  94. +}
  95. +
  96. +static int pcm5102a_remove(struct platform_device *pdev)
  97. +{
  98. + snd_soc_unregister_codec(&pdev->dev);
  99. + return 0;
  100. +}
  101. +
  102. +static struct platform_driver pcm5102a_codec_driver = {
  103. + .probe = pcm5102a_probe,
  104. + .remove = pcm5102a_remove,
  105. + .driver = {
  106. + .name = "pcm5102a-codec",
  107. + .owner = THIS_MODULE,
  108. + },
  109. +};
  110. +
  111. +module_platform_driver(pcm5102a_codec_driver);
  112. +
  113. +MODULE_DESCRIPTION("ASoC PCM5102A codec driver");
  114. +MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>");
  115. +MODULE_LICENSE("GPL v2");