From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.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 10D80310774 for ; Thu, 20 Nov 2025 10:10:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763633439; cv=none; b=fDVcufl1sX8Ncxh2DykJ8jLd+wOJ4WyHrVB6tZ6sczc1AxaBG9DltGZYyMZRwwJNsUIyWpIXj7w354uCb+kfXndF/asqK5xzJIANPL39cOrdatMrCtc8RW2XrZMABmLfy0lFnI2/K/HV6MgKtpTUBRDizroD9L9fbKuRZSBQjkU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763633439; c=relaxed/simple; bh=OyZfVmG0raYOvMBF12VXC7cm2GCgMS+jOtMXRYSx6R0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=eT58ogMe/GeajGlRhKOcLtWiYMtbbl5ZGidpEjwy0y+i/EJUEVe/CmcwhG0KMnSt5G/5GX58KEb55+AkKn/WEcdQi3D3VnZtsAY5yw6URRsOXK+ekOTl0my0oKpJBRAId1Yx4D+AXJNgPkt7I8YlbtHeIAEjjU99e2zqgR/ZNtM= 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=SUPbCdKe; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=BCt0GI5H; arc=none smtp.client-ip=205.220.180.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="SUPbCdKe"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="BCt0GI5H" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5AK4xLu24101104 for ; Thu, 20 Nov 2025 10:10:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=qcppdkim1; bh=23cqg0loiit8wTW39VISfFQ4 BP4oAi4cHh27I38AFLE=; b=SUPbCdKesvqaj54ZqI9nC623Lq7sUQAuWOC6y3rR nwWoaMsqHZAIxFlHVHkD2loN+eur7FN8HrO2tSwAjgW4jVMb3V4ihBOd55dgc7a7 s1Y4x0BVWmXB7pSz8GYzNNM/5kbJuNO1ciEpG0mKxtDO4Y7vHuZi/+RbE00FLCW5 /lf8kpSFx9PF1ILMDGbVt4jxtOPMciZ6Ci9c7m279HrjizsCrUIRBnpy1PMH/hoB Ys2Ak1rpBmvk0o0l2xhSCC66HJc3aGJDhipPR+I+OZFRSSieK3plrOAMPGHMOjEz nyy/A7jOzNebXuEzVLJ261LGMeL/CnwaoarfzVUKHF1cMQ== Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ahver0weg-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 20 Nov 2025 10:10:36 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-297d50cd8c4so27636045ad.0 for ; Thu, 20 Nov 2025 02:10:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1763633436; x=1764238236; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=23cqg0loiit8wTW39VISfFQ4BP4oAi4cHh27I38AFLE=; b=BCt0GI5H/KooX5rpvKT+QS1L9mHTNY6yq0w63rX28HilVSvKuUlpxqGcfRmC0Jr/n7 QRZzamgiXiJ7CHiOjNm/JIaVexWo7UQbI2RpCUgUKeh93PtEEd84bNNabJxytyJ5+h4b 21tsLN3bUx91l5czEnPw1HL7hCu2oOdYiw1ifSneb6yVoEa8/X7YBPK7CohyjVDv4Suf BB8sPAGDCEgOIlMoPW/zINaTh595M8pNwdGI3UrJ7Z0McEpniz/sYeRda8F/+oeb+oFs c8+FqJL6HGY++TJbV6GU+0o5sw3Ohu62UDnUp3QuNMtU+Vg4wCKP4VcnjiDGv3jCTQi2 TiQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763633436; x=1764238236; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=23cqg0loiit8wTW39VISfFQ4BP4oAi4cHh27I38AFLE=; b=G5yYyQtwYZiKOBE2S92i7zwVTI1BqmAWtfvQp0LAFCDEJODTqZCbooOgpM3eQw5w3D vyz0dUsX2JLXJakUgfxf54wI/R6yBtksfaJq9eIWdcd6UsURlCbRipm//kk1+yjUlSyQ 96vSv67DYGBioqj5VwIwYh/fP2RjrnKXWG4DaQcgzwe39w3j0oUIu7dIR+mkrQlWUIM3 A8VcHp9zu0Va1DrVXEVWsYULJc0+wIySZtgNYwExbfk4B8MqxwOqBqU2A5Fnffe7A9TI as1YamBGD+JPB2s+rtMdGlwnHjR1jTduglhlNN/fv2NLxAzh+sL/Xk9hRXSc5apPnS5T F9sQ== X-Forwarded-Encrypted: i=1; AJvYcCUwtfdJYTA5LgUykGRM8hXhUw3vzSIWh6RSj7NXHSgZQ51XU/7LRJqUxqydFRqhclJupRBSNbGQjqBm9QI=@vger.kernel.org X-Gm-Message-State: AOJu0YzQ1p/qrf02cyX+9V8rJ3DTw4U/ctri8np4c86K/n9H8enRfr6B YCcu5VRO/ElDkVFwTkgvf/RZ9yLJ/bBYc3Xy+SU+29Y+TJ8FGf8YB/xOppTXqdvoSuU9QmH5h9C dJvEmKdLwd2Q9nu3/3rxVeHXgxy2va6FxB2eBFJImT0XqgB2Hjb2IpCQtv63s0vJVJ3Xf5Q6oaw 4= X-Gm-Gg: ASbGncuFYxPCTJPsAhKtgSZTvy09zhpkHANOBc51qQo8D5/JsZMfzly13x2hb++jpej uLZ55i7Jh9tGz4eUOCq01uVNZgHGIDFjC2JtzAmHqW/0XD9Rr+egqmIgRxe8QS9r1cr8OwpSEx7 Pl8SkClk8Lyp2c180QN53SBYwMPkot5bQHA211LY4JzcK3Pl7Baj5LMzITh+gFZI07leuz7qcb6 VF0Rjtwizny48sbhcxwc2B3wBmJ7lEBuGRNcu0BIbgGmeHXZxcpWvbAFTbwjheW0qAhA7OBtV55 UVPVE7YF0oaIv6+ZsaZhm4rkgMTGIaUR5pbBM4JcV670uZLRDKPBtts13iGrisII8fC7XehUWpG Pbl0owCrukV9ZgIv+ntlWnL2e1ZHYnTnRmVSWna9lYmUTKtY= X-Received: by 2002:a17:902:d544:b0:29b:5c65:4531 with SMTP id d9443c01a7336-29b5c654627mr31208585ad.59.1763633435517; Thu, 20 Nov 2025 02:10:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IFWP4FnW1QIf5n0h8n+V592eiY/dCsne+EMlW+RUnc0PiqPyIi4xPBvqO3h+nAvNkuXaDx5oQ== X-Received: by 2002:a17:902:d544:b0:29b:5c65:4531 with SMTP id d9443c01a7336-29b5c654627mr31208225ad.59.1763633435061; Thu, 20 Nov 2025 02:10:35 -0800 (PST) Received: from hu-arakshit-hyd.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-29b5b13e7e6sm21535785ad.40.2025.11.20.02.10.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 02:10:34 -0800 (PST) Date: Thu, 20 Nov 2025 15:40:30 +0530 From: Abhinaba Rakshit To: Bryan O'Donoghue Cc: Bjorn Andersson , Konrad Dybcio , Manivannan Sadhasivam , "James E.J. Bottomley" , "Martin K. Petersen" , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org Subject: Re: [PATCH 1/2] soc: qcom: ice: enable ICE clock scaling API Message-ID: References: <20251001-enable-ufs-ice-clock-scaling-v1-0-ec956160b696@oss.qualcomm.com> <6PNEPfyjHahJ_pLSaxMINWXDHyO3NKVQD8Bo6XXlA7yI8Qcgim3MDd4gFC8LIMYAIFoAIHnttsDVc6LFEdBWCg==@protonmail.internalid> <20251001-enable-ufs-ice-clock-scaling-v1-1-ec956160b696@oss.qualcomm.com> <22a6cebc-bd09-48f5-a11e-ab925011bd8f@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <22a6cebc-bd09-48f5-a11e-ab925011bd8f@kernel.org> X-Authority-Analysis: v=2.4 cv=ZvPg6t7G c=1 sm=1 tr=0 ts=691ee91c cx=c_pps a=cmESyDAEBpBGqyK7t0alAg==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=kj9zAlcOel0A:10 a=6UeiqGixMTsA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=k58wtyJiP0ZlwjBnw7gA:9 a=CjuIK1q_8ugA:10 a=1OuFwYUASf3TG4hYMiVC:22 X-Proofpoint-ORIG-GUID: LbKs-hLcYiJvycgb15FkleUcAQ2ZvxsQ X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMTIwMDA2MSBTYWx0ZWRfX9Ne2K/SgH81i 39+IOI0q+5Bj+WQiFXhWjjBc0LL3Vo66AKyWmRe0c9/EtIidlqSGY0ol2Gog72AvNaduuS8gHX8 QfCs+d/S3AC04Zpk3YBS8Pmbyg8YnugGJ/I3r1TMP2KPQIRhcEJEF6nKpnw6ghuj/Dd5/8ETlXu 5B2LFvgEzqNirz5IZwNlIuRpZLDTFyVOODJUzCbJ3q41yDw0nLUJk2XjLZbZXHpCfEJPYvMWUBC mAR3MzEl01SJSE6abIfBfU6DQKOVOIxFbzvsi56zz+2PKHtFPt3ZrI0w1JLGZ8n5STXdI88O8qK 1ZmtM2LTsdkJ4kYcxPH5UiZzLZS9JqJprJCvoRYslmpeTpcghPnUbO9qChCS6UUqfY6+P5Re0tL snLfC1ytwwEQl+HSvvXrQQVj8IhXpg== X-Proofpoint-GUID: LbKs-hLcYiJvycgb15FkleUcAQ2ZvxsQ 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-20_03,2025-11-20_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 malwarescore=0 clxscore=1015 priorityscore=1501 spamscore=0 bulkscore=0 adultscore=0 lowpriorityscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2510240001 definitions=main-2511200061 On Thu, Oct 02, 2025 at 01:21:22AM +0100, Bryan O'Donoghue wrote: > On 01/10/2025 12:38, Abhinaba Rakshit wrote: > > Add ICE clock scaling API based on the parsed clk supported > > frequencies from dt entry. > > > > Signed-off-by: Abhinaba Rakshit > > --- > > drivers/soc/qcom/ice.c | 25 +++++++++++++++++++++++++ > > include/soc/qcom/ice.h | 1 + > > 2 files changed, 26 insertions(+) > > > > diff --git a/drivers/soc/qcom/ice.c b/drivers/soc/qcom/ice.c > > index c467b55b41744ebec0680f5112cc4bb1ba00c513..ec8d6bb9f426deee1038616282176bfc8e5b9ec1 100644 > > --- a/drivers/soc/qcom/ice.c > > +++ b/drivers/soc/qcom/ice.c > > @@ -97,6 +97,8 @@ struct qcom_ice { > > struct clk *core_clk; > > bool use_hwkm; > > bool hwkm_init_complete; > > + u32 max_freq; > > + u32 min_freq; > > }; > > > > static bool qcom_ice_check_supported(struct qcom_ice *ice) > > @@ -514,10 +516,25 @@ int qcom_ice_import_key(struct qcom_ice *ice, > > } > > EXPORT_SYMBOL_GPL(qcom_ice_import_key); > > > > +int qcom_ice_scale_clk(struct qcom_ice *ice, bool scale_up) > > +{ > > + int ret = 0; > > + > > + if (scale_up && ice->max_freq) > > + ret = clk_set_rate(ice->core_clk, ice->max_freq); > > + else if (!scale_up && ice->min_freq) > > + ret = clk_set_rate(ice->core_clk, ice->min_freq); > > + > > + return ret; > > +} > > +EXPORT_SYMBOL_GPL(qcom_ice_scale_clk); > > + > > static struct qcom_ice *qcom_ice_create(struct device *dev, > > void __iomem *base) > > { > > struct qcom_ice *engine; > > + const __be32 *prop; > > + int len; > > > > if (!qcom_scm_is_available()) > > return ERR_PTR(-EPROBE_DEFER); > > @@ -549,6 +566,14 @@ static struct qcom_ice *qcom_ice_create(struct device *dev, > > if (IS_ERR(engine->core_clk)) > > return ERR_CAST(engine->core_clk); > > > > + prop = of_get_property(dev->of_node, "freq-table-hz", &len); > > + if (!prop || len < 2 * sizeof(uint32_t)) { > > + dev_err(dev, "Freq-hz property not found or invalid length\n"); > > If this error really happened you should pus the result code up the call > stack also since either case can be an error you can inform the user of > which error happened in your output string. Okay. However, we will move to using OPP table and hence, this logic might change. > > > + } else { > > + engine->min_freq = be32_to_cpu(prop[0]); > > + engine->max_freq = be32_to_cpu(prop[1]); > > You check for zero later on in the code but, is zero a valid value to be > returned here ? > > e.g. is it valid to specify "freq-table-hz" in your DT but then set max to > zero ? min to zero ? > > If not you may as well reject zero and dispense with the checks later on. Yes, zero is valid here (means "no scaling"), will document it in patchset v2. > > > + } > > + > > if (!qcom_ice_check_supported(engine)) > > return ERR_PTR(-EOPNOTSUPP); > > > > diff --git a/include/soc/qcom/ice.h b/include/soc/qcom/ice.h > > index 4bee553f0a59d86ec6ce20f7c7b4bce28a706415..b701ec9e062f70152f6dea8bf6c4637ab6ef20f1 100644 > > --- a/include/soc/qcom/ice.h > > +++ b/include/soc/qcom/ice.h > > @@ -30,5 +30,6 @@ int qcom_ice_import_key(struct qcom_ice *ice, > > const u8 *raw_key, size_t raw_key_size, > > u8 lt_key[BLK_CRYPTO_MAX_HW_WRAPPED_KEY_SIZE]); > > struct qcom_ice *devm_of_qcom_ice_get(struct device *dev); > > +int qcom_ice_scale_clk(struct qcom_ice *ice, bool scale_up); > > > > #endif /* __QCOM_ICE_H__ */ > > > > -- > > 2.34.1 > > > > >