From patchwork Tue Jan 2 14:42:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 123137 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp9042256qgn; Tue, 2 Jan 2018 06:43:51 -0800 (PST) X-Google-Smtp-Source: ACJfBotPPiAl0cJeDzrIbfq5DO4K31BI/1CQQhfOhmFH51yPn9XEns+PvMlShti7Za0vkeXK9Tdu X-Received: by 10.101.78.6 with SMTP id r6mr8480691pgt.64.1514904231363; Tue, 02 Jan 2018 06:43:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514904231; cv=none; d=google.com; s=arc-20160816; b=hiTAxW+b4ICcXdOfXztL/6PQuItoXJu+lBaAl3fynDePfu1vaVoO5mjaPTRMDwwAut lwjdHlYUSdHXNG3+7ap3e1Uh6bXQOV0dJr3ZZeMDCQrsIRjZansGHNUBERMBQ7oQsZZd 8uJ+i4orfoDdjUZ30O3V50Piz11J0M1Zr/6l3Ll7u1/hl2m42xLb7yJT194grZn8Mugy 9DiRuAnONXXVGnJRzJv5EjHLvLvZVCuB24/IIy5trorLFU4qCwqGVujWZyTkJ1zMEQ9A a6Jt52yJWKZa6oTkEKolDEkNnlK93/urSRg/3eZapHSsa3C8PjFid4MW4kPbDPc8uTRM LPWw== 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:message-id:date :subject:cc:to:from:arc-authentication-results; bh=3/8/jap/2b5wMtCEB+kIog/zTZ93/j0Or2FAwcMffcI=; b=XcyORfEiLQyJWHlpnYq3p3M1MRYH8B5Uud9FiRuj6jTiVYpnNlzFihxNL7AZHOnmDT 6VjeIbVAdzdqS2ZBeqNJBeWarIIXrHTLWs4QCx4crdnXWj7XTXYu2b2dSFHsI5+jRXc2 4ka0ipW45CEH0i8CvqtN3gsJesedpkXHBQt/HdAvHUNuUQBo2qvAszQ4H8niRn+C9IE2 0yQjttg6D5xhx+eiqr+L2yFMW0C2MCN0/BXjaijYFd07mVWeM19jALl2ovDckz5hqy/9 95OstpaQp6tIUX95ugK13qEjmw1bnU3lOhEW+c/+eyQk0cEqc5DhQPn9cJp6nP7nAv5T uazg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x12si17760744pgc.25.2018.01.02.06.43.51; Tue, 02 Jan 2018 06:43:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751170AbeABOnt (ORCPT + 6 others); Tue, 2 Jan 2018 09:43:49 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:39948 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753589AbeABOnq (ORCPT ); Tue, 2 Jan 2018 09:43:46 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 87E8D15A2; Tue, 2 Jan 2018 06:43:45 -0800 (PST) Received: from e107155-lin.cambridge.arm.com (e107155-lin.cambridge.arm.com [10.1.210.28]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 51C863F246; Tue, 2 Jan 2018 06:43:43 -0800 (PST) From: Sudeep Holla To: ALKML , LKML , DTML Cc: Sudeep Holla , Roy Franz , Harb Abdulhamid , Nishanth Menon , Arnd Bergmann , Loc Ho , Alexey Klimov , Ryan Harkin , Jassi Brar , linux-pm@vger.kernel.org Subject: [PATCH v5 20/20] cpufreq: scmi: add support for fast frequency switching Date: Tue, 2 Jan 2018 14:42:42 +0000 Message-Id: <1514904162-11201-21-git-send-email-sudeep.holla@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514904162-11201-1-git-send-email-sudeep.holla@arm.com> References: <1514904162-11201-1-git-send-email-sudeep.holla@arm.com> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org The cpufreq core provides option for drivers to implement fast_switch callback which is invoked for frequency switching from interrupt context. This patch adds support for fast_switch callback in SCMI cpufreq driver by making use of polling based SCMI transfer. It also sets the flag fast_switch_possible. Cc: linux-pm@vger.kernel.org Acked-by: Rafael J. Wysocki Acked-by: Viresh Kumar Signed-off-by: Sudeep Holla --- drivers/cpufreq/scmi-cpufreq.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c index 0ee9335d0063..d0a82d7c6fd4 100644 --- a/drivers/cpufreq/scmi-cpufreq.c +++ b/drivers/cpufreq/scmi-cpufreq.c @@ -64,6 +64,19 @@ scmi_cpufreq_set_target(struct cpufreq_policy *policy, unsigned int index) return perf_ops->freq_set(handle, priv->domain_id, freq, false); } +static unsigned int scmi_cpufreq_fast_switch(struct cpufreq_policy *policy, + unsigned int target_freq) +{ + struct scmi_data *priv = policy->driver_data; + struct scmi_perf_ops *perf_ops = handle->perf_ops; + + if (!perf_ops->freq_set(handle, priv->domain_id, + target_freq * 1000, true)) + return target_freq; + + return 0; +} + static int scmi_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask) { @@ -163,6 +176,7 @@ static int scmi_cpufreq_init(struct cpufreq_policy *policy) policy->cpuinfo.transition_latency = latency; + policy->fast_switch_possible = true; return 0; out_free_cpufreq_table: @@ -222,6 +236,7 @@ static struct cpufreq_driver scmi_cpufreq_driver = { .verify = cpufreq_generic_frequency_table_verify, .attr = cpufreq_generic_attr, .target_index = scmi_cpufreq_set_target, + .fast_switch = scmi_cpufreq_fast_switch, .get = scmi_cpufreq_get_rate, .init = scmi_cpufreq_init, .exit = scmi_cpufreq_exit,