summaryrefslogtreecommitdiff
path: root/drivers/pinctrl/mediatek/pinctrl-mt2712.c
diff options
context:
space:
mode:
authorAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>2022-02-22 14:11:44 +0300
committerLinus Walleij <linus.walleij@linaro.org>2022-03-17 04:06:53 +0300
commit156f721704b5c9e8fae02270f606f09d710ff27e (patch)
tree84b296095ac0525823a673fe4c4cc7d8c207c58b /drivers/pinctrl/mediatek/pinctrl-mt2712.c
parentc19763c3de3718b8d8472e180421aa9d4a86770f (diff)
downloadlinux-156f721704b5c9e8fae02270f606f09d710ff27e.tar.xz
pinctrl: mediatek: common-v1: Commonize spec_ies_smt_set callback
All of the MediaTek pinctrl drivers registering with pinctrl-mtk-common that are offering a .spec_ies_smt_set() callback are declaring their own function which is doing exactly the same on all drivers: calling mtk_pconf_spec_set_ies_smt_range() with their struct and a simple check. Commonize this callback by adding the ies and smt structure pointers to struct mtk_pinctrl_devdata and changing the callback signature to take it. Removing the callback and checking for the existance of the spec_smt and/or spec_ies data would allow us to staticize the function mtk_pconf_spec_set_ies_smt_range(), but this solution was avoided as to keep flexibility, as some SoCs may need to perform a very different operation compared to what this commonized function is doing. Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Reviewed-by: Chen-Yu Tsai <wenst@chromium.org> Link: https://lore.kernel.org/r/20220222111144.20796-6-angelogioacchino.delregno@collabora.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/mediatek/pinctrl-mt2712.c')
-rw-r--r--drivers/pinctrl/mediatek/pinctrl-mt2712.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/drivers/pinctrl/mediatek/pinctrl-mt2712.c b/drivers/pinctrl/mediatek/pinctrl-mt2712.c
index b6182b06584b..b921068f9e69 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mt2712.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mt2712.c
@@ -275,19 +275,6 @@ static const struct mtk_pin_ies_smt_set mt2712_ies_set[] = {
MTK_PIN_IES_SMT_SPEC(207, 209, 0x8b0, 15)
};
-static int mt2712_ies_smt_set(struct regmap *regmap, unsigned int pin,
- unsigned char align,
- int value, enum pin_config_param arg)
-{
- if (arg == PIN_CONFIG_INPUT_ENABLE)
- return mtk_pconf_spec_set_ies_smt_range(regmap, mt2712_ies_set,
- ARRAY_SIZE(mt2712_ies_set), pin, align, value);
- if (arg == PIN_CONFIG_INPUT_SCHMITT_ENABLE)
- return mtk_pconf_spec_set_ies_smt_range(regmap, mt2712_smt_set,
- ARRAY_SIZE(mt2712_smt_set), pin, align, value);
- return -EINVAL;
-}
-
static const struct mtk_drv_group_desc mt2712_drv_grp[] = {
/* 0E4E8SR 4/8/12/16 */
MTK_DRV_GRP(4, 16, 1, 2, 4),
@@ -553,10 +540,14 @@ static const struct mtk_pinctrl_devdata mt2712_pinctrl_data = {
.n_grp_cls = ARRAY_SIZE(mt2712_drv_grp),
.pin_drv_grp = mt2712_pin_drv,
.n_pin_drv_grps = ARRAY_SIZE(mt2712_pin_drv),
+ .spec_ies = mt2712_ies_set,
+ .n_spec_ies = ARRAY_SIZE(mt2712_ies_set),
.spec_pupd = mt2712_spec_pupd,
.n_spec_pupd = ARRAY_SIZE(mt2712_spec_pupd),
+ .spec_smt = mt2712_smt_set,
+ .n_spec_smt = ARRAY_SIZE(mt2712_smt_set),
.spec_pull_set = mtk_pctrl_spec_pull_set_samereg,
- .spec_ies_smt_set = mt2712_ies_smt_set,
+ .spec_ies_smt_set = mtk_pconf_spec_set_ies_smt_range,
.dir_offset = 0x0000,
.pullen_offset = 0x0100,
.pullsel_offset = 0x0200,