* [PATCH v4 0/3] hwmon: tmp108: Add support for P3T1085
@ 2024-11-12 16:51 Frank Li
2024-11-12 16:51 ` [PATCH v4 1/3] hwmon: tmp108: Add helper function tmp108_common_probe() to prepare I3C support Frank Li
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Frank Li @ 2024-11-12 16:51 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jonathan Cameron,
Lars-Peter Clausen, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Jean Delvare,
Guenter Roeck
Cc: devicetree, linux-kernel, linux-iio, imx, linux-arm-kernel,
Krzysztof Kozlowski, linux-hwmon, Frank Li
Add basic function support for P3T1085 temperature sensor.
- reuse tmp108 driver
- Update imx93-9x9-qsb.dts
To: Rob Herring <robh@kernel.org>
To: Krzysztof Kozlowski <krzk+dt@kernel.org>
To: Conor Dooley <conor+dt@kernel.org>
To: Jonathan Cameron <jic23@kernel.org>
To: Lars-Peter Clausen <lars@metafoo.de>
To: Shawn Guo <shawnguo@kernel.org>
To: Sascha Hauer <s.hauer@pengutronix.de>
To: Pengutronix Kernel Team <kernel@pengutronix.de>
To: Fabio Estevam <festevam@gmail.com>
To: Jean Delvare <jdelvare@suse.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: devicetree@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-iio@vger.kernel.org
Cc: imx@lists.linux.dev
Cc: linux-arm-kernel@lists.infradead.org
Cc: Krzysztof Kozlowski <krzk@kernel.org>
Cc: linux-hwmon@vger.kernel.org
Signed-off-by: Frank Li <Frank.Li@nxp.com>
Changes in v4:
- remove first 2 patches, which already applied
- change to use module_i3c_i2c_driver
- Link to v3: https://lore.kernel.org/r/20241111-p3t1085-v3-0-bff511550aad@nxp.com
Changes in v3:
- Change cover letter subject
- Split compatible string change to a new patch
- Remove i3c/master.h
- Update document about p3t1085
- Link to v2: https://lore.kernel.org/r/20241108-p3t1085-v2-0-6a8990a59efd@nxp.com
Changes in v2:
- Amost rewrite and reuse existed TMP108 driver
- Link to v1: https://lore.kernel.org/r/20241107-p3t1085-v1-0-9a76cb85673f@nxp.com
---
Frank Li (3):
hwmon: tmp108: Add helper function tmp108_common_probe() to prepare I3C support
hwmon: tmp108: Add support for I3C device
arm64: dts: imx93-9x9-qsb: add temp-sensor nxp,p3t1085
arch/arm64/boot/dts/freescale/imx93-9x9-qsb.dts | 5 ++
drivers/hwmon/Kconfig | 1 +
drivers/hwmon/tmp108.c | 74 ++++++++++++++++++-------
3 files changed, 61 insertions(+), 19 deletions(-)
---
base-commit: f3272f4a58ea775b71067cf0f31e3e29f7fb19f5
change-id: 20241107-p3t1085-fbd8726cbc0e
Best regards,
---
Frank Li <Frank.Li@nxp.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v4 1/3] hwmon: tmp108: Add helper function tmp108_common_probe() to prepare I3C support
2024-11-12 16:51 [PATCH v4 0/3] hwmon: tmp108: Add support for P3T1085 Frank Li
@ 2024-11-12 16:51 ` Frank Li
2024-11-12 17:04 ` Guenter Roeck
2024-11-12 16:52 ` [PATCH v4 2/3] hwmon: tmp108: Add support for I3C device Frank Li
2024-11-12 16:52 ` [PATCH v4 3/3] arm64: dts: imx93-9x9-qsb: add temp-sensor nxp,p3t1085 Frank Li
2 siblings, 1 reply; 8+ messages in thread
From: Frank Li @ 2024-11-12 16:51 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jonathan Cameron,
Lars-Peter Clausen, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Jean Delvare,
Guenter Roeck
Cc: devicetree, linux-kernel, linux-iio, imx, linux-arm-kernel,
Krzysztof Kozlowski, linux-hwmon, Frank Li
Add help function tmp108_common_probe() to pave road to support i3c for
P3T1085(NXP) chip.
Use dev_err_probe() to simple code.
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
dev_err_probe() have not involve addition diff change. The difference
always list these code block change regardless use dev_err_probe().
---
change from v2 to v3
- update subject by add prepare I3C support"
---
drivers/hwmon/tmp108.c | 39 +++++++++++++++++++++------------------
1 file changed, 21 insertions(+), 18 deletions(-)
diff --git a/drivers/hwmon/tmp108.c b/drivers/hwmon/tmp108.c
index b561b452d8d39..bfbea6349a95f 100644
--- a/drivers/hwmon/tmp108.c
+++ b/drivers/hwmon/tmp108.c
@@ -323,33 +323,19 @@ static const struct regmap_config tmp108_regmap_config = {
.use_single_write = true,
};
-static int tmp108_probe(struct i2c_client *client)
+static int tmp108_common_probe(struct device *dev, struct regmap *regmap, char *name)
{
- struct device *dev = &client->dev;
struct device *hwmon_dev;
struct tmp108 *tmp108;
- int err;
u32 config;
-
- if (!i2c_check_functionality(client->adapter,
- I2C_FUNC_SMBUS_WORD_DATA)) {
- dev_err(dev,
- "adapter doesn't support SMBus word transactions\n");
- return -ENODEV;
- }
+ int err;
tmp108 = devm_kzalloc(dev, sizeof(*tmp108), GFP_KERNEL);
if (!tmp108)
return -ENOMEM;
dev_set_drvdata(dev, tmp108);
-
- tmp108->regmap = devm_regmap_init_i2c(client, &tmp108_regmap_config);
- if (IS_ERR(tmp108->regmap)) {
- err = PTR_ERR(tmp108->regmap);
- dev_err(dev, "regmap init failed: %d", err);
- return err;
- }
+ tmp108->regmap = regmap;
err = regmap_read(tmp108->regmap, TMP108_REG_CONF, &config);
if (err < 0) {
@@ -383,13 +369,30 @@ static int tmp108_probe(struct i2c_client *client)
return err;
}
- hwmon_dev = devm_hwmon_device_register_with_info(dev, client->name,
+ hwmon_dev = devm_hwmon_device_register_with_info(dev, name,
tmp108,
&tmp108_chip_info,
NULL);
return PTR_ERR_OR_ZERO(hwmon_dev);
}
+static int tmp108_probe(struct i2c_client *client)
+{
+ struct device *dev = &client->dev;
+ struct regmap *regmap;
+
+ if (!i2c_check_functionality(client->adapter,
+ I2C_FUNC_SMBUS_WORD_DATA))
+ return dev_err_probe(dev, -ENODEV,
+ "adapter doesn't support SMBus word transactions\n");
+
+ regmap = devm_regmap_init_i2c(client, &tmp108_regmap_config);
+ if (IS_ERR(regmap))
+ return dev_err_probe(dev, PTR_ERR(regmap), "regmap init failed");
+
+ return tmp108_common_probe(dev, regmap, client->name);
+}
+
static int tmp108_suspend(struct device *dev)
{
struct tmp108 *tmp108 = dev_get_drvdata(dev);
--
2.34.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v4 2/3] hwmon: tmp108: Add support for I3C device
2024-11-12 16:51 [PATCH v4 0/3] hwmon: tmp108: Add support for P3T1085 Frank Li
2024-11-12 16:51 ` [PATCH v4 1/3] hwmon: tmp108: Add helper function tmp108_common_probe() to prepare I3C support Frank Li
@ 2024-11-12 16:52 ` Frank Li
2024-11-12 17:11 ` Guenter Roeck
2024-11-12 16:52 ` [PATCH v4 3/3] arm64: dts: imx93-9x9-qsb: add temp-sensor nxp,p3t1085 Frank Li
2 siblings, 1 reply; 8+ messages in thread
From: Frank Li @ 2024-11-12 16:52 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jonathan Cameron,
Lars-Peter Clausen, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Jean Delvare,
Guenter Roeck
Cc: devicetree, linux-kernel, linux-iio, imx, linux-arm-kernel,
Krzysztof Kozlowski, linux-hwmon, Frank Li
Add support for I3C device in the tmp108 driver to handle the P3T1085
sensor. Register the I3C device driver to enable I3C functionality for the
sensor.
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
change from v3 to v4
- use module_i3c_i2c_driver
change from v2 to v3
- change kconfig to select REGMAP_I3C if enable i3c
- remove i3c/master.h
- remove , after {}
- use #ifdef CONFIG_I3C about i3c register code
I2C I3C
Y Y support both
Y N i3c part code will not be compiled
N Y whole TPM108 will not be compiled
N N whole TPM108 will not be compiled
---
drivers/hwmon/Kconfig | 1 +
drivers/hwmon/tmp108.c | 35 ++++++++++++++++++++++++++++++++++-
2 files changed, 35 insertions(+), 1 deletion(-)
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index d43ca7aa4a548..9579db7849e1f 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -2298,6 +2298,7 @@ config SENSORS_TMP108
tristate "Texas Instruments TMP108"
depends on I2C
select REGMAP_I2C
+ select REGMAP_I3C if I3C
help
If you say yes here you get support for Texas Instruments TMP108
sensor chips and NXP P3T1085.
diff --git a/drivers/hwmon/tmp108.c b/drivers/hwmon/tmp108.c
index bfbea6349a95f..1f36af2cd2d94 100644
--- a/drivers/hwmon/tmp108.c
+++ b/drivers/hwmon/tmp108.c
@@ -13,6 +13,7 @@
#include <linux/mutex.h>
#include <linux/of.h>
#include <linux/i2c.h>
+#include <linux/i3c/device.h>
#include <linux/init.h>
#include <linux/jiffies.h>
#include <linux/regmap.h>
@@ -440,7 +441,39 @@ static struct i2c_driver tmp108_driver = {
.id_table = tmp108_i2c_ids,
};
-module_i2c_driver(tmp108_driver);
+static const struct i3c_device_id p3t1085_i3c_ids[] = {
+ I3C_DEVICE(0x011b, 0x1529, NULL),
+ {}
+};
+MODULE_DEVICE_TABLE(i3c, p3t1085_i3c_ids);
+
+static int p3t1085_i3c_probe(struct i3c_device *i3cdev)
+{
+ struct device *dev = i3cdev_to_dev(i3cdev);
+ struct regmap *regmap;
+
+#ifdef CONFIG_REGMAP_I3C
+ regmap = devm_regmap_init_i3c(i3cdev, &tmp108_regmap_config);
+#else
+ regmap = ERR_PTR(-ENODEV);
+#endif
+
+ if (IS_ERR(regmap))
+ return dev_err_probe(dev, PTR_ERR(regmap),
+ "Failed to register i3c regmap\n");
+
+ return tmp108_common_probe(dev, regmap, "p3t1085_i3c");
+}
+
+static struct i3c_driver p3t1085_driver = {
+ .driver = {
+ .name = "p3t1085_i3c",
+ },
+ .probe = p3t1085_i3c_probe,
+ .id_table = p3t1085_i3c_ids,
+};
+
+module_i3c_i2c_driver(p3t1085_driver, &tmp108_driver)
MODULE_AUTHOR("John Muir <john@jmuir.com>");
MODULE_DESCRIPTION("Texas Instruments TMP108 temperature sensor driver");
--
2.34.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v4 3/3] arm64: dts: imx93-9x9-qsb: add temp-sensor nxp,p3t1085
2024-11-12 16:51 [PATCH v4 0/3] hwmon: tmp108: Add support for P3T1085 Frank Li
2024-11-12 16:51 ` [PATCH v4 1/3] hwmon: tmp108: Add helper function tmp108_common_probe() to prepare I3C support Frank Li
2024-11-12 16:52 ` [PATCH v4 2/3] hwmon: tmp108: Add support for I3C device Frank Li
@ 2024-11-12 16:52 ` Frank Li
2024-11-12 17:03 ` Guenter Roeck
2024-12-09 11:53 ` Shawn Guo
2 siblings, 2 replies; 8+ messages in thread
From: Frank Li @ 2024-11-12 16:52 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jonathan Cameron,
Lars-Peter Clausen, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Jean Delvare,
Guenter Roeck
Cc: devicetree, linux-kernel, linux-iio, imx, linux-arm-kernel,
Krzysztof Kozlowski, linux-hwmon, Frank Li
Add temp-sensor nxp,p3t1085 for imx93-9x9-qsb boards.
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
change from v1 to v4
- none
---
arch/arm64/boot/dts/freescale/imx93-9x9-qsb.dts | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/arm64/boot/dts/freescale/imx93-9x9-qsb.dts b/arch/arm64/boot/dts/freescale/imx93-9x9-qsb.dts
index 20ec5b3c21f42..36f2995acbe29 100644
--- a/arch/arm64/boot/dts/freescale/imx93-9x9-qsb.dts
+++ b/arch/arm64/boot/dts/freescale/imx93-9x9-qsb.dts
@@ -221,6 +221,11 @@ wm8962: audio-codec@1a {
>;
};
+ p3t1085: temperature-sensor@48 {
+ compatible = "nxp,p3t1085";
+ reg = <0x48>;
+ };
+
ptn5110: tcpc@50 {
compatible = "nxp,ptn5110", "tcpci";
reg = <0x50>;
--
2.34.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v4 3/3] arm64: dts: imx93-9x9-qsb: add temp-sensor nxp,p3t1085
2024-11-12 16:52 ` [PATCH v4 3/3] arm64: dts: imx93-9x9-qsb: add temp-sensor nxp,p3t1085 Frank Li
@ 2024-11-12 17:03 ` Guenter Roeck
2024-12-09 11:53 ` Shawn Guo
1 sibling, 0 replies; 8+ messages in thread
From: Guenter Roeck @ 2024-11-12 17:03 UTC (permalink / raw)
To: Frank Li, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Jonathan Cameron, Lars-Peter Clausen, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Jean Delvare
Cc: devicetree, linux-kernel, linux-iio, imx, linux-arm-kernel,
Krzysztof Kozlowski, linux-hwmon
On 11/12/24 08:52, Frank Li wrote:
> Add temp-sensor nxp,p3t1085 for imx93-9x9-qsb boards.
>
> Signed-off-by: Frank Li <Frank.Li@nxp.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v4 1/3] hwmon: tmp108: Add helper function tmp108_common_probe() to prepare I3C support
2024-11-12 16:51 ` [PATCH v4 1/3] hwmon: tmp108: Add helper function tmp108_common_probe() to prepare I3C support Frank Li
@ 2024-11-12 17:04 ` Guenter Roeck
0 siblings, 0 replies; 8+ messages in thread
From: Guenter Roeck @ 2024-11-12 17:04 UTC (permalink / raw)
To: Frank Li
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jonathan Cameron,
Lars-Peter Clausen, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Jean Delvare, devicetree,
linux-kernel, linux-iio, imx, linux-arm-kernel,
Krzysztof Kozlowski, linux-hwmon
On Tue, Nov 12, 2024 at 11:51:59AM -0500, Frank Li wrote:
> Add help function tmp108_common_probe() to pave road to support i3c for
> P3T1085(NXP) chip.
>
> Use dev_err_probe() to simple code.
>
> Signed-off-by: Frank Li <Frank.Li@nxp.com>
Applied.
Thanks,
Guenter
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v4 2/3] hwmon: tmp108: Add support for I3C device
2024-11-12 16:52 ` [PATCH v4 2/3] hwmon: tmp108: Add support for I3C device Frank Li
@ 2024-11-12 17:11 ` Guenter Roeck
0 siblings, 0 replies; 8+ messages in thread
From: Guenter Roeck @ 2024-11-12 17:11 UTC (permalink / raw)
To: Frank Li
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jonathan Cameron,
Lars-Peter Clausen, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Jean Delvare, devicetree,
linux-kernel, linux-iio, imx, linux-arm-kernel,
Krzysztof Kozlowski, linux-hwmon
On Tue, Nov 12, 2024 at 11:52:00AM -0500, Frank Li wrote:
> Add support for I3C device in the tmp108 driver to handle the P3T1085
> sensor. Register the I3C device driver to enable I3C functionality for the
> sensor.
>
> Signed-off-by: Frank Li <Frank.Li@nxp.com>
Applied.
Thanks,
Guenter
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v4 3/3] arm64: dts: imx93-9x9-qsb: add temp-sensor nxp,p3t1085
2024-11-12 16:52 ` [PATCH v4 3/3] arm64: dts: imx93-9x9-qsb: add temp-sensor nxp,p3t1085 Frank Li
2024-11-12 17:03 ` Guenter Roeck
@ 2024-12-09 11:53 ` Shawn Guo
1 sibling, 0 replies; 8+ messages in thread
From: Shawn Guo @ 2024-12-09 11:53 UTC (permalink / raw)
To: Frank Li
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jonathan Cameron,
Lars-Peter Clausen, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Jean Delvare,
Guenter Roeck, devicetree, linux-kernel, linux-iio, imx,
linux-arm-kernel, Krzysztof Kozlowski, linux-hwmon
On Tue, Nov 12, 2024 at 11:52:01AM -0500, Frank Li wrote:
> Add temp-sensor nxp,p3t1085 for imx93-9x9-qsb boards.
>
> Signed-off-by: Frank Li <Frank.Li@nxp.com>
Applied, thanks!
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-12-09 11:54 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-12 16:51 [PATCH v4 0/3] hwmon: tmp108: Add support for P3T1085 Frank Li
2024-11-12 16:51 ` [PATCH v4 1/3] hwmon: tmp108: Add helper function tmp108_common_probe() to prepare I3C support Frank Li
2024-11-12 17:04 ` Guenter Roeck
2024-11-12 16:52 ` [PATCH v4 2/3] hwmon: tmp108: Add support for I3C device Frank Li
2024-11-12 17:11 ` Guenter Roeck
2024-11-12 16:52 ` [PATCH v4 3/3] arm64: dts: imx93-9x9-qsb: add temp-sensor nxp,p3t1085 Frank Li
2024-11-12 17:03 ` Guenter Roeck
2024-12-09 11:53 ` Shawn Guo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).