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) 2022 Advanced Micro Devices, Inc. 7 // 8 // Authors: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com> 9 10 /* 11 * Hardware interface for Audio DSP on Rembrandt 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 27 static struct snd_soc_dai_driver rembrandt_sof_dai[] = { 28 [I2S_HS_INSTANCE] = { 29 .id = I2S_HS_INSTANCE, 30 .name = "acp-sof-hs", 31 .playback = { 32 .rates = SNDRV_PCM_RATE_8000_96000, 33 .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 | 34 SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE, 35 .channels_min = 2, 36 .channels_max = 8, 37 .rate_min = 8000, 38 .rate_max = 96000, 39 }, 40 .capture = { 41 .rates = SNDRV_PCM_RATE_8000_48000, 42 .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 | 43 SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE, 44 /* Supporting only stereo for I2S HS controller capture */ 45 .channels_min = 2, 46 .channels_max = 2, 47 .rate_min = 8000, 48 .rate_max = 48000, 49 }, 50 .probe = &acp_dai_probe, 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 .probe = &acp_dai_probe, 76 }, 77 78 [I2S_SP_INSTANCE] = { 79 .id = I2S_SP_INSTANCE, 80 .name = "acp-sof-sp", 81 .playback = { 82 .rates = SNDRV_PCM_RATE_8000_96000, 83 .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 | 84 SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE, 85 .channels_min = 2, 86 .channels_max = 8, 87 .rate_min = 8000, 88 .rate_max = 96000, 89 }, 90 .capture = { 91 .rates = SNDRV_PCM_RATE_8000_48000, 92 .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 | 93 SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE, 94 /* Supporting only stereo for I2S SP controller capture */ 95 .channels_min = 2, 96 .channels_max = 2, 97 .rate_min = 8000, 98 .rate_max = 48000, 99 }, 100 .probe = &acp_dai_probe, 101 }, 102 103 [PDM_DMIC_INSTANCE] = { 104 .id = PDM_DMIC_INSTANCE, 105 .name = "acp-sof-dmic", 106 .capture = { 107 .rates = SNDRV_PCM_RATE_8000_48000, 108 .formats = SNDRV_PCM_FMTBIT_S32_LE, 109 .channels_min = 2, 110 .channels_max = 4, 111 .rate_min = 8000, 112 .rate_max = 48000, 113 }, 114 }, 115 }; 116 117 /* Rembrandt ops */ 118 struct snd_sof_dsp_ops sof_rembrandt_ops; 119 EXPORT_SYMBOL_NS(sof_rembrandt_ops, SND_SOC_SOF_AMD_COMMON); 120 121 int sof_rembrandt_ops_init(struct snd_sof_dev *sdev) 122 { 123 /* common defaults */ 124 memcpy(&sof_rembrandt_ops, &sof_acp_common_ops, sizeof(struct snd_sof_dsp_ops)); 125 126 sof_rembrandt_ops.drv = rembrandt_sof_dai; 127 sof_rembrandt_ops.num_drv = ARRAY_SIZE(rembrandt_sof_dai); 128 129 return 0; 130 } 131 132 MODULE_IMPORT_NS(SND_SOC_SOF_AMD_COMMON); 133 MODULE_DESCRIPTION("REMBRANDT SOF Driver"); 134 MODULE_LICENSE("Dual BSD/GPL"); 135