From patchwork Fri May 20 12:30:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Sperl X-Patchwork-Id: 9129745 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 417F360467 for ; Fri, 20 May 2016 14:49:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 35F2827BE4 for ; Fri, 20 May 2016 14:49:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2AAC127BF4; Fri, 20 May 2016 14:49:18 +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 0BC5327BE4 for ; Fri, 20 May 2016 14:49:16 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 2EAD4266823; Fri, 20 May 2016 16:49:14 +0200 (CEST) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 4EB0F2671AA; Fri, 20 May 2016 16:01:31 +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 31AA726685D; Fri, 20 May 2016 16:01:28 +0200 (CEST) Received: from cgate.sperl.org (212-186-180-163.static.surfer.at [212.186.180.163]) by alsa0.perex.cz (Postfix) with ESMTP id B3B1D266674 for ; Fri, 20 May 2016 14:30:49 +0200 (CEST) Received: from rasp3a.intern.sperl.org (account martin@sperl.org [10.10.10.43] verified) by sperl.org (CommuniGate Pro SMTP 6.1.2) with ESMTPSA id 6465606; Fri, 20 May 2016 12:30:49 +0000 From: kernel@martin.sperl.org To: Rob Herring , Pawel Moll , Mark Rutland , Mark Brown , Jaroslav Kysela , Takashi Iwai , devicetree@vger.kernel.org, alsa-devel@alsa-project.org Date: Fri, 20 May 2016 12:30:45 +0000 Message-Id: <1463747445-14167-3-git-send-email-kernel@martin.sperl.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1463747445-14167-1-git-send-email-kernel@martin.sperl.org> References: <1463747445-14167-1-git-send-email-kernel@martin.sperl.org> Cc: Martin Sperl Subject: [alsa-devel] [PATCH 2/2] ASoC: simple_card: add support for hw_params_rules 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 From: Martin Sperl Add support for hw_params_rules to simple_card. Signed-off-by: Martin Sperl --- Documentation/devicetree/bindings/sound/simple-card.txt | 1 + sound/soc/generic/simple-card.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/sound/simple-card.txt b/Documentation/devicetree/bindings/sound/simple-card.txt index cf3979e..2cfed39 100644 --- a/Documentation/devicetree/bindings/sound/simple-card.txt +++ b/Documentation/devicetree/bindings/sound/simple-card.txt @@ -31,6 +31,7 @@ Optional subnodes: omitted when the card has only one DAI link. See the examples and the section bellow. +- hw-params-rules : Please refer to hw-params-rules.txt. Dai-link subnode properties and subnodes: diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 2389ab4..6b95ea1 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -8,6 +8,7 @@ * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ +#include "hw-params-rules.h" #include #include #include @@ -33,6 +34,7 @@ struct simple_card_data { int gpio_hp_det_invert; int gpio_mic_det; int gpio_mic_det_invert; + struct list_head hw_params_rules; struct snd_soc_dai_link dai_link[]; /* dynamically allocated */ }; @@ -51,7 +53,7 @@ static int asoc_simple_card_startup(struct snd_pcm_substream *substream) ret = clk_prepare_enable(dai_props->cpu_dai.clk); if (ret) return ret; - + ret = clk_prepare_enable(dai_props->codec_dai.clk); if (ret) clk_disable_unprepare(dai_props->cpu_dai.clk); @@ -99,7 +101,9 @@ static int asoc_simple_card_hw_params(struct snd_pcm_substream *substream, if (ret && ret != -ENOTSUPP) goto err; } - return 0; + + return asoc_generic_hw_params_process_rules( + &priv->hw_params_rules, substream, params); err: return ret; } @@ -509,7 +513,8 @@ static int asoc_simple_card_parse_of(struct device_node *node, if (!priv->snd_card.name) priv->snd_card.name = priv->snd_card.dai_link->name; - return 0; + return asoc_generic_hw_params_rules_parse_of( + dev, node, &priv->hw_params_rules); } /* Decrease the reference count of the device nodes */