From b6e436b263b35476da4be06e0719cb1d5c8f8eed Mon Sep 17 00:00:00 2001 From: Ian Armstrong Date: Mon, 21 Dec 2009 22:59:26 -0300 Subject: V4L/DVB: ivtv: Fix race condition for queued udma transfers There are several DMA related interrupts which wake up the dma_waitq. The udma routines use this queue while they wait for their transfer to complete. When woken, the udma routine will check the IVTV_F_I_UDMA_PENDING & IVTV_F_I_UDMA flags to see if the transfer is still queued or has finished. However, a small window exists between the IVTV_F_I_UDMA_PENDING flag being cleared and the IVTV_F_I_UDMA flag being set. Given that the completion of an unrelated DMA transfer may wake up the udma routine, it's possible for this check to fail and the udma routine will start unmapping pages when the transfer has only just started. The result of this is unpredictable. This fix simply delays the clearing of the IVTV_F_I_UDMA_PENDING flag until after IVTV_F_I_UDMA has been set. Signed-off-by: Ian Armstrong Signed-off-by: Andy Walls Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/ivtv/ivtv-irq.c | 5 +++-- drivers/media/video/ivtv/ivtv-udma.c | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers/media/video/ivtv') diff --git a/drivers/media/video/ivtv/ivtv-irq.c b/drivers/media/video/ivtv/ivtv-irq.c index cd9db0bf33b..ee0cdded69f 100644 --- a/drivers/media/video/ivtv/ivtv-irq.c +++ b/drivers/media/video/ivtv/ivtv-irq.c @@ -940,9 +940,10 @@ irqreturn_t ivtv_irq_handler(int irq, void *dev_id) ivtv_dma_enc_start(s); break; } - if (i == IVTV_MAX_STREAMS && test_and_clear_bit(IVTV_F_I_UDMA_PENDING, &itv->i_flags)) { + + if (i == IVTV_MAX_STREAMS && + test_bit(IVTV_F_I_UDMA_PENDING, &itv->i_flags)) ivtv_udma_start(itv); - } } if ((combo & IVTV_IRQ_DMA) && !test_bit(IVTV_F_I_PIO, &itv->i_flags)) { diff --git a/drivers/media/video/ivtv/ivtv-udma.c b/drivers/media/video/ivtv/ivtv-udma.c index d07ad6c3902..1daf1dd65bf 100644 --- a/drivers/media/video/ivtv/ivtv-udma.c +++ b/drivers/media/video/ivtv/ivtv-udma.c @@ -213,6 +213,7 @@ void ivtv_udma_start(struct ivtv *itv) write_reg_sync(read_reg(IVTV_REG_DMAXFER) | 0x01, IVTV_REG_DMAXFER); set_bit(IVTV_F_I_DMA, &itv->i_flags); set_bit(IVTV_F_I_UDMA, &itv->i_flags); + clear_bit(IVTV_F_I_UDMA_PENDING, &itv->i_flags); } void ivtv_udma_prepare(struct ivtv *itv) -- cgit v1.2.3-70-g09d2 From 3ccc646b56a3f03029a259c6a8affd9cecc6020e Mon Sep 17 00:00:00 2001 From: Andy Walls Date: Thu, 24 Dec 2009 13:06:08 -0300 Subject: V4L/DVB: cx25840, v4l2-subdev, ivtv, pvrusb2: Fix ivtv/cx25840 tinny audio This change attempts to fix the ivtv tinny audio problem by keeping digitizer to encoder audio clocks running, while disabling the video clocks as needed to avoid unpredictable PCI bus hangs. To accomplish this, for the cx25840 module enabling of audio streaming had to be separated from enabling video streaming, requiring an additional v4l2_subdev_audio_op and calls to this new op in the pvrusb2 and ivtv drivers. The cx231xx and cx23885 driver use the cx25840 module for affecting only video on s_stream calls, so those drivers needed no change. The CX23418 hardware does not exhibit either the tinny audio problem nor the PCI bus hang, so the cx18 driver did not need corresponding changes. CX2341[56] based cards that are not using the CX2584x family of chips do not seem to be affected by the tinny audio problem, and this change should not affect how they are configured. It will delay their first capture by starting by another 300 msec though. Many thanks go to Argus and Martin Dauskardt whose persistent testing and investigation of this problem will hopefully fix this problem once and for all for many ivtv users. Reported-by: Martin Dauskardt Reported-by: Argus Signed-off-by: Andy Walls Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/cx25840/cx25840-core.c | 48 ++++++++++++++++++++++++------ drivers/media/video/ivtv/ivtv-streams.c | 4 +++ drivers/media/video/pvrusb2/pvrusb2-hdw.c | 1 + include/media/v4l2-subdev.h | 1 + 4 files changed, 45 insertions(+), 9 deletions(-) (limited to 'drivers/media/video/ivtv') diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c index 385ecd58f1c..796f12d59da 100644 --- a/drivers/media/video/cx25840/cx25840-core.c +++ b/drivers/media/video/cx25840/cx25840-core.c @@ -1347,30 +1347,59 @@ static int cx25840_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register * } #endif +static int cx25840_s_audio_stream(struct v4l2_subdev *sd, int enable) +{ + struct cx25840_state *state = to_state(sd); + struct i2c_client *client = v4l2_get_subdevdata(sd); + u8 v; + + if (is_cx2583x(state) || is_cx2388x(state) || is_cx231xx(state)) + return 0; + + v4l_dbg(1, cx25840_debug, client, "%s audio output\n", + enable ? "enable" : "disable"); + + if (enable) { + v = cx25840_read(client, 0x115) | 0x80; + cx25840_write(client, 0x115, v); + v = cx25840_read(client, 0x116) | 0x03; + cx25840_write(client, 0x116, v); + } else { + v = cx25840_read(client, 0x115) & ~(0x80); + cx25840_write(client, 0x115, v); + v = cx25840_read(client, 0x116) & ~(0x03); + cx25840_write(client, 0x116, v); + } + return 0; +} + static int cx25840_s_stream(struct v4l2_subdev *sd, int enable) { struct cx25840_state *state = to_state(sd); struct i2c_client *client = v4l2_get_subdevdata(sd); + u8 v; - v4l_dbg(1, cx25840_debug, client, "%s output\n", + v4l_dbg(1, cx25840_debug, client, "%s video output\n", enable ? "enable" : "disable"); if (enable) { if (is_cx2388x(state) || is_cx231xx(state)) { - u8 v = (cx25840_read(client, 0x421) | 0x0b); + v = cx25840_read(client, 0x421) | 0x0b; cx25840_write(client, 0x421, v); } else { - cx25840_write(client, 0x115, - is_cx2583x(state) ? 0x0c : 0x8c); - cx25840_write(client, 0x116, - is_cx2583x(state) ? 0x04 : 0x07); + v = cx25840_read(client, 0x115) | 0x0c; + cx25840_write(client, 0x115, v); + v = cx25840_read(client, 0x116) | 0x04; + cx25840_write(client, 0x116, v); } } else { if (is_cx2388x(state) || is_cx231xx(state)) { - u8 v = cx25840_read(client, 0x421) & ~(0x0b); + v = cx25840_read(client, 0x421) & ~(0x0b); cx25840_write(client, 0x421, v); } else { - cx25840_write(client, 0x115, 0x00); - cx25840_write(client, 0x116, 0x00); + v = cx25840_read(client, 0x115) & ~(0x0c); + cx25840_write(client, 0x115, v); + v = cx25840_read(client, 0x116) & ~(0x04); + cx25840_write(client, 0x116, v); } } return 0; @@ -1601,6 +1630,7 @@ static const struct v4l2_subdev_tuner_ops cx25840_tuner_ops = { static const struct v4l2_subdev_audio_ops cx25840_audio_ops = { .s_clock_freq = cx25840_s_clock_freq, .s_routing = cx25840_s_audio_routing, + .s_stream = cx25840_s_audio_stream, }; static const struct v4l2_subdev_video_ops cx25840_video_ops = { diff --git a/drivers/media/video/ivtv/ivtv-streams.c b/drivers/media/video/ivtv/ivtv-streams.c index e12c6022373..2f90dd255cd 100644 --- a/drivers/media/video/ivtv/ivtv-streams.c +++ b/drivers/media/video/ivtv/ivtv-streams.c @@ -577,10 +577,14 @@ int ivtv_start_v4l2_encode_stream(struct ivtv_stream *s) clear_bit(IVTV_F_I_EOS, &itv->i_flags); /* Initialize Digitizer for Capture */ + /* Avoid tinny audio problem - ensure audio clocks are going */ + v4l2_subdev_call(itv->sd_audio, audio, s_stream, 1); + /* Avoid unpredictable PCI bus hang - disable video clocks */ v4l2_subdev_call(itv->sd_video, video, s_stream, 0); ivtv_msleep_timeout(300, 1); ivtv_vapi(itv, CX2341X_ENC_INITIALIZE_INPUT, 0); v4l2_subdev_call(itv->sd_video, video, s_stream, 1); + ivtv_msleep_timeout(300, 1); } /* begin_capture */ diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c index 1bbdab08fe0..ad9ed51f7b9 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c @@ -1705,6 +1705,7 @@ static int pvr2_decoder_enable(struct pvr2_hdw *hdw,int enablefl) pvr2_trace(PVR2_TRACE_CHIPS, "subdev v4l2 stream=%s", (enablefl ? "on" : "off")); v4l2_device_call_all(&hdw->v4l2_dev, 0, video, s_stream, enablefl); + v4l2_device_call_all(&hdw->v4l2_dev, 0, audio, s_stream, enablefl); if (hdw->decoder_client_id) { /* We get here if the encoder has been noticed. Otherwise we'll issue a warning to the user (which should diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index 9ba99cd39ee..2bcdca0a57f 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -180,6 +180,7 @@ struct v4l2_subdev_audio_ops { int (*s_clock_freq)(struct v4l2_subdev *sd, u32 freq); int (*s_i2s_clock_freq)(struct v4l2_subdev *sd, u32 freq); int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config); + int (*s_stream)(struct v4l2_subdev *sd, int enable); }; /* -- cgit v1.2.3-70-g09d2 From 95480f2773588eabb35ac9354d068b068ef11e70 Mon Sep 17 00:00:00 2001 From: Andy Walls Date: Sun, 17 Jan 2010 21:12:24 -0300 Subject: V4L/DVB: ivtv: Adjust msleep() delays used to prevent tinny audio and PCI bus hang Martin Dauskardt has done extensive testing on what values can be used and and concluded that only 300 ms total is required to avoid bad video effects such as occasional black screen and short sync disturbances. Furthermore he determined how this 300 ms was split between the two msleep()s did matter very much, so he suggested 150ms/150ms as one acceptable alternative that is implemented here. Many thanks go to Martin. Tested-by: Martin Dauskardt Signed-off-by: Andy Walls Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/ivtv/ivtv-streams.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/media/video/ivtv') diff --git a/drivers/media/video/ivtv/ivtv-streams.c b/drivers/media/video/ivtv/ivtv-streams.c index 2f90dd255cd..1f9387f6ca2 100644 --- a/drivers/media/video/ivtv/ivtv-streams.c +++ b/drivers/media/video/ivtv/ivtv-streams.c @@ -581,10 +581,10 @@ int ivtv_start_v4l2_encode_stream(struct ivtv_stream *s) v4l2_subdev_call(itv->sd_audio, audio, s_stream, 1); /* Avoid unpredictable PCI bus hang - disable video clocks */ v4l2_subdev_call(itv->sd_video, video, s_stream, 0); - ivtv_msleep_timeout(300, 1); + ivtv_msleep_timeout(150, 1); ivtv_vapi(itv, CX2341X_ENC_INITIALIZE_INPUT, 0); v4l2_subdev_call(itv->sd_video, video, s_stream, 1); - ivtv_msleep_timeout(300, 1); + ivtv_msleep_timeout(150, 1); } /* begin_capture */ -- cgit v1.2.3-70-g09d2 From 587808d5f59e842f9258a15e88ad530fcf6e6763 Mon Sep 17 00:00:00 2001 From: Andy Walls Date: Wed, 10 Feb 2010 15:34:46 -0300 Subject: V4L/DVB: ivtv: Fix ivtv_api_get_data() to avoid unneeded IO during IRQ handling ivtv_api_get_data() was performing more PCI MMIO than needed, resulting often in it accounting for more than half the total time spent in ivtv_irq_handler(). Now it only reads at most 7 of the 16 mailbox data words over the PCI bus, and in some instances only 2 or 3 data words as needed. Signed-off-by: Andy Walls Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/ivtv/ivtv-firmware.c | 2 +- drivers/media/video/ivtv/ivtv-irq.c | 9 +++++---- drivers/media/video/ivtv/ivtv-mailbox.c | 9 +++++---- drivers/media/video/ivtv/ivtv-mailbox.h | 3 ++- 4 files changed, 13 insertions(+), 10 deletions(-) (limited to 'drivers/media/video/ivtv') diff --git a/drivers/media/video/ivtv/ivtv-firmware.c b/drivers/media/video/ivtv/ivtv-firmware.c index c1b7ec475c2..a71e8ba306b 100644 --- a/drivers/media/video/ivtv/ivtv-firmware.c +++ b/drivers/media/video/ivtv/ivtv-firmware.c @@ -258,7 +258,7 @@ void ivtv_init_mpeg_decoder(struct ivtv *itv) IVTV_ERR("ivtv_init_mpeg_decoder failed to start playback\n"); return; } - ivtv_api_get_data(&itv->dec_mbox, IVTV_MBOX_DMA, data); + ivtv_api_get_data(&itv->dec_mbox, IVTV_MBOX_DMA, 2, data); mem_offset = itv->dec_mem + data[1]; if ((readbytes = load_fw_direct(IVTV_DECODE_INIT_MPEG_FILENAME, diff --git a/drivers/media/video/ivtv/ivtv-irq.c b/drivers/media/video/ivtv/ivtv-irq.c index ee0cdded69f..12d36ca91d5 100644 --- a/drivers/media/video/ivtv/ivtv-irq.c +++ b/drivers/media/video/ivtv/ivtv-irq.c @@ -562,7 +562,7 @@ static void ivtv_irq_enc_dma_complete(struct ivtv *itv) u32 data[CX2341X_MBOX_MAX_DATA]; struct ivtv_stream *s; - ivtv_api_get_data(&itv->enc_mbox, IVTV_MBOX_DMA_END, data); + ivtv_api_get_data(&itv->enc_mbox, IVTV_MBOX_DMA_END, 2, data); IVTV_DEBUG_HI_IRQ("ENC DMA COMPLETE %x %d (%d)\n", data[0], data[1], itv->cur_dma_stream); del_timer(&itv->dma_timer); @@ -638,7 +638,7 @@ static void ivtv_irq_dma_err(struct ivtv *itv) u32 data[CX2341X_MBOX_MAX_DATA]; del_timer(&itv->dma_timer); - ivtv_api_get_data(&itv->enc_mbox, IVTV_MBOX_DMA_END, data); + ivtv_api_get_data(&itv->enc_mbox, IVTV_MBOX_DMA_END, 2, data); IVTV_DEBUG_WARN("DMA ERROR %08x %08x %08x %d\n", data[0], data[1], read_reg(IVTV_REG_DMASTATUS), itv->cur_dma_stream); write_reg(read_reg(IVTV_REG_DMASTATUS) & 3, IVTV_REG_DMASTATUS); @@ -669,7 +669,7 @@ static void ivtv_irq_enc_start_cap(struct ivtv *itv) struct ivtv_stream *s; /* Get DMA destination and size arguments from card */ - ivtv_api_get_data(&itv->enc_mbox, IVTV_MBOX_DMA, data); + ivtv_api_get_data(&itv->enc_mbox, IVTV_MBOX_DMA, 7, data); IVTV_DEBUG_HI_IRQ("ENC START CAP %d: %08x %08x\n", data[0], data[1], data[2]); if (data[0] > 2 || data[1] == 0 || data[2] == 0) { @@ -713,9 +713,9 @@ static void ivtv_irq_dec_data_req(struct ivtv *itv) struct ivtv_stream *s; /* YUV or MPG */ - ivtv_api_get_data(&itv->dec_mbox, IVTV_MBOX_DMA, data); if (test_bit(IVTV_F_I_DEC_YUV, &itv->i_flags)) { + ivtv_api_get_data(&itv->dec_mbox, IVTV_MBOX_DMA, 2, data); itv->dma_data_req_size = 1080 * ((itv->yuv_info.v4l2_src_h + 31) & ~31); itv->dma_data_req_offset = data[1]; @@ -724,6 +724,7 @@ static void ivtv_irq_dec_data_req(struct ivtv *itv) s = &itv->streams[IVTV_DEC_STREAM_TYPE_YUV]; } else { + ivtv_api_get_data(&itv->dec_mbox, IVTV_MBOX_DMA, 3, data); itv->dma_data_req_size = min_t(u32, data[2], 0x10000); itv->dma_data_req_offset = data[1]; s = &itv->streams[IVTV_DEC_STREAM_TYPE_MPG]; diff --git a/drivers/media/video/ivtv/ivtv-mailbox.c b/drivers/media/video/ivtv/ivtv-mailbox.c index 1b5c0ac09a8..84577f6f41a 100644 --- a/drivers/media/video/ivtv/ivtv-mailbox.c +++ b/drivers/media/video/ivtv/ivtv-mailbox.c @@ -369,10 +369,11 @@ int ivtv_vapi(struct ivtv *itv, int cmd, int args, ...) } /* This one is for stuff that can't sleep.. irq handlers, etc.. */ -void ivtv_api_get_data(struct ivtv_mailbox_data *mbdata, int mb, u32 data[]) +void ivtv_api_get_data(struct ivtv_mailbox_data *mbdata, int mb, + int argc, u32 data[]) { + volatile u32 __iomem *p = mbdata->mbox[mb].data; int i; - - for (i = 0; i < CX2341X_MBOX_MAX_DATA; i++) - data[i] = readl(&mbdata->mbox[mb].data[i]); + for (i = 0; i < argc; i++, p++) + data[i] = readl(p); } diff --git a/drivers/media/video/ivtv/ivtv-mailbox.h b/drivers/media/video/ivtv/ivtv-mailbox.h index 6ef12091e3f..8247662c928 100644 --- a/drivers/media/video/ivtv/ivtv-mailbox.h +++ b/drivers/media/video/ivtv/ivtv-mailbox.h @@ -24,7 +24,8 @@ #define IVTV_MBOX_DMA_END 8 #define IVTV_MBOX_DMA 9 -void ivtv_api_get_data(struct ivtv_mailbox_data *mbox, int mb, u32 data[]); +void ivtv_api_get_data(struct ivtv_mailbox_data *mbdata, int mb, + int argc, u32 data[]); int ivtv_api(struct ivtv *itv, int cmd, int args, u32 data[]); int ivtv_vapi_result(struct ivtv *itv, u32 data[CX2341X_MBOX_MAX_DATA], int cmd, int args, ...); int ivtv_vapi(struct ivtv *itv, int cmd, int args, ...); -- cgit v1.2.3-70-g09d2 From 7c12167bae57994e30cc5258e8aaa6fb06258f46 Mon Sep 17 00:00:00 2001 From: Eric Anderson Date: Wed, 10 Feb 2010 22:14:54 -0300 Subject: V4L/DVB: ivtv: Add initial entry for Sony VAIO Giga Pocket (Kikyou) cards This is a slightly modified version of Eric Anderson's original patch for the Sony Giga Pocket board. It has been updated to apply to the latest ivtv driver version by Hans Verkuil and Andy Walls . Also Andy Walls modified the patch to use a new Sony BTF-Pnx01Z tuner entry based on Eric Anderson's experimental findings for the bandswitch. >From Eric Anderson's original email: 1. The tuner on the card doesn't seem to match any standard ones. I modified an existing tuner entry. Ideally a new tuner entry should be created. (The only difference from the one I modified is that the low-to-mid range frequency cut-off is slightly different, as are the bit config settings.) 2. It wasn't obvious how to choose a second audio input other than using "radio" as an option. Basically there's two GPIO audio inputs. Using radio allowed me to avoid major restructuring to the code. (perhaps other cards don't have this often...) 3. It's not clear that there's a mute setting that works. Not sure why. 4. I haven't had a chance to test the two Svideo inputs. I set them to COMPOSITE1 and SVIDEO2, but I'm not sure those are the correct settings. The standard composite video inputs seem to work. Signed-off-by: Andy Walls Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/ivtv/ivtv-cards.c | 55 ++++++++++++++++++++++++++++++++++ drivers/media/video/ivtv/ivtv-cards.h | 4 ++- drivers/media/video/ivtv/ivtv-driver.c | 1 + 3 files changed, 59 insertions(+), 1 deletion(-) (limited to 'drivers/media/video/ivtv') diff --git a/drivers/media/video/ivtv/ivtv-cards.c b/drivers/media/video/ivtv/ivtv-cards.c index 79d0fe4990d..79c1b7af882 100644 --- a/drivers/media/video/ivtv/ivtv-cards.c +++ b/drivers/media/video/ivtv/ivtv-cards.c @@ -1210,6 +1210,60 @@ static const struct ivtv_card ivtv_card_buffalo = { .i2c = &ivtv_i2c_std, }; +/* ------------------------------------------------------------------------- */ +/* Sony Kikyou */ + +static const struct ivtv_card_pci_info ivtv_pci_kikyou[] = { + { PCI_DEVICE_ID_IVTV16, IVTV_PCI_ID_SONY, 0x813d }, + { 0, 0, 0 } +}; + +static const struct ivtv_card ivtv_card_kikyou = { + .type = IVTV_CARD_KIKYOU, + .name = "Sony VAIO Giga Pocket (ENX Kikyou)", + .v4l2_capabilities = IVTV_CAP_ENCODER, + .hw_video = IVTV_HW_SAA7115, + .hw_audio = IVTV_HW_GPIO, + .hw_audio_ctrl = IVTV_HW_GPIO, + .hw_all = IVTV_HW_GPIO | IVTV_HW_SAA7115 | IVTV_HW_TUNER, + .video_inputs = { + { IVTV_CARD_INPUT_VID_TUNER, 0, IVTV_SAA71XX_COMPOSITE5 }, + { IVTV_CARD_INPUT_COMPOSITE1, 1, IVTV_SAA71XX_COMPOSITE4 }, /* rear */ + { IVTV_CARD_INPUT_COMPOSITE2, 2, IVTV_SAA71XX_COMPOSITE1 }, /* front */ + { IVTV_CARD_INPUT_SVIDEO1, 1, IVTV_SAA71XX_SVIDEO1 }, + { IVTV_CARD_INPUT_SVIDEO2, 2, IVTV_SAA71XX_SVIDEO2 }, + }, + .audio_inputs = { + { IVTV_CARD_INPUT_AUD_TUNER, IVTV_GPIO_TUNER }, + { IVTV_CARD_INPUT_LINE_IN1, IVTV_GPIO_LINE_IN }, + /* IVTV_GPIO_RADIO?? pretend to have "radio" for 2nd audio GPIO. */ + { IVTV_CARD_INPUT_LINE_IN2, 2 }, + }, + /* + * Sony windows software seems to set 0x200 when unmuting. + * Does it do anything? Not clear what 0x100 does either. + */ + .gpio_init = { .direction = 0x0381, .initial_value = 0x0320 }, + .gpio_audio_input = { .mask = 0x0060, + .tuner = 0x0000, + .linein = 0x0060, + .radio = 0x0020 }, + .gpio_audio_mute = { .mask = 0x0000, + .mute = 0x0000 }, /* 0x200? Disable for now. */ + .gpio_audio_mode = { .mask = 0x0080, + .mono = 0x0000, + .stereo = 0x0000, /* SAP */ + .lang1 = 0x0080, + .lang2 = 0x0000, + .both = 0x0080 }, + .tuners = { + { .std = V4L2_STD_ALL, .tuner = TUNER_SONY_BTF_PXN01Z }, + }, + .pci_list = ivtv_pci_kikyou, + .i2c = &ivtv_i2c_std, +}; + + static const struct ivtv_card *ivtv_card_list[] = { &ivtv_card_pvr250, &ivtv_card_pvr350, @@ -1238,6 +1292,7 @@ static const struct ivtv_card *ivtv_card_list[] = { &ivtv_card_aver_m104, &ivtv_card_buffalo, &ivtv_card_aver_ultra1500mce, + &ivtv_card_kikyou, /* Variations of standard cards but with the same PCI IDs. These cards must come last in this list. */ diff --git a/drivers/media/video/ivtv/ivtv-cards.h b/drivers/media/video/ivtv/ivtv-cards.h index 6148827ec88..78eca992e1f 100644 --- a/drivers/media/video/ivtv/ivtv-cards.h +++ b/drivers/media/video/ivtv/ivtv-cards.h @@ -51,7 +51,8 @@ #define IVTV_CARD_AVER_M104 24 /* AverMedia M104 miniPCI card */ #define IVTV_CARD_BUFFALO_MV5L 25 /* Buffalo PC-MV5L/PCI card */ #define IVTV_CARD_AVER_ULTRA1500MCE 26 /* AVerMedia UltraTV 1500 MCE */ -#define IVTV_CARD_LAST 26 +#define IVTV_CARD_KIKYOU 27 /* Sony VAIO Giga Pocket (ENX Kikyou) */ +#define IVTV_CARD_LAST 27 /* Variants of existing cards but with the same PCI IDs. The driver detects these based on other device information. @@ -86,6 +87,7 @@ #define IVTV_PCI_ID_MELCO 0x1154 #define IVTV_PCI_ID_GOTVIEW1 0xffac #define IVTV_PCI_ID_GOTVIEW2 0xffad +#define IVTV_PCI_ID_SONY 0x104d /* hardware flags, no gaps allowed */ #define IVTV_HW_CX25840 (1 << 0) diff --git a/drivers/media/video/ivtv/ivtv-driver.c b/drivers/media/video/ivtv/ivtv-driver.c index 347c3344f56..9a250548be4 100644 --- a/drivers/media/video/ivtv/ivtv-driver.c +++ b/drivers/media/video/ivtv/ivtv-driver.c @@ -193,6 +193,7 @@ MODULE_PARM_DESC(cardtype, "\t\t\t25 = AverMedia M104 (not yet working)\n" "\t\t\t26 = Buffalo PC-MV5L/PCI\n" "\t\t\t27 = AVerMedia UltraTV 1500 MCE\n" + "\t\t\t28 = Sony VAIO Giga Pocket (ENX Kikyou)\n" "\t\t\t 0 = Autodetect (default)\n" "\t\t\t-1 = Ignore this card\n\t\t"); MODULE_PARM_DESC(pal, "Set PAL standard: BGH, DK, I, M, N, Nc, 60"); -- cgit v1.2.3-70-g09d2 From c1ea5b7424e4d1d3f56de1504a257ec2419259e8 Mon Sep 17 00:00:00 2001 From: Andy Walls Date: Sat, 20 Feb 2010 21:28:39 -0300 Subject: V4L/DVB: ivtv: Tweak Sony GigaPocket Kikyou card entry based on experiments Based on experiments by Eric Wescott, edit the Sony GigaPocket (Kikyou) card entry video and audio mux settings. Signed-off-by: Andy Walls Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/ivtv/ivtv-cards.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'drivers/media/video/ivtv') diff --git a/drivers/media/video/ivtv/ivtv-cards.c b/drivers/media/video/ivtv/ivtv-cards.c index 79c1b7af882..ca1fd3227a9 100644 --- a/drivers/media/video/ivtv/ivtv-cards.c +++ b/drivers/media/video/ivtv/ivtv-cards.c @@ -1227,27 +1227,20 @@ static const struct ivtv_card ivtv_card_kikyou = { .hw_audio_ctrl = IVTV_HW_GPIO, .hw_all = IVTV_HW_GPIO | IVTV_HW_SAA7115 | IVTV_HW_TUNER, .video_inputs = { - { IVTV_CARD_INPUT_VID_TUNER, 0, IVTV_SAA71XX_COMPOSITE5 }, - { IVTV_CARD_INPUT_COMPOSITE1, 1, IVTV_SAA71XX_COMPOSITE4 }, /* rear */ - { IVTV_CARD_INPUT_COMPOSITE2, 2, IVTV_SAA71XX_COMPOSITE1 }, /* front */ + { IVTV_CARD_INPUT_VID_TUNER, 0, IVTV_SAA71XX_COMPOSITE1 }, + { IVTV_CARD_INPUT_COMPOSITE1, 1, IVTV_SAA71XX_COMPOSITE1 }, { IVTV_CARD_INPUT_SVIDEO1, 1, IVTV_SAA71XX_SVIDEO1 }, - { IVTV_CARD_INPUT_SVIDEO2, 2, IVTV_SAA71XX_SVIDEO2 }, }, .audio_inputs = { { IVTV_CARD_INPUT_AUD_TUNER, IVTV_GPIO_TUNER }, { IVTV_CARD_INPUT_LINE_IN1, IVTV_GPIO_LINE_IN }, - /* IVTV_GPIO_RADIO?? pretend to have "radio" for 2nd audio GPIO. */ - { IVTV_CARD_INPUT_LINE_IN2, 2 }, - }, - /* - * Sony windows software seems to set 0x200 when unmuting. - * Does it do anything? Not clear what 0x100 does either. - */ - .gpio_init = { .direction = 0x0381, .initial_value = 0x0320 }, + { IVTV_CARD_INPUT_LINE_IN2, IVTV_GPIO_LINE_IN }, + }, + .gpio_init = { .direction = 0x03e1, .initial_value = 0x0320 }, .gpio_audio_input = { .mask = 0x0060, - .tuner = 0x0000, - .linein = 0x0060, - .radio = 0x0020 }, + .tuner = 0x0020, + .linein = 0x0000, + .radio = 0x0060 }, .gpio_audio_mute = { .mask = 0x0000, .mute = 0x0000 }, /* 0x200? Disable for now. */ .gpio_audio_mode = { .mask = 0x0080, -- cgit v1.2.3-70-g09d2