[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221123152001.694546-4-abel.vesa@linaro.org>
Date: Wed, 23 Nov 2022 17:20:00 +0200
From: Abel Vesa <abel.vesa@...aro.org>
To: Andy Gross <agross@...nel.org>,
Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konrad.dybcio@...aro.org>,
Linus Walleij <linus.walleij@...aro.org>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
devicetree@...r.kernel.org, linux-arm-msm@...r.kernel.org,
"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
Neil Armstrong <neil.armstrong@...aro.org>
Subject: [PATCH v2 3/4] pinctrl: qcom: add support for i2c specific pull feature
From: Neil Armstrong <neil.armstrong@...aro.org>
Add support for the new i2c_pull property introduced for SM8550 setting
a I2C specific pull mode on I2C able pins.
Signed-off-by: Neil Armstrong <neil.armstrong@...aro.org>
Signed-off-by: Abel Vesa <abel.vesa@...aro.org>
---
Changes since v1:
* Added my missing Signed-off-by tag
drivers/pinctrl/qcom/pinctrl-msm.c | 20 ++++++++++++++++++++
drivers/pinctrl/qcom/pinctrl-msm.h | 1 +
2 files changed, 21 insertions(+)
diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c
index 8fbb953c4bbe..f92082c1c805 100644
--- a/drivers/pinctrl/qcom/pinctrl-msm.c
+++ b/drivers/pinctrl/qcom/pinctrl-msm.c
@@ -83,6 +83,12 @@ struct msm_pinctrl {
u32 phys_base[MAX_NR_TILES];
};
+#define PIN_CONFIG_QCOM_I2C_PULL (PIN_CONFIG_END + 1)
+
+static const struct pinconf_generic_params msm_pinconf_custom_bindings[] = {
+ {"qcom,i2c-pull", PIN_CONFIG_END + 1, 0},
+};
+
#define MSM_ACCESSOR(name) \
static u32 msm_readl_##name(struct msm_pinctrl *pctrl, \
const struct msm_pingroup *g) \
@@ -324,6 +330,12 @@ static int msm_config_reg(struct msm_pinctrl *pctrl,
*bit = g->oe_bit;
*mask = 1;
break;
+ case PIN_CONFIG_QCOM_I2C_PULL:
+ if (g->i2c_pull_bit == 0)
+ return -EOPNOTSUPP;
+ *bit = g->i2c_pull_bit;
+ *mask = 1;
+ break;
default:
return -ENOTSUPP;
}
@@ -415,6 +427,9 @@ static int msm_config_group_get(struct pinctrl_dev *pctldev,
return -EINVAL;
arg = 1;
break;
+ case PIN_CONFIG_QCOM_I2C_PULL:
+ arg = 1;
+ break;
default:
return -ENOTSUPP;
}
@@ -498,6 +513,9 @@ static int msm_config_group_set(struct pinctrl_dev *pctldev,
/* disable output */
arg = 0;
break;
+ case PIN_CONFIG_QCOM_I2C_PULL:
+ arg = 1;
+ break;
default:
dev_err(pctrl->dev, "Unsupported config parameter: %x\n",
param);
@@ -1495,6 +1513,8 @@ int msm_pinctrl_probe(struct platform_device *pdev,
pctrl->desc.name = dev_name(&pdev->dev);
pctrl->desc.pins = pctrl->soc->pins;
pctrl->desc.npins = pctrl->soc->npins;
+ pctrl->desc.custom_params = msm_pinconf_custom_bindings;
+ pctrl->desc.num_custom_params = ARRAY_SIZE(msm_pinconf_custom_bindings);
pctrl->pctrl = devm_pinctrl_register(&pdev->dev, &pctrl->desc, pctrl);
if (IS_ERR(pctrl->pctrl)) {
diff --git a/drivers/pinctrl/qcom/pinctrl-msm.h b/drivers/pinctrl/qcom/pinctrl-msm.h
index 05a1209bf9ae..985eceda2517 100644
--- a/drivers/pinctrl/qcom/pinctrl-msm.h
+++ b/drivers/pinctrl/qcom/pinctrl-msm.h
@@ -80,6 +80,7 @@ struct msm_pingroup {
unsigned pull_bit:5;
unsigned drv_bit:5;
+ unsigned i2c_pull_bit:5;
unsigned od_bit:5;
unsigned egpio_enable:5;
--
2.34.1
Powered by blists - more mailing lists