Re: [PATCH 6/6] iio: gyro: mpu3050: Fix the scale list and report it via read_avail()
From: Jonathan Cameron
Date: Sat Nov 07 2026 - 20:18:41 EST
On Mon, 2 Nov 2026 16:47:00 +0900
Arka Mondal <arka@xxxxxxxxxxxxxx> wrote:
> The angular velocity channels keep IIO_CHAN_INFO_SCALE in
> info_mask_shared_by_type, so userspace reads the scale from
> in_anglvel_scale. One custom attribute lists the values it can take,
> and that list is wrong in both its numbers and its name.
>
> The four numbers were computed against 2^16 while mpu3050_read_raw()
> divides by U16_MAX, so not one of them is a value the channel ever
> reports. The list gives 0.000122070, 0.000274658, 0.000518798 and
> 0.001068115, where the channel reports 0.000122072, 0.000274662,
> 0.000518806 and 0.001068131.
>
> The name, anglevel_scale_available, has neither the in_ prefix nor
> the anglvel spelling the core uses for IIO_ANGL_VEL, so it sits at the
> device level and userspace that opens in_anglvel_scale_available finds
> no such file.
>
> Report the list through read_avail(), built from the same
> IIO_DEGREE_TO_RAD() terms and U16_MAX that mpu3050_read_raw() uses so
> the two cannot drift apart again, and delete the attribute along with
> the comment describing the hardcoded factors.
>
> Fixes: 3904b28efb2c ("iio: gyro: Add driver for the MPU-3050 gyroscope")
> Signed-off-by: Arka Mondal <arka@xxxxxxxxxxxxxx>
Applied this one.
thanks,
Jonathan