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 A73791F4CB3 for ; Mon, 24 Nov 2025 11:01:22 +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=1763982084; cv=none; b=uPuNNOkGYOKbU9GNcHvmXMXNMhRnu+ruhDcKeNbWCxs2LYUnM+u11YqSxNyNW6onjWjq4TpyXT00ErRS7dY7pl7+FTPvSu7XyY9uDOrZzmwjWFx22Z/Zrn2HG6FrGSYVookXwjHSJMkrN5Sg8+82Vd38KY1IdCQHyKDj/Y3O+34= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763982084; c=relaxed/simple; bh=kmWnFKuFNtcDWt9VYmAJ6yQ/jTKnqbkS2w3UokWd2XA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=uC/KKsb/eSOvkFckz5ikPYjD2BcfFHcecOZKufO8MDAlrsA7gIEEOzRqAjU//kxBsEyoi0VEQtnASft3YmVxnN+n+FIPNUFzSiwquoWdeRCXzeStZr6lbJDzNfg9r/pNrSHgyNWCB+/Wlu3pfHmFu/jeZQGGN33LwvsFygTF5GA= 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=h8hXWE6p; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=SGr1O8f+; 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="h8hXWE6p"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="SGr1O8f+" 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 5AO9Bd9H2519842 for ; Mon, 24 Nov 2025 11:01:22 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= kmWnFKuFNtcDWt9VYmAJ6yQ/jTKnqbkS2w3UokWd2XA=; b=h8hXWE6p1UNJGR2w bJenDEb4N0liD4ovo5hL8e4kHmedUtZrPntvj9Lnp15Y748baQBPo/H/LLT6CCE3 92+yxV6MA27NodhuYQM3WE/hWJwG+oWl6g+1dEBTJGSoj0sZKQCzILJgzqYyPp/y f0zBFNmvJFexj9BHEbi6SA4nuSMfolpuhxaJ05M4llT6ko5aQQAkWmkZHXyPtsq1 h16o0RvHEwIeiAPLIIqvFtm4iLPMGLx41pDQZZBlNYiSztzQ1zmtGAwGcCDgU4hS Vi6zCNlEmDgRqxRp7T/AK1qK/eDFIsl+mFWQbPY3Dj7kllYqWNh8jiEjcJCmMVlr oWyMeg== Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ak68dvqhp-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 24 Nov 2025 11:01:21 +0000 (GMT) Received: by mail-qt1-f198.google.com with SMTP id d75a77b69052e-4ee07f794fcso15333681cf.2 for ; Mon, 24 Nov 2025 03:01:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1763982081; x=1764586881; darn=vger.kernel.org; h=content-transfer-encoding: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; bh=kmWnFKuFNtcDWt9VYmAJ6yQ/jTKnqbkS2w3UokWd2XA=; b=SGr1O8f+rHJFfjPFDNjoigwdi2Jli74p6ClpprZpm8qNwNekCHm+eupanKqYH742NZ K0lQwfnjf3uFphpYFBu3v2ervnqpux1JX3JJU4Iwv3uNAxIxA9bNWpnCAcKAv7k9GwLA QU2RUj/tl+eZV5QHMq/UAkkj+JECPMNBQvlQVmk9TOXaI9IYrbDAEoVXSfrguvycu7jv DIApftNbDXJf+yCk6Q33KIMMWq/9ttCpgeVVic70ICF1y8xUfeaqX2bQg9UTCUMNJ8XC fS1js3Bxz7Fz6gJXmOKMIUqZxhKIA0yCH+Wom6PRjxOCK9qiHwSVIMs69vQvlcqBISb0 /giw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763982081; x=1764586881; h=content-transfer-encoding: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; bh=kmWnFKuFNtcDWt9VYmAJ6yQ/jTKnqbkS2w3UokWd2XA=; b=lkcvBkBx4MGedho8OeHxX0Pvrua/4vfHLYQQwzDCESQDyAexsvuHetrRQnyjCGRqsG SLJFH5w9vO+6WEVGO9/CR0PAn1NJ6JixCtXc65RMom273X4HeKntgeq8ong/TCMXjv/N Qr6qNlAGYqrnbQRm5TIfx9LRzObaDQQj1/VH+//WmN50uncq6R9t4aWRCeJnjt+R5kaL lvdCmwboYRRSss4X1oM5EK605HZ0r4LrBvZVCMvbWjfDuxQdOEEDia85ljBhH+4rQxLC 3g2d4dsjqudh90KhXOGtU5U9fPIVQLYiX+VE3lEOkLaza3b7AhSvEZlifmzMB+gtZptv O2YQ== X-Forwarded-Encrypted: i=1; AJvYcCWp2HZIWGnvWHNnfL80AcSYa+2vBYHbsHiQcByvBjZa3pE121AuqUApfi/MNfLGARw55mLKsCn/WE7V8S8=@vger.kernel.org X-Gm-Message-State: AOJu0YxIpo3RTtiWF54Bhcx3zPhQ4vw/K26PRNHr3aOdJi6zkScDPBMz Eh+nvmKyWHH+8sOVpdIMBOMok4wd44ihGxhyvU20pt+uGbcTOSAGAkEeMLnm/lNbTIr0EuN6qx4 EIMnNDyXoMtL3EvBGoBOvgKNwZTpCFtnxka8AOCeH59ZzFS1qhFTjLn6mrXYw/xX4qkU= X-Gm-Gg: ASbGncvdcqlG/5iny7QDkXeO1qSXgEUa4zU+aKe+XrXgUQ5tPYwg5lUeGr/hM63J17N /FptMNflwXQb2vwSjiYiQKPBjTbiRygvkiN8J7R2IOFWJxk0s1nN1IbmzA1q6EJ+6daEVMOIjr1 a3Syw3kk7fIW/UkkomqWSQa11OAeOJCR69z175cxjFmQ6dws2XVKu5yEekyoOOaTkHPImOrUKXZ 04hIrGPYngmfBYmgnJ4zeEOpi59Xf0oiWPJMUULAxbO0uArJUO8sbG+czO8m8wVJo3XO7/r4uL9 loXzMWEmGlUulxVnR1A+6JSkXotbuiJReLjFwhfZrz/ISN8ScHU122KZVhVsa7wvT6je41xg10N E64gCrMAjfcj+SyC7Xu+A86QzoXyo0FUYf/KfqIcok32uTcGEfF5U0dWy+8rCzcKwt84= X-Received: by 2002:a05:622a:151:b0:4ee:1924:c6fc with SMTP id d75a77b69052e-4ee5883a43cmr108928071cf.1.1763982080640; Mon, 24 Nov 2025 03:01:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IGL5sXsmRBw0D0XCsDUFrVI+NEx70UqgwcK6a92gGa0RVxZdcHmClSbnmd1vrTkeOCIyt+AMw== X-Received: by 2002:a05:622a:151:b0:4ee:1924:c6fc with SMTP id d75a77b69052e-4ee5883a43cmr108927301cf.1.1763982080014; Mon, 24 Nov 2025 03:01:20 -0800 (PST) Received: from [192.168.119.202] (078088045245.garwolin.vectranet.pl. [78.88.45.245]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b7654d502fasm1245441466b.17.2025.11.24.03.01.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 24 Nov 2025 03:01:19 -0800 (PST) Message-ID: <4ec493de-10d9-4a0d-b00c-d6e0f3d92b34@oss.qualcomm.com> Date: Mon, 24 Nov 2025 12:01:15 +0100 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 v2 5/6] arm64: dts: qcom: x1e80100-vivobook-s15: add charge limit nvmem To: Maud Spierings , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Simona Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Konrad Dybcio Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org References: <20251116-asus_usbc_dp-v2-0-cc8f51136c9f@hotmail.com> <20251116-asus_usbc_dp-v2-5-cc8f51136c9f@hotmail.com> <378c611b-f8c6-4f89-a3b3-6d8c22445e83@oss.qualcomm.com> <57bab427-d8fd-490d-88f6-358b79367ed1@oss.qualcomm.com> Content-Language: en-US From: Konrad Dybcio In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMTI0MDA5NyBTYWx0ZWRfX8FdGUNPC1Vmd yVOObOVTqgZBwU6dZkGBzxlDSnEv4dAf8beMT51UOotBBg4QDzrNhRcT+Ci+/FB3YzszQob+gey CWfSPRvZyAvWs6dBh/uaPfnU8VBBFthG5+KbFpCYnyZUNL+Emapbe5df17fZOwbxhKOAqRyC2YX p8aj9m+k9me2NtyQbuD7zOVELBcmSwSQWuKSE8fJEV+UsW7CM/emIXjXz1KJqGHgVCEMDu3iOl0 B/HH/y5m7mI8DGKWmK6/F6h/F3Zge8Y9KbAeKK20zY659kpZw+1P0EN1Ide9YoSKI6B/30tGJCV OJmw+0xrPXoMfgQ9rI7qNyd2/Ox5MJN9DAO+zwFlX4ckgLe7IaSGcqjxCda7mG65vm1J0BmtjeB 8qOlouYYG9LW6/wBdK9jr6hl8+Xm2w== X-Proofpoint-GUID: WUBXhk8NvEb2FLHy8aazk6TBmhC8qhOi X-Proofpoint-ORIG-GUID: WUBXhk8NvEb2FLHy8aazk6TBmhC8qhOi X-Authority-Analysis: v=2.4 cv=UsBu9uwB c=1 sm=1 tr=0 ts=69243b01 cx=c_pps a=mPf7EqFMSY9/WdsSgAYMbA==:117 a=FpWmc02/iXfjRdCD7H54yg==:17 a=IkcTkHD0fZMA:10 a=6UeiqGixMTsA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=69EAbJreAAAA:8 a=EUspDBNiAAAA:8 a=b1RjkcaNCWOaYSfdytUA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=dawVfQjAaf238kedN5IG:22 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-24_04,2025-11-21_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 adultscore=0 priorityscore=1501 impostorscore=0 phishscore=0 suspectscore=0 lowpriorityscore=0 clxscore=1015 malwarescore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2510240001 definitions=main-2511240097 On 11/23/25 12:03 PM, Maud Spierings wrote: > On 11/22/25 14:37, Konrad Dybcio wrote: >> On 11/22/25 12:07 PM, Maud Spierings wrote: >>> On 11/20/25 16:36, Konrad Dybcio wrote: >>>> On 11/17/25 4:44 PM, Maud Spierings wrote: >>>>> On 11/17/25 16:35, Konrad Dybcio wrote: >>>>>> On 11/17/25 3:13 PM, Maud Spierings wrote: >>>>>>> Hi Konrad, >>>>>>> >>>>>>> On 11/17/25 13:59, Konrad Dybcio wrote: >>>>>>>> On 11/16/25 11:52 AM, Maud Spierings via B4 Relay wrote: >>>>>>>>> From: Maud Spierings >>>>>>>>> >>>>>>>>> Add nvmem cells for getting charge control thresholds if they have >>>>>>>>> been set previously. >>>>>>>>> >>>>>>>>> Signed-off-by: Maud Spierings >>>>>>>>> --- >>>>>>>> Have you verified that e.g. >>>>>>>> >>>>>>>> connecting the charger >>>>>>>> setting the charge threshold >>>>>>>> rebooting to windows >>>>>>>> rebooting to windows once more for good measure >>>>>>>> rebooting to linux >>>>>>>> >>>>>>>> still has the settings persist? >>>>>>> Hmm I have tried several things but I can't seem to get the values to stick. I the spmi-sdam driver is compiled in, I am not quite sure if I might be missing something. >>>>>> Hm, I wonder if Windows/UEFI overwrites these values or whether they're >>>>>> used by something else.. >>>>>> >>>>>> Can you set a threshold in windows and see if Linux can read back that >>>>>> data? >>>>> the values in /sys/class/power_supply/jada-jada/ are zero when rebooting from Windows into Linux after enabling charge limitting in the Asus application. >>>>> >>>>> I remember my old vivobook (x86) also forgot its settings each boot, but given the nvmem cells that should not be happing here I guess. It is odd that there seems to be no collision between Windows and Linux. Maybe the Windows mechanism is doing the old trick of writing it in there every boot? >>>> Odd indeed.. Does it work if you reboot from Linux to Linux? >>> It seems not, I seem to remember testing it quite some time ago, but I cannot get it to remember any way, at least it is not popping up in sysfs, always back to 0 >> It seems like the driver currently only populates the sysfs start/stop >> values if the "enable" bit is set >> >> Could you check this (hacky and wrong) diff and give it another try? >> >> diff --git a/drivers/power/supply/qcom_battmgr.c b/drivers/power/supply/qcom_battmgr.c >> index c8028606bba0..9ebd8adfb8eb 100644 >> --- a/drivers/power/supply/qcom_battmgr.c >> +++ b/drivers/power/supply/qcom_battmgr.c >> @@ -733,7 +733,7 @@ static int qcom_battmgr_charge_control_thresholds_init(struct qcom_battmgr *batt >>          u8 en, end_soc, start_soc, delta_soc; >>            ret = nvmem_cell_read_u8(battmgr->dev->parent, "charge_limit_en", &en); >> -       if (!ret && en != 0) { >> +       if (!ret) { >>                  ret = nvmem_cell_read_u8(battmgr->dev->parent, "charge_limit_end", &end_soc); >>                  if (ret < 0) >>                          return ret; >> >> > Nope still nothing, there is one err about "failed to send synthetic uevent: -11" during startup, but I don't know how relevant that is. Hm, I'm a little puzzled.. It may be that ASUS customized the charge control functionality, but I doubt that In any case, this patch should let you limit the charging bounds within a single boot on Linux, so that's already useful.. Reviewed-by: Konrad Dybcio Konrad