cregit-Linux how code gets into the kernel

Release 4.16 include/linux/gpio.h

Directory: include/linux
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * <linux/gpio.h>
 *
 * This is the LEGACY GPIO bulk include file, including legacy APIs. It is
 * used for GPIO drivers still referencing the global GPIO numberspace,
 * and should not be included in new code.
 *
 * If you're implementing a GPIO driver, only include <linux/gpio/driver.h>
 * If you're implementing a GPIO consumer, only include <linux/gpio/consumer.h>
 */
#ifndef __LINUX_GPIO_H

#define __LINUX_GPIO_H

#include <linux/errno.h>

/* see Documentation/gpio/gpio-legacy.txt */

/* make these flag values available regardless of GPIO kconfig options */

#define GPIOF_DIR_OUT	(0 << 0)

#define GPIOF_DIR_IN	(1 << 0)


#define GPIOF_INIT_LOW	(0 << 1)

#define GPIOF_INIT_HIGH	(1 << 1)


#define GPIOF_IN		(GPIOF_DIR_IN)

#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 << 3)

/* Gpio pin is open source */

#define GPIOF_OPEN_SOURCE	(1 << 4)


#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)

/**
 * struct gpio - a structure describing a GPIO with configuration
 * @gpio:       the GPIO number
 * @flags:      GPIO configuration as specified by GPIOF_*
 * @label:      a literal description string of this GPIO
 */

struct gpio {
	
unsigned	gpio;
	
unsigned long	flags;
	
const char	*label;
};

#ifdef CONFIG_GPIOLIB

#ifdef CONFIG_ARCH_HAVE_CUSTOM_GPIO_H
#include <asm/gpio.h>
#else

#include <asm-generic/gpio.h>


static inline int gpio_get_value(unsigned int gpio) { return __gpio_get_value(gpio); }

Contributors

PersonTokensPropCommitsCommitProp
Mark Brown17100.00%1100.00%
Total17100.00%1100.00%


static inline void gpio_set_value(unsigned int gpio, int value) { __gpio_set_value(gpio, value); }

Contributors

PersonTokensPropCommitsCommitProp
Mark Brown21100.00%1100.00%
Total21100.00%1100.00%


static inline int gpio_cansleep(unsigned int gpio) { return __gpio_cansleep(gpio); }

Contributors

PersonTokensPropCommitsCommitProp
Mark Brown17100.00%1100.00%
Total17100.00%1100.00%


static inline int gpio_to_irq(unsigned int gpio) { return __gpio_to_irq(gpio); }

Contributors

PersonTokensPropCommitsCommitProp
Mark Brown17100.00%1100.00%
Total17100.00%1100.00%


static inline int irq_to_gpio(unsigned int irq) { return -EINVAL; }

Contributors

PersonTokensPropCommitsCommitProp
Mark Brown15100.00%1100.00%
Total15100.00%1100.00%

#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> #include <linux/types.h> #include <linux/bug.h> #include <linux/pinctrl/pinctrl.h> struct device; struct gpio_chip;
static inline bool gpio_is_valid(int number) { return false; }

Contributors

PersonTokensPropCommitsCommitProp
David Brownell1184.62%150.00%
Joe Perches215.38%150.00%
Total13100.00%2100.00%


static inline int gpio_request(unsigned gpio, const char *label) { return -ENOSYS; }

Contributors

PersonTokensPropCommitsCommitProp
David Brownell19100.00%1100.00%
Total19100.00%1100.00%


static inline int gpio_request_one(unsigned gpio, unsigned long flags, const char *label) { return -ENOSYS; }

Contributors

PersonTokensPropCommitsCommitProp
Wolfram Sang23100.00%1100.00%
Total23100.00%1100.00%


static inline int gpio_request_array(const struct gpio *array, size_t num) { return -ENOSYS; }

Contributors

PersonTokensPropCommitsCommitProp
Wolfram Sang1995.00%150.00%
Lars-Peter Clausen15.00%150.00%
Total20100.00%2100.00%


static inline void gpio_free(unsigned gpio) { might_sleep(); /* GPIO can never have been requested */ WARN_ON(1); }

Contributors

PersonTokensPropCommitsCommitProp
David Brownell1052.63%133.33%
Mark Brown631.58%133.33%
Uwe Kleine-König315.79%133.33%
Total19100.00%3100.00%


static inline void gpio_free_array(const struct gpio *array, size_t num) { might_sleep(); /* GPIO can never have been requested */ WARN_ON(1); }

Contributors

PersonTokensPropCommitsCommitProp
Wolfram Sang2496.00%150.00%
Lars-Peter Clausen14.00%150.00%
Total25100.00%2100.00%


static inline int gpio_direction_input(unsigned gpio) { return -ENOSYS; }

Contributors

PersonTokensPropCommitsCommitProp
David Brownell14100.00%1100.00%
Total14100.00%1100.00%


static inline int gpio_direction_output(unsigned gpio, int value) { return -ENOSYS; }

Contributors

PersonTokensPropCommitsCommitProp
David Brownell17100.00%1100.00%
Total17100.00%1100.00%


static inline int gpio_set_debounce(unsigned gpio, unsigned debounce) { return -ENOSYS; }

Contributors

PersonTokensPropCommitsCommitProp
Felipe Balbi17100.00%1100.00%
Total17100.00%1100.00%


