• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Rockchip Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "config.h"
18 static const struct RouteCfgInfo default_speaker_normal_controls[] = {
19     {
20         .controlName = "Playback Path",
21         .stringVal = "SPK",
22     },
23 };
24 
25 static const struct RouteCfgInfo default_headphone_normal_controls[] = {
26     {
27         .controlName = "Playback Path",
28         .stringVal = "HP_NO_MIC",
29     },
30 };
31 
32 static const struct RouteCfgInfo default_speaker_headphone_normal_controls[] = {
33     {
34         .controlName = "Playback Path",
35         .stringVal = "SPK_HP",
36     },
37 };
38 
39 static const struct RouteCfgInfo default_main_mic_capture_controls[] = {
40     {
41         .controlName = "Capture MIC Path",
42         .stringVal = "Main Mic",
43     },
44 };
45 
46 static const struct RouteCfgInfo default_hands_free_mic_capture_controls[] = {
47     {
48         .controlName = "Capture MIC Path",
49         .stringVal = "Hands Free Mic",
50     },
51 };
52 
53 static const struct RouteCfgInfo default_playback_off_controls[] = {
54     {
55         .controlName = "Playback Path",
56         .stringVal = "OFF",
57     },
58 };
59 
60 static const struct RouteCfgInfo default_capture_off_controls[] = {
61     {
62         .controlName = "Capture MIC Path",
63         .stringVal = "MIC OFF",
64     },
65 };
66 
67 static struct PathRouteCfgTable default_config_table = {
68     // speaker
69     .speakNormal = {
70         .sndCard = 1,
71         .devices = DEVICES_0,
72         .controls = default_speaker_normal_controls,
73         .ctlsNums = sizeof(default_speaker_normal_controls) / sizeof(struct RouteCfgInfo),
74     },
75 
76     // headphone
77     .headphoneNormal = {
78         .sndCard = 1,
79         .devices = DEVICES_0,
80         .controls = default_headphone_normal_controls,
81         .ctlsNums = sizeof(default_headphone_normal_controls) / sizeof(struct RouteCfgInfo),
82     },
83 
84     .speakerHeadphoneNormal = {
85         .sndCard = 1,
86         .devices = DEVICES_0,
87         .controls = default_speaker_headphone_normal_controls,
88         .ctlsNums = sizeof(default_speaker_headphone_normal_controls) / sizeof(struct RouteCfgInfo),
89     },
90 
91     // capture
92     .mainMicCapture = {
93         .sndCard = 1,
94         .devices = DEVICES_0,
95         .controls = default_main_mic_capture_controls,
96         .ctlsNums = sizeof(default_main_mic_capture_controls) / sizeof(struct RouteCfgInfo),
97     },
98     .handsFreeMicCapture = {
99         .sndCard = 1,
100         .devices = DEVICES_0,
101         .controls = default_hands_free_mic_capture_controls,
102         .ctlsNums = sizeof(default_hands_free_mic_capture_controls) / sizeof(struct RouteCfgInfo),
103     },
104 
105     // off
106     .playbackOff = {
107         .controls = default_playback_off_controls,
108         .ctlsNums = sizeof(default_playback_off_controls) / sizeof(struct RouteCfgInfo),
109     },
110     .captureOff = {
111         .controls = default_capture_off_controls,
112         .ctlsNums = sizeof(default_capture_off_controls) / sizeof(struct RouteCfgInfo),
113     },
114 
115 #ifdef BOX_HAL
116     // hdmi
117     .HdmiNormal = {
118         .sndCard = 0,
119         .devices = DEVICES_0,
120         .ctlsNums = 0,
121     },
122 #else
123     // hdmi
124     .HdmiNormal = {
125         .sndCard = 0,
126         .devices = DEVICES_0,
127         .ctlsNums = 0,
128     },
129 #endif
130 };
131 
132 static const struct RouteCfgInfo hdmi_analog_speaker_normal_controls[] = {
133     {
134         .controlName = "DAC Playback Volume",
135         .intVal = {192, 192},
136     },
137 };
138 
139 static const struct RouteCfgInfo hdmi_analog_headphone_normal_controls[] = {
140     {
141         .controlName = "DAC Playback Volume",
142         .intVal = {192, 192},
143     },
144 };
145 
146 static const struct RouteCfgInfo hdmi_analog_hdmi_normal_controls[] = {
147     {
148         .controlName = "DAC Playback Volume",
149         .intVal = {0, 0},
150     },
151 };
152 
153 static const struct RouteCfgInfo hdmi_analog_speaker_headphone_normal_controls[] = {
154     {
155         .controlName = "DAC Playback Volume",
156         .intVal = {192, 192},
157     },
158 };
159 
160 static const struct RouteCfgInfo hdmi_analog_main_mic_capture_controls[] = {
161     {
162         .controlName = "Differential Mux",
163         .intVal = {0},
164     },
165 };
166 
167 static const struct RouteCfgInfo hdmi_analog_hands_free_mic_capture_controls[] = {
168     {
169         .controlName = "Differential Mux",
170         .intVal = {1},
171     },
172 };
173 
174 static const struct RouteCfgInfo hdmi_analog_playback_off_controls[] = {
175     {
176         .controlName = "Playback Path",
177         .stringVal = "OFF",
178     },
179 };
180 
181 static const struct RouteCfgInfo hdmi_analog_capture_off_controls[] = {
182     {
183         .controlName = "Capture MIC Path",
184         .stringVal = "MIC OFF",
185     },
186 };
187 
188 static struct PathRouteCfgTable hdmi_analog_config_table = {
189     // speaker
190     .speakNormal = {
191         .sndCard = 0,
192         .devices = DEVICES_0,
193         .controls = hdmi_analog_speaker_normal_controls,
194         .ctlsNums = sizeof(hdmi_analog_speaker_normal_controls) / sizeof(struct RouteCfgInfo),
195     },
196 
197     // headphone
198     .headphoneNormal = {
199         .sndCard = 0,
200         .devices = DEVICES_0,
201         .controls = hdmi_analog_headphone_normal_controls,
202         .ctlsNums = sizeof(hdmi_analog_headphone_normal_controls) / sizeof(struct RouteCfgInfo),
203     },
204 
205     .speakerHeadphoneNormal = {
206         .sndCard = 0,
207         .devices = DEVICES_0,
208         .controls = hdmi_analog_speaker_headphone_normal_controls,
209         .ctlsNums = sizeof(hdmi_analog_speaker_headphone_normal_controls) / sizeof(struct RouteCfgInfo),
210     },
211 
212     // capture
213     .mainMicCapture = {
214         .sndCard = 0,
215         .devices = DEVICES_0,
216         .controls = hdmi_analog_main_mic_capture_controls,
217         .ctlsNums = sizeof(hdmi_analog_main_mic_capture_controls) / sizeof(struct RouteCfgInfo),
218     },
219     .handsFreeMicCapture = {
220         .sndCard = 0,
221         .devices = DEVICES_0,
222         .controls = hdmi_analog_hands_free_mic_capture_controls,
223         .ctlsNums = sizeof(hdmi_analog_hands_free_mic_capture_controls) / sizeof(struct RouteCfgInfo),
224     },
225 
226     // off
227     .playbackOff = {
228         .controls = hdmi_analog_playback_off_controls,
229         .ctlsNums = sizeof(hdmi_analog_playback_off_controls) / sizeof(struct RouteCfgInfo),
230     },
231     .captureOff = {
232         .controls = hdmi_analog_capture_off_controls,
233         .ctlsNums = sizeof(hdmi_analog_capture_off_controls) / sizeof(struct RouteCfgInfo),
234     },
235 #ifdef BOX_HAL
236     // hdmi
237     .HdmiNormal = {
238         .sndCard = 0,
239         .devices = DEVICES_0,
240         .ctlsNums = 0,
241     },
242 #else
243     // hdmi
244     .HdmiNormal = {
245         .sndCard = 0,
246         .devices = DEVICES_0,
247         .controls = hdmi_analog_hdmi_normal_controls,
248         .ctlsNums = sizeof(hdmi_analog_hdmi_normal_controls) / sizeof(struct RouteCfgInfo),
249     },
250 #endif
251 };
252 
GetHdmiConfigTable(void)253 struct PathRouteCfgTable* GetHdmiConfigTable(void)
254 {
255     return &hdmi_analog_config_table;
256 }
257 
GetDefaultConfigTable(void)258 struct PathRouteCfgTable* GetDefaultConfigTable(void)
259 {
260     return &default_config_table;
261 }
262