mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-27 04:54:41 +08:00
media: allegro: support handling firmware dependent values
Like the message format, also the identifiers in the messages differ between firmware versions. This especially affects the identifier for the codec that shall be used. As the messages used by the driver are now independent from the firmware, we can use the values defined by V4L2 as identifiers in the messages. Convert the V4L2 codec format to the respective firmware value when encoding the messages to binary format instead beforehand. Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
parent
fc1c13deb1
commit
62ed97df7d
@ -812,15 +812,6 @@ static u32 v4l2_colorspace_to_mcu_colorspace(enum v4l2_colorspace colorspace)
|
||||
}
|
||||
}
|
||||
|
||||
static s8 v4l2_pixelformat_to_mcu_codec(u32 pixelformat)
|
||||
{
|
||||
switch (pixelformat) {
|
||||
case V4L2_PIX_FMT_H264:
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
static u8 v4l2_profile_to_mcu_profile(enum v4l2_mpeg_video_h264_profile profile)
|
||||
{
|
||||
switch (profile) {
|
||||
@ -919,7 +910,7 @@ static int fill_create_channel_param(struct allegro_channel *channel,
|
||||
param->src_mode = 0x0;
|
||||
param->profile = v4l2_profile_to_mcu_profile(channel->profile);
|
||||
param->constraint_set_flags = BIT(1);
|
||||
param->codec = v4l2_pixelformat_to_mcu_codec(channel->codec);
|
||||
param->codec = channel->codec;
|
||||
param->level = v4l2_level_to_mcu_level(channel->level);
|
||||
param->tier = 0;
|
||||
param->sps_param = BIT(20) | 0x4a;
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <linux/bitfield.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/videodev2.h>
|
||||
|
||||
#include "allegro-mail.h"
|
||||
|
||||
@ -53,17 +54,29 @@ allegro_enc_init(u32 *dst, struct mcu_msg_init_request *msg)
|
||||
return i * sizeof(*dst);
|
||||
}
|
||||
|
||||
static inline u32 settings_get_mcu_codec(struct create_channel_param *param)
|
||||
{
|
||||
u32 pixelformat = param->codec;
|
||||
|
||||
switch (pixelformat) {
|
||||
case V4L2_PIX_FMT_H264:
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
allegro_encode_channel_config(u32 *dst, struct create_channel_param *param)
|
||||
{
|
||||
unsigned int i = 0;
|
||||
unsigned int codec = settings_get_mcu_codec(param);
|
||||
|
||||
dst[i++] = FIELD_PREP(GENMASK(31, 16), param->height) |
|
||||
FIELD_PREP(GENMASK(15, 0), param->width);
|
||||
dst[i++] = param->format;
|
||||
dst[i++] = param->colorspace;
|
||||
dst[i++] = param->src_mode;
|
||||
dst[i++] = FIELD_PREP(GENMASK(31, 24), param->codec) |
|
||||
dst[i++] = FIELD_PREP(GENMASK(31, 24), codec) |
|
||||
FIELD_PREP(GENMASK(23, 8), param->constraint_set_flags) |
|
||||
FIELD_PREP(GENMASK(7, 0), param->profile);
|
||||
dst[i++] = FIELD_PREP(GENMASK(31, 16), param->tier) |
|
||||
|
@ -48,7 +48,7 @@ struct create_channel_param {
|
||||
u32 src_mode;
|
||||
u8 profile;
|
||||
u16 constraint_set_flags;
|
||||
s8 codec;
|
||||
u32 codec;
|
||||
u16 level;
|
||||
u16 tier;
|
||||
u32 sps_param;
|
||||
|
Loading…
Reference in New Issue
Block a user