All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jean-Francois Moine <moinejf@free.fr>
To: dri-devel@lists.freedesktop.org
Cc: Dave Airlie <airlied@gmail.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Rob Clark <robdclark@gmail.com>,
	Russell King - ARM Linux <linux@arm.linux.org.uk>
Subject: [PATCH v5 18/23] drm/i2c: tda998x: make the audio code more readable
Date: Sat, 25 Jan 2014 18:14:40 +0100	[thread overview]
Message-ID: <7dca56216f9df5495b77d463e52a0a67bac69fe7.1390986083.git.moinejf@free.fr> (raw)
In-Reply-To: <cover.1390986082.git.moinejf@free.fr>

This patch adds a definition of the values of the MUX_AP register and
simplifies the macro's defining the fields of the AIP_CLKSEL register.
This makes the format specific audio init sequence more readable.

Tested-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
---
 drivers/gpu/drm/i2c/tda998x_drv.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c
index 873e1e9..3e56302 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -126,6 +126,8 @@ struct tda998x_priv {
 # define VIP_CNTRL_5_CKCASE       (1 << 0)
 # define VIP_CNTRL_5_SP_CNT(x)    (((x) & 3) << 1)
 #define REG_MUX_AP                REG(0x00, 0x26)     /* read/write */
+# define MUX_AP_SELECT_I2S	  0x64
+# define MUX_AP_SELECT_SPDIF	  0x40
 #define REG_MUX_VP_VIP_OUT        REG(0x00, 0x27)     /* read/write */
 #define REG_MAT_CONTRL            REG(0x00, 0x80)     /* write */
 # define MAT_CONTRL_MAT_SC(x)     (((x) & 3) << 0)
@@ -203,10 +205,11 @@ struct tda998x_priv {
 #define REG_I2S_FORMAT            REG(0x00, 0xfc)     /* read/write */
 # define I2S_FORMAT(x)            (((x) & 3) << 0)
 #define REG_AIP_CLKSEL            REG(0x00, 0xfd)     /* write */
-# define AIP_CLKSEL_FS(x)         (((x) & 3) << 0)
-# define AIP_CLKSEL_CLK_POL(x)    (((x) & 1) << 2)
-# define AIP_CLKSEL_AIP(x)        (((x) & 7) << 3)
-
+# define AIP_CLKSEL_AIP_SPDIF	  (0 << 3)
+# define AIP_CLKSEL_AIP_I2S	  (1 << 3)
+# define AIP_CLKSEL_FS_ACLK	  (0 << 0)
+# define AIP_CLKSEL_FS_MCLK	  (1 << 0)
+# define AIP_CLKSEL_FS_FS64SPDIF  (2 << 0)
 
 /* Page 02h: PLL settings */
 #define REG_PLL_SERIAL_1          REG(0x02, 0x00)     /* read/write */
@@ -645,19 +648,17 @@ tda998x_configure_audio(struct tda998x_priv *priv,
 	/* Set audio input source */
 	switch (p->audio_format) {
 	case AFMT_SPDIF:
-		reg_write(priv, REG_MUX_AP, 0x40);
-		clksel_aip = AIP_CLKSEL_AIP(0);
-		/* FS64SPDIF */
-		clksel_fs = AIP_CLKSEL_FS(2);
+		reg_write(priv, REG_MUX_AP, MUX_AP_SELECT_SPDIF);
+		clksel_aip = AIP_CLKSEL_AIP_SPDIF;
+		clksel_fs = AIP_CLKSEL_FS_FS64SPDIF;
 		cts_n = CTS_N_M(3) | CTS_N_K(3);
 		ca_i2s = 0;
 		break;
 
 	case AFMT_I2S:
-		reg_write(priv, REG_MUX_AP, 0x64);
-		clksel_aip = AIP_CLKSEL_AIP(1);
-		/* ACLK */
-		clksel_fs = AIP_CLKSEL_FS(0);
+		reg_write(priv, REG_MUX_AP, MUX_AP_SELECT_I2S);
+		clksel_aip = AIP_CLKSEL_AIP_I2S;
+		clksel_fs = AIP_CLKSEL_FS_ACLK;
 		cts_n = CTS_N_M(3) | CTS_N_K(3);
 		ca_i2s = CA_I2S_CA_I2S(0);
 		break;
-- 
1.9.rc1


WARNING: multiple messages have this Message-ID (diff)
From: moinejf@free.fr (Jean-Francois Moine)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v5 18/23] drm/i2c: tda998x: make the audio code more readable
Date: Sat, 25 Jan 2014 18:14:40 +0100	[thread overview]
Message-ID: <7dca56216f9df5495b77d463e52a0a67bac69fe7.1390986083.git.moinejf@free.fr> (raw)
In-Reply-To: <cover.1390986082.git.moinejf@free.fr>

This patch adds a definition of the values of the MUX_AP register and
simplifies the macro's defining the fields of the AIP_CLKSEL register.
This makes the format specific audio init sequence more readable.

Tested-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
---
 drivers/gpu/drm/i2c/tda998x_drv.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c
index 873e1e9..3e56302 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -126,6 +126,8 @@ struct tda998x_priv {
 # define VIP_CNTRL_5_CKCASE       (1 << 0)
 # define VIP_CNTRL_5_SP_CNT(x)    (((x) & 3) << 1)
 #define REG_MUX_AP                REG(0x00, 0x26)     /* read/write */
+# define MUX_AP_SELECT_I2S	  0x64
+# define MUX_AP_SELECT_SPDIF	  0x40
 #define REG_MUX_VP_VIP_OUT        REG(0x00, 0x27)     /* read/write */
 #define REG_MAT_CONTRL            REG(0x00, 0x80)     /* write */
 # define MAT_CONTRL_MAT_SC(x)     (((x) & 3) << 0)
@@ -203,10 +205,11 @@ struct tda998x_priv {
 #define REG_I2S_FORMAT            REG(0x00, 0xfc)     /* read/write */
 # define I2S_FORMAT(x)            (((x) & 3) << 0)
 #define REG_AIP_CLKSEL            REG(0x00, 0xfd)     /* write */
-# define AIP_CLKSEL_FS(x)         (((x) & 3) << 0)
-# define AIP_CLKSEL_CLK_POL(x)    (((x) & 1) << 2)
-# define AIP_CLKSEL_AIP(x)        (((x) & 7) << 3)
-
+# define AIP_CLKSEL_AIP_SPDIF	  (0 << 3)
+# define AIP_CLKSEL_AIP_I2S	  (1 << 3)
+# define AIP_CLKSEL_FS_ACLK	  (0 << 0)
+# define AIP_CLKSEL_FS_MCLK	  (1 << 0)
+# define AIP_CLKSEL_FS_FS64SPDIF  (2 << 0)
 
 /* Page 02h: PLL settings */
 #define REG_PLL_SERIAL_1          REG(0x02, 0x00)     /* read/write */
@@ -645,19 +648,17 @@ tda998x_configure_audio(struct tda998x_priv *priv,
 	/* Set audio input source */
 	switch (p->audio_format) {
 	case AFMT_SPDIF:
-		reg_write(priv, REG_MUX_AP, 0x40);
-		clksel_aip = AIP_CLKSEL_AIP(0);
-		/* FS64SPDIF */
-		clksel_fs = AIP_CLKSEL_FS(2);
+		reg_write(priv, REG_MUX_AP, MUX_AP_SELECT_SPDIF);
+		clksel_aip = AIP_CLKSEL_AIP_SPDIF;
+		clksel_fs = AIP_CLKSEL_FS_FS64SPDIF;
 		cts_n = CTS_N_M(3) | CTS_N_K(3);
 		ca_i2s = 0;
 		break;
 
 	case AFMT_I2S:
-		reg_write(priv, REG_MUX_AP, 0x64);
-		clksel_aip = AIP_CLKSEL_AIP(1);
-		/* ACLK */
-		clksel_fs = AIP_CLKSEL_FS(0);
+		reg_write(priv, REG_MUX_AP, MUX_AP_SELECT_I2S);
+		clksel_aip = AIP_CLKSEL_AIP_I2S;
+		clksel_fs = AIP_CLKSEL_FS_ACLK;
 		cts_n = CTS_N_M(3) | CTS_N_K(3);
 		ca_i2s = CA_I2S_CA_I2S(0);
 		break;
-- 
1.9.rc1

  parent reply	other threads:[~2014-01-29  9:25 UTC|newest]

Thread overview: 103+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-29  9:01 [PATCH v5 00/23] Jean-Francois Moine
2014-01-29  9:01 ` Jean-Francois Moine
2014-01-29  9:01 ` Jean-Francois Moine
2014-01-25 17:14 ` [PATCH v5 23/23] drm/i2c: tda998x: adjust the audio clock divider for S/PDIF Jean-Francois Moine
2014-01-25 17:14   ` Jean-Francois Moine
2014-01-25 17:14 ` [PATCH v5 17/23] drm/i2c: tda998x: set the PLL division factor in range 0..3 Jean-Francois Moine
2014-01-25 17:14   ` Jean-Francois Moine
2014-01-25 17:14   ` Jean-Francois Moine
2014-01-29 15:16   ` Joe Perches
2014-01-29 15:16     ` Joe Perches
2014-01-25 17:14 ` [PATCH v5 16/23] drm/i2c: tda998x: fix the ENABLE_SPACE register Jean-Francois Moine
2014-01-25 17:14   ` Jean-Francois Moine
2014-01-25 17:14 ` [PATCH v5 15/23] drm/i2c: tda998x: add DT documentation Jean-Francois Moine
2014-01-25 17:14   ` Jean-Francois Moine
2014-01-25 17:14 ` [PATCH v5 13/23] drm/i2c: tda998x: always enable EDID read IRQ Jean-Francois Moine
2014-01-25 17:14   ` Jean-Francois Moine
2014-01-25 17:14 ` [PATCH v5 14/23] drm/i2c: tda998x: use irq for connection status and EDID read Jean-Francois Moine
2014-01-25 17:14   ` Jean-Francois Moine
2014-01-25 17:14 ` [PATCH v5 22/23] drm/i2c: tda998x: code optimization Jean-Francois Moine
2014-01-25 17:14   ` Jean-Francois Moine
2014-01-25 17:14 ` [PATCH v5 21/23] drm/i2c: tda998x: change the frequence in the audio channel Jean-Francois Moine
2014-01-25 17:14   ` Jean-Francois Moine
2014-01-25 17:14 ` [PATCH v5 20/23] drm/i2c: tda998x: add the active aspect in HDMI AVI frame Jean-Francois Moine
2014-01-25 17:14   ` Jean-Francois Moine
2014-01-25 17:14   ` Jean-Francois Moine
2014-01-25 17:14 ` Jean-Francois Moine [this message]
2014-01-25 17:14   ` [PATCH v5 18/23] drm/i2c: tda998x: make the audio code more readable Jean-Francois Moine
2014-01-25 17:14 ` [PATCH v5 19/23] drm/i2c: tda998x: remove the unused variable ca_i2s Jean-Francois Moine
2014-01-25 17:14   ` Jean-Francois Moine
2014-01-25 17:14   ` Jean-Francois Moine
2014-01-25 17:14 ` [PATCH v5 08/23] drm/i2c: tda998x: use HDMI constants Jean-Francois Moine
2014-01-25 17:14   ` Jean-Francois Moine
2014-01-25 17:14   ` Jean-Francois Moine
2014-01-25 17:14 ` [PATCH v5 12/23] drm/i2c: tda998x: add DT support Jean-Francois Moine
2014-01-25 17:14   ` Jean-Francois Moine
2014-01-25 17:14   ` Jean-Francois Moine
2014-01-25 17:14 ` [PATCH v5 09/23] drm/i2c: tda998x: don't read write-only registers Jean-Francois Moine
2014-01-25 17:14   ` Jean-Francois Moine
2014-01-25 17:14   ` Jean-Francois Moine
2014-02-02 16:23   ` Russell King - ARM Linux
2014-02-02 16:23     ` Russell King - ARM Linux
2014-02-02 17:45     ` Jean-Francois Moine
2014-02-02 17:45       ` Jean-Francois Moine
2014-02-02 17:45       ` Jean-Francois Moine
2014-02-02 17:57       ` Russell King - ARM Linux
2014-02-02 17:57         ` Russell King - ARM Linux
2014-01-25 17:14 ` [PATCH v5 10/23] drm/i2c: tda998x: free the CEC device on encoder_destroy Jean-Francois Moine
2014-01-25 17:14   ` Jean-Francois Moine
2014-01-25 17:14   ` Jean-Francois Moine
2014-01-25 17:14 ` [PATCH v5 11/23] drm/i2c: tda998x: check the CEC device creation Jean-Francois Moine
2014-01-25 17:14   ` Jean-Francois Moine
2014-01-25 17:14   ` Jean-Francois Moine
2014-01-25 17:14 ` [PATCH v5 07/23] drm/i2c: tda998x: fix bad value in the AIF Jean-Francois Moine
2014-01-25 17:14   ` Jean-Francois Moine
2014-01-25 17:14 ` [PATCH v5 05/23] drm/i2c: tda998x: don't freeze the system at audio startup time Jean-Francois Moine
2014-01-25 17:14   ` Jean-Francois Moine
2014-01-25 17:14   ` Jean-Francois Moine
2014-01-25 17:14 ` [PATCH v5 02/23] drm/i2c: tda998x: check more I/O errors Jean-Francois Moine
2014-01-25 17:14   ` Jean-Francois Moine
2014-01-25 17:14   ` Jean-Francois Moine
2014-02-02 16:20   ` Russell King - ARM Linux
2014-02-02 16:20     ` Russell King - ARM Linux
2014-02-02 17:30     ` Jean-Francois Moine
2014-02-02 17:30       ` Jean-Francois Moine
2014-02-02 17:30       ` Jean-Francois Moine
2014-02-02 17:56       ` Russell King - ARM Linux
2014-02-02 17:56         ` Russell King - ARM Linux
2014-01-25 17:14 ` [PATCH v5 06/23] drm/i2c: tda998x: force the page register at startup time Jean-Francois Moine
2014-01-25 17:14   ` Jean-Francois Moine
2014-01-25 17:14   ` Jean-Francois Moine
2014-01-25 17:14 ` [PATCH v5 03/23] drm/i2c: tda998x: code cleanup Jean-Francois Moine
2014-01-25 17:14   ` Jean-Francois Moine
2014-01-25 17:14 ` [PATCH v5 04/23] drm/i2c: tda998x: change probe message origin Jean-Francois Moine
2014-01-25 17:14   ` Jean-Francois Moine
2014-01-25 17:14   ` Jean-Francois Moine
2014-01-25 17:14 ` [PATCH v5 01/23] drm/i2c: tda998x: simplify the i2c read/write functions Jean-Francois Moine
2014-01-25 17:14   ` Jean-Francois Moine
2014-01-25 17:14   ` Jean-Francois Moine
2014-02-02 12:43 ` [PATCH v5 00/23] Russell King - ARM Linux
2014-02-02 12:43   ` Russell King - ARM Linux
2014-02-02 12:43   ` Russell King - ARM Linux
2014-02-02 18:04   ` Russell King - ARM Linux
2014-02-02 18:04     ` Russell King - ARM Linux
2014-02-02 19:00     ` Jean-Francois Moine
2014-02-02 19:00       ` Jean-Francois Moine
2014-02-02 19:00       ` Jean-Francois Moine
2014-02-02 18:06   ` Jean-Francois Moine
2014-02-02 18:06     ` Jean-Francois Moine
2014-02-02 18:23     ` Russell King - ARM Linux
2014-02-02 18:23       ` Russell King - ARM Linux
2014-02-02 18:23       ` Russell King - ARM Linux
2014-02-02 18:41       ` Sebastian Hesselbarth
2014-02-02 18:41         ` Sebastian Hesselbarth
2014-02-02 18:54       ` Jean-Francois Moine
2014-02-02 18:54         ` Jean-Francois Moine
2014-02-02 18:54         ` Jean-Francois Moine
2014-02-02 19:15         ` Russell King - ARM Linux
2014-02-02 19:15           ` Russell King - ARM Linux
2014-02-02 20:07           ` Jean-Francois Moine
2014-02-02 20:07             ` Jean-Francois Moine
2014-02-02 20:07             ` Jean-Francois Moine
2014-02-03 12:46     ` Mark Brown
2014-02-03 12:46       ` Mark Brown

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=7dca56216f9df5495b77d463e52a0a67bac69fe7.1390986083.git.moinejf@free.fr \
    --to=moinejf@free.fr \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=robdclark@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.