include/linux/gpio/consumer.h
Source file repositories/reference/linux-study-clean/include/linux/gpio/consumer.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/gpio/consumer.h- Extension
.h- Size
- 21263 bytes
- Lines
- 753
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bits.hlinux/err.hlinux/types.hdefs.hlinux/bug.hlinux/kernel.h
Detected Declarations
struct acpi_devicestruct devicestruct fwnode_handlestruct gpio_arraystruct gpio_descstruct gpio_descsstruct acpi_gpio_paramsstruct acpi_gpio_mappingenum gpiod_flagsfunction gpiod_countfunction gpiod_getfunction gpiod_get_indexfunction gpiod_get_optionalfunction gpiod_get_index_optionalfunction gpiod_get_arrayfunction gpiod_get_array_optionalfunction gpiod_putfunction devm_gpiod_unhingefunction gpiod_put_arrayfunction devm_gpiod_getfunction devm_gpiod_get_indexfunction devm_gpiod_get_optionalfunction devm_gpiod_get_index_optionalfunction devm_gpiod_get_arrayfunction devm_gpiod_get_array_optionalfunction devm_gpiod_putfunction devm_gpiod_put_arrayfunction gpiod_get_directionfunction gpiod_is_single_endedfunction gpiod_direction_inputfunction gpiod_direction_outputfunction gpiod_direction_output_rawfunction gpiod_get_valuefunction gpiod_get_array_valuefunction gpiod_set_valuefunction gpiod_set_array_valuefunction gpiod_get_raw_valuefunction gpiod_get_raw_array_valuefunction gpiod_set_raw_valuefunction gpiod_set_raw_array_valuefunction gpiod_get_value_cansleepfunction gpiod_get_array_value_cansleepfunction gpiod_set_value_cansleepfunction gpiod_set_array_value_cansleepfunction gpiod_get_raw_value_cansleepfunction gpiod_get_raw_array_value_cansleepfunction gpiod_set_raw_value_cansleepfunction gpiod_set_raw_array_value_cansleep
Annotated Snippet
struct gpio_descs {
struct gpio_array *info;
unsigned int ndescs;
struct gpio_desc *desc[];
};
#define GPIOD_FLAGS_BIT_DIR_SET BIT(0)
#define GPIOD_FLAGS_BIT_DIR_OUT BIT(1)
#define GPIOD_FLAGS_BIT_DIR_VAL BIT(2)
#define GPIOD_FLAGS_BIT_OPEN_DRAIN BIT(3)
/* GPIOD_FLAGS_BIT_NONEXCLUSIVE is DEPRECATED, don't use in new code. */
#define GPIOD_FLAGS_BIT_NONEXCLUSIVE BIT(4)
/**
* enum gpiod_flags - Optional flags that can be passed to one of gpiod_* to
* configure direction and output value. These values
* cannot be OR'd.
*
* @GPIOD_ASIS: Don't change anything
* @GPIOD_IN: Set lines to input mode
* @GPIOD_OUT_LOW: Set lines to output and drive them low
* @GPIOD_OUT_HIGH: Set lines to output and drive them high
* @GPIOD_OUT_LOW_OPEN_DRAIN: Set lines to open-drain output and drive them low
* @GPIOD_OUT_HIGH_OPEN_DRAIN: Set lines to open-drain output and drive them high
*/
enum gpiod_flags {
GPIOD_ASIS = 0,
GPIOD_IN = GPIOD_FLAGS_BIT_DIR_SET,
GPIOD_OUT_LOW = GPIOD_FLAGS_BIT_DIR_SET | GPIOD_FLAGS_BIT_DIR_OUT,
GPIOD_OUT_HIGH = GPIOD_FLAGS_BIT_DIR_SET | GPIOD_FLAGS_BIT_DIR_OUT |
GPIOD_FLAGS_BIT_DIR_VAL,
GPIOD_OUT_LOW_OPEN_DRAIN = GPIOD_OUT_LOW | GPIOD_FLAGS_BIT_OPEN_DRAIN,
GPIOD_OUT_HIGH_OPEN_DRAIN = GPIOD_OUT_HIGH | GPIOD_FLAGS_BIT_OPEN_DRAIN,
};
#ifdef CONFIG_GPIOLIB
/* Return the number of GPIOs associated with a device / function */
int gpiod_count(struct device *dev, const char *con_id);
/* Acquire and dispose GPIOs */
struct gpio_desc *__must_check gpiod_get(struct device *dev,
const char *con_id,
enum gpiod_flags flags);
struct gpio_desc *__must_check gpiod_get_index(struct device *dev,
const char *con_id,
unsigned int idx,
enum gpiod_flags flags);
struct gpio_desc *__must_check gpiod_get_optional(struct device *dev,
const char *con_id,
enum gpiod_flags flags);
struct gpio_desc *__must_check gpiod_get_index_optional(struct device *dev,
const char *con_id,
unsigned int index,
enum gpiod_flags flags);
struct gpio_descs *__must_check gpiod_get_array(struct device *dev,
const char *con_id,
enum gpiod_flags flags);
struct gpio_descs *__must_check gpiod_get_array_optional(struct device *dev,
const char *con_id,
enum gpiod_flags flags);
void gpiod_put(struct gpio_desc *desc);
void gpiod_put_array(struct gpio_descs *descs);
struct gpio_desc *__must_check devm_gpiod_get(struct device *dev,
const char *con_id,
enum gpiod_flags flags);
struct gpio_desc *__must_check devm_gpiod_get_index(struct device *dev,
const char *con_id,
unsigned int idx,
enum gpiod_flags flags);
struct gpio_desc *__must_check devm_gpiod_get_optional(struct device *dev,
const char *con_id,
enum gpiod_flags flags);
struct gpio_desc *__must_check
devm_gpiod_get_index_optional(struct device *dev, const char *con_id,
unsigned int index, enum gpiod_flags flags);
struct gpio_descs *__must_check devm_gpiod_get_array(struct device *dev,
const char *con_id,
enum gpiod_flags flags);
struct gpio_descs *__must_check
devm_gpiod_get_array_optional(struct device *dev, const char *con_id,
enum gpiod_flags flags);
void devm_gpiod_put(struct device *dev, struct gpio_desc *desc);
void devm_gpiod_unhinge(struct device *dev, struct gpio_desc *desc);
void devm_gpiod_put_array(struct device *dev, struct gpio_descs *descs);
int gpiod_get_direction(struct gpio_desc *desc);
bool gpiod_is_single_ended(struct gpio_desc *desc);
int gpiod_direction_input(struct gpio_desc *desc);
Annotation
- Immediate include surface: `linux/bits.h`, `linux/err.h`, `linux/types.h`, `defs.h`, `linux/bug.h`, `linux/kernel.h`.
- Detected declarations: `struct acpi_device`, `struct device`, `struct fwnode_handle`, `struct gpio_array`, `struct gpio_desc`, `struct gpio_descs`, `struct acpi_gpio_params`, `struct acpi_gpio_mapping`, `enum gpiod_flags`, `function gpiod_count`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.