Re: [PATCH 4/5] iio: adc: ti-ads1262: Add calibration support
From: Kurt Borja
Date: Sun Jun 14 2026 - 16:32:08 EST
On Sat Jun 13, 2026 at 8:50 AM -05, Jonathan Cameron wrote:
> On Fri, 12 Jun 2026 17:46:22 -0500
> Kurt Borja <kuurtb@xxxxxxxxx> wrote:
>
>> Add channel calibration support.
>>
>> Signed-off-by: Kurt Borja <kuurtb@xxxxxxxxx>
>> ---
[...]
> Read it into a u8 [3] and use get_unaligned_le24()
> That avoids us having to think too much about the bits that aren't
> initialized and static analysis / compilers having to figure out
> they don't matter. I general it is easier to understand.
I didn't know there was a 24 bit version. I'll definitely use it.
>
>> + if (ret)
>> + return ret;
>> + *val = sign_extend32(le32_to_cpu(lval), 23);
>> +
>> + return 0;
>> +}
>> +
>> +static int ads1262_write_calib(struct ads1262 *st, unsigned int reg, u32 val)
>> +{
>> + __le32 lval = cpu_to_le32(val);
>> +
>> + /*
>> + * The calibration word is a signed 24 bit LSB-first value.
>> + */
>> + return regmap_bulk_write(st->regmap, reg, &lval, 3);
>
> Similar with a u8 [3] for the '__le24' storage.
>
>> +}
>> +
--
Thanks,
~ Kurt