From patchwork Thu Nov 3 11:01:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 14816 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp458756wru; Thu, 3 Nov 2022 04:08:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5vcDXeHXCWEx6Xmcr9pq4J/1OuLF/2sNQc0YYRl8tW4RgaCDqXqcUs58ogMkTMuRMlmlVL X-Received: by 2002:a63:450b:0:b0:46f:6321:1e2c with SMTP id s11-20020a63450b000000b0046f63211e2cmr26034380pga.390.1667473688792; Thu, 03 Nov 2022 04:08:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667473688; cv=none; d=google.com; s=arc-20160816; b=CS2l6Jn3DL9z30LTrvhw2hAtomKALGwoXzsr+lja0b/Z0cs/oaNI/gXxEDHLSHiEiL sKOfrEEZSh4hRdooUC+Xnx2K3TCBG5j0mCd1IhAsOie15HFxU6uahXWCWj/qTHDMtDr/ 5vymyBLGcKyzazTL4PG5CJZG/RvUNFP/ohGAL9AHdvkt66V2CPH0tTLhuyFkhDsyxC2P VM3NWN5NI4lqjGX5pg591Xt8MgEcW5PD/87PlrTiwbubYhgyRVxupl64eo/dkPyfBB62 Ufc2MivykPWd3GGDzc2VOM2An7jFzzdjW++PLW1DXDGzZ4bHABR1nd8zGot1zutadIyi HEGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=rdlSJiSDdFVNFGf7aj1iVzyqCpSjnjyK7zZt5V+eoFk=; b=F9OUd4kN97NzLus+2EZfqZagNZKptEIVQc7z2ezluYwhWrqTmxJrX6I7FUEhnWBOfb L8hBPbt6g15JSQr3+k3XEmpAdmfbkallYSlRlKooaI3AJLBTCyeT0PMkdp71GvGmwOZH 034D3K+eVtH09crOR9gVwbcl85H7tITOeXU68k+cvz+PvkM4aytNvsofqEtktN1K6zKS 5Alc2ssHPLEsTSuFO+kD8E6XW3UxCbSA8UvBd3JQPgsQ133mQ8dewoX+W85MIgVABZyR VisymIaKSIRF405zsNH4xQcL3jLYUSOVlcJeJkCwe7jA/gftfYEZ4/HckJGmBf2uWbxp 2slg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UAmCLml2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k189-20020a633dc6000000b00438ce28758csi759351pga.136.2022.11.03.04.07.52; Thu, 03 Nov 2022 04:08:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UAmCLml2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231351AbiKCLBm (ORCPT + 99 others); Thu, 3 Nov 2022 07:01:42 -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-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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748472890792143805?= X-GMAIL-MSGID: =?utf-8?q?1748472890792143805?= 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/Documentation/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. Entries for multiple regulators shall be provided in the same field - separated by angular brackets <>. If current values aren't required + 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 relate the From patchwork Thu Nov 3 11:01:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 14815 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp458708wru; Thu, 3 Nov 2022 04:08:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM77v2yDb6gFpWPVRw4e80UvGqqIvLH6cVLvL3nuDNqFg+pZcDRuw3R+kz06BeSYhqrVx8p1 X-Received: by 2002:a17:902:7485:b0:17d:5176:fe6e with SMTP id h5-20020a170902748500b0017d5176fe6emr29836547pll.147.1667473683021; Thu, 03 Nov 2022 04:08:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667473683; cv=none; d=google.com; s=arc-20160816; b=LSfHwpYQ5kssndtHLM+IMEBlbEE6q7Wg0/Q79bYvETgDir0XUbjorSOMXf1pWME8r9 MlWDuzrDJ5SbdqdzlEdRqlG4V6Ae0mGxV+RqXEN4TCre8b3HZ9iPb5lm+5KlGpYKOpDS cIZj8XJjW274VloyfvK67XemULBvzx/QPbqpuLk10ZP4mj4n5ikOQZ+1L7i6bK4zRBkZ bAEmEgREDZQhiu2uj0KWRe04iV/xijf/+/+o8n3H5faACCuw8/0D8+cSDoLceBgcr4cg 1MzmvwFQiR9r9hnR7eJpZP61pdCtGLvS1GzhBToxcxxZGSyE+Lu8B+Sn7fysbcpKuR32 xFVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=E6BayU7+whKMo3/qWo30Lf+/AWFHgaDluxjQcRS3B+I=; b=P7eRqkNiOS2EGajPcrW/Kt78ur6xuAwgzfRhSU20sNS1MnCJcgRvnHY8QmtCxCk1ID APQgV/AoIurNGric5742JOwdiZK0d5N60D5p4J5dTDBNHIpQuFQl2NXG5OsLVCT23KOv +53lhsfKoclDOmXgvxrrpH5D4jnECFGYdFRr14KKI8PbKXVRgZdogkDVe0fD/tS905gj mqpKgZkirKdaq33j11408OYvNWtFdPewUreQse+5v9ysbhgKkqpRGtpBFbXf6d+lMmvo 9W6s/jfbYB4ITM5jDj5cGhTcOicno12F66jBZsj5fHb+YAF6ojsl0UrGslU+KJ/m8ZmG h1XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zBFjYYnE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r10-20020a170902c60a00b00186a8c18856si307016plr.451.2022.11.03.04.07.44; Thu, 03 Nov 2022 04:08:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zBFjYYnE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231296AbiKCLBp (ORCPT + 99 others); Thu, 3 Nov 2022 07:01:45 -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-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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748472884996885770?= X-GMAIL-MSGID: =?utf-8?q?1748472884996885770?= 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/Documentation/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 - '^opp-microwatt': + '^opp-microwatt-': description: - Named opp-microwatt property. Similar to opp-microamp property, + Named opp-microwatt property. Similar to opp-microamp- property, but for microwatt instead. $ref: /schemas/types.yaml#/definitions/uint32-array minItems: 1 From patchwork Thu Nov 3 11:01:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 14817 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp458993wru; Thu, 3 Nov 2022 04:08:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7rViui3WgXOLILFbKNUGvDA1mJPDzDvSpG0xdmDp4KBpxoQ8FhSt/bgBDBNRSDT/AEmQHL X-Received: by 2002:a17:902:7d87:b0:17f:9cd0:2e03 with SMTP id a7-20020a1709027d8700b0017f9cd02e03mr29593050plm.164.1667473715416; Thu, 03 Nov 2022 04:08:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667473715; cv=none; d=google.com; s=arc-20160816; b=o/fbTwFsxTcrPP4R/S8B3wneV2SWBrSQykxnFDFFOD419UfCr6VU0uavYBpajSGC96 8iY5LRgnKJVlY6WM/N5S0vJcASmwus1OBWvYNzBApLykLkqLBz6WD9kODjAsS3YC8tm/ B+t0/45RPHsEyI1I5ed62+6DcNt7kTu5DCZ8gb4+wdLZ0HU5Pvc5YmRJxXnrS9hMe6ek 0oVn1Y8Lm/VRDzcTlBwDcjhDAe7WcKd7b/tjM1zriI0p6MjHQGXLPvlLwyafw+df7sH8 Zrp59vOoxV/60bN3d3Y8P9CD9eTH8v+kGp+KVMkxTlpwFxuvzEcz8PF/u9vDVX2moHNB 59HA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=CUlxdNeoLlpwqgvI1vJN7b1g7ZmITiL31RBfTgzzy+4=; b=G+ug+BIpsJXT0Sb3ymo0cQ84xJrlaceKA/YKcbWncHSerMhSrsZ4tjLlkd39kQBahs dWrVs0cUE9vAo1WG3UDraPzecOWeODpNDOkmm7yVIZsBXRqF6kvXw7IOtkS99qTsZAFX ZwiLulgSn+XLTSIgIbD0/SS0QpLRkqLkMVHuTKcqhYNrCxJcjGOxV1W6EgzOuFpEngVy mZQBHyK2kEkubsgCjATKqK5WYrEc9/iUUzW9mJY+iBlL1awvI0N5Cb3XNRJphaYJh1EG 9fZEyu4g5T+QizTpDJLwPSQ4IbSq1ug2RxhU2JKrPL8hScTAAZn7svJcdSc+YHQjmCls nSoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XJqmPRwv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q40-20020a17090a1b2b00b00215e3cdaa35si1877816pjq.134.2022.11.03.04.08.20; Thu, 03 Nov 2022 04:08:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XJqmPRwv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231411AbiKCLBu (ORCPT + 99 others); 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-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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748472918572404961?= X-GMAIL-MSGID: =?utf-8?q?1748472918572404961?= 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, } } - /* Search for "opp-microwatt" */ - sprintf(name, "opp-microwatt"); - prop = of_find_property(opp->np, name, NULL); + /* Search for "opp-microwatt-" */ + prop = NULL; + if (opp_table->prop_name) { + snprintf(name, sizeof(name), "opp-microwatt-%s", + opp_table->prop_name); + prop = of_find_property(opp->np, name, NULL); + } + + if (!prop) { + /* Search for "opp-microwatt" */ + sprintf(name, "opp-microwatt"); + prop = of_find_property(opp->np, name, NULL); + } if (prop) { pcount = of_property_count_u32_elems(opp->np, name); From patchwork Thu Nov 3 11:01:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 14818 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp459294wru; Thu, 3 Nov 2022 04:09:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ZcTxpRn4dBLTghFUX8nbC+2UFZFipQghAHSBsYtdmYxQ4HMNN26EjzP9K2cAXs1qAwQet X-Received: by 2002:a17:90a:311:b0:214:143b:c7ab with SMTP id 17-20020a17090a031100b00214143bc7abmr12826370pje.21.1667473751508; Thu, 03 Nov 2022 04:09:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667473751; cv=none; d=google.com; s=arc-20160816; b=rupDlBAN05EuA/Ow3O3ZaG8igEGqP2mlT5/3w5Y7itUzTbcmfVr18/7+pmermZc9nD 7/k7qU9qyGeYQVjtpnz/MLMVqP0jZ9WsMvMnmGaJKdNeudbvN4SEPLqt1ey1LU8hsMUu 6XQjoI/2oF0+DKDM9zbQ8QzIrlmEpJGkXFFmOeeXysQZtYX62Lyrk6iZCaKajgaKMbWF aKEooU0iEmYA/pqYokm/nd8ICl9pJOJ91TM1Otf07UYwfbrDcU9APBqJ917zy0yb7RUA KA6lDFJUs/jXR0EAhfgk6iZ25SFj217TzMloZ6ryl/yaHA0yYl97m9ypGCNMzW3TNmho 1mUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jKnEZG0ef1w3+ZtyBo/x5Fjh/UyIelJHnysoJI3A1/8=; b=tPdd8T7nwEl5cYQKuQt7O4yyrB2Zn94eUPR3TOR4cvifxIoWghL5SOM1yhEvAF2TND kpH1yNT8a0Ul0zZUoqzSYxCaWu7qWd0MQjNIB547dKDcFM5aYV3IoeVRzDL6QxpRAX96 48FCX3gp11qp1+r5IX/uUJX16I9zXT/KIyQ50pzzpW3+vU3KZOJ+4RxM3tFmUnVs97tD bYVphSjzkF8Fqk/urHyk+ArmsG1Fhu69L7GS1qW3oMarHLMaSqp4wXLaIenrv5m+ZGR5 qyRVoUOi2+CFU0g9orYr13XvHFykHtgSKcCCGoCYIHgHdcFE7LrBEQjHLrbj0+uN8s01 gGoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="M/k9L/GA"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m13-20020a170902f64d00b00176c9015627si439478plg.94.2022.11.03.04.08.57; Thu, 03 Nov 2022 04:09:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="M/k9L/GA"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231388AbiKCLB5 (ORCPT + 99 others); Thu, 3 Nov 2022 07:01:57 -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-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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748472956010792603?= X-GMAIL-MSGID: =?utf-8?q?1748472956010792603?= 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, struct opp_table *opp_table, return false; } -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 = NULL, *microwatt = NULL; - int supplies = opp_table->regulator_count; - int vcount, icount, pcount, ret, i, j; struct property *prop = NULL; char name[NAME_MAX]; + int count, ret; + u32 *out; - /* 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 = of_find_property(opp->np, name, NULL); } if (!prop) { - /* Search for "opp-microvolt" */ - sprintf(name, "opp-microvolt"); + /* Search for "opp-" */ + snprintf(name, sizeof(name), "opp-%s", prop_type); prop = of_find_property(opp->np, name, NULL); - - /* Missing property isn't a problem, but an invalid entry is */ - if (!prop) { - if (unlikely(supplies == -1)) { - /* Initialize regulator_count */ - opp_table->regulator_count = 0; - return 0; - } - - if (!supplies) - return 0; - - dev_err(dev, "%s: opp-microvolt missing although OPP managing regulators\n", - __func__); - return -EINVAL; - } - } - - if (unlikely(supplies == -1)) { - /* Initialize regulator_count */ - supplies = opp_table->regulator_count = 1; - } else if (unlikely(!supplies)) { - dev_err(dev, "%s: opp-microvolt wasn't expected\n", __func__); - return -EINVAL; + if (!prop) + return NULL; } - vcount = 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 = 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); } - /* There can be one or three elements per supply */ - if (vcount != supplies && vcount != supplies * 3) { - dev_err(dev, "%s: Invalid number of elements in %s property (%d) with supplies (%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 == -1)) + opp_table->regulator_count = 1; + + if (count != opp_table->regulator_count && + (!triplet || count != opp_table->regulator_count * 3)) { + dev_err(dev, "%s: Invalid number of elements in %s property (%u) with supplies (%d)\n", + __func__, prop_type, count, opp_table->regulator_count); + return ERR_PTR(-EINVAL); } - microvolt = kmalloc_array(vcount, sizeof(*microvolt), GFP_KERNEL); - if (!microvolt) - return -ENOMEM; + out = kmalloc_array(count, sizeof(*out), GFP_KERNEL); + if (!out) + return ERR_PTR(-EINVAL); - ret = of_property_read_u32_array(opp->np, name, microvolt, vcount); + ret = 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 = -EINVAL; - goto free_microvolt; + kfree(out); + return ERR_PTR(-EINVAL); } - /* Search for "opp-microamp-" */ - prop = NULL; - if (opp_table->prop_name) { - snprintf(name, sizeof(name), "opp-microamp-%s", - opp_table->prop_name); - prop = of_find_property(opp->np, name, NULL); - } + if (triplet) + *triplet = count != opp_table->regulator_count; - if (!prop) { - /* Search for "opp-microamp" */ - sprintf(name, "opp-microamp"); - prop = of_find_property(opp->np, name, NULL); - } - - if (prop) { - icount = of_property_count_u32_elems(opp->np, name); - if (icount < 0) { - dev_err(dev, "%s: Invalid %s property (%d)\n", __func__, - name, icount); - ret = icount; - goto free_microvolt; - } + return out; +} - if (icount != supplies) { - dev_err(dev, "%s: Invalid number of elements in %s property (%d) with supplies (%d)\n", - __func__, name, icount, supplies); - ret = -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; - microamp = kmalloc_array(icount, sizeof(*microamp), GFP_KERNEL); - if (!microamp) { - ret = -EINVAL; - goto free_microvolt; - } + microvolt = _parse_named_prop(opp, dev, opp_table, "microvolt", triplet); + if (IS_ERR(microvolt)) + return microvolt; - ret = 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 = -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 regulators\n", + __func__); + return ERR_PTR(-EINVAL); } } - /* Search for "opp-microwatt-" */ - prop = NULL; - if (opp_table->prop_name) { - snprintf(name, sizeof(name), "opp-microwatt-%s", - opp_table->prop_name); - prop = of_find_property(opp->np, name, NULL); - } - - if (!prop) { - /* Search for "opp-microwatt" */ - sprintf(name, "opp-microwatt"); - prop = of_find_property(opp->np, name, NULL); - } + return microvolt; +} - if (prop) { - pcount = of_property_count_u32_elems(opp->np, name); - if (pcount < 0) { - dev_err(dev, "%s: Invalid %s property (%d)\n", __func__, - name, pcount); - ret = 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; - if (pcount != supplies) { - dev_err(dev, "%s: Invalid number of elements in %s property (%d) with supplies (%d)\n", - __func__, name, pcount, supplies); - ret = -EINVAL; - goto free_microamp; - } + microvolt = opp_parse_microvolt(opp, dev, opp_table, &triplet); + if (IS_ERR_OR_NULL(microvolt)) + return PTR_ERR(microvolt); - microwatt = kmalloc_array(pcount, sizeof(*microwatt), - GFP_KERNEL); - if (!microwatt) { - ret = -EINVAL; - goto free_microamp; - } + microamp = _parse_named_prop(opp, dev, opp_table, "microamp", NULL); + if (IS_ERR(microamp)) { + ret = PTR_ERR(microamp); + goto free_microvolt; + } - ret = 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 = -EINVAL; - goto free_microwatt; - } + microwatt = _parse_named_prop(opp, dev, opp_table, "microwatt", NULL); + if (IS_ERR(microwatt)) { + ret = PTR_ERR(microwatt); + goto free_microamp; } - for (i = 0, j = 0; i < supplies; i++) { + for (i = 0, j = 0; i < opp_table->regulator_count; i++) { opp->supplies[i].u_volt = microvolt[j++]; - if (vcount == supplies) { - opp->supplies[i].u_volt_min = opp->supplies[i].u_volt; - opp->supplies[i].u_volt_max = opp->supplies[i].u_volt; - } else { + if (triplet) { opp->supplies[i].u_volt_min = microvolt[j++]; opp->supplies[i].u_volt_max = microvolt[j++]; + } else { + opp->supplies[i].u_volt_min = opp->supplies[i].u_volt; + opp->supplies[i].u_volt_max = opp->supplies[i].u_volt; } if (microamp) @@ -760,7 +707,6 @@ static int opp_parse_supplies(struct dev_pm_opp *opp, struct device *dev, opp->supplies[i].u_watt = microwatt[i]; } -free_microwatt: kfree(microwatt); free_microamp: kfree(microamp); From patchwork Thu Nov 3 11:01:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 14819 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp459385wru; Thu, 3 Nov 2022 04:09:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Rtsv2MIPql0jkE5sQNd96eWfq2o46BIbBbZbn1fnd11XeS9KHUCCKK6TL1ZE9jcyFAp1u X-Received: by 2002:aa7:8c15:0:b0:56b:ead2:3950 with SMTP id c21-20020aa78c15000000b0056bead23950mr30254816pfd.77.1667473759587; Thu, 03 Nov 2022 04:09:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667473759; cv=none; d=google.com; s=arc-20160816; b=Ul1GUFiIxwspfbGxV2yNn3Sp8K0U3/0uKtujgRCTuY+8+IpiObXKEp7nKGneBoI6mr iwMcaCD2E59/BfpsYX8HLIjA/6NwroUl81zpOBBvygFsmlvLs7ZeaJYSY6tbMeX4bMGu EBcw4ELZIJV7sFJBjRumGAwgbVaBHWDjycXBM2KCYHk5hYxdiLbQcU7TSi7nSRofOxTh m2eSvMLAwAG7AsGhYdWXe7+rvdX/Ft+0y5srXtJItwLyaActRAMaMTJgjdrdlaIm/FKr zQ2ritV3V17uX3dWUo/9J1t3Dxy/UsLVrVYb5hj9G21bkhCbxT2hMEHlHUf0USSCkbo6 4hnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=fsmUR9VBjzdfb/PGMg0vmzjLCq4QjfuLi4iPrW87qL0=; b=OPiYbaa8ZOMsbhhzzR0Qtv56Tio6yti+ax1digU8TSNFDq/AWnSTCxsBsKOgsBoraj +OOjuG3FCZuG9tlGad/VEpn/Tr7Kimg/9FQYlQui0cdJW9ToygQFLi6rDM9n0ohcmZdE yaYq97K7FkraY16+il6KRJf7KwdWJO3ay2Tpv3kWI7p3Ryn6QxtTSEg+X19kIA0TdOdL pGTvCCESHc7TFhAQE1Hh9Z1GL38UsbFN9L6Vp8GSTcqlNSJTi/m80bZoSGZMs4upJ1EL B8jB/XqEkJAS77W40R0qRRrs5MfSf0ooDAbNdc0GpOV+adizy7JPZrTqHcyIOsKBT5R0 scGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GHinC0Pr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cp8-20020a056a00348800b0055214e179d5si399250pfb.63.2022.11.03.04.09.04; Thu, 03 Nov 2022 04:09:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GHinC0Pr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231355AbiKCLCS (ORCPT + 99 others); Thu, 3 Nov 2022 07:02:18 -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-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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748472964773558890?= X-GMAIL-MSGID: =?utf-8?q?1748472964773558890?= 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 regulators\n", __func__); return ERR_PTR(-EINVAL); @@ -674,7 +677,7 @@ static int opp_parse_supplies(struct dev_pm_opp *opp, struct device *dev, bool triplet; microvolt = opp_parse_microvolt(opp, dev, opp_table, &triplet); - if (IS_ERR_OR_NULL(microvolt)) + if (IS_ERR(microvolt)) return PTR_ERR(microvolt); microamp = _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; } - for (i = 0, j = 0; i < opp_table->regulator_count; i++) { - opp->supplies[i].u_volt = microvolt[j++]; + /* + * Initialize regulator_count if it is uninitialized and no properties + * are found. + */ + if (unlikely(opp_table->regulator_count == -1)) { + opp_table->regulator_count = 0; + return 0; + } - if (triplet) { - opp->supplies[i].u_volt_min = microvolt[j++]; - opp->supplies[i].u_volt_max = microvolt[j++]; - } else { - opp->supplies[i].u_volt_min = opp->supplies[i].u_volt; - opp->supplies[i].u_volt_max = opp->supplies[i].u_volt; + for (i = 0, j = 0; i < opp_table->regulator_count; i++) { + if (microvolt) { + opp->supplies[i].u_volt = microvolt[j++]; + + if (triplet) { + opp->supplies[i].u_volt_min = microvolt[j++]; + opp->supplies[i].u_volt_max = microvolt[j++]; + } else { + opp->supplies[i].u_volt_min = opp->supplies[i].u_volt; + opp->supplies[i].u_volt_max = opp->supplies[i].u_volt; + } } if (microamp)