renoir.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. // SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
  2. //
  3. // This file is provided under a dual BSD/GPLv2 license. When using or
  4. // redistributing this file, you may do so under either license.
  5. //
  6. // Copyright(c) 2021 Advanced Micro Devices, Inc.
  7. //
  8. // Authors: Ajit Kumar Pandey <[email protected]>
  9. /*
  10. * Hardware interface for Audio DSP on Renoir platform
  11. */
  12. #include <linux/platform_device.h>
  13. #include <linux/module.h>
  14. #include "../ops.h"
  15. #include "../sof-audio.h"
  16. #include "acp.h"
  17. #include "acp-dsp-offset.h"
  18. #define I2S_BT_INSTANCE 0
  19. #define I2S_SP_INSTANCE 1
  20. #define PDM_DMIC_INSTANCE 2
  21. static struct snd_soc_dai_driver renoir_sof_dai[] = {
  22. [I2S_BT_INSTANCE] = {
  23. .id = I2S_BT_INSTANCE,
  24. .name = "acp-sof-bt",
  25. .playback = {
  26. .rates = SNDRV_PCM_RATE_8000_96000,
  27. .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 |
  28. SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE,
  29. .channels_min = 2,
  30. .channels_max = 8,
  31. .rate_min = 8000,
  32. .rate_max = 96000,
  33. },
  34. .capture = {
  35. .rates = SNDRV_PCM_RATE_8000_48000,
  36. .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 |
  37. SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE,
  38. /* Supporting only stereo for I2S BT controller capture */
  39. .channels_min = 2,
  40. .channels_max = 2,
  41. .rate_min = 8000,
  42. .rate_max = 48000,
  43. },
  44. .probe = &acp_dai_probe,
  45. },
  46. [I2S_SP_INSTANCE] = {
  47. .id = I2S_SP_INSTANCE,
  48. .name = "acp-sof-sp",
  49. .playback = {
  50. .rates = SNDRV_PCM_RATE_8000_96000,
  51. .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 |
  52. SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE,
  53. .channels_min = 2,
  54. .channels_max = 8,
  55. .rate_min = 8000,
  56. .rate_max = 96000,
  57. },
  58. .capture = {
  59. .rates = SNDRV_PCM_RATE_8000_48000,
  60. .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 |
  61. SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE,
  62. /* Supporting only stereo for I2S SP controller capture */
  63. .channels_min = 2,
  64. .channels_max = 2,
  65. .rate_min = 8000,
  66. .rate_max = 48000,
  67. },
  68. .probe = &acp_dai_probe,
  69. },
  70. [PDM_DMIC_INSTANCE] = {
  71. .id = PDM_DMIC_INSTANCE,
  72. .name = "acp-sof-dmic",
  73. .capture = {
  74. .rates = SNDRV_PCM_RATE_8000_48000,
  75. .formats = SNDRV_PCM_FMTBIT_S32_LE,
  76. .channels_min = 2,
  77. .channels_max = 4,
  78. .rate_min = 8000,
  79. .rate_max = 48000,
  80. },
  81. },
  82. };
  83. /* Renoir ops */
  84. struct snd_sof_dsp_ops sof_renoir_ops;
  85. EXPORT_SYMBOL_NS(sof_renoir_ops, SND_SOC_SOF_AMD_COMMON);
  86. int sof_renoir_ops_init(struct snd_sof_dev *sdev)
  87. {
  88. /* common defaults */
  89. memcpy(&sof_renoir_ops, &sof_acp_common_ops, sizeof(struct snd_sof_dsp_ops));
  90. sof_renoir_ops.drv = renoir_sof_dai;
  91. sof_renoir_ops.num_drv = ARRAY_SIZE(renoir_sof_dai);
  92. return 0;
  93. }
  94. MODULE_IMPORT_NS(SND_SOC_SOF_AMD_COMMON);
  95. MODULE_DESCRIPTION("RENOIR SOF Driver");
  96. MODULE_LICENSE("Dual BSD/GPL");