alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Raphael Poggi <poggi.raph@gmail.com>
To: perex@perex.cz, tiwai@suse.com
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	alsa-devel@alsa-project.org, Raphael Poggi <poggi.raph@gmail.com>
Subject: [PATCH 2/4] sound: codecs: pcm1792a: add define for register
Date: Fri, 20 Nov 2015 11:09:15 +0100	[thread overview]
Message-ID: <1448014157-36526-3-git-send-email-raphael.poggi@avalun.com> (raw)
In-Reply-To: <1448014157-36526-1-git-send-email-raphael.poggi@avalun.com>

From: Raphael Poggi <poggi.raph@gmail.com>

Use define for register instead of number, when it is possible.
Doing this, make easier to read and use in the code.

Signed-off-by: Raphael Poggi <poggi.raph@gmail.com>
---
 sound/soc/codecs/pcm1792a.c | 47 +++++++++++++++++++++++++++------------------
 1 file changed, 28 insertions(+), 19 deletions(-)

diff --git a/sound/soc/codecs/pcm1792a.c b/sound/soc/codecs/pcm1792a.c
index cf42b24..febaa48 100644
--- a/sound/soc/codecs/pcm1792a.c
+++ b/sound/soc/codecs/pcm1792a.c
@@ -33,27 +33,36 @@
 
 #include "pcm1792a.h"
 
-#define PCM1792A_DAC_VOL_LEFT	0x10
-#define PCM1792A_DAC_VOL_RIGHT	0x11
-#define PCM1792A_FMT_CONTROL	0x12
-#define PCM1792A_MODE_CONTROL	0x13
-#define PCM1792A_SOFT_MUTE	PCM1792A_FMT_CONTROL
-
-#define PCM1792A_FMT_MASK	0x70
-#define PCM1792A_FMT_SHIFT	4
-#define PCM1792A_MUTE_MASK	0x01
-#define PCM1792A_MUTE_SHIFT	0
-#define PCM1792A_ATLD_ENABLE	(1 << 7)
+#define PCM1792A_DAC_VOL_LEFT		0x10
+#define PCM1792A_DAC_VOL_RIGHT		0x11
+#define PCM1792A_FMT_CONTROL		0x12
+#define PCM1792A_MODE_CONTROL		0x13
+#define PCM1792A_ZERO_OUTPUT		0x15
+#define PCM1792A_SOFT_MUTE		PCM1792A_FMT_CONTROL
+#define PCM1792A_ZERO_FLAG		0x16
+#define PCM1792A_DEVICE_ID		0x17
+
+#define PCM1792A_CHANNEL		0x14
+#define PCM1792A_CHANNEL_MONO_MASK	0x8
+#define PCM1792A_CHANNEL_MONO_SHIFT	0x8
+#define PCM1792A_CHANNEL_MONO_LEFT	(0x0 << PCM1792A_CHANNEL_MONO_SHIFT)
+#define PCM1792A_CHANNEL_MONO_RIGHT	(0x1 << PCM1792A_CHANNEL_MONO_SHIFT)
+
+#define PCM1792A_FMT_MASK		0x70
+#define PCM1792A_FMT_SHIFT		4
+#define PCM1792A_MUTE_MASK		0x01
+#define PCM1792A_MUTE_SHIFT		0
+#define PCM1792A_ATLD_ENABLE		(1 << 7)
 
 static const struct reg_default pcm1792a_reg_defaults[] = {
-	{ 0x10, 0xff },
-	{ 0x11, 0xff },
-	{ 0x12, 0x50 },
-	{ 0x13, 0x00 },
-	{ 0x14, 0x00 },
-	{ 0x15, 0x01 },
-	{ 0x16, 0x00 },
-	{ 0x17, 0x00 },
+	{ PCM1792A_DAC_VOL_LEFT, 0xff },
+	{ PCM1792A_DAC_VOL_RIGHT, 0xff },
+	{ PCM1792A_FMT_CONTROL, 0x50 },
+	{ PCM1792A_MODE_CONTROL, 0x00 },
+	{ PCM1792A_CHANNEL, 0x00 },
+	{ PCM1792A_ZERO_OUTPUT, 0x01 },
+	{ PCM1792A_ZERO_FLAG, 0x00 },
+	{ PCM1792A_DEVICE_ID, 0x00 },
 };
 
 static bool pcm1792a_accessible_reg(struct device *dev, unsigned int reg)
-- 
2.1.0

  reply	other threads:[~2015-11-20 10:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-20 10:09 [PATCH 0/4] New feature and clean up for pcm1792a driver Raphael Poggi
2015-11-20 10:09 ` Raphael Poggi [this message]
2015-11-21  9:36   ` [alsa-devel] [PATCH 2/4] sound: codecs: pcm1792a: add define for register Michael Trimarchi
     [not found] ` <1448014157-36526-1-git-send-email-raphael.poggi-jXdF5569nj7QT0dZR+AlfA@public.gmane.org>
2015-11-20 10:09   ` [PATCH 1/4] sound: codecs: pcm1792a: clean function exit Raphael Poggi
     [not found]     ` <1448014157-36526-2-git-send-email-raphael.poggi-jXdF5569nj7QT0dZR+AlfA@public.gmane.org>
2015-11-21  9:31       ` [alsa-devel] " Michael Trimarchi
2015-11-21 16:16         ` Raphaël Poggi
2015-11-21 16:33           ` Michael Trimarchi
2015-11-20 10:09   ` [PATCH 3/4] dt-bindings: sound: add binding for pcm1792a Raphael Poggi
2015-11-20 14:42     ` Rob Herring
2015-11-20 15:04       ` Michael Trimarchi
2015-11-20 10:09 ` [PATCH 4/4] sound: codecs: pcm1792a: introduce channel side Raphael Poggi
     [not found]   ` <1448014157-36526-5-git-send-email-raphael.poggi-jXdF5569nj7QT0dZR+AlfA@public.gmane.org>
2015-11-21  9:37     ` [alsa-devel] " Michael Trimarchi
2015-11-24  8:21       ` Raphaël Poggi
2015-11-24  8:27         ` Michael Trimarchi
     [not found]           ` <CAOf5uwmdwcdbxx2b6DvMeOJBahkZ3iiosWtHPD2zhxcDqO2b_A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-11-24 16:04             ` Raphaël Poggi
2015-11-24 20:10               ` Michael Trimarchi

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=1448014157-36526-3-git-send-email-raphael.poggi@avalun.com \
    --to=poggi.raph@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).