From: Sebastian Reichel <sebastian.reichel@collabora.com>
To: Vladyslav Tymoshchuk <tvlad744@gmail.com>
Cc: Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>,
Abel Vesa <abelvesa@kernel.org>,
Heikki Krogerus <heikki.krogerus@linux.intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Krzysztof Kozlowski <krzk@kernel.org>,
Dmitry Baryshkov <lumag@kernel.org>,
Casey Connolly <casey.connolly@linaro.org>,
Johan Hovold <johan@kernel.org>,
Jishnu Prakash <jishnu.prakash@oss.qualcomm.com>,
Kamal Wadhwa <kamal.wadhwa@oss.qualcomm.com>,
Joonhoe Kim <26rote@gmail.com>,
Daniel J Blueman <daniel@quora.org>,
Neil Armstrong <neil.armstrong@linaro.org>,
Kees Cook <kees@kernel.org>,
"Gustavo A . R . Silva" <gustavoars@kernel.org>,
linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org,
linux-pm@vger.kernel.org, linux-hardening@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 4/4] power: supply: qcom_battmgr: Allow charger changes to wake up the system
Date: Sun, 29 Nov 2026 00:24:37 +0100 [thread overview]
Message-ID: <awtiN7wnFvkrRPrF@venus> (raw)
In-Reply-To: <20261022173225.58-1-tvlad744@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3064 bytes --]
Hi,
On Thu, Oct 22, 2026 at 08:32:24PM +0300, Vladyslav Tymoshchuk wrote:
> The battery manager notifies about changes of the battery state, many
> of which arrive while the system is asleep, and about changes of the
> USB and wireless charger properties, a charger being plugged in or out
> for one. Only the latter can be worth a wakeup, to show the new
> charging state for example.
>
> Make the device wakeup capable, and set a wakeup filter that lets
> pmic_glink report only the charger notifications as wakeup events.
> Leave wakeup disabled, so that nothing changes by default: whether a
> charger change should wake up the system is up to user space, through
> power/wakeup.
>
> Signed-off-by: Vladyslav Tymoshchuk <tvlad744@gmail.com>
> ---
Looks ok to me. Obviously depends on the other patches in this
series and cannot be applied by me. You might have a better chance
to get a review of the other patches, if you send this series
without RFC tag. Please trim down the super long AI commit messages
to the relevant information when resending.
Greetings,
-- Sebastian
> I used an AI assistant (Claude) for the analysis and to draft this
> patch and its description; I reviewed the result. The testing is
> described in the cover letter.
>
> drivers/power/supply/qcom_battmgr.c | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/drivers/power/supply/qcom_battmgr.c b/drivers/power/supply/qcom_battmgr.c
> index 636d6f6acecc..7a783a3a320d 100644
> --- a/drivers/power/supply/qcom_battmgr.c
> +++ b/drivers/power/supply/qcom_battmgr.c
> @@ -10,6 +10,7 @@
> #include <linux/mutex.h>
> #include <linux/nvmem-consumer.h>
> #include <linux/of_device.h>
> +#include <linux/pm_wakeup.h>
> #include <linux/power_supply.h>
> #include <linux/property.h>
> #include <linux/soc/qcom/pdr.h>
> @@ -1596,6 +1597,20 @@ static void qcom_battmgr_sm8350_callback(struct qcom_battmgr *battmgr,
> complete(&battmgr->ack);
> }
>
> +static bool qcom_battmgr_is_charger_notification(const void *data, size_t len, void *priv)
> +{
> + const struct qcom_battmgr_message *msg = data;
> + unsigned int notification;
> +
> + if (le32_to_cpu(msg->hdr.opcode) != BATTMGR_NOTIFICATION ||
> + len != sizeof(msg->hdr) + sizeof(msg->notification))
> + return false;
> +
> + notification = le32_to_cpu(msg->notification) & 0xff;
> +
> + return notification == NOTIF_USB_PROPERTY || notification == NOTIF_WLS_PROPERTY;
> +}
> +
> static void qcom_battmgr_callback(const void *data, size_t len, void *priv)
> {
> const struct pmic_glink_hdr *hdr = data;
> @@ -1750,6 +1765,10 @@ static int qcom_battmgr_probe(struct auxiliary_device *adev,
> if (IS_ERR(battmgr->client))
> return PTR_ERR(battmgr->client);
>
> + device_set_wakeup_capable(dev, true);
> + pmic_glink_client_set_wakeup_filter(battmgr->client,
> + qcom_battmgr_is_charger_notification);
> +
> pmic_glink_client_register(battmgr->client);
>
> return 0;
> --
> 2.43.0
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2026-11-28 23:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-22 16:41 [RFC PATCH 0/4] soc: qcom: pmic_glink: Hold back notifications over system sleep Vladyslav Tymoshchuk
2026-10-22 16:41 ` [RFC PATCH 1/4] " Vladyslav Tymoshchuk
2026-10-22 16:41 ` [RFC PATCH 2/4] soc: qcom: pmic_glink: Report wakeup events on behalf of clients Vladyslav Tymoshchuk
2026-10-22 16:41 ` [RFC PATCH 3/4] usb: typec: ucsi: glink: Wake up the system on connector changes Vladyslav Tymoshchuk
2026-10-22 17:32 ` [RFC PATCH 4/4] power: supply: qcom_battmgr: Allow charger changes to wake up the system Vladyslav Tymoshchuk
2026-11-28 23:24 ` Sebastian Reichel [this message]
2026-11-02 22:05 ` [RFC PATCH 0/4] soc: qcom: pmic_glink: Hold back notifications over system sleep Joonhoe Kim
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=awtiN7wnFvkrRPrF@venus \
--to=sebastian.reichel@collabora.com \
--cc=26rote@gmail.com \
--cc=abelvesa@kernel.org \
--cc=andersson@kernel.org \
--cc=casey.connolly@linaro.org \
--cc=daniel@quora.org \
--cc=gregkh@linuxfoundation.org \
--cc=gustavoars@kernel.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=jishnu.prakash@oss.qualcomm.com \
--cc=johan@kernel.org \
--cc=kamal.wadhwa@oss.qualcomm.com \
--cc=kees@kernel.org \
--cc=konradybcio@kernel.org \
--cc=krzk@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=lumag@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=tvlad744@gmail.com \
/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