summaryrefslogtreecommitdiff
path: root/include/gpio.h
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2019-03-11 15:57:52 -0700
committerchrome-bot <chrome-bot@chromium.org>2019-03-26 04:42:55 -0700
commitbb266fc26fc05d4ab22de6ad7bce5b477c9f9140 (patch)
treef6ada087f62246c3a9547e649ac8846b0ed6d5ab /include/gpio.h
parent0bfc511527cf2aebfa163c63a1d028419ca0b0c3 (diff)
downloadchrome-ec-bb266fc26fc05d4ab22de6ad7bce5b477c9f9140.tar.gz
common: replace 1 << digits, with BIT(digits)
Requested for linux integration, use BIT instead of 1 << First step replace bit operation with operand containing only digits. Fix an error in motion_lid try to set bit 31 of a signed integer. BUG=None BRANCH=None TEST=compile Change-Id: Ie843611f2f68e241f0f40d4067f7ade726951d29 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1518659 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'include/gpio.h')
-rw-r--r--include/gpio.h40
1 files changed, 20 insertions, 20 deletions
diff --git a/include/gpio.h b/include/gpio.h
index 1c80f7e32d..f01cd5147e 100644
--- a/include/gpio.h
+++ b/include/gpio.h
@@ -12,29 +12,29 @@
/* Flag definitions for gpio_info and gpio_alt_func */
/* The following are valid for both gpio_info and gpio_alt_func: */
-#define GPIO_OPEN_DRAIN (1 << 0) /* Output type is open-drain */
-#define GPIO_PULL_UP (1 << 1) /* Enable on-chip pullup */
-#define GPIO_PULL_DOWN (1 << 2) /* Enable on-chip pulldown */
+#define GPIO_OPEN_DRAIN BIT(0) /* Output type is open-drain */
+#define GPIO_PULL_UP BIT(1) /* Enable on-chip pullup */
+#define GPIO_PULL_DOWN BIT(2) /* Enable on-chip pulldown */
/* The following are valid for gpio_alt_func only */
-#define GPIO_ANALOG (1 << 3) /* Set pin to analog-mode */
+#define GPIO_ANALOG BIT(3) /* Set pin to analog-mode */
/* The following are valid for gpio_info only */
-#define GPIO_INPUT (1 << 4) /* Input */
-#define GPIO_OUTPUT (1 << 5) /* Output */
-#define GPIO_LOW (1 << 6) /* If GPIO_OUTPUT, set level low */
-#define GPIO_HIGH (1 << 7) /* If GPIO_OUTPUT, set level high */
-#define GPIO_INT_F_RISING (1 << 8) /* Interrupt on rising edge */
-#define GPIO_INT_F_FALLING (1 << 9) /* Interrupt on falling edge */
-#define GPIO_INT_F_LOW (1 << 11) /* Interrupt on low level */
-#define GPIO_INT_F_HIGH (1 << 12) /* Interrupt on high level */
-#define GPIO_DEFAULT (1 << 13) /* Don't set up on boot */
-#define GPIO_INT_DSLEEP (1 << 14) /* Interrupt in deep sleep */
-#define GPIO_INT_SHARED (1 << 15) /* Shared among multiple pins */
-#define GPIO_SEL_1P8V (1 << 16) /* Support 1.8v */
-#define GPIO_ALTERNATE (1 << 17) /* GPIO used for alternate function. */
-#define GPIO_LOCKED (1 << 18) /* Lock GPIO output and configuration */
-#define GPIO_HIB_WAKE_HIGH (1 << 19) /* Hibernate wake on high level */
+#define GPIO_INPUT BIT(4) /* Input */
+#define GPIO_OUTPUT BIT(5) /* Output */
+#define GPIO_LOW BIT(6) /* If GPIO_OUTPUT, set level low */
+#define GPIO_HIGH BIT(7) /* If GPIO_OUTPUT, set level high */
+#define GPIO_INT_F_RISING BIT(8) /* Interrupt on rising edge */
+#define GPIO_INT_F_FALLING BIT(9) /* Interrupt on falling edge */
+#define GPIO_INT_F_LOW BIT(11) /* Interrupt on low level */
+#define GPIO_INT_F_HIGH BIT(12) /* Interrupt on high level */
+#define GPIO_DEFAULT BIT(13) /* Don't set up on boot */
+#define GPIO_INT_DSLEEP BIT(14) /* Interrupt in deep sleep */
+#define GPIO_INT_SHARED BIT(15) /* Shared among multiple pins */
+#define GPIO_SEL_1P8V BIT(16) /* Support 1.8v */
+#define GPIO_ALTERNATE BIT(17) /* GPIO used for alternate function. */
+#define GPIO_LOCKED BIT(18) /* Lock GPIO output and configuration */
+#define GPIO_HIB_WAKE_HIGH BIT(19) /* Hibernate wake on high level */
#ifdef CONFIG_GPIO_POWER_DOWN
-#define GPIO_POWER_DOWN (1 << 20) /* Pin and pad is powered off */
+#define GPIO_POWER_DOWN BIT(20) /* Pin and pad is powered off */
#endif
/* Common flag combinations */