* [PATCH] iio: adc: ti-adc081c: Partial revert of removal of ACPI IDs
@ 2021-10-03 16:24 Jonathan Cameron
2021-10-03 16:28 ` Andy Shevchenko
0 siblings, 1 reply; 7+ messages in thread
From: Jonathan Cameron @ 2021-10-03 16:24 UTC (permalink / raw)
To: linux-iio; +Cc: Jonathan Cameron, Kunyang Fan, Andy Shevchenko
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Unfortuanately a non standards compliant ACPI ID is known to be
in the wild on some AAEON boards.
Partly revert the removal of these IDs so that ADC081C will again
work + add a comment to that affect for future reference.
Reported-by: Kunyang Fan <Kunyang_Fan@aaeon.com.tw>
Fixes: c458b7ca3fd0 ("iio:adc:ti-adc081c: Drop ACPI ids that seem very unlikely to be official.")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
---
Kunyang Fan,
I left this for a while in the hope that you might be able to
provide more details on where this ID is used + whether there are
other similar IDs in use by AAEON firmwares.
That information would still be extremely useful given the vague
nature of the comment I have added will give us no real information
on whether we can drop this in the distant future.
Also, please test this patch to make sure I've put back everything
necessary.
drivers/iio/adc/ti-adc081c.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/adc/ti-adc081c.c b/drivers/iio/adc/ti-adc081c.c
index 16fc608db36a..0872a4897609 100644
--- a/drivers/iio/adc/ti-adc081c.c
+++ b/drivers/iio/adc/ti-adc081c.c
@@ -15,6 +15,7 @@
* bits of value registers are reserved.
*/
+#include <linux/acpi.h>
#include <linux/err.h>
#include <linux/i2c.h>
#include <linux/module.h>
@@ -162,7 +163,17 @@ static int adc081c_probe(struct i2c_client *client,
if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WORD_DATA))
return -EOPNOTSUPP;
- model = &adcxx1c_models[id->driver_data];
+ if (ACPI_COMPANION(&client->dev)) {
+ const struct acpi_device_id *ad_id;
+
+ ad_id = acpi_match_device(client->dev.driver->acpi_match_table,
+ &client->dev);
+ if (!ad_id)
+ return -ENODEV;
+ model = &adcxx1c_models[ad_id->driver_data];
+ } else {
+ model = &adcxx1c_models[id->driver_data];
+ }
iio = devm_iio_device_alloc(&client->dev, sizeof(*adc));
if (!iio)
@@ -210,6 +221,13 @@ static const struct i2c_device_id adc081c_id[] = {
};
MODULE_DEVICE_TABLE(i2c, adc081c_id);
+static const struct acpi_device_id adc081c_acpi_match[] = {
+ /* Used on some AAEON boards */
+ { "ADC081C", ADC081C },
+ { }
+};
+MODULE_DEVICE_TABLE(acpi, adc081c_acpi_match);
+
static const struct of_device_id adc081c_of_match[] = {
{ .compatible = "ti,adc081c" },
{ .compatible = "ti,adc101c" },
@@ -222,6 +240,7 @@ static struct i2c_driver adc081c_driver = {
.driver = {
.name = "adc081c",
.of_match_table = adc081c_of_match,
+ .acpi_match_table = adc081c_acpi_match,
},
.probe = adc081c_probe,
.id_table = adc081c_id,
--
2.33.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] iio: adc: ti-adc081c: Partial revert of removal of ACPI IDs
2021-10-03 16:24 [PATCH] iio: adc: ti-adc081c: Partial revert of removal of ACPI IDs Jonathan Cameron
@ 2021-10-03 16:28 ` Andy Shevchenko
2021-10-04 19:25 ` Jonathan Cameron
2021-11-30 4:22 ` Kunyang Fan(范坤揚)
0 siblings, 2 replies; 7+ messages in thread
From: Andy Shevchenko @ 2021-10-03 16:28 UTC (permalink / raw)
To: Jonathan Cameron; +Cc: linux-iio, Jonathan Cameron, Kunyang Fan
On Sun, Oct 3, 2021 at 7:20 PM Jonathan Cameron <jic23@kernel.org> wrote:
>
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> Unfortuanately a non standards compliant ACPI ID is known to be
Unfortunately
> in the wild on some AAEON boards.
>
> Partly revert the removal of these IDs so that ADC081C will again
> work + add a comment to that affect for future reference.
affect?! Okay, you are native speaker.
...
> +#include <linux/acpi.h>
> + if (ACPI_COMPANION(&client->dev)) {
> + const struct acpi_device_id *ad_id;
> +
> + ad_id = acpi_match_device(client->dev.driver->acpi_match_table,
> + &client->dev);
> + if (!ad_id)
> + return -ENODEV;
> + model = &adcxx1c_models[ad_id->driver_data];
> + } else {
> + model = &adcxx1c_models[id->driver_data];
> + }
Can we please use device_get_match_data() instead (with corresponding
property.h inclusion instead of acpi.h)?
This may require adding driver_data to OF IDs.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] iio: adc: ti-adc081c: Partial revert of removal of ACPI IDs
2021-10-03 16:28 ` Andy Shevchenko
@ 2021-10-04 19:25 ` Jonathan Cameron
2021-11-30 4:22 ` Kunyang Fan(范坤揚)
1 sibling, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2021-10-04 19:25 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: linux-iio, Jonathan Cameron, Kunyang Fan
On Sun, 3 Oct 2021 19:28:06 +0300
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> On Sun, Oct 3, 2021 at 7:20 PM Jonathan Cameron <jic23@kernel.org> wrote:
> >
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> >
> > Unfortuanately a non standards compliant ACPI ID is known to be
>
> Unfortunately
One day I'll actually remember to spell check my patch descriptions.
Sorry!
>
> > in the wild on some AAEON boards.
> >
> > Partly revert the removal of these IDs so that ADC081C will again
> > work + add a comment to that affect for future reference.
>
> affect?! Okay, you are native speaker.
Doesn't make me competent at writing my native language :)
>
> ...
>
> > +#include <linux/acpi.h>
>
> > + if (ACPI_COMPANION(&client->dev)) {
> > + const struct acpi_device_id *ad_id;
> > +
> > + ad_id = acpi_match_device(client->dev.driver->acpi_match_table,
> > + &client->dev);
> > + if (!ad_id)
> > + return -ENODEV;
> > + model = &adcxx1c_models[ad_id->driver_data];
> > + } else {
> > + model = &adcxx1c_models[id->driver_data];
> > + }
>
> Can we please use device_get_match_data() instead (with corresponding
> property.h inclusion instead of acpi.h)?
> This may require adding driver_data to OF IDs.
>
Sure. I was going for minimal change + most revert like, but fair enough
we'll clean that up whilst here.
Jonathan
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH] iio: adc: ti-adc081c: Partial revert of removal of ACPI IDs
2021-10-03 16:28 ` Andy Shevchenko
2021-10-04 19:25 ` Jonathan Cameron
@ 2021-11-30 4:22 ` Kunyang Fan(范坤揚)
2021-11-30 9:44 ` Andy Shevchenko
1 sibling, 1 reply; 7+ messages in thread
From: Kunyang Fan(范坤揚) @ 2021-11-30 4:22 UTC (permalink / raw)
To: Andy Shevchenko, Jonathan Cameron
Cc: linux-iio, Jonathan Cameron, Kunyang Fan,
Jacob Wu(吳文傑)
Hi Andy,
This patch would affect the ADC function on AAEON x86 products: https://www.aaeon.com/en/p/developer-board-intel-11th-up-xtreme-i11, we need the ACPI ID to enable ADC device ADC081C
Thanks,
Kunyang
-----Original Message-----
From: Andy Shevchenko <andy.shevchenko@gmail.com>
Sent: Monday, October 4, 2021 12:28 AM
To: Jonathan Cameron <jic23@kernel.org>
Cc: linux-iio <linux-iio@vger.kernel.org>; Jonathan Cameron <Jonathan.Cameron@huawei.com>; Kunyang Fan <Kunyang_Fan@aaeon.com.tw>
Subject: Re: [PATCH] iio: adc: ti-adc081c: Partial revert of removal of ACPI IDs
On Sun, Oct 3, 2021 at 7:20 PM Jonathan Cameron <jic23@kernel.org> wrote:
>
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> Unfortuanately a non standards compliant ACPI ID is known to be
Unfortunately
> in the wild on some AAEON boards.
>
> Partly revert the removal of these IDs so that ADC081C will again work
> + add a comment to that affect for future reference.
affect?! Okay, you are native speaker.
...
> +#include <linux/acpi.h>
> + if (ACPI_COMPANION(&client->dev)) {
> + const struct acpi_device_id *ad_id;
> +
> + ad_id = acpi_match_device(client->dev.driver->acpi_match_table,
> + &client->dev);
> + if (!ad_id)
> + return -ENODEV;
> + model = &adcxx1c_models[ad_id->driver_data];
> + } else {
> + model = &adcxx1c_models[id->driver_data];
> + }
Can we please use device_get_match_data() instead (with corresponding property.h inclusion instead of acpi.h)?
This may require adding driver_data to OF IDs.
--
With Best Regards,
Andy Shevchenko
<p></p>
===================================================================================================================================
This email and any attachments to it contain confidential information and are intended solely for the use of the individual to whom it is addressed.If you are not the intended recipient or receive it accidentally, please immediately notify the sender by e-mail and delete the message and any attachments from your computer system, and destroy all hard copies. If any, please be advised that any unauthorized disclosure, copying, distribution or any action taken or omitted in reliance on this, is illegal and prohibited. Furthermore, any views or opinions expressed are solely those of the author and do not represent those of ASUSTeK. Thank you for your cooperation.
===================================================================================================================================
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] iio: adc: ti-adc081c: Partial revert of removal of ACPI IDs
2021-11-30 4:22 ` Kunyang Fan(范坤揚)
@ 2021-11-30 9:44 ` Andy Shevchenko
2021-11-30 10:10 ` Jonathan Cameron
0 siblings, 1 reply; 7+ messages in thread
From: Andy Shevchenko @ 2021-11-30 9:44 UTC (permalink / raw)
To: Kunyang Fan(范坤揚)
Cc: Jonathan Cameron, linux-iio, Jonathan Cameron, Kunyang Fan,
Jacob Wu(吳文傑)
On Tue, Nov 30, 2021 at 6:22 AM Kunyang Fan(范坤揚) <Kunyang_Fan@asus.com> wrote:
>
> Hi Andy,
>
> This patch would affect the ADC function on AAEON x86 products: https://www.aaeon.com/en/p/developer-board-intel-11th-up-xtreme-i11, we need the ACPI ID to enable ADC device ADC081C
AFAIU Jonathan did that patch (and it's applied, right?) exactly for
that reason, but the main issue here is the process inside AAEON
company regarding ACPI IDs, can that be fixed please?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] iio: adc: ti-adc081c: Partial revert of removal of ACPI IDs
2021-11-30 9:44 ` Andy Shevchenko
@ 2021-11-30 10:10 ` Jonathan Cameron
2021-11-30 10:16 ` Kunyang Fan(范坤揚)
0 siblings, 1 reply; 7+ messages in thread
From: Jonathan Cameron @ 2021-11-30 10:10 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Kunyang Fan(范坤揚), Jonathan Cameron,
linux-iio, Kunyang Fan, Jacob Wu(吳文傑)
On Tue, 30 Nov 2021 11:44:17 +0200
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> On Tue, Nov 30, 2021 at 6:22 AM Kunyang Fan(范坤揚) <Kunyang_Fan@asus.com> wrote:
> >
> > Hi Andy,
> >
> > This patch would affect the ADC function on AAEON x86 products: https://www.aaeon.com/en/p/developer-board-intel-11th-up-xtreme-i11, we need the ACPI ID to enable ADC device ADC081C
>
> AFAIU Jonathan did that patch (and it's applied, right?) exactly for
> that reason, but the main issue here is the process inside AAEON
> company regarding ACPI IDs, can that be fixed please?
>
I need to do a v2 with changes as you suggested, so not in yet.
Jonathan
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH] iio: adc: ti-adc081c: Partial revert of removal of ACPI IDs
2021-11-30 10:10 ` Jonathan Cameron
@ 2021-11-30 10:16 ` Kunyang Fan(范坤揚)
0 siblings, 0 replies; 7+ messages in thread
From: Kunyang Fan(范坤揚) @ 2021-11-30 10:16 UTC (permalink / raw)
To: Jonathan Cameron, Andy Shevchenko
Cc: Jonathan Cameron, linux-iio, Kunyang Fan,
Jacob Wu(吳文傑)
Hi Andy,
Yes, this patch can resolve the ADC device "ADC081C021CIMKX" not found issue on our x86 devices. Currently, this patch is still not in the latest kernel 5.16.0-rc3.
Best regard,
Kunyang
-----Original Message-----
From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
Sent: Tuesday, November 30, 2021 6:11 PM
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Kunyang Fan(范坤揚) <Kunyang_Fan@asus.com>; Jonathan Cameron <jic23@kernel.org>; linux-iio <linux-iio@vger.kernel.org>; Kunyang Fan <Kunyang_Fan@aaeon.com.tw>; Jacob Wu(吳文傑) <Jacob_Wu@asus.com>
Subject: Re: [PATCH] iio: adc: ti-adc081c: Partial revert of removal of ACPI IDs
On Tue, 30 Nov 2021 11:44:17 +0200
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> On Tue, Nov 30, 2021 at 6:22 AM Kunyang Fan(范坤揚) <Kunyang_Fan@asus.com> wrote:
> >
> > Hi Andy,
> >
> > This patch would affect the ADC function on AAEON x86 products:
> > https://www.aaeon.com/en/p/developer-board-intel-11th-up-xtreme-i11,
> > we need the ACPI ID to enable ADC device ADC081C
>
> AFAIU Jonathan did that patch (and it's applied, right?) exactly for
> that reason, but the main issue here is the process inside AAEON
> company regarding ACPI IDs, can that be fixed please?
>
I need to do a v2 with changes as you suggested, so not in yet.
Jonathan
<p></p>
===================================================================================================================================
This email and any attachments to it contain confidential information and are intended solely for the use of the individual to whom it is addressed.If you are not the intended recipient or receive it accidentally, please immediately notify the sender by e-mail and delete the message and any attachments from your computer system, and destroy all hard copies. If any, please be advised that any unauthorized disclosure, copying, distribution or any action taken or omitted in reliance on this, is illegal and prohibited. Furthermore, any views or opinions expressed are solely those of the author and do not represent those of ASUSTeK. Thank you for your cooperation.
===================================================================================================================================
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-11-30 10:16 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-03 16:24 [PATCH] iio: adc: ti-adc081c: Partial revert of removal of ACPI IDs Jonathan Cameron
2021-10-03 16:28 ` Andy Shevchenko
2021-10-04 19:25 ` Jonathan Cameron
2021-11-30 4:22 ` Kunyang Fan(范坤揚)
2021-11-30 9:44 ` Andy Shevchenko
2021-11-30 10:10 ` Jonathan Cameron
2021-11-30 10:16 ` Kunyang Fan(范坤揚)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox