162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (C) 2018 MediaTek Inc.
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Author: Sean Wang <sean.wang@mediatek.com>
662306a36Sopenharmony_ci *
762306a36Sopenharmony_ci */
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#ifndef __PINCTRL_MTK_COMMON_V2_H
1062306a36Sopenharmony_ci#define __PINCTRL_MTK_COMMON_V2_H
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci#include <linux/gpio/driver.h>
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci#define MTK_INPUT      0
1562306a36Sopenharmony_ci#define MTK_OUTPUT     1
1662306a36Sopenharmony_ci#define MTK_DISABLE    0
1762306a36Sopenharmony_ci#define MTK_ENABLE     1
1862306a36Sopenharmony_ci#define MTK_PULLDOWN   0
1962306a36Sopenharmony_ci#define MTK_PULLUP     1
2062306a36Sopenharmony_ci#define MTK_PULL_PU_PD_TYPE		BIT(0)
2162306a36Sopenharmony_ci#define MTK_PULL_PULLSEL_TYPE		BIT(1)
2262306a36Sopenharmony_ci#define MTK_PULL_PUPD_R1R0_TYPE		BIT(2)
2362306a36Sopenharmony_ci/* MTK_PULL_RSEL_TYPE can select resistance and can be
2462306a36Sopenharmony_ci * turned on/off itself. But it can't be selected pull up/down
2562306a36Sopenharmony_ci */
2662306a36Sopenharmony_ci#define MTK_PULL_RSEL_TYPE		BIT(3)
2762306a36Sopenharmony_ci/* MTK_PULL_PU_PD_RSEL_TYPE is a type which is controlled by
2862306a36Sopenharmony_ci * MTK_PULL_PU_PD_TYPE and MTK_PULL_RSEL_TYPE.
2962306a36Sopenharmony_ci */
3062306a36Sopenharmony_ci#define MTK_PULL_PU_PD_RSEL_TYPE	(MTK_PULL_PU_PD_TYPE \
3162306a36Sopenharmony_ci					| MTK_PULL_RSEL_TYPE)
3262306a36Sopenharmony_ci#define MTK_PULL_TYPE_MASK	(MTK_PULL_PU_PD_TYPE |\
3362306a36Sopenharmony_ci				 MTK_PULL_PULLSEL_TYPE |\
3462306a36Sopenharmony_ci				 MTK_PULL_PUPD_R1R0_TYPE |\
3562306a36Sopenharmony_ci				 MTK_PULL_RSEL_TYPE)
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci#define EINT_NA	U16_MAX
3862306a36Sopenharmony_ci#define NO_EINT_SUPPORT	EINT_NA
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci#define PIN_FIELD_CALC(_s_pin, _e_pin, _i_base, _s_addr, _x_addrs,      \
4162306a36Sopenharmony_ci		       _s_bit, _x_bits, _sz_reg, _fixed) {		\
4262306a36Sopenharmony_ci		.s_pin = _s_pin,					\
4362306a36Sopenharmony_ci		.e_pin = _e_pin,					\
4462306a36Sopenharmony_ci		.i_base = _i_base,					\
4562306a36Sopenharmony_ci		.s_addr = _s_addr,					\
4662306a36Sopenharmony_ci		.x_addrs = _x_addrs,					\
4762306a36Sopenharmony_ci		.s_bit = _s_bit,					\
4862306a36Sopenharmony_ci		.x_bits = _x_bits,					\
4962306a36Sopenharmony_ci		.sz_reg = _sz_reg,					\
5062306a36Sopenharmony_ci		.fixed = _fixed,					\
5162306a36Sopenharmony_ci	}
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ci#define PIN_FIELD(_s_pin, _e_pin, _s_addr, _x_addrs, _s_bit, _x_bits)	\
5462306a36Sopenharmony_ci	PIN_FIELD_CALC(_s_pin, _e_pin, 0, _s_addr, _x_addrs, _s_bit,	\
5562306a36Sopenharmony_ci		       _x_bits, 32, 0)
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ci#define PINS_FIELD(_s_pin, _e_pin, _s_addr, _x_addrs, _s_bit, _x_bits)	\
5862306a36Sopenharmony_ci	PIN_FIELD_CALC(_s_pin, _e_pin, 0, _s_addr, _x_addrs, _s_bit,	\
5962306a36Sopenharmony_ci		       _x_bits, 32, 1)
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ci#define PIN_RSEL(_s_pin, _e_pin, _rsel_index, _up_resl, _down_rsel) {	\
6262306a36Sopenharmony_ci		.s_pin = _s_pin,					\
6362306a36Sopenharmony_ci		.e_pin = _e_pin,					\
6462306a36Sopenharmony_ci		.rsel_index = _rsel_index,				\
6562306a36Sopenharmony_ci		.up_rsel = _up_resl,					\
6662306a36Sopenharmony_ci		.down_rsel = _down_rsel,				\
6762306a36Sopenharmony_ci	}
6862306a36Sopenharmony_ci
6962306a36Sopenharmony_ci/* List these attributes which could be modified for the pin */
7062306a36Sopenharmony_cienum {
7162306a36Sopenharmony_ci	PINCTRL_PIN_REG_MODE,
7262306a36Sopenharmony_ci	PINCTRL_PIN_REG_DIR,
7362306a36Sopenharmony_ci	PINCTRL_PIN_REG_DI,
7462306a36Sopenharmony_ci	PINCTRL_PIN_REG_DO,
7562306a36Sopenharmony_ci	PINCTRL_PIN_REG_SR,
7662306a36Sopenharmony_ci	PINCTRL_PIN_REG_SMT,
7762306a36Sopenharmony_ci	PINCTRL_PIN_REG_PD,
7862306a36Sopenharmony_ci	PINCTRL_PIN_REG_PU,
7962306a36Sopenharmony_ci	PINCTRL_PIN_REG_E4,
8062306a36Sopenharmony_ci	PINCTRL_PIN_REG_E8,
8162306a36Sopenharmony_ci	PINCTRL_PIN_REG_TDSEL,
8262306a36Sopenharmony_ci	PINCTRL_PIN_REG_RDSEL,
8362306a36Sopenharmony_ci	PINCTRL_PIN_REG_DRV,
8462306a36Sopenharmony_ci	PINCTRL_PIN_REG_PUPD,
8562306a36Sopenharmony_ci	PINCTRL_PIN_REG_R0,
8662306a36Sopenharmony_ci	PINCTRL_PIN_REG_R1,
8762306a36Sopenharmony_ci	PINCTRL_PIN_REG_IES,
8862306a36Sopenharmony_ci	PINCTRL_PIN_REG_PULLEN,
8962306a36Sopenharmony_ci	PINCTRL_PIN_REG_PULLSEL,
9062306a36Sopenharmony_ci	PINCTRL_PIN_REG_DRV_EN,
9162306a36Sopenharmony_ci	PINCTRL_PIN_REG_DRV_E0,
9262306a36Sopenharmony_ci	PINCTRL_PIN_REG_DRV_E1,
9362306a36Sopenharmony_ci	PINCTRL_PIN_REG_DRV_ADV,
9462306a36Sopenharmony_ci	PINCTRL_PIN_REG_RSEL,
9562306a36Sopenharmony_ci	PINCTRL_PIN_REG_MAX,
9662306a36Sopenharmony_ci};
9762306a36Sopenharmony_ci
9862306a36Sopenharmony_ci/* Group the pins by the driving current */
9962306a36Sopenharmony_cienum {
10062306a36Sopenharmony_ci	DRV_FIXED,
10162306a36Sopenharmony_ci	DRV_GRP0,
10262306a36Sopenharmony_ci	DRV_GRP1,
10362306a36Sopenharmony_ci	DRV_GRP2,
10462306a36Sopenharmony_ci	DRV_GRP3,
10562306a36Sopenharmony_ci	DRV_GRP4,
10662306a36Sopenharmony_ci	DRV_GRP_MAX,
10762306a36Sopenharmony_ci};
10862306a36Sopenharmony_ci
10962306a36Sopenharmony_cistatic const char * const mtk_default_register_base_names[] __maybe_unused = {
11062306a36Sopenharmony_ci	"base",
11162306a36Sopenharmony_ci};
11262306a36Sopenharmony_ci
11362306a36Sopenharmony_ci/* struct mtk_pin_field - the structure that holds the information of the field
11462306a36Sopenharmony_ci *			  used to describe the attribute for the pin
11562306a36Sopenharmony_ci * @base:		the index pointing to the entry in base address list
11662306a36Sopenharmony_ci * @offset:		the register offset relative to the base address
11762306a36Sopenharmony_ci * @mask:		the mask used to filter out the field from the register
11862306a36Sopenharmony_ci * @bitpos:		the start bit relative to the register
11962306a36Sopenharmony_ci * @next:		the indication that the field would be extended to the
12062306a36Sopenharmony_ci			next register
12162306a36Sopenharmony_ci */
12262306a36Sopenharmony_cistruct mtk_pin_field {
12362306a36Sopenharmony_ci	u8  index;
12462306a36Sopenharmony_ci	u32 offset;
12562306a36Sopenharmony_ci	u32 mask;
12662306a36Sopenharmony_ci	u8  bitpos;
12762306a36Sopenharmony_ci	u8  next;
12862306a36Sopenharmony_ci};
12962306a36Sopenharmony_ci
13062306a36Sopenharmony_ci/* struct mtk_pin_field_calc - the structure that holds the range providing
13162306a36Sopenharmony_ci *			       the guide used to look up the relevant field
13262306a36Sopenharmony_ci * @s_pin:		the start pin within the range
13362306a36Sopenharmony_ci * @e_pin:		the end pin within the range
13462306a36Sopenharmony_ci * @i_base:		the index pointing to the entry in base address list
13562306a36Sopenharmony_ci * @s_addr:		the start address for the range
13662306a36Sopenharmony_ci * @x_addrs:		the address distance between two consecutive registers
13762306a36Sopenharmony_ci *			within the range
13862306a36Sopenharmony_ci * @s_bit:		the start bit for the first register within the range
13962306a36Sopenharmony_ci * @x_bits:		the bit distance between two consecutive pins within
14062306a36Sopenharmony_ci *			the range
14162306a36Sopenharmony_ci * @sz_reg:		the size of bits in a register
14262306a36Sopenharmony_ci * @fixed:		the consecutive pins share the same bits with the 1st
14362306a36Sopenharmony_ci *			pin
14462306a36Sopenharmony_ci */
14562306a36Sopenharmony_cistruct mtk_pin_field_calc {
14662306a36Sopenharmony_ci	u16 s_pin;
14762306a36Sopenharmony_ci	u16 e_pin;
14862306a36Sopenharmony_ci	u8  i_base;
14962306a36Sopenharmony_ci	u32 s_addr;
15062306a36Sopenharmony_ci	u8  x_addrs;
15162306a36Sopenharmony_ci	u8  s_bit;
15262306a36Sopenharmony_ci	u8  x_bits;
15362306a36Sopenharmony_ci	u8  sz_reg;
15462306a36Sopenharmony_ci	u8  fixed;
15562306a36Sopenharmony_ci};
15662306a36Sopenharmony_ci
15762306a36Sopenharmony_ci/**
15862306a36Sopenharmony_ci * struct mtk_pin_rsel - the structure that provides bias resistance selection.
15962306a36Sopenharmony_ci * @s_pin:		the start pin within the rsel range
16062306a36Sopenharmony_ci * @e_pin:		the end pin within the rsel range
16162306a36Sopenharmony_ci * @rsel_index:	the rsel bias resistance index
16262306a36Sopenharmony_ci * @up_rsel:	the pullup rsel bias resistance value
16362306a36Sopenharmony_ci * @down_rsel:	the pulldown rsel bias resistance value
16462306a36Sopenharmony_ci */
16562306a36Sopenharmony_cistruct mtk_pin_rsel {
16662306a36Sopenharmony_ci	u16 s_pin;
16762306a36Sopenharmony_ci	u16 e_pin;
16862306a36Sopenharmony_ci	u16 rsel_index;
16962306a36Sopenharmony_ci	u32 up_rsel;
17062306a36Sopenharmony_ci	u32 down_rsel;
17162306a36Sopenharmony_ci};
17262306a36Sopenharmony_ci
17362306a36Sopenharmony_ci/* struct mtk_pin_reg_calc - the structure that holds all ranges used to
17462306a36Sopenharmony_ci *			     determine which register the pin would make use of
17562306a36Sopenharmony_ci *			     for certain pin attribute.
17662306a36Sopenharmony_ci * @range:		     the start address for the range
17762306a36Sopenharmony_ci * @nranges:		     the number of items in the range
17862306a36Sopenharmony_ci */
17962306a36Sopenharmony_cistruct mtk_pin_reg_calc {
18062306a36Sopenharmony_ci	const struct mtk_pin_field_calc *range;
18162306a36Sopenharmony_ci	unsigned int nranges;
18262306a36Sopenharmony_ci};
18362306a36Sopenharmony_ci
18462306a36Sopenharmony_ci/**
18562306a36Sopenharmony_ci * struct mtk_func_desc - the structure that providing information
18662306a36Sopenharmony_ci *			  all the funcs for this pin
18762306a36Sopenharmony_ci * @name:		the name of function
18862306a36Sopenharmony_ci * @muxval:		the mux to the function
18962306a36Sopenharmony_ci */
19062306a36Sopenharmony_cistruct mtk_func_desc {
19162306a36Sopenharmony_ci	const char *name;
19262306a36Sopenharmony_ci	u8 muxval;
19362306a36Sopenharmony_ci};
19462306a36Sopenharmony_ci
19562306a36Sopenharmony_ci/**
19662306a36Sopenharmony_ci * struct mtk_eint_desc - the structure that providing information
19762306a36Sopenharmony_ci *			       for eint data per pin
19862306a36Sopenharmony_ci * @eint_m:		the eint mux for this pin
19962306a36Sopenharmony_ci * @eitn_n:		the eint number for this pin
20062306a36Sopenharmony_ci */
20162306a36Sopenharmony_cistruct mtk_eint_desc {
20262306a36Sopenharmony_ci	u16 eint_m;
20362306a36Sopenharmony_ci	u16 eint_n;
20462306a36Sopenharmony_ci};
20562306a36Sopenharmony_ci
20662306a36Sopenharmony_ci/**
20762306a36Sopenharmony_ci * struct mtk_pin_desc - the structure that providing information
20862306a36Sopenharmony_ci *			       for each pin of chips
20962306a36Sopenharmony_ci * @number:		unique pin number from the global pin number space
21062306a36Sopenharmony_ci * @name:		name for this pin
21162306a36Sopenharmony_ci * @eint:		the eint data for this pin
21262306a36Sopenharmony_ci * @drv_n:		the index with the driving group
21362306a36Sopenharmony_ci * @funcs:		all available functions for this pins (only used in
21462306a36Sopenharmony_ci *			those drivers compatible to pinctrl-mtk-common.c-like
21562306a36Sopenharmony_ci *			ones)
21662306a36Sopenharmony_ci */
21762306a36Sopenharmony_cistruct mtk_pin_desc {
21862306a36Sopenharmony_ci	unsigned int number;
21962306a36Sopenharmony_ci	const char *name;
22062306a36Sopenharmony_ci	struct mtk_eint_desc eint;
22162306a36Sopenharmony_ci	u8 drv_n;
22262306a36Sopenharmony_ci	struct mtk_func_desc *funcs;
22362306a36Sopenharmony_ci};
22462306a36Sopenharmony_ci
22562306a36Sopenharmony_cistruct mtk_pinctrl_group {
22662306a36Sopenharmony_ci	const char	*name;
22762306a36Sopenharmony_ci	unsigned long	config;
22862306a36Sopenharmony_ci	unsigned	pin;
22962306a36Sopenharmony_ci};
23062306a36Sopenharmony_ci
23162306a36Sopenharmony_cistruct mtk_pinctrl;
23262306a36Sopenharmony_ci
23362306a36Sopenharmony_ci/* struct mtk_pin_soc - the structure that holds SoC-specific data */
23462306a36Sopenharmony_cistruct mtk_pin_soc {
23562306a36Sopenharmony_ci	const struct mtk_pin_reg_calc	*reg_cal;
23662306a36Sopenharmony_ci	const struct mtk_pin_desc	*pins;
23762306a36Sopenharmony_ci	unsigned int			npins;
23862306a36Sopenharmony_ci	const struct group_desc		*grps;
23962306a36Sopenharmony_ci	unsigned int			ngrps;
24062306a36Sopenharmony_ci	const struct function_desc	*funcs;
24162306a36Sopenharmony_ci	unsigned int			nfuncs;
24262306a36Sopenharmony_ci	const struct mtk_eint_regs	*eint_regs;
24362306a36Sopenharmony_ci	const struct mtk_eint_hw	*eint_hw;
24462306a36Sopenharmony_ci
24562306a36Sopenharmony_ci	/* Specific parameters per SoC */
24662306a36Sopenharmony_ci	u8				gpio_m;
24762306a36Sopenharmony_ci	bool				ies_present;
24862306a36Sopenharmony_ci	const char * const		*base_names;
24962306a36Sopenharmony_ci	unsigned int			nbase_names;
25062306a36Sopenharmony_ci	const unsigned int		*pull_type;
25162306a36Sopenharmony_ci	const struct mtk_pin_rsel	*pin_rsel;
25262306a36Sopenharmony_ci	unsigned int			npin_rsel;
25362306a36Sopenharmony_ci
25462306a36Sopenharmony_ci	/* Specific pinconfig operations */
25562306a36Sopenharmony_ci	int (*bias_disable_set)(struct mtk_pinctrl *hw,
25662306a36Sopenharmony_ci				const struct mtk_pin_desc *desc);
25762306a36Sopenharmony_ci	int (*bias_disable_get)(struct mtk_pinctrl *hw,
25862306a36Sopenharmony_ci				const struct mtk_pin_desc *desc, int *res);
25962306a36Sopenharmony_ci	int (*bias_set)(struct mtk_pinctrl *hw,
26062306a36Sopenharmony_ci			const struct mtk_pin_desc *desc, bool pullup);
26162306a36Sopenharmony_ci	int (*bias_get)(struct mtk_pinctrl *hw,
26262306a36Sopenharmony_ci			const struct mtk_pin_desc *desc, bool pullup, int *res);
26362306a36Sopenharmony_ci
26462306a36Sopenharmony_ci	int (*bias_set_combo)(struct mtk_pinctrl *hw,
26562306a36Sopenharmony_ci			const struct mtk_pin_desc *desc, u32 pullup, u32 arg);
26662306a36Sopenharmony_ci	int (*bias_get_combo)(struct mtk_pinctrl *hw,
26762306a36Sopenharmony_ci			const struct mtk_pin_desc *desc, u32 *pullup, u32 *arg);
26862306a36Sopenharmony_ci
26962306a36Sopenharmony_ci	int (*drive_set)(struct mtk_pinctrl *hw,
27062306a36Sopenharmony_ci			 const struct mtk_pin_desc *desc, u32 arg);
27162306a36Sopenharmony_ci	int (*drive_get)(struct mtk_pinctrl *hw,
27262306a36Sopenharmony_ci			 const struct mtk_pin_desc *desc, int *val);
27362306a36Sopenharmony_ci
27462306a36Sopenharmony_ci	int (*adv_pull_set)(struct mtk_pinctrl *hw,
27562306a36Sopenharmony_ci			    const struct mtk_pin_desc *desc, bool pullup,
27662306a36Sopenharmony_ci			    u32 arg);
27762306a36Sopenharmony_ci	int (*adv_pull_get)(struct mtk_pinctrl *hw,
27862306a36Sopenharmony_ci			    const struct mtk_pin_desc *desc, bool pullup,
27962306a36Sopenharmony_ci			    u32 *val);
28062306a36Sopenharmony_ci	int (*adv_drive_set)(struct mtk_pinctrl *hw,
28162306a36Sopenharmony_ci			     const struct mtk_pin_desc *desc, u32 arg);
28262306a36Sopenharmony_ci	int (*adv_drive_get)(struct mtk_pinctrl *hw,
28362306a36Sopenharmony_ci			     const struct mtk_pin_desc *desc, u32 *val);
28462306a36Sopenharmony_ci
28562306a36Sopenharmony_ci	/* Specific driver data */
28662306a36Sopenharmony_ci	void				*driver_data;
28762306a36Sopenharmony_ci};
28862306a36Sopenharmony_ci
28962306a36Sopenharmony_cistruct mtk_pinctrl {
29062306a36Sopenharmony_ci	struct pinctrl_dev		*pctrl;
29162306a36Sopenharmony_ci	void __iomem			**base;
29262306a36Sopenharmony_ci	u8				nbase;
29362306a36Sopenharmony_ci	struct device			*dev;
29462306a36Sopenharmony_ci	struct gpio_chip		chip;
29562306a36Sopenharmony_ci	const struct mtk_pin_soc        *soc;
29662306a36Sopenharmony_ci	struct mtk_eint			*eint;
29762306a36Sopenharmony_ci	struct mtk_pinctrl_group	*groups;
29862306a36Sopenharmony_ci	const char          **grp_names;
29962306a36Sopenharmony_ci	/* lock pin's register resource to avoid multiple threads issue*/
30062306a36Sopenharmony_ci	spinlock_t lock;
30162306a36Sopenharmony_ci	/* identify rsel setting by si unit or rsel define in dts node */
30262306a36Sopenharmony_ci	bool rsel_si_unit;
30362306a36Sopenharmony_ci};
30462306a36Sopenharmony_ci
30562306a36Sopenharmony_civoid mtk_rmw(struct mtk_pinctrl *pctl, u8 i, u32 reg, u32 mask, u32 set);
30662306a36Sopenharmony_ci
30762306a36Sopenharmony_ciint mtk_hw_set_value(struct mtk_pinctrl *hw, const struct mtk_pin_desc *desc,
30862306a36Sopenharmony_ci		     int field, int value);
30962306a36Sopenharmony_ciint mtk_hw_get_value(struct mtk_pinctrl *hw, const struct mtk_pin_desc *desc,
31062306a36Sopenharmony_ci		     int field, int *value);
31162306a36Sopenharmony_ci
31262306a36Sopenharmony_ciint mtk_build_eint(struct mtk_pinctrl *hw, struct platform_device *pdev);
31362306a36Sopenharmony_ci
31462306a36Sopenharmony_ciint mtk_pinconf_bias_disable_set(struct mtk_pinctrl *hw,
31562306a36Sopenharmony_ci				 const struct mtk_pin_desc *desc);
31662306a36Sopenharmony_ciint mtk_pinconf_bias_disable_get(struct mtk_pinctrl *hw,
31762306a36Sopenharmony_ci				 const struct mtk_pin_desc *desc, int *res);
31862306a36Sopenharmony_ciint mtk_pinconf_bias_set(struct mtk_pinctrl *hw,
31962306a36Sopenharmony_ci			 const struct mtk_pin_desc *desc, bool pullup);
32062306a36Sopenharmony_ciint mtk_pinconf_bias_get(struct mtk_pinctrl *hw,
32162306a36Sopenharmony_ci			 const struct mtk_pin_desc *desc, bool pullup,
32262306a36Sopenharmony_ci			 int *res);
32362306a36Sopenharmony_ci
32462306a36Sopenharmony_ciint mtk_pinconf_bias_disable_set_rev1(struct mtk_pinctrl *hw,
32562306a36Sopenharmony_ci				      const struct mtk_pin_desc *desc);
32662306a36Sopenharmony_ciint mtk_pinconf_bias_disable_get_rev1(struct mtk_pinctrl *hw,
32762306a36Sopenharmony_ci				      const struct mtk_pin_desc *desc,
32862306a36Sopenharmony_ci				      int *res);
32962306a36Sopenharmony_ciint mtk_pinconf_bias_set_rev1(struct mtk_pinctrl *hw,
33062306a36Sopenharmony_ci			      const struct mtk_pin_desc *desc, bool pullup);
33162306a36Sopenharmony_ciint mtk_pinconf_bias_get_rev1(struct mtk_pinctrl *hw,
33262306a36Sopenharmony_ci			      const struct mtk_pin_desc *desc, bool pullup,
33362306a36Sopenharmony_ci			      int *res);
33462306a36Sopenharmony_ciint mtk_pinconf_bias_set_combo(struct mtk_pinctrl *hw,
33562306a36Sopenharmony_ci				const struct mtk_pin_desc *desc,
33662306a36Sopenharmony_ci				u32 pullup, u32 enable);
33762306a36Sopenharmony_ciint mtk_pinconf_bias_get_combo(struct mtk_pinctrl *hw,
33862306a36Sopenharmony_ci			      const struct mtk_pin_desc *desc,
33962306a36Sopenharmony_ci			      u32 *pullup, u32 *enable);
34062306a36Sopenharmony_ci
34162306a36Sopenharmony_ciint mtk_pinconf_drive_set(struct mtk_pinctrl *hw,
34262306a36Sopenharmony_ci			  const struct mtk_pin_desc *desc, u32 arg);
34362306a36Sopenharmony_ciint mtk_pinconf_drive_get(struct mtk_pinctrl *hw,
34462306a36Sopenharmony_ci			  const struct mtk_pin_desc *desc, int *val);
34562306a36Sopenharmony_ci
34662306a36Sopenharmony_ciint mtk_pinconf_drive_set_rev1(struct mtk_pinctrl *hw,
34762306a36Sopenharmony_ci			       const struct mtk_pin_desc *desc, u32 arg);
34862306a36Sopenharmony_ciint mtk_pinconf_drive_get_rev1(struct mtk_pinctrl *hw,
34962306a36Sopenharmony_ci			       const struct mtk_pin_desc *desc, int *val);
35062306a36Sopenharmony_ci
35162306a36Sopenharmony_ciint mtk_pinconf_drive_set_raw(struct mtk_pinctrl *hw,
35262306a36Sopenharmony_ci			       const struct mtk_pin_desc *desc, u32 arg);
35362306a36Sopenharmony_ciint mtk_pinconf_drive_get_raw(struct mtk_pinctrl *hw,
35462306a36Sopenharmony_ci			       const struct mtk_pin_desc *desc, int *val);
35562306a36Sopenharmony_ci
35662306a36Sopenharmony_ciint mtk_pinconf_adv_pull_set(struct mtk_pinctrl *hw,
35762306a36Sopenharmony_ci			     const struct mtk_pin_desc *desc, bool pullup,
35862306a36Sopenharmony_ci			     u32 arg);
35962306a36Sopenharmony_ciint mtk_pinconf_adv_pull_get(struct mtk_pinctrl *hw,
36062306a36Sopenharmony_ci			     const struct mtk_pin_desc *desc, bool pullup,
36162306a36Sopenharmony_ci			     u32 *val);
36262306a36Sopenharmony_ciint mtk_pinconf_adv_drive_set(struct mtk_pinctrl *hw,
36362306a36Sopenharmony_ci			      const struct mtk_pin_desc *desc, u32 arg);
36462306a36Sopenharmony_ciint mtk_pinconf_adv_drive_get(struct mtk_pinctrl *hw,
36562306a36Sopenharmony_ci			      const struct mtk_pin_desc *desc, u32 *val);
36662306a36Sopenharmony_ciint mtk_pinconf_adv_drive_set_raw(struct mtk_pinctrl *hw,
36762306a36Sopenharmony_ci				  const struct mtk_pin_desc *desc, u32 arg);
36862306a36Sopenharmony_ciint mtk_pinconf_adv_drive_get_raw(struct mtk_pinctrl *hw,
36962306a36Sopenharmony_ci				  const struct mtk_pin_desc *desc, u32 *val);
37062306a36Sopenharmony_ci
37162306a36Sopenharmony_cibool mtk_is_virt_gpio(struct mtk_pinctrl *hw, unsigned int gpio_n);
37262306a36Sopenharmony_ci#endif /* __PINCTRL_MTK_COMMON_V2_H */
373