From patchwork Mon Apr 9 11:43:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 133025 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp168104ljb; Mon, 9 Apr 2018 04:44:15 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+2nLpYpdvxzQGAFt2yN70z6fqnOydY2U7/8032BnM8EfdzFiu6mQ59XtWKc1rhx5W3fjZ6 X-Received: by 10.99.140.14 with SMTP id m14mr25438521pgd.320.1523274255767; Mon, 09 Apr 2018 04:44:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523274255; cv=none; d=google.com; s=arc-20160816; b=k64Ruce+aiN+mSzF7SfJ3L8KZ39ioO+48XgfaRTj/wOvdQSH+JLKWJgP29Uoc+BrYB aGQ/R1aj2M1uvpQZRy5B7K20shq4oLah5A5Y84AYiuMC2lFWpiflg31pF6zsER+aXyji 4hpF3rZc1J0yqriEfpTL6kOSNvXruft5VrK9MXwlzEb7k1TdSY3AlKHmFTerNfuALogj MPjb2mV+Q29XRs/3n71c3kycwwvaUtH8W9D+HwL3SPfRQQuBYVH4J89zYLvR9MUlOGDT hSnWg3eXvDP5kN3YvwWTLuzm/WGEA0b5hLuu+KM1bjlYMmVeXYjwRyQ0YT1cFZ3atEgN L1gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=3otSLEKl/C+PXqkoHwvtv1Pn9utIkw+MVKrnx7/KwOg=; b=UOlS+usVqI/jXn3CuI1gN9S61BQdP8sTzsBWe9zyT3DD2p17BR456SlSwmbRM/gQhG 97IdlLtO3F0g1Kv5zeRoZ8qxAnCPBtxoYIqOpPUvapUemCOxTOPqdRCY5zxRsQfB1WeJ or1nvdioQjdKqQ/ysmiBmc7aN+2Iwvn1l30+v3lBtrO/aGgNJ155NviK6tCu6Ypi2l4K 9/9GEsSHZG9JqMV7pMDG7Dk51HJasKqc+cUcONMZXCZvP08DKQCJ3OO74ru0q9wkjFy/ Z2SkFu2OvverwozI77I31HWtWEymC1tR1yiYH15KhBA2kSS2s8Tsu/J/4rfaOSlkfwI/ Tgfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=byo3VBgm; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j188si105815pgc.584.2018.04.09.04.44.15; Mon, 09 Apr 2018 04:44:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=byo3VBgm; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1752178AbeDILoO (ORCPT + 11 others); Mon, 9 Apr 2018 07:44:14 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:38972 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751707AbeDILoO (ORCPT ); Mon, 9 Apr 2018 07:44:14 -0400 Received: by mail-pf0-f195.google.com with SMTP id c78so5650905pfj.6 for ; Mon, 09 Apr 2018 04:44:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=3otSLEKl/C+PXqkoHwvtv1Pn9utIkw+MVKrnx7/KwOg=; b=byo3VBgm9R3dcFy6OQKqlUoy0R13Wc7v7g/BOKnOgUlKffWZ1MwELvXum+yeN91sJM fJKuJttd/1GZ9k2qNN/2onOrwFb4Hc5R+EajDM0zxZBpRr3IOMm4ctk71HrSAtiLZQd4 3WYdbQMZjigrMifEMFM+2/qYsfEnj0GcA6+4w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=3otSLEKl/C+PXqkoHwvtv1Pn9utIkw+MVKrnx7/KwOg=; b=kqaBD98wwTLhnnTT4jz73aaCoDqg8jtUQMDYF/asksTrtU1Mpd+ZOIJHkioTz9a9D9 Gs65oYfJoUjfZcJVV3UVFcEZ3EW57M0NpKYDRV4+Q5V/ky4P93t7TtWwMyb4v5Z5jB7F AgMM3FfiYBnYrcKunOMXw1kxUoa1EBmvn9pR6Q98gB6vVU0rUy+J7m0vTBkaF4pSutMl NS+XiEPQTt1q5XYJ/+XgaAmAl61U7aD7AgYkq/pqa2coS4H+SL4/AaPpf4OUZlUN2/UP a3W9qvtcq3f1wx3rg8jzz7fcCb0+1xCUmzhIH18bzIrBuhk+l0jmkv7ET1pzaAoaTL90 f93A== X-Gm-Message-State: AElRT7FsX0Fdp1peuJHHkdYiouPoLyjlYjL8rCO700hoCvLjdO4xmrEj FSpox79s/zOLJY78YE5aG6sTvw== X-Received: by 10.98.102.131 with SMTP id s3mr28669328pfj.89.1523274253593; Mon, 09 Apr 2018 04:44:13 -0700 (PDT) Received: from localhost ([122.171.228.188]) by smtp.gmail.com with ESMTPSA id q13sm375389pgr.52.2018.04.09.04.44.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Apr 2018 04:44:13 -0700 (PDT) From: Viresh Kumar To: Ulf Hansson , Stephen Boyd , Viresh Kumar , Nishanth Menon , "Rafael J. Wysocki" , Kevin Hilman Cc: Viresh Kumar , Rajendra Nayak , Vincent Guittot , linux-pm@vger.kernel.org, Rob Herring Subject: [PATCH V2 01/11] PM / OPP: dt-bindings: Rename "required-opp" as "required-opps" Date: Mon, 9 Apr 2018 17:13:41 +0530 Message-Id: <85cec966b995393b403d7273ec3abf6f0b0a60d5.1523273291.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org This property can contain more than one phandle and it must be named "required-opps" instead. Cc: Rob Herring Suggested-by: Stephen Boyd Signed-off-by: Viresh Kumar --- Documentation/devicetree/bindings/opp/opp.txt | 2 +- Documentation/devicetree/bindings/power/power_domain.txt | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) -- 2.15.0.194.g9af6a3dea062 Reviewed-by: Ulf Hansson Reviewed-by: Rob Herring diff --git a/Documentation/devicetree/bindings/opp/opp.txt b/Documentation/devicetree/bindings/opp/opp.txt index 4e4f30288c8b..788052d66c9d 100644 --- a/Documentation/devicetree/bindings/opp/opp.txt +++ b/Documentation/devicetree/bindings/opp/opp.txt @@ -159,7 +159,7 @@ properties. - status: Marks the node enabled/disabled. -- required-opp: This contains phandle to an OPP node in another device's OPP +- required-opps: This contains phandle to an OPP node in another device's OPP table. It may contain an array of phandles, where each phandle points to an OPP of a different device. It should not contain multiple phandles to the OPP nodes in the same OPP table. This specifies the minimum required OPP of the diff --git a/Documentation/devicetree/bindings/power/power_domain.txt b/Documentation/devicetree/bindings/power/power_domain.txt index f3355313c020..4733f76cbe48 100644 --- a/Documentation/devicetree/bindings/power/power_domain.txt +++ b/Documentation/devicetree/bindings/power/power_domain.txt @@ -127,7 +127,7 @@ inside a PM domain with index 0 of a power controller represented by a node with the label "power". Optional properties: -- required-opp: This contains phandle to an OPP node in another device's OPP +- required-opps: This contains phandle to an OPP node in another device's OPP table. It may contain an array of phandles, where each phandle points to an OPP of a different device. It should not contain multiple phandles to the OPP nodes in the same OPP table. This specifies the minimum required OPP of the @@ -175,14 +175,14 @@ with the label "power". compatible = "foo,i-leak-current"; reg = <0x12350000 0x1000>; power-domains = <&power 0>; - required-opp = <&domain0_opp_0>; + required-opps = <&domain0_opp_0>; }; leaky-device1@12350000 { compatible = "foo,i-leak-current"; reg = <0x12350000 0x1000>; power-domains = <&power 1>; - required-opp = <&domain1_opp_1>; + required-opps = <&domain1_opp_1>; }; [1]. Documentation/devicetree/bindings/power/domain-idle-state.txt From patchwork Mon Apr 9 11:43:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 133026 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp168138ljb; Mon, 9 Apr 2018 04:44:18 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/L+hnytktMk4hZYldbtxu9njgNpt/B788wOC1nnj+wQXiSc2yCo8JBDZza020bjsajYb2V X-Received: by 2002:a17:902:2805:: with SMTP id e5-v6mr39104738plb.89.1523274258245; Mon, 09 Apr 2018 04:44:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523274258; cv=none; d=google.com; s=arc-20160816; b=BZOo+/8cvBJQubsVEOejxk8SKg2o1fbGgrl+duBGJRZlU9+kLgq7W9IbAM0oHivryB l6C3+UqPwT8eBa2Em+TpgXfa6/EZ69vVROKw1Zqn9410JkgqhswumIpIncUzokLH1+kN 48BK1L6ECTRPqe/8w/aLi9t1OY5G3ATa1CoCadMhPoBCFaEe0vZTL+5Jk2/L3JNEPkkM TkF7Ca2T0e+Uq6pWQMK7AvuK5j+nS8UqYsd0f5cPjxF27XNAwIcU8P4ATtqvK3M2Ihdi fpC6QEZpY5/j1GQ6SrAm5PJWuET1vDsIIExEg8NBYabbKvGxFg9j+KeK+xJ1lIRxINFm oC4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=uyFc6sC0wMsLngV7eBxFxgY3xGLIfpYgTuWQe8f4MZs=; b=wKX8ASoIL2SntcGEZec29eQFJNrfbjAATWXKDnztU00C+WGkomxsmSSKMlkiJwApW6 JNrqzyt3Pr6U4wL+jFY0Sp6iMairfy4j4LixOB4XBzxWilTcOZkvZSJMKKq8FPHdUaWT 6HAjVdwMCTxoyPD9JqS7GmtFmFZfq06Sp1ddTGxUxeedM6klk3naumGUfizAbyygvRiH vK25Wc5OKHM3w0kZ3eHfFo7J/eGQQfQuTIB5Hj+goqoZZ0ExR1dxiESJNdHlczzr6UnR euhnTDgq4TvARPmcUtifj8PgiKGTxaDOQLXB9do7FoadkHuNnTncvOkbi9tQKgHl7ygh S3Ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LgNaA1hJ; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j188si105815pgc.584.2018.04.09.04.44.17; Mon, 09 Apr 2018 04:44:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LgNaA1hJ; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1751643AbeDILoR (ORCPT + 11 others); Mon, 9 Apr 2018 07:44:17 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:45821 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751507AbeDILoQ (ORCPT ); Mon, 9 Apr 2018 07:44:16 -0400 Received: by mail-pf0-f196.google.com with SMTP id l27so5646574pfk.12 for ; Mon, 09 Apr 2018 04:44:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=uyFc6sC0wMsLngV7eBxFxgY3xGLIfpYgTuWQe8f4MZs=; b=LgNaA1hJ1Cf0aamAds6X3RRkb/tnfuq2uATvxI+gfiPN3U++5amyCwYLO6ktKKIjYU SRV7erJBtlZe7IMtv7w1knuHAGfZPeh4B+5G7CwEN7rlfWlEuucN8z0/PcP1iw72x/ln JcIEHSxlMCxiOaBg0Tj5dkWd0JQVwjByabqbE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=uyFc6sC0wMsLngV7eBxFxgY3xGLIfpYgTuWQe8f4MZs=; b=iv788SuYDgZEHowNIdY0dTlOV8OyBvXptPCoGYz5Q78CEgsi5a3kZNed7mKMpD4/4L MzBCu4cJPF7Z4ZCpZzX/B7hMPQ6QhnWsDpddzaS5P8sOT0MHVO4Z0MnqPpAHgg8uZgQx 8GcJXzdcaTnUOo7fMtYdgfr6Se/PqDfoo6OWfGi0QekdIS244/b1Aqf6M2ClyQ6CBP5N c7UzwBvDBXDOy3V2rFmVvWUOPJcAvKyzvrX4JMzl/MNTR8I5Ds5E6TVHAsPhlGBw5x0M 1Zin1ICsOlvUBj3W9NgLs0nt9Fya1oemQZl94iuOjIw3isGdywS2lzqYI4dlRFZE3Ize zMLw== X-Gm-Message-State: AElRT7HyrIrI0AYbCbZ0XITnjiHb1VW5QOfqP0steWOSrdPIxudE8pbI CZiYq8PU5PM6mTGuy6Tmx5E1RTvsqJA= X-Received: by 10.98.87.151 with SMTP id i23mr28886223pfj.175.1523274256239; Mon, 09 Apr 2018 04:44:16 -0700 (PDT) Received: from localhost ([122.171.228.188]) by smtp.gmail.com with ESMTPSA id d8sm596372pgu.60.2018.04.09.04.44.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Apr 2018 04:44:15 -0700 (PDT) From: Viresh Kumar To: Ulf Hansson , Stephen Boyd , Viresh Kumar , Nishanth Menon Cc: Viresh Kumar , Rajendra Nayak , Vincent Guittot , linux-pm@vger.kernel.org, Rob Herring Subject: [PATCH V2 02/11] PM / OPP: dt-bindings: Make "opp-hz" optional for power domains Date: Mon, 9 Apr 2018 17:13:42 +0530 Message-Id: <5c4a3a3fb4bf7320e592aabf582bfb6bdec4ee69.1523273291.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The "opp-hz" property is not relevant across all the devices that use the OPP tables now. For example, for a power domain a frequency value wouldn't mean anything. Though they must have another property, which may be implementation defined, which uniquely identifies the OPP nodes. Make "opp-hz" optional for such devices. Cc: Rob Herring Signed-off-by: Viresh Kumar --- Documentation/devicetree/bindings/opp/opp.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -- 2.15.0.194.g9af6a3dea062 Reviewed-by: Ulf Hansson diff --git a/Documentation/devicetree/bindings/opp/opp.txt b/Documentation/devicetree/bindings/opp/opp.txt index 788052d66c9d..c396c4c0af92 100644 --- a/Documentation/devicetree/bindings/opp/opp.txt +++ b/Documentation/devicetree/bindings/opp/opp.txt @@ -82,7 +82,10 @@ This defines voltage-current-frequency combinations along with other related properties. Required properties: -- opp-hz: Frequency in Hz, expressed as a 64-bit big-endian integer. +- opp-hz: Frequency in Hz, expressed as a 64-bit big-endian integer. This is a + required property for all device nodes but devices like power domains. The + power domain nodes must have another (implementation dependent) property which + uniquely identifies the OPP nodes. Optional properties: - opp-microvolt: voltage in micro Volts. From patchwork Mon Apr 9 11:43:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 133027 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp168173ljb; Mon, 9 Apr 2018 04:44:21 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/q2BbjudgjwbTouPplEyGr4Ym5L21Tq1pHo2yqN4dw9Rg6LrwUVZEarAKdTmsOtZzaPrbX X-Received: by 2002:a17:902:341:: with SMTP id 59-v6mr37250158pld.407.1523274261365; Mon, 09 Apr 2018 04:44:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523274261; cv=none; d=google.com; s=arc-20160816; b=pTGJgi+1ToE2udeKG8ALuJh110xafNRgBbxzs3MQHwSV1ICtk2NM6O4auKTDaQgYKF ujcEgio7WGD7P4um2wExOM0gvPH81fRl/gfLmiCBtO8UMfELIDxyd7azsuzURIboKPKo 4dPEt8sNhf7aSsX3w2K7Ymre3Mgb9CV5NDpLuIKlglV6CmtkQ2ziXDeTmcJVWCBbmRJ4 g8FJc8Ed48nskPBg2SfS7GuQF9DCiymyiXG3WPJZw8zufXzX+NLivEwiwQmuopA/3AZz yAGY22o3tlwpWPM3xOx+cfvvA5mzGP12ofIfQuxMIrdbJGacCHR8BIXZKUcfS7/hAFNG xGjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=FbTClrwyMcmHg+co92jGj7lk/HteBOT5VmTDz5/SBlk=; b=dLfxJSDx7sS3yNcRor0Wh5AkRswjRmtXvWmGTEThqQWT6zEsvGqJvNuTc1gp1m2Uxt +Go5v69UVzS8PkpmevLrQGQCmvlygQaISRB2XLDBlAPcc7aG82hlwLUS5BHYXUp5UaA3 0ToWU7xsdf9NNfqdyFxxWZMKwF3rly6KIN3ZKROlLdVR6cAGAsqFz6Y5TNI3YWomWz9D nxNskGEn1hO/rqNxp6qn7eO89/BZu9aEZb6yjjLF1MH/tdkv3lFZ9pPtWYhPCrfOoFtr ZDUo4OZeEZ3iz9uCzdAz1llEieI/D+9Dasy5R0G+eJNAlHNDnDNrbUydiHl+EKxMNChy S3vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=M/LHhsl2; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j188si105815pgc.584.2018.04.09.04.44.21; Mon, 09 Apr 2018 04:44:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=M/LHhsl2; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1751736AbeDILoU (ORCPT + 11 others); Mon, 9 Apr 2018 07:44:20 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:45526 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751589AbeDILoT (ORCPT ); Mon, 9 Apr 2018 07:44:19 -0400 Received: by mail-pl0-f65.google.com with SMTP id e22-v6so3200349plj.12 for ; Mon, 09 Apr 2018 04:44:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=FbTClrwyMcmHg+co92jGj7lk/HteBOT5VmTDz5/SBlk=; b=M/LHhsl2sjWJNn4cpGJ1iwmyDiilpry2b6zWCGv8cxW2V9QdkWt8rBaxOteLbEn7x/ LUhnnYR1ZZaaiJ9/4C4z1gZDnspp9cDiuy1rji0NezgDU2RfvwDF6mNk7NWuxp+2wx4g /iD/LAdyQ7Z2k1fIkRpxW7OOo3cTDxoZ+Zk68= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=FbTClrwyMcmHg+co92jGj7lk/HteBOT5VmTDz5/SBlk=; b=akEd95sR4Y06/fee82DdLk9Krxp+tiKLRRIsGDRsUpUGAGdhtjlZ3P/QwODmuI7mCV CPbGA9U37mFyYLucPbSsSfeGppbXJehifnxAEVF6S9qZlRjDuMvoidUP/9lEWntY60J5 oCS7SspjjyemZv87iqwnXa3XV/2x1ksHDo8uBe8HmDIjuw6ncKrNsMfa2d1xwuoC7rrI 51QQ9v81yKKxUae6S5aDjoHALsmty65UNuN6n56BatEX/nRpJ6uqxzSq1UNeFeVqUnpQ HSAB5lgWVzbvaY5amUTbzBSqEf9FM2XH7OnwyJBAgr11KDWDhGlfkaWqt6ZDr4U8/dO7 GhNQ== X-Gm-Message-State: AElRT7Ftn5njJF58wzJlZ+CgMLceNkkUfmEQ4CpxzORiUyfqbEadz+0r izBF4BnUgvYqDVzwXnwVWq2veA== X-Received: by 2002:a17:902:7087:: with SMTP id z7-v6mr39162538plk.315.1523274259137; Mon, 09 Apr 2018 04:44:19 -0700 (PDT) Received: from localhost ([122.171.228.188]) by smtp.gmail.com with ESMTPSA id o18sm433927pgd.59.2018.04.09.04.44.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Apr 2018 04:44:18 -0700 (PDT) From: Viresh Kumar To: Ulf Hansson , Stephen Boyd , Viresh Kumar , Nishanth Menon Cc: Viresh Kumar , Rajendra Nayak , Vincent Guittot , linux-pm@vger.kernel.org Subject: [PATCH V2 03/11] PM / OPP: "opp-hz" is optional for power domains Date: Mon, 9 Apr 2018 17:13:43 +0530 Message-Id: X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org "opp-hz" property is optional for power domains, don't error out if it is missing. Signed-off-by: Viresh Kumar --- drivers/opp/core.c | 92 +++++++++++++++++++++++++++++++-------------------- drivers/opp/debugfs.c | 15 +++++++-- drivers/opp/of.c | 26 ++++++++++----- drivers/opp/opp.h | 3 +- 4 files changed, 89 insertions(+), 47 deletions(-) -- 2.15.0.194.g9af6a3dea062 Reviewed-by: Ulf Hansson diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 92fa94a6dcc1..a0f72c732718 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -281,6 +281,23 @@ unsigned long dev_pm_opp_get_suspend_opp_freq(struct device *dev) } EXPORT_SYMBOL_GPL(dev_pm_opp_get_suspend_opp_freq); +int _get_opp_count(struct opp_table *opp_table) +{ + struct dev_pm_opp *opp; + int count = 0; + + mutex_lock(&opp_table->lock); + + list_for_each_entry(opp, &opp_table->opp_list, node) { + if (opp->available) + count++; + } + + mutex_unlock(&opp_table->lock); + + return count; +} + /** * dev_pm_opp_get_opp_count() - Get number of opps available in the opp table * @dev: device for which we do this operation @@ -291,25 +308,17 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_get_suspend_opp_freq); int dev_pm_opp_get_opp_count(struct device *dev) { struct opp_table *opp_table; - struct dev_pm_opp *temp_opp; - int count = 0; + int count; opp_table = _find_opp_table(dev); if (IS_ERR(opp_table)) { count = PTR_ERR(opp_table); dev_dbg(dev, "%s: OPP table not found (%d)\n", __func__, count); - return count; - } - - mutex_lock(&opp_table->lock); - - list_for_each_entry(temp_opp, &opp_table->opp_list, node) { - if (temp_opp->available) - count++; + return 0; } - mutex_unlock(&opp_table->lock); + count = _get_opp_count(opp_table); dev_pm_opp_put_opp_table(opp_table); return count; @@ -985,22 +994,11 @@ static bool _opp_supported_by_regulators(struct dev_pm_opp *opp, return true; } -/* - * Returns: - * 0: On success. And appropriate error message for duplicate OPPs. - * -EBUSY: For OPP with same freq/volt and is available. The callers of - * _opp_add() must return 0 if they receive -EBUSY from it. This is to make - * sure we don't print error messages unnecessarily if different parts of - * kernel try to initialize the OPP table. - * -EEXIST: For OPP with same freq but different volt or is unavailable. This - * should be considered an error by the callers of _opp_add(). - */ -int _opp_add(struct device *dev, struct dev_pm_opp *new_opp, - struct opp_table *opp_table) +static int _opp_is_duplicate(struct device *dev, struct dev_pm_opp *new_opp, + struct opp_table *opp_table, + struct list_head **head) { struct dev_pm_opp *opp; - struct list_head *head; - int ret; /* * Insert new OPP in order of increasing frequency and discard if @@ -1010,17 +1008,14 @@ int _opp_add(struct device *dev, struct dev_pm_opp *new_opp, * loop, don't replace it with head otherwise it will become an infinite * loop. */ - mutex_lock(&opp_table->lock); - head = &opp_table->opp_list; - list_for_each_entry(opp, &opp_table->opp_list, node) { if (new_opp->rate > opp->rate) { - head = &opp->node; + *head = &opp->node; continue; } if (new_opp->rate < opp->rate) - break; + return 0; /* Duplicate OPPs */ dev_warn(dev, "%s: duplicate OPPs detected. Existing: freq: %lu, volt: %lu, enabled: %d. New: freq: %lu, volt: %lu, enabled: %d\n", @@ -1029,11 +1024,38 @@ int _opp_add(struct device *dev, struct dev_pm_opp *new_opp, new_opp->supplies[0].u_volt, new_opp->available); /* Should we compare voltages for all regulators here ? */ - ret = opp->available && - new_opp->supplies[0].u_volt == opp->supplies[0].u_volt ? -EBUSY : -EEXIST; + return opp->available && + new_opp->supplies[0].u_volt == opp->supplies[0].u_volt ? -EBUSY : -EEXIST; + } + + return 0; +} + +/* + * Returns: + * 0: On success. And appropriate error message for duplicate OPPs. + * -EBUSY: For OPP with same freq/volt and is available. The callers of + * _opp_add() must return 0 if they receive -EBUSY from it. This is to make + * sure we don't print error messages unnecessarily if different parts of + * kernel try to initialize the OPP table. + * -EEXIST: For OPP with same freq but different volt or is unavailable. This + * should be considered an error by the callers of _opp_add(). + */ +int _opp_add(struct device *dev, struct dev_pm_opp *new_opp, + struct opp_table *opp_table, bool rate_not_available) +{ + struct list_head *head; + int ret; + + mutex_lock(&opp_table->lock); + head = &opp_table->opp_list; - mutex_unlock(&opp_table->lock); - return ret; + if (likely(!rate_not_available)) { + ret = _opp_is_duplicate(dev, new_opp, opp_table, &head); + if (ret) { + mutex_unlock(&opp_table->lock); + return ret; + } } if (opp_table->get_pstate) @@ -1104,7 +1126,7 @@ int _opp_add_v1(struct opp_table *opp_table, struct device *dev, new_opp->available = true; new_opp->dynamic = dynamic; - ret = _opp_add(dev, new_opp, opp_table); + ret = _opp_add(dev, new_opp, opp_table, false); if (ret) { /* Don't return error for duplicate OPPs */ if (ret == -EBUSY) diff --git a/drivers/opp/debugfs.c b/drivers/opp/debugfs.c index b03c03576a62..e6828e5f81b0 100644 --- a/drivers/opp/debugfs.c +++ b/drivers/opp/debugfs.c @@ -77,10 +77,21 @@ int opp_debug_create_one(struct dev_pm_opp *opp, struct opp_table *opp_table) { struct dentry *pdentry = opp_table->dentry; struct dentry *d; + unsigned long id; char name[25]; /* 20 chars for 64 bit value + 5 (opp:\0) */ - /* Rate is unique to each OPP, use it to give opp-name */ - snprintf(name, sizeof(name), "opp:%lu", opp->rate); + /* + * Get directory name for OPP. + * + * - Normally rate is unique to each OPP, use it to get unique opp-name. + * - For some devices rate isn't available, use index instead. + */ + if (likely(opp->rate)) + id = opp->rate; + else + id = _get_opp_count(opp_table); + + snprintf(name, sizeof(name), "opp:%lu", id); /* Create per-opp directory */ d = debugfs_create_dir(name, pdentry); diff --git a/drivers/opp/of.c b/drivers/opp/of.c index cb716aa2f44b..c5c5afcaa2e3 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -292,6 +292,7 @@ static int _opp_add_static_v2(struct opp_table *opp_table, struct device *dev, u64 rate; u32 val; int ret; + bool rate_not_available = false; new_opp = _opp_allocate(opp_table); if (!new_opp) @@ -299,8 +300,21 @@ static int _opp_add_static_v2(struct opp_table *opp_table, struct device *dev, ret = of_property_read_u64(np, "opp-hz", &rate); if (ret < 0) { - dev_err(dev, "%s: opp-hz not found\n", __func__); - goto free_opp; + /* "opp-hz" is optional for devices like power domains. */ + if (!of_find_property(dev->of_node, "#power-domain-cells", + NULL)) { + dev_err(dev, "%s: opp-hz not found\n", __func__); + goto free_opp; + } + + rate_not_available = true; + } else { + /* + * Rate is defined as an unsigned long in clk API, and so + * casting explicitly to its type. Must be fixed once rate is 64 + * bit guaranteed in clk API. + */ + new_opp->rate = (unsigned long)rate; } /* Check if the OPP supports hardware's hierarchy of versions or not */ @@ -309,12 +323,6 @@ static int _opp_add_static_v2(struct opp_table *opp_table, struct device *dev, goto free_opp; } - /* - * Rate is defined as an unsigned long in clk API, and so casting - * explicitly to its type. Must be fixed once rate is 64 bit - * guaranteed in clk API. - */ - new_opp->rate = (unsigned long)rate; new_opp->turbo = of_property_read_bool(np, "turbo-mode"); new_opp->np = np; @@ -328,7 +336,7 @@ static int _opp_add_static_v2(struct opp_table *opp_table, struct device *dev, if (ret) goto free_opp; - ret = _opp_add(dev, new_opp, opp_table); + ret = _opp_add(dev, new_opp, opp_table, rate_not_available); if (ret) { /* Don't return error for duplicate OPPs */ if (ret == -EBUSY) diff --git a/drivers/opp/opp.h b/drivers/opp/opp.h index 4d00061648a3..381a4fb15d5c 100644 --- a/drivers/opp/opp.h +++ b/drivers/opp/opp.h @@ -188,13 +188,14 @@ struct opp_table { /* Routines internal to opp core */ void _get_opp_table_kref(struct opp_table *opp_table); +int _get_opp_count(struct opp_table *opp_table); struct opp_table *_find_opp_table(struct device *dev); struct opp_device *_add_opp_dev(const struct device *dev, struct opp_table *opp_table); void _dev_pm_opp_remove_table(struct opp_table *opp_table, struct device *dev, bool remove_all); void _dev_pm_opp_find_and_remove_table(struct device *dev, bool remove_all); struct dev_pm_opp *_opp_allocate(struct opp_table *opp_table); void _opp_free(struct dev_pm_opp *opp); -int _opp_add(struct device *dev, struct dev_pm_opp *new_opp, struct opp_table *opp_table); +int _opp_add(struct device *dev, struct dev_pm_opp *new_opp, struct opp_table *opp_table, bool rate_not_available); int _opp_add_v1(struct opp_table *opp_table, struct device *dev, unsigned long freq, long u_volt, bool dynamic); void _dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask, bool of); struct opp_table *_add_opp_table(struct device *dev); From patchwork Mon Apr 9 11:43:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 133028 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp168208ljb; Mon, 9 Apr 2018 04:44:24 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+h+5x1GRmf8L0797ljTmEpI+mPIVYRPdu4s4cgZgmMoBO8kTatTn9h9RJvWwFBL/iFmDKc X-Received: by 10.99.141.200 with SMTP id z191mr24735565pgd.418.1523274264212; Mon, 09 Apr 2018 04:44:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523274264; cv=none; d=google.com; s=arc-20160816; b=t4kIty/W6cY44XAKW4SktjO/ex+p7bAd5SaqBVu2fepq6Ca/WDp8QIbgw4tEdWm4mk AKn9GSC7X2UNm8CXO78tv329dKXrvwwxttkP3+PT4s8L3BUtTvIJHLVuGtWB2lDlmef7 jgTQChktCz1OLt0iX5uKRY9xHZ/G8a2dQD0wJQJ/q/d9H88vMd0ct3hKuBxowBHQ2+eQ tNIPMVRnCPKObGKNChCXP+F6ofYhZkgyytuvnfCVGbw+Quc1uSYKfbJe7GL8NjucKdPO 1yPxFGPFD6HAf1grJe8uinUfL9HxDJI5BkOm0ygKRRExbz0+bpwNbeMXc2btsulzTUo7 tIzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=WdS1s08ambvg+/6ENbYIlW1EjELUFM/jas13qlT23FY=; b=1G7Cu+VAnKiUrV6/hTQ/3lMd1grUaUFiCYEsI6Hdfw5hi5Wfk2t1wl+JzUOiZim4v4 NYTY0sHUdDMiRP7lGvwtQj0cAgNVRfIPH09tb6bWCz/61t7CSY6jj0OH1pOZ/WuaDH6d sp3BAXfJYcYQQ8r+T7xf41s2jdzd/1iA0vzQny4q7lssrHmfSHCDdru2Meu/yELq+lp7 F+yTF/W7ReIikY6eqz1nmB8ixsnnsRMurgFFhZXQoM3NBMeNi1q4o751ZiL18lcM+XEw 32JE4pYBdLE4pDQqnVlG675/wijToM/CYO+AkO928gdLGZT6GzXGa6DNc46s0APcDPH2 irwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Rx+aZzAX; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j188si105815pgc.584.2018.04.09.04.44.23; Mon, 09 Apr 2018 04:44:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Rx+aZzAX; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1751707AbeDILoX (ORCPT + 11 others); Mon, 9 Apr 2018 07:44:23 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:45372 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751728AbeDILoW (ORCPT ); Mon, 9 Apr 2018 07:44:22 -0400 Received: by mail-pg0-f66.google.com with SMTP id y63so145285pgy.12 for ; Mon, 09 Apr 2018 04:44:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=WdS1s08ambvg+/6ENbYIlW1EjELUFM/jas13qlT23FY=; b=Rx+aZzAX95hH22Jf7U+F/Z183LburqQIvUkShSx9/sIyyZib9sUiJbPeahtx6MP4B3 2dzgd2fSNIpBXl+1bprPlyReyT7ymJyettaV918Tic9/eVb9mYZ6788CySRreD6xUM5t NiRk9JNIJnA93q1Rc8CdzwZvbpNd01fFXtTyU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=WdS1s08ambvg+/6ENbYIlW1EjELUFM/jas13qlT23FY=; b=LRtDnJMQQgf8tHHa8otpI4fxdW6fI2oyapVUaBbZ45Hzb0dIRie6ro14or7OEzCVVp 9ozCiYZvqgs5Iz7X5dzjpJroCI3gN3zSjHA46epDeae+KH0sFCUD8is2SmexGJNsobJ1 vXGC8eRIcC+0bLJc6q7pgnWd9M6oBPOiBNnt14R1gBZMDiOqu+xEplYyv5gsEp53nPDT W8UO5mopec1EQWORLXnFnB7lSatTAGzfCx/tcokznKlVWv0DAVBRZQ/TyHBhOfaiyT1y /ad41SlZxybMBeqfn6LfJZnU39t5FBIPMpHYh9h6lnIMwfN9zR/gsE1flVAr/znky1Hg 1QVQ== X-Gm-Message-State: AElRT7H+oPGI9klIurxFPJGjWcmaujn7zhCKpNEON2Kph4BHMjOvLuob CE5iRlqSdTnrkhB3BEcqFKBfAw== X-Received: by 10.98.194.195 with SMTP id w64mr29082692pfk.83.1523274261983; Mon, 09 Apr 2018 04:44:21 -0700 (PDT) Received: from localhost ([122.171.228.188]) by smtp.gmail.com with ESMTPSA id 86sm824818pfh.93.2018.04.09.04.44.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Apr 2018 04:44:21 -0700 (PDT) From: Viresh Kumar To: Ulf Hansson , Stephen Boyd , Viresh Kumar , Nishanth Menon , "Rafael J. Wysocki" Cc: Viresh Kumar , Rajendra Nayak , Vincent Guittot , linux-pm@vger.kernel.org Subject: [PATCH V2 04/11] PM / OPP: Implement dev_pm_opp_of_add_table_indexed() Date: Mon, 9 Apr 2018 17:13:44 +0530 Message-Id: <30a8780632ca0d32dc8cf52ee12cef840a3a032d.1523273291.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The "operating-points-v2" property can contain a list of phandles now, specifically for the power domain providers that provide multiple domains. Add support to parse that. Signed-off-by: Viresh Kumar Reviewed-by: Ulf Hansson --- drivers/opp/of.c | 50 +++++++++++++++++++++++++++++++++++++++++--------- include/linux/pm_opp.h | 6 ++++++ 2 files changed, 47 insertions(+), 9 deletions(-) -- 2.15.0.194.g9af6a3dea062 diff --git a/drivers/opp/of.c b/drivers/opp/of.c index c5c5afcaa2e3..cba669cd00c5 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -250,20 +250,17 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_of_remove_table); /* Returns opp descriptor node for a device node, caller must * do of_node_put() */ -static struct device_node *_opp_of_get_opp_desc_node(struct device_node *np) +static struct device_node *_opp_of_get_opp_desc_node(struct device_node *np, + int index) { - /* - * There should be only ONE phandle present in "operating-points-v2" - * property. - */ - - return of_parse_phandle(np, "operating-points-v2", 0); + /* "operating-points-v2" can be an array for power domain providers */ + return of_parse_phandle(np, "operating-points-v2", index); } /* Returns opp descriptor node for a device, caller must do of_node_put() */ struct device_node *dev_pm_opp_of_get_opp_desc_node(struct device *dev) { - return _opp_of_get_opp_desc_node(dev->of_node); + return _opp_of_get_opp_desc_node(dev->of_node, 0); } EXPORT_SYMBOL_GPL(dev_pm_opp_of_get_opp_desc_node); @@ -517,6 +514,41 @@ int dev_pm_opp_of_add_table(struct device *dev) } EXPORT_SYMBOL_GPL(dev_pm_opp_of_add_table); +/** + * dev_pm_opp_of_add_table_indexed() - Initialize indexed opp table from device tree + * @dev: device pointer used to lookup OPP table. + * @index: Index number. + * + * Register the initial OPP table with the OPP library for given device only + * using the "operating-points-v2" property. + * + * Return: + * 0 On success OR + * Duplicate OPPs (both freq and volt are same) and opp->available + * -EEXIST Freq are same and volt are different OR + * Duplicate OPPs (both freq and volt are same) and !opp->available + * -ENOMEM Memory allocation failure + * -ENODEV when 'operating-points' property is not found or is invalid data + * in device node. + * -ENODATA when empty 'operating-points' property is found + * -EINVAL when invalid entries are found in opp-v2 table + */ +int dev_pm_opp_of_add_table_indexed(struct device *dev, int index) +{ + struct device_node *opp_np; + int ret; + + opp_np = _opp_of_get_opp_desc_node(dev->of_node, index); + if (!opp_np) + return -ENODEV; + + ret = _of_add_opp_table_v2(dev, opp_np); + of_node_put(opp_np); + + return ret; +} +EXPORT_SYMBOL_GPL(dev_pm_opp_of_add_table_indexed); + /* CPU device specific helpers */ /** @@ -621,7 +653,7 @@ int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, } /* Get OPP descriptor node */ - tmp_np = _opp_of_get_opp_desc_node(cpu_np); + tmp_np = _opp_of_get_opp_desc_node(cpu_np, 0); of_node_put(cpu_np); if (!tmp_np) { pr_err("%pOF: Couldn't find opp node\n", cpu_np); diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 6c2d2e88f066..f042fdeaaa3c 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -303,6 +303,7 @@ static inline void dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask #if defined(CONFIG_PM_OPP) && defined(CONFIG_OF) int dev_pm_opp_of_add_table(struct device *dev); +int dev_pm_opp_of_add_table_indexed(struct device *dev, int index); void dev_pm_opp_of_remove_table(struct device *dev); int dev_pm_opp_of_cpumask_add_table(const struct cpumask *cpumask); void dev_pm_opp_of_cpumask_remove_table(const struct cpumask *cpumask); @@ -314,6 +315,11 @@ static inline int dev_pm_opp_of_add_table(struct device *dev) return -ENOTSUPP; } +static inline int dev_pm_opp_of_add_table_indexed(struct device *dev, int index) +{ + return -ENOTSUPP; +} + static inline void dev_pm_opp_of_remove_table(struct device *dev) { } From patchwork Mon Apr 9 11:43:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 133029 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp168256ljb; Mon, 9 Apr 2018 04:44:27 -0700 (PDT) X-Google-Smtp-Source: AIpwx49OFIxRosBUGh71AQQ2AoVwt84E6rlA7z4s3ce4gJ39va4rd2hdp4ypLgXrBbb82VTekGbL X-Received: by 10.101.76.207 with SMTP id n15mr25371059pgt.313.1523274267095; Mon, 09 Apr 2018 04:44:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523274267; cv=none; d=google.com; s=arc-20160816; b=RmasGHseUFKvzMIFRX5RahVjm7OTVDd7iqtMT9qx3aFi5C2iWWTJxHnnXU37Bs4dLh BjMO3+RnlhBm0h5R/d0Fr7nO/abTvBMlF8QjDOiKkkXuSS3qceZ5I/5qu6jPykgQwZz3 MfoF1JsvMkzbyyp8Mk0gv+YLkhPFpGVQRlDNTjjooxeUgdz0w4tFYI1/9kCV1Qv/IpFy F3pO8Ig0KoitnqmD5qD2drJDLFMlzywia8GU6PuE+bdYtgp6XNCjSBsIbHdw2CGwbgBH vjzXZhVi2vQ0oLLAAvxaCpUeF+AxlKpRmO8CvTzN/lHYStbzT/q26eBpBn3RWN04hDgD wTNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=Dyz16f/J6MR66QggqKEx5zGMjJYj7H8uGvs95bHqvQg=; b=MwQykeLXBMiSUhncQJf56rfozdXS8afGyJwvkl+V5DhTjneBxPLPJ/C+TRDnADeTer 5RpbHQsyvwVxlvTOaeebm70kKY2yabeyXzqMMo5I31EggIS0L8OC+rkGE7jNIXN31Q42 skqchEYlpM3yKS98iQJHEvldlwKcQggNsuiaFZxisdyUNlF+gqFAic5YuTyxBbxysK6a HMKi9/T43zRgAt6umxYXNr7Qg1mdgcitYLIMUbctzroQID2p4FC9T2yGOv+jY+tyHjX1 wiBg4KE6VP1JZ4H+DYO57WBxdoMwiIFeFD62i+bdJNaX7VvhlzYpbb3XpKqbRjv0WGrB /ogQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FtuLRDJ0; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j188si105815pgc.584.2018.04.09.04.44.26; Mon, 09 Apr 2018 04:44:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FtuLRDJ0; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1751738AbeDILo0 (ORCPT + 11 others); Mon, 9 Apr 2018 07:44:26 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:35028 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751581AbeDILoZ (ORCPT ); Mon, 9 Apr 2018 07:44:25 -0400 Received: by mail-pf0-f196.google.com with SMTP id u86so5661316pfd.2 for ; Mon, 09 Apr 2018 04:44:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=Dyz16f/J6MR66QggqKEx5zGMjJYj7H8uGvs95bHqvQg=; b=FtuLRDJ0Mf/B1F9Nh6ATOJLo3sehbbtzbogVzrVydk1g8eGyE2QNHkoS0CwFBKpuVy mNP5hBUFjMEOoo/efE2n09KJV9L3VYLuZyhJejDeZD22c1BFwAJPq1a6UZbskm5YmmVS cHIze0nfGs2drENunramYofcma3tUlPlaemBg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=Dyz16f/J6MR66QggqKEx5zGMjJYj7H8uGvs95bHqvQg=; b=Oya/lS7VIp+MNKrNZXOVoJD645ykkOlf3qx+rt1z6phm8YPx5AEPHBY22ph6Lvuw4u hAv0tAYKiCLnf7z4NqPpPTXVGZqXoPZINkD7C5LeRifnmfw6Vg1SkxhWUng2oq/5DhfW zDMjZBohU9YkSEeZpuSndtLi9bP2lT5ISaMfscxC1IIKOv7rtXMuM7nuV/zksH3fBbye 0EK5y9mx4O/Ia02SK9TJCVODWjbdQ3dR9D2P1tiVC41Z3M2lTlLguXPl+sY2mKwRt+8J pY4tW7Yt/UG0tKt+2FU5CyDeI8eu5r6To2EOL55IP9X57esJvRbchJ/I4kpSKuREDi/V m3Yg== X-Gm-Message-State: AElRT7FIlVJPgWCLH99S5UcwbXRhaKJq+h8qzh7Ue0vv/jWFgSpDYZj4 6g4+QaEcV7vgsIR9qkPWrcMm/g== X-Received: by 10.99.136.194 with SMTP id l185mr25303738pgd.419.1523274265028; Mon, 09 Apr 2018 04:44:25 -0700 (PDT) Received: from localhost ([122.171.228.188]) by smtp.gmail.com with ESMTPSA id u6sm451590pgo.1.2018.04.09.04.44.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Apr 2018 04:44:24 -0700 (PDT) From: Viresh Kumar To: Ulf Hansson , Stephen Boyd , Viresh Kumar , Nishanth Menon , "Rafael J. Wysocki" Cc: Viresh Kumar , Rajendra Nayak , Vincent Guittot , linux-pm@vger.kernel.org Subject: [PATCH V2 05/11] PM / OPP: Implement of_dev_pm_opp_find_required_opp() Date: Mon, 9 Apr 2018 17:13:45 +0530 Message-Id: X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org A device's DT node or its OPP nodes can contain a phandle to other device's OPP node, in the "required-opps" property. This patch implements a routine to find that required OPP from the node that contains the "required-opps" property. Signed-off-by: Viresh Kumar Reviewed-by: Ulf Hansson --- drivers/opp/core.c | 4 +--- drivers/opp/of.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++ drivers/opp/opp.h | 1 + include/linux/pm_opp.h | 6 ++++++ 4 files changed, 62 insertions(+), 3 deletions(-) -- 2.15.0.194.g9af6a3dea062 diff --git a/drivers/opp/core.c b/drivers/opp/core.c index a0f72c732718..416f54ba7a26 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -33,8 +33,6 @@ LIST_HEAD(opp_tables); /* Lock to allow exclusive modification to the device and opp lists */ DEFINE_MUTEX(opp_table_lock); -static void dev_pm_opp_get(struct dev_pm_opp *opp); - static struct opp_device *_find_opp_dev(const struct device *dev, struct opp_table *opp_table) { @@ -901,7 +899,7 @@ static void _opp_kref_release(struct kref *kref) dev_pm_opp_put_opp_table(opp_table); } -static void dev_pm_opp_get(struct dev_pm_opp *opp) +void dev_pm_opp_get(struct dev_pm_opp *opp) { kref_get(&opp->kref); } diff --git a/drivers/opp/of.c b/drivers/opp/of.c index cba669cd00c5..6380ec3d695b 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -673,3 +673,57 @@ int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, return ret; } EXPORT_SYMBOL_GPL(dev_pm_opp_of_get_sharing_cpus); + +/** + * of_dev_pm_opp_find_required_opp() - Search for required OPP. + * @dev: The device whose OPP node is referenced by the 'np' DT node. + * @np: Node that contains the "required-opps" property. + * + * Returns the OPP of the device 'dev', whose phandle is present in the "np" + * node. Although the "required-opps" property supports having multiple + * phandles, this helper routine only parses the very first phandle in the list. + * + * Return: Matching opp, else returns ERR_PTR in case of error and should be + * handled using IS_ERR. + * + * The callers are required to call dev_pm_opp_put() for the returned OPP after + * use. + */ +struct dev_pm_opp *of_dev_pm_opp_find_required_opp(struct device *dev, + struct device_node *np) +{ + struct dev_pm_opp *temp_opp, *opp = ERR_PTR(-ENODEV); + struct device_node *required_np; + struct opp_table *opp_table; + + opp_table = _find_opp_table(dev); + if (IS_ERR(opp_table)) + return ERR_CAST(opp_table); + + required_np = of_parse_phandle(np, "required-opps", 0); + if (unlikely(!required_np)) { + dev_err(dev, "Unable to parse required-opps\n"); + goto put_opp_table; + } + + mutex_lock(&opp_table->lock); + + list_for_each_entry(temp_opp, &opp_table->opp_list, node) { + if (temp_opp->available && temp_opp->np == required_np) { + opp = temp_opp; + + /* Increment the reference count of OPP */ + dev_pm_opp_get(opp); + break; + } + } + + mutex_unlock(&opp_table->lock); + + of_node_put(required_np); +put_opp_table: + dev_pm_opp_put_opp_table(opp_table); + + return opp; +} +EXPORT_SYMBOL_GPL(of_dev_pm_opp_find_required_opp); diff --git a/drivers/opp/opp.h b/drivers/opp/opp.h index 381a4fb15d5c..f9eccf9811ae 100644 --- a/drivers/opp/opp.h +++ b/drivers/opp/opp.h @@ -187,6 +187,7 @@ struct opp_table { }; /* Routines internal to opp core */ +void dev_pm_opp_get(struct dev_pm_opp *opp); void _get_opp_table_kref(struct opp_table *opp_table); int _get_opp_count(struct opp_table *opp_table); struct opp_table *_find_opp_table(struct device *dev); diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index f042fdeaaa3c..70686f434c13 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -309,6 +309,7 @@ int dev_pm_opp_of_cpumask_add_table(const struct cpumask *cpumask); void dev_pm_opp_of_cpumask_remove_table(const struct cpumask *cpumask); int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask); struct device_node *dev_pm_opp_of_get_opp_desc_node(struct device *dev); +struct dev_pm_opp *of_dev_pm_opp_find_required_opp(struct device *dev, struct device_node *np); #else static inline int dev_pm_opp_of_add_table(struct device *dev) { @@ -342,6 +343,11 @@ static inline struct device_node *dev_pm_opp_of_get_opp_desc_node(struct device { return NULL; } + +static inline struct dev_pm_opp *of_dev_pm_opp_find_required_opp(struct device *dev, struct device_node *np) +{ + return NULL; +} #endif #endif /* __LINUX_OPP_H__ */ From patchwork Mon Apr 9 11:43:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 133030 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp168295ljb; Mon, 9 Apr 2018 04:44:29 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+x6veBUIEuuneoiF73wSncRxt0e70qgc4VEGHTNTQLEkLBi3yJk5+AQ0dryfryt/8YGih5 X-Received: by 2002:a17:902:d20a:: with SMTP id t10-v6mr5114523ply.151.1523274269705; Mon, 09 Apr 2018 04:44:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523274269; cv=none; d=google.com; s=arc-20160816; b=ECGQ6xyQH2IiSHQURNM1+Icvjc7mb+LPzEVOsXeJAvFOWAaW3GOsFuttF9Yva3AENx 5qw7QHVRKDUiBlyV/hBIshIuPeV4FQcLgK1B4R7i6CiCRNtso2lJoo7A5ON9wJV3m8Gc WArJRM7eBaNSzK7jhgpALB6qnrXFx8tx/KaytnC6bBHR7Yip2qlTCtzMHLtK/hMk7olJ 122XQKeMtVNSsIGuyk3MesbXIRF0kHTIbHt7ItsLxAHl5eLmwyL8gnfR1NuuBZRxrULr nEQ8oLK4H+JsYkAiNWx7MEIZ95HUj9y0CH0w/crJARzI+nqpjuz5PXGFg+/ksZ5XSfK8 v+kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=sLm6WLhZDo0FcUDbqamsSacxR00r3oXmusMjKz4Cd5E=; b=T4FSCnpDVpcYcYYFS4yYE114Z8ENUH1D+E7Fau3qWpmZ1QqlT21/jJ8WyLW+4HdPJG YD/9QMMjT9qfucMyRZr+nDUfx2BVI/pQFuX3kxJgdCwNczJP+uxbgcWbIRUj6C0N6exL ktuYEUyVm1szgznVr1xsNhvrhKMXEG6lGWqj6/+o7v+p6IgEnBBuBKvF3Ta2RH5LiBUd +pp0CIk2++Owync4PHT1VdkdNS31kKIJBkspNC9x7qY/G+8aN0jM1Fx+hQYZQCkFM4IX nkdUzzr5p6tRpj37Ac6kxT+DApO/ml3AaNUcWrQIJYOd2Rc01iqDwQLsDccT9LFPDsaK i7SA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=klx+uqQs; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j188si105815pgc.584.2018.04.09.04.44.29; Mon, 09 Apr 2018 04:44:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=klx+uqQs; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1751856AbeDILo2 (ORCPT + 11 others); Mon, 9 Apr 2018 07:44:28 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:38874 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751728AbeDILo2 (ORCPT ); Mon, 9 Apr 2018 07:44:28 -0400 Received: by mail-pl0-f67.google.com with SMTP id c7-v6so1706102plr.5 for ; Mon, 09 Apr 2018 04:44:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=sLm6WLhZDo0FcUDbqamsSacxR00r3oXmusMjKz4Cd5E=; b=klx+uqQsPAlKIiCE43xNvm7jGLU8fLXtW4MTNM3F08LX2fH3idFpA8/FQKoO8GEeg0 EbsZvQzfui22r6hHpUcgzcUG+pHgbnMEpammEtAiJd4ULFK2flBeLA5x9d1koXNY0Xl6 TeIMtq9mjYyiTFyK3aNYf/sx8waiEPduF7/bQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=sLm6WLhZDo0FcUDbqamsSacxR00r3oXmusMjKz4Cd5E=; b=m7TjQkw6A5v0KRywUEDyuF2BUcIoQmh/WADCAt7FFDglbQKw6FRVa6xCv1c0H/EIcO iBfWR5Xul1mZP2wzlFieXbZkh6RrKreOB3cqE5+BpBYehhYhUMa5/RnoYKvqj5lbg9HM ajzbwiolvnyz/JM1lEEXh/KKuwBRd1KCO3QzjVKlD7geY6QjgFcC7Nin5z7+3Jxi75AN My0TTNSKzPEf4sERD9mXAlRdff3Y7C9w48a3XI5MR1fMZ0eSn4QqYvmdnd/DEppVwUXS BRpChB+WfxndnwmZGOJUelBGV6KCXtrYcPXIA6qsasyEIBSnR1aG41Hk4+ESG9EItFuD T1HA== X-Gm-Message-State: AElRT7HWNvXxOK/KSB/s7SZ18FmnfwSMGvwkLenIsG75xTvre/FLefiz gg+bdaVt0q4Xfsn65qjZQbLUyw== X-Received: by 2002:a17:902:900a:: with SMTP id a10-v6mr39348910plp.142.1523274267790; Mon, 09 Apr 2018 04:44:27 -0700 (PDT) Received: from localhost ([122.171.228.188]) by smtp.gmail.com with ESMTPSA id k73sm459290pgc.55.2018.04.09.04.44.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Apr 2018 04:44:27 -0700 (PDT) From: Viresh Kumar To: Ulf Hansson , Stephen Boyd , Viresh Kumar , Nishanth Menon , "Rafael J. Wysocki" Cc: Viresh Kumar , Rajendra Nayak , Vincent Guittot , linux-pm@vger.kernel.org, Jordan Crouse Subject: [PATCH V2 06/11] PM / OPP: Implement dev_pm_opp_get_of_node() Date: Mon, 9 Apr 2018 17:13:46 +0530 Message-Id: X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org This adds a new helper to let the power domain drivers to access opp->np, so that they can read platform specific properties from the node. Signed-off-by: Jordan Crouse Signed-off-by: Rajendra Nayak Signed-off-by: Viresh Kumar --- drivers/opp/of.c | 19 +++++++++++++++++++ include/linux/pm_opp.h | 5 +++++ 2 files changed, 24 insertions(+) -- 2.15.0.194.g9af6a3dea062 Reviewed-by: Ulf Hansson diff --git a/drivers/opp/of.c b/drivers/opp/of.c index 6380ec3d695b..de41e68b780f 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -727,3 +727,22 @@ struct dev_pm_opp *of_dev_pm_opp_find_required_opp(struct device *dev, return opp; } EXPORT_SYMBOL_GPL(of_dev_pm_opp_find_required_opp); + +/** + * dev_pm_opp_get_of_node() - Gets the DT node corresponding to an opp + * @opp: opp for which DT node has to be returned for + * + * Return: DT node corresponding to the opp, else 0 on success. + * + * The caller needs to put the node with of_node_put() after using it. + */ +struct device_node *dev_pm_opp_get_of_node(struct dev_pm_opp *opp) +{ + if (IS_ERR_OR_NULL(opp)) { + pr_err("%s: Invalid parameters\n", __func__); + return NULL; + } + + return of_node_get(opp->np); +} +EXPORT_SYMBOL_GPL(dev_pm_opp_get_of_node); diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 70686f434c13..8fd34c4398b2 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -310,6 +310,7 @@ void dev_pm_opp_of_cpumask_remove_table(const struct cpumask *cpumask); int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask); struct device_node *dev_pm_opp_of_get_opp_desc_node(struct device *dev); struct dev_pm_opp *of_dev_pm_opp_find_required_opp(struct device *dev, struct device_node *np); +struct device_node *dev_pm_opp_get_of_node(struct dev_pm_opp *opp); #else static inline int dev_pm_opp_of_add_table(struct device *dev) { @@ -348,6 +349,10 @@ static inline struct dev_pm_opp *of_dev_pm_opp_find_required_opp(struct device * { return NULL; } +static inline struct device_node *dev_pm_opp_get_of_node(struct dev_pm_opp *opp) +{ + return NULL; +} #endif #endif /* __LINUX_OPP_H__ */ From patchwork Mon Apr 9 11:43:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 133031 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp168325ljb; Mon, 9 Apr 2018 04:44:32 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+zfynJiD1WYPoC0I/Ptpvt75WO7CbRSQGb880Vc8CUIvG0DzepTsxrkzdB3yLg5M2lrHXy X-Received: by 2002:a17:902:71cc:: with SMTP id t12-v6mr31254648plm.247.1523274272613; Mon, 09 Apr 2018 04:44:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523274272; cv=none; d=google.com; s=arc-20160816; b=YFZJY1cNwO5mp6QrkaLPr7RU4+TPjgAAWUXcyG5Z9WuCL5T6MEnwtxPA2MRV9u++Qm URfKspFUIY6lkGu4+UzBQnWmTBb/n7ZjBqZ1V3okfSNqDFTcJYJ8k9YbWcFDczoXB+Lr C2lrG/way66oeZ2llxx630GXoVJZHNcwkclfv9/lsiSdTUdkVKP8BplPhVJnnVqrpwQv wX3wQSjvJGuVS4oi0UTwg9+LJObw9bTGqkJj87NtKPlb1kMia/Nz/Z1EZ+ApZ8Hlt6Bg xfMy9cqsU4MzZzRn89MPAuKsDTKAL4ZQk9nTm1WwxThSxjWRlfvjy8H8rIItY4Uj5OhZ JSJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=SXUdyoqeBQisja62usOsgGFOjGqvl1XoLQLEjGJ8Rnk=; b=VZGm+l0e99ciiH9Ew3iBWfMEet8yMd0P/8Zm5uaAv4qbC4sPXjgKHL9GsMPaYn54+p ZBgbwLNa4sQNxTfR1XEx4WuGUOI5rYpkGuG1V84P1IxEBG4xHZLK4NbJlcyjE01+aIMJ Fbpt1pvC1adej8XddqMhnphQ/l1uKymmG9n6L4puUbOKNhFmX4tBiGU47KrHbBd8z5gc Y8uRQ1vPDeg9gw7KPvrvaowZ0nhvZWG07Ox6deLjN/o0Dj5ID9h9vOy+RD1l3KnAEBTr ArXDeYpuUGxLSuP+udfsq4MytfFWn+soDD9mQmVx+ZxKYzzSs3L/H6YeErZEWc88fgYO OFEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J+IuPCAG; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j188si105815pgc.584.2018.04.09.04.44.32; Mon, 09 Apr 2018 04:44:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J+IuPCAG; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1752181AbeDILob (ORCPT + 11 others); Mon, 9 Apr 2018 07:44:31 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:45543 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751728AbeDILob (ORCPT ); Mon, 9 Apr 2018 07:44:31 -0400 Received: by mail-pl0-f65.google.com with SMTP id e22-v6so3200653plj.12 for ; Mon, 09 Apr 2018 04:44:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=SXUdyoqeBQisja62usOsgGFOjGqvl1XoLQLEjGJ8Rnk=; b=J+IuPCAGx1ZfZTJGlBUqLp7WL/q+Tq+U1EX3pdy6Y8NcTHIMuSd+e/GxKMMLNwg/ad jMRdGV00l/t2uzoZWKVSzYH7YpHPwYxJwcFLrOM7TwGnJz6nCvMpJ/0RUPtTYL0LeuEh FEJQ/8gF8e+m9JQ1W3L1gVD0grFfnjokfyzMo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=SXUdyoqeBQisja62usOsgGFOjGqvl1XoLQLEjGJ8Rnk=; b=J9cfkvvQTz5IGWG+J7wTVWwU2f8aXCqWzBwE+Bbz6U3YR2eRhBqqBvmSCxNLRnCP0a K4hJQ4RHfgM5xgzlk8EAREqvSdMsnC0+oDLeIudthI+ABI8RJcbr404R2c1UPASaMOn8 9uuFTT0r7KqtAbyS05QVR4XZ7TYbvUMbWosINbz2rDpxndU4763kDhj0/HF/mHSuPB7G 0Ickt8AIdFwA7QsRsgm3T61tpX5gvivY/8KYZEFZtoxHGHLI5NRN2xXskV6NIDgOD6+7 18VXAKfKL9SRHKhwZQ5g2HNKrBhsopClF+mXh+7TmQekrFDVpZ4TTb98b5Hg9hQutUcb fiXg== X-Gm-Message-State: AElRT7HA1udh2+RSRRU/LRA0gciBaxYkDzQrpNmKcceHc1NA+FSYkoHA MZ96rx6NAQsvil4Ryj4iUodMfQ== X-Received: by 2002:a17:902:41:: with SMTP id 59-v6mr39019898pla.248.1523274270550; Mon, 09 Apr 2018 04:44:30 -0700 (PDT) Received: from localhost ([122.171.228.188]) by smtp.gmail.com with ESMTPSA id j83sm590045pfe.178.2018.04.09.04.44.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Apr 2018 04:44:30 -0700 (PDT) From: Viresh Kumar To: Ulf Hansson , Stephen Boyd , "Rafael J. Wysocki" , Kevin Hilman , Pavel Machek , Len Brown Cc: Viresh Kumar , Rajendra Nayak , Vincent Guittot , linux-pm@vger.kernel.org Subject: [PATCH V2 07/11] PM / Domain: Add struct device to genpd Date: Mon, 9 Apr 2018 17:13:47 +0530 Message-Id: <26cfcef726e24a578768ea75ade5fd9b2fb19254.1523273291.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The power-domain core would be using the OPP core going forward and the OPP core has the basic requirement of a device structure for its working. Add a struct device to the genpd structure. This doesn't register the device with device core as the "dev" pointer is mostly used by the OPP core as a cookie for now and registering the device is not mandatory. Signed-off-by: Viresh Kumar --- drivers/base/power/domain.c | 3 +++ include/linux/pm_domain.h | 1 + 2 files changed, 4 insertions(+) -- 2.15.0.194.g9af6a3dea062 Acked-by: Ulf Hansson diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 1ea0e2502e8e..4a3dc9cc0848 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -1696,6 +1696,9 @@ int pm_genpd_init(struct generic_pm_domain *genpd, return ret; } + device_initialize(&genpd->dev); + dev_set_name(&genpd->dev, "%s", genpd->name); + mutex_lock(&gpd_list_lock); list_add(&genpd->gpd_list_node, &gpd_list); mutex_unlock(&gpd_list_lock); diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index 04dbef9847d3..aaacaa35005d 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h @@ -49,6 +49,7 @@ struct genpd_power_state { struct genpd_lock_ops; struct generic_pm_domain { + struct device dev; struct dev_pm_domain domain; /* PM domain operations */ struct list_head gpd_list_node; /* Node in the global PM domains list */ struct list_head master_links; /* Links with PM domain as a master */ From patchwork Mon Apr 9 11:43:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 133035 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp168555ljb; Mon, 9 Apr 2018 04:44:50 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/9HkS9d9mNF9jiWdUDiHLOIb/SQ9kayVk2YB8YQXGvRj9gBb/hoG/2ECIepzvN1fteavQL X-Received: by 10.99.98.196 with SMTP id w187mr25317482pgb.307.1523274290367; Mon, 09 Apr 2018 04:44:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523274290; cv=none; d=google.com; s=arc-20160816; b=i2hWp7B5+UaigJQT5l+PzcWmepV2uvDamoMkmNQKi/4PE9T/mrKKV+J7CohknpeK4P F3qbsZmS05SIiTvld52w5cTLg+UJ7LRBikYq8UlzC/k2K8PHMVH/+knXBeRIbMnMF/5L Zghajm3VuumzNBaDhiLKQpsWS3DPKqkUz9FhMbaQMYe1RoKVA1wDh2YO0YVjcmnsk/G6 LrSsGtZ0C1BoXoYHvBZUXDltII7k3rs0NGqJIaI6xD5bQa2qJioksd0LxqRZS+rhHKZm rpYgK9GfECdegOOriXUQcIV6LeVSkRQhO7htKtj1S+NayXumAh9AWLU9EBwQiYYnuR+u LhFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=UNtc9YLsR9gj7PTNfDn6DdyccZp+9CPTGr/+AQJ4onM=; b=lgT4FN6QZ8V5K6TdO4UPd+zbRhpvnWD1pyVuH90Y+2Y7mNbun/La7WDYBIV0KXF4BX UOT0SG4aDjfNE4VgDF5JGcxkLGgquybh60WwCjW9w8A4GKs5sxJckbRcgQnaVUvpNqp0 bctb+u85Z7TR09z89ZFsHCVzBLNCar+ufOnnZHfQaR9evT2i7xTNcbwJX+HhCY0G6vcg onFSaOlm3AWaEMICjep3bXmSjKrNew7CRKaShSLjpVUIm9/bgdLdmD/Hm07OXuwdgdqk yQuUPSjYhMTQddGIdsAHL34AoMPH6c3ricUJ65sn3SEOK1AXwAdaHbg+A70RKp4cnJ8c 2eGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=C++dqY8G; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n11-v6si153720pls.422.2018.04.09.04.44.50; Mon, 09 Apr 2018 04:44:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=C++dqY8G; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1751794AbeDILot (ORCPT + 11 others); Mon, 9 Apr 2018 07:44:49 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:35305 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751851AbeDILod (ORCPT ); Mon, 9 Apr 2018 07:44:33 -0400 Received: by mail-pg0-f65.google.com with SMTP id j3so145201pgf.2 for ; Mon, 09 Apr 2018 04:44:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=UNtc9YLsR9gj7PTNfDn6DdyccZp+9CPTGr/+AQJ4onM=; b=C++dqY8GhMqDIJVITgV+Mwn+g5eMxnuaNopuMMAAVLSX6WaBB1gABuhtppe+wnJthD 2TuQ8sLR4E/kYCEfX6hiWe7x+UAkbijHlaYl4pZYuUSKmep+X2LeR565qeMesZdVXzyC 2tJ6MWWKe6xHgsBgasHddOnR7v7snvGa4kcqw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=UNtc9YLsR9gj7PTNfDn6DdyccZp+9CPTGr/+AQJ4onM=; b=NZeo9jSUeKi1bwQEYYShHCO76V79tvT8sZM+8cKOiHm+fkvTxEJC6LApc180NZmYaw NLMbxhWe9aB9sw0ew+UDUoVvwGG+9FdP1voLT/J4cJdh8qHNwkNu3xCLNQJYXTB2JVnk FFETSGV72mr4FEML9vnQKKt9p9aohXa9NtjeaU4TP5ug2gp0BPpiZxO1hjm6I1PGGNpu hmH4OGq8i206qoyVl3CSjZ4Jypg3tvAt2/H+mffZGzIvPJFNMX03xZHQEv4y+zULk0ze G68rgm7dTOBsqJ3c4YbSdVfY7GJ3Ad/jf+P1iEgepf9YiVK9nLbw9RU5kIZB2kBTdoGe /1cw== X-Gm-Message-State: ALQs6tAh18nlml7+NHqECBWijCSV4YPhycfBJMWoXbvqx0Q6f92Wb96R CPdjaxIH8hktGMRAV1dG+yUsKg== X-Received: by 10.99.127.3 with SMTP id a3mr11489004pgd.267.1523274273362; Mon, 09 Apr 2018 04:44:33 -0700 (PDT) Received: from localhost ([122.171.228.188]) by smtp.gmail.com with ESMTPSA id p1sm681794pgc.15.2018.04.09.04.44.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Apr 2018 04:44:32 -0700 (PDT) From: Viresh Kumar To: Ulf Hansson , Stephen Boyd , "Rafael J. Wysocki" , Kevin Hilman , Pavel Machek , Len Brown Cc: Viresh Kumar , Rajendra Nayak , Vincent Guittot , linux-pm@vger.kernel.org Subject: [PATCH V2 08/11] PM / Domain: Add support to parse domain's OPP table Date: Mon, 9 Apr 2018 17:13:48 +0530 Message-Id: X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The generic power domains can have an OPP table for themselves now, and phandle of their OPP nodes can be used by the devices powered by the domain. In order for the OPP core to translate requirements between the devices and their power domains, both need to have an OPP table in kernel. Parse the OPP table for power domains if they have their set_performance_state() callback set. With this patch, an OPP table would be created for the genpd in kernel based on the OPP table present in DT, if the genpd have its set_performance_state() callback set. Signed-off-by: Viresh Kumar Acked-by: Ulf Hansson --- drivers/base/power/domain.c | 76 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 62 insertions(+), 14 deletions(-) -- 2.15.0.194.g9af6a3dea062 diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 4a3dc9cc0848..5c0019d70d76 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -1895,14 +1896,33 @@ int of_genpd_add_provider_simple(struct device_node *np, mutex_lock(&gpd_list_lock); - if (genpd_present(genpd)) { - ret = genpd_add_provider(np, genpd_xlate_simple, genpd); - if (!ret) { - genpd->provider = &np->fwnode; - genpd->has_provider = true; + if (!genpd_present(genpd)) + goto unlock; + + genpd->dev.of_node = np; + + /* Parse genpd OPP table */ + if (genpd->set_performance_state) { + ret = dev_pm_opp_of_add_table(&genpd->dev); + if (ret) { + dev_err(&genpd->dev, "Failed to add OPP table: %d\n", + ret); + goto unlock; } } + ret = genpd_add_provider(np, genpd_xlate_simple, genpd); + if (ret) { + if (genpd->set_performance_state) + dev_pm_opp_of_remove_table(&genpd->dev); + + goto unlock; + } + + genpd->provider = &np->fwnode; + genpd->has_provider = true; + +unlock: mutex_unlock(&gpd_list_lock); return ret; @@ -1917,6 +1937,7 @@ EXPORT_SYMBOL_GPL(of_genpd_add_provider_simple); int of_genpd_add_provider_onecell(struct device_node *np, struct genpd_onecell_data *data) { + struct generic_pm_domain *genpd; unsigned int i; int ret = -EINVAL; @@ -1929,13 +1950,27 @@ int of_genpd_add_provider_onecell(struct device_node *np, data->xlate = genpd_xlate_onecell; for (i = 0; i < data->num_domains; i++) { - if (!data->domains[i]) + genpd = data->domains[i]; + + if (!genpd) continue; - if (!genpd_present(data->domains[i])) + if (!genpd_present(genpd)) goto error; - data->domains[i]->provider = &np->fwnode; - data->domains[i]->has_provider = true; + genpd->dev.of_node = np; + + /* Parse genpd OPP table */ + if (genpd->set_performance_state) { + ret = dev_pm_opp_of_add_table_indexed(&genpd->dev, i); + if (ret) { + dev_err(&genpd->dev, "Failed to add OPP table for index %d: %d\n", + i, ret); + goto error; + } + } + + genpd->provider = &np->fwnode; + genpd->has_provider = true; } ret = genpd_add_provider(np, data->xlate, data); @@ -1948,10 +1983,16 @@ int of_genpd_add_provider_onecell(struct device_node *np, error: while (i--) { - if (!data->domains[i]) + genpd = data->domains[i]; + + if (!genpd) continue; - data->domains[i]->provider = NULL; - data->domains[i]->has_provider = false; + + genpd->provider = NULL; + genpd->has_provider = false; + + if (genpd->set_performance_state) + dev_pm_opp_of_remove_table(&genpd->dev); } mutex_unlock(&gpd_list_lock); @@ -1978,10 +2019,17 @@ void of_genpd_del_provider(struct device_node *np) * provider, set the 'has_provider' to false * so that the PM domain can be safely removed. */ - list_for_each_entry(gpd, &gpd_list, gpd_list_node) - if (gpd->provider == &np->fwnode) + list_for_each_entry(gpd, &gpd_list, gpd_list_node) { + if (gpd->provider == &np->fwnode) { gpd->has_provider = false; + if (!gpd->set_performance_state) + continue; + + dev_pm_opp_of_remove_table(&gpd->dev); + } + } + list_del(&cp->link); of_node_put(cp->node); kfree(cp); From patchwork Mon Apr 9 11:43:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 133032 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp168467ljb; Mon, 9 Apr 2018 04:44:42 -0700 (PDT) X-Google-Smtp-Source: AIpwx49/iS2QtfwsX4WVuJOm4disy5bmNr6UxeCZYpc9GhiUN7LjU1ByQLT0zLAdpWgc+a4jn8OC X-Received: by 2002:a17:902:a70f:: with SMTP id w15-v6mr38616529plq.344.1523274282728; Mon, 09 Apr 2018 04:44:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523274282; cv=none; d=google.com; s=arc-20160816; b=KNrXd3Ug1zxfvLv4eDQ9rIeyEnKE5SCD513iOxE2rmfP+Y2OYr7BNXg/EeVY1RjTTD czUbDh9vONJKFYzSb1QecwZGZHelz4hg+hynKgICsfPEchJ5jiaEMG6dw8Zpfdp1Kvyi 6eyuYJj+kUGLOjfSwkqCvHf6svrAfecXC9kV91Wj2RxLmRV/+w4+licv2LtbEq3mYSev TWCQEmxvyOXUpZu2/VXdA4O7SPWlcz5/1Ta4DsHOKCfZlWSJp6ZQFCRvop2nIi6egcmn EyKCpB0G1AXCmlgIUOjROysqr2CdPfHOJWYbkoLway0CgZrE/ik+pwMJYwbM7Z0siN0x d1Sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=b66fYmTqfnBB5WbKJetCcqHsTA7X6RwIkxdR9YdwXqw=; b=QNXWS7W4e2F9iLl5aKUpRo1geYLqkUGA4d+xSawcaAGozdSaFr9hmgtYYktg8fOmVC obC7Ba7Ah/pexv4wPTxhr5lNYYTDT5n4yTaxkfRwffjGgOsw6LffCwcI4CU8eRTllPd9 abLFeC5kQw9mRiciAFQCbvsKDTbPhhRiCT7JNgu24/+9otUYhwR4GTl3+wl9xJIMpAQt Siyi9cwzEAX/6IPnjpxacRspbR8JQZrdhD5nkCCsFQtPdgGqadtHAZYx1/affLKz80ZU QWWDWwuiN6Ew3yQIDberM+CIFiAMbRigE4L17yvD+HlGK2vNLZTMGCqBNpPMpq+JJa2y KdtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=g8ON9qmz; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n11-v6si153720pls.422.2018.04.09.04.44.42; Mon, 09 Apr 2018 04:44:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=g8ON9qmz; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1752249AbeDILoi (ORCPT + 11 others); Mon, 9 Apr 2018 07:44:38 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:43369 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752234AbeDILog (ORCPT ); Mon, 9 Apr 2018 07:44:36 -0400 Received: by mail-pl0-f68.google.com with SMTP id a39-v6so4949733pla.10 for ; Mon, 09 Apr 2018 04:44:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=b66fYmTqfnBB5WbKJetCcqHsTA7X6RwIkxdR9YdwXqw=; b=g8ON9qmzcrWX3fZ6h60eu519e8pNZvwZbdmPWdj0A0D/Rndb7gzG+cE8iSyomNQdII SF53s+1GVRP62qyXaJJxSAwRRR3KRukia3MeNcLJjAnVXWLJ7RAgrcti0lTV7FqO1mj0 uptYvwlaseYQOrqyk+zwm7zLI5hE2BUcfNrQM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=b66fYmTqfnBB5WbKJetCcqHsTA7X6RwIkxdR9YdwXqw=; b=Khkd4wVFjS5NgnxzIYVH/XwpY5o3nPlhSkdSlcNSNiMlP1YOuvsr+XkDn+dOXUtPJ0 2LrsoRt5xIgO/w1ZPZGgcFO93H+w3T+dGedEeWRrSFtMa5flaImazMOxjYg0DIuF7YQK JMax13FH28AZ+U9ZZShSJvbjLl2EMnOOAU49qUZqv/NgJqk1PUAfaGpN1C51inE3aUzm s1PPRQzQm/QaoRVkcMLN1eS4Pxs07oSyAGNRwXJTMOBCZGRNHz405PKnr7HMz2zqB+T6 QSzWdhnoGxjh4BWTsWwdqU8er400JwGDdbRyrappukeJhVuZ5on7dpjGaO8zC09M0dkG 4Q1A== X-Gm-Message-State: AElRT7HCkO1r9HgYziWOBw0qRFu7KFOl1rVObl1lLAVJyAEFBsPpPO/g XnifOsUBvhUe65Wenm/rRvra2w== X-Received: by 2002:a17:902:7045:: with SMTP id h5-v6mr38459311plt.1.1523274276388; Mon, 09 Apr 2018 04:44:36 -0700 (PDT) Received: from localhost ([122.171.228.188]) by smtp.gmail.com with ESMTPSA id q15sm621844pfi.140.2018.04.09.04.44.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Apr 2018 04:44:35 -0700 (PDT) From: Viresh Kumar To: Ulf Hansson , Stephen Boyd , "Rafael J. Wysocki" , Kevin Hilman , Len Brown , Pavel Machek Cc: Viresh Kumar , Rajendra Nayak , Vincent Guittot , linux-pm@vger.kernel.org Subject: [PATCH V2 09/11] PM / Domain: Implement of_dev_pm_genpd_opp_to_performance_state() Date: Mon, 9 Apr 2018 17:13:49 +0530 Message-Id: X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org This implements of_dev_pm_genpd_opp_to_performance_state() which can be used from the device drivers or the OPP core to find the performance state encoded in the "required-opps" property of a node. Normally this would be called only once for each OPP of the device for which the OPP table of the device is getting generated. Different platforms may encode the performance state differently using the OPP table (they may simply return value of opp-hz or opp-microvolt, or apply some algorithm on top of those values) and so a new callback ->opp_to_performance_state() is implemented to allow platform specific drivers to convert the power domain OPP to a performance state value. Signed-off-by: Viresh Kumar --- drivers/base/power/domain.c | 48 +++++++++++++++++++++++++++++++++++++++++++++ include/linux/pm_domain.h | 12 ++++++++++++ 2 files changed, 60 insertions(+) -- 2.15.0.194.g9af6a3dea062 Acked-by: Ulf Hansson Signed-off-by: Viresh Kumar Acked-by: Ulf Hansson diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 5c0019d70d76..5efdf67220f8 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -2412,6 +2412,54 @@ int of_genpd_parse_idle_states(struct device_node *dn, } EXPORT_SYMBOL_GPL(of_genpd_parse_idle_states); +/** + * of_dev_pm_genpd_opp_to_performance_state- Gets performance state of device's + * power domain corresponding to a DT node's "required-opps" property. + * + * @dev: Device for which the performance-state needs to be found. + * @opp_node: DT node where the "required-opps" property is present. This can be + * the device node itself (if it doesn't have an OPP table) or a node + * within the OPP table of a device (if device has an OPP table). + * @state: Pointer to return performance state. + * + * Returns performance state corresponding to the "required-opps" property of + * a DT node. This calls platform specific genpd->opp_to_performance_state() + * callback to translate power domain OPP to performance state. + * + * Returns performance state on success and 0 on failure. + */ +unsigned int of_dev_pm_genpd_opp_to_performance_state(struct device *dev, + struct device_node *opp_node) +{ + struct generic_pm_domain *genpd; + struct dev_pm_opp *opp; + int state = 0; + + genpd = dev_to_genpd(dev); + if (IS_ERR(genpd)) + return 0; + + if (unlikely(!genpd->set_performance_state)) + return 0; + + genpd_lock(genpd); + + opp = of_dev_pm_opp_find_required_opp(&genpd->dev, opp_node); + if (IS_ERR(opp)) { + state = PTR_ERR(opp); + goto unlock; + } + + state = genpd->opp_to_performance_state(genpd, opp); + dev_pm_opp_put(opp); + +unlock: + genpd_unlock(genpd); + + return state; +} +EXPORT_SYMBOL_GPL(of_dev_pm_genpd_opp_to_performance_state); + #endif /* CONFIG_PM_GENERIC_DOMAINS_OF */ diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index aaacaa35005d..fc1b723b03a1 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h @@ -47,6 +47,7 @@ struct genpd_power_state { }; struct genpd_lock_ops; +struct dev_pm_opp; struct generic_pm_domain { struct device dev; @@ -68,6 +69,8 @@ struct generic_pm_domain { unsigned int performance_state; /* Aggregated max performance state */ int (*power_off)(struct generic_pm_domain *domain); int (*power_on)(struct generic_pm_domain *domain); + unsigned int (*opp_to_performance_state)(struct generic_pm_domain *genpd, + struct dev_pm_opp *opp); int (*set_performance_state)(struct generic_pm_domain *genpd, unsigned int state); struct gpd_dev_ops dev_ops; @@ -244,6 +247,8 @@ extern int of_genpd_add_subdomain(struct of_phandle_args *parent, extern struct generic_pm_domain *of_genpd_remove_last(struct device_node *np); extern int of_genpd_parse_idle_states(struct device_node *dn, struct genpd_power_state **states, int *n); +extern unsigned int of_dev_pm_genpd_opp_to_performance_state(struct device *dev, + struct device_node *opp_node); int genpd_dev_pm_attach(struct device *dev); #else /* !CONFIG_PM_GENERIC_DOMAINS_OF */ @@ -279,6 +284,13 @@ static inline int of_genpd_parse_idle_states(struct device_node *dn, return -ENODEV; } +static inline unsigned int +of_dev_pm_genpd_opp_to_performance_state(struct device *dev, + struct device_node *opp_node) +{ + return -ENODEV; +} + static inline int genpd_dev_pm_attach(struct device *dev) { return -ENODEV; From patchwork Mon Apr 9 11:43:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 133033 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp168479ljb; Mon, 9 Apr 2018 04:44:44 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/aEg80ioRwNFcKqAb4DT1J9ZmdPlpjFIpy6BiUD8vzxTKwC0BcOnobswV1Ws+rsMGcLubj X-Received: by 2002:a17:902:2e:: with SMTP id 43-v6mr38237189pla.282.1523274284310; Mon, 09 Apr 2018 04:44:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523274284; cv=none; d=google.com; s=arc-20160816; b=CG8SCGYTH8i4S4JvrAWLSp1UpyyM9CYE1ui9Q+UUNdM+zhUufcjpP0EILscbzBADIb Sc0e49DMPlObgX60H3TTJrIUoq4yAIRDBKcA0OBZ5aeI/FX1tX4F2qYCFAQMoub78cQy CrYk3K+ugfSbi4fgzaHVx5f6mj4AQ25DKSSWIuXB15k+WnBgRObJ0IlaoIdz1NXoWGGx M+Wv+dcqfjA7JsoaVVX+GEJgN7AU0mWSD96bE+PHolb0eRwcWyCOYIOiJMhZZh9tpONA GxdBwOTxsCN8sKmG9OQRBMQIKbycOH8Osb3h4KTJYdFDSG7CmspYMZ0pNRGk3wurxCSm BXeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=9wDc+0pse7OWTpuIPhm3Ig06uxmHSKdgmTinQq1SoDI=; b=ccsd6NgwfEfPl78qjVssih1ywjFZx9Gi0hl5EXLd/8cD77vxCdVls9UEdUYSAAcRMu IYWZWdAy+9/HhteJTRwcFuoDaa4P7pphBup6otU23cKWc88Sp7zrMVnRwP1w1sbjvTTZ kgR5xzin/6p6XUnqZgoe6Sn9V8HSg8LaSsi28bDmedWa3Q6oK1xfpm8H8E+eEQdQ5a51 s0KH9FeUldDfAdX7dMY5kH1oGgzpy/8KHuvg0Zev7/GYaCE4je0aaSTM21tQh7uFtBfD w7B/WLMp3OowkFGsH3qbqVzPGA9/W6xp5qS35bRR7smo3pzgIOMZl25wOzENBS9UE2Da IxBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DfpsJRN7; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n11-v6si153720pls.422.2018.04.09.04.44.43; Mon, 09 Apr 2018 04:44:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DfpsJRN7; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1752262AbeDILol (ORCPT + 11 others); Mon, 9 Apr 2018 07:44:41 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:35518 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752240AbeDILoj (ORCPT ); Mon, 9 Apr 2018 07:44:39 -0400 Received: by mail-pl0-f67.google.com with SMTP id 61-v6so4959542plb.2 for ; Mon, 09 Apr 2018 04:44:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=9wDc+0pse7OWTpuIPhm3Ig06uxmHSKdgmTinQq1SoDI=; b=DfpsJRN7Fnt3CZ01FZs5EcbZmk0ZXaq6OwsVlvg+JQyVhBwVAHyAuF3ReKf0py33bz TYEbijTwvMl81OJNq4Nk272PE3cKeP7TWFcuRHk7IZa61/y7TTVdFqzWgbNrRB0QnrfR dpwBZEIy2i2qI0jiLQbEU1N7VR6QGoeVGNPb0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=9wDc+0pse7OWTpuIPhm3Ig06uxmHSKdgmTinQq1SoDI=; b=JcZxXyGxqSNUVs7h9WRa8AlYJWQ6rn6QUXhN/zKLog6TssGloU6UZXHaizPjPwL9BM 4f2EvJF3Km9mYkTWHLvADnfzJkX5kORkcMcbJypzEQ3f+1AecB3HHGCD3vKJ5LwT6lRH XawbbLhfV/XaJda7TOvPkUZOL209s0UMQv5PEDho2E6S1pRv1GgTsdQeCMqYpn7oQKlP /AT+FCmTcL18N1K949rULsNjUOgeTuGQC1XE4ob+7OOAoBGjlipYjLHb3v16zQeM8C6g uCXP9LHog5MUMKAtndbbobxbVBobuVQW+lW1D/OiLU9MPuzsik6yiakU7EZgOztevp/X C6xA== X-Gm-Message-State: AElRT7FyBAbHXrSMxkw4PDjH3sawOwZZ4XymNr0T57vbUKG7AcGMUGdK npBgQT7AtMPqLFWSiYpCxDatnYARoDg= X-Received: by 2002:a17:902:3084:: with SMTP id v4-v6mr39008494plb.262.1523274279175; Mon, 09 Apr 2018 04:44:39 -0700 (PDT) Received: from localhost ([122.171.228.188]) by smtp.gmail.com with ESMTPSA id j10sm894544pfj.1.2018.04.09.04.44.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Apr 2018 04:44:38 -0700 (PDT) From: Viresh Kumar To: Ulf Hansson , Stephen Boyd , Viresh Kumar , Nishanth Menon Cc: Viresh Kumar , Rajendra Nayak , Vincent Guittot , linux-pm@vger.kernel.org Subject: [PATCH V2 10/11] PM / OPP: Get performance state using genpd helper Date: Mon, 9 Apr 2018 17:13:50 +0530 Message-Id: X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The genpd core provides an API now to retrieve the performance state from DT, use that instead of the ->get_pstate() callback. Signed-off-by: Viresh Kumar Reviewed-by: Ulf Hansson --- drivers/opp/core.c | 3 --- drivers/opp/of.c | 20 +++++++++++++++++++- 2 files changed, 19 insertions(+), 4 deletions(-) -- 2.15.0.194.g9af6a3dea062 diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 416f54ba7a26..e4ec30ee1493 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -1056,9 +1056,6 @@ int _opp_add(struct device *dev, struct dev_pm_opp *new_opp, } } - if (opp_table->get_pstate) - new_opp->pstate = opp_table->get_pstate(dev, new_opp->rate); - list_add(&new_opp->node, head); mutex_unlock(&opp_table->lock); diff --git a/drivers/opp/of.c b/drivers/opp/of.c index de41e68b780f..5de9ec47c6bd 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -329,6 +330,8 @@ static int _opp_add_static_v2(struct opp_table *opp_table, struct device *dev, if (!of_property_read_u32(np, "clock-latency-ns", &val)) new_opp->clock_latency_ns = val; + new_opp->pstate = of_dev_pm_genpd_opp_to_performance_state(dev, np); + ret = opp_parse_supplies(new_opp, dev, opp_table); if (ret) goto free_opp; @@ -379,7 +382,8 @@ static int _of_add_opp_table_v2(struct device *dev, struct device_node *opp_np) { struct device_node *np; struct opp_table *opp_table; - int ret = 0, count = 0; + int ret = 0, count = 0, pstate_count = 0; + struct dev_pm_opp *opp; opp_table = _managed_opp(opp_np); if (opp_table) { @@ -413,6 +417,20 @@ static int _of_add_opp_table_v2(struct device *dev, struct device_node *opp_np) goto put_opp_table; } + list_for_each_entry(opp, &opp_table->opp_list, node) + pstate_count += !!opp->pstate; + + /* Either all or none of the nodes shall have performance state set */ + if (pstate_count && pstate_count != count) { + dev_err(dev, "Not all nodes have performance state set (%d: %d)\n", + count, pstate_count); + ret = -ENOENT; + goto put_opp_table; + } + + if (pstate_count) + opp_table->genpd_performance_state = true; + opp_table->np = opp_np; if (of_property_read_bool(opp_np, "opp-shared")) opp_table->shared_opp = OPP_TABLE_ACCESS_SHARED; From patchwork Mon Apr 9 11:43:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 133034 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp168510ljb; Mon, 9 Apr 2018 04:44:46 -0700 (PDT) X-Google-Smtp-Source: AIpwx4829N/tUBG8Ak+kWITWRCpwKoNowi7aWUeT96IyNcTjx1xEOokYpWq6J4tvaFHvWSQI2J81 X-Received: by 2002:a17:902:107:: with SMTP id 7-v6mr38190421plb.374.1523274286654; Mon, 09 Apr 2018 04:44:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523274286; cv=none; d=google.com; s=arc-20160816; b=zl3eYwxoBg+h0ZwUJ8oqxijFK5sjeXMkxKzM1WLK1QpdPHmFClEE4sNcnQDyiEO9CJ 5IldDpsNSwA15KZw6Adv/Awv0VzJlDooGXKalUDtxVCyzR42ixV45YQkbBs8MpXRmwc8 txyyPi13EJetLwf2WuFu0rFhkqaXS58YtGJm+lyFJkKt187WpaMblJpuH9VVQeouOKjK AvP+2HNm+A/gohtctqecDI92L051jSGDQi6bkB5u4T2oRO6f5JiA+uxXNRO+TTeUixNM KcjNaH6oqY6NpER+uV5OQIDJkCxVLeOVcKM1awPoyrui5Lu2pT6Y5nOuk0/8PW3qFfnJ Joww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=TFezoPga6ifvymwl7bV21bweH3Wl2drJfxx5EqJqrT8=; b=QdXd6l8t801uTqkcbCPwe7gX1gz8nMXnvvtBUBwUkexAz1wXk/UCsJv+oQbOLmAyCh iMlFkSjcVLFPDmPoqiKHnARNOLLNGemDgMvIZDDQYABVoowzmdETLAAEl6NBs7zmawtI 3Pq9KJbpHsGSbLFNd6eyCRauVgzetmE1omMkgFMgNyaL5nJOOkDckcEs9w8GyM/KeF/c cNxxjPu79CUodppqtPfVuy99qhVG4n/c170keFgv/eoq2evxfxHxmrCBadF4fV1pF9OQ CNCAqDhSolDizP/+aJ7wRQ5lTCtgqiILg8olymlp2qOau8Yddlnz6iAnXV2cFSYYa3xq cFhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AzzjnMJk; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n11-v6si153720pls.422.2018.04.09.04.44.46; Mon, 09 Apr 2018 04:44:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AzzjnMJk; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1752272AbeDILoo (ORCPT + 11 others); Mon, 9 Apr 2018 07:44:44 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:35520 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752260AbeDILom (ORCPT ); Mon, 9 Apr 2018 07:44:42 -0400 Received: by mail-pl0-f65.google.com with SMTP id 61-v6so4959610plb.2 for ; Mon, 09 Apr 2018 04:44:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=TFezoPga6ifvymwl7bV21bweH3Wl2drJfxx5EqJqrT8=; b=AzzjnMJkINUizEYNIATdraA8i9kwcW958GTPiubPC9eh+2hBH1c12+WTjdCCNHqu7f Wdr95JHIlACRjeY2at+xxy8SyPtd7KaN8ELfdInjrtE0PcvmROBwbpFO69K447oZeyZ8 T0ouf5jNLb8CVmyTDo9ult1yZuc7eJDZijOPI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=TFezoPga6ifvymwl7bV21bweH3Wl2drJfxx5EqJqrT8=; b=EkFxoDha+Mjci11q9NMEn6g4aVCklUcbzXSSWmMzUrhvCg7AKrWIFaZn44J4IvW5pg pAbvRTnk5+4x4Q6BnwFTGyNdgAk6/5KR14SgWtvS4kaK2OsSa8zCMOvTVHg8UCvP7m14 5dFkS+KTj144Y8Oaa/WmEDvgYNtMdizwZFQbzuugvhCQ230uB/VAHBzYBl3JHfMx5C+U D0QdePOUg4neDT+UBVPysGZOv4hPXicpKqMGKEFHiT7OpMHFfpDjT6GZUHMCYqe8ftcF s9DPB36OM/ZHvvnpErOcDFfOAtLiCCmD6usg8xWBaBS9woKqFT7+m6QEs249AEIHwVuS 1+OA== X-Gm-Message-State: ALQs6tCsidUROrqfx6d2qBFSo/kznKzC068QZ8dHbrWoSuNOvGX8+gEk Wr8rXq5511WVzKnq2IqBQlje+w== X-Received: by 2002:a17:902:8505:: with SMTP id bj5-v6mr19759049plb.231.1523274282092; Mon, 09 Apr 2018 04:44:42 -0700 (PDT) Received: from localhost ([122.171.228.188]) by smtp.gmail.com with ESMTPSA id t25sm338588pfh.184.2018.04.09.04.44.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Apr 2018 04:44:41 -0700 (PDT) From: Viresh Kumar To: Ulf Hansson , Stephen Boyd , Viresh Kumar , Nishanth Menon , "Rafael J. Wysocki" Cc: Viresh Kumar , Rajendra Nayak , Vincent Guittot , linux-pm@vger.kernel.org Subject: [PATCH V2 11/11] PM / OPP: Remove dev_pm_opp_{un}register_get_pstate_helper() Date: Mon, 9 Apr 2018 17:13:51 +0530 Message-Id: <9068360bcd9d2c3f9099af2ba80b7396fbf79d47.1523273291.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org These helpers aren't used anymore, remove them. Signed-off-by: Viresh Kumar Reviewed-by: Ulf Hansson --- drivers/opp/core.c | 75 -------------------------------------------------- drivers/opp/opp.h | 2 -- include/linux/pm_opp.h | 10 ------- 3 files changed, 87 deletions(-) -- 2.15.0.194.g9af6a3dea062 diff --git a/drivers/opp/core.c b/drivers/opp/core.c index e4ec30ee1493..6d3624ba89b6 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -1567,81 +1567,6 @@ void dev_pm_opp_unregister_set_opp_helper(struct opp_table *opp_table) } EXPORT_SYMBOL_GPL(dev_pm_opp_unregister_set_opp_helper); -/** - * dev_pm_opp_register_get_pstate_helper() - Register get_pstate() helper. - * @dev: Device for which the helper is getting registered. - * @get_pstate: Helper. - * - * TODO: Remove this callback after the same information is available via Device - * Tree. - * - * This allows a platform to initialize the performance states of individual - * OPPs for its devices, until we get similar information directly from DT. - * - * This must be called before the OPPs are initialized for the device. - */ -struct opp_table *dev_pm_opp_register_get_pstate_helper(struct device *dev, - int (*get_pstate)(struct device *dev, unsigned long rate)) -{ - struct opp_table *opp_table; - int ret; - - if (!get_pstate) - return ERR_PTR(-EINVAL); - - opp_table = dev_pm_opp_get_opp_table(dev); - if (!opp_table) - return ERR_PTR(-ENOMEM); - - /* This should be called before OPPs are initialized */ - if (WARN_ON(!list_empty(&opp_table->opp_list))) { - ret = -EBUSY; - goto err; - } - - /* Already have genpd_performance_state set */ - if (WARN_ON(opp_table->genpd_performance_state)) { - ret = -EBUSY; - goto err; - } - - opp_table->genpd_performance_state = true; - opp_table->get_pstate = get_pstate; - - return opp_table; - -err: - dev_pm_opp_put_opp_table(opp_table); - - return ERR_PTR(ret); -} -EXPORT_SYMBOL_GPL(dev_pm_opp_register_get_pstate_helper); - -/** - * dev_pm_opp_unregister_get_pstate_helper() - Releases resources blocked for - * get_pstate() helper - * @opp_table: OPP table returned from dev_pm_opp_register_get_pstate_helper(). - * - * Release resources blocked for platform specific get_pstate() helper. - */ -void dev_pm_opp_unregister_get_pstate_helper(struct opp_table *opp_table) -{ - if (!opp_table->genpd_performance_state) { - pr_err("%s: Doesn't have performance states set\n", - __func__); - return; - } - - /* Make sure there are no concurrent readers while updating opp_table */ - WARN_ON(!list_empty(&opp_table->opp_list)); - - opp_table->genpd_performance_state = false; - opp_table->get_pstate = NULL; - - dev_pm_opp_put_opp_table(opp_table); -} -EXPORT_SYMBOL_GPL(dev_pm_opp_unregister_get_pstate_helper); - /** * dev_pm_opp_add() - Add an OPP table from a table definitions * @dev: device for which we do this operation diff --git a/drivers/opp/opp.h b/drivers/opp/opp.h index f9eccf9811ae..7c540fd063b2 100644 --- a/drivers/opp/opp.h +++ b/drivers/opp/opp.h @@ -140,7 +140,6 @@ enum opp_table_access { * @genpd_performance_state: Device's power domain support performance state. * @set_opp: Platform specific set_opp callback * @set_opp_data: Data to be passed to set_opp callback - * @get_pstate: Platform specific get_pstate callback * @dentry: debugfs dentry pointer of the real device directory (not links). * @dentry_name: Name of the real dentry. * @@ -178,7 +177,6 @@ struct opp_table { int (*set_opp)(struct dev_pm_set_opp_data *data); struct dev_pm_set_opp_data *set_opp_data; - int (*get_pstate)(struct device *dev, unsigned long rate); #ifdef CONFIG_DEBUG_FS struct dentry *dentry; diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 8fd34c4398b2..099b31960dec 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -125,8 +125,6 @@ struct opp_table *dev_pm_opp_set_clkname(struct device *dev, const char * name); void dev_pm_opp_put_clkname(struct opp_table *opp_table); struct opp_table *dev_pm_opp_register_set_opp_helper(struct device *dev, int (*set_opp)(struct dev_pm_set_opp_data *data)); void dev_pm_opp_unregister_set_opp_helper(struct opp_table *opp_table); -struct opp_table *dev_pm_opp_register_get_pstate_helper(struct device *dev, int (*get_pstate)(struct device *dev, unsigned long rate)); -void dev_pm_opp_unregister_get_pstate_helper(struct opp_table *opp_table); int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq); int dev_pm_opp_set_sharing_cpus(struct device *cpu_dev, const struct cpumask *cpumask); int dev_pm_opp_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask); @@ -247,14 +245,6 @@ static inline struct opp_table *dev_pm_opp_register_set_opp_helper(struct device static inline void dev_pm_opp_unregister_set_opp_helper(struct opp_table *opp_table) {} -static inline struct opp_table *dev_pm_opp_register_get_pstate_helper(struct device *dev, - int (*get_pstate)(struct device *dev, unsigned long rate)) -{ - return ERR_PTR(-ENOTSUPP); -} - -static inline void dev_pm_opp_unregister_get_pstate_helper(struct opp_table *opp_table) {} - static inline struct opp_table *dev_pm_opp_set_prop_name(struct device *dev, const char *name) { return ERR_PTR(-ENOTSUPP);