From: Jelle van der Waa <jvanderwaa@redhat.com>
To: "Jonathan Woithe" <jwoithe@just42.net>,
"Hans de Goede" <hdegoede@redhat.com>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: Jelle van der Waa <jvanderwaa@redhat.com>,
platform-driver-x86@vger.kernel.org
Subject: [PATCH 2/2] platform/x86: fujitsu: clamp charge_control_end_threshold values to 50
Date: Mon, 9 Jun 2025 12:21:14 +0200 [thread overview]
Message-ID: <20250609102115.36936-3-jvanderwaa@redhat.com> (raw)
In-Reply-To: <20250609102115.36936-1-jvanderwaa@redhat.com>
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>
---
drivers/platform/x86/fujitsu-laptop.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c
index c8aeb28a783c..f6a4a02e8d44 100644
--- a/drivers/platform/x86/fujitsu-laptop.c
+++ b/drivers/platform/x86/fujitsu-laptop.c
@@ -187,9 +187,12 @@ static ssize_t charge_control_end_threshold_store(struct device *dev,
if (ret)
return ret;
- if (value < 50 || value > 100)
+ if (value > 100)
return -EINVAL;
+ if (value < 50)
+ value = 50;
+
cc_end_value = value * 0x100 + 0x20;
s006_cc_return = call_fext_func(fext, FUNC_S006_METHOD,
CHARGE_CONTROL_RW, cc_end_value, 0x0);
--
2.49.0
next prev parent reply other threads:[~2025-06-09 10:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-09 10:21 [PATCH 0/2] platform/x86: clamp charge thresholds on fujitsu Jelle van der Waa
2025-06-09 10:21 ` [PATCH 1/2] platform/x86: fujitsu: use unsigned int for kstrtounit Jelle van der Waa
2025-06-09 10:36 ` Hans de Goede
2025-06-13 10:14 ` Ilpo Järvinen
2025-06-09 10:21 ` Jelle van der Waa [this message]
2025-06-09 10:38 ` [PATCH 2/2] platform/x86: fujitsu: clamp charge_control_end_threshold values to 50 Hans de Goede
2025-06-09 10:47 ` [PATCH 0/2] platform/x86: clamp charge thresholds on fujitsu Jonathan Woithe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250609102115.36936-3-jvanderwaa@redhat.com \
--to=jvanderwaa@redhat.com \
--cc=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jwoithe@just42.net \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox