From: Rickard Andersson <rickaran@axis.com>
To: <broonie@kernel.org>, <lgirdwood@gmail.com>,
<linux-kernel@vger.kernel.org>, <yibin.gong@nxp.com>
Cc: <rickaran@axis.com>, <rickard314.andersson@gmail.com>, <perdo@axis.com>
Subject: [PATCH 2/5] regulator: pca9450: Make I2C Level Translator configurable
Date: Thu, 28 Apr 2022 16:01:36 +0200 [thread overview]
Message-ID: <20220428140139.7349-2-rickaran@axis.com> (raw)
In-Reply-To: <20220428140139.7349-1-rickaran@axis.com>
From: Per-Daniel Olsson <perdo@axis.com>
Make the I2C Level Translator included in PCA9450 configurable from
devicetree. The reset state is off. By setting nxp,i2c-lt-enable, the
I2C Level Translator will be enabled while in STANDBY or RUN state.
Signed-off-by: Per-Daniel Olsson <perdo@axis.com>
---
drivers/regulator/pca9450-regulator.c | 11 +++++++++++
include/linux/regulator/pca9450.h | 7 +++++++
2 files changed, 18 insertions(+)
diff --git a/drivers/regulator/pca9450-regulator.c b/drivers/regulator/pca9450-regulator.c
index 64e5f5f0cc84..87b4e6e29ba1 100644
--- a/drivers/regulator/pca9450-regulator.c
+++ b/drivers/regulator/pca9450-regulator.c
@@ -810,6 +810,17 @@ static int pca9450_i2c_probe(struct i2c_client *i2c,
return ret;
}
+ if (of_property_read_bool(i2c->dev.of_node, "nxp,i2c-lt-enable")) {
+ /* Enable I2C Level Translator */
+ ret = regmap_update_bits(pca9450->regmap, PCA9450_REG_CONFIG2,
+ I2C_LT_MASK, I2C_LT_ON_STANDBY_RUN);
+ if (ret) {
+ dev_err(&i2c->dev,
+ "Failed to enable I2C level translator\n");
+ return ret;
+ }
+ }
+
/*
* The driver uses the LDO5CTRL_H register to control the LDO5 regulator.
* This is only valid if the SD_VSEL input of the PMIC is high. Let's
diff --git a/include/linux/regulator/pca9450.h b/include/linux/regulator/pca9450.h
index 71902f41c919..3c01c2bf84f5 100644
--- a/include/linux/regulator/pca9450.h
+++ b/include/linux/regulator/pca9450.h
@@ -226,4 +226,11 @@ enum {
#define WDOG_B_CFG_COLD_LDO12 0x80
#define WDOG_B_CFG_COLD 0xC0
+/* PCA9450_REG_CONFIG2 bits */
+#define I2C_LT_MASK 0x03
+#define I2C_LT_FORCE_DISABLE 0x00
+#define I2C_LT_ON_STANDBY_RUN 0x01
+#define I2C_LT_ON_RUN 0x02
+#define I2C_LT_FORCE_ENABLE 0x03
+
#endif /* __LINUX_REG_PCA9450_H__ */
--
2.20.1
next prev parent reply other threads:[~2022-04-28 14:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-28 14:01 [PATCH 1/5] dt-bindings: regulator: Add property for I2C level shifter Rickard Andersson
2022-04-28 14:01 ` Rickard Andersson [this message]
2022-04-28 14:01 ` [PATCH 3/5] dt-bindings: regulator: Add property for WDOG_B warm reset Rickard Andersson
2022-04-28 14:01 ` [PATCH 4/5] regulator: pca9450: Make warm reset on WDOG_B assertion Rickard Andersson
2022-04-28 14:01 ` [PATCH 5/5] regulator: pca9450: Enable DVS control via PMIC_STBY_REQ Rickard Andersson
2022-04-28 15:07 ` [PATCH 1/5] dt-bindings: regulator: Add property for I2C level shifter Mark Brown
2022-05-03 15:51 ` (subset) " Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220428140139.7349-2-rickaran@axis.com \
--to=rickaran@axis.com \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=perdo@axis.com \
--cc=rickard314.andersson@gmail.com \
--cc=yibin.gong@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox