Skip to content

Commit db2a8b6

Browse files
ribaldawsakernel
authored andcommitted
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. DocLink: https://qtec.com/camera-technology-camera-platforms/ Fixes: 3eddad9 ("i2c: designware: reverts "i2c: designware: Add support for AMD I2C controller"") Signed-off-by: Ricardo Ribalda <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Acked-by: Jarkko Nikula <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent cd217f2 commit db2a8b6

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

drivers/i2c/busses/i2c-designware-platdrv.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <linux/clk-provider.h>
1313
#include <linux/clk.h>
1414
#include <linux/delay.h>
15+
#include <linux/dmi.h>
1516
#include <linux/err.h>
1617
#include <linux/errno.h>
1718
#include <linux/i2c.h>
@@ -191,6 +192,17 @@ static int dw_i2c_plat_request_regs(struct dw_i2c_dev *dev)
191192
return ret;
192193
}
193194

195+
static const struct dmi_system_id dw_i2c_hwmon_class_dmi[] = {
196+
{
197+
.ident = "Qtechnology QT5222",
198+
.matches = {
199+
DMI_MATCH(DMI_SYS_VENDOR, "Qtechnology"),
200+
DMI_MATCH(DMI_PRODUCT_NAME, "QT5222"),
201+
},
202+
},
203+
{ } /* terminate list */
204+
};
205+
194206
static int dw_i2c_plat_probe(struct platform_device *pdev)
195207
{
196208
struct dw_i2c_platform_data *pdata = dev_get_platdata(&pdev->dev);
@@ -267,7 +279,8 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
267279

268280
adap = &dev->adapter;
269281
adap->owner = THIS_MODULE;
270-
adap->class = I2C_CLASS_DEPRECATED;
282+
adap->class = dmi_check_system(dw_i2c_hwmon_class_dmi) ?
283+
I2C_CLASS_HWMON : I2C_CLASS_DEPRECATED;
271284
ACPI_COMPANION_SET(&adap->dev, ACPI_COMPANION(&pdev->dev));
272285
adap->dev.of_node = pdev->dev.of_node;
273286
adap->nr = -1;

0 commit comments

Comments
 (0)