Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3119465rdh; Thu, 28 Sep 2023 03:18:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHoBAhVW1QZGBB3yWmlqPR8lHeDNzrPOwafz/m17HGNVrei0T3IglXpV4cTWDy9jZqjhMYX X-Received: by 2002:a17:902:8649:b0:1c3:1f0c:fb82 with SMTP id y9-20020a170902864900b001c31f0cfb82mr549101plt.41.1695896310015; Thu, 28 Sep 2023 03:18:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695896310; cv=none; d=google.com; s=arc-20160816; b=zjfEH+FZWwV2ym7TBJhH/TjKAooM1YvkxFFVMMvVH64oHPnEb2duzW056Cvvv86/p7 zmKc08U3MwI0lzEY66eKlAvzxV17vboxGeHKi/szzWTPLSOv2jeIiWjjZrOOun/MTyu/ Eu5+9lSeGYmmWjymhJ6Jiax617vHDk7UAcEZioWCFktfvRitB9DmuLOwYLSbuxYit9X8 RMjuOj6pX+mJBwErHIgekvIZKIJzxqVlYxnYxZqBWSEku8cGu0cH1u12v8tUuIlVbaND MLlrAoYSmssGae0G3/xpeKsWBp1PN4ikhn54nHDMgy/QQZ+WYviyc0QH6wMGTpCiiwht PBaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=zjsWLhBbxghFcZQJvI05NQSxSkxktlTftSOowIaiCrE=; fh=pQXGRfgncJVzYayw85Nd1W1jd49C15sx8J5nQhx1pl8=; b=Efia8KhgpT361WAzEo9+hINYKvdH59aFtMb0gqhcCBywyO2KNFsx7uPq5/vZo6RJm/ ykhv0wr8FkaFZV1x90D+cPi+jJR+e4XqumFSE9hDTJPOtM2wVNxHQsDd2P9xxP3moWDI 1dvZH3VD6vwacpsgaRnE1iRwtJ56MJmiUJduLplC+5khrgb233+0BiRAjh1Cp27U+5Xl 18baIW/OEoATP0xP9t7+S3oGzwv2Lvz1Coq/XIH6A8gT4zOUi5myMJHEm1p1IYHyJZHm 7AvfKxvVlAvM0rjKoCcheDCBttpKKGH+0PKo/8ov9AL2obHA4hOI2co47PiOH4mReEPE hIDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=WEkZ7qzL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id f1-20020a170902ce8100b001c3fcfb8000si18293869plg.506.2023.09.28.03.18.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 03:18:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=WEkZ7qzL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id BB23681BF334; Wed, 27 Sep 2023 20:36:14 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230125AbjI1Dfj (ORCPT + 99 others); Wed, 27 Sep 2023 23:35:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229920AbjI1Dfg (ORCPT ); Wed, 27 Sep 2023 23:35:36 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1BAD94; Wed, 27 Sep 2023 20:35:35 -0700 (PDT) Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38S2Hdmo017390; Thu, 28 Sep 2023 03:35:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=zjsWLhBbxghFcZQJvI05NQSxSkxktlTftSOowIaiCrE=; b=WEkZ7qzL7DOzI+6bdGiGNKvoeFfdwwz34zV84vtNISzesUlxcE97dXFCsNjItFMNwZzF bFPO0Rzv/cjY8r3OTtO1pTRuPWzuxBYkN8Adg4wcAKvL6USB0njlD8NtMcfD0YlW4mj9 jiaqLafog94Nn0K5fhu8YPR9TkEd0WExY2j4hQiAWQR08hyz72ttOb4PHGwVAbs4INjo aUo97gZ0o2MqAYFGNymuIh1NegSUY4Oj2EcwiPgcj+C+3q+ec0/JV/c5z70/gbZb7FzU S6d7CZdstIZbm1n5AyfKsXUAOsdnzk3VXZYpyys4v9P5dvh627MA6OHPnACWR7zGYAIf 3Q== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3tcvg98mh3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 28 Sep 2023 03:35:27 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 38S3ZP25014967 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 28 Sep 2023 03:35:25 GMT Received: from [10.216.41.51] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.36; Wed, 27 Sep 2023 20:35:16 -0700 Message-ID: <7d5426cc-01db-e3c5-c968-d57122d0d0f6@quicinc.com> Date: Thu, 28 Sep 2023 09:05:11 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.13.1 Subject: Re: [PATCH v5 3/5] opp: Add dev_pm_opp_find_level_floor() Content-Language: en-US To: Viresh Kumar CC: , , , , , , , , , , , , , , , , , , , , , , , References: <1694066433-8677-1-git-send-email-quic_krichai@quicinc.com> <1694066433-8677-4-git-send-email-quic_krichai@quicinc.com> <20230927071458.busudwwj26kmia4u@vireshk-i7> From: Krishna Chaitanya Chundru In-Reply-To: <20230927071458.busudwwj26kmia4u@vireshk-i7> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: tSZjtMznI6EeQ1NvReX8kI2cEAfR29Jt X-Proofpoint-GUID: tSZjtMznI6EeQ1NvReX8kI2cEAfR29Jt X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-09-27_17,2023-09-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 priorityscore=1501 lowpriorityscore=0 phishscore=0 adultscore=0 bulkscore=0 suspectscore=0 mlxscore=0 mlxlogscore=999 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2309280030 X-Spam-Status: No, score=-2.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 27 Sep 2023 20:36:14 -0700 (PDT) On 9/27/2023 12:44 PM, Viresh Kumar wrote: > On 07-09-23, 11:30, Krishna chaitanya chundru wrote: > > $Subject should have OPP instead of opp. Past history of framework can be seen > for this. > >> During initialization of some drivers, need to vote for max level. >> >> Adding dev_pm_opp_find_level_floor() for searching a lesser match or >> operating on OPP in the order of decreasing level. >> >> Signed-off-by: Krishna chaitanya chundru >> --- >> drivers/opp/core.c | 25 +++++++++++++++++++++++++ >> include/linux/pm_opp.h | 9 +++++++++ >> 2 files changed, 34 insertions(+) >> >> diff --git a/drivers/opp/core.c b/drivers/opp/core.c >> index 919cc53..6d4d226 100644 >> --- a/drivers/opp/core.c >> +++ b/drivers/opp/core.c >> @@ -814,6 +814,31 @@ struct dev_pm_opp *dev_pm_opp_find_level_ceil(struct device *dev, >> EXPORT_SYMBOL_GPL(dev_pm_opp_find_level_ceil); >> >> /** >> + * dev_pm_opp_find_level_floor() - Search for a rounded floor freq > freq ? > >> + * @dev: device for which we do this operation >> + * @level: Start level >> + * >> + * Search for the matching floor *available* OPP from a starting level >> + * for a device. >> + * >> + * Return: matching *opp and refreshes *level accordingly, else returns >> + * ERR_PTR in case of error and should be handled using IS_ERR. Error return >> + * values can be: >> + * EINVAL: for bad pointer >> + * ERANGE: no match found for search >> + * ENODEV: if device not found in list of registered devices >> + * >> + * The callers are required to call dev_pm_opp_put() for the returned OPP after >> + * use. >> + */ >> +struct dev_pm_opp *dev_pm_opp_find_level_floor(struct device *dev, >> + unsigned long *level) >> +{ >> + return _find_key_floor(dev, level, 0, true, _read_level, NULL); >> +} >> +EXPORT_SYMBOL_GPL(dev_pm_opp_find_level_floor); >> + >> +/** >> * dev_pm_opp_find_bw_ceil() - Search for a rounded ceil bandwidth >> * @dev: device for which we do this operation >> * @bw: start bandwidth >> diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h >> index 91f87d7..baea92f 100644 >> --- a/include/linux/pm_opp.h >> +++ b/include/linux/pm_opp.h >> @@ -144,6 +144,9 @@ struct dev_pm_opp *dev_pm_opp_find_level_exact(struct device *dev, >> struct dev_pm_opp *dev_pm_opp_find_level_ceil(struct device *dev, >> unsigned int *level); >> >> +struct dev_pm_opp *dev_pm_opp_find_level_floor(struct device *dev, >> + unsigned long *level); >> + >> struct dev_pm_opp *dev_pm_opp_find_bw_ceil(struct device *dev, >> unsigned int *bw, int index); >> >> @@ -314,6 +317,12 @@ static inline struct dev_pm_opp *dev_pm_opp_find_bw_ceil(struct device *dev, >> return ERR_PTR(-EOPNOTSUPP); >> } >> >> +static inline struct dev_pm_opp *dev_pm_opp_find_level_floor(struct device *dev, > Why add between two bw related functions ? > >> + unsigned long *level) >> +{ >> + return ERR_PTR(-EOPNOTSUPP); >> +} >> + >> static inline struct dev_pm_opp *dev_pm_opp_find_bw_floor(struct device *dev, >> unsigned int *bw, int index) >> { > Fixed all this and applied. Thanks. > I didn't notice this before, thanks for fixing and applying . - KC