Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759602AbbKTKJq (ORCPT ); Fri, 20 Nov 2015 05:09:46 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:34743 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751454AbbKTKJl (ORCPT ); Fri, 20 Nov 2015 05:09:41 -0500 From: Raphael Poggi X-Google-Original-From: Raphael Poggi To: perex@perex.cz, tiwai@suse.com Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, Raphael Poggi Subject: [PATCH 2/4] sound: codecs: pcm1792a: add define for register Date: Fri, 20 Nov 2015 11:09:15 +0100 Message-Id: <1448014157-36526-3-git-send-email-raphael.poggi@avalun.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1448014157-36526-1-git-send-email-raphael.poggi@avalun.com> References: <1448014157-36526-1-git-send-email-raphael.poggi@avalun.com> X-Antivirus: avast! (VPS 151119-1, 19/11/2015), Outbound message X-Antivirus-Status: Clean Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2474 Lines: 78 From: Raphael Poggi 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 --- 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 -- 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/