mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-26 19:15:25 +07:00
114b5f8f7e
Core changes: - A patch series from Hans Verkuil to make it possible to enable/disable IRQs on a GPIO line at runtime and drive GPIO lines as output without having to put/get them from scratch. The irqchip callbacks have been improved so that they can use only the fastpatch callbacks to enable/disable irqs like any normal irqchip, especially the gpiod_lock_as_irq() has been improved to be callable in fastpath context. A bunch of rework had to be done to achieve this but it is a big win since I never liked to restrict this to slowpath. The only call requireing slowpath was try_module_get() and this is kept at the .request_resources() slowpath callback. In the GPIO CEC driver this is a big win sine a single line is used for both outgoing and incoming traffic, and this needs to use IRQs for incoming traffic while actively driving the line for outgoing traffic. - Janusz Krzysztofik improved the GPIO array API to pass a "cookie" (struct gpio_array) and a bitmap for setting or getting multiple GPIO lines at once. This improvement orginated in a specific need to speed up an OMAP1 driver and has led to a much better API and real performance gains when the state of the array can be used to bypass a lot of checks and code when we want things to go really fast. The previous code would minimize the number of calls down to the driver callbacks assuming the CPU speed was orders of magnitude faster than the I/O latency, but this assumption was wrong on several platforms: what we needed to do was to profile and improve the speed on the hot path of the array functions and this change is now completed. - Clean out the painful and hard to grasp BNF experiments from the device tree bindings. Future approaches are looking into using JSON schema for this purpose. (Rob Herring is floating a patch series.) New drivers: - The RCAR driver now supports r8a774a1 (RZ/G2M). - Synopsys GPIO via CREGs driver. Major improvements: - Modernization of the EP93xx driver to use irqdomain and other contemporary concepts. - The ingenic driver has been merged into the Ingenic pin control driver and removed from the GPIO subsystem. - Debounce support in the ftgpio010 driver. -----BEGIN PGP SIGNATURE----- iQIcBAABAgAGBQJbzdyOAAoJEEEQszewGV1zfYcP/0HBEAOPhHD/i5OQxfKs1msh mFT/t/IbTmRpCgbEv4CDx4Kc/InE0sUnQr1TL/1WvU6uObM6Ncxq5Z90MvyrgzYu BqQHq2k2tORvkVSNRxcfD/BAAoo1EerXts1kDhutvdKfepfS6DxpENwzvsFgkVlq 2jj1cdZztjv8A+9cspHDpQP+jDvl1VSc10nR5fRu1TttSpUwzRJaB30NBNXJmMJc 5KUr67lEbsQRPsBvFErU11bydPqhfT+pXmODcfIwS0EtATQ8WC5mkSb/Ooei0fvT oZ7uR3Os8tMf7isOKssEyFabKwhnfOEt6TBt9em0TfUtInOo0Dc7r8TfBcn57fyZ xg2R9DQEVRfac8bjhF/BI5KHuN9IMGDDvj6XApumQVliZbISRjMnh3jte6RpcV0A Ejqz8FeDY13qvEdOnW1EPpwmXdDVWiEAq0ebGLStKNls+/4gB2HmyxGUOzJf+og5 hujsxcJzGQqjCe0moeY/1d7vsy0ZjbHoS+p5fy79U212y2O7onEzFU92AX89bxKC rx2eCNmiZxCUy1nqu8edO62VnH6QdnqG3o+a4DJfCSHPvFM/E/NX9zHemZubQQ4I rYXNy4bL4tEG9cqWMfBxWrpiDZw7H6l8kXwdZG8IMyRU9BcKu96amgZ+jBXwzoaB JZelAAUWB9APghJYFr7o =YosT -----END PGP SIGNATURE----- Merge tag 'gpio-v4.20-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio Pull GPIO updates from Linus Walleij: "This is the bulk of GPIO changes for the v4.20 series: Core changes: - A patch series from Hans Verkuil to make it possible to enable/disable IRQs on a GPIO line at runtime and drive GPIO lines as output without having to put/get them from scratch. The irqchip callbacks have been improved so that they can use only the fastpatch callbacks to enable/disable irqs like any normal irqchip, especially the gpiod_lock_as_irq() has been improved to be callable in fastpath context. A bunch of rework had to be done to achieve this but it is a big win since I never liked to restrict this to slowpath. The only call requireing slowpath was try_module_get() and this is kept at the .request_resources() slowpath callback. In the GPIO CEC driver this is a big win sine a single line is used for both outgoing and incoming traffic, and this needs to use IRQs for incoming traffic while actively driving the line for outgoing traffic. - Janusz Krzysztofik improved the GPIO array API to pass a "cookie" (struct gpio_array) and a bitmap for setting or getting multiple GPIO lines at once. This improvement orginated in a specific need to speed up an OMAP1 driver and has led to a much better API and real performance gains when the state of the array can be used to bypass a lot of checks and code when we want things to go really fast. The previous code would minimize the number of calls down to the driver callbacks assuming the CPU speed was orders of magnitude faster than the I/O latency, but this assumption was wrong on several platforms: what we needed to do was to profile and improve the speed on the hot path of the array functions and this change is now completed. - Clean out the painful and hard to grasp BNF experiments from the device tree bindings. Future approaches are looking into using JSON schema for this purpose. (Rob Herring is floating a patch series.) New drivers: - The RCAR driver now supports r8a774a1 (RZ/G2M). - Synopsys GPIO via CREGs driver. Major improvements: - Modernization of the EP93xx driver to use irqdomain and other contemporary concepts. - The ingenic driver has been merged into the Ingenic pin control driver and removed from the GPIO subsystem. - Debounce support in the ftgpio010 driver" * tag 'gpio-v4.20-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (116 commits) gpio: Clarify kerneldoc on gpiochip_set_chained_irqchip() gpio: Remove unused 'irqchip' argument to gpiochip_set_cascaded_irqchip() gpio: Drop parent irq assignment during cascade setup mmc: pwrseq_simple: Fix incorrect handling of GPIO bitmap gpio: fix SNPS_CREG kconfig dependency warning gpiolib: Initialize gdev field before is used gpio: fix kernel-doc after devres.c file rename gpio: fix doc string for devm_gpiochip_add_data() to not talk about irq_chip gpio: syscon: Fix possible NULL ptr usage gpiolib: Show correct direction from the beginning pinctrl: msm: Use init_valid_mask exported function gpiolib: Add init_valid_mask exported function GPIO: add single-register GPIO via CREG driver dt-bindings: Document the Synopsys GPIO via CREG bindings gpio: mockup: use device properties instead of platform_data gpio: Slightly more helpful debugfs gpio: omap: Remove set but not used variable 'dev' gpio: omap: drop omap_gpio_list Accept partial 'gpio-line-names' property. gpio: omap: get rid of the conditional PM runtime calls ...
590 lines
16 KiB
C
590 lines
16 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef __LINUX_GPIO_CONSUMER_H
|
|
#define __LINUX_GPIO_CONSUMER_H
|
|
|
|
#include <linux/bug.h>
|
|
#include <linux/err.h>
|
|
#include <linux/kernel.h>
|
|
|
|
struct device;
|
|
|
|
/**
|
|
* Opaque descriptor for a GPIO. These are obtained using gpiod_get() and are
|
|
* preferable to the old integer-based handles.
|
|
*
|
|
* Contrary to integers, a pointer to a gpio_desc is guaranteed to be valid
|
|
* until the GPIO is released.
|
|
*/
|
|
struct gpio_desc;
|
|
|
|
/**
|
|
* Opaque descriptor for a structure of GPIO array attributes. This structure
|
|
* is attached to struct gpiod_descs obtained from gpiod_get_array() and can be
|
|
* passed back to get/set array functions in order to activate fast processing
|
|
* path if applicable.
|
|
*/
|
|
struct gpio_array;
|
|
|
|
/**
|
|
* Struct containing an array of descriptors that can be obtained using
|
|
* gpiod_get_array().
|
|
*/
|
|
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)
|
|
#define GPIOD_FLAGS_BIT_NONEXCLUSIVE BIT(4)
|
|
|
|
/**
|
|
* Optional flags that can be passed to one of gpiod_* to configure direction
|
|
* and output value. These values cannot be OR'd.
|
|
*/
|
|
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_put_array(struct device *dev, struct gpio_descs *descs);
|
|
|
|
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(const struct gpio_desc *desc);
|
|
int gpiod_get_array_value(unsigned int array_size,
|
|
struct gpio_desc **desc_array,
|
|
struct gpio_array *array_info,
|
|
unsigned long *value_bitmap);
|
|
void gpiod_set_value(struct gpio_desc *desc, int value);
|
|
int gpiod_set_array_value(unsigned int array_size,
|
|
struct gpio_desc **desc_array,
|
|
struct gpio_array *array_info,
|
|
unsigned long *value_bitmap);
|
|
int gpiod_get_raw_value(const struct gpio_desc *desc);
|
|
int gpiod_get_raw_array_value(unsigned int array_size,
|
|
struct gpio_desc **desc_array,
|
|
struct gpio_array *array_info,
|
|
unsigned long *value_bitmap);
|
|
void gpiod_set_raw_value(struct gpio_desc *desc, int value);
|
|
int gpiod_set_raw_array_value(unsigned int array_size,
|
|
struct gpio_desc **desc_array,
|
|
struct gpio_array *array_info,
|
|
unsigned long *value_bitmap);
|
|
|
|
/* Value get/set from sleeping context */
|
|
int gpiod_get_value_cansleep(const struct gpio_desc *desc);
|
|
int gpiod_get_array_value_cansleep(unsigned int array_size,
|
|
struct gpio_desc **desc_array,
|
|
struct gpio_array *array_info,
|
|
unsigned long *value_bitmap);
|
|
void gpiod_set_value_cansleep(struct gpio_desc *desc, int value);
|
|
int gpiod_set_array_value_cansleep(unsigned int array_size,
|
|
struct gpio_desc **desc_array,
|
|
struct gpio_array *array_info,
|
|
unsigned long *value_bitmap);
|
|
int gpiod_get_raw_value_cansleep(const struct gpio_desc *desc);
|
|
int gpiod_get_raw_array_value_cansleep(unsigned int array_size,
|
|
struct gpio_desc **desc_array,
|
|
struct gpio_array *array_info,
|
|
unsigned long *value_bitmap);
|
|
void gpiod_set_raw_value_cansleep(struct gpio_desc *desc, int value);
|
|
int gpiod_set_raw_array_value_cansleep(unsigned int array_size,
|
|
struct gpio_desc **desc_array,
|
|
struct gpio_array *array_info,
|
|
unsigned long *value_bitmap);
|
|
|
|
int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce);
|
|
int gpiod_set_transitory(struct gpio_desc *desc, bool transitory);
|
|
|
|
int gpiod_is_active_low(const struct gpio_desc *desc);
|
|
int gpiod_cansleep(const struct gpio_desc *desc);
|
|
|
|
int gpiod_to_irq(const struct gpio_desc *desc);
|
|
void gpiod_set_consumer_name(struct gpio_desc *desc, const char *name);
|
|
|
|
/* Convert between the old gpio_ and new gpiod_ interfaces */
|
|
struct gpio_desc *gpio_to_desc(unsigned gpio);
|
|
int desc_to_gpio(const struct gpio_desc *desc);
|
|
|
|
/* Child properties interface */
|
|
struct device_node;
|
|
struct fwnode_handle;
|
|
|
|
struct gpio_desc *devm_gpiod_get_from_of_node(struct device *dev,
|
|
struct device_node *node,
|
|
const char *propname, int index,
|
|
enum gpiod_flags dflags,
|
|
const char *label);
|
|
struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode,
|
|
const char *propname, int index,
|
|
enum gpiod_flags dflags,
|
|
const char *label);
|
|
struct gpio_desc *devm_fwnode_get_index_gpiod_from_child(struct device *dev,
|
|
const char *con_id, int index,
|
|
struct fwnode_handle *child,
|
|
enum gpiod_flags flags,
|
|
const char *label);
|
|
|
|
#else /* CONFIG_GPIOLIB */
|
|
|
|
static inline int gpiod_count(struct device *dev, const char *con_id)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline struct gpio_desc *__must_check gpiod_get(struct device *dev,
|
|
const char *con_id,
|
|
enum gpiod_flags flags)
|
|
{
|
|
return ERR_PTR(-ENOSYS);
|
|
}
|
|
static inline struct gpio_desc *__must_check
|
|
gpiod_get_index(struct device *dev,
|
|
const char *con_id,
|
|
unsigned int idx,
|
|
enum gpiod_flags flags)
|
|
{
|
|
return ERR_PTR(-ENOSYS);
|
|
}
|
|
|
|
static inline struct gpio_desc *__must_check
|
|
gpiod_get_optional(struct device *dev, const char *con_id,
|
|
enum gpiod_flags flags)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
static inline struct gpio_desc *__must_check
|
|
gpiod_get_index_optional(struct device *dev, const char *con_id,
|
|
unsigned int index, enum gpiod_flags flags)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
static inline struct gpio_descs *__must_check
|
|
gpiod_get_array(struct device *dev, const char *con_id,
|
|
enum gpiod_flags flags)
|
|
{
|
|
return ERR_PTR(-ENOSYS);
|
|
}
|
|
|
|
static inline struct gpio_descs *__must_check
|
|
gpiod_get_array_optional(struct device *dev, const char *con_id,
|
|
enum gpiod_flags flags)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
static inline void gpiod_put(struct gpio_desc *desc)
|
|
{
|
|
might_sleep();
|
|
|
|
/* GPIO can never have been requested */
|
|
WARN_ON(1);
|
|
}
|
|
|
|
static inline void gpiod_put_array(struct gpio_descs *descs)
|
|
{
|
|
might_sleep();
|
|
|
|
/* GPIO can never have been requested */
|
|
WARN_ON(1);
|
|
}
|
|
|
|
static inline struct gpio_desc *__must_check
|
|
devm_gpiod_get(struct device *dev,
|
|
const char *con_id,
|
|
enum gpiod_flags flags)
|
|
{
|
|
return ERR_PTR(-ENOSYS);
|
|
}
|
|
static inline
|
|
struct gpio_desc *__must_check
|
|
devm_gpiod_get_index(struct device *dev,
|
|
const char *con_id,
|
|
unsigned int idx,
|
|
enum gpiod_flags flags)
|
|
{
|
|
return ERR_PTR(-ENOSYS);
|
|
}
|
|
|
|
static inline struct gpio_desc *__must_check
|
|
devm_gpiod_get_optional(struct device *dev, const char *con_id,
|
|
enum gpiod_flags flags)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
static inline struct gpio_desc *__must_check
|
|
devm_gpiod_get_index_optional(struct device *dev, const char *con_id,
|
|
unsigned int index, enum gpiod_flags flags)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
static inline struct gpio_descs *__must_check
|
|
devm_gpiod_get_array(struct device *dev, const char *con_id,
|
|
enum gpiod_flags flags)
|
|
{
|
|
return ERR_PTR(-ENOSYS);
|
|
}
|
|
|
|
static inline struct gpio_descs *__must_check
|
|
devm_gpiod_get_array_optional(struct device *dev, const char *con_id,
|
|
enum gpiod_flags flags)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
static inline void devm_gpiod_put(struct device *dev, struct gpio_desc *desc)
|
|
{
|
|
might_sleep();
|
|
|
|
/* GPIO can never have been requested */
|
|
WARN_ON(1);
|
|
}
|
|
|
|
static inline void devm_gpiod_put_array(struct device *dev,
|
|
struct gpio_descs *descs)
|
|
{
|
|
might_sleep();
|
|
|
|
/* GPIO can never have been requested */
|
|
WARN_ON(1);
|
|
}
|
|
|
|
|
|
static inline int gpiod_get_direction(const struct gpio_desc *desc)
|
|
{
|
|
/* GPIO can never have been requested */
|
|
WARN_ON(1);
|
|
return -ENOSYS;
|
|
}
|
|
static inline int gpiod_direction_input(struct gpio_desc *desc)
|
|
{
|
|
/* GPIO can never have been requested */
|
|
WARN_ON(1);
|
|
return -ENOSYS;
|
|
}
|
|
static inline int gpiod_direction_output(struct gpio_desc *desc, int value)
|
|
{
|
|
/* GPIO can never have been requested */
|
|
WARN_ON(1);
|
|
return -ENOSYS;
|
|
}
|
|
static inline int gpiod_direction_output_raw(struct gpio_desc *desc, int value)
|
|
{
|
|
/* GPIO can never have been requested */
|
|
WARN_ON(1);
|
|
return -ENOSYS;
|
|
}
|
|
|
|
|
|
static inline int gpiod_get_value(const struct gpio_desc *desc)
|
|
{
|
|
/* GPIO can never have been requested */
|
|
WARN_ON(1);
|
|
return 0;
|
|
}
|
|
static inline int gpiod_get_array_value(unsigned int array_size,
|
|
struct gpio_desc **desc_array,
|
|
struct gpio_array *array_info,
|
|
unsigned long *value_bitmap)
|
|
{
|
|
/* GPIO can never have been requested */
|
|
WARN_ON(1);
|
|
return 0;
|
|
}
|
|
static inline void gpiod_set_value(struct gpio_desc *desc, int value)
|
|
{
|
|
/* GPIO can never have been requested */
|
|
WARN_ON(1);
|
|
}
|
|
static inline int gpiod_set_array_value(unsigned int array_size,
|
|
struct gpio_desc **desc_array,
|
|
struct gpio_array *array_info,
|
|
unsigned long *value_bitmap)
|
|
{
|
|
/* GPIO can never have been requested */
|
|
WARN_ON(1);
|
|
return 0;
|
|
}
|
|
static inline int gpiod_get_raw_value(const struct gpio_desc *desc)
|
|
{
|
|
/* GPIO can never have been requested */
|
|
WARN_ON(1);
|
|
return 0;
|
|
}
|
|
static inline int gpiod_get_raw_array_value(unsigned int array_size,
|
|
struct gpio_desc **desc_array,
|
|
struct gpio_array *array_info,
|
|
unsigned long *value_bitmap)
|
|
{
|
|
/* GPIO can never have been requested */
|
|
WARN_ON(1);
|
|
return 0;
|
|
}
|
|
static inline void gpiod_set_raw_value(struct gpio_desc *desc, int value)
|
|
{
|
|
/* GPIO can never have been requested */
|
|
WARN_ON(1);
|
|
}
|
|
static inline int gpiod_set_raw_array_value(unsigned int array_size,
|
|
struct gpio_desc **desc_array,
|
|
struct gpio_array *array_info,
|
|
unsigned long *value_bitmap)
|
|
{
|
|
/* GPIO can never have been requested */
|
|
WARN_ON(1);
|
|
return 0;
|
|
}
|
|
|
|
static inline int gpiod_get_value_cansleep(const struct gpio_desc *desc)
|
|
{
|
|
/* GPIO can never have been requested */
|
|
WARN_ON(1);
|
|
return 0;
|
|
}
|
|
static inline int gpiod_get_array_value_cansleep(unsigned int array_size,
|
|
struct gpio_desc **desc_array,
|
|
struct gpio_array *array_info,
|
|
unsigned long *value_bitmap)
|
|
{
|
|
/* GPIO can never have been requested */
|
|
WARN_ON(1);
|
|
return 0;
|
|
}
|
|
static inline void gpiod_set_value_cansleep(struct gpio_desc *desc, int value)
|
|
{
|
|
/* GPIO can never have been requested */
|
|
WARN_ON(1);
|
|
}
|
|
static inline int gpiod_set_array_value_cansleep(unsigned int array_size,
|
|
struct gpio_desc **desc_array,
|
|
struct gpio_array *array_info,
|
|
unsigned long *value_bitmap)
|
|
{
|
|
/* GPIO can never have been requested */
|
|
WARN_ON(1);
|
|
return 0;
|
|
}
|
|
static inline int gpiod_get_raw_value_cansleep(const struct gpio_desc *desc)
|
|
{
|
|
/* GPIO can never have been requested */
|
|
WARN_ON(1);
|
|
return 0;
|
|
}
|
|
static inline int gpiod_get_raw_array_value_cansleep(unsigned int array_size,
|
|
struct gpio_desc **desc_array,
|
|
struct gpio_array *array_info,
|
|
unsigned long *value_bitmap)
|
|
{
|
|
/* GPIO can never have been requested */
|
|
WARN_ON(1);
|
|
return 0;
|
|
}
|
|
static inline void gpiod_set_raw_value_cansleep(struct gpio_desc *desc,
|
|
int value)
|
|
{
|
|
/* GPIO can never have been requested */
|
|
WARN_ON(1);
|
|
}
|
|
static inline int gpiod_set_raw_array_value_cansleep(unsigned int array_size,
|
|
struct gpio_desc **desc_array,
|
|
struct gpio_array *array_info,
|
|
unsigned long *value_bitmap)
|
|
{
|
|
/* GPIO can never have been requested */
|
|
WARN_ON(1);
|
|
return 0;
|
|
}
|
|
|
|
static inline int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce)
|
|
{
|
|
/* GPIO can never have been requested */
|
|
WARN_ON(1);
|
|
return -ENOSYS;
|
|
}
|
|
|
|
static inline int gpiod_set_transitory(struct gpio_desc *desc, bool transitory)
|
|
{
|
|
/* GPIO can never have been requested */
|
|
WARN_ON(1);
|
|
return -ENOSYS;
|
|
}
|
|
|
|
static inline int gpiod_is_active_low(const struct gpio_desc *desc)
|
|
{
|
|
/* GPIO can never have been requested */
|
|
WARN_ON(1);
|
|
return 0;
|
|
}
|
|
static inline int gpiod_cansleep(const struct gpio_desc *desc)
|
|
{
|
|
/* GPIO can never have been requested */
|
|
WARN_ON(1);
|
|
return 0;
|
|
}
|
|
|
|
static inline int gpiod_to_irq(const struct gpio_desc *desc)
|
|
{
|
|
/* GPIO can never have been requested */
|
|
WARN_ON(1);
|
|
return -EINVAL;
|
|
}
|
|
|
|
static inline void gpiod_set_consumer_name(struct gpio_desc *desc, const char *name)
|
|
{
|
|
/* GPIO can never have been requested */
|
|
WARN_ON(1);
|
|
}
|
|
|
|
static inline struct gpio_desc *gpio_to_desc(unsigned gpio)
|
|
{
|
|
return ERR_PTR(-EINVAL);
|
|
}
|
|
|
|
static inline int desc_to_gpio(const struct gpio_desc *desc)
|
|
{
|
|
/* GPIO can never have been requested */
|
|
WARN_ON(1);
|
|
return -EINVAL;
|
|
}
|
|
|
|
/* Child properties interface */
|
|
struct device_node;
|
|
struct fwnode_handle;
|
|
|
|
static inline
|
|
struct gpio_desc *devm_gpiod_get_from_of_node(struct device *dev,
|
|
struct device_node *node,
|
|
const char *propname, int index,
|
|
enum gpiod_flags dflags,
|
|
const char *label)
|
|
{
|
|
return ERR_PTR(-ENOSYS);
|
|
}
|
|
|
|
static inline
|
|
struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode,
|
|
const char *propname, int index,
|
|
enum gpiod_flags dflags,
|
|
const char *label)
|
|
{
|
|
return ERR_PTR(-ENOSYS);
|
|
}
|
|
|
|
static inline
|
|
struct gpio_desc *devm_fwnode_get_index_gpiod_from_child(struct device *dev,
|
|
const char *con_id, int index,
|
|
struct fwnode_handle *child,
|
|
enum gpiod_flags flags,
|
|
const char *label)
|
|
{
|
|
return ERR_PTR(-ENOSYS);
|
|
}
|
|
|
|
#endif /* CONFIG_GPIOLIB */
|
|
|
|
static inline
|
|
struct gpio_desc *devm_fwnode_get_gpiod_from_child(struct device *dev,
|
|
const char *con_id,
|
|
struct fwnode_handle *child,
|
|
enum gpiod_flags flags,
|
|
const char *label)
|
|
{
|
|
return devm_fwnode_get_index_gpiod_from_child(dev, con_id, 0, child,
|
|
flags, label);
|
|
}
|
|
|
|
#if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_GPIO_SYSFS)
|
|
|
|
int gpiod_export(struct gpio_desc *desc, bool direction_may_change);
|
|
int gpiod_export_link(struct device *dev, const char *name,
|
|
struct gpio_desc *desc);
|
|
void gpiod_unexport(struct gpio_desc *desc);
|
|
|
|
#else /* CONFIG_GPIOLIB && CONFIG_GPIO_SYSFS */
|
|
|
|
static inline int gpiod_export(struct gpio_desc *desc,
|
|
bool direction_may_change)
|
|
{
|
|
return -ENOSYS;
|
|
}
|
|
|
|
static inline int gpiod_export_link(struct device *dev, const char *name,
|
|
struct gpio_desc *desc)
|
|
{
|
|
return -ENOSYS;
|
|
}
|
|
|
|
static inline void gpiod_unexport(struct gpio_desc *desc)
|
|
{
|
|
}
|
|
|
|
#endif /* CONFIG_GPIOLIB && CONFIG_GPIO_SYSFS */
|
|
|
|
#endif
|