diff options
author | Jarkko Nikula <jhnikula@gmail.com> | 2010-12-14 05:18:30 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-12-15 13:00:41 -0500 |
commit | 8ddab3f5107c3955e70e87a632d4d179ddba1189 (patch) | |
tree | 639742e20df719e585f1f31896112fa08314f7a6 | |
parent | 656d4b1edeb32a87042caee5694603706e399929 (diff) |
ASoC: Move DAPM paths from DAPM context to snd_soc_card
Decoupling DAPM paths from DAPM context is a first prerequisite when
extending ASoC core to cross-device paths. This patch is almost a nullop and
does not allow to construct cross-device setup but the path clean-up part in
dapm_free_widgets is prepared to remove cross-device paths between a device
being removed and others.
Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r-- | include/sound/soc-dapm.h | 1 | ||||
-rw-r--r-- | include/sound/soc.h | 2 | ||||
-rw-r--r-- | sound/soc/codecs/tlv320aic3x.c | 2 | ||||
-rw-r--r-- | sound/soc/soc-core.c | 2 | ||||
-rw-r--r-- | sound/soc/soc-dapm.c | 41 |
5 files changed, 31 insertions, 17 deletions
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index aef975f47bad..2c1e0eed43d5 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h | |||
@@ -463,7 +463,6 @@ struct snd_soc_dapm_widget { | |||
463 | /* DAPM context */ | 463 | /* DAPM context */ |
464 | struct snd_soc_dapm_context { | 464 | struct snd_soc_dapm_context { |
465 | struct list_head widgets; | 465 | struct list_head widgets; |
466 | struct list_head paths; | ||
467 | enum snd_soc_bias_level bias_level; | 466 | enum snd_soc_bias_level bias_level; |
468 | enum snd_soc_bias_level suspend_bias_level; | 467 | enum snd_soc_bias_level suspend_bias_level; |
469 | struct delayed_work delayed_work; | 468 | struct delayed_work delayed_work; |
diff --git a/include/sound/soc.h b/include/sound/soc.h index 7e65b015f8dd..466895b627b5 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h | |||
@@ -661,6 +661,8 @@ struct snd_soc_card { | |||
661 | struct list_head platform_dev_list; | 661 | struct list_head platform_dev_list; |
662 | struct list_head dai_dev_list; | 662 | struct list_head dai_dev_list; |
663 | 663 | ||
664 | struct list_head paths; | ||
665 | |||
664 | #ifdef CONFIG_DEBUG_FS | 666 | #ifdef CONFIG_DEBUG_FS |
665 | struct dentry *debugfs_card_root; | 667 | struct dentry *debugfs_card_root; |
666 | struct dentry *debugfs_pop_time; | 668 | struct dentry *debugfs_pop_time; |
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c index fc5abdf0bcb0..899af41787c1 100644 --- a/sound/soc/codecs/tlv320aic3x.c +++ b/sound/soc/codecs/tlv320aic3x.c | |||
@@ -185,7 +185,7 @@ static int snd_soc_dapm_put_volsw_aic3x(struct snd_kcontrol *kcontrol, | |||
185 | 185 | ||
186 | if (snd_soc_test_bits(widget->codec, reg, val_mask, val)) { | 186 | if (snd_soc_test_bits(widget->codec, reg, val_mask, val)) { |
187 | /* find dapm widget path assoc with kcontrol */ | 187 | /* find dapm widget path assoc with kcontrol */ |
188 | list_for_each_entry(path, &widget->dapm->paths, list) { | 188 | list_for_each_entry(path, &widget->dapm->card->paths, list) { |
189 | if (path->kcontrol != kcontrol) | 189 | if (path->kcontrol != kcontrol) |
190 | continue; | 190 | continue; |
191 | 191 | ||
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 1dc4b11c1988..bdb2ca9da58b 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -1879,6 +1879,7 @@ static int soc_probe(struct platform_device *pdev) | |||
1879 | INIT_LIST_HEAD(&card->dai_dev_list); | 1879 | INIT_LIST_HEAD(&card->dai_dev_list); |
1880 | INIT_LIST_HEAD(&card->codec_dev_list); | 1880 | INIT_LIST_HEAD(&card->codec_dev_list); |
1881 | INIT_LIST_HEAD(&card->platform_dev_list); | 1881 | INIT_LIST_HEAD(&card->platform_dev_list); |
1882 | INIT_LIST_HEAD(&card->paths); | ||
1882 | 1883 | ||
1883 | soc_init_card_debugfs(card); | 1884 | soc_init_card_debugfs(card); |
1884 | 1885 | ||
@@ -3481,7 +3482,6 @@ int snd_soc_register_codec(struct device *dev, | |||
3481 | codec->compress_type = SND_SOC_FLAT_COMPRESSION; | 3482 | codec->compress_type = SND_SOC_FLAT_COMPRESSION; |
3482 | 3483 | ||
3483 | INIT_LIST_HEAD(&codec->dapm.widgets); | 3484 | INIT_LIST_HEAD(&codec->dapm.widgets); |
3484 | INIT_LIST_HEAD(&codec->dapm.paths); | ||
3485 | codec->write = codec_drv->write; | 3485 | codec->write = codec_drv->write; |
3486 | codec->read = codec_drv->read; | 3486 | codec->read = codec_drv->read; |
3487 | codec->dapm.bias_level = SND_SOC_BIAS_OFF; | 3487 | codec->dapm.bias_level = SND_SOC_BIAS_OFF; |
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 3d310af28907..5d9ec4a3a9f1 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -272,7 +272,7 @@ static int dapm_connect_mux(struct snd_soc_dapm_context *dapm, | |||
272 | 272 | ||
273 | for (i = 0; i < e->max; i++) { | 273 | for (i = 0; i < e->max; i++) { |
274 | if (!(strcmp(control_name, e->texts[i]))) { | 274 | if (!(strcmp(control_name, e->texts[i]))) { |
275 | list_add(&path->list, &dapm->paths); | 275 | list_add(&path->list, &dapm->card->paths); |
276 | list_add(&path->list_sink, &dest->sources); | 276 | list_add(&path->list_sink, &dest->sources); |
277 | list_add(&path->list_source, &src->sinks); | 277 | list_add(&path->list_source, &src->sinks); |
278 | path->name = (char*)e->texts[i]; | 278 | path->name = (char*)e->texts[i]; |
@@ -294,7 +294,7 @@ static int dapm_connect_mixer(struct snd_soc_dapm_context *dapm, | |||
294 | /* search for mixer kcontrol */ | 294 | /* search for mixer kcontrol */ |
295 | for (i = 0; i < dest->num_kcontrols; i++) { | 295 | for (i = 0; i < dest->num_kcontrols; i++) { |
296 | if (!strcmp(control_name, dest->kcontrols[i].name)) { | 296 | if (!strcmp(control_name, dest->kcontrols[i].name)) { |
297 | list_add(&path->list, &dapm->paths); | 297 | list_add(&path->list, &dapm->card->paths); |
298 | list_add(&path->list_sink, &dest->sources); | 298 | list_add(&path->list_sink, &dest->sources); |
299 | list_add(&path->list_source, &src->sinks); | 299 | list_add(&path->list_source, &src->sinks); |
300 | path->name = dest->kcontrols[i].name; | 300 | path->name = dest->kcontrols[i].name; |
@@ -453,7 +453,7 @@ static inline void dapm_clear_walk(struct snd_soc_dapm_context *dapm) | |||
453 | { | 453 | { |
454 | struct snd_soc_dapm_path *p; | 454 | struct snd_soc_dapm_path *p; |
455 | 455 | ||
456 | list_for_each_entry(p, &dapm->paths, list) | 456 | list_for_each_entry(p, &dapm->card->paths, list) |
457 | p->walked = 0; | 457 | p->walked = 0; |
458 | } | 458 | } |
459 | 459 | ||
@@ -1180,7 +1180,7 @@ static int dapm_mux_update_power(struct snd_soc_dapm_widget *widget, | |||
1180 | return 0; | 1180 | return 0; |
1181 | 1181 | ||
1182 | /* find dapm widget path assoc with kcontrol */ | 1182 | /* find dapm widget path assoc with kcontrol */ |
1183 | list_for_each_entry(path, &widget->dapm->paths, list) { | 1183 | list_for_each_entry(path, &widget->dapm->card->paths, list) { |
1184 | if (path->kcontrol != kcontrol) | 1184 | if (path->kcontrol != kcontrol) |
1185 | continue; | 1185 | continue; |
1186 | 1186 | ||
@@ -1214,7 +1214,7 @@ static int dapm_mixer_update_power(struct snd_soc_dapm_widget *widget, | |||
1214 | return -ENODEV; | 1214 | return -ENODEV; |
1215 | 1215 | ||
1216 | /* find dapm widget path assoc with kcontrol */ | 1216 | /* find dapm widget path assoc with kcontrol */ |
1217 | list_for_each_entry(path, &widget->dapm->paths, list) { | 1217 | list_for_each_entry(path, &widget->dapm->card->paths, list) { |
1218 | if (path->kcontrol != kcontrol) | 1218 | if (path->kcontrol != kcontrol) |
1219 | continue; | 1219 | continue; |
1220 | 1220 | ||
@@ -1305,15 +1305,28 @@ static void dapm_free_widgets(struct snd_soc_dapm_context *dapm) | |||
1305 | 1305 | ||
1306 | list_for_each_entry_safe(w, next_w, &dapm->widgets, list) { | 1306 | list_for_each_entry_safe(w, next_w, &dapm->widgets, list) { |
1307 | list_del(&w->list); | 1307 | list_del(&w->list); |
1308 | /* | ||
1309 | * remove source and sink paths associated to this widget. | ||
1310 | * While removing the path, remove reference to it from both | ||
1311 | * source and sink widgets so that path is removed only once. | ||
1312 | */ | ||
1313 | list_for_each_entry_safe(p, next_p, &w->sources, list_sink) { | ||
1314 | list_del(&p->list_sink); | ||
1315 | list_del(&p->list_source); | ||
1316 | list_del(&p->list); | ||
1317 | kfree(p->long_name); | ||
1318 | kfree(p); | ||
1319 | } | ||
1320 | list_for_each_entry_safe(p, next_p, &w->sinks, list_source) { | ||
1321 | list_del(&p->list_sink); | ||
1322 | list_del(&p->list_source); | ||
1323 | list_del(&p->list); | ||
1324 | kfree(p->long_name); | ||
1325 | kfree(p); | ||
1326 | } | ||
1308 | kfree(w->name); | 1327 | kfree(w->name); |
1309 | kfree(w); | 1328 | kfree(w); |
1310 | } | 1329 | } |
1311 | |||
1312 | list_for_each_entry_safe(p, next_p, &dapm->paths, list) { | ||
1313 | list_del(&p->list); | ||
1314 | kfree(p->long_name); | ||
1315 | kfree(p); | ||
1316 | } | ||
1317 | } | 1330 | } |
1318 | 1331 | ||
1319 | static int snd_soc_dapm_set_pin(struct snd_soc_dapm_context *dapm, | 1332 | static int snd_soc_dapm_set_pin(struct snd_soc_dapm_context *dapm, |
@@ -1420,7 +1433,7 @@ static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm, | |||
1420 | 1433 | ||
1421 | /* connect static paths */ | 1434 | /* connect static paths */ |
1422 | if (control == NULL) { | 1435 | if (control == NULL) { |
1423 | list_add(&path->list, &dapm->paths); | 1436 | list_add(&path->list, &dapm->card->paths); |
1424 | list_add(&path->list_sink, &wsink->sources); | 1437 | list_add(&path->list_sink, &wsink->sources); |
1425 | list_add(&path->list_source, &wsource->sinks); | 1438 | list_add(&path->list_source, &wsource->sinks); |
1426 | path->connect = 1; | 1439 | path->connect = 1; |
@@ -1442,7 +1455,7 @@ static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm, | |||
1442 | case snd_soc_dapm_supply: | 1455 | case snd_soc_dapm_supply: |
1443 | case snd_soc_dapm_aif_in: | 1456 | case snd_soc_dapm_aif_in: |
1444 | case snd_soc_dapm_aif_out: | 1457 | case snd_soc_dapm_aif_out: |
1445 | list_add(&path->list, &dapm->paths); | 1458 | list_add(&path->list, &dapm->card->paths); |
1446 | list_add(&path->list_sink, &wsink->sources); | 1459 | list_add(&path->list_sink, &wsink->sources); |
1447 | list_add(&path->list_source, &wsource->sinks); | 1460 | list_add(&path->list_source, &wsource->sinks); |
1448 | path->connect = 1; | 1461 | path->connect = 1; |
@@ -1465,7 +1478,7 @@ static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm, | |||
1465 | case snd_soc_dapm_mic: | 1478 | case snd_soc_dapm_mic: |
1466 | case snd_soc_dapm_line: | 1479 | case snd_soc_dapm_line: |
1467 | case snd_soc_dapm_spk: | 1480 | case snd_soc_dapm_spk: |
1468 | list_add(&path->list, &dapm->paths); | 1481 | list_add(&path->list, &dapm->card->paths); |
1469 | list_add(&path->list_sink, &wsink->sources); | 1482 | list_add(&path->list_sink, &wsink->sources); |
1470 | list_add(&path->list_source, &wsource->sinks); | 1483 | list_add(&path->list_source, &wsource->sinks); |
1471 | path->connect = 0; | 1484 | path->connect = 0; |