hc
2023-12-09 95099d4622f8cb224d94e314c7a8e0df60b13f87
kernel/include/sound/soc-dapm.h
....@@ -16,6 +16,8 @@
1616 #include <sound/asoc.h>
1717
1818 struct device;
19
+struct snd_soc_pcm_runtime;
20
+struct soc_enum;
1921
2022 /* widget has no PM register bit */
2123 #define SND_SOC_NOPM -1
....@@ -214,21 +216,21 @@
214216 .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD}
215217
216218 /* stream domain */
217
-#define SND_SOC_DAPM_AIF_IN(wname, stname, wslot, wreg, wshift, winvert) \
219
+#define SND_SOC_DAPM_AIF_IN(wname, stname, wchan, wreg, wshift, winvert) \
218220 { .id = snd_soc_dapm_aif_in, .name = wname, .sname = stname, \
219
- SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), }
220
-#define SND_SOC_DAPM_AIF_IN_E(wname, stname, wslot, wreg, wshift, winvert, \
221
+ .channel = wchan, SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), }
222
+#define SND_SOC_DAPM_AIF_IN_E(wname, stname, wchan, wreg, wshift, winvert, \
221223 wevent, wflags) \
222224 { .id = snd_soc_dapm_aif_in, .name = wname, .sname = stname, \
223
- SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
225
+ .channel = wchan, SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
224226 .event = wevent, .event_flags = wflags }
225
-#define SND_SOC_DAPM_AIF_OUT(wname, stname, wslot, wreg, wshift, winvert) \
227
+#define SND_SOC_DAPM_AIF_OUT(wname, stname, wchan, wreg, wshift, winvert) \
226228 { .id = snd_soc_dapm_aif_out, .name = wname, .sname = stname, \
227
- SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), }
228
-#define SND_SOC_DAPM_AIF_OUT_E(wname, stname, wslot, wreg, wshift, winvert, \
229
+ .channel = wchan, SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), }
230
+#define SND_SOC_DAPM_AIF_OUT_E(wname, stname, wchan, wreg, wshift, winvert, \
229231 wevent, wflags) \
230232 { .id = snd_soc_dapm_aif_out, .name = wname, .sname = stname, \
231
- SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
233
+ .channel = wchan, SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
232234 .event = wevent, .event_flags = wflags }
233235 #define SND_SOC_DAPM_DAC(wname, stname, wreg, wshift, winvert) \
234236 { .id = snd_soc_dapm_dac, .name = wname, .sname = stname, \
....@@ -376,6 +378,24 @@
376378 struct snd_soc_dapm_update;
377379 enum snd_soc_dapm_direction;
378380
381
+/*
382
+ * Bias levels
383
+ *
384
+ * @ON: Bias is fully on for audio playback and capture operations.
385
+ * @PREPARE: Prepare for audio operations. Called before DAPM switching for
386
+ * stream start and stop operations.
387
+ * @STANDBY: Low power standby state when no playback/capture operations are
388
+ * in progress. NOTE: The transition time between STANDBY and ON
389
+ * should be as fast as possible and no longer than 10ms.
390
+ * @OFF: Power Off. No restrictions on transition times.
391
+ */
392
+enum snd_soc_bias_level {
393
+ SND_SOC_BIAS_OFF = 0,
394
+ SND_SOC_BIAS_STANDBY = 1,
395
+ SND_SOC_BIAS_PREPARE = 2,
396
+ SND_SOC_BIAS_ON = 3,
397
+};
398
+
379399 int dapm_regulator_event(struct snd_soc_dapm_widget *w,
380400 struct snd_kcontrol *kcontrol, int event);
381401 int dapm_clock_event(struct snd_soc_dapm_widget *w,
....@@ -404,20 +424,24 @@
404424 struct snd_soc_dapm_widget *snd_soc_dapm_new_control(
405425 struct snd_soc_dapm_context *dapm,
406426 const struct snd_soc_dapm_widget *widget);
427
+struct snd_soc_dapm_widget *snd_soc_dapm_new_control_unlocked(
428
+ struct snd_soc_dapm_context *dapm,
429
+ const struct snd_soc_dapm_widget *widget);
407430 int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm,
408431 struct snd_soc_dai *dai);
409432 int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card);
410433 void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card);
411
-int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
412
- struct snd_soc_pcm_runtime *rtd,
413
- const struct snd_soc_pcm_stream *params,
414
- unsigned int num_params,
415
- struct snd_soc_dapm_widget *source,
416
- struct snd_soc_dapm_widget *sink);
434
+
435
+int snd_soc_dapm_update_dai(struct snd_pcm_substream *substream,
436
+ struct snd_pcm_hw_params *params,
437
+ struct snd_soc_dai *dai);
417438
418439 /* dapm path setup */
419440 int snd_soc_dapm_new_widgets(struct snd_soc_card *card);
420441 void snd_soc_dapm_free(struct snd_soc_dapm_context *dapm);
442
+void snd_soc_dapm_init(struct snd_soc_dapm_context *dapm,
443
+ struct snd_soc_card *card,
444
+ struct snd_soc_component *component);
421445 int snd_soc_dapm_add_routes(struct snd_soc_dapm_context *dapm,
422446 const struct snd_soc_dapm_route *route, int num);
423447 int snd_soc_dapm_del_routes(struct snd_soc_dapm_context *dapm,
....@@ -430,6 +454,7 @@
430454 /* dapm events */
431455 void snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream,
432456 int event);
457
+void snd_soc_dapm_stream_stop(struct snd_soc_pcm_runtime *rtd, int stream);
433458 void snd_soc_dapm_shutdown(struct snd_soc_card *card);
434459
435460 /* external DAPM widget events */
....@@ -477,6 +502,7 @@
477502 struct snd_soc_dapm_widget_list **list,
478503 bool (*custom_stop_condition)(struct snd_soc_dapm_widget *,
479504 enum snd_soc_dapm_direction));
505
+void snd_soc_dapm_dai_free_widgets(struct snd_soc_dapm_widget_list **list);
480506
481507 struct snd_soc_dapm_context *snd_soc_dapm_kcontrol_dapm(
482508 struct snd_kcontrol *kcontrol);
....@@ -527,6 +553,9 @@
527553 snd_soc_dapm_asrc, /* DSP/CODEC ASRC component */
528554 snd_soc_dapm_encoder, /* FW/SW audio encoder component */
529555 snd_soc_dapm_decoder, /* FW/SW audio decoder component */
556
+
557
+ /* Don't edit below this line */
558
+ SND_SOC_DAPM_TYPE_COUNT
530559 };
531560
532561 enum snd_soc_dapm_subclass {
....@@ -548,6 +577,8 @@
548577 /* Note: currently only supported for links where source is a supply */
549578 int (*connected)(struct snd_soc_dapm_widget *source,
550579 struct snd_soc_dapm_widget *sink);
580
+
581
+ struct snd_soc_dobj dobj;
551582 };
552583
553584 /* dapm audio path between two widgets */
....@@ -592,9 +623,6 @@
592623 void *priv; /* widget specific data */
593624 struct regulator *regulator; /* attached regulator */
594625 struct pinctrl *pinctrl; /* attached pinctrl */
595
- const struct snd_soc_pcm_stream *params; /* params for dai links */
596
- unsigned int num_params; /* number of params for dai links */
597
- unsigned int params_select; /* currently selected param for dai link */
598626
599627 /* dapm control */
600628 int reg; /* negative reg = no direct dapm */
....@@ -636,6 +664,8 @@
636664 int endpoints[2];
637665
638666 struct clk *clk;
667
+
668
+ int channel;
639669 };
640670
641671 struct snd_soc_dapm_update {
....@@ -659,8 +689,6 @@
659689 unsigned int idle_bias_off:1; /* Use BIAS_OFF instead of STANDBY */
660690 /* Go to BIAS_OFF in suspend if the DAPM context is idle */
661691 unsigned int suspend_bias_off:1;
662
- void (*seq_notifier)(struct snd_soc_dapm_context *,
663
- enum snd_soc_dapm_type, int);
664692
665693 struct device *dev; /* from parent - for debug */
666694 struct snd_soc_component *component; /* parent component */
....@@ -669,10 +697,6 @@
669697 /* used during DAPM updates */
670698 enum snd_soc_bias_level target_bias_level;
671699 struct list_head list;
672
-
673
- int (*stream_event)(struct snd_soc_dapm_context *dapm, int event);
674
- int (*set_bias_level)(struct snd_soc_dapm_context *dapm,
675
- enum snd_soc_bias_level level);
676700
677701 struct snd_soc_dapm_wcache path_sink_cache;
678702 struct snd_soc_dapm_wcache path_source_cache;
....@@ -685,9 +709,14 @@
685709 /* A list of widgets associated with an object, typically a snd_kcontrol */
686710 struct snd_soc_dapm_widget_list {
687711 int num_widgets;
688
- struct snd_soc_dapm_widget *widgets[0];
712
+ struct snd_soc_dapm_widget *widgets[];
689713 };
690714
715
+#define for_each_dapm_widgets(list, i, widget) \
716
+ for ((i) = 0; \
717
+ (i) < list->num_widgets && (widget = list->widgets[i]); \
718
+ (i)++)
719
+
691720 struct snd_soc_dapm_stats {
692721 int power_checks;
693722 int path_checks;