From patchwork Mon Feb 15 14:11:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 8315681 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 19170C02AA for ; Mon, 15 Feb 2016 14:12:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 38F3A203A9 for ; Mon, 15 Feb 2016 14:12:35 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id F361B2039C for ; Mon, 15 Feb 2016 14:12:33 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 25467265335; Mon, 15 Feb 2016 15:12:33 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id ACE8B265132; Mon, 15 Feb 2016 15:11:53 +0100 (CET) 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 E8C0B261721; Mon, 15 Feb 2016 15:11:52 +0100 (CET) Received: from bear.ext.ti.com (bear.ext.ti.com [192.94.94.41]) by alsa0.perex.cz (Postfix) with ESMTP id EAF87261721 for ; Mon, 15 Feb 2016 15:11:45 +0100 (CET) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id u1FEBhXW026274; Mon, 15 Feb 2016 08:11:43 -0600 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id u1FEBhqN003576; Mon, 15 Feb 2016 08:11:43 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.224.2; Mon, 15 Feb 2016 08:11:43 -0600 Received: from dflp33.itg.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id u1FEBcmX032690; Mon, 15 Feb 2016 08:11:41 -0600 From: Peter Ujfalusi To: Mark Brown , Liam Girdwood Date: Mon, 15 Feb 2016 16:11:32 +0200 Message-ID: <1455545495-20292-2-git-send-email-peter.ujfalusi@ti.com> X-Mailer: git-send-email 2.7.1 In-Reply-To: <1455545495-20292-1-git-send-email-peter.ujfalusi@ti.com> References: <1455545495-20292-1-git-send-email-peter.ujfalusi@ti.com> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, Jyri Sarha Subject: [alsa-devel] [PATCH 1/4] ASoC: davinci-mcasp: Use defines for clkdiv IDs via DT binding header 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of hardwired IDs add defines to select which divider to configure. The defines are placed in the dt binding header so legacy and DT files can both use them. Signed-off-by: Peter Ujfalusi --- include/dt-bindings/sound/ti-mcasp.h | 9 +++++++++ sound/soc/davinci/davinci-mcasp.c | 8 +++++--- 2 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 include/dt-bindings/sound/ti-mcasp.h diff --git a/include/dt-bindings/sound/ti-mcasp.h b/include/dt-bindings/sound/ti-mcasp.h new file mode 100644 index 000000000000..03519ab67b44 --- /dev/null +++ b/include/dt-bindings/sound/ti-mcasp.h @@ -0,0 +1,9 @@ +#ifndef _DT_BINDINGS_TI_MCASP_H +#define _DT_BINDINGS_TI_MCASP_H + +/* clock divider IDs */ +#define MCASP_CLKDIV_AUXCLK 0 /* HCLK divider from AUXCLK */ +#define MCASP_CLKDIV_BCLK 1 /* BCLK divider from HCLK */ +#define MCASP_CLKDIV_BCLK_FS_RATIO 2 /* to set BCLK FS ration */ + +#endif /* _DT_BINDINGS_TI_MCASP_H */ diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index 3cf46afb353f..a4e40606742a 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c @@ -37,6 +37,7 @@ #include #include #include +#include #include "edma-pcm.h" #include "davinci-mcasp.h" @@ -541,14 +542,14 @@ static int __davinci_mcasp_set_clkdiv(struct snd_soc_dai *dai, int div_id, pm_runtime_get_sync(mcasp->dev); switch (div_id) { - case 0: /* MCLK divider */ + case MCASP_CLKDIV_AUXCLK: /* MCLK divider */ mcasp_mod_bits(mcasp, DAVINCI_MCASP_AHCLKXCTL_REG, AHCLKXDIV(div - 1), AHCLKXDIV_MASK); mcasp_mod_bits(mcasp, DAVINCI_MCASP_AHCLKRCTL_REG, AHCLKRDIV(div - 1), AHCLKRDIV_MASK); break; - case 1: /* BCLK divider */ + case MCASP_CLKDIV_BCLK: /* BCLK divider */ mcasp_mod_bits(mcasp, DAVINCI_MCASP_ACLKXCTL_REG, ACLKXDIV(div - 1), ACLKXDIV_MASK); mcasp_mod_bits(mcasp, DAVINCI_MCASP_ACLKRCTL_REG, @@ -557,7 +558,8 @@ static int __davinci_mcasp_set_clkdiv(struct snd_soc_dai *dai, int div_id, mcasp->bclk_div = div; break; - case 2: /* + case MCASP_CLKDIV_BCLK_FS_RATIO: + /* * BCLK/LRCLK ratio descries how many bit-clock cycles * fit into one frame. The clock ratio is given for a * full period of data (for I2S format both left and