Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1274618
| From | Michael Trimarchi <michael@amarulasolutions.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [alsa-devel] [PATCH 2/4] sound: codecs: pcm1792a: add define for register |
| Date | 2015-11-21 10:40 +0100 |
| Message-ID | <qxcOd-3oU-3@gated-at.bofh.it> (permalink) |
| References | <qwQNI-5O7-5@gated-at.bofh.it> <qwQNI-5O7-25@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Hi
On Fri, Nov 20, 2015 at 11:09 AM, Raphael Poggi <poggi.raph@gmail.com> wrote:
> 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)
> +
Can you just add what you use? and give an order on those defines?
What is register, what is mask, what is 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)
This function should be update too
Michael
> --
> 2.1.0
>
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
--
| Michael Nazzareno Trimarchi Amarula Solutions BV |
| COO - Founder Cruquiuskade 47 |
| +31(0)851119172 Amsterdam 1018 AM NL |
| [`as] http://www.amarulasolutions.com |
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/4] New feature and clean up for pcm1792a driver Raphael Poggi <poggi.raph@gmail.com> - 2015-11-20 11:10 +0100
[PATCH 2/4] sound: codecs: pcm1792a: add define for register Raphael Poggi <poggi.raph@gmail.com> - 2015-11-20 11:10 +0100
Re: [alsa-devel] [PATCH 2/4] sound: codecs: pcm1792a: add define for register Michael Trimarchi <michael@amarulasolutions.com> - 2015-11-21 10:40 +0100
[PATCH 1/4] sound: codecs: pcm1792a: clean function exit Raphael Poggi <poggi.raph@gmail.com> - 2015-11-20 11:20 +0100
Re: [alsa-devel] [PATCH 1/4] sound: codecs: pcm1792a: clean function exit Michael Trimarchi <michael@amarulasolutions.com> - 2015-11-21 10:40 +0100
Re: [alsa-devel] [PATCH 1/4] sound: codecs: pcm1792a: clean function exit Raphaël Poggi <poggi.raph@gmail.com> - 2015-11-21 17:20 +0100
Re: [alsa-devel] [PATCH 1/4] sound: codecs: pcm1792a: clean function exit Michael Trimarchi <michael@amarulasolutions.com> - 2015-11-21 17:40 +0100
[PATCH 3/4] dt-bindings: sound: add binding for pcm1792a Raphael Poggi <poggi.raph@gmail.com> - 2015-11-20 11:20 +0100
Re: [PATCH 3/4] dt-bindings: sound: add binding for pcm1792a Rob Herring <robh@kernel.org> - 2015-11-20 15:50 +0100
Re: [alsa-devel] [PATCH 3/4] dt-bindings: sound: add binding for pcm1792a Michael Trimarchi <michael@amarulasolutions.com> - 2015-11-20 16:10 +0100
[PATCH 4/4] sound: codecs: pcm1792a: introduce channel side Raphael Poggi <poggi.raph@gmail.com> - 2015-11-20 11:20 +0100
Re: [alsa-devel] [PATCH 4/4] sound: codecs: pcm1792a: introduce channel side Michael Trimarchi <michael@amarulasolutions.com> - 2015-11-21 10:40 +0100
Re: [alsa-devel] [PATCH 4/4] sound: codecs: pcm1792a: introduce channel side Michael Trimarchi <michael@amarulasolutions.com> - 2015-11-24 09:30 +0100
Re: [alsa-devel] [PATCH 4/4] sound: codecs: pcm1792a: introduce channel side Raphaël Poggi <poggi.raph@gmail.com> - 2015-11-24 17:10 +0100
Re: [alsa-devel] [PATCH 4/4] sound: codecs: pcm1792a: introduce channel side Michael Trimarchi <michael@amarulasolutions.com> - 2015-11-24 21:20 +0100
Re: [alsa-devel] [PATCH 4/4] sound: codecs: pcm1792a: introduce channel side Raphaël Poggi <poggi.raph@gmail.com> - 2015-11-24 09:30 +0100
csiph-web