From patchwork Tue Sep 19 22:32:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 113068 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp34110qgf; Tue, 19 Sep 2017 15:33:09 -0700 (PDT) X-Received: by 10.159.198.74 with SMTP id y10mr106764plt.45.1505860389439; Tue, 19 Sep 2017 15:33:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505860389; cv=none; d=google.com; s=arc-20160816; b=gwyIkVgMh9cmpOfoSV6cbnAD2A9IEr03t89oa37h6OaJVKQawwd16vFYQ/NSJd/9AM hFjWjkZtyTra8a+Yj1rna3uBqFO8MuGskGyEeXgJvVAAu7KJCuG+HVu+0cHJ9Kc2o2V3 PFURuBpSXo1C6v2xXBbgfYIazsPPmBO/MJKBOwlqpubPyPnDHLGa66LzimoP5XRKrXcP QToQTEc42cyl7oR6D2rJLS+diaUyqaYaGpZ96oy293JnuXPGscRr1o86NqhJoNt+alNK txAlJjYDAxD4wzzjj0K1xfWA4DHE9C7VoIvVFGSV/twX3YN+mZQG0caBhLYF2iMc9M4m Lbxg== 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=sb2NA7EgCbClj7J2sUSx8EN3Q8urKhCHn6JapG2gyY8=; b=MWMWu6/nepGyhr2+QSdVnO+8m+y63CSEnRmfe8XiF7ja0GK66VPQ+ojlNhp1OvQXoY 1gJC7MD1QbKqFA5u4v8EKpOodSncEBhvksF6hQqAbsJP55zgXUUgcJ7l3ZhX0E1d3DOx ARa4iT6x0A03IedCA5bfaZsBrdes+v6NzflBZp/bUHieSFkTMAOus60cDiVo70VSJ4uv 7xzmVC20D++8iM/N830MA1W0oOA1kENGK+bwYEEfA9t56HdMcMOTvTIqfzne0nGskty2 +meA/5Il2su4QGzVTAwwNjfMV3B8EmDlg5tngf/NbVBdHT2Q5N+iBSNmyGuUbuJQnGX/ /cIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WtnjFGrh; 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; 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 y7si231205plh.605.2017.09.19.15.33.05; Tue, 19 Sep 2017 15:33:09 -0700 (PDT) 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; dkim=pass header.i=@linaro.org header.s=google header.b=WtnjFGrh; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751812AbdISWdE (ORCPT + 26 others); Tue, 19 Sep 2017 18:33:04 -0400 Received: from mail-pg0-f49.google.com ([74.125.83.49]:53639 "EHLO mail-pg0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751772AbdISWcs (ORCPT ); Tue, 19 Sep 2017 18:32:48 -0400 Received: by mail-pg0-f49.google.com with SMTP id j70so600702pgc.10 for ; Tue, 19 Sep 2017 15:32:48 -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=sb2NA7EgCbClj7J2sUSx8EN3Q8urKhCHn6JapG2gyY8=; b=WtnjFGrhVskn6VXY+YOPDxYWknU+Ft4Ku7twHa/6UfbLvLgMrUBdgC2fKQsGqXP4xb 9g564ut4+tE7ArdHE0ys4Owl8TACviYhcmY5xrdyMWlfxXv3amEZ9Pi2ERU1dOh48GQ5 Cszae7mvksJbAr8k6EvTDIIbpAEP2gpu3qKJE= 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=sb2NA7EgCbClj7J2sUSx8EN3Q8urKhCHn6JapG2gyY8=; b=YpXyzEjQb1vWQ71V0ScdsQk0k4lU02XaMaJeuAwR2AVqM//OzlZja8FCyQdKQpcvck JZvZIN63IZXEQodC1xj1bYAMWHdQSOe+gOnnA5FZ+8651NBsqxgzV3iNB2Rol6VQri5T 7LpDFy5czGEcctenKCrN/KyrZ/1MDEcJdj3mYhpGUzUqWtgZwRR/5qi8ACuQDWTrBt/9 UVZ3tQozwJK+FpalYga5NzoGY7927v2XrSWYr/irg4gZ8FV8G1nGjpa+wsoZ/ZTKThpt GNBUyONZIMUc5sQPpG19OPjzO8c6Va9zeeCjxld+E+vC7Y8XGythqYThyNQOicCjQpiU 7zDw== X-Gm-Message-State: AHPjjUgWmDQVWEmpB5CCt5w/tAExKAo4Wu66ANFQYEoOQjCn0bXLQpL5 lBXqMkluVtsdXjbEHbM7JqKynQ== X-Google-Smtp-Source: AOwi7QDOgS4Q/BGFLVCCAKrwUT6RO0joZepw/cyQtwKATx1q7maFzITBjoFiT2SWQx9cWe+00CqzGA== X-Received: by 10.98.70.221 with SMTP id o90mr107095pfi.277.1505860367999; Tue, 19 Sep 2017 15:32:47 -0700 (PDT) Received: from localhost (cpe-172-88-64-62.socal.res.rr.com. [172.88.64.62]) by smtp.gmail.com with ESMTPSA id r90sm5520345pfb.183.2017.09.19.15.32.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Sep 2017 15:32:47 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , ulf.hansson@linaro.org, Kevin Hilman Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Stephen Boyd , Nishanth Menon , robh+dt@kernel.org, lina.iyer@linaro.org, rnayak@codeaurora.org, sudeep.holla@arm.com, linux-kernel@vger.kernel.org, Len Brown , Pavel Machek , Andy Gross , David Brown Subject: [PATCH V10 7/7] remoteproc: qcom: q6v5: Vote for proxy powerdomain performance state Date: Tue, 19 Sep 2017 15:32:23 -0700 Message-Id: <50dd4d69098783bd844a55a321beaa94d216242d.1505859768.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rajendra Nayak THIS IS TEST CODE, SHOULDN'T BE MERGED. This patch just demonstrates the usage of pm_genpd_update_performance_state() api in cases where users need to set performance state of a powerdomain without having to do it via the OPP framework. q6v5 remoteproc driver needs to proxy vote for performance states of multiple powerdomains (but we currently only demonstate how it can be done for one powerdomain, as there is no way to associate multiple powerdomains to a device at this time) while it loads the firmware, and then releases the vote, once the firmware is up and can vote for itself. This is not a functional patch since rpmpd driver only supports msm8996 and there is no msm8996 support in the q6v5 remoteproc driver at this point in mainline. This patch is not tested as well. Not-signed-off-by: Rajendra Nayak Not-signed-off-by: Viresh Kumar --- drivers/remoteproc/qcom_q6v5_pil.c | 20 +++++++++++++------- drivers/soc/qcom/rpmpd.c | 5 +++++ 2 files changed, 18 insertions(+), 7 deletions(-) -- 2.7.4 diff --git a/drivers/remoteproc/qcom_q6v5_pil.c b/drivers/remoteproc/qcom_q6v5_pil.c index 2d3d5ac92c06..dcb865b13c5c 100644 --- a/drivers/remoteproc/qcom_q6v5_pil.c +++ b/drivers/remoteproc/qcom_q6v5_pil.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -152,6 +153,8 @@ struct q6v5 { void *mpss_region; size_t mpss_size; + bool has_perf_state; + struct qcom_rproc_subdev smd_subdev; struct qcom_rproc_ssr ssr_subdev; }; @@ -604,11 +607,12 @@ static int q6v5_start(struct rproc *rproc) struct q6v5 *qproc = (struct q6v5 *)rproc->priv; int ret; - ret = q6v5_regulator_enable(qproc, qproc->proxy_regs, - qproc->proxy_reg_count); - if (ret) { - dev_err(qproc->dev, "failed to enable proxy supplies\n"); - return ret; + if (qproc->has_perf_state) { + ret = dev_pm_genpd_update_performance_state(qproc->dev, INT_MAX); + if (ret) { + dev_err(qproc->dev, "Failed to set performance state.\n"); + return ret; + } } ret = q6v5_clk_enable(qproc->dev, qproc->proxy_clks, @@ -672,8 +676,8 @@ static int q6v5_start(struct rproc *rproc) q6v5_clk_disable(qproc->dev, qproc->proxy_clks, qproc->proxy_clk_count); - q6v5_regulator_disable(qproc, qproc->proxy_regs, - qproc->proxy_reg_count); + if (qproc->has_perf_state) + dev_pm_genpd_update_performance_state(qproc->dev, 0); return 0; @@ -1046,6 +1050,8 @@ static int q6v5_probe(struct platform_device *pdev) if (ret) goto free_rproc; + qproc->has_perf_state = pm_genpd_has_performance_state(&qproc->dev); + return 0; free_rproc: diff --git a/drivers/soc/qcom/rpmpd.c b/drivers/soc/qcom/rpmpd.c index 4e4f5cda9ce2..c1733da8a7c8 100644 --- a/drivers/soc/qcom/rpmpd.c +++ b/drivers/soc/qcom/rpmpd.c @@ -145,6 +145,7 @@ enum msm8996_devices { UFS, PCIE, USB3, + Q6V5_PIL, }; static struct rpmpd_freq_map msm8996_rpmpd_freq_map[] = { @@ -171,6 +172,10 @@ static struct rpmpd_freq_map msm8996_rpmpd_freq_map[] = { .freq[LOW] = 120000000, .freq[NOMINAL] = 150000000, }, + [Q6V5_PIL] = { + .pd = &msm8996_vddcx, + .freq[HIGH] = INT_MAX, + }, }; static const struct of_device_id rpmpd_performance_table[] = {