From patchwork Tue Jan 6 16:37:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 42789 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f71.google.com (mail-ee0-f71.google.com [74.125.83.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 30BD62062F for ; Tue, 6 Jan 2015 16:37:50 +0000 (UTC) Received: by mail-ee0-f71.google.com with SMTP id c13sf2095569eek.2 for ; Tue, 06 Jan 2015 08:37:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=HLn7oWI6H66GUXR4BGKbB76cVVktqEM3A7a0PRYPkRM=; b=KQdHljBZ4kvkkIaafRgCtm3adappVNtxL21iahHPSuAZMWoatvYCdVi2ZA4VIgPhJH By3t9IfSXGACJoPs9YyGVkXLNjPZ8VYFw6K0wZ9d9Ny6p5p0pUd8AY4j0g0kfccY9Bdm FG4tLveRsn25npf2OH/KT41cf13qoWLFafM+5PVIdtKTbezPQqXFAHfkgmejG+AIs+n8 8fL0LaRp00TClpvrD7LlkrX1d4Qk+lpuCNuNhTzUcrzzh5kL+DzLlsZp6Ja8e8n+Wjeq 27a3gAmLKWQO7g+DqQdyqlzyvv1mkSG3cnAvV7dUsJcG6X/yX+EVfsZO4VC3QzWw1Udo fDfg== X-Gm-Message-State: ALoCoQkJmbDqfYVJUcIdon2GI7OC50tSaAWpOqt8zp17knCXqQghQi89BePtM7tEr+EvMzCqISrh X-Received: by 10.112.141.232 with SMTP id rr8mr346042lbb.0.1420562269414; Tue, 06 Jan 2015 08:37:49 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.206.70 with SMTP id lm6ls60968lac.41.gmail; Tue, 06 Jan 2015 08:37:49 -0800 (PST) X-Received: by 10.112.172.194 with SMTP id be2mr102829458lbc.53.1420562269272; Tue, 06 Jan 2015 08:37:49 -0800 (PST) Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com. [209.85.217.170]) by mx.google.com with ESMTPS id ua8si66665517lac.7.2015.01.06.08.37.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 06 Jan 2015 08:37:49 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.170 as permitted sender) client-ip=209.85.217.170; Received: by mail-lb0-f170.google.com with SMTP id 10so19845057lbg.29 for ; Tue, 06 Jan 2015 08:37:49 -0800 (PST) X-Received: by 10.112.235.137 with SMTP id um9mr101318359lbc.41.1420562269153; Tue, 06 Jan 2015 08:37:49 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.9.200 with SMTP id c8csp1224860lbb; Tue, 6 Jan 2015 08:37:48 -0800 (PST) X-Received: by 10.68.129.229 with SMTP id nz5mr29015456pbb.144.1420562264590; Tue, 06 Jan 2015 08:37:44 -0800 (PST) Received: from mail-pa0-f47.google.com (mail-pa0-f47.google.com. [209.85.220.47]) by mx.google.com with ESMTPS id tw10si40741571pab.190.2015.01.06.08.37.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 06 Jan 2015 08:37:44 -0800 (PST) Received-SPF: pass (google.com: domain of mathieu.poirier@linaro.org designates 209.85.220.47 as permitted sender) client-ip=209.85.220.47; Received: by mail-pa0-f47.google.com with SMTP id kq14so31155258pab.6 for ; Tue, 06 Jan 2015 08:37:43 -0800 (PST) X-Received: by 10.66.171.206 with SMTP id aw14mr156590906pac.40.1420562263663; Tue, 06 Jan 2015 08:37:43 -0800 (PST) Received: from t430.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [70.73.24.112]) by mx.google.com with ESMTPSA id iv1sm42245554pbc.87.2015.01.06.08.37.42 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 06 Jan 2015 08:37:42 -0800 (PST) From: mathieu.poirier@linaro.org To: liviu.dudau@arm.com, sudeep.holla@arm.com, lorenzo.pieralisi@arm.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, mathieu.poirier@linaro.org, patches@linaro.org Subject: [PATCH 3/9] coresight-funnel: Adding runtime PM awareness Date: Tue, 6 Jan 2015 09:37:07 -0700 Message-Id: <1420562233-2015-4-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1420562233-2015-1-git-send-email-mathieu.poirier@linaro.org> References: <1420562233-2015-1-git-send-email-mathieu.poirier@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: mathieu.poirier@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.170 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Mathieu Poirier Using the runtime API whenever HW access is required. As such and by associating a coresight component to a power domain in the device tree, faults associated to accessing unpowered devices are mitigated. Signed-off-by: Mathieu Poirier --- drivers/coresight/coresight-funnel.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/coresight/coresight-funnel.c b/drivers/coresight/coresight-funnel.c index 2108edffe1f4..b655ecfb23c6 100644 --- a/drivers/coresight/coresight-funnel.c +++ b/drivers/coresight/coresight-funnel.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "coresight-priv.h" @@ -73,6 +74,7 @@ static int funnel_enable(struct coresight_device *csdev, int inport, if (ret) return ret; + pm_runtime_get_sync(drvdata->dev); funnel_enable_hw(drvdata, inport); dev_info(drvdata->dev, "FUNNEL inport %d enabled\n", inport); @@ -98,7 +100,7 @@ static void funnel_disable(struct coresight_device *csdev, int inport, struct funnel_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); funnel_disable_hw(drvdata, inport); - + pm_runtime_put_sync(drvdata->dev); clk_disable_unprepare(drvdata->clk); dev_info(drvdata->dev, "FUNNEL inport %d disabled\n", inport); @@ -161,8 +163,10 @@ static ssize_t funnel_ctrl_show(struct device *dev, if (ret) return ret; + pm_runtime_get_sync(drvdata->dev); val = get_funnel_ctrl_hw(drvdata); clk_disable_unprepare(drvdata->clk); + pm_runtime_put_sync(drvdata->dev); return sprintf(buf, "%#x\n", val); } @@ -222,6 +226,9 @@ static int funnel_probe(struct amba_device *adev, const struct amba_id *id) if (IS_ERR(drvdata->csdev)) return PTR_ERR(drvdata->csdev); + pm_runtime_set_suspended(dev); + pm_runtime_put_noidle(dev); + dev_info(dev, "FUNNEL initialized\n"); return 0; }