From patchwork Tue May 26 18:59:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jyri Sarha X-Patchwork-Id: 6485241 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 64F27C0020 for ; Tue, 26 May 2015 19:00:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 899F420670 for ; Tue, 26 May 2015 19:00:19 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 3D66E2044B for ; Tue, 26 May 2015 19:00:18 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 55D4B2657A5; Tue, 26 May 2015 21:00:17 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 0B7512654F1; Tue, 26 May 2015 20:59:48 +0200 (CEST) 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 5AC1726550C; Tue, 26 May 2015 20:59:47 +0200 (CEST) Received: from devils.ext.ti.com (devils.ext.ti.com [198.47.26.153]) by alsa0.perex.cz (Postfix) with ESMTP id 0B04D264F39 for ; Tue, 26 May 2015 20:59:39 +0200 (CEST) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id t4QIxaSh004285; Tue, 26 May 2015 13:59:36 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id t4QIxapS028863; Tue, 26 May 2015 13:59:36 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.224.2; Tue, 26 May 2015 13:59:36 -0500 Received: from imryr.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id t4QIxUKn032651; Tue, 26 May 2015 13:59:34 -0500 From: Jyri Sarha To: , , , Date: Tue, 26 May 2015 21:59:05 +0300 Message-ID: <1432666751-24794-2-git-send-email-jsarha@ti.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1432666751-24794-1-git-send-email-jsarha@ti.com> References: <1432666751-24794-1-git-send-email-jsarha@ti.com> MIME-Version: 1.0 Cc: peter.ujfalusi@ti.com, moinejf@free.fr, broonie@kernel.org, Jyri Sarha , liam.r.girdwood@linux.intel.com, tomi.valkeinen@ti.com, rmk+kernel@arm.linux.org.uk Subject: [alsa-devel] [PATCH RFC v2 1/7] ASoC: core: If component doesn't have of_node use parent's node instead 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP If an ASoC component device does not have a device tree node, use its parent's node instead, when looking for a matching DAI based on a device tree reference. This allows video device drivers to register a separate child device for their ASoC side audio functionality. Signed-off-by: Jyri Sarha --- sound/soc/soc-core.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 2373252..b1bcff2 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -904,12 +904,17 @@ static struct snd_soc_dai *snd_soc_find_dai( { struct snd_soc_component *component; struct snd_soc_dai *dai; + struct device_node *component_of_node; lockdep_assert_held(&client_mutex); /* Find CPU DAI from registered DAIs*/ list_for_each_entry(component, &component_list, list) { - if (dlc->of_node && component->dev->of_node != dlc->of_node) + component_of_node = component->dev->of_node; + if (!component_of_node && component->dev->parent) + component_of_node = component->dev->parent->of_node; + + if (dlc->of_node && component_of_node != dlc->of_node) continue; if (dlc->name && strcmp(component->name, dlc->name)) continue; @@ -3488,11 +3493,16 @@ static int snd_soc_get_dai_name(struct of_phandle_args *args, const char **dai_name) { struct snd_soc_component *pos; + struct device_node *component_of_node; int ret = -EPROBE_DEFER; mutex_lock(&client_mutex); list_for_each_entry(pos, &component_list, list) { - if (pos->dev->of_node != args->np) + component_of_node = pos->dev->of_node; + if (!component_of_node && pos->dev->parent) + component_of_node = pos->dev->parent->of_node; + + if (component_of_node != args->np) continue; if (pos->driver->of_xlate_dai_name) {