#ifndef __LINUX_PINCTRL_CONSUMER_H
#define __LINUX_PINCTRL_CONSUMER_H
#include <linux/err.h>
#include <linux/types.h>
#include <linux/pinctrl/pinctrl-state.h>
struct device;
struct gpio_chip;
struct pinctrl;
struct pinctrl_state;
#ifdef CONFIG_PINCTRL
bool pinctrl_gpio_can_use_line(struct gpio_chip *gc, unsigned int offset);
int pinctrl_gpio_request(struct gpio_chip *gc, unsigned int offset);
void pinctrl_gpio_free(struct gpio_chip *gc, unsigned int offset);
int pinctrl_gpio_direction_input(struct gpio_chip *gc,
unsigned int offset);
int pinctrl_gpio_direction_output(struct gpio_chip *gc,
unsigned int offset);
int pinctrl_gpio_set_config(struct gpio_chip *gc, unsigned int offset,
unsigned long config);
struct pinctrl * __must_check pinctrl_get(struct device *dev);
void pinctrl_put(struct pinctrl *p);
struct pinctrl_state * __must_check pinctrl_lookup_state(struct pinctrl *p,
const char *name);
int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *s);
struct pinctrl * __must_check devm_pinctrl_get(struct device *dev);
void devm_pinctrl_put(struct pinctrl *p);
int pinctrl_select_default_state(struct device *dev);
#ifdef CONFIG_PM
int pinctrl_pm_select_default_state(struct device *dev);
int pinctrl_pm_select_sleep_state(struct device *dev);
int pinctrl_pm_select_idle_state(struct device *dev);
#else
static inline int pinctrl_pm_select_default_state(struct device *dev)
{
return 0;
}
static inline int pinctrl_pm_select_sleep_state(struct device *dev)
{
return 0;
}
static inline int pinctrl_pm_select_idle_state(struct device *dev)
{
return 0;
}
#endif
#else
static inline bool
pinctrl_gpio_can_use_line(struct gpio_chip *gc, unsigned int offset)
{
return true;
}
static inline int
pinctrl_gpio_request(struct gpio_chip *gc, unsigned int offset)
{
return 0;
}
static inline void
pinctrl_gpio_free(struct gpio_chip *gc, unsigned int offset)
{
}
static inline int
pinctrl_gpio_direction_input(struct gpio_chip *gc, unsigned int offset)
{
return 0;
}
static inline int
pinctrl_gpio_direction_output(struct gpio_chip *gc, unsigned int offset)
{
return 0;
}
static inline int
pinctrl_gpio_set_config(struct gpio_chip *gc, unsigned int offset,
unsigned long config)
{
return 0;
}
static inline struct pinctrl * __must_check pinctrl_get(struct device *dev)
{
return NULL;
}
static inline void pinctrl_put(struct pinctrl *p)
{
}
static inline struct pinctrl_state * __must_check pinctrl_lookup_state(struct pinctrl *p,
const char *name)
{
return NULL;
}
static inline int pinctrl_select_state(struct pinctrl *p,
struct pinctrl_state *s)
{
return 0;
}
static inline struct pinctrl * __must_check devm_pinctrl_get(struct device *dev)
{
return NULL;
}
static inline void devm_pinctrl_put(struct pinctrl *p)
{
}
static inline int pinctrl_select_default_state(struct device *dev)
{
return 0;
}
static inline int pinctrl_pm_select_default_state(struct device *dev)
{
return 0;
}
static inline int pinctrl_pm_select_sleep_state(struct device *dev)
{
return 0;
}
static inline int pinctrl_pm_select_idle_state(struct device *dev)
{
return 0;
}
#endif
static inline struct pinctrl * __must_check pinctrl_get_select(struct device *dev,
const char *name)
{ … }
static inline struct pinctrl * __must_check pinctrl_get_select_default(struct device *dev)
{ … }
static inline struct pinctrl * __must_check devm_pinctrl_get_select(struct device *dev,
const char *name)
{ … }
static inline struct pinctrl * __must_check devm_pinctrl_get_select_default(struct device *dev)
{ … }
#endif