From patchwork Sat Jan 5 17:48:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ayaka X-Patchwork-Id: 10749331 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DC9A614DE for ; Sat, 5 Jan 2019 17:50:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C6B05284F0 for ; Sat, 5 Jan 2019 17:50:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B8D4B287F9; Sat, 5 Jan 2019 17:50:09 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 716C3284F0 for ; Sat, 5 Jan 2019 17:50:09 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: 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: List-Owner; bh=1d9cSCR8S58EXGq+pakqhsI73ZOQEUFUlEqO0bIoPr4=; b=roLdU0omHz2cW+ Brd9M6L8uHL4KiABxQk1aOZxMeHQB2yQngl0vWHx54dy9MvMmVf3PVRLsRphUekVBnM4ihSSlTCAk t3LAhriM0CvLDfemgm1Q/A3AzzCDK94DgGrC1/3gfYB7OWsHxPlTYurUn5YXxkd5STV11sPpr9Gty h9K0UiQ54IaxmgB/4FLsqgZ3ZPWkt/leRUtiiUWGZBntTK7QUTDr6f+wIvGO1RZJYUEqwgDzH2GGJ PVIPjAJMSIBWpPtcmLc225jQdjHr3dznNJ8hqSXUO6Vy8q13aEuSnYwpmdiJlht/GScS2WtuIu3zC qG+GdyILnOmhHhpv+vXA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gfq5E-0007ar-O6; Sat, 05 Jan 2019 17:50:04 +0000 Received: from kozue.soulik.info ([108.61.200.231]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gfq4G-0006Re-VU; Sat, 05 Jan 2019 17:49:08 +0000 Received: from misaki.sumomo.pri (unknown [IPv6:2001:470:b30d:2:c604:15ff:0:a00]) by kozue.soulik.info (Postfix) with ESMTPA id F0844101811; Sun, 6 Jan 2019 02:49:41 +0900 (JST) From: Randy Li To: linux-rockchip@lists.infradead.org Subject: [PATCH 3/3] soc: rockchip: power-domain: export idle request Date: Sun, 6 Jan 2019 01:48:37 +0800 Message-Id: <20190105174837.19378-4-ayaka@soulik.info> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190105174837.19378-1-ayaka@soulik.info> References: <20190105174837.19378-1-ayaka@soulik.info> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190105_094905_523550_23177526 X-CRM114-Status: UNSURE ( 8.29 ) X-CRM114-Notice: Please train this message. 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: ulf.hansson@linaro.org, zhangqing@rock-chips.com, heiko@sntech.de, geert+renesas@glider.be, sboyd@kernel.org, mturquette@baylibre.com, Randy Li , linux-kernel@vger.kernel.org, Jeffy Chen , linux-arm-kernel@lists.infradead.org, Caesar Wang 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 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 Signed-off-by: Caesar Wang Signed-off-by: Jeffy Chen Signed-off-by: Randy Li --- drivers/soc/rockchip/pm_domains.c | 23 +++++++++++++++++++++++ include/soc/rockchip/pm_domains.h | 18 ++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 include/soc/rockchip/pm_domains.h diff --git a/drivers/soc/rockchip/pm_domains.c b/drivers/soc/rockchip/pm_domains.c index 847c7c482b26..3e2e252cb64b 100644 --- a/drivers/soc/rockchip/pm_domains.c +++ b/drivers/soc/rockchip/pm_domains.c @@ -199,6 +199,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/soc/rockchip/pm_domains.h b/include/soc/rockchip/pm_domains.h new file mode 100644 index 000000000000..690db6118636 --- /dev/null +++ b/include/soc/rockchip/pm_domains.h @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __SOC_ROCKCHIP_PM_DOMAINS_H +#define __SOC_ROCKCHIP_PM_DOMAINS_H + +#include + +struct device; + +#ifdef CONFIG_ROCKCHIP_PM_DOMAINS +int rockchip_pmu_idle_request(struct device *dev, bool idle); +#else +static inline int rockchip_pmu_idle_request(struct device *dev, bool idle) +{ + return -ENOTSUPP; +} +#endif + +#endif