From nobody Thu Apr 9 06:18:05 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 49AB8C43217 for ; Thu, 3 Nov 2022 11:01:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231394AbiKCLBo (ORCPT ); Thu, 3 Nov 2022 07:01:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231355AbiKCLBa (ORCPT ); Thu, 3 Nov 2022 07:01:30 -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 F3743BE0A for ; Thu, 3 Nov 2022 04:01:27 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id g62so1237072pfb.10 for ; Thu, 03 Nov 2022 04:01:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=rdlSJiSDdFVNFGf7aj1iVzyqCpSjnjyK7zZt5V+eoFk=; b=UAmCLml2yroJcnFXFQvvkzy2aNsqlmSGQS5t8dAlzArMlFBKaJvBqOYgjVuzPCG/bE L2WuZiDJamaQQHF2ZtSeEUW7/i0igpivEDO/H0L4WEvA96KyIp4Ir6RN5mH65cTc+2M7 uSNZPqD1dPevSMC1cs4iZuhIbno4Gm1Rqm0SPA93wu+ObgvakF0ME6NX0J9HsYvsCZvF gYm49A8S1d6ELns4/t72kFySs2bKD4wSQcIFa2W4uAii1H6TKDUFwRr3OI63qafeKe4t 1/WNmtSiTXdFO7DIb5EO1TUOV4ctgbAKuGeVs62PKSYpI4fPzdnAVRZR26VNUsmsW+eI RMcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=rdlSJiSDdFVNFGf7aj1iVzyqCpSjnjyK7zZt5V+eoFk=; b=W2r/71qAsUwW6QwRQglHv0UJVSmy6mFthXDS/BW7btkGd9lsZbBij8+wTgPkHUAoiX k4kcvliKX1ZnN1XyiZn9oSLw2tsUgg8g5ZIUCqM1g/19P3hSs29ONfQUEdFgggFsxnzu F1zWkOhXfORxn3GIxrQ0EbCYq+mWyMPeM/GJo4voqhokJkuXw2G7SftwiMnsjP3W1AGT P9EbfAzwTIWRPvyr+pwIBLMofNAvedERFrHkrnpl4Fk7X96oKqe0KdzmccowqwYr/3ZZ LfQqCCaI83VI5H7S+4sru4y8R3PNdygXNvXE64RZkqi9AfHHz2tyoFrvk1H2OBa6W9LR BJRg== X-Gm-Message-State: ACrzQf04aI0gpdnS5slXBd3FmwRXQzxtLvjpoK9R/6s5AXEbSv04e53P 80Bng5gslIkac0t2iKGVwXvGyw== X-Google-Smtp-Source: AMsMyM5Tmy8uLzzWKsj3p8zB/Bu8mxxZ/K6C/aTTqngKlL9AKMx2cTWBUah3RAb1oXK+BGWrxzA2qQ== X-Received: by 2002:a05:6a00:140f:b0:56e:1190:e731 with SMTP id l15-20020a056a00140f00b0056e1190e731mr7920554pfu.39.1667473287402; Thu, 03 Nov 2022 04:01:27 -0700 (PDT) Received: from localhost ([122.172.84.80]) by smtp.gmail.com with ESMTPSA id gm22-20020a17090b101600b002132f3e71c6sm684726pjb.52.2022.11.03.04.01.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Nov 2022 04:01:22 -0700 (PDT) From: Viresh Kumar To: James Calligeros , Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , "Rafael J. Wysocki" , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/5] dt-bindings: opp: Fix usage of current in microwatt property Date: Thu, 3 Nov 2022 16:31:04 +0530 Message-Id: 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 bindings mentions "current" instead of "power". Fix it. Signed-off-by: Viresh Kumar --- Documentation/devicetree/bindings/opp/opp-v2-base.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/opp/opp-v2-base.yaml b/Docum= entation/devicetree/bindings/opp/opp-v2-base.yaml index 66d0ec763f0b..cb025b0a346d 100644 --- a/Documentation/devicetree/bindings/opp/opp-v2-base.yaml +++ b/Documentation/devicetree/bindings/opp/opp-v2-base.yaml @@ -108,7 +108,7 @@ select: false The power for the OPP in micro-Watts. =20 Entries for multiple regulators shall be provided in the same fi= eld - separated by angular brackets <>. If current values aren't requi= red + separated by angular brackets <>. If power values aren't required for a regulator, then it shall be filled with 0. If power values aren't required for any of the regulators, then this field is not required. The OPP binding doesn't provide any provisions to rela= te the --=20 2.31.1.272.g89b43f80a514 From nobody Thu Apr 9 06:18:05 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 50413C4332F for ; Thu, 3 Nov 2022 11:01:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231378AbiKCLBr (ORCPT ); Thu, 3 Nov 2022 07:01:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231406AbiKCLBc (ORCPT ); Thu, 3 Nov 2022 07:01:32 -0400 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECF1111469 for ; Thu, 3 Nov 2022 04:01:31 -0700 (PDT) Received: by mail-pf1-x436.google.com with SMTP id y13so1247703pfp.7 for ; Thu, 03 Nov 2022 04:01:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=E6BayU7+whKMo3/qWo30Lf+/AWFHgaDluxjQcRS3B+I=; b=zBFjYYnEhLeXIdKyW1HwYfCDZkwamdYAyCaULgx22W6EDH2VciVt6JBdjuhARELL7Z B6TRmjSnBhSjw1uHc1PgyjAgbZqRJCo/5A1nWb5bHfG6WOF/WuQVA4HTv7b0a2xLswx1 HYopKypv+/vT4/DxU0fHpK1pQNpu1pB7+3PElCF168ELSPW39BWfKleEHxSU9J0Fy7KB YvV1ZlHt3T1RcAuYWKU57QZY6hn+uM3jd72mlvRAKS7NYweoyk951Iy2kJIO03mAzs65 VNKwiTb/seEZcw+57WkozNYEn0gMa3GDAhUC+tFjhSNTyu07QiIx4cWUWLhKftY/l7dd FQfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=E6BayU7+whKMo3/qWo30Lf+/AWFHgaDluxjQcRS3B+I=; b=vh17+ZasM9fXhXWO6jQWcz1mn7SnJYUcyY6vLDqkdDIE0EYTjzAXzvUOYp5LjtoZbd PISif2w/8PJPCZEYl+J0HUgOnbckGgCZuuyIjZd3wehFsL1FiIhXoN8qSXaDPRT+65zO sQ9I7K6UvoD4HgqcT+3x0MDhmtZQ2hESWNb8Bq2kCheNNus5swjSJNLzC+VhjDS2oOrw OU7rnMOl4yxCEYomTqvzqsLca58amWlw7wa6Xd4LOW9gKawcvNemktKRw7eEX639p2W5 cjR+jI3pK8ymSMzcnRYEwHPjr0miOK02n/GSffug0KusF7zoUEDgHO9/Yav1phmqWb02 IAfg== X-Gm-Message-State: ACrzQf1qm4pVgsEPtqtovPFyXRuyhIfkWUmNHGW/29a38nidmEblf6L+ QzzHCh+cz4KxPObyYX40XHmuWw== X-Google-Smtp-Source: AMsMyM4HjVW6bkRyhyG5xTtXGuUSaciInOBhBw7kerR3KeoO2GrpLemNgw+shfbnxFL628VqHpEE9g== X-Received: by 2002:a63:3347:0:b0:470:1a94:4bf with SMTP id z68-20020a633347000000b004701a9404bfmr3864142pgz.374.1667473291406; Thu, 03 Nov 2022 04:01:31 -0700 (PDT) Received: from localhost ([122.172.84.80]) by smtp.gmail.com with ESMTPSA id f3-20020a170902f38300b0016c50179b1esm355601ple.152.2022.11.03.04.01.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Nov 2022 04:01:30 -0700 (PDT) From: Viresh Kumar To: James Calligeros , Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , "Rafael J. Wysocki" , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/5] dt-bindings: opp: Fix named microwatt property Date: Thu, 3 Nov 2022 16:31:05 +0530 Message-Id: <52bfa57ae698da9881e8a9302473e87f5757d5b6.1667473008.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 named microwatt- property should look exactly like microvolt and microamp properties. There were some differences, fix them. Signed-off-by: Viresh Kumar --- Documentation/devicetree/bindings/opp/opp-v2-base.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/opp/opp-v2-base.yaml b/Docum= entation/devicetree/bindings/opp/opp-v2-base.yaml index cb025b0a346d..cf9c2f7bddc2 100644 --- a/Documentation/devicetree/bindings/opp/opp-v2-base.yaml +++ b/Documentation/devicetree/bindings/opp/opp-v2-base.yaml @@ -230,9 +230,9 @@ select: false minItems: 1 maxItems: 8 # Should be enough regulators =20 - '^opp-microwatt': + '^opp-microwatt-': description: - Named opp-microwatt property. Similar to opp-microamp property, + Named opp-microwatt property. Similar to opp-microamp- pro= perty, but for microwatt instead. $ref: /schemas/types.yaml#/definitions/uint32-array minItems: 1 --=20 2.31.1.272.g89b43f80a514 From nobody Thu Apr 9 06:18:05 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 6F321C43217 for ; Thu, 3 Nov 2022 11:01:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231428AbiKCLBu (ORCPT ); Thu, 3 Nov 2022 07:01:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231375AbiKCLBh (ORCPT ); Thu, 3 Nov 2022 07:01:37 -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 75A36B7EB for ; Thu, 3 Nov 2022 04:01:36 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id l2so1531491pld.13 for ; Thu, 03 Nov 2022 04:01:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=CUlxdNeoLlpwqgvI1vJN7b1g7ZmITiL31RBfTgzzy+4=; b=XJqmPRwvw+FN/EEePw4qaKUzYroDLu2G9Z6BA7HPgsLyBuvWmXKCSGvjHrIuOEIARG uLbAxrwgIuW4C5fAjPdhLpEMEd99EaT457UbyTI8jBNoVJv6ZVLJnMKPnFxE94t0pcCL ir0xmdfgQ/FjROoq+EP+b2wH+9gP6VhFXEjgdgSxIout3u2ddUFIXPyJL8HVuA+JcCEc AGD/OxvZS1hTK32WR0qll0Hdq/35CG2SO78CgHKA9m/Xi8/d69FtbaYQvyZsPFGyGHTi 0LG17JB/H9gightd066xVQsKspk0uBv9QvMyjhnSLn1vEY/pM4WshA9PVhP4R62yNHhJ 5Vsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=CUlxdNeoLlpwqgvI1vJN7b1g7ZmITiL31RBfTgzzy+4=; b=qro1cS37YmNQONg53IsS5UMbWhxwEuwIJagsLGvRtQyV67s7EpSVOPajdOrEAe6WSO djqUd/dkCcDV1r+bYMCujW7FJZVw1TEq1eRsxLdyLUtAD0sLp9U4hgaMjJfOTpXfgaUK Iaxf6BJRuNW9N9iYvyIvbKCFu1WNeTwMQn9yfbGKD9bFlLLsFClWZ/OqUOz4N1KiS3FR KceH4RoXviKeOwT4tflpcDox+9Eq8oWxssrLZNAmR3NmCV7wUOpe7/x8r6Fr/5K8qsFo GmnvxhH5eGCfxfkqZ5CYus589UEOP+Avpm5vAZOCREp24idQeORbVfQBN+j7vUdotK6V rB+Q== X-Gm-Message-State: ACrzQf0v7FH+6W6rgFQFKb4xtyGt38kx6ngvYyUtN5Y8vJK3JB2hC0/V ucqOz21SUntRw0gNzdKsvvfI1g== X-Google-Smtp-Source: AMsMyM7+o44INWslrGpI+jefjbcGs9mWsqvc/VDaW4kwMbJEnEDqYNM+dVUGYoQeRY7M6xLcvREWxQ== X-Received: by 2002:a17:90a:d084:b0:213:8cf1:4d34 with SMTP id k4-20020a17090ad08400b002138cf14d34mr31351688pju.150.1667473295998; Thu, 03 Nov 2022 04:01:35 -0700 (PDT) Received: from localhost ([122.172.84.80]) by smtp.gmail.com with ESMTPSA id s2-20020a170902b18200b001871acf245csm391281plr.37.2022.11.03.04.01.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Nov 2022 04:01:35 -0700 (PDT) From: Viresh Kumar To: James Calligeros , Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org Subject: [PATCH 3/5] OPP: Parse named opp-microwatt property too Date: Thu, 3 Nov 2022 16:31:06 +0530 Message-Id: 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" We missed parsing the named opp-microwatt- property, fix that. Signed-off-by: Viresh Kumar --- drivers/opp/of.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/opp/of.c b/drivers/opp/of.c index 605d68673f92..e010e119c42b 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -695,9 +695,19 @@ static int opp_parse_supplies(struct dev_pm_opp *opp, = struct device *dev, } } =20 - /* Search for "opp-microwatt" */ - sprintf(name, "opp-microwatt"); - prop =3D of_find_property(opp->np, name, NULL); + /* Search for "opp-microwatt-" */ + prop =3D NULL; + if (opp_table->prop_name) { + snprintf(name, sizeof(name), "opp-microwatt-%s", + opp_table->prop_name); + prop =3D of_find_property(opp->np, name, NULL); + } + + if (!prop) { + /* Search for "opp-microwatt" */ + sprintf(name, "opp-microwatt"); + prop =3D of_find_property(opp->np, name, NULL); + } =20 if (prop) { pcount =3D of_property_count_u32_elems(opp->np, name); --=20 2.31.1.272.g89b43f80a514 From nobody Thu Apr 9 06:18:05 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 A16EBC4332F for ; Thu, 3 Nov 2022 11:02:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230510AbiKCLB6 (ORCPT ); Thu, 3 Nov 2022 07:01:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231316AbiKCLBl (ORCPT ); Thu, 3 Nov 2022 07:01:41 -0400 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E307B7FD for ; Thu, 3 Nov 2022 04:01:40 -0700 (PDT) Received: by mail-pf1-x433.google.com with SMTP id d10so1248395pfh.6 for ; Thu, 03 Nov 2022 04:01:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=jKnEZG0ef1w3+ZtyBo/x5Fjh/UyIelJHnysoJI3A1/8=; b=M/k9L/GATSz3t4hC6JTpBUGIjCJJ+L5qRie3ARsFP0YAVMwwS8hJcprzYnjHgBiZFC JQsycKDKpqWj8grx1dC5NEnjUIk2Sc4Nh3jWiqN8/ECXYdWtTAaKHZo0qV2rKIek12Xw 2TVsLH4Cz4GmkwcJSrR59QhTA1KmNdS1Hw2fx2ZHK9H+yr3QfkFuQO9DL47np6DRic4g Un5TVyF+TMYrtZWrYQ8QvE16ARmZMQV7rFI0AUa/2h+CxzLhQIiulGBW1W3ced9RNGCD dG++DjXtkjNM4EfSy61SpEIHefsrFsX67Swfdbwko9yf3HirK83PtIZ3o7uSCPnQ2hEn tm8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=jKnEZG0ef1w3+ZtyBo/x5Fjh/UyIelJHnysoJI3A1/8=; b=P9V/x/CWeyEL2gg+ZD2R6S/1BtnIcMZaB+vuOz494y3hitDD4phEFt4r006ylrmmap m8D3zX8i9JkPXzNtTBMxc1YpQB/QiPnKhddLxjgFnUk7ke6q0U8SoNvsRwzD+IFPSpHj IFoVnwYc5kirE6YiNUYNluFOMjgsZSZATFxudxddMSN/7gzHC+18ZjYqcnFCrAtSlTal 26h0MSg5T9A/H3vC3rnrCiN4/1m+E+mvKn5N8jKceWlxyLzEBhq5rCa+6hxQ63t+LUiv AQRdfa510HJmcNhv6y/UvIEjmRv/lO4801fSv9P/6mlDw/r1LUhQ/y/9pei0A7JZ3tuE 85pQ== X-Gm-Message-State: ACrzQf0pKIB4beG7NJHNahXMnihFxFKBgtbGuGZuwjATtIH37Hfk7B35 sj4GH8XQmBpEdaZByotB80xg0g== X-Google-Smtp-Source: AMsMyM4dVhJX1yGhZhr6WzIziWnaGlZDw/A/iObTpehlPp5zHnq37z035BHCsoaJg+MsELfh+4zvqg== X-Received: by 2002:a63:106:0:b0:460:64ce:51c4 with SMTP id 6-20020a630106000000b0046064ce51c4mr25372692pgb.17.1667473299580; Thu, 03 Nov 2022 04:01:39 -0700 (PDT) Received: from localhost ([122.172.84.80]) by smtp.gmail.com with ESMTPSA id o9-20020a17090ab88900b0020d39ffe987sm699759pjr.50.2022.11.03.04.01.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Nov 2022 04:01:39 -0700 (PDT) From: Viresh Kumar To: James Calligeros , Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org Subject: [PATCH 4/5] OPP: Simplify opp_parse_supplies() by restructuring it Date: Thu, 3 Nov 2022 16:31:07 +0530 Message-Id: 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" opp_parse_supplies() has grown into too big of a routine (~190 lines) and it is not straight-forward to understand it anymore. Break it into smaller routines and reduce code redundancy a bit by using the same code to parse properties. This shouldn't result in any logical changes. Signed-off-by: Viresh Kumar --- drivers/opp/of.c | 216 ++++++++++++++++++----------------------------- 1 file changed, 81 insertions(+), 135 deletions(-) diff --git a/drivers/opp/of.c b/drivers/opp/of.c index e010e119c42b..e51c43495e21 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -578,179 +578,126 @@ static bool _opp_is_supported(struct device *dev, s= truct opp_table *opp_table, return false; } =20 -static int opp_parse_supplies(struct dev_pm_opp *opp, struct device *dev, - struct opp_table *opp_table) +static u32 *_parse_named_prop(struct dev_pm_opp *opp, struct device *dev, + struct opp_table *opp_table, + const char *prop_type, bool *triplet) { - u32 *microvolt, *microamp =3D NULL, *microwatt =3D NULL; - int supplies =3D opp_table->regulator_count; - int vcount, icount, pcount, ret, i, j; struct property *prop =3D NULL; char name[NAME_MAX]; + int count, ret; + u32 *out; =20 - /* Search for "opp-microvolt-" */ + /* Search for "opp--" */ if (opp_table->prop_name) { - snprintf(name, sizeof(name), "opp-microvolt-%s", + snprintf(name, sizeof(name), "opp-%s-%s", prop_type, opp_table->prop_name); prop =3D of_find_property(opp->np, name, NULL); } =20 if (!prop) { - /* Search for "opp-microvolt" */ - sprintf(name, "opp-microvolt"); + /* Search for "opp-" */ + snprintf(name, sizeof(name), "opp-%s", prop_type); prop =3D of_find_property(opp->np, name, NULL); - - /* Missing property isn't a problem, but an invalid entry is */ - if (!prop) { - if (unlikely(supplies =3D=3D -1)) { - /* Initialize regulator_count */ - opp_table->regulator_count =3D 0; - return 0; - } - - if (!supplies) - return 0; - - dev_err(dev, "%s: opp-microvolt missing although OPP managing regulator= s\n", - __func__); - return -EINVAL; - } - } - - if (unlikely(supplies =3D=3D -1)) { - /* Initialize regulator_count */ - supplies =3D opp_table->regulator_count =3D 1; - } else if (unlikely(!supplies)) { - dev_err(dev, "%s: opp-microvolt wasn't expected\n", __func__); - return -EINVAL; + if (!prop) + return NULL; } =20 - vcount =3D of_property_count_u32_elems(opp->np, name); - if (vcount < 0) { - dev_err(dev, "%s: Invalid %s property (%d)\n", - __func__, name, vcount); - return vcount; + count =3D of_property_count_u32_elems(opp->np, name); + if (count < 0) { + dev_err(dev, "%s: Invalid %s property (%d)\n", __func__, name, + count); + return ERR_PTR(count); } =20 - /* There can be one or three elements per supply */ - if (vcount !=3D supplies && vcount !=3D supplies * 3) { - dev_err(dev, "%s: Invalid number of elements in %s property (%d) with su= pplies (%d)\n", - __func__, name, vcount, supplies); - return -EINVAL; + /* + * Initialize regulator_count, if regulator information isn't provided + * by the platform. Now that one of the properties is available, fix the + * regulator_count to 1. + */ + if (unlikely(opp_table->regulator_count =3D=3D -1)) + opp_table->regulator_count =3D 1; + + if (count !=3D opp_table->regulator_count && + (!triplet || count !=3D opp_table->regulator_count * 3)) { + dev_err(dev, "%s: Invalid number of elements in %s property (%u) with su= pplies (%d)\n", + __func__, prop_type, count, opp_table->regulator_count); + return ERR_PTR(-EINVAL); } =20 - microvolt =3D kmalloc_array(vcount, sizeof(*microvolt), GFP_KERNEL); - if (!microvolt) - return -ENOMEM; + out =3D kmalloc_array(count, sizeof(*out), GFP_KERNEL); + if (!out) + return ERR_PTR(-EINVAL); =20 - ret =3D of_property_read_u32_array(opp->np, name, microvolt, vcount); + ret =3D of_property_read_u32_array(opp->np, name, out, count); if (ret) { dev_err(dev, "%s: error parsing %s: %d\n", __func__, name, ret); - ret =3D -EINVAL; - goto free_microvolt; + kfree(out); + return ERR_PTR(-EINVAL); } =20 - /* Search for "opp-microamp-" */ - prop =3D NULL; - if (opp_table->prop_name) { - snprintf(name, sizeof(name), "opp-microamp-%s", - opp_table->prop_name); - prop =3D of_find_property(opp->np, name, NULL); - } + if (triplet) + *triplet =3D count !=3D opp_table->regulator_count; =20 - if (!prop) { - /* Search for "opp-microamp" */ - sprintf(name, "opp-microamp"); - prop =3D of_find_property(opp->np, name, NULL); - } - - if (prop) { - icount =3D of_property_count_u32_elems(opp->np, name); - if (icount < 0) { - dev_err(dev, "%s: Invalid %s property (%d)\n", __func__, - name, icount); - ret =3D icount; - goto free_microvolt; - } + return out; +} =20 - if (icount !=3D supplies) { - dev_err(dev, "%s: Invalid number of elements in %s property (%d) with s= upplies (%d)\n", - __func__, name, icount, supplies); - ret =3D -EINVAL; - goto free_microvolt; - } +static u32 *opp_parse_microvolt(struct dev_pm_opp *opp, struct device *dev, + struct opp_table *opp_table, bool *triplet) +{ + u32 *microvolt; =20 - microamp =3D kmalloc_array(icount, sizeof(*microamp), GFP_KERNEL); - if (!microamp) { - ret =3D -EINVAL; - goto free_microvolt; - } + microvolt =3D _parse_named_prop(opp, dev, opp_table, "microvolt", triplet= ); + if (IS_ERR(microvolt)) + return microvolt; =20 - ret =3D of_property_read_u32_array(opp->np, name, microamp, - icount); - if (ret) { - dev_err(dev, "%s: error parsing %s: %d\n", __func__, - name, ret); - ret =3D -EINVAL; - goto free_microamp; + if (!microvolt) { + /* + * Missing property isn't a problem, but an invalid + * entry is. This property isn't optional if regulator + * information is provided. + */ + if (opp_table->regulator_count > 0) { + dev_err(dev, "%s: opp-microvolt missing although OPP managing regulator= s\n", + __func__); + return ERR_PTR(-EINVAL); } } =20 - /* Search for "opp-microwatt-" */ - prop =3D NULL; - if (opp_table->prop_name) { - snprintf(name, sizeof(name), "opp-microwatt-%s", - opp_table->prop_name); - prop =3D of_find_property(opp->np, name, NULL); - } - - if (!prop) { - /* Search for "opp-microwatt" */ - sprintf(name, "opp-microwatt"); - prop =3D of_find_property(opp->np, name, NULL); - } + return microvolt; +} =20 - if (prop) { - pcount =3D of_property_count_u32_elems(opp->np, name); - if (pcount < 0) { - dev_err(dev, "%s: Invalid %s property (%d)\n", __func__, - name, pcount); - ret =3D pcount; - goto free_microamp; - } +static int opp_parse_supplies(struct dev_pm_opp *opp, struct device *dev, + struct opp_table *opp_table) +{ + u32 *microvolt, *microamp, *microwatt; + int ret, i, j; + bool triplet; =20 - if (pcount !=3D supplies) { - dev_err(dev, "%s: Invalid number of elements in %s property (%d) with s= upplies (%d)\n", - __func__, name, pcount, supplies); - ret =3D -EINVAL; - goto free_microamp; - } + microvolt =3D opp_parse_microvolt(opp, dev, opp_table, &triplet); + if (IS_ERR_OR_NULL(microvolt)) + return PTR_ERR(microvolt); =20 - microwatt =3D kmalloc_array(pcount, sizeof(*microwatt), - GFP_KERNEL); - if (!microwatt) { - ret =3D -EINVAL; - goto free_microamp; - } + microamp =3D _parse_named_prop(opp, dev, opp_table, "microamp", NULL); + if (IS_ERR(microamp)) { + ret =3D PTR_ERR(microamp); + goto free_microvolt; + } =20 - ret =3D of_property_read_u32_array(opp->np, name, microwatt, - pcount); - if (ret) { - dev_err(dev, "%s: error parsing %s: %d\n", __func__, - name, ret); - ret =3D -EINVAL; - goto free_microwatt; - } + microwatt =3D _parse_named_prop(opp, dev, opp_table, "microwatt", NULL); + if (IS_ERR(microwatt)) { + ret =3D PTR_ERR(microwatt); + goto free_microamp; } =20 - for (i =3D 0, j =3D 0; i < supplies; i++) { + for (i =3D 0, j =3D 0; i < opp_table->regulator_count; i++) { opp->supplies[i].u_volt =3D microvolt[j++]; =20 - if (vcount =3D=3D supplies) { - opp->supplies[i].u_volt_min =3D opp->supplies[i].u_volt; - opp->supplies[i].u_volt_max =3D opp->supplies[i].u_volt; - } else { + if (triplet) { opp->supplies[i].u_volt_min =3D microvolt[j++]; opp->supplies[i].u_volt_max =3D microvolt[j++]; + } else { + opp->supplies[i].u_volt_min =3D opp->supplies[i].u_volt; + opp->supplies[i].u_volt_max =3D opp->supplies[i].u_volt; } =20 if (microamp) @@ -760,7 +707,6 @@ static int opp_parse_supplies(struct dev_pm_opp *opp, s= truct device *dev, opp->supplies[i].u_watt =3D microwatt[i]; } =20 -free_microwatt: kfree(microwatt); free_microamp: kfree(microamp); --=20 2.31.1.272.g89b43f80a514 From nobody Thu Apr 9 06:18:05 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 1AD0BC4332F for ; Thu, 3 Nov 2022 11:02:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229501AbiKCLCW (ORCPT ); Thu, 3 Nov 2022 07:02:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231415AbiKCLCB (ORCPT ); Thu, 3 Nov 2022 07:02:01 -0400 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38B861146D for ; Thu, 3 Nov 2022 04:01:55 -0700 (PDT) Received: by mail-pl1-x633.google.com with SMTP id 4so1610731pli.0 for ; Thu, 03 Nov 2022 04:01:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=fsmUR9VBjzdfb/PGMg0vmzjLCq4QjfuLi4iPrW87qL0=; b=GHinC0PrjwVZKhYfmM8nt17mNc2XQ9VSl2eWqe4GgpapVAog+Tw41GRAzFQDLdwSfh 3U27PBnVZm8Z31LLeWf798nvm6I8hmccO+gZsY8kqIMjeRMuE6yovKGZTftmyFWoNXMx nQX/kahB2mbF7pom1+RpekbBuhWNpUUy/17bBbYAvjDZPAp5bqtFuWwQ7ii4/apHMqQ+ v5qdpSlzR0b4MQuhEkxaKojApu8ykXPymUmAb63meFdW3KxBXuYS4SBRtkmJIs4YHBrR jeSy+UfYb4f/uBYwd9A/FslWy97JajxeHtcU1FLdd60oolyMEa/NwIYdHCCx5TozlFZ4 C/2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=fsmUR9VBjzdfb/PGMg0vmzjLCq4QjfuLi4iPrW87qL0=; b=L+UF2fcBiBxURJs2w8a4wnkJB/fGZg3nlCLVzolu6gsb8umoizaUxg4mjcVV+JEl4n iM6PMFHT7IEgt/ijLVV4j+iy2gBIQJcFf2sqGYqnB8r4q1k67HZMtVfFcfvvoq5GVTG1 ZBZE9kDv6F4lKNodki3QKwQD3wLt8aiwGFAnAyicGtSqjAbDv/6/sBkc/KGeG8JN9ind v299bEL17PFMFX47+cbLLmCAQDOHRkUWYx3G67s3X15RVZ0UBLkRbRNud1zhfAjLfGuI xPCLqQymk2o6zi1mUl4IsgMVXUMDKbozoenJHTVqlCvYWAObIdfWusIo5fbYYcnDY2aP 1eVA== X-Gm-Message-State: ACrzQf14f4ca7TnIb+lpvp5lI3bnFZLCkUD7ZLq4TO6TMZopGiCEvPyT TMV86WVRo8wIz55GqHB0PyNjfQ== X-Google-Smtp-Source: AMsMyM6XSKlbSK0JuqjYQIz/h/+VQHH4mk0vaC5SsBya5JFSTXHYTK4fF7hmoELCXp9bmqBQJsmNNw== X-Received: by 2002:a17:90b:3690:b0:213:c985:b5ee with SMTP id mj16-20020a17090b369000b00213c985b5eemr25247343pjb.192.1667473314641; Thu, 03 Nov 2022 04:01:54 -0700 (PDT) Received: from localhost ([122.172.84.80]) by smtp.gmail.com with ESMTPSA id b33-20020a630c21000000b00461b85e5ad6sm560176pgl.19.2022.11.03.04.01.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Nov 2022 04:01:43 -0700 (PDT) From: Viresh Kumar To: James Calligeros , Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org Subject: [PATCH V2 5/5] OPP: decouple dt properties in opp_parse_supplies() Date: Thu, 3 Nov 2022 16:31:08 +0530 Message-Id: <5acd93462bff6c108d65802fd39f6002dfadd1a0.1667473008.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: James Calligeros The opp-microwatt property was added with the intention of providing platforms a way to specify a precise value for the power consumption of a device at a given OPP to enable better energy-aware scheduling decisions by informing the kernel of the total static and dynamic power of a device at a given OPP, removing the reliance on the EM subsystem's often flawed estimations. This property is parsed by opp_parse_supplies(), which creates a hard dependency on the opp-microvolt property. Some platforms, such as Apple Silicon, do not describe their device's voltage regulators in the DT as they cannot be controlled by the kernel and/or rely on opaque firmware algorithms to control their voltage and current characteristics at runtime. We can, however, experimentally determine the power consumption of a given device at a given OPP, taking advantage of opp-microwatt to provide EAS on such devices as was initially intended. Allow platforms to specify and consume any subset of opp-microvolt, opp-microamp, or opp-microwatt without a hard dependency on opp-microvolt to enable this functionality on such platforms. Signed-off-by: James Calligeros Co-developed-by: Viresh Kumar Signed-off-by: Viresh Kumar Tested-by: James Calligeros --- V2: Rewritten by Viresh on top of his changes. drivers/opp/of.c | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/drivers/opp/of.c b/drivers/opp/of.c index e51c43495e21..273fa9c0e1c0 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -654,9 +654,12 @@ static u32 *opp_parse_microvolt(struct dev_pm_opp *opp= , struct device *dev, /* * Missing property isn't a problem, but an invalid * entry is. This property isn't optional if regulator - * information is provided. + * information is provided. Check only for the first OPP, as + * regulator_count may get initialized after that to a valid + * value. */ - if (opp_table->regulator_count > 0) { + if (list_empty(&opp_table->opp_list) && + opp_table->regulator_count > 0) { dev_err(dev, "%s: opp-microvolt missing although OPP managing regulator= s\n", __func__); return ERR_PTR(-EINVAL); @@ -674,7 +677,7 @@ static int opp_parse_supplies(struct dev_pm_opp *opp, s= truct device *dev, bool triplet; =20 microvolt =3D opp_parse_microvolt(opp, dev, opp_table, &triplet); - if (IS_ERR_OR_NULL(microvolt)) + if (IS_ERR(microvolt)) return PTR_ERR(microvolt); =20 microamp =3D _parse_named_prop(opp, dev, opp_table, "microamp", NULL); @@ -689,15 +692,26 @@ static int opp_parse_supplies(struct dev_pm_opp *opp,= struct device *dev, goto free_microamp; } =20 - for (i =3D 0, j =3D 0; i < opp_table->regulator_count; i++) { - opp->supplies[i].u_volt =3D microvolt[j++]; + /* + * Initialize regulator_count if it is uninitialized and no properties + * are found. + */ + if (unlikely(opp_table->regulator_count =3D=3D -1)) { + opp_table->regulator_count =3D 0; + return 0; + } =20 - if (triplet) { - opp->supplies[i].u_volt_min =3D microvolt[j++]; - opp->supplies[i].u_volt_max =3D microvolt[j++]; - } else { - opp->supplies[i].u_volt_min =3D opp->supplies[i].u_volt; - opp->supplies[i].u_volt_max =3D opp->supplies[i].u_volt; + for (i =3D 0, j =3D 0; i < opp_table->regulator_count; i++) { + if (microvolt) { + opp->supplies[i].u_volt =3D microvolt[j++]; + + if (triplet) { + opp->supplies[i].u_volt_min =3D microvolt[j++]; + opp->supplies[i].u_volt_max =3D microvolt[j++]; + } else { + opp->supplies[i].u_volt_min =3D opp->supplies[i].u_volt; + opp->supplies[i].u_volt_max =3D opp->supplies[i].u_volt; + } } =20 if (microamp) --=20 2.31.1.272.g89b43f80a514