From patchwork Wed Jun 21 07:10:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 106052 Delivered-To: patch@linaro.org Received: by 10.140.91.2 with SMTP id y2csp1786217qgd; Wed, 21 Jun 2017 00:11:36 -0700 (PDT) X-Received: by 10.99.160.109 with SMTP id u45mr33000862pgn.138.1498029096739; Wed, 21 Jun 2017 00:11:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498029096; cv=none; d=google.com; s=arc-20160816; b=PAXbMGd4KHtVfD9daIxwyxREXnYyB6emQA+ZdOyNfLUvvh/j0/0cuvQ2hJV8Mgk9D3 8/MW4JD2Y7fc2uqXSUNKDuKqby0zHAbP3HpFMN/X3IGPpo3zbbUyACYxBzf4pjl4rcSO VsobN2FCgXUJgpCuzuTDVrwSH5kXpXuRhBIGtVVRus9GH9S6Ilezo++8W9Nl11rGnn0t 5JZpFk6RepCfmtje1f4j5dQpJE487+TzD67wOFYrKkEhCvsRsCTrAhRjogDvoJg/FNtX fCWdFQ8ALAYL7coZFRvum1Q4p0qu30fbG6B8Zw9Tp8aWII8vi8r9Qvbyg0L0AIY0Wmv3 xUcw== 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=Va45FFe3q25p0n3J83uGpcY0QWH+SpRIZBs03F9vbEM=; b=VgDv0gMVnGRcGEO9S9HlY43gGzXdvhSNPsszgW/6nyntEDEIng1T2bI/PQGfE526pC nYkGvy8ruFBftzTgwzgeZ2BhUnl3B0NP4T7+xhNTZIO/GawFSJJQ7ndb7Mj03Zqtqrts yff+fx1VOQX6NY8+edDpTpGm4CIQVtUAMOhrJ+od7Fn46AS34YxDkPYXKRX+Q4GQt0gO 9vu1Fl6kr6nuqDXzhA6VpTZhGrRgzEu3Xbz/B8H82aui9a2HZHw3t2sBPiu7EnAI8uWv 0qy5rEwj8VLJu6VXZmHNDI2eJ5rg6B8iGBF/T4UFOPjB/1Ef0iNg6yhS1P3bLWLucfOh Q2Yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=Ok5r/iGy; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 h66si12330513pfa.285.2017.06.21.00.11.36; Wed, 21 Jun 2017 00:11:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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.b=Ok5r/iGy; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1752590AbdFUHLY (ORCPT + 14 others); Wed, 21 Jun 2017 03:11:24 -0400 Received: from mail-pg0-f44.google.com ([74.125.83.44]:34902 "EHLO mail-pg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752555AbdFUHLW (ORCPT ); Wed, 21 Jun 2017 03:11:22 -0400 Received: by mail-pg0-f44.google.com with SMTP id 132so39875696pgb.2 for ; Wed, 21 Jun 2017 00:11:22 -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=Va45FFe3q25p0n3J83uGpcY0QWH+SpRIZBs03F9vbEM=; b=Ok5r/iGyFrkZRGE7psyfuuxnnZMbptPhzhNx9Q1DPOVZHDf8KRhTCCIs3/3UQM9XR1 KGhMAq/oSJffyYnGfXAflLXRpMLL72CrsaUtnloPQi7PZFhqHN5gZD4DuUB9tQVCTd6d +r4YiEObH4pZQ0F/YZKG2UNeu7HyTItwo6ieo= 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=Va45FFe3q25p0n3J83uGpcY0QWH+SpRIZBs03F9vbEM=; b=PNbHxI925AiRIp8WvQY/RGjsIzoD9od5OIAxWCNy7TPpeN721Z22aX5A2feCHwyzMr DVpS/7UInz8zI9AO4cpMwhVhfDTLh2SvLKKll8ekd4WjvFVwxe6wejQyQEaNaurSuil3 RxfEB6Kba31PvtbQChGx9jdECTuil5mvQXRT2NiB8pqiiex1w5mALpGpc53yC4sYWW2W NplMh8PWiQ7TO61C+JQFojsy4NSwuCAyTOtVlLja53nG9SvfD8GoT6XR1D3nDq1y2j9R +9P7HYVP6iGb+ukmNP3IoikTgQXkVCGWF8/fJERPzoH6aVVM07org632t2dre7cTwwxx FsKw== X-Gm-Message-State: AKS2vOzaq5jWTXrGa0qA0MpbOSFsGd5RNGbXsQxwtoYwx/9Q8cNz7H4Q Mgd9C9j3OhNmiU5U X-Received: by 10.99.113.65 with SMTP id b1mr35582012pgn.275.1498029076567; Wed, 21 Jun 2017 00:11:16 -0700 (PDT) Received: from localhost ([122.172.59.234]) by smtp.gmail.com with ESMTPSA id m11sm31341284pfg.85.2017.06.21.00.11.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Jun 2017 00:11:16 -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: [NOT-FOR-MERGE V8 6/6] remoteproc: qcom: q6v5: Vote for proxy powerdomain performance state Date: Wed, 21 Jun 2017 12:40:53 +0530 Message-Id: <3bc9ead29ae0171d2f099c2c060645597107c990.1498026827.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.13.0.71.gd7076ec9c9cb In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@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.13.0.71.gd7076ec9c9cb diff --git a/drivers/remoteproc/qcom_q6v5_pil.c b/drivers/remoteproc/qcom_q6v5_pil.c index 8fd697a3cf8f..47c9dad98ee8 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; }; @@ -603,11 +606,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 = 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, @@ -671,8 +675,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) + pm_genpd_update_performance_state(qproc->dev, 0); return 0; @@ -1043,6 +1047,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 7ef81429c5c5..b1af1442ebe9 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[] = {