From patchwork Thu Dec 29 13:11:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 9491201 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 251A560488 for ; Thu, 29 Dec 2016 13:25:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0403D20007 for ; Thu, 29 Dec 2016 13:25:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DA0CD252D5; Thu, 29 Dec 2016 13:25:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7E30320007 for ; Thu, 29 Dec 2016 13:25:55 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 26E0E266F0A; Thu, 29 Dec 2016 14:25:49 +0100 (CET) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 78F84266F02; Thu, 29 Dec 2016 14:23:28 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id C4470266F00; Thu, 29 Dec 2016 14:21:59 +0100 (CET) Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by alsa0.perex.cz (Postfix) with ESMTP id 0BF7F266E52 for ; Thu, 29 Dec 2016 14:21:54 +0100 (CET) Received: from epcas1p1.samsung.com (unknown [182.195.41.45]) by mailout2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OIY01TZO7BM4Z00@mailout2.samsung.com> for alsa-devel@alsa-project.org; Thu, 29 Dec 2016 22:11:46 +0900 (KST) Received: from epsmges1p4.samsung.com (unknown [182.195.42.56]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20161229131145epcas1p3010043238a39415bde0dc5e0d6f5b8f9~UvDNBLBmj0335603356epcas1p3c; Thu, 29 Dec 2016 13:11:45 +0000 (GMT) Received: from epcas1p4.samsung.com ( [182.195.41.48]) by epsmges1p4.samsung.com (Symantec Messaging Gateway) with SMTP id E7.B0.02762.19B05685; Thu, 29 Dec 2016 22:11:45 +0900 (KST) Received: from epcpsbgm1new.samsung.com (u26.gpu120.samsung.co.kr [203.254.230.26]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20161229131145epcas1p26f296b842521fba67815d43cbe7562ba~UvDMnQKnb0090100901epcas1p2Y; Thu, 29 Dec 2016 13:11:45 +0000 (GMT) X-AuditID: b6c32a38-f79156d000000aca-f2-58650b917795 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1new.samsung.com (EPCPMTA) with SMTP id 12.7A.28252.19B05685; Thu, 29 Dec 2016 22:11:45 +0900 (KST) Received: from AMDC3061.digital.local ([106.116.147.40]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OIY00C5G7B0W8A0@mmp1.samsung.com>; Thu, 29 Dec 2016 22:11:45 +0900 (KST) From: Sylwester Nawrocki To: broonie@kernel.org, alsa-devel@alsa-project.org Date: Thu, 29 Dec 2016 14:11:21 +0100 Message-id: <1483017081-22605-1-git-send-email-s.nawrocki@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrAIsWRmVeSWpSXmKPExsWy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Bw DnAPVtK3S3DLeNr0jaVgnUTF39/P2BoY/wh3MXJySAiYSLzZ+IsVwhaTuHBvPVsXIxeHkMBS RonvNyaxQzi/GCUeH21lA6liEzCU6D3axwhiiwgYS9z8vJMZxGYWqJRYuWojWI2wgJvE9/8X wGwWAVWJybfeg9m8QPE33Q2MENvkJE4em8w6gZF7ASPDKkaJ1ILkguKk9FzDvNRyveLE3OLS vHS95PzcTYzgMH0mtYPx4C73Q4wCHIxKPLwSMikRQqyJZcWVuYcYJTiYlUR4K7hSI4R4UxIr q1KL8uOLSnNSiw8xmgIdMJFZSjQ5HxhDeSXxhibmJubGBhbmlpYmRkrivI2zn4ULCaQnlqRm p6YWpBbB9DFxcEo1MFq++Sukp2aa+GLjlpf7Ba8XcntZ3RLQeVn7h3PBVfHFE47oTNYuXL1v O9/RjP17jc9aqMcwlDnl+m2MZr+XMUlVL8du294NZzvPyq6ts8mSNzfceccu7mF21vXON85L Ylz/t/TJdAnqOjVuX/r7VqRCu8niZzznj+9Y+Xm5QpCA1LVFQTqPrJVYijMSDbWYi4oTAQpd kNFpAgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20161229131145epcas1p26f296b842521fba67815d43cbe7562ba X-Msg-Generator: CA X-Sender-IP: 203.254.230.26 X-Local-Sender: =?UTF-8?B?U3lsd2VzdGVyIE5hd3JvY2tpG1NSUE9MLUtlcm5lbCAoVFAp?= =?UTF-8?B?G+yCvOyEseyghOyekBtTZW5pb3IgU29mdHdhcmUgRW5naW5lZXI=?= X-Global-Sender: =?UTF-8?B?U3lsd2VzdGVyIE5hd3JvY2tpG1NSUE9MLUtlcm5lbCAoVFAp?= =?UTF-8?B?G1NhbXN1bmcgRWxlY3Ryb25pY3MbU2VuaW9yIFNvZnR3YXJlIEVuZ2luZWVy?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDAyQ0QwMjczOTI=?= CMS-TYPE: 101P X-HopCount: 7 X-CMS-RootMailID: 20161229131145epcas1p26f296b842521fba67815d43cbe7562ba X-RootMTR: 20161229131145epcas1p26f296b842521fba67815d43cbe7562ba References: Cc: Sylwester Nawrocki , lars@metafoo.de, lgirdwood@gmail.com, kuninori.morimoto.gx@renesas.com Subject: [alsa-devel] [PATCH] ASoC: Fix binding and probing of auxiliary components X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Currently binding of auxiliary devices doesn't work as in soc_bind_aux_dev() function a bound component is not being added to any list and in soc_probe_aux_devices() we are trying to walk the component_dev_list list to probe auxiliary components but at that time this list doesn't contain any auxiliary components since they are being added to the card only in soc_probe_component(). This patch adds a list to the card where are stored bound but not probed auxiliary devices, so that all aux devices can be probed. Fixes: 1a653aa44725 "ASoC: core: replace aux_comp_list to component_dev_list" Signed-off-by: Sylwester Nawrocki --- I'm not sure if this is a correct approach, without this patch the amplifier component doesn't get bound to the card on the TM2 board. --- include/sound/soc.h | 3 +++ sound/soc/soc-core.c | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) -- 1.9.1 diff --git a/include/sound/soc.h b/include/sound/soc.h index 2b502f6..b86168a 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -813,6 +813,7 @@ struct snd_soc_component { unsigned int suspended:1; /* is in suspend PM state */ struct list_head list; + struct list_head card_aux_list; /* for auxiliary bound components */ struct list_head card_list; struct snd_soc_dai_driver *dai_drv; @@ -1152,6 +1153,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 +1549,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 f1901bb..baa1afa 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1748,6 +1748,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->card_aux_list, &card->aux_comp_list); return 0; @@ -1758,16 +1759,14 @@ static int soc_bind_aux_dev(struct snd_soc_card *card, int num) static int soc_probe_aux_devices(struct snd_soc_card *card) { - struct snd_soc_component *comp; + struct snd_soc_component *comp, *tmp; int order; int ret; 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_safe(comp, tmp, &card->aux_comp_list, + card_aux_list) { if (comp->driver->probe_order == order) { ret = soc_probe_component(card, comp); if (ret < 0) { @@ -1776,6 +1775,7 @@ static int soc_probe_aux_devices(struct snd_soc_card *card) comp->name, ret); return ret; } + list_del(&comp->card_aux_list); } } }