Commit 3aef46bd authored by Jernej Skrabec's avatar Jernej Skrabec Committed by Mauro Carvalho Chehab

media: cedrus: Properly signal size in mode register

Mode register also holds information if video width is bigger than 2048
and if it is equal to 4096.

Rework cedrus_engine_enable() to properly signal this properties.
Signed-off-by: default avatarJernej Skrabec <jernej.skrabec@siol.net>
Acked-by: default avatarPaul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent df4a3e7f
...@@ -485,7 +485,7 @@ static void cedrus_h264_setup(struct cedrus_ctx *ctx, ...@@ -485,7 +485,7 @@ static void cedrus_h264_setup(struct cedrus_ctx *ctx,
{ {
struct cedrus_dev *dev = ctx->dev; struct cedrus_dev *dev = ctx->dev;
cedrus_engine_enable(dev, CEDRUS_CODEC_H264); cedrus_engine_enable(ctx, CEDRUS_CODEC_H264);
cedrus_write(dev, VE_H264_SDROT_CTRL, 0); cedrus_write(dev, VE_H264_SDROT_CTRL, 0);
cedrus_write(dev, VE_H264_EXTRA_BUFFER1, cedrus_write(dev, VE_H264_EXTRA_BUFFER1,
......
...@@ -276,7 +276,7 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx, ...@@ -276,7 +276,7 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx,
} }
/* Activate H265 engine. */ /* Activate H265 engine. */
cedrus_engine_enable(dev, CEDRUS_CODEC_H265); cedrus_engine_enable(ctx, CEDRUS_CODEC_H265);
/* Source offset and length in bits. */ /* Source offset and length in bits. */
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include "cedrus_hw.h" #include "cedrus_hw.h"
#include "cedrus_regs.h" #include "cedrus_regs.h"
int cedrus_engine_enable(struct cedrus_dev *dev, enum cedrus_codec codec) int cedrus_engine_enable(struct cedrus_ctx *ctx, enum cedrus_codec codec)
{ {
u32 reg = 0; u32 reg = 0;
...@@ -58,7 +58,12 @@ int cedrus_engine_enable(struct cedrus_dev *dev, enum cedrus_codec codec) ...@@ -58,7 +58,12 @@ int cedrus_engine_enable(struct cedrus_dev *dev, enum cedrus_codec codec)
return -EINVAL; return -EINVAL;
} }
cedrus_write(dev, VE_MODE, reg); if (ctx->src_fmt.width == 4096)
reg |= VE_MODE_PIC_WIDTH_IS_4096;
if (ctx->src_fmt.width > 2048)
reg |= VE_MODE_PIC_WIDTH_MORE_2048;
cedrus_write(ctx->dev, VE_MODE, reg);
return 0; return 0;
} }
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#ifndef _CEDRUS_HW_H_ #ifndef _CEDRUS_HW_H_
#define _CEDRUS_HW_H_ #define _CEDRUS_HW_H_
int cedrus_engine_enable(struct cedrus_dev *dev, enum cedrus_codec codec); int cedrus_engine_enable(struct cedrus_ctx *ctx, enum cedrus_codec codec);
void cedrus_engine_disable(struct cedrus_dev *dev); void cedrus_engine_disable(struct cedrus_dev *dev);
void cedrus_dst_format_set(struct cedrus_dev *dev, void cedrus_dst_format_set(struct cedrus_dev *dev,
......
...@@ -96,7 +96,7 @@ static void cedrus_mpeg2_setup(struct cedrus_ctx *ctx, struct cedrus_run *run) ...@@ -96,7 +96,7 @@ static void cedrus_mpeg2_setup(struct cedrus_ctx *ctx, struct cedrus_run *run)
quantization = run->mpeg2.quantization; quantization = run->mpeg2.quantization;
/* Activate MPEG engine. */ /* Activate MPEG engine. */
cedrus_engine_enable(dev, CEDRUS_CODEC_MPEG2); cedrus_engine_enable(ctx, CEDRUS_CODEC_MPEG2);
/* Set intra quantization matrix. */ /* Set intra quantization matrix. */
......
...@@ -35,6 +35,8 @@ ...@@ -35,6 +35,8 @@
#define VE_MODE 0x00 #define VE_MODE 0x00
#define VE_MODE_PIC_WIDTH_IS_4096 BIT(22)
#define VE_MODE_PIC_WIDTH_MORE_2048 BIT(21)
#define VE_MODE_REC_WR_MODE_2MB (0x01 << 20) #define VE_MODE_REC_WR_MODE_2MB (0x01 << 20)
#define VE_MODE_REC_WR_MODE_1MB (0x00 << 20) #define VE_MODE_REC_WR_MODE_1MB (0x00 << 20)
#define VE_MODE_DDR_MODE_BW_128 (0x03 << 16) #define VE_MODE_DDR_MODE_BW_128 (0x03 << 16)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment