From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E1F52FF16B for ; Tue, 18 Nov 2025 02:29:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763432987; cv=none; b=b5GpBpnQ1/Fi7jnYmOnlQzrm2Mj6/Tg7FjM3Z/9BdbnoZb81HGEfDwJtTZ4v8GAOmit7jjx39yioJS1dxpDB316akO2CpGL2cFB8ZtHhMeLe1Ck96etFHq9oTYvk4v6p1Udwce8DCaG8X20AceqijL7i66boHnjabKLw6L8yyOg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763432987; c=relaxed/simple; bh=2KOfma0sITPO/4dH2G9QHJ4relhWBo110kMOcda7Thk=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type; b=AqOdidCeOPcHU/ZKnBeiVouA0oeyPuc9kOQz8aKfDvVKvVA3DZdhOs7A65HSxxUKLH0vt4Fe9h1E7Wo5fvaUCLj/xQhKelRV+9c2EDgBZStrp4guA8LZ0BCJyxziNmDzRtpskDiZymJtypqITk1tL/Ig/tH7EAj3ppXfD9XO7BY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=KYdijhW9; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=PmXLlxxY; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject 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.b="KYdijhW9"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="PmXLlxxY" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5AHJcfGw3671302 for ; Tue, 18 Nov 2025 02:29:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= xDqii3elKukNgR40+RTb2lx/n+vGBSNGvcekTp398fU=; b=KYdijhW9h0aGpVmd xAbg1APihmWlAuWKP2GrwJbGpFVIZeMYnFL0pk/BL5m69GOQcaovfVV79J94VBr7 ZCB/DamiCnmXXxXL1pevn04VVF1crVNJkLnFWgwlRrqfhCxbA7rd6mvpqDQlgFtJ Uu4zaQAAUW6rOfuf1/f4blgXtftOR3GKnmSpTZNkk+T3K7dBP6yWyq+PqHHFXH/T bVlDpwlBDfQjOLM7qGTx3LrSqx0sUzozY70EeKEM0pRHaWMvx1lCfGcuSbsZRSI4 knJTs1xQ798vMY5ynz2EGwbvOa4Jh9N07tElB93NHZ7tfCsa0s489NXSaJMgzdWt OPmTtw== Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ag2g5adtk-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 18 Nov 2025 02:29:45 +0000 (GMT) Received: by mail-pf1-f198.google.com with SMTP id d2e1a72fcca58-7bf5cdef41dso3207812b3a.0 for ; Mon, 17 Nov 2025 18:29:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1763432984; x=1764037784; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=xDqii3elKukNgR40+RTb2lx/n+vGBSNGvcekTp398fU=; b=PmXLlxxYdSvk5L2BnVmimCjyZi9W8ycmedXXTIdieDrKxwij2XR3mseEJHN0wZWU3i CiWXJrZeH+pSDcLKz9UFZwH0P7M4okPpbeTTPL1aJNrmQc2j/JjgPrWVPB6Wsc9Ymfed /Tk/OELIMO1k0V57VVqvG53UFCNysbP6kCkbbETyOC4TYkjrWpgjxWxjj16xn7w/UMKy xIfNu8ElMpZwQ3AIAybLd0Usic33jCjCLnsfd8dZxt85nC19F6ftzYgUuuCF07enLdtC l73X99tEatehrO8Mtw39MOx3F5UrBZx6JYJPrEN1Jmk++aJB8onRUAglF5SUkFinIvku uWMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763432984; x=1764037784; h=content-transfer-encoding:in-reply-to:from:content-language :references: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; bh=xDqii3elKukNgR40+RTb2lx/n+vGBSNGvcekTp398fU=; b=UosNXhjZzQpwacPc43kr8QPY87opWNBkRNFwe9WwlGdLn1lQkJE07QOHeMhLs1bbj9 fVvJ4U4nubZAz+r8UWGJaY1E3pGLjW8AldZitSnE1AilED9GYkyiM9VEb3dlzPfgHtEM jTZEIQSNyJV2SHt8wHXxeSoo8bNF8Rt9MkZO4JTZhcwHWs0D2XoA/riDF0i5kgCy+uVQ PjAO7bsZQJWn4Wq5HGj4zfSv/mWLJ2BrfutQF2ZyqwAcEeAeu1Mg/Mj98WwBa6K2Girh DSvU9uEtP5ASdKZJkWGXsUvzad/Ha07KFyGG77BsxcMDDbwOgIWzYZmyutJlZdXe9Wm8 Xi3g== X-Forwarded-Encrypted: i=1; AJvYcCVOxGN6imSNjZniexnF5GHeoH7B0ZE0/XznIz8l7cxdey0ETzjmKhlad3g4/W0DAPmqR6SU4qfU21KnFCk=@vger.kernel.org X-Gm-Message-State: AOJu0YyY34g0K7t4oXZtE7SptS8FbgvwBwuUKhYaftERdsBIxxhPqZpJ UvorhT8bcgBefjjh5/aQ3LZWraUK4FDlikm0GOrzJ9Jh2l10v9L+u38DY1UvP1Sb3QAqKOVCxWF hN5OVaFrdWxu/wtsnWGyQKN1iLrkEhvE3RVbU0TiwLsLVLGhNcyw5TUylgLwR8IEIk0A= X-Gm-Gg: ASbGnct8TCLTL9IJFOxUlAOcPhDChJIgB8/sz79irviRWekkqH2h6xia3EYQN1lwAmR jvDQCQMZHELkWvXNV74u2oDlyndJFKJT6pr5UI/eruZRZAz0Cs6rbhWPNlst8rKbTx5lXwnyP+7 oeaGnVcWC8KhKQY/L3Zyqy0Inu6yizxvVNHIqGBkszAAYB3lXNwhpL32h2qgcTZbTNIqghT3ySW u2H8dYBWphwSFw6TGvQR9VuZaoutWK0+lhmKz1k5BSn7VH6aSIdCMbXq/b7riPS6iJjBIlRm7IZ otGy/F0lZbxNAxEZfYmcNmQGJ9yjPDWXT8E2a9/H5qjpJAEhaAdZFYYKUiem3UiM9A4+PhJWW12 pqooXXeabnIJQeWRlJHkYTx2BdhMsey3FS1iskOFve9viQfPQKx+Sw9Rdam1fBsROcoRAgQgrmN aJ8sU= X-Received: by 2002:a05:6a00:1744:b0:7b8:6e0d:6566 with SMTP id d2e1a72fcca58-7ba3be8c60fmr13776017b3a.15.1763432984570; Mon, 17 Nov 2025 18:29:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IHARX4H4UC1Tv8HJiSAkEHFZwwaJOg+neMIkMp2N3vFNfTFZNFkcsb5OXabfS1mRLsiOx+BBA== X-Received: by 2002:a05:6a00:1744:b0:7b8:6e0d:6566 with SMTP id d2e1a72fcca58-7ba3be8c60fmr13775991b3a.15.1763432984068; Mon, 17 Nov 2025 18:29:44 -0800 (PST) Received: from [10.133.33.128] (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7b927c22b1bsm14420563b3a.66.2025.11.17.18.29.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 17 Nov 2025 18:29:43 -0800 (PST) Message-ID: Date: Tue, 18 Nov 2025 10:29:35 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 0/2] power: supply: qcom_battmgr: improve charge control threshold handling To: Konrad Dybcio , Val Packett , Sebastian Reichel , Neil Armstrong , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org References: <20251012233333.19144-2-val@packett.cool> <02db51aa-6e19-411f-875f-718b8215c373@oss.qualcomm.com> Content-Language: en-US From: Fenglin Wu In-Reply-To: <02db51aa-6e19-411f-875f-718b8215c373@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Authority-Analysis: v=2.4 cv=F7Vat6hN c=1 sm=1 tr=0 ts=691bda19 cx=c_pps a=m5Vt/hrsBiPMCU0y4gIsQw==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=6UeiqGixMTsA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=efJFygxvcKwCkfyfGs0A:9 a=QEXdDO2ut3YA:10 a=IoOABgeZipijB_acs4fv:22 X-Proofpoint-GUID: z-OhpuXnYtezihzV2x2nOeLf9YK6KL4y X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMTE4MDAxOCBTYWx0ZWRfX/y01iT6iRsVW rrzB1wmsFN9pvIXlnaOv4slW0BsK7lDqEXqIUecPmN5B8YaxpzqZ52j11cCrnnXlAioZ/D2558q SiadP2o0YI7r4ejp1SttZXnuKkjZiZs6ub+NqcU3m86gtr0XSBQh1NUzWcEbmZlMLrKyf0R2wWx kSyxYzQNJcgDUbTltekKZdpDpTW9A+Cz5vPUBdDuM+udJAfGD/C91g5NTscFfTgv/Ewx1U5twsA hLJKtD80E0DRgr2cnykNrYHMBI5rl4Tm4uhTb8bRIJV2TGBk3jEnZLDpHeMJUw6+UBO0SEifP9t neLu27yeipnI7zMGL0nwQGBS8bmfXLkHj5QpZObS7Lk8wOzCRxP3jGDa9LLedxadqg1x+hS4kRQ AsY2gvy+9pkB5EB/Sq4c0JipC4b02w== X-Proofpoint-ORIG-GUID: z-OhpuXnYtezihzV2x2nOeLf9YK6KL4y X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-11-17_04,2025-11-13_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 clxscore=1015 spamscore=0 bulkscore=0 adultscore=0 lowpriorityscore=0 phishscore=0 suspectscore=0 malwarescore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2510240001 definitions=main-2511180018 On 11/17/2025 8:45 PM, Konrad Dybcio wrote: > On 11/17/25 6:12 AM, Fenglin Wu wrote: >> On 10/13/2025 7:32 AM, Val Packett wrote: >>> Currently, upowerd is unable to turn off the battery preservation mode[1] >>> on Qualcomm laptops, because it does that by setting the start threshold to >>> zero and the driver returns an error: >>> >>> pmic_glink.power-supply.0: charge control start threshold exceed range: [50 - 95] >>> >>> Kernel documentation says the end threshold must be clamped[2] but does >>> not say anything about the start threshold. >>> >>> In this proposal I've special-cased start==0 to actually disable the >>> functionality via the enable bit, and otherwise made both start and >>> end thresholds be clamped to the acceptable range. Hopefully that's >>> fine? >> It is fine to clamping the threshold to the acceptable range. Thank you for making the changes. >>> Or should the [1 - 49] range for start actually be rejected? >> The minimum charging start threshold was set to 50 to improve user experience. If the threshold is too low and the system keeps drawing power from the battery frequently due to a large system load and a weak charger, the laptop will only begin charging when the battery level falls below that threshold. If the user disconnects the charger at that time, then the device would be only having a battery below 50%. Setting the threshold at 50 ensures the battery always stays above 50%. > So can we set it lower? > > Such decisions are best deferred to userspace and/or the user, which can > limit what the kernel exposes as necessary/deemed useful > > Konrad Yes, it can be set to a lower value. However, I am still having concerns that the inappropriate start and end threshold settings would cause a very bad user experience if they are misused, since these thresholds are stored in nvmem and they won't be reset until battery is unplugged or completely drained. For example, if someone intentionally sets the start threshold to 1 and end threshold to 6, and if the laptop was shutdown with a battery SoC less than the end threshold, I am not sure if <6% percent battery level would be good enough to boot up the laptop successfully, if it is not, then the laptop may not have chance to charge up until you hot plug the battery. Also, from battery management firmware point of view, the charge control feature was mainly designed for battery health management, to slow the aging of Li-ion battery by preventing it from being frequently charged to full state. Having a too low minimum start threshold setting won't help anything on that. Thanks Fenglin