struct regmap *regmap;
struct regmap *sram;
+ const struct fw_info *fw_info;
struct allegro_buffer firmware;
struct allegro_buffer suballocator;
unsigned int mailbox_cmd;
unsigned int mailbox_status;
size_t mailbox_size;
+ enum mcu_msg_version mailbox_version;
size_t suballocator_size;
};
.mailbox_cmd = 0x7800,
.mailbox_status = 0x7c00,
.mailbox_size = 0x400 - 0x8,
+ .mailbox_version = MCU_MSG_VERSION_2018_2,
.suballocator_size = SZ_16M,
},
};
if (!msg)
return;
+ msg->header.version = dev->fw_info->mailbox_version;
+
tmp = kmalloc(mbox->size, GFP_KERNEL);
if (!tmp)
goto out;
memset(&msg, 0, sizeof(msg));
msg.header.type = MCU_MSG_TYPE_INIT;
+ msg.header.version = dev->fw_info->mailbox_version;
msg.suballoc_dma = to_mcu_addr(dev, suballoc_dma);
msg.suballoc_size = to_mcu_size(dev, suballoc_size);
memset(¶m, 0, sizeof(param));
fill_create_channel_param(channel, ¶m);
allegro_alloc_buffer(dev, blob, sizeof(struct create_channel_param));
+ param.version = dev->fw_info->mailbox_version;
size = allegro_encode_config_blob(blob->vaddr, ¶m);
memset(&msg, 0, sizeof(msg));
msg.header.type = MCU_MSG_TYPE_CREATE_CHANNEL;
+ msg.header.version = dev->fw_info->mailbox_version;
msg.user_id = channel->user_id;
memset(&msg, 0, sizeof(msg));
msg.header.type = MCU_MSG_TYPE_DESTROY_CHANNEL;
+ msg.header.version = dev->fw_info->mailbox_version;
msg.channel_id = channel->mcu_channel_id;
memset(&msg, 0, sizeof(msg));
msg.header.type = MCU_MSG_TYPE_PUT_STREAM_BUFFER;
+ msg.header.version = dev->fw_info->mailbox_version;
msg.channel_id = channel->mcu_channel_id;
msg.dma_addr = to_codec_addr(dev, paddr);
memset(&msg, 0, sizeof(msg));
msg.header.type = MCU_MSG_TYPE_ENCODE_FRAME;
+ msg.header.version = dev->fw_info->mailbox_version;
msg.channel_id = channel->mcu_channel_id;
msg.encoding_options = AL_OPT_FORCE_LOAD;
return -ENOMEM;
msg->header.type = type;
+ msg->header.version = dev->fw_info->mailbox_version;
+
msg->channel_id = channel->mcu_channel_id;
msg->num_buffers = num_buffers;
const char *fw_codec_name = "al5e.fw";
const struct firmware *fw_codec;
int err;
- const struct fw_info *info;
if (!fw)
return;
if (err)
goto err_release_firmware;
- info = allegro_get_firmware_info(dev, fw, fw_codec);
- if (!info) {
+ dev->fw_info = allegro_get_firmware_info(dev, fw, fw_codec);
+ if (!dev->fw_info) {
v4l2_err(&dev->v4l2_dev, "firmware is not supported\n");
goto err_release_firmware_codec;
}
v4l2_info(&dev->v4l2_dev,
- "using mcu firmware version '%s'\n", info->version);
+ "using mcu firmware version '%s'\n", dev->fw_info->version);
/* Ensure that the mcu is sleeping at the reset vector */
err = allegro_mcu_reset(dev);
allegro_copy_firmware(dev, fw->data, fw->size);
allegro_copy_fw_codec(dev, fw_codec->data, fw_codec->size);
- err = allegro_mcu_hw_init(dev, info);
+ err = allegro_mcu_hw_init(dev, dev->fw_info);
if (err) {
v4l2_err(&dev->v4l2_dev, "failed to initialize mcu\n");
goto err_free_fw_codec;