From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=205.220.168.131 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796121851; b=Y2EGZT2/Tp9pwLBQuIy5Y7MWv2mkxyxpmJndOfKV/9FUdehKV6ISeBvAPNPPqZSuGXPq w+1aXSaFvOcjV09Iqn16kJxBzZIPmvgB6AzWTyOZkMbABGgCNAlmEHg1ZxYvTcuyXWyp/ uS/Fgu0zgeVgp/l86Dz8zOSIkAGiWM0s8SLFBQV9udhvaq5W05bNVUE9nJoQKvCwj36zH MkfUJ23pzZQE0JqxFoorCrH/LLcvWpp6UjjBtEjQ+yF09j6Q+J1UWf2AxgkgzQY30C2QW 574bmzDjY0xcwuyEmC67u1V4X5Mcg4YsQfjwJ8ZeRD7nn/CsqsUiZhi0PkjvGAjIHjA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796121851; h=DMARC-Filter:Received:DKIM-Signature:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Forwarded-Encrypted: X-Gm-Message-State:X-Gm-Gg:X-Received:X-Received:Received:Message-ID: Date:MIME-Version:User-Agent:Subject:To:Cc:References: Content-Language:From:In-Reply-To:Content-Type: Content-Transfer-Encoding:X-Proofpoint-Spam-Details-Enc: X-Proofpoint-Spam-Info:X-Authority-Analysis:X-Proofpoint-ORIG-GUID: X-Proofpoint-GUID:X-Proofpoint-Virus-Version: X-Proofpoint-Spam-Details; bh=yHGFOKdI0Xr8BHm1l/uUiqoHK0gPK9dbedAObtEoBz8=; b=DDd6UeoOpJZLYUQ1f1i1EVrggUd8+sP57h+vHZMkOdcXtm/Dtcavv0CNXG/1lYG/qsZ1 K4e7leg+vKDGP+prJGuoM+68f5fiywTTRuEqgmkF/af438RtiAg4aw6mIfs1S1VXfiVFy 4T0m6glzdxYMKFdRAXvBXCWA7c7r+DhKWpz/yQOtLBalMZ1DMK77wy7tQbQhYpv0ihwHE Ttg6iJ0rzYrh41iAnWvv6VIof+ve/MpArPkT17YulsTTM1xcG3QMWIjWgOhS+wOd+EmJd rv3At5BgntRTK3tq6ECLOfMLk8eb0+Tc97tyt+PSWtZLZkIGbIsALJVSJRd6WAJwPTg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=AlZWBVXC; dkim=pass header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=SggWcBPT; arc=none smtp.remote-ip=205.220.168.131 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 54E35606A327 for ; Tue, 1 Dec 2026 10:44:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 54E35606A327 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=AlZWBVXC; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=SggWcBPT Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6B1AQG0x827437 for ; Tue, 1 Dec 2026 10:44:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= yHGFOKdI0Xr8BHm1l/uUiqoHK0gPK9dbedAObtEoBz8=; b=AlZWBVXCKkiDq/VE UdB4bd6vmOvG8y/E6kW4wQ5Gb8bXSVP9IGBG3YLNnX/YwHf6Ipo9SIhEc7BpLKfj vSJlmFA0zBIoUagT5OrZF+E292zrfFreCW2XYkeS/SFnlgmucBRIVXZckQ9UrzZY 7e9eQEP57QN/IqblLuE1y7IbtVMOIRxcPh343gefQrOJqVxoAy/hINyoMCOLpu6e 4U5ue+WmWg6nBnEcxt75VRrssNVUAgA0CzDTLwobZv9Z+8ffLo3JoZeDq/xGebiA ZWcxWXB0iLX06/0+jxFVQcO2PWgg6U9iBwUNCK+cd7GEwfUsHDWTU25kZskAXVIA vKCi2w== Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j9pts1kws-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 01 Dec 2026 10:44:10 +0000 (GMT) Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-55cbd8c22b1so18450921cf.1 for ; Tue, 01 Dec 2026 02:44:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1796121849; x=1796726649; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=yHGFOKdI0Xr8BHm1l/uUiqoHK0gPK9dbedAObtEoBz8=; b=SggWcBPTtiOLAuLUNrDUXM4V3bAxmND4sJzQ7XC0+Ds8DjwIBh9Xn3L9mYZpnm6NUc TgnNDqjSg4xe5McCHdrvzlb8hQjkmhoE19suuH+SWlXWtZzeTQ8LE+qmANjrs28i1NTE ov80pivoLQAmbXmLzj4rFlvRv5V5BIDx599YjUehJBOHvxLuM6Ts9BNUP/3r8Wxel19N 49QjIUnjkPbrHrowQkcYsZMYF1ZzysbudA0zksUY8LUtH9j5LiNFWk9yXbDYXviC4/qM 0uofP9NXMIjhB+d2NG9YSQKavWyHc6o/xCF6XqI4mPi8mkNQVfd92PhS3pfSjybnH4ib p7lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796121849; x=1796726649; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=yHGFOKdI0Xr8BHm1l/uUiqoHK0gPK9dbedAObtEoBz8=; b=gVN3veyDFRjat5HdAMPovkJ8nA0TSIyG1qxDm2ymXyod3D2Xcx+mooVdpv4JzyWi9n MQZro6wp4lekuavrlPmSfoXvMZhNJ7h0GPoRjQn0LwwE3MyqoQBAj++021JhbvXAtXmh 33BfuiGzbouvmDHtk0+Z2+88V6+djiMyaqyj//uoXbNPJsEDoHJY9nQf5yM1VZWZ5tAT 6JhUKU5DW3dk6Pkr+7M0OzxpqyNBsj8zbMqguH7LcEVs7rg/WAJXLVOecE7n1/uF+d1v x+PwnVFIJxSm2twsjventGoWl0oLVWSdAWNItFaXyxpXUGZdz0sst8CobzvaedGogrQq 34MA== X-Forwarded-Encrypted: i=1; AL+hErES+7Ceth6Bnii8CiQBsmMTnhsj/PKs9sBR5Hp3spbq36YwAfj9NPME5640L48twaIK/YcyF1sWpwL8I+M=@vger.kernel.org X-Gm-Message-State: APuU4Z+ekc8rP1g/BMUdR7+lMIHalSQj6hBDcWZAbHk+Tzig3CeZ2s1J 55lKXxIbqrq4rJi8ybzGbbXsF33A69LcFE007YzdtRLtgXXfyFtv02PMfEFDfHoR0w0dgET9IKA gH/pXt9tD0mM03UiB9Im8/C3/TovU3jdBYnPq9nvNxyocZmaASAt3HVLz6utYfLEl9Kw= X-Gm-Gg: AZFdTZdJLLnsHW3xGkoUikwa5smM/P7LQaOkrKQwtBhSUptVqO5yGNuq4YpsA1GjUaE w7rlLzxgytMCNRtH8rC/h/5lCSf38hxH7a7Wqragjsn+UE/2q5A/Vhz+XzP8JDfXKDbVkEo0j6C TKgel10XLcr0+HkG9XR21laU7utop2B//6QkJeuEWuG9bqcWo6z2w14ESoI0TBsIKdQ7suQo+lw Egh9/REQM0HVNcoMPF4GNwUdFc3Xz2hejpr3n25mBQXas8y56yq0BS7Y4rIncl2Wnc95b54djAm 2OyTqz7lpUUZQdfAWph8sIE2NId4JzS3Tg17giYXUFrnEWPQpYu+ha9cQGM9Wo7OK3Y3L9FGKdp WMPFA9w0m76QZrOYk1yRko9o6Br+CrnayGRrofW37m5TZ2ocS+RRJCCrD5ezLNza024cL1w== X-Received: by 2002:a05:622b:57:10b0:536:61d4:cc80 with SMTP id d75a77b69052e-55d76a6b28dmr628436321cf.5.1796121849447; Tue, 01 Dec 2026 02:44:09 -0800 (PST) X-Received: by 2002:a05:622b:57:10b0:536:61d4:cc80 with SMTP id d75a77b69052e-55d76a6b28dmr628435811cf.5.1796121848813; Tue, 01 Dec 2026 02:44:08 -0800 (PST) Received: from [192.168.226.72] ([178.235.128.140]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6ba36e35ca6sm15488172a12.4.2026.12.01.02.44.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 01 Dec 2026 02:44:07 -0800 (PST) Message-ID: Date: Tue, 1 Dec 2026 11:44:05 +0100 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 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/2] power: supply: qcom_battmgr: Apply a USB input current limit set early To: venkat.yadlapati@yahoo.com, Sebastian Reichel Cc: linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Joonhoe Kim <26rote@gmail.com> References: <20261116-vantage-battmgr-v1-0-7b59157377b7@yahoo.com> <20261116-vantage-battmgr-v1-1-7b59157377b7@yahoo.com> Content-Language: en-US From: Konrad Dybcio In-Reply-To: <20261116-vantage-battmgr-v1-1-7b59157377b7@yahoo.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjAxMDA0MiBTYWx0ZWRfX8+2IbUdn2S/8 dR13TV+5CAiwTDa7NYT6BG1TpmJ0A/Vq+bupLTWXmp1slyUT4gOT7OF/KzfAS7Wu8X04HfDrarh qUMCRr6K3QUvIghHvKiWlwYn+UlQHsuD1QgugcSp4M6RgWhHU83OWSEs+EMF9hDVAaviuq2fRM9 40/BC+RCII8fuzfRoOXZOUNQQit1gW17VO8kanlLOOluugYrivHZSEwfMqJqm78PDvP17jAU0hM 6zxCIv0hztPZBD9bT4Dl860f3obBx65Yj/f0OeoLWKPGoWvH/GAaNKzMj3wyeHsdMjHEiQETHOx W52evEVqyWeh1ChVvbu/ZBXgMb2np7bOHx5xoIaW6u5ICo0j5MQRjta6+ZeHF4jlZ5YmDuVTf8B WKc1aJgYyS/HPPilUaoAY7hYAHPzi/f2D+ykjhK/G34u93lDuu0pbWtZyoyrGvKESBlmHkJd7pt VTRqEIYByOMlrRnVNjA== X-Proofpoint-Spam-Info: AW1haW4tMjYxMjAxMDA0MiBTYWx0ZWRfXyzVdb2vEqj63 YyciIIskzYcDqUBzZm9xMory7UStXD7BPvkZdLCj8QWGTZQsy6BMf+BkI/xbiFOT5Xkj8UhbV3J RMG19deU0jZHE21xFud7QyhnLpQBBUM= X-Authority-Analysis: v=2.4 cv=Cqoq4X4D c=1 sm=1 tr=0 ts=6b0ea4fa cx=c_pps a=WeENfcodrlLV9YRTxbY/uA==:117 a=PRfkaYvzSr8QmIIGAkY2Sg==:17 a=IkcTkHD0fZMA:10 a=pUM-KoujPXoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_K5XuSEh1TEqbUxoQ0s3:22 a=CjxXgO3LAAAA:8 a=2ueYr67G47rI8CukiLgA:9 a=QEXdDO2ut3YA:10 a=kacYvNCVWA4VmyqE58fU:22 X-Proofpoint-ORIG-GUID: FJExea9UENxUtiQSmxz5RSnJc-8BBl_k X-Proofpoint-GUID: FJExea9UENxUtiQSmxz5RSnJc-8BBl_k X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-12-01_02,2026-11-30_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 adultscore=0 priorityscore=1501 suspectscore=0 malwarescore=0 spamscore=0 lowpriorityscore=0 impostorscore=0 bulkscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2612010042 On 11/15/26 9:20 PM, Venkat Yadlapati via B4 Relay wrote: > From: Venkat Yadlapati > > The USB controller can report the current a USB host grants, e.g. with > the usb-psy-name property of dwc3, before the battery manager service > is up. The input current limit is then rejected with -EAGAIN and the > firmware keeps the 100 mA allowed before enumeration, so a phone that is > in use discharges while it is connected to a computer. > > Remember the limit while the service is down and send it once the > service comes up. > > Assisted-by: LLM This tag is no longer valid, please switch to linux-next/master as your base and run checkpatch > Signed-off-by: Venkat Yadlapati > --- [...] > +static int qcom_battmgr_usb_set_icl(struct qcom_battmgr *battmgr, u32 icl) > +{ > + int ret; > + > + 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_... > +} > + > static int qcom_battmgr_usb_set_property(struct power_supply *psy, > enum power_supply_property psp, > const union power_supply_propval *pval) > { > struct qcom_battmgr *battmgr = power_supply_get_drvdata(psy); > - int ret; > - > - if (!battmgr->service_up) > - return -EAGAIN; > > if (psp != POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT || pval->intval < 0) > return -EINVAL; > > - mutex_lock(&battmgr->lock); > - ret = qcom_battmgr_request_property(battmgr, BATTMGR_USB_PROPERTY_SET, > - USB_INPUT_CURR_LIMIT, pval->intval); > - mutex_unlock(&battmgr->lock); > + /* > + * The USB controller can report the current a host grants before the > + * firmware service is up, apply it once the service comes up. > + */ > + 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 Konrad