All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Kurt Borja <kuurtb@gmail.com>
Cc: "Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 04/10] iio: adc: ti-ads1262: support per-channel sampling frequency
Date: Sun, 30 Aug 2026 02:36:19 +0100	[thread overview]
Message-ID: <20260830023619.654d1bbe@jic23-huawei> (raw)
In-Reply-To: <20260828-ads126x-v4-4-1dc27e9c0260@gmail.com>

On Fri, 28 Aug 2026 01:38:19 -0500
Kurt Borja <kuurtb@gmail.com> wrote:

> Add per-channel sampling frequency support. The "available" attribute is
> assigned per-channel too, in order to eventually support per-filter
> availability.
> 
> Signed-off-by: Kurt Borja <kuurtb@gmail.com>
A build issue below.

>  };
>  
> +static const struct ads1262_channel ads1262_default_channel = {
> +	.data_rate = ADS1262_DR_20_SPS,
> +	.filter = ADS1262_FILTER_FIR,
> +};

See below - this probably wants to be a slightly more complex define.



> @@ -763,8 +970,15 @@ static int ads1262_parse_channels(struct iio_dev *indio_dev)
>  	if (!chan_specs)
>  		return -ENOMEM;
>  
> +	st->num_channels = num_fw_channels + ADS1262_MON_CHANNEL_COUNT;
> +	st->channels = devm_kcalloc(dev, st->num_channels, sizeof(*st->channels),
> +				    GFP_KERNEL);
> +	if (!st->channels)
> +		return -ENOMEM;
> +
>  	device_for_each_named_child_node_scoped(dev, node, "channel") {
>  		struct iio_chan_spec *spec = &chan_specs[i];
> +		struct ads1262_channel *chan = &st->channels[i];
>  
>  		ret = fwnode_property_read_u32(node, "reg", &reg);
>  		if (ret)
> @@ -772,6 +986,8 @@ static int ads1262_parse_channels(struct iio_dev *indio_dev)
>  		if (reg >= ADS1262_MONITOR_ADDR_OFFSET)
>  			return dev_err_probe(dev, -EINVAL, "%pfwP: reg out of range\n", node);
>  
> +		*chan = (struct ads1262_channel)ads1262_default_channel;

This is giving me a build warning:

drivers/iio/adc/ti-ads1262.c:1913:26: warning: cast to non-scalar
drivers/iio/adc/ti-ads1262.c:1913:26: warning: cast from non-scalar

So we can't do this... Hmm. It's pretty simply. Use a define for
the default channel with the (struct adds1262_channel)
and that should work for us.

> +
>  		ret = ads1262_parse_channel_node(st, spec, node);
>  		if (ret)
>  			return ret;
> @@ -786,7 +1002,9 @@ static int ads1262_parse_channels(struct iio_dev *indio_dev)
>  			.storagebits = 32,
>  			.endianness = IIO_BE,
>  		};
> -		spec->info_mask_separate = BIT(IIO_CHAN_INFO_RAW);
> +		spec->info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
> +					   BIT(IIO_CHAN_INFO_SAMP_FREQ);
> +		spec->info_mask_separate_available = BIT(IIO_CHAN_INFO_SAMP_FREQ);
>  
>  		i++;
>  	}
> @@ -795,6 +1013,7 @@ static int ads1262_parse_channels(struct iio_dev *indio_dev)
>  	       sizeof(ads1262_monitor_chan_specs));
>  
>  	for (unsigned int mon = 0; mon < ADS1262_MON_CHANNEL_COUNT; mon++) {
> +		st->channels[i] = (struct ads1262_channel)ads1262_default_channel;
Same here - a define would allow this to work rather than giving build
problems as it currently does.

>  		chan_specs[i].scan_index = i;
>  		i++;
>  	}
> @@ -890,6 +1109,10 @@ static int ads1262_spi_probe(struct spi_device *spi)
>  
>  	indio_dev->name = ads1262_device_id_to_name[st->dev_id];
>  
> +	ret = ads1262_populate_tables(indio_dev);
> +	if (ret)
> +		return ret;
> +
>  	/*
>  	 * REVISIT: This chip has software polling capabilities, which could be
>  	 * used to stop depending on the DRDY signal.
> 


  parent reply	other threads:[~2026-08-30  1:36 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-28  6:38 [PATCH v4 00/10] iio: adc: Add TI ADS126X ADC family support Kurt Borja
2026-08-28  6:38 ` [PATCH v4 01/10] dt-bindings: adc: add excitation-current-chopping property Kurt Borja
2026-08-28 16:33   ` Conor Dooley
2026-08-28  6:38 ` [PATCH v4 02/10] dt-bindings: iio: adc: support the TI ADS126x ADC family Kurt Borja
2026-08-28  6:45   ` sashiko-bot
2026-08-28 16:39   ` Conor Dooley
2026-08-30  1:57     ` Jonathan Cameron
2026-08-30  1:53   ` Jonathan Cameron
2026-08-28  6:38 ` [PATCH v4 03/10] iio: adc: add the ti-ads1262 driver Kurt Borja
2026-08-28  6:52   ` sashiko-bot
2026-08-30  2:02     ` Jonathan Cameron
2026-08-28  8:09   ` Andy Shevchenko
2026-08-28  6:38 ` [PATCH v4 04/10] iio: adc: ti-ads1262: support per-channel sampling frequency Kurt Borja
2026-08-28  7:03   ` sashiko-bot
2026-08-30  1:36   ` Jonathan Cameron [this message]
2026-08-30  2:22   ` Jonathan Cameron
2026-08-28  6:38 ` [PATCH v4 05/10] iio: adc: ti-ads1262: support per-channel reference and gain Kurt Borja
2026-08-28  6:38 ` [PATCH v4 06/10] iio: adc: ti-ads1262: support input chopping Kurt Borja
2026-08-28  6:38 ` [PATCH v4 07/10] iio: adc: ti-ads1262: support excitation currents Kurt Borja
2026-08-28  6:57   ` sashiko-bot
2026-08-28  6:38 ` [PATCH v4 08/10] iio: adc: ti-ads1262: support triggered buffer sampling Kurt Borja
2026-08-28  6:57   ` sashiko-bot
2026-08-28  6:38 ` [PATCH v4 09/10] iio: adc: ti-ads1262: support REFOUT and VBIAS regulators Kurt Borja
2026-08-28  6:53   ` sashiko-bot
2026-08-28  6:38 ` [PATCH v4 10/10] iio: adc: ti-ads1262: support common mode supplies Kurt Borja
2026-08-28  7:03   ` sashiko-bot

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=20260830023619.654d1bbe@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=andy@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuurtb@gmail.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=robh@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.