Merge tag 'gpio-v3.13-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw...
[linux-drm-fsl-dcu.git] / include / linux / gpio.h
index b8d0e53a802f0eacadcd44f4f3fba8ec1163eda5..13dfd24d01abc0d156e9cfa553f6b41aac96cb5f 100644 (file)
 #define GPIOF_OUT_INIT_LOW     (GPIOF_DIR_OUT | GPIOF_INIT_LOW)
 #define GPIOF_OUT_INIT_HIGH    (GPIOF_DIR_OUT | GPIOF_INIT_HIGH)
 
+/* Gpio pin is active-low */
+#define GPIOF_ACTIVE_LOW        (1 << 2)
+
 /* Gpio pin is open drain */
-#define GPIOF_OPEN_DRAIN       (1 << 2)
+#define GPIOF_OPEN_DRAIN       (1 << 3)
 
 /* Gpio pin is open source */
-#define GPIOF_OPEN_SOURCE      (1 << 3)
+#define GPIOF_OPEN_SOURCE      (1 << 4)
 
-#define GPIOF_EXPORT           (1 << 4)
-#define GPIOF_EXPORT_CHANGEABLE        (1 << 5)
+#define GPIOF_EXPORT           (1 << 5)
+#define GPIOF_EXPORT_CHANGEABLE        (1 << 6)
 #define GPIOF_EXPORT_DIR_FIXED (GPIOF_EXPORT)
 #define GPIOF_EXPORT_DIR_CHANGEABLE (GPIOF_EXPORT | GPIOF_EXPORT_CHANGEABLE)
 
@@ -74,6 +77,15 @@ static inline int irq_to_gpio(unsigned int irq)
 
 #endif /* ! CONFIG_ARCH_HAVE_CUSTOM_GPIO_H */
 
+/* CONFIG_GPIOLIB: bindings for managed devices that want to request gpios */
+
+struct device;
+
+int devm_gpio_request(struct device *dev, unsigned gpio, const char *label);
+int devm_gpio_request_one(struct device *dev, unsigned gpio,
+                         unsigned long flags, const char *label);
+void devm_gpio_free(struct device *dev, unsigned int gpio);
+
 #else /* ! CONFIG_GPIOLIB */
 
 #include <linux/kernel.h>
@@ -205,6 +217,18 @@ static inline int gpio_to_irq(unsigned gpio)
        return -EINVAL;
 }
 
+static inline int gpio_lock_as_irq(struct gpio_chip *chip, unsigned int offset)
+{
+       WARN_ON(1);
+       return -EINVAL;
+}
+
+static inline void gpio_unlock_as_irq(struct gpio_chip *chip,
+                                     unsigned int offset)
+{
+       WARN_ON(1);
+}
+
 static inline int irq_to_gpio(unsigned irq)
 {
        /* irq can never have been returned from gpio_to_irq() */
@@ -236,14 +260,25 @@ gpiochip_remove_pin_ranges(struct gpio_chip *chip)
        WARN_ON(1);
 }
 
-#endif /* ! CONFIG_GPIOLIB */
+static inline int devm_gpio_request(struct device *dev, unsigned gpio,
+                                   const char *label)
+{
+       WARN_ON(1);
+       return -EINVAL;
+}
 
-struct device;
+static inline int devm_gpio_request_one(struct device *dev, unsigned gpio,
+                                       unsigned long flags, const char *label)
+{
+       WARN_ON(1);
+       return -EINVAL;
+}
 
-/* bindings for managed devices that want to request gpios */
-int devm_gpio_request(struct device *dev, unsigned gpio, const char *label);
-int devm_gpio_request_one(struct device *dev, unsigned gpio,
-                         unsigned long flags, const char *label);
-void devm_gpio_free(struct device *dev, unsigned int gpio);
+static inline void devm_gpio_free(struct device *dev, unsigned int gpio)
+{
+       WARN_ON(1);
+}
+
+#endif /* ! CONFIG_GPIOLIB */
 
 #endif /* __LINUX_GPIO_H */