From patchwork Sat Jan 5 17:48:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ayaka X-Patchwork-Id: 10749319 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 36B0514E5 for ; Sat, 5 Jan 2019 17:49:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 226E4284F0 for ; Sat, 5 Jan 2019 17:49:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 16CBC287F9; Sat, 5 Jan 2019 17:49:18 +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=ham 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 89E97284F0 for ; Sat, 5 Jan 2019 17:49:17 +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=8VMGdP4eTgK/4TNEqf9iPG52lpiEQjeJXorH+XCKXww=; b=FjAVsqEvcFADDH FhElxx0uTgAksgEfZ54c77m5on6wyMD7f+egq0GuMwxxWpmbLnv4E8HheasWY4qIXbp2Oixm60oMI B8XQEoLHAkgMGtwzZkA33TLHb8DdlKijtVrAdKkG8AnXz6i9znv8gdp4OY1V0OCyQip2umbaIin0E YJDyqvYJACJHuutAsi4Nnf7p9DyNJhWt/yWk8OKBbC4iwoKfv3D9vir+Zazh1KLHoiJxnCcRNbKuV k5z8VnYc0Cugh+raz9YrUzyvPOPBQccuj2xyv48Wz7GwjYucd2yiBya+kPB1tkmv//SuoLH+uDmU9 K2yGWYHIfcISzaX0dkUg==; 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 1gfq4O-0006a8-EK; Sat, 05 Jan 2019 17:49:12 +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 1gfq4C-0006Pp-LS; Sat, 05 Jan 2019 17:49:02 +0000 Received: from misaki.sumomo.pri (unknown [IPv6:2001:470:b30d:2:c604:15ff:0:a00]) by kozue.soulik.info (Postfix) with ESMTPA id 91048101714; Sun, 6 Jan 2019 02:49:36 +0900 (JST) From: Randy Li To: linux-rockchip@lists.infradead.org Subject: [PATCH 1/3] clk: rockchip: add video clk parents for rk3399 Date: Sun, 6 Jan 2019 01:48:35 +0800 Message-Id: <20190105174837.19378-2-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_094900_811827_DAA34140 X-CRM114-Status: UNSURE ( 7.43 ) X-CRM114-Notice: Please train this message. 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: 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, linux-arm-kernel@lists.infradead.org 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 Video codec won't work properly with a clock too low nor too high. We need to export them, allowing the device tree to assign a suitable clocks for them. Signed-off-by: Randy Li --- drivers/clk/rockchip/clk-rk3399.c | 5 +++-- include/dt-bindings/clock/rk3399-cru.h | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/clk/rockchip/clk-rk3399.c b/drivers/clk/rockchip/clk-rk3399.c index 5a628148f3f0..fe6cebcb26b6 100644 --- a/drivers/clk/rockchip/clk-rk3399.c +++ b/drivers/clk/rockchip/clk-rk3399.c @@ -740,7 +740,8 @@ static struct rockchip_clk_branch rk3399_clk_branches[] __initdata = { RK3399_CLKGATE_CON(15), 6, GFLAGS), /* vcodec */ - COMPOSITE(0, "aclk_vcodec_pre", mux_pll_src_cpll_gpll_npll_ppll_p, 0, + COMPOSITE(ACLK_VCODEC_PRE, "aclk_vcodec_pre", + mux_pll_src_cpll_gpll_npll_ppll_p, 0, RK3399_CLKSEL_CON(7), 6, 2, MFLAGS, 0, 5, DFLAGS, RK3399_CLKGATE_CON(4), 0, GFLAGS), COMPOSITE_NOMUX(0, "hclk_vcodec_pre", "aclk_vcodec_pre", 0, @@ -764,7 +765,7 @@ static struct rockchip_clk_branch rk3399_clk_branches[] __initdata = { RK3399_CLKSEL_CON(9), 14, 2, MFLAGS, 8, 5, DFLAGS, RK3399_CLKGATE_CON(4), 5, GFLAGS), - COMPOSITE(0, "aclk_vdu_pre", mux_pll_src_cpll_gpll_npll_ppll_p, 0, + COMPOSITE(ACLK_VDU_PRE, "aclk_vdu_pre", mux_pll_src_cpll_gpll_npll_ppll_p, 0, RK3399_CLKSEL_CON(8), 6, 2, MFLAGS, 0, 5, DFLAGS, RK3399_CLKGATE_CON(4), 2, GFLAGS), COMPOSITE_NOMUX(0, "hclk_vdu_pre", "aclk_vdu_pre", 0, diff --git a/include/dt-bindings/clock/rk3399-cru.h b/include/dt-bindings/clock/rk3399-cru.h index 22cb1dfa9004..dd13554aaf76 100644 --- a/include/dt-bindings/clock/rk3399-cru.h +++ b/include/dt-bindings/clock/rk3399-cru.h @@ -219,6 +219,8 @@ #define ACLK_GIC_PRE 262 #define ACLK_VOP0_PRE 263 #define ACLK_VOP1_PRE 264 +#define ACLK_VCODEC_PRE 265 +#define ACLK_VDU_PRE 266 /* pclk gates */ #define PCLK_PERIHP 320 From patchwork Sat Jan 5 17:48:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ayaka X-Patchwork-Id: 10749325 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 877DD17E1 for ; Sat, 5 Jan 2019 17:49:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 73C23284F0 for ; Sat, 5 Jan 2019 17:49:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 681E9287F9; Sat, 5 Jan 2019 17:49:37 +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=ham 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 BF471284F0 for ; Sat, 5 Jan 2019 17:49:36 +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=AsR4TUlBfXyD1TD2g3WDakVo6QMvzxyk2N/SprTFQho=; b=WdQ0Cl57S7uf3L DcyXCb0fDc5uAJAp4BLMdgpzHhaEXt9DmOEt0OiQMkGpx/HuoiYHa/spk7TSr5pcNoDNeO94gM3Nj e/0e/MKTgI5IvRtwoVRfcz+U4PpofcN5xa4uuAWJrY3Qo7+zjylIE2Y3AEV1qVeQ8gw6X7Erqoaqm TLC5BcOZB3qkTu2rOuVJduLZsuJmzjYtYKfaSFhRJSrVZwrpIWM9GmqB98KPkHD0/WOYAmSWp9KlN ts67ezP8GosOY0kt5V8A/pIsRDu7HKKXP2D+tkB1A0P3JINARoDwsA5bswUMZRki3Pr2pIHHRAZKS mLL6xmLHKsay+fqpI/2g==; 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 1gfq4f-0006sz-N4; Sat, 05 Jan 2019 17:49:29 +0000 Received: from kozue.soulik.info ([2001:19f0:7000:8404:5054:ff:fe75:428f]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gfq4E-0006QL-ML; Sat, 05 Jan 2019 17:49:04 +0000 Received: from misaki.sumomo.pri (unknown [IPv6:2001:470:b30d:2:c604:15ff:0:a00]) by kozue.soulik.info (Postfix) with ESMTPA id 80697101784; Sun, 6 Jan 2019 02:49:39 +0900 (JST) From: Randy Li To: linux-rockchip@lists.infradead.org Subject: [PATCH 2/3] arm64: dts: rockchip: add power domain to iommu rk3399 Date: Sun, 6 Jan 2019 01:48:36 +0800 Message-Id: <20190105174837.19378-3-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_094902_951111_2AA8E85B X-CRM114-Status: UNSURE ( 7.61 ) X-CRM114-Notice: Please train this message. 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: 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, linux-arm-kernel@lists.infradead.org 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 IOMMU device won't work without power unless PMU can't turn it off. Signed-off-by: Randy Li --- arch/arm64/boot/dts/rockchip/rk3399.dtsi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi index 6cc1c9fa4ea6..b22b2e40422b 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi @@ -1263,6 +1263,7 @@ clock-names = "aclk", "iface"; #iommu-cells = <0>; power-domains = <&power RK3399_PD_VCODEC>; + status = "disabled"; }; vdec_mmu: iommu@ff660480 { @@ -1273,6 +1274,7 @@ clocks = <&cru ACLK_VDU>, <&cru HCLK_VDU>; clock-names = "aclk", "iface"; #iommu-cells = <0>; + power-domains = <&power RK3399_PD_VDU>; status = "disabled"; }; 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: 10749329 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 D310814DE for ; Sat, 5 Jan 2019 17:49:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BE746284F0 for ; Sat, 5 Jan 2019 17:49:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B2550287F9; Sat, 5 Jan 2019 17:49:50 +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=ham 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 62AAB284F0 for ; Sat, 5 Jan 2019 17:49:50 +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=8KCRxXkqoeNGt7l590Sj2n6aZeAa+ce5OlI9fTVdtSs=; b=U98ZXUIZ6MyOf+ aOAQ30enyl3BxnAZJunJYVK/HChvL573xYzal+tcyW5JyAuMVWb8/UUurkcRq/v/wTndtNFf2YqTs pZDsOPojXkacFC1Rqo12ZiCJFcJCvI4biojZaUQdx6B/tQ0vdpfMXEmAyiA76Tde/0+0WFYmBDZI/ By1lhZ0y2V62IDhxFcN/GpC4uFNkLlDCp7eDMqOfJA+RtH2eiRaL/UiRHe/teJdKit7bj8qh1CYyK 5guPjLIOxVn2jHHu48NEHMknQRCNCKs18QNmYOc7sj+rBb6i2qBZUnrKZtTzf3Wmi/V+PNRq9fjCK 1nwqSSN8mJXEhdc8dzxw==; 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 1gfq4y-0007Dj-43; Sat, 05 Jan 2019 17:49:48 +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-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: 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-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 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