V4L/DVB (10956): cx231xx: First series of manual CodingStyle fixes

This patch cleans up CodingStyle on the following source files:

There are still much more to be fixed on later patches

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Mauro Carvalho Chehab 2009-03-03 13:31:36 -03:00
parent 84b5dbf39e
commit cde4362f02
5 changed files with 1275 additions and 1646 deletions

View File

@ -70,7 +70,6 @@ static int cx231xx_isoc_audio_deinit(struct cx231xx *dev)
kfree(dev->adev.transfer_buffer[i]); kfree(dev->adev.transfer_buffer[i]);
dev->adev.transfer_buffer[i] = NULL; dev->adev.transfer_buffer[i] = NULL;
} }
} }
@ -108,18 +107,19 @@ static void cx231xx_audio_isocirq(struct urb *urb)
stride = runtime->frame_bits >> 3; stride = runtime->frame_bits >> 3;
for (i = 0; i < urb->number_of_packets; i++) { for (i = 0; i < urb->number_of_packets; i++) {
int length = int length = urb->iso_frame_desc[i].actual_length /
urb->iso_frame_desc[i].actual_length / stride; stride;
cp = (unsigned char *)urb->transfer_buffer + cp = (unsigned char *)urb->transfer_buffer +
urb->iso_frame_desc[i].offset; urb->iso_frame_desc[i].offset;
if (!length) if (!length)
continue; continue;
oldptr = dev->adev.hwptr_done_capture; oldptr = dev->adev.hwptr_done_capture;
if (oldptr + length >= runtime->buffer_size) { if (oldptr + length >= runtime->buffer_size) {
unsigned int cnt = unsigned int cnt;
runtime->buffer_size - oldptr;
cnt = runtime->buffer_size - oldptr;
memcpy(runtime->dma_area + oldptr * stride, cp, memcpy(runtime->dma_area + oldptr * stride, cp,
cnt * stride); cnt * stride);
memcpy(runtime->dma_area, cp + cnt * stride, memcpy(runtime->dma_area, cp + cnt * stride,
@ -132,16 +132,12 @@ static void cx231xx_audio_isocirq(struct urb *urb)
snd_pcm_stream_lock(substream); snd_pcm_stream_lock(substream);
dev->adev.hwptr_done_capture += length; dev->adev.hwptr_done_capture += length;
if (dev->adev.hwptr_done_capture >= if (dev->adev.hwptr_done_capture >= runtime->buffer_size)
runtime->buffer_size) dev->adev.hwptr_done_capture -= runtime->buffer_size;
dev->adev.hwptr_done_capture -=
runtime->buffer_size;
dev->adev.capture_transfer_done += length; dev->adev.capture_transfer_done += length;
if (dev->adev.capture_transfer_done >= if (dev->adev.capture_transfer_done >= runtime->period_size) {
runtime->period_size) { dev->adev.capture_transfer_done -= runtime->period_size;
dev->adev.capture_transfer_done -=
runtime->period_size;
period_elapsed = 1; period_elapsed = 1;
} }
snd_pcm_stream_unlock(substream); snd_pcm_stream_unlock(substream);
@ -189,8 +185,7 @@ static int cx231xx_init_audio_isoc(struct cx231xx *dev)
urb->dev = dev->udev; urb->dev = dev->udev;
urb->context = dev; urb->context = dev;
urb->pipe = urb->pipe = usb_rcvisocpipe(dev->udev, dev->adev.end_point_addr);
usb_rcvisocpipe(dev->udev, dev->adev.end_point_addr);
urb->transfer_flags = URB_ISO_ASAP; urb->transfer_flags = URB_ISO_ASAP;
urb->transfer_buffer = dev->adev.transfer_buffer[i]; urb->transfer_buffer = dev->adev.transfer_buffer[i];
urb->interval = 1; urb->interval = 1;
@ -198,8 +193,7 @@ static int cx231xx_init_audio_isoc(struct cx231xx *dev)
urb->number_of_packets = CX231XX_NUM_AUDIO_PACKETS; urb->number_of_packets = CX231XX_NUM_AUDIO_PACKETS;
urb->transfer_buffer_length = sb_size; urb->transfer_buffer_length = sb_size;
for (j = k = 0; j < CX231XX_NUM_AUDIO_PACKETS; for (j = k = 0; j < CX231XX_NUM_AUDIO_PACKETS; j++, k += dev->adev.max_pkt_size) {
j++, k += dev->adev.max_pkt_size) {
urb->iso_frame_desc[j].offset = k; urb->iso_frame_desc[j].offset = k;
urb->iso_frame_desc[j].length = dev->adev.max_pkt_size; urb->iso_frame_desc[j].length = dev->adev.max_pkt_size;
} }
@ -275,10 +269,10 @@ static struct snd_pcm_hardware snd_cx231xx_hw_capture = {
.channels_min = 2, .channels_min = 2,
.channels_max = 2, .channels_max = 2,
.buffer_bytes_max = 62720 * 8, /* just about the value in usbaudio.c */ .buffer_bytes_max = 62720 * 8, /* just about the value in usbaudio.c */
.period_bytes_min = 64, /* 12544/2, */ .period_bytes_min = 64, /* 12544/2, */
.period_bytes_max = 12544, .period_bytes_max = 12544,
.periods_min = 2, .periods_min = 2,
.periods_max = 98, /* 12544, */ .periods_max = 98, /* 12544, */
}; };
static int snd_cx231xx_capture_open(struct snd_pcm_substream *substream) static int snd_cx231xx_capture_open(struct snd_pcm_substream *substream)
@ -477,9 +471,8 @@ static int cx231xx_audio_init(struct cx231xx *dev)
"non standard usbaudio\n"); "non standard usbaudio\n");
card = snd_card_new(index[devnr], "Cx231xx Audio", THIS_MODULE, 0); card = snd_card_new(index[devnr], "Cx231xx Audio", THIS_MODULE, 0);
if (card == NULL) { if (card == NULL)
return -ENOMEM; return -ENOMEM;
}
spin_lock_init(&adev->slock); spin_lock_init(&adev->slock);
err = snd_pcm_new(card, "Cx231xx Audio", 0, 0, 1, &pcm); err = snd_pcm_new(card, "Cx231xx Audio", 0, 0, 1, &pcm);

File diff suppressed because it is too large Load Diff

View File

@ -109,27 +109,29 @@ static inline int cx231xx_isoc_vbi_copy(struct cx231xx *dev, struct urb *urb)
buffer_size = urb->actual_length; buffer_size = urb->actual_length;
if (buffer_size > 0) { if (buffer_size > 0) {
bytes_parsed = 0; bytes_parsed = 0;
if (dma_q->is_partial_line) { if (dma_q->is_partial_line) {
/* Handle the case where we were working on a partial line */ /* Handle the case where we were working on a partial
line */
sav_eav = dma_q->last_sav; sav_eav = dma_q->last_sav;
} else { } else {
/* Check for a SAV/EAV overlapping the buffer boundary */ /* Check for a SAV/EAV overlapping the
sav_eav = buffer boundary */
cx231xx_find_boundary_SAV_EAV(p_buffer,
sav_eav = cx231xx_find_boundary_SAV_EAV(p_buffer,
dma_q->partial_buf, dma_q->partial_buf,
&bytes_parsed); &bytes_parsed);
} }
sav_eav &= 0xF0; sav_eav &= 0xF0;
/* Get the first line if we have some portion of an SAV/EAV from the last buffer /* Get the first line if we have some portion of an SAV/EAV from
or a partial line */ the last buffer or a partial line */
if (sav_eav) { if (sav_eav) {
bytes_parsed += cx231xx_get_vbi_line(dev, dma_q, sav_eav, /* SAV/EAV */ bytes_parsed += cx231xx_get_vbi_line(dev, dma_q,
p_buffer + bytes_parsed, /* p_buffer */ sav_eav, /* SAV/EAV */
buffer_size - bytes_parsed); /* buffer size */ p_buffer + bytes_parsed, /* p_buffer */
buffer_size - bytes_parsed); /* buffer size */
} }
/* Now parse data that is completely in this buffer */ /* Now parse data that is completely in this buffer */
@ -139,16 +141,17 @@ static inline int cx231xx_isoc_vbi_copy(struct cx231xx *dev, struct urb *urb)
u32 bytes_used = 0; u32 bytes_used = 0;
sav_eav = cx231xx_find_next_SAV_EAV(p_buffer + bytes_parsed, /* p_buffer */ sav_eav = cx231xx_find_next_SAV_EAV(p_buffer + bytes_parsed, /* p_buffer */
buffer_size - bytes_parsed, /* buffer size */ buffer_size - bytes_parsed, /* buffer size */
&bytes_used); /* Receives bytes used to get SAV/EAV */ &bytes_used); /* Receives bytes used to get SAV/EAV */
bytes_parsed += bytes_used; bytes_parsed += bytes_used;
sav_eav &= 0xF0; sav_eav &= 0xF0;
if (sav_eav && (bytes_parsed < buffer_size)) { if (sav_eav && (bytes_parsed < buffer_size)) {
bytes_parsed += cx231xx_get_vbi_line(dev, dma_q, sav_eav, /* SAV/EAV */ bytes_parsed += cx231xx_get_vbi_line(dev,
p_buffer + bytes_parsed, /* p_buffer */ dma_q, sav_eav, /* SAV/EAV */
buffer_size - bytes_parsed); /* buffer size */ p_buffer + bytes_parsed, /* p_buffer */
buffer_size - bytes_parsed); /* buffer size */
} }
} }
@ -261,7 +264,7 @@ vbi_buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb,
buf->vb.state = VIDEOBUF_PREPARED; buf->vb.state = VIDEOBUF_PREPARED;
return 0; return 0;
fail: fail:
free_buffer(vq, buf); free_buffer(vq, buf);
return rc; return rc;
} }
@ -285,20 +288,15 @@ static void vbi_buffer_release(struct videobuf_queue *vq,
{ {
struct cx231xx_buffer *buf = struct cx231xx_buffer *buf =
container_of(vb, struct cx231xx_buffer, vb); container_of(vb, struct cx231xx_buffer, vb);
/*
struct cx231xx_fh *fh = vq->priv_data;
struct cx231xx *dev = (struct cx231xx *)fh->dev;
cx231xx_info(DRIVER_NAME "cx231xx: called vbi_buffer_release\n");
*/
free_buffer(vq, buf); free_buffer(vq, buf);
} }
struct videobuf_queue_ops cx231xx_vbi_qops = { struct videobuf_queue_ops cx231xx_vbi_qops = {
.buf_setup = vbi_buffer_setup, .buf_setup = vbi_buffer_setup,
.buf_prepare = vbi_buffer_prepare, .buf_prepare = vbi_buffer_prepare,
.buf_queue = vbi_buffer_queue, .buf_queue = vbi_buffer_queue,
.buf_release = vbi_buffer_release, .buf_release = vbi_buffer_release,
}; };
@ -387,7 +385,6 @@ void cx231xx_uninit_vbi_isoc(struct cx231xx *dev)
cx231xx_capture_start(dev, 0, Vbi); cx231xx_capture_start(dev, 0, Vbi);
} }
EXPORT_SYMBOL_GPL(cx231xx_uninit_vbi_isoc); EXPORT_SYMBOL_GPL(cx231xx_uninit_vbi_isoc);
/* /*
@ -395,8 +392,8 @@ EXPORT_SYMBOL_GPL(cx231xx_uninit_vbi_isoc);
*/ */
int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets, int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets,
int num_bufs, int max_pkt_size, int num_bufs, int max_pkt_size,
int (*isoc_copy) (struct cx231xx * dev, int (*isoc_copy) (struct cx231xx *dev,
struct urb * urb)) struct urb *urb))
{ {
struct cx231xx_dmaqueue *dma_q = &dev->vbi_mode.vidq; struct cx231xx_dmaqueue *dma_q = &dev->vbi_mode.vidq;
int i; int i;
@ -427,8 +424,8 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets,
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
dma_q->partial_buf[i] = 0; dma_q->partial_buf[i] = 0;
dev->vbi_mode.isoc_ctl.urb = dev->vbi_mode.isoc_ctl.urb = kzalloc(sizeof(void *) * num_bufs,
kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL); GFP_KERNEL);
if (!dev->vbi_mode.isoc_ctl.urb) { if (!dev->vbi_mode.isoc_ctl.urb) {
cx231xx_errdev("cannot alloc memory for usb buffers\n"); cx231xx_errdev("cannot alloc memory for usb buffers\n");
return -ENOMEM; return -ENOMEM;
@ -466,7 +463,7 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets,
cx231xx_err(DRIVER_NAME cx231xx_err(DRIVER_NAME
": unable to allocate %i bytes for transfer" ": unable to allocate %i bytes for transfer"
" buffer %i%s\n", sb_size, i, " buffer %i%s\n", sb_size, i,
in_interrupt()? " while in int" : ""); in_interrupt() ? " while in int" : "");
cx231xx_uninit_vbi_isoc(dev); cx231xx_uninit_vbi_isoc(dev);
return -ENOMEM; return -ENOMEM;
} }
@ -495,11 +492,10 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets,
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(cx231xx_init_vbi_isoc); EXPORT_SYMBOL_GPL(cx231xx_init_vbi_isoc);
u32 cx231xx_get_vbi_line(struct cx231xx * dev, struct cx231xx_dmaqueue * dma_q, u32 cx231xx_get_vbi_line(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q,
u8 sav_eav, u8 * p_buffer, u32 buffer_size) u8 sav_eav, u8 *p_buffer, u32 buffer_size)
{ {
u32 bytes_copied = 0; u32 bytes_copied = 0;
int current_field = -1; int current_field = -1;
@ -550,15 +546,14 @@ static inline void vbi_buffer_filled(struct cx231xx *dev,
} }
u32 cx231xx_copy_vbi_line(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, u32 cx231xx_copy_vbi_line(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q,
u8 * p_line, u32 length, int field_number) u8 *p_line, u32 length, int field_number)
{ {
u32 bytes_to_copy; u32 bytes_to_copy;
struct cx231xx_buffer *buf; struct cx231xx_buffer *buf;
u32 _line_size = dev->width * 2; u32 _line_size = dev->width * 2;
if (dma_q->current_field != field_number) { if (dma_q->current_field != field_number)
cx231xx_reset_vbi_buffer(dev, dma_q); cx231xx_reset_vbi_buffer(dev, dma_q);
}
/* get the buffer pointer */ /* get the buffer pointer */
buf = dev->vbi_mode.isoc_ctl.buf; buf = dev->vbi_mode.isoc_ctl.buf;
@ -651,7 +646,6 @@ void cx231xx_reset_vbi_buffer(struct cx231xx *dev,
buf = dev->vbi_mode.isoc_ctl.buf; buf = dev->vbi_mode.isoc_ctl.buf;
if (buf == NULL) { if (buf == NULL) {
/* first try to get the buffer */ /* first try to get the buffer */
get_next_vbi_buf(dma_q, &buf); get_next_vbi_buf(dma_q, &buf);
@ -664,7 +658,7 @@ void cx231xx_reset_vbi_buffer(struct cx231xx *dev,
} }
int cx231xx_do_vbi_copy(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, int cx231xx_do_vbi_copy(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q,
u8 * p_buffer, u32 bytes_to_copy) u8 *p_buffer, u32 bytes_to_copy)
{ {
u8 *p_out_buffer = NULL; u8 *p_out_buffer = NULL;
u32 current_line_bytes_copied = 0; u32 current_line_bytes_copied = 0;
@ -675,9 +669,8 @@ int cx231xx_do_vbi_copy(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q,
buf = dev->vbi_mode.isoc_ctl.buf; buf = dev->vbi_mode.isoc_ctl.buf;
if (buf == NULL) { if (buf == NULL)
return -1; return -EINVAL;
}
p_out_buffer = videobuf_to_vmalloc(&buf->vb); p_out_buffer = videobuf_to_vmalloc(&buf->vb);
@ -686,23 +679,22 @@ int cx231xx_do_vbi_copy(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q,
_line_size - dma_q->bytes_left_in_line; _line_size - dma_q->bytes_left_in_line;
} }
offset = offset = (dma_q->lines_completed * _line_size) +
(dma_q->lines_completed * _line_size) + current_line_bytes_copied; current_line_bytes_copied;
/* prepare destination address */ /* prepare destination address */
startwrite = p_out_buffer + offset; startwrite = p_out_buffer + offset;
lencopy = lencopy = dma_q->bytes_left_in_line > bytes_to_copy ?
dma_q->bytes_left_in_line > bytes_to_copy : dma_q->bytes_left_in_line;
bytes_to_copy ? bytes_to_copy : dma_q->bytes_left_in_line;
memcpy(startwrite, p_buffer, lencopy); memcpy(startwrite, p_buffer, lencopy);
return 0; return 0;
} }
u8 cx231xx_is_vbi_buffer_done(struct cx231xx * dev, u8 cx231xx_is_vbi_buffer_done(struct cx231xx *dev,
struct cx231xx_dmaqueue * dma_q) struct cx231xx_dmaqueue *dma_q)
{ {
u32 height = 0; u32 height = 0;

View File

@ -1,5 +1,6 @@
/* /*
cx231xx-video.c - driver for Conexant Cx23100/101/102 USB video capture devices cx231xx-video.c - driver for Conexant Cx23100/101/102
USB video capture devices
Copyright (C) 2008 <srinivasa.deevi at conexant dot com> Copyright (C) 2008 <srinivasa.deevi at conexant dot com>
Based on em28xx driver Based on em28xx driver
@ -109,91 +110,91 @@ static const struct v4l2_queryctrl no_ctl = {
static struct cx231xx_ctrl cx231xx_ctls[] = { static struct cx231xx_ctrl cx231xx_ctls[] = {
/* --- video --- */ /* --- video --- */
{ {
.v = { .v = {
.id = V4L2_CID_BRIGHTNESS, .id = V4L2_CID_BRIGHTNESS,
.name = "Brightness", .name = "Brightness",
.minimum = 0x00, .minimum = 0x00,
.maximum = 0xff, .maximum = 0xff,
.step = 1, .step = 1,
.default_value = 0x7f, .default_value = 0x7f,
.type = V4L2_CTRL_TYPE_INTEGER, .type = V4L2_CTRL_TYPE_INTEGER,
}, },
.off = 128, .off = 128,
.reg = LUMA_CTRL, .reg = LUMA_CTRL,
.mask = 0x00ff, .mask = 0x00ff,
.shift = 0, .shift = 0,
}, { }, {
.v = { .v = {
.id = V4L2_CID_CONTRAST, .id = V4L2_CID_CONTRAST,
.name = "Contrast", .name = "Contrast",
.minimum = 0, .minimum = 0,
.maximum = 0xff, .maximum = 0xff,
.step = 1, .step = 1,
.default_value = 0x3f, .default_value = 0x3f,
.type = V4L2_CTRL_TYPE_INTEGER, .type = V4L2_CTRL_TYPE_INTEGER,
}, },
.off = 0, .off = 0,
.reg = LUMA_CTRL, .reg = LUMA_CTRL,
.mask = 0xff00, .mask = 0xff00,
.shift = 8, .shift = 8,
}, { }, {
.v = { .v = {
.id = V4L2_CID_HUE, .id = V4L2_CID_HUE,
.name = "Hue", .name = "Hue",
.minimum = 0, .minimum = 0,
.maximum = 0xff, .maximum = 0xff,
.step = 1, .step = 1,
.default_value = 0x7f, .default_value = 0x7f,
.type = V4L2_CTRL_TYPE_INTEGER, .type = V4L2_CTRL_TYPE_INTEGER,
}, },
.off = 128, .off = 128,
.reg = CHROMA_CTRL, .reg = CHROMA_CTRL,
.mask = 0xff0000, .mask = 0xff0000,
.shift = 16, .shift = 16,
}, { }, {
/* strictly, this only describes only U saturation. /* strictly, this only describes only U saturation.
* V saturation is handled specially through code. * V saturation is handled specially through code.
*/ */
.v = { .v = {
.id = V4L2_CID_SATURATION, .id = V4L2_CID_SATURATION,
.name = "Saturation", .name = "Saturation",
.minimum = 0, .minimum = 0,
.maximum = 0xff, .maximum = 0xff,
.step = 1, .step = 1,
.default_value = 0x7f, .default_value = 0x7f,
.type = V4L2_CTRL_TYPE_INTEGER, .type = V4L2_CTRL_TYPE_INTEGER,
}, },
.off = 0, .off = 0,
.reg = CHROMA_CTRL, .reg = CHROMA_CTRL,
.mask = 0x00ff, .mask = 0x00ff,
.shift = 0, .shift = 0,
}, { }, {
/* --- audio --- */ /* --- audio --- */
.v = { .v = {
.id = V4L2_CID_AUDIO_MUTE, .id = V4L2_CID_AUDIO_MUTE,
.name = "Mute", .name = "Mute",
.minimum = 0, .minimum = 0,
.maximum = 1, .maximum = 1,
.default_value = 1, .default_value = 1,
.type = V4L2_CTRL_TYPE_BOOLEAN, .type = V4L2_CTRL_TYPE_BOOLEAN,
}, },
.reg = PATH1_CTL1, .reg = PATH1_CTL1,
.mask = (0x1f << 24), .mask = (0x1f << 24),
.shift = 24, .shift = 24,
}, { }, {
.v = { .v = {
.id = V4L2_CID_AUDIO_VOLUME, .id = V4L2_CID_AUDIO_VOLUME,
.name = "Volume", .name = "Volume",
.minimum = 0, .minimum = 0,
.maximum = 0x3f, .maximum = 0x3f,
.step = 1, .step = 1,
.default_value = 0x3f, .default_value = 0x3f,
.type = V4L2_CTRL_TYPE_INTEGER, .type = V4L2_CTRL_TYPE_INTEGER,
}, },
.reg = PATH1_VOL_CTL, .reg = PATH1_VOL_CTL,
.mask = 0xff, .mask = 0xff,
.shift = 0, .shift = 0,
} }
}; };
static const int CX231XX_CTLS = ARRAY_SIZE(cx231xx_ctls); static const int CX231XX_CTLS = ARRAY_SIZE(cx231xx_ctls);
@ -373,12 +374,13 @@ static inline int cx231xx_isoc_copy(struct cx231xx *dev, struct urb *urb)
} }
sav_eav &= 0xF0; sav_eav &= 0xF0;
/* Get the first line if we have some portion of an SAV/EAV from the last buffer /* Get the first line if we have some portion of an SAV/EAV from
or a partial line */ the last buffer or a partial line */
if (sav_eav) { if (sav_eav) {
bytes_parsed += cx231xx_get_video_line(dev, dma_q, sav_eav, /* SAV/EAV */ bytes_parsed += cx231xx_get_video_line(dev, dma_q,
p_buffer + bytes_parsed, /* p_buffer */ sav_eav, /* SAV/EAV */
buffer_size - bytes_parsed); /* buffer size */ p_buffer + bytes_parsed, /* p_buffer */
buffer_size - bytes_parsed); /* buffer size */
} }
/* Now parse data that is completely in this buffer */ /* Now parse data that is completely in this buffer */
@ -388,21 +390,22 @@ static inline int cx231xx_isoc_copy(struct cx231xx *dev, struct urb *urb)
u32 bytes_used = 0; u32 bytes_used = 0;
sav_eav = cx231xx_find_next_SAV_EAV(p_buffer + bytes_parsed, /* p_buffer */ sav_eav = cx231xx_find_next_SAV_EAV(p_buffer + bytes_parsed, /* p_buffer */
buffer_size - bytes_parsed, /* buffer size */ buffer_size - bytes_parsed, /* buffer size */
&bytes_used); /* Receives bytes used to get SAV/EAV */ &bytes_used); /* Receives bytes used to get SAV/EAV */
bytes_parsed += bytes_used; bytes_parsed += bytes_used;
sav_eav &= 0xF0; sav_eav &= 0xF0;
if (sav_eav && (bytes_parsed < buffer_size)) { if (sav_eav && (bytes_parsed < buffer_size)) {
bytes_parsed += cx231xx_get_video_line(dev, dma_q, sav_eav, /* SAV/EAV */ bytes_parsed += cx231xx_get_video_line(dev,
p_buffer + bytes_parsed, /* p_buffer */ dma_q, sav_eav, /* SAV/EAV */
buffer_size - bytes_parsed); /* buffer size */ p_buffer + bytes_parsed, /* p_buffer */
buffer_size - bytes_parsed); /* buffer size */
} }
} }
/* Save the last four bytes of the buffer so we can check the buffer boundary /* Save the last four bytes of the buffer so we can check the
condition next time */ buffer boundary condition next time */
memcpy(dma_q->partial_buf, p_buffer + buffer_size - 4, 4); memcpy(dma_q->partial_buf, p_buffer + buffer_size - 4, 4);
bytes_parsed = 0; bytes_parsed = 0;
@ -410,8 +413,8 @@ static inline int cx231xx_isoc_copy(struct cx231xx *dev, struct urb *urb)
return rc; return rc;
} }
u8 cx231xx_find_boundary_SAV_EAV(u8 * p_buffer, u8 * partial_buf, u8 cx231xx_find_boundary_SAV_EAV(u8 *p_buffer, u8 *partial_buf,
u32 * p_bytes_used) u32 *p_bytes_used)
{ {
u32 bytes_used; u32 bytes_used;
u8 boundary_bytes[8]; u8 boundary_bytes[8];
@ -426,8 +429,8 @@ u8 cx231xx_find_boundary_SAV_EAV(u8 * p_buffer, u8 * partial_buf,
memcpy(boundary_bytes + 4, p_buffer, 4); memcpy(boundary_bytes + 4, p_buffer, 4);
/* Check for the SAV/EAV in the boundary buffer */ /* Check for the SAV/EAV in the boundary buffer */
sav_eav = sav_eav = cx231xx_find_next_SAV_EAV((u8 *)&boundary_bytes, 8,
cx231xx_find_next_SAV_EAV((u8 *) & boundary_bytes, 8, &bytes_used); &bytes_used);
if (sav_eav) { if (sav_eav) {
/* found a boundary SAV/EAV. Updates the bytes used to reflect /* found a boundary SAV/EAV. Updates the bytes used to reflect
@ -438,13 +441,16 @@ u8 cx231xx_find_boundary_SAV_EAV(u8 * p_buffer, u8 * partial_buf,
return sav_eav; return sav_eav;
} }
u8 cx231xx_find_next_SAV_EAV(u8 * p_buffer, u32 buffer_size, u32 * p_bytes_used) u8 cx231xx_find_next_SAV_EAV(u8 *p_buffer, u32 buffer_size, u32 *p_bytes_used)
{ {
u32 i; u32 i;
u8 sav_eav = 0; u8 sav_eav = 0;
/* Don't search if the buffer size is less than 4. It causes a page fault since /*
buffer_size - 4 evaluates to a large number in that case. */ * Don't search if the buffer size is less than 4. It causes a page
* fault since buffer_size - 4 evaluates to a large number in that
* case.
*/
if (buffer_size < 4) { if (buffer_size < 4) {
*p_bytes_used = buffer_size; *p_bytes_used = buffer_size;
return 0; return 0;
@ -465,69 +471,61 @@ u8 cx231xx_find_next_SAV_EAV(u8 * p_buffer, u32 buffer_size, u32 * p_bytes_used)
return 0; return 0;
} }
u32 cx231xx_get_video_line(struct cx231xx * dev, u32 cx231xx_get_video_line(struct cx231xx *dev,
struct cx231xx_dmaqueue * dma_q, u8 sav_eav, struct cx231xx_dmaqueue *dma_q, u8 sav_eav,
u8 * p_buffer, u32 buffer_size) u8 *p_buffer, u32 buffer_size)
{ {
u32 bytes_copied = 0; u32 bytes_copied = 0;
int current_field = -1; int current_field = -1;
switch (sav_eav) { switch (sav_eav) {
case SAV_ACTIVE_VIDEO_FIELD1: case SAV_ACTIVE_VIDEO_FIELD1:
/* looking for skipped line which occurred in PAL 720x480 mode. In this case, /* looking for skipped line which occurred in PAL 720x480 mode.
there will be no active data contained between the SAV and EAV */ In this case, there will be no active data contained
if ((buffer_size > 3) && between the SAV and EAV */
(p_buffer[0] == 0xFF) && (p_buffer[1] == 0x00) if ((buffer_size > 3) && (p_buffer[0] == 0xFF) &&
&& (p_buffer[2] == 0x00) (p_buffer[1] == 0x00) && (p_buffer[2] == 0x00) &&
&& ((p_buffer[3] == EAV_ACTIVE_VIDEO_FIELD1) ((p_buffer[3] == EAV_ACTIVE_VIDEO_FIELD1) ||
|| (p_buffer[3] == EAV_ACTIVE_VIDEO_FIELD2) (p_buffer[3] == EAV_ACTIVE_VIDEO_FIELD2) ||
|| (p_buffer[3] == EAV_VBLANK_FIELD1) (p_buffer[3] == EAV_VBLANK_FIELD1) ||
|| (p_buffer[3] == EAV_VBLANK_FIELD2) (p_buffer[3] == EAV_VBLANK_FIELD2)))
)
) {
return bytes_copied; return bytes_copied;
}
current_field = 1; current_field = 1;
break; break;
case SAV_ACTIVE_VIDEO_FIELD2: case SAV_ACTIVE_VIDEO_FIELD2:
/* looking for skipped line which occurred in PAL 720x480 mode. In this case, /* looking for skipped line which occurred in PAL 720x480 mode.
there will be no active data contained between the SAV and EAV */ In this case, there will be no active data contained between
if ((buffer_size > 3) && the SAV and EAV */
(p_buffer[0] == 0xFF) && (p_buffer[1] == 0x00) if ((buffer_size > 3) && (p_buffer[0] == 0xFF) &&
&& (p_buffer[2] == 0x00) (p_buffer[1] == 0x00) && (p_buffer[2] == 0x00) &&
&& ((p_buffer[3] == EAV_ACTIVE_VIDEO_FIELD1) ((p_buffer[3] == EAV_ACTIVE_VIDEO_FIELD1) ||
|| (p_buffer[3] == EAV_ACTIVE_VIDEO_FIELD2) (p_buffer[3] == EAV_ACTIVE_VIDEO_FIELD2) ||
|| (p_buffer[3] == EAV_VBLANK_FIELD1) (p_buffer[3] == EAV_VBLANK_FIELD1) ||
|| (p_buffer[3] == EAV_VBLANK_FIELD2) (p_buffer[3] == EAV_VBLANK_FIELD2)))
)
) {
return bytes_copied; return bytes_copied;
}
current_field = 2; current_field = 2;
break; break;
} }
dma_q->last_sav = sav_eav; dma_q->last_sav = sav_eav;
bytes_copied = bytes_copied = cx231xx_copy_video_line(dev, dma_q, p_buffer,
cx231xx_copy_video_line(dev, dma_q, p_buffer, buffer_size, buffer_size, current_field);
current_field);
return bytes_copied; return bytes_copied;
} }
u32 cx231xx_copy_video_line(struct cx231xx * dev, u32 cx231xx_copy_video_line(struct cx231xx *dev,
struct cx231xx_dmaqueue * dma_q, u8 * p_line, struct cx231xx_dmaqueue *dma_q, u8 *p_line,
u32 length, int field_number) u32 length, int field_number)
{ {
u32 bytes_to_copy; u32 bytes_to_copy;
struct cx231xx_buffer *buf; struct cx231xx_buffer *buf;
u32 _line_size = dev->width * 2; u32 _line_size = dev->width * 2;
if (dma_q->current_field != field_number) { if (dma_q->current_field != field_number)
cx231xx_reset_video_buffer(dev, dma_q); cx231xx_reset_video_buffer(dev, dma_q);
}
/* get the buffer pointer */ /* get the buffer pointer */
buf = dev->video_mode.isoc_ctl.buf; buf = dev->video_mode.isoc_ctl.buf;
@ -541,8 +539,8 @@ u32 cx231xx_copy_video_line(struct cx231xx * dev,
if (dma_q->lines_completed >= dma_q->lines_per_field) { if (dma_q->lines_completed >= dma_q->lines_per_field) {
dma_q->bytes_left_in_line -= bytes_to_copy; dma_q->bytes_left_in_line -= bytes_to_copy;
dma_q->is_partial_line = dma_q->is_partial_line = (dma_q->bytes_left_in_line == 0) ?
(dma_q->bytes_left_in_line == 0) ? 0 : 1; 0 : 1;
return 0; return 0;
} }
@ -552,8 +550,8 @@ u32 cx231xx_copy_video_line(struct cx231xx * dev,
have copied if we had a buffer. */ have copied if we had a buffer. */
if (!buf) { if (!buf) {
dma_q->bytes_left_in_line -= bytes_to_copy; dma_q->bytes_left_in_line -= bytes_to_copy;
dma_q->is_partial_line = dma_q->is_partial_line = (dma_q->bytes_left_in_line == 0)
(dma_q->bytes_left_in_line == 0) ? 0 : 1; ? 0 : 1;
return bytes_to_copy; return bytes_to_copy;
} }
@ -564,13 +562,11 @@ u32 cx231xx_copy_video_line(struct cx231xx * dev,
dma_q->bytes_left_in_line -= bytes_to_copy; dma_q->bytes_left_in_line -= bytes_to_copy;
if (dma_q->bytes_left_in_line == 0) { if (dma_q->bytes_left_in_line == 0) {
dma_q->bytes_left_in_line = _line_size; dma_q->bytes_left_in_line = _line_size;
dma_q->lines_completed++; dma_q->lines_completed++;
dma_q->is_partial_line = 0; dma_q->is_partial_line = 0;
if (cx231xx_is_buffer_done(dev, dma_q) && buf) { if (cx231xx_is_buffer_done(dev, dma_q) && buf) {
buffer_filled(dev, dma_q, buf); buffer_filled(dev, dma_q, buf);
dma_q->pos = 0; dma_q->pos = 0;
@ -589,11 +585,10 @@ void cx231xx_reset_video_buffer(struct cx231xx *dev,
/* handle the switch from field 1 to field 2 */ /* handle the switch from field 1 to field 2 */
if (dma_q->current_field == 1) { if (dma_q->current_field == 1) {
if (dma_q->lines_completed >= dma_q->lines_per_field) { if (dma_q->lines_completed >= dma_q->lines_per_field)
dma_q->field1_done = 1; dma_q->field1_done = 1;
} else { else
dma_q->field1_done = 0; dma_q->field1_done = 0;
}
} }
buf = dev->video_mode.isoc_ctl.buf; buf = dev->video_mode.isoc_ctl.buf;
@ -617,7 +612,7 @@ void cx231xx_reset_video_buffer(struct cx231xx *dev,
} }
int cx231xx_do_copy(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, int cx231xx_do_copy(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q,
u8 * p_buffer, u32 bytes_to_copy) u8 *p_buffer, u32 bytes_to_copy)
{ {
u8 *p_out_buffer = NULL; u8 *p_out_buffer = NULL;
u32 current_line_bytes_copied = 0; u32 current_line_bytes_copied = 0;
@ -647,14 +642,11 @@ int cx231xx_do_copy(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q,
/* bytes already completed in the current line */ /* bytes already completed in the current line */
startwrite += current_line_bytes_copied; startwrite += current_line_bytes_copied;
lencopy = lencopy = dma_q->bytes_left_in_line > bytes_to_copy ?
dma_q->bytes_left_in_line > bytes_to_copy : dma_q->bytes_left_in_line;
bytes_to_copy ? bytes_to_copy : dma_q->bytes_left_in_line;
if ((u8 *) (startwrite + lencopy) > if ((u8 *)(startwrite + lencopy) > (u8 *)(p_out_buffer + buf->vb.size))
(u8 *) (p_out_buffer + buf->vb.size)) {
return 0; return 0;
}
/* The below copies the UYVY data straight into video buffer */ /* The below copies the UYVY data straight into video buffer */
cx231xx_swab((u16 *) p_buffer, (u16 *) startwrite, (u16) lencopy); cx231xx_swab((u16 *) p_buffer, (u16 *) startwrite, (u16) lencopy);
@ -662,16 +654,15 @@ int cx231xx_do_copy(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q,
return 0; return 0;
} }
void cx231xx_swab(u16 * from, u16 * to, u16 len) void cx231xx_swab(u16 *from, u16 *to, u16 len)
{ {
u16 i; u16 i;
if (len <= 0) if (len <= 0)
return; return;
for (i = 0; i < len / 2; i++) { for (i = 0; i < len / 2; i++)
to[i] = (from[i] << 8) | (from[i] >> 8); to[i] = (from[i] << 8) | (from[i] >> 8);
}
} }
u8 cx231xx_is_buffer_done(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q) u8 cx231xx_is_buffer_done(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q)
@ -679,10 +670,9 @@ u8 cx231xx_is_buffer_done(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q)
u8 buffer_complete = 0; u8 buffer_complete = 0;
/* Dual field stream */ /* Dual field stream */
buffer_complete = buffer_complete = ((dma_q->current_field == 2) &&
((dma_q->current_field == 2) && (dma_q->lines_completed >= dma_q->lines_per_field) &&
(dma_q->lines_completed >= dma_q->lines_per_field) && dma_q->field1_done);
dma_q->field1_done);
return buffer_complete; return buffer_complete;
} }
@ -698,8 +688,7 @@ buffer_setup(struct videobuf_queue *vq, unsigned int *count, unsigned int *size)
struct cx231xx *dev = fh->dev; struct cx231xx *dev = fh->dev;
struct v4l2_frequency f; struct v4l2_frequency f;
*size = *size = (fh->dev->width * fh->dev->height * dev->format->depth + 7)>>3;
(fh->dev->width * fh->dev->height * dev->format->depth + 7) >> 3;
if (0 == *count) if (0 == *count)
*count = CX231XX_DEF_BUF; *count = CX231XX_DEF_BUF;
@ -722,6 +711,7 @@ static void free_buffer(struct videobuf_queue *vq, struct cx231xx_buffer *buf)
struct cx231xx_fh *fh = vq->priv_data; struct cx231xx_fh *fh = vq->priv_data;
struct cx231xx *dev = fh->dev; struct cx231xx *dev = fh->dev;
unsigned long flags = 0; unsigned long flags = 0;
if (in_interrupt()) if (in_interrupt())
BUG(); BUG();
@ -754,9 +744,8 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb,
int rc = 0, urb_init = 0; int rc = 0, urb_init = 0;
/* The only currently supported format is 16 bits/pixel */ /* The only currently supported format is 16 bits/pixel */
buf->vb.size = buf->vb.size = (fh->dev->width * fh->dev->height * dev->format->depth
(fh->dev->width * fh->dev->height * dev->format->depth + 7) >> 3; + 7) >> 3;
if (0 != buf->vb.baddr && buf->vb.bsize < buf->vb.size) if (0 != buf->vb.baddr && buf->vb.bsize < buf->vb.size)
return -EINVAL; return -EINVAL;
@ -785,7 +774,7 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb,
buf->vb.state = VIDEOBUF_PREPARED; buf->vb.state = VIDEOBUF_PREPARED;
return 0; return 0;
fail: fail:
free_buffer(vq, buf); free_buffer(vq, buf);
return rc; return rc;
} }
@ -876,7 +865,7 @@ static int res_get(struct cx231xx_fh *fh)
static int res_check(struct cx231xx_fh *fh) static int res_check(struct cx231xx_fh *fh)
{ {
return (fh->stream_on); return fh->stream_on;
} }
static void res_free(struct cx231xx_fh *fh) static void res_free(struct cx231xx_fh *fh)
@ -948,6 +937,7 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
f->fmt.pix.field = V4L2_FIELD_INTERLACED; f->fmt.pix.field = V4L2_FIELD_INTERLACED;
mutex_unlock(&dev->lock); mutex_unlock(&dev->lock);
return 0; return 0;
} }
@ -1056,7 +1046,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
/* Set the correct alternate setting for this resolution */ /* Set the correct alternate setting for this resolution */
cx231xx_resolution_set(dev); cx231xx_resolution_set(dev);
out: out:
mutex_unlock(&dev->lock); mutex_unlock(&dev->lock);
return rc; return rc;
} }
@ -1110,11 +1100,11 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id * norm)
static const char *iname[] = { static const char *iname[] = {
[CX231XX_VMUX_COMPOSITE1] = "Composite1", [CX231XX_VMUX_COMPOSITE1] = "Composite1",
[CX231XX_VMUX_SVIDEO] = "S-Video", [CX231XX_VMUX_SVIDEO] = "S-Video",
[CX231XX_VMUX_TELEVISION] = "Television", [CX231XX_VMUX_TELEVISION] = "Television",
[CX231XX_VMUX_CABLE] = "Cable TV", [CX231XX_VMUX_CABLE] = "Cable TV",
[CX231XX_VMUX_DVB] = "DVB", [CX231XX_VMUX_DVB] = "DVB",
[CX231XX_VMUX_DEBUG] = "for debug only", [CX231XX_VMUX_DEBUG] = "for debug only",
}; };
static int vidioc_enum_input(struct file *file, void *priv, static int vidioc_enum_input(struct file *file, void *priv,
@ -1386,12 +1376,11 @@ static int vidioc_s_frequency(struct file *file, void *priv,
dev->ctl_freq = f->frequency; dev->ctl_freq = f->frequency;
if (dev->tuner_type == TUNER_XC5000) { if (dev->tuner_type == TUNER_XC5000) {
if (dev->cx231xx_set_analog_freq != NULL) { if (dev->cx231xx_set_analog_freq != NULL)
dev->cx231xx_set_analog_freq(dev, f->frequency); dev->cx231xx_set_analog_freq(dev, f->frequency);
}
} else { } else {
cx231xx_i2c_call_clients(&dev->i2c_bus[1], VIDIOC_S_FREQUENCY, cx231xx_i2c_call_clients(&dev->i2c_bus[1],
f); VIDIOC_S_FREQUENCY, f);
} }
mutex_unlock(&dev->lock); mutex_unlock(&dev->lock);
@ -1430,47 +1419,42 @@ static int vidioc_g_register(struct file *file, void *priv,
case V4L2_CHIP_MATCH_HOST: case V4L2_CHIP_MATCH_HOST:
switch (reg->match.addr) { switch (reg->match.addr) {
case 0: /* Cx231xx - internal registers */ case 0: /* Cx231xx - internal registers */
ret = ret = cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER,
cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, (u16)reg->reg, value, 4);
(u16) reg->reg, value, 4); reg->val = value[0] | value[1] << 8 |
reg->val = value[2] << 16 | value[3] << 24;
value[0] | value[1] << 8 | value[2] << 16 | value[3]
<< 24;
break; break;
case 1: /* Colibri - read byte */ case 1: /* Colibri - read byte */
ret = ret = cx231xx_read_i2c_data(dev, Colibri_DEVICE_ADDRESS,
cx231xx_read_i2c_data(dev, Colibri_DEVICE_ADDRESS, (u16)reg->reg, 2, &data, 1);
(u16) reg->reg, 2, &data, 1);
reg->val = le32_to_cpu(data & 0xff); reg->val = le32_to_cpu(data & 0xff);
break; break;
case 14: /* Colibri - read dword */ case 14: /* Colibri - read dword */
ret = ret = cx231xx_read_i2c_data(dev, Colibri_DEVICE_ADDRESS,
cx231xx_read_i2c_data(dev, Colibri_DEVICE_ADDRESS, (u16)reg->reg, 2, &data, 4);
(u16) reg->reg, 2, &data, 4);
reg->val = le32_to_cpu(data); reg->val = le32_to_cpu(data);
break; break;
case 2: /* Hammerhead - read byte */ case 2: /* Hammerhead - read byte */
ret = ret = cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, (u16)reg->reg, 2, &data, 1);
(u16) reg->reg, 2, &data, 1);
reg->val = le32_to_cpu(data & 0xff); reg->val = le32_to_cpu(data & 0xff);
break; break;
case 24: /* Hammerhead - read dword */ case 24: /* Hammerhead - read dword */
ret = ret = cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS,
cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, (u16)reg->reg, 2, &data, 4);
(u16) reg->reg, 2, &data, 4);
reg->val = le32_to_cpu(data); reg->val = le32_to_cpu(data);
break; break;
case 3: /* flatiron - read byte */ case 3: /* flatiron - read byte */
ret = ret = cx231xx_read_i2c_data(dev,
cx231xx_read_i2c_data(dev, Flatrion_DEVICE_ADDRESS, Flatrion_DEVICE_ADDRESS,
(u16) reg->reg, 1, &data, 1); (u16)reg->reg, 1,
&data, 1);
reg->val = le32_to_cpu(data & 0xff); reg->val = le32_to_cpu(data & 0xff);
break; break;
case 34: /* flatiron - read dword */ case 34: /* flatiron - read dword */
ret = ret =
cx231xx_read_i2c_data(dev, Flatrion_DEVICE_ADDRESS, cx231xx_read_i2c_data(dev, Flatrion_DEVICE_ADDRESS,
(u16) reg->reg, 1, &data, 4); (u16)reg->reg, 1, &data, 4);
reg->val = le32_to_cpu(data); reg->val = le32_to_cpu(data);
break; break;
} }
@ -1489,9 +1473,7 @@ static int vidioc_g_register(struct file *file, void *priv,
} }
mutex_lock(&dev->lock); mutex_lock(&dev->lock);
cx231xx_i2c_call_clients(&dev->i2c_bus[0], VIDIOC_DBG_G_REGISTER, reg); cx231xx_i2c_call_clients(&dev->i2c_bus[0], VIDIOC_DBG_G_REGISTER, reg);
mutex_unlock(&dev->lock); mutex_unlock(&dev->lock);
return ret; return ret;
@ -1520,53 +1502,50 @@ static int vidioc_s_register(struct file *file, void *priv,
data[1] = (u8) (value >> 8); data[1] = (u8) (value >> 8);
data[2] = (u8) (value >> 16); data[2] = (u8) (value >> 16);
data[3] = (u8) (value >> 24); data[3] = (u8) (value >> 24);
ret = ret = cx231xx_write_ctrl_reg(dev,
cx231xx_write_ctrl_reg(dev,
VRT_SET_REGISTER, VRT_SET_REGISTER,
(u16) reg->reg, data, (u16)reg->reg, data,
4); 4);
break; break;
case 1: /* Colibri - read byte */ case 1: /* Colibri - read byte */
ret = ret = cx231xx_write_i2c_data(dev,
cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS,
Colibri_DEVICE_ADDRESS, (u16)reg->reg, 2,
(u16) reg->reg, 2, value, 1);
value, 1);
break; break;
case 14: /* Colibri - read dword */ case 14: /* Colibri - read dword */
ret = ret = cx231xx_write_i2c_data(dev,
cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS,
Colibri_DEVICE_ADDRESS, (u16)reg->reg, 2,
(u16) reg->reg, 2, value, 4);
value, 4);
break; break;
case 2: /* Hammerhead - read byte */ case 2: /* Hammerhead - read byte */
ret = ret =
cx231xx_write_i2c_data(dev, cx231xx_write_i2c_data(dev,
HAMMERHEAD_I2C_ADDRESS, HAMMERHEAD_I2C_ADDRESS,
(u16) reg->reg, 2, (u16)reg->reg, 2,
value, 1); value, 1);
break; break;
case 24: /* Hammerhead - read dword */ case 24: /* Hammerhead - read dword */
ret = ret =
cx231xx_write_i2c_data(dev, cx231xx_write_i2c_data(dev,
HAMMERHEAD_I2C_ADDRESS, HAMMERHEAD_I2C_ADDRESS,
(u16) reg->reg, 2, (u16)reg->reg, 2,
value, 4); value, 4);
break; break;
case 3: /* flatiron - read byte */ case 3: /* flatiron - read byte */
ret = ret =
cx231xx_write_i2c_data(dev, cx231xx_write_i2c_data(dev,
Flatrion_DEVICE_ADDRESS, Flatrion_DEVICE_ADDRESS,
(u16) reg->reg, 1, (u16)reg->reg, 1,
value, 1); value, 1);
break; break;
case 34: /* flatiron - read dword */ case 34: /* flatiron - read dword */
ret = ret =
cx231xx_write_i2c_data(dev, cx231xx_write_i2c_data(dev,
Flatrion_DEVICE_ADDRESS, Flatrion_DEVICE_ADDRESS,
(u16) reg->reg, 1, (u16)reg->reg, 1,
value, 4); value, 4);
break; break;
} }
} }
@ -1805,7 +1784,7 @@ static int vidioc_reqbufs(struct file *file, void *priv,
if (rc < 0) if (rc < 0)
return rc; return rc;
return (videobuf_reqbufs(&fh->vb_vidq, rb)); return videobuf_reqbufs(&fh->vb_vidq, rb);
} }
static int vidioc_querybuf(struct file *file, void *priv, struct v4l2_buffer *b) static int vidioc_querybuf(struct file *file, void *priv, struct v4l2_buffer *b)
@ -1818,7 +1797,7 @@ static int vidioc_querybuf(struct file *file, void *priv, struct v4l2_buffer *b)
if (rc < 0) if (rc < 0)
return rc; return rc;
return (videobuf_querybuf(&fh->vb_vidq, b)); return videobuf_querybuf(&fh->vb_vidq, b);
} }
static int vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *b) static int vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *b)
@ -1831,7 +1810,7 @@ static int vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *b)
if (rc < 0) if (rc < 0)
return rc; return rc;
return (videobuf_qbuf(&fh->vb_vidq, b)); return videobuf_qbuf(&fh->vb_vidq, b);
} }
static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b) static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b)
@ -1844,7 +1823,7 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b)
if (rc < 0) if (rc < 0)
return rc; return rc;
return (videobuf_dqbuf(&fh->vb_vidq, b, file->f_flags & O_NONBLOCK)); return videobuf_dqbuf(&fh->vb_vidq, b, file->f_flags & O_NONBLOCK);
} }
#ifdef CONFIG_VIDEO_V4L1_COMPAT #ifdef CONFIG_VIDEO_V4L1_COMPAT
@ -2030,17 +2009,19 @@ static int cx231xx_v4l2_open(struct file *filp)
dev->users++; dev->users++;
if (fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { if (fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
videobuf_queue_vmalloc_init(&fh->vb_vidq, &cx231xx_video_qops, NULL, &dev->video_mode.slock, fh->type, V4L2_FIELD_INTERLACED, /* V4L2_FIELD_SEQ_TB, */ videobuf_queue_vmalloc_init(&fh->vb_vidq, &cx231xx_video_qops,
NULL, &dev->video_mode.slock,
fh->type, V4L2_FIELD_INTERLACED,
sizeof(struct cx231xx_buffer), fh); sizeof(struct cx231xx_buffer), fh);
}
if (fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) { if (fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) {
/* Set the required alternate setting VBI interface works in
/* Set the required alternate setting VBI interface works in Bulk mode only */ Bulk mode only */
cx231xx_set_alt_setting(dev, INDEX_VANC, 0); cx231xx_set_alt_setting(dev, INDEX_VANC, 0);
videobuf_queue_vmalloc_init(&fh->vb_vidq, &cx231xx_vbi_qops, NULL, &dev->vbi_mode.slock, fh->type, V4L2_FIELD_SEQ_TB, /* V4L2_FIELD_INTERLACED, */ videobuf_queue_vmalloc_init(&fh->vb_vidq, &cx231xx_vbi_qops,
NULL, &dev->vbi_mode.slock,
fh->type, V4L2_FIELD_SEQ_TB,
sizeof(struct cx231xx_buffer), fh); sizeof(struct cx231xx_buffer), fh);
} }
@ -2120,11 +2101,10 @@ static int cx231xx_v4l2_close(struct file *filp)
cx231xx_uninit_vbi_isoc(dev); cx231xx_uninit_vbi_isoc(dev);
/* set alternate 0 */ /* set alternate 0 */
if (!dev->vbi_or_sliced_cc_mode) { if (!dev->vbi_or_sliced_cc_mode)
cx231xx_set_alt_setting(dev, INDEX_VANC, 0); cx231xx_set_alt_setting(dev, INDEX_VANC, 0);
} else { else
cx231xx_set_alt_setting(dev, INDEX_HANC, 0); cx231xx_set_alt_setting(dev, INDEX_HANC, 0);
}
kfree(fh); kfree(fh);
dev->users--; dev->users--;
@ -2169,8 +2149,8 @@ static int cx231xx_v4l2_close(struct file *filp)
* will allocate buffers when called for the first time * will allocate buffers when called for the first time
*/ */
static ssize_t static ssize_t
cx231xx_v4l2_read(struct file *filp, char __user * buf, size_t count, cx231xx_v4l2_read(struct file *filp, char __user *buf, size_t count,
loff_t * pos) loff_t *pos)
{ {
struct cx231xx_fh *fh = filp->private_data; struct cx231xx_fh *fh = filp->private_data;
struct cx231xx *dev = fh->dev; struct cx231xx *dev = fh->dev;
@ -2254,98 +2234,98 @@ static int cx231xx_v4l2_mmap(struct file *filp, struct vm_area_struct *vma)
} }
static const struct v4l2_file_operations cx231xx_v4l_fops = { static const struct v4l2_file_operations cx231xx_v4l_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = cx231xx_v4l2_open, .open = cx231xx_v4l2_open,
.release = cx231xx_v4l2_close, .release = cx231xx_v4l2_close,
.read = cx231xx_v4l2_read, .read = cx231xx_v4l2_read,
.poll = cx231xx_v4l2_poll, .poll = cx231xx_v4l2_poll,
.mmap = cx231xx_v4l2_mmap, .mmap = cx231xx_v4l2_mmap,
.ioctl = video_ioctl2, .ioctl = video_ioctl2,
}; };
static const struct v4l2_ioctl_ops video_ioctl_ops = { static const struct v4l2_ioctl_ops video_ioctl_ops = {
.vidioc_querycap = vidioc_querycap, .vidioc_querycap = vidioc_querycap,
.vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap,
.vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap,
.vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap, .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap,
.vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap,
.vidioc_g_fmt_vbi_cap = vidioc_g_fmt_vbi_cap, .vidioc_g_fmt_vbi_cap = vidioc_g_fmt_vbi_cap,
.vidioc_try_fmt_vbi_cap = vidioc_try_fmt_vbi_cap, .vidioc_try_fmt_vbi_cap = vidioc_try_fmt_vbi_cap,
.vidioc_s_fmt_vbi_cap = vidioc_try_fmt_vbi_cap, .vidioc_s_fmt_vbi_cap = vidioc_try_fmt_vbi_cap,
.vidioc_g_audio = vidioc_g_audio, .vidioc_g_audio = vidioc_g_audio,
.vidioc_s_audio = vidioc_s_audio, .vidioc_s_audio = vidioc_s_audio,
.vidioc_cropcap = vidioc_cropcap, .vidioc_cropcap = vidioc_cropcap,
.vidioc_g_fmt_sliced_vbi_cap = vidioc_g_fmt_sliced_vbi_cap, .vidioc_g_fmt_sliced_vbi_cap = vidioc_g_fmt_sliced_vbi_cap,
.vidioc_try_fmt_sliced_vbi_cap = vidioc_try_set_sliced_vbi_cap, .vidioc_try_fmt_sliced_vbi_cap = vidioc_try_set_sliced_vbi_cap,
.vidioc_reqbufs = vidioc_reqbufs, .vidioc_reqbufs = vidioc_reqbufs,
.vidioc_querybuf = vidioc_querybuf, .vidioc_querybuf = vidioc_querybuf,
.vidioc_qbuf = vidioc_qbuf, .vidioc_qbuf = vidioc_qbuf,
.vidioc_dqbuf = vidioc_dqbuf, .vidioc_dqbuf = vidioc_dqbuf,
.vidioc_s_std = vidioc_s_std, .vidioc_s_std = vidioc_s_std,
.vidioc_g_std = vidioc_g_std, .vidioc_g_std = vidioc_g_std,
.vidioc_enum_input = vidioc_enum_input, .vidioc_enum_input = vidioc_enum_input,
.vidioc_g_input = vidioc_g_input, .vidioc_g_input = vidioc_g_input,
.vidioc_s_input = vidioc_s_input, .vidioc_s_input = vidioc_s_input,
.vidioc_queryctrl = vidioc_queryctrl, .vidioc_queryctrl = vidioc_queryctrl,
.vidioc_g_ctrl = vidioc_g_ctrl, .vidioc_g_ctrl = vidioc_g_ctrl,
.vidioc_s_ctrl = vidioc_s_ctrl, .vidioc_s_ctrl = vidioc_s_ctrl,
.vidioc_streamon = vidioc_streamon, .vidioc_streamon = vidioc_streamon,
.vidioc_streamoff = vidioc_streamoff, .vidioc_streamoff = vidioc_streamoff,
.vidioc_g_tuner = vidioc_g_tuner, .vidioc_g_tuner = vidioc_g_tuner,
.vidioc_s_tuner = vidioc_s_tuner, .vidioc_s_tuner = vidioc_s_tuner,
.vidioc_g_frequency = vidioc_g_frequency, .vidioc_g_frequency = vidioc_g_frequency,
.vidioc_s_frequency = vidioc_s_frequency, .vidioc_s_frequency = vidioc_s_frequency,
#ifdef CONFIG_VIDEO_ADV_DEBUG #ifdef CONFIG_VIDEO_ADV_DEBUG
.vidioc_g_register = vidioc_g_register, .vidioc_g_register = vidioc_g_register,
.vidioc_s_register = vidioc_s_register, .vidioc_s_register = vidioc_s_register,
#endif #endif
#ifdef CONFIG_VIDEO_V4L1_COMPAT #ifdef CONFIG_VIDEO_V4L1_COMPAT
.vidiocgmbuf = vidiocgmbuf, .vidiocgmbuf = vidiocgmbuf,
#endif #endif
}; };
static struct video_device cx231xx_vbi_template; static struct video_device cx231xx_vbi_template;
static const struct video_device cx231xx_video_template = { static const struct video_device cx231xx_video_template = {
.fops = &cx231xx_v4l_fops, .fops = &cx231xx_v4l_fops,
.release = video_device_release, .release = video_device_release,
.ioctl_ops = &video_ioctl_ops, .ioctl_ops = &video_ioctl_ops,
.minor = -1, .minor = -1,
.tvnorms = V4L2_STD_ALL, .tvnorms = V4L2_STD_ALL,
.current_norm = V4L2_STD_PAL, .current_norm = V4L2_STD_PAL,
}; };
static const struct v4l2_file_operations radio_fops = { static const struct v4l2_file_operations radio_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = cx231xx_v4l2_open, .open = cx231xx_v4l2_open,
.release = cx231xx_v4l2_close, .release = cx231xx_v4l2_close,
.ioctl = video_ioctl2, .ioctl = video_ioctl2,
}; };
static const struct v4l2_ioctl_ops radio_ioctl_ops = { static const struct v4l2_ioctl_ops radio_ioctl_ops = {
.vidioc_querycap = radio_querycap, .vidioc_querycap = radio_querycap,
.vidioc_g_tuner = radio_g_tuner, .vidioc_g_tuner = radio_g_tuner,
.vidioc_enum_input = radio_enum_input, .vidioc_enum_input = radio_enum_input,
.vidioc_g_audio = radio_g_audio, .vidioc_g_audio = radio_g_audio,
.vidioc_s_tuner = radio_s_tuner, .vidioc_s_tuner = radio_s_tuner,
.vidioc_s_audio = radio_s_audio, .vidioc_s_audio = radio_s_audio,
.vidioc_s_input = radio_s_input, .vidioc_s_input = radio_s_input,
.vidioc_queryctrl = radio_queryctrl, .vidioc_queryctrl = radio_queryctrl,
.vidioc_g_ctrl = vidioc_g_ctrl, .vidioc_g_ctrl = vidioc_g_ctrl,
.vidioc_s_ctrl = vidioc_s_ctrl, .vidioc_s_ctrl = vidioc_s_ctrl,
.vidioc_g_frequency = vidioc_g_frequency, .vidioc_g_frequency = vidioc_g_frequency,
.vidioc_s_frequency = vidioc_s_frequency, .vidioc_s_frequency = vidioc_s_frequency,
#ifdef CONFIG_VIDEO_ADV_DEBUG #ifdef CONFIG_VIDEO_ADV_DEBUG
.vidioc_g_register = vidioc_g_register, .vidioc_g_register = vidioc_g_register,
.vidioc_s_register = vidioc_s_register, .vidioc_s_register = vidioc_s_register,
#endif #endif
}; };
static struct video_device cx231xx_radio_template = { static struct video_device cx231xx_radio_template = {
.name = "cx231xx-radio", .name = "cx231xx-radio",
.fops = &radio_fops, .fops = &radio_fops,
.ioctl_ops = &radio_ioctl_ops, .ioctl_ops = &radio_ioctl_ops,
.minor = -1, .minor = -1,
}; };
/******************************** usb interface ******************************/ /******************************** usb interface ******************************/
@ -2358,6 +2338,7 @@ static struct video_device *cx231xx_vdev_init(struct cx231xx *dev, const struct
vfd = video_device_alloc(); vfd = video_device_alloc();
if (NULL == vfd) if (NULL == vfd)
return NULL; return NULL;
*vfd = *template; *vfd = *template;
vfd->minor = -1; vfd->minor = -1;
vfd->parent = &dev->udev->dev; vfd->parent = &dev->udev->dev;
@ -2439,8 +2420,8 @@ int cx231xx_register_analog_devices(struct cx231xx *dev)
dev->name, dev->vbi_dev->num); dev->name, dev->vbi_dev->num);
if (cx231xx_boards[dev->model].radio.type == CX231XX_RADIO) { if (cx231xx_boards[dev->model].radio.type == CX231XX_RADIO) {
dev->radio_dev = dev->radio_dev = cx231xx_vdev_init(dev, &cx231xx_radio_template,
cx231xx_vdev_init(dev, &cx231xx_radio_template, "radio"); "radio");
if (!dev->radio_dev) { if (!dev->radio_dev) {
cx231xx_errdev("cannot allocate video_device.\n"); cx231xx_errdev("cannot allocate video_device.\n");
return -ENODEV; return -ENODEV;

View File

@ -140,8 +140,7 @@ struct cx231xx_usb_isoc_ctl {
int nfields; int nfields;
/* isoc urb callback */ /* isoc urb callback */
int (*isoc_copy) (struct cx231xx * dev, struct urb * urb); int (*isoc_copy) (struct cx231xx *dev, struct urb *urb);
}; };
struct cx231xx_fmt { struct cx231xx_fmt {
@ -497,20 +496,19 @@ struct cx231xx {
char urb_buf[URB_MAX_CTRL_SIZE]; /* urb control msg buffer */ char urb_buf[URB_MAX_CTRL_SIZE]; /* urb control msg buffer */
/* helper funcs that call usb_control_msg */ /* helper funcs that call usb_control_msg */
int (*cx231xx_read_ctrl_reg) (struct cx231xx * dev, u8 req, u16 reg, int (*cx231xx_read_ctrl_reg) (struct cx231xx *dev, u8 req, u16 reg,
char *buf, int len); char *buf, int len);
int (*cx231xx_write_ctrl_reg) (struct cx231xx * dev, u8 req, u16 reg, int (*cx231xx_write_ctrl_reg) (struct cx231xx *dev, u8 req, u16 reg,
char *buf, int len); char *buf, int len);
int (*cx231xx_send_usb_command) (struct cx231xx_i2c * i2c_bus, int (*cx231xx_send_usb_command) (struct cx231xx_i2c *i2c_bus,
struct cx231xx_i2c_xfer_data * struct cx231xx_i2c_xfer_data *req_data);
req_data); int (*cx231xx_gpio_i2c_read) (struct cx231xx *dev, u8 dev_addr,
int (*cx231xx_gpio_i2c_read) (struct cx231xx * dev, u8 dev_addr, u8 *buf, u8 len);
u8 * buf, u8 len); int (*cx231xx_gpio_i2c_write) (struct cx231xx *dev, u8 dev_addr,
int (*cx231xx_gpio_i2c_write) (struct cx231xx * dev, u8 dev_addr, u8 *buf, u8 len);
u8 * buf, u8 len);
int (*cx231xx_set_analog_freq) (struct cx231xx * dev, u32 freq); int (*cx231xx_set_analog_freq) (struct cx231xx *dev, u32 freq);
int (*cx231xx_reset_analog_tuner) (struct cx231xx * dev); int (*cx231xx_reset_analog_tuner) (struct cx231xx *dev);
enum cx231xx_mode mode; enum cx231xx_mode mode;
@ -562,7 +560,7 @@ int cx231xx_i2c_unregister(struct cx231xx_i2c *bus);
/* Internal block control functions */ /* Internal block control functions */
int cx231xx_read_i2c_data(struct cx231xx *dev, u8 dev_addr, int cx231xx_read_i2c_data(struct cx231xx *dev, u8 dev_addr,
u16 saddr, u8 saddr_len, u32 * data, u8 data_len); u16 saddr, u8 saddr_len, u32 *data, u8 data_len);
int cx231xx_write_i2c_data(struct cx231xx *dev, u8 dev_addr, int cx231xx_write_i2c_data(struct cx231xx *dev, u8 dev_addr,
u16 saddr, u8 saddr_len, u32 data, u8 data_len); u16 saddr, u8 saddr_len, u32 data, u8 data_len);
int cx231xx_reg_mask_write(struct cx231xx *dev, u8 dev_addr, u8 size, int cx231xx_reg_mask_write(struct cx231xx *dev, u8 dev_addr, u8 size,
@ -594,20 +592,20 @@ int cx231xx_tuner_pre_channel_change(struct cx231xx *dev);
int cx231xx_tuner_post_channel_change(struct cx231xx *dev); int cx231xx_tuner_post_channel_change(struct cx231xx *dev);
/* video parser functions */ /* video parser functions */
u8 cx231xx_find_next_SAV_EAV(u8 * p_buffer, u32 buffer_size, u8 cx231xx_find_next_SAV_EAV(u8 *p_buffer, u32 buffer_size,
u32 * p_bytes_used); u32 *p_bytes_used);
u8 cx231xx_find_boundary_SAV_EAV(u8 * p_buffer, u8 * partial_buf, u8 cx231xx_find_boundary_SAV_EAV(u8 *p_buffer, u8 *partial_buf,
u32 * p_bytes_used); u32 *p_bytes_used);
int cx231xx_do_copy(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, int cx231xx_do_copy(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q,
u8 * p_buffer, u32 bytes_to_copy); u8 *p_buffer, u32 bytes_to_copy);
void cx231xx_reset_video_buffer(struct cx231xx *dev, void cx231xx_reset_video_buffer(struct cx231xx *dev,
struct cx231xx_dmaqueue *dma_q); struct cx231xx_dmaqueue *dma_q);
u8 cx231xx_is_buffer_done(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q); u8 cx231xx_is_buffer_done(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q);
u32 cx231xx_copy_video_line(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, u32 cx231xx_copy_video_line(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q,
u8 * p_line, u32 length, int field_number); u8 *p_line, u32 length, int field_number);
u32 cx231xx_get_video_line(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, u32 cx231xx_get_video_line(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q,
u8 sav_eav, u8 * p_buffer, u32 buffer_size); u8 sav_eav, u8 *p_buffer, u32 buffer_size);
void cx231xx_swab(u16 * from, u16 * to, u16 len); void cx231xx_swab(u16 *from, u16 *to, u16 len);
/* Provided by cx231xx-core.c */ /* Provided by cx231xx-core.c */
@ -624,15 +622,15 @@ int cx231xx_write_ctrl_reg(struct cx231xx *dev, u8 req, u16 reg,
char *buf, int len); char *buf, int len);
int cx231xx_mode_register(struct cx231xx *dev, u16 address, u32 mode); int cx231xx_mode_register(struct cx231xx *dev, u16 address, u32 mode);
int cx231xx_send_vendor_cmd(struct cx231xx *dev, VENDOR_REQUEST_IN * ven_req); int cx231xx_send_vendor_cmd(struct cx231xx *dev, VENDOR_REQUEST_IN *ven_req);
int cx231xx_send_usb_command(struct cx231xx_i2c *i2c_bus, int cx231xx_send_usb_command(struct cx231xx_i2c *i2c_bus,
struct cx231xx_i2c_xfer_data *req_data); struct cx231xx_i2c_xfer_data *req_data);
/* Gpio related functions */ /* Gpio related functions */
int cx231xx_send_gpio_cmd(struct cx231xx *dev, u32 gpio_bit, u8 * gpio_val, int cx231xx_send_gpio_cmd(struct cx231xx *dev, u32 gpio_bit, u8 *gpio_val,
u8 len, u8 request, u8 direction); u8 len, u8 request, u8 direction);
int cx231xx_set_gpio_bit(struct cx231xx *dev, u32 gpio_bit, u8 * gpio_val); int cx231xx_set_gpio_bit(struct cx231xx *dev, u32 gpio_bit, u8 *gpio_val);
int cx231xx_get_gpio_bit(struct cx231xx *dev, u32 gpio_bit, u8 * gpio_val); int cx231xx_get_gpio_bit(struct cx231xx *dev, u32 gpio_bit, u8 *gpio_val);
int cx231xx_set_gpio_value(struct cx231xx *dev, int pin_number, int pin_value); int cx231xx_set_gpio_value(struct cx231xx *dev, int pin_number, int pin_value);
int cx231xx_set_gpio_direction(struct cx231xx *dev, int pin_number, int cx231xx_set_gpio_direction(struct cx231xx *dev, int pin_number,
int pin_value); int pin_value);
@ -640,13 +638,13 @@ int cx231xx_set_gpio_direction(struct cx231xx *dev, int pin_number,
int cx231xx_gpio_i2c_start(struct cx231xx *dev); int cx231xx_gpio_i2c_start(struct cx231xx *dev);
int cx231xx_gpio_i2c_end(struct cx231xx *dev); int cx231xx_gpio_i2c_end(struct cx231xx *dev);
int cx231xx_gpio_i2c_write_byte(struct cx231xx *dev, u8 data); int cx231xx_gpio_i2c_write_byte(struct cx231xx *dev, u8 data);
int cx231xx_gpio_i2c_read_byte(struct cx231xx *dev, u8 * buf); int cx231xx_gpio_i2c_read_byte(struct cx231xx *dev, u8 *buf);
int cx231xx_gpio_i2c_read_ack(struct cx231xx *dev); int cx231xx_gpio_i2c_read_ack(struct cx231xx *dev);
int cx231xx_gpio_i2c_write_ack(struct cx231xx *dev); int cx231xx_gpio_i2c_write_ack(struct cx231xx *dev);
int cx231xx_gpio_i2c_write_nak(struct cx231xx *dev); int cx231xx_gpio_i2c_write_nak(struct cx231xx *dev);
int cx231xx_gpio_i2c_read(struct cx231xx *dev, u8 dev_addr, u8 * buf, u8 len); int cx231xx_gpio_i2c_read(struct cx231xx *dev, u8 dev_addr, u8 *buf, u8 len);
int cx231xx_gpio_i2c_write(struct cx231xx *dev, u8 dev_addr, u8 * buf, u8 len); int cx231xx_gpio_i2c_write(struct cx231xx *dev, u8 dev_addr, u8 *buf, u8 len);
/* audio related functions */ /* audio related functions */
int cx231xx_set_audio_decoder_input(struct cx231xx *dev, int cx231xx_set_audio_decoder_input(struct cx231xx *dev,
@ -658,8 +656,8 @@ int cx231xx_set_video_alternate(struct cx231xx *dev);
int cx231xx_set_alt_setting(struct cx231xx *dev, u8 index, u8 alt); int cx231xx_set_alt_setting(struct cx231xx *dev, u8 index, u8 alt);
int cx231xx_init_isoc(struct cx231xx *dev, int max_packets, int cx231xx_init_isoc(struct cx231xx *dev, int max_packets,
int num_bufs, int max_pkt_size, int num_bufs, int max_pkt_size,
int (*isoc_copy) (struct cx231xx * dev, int (*isoc_copy) (struct cx231xx *dev,
struct urb * urb)); struct urb *urb));
void cx231xx_uninit_isoc(struct cx231xx *dev); void cx231xx_uninit_isoc(struct cx231xx *dev);
int cx231xx_set_mode(struct cx231xx *dev, enum cx231xx_mode set_mode); int cx231xx_set_mode(struct cx231xx *dev, enum cx231xx_mode set_mode);
int cx231xx_gpio_set(struct cx231xx *dev, struct cx231xx_reg_seq *gpio); int cx231xx_gpio_set(struct cx231xx *dev, struct cx231xx_reg_seq *gpio);