Received: by 10.223.185.116 with SMTP id b49csp894076wrg; Fri, 23 Feb 2018 08:26:06 -0800 (PST) X-Google-Smtp-Source: AH8x227KwBFMrNz+rMN+iv1y7nDbvUnXiruBh2Zf9pcp4Kq87asgbtqLJ22yvTAbgPNlV1MIZmsA X-Received: by 2002:a17:902:2702:: with SMTP id c2-v6mr2228264plb.342.1519403166165; Fri, 23 Feb 2018 08:26:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519403166; cv=none; d=google.com; s=arc-20160816; b=BApVVXiuDKRDSIHrstmMe11FAayWNzSXrITzP8Z3HHg1zAnByYK/sivOj07LaKpc93 rIZrrfghO0Iz3CP1uCGkES/JEyZMB/I4KapfOgLDnGtOiJB6GnEmv7mIq0ekxQ7tMFpV nsL6vhk4kqn4e+smPBKE9+kRQxmdAy84VU9ihbeGitqAM7G0KQwKPLQFD6zz0eemHssM 8GPfknXr9yNSqDE2+VNFHN3CY50cX/szqBGUFKxBgGyH7Jm33n3qprIbzNzArpXY0A7c 0G+wl3qoOuBp0aqE+H7aksg8dIAsZIlpUoQ6QZT2MqhWUuxbI3N6GGvHIj96+ovlbQhr 4Bzw== 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 j8-v6si1960524plk.464.2018.02.23.08.25.51; Fri, 23 Feb 2018 08:26:06 -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 S1751624AbeBWQY6 (ORCPT + 99 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(+) 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, -- 2.7.4