From: David Lechner <dlechner@baylibre.com>
To: Jakub Szczudlo <jakubszczudlo40@gmail.com>, linux-iio@vger.kernel.org
Cc: andy@kernel.org, antoniu.miclaus@analog.com, conor+dt@kernel.org,
devicetree@vger.kernel.org, duje@dujemihanovic.xyz,
jic23@kernel.org, jishnu.prakash@oss.qualcomm.com,
jorge.marques@analog.com, joshua.crofts1@gmail.com,
krzk+dt@kernel.org, linusw@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 v6 3/3] iio: adc: Add ti-ads1110 support to ti-ads1100 driver
Date: Sat, 11 Jul 2026 15:01:33 -0500 [thread overview]
Message-ID: <35c47ff5-0a8b-4c99-8e5b-d86c04039e17@baylibre.com> (raw)
In-Reply-To: <20260711184414.1013686-4-jakubszczudlo40@gmail.com>
On 7/11/26 1:44 PM, Jakub Szczudlo wrote:
> Add ADS1110 support that have faster datarate than ADS1100, it also uses
> internal voltage reference of 2.048V for measurement.
>
...
> +static int ads1100_get_vref_milivolts(struct ads1100_data *data)
> +{
> + int voltage_uV;
> +
> + if (data->ads_config->has_internal_vref_only)
> + return ADS1110_INTERNAL_REF_mV;
> +
> + voltage_uV = regulator_get_voltage(data->reg_vdd);
> + if (voltage_uV < 0)
> + return voltage_uV;
> +
> + return voltage_uV / (MICRO / MILLI);
> +}
> +
...
T;
> @@ -276,6 +310,7 @@ static int ads1100_read_raw(struct iio_dev *indio_dev,
> int *val2, long mask)
> {
> int ret;
> + int data_rate_index;
> struct ads1100_data *data = iio_priv(indio_dev);
>
> guard(mutex)(&data->lock);
> @@ -292,12 +327,12 @@ static int ads1100_read_raw(struct iio_dev *indio_dev,
> return IIO_VAL_INT;
> case IIO_CHAN_INFO_SCALE:
> /* full-scale is the supply voltage in millivolts */
> - *val = ads1100_get_vdd_millivolts(data);
> + *val = ads1100_get_vref_milivolts(data);
Obviously, the existing code was getting away without checking for
error here. Since the ads1100_get_vref_milivolts() function handles
the error case now, seems like we should be checking the return value
here as well.
> *val2 = 15 + FIELD_GET(ADS1100_PGA_MASK, data->config);
> return IIO_VAL_FRACTIONAL_LOG2;
> case IIO_CHAN_INFO_SAMP_FREQ:
> - *val = ads1100_data_rate[FIELD_GET(ADS1100_DR_MASK,
> - data->config)];
> + data_rate_index = FIELD_GET(ADS1100_DR_MASK, data->config);
> + *val = data->ads_config->available_data_rate_hz[data_rate_index];
> return IIO_VAL_INT;
> default:
> return -EINVAL;
next prev parent reply other threads:[~2026-07-11 20:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-11 18:44 [PATCH v6 0/3 ] iio: adc: Add support for TI ADS1110 to ti-ads1100 driver Jakub Szczudlo
2026-07-11 18:44 ` [PATCH v6 1/3] iio: adc: Fix incorrect reading when datarate changed in single mode Jakub Szczudlo
2026-07-11 18:54 ` sashiko-bot
2026-07-11 19:51 ` David Lechner
2026-07-11 18:44 ` [PATCH v6 2/3] dt-bindings: iio: adc: ti,ads1100: add support for ADS1110 Jakub Szczudlo
2026-07-11 18:44 ` [PATCH v6 3/3] iio: adc: Add ti-ads1110 support to ti-ads1100 driver Jakub Szczudlo
2026-07-11 18:57 ` sashiko-bot
2026-07-11 20:01 ` David Lechner [this message]
2026-07-12 10:16 ` Jakub Szczudło
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=35c47ff5-0a8b-4c99-8e5b-d86c04039e17@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=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