diff options
Diffstat (limited to 'linux/drivers')
27 files changed, 290 insertions, 271 deletions
diff --git a/linux/drivers/media/video/cs53l32a.c b/linux/drivers/media/video/cs53l32a.c index 07644a97d..f0240e079 100644 --- a/linux/drivers/media/video/cs53l32a.c +++ b/linux/drivers/media/video/cs53l32a.c @@ -28,6 +28,7 @@ #include <linux/i2c-id.h> #include <linux/videodev.h> #include <media/v4l2-common.h> +#include <media/v4l2-chip-ident.h> #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) #include "i2c-compat.h" #include <linux/slab.h> @@ -115,6 +116,9 @@ static int cs53l32a_command(struct i2c_client *client, unsigned int cmd, cs53l32a_write(client, 0x05, (u8) ctrl->value); break; + case VIDIOC_G_CHIP_IDENT: + return v4l2_chip_ident_i2c_client(client, arg, V4L2_IDENT_CS53l32A, 0); + case VIDIOC_LOG_STATUS: { u8 v = cs53l32a_read(client, 0x01); diff --git a/linux/drivers/media/video/cx25840/cx25840-core.c b/linux/drivers/media/video/cx25840/cx25840-core.c index d5a0789bc..c401c1ee7 100644 --- a/linux/drivers/media/video/cx25840/cx25840-core.c +++ b/linux/drivers/media/video/cx25840/cx25840-core.c @@ -840,15 +840,7 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd, break; case VIDIOC_G_CHIP_IDENT: - { - struct v4l2_chip_ident *chip = arg; - - if (!v4l2_chip_match_i2c_client(client, chip->match_type, chip->match_chip)) - return -EINVAL; - chip->ident = state->id; - chip->revision = state->rev; - break; - } + return v4l2_chip_ident_i2c_client(client, arg, state->id, state->rev); default: return -EINVAL; diff --git a/linux/drivers/media/video/ivtv/ivtv-cards.c b/linux/drivers/media/video/ivtv/ivtv-cards.c index 2ee7b8701..8eab02083 100644 --- a/linux/drivers/media/video/ivtv/ivtv-cards.c +++ b/linux/drivers/media/video/ivtv/ivtv-cards.c @@ -604,8 +604,8 @@ static const struct ivtv_card ivtv_card_cx23416gyc_nogrycs = { static const struct ivtv_card_pci_info ivtv_pci_gv_mvprx[] = { { PCI_DEVICE_ID_IVTV16, IVTV_PCI_ID_IODATA, 0xd01e }, - { PCI_DEVICE_ID_IVTV16, IVTV_PCI_ID_IODATA, 0xd038 }, //2W#1 - { PCI_DEVICE_ID_IVTV16, IVTV_PCI_ID_IODATA, 0xd039 }, //2W#2 + { PCI_DEVICE_ID_IVTV16, IVTV_PCI_ID_IODATA, 0xd038 }, /* 2W unit #1 */ + { PCI_DEVICE_ID_IVTV16, IVTV_PCI_ID_IODATA, 0xd039 }, /* 2W unit #2 */ { 0, 0, 0 } }; @@ -651,7 +651,7 @@ static const struct ivtv_card ivtv_card_gv_mvprx2e = { .name = "I/O Data GV-MVP/RX2E", .v4l2_capabilities = IVTV_CAP_ENCODER, .hw_video = IVTV_HW_SAA7115, - .hw_audio = IVTV_HW_GPIO, // |IVTV_HW_WM8739, + .hw_audio = IVTV_HW_GPIO, .hw_audio_ctrl = IVTV_HW_WM8739, .hw_all = IVTV_HW_GPIO | IVTV_HW_SAA7115 | IVTV_HW_TUNER | IVTV_HW_TVAUDIO | IVTV_HW_WM8739, diff --git a/linux/drivers/media/video/ivtv/ivtv-controls.c b/linux/drivers/media/video/ivtv/ivtv-controls.c index d0e39ba2b..7a876c3e5 100644 --- a/linux/drivers/media/video/ivtv/ivtv-controls.c +++ b/linux/drivers/media/video/ivtv/ivtv-controls.c @@ -158,12 +158,12 @@ static int ivtv_setup_vbi_fmt(struct ivtv *itv, enum v4l2_mpeg_stream_vbi_fmt fm if (atomic_read(&itv->capturing) > 0) return -EBUSY; - // First try to allocate sliced VBI buffers if needed. + /* First try to allocate sliced VBI buffers if needed. */ if (fmt && itv->vbi.sliced_mpeg_data[0] == NULL) { int i; for (i = 0; i < IVTV_VBI_FRAMES; i++) { - // Yuck, hardcoded. Needs to be a define + /* Yuck, hardcoded. Needs to be a define */ itv->vbi.sliced_mpeg_data[i] = kmalloc(2049, GFP_KERNEL); if (itv->vbi.sliced_mpeg_data[i] == NULL) { while (--i >= 0) { @@ -246,13 +246,7 @@ int ivtv_control_ioctls(struct ivtv *itv, unsigned int cmd, void *arg) fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; fmt.fmt.pix.width = itv->params.width / (is_mpeg1 ? 2 : 1); fmt.fmt.pix.height = itv->params.height; -// if (atomic_read(&itv->capturing) > 0) { -// IVTV_DEBUG_WARN( -// "v4l2 ioctl: set size failed, " -// "capture in progress\n"); -// } else { - itv->video_dec_func(itv, VIDIOC_S_FMT, &fmt); -// } + itv->video_dec_func(itv, VIDIOC_S_FMT, &fmt); } err = cx2341x_update(itv, ivtv_api_func, &itv->params, &p); if (!err && itv->params.stream_vbi_fmt != p.stream_vbi_fmt) { diff --git a/linux/drivers/media/video/ivtv/ivtv-driver.c b/linux/drivers/media/video/ivtv/ivtv-driver.c index 60fdefd02..83102b4f5 100644 --- a/linux/drivers/media/video/ivtv/ivtv-driver.c +++ b/linux/drivers/media/video/ivtv/ivtv-driver.c @@ -119,7 +119,7 @@ static int ivtv_yuv_mode = 0; static int ivtv_yuv_threshold=480; static int ivtv_pci_latency = 1; -int ivtv_debug = IVTV_DBGFLG_WARN; +int ivtv_debug = 0; int newi2c = -1; @@ -336,9 +336,9 @@ static void ivtv_process_eeprom(struct ivtv *itv) /* Many thanks to Steven Toth from Hauppauge for providing the model numbers */ switch (tv.model) { - // In a few cases the PCI subsystem IDs do not correctly - // identify the card. A better method is to check the - // model number from the eeprom instead. + /* In a few cases the PCI subsystem IDs do not correctly + identify the card. A better method is to check the + model number from the eeprom instead. */ case 32000 ... 32999: case 48000 ... 48099: /* 48??? range are PVR250s with a cx23415 */ case 48400 ... 48599: @@ -433,7 +433,7 @@ static void ivtv_process_eeprom(struct ivtv *itv) } if (itv->std != 0) - // user specified tuner standard + /* user specified tuner standard */ return; /* autodetect tuner standard */ @@ -677,6 +677,7 @@ static int __devinit ivtv_init_struct1(struct ivtv *itv) /* OSD */ itv->osd_global_alpha_state = 1; + itv->osd_global_alpha = 255; /* YUV */ atomic_set(&itv->yuv_info.next_dma_frame, -1); @@ -685,8 +686,8 @@ static int __devinit ivtv_init_struct1(struct ivtv *itv) return 0; } -// Second initialization part. Here the card type has been -// autodetected. +/* Second initialization part. Here the card type has been + autodetected. */ static void __devinit ivtv_init_struct2(struct ivtv *itv) { int i; @@ -709,9 +710,9 @@ static void __devinit ivtv_init_struct2(struct ivtv *itv) itv->digitizer = 0x140; if (itv->card->hw_all & IVTV_HW_CX25840) { - itv->vbi.sliced_size = 288; // multiple of 16, real size = 284 + itv->vbi.sliced_size = 288; /* multiple of 16, real size = 284 */ } else { - itv->vbi.sliced_size = 64; // multiple of 16, real size = 52 + itv->vbi.sliced_size = 64; /* multiple of 16, real size = 52 */ } /* Find tuner input */ @@ -1077,8 +1078,8 @@ static int __devinit ivtv_probe(struct pci_dev *dev, #ifdef CONFIG_VIDEO_TVEEPROM_MODULE ivtv_request_module(itv, "tveeprom"); #endif - // Based on the model number the cardtype may be changed. - // The PCI IDs are not always reliable. + /* Based on the model number the cardtype may be changed. + The PCI IDs are not always reliable. */ ivtv_process_eeprom(itv); } @@ -1104,8 +1105,8 @@ static int __devinit ivtv_probe(struct pci_dev *dev, if (itv->options.radio == -1) itv->options.radio = (itv->card->radio_input.audio_type != 0); - // The card is now fully identified, continue with card-specific - // initialization. + /* The card is now fully identified, continue with card-specific + initialization. */ ivtv_init_struct2(itv); ivtv_load_and_init_modules(itv); @@ -1131,14 +1132,14 @@ static int __devinit ivtv_probe(struct pci_dev *dev, /* Setup VBI Raw Size. Should be big enough to hold PAL. It is possible to switch between PAL and NTSC, so we need to take the largest size here. */ - // 1456 is multiple of 16, real size = 1444 + /* 1456 is multiple of 16, real size = 1444 */ itv->vbi.raw_size = 1456; - // We use a buffer size of 1/2 of the total size needed for a - // frame. This is actually very useful, since we now receive - // a field at a time and that makes 'compressing' the raw data - // down to size by stripping off the SAV codes a lot easier. - // Note: having two different buffer sizes prevents standard - // switching on the fly. We need to find a better solution... + /* We use a buffer size of 1/2 of the total size needed for a + frame. This is actually very useful, since we now receive + a field at a time and that makes 'compressing' the raw data + down to size by stripping off the SAV codes a lot easier. + Note: having two different buffer sizes prevents standard + switching on the fly. We need to find a better solution... */ vbi_buf_size = itv->vbi.raw_size * (itv->is_60hz ? 24 : 36) / 2; itv->stream_buf_size[IVTV_ENC_STREAM_TYPE_VBI] = vbi_buf_size; itv->stream_buf_size[IVTV_DEC_STREAM_TYPE_VBI] = sizeof(struct v4l2_sliced_vbi_data) * 36; @@ -1220,7 +1221,7 @@ static int __devinit ivtv_probe(struct pci_dev *dev, /* Let the VIDIOC_S_STD ioctl do all the work, keeps the code in one place. */ - itv->std++; // Force full standard initialization + itv->std++; /* Force full standard initialization */ itv->std_out = itv->std; ivtv_v4l2_ioctls(itv, NULL, VIDIOC_S_STD, &itv->tuner_std); ivtv_v4l2_ioctls(itv, NULL, VIDIOC_S_FREQUENCY, &vf); @@ -1344,7 +1345,7 @@ static int module_start(void) } if (ivtv_debug < 0 || ivtv_debug > 511) { - ivtv_debug = 1; + ivtv_debug = 0; printk(KERN_INFO "ivtv: debug value must be >= 0 and <= 511!\n"); } diff --git a/linux/drivers/media/video/ivtv/ivtv-driver.h b/linux/drivers/media/video/ivtv/ivtv-driver.h index f62e62b79..3daf1a9fc 100644 --- a/linux/drivers/media/video/ivtv/ivtv-driver.h +++ b/linux/drivers/media/video/ivtv/ivtv-driver.h @@ -65,7 +65,7 @@ #include <media/tuner.h> #include <media/cx2341x.h> -//#define HAVE_XC3028 1 +/* #define HAVE_XC3028 1 */ #include <media/ivtv.h> @@ -99,13 +99,13 @@ extern const u32 yuv_offset[4]; -// Maximum ivtv driver instances. -// Based on 6 PVR500s each with two PVR15s... -// TODO: make this dynamic. I believe it is only a global in order to support -// ivtv-fb. There must be a better way to do that. +/* Maximum ivtv driver instances. + Based on 6 PVR500s each with two PVR15s... + TODO: make this dynamic. I believe it is only a global in order to support + ivtv-fb. There must be a better way to do that. */ #define IVTV_MAX_CARDS 12 -// Supported cards +/* Supported cards */ #define IVTV_CARD_PVR_250 0 /* WinTV PVR 250 */ #define IVTV_CARD_PVR_350 1 /* encoder, decoder, tv-out */ #define IVTV_CARD_PVR_150 2 /* WinTV PVR 150 and PVR 500 (really just two @@ -709,7 +709,7 @@ struct ivtv { u32 v4l2_cap; /* V4L2 capabilities of card */ u32 hw_flags; /* Hardware description of the board */ - // controlling Video decoder function + /* controlling Video decoder function */ int (*video_dec_func)(struct ivtv *, unsigned int, void *); struct ivtv_options options; /* User options */ diff --git a/linux/drivers/media/video/ivtv/ivtv-fileops.c b/linux/drivers/media/video/ivtv/ivtv-fileops.c index d7bb76931..90e0f51e6 100644 --- a/linux/drivers/media/video/ivtv/ivtv-fileops.c +++ b/linux/drivers/media/video/ivtv/ivtv-fileops.c @@ -46,9 +46,9 @@ int ivtv_claim_stream(struct ivtv_open_id *id, int type) int vbi_type; if (test_and_set_bit(IVTV_F_S_CLAIMED, &s->s_flags)) { - // someone already claimed this stream + /* someone already claimed this stream */ if (s->id == id->open_id) { - // yes, this file descriptor did. So that's OK. + /* yes, this file descriptor did. So that's OK. */ return 0; } if (s->id == -1 && (type == IVTV_DEC_STREAM_TYPE_VBI || @@ -66,7 +66,7 @@ int ivtv_claim_stream(struct ivtv_open_id *id, int type) } s->id = id->open_id; if (type == IVTV_DEC_STREAM_TYPE_VBI) { - // Enable reinsertion interrupt + /* Enable reinsertion interrupt */ ivtv_clear_irq_mask(itv, IVTV_IRQ_DEC_VBI_RE_INSERT); } @@ -85,11 +85,11 @@ int ivtv_claim_stream(struct ivtv_open_id *id, int type) s_vbi = &itv->streams[vbi_type]; if (!test_and_set_bit(IVTV_F_S_CLAIMED, &s_vbi->s_flags)) { - // Enable reinsertion interrupt + /* Enable reinsertion interrupt */ if (vbi_type == IVTV_DEC_STREAM_TYPE_VBI) ivtv_clear_irq_mask(itv, IVTV_IRQ_DEC_VBI_RE_INSERT); } - // mark that it is used internally + /* mark that it is used internally */ set_bit(IVTV_F_S_INTERNAL_USE, &s_vbi->s_flags); return 0; } @@ -104,7 +104,7 @@ void ivtv_release_stream(struct ivtv_stream *s) s->id = -1; if ((s->type == IVTV_DEC_STREAM_TYPE_VBI || s->type == IVTV_ENC_STREAM_TYPE_VBI) && test_bit(IVTV_F_S_INTERNAL_USE, &s->s_flags)) { - // this stream is still in use internally + /* this stream is still in use internally */ return; } if (!test_and_clear_bit(IVTV_F_S_CLAIMED, &s->s_flags)) { @@ -114,7 +114,7 @@ void ivtv_release_stream(struct ivtv_stream *s) ivtv_flush_queues(s); - // disable reinsertion interrupt + /* disable reinsertion interrupt */ if (s->type == IVTV_DEC_STREAM_TYPE_VBI) ivtv_set_irq_mask(itv, IVTV_IRQ_DEC_VBI_RE_INSERT); @@ -128,16 +128,16 @@ void ivtv_release_stream(struct ivtv_stream *s) else return; - // clear internal use flag + /* clear internal use flag */ if (!test_and_clear_bit(IVTV_F_S_INTERNAL_USE, &s_vbi->s_flags)) { - // was already cleared + /* was already cleared */ return; } if (s_vbi->id != -1) { - // VBI stream still claimed by a file descriptor + /* VBI stream still claimed by a file descriptor */ return; } - // disable reinsertion interrupt + /* disable reinsertion interrupt */ if (s_vbi->type == IVTV_DEC_STREAM_TYPE_VBI) ivtv_set_irq_mask(itv, IVTV_IRQ_DEC_VBI_RE_INSERT); clear_bit(IVTV_F_S_CLAIMED, &s_vbi->s_flags); @@ -776,7 +776,7 @@ int ivtv_v4l2_close(struct inode *inode, struct file *filp) /* Stop radio */ if (id->type == IVTV_ENC_STREAM_TYPE_RAD) { - // Closing radio device, return to TV mode + /* Closing radio device, return to TV mode */ ivtv_mute(itv); /* Mark that the radio is no longer in use */ clear_bit(IVTV_F_I_RADIO_USER, &itv->i_flags); @@ -836,12 +836,12 @@ int ivtv_v4l2_open(struct inode *inode, struct file *filp) if (y == IVTV_DEC_STREAM_TYPE_YUV) { if (read_reg(0x82c) == 0) { IVTV_ERR("Tried to open YUV output device but need to send data to mpeg decoder before it can be used\n"); - // return -ENODEV; + /* return -ENODEV; */ } ivtv_udma_alloc(itv); } - // Allocate memory + /* Allocate memory */ item = kmalloc(sizeof(struct ivtv_open_id), GFP_KERNEL); if (NULL == item) { IVTV_DEBUG_WARN("nomem on v4l2 open\n"); diff --git a/linux/drivers/media/video/ivtv/ivtv-firmware.c b/linux/drivers/media/video/ivtv/ivtv-firmware.c index 544406523..d4c910b78 100644 --- a/linux/drivers/media/video/ivtv/ivtv-firmware.c +++ b/linux/drivers/media/video/ivtv/ivtv-firmware.c @@ -59,10 +59,10 @@ retry: /* temporarily allow 256 KB encoding firmwares as well for compatibility with blackbird cards */ if (fw->size != size && fw->size != 256 * 1024) { - // Due to race conditions in firmware loading (esp. with udev <0.95) - // the wrong file was sometimes loaded. So we check filesizes to - // see if at least the right-sized file was loaded. If not, then we - // retry. + /* Due to race conditions in firmware loading (esp. with udev <0.95) + the wrong file was sometimes loaded. So we check filesizes to + see if at least the right-sized file was loaded. If not, then we + retry. */ IVTV_INFO("retry: file loaded was not %s (expected size %ld, got %zd)\n", fn, size, fw->size); release_firmware(fw); retries--; @@ -78,8 +78,8 @@ retry: IVTV_INFO("loaded %s firmware (%zd bytes)\n", fn, fw->size); return size; } - IVTV_INFO("unable to open firmware %s (must be %ld bytes)\n", fn, size); - IVTV_INFO("did you put the firmware in the hotplug firmware directory?\n"); + IVTV_ERR("unable to open firmware %s (must be %ld bytes)\n", fn, size); + IVTV_ERR("did you put the firmware in the hotplug firmware directory?\n"); return -ENOMEM; } @@ -216,9 +216,9 @@ int ivtv_firmware_init(struct ivtv *itv) /* find mailboxes and ping firmware */ itv->enc_mbox.mbox = ivtv_search_mailbox(itv->enc_mem, IVTV_ENCODER_SIZE); if (itv->enc_mbox.mbox == NULL) - IVTV_DEBUG_WARN("Encoder mailbox not found\n"); + IVTV_ERR("Encoder mailbox not found\n"); else if (ivtv_vapi(itv, CX2341X_ENC_PING_FW, 0)) { - IVTV_DEBUG_WARN("Encoder firmware dead!\n"); + IVTV_ERR("Encoder firmware dead!\n"); itv->enc_mbox.mbox = NULL; } if (itv->enc_mbox.mbox == NULL) @@ -229,9 +229,9 @@ int ivtv_firmware_init(struct ivtv *itv) itv->dec_mbox.mbox = ivtv_search_mailbox(itv->dec_mem, IVTV_DECODER_SIZE); if (itv->dec_mbox.mbox == NULL) - IVTV_DEBUG_WARN("Decoder mailbox not found\n"); + IVTV_ERR("Decoder mailbox not found\n"); else if (itv->has_cx23415 && ivtv_vapi(itv, CX2341X_DEC_PING_FW, 0)) { - IVTV_DEBUG_WARN("Decoder firmware dead!\n"); + IVTV_ERR("Decoder firmware dead!\n"); itv->dec_mbox.mbox = NULL; } return itv->dec_mbox.mbox ? 0 : -ENODEV; @@ -262,7 +262,7 @@ void ivtv_init_mpeg_decoder(struct ivtv *itv) if ((readbytes = load_fw_direct(IVTV_DECODE_INIT_MPEG_FILENAME, mem_offset, itv, IVTV_DECODE_INIT_MPEG_SIZE)) <= 0) { - IVTV_INFO("failed to read mpeg decoder initialisation file %s\n", + IVTV_DEBUG_WARN("failed to read mpeg decoder initialisation file %s\n", IVTV_DECODE_INIT_MPEG_FILENAME); } else { ivtv_vapi(itv, CX2341X_DEC_SCHED_DMA_FROM_HOST, 3, 0, readbytes, 0); diff --git a/linux/drivers/media/video/ivtv/ivtv-gpio.c b/linux/drivers/media/video/ivtv/ivtv-gpio.c index 598e76575..bc8f8ca29 100644 --- a/linux/drivers/media/video/ivtv/ivtv-gpio.c +++ b/linux/drivers/media/video/ivtv/ivtv-gpio.c @@ -114,7 +114,7 @@ void ivtv_reset_ir_gpio(struct ivtv *itv) write_reg(curdir, IVTV_REG_GPIO_DIR); curout = (curout & ~0xF) | 1; write_reg(curout, IVTV_REG_GPIO_OUT); - // We could use something else for smaller time + /* We could use something else for smaller time */ current->state = TASK_INTERRUPTIBLE; schedule_timeout(1); curout |= 2; @@ -287,7 +287,7 @@ int ivtv_gpio(struct ivtv *itv, unsigned int command, void *arg) return 0; case VIDIOC_INT_S_VIDEO_ROUTING: - if (route->input > 2) // 0:Tuner 1:Composite 2:S-Video + if (route->input > 2) /* 0:Tuner 1:Composite 2:S-Video */ return -EINVAL; mask = itv->card->gpio_video_input.mask; if (route->input == 0) diff --git a/linux/drivers/media/video/ivtv/ivtv-i2c.c b/linux/drivers/media/video/ivtv/ivtv-i2c.c index 146a30979..464ee5bae 100644 --- a/linux/drivers/media/video/ivtv/ivtv-i2c.c +++ b/linux/drivers/media/video/ivtv/ivtv-i2c.c @@ -570,7 +570,8 @@ int ivtv_call_i2c_client(struct ivtv *itv, int addr, unsigned int cmd, void *arg return retval; } } - IVTV_ERR("i2c addr 0x%02x not found for command 0x%x!\n", addr, cmd); + if (cmd != VIDIOC_G_CHIP_IDENT) + IVTV_ERR("i2c addr 0x%02x not found for command 0x%x!\n", addr, cmd); return -ENODEV; } @@ -655,7 +656,8 @@ int ivtv_i2c_id(struct ivtv *itv, u32 id, unsigned int cmd, void *arg) addr = ivtv_i2c_id_addr(itv, id); if (addr < 0) { - IVTV_ERR("i2c ID 0x%08x (%s) not found for command 0x%x!\n", + if (cmd != VIDIOC_G_CHIP_IDENT) + IVTV_ERR("i2c ID 0x%08x (%s) not found for command 0x%x!\n", id, ivtv_i2c_id_name(id), cmd); return addr; } diff --git a/linux/drivers/media/video/ivtv/ivtv-ioctl.c b/linux/drivers/media/video/ivtv/ivtv-ioctl.c index a5560abd3..f8107e337 100644 --- a/linux/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/linux/drivers/media/video/ivtv/ivtv-ioctl.c @@ -554,7 +554,7 @@ static int ivtv_try_or_set_fmt(struct ivtv *itv, int streamtype, return 0; } - // set window size + /* set window size */ if (fmt->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { int w = fmt->fmt.pix.width; int h = fmt->fmt.pix.height; @@ -588,7 +588,7 @@ static int ivtv_try_or_set_fmt(struct ivtv *itv, int streamtype, return ivtv_get_fmt(itv, streamtype, fmt); } - // set raw VBI format + /* set raw VBI format */ if (fmt->type == V4L2_BUF_TYPE_VBI_CAPTURE) { if (set_fmt && streamtype == IVTV_ENC_STREAM_TYPE_VBI && itv->vbi.sliced_in->service_set && @@ -602,22 +602,22 @@ static int ivtv_try_or_set_fmt(struct ivtv *itv, int streamtype, return ivtv_get_fmt(itv, streamtype, fmt); } - // set sliced VBI output - // In principle the user could request that only certain - // VBI types are output and that the others are ignored. - // I.e., suppress CC in the even fields or only output - // WSS and no VPS. Currently though there is no choice. + /* set sliced VBI output + In principle the user could request that only certain + VBI types are output and that the others are ignored. + I.e., suppress CC in the even fields or only output + WSS and no VPS. Currently though there is no choice. */ if (fmt->type == V4L2_BUF_TYPE_SLICED_VBI_OUTPUT) return ivtv_get_fmt(itv, streamtype, fmt); - // any else but sliced VBI capture is an error + /* any else but sliced VBI capture is an error */ if (fmt->type != V4L2_BUF_TYPE_SLICED_VBI_CAPTURE) return -EINVAL; if (streamtype == IVTV_DEC_STREAM_TYPE_VBI) return ivtv_get_fmt(itv, streamtype, fmt); - // set sliced VBI capture format + /* set sliced VBI capture format */ vbifmt->io_size = sizeof(struct v4l2_sliced_vbi_data) * 36; memset(vbifmt->reserved, 0, sizeof(vbifmt->reserved)); @@ -662,18 +662,26 @@ static int ivtv_internal_ioctls(struct file *filp, unsigned int cmd, void *arg) return ivtv_i2c_id(itv, reg->match_chip, cmd, arg); return ivtv_call_i2c_client(itv, reg->match_chip, cmd, arg); - case VIDIOC_G_CHIP_IDENT: + case VIDIOC_G_CHIP_IDENT: { + struct v4l2_chip_ident *chip = arg; + IVTV_DEBUG_IOCTL("VIDIOC_G_CHIP_IDENT\n"); - if (v4l2_chip_match_host(reg->match_type, reg->match_chip)) { - struct v4l2_chip_ident *chip = arg; + chip->ident = V4L2_IDENT_NONE; + chip->revision = 0; + if (reg->match_type == V4L2_CHIP_MATCH_HOST) { + if (v4l2_chip_match_host(reg->match_type, reg->match_chip)) { + struct v4l2_chip_ident *chip = arg; - chip->ident = itv->has_cx23415 ? V4L2_IDENT_CX23415 : V4L2_IDENT_CX23416; - chip->revision = 0; + chip->ident = itv->has_cx23415 ? V4L2_IDENT_CX23415 : V4L2_IDENT_CX23416; + } return 0; } if (reg->match_type == V4L2_CHIP_MATCH_I2C_DRIVER) return ivtv_i2c_id(itv, reg->match_chip, cmd, arg); - return ivtv_call_i2c_client(itv, reg->match_chip, cmd, arg); + if (reg->match_type == V4L2_CHIP_MATCH_I2C_ADDR) + return ivtv_call_i2c_client(itv, reg->match_chip, cmd, arg); + return -EINVAL; + } case VIDIOC_INT_S_AUDIO_ROUTING: { struct v4l2_routing *route = arg; @@ -689,7 +697,6 @@ static int ivtv_internal_ioctls(struct file *filp, unsigned int cmd, void *arg) break; default: - IVTV_DEBUG_IOCTL( "Unknown internal IVTV command %08x\n", cmd); return -EINVAL; } return 0; @@ -1160,7 +1167,6 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void } default: - IVTV_DEBUG_WARN("unknown VIDIOC command %08x\n", cmd); return -EINVAL; } return 0; @@ -1433,7 +1439,6 @@ static int ivtv_ivtv_ioctls(struct file *filp, unsigned int cmd, void *arg) } default: - IVTV_DEBUG_WARN("unknown IVTV command %08x\n", cmd); return -EINVAL; } return 0; diff --git a/linux/drivers/media/video/ivtv/ivtv-irq.c b/linux/drivers/media/video/ivtv/ivtv-irq.c index 21bb88a2f..da00d7c9a 100644 --- a/linux/drivers/media/video/ivtv/ivtv-irq.c +++ b/linux/drivers/media/video/ivtv/ivtv-irq.c @@ -487,7 +487,7 @@ static void ivtv_irq_dma_err(struct ivtv *itv) itv->cur_dma_stream >= 0 && itv->cur_dma_stream < IVTV_MAX_STREAMS) { struct ivtv_stream *s = &itv->streams[itv->cur_dma_stream]; - // retry + /* retry */ write_reg(read_reg(IVTV_REG_DMASTATUS) & 3, IVTV_REG_DMASTATUS); if (s->type >= IVTV_DEC_STREAM_TYPE_MPG) ivtv_dma_dec_start(s); @@ -772,7 +772,7 @@ irqreturn_t ivtv_irq_handler(int irq, void *dev_id) if (combo & IVTV_IRQ_ENC_VIM_RST) { IVTV_DEBUG_IRQ("VIM RST\n"); - //ivtv_vapi(itv, CX2341X_ENC_REFRESH_INPUT, 0); + /*ivtv_vapi(itv, CX2341X_ENC_REFRESH_INPUT, 0); */ } if (combo & IVTV_IRQ_DEC_AUD_MODE_CHG) { diff --git a/linux/drivers/media/video/ivtv/ivtv-mailbox.c b/linux/drivers/media/video/ivtv/ivtv-mailbox.c index 131a5a404..6ae42a3b0 100644 --- a/linux/drivers/media/video/ivtv/ivtv-mailbox.c +++ b/linux/drivers/media/video/ivtv/ivtv-mailbox.c @@ -90,7 +90,7 @@ static const struct ivtv_api_info api_info[256] = { API_ENTRY(CX2341X_ENC_MUTE_AUDIO, API_RESULT), API_ENTRY(CX2341X_ENC_SET_VERT_CROP_LINE, API_FAST_RESULT), API_ENTRY(CX2341X_ENC_MISC, API_FAST_RESULT), - // Obsolete PULLDOWN API command + /* Obsolete PULLDOWN API command */ API_ENTRY(0xb1, API_CACHE), /* MPEG decoder API */ diff --git a/linux/drivers/media/video/ivtv/ivtv-streams.c b/linux/drivers/media/video/ivtv/ivtv-streams.c index c5704ff1f..73a1c933d 100644 --- a/linux/drivers/media/video/ivtv/ivtv-streams.c +++ b/linux/drivers/media/video/ivtv/ivtv-streams.c @@ -315,7 +315,7 @@ static void ivtv_vbi_setup(struct ivtv *itv) int i; /* If Embed then streamtype must be Program */ - // TODO: should we really do this? + /* TODO: should we really do this? */ if (0 && !raw && itv->vbi.insert_mpeg) { itv->params.stream_type = 0; @@ -336,14 +336,14 @@ static void ivtv_vbi_setup(struct ivtv *itv) itv->vbi.start[1] = 318; } - // setup VBI registers + /* setup VBI registers */ itv->video_dec_func(itv, VIDIOC_S_FMT, &itv->vbi.in); - // determine number of lines and total number of VBI bytes. - // A raw line takes 1443 bytes: 2 * 720 + 4 byte frame header - 1 - // The '- 1' byte is probably an unused U or V byte. Or something... - // A sliced line takes 51 bytes: 4 byte frame header, 4 byte internal - // header, 42 data bytes + checksum (to be confirmed) + /* determine number of lines and total number of VBI bytes. + A raw line takes 1443 bytes: 2 * 720 + 4 byte frame header - 1 + The '- 1' byte is probably an unused U or V byte. Or something... + A sliced line takes 51 bytes: 4 byte frame header, 4 byte internal + header, 42 data bytes + checksum (to be confirmed) */ if (raw) { lines = itv->vbi.count * 2; } else { @@ -354,21 +354,21 @@ static void ivtv_vbi_setup(struct ivtv *itv) itv->vbi.enc_size = lines * (raw ? itv->vbi.raw_size : itv->vbi.sliced_size); - // Note: sliced vs raw flag doesn't seem to have any effect - // TODO: check mode (0x02) value with older ivtv versions. + /* Note: sliced vs raw flag doesn't seem to have any effect + TODO: check mode (0x02) value with older ivtv versions. */ data[0] = raw | 0x02 | (0xbd << 8); - // Every X number of frames a VBI interrupt arrives (frames as in 25 or 30 fps) + /* Every X number of frames a VBI interrupt arrives (frames as in 25 or 30 fps) */ data[1] = 1; - // The VBI frames are stored in a ringbuffer with this size (with a VBI frame as unit) + /* The VBI frames are stored in a ringbuffer with this size (with a VBI frame as unit) */ data[2] = raw ? 4 : 8; - // The start/stop codes determine which VBI lines end up in the raw VBI data area. - // The codes are from table 24 in the saa7115 datasheet. Each raw/sliced/video line - // is framed with codes FF0000XX where XX is the SAV/EAV (Start/End of Active Video) - // code. These values for raw VBI are obtained from a driver disassembly. The sliced - // start/stop codes was deduced from this, but they do not appear in the driver. - // Other code pairs that I found are: 0x250E6249/0x13545454 and 0x25256262/0x38137F54. - // However, I have no idea what these values are for. + /* The start/stop codes determine which VBI lines end up in the raw VBI data area. + The codes are from table 24 in the saa7115 datasheet. Each raw/sliced/video line + is framed with codes FF0000XX where XX is the SAV/EAV (Start/End of Active Video) + code. These values for raw VBI are obtained from a driver disassembly. The sliced + start/stop codes was deduced from this, but they do not appear in the driver. + Other code pairs that I found are: 0x250E6249/0x13545454 and 0x25256262/0x38137F54. + However, I have no idea what these values are for. */ if (itv->hw_flags & IVTV_HW_CX25840) { /* Setup VBI for the cx25840 digitizer */ if (raw) { @@ -378,9 +378,9 @@ static void ivtv_vbi_setup(struct ivtv *itv) data[3] = 0xB0F0B0F0; data[4] = 0xA0E0A0E0; } - // Lines per frame + /* Lines per frame */ data[5] = lines; - // bytes per line + /* bytes per line */ data[6] = (raw ? itv->vbi.raw_size : itv->vbi.sliced_size); } else { /* Setup VBI for the saa7115 digitizer */ @@ -391,9 +391,9 @@ static void ivtv_vbi_setup(struct ivtv *itv) data[3] = 0xABABECEC; data[4] = 0xB6F1F1F1; } - // Lines per frame + /* Lines per frame */ data[5] = lines; - // bytes per line + /* bytes per line */ data[6] = itv->vbi.enc_size / lines; } @@ -403,7 +403,7 @@ static void ivtv_vbi_setup(struct ivtv *itv) ivtv_api(itv, CX2341X_ENC_SET_VBI_CONFIG, 7, data); - // returns the VBI encoder memory area. + /* returns the VBI encoder memory area. */ itv->vbi.enc_start = data[2]; itv->vbi.fpi = data[0]; if (!itv->vbi.fpi) @@ -412,8 +412,8 @@ static void ivtv_vbi_setup(struct ivtv *itv) IVTV_DEBUG_INFO("Setup VBI start 0x%08x frames %d fpi %d lines 0x%08x\n", itv->vbi.enc_start, data[1], itv->vbi.fpi, itv->digitizer); - // select VBI lines. - // Note that the sliced argument seems to have no effect. + /* select VBI lines. + Note that the sliced argument seems to have no effect. */ for (i = 2; i <= 24; i++) { int valid; @@ -428,12 +428,12 @@ static void ivtv_vbi_setup(struct ivtv *itv) valid, 0, 0, 0); } - // Remaining VBI questions: - // - Is it possible to select particular VBI lines only for inclusion in the MPEG - // stream? Currently you can only get the first X lines. - // - Is mixed raw and sliced VBI possible? - // - What's the meaning of the raw/sliced flag? - // - What's the meaning of params 2, 3 & 4 of the Select VBI command? + /* Remaining VBI questions: + - Is it possible to select particular VBI lines only for inclusion in the MPEG + stream? Currently you can only get the first X lines. + - Is mixed raw and sliced VBI possible? + - What's the meaning of the raw/sliced flag? + - What's the meaning of params 2, 3 & 4 of the Select VBI command? */ } int ivtv_start_v4l2_encode_stream(struct ivtv_stream *s) @@ -504,7 +504,7 @@ int ivtv_start_v4l2_encode_stream(struct ivtv_stream *s) but occasionally. Many thanks go to Leonard Orb who spent a lot of effort and time trying to trace the cause of the drop outs. */ /* 1 frame per DMA */ - //ivtv_vapi(itv, CX2341X_ENC_SET_DMA_BLOCK_SIZE, 2, 128, 0); + /*ivtv_vapi(itv, CX2341X_ENC_SET_DMA_BLOCK_SIZE, 2, 128, 0); */ ivtv_vapi(itv, CX2341X_ENC_SET_DMA_BLOCK_SIZE, 2, 1, 1); /* Stuff from Windows, we don't know what it is */ @@ -646,7 +646,7 @@ int ivtv_start_v4l2_decode_stream(struct ivtv_stream *s, int gop_offset) return -EINVAL; if (test_and_set_bit(IVTV_F_S_STREAMING, &s->s_flags)) - return 0; // already started + return 0; /* already started */ IVTV_DEBUG_INFO("Starting decode stream %s (gop_offset %d)\n", s->name, gop_offset); diff --git a/linux/drivers/media/video/ivtv/ivtv-vbi.c b/linux/drivers/media/video/ivtv/ivtv-vbi.c index 747827b2e..71acc97b1 100644 --- a/linux/drivers/media/video/ivtv/ivtv-vbi.c +++ b/linux/drivers/media/video/ivtv/ivtv-vbi.c @@ -218,7 +218,7 @@ static int ivtv_convert_ivtv_vbi(struct ivtv *itv, u8 *p) ssize_t ivtv_write_vbi(struct ivtv *itv, const char __user *ubuf, size_t count) { - // Should be a __user pointer, but sparse doesn't parse this bit correctly. + /* Should be a __user pointer, but sparse doesn't parse this bit correctly. */ const struct v4l2_sliced_vbi_data *p = (const struct v4l2_sliced_vbi_data *)ubuf; u8 cc[4] = { 0x80, 0x80, 0x80, 0x80 }; int found_cc = 0; @@ -262,7 +262,7 @@ ssize_t ivtv_write_vbi(struct ivtv *itv, const char __user *ubuf, size_t count) case V4L2_SLICED_WSS_625: if (p->line == 23 && p->field == 0 && (itv->vbi.service_set_out & V4L2_SLICED_WSS_625)) { - // No lock needed for WSS + /* No lock needed for WSS */ itv->vbi.wss = p->data[0] | (p->data[1] << 8); itv->vbi.wss_found = 1; set_bit(IVTV_F_I_UPDATE_WSS, &itv->i_flags); @@ -288,9 +288,9 @@ ssize_t ivtv_write_vbi(struct ivtv *itv, const char __user *ubuf, size_t count) return (const char __user *)p - ubuf; } -// Compress raw VBI format, removes leading SAV codes and surplus space after the -// field. -// Returns new compressed size. +/* Compress raw VBI format, removes leading SAV codes and surplus space after the + field. + Returns new compressed size. */ static u32 compress_raw_buf(struct ivtv *itv, u8 *buf, u32 size) { u32 line_size = itv->vbi.raw_decoder_line_size; @@ -304,7 +304,7 @@ static u32 compress_raw_buf(struct ivtv *itv, u8 *buf, u32 size) for (i = 0; i < lines; i++) { p = buf + i * line_size; - // Look for SAV code + /* Look for SAV code */ if (p[0] != 0xff || p[1] || p[2] || (p[3] != sav1 && p[3] != sav2)) { break; } @@ -315,15 +315,15 @@ static u32 compress_raw_buf(struct ivtv *itv, u8 *buf, u32 size) } -// Compressed VBI format, all found sliced blocks put next to one another -// Returns new compressed size +/* Compressed VBI format, all found sliced blocks put next to one another + Returns new compressed size */ static u32 compress_sliced_buf(struct ivtv *itv, u32 line, u8 *buf, u32 size, u8 sav) { u32 line_size = itv->vbi.sliced_decoder_line_size; struct v4l2_decode_vbi_line vbi; int i; - // find the first valid line + /* find the first valid line */ for (i = 0; i < size; i++, buf++) { if (buf[0] == 0xff && !buf[1] && !buf[2] && buf[3] == sav) break; @@ -336,7 +336,7 @@ static u32 compress_sliced_buf(struct ivtv *itv, u32 line, u8 *buf, u32 size, u8 for (i = 0; i < size / line_size; i++) { u8 *p = buf + i * line_size; - // Look for SAV code + /* Look for SAV code */ if (p[0] != 0xff || p[1] || p[2] || p[3] != sav) { continue; } @@ -360,7 +360,7 @@ void ivtv_process_vbi_data(struct ivtv *itv, struct ivtv_buffer *buf, u32 size = buf->bytesused; int y; - // Raw VBI data + /* Raw VBI data */ if (streamtype == IVTV_ENC_STREAM_TYPE_VBI && itv->vbi.sliced_in->service_set == 0) { u8 type; @@ -370,7 +370,7 @@ void ivtv_process_vbi_data(struct ivtv *itv, struct ivtv_buffer *buf, size = buf->bytesused = compress_raw_buf(itv, p, size); - // second field of the frame? + /* second field of the frame? */ if (type == itv->vbi.raw_decoder_sav_even_field) { /* Dirty hack needed for backwards compatibility of old VBI software. */ @@ -381,21 +381,21 @@ void ivtv_process_vbi_data(struct ivtv *itv, struct ivtv_buffer *buf, return; } - // Sliced VBI data with data insertion + /* Sliced VBI data with data insertion */ if (streamtype == IVTV_ENC_STREAM_TYPE_VBI) { int lines; ivtv_buf_swap(buf); - // first field + /* first field */ lines = compress_sliced_buf(itv, 0, p, size / 2, itv->vbi.sliced_decoder_sav_odd_field); - // second field - // experimentation shows that the second half does not always begin - // at the exact address. So start a bit earlier (hence 32). + /* second field */ + /* experimentation shows that the second half does not always begin + at the exact address. So start a bit earlier (hence 32). */ lines = compress_sliced_buf(itv, lines, p + size / 2 - 32, size / 2 + 32, itv->vbi.sliced_decoder_sav_even_field); - // always return at least one empty line + /* always return at least one empty line */ if (lines == 0) { itv->vbi.sliced_data[0].id = 0; itv->vbi.sliced_data[0].line = 0; @@ -412,7 +412,7 @@ void ivtv_process_vbi_data(struct ivtv *itv, struct ivtv_buffer *buf, return; } - // Sliced VBI re-inserted from an MPEG stream + /* Sliced VBI re-inserted from an MPEG stream */ if (streamtype == IVTV_DEC_STREAM_TYPE_VBI) { /* If the size is not 4-byte aligned, then the starting address for the swapping is also shifted. After swapping the data the diff --git a/linux/drivers/media/video/ivtv/ivtv-yuv.c b/linux/drivers/media/video/ivtv/ivtv-yuv.c index caf7e27a1..04d93a753 100644 --- a/linux/drivers/media/video/ivtv/ivtv-yuv.c +++ b/linux/drivers/media/video/ivtv/ivtv-yuv.c @@ -124,7 +124,7 @@ static void ivtv_yuv_filter(struct ivtv *itv, int h_filter, int v_filter_1, int { int filter_index, filter_line; - // If any filter is -1, then don't update it + /* If any filter is -1, then don't update it */ if (h_filter > -1) { if (h_filter > 4) h_filter = 4; filter_index = h_filter * 384; @@ -196,25 +196,25 @@ static void ivtv_yuv_handle_horizontal(struct ivtv *itv, struct yuv_frame_info * IVTV_DEBUG_WARN( "Need to adjust to width %d src_w %d dst_w %d src_x %d dst_x %d\n", window->tru_w, window->src_w, window->dst_w,window->src_x, window->dst_x); - // How wide is the src image + /* How wide is the src image */ x_cutoff = window->src_w + window->src_x; - // Set the display width + /* Set the display width */ reg_2834 = window->dst_w; reg_2838 = reg_2834; - // Set the display position + /* Set the display position */ reg_2890 = window->dst_x; - // Index into the image horizontally + /* Index into the image horizontally */ reg_2870 = 0; - // 2870 is normally fudged to align video coords with osd coords. - // If running full screen, it causes an unwanted left shift - // Remove the fudge if we almost fill the screen. - // Gradually adjust the offset to avoid the video 'snapping' - // left/right if it gets dragged through this region. - // Only do this if osd is full width. + /* 2870 is normally fudged to align video coords with osd coords. + If running full screen, it causes an unwanted left shift + Remove the fudge if we almost fill the screen. + Gradually adjust the offset to avoid the video 'snapping' + left/right if it gets dragged through this region. + Only do this if osd is full width. */ if (window->vis_w == 720) { if ((window->tru_x - window->pan_x > -1) && (window->tru_x - window->pan_x <= 40) && (window->dst_w >= 680)){ reg_2870 = 10 - (window->tru_x - window->pan_x) / 4; @@ -234,7 +234,7 @@ static void ivtv_yuv_handle_horizontal(struct ivtv *itv, struct yuv_frame_info * else reg_2870 = 0x0012000e - reg_2870; - // We're also using 2870 to shift the image left (src_x & negative dst_x) + /* We're also using 2870 to shift the image left (src_x & negative dst_x) */ reg_2870_offset = (window->src_x*((window->dst_w << 21)/window->src_w))>>19; if (window->dst_w >= window->src_w) { @@ -249,8 +249,8 @@ static void ivtv_yuv_handle_horizontal(struct ivtv *itv, struct yuv_frame_info * reg_285c = master_width >> 1; reg_2864 = master_width >> 1; - // We also need to factor in the scaling - // (src_w - dst_w) / (src_w / 4) + /* We also need to factor in the scaling + (src_w - dst_w) / (src_w / 4) */ if (window->dst_w > window->src_w) reg_2870_base = ((window->dst_w - window->src_w)<<16) / (window->src_w <<14); else @@ -288,16 +288,16 @@ static void ivtv_yuv_handle_horizontal(struct ivtv *itv, struct yuv_frame_info * reg_2874 = 0x00000001; } - // Select the horizontal filter + /* Select the horizontal filter */ if (window->src_w == window->dst_w) { - // An exact size match uses filter 0 + /* An exact size match uses filter 0 */ h_filter = 0; } else { - // Figure out which filter to use + /* Figure out which filter to use */ h_filter = ((window->src_w << 16) / window->dst_w) >> 15; h_filter = (h_filter >> 1) + (h_filter & 1); - // Only an exact size match can use filter 0 + /* Only an exact size match can use filter 0 */ if (h_filter == 0) h_filter = 1; } @@ -330,7 +330,7 @@ static void ivtv_yuv_handle_horizontal(struct ivtv *itv, struct yuv_frame_info * write_reg( reg_2890,0x02890); IVTV_DEBUG_YUV("Update reg 0x2890 %08x->%08x\n",itv->yuv_info.reg_2890, reg_2890); - // Only update the filter if we really need to + /* Only update the filter if we really need to */ if (h_filter != itv->yuv_info.h_filter) { ivtv_yuv_filter (itv,h_filter,-1,-1); itv->yuv_info.h_filter = h_filter; @@ -354,7 +354,7 @@ static void ivtv_yuv_handle_vertical(struct ivtv *itv, struct yuv_frame_info *wi IVTV_DEBUG_WARN("Need to adjust to height %d src_h %d dst_h %d src_y %d dst_y %d\n", window->tru_h, window->src_h, window->dst_h,window->src_y, window->dst_y); - // What scaling mode is being used... + /* What scaling mode is being used... */ if (window->interlaced_y) { IVTV_DEBUG_YUV("Scaling mode Y: Interlaced\n"); } @@ -369,7 +369,7 @@ static void ivtv_yuv_handle_vertical(struct ivtv *itv, struct yuv_frame_info *wi IVTV_DEBUG_YUV("Scaling mode UV: Progressive\n"); } - // What is the source video being treated as... + /* What is the source video being treated as... */ if (itv->yuv_info.frame_interlaced) { IVTV_DEBUG_WARN("Source video: Interlaced\n"); } @@ -377,8 +377,8 @@ static void ivtv_yuv_handle_vertical(struct ivtv *itv, struct yuv_frame_info *wi IVTV_DEBUG_WARN("Source video: Non-interlaced\n"); } - // We offset into the image using two different index methods, so split - // the y source coord into two parts. + /* We offset into the image using two different index methods, so split + the y source coord into two parts. */ if (window->src_y < 8) { src_y_minor_uv = window->src_y; src_y_major_uv = 0; @@ -465,8 +465,8 @@ static void ivtv_yuv_handle_vertical(struct ivtv *itv, struct yuv_frame_info *wi reg_296c = 0x00000102; } - // FIXME These registers change depending on scaled / unscaled output - // We really need to work out what they should be + /* FIXME These registers change depending on scaled / unscaled output + We really need to work out what they should be */ if (window->src_h == window->dst_h){ reg_2934 = 0x00020000; reg_293c = 0x00100000; @@ -480,7 +480,7 @@ static void ivtv_yuv_handle_vertical(struct ivtv *itv, struct yuv_frame_info *wi reg_294c = 0x00000FF0; } - // The first line to be displayed + /* The first line to be displayed */ reg_2950 = 0x00010000 + src_y_major_y; if (window->interlaced_y) reg_2950 += 0x00010000; reg_2954 = reg_2950 + 1; @@ -499,12 +499,12 @@ static void ivtv_yuv_handle_vertical(struct ivtv *itv, struct yuv_frame_info *wi else reg_289c = (reg_289c + ((window->dst_y & ~1)<<15))+(window->dst_y >>1); - // How much of the source to decode. - // Take into account the source offset + /* How much of the source to decode. + Take into account the source offset */ reg_2960 = ((src_y_minor_y + window->src_h + src_y_major_y) - 1 ) | ((((src_y_minor_uv + window->src_h + src_y_major_uv) - 1) & ~1) << 15); - // Calculate correct value for register 2964 + /* Calculate correct value for register 2964 */ if (window->src_h == window->dst_h) reg_2964 = 1; else { @@ -514,15 +514,15 @@ static void ivtv_yuv_handle_vertical(struct ivtv *itv, struct yuv_frame_info *wi reg_2968 = (reg_2964 << 16) + reg_2964 + (reg_2964 >> 1); reg_2964 = (reg_2964 << 16) + reg_2964 + (reg_2964 * 46 / 94); - // Okay, we've wasted time working out the correct value, - // but if we use it, it fouls the the window alignment. - // Fudge it to what we want... + /* Okay, we've wasted time working out the correct value, + but if we use it, it fouls the the window alignment. + Fudge it to what we want... */ reg_2964 = 0x00010001 + ((reg_2964 & 0x0000FFFF) - (reg_2964 >> 16)); reg_2968 = 0x00010001 + ((reg_2968 & 0x0000FFFF) - (reg_2968 >> 16)); - // Deviate further from what it should be. I find the flicker headache - // inducing so try to reduce it slightly. Leave 2968 as-is otherwise - // colours foul. + /* Deviate further from what it should be. I find the flicker headache + inducing so try to reduce it slightly. Leave 2968 as-is otherwise + colours foul. */ if ((reg_2964 != 0x00010001) && (window->dst_h / 2 <= window->src_h)) reg_2964 = (reg_2964 & 0xFFFF0000) + ((reg_2964 & 0x0000FFFF)/2); @@ -532,17 +532,17 @@ static void ivtv_yuv_handle_vertical(struct ivtv *itv, struct yuv_frame_info *wi reg_2964 += ((reg_2964_base << 16) | reg_2964_base); reg_2968 += ((reg_2968_base << 16) | reg_2968_base); - // Select the vertical filter + /* Select the vertical filter */ if (window->src_h == window->dst_h) { - // An exact size match uses filter 0/1 + /* An exact size match uses filter 0/1 */ v_filter_1 = 0; v_filter_2 = 1; } else { - // Figure out which filter to use + /* Figure out which filter to use */ v_filter_1 = ((window->src_h << 16) / window->dst_h) >> 15; v_filter_1 = (v_filter_1 >> 1) + (v_filter_1 & 1); - // Only an exact size match can use filter 0 + /* Only an exact size match can use filter 0 */ if (v_filter_1 == 0) v_filter_1 = 1; v_filter_2 = v_filter_1; } @@ -554,9 +554,9 @@ static void ivtv_yuv_handle_vertical(struct ivtv *itv, struct yuv_frame_info *wi write_reg(reg_294c, 0x0294c); IVTV_DEBUG_YUV("Update reg 0x2944 %08x->%08x 0x294c %08x->%08x\n",itv->yuv_info.reg_2944, reg_2944, itv->yuv_info.reg_294c, reg_294c); - // Ensure 2970 is 0 (does it ever change ?) -// write_reg(0,0x02970); -// IVTV_DEBUG_YUV("Update reg 0x2970 %08x->%08x\n",itv->yuv_info.reg_2970, 0); + /* Ensure 2970 is 0 (does it ever change ?) */ +/* write_reg(0,0x02970); */ +/* IVTV_DEBUG_YUV("Update reg 0x2970 %08x->%08x\n",itv->yuv_info.reg_2970, 0); */ write_reg(reg_2930, 0x02938); write_reg(reg_2930, 0x02930); @@ -599,13 +599,13 @@ static void ivtv_yuv_handle_vertical(struct ivtv *itv, struct yuv_frame_info *wi write_reg( reg_289c,0x0289c); IVTV_DEBUG_YUV("Update reg 0x289c %08x->%08x\n",itv->yuv_info.reg_289c, reg_289c); - // Only update filter 1 if we really need to + /* Only update filter 1 if we really need to */ if (v_filter_1 != itv->yuv_info.v_filter_1) { ivtv_yuv_filter (itv,-1,v_filter_1,-1); itv->yuv_info.v_filter_1 = v_filter_1; } - // Only update filter 2 if we really need to + /* Only update filter 2 if we really need to */ if (v_filter_2 != itv->yuv_info.v_filter_2) { ivtv_yuv_filter (itv,-1,-1,v_filter_2); itv->yuv_info.v_filter_2 = v_filter_2; @@ -622,9 +622,9 @@ static u32 ivtv_yuv_window_setup (struct ivtv *itv, struct yuv_frame_info *windo u32 osd_scale; u32 yuv_update = 0; - // Work out the lace settings + /* Work out the lace settings */ switch (itv->yuv_info.lace_mode) { - case IVTV_YUV_MODE_PROGRESSIVE: // Progressive mode + case IVTV_YUV_MODE_PROGRESSIVE: /* Progressive mode */ itv->yuv_info.frame_interlaced = 0; if (window->tru_h < 512 || (window->tru_h > 576 && window->tru_h < 1021)) window->interlaced_y = 0; @@ -659,7 +659,7 @@ static u32 ivtv_yuv_window_setup (struct ivtv *itv, struct yuv_frame_info *windo } break; - case IVTV_YUV_MODE_INTERLACED: // Interlace mode + case IVTV_YUV_MODE_INTERLACED: /* Interlace mode */ default: itv->yuv_info.frame_interlaced = 1; window->interlaced_y = 1; @@ -667,11 +667,11 @@ static u32 ivtv_yuv_window_setup (struct ivtv *itv, struct yuv_frame_info *windo break; } - // Sorry, but no negative coords for src + /* Sorry, but no negative coords for src */ if (window->src_x < 0) window->src_x = 0; if (window->src_y < 0) window->src_y = 0; - // Can only reduce width down to 1/4 original size + /* Can only reduce width down to 1/4 original size */ if ((osd_crop = window->src_w - ( 4 * window->dst_w )) > 0) { window->src_x += osd_crop / 2; window->src_w = (window->src_w - osd_crop) & ~3; @@ -679,13 +679,13 @@ static u32 ivtv_yuv_window_setup (struct ivtv *itv, struct yuv_frame_info *windo window->dst_w += window->dst_w & 1; } - // Can only reduce height down to 1/4 original size + /* Can only reduce height down to 1/4 original size */ if (window->src_h / window->dst_h >= 2) { - // Overflow may be because we're running progressive, so force mode switch + /* Overflow may be because we're running progressive, so force mode switch */ window->interlaced_y = 1; - // Make sure we're still within limits for interlace + /* Make sure we're still within limits for interlace */ if ((osd_crop = window->src_h - ( 4 * window->dst_h )) > 0) { - // If we reach here we'll have to force the height. + /* If we reach here we'll have to force the height. */ window->src_y += osd_crop / 2; window->src_h = (window->src_h - osd_crop) & ~3; window->dst_h = window->src_h / 4; @@ -693,16 +693,16 @@ static u32 ivtv_yuv_window_setup (struct ivtv *itv, struct yuv_frame_info *windo } } - // If there's nothing to safe to display, we may as well stop now + /* If there's nothing to safe to display, we may as well stop now */ if ((int)window->dst_w <= 2 || (int)window->dst_h <= 2 || (int)window->src_w <= 2 || (int)window->src_h <= 2) { return 0; } - // Ensure video remains inside OSD area + /* Ensure video remains inside OSD area */ osd_scale = (window->src_h << 16) / window->dst_h; if ((osd_crop = window->pan_y - window->dst_y) > 0) { - // Falls off the upper edge - crop + /* Falls off the upper edge - crop */ window->src_y += (osd_scale * osd_crop) >> 16; window->src_h -= (osd_scale * osd_crop) >> 16; window->dst_h -= osd_crop; @@ -713,7 +713,7 @@ static u32 ivtv_yuv_window_setup (struct ivtv *itv, struct yuv_frame_info *windo } if ((osd_crop = window->dst_h + window->dst_y - window->vis_h) > 0) { - // Falls off the lower edge - crop + /* Falls off the lower edge - crop */ window->dst_h -= osd_crop; window->src_h -= (osd_scale * osd_crop) >> 16; } @@ -721,7 +721,7 @@ static u32 ivtv_yuv_window_setup (struct ivtv *itv, struct yuv_frame_info *windo osd_scale = (window->src_w << 16) / window->dst_w; if ((osd_crop = window->pan_x - window->dst_x) > 0) { - // Fall off the left edge - crop + /* Fall off the left edge - crop */ window->src_x += (osd_scale * osd_crop) >> 16; window->src_w -= (osd_scale * osd_crop) >> 16; window->dst_w -= osd_crop; @@ -732,17 +732,17 @@ static u32 ivtv_yuv_window_setup (struct ivtv *itv, struct yuv_frame_info *windo } if ((osd_crop = window->dst_w + window->dst_x - window->vis_w) > 0) { - // Falls off the right edge - crop + /* Falls off the right edge - crop */ window->dst_w -= osd_crop; window->src_w -= (osd_scale * osd_crop) >> 16; } - // The OSD can be moved. Track to it + /* The OSD can be moved. Track to it */ window->dst_x += itv->yuv_info.osd_x_offset; window->dst_y += itv->yuv_info.osd_y_offset; - // Width & height for both src & dst must be even. - // Same for coordinates. + /* Width & height for both src & dst must be even. + Same for coordinates. */ window->dst_w &= ~1; window->dst_x &= ~1; @@ -761,8 +761,8 @@ static u32 ivtv_yuv_window_setup (struct ivtv *itv, struct yuv_frame_info *windo window->src_h &= ~1; window->dst_h &= ~1; - // Due to rounding, we may have reduced the output size to <1/4 of the source - // Check again, but this time just resize. Don't change source coordinates + /* Due to rounding, we may have reduced the output size to <1/4 of the source + Check again, but this time just resize. Don't change source coordinates */ if (window->dst_w < window->src_w / 4) { window->src_w &= ~3; window->dst_w = window->src_w / 4; @@ -774,12 +774,12 @@ static u32 ivtv_yuv_window_setup (struct ivtv *itv, struct yuv_frame_info *windo window->dst_h += window->dst_h & 1; } - // Check again. If there's nothing to safe to display, stop now + /* Check again. If there's nothing to safe to display, stop now */ if ((int)window->dst_w <= 2 || (int)window->dst_h <= 2 || (int)window->src_w <= 2 || (int)window->src_h <= 2) { return 0; } - // Both x offset & width are linked, so they have to be done together + /* Both x offset & width are linked, so they have to be done together */ if ((itv->yuv_info.old_frame_info.dst_w != window->dst_w) || (itv->yuv_info.old_frame_info.src_w != window->src_w) || (itv->yuv_info.old_frame_info.dst_x != window->dst_x) || @@ -821,7 +821,7 @@ void ivtv_yuv_work_handler (void *arg) int frame = itv->yuv_info.update_frame; -// IVTV_DEBUG_YUV("Update yuv registers for frame %d\n",frame); +/* IVTV_DEBUG_YUV("Update yuv registers for frame %d\n",frame); */ memcpy(&window, &itv->yuv_info.new_frame_info[frame], sizeof (window)); /* Update the osd pan info */ @@ -848,7 +848,7 @@ static void ivtv_yuv_init (struct ivtv *itv) { IVTV_DEBUG_YUV("ivtv_yuv_init\n"); - // Take a snapshot of the current register settings + /* Take a snapshot of the current register settings */ itv->yuv_info.reg_2834 = read_reg(0x02834); itv->yuv_info.reg_2838 = read_reg(0x02838); itv->yuv_info.reg_283c = read_reg(0x0283c); @@ -892,22 +892,22 @@ static void ivtv_yuv_init (struct ivtv *itv) itv->yuv_info.v_filter_2 = -1; itv->yuv_info.h_filter = -1; - // Set some valid size info + /* Set some valid size info */ itv->yuv_info.osd_x_offset = read_reg(0x02a04) & 0x00000FFF; itv->yuv_info.osd_y_offset = (read_reg(0x02a04) >> 16) & 0x00000FFF; - // Bit 2 of reg 2878 indicates current decoder output format - // 0 : NTSC 1 : PAL + /* Bit 2 of reg 2878 indicates current decoder output format + 0 : NTSC 1 : PAL */ if (read_reg(0x2878) & 4) itv->yuv_info.decode_height = 576; else itv->yuv_info.decode_height = 480; - // If no visible size set, assume full size + /* If no visible size set, assume full size */ if (!itv->yuv_info.osd_vis_w) itv->yuv_info.osd_vis_w = 720 - itv->yuv_info.osd_x_offset; if (!itv->yuv_info.osd_vis_h) itv->yuv_info.osd_vis_h = itv->yuv_info.decode_height - itv->yuv_info.osd_y_offset; - // We need a buffer for blanking when Y plane is offset - non-fatal if we can't get one + /* We need a buffer for blanking when Y plane is offset - non-fatal if we can't get one */ itv->yuv_info.blanking_ptr = kzalloc(720*16,GFP_KERNEL); if (itv->yuv_info.blanking_ptr) { itv->yuv_info.blanking_dmaptr = pci_map_single(itv->dev, itv->yuv_info.blanking_ptr, 720*16, PCI_DMA_TODEVICE); @@ -943,7 +943,7 @@ int ivtv_yuv_prep_frame(struct ivtv *itv, struct ivtv_dma_frame *args) last_fill_frame = (atomic_read(&itv->yuv_info.next_dma_frame)+1) & 0x3; if (next_fill_frame != last_fill_frame && last_fill_frame != frame) { - // Buffers are full - Overwrite the last frame */ + /* Buffers are full - Overwrite the last frame */ next_fill_frame = frame; frame = (frame - 1) & 3; } @@ -981,7 +981,7 @@ int ivtv_yuv_prep_frame(struct ivtv *itv, struct ivtv_dma_frame *args) sizeof (itv->yuv_info.new_frame_info[frame]))) { memcpy(&itv->yuv_info.old_frame_info_args, &itv->yuv_info.new_frame_info[frame], sizeof (itv->yuv_info.old_frame_info_args)); itv->yuv_info.new_frame_info[frame].update = 1; -// IVTV_DEBUG_YUV ("Requesting register update for frame %d\n",frame); +/* IVTV_DEBUG_YUV ("Requesting register update for frame %d\n",frame); */ } /* DMA the frame */ @@ -1034,9 +1034,9 @@ void ivtv_yuv_close(struct ivtv *itv) /* Reset registers we have changed so mpeg playback works */ - // If we fully restore this register, the display may remain active. - // Restore, but set one bit to blank the video. Firmware will always - // clear this bit when needed, so not a problem. + /* If we fully restore this register, the display may remain active. + Restore, but set one bit to blank the video. Firmware will always + clear this bit when needed, so not a problem. */ write_reg(itv->yuv_info.reg_2898 | 0x01000000, 0x2898); write_reg(itv->yuv_info.reg_2834, 0x02834); @@ -1077,59 +1077,59 @@ void ivtv_yuv_close(struct ivtv *itv) write_reg(itv->yuv_info.reg_296c, 0x0296c); write_reg(itv->yuv_info.reg_2970, 0x02970); - // Prepare to restore filters + /* Prepare to restore filters */ - // First the horizontal filter + /* First the horizontal filter */ if ((itv->yuv_info.reg_2834 & 0x0000FFFF) == (itv->yuv_info.reg_2834 >> 16)) { - // An exact size match uses filter 0 + /* An exact size match uses filter 0 */ h_filter = 0; } else { - // Figure out which filter to use + /* Figure out which filter to use */ h_filter = ((itv->yuv_info.reg_2834 << 16) / (itv->yuv_info.reg_2834 >> 16)) >> 15; h_filter = (h_filter >> 1) + (h_filter & 1); - // Only an exact size match can use filter 0. + /* Only an exact size match can use filter 0. */ if (h_filter < 1) h_filter = 1; } - // Now the vertical filter + /* Now the vertical filter */ if ((itv->yuv_info.reg_2918 & 0x0000FFFF) == (itv->yuv_info.reg_2918 >> 16)) { - // An exact size match uses filter 0/1 + /* An exact size match uses filter 0/1 */ v_filter_1 = 0; v_filter_2 = 1; } else { - // Figure out which filter to use + /* Figure out which filter to use */ v_filter_1 = ((itv->yuv_info.reg_2918 << 16) / (itv->yuv_info.reg_2918 >> 16)) >> 15; v_filter_1 = (v_filter_1 >> 1) + (v_filter_1 & 1); - // Only an exact size match can use filter 0 + /* Only an exact size match can use filter 0 */ if (v_filter_1 == 0) v_filter_1 = 1; v_filter_2 = v_filter_1; } - // Now restore the filters + /* Now restore the filters */ ivtv_yuv_filter (itv,h_filter,v_filter_1,v_filter_2); - // and clear a few registers + /* and clear a few registers */ write_reg(0, 0x02814); write_reg(0, 0x0282c); write_reg(0, 0x02904); write_reg(0, 0x02910); - // Release the blanking buffer + /* Release the blanking buffer */ if (itv->yuv_info.blanking_ptr) { kfree (itv->yuv_info.blanking_ptr); itv->yuv_info.blanking_ptr = NULL; pci_unmap_single(itv->dev, itv->yuv_info.blanking_dmaptr, 720*16, PCI_DMA_TODEVICE); } - // Invalidate the old dimension information + /* Invalidate the old dimension information */ itv->yuv_info.old_frame_info.src_w = 0; itv->yuv_info.old_frame_info.src_h = 0; itv->yuv_info.old_frame_info_args.src_w = 0; itv->yuv_info.old_frame_info_args.src_h = 0; - // All done. + /* All done. */ clear_bit(IVTV_F_I_DECODING_YUV, &itv->i_flags); } diff --git a/linux/drivers/media/video/msp3400-driver.c b/linux/drivers/media/video/msp3400-driver.c index 9958e2570..0e21a5b57 100644 --- a/linux/drivers/media/video/msp3400-driver.c +++ b/linux/drivers/media/video/msp3400-driver.c @@ -817,6 +817,9 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) break; } + case VIDIOC_G_CHIP_IDENT: + return v4l2_chip_ident_i2c_client(client, arg, state->ident, (state->rev1 << 16) | state->rev2); + default: /* unknown */ return -EINVAL; @@ -944,6 +947,8 @@ static int msp_attach(struct i2c_adapter *adapter, int address, int kind) snprintf(client->name, sizeof(client->name), "MSP%d4%02d%c-%c%d", msp_family, msp_product, msp_revision, msp_hard, msp_rom); + /* Rev B=2, C=3, D=4, G=7 */ + state->ident = msp_family * 10000 + 4000 + msp_product * 10 + msp_revision - '@'; /* Has NICAM support: all mspx41x and mspx45x products have NICAM */ state->has_nicam = msp_prod_hi == 1 || msp_prod_hi == 5; diff --git a/linux/drivers/media/video/msp3400-driver.h b/linux/drivers/media/video/msp3400-driver.h index a783277ab..cbd4a91f5 100644 --- a/linux/drivers/media/video/msp3400-driver.h +++ b/linux/drivers/media/video/msp3400-driver.h @@ -50,6 +50,7 @@ extern int msp_stereo_thresh; struct msp_state { int rev1, rev2; + int ident; u8 has_nicam; u8 has_radio; u8 has_headphones; diff --git a/linux/drivers/media/video/ov7670.c b/linux/drivers/media/video/ov7670.c index d68f36851..b033bf334 100644 --- a/linux/drivers/media/video/ov7670.c +++ b/linux/drivers/media/video/ov7670.c @@ -1316,15 +1316,7 @@ static int ov7670_command(struct i2c_client *client, unsigned int cmd, { switch (cmd) { case VIDIOC_G_CHIP_IDENT: - { - struct v4l2_chip_ident *chip = arg; - - if (!v4l2_chip_match_i2c_client(client, chip->match_type, chip->match_chip)) - return -EINVAL; - chip->ident = V4L2_IDENT_OV7670; - chip->revision = 0; - return 0; - } + return v4l2_chip_ident_i2c_client(client, arg, V4L2_IDENT_OV7670, 0); case VIDIOC_INT_RESET: ov7670_reset(client); diff --git a/linux/drivers/media/video/saa7115.c b/linux/drivers/media/video/saa7115.c index 8b4abb3a1..064a81334 100644 --- a/linux/drivers/media/video/saa7115.c +++ b/linux/drivers/media/video/saa7115.c @@ -1449,15 +1449,7 @@ static int saa711x_command(struct i2c_client *client, unsigned int cmd, void *ar #endif case VIDIOC_G_CHIP_IDENT: - { - struct v4l2_chip_ident *chip = arg; - - if (!v4l2_chip_match_i2c_client(client, chip->match_type, chip->match_chip)) - return -EINVAL; - chip->ident = state->ident; - chip->revision = 0; - break; - } + return v4l2_chip_ident_i2c_client(client, arg, state->ident, 0); default: return -EINVAL; diff --git a/linux/drivers/media/video/saa7127.c b/linux/drivers/media/video/saa7127.c index 28306f15d..185eb7e9d 100644 --- a/linux/drivers/media/video/saa7127.c +++ b/linux/drivers/media/video/saa7127.c @@ -664,15 +664,7 @@ static int saa7127_command(struct i2c_client *client, } case VIDIOC_G_CHIP_IDENT: - { - struct v4l2_chip_ident *chip = arg; - - if (!v4l2_chip_match_i2c_client(client, chip->match_type, chip->match_chip)) - return -EINVAL; - chip->ident = state->ident; - chip->revision = 0; - break; - } + return v4l2_chip_ident_i2c_client(client, arg, state->ident, 0); default: return -EINVAL; diff --git a/linux/drivers/media/video/tvaudio.c b/linux/drivers/media/video/tvaudio.c index e08484fd2..cc885951e 100644 --- a/linux/drivers/media/video/tvaudio.c +++ b/linux/drivers/media/video/tvaudio.c @@ -40,6 +40,7 @@ #endif #include <media/tvaudio.h> #include <media/v4l2-common.h> +#include <media/v4l2-chip-ident.h> #include <media/i2c-addr.h> @@ -1814,6 +1815,9 @@ static int chip_command(struct i2c_client *client, /* the thread will call checkmode() later */ } break; + + case VIDIOC_G_CHIP_IDENT: + return v4l2_chip_ident_i2c_client(client, arg, V4L2_IDENT_TVAUDIO, 0); } return 0; } diff --git a/linux/drivers/media/video/upd64031a.c b/linux/drivers/media/video/upd64031a.c index 3a7db9f7a..bd6a50ec7 100644 --- a/linux/drivers/media/video/upd64031a.c +++ b/linux/drivers/media/video/upd64031a.c @@ -27,6 +27,7 @@ #include <linux/i2c.h> #include <linux/videodev2.h> #include <media/v4l2-common.h> +#include <media/v4l2-chip-ident.h> #include <media/upd64031a.h> #include "compat.h" @@ -187,6 +188,9 @@ static int upd64031a_command(struct i2c_client *client, unsigned int cmd, void * } #endif + case VIDIOC_G_CHIP_IDENT: + return v4l2_chip_ident_i2c_client(client, arg, V4L2_IDENT_UPD64031A, 0); + default: break; } diff --git a/linux/drivers/media/video/upd64083.c b/linux/drivers/media/video/upd64083.c index 317baed46..ccf340a5b 100644 --- a/linux/drivers/media/video/upd64083.c +++ b/linux/drivers/media/video/upd64083.c @@ -26,6 +26,7 @@ #include <linux/i2c.h> #include <linux/videodev2.h> #include <media/v4l2-common.h> +#include <media/v4l2-chip-ident.h> #include <media/upd64083.h> #include "compat.h" @@ -163,6 +164,10 @@ static int upd64083_command(struct i2c_client *client, unsigned int cmd, void *a break; } #endif + + case VIDIOC_G_CHIP_IDENT: + return v4l2_chip_ident_i2c_client(client, arg, V4L2_IDENT_UPD64083, 0); + default: break; } diff --git a/linux/drivers/media/video/v4l2-common.c b/linux/drivers/media/video/v4l2-common.c index 60c56a8b0..0a45e19cb 100644 --- a/linux/drivers/media/video/v4l2-common.c +++ b/linux/drivers/media/video/v4l2-common.c @@ -60,6 +60,7 @@ #include <linux/video_decoder.h> #define __OLD_VIDIOC_ /* To allow fixing old calls*/ #include <media/v4l2-common.h> +#include <media/v4l2-chip-ident.h> #ifdef CONFIG_KMOD #include <linux/kmod.h> @@ -1605,6 +1606,22 @@ int v4l2_chip_match_i2c_client(struct i2c_client *c, u32 match_type, u32 match_c } } +int v4l2_chip_ident_i2c_client(struct i2c_client *c, struct v4l2_chip_ident *chip, + u32 ident, u32 revision) +{ + if (!v4l2_chip_match_i2c_client(c, chip->match_type, chip->match_chip)) + return 0; + if (chip->ident == V4L2_IDENT_NONE) { + chip->ident = ident; + chip->revision = revision; + } + else { + chip->ident = V4L2_IDENT_AMBIGUOUS; + chip->revision = 0; + } + return 0; +} + int v4l2_chip_match_host(u32 match_type, u32 match_chip) { switch (match_type) { @@ -1639,6 +1656,7 @@ EXPORT_SYMBOL(v4l2_ctrl_query_fill); EXPORT_SYMBOL(v4l2_ctrl_query_fill_std); EXPORT_SYMBOL(v4l2_chip_match_i2c_client); +EXPORT_SYMBOL(v4l2_chip_ident_i2c_client); EXPORT_SYMBOL(v4l2_chip_match_host); /* diff --git a/linux/drivers/media/video/wm8739.c b/linux/drivers/media/video/wm8739.c index 4b4e5277f..da14fa401 100644 --- a/linux/drivers/media/video/wm8739.c +++ b/linux/drivers/media/video/wm8739.c @@ -29,6 +29,7 @@ #include <linux/i2c-id.h> #include <linux/videodev.h> #include <media/v4l2-common.h> +#include <media/v4l2-chip-ident.h> #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) #include "i2c-compat.h" #include <linux/slab.h> @@ -248,6 +249,9 @@ static int wm8739_command(struct i2c_client *client, unsigned int cmd, void *arg return -EINVAL; } + case VIDIOC_G_CHIP_IDENT: + return v4l2_chip_ident_i2c_client(client, arg, V4L2_IDENT_WM8739, 0); + case VIDIOC_LOG_STATUS: v4l_info(client, "Frequency: %u Hz\n", state->clock_freq); v4l_info(client, "Volume L: %02x%s\n", state->vol_l & 0x1f, diff --git a/linux/drivers/media/video/wm8775.c b/linux/drivers/media/video/wm8775.c index d64f9c534..4727cbd6d 100644 --- a/linux/drivers/media/video/wm8775.c +++ b/linux/drivers/media/video/wm8775.c @@ -33,6 +33,7 @@ #include <linux/i2c-id.h> #include <linux/videodev.h> #include <media/v4l2-common.h> +#include <media/v4l2-chip-ident.h> #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) #include "i2c-compat.h" #include <linux/slab.h> @@ -132,6 +133,9 @@ static int wm8775_command(struct i2c_client *client, unsigned int cmd, wm8775_write(client, R21, 0x100 + state->input); break; + case VIDIOC_G_CHIP_IDENT: + return v4l2_chip_ident_i2c_client(client, arg, V4L2_IDENT_WM8775, 0); + case VIDIOC_LOG_STATUS: v4l_info(client, "Input: %d%s\n", state->input, state->muted ? " (muted)" : ""); |