Skip to content

Commit 099f37a

Browse files
abelvesalinusw
authored andcommitted
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: Neil Armstrong <[email protected]> Signed-off-by: Neil Armstrong <[email protected]> Signed-off-by: Abel Vesa <[email protected]> Reviewed-by: Bjorn Andersson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
1 parent b1170c4 commit 099f37a

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

drivers/pinctrl/qcom/pinctrl-msm.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,8 @@ static int msm_config_reg(struct msm_pinctrl *pctrl,
310310
case PIN_CONFIG_BIAS_PULL_UP:
311311
*bit = g->pull_bit;
312312
*mask = 3;
313+
if (g->i2c_pull_bit)
314+
*mask |= BIT(g->i2c_pull_bit) >> *bit;
313315
break;
314316
case PIN_CONFIG_DRIVE_OPEN_DRAIN:
315317
*bit = g->od_bit;
@@ -336,6 +338,7 @@ static int msm_config_reg(struct msm_pinctrl *pctrl,
336338
#define MSM_KEEPER 2
337339
#define MSM_PULL_UP_NO_KEEPER 2
338340
#define MSM_PULL_UP 3
341+
#define MSM_I2C_STRONG_PULL_UP 2200
339342

340343
static unsigned msm_regval_to_drive(u32 val)
341344
{
@@ -387,6 +390,8 @@ static int msm_config_group_get(struct pinctrl_dev *pctldev,
387390
case PIN_CONFIG_BIAS_PULL_UP:
388391
if (pctrl->soc->pull_no_keeper)
389392
arg = arg == MSM_PULL_UP_NO_KEEPER;
393+
else if (arg & BIT(g->i2c_pull_bit))
394+
arg = MSM_I2C_STRONG_PULL_UP;
390395
else
391396
arg = arg == MSM_PULL_UP;
392397
if (!arg)
@@ -467,6 +472,8 @@ static int msm_config_group_set(struct pinctrl_dev *pctldev,
467472
case PIN_CONFIG_BIAS_PULL_UP:
468473
if (pctrl->soc->pull_no_keeper)
469474
arg = MSM_PULL_UP_NO_KEEPER;
475+
else if (g->i2c_pull_bit && arg == MSM_I2C_STRONG_PULL_UP)
476+
arg = BIT(g->i2c_pull_bit) | MSM_PULL_UP;
470477
else
471478
arg = MSM_PULL_UP;
472479
break;

drivers/pinctrl/qcom/pinctrl-msm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ struct msm_pingroup {
8080

8181
unsigned pull_bit:5;
8282
unsigned drv_bit:5;
83+
unsigned i2c_pull_bit:5;
8384

8485
unsigned od_bit:5;
8586
unsigned egpio_enable:5;

drivers/pinctrl/qcom/pinctrl-sm8550.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
.mux_bit = 2, \
4848
.pull_bit = 0, \
4949
.drv_bit = 6, \
50+
.i2c_pull_bit = 13, \
5051
.egpio_enable = 12, \
5152
.egpio_present = 11, \
5253
.oe_bit = 9, \

0 commit comments

Comments
 (0)