[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200624112530.852254-1-ribalda@kernel.org>
Date: Wed, 24 Jun 2020 13:25:30 +0200
From: Ricardo Ribalda <ribalda@...nel.org>
To: Jarkko Nikula <jarkko.nikula@...ux.intel.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Mika Westerberg <mika.westerberg@...ux.intel.com>,
linux-i2c@...r.kernel.org, linux-kernel@...r.kernel.org,
Wolfram Sang <wsa@...nel.org>
Cc: Ricardo Ribalda <ribalda@...nel.org>
Subject: [PATCH v2] 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.
Signed-off-by: Ricardo Ribalda <ribalda@...nel.org>
---
v2:
Changes by Andy Shevchenko <andriy.shevchenko@...ux.intel.com>:
- CodeStyle
Changes by kernel test robot <lkp@...el.com>
- Include dmi header to fix build error on arc
- check if dmi_get_system_info returned NULL
drivers/i2c/busses/i2c-designware-platdrv.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index c2efaaaac252..5892fdba9c25 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -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>
@@ -173,6 +174,19 @@ static void dw_i2c_plat_pm_cleanup(struct dw_i2c_dev *dev)
pm_runtime_put_noidle(dev->dev);
}
+static bool dw_i2c_hwmon_bus(void)
+{
+ const char *product_name = dmi_get_system_info(DMI_PRODUCT_NAME);
+
+ if (!product_name)
+ return false;
+
+ if (strstr(product_name, "QT5222"))
+ return true;
+
+ return false;
+}
+
static int dw_i2c_plat_request_regs(struct dw_i2c_dev *dev)
{
struct platform_device *pdev = to_platform_device(dev->dev);
@@ -267,7 +281,7 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
adap = &dev->adapter;
adap->owner = THIS_MODULE;
- adap->class = I2C_CLASS_DEPRECATED;
+ adap->class = dw_i2c_hwmon_bus() ? 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;
--
2.27.0
Powered by blists - more mailing lists