Devicetree
 help / color / mirror / Atom feed
From: David Lechner <dlechner@baylibre.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: Jakub Szczudlo <jakubszczudlo40@gmail.com>,
	linux-iio@vger.kernel.org, andy@kernel.org,
	antoniu.miclaus@analog.com, conor+dt@kernel.org,
	devicetree@vger.kernel.org, duje@dujemihanovic.xyz,
	jishnu.prakash@oss.qualcomm.com, jorge.marques@analog.com,
	joshua.crofts1@gmail.com, krzk+dt@kernel.org, linusw@kernel.org,
	linux-kernel@vger.kernel.org, marcelo.schmitt@analog.com,
	mazziesaccount@gmail.com, mike.looijmans@topic.nl,
	nuno.sa@analog.com, robh@kernel.org,
	sakari.ailus@linux.intel.com, wens@kernel.org
Subject: Re: [PATCH v4 1/3] iio: adc: Fix incorrect reading when datarate changed in single mode
Date: Mon, 29 Jun 2026 13:55:47 -0500	[thread overview]
Message-ID: <2cdb9cd4-8e6c-4bdf-b14e-2191b104d229@baylibre.com> (raw)
In-Reply-To: <20260629193329.34fab6e3@jic23-huawei>

On 6/29/26 1:33 PM, Jonathan Cameron wrote:
> On Sat, 27 Jun 2026 17:31:24 -0500
> David Lechner <dlechner@baylibre.com> wrote:
> 
>> On 6/22/26 5:15 PM, Jakub Szczudlo wrote:
>>> When device is suspended and it is in single mode then changing
>>> datarate doesn't make it actual wait for new measurement, so to
>>> be sure that read after change is correct functions that changes
>>> datarate and gain will wait for new data.
>>>
>>> Fixes: 541880542f2b ("iio: adc: Add TI ADS1100 and ADS1000")
>>> Signed-off-by: Jakub Szczudlo <jakubszczudlo40@gmail.com>
>>> ---
>>>  drivers/iio/adc/ti-ads1100.c | 74 ++++++++++++++++++++++++++++++++++--
>>>  1 file changed, 70 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/iio/adc/ti-ads1100.c b/drivers/iio/adc/ti-ads1100.c
>>> index 9fe8d54cce83..e3c801381434 100644
>>> --- a/drivers/iio/adc/ti-ads1100.c
>>> +++ b/drivers/iio/adc/ti-ads1100.c
>>> @@ -15,6 +15,7 @@
>>>  #include <linux/module.h>
>>>  #include <linux/init.h>
>>>  #include <linux/i2c.h>
>>> +#include <linux/iopoll.h>
>>>  #include <linux/mutex.h>
>>>  #include <linux/property.h>
>>>  #include <linux/pm_runtime.h>
>>> @@ -43,6 +44,9 @@
>>>  static const int ads1100_data_rate[] = { 128, 32, 16, 8 };
>>>  static const int ads1100_data_rate_bits[] = { 12, 14, 15, 16 };
>>>  
>>> +/* Timeout based on the minimum sample rate of 8 SPS (7.5s) */
>>> +#define ADS1100_MAX_DRDY_TIMEOUT_US	7500000
>>> +
>>>  struct ads1100_data {
>>>  	struct i2c_client *client;
>>>  	struct regulator *reg_vdd;
>>> @@ -123,10 +127,49 @@ static int ads1100_get_adc_result(struct ads1100_data *data, int chan, int *val)
>>>  	return 0;
>>>  }
>>>  
>>> +static bool ads1100_new_data_not_ready(struct ads1100_data *data)
>>> +{
>>> +	int ret;
>>> +	u8 buffer[3];
>>> +
>>> +	ret = i2c_master_recv(data->client, (char *)&buffer, sizeof(buffer));  
>>
>> Do we actually need the cast here? char * is like void * and should not need it.
> Hi David,
> 
> Any more background on this?  The void * implicit cast thing is in the
> c standard.  I don't think there is anything equivalent for char *
> 
> Thanks,
> 
> Jonathan

Oops, I must have been mixing that up with special type punning
rules for char.

According to [1], char is not compatible with either of signed char
or unsigned char.

[1]: https://en.cppreference.com/c/language/type#Compatible_types

  reply	other threads:[~2026-06-29 18:55 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-22 22:15 [PATCH v4 0/3] iio: adc: Add support for TI ADS1110 to ti-ads1100 driver Jakub Szczudlo
2026-06-22 22:15 ` [PATCH v4 1/3] iio: adc: Fix incorrect reading when datarate changed in single mode Jakub Szczudlo
2026-06-22 22:33   ` sashiko-bot
2026-06-23  9:16   ` Andy Shevchenko
2026-06-23  9:29     ` Joshua Crofts
2026-06-23  9:39       ` Andy Shevchenko
2026-06-29 18:28         ` Jonathan Cameron
2026-06-29 22:51     ` Jonathan Cameron
2026-06-30 11:36       ` Andy Shevchenko
2026-06-30 12:08         ` Matti Vaittinen
2026-06-30 12:28           ` Andy Shevchenko
2026-06-30 17:01             ` Jakub Szczudło
2026-06-27 22:31   ` David Lechner
2026-06-29 18:33     ` Jonathan Cameron
2026-06-29 18:55       ` David Lechner [this message]
2026-06-22 22:15 ` [PATCH v4 2/3] dt-bindings: iio: adc: ti,ads1100: add support for ADS1110 Jakub Szczudlo
2026-06-22 22:15 ` [PATCH v4 3/3] iio: adc: Add ti-ads1110 support to ti-ads1100 driver Jakub Szczudlo
2026-06-22 22:31   ` sashiko-bot
2026-06-23  9:23   ` Andy Shevchenko
2026-06-23 18:49     ` Jakub Szczudło
2026-06-27 22:42   ` David Lechner

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=2cdb9cd4-8e6c-4bdf-b14e-2191b104d229@baylibre.com \
    --to=dlechner@baylibre.com \
    --cc=andy@kernel.org \
    --cc=antoniu.miclaus@analog.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=duje@dujemihanovic.xyz \
    --cc=jakubszczudlo40@gmail.com \
    --cc=jic23@kernel.org \
    --cc=jishnu.prakash@oss.qualcomm.com \
    --cc=jorge.marques@analog.com \
    --cc=joshua.crofts1@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.schmitt@analog.com \
    --cc=mazziesaccount@gmail.com \
    --cc=mike.looijmans@topic.nl \
    --cc=nuno.sa@analog.com \
    --cc=robh@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=wens@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