From patchwork Sat Jul 29 14:17:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Code Kipper X-Patchwork-Id: 9869955 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 904176038F for ; Sat, 29 Jul 2017 14:19:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B2AB286F7 for ; Sat, 29 Jul 2017 14:19:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6C260288CE; Sat, 29 Jul 2017 14:19:11 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=no 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 91C0128653 for ; Sat, 29 Jul 2017 14:19:10 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 89051266E30; Sat, 29 Jul 2017 16:18:06 +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 A04CC266E13; Sat, 29 Jul 2017 16:18:01 +0200 (CEST) Received: from mail-lf0-f68.google.com (mail-lf0-f68.google.com [209.85.215.68]) by alsa0.perex.cz (Postfix) with ESMTP id 8A3D1266E0D for ; Sat, 29 Jul 2017 16:17:58 +0200 (CEST) Received: by mail-lf0-f68.google.com with SMTP id t128so11570454lff.3 for ; Sat, 29 Jul 2017 07:17:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=DylUyDjHbTxSC013Wr+LZZ06Kd3d2IyZDJssw5vXCJU=; b=cuLnULA5SHN8XeCbmm4lNH67sSTJRALNieVJl02FM3ZdBmQWstEkhmJP68PvndaYzq oFS4ei0Lp0PRxyV8lZGRz2V3774KPykxeS1inyvsYZ6Xp2Cn+6ZXrzhqLMV/TKOvtX0s o/MQxmWwIFqGsxx5I57EhlfYmhT8ZqYNmm6sNkhYyFtJHtCp1f2whAB0P6UCQwbI3Wa5 +kj0qlUELGmj2oBH2E3GI7QPxiX581ubGdTXhdU9Sr0dQetRIpnSAbSgcQD+u+Xwyp8Y xhiHqdoibOvh/fm1q/BrSrFnEs2p7zUAsE7QyQtydpZG9f1XSmUpRVLtrQZOyR5XG0k/ MzqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=DylUyDjHbTxSC013Wr+LZZ06Kd3d2IyZDJssw5vXCJU=; b=jA89nkHeduVPVDARaAQMDsiggrilHhyMJdR6NfqrDnzDvUDSvM4lG+aVGK6ejb1uJP bIUgJAVLhI7sCthmbytRsriBmKHxcA1EEaH6ETKSpnW+Mb6ASi/JMJ7hEWrFjh1Fn0fn Inr8ZmBH/R/78QyXc6YQYQWbB3/JJkb7frwViAjXZJF2XoSgzptzp4NoO1g5hT4uu3bl oRYcUaxWA4qdrsj2EbDvuucpm2pUbR4pDZZa4eT+41vmLNf2DeN1jrGVXEnc7Z7O7kPt 1ekGeWcMDWzEJex0SjUd/ttmsxlJh4oFVfhalv9EEVvMHl94nt+5j4gSCcaNt8tcsoB/ diEg== X-Gm-Message-State: AIVw112RzUidTYoiDykn5sQ/8i2GS3KZ4jyozM6FHy/ynQCESNI6oi3I hppb5VTcPXwswg== X-Received: by 10.25.16.168 with SMTP id 40mr3236941lfq.147.1501337878369; Sat, 29 Jul 2017 07:17:58 -0700 (PDT) Received: from localhost.localdomain (c80-217-9-219.bredband.comhem.se. [80.217.9.219]) by smtp.gmail.com with ESMTPSA id s189sm4581958lja.77.2017.07.29.07.17.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 29 Jul 2017 07:17:56 -0700 (PDT) From: codekipper@gmail.com To: maxime.ripard@free-electrons.com Date: Sat, 29 Jul 2017 16:17:43 +0200 Message-Id: <20170729141753.20174-3-codekipper@gmail.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20170729141753.20174-1-codekipper@gmail.com> References: <20170729141753.20174-1-codekipper@gmail.com> Cc: alsa-devel@alsa-project.org, Marcus Cooper , lgirdwood@gmail.com, linux-kernel@vger.kernel.org, be17068@iperbole.bo.it, linux-sunxi@googlegroups.com, broonie@kernel.org, linux-arm-kernel@lists.infradead.org Subject: [alsa-devel] [PATCH v3 02/12] ASoC: sun4i-i2s: Add clkdiv offsets to quirks 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: Marcus Cooper The BCLKDIV and MCLKDIV found on newer SoCs start from an offset of 1. Add the functionality to adjust the division values according to the needs to the device being used. Signed-off-by: Marcus Cooper --- sound/soc/sunxi/sun4i-i2s.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c index d7ee7a443e4e..1d538de4e4d0 100644 --- a/sound/soc/sunxi/sun4i-i2s.c +++ b/sound/soc/sunxi/sun4i-i2s.c @@ -94,9 +94,13 @@ * struct sun4i_i2s_quirks - Differences between SoC variants. * * @has_reset: SoC needs reset deasserted. + * @mclk_offset: Value by which mclkdiv needs to be adjusted. + * @bclk_offset: Value by which bclkdiv needs to be adjusted. */ struct sun4i_i2s_quirks { bool has_reset; + unsigned int mclk_offset; + unsigned int bclk_offset; }; struct sun4i_i2s { @@ -149,7 +153,7 @@ static int sun4i_i2s_get_bclk_div(struct sun4i_i2s *i2s, const struct sun4i_i2s_clk_div *bdiv = &sun4i_i2s_bclk_div[i]; if (bdiv->div == div) - return bdiv->val; + return bdiv->val + i2s->variant->bclk_offset; } return -EINVAL; @@ -167,7 +171,7 @@ static int sun4i_i2s_get_mclk_div(struct sun4i_i2s *i2s, const struct sun4i_i2s_clk_div *mdiv = &sun4i_i2s_mclk_div[i]; if (mdiv->div == div) - return mdiv->val; + return mdiv->val + i2s->variant->mclk_offset; } return -EINVAL;