hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/sound/soc/rockchip/rockchip_multi_dais.c
....@@ -23,6 +23,8 @@
2323 #define DAIS_DRV_NAME "rockchip-mdais"
2424 #define RK3308_GRF_SOC_CON2 0x308
2525
26
+#define SOUND_NAME_PREFIX "sound-name-prefix"
27
+
2628 static inline struct rk_mdais_dev *to_info(struct snd_soc_dai *dai)
2729 {
2830 return snd_soc_dai_get_drvdata(dai);
....@@ -220,13 +222,23 @@
220222 static int rockchip_mdais_dai_probe(struct snd_soc_dai *dai)
221223 {
222224 struct rk_mdais_dev *mdais = to_info(dai);
225
+ struct snd_soc_component *comp;
223226 struct snd_soc_dai *child;
227
+ const char *str;
224228 int ret, i = 0;
225229
226230 for (i = 0; i < mdais->num_dais; i++) {
227231 child = mdais->dais[i].dai;
232
+ comp = child->component;
228233 if (!child->probed && child->driver->probe) {
229
- child->component->card = dai->component->card;
234
+ if (!comp->name_prefix) {
235
+ ret = device_property_read_string(child->dev,
236
+ SOUND_NAME_PREFIX, &str);
237
+ if (!ret)
238
+ comp->name_prefix = str;
239
+ }
240
+
241
+ comp->card = dai->component->card;
230242 ret = child->driver->probe(child);
231243 if (ret < 0) {
232244 dev_err(child->dev,
....@@ -234,6 +246,14 @@
234246 child->name, ret);
235247 return ret;
236248 }
249
+
250
+ ret = snd_soc_add_component_controls(comp,
251
+ comp->driver->controls,
252
+ comp->driver->num_controls);
253
+ if (ret)
254
+ dev_err(dai->dev, "%s: Failed to add controls, should add '%s' in DT\n",
255
+ dev_name(child->dev), SOUND_NAME_PREFIX);
256
+
237257 dai->probed = 1;
238258 }
239259 }
....@@ -383,9 +403,9 @@
383403 .probe = rockchip_mdais_dai_probe,
384404 .playback = {
385405 .stream_name = "Playback",
386
- .channels_min = 2,
387
- .channels_max = 32,
388
- .rates = SNDRV_PCM_RATE_8000_192000,
406
+ .channels_min = 1,
407
+ .channels_max = 512,
408
+ .rates = SNDRV_PCM_RATE_8000_384000,
389409 .formats = (SNDRV_PCM_FMTBIT_S8 |
390410 SNDRV_PCM_FMTBIT_S16_LE |
391411 SNDRV_PCM_FMTBIT_S20_3LE |
....@@ -394,9 +414,9 @@
394414 },
395415 .capture = {
396416 .stream_name = "Capture",
397
- .channels_min = 2,
398
- .channels_max = 32,
399
- .rates = SNDRV_PCM_RATE_8000_192000,
417
+ .channels_min = 1,
418
+ .channels_max = 512,
419
+ .rates = SNDRV_PCM_RATE_8000_384000,
400420 .formats = (SNDRV_PCM_FMTBIT_S8 |
401421 SNDRV_PCM_FMTBIT_S16_LE |
402422 SNDRV_PCM_FMTBIT_S20_3LE |