hc
2024-05-10 748e4f3d702def1a4bff191e0cf93b6a05340f01
kernel/include/sound/soc-dapm.h
....@@ -16,6 +16,9 @@
1616 #include <sound/asoc.h>
1717
1818 struct device;
19
+struct snd_pcm_substream;
20
+struct snd_soc_pcm_runtime;
21
+struct soc_enum;
1922
2023 /* widget has no PM register bit */
2124 #define SND_SOC_NOPM -1
....@@ -214,21 +217,21 @@
214217 .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD}
215218
216219 /* stream domain */
217
-#define SND_SOC_DAPM_AIF_IN(wname, stname, wslot, wreg, wshift, winvert) \
220
+#define SND_SOC_DAPM_AIF_IN(wname, stname, wchan, wreg, wshift, winvert) \
218221 { .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, \
222
+ .channel = wchan, SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), }
223
+#define SND_SOC_DAPM_AIF_IN_E(wname, stname, wchan, wreg, wshift, winvert, \
221224 wevent, wflags) \
222225 { .id = snd_soc_dapm_aif_in, .name = wname, .sname = stname, \
223
- SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
226
+ .channel = wchan, SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
224227 .event = wevent, .event_flags = wflags }
225
-#define SND_SOC_DAPM_AIF_OUT(wname, stname, wslot, wreg, wshift, winvert) \
228
+#define SND_SOC_DAPM_AIF_OUT(wname, stname, wchan, wreg, wshift, winvert) \
226229 { .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, \
230
+ .channel = wchan, SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), }
231
+#define SND_SOC_DAPM_AIF_OUT_E(wname, stname, wchan, wreg, wshift, winvert, \
229232 wevent, wflags) \
230233 { .id = snd_soc_dapm_aif_out, .name = wname, .sname = stname, \
231
- SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
234
+ .channel = wchan, SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
232235 .event = wevent, .event_flags = wflags }
233236 #define SND_SOC_DAPM_DAC(wname, stname, wreg, wshift, winvert) \
234237 { .id = snd_soc_dapm_dac, .name = wname, .sname = stname, \
....@@ -376,6 +379,24 @@
376379 struct snd_soc_dapm_update;
377380 enum snd_soc_dapm_direction;
378381
382
+/*
383
+ * Bias levels
384
+ *
385
+ * @ON: Bias is fully on for audio playback and capture operations.
386
+ * @PREPARE: Prepare for audio operations. Called before DAPM switching for
387
+ * stream start and stop operations.
388
+ * @STANDBY: Low power standby state when no playback/capture operations are
389
+ * in progress. NOTE: The transition time between STANDBY and ON
390
+ * should be as fast as possible and no longer than 10ms.
391
+ * @OFF: Power Off. No restrictions on transition times.
392
+ */
393
+enum snd_soc_bias_level {
394
+ SND_SOC_BIAS_OFF = 0,
395
+ SND_SOC_BIAS_STANDBY = 1,
396
+ SND_SOC_BIAS_PREPARE = 2,
397
+ SND_SOC_BIAS_ON = 3,
398
+};
399
+
379400 int dapm_regulator_event(struct snd_soc_dapm_widget *w,
380401 struct snd_kcontrol *kcontrol, int event);
381402 int dapm_clock_event(struct snd_soc_dapm_widget *w,
....@@ -404,20 +425,24 @@
404425 struct snd_soc_dapm_widget *snd_soc_dapm_new_control(
405426 struct snd_soc_dapm_context *dapm,
406427 const struct snd_soc_dapm_widget *widget);
428
+struct snd_soc_dapm_widget *snd_soc_dapm_new_control_unlocked(
429
+ struct snd_soc_dapm_context *dapm,
430
+ const struct snd_soc_dapm_widget *widget);
407431 int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm,
408432 struct snd_soc_dai *dai);
409433 int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card);
410434 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);
435
+
436
+int snd_soc_dapm_update_dai(struct snd_pcm_substream *substream,
437
+ struct snd_pcm_hw_params *params,
438
+ struct snd_soc_dai *dai);
417439
418440 /* dapm path setup */
419441 int snd_soc_dapm_new_widgets(struct snd_soc_card *card);
420442 void snd_soc_dapm_free(struct snd_soc_dapm_context *dapm);
443
+void snd_soc_dapm_init(struct snd_soc_dapm_context *dapm,
444
+ struct snd_soc_card *card,
445
+ struct snd_soc_component *component);
421446 int snd_soc_dapm_add_routes(struct snd_soc_dapm_context *dapm,
422447 const struct snd_soc_dapm_route *route, int num);
423448 int snd_soc_dapm_del_routes(struct snd_soc_dapm_context *dapm,
....@@ -430,6 +455,7 @@
430455 /* dapm events */
431456 void snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream,
432457 int event);
458
+void snd_soc_dapm_stream_stop(struct snd_soc_pcm_runtime *rtd, int stream);
433459 void snd_soc_dapm_shutdown(struct snd_soc_card *card);
434460
435461 /* external DAPM widget events */
....@@ -477,6 +503,7 @@
477503 struct snd_soc_dapm_widget_list **list,
478504 bool (*custom_stop_condition)(struct snd_soc_dapm_widget *,
479505 enum snd_soc_dapm_direction));
506
+void snd_soc_dapm_dai_free_widgets(struct snd_soc_dapm_widget_list **list);
480507
481508 struct snd_soc_dapm_context *snd_soc_dapm_kcontrol_dapm(
482509 struct snd_kcontrol *kcontrol);
....@@ -527,6 +554,9 @@
527554 snd_soc_dapm_asrc, /* DSP/CODEC ASRC component */
528555 snd_soc_dapm_encoder, /* FW/SW audio encoder component */
529556 snd_soc_dapm_decoder, /* FW/SW audio decoder component */
557
+
558
+ /* Don't edit below this line */
559
+ SND_SOC_DAPM_TYPE_COUNT
530560 };
531561
532562 enum snd_soc_dapm_subclass {
....@@ -548,6 +578,8 @@
548578 /* Note: currently only supported for links where source is a supply */
549579 int (*connected)(struct snd_soc_dapm_widget *source,
550580 struct snd_soc_dapm_widget *sink);
581
+
582
+ struct snd_soc_dobj dobj;
551583 };
552584
553585 /* dapm audio path between two widgets */
....@@ -592,9 +624,6 @@
592624 void *priv; /* widget specific data */
593625 struct regulator *regulator; /* attached regulator */
594626 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 */
598627
599628 /* dapm control */
600629 int reg; /* negative reg = no direct dapm */
....@@ -636,6 +665,8 @@
636665 int endpoints[2];
637666
638667 struct clk *clk;
668
+
669
+ int channel;
639670 };
640671
641672 struct snd_soc_dapm_update {
....@@ -659,8 +690,6 @@
659690 unsigned int idle_bias_off:1; /* Use BIAS_OFF instead of STANDBY */
660691 /* Go to BIAS_OFF in suspend if the DAPM context is idle */
661692 unsigned int suspend_bias_off:1;
662
- void (*seq_notifier)(struct snd_soc_dapm_context *,
663
- enum snd_soc_dapm_type, int);
664693
665694 struct device *dev; /* from parent - for debug */
666695 struct snd_soc_component *component; /* parent component */
....@@ -669,10 +698,6 @@
669698 /* used during DAPM updates */
670699 enum snd_soc_bias_level target_bias_level;
671700 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);
676701
677702 struct snd_soc_dapm_wcache path_sink_cache;
678703 struct snd_soc_dapm_wcache path_source_cache;
....@@ -685,9 +710,14 @@
685710 /* A list of widgets associated with an object, typically a snd_kcontrol */
686711 struct snd_soc_dapm_widget_list {
687712 int num_widgets;
688
- struct snd_soc_dapm_widget *widgets[0];
713
+ struct snd_soc_dapm_widget *widgets[];
689714 };
690715
716
+#define for_each_dapm_widgets(list, i, widget) \
717
+ for ((i) = 0; \
718
+ (i) < list->num_widgets && (widget = list->widgets[i]); \
719
+ (i)++)
720
+
691721 struct snd_soc_dapm_stats {
692722 int power_checks;
693723 int path_checks;