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 1A2BE279336 for ; Fri, 13 Feb 2026 10:55:15 +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=1770980118; cv=none; b=KviVxYiyRUp6CPzyz2iP/mGjvObXzVg11D8nX9m4yXv88FehmiZjxRwzt2c3gfpOMf1ynCUZ/cNdFkW+g+a1EJq+lGwOsuRl0lUdpxGavq0ZyUGoX7pqLCQ8KDx7YpQ4Sq7Zemn1d2tRBP1c0ogaIf/lhiVq2KOGgGraGuC00Ug= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770980118; c=relaxed/simple; bh=sISlQNo22rhzeXky3hysxZuotkwCFL5UOEy78QbT9GA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=UucvYjrx2X8B/psxAfZWbmGrrtxtpfYKLNKgmGxlz1stZSkv/Sn/mJjvfe/A2vikFC7piK3YhuuBWHpktqSAu7jphv2iY6WL0ASu1mqToiweylibOkTuyq7TLnSMXKeti4B0qYzVE+sp06VYhpu0x73Xpi775qFVOM1WX9rXCAE= 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=A7/NKsr/; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=I7MyPJi5; 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="A7/NKsr/"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="I7MyPJi5" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 61D7kBLk1642041 for ; Fri, 13 Feb 2026 10:55:15 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= zouAPUjQyVlj9GPmB6CLRV7EXXiZWNs++RVmMWYgHOc=; b=A7/NKsr/Zmc8EQUY I/alKTHEJLsf5D2+jw1AOZ40DKII3mqwc83s4ozT+BPS2BbIMIIABDQlmHPl40Rp jChC7uwk37NXwBeB3lc+qdukdGDOP3QD9NTER9koqquSMRLb3d2EIe1Go5QKY/am uq0jme+Xe9d914Skre/j0TyT1D7SdrcMjy9G76iFdJitmSv9rJcB95lALH9Odivh cOnqGieSyX268kU+Tv3kOPVWIT4ZdXYA2O6yPe7ZLOQCC3k8/fvcpAphbaiiK9f7 v1EoWE9/KICn04TvwGZnfGKwDI4O/bEGKvjbmHQmWlsciF7VFq8+/Jcy97AALBmN MdFzIg== Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4c9ptv2g5h-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 13 Feb 2026 10:55:15 +0000 (GMT) Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-8cb38a5dc3cso21613285a.3 for ; Fri, 13 Feb 2026 02:55:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1770980114; x=1771584914; 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=zouAPUjQyVlj9GPmB6CLRV7EXXiZWNs++RVmMWYgHOc=; b=I7MyPJi5MunLu4BpjxmWX7x9LgdX6VplX3DIkLdaKyMenb/u14Rhv8N/NTf/VAPk+Z 5NaIV/hRlGNS///thSMQ2x1ed924+0LVykphh8Uhv382CYKq+yXioi77qYL+pMKzxGcV HvOcZ1xgoWjwJET32+uwmmX5TOEPVWO5VBGGiYouNornzvFzdG0VBCBAdLpzLlH0nLL5 ZoqyX7F90+psTJrcJLMnmQJo9I9o149cqEzOMjGW2kc8+Xu+7jW397jbE9rBiNhM+PSN v/h7cblSZuqa8SAuAZ/SxUxAuSxxowmkhO53rhLAiJSuSGbjWCdKLEjkMgJLgq1epEpa 8CiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770980114; x=1771584914; 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=zouAPUjQyVlj9GPmB6CLRV7EXXiZWNs++RVmMWYgHOc=; b=dahhHnROM4dRwizKqVyaQk3GLUl8w7ARicw5OxNOTZUOHZN61RbB9pvz7PotyBqarw xOFpqC6aRrezFKQBPD+TTCqubdRqRyuha1Eq0i4nQCmI+WZi2Mdt77/rp2XzjOh9VXhU 4BCS2/ud+PdbHwYJmhNAIdAol9zJp88dgi7rQEurfoZxvvvVEB70F5atTlb45JBlscIY DCG3LycOARWye0OKkivMghTi24/8MHKx3vdA+bg8LoH+HznGIb6P1bkx6xT3u9Zp/8ek wlQCg7Rv07b0WIGNBop3cSn3uZkTJg4UR1oyOEpAd6+l/rHPZHua+YnbMNTw9Eip+RAT pK7A== X-Forwarded-Encrypted: i=1; AJvYcCV6HtgTnEsYJbb4rVWht28/prW3MYjxtUsDj2sJyGTJnPkd4Oo1aE9xVkyouvOnrZT7mOUr7L8ZNuW4PQc=@vger.kernel.org X-Gm-Message-State: AOJu0YwBHC4Q/WPhU+sZXehho+gpA4zeq+xeyihx2z0+VArRr2letsP5 7GKft2HQbIROlsvh+mKkYnjHQO2QvNRM6QXL1p0l6pqMSsQGXqaMwSUg7KrE/TcahYSk0UerlA7 VVw7h5Qp62Y7gZpK78QFMhBvg4JSe7zE9ijGb+kNSpiKP/79FqpinD2uyTg+Ww/rFrrg= X-Gm-Gg: AZuq6aIDbWGW8nt5X+e2Lqb3velmbuDxnW/G9Ny///RoqsSzHdslrcD7LjYWBSewVZ+ YkQWRlX+Gq70cS/uHqNHOBzSlLnusjrbmmF33c7M2gUaRwjzCpUj1Fp9sW5vPjpN7Fz2x951NuA oQS8t7XOJV2AGbJGhvvxVwdKx5Tw43rbFckEP8NtXbhSDfzIVUHa19t4/rZjaZWLE+ZWy/y4fmC yN0SHvlB5LlJQTwrWtgUOhegxHTQPV2/cd81YbtMsMPKCUTU0gGln0oiHyydsKR28CV5FcpT/vl 5CPX8ZA1IgCEi9kA9LDSN38r8ZIBQ/SArlC5fth/1YsRJhh70WrNVS6xwCC7iPDlKDvQhM4WtlC x+9u/bwZ+0rkOvAat9UahBp6IvOPnPKYGYFM8GwPeqFaiqHXPVL95b0oxDpnP5TelOGf1qhPYV7 LtJv4= X-Received: by 2002:a05:620a:258f:b0:8c5:3892:a554 with SMTP id af79cd13be357-8cb408477a0mr171811085a.3.1770980114378; Fri, 13 Feb 2026 02:55:14 -0800 (PST) X-Received: by 2002:a05:620a:258f:b0:8c5:3892:a554 with SMTP id af79cd13be357-8cb408477a0mr171808185a.3.1770980113926; Fri, 13 Feb 2026 02:55:13 -0800 (PST) Received: from [192.168.119.254] (078088045245.garwolin.vectranet.pl. [78.88.45.245]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b8f6e95004dsm247492166b.5.2026.02.13.02.55.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 13 Feb 2026 02:55:13 -0800 (PST) Message-ID: <367a41a9-8e80-4bcd-9985-242469024b31@oss.qualcomm.com> Date: Fri, 13 Feb 2026 11:55:10 +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 2/4] hwmon: Add Qualcomm PMIC BCL hardware monitor driver To: Manaf Meethalavalappu Pallikunhi , Guenter Roeck , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Konrad Dybcio , amit.kucheria@oss.qualcomm.com, Daniel Lezcano , Gaurav Kohli Cc: linux-hwmon@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org References: <20260206-qcom-bcl-hwmon-v1-0-7b426f0b77a1@oss.qualcomm.com> <20260206-qcom-bcl-hwmon-v1-2-7b426f0b77a1@oss.qualcomm.com> <7911bbae-c507-4420-a05c-89242941f774@oss.qualcomm.com> <66e6696d-3fab-4da5-ab89-4067d856f186@oss.qualcomm.com> Content-Language: en-US From: Konrad Dybcio In-Reply-To: <66e6696d-3fab-4da5-ab89-4067d856f186@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Proofpoint-GUID: 8y3qA4gqKM7Kb8caobnk7RkMB3F8kNet X-Authority-Analysis: v=2.4 cv=eaowvrEH c=1 sm=1 tr=0 ts=698f0313 cx=c_pps a=qKBjSQ1v91RyAK45QCPf5w==:117 a=FpWmc02/iXfjRdCD7H54yg==:17 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=Mpw57Om8IfrbqaoTuvik:22 a=GgsMoib0sEa3-_RKJdDe:22 a=EUspDBNiAAAA:8 a=0IPvm9oXmU5doNSm3s4A:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=NFOGd7dJGGMPyQGDc5-O:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjEzMDA4MyBTYWx0ZWRfXy6Da3d2/NrJi 3FOaXwstD5bqu1VAvORpCpyvI34ARlm87viIcFznZi/6r934Mckl3szj/kjs3CTd0hif3T2WRKO KsMH6hjzAsnZdniIK3f9RJq45ONKmte41eeGTT3LIn1L9uBhNS62Zee4hsy1VgVvAh/bQW2d8o8 aJecdIaQHUuNVAn1gac5U1aFCr5qUXfbo5bLDxZjIjmEGCAmm0S7VmSCbKnLRXJqKbf/Z6CKaS9 D54qexlld7c+1mRwmYUxUrSCDVUh2jLH3EE1qo/gaF9a+KyTyWZntDhIDMyxBFsKABmbMYpotHp OfWXLqTpAF2FPtytpg3ACm/BkFdukXCRxmbd2JilL5b5kwXIWs86yKX9BTO89WF8eiqbf74espu mRXzA4t0k4zYWRVMlaL+c4EWu4KtlNnAaRVOMqSk7TlwLnt0lpFoJCBCS+1x0PA9HPzQt7rfSQ/ z1jwFi600et+fgepBaw== X-Proofpoint-ORIG-GUID: 8y3qA4gqKM7Kb8caobnk7RkMB3F8kNet X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-13_01,2026-02-12_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 adultscore=0 lowpriorityscore=0 clxscore=1015 phishscore=0 impostorscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602130083 On 2/13/26 10:42 AM, Manaf Meethalavalappu Pallikunhi wrote: > Hi Konrad, > > > On 2/6/2026 2:57 PM, Konrad Dybcio wrote: >> On 2/5/26 10:14 PM, Manaf Meethalavalappu Pallikunhi wrote: >>> Add support for Qualcomm PMIC Battery Current Limiting (BCL) hardware >>> monitor driver. The BCL peripheral is present in Qualcomm PMICs and >>> provides real-time monitoring and protection against battery >>> overcurrent and under voltage conditions. >>> >>> The driver monitors: >>> - Battery voltage with configurable low voltage thresholds >>> - Battery current with configurable high current thresholds >>> - Two limit alarm interrupts (max/min, critical) >>> >>> The driver integrates with the Linux hwmon subsystem and provides >>> standard hwmon attributes for monitoring battery conditions. >>> >>> Signed-off-by: Manaf Meethalavalappu Pallikunhi >>> --- [...] >>> +                    enum bcl_channel_type type, u8 field_width) >>> +{ >>> +    u32 def_scale = desc->channel[type].default_scale_nu; >>> +    u32 lsb_weight = field_width > 8 ? 1 : 1 << field_width; >>> +    u32 scaling_factor = def_scale * lsb_weight; >> Would this be equivalent? >> >> if (field_width > 8) >>     def_scale <<= field_width; Actually reading it again, that'd be "if (field_width *<=* 8)" and the div_s64 could become a mult_frac() if you take care of the types I would then read that as "some PMICs have a higher resolution ADC but with the same range" - would that be right? Konrad