From 0c57b11076a797902550b9f74763718edb825483 Mon Sep 17 00:00:00 2001 From: Mike Isely Date: Wed, 15 Mar 2006 00:44:43 -0600 Subject: Update pvrusb2 driver to operate msp3400 as a pure v4l2 module. From: Mike Isely Signed-off-by: Mike Isely --- linux/drivers/media/video/pvrusb2/pvrusb2-audio.c | 58 +++++++---------------- 1 file changed, 17 insertions(+), 41 deletions(-) (limited to 'linux/drivers/media') diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-audio.c b/linux/drivers/media/video/pvrusb2/pvrusb2-audio.c index 7e2fab330..c43b98897 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-audio.c +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-audio.c @@ -38,21 +38,6 @@ struct pvr2_msp3400_handler { }; -/* - - MCI 10-Mar-2005 - Rather than operate the msp34xx - directly, we rely on the msp3400.ko module to do it for us. We - really have to do this because that $##@!! module is going to attach - itself to us anyway, so we really can't operate the chip ourselves. - Unfortunately msp3400.ko is a real train wreck of a piece of code. - Most of the code below tries to tickle that module in just the right - way to get the results we need. Yuck. msp3400.c should be taken - out back and shot. Based on my reading of the actual chip datasheet - it should in theory be possible to write a far cleaner and simpler - driver than what is currently there right now. - -*/ - static int xlat_audiomode_to_v4l2(int id) { switch (id) { @@ -75,10 +60,10 @@ static int xlat_audiomode_to_v4l2(int id) static void set_stereo(struct pvr2_msp3400_handler *ctxt) { struct pvr2_hdw *hdw = ctxt->hdw; - unsigned short sarg = 0; + struct v4l2_audio ac; struct msp_matrix mspm; - pvr2_trace(PVR2_TRACE_CHIPS,"i2c msp3400 set_stereo"); + pvr2_trace(PVR2_TRACE_CHIPS,"i2c msp3400 v4l2 set_stereo"); if (hdw->controls[PVR2_CID_INPUT].value == PVR2_CVAL_INPUT_TV) { struct v4l2_tuner vt; @@ -88,38 +73,29 @@ static void set_stereo(struct pvr2_msp3400_handler *ctxt) pvr2_i2c_client_cmd(ctxt->client,VIDIOC_S_TUNER,&vt); } - sarg = AUDIO_TUNER; + memset(&ac,0,sizeof(ac)); + ac.index = AUDIO_TUNER; switch (hdw->controls[PVR2_CID_INPUT].value) { case PVR2_CVAL_INPUT_TV: - sarg = AUDIO_TUNER; + ac.index = AUDIO_TUNER; break; case PVR2_CVAL_INPUT_RADIO: - /* Assume that msp34xx also handle FM decoding, in which case - we're still using the tuner. */ - sarg = AUDIO_TUNER; + ac.index = AUDIO_RADIO; break; case PVR2_CVAL_INPUT_SVIDEO: case PVR2_CVAL_INPUT_COMPOSITE: - sarg = AUDIO_EXTERN; + ac.index = AUDIO_EXTERN_1; break; } - pvr2_i2c_client_cmd(ctxt->client,AUDC_SET_INPUT,&sarg); - - /* The above should have been enough to do the job, however - msp3400.ko does an incomplete job of handling the scart - routing. Really. It doesn't even bother to initialize the - SC1 output at all. So we have to help it here... - Unfortunately this also means that we have include - msp3400.c's header file and it currently isn't in a public - place. Damnit! */ + pvr2_i2c_client_cmd(ctxt->client,VIDIOC_S_AUDIO,&ac); mspm.input = SCART_IN1_DA; switch (hdw->controls[PVR2_CID_INPUT].value) { case PVR2_CVAL_INPUT_SVIDEO: case PVR2_CVAL_INPUT_COMPOSITE: /* Bypass the DSP and just use IN1. In theory we - should be able to permanent just use IN1_DA, but to - do that msp3400.ko should be adjusting the DSP + should be able to permanently just use IN1_DA, but + to do that msp3400.ko should be adjusting the DSP input SCART routing correctly when doing video in. Unfortunately that appears not to be the case. I really hate that module. */ @@ -182,19 +158,19 @@ static void msp3400_update(struct pvr2_msp3400_handler *ctxt) } -/* This reads back the current volume parameters and signal type */ +/* This reads back the current signal type */ static int get_audio_status(struct pvr2_msp3400_handler *ctxt) { - struct video_audio vt; + struct v4l2_tuner vt; int stat; memset(&vt,0,sizeof(vt)); - stat = pvr2_i2c_client_cmd(ctxt->client,VIDIOCGAUDIO,&vt); + stat = pvr2_i2c_client_cmd(ctxt->client,VIDIOC_G_TUNER,&vt); if (stat < 0) return stat; - ctxt->hdw->flag_stereo = (vt.mode & VIDEO_SOUND_STEREO) != 0; + ctxt->hdw->flag_stereo = (vt.audmode & V4L2_TUNER_MODE_STEREO) != 0; ctxt->hdw->flag_bilingual = - (vt.mode & (VIDEO_SOUND_LANG1|VIDEO_SOUND_LANG2)) != 0; + (vt.audmode & V4L2_TUNER_MODE_LANG2) != 0; return 0; } @@ -210,7 +186,7 @@ static void pvr2_msp3400_detach(struct pvr2_msp3400_handler *ctxt) static unsigned int pvr2_msp3400_describe(struct pvr2_msp3400_handler *ctxt, char *buf,unsigned int cnt) { - return scnprintf(buf,cnt,"handler: pvrusb2-audio"); + return scnprintf(buf,cnt,"handler: pvrusb2-audio v4l2"); } @@ -243,7 +219,7 @@ int pvr2_i2c_msp3400_setup(struct pvr2_hdw *hdw,struct pvr2_i2c_client *cp) sizeof(msp3400_ops[0]))) - 1; cp->handler = &ctxt->i2c_handler; hdw->audio_stat = &ctxt->astat; - pvr2_trace(PVR2_TRACE_CHIPS,"i2c 0x%x msp3400 V4L1 handler set up", + pvr2_trace(PVR2_TRACE_CHIPS,"i2c 0x%x msp3400 V4L2 handler set up", cp->client->addr); return !0; } -- cgit v1.2.3 From 853281d7ac18c7e109231a4d86a9565623531de2 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Fri, 17 Mar 2006 00:23:47 +0100 Subject: Fix saturation bug. Fix NTSC->PAL standard change. Detect NTSC-KR standard. From: Hans Verkuil Signed-off-by: Hans Verkuil --- linux/drivers/media/video/cx25840/cx25840-core.c | 35 +++++++++++++++++++++--- 1 file changed, 31 insertions(+), 4 deletions(-) (limited to 'linux/drivers/media') diff --git a/linux/drivers/media/video/cx25840/cx25840-core.c b/linux/drivers/media/video/cx25840/cx25840-core.c index d7d19bdc3..ab903c3d4 100644 --- a/linux/drivers/media/video/cx25840/cx25840-core.c +++ b/linux/drivers/media/video/cx25840/cx25840-core.c @@ -187,9 +187,9 @@ static void cx25840_initialize(struct i2c_client *client, int loadfw) cx25840_write(client, 0x4a5, 0x00); cx25840_write(client, 0x402, 0x00); /* 8. */ - cx25840_write(client, 0x401, 0x18); - cx25840_write(client, 0x4a2, 0x10); - cx25840_write(client, 0x402, 0x04); + cx25840_and_or(client, 0x401, ~0x18, 0); + cx25840_and_or(client, 0x4a2, ~0x10, 0x10); + /* steps 8c and 8d are done in change_input() */ /* 10. */ cx25840_write(client, 0x8d3, 0x1f); cx25840_write(client, 0x8e3, 0x03); @@ -220,6 +220,17 @@ static void input_change(struct i2c_client *client) struct cx25840_state *state = i2c_get_clientdata(client); v4l2_std_id std = cx25840_get_v4lstd(client); + /* Follow step 8c and 8d of section 3.16 in the cx25840 datasheet */ + if (std & V4L2_STD_SECAM) { + cx25840_write(client, 0x402, 0); + } + else { + cx25840_write(client, 0x402, 0x04); + cx25840_write(client, 0x49f, (std & V4L2_STD_NTSC) ? 0x14 : 0x11); + } + cx25840_and_or(client, 0x401, ~0x60, 0); + cx25840_and_or(client, 0x401, ~0x60, 0x60); + /* Note: perhaps V4L2_STD_PAL_M should be handled as V4L2_STD_NTSC instead of V4L2_STD_PAL. Someone needs to test this. */ if (std & V4L2_STD_PAL) { @@ -354,6 +365,15 @@ static int set_v4lstd(struct i2c_client *client, v4l2_std_id std) } } + /* Follow step 9 of section 3.16 in the cx25840 datasheet. + Without this PAL may display a vertical ghosting effect. + This happens for example with the Yuan MPC622. */ + if (fmt >= 4 && fmt < 8) { + /* Set format to NTSC-M */ + cx25840_and_or(client, 0x400, ~0xf, 1); + /* Turn off LCOMB */ + cx25840_and_or(client, 0x47b, ~6, 0); + } cx25840_and_or(client, 0x400, ~0xf, fmt); cx25840_vbi_setup(client); return 0; @@ -370,7 +390,14 @@ v4l2_std_id cx25840_get_v4lstd(struct i2c_client * client) } switch (fmt) { - case 0x1: return V4L2_STD_NTSC_M | V4L2_STD_NTSC_M_KR; + case 0x1: + { + /* if the audio std is A2-M, then this is the South Korean + NTSC standard */ + if (cx25840_read(client, 0x805) == 2) + return V4L2_STD_NTSC_M_KR; + return V4L2_STD_NTSC_M; + } case 0x2: return V4L2_STD_NTSC_M_JP; case 0x3: return V4L2_STD_NTSC_443; case 0x4: return V4L2_STD_PAL; -- cgit v1.2.3 From 62643984d9d829c44ce1848355c3d07930b54847 Mon Sep 17 00:00:00 2001 From: Patrick Boettcher Date: Sat, 18 Mar 2006 18:13:22 +0100 Subject: Make hotplug automatically load the b2c2-flexcop-usb module From: Patrick Boettcher There was no MODULE_DEVICE_TABLE for the b2c2-flexcop-usb module. This makes it impossible for hotplug to load the module automatically, when such a device is connected. Signed-off-by: Patrick Boettcher --- linux/drivers/media/dvb/b2c2/flexcop-usb.c | 1 + 1 file changed, 1 insertion(+) (limited to 'linux/drivers/media') diff --git a/linux/drivers/media/dvb/b2c2/flexcop-usb.c b/linux/drivers/media/dvb/b2c2/flexcop-usb.c index 78e0adf0f..c29abd803 100644 --- a/linux/drivers/media/dvb/b2c2/flexcop-usb.c +++ b/linux/drivers/media/dvb/b2c2/flexcop-usb.c @@ -541,6 +541,7 @@ static struct usb_device_id flexcop_usb_table [] = { { USB_DEVICE(0x0af7, 0x0101) }, { } }; +MODULE_DEVICE_TABLE (usb, flexcop_usb_table); /* usb specific object needed to register this driver with the usb subsystem */ static struct usb_driver flexcop_usb_driver = { -- cgit v1.2.3 From 815e19f2f48c5a8e920be81523aca51206d7750b Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sat, 18 Mar 2006 14:12:43 -0500 Subject: fix build for kernels prior to 2.6.13 From: Michael Krufky +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13) +static unsigned short normal_i2c_range[] = { I2C_CLIENT_END }; +#endif /* magic definition of all other variables and things */ I2C_CLIENT_INSMOD; Signed-off-by: Michael Krufky --- linux/drivers/media/video/tda9840.c | 3 +++ linux/drivers/media/video/tea6415c.c | 3 +++ linux/drivers/media/video/tea6420.c | 3 +++ 3 files changed, 9 insertions(+) (limited to 'linux/drivers/media') diff --git a/linux/drivers/media/video/tda9840.c b/linux/drivers/media/video/tda9840.c index 4677399db..42a842aec 100644 --- a/linux/drivers/media/video/tda9840.c +++ b/linux/drivers/media/video/tda9840.c @@ -46,6 +46,9 @@ MODULE_PARM_DESC(debug, "Turn on/off device debugging (default:off)."); /* addresses to scan, found only at 0x42 (7-Bit) */ static unsigned short normal_i2c[] = { I2C_ADDR_TDA9840, I2C_CLIENT_END }; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13) +static unsigned short normal_i2c_range[] = { I2C_CLIENT_END }; +#endif /* magic definition of all other variables and things */ I2C_CLIENT_INSMOD; diff --git a/linux/drivers/media/video/tea6415c.c b/linux/drivers/media/video/tea6415c.c index 12e83ad21..98434efb0 100644 --- a/linux/drivers/media/video/tea6415c.c +++ b/linux/drivers/media/video/tea6415c.c @@ -46,6 +46,9 @@ MODULE_PARM_DESC(debug, "Turn on/off device debugging (default:off)."); /* addresses to scan, found only at 0x03 and/or 0x43 (7-bit) */ static unsigned short normal_i2c[] = { I2C_TEA6415C_1, I2C_TEA6415C_2, I2C_CLIENT_END }; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13) +static unsigned short normal_i2c_range[] = { I2C_CLIENT_END }; +#endif /* magic definition of all other variables and things */ I2C_CLIENT_INSMOD; diff --git a/linux/drivers/media/video/tea6420.c b/linux/drivers/media/video/tea6420.c index 27454cbb8..b5e41f49b 100644 --- a/linux/drivers/media/video/tea6420.c +++ b/linux/drivers/media/video/tea6420.c @@ -43,6 +43,9 @@ MODULE_PARM_DESC(debug, "Turn on/off device debugging (default:off)."); /* addresses to scan, found only at 0x4c and/or 0x4d (7-Bit) */ static unsigned short normal_i2c[] = { I2C_ADDR_TEA6420_1, I2C_ADDR_TEA6420_2, I2C_CLIENT_END }; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13) +static unsigned short normal_i2c_range[] = { I2C_CLIENT_END }; +#endif /* magic definition of all other variables and things */ I2C_CLIENT_INSMOD; -- cgit v1.2.3 From b1514075fbc51cbbc601923e46c565c87836af75 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sat, 18 Mar 2006 16:36:44 -0500 Subject: Kconfig: fix title and description for VIDEO_CX88_ALSA From: Michael Krufky Signed-off-by: Michael Krufky --- linux/drivers/media/video/cx88/Kconfig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'linux/drivers/media') diff --git a/linux/drivers/media/video/cx88/Kconfig b/linux/drivers/media/video/cx88/Kconfig index e140996e6..ff0f72340 100644 --- a/linux/drivers/media/video/cx88/Kconfig +++ b/linux/drivers/media/video/cx88/Kconfig @@ -16,12 +16,13 @@ config VIDEO_CX88 module will be called cx8800 config VIDEO_CX88_ALSA - tristate "ALSA DMA audio support" + tristate "Conexant 2388x DMA audio support" depends on VIDEO_CX88 && SND && EXPERIMENTAL select SND_PCM ---help--- This is a video4linux driver for direct (DMA) audio on - Conexant 2388x based TV cards. + Conexant 2388x based TV cards using ALSA. + It only works with boards with function 01 enabled. To check if your board supports, use lspci -n. If supported, you should see 1471:8801 or 1471:8811 -- cgit v1.2.3