#include <linux/io.h>
#include <linux/gpio/driver.h>
#include <linux/of.h>
#include <linux/of_irq.h>
#include <linux/pinctrl/consumer.h>
#include <linux/pinctrl/machine.h>
#include <linux/pinctrl/pinconf.h>
#include <linux/pinctrl/pinconf-generic.h>
#include <linux/pinctrl/pinctrl.h>
#include <linux/pinctrl/pinmux.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/bitops.h>
#include <linux/regmap.h>
#include <linux/mfd/syscon.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/pm.h>
#include <dt-bindings/pinctrl/mt65xx.h>
#include "../core.h"
#include "../pinconf.h"
#include "../pinctrl-utils.h"
#include "mtk-eint.h"
#include "pinctrl-mtk-common.h"
#define GPIO_MODE_BITS …
#define GPIO_MODE_PREFIX …
static const char * const mtk_gpio_functions[] = …;
static struct regmap *mtk_get_regmap(struct mtk_pinctrl *pctl,
unsigned long pin)
{ … }
static unsigned int mtk_get_port(struct mtk_pinctrl *pctl, unsigned long pin)
{ … }
static int mtk_pmx_gpio_set_direction(struct pinctrl_dev *pctldev,
struct pinctrl_gpio_range *range, unsigned offset,
bool input)
{ … }
static void mtk_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
{ … }
static int mtk_pconf_set_ies_smt(struct mtk_pinctrl *pctl, unsigned pin,
int value, enum pin_config_param arg)
{ … }
int mtk_pconf_spec_set_ies_smt_range(struct regmap *regmap,
const struct mtk_pinctrl_devdata *devdata,
unsigned int pin, int value, enum pin_config_param arg)
{ … }
static const struct mtk_pin_drv_grp *mtk_find_pin_drv_grp_by_pin(
struct mtk_pinctrl *pctl, unsigned long pin) { … }
static int mtk_pconf_set_driving(struct mtk_pinctrl *pctl,
unsigned int pin, unsigned char driving)
{ … }
int mtk_pctrl_spec_pull_set_samereg(struct regmap *regmap,
const struct mtk_pinctrl_devdata *devdata,
unsigned int pin, bool isup, unsigned int r1r0)
{ … }
static int mtk_pconf_set_pull_select(struct mtk_pinctrl *pctl,
unsigned int pin, bool enable, bool isup, unsigned int arg)
{ … }
static int mtk_pconf_parse_conf(struct pinctrl_dev *pctldev,
unsigned int pin, enum pin_config_param param,
enum pin_config_param arg)
{ … }
static int mtk_pconf_group_get(struct pinctrl_dev *pctldev,
unsigned group,
unsigned long *config)
{ … }
static int mtk_pconf_group_set(struct pinctrl_dev *pctldev, unsigned group,
unsigned long *configs, unsigned num_configs)
{ … }
static const struct pinconf_ops mtk_pconf_ops = …;
static struct mtk_pinctrl_group *
mtk_pctrl_find_group_by_pin(struct mtk_pinctrl *pctl, u32 pin)
{ … }
static const struct mtk_desc_function *mtk_pctrl_find_function_by_pin(
struct mtk_pinctrl *pctl, u32 pin_num, u32 fnum)
{ … }
static bool mtk_pctrl_is_function_valid(struct mtk_pinctrl *pctl,
u32 pin_num, u32 fnum)
{ … }
static int mtk_pctrl_dt_node_to_map_func(struct mtk_pinctrl *pctl,
u32 pin, u32 fnum, struct mtk_pinctrl_group *grp,
struct pinctrl_map **map, unsigned *reserved_maps,
unsigned *num_maps)
{ … }
static int mtk_pctrl_dt_subnode_to_map(struct pinctrl_dev *pctldev,
struct device_node *node,
struct pinctrl_map **map,
unsigned *reserved_maps,
unsigned *num_maps)
{ … }
static int mtk_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
struct device_node *np_config,
struct pinctrl_map **map, unsigned *num_maps)
{ … }
static int mtk_pctrl_get_groups_count(struct pinctrl_dev *pctldev)
{ … }
static const char *mtk_pctrl_get_group_name(struct pinctrl_dev *pctldev,
unsigned group)
{ … }
static int mtk_pctrl_get_group_pins(struct pinctrl_dev *pctldev,
unsigned group,
const unsigned **pins,
unsigned *num_pins)
{ … }
static const struct pinctrl_ops mtk_pctrl_ops = …;
static int mtk_pmx_get_funcs_cnt(struct pinctrl_dev *pctldev)
{ … }
static const char *mtk_pmx_get_func_name(struct pinctrl_dev *pctldev,
unsigned selector)
{ … }
static int mtk_pmx_get_func_groups(struct pinctrl_dev *pctldev,
unsigned function,
const char * const **groups,
unsigned * const num_groups)
{ … }
static int mtk_pmx_set_mode(struct pinctrl_dev *pctldev,
unsigned long pin, unsigned long mode)
{ … }
static const struct mtk_desc_pin *
mtk_find_pin_by_eint_num(struct mtk_pinctrl *pctl, unsigned int eint_num)
{ … }
static int mtk_pmx_set_mux(struct pinctrl_dev *pctldev,
unsigned function,
unsigned group)
{ … }
static int mtk_pmx_find_gpio_mode(struct mtk_pinctrl *pctl,
unsigned offset)
{ … }
static int mtk_pmx_gpio_request_enable(struct pinctrl_dev *pctldev,
struct pinctrl_gpio_range *range,
unsigned offset)
{ … }
static const struct pinmux_ops mtk_pmx_ops = …;
static int mtk_gpio_direction_output(struct gpio_chip *chip,
unsigned offset, int value)
{ … }
static int mtk_gpio_get_direction(struct gpio_chip *chip, unsigned offset)
{ … }
static int mtk_gpio_get(struct gpio_chip *chip, unsigned offset)
{ … }
static int mtk_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
{ … }
static int mtk_gpio_set_config(struct gpio_chip *chip, unsigned offset,
unsigned long config)
{ … }
static const struct gpio_chip mtk_gpio_chip = …;
static int mtk_eint_suspend(struct device *device)
{ … }
static int mtk_eint_resume(struct device *device)
{ … }
EXPORT_GPL_DEV_SLEEP_PM_OPS(mtk_eint_pm_ops) = …;
static int mtk_pctrl_build_state(struct platform_device *pdev)
{ … }
static int
mtk_xt_get_gpio_n(void *data, unsigned long eint_n, unsigned int *gpio_n,
struct gpio_chip **gpio_chip)
{ … }
static int mtk_xt_get_gpio_state(void *data, unsigned long eint_n)
{ … }
static int mtk_xt_set_gpio_as_eint(void *data, unsigned long eint_n)
{ … }
static const struct mtk_eint_xt mtk_eint_xt = …;
static int mtk_eint_init(struct mtk_pinctrl *pctl, struct platform_device *pdev)
{ … }
int mtk_pctrl_init(struct platform_device *pdev,
const struct mtk_pinctrl_devdata *data,
struct regmap *regmap)
{ … }
int mtk_pctrl_common_probe(struct platform_device *pdev)
{ … }