diff options
author | Yingjoe Chen <yingjoe.chen@mediatek.com> | 2015-05-19 08:11:15 +0200 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2015-05-19 11:13:51 +0200 |
commit | e73fe2713fc9e8ab8d2d039abc48f7684b60f5ac (patch) | |
tree | 69cf94dbda42e8a3a9a936e780de44afceaa0011 /drivers/pinctrl/mediatek/pinctrl-mtk-common.h | |
parent | pinctrl: mediatek: data struct optimize and remove unused member (diff) | |
download | linux-e73fe2713fc9e8ab8d2d039abc48f7684b60f5ac.tar.xz linux-e73fe2713fc9e8ab8d2d039abc48f7684b60f5ac.zip |
pinctrl: mediatek: add mtk_pctrl_spec_pull_set_samereg common code
Several mediatek soc use similar pull setting procedure as mt8173,
the pupd enable and resistance setting are in the same register.
Add common code mtk_pctrl_spec_pull_set_samereg out of spec_pull_set
in mt8173 to handle this case, so future soc driver can use it.
Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
Signed-off-by: Hongzhou Yang <hongzhou.yang@mediatek.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to '')
-rw-r--r-- | drivers/pinctrl/mediatek/pinctrl-mtk-common.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.h b/drivers/pinctrl/mediatek/pinctrl-mtk-common.h index 150884967061..2a4b7bee4564 100644 --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.h +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.h @@ -117,6 +117,32 @@ struct mtk_pin_drv_grp { .grp = _grp, \ } +/** + * struct mtk_pin_spec_pupd_set_samereg + * - For special pins' pull up/down setting which resides in same register + * @pin: The pin number. + * @offset: The offset of special pull up/down setting register. + * @pupd_bit: The pull up/down bit in this register. + * @r0_bit: The r0 bit of pull resistor. + * @r1_bit: The r1 bit of pull resistor. + */ +struct mtk_pin_spec_pupd_set_samereg { + unsigned short pin; + unsigned short offset; + unsigned char pupd_bit; + unsigned char r1_bit; + unsigned char r0_bit; +}; + +#define MTK_PIN_PUPD_SPEC_SR(_pin, _offset, _pupd, _r1, _r0) \ + { \ + .pin = _pin, \ + .offset = _offset, \ + .pupd_bit = _pupd, \ + .r1_bit = _r1, \ + .r0_bit = _r0, \ + } + struct mtk_eint_offsets { const char *name; unsigned int stat; @@ -220,4 +246,9 @@ struct mtk_pinctrl { int mtk_pctrl_init(struct platform_device *pdev, const struct mtk_pinctrl_devdata *data); +int mtk_pctrl_spec_pull_set_samereg(struct regmap *regmap, + const struct mtk_pin_spec_pupd_set_samereg *pupd_infos, + unsigned int info_num, unsigned int pin, + unsigned char align, bool isup, unsigned int r1r0); + #endif /* __PINCTRL_MTK_COMMON_H */ |