All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@jic23.retrosnub.co.uk>
To: "Kunyang Fan(范坤揚)" <Kunyang_Fan@asus.com>
Cc: "linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	Kunyang Fan <Kunyang_Fan@aaeon.com.tw>,
	Andy Shevchenko <andy.shevchenko@gmail.com>
Subject: Re: [PATCH v2] iio: adc: ti-adc081c: Partial revert of removal of ACPI IDs
Date: Sun, 12 Dec 2021 16:22:21 +0000	[thread overview]
Message-ID: <20211212162153.28810ff0@jic23-huawei> (raw)
In-Reply-To: <HK0PR04MB3074C424090A590237DC4173F66F9@HK0PR04MB3074.apcprd04.prod.outlook.com>

On Wed, 8 Dec 2021 07:36:16 +0000
Kunyang Fan(范坤揚) <Kunyang_Fan@asus.com> wrote:

> Hi Jonathan,
> 
> This patch is looked good to me, and I used our product UP-extremei11 to verify ADC ADC081C function.

Hi Kunayang,

If you could give a formal Tested-by tag that would be great.

I'm running a bit slow this this weekend so will try
to pick up outstanding patches mid week.

Thanks,

Jonathan

> 
> Thanks,
> 
> Kunyang
> 
> -----Original Message-----
> From: Jonathan Cameron <jic23@kernel.org>
> Sent: Monday, December 6, 2021 1:27 AM
> To: linux-iio@vger.kernel.org
> Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>; Kunyang Fan <Kunyang_Fan@aaeon.com.tw>; Andy Shevchenko <andy.shevchenko@gmail.com>
> Subject: [PATCH v2] iio: adc: ti-adc081c: Partial revert of removal of ACPI IDs
> 
> 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.
> 
> Whilst here use generic firmware properties rather than the ACPI specific handling previously found in this driver.
> 
> 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>
> ---
> 
> Looking ideally for a tested-by for this from Kunyang Fan.
> 
> v2: Use generic firmware properties as Andy Shevchenko rightly suggested.
> I took it a bit further than strictly necessary as I don't like putting enums in the driver_data only to use them to index a table when we could just use the pointers directly.
> 
> Note this driver does have device tree binding documentation but that's a job for another day.  Or maybe later today if I get really bored this evening :)
> 
>  drivers/iio/adc/ti-adc081c.c | 22 +++++++++++++++++-----
>  1 file changed, 17 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/iio/adc/ti-adc081c.c b/drivers/iio/adc/ti-adc081c.c index 16fc608db36a..bd48b073e720 100644
> --- a/drivers/iio/adc/ti-adc081c.c
> +++ b/drivers/iio/adc/ti-adc081c.c
> @@ -19,6 +19,7 @@
>  #include <linux/i2c.h>
>  #include <linux/module.h>
>  #include <linux/mod_devicetable.h>
> +#include <linux/property.h>
> 
>  #include <linux/iio/iio.h>
>  #include <linux/iio/buffer.h>
> @@ -156,13 +157,16 @@ static int adc081c_probe(struct i2c_client *client,  {
>         struct iio_dev *iio;
>         struct adc081c *adc;
> -       struct adcxx1c_model *model;
> +       const struct adcxx1c_model *model;
>         int err;
> 
>         if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WORD_DATA))
>                 return -EOPNOTSUPP;
> 
> -       model = &adcxx1c_models[id->driver_data];
> +       if (dev_fwnode(&client->dev))
> +               model = device_get_match_data(&client->dev);
> +       else
> +               model = &adcxx1c_models[id->driver_data];
> 
>         iio = devm_iio_device_alloc(&client->dev, sizeof(*adc));
>         if (!iio)
> @@ -210,10 +214,17 @@ 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", (kernel_ulong_t)&adcxx1c_models[ADC081C] },
> +       { }
> +};
> +MODULE_DEVICE_TABLE(acpi, adc081c_acpi_match);
> +
>  static const struct of_device_id adc081c_of_match[] = {
> -       { .compatible = "ti,adc081c" },
> -       { .compatible = "ti,adc101c" },
> -       { .compatible = "ti,adc121c" },
> +       { .compatible = "ti,adc081c", .data = &adcxx1c_models[ADC081C] },
> +       { .compatible = "ti,adc101c", .data = &adcxx1c_models[ADC101C] },
> +       { .compatible = "ti,adc121c", .data = &adcxx1c_models[ADC121C] },
>         { }
>  };
>  MODULE_DEVICE_TABLE(of, adc081c_of_match); @@ -222,6 +233,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.34.1
> 
> <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.
> ===================================================================================================================================


  reply	other threads:[~2021-12-12 16:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-05 17:27 [PATCH v2] iio: adc: ti-adc081c: Partial revert of removal of ACPI IDs Jonathan Cameron
2021-12-08  7:36 ` Kunyang Fan(范坤揚)
2021-12-12 16:22   ` Jonathan Cameron [this message]
     [not found]     ` <20211216115547.60d3afe8@jic23-huawei>
2021-12-17  2:44       ` Kunyang_Fan

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=20211212162153.28810ff0@jic23-huawei \
    --to=jic23@jic23.retrosnub.co.uk \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=Kunyang_Fan@aaeon.com.tw \
    --cc=Kunyang_Fan@asus.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=linux-iio@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.