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) 2023 Advanced Micro Devices, Inc. 7 // 8 // Authors: Vijendar Mukunda <Vijendar.Mukunda@amd.com> 9 10 /* 11 * Hardware interface for Audio DSP on ACP6.3 version based platform 12 */ 13 14 #include <linux/platform_device.h> 15 #include <linux/module.h> 16 17 #include "../ops.h" 18 #include "../sof-audio.h" 19 #include "acp.h" 20 #include "acp-dsp-offset.h" 21 22 #define I2S_HS_INSTANCE 0 23 #define I2S_BT_INSTANCE 1 24 #define I2S_SP_INSTANCE 2 25 #define PDM_DMIC_INSTANCE 3 26 #define I2S_HS_VIRTUAL_INSTANCE 4 27 28 static struct snd_soc_dai_driver acp63_sof_dai[] = { 29 [I2S_HS_INSTANCE] = { 30 .id = I2S_HS_INSTANCE, 31 .name = "acp-sof-hs", 32 .playback = { 33 .rates = SNDRV_PCM_RATE_8000_96000, 34 .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 | 35 SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE, 36 .channels_min = 2, 37 .channels_max = 8, 38 .rate_min = 8000, 39 .rate_max = 96000, 40 }, 41 .capture = { 42 .rates = SNDRV_PCM_RATE_8000_48000, 43 .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 | 44 SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE, 45 /* Supporting only stereo for I2S HS controller capture */ 46 .channels_min = 2, 47 .channels_max = 2, 48 .rate_min = 8000, 49 .rate_max = 48000, 50 }, 51 }, 52 53 [I2S_BT_INSTANCE] = { 54 .id = I2S_BT_INSTANCE, 55 .name = "acp-sof-bt", 56 .playback = { 57 .rates = SNDRV_PCM_RATE_8000_96000, 58 .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 | 59 SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE, 60 .channels_min = 2, 61 .channels_max = 8, 62 .rate_min = 8000, 63 .rate_max = 96000, 64 }, 65 .capture = { 66 .rates = SNDRV_PCM_RATE_8000_48000, 67 .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 | 68 SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE, 69 /* Supporting only stereo for I2S BT controller capture */ 70 .channels_min = 2, 71 .channels_max = 2, 72 .rate_min = 8000, 73 .rate_max = 48000, 74 }, 75 }, 76 77 [I2S_SP_INSTANCE] = { 78 .id = I2S_SP_INSTANCE, 79 .name = "acp-sof-sp", 80 .playback = { 81 .rates = SNDRV_PCM_RATE_8000_96000, 82 .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 | 83 SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE, 84 .channels_min = 2, 85 .channels_max = 8, 86 .rate_min = 8000, 87 .rate_max = 96000, 88 }, 89 .capture = { 90 .rates = SNDRV_PCM_RATE_8000_48000, 91 .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 | 92 SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE, 93 /* Supporting only stereo for I2S SP controller capture */ 94 .channels_min = 2, 95 .channels_max = 2, 96 .rate_min = 8000, 97 .rate_max = 48000, 98 }, 99 }, 100 101 [PDM_DMIC_INSTANCE] = { 102 .id = PDM_DMIC_INSTANCE, 103 .name = "acp-sof-dmic", 104 .capture = { 105 .rates = SNDRV_PCM_RATE_8000_48000, 106 .formats = SNDRV_PCM_FMTBIT_S32_LE, 107 .channels_min = 2, 108 .channels_max = 4, 109 .rate_min = 8000, 110 .rate_max = 48000, 111 }, 112 }, 113 114 [I2S_HS_VIRTUAL_INSTANCE] = { 115 .id = I2S_HS_VIRTUAL_INSTANCE, 116 .name = "acp-sof-hs-virtual", 117 .playback = { 118 .rates = SNDRV_PCM_RATE_8000_96000, 119 .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 | 120 SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE, 121 .channels_min = 2, 122 .channels_max = 8, 123 .rate_min = 8000, 124 .rate_max = 96000, 125 }, 126 }, 127 }; 128 129 /* Phoenix ops */ 130 struct snd_sof_dsp_ops sof_acp63_ops; 131 EXPORT_SYMBOL_NS(sof_acp63_ops, SND_SOC_SOF_AMD_COMMON); 132 133 int sof_acp63_ops_init(struct snd_sof_dev *sdev) 134 { 135 /* common defaults */ 136 memcpy(&sof_acp63_ops, &sof_acp_common_ops, sizeof(struct snd_sof_dsp_ops)); 137 138 sof_acp63_ops.drv = acp63_sof_dai; 139 sof_acp63_ops.num_drv = ARRAY_SIZE(acp63_sof_dai); 140 141 return 0; 142 } 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.