HID: sony: Report more accurate DS4 power status.
authorRoderick Colenbrander <roderick.colenbrander@sony.com>
Tue, 10 Nov 2020 07:22:27 +0000 (23:22 -0800)
committerJiri Kosina <jkosina@suse.cz>
Wed, 25 Nov 2020 12:53:18 +0000 (13:53 +0100)
commita76a6c1893b0806657cb747c3c8949d3103fbc3f
treecce6088971426fa868810db0a837d7e1dac10c5f
parentd5530d82efc8631beff20480b1168b1c44294fe1
HID: sony: Report more accurate DS4 power status.

This patch moves the power supply status logic to DS3/DS4 parse_report,
to allow for more accurate DS4 status reporting.

The DS4 power status code was actually incorrect, but reported okay'ish
data in most cases. There was a different interpretation of the battery_info
values 0-10 or 0-9 depending on cable state. It added +1 to extend the range
to 0-10. This is actually incorrect, there is no different range. Values
higher than 11 actually indicates 'full' and 14/15 'error' for which we
reported 100% and a valid power state.

Moving the status logic to parse_report avoids having to pass more state
to the generic sony_battery_get_property and simplifies the code.

Signed-off-by: Roderick Colenbrander <roderick.colenbrander@sony.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-sony.c