summaryrefslogtreecommitdiffstats
path: root/drivers/staging/media/allegro-dvt/allegro-mail.c
diff options
context:
space:
mode:
authorMichael Tretter <m.tretter@pengutronix.de>2020-07-13 16:42:25 +0200
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2020-07-19 14:00:31 +0200
commitc4756d8774159ef1a9a204d656589c886fcefc5b (patch)
tree7676551678a253a55646fd49bdbf8a258f9dc3d6 /drivers/staging/media/allegro-dvt/allegro-mail.c
parentd30e841216411cb95ffbb56252f8431fd752c54d (diff)
media: allegro: add config blob for channel
Firmware versions >= 2019.2 do not configure the channel via the mailbox interface anymore, but use a separate chunk of memory that is only referenced by the message. As the configuration must be in a format that is understood by the firmware and this format can change between firmware versions, handle it similar to the message and treat is as a blob. In order to support both methods in the driver, always use a separate blob for the channel configuration and copy that blob into the mailbox if the firmware requires it and otherwise reference it. 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>
Diffstat (limited to 'drivers/staging/media/allegro-dvt/allegro-mail.c')
-rw-r--r--drivers/staging/media/allegro-dvt/allegro-mail.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/staging/media/allegro-dvt/allegro-mail.c b/drivers/staging/media/allegro-dvt/allegro-mail.c
index 7121f128aff3..c55b9339f9c6 100644
--- a/drivers/staging/media/allegro-dvt/allegro-mail.c
+++ b/drivers/staging/media/allegro-dvt/allegro-mail.c
@@ -9,6 +9,7 @@
#include <linux/bitfield.h>
#include <linux/export.h>
#include <linux/errno.h>
+#include <linux/string.h>
#include <linux/videodev2.h>
#include "allegro-mail.h"
@@ -65,8 +66,8 @@ static inline u32 settings_get_mcu_codec(struct create_channel_param *param)
}
}
-static ssize_t
-allegro_encode_channel_config(u32 *dst, struct create_channel_param *param)
+ssize_t
+allegro_encode_config_blob(u32 *dst, struct create_channel_param *param)
{
unsigned int i = 0;
u32 val;
@@ -158,18 +159,23 @@ allegro_encode_channel_config(u32 *dst, struct create_channel_param *param)
static ssize_t
allegro_enc_create_channel(u32 *dst, struct mcu_msg_create_channel *msg)
{
- struct create_channel_param *param = &msg->param;
- ssize_t size = 0;
unsigned int i = 0;
dst[i++] = msg->user_id;
- size = allegro_encode_channel_config(&dst[i], param);
- i += size / sizeof(*dst);
+ memcpy(&dst[i], msg->blob, msg->blob_size);
+ i += msg->blob_size / sizeof(*dst);
return i * sizeof(*dst);
}
+ssize_t allegro_decode_config_blob(struct create_channel_param *param,
+ struct mcu_msg_create_channel_response *msg,
+ u32 *src)
+{
+ return 0;
+}
+
static ssize_t
allegro_enc_destroy_channel(u32 *dst, struct mcu_msg_destroy_channel *msg)
{