iio: adc: ti-adc081c: Partial revert of removal of ACPI IDs
Jonathan Cameron
maintainerPATCH 1/1 iio: adc: ti-adc081c: Partial revert of removal of ACPI IDs
From: Jonathan Cameron <[email protected]>
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.
---
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(-)
drivers/iio/adc/ti-adc081c.c +20 -1
@@ -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,
Signature · 1 line
2.33.0
Quoted 4 lines · Jonathan Cameron
From: Jonathan Cameron <[email protected]>
Unfortuanately a non standards compliant ACPI ID is known to be
Unfortunately
Quoted 4 lines
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.
...
drivers/iio/adc/ti-adc081c.c static int adc081c_probe(struct i2c_client *client, · line 176
Quoted 13 lines
drivers/iio/adc/ti-adc081c.c +12
-0+#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.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Jonathan Cameron
maintainerQuoted 7 lines · On Sun, 3 Oct 2021 19:28:06 +0300 Andy Shevchenko <[email protected]>…
Quoted 4 lines · Jonathan Cameron
From: Jonathan Cameron <[email protected]>
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!
Quoted 7 lines
Quoted 5 lines
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 :)
Quoted 17 lines
...
drivers/iio/adc/ti-adc081c.c static int adc081c_probe(struct i2c_client *client, · line 176
Quoted 13 lines
drivers/iio/adc/ti-adc081c.c +12
-0+#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]; + }
Quoted 4 lines
Can we please use
device_get_match_data()instead (with correspondingproperty.hinclusion instead ofacpi.h)?
This may require addingdriver_datato OF IDs.
Sure. I was going for minimal change + most revert like, but fair enough we'll clean that up whilst here.
Jonathan
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 <[email protected]>
Sent: Monday, October 4, 2021 12:28 AM
To: Jonathan Cameron <[email protected]>
Cc: linux-iio <[email protected]>; Jonathan Cameron <[email protected]>; Kunyang Fan <[email protected]>
Subject: Re: [PATCH] iio: adc: ti-adc081c: Partial revert of removal of ACPI IDs
Quoted 4 lines · Jonathan Cameron
From: Jonathan Cameron <[email protected]>
Unfortuanately a non standards compliant ACPI ID is known to be
Unfortunately
Quoted 4 lines
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.
...
drivers/iio/adc/ti-adc081c.c static int adc081c_probe(struct i2c_client *client, · line 176
Quoted 13 lines
drivers/iio/adc/ti-adc081c.c +12
-0+#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.
===================================================================================================================================
Quoted 4 lines · Kunyang Fan(范坤揚)
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?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 10 lines · On Tue, 30 Nov 2021 11:44:17 +0200 Andy Shevchenko <[email protected]>…
Quoted 4 lines · Kunyang Fan(范坤揚)
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
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 <[email protected]>
Sent: Tuesday, November 30, 2021 6:11 PM
To: Andy Shevchenko <[email protected]>
Cc: Kunyang Fan(范坤揚) <[email protected]>; Jonathan Cameron <[email protected]>; linux-iio <[email protected]>; Kunyang Fan <[email protected]>; Jacob Wu(吳文傑) <[email protected]>
Subject: Re: [PATCH] iio: adc: ti-adc081c: Partial revert of removal of ACPI IDs
Quoted 4 lines · On Tue, 30 Nov 2021 11:44:17 +0200 Andy Shevchenko <[email protected]>…
Quoted 3 lines · Kunyang Fan(范坤揚)
Hi Andy,
Quoted 8 lines
Quoted 3 lines
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 ADC081CAFAIU 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.
===================================================================================================================================