Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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.

+75 -53
+5 -17
include/sound/soc-component.h
··· 261 261 list_for_each_entry_safe(dai, _dai, &(component)->dai_list, list) 262 262 263 263 /** 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 280 265 * component 281 266 * @component: The component for which to get the DAPM context 282 267 */ 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( 284 269 struct snd_soc_component *component) 285 270 { 286 271 return &component->dapm; 287 272 } 273 + 274 + // FIXME 275 + #define snd_soc_component_get_dapm snd_soc_component_to_dapm 288 276 289 277 /** 290 278 * snd_soc_component_cache_sync() - Sync the register cache with the hardware
+8 -4
include/sound/soc-dapm.h
··· 583 583 struct snd_soc_dapm_context { 584 584 enum snd_soc_bias_level bias_level; 585 585 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 */ 589 587 590 - struct device *dev; /* from parent - for debug */ 588 + struct device *dev; /* from parent - for debug */ /* REMOVE ME */ 591 589 struct snd_soc_component *component; /* parent component */ 592 590 struct snd_soc_card *card; /* parent card */ 593 591 ··· 658 660 int snd_soc_dapm_update_dai(struct snd_pcm_substream *substream, 659 661 struct snd_pcm_hw_params *params, struct snd_soc_dai *dai); 660 662 int snd_soc_dapm_widget_name_cmp(struct snd_soc_dapm_widget *widget, const char *s); 663 + struct device *snd_soc_dapm_to_dev(struct snd_soc_dapm_context *dapm); 664 + struct snd_soc_card *snd_soc_dapm_to_card(struct snd_soc_dapm_context *dapm); 665 + struct snd_soc_component *snd_soc_dapm_to_component(struct snd_soc_dapm_context *dapm); 666 + 667 + bool snd_soc_dapm_get_idle_bias(struct snd_soc_dapm_context *dapm); 668 + void snd_soc_dapm_set_idle_bias(struct snd_soc_dapm_context *dapm, bool on); 661 669 662 670 /* dapm path setup */ 663 671 int snd_soc_dapm_new_widgets(struct snd_soc_card *card);
+5
include/sound/soc.h
··· 1120 1120 return card && card->instantiated; 1121 1121 } 1122 1122 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 + 1123 1128 /* SoC machine DAI configuration, glues a codec and cpu DAI together */ 1124 1129 struct snd_soc_pcm_runtime { 1125 1130 struct device *dev;
+1 -1
sound/soc/codecs/wm8993.c
··· 1536 1536 * VMID as an output and can disable it. 1537 1537 */ 1538 1538 if (wm8993->pdata.lineout1_diff && wm8993->pdata.lineout2_diff) 1539 - dapm->idle_bias_off = 1; 1539 + dapm->idle_bias = false; 1540 1540 1541 1541 return 0; 1542 1542
+3 -3
sound/soc/codecs/wm8994.c
··· 4182 4182 4183 4183 wm8994->micdet_irq = control->pdata.micdet_irq; 4184 4184 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; 4187 4187 4188 4188 /* Set revision-specific configuration */ 4189 4189 switch (control->type) { ··· 4191 4191 /* Single ended line outputs should have VMID on. */ 4192 4192 if (!control->pdata.lineout1_diff || 4193 4193 !control->pdata.lineout2_diff) 4194 - dapm->idle_bias_off = 0; 4194 + dapm->idle_bias = true; 4195 4195 4196 4196 switch (control->revision) { 4197 4197 case 2:
+1 -1
sound/soc/intel/avs/boards/es8336.c
··· 132 132 snd_jack_set_key(data->jack.jack, SND_JACK_BTN_0, KEY_PLAYPAUSE); 133 133 snd_soc_component_set_jack(component, &data->jack, NULL); 134 134 135 - card->dapm.idle_bias_off = true; 135 + card->dapm.idle_bias = false; 136 136 137 137 return 0; 138 138 }
+1 -1
sound/soc/intel/avs/boards/rt274.c
··· 117 117 return ret; 118 118 } 119 119 120 - card->dapm.idle_bias_off = true; 120 + card->dapm.idle_bias = false; 121 121 122 122 return 0; 123 123 }
+1 -1
sound/soc/intel/avs/boards/rt5640.c
··· 67 67 return ret; 68 68 69 69 snd_soc_component_set_jack(codec_dai->component, jack, NULL); 70 - card->dapm.idle_bias_off = true; 70 + card->dapm.idle_bias = false; 71 71 72 72 return 0; 73 73 }
+1 -1
sound/soc/intel/boards/bytcht_cx2072x.c
··· 77 77 byt_cht_cx2072x_acpi_gpios)) 78 78 dev_warn(rtd->dev, "Unable to add GPIO mapping table\n"); 79 79 80 - card->dapm.idle_bias_off = true; 80 + card->dapm.idle_bias = false; 81 81 82 82 /* set the default PLL rate, the clock is handled by the codec driver */ 83 83 ret = snd_soc_dai_set_sysclk(snd_soc_rtd_to_codec(rtd, 0), CX2072X_MCLK_EXTERNAL_PLL,
+1 -1
sound/soc/intel/boards/bytcht_es8316.c
··· 179 179 int num_routes; 180 180 int ret; 181 181 182 - card->dapm.idle_bias_off = true; 182 + card->dapm.idle_bias = false; 183 183 184 184 switch (BYT_CHT_ES8316_MAP(quirk)) { 185 185 case BYT_CHT_ES8316_INTMIC_IN1_MAP:
+1 -1
sound/soc/intel/boards/bytcr_rt5640.c
··· 1324 1324 int num_routes = 0; 1325 1325 int ret; 1326 1326 1327 - card->dapm.idle_bias_off = true; 1327 + card->dapm.idle_bias = false; 1328 1328 jack_data->use_platform_clock = true; 1329 1329 1330 1330 /* Start with RC clk for jack-detect (we disable MCLK below) */
+1 -1
sound/soc/intel/boards/bytcr_rt5651.c
··· 586 586 int report; 587 587 int ret; 588 588 589 - card->dapm.idle_bias_off = true; 589 + card->dapm.idle_bias = false; 590 590 591 591 /* Start with RC clk for jack-detect (we disable MCLK below) */ 592 592 if (byt_rt5651_quirk & BYT_RT5651_MCLK_EN)
+1 -1
sound/soc/intel/boards/bytcr_wm5102.c
··· 288 288 const struct snd_soc_dapm_route *custom_map = NULL; 289 289 int ret, jack_type, num_routes = 0; 290 290 291 - card->dapm.idle_bias_off = true; 291 + card->dapm.idle_bias = false; 292 292 293 293 ret = snd_soc_add_card_controls(card, byt_wm5102_controls, 294 294 ARRAY_SIZE(byt_wm5102_controls));
+1 -1
sound/soc/intel/boards/sof_es8336.c
··· 276 276 int num_routes; 277 277 int ret; 278 278 279 - card->dapm.idle_bias_off = true; 279 + card->dapm.idle_bias = false; 280 280 281 281 if (quirk & SOC_ES8336_HEADSET_MIC1) { 282 282 custom_map = sof_es8316_headset_mic1_map;
+2 -2
sound/soc/soc-core.c
··· 717 717 * means it's doing something, 718 718 * otherwise fall through. 719 719 */ 720 - if (dapm->idle_bias_off) { 720 + if (!dapm->idle_bias) { 721 721 dev_dbg(component->dev, 722 722 "ASoC: idle_bias_off CODEC on over suspend\n"); 723 723 break; ··· 1652 1652 if (ret < 0) 1653 1653 goto err_probe; 1654 1654 1655 - WARN(dapm->idle_bias_off && 1655 + WARN(!dapm->idle_bias && 1656 1656 dapm->bias_level != SND_SOC_BIAS_OFF, 1657 1657 "codec %s can not start from non-off bias with idle_bias_off==1\n", 1658 1658 component->name);
+41 -16
sound/soc/soc-dapm.c
··· 165 165 kfree(buf); 166 166 } 167 167 168 + struct device *snd_soc_dapm_to_dev(struct snd_soc_dapm_context *dapm) 169 + { 170 + if (dapm->component) 171 + return dapm->component->dev; 172 + 173 + return dapm->card->dev; 174 + } 175 + EXPORT_SYMBOL_GPL(snd_soc_dapm_to_dev); 176 + 177 + struct snd_soc_card *snd_soc_dapm_to_card(struct snd_soc_dapm_context *dapm) 178 + { 179 + return dapm->card; 180 + } 181 + EXPORT_SYMBOL_GPL(snd_soc_dapm_to_card); 182 + 183 + struct snd_soc_component *snd_soc_dapm_to_component(struct snd_soc_dapm_context *dapm) 184 + { 185 + return dapm->component; 186 + } 187 + EXPORT_SYMBOL_GPL(snd_soc_dapm_to_component); 188 + 168 189 static bool dapm_dirty_widget(struct snd_soc_dapm_widget *w) 169 190 { 170 191 return !list_empty(&w->dirty); ··· 2180 2159 dapm_seq_insert(w, down_list, false); 2181 2160 } 2182 2161 2183 - static bool dapm_idle_bias_off(struct snd_soc_dapm_context *dapm) 2162 + bool snd_soc_dapm_get_idle_bias(struct snd_soc_dapm_context *dapm) 2184 2163 { 2185 - if (dapm->idle_bias_off) 2186 - return true; 2164 + if (dapm->idle_bias) { 2165 + struct snd_soc_component *component = snd_soc_dapm_to_component(dapm); 2166 + unsigned int state = snd_power_get_state(dapm->card->snd_card); 2187 2167 2188 - switch (snd_power_get_state(dapm->card->snd_card)) { 2189 - case SNDRV_CTL_POWER_D3hot: 2190 - case SNDRV_CTL_POWER_D3cold: 2191 - return dapm->suspend_bias_off; 2192 - default: 2193 - break; 2168 + if ((state == SNDRV_CTL_POWER_D3hot || (state == SNDRV_CTL_POWER_D3cold)) && 2169 + component) 2170 + return !component->driver->suspend_bias_off; 2194 2171 } 2195 2172 2196 - return false; 2173 + return dapm->idle_bias; 2197 2174 } 2175 + EXPORT_SYMBOL_GPL(snd_soc_dapm_get_idle_bias); 2176 + 2177 + void snd_soc_dapm_set_idle_bias(struct snd_soc_dapm_context *dapm, bool on) 2178 + { 2179 + dapm->idle_bias = on; 2180 + } 2181 + EXPORT_SYMBOL_GPL(snd_soc_dapm_set_idle_bias); 2198 2182 2199 2183 /* 2200 2184 * Scan each dapm widget for complete audio path. ··· 2226 2200 trace_snd_soc_dapm_start(card, event); 2227 2201 2228 2202 for_each_card_dapms(card, d) { 2229 - if (dapm_idle_bias_off(d)) 2230 - d->target_bias_level = SND_SOC_BIAS_OFF; 2231 - else 2203 + if (snd_soc_dapm_get_idle_bias(d)) 2232 2204 d->target_bias_level = SND_SOC_BIAS_STANDBY; 2205 + else 2206 + d->target_bias_level = SND_SOC_BIAS_OFF; 2233 2207 } 2234 2208 2235 2209 dapm_reset(card); ··· 2293 2267 if (d->target_bias_level > bias) 2294 2268 bias = d->target_bias_level; 2295 2269 for_each_card_dapms(card, d) 2296 - if (!dapm_idle_bias_off(d)) 2270 + if (snd_soc_dapm_get_idle_bias(d)) 2297 2271 d->target_bias_level = bias; 2298 2272 2299 2273 trace_snd_soc_dapm_walk_done(card); ··· 4827 4801 4828 4802 if (component) { 4829 4803 dapm->dev = component->dev; 4830 - dapm->idle_bias_off = !component->driver->idle_bias_on; 4831 - dapm->suspend_bias_off = component->driver->suspend_bias_off; 4804 + dapm->idle_bias = component->driver->idle_bias_on; 4832 4805 } else { 4833 4806 dapm->dev = card->dev; 4834 4807 }
+1 -1
sound/soc/sof/sof-client-probes.c
··· 525 525 card->dai_link = links; 526 526 527 527 /* set idle_bias_off to prevent the core from resuming the card->dev */ 528 - card->dapm.idle_bias_off = true; 528 + card->dapm.idle_bias = false; 529 529 530 530 snd_soc_card_set_drvdata(card, cdev); 531 531