2019-01-05 17:51:09

by Randy Li

[permalink] [raw]
Subject: [PATCH 0/3] The basic patches for rockchip video codec

I will post a driver for video codec using the vendor userspace
interface. It is not used for merging but checking the work status of
the other devices and pre-patches need to be merged.

Without the following modification, video codec can't work properly.
I check the status of the upstream kernel for rockchip, network, eMMC,
USB and VOP work much worse and slow than the vendor kernel. I think the
video codec driver would be a good example to verify the other drivers.

Randy Li (3):
clk: rockchip: add video clk parents for rk3399
arm64: dts: rockchip: add power domain to iommu rk3399
soc: rockchip: power-domain: export idle request

arch/arm64/boot/dts/rockchip/rk3399.dtsi | 2 ++
drivers/clk/rockchip/clk-rk3399.c | 5 +++--
drivers/soc/rockchip/pm_domains.c | 23 +++++++++++++++++++++++
include/dt-bindings/clock/rk3399-cru.h | 2 ++
include/soc/rockchip/pm_domains.h | 18 ++++++++++++++++++
5 files changed, 48 insertions(+), 2 deletions(-)
create mode 100644 include/soc/rockchip/pm_domains.h

--
2.20.1



2019-01-05 17:50:29

by Randy Li

[permalink] [raw]
Subject: [PATCH 2/3] arm64: dts: rockchip: add power domain to iommu rk3399

IOMMU device won't work without power unless PMU
can't turn it off.

Signed-off-by: Randy Li <[email protected]>
---
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";
};

--
2.20.1


2019-01-05 17:50:29

by Randy Li

[permalink] [raw]
Subject: [PATCH 1/3] clk: rockchip: add video clk parents for rk3399

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 <[email protected]>
---
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
--
2.20.1


2019-01-05 17:52:01

by Randy Li

[permalink] [raw]
Subject: [PATCH 3/3] soc: rockchip: power-domain: export idle request

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 <[email protected]>
Signed-off-by: Jeffy Chen <[email protected]>
Signed-off-by: Randy Li <[email protected]>
---
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 <linux/errno.h>
+
+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
--
2.20.1