wm8727.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * wm8727.c
  4. *
  5. * Created on: 15-Oct-2009
  6. * Author: neil.jones@imgtec.com
  7. *
  8. * Copyright (C) 2009 Imagination Technologies Ltd.
  9. */
  10. #include <linux/init.h>
  11. #include <linux/slab.h>
  12. #include <linux/module.h>
  13. #include <linux/kernel.h>
  14. #include <linux/device.h>
  15. #include <sound/core.h>
  16. #include <sound/pcm.h>
  17. #include <sound/initval.h>
  18. #include <sound/soc.h>
  19. static const struct snd_soc_dapm_widget wm8727_dapm_widgets[] = {
  20. SND_SOC_DAPM_OUTPUT("VOUTL"),
  21. SND_SOC_DAPM_OUTPUT("VOUTR"),
  22. };
  23. static const struct snd_soc_dapm_route wm8727_dapm_routes[] = {
  24. { "VOUTL", NULL, "Playback" },
  25. { "VOUTR", NULL, "Playback" },
  26. };
  27. /*
  28. * Note this is a simple chip with no configuration interface, sample rate is
  29. * determined automatically by examining the Master clock and Bit clock ratios
  30. */
  31. #define WM8727_RATES (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 |\
  32. SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000 |\
  33. SNDRV_PCM_RATE_192000)
  34. static struct snd_soc_dai_driver wm8727_dai = {
  35. .name = "wm8727-hifi",
  36. .playback = {
  37. .stream_name = "Playback",
  38. .channels_min = 2,
  39. .channels_max = 2,
  40. .rates = WM8727_RATES,
  41. .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE,
  42. },
  43. };
  44. static const struct snd_soc_component_driver soc_component_dev_wm8727 = {
  45. .dapm_widgets = wm8727_dapm_widgets,
  46. .num_dapm_widgets = ARRAY_SIZE(wm8727_dapm_widgets),
  47. .dapm_routes = wm8727_dapm_routes,
  48. .num_dapm_routes = ARRAY_SIZE(wm8727_dapm_routes),
  49. .idle_bias_on = 1,
  50. .use_pmdown_time = 1,
  51. .endianness = 1,
  52. .non_legacy_dai_naming = 1,
  53. };
  54. static int wm8727_probe(struct platform_device *pdev)
  55. {
  56. return devm_snd_soc_register_component(&pdev->dev,
  57. &soc_component_dev_wm8727, &wm8727_dai, 1);
  58. }
  59. static struct platform_driver wm8727_codec_driver = {
  60. .driver = {
  61. .name = "wm8727",
  62. },
  63. .probe = wm8727_probe,
  64. };
  65. module_platform_driver(wm8727_codec_driver);
  66. MODULE_DESCRIPTION("ASoC wm8727 driver");
  67. MODULE_AUTHOR("Neil Jones");
  68. MODULE_LICENSE("GPL");