diff mbox

Revert "ASoC: core: replace aux_comp_list to component_dev_list"

Message ID 1483022987-28843-1-git-send-email-nikita.yoush@cogentembedded.com (mailing list archive)
State New, archived
Headers show

Commit Message

Nikita Yushchenko Dec. 29, 2016, 2:49 p.m. UTC
This reverts commit 1a653aa44725668590b36bbe2d7fe4736a69f055 ("ASoC:
core: replace aux_comp_list to component_dev_list").

That commit tries to remove card->aux_comp_list, using flagged entries
in card->component_dev_list instead.

However, components are added to card->component_dev_list in
soc_probe_component(), which is called for aux devices by
soc_probe_aux_devices(). Before that commit, it traversed
card->aux_comp_list and found aux devices added by soc_bind_aux_dev().
After that commit, it traverses card->component_dev_list and finds no
aux devices, because soc_probe_component() was not yet called for them.

Thus all aux devices are lost and any setup that needs them no longer
works.

Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
---
Fixed lost line in commit message ;)
 include/sound/soc.h  |  4 +++-
 sound/soc/soc-core.c | 17 +++++------------
 2 files changed, 8 insertions(+), 13 deletions(-)

Comments

On 12/29/2016 03:49 PM, Nikita Yushchenko wrote:
> This reverts commit 1a653aa44725668590b36bbe2d7fe4736a69f055 ("ASoC:
> core: replace aux_comp_list to component_dev_list").
> 
> That commit tries to remove card->aux_comp_list, using flagged entries
> in card->component_dev_list instead.
> 
> However, components are added to card->component_dev_list in
> soc_probe_component(), which is called for aux devices by
> soc_probe_aux_devices(). Before that commit, it traversed
> card->aux_comp_list and found aux devices added by soc_bind_aux_dev().
> After that commit, it traverses card->component_dev_list and finds no
> aux devices, because soc_probe_component() was not yet called for them.
> 
> Thus all aux devices are lost and any setup that needs them no longer
> works.

I think we can't simply revert that commit now, after commit

9178feb ASoC: add Component level suspend/resume
component_dev_list is also used for the component level suspend/resume,
if auxiliary devices would have been on a separate list they would be
missed in the suspend/resume sequences.

I run into same issue and posted a patch:

"ASoC: Fix binding and probing of auxiliary components".

--
Thanks,
Sylwester
Nikita Yushchenko Dec. 29, 2016, 4:20 p.m. UTC | #2
29.12.2016 19:18, Sylwester Nawrocki пишет:
> On 12/29/2016 03:49 PM, Nikita Yushchenko wrote:
>> This reverts commit 1a653aa44725668590b36bbe2d7fe4736a69f055 ("ASoC:
>> core: replace aux_comp_list to component_dev_list").
>>
>> That commit tries to remove card->aux_comp_list, using flagged entries
>> in card->component_dev_list instead.
>>
>> However, components are added to card->component_dev_list in
>> soc_probe_component(), which is called for aux devices by
>> soc_probe_aux_devices(). Before that commit, it traversed
>> card->aux_comp_list and found aux devices added by soc_bind_aux_dev().
>> After that commit, it traverses card->component_dev_list and finds no
>> aux devices, because soc_probe_component() was not yet called for them.
>>
>> Thus all aux devices are lost and any setup that needs them no longer
>> works.
> 
> I think we can't simply revert that commit now, after commit
> 
> 9178feb ASoC: add Component level suspend/resume
> component_dev_list is also used for the component level suspend/resume,
> if auxiliary devices would have been on a separate list they would be
> missed in the suspend/resume sequences.

I believe aux devices are on both lists.
Nikita Yushchenko Dec. 29, 2016, 4:20 p.m. UTC | #3
>> This reverts commit 1a653aa44725668590b36bbe2d7fe4736a69f055 ("ASoC:
>> core: replace aux_comp_list to component_dev_list").
>>
>> That commit tries to remove card->aux_comp_list, using flagged entries
>> in card->component_dev_list instead.
>>
>> However, components are added to card->component_dev_list in
>> soc_probe_component(), which is called for aux devices by
>> soc_probe_aux_devices(). Before that commit, it traversed
>> card->aux_comp_list and found aux devices added by soc_bind_aux_dev().
>> After that commit, it traverses card->component_dev_list and finds no
>> aux devices, because soc_probe_component() was not yet called for them.
>>
>> Thus all aux devices are lost and any setup that needs them no longer
>> works.
> 
> I think we can't simply revert that commit now, after commit
> 
> 9178feb ASoC: add Component level suspend/resume
> component_dev_list is also used for the component level suspend/resume,
> if auxiliary devices would have been on a separate list they would be
> missed in the suspend/resume sequences.

I believe aux devices are on both lists.
On 12/29/2016 05:20 PM, Nikita Yushchenko wrote:
> I believe aux devices are on both lists.

Indeed, you are right, they are on both lists.
So there should be no issues after reverting.
Mark Brown Jan. 6, 2017, 6:18 p.m. UTC | #5
On Thu, Dec 29, 2016 at 05:18:21PM +0100, Sylwester Nawrocki wrote:

> I run into same issue and posted a patch:

> "ASoC: Fix binding and probing of auxiliary components".

Which I applied so I guess things are fine now without the revert?  I'm
still working through backlog from the holidays so didn't check
properly yet.
Chen-Yu Tsai Jan. 7, 2017, 8:33 p.m. UTC | #6
On Sat, Jan 7, 2017 at 2:18 AM, Mark Brown <broonie@kernel.org> wrote:
> On Thu, Dec 29, 2016 at 05:18:21PM +0100, Sylwester Nawrocki wrote:
>
>> I run into same issue and posted a patch:
>
>> "ASoC: Fix binding and probing of auxiliary components".
>
> Which I applied so I guess things are fine now without the revert?  I'm
> still working through backlog from the holidays so didn't check
> properly yet.

This fixes the Allwinner H3 codec analog controls aux_device for me.
Thanks.

ChenYu

>
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
Nikita Yushchenko Jan. 9, 2017, 7:41 a.m. UTC | #7
>>> I run into same issue and posted a patch:
>>
>>> "ASoC: Fix binding and probing of auxiliary components".
>>
>> Which I applied so I guess things are fine now without the revert?  I'm
>> still working through backlog from the holidays so didn't check
>> properly yet.
> 
> This fixes the Allwinner H3 codec analog controls aux_device for me.
> Thanks.

But this is not yet in 4.10-rc3 ?
Mark Brown Jan. 9, 2017, 11:55 a.m. UTC | #8
On Mon, Jan 09, 2017 at 10:41:37AM +0300, Nikita Yushchenko wrote:

> But this is not yet in 4.10-rc3 ?

Yes.  It's not yet been sent to Linus, it'll go whenever the next batch
of fixes goes.
diff mbox

Patch

diff --git a/include/sound/soc.h b/include/sound/soc.h
index 2b502f6cc6d0..8172a512632a 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -809,10 +809,10 @@  struct snd_soc_component {
 
 	unsigned int ignore_pmdown_time:1; /* pmdown_time is ignored at stop */
 	unsigned int registered_as_component:1;
-	unsigned int auxiliary:1; /* for auxiliary component of the card */
 	unsigned int suspended:1; /* is in suspend PM state */
 
 	struct list_head list;
+	struct list_head list_aux; /* for auxiliary component of the card */
 	struct list_head card_list;
 
 	struct snd_soc_dai_driver *dai_drv;
@@ -1152,6 +1152,7 @@  struct snd_soc_card {
 	 */
 	struct snd_soc_aux_dev *aux_dev;
 	int num_aux_devs;
+	struct list_head aux_comp_list;
 
 	const struct snd_kcontrol_new *controls;
 	int num_controls;
@@ -1547,6 +1548,7 @@  static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card)
 	INIT_LIST_HEAD(&card->widgets);
 	INIT_LIST_HEAD(&card->paths);
 	INIT_LIST_HEAD(&card->dapm_list);
+	INIT_LIST_HEAD(&card->aux_comp_list);
 	INIT_LIST_HEAD(&card->component_dev_list);
 }
 
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index f1901bb1466e..15657a65e4ca 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1747,8 +1747,7 @@  static int soc_bind_aux_dev(struct snd_soc_card *card, int num)
 	}
 
 	component->init = aux_dev->init;
-	component->auxiliary = 1;
-
+	list_add(&component->list_aux, &card->aux_comp_list);
 	return 0;
 
 err_defer:
@@ -1764,10 +1763,7 @@  static int soc_probe_aux_devices(struct snd_soc_card *card)
 
 	for (order = SND_SOC_COMP_ORDER_FIRST; order <= SND_SOC_COMP_ORDER_LAST;
 		order++) {
-		list_for_each_entry(comp, &card->component_dev_list, card_list) {
-			if (!comp->auxiliary)
-				continue;
-
+		list_for_each_entry(comp, &card->aux_comp_list, list_aux) {
 			if (comp->driver->probe_order == order) {
 				ret = soc_probe_component(card,	comp);
 				if (ret < 0) {
@@ -1791,14 +1787,11 @@  static void soc_remove_aux_devices(struct snd_soc_card *card)
 	for (order = SND_SOC_COMP_ORDER_FIRST; order <= SND_SOC_COMP_ORDER_LAST;
 		order++) {
 		list_for_each_entry_safe(comp, _comp,
-			&card->component_dev_list, card_list) {
-
-			if (!comp->auxiliary)
-				continue;
-
+			&card->aux_comp_list, list_aux) {
 			if (comp->driver->remove_order == order) {
 				soc_remove_component(comp);
-				comp->auxiliary = 0;
+				/* remove it from the card's aux_comp_list */
+				list_del(&comp->list_aux);
 			}
 		}
 	}