From patchwork Sat Aug 1 10:02:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 11695963 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4CB46722 for ; Sat, 1 Aug 2020 10:06:10 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D764C20836 for ; Sat, 1 Aug 2020 10:06:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="fKeCelGJ"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gerhold.net header.i=@gerhold.net header.b="lObvsHuu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D764C20836 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=gerhold.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 72EAB16AE; Sat, 1 Aug 2020 12:05:20 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 72EAB16AE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1596276368; bh=vUmtSeXlQZlcxBEzzX/yTSNCfa1a707fW42KAD8sxbA=; h=From:To:Subject:Date:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=fKeCelGJvmxzVyOEyre+xmPsyhkd/6KP436fTkh5TUiyVK1vRrrPSEmINsg8mUJz4 /IVntz3O7qgkO6brBlVcneFoxoI3KBgqvoJMkjwFEqlHyI6mKccuV4Cb7lfYRpfy8z dQPWWxIK4OzBpT3vS4DMrXanUHaBn1joaBcq5j5c= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 2F239F80256; Sat, 1 Aug 2020 12:04:28 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id EBAF0F8011C; Sat, 1 Aug 2020 12:04:25 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from mo4-p01-ob.smtp.rzone.de (mo4-p01-ob.smtp.rzone.de [85.215.255.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id D6757F8015C for ; Sat, 1 Aug 2020 12:04:15 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D6757F8015C Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gerhold.net header.i=@gerhold.net header.b="lObvsHuu" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1596276255; s=strato-dkim-0002; d=gerhold.net; h=Message-Id:Date:Subject:Cc:To:From:X-RZG-CLASS-ID:X-RZG-AUTH:From: Subject:Sender; bh=Pmv7+iLSVshdoV6ocv6fKYKPavqAIV2Sg/urAg838/A=; b=lObvsHuub2Amd8bN8vsM9VtCSb6fTK4cYzfzlvVRJDwbVsDr1fS7PeBZtxJRVFOlGw U3KzNKrNcUlk7T8s4fJOaaSFPM8XV53Ujfi3PW0tgIO2EdWIAdaPM7IzqTzGB8ANnYqh tLUaroeodwJeJ7Cm3bZxA6tvrKapuPleJMTGlzcdVxNNVxrVWjPK8jzTq5eE2citSpl2 n4VnIDrfnnaP8X9xdwADmt+zwqgn/Vdj+IW1D1oYM529DW9xwR8EZFMO6M4RdeKN16Rc aOdwp3fiZwdQ6jkTSc7ERwxQJ/MsUp9wWHZRRsn1wKmJnVeo7LJ7rPgnewlG1Sc4ZfSq FFcA== X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVORvLd4SsytBXS7IYBkLahKxB5m6NBgYo" X-RZG-CLASS-ID: mo00 Received: from localhost.localdomain by smtp.strato.de (RZmta 46.10.5 DYNA|AUTH) with ESMTPSA id Y0939ew71A40rZ6 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Sat, 1 Aug 2020 12:04:00 +0200 (CEST) From: Stephan Gerhold To: Mark Brown Subject: [PATCH 1/3] ASoC: core: Add common helper to parse aux devs from device tree Date: Sat, 1 Aug 2020 12:02:55 +0200 Message-Id: <20200801100257.22658-1-stephan@gerhold.net> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, Stephan Gerhold , Kuninori Morimoto , Kevin Hilman , Liam Girdwood , linux-amlogic@lists.infradead.org, Jerome Brunet X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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" simple-card.c and meson-card-utils.c use pretty much the same helper function to parse auxiliary devices from the device tree. Make it easier for other drivers to parse these from the device tree as well by adding a shared helper function to soc-core.c. snd_soc_of_parse_aux_devs() is pretty much a copy of meson_card_add_aux_devices() from meson-card-utils.c with two minor changes: - Make property name configurable as parameter - Change dev_err() message slightly for consistency with other error messages in soc-core.c Signed-off-by: Stephan Gerhold Reviewed-by: Jerome Brunet --- I have another patch set that I will submit separately which makes use of this function to parse aux devs from the device tree within qcom_snd_parse_of(). This is preparation for that patch set. --- include/sound/soc.h | 1 + sound/soc/soc-core.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/include/sound/soc.h b/include/sound/soc.h index 5e3919ffb00c..a0918d159fd3 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -1331,6 +1331,7 @@ void snd_soc_of_parse_audio_prefix(struct snd_soc_card *card, int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, const char *propname); +int snd_soc_of_parse_aux_devs(struct snd_soc_card *card, const char *propname); unsigned int snd_soc_of_parse_daifmt(struct device_node *np, const char *prefix, struct device_node **bitclkmaster, diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 2fe1b2ec7c8f..bf46f410c8c6 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2827,6 +2827,37 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, } EXPORT_SYMBOL_GPL(snd_soc_of_parse_audio_routing); +int snd_soc_of_parse_aux_devs(struct snd_soc_card *card, const char *propname) +{ + struct device_node *node = card->dev->of_node; + struct snd_soc_aux_dev *aux; + int num, i; + + num = of_count_phandle_with_args(node, propname, NULL); + if (num == -ENOENT) { + return 0; + } else if (num < 0) { + dev_err(card->dev, "ASOC: Property '%s' could not be read: %d\n", + propname, num); + return num; + } + + aux = devm_kcalloc(card->dev, num, sizeof(*aux), GFP_KERNEL); + if (!aux) + return -ENOMEM; + card->aux_dev = aux; + card->num_aux_devs = num; + + for_each_card_pre_auxs(card, i, aux) { + aux->dlc.of_node = of_parse_phandle(node, propname, i); + if (!aux->dlc.of_node) + return -EINVAL; + } + + return 0; +} +EXPORT_SYMBOL_GPL(snd_soc_of_parse_aux_devs); + unsigned int snd_soc_of_parse_daifmt(struct device_node *np, const char *prefix, struct device_node **bitclkmaster, From patchwork Sat Aug 1 10:02:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 11695961 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C60C61575 for ; Sat, 1 Aug 2020 10:05:18 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E0C96206F6 for ; Sat, 1 Aug 2020 10:05:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="Yx2WnxkF"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gerhold.net header.i=@gerhold.net header.b="VvyPB7yK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E0C96206F6 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=gerhold.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id BE49516B3; Sat, 1 Aug 2020 12:04:27 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz BE49516B3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1596276315; bh=+823si1CZiP5z0sJ1tTDVh0uwIk5AfISmiDLRPA+FyM=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Yx2WnxkFvo+3D1OiN7ICH6r/5ku/Ag80zLM80UK2C99KaMSfMUDSCDd+kNJ4h7SP8 bkvMaoC3bGBmvj8fpZc0qQ44jg5po8BdyxIoOl+I3E1miFGEelUizoJVdhJIgUQYtD L9SyNip2nmjN4IoN/stCmUAS5HfnpH1rkiKgK6WI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 3A71AF80227; Sat, 1 Aug 2020 12:04:27 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id ADEF6F80256; Sat, 1 Aug 2020 12:04:25 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from mo4-p01-ob.smtp.rzone.de (mo4-p01-ob.smtp.rzone.de [85.215.255.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 9D49CF8011C for ; Sat, 1 Aug 2020 12:04:15 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9D49CF8011C Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gerhold.net header.i=@gerhold.net header.b="VvyPB7yK" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1596276255; s=strato-dkim-0002; d=gerhold.net; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=D201RxrKY/jF6vCi3Z/0LyKu6Ty7PhswE7QCdIrJJ7c=; b=VvyPB7yKeFHIdT99h8B9QVLSfCrGKcym9G7GEwLVcR4i9JOn6WAyJaJdt5s+8nhr9o NwYM0xOjdwwsbnpl3Pbq0gDzxdxCitjGcsV3aQRYmFnPjFBCzBlmiEem7hXmtlvDr0hj bXnZ/i6szUcNaxGvvkUoxum8mnbQVncIaU6QdSWPiTVB/BC/j6XawApNAOOmbIcZNOLT NcCjnJGIt2vwulHDCh2Io9+iVWgdOO1QdbGcilyEfo93vZwYsvnonFw/oZGEfqBcoQsx NdT3Js3sC4NnlEZBufg2bs/87bnS7O0fkTxCZIJOxh95Ptmv0+T+AmbIbgGmUOSmyYsT F/BQ== X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVORvLd4SsytBXS7IYBkLahKxB5m6NBgYo" X-RZG-CLASS-ID: mo00 Received: from localhost.localdomain by smtp.strato.de (RZmta 46.10.5 DYNA|AUTH) with ESMTPSA id Y0939ew71A41rZ7 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Sat, 1 Aug 2020 12:04:01 +0200 (CEST) From: Stephan Gerhold To: Mark Brown Subject: [PATCH 2/3] ASoC: simple-card: Use snd_soc_of_parse_aux_devs() Date: Sat, 1 Aug 2020 12:02:56 +0200 Message-Id: <20200801100257.22658-2-stephan@gerhold.net> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200801100257.22658-1-stephan@gerhold.net> References: <20200801100257.22658-1-stephan@gerhold.net> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, Stephan Gerhold , Kuninori Morimoto , Kevin Hilman , Liam Girdwood , linux-amlogic@lists.infradead.org, Jerome Brunet X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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" Use the new common snd_soc_of_parse_aux_devs() helper function to parse auxiliary devices from the device tree. The code is slightly different but the binding that is parsed is exactly the same. Signed-off-by: Stephan Gerhold --- sound/soc/generic/simple-card.c | 33 +-------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 04d4d28ed511..75365c7bb393 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -424,37 +424,6 @@ static int simple_for_each_link(struct asoc_simple_priv *priv, return ret; } -static int simple_parse_aux_devs(struct device_node *node, - struct asoc_simple_priv *priv) -{ - struct device *dev = simple_priv_to_dev(priv); - struct device_node *aux_node; - struct snd_soc_card *card = simple_priv_to_card(priv); - int i, n, len; - - if (!of_find_property(node, PREFIX "aux-devs", &len)) - return 0; /* Ok to have no aux-devs */ - - n = len / sizeof(__be32); - if (n <= 0) - return -EINVAL; - - card->aux_dev = devm_kcalloc(dev, - n, sizeof(*card->aux_dev), GFP_KERNEL); - if (!card->aux_dev) - return -ENOMEM; - - for (i = 0; i < n; i++) { - aux_node = of_parse_phandle(node, PREFIX "aux-devs", i); - if (!aux_node) - return -EINVAL; - card->aux_dev[i].dlc.of_node = aux_node; - } - - card->num_aux_devs = n; - return 0; -} - static int simple_parse_of(struct asoc_simple_priv *priv) { struct device *dev = simple_priv_to_dev(priv); @@ -504,7 +473,7 @@ static int simple_parse_of(struct asoc_simple_priv *priv) if (ret < 0) return ret; - ret = simple_parse_aux_devs(top, priv); + ret = snd_soc_of_parse_aux_devs(card, PREFIX "aux-devs"); return ret; } From patchwork Sat Aug 1 10:02:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 11695965 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5018B913 for ; Sat, 1 Aug 2020 10:06:59 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 56A4720836 for ; Sat, 1 Aug 2020 10:06:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="C1E1yhFk"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gerhold.net header.i=@gerhold.net header.b="PH1/SkyX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 56A4720836 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=gerhold.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id CEEF516DE; Sat, 1 Aug 2020 12:06:08 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz CEEF516DE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1596276416; bh=qktnAtanpZbQ/NFpeCdKjFm++fBEygaFvv0sbf9I9Yc=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=C1E1yhFkUE4lJcNVvSw/yO82FqNcSjaMKFZ3jl+mSnLfcZFDRmOkMi4KGbfZIvNby twotd69/LVWNp761zPxV5RTLT57/4xjNAcn5JqRZJBl65g5NHiuM4g5ZWYsixbQFtB BH6zti7DjLw4It7jfxEZ5Mac3C4qDFdRhCwLlvKA= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id ECD94F8029B; Sat, 1 Aug 2020 12:04:31 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id A4B5BF802BD; Sat, 1 Aug 2020 12:04:30 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from mo4-p02-ob.smtp.rzone.de (mo4-p02-ob.smtp.rzone.de [85.215.255.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 65171F8021C for ; Sat, 1 Aug 2020 12:04:15 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 65171F8021C Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gerhold.net header.i=@gerhold.net header.b="PH1/SkyX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1596276255; s=strato-dkim-0002; d=gerhold.net; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=XWvOu54S0LJGbQq3Q4KDpCFi37RtmgZWkg+uKQEibNA=; b=PH1/SkyXdl6gAbltjlk5ggviOdS+R8py/amXhJRp4eyvwqKI70oY6PIYleATp3DhVW d+Z8ovnupbfFr8Y3JLjV9ho3N7JJjsaEQ3wLm2dszSI3uVjeG2ViqldTTbq1ORFKvcJT B7fvW+Pm5/aUf+yjtNG9H5HC6RSkkJihAnfaKPDX4/B3VHS6L+0ZgP19ll0WZ7Ds/uAJ Gb1TU7MJWnfYvEiEAiAiBrYkNS4IdrffosjalEoEhi0R+U5xtOuc6/ib5JW7ztmqayB6 62LvCZH1sJTEbQL1qDq5VoSETD27aonqfeHobHZBYkJZtCvf7X/8NDepX+CASQf9uzcw bCfQ== X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVORvLd4SsytBXS7IYBkLahKxB5m6NBgYo" X-RZG-CLASS-ID: mo00 Received: from localhost.localdomain by smtp.strato.de (RZmta 46.10.5 DYNA|AUTH) with ESMTPSA id Y0939ew71A41rZ8 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Sat, 1 Aug 2020 12:04:01 +0200 (CEST) From: Stephan Gerhold To: Mark Brown Subject: [PATCH 3/3] ASoC: meson: Use snd_soc_of_parse_aux_devs() Date: Sat, 1 Aug 2020 12:02:57 +0200 Message-Id: <20200801100257.22658-3-stephan@gerhold.net> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200801100257.22658-1-stephan@gerhold.net> References: <20200801100257.22658-1-stephan@gerhold.net> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, Stephan Gerhold , Kuninori Morimoto , Kevin Hilman , Liam Girdwood , linux-amlogic@lists.infradead.org, Jerome Brunet X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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" Use the new common snd_soc_of_parse_aux_devs() helper function to parse auxiliary devices from the device tree. The new helper is just a copy of meson_card_add_aux_devices() so there is no functional change. Signed-off-by: Stephan Gerhold --- sound/soc/meson/meson-card-utils.c | 33 +----------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/sound/soc/meson/meson-card-utils.c b/sound/soc/meson/meson-card-utils.c index 6a64ac01b5ca..300ac8be46ef 100644 --- a/sound/soc/meson/meson-card-utils.c +++ b/sound/soc/meson/meson-card-utils.c @@ -254,37 +254,6 @@ static int meson_card_parse_of_optional(struct snd_soc_card *card, return func(card, propname); } -static int meson_card_add_aux_devices(struct snd_soc_card *card) -{ - struct device_node *node = card->dev->of_node; - struct snd_soc_aux_dev *aux; - int num, i; - - num = of_count_phandle_with_args(node, "audio-aux-devs", NULL); - if (num == -ENOENT) { - return 0; - } else if (num < 0) { - dev_err(card->dev, "error getting auxiliary devices: %d\n", - num); - return num; - } - - aux = devm_kcalloc(card->dev, num, sizeof(*aux), GFP_KERNEL); - if (!aux) - return -ENOMEM; - card->aux_dev = aux; - card->num_aux_devs = num; - - for_each_card_pre_auxs(card, i, aux) { - aux->dlc.of_node = - of_parse_phandle(node, "audio-aux-devs", i); - if (!aux->dlc.of_node) - return -EINVAL; - } - - return 0; -} - static void meson_card_clean_references(struct meson_card *priv) { struct snd_soc_card *card = &priv->card; @@ -357,7 +326,7 @@ int meson_card_probe(struct platform_device *pdev) if (ret) goto out_err; - ret = meson_card_add_aux_devices(&priv->card); + ret = snd_soc_of_parse_aux_devs(&priv->card, "audio-aux-devs"); if (ret) goto out_err;