i2c: designware: platdrv: Set class based on dmi
Subsystems (3)
PATCH v3 1/1 i2c: designware: platdrv: Set class based on dmi
Current AMD's zen-based APUs use this core for some of its i2c-buses.
With this patch we re-enable autodetection of hwmon-alike devices, so lm-sensors will be able to work automatically.
It does not affect the boot-time of embedded devices, as the class is set based on the dmi information.
Dmi is probed only on Qtechnology QT5222 Industrial Camera Platform
https://qtec.com/camera-technology-camera-platforms/
---
v3: Comment by Andy Shevchenko <[email protected]>
- Add Fixes tag
- Do not user strstr for dmidecode
Comment by Jarkko Nikula <[email protected]>
- Use dmi_check_system()
drivers/i2c/busses/i2c-designware-platdrv.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-designware-platdrv.c +15 -1
@@ -12,6 +12,7 @@#include <linux/clk-provider.h> #include <linux/clk.h> #include <linux/delay.h> +#include <linux/dmi.h> #include <linux/err.h> #include <linux/errno.h> #include <linux/i2c.h>
@@ -191,6 +192,18 @@ static int dw_i2c_plat_request_regs(struct dw_i2c_dev *dev)return ret; } +static const struct dmi_system_id allow_probe[] = { + { + .ident ="Qtechnology QT5222" , + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Qtechnology" ), +DMI_MATCH (DMI_PRODUCT_NAME ,"QT5222" ) + } + }, + + { } +}; +static int dw_i2c_plat_probe (struct platform_device *pdev) {struct dw_i2c_platform_data *pdata =dev_get_platdata (&pdev->dev);
@@ -267,7 +280,8 @@ static int dw_i2c_plat_probe(struct platform_device *pdev) adap = &dev->adapter; adap->owner =THIS_MODULE ; - adap->class =I2C_CLASS_DEPRECATED ; + adap->class =dmi_check_system (allow_probe) ? +I2C_CLASS_HWMON :I2C_CLASS_DEPRECATED ;ACPI_COMPANION_SET (&adap->dev,ACPI_COMPANION (&pdev->dev)); adap->dev.of_node = pdev->dev.of_node; adap->nr =-1 ;
Signature · 1 line
2.27.0
Andy Shevchenko
reviewerQuoted 7 lines · Ricardo Ribalda
Current AMD's zen-based APUs use this core for some of its i2c-buses.
With this patch we re-enable autodetection of hwmon-alike devices, so lm-sensors will be able to work automatically.
It does not affect the boot-time of embedded devices, as the class is set based on the dmi information.
dmi -> DMI
Quoted 1 line
Dmi is probed only on Qtechnology QT5222 Industrial Camera Platform
Dmi -> DMI
Quoted 1 line
Use DocLink: tag.
...
Quoted 1 line
+static const struct
dmi_system_idallow_probe[] = {
allow_probe -> dw_i2c_hwmon_class_dmi
drivers/i2c/busses/i2c-designware-platdrv.c static int dw_i2c_plat_request_regs(struct dw_i2c_dev *dev) · line 200
Quoted 6 lines
drivers/i2c/busses/i2c-designware-platdrv.c +5
-0+ { + .ident = "Qtechnology QT5222", + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Qtechnology" ), +DMI_MATCH (DMI_PRODUCT_NAME ,"QT5222" )
Comma is missed.
drivers/i2c/busses/i2c-designware-platdrv.c static int dw_i2c_plat_request_regs(struct dw_i2c_dev *dev) · line 203
Quoted 4 lines
drivers/i2c/busses/i2c-designware-platdrv.c +3
-0+ } + }, +
Redundant.
Quoted 2 lines
drivers/i2c/busses/i2c-designware-platdrv.c +2
-0+ { } +};
Signature · 2 lines
With Best Regards, Andy Shevchenko
Andy Shevchenko
reviewerQuoted 10 lines · Andy Shevchenko
Quoted 7 lines · Ricardo Ribalda
Current AMD's zen-based APUs use this core for some of its i2c-buses.
With this patch we re-enable autodetection of hwmon-alike devices, so lm-sensors will be able to work automatically.
It does not affect the boot-time of embedded devices, as the class is set based on the dmi information.
dmi -> DMI
...and in the Subject.
Quoted 3 lines
Quoted 1 line
Dmi is probed only on Qtechnology QT5222 Industrial Camera Platform
Dmi -> DMI
...and period at the end of sentence.
Quoted 34 lines
Quoted 1 line
Use DocLink: tag.
...
Quoted 1 line
+static const struct
dmi_system_idallow_probe[] = {
allow_probe->dw_i2c_hwmon_class_dmidrivers/i2c/busses/i2c-designware-platdrv.c static int dw_i2c_plat_request_regs(struct dw_i2c_dev *dev) · line 200
Quoted 6 lines
drivers/i2c/busses/i2c-designware-platdrv.c +5
-0+ { + .ident = "Qtechnology QT5222", + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Qtechnology" ), +DMI_MATCH (DMI_PRODUCT_NAME ,"QT5222" )Comma is missed.
drivers/i2c/busses/i2c-designware-platdrv.c static int dw_i2c_plat_request_regs(struct dw_i2c_dev *dev) · line 203
Quoted 4 lines
drivers/i2c/busses/i2c-designware-platdrv.c +3
-0+ } + }, +Redundant.
Quoted 2 lines
drivers/i2c/busses/i2c-designware-platdrv.c +2
-0+ { } +};Signature · 2 lines
With Best Regards, Andy Shevchenko
Signature · 2 lines
With Best Regards, Andy Shevchenko