[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241109131604.5d8b701a@jic23-huawei>
Date: Sat, 9 Nov 2024 13:16:04 +0000
From: Jonathan Cameron <jic23@...nel.org>
To: Frank Li <Frank.Li@....com>
Cc: Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>, Lars-Peter Clausen <lars@...afoo.de>,
Shawn Guo <shawnguo@...nel.org>, Sascha Hauer <s.hauer@...gutronix.de>,
Pengutronix Kernel Team <kernel@...gutronix.de>, Fabio Estevam
<festevam@...il.com>, Jean Delvare <jdelvare@...e.com>, Guenter Roeck
<linux@...ck-us.net>, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-iio@...r.kernel.org,
imx@...ts.linux.dev, linux-arm-kernel@...ts.infradead.org, Krzysztof
Kozlowski <krzk@...nel.org>, linux-hwmon@...r.kernel.org
Subject: Re: [PATCH v2 3/4] hwmon: tmp108: Add support for I3C device
On Fri, 08 Nov 2024 17:26:57 -0500
Frank Li <Frank.Li@....com> 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@....com>
> ---
> drivers/hwmon/tmp108.c | 31 +++++++++++++++++++++++++++++++
> 1 file changed, 31 insertions(+)
>
> diff --git a/drivers/hwmon/tmp108.c b/drivers/hwmon/tmp108.c
> index bfbea6349a95f..83d6847cb542c 100644
> --- a/drivers/hwmon/tmp108.c
> +++ b/drivers/hwmon/tmp108.c
> @@ -13,6 +13,8 @@
> #include <linux/mutex.h>
> #include <linux/of.h>
> #include <linux/i2c.h>
> +#include <linux/i3c/device.h>
> +#include <linux/i3c/master.h>
Seems odd you need master.h in a device driver.
I'll guess that's because you should be using i3cdev_to_device()
and not looking in the i3c_device structure at all.
> #include <linux/init.h>
> #include <linux/jiffies.h>
> #include <linux/regmap.h>
> @@ -442,6 +444,35 @@ static struct i2c_driver tmp108_driver = {
>
> module_i2c_driver(tmp108_driver);
>
> +#ifdef CONFIG_REGMAP_I3C
> +static const struct i3c_device_id p3t1085_i3c_ids[] = {
> + I3C_DEVICE(0x011b, 0x1529, NULL),
> + {},
Trivial, but no trailing comma needed here as nothing can come after
this terminator entry. That is also consistent with existing similar
tables in this driver.
> +};
> +MODULE_DEVICE_TABLE(i3c, p3t1085_i3c_ids);
> +
> +static int p3t1085_i3c_probe(struct i3c_device *i3cdev)
> +{
> + struct regmap *regmap;
> +
> + regmap = devm_regmap_init_i3c(i3cdev, &tmp108_regmap_config);
> + if (IS_ERR(regmap))
> + return dev_err_probe(&i3cdev->dev, PTR_ERR(regmap),
> + "Failed to register i3c regmap\n");
> +
> + return tmp108_common_probe(&i3cdev->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_driver(p3t1085_driver);
> +#endif
> +
> MODULE_AUTHOR("John Muir <john@...ir.com>");
> MODULE_DESCRIPTION("Texas Instruments TMP108 temperature sensor driver");
> MODULE_LICENSE("GPL");
>
Powered by blists - more mailing lists