diff options
| author | Zhang Jie <zhangjie14@huaqin.corp-partner.google.com> | 2026-08-18 15:28:03 +0800 |
|---|---|---|
| committer | Jonathan Cameron <jonathan.cameron@oss.qualcomm.com> | 2026-08-31 00:52:41 +0100 |
| commit | fbf33cb18334e7cab1ed4ad2e9a98a1299ad874c (patch) | |
| tree | 12744fb17125b0a6a7cae32400420a921f2edbbf /tools/lib/python/kdoc/python_version.py | |
| parent | 0e65412aee4f651d2c9785f542a13e4b44002a75 (diff) | |
| download | linux-next-fbf33cb18334e7cab1ed4ad2e9a98a1299ad874c.tar.gz linux-next-fbf33cb18334e7cab1ed4ad2e9a98a1299ad874c.zip | |
iio: proximity: sx9324: Correct proximity channel resolution
The proximity channels were previously defined with 12 realbits.
However, PROXDIFF is read from RegDiffMsb (0x65) and RegDiffLsb
(0x66). The SX9324 datasheet assigns bits 7:0 of each register to
PROXDIFF and documents it as a signed two's-complement value
(Revision 3, Section 8, Table 8, page 43). In contrast, RegOffsetMsb
explicitly marks bits 7:6 as reserved. Thus, PROXDIFF is a 16-bit
signed value.
With realbits = 12, sx_common_read_proximity() uses bit 11 as the
sign bit in sign_extend32(), causing samples outside the 12-bit
signed range to wrap into the [-2048, 2047] range.
Correct the realbits value to 16 to accurately reflect the hardware.
Tested on an SX9324-based device: a phase 0 DIFF readback of 0x7fff
was reported as -1 before this change and as 32767 afterward.
Fixes: 4c18a890dff8 ("iio:proximity:sx9324: Add SX9324 support")
Cc: stable@vger.kernel.org
Signed-off-by: Zhang Jie <zhangjie14@huaqin.corp-partner.google.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Diffstat (limited to 'tools/lib/python/kdoc/python_version.py')
0 files changed, 0 insertions, 0 deletions
