aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-dapm.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-09-28 12:19:47 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-10-04 11:50:18 -0400
commitf9de6d741d246583a8fdcf212cf14456a1622ce1 (patch)
treeecf0713603063df385a87c3943d03f9b8e8f43f5 /sound/soc/soc-dapm.c
parent05623c4314cba3971f8476151aff73126127925f (diff)
ASoC: Move bias level decision into main dapm_power_widgets()
Future patches will try to reduce the number of widgets we check on each DAPM run but we're still going to need to look and see if the devices is on at all so we can manage the overall device bias. Move these checks out into the main dapm_power_widgets() function so we don't have to think about them for now. Once we're doing more incremental updates it'll probably be worth using refcounts for each bias level to avoid having to do the sweep over all widgets but that's not going to be where the big performance wins are. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r--sound/soc/soc-dapm.c44
1 files changed, 23 insertions, 21 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index dcbd4687b42f..12bd01a1863a 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -1218,7 +1218,6 @@ static void dapm_power_one_widget(struct snd_soc_dapm_widget *w,
1218 struct list_head *up_list, 1218 struct list_head *up_list,
1219 struct list_head *down_list) 1219 struct list_head *down_list)
1220{ 1220{
1221 struct snd_soc_dapm_context *d;
1222 int power; 1221 int power;
1223 1222
1224 switch (w->id) { 1223 switch (w->id) {
@@ -1238,26 +1237,6 @@ static void dapm_power_one_widget(struct snd_soc_dapm_widget *w,
1238 else 1237 else
1239 power = 1; 1238 power = 1;
1240 1239
1241 if (power) {
1242 d = w->dapm;
1243
1244 /* Supplies and micbiases only bring the
1245 * context up to STANDBY as unless something
1246 * else is active and passing audio they
1247 * generally don't require full power.
1248 */
1249 switch (w->id) {
1250 case snd_soc_dapm_supply:
1251 case snd_soc_dapm_micbias:
1252 if (d->target_bias_level < SND_SOC_BIAS_STANDBY)
1253 d->target_bias_level = SND_SOC_BIAS_STANDBY;
1254 break;
1255 default:
1256 d->target_bias_level = SND_SOC_BIAS_ON;
1257 break;
1258 }
1259 }
1260
1261 dapm_widget_set_power(w, power, up_list, down_list); 1240 dapm_widget_set_power(w, power, up_list, down_list);
1262 break; 1241 break;
1263 } 1242 }
@@ -1302,6 +1281,29 @@ static int dapm_power_widgets(struct snd_soc_dapm_context *dapm, int event)
1302 dapm_power_one_widget(w, &up_list, &down_list); 1281 dapm_power_one_widget(w, &up_list, &down_list);
1303 } 1282 }
1304 1283
1284 list_for_each_entry(w, &card->widgets, list) {
1285 if (w->power) {
1286 d = w->dapm;
1287
1288 /* Supplies and micbiases only bring the
1289 * context up to STANDBY as unless something
1290 * else is active and passing audio they
1291 * generally don't require full power.
1292 */
1293 switch (w->id) {
1294 case snd_soc_dapm_supply:
1295 case snd_soc_dapm_micbias:
1296 if (d->target_bias_level < SND_SOC_BIAS_STANDBY)
1297 d->target_bias_level = SND_SOC_BIAS_STANDBY;
1298 break;
1299 default:
1300 d->target_bias_level = SND_SOC_BIAS_ON;
1301 break;
1302 }
1303 }
1304
1305 }
1306
1305 /* If there are no DAPM widgets then try to figure out power from the 1307 /* If there are no DAPM widgets then try to figure out power from the
1306 * event type. 1308 * event type.
1307 */ 1309 */