#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/vmalloc.h>
+#include <linux/byteorder/generic.h>
#include <linux/interrupt.h>
#include <linux/proc_fs.h>
ZR36057_ISR_JPEGRepIRQ )
extern const struct zoran_format zoran_formats[];
-extern const int zoran_num_formats;
extern int *zr_debug;
* load on Bt819 input, there will be
* some image imperfections */
-MODULE_PARM(lml33dpath, "i");
+module_param(lml33dpath, bool, 0);
MODULE_PARM_DESC(lml33dpath,
"Use digital path capture mode (on LML33 cards)");
+static void
+zr36057_init_vfe (struct zoran *zr);
+
/*
* General Purpose I/O and Guest bus access
*/
zr->jpg_buffers.buffer[i].state = BUZ_STATE_USER; /* nothing going on */
}
for (i = 0; i < BUZ_NUM_STAT_COM; i++) {
- zr->stat_com[i] = 1; /* mark as unavailable to zr36057 */
+ zr->stat_com[i] = cpu_to_le32(1); /* mark as unavailable to zr36057 */
}
}
switch (mode) {
- case BUZ_MODE_MOTION_COMPRESS:
+ case BUZ_MODE_MOTION_COMPRESS: {
+ struct jpeg_app_marker app;
+ struct jpeg_com_marker com;
+
/* In motion compress mode, the decoder output must be enabled, and
* the video bus direction set to input.
*/
/* Take the JPEG codec and the VFE out of sleep */
jpeg_codec_sleep(zr, 0);
+
+ /* set JPEG app/com marker */
+ app.appn = zr->jpg_settings.jpg_comp.APPn;
+ app.len = zr->jpg_settings.jpg_comp.APP_len;
+ memcpy(app.data, zr->jpg_settings.jpg_comp.APP_data, 60);
+ zr->codec->control(zr->codec, CODEC_S_JPEG_APP_DATA,
+ sizeof(struct jpeg_app_marker), &app);
+
+ com.len = zr->jpg_settings.jpg_comp.COM_len;
+ memcpy(com.data, zr->jpg_settings.jpg_comp.COM_data, 60);
+ zr->codec->control(zr->codec, CODEC_S_JPEG_COM_DATA,
+ sizeof(struct jpeg_com_marker), &com);
+
/* Setup the JPEG codec */
zr->codec->control(zr->codec, CODEC_S_JPEG_TDS_BYTE,
sizeof(int), &field_size);
dprintk(2, KERN_INFO "%s: enable_jpg(MOTION_COMPRESS)\n",
ZR_DEVNAME(zr));
break;
+ }
case BUZ_MODE_MOTION_DECOMPRESS:
/* In motion decompression mode, the decoder output must be disabled, and
/* fill 1 stat_com entry */
i = (zr->jpg_dma_head -
zr->jpg_err_shift) & BUZ_MASK_STAT_COM;
- if (!(zr->stat_com[i] & 1))
+ if (!(zr->stat_com[i] & cpu_to_le32(1)))
break;
zr->stat_com[i] =
- zr->jpg_buffers.buffer[frame].frag_tab_bus;
+ cpu_to_le32(zr->jpg_buffers.buffer[frame].frag_tab_bus);
} else {
/* fill 2 stat_com entries */
i = ((zr->jpg_dma_head -
zr->jpg_err_shift) & 1) * 2;
- if (!(zr->stat_com[i] & 1))
+ if (!(zr->stat_com[i] & cpu_to_le32(1)))
break;
zr->stat_com[i] =
- zr->jpg_buffers.buffer[frame].frag_tab_bus;
+ cpu_to_le32(zr->jpg_buffers.buffer[frame].frag_tab_bus);
zr->stat_com[i + 1] =
- zr->jpg_buffers.buffer[frame].frag_tab_bus;
+ cpu_to_le32(zr->jpg_buffers.buffer[frame].frag_tab_bus);
}
zr->jpg_buffers.buffer[frame].state = BUZ_STATE_DMA;
zr->jpg_dma_head++;
i = ((zr->jpg_dma_tail -
zr->jpg_err_shift) & 1) * 2 + 1;
- stat_com = zr->stat_com[i];
+ stat_com = le32_to_cpu(zr->stat_com[i]);
if ((stat_com & 1) == 0) {
return;
for (i = 0;
i < zr->jpg_buffers.num_buffers;
i++) {
- if (zr->stat_com[j] ==
+ if (le32_to_cpu(zr->stat_com[j]) ==
zr->jpg_buffers.
buffer[i].
frag_tab_bus) {
printk("\n");
}
}
-
/* Find an entry in stat_com and rotate contents */
{
int i;
zr->jpg_err_shift) & 1) * 2;
if (zr->codec_mode == BUZ_MODE_MOTION_DECOMPRESS) {
/* Mimic zr36067 operation */
- zr->stat_com[i] |= 1;
+ zr->stat_com[i] |= cpu_to_le32(1);
if (zr->jpg_settings.TmpDcm != 1)
- zr->stat_com[i + 1] |= 1;
+ zr->stat_com[i + 1] |= cpu_to_le32(1);
/* Refill */
zoran_reap_stat_com(zr);
zoran_feed_stat_com(zr);
int j;
u32 bus_addr[BUZ_NUM_STAT_COM];
+ /* Here we are copying the stat_com array, which
+ * is already in little endian format, so
+ * no endian conversions here
+ */
memcpy(bus_addr, zr->stat_com,
sizeof(bus_addr));
for (j = 0; j < BUZ_NUM_STAT_COM; j++) {
zr->stat_com[j] =
bus_addr[(i + j) &
BUZ_MASK_STAT_COM];
+
}
zr->jpg_err_shift += i;
zr->jpg_err_shift &= BUZ_MASK_STAT_COM;
int i;
strcpy(sv, sc);
for (i = 0; i < 4; i++) {
- if (zr->stat_com[i] & 1)
+ if (le32_to_cpu(zr->stat_com[i]) & 1)
sv[i] = '1';
}
sv[4] = 0;
ZR_DEVNAME(zr), zr->jpg_seq_num);
for (i = 0; i < 4; i++) {
printk(" %08x",
- zr->stat_com[i]);
+ le32_to_cpu(zr->stat_com[i]));
}
printk("\n");
}
* initialize video front end
*/
-void
+static void
zr36057_init_vfe (struct zoran *zr)
{
u32 reg;