From patchwork Tue Jan 29 23:20:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 157017 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp5253736jaa; Tue, 29 Jan 2019 15:20:43 -0800 (PST) X-Google-Smtp-Source: ALg8bN6xg5fDDrMHSse9ly9XJJ+qPG3b0hyz9xdk8Y6ien+w6TKC38s1zkg7P2ikwLI/Z7671+gF X-Received: by 2002:a17:902:4601:: with SMTP id o1mr27995774pld.243.1548804043009; Tue, 29 Jan 2019 15:20:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548804043; cv=none; d=google.com; s=arc-20160816; b=R5Re42GeiumxlFW2Bu4WmddG4uFYionZ3yllEYMqz2oL9/RAgMIm+zMF76CyPTXeq6 ZwRATpG3o1jvLA94m4PMDxAfuByHGX+bWU81axIvGAe1BcO7u0DuFts0fylTumAtp7df RlJI1TlFaYRWJRy83HFyYnmiXYQ5O94K+zJfLb9F/siomhSZG7Br1SUhAjA2SeaSA+fF kOg0pQvPe/H5h2xi9h2hM6rd9orMamLiAcIkhrdhg5Y5LLy0EZ7paH/Qa4buEP4LW+ZQ zQ5QvMHtpa681pL+d8UeKnPpAhUomorXm4VcvKX/RAAjG/zmBXLfoZKXD785fZqxxaxJ pYXQ== 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:dkim-signature; bh=+VB4lYf9DNI0f5oxIEKDuBpa7GNxZTlTEpIziZQr2lk=; b=ta3s+W6QR9JC5/UZC8xT90t4ybppsWS6rT5k3WIH1c8sq5ioX6+9LzUbRWGJfzV/Iv PQMLRgx0NXB5gDDEzThRSIu8hwF5n0bMk5raNyCeuj12rvKAIuiwMQHI9x4CmjaAk5q9 w3LPLHgI9F0MYx9MeF3ddGt7hAKEgq4WoV/GZ4i94qLW3CsuuiRW22/ILaYYhToWby2l 8kF2oAjv65AlIbGQTcw3ovgEbIn6txPc+R5MWTt216kUaT/MqFvOfDSXytEqO7xZDpff CY3aT4dg0YnNOxfSQ/nlNtaxoWU5Q43zCDzuG3laDuQXMRlD+Sr/+TPY9uPGwjJk3+bA h1UA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FK7a1zOH; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-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 m39si37433692plg.315.2019.01.29.15.20.42; Tue, 29 Jan 2019 15:20:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-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=FK7a1zOH; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-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 S1729959AbfA2XUl (ORCPT + 7 others); Tue, 29 Jan 2019 18:20:41 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:45051 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729954AbfA2XUk (ORCPT ); Tue, 29 Jan 2019 18:20:40 -0500 Received: by mail-pf1-f193.google.com with SMTP id u6so10412157pfh.11 for ; Tue, 29 Jan 2019 15:20:40 -0800 (PST) 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; bh=+VB4lYf9DNI0f5oxIEKDuBpa7GNxZTlTEpIziZQr2lk=; b=FK7a1zOH+uDiPanqJJPgFQlERDW5djLwpFLeN7Z2c1/2lJ/xPoSynfnEbwPnHTlDvk IqVKTreSXLXARjzAQntWrAqb932VVEj4lJP9L9+oNTcVHo3vMhb7nweJrlTbJrEXvOZb gq0BbHPcby5ijOA8fxpYJhQmjiVteLp41lz7c= 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; bh=+VB4lYf9DNI0f5oxIEKDuBpa7GNxZTlTEpIziZQr2lk=; b=DW8hQbjq3V/o1EHHF2rjI5CoUXd9csrDdWMAahNO1D0Qx4AE6Zu3u5BjaSkVMhJFzc SY2rdrWsWlDxiJUU4mEKQCcD2JElSyJ4K4KwpOa92EoJacHxtnTTmehLUn52c0SMTU/h wbKI9YP2hOZcgRu8p458nCTR7HvMzaqO9k7Y9TvArcOStnOns9qRDXJ9lLLxv60n009l Oi+S1mAfS45Tl2hyLyKuGCxahhgykD7fkZ9FBWLn2qAMCkhPzJAsgKSKSAgOhGtY5o0m wOLRcxFuQvpeNvIRaTfok181C9piIhbgcJcRg7G4BkmdSzwNg7jPXiSt+pOYAzwfTTZ1 RAEw== X-Gm-Message-State: AJcUukchX0POt4n3U9gfsqFMK5el0vWeZH7Foeyjv3SKvnS/YsFfvIJt J8UfWgu2ajeIjUr2GxFk/SNQrJvUlnY= X-Received: by 2002:a63:111c:: with SMTP id g28mr25113118pgl.85.1548804039696; Tue, 29 Jan 2019 15:20:39 -0800 (PST) Received: from localhost.localdomain (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id v70sm51182779pfa.152.2019.01.29.15.20.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Jan 2019 15:20:38 -0800 (PST) From: Bjorn Andersson To: Ohad Ben-Cohen , Bjorn Andersson Cc: Andy Gross , David Brown , Rob Herring , Mark Rutland , Arun Kumar Neelakantam , Sibi Sankar , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org Subject: [PATCH v4 08/10] remoteproc: q6v5-mss: Active powerdomain for SDM845 Date: Tue, 29 Jan 2019 15:20:07 -0800 Message-Id: <20190129232009.5033-9-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20190129232009.5033-1-bjorn.andersson@linaro.org> References: <20190129232009.5033-1-bjorn.andersson@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org The SDM845 MSS needs the load_state powerdomain voted for during the duration of the MSS being powered on, to let the AOSS know that it may not perform certain power save measures. So vote for this. Tested-by: Sibi Sankar Reviewed-by: Sibi Sankar Signed-off-by: Bjorn Andersson --- Changes since v3: - None drivers/remoteproc/qcom_q6v5_mss.c | 31 ++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) -- 2.18.0 diff --git a/drivers/remoteproc/qcom_q6v5_mss.c b/drivers/remoteproc/qcom_q6v5_mss.c index c32c63e351a0..e30f5486fd20 100644 --- a/drivers/remoteproc/qcom_q6v5_mss.c +++ b/drivers/remoteproc/qcom_q6v5_mss.c @@ -133,6 +133,7 @@ struct rproc_hexagon_res { char **proxy_clk_names; char **reset_clk_names; char **active_clk_names; + char **active_pd_names; char **proxy_pd_names; int version; bool need_mem_protection; @@ -159,10 +160,12 @@ struct q6v5 { struct clk *active_clks[8]; struct clk *reset_clks[4]; struct clk *proxy_clks[4]; + struct device *active_pds[1]; struct device *proxy_pds[3]; int active_clk_count; int reset_clk_count; int proxy_clk_count; + int active_pd_count; int proxy_pd_count; struct reg_info active_regs[1]; @@ -730,10 +733,16 @@ static int q6v5_mba_load(struct q6v5 *qproc) qcom_q6v5_prepare(&qproc->q6v5); + ret = q6v5_pds_enable(qproc, qproc->active_pds, qproc->active_pd_count); + if (ret < 0) { + dev_err(qproc->dev, "failed to enable active power domains\n"); + goto disable_irqs; + } + ret = q6v5_pds_enable(qproc, qproc->proxy_pds, qproc->proxy_pd_count); if (ret < 0) { dev_err(qproc->dev, "failed to enable proxy power domains\n"); - goto disable_irqs; + goto disable_active_pds; } ret = q6v5_regulator_enable(qproc, qproc->proxy_regs, @@ -839,6 +848,8 @@ static int q6v5_mba_load(struct q6v5 *qproc) qproc->proxy_reg_count); disable_proxy_pds: q6v5_pds_disable(qproc, qproc->proxy_pds, qproc->proxy_pd_count); +disable_active_pds: + q6v5_pds_disable(qproc, qproc->active_pds, qproc->active_pd_count); disable_irqs: qcom_q6v5_unprepare(&qproc->q6v5); @@ -878,6 +889,7 @@ static void q6v5_mba_reclaim(struct q6v5 *qproc) qproc->active_clk_count); q6v5_regulator_disable(qproc, qproc->active_regs, qproc->active_reg_count); + q6v5_pds_disable(qproc, qproc->active_pds, qproc->active_pd_count); /* In case of failure or coredump scenario where reclaiming MBA memory * could not happen reclaim it here. @@ -1412,11 +1424,19 @@ static int q6v5_probe(struct platform_device *pdev) } qproc->active_reg_count = ret; + ret = q6v5_pds_attach(&pdev->dev, qproc->active_pds, + desc->active_pd_names); + if (ret < 0) { + dev_err(&pdev->dev, "Failed to attach active power domains\n"); + goto free_rproc; + } + qproc->active_pd_count = ret; + ret = q6v5_pds_attach(&pdev->dev, qproc->proxy_pds, desc->proxy_pd_names); if (ret < 0) { dev_err(&pdev->dev, "Failed to init power domains\n"); - goto free_rproc; + goto detach_active_pds; } qproc->proxy_pd_count = ret; @@ -1452,6 +1472,8 @@ static int q6v5_probe(struct platform_device *pdev) detach_proxy_pds: q6v5_pds_detach(qproc, qproc->proxy_pds, qproc->proxy_pd_count); +detach_active_pds: + q6v5_pds_detach(qproc, qproc->active_pds, qproc->active_pd_count); free_rproc: rproc_free(rproc); @@ -1469,6 +1491,7 @@ static int q6v5_remove(struct platform_device *pdev) qcom_remove_smd_subdev(qproc->rproc, &qproc->smd_subdev); qcom_remove_ssr_subdev(qproc->rproc, &qproc->ssr_subdev); + q6v5_pds_detach(qproc, qproc->active_pds, qproc->active_pd_count); q6v5_pds_detach(qproc, qproc->proxy_pds, qproc->proxy_pd_count); rproc_free(qproc->rproc); @@ -1495,6 +1518,10 @@ static const struct rproc_hexagon_res sdm845_mss = { "mnoc_axi", NULL }, + .active_pd_names = (char*[]){ + "load_state", + NULL + }, .proxy_pd_names = (char*[]){ "cx", "mx",