Re: [PATCH v4 04/10] iio: adc: ti-ads1262: support per-channel sampling frequency

From: Kurt Borja

Date: Sun Sep 06 2026 - 16:16:32 EST


On Sat Aug 29, 2026 at 10:36 PM -03, Jonathan Cameron wrote:
> On Fri, 28 Aug 2026 01:38:19 -0500
> Kurt Borja <kuurtb@xxxxxxxxx> 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@xxxxxxxxx>
> 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.

Thanks, I'll go for that.

...

--
Thanks,
~ Kurt