diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-23 21:12:49 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-23 21:12:49 -0700 |
commit | df462b3dbeeaae7141f1b63cbfcc1e1bae6a85fc (patch) | |
tree | bca52fce066159f136d75c69e79016422212cb1d /drivers/staging | |
parent | 343800e7d20944aead238c2c6e3f7789f8b6587c (diff) | |
parent | cf25220677b3f10468a74278130fe224f73632a6 (diff) |
Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6
* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6: (247 commits)
[media] gspca - sunplus: Fix some warnings and simplify code
[media] gspca: Fix some warnings tied to 'no debug'
[media] gspca: Unset debug by default
[media] gspca - cpia1: Remove a bad conditional compilation instruction
[media] gspca - main: Remove USB traces
[media] gspca - main: Version change to 2.13
[media] gspca - stk014 / t613: Accept the index 0 in querymenu
[media] gspca - kinect: Remove __devinitdata
[media] gspca - cpia1: Fix some warnings
[media] video/Kconfig: Fix mis-classified devices
[media] support for medion dvb stick 1660:1921
[media] tm6000: fix uninitialized field, change prink to dprintk
[media] cx231xx: Add support for Iconbit U100
[media] saa7134 add new TV cards
[media] Use a more consistent value for RC repeat period
[media] cx18: Move spinlock and vb_type initialisation into stream_init
[media] tm6000: remove tm6010 sif audio start and stop
[media] tm6000: remove unused exports
[media] tm6000: add pts logging
[media] tm6000: change from ioctl to unlocked_ioctl
...
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/lirc/lirc_sasem.c | 13 | ||||
-rw-r--r-- | drivers/staging/tm6000/CARDLIST | 16 | ||||
-rw-r--r-- | drivers/staging/tm6000/tm6000-alsa.c | 3 | ||||
-rw-r--r-- | drivers/staging/tm6000/tm6000-cards.c | 381 | ||||
-rw-r--r-- | drivers/staging/tm6000/tm6000-core.c | 109 | ||||
-rw-r--r-- | drivers/staging/tm6000/tm6000-i2c.c | 33 | ||||
-rw-r--r-- | drivers/staging/tm6000/tm6000-stds.c | 923 | ||||
-rw-r--r-- | drivers/staging/tm6000/tm6000-usb-isoc.h | 2 | ||||
-rw-r--r-- | drivers/staging/tm6000/tm6000-video.c | 212 | ||||
-rw-r--r-- | drivers/staging/tm6000/tm6000.h | 46 |
10 files changed, 781 insertions, 957 deletions
diff --git a/drivers/staging/lirc/lirc_sasem.c b/drivers/staging/lirc/lirc_sasem.c index 63a438d1c84..7080cdeab5a 100644 --- a/drivers/staging/lirc/lirc_sasem.c +++ b/drivers/staging/lirc/lirc_sasem.c @@ -570,6 +570,7 @@ static void incoming_packet(struct sasem_context *context, unsigned char *buf = urb->transfer_buffer; long ms; struct timeval tv; + int i; if (len != 8) { printk(KERN_WARNING "%s: invalid incoming packet size (%d)\n", @@ -577,12 +578,12 @@ static void incoming_packet(struct sasem_context *context, return; } -#ifdef DEBUG - int i; - for (i = 0; i < 8; ++i) - printk(KERN_INFO "%02x ", buf[i]); - printk(KERN_INFO "\n"); -#endif + if (debug) { + printk(KERN_INFO "Incoming data: "); + for (i = 0; i < 8; ++i) + printk(KERN_CONT "%02x ", buf[i]); + printk(KERN_CONT "\n"); + } /* * Lirc could deal with the repeat code, but we really need to block it diff --git a/drivers/staging/tm6000/CARDLIST b/drivers/staging/tm6000/CARDLIST new file mode 100644 index 00000000000..b5edce48799 --- /dev/null +++ b/drivers/staging/tm6000/CARDLIST @@ -0,0 +1,16 @@ + 1 -> Generic tm5600 board (tm5600) [6000:0001] + 2 -> Generic tm6000 board (tm6000) [6000:0001] + 3 -> Generic tm6010 board (tm6010) [6000:0002] + 4 -> 10Moons UT821 (tm5600) [6000:0001] + 5 -> 10Moons UT330 (tm5600) + 6 -> ADSTech Dual TV (tm6000) [06e1:f332] + 7 -> FreeCom and similar (tm6000) [14aa:0620] + 8 -> ADSTech Mini Dual TV (tm6000) [06e1:b339] + 9 -> Hauppauge WinTV HVR-900H/USB2 Stick (tm6010) [2040:6600,2040:6601,2040:6610,2040:6611] + 10 -> Beholder Wander (tm6010) [6000:dec0] + 11 -> Beholder Voyager (tm6010) [6000:dec1] + 12 -> TerraTec Cinergy Hybrid XE/Cinergy Hybrid Stick (tm6010) [0ccd:0086,0ccd:00a5] + 13 -> TwinHan TU501 (tm6010) [13d3:3240,13d3:3241,13d3:3243,13d3:3264] + 14 -> Beholder Wander Lite (tm6010) [6000:dec2] + 15 -> Beholder Voyager Lite (tm6010) [6000:dec3] + diff --git a/drivers/staging/tm6000/tm6000-alsa.c b/drivers/staging/tm6000/tm6000-alsa.c index acb03172a88..2b96047c298 100644 --- a/drivers/staging/tm6000/tm6000-alsa.c +++ b/drivers/staging/tm6000/tm6000-alsa.c @@ -84,7 +84,6 @@ static int _tm6000_start_audio_dma(struct snd_tm6000_card *chip) tm6000_set_audio_bitrate(core, 48000); - tm6000_set_reg(core, TM6010_REQ08_R01_A_INIT, 0x80); return 0; } @@ -101,8 +100,6 @@ static int _tm6000_stop_audio_dma(struct snd_tm6000_card *chip) /* Disables audio */ tm6000_set_reg_mask(core, TM6010_REQ07_RCC_ACTIVE_VIDEO_IF, 0x00, 0x40); - tm6000_set_reg(core, TM6010_REQ08_R01_A_INIT, 0); - return 0; } diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index 146c7e86dec..a69c82e1199 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -54,6 +54,11 @@ #define TM6010_BOARD_BEHOLD_VOYAGER_LITE 15 #define TM5600_BOARD_TERRATEC_GRABSTER 16 +#define is_generic(model) ((model == TM6000_BOARD_UNKNOWN) || \ + (model == TM5600_BOARD_GENERIC) || \ + (model == TM6000_BOARD_GENERIC) || \ + (model == TM6010_BOARD_GENERIC)) + #define TM6000_MAXBOARDS 16 static unsigned int card[] = {[0 ... (TM6000_MAXBOARDS - 1)] = UNSET }; @@ -64,10 +69,11 @@ static unsigned long tm6000_devused; struct tm6000_board { char *name; + char eename[16]; /* EEPROM name */ + unsigned eename_size; /* size of EEPROM name */ + unsigned eename_pos; /* Position where it appears at ROM */ struct tm6000_capabilities caps; - enum tm6000_inaudio aradio; - enum tm6000_inaudio avideo; enum tm6000_devtype type; /* variant of the chipset */ int tuner_type; /* type of the tuner */ @@ -76,6 +82,9 @@ struct tm6000_board { struct tm6000_gpio gpio; + struct tm6000_input vinput[3]; + struct tm6000_input rinput; + char *ir_codes; }; @@ -83,11 +92,26 @@ struct tm6000_board tm6000_boards[] = { [TM6000_BOARD_UNKNOWN] = { .name = "Unknown tm6000 video grabber", .caps = { - .has_tuner = 1, + .has_tuner = 1, + .has_eeprom = 1, }, .gpio = { .tuner_reset = TM6000_GPIO_1, }, + .vinput = { { + .type = TM6000_INPUT_TV, + .vmux = TM6000_VMUX_VIDEO_B, + .amux = TM6000_AMUX_ADC1, + }, { + .type = TM6000_INPUT_COMPOSITE1, + .vmux = TM6000_VMUX_VIDEO_A, + .amux = TM6000_AMUX_ADC2, + }, { + .type = TM6000_INPUT_SVIDEO, + .vmux = TM6000_VMUX_VIDEO_AB, + .amux = TM6000_AMUX_ADC2, + }, + }, }, [TM5600_BOARD_GENERIC] = { .name = "Generic tm5600 board", @@ -96,10 +120,25 @@ struct tm6000_board tm6000_boards[] = { .tuner_addr = 0xc2 >> 1, .caps = { .has_tuner = 1, + .has_eeprom = 1, }, .gpio = { .tuner_reset = TM6000_GPIO_1, }, + .vinput = { { + .type = TM6000_INPUT_TV, + .vmux = TM6000_VMUX_VIDEO_B, + .amux = TM6000_AMUX_ADC1, + }, { + .type = TM6000_INPUT_COMPOSITE1, + .vmux = TM6000_VMUX_VIDEO_A, + .amux = TM6000_AMUX_ADC2, + }, { + .type = TM6000_INPUT_SVIDEO, + .vmux = TM6000_VMUX_VIDEO_AB, + .amux = TM6000_AMUX_ADC2, + }, + }, }, [TM6000_BOARD_GENERIC] = { .name = "Generic tm6000 board", @@ -107,11 +146,25 @@ struct tm6000_board tm6000_boards[] = { .tuner_addr = 0xc2 >> 1, .caps = { .has_tuner = 1, - .has_dvb = 1, + .has_eeprom = 1, }, .gpio = { .tuner_reset = TM6000_GPIO_1, }, + .vinput = { { + .type = TM6000_INPUT_TV, + .vmux = TM6000_VMUX_VIDEO_B, + .amux = TM6000_AMUX_ADC1, + }, { + .type = TM6000_INPUT_COMPOSITE1, + .vmux = TM6000_VMUX_VIDEO_A, + .amux = TM6000_AMUX_ADC2, + }, { + .type = TM6000_INPUT_SVIDEO, + .vmux = TM6000_VMUX_VIDEO_AB, + .amux = TM6000_AMUX_ADC2, + }, + }, }, [TM6010_BOARD_GENERIC] = { .name = "Generic tm6010 board", @@ -135,10 +188,27 @@ struct tm6000_board tm6000_boards[] = { .dvb_led = TM6010_GPIO_5, .ir = TM6010_GPIO_0, }, + .vinput = { { + .type = TM6000_INPUT_TV, + .vmux = TM6000_VMUX_VIDEO_B, + .amux = TM6000_AMUX_SIF1, + }, { + .type = TM6000_INPUT_COMPOSITE1, + .vmux = TM6000_VMUX_VIDEO_A, + .amux = TM6000_AMUX_ADC2, + }, { + .type = TM6000_INPUT_SVIDEO, + .vmux = TM6000_VMUX_VIDEO_AB, + .amux = TM6000_AMUX_ADC2, + }, + }, }, [TM5600_BOARD_10MOONS_UT821] = { .name = "10Moons UT 821", .tuner_type = TUNER_XC2028, + .eename = { '1', '0', 'M', 'O', 'O', 'N', 'S', '5', '6', '0', '0', 0xff, 0x45, 0x5b}, + .eename_size = 14, + .eename_pos = 0x14, .type = TM5600, .tuner_addr = 0xc2 >> 1, .caps = { @@ -148,6 +218,20 @@ struct tm6000_board tm6000_boards[] = { .gpio = { .tuner_reset = TM6000_GPIO_1, }, + .vinput = { { + .type = TM6000_INPUT_TV, + .vmux = TM6000_VMUX_VIDEO_B, + .amux = TM6000_AMUX_ADC1, + }, { + .type = TM6000_INPUT_COMPOSITE1, + .vmux = TM6000_VMUX_VIDEO_A, + .amux = TM6000_AMUX_ADC2, + }, { + .type = TM6000_INPUT_SVIDEO, + .vmux = TM6000_VMUX_VIDEO_AB, + .amux = TM6000_AMUX_ADC2, + }, + }, }, [TM5600_BOARD_10MOONS_UT330] = { .name = "10Moons UT 330", @@ -159,6 +243,20 @@ struct tm6000_board tm6000_boards[] = { .has_zl10353 = 0, .has_eeprom = 1, }, + .vinput = { { + .type = TM6000_INPUT_TV, + .vmux = TM6000_VMUX_VIDEO_B, + .amux = TM6000_AMUX_ADC1, + }, { + .type = TM6000_INPUT_COMPOSITE1, + .vmux = TM6000_VMUX_VIDEO_A, + .amux = TM6000_AMUX_ADC2, + }, { + .type = TM6000_INPUT_SVIDEO, + .vmux = TM6000_VMUX_VIDEO_AB, + .amux = TM6000_AMUX_ADC2, + }, + }, }, [TM6000_BOARD_ADSTECH_DUAL_TV] = { .name = "ADSTECH Dual TV USB", @@ -171,6 +269,20 @@ struct tm6000_board tm6000_boards[] = { .has_zl10353 = 1, .has_eeprom = 1, }, + .vinput = { { + .type = TM6000_INPUT_TV, + .vmux = TM6000_VMUX_VIDEO_B, + .amux = TM6000_AMUX_ADC1, + }, { + .type = TM6000_INPUT_COMPOSITE1, + .vmux = TM6000_VMUX_VIDEO_A, + .amux = TM6000_AMUX_ADC2, + }, { + .type = TM6000_INPUT_SVIDEO, + .vmux = TM6000_VMUX_VIDEO_AB, + .amux = TM6000_AMUX_ADC2, + }, + }, }, [TM6000_BOARD_FREECOM_AND_SIMILAR] = { .name = "Freecom Hybrid Stick / Moka DVB-T Receiver Dual", @@ -187,6 +299,20 @@ struct tm6000_board tm6000_boards[] = { .gpio = { .tuner_reset = TM6000_GPIO_4, }, + .vinput = { { + .type = TM6000_INPUT_TV, + .vmux = TM6000_VMUX_VIDEO_B, + .amux = TM6000_AMUX_ADC1, + }, { + .type = TM6000_INPUT_COMPOSITE1, + .vmux = TM6000_VMUX_VIDEO_A, + .amux = TM6000_AMUX_ADC2, + }, { + .type = TM6000_INPUT_SVIDEO, + .vmux = TM6000_VMUX_VIDEO_AB, + .amux = TM6000_AMUX_ADC2, + }, + }, }, [TM6000_BOARD_ADSTECH_MINI_DUAL_TV] = { .name = "ADSTECH Mini Dual TV USB", @@ -202,9 +328,26 @@ struct tm6000_board tm6000_boards[] = { .gpio = { .tuner_reset = TM6000_GPIO_4, }, + .vinput = { { + .type = TM6000_INPUT_TV, + .vmux = TM6000_VMUX_VIDEO_B, + .amux = TM6000_AMUX_ADC1, + }, { + .type = TM6000_INPUT_COMPOSITE1, + .vmux = TM6000_VMUX_VIDEO_A, + .amux = TM6000_AMUX_ADC2, + }, { + .type = TM6000_INPUT_SVIDEO, + .vmux = TM6000_VMUX_VIDEO_AB, + .amux = TM6000_AMUX_ADC2, + }, + }, }, [TM6010_BOARD_HAUPPAUGE_900H] = { .name = "Hauppauge WinTV HVR-900H / WinTV USB2-Stick", + .eename = { 'H', 0, 'V', 0, 'R', 0, '9', 0, '0', 0, '0', 0, 'H', 0 }, + .eename_size = 14, + .eename_pos = 0x42, .tuner_type = TUNER_XC2028, /* has a XC3028 */ .tuner_addr = 0xc2 >> 1, .demod_addr = 0x1e >> 1, @@ -225,6 +368,20 @@ struct tm6000_board tm6000_boards[] = { .dvb_led = TM6010_GPIO_5, .ir = TM6010_GPIO_0, }, + .vinput = { { + .type = TM6000_INPUT_TV, + .vmux = TM6000_VMUX_VIDEO_B, + .amux = TM6000_AMUX_SIF1, + }, { + .type = TM6000_INPUT_COMPOSITE1, + .vmux = TM6000_VMUX_VIDEO_A, + .amux = TM6000_AMUX_ADC2, + }, { + .type = TM6000_INPUT_SVIDEO, + .vmux = TM6000_VMUX_VIDEO_AB, + .amux = TM6000_AMUX_ADC2, + }, + }, }, [TM6010_BOARD_BEHOLD_WANDER] = { .name = "Beholder Wander DVB-T/TV/FM USB2.0", @@ -232,43 +389,73 @@ struct tm6000_board tm6000_boards[] = { .tuner_addr = 0xc2 >> 1, .demod_addr = 0x1e >> 1, .type = TM6010, - .avideo = TM6000_AIP_SIF1, - .aradio = TM6000_AIP_LINE1, .caps = { .has_tuner = 1, .has_dvb = 1, .has_zl10353 = 1, .has_eeprom = 1, .has_remote = 1, - .has_input_comp = 1, - .has_input_svid = 1, + .has_radio = 1. }, .gpio = { .tuner_reset = TM6010_GPIO_0, .demod_reset = TM6010_GPIO_1, .power_led = TM6010_GPIO_6, }, + .vinput = { { + .type = TM6000_INPUT_TV, + .vmux = TM6000_VMUX_VIDEO_B, + .amux = TM6000_AMUX_SIF1, + }, { + .type = TM6000_INPUT_COMPOSITE1, + .vmux = TM6000_VMUX_VIDEO_A, + .amux = TM6000_AMUX_ADC2, + }, { + .type = TM6000_INPUT_SVIDEO, + .vmux = TM6000_VMUX_VIDEO_AB, + .amux = TM6000_AMUX_ADC2, + }, + }, + .rinput = { + .type = TM6000_INPUT_RADIO, + .amux = TM6000_AMUX_ADC1, + }, }, [TM6010_BOARD_BEHOLD_VOYAGER] = { .name = "Beholder Voyager TV/FM USB2.0", .tuner_type = TUNER_XC5000, .tuner_addr = 0xc2 >> 1, .type = TM6010, - .avideo = TM6000_AIP_SIF1, - .aradio = TM6000_AIP_LINE1, .caps = { .has_tuner = 1, .has_dvb = 0, .has_zl10353 = 0, .has_eeprom = 1, .has_remote = 1, - .has_input_comp = 1, - .has_input_svid = 1, + .has_radio = 1, }, .gpio = { .tuner_reset = TM6010_GPIO_0, .power_led = TM6010_GPIO_6, }, + .vinput = { { + .type = TM6000_INPUT_TV, + .vmux = TM6000_VMUX_VIDEO_B, + .amux = TM6000_AMUX_SIF1, + }, { + .type = TM6000_INPUT_COMPOSITE1, + .vmux = TM6000_VMUX_VIDEO_A, + .amux = TM6000_AMUX_ADC2, + }, { + .type = TM6000_INPUT_SVIDEO, + .vmux = TM6000_VMUX_VIDEO_AB, + .amux = TM6000_AMUX_ADC2, + }, + }, + .rinput = { + .type = TM6000_INPUT_RADIO, + .amux = TM6000_AMUX_ADC1, + }, }, [TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE] = { .name = "Terratec Cinergy Hybrid XE / Cinergy Hybrid-Stick", @@ -293,11 +480,39 @@ struct tm6000_board tm6000_boards[] = { .ir = TM6010_GPIO_0, }, .ir_codes = RC_MAP_NEC_TERRATEC_CINERGY_XS, + .vinput = { { + .type = TM6000_INPUT_TV, + .vmux = TM6000_VMUX_VIDEO_B, + .amux = TM6000_AMUX_SIF1, + }, { + .type = TM6000_INPUT_COMPOSITE1, + .vmux = TM6000_VMUX_VIDEO_A, + .amux = TM6000_AMUX_ADC2, + }, { + .type = TM6000_INPUT_SVIDEO, + .vmux = TM6000_VMUX_VIDEO_AB, + .amux = TM6000_AMUX_ADC2, + }, + }, }, [TM5600_BOARD_TERRATEC_GRABSTER] = { .name = "Terratec Grabster AV 150/250 MX", .type = TM5600, .tuner_type = TUNER_ABSENT, + .vinput = { { + .type = TM6000_INPUT_TV, + .vmux = TM6000_VMUX_VIDEO_B, + .amux = TM6000_AMUX_ADC1, + }, { + .type = TM6000_INPUT_COMPOSITE1, + .vmux = TM6000_VMUX_VIDEO_A, + .amux = TM6000_AMUX_ADC2, + }, { + .type = TM6000_INPUT_SVIDEO, + .vmux = TM6000_VMUX_VIDEO_AB, + .amux = TM6000_AMUX_ADC2, + }, + }, }, [TM6010_BOARD_TWINHAN_TU501] = { .name = "Twinhan TU501(704D1)", @@ -321,6 +536,20 @@ struct tm6000_board tm6000_boards[] = { .dvb_led = TM6010_GPIO_5, .ir = TM6010_GPIO_0, }, + .vinput = { { + .type = TM6000_INPUT_TV, + .vmux = TM6000_VMUX_VIDEO_B, + .amux = TM6000_AMUX_SIF1, + }, { + .type = TM6000_INPUT_COMPOSITE1, + .vmux = TM6000_VMUX_VIDEO_A, + .amux = TM6000_AMUX_ADC2, + }, { + .type = TM6000_INPUT_SVIDEO, + .vmux = TM6000_VMUX_VIDEO_AB, + .amux = TM6000_AMUX_ADC2, + }, + }, }, [TM6010_BOARD_BEHOLD_WANDER_LITE] = { .name = "Beholder Wander Lite DVB-T/TV/FM USB2.0", @@ -328,49 +557,63 @@ struct tm6000_board tm6000_boards[] = { .tuner_addr = 0xc2 >> 1, .demod_addr = 0x1e >> 1, .type = TM6010, - .avideo = TM6000_AIP_SIF1, - .aradio = TM6000_AIP_LINE1, .caps = { .has_tuner = 1, .has_dvb = 1, .has_zl10353 = 1, .has_eeprom = 1, .has_remote = 0, - .has_input_comp = 0, - .has_input_svid = 0, + .has_radio = 1, }, .gpio = { .tuner_reset = TM6010_GPIO_0, .demod_reset = TM6010_GPIO_1, .power_led = TM6010_GPIO_6, }, + .vinput = { { + .type = TM6000_INPUT_TV, + .vmux = TM6000_VMUX_VIDEO_B, + .amux = TM6000_AMUX_SIF1, + }, + }, + .rinput = { + .type = TM6000_INPUT_RADIO, + .amux = TM6000_AMUX_ADC1, + }, }, [TM6010_BOARD_BEHOLD_VOYAGER_LITE] = { .name = "Beholder Voyager Lite TV/FM USB2.0", .tuner_type = TUNER_XC5000, .tuner_addr = 0xc2 >> 1, .type = TM6010, - .avideo = TM6000_AIP_SIF1, - .aradio = TM6000_AIP_LINE1, .caps = { .has_tuner = 1, .has_dvb = 0, .has_zl10353 = 0, .has_eeprom = 1, .has_remote = 0, - .has_input_comp = 0, - .has_input_svid = 0, + .has_radio = 1, }, .gpio = { .tuner_reset = TM6010_GPIO_0, .power_led = TM6010_GPIO_6, }, + .vinput = { { + .type = TM6000_INPUT_TV, + .vmux = TM6000_VMUX_VIDEO_B, + .amux = TM6000_AMUX_SIF1, + }, + }, + .rinput = { + .type = TM6000_INPUT_RADIO, + .amux = TM6000_AMUX_ADC1, + }, }, }; /* table of devices that work with this driver */ struct usb_device_id tm6000_id_table[] = { - { USB_DEVICE(0x6000, 0x0001), .driver_info = TM5600_BOARD_10MOONS_UT821 }, + { USB_DEVICE(0x6000, 0x0001), .driver_info = TM5600_BOARD_GENERIC }, { USB_DEVICE(0x6000, 0x0002), .driver_info = TM6010_BOARD_GENERIC }, { USB_DEVICE(0x06e1, 0xf332), .driver_info = TM6000_BOARD_ADSTECH_DUAL_TV }, { USB_DEVICE(0x14aa, 0x0620), .driver_info = TM6000_BOARD_FREECOM_AND_SIMILAR }, @@ -679,12 +922,8 @@ static void tm6000_config_tuner(struct tm6000_core *dev) memset(&xc2028_cfg, 0, sizeof(xc2028_cfg)); memset(&ctl, 0, sizeof(ctl)); - ctl.input1 = 1; - ctl.read_not_reliable = 0; - ctl.msleep = 10; ctl.demod = XC3028_FE_ZARLINK456; - ctl.vhfbw7 = 1; - ctl.uhfbw8 = 1; + xc2028_cfg.tuner = TUNER_XC2028; xc2028_cfg.priv = &ctl; @@ -729,16 +968,10 @@ static void tm6000_config_tuner(struct tm6000_core *dev) } } -static int tm6000_init_dev(struct tm6000_core *dev) +static int fill_board_specific_data(struct tm6000_core *dev) { - struct v4l2_frequency f; - int rc = 0; - - mutex_init(&dev->lock); - - mutex_lock(&dev->lock); + int rc; - /* Initializa board-specific data */ dev->dev_type = tm6000_boards[dev->model].type; dev->tuner_type = tm6000_boards[dev->model].tuner_type; dev->tuner_addr = tm6000_boards[dev->model].tuner_addr; @@ -751,21 +984,85 @@ static int tm6000_init_dev(struct tm6000_core *dev) dev->caps = tm6000_boards[dev->model].caps; - dev->avideo = tm6000_boards[dev->model].avideo; - dev->aradio = tm6000_boards[dev->model].aradio; + dev->vinput[0] = tm6000_boards[dev->model].vinput[0]; + dev->vinput[1] = tm6000_boards[dev->model].vinput[1]; + dev->vinput[2] = tm6000_boards[dev->model].vinput[2]; + dev->rinput = tm6000_boards[dev->model].rinput; + /* initialize hardware */ rc = tm6000_init(dev); if (rc < 0) - goto err; + return rc; rc = v4l2_device_register(&dev->udev->dev, &dev->v4l2_dev); if (rc < 0) - goto err; + return rc; - /* register i2c bus */ - rc = tm6000_i2c_register(dev); - if (rc < 0) - goto err; + return rc; +} + + +static void use_alternative_detection_method(struct tm6000_core *dev) +{ + int i, model = -1; + + if (!dev->eedata_size) + return; + + for (i = 0; i < ARRAY_SIZE(tm6000_boards); i++) { + if (!tm6000_boards[i].eename_size) + continue; + if (dev->eedata_size < tm6000_boards[i].eename_pos + + tm6000_boards[i].eename_size) + continue; + + if (!memcmp(&dev->eedata[tm6000_boards[i].eename_pos], + tm6000_boards[i].eename, + tm6000_boards[i].eename_size)) { + model = i; + break; + } + } + if (model < 0) { + printk(KERN_INFO "Device has eeprom but is currently unknown\n"); + return; + } + + dev->model = model; + + printk(KERN_INFO "Device identified via eeprom as %s (type = %d)\n", + tm6000_boards[model].name, model); +} + +static int tm6000_init_dev(struct tm6000_core *dev) +{ + struct v4l2_frequency f; + int rc = 0; + + mutex_init(&dev->lock); + mutex_lock(&dev->lock); + + if (!is_generic(dev->model)) { + rc = fill_board_specific_data(dev); + if (rc < 0) + goto err; + + /* register i2c bus */ + rc = tm6000_i2c_register(dev); + if (rc < 0) + goto err; + } else { + /* register i2c bus */ + rc = tm6000_i2c_register(dev); + if (rc < 0) + goto err; + + use_alternative_detection_method(dev); + + rc = fill_board_specific_data(dev); + if (rc < 0) + goto err; + } /* Default values for STD and resolutions */ dev->width = 720; diff --git a/drivers/staging/tm6000/tm6000-core.c b/drivers/staging/tm6000/tm6000-core.c index 778e53413af..d7eb2e23cdb 100644 --- a/drivers/staging/tm6000/tm6000-core.c +++ b/drivers/staging/tm6000/tm6000-core.c @@ -268,19 +268,18 @@ int tm6000_init_analog_mode(struct tm6000_core *dev) struct v4l2_frequency f; if (dev->dev_type == TM6010) { - /* Enable video */ - + /* Enable video and audio */ tm6000_set_reg_mask(dev, TM6010_REQ07_RCC_ACTIVE_VIDEO_IF, 0x60, 0x60); + /* Disable TS input */ tm6000_set_reg_mask(dev, TM6010_REQ07_RC0_ACTIVE_VIDEO_SOURCE, 0x00, 0x40); - tm6000_set_reg(dev, TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc); - } else { /* Enables soft reset */ tm6000_set_reg(dev, TM6010_REQ07_R3F_RESET, 0x01); if (dev->scaler) + /* Disable Hfilter and Enable TS Drop err */ tm6000_set_reg(dev, TM6010_REQ07_RC0_ACTIVE_VIDEO_SOURCE, 0x20); else /* Enable Hfilter and disable TS Drop err */ tm6000_set_reg(dev, TM6010_REQ07_RC0_ACTIVE_VIDEO_SOURCE, 0x80); @@ -300,14 +299,6 @@ int tm6000_init_analog_mode(struct tm6000_core *dev) /* Disables soft reset */ tm6000_set_reg(dev, TM6010_REQ07_R3F_RESET, 0x00); - - /* E3: Select input 0 - TV tuner */ - tm6000_set_reg(dev, TM6000_REQ07_RE3_VADC_INP_LPF_SEL1, 0x00); - tm6000_set_reg(dev, TM6000_REQ07_REB_VADC_AADC_MODE, 0x60); - - /* This controls input */ - tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, TM6000_GPIO_2, 0x0); - tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, TM6000_GPIO_3, 0x01); } msleep(20); @@ -327,7 +318,7 @@ int tm6000_init_analog_mode(struct tm6000_core *dev) v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, &f); msleep(100); - tm6000_set_standard(dev, &dev->norm); + tm6000_set_standard(dev); tm6000_set_vbi(dev); tm6000_set_audio_bitrate(dev, 48000); @@ -343,21 +334,16 @@ int tm6000_init_analog_mode(struct tm6000_core *dev) int tm6000_init_digital_mode(struct tm6000_core *dev) { if (dev->dev_type == TM6010) { - int val; - u8 buf[2]; - - /* digital init */ - val = tm6000_get_reg(dev, TM6010_REQ07_RCC_ACTIVE_VIDEO_IF, 0); - val &= ~0x60; - tm6000_set_reg(dev, TM6010_REQ07_RCC_ACTIVE_VIDEO_IF, val); - val = tm6000_get_reg(dev, TM6010_REQ07_RC0_ACTIVE_VIDEO_SOURCE, 0); - val |= 0x40; - tm6000_set_reg(dev, TM6010_REQ07_RC0_ACTIVE_VIDEO_SOURCE, val); + /* Disable video and audio */ + tm6000_set_reg_mask(dev, TM6010_REQ07_RCC_ACTIVE_VIDEO_IF, + 0x00, 0x60); + /* Enable TS input */ + tm6000_set_reg_mask(dev, TM6010_REQ07_RC0_ACTIVE_VIDEO_SOURCE, + 0x40, 0x40); + /* all power down, but not the digital data port */ tm6000_set_reg(dev, TM6010_REQ07_RFE_POWER_DOWN, 0x28); tm6000_set_reg(dev, TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xfc); tm6000_set_reg(dev, TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0xff); - tm6000_read_write_usb(dev, 0xc0, 0x0e, 0x00c2, 0x0008, buf, 2); - printk(KERN_INFO"buf %#x %#x\n", buf[0], buf[1]); } else { tm6000_set_reg(dev, TM6010_REQ07_RFF_SOFT_RESET, 0x08); tm6000_set_reg(dev, TM6010_REQ07_RFF_SOFT_RESET, 0x00); @@ -489,14 +475,6 @@ struct reg_init tm6010_init_tab[] = { { TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xf0 }, { TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2 }, { TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x60 }, - { TM6010_REQ08_R03_A_AUTO_GAIN_CTRL, 0x00}, - { TM6010_REQ08_R04_A_SIF_AMP_CTRL, 0x80}, - { TM6010_REQ08_R0C_A_ASD_THRES2, 0x0a}, - { TM6010_REQ08_R0D_A_AMD_THRES, 0x40}, - { TM6010_REQ08_R1A_A_NICAM_SER_MAX, 0x64}, - { TM6010_REQ08_R1B_A_NICAM_SER_MIN, 0x20}, - { TM6010_REQ08_R16_A_AGC_GAIN_MAX, 0xfe}, - { TM6010_REQ08_R17_A_AGC_GAIN_MIN, 0x01}, { TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc }, { TM6010_REQ07_R3F_RESET, 0x01 }, @@ -657,24 +635,29 @@ int tm6000_set_audio_bitrate(struct tm6000_core *dev, int bitrate) } EXPORT_SYMBOL_GPL(tm6000_set_audio_bitrate); -int tm6000_set_audio_input(struct tm6000_core *dev, enum tm6000_inaudio ainp) +int tm6000_set_audio_rinput(struct tm6000_core *dev) { if (dev->dev_type == TM6010) { /* Audio crossbar setting, default SIF1 */ - u8 areg_f0 = 0x03; + u8 areg_f0; - switch (ainp) { - case TM6000_AIP_SIF1: - case TM6000_AIP_SIF2: + switch (dev->rinput.amux) { + case TM6000_AMUX_SIF1: + case TM6000_AMUX_SIF2: areg_f0 = 0x03; break; - case TM6000_AIP_LINE1: + case TM6000_AMUX_ADC1: areg_f0 = 0x00; break; - case TM6000_AIP_LINE2: + case TM6000_AMUX_ADC2: areg_f0 = 0x08; break; + case TM6000_AMUX_I2S: + areg_f0 = 0x04; + break; default: + printk(KERN_INFO "%s: audio input dosn't support\n", + dev->name); return 0; break; } @@ -682,17 +665,18 @@ int tm6000_set_audio_input(struct tm6000_core *dev, enum tm6000_inaudio ainp) tm6000_set_reg_mask(dev, TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, areg_f0, 0x0f); } else { + u8 areg_eb; /* Audio setting, default LINE1 */ - u8 areg_eb = 0x00; - - switch (ainp) { - case TM6000_AIP_LINE1: + switch (dev->rinput.amux) { + case TM6000_AMUX_ADC1: areg_eb = 0x00; break; - case TM6000_AIP_LINE2: + case TM6000_AMUX_ADC2: areg_eb = 0x04; break; default: + printk(KERN_INFO "%s: audio input dosn't support\n", + dev->name); return 0; break; } @@ -702,7 +686,6 @@ int tm6000_set_audio_input(struct tm6000_core *dev, enum tm6000_inaudio ainp) } return 0; } -EXPORT_SYMBOL_GPL(tm6000_set_audio_input); void tm6010_set_mute_sif(struct tm6000_core *dev, u8 mute) { @@ -736,16 +719,16 @@ void tm6010_set_mute_adc(struct tm6000_core *dev, u8 mute) int tm6000_tvaudio_set_mute(struct tm6000_core *dev, u8 mute) { - enum tm6000_inaudio ainp; + enum tm6000_mux mux; if (dev->radio) - ainp = dev->aradio; + mux = dev->rinput.amux; else - ainp = dev->avideo; + mux = dev->vinput[dev->input].amux; - switch (ainp) { - case TM6000_AIP_SIF1: - case TM6000_AIP_SIF2: + switch (mux) { + case TM6000_AMUX_SIF1: + case TM6000_AMUX_SIF2: if (dev->dev_type == TM6010) tm6010_set_mute_sif(dev, mute); else { @@ -755,8 +738,8 @@ int tm6000_tvaudio_set_mute(struct tm6000_core *dev, u8 mute) return -EINVAL; } break; - case TM6000_AIP_LINE1: - case TM6000_AIP_LINE2: + case TM6000_AMUX_ADC1: + case TM6000_AMUX_ADC2: tm6010_set_mute_adc(dev, mute); break; default: @@ -765,7 +748,6 @@ int tm6000_tvaudio_set_mute(struct tm6000_core *dev, u8 mute) } return 0; } -EXPORT_SYMBOL_GPL(tm6000_tvaudio_set_mute); void tm6010_set_volume_sif(struct tm6000_core *dev, int vol) { @@ -797,17 +779,17 @@ void tm6010_set_volume_adc(struct tm6000_core *dev, int vol) void tm6000_set_volume(struct tm6000_core *dev, int vol) { - enum tm6000_inaudio ainp; + enum tm6000_mux mux; if (dev->radio) { - ainp = dev->aradio; + mux = dev->rinput.amux; vol += 8; /* Offset to 0 dB */ } else - ainp = dev->avideo; + mux = dev->vinput[dev->input].amux; - switch (ainp) { - case TM6000_AIP_SIF1: - case TM6000_AIP_SIF2: + switch (mux) { + case TM6000_AMUX_SIF1: + case TM6000_AMUX_SIF2: if (dev->dev_type == TM6010) tm6010_set_volume_sif(dev, vol); else @@ -815,15 +797,14 @@ void tm6000_set_volume(struct tm6000_core *dev, int vol) " SIF audio inputs. Please check the %s" " configuration.\n", dev->name); break; - case TM6000_AIP_LINE1: - case TM6000_AIP_LINE2: + case TM6000_AMUX_ADC1: + case TM6000_AMUX_ADC2: tm6010_set_volume_adc(dev, vol); break; default: break; } } -EXPORT_SYMBOL_GPL(tm6000_set_volume); static LIST_HEAD(tm6000_devlist); static DEFINE_MUTEX(tm6000_devlist_mutex); diff --git a/drivers/staging/tm6000/tm6000-i2c.c b/drivers/staging/tm6000/tm6000-i2c.c index 18de4748f27..8828c120b5c 100644 --- a/drivers/staging/tm6000/tm6000-i2c.c +++ b/drivers/staging/tm6000/tm6000-i2c.c @@ -237,35 +237,36 @@ err: return rc; } -static int tm6000_i2c_eeprom(struct tm6000_core *dev, - unsigned char *eedata, int len) +static int tm6000_i2c_eeprom(struct tm6000_core *dev) { int i, rc; - unsigned char *p = eedata; + unsigned char *p = dev->eedata; unsigned char bytes[17]; dev->i2c_client.addr = 0xa0 >> 1; + dev->eedata_size = 0; bytes[16] = '\0'; - for (i = 0; i < len; ) { - *p = i; - rc = tm6000_i2c_recv_regs(dev, 0xa0, i, p, 1); + for (i = 0; i < sizeof(dev->eedata); ) { + *p = i; + rc = tm6000_i2c_recv_regs(dev, 0xa0, i, p, 1); if (rc < 1) { - if (p == eedata) + if (p == dev->eedata) goto noeeprom; else { printk(KERN_WARNING "%s: i2c eeprom read error (err=%d)\n", dev->name, rc); } - return -1; + return -EINVAL; } + dev->eedata_size++; p++; if (0 == (i % 16)) printk(KERN_INFO "%s: i2c eeprom %02x:", dev->name, i); - printk(" %02x", eedata[i]); - if ((eedata[i] >= ' ') && (eedata[i] <= 'z')) - bytes[i%16] = eedata[i]; + printk(" %02x", dev->eedata[i]); + if ((dev->eedata[i] >= ' ') && (dev->eedata[i] <= 'z')) + bytes[i%16] = dev->eedata[i]; else bytes[i%16] = '.'; @@ -280,15 +281,15 @@ static int tm6000_i2c_eeprom(struct tm6000_core *dev, bytes[i%16] = '\0'; for (i %= 16; i < 16; i++) printk(" "); + printk(" %s\n", bytes); } - printk(" %s\n", bytes); return 0; noeeprom: printk(KERN_INFO "%s: Huh, no eeprom present (err=%d)?\n", - dev->name, rc); - return rc; + dev->name, rc); + return -EINVAL; } /* ----------------------------------------------------------- */ @@ -314,7 +315,6 @@ static const struct i2c_algorithm tm6000_algo = { */ int tm6000_i2c_register(struct tm6000_core *dev) { - unsigned char eedata[256]; int rc; dev->i2c_adap.owner = THIS_MODULE; @@ -329,8 +329,7 @@ int tm6000_i2c_register(struct tm6000_core *dev) dev->i2c_client.adapter = &dev->i2c_adap; strlcpy(dev->i2c_client.name, "tm6000 internal", I2C_NAME_SIZE); - - tm6000_i2c_eeprom(dev, eedata, sizeof(eedata)); + tm6000_i2c_eeprom(dev); return 0; } diff --git a/drivers/staging/tm6000/tm6000-stds.c b/drivers/staging/tm6000/tm6000-stds.c index da3e51bde10..8b29d732ddc 100644 --- a/drivers/staging/tm6000/tm6000-stds.c +++ b/drivers/staging/tm6000/tm6000-stds.c @@ -22,422 +22,26 @@ #include "tm6000.h" #include "tm6000-regs.h" +static unsigned int tm6010_a_mode = 0; +module_param(tm6010_a_mode, int, 0644); +MODULE_PARM_DESC(tm6010_a_mode, "set tm6010 sif audio mode"); + struct tm6000_reg_settings { unsigned char req; unsigned char reg; unsigned char value; }; -enum tm6000_audio_std { - BG_NICAM, - BTSC, - BG_A2, - DK_NICAM, - EIAJ, - FM_RADIO, - I_NICAM, - KOREA_A2, - L_NICAM, -}; - -struct tm6000_std_tv_settings { - v4l2_std_id id; - enum tm6000_audio_std audio_default_std; - - struct tm6000_reg_settings sif[12]; - struct tm6000_reg_settings nosif[12]; - struct tm6000_reg_settings common[26]; -}; struct tm6000_std_settings { v4l2_std_id id; - enum tm6000_audio_std audio_default_std; - struct tm6000_reg_settings common[37]; -}; - -static struct tm6000_std_tv_settings tv_stds[] = { - { - .id = V4L2_STD_PAL_M, - .audio_default_std = BTSC, - .sif = { - {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf2}, - {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xf8}, - {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf3}, - {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x08}, - {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf1}, - {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xe0}, - {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, - {TM6010_REQ08_RED_GAIN_SEL, 0xe8}, - {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x62}, - {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfe}, - {TM6010_REQ07_RFE_POWER_DOWN, 0xcb}, - {0, 0, 0}, - }, - .nosif = { - {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf0}, - {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xf8}, - {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf3}, - {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x0f}, - {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf1}, - {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xe0}, - {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, - {TM6010_REQ08_RED_GAIN_SEL, 0xe8}, - {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x60}, - {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc}, - {TM6010_REQ07_RFE_POWER_DOWN, 0x8b}, - {0, 0, 0}, - }, - .common = { - {TM6010_REQ07_R3F_RESET, 0x01}, - {TM6010_REQ07_R00_VIDEO_CONTROL0, 0x04}, - {TM6010_REQ07_R01_VIDEO_CONTROL1, 0x0e}, - {TM6010_REQ07_R02_VIDEO_CONTROL2, 0x5f}, - {TM6010_REQ07_R03_YC_SEP_CONTROL, 0x00}, - {TM6010_REQ07_R07_OUTPUT_CONTROL, 0x31}, - {TM6010_REQ07_R18_CHROMA_DTO_INCREMENT3, 0x1e}, - {TM6010_REQ07_R19_CHROMA_DTO_INCREMENT2, 0x83}, - {TM6010_REQ07_R1A_CHROMA_DTO_INCREMENT1, 0x0a}, - {TM6010_REQ07_R1B_CHROMA_DTO_INCREMENT0, 0xe0}, - {TM6010_REQ07_R1C_HSYNC_DTO_INCREMENT3, 0x1c}, - {TM6010_REQ07_R1D_HSYNC_DTO_INCREMENT2, 0xcc}, - {TM6010_REQ07_R1E_HSYNC_DTO_INCREMENT1, 0xcc}, - {TM6010_REQ07_R1F_HSYNC_DTO_INCREMENT0, 0xcd}, - {TM6010_REQ07_R2E_ACTIVE_VIDEO_HSTART, 0x88}, - {TM6010_REQ07_R30_ACTIVE_VIDEO_VSTART, 0x20}, - {TM6010_REQ07_R31_ACTIVE_VIDEO_VHIGHT, 0x61}, - {TM6010_REQ07_R33_VSYNC_HLOCK_MAX, 0x0c}, - {TM6010_REQ07_R35_VSYNC_AGC_MAX, 0x1c}, - {TM6010_REQ07_R82_COMB_FILTER_CONFIG, 0x52}, - {TM6010_REQ07_R83_CHROMA_LOCK_CONFIG, 0x6F}, - - {TM6010_REQ07_R04_LUMA_HAGC_CONTROL, 0xdc}, - {TM6010_REQ07_R0D_CHROMA_KILL_LEVEL, 0x07}, - - {TM6010_REQ07_R3F_RESET, 0x00}, - - {0, 0, 0}, - }, - }, { - .id = V4L2_STD_PAL_Nc, - .audio_default_std = BTSC, - .sif = { - {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf2}, - {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xf8}, - {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf3}, - {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x08}, - {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf1}, - {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xe0}, - {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, - {TM6010_REQ08_RED_GAIN_SEL, 0xe8}, - {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x62}, - {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfe}, - {TM6010_REQ07_RFE_POWER_DOWN, 0xcb}, - {0, 0, 0}, - }, - .nosif = { - {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf0}, - {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xf8}, - {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf3}, - {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x0f}, - {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf1}, - {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xe0}, - {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, - {TM6010_REQ08_RED_GAIN_SEL, 0xe8}, - {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x60}, - {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc}, - {TM6010_REQ07_RFE_POWER_DOWN, 0x8b}, - {0, 0, 0}, - }, - .common = { - {TM6010_REQ07_R3F_RESET, 0x01}, - {TM6010_REQ07_R00_VIDEO_CONTROL0, 0x36}, - {TM6010_REQ07_R01_VIDEO_CONTROL1, 0x0e}, - {TM6010_REQ07_R02_VIDEO_CONTROL2, 0x5f}, - {TM6010_REQ07_R03_YC_SEP_CONTROL, 0x02}, - {TM6010_REQ07_R07_OUTPUT_CONTROL, 0x31}, - {TM6010_REQ07_R18_CHROMA_DTO_INCREMENT3, 0x1e}, - {TM6010_REQ07_R19_CHROMA_DTO_INCREMENT2, 0x91}, - {TM6010_REQ07_R1A_CHROMA_DTO_INCREMENT1, 0x1f}, - {TM6010_REQ07_R1B_CHROMA_DTO_INCREMENT0, 0x0c}, - {TM6010_REQ07_R1C_HSYNC_DTO_INCREMENT3, 0x1c}, - {TM6010_REQ07_R1D_HSYNC_DTO_INCREMENT2, 0xcc}, - {TM6010_REQ07_R1E_HSYNC_DTO_INCREMENT1, 0xcc}, - {TM6010_REQ07_R1F_HSYNC_DTO_INCREMENT0, 0xcd}, - {TM6010_REQ07_R2E_ACTIVE_VIDEO_HSTART, 0x8c}, - {TM6010_REQ07_R30_ACTIVE_VIDEO_VSTART, 0x2c}, - {TM6010_REQ07_R31_ACTIVE_VIDEO_VHIGHT, 0xc1}, - {TM6010_REQ07_R33_VSYNC_HLOCK_MAX, 0x0c}, - {TM6010_REQ07_R35_VSYNC_AGC_MAX, 0x1c}, - {TM6010_REQ07_R82_COMB_FILTER_CONFIG, 0x52}, - {TM6010_REQ07_R83_CHROMA_LOCK_CONFIG, 0x6F}, - - {TM6010_REQ07_R04_LUMA_HAGC_CONTROL, 0xdc}, - {TM6010_REQ07_R0D_CHROMA_KILL_LEVEL, 0x07}, - - {TM6010_REQ07_R3F_RESET, 0x00}, - - {0, 0, 0}, - }, - }, { - .id = V4L2_STD_PAL, - .audio_default_std = BG_A2, - .sif = { - {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf2}, - {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xf8}, - {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf3}, - {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x08}, - {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf1}, - {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xe0}, - {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, - {TM6010_REQ08_RED_GAIN_SEL, 0xe8}, - {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x62}, - {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfe}, - {TM6010_REQ07_RFE_POWER_DOWN, 0xcb}, - {0, 0, 0} - }, - .nosif = { - {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf0}, - {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xf8}, - {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf3}, - {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x0f}, - {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf1}, - {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xe0}, - {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, - {TM6010_REQ08_RED_GAIN_SEL, 0xe8}, - {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x60}, - {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc}, - {TM6010_REQ07_RFE_POWER_DOWN, 0x8b}, - {0, 0, 0}, - }, - .common = { - {TM6010_REQ07_R3F_RESET, 0x01}, - {TM6010_REQ07_R00_VIDEO_CONTROL0, 0x32}, - {TM6010_REQ07_R01_VIDEO_CONTROL1, 0x0e}, - {TM6010_REQ07_R02_VIDEO_CONTROL2, 0x5f}, - {TM6010_REQ07_R03_YC_SEP_CONTROL, 0x02}, - {TM6010_REQ07_R07_OUTPUT_CONTROL, 0x31}, - {TM6010_REQ07_R18_CHROMA_DTO_INCREMENT3, 0x25}, - {TM6010_REQ07_R19_CHROMA_DTO_INCREMENT2, 0xd5}, - {TM6010_REQ07_R1A_CHROMA_DTO_INCREMENT1, 0x63}, - {TM6010_REQ07_R1B_CHROMA_DTO_INCREMENT0, 0x50}, - {TM6010_REQ07_R1C_HSYNC_DTO_INCREMENT3, 0x1c}, - {TM6010_REQ07_R1D_HSYNC_DTO_INCREMENT2, 0xcc}, - {TM6010_REQ07_R1E_HSYNC_DTO_INCREMENT1, 0xcc}, - {TM6010_REQ07_R1F_HSYNC_DTO_INCREMENT0, 0xcd}, - {TM6010_REQ07_R2E_ACTIVE_VIDEO_HSTART, 0x8c}, - {TM6010_REQ07_R30_ACTIVE_VIDEO_VSTART, 0x2c}, - {TM6010_REQ07_R31_ACTIVE_VIDEO_VHIGHT, 0xc1}, - {TM6010_REQ07_R33_VSYNC_HLOCK_MAX, 0x0c}, - {TM6010_REQ07_R35_VSYNC_AGC_MAX, 0x1c}, - {TM6010_REQ07_R82_COMB_FILTER_CONFIG, 0x52}, - {TM6010_REQ07_R83_CHROMA_LOCK_CONFIG, 0x6F}, - - {TM6010_REQ07_R04_LUMA_HAGC_CONTROL, 0xdc}, - {TM6010_REQ07_R0D_CHROMA_KILL_LEVEL, 0x07}, - - {TM6010_REQ07_R3F_RESET, 0x00}, - - {0, 0, 0}, - }, - }, { - .id = V4L2_STD_SECAM_B | V4L2_STD_SECAM_G, - .audio_default_std = BG_NICAM, - .sif = { - {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf2}, - {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xf8}, - {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf3}, - {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x08}, - {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf1}, - {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xe0}, - {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, - {TM6010_REQ08_RED_GAIN_SEL, 0xe8}, - {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x62}, - {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfe}, - {TM6010_REQ07_RFE_POWER_DOWN, 0xcb}, - {0, 0, 0}, - }, - .nosif = { - {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf0}, - {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xf8}, - {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf3}, - {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x0f}, - {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf1}, - {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xe0}, - {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, - {TM6010_REQ08_RED_GAIN_SEL, 0xe8}, - {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x60}, - {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc}, - {TM6010_REQ07_RFE_POWER_DOWN, 0x8b}, - {0, 0, 0}, - }, - .common = { - {TM6010_REQ07_R3F_RESET, 0x01}, - {TM6010_REQ07_R00_VIDEO_CONTROL0, 0x38}, - {TM6010_REQ07_R01_VIDEO_CONTROL1, 0x0e}, - {TM6010_REQ07_R02_VIDEO_CONTROL2, 0x5f}, - {TM6010_REQ07_R03_YC_SEP_CONTROL, 0x02}, - {TM6010_REQ07_R07_OUTPUT_CONTROL, 0x31}, - {TM6010_REQ07_R18_CHROMA_DTO_INCREMENT3, 0x24}, - {TM6010_REQ07_R19_CHROMA_DTO_INCREMENT2, 0x92}, - {TM6010_REQ07_R1A_CHROMA_DTO_INCREMENT1, 0xe8}, - {TM6010_REQ07_R1B_CHROMA_DTO_INCREMENT0, 0xed}, - {TM6010_REQ07_R1C_HSYNC_DTO_INCREMENT3, 0x1c}, - {TM6010_REQ07_R1D_HSYNC_DTO_INCREMENT2, 0xcc}, - {TM6010_REQ07_R1E_HSYNC_DTO_INCREMENT1, 0xcc}, - {TM6010_REQ07_R1F_HSYNC_DTO_INCREMENT0, 0xcd}, - {TM6010_REQ07_R2E_ACTIVE_VIDEO_HSTART, 0x8c}, - {TM6010_REQ07_R30_ACTIVE_VIDEO_VSTART, 0x2c}, - {TM6010_REQ07_R31_ACTIVE_VIDEO_VHIGHT, 0xc1}, - {TM6010_REQ07_R33_VSYNC_HLOCK_MAX, 0x2c}, - {TM6010_REQ07_R35_VSYNC_AGC_MAX, 0x18}, - {TM6010_REQ07_R82_COMB_FILTER_CONFIG, 0x42}, - {TM6010_REQ07_R83_CHROMA_LOCK_CONFIG, 0xFF}, - - {TM6010_REQ07_R0D_CHROMA_KILL_LEVEL, 0x07}, - - {TM6010_REQ07_R3F_RESET, 0x00}, - {0, 0, 0}, - }, - }, { - .id = V4L2_STD_SECAM_DK, - .audio_default_std = DK_NICAM, - .sif = { - {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf2}, - {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xf8}, - {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf3}, - {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x08}, - {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf1}, - {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xe0}, - {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, - {TM6010_REQ08_RED_GAIN_SEL, 0xe8}, - {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x62}, - {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfe}, - {TM6010_REQ07_RFE_POWER_DOWN, 0xcb}, - {0, 0, 0}, - }, - .nosif = { - {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf0}, - {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xf8}, - {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf3}, - {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x0f}, - {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf1}, - {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xe0}, - {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, - {TM6010_REQ08_RED_GAIN_SEL, 0xe8}, - {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x60}, - {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc}, - {TM6010_REQ07_RFE_POWER_DOWN, 0x8b}, - {0, 0, 0}, - }, - .common = { - {TM6010_REQ07_R3F_RESET, 0x01}, - {TM6010_REQ07_R00_VIDEO_CONTROL0, 0x38}, - {TM6010_REQ07_R01_VIDEO_CONTROL1, 0x0e}, - {TM6010_REQ07_R02_VIDEO_CONTROL2, 0x5f}, - {TM6010_REQ07_R03_YC_SEP_CONTROL, 0x02}, - {TM6010_REQ07_R07_OUTPUT_CONTROL, 0x31}, - {TM6010_REQ07_R18_CHROMA_DTO_INCREMENT3, 0x24}, - {TM6010_REQ07_R19_CHROMA_DTO_INCREMENT2, 0x92}, - {TM6010_REQ07_R1A_CHROMA_DTO_INCREMENT1, 0xe8}, - {TM6010_REQ07_R1B_CHROMA_DTO_INCREMENT0, 0xed}, - {TM6010_REQ07_R1C_HSYNC_DTO_INCREMENT3, 0x1c}, - {TM6010_REQ07_R1D_HSYNC_DTO_INCREMENT2, 0xcc}, - {TM6010_REQ07_R1E_HSYNC_DTO_INCREMENT1, 0xcc}, - {TM6010_REQ07_R1F_HSYNC_DTO_INCREMENT0, 0xcd}, - {TM6010_REQ07_R2E_ACTIVE_VIDEO_HSTART, 0x8c}, - {TM6010_REQ07_R30_ACTIVE_VIDEO_VSTART, 0x2c}, - {TM6010_REQ07_R31_ACTIVE_VIDEO_VHIGHT, 0xc1}, - {TM6010_REQ07_R33_VSYNC_HLOCK_MAX, 0x2c}, - {TM6010_REQ07_R35_VSYNC_AGC_MAX, 0x18}, - {TM6010_REQ07_R82_COMB_FILTER_CONFIG, 0x42}, - {TM6010_REQ07_R83_CHROMA_LOCK_CONFIG, 0xFF}, - - {TM6010_REQ07_R0D_CHROMA_KILL_LEVEL, 0x07}, - - {TM6010_REQ07_R3F_RESET, 0x00}, - {0, 0, 0}, - }, - }, { - .id = V4L2_STD_NTSC, - .audio_default_std = BTSC, - .sif = { - {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf2}, - {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xf8}, - {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf3}, - {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x08}, - {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf1}, - {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xe0}, - {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, - {TM6010_REQ08_RED_GAIN_SEL, 0xe8}, - {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x62}, - {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfe}, - {TM6010_REQ07_RFE_POWER_DOWN, 0xcb}, - {0, 0, 0}, - }, - .nosif = { - {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf0}, - {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xf8}, - {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf3}, - {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x0f}, - {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf1}, - {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xe0}, - {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, - {TM6010_REQ08_RED_GAIN_SEL, 0xe8}, - {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x60}, - {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc}, - {TM6010_REQ07_RFE_POWER_DOWN, 0x8b}, - {0, 0, 0}, - }, - .common = { - {TM6010_REQ07_R3F_RESET, 0x01}, - {TM6010_REQ07_R00_VIDEO_CONTROL0, 0x00}, - {TM6010_REQ07_R01_VIDEO_CONTROL1, 0x0f}, - {TM6010_REQ07_R02_VIDEO_CONTROL2, 0x5f}, - {TM6010_REQ07_R03_YC_SEP_CONTROL, 0x00}, - {TM6010_REQ07_R07_OUTPUT_CONTROL, 0x31}, - {TM6010_REQ07_R18_CHROMA_DTO_INCREMENT3, 0x1e}, - {TM6010_REQ07_R19_CHROMA_DTO_INCREMENT2, 0x8b}, - {TM6010_REQ07_R1A_CHROMA_DTO_INCREMENT1, 0xa2}, - {TM6010_REQ07_R1B_CHROMA_DTO_INCREMENT0, 0xe9}, - {TM6010_REQ07_R1C_HSYNC_DTO_INCREMENT3, 0x1c}, - {TM6010_REQ07_R1D_HSYNC_DTO_INCREMENT2, 0xcc}, - {TM6010_REQ07_R1E_HSYNC_DTO_INCREMENT1, 0xcc}, - {TM6010_REQ07_R1F_HSYNC_DTO_INCREMENT0, 0xcd}, - {TM6010_REQ07_R2E_ACTIVE_VIDEO_HSTART, 0x88}, - {TM6010_REQ07_R30_ACTIVE_VIDEO_VSTART, 0x22}, - {TM6010_REQ07_R31_ACTIVE_VIDEO_VHIGHT, 0x61}, - {TM6010_REQ07_R33_VSYNC_HLOCK_MAX, 0x1c}, - {TM6010_REQ07_R35_VSYNC_AGC_MAX, 0x1c}, - {TM6010_REQ07_R82_COMB_FILTER_CONFIG, 0x42}, - {TM6010_REQ07_R83_CHROMA_LOCK_CONFIG, 0x6F}, - - {TM6010_REQ07_R04_LUMA_HAGC_CONTROL, 0xdd}, - {TM6010_REQ07_R0D_CHROMA_KILL_LEVEL, 0x07}, - - {TM6010_REQ07_R3F_RESET, 0x00}, - - {0, 0, 0}, - }, - }, + struct tm6000_reg_settings common[27]; }; static struct tm6000_std_settings composite_stds[] = { { .id = V4L2_STD_PAL_M, - .audio_default_std = BTSC, .common = { - {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf0}, - {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xf4}, - {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf3}, - {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x0f}, - {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf1}, - {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xe0}, - {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, - {TM6010_REQ08_RED_GAIN_SEL, 0xe8}, - {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x68}, - {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc}, - {TM6010_REQ07_RFE_POWER_DOWN, 0x8b}, - {TM6010_REQ07_R3F_RESET, 0x01}, {TM6010_REQ07_R00_VIDEO_CONTROL0, 0x04}, {TM6010_REQ07_R01_VIDEO_CONTROL1, 0x0e}, @@ -467,20 +71,7 @@ static struct tm6000_std_settings composite_stds[] = { }, }, { .id = V4L2_STD_PAL_Nc, - .audio_default_std = BTSC, .common = { - {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf0}, - {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xf4}, - {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf3}, - {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x0f}, - {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf1}, - {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xe0}, - {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, - {TM6010_REQ08_RED_GAIN_SEL, 0xe8}, - {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x68}, - {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc}, - {TM6010_REQ07_RFE_POWER_DOWN, 0x8b}, - {TM6010_REQ07_R3F_RESET, 0x01}, {TM6010_REQ07_R00_VIDEO_CONTROL0, 0x36}, {TM6010_REQ07_R01_VIDEO_CONTROL1, 0x0e}, @@ -510,20 +101,7 @@ static struct tm6000_std_settings composite_stds[] = { }, }, { .id = V4L2_STD_PAL, - .audio_default_std = BG_A2, .common = { - {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf0}, - {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xf4}, - {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf3}, - {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x0f}, - {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf1}, - {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xe0}, - {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, - {TM6010_REQ08_RED_GAIN_SEL, 0xe8}, - {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x68}, - {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc}, - {TM6010_REQ07_RFE_POWER_DOWN, 0x8b}, - {TM6010_REQ07_R3F_RESET, 0x01}, {TM6010_REQ07_R00_VIDEO_CONTROL0, 0x32}, {TM6010_REQ07_R01_VIDEO_CONTROL1, 0x0e}, @@ -553,62 +131,7 @@ static struct tm6000_std_settings composite_stds[] = { }, }, { .id = V4L2_STD_SECAM, - .audio_default_std = BG_NICAM, - .common = { - {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf0}, - {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xf4}, - {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf3}, - {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x0f}, - {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf1}, - {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xe0}, - {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, - {TM6010_REQ08_RED_GAIN_SEL, 0xe8}, - {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x68}, - {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc}, - {TM6010_REQ07_RFE_POWER_DOWN, 0x8b}, - - {TM6010_REQ07_R3F_RESET, 0x01}, - {TM6010_REQ07_R00_VIDEO_CONTROL0, 0x38}, - {TM6010_REQ07_R01_VIDEO_CONTROL1, 0x0e}, - {TM6010_REQ07_R02_VIDEO_CONTROL2, 0x5f}, - {TM6010_REQ07_R03_YC_SEP_CONTROL, 0x02}, - {TM6010_REQ07_R07_OUTPUT_CONTROL, 0x31}, - {TM6010_REQ07_R18_CHROMA_DTO_INCREMENT3, 0x24}, - {TM6010_REQ07_R19_CHROMA_DTO_INCREMENT2, 0x92}, - {TM6010_REQ07_R1A_CHROMA_DTO_INCREMENT1, 0xe8}, - {TM6010_REQ07_R1B_CHROMA_DTO_INCREMENT0, 0xed}, - {TM6010_REQ07_R1C_HSYNC_DTO_INCREMENT3, 0x1c}, - {TM6010_REQ07_R1D_HSYNC_DTO_INCREMENT2, 0xcc}, - {TM6010_REQ07_R1E_HSYNC_DTO_INCREMENT1, 0xcc}, - {TM6010_REQ07_R1F_HSYNC_DTO_INCREMENT0, 0xcd}, - {TM6010_REQ07_R2E_ACTIVE_VIDEO_HSTART, 0x8c}, - {TM6010_REQ07_R30_ACTIVE_VIDEO_VSTART, 0x2c}, - {TM6010_REQ07_R31_ACTIVE_VIDEO_VHIGHT, 0xc1}, - {TM6010_REQ07_R33_VSYNC_HLOCK_MAX, 0x2c}, - {TM6010_REQ07_R35_VSYNC_AGC_MAX, 0x18}, - {TM6010_REQ07_R82_COMB_FILTER_CONFIG, 0x42}, - {TM6010_REQ07_R83_CHROMA_LOCK_CONFIG, 0xFF}, - - {TM6010_REQ07_R0D_CHROMA_KILL_LEVEL, 0x07}, - {TM6010_REQ07_R3F_RESET, 0x00}, - {0, 0, 0}, - }, - }, { - .id = V4L2_STD_SECAM_DK, - .audio_default_std = DK_NICAM, .common = { - {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf0}, - {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xf4}, - {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf3}, - {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x0f}, - {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf1}, - {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xe0}, - {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, - {TM6010_REQ08_RED_GAIN_SEL, 0xe8}, - {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x68}, - {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc}, - {TM6010_REQ07_RFE_POWER_DOWN, 0x8b}, - {TM6010_REQ07_R3F_RESET, 0x01}, {TM6010_REQ07_R00_VIDEO_CONTROL0, 0x38}, {TM6010_REQ07_R01_VIDEO_CONTROL1, 0x0e}, @@ -637,20 +160,7 @@ static struct tm6000_std_settings composite_stds[] = { }, }, { .id = V4L2_STD_NTSC, - .audio_default_std = BTSC, .common = { - {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf0}, - {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xf4}, - {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf3}, - {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x0f}, - {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf1}, - {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xe0}, - {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, - {TM6010_REQ08_RED_GAIN_SEL, 0xe8}, - {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x68}, - {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc}, - {TM6010_REQ07_RFE_POWER_DOWN, 0x8b}, - {TM6010_REQ07_R3F_RESET, 0x01}, {TM6010_REQ07_R00_VIDEO_CONTROL0, 0x00}, {TM6010_REQ07_R01_VIDEO_CONTROL1, 0x0f}, @@ -684,20 +194,7 @@ static struct tm6000_std_settings composite_stds[] = { static struct tm6000_std_settings svideo_stds[] = { { .id = V4L2_STD_PAL_M, - .audio_default_std = BTSC, .common = { - {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf0}, - {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xfc}, - {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf8}, - {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x00}, - {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf2}, - {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xf0}, - {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, - {TM6010_REQ08_RED_GAIN_SEL, 0xe0}, - {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x68}, - {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc}, - {TM6010_REQ07_RFE_POWER_DOWN, 0x8a}, - {TM6010_REQ07_R3F_RESET, 0x01}, {TM6010_REQ07_R00_VIDEO_CONTROL0, 0x05}, {TM6010_REQ07_R01_VIDEO_CONTROL1, 0x0e}, @@ -727,20 +224,7 @@ static struct tm6000_std_settings svideo_stds[] = { }, }, { .id = V4L2_STD_PAL_Nc, - .audio_default_std = BTSC, .common = { - {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf0}, - {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xfc}, - {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf8}, - {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x00}, - {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf2}, - {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xf0}, - {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, - {TM6010_REQ08_RED_GAIN_SEL, 0xe0}, - {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x68}, - {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc}, - {TM6010_REQ07_RFE_POWER_DOWN, 0x8a}, - {TM6010_REQ07_R3F_RESET, 0x01}, {TM6010_REQ07_R00_VIDEO_CONTROL0, 0x37}, {TM6010_REQ07_R01_VIDEO_CONTROL1, 0x0e}, @@ -770,20 +254,7 @@ static struct tm6000_std_settings svideo_stds[] = { }, }, { .id = V4L2_STD_PAL, - .audio_default_std = BG_A2, .common = { - {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf0}, - {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xfc}, - {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf8}, - {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x00}, - {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf2}, - {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xf0}, - {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, - {TM6010_REQ08_RED_GAIN_SEL, 0xe0}, - {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x68}, - {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc}, - {TM6010_REQ07_RFE_POWER_DOWN, 0x8a}, - {TM6010_REQ07_R3F_RESET, 0x01}, {TM6010_REQ07_R00_VIDEO_CONTROL0, 0x33}, {TM6010_REQ07_R01_VIDEO_CONTROL1, 0x0e}, @@ -813,62 +284,7 @@ static struct tm6000_std_settings svideo_stds[] = { }, }, { .id = V4L2_STD_SECAM, - .audio_default_std = BG_NICAM, - .common = { - {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf0}, - {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xfc}, - {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf8}, - {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x00}, - {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf2}, - {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xf0}, - {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, - {TM6010_REQ08_RED_GAIN_SEL, 0xe0}, - {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x68}, - {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc}, - {TM6010_REQ07_RFE_POWER_DOWN, 0x8a}, - - {TM6010_REQ07_R3F_RESET, 0x01}, - {TM6010_REQ07_R00_VIDEO_CONTROL0, 0x39}, - {TM6010_REQ07_R01_VIDEO_CONTROL1, 0x0e}, - {TM6010_REQ07_R02_VIDEO_CONTROL2, 0x5f}, - {TM6010_REQ07_R03_YC_SEP_CONTROL, 0x03}, - {TM6010_REQ07_R07_OUTPUT_CONTROL, 0x31}, - {TM6010_REQ07_R18_CHROMA_DTO_INCREMENT3, 0x24}, - {TM6010_REQ07_R19_CHROMA_DTO_INCREMENT2, 0x92}, - {TM6010_REQ07_R1A_CHROMA_DTO_INCREMENT1, 0xe8}, - {TM6010_REQ07_R1B_CHROMA_DTO_INCREMENT0, 0xed}, - {TM6010_REQ07_R1C_HSYNC_DTO_INCREMENT3, 0x1c}, - {TM6010_REQ07_R1D_HSYNC_DTO_INCREMENT2, 0xcc}, - {TM6010_REQ07_R1E_HSYNC_DTO_INCREMENT1, 0xcc}, - {TM6010_REQ07_R1F_HSYNC_DTO_INCREMENT0, 0xcd}, - {TM6010_REQ07_R2E_ACTIVE_VIDEO_HSTART, 0x8c}, - {TM6010_REQ07_R30_ACTIVE_VIDEO_VSTART, 0x2a}, - {TM6010_REQ07_R31_ACTIVE_VIDEO_VHIGHT, 0xc1}, - {TM6010_REQ07_R33_VSYNC_HLOCK_MAX, 0x2c}, - {TM6010_REQ07_R35_VSYNC_AGC_MAX, 0x18}, - {TM6010_REQ07_R82_COMB_FILTER_CONFIG, 0x42}, - {TM6010_REQ07_R83_CHROMA_LOCK_CONFIG, 0xFF}, - - {TM6010_REQ07_R0D_CHROMA_KILL_LEVEL, 0x07}, - {TM6010_REQ07_R3F_RESET, 0x00}, - {0, 0, 0}, - }, - }, { - .id = V4L2_STD_SECAM_DK, - .audio_default_std = DK_NICAM, .common = { - {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf0}, - {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xfc}, - {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf8}, - {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x00}, - {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf2}, - {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xf0}, - {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, - {TM6010_REQ08_RED_GAIN_SEL, 0xe0}, - {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x68}, - {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc}, - {TM6010_REQ07_RFE_POWER_DOWN, 0x8a}, - {TM6010_REQ07_R3F_RESET, 0x01}, {TM6010_REQ07_R00_VIDEO_CONTROL0, 0x39}, {TM6010_REQ07_R01_VIDEO_CONTROL1, 0x0e}, @@ -897,20 +313,7 @@ static struct tm6000_std_settings svideo_stds[] = { }, }, { .id = V4L2_STD_NTSC, - .audio_default_std = BTSC, .common = { - {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf0}, - {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xfc}, - {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf8}, - {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x00}, - {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf2}, - {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xf0}, - {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, - {TM6010_REQ08_RED_GAIN_SEL, 0xe0}, - {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x68}, - {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc}, - {TM6010_REQ07_RFE_POWER_DOWN, 0x8a}, - {TM6010_REQ07_R3F_RESET, 0x01}, {TM6010_REQ07_R00_VIDEO_CONTROL0, 0x01}, {TM6010_REQ07_R01_VIDEO_CONTROL1, 0x0f}, @@ -943,13 +346,11 @@ static struct tm6000_std_settings svideo_stds[] = { }; -static int tm6000_set_audio_std(struct tm6000_core *dev, - enum tm6000_audio_std std) +static int tm6000_set_audio_std(struct tm6000_core *dev) { uint8_t areg_02 = 0x04; /* GC1 Fixed gain 0dB */ - uint8_t areg_05 = 0x09; /* Auto 4.5 = M Japan, Auto 6.5 = DK */ + uint8_t areg_05 = 0x01; /* Auto 4.5 = M Japan, Auto 6.5 = DK */ uint8_t areg_06 = 0x02; /* Auto de-emphasis, mannual channel mode */ - uint8_t mono_flag = 0; /* No mono */ uint8_t nicam_flag = 0; /* No NICAM */ if (dev->radio) { @@ -958,81 +359,99 @@ static int tm6000_set_audio_std(struct tm6000_core *dev, tm6000_set_reg(dev, TM6010_REQ08_R03_A_AUTO_GAIN_CTRL, 0x00); tm6000_set_reg(dev, TM6010_REQ08_R04_A_SIF_AMP_CTRL, 0x80); tm6000_set_reg(dev, TM6010_REQ08_R05_A_STANDARD_MOD, 0x0c); - tm6000_set_reg(dev, TM6010_REQ08_R06_A_SOUND_MOD, 0x00); + /* set mono or stereo */ + if (dev->amode == V4L2_TUNER_MODE_MONO) + tm6000_set_reg(dev, TM6010_REQ08_R06_A_SOUND_MOD, 0x00); + else if (dev->amode == V4L2_TUNER_MODE_STEREO) + tm6000_set_reg(dev, TM6010_REQ08_R06_A_SOUND_MOD, 0x02); tm6000_set_reg(dev, TM6010_REQ08_R09_A_MAIN_VOL, 0x18); tm6000_set_reg(dev, TM6010_REQ08_R0C_A_ASD_THRES2, 0x0a); tm6000_set_reg(dev, TM6010_REQ08_R0D_A_AMD_THRES, 0x40); - tm6000_set_reg(dev, TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc); + tm6000_set_reg(dev, TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfe); tm6000_set_reg(dev, TM6010_REQ08_R1E_A_GAIN_DEEMPH_OUT, 0x13); tm6000_set_reg(dev, TM6010_REQ08_R01_A_INIT, 0x80); return 0; } - switch (std) { -#if 0 - case DK_MONO: - mono_flag = 1; - break; - case DK_A2_1: - break; - case DK_A2_3: - areg_05 = 0x0b; - break; - case BG_MONO: - mono_flag = 1; - areg_05 = 0x05; - break; -#endif - case BG_NICAM: - areg_05 = 0x07; - nicam_flag = 1; - break; - case BTSC: - areg_05 = 0x02; - break; - case BG_A2: - areg_05 = 0x05; - break; - case DK_NICAM: - areg_05 = 0x06; - nicam_flag = 1; - break; - case EIAJ: - areg_05 = 0x02; - break; - case I_NICAM: - areg_05 = 0x08; - nicam_flag = 1; + switch (tm6010_a_mode) { + /* auto */ + case 0: + switch (dev->norm) { + case V4L2_STD_NTSC_M_KR: + areg_05 |= 0x00; + break; + case V4L2_STD_NTSC_M_JP: + areg_05 |= 0x40; + break; + case V4L2_STD_NTSC_M: + case V4L2_STD_PAL_M: + case V4L2_STD_PAL_N: + areg_05 |= 0x20; + break; + case V4L2_STD_PAL_Nc: + areg_05 |= 0x60; + break; + case V4L2_STD_SECAM_L: + areg_05 |= 0x00; + break; + case V4L2_STD_DK: + areg_05 |= 0x10; + break; + } break; - case KOREA_A2: - areg_05 = 0x04; + /* A2 */ + case 1: + switch (dev->norm) { + case V4L2_STD_B: + case V4L2_STD_GH: + areg_05 = 0x05; + break; + case V4L2_STD_DK: + areg_05 = 0x09; + break; + } break; - case L_NICAM: - areg_02 = 0x02; /* GC1 Fixed gain +12dB */ - areg_05 = 0x0a; + /* NICAM */ + case 2: + switch (dev->norm) { + case V4L2_STD_B: + case V4L2_STD_GH: + areg_05 = 0x07; + break; + case V4L2_STD_DK: + areg_05 = 0x06; + break; + case V4L2_STD_PAL_I: + areg_05 = 0x08; + break; + case V4L2_STD_SECAM_L: + areg_05 = 0x0a; + areg_02 = 0x02; + break; + } nicam_flag = 1; break; - default: - /* do nothink */ - break; - } - -#if 0 - switch (tv_audio_mode) { - case TV_MONO: - areg_06 = (nicam_flag) ? 0x03 : 0x00; - break; - case TV_LANG_A: - areg_06 = 0x00; - break; - case TV_LANG_B: - areg_06 = 0x01; + /* other */ + case 3: + switch (dev->norm) { + /* DK3_A2 */ + case V4L2_STD_DK: + areg_05 = 0x0b; + break; + /* Korea */ + case V4L2_STD_NTSC_M_KR: + areg_05 = 0x04; + break; + /* EIAJ */ + case V4L2_STD_NTSC_M_JP: + areg_05 = 0x03; + break; + default: + areg_05 = 0x02; + break; + } break; } -#endif - - if (mono_flag) - areg_06 = 0x00; tm6000_set_reg(dev, TM6010_REQ08_R01_A_INIT, 0x00); tm6000_set_reg(dev, TM6010_REQ08_R02_A_FIX_GAIN_CTRL, areg_02); @@ -1066,9 +485,6 @@ static int tm6000_set_audio_std(struct tm6000_core *dev, tm6000_set_reg(dev, TM6010_REQ08_R1E_A_GAIN_DEEMPH_OUT, 0x13); tm6000_set_reg(dev, TM6010_REQ08_R1F_A_TEST_INTF_SEL, 0x00); tm6000_set_reg(dev, TM6010_REQ08_R20_A_TEST_PIN_SEL, 0x00); - tm6000_set_reg(dev, TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf3); - tm6000_set_reg(dev, TM6010_REQ08_R06_A_SOUND_MOD, 0x00); - tm6000_set_reg(dev, TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc); tm6000_set_reg(dev, TM6010_REQ08_R01_A_INIT, 0x80); return 0; @@ -1095,10 +511,6 @@ static int tm6000_load_std(struct tm6000_core *dev, if (!set[i].req) return 0; - if ((dev->dev_type != TM6010) && - (set[i].req == REQ_08_SET_GET_AVREG_BIT)) - continue; - rc = tm6000_set_reg(dev, set[i].req, set[i].reg, set[i].value); if (rc < 0) { printk(KERN_ERR "Error %i while setting " @@ -1111,53 +523,126 @@ static int tm6000_load_std(struct tm6000_core *dev, return 0; } -static int tm6000_set_tv(struct tm6000_core *dev, int pos) -{ - int rc; - - /* FIXME: This code is for tm6010 - not tested yet - doesn't work with - tm5600 - */ - - /* FIXME: This is tuner-dependent */ - int nosif = 0; - - if (nosif) { - rc = tm6000_load_std(dev, tv_stds[pos].nosif, - sizeof(tv_stds[pos].nosif)); - } else { - rc = tm6000_load_std(dev, tv_stds[pos].sif, - sizeof(tv_stds[pos].sif)); - } - if (rc < 0) - return rc; - rc = tm6000_load_std(dev, tv_stds[pos].common, - sizeof(tv_stds[pos].common)); - - tm6000_set_audio_std(dev, tv_stds[pos].audio_default_std); - - return rc; -} - -int tm6000_set_standard(struct tm6000_core *dev, v4l2_std_id * norm) +int tm6000_set_standard(struct tm6000_core *dev) { int i, rc = 0; + u8 reg_07_fe = 0x8a; + u8 reg_08_f1 = 0xfc; + u8 reg_08_e2 = 0xf0; + u8 reg_08_e6 = 0x0f; - dev->norm = *norm; tm6000_get_std_res(dev); - switch (dev->input) { - case TM6000_INPUT_TV: - for (i = 0; i < ARRAY_SIZE(tv_stds); i++) { - if (*norm & tv_stds[i].id) { - rc = tm6000_set_tv(dev, i); - goto ret; - } + if (dev->radio) { + /* todo */ + } + + if (dev->dev_type == TM6010) { + switch (dev->vinput[dev->input].vmux) { + case TM6000_VMUX_VIDEO_A: + tm6000_set_reg(dev, TM6010_REQ08_RE3_ADC_IN1_SEL, 0xf4); + tm6000_set_reg(dev, TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf1); + tm6000_set_reg(dev, TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xe0); + tm6000_set_reg(dev, TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2); + tm6000_set_reg(dev, TM6010_REQ08_RED_GAIN_SEL, 0xe8); + reg_07_fe |= 0x01; + break; + case TM6000_VMUX_VIDEO_B: + tm6000_set_reg(dev, TM6010_REQ08_RE3_ADC_IN1_SEL, 0xf8); + tm6000_set_reg(dev, TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf1); + tm6000_set_reg(dev, TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xe0); + tm6000_set_reg(dev, TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2); + tm6000_set_reg(dev, TM6010_REQ08_RED_GAIN_SEL, 0xe8); + reg_07_fe |= 0x01; + break; + case TM6000_VMUX_VIDEO_AB: + tm6000_set_reg(dev, TM6010_REQ08_RE3_ADC_IN1_SEL, 0xfc); + tm6000_set_reg(dev, TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf8); + reg_08_e6 = 0x00; + tm6000_set_reg(dev, TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf2); + tm6000_set_reg(dev, TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xf0); + tm6000_set_reg(dev, TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2); + tm6000_set_reg(dev, TM6010_REQ08_RED_GAIN_SEL, 0xe0); + break; + default: + break; } - return -EINVAL; - case TM6000_INPUT_SVIDEO: + switch (dev->vinput[dev->input].amux) { + case TM6000_AMUX_ADC1: + tm6000_set_reg_mask(dev, TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, + 0x00, 0x0f); + break; + case TM6000_AMUX_ADC2: + tm6000_set_reg_mask(dev, TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, + 0x08, 0x0f); + break; + case TM6000_AMUX_SIF1: + reg_08_e2 |= 0x02; + reg_08_e6 = 0x08; + reg_07_fe |= 0x40; + reg_08_f1 |= 0x02; + tm6000_set_reg(dev, TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf3); + tm6000_set_reg_mask(dev, TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, + 0x02, 0x0f); + break; + case TM6000_AMUX_SIF2: + reg_08_e2 |= 0x02; + reg_08_e6 = 0x08; + reg_07_fe |= 0x40; + reg_08_f1 |= 0x02; + tm6000_set_reg(dev, TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf7); + tm6000_set_reg_mask(dev, TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, + 0x02, 0x0f); + break; + default: + break; + } + tm6000_set_reg(dev, TM6010_REQ08_RE2_POWER_DOWN_CTRL1, reg_08_e2); + tm6000_set_reg(dev, TM6010_REQ08_RE6_POWER_DOWN_CTRL2, reg_08_e6); + tm6000_set_reg(dev, TM6010_REQ08_RF1_AADC_POWER_DOWN, reg_08_f1); + tm6000_set_reg(dev, TM6010_REQ07_RFE_POWER_DOWN, reg_07_fe); + } else { + switch (dev->vinput[dev->input].vmux) { + case TM6000_VMUX_VIDEO_A: + tm6000_set_reg(dev, TM6000_REQ07_RE3_VADC_INP_LPF_SEL1, 0x10); + tm6000_set_reg(dev, TM6000_REQ07_RE5_VADC_INP_LPF_SEL2, 0x00); + tm6000_set_reg(dev, TM6000_REQ07_RE8_VADC_PWDOWN_CTL, 0x0f); + tm6000_set_reg(dev, + REQ_03_SET_GET_MCU_PIN, dev->vinput[dev->input].v_gpio, 0); + break; + case TM6000_VMUX_VIDEO_B: + tm6000_set_reg(dev, TM6000_REQ07_RE3_VADC_INP_LPF_SEL1, 0x00); + tm6000_set_reg(dev, TM6000_REQ07_RE5_VADC_INP_LPF_SEL2, 0x00); + tm6000_set_reg(dev, TM6000_REQ07_RE8_VADC_PWDOWN_CTL, 0x0f); + tm6000_set_reg(dev, + REQ_03_SET_GET_MCU_PIN, dev->vinput[dev->input].v_gpio, 0); + break; + case TM6000_VMUX_VIDEO_AB: + tm6000_set_reg(dev, TM6000_REQ07_RE3_VADC_INP_LPF_SEL1, 0x10); + tm6000_set_reg(dev, TM6000_REQ07_RE5_VADC_INP_LPF_SEL2, 0x10); + tm6000_set_reg(dev, TM6000_REQ07_RE8_VADC_PWDOWN_CTL, 0x00); + tm6000_set_reg(dev, + REQ_03_SET_GET_MCU_PIN, dev->vinput[dev->input].v_gpio, 1); + break; + default: + break; + } + switch (dev->vinput[dev->input].amux) { + case TM6000_AMUX_ADC1: + tm6000_set_reg_mask(dev, + TM6000_REQ07_REB_VADC_AADC_MODE, 0x00, 0x0f); + break; + case TM6000_AMUX_ADC2: + tm6000_set_reg_mask(dev, + TM6000_REQ07_REB_VADC_AADC_MODE, 0x04, 0x0f); + break; + default: + break; + } + } + if (dev->vinput[dev->input].type == TM6000_INPUT_SVIDEO) { for (i = 0; i < ARRAY_SIZE(svideo_stds); i++) { - if (*norm & svideo_stds[i].id) { + if (dev->norm & svideo_stds[i].id) { rc = tm6000_load_std(dev, svideo_stds[i].common, sizeof(svideo_stds[i]. common)); @@ -1165,14 +650,13 @@ int tm6000_set_standard(struct tm6000_core *dev, v4l2_std_id * norm) } } return -EINVAL; - case TM6000_INPUT_COMPOSITE: + } else { for (i = 0; i < ARRAY_SIZE(composite_stds); i++) { - if (*norm & composite_stds[i].id) { + if (dev->norm & composite_stds[i].id) { rc = tm6000_load_std(dev, composite_stds[i].common, sizeof(composite_stds[i]. common)); - tm6000_set_audio_std(dev, composite_stds[i].audio_default_std); goto ret; } } @@ -1183,6 +667,11 @@ ret: if (rc < 0) return rc; + if ((dev->dev_type == TM6010) && + ((dev->vinput[dev->input].amux == TM6000_AMUX_SIF1) || + (dev->vinput[dev->input].amux == TM6000_AMUX_SIF2))) + tm6000_set_audio_std(dev); + msleep(40); diff --git a/drivers/staging/tm6000/tm6000-usb-isoc.h b/drivers/staging/tm6000/tm6000-usb-isoc.h index a9e61d95a9b..084c2a8904a 100644 --- a/drivers/staging/tm6000/tm6000-usb-isoc.h +++ b/drivers/staging/tm6000/tm6000-usb-isoc.h @@ -39,7 +39,7 @@ struct usb_isoc_ctl { int pos, size, pktsize; /* Last field: ODD or EVEN? */ - int vfield; + int vfield, field; /* Stores incomplete commands */ u32 tmp_buf; diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index 17db6684abb..4264064a727 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -34,6 +34,7 @@ #include <linux/usb.h> #include <linux/videodev2.h> #include <media/v4l2-ioctl.h> +#include <media/tuner.h> #include <linux/interrupt.h> #include <linux/kthread.h> #include <linux/highmem.h> @@ -228,7 +229,7 @@ static int copy_streams(u8 *data, unsigned long len, unsigned long header = 0; int rc = 0; unsigned int cmd, cpysize, pktsize, size, field, block, line, pos = 0; - struct tm6000_buffer *vbuf; + struct tm6000_buffer *vbuf = NULL; char *voutp = NULL; unsigned int linewidth; @@ -318,7 +319,7 @@ static int copy_streams(u8 *data, unsigned long len, if (pos + size > vbuf->vb.size) cmd = TM6000_URB_MSG_ERR; dev->isoc_ctl.vfield = field; - } + } break; case TM6000_URB_MSG_VBI: break; @@ -333,6 +334,7 @@ static int copy_streams(u8 *data, unsigned long len, size = dev->isoc_ctl.size; pos = dev->isoc_ctl.pos; pktsize = dev->isoc_ctl.pktsize; + field = dev->isoc_ctl.field; } cpysize = (endp - ptr > size) ? size : endp - ptr; if (cpysize) { @@ -343,24 +345,26 @@ static int copy_streams(u8 *data, unsigned long len, if (vbuf) memcpy(&voutp[pos], ptr, cpysize); break; - case TM6000_URB_MSG_AUDIO: - /* Need some code to copy audio buffer */ - if (dev->fourcc == V4L2_PIX_FMT_YUYV) { - /* Swap word bytes */ - int i; + case TM6000_URB_MSG_AUDIO: { + int i; + for (i = 0; i < cpysize; i += 2) + swab16s((u16 *)(ptr + i)); - for (i = 0; i < cpysize; i += 2) - swab16s((u16 *)(ptr + i)); - } tm6000_call_fillbuf(dev, TM6000_AUDIO, ptr, cpysize); break; + } case TM6000_URB_MSG_VBI: /* Need some code to copy vbi buffer */ break; - case TM6000_URB_MSG_PTS: + case TM6000_URB_MSG_PTS: { /* Need some code to copy pts */ + u32 pts; + pts = *(u32 *)ptr; + dprintk(dev, V4L2_DEBUG_ISOC, "field %d, PTS %x", + field, pts); break; } + } } if (ptr + pktsize > endp) { /* End of URB packet, but cmd processing is not @@ -369,6 +373,7 @@ static int copy_streams(u8 *data, unsigned long len, dev->isoc_ctl.pos = pos + cpysize; dev->isoc_ctl.size = size - cpysize; dev->isoc_ctl.cmd = cmd; + dev->isoc_ctl.field = field; dev->isoc_ctl.pktsize = pktsize - (endp - ptr); ptr += endp - ptr; } else { @@ -883,14 +888,19 @@ static void res_free(struct tm6000_core *dev, struct tm6000_fh *fh) static int vidioc_querycap(struct file *file, void *priv, struct v4l2_capability *cap) { + struct tm6000_core *dev = ((struct tm6000_fh *)priv)->dev; strlcpy(cap->driver, "tm6000", sizeof(cap->driver)); strlcpy(cap->card, "Trident TVMaster TM5600/6000/6010", sizeof(cap->card)); cap->version = TM6000_VERSION; cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING | - V4L2_CAP_TUNER | + V4L2_CAP_AUDIO | V4L2_CAP_READWRITE; + + if (dev->tuner_type != TUNER_ABSENT) + cap->capabilities |= V4L2_CAP_TUNER; + return 0; } @@ -1077,35 +1087,37 @@ static int vidioc_s_std (struct file *file, void *priv, v4l2_std_id *norm) return 0; } +static const char *iname [] = { + [TM6000_INPUT_TV] = "Television", + [TM6000_INPUT_COMPOSITE1] = "Composite 1", + [TM6000_INPUT_COMPOSITE2] = "Composite 2", + [TM6000_INPUT_SVIDEO] = "S-Video", +}; + static int vidioc_enum_input(struct file *file, void *priv, - struct v4l2_input *inp) + struct v4l2_input *i) { struct tm6000_fh *fh = priv; struct tm6000_core *dev = fh->dev; + unsigned int n; - switch (inp->index) { - case TM6000_INPUT_TV: - inp->type = V4L2_INPUT_TYPE_TUNER; - strcpy(inp->name, "Television"); - break; - case TM6000_INPUT_COMPOSITE: - if (dev->caps.has_input_comp) { - inp->type = V4L2_INPUT_TYPE_CAMERA; - strcpy(inp->name, "Composite"); - } else - return -EINVAL; - break; - case TM6000_INPUT_SVIDEO: - if (dev->caps.has_input_svid) { - inp->type = V4L2_INPUT_TYPE_CAMERA; - strcpy(inp->name, "S-Video"); - } else - return -EINVAL; - break; - default: + n = i->index; + if (n >= 3) return -EINVAL; - } - inp->std = TM6000_STD; + + if (!dev->vinput[n].type) + return -EINVAL; + + i->index = n; + + if (dev->vinput[n].type == TM6000_INPUT_TV) + i->type = V4L2_INPUT_TYPE_TUNER; + else + i->type = V4L2_INPUT_TYPE_CAMERA; + + strcpy(i->name, iname[dev->vinput[n].type]); + + i->std = TM6000_STD; return 0; } @@ -1119,38 +1131,26 @@ static int vidioc_g_input(struct file *file, void *priv, unsigned int *i) return 0; } + static int vidioc_s_input(struct file *file, void *priv, unsigned int i) { struct tm6000_fh *fh = priv; struct tm6000_core *dev = fh->dev; int rc = 0; - char buf[1]; - switch (i) { - case TM6000_INPUT_TV: - dev->input = i; - *buf = 0; - break; - case TM6000_INPUT_COMPOSITE: - case TM6000_INPUT_SVIDEO: - dev->input = i; - *buf = 1; - break; - default: + if (i >= 3) + return -EINVAL; + if (!dev->vinput[i].type) return -EINVAL; - } - rc = tm6000_read_write_usb(dev, USB_DIR_OUT | USB_TYPE_VENDOR, - REQ_03_SET_GET_MCU_PIN, 0x03, 1, buf, 1); - if (!rc) { - dev->input = i; - rc = vidioc_s_std(file, priv, &dev->vfd->current_norm); - } + dev->input = i; + + rc = vidioc_s_std(file, priv, &dev->vfd->current_norm); return rc; } - /* --- controls ---------------------------------------------- */ +/* --- controls ---------------------------------------------- */ static int vidioc_queryctrl(struct file *file, void *priv, struct v4l2_queryctrl *qc) { @@ -1251,7 +1251,11 @@ static int vidioc_g_tuner(struct file *file, void *priv, t->type = V4L2_TUNER_ANALOG_TV; t->capability = V4L2_TUNER_CAP_NORM; t->rangehigh = 0xffffffffUL; - t->rxsubchans = V4L2_TUNER_SUB_MONO; + t->rxsubchans = V4L2_TUNER_SUB_STEREO; + + v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, g_tuner, t); + + t->audmode = dev->amode; return 0; } @@ -1267,6 +1271,11 @@ static int vidioc_s_tuner(struct file *file, void *priv, if (0 != t->index) return -EINVAL; + dev->amode = t->audmode; + dprintk(dev, 3, "audio mode: %x\n", t->audmode); + + v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_tuner, t); + return 0; } @@ -1320,7 +1329,11 @@ static int radio_querycap(struct file *file, void *priv, le16_to_cpu(dev->udev->descriptor.idVendor), le16_to_cpu(dev->udev->descriptor.idProduct)); cap->version = dev->dev_type; - cap->capabilities = V4L2_CAP_TUNER; + cap->capabilities = V4L2_CAP_TUNER | + V4L2_CAP_AUDIO | + V4L2_CAP_RADIO | + V4L2_CAP_READWRITE | + V4L2_CAP_STREAMING; return 0; } @@ -1337,17 +1350,10 @@ static int radio_g_tuner(struct file *file, void *priv, memset(t, 0, sizeof(*t)); strcpy(t->name, "Radio"); t->type = V4L2_TUNER_RADIO; + t->rxsubchans = V4L2_TUNER_SUB_STEREO; v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, g_tuner, t); - if ((dev->aradio == TM6000_AIP_LINE1) || - (dev->aradio == TM6000_AIP_LINE2)) { - t->rxsubchans = V4L2_TUNER_SUB_MONO; - } - else { - t->rxsubchans = V4L2_TUNER_SUB_STEREO; - } - return 0; } @@ -1368,9 +1374,15 @@ static int radio_s_tuner(struct file *file, void *priv, static int radio_enum_input(struct file *file, void *priv, struct v4l2_input *i) { + struct tm6000_fh *fh = priv; + struct tm6000_core *dev = fh->dev; + if (i->index != 0) return -EINVAL; + if (!dev->rinput.type) + return -EINVAL; + strcpy(i->name, "Radio"); i->type = V4L2_INPUT_TYPE_TUNER; @@ -1379,7 +1391,14 @@ static int radio_enum_input(struct file *file, void *priv, static int radio_g_input(struct file *filp, void *priv, unsigned int *i) { - *i = 0; + struct tm6000_fh *fh = priv; + struct tm6000_core *dev = fh->dev; + + if (dev->input !=5) + return -EINVAL; + + *i = dev->input -5; + return 0; } @@ -1399,6 +1418,17 @@ static int radio_s_audio(struct file *file, void *priv, static int radio_s_input(struct file *filp, void *priv, unsigned int i) { + struct tm6000_fh *fh = priv; + struct tm6000_core *dev = fh->dev; + + if (i) + return -EINVAL; + + if (!dev->rinput.type) + return -EINVAL; + + dev->input = i + 5; + return 0; } @@ -1512,16 +1542,12 @@ static int tm6000_open(struct file *file) if (fh->radio) { dprintk(dev, V4L2_DEBUG_OPEN, "video_open: setting radio device\n"); - tm6000_set_audio_input(dev, dev->aradio); - tm6000_set_volume(dev, dev->ctl_volume); + dev->input = 5; + tm6000_set_audio_rinput(dev); v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_radio); tm6000_prepare_isoc(dev); tm6000_start_thread(dev); } - else { - tm6000_set_audio_input(dev, dev->avideo); - tm6000_set_volume(dev, dev->ctl_volume); - } return 0; } @@ -1647,10 +1673,10 @@ static struct video_device tm6000_template = { }; static const struct v4l2_file_operations radio_fops = { - .owner = THIS_MODULE, - .open = tm6000_open, - .release = tm6000_release, - .ioctl = video_ioctl2, + .owner = THIS_MODULE, + .open = tm6000_open, + .release = tm6000_release, + .unlocked_ioctl = video_ioctl2, }; static const struct v4l2_ioctl_ops radio_ioctl_ops = { @@ -1730,24 +1756,26 @@ int tm6000_v4l2_register(struct tm6000_core *dev) printk(KERN_INFO "%s: registered device %s\n", dev->name, video_device_node_name(dev->vfd)); - dev->radio_dev = vdev_init(dev, &tm6000_radio_template, - "radio"); - if (!dev->radio_dev) { - printk(KERN_INFO "%s: can't register radio device\n", - dev->name); - return ret; /* FIXME release resource */ - } + if (dev->caps.has_radio) { + dev->radio_dev = vdev_init(dev, &tm6000_radio_template, + "radio"); + if (!dev->radio_dev) { + printk(KERN_INFO "%s: can't register radio device\n", + dev->name); + return ret; /* FIXME release resource */ + } - ret = video_register_device(dev->radio_dev, VFL_TYPE_RADIO, - radio_nr); - if (ret < 0) { - printk(KERN_INFO "%s: can't register radio device\n", - dev->name); - return ret; /* FIXME release resource */ - } + ret = video_register_device(dev->radio_dev, VFL_TYPE_RADIO, + radio_nr); + if (ret < 0) { + printk(KERN_INFO "%s: can't register radio device\n", + dev->name); + return ret; /* FIXME release resource */ + } - printk(KERN_INFO "%s: registered device %s\n", - dev->name, video_device_node_name(dev->radio_dev)); + printk(KERN_INFO "%s: registered device %s\n", + dev->name, video_device_node_name(dev->radio_dev)); + } printk(KERN_INFO "Trident TVMaster TM5600/TM6000/TM6010 USB2 board (Load status: %d)\n", ret); return ret; diff --git a/drivers/staging/tm6000/tm6000.h b/drivers/staging/tm6000/tm6000.h index 99ae50e82b2..ae6369b9a90 100644 --- a/drivers/staging/tm6000/tm6000.h +++ b/drivers/staging/tm6000/tm6000.h @@ -40,11 +40,24 @@ #define TM6000_VERSION KERNEL_VERSION(0, 0, 2) /* Inputs */ - enum tm6000_itype { - TM6000_INPUT_TV = 0, - TM6000_INPUT_COMPOSITE, + TM6000_INPUT_TV = 1, + TM6000_INPUT_COMPOSITE1, + TM6000_INPUT_COMPOSITE2, TM6000_INPUT_SVIDEO, + TM6000_INPUT_DVB, + TM6000_INPUT_RADIO, +}; + +enum tm6000_mux { + TM6000_VMUX_VIDEO_A = 1, + TM6000_VMUX_VIDEO_B, + TM6000_VMUX_VIDEO_AB, + TM6000_AMUX_ADC1, + TM6000_AMUX_ADC2, + TM6000_AMUX_SIF1, + TM6000_AMUX_SIF2, + TM6000_AMUX_I2S, }; enum tm6000_devtype { @@ -53,12 +66,12 @@ enum tm6000_devtype { TM6010, }; -enum tm6000_inaudio { - TM6000_AIP_UNK = 0, - TM6000_AIP_SIF1, - TM6000_AIP_SIF2, - TM6000_AIP_LINE1, - TM6000_AIP_LINE2, +struct tm6000_input { + enum tm6000_itype type; + enum tm6000_mux vmux; + enum tm6000_mux amux; + unsigned int v_gpio; + unsigned int a_gpio; }; /* ------------------------------------------------------------------ @@ -129,8 +142,7 @@ struct tm6000_capabilities { unsigned int has_zl10353:1; unsigned int has_eeprom:1; unsigned int has_remote:1; - unsigned int has_input_comp:1; - unsigned int has_input_svid:1; + unsigned int has_radio:1; }; struct tm6000_dvb { @@ -167,6 +179,8 @@ struct tm6000_core { int model; /* index in the device_data struct */ int devno; /* marks the number of this device */ enum tm6000_devtype dev_type; /* type of device */ + unsigned char eedata[256]; /* Eeprom data */ + unsigned eedata_size; /* Size of the eeprom info */ v4l2_std_id norm; /* Current norm */ int width, height; /* Selected resolution */ @@ -211,6 +225,9 @@ struct tm6000_core { struct v4l2_device v4l2_dev; int input; + struct tm6000_input vinput[3]; /* video input */ + struct tm6000_input rinput; /* radio input */ + int freq; unsigned int fourcc; @@ -218,6 +235,7 @@ struct tm6000_core { int ctl_mute; /* audio */ int ctl_volume; + int amode; /* DVB-T support */ struct tm6000_dvb *dvb; @@ -226,8 +244,6 @@ struct tm6000_core { struct snd_tm6000_card *adev; struct work_struct wq_trigger; /* Trigger to start/stop audio for alsa module */ atomic_t stream_started; /* stream should be running if true */ - enum tm6000_inaudio avideo; - enum tm6000_inaudio aradio; struct tm6000_IR *ir; @@ -302,7 +318,7 @@ int tm6000_init(struct tm6000_core *dev); int tm6000_init_analog_mode(struct tm6000_core *dev); int tm6000_init_digital_mode(struct tm6000_core *dev); int tm6000_set_audio_bitrate(struct tm6000_core *dev, int bitrate); -int tm6000_set_audio_input(struct tm6000_core *dev, enum tm6000_inaudio ainp); +int tm6000_set_audio_rinput(struct tm6000_core *dev); int tm6000_tvaudio_set_mute(struct tm6000_core *dev, u8 mute); void tm6000_set_volume(struct tm6000_core *dev, int vol); @@ -323,7 +339,7 @@ int tm6000_call_fillbuf(struct tm6000_core *dev, enum tm6000_ops_type type, /* In tm6000-stds.c */ void tm6000_get_std_res(struct tm6000_core *dev); -int tm6000_set_standard(struct tm6000_core *dev, v4l2_std_id *norm); +int tm6000_set_standard(struct tm6000_core *dev); /* In tm6000-i2c.c */ int tm6000_i2c_register(struct tm6000_core *dev); |