static inline int gpio_get_value(unsigned gpio) { /* GPIO can never have been requested or set as {in,out}put */ WARN_ON(1); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
David Brownell19100.00%1100.00%
Total19100.00%1100.00%


static inline void gpio_set_value(unsigned gpio, int value) { /* GPIO can never have been requested or set as output */ WARN_ON(1); }

Contributors

PersonTokensPropCommitsCommitProp
David Brownell19100.00%1100.00%
Total19100.00%1100.00%


static inline int gpio_cansleep(unsigned gpio) { /* GPIO can never have been requested or set as {in,out}put */ WARN_ON(1); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
David Brownell19100.00%1100.00%
Total19100.00%1100.00%


static inline int gpio_get_value_cansleep(unsigned gpio) { /* GPIO can never have been requested or set as {in,out}put */ WARN_ON(1); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
David Brownell19100.00%1100.00%
Total19100.00%1100.00%


static inline void gpio_set_value_cansleep(unsigned gpio, int value) { /* GPIO can never have been requested or set as output */ WARN_ON(1); }

Contributors

PersonTokensPropCommitsCommitProp
David Brownell19100.00%1100.00%
Total19100.00%1100.00%


static inline int gpio_export(unsigned gpio, bool direction_may_change) { /* GPIO can never have been requested or set as {in,out}put */ WARN_ON(1); return -EINVAL; }

Contributors

PersonTokensPropCommitsCommitProp
David Brownell23100.00%1100.00%
Total23100.00%1100.00%


static inline int gpio_export_link(struct device *dev, const char *name, unsigned gpio) { /* GPIO can never have been exported */ WARN_ON(1); return -EINVAL; }

Contributors

PersonTokensPropCommitsCommitProp
Jani Nikula30100.00%1100.00%
Total30100.00%1100.00%


static inline void gpio_unexport(unsigned gpio) { /* GPIO can never have been exported */ WARN_ON(1); }

Contributors

PersonTokensPropCommitsCommitProp
David Brownell16100.00%1100.00%
Total16100.00%1100.00%


static inline int gpio_to_irq(unsigned gpio) { /* GPIO can never have been requested or set as input */ WARN_ON(1); return -EINVAL; }

Contributors

PersonTokensPropCommitsCommitProp
David Brownell20100.00%1100.00%
Total20100.00%1100.00%


static inline int gpiochip_lock_as_irq(struct gpio_chip *chip, unsigned int offset) { WARN_ON(1); return -EINVAL; }

Contributors

PersonTokensPropCommitsCommitProp
Linus Walleij2496.00%150.00%
Alexandre Courbot14.00%150.00%
Total25100.00%2100.00%


static inline void gpiochip_unlock_as_irq(struct gpio_chip *chip, unsigned int offset) { WARN_ON(1); }

Contributors

PersonTokensPropCommitsCommitProp
Linus Walleij2095.24%150.00%
Alexandre Courbot14.76%150.00%
Total21100.00%2100.00%


static inline int irq_to_gpio(unsigned irq) { /* irq can never have been returned from gpio_to_irq() */ WARN_ON(1); return -EINVAL; }

Contributors

PersonTokensPropCommitsCommitProp
David Brownell20100.00%1100.00%
Total20100.00%1100.00%


static inline int gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name, unsigned int gpio_offset, unsigned int pin_offset, unsigned int npins) { WARN_ON(1); return -EINVAL; }

Contributors

PersonTokensPropCommitsCommitProp
Linus Walleij1950.00%583.33%
Shiraz Hashim1950.00%116.67%
Total38100.00%6100.00%


static inline int gpiochip_add_pingroup_range(struct gpio_chip *chip, struct pinctrl_dev *pctldev, unsigned int gpio_offset, const char *pin_group) { WARN_ON(1); return -EINVAL; }

Contributors

PersonTokensPropCommitsCommitProp
Christian Ruppert3394.29%150.00%
Linus Walleij25.71%150.00%
Total35100.00%2100.00%


static inline void gpiochip_remove_pin_ranges(struct gpio_chip *chip) { WARN_ON(1); }

Contributors

PersonTokensPropCommitsCommitProp
Shiraz Hashim847.06%133.33%
Linus Walleij741.18%133.33%
Christian Ruppert211.76%133.33%
Total17100.00%3100.00%


static inline int devm_gpio_request(struct device *dev, unsigned gpio, const char *label) { WARN_ON(1); return -EINVAL; }

Contributors

PersonTokensPropCommitsCommitProp
Shawn Guo1655.17%150.00%
Linus Walleij1344.83%150.00%
Total29100.00%2100.00%


static inline int devm_gpio_request_one(struct device *dev, unsigned gpio, unsigned long flags, const char *label) { WARN_ON(1); return -EINVAL; }

Contributors

PersonTokensPropCommitsCommitProp
Shawn Guo2060.61%150.00%
Linus Walleij1339.39%150.00%
Total33100.00%2100.00%


static inline void devm_gpio_free(struct device *dev, unsigned int gpio) { WARN_ON(1); }

Contributors

PersonTokensPropCommitsCommitProp
Shawn Guo1257.14%150.00%
Linus Walleij942.86%150.00%
Total21100.00%2100.00%

#endif /* ! CONFIG_GPIOLIB */ #endif /* __LINUX_GPIO_H */

Overall Contributors

PersonTokensPropCommitsCommitProp
David Brownell26630.72%38.82%
Linus Walleij16719.28%823.53%
Mark Brown12414.32%38.82%
Wolfram Sang809.24%25.88%
Shawn Guo485.54%12.94%
Christian Ruppert384.39%12.94%
Jani Nikula333.81%12.94%
Randy Dunlap293.35%12.94%
Shiraz Hashim273.12%12.94%
Felipe Balbi171.96%12.94%
Alexandre Courbot131.50%38.82%
Laxman Dewangan80.92%25.88%
Uwe Kleine-König60.69%12.94%
Anton Vorontsov30.35%12.94%
Lars-Peter Clausen20.23%12.94%
Joe Perches20.23%12.94%
Richard Genoud10.12%12.94%
Paul Gortmaker10.12%12.94%
Greg Kroah-Hartman10.12%12.94%
Total866100.00%34100.00%
Directory: include/linux
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.