All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Ujfalusi <peter.ujfalusi@ti.com>
To: Mark Brown <broonie@kernel.org>, Liam Girdwood <lgirdwood@gmail.com>
Cc: alsa-devel@alsa-project.org, Jyri Sarha <jsarha@ti.com>
Subject: [PATCH 1/4] ASoC: davinci-mcasp: Use defines for clkdiv IDs via DT binding header
Date: Mon, 15 Feb 2016 16:11:32 +0200	[thread overview]
Message-ID: <1455545495-20292-2-git-send-email-peter.ujfalusi@ti.com> (raw)
In-Reply-To: <1455545495-20292-1-git-send-email-peter.ujfalusi@ti.com>

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 <peter.ujfalusi@ti.com>
---
 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 <sound/soc.h>
 #include <sound/dmaengine_pcm.h>
 #include <sound/omap-pcm.h>
+#include <dt-bindings/sound/ti-mcasp.h>
 
 #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
-- 
2.7.1

  reply	other threads:[~2016-02-15 14:11 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-15 14:11 [PATCH 0/4] ASoC: simple-card/davinci-mcasp: System clock configuration support Peter Ujfalusi
2016-02-15 14:11 ` Peter Ujfalusi [this message]
2016-02-15 14:11 ` [PATCH 2/4] ASoC: davinci-mcasp: Improve the sysclk selection Peter Ujfalusi
2016-02-15 14:11 ` [PATCH 3/4] ASoC: simple-card: Add system-clock-direction DT parameter to dai nodes Peter Ujfalusi
2016-02-15 14:11 ` [PATCH 4/4] ASoC: simple-card: Support for selecting system clocks by ID Peter Ujfalusi
2016-02-15 15:26   ` Mark Brown
2016-02-16  9:46     ` Peter Ujfalusi
2016-02-16  9:46       ` Peter Ujfalusi
2016-02-16 13:42       ` Mark Brown
2016-02-16 19:13         ` Michael Turquette
2016-02-16 19:13           ` Michael Turquette
2016-02-17  8:13           ` Peter Ujfalusi
2016-02-17  8:13             ` Peter Ujfalusi
2016-02-17 12:07             ` Mark Brown
2016-02-17 19:52               ` Peter Ujfalusi
2016-02-17 19:52                 ` Peter Ujfalusi
2016-04-18 15:50                 ` [alsa-devel] " Peter Ujfalusi
2016-04-18 15:50                   ` Peter Ujfalusi
2016-04-18 16:29                   ` Mark Brown
2016-04-21 22:29                     ` Stephen Boyd
2016-04-22 11:52                       ` Peter Ujfalusi
2016-04-22 11:52                         ` Peter Ujfalusi
2016-04-22 12:08                         ` Tero Kristo
2016-04-22 12:08                           ` Tero Kristo
2016-02-17 11:31           ` Mark Brown
2016-02-17 14:18           ` [alsa-devel] " Ricard Wanderlof
2016-02-17 14:18             ` Ricard Wanderlof
2016-02-17 14:18             ` Ricard Wanderlof
2016-02-22  3:21             ` Mark Brown
2016-02-16 12:46     ` Andreas Irestål

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1455545495-20292-2-git-send-email-peter.ujfalusi@ti.com \
    --to=peter.ujfalusi@ti.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=jsarha@ti.com \
    --cc=lgirdwood@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.