diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-07-24 13:19:38 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-07-24 13:19:38 -0300 |
commit | 01c0f8a05ed9f470095e7ec095308726a91f3931 (patch) | |
tree | 7aa94b448e3cfb12b8e2fcf1f46537dc6948d36c /linux/drivers/media/video/cpia2 | |
parent | 72f297be4182a7ebc0db2f38eb7ada75ad7b2ee4 (diff) | |
download | mediapointer-dvb-s2-01c0f8a05ed9f470095e7ec095308726a91f3931.tar.gz mediapointer-dvb-s2-01c0f8a05ed9f470095e7ec095308726a91f3931.tar.bz2 |
backport request_firmware changesets for vicam and cpia2_core
From: Mauro Carvalho Chehab <mchehab@infradead.org>
kernel-sync:
Backport changeset 04a33e406a062cd1bb55014ee17a3558109a2d74
Author: David Woodhouse <dwmw2@infradead.org>
Date: Mon Jun 23 11:36:23 2008 +0100
cpia2: use request_firmware()
Thanks for Jaswinder Singh for converting the firmware blob itself to ihex.
Backport changeset fb54be8755d386008bfadb7fc8ff89451fa3a9c9
Author: Jaswinder Singh <jaswinder@infradead.org>
Date: Fri Jun 27 19:50:40 2008 +0530
vicam: use request_firmware()
Although it wasn't actually using ihex records before, we use the Intel
HEX record format for this firmware -- because that gives us a simple
way to split it into separate chunks internally as we need, without
loading each part as a separate file.
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux/drivers/media/video/cpia2')
-rw-r--r-- | linux/drivers/media/video/cpia2/cpia2_core.c | 46 |
1 files changed, 37 insertions, 9 deletions
diff --git a/linux/drivers/media/video/cpia2/cpia2_core.c b/linux/drivers/media/video/cpia2/cpia2_core.c index c8b9fdb70..f2e8b1c82 100644 --- a/linux/drivers/media/video/cpia2/cpia2_core.c +++ b/linux/drivers/media/video/cpia2/cpia2_core.c @@ -33,11 +33,10 @@ #include <linux/slab.h> #include <linux/vmalloc.h> +#include <linux/firmware.h> /* #define _CPIA2_DEBUG_ */ -#include "cpia2patch.h" - #ifdef _CPIA2_DEBUG_ static const char *block_name[] = { @@ -893,24 +892,53 @@ int cpia2_set_low_power(struct camera_data *cam) * apply_vp_patch * *****************************************************************************/ +static int cpia2_send_onebyte_command(struct camera_data *cam, + struct cpia2_command *cmd, + u8 start, u8 datum) +{ + cmd->buffer.block_data[0] = datum; + cmd->start = start; + cmd->reg_count = 1; + return cpia2_send_command(cam, cmd); +} + static int apply_vp_patch(struct camera_data *cam) { - int i, j; + const struct firmware *fw; + const char fw_name[] = "cpia2/stv0672_vp4.bin"; + int i, ret; struct cpia2_command cmd; + ret = request_firmware(&fw, fw_name, &cam->dev->dev); + if (ret) { + printk(KERN_ERR "cpia2: failed to load VP patch \"%s\"\n", + fw_name); + return ret; + } + cmd.req_mode = CAMERAACCESS_TYPE_REPEAT | CAMERAACCESS_VP; cmd.direction = TRANSFER_WRITE; - for (i = 0; i < PATCH_DATA_SIZE; i++) { - for (j = 0; j < patch_data[i].count; j++) { - cmd.buffer.block_data[j] = patch_data[i].data[j]; - } + /* First send the start address... */ + cpia2_send_onebyte_command(cam, &cmd, 0x0A, fw->data[0]); /* hi */ + cpia2_send_onebyte_command(cam, &cmd, 0x0B, fw->data[1]); /* lo */ - cmd.start = patch_data[i].reg; - cmd.reg_count = patch_data[i].count; + /* ... followed by the data payload */ + for (i = 2; i < fw->size; i += 64) { + cmd.start = 0x0C; /* Data */ + cmd.reg_count = min_t(int, 64, fw->size - i); + memcpy(cmd.buffer.block_data, &fw->data[i], cmd.reg_count); cpia2_send_command(cam, &cmd); } + /* Next send the start address... */ + cpia2_send_onebyte_command(cam, &cmd, 0x0A, fw->data[0]); /* hi */ + cpia2_send_onebyte_command(cam, &cmd, 0x0B, fw->data[1]); /* lo */ + + /* ... followed by the 'goto' command */ + cpia2_send_onebyte_command(cam, &cmd, 0x0D, 1); + + release_firmware(fw); return 0; } |