Skip to content

Commit dfe3de7

Browse files
committed
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.
2 parents 2aa28b7 + cb3c715 commit dfe3de7

17 files changed

Lines changed: 75 additions & 53 deletions

File tree

include/sound/soc-component.h

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -261,31 +261,19 @@ struct snd_soc_component {
261261
list_for_each_entry_safe(dai, _dai, &(component)->dai_list, list)
262262

263263
/**
264-
* snd_soc_dapm_to_component() - Casts a DAPM context to the component it is
265-
* embedded in
266-
* @dapm: The DAPM context to cast to the component
267-
*
268-
* This function must only be used on DAPM contexts that are known to be part of
269-
* a component (e.g. in a component driver). Otherwise the behavior is
270-
* undefined.
271-
*/
272-
static inline struct snd_soc_component *snd_soc_dapm_to_component(
273-
struct snd_soc_dapm_context *dapm)
274-
{
275-
return container_of(dapm, struct snd_soc_component, dapm);
276-
}
277-
278-
/**
279-
* snd_soc_component_get_dapm() - Returns the DAPM context associated with a
264+
* snd_soc_component_to_dapm() - Returns the DAPM context associated with a
280265
* component
281266
* @component: The component for which to get the DAPM context
282267
*/
283-
static inline struct snd_soc_dapm_context *snd_soc_component_get_dapm(
268+
static inline struct snd_soc_dapm_context *snd_soc_component_to_dapm(
284269
struct snd_soc_component *component)
285270
{
286271
return &component->dapm;
287272
}
288273

274+
// FIXME
275+
#define snd_soc_component_get_dapm snd_soc_component_to_dapm
276+
289277
/**
290278
* snd_soc_component_cache_sync() - Sync the register cache with the hardware
291279
* @component: COMPONENT to sync

include/sound/soc-dapm.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -583,11 +583,9 @@ struct snd_soc_dapm_update {
583583
struct snd_soc_dapm_context {
584584
enum snd_soc_bias_level bias_level;
585585

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

590-
struct device *dev; /* from parent - for debug */
588+
struct device *dev; /* from parent - for debug */ /* REMOVE ME */
591589
struct snd_soc_component *component; /* parent component */
592590
struct snd_soc_card *card; /* parent card */
593591

@@ -660,6 +658,12 @@ void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card);
660658
int snd_soc_dapm_update_dai(struct snd_pcm_substream *substream,
661659
struct snd_pcm_hw_params *params, struct snd_soc_dai *dai);
662660
int snd_soc_dapm_widget_name_cmp(struct snd_soc_dapm_widget *widget, const char *s);
661+
struct device *snd_soc_dapm_to_dev(struct snd_soc_dapm_context *dapm);
662+
struct snd_soc_card *snd_soc_dapm_to_card(struct snd_soc_dapm_context *dapm);
663+
struct snd_soc_component *snd_soc_dapm_to_component(struct snd_soc_dapm_context *dapm);
664+
665+
bool snd_soc_dapm_get_idle_bias(struct snd_soc_dapm_context *dapm);
666+
void snd_soc_dapm_set_idle_bias(struct snd_soc_dapm_context *dapm, bool on);
663667

664668
/* dapm path setup */
665669
int snd_soc_dapm_new_widgets(struct snd_soc_card *card);

include/sound/soc.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,6 +1120,11 @@ static inline int snd_soc_card_is_instantiated(struct snd_soc_card *card)
11201120
return card && card->instantiated;
11211121
}
11221122

1123+
static inline struct snd_soc_dapm_context *snd_soc_card_to_dapm(struct snd_soc_card *card)
1124+
{
1125+
return &card->dapm;
1126+
}
1127+
11231128
/* SoC machine DAI configuration, glues a codec and cpu DAI together */
11241129
struct snd_soc_pcm_runtime {
11251130
struct device *dev;

sound/soc/codecs/wm8993.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1536,7 +1536,7 @@ static int wm8993_probe(struct snd_soc_component *component)
15361536
* VMID as an output and can disable it.
15371537
*/
15381538
if (wm8993->pdata.lineout1_diff && wm8993->pdata.lineout2_diff)
1539-
dapm->idle_bias_off = 1;
1539+
dapm->idle_bias = false;
15401540

15411541
return 0;
15421542

sound/soc/codecs/wm8994.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4182,16 +4182,16 @@ static int wm8994_component_probe(struct snd_soc_component *component)
41824182

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

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

41884188
/* Set revision-specific configuration */
41894189
switch (control->type) {
41904190
case WM8994:
41914191
/* Single ended line outputs should have VMID on. */
41924192
if (!control->pdata.lineout1_diff ||
41934193
!control->pdata.lineout2_diff)
4194-
dapm->idle_bias_off = 0;
4194+
dapm->idle_bias = true;
41954195

41964196
switch (control->revision) {
41974197
case 2:

sound/soc/intel/avs/boards/es8336.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ static int avs_es8336_codec_init(struct snd_soc_pcm_runtime *runtime)
132132
snd_jack_set_key(data->jack.jack, SND_JACK_BTN_0, KEY_PLAYPAUSE);
133133
snd_soc_component_set_jack(component, &data->jack, NULL);
134134

135-
card->dapm.idle_bias_off = true;
135+
card->dapm.idle_bias = false;
136136

137137
return 0;
138138
}

sound/soc/intel/avs/boards/rt274.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ static int avs_rt274_codec_init(struct snd_soc_pcm_runtime *runtime)
117117
return ret;
118118
}
119119

120-
card->dapm.idle_bias_off = true;
120+
card->dapm.idle_bias = false;
121121

122122
return 0;
123123
}

sound/soc/intel/avs/boards/rt5640.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ static int avs_rt5640_codec_init(struct snd_soc_pcm_runtime *runtime)
6767
return ret;
6868

6969
snd_soc_component_set_jack(codec_dai->component, jack, NULL);
70-
card->dapm.idle_bias_off = true;
70+
card->dapm.idle_bias = false;
7171

7272
return 0;
7373
}

sound/soc/intel/boards/bytcht_cx2072x.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ static int byt_cht_cx2072x_init(struct snd_soc_pcm_runtime *rtd)
7777
byt_cht_cx2072x_acpi_gpios))
7878
dev_warn(rtd->dev, "Unable to add GPIO mapping table\n");
7979

80-
card->dapm.idle_bias_off = true;
80+
card->dapm.idle_bias = false;
8181

8282
/* set the default PLL rate, the clock is handled by the codec driver */
8383
ret = snd_soc_dai_set_sysclk(snd_soc_rtd_to_codec(rtd, 0), CX2072X_MCLK_EXTERNAL_PLL,

sound/soc/intel/boards/bytcht_es8316.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ static int byt_cht_es8316_init(struct snd_soc_pcm_runtime *runtime)
179179
int num_routes;
180180
int ret;
181181

182-
card->dapm.idle_bias_off = true;
182+
card->dapm.idle_bias = false;
183183

184184
switch (BYT_CHT_ES8316_MAP(quirk)) {
185185
case BYT_CHT_ES8316_INTMIC_IN1_MAP:

0 commit comments

Comments
 (0)