LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Jernej Skrabec <jernej.skrabec@gmail.com>
To: linux-media@vger.kernel.org
Cc: ezequiel@vanguardiasur.com.ar, nicolas.dufresne@collabora.com,
	mchehab@kernel.org, robh+dt@kernel.org, mripard@kernel.org,
	wens@csie.org, p.zabel@pengutronix.de, andrzej.p@collabora.com,
	gregkh@linuxfoundation.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org,
	linux-staging@lists.linux.dev,
	Jernej Skrabec <jernej.skrabec@gmail.com>
Subject: [PATCH 2/7] media: hantro: vp9: use double buffering if needed
Date: Mon, 22 Nov 2021 19:46:57 +0100	[thread overview]
Message-ID: <20211122184702.768341-3-jernej.skrabec@gmail.com> (raw)
In-Reply-To: <20211122184702.768341-1-jernej.skrabec@gmail.com>

Some G2 variants need double buffering to be enabled in order to work
correctly, like that found in Allwinner H6 SoC.

Add platform quirk for that.

Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
---
 drivers/staging/media/hantro/hantro.h            | 2 ++
 drivers/staging/media/hantro/hantro_g2_regs.h    | 1 +
 drivers/staging/media/hantro/hantro_g2_vp9_dec.c | 2 ++
 3 files changed, 5 insertions(+)

diff --git a/drivers/staging/media/hantro/hantro.h b/drivers/staging/media/hantro/hantro.h
index 33eb3e092cc1..d03824fa3222 100644
--- a/drivers/staging/media/hantro/hantro.h
+++ b/drivers/staging/media/hantro/hantro.h
@@ -73,6 +73,7 @@ struct hantro_irq {
  * @num_clocks:			number of clocks in the array
  * @reg_names:			array of register range names
  * @num_regs:			number of register range names in the array
+ * @double_buffer:		core needs double buffering
  */
 struct hantro_variant {
 	unsigned int enc_offset;
@@ -94,6 +95,7 @@ struct hantro_variant {
 	int num_clocks;
 	const char * const *reg_names;
 	int num_regs;
+	unsigned int double_buffer : 1;
 };
 
 /**
diff --git a/drivers/staging/media/hantro/hantro_g2_regs.h b/drivers/staging/media/hantro/hantro_g2_regs.h
index 9c857dd1ad9b..15a391a4650e 100644
--- a/drivers/staging/media/hantro/hantro_g2_regs.h
+++ b/drivers/staging/media/hantro/hantro_g2_regs.h
@@ -270,6 +270,7 @@
 #define g2_apf_threshold	G2_DEC_REG(55, 0, 0xffff)
 
 #define g2_clk_gate_e		G2_DEC_REG(58, 16, 0x1)
+#define g2_double_buffer_e	G2_DEC_REG(58, 15, 0x1)
 #define g2_buswidth		G2_DEC_REG(58, 8,  0x7)
 #define g2_max_burst		G2_DEC_REG(58, 0,  0xff)
 
diff --git a/drivers/staging/media/hantro/hantro_g2_vp9_dec.c b/drivers/staging/media/hantro/hantro_g2_vp9_dec.c
index e04242d10fa2..d4fc649a4da1 100644
--- a/drivers/staging/media/hantro/hantro_g2_vp9_dec.c
+++ b/drivers/staging/media/hantro/hantro_g2_vp9_dec.c
@@ -847,6 +847,8 @@ config_registers(struct hantro_ctx *ctx, const struct v4l2_ctrl_vp9_frame *dec_p
 	hantro_reg_write(ctx->dev, &g2_clk_gate_e, 1);
 	hantro_reg_write(ctx->dev, &g2_max_cb_size, 6);
 	hantro_reg_write(ctx->dev, &g2_min_cb_size, 3);
+	if (ctx->dev->variant->double_buffer)
+		hantro_reg_write(ctx->dev, &g2_double_buffer_e, 1);
 
 	config_output(ctx, dst, dec_params);
 
-- 
2.34.0


  parent reply	other threads:[~2021-11-22 18:47 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-22 18:46 [PATCH 0/7] media: hantro: add Allwinner H6 support Jernej Skrabec
2021-11-22 18:46 ` [PATCH 1/7] media: hantro: add support for reset lines Jernej Skrabec
2021-11-23 11:09   ` Andrzej Pietrasiewicz
2021-11-23 14:59     ` Dan Carpenter
2021-11-23 16:36       ` Andrzej Pietrasiewicz
2021-11-23 16:46         ` Jernej Škrabec
     [not found]           ` <CAAEAJfD3d4zjwvbv967+oe6awnAkZiGNKroYF5jvoTy=0sn+Pw@mail.gmail.com>
2021-11-30 10:39             ` Andrzej Pietrasiewicz
2021-11-22 18:46 ` Jernej Skrabec [this message]
2021-11-23 11:22   ` [PATCH 2/7] media: hantro: vp9: use double buffering if needed Andrzej Pietrasiewicz
2021-11-22 18:46 ` [PATCH 3/7] media: hantro: vp9: add support for legacy register set Jernej Skrabec
2021-11-23 12:06   ` Andrzej Pietrasiewicz
2021-11-22 18:46 ` [PATCH 4/7] media: hantro: move postproc enablement for old cores Jernej Skrabec
2021-11-23 12:12   ` Andrzej Pietrasiewicz
2021-11-25 12:00   ` Ezequiel Garcia
2021-11-25 19:21     ` Jernej Škrabec
2021-11-22 18:47 ` [PATCH 5/7] media: dt-bindings: allwinner: document H6 Hantro G2 binding Jernej Skrabec
2021-11-22 18:47 ` [PATCH 6/7] media: hantro: Add support for Allwinner H6 Jernej Skrabec
2021-11-23 12:23   ` Andrzej Pietrasiewicz
2021-11-22 18:47 ` [PATCH 7/7] arm64: dts: allwinner: h6: Add Hantro G2 node Jernej Skrabec
2021-11-22 18:51 ` [PATCH 0/7] media: hantro: add Allwinner H6 support Jernej Škrabec

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211122184702.768341-3-jernej.skrabec@gmail.com \
    --to=jernej.skrabec@gmail.com \
    --cc=andrzej.p@collabora.com \
    --cc=devicetree@vger.kernel.org \
    --cc=ezequiel@vanguardiasur.com.ar \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=mchehab@kernel.org \
    --cc=mripard@kernel.org \
    --cc=nicolas.dufresne@collabora.com \
    --cc=p.zabel@pengutronix.de \
    --cc=robh+dt@kernel.org \
    --cc=wens@csie.org \
    --subject='Re: [PATCH 2/7] media: hantro: vp9: use double buffering if needed' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).