|
13 | 13 | #include <linux/mutex.h>
|
14 | 14 | #include <linux/of.h>
|
15 | 15 | #include <linux/i2c.h>
|
| 16 | +#include <linux/i3c/device.h> |
16 | 17 | #include <linux/init.h>
|
17 | 18 | #include <linux/jiffies.h>
|
18 | 19 | #include <linux/regmap.h>
|
@@ -440,7 +441,39 @@ static struct i2c_driver tmp108_driver = {
|
440 | 441 | .id_table = tmp108_i2c_ids,
|
441 | 442 | };
|
442 | 443 |
|
443 |
| -module_i2c_driver(tmp108_driver); |
| 444 | +static const struct i3c_device_id p3t1085_i3c_ids[] = { |
| 445 | + I3C_DEVICE(0x011b, 0x1529, NULL), |
| 446 | + {} |
| 447 | +}; |
| 448 | +MODULE_DEVICE_TABLE(i3c, p3t1085_i3c_ids); |
| 449 | + |
| 450 | +static int p3t1085_i3c_probe(struct i3c_device *i3cdev) |
| 451 | +{ |
| 452 | + struct device *dev = i3cdev_to_dev(i3cdev); |
| 453 | + struct regmap *regmap; |
| 454 | + |
| 455 | +#ifdef CONFIG_REGMAP_I3C |
| 456 | + regmap = devm_regmap_init_i3c(i3cdev, &tmp108_regmap_config); |
| 457 | +#else |
| 458 | + regmap = ERR_PTR(-ENODEV); |
| 459 | +#endif |
| 460 | + |
| 461 | + if (IS_ERR(regmap)) |
| 462 | + return dev_err_probe(dev, PTR_ERR(regmap), |
| 463 | + "Failed to register i3c regmap\n"); |
| 464 | + |
| 465 | + return tmp108_common_probe(dev, regmap, "p3t1085_i3c"); |
| 466 | +} |
| 467 | + |
| 468 | +static struct i3c_driver p3t1085_driver = { |
| 469 | + .driver = { |
| 470 | + .name = "p3t1085_i3c", |
| 471 | + }, |
| 472 | + .probe = p3t1085_i3c_probe, |
| 473 | + .id_table = p3t1085_i3c_ids, |
| 474 | +}; |
| 475 | + |
| 476 | +module_i3c_i2c_driver(p3t1085_driver, &tmp108_driver) |
444 | 477 |
|
445 | 478 | MODULE_AUTHOR( "John Muir <[email protected]>");
|
446 | 479 | MODULE_DESCRIPTION("Texas Instruments TMP108 temperature sensor driver");
|
|
0 commit comments