1 // SPDX-License-Identifier: (GPL-2.0-only OR B 1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) 2 // 2 // 3 // This file is provided under a dual BSD/GPLv 3 // This file is provided under a dual BSD/GPLv2 license. When using or 4 // redistributing this file, you may do so und 4 // redistributing this file, you may do so under either license. 5 // 5 // 6 // Copyright(c) 2024 Advanced Micro Devices, I 6 // Copyright(c) 2024 Advanced Micro Devices, Inc. 7 // 7 // 8 // Authors: Vijendar Mukunda <Vijendar.Mukunda 8 // Authors: Vijendar Mukunda <Vijendar.Mukunda@amd.com> 9 9 10 /* 10 /* 11 * Hardware interface for Audio DSP on ACP7.0 11 * Hardware interface for Audio DSP on ACP7.0 version based platform 12 */ 12 */ 13 13 14 #include <linux/platform_device.h> 14 #include <linux/platform_device.h> 15 #include <linux/module.h> 15 #include <linux/module.h> 16 16 17 #include "../ops.h" 17 #include "../ops.h" 18 #include "../sof-audio.h" 18 #include "../sof-audio.h" 19 #include "acp.h" 19 #include "acp.h" 20 #include "acp-dsp-offset.h" 20 #include "acp-dsp-offset.h" 21 21 22 #define I2S_HS_INSTANCE 0 22 #define I2S_HS_INSTANCE 0 23 #define I2S_BT_INSTANCE 1 23 #define I2S_BT_INSTANCE 1 24 #define I2S_SP_INSTANCE 2 24 #define I2S_SP_INSTANCE 2 25 #define PDM_DMIC_INSTANCE 3 25 #define PDM_DMIC_INSTANCE 3 26 #define I2S_HS_VIRTUAL_INSTANCE 4 26 #define I2S_HS_VIRTUAL_INSTANCE 4 27 27 28 static struct snd_soc_dai_driver acp70_sof_dai 28 static struct snd_soc_dai_driver acp70_sof_dai[] = { 29 [I2S_HS_INSTANCE] = { 29 [I2S_HS_INSTANCE] = { 30 .id = I2S_HS_INSTANCE, 30 .id = I2S_HS_INSTANCE, 31 .name = "acp-sof-hs", 31 .name = "acp-sof-hs", 32 .playback = { 32 .playback = { 33 .rates = SNDRV_PCM_RAT 33 .rates = SNDRV_PCM_RATE_8000_96000, 34 .formats = SNDRV_PCM_F 34 .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 | 35 SNDRV_PCM_F 35 SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE, 36 .channels_min = 2, 36 .channels_min = 2, 37 .channels_max = 8, 37 .channels_max = 8, 38 .rate_min = 8000, 38 .rate_min = 8000, 39 .rate_max = 96000, 39 .rate_max = 96000, 40 }, 40 }, 41 .capture = { 41 .capture = { 42 .rates = SNDRV_PCM_RAT 42 .rates = SNDRV_PCM_RATE_8000_48000, 43 .formats = SNDRV_PCM_F 43 .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 | 44 SNDRV_PCM_F 44 SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE, 45 /* Supporting only ste 45 /* Supporting only stereo for I2S HS controller capture */ 46 .channels_min = 2, 46 .channels_min = 2, 47 .channels_max = 2, 47 .channels_max = 2, 48 .rate_min = 8000, 48 .rate_min = 8000, 49 .rate_max = 48000, 49 .rate_max = 48000, 50 }, 50 }, 51 }, 51 }, 52 52 53 [I2S_BT_INSTANCE] = { 53 [I2S_BT_INSTANCE] = { 54 .id = I2S_BT_INSTANCE, 54 .id = I2S_BT_INSTANCE, 55 .name = "acp-sof-bt", 55 .name = "acp-sof-bt", 56 .playback = { 56 .playback = { 57 .rates = SNDRV_PCM_RAT 57 .rates = SNDRV_PCM_RATE_8000_96000, 58 .formats = SNDRV_PCM_F 58 .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 | 59 SNDRV_PCM_F 59 SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE, 60 .channels_min = 2, 60 .channels_min = 2, 61 .channels_max = 8, 61 .channels_max = 8, 62 .rate_min = 8000, 62 .rate_min = 8000, 63 .rate_max = 96000, 63 .rate_max = 96000, 64 }, 64 }, 65 .capture = { 65 .capture = { 66 .rates = SNDRV_PCM_RAT 66 .rates = SNDRV_PCM_RATE_8000_48000, 67 .formats = SNDRV_PCM_F 67 .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 | 68 SNDRV_PCM_F 68 SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE, 69 /* Supporting only ste 69 /* Supporting only stereo for I2S BT controller capture */ 70 .channels_min = 2, 70 .channels_min = 2, 71 .channels_max = 2, 71 .channels_max = 2, 72 .rate_min = 8000, 72 .rate_min = 8000, 73 .rate_max = 48000, 73 .rate_max = 48000, 74 }, 74 }, 75 }, 75 }, 76 76 77 [I2S_SP_INSTANCE] = { 77 [I2S_SP_INSTANCE] = { 78 .id = I2S_SP_INSTANCE, 78 .id = I2S_SP_INSTANCE, 79 .name = "acp-sof-sp", 79 .name = "acp-sof-sp", 80 .playback = { 80 .playback = { 81 .rates = SNDRV_PCM_RAT 81 .rates = SNDRV_PCM_RATE_8000_96000, 82 .formats = SNDRV_PCM_F 82 .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 | 83 SNDRV_PCM_F 83 SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE, 84 .channels_min = 2, 84 .channels_min = 2, 85 .channels_max = 8, 85 .channels_max = 8, 86 .rate_min = 8000, 86 .rate_min = 8000, 87 .rate_max = 96000, 87 .rate_max = 96000, 88 }, 88 }, 89 .capture = { 89 .capture = { 90 .rates = SNDRV_PCM_RAT 90 .rates = SNDRV_PCM_RATE_8000_48000, 91 .formats = SNDRV_PCM_F 91 .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 | 92 SNDRV_PCM_F 92 SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE, 93 /* Supporting only ste 93 /* Supporting only stereo for I2S SP controller capture */ 94 .channels_min = 2, 94 .channels_min = 2, 95 .channels_max = 2, 95 .channels_max = 2, 96 .rate_min = 8000, 96 .rate_min = 8000, 97 .rate_max = 48000, 97 .rate_max = 48000, 98 }, 98 }, 99 }, 99 }, 100 100 101 [PDM_DMIC_INSTANCE] = { 101 [PDM_DMIC_INSTANCE] = { 102 .id = PDM_DMIC_INSTANCE, 102 .id = PDM_DMIC_INSTANCE, 103 .name = "acp-sof-dmic", 103 .name = "acp-sof-dmic", 104 .capture = { 104 .capture = { 105 .rates = SNDRV_PCM_RAT 105 .rates = SNDRV_PCM_RATE_8000_48000, 106 .formats = SNDRV_PCM_F 106 .formats = SNDRV_PCM_FMTBIT_S32_LE, 107 .channels_min = 2, 107 .channels_min = 2, 108 .channels_max = 4, 108 .channels_max = 4, 109 .rate_min = 8000, 109 .rate_min = 8000, 110 .rate_max = 48000, 110 .rate_max = 48000, 111 }, 111 }, 112 }, 112 }, 113 113 114 [I2S_HS_VIRTUAL_INSTANCE] = { 114 [I2S_HS_VIRTUAL_INSTANCE] = { 115 .id = I2S_HS_VIRTUAL_INSTANCE, 115 .id = I2S_HS_VIRTUAL_INSTANCE, 116 .name = "acp-sof-hs-virtual", 116 .name = "acp-sof-hs-virtual", 117 .playback = { 117 .playback = { 118 .rates = SNDRV_PCM_RAT 118 .rates = SNDRV_PCM_RATE_8000_96000, 119 .formats = SNDRV_PCM_F 119 .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 | 120 SNDRV_PCM_F 120 SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE, 121 .channels_min = 2, 121 .channels_min = 2, 122 .channels_max = 8, 122 .channels_max = 8, 123 .rate_min = 8000, 123 .rate_min = 8000, 124 .rate_max = 96000, 124 .rate_max = 96000, 125 }, 125 }, 126 }, 126 }, 127 }; 127 }; 128 128 129 /* Phoenix ops */ 129 /* Phoenix ops */ 130 struct snd_sof_dsp_ops sof_acp70_ops; 130 struct snd_sof_dsp_ops sof_acp70_ops; 131 EXPORT_SYMBOL_NS(sof_acp70_ops, SND_SOC_SOF_AM 131 EXPORT_SYMBOL_NS(sof_acp70_ops, SND_SOC_SOF_AMD_COMMON); 132 132 133 int sof_acp70_ops_init(struct snd_sof_dev *sde 133 int sof_acp70_ops_init(struct snd_sof_dev *sdev) 134 { 134 { 135 /* common defaults */ 135 /* common defaults */ 136 memcpy(&sof_acp70_ops, &sof_acp_common 136 memcpy(&sof_acp70_ops, &sof_acp_common_ops, sizeof(struct snd_sof_dsp_ops)); 137 137 138 sof_acp70_ops.drv = acp70_sof_dai; 138 sof_acp70_ops.drv = acp70_sof_dai; 139 sof_acp70_ops.num_drv = ARRAY_SIZE(acp 139 sof_acp70_ops.num_drv = ARRAY_SIZE(acp70_sof_dai); 140 140 141 return 0; 141 return 0; 142 } 142 } 143 143
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.