/** * struct gpio_descs - Struct containing an array of descriptors that can be * obtained using gpiod_get_array() * * @info: Pointer to the opaque gpio_array structure * @ndescs: Number of held descriptors * @desc: Array of pointers to GPIO descriptors
*/ struct gpio_descs { struct gpio_array *info; unsignedint 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, constchar *con_id);
int gpiod_get_direction(struct gpio_desc *desc); int gpiod_direction_input(struct gpio_desc *desc); int gpiod_direction_output(struct gpio_desc *desc, int value); int gpiod_direction_output_raw(struct gpio_desc *desc, int value);
/* Value get/set from non-sleeping context */ int gpiod_get_value(conststruct gpio_desc *desc); int gpiod_get_array_value(unsignedint array_size, struct gpio_desc **desc_array, struct gpio_array *array_info, unsignedlong *value_bitmap); int gpiod_set_value(struct gpio_desc *desc, int value); int gpiod_set_array_value(unsignedint array_size, struct gpio_desc **desc_array, struct gpio_array *array_info, unsignedlong *value_bitmap); int gpiod_get_raw_value(conststruct gpio_desc *desc); int gpiod_get_raw_array_value(unsignedint array_size, struct gpio_desc **desc_array, struct gpio_array *array_info, unsignedlong *value_bitmap); int gpiod_set_raw_value(struct gpio_desc *desc, int value); int gpiod_set_raw_array_value(unsignedint array_size, struct gpio_desc **desc_array, struct gpio_array *array_info, unsignedlong *value_bitmap);
/* Value get/set from sleeping context */ int gpiod_get_value_cansleep(conststruct gpio_desc *desc); int gpiod_get_array_value_cansleep(unsignedint array_size, struct gpio_desc **desc_array, struct gpio_array *array_info, unsignedlong *value_bitmap); int gpiod_set_value_cansleep(struct gpio_desc *desc, int value); int gpiod_set_array_value_cansleep(unsignedint array_size, struct gpio_desc **desc_array, struct gpio_array *array_info, unsignedlong *value_bitmap); int gpiod_get_raw_value_cansleep(conststruct gpio_desc *desc); int gpiod_get_raw_array_value_cansleep(unsignedint array_size, struct gpio_desc **desc_array, struct gpio_array *array_info, unsignedlong *value_bitmap); int gpiod_set_raw_value_cansleep(struct gpio_desc *desc, int value); int gpiod_set_raw_array_value_cansleep(unsignedint array_size, struct gpio_desc **desc_array, struct gpio_array *array_info, unsignedlong *value_bitmap);
int gpiod_set_config(struct gpio_desc *desc, unsignedlong config); int gpiod_set_debounce(struct gpio_desc *desc, unsignedint debounce); void gpiod_toggle_active_low(struct gpio_desc *desc);
int gpiod_is_active_low(conststruct gpio_desc *desc); int gpiod_cansleep(conststruct gpio_desc *desc);
int gpiod_to_irq(conststruct gpio_desc *desc); int gpiod_set_consumer_name(struct gpio_desc *desc, constchar *name);
/* Convert between the old gpio_ and new gpiod_ interfaces */ struct gpio_desc *gpio_to_desc(unsigned gpio); int desc_to_gpio(conststruct gpio_desc *desc);
/* GPIO can never have been requested */
WARN_ON(descs);
}
staticinlineint gpiod_get_direction(conststruct gpio_desc *desc)
{ /* GPIO can never have been requested */
WARN_ON(desc); return -ENOSYS;
} staticinlineint gpiod_direction_input(struct gpio_desc *desc)
{ /* GPIO can never have been requested */
WARN_ON(desc); return -ENOSYS;
} staticinlineint gpiod_direction_output(struct gpio_desc *desc, int value)
{ /* GPIO can never have been requested */
WARN_ON(desc); return -ENOSYS;
} staticinlineint gpiod_direction_output_raw(struct gpio_desc *desc, int value)
{ /* GPIO can never have been requested */
WARN_ON(desc); return -ENOSYS;
} staticinlineint gpiod_get_value(conststruct gpio_desc *desc)
{ /* GPIO can never have been requested */
WARN_ON(desc); return 0;
} staticinlineint gpiod_get_array_value(unsignedint array_size, struct gpio_desc **desc_array, struct gpio_array *array_info, unsignedlong *value_bitmap)
{ /* GPIO can never have been requested */
WARN_ON(desc_array); return 0;
} staticinlineint gpiod_set_value(struct gpio_desc *desc, int value)
{ /* GPIO can never have been requested */
WARN_ON(desc); return 0;
} staticinlineint gpiod_set_array_value(unsignedint array_size, struct gpio_desc **desc_array, struct gpio_array *array_info, unsignedlong *value_bitmap)
{ /* GPIO can never have been requested */
WARN_ON(desc_array); return 0;
} staticinlineint gpiod_get_raw_value(conststruct gpio_desc *desc)
{ /* GPIO can never have been requested */
WARN_ON(desc); return 0;
} staticinlineint gpiod_get_raw_array_value(unsignedint array_size, struct gpio_desc **desc_array, struct gpio_array *array_info, unsignedlong *value_bitmap)
{ /* GPIO can never have been requested */
WARN_ON(desc_array); return 0;
} staticinlineint gpiod_set_raw_value(struct gpio_desc *desc, int value)
{ /* GPIO can never have been requested */
WARN_ON(desc); return 0;
} staticinlineint gpiod_set_raw_array_value(unsignedint array_size, struct gpio_desc **desc_array, struct gpio_array *array_info, unsignedlong *value_bitmap)
{ /* GPIO can never have been requested */
WARN_ON(desc_array); return 0;
}
staticinlineint gpiod_get_value_cansleep(conststruct gpio_desc *desc)
{ /* GPIO can never have been requested */
WARN_ON(desc); return 0;
} staticinlineint gpiod_get_array_value_cansleep(unsignedint array_size, struct gpio_desc **desc_array, struct gpio_array *array_info, unsignedlong *value_bitmap)
{ /* GPIO can never have been requested */
WARN_ON(desc_array); return 0;
} staticinlineint gpiod_set_value_cansleep(struct gpio_desc *desc, int value)
{ /* GPIO can never have been requested */
WARN_ON(desc); return 0;
} staticinlineint gpiod_set_array_value_cansleep(unsignedint array_size, struct gpio_desc **desc_array, struct gpio_array *array_info, unsignedlong *value_bitmap)
{ /* GPIO can never have been requested */
WARN_ON(desc_array); return 0;
} staticinlineint gpiod_get_raw_value_cansleep(conststruct gpio_desc *desc)
{ /* GPIO can never have been requested */
WARN_ON(desc); return 0;
} staticinlineint gpiod_get_raw_array_value_cansleep(unsignedint array_size, struct gpio_desc **desc_array, struct gpio_array *array_info, unsignedlong *value_bitmap)
{ /* GPIO can never have been requested */
WARN_ON(desc_array); return 0;
} staticinlineint gpiod_set_raw_value_cansleep(struct gpio_desc *desc, int value)
{ /* GPIO can never have been requested */
WARN_ON(desc); return 0;
} staticinlineint gpiod_set_raw_array_value_cansleep(unsignedint array_size, struct gpio_desc **desc_array, struct gpio_array *array_info, unsignedlong *value_bitmap)
{ /* GPIO can never have been requested */
WARN_ON(desc_array); return 0;
}
staticinlineint gpiod_set_config(struct gpio_desc *desc, unsignedlong config)
{ /* GPIO can never have been requested */
WARN_ON(desc); return -ENOSYS;
}
staticinlineint gpiod_set_debounce(struct gpio_desc *desc, unsignedint debounce)
{ /* GPIO can never have been requested */
WARN_ON(desc); return -ENOSYS;
}
staticinlinevoid gpiod_toggle_active_low(struct gpio_desc *desc)
{ /* GPIO can never have been requested */
WARN_ON(desc);
}
staticinlineint gpiod_is_active_low(conststruct gpio_desc *desc)
{ /* GPIO can never have been requested */
WARN_ON(desc); return 0;
} staticinlineint gpiod_cansleep(conststruct gpio_desc *desc)
{ /* GPIO can never have been requested */
WARN_ON(desc); return 0;
}
staticinlineint gpiod_to_irq(conststruct gpio_desc *desc)
{ /* GPIO can never have been requested */
WARN_ON(desc); return -EINVAL;
}
staticinlineint gpiod_set_consumer_name(struct gpio_desc *desc, constchar *name)
{ /* GPIO can never have been requested */
WARN_ON(desc); return -EINVAL;
}
/* Ignore IoRestriction field */ #define ACPI_GPIO_QUIRK_NO_IO_RESTRICTION BIT(0) /* * When ACPI GPIO mapping table is in use the index parameter inside it * refers to the GPIO resource in _CRS method. That index has no * distinction of actual type of the resource. When consumer wants to * get GpioIo type explicitly, this quirk may be used.
*/ #define ACPI_GPIO_QUIRK_ONLY_GPIOIO BIT(1) /* Use given pin as an absolute GPIO number in the system */ #define ACPI_GPIO_QUIRK_ABSOLUTE_NUMBER BIT(2)
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.