From patchwork Wed Aug 2 10:12:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 109205 Delivered-To: patch@linaro.org Received: by 10.140.101.6 with SMTP id t6csp2590806qge; Wed, 2 Aug 2017 03:13:15 -0700 (PDT) X-Received: by 10.98.102.149 with SMTP id s21mr22682161pfj.331.1501668795335; Wed, 02 Aug 2017 03:13:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501668795; cv=none; d=google.com; s=arc-20160816; b=zMIytacDOX68HAMi6Lul106KvFcuhLGl5XP9m66hKBB8Wxf5skCIUsJOc69pJs/hB1 8W0JB6V4Fk6LKvYf1E32csqc1O4Dgx0aLlJVn7Wt1IKlMRz8epoeDfnnNVWIfqszHm2C ZVePMRUvyngJSwH6plMDykPPkLHJCUZ1/cDx8LW9VN8nFVZihG37/+dibOKRVYF6vqR1 MbzZMIpPMayS3G7lulc9SBDZRXupRwvmSa9Us/dNAVGEFKE+9lDxy55+m/hrOfras8fL gwafOLVENeYLfO137jA6hr9SYox/VlaVBDUVXL2WtF/Ops71n96nlkPEYqvUu1L364ac Fp0g== 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=JNNwhuEdfBzQXGQfzTSMrKgozOgWmiF/fw1fFUkDXB4=; b=dMX3be7W43Gx5QgvfSPIgG6ScOaOYNorlypWFvMn9uq4qIADRc05buMLNsh0vKw0Ar UR2bnnCk+YHs4bWTpeKiZ0HU56WRZr/CoQU+rsmFjzxP0CiKOTRRgeX+dGwMEFQC66EO gP37X8O4oxjXU7s/kJgf0mx5BdYCJqQe163wVtEy4vIElpnu7XbNDkPzT9O8AnzCcj3p i7dBCOaaWHJwXMpx8HpK/DX31s8LQHdoacbLF9WxovsGDsVEgxyw9EXTgAxY4ims/kOU eBJaGBp6FqYjTuNH4yv8BU9S8QI4jpOYiWKQ0urSHuLx26AMX0BQYkT8ibL9ziX8f1mK 9kEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=hwc4JX09; 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 g25si1641480plj.140.2017.08.02.03.13.14; Wed, 02 Aug 2017 03:13:15 -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.b=hwc4JX09; 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 S1752935AbdHBKNN (ORCPT + 25 others); Wed, 2 Aug 2017 06:13:13 -0400 Received: from mail-pg0-f46.google.com ([74.125.83.46]:35690 "EHLO mail-pg0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752883AbdHBKNF (ORCPT ); Wed, 2 Aug 2017 06:13:05 -0400 Received: by mail-pg0-f46.google.com with SMTP id v189so19398702pgd.2 for ; Wed, 02 Aug 2017 03:13:05 -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=JNNwhuEdfBzQXGQfzTSMrKgozOgWmiF/fw1fFUkDXB4=; b=hwc4JX09IM6dQ2lAn+f9rIXMokslyQ8Q6v5pYO/euXEqdOU4rdTMeGqFRvWWvbTcjM Lh9f42oCcMdaXuIBxF216JnmPLwwMTiAJzoYgbJA1blRhe02qLeoKrakz7OECERhXD71 /tEv25J0X0FzwuBoYfNXJwjqWkCLxYASkIdUY= 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=JNNwhuEdfBzQXGQfzTSMrKgozOgWmiF/fw1fFUkDXB4=; b=ozgVuixKJF4haGuuACk7EAhmTf0cEl7LPlHCJrfSz04ctaNuCBzXQ7WB+loIKXJc5w VVhvmEUyu4G8FTcJcEJp8JY76a8zMirhcE/ZdG+1zR7dVnDJ1qugam4xYOKzFJL9Ev1r IE2TkpJdZOtwaA1pHGwP4M//MGgM5ZlfrM8qtwMO0VmdZ2/CYakvJyD9/SY3u+YgoLuu XWz6fX5+wrn/qkhQYiqPJT/Mo9C0pTD0DsmEUXkoO9ZwePXC2fKQ5nPLgW4pWKqY+VXH kJJ3E4xzCl1Q33V5v5oc8wDpBDU6DAE/SV/rA16FW4FZ3yATufgIu8ZoKTM9Bq9L37yz nwrQ== X-Gm-Message-State: AIVw1132h4d3REUONsRHHlMCSZVqQUEgtd2/NjeWTFyTyOytPNZoz/zn 2Z5D49+VIL/Y02af X-Received: by 10.99.240.69 with SMTP id s5mr21471530pgj.23.1501668784990; Wed, 02 Aug 2017 03:13:04 -0700 (PDT) Received: from localhost ([122.171.108.183]) by smtp.gmail.com with ESMTPSA id 86sm2096203pfm.105.2017.08.02.03.13.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Aug 2017 03:13:04 -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 V9 7/7] remoteproc: qcom: q6v5: Vote for proxy powerdomain performance state Date: Wed, 2 Aug 2017 15:42:38 +0530 Message-Id: <632eb4c9568177dd7a3f3c29ba88698616f6e4ad.1501668354.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-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.13.0.71.gd7076ec9c9cb diff --git a/drivers/remoteproc/qcom_q6v5_pil.c b/drivers/remoteproc/qcom_q6v5_pil.c index 8fd697a3cf8f..586f74ddd909 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 = 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, @@ -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) + dev_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 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[] = {