diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-07-24 13:28:47 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-07-24 13:28:47 -0300 |
commit | a143a46f97749a34cf805cfce00a2fa51a63b043 (patch) | |
tree | 76e27a09f22f0f51d3d226399528f743222055df /linux/drivers/media/video/cpia2 | |
parent | e46f9d89ede64dc52c0e933a4d0ccaeaa6e88ddb (diff) | |
download | mediapointer-dvb-s2-a143a46f97749a34cf805cfce00a2fa51a63b043.tar.gz mediapointer-dvb-s2-a143a46f97749a34cf805cfce00a2fa51a63b043.tar.bz2 |
make cpia2 and vicam backward compatible
From: Mauro Carvalho Chehab <mchehab@infradead.org>
Probably, this is a bit overkill, but let's keep the old behavior for kernels
lower than 2.6.27, until we make sure that those changes work fine also for
older kernels.
kernel-sync: since we don't want this patch to go to kernel
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 | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/linux/drivers/media/video/cpia2/cpia2_core.c b/linux/drivers/media/video/cpia2/cpia2_core.c index f2e8b1c82..d6a1c1952 100644 --- a/linux/drivers/media/video/cpia2/cpia2_core.c +++ b/linux/drivers/media/video/cpia2/cpia2_core.c @@ -33,10 +33,16 @@ #include <linux/slab.h> #include <linux/vmalloc.h> +#if LINUX_VERSION_CODE => KERNEL_VERSION(2,6,27) #include <linux/firmware.h> +#endif /* #define _CPIA2_DEBUG_ */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) +#include "cpia2patch.h" + +#endif #ifdef _CPIA2_DEBUG_ static const char *block_name[] = { @@ -892,6 +898,7 @@ int cpia2_set_low_power(struct camera_data *cam) * apply_vp_patch * *****************************************************************************/ +#if LINUX_VERSION_CODE => KERNEL_VERSION(2,6,27) static int cpia2_send_onebyte_command(struct camera_data *cam, struct cpia2_command *cmd, u8 start, u8 datum) @@ -902,13 +909,19 @@ static int cpia2_send_onebyte_command(struct camera_data *cam, return cpia2_send_command(cam, cmd); } +#endif static int apply_vp_patch(struct camera_data *cam) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) + int i, j; +#else const struct firmware *fw; const char fw_name[] = "cpia2/stv0672_vp4.bin"; int i, ret; +#endif struct cpia2_command cmd; +#if LINUX_VERSION_CODE => KERNEL_VERSION(2,6,27) ret = request_firmware(&fw, fw_name, &cam->dev->dev); if (ret) { printk(KERN_ERR "cpia2: failed to load VP patch \"%s\"\n", @@ -916,9 +929,19 @@ static int apply_vp_patch(struct camera_data *cam) return ret; } +#endif cmd.req_mode = CAMERAACCESS_TYPE_REPEAT | CAMERAACCESS_VP; cmd.direction = TRANSFER_WRITE; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) + 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]; + } + + cmd.start = patch_data[i].reg; + cmd.reg_count = patch_data[i].count; +#else /* 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 */ @@ -928,9 +951,11 @@ static int apply_vp_patch(struct camera_data *cam) 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); +#endif cpia2_send_command(cam, &cmd); } +#if LINUX_VERSION_CODE => KERNEL_VERSION(2,6,27) /* 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 */ @@ -939,6 +964,7 @@ static int apply_vp_patch(struct camera_data *cam) cpia2_send_onebyte_command(cam, &cmd, 0x0D, 1); release_firmware(fw); +#endif return 0; } |