drivers/hwmon/pmbus/dps920ab.c | 7 +++++++ 1 file changed, 7 insertions(+)
Currently I have an x86-based system with a Delta PSU
attched to it thought the i2c bus and OF is disabled.
That means that in the configuration above I can't instantiate
an i2c driver since the driver doesn't have the i2c match table.
Let's add the ability to match the driver with i2c like the
following command:
echo "dps920ab" 0x58 > /sys/bus/i2c/devices/i2c-0/new_device
...
[616189.076211] i2c i2c-0: new_device: Instantiated device dps920ab at 0x58
v2: add more verbose changelog
Signed-off-by: Denis Kirjanov <kirjanov@gmail.com>
---
drivers/hwmon/pmbus/dps920ab.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/hwmon/pmbus/dps920ab.c b/drivers/hwmon/pmbus/dps920ab.c
index cc5aac9dfdb3..c002ed41f517 100644
--- a/drivers/hwmon/pmbus/dps920ab.c
+++ b/drivers/hwmon/pmbus/dps920ab.c
@@ -190,12 +190,19 @@ static const struct of_device_id __maybe_unused dps920ab_of_match[] = {
MODULE_DEVICE_TABLE(of, dps920ab_of_match);
+static struct i2c_device_id dps920ab_i2c_match[] = {
+ { "dps920ab" },
+ {}
+};
+MODULE_DEVICE_TABLE(i2c, dps920ab_i2c_match);
+
static struct i2c_driver dps920ab_driver = {
.driver = {
.name = "dps920ab",
.of_match_table = of_match_ptr(dps920ab_of_match),
},
.probe = dps920ab_probe,
+ .id_table = dps920ab_device_id,
};
module_i2c_driver(dps920ab_driver);
--
2.43.0
On Fri, Dec 27, 2024 at 01:59:55PM +0300, Denis Kirjanov wrote: > Currently I have an x86-based system with a Delta PSU > attched to it thought the i2c bus and OF is disabled. > That means that in the configuration above I can't instantiate > an i2c driver since the driver doesn't have the i2c match table. > > Let's add the ability to match the driver with i2c like the > following command: > > echo "dps920ab" 0x58 > /sys/bus/i2c/devices/i2c-0/new_device > ... > [616189.076211] i2c i2c-0: new_device: Instantiated device dps920ab at 0x58 > > v2: add more verbose changelog > > Signed-off-by: Denis Kirjanov <kirjanov@gmail.com> Documentation/process/submitting-patches.rst, "The canonical patch format", describes in detail how a patch description should look like. Anything from "The explanation body" onwards is relevant here. A useful patch description would be a simple "Add support for instantiating the Delta DPS920AB PSU through I2C on systems without devicetree support". Everything else is irrelevant for the patch description and, if desired, should be after "---". Thanks, Guenter
© 2016 - 2026 Red Hat, Inc.