diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-13 17:03:59 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-13 17:03:59 -0400 |
commit | cf2fa66055d718ae13e62451bb546505f63906a2 (patch) | |
tree | e206d3f04e74a34e9aa88d21af6c26eea21d4121 /drivers/media/video/cx18/cx18-ioctl.c | |
parent | 4501a466f28788485604ee42641d7a5fe7258d16 (diff) | |
parent | 57f51dbc45f65f7ee1e8c8f77200bb8000e3e271 (diff) |
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6: (313 commits)
V4L/DVB (9186): Added support for Prof 7300 DVB-S/S2 cards
V4L/DVB (9185): S2API: Ensure we have a reasonable ROLLOFF default
V4L/DVB (9184): cx24116: Change the default SNR units back to percentage by default.
V4L/DVB (9183): S2API: Return error of the caller provides 0 commands.
V4L/DVB (9182): S2API: Added support for DTV_HIERARCHY
V4L/DVB (9181): S2API: Add support fot DTV_GUARD_INTERVAL and DTV_TRANSMISSION_MODE
V4L/DVB (9180): S2API: Added support for DTV_CODE_RATE_HP/LP
V4L/DVB (9179): S2API: frontend.h cleanup
V4L/DVB (9178): cx24116: Add module parameter to return SNR as ESNO.
V4L/DVB (9177): S2API: Change _8PSK / _16APSK to PSK_8 and APSK_16
V4L/DVB (9176): Add support for DvbWorld USB cards with STV0288 demodulator.
V4L/DVB (9175): Remove NULL pointer in stb6000 driver.
V4L/DVB (9174): Allow custom inittab for ST STV0288 demodulator.
V4L/DVB (9173): S2API: Remove the hardcoded command limit during validation
V4L/DVB (9172): S2API: Bugfix related to DVB-S / DVB-S2 tuning for the legacy API.
V4L/DVB (9171): S2API: Stop an OOPS if illegal commands are dumped in S2API.
V4L/DVB (9170): cx24116: Sanity checking to data input via S2API to the cx24116 demod.
V4L/DVB (9169): uvcvideo: Support two new Bison Electronics webcams.
V4L/DVB (9168): Add support for MSI TV@nywhere Plus remote
V4L/DVB: v4l2-dev: remove duplicated #include
...
Diffstat (limited to 'drivers/media/video/cx18/cx18-ioctl.c')
-rw-r--r-- | drivers/media/video/cx18/cx18-ioctl.c | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/drivers/media/video/cx18/cx18-ioctl.c b/drivers/media/video/cx18/cx18-ioctl.c index a7f839631d6a..f0ca50f5fdde 100644 --- a/drivers/media/video/cx18/cx18-ioctl.c +++ b/drivers/media/video/cx18/cx18-ioctl.c | |||
@@ -22,6 +22,7 @@ | |||
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include "cx18-driver.h" | 24 | #include "cx18-driver.h" |
25 | #include "cx18-io.h" | ||
25 | #include "cx18-version.h" | 26 | #include "cx18-version.h" |
26 | #include "cx18-mailbox.h" | 27 | #include "cx18-mailbox.h" |
27 | #include "cx18-i2c.h" | 28 | #include "cx18-i2c.h" |
@@ -170,7 +171,6 @@ static int cx18_try_fmt_vid_cap(struct file *file, void *fh, | |||
170 | { | 171 | { |
171 | struct cx18_open_id *id = fh; | 172 | struct cx18_open_id *id = fh; |
172 | struct cx18 *cx = id->cx; | 173 | struct cx18 *cx = id->cx; |
173 | |||
174 | int w = fmt->fmt.pix.width; | 174 | int w = fmt->fmt.pix.width; |
175 | int h = fmt->fmt.pix.height; | 175 | int h = fmt->fmt.pix.height; |
176 | 176 | ||
@@ -202,8 +202,7 @@ static int cx18_s_fmt_vid_cap(struct file *file, void *fh, | |||
202 | struct cx18_open_id *id = fh; | 202 | struct cx18_open_id *id = fh; |
203 | struct cx18 *cx = id->cx; | 203 | struct cx18 *cx = id->cx; |
204 | int ret; | 204 | int ret; |
205 | int w = fmt->fmt.pix.width; | 205 | int w, h; |
206 | int h = fmt->fmt.pix.height; | ||
207 | 206 | ||
208 | ret = v4l2_prio_check(&cx->prio, &id->prio); | 207 | ret = v4l2_prio_check(&cx->prio, &id->prio); |
209 | if (ret) | 208 | if (ret) |
@@ -212,6 +211,8 @@ static int cx18_s_fmt_vid_cap(struct file *file, void *fh, | |||
212 | ret = cx18_try_fmt_vid_cap(file, fh, fmt); | 211 | ret = cx18_try_fmt_vid_cap(file, fh, fmt); |
213 | if (ret) | 212 | if (ret) |
214 | return ret; | 213 | return ret; |
214 | w = fmt->fmt.pix.width; | ||
215 | h = fmt->fmt.pix.height; | ||
215 | 216 | ||
216 | if (cx->params.width == w && cx->params.height == h) | 217 | if (cx->params.width == w && cx->params.height == h) |
217 | return 0; | 218 | return 0; |
@@ -286,9 +287,9 @@ static int cx18_cxc(struct cx18 *cx, unsigned int cmd, void *arg) | |||
286 | 287 | ||
287 | spin_lock_irqsave(&cx18_cards_lock, flags); | 288 | spin_lock_irqsave(&cx18_cards_lock, flags); |
288 | if (cmd == VIDIOC_DBG_G_REGISTER) | 289 | if (cmd == VIDIOC_DBG_G_REGISTER) |
289 | regs->val = read_enc(regs->reg); | 290 | regs->val = cx18_read_enc(cx, regs->reg); |
290 | else | 291 | else |
291 | write_enc(regs->val, regs->reg); | 292 | cx18_write_enc(cx, regs->val, regs->reg); |
292 | spin_unlock_irqrestore(&cx18_cards_lock, flags); | 293 | spin_unlock_irqrestore(&cx18_cards_lock, flags); |
293 | return 0; | 294 | return 0; |
294 | } | 295 | } |
@@ -345,7 +346,7 @@ static int cx18_querycap(struct file *file, void *fh, | |||
345 | 346 | ||
346 | strlcpy(vcap->driver, CX18_DRIVER_NAME, sizeof(vcap->driver)); | 347 | strlcpy(vcap->driver, CX18_DRIVER_NAME, sizeof(vcap->driver)); |
347 | strlcpy(vcap->card, cx->card_name, sizeof(vcap->card)); | 348 | strlcpy(vcap->card, cx->card_name, sizeof(vcap->card)); |
348 | strlcpy(vcap->bus_info, pci_name(cx->dev), sizeof(vcap->bus_info)); | 349 | snprintf(vcap->bus_info, sizeof(vcap->bus_info), "PCI:%s", pci_name(cx->dev)); |
349 | vcap->version = CX18_DRIVER_VERSION; /* version */ | 350 | vcap->version = CX18_DRIVER_VERSION; /* version */ |
350 | vcap->capabilities = cx->v4l2_cap; /* capabilities */ | 351 | vcap->capabilities = cx->v4l2_cap; /* capabilities */ |
351 | return 0; | 352 | return 0; |
@@ -622,6 +623,7 @@ static int cx18_encoder_cmd(struct file *file, void *fh, | |||
622 | { | 623 | { |
623 | struct cx18_open_id *id = fh; | 624 | struct cx18_open_id *id = fh; |
624 | struct cx18 *cx = id->cx; | 625 | struct cx18 *cx = id->cx; |
626 | u32 h; | ||
625 | 627 | ||
626 | switch (enc->cmd) { | 628 | switch (enc->cmd) { |
627 | case V4L2_ENC_CMD_START: | 629 | case V4L2_ENC_CMD_START: |
@@ -643,8 +645,14 @@ static int cx18_encoder_cmd(struct file *file, void *fh, | |||
643 | return -EPERM; | 645 | return -EPERM; |
644 | if (test_and_set_bit(CX18_F_I_ENC_PAUSED, &cx->i_flags)) | 646 | if (test_and_set_bit(CX18_F_I_ENC_PAUSED, &cx->i_flags)) |
645 | return 0; | 647 | return 0; |
648 | h = cx18_find_handle(cx); | ||
649 | if (h == CX18_INVALID_TASK_HANDLE) { | ||
650 | CX18_ERR("Can't find valid task handle for " | ||
651 | "V4L2_ENC_CMD_PAUSE\n"); | ||
652 | return -EBADFD; | ||
653 | } | ||
646 | cx18_mute(cx); | 654 | cx18_mute(cx); |
647 | cx18_vapi(cx, CX18_CPU_CAPTURE_PAUSE, 1, cx18_find_handle(cx)); | 655 | cx18_vapi(cx, CX18_CPU_CAPTURE_PAUSE, 1, h); |
648 | break; | 656 | break; |
649 | 657 | ||
650 | case V4L2_ENC_CMD_RESUME: | 658 | case V4L2_ENC_CMD_RESUME: |
@@ -654,7 +662,13 @@ static int cx18_encoder_cmd(struct file *file, void *fh, | |||
654 | return -EPERM; | 662 | return -EPERM; |
655 | if (!test_and_clear_bit(CX18_F_I_ENC_PAUSED, &cx->i_flags)) | 663 | if (!test_and_clear_bit(CX18_F_I_ENC_PAUSED, &cx->i_flags)) |
656 | return 0; | 664 | return 0; |
657 | cx18_vapi(cx, CX18_CPU_CAPTURE_RESUME, 1, cx18_find_handle(cx)); | 665 | h = cx18_find_handle(cx); |
666 | if (h == CX18_INVALID_TASK_HANDLE) { | ||
667 | CX18_ERR("Can't find valid task handle for " | ||
668 | "V4L2_ENC_CMD_RESUME\n"); | ||
669 | return -EBADFD; | ||
670 | } | ||
671 | cx18_vapi(cx, CX18_CPU_CAPTURE_RESUME, 1, h); | ||
658 | cx18_unmute(cx); | 672 | cx18_unmute(cx); |
659 | break; | 673 | break; |
660 | 674 | ||
@@ -731,12 +745,14 @@ static int cx18_log_status(struct file *file, void *fh) | |||
731 | continue; | 745 | continue; |
732 | CX18_INFO("Stream %s: status 0x%04lx, %d%% of %d KiB (%d buffers) in use\n", | 746 | CX18_INFO("Stream %s: status 0x%04lx, %d%% of %d KiB (%d buffers) in use\n", |
733 | s->name, s->s_flags, | 747 | s->name, s->s_flags, |
734 | (s->buffers - s->q_free.buffers) * 100 / s->buffers, | 748 | (s->buffers - atomic_read(&s->q_free.buffers)) |
749 | * 100 / s->buffers, | ||
735 | (s->buffers * s->buf_size) / 1024, s->buffers); | 750 | (s->buffers * s->buf_size) / 1024, s->buffers); |
736 | } | 751 | } |
737 | CX18_INFO("Read MPEG/VBI: %lld/%lld bytes\n", | 752 | CX18_INFO("Read MPEG/VBI: %lld/%lld bytes\n", |
738 | (long long)cx->mpg_data_received, | 753 | (long long)cx->mpg_data_received, |
739 | (long long)cx->vbi_data_inserted); | 754 | (long long)cx->vbi_data_inserted); |
755 | cx18_log_statistics(cx); | ||
740 | CX18_INFO("================== END STATUS CARD #%d ==================\n", cx->num); | 756 | CX18_INFO("================== END STATUS CARD #%d ==================\n", cx->num); |
741 | return 0; | 757 | return 0; |
742 | } | 758 | } |