linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] Enable decoder for mt8183
@ 2023-06-05 16:20 Nícolas F. R. A. Prado
  2023-06-05 16:20 ` [PATCH 5/6] clk: mediatek: mt8183: Add CLK_VDEC_ACTIVE to vdec Nícolas F. R. A. Prado
  0 siblings, 1 reply; 3+ messages in thread
From: Nícolas F. R. A. Prado @ 2023-06-05 16:20 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil
  Cc: AngeloGioacchino Del Regno, kernel, Nícolas F. R. A. Prado,
	Andrew-CT Chen, Chen-Yu Tsai, Conor Dooley, Krzysztof Kozlowski,
	Mauro Carvalho Chehab, Michael Turquette, Miles Chen,
	Rob Herring, Stephen Boyd, Tiffany Lin, Yunfei Dong, devicetree,
	linux-arm-kernel, linux-clk, linux-kernel, linux-media,
	linux-mediatek


This series enables the hardware decoder present on mt8183. At first
glance, the only missing piece is the devicetree node for it, however,
simply adding it as is would cause an address collision between the
first register iospace and the clock-controller node, so a rework of the
dt-binding and driver, as well as addition of a clock, were needed
first.

Tested that H264 decoding works with the hardware decoder on
mt8183-kukui-jacuzzi-juniper-sku16, giving a fluster score of 98/135 on
the JVT-AVC_V1 test suite. And ensured other SoCs (MT8192 and MT8195)
still work as usual.


Nícolas F. R. A. Prado (5):
  media: dt-bindings: mediatek,vcodec: Allow single clock for mt8183
  media: dt-bindings: mediatek,vcodec: Don't require assigned-clocks
  media: dt-bindings: mediatek,vcodec: Remove VDEC_SYS for mt8183
  media: mediatek: vcodec: Read HW active status from clock
  clk: mediatek: mt8183: Add CLK_VDEC_ACTIVE to vdec

Yunfei Dong (1):
  arm64: dts: mediatek: mt8183: Add decoder

 .../media/mediatek,vcodec-decoder.yaml        | 56 ++++++++++++++----
 arch/arm64/boot/dts/mediatek/mt8183.dtsi      | 39 ++++++++++++
 drivers/clk/mediatek/clk-mt8183-vdec.c        |  5 ++
 .../mediatek/vcodec/mtk_vcodec_dec_drv.c      | 59 +++++++++++++++----
 .../mediatek/vcodec/mtk_vcodec_dec_hw.c       | 20 +++++--
 .../mediatek/vcodec/mtk_vcodec_dec_pm.c       | 12 +++-
 .../platform/mediatek/vcodec/mtk_vcodec_drv.h |  1 +
 include/dt-bindings/clock/mt8183-clk.h        |  3 +-
 8 files changed, 165 insertions(+), 30 deletions(-)

-- 
2.40.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 5/6] clk: mediatek: mt8183: Add CLK_VDEC_ACTIVE to vdec
  2023-06-05 16:20 [PATCH 0/6] Enable decoder for mt8183 Nícolas F. R. A. Prado
@ 2023-06-05 16:20 ` Nícolas F. R. A. Prado
  2023-06-06  7:39   ` AngeloGioacchino Del Regno
  0 siblings, 1 reply; 3+ messages in thread
From: Nícolas F. R. A. Prado @ 2023-06-05 16:20 UTC (permalink / raw)
  To: Matthias Brugger, Hans Verkuil
  Cc: AngeloGioacchino Del Regno, kernel, Nícolas F. R. A. Prado,
	Chen-Yu Tsai, Conor Dooley, Krzysztof Kozlowski,
	Michael Turquette, Miles Chen, Rob Herring, Stephen Boyd,
	devicetree, linux-arm-kernel, linux-clk, linux-kernel,
	linux-mediatek

Add the CLK_VDEC_ACTIVE clock to the vdec clock driver. This clock is
enabled by the VPU once it starts decoding.

Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
---

 drivers/clk/mediatek/clk-mt8183-vdec.c | 5 +++++
 include/dt-bindings/clock/mt8183-clk.h | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/mediatek/clk-mt8183-vdec.c b/drivers/clk/mediatek/clk-mt8183-vdec.c
index 513b7956cbea..5830934a6d25 100644
--- a/drivers/clk/mediatek/clk-mt8183-vdec.c
+++ b/drivers/clk/mediatek/clk-mt8183-vdec.c
@@ -27,6 +27,10 @@ static const struct mtk_gate_regs vdec1_cg_regs = {
 	GATE_MTK(_id, _name, _parent, &vdec0_cg_regs, _shift,	\
 		&mtk_clk_gate_ops_setclr_inv)
 
+#define GATE_VDEC0(_id, _name, _parent, _shift)		\
+	GATE_MTK(_id, _name, _parent, &vdec0_cg_regs, _shift,	\
+		&mtk_clk_gate_ops_setclr)
+
 #define GATE_VDEC1_I(_id, _name, _parent, _shift)		\
 	GATE_MTK(_id, _name, _parent, &vdec1_cg_regs, _shift,	\
 		&mtk_clk_gate_ops_setclr_inv)
@@ -34,6 +38,7 @@ static const struct mtk_gate_regs vdec1_cg_regs = {
 static const struct mtk_gate vdec_clks[] = {
 	/* VDEC0 */
 	GATE_VDEC0_I(CLK_VDEC_VDEC, "vdec_vdec", "mm_sel", 0),
+	GATE_VDEC0(CLK_VDEC_ACTIVE, "vdec_active", "mm_sel", 4),
 	/* VDEC1 */
 	GATE_VDEC1_I(CLK_VDEC_LARB1, "vdec_larb1", "mm_sel", 0),
 };
diff --git a/include/dt-bindings/clock/mt8183-clk.h b/include/dt-bindings/clock/mt8183-clk.h
index a7b470b0ec8a..32dd7d91dbe2 100644
--- a/include/dt-bindings/clock/mt8183-clk.h
+++ b/include/dt-bindings/clock/mt8183-clk.h
@@ -357,7 +357,8 @@
 /* VDEC_GCON */
 #define CLK_VDEC_VDEC			0
 #define CLK_VDEC_LARB1			1
-#define CLK_VDEC_NR_CLK			2
+#define CLK_VDEC_ACTIVE			2
+#define CLK_VDEC_NR_CLK			3
 
 /* VENC_GCON */
 #define CLK_VENC_LARB			0
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 5/6] clk: mediatek: mt8183: Add CLK_VDEC_ACTIVE to vdec
  2023-06-05 16:20 ` [PATCH 5/6] clk: mediatek: mt8183: Add CLK_VDEC_ACTIVE to vdec Nícolas F. R. A. Prado
@ 2023-06-06  7:39   ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 3+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-06-06  7:39 UTC (permalink / raw)
  To: Nícolas F. R. A. Prado, Matthias Brugger, Hans Verkuil
  Cc: kernel, Chen-Yu Tsai, Conor Dooley, Krzysztof Kozlowski,
	Michael Turquette, Miles Chen, Rob Herring, Stephen Boyd,
	devicetree, linux-arm-kernel, linux-clk, linux-kernel,
	linux-mediatek

Il 05/06/23 18:20, Nícolas F. R. A. Prado ha scritto:
> Add the CLK_VDEC_ACTIVE clock to the vdec clock driver. This clock is
> enabled by the VPU once it starts decoding.
> 
> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>

Since this is hw managed, it's a good idea to add CLK_IGNORE_UNUSED to this
clock's flags to avoid potential lockups at boot. Please add that flag.

Cheers,
Angelo


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-06-06  7:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-05 16:20 [PATCH 0/6] Enable decoder for mt8183 Nícolas F. R. A. Prado
2023-06-05 16:20 ` [PATCH 5/6] clk: mediatek: mt8183: Add CLK_VDEC_ACTIVE to vdec Nícolas F. R. A. Prado
2023-06-06  7:39   ` AngeloGioacchino Del Regno

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).