Unverified Commit dfe3de7b authored by Mark Brown's avatar Mark Brown
Browse files

ASoC: soc-dapm: prepare for hiding struct

Merge series from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

We would like to hide struct snd_soc_dapm_context from driver. So we need
cleanup code  first. These are preparation for it.
parents 2aa28b74 cb3c715d
Loading
Loading
Loading
Loading
+5 −17
Original line number Diff line number Diff line
@@ -261,31 +261,19 @@ struct snd_soc_component {
	list_for_each_entry_safe(dai, _dai, &(component)->dai_list, list)

/**
 * snd_soc_dapm_to_component() - Casts a DAPM context to the component it is
 *  embedded in
 * @dapm: The DAPM context to cast to the component
 *
 * This function must only be used on DAPM contexts that are known to be part of
 * a component (e.g. in a component driver). Otherwise the behavior is
 * undefined.
 */
static inline struct snd_soc_component *snd_soc_dapm_to_component(
	struct snd_soc_dapm_context *dapm)
{
	return container_of(dapm, struct snd_soc_component, dapm);
}

/**
 * snd_soc_component_get_dapm() - Returns the DAPM context associated with a
 * snd_soc_component_to_dapm() - Returns the DAPM context associated with a
 *  component
 * @component: The component for which to get the DAPM context
 */
static inline struct snd_soc_dapm_context *snd_soc_component_get_dapm(
static inline struct snd_soc_dapm_context *snd_soc_component_to_dapm(
	struct snd_soc_component *component)
{
	return &component->dapm;
}

// FIXME
#define snd_soc_component_get_dapm	snd_soc_component_to_dapm

/**
 * snd_soc_component_cache_sync() - Sync the register cache with the hardware
 * @component: COMPONENT to sync
+8 −4
Original line number Diff line number Diff line
@@ -583,11 +583,9 @@ struct snd_soc_dapm_update {
struct snd_soc_dapm_context {
	enum snd_soc_bias_level bias_level;

	/* bit field */
	unsigned int idle_bias_off:1;		/* Use BIAS_OFF instead of STANDBY */
	unsigned int suspend_bias_off:1;	/* Use BIAS_OFF in suspend if the DAPM is idle */
	bool idle_bias;				/* Use BIAS_OFF instead of STANDBY when false */

	struct device *dev;			/* from parent - for debug */
	struct device *dev;			/* from parent - for debug */ /* REMOVE ME */
	struct snd_soc_component *component;	/* parent component */
	struct snd_soc_card *card;		/* parent card */

@@ -660,6 +658,12 @@ void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card);
int snd_soc_dapm_update_dai(struct snd_pcm_substream *substream,
			    struct snd_pcm_hw_params *params, struct snd_soc_dai *dai);
int snd_soc_dapm_widget_name_cmp(struct snd_soc_dapm_widget *widget, const char *s);
struct device *snd_soc_dapm_to_dev(struct snd_soc_dapm_context *dapm);
struct snd_soc_card *snd_soc_dapm_to_card(struct snd_soc_dapm_context *dapm);
struct snd_soc_component *snd_soc_dapm_to_component(struct snd_soc_dapm_context *dapm);

bool snd_soc_dapm_get_idle_bias(struct snd_soc_dapm_context *dapm);
void snd_soc_dapm_set_idle_bias(struct snd_soc_dapm_context *dapm, bool on);

/* dapm path setup */
int snd_soc_dapm_new_widgets(struct snd_soc_card *card);
+5 −0
Original line number Diff line number Diff line
@@ -1120,6 +1120,11 @@ static inline int snd_soc_card_is_instantiated(struct snd_soc_card *card)
	return card && card->instantiated;
}

static inline struct snd_soc_dapm_context *snd_soc_card_to_dapm(struct snd_soc_card *card)
{
	return &card->dapm;
}

/* SoC machine DAI configuration, glues a codec and cpu DAI together */
struct snd_soc_pcm_runtime {
	struct device *dev;
+1 −1
Original line number Diff line number Diff line
@@ -1536,7 +1536,7 @@ static int wm8993_probe(struct snd_soc_component *component)
	 * VMID as an output and can disable it.
	 */
	if (wm8993->pdata.lineout1_diff && wm8993->pdata.lineout2_diff)
		dapm->idle_bias_off = 1;
		dapm->idle_bias = false;

	return 0;

+3 −3
Original line number Diff line number Diff line
@@ -4182,8 +4182,8 @@ static int wm8994_component_probe(struct snd_soc_component *component)

	wm8994->micdet_irq = control->pdata.micdet_irq;

	/* By default use idle_bias_off, will override for WM8994 */
	dapm->idle_bias_off = 1;
	/* By default use idle_bias false, will override for WM8994 */
	dapm->idle_bias = false;

	/* Set revision-specific configuration */
	switch (control->type) {
@@ -4191,7 +4191,7 @@ static int wm8994_component_probe(struct snd_soc_component *component)
		/* Single ended line outputs should have VMID on. */
		if (!control->pdata.lineout1_diff ||
		    !control->pdata.lineout2_diff)
			dapm->idle_bias_off = 0;
			dapm->idle_bias = true;

		switch (control->revision) {
		case 2:
Loading