From patchwork Mon May 8 16:34:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ayaka X-Patchwork-Id: 9716475 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 91386602A0 for ; Mon, 8 May 2017 16:35:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 82C3520242 for ; Mon, 8 May 2017 16:35:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 774FF204C2; Mon, 8 May 2017 16:35:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2699B20242 for ; Mon, 8 May 2017 16:35:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=unNyRYsYrIzm+6VXYAiNa/1KabF6PXDwSkSTo8DRj2E=; b=iWz uYb57Uwg6wjN+4dJGW9BRdSYK7OyxQcSYgOFMHGm7gSnTpRSpbnuhAudYtv/Gl9UwRCNv1WymL+jn SKq32NQ34c7px8InUuSACe8FfxMvb403lOZE3c/GcD7nF6Gq95o8HhC5miBWG8u47zibiav59/fiR 3CWh80PlFmTsCrOW9v/BiyfBUvq/BBONaN3O/BvB3fHqgeiKnzUOaWE2f/shyp/fVUAEghlG4z8ck yMEcNjbil411q5UyNkWq0uOpZjwQFpIKl/bgHcYWP7N3t9iDyXzDi/r6RjyRgtVEG5420fhUv1U6f hmwwlLnEWLsRQWl/4LEWDq0JCZq0gSA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1d7ld9-0000KM-2h; Mon, 08 May 2017 16:35:27 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d7lcg-000754-L6; Mon, 08 May 2017 16:34:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=wKqLG19iQmABuoLaoz4zVJj4sNDJz7+eJVdq+MXzotk=; b=YPzV7qfMqOxYwSXU/uHdNTv0m nz6Oq7gpl0VIfv1scllUz+DG47CLOcm4SALh7DQTFAihs9D93mzLX0LX3VflYP7ttruU+q/5o23QM IkdT5HQrYZ7livZfA6D8COV07wYVrL8KOMqPwApvJUcwvzs+RCfi2oWoi4OaIyiueXZ7K6bP4lUIN nhqFa/rcpo/8+OwzZo+ZGQNOBFy2zQ7OHam8n/TStWpftx7ftX6t+YeHj4GMEOaWI7Kf5FCbFDszH VAvEpcD584CqtpvvhP2r/MLc1rh59I5j5i/6H+nZicAZjZ48VsS5ZhPiaxGn2Dez960RyT+bQKljL NMeVQX2XA==; Received: from kozue.soulik.info ([2001:19f0:7000:8404:5054:ff:fe75:428f]) by merlin.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d7lcf-00068m-4s; Mon, 08 May 2017 16:34:58 +0000 Received: from misaki.sumomo.pri (unknown [IPv6:2001:470:b30d:2:3fe5:5e2:ef97:4abb]) by kozue.soulik.info (Postfix) with ESMTPA id 467BA100813; Tue, 9 May 2017 01:35:00 +0900 (JST) From: Randy Li To: linux-rockchip@lists.infradead.org Subject: [PATCH] soc: rockchip: power-domain: export idle request Date: Tue, 9 May 2017 00:34:17 +0800 Message-Id: <20170508163417.15017-1-ayaka@soulik.info> X-Mailer: git-send-email 2.9.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170508_123457_344651_0E9CB4C0 X-CRM114-Status: GOOD ( 14.46 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Randy Li , heiko@sntech.de, zhangqing@rock-chips.com, dianders@chromium.org, linux-kernel@vger.kernel.org, Jeffy Chen , linux-arm-kernel@lists.infradead.org, wxt@rock-chips.com MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP We need to put the power status of HEVC/RKVDEC IP into IDLE unless we can't reset that IP or the SoC would crash down. rockchip_pmu_idle_request(dev, true)---> enter idle rockchip_pmu_idle_request(dev, false)---> exit idle Only the video codec drivers of rockchip platform would request this patch currently. I am not sure whether it is necessary to add a new function at generic power domain. I want someone give me some advises here. Signed-off-by: Caesar Wang Signed-off-by: Jeffy Chen Signed-off-by: Randy Li --- drivers/soc/rockchip/pm_domains.c | 24 ++++++++++++++++++++++++ include/linux/rockchip_pmu.h | 15 +++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 include/linux/rockchip_pmu.h diff --git a/drivers/soc/rockchip/pm_domains.c b/drivers/soc/rockchip/pm_domains.c index 796c46a..c1bff1c 100644 --- a/drivers/soc/rockchip/pm_domains.c +++ b/drivers/soc/rockchip/pm_domains.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -179,6 +180,29 @@ static int rockchip_pmu_set_idle_request(struct rockchip_pm_domain *pd, return 0; } +int rockchip_pmu_idle_request(struct device *dev, bool idle) +{ + struct generic_pm_domain *genpd; + struct rockchip_pm_domain *pd; + int ret; + + if (IS_ERR_OR_NULL(dev)) + return -EINVAL; + + if (IS_ERR_OR_NULL(dev->pm_domain)) + return -EINVAL; + + genpd = pd_to_genpd(dev->pm_domain); + pd = to_rockchip_pd(genpd); + + mutex_lock(&pd->pmu->mutex); + ret = rockchip_pmu_set_idle_request(pd, idle); + mutex_unlock(&pd->pmu->mutex); + + return ret; +} +EXPORT_SYMBOL(rockchip_pmu_idle_request); + static int rockchip_pmu_save_qos(struct rockchip_pm_domain *pd) { int i; diff --git a/include/linux/rockchip_pmu.h b/include/linux/rockchip_pmu.h new file mode 100644 index 0000000..720b331 --- /dev/null +++ b/include/linux/rockchip_pmu.h @@ -0,0 +1,15 @@ +/* + * pm_domain.h - Definitions and headers related to device power domains. + * + * Copyright (C) 2017 Randy Li . + * + * This file is released under the GPLv2. + */ + +#ifndef _LINUX_ROCKCHIP_PM_H +#define _LINUX_ROCKCHIP_PM_H +#include + +int rockchip_pmu_idle_request(struct device *dev, bool idle); + +#endif /* _LINUX_ROCKCHIP_PM_H */