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 <AjitKumar.Pandey@amd.com>
9
10 /*
11 * Hardware interface for Audio DSP on Renoir 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_BT_INSTANCE 0
23 #define I2S_SP_INSTANCE 1
24 #define PDM_DMIC_INSTANCE 2
25 #define I2S_SP_VIRTUAL_INSTANCE 3
26
27 static struct snd_soc_dai_driver renoir_sof_dai[] = {
28 [I2S_BT_INSTANCE] = {
29 .id = I2S_BT_INSTANCE,
30 .name = "acp-sof-bt",
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 BT controller capture */
45 .channels_min = 2,
46 .channels_max = 2,
47 .rate_min = 8000,
48 .rate_max = 48000,
49 },
50 },
51
52 [I2S_SP_INSTANCE] = {
53 .id = I2S_SP_INSTANCE,
54 .name = "acp-sof-sp",
55 .playback = {
56 .rates = SNDRV_PCM_RATE_8000_96000,
57 .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 |
58 SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE,
59 .channels_min = 2,
60 .channels_max = 8,
61 .rate_min = 8000,
62 .rate_max = 96000,
63 },
64 .capture = {
65 .rates = SNDRV_PCM_RATE_8000_48000,
66 .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 |
67 SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE,
68 /* Supporting only stereo for I2S SP controller capture */
69 .channels_min = 2,
70 .channels_max = 2,
71 .rate_min = 8000,
72 .rate_max = 48000,
73 },
74 },
75
76 [PDM_DMIC_INSTANCE] = {
77 .id = PDM_DMIC_INSTANCE,
78 .name = "acp-sof-dmic",
79 .capture = {
80 .rates = SNDRV_PCM_RATE_8000_48000,
81 .formats = SNDRV_PCM_FMTBIT_S32_LE,
82 .channels_min = 2,
83 .channels_max = 4,
84 .rate_min = 8000,
85 .rate_max = 48000,
86 },
87 },
88
89 [I2S_SP_VIRTUAL_INSTANCE] = {
90 .id = I2S_SP_VIRTUAL_INSTANCE,
91 .name = "acp-sof-sp-virtual",
92 .playback = {
93 .rates = SNDRV_PCM_RATE_8000_96000,
94 .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 |
95 SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE,
96 .channels_min = 2,
97 .channels_max = 8,
98 .rate_min = 8000,
99 .rate_max = 96000,
100 },
101 },
102 };
103
104 /* Renoir ops */
105 struct snd_sof_dsp_ops sof_renoir_ops;
106 EXPORT_SYMBOL_NS(sof_renoir_ops, SND_SOC_SOF_AMD_COMMON);
107
sof_renoir_ops_init(struct snd_sof_dev * sdev)108 int sof_renoir_ops_init(struct snd_sof_dev *sdev)
109 {
110 /* common defaults */
111 memcpy(&sof_renoir_ops, &sof_acp_common_ops, sizeof(struct snd_sof_dsp_ops));
112
113 sof_renoir_ops.drv = renoir_sof_dai;
114 sof_renoir_ops.num_drv = ARRAY_SIZE(renoir_sof_dai);
115
116 return 0;
117 }
118