Commit 156f7217 authored by AngeloGioacchino Del Regno's avatar AngeloGioacchino Del Regno Committed by Linus Walleij

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: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: default avatarChen-Yu Tsai <wenst@chromium.org>
Link: https://lore.kernel.org/r/20220222111144.20796-6-angelogioacchino.delregno@collabora.comSigned-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent c19763c3
...@@ -429,18 +429,6 @@ static const struct mtk_pin_ies_smt_set mt2701_smt_set[] = { ...@@ -429,18 +429,6 @@ static const struct mtk_pin_ies_smt_set mt2701_smt_set[] = {
MTK_PIN_IES_SMT_SPEC(278, 278, 0xb70, 13), MTK_PIN_IES_SMT_SPEC(278, 278, 0xb70, 13),
}; };
static int mt2701_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, mt2701_ies_set,
ARRAY_SIZE(mt2701_ies_set), pin, align, value);
else if (arg == PIN_CONFIG_INPUT_SCHMITT_ENABLE)
return mtk_pconf_spec_set_ies_smt_range(regmap, mt2701_smt_set,
ARRAY_SIZE(mt2701_smt_set), pin, align, value);
return -EINVAL;
}
static const struct mtk_spec_pinmux_set mt2701_spec_pinmux[] = { static const struct mtk_spec_pinmux_set mt2701_spec_pinmux[] = {
MTK_PINMUX_SPEC(22, 0xb10, 3), MTK_PINMUX_SPEC(22, 0xb10, 3),
MTK_PINMUX_SPEC(23, 0xb10, 4), MTK_PINMUX_SPEC(23, 0xb10, 4),
...@@ -501,10 +489,14 @@ static const struct mtk_pinctrl_devdata mt2701_pinctrl_data = { ...@@ -501,10 +489,14 @@ static const struct mtk_pinctrl_devdata mt2701_pinctrl_data = {
.n_grp_cls = ARRAY_SIZE(mt2701_drv_grp), .n_grp_cls = ARRAY_SIZE(mt2701_drv_grp),
.pin_drv_grp = mt2701_pin_drv, .pin_drv_grp = mt2701_pin_drv,
.n_pin_drv_grps = ARRAY_SIZE(mt2701_pin_drv), .n_pin_drv_grps = ARRAY_SIZE(mt2701_pin_drv),
.spec_ies = mt2701_ies_set,
.n_spec_ies = ARRAY_SIZE(mt2701_ies_set),
.spec_pupd = mt2701_spec_pupd, .spec_pupd = mt2701_spec_pupd,
.n_spec_pupd = ARRAY_SIZE(mt2701_spec_pupd), .n_spec_pupd = ARRAY_SIZE(mt2701_spec_pupd),
.spec_smt = mt2701_smt_set,
.n_spec_smt = ARRAY_SIZE(mt2701_smt_set),
.spec_pull_set = mtk_pctrl_spec_pull_set_samereg, .spec_pull_set = mtk_pctrl_spec_pull_set_samereg,
.spec_ies_smt_set = mt2701_ies_smt_set, .spec_ies_smt_set = mtk_pconf_spec_set_ies_smt_range,
.spec_pinmux_set = mt2701_spec_pinmux_set, .spec_pinmux_set = mt2701_spec_pinmux_set,
.spec_dir_set = mt2701_spec_dir_set, .spec_dir_set = mt2701_spec_dir_set,
.dir_offset = 0x0000, .dir_offset = 0x0000,
......
...@@ -275,19 +275,6 @@ static const struct mtk_pin_ies_smt_set mt2712_ies_set[] = { ...@@ -275,19 +275,6 @@ static const struct mtk_pin_ies_smt_set mt2712_ies_set[] = {
MTK_PIN_IES_SMT_SPEC(207, 209, 0x8b0, 15) 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[] = { static const struct mtk_drv_group_desc mt2712_drv_grp[] = {
/* 0E4E8SR 4/8/12/16 */ /* 0E4E8SR 4/8/12/16 */
MTK_DRV_GRP(4, 16, 1, 2, 4), MTK_DRV_GRP(4, 16, 1, 2, 4),
...@@ -553,10 +540,14 @@ static const struct mtk_pinctrl_devdata mt2712_pinctrl_data = { ...@@ -553,10 +540,14 @@ static const struct mtk_pinctrl_devdata mt2712_pinctrl_data = {
.n_grp_cls = ARRAY_SIZE(mt2712_drv_grp), .n_grp_cls = ARRAY_SIZE(mt2712_drv_grp),
.pin_drv_grp = mt2712_pin_drv, .pin_drv_grp = mt2712_pin_drv,
.n_pin_drv_grps = ARRAY_SIZE(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, .spec_pupd = mt2712_spec_pupd,
.n_spec_pupd = ARRAY_SIZE(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_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, .dir_offset = 0x0000,
.pullen_offset = 0x0100, .pullen_offset = 0x0100,
.pullsel_offset = 0x0200, .pullsel_offset = 0x0200,
......
...@@ -252,19 +252,6 @@ static const struct mtk_pin_ies_smt_set mt8127_smt_set[] = { ...@@ -252,19 +252,6 @@ static const struct mtk_pin_ies_smt_set mt8127_smt_set[] = {
MTK_PIN_IES_SMT_SPEC(142, 142, 0x920, 13), MTK_PIN_IES_SMT_SPEC(142, 142, 0x920, 13),
}; };
static int mt8127_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, mt8127_ies_set,
ARRAY_SIZE(mt8127_ies_set), pin, align, value);
else if (arg == PIN_CONFIG_INPUT_SCHMITT_ENABLE)
return mtk_pconf_spec_set_ies_smt_range(regmap, mt8127_smt_set,
ARRAY_SIZE(mt8127_smt_set), pin, align, value);
return -EINVAL;
}
static const struct mtk_pinctrl_devdata mt8127_pinctrl_data = { static const struct mtk_pinctrl_devdata mt8127_pinctrl_data = {
.pins = mtk_pins_mt8127, .pins = mtk_pins_mt8127,
.npins = ARRAY_SIZE(mtk_pins_mt8127), .npins = ARRAY_SIZE(mtk_pins_mt8127),
...@@ -272,10 +259,14 @@ static const struct mtk_pinctrl_devdata mt8127_pinctrl_data = { ...@@ -272,10 +259,14 @@ static const struct mtk_pinctrl_devdata mt8127_pinctrl_data = {
.n_grp_cls = ARRAY_SIZE(mt8127_drv_grp), .n_grp_cls = ARRAY_SIZE(mt8127_drv_grp),
.pin_drv_grp = mt8127_pin_drv, .pin_drv_grp = mt8127_pin_drv,
.n_pin_drv_grps = ARRAY_SIZE(mt8127_pin_drv), .n_pin_drv_grps = ARRAY_SIZE(mt8127_pin_drv),
.spec_ies = mt8127_ies_set,
.n_spec_ies = ARRAY_SIZE(mt8127_ies_set),
.spec_pupd = mt8127_spec_pupd, .spec_pupd = mt8127_spec_pupd,
.n_spec_pupd = ARRAY_SIZE(mt8127_spec_pupd), .n_spec_pupd = ARRAY_SIZE(mt8127_spec_pupd),
.spec_smt = mt8127_smt_set,
.n_spec_smt = ARRAY_SIZE(mt8127_smt_set),
.spec_pull_set = mtk_pctrl_spec_pull_set_samereg, .spec_pull_set = mtk_pctrl_spec_pull_set_samereg,
.spec_ies_smt_set = mt8127_ies_smt_set, .spec_ies_smt_set = mtk_pconf_spec_set_ies_smt_range,
.dir_offset = 0x0000, .dir_offset = 0x0000,
.pullen_offset = 0x0100, .pullen_offset = 0x0100,
.pullsel_offset = 0x0200, .pullsel_offset = 0x0200,
......
...@@ -285,18 +285,6 @@ static const struct mtk_pin_ies_smt_set mt8167_smt_set[] = { ...@@ -285,18 +285,6 @@ static const struct mtk_pin_ies_smt_set mt8167_smt_set[] = {
MTK_PIN_IES_SMT_SPEC(121, 124, 0xA10, 9), MTK_PIN_IES_SMT_SPEC(121, 124, 0xA10, 9),
}; };
static int mt8167_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, mt8167_ies_set,
ARRAY_SIZE(mt8167_ies_set), pin, align, value);
else if (arg == PIN_CONFIG_INPUT_SCHMITT_ENABLE)
return mtk_pconf_spec_set_ies_smt_range(regmap, mt8167_smt_set,
ARRAY_SIZE(mt8167_smt_set), pin, align, value);
return -EINVAL;
}
static const struct mtk_pinctrl_devdata mt8167_pinctrl_data = { static const struct mtk_pinctrl_devdata mt8167_pinctrl_data = {
.pins = mtk_pins_mt8167, .pins = mtk_pins_mt8167,
.npins = ARRAY_SIZE(mtk_pins_mt8167), .npins = ARRAY_SIZE(mtk_pins_mt8167),
...@@ -304,10 +292,14 @@ static const struct mtk_pinctrl_devdata mt8167_pinctrl_data = { ...@@ -304,10 +292,14 @@ static const struct mtk_pinctrl_devdata mt8167_pinctrl_data = {
.n_grp_cls = ARRAY_SIZE(mt8167_drv_grp), .n_grp_cls = ARRAY_SIZE(mt8167_drv_grp),
.pin_drv_grp = mt8167_pin_drv, .pin_drv_grp = mt8167_pin_drv,
.n_pin_drv_grps = ARRAY_SIZE(mt8167_pin_drv), .n_pin_drv_grps = ARRAY_SIZE(mt8167_pin_drv),
.spec_ies = mt8167_ies_set,
.n_spec_ies = ARRAY_SIZE(mt8167_ies_set),
.spec_pupd = mt8167_spec_pupd, .spec_pupd = mt8167_spec_pupd,
.n_spec_pupd = ARRAY_SIZE(mt8167_spec_pupd), .n_spec_pupd = ARRAY_SIZE(mt8167_spec_pupd),
.spec_smt = mt8167_smt_set,
.n_spec_smt = ARRAY_SIZE(mt8167_smt_set),
.spec_pull_set = mtk_pctrl_spec_pull_set_samereg, .spec_pull_set = mtk_pctrl_spec_pull_set_samereg,
.spec_ies_smt_set = mt8167_ies_smt_set, .spec_ies_smt_set = mtk_pconf_spec_set_ies_smt_range,
.dir_offset = 0x0000, .dir_offset = 0x0000,
.pullen_offset = 0x0500, .pullen_offset = 0x0500,
.pullsel_offset = 0x0600, .pullsel_offset = 0x0600,
......
...@@ -167,18 +167,6 @@ static const struct mtk_pin_ies_smt_set mt8173_ies_set[] = { ...@@ -167,18 +167,6 @@ static const struct mtk_pin_ies_smt_set mt8173_ies_set[] = {
MTK_PIN_IES_SMT_SPEC(133, 134, 0x910, 8) MTK_PIN_IES_SMT_SPEC(133, 134, 0x910, 8)
}; };
static int mt8173_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, mt8173_ies_set,
ARRAY_SIZE(mt8173_ies_set), pin, align, value);
else if (arg == PIN_CONFIG_INPUT_SCHMITT_ENABLE)
return mtk_pconf_spec_set_ies_smt_range(regmap, mt8173_smt_set,
ARRAY_SIZE(mt8173_smt_set), pin, align, value);
return -EINVAL;
}
static const struct mtk_drv_group_desc mt8173_drv_grp[] = { static const struct mtk_drv_group_desc mt8173_drv_grp[] = {
/* 0E4E8SR 4/8/12/16 */ /* 0E4E8SR 4/8/12/16 */
MTK_DRV_GRP(4, 16, 1, 2, 4), MTK_DRV_GRP(4, 16, 1, 2, 4),
...@@ -312,10 +300,14 @@ static const struct mtk_pinctrl_devdata mt8173_pinctrl_data = { ...@@ -312,10 +300,14 @@ static const struct mtk_pinctrl_devdata mt8173_pinctrl_data = {
.n_grp_cls = ARRAY_SIZE(mt8173_drv_grp), .n_grp_cls = ARRAY_SIZE(mt8173_drv_grp),
.pin_drv_grp = mt8173_pin_drv, .pin_drv_grp = mt8173_pin_drv,
.n_pin_drv_grps = ARRAY_SIZE(mt8173_pin_drv), .n_pin_drv_grps = ARRAY_SIZE(mt8173_pin_drv),
.spec_ies = mt8173_ies_set,
.n_spec_ies = ARRAY_SIZE(mt8173_ies_set),
.spec_pupd = mt8173_spec_pupd, .spec_pupd = mt8173_spec_pupd,
.n_spec_pupd = ARRAY_SIZE(mt8173_spec_pupd), .n_spec_pupd = ARRAY_SIZE(mt8173_spec_pupd),
.spec_smt = mt8173_smt_set,
.n_spec_smt = ARRAY_SIZE(mt8173_smt_set),
.spec_pull_set = mtk_pctrl_spec_pull_set_samereg, .spec_pull_set = mtk_pctrl_spec_pull_set_samereg,
.spec_ies_smt_set = mt8173_ies_smt_set, .spec_ies_smt_set = mtk_pconf_spec_set_ies_smt_range,
.dir_offset = 0x0000, .dir_offset = 0x0000,
.pullen_offset = 0x0100, .pullen_offset = 0x0100,
.pullsel_offset = 0x0200, .pullsel_offset = 0x0200,
......
...@@ -416,18 +416,6 @@ static const struct mtk_pin_ies_smt_set mt8365_smt_set[] = { ...@@ -416,18 +416,6 @@ static const struct mtk_pin_ies_smt_set mt8365_smt_set[] = {
MTK_PIN_IES_SMT_SPEC(144, 144, 0x480, 22), MTK_PIN_IES_SMT_SPEC(144, 144, 0x480, 22),
}; };
static int mt8365_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, mt8365_ies_set,
ARRAY_SIZE(mt8365_ies_set), pin, align, value);
else if (arg == PIN_CONFIG_INPUT_SCHMITT_ENABLE)
return mtk_pconf_spec_set_ies_smt_range(regmap, mt8365_smt_set,
ARRAY_SIZE(mt8365_smt_set), pin, align, value);
return -EINVAL;
}
static const struct mtk_pinctrl_devdata mt8365_pinctrl_data = { static const struct mtk_pinctrl_devdata mt8365_pinctrl_data = {
.pins = mtk_pins_mt8365, .pins = mtk_pins_mt8365,
.npins = ARRAY_SIZE(mtk_pins_mt8365), .npins = ARRAY_SIZE(mtk_pins_mt8365),
...@@ -435,10 +423,14 @@ static const struct mtk_pinctrl_devdata mt8365_pinctrl_data = { ...@@ -435,10 +423,14 @@ static const struct mtk_pinctrl_devdata mt8365_pinctrl_data = {
.n_grp_cls = ARRAY_SIZE(mt8365_drv_grp), .n_grp_cls = ARRAY_SIZE(mt8365_drv_grp),
.pin_drv_grp = mt8365_pin_drv, .pin_drv_grp = mt8365_pin_drv,
.n_pin_drv_grps = ARRAY_SIZE(mt8365_pin_drv), .n_pin_drv_grps = ARRAY_SIZE(mt8365_pin_drv),
.spec_ies = mt8365_ies_set,
.n_spec_ies = ARRAY_SIZE(mt8365_ies_set),
.spec_smt = mt8365_smt_set,
.n_spec_smt = ARRAY_SIZE(mt8365_smt_set),
.spec_pupd = mt8365_spec_pupd, .spec_pupd = mt8365_spec_pupd,
.n_spec_pupd = ARRAY_SIZE(mt8365_spec_pupd), .n_spec_pupd = ARRAY_SIZE(mt8365_spec_pupd),
.spec_pull_set = mtk_pctrl_spec_pull_set_samereg, .spec_pull_set = mtk_pctrl_spec_pull_set_samereg,
.spec_ies_smt_set = mt8365_ies_smt_set, .spec_ies_smt_set = mtk_pconf_spec_set_ies_smt_range,
.dir_offset = 0x0140, .dir_offset = 0x0140,
.dout_offset = 0x00A0, .dout_offset = 0x00A0,
.din_offset = 0x0000, .din_offset = 0x0000,
......
...@@ -285,18 +285,6 @@ static const struct mtk_pin_ies_smt_set mt8516_smt_set[] = { ...@@ -285,18 +285,6 @@ static const struct mtk_pin_ies_smt_set mt8516_smt_set[] = {
MTK_PIN_IES_SMT_SPEC(121, 124, 0xA10, 9), MTK_PIN_IES_SMT_SPEC(121, 124, 0xA10, 9),
}; };
static int mt8516_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, mt8516_ies_set,
ARRAY_SIZE(mt8516_ies_set), pin, align, value);
else if (arg == PIN_CONFIG_INPUT_SCHMITT_ENABLE)
return mtk_pconf_spec_set_ies_smt_range(regmap, mt8516_smt_set,
ARRAY_SIZE(mt8516_smt_set), pin, align, value);
return -EINVAL;
}
static const struct mtk_pinctrl_devdata mt8516_pinctrl_data = { static const struct mtk_pinctrl_devdata mt8516_pinctrl_data = {
.pins = mtk_pins_mt8516, .pins = mtk_pins_mt8516,
.npins = ARRAY_SIZE(mtk_pins_mt8516), .npins = ARRAY_SIZE(mtk_pins_mt8516),
...@@ -304,10 +292,14 @@ static const struct mtk_pinctrl_devdata mt8516_pinctrl_data = { ...@@ -304,10 +292,14 @@ static const struct mtk_pinctrl_devdata mt8516_pinctrl_data = {
.n_grp_cls = ARRAY_SIZE(mt8516_drv_grp), .n_grp_cls = ARRAY_SIZE(mt8516_drv_grp),
.pin_drv_grp = mt8516_pin_drv, .pin_drv_grp = mt8516_pin_drv,
.n_pin_drv_grps = ARRAY_SIZE(mt8516_pin_drv), .n_pin_drv_grps = ARRAY_SIZE(mt8516_pin_drv),
.spec_ies = mt8516_ies_set,
.n_spec_ies = ARRAY_SIZE(mt8516_ies_set),
.spec_pupd = mt8516_spec_pupd, .spec_pupd = mt8516_spec_pupd,
.n_spec_pupd = ARRAY_SIZE(mt8516_spec_pupd), .n_spec_pupd = ARRAY_SIZE(mt8516_spec_pupd),
.spec_smt = mt8516_smt_set,
.n_spec_smt = ARRAY_SIZE(mt8516_smt_set),
.spec_pull_set = mtk_pctrl_spec_pull_set_samereg, .spec_pull_set = mtk_pctrl_spec_pull_set_samereg,
.spec_ies_smt_set = mt8516_ies_smt_set, .spec_ies_smt_set = mtk_pconf_spec_set_ies_smt_range,
.dir_offset = 0x0000, .dir_offset = 0x0000,
.pullen_offset = 0x0500, .pullen_offset = 0x0500,
.pullsel_offset = 0x0600, .pullsel_offset = 0x0600,
......
...@@ -131,7 +131,7 @@ static int mtk_pconf_set_ies_smt(struct mtk_pinctrl *pctl, unsigned pin, ...@@ -131,7 +131,7 @@ static int mtk_pconf_set_ies_smt(struct mtk_pinctrl *pctl, unsigned pin,
*/ */
if (pctl->devdata->spec_ies_smt_set) { if (pctl->devdata->spec_ies_smt_set) {
return pctl->devdata->spec_ies_smt_set(mtk_get_regmap(pctl, pin), return pctl->devdata->spec_ies_smt_set(mtk_get_regmap(pctl, pin),
pin, pctl->devdata->port_align, value, arg); pctl->devdata, pin, value, arg);
} }
if (arg == PIN_CONFIG_INPUT_ENABLE) if (arg == PIN_CONFIG_INPUT_ENABLE)
...@@ -151,10 +151,27 @@ static int mtk_pconf_set_ies_smt(struct mtk_pinctrl *pctl, unsigned pin, ...@@ -151,10 +151,27 @@ static int mtk_pconf_set_ies_smt(struct mtk_pinctrl *pctl, unsigned pin,
} }
int mtk_pconf_spec_set_ies_smt_range(struct regmap *regmap, int mtk_pconf_spec_set_ies_smt_range(struct regmap *regmap,
const struct mtk_pin_ies_smt_set *ies_smt_infos, unsigned int info_num, const struct mtk_pinctrl_devdata *devdata,
unsigned int pin, unsigned char align, int value) unsigned int pin, int value, enum pin_config_param arg)
{ {
unsigned int i, reg_addr, bit; const struct mtk_pin_ies_smt_set *ies_smt_infos = NULL;
unsigned int i, info_num, reg_addr, bit;
switch (arg) {
case PIN_CONFIG_INPUT_ENABLE:
ies_smt_infos = devdata->spec_ies;
info_num = devdata->n_spec_ies;
break;
case PIN_CONFIG_INPUT_SCHMITT_ENABLE:
ies_smt_infos = devdata->spec_smt;
info_num = devdata->n_spec_smt;
break;
default:
break;
};
if (!ies_smt_infos)
return -EINVAL;
for (i = 0; i < info_num; i++) { for (i = 0; i < info_num; i++) {
if (pin >= ies_smt_infos[i].start && if (pin >= ies_smt_infos[i].start &&
...@@ -167,9 +184,9 @@ int mtk_pconf_spec_set_ies_smt_range(struct regmap *regmap, ...@@ -167,9 +184,9 @@ int mtk_pconf_spec_set_ies_smt_range(struct regmap *regmap,
return -EINVAL; return -EINVAL;
if (value) if (value)
reg_addr = ies_smt_infos[i].offset + align; reg_addr = ies_smt_infos[i].offset + devdata->port_align;
else else
reg_addr = ies_smt_infos[i].offset + (align << 1); reg_addr = ies_smt_infos[i].offset + (devdata->port_align << 1);
bit = BIT(ies_smt_infos[i].bit); bit = BIT(ies_smt_infos[i].bit);
regmap_write(regmap, reg_addr, bit); regmap_write(regmap, reg_addr, bit);
......
...@@ -193,8 +193,12 @@ struct mtk_eint_offsets { ...@@ -193,8 +193,12 @@ struct mtk_eint_offsets {
* *
* @grp_desc: The driving group info. * @grp_desc: The driving group info.
* @pin_drv_grp: The driving group for all pins. * @pin_drv_grp: The driving group for all pins.
* @spec_ies: Special pin setting for input enable
* @n_spec_ies: Number of entries in spec_ies
* @spec_pupd: Special pull up/down setting * @spec_pupd: Special pull up/down setting
* @n_spec_pupd: Number of entries in spec_pupd * @n_spec_pupd: Number of entries in spec_pupd
* @spec_smt: Special pin setting for schmitt
* @n_spec_smt: Number of entries in spec_smt
* @spec_pull_set: Each SoC may have special pins for pull up/down setting, * @spec_pull_set: Each SoC may have special pins for pull up/down setting,
* these pins' pull setting are very different, they have separate pull * these pins' pull setting are very different, they have separate pull
* up/down bit, R0 and R1 resistor bit, so they need special pull setting. * up/down bit, R0 and R1 resistor bit, so they need special pull setting.
...@@ -233,13 +237,18 @@ struct mtk_pinctrl_devdata { ...@@ -233,13 +237,18 @@ struct mtk_pinctrl_devdata {
unsigned int n_grp_cls; unsigned int n_grp_cls;
const struct mtk_pin_drv_grp *pin_drv_grp; const struct mtk_pin_drv_grp *pin_drv_grp;
unsigned int n_pin_drv_grps; unsigned int n_pin_drv_grps;
const struct mtk_pin_ies_smt_set *spec_ies;
unsigned int n_spec_ies;
const struct mtk_pin_spec_pupd_set_samereg *spec_pupd; const struct mtk_pin_spec_pupd_set_samereg *spec_pupd;
unsigned int n_spec_pupd; unsigned int n_spec_pupd;
const struct mtk_pin_ies_smt_set *spec_smt;
unsigned int n_spec_smt;
int (*spec_pull_set)(struct regmap *regmap, int (*spec_pull_set)(struct regmap *regmap,
const struct mtk_pinctrl_devdata *devdata, const struct mtk_pinctrl_devdata *devdata,
unsigned int pin, bool isup, unsigned int r1r0); unsigned int pin, bool isup, unsigned int r1r0);
int (*spec_ies_smt_set)(struct regmap *reg, unsigned int pin, int (*spec_ies_smt_set)(struct regmap *reg,
unsigned char align, int value, enum pin_config_param arg); const struct mtk_pinctrl_devdata *devdata,
unsigned int pin, int value, enum pin_config_param arg);
void (*spec_pinmux_set)(struct regmap *reg, unsigned int pin, void (*spec_pinmux_set)(struct regmap *reg, unsigned int pin,
unsigned int mode); unsigned int mode);
void (*spec_dir_set)(unsigned int *reg_addr, unsigned int pin); void (*spec_dir_set)(unsigned int *reg_addr, unsigned int pin);
...@@ -289,8 +298,8 @@ int mtk_pctrl_spec_pull_set_samereg(struct regmap *regmap, ...@@ -289,8 +298,8 @@ int mtk_pctrl_spec_pull_set_samereg(struct regmap *regmap,
unsigned int pin, bool isup, unsigned int r1r0); unsigned int pin, bool isup, unsigned int r1r0);
int mtk_pconf_spec_set_ies_smt_range(struct regmap *regmap, int mtk_pconf_spec_set_ies_smt_range(struct regmap *regmap,
const struct mtk_pin_ies_smt_set *ies_smt_infos, unsigned int info_num, const struct mtk_pinctrl_devdata *devdata,
unsigned int pin, unsigned char align, int value); unsigned int pin, int value, enum pin_config_param arg);
extern const struct dev_pm_ops mtk_eint_pm_ops; extern const struct dev_pm_ops mtk_eint_pm_ops;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment