Skip to content
Commit 0eabb139 authored by Alexandru Gagniuc's avatar Alexandru Gagniuc Committed by Guenter Roeck
Browse files

hwmon: (tps23861) fix byte order in current and voltage registers



Trying to use this driver on a big-endian machine results in garbage
values for voltage and current. The tps23861 registers are little-
endian, and regmap_read_bulk() does not do byte order conversion. Thus
on BE machines, the most significant bytes got modified, and were
trimmed by the VOLTAGE_CURRENT_MASK.

To resolve this use uint16_t values, and convert them to host byte
order using le16_to_cpu(). This results in correct readings on MIPS.

Signed-off-by: default avatarAlexandru Gagniuc <mr.nuke.me@gmail.com>
Link: https://lore.kernel.org/r/20220721032255.2850647-1-mr.nuke.me@gmail.com


[groeck: Use __le16 instead of uint16_t]
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 3b1ea71f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment