From nobody Sat Feb 7 17:55:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD2D9EB64DD for ; Fri, 21 Jul 2023 09:41:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230111AbjGUJlU (ORCPT ); Fri, 21 Jul 2023 05:41:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230029AbjGUJlO (ORCPT ); Fri, 21 Jul 2023 05:41:14 -0400 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CB282D46 for ; Fri, 21 Jul 2023 02:41:13 -0700 (PDT) Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1b89d47ffb6so10390125ad.2 for ; Fri, 21 Jul 2023 02:41:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689932473; x=1690537273; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=C6yDwHR8CjSzLvtEor6MI6CE+UiAGOZc12BD4oiDuSo=; b=PdKQDS+1nlXydb+5R8TxjZ7RbKzetxDiuD7HuGUHno/JNfMOM1u+Wugb/3enYlBk0a /yJRnGtbDQsFLP5Vhtcis/4Q0J2RY5Jvk1NWjHcaBmvu/RgtuWqDmAu1uMk4YoeqtNxp iyUHSBJydok2kBv/ryvHmscoax+3oJELdtfRGtyX3zf9qdxnN5E8N6nWLvy4rpkmOT4o hRLSF8TeHyf1FdQgQvchDb/1d+iNwbwiMdFQtZE3BOcPI4Nm2W2XM1aV5U21xenx9YR4 6qLMKQhJBb1JrYhh5dsRcdbVTcrrrhYgSEkDq0I/7XhH7qQUISf3qrSnpBlXHl+RGbS/ /uMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689932473; x=1690537273; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=C6yDwHR8CjSzLvtEor6MI6CE+UiAGOZc12BD4oiDuSo=; b=PjTiMFKsUe9iZLpOQMlMBnGJ5Qm1SpExTtDeDRkNHjoDuiSHT7chEIeh2+9UF25kBw f/AwS47xCfuwio/Zg95QrTeamN8jqhjOpfDZsp0NvaPvrz9YRppDUOLw21EtlQciUtuy 5xcaedHUFtOCJpEtuwJOIuvnYUhPcsdk5hceG24uOKzoxSvl1fh5mE5ncmilU4uacLsg 8z6X4W4w0pY2QDO7Ac3e/WlvADRkeTzt4H7h2L60phn7zIHFGbBUt4aN8lDIBasqC9cM YfUtk5HVryhhssdfw8B3xnJagh1sytsbamxz2hCgYodZz6Ts+LUp3bRktRsnlndbNndJ d47g== X-Gm-Message-State: ABy/qLYlfgPUwWy2EPjCAhhom2gT0TWspYVI5GcqEinxh+TMbyuYj2kU 44ZbhdZ8n2QUucAi9nk1RtBbLQ== X-Google-Smtp-Source: APBJJlHHO7Z+R2tpbCR19q/21EKGqsi2PifbH2YSzzeeHwz2+Q4HfzwBny+9uk4Oi5w4pSHQKKM8lQ== X-Received: by 2002:a17:902:ce84:b0:1b6:ba60:77f0 with SMTP id f4-20020a170902ce8400b001b6ba6077f0mr1347225plg.10.1689932472961; Fri, 21 Jul 2023 02:41:12 -0700 (PDT) Received: from localhost ([122.172.87.195]) by smtp.gmail.com with ESMTPSA id c1-20020a170902d48100b001b895a17429sm2959770plg.280.2023.07.21.02.41.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jul 2023 02:41:12 -0700 (PDT) From: Viresh Kumar To: Viresh Kumar , Nishanth Menon , Stephen Boyd , "Rafael J. Wysocki" Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Manivannan Sadhasivam , linux-kernel@vger.kernel.org Subject: [PATCH 1/6] OPP: Rearrange entries in pm_opp.h Date: Fri, 21 Jul 2023 15:10:54 +0530 Message-Id: <754833b3194c30dad5af0145e25192a8e29521ab.1689932341.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Rearrange the helper function declarations / definitions to keep them in order of freq, level and then bw. Signed-off-by: Viresh Kumar --- include/linux/pm_opp.h | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index dc1fb5890792..3821f50b9b89 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -121,17 +121,19 @@ unsigned long dev_pm_opp_get_suspend_opp_freq(struct = device *dev); struct dev_pm_opp *dev_pm_opp_find_freq_exact(struct device *dev, unsigned long freq, bool available); + struct dev_pm_opp *dev_pm_opp_find_freq_floor(struct device *dev, unsigned long *freq); =20 +struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *dev, + unsigned long *freq); + struct dev_pm_opp *dev_pm_opp_find_level_exact(struct device *dev, unsigned int level); + struct dev_pm_opp *dev_pm_opp_find_level_ceil(struct device *dev, unsigned int *level); =20 -struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *dev, - unsigned long *freq); - struct dev_pm_opp *dev_pm_opp_find_bw_ceil(struct device *dev, unsigned int *bw, int index); =20 @@ -247,32 +249,32 @@ static inline unsigned long dev_pm_opp_get_suspend_op= p_freq(struct device *dev) return 0; } =20 -static inline struct dev_pm_opp *dev_pm_opp_find_level_exact(struct device= *dev, - unsigned int level) +static inline struct dev_pm_opp *dev_pm_opp_find_freq_exact(struct device = *dev, + unsigned long freq, bool available) { return ERR_PTR(-EOPNOTSUPP); } =20 -static inline struct dev_pm_opp *dev_pm_opp_find_level_ceil(struct device = *dev, - unsigned int *level) +static inline struct dev_pm_opp *dev_pm_opp_find_freq_floor(struct device = *dev, + unsigned long *freq) { return ERR_PTR(-EOPNOTSUPP); } =20 -static inline struct dev_pm_opp *dev_pm_opp_find_freq_exact(struct device = *dev, - unsigned long freq, bool available) +static inline struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *= dev, + unsigned long *freq) { return ERR_PTR(-EOPNOTSUPP); } =20 -static inline struct dev_pm_opp *dev_pm_opp_find_freq_floor(struct device = *dev, - unsigned long *freq) +static inline struct dev_pm_opp *dev_pm_opp_find_level_exact(struct device= *dev, + unsigned int level) { return ERR_PTR(-EOPNOTSUPP); } =20 -static inline struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *= dev, - unsigned long *freq) +static inline struct dev_pm_opp *dev_pm_opp_find_level_ceil(struct device = *dev, + unsigned int *level) { return ERR_PTR(-EOPNOTSUPP); } --=20 2.31.1.272.g89b43f80a514 From nobody Sat Feb 7 17:55:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4482EB64DC for ; Fri, 21 Jul 2023 09:41:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230212AbjGUJl2 (ORCPT ); Fri, 21 Jul 2023 05:41:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230120AbjGUJlS (ORCPT ); Fri, 21 Jul 2023 05:41:18 -0400 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E58C330C7 for ; Fri, 21 Jul 2023 02:41:16 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-68336d06620so1531172b3a.1 for ; Fri, 21 Jul 2023 02:41:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689932476; x=1690537276; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6VfRkQPrBQp5nkzs4j3nyKArLBvoZpDkodHX3J6rbBs=; b=iCXPQGvwGph1wJcfy5vSSwH6shKYOGyynlju+9gl4A04h/yKW9uOhJRBt8NLnwxmo6 ED0QoVvs6hdXY5QsxX6AlkkaG3tj4o/XB0FBmWbBrdJ4GUM2T2TK9pSZlsKQMyYgSYz6 MppgzuZZ56SOT1Tr0Ti7X+g2ov8t+2tuNznc+FukPQ6mIK3U1fa987bB+yHh8svg4oRG LNSXvTbC2fYdX9P2hR8XRhia9Bo1em7EHAzTCySDUy1u922uOvaoLOAMBpkF0Hbs+Pci M9LFscK0/EDqwEY7zgmjhW9llglYBLEfJ8002K2wHzkSlgT/0mOG3qbc9JRMk4pjQSoQ pMWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689932476; x=1690537276; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6VfRkQPrBQp5nkzs4j3nyKArLBvoZpDkodHX3J6rbBs=; b=gQPHzvCXrJqZkj7l9Mh7M4uOuSF8pjCmZEKYLQijZTs30mEzK5cnqcTrTEo9xS0jQc aGvegN9QnJZZZBW2lCqI4CHUr+dw81tIo75obbhtcWx5Dky9V7npCJmDHd36c3m99s2R YG/gmtJ51v6fULcUaJx8wmPIUdaC4xP20zYzCnUxTRU/myYq1uuXJ4LgOb1gyBPZts3Z LrMYkwwOVx94K3zIS+67CsMh10v06ZgZkxXj44aaiJ931vaDU4r8ye8EO9tr7qwpR3Z4 Sj/lZPfrV4bx7brG+Qh2/3eRgePpycYi5NVr5e3+g4FYd2ScNr4Rw4pJm40vxyDW53M8 3jgw== X-Gm-Message-State: ABy/qLZtTUI3E79/lVx705E0cBtnGbrau3ylNfCTPZ9bFy1Fo/UxEhl4 9bqFPBtWBuQO5/qAmYetSizbfmwRl600Ag6Pnq4= X-Google-Smtp-Source: APBJJlFFaDABXjfj3teUYbjZ3xP8/Hta2nJG2IfmVTu/qm200JNmynpvTbbWjXkG9w7UAXArYfhCQg== X-Received: by 2002:a05:6a00:22c4:b0:686:2fde:4da with SMTP id f4-20020a056a0022c400b006862fde04damr1949197pfj.15.1689932476347; Fri, 21 Jul 2023 02:41:16 -0700 (PDT) Received: from localhost ([122.172.87.195]) by smtp.gmail.com with ESMTPSA id x9-20020a056a00270900b00654228f9e93sm2584934pfv.120.2023.07.21.02.41.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jul 2023 02:41:15 -0700 (PDT) From: Viresh Kumar To: Viresh Kumar , Nishanth Menon , Stephen Boyd , "Rafael J. Wysocki" Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Manivannan Sadhasivam , linux-kernel@vger.kernel.org Subject: [PATCH 2/6] OPP: Introduce dev_pm_opp_find_freq_{ceil/floor}_indexed() APIs Date: Fri, 21 Jul 2023 15:10:55 +0530 Message-Id: <142e17c1c2b48e3fb4f024e62ab6dee18f268694.1689932341.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Manivannan Sadhasivam In the case of devices with multiple clocks, drivers need to specify the clock index for the OPP framework to find the OPP corresponding to the floor/ceil of the supplied frequency. So let's introduce the two new APIs accepting the clock index as an argument. These APIs use the exising _find_key_ceil() helper by supplying the clock index to it. Signed-off-by: Manivannan Sadhasivam [ Viresh: Rearranged definitions in pm_opp.h ] Signed-off-by: Viresh Kumar --- drivers/opp/core.c | 56 ++++++++++++++++++++++++++++++++++++++++++ include/linux/pm_opp.h | 18 ++++++++++++++ 2 files changed, 74 insertions(+) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 3f46e499d615..cb4f47b341f9 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -658,6 +658,34 @@ struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct de= vice *dev, } EXPORT_SYMBOL_GPL(dev_pm_opp_find_freq_ceil); =20 +/** + * dev_pm_opp_find_freq_ceil_indexed() - Search for a rounded ceil freq fo= r the + * clock corresponding to the index + * @dev: Device for which we do this operation + * @freq: Start frequency + * @index: Clock index + * + * Search for the matching ceil *available* OPP for the clock correspondin= g to + * the specified index from a starting freq for a device. + * + * Return: matching *opp and refreshes *freq accordingly, else returns + * ERR_PTR in case of error and should be handled using IS_ERR. Error retu= rn + * 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_freq_ceil_indexed(struct device *dev, unsigned long *freq, + u32 index) +{ + return _find_key_ceil(dev, freq, index, true, _read_freq, NULL); +} +EXPORT_SYMBOL_GPL(dev_pm_opp_find_freq_ceil_indexed); + /** * dev_pm_opp_find_freq_floor() - Search for a rounded floor freq * @dev: device for which we do this operation @@ -683,6 +711,34 @@ struct dev_pm_opp *dev_pm_opp_find_freq_floor(struct d= evice *dev, } EXPORT_SYMBOL_GPL(dev_pm_opp_find_freq_floor); =20 +/** + * dev_pm_opp_find_freq_floor_indexed() - Search for a rounded floor freq = for the + * clock corresponding to the index + * @dev: Device for which we do this operation + * @freq: Start frequency + * @index: Clock index + * + * Search for the matching floor *available* OPP for the clock correspondi= ng to + * the specified index from a starting freq for a device. + * + * Return: matching *opp and refreshes *freq accordingly, else returns + * ERR_PTR in case of error and should be handled using IS_ERR. Error retu= rn + * 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_freq_floor_indexed(struct device *dev, unsigned long *freq, + u32 index) +{ + return _find_key_floor(dev, freq, index, true, _read_freq, NULL); +} +EXPORT_SYMBOL_GPL(dev_pm_opp_find_freq_floor_indexed); + /** * dev_pm_opp_find_level_exact() - search for an exact level * @dev: device for which we do this operation diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 3821f50b9b89..2617f2c51f29 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -125,9 +125,15 @@ struct dev_pm_opp *dev_pm_opp_find_freq_exact(struct d= evice *dev, struct dev_pm_opp *dev_pm_opp_find_freq_floor(struct device *dev, unsigned long *freq); =20 +struct dev_pm_opp *dev_pm_opp_find_freq_floor_indexed(struct device *dev, + unsigned long *freq, u32 index); + struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *dev, unsigned long *freq); =20 +struct dev_pm_opp *dev_pm_opp_find_freq_ceil_indexed(struct device *dev, + unsigned long *freq, u32 index); + struct dev_pm_opp *dev_pm_opp_find_level_exact(struct device *dev, unsigned int level); =20 @@ -261,12 +267,24 @@ static inline struct dev_pm_opp *dev_pm_opp_find_freq= _floor(struct device *dev, return ERR_PTR(-EOPNOTSUPP); } =20 +static inline struct dev_pm_opp * +dev_pm_opp_find_freq_floor_indexed(struct device *dev, unsigned long *freq= , u32 index) +{ + return ERR_PTR(-EOPNOTSUPP); +} + static inline struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *= dev, unsigned long *freq) { return ERR_PTR(-EOPNOTSUPP); } =20 +static inline struct dev_pm_opp * +dev_pm_opp_find_freq_ceil_indexed(struct device *dev, unsigned long *freq,= u32 index) +{ + return ERR_PTR(-EOPNOTSUPP); +} + static inline struct dev_pm_opp *dev_pm_opp_find_level_exact(struct device= *dev, unsigned int level) { --=20 2.31.1.272.g89b43f80a514 From nobody Sat Feb 7 17:55:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 221F3EB64DD for ; Fri, 21 Jul 2023 09:41:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230243AbjGUJld (ORCPT ); Fri, 21 Jul 2023 05:41:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230268AbjGUJlX (ORCPT ); Fri, 21 Jul 2023 05:41:23 -0400 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4760D30D6 for ; Fri, 21 Jul 2023 02:41:20 -0700 (PDT) Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-666eec46206so1551162b3a.3 for ; Fri, 21 Jul 2023 02:41:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689932480; x=1690537280; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JYBTSL0OfRqOhOs6Z05SkTlqzON3K7UIBYPi9xq4xxc=; b=h/+u+zIoZ/y1VnucGLle63jX7c+pQ7Xm0NSJwjLnLSldtrque1+JD9Y6a5Wt6PV+s8 nSh+rpgcEuhavmiPomFhpb0tgkZ9ria5aWjkvT4t/eGKlkkib3Se8yudwK9gO7HWsWso riB1rg8fd7Cn3A4auXB5333l3S1A/Wm/ucpZx74pgINzcnP4STs9BAOF0/Wx9lk5e+d/ +mOZ6lXDiummONPaFzjVBcA7Ne48ukqaWjjF9HPevN7LRV5KGvNLT9FWwCs5HFGjSxKr EPYzojBgnvifHYFzhsMhUsMRDXh5/j/snvR7jwU9b/RRxI6r0U2/XSIGuPL2z9v0xMEB OszQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689932480; x=1690537280; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JYBTSL0OfRqOhOs6Z05SkTlqzON3K7UIBYPi9xq4xxc=; b=KqoIlFE8o6reoeQi1/je7uZdN5Kg5XtSozCA0qcdkVVzNZyPypj0gSbOO0ZiZ5iBQ5 eGXg72PLek3p0ratYiHwnpbOKUtadtoJdKqBL6QOG890GM5E/00CZTUaW8/sggezV9D9 NH48/Vvav1rq7dhfuCztOoJYjUYii3lQVUyPr9uwH/y467tuh49wpyqAXUyhvwy7o/ia CIpJPl/OHilzAZGy+T0T2lnGn4L5o/mW0sZ5/7DV58+JpuDNb8zHQSpEo/U15rm9fZ9n N2V3AoGCYFD7Hv+wAICYZJlV0qD4dTydiXPk2eCKX4IrZSVWOIBcm4dXBpqdipDYo8R6 l6dg== X-Gm-Message-State: ABy/qLbrNktcuPvQLdJH8Iw77ZLmn1eIcifHtPPGYPNEfiM2mSq80kJi NnyHc1xj8wUHXD47Q/Ys41PkpQ== X-Google-Smtp-Source: APBJJlHXUu/oayiAgSCxfpwW4T9SemBsvXOG6+3NOAj1UN9MdpiDtsif4PSKpRSdjDaxkHrn6GIH5g== X-Received: by 2002:a05:6a00:2351:b0:686:24e1:d12e with SMTP id j17-20020a056a00235100b0068624e1d12emr1697924pfj.30.1689932479645; Fri, 21 Jul 2023 02:41:19 -0700 (PDT) Received: from localhost ([122.172.87.195]) by smtp.gmail.com with ESMTPSA id j26-20020a62e91a000000b00682ad247e5fsm2633899pfh.179.2023.07.21.02.41.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jul 2023 02:41:19 -0700 (PDT) From: Viresh Kumar To: Viresh Kumar , Nishanth Menon , Stephen Boyd , "Rafael J. Wysocki" Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Manivannan Sadhasivam , linux-kernel@vger.kernel.org Subject: [PATCH 3/6] OPP: Introduce dev_pm_opp_get_freq_indexed() API Date: Fri, 21 Jul 2023 15:10:56 +0530 Message-Id: <93dc0fb7d0c51908ce1a1c35bec846afa7596e65.1689932341.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Manivannan Sadhasivam In the case of devices with multiple clocks, drivers need to specify the frequency index for the OPP framework to get the specific frequency within the required OPP. So let's introduce the dev_pm_opp_get_freq_indexed() API accepting the frequency index as an argument. Signed-off-by: Manivannan Sadhasivam Signed-off-by: Viresh Kumar --- drivers/opp/core.c | 22 ++++++++++++++++++++++ include/linux/pm_opp.h | 7 +++++++ 2 files changed, 29 insertions(+) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index cb4f47b341f9..00638d40353f 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -197,6 +197,28 @@ unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *o= pp) } EXPORT_SYMBOL_GPL(dev_pm_opp_get_freq); =20 +/** + * dev_pm_opp_get_freq_indexed() - Gets the frequency corresponding to an + * available opp with specified index + * @opp: opp for which frequency has to be returned for + * @index: index of the frequency within the required opp + * + * Return: frequency in hertz corresponding to the opp with specified inde= x, + * else return 0 + */ +unsigned long dev_pm_opp_get_freq_indexed(struct dev_pm_opp *opp, u32 inde= x) +{ + struct opp_table *opp_table =3D opp->opp_table; + + if (IS_ERR_OR_NULL(opp) || index >=3D opp_table->clk_count) { + pr_err("%s: Invalid parameters\n", __func__); + return 0; + } + + return opp->rates[index]; +} +EXPORT_SYMBOL_GPL(dev_pm_opp_get_freq_indexed); + /** * dev_pm_opp_get_level() - Gets the level corresponding to an available o= pp * @opp: opp for which level value has to be returned for diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 2617f2c51f29..a13a1705df57 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -105,6 +105,8 @@ unsigned long dev_pm_opp_get_power(struct dev_pm_opp *o= pp); =20 unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp); =20 +unsigned long dev_pm_opp_get_freq_indexed(struct dev_pm_opp *opp, u32 inde= x); + unsigned int dev_pm_opp_get_level(struct dev_pm_opp *opp); =20 unsigned int dev_pm_opp_get_required_pstate(struct dev_pm_opp *opp, @@ -213,6 +215,11 @@ static inline unsigned long dev_pm_opp_get_freq(struct= dev_pm_opp *opp) return 0; } =20 +static inline unsigned long dev_pm_opp_get_freq_indexed(struct dev_pm_opp = *opp, u32 index) +{ + return 0; +} + static inline unsigned int dev_pm_opp_get_level(struct dev_pm_opp *opp) { return 0; --=20 2.31.1.272.g89b43f80a514 From nobody Sat Feb 7 17:55:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33570EB64DD for ; Fri, 21 Jul 2023 09:41:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230309AbjGUJlh (ORCPT ); Fri, 21 Jul 2023 05:41:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230443AbjGUJl2 (ORCPT ); Fri, 21 Jul 2023 05:41:28 -0400 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74A202D46 for ; Fri, 21 Jul 2023 02:41:23 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-666e3b15370so1244631b3a.0 for ; Fri, 21 Jul 2023 02:41:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689932483; x=1690537283; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Fj8dA1DktttqIwOcB9+fhQ+T0lm3kSZr4JIH2/qzqQA=; b=ppSdeh1tc7/xXjxPCMvsSLzFw8TMUJ+nxHU66ilqA2uJIXDHmUOzyl4Jhi3/j3Xxkn bfZ9i1cASnTa6Yxxl+HjKVYqZiVFA8lTf45yyrSB82n+lGi4ucYK86AjQwwnI3NAL1gc GCVmCtXOjB1m8QAo63HIFFGB6JNi4DTzyY7AYQ09GWX/PtG2JgDmxbUtMpZKYuQGUTFa IK9CQ6hNGTlmVIwjvsYyzE5+2fQpNDBZTEKESutobnEaknXcJf1MXkJsifXubACig7YY XMIfHP/45X5v3I6GkyI23Zf8bkcFIyc6ULojKi8BtpAi3D2RAYyj3SY39FOZmJEZ9VsX 0HZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689932483; x=1690537283; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Fj8dA1DktttqIwOcB9+fhQ+T0lm3kSZr4JIH2/qzqQA=; b=fHOE/4sT7AH+oT1yvAqaG3RUcEN+dK+zNQAMyV1QGjHZwrsQnlGuG9QVYcGM0HMJ5E 2HjAb2Hw1m+FJlQXbj8qDKMqlVSrCthjHb2h46mX++dc7ByiIAWE5ziJEJom05TmjsV/ GMWWz69W3yg/LRZAqXfiWQIQaviFM9qUDeJmKtcRV8n+r7Rrqa+FBIIdBlXFk7EvLxtU vegireQODcMooKA77xcrwmMZCwyu5Rg0bCy2TrvfBrCw/CPux3anvfAfwuUiovxiSysg SydUbuGKqDKeeDyad0pCJNfJF8vxPY70WudjOjsRe4aXqJXvMCs6nnhWcPrdd/3Lyuuf k+lg== X-Gm-Message-State: ABy/qLZnF1hPFFSrfq/ienRC1Szc1AboX6n6Knul1CaZDK/7b5t1YbLO +kwjjvbw/PECZH/vE6JfsYKrRg== X-Google-Smtp-Source: APBJJlE+Z+Q/a/hBNzBPrnIj9DIFZ6m3Wrxijt1nY+kqHYntfPBiUWs0s1pC4fNMKmMdjmCEHnjM1A== X-Received: by 2002:a05:6a20:b715:b0:130:661c:613d with SMTP id fg21-20020a056a20b71500b00130661c613dmr1069627pzb.5.1689932482813; Fri, 21 Jul 2023 02:41:22 -0700 (PDT) Received: from localhost ([122.172.87.195]) by smtp.gmail.com with ESMTPSA id j26-20020a62e91a000000b00682ad247e5fsm2634011pfh.179.2023.07.21.02.41.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jul 2023 02:41:22 -0700 (PDT) From: Viresh Kumar To: Viresh Kumar , Nishanth Menon , Stephen Boyd , "Rafael J. Wysocki" Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Manivannan Sadhasivam , linux-kernel@vger.kernel.org Subject: [PATCH 4/6] OPP: Add dev_pm_opp_find_freq_exact_indexed() Date: Fri, 21 Jul 2023 15:10:57 +0530 Message-Id: <852a47c0e7a795bdf6424519ab7fadfdeb5b4a3c.1689932341.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The indexed version of the API is added for other floor and ceil, add the same for exact as well for completeness. Signed-off-by: Viresh Kumar --- drivers/opp/core.c | 28 ++++++++++++++++++++++++++++ include/linux/pm_opp.h | 11 +++++++++++ 2 files changed, 39 insertions(+) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 00638d40353f..7b1d5724b3d8 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -648,6 +648,34 @@ struct dev_pm_opp *dev_pm_opp_find_freq_exact(struct d= evice *dev, } EXPORT_SYMBOL_GPL(dev_pm_opp_find_freq_exact); =20 +/** + * dev_pm_opp_find_freq_exact_indexed() - Search for an exact freq for the + * clock corresponding to the index + * @dev: Device for which we do this operation + * @freq: frequency to search for + * @index: Clock index + * @available: true/false - match for available opp + * + * Search for the matching exact OPP for the clock corresponding to the + * specified index from a starting freq for a device. + * + * Return: matching *opp , else returns ERR_PTR in case of error and shoul= d 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_freq_exact_indexed(struct device *dev, unsigned long freq, + u32 index, bool available) +{ + return _find_key_exact(dev, freq, index, available, _read_freq, NULL); +} +EXPORT_SYMBOL_GPL(dev_pm_opp_find_freq_exact_indexed); + static noinline struct dev_pm_opp *_find_freq_ceil(struct opp_table *opp_t= able, unsigned long *freq) { diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index a13a1705df57..23e4e4eaaa42 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -124,6 +124,10 @@ struct dev_pm_opp *dev_pm_opp_find_freq_exact(struct d= evice *dev, unsigned long freq, bool available); =20 +struct dev_pm_opp * +dev_pm_opp_find_freq_exact_indexed(struct device *dev, unsigned long freq, + u32 index, bool available); + struct dev_pm_opp *dev_pm_opp_find_freq_floor(struct device *dev, unsigned long *freq); =20 @@ -268,6 +272,13 @@ static inline struct dev_pm_opp *dev_pm_opp_find_freq_= exact(struct device *dev, return ERR_PTR(-EOPNOTSUPP); } =20 +static inline struct dev_pm_opp * +dev_pm_opp_find_freq_exact_indexed(struct device *dev, unsigned long freq, + u32 index, bool available) +{ + return ERR_PTR(-EOPNOTSUPP); +} + static inline struct dev_pm_opp *dev_pm_opp_find_freq_floor(struct device = *dev, unsigned long *freq) { --=20 2.31.1.272.g89b43f80a514 From nobody Sat Feb 7 17:55:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36593EB64DC for ; Fri, 21 Jul 2023 09:41:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230200AbjGUJlq (ORCPT ); Fri, 21 Jul 2023 05:41:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230219AbjGUJlb (ORCPT ); Fri, 21 Jul 2023 05:41:31 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69F8C358C for ; Fri, 21 Jul 2023 02:41:26 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1b9e9765f2cso10966845ad.3 for ; Fri, 21 Jul 2023 02:41:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689932486; x=1690537286; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ecCZasV/2WenVXDyoE4/W5g65II48G/OFEkNC6yHhK4=; b=xPO2cIrcSsEOWHLbJo/1rP2vhKK+JOYOe3Q0ys29Ek26FtDXZUte1VyFagly6pU1c6 WF0Hc8txjsBW6htA1P6/B3Et9sMJqeMDGtZ9QlhYOAW0k5v/ljmqZ3LlmkBTWsvzLqrc By+JpiGtwqO1BB5Ib/lZKA+iK5vc4vKQps36kqmDyRgmkDM7XVZPlmaHMp4SPBq1vZW9 Ohb/l6AIAQFKjXnSbvcvURLoxKgJJ+vfLtKgnhaxCdFrto/AE8sa0cyu8e0p4uqH3MCP PVOKtMgMkP+mweNRC45npmdd3bl6UkU9I1NWOWNYhrP69yPOZi6RTk00uJW2nAJQTAmH Mivg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689932486; x=1690537286; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ecCZasV/2WenVXDyoE4/W5g65II48G/OFEkNC6yHhK4=; b=FBmwScmJnebSTXofFpV8pvsqa68RnhbDkMnhXn91cu4suj9eXr/v7ZJy9dxb9ogDOM tH4MjsTf/oFmdzIx4n8lg496LRxzi15TtHYNUt+V4EjR576Qk0MUZ/VK0i05LdhVmTFy GGMIOfevc4EMD0rpkClkhRPVKz+e6BSArFdP7X3U1qrRZo6GfKWykWT+UZAJ3KUGUETc AACT1wy7Fk7O1zPYu6fRaAO07qhos3JkUUtRaa7eysZAAfaOIABf8BMIoxlx090NqQWS XCbBuRNIjHUB7lVuyHcIE3VkkqpVPXJGYKioMxSSC3TTUnCSJ5/YJtPSIbS6qRK1jrD5 te+A== X-Gm-Message-State: ABy/qLYfRWbO60IXeKJ3VD0DaPqVZ038q4FQuLFnxDPrlSlyc0smjr9+ NAv0LvWt/o4axUNc6fg8aZZ6cg== X-Google-Smtp-Source: APBJJlHSnvCG5tuyWxpXiUQIgWDsCPS3Y8Nd+m2OqCv6WoSuswjTFEEEnMT3ddbdlQ3vTCzoObeAEw== X-Received: by 2002:a17:902:ba88:b0:1b8:944a:a932 with SMTP id k8-20020a170902ba8800b001b8944aa932mr1144713pls.2.1689932485880; Fri, 21 Jul 2023 02:41:25 -0700 (PDT) Received: from localhost ([122.172.87.195]) by smtp.gmail.com with ESMTPSA id jg5-20020a17090326c500b001b9fdeead86sm2989244plb.68.2023.07.21.02.41.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jul 2023 02:41:25 -0700 (PDT) From: Viresh Kumar To: Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , "Rafael J. Wysocki" , Manivannan Sadhasivam , linux-kernel@vger.kernel.org Subject: [PATCH 5/6] OPP: Update _read_freq() to return the correct frequency Date: Fri, 21 Jul 2023 15:10:58 +0530 Message-Id: <13c3657578d0c054cfcfe4496dde560b6a816e3b.1689932341.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Now that we support finding indexed frequencies, lets update _read_freq() to return the right one. Signed-off-by: Viresh Kumar Acked-by: Manivannan Sadhasivam --- drivers/opp/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 7b1d5724b3d8..95f49fbe431c 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -472,7 +472,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_get_opp_count); /* Helpers to read keys */ static unsigned long _read_freq(struct dev_pm_opp *opp, int index) { - return opp->rates[0]; + return opp->rates[index]; } =20 static unsigned long _read_level(struct dev_pm_opp *opp, int index) --=20 2.31.1.272.g89b43f80a514 From nobody Sat Feb 7 17:55:20 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4EDF1EB64DD for ; Fri, 21 Jul 2023 09:41:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231262AbjGUJlu (ORCPT ); Fri, 21 Jul 2023 05:41:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230326AbjGUJlh (ORCPT ); Fri, 21 Jul 2023 05:41:37 -0400 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D678F30DF for ; Fri, 21 Jul 2023 02:41:29 -0700 (PDT) Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1b8ad907ba4so10602525ad.0 for ; Fri, 21 Jul 2023 02:41:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689932489; x=1690537289; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wV1Dq3qxy3owBxFZT6zTX4jA+LGfZlUCj9m2f/LMDI4=; b=PX7uG1KzgJBF9OqFkdVoGQGowY0yc8uyhhSfAf0grrqIE31HiSaobdTHh3woQlGXGl AFqxibmxcYe39UOHeBHgoboxh9JYggzuUuvt1gJCi3ouJBIdUMoF4ixPcx8eJN3OK+ki btdQ/IoO87PY9n2Su1E4ChD5X10ObsuPDki1Rx/1aBCFcdc0ZdGVGdfetwIkwd4MKWeJ bJJqDzcGmqQUmyZtwGJPIyHwHDwculDG0IBmUXRxtWgTrZCBt4aD8Bdicjs7GNHauexv CtVk4Y80Atp8Fu256ntEOo/AGfDuZyhUX4EgdG9q7xiblOoGPCtYOssK23WQuWvV/B85 uh+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689932489; x=1690537289; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wV1Dq3qxy3owBxFZT6zTX4jA+LGfZlUCj9m2f/LMDI4=; b=e7/rr6+6a3pPsqitwekgGYVAaPHPZlmIpANFQL7wlM/TIz9YGhTDQ6AZw7TzppkJAR nKQ12n8niVXvUemJxndRP0IcW6A/la/zNJNCKux+/nORCjKoDgDrXIzM1UMvaJT3N4qo CRLej4sgTYfqDNG1vV7lc2VbvyuMxUa2ssnxJ5x6ob+CVN6O0JRFuv3i7Iizj6cs7P5h SiyINEB8u6ay5QESOZFmFE2I3+VgMBuRGazx9UjUR3D5+PLGqgK8bDlieBlhcLJhUNrP GzG5zetFKqELu8FNB0jiOCSLbFNzkXH8jXCd2jSPXuhIsIbPXmyXqroq9X2NMAzWpUN5 0x9g== X-Gm-Message-State: ABy/qLZVUQGdSgOxwMCbBWtu6QyJax1np+4fJQqdgRN9yaOMs7mc86Tk s+JeNuFpv6V9CLazmGZWqoJC/g== X-Google-Smtp-Source: APBJJlFwLBVVI5u6w9IjfM/dmNtJVCNAkIhF1rY/8iqPtscxzS4IN3fls6jffvT2kO3RWDvl6CRYyw== X-Received: by 2002:a17:902:ce84:b0:1b6:ba60:77f0 with SMTP id f4-20020a170902ce8400b001b6ba6077f0mr1347697plg.10.1689932489156; Fri, 21 Jul 2023 02:41:29 -0700 (PDT) Received: from localhost ([122.172.87.195]) by smtp.gmail.com with ESMTPSA id u22-20020a170902a61600b001b2069072ccsm3005270plq.18.2023.07.21.02.41.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jul 2023 02:41:28 -0700 (PDT) From: Viresh Kumar To: Viresh Kumar , Nishanth Menon , Stephen Boyd , "Rafael J. Wysocki" Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Manivannan Sadhasivam , linux-kernel@vger.kernel.org Subject: [PATCH 6/6] OPP: Reuse dev_pm_opp_get_freq_indexed() Date: Fri, 21 Jul 2023 15:10:59 +0530 Message-Id: <5ddded46303f9d034ecb79f1fcc48abcc590f7db.1689932341.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Reuse dev_pm_opp_get_freq_indexed() from dev_pm_opp_get_freq(). Signed-off-by: Viresh Kumar Acked-by: Manivannan Sadhasivam --- drivers/opp/core.c | 21 --------------------- include/linux/pm_opp.h | 12 +++++------- 2 files changed, 5 insertions(+), 28 deletions(-) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 95f49fbe431c..16a103e6695b 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -176,27 +176,6 @@ unsigned long dev_pm_opp_get_power(struct dev_pm_opp *= opp) } EXPORT_SYMBOL_GPL(dev_pm_opp_get_power); =20 -/** - * dev_pm_opp_get_freq() - Gets the frequency corresponding to an availabl= e opp - * @opp: opp for which frequency has to be returned for - * - * Return: frequency in hertz corresponding to the opp, else - * return 0 - */ -unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp) -{ - if (IS_ERR_OR_NULL(opp)) { - pr_err("%s: Invalid parameters\n", __func__); - return 0; - } - - if (!assert_single_clk(opp->opp_table)) - return 0; - - return opp->rates[0]; -} -EXPORT_SYMBOL_GPL(dev_pm_opp_get_freq); - /** * dev_pm_opp_get_freq_indexed() - Gets the frequency corresponding to an * available opp with specified index diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 23e4e4eaaa42..91f87d7e807c 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -103,8 +103,6 @@ int dev_pm_opp_get_supplies(struct dev_pm_opp *opp, str= uct dev_pm_opp_supply *su =20 unsigned long dev_pm_opp_get_power(struct dev_pm_opp *opp); =20 -unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp); - unsigned long dev_pm_opp_get_freq_indexed(struct dev_pm_opp *opp, u32 inde= x); =20 unsigned int dev_pm_opp_get_level(struct dev_pm_opp *opp); @@ -214,11 +212,6 @@ static inline unsigned long dev_pm_opp_get_power(struc= t dev_pm_opp *opp) return 0; } =20 -static inline unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp) -{ - return 0; -} - static inline unsigned long dev_pm_opp_get_freq_indexed(struct dev_pm_opp = *opp, u32 index) { return 0; @@ -669,4 +662,9 @@ static inline void dev_pm_opp_put_prop_name(int token) dev_pm_opp_clear_config(token); } =20 +static inline unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp) +{ + return dev_pm_opp_get_freq_indexed(opp, 0); +} + #endif /* __LINUX_OPP_H__ */ --=20 2.31.1.272.g89b43f80a514