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 88383296BD2 for ; Tue, 30 Jun 2026 13:47:34 +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=1782827257; cv=none; b=ekC2qB7MORKvJfIF3p3dxA1wpKHPVOBNH4aSaTHdkgmAkFYBgu+phKpFUw5ODlU1E3z8od1wKW5DfUscs2mo9deZBEPMWjEEME7RKOM70isFZG0oh0PBCe+p4w6JlI4FTv/7p9uWOP9t6rI0knhhCnveZMuEPMskcQog+q7r6aY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782827257; c=relaxed/simple; bh=uQcFgZ5PTdj0fysLbhqM5+3zbS6y2ntd2SFx87lCYuc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=EtrmtUbFHh1f3ewHBXCxfL2noR6xjeE2HMGxeHE2CGo75vRRF1368Eagtm+7Jb88q5BJG6q9VUjOckKdW7qe1P+vQ7tYuA9Q++6eM/RA9xO+JNtO9oYmsjuGFhdj8PzowxORSwHo32PY+9UPvsy0M59bUYeNGOBEdKlUkKJLcwY= 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=klJIHGzI; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=UwS84tZS; 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="klJIHGzI"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="UwS84tZS" 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 65U9mxbW1604773 for ; Tue, 30 Jun 2026 13:47:33 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= 32rvVfYkUGtiT3VzoEyiVTP+jLoTdGjbv7dR7oDUFGY=; b=klJIHGzI+aaf56xY nG5oZcDutRX0s6Gh3v8WoJz/9ES31zfODh0ZxYppQHhQb22Bbwah7EN/0m38uhh3 rAPCYuz6Cen1DQUS2cmm0CxGDKt3rLcqrj+rhA2ebUBkMMDz368siRaUGOH329p0 /Q4EBo98Pt8lCYn3r8EUuwX6t1xOoVkcqw2FLTdcbXuP35HScwhkxlm8jTnY2BNk JXUs2S3gWYW+3NYwiRA3L/EngiXGRpFWiNYvscHtvOMNVJuDmfrp8z23C3Mn3dav K/TOdCr91d1ejX4Pv27WlhbSAbwcqZnxMgA8qef1vBV+BRzRO66XXG8E+HVJYewh lz0iYg== 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 4f462fjgtu-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 30 Jun 2026 13:47:33 +0000 (GMT) Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-51a07295d67so13647451cf.2 for ; Tue, 30 Jun 2026 06:47:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1782827252; x=1783432052; 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=32rvVfYkUGtiT3VzoEyiVTP+jLoTdGjbv7dR7oDUFGY=; b=UwS84tZS4o1HS1dOKrajcEf2gGfBozLIs236q2BJgFw1l7B36p21FpvRD9EG5f4orA 7DgboH3VXjjtyKbmAYGC3vTAAGIxro6w3K8OXqLX6m31jqoSKxG1kAjhpQME9Hdl+IkD fMXA+jf4/2RaLFvkDlGWCewR/qPw10JizROLPHDVsafxBEI+F1w+PFS+R8FxxXjFGrIO tOtOGeZnHe8q90V5JOlyED4UnAdjoeAk7eboCTl1NvbbxhKAHkDzjaO+KgwMIBCnP4r1 xua4IrpllQPys+J9sxFPJYtEyfwQcwSFZVQPzFlelh5Ay8nZyY2kXTwglkPEykXPwnqW bdiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782827252; x=1783432052; 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=32rvVfYkUGtiT3VzoEyiVTP+jLoTdGjbv7dR7oDUFGY=; b=JeESaT0uy1QFuFNa4gOD2jO92bGAovYIOAittDBCxXYCMLgKzOhh7Opr3AjrbswUSa WJ88ai5+k7JOmkUN9N2IHvbmeWxrKosLfKNaF9jw8F71C6ufsJUFzI00p7lVzSbzpukx lEbSZCf/6feU8OlzqTd5EEMWI9jwR1JQddjHDOl9uM3o2QR8BiVTN6N2TcticR63uIVD /y/MCexOSJzYF9Faf+w7NSJm3L0O8QAaoL+GmVtAEwWm6ZJ8hTdOtXodEAsMGIHrNVMp GY37MZDaLedJlP58Ev9n338csUydSS+j8srD48ta725RgWr+UFHgc8U8vz3OGIsJ1ctL C70g== X-Forwarded-Encrypted: i=1; AFNElJ9xx9iFzwmFyt9nwn0gyCAMV6A4H7iTAvSB+d+rERq3+zTAfIOPBxR4y+n4mRgftqA+2ir6raNra/GGO3E=@vger.kernel.org X-Gm-Message-State: AOJu0Yxqic8nGiy+WcGTCZ4br3ydl2bUHm4oo31CFveR5Pj8EuAp2d1q oz1KlOnZFPzDxOplE0UfpYy4PvNRQITrAu9q51vpjfBY9gKEjayBDQ7uodl+QA7fr55PF1AUl7u CaV7slctf5KSTkMsELlJWCC6xLH2y+7zsMWzATNptYb6glHSnV/mTtEpKSzzluOk+/h4= X-Gm-Gg: AfdE7cm+VndE7N9JFFIQa8JUUdnUQ84ICiYM7vvsV5fuxfAAt25XK3J70uu46XbPo2t 25Xqclo6TEGDuVvX1+ZIw9EnhKMcGQNV9h9W8GWzDzLSJOq+pXPRS2bP8RaJ21nORNhCc7XFPtV xzAWQNN86ygzGIORkSonJUDd073QTgjbDIEv5kSdXFzGs92E/bQFqSwsU8Qm/3DEgQ+mxFlFWnb BLrjc38RRKHlGHVDxTRhg7TZe67AM76K/bT/oT3kn8WEPoRgPM9IGTyx4l1n08ybM0Duaw2MSzy Ws3OZ93DQwYx12UHtyEIFcNORax+/wFl96Zw/EEXvYJinRsGtrBzCc3lDCztopdDrY0txGg66d7 NlY2Xiu0iqonJgoS5wTWPeLvG6Y0raCTpdgo= X-Received: by 2002:a05:622a:180f:b0:50f:a53b:9d5 with SMTP id d75a77b69052e-51c105fd5eamr33252611cf.2.1782827252133; Tue, 30 Jun 2026 06:47:32 -0700 (PDT) X-Received: by 2002:a05:622a:180f:b0:50f:a53b:9d5 with SMTP id d75a77b69052e-51c105fd5eamr33252211cf.2.1782827251549; Tue, 30 Jun 2026 06:47:31 -0700 (PDT) Received: from [192.168.120.170] ([178.235.128.140]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c1288f0cc89sm131546966b.36.2026.06.30.06.47.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 30 Jun 2026 06:47:30 -0700 (PDT) Message-ID: <70a3631f-c687-4bdc-a1b1-7fb123e073c8@oss.qualcomm.com> Date: Tue, 30 Jun 2026 15:47:28 +0200 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/2] regulator: qcom_usb_vbus: add support for qcom,pm4125-vbus-reg To: Rakesh Kota Cc: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Wesley Cheng , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, jishnu.prakash@oss.qualcomm.com, kamal.wadhwa@oss.qualcomm.com References: <20260520-add_pm4125-vbus-reg-v1-0-f6d15d7dbbe8@oss.qualcomm.com> <20260520-add_pm4125-vbus-reg-v1-2-f6d15d7dbbe8@oss.qualcomm.com> <7b47ca4e-dc20-4155-881a-b1849cc000c7@oss.qualcomm.com> <20260520112159.o2p7gyfnwowhxgfp@hu-kotarake-hyd.qualcomm.com> Content-Language: en-US From: Konrad Dybcio In-Reply-To: <20260520112159.o2p7gyfnwowhxgfp@hu-kotarake-hyd.qualcomm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNjMwMDEyNyBTYWx0ZWRfX7PSz/TPC9jKw kwtzsgdjPL5m4fCaYpnFtHNNNpX/HgCZWpBjuwDHPc2USK3qO+8DpcLUq0pUA3FB/HQ3w42VLGg 6dK9XEHmFwhV1097tiLsK1Kt1hUb+rDVGPMX0TgIVhnrIlXbaCBcsl7cKGVBxyjOzu9V/kmeEvk L1ISLiiVmIRis+eL/FcmgL31/hVRFFhqlhHGaueoMDuOjhJAAJWQmiyFPhVAecuMX9uMY1rkPaH EZW4PKUz3CLqhyL1Ce3cPT8EIaCJADaS2b6dQVx0EwqEVu0nHr5OWZ2KV4/AQn9MQoRlRJTyxq+ tNbGWJMlMgkUd9IHpIdFSeh9kD6k/bm5yFzgPV3V/j0ZnelpqZEIvohw7yKthm/+RLyN+ZPiq+b zSLwSo4X8pGopzRqLK6rTkqWM21dIhbXU9sfyJKmYm7XSiJ7a3L/SXnoDU2r6pjn7OhQx/++nO2 GXFqcVSPT8KKS/Hk8nA== X-Proofpoint-ORIG-GUID: J51kxQv3zQ79xz564vqjuRHPQvVSTHSq X-Authority-Analysis: v=2.4 cv=JqbBas4C c=1 sm=1 tr=0 ts=6a43c8f5 cx=c_pps a=WeENfcodrlLV9YRTxbY/uA==:117 a=PRfkaYvzSr8QmIIGAkY2Sg==:17 a=IkcTkHD0fZMA:10 a=FelO9ux0wxsA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=eoimf2acIAo5FJnRuUoq:22 a=EUspDBNiAAAA:8 a=Iub-jLrIGNqVuaaK_7QA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=kacYvNCVWA4VmyqE58fU:22 X-Proofpoint-GUID: J51kxQv3zQ79xz564vqjuRHPQvVSTHSq X-Proofpoint-Spam-Info: AW1haW4tMjYwNjMwMDEyNyBTYWx0ZWRfX0+EuDwPeA69Y rz+loA2+JQyGYik+IAIvsI7L4y+0fEYj5mjRV9vxg3tbsUEo1LRXuv4S/d1tX5FTYWRdVrmOXyR fREVSf6Xpe6YRBucSlOxC1gbFz2eI9Y= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.125,FMLib:17.12.100.49 definitions=2026-06-30_03,2026-06-26_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 priorityscore=1501 bulkscore=0 adultscore=0 impostorscore=0 suspectscore=0 phishscore=0 malwarescore=0 spamscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2606300127 On 5/20/26 1:21 PM, Rakesh Kota wrote: > On Wed, May 20, 2026 at 11:51:49AM +0200, Konrad Dybcio wrote: >> On 5/20/26 11:07 AM, Rakesh Kota wrote: >>> The PM4125 PMIC uses a different register layout for USB VBUS control >>> compared to PM8150B. On PM4125, CMD_OTG is at offset 0x50, OTG_CFG is >>> at 0x56, and offset 0x52 is a 2-bit VBOOST voltage selector rather than >>> a current-limit selector. >>> >>> Introduce per-compatible regulator descriptor data to accommodate these >>> differences. This keeps the existing PM8150B current-limit logic intact >>> while adding a dedicated voltage-selector path for PM4125. >>> >>> Signed-off-by: Rakesh Kota >>> --- >>> drivers/regulator/qcom_usb_vbus-regulator.c | 102 ++++++++++++++++++++++++---- >>> 1 file changed, 88 insertions(+), 14 deletions(-) >>> >>> diff --git a/drivers/regulator/qcom_usb_vbus-regulator.c b/drivers/regulator/qcom_usb_vbus-regulator.c >>> index cd94ed67621fee9f6d7a0327054db0ebab6cc7ee..3d425452a0b35b35c4b454f84eb28e87cc8ba4f8 100644 >>> --- a/drivers/regulator/qcom_usb_vbus-regulator.c >>> +++ b/drivers/regulator/qcom_usb_vbus-regulator.c >>> @@ -20,10 +20,35 @@ >>> #define OTG_CFG 0x53 >>> #define OTG_EN_SRC_CFG BIT(1) >>> >>> +#define PM4125_CMD_OTG 0x50 >> >> This register is named differently > Ok, i will update name to PM4125_VBOOST_EN in next version. >> >>> +#define PM4125_VBOOST_CFG 0x52 >>> +#define PM4125_VBOOST_CFG_MASK GENMASK(1, 0) >>> +#define PM4125_OTG_CFG 0x56 >> >> And so is this one > update name to PM4125_VBOOST_CFG in next version >> >> >>> +#define PM4125_OTG_EN_SRC_CFG BIT(0) >>> + >>> +struct qcom_usb_vbus_reg_data { >>> + u16 cmd_otg; >>> + u16 otg_cfg; >>> + u8 otg_en_src_cfg; >>> + u16 csel_reg; >>> + u8 csel_mask; >>> + const unsigned int *curr_table; >>> + unsigned int n_current_limits; >>> + u16 vsel_reg; >>> + u8 vsel_mask; >>> + const unsigned int *volt_table; >>> + unsigned int n_voltages; >>> + const struct regulator_ops *ops; >>> +}; >> >> And because they're so different, keeping them in a single driver starts to >> look a little odd > > You are right, they differ in control mechanism — one uses current > control and the other uses voltage control for VBUS in host mode. > Since the functional purpose is the same (VBUS regulation in host > mode), I felt a single driver made sense to avoid code duplication. > > But open to suggestions — should I split this into separate drivers > or is there a better way to handle this cleanly? >> >>> + >>> static const unsigned int curr_table[] = { >>> 500000, 1000000, 1500000, 2000000, 2500000, 3000000, >>> }; >> >> And I think there's current-limiting on this PMIC too, except in a differnt >> peripheral (@1300) >> > The @1300 peripheral is for ICL (Input Current Limit) in device mode > charging — not for host mode VBUS regulation. > > Could you share the register you're referring to for further clarity? I think I looked at ICL_OPTIONS (+0x50) and ICL_CFG (+0x52), but yeah, it seems like I mistook the two kinds of currents at play. Konrad