From patchwork Tue Nov 3 01:33:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caesar Wang X-Patchwork-Id: 7539231 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B95599F65E for ; Tue, 3 Nov 2015 01:36:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EF9E62062F for ; Tue, 3 Nov 2015 01:36:52 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1FE2A203DF for ; Tue, 3 Nov 2015 01:36:52 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZtQUv-0005Yv-04; Tue, 03 Nov 2015 01:34:53 +0000 Received: from mail-pa0-f49.google.com ([209.85.220.49]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZtQUo-0005UW-Ko; Tue, 03 Nov 2015 01:34:47 +0000 Received: by pacfv9 with SMTP id fv9so2720538pac.3; Mon, 02 Nov 2015 17:34:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8L4EjrsymDuRLf4902XO9aThAOG4WGC/weLwDhxbcYM=; b=YDXH+oUlngxVItbW83kKNBEoltKr/Aq17MAjlpKxE1vNz0UiedmUHFUNLAO+bvnOSV eP9vZfu5M+ycfYWa117ziw5c87LJAkjY6rESKxvK2tfZyqQtiYVHgNY8wTjdpg4VbksE 1+DpzVt+Wr1c41eNDWKrsxgqRp9pqXbCE2tnKliT+M4NoQgjmAfu/Ci53ccrrE490VLu Mdq8XbM+b4E3sGyb8EgN7TQsfEk8feYt3PFtKZ4yxA7HsZR6azWqn5nQHoDWlFTvAE5N ljN5PgP1NnnbKATDrEVEK7AaeVY26kDozCgNWLEfEqR6kTvjlsGmXA8XuPbNWAkXYDh3 IaMg== X-Received: by 10.66.227.38 with SMTP id rx6mr31033619pac.85.1446514466037; Mon, 02 Nov 2015 17:34:26 -0800 (PST) Received: from localhost.localdomain ([103.47.144.138]) by smtp.gmail.com with ESMTPSA id yp5sm26371345pac.38.2015.11.02.17.34.18 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Nov 2015 17:34:25 -0800 (PST) From: Caesar Wang To: Heiko Stuebner , Mark Brown Subject: [PATCH v1 1/5] ASoC: rockchip: i2s: Support to set the divider clock API Date: Tue, 3 Nov 2015 09:33:54 +0800 Message-Id: <1446514438-13922-2-git-send-email-wxt@rock-chips.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1446514438-13922-1-git-send-email-wxt@rock-chips.com> References: <1446514438-13922-1-git-send-email-wxt@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151102_173446_853123_5632B656 X-CRM114-Status: GOOD ( 12.50 ) X-Spam-Score: -2.4 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alsa-devel@alsa-project.org, Liam Girdwood , linux-kernel@vger.kernel.org, Takashi Iwai , Doug Anderson , Jaroslav Kysela , linux-rockchip@lists.infradead.org, Dylan Reid , Cheng-Yi Chiang , Sonny Rao , linux-arm-kernel@lists.infradead.org, Caesar Wang MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In order to support more sample rates, add the divider clock api. As the input source clock to the module is MCLK_I2S, and by the divider of the module, the clock generator generates SCLK and LRCK to transmitter and receiver. Signed-off-by: Caesar Wang --- Changes in v1: - change the subject and commit. - remove the print message dev_dbg(). sound/soc/rockchip/rockchip_i2s.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c index b936102..23c867f 100644 --- a/sound/soc/rockchip/rockchip_i2s.c +++ b/sound/soc/rockchip/rockchip_i2s.c @@ -286,6 +286,32 @@ static int rockchip_i2s_trigger(struct snd_pcm_substream *substream, return ret; } +static int rockchip_i2s_set_clkdiv(struct snd_soc_dai *cpu_dai, + int div_id, int div) +{ + struct rk_i2s_dev *i2s = to_info(cpu_dai); + unsigned int val = 0; + + switch (div_id) { + case ROCKCHIP_DIV_BCLK: + val |= I2S_CKR_TSD(div); + val |= I2S_CKR_RSD(div); + regmap_update_bits(i2s->regmap, I2S_CKR, + I2S_CKR_TSD_MASK | I2S_CKR_RSD_MASK, + val); + break; + case ROCKCHIP_DIV_MCLK: + val |= I2S_CKR_MDIV(div); + regmap_update_bits(i2s->regmap, I2S_CKR, + I2S_CKR_MDIV_MASK, val); + break; + default: + return -EINVAL; + } + + return 0; +} + static int rockchip_i2s_set_sysclk(struct snd_soc_dai *cpu_dai, int clk_id, unsigned int freq, int dir) { @@ -311,6 +337,7 @@ static int rockchip_i2s_dai_probe(struct snd_soc_dai *dai) static const struct snd_soc_dai_ops rockchip_i2s_dai_ops = { .hw_params = rockchip_i2s_hw_params, + .set_clkdiv = rockchip_i2s_set_clkdiv, .set_sysclk = rockchip_i2s_set_sysclk, .set_fmt = rockchip_i2s_set_fmt, .trigger = rockchip_i2s_trigger,