From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=106.10.242.210 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796141362; b=e/sxQJjHUIIKC9jXKzq7iscnN/fIqeNwozDERX/PxNWj3g1CjQjKWTcM0ws9rCKhFEYw +LYr95gYN74mLgO/9NQJ1yjSeIhibjQKL/lnHgHk6wupR9iMko+dJTpFizIuHwOq0tWxm K41QYb70UK9BFf9afB6SVcXIlLgvoNp6i4cURLCZ5d+3KutALrhDb167F/fd6myswD4gF paKJIDEMIYGSL88PEqWDZAec3wpxVm0IZc7e/OOaRbHODDLoe0CryRgXhVRZHYea3Dg2R TWJKoBAu7d9VZK9ZtEw2edeRpv5eqWzLpuTL+0TzIh/fNJS4evkx8kYFw5nFkO+TejA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796141362; h=DMARC-Filter:DKIM-Signature:X-SONIC-DKIM-SIGN:X-YMail-OSG:X-Sonic-MF: X-Sonic-ID:Received:Received:From:To:Cc:Subject:Date:Message-ID: X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=i3JjWonwAGruw21W0PASNsqw8Gwl50omaIvXWqQHyt4=; b=5GVc0NPT1ymERBcc8IZ5nLZMBziCPinDSLo4b1XQKSRqO5JYVdABGL3LLzbrDp+jqyi6 AQGUznTS8WodudvQjBR4lsDrTW+znjWxKbV0vIp/wkfXNINwdZnBhqlRvp5kJ/WTb43X0 SA3lZiiE9Ul53eTnvvOdEnMf38KJDBdkWFT7lxBZwXGJzn8V/N1zv+KMxGb4/xVml2Hym NTzGJYHyHcLFiF6RtHwS7sFe1drjCQ8126mGGU5sXg1Ap15X5uTStnlOnDnVi0K/koD5Y eQaaSIkyjVJzpKYgs9QMQPWJiBKaeUYhYIYMg4/bzdmEawE8HWSJufRcLUyqVRSm7Bw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=yahoo.com; spf=pass smtp.mailfrom=yahoo.com; dkim=pass header.d=yahoo.com header.i=@yahoo.com header.a=rsa-sha256 header.s=s2048 header.b=ffydfLWA; arc=none smtp.remote-ip=106.10.242.210 Received: from sonic304-20.consmr.mail.sg3.yahoo.com (sonic304-20.consmr.mail.sg3.yahoo.com [106.10.242.210]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4CBE3606A68D for ; Tue, 1 Dec 2026 16:09:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 4CBE3606A68D Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=yahoo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=yahoo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=yahoo.com header.i=@yahoo.com header.a=rsa-sha256 header.s=s2048 header.b=ffydfLWA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1796141359; bh=i3JjWonwAGruw21W0PASNsqw8Gwl50omaIvXWqQHyt4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To:Content-Type; b=ffydfLWAL5Xcj1OT4ypwesihd7zVUIUJVR9FBi/FsvrMCqUnt0uIcziTkHWraqD37rfLF85SxTeHhkP3n31U/bRDhvb2BWvMgHbA6GyUab9ND5za4K+A9XGzGWVeXRwDaglh2ALfN2Nsq7O1ssb7+xZil+9fG0iWlMOQw3g0smm8n1xgHPv4lGeVsAYQwMg49PuC3fnXIRMOxdeutpo8soRcx4AfEfPGaO1Q4JSsEsrcgm+Qa10AGsRVP3VO+hz2N2aDy5J7hETWc+ATFUBwFAAuWvBqgHOY7gMJq4gjDTBhjE808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GB8PkUqKKJ.YqPd_Vl1s7kfvd7a48kYui_MutqrwDgZp7o9_0OuXs.VeRxf llGf0ZMHWYYg58YKWZSvzaJFKVQfVVgOCKJ7ciEI7Sl8LPvFspS3So7nAvaFdDkVwXZK626cRIpe bn4PGdg22NerjOWoOdEZuyqUh4We9K1oslMFQdn6Cp9XZi3MkMAKbb_hF8.qWymDptQCwG3urxLh YUL9gYb_gg_ohkvI604gM66Z6HZFZZWSyiQ42HkpdUL5c.5YK490S_prGsF2sljSEl0DddhQ7jef DIlTQHVamWev.feDQeoTX1eU8vI4A8OYdYWNEE.SPMp4syJACBz2RfpcmVebxIlj4kJa967IyxTh Ui6SYGen.fhiucUtomt4FWJsVy6ctoZA1ijdPANhjvUpTeTy0UhUIz3RDo0Gs3FVfZPi7Ytcs0qE mCPPJony0T9hj9Q1HuFdfUw8RENYNG3IBrlPGtSFqkr4NtLz1ygc.pOd0M_uQrrt6d6Y7AnZZpiP U.9.XjVhNr7BrBenC3f7MhTkxEcUV9oBli_K_6geJJOMMFH03zN5VpnIdXjq6bHBomTKFThLGMjH rW.h3xifEqTDtHcAcvfJ7FzxdLRb_dUsV1IonJ.bpJ7_nmr1LDsbUTYkuK3zi7FHQkdnAkvmD2_o 1rrXZflYRQy0eL3WxsVMdS.Abu2Qvge.m0RmnbXhpZhQ- X-Sonic-MF: X-Sonic-ID: 10558898-4f48-44e1-90fe-0e2b2980f1ba Received: from sonic.gate.mail.ne1.yahoo.com by sonic304.consmr.mail.sg3.yahoo.com with HTTP; Tue, 1 Dec 2026 16:09:19 +0000 Received: by hermes--production-sg3-5ff9d6888d-hlwwr (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID ad54adfc369060ad62232fc58c9eb06f; Tue, 01 Dec 2026 16:09:14 +0000 (UTC) From: Venkat Yadlapati To: Konrad Dybcio Cc: Sebastian Reichel , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Joonhoe Kim <26rote@gmail.com> Subject: Re: [PATCH 1/2] power: supply: qcom_battmgr: Apply a USB input current limit set early Date: Tue, 1 Dec 2026 21:38:52 +0530 Message-ID: <20261201160910.169252-1-venkat.yadlapati@yahoo.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: References: <20261116-vantage-battmgr-v1-0-7b59157377b7@yahoo.com> <20261116-vantage-battmgr-v1-1-7b59157377b7@yahoo.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On 12/1/26 4:14 PM, Konrad Dybcio wrote: > On 11/15/26 9:20 PM, Venkat Yadlapati via B4 Relay wrote: >> Assisted-by: LLM > > This tag is no longer valid, please switch to linux-next/master as > your base and run checkpatch Thanks for the review. That line is already gone in v2 [1], which is based on next-20261120 and otherwise has the same code as v1, so the comments below apply to v2 as well. v3 will be on a current linux-next and checked with checkpatch again. >> + mutex_lock(&battmgr->lock); >> + ret = qcom_battmgr_request_property(battmgr, BATTMGR_USB_PROPERTY_SET, >> + USB_INPUT_CURR_LIMIT, icl); >> + mutex_unlock(&battmgr->lock); >> + >> + return ret; > > guard(mutex)(&battmgr->lock) > > return qcom_battmgr_... Will do. >> + if (!battmgr->service_up) { >> + battmgr->usb_icl = pval->intval; >> + battmgr->usb_icl_pending = true; >> + return 0; >> + } > > This is the easiest workaround, but I fear this may spiral out of > control, as the same would apply to essentially any parameter > that's writeable. > > I'm thinking about whether we should perhaps defer the > registration of the power supplies until the service first appears. > I'm not sure of how much collateral damage that would cause. Upon > a "service goes down" event, we could keep the "return -EAGAIN" > behavior Agreed, and for the dwc3 case it looks like the cleaner fix. dwc3 already copes with a supply that shows up late: since 7c87ef27af79 ("usb: dwc3: avoid probe deferral when USB power supply is not available") it waits on the power supply notifier instead of deferring its probe, and when the supply appears it sends the current it has stored in the meantime. So with the supplies registered from the first SERVREG_SERVICE_STATE_UP, the limit reaches the firmware without any caching in battmgr, and dwc3 is not held back while the ADSP boots. The other users I can think of (the userspace battery tools, power supply links from other drivers) already have to deal with supplies that appear later, but I may be missing a user on the laptops. I would do that in v3: register the power supplies from the enable work on the first "up" notification instead of in probe, keep returning -EAGAIN while the service is down after that, and drop the usb_icl_pending caching from this patch. One thing I noticed in the current version: the pending limit is applied right after the notifications are enabled, and with 2/2 the charger type is read at that point. It can still be unknown then, in which case 2/2 rejects the limit. The downstream driver sleeps 200 ms before re-applying the limit for that reason. With late registration dwc3 sets the limit only after the supply is registered, but the type may still not be known yet, so I will look at that in v3 too. v3 will take a while, as the phone is going in for repair and I don't want to send it untested. [1] https://lore.kernel.org/all/20261123-vantage-battmgr-v2-0-03a419078d0a@yahoo.com/ Thanks, Venkat