From patchwork Fri Jun 9 08:52:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sugar Zhang X-Patchwork-Id: 9777551 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 EC0D760318 for ; Fri, 9 Jun 2017 08:57:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD0F328553 for ; Fri, 9 Jun 2017 08:57:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D1D9A285D4; Fri, 9 Jun 2017 08:57:54 +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=-0.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,URIBL_BLACK autolearn=no version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6E67028553 for ; Fri, 9 Jun 2017 08:57:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=lqW3IBdjfP9V7KcffjK04Y/9OtP7+5OPr3Rrz2IRXuI=; b=i1Wc5a5apaUa9zKkGWf6XSqeDy gkj0gJrJNCKOHRNvxvdb/iubIBpoumS6piTipuMTF+xaQ27W6jMHFXVGbdAvJSvQojdcYsZZw6tNo uLbYUa6O/uVIL43Gz6PDg1hrMXN6UzDCeTmIrztQlgp066Y4pJjsb+VYxzVaLlitxJY1+wvd5PQAf aSNt9LpOVl5KIQpystKqMX7w+MbSoeHBy17U9spNeuuLqyDZT2vZYYTff3MHy7dKM1p7w7bB/oqDr d4Al36orPuMQyqKDT7oOEbT2jfD6z6QTaBzPdNGTE+1X1sVE//h5aD5G7uj6Ty50NeBcskoNfJQPC cnWyo7cQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dJFjt-0006zi-AO; Fri, 09 Jun 2017 08:57:53 +0000 Received: from regular1.263xmail.com ([211.150.99.130]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dJFjG-0005vP-Ac; Fri, 09 Jun 2017 08:57:19 +0000 Received: from sugar.zhang?rock-chips.com (unknown [192.168.167.232]) by regular1.263xmail.com (Postfix) with ESMTP id 23478B076; Fri, 9 Jun 2017 16:56:53 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.263.net (Postfix) with ESMTP id 751433BE; Fri, 9 Jun 2017 16:56:49 +0800 (CST) X-RL-SENDER: sugar.zhang@rock-chips.com X-FST-TO: heiko@sntech.de X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: sugar.zhang@rock-chips.com X-UNIQUE-TAG: <3c02a91c2af17a9b3fa8fe2c0b1184cf> X-ATTACHMENT-NUM: 0 X-SENDER: zxg@rock-chips.com X-DNS-TYPE: 0 Received: from unknown (unknown [58.22.7.114]) by smtp.263.net (Postfix) whith SMTP id 18713W2OS61; Fri, 09 Jun 2017 16:56:53 +0800 (CST) From: Sugar Zhang To: heiko@sntech.de, broonie@kernel.org Subject: [PATCH v1 2/4] ASoC: rockchip: i2s: add support for i2s bclk fs configuration Date: Fri, 9 Jun 2017 16:52:47 +0800 Message-Id: <1496998369-30556-3-git-send-email-sugar.zhang@rock-chips.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1496998369-30556-1-git-send-email-sugar.zhang@rock-chips.com> References: <1496998369-30556-1-git-send-email-sugar.zhang@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170609_015714_924180_98BE342C X-CRM114-Status: UNSURE ( 9.65 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Takashi Iwai , Liam Girdwood , Jaroslav Kysela , Sugar Zhang , linux-rockchip@lists.infradead.org, Rob Herring , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP this patch add support for i2s bclk fs configuration, we can configure bclk_fs by devicetree as required. Signed-off-by: Sugar Zhang --- Documentation/devicetree/bindings/sound/rockchip-i2s.txt | 2 ++ sound/soc/rockchip/rockchip_i2s.c | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/sound/rockchip-i2s.txt b/Documentation/devicetree/bindings/sound/rockchip-i2s.txt index 206aba1..de3cbbe 100644 --- a/Documentation/devicetree/bindings/sound/rockchip-i2s.txt +++ b/Documentation/devicetree/bindings/sound/rockchip-i2s.txt @@ -23,6 +23,7 @@ Required properties: - "i2s_clk" : clock for I2S controller - rockchip,playback-channels: max playback channels, if not set, 8 channels default. - rockchip,capture-channels: max capture channels, if not set, 2 channels default. +- rockchip,bclk-fs: configure the i2s bclk fs. Required properties for controller which support multi channels playback/capture: @@ -41,4 +42,5 @@ i2s@ff890000 { clocks = <&cru HCLK_I2S0>, <&cru SCLK_I2S0>; rockchip,playback-channels = <8>; rockchip,capture-channels = <2>; + rockchip,bclk-fs = <128>; }; diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c index f548433..220232b 100644 --- a/sound/soc/rockchip/rockchip_i2s.c +++ b/sound/soc/rockchip/rockchip_i2s.c @@ -51,6 +51,7 @@ struct rk_i2s_dev { bool rx_start; bool is_master_mode; const struct rk_i2s_pins *pins; + unsigned int bclk_fs; }; static int i2s_runtime_suspend(struct device *dev) @@ -254,7 +255,7 @@ static int rockchip_i2s_hw_params(struct snd_pcm_substream *substream, if (i2s->is_master_mode) { mclk_rate = clk_get_rate(i2s->mclk); - bclk_rate = 2 * 32 * params_rate(params); + bclk_rate = i2s->bclk_fs * params_rate(params); if (bclk_rate && mclk_rate % bclk_rate) return -EINVAL; @@ -633,6 +634,12 @@ static int rockchip_i2s_probe(struct platform_device *pdev) soc_dai->capture.channels_max = val; } + i2s->bclk_fs = 64; + if (!of_property_read_u32(node, "rockchip,bclk-fs", &val)) { + if ((val >= 32) && (val % 2 == 0)) + i2s->bclk_fs = val; + } + ret = devm_snd_soc_register_component(&pdev->dev, &rockchip_i2s_component, soc_dai, 1);