18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (C) 2018 MediaTek Inc.
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Author: Sean Wang <sean.wang@mediatek.com>
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#ifndef __PINCTRL_MTK_COMMON_V2_H
108c2ecf20Sopenharmony_ci#define __PINCTRL_MTK_COMMON_V2_H
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#include <linux/gpio/driver.h>
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#define MTK_INPUT      0
158c2ecf20Sopenharmony_ci#define MTK_OUTPUT     1
168c2ecf20Sopenharmony_ci#define MTK_DISABLE    0
178c2ecf20Sopenharmony_ci#define MTK_ENABLE     1
188c2ecf20Sopenharmony_ci#define MTK_PULLDOWN   0
198c2ecf20Sopenharmony_ci#define MTK_PULLUP     1
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci#define EINT_NA	U16_MAX
228c2ecf20Sopenharmony_ci#define NO_EINT_SUPPORT	EINT_NA
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#define PIN_FIELD_CALC(_s_pin, _e_pin, _i_base, _s_addr, _x_addrs,      \
258c2ecf20Sopenharmony_ci		       _s_bit, _x_bits, _sz_reg, _fixed) {		\
268c2ecf20Sopenharmony_ci		.s_pin = _s_pin,					\
278c2ecf20Sopenharmony_ci		.e_pin = _e_pin,					\
288c2ecf20Sopenharmony_ci		.i_base = _i_base,					\
298c2ecf20Sopenharmony_ci		.s_addr = _s_addr,					\
308c2ecf20Sopenharmony_ci		.x_addrs = _x_addrs,					\
318c2ecf20Sopenharmony_ci		.s_bit = _s_bit,					\
328c2ecf20Sopenharmony_ci		.x_bits = _x_bits,					\
338c2ecf20Sopenharmony_ci		.sz_reg = _sz_reg,					\
348c2ecf20Sopenharmony_ci		.fixed = _fixed,					\
358c2ecf20Sopenharmony_ci	}
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci#define PIN_FIELD(_s_pin, _e_pin, _s_addr, _x_addrs, _s_bit, _x_bits)	\
388c2ecf20Sopenharmony_ci	PIN_FIELD_CALC(_s_pin, _e_pin, 0, _s_addr, _x_addrs, _s_bit,	\
398c2ecf20Sopenharmony_ci		       _x_bits, 32, 0)
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci#define PINS_FIELD(_s_pin, _e_pin, _s_addr, _x_addrs, _s_bit, _x_bits)	\
428c2ecf20Sopenharmony_ci	PIN_FIELD_CALC(_s_pin, _e_pin, 0, _s_addr, _x_addrs, _s_bit,	\
438c2ecf20Sopenharmony_ci		       _x_bits, 32, 1)
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci/* List these attributes which could be modified for the pin */
468c2ecf20Sopenharmony_cienum {
478c2ecf20Sopenharmony_ci	PINCTRL_PIN_REG_MODE,
488c2ecf20Sopenharmony_ci	PINCTRL_PIN_REG_DIR,
498c2ecf20Sopenharmony_ci	PINCTRL_PIN_REG_DI,
508c2ecf20Sopenharmony_ci	PINCTRL_PIN_REG_DO,
518c2ecf20Sopenharmony_ci	PINCTRL_PIN_REG_SR,
528c2ecf20Sopenharmony_ci	PINCTRL_PIN_REG_SMT,
538c2ecf20Sopenharmony_ci	PINCTRL_PIN_REG_PD,
548c2ecf20Sopenharmony_ci	PINCTRL_PIN_REG_PU,
558c2ecf20Sopenharmony_ci	PINCTRL_PIN_REG_E4,
568c2ecf20Sopenharmony_ci	PINCTRL_PIN_REG_E8,
578c2ecf20Sopenharmony_ci	PINCTRL_PIN_REG_TDSEL,
588c2ecf20Sopenharmony_ci	PINCTRL_PIN_REG_RDSEL,
598c2ecf20Sopenharmony_ci	PINCTRL_PIN_REG_DRV,
608c2ecf20Sopenharmony_ci	PINCTRL_PIN_REG_PUPD,
618c2ecf20Sopenharmony_ci	PINCTRL_PIN_REG_R0,
628c2ecf20Sopenharmony_ci	PINCTRL_PIN_REG_R1,
638c2ecf20Sopenharmony_ci	PINCTRL_PIN_REG_IES,
648c2ecf20Sopenharmony_ci	PINCTRL_PIN_REG_PULLEN,
658c2ecf20Sopenharmony_ci	PINCTRL_PIN_REG_PULLSEL,
668c2ecf20Sopenharmony_ci	PINCTRL_PIN_REG_DRV_EN,
678c2ecf20Sopenharmony_ci	PINCTRL_PIN_REG_DRV_E0,
688c2ecf20Sopenharmony_ci	PINCTRL_PIN_REG_DRV_E1,
698c2ecf20Sopenharmony_ci	PINCTRL_PIN_REG_MAX,
708c2ecf20Sopenharmony_ci};
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci/* Group the pins by the driving current */
738c2ecf20Sopenharmony_cienum {
748c2ecf20Sopenharmony_ci	DRV_FIXED,
758c2ecf20Sopenharmony_ci	DRV_GRP0,
768c2ecf20Sopenharmony_ci	DRV_GRP1,
778c2ecf20Sopenharmony_ci	DRV_GRP2,
788c2ecf20Sopenharmony_ci	DRV_GRP3,
798c2ecf20Sopenharmony_ci	DRV_GRP4,
808c2ecf20Sopenharmony_ci	DRV_GRP_MAX,
818c2ecf20Sopenharmony_ci};
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_cistatic const char * const mtk_default_register_base_names[] __maybe_unused = {
848c2ecf20Sopenharmony_ci	"base",
858c2ecf20Sopenharmony_ci};
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci/* struct mtk_pin_field - the structure that holds the information of the field
888c2ecf20Sopenharmony_ci *			  used to describe the attribute for the pin
898c2ecf20Sopenharmony_ci * @base:		the index pointing to the entry in base address list
908c2ecf20Sopenharmony_ci * @offset:		the register offset relative to the base address
918c2ecf20Sopenharmony_ci * @mask:		the mask used to filter out the field from the register
928c2ecf20Sopenharmony_ci * @bitpos:		the start bit relative to the register
938c2ecf20Sopenharmony_ci * @next:		the indication that the field would be extended to the
948c2ecf20Sopenharmony_ci			next register
958c2ecf20Sopenharmony_ci */
968c2ecf20Sopenharmony_cistruct mtk_pin_field {
978c2ecf20Sopenharmony_ci	u8  index;
988c2ecf20Sopenharmony_ci	u32 offset;
998c2ecf20Sopenharmony_ci	u32 mask;
1008c2ecf20Sopenharmony_ci	u8  bitpos;
1018c2ecf20Sopenharmony_ci	u8  next;
1028c2ecf20Sopenharmony_ci};
1038c2ecf20Sopenharmony_ci
1048c2ecf20Sopenharmony_ci/* struct mtk_pin_field_calc - the structure that holds the range providing
1058c2ecf20Sopenharmony_ci *			       the guide used to look up the relevant field
1068c2ecf20Sopenharmony_ci * @s_pin:		the start pin within the range
1078c2ecf20Sopenharmony_ci * @e_pin:		the end pin within the range
1088c2ecf20Sopenharmony_ci * @i_base:		the index pointing to the entry in base address list
1098c2ecf20Sopenharmony_ci * @s_addr:		the start address for the range
1108c2ecf20Sopenharmony_ci * @x_addrs:		the address distance between two consecutive registers
1118c2ecf20Sopenharmony_ci *			within the range
1128c2ecf20Sopenharmony_ci * @s_bit:		the start bit for the first register within the range
1138c2ecf20Sopenharmony_ci * @x_bits:		the bit distance between two consecutive pins within
1148c2ecf20Sopenharmony_ci *			the range
1158c2ecf20Sopenharmony_ci * @sz_reg:		the size of bits in a register
1168c2ecf20Sopenharmony_ci * @fixed:		the consecutive pins share the same bits with the 1st
1178c2ecf20Sopenharmony_ci *			pin
1188c2ecf20Sopenharmony_ci */
1198c2ecf20Sopenharmony_cistruct mtk_pin_field_calc {
1208c2ecf20Sopenharmony_ci	u16 s_pin;
1218c2ecf20Sopenharmony_ci	u16 e_pin;
1228c2ecf20Sopenharmony_ci	u8  i_base;
1238c2ecf20Sopenharmony_ci	u32 s_addr;
1248c2ecf20Sopenharmony_ci	u8  x_addrs;
1258c2ecf20Sopenharmony_ci	u8  s_bit;
1268c2ecf20Sopenharmony_ci	u8  x_bits;
1278c2ecf20Sopenharmony_ci	u8  sz_reg;
1288c2ecf20Sopenharmony_ci	u8  fixed;
1298c2ecf20Sopenharmony_ci};
1308c2ecf20Sopenharmony_ci
1318c2ecf20Sopenharmony_ci/* struct mtk_pin_reg_calc - the structure that holds all ranges used to
1328c2ecf20Sopenharmony_ci *			     determine which register the pin would make use of
1338c2ecf20Sopenharmony_ci *			     for certain pin attribute.
1348c2ecf20Sopenharmony_ci * @range:		     the start address for the range
1358c2ecf20Sopenharmony_ci * @nranges:		     the number of items in the range
1368c2ecf20Sopenharmony_ci */
1378c2ecf20Sopenharmony_cistruct mtk_pin_reg_calc {
1388c2ecf20Sopenharmony_ci	const struct mtk_pin_field_calc *range;
1398c2ecf20Sopenharmony_ci	unsigned int nranges;
1408c2ecf20Sopenharmony_ci};
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_ci/**
1438c2ecf20Sopenharmony_ci * struct mtk_func_desc - the structure that providing information
1448c2ecf20Sopenharmony_ci *			  all the funcs for this pin
1458c2ecf20Sopenharmony_ci * @name:		the name of function
1468c2ecf20Sopenharmony_ci * @muxval:		the mux to the function
1478c2ecf20Sopenharmony_ci */
1488c2ecf20Sopenharmony_cistruct mtk_func_desc {
1498c2ecf20Sopenharmony_ci	const char *name;
1508c2ecf20Sopenharmony_ci	u8 muxval;
1518c2ecf20Sopenharmony_ci};
1528c2ecf20Sopenharmony_ci
1538c2ecf20Sopenharmony_ci/**
1548c2ecf20Sopenharmony_ci * struct mtk_eint_desc - the structure that providing information
1558c2ecf20Sopenharmony_ci *			       for eint data per pin
1568c2ecf20Sopenharmony_ci * @eint_m:		the eint mux for this pin
1578c2ecf20Sopenharmony_ci * @eitn_n:		the eint number for this pin
1588c2ecf20Sopenharmony_ci */
1598c2ecf20Sopenharmony_cistruct mtk_eint_desc {
1608c2ecf20Sopenharmony_ci	u16 eint_m;
1618c2ecf20Sopenharmony_ci	u16 eint_n;
1628c2ecf20Sopenharmony_ci};
1638c2ecf20Sopenharmony_ci
1648c2ecf20Sopenharmony_ci/**
1658c2ecf20Sopenharmony_ci * struct mtk_pin_desc - the structure that providing information
1668c2ecf20Sopenharmony_ci *			       for each pin of chips
1678c2ecf20Sopenharmony_ci * @number:		unique pin number from the global pin number space
1688c2ecf20Sopenharmony_ci * @name:		name for this pin
1698c2ecf20Sopenharmony_ci * @eint:		the eint data for this pin
1708c2ecf20Sopenharmony_ci * @drv_n:		the index with the driving group
1718c2ecf20Sopenharmony_ci * @funcs:		all available functions for this pins (only used in
1728c2ecf20Sopenharmony_ci *			those drivers compatible to pinctrl-mtk-common.c-like
1738c2ecf20Sopenharmony_ci *			ones)
1748c2ecf20Sopenharmony_ci */
1758c2ecf20Sopenharmony_cistruct mtk_pin_desc {
1768c2ecf20Sopenharmony_ci	unsigned int number;
1778c2ecf20Sopenharmony_ci	const char *name;
1788c2ecf20Sopenharmony_ci	struct mtk_eint_desc eint;
1798c2ecf20Sopenharmony_ci	u8 drv_n;
1808c2ecf20Sopenharmony_ci	struct mtk_func_desc *funcs;
1818c2ecf20Sopenharmony_ci};
1828c2ecf20Sopenharmony_ci
1838c2ecf20Sopenharmony_cistruct mtk_pinctrl_group {
1848c2ecf20Sopenharmony_ci	const char	*name;
1858c2ecf20Sopenharmony_ci	unsigned long	config;
1868c2ecf20Sopenharmony_ci	unsigned	pin;
1878c2ecf20Sopenharmony_ci};
1888c2ecf20Sopenharmony_ci
1898c2ecf20Sopenharmony_cistruct mtk_pinctrl;
1908c2ecf20Sopenharmony_ci
1918c2ecf20Sopenharmony_ci/* struct mtk_pin_soc - the structure that holds SoC-specific data */
1928c2ecf20Sopenharmony_cistruct mtk_pin_soc {
1938c2ecf20Sopenharmony_ci	const struct mtk_pin_reg_calc	*reg_cal;
1948c2ecf20Sopenharmony_ci	const struct mtk_pin_desc	*pins;
1958c2ecf20Sopenharmony_ci	unsigned int			npins;
1968c2ecf20Sopenharmony_ci	const struct group_desc		*grps;
1978c2ecf20Sopenharmony_ci	unsigned int			ngrps;
1988c2ecf20Sopenharmony_ci	const struct function_desc	*funcs;
1998c2ecf20Sopenharmony_ci	unsigned int			nfuncs;
2008c2ecf20Sopenharmony_ci	const struct mtk_eint_regs	*eint_regs;
2018c2ecf20Sopenharmony_ci	const struct mtk_eint_hw	*eint_hw;
2028c2ecf20Sopenharmony_ci
2038c2ecf20Sopenharmony_ci	/* Specific parameters per SoC */
2048c2ecf20Sopenharmony_ci	u8				gpio_m;
2058c2ecf20Sopenharmony_ci	bool				ies_present;
2068c2ecf20Sopenharmony_ci	const char * const		*base_names;
2078c2ecf20Sopenharmony_ci	unsigned int			nbase_names;
2088c2ecf20Sopenharmony_ci
2098c2ecf20Sopenharmony_ci	/* Specific pinconfig operations */
2108c2ecf20Sopenharmony_ci	int (*bias_disable_set)(struct mtk_pinctrl *hw,
2118c2ecf20Sopenharmony_ci				const struct mtk_pin_desc *desc);
2128c2ecf20Sopenharmony_ci	int (*bias_disable_get)(struct mtk_pinctrl *hw,
2138c2ecf20Sopenharmony_ci				const struct mtk_pin_desc *desc, int *res);
2148c2ecf20Sopenharmony_ci	int (*bias_set)(struct mtk_pinctrl *hw,
2158c2ecf20Sopenharmony_ci			const struct mtk_pin_desc *desc, bool pullup);
2168c2ecf20Sopenharmony_ci	int (*bias_get)(struct mtk_pinctrl *hw,
2178c2ecf20Sopenharmony_ci			const struct mtk_pin_desc *desc, bool pullup, int *res);
2188c2ecf20Sopenharmony_ci
2198c2ecf20Sopenharmony_ci	int (*bias_set_combo)(struct mtk_pinctrl *hw,
2208c2ecf20Sopenharmony_ci			const struct mtk_pin_desc *desc, u32 pullup, u32 arg);
2218c2ecf20Sopenharmony_ci	int (*bias_get_combo)(struct mtk_pinctrl *hw,
2228c2ecf20Sopenharmony_ci			const struct mtk_pin_desc *desc, u32 *pullup, u32 *arg);
2238c2ecf20Sopenharmony_ci
2248c2ecf20Sopenharmony_ci	int (*drive_set)(struct mtk_pinctrl *hw,
2258c2ecf20Sopenharmony_ci			 const struct mtk_pin_desc *desc, u32 arg);
2268c2ecf20Sopenharmony_ci	int (*drive_get)(struct mtk_pinctrl *hw,
2278c2ecf20Sopenharmony_ci			 const struct mtk_pin_desc *desc, int *val);
2288c2ecf20Sopenharmony_ci
2298c2ecf20Sopenharmony_ci	int (*adv_pull_set)(struct mtk_pinctrl *hw,
2308c2ecf20Sopenharmony_ci			    const struct mtk_pin_desc *desc, bool pullup,
2318c2ecf20Sopenharmony_ci			    u32 arg);
2328c2ecf20Sopenharmony_ci	int (*adv_pull_get)(struct mtk_pinctrl *hw,
2338c2ecf20Sopenharmony_ci			    const struct mtk_pin_desc *desc, bool pullup,
2348c2ecf20Sopenharmony_ci			    u32 *val);
2358c2ecf20Sopenharmony_ci	int (*adv_drive_set)(struct mtk_pinctrl *hw,
2368c2ecf20Sopenharmony_ci			     const struct mtk_pin_desc *desc, u32 arg);
2378c2ecf20Sopenharmony_ci	int (*adv_drive_get)(struct mtk_pinctrl *hw,
2388c2ecf20Sopenharmony_ci			     const struct mtk_pin_desc *desc, u32 *val);
2398c2ecf20Sopenharmony_ci
2408c2ecf20Sopenharmony_ci	/* Specific driver data */
2418c2ecf20Sopenharmony_ci	void				*driver_data;
2428c2ecf20Sopenharmony_ci};
2438c2ecf20Sopenharmony_ci
2448c2ecf20Sopenharmony_cistruct mtk_pinctrl {
2458c2ecf20Sopenharmony_ci	struct pinctrl_dev		*pctrl;
2468c2ecf20Sopenharmony_ci	void __iomem			**base;
2478c2ecf20Sopenharmony_ci	u8				nbase;
2488c2ecf20Sopenharmony_ci	struct device			*dev;
2498c2ecf20Sopenharmony_ci	struct gpio_chip		chip;
2508c2ecf20Sopenharmony_ci	const struct mtk_pin_soc        *soc;
2518c2ecf20Sopenharmony_ci	struct mtk_eint			*eint;
2528c2ecf20Sopenharmony_ci	struct mtk_pinctrl_group	*groups;
2538c2ecf20Sopenharmony_ci	const char          **grp_names;
2548c2ecf20Sopenharmony_ci};
2558c2ecf20Sopenharmony_ci
2568c2ecf20Sopenharmony_civoid mtk_rmw(struct mtk_pinctrl *pctl, u8 i, u32 reg, u32 mask, u32 set);
2578c2ecf20Sopenharmony_ci
2588c2ecf20Sopenharmony_ciint mtk_hw_set_value(struct mtk_pinctrl *hw, const struct mtk_pin_desc *desc,
2598c2ecf20Sopenharmony_ci		     int field, int value);
2608c2ecf20Sopenharmony_ciint mtk_hw_get_value(struct mtk_pinctrl *hw, const struct mtk_pin_desc *desc,
2618c2ecf20Sopenharmony_ci		     int field, int *value);
2628c2ecf20Sopenharmony_ci
2638c2ecf20Sopenharmony_ciint mtk_build_eint(struct mtk_pinctrl *hw, struct platform_device *pdev);
2648c2ecf20Sopenharmony_ci
2658c2ecf20Sopenharmony_ciint mtk_pinconf_bias_disable_set(struct mtk_pinctrl *hw,
2668c2ecf20Sopenharmony_ci				 const struct mtk_pin_desc *desc);
2678c2ecf20Sopenharmony_ciint mtk_pinconf_bias_disable_get(struct mtk_pinctrl *hw,
2688c2ecf20Sopenharmony_ci				 const struct mtk_pin_desc *desc, int *res);
2698c2ecf20Sopenharmony_ciint mtk_pinconf_bias_set(struct mtk_pinctrl *hw,
2708c2ecf20Sopenharmony_ci			 const struct mtk_pin_desc *desc, bool pullup);
2718c2ecf20Sopenharmony_ciint mtk_pinconf_bias_get(struct mtk_pinctrl *hw,
2728c2ecf20Sopenharmony_ci			 const struct mtk_pin_desc *desc, bool pullup,
2738c2ecf20Sopenharmony_ci			 int *res);
2748c2ecf20Sopenharmony_ci
2758c2ecf20Sopenharmony_ciint mtk_pinconf_bias_disable_set_rev1(struct mtk_pinctrl *hw,
2768c2ecf20Sopenharmony_ci				      const struct mtk_pin_desc *desc);
2778c2ecf20Sopenharmony_ciint mtk_pinconf_bias_disable_get_rev1(struct mtk_pinctrl *hw,
2788c2ecf20Sopenharmony_ci				      const struct mtk_pin_desc *desc,
2798c2ecf20Sopenharmony_ci				      int *res);
2808c2ecf20Sopenharmony_ciint mtk_pinconf_bias_set_rev1(struct mtk_pinctrl *hw,
2818c2ecf20Sopenharmony_ci			      const struct mtk_pin_desc *desc, bool pullup);
2828c2ecf20Sopenharmony_ciint mtk_pinconf_bias_get_rev1(struct mtk_pinctrl *hw,
2838c2ecf20Sopenharmony_ci			      const struct mtk_pin_desc *desc, bool pullup,
2848c2ecf20Sopenharmony_ci			      int *res);
2858c2ecf20Sopenharmony_ciint mtk_pinconf_bias_set_combo(struct mtk_pinctrl *hw,
2868c2ecf20Sopenharmony_ci				const struct mtk_pin_desc *desc,
2878c2ecf20Sopenharmony_ci				u32 pullup, u32 enable);
2888c2ecf20Sopenharmony_ciint mtk_pinconf_bias_get_combo(struct mtk_pinctrl *hw,
2898c2ecf20Sopenharmony_ci			      const struct mtk_pin_desc *desc,
2908c2ecf20Sopenharmony_ci			      u32 *pullup, u32 *enable);
2918c2ecf20Sopenharmony_ci
2928c2ecf20Sopenharmony_ciint mtk_pinconf_drive_set(struct mtk_pinctrl *hw,
2938c2ecf20Sopenharmony_ci			  const struct mtk_pin_desc *desc, u32 arg);
2948c2ecf20Sopenharmony_ciint mtk_pinconf_drive_get(struct mtk_pinctrl *hw,
2958c2ecf20Sopenharmony_ci			  const struct mtk_pin_desc *desc, int *val);
2968c2ecf20Sopenharmony_ci
2978c2ecf20Sopenharmony_ciint mtk_pinconf_drive_set_rev1(struct mtk_pinctrl *hw,
2988c2ecf20Sopenharmony_ci			       const struct mtk_pin_desc *desc, u32 arg);
2998c2ecf20Sopenharmony_ciint mtk_pinconf_drive_get_rev1(struct mtk_pinctrl *hw,
3008c2ecf20Sopenharmony_ci			       const struct mtk_pin_desc *desc, int *val);
3018c2ecf20Sopenharmony_ci
3028c2ecf20Sopenharmony_ciint mtk_pinconf_drive_set_raw(struct mtk_pinctrl *hw,
3038c2ecf20Sopenharmony_ci			       const struct mtk_pin_desc *desc, u32 arg);
3048c2ecf20Sopenharmony_ciint mtk_pinconf_drive_get_raw(struct mtk_pinctrl *hw,
3058c2ecf20Sopenharmony_ci			       const struct mtk_pin_desc *desc, int *val);
3068c2ecf20Sopenharmony_ci
3078c2ecf20Sopenharmony_ciint mtk_pinconf_adv_pull_set(struct mtk_pinctrl *hw,
3088c2ecf20Sopenharmony_ci			     const struct mtk_pin_desc *desc, bool pullup,
3098c2ecf20Sopenharmony_ci			     u32 arg);
3108c2ecf20Sopenharmony_ciint mtk_pinconf_adv_pull_get(struct mtk_pinctrl *hw,
3118c2ecf20Sopenharmony_ci			     const struct mtk_pin_desc *desc, bool pullup,
3128c2ecf20Sopenharmony_ci			     u32 *val);
3138c2ecf20Sopenharmony_ciint mtk_pinconf_adv_drive_set(struct mtk_pinctrl *hw,
3148c2ecf20Sopenharmony_ci			      const struct mtk_pin_desc *desc, u32 arg);
3158c2ecf20Sopenharmony_ciint mtk_pinconf_adv_drive_get(struct mtk_pinctrl *hw,
3168c2ecf20Sopenharmony_ci			      const struct mtk_pin_desc *desc, u32 *val);
3178c2ecf20Sopenharmony_ci
3188c2ecf20Sopenharmony_cibool mtk_is_virt_gpio(struct mtk_pinctrl *hw, unsigned int gpio_n);
3198c2ecf20Sopenharmony_ci#endif /* __PINCTRL_MTK_COMMON_V2_H */
320