summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python
diff options
context:
space:
mode:
authorArnav Kapoor <kapoorarnav43@gmail.com>2026-10-26 03:42:38 +0530
committerJonathan Cameron <jonathan.cameron@oss.qualcomm.com>2026-11-02 00:39:41 +0000
commitd252425c1533bfacd5940faa3371af82196bff5b (patch)
tree2ef863d79ed8a39d3b41d3d1cbf0573db0fc39a1 /tools/perf/scripts/python
parent0516c565878687e1b4952edf32b4a069ca13e9ad (diff)
iio: proximity: sx9360: fix sampling frequency write and available range
GNRL_CTRL1/2 hold the scan period in units of 8192 / FOSC, but sx9360_set_samp_freq() computes freq * 8192 / FOSC and mis-scales val2, which is in micro units. Any integer frequency then programs a period of 0, and fractional parts above ~0.26 Hz overflow the int, writing 0x10 to GNRL_CTRL1 outside the SCANPERIOD field. Compute FOSC / (freq * 8192), rounded to the closest value, and reject frequencies outside the 1..2047 period range. The available range doesn't match the limits in the comments next to it either: 4 MHz / 8192 is 488.28125 Hz, not 448.28125 Hz, 4 MHz / (8192 * 2047) is 0.238535 Hz, and (max - min) / 2047 is 0.238419 Hz. Use those values. Fixes: 1cdb4c47f7f5 ("iio:proximity:sx9360: Add sx9360 support") Signed-off-by: Arnav Kapoor <kapoorarnav43@gmail.com> Cc: stable@vger.kernel.org Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions