ak4554.c 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. // SPDX-License-Identifier: GPL-2.0
  2. // ak4554.c
  3. //
  4. // Copyright (C) 2013 Renesas Solutions Corp.
  5. // Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
  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_rates = 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. .non_legacy_dai_naming = 1,
  63. };
  64. static int ak4554_soc_probe(struct platform_device *pdev)
  65. {
  66. return devm_snd_soc_register_component(&pdev->dev,
  67. &soc_component_dev_ak4554,
  68. &ak4554_dai, 1);
  69. }
  70. static const struct of_device_id ak4554_of_match[] = {
  71. { .compatible = "asahi-kasei,ak4554" },
  72. {},
  73. };
  74. MODULE_DEVICE_TABLE(of, ak4554_of_match);
  75. static struct platform_driver ak4554_driver = {
  76. .driver = {
  77. .name = "ak4554-adc-dac",
  78. .of_match_table = ak4554_of_match,
  79. },
  80. .probe = ak4554_soc_probe,
  81. };
  82. module_platform_driver(ak4554_driver);
  83. MODULE_LICENSE("GPL v2");
  84. MODULE_DESCRIPTION("SoC AK4554 driver");
  85. MODULE_AUTHOR("Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>");