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 A6CE7346769 for ; Wed, 18 Feb 2026 19:02:37 +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=1771441359; cv=none; b=JV1oGIcRFxfD/IvjpiEPab3xqhkaAbywWUKkOVYl/PAFAefYrsSPJkg2C0K559hU+uGgd+xnlFIeD2TBz71Lshm1hdDafjlwxe0rbndr+5GG6v77MsgUE9e6jUFpyA47/4d0G7SA/X1BGqkvsUX4/L1BFxheEUJwSyY59EY4vps= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771441359; c=relaxed/simple; bh=NPAOoz43RYhuDi9jjIeNQ9/kIJzQjAIj9Y0mBLlSD+Y=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=uKPGTRg+3tLPV+P2nr3ybQDiKZQO6DkLPVBW2mVqSbeziO9zjLVm70Tg/d2PCp+9PlPbaPlZSB8rKYa20DquSOmTFu0MWE+iz9mjYh2qln4b6lHvUZ94Qwo/zfP1Fb5Ir4AYKjjK9xIuLOBtYcjJTYnkijxYATgG0Z+NirQL5gU= 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=IWh8gHf/; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=MnsK3sDI; 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="IWh8gHf/"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="MnsK3sDI" 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 61IIFMSO3379857 for ; Wed, 18 Feb 2026 19:02: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=tHJCzh7NaOhxkRn2RI+46rfm nRfRQdY+S86XdtOBNuk=; b=IWh8gHf/bIW7MG4nqxZcUTRpJ4wN11XMgDqdO86W mCWK5iJFRJLHXMZk2jBWKYS34q8kA/J4ENiUHX1rYBCYEtiIJh2/k7PnRu6GT5t5 Gc3Kfh3wwCGZDjFcVV4Bck0wpze3EJSQAiLEPozL8Um7v9fYneaeri1cYoKNz+q8 rS0FFCCjKtBhVrv2jhMG96TG2AHXSQdFnj2YXb0t4olSXAJ4kn2XPxpgvDKaHQyG E7bzODZKzjXdSet+/PCabyidlYK+LhRH41B6RhH6euUi6JW1xKcyt/DZGUfzEOym qBgxb59ixfFO4OOe7Vuqc8TOP2cc2KHDfufedbDACG7x/Q== 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 4ccxnykgfg-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 18 Feb 2026 19:02:36 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-2a9638b0422so429965ad.3 for ; Wed, 18 Feb 2026 11:02:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1771441356; x=1772046156; 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=tHJCzh7NaOhxkRn2RI+46rfmnRfRQdY+S86XdtOBNuk=; b=MnsK3sDI9oQa12V3+AzhLDoQ1oHq2URe4aPpRsSTSCCL776zRhUzt47lAiJ8wBDLt8 X4Ach+/Y6O1VGQILNJ1zqNKb/jEK0fLA/9KncEBfpkZFAyAReRsCiZQAY2aVirdf0XVG kfSp6NbXMa7HP2pzmDVtTA3yZu6Mxl8YauEocVvfHQBJqmqaV8tEfejwGrSdMi8ZM9Jp 7b7U9dl1hnL4gWFH6ZHe0PBnupUScCQLXf/Nw5fmxrgwz5jN/mGIOSnE5BazHo61Yi4O sA2vNBH86rXyKV52hg3Ax9f8ZsWtVVgAvHpLw5ON3RMSdTSxEVl4LDJx2FLC3B1YIDkE rXIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771441356; x=1772046156; 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=tHJCzh7NaOhxkRn2RI+46rfmnRfRQdY+S86XdtOBNuk=; b=EuKPNjgJQ9Yk9TT5YZeNwmac6DsRhQl4Rr8CcNJDdfM0XwWI/Ymcfcd3Hg8bYBJ7Of 9Z44FE+x9xgJ0EXcWepou/nZm6qSpfn5f0m2jlQspmBQRNvqtas3AiAc/nAIuyDHLtfA 67CLlHghPcq7TLl5ld1JL6Bc/ygoc9N9/N70yc3gT9lJh+1k5MLFgHtshGcrWTLHwezy jJiT9TwMyq+i7elH/QxKjsWICZ9KvVDR1VdJNq8EU4ZXCBf+P/U5lWR0GuE6jCtXV0D0 qzd+QlXaWZM6Y273jv40OrfUxJaPEIol3MYX6MvbNNE6odGylFVfrDWhXTtOQj+mZjSG 349g== X-Forwarded-Encrypted: i=1; AJvYcCWmlA7a/vn6VfN2TQ0nyZQ115tU33orZBSxa9TtCZJ/y4swyOfLUDgTH0PBDGyxejT+GZ+Wy1kLUmtWeo8=@vger.kernel.org X-Gm-Message-State: AOJu0YzSZ7tS9CuIuZLpKEfAmxvVzrWRxDsNfzI3LWNvigW1mncgECQv njB00blLowroNIZYpIuc+JCVwB95PuwdtkrghZTGWw95kDA5g6XLqmnyvVvW0YdvtG1y915tegz tbThiP+M37CCnD1B2V4wCaqNVcvxL7aBKkAC8cnjs8RgeojX0mWQu1xlaZgH1bCMBerw= X-Gm-Gg: AZuq6aKgISQ+8yN93Av+NTYNwLZZYRZB0zlQ9PjLuqDnArpSJTxC9UhrhzTGCSI0l+X XQp4zC5/Xc5BYxb4pYsw696tJcyYhWCVbqN5fKtrWyZXk7AKs2o4r09nhkwZriNL32ip41YFfNX laQOIUnXq3Z8Xxt8ZdfBW+pgY/vblLEbGEB63R1QK+YzuOm/IkkdBBnZNkbJ8RptvfWrnwsrW7z bdIiRxVxZqaHhTKnLp7S2dvJLm+T3MxtBwc5WAundXS6ZuBX3wbionpUNx3Dn5yZVBWRQRqe3Ie RKL0DPIcA5c5KtTqt+iQGrMjPasZhKg9G7oF09utToaW/9vZTuGKttgsWWINbvdQceYfmnPI+Zk vlf7ZvkolHRrbCwiLXu7Vw7ZmSYlpTNgmUGDMC43MD9i2XPFlhnTshH0ssTo= X-Received: by 2002:a17:903:2391:b0:2a9:4700:2a94 with SMTP id d9443c01a7336-2ad1740bc3emr158534055ad.10.1771441356058; Wed, 18 Feb 2026 11:02:36 -0800 (PST) X-Received: by 2002:a17:903:2391:b0:2a9:4700:2a94 with SMTP id d9443c01a7336-2ad1740bc3emr158533685ad.10.1771441355474; Wed, 18 Feb 2026 11:02:35 -0800 (PST) Received: from hu-arakshit-hyd.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2ad1aadc7f8sm137306585ad.66.2026.02.18.11.02.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Feb 2026 11:02:34 -0800 (PST) Date: Thu, 19 Feb 2026 00:32:27 +0530 From: Abhinaba Rakshit To: Konrad Dybcio Cc: Bjorn Andersson , Konrad Dybcio , Manivannan Sadhasivam , "James E.J. Bottomley" , "Martin K. Petersen" , Neeraj Soni , Herbert Xu , "David S. Miller" , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, linux-crypto@vger.kernel.org, devicetree@vger.kernel.org Subject: Re: [PATCH v5 2/4] soc: qcom: ice: Add OPP-based clock scaling support for ICE Message-ID: References: <20260211-enable-ufs-ice-clock-scaling-v5-0-221c520a1f2e@oss.qualcomm.com> <20260211-enable-ufs-ice-clock-scaling-v5-2-221c520a1f2e@oss.qualcomm.com> <3ecb8d08-64cb-4fe1-bebd-1532dc5a86af@oss.qualcomm.com> 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: <3ecb8d08-64cb-4fe1-bebd-1532dc5a86af@oss.qualcomm.com> X-Proofpoint-ORIG-GUID: F7EAZrJOim8nxp2mh1CWsLV7WQZVLN3p X-Authority-Analysis: v=2.4 cv=Do5bOW/+ c=1 sm=1 tr=0 ts=69960ccc cx=c_pps a=cmESyDAEBpBGqyK7t0alAg==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=kj9zAlcOel0A:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=Mpw57Om8IfrbqaoTuvik:22 a=GgsMoib0sEa3-_RKJdDe:22 a=JfTRIjoQZr9pu4DAOa4A:9 a=CjuIK1q_8ugA:10 a=1OuFwYUASf3TG4hYMiVC:22 X-Proofpoint-GUID: F7EAZrJOim8nxp2mh1CWsLV7WQZVLN3p X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjE4MDE2MiBTYWx0ZWRfX8iz1/29Y3wUg q7pSyMliwaPG7hCvo9Z/ijqkNxOmEFpAoi/ufiLqKkBmfAkQZuXml9L0GsxJsYur38fI4VMVFen WLGKAhyjRd/w6/eQI2eMov95sFH+VhMPWBkc7kLgn5ySF+2JDJZK9krEluexOvZGbEbsgXFOqVT eUlK+SX/2PEZNIbzlA0kzhio0fONa99r4rSn/Qw/W32eCOgGZCytzt/c7RFDO7bHA/l50+FMqct 6K/UidQVkglWvkqHfYGYQ5gQQNjwejAwn33UYVG4YC6Qmji1UqDC0L+FhJlTJytytFby13wUsoj Dw8ZZ0svfFyAcKqyDpOcJCuI1Bf6jNU5wRC/oq1oDGzq90rtNoiaMdGcB/XbRVsHLaZXmMvT1cV qa5hMQxGMqvHh4CYn1YKZBjKRageg/NX89SirbHfVoXtkhdQEcqj9UHcFpWVTNBiJn3kQqfxWYd H3NemOTp+L4/tfGqzlw== 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-18_04,2026-02-18_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 impostorscore=0 phishscore=0 bulkscore=0 clxscore=1015 priorityscore=1501 adultscore=0 malwarescore=0 suspectscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602180162 On Mon, Feb 16, 2026 at 01:18:57PM +0100, Konrad Dybcio wrote: > On 2/13/26 8:02 AM, Abhinaba Rakshit wrote: > > On Thu, Feb 12, 2026 at 12:30:00PM +0100, Konrad Dybcio wrote: > >> On 2/11/26 10:47 AM, Abhinaba Rakshit wrote: > >>> Register optional operation-points-v2 table for ICE device > >>> and aquire its minimum and maximum frequency during ICE > >>> device probe. > > [...] > > >>> + if (!ice->has_opp) > >>> + return -EOPNOTSUPP; > >>> + > >>> + /* Clamp the freq to max if target_freq is beyond supported frequencies */ > >>> + if (ice->max_freq && target_freq >= ice->max_freq) { > >>> + ice_freq = ice->max_freq; > >>> + goto scale_clock; > >>> + } > >>> + > >>> + /* Clamp the freq to min if target_freq is below supported frequencies */ > >>> + if (ice->min_freq && target_freq <= ice->min_freq) { > >>> + ice_freq = ice->min_freq; > >>> + goto scale_clock; > >>> + } > >> > >> The OPP framework won't let you overclock the ICE if this is what these checks > >> are about. Plus the clk framework will perform rounding for you too > > > > Right, maybe I can just add a check for 0 freq just to ensure the export API is > > not miss used. > > Something shown below: > > > > if (!target_freq) > > return -EINVAL; > > > > However, my main concern was for the corner cases, where: > > (target_freq > max && ROUND_CEIL) > > and > > (target_freq < min && ROUND_FLOOR) > > In both the cases, the OPP APIs will fail and the clock remains unchanged. > > I would argue that's expected behavior, if the requested rate can not > be achieved, the "set_rate"-like function should fail > > > Hence, I added the checks to make the API as generic/robust as possible. > > AFAICT we generally set storage_ctrl_rate == ice_clk_rate with some slight > play, but the latter never goes above the FMAX of the former > > For the second case, I'm not sure it's valid. For "find lowest rate" I would > expect find_freq_*ceil*(rate=0). For other cases of scale-down I would expect > that we want to keep the clock at >= (or ideally == )storage_ctrl_clk anyway > so I'm not sure _floor() is useful Clear, I guess, the idea is to ensure ice-clk <= storage-clk in case of scale_up and ice-clk >= storage-clk in case of scale_down. Best would be to use, _floor for scale_up and _ceil for scale_down. > > > > Please let me know, your thoughts. > > > >>> + > >>> + switch (flags) { > >> > >> Are you going to use these flags? Currently they're dead code > > > > I agree, currently they are not used. > > However, since its an export API, I want to keep the rounding FLAGS > > support as it a common to have rounding flags in clock scaling APIs, > > and to support any future use-cases as well. > > I think you have a bit of a misconception - yes, this is an export API and > should be designed with the consumers in mind, but then it's consumed by > in-tree modules only ("what's not on the list doesn't exist"), so it's actually > generally *discouraged* (with varying levels of emphasis) to add any code that > is not immediately useful, as these functions can be updated at any point in > time down the line Sure, understood Will make sure to update in next patchset and make use of rounding flags. Abhinaba Rakshit