Commit 099f37a5 authored by Abel Vesa's avatar Abel Vesa Committed by Linus Walleij

pinctrl: qcom: Add support for i2c specific pull feature

Add support for the new i2c_pull property introduced for SM8550 setting
a I2C specific pull mode on I2C able pins. Add the bit to the SM8550
specific driver while at it.
Co-developed-by: default avatarNeil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: default avatarNeil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: default avatarAbel Vesa <abel.vesa@linaro.org>
Reviewed-by: default avatarBjorn Andersson <andersson@kernel.org>
Link: https://lore.kernel.org/r/20230209074510.4153294-1-abel.vesa@linaro.orgSigned-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent b1170c42
...@@ -310,6 +310,8 @@ static int msm_config_reg(struct msm_pinctrl *pctrl, ...@@ -310,6 +310,8 @@ static int msm_config_reg(struct msm_pinctrl *pctrl,
case PIN_CONFIG_BIAS_PULL_UP: case PIN_CONFIG_BIAS_PULL_UP:
*bit = g->pull_bit; *bit = g->pull_bit;
*mask = 3; *mask = 3;
if (g->i2c_pull_bit)
*mask |= BIT(g->i2c_pull_bit) >> *bit;
break; break;
case PIN_CONFIG_DRIVE_OPEN_DRAIN: case PIN_CONFIG_DRIVE_OPEN_DRAIN:
*bit = g->od_bit; *bit = g->od_bit;
...@@ -336,6 +338,7 @@ static int msm_config_reg(struct msm_pinctrl *pctrl, ...@@ -336,6 +338,7 @@ static int msm_config_reg(struct msm_pinctrl *pctrl,
#define MSM_KEEPER 2 #define MSM_KEEPER 2
#define MSM_PULL_UP_NO_KEEPER 2 #define MSM_PULL_UP_NO_KEEPER 2
#define MSM_PULL_UP 3 #define MSM_PULL_UP 3
#define MSM_I2C_STRONG_PULL_UP 2200
static unsigned msm_regval_to_drive(u32 val) static unsigned msm_regval_to_drive(u32 val)
{ {
...@@ -387,6 +390,8 @@ static int msm_config_group_get(struct pinctrl_dev *pctldev, ...@@ -387,6 +390,8 @@ static int msm_config_group_get(struct pinctrl_dev *pctldev,
case PIN_CONFIG_BIAS_PULL_UP: case PIN_CONFIG_BIAS_PULL_UP:
if (pctrl->soc->pull_no_keeper) if (pctrl->soc->pull_no_keeper)
arg = arg == MSM_PULL_UP_NO_KEEPER; arg = arg == MSM_PULL_UP_NO_KEEPER;
else if (arg & BIT(g->i2c_pull_bit))
arg = MSM_I2C_STRONG_PULL_UP;
else else
arg = arg == MSM_PULL_UP; arg = arg == MSM_PULL_UP;
if (!arg) if (!arg)
...@@ -467,6 +472,8 @@ static int msm_config_group_set(struct pinctrl_dev *pctldev, ...@@ -467,6 +472,8 @@ static int msm_config_group_set(struct pinctrl_dev *pctldev,
case PIN_CONFIG_BIAS_PULL_UP: case PIN_CONFIG_BIAS_PULL_UP:
if (pctrl->soc->pull_no_keeper) if (pctrl->soc->pull_no_keeper)
arg = MSM_PULL_UP_NO_KEEPER; arg = MSM_PULL_UP_NO_KEEPER;
else if (g->i2c_pull_bit && arg == MSM_I2C_STRONG_PULL_UP)
arg = BIT(g->i2c_pull_bit) | MSM_PULL_UP;
else else
arg = MSM_PULL_UP; arg = MSM_PULL_UP;
break; break;
......
...@@ -80,6 +80,7 @@ struct msm_pingroup { ...@@ -80,6 +80,7 @@ struct msm_pingroup {
unsigned pull_bit:5; unsigned pull_bit:5;
unsigned drv_bit:5; unsigned drv_bit:5;
unsigned i2c_pull_bit:5;
unsigned od_bit:5; unsigned od_bit:5;
unsigned egpio_enable:5; unsigned egpio_enable:5;
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
.mux_bit = 2, \ .mux_bit = 2, \
.pull_bit = 0, \ .pull_bit = 0, \
.drv_bit = 6, \ .drv_bit = 6, \
.i2c_pull_bit = 13, \
.egpio_enable = 12, \ .egpio_enable = 12, \
.egpio_present = 11, \ .egpio_present = 11, \
.oe_bit = 9, \ .oe_bit = 9, \
......
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