From patchwork Mon Feb 12 18:45:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 128153 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3485690ljc; Mon, 12 Feb 2018 10:46:36 -0800 (PST) X-Google-Smtp-Source: AH8x224QwNDLkujDSDjc/G9ig9HstRreZdxykjOSOIl9SjMhTUzWihsvEKrdAeJR6O4zhRQK8G4H X-Received: by 10.101.64.74 with SMTP id h10mr9728726pgp.200.1518461195905; Mon, 12 Feb 2018 10:46:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518461195; cv=none; d=google.com; s=arc-20160816; b=OZCIfUXvSiwy7SnK+AM00/0jufRBdPDNSt5NwtxeK4EIbZrftKfY5CYKIqaCcrAdIb SrE2tm7KFLcnLtIg2gqgngr0SnGkP8owTdC52q4FTgWDywo58ekSE51v+nXykUB8CREY cTWtJFcx77R+FnqTfD7TDy9t2ezKR6UCbYq3bok89C0gafMSDwRnjFxD12woKTR6Lhn+ biI+fAvZ4BYKzGMneaCJ+mwZw/ablub2c8NnrCgd6sH7ucWSymhGkGTj5vy/bnrRVXYQ Yyc5bOu0i1HxQrODpdDzomNGdI0b0USuCSNZTrS/rXLnkToaV2YNs/bEV/UcT3wmggd1 WVGA== 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=PjOe8S8Onvct3BSagmr9w+aYI5UY8YfLSSSDIIsw9bc=; b=pU1Q/VxezFZ5hBCEvhQFh/MU85StMDv0Wy9sfrzjNVIqnhBudQpJj3uk2VEaAjA8Kn KlhKD4o36O9KaL/r1It0SjRtY85dcnIWpbleIyWu5UoJngr6tcJ/rZMKQmOvVjLQUEjS +C9AxN0HLrDgZt7FESmmv2mv1y4StbwAqQCegcSJeujGElwuyVw1sweIxcCbXy80UZcg 2EnwpkbpYNTh9PqukDgFFH07GpSZ0whCO0El9BHt/Mid2k5mxne3e93RI1u8SObNWHG5 0pDnqQoYGTl5m28nQ/ZLDcrJ8R70gUaO9K62Rr7jYglMNdjcOCizQIo5KV7Pd9uXlCqs MWAg== 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 c6si5464442pgn.681.2018.02.12.10.46.35; Mon, 12 Feb 2018 10:46:35 -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 S932190AbeBLSqS (ORCPT + 26 others); Mon, 12 Feb 2018 13:46:18 -0500 Received: from foss.arm.com ([217.140.101.70]:47326 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754160AbeBLSqP (ORCPT ); Mon, 12 Feb 2018 13:46:15 -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 A05C91435; Mon, 12 Feb 2018 10:46:15 -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 2788E3F24D; Mon, 12 Feb 2018 10:46:14 -0800 (PST) From: Sudeep Holla To: ALKML , LKML , DTML Cc: Sudeep Holla , Greg Kroah-Hartman , Arnd Bergmann , Alexey Klimov , linux-pm@vger.kernel.org Subject: [PATCH v5 20/20] cpufreq: scmi: add support for fast frequency switching Date: Mon, 12 Feb 2018 18:45:24 +0000 Message-Id: <1518461124-17371-21-git-send-email-sudeep.holla@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518461124-17371-1-git-send-email-sudeep.holla@arm.com> References: <1518461124-17371-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 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) -- 2.7.4 diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c index d6d35f7692b3..c869c99b2142 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: @@ -201,6 +215,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,