ak4554.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. // SPDX-License-Identifier: GPL-2.0
  2. // ak4554.c
  3. //
  4. // Copyright (C) 2013 Renesas Solutions Corp.
  5. // Kuninori Morimoto <[email protected]>
  6. #include <linux/module.h>
  7. #include <sound/soc.h>
  8. /*
  9. * ak4554 is very simple DA/AD converter which has no setting register.
  10. *
  11. * CAUTION
  12. *
  13. * ak4554 playback format is SND_SOC_DAIFMT_RIGHT_J,
  14. * and, capture format is SND_SOC_DAIFMT_LEFT_J
  15. * on same bit clock, LR clock.
  16. * But, this driver doesn't have snd_soc_dai_ops :: set_fmt
  17. *
  18. * CPU/Codec DAI image
  19. *
  20. * CPU-DAI1 (plaback only fmt = RIGHT_J) --+-- ak4554
  21. * |
  22. * CPU-DAI2 (capture only fmt = LEFT_J) ---+
  23. */
  24. static const struct snd_soc_dapm_widget ak4554_dapm_widgets[] = {
  25. SND_SOC_DAPM_INPUT("AINL"),
  26. SND_SOC_DAPM_INPUT("AINR"),
  27. SND_SOC_DAPM_OUTPUT("AOUTL"),
  28. SND_SOC_DAPM_OUTPUT("AOUTR"),
  29. };
  30. static const struct snd_soc_dapm_route ak4554_dapm_routes[] = {
  31. { "Capture", NULL, "AINL" },
  32. { "Capture", NULL, "AINR" },
  33. { "AOUTL", NULL, "Playback" },
  34. { "AOUTR", NULL, "Playback" },
  35. };
  36. static struct snd_soc_dai_driver ak4554_dai = {
  37. .name = "ak4554-hifi",
  38. .playback = {
  39. .stream_name = "Playback",
  40. .channels_min = 2,
  41. .channels_max = 2,
  42. .rates = SNDRV_PCM_RATE_8000_48000,
  43. .formats = SNDRV_PCM_FMTBIT_S16_LE,
  44. },
  45. .capture = {
  46. .stream_name = "Capture",
  47. .channels_min = 2,
  48. .channels_max = 2,
  49. .rates = SNDRV_PCM_RATE_8000_48000,
  50. .formats = SNDRV_PCM_FMTBIT_S16_LE,
  51. },
  52. .symmetric_rate = 1,
  53. };
  54. static const struct snd_soc_component_driver soc_component_dev_ak4554 = {
  55. .dapm_widgets = ak4554_dapm_widgets,
  56. .num_dapm_widgets = ARRAY_SIZE(ak4554_dapm_widgets),
  57. .dapm_routes = ak4554_dapm_routes,
  58. .num_dapm_routes = ARRAY_SIZE(ak4554_dapm_routes),
  59. .idle_bias_on = 1,
  60. .use_pmdown_time = 1,
  61. .endianness = 1,
  62. };
  63. static int ak4554_soc_probe(struct platform_device *pdev)
  64. {
  65. return devm_snd_soc_register_component(&pdev->dev,
  66. &soc_component_dev_ak4554,
  67. &ak4554_dai, 1);
  68. }
  69. static const struct of_device_id ak4554_of_match[] = {
  70. { .compatible = "asahi-kasei,ak4554" },
  71. {},
  72. };
  73. MODULE_DEVICE_TABLE(of, ak4554_of_match);
  74. static struct platform_driver ak4554_driver = {
  75. .driver = {
  76. .name = "ak4554-adc-dac",
  77. .of_match_table = ak4554_of_match,
  78. },
  79. .probe = ak4554_soc_probe,
  80. };
  81. module_platform_driver(ak4554_driver);
  82. MODULE_LICENSE("GPL v2");
  83. MODULE_DESCRIPTION("SoC AK4554 driver");
  84. MODULE_AUTHOR("Kuninori Morimoto <[email protected]>");