Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

platform/x86: fujitsu: clamp charge_control_end_threshold values to 50

Follow the sysfs ABI documentation that drivers should round written
values to the nearest supported value instead of returning an error.

Tested on a Fujitsu Lifebook U7720.

Signed-off-by: Jelle van der Waa <jvanderwaa@redhat.com>
Reviewed-by: Hans de Goede <hansg@kernel.org>
Acked-by: Jonathan Woithe <jwoithe@just42.net>
Link: https://lore.kernel.org/r/20250609102115.36936-3-jvanderwaa@redhat.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

authored by

Jelle van der Waa and committed by
Ilpo Järvinen
dce77641 d9926f09

+4 -1
+4 -1
drivers/platform/x86/fujitsu-laptop.c
··· 187 187 if (ret) 188 188 return ret; 189 189 190 - if (value < 50 || value > 100) 190 + if (value > 100) 191 191 return -EINVAL; 192 + 193 + if (value < 50) 194 + value = 50; 192 195 193 196 cc_end_value = value * 0x100 + 0x20; 194 197 s006_cc_return = call_fext_func(fext, FUNC_S006_METHOD,