From patchwork Fri Feb 23 16:23:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 129442 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp789894lja; Fri, 23 Feb 2018 08:25:04 -0800 (PST) X-Google-Smtp-Source: AH8x225rvkPTOAxE+GFce7fjkvacS7nNMq3DciflJhMKPz/RRtWd9pGkq4rnI9S+DwrSgxw5D6PE X-Received: by 10.98.8.219 with SMTP id 88mr2327592pfi.4.1519403104059; Fri, 23 Feb 2018 08:25:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519403104; cv=none; d=google.com; s=arc-20160816; b=W6KgYDHemSkoCxQY94KmStc9nrxFgPL1a98W906ecuVMaUAMbB4ZYFC/oUQqpQ9kFM SR2QJjwG+bnfC9YRP4K2o5cHmbMFvjGT6AtQ2Fgdj+yDMJHoz7DY6JrU2h6H90rE5MBh ay4JJ1FlNr2Hr9jvhWM3DeywWnyJF2ALtKoxA17Y063Vk/otsx92bv9zeI4EyfiNJrNt 4azmm0pD/bs390BjZVg97n34O9K9y+QIyH8trgb+zrZHAtXOw45D1FIC7AxXfgdsGwde wFF4ADfUp30CEMBm0FkU+gnfbPAX+nqu9uk8Ae0bftT9jm1sqCnjkI49B9yRoYjKPdht DR2A== 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=RSbsANuSxBwcm+kRTuCfGyuJwHa/xjk6xBT0hXu0WcE=; b=e9pWKr9T+t07dsMBG9CSZdXAI+dUEavg8Q7UHuBKAaAXpBAuzxKPck6ClaZp4bn2BD Fr8lhrfw2oYZpfkOL8NUtjnwTV8HEvvZDpBZyP3CKvbmeMb9Dxsz7uWZIyONJgQFl40y mB32K19MmHfC0/HgO3a3SkRGCmdeDqotdwYCwmc4P7flBKfWCZseK7fnrAlcdqkFVbEH mJJysa3TkUeF2wBVUPKXkubQJwpGN/oOxAibmsVUv3FpBnTpcQI+GdeziUQc7V6OoVYy NHJkG4bNXEGakJP+7K5LkwK+Hs41Z9dCATV04T/r7NymlI5RUcUlOAtYy33jUNMTotIE fL3g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 t2si1694274pgp.480.2018.02.23.08.25.03; Fri, 23 Feb 2018 08:25:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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 linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751639AbeBWQY6 (ORCPT + 28 others); Fri, 23 Feb 2018 11:24:58 -0500 Received: from foss.arm.com ([217.140.101.70]:57424 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751420AbeBWQYl (ORCPT ); Fri, 23 Feb 2018 11:24:41 -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 611CB174E; Fri, 23 Feb 2018 08:24:41 -0800 (PST) Received: from e107155-lin.cambridge.arm.com (unknown [10.1.210.28]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id DC6813F25C; Fri, 23 Feb 2018 08:24:39 -0800 (PST) From: Sudeep Holla To: ALKML , LKML , DTML Cc: Sudeep Holla , Alexey Klimov , Arnd Bergmann , Greg Kroah-Hartman , linux-pm@vger.kernel.org Subject: [PATCH v6 20/20] cpufreq: scmi: add support for fast frequency switching Date: Fri, 23 Feb 2018 16:23:50 +0000 Message-Id: <1519403030-21189-21-git-send-email-sudeep.holla@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519403030-21189-1-git-send-email-sudeep.holla@arm.com> References: <1519403030-21189-1-git-send-email-sudeep.holla@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) -- 2.7.4 diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c index 3745dc5fe2a8..ec0c58ddc1ed 100644 --- a/drivers/cpufreq/scmi-cpufreq.c +++ b/drivers/cpufreq/scmi-cpufreq.c @@ -69,6 +69,22 @@ scmi_cpufreq_set_target(struct cpufreq_policy *policy, unsigned int index) return ret; } +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)) { + arch_set_freq_scale(policy->related_cpus, target_freq, + policy->cpuinfo.max_freq); + return target_freq; + } + + return 0; +} + static int scmi_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask) { @@ -168,6 +184,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: @@ -206,6 +223,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,