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: 9716473 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 46B61602A0 for ; Mon, 8 May 2017 16:35:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 37D6C20242 for ; Mon, 8 May 2017 16:35:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2BD3F204C2; Mon, 8 May 2017 16:35:15 +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 C4AE320242 for ; Mon, 8 May 2017 16:35:14 +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=/dELyzcDsbW7Ktu0deWaam4XudZRDHVLbwc917qOUVk=; b=hZK KYKOl97ZcgKab31F8K1IWh58hNyTJrMb/7PKHj8b9sWV9aZcdSHqMk3fB+vP8NFTH8c+E7eVFi4zr 7rH6OuC2iJkBEBINO/aT1p4q6v4Fgqqb89kFH9867ENHbsim3XbMtUMgob3VJtfkwV1CBzVuVQRnL JkbwMsDPxi6Uesol3BiFYeC+V3DUNdlau0kos36qGy4H96ceZBBli7MK9gg7+Rw/OmhLUYxgbxAOC tmuwowYDmRjUuNvOHR/CrNfKQs25ZxD7KNPGdYiSFalzXqgE66GKcXl+dyLA0BUR6/rcyBDERTbqS mFB7TBuizqVkDfh+DZeCWat8TTBxgow==; 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 1d7lcw-0008TU-AU; Mon, 08 May 2017 16:35:14 +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-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: 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-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=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 */