The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* iio: accel: dmard09: in_accel_scale always returns -EINVAL
@ 2026-06-17 15:53 Mert Seftali
  2026-06-18 15:47 ` Maxwell Doose
  0 siblings, 1 reply; 5+ messages in thread
From: Mert Seftali @ 2026-06-17 15:53 UTC (permalink / raw)
  To: jic23, jelle; +Cc: linux-iio, linux-kernel

Hi,

I've been digging into IIO to learn my way around it, and the dmard09
accelerometer driver caught my eye as I think its scale attribute has
been broken since day one, so I wanted to flag it.

The channels advertise scale:

    .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),

which makes the core create in_accel_scale. The trouble is
dmard09_read_raw() never handles IIO_CHAN_INFO_SCALE, it only does
RAW, and SCALE drops straight into 'default: return -EINVAL'. So
reading the scale just errors out:

    $ cat .../iio:deviceX/in_accel_scale
    cat: in_accel_scale: Invalid argument

and userspace is left with raw counts it can't turn into m/s^2.

To be clear about how I found this: I don't have the hardware, I traced
it through the core (iio_read_channel_info() -> read_raw() with the
SCALE mask) rather than seeing it fail on a device. But the path looks
unambiguous.

I went looking to fix it properly; add a SCALE case returning the
sensitivity, the way dmard06 and dmard10 do, but I couldn't find a
DMARD09 datasheet anywhere. Digging through the list archives, it looks
like the scale was declared in the original 2016 submission but never
implemented, and the driver was written from a vendor source without a
datasheet to begin with. So I don't have a real number to use, and I'd
rather not make one up.

Hence the email instead of a patch: would you prefer to just drop the
scale declaration so the driver stops advertising something it can't
deliver, or does anyone happen to have the DMARD09 sensitivity so it
can be done right? I'm happy to send a patch either way.

Thanks,
Mert

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-06-19 12:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-17 15:53 iio: accel: dmard09: in_accel_scale always returns -EINVAL Mert Seftali
2026-06-18 15:47 ` Maxwell Doose
2026-06-18 16:08   ` Mert Seftali
2026-06-19  7:20     ` Joshua Crofts
2026-06-19 12:10       ` Mert Seftali

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox