From: Jarkko Nikula <jarkko.nikula@linux.intel.com>
To: Ricardo Ribalda <ribalda@kernel.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
Wolfram Sang <wsa@kernel.org>
Subject: Re: [PATCH v2] i2c: designware: platdrv: Set class based on dmi
Date: Thu, 25 Jun 2020 16:21:39 +0300 [thread overview]
Message-ID: <e309d8c9-4721-ac78-87a2-272b4f1a8d3c@linux.intel.com> (raw)
In-Reply-To: <20200624112530.852254-1-ribalda@kernel.org>
On 6/24/20 2:25 PM, Ricardo Ribalda wrote:
> 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@kernel.org>
> ---
> v2:
> Changes by Andy Shevchenko <andriy.shevchenko@linux.intel.com>:
> - CodeStyle
> Changes by kernel test robot <lkp@intel.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;
> +}
> +
I'm not too familiar with the DMI stuff but is the more usual way to
have struct dmi_system_id table and match it with dmi_check_system()?
Perhaps scales better than individual dmi_get_system_info() and string
comparison calls.
Andy and I were pondering offline is there any info in ACPI table that
tells which bus have these sensors or can it be hardcoded with the DMI
match so that there is no need probe all buses for these sensors on that
product. But that can be another optimization patch I guess.
--
Jarkko
prev parent reply other threads:[~2020-06-25 13:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-24 11:25 [PATCH v2] i2c: designware: platdrv: Set class based on dmi Ricardo Ribalda
2020-06-24 13:22 ` Andy Shevchenko
2020-06-24 13:45 ` Jarkko Nikula
2020-06-25 13:21 ` Jarkko Nikula [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e309d8c9-4721-ac78-87a2-272b4f1a8d3c@linux.intel.com \
--to=jarkko.nikula@linux.intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=ribalda@kernel.org \
--cc=wsa@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox