diff mbox

[1/7] ASoC: rt5677: add GPIO helper macros

Message ID 1433200158-6890-1-git-send-email-vz@mleia.com (mailing list archive)
State New, archived
Headers show

Commit Message

Vladimir Zapolskiy June 1, 2015, 11:09 p.m. UTC
Add generic macro definitions for GPIO[1-5] direction and value
register bits, argument is RT5677_GPIOn.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Cc: Bard Liao <bardliao@realtek.com>
Cc: Oder Chiou <oder_chiou@realtek.com>
---
 sound/soc/codecs/rt5677.h | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Takashi Iwai June 2, 2015, 5:23 a.m. UTC | #1
At Tue,  2 Jun 2015 02:09:12 +0300,
Vladimir Zapolskiy wrote:
> 
> Add generic macro definitions for GPIO[1-5] direction and value
> register bits, argument is RT5677_GPIOn.
> 
> Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
> Cc: Bard Liao <bardliao@realtek.com>
> Cc: Oder Chiou <oder_chiou@realtek.com>
> ---
>  sound/soc/codecs/rt5677.h | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/sound/soc/codecs/rt5677.h b/sound/soc/codecs/rt5677.h
> index 7eca38a..5b84255 100644
> --- a/sound/soc/codecs/rt5677.h
> +++ b/sound/soc/codecs/rt5677.h
> @@ -1622,6 +1622,12 @@
>  #define RT5677_GPIO1_P_NOR			(0x0 << 0)
>  #define RT5677_GPIO1_P_INV			(0x1 << 0)
>  
> +#define RT5677_GPIO_DIR_OUT_MASK(n)		(0x3 << (n * 3 + 1))
> +#define RT5677_GPIO_DIR_MASK(n)			(0x1 << (n * 3 + 2))
> +#define RT5677_GPIO_DIR_OUT(n)			(0x1 << (n * 3 + 2))
> +#define RT5677_GPIO_OUT_MASK(n)			(0x1 << (n * 3 + 1))
> +#define RT5677_GPIO_OUT_HI(n)			(0x1 << (n * 3 + 1))

Put parentheses around n in expansion.


thanks,

Takashi
diff mbox

Patch

diff --git a/sound/soc/codecs/rt5677.h b/sound/soc/codecs/rt5677.h
index 7eca38a..5b84255 100644
--- a/sound/soc/codecs/rt5677.h
+++ b/sound/soc/codecs/rt5677.h
@@ -1622,6 +1622,12 @@ 
 #define RT5677_GPIO1_P_NOR			(0x0 << 0)
 #define RT5677_GPIO1_P_INV			(0x1 << 0)
 
+#define RT5677_GPIO_DIR_OUT_MASK(n)		(0x3 << (n * 3 + 1))
+#define RT5677_GPIO_DIR_MASK(n)			(0x1 << (n * 3 + 2))
+#define RT5677_GPIO_DIR_OUT(n)			(0x1 << (n * 3 + 2))
+#define RT5677_GPIO_OUT_MASK(n)			(0x1 << (n * 3 + 1))
+#define RT5677_GPIO_OUT_HI(n)			(0x1 << (n * 3 + 1))
+
 /* GPIO Control 3 (0xc2) */
 #define RT5677_GPIO6_DIR_MASK			(0x1 << 2)
 #define RT5677_GPIO6_DIR_SFT			2