Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[PATCH 000/141] V4L/DVB updates part 1

5 views
Skip to first unread message

mch...@infradead.org

unread,
Mar 20, 2006, 10:50:09 AM3/20/06
to
This patch series is also available under v4l-dvb.git tree at:
kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git

Linus, please pull these from master branch.

It contains the following stuff:

- Add PCI ID for DigitalNow DVB-T Dual, rebranded DViCO FusionHDTV DVB-T Dual.
- Hauppauge Grey Remote support
- Move all IR keymaps to ir-common module
- Remove duplicated keymaps and add keymap for KWorld LTV883IR.
- Fix handling of VIDIOC_G_TUNER audmode in msp3400
- Add probe check for the tda9840.
- VIDEO_CX88_ALSA must select SND_PCM
- Fixes tvp5150a/am1 detection.
- Added credits for em28xx-video.c
- added some code for VBI processing and cleanup debug dump
- Included new sliced VBI types to videodev2.h and tvp5150
- Mark Typhoon cards as Lifeview OEM's
- Implemented sliced VBI set on VIDIOC_S_FMT
- group dvb-bt8xx Subsystem ID's together, in order.
- Kill nxt2002 in favor of the nxt200x module
- rename dvb_pll_tbmv30111in to dvb_pll_samsung_tbmv
- Recognise Hauppauge card #34519
- make VP-3054 Secondary I2C Bus Support a Kconfig option.
- Cause tda9887 to use I2C_DRIVERID_TDA9887
- added some VBI macros and moved minor definitions to header file
- Added iocls to configure VBI on tvp5150
- Several fixes to prepare for VBI
- Implemented VIDIOC_G_FMT/S_FMT for sliced VBI
- CodingStyle fixes.
- audmode and rxsubchans fixes (VIDIOC_G/S_TUNER)
- drivers/media/dvb/ possible cleanups
- Missing break statement on tuner-core
- Add new internal VIDIOC_INT commands
- fixed spelling error, exectuted --> executed.
- Hauppauge HVR 900 Composite support
- Fix printk type warning
- changed comment in tuner-core.c
- rename cb variable names in tuner structures for global consistency
- move config byte from tuner_params to tuner_range struct.
- removed duplicated tuner_ranges
- media video stradis memory fix
- Allow tristate build for cx88-vp3054-i2c
- Alters MAINTAINERS file to point to newer v4l-dvb email
- Add count to tunertype struct
- Fix NICAM buzz on analog sound
- Add support for the Avermedia 777 DVB-T card
- Move video std detection to top of set_tv_freq function
- Allow multiple tuner params in each tuner definition
- Tuner_dbg will show tuner param and range selected
- Update tuner comments
- Allow SAA7134 to fall back to AM sound when there is NICAM-L
- Added terratec hybrid xs and kworld 2800rf support
- Use default tuner_params if desired_type not available
- Show debug for tuners trying to use unsupported video standards
- Changed description of KWorld PVR TV 2800RF
- Added signal detection support to tvp5150
- Fix [Bug 5895] to correct snd_87x autodetect
- Add IR support to KWorld DVB-T (cx22702-based)
- Kconfig: DVB_USB_CXUSB depends on DVB_LGDT330X and DVB_MT352
- Add standard for South Korean NTSC-M using A2 audio.
- Added support for the LifeView FlyDVB-T LR301 card
- TDA8290 update
- TDA10046 Driver update
- Added support for the ADS Instant TV DUO Cardbus PTV331
- Fixed i2c return value, conversion mdelay to msleep
- Support for Galaxis DVB-S rev1.3
- Use parallel transport for FusionHDTV Dual Digital USB
- Use MT352 parallel transport function for all Bluebird FusionHDTV DVB-T boxes.
- FIX: Multiple usage of VP7045-based devices
- FIX: Check if FW was downloaded or not + new firmware file
- Fixed em28xx based system lockup
- Added support for the Tevion DVB-T 220RF card
- Add initial support for KWorld HardwareMpegTV XPert
- Makes Some symbols static.
- sem2mutex: drivers/media/, #2
- fix saa7146 kobject register failure
- DVB: remove the at76c651/tda80xx frontends
- Fix Samsung tuner frequency ranges
- Disabled debug on by default in tvp5150
- Adding support for Terratec Prodigy XS
- Removing personal email from DVB maintainers
- .gitignore should also ignore StGit generated dirs
- Added support for xc3028 analogue tuner (Hauppauge HVR900, Terratec Hybrid XS)
- Fixed xc3028 firmware extractor, added terratec fw support
- Fixed amux hauppauge hvr900/terratec hybrid xs
- XC3028 code marked with an special define option
- Added ET61X251 fourcc type
- Fix in-kernel build
- Bt8xx documentation authors fix
- Drivers/media/dvb/frontends/mt312.c: cleanups
- Make a struct static
- Upstream sync - make 2 structs static
- KWorld HardwareMpegTV XPert: Add radio support
- KWorld HardwareMpegTV XPert must set gpio2
- Add saa713x card: ELSA EX-VISION 700TV (saa7130)
- Pinnacle PCTV 40i: add filtered Composite2 input
- Fixed saa7134 ALSA initialization with multiple cards
- Remote control codes for BTTV_BOARD_CONTVFMI
- Cxusb: fix lgdt3303 naming
- Fix maximum for the saturation and contrast controls.
- Add support for Kworld ATSC110
- KWorld ATSC110: implement set_pll_input
- Kworld ATSC110: enable composite and svideo inputs
- Kworld ATSC110: cleanups
- Kworld ATSC110: initialize the tuner for analog mode on module load
- KWorld HardwareMpegTV XPert: update comments
- LifeView FlyDVB-T Duo: add support for remote control
- Add debug to ioctl arguments.
- Fix a small bug when constructing fps and line numbers
- Debug messages for ioctl improved
- Adds debuging v4l2_memory enum
- Add AUDIO_GET_PTS and VIDEO_GET_PTS ioctls
- Add cpia2 camera support
- Support for Satelco EasyWatch DVB-S light
- Restore power on defaults of tda9887 after tda8290 probe
- TUV1236d: declare buffer as static const
- Fix stv0297 for qam128 on tt c1500 (saa7146)
- Dvb: fix __init/__exit section references in av7110 driver
- Dvb-core: remove dead code
- Ignore DiSEqC messages > 6 and < 3
- Fix broken IF-OUT Relay handling
- Fix module parameters
- Documentation update
- Do a RESYNC for all cards
- XC3028 code removed from -git versions
- Cx88: reduce excessive logging
- Bttv: correct bttv_risc_packed buffer size
- Fixed Pinnacle 300i DVB-T support
- Add DVB-T support for the LifeView DVB Trio PCI card
- ELSA EX-VISION 700TV: fix incorrect PCI subsystem ID
- ELSA EX-VISION 500TV: fix incorrect PCI subsystem ID
- IR keymaps are exported by the ir-common module now
- cpia2/cpia2_v4l.c cleanups
- Fixes for Lifeview Trio non fatal bugs
- Coding style fixes in saa7134-dvb.c
- Workaround to fix initialization for Nexus CA
- Refactored LNBP21 and BSBE1 support
- TechnoTrend S-1500 card handling moved from budget.c to budget-ci.c
- Use refactored LNBP21 and BSBE1 code
- DViCO FusionHDTV DVB-T Hybrid and ZL10353-based FusionHDTV DVB-T Plus support
- Kconfig: fix in-kernel build for cx88-dvb: zl10353 frontend
- Move DViCO hybrid initialisation data from stack.
- FE6600 is a Thomson tuner
- Typos grab bag of the month
- Saa7134: document that there's also a 220RF from KWorld
- Msp3400-kthreads.c: make 3 functions static

Cheers,
Mauro.

V4L/DVB development is hosted at http://linuxtv.org
Development Mercurial trees are available at http://linuxtv.org/hg
---

.gitignore | 2
Documentation/dvb/avermedia.txt | 10
Documentation/dvb/bt8xx.txt | 6
Documentation/dvb/get_dvb_firmware | 23
Documentation/dvb/readme.txt | 32
Documentation/video4linux/CARDLIST.cx88 | 4
Documentation/video4linux/CARDLIST.em28xx | 3
Documentation/video4linux/CARDLIST.saa7134 | 22
Documentation/video4linux/CARDLIST.tuner | 4
Documentation/video4linux/README.cpia2 | 132
Documentation/video4linux/cpia2_overview.txt | 38
MAINTAINERS | 12
drivers/media/common/Makefile | 1
drivers/media/common/ir-common.c | 519 --
drivers/media/common/ir-functions.c | 272 +
drivers/media/common/ir-keymaps.c | 1731 ++++++++-
drivers/media/common/saa7146_core.c | 6
drivers/media/common/saa7146_fops.c | 18
drivers/media/common/saa7146_i2c.c | 4
drivers/media/common/saa7146_vbi.c | 2
drivers/media/common/saa7146_video.c | 30
drivers/media/dvb/b2c2/Kconfig | 2
drivers/media/dvb/b2c2/flexcop-common.h | 6
drivers/media/dvb/b2c2/flexcop-dma.c | 35
drivers/media/dvb/b2c2/flexcop-fe-tuner.c | 13
drivers/media/dvb/b2c2/flexcop-i2c.c | 6
drivers/media/dvb/b2c2/flexcop-misc.c | 6
drivers/media/dvb/b2c2/flexcop-pci.c | 6
drivers/media/dvb/b2c2/flexcop-reg.h | 4
drivers/media/dvb/bt8xx/bt878.c | 50
drivers/media/dvb/bt8xx/bt878.h | 21
drivers/media/dvb/bt8xx/dst.c | 16
drivers/media/dvb/bt8xx/dst_ca.c | 6
drivers/media/dvb/bt8xx/dst_common.h | 3
drivers/media/dvb/bt8xx/dvb-bt8xx.c | 47
drivers/media/dvb/bt8xx/dvb-bt8xx.h | 3
drivers/media/dvb/cinergyT2/cinergyT2.c | 47
drivers/media/dvb/dvb-core/demux.h | 2
drivers/media/dvb/dvb-core/dmxdev.c | 105
drivers/media/dvb/dvb-core/dmxdev.h | 14
drivers/media/dvb/dvb-core/dvb_demux.c | 104
drivers/media/dvb/dvb-core/dvb_demux.h | 4
drivers/media/dvb/dvb-core/dvb_frontend.c | 21
drivers/media/dvb/dvb-core/dvb_frontend.h | 1
drivers/media/dvb/dvb-core/dvb_net.c | 14
drivers/media/dvb/dvb-usb/Kconfig | 12
drivers/media/dvb/dvb-usb/cxusb.c | 24
drivers/media/dvb/dvb-usb/dibusb-common.c | 4
drivers/media/dvb/dvb-usb/digitv.c | 17
drivers/media/dvb/dvb-usb/dvb-usb-firmware.c | 8
drivers/media/dvb/dvb-usb/dvb-usb-init.c | 6
drivers/media/dvb/dvb-usb/dvb-usb-urb.c | 4
drivers/media/dvb/dvb-usb/dvb-usb.h | 12
drivers/media/dvb/dvb-usb/vp702x.c | 10
drivers/media/dvb/dvb-usb/vp702x.h | 2
drivers/media/dvb/dvb-usb/vp7045-fe.c | 6
drivers/media/dvb/dvb-usb/vp7045.c | 4
drivers/media/dvb/frontends/Kconfig | 32
drivers/media/dvb/frontends/Makefile | 4
drivers/media/dvb/frontends/at76c651.c | 450 --
drivers/media/dvb/frontends/at76c651.h | 47
drivers/media/dvb/frontends/bcm3510.c | 9
drivers/media/dvb/frontends/bsbe1.h | 123
drivers/media/dvb/frontends/cx24110.c | 13
drivers/media/dvb/frontends/cx24110.h | 1
drivers/media/dvb/frontends/dvb-pll.c | 75
drivers/media/dvb/frontends/dvb-pll.h | 11
drivers/media/dvb/frontends/lnbp21.h | 139
drivers/media/dvb/frontends/mt312.c | 116
drivers/media/dvb/frontends/mt312.h | 6
drivers/media/dvb/frontends/nxt2002.c | 706 ---
drivers/media/dvb/frontends/nxt2002.h | 23
drivers/media/dvb/frontends/nxt200x.c | 58
drivers/media/dvb/frontends/stv0297.c | 4
drivers/media/dvb/frontends/tda1004x.c | 25
drivers/media/dvb/frontends/tda1004x.h | 3
drivers/media/dvb/frontends/tda80xx.c | 734 ----
drivers/media/dvb/frontends/tda80xx.h | 51
drivers/media/dvb/frontends/zl10353.c | 311 +
drivers/media/dvb/frontends/zl10353.h | 43
drivers/media/dvb/frontends/zl10353_priv.h | 42
drivers/media/dvb/ttpci/av7110.c | 160
drivers/media/dvb/ttpci/av7110.h | 9
drivers/media/dvb/ttpci/av7110_hw.c | 43
drivers/media/dvb/ttpci/av7110_ir.c | 30
drivers/media/dvb/ttpci/budget-av.c | 4
drivers/media/dvb/ttpci/budget-ci.c | 18
drivers/media/dvb/ttpci/budget.c | 156
drivers/media/dvb/ttpci/budget.h | 4
drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c | 32
drivers/media/dvb/ttusb-dec/ttusb_dec.c | 31
drivers/media/radio/miropcm20-rds-core.c | 11
drivers/media/radio/radio-aimslab.c | 20
drivers/media/radio/radio-aztech.c | 12
drivers/media/radio/radio-maestro.c | 11
drivers/media/radio/radio-maxiradio.c | 11
drivers/media/radio/radio-sf16fmi.c | 22
drivers/media/radio/radio-sf16fmr2.c | 22
drivers/media/radio/radio-typhoon.c | 12
drivers/media/radio/radio-zoltrix.c | 26
drivers/media/video/Kconfig | 10
drivers/media/video/Makefile | 5
drivers/media/video/arv.c | 16
drivers/media/video/bttv-cards.c | 6
drivers/media/video/bttv-driver.c | 50
drivers/media/video/bttv-input.c | 248 -
drivers/media/video/bttv-risc.c | 12
drivers/media/video/bw-qcam.c | 16
drivers/media/video/bw-qcam.h | 2
drivers/media/video/c-qcam.c | 19
drivers/media/video/cpia.c | 104
drivers/media/video/cpia.h | 5
drivers/media/video/cpia2/Makefile | 3
drivers/media/video/cpia2/cpia2.h | 497 ++
drivers/media/video/cpia2/cpia2_core.c | 2525 ++++++++++++++
drivers/media/video/cpia2/cpia2_registers.h | 476 ++
drivers/media/video/cpia2/cpia2_usb.c | 907 +++++
drivers/media/video/cpia2/cpia2_v4l.c | 2135 +++++++++++
drivers/media/video/cpia2/cpia2dev.h | 50
drivers/media/video/cpia2/cpia2patch.h | 233 +
drivers/media/video/cx25840/cx25840-core.c | 100
drivers/media/video/cx25840/cx25840-vbi.c | 6
drivers/media/video/cx25840/cx25840.h | 1
drivers/media/video/cx88/Kconfig | 23
drivers/media/video/cx88/Makefile | 6
drivers/media/video/cx88/cx88-alsa.c | 6
drivers/media/video/cx88/cx88-cards.c | 114
drivers/media/video/cx88/cx88-core.c | 16
drivers/media/video/cx88/cx88-dvb.c | 110
drivers/media/video/cx88/cx88-input.c | 339 -
drivers/media/video/cx88/cx88-video.c | 40
drivers/media/video/cx88/cx88.h | 6
drivers/media/video/em28xx/em28xx-cards.c | 250 -
drivers/media/video/em28xx/em28xx-core.c | 17
drivers/media/video/em28xx/em28xx-i2c.c | 9
drivers/media/video/em28xx/em28xx-input.c | 85
drivers/media/video/em28xx/em28xx-video.c | 1561 ++++----
drivers/media/video/em28xx/em28xx.h | 11
drivers/media/video/hexium_orion.c | 2
drivers/media/video/ir-kbd-i2c.c | 52
drivers/media/video/meye.c | 112
drivers/media/video/meye.h | 4
drivers/media/video/msp3400-driver.c | 80
drivers/media/video/msp3400-kthreads.c | 361 --
drivers/media/video/msp3400.h | 12
drivers/media/video/mxb.c | 4
drivers/media/video/planb.c | 8
drivers/media/video/planb.h | 2
drivers/media/video/pms.c | 28
drivers/media/video/saa5246a.c | 10
drivers/media/video/saa5249.c | 10
drivers/media/video/saa7115.c | 10
drivers/media/video/saa7134/saa7134-alsa.c | 10
drivers/media/video/saa7134/saa7134-cards.c | 289 +
drivers/media/video/saa7134/saa7134-core.c | 2
drivers/media/video/saa7134/saa7134-dvb.c | 198 +
drivers/media/video/saa7134/saa7134-empress.c | 8
drivers/media/video/saa7134/saa7134-input.c | 513 --
drivers/media/video/saa7134/saa7134-oss.c | 40
drivers/media/video/saa7134/saa7134-tvaudio.c | 14
drivers/media/video/saa7134/saa7134-video.c | 40
drivers/media/video/saa7134/saa7134.h | 14
drivers/media/video/stradis.c | 15
drivers/media/video/tda8290.c | 16
drivers/media/video/tda9887.c | 9
drivers/media/video/tuner-core.c | 92
drivers/media/video/tuner-simple.c | 179
drivers/media/video/tuner-types.c | 679 +--
drivers/media/video/tvaudio.c | 35
drivers/media/video/tvp5150.c | 829 ++--
drivers/media/video/tvp5150_reg.h | 125
drivers/media/video/v4l2-common.c | 592 +++
drivers/media/video/video-buf-dvb.c | 10
drivers/media/video/video-buf.c | 42
drivers/media/video/videocodec.h | 2
drivers/media/video/videodev.c | 22
drivers/media/video/vino.c | 33
drivers/media/video/zr36050.c | 2
drivers/media/video/zr36060.c | 2
drivers/media/video/zr36120_i2c.c | 2
include/linux/dvb/audio.h | 13
include/linux/dvb/video.h | 13
include/linux/videodev2.h | 97
include/media/ir-common.h | 48
include/media/saa7146.h | 21
include/media/tuner-types.h | 3
include/media/tuner.h | 8
include/media/v4l2-common.h | 65
include/media/video-buf-dvb.h | 2
include/media/video-buf.h | 2
190 files changed, 14518 insertions(+), 7458 deletions(-)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majo...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

mch...@infradead.org

unread,
Mar 20, 2006, 10:50:10 AM3/20/06
to
From: Chris Pascoe <c.pa...@itee.uq.edu.au>
Date: 1141168991 -0300

The init_data array is never changed and need not be on the stack.
Turn it into a static variable.

Signed-off-by: Michael Krufky <mkr...@linuxtv.org>
Signed-off-by: Chris Pascoe <c.pa...@itee.uq.edu.au>
Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c
index d91e5b3..f655567 100644
--- a/drivers/media/video/cx88/cx88-cards.c
+++ b/drivers/media/video/cx88/cx88-cards.c
@@ -1435,7 +1435,7 @@ static void dvico_fusionhdtv_hybrid_init
{
struct i2c_msg msg = { .addr = 0x45, .flags = 0 };
int i, err;
- u8 init_bufs[13][5] = {
+ static u8 init_bufs[13][5] = {
{ 0x10, 0x00, 0x20, 0x01, 0x03 },
{ 0x10, 0x10, 0x01, 0x00, 0x21 },
{ 0x10, 0x10, 0x10, 0x00, 0xCA },

mch...@infradead.org

unread,
Mar 20, 2006, 10:50:11 AM3/20/06
to
From: Mauro Carvalho Chehab <mch...@infradead.org>
Date: 1141009657 -0300

- Current xc3028 support is still experimental, requiring more work to be
sent to mainstream. So, it was marked inside some defines, in order to be
removed by gentree.pl stript. Script also updated to remove it.

Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
index 00665d6..6666305 100644
--- a/drivers/media/video/em28xx/em28xx-cards.c
+++ b/drivers/media/video/em28xx/em28xx-cards.c
@@ -154,6 +154,7 @@ struct em28xx_board em28xx_boards[] = {
.amux = 1,
}},
},
+#ifdef CONFIG_XC3028
[EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900] = {
.name = "Hauppauge WinTV HVR 900",
.vchannels = 3,
@@ -222,6 +223,7 @@ struct em28xx_board em28xx_boards[] = {
.amux = 1,
}},
},
+#endif
[EM2820_BOARD_MSI_VOX_USB_2] = {
.name = "MSI VOX USB 2.0",
.vchannels = 3,
@@ -340,9 +342,11 @@ struct usb_device_id em28xx_id_table []
{ USB_DEVICE(0x2304, 0x0208), .driver_info = EM2820_BOARD_PINNACLE_USB_2 },
{ USB_DEVICE(0x2040, 0x4200), .driver_info = EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 },
{ USB_DEVICE(0x2304, 0x0207), .driver_info = EM2820_BOARD_PINNACLE_DVC_90 },
+#ifdef CONFIG_XC3028
{ USB_DEVICE(0x2040, 0x6500), .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900 },
{ USB_DEVICE(0x0ccd, 0x0042), .driver_info = EM2880_BOARD_TERRATEC_HYBRID_XS },
{ USB_DEVICE(0x0ccd, 0x0047), .driver_info = EM2880_BOARD_TERRATEC_PRODIGY_XS },
+#endif
{ },
};

diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index 4a660a4..3a96cc4 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -216,9 +216,11 @@ static void set_type(struct i2c_client *
i2c_master_send(c,buffer,4);
default_tuner_init(c);
break;
+#ifdef CONFIG_XC3028
case TUNER_XCEIVE_XC3028:
xc3028_init(c);
break;
+#endif
default:
default_tuner_init(c);
break;
diff --git a/drivers/media/video/tuner-types.c b/drivers/media/video/tuner-types.c
diff --git a/drivers/media/video/tuner-types.c b/drivers/media/video/tuner-types.c
index a4384e6..15761dd 100644
--- a/drivers/media/video/tuner-types.c
+++ b/drivers/media/video/tuner-types.c
@@ -983,23 +983,6 @@ static struct tuner_params tuner_samsung
},
};

-/* ------------ TUNER_XCEIVE_XC3028 - Xceive xc3028 ------------ */
-
-static struct tuner_range tuner_xceive_xc3028_ranges[] = {
- { 16 * 140.25 /*MHz*/, 0x02, },
- { 16 * 463.25 /*MHz*/, 0x04, },
- { 16 * 999.99 , 0x01, },
-};
-
-static struct tuner_params tuner_xceive_xc3028_params[] = {
- {
- .type = TUNER_XCEIVE_XC3028,
- .ranges = tuner_xceive_xc3028_ranges,
- .count = ARRAY_SIZE(tuner_xceive_xc3028_ranges),
- },
-};
-
-
/* --------------------------------------------------------------------- */

struct tunertype tuners[] = {
@@ -1369,7 +1352,7 @@ struct tunertype tuners[] = {
},
[TUNER_XCEIVE_XC3028] = { /* Xceive 3028 */
.name = "Xceive xc3028",
- .params = tuner_xceive_xc3028_params,
+ /* see xc3028.c for details */
},
};

mch...@infradead.org

unread,
Mar 20, 2006, 10:50:13 AM3/20/06
to
From: Curt Meyers <cme...@boilerbots.com>
Date: 1141009707 -0300

- When tuning VSB, use ANT input
- When tuning QAM, use CABLE input

Signed-off-by: Curt Meyers <cme...@boilerbots.com>
Signed-off-by: Michael Krufky <mkr...@linuxtv.org>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c
index 354bbf7..7577962 100644
--- a/drivers/media/video/saa7134/saa7134-dvb.c
+++ b/drivers/media/video/saa7134/saa7134-dvb.c
@@ -928,10 +928,20 @@ static struct nxt200x_config avertvhda18
.pll_desc = &dvb_pll_tdhu2,
};

+static int nxt200x_set_pll_input(u8 *buf, int input)
+{
+ if (input)
+ buf[3] |= 0x08;
+ else
+ buf[3] &= ~0x08;
+ return 0;
+}
+
static struct nxt200x_config kworldatsc110 = {
.demod_address = 0x0a,
.pll_address = 0x61,
.pll_desc = &dvb_pll_tuv1236d,
+ .set_pll_input = nxt200x_set_pll_input,
};
#endif

mch...@infradead.org

unread,
Mar 20, 2006, 10:50:14 AM3/20/06
to
From: Markus Rechberger <mrech...@gmail.com>
Date: 1139300741 -0200

Changed description of KWorld PVR TV 2800RF

Signed-off-by: Markus Rechberger <mrech...@gmail.com>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/Documentation/video4linux/CARDLIST.em28xx b/Documentation/video4linux/CARDLIST.em28xx
diff --git a/Documentation/video4linux/CARDLIST.em28xx b/Documentation/video4linux/CARDLIST.em28xx
index 7a903f7..a302668 100644
--- a/Documentation/video4linux/CARDLIST.em28xx
+++ b/Documentation/video4linux/CARDLIST.em28xx
@@ -8,4 +8,4 @@
7 -> Leadtek Winfast USB II (em2800)
8 -> Kworld USB2800 (em2800)
9 -> Pinnacle Dazzle DVC 90 (em2820/em2840) [2304:0207]
- 12 -> Unknown EM2820/2840 video grabber (em2820/em2840)
+ 12 -> Kworld PVR TV 2800 RF (em2820/em2840)


diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c

index 573d24d..a9e7cec 100644
--- a/drivers/media/video/em28xx/em28xx-cards.c
+++ b/drivers/media/video/em28xx/em28xx-cards.c
@@ -73,7 +73,7 @@ struct em28xx_board em28xx_boards[] = {
}},
},
[EM2820_BOARD_KWORLD_PVRTV2800RF] = {
- .name = "Unknown EM2820/2840 video grabber",
+ .name = "Kworld PVR TV 2800 RF",
.is_em2800 = 0,
.vchannels = 2,
.norm = VIDEO_MODE_PAL,

mch...@infradead.org

unread,
Mar 20, 2006, 10:50:16 AM3/20/06
to
From: Mauro Carvalho Chehab <mch...@infradead.org>
Date: 1141009660 -0300

Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 1dd8efe..3f15043 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -326,6 +326,7 @@ struct v4l2_pix_format
#define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S','9','1','0') /* SN9C10x compression */
#define V4L2_PIX_FMT_PWC1 v4l2_fourcc('P','W','C','1') /* pwc older webcam */
#define V4L2_PIX_FMT_PWC2 v4l2_fourcc('P','W','C','2') /* pwc newer webcam */
+#define V4L2_PIX_FMT_ET61X251 v4l2_fourcc('E','6','2','5') /* ET61X251 compression */

/*
* F O R M A T E N U M E R A T I O N

mch...@infradead.org

unread,
Mar 20, 2006, 10:50:13 AM3/20/06
to
From: Thilo Berger <thilo_...@gmx.net>
Date: 1141009748 -0300

Support for Satelco EasyWatch DVB-S light.

Signed-off-by: Thilo Berger <thilo_...@gmx.net>
Signed-off-by: Oliver Endriss <o.en...@gmx.de>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/dvb/ttpci/budget-av.c b/drivers/media/dvb/ttpci/budget-av.c
diff --git a/drivers/media/dvb/ttpci/budget-av.c b/drivers/media/dvb/ttpci/budget-av.c
index 1465c04..9dd4745 100644
--- a/drivers/media/dvb/ttpci/budget-av.c
+++ b/drivers/media/dvb/ttpci/budget-av.c
@@ -1000,6 +1000,7 @@ static u8 read_pwm(struct budget_av *bud

#define SUBID_DVBS_TV_STAR 0x0014
#define SUBID_DVBS_TV_STAR_CI 0x0016
+#define SUBID_DVBS_EASYWATCH 0x001e
#define SUBID_DVBC_KNC1 0x0020
#define SUBID_DVBC_KNC1_PLUS 0x0021
#define SUBID_DVBC_CINERGY1200 0x1156
@@ -1038,6 +1039,7 @@ static void frontend_init(struct budget_
case SUBID_DVBS_TV_STAR:
case SUBID_DVBS_TV_STAR_CI:
case SUBID_DVBS_CYNERGY1200N:
+ case SUBID_DVBS_EASYWATCH:
fe = stv0299_attach(&philips_sd1878_config,
&budget_av->budget.i2c_adap);
break;
@@ -1285,6 +1287,7 @@ MAKE_BUDGET_INFO(knc1s, "KNC1 DVB-S", BU
MAKE_BUDGET_INFO(knc1c, "KNC1 DVB-C", BUDGET_KNC1C);
MAKE_BUDGET_INFO(knc1t, "KNC1 DVB-T", BUDGET_KNC1T);
MAKE_BUDGET_INFO(kncxs, "KNC TV STAR DVB-S", BUDGET_TVSTAR);
+MAKE_BUDGET_INFO(satewpls, "Satelco EasyWatch DVB-S light", BUDGET_TVSTAR);
MAKE_BUDGET_INFO(knc1sp, "KNC1 DVB-S Plus", BUDGET_KNC1SP);
MAKE_BUDGET_INFO(knc1cp, "KNC1 DVB-C Plus", BUDGET_KNC1CP);
MAKE_BUDGET_INFO(knc1tp, "KNC1 DVB-T Plus", BUDGET_KNC1TP);
@@ -1300,6 +1303,7 @@ static struct pci_device_id pci_tbl[] =
MAKE_EXTENSION_PCI(knc1sp, 0x1131, 0x0011),
MAKE_EXTENSION_PCI(kncxs, 0x1894, 0x0014),
MAKE_EXTENSION_PCI(kncxs, 0x1894, 0x0016),
+ MAKE_EXTENSION_PCI(satewpls, 0x1894, 0x001e),
MAKE_EXTENSION_PCI(knc1c, 0x1894, 0x0020),
MAKE_EXTENSION_PCI(knc1cp, 0x1894, 0x0021),
MAKE_EXTENSION_PCI(knc1t, 0x1894, 0x0030),

mch...@infradead.org

unread,
Mar 20, 2006, 10:50:15 AM3/20/06
to
From: Oliver Endriss <o.en...@gmx.de>
Date: 1139302151 -0200

support for Galaxis DVB-S rev1.3 (subsystem 13c2:0004)

Signed-off-by: Oliver Endriss <o.en...@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c
diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c
index 2749490..d36369e 100644
--- a/drivers/media/dvb/ttpci/av7110.c
+++ b/drivers/media/dvb/ttpci/av7110.c
@@ -2329,6 +2329,17 @@ static int frontend_init(struct av7110 *
av7110->fe = ves1820_attach(&alps_tdbe2_config, &av7110->i2c_adap, read_pwm(av7110));
break;

+ case 0x0004: // Galaxis DVB-S rev1.3
+ /* ALPS BSRV2 */
+ av7110->fe = ves1x93_attach(&alps_bsrv2_config, &av7110->i2c_adap);
+ if (av7110->fe) {
+ av7110->fe->ops->diseqc_send_master_cmd = av7110_diseqc_send_master_cmd;
+ av7110->fe->ops->diseqc_send_burst = av7110_diseqc_send_burst;
+ av7110->fe->ops->set_tone = av7110_set_tone;
+ av7110->recover = dvb_s_recover;
+ }
+ break;
+
case 0x0006: /* Fujitsu-Siemens DVB-S rev 1.6 */
/* Grundig 29504-451 */
av7110->fe = tda8083_attach(&grundig_29504_451_config, &av7110->i2c_adap);
@@ -2930,6 +2941,7 @@ MAKE_AV7110_INFO(tts_1_3se, "Technotren
MAKE_AV7110_INFO(ttt, "Technotrend/Hauppauge DVB-T");
MAKE_AV7110_INFO(fsc, "Fujitsu Siemens DVB-C");
MAKE_AV7110_INFO(fss, "Fujitsu Siemens DVB-S rev1.6");
+MAKE_AV7110_INFO(gxs_1_3, "Galaxis DVB-S rev1.3");

static struct pci_device_id pci_tbl[] = {
MAKE_EXTENSION_PCI(fsc, 0x110a, 0x0000),
@@ -2937,13 +2949,13 @@ static struct pci_device_id pci_tbl[] =
MAKE_EXTENSION_PCI(ttt_1_X, 0x13c2, 0x0001),
MAKE_EXTENSION_PCI(ttc_2_X, 0x13c2, 0x0002),
MAKE_EXTENSION_PCI(tts_2_X, 0x13c2, 0x0003),
+ MAKE_EXTENSION_PCI(gxs_1_3, 0x13c2, 0x0004),
MAKE_EXTENSION_PCI(fss, 0x13c2, 0x0006),
MAKE_EXTENSION_PCI(ttt, 0x13c2, 0x0008),
MAKE_EXTENSION_PCI(ttc_1_X, 0x13c2, 0x000a),
MAKE_EXTENSION_PCI(tts_2_3, 0x13c2, 0x000e),
MAKE_EXTENSION_PCI(tts_1_3se, 0x13c2, 0x1002),

-/* MAKE_EXTENSION_PCI(???, 0x13c2, 0x0004), UNDEFINED CARD */ // Galaxis DVB PC-Sat-Carte
/* MAKE_EXTENSION_PCI(???, 0x13c2, 0x0005), UNDEFINED CARD */ // Technisat SkyStar1
/* MAKE_EXTENSION_PCI(???, 0x13c2, 0x0009), UNDEFINED CARD */ // TT/Hauppauge WinTV Nexus-CA v????

mch...@infradead.org

unread,
Mar 20, 2006, 11:00:14 AM3/20/06
to
From: Mauro Carvalho Chehab <mch...@infradead.org>
Date: 1138043466 -0200

- Implemented sliced VBI set on VIDIOC_S_FMT

Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c
diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c
index 17a8dd7..df7f304 100644
--- a/drivers/media/video/tvp5150.c
+++ b/drivers/media/video/tvp5150.c
@@ -637,12 +637,15 @@ static void tvp5150_vbi_get_cap(const st
* LSB = field1
* MSB = field2
*/
-static int tvp5150_set_vbi(struct i2c_client *c, unsigned int type,
- u8 flags, int line, const int fields)
+static int tvp5150_set_vbi(struct i2c_client *c,
+ const struct i2c_vbi_ram_value *regs,
+ unsigned int type,u8 flags, int line,
+ const int fields)
{
struct tvp5150 *decoder = i2c_get_clientdata(c);
v4l2_std_id std=decoder->norm;
u8 reg;
+ int pos=0;

if (std == V4L2_STD_ALL) {
tvp5150_err("VBI can't be configured without knowing number of lines\n");
@@ -653,9 +656,23 @@ static int tvp5150_set_vbi(struct i2c_cl
}

if (line<6||line>27)
- return -EINVAL;
+ return 0;
+
+ while (regs->reg != (u16)-1 ) {
+ if ((type & regs->type.vbi_type) &&
+ (line>=regs->type.ini_line) &&
+ (line<=regs->type.end_line)) {
+ type=regs->type.vbi_type;
+ break;
+ }
+
+ regs++;
+ pos++;
+ }
+ if (regs->reg == (u16)-1)
+ return 0;

- type=type | (flags & 0xf0);
+ type=pos | (flags & 0xf0);
reg=((line-6)<<1)+TVP5150_LINE_MODE_INI;

if (fields&1) {
@@ -666,7 +683,7 @@ static int tvp5150_set_vbi(struct i2c_cl
tvp5150_write(c, reg+1, type);
}

- return 0;
+ return type;
}

static int tvp5150_set_std(struct i2c_client *c, v4l2_std_id std)
@@ -821,7 +838,27 @@ static int tvp5150_command(struct i2c_cl
tvp5150_vbi_get_cap(vbi_ram_default, cap);
break;
}
+ case VIDIOC_S_FMT:
+ {
+ struct v4l2_format *fmt;
+ struct v4l2_sliced_vbi_format *svbi;
+ int i;

+ fmt = arg;
+ if (fmt->type != V4L2_BUF_TYPE_SLICED_VBI_CAPTURE)
+ return -EINVAL;
+ svbi = &fmt->fmt.sliced;
+ if (svbi->service_set != 0) {
+ for (i = 0; i <= 23; i++) {
+ svbi->service_lines[1][i] = 0;
+
+ svbi->service_lines[0][i]=tvp5150_set_vbi(c,
+ vbi_ram_default,
+ svbi->service_lines[0][i],0xf0,i,3);
+ }
+ }
+ break;
+ }
#ifdef CONFIG_VIDEO_ADV_DEBUG
case VIDIOC_INT_G_REGISTER:
{

mch...@infradead.org

unread,
Mar 20, 2006, 11:00:16 AM3/20/06
to
From: Michael Krufky <mkr...@linuxtv.org>
Date: 1141064569 -0300

- ELSA EX-VISION 500TV was incorrectly programmed to have the same
subsystem ID as ELSA EX-VISION 300TV, (1048:226b)
- This changeset replaces the incorrect subsystem ID (1048:226b)
with the correct one (1048:226a) for the ELSA EX-VISION 500TV.

Signed-off-by: Michael Krufky <mkr...@linuxtv.org>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134
diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134
index 8435a21..17ea5a0 100644
--- a/Documentation/video4linux/CARDLIST.saa7134
+++ b/Documentation/video4linux/CARDLIST.saa7134
@@ -13,7 +13,7 @@
12 -> Medion 7134 [16be:0003]
13 -> Typhoon TV+Radio 90031
14 -> ELSA EX-VISION 300TV [1048:226b]
- 15 -> ELSA EX-VISION 500TV [1048:226b]
+ 15 -> ELSA EX-VISION 500TV [1048:226a]
16 -> ASUS TV-FM 7134 [1043:4842,1043:4830,1043:4840]
17 -> AOPEN VA1000 POWER [1131:7133]
18 -> BMK MPEX No Tuner
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
index 384f6f2..f156650 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -2882,7 +2882,7 @@ struct pci_device_id saa7134_pci_tbl[] =
.vendor = PCI_VENDOR_ID_PHILIPS,
.device = PCI_DEVICE_ID_PHILIPS_SAA7130,
.subvendor = 0x1048,
- .subdevice = 0x226b,
+ .subdevice = 0x226a,
.driver_data = SAA7134_BOARD_ELSA_500TV,
},{
.vendor = PCI_VENDOR_ID_PHILIPS,

mch...@infradead.org

unread,
Mar 20, 2006, 11:00:16 AM3/20/06
to
From: Michael Krufky <mkr...@m1k.net>
Date: 1138043466 -0200

- Kill nxt2002 module in favor of nxt200x.
- Repair broken nxt2002 support in the nxt200x module.
- Make the flexcop driver use nxt200x instead of the nxt2002 module for the
Air2PC 2nd generation PCI card.
- Remove the nxt2002 module from cvs and kernel build.

Signed-off-by: Michael Krufky <mkr...@m1k.net>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/dvb/b2c2/Kconfig b/drivers/media/dvb/b2c2/Kconfig
diff --git a/drivers/media/dvb/b2c2/Kconfig b/drivers/media/dvb/b2c2/Kconfig
index 2583a86..2963605 100644
--- a/drivers/media/dvb/b2c2/Kconfig
+++ b/drivers/media/dvb/b2c2/Kconfig
@@ -4,7 +4,7 @@ config DVB_B2C2_FLEXCOP
select DVB_STV0299
select DVB_MT352
select DVB_MT312
- select DVB_NXT2002
+ select DVB_NXT200X
select DVB_STV0297
select DVB_BCM3510
select DVB_LGDT330X
diff --git a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c
diff --git a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c
index 0b940e1..dbe6f6b 100644
--- a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c
+++ b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c
@@ -9,7 +9,7 @@

#include "stv0299.h"
#include "mt352.h"
-#include "nxt2002.h"
+#include "nxt200x.h"
#include "bcm3510.h"
#include "stv0297.h"
#include "mt312.h"
@@ -343,9 +343,10 @@ static struct lgdt330x_config air2pc_ats
.clock_polarity_flip = 1,
};

-static struct nxt2002_config samsung_tbmv_config = {
+static struct nxt200x_config samsung_tbmv_config = {
.demod_address = 0x0a,
- .request_firmware = flexcop_fe_request_firmware,
+ .pll_address = 0xc2,
+ .pll_desc = &dvb_pll_tbmv30111in,
};

static struct bcm3510_config air2pc_atsc_first_gen_config = {
@@ -505,7 +506,7 @@ int flexcop_frontend_init(struct flexcop
info("found the mt352 at i2c address: 0x%02x",samsung_tdtc9251dh0_config.demod_address);
} else
/* try the air atsc 2nd generation (nxt2002) */
- if ((fc->fe = nxt2002_attach(&samsung_tbmv_config, &fc->i2c_adap)) != NULL) {
+ if ((fc->fe = nxt200x_attach(&samsung_tbmv_config, &fc->i2c_adap)) != NULL) {
fc->dev_type = FC_AIR_ATSC2;
info("found the nxt2002 at i2c address: 0x%02x",samsung_tbmv_config.demod_address);
} else
diff --git a/drivers/media/dvb/frontends/Kconfig b/drivers/media/dvb/frontends/Kconfig
diff --git a/drivers/media/dvb/frontends/Kconfig b/drivers/media/dvb/frontends/Kconfig
index db3a8b4..f09e3da 100644
--- a/drivers/media/dvb/frontends/Kconfig
+++ b/drivers/media/dvb/frontends/Kconfig
@@ -166,18 +166,6 @@ config DVB_STV0297
comment "ATSC (North American/Korean Terresterial DTV) frontends"
depends on DVB_CORE

-config DVB_NXT2002
- tristate "Nxt2002 based"
- depends on DVB_CORE
- select FW_LOADER
- help
- An ATSC 8VSB tuner module. Say Y when you want to support this frontend.
-
- This driver needs external firmware. Please use the command
- "<kerneldir>/Documentation/dvb/get_dvb_firmware nxt2002" to
- download/extract it, and then copy it to /usr/lib/hotplug/firmware
- or /lib/firmware (depending on configuration of firmware hotplug).
-
config DVB_NXT200X
tristate "Nextwave NXT2002/NXT2004 based"
depends on DVB_CORE
diff --git a/drivers/media/dvb/frontends/Makefile b/drivers/media/dvb/frontends/Makefile
diff --git a/drivers/media/dvb/frontends/Makefile b/drivers/media/dvb/frontends/Makefile
index 615ec83..8f30146 100644
--- a/drivers/media/dvb/frontends/Makefile
+++ b/drivers/media/dvb/frontends/Makefile
@@ -25,7 +25,6 @@ obj-$(CONFIG_DVB_CX22702) += cx22702.o
obj-$(CONFIG_DVB_TDA80XX) += tda80xx.o
obj-$(CONFIG_DVB_TDA10021) += tda10021.o
obj-$(CONFIG_DVB_STV0297) += stv0297.o
-obj-$(CONFIG_DVB_NXT2002) += nxt2002.o
obj-$(CONFIG_DVB_NXT200X) += nxt200x.o
obj-$(CONFIG_DVB_OR51211) += or51211.o
obj-$(CONFIG_DVB_OR51132) += or51132.o
diff --git a/drivers/media/dvb/frontends/dvb-pll.c b/drivers/media/dvb/frontends/dvb-pll.c
diff --git a/drivers/media/dvb/frontends/dvb-pll.c b/drivers/media/dvb/frontends/dvb-pll.c
index 1b9934e..9c9c12a 100644
--- a/drivers/media/dvb/frontends/dvb-pll.c
+++ b/drivers/media/dvb/frontends/dvb-pll.c
@@ -326,7 +326,7 @@ struct dvb_pll_desc dvb_pll_tuv1236d = {
};
EXPORT_SYMBOL(dvb_pll_tuv1236d);

-/* Samsung TBMV30111IN
+/* Samsung TBMV30111IN / TBMV30712IN1
* used in Air2PC ATSC - 2nd generation (nxt2002)
*/
struct dvb_pll_desc dvb_pll_tbmv30111in = {
diff --git a/drivers/media/dvb/frontends/nxt2002.c b/drivers/media/dvb/frontends/nxt2002.c
diff --git a/drivers/media/dvb/frontends/nxt2002.c b/drivers/media/dvb/frontends/nxt2002.c
deleted file mode 100644
index 4f263e6..0000000
--- a/drivers/media/dvb/frontends/nxt2002.c
+++ /dev/null
@@ -1,706 +0,0 @@
-/*
- Support for B2C2/BBTI Technisat Air2PC - ATSC
-
- Copyright (C) 2004 Taylor Jacob <rtj...@earthlink.net>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-/*
- * This driver needs external firmware. Please use the command
- * "<kerneldir>/Documentation/dvb/get_dvb_firmware nxt2002" to
- * download/extract it, and then copy it to /usr/lib/hotplug/firmware
- * or /lib/firmware (depending on configuration of firmware hotplug).
- */
-#define NXT2002_DEFAULT_FIRMWARE "dvb-fe-nxt2002.fw"
-#define CRC_CCIT_MASK 0x1021
-
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/moduleparam.h>
-#include <linux/device.h>
-#include <linux/firmware.h>
-#include <linux/string.h>
-#include <linux/slab.h>
-
-#include "dvb_frontend.h"
-#include "nxt2002.h"
-
-struct nxt2002_state {
-
- struct i2c_adapter* i2c;
- struct dvb_frontend_ops ops;
- const struct nxt2002_config* config;
- struct dvb_frontend frontend;
-
- /* demodulator private data */
- u8 initialised:1;
-};
-
-static int debug;
-#define dprintk(args...) \
- do { \
- if (debug) printk(KERN_DEBUG "nxt2002: " args); \
- } while (0)
-
-static int i2c_writebytes (struct nxt2002_state* state, u8 reg, u8 *buf, u8 len)
-{
- /* probbably a much better way or doing this */
- u8 buf2 [256],x;
- int err;
- struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf2, .len = len + 1 };
-
- buf2[0] = reg;
- for (x = 0 ; x < len ; x++)
- buf2[x+1] = buf[x];
-
- if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) {
- printk ("%s: i2c write error (addr %02x, err == %i)\n",
- __FUNCTION__, state->config->demod_address, err);
- return -EREMOTEIO;
- }
-
- return 0;
-}
-
-static u8 i2c_readbytes (struct nxt2002_state* state, u8 reg, u8* buf, u8 len)
-{
- u8 reg2 [] = { reg };
-
- struct i2c_msg msg [] = { { .addr = state->config->demod_address, .flags = 0, .buf = reg2, .len = 1 },
- { .addr = state->config->demod_address, .flags = I2C_M_RD, .buf = buf, .len = len } };
-
- int err;
-
- if ((err = i2c_transfer (state->i2c, msg, 2)) != 2) {
- printk ("%s: i2c read error (addr %02x, err == %i)\n",
- __FUNCTION__, state->config->demod_address, err);
- return -EREMOTEIO;
- }
-
- return 0;
-}
-
-static u16 nxt2002_crc(u16 crc, u8 c)
-{
-
- u8 i;
- u16 input = (u16) c & 0xFF;
-
- input<<=8;
- for(i=0 ;i<8 ;i++) {
- if((crc ^ input) & 0x8000)
- crc=(crc<<1)^CRC_CCIT_MASK;
- else
- crc<<=1;
- input<<=1;
- }
- return crc;
-}
-
-static int nxt2002_writereg_multibyte (struct nxt2002_state* state, u8 reg, u8* data, u8 len)
-{
- u8 buf;
- dprintk("%s\n", __FUNCTION__);
-
- /* set multi register length */
- i2c_writebytes(state,0x34,&len,1);
-
- /* set mutli register register */
- i2c_writebytes(state,0x35,&reg,1);
-
- /* send the actual data */
- i2c_writebytes(state,0x36,data,len);
-
- /* toggle the multireg write bit*/
- buf = 0x02;
- i2c_writebytes(state,0x21,&buf,1);
-
- i2c_readbytes(state,0x21,&buf,1);
-
- if ((buf & 0x02) == 0)
- return 0;
-
- dprintk("Error writing multireg register %02X\n",reg);
-
- return 0;
-}
-
-static int nxt2002_readreg_multibyte (struct nxt2002_state* state, u8 reg, u8* data, u8 len)
-{
- u8 len2;
- dprintk("%s\n", __FUNCTION__);
-
- /* set multi register length */
- len2 = len & 0x80;
- i2c_writebytes(state,0x34,&len2,1);
-
- /* set mutli register register */
- i2c_writebytes(state,0x35,&reg,1);
-
- /* send the actual data */
- i2c_readbytes(state,reg,data,len);
-
- return 0;
-}
-
-static void nxt2002_microcontroller_stop (struct nxt2002_state* state)
-{
- u8 buf[2],counter = 0;
- dprintk("%s\n", __FUNCTION__);
-
- buf[0] = 0x80;
- i2c_writebytes(state,0x22,buf,1);
-
- while (counter < 20) {
- i2c_readbytes(state,0x31,buf,1);
- if (buf[0] & 0x40)
- return;
- msleep(10);
- counter++;
- }
-
- dprintk("Timeout waiting for micro to stop.. This is ok after firmware upload\n");
- return;
-}
-
-static void nxt2002_microcontroller_start (struct nxt2002_state* state)
-{
- u8 buf;
- dprintk("%s\n", __FUNCTION__);
-
- buf = 0x00;
- i2c_writebytes(state,0x22,&buf,1);
-}
-
-static int nxt2002_writetuner (struct nxt2002_state* state, u8* data)
-{
- u8 buf,count = 0;
-
- dprintk("Tuner Bytes: %02X %02X %02X %02X\n",data[0],data[1],data[2],data[3]);
-
- dprintk("%s\n", __FUNCTION__);
- /* stop the micro first */
- nxt2002_microcontroller_stop(state);
-
- /* set the i2c transfer speed to the tuner */
- buf = 0x03;
- i2c_writebytes(state,0x20,&buf,1);
-
- /* setup to transfer 4 bytes via i2c */
- buf = 0x04;
- i2c_writebytes(state,0x34,&buf,1);
-
- /* write actual tuner bytes */
- i2c_writebytes(state,0x36,data,4);
-
- /* set tuner i2c address */
- buf = 0xC2;
- i2c_writebytes(state,0x35,&buf,1);
-
- /* write UC Opmode to begin transfer */
- buf = 0x80;
- i2c_writebytes(state,0x21,&buf,1);
-
- while (count < 20) {
- i2c_readbytes(state,0x21,&buf,1);
- if ((buf & 0x80)== 0x00)
- return 0;
- msleep(100);
- count++;
- }
-
- printk("nxt2002: timeout error writing tuner\n");
- return 0;
-}
-
-static void nxt2002_agc_reset(struct nxt2002_state* state)
-{
- u8 buf;
- dprintk("%s\n", __FUNCTION__);
-
- buf = 0x08;
- i2c_writebytes(state,0x08,&buf,1);
-
- buf = 0x00;
- i2c_writebytes(state,0x08,&buf,1);
-
- return;
-}
-
-static int nxt2002_load_firmware (struct dvb_frontend* fe, const struct firmware *fw)
-{
-
- struct nxt2002_state* state = fe->demodulator_priv;
- u8 buf[256],written = 0,chunkpos = 0;
- u16 rambase,position,crc = 0;
-
- dprintk("%s\n", __FUNCTION__);
- dprintk("Firmware is %zu bytes\n",fw->size);
-
- /* Get the RAM base for this nxt2002 */
- i2c_readbytes(state,0x10,buf,1);
-
- if (buf[0] & 0x10)
- rambase = 0x1000;
- else
- rambase = 0x0000;
-
- dprintk("rambase on this nxt2002 is %04X\n",rambase);
-
- /* Hold the micro in reset while loading firmware */
- buf[0] = 0x80;
- i2c_writebytes(state,0x2B,buf,1);
-
- for (position = 0; position < fw->size ; position++) {
- if (written == 0) {
- crc = 0;
- chunkpos = 0x28;
- buf[0] = ((rambase + position) >> 8);
- buf[1] = (rambase + position) & 0xFF;
- buf[2] = 0x81;
- /* write starting address */
- i2c_writebytes(state,0x29,buf,3);
- }
- written++;
- chunkpos++;
-
- if ((written % 4) == 0)
- i2c_writebytes(state,chunkpos,&fw->data[position-3],4);
-
- crc = nxt2002_crc(crc,fw->data[position]);
-
- if ((written == 255) || (position+1 == fw->size)) {
- /* write remaining bytes of firmware */
- i2c_writebytes(state, chunkpos+4-(written %4),
- &fw->data[position-(written %4) + 1],
- written %4);
- buf[0] = crc << 8;
- buf[1] = crc & 0xFF;
-
- /* write crc */
- i2c_writebytes(state,0x2C,buf,2);
-
- /* do a read to stop things */
- i2c_readbytes(state,0x2A,buf,1);
-
- /* set transfer mode to complete */
- buf[0] = 0x80;
- i2c_writebytes(state,0x2B,buf,1);
-
- written = 0;
- }
- }
-
- printk ("done.\n");
- return 0;
-};
-
-static int nxt2002_setup_frontend_parameters (struct dvb_frontend* fe,
- struct dvb_frontend_parameters *p)
-{
- struct nxt2002_state* state = fe->demodulator_priv;
- u32 freq = 0;
- u16 tunerfreq = 0;
- u8 buf[4];
-
- freq = 44000 + ( p->frequency / 1000 );
-
- dprintk("freq = %d p->frequency = %d\n",freq,p->frequency);
-
- tunerfreq = freq * 24/4000;
-
- buf[0] = (tunerfreq >> 8) & 0x7F;
- buf[1] = (tunerfreq & 0xFF);
-
- if (p->frequency <= 214000000) {
- buf[2] = 0x84 + (0x06 << 3);
- buf[3] = (p->frequency <= 172000000) ? 0x01 : 0x02;
- } else if (p->frequency <= 721000000) {
- buf[2] = 0x84 + (0x07 << 3);
- buf[3] = (p->frequency <= 467000000) ? 0x02 : 0x08;
- } else if (p->frequency <= 841000000) {
- buf[2] = 0x84 + (0x0E << 3);
- buf[3] = 0x08;
- } else {
- buf[2] = 0x84 + (0x0F << 3);
- buf[3] = 0x02;
- }
-
- /* write frequency information */
- nxt2002_writetuner(state,buf);
-
- /* reset the agc now that tuning has been completed */
- nxt2002_agc_reset(state);
-
- /* set target power level */
- switch (p->u.vsb.modulation) {
- case QAM_64:
- case QAM_256:
- buf[0] = 0x74;
- break;
- case VSB_8:
- buf[0] = 0x70;
- break;
- default:
- return -EINVAL;
- break;
- }
- i2c_writebytes(state,0x42,buf,1);
-
- /* configure sdm */
- buf[0] = 0x87;
- i2c_writebytes(state,0x57,buf,1);
-
- /* write sdm1 input */
- buf[0] = 0x10;
- buf[1] = 0x00;
- nxt2002_writereg_multibyte(state,0x58,buf,2);
-
- /* write sdmx input */
- switch (p->u.vsb.modulation) {
- case QAM_64:
- buf[0] = 0x68;
- break;
- case QAM_256:
- buf[0] = 0x64;
- break;
- case VSB_8:
- buf[0] = 0x60;
- break;
- default:
- return -EINVAL;
- break;
- }
- buf[1] = 0x00;
- nxt2002_writereg_multibyte(state,0x5C,buf,2);
-
- /* write adc power lpf fc */
- buf[0] = 0x05;
- i2c_writebytes(state,0x43,buf,1);
-
- /* write adc power lpf fc */
- buf[0] = 0x05;
- i2c_writebytes(state,0x43,buf,1);
-
- /* write accumulator2 input */
- buf[0] = 0x80;
- buf[1] = 0x00;
- nxt2002_writereg_multibyte(state,0x4B,buf,2);
-
- /* write kg1 */
- buf[0] = 0x00;
- i2c_writebytes(state,0x4D,buf,1);
-
- /* write sdm12 lpf fc */
- buf[0] = 0x44;
- i2c_writebytes(state,0x55,buf,1);
-
- /* write agc control reg */
- buf[0] = 0x04;
- i2c_writebytes(state,0x41,buf,1);
-
- /* write agc ucgp0 */
- switch (p->u.vsb.modulation) {
- case QAM_64:
- buf[0] = 0x02;
- break;
- case QAM_256:
- buf[0] = 0x03;
- break;
- case VSB_8:
- buf[0] = 0x00;
- break;
- default:
- return -EINVAL;
- break;
- }
- i2c_writebytes(state,0x30,buf,1);
-
- /* write agc control reg */
- buf[0] = 0x00;
- i2c_writebytes(state,0x41,buf,1);
-
- /* write accumulator2 input */
- buf[0] = 0x80;
- buf[1] = 0x00;
- nxt2002_writereg_multibyte(state,0x49,buf,2);
- nxt2002_writereg_multibyte(state,0x4B,buf,2);
-
- /* write agc control reg */
- buf[0] = 0x04;
- i2c_writebytes(state,0x41,buf,1);
-
- nxt2002_microcontroller_start(state);
-
- /* adjacent channel detection should be done here, but I don't
- have any stations with this need so I cannot test it */
-
- return 0;
-}
-
-static int nxt2002_read_status(struct dvb_frontend* fe, fe_status_t* status)
-{
- struct nxt2002_state* state = fe->demodulator_priv;
- u8 lock;
- i2c_readbytes(state,0x31,&lock,1);
-
- *status = 0;
- if (lock & 0x20) {
- *status |= FE_HAS_SIGNAL;
- *status |= FE_HAS_CARRIER;
- *status |= FE_HAS_VITERBI;
- *status |= FE_HAS_SYNC;
- *status |= FE_HAS_LOCK;
- }
- return 0;
-}
-
-static int nxt2002_read_ber(struct dvb_frontend* fe, u32* ber)
-{
- struct nxt2002_state* state = fe->demodulator_priv;
- u8 b[3];
-
- nxt2002_readreg_multibyte(state,0xE6,b,3);
-
- *ber = ((b[0] << 8) + b[1]) * 8;
-
- return 0;
-}
-
-static int nxt2002_read_signal_strength(struct dvb_frontend* fe, u16* strength)
-{
- struct nxt2002_state* state = fe->demodulator_priv;
- u8 b[2];
- u16 temp = 0;
-
- /* setup to read cluster variance */
- b[0] = 0x00;
- i2c_writebytes(state,0xA1,b,1);
-
- /* get multreg val */
- nxt2002_readreg_multibyte(state,0xA6,b,2);
-
- temp = (b[0] << 8) | b[1];
- *strength = ((0x7FFF - temp) & 0x0FFF) * 16;
-
- return 0;
-}
-
-static int nxt2002_read_snr(struct dvb_frontend* fe, u16* snr)
-{
-
- struct nxt2002_state* state = fe->demodulator_priv;
- u8 b[2];
- u16 temp = 0, temp2;
- u32 snrdb = 0;
-
- /* setup to read cluster variance */
- b[0] = 0x00;
- i2c_writebytes(state,0xA1,b,1);
-
- /* get multreg val from 0xA6 */
- nxt2002_readreg_multibyte(state,0xA6,b,2);
-
- temp = (b[0] << 8) | b[1];
- temp2 = 0x7FFF - temp;
-
- /* snr will be in db */
- if (temp2 > 0x7F00)
- snrdb = 1000*24 + ( 1000*(30-24) * ( temp2 - 0x7F00 ) / ( 0x7FFF - 0x7F00 ) );
- else if (temp2 > 0x7EC0)
- snrdb = 1000*18 + ( 1000*(24-18) * ( temp2 - 0x7EC0 ) / ( 0x7F00 - 0x7EC0 ) );
- else if (temp2 > 0x7C00)
- snrdb = 1000*12 + ( 1000*(18-12) * ( temp2 - 0x7C00 ) / ( 0x7EC0 - 0x7C00 ) );
- else
- snrdb = 1000*0 + ( 1000*(12-0) * ( temp2 - 0 ) / ( 0x7C00 - 0 ) );
-
- /* the value reported back from the frontend will be FFFF=32db 0000=0db */
-
- *snr = snrdb * (0xFFFF/32000);
-
- return 0;
-}
-
-static int nxt2002_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)
-{
- struct nxt2002_state* state = fe->demodulator_priv;
- u8 b[3];
-
- nxt2002_readreg_multibyte(state,0xE6,b,3);
- *ucblocks = b[2];
-
- return 0;
-}
-
-static int nxt2002_sleep(struct dvb_frontend* fe)
-{
- return 0;
-}
-
-static int nxt2002_init(struct dvb_frontend* fe)
-{
- struct nxt2002_state* state = fe->demodulator_priv;
- const struct firmware *fw;
- int ret;
- u8 buf[2];
-
- if (!state->initialised) {
- /* request the firmware, this will block until someone uploads it */
- printk("nxt2002: Waiting for firmware upload (%s)...\n", NXT2002_DEFAULT_FIRMWARE);
- ret = state->config->request_firmware(fe, &fw, NXT2002_DEFAULT_FIRMWARE);
- printk("nxt2002: Waiting for firmware upload(2)...\n");
- if (ret) {
- printk("nxt2002: no firmware upload (timeout or file not found?)\n");
- return ret;
- }
-
- ret = nxt2002_load_firmware(fe, fw);
- if (ret) {
- printk("nxt2002: writing firmware to device failed\n");
- release_firmware(fw);
- return ret;
- }
- printk("nxt2002: firmware upload complete\n");
-
- /* Put the micro into reset */
- nxt2002_microcontroller_stop(state);
-
- /* ensure transfer is complete */
- buf[0]=0;
- i2c_writebytes(state,0x2B,buf,1);
-
- /* Put the micro into reset for real this time */
- nxt2002_microcontroller_stop(state);
-
- /* soft reset everything (agc,frontend,eq,fec)*/
- buf[0] = 0x0F;
- i2c_writebytes(state,0x08,buf,1);
- buf[0] = 0x00;
- i2c_writebytes(state,0x08,buf,1);
-
- /* write agc sdm configure */
- buf[0] = 0xF1;
- i2c_writebytes(state,0x57,buf,1);
-
- /* write mod output format */
- buf[0] = 0x20;
- i2c_writebytes(state,0x09,buf,1);
-
- /* write fec mpeg mode */
- buf[0] = 0x7E;
- buf[1] = 0x00;
- i2c_writebytes(state,0xE9,buf,2);
-
- /* write mux selection */
- buf[0] = 0x00;
- i2c_writebytes(state,0xCC,buf,1);
-
- state->initialised = 1;
- }
-
- return 0;
-}
-
-static int nxt2002_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fesettings)
-{
- fesettings->min_delay_ms = 500;
- fesettings->step_size = 0;
- fesettings->max_drift = 0;
- return 0;
-}
-
-static void nxt2002_release(struct dvb_frontend* fe)
-{
- struct nxt2002_state* state = fe->demodulator_priv;
- kfree(state);
-}
-
-static struct dvb_frontend_ops nxt2002_ops;
-
-struct dvb_frontend* nxt2002_attach(const struct nxt2002_config* config,
- struct i2c_adapter* i2c)
-{
- struct nxt2002_state* state = NULL;
- u8 buf [] = {0,0,0,0,0};
-
- /* allocate memory for the internal state */
- state = kmalloc(sizeof(struct nxt2002_state), GFP_KERNEL);
- if (state == NULL) goto error;
-
- /* setup the state */
- state->config = config;
- state->i2c = i2c;
- memcpy(&state->ops, &nxt2002_ops, sizeof(struct dvb_frontend_ops));
- state->initialised = 0;
-
- /* Check the first 5 registers to ensure this a revision we can handle */
-
- i2c_readbytes(state, 0x00, buf, 5);
- if (buf[0] != 0x04) goto error; /* device id */
- if (buf[1] != 0x02) goto error; /* fab id */
- if (buf[2] != 0x11) goto error; /* month */
- if (buf[3] != 0x20) goto error; /* year msb */
- if (buf[4] != 0x00) goto error; /* year lsb */
-
- /* create dvb_frontend */
- state->frontend.ops = &state->ops;
- state->frontend.demodulator_priv = state;
- return &state->frontend;
-
-error:
- kfree(state);
- return NULL;
-}
-
-static struct dvb_frontend_ops nxt2002_ops = {
-
- .info = {
- .name = "Nextwave nxt2002 VSB/QAM frontend",
- .type = FE_ATSC,
- .frequency_min = 54000000,
- .frequency_max = 860000000,
- /* stepsize is just a guess */
- .frequency_stepsize = 166666,
- .caps = FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 |
- FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO |
- FE_CAN_8VSB | FE_CAN_QAM_64 | FE_CAN_QAM_256
- },
-
- .release = nxt2002_release,
-
- .init = nxt2002_init,
- .sleep = nxt2002_sleep,
-
- .set_frontend = nxt2002_setup_frontend_parameters,
- .get_tune_settings = nxt2002_get_tune_settings,
-
- .read_status = nxt2002_read_status,
- .read_ber = nxt2002_read_ber,
- .read_signal_strength = nxt2002_read_signal_strength,
- .read_snr = nxt2002_read_snr,
- .read_ucblocks = nxt2002_read_ucblocks,
-
-};
-
-module_param(debug, int, 0644);
-MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off).");
-
-MODULE_DESCRIPTION("NXT2002 ATSC (8VSB & ITU J83 AnnexB FEC QAM64/256) demodulator driver");
-MODULE_AUTHOR("Taylor Jacob");
-MODULE_LICENSE("GPL");
-
-EXPORT_SYMBOL(nxt2002_attach);
diff --git a/drivers/media/dvb/frontends/nxt2002.h b/drivers/media/dvb/frontends/nxt2002.h
diff --git a/drivers/media/dvb/frontends/nxt2002.h b/drivers/media/dvb/frontends/nxt2002.h
deleted file mode 100644
index 462301f..0000000
--- a/drivers/media/dvb/frontends/nxt2002.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- Driver for the Nxt2002 demodulator
-*/
-
-#ifndef NXT2002_H
-#define NXT2002_H
-
-#include <linux/dvb/frontend.h>
-#include <linux/firmware.h>
-
-struct nxt2002_config
-{
- /* the demodulator's i2c address */
- u8 demod_address;
-
- /* request firmware for device */
- int (*request_firmware)(struct dvb_frontend* fe, const struct firmware **fw, char* name);
-};
-
-extern struct dvb_frontend* nxt2002_attach(const struct nxt2002_config* config,
- struct i2c_adapter* i2c);
-
-#endif // NXT2002_H
diff --git a/drivers/media/dvb/frontends/nxt200x.c b/drivers/media/dvb/frontends/nxt200x.c
diff --git a/drivers/media/dvb/frontends/nxt200x.c b/drivers/media/dvb/frontends/nxt200x.c
index 78d2b93..9e35353 100644
--- a/drivers/media/dvb/frontends/nxt200x.c
+++ b/drivers/media/dvb/frontends/nxt200x.c
@@ -1,9 +1,10 @@
/*
* Support for NXT2002 and NXT2004 - VSB/QAM
*
- * Copyright (C) 2005 Kirk Lapray (kirk....@gmail.com)
+ * Copyright (C) 2005 Kirk Lapray <kirk....@gmail.com>
+ * Copyright (C) 2006 Michael Krufky <mkr...@m1k.net>
* based on nxt2002 by Taylor Jacob <rtj...@earthlink.net>
- * and nxt2004 by Jean-Francois Thibert (jeanfr...@sagetv.com)
+ * and nxt2004 by Jean-Francois Thibert <jeanfr...@sagetv.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -614,7 +615,17 @@ static int nxt200x_setup_frontend_parame
/* write sdm1 input */
buf[0] = 0x10;
buf[1] = 0x00;
- nxt200x_writebytes(state, 0x58, buf, 2);
+ switch (state->demod_chip) {
+ case NXT2002:
+ nxt200x_writereg_multibyte(state, 0x58, buf, 2);
+ break;
+ case NXT2004:
+ nxt200x_writebytes(state, 0x58, buf, 2);
+ break;
+ default:
+ return -EINVAL;
+ break;
+ }

/* write sdmx input */
switch (p->u.vsb.modulation) {
@@ -632,7 +643,17 @@ static int nxt200x_setup_frontend_parame
break;
}
buf[1] = 0x00;
- nxt200x_writebytes(state, 0x5C, buf, 2);
+ switch (state->demod_chip) {
+ case NXT2002:
+ nxt200x_writereg_multibyte(state, 0x5C, buf, 2);
+ break;
+ case NXT2004:
+ nxt200x_writebytes(state, 0x5C, buf, 2);
+ break;
+ default:
+ return -EINVAL;
+ break;
+ }

/* write adc power lpf fc */
buf[0] = 0x05;
@@ -648,7 +669,17 @@ static int nxt200x_setup_frontend_parame
/* write accumulator2 input */
buf[0] = 0x80;
buf[1] = 0x00;
- nxt200x_writebytes(state, 0x4B, buf, 2);
+ switch (state->demod_chip) {
+ case NXT2002:
+ nxt200x_writereg_multibyte(state, 0x4B, buf, 2);
+ break;
+ case NXT2004:
+ nxt200x_writebytes(state, 0x4B, buf, 2);
+ break;
+ default:
+ return -EINVAL;
+ break;
+ }

/* write kg1 */
buf[0] = 0x00;
@@ -714,8 +745,19 @@ static int nxt200x_setup_frontend_parame
/* write accumulator2 input */
buf[0] = 0x80;
buf[1] = 0x00;
- nxt200x_writebytes(state, 0x49, buf,2);
- nxt200x_writebytes(state, 0x4B, buf,2);
+ switch (state->demod_chip) {
+ case NXT2002:
+ nxt200x_writereg_multibyte(state, 0x49, buf, 2);
+ nxt200x_writereg_multibyte(state, 0x4B, buf, 2);
+ break;
+ case NXT2004:
+ nxt200x_writebytes(state, 0x49, buf, 2);
+ nxt200x_writebytes(state, 0x4B, buf, 2);
+ break;
+ default:
+ return -EINVAL;
+ break;
+ }

/* write agc control reg */
buf[0] = 0x04;
@@ -1199,7 +1241,7 @@ module_param(debug, int, 0644);
MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off).");

MODULE_DESCRIPTION("NXT200X (ATSC 8VSB & ITU-T J.83 AnnexB 64/256 QAM) Demodulator Driver");
-MODULE_AUTHOR("Kirk Lapray, Jean-Francois Thibert, and Taylor Jacob");
+MODULE_AUTHOR("Kirk Lapray, Michael Krufky, Jean-Francois Thibert, and Taylor Jacob");
MODULE_LICENSE("GPL");

EXPORT_SYMBOL(nxt200x_attach);

mch...@infradead.org

unread,
Mar 20, 2006, 11:00:20 AM3/20/06
to
From: Manu Abraham <ma...@linuxtv.org>
Date: 1141009672 -0300

Signed-off-by: Manu Abraham <ma...@linuxtv.org>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/dvb/bt8xx/bt878.c b/drivers/media/dvb/bt8xx/bt878.c
diff --git a/drivers/media/dvb/bt8xx/bt878.c b/drivers/media/dvb/bt8xx/bt878.c
index d276ce6..5500f8a 100644
--- a/drivers/media/dvb/bt8xx/bt878.c
+++ b/drivers/media/dvb/bt8xx/bt878.c
@@ -382,7 +382,7 @@ bt878_device_control(struct bt878 *bt, u
EXPORT_SYMBOL(bt878_device_control);


-struct cards card_list[] __devinitdata = {
+static struct cards card_list[] __devinitdata = {

{ 0x01010071, BTTV_BOARD_NEBULA_DIGITV, "Nebula Electronics DigiTV" },
{ 0x07611461, BTTV_BOARD_AVDVBT_761, "AverMedia AverTV DVB-T 761" },

mch...@infradead.org

unread,
Mar 20, 2006, 11:00:21 AM3/20/06
to
From: Ricardo Cerqueira <v...@cerqueira.org>
Date: 1141398822 -0300

Moved keymaps to the ir-common module, and export them from there, instead
of #including them in each module

Included missing files from V4L/DVB(3197).

Signed-off-by: Ricardo Cerqueira <v...@cerqueira.org>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/common/ir-functions.c b/drivers/media/common/ir-functions.c
diff --git a/drivers/media/common/ir-functions.c b/drivers/media/common/ir-functions.c
new file mode 100644
index 0000000..397cff8
--- /dev/null
+++ b/drivers/media/common/ir-functions.c
@@ -0,0 +1,272 @@
+/*
+ *
+ * some common structs and functions to handle infrared remotes via
+ * input layer ...
+ *
+ * (c) 2003 Gerd Knorr <kra...@bytesex.org> [SuSE Labs]
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/string.h>
+#include <media/ir-common.h>
+
+/* -------------------------------------------------------------------------- */
+
+MODULE_AUTHOR("Gerd Knorr <kra...@bytesex.org> [SuSE Labs]");
+MODULE_LICENSE("GPL");
+
+static int repeat = 1;
+module_param(repeat, int, 0444);
+MODULE_PARM_DESC(repeat,"auto-repeat for IR keys (default: on)");
+
+static int debug = 0; /* debug level (0,1,2) */
+module_param(debug, int, 0644);
+
+#define dprintk(level, fmt, arg...) if (debug >= level) \
+ printk(KERN_DEBUG fmt , ## arg)
+
+/* -------------------------------------------------------------------------- */
+
+static void ir_input_key_event(struct input_dev *dev, struct ir_input_state *ir)
+{
+ if (KEY_RESERVED == ir->keycode) {
+ printk(KERN_INFO "%s: unknown key: key=0x%02x raw=0x%02x down=%d\n",
+ dev->name,ir->ir_key,ir->ir_raw,ir->keypressed);
+ return;
+ }
+ dprintk(1,"%s: key event code=%d down=%d\n",
+ dev->name,ir->keycode,ir->keypressed);
+ input_report_key(dev,ir->keycode,ir->keypressed);
+ input_sync(dev);
+}
+
+/* -------------------------------------------------------------------------- */
+
+void ir_input_init(struct input_dev *dev, struct ir_input_state *ir,
+ int ir_type, IR_KEYTAB_TYPE *ir_codes)
+{
+ int i;
+
+ ir->ir_type = ir_type;
+ if (ir_codes)
+ memcpy(ir->ir_codes, ir_codes, sizeof(ir->ir_codes));
+
+
+ dev->keycode = ir->ir_codes;
+ dev->keycodesize = sizeof(IR_KEYTAB_TYPE);
+ dev->keycodemax = IR_KEYTAB_SIZE;
+ for (i = 0; i < IR_KEYTAB_SIZE; i++)
+ set_bit(ir->ir_codes[i], dev->keybit);
+ clear_bit(0, dev->keybit);
+
+ set_bit(EV_KEY, dev->evbit);
+ if (repeat)
+ set_bit(EV_REP, dev->evbit);
+}
+
+void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir)
+{
+ if (ir->keypressed) {
+ ir->keypressed = 0;
+ ir_input_key_event(dev,ir);
+ }
+}
+
+void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir,
+ u32 ir_key, u32 ir_raw)
+{
+ u32 keycode = IR_KEYCODE(ir->ir_codes, ir_key);
+
+ if (ir->keypressed && ir->keycode != keycode) {
+ ir->keypressed = 0;
+ ir_input_key_event(dev,ir);
+ }
+ if (!ir->keypressed) {
+ ir->ir_key = ir_key;
+ ir->ir_raw = ir_raw;
+ ir->keycode = keycode;
+ ir->keypressed = 1;
+ ir_input_key_event(dev,ir);
+ }
+}
+
+/* -------------------------------------------------------------------------- */
+
+u32 ir_extract_bits(u32 data, u32 mask)
+{
+ int mbit, vbit;
+ u32 value;
+
+ value = 0;
+ vbit = 0;
+ for (mbit = 0; mbit < 32; mbit++) {
+ if (!(mask & ((u32)1 << mbit)))
+ continue;
+ if (data & ((u32)1 << mbit))
+ value |= (1 << vbit);
+ vbit++;
+ }
+ return value;
+}
+
+static int inline getbit(u32 *samples, int bit)
+{
+ return (samples[bit/32] & (1 << (31-(bit%32)))) ? 1 : 0;
+}
+
+/* sump raw samples for visual debugging ;) */
+int ir_dump_samples(u32 *samples, int count)
+{
+ int i, bit, start;
+
+ printk(KERN_DEBUG "ir samples: ");
+ start = 0;
+ for (i = 0; i < count * 32; i++) {
+ bit = getbit(samples,i);
+ if (bit)
+ start = 1;
+ if (0 == start)
+ continue;
+ printk("%s", bit ? "#" : "_");
+ }
+ printk("\n");


+ return 0;
+}
+

+/* decode raw samples, pulse distance coding used by NEC remotes */
+int ir_decode_pulsedistance(u32 *samples, int count, int low, int high)
+{
+ int i,last,bit,len;
+ u32 curBit;
+ u32 value;
+
+ /* find start burst */
+ for (i = len = 0; i < count * 32; i++) {
+ bit = getbit(samples,i);
+ if (bit) {
+ len++;
+ } else {
+ if (len >= 29)
+ break;
+ len = 0;
+ }
+ }
+
+ /* start burst to short */
+ if (len < 29)
+ return 0xffffffff;
+
+ /* find start silence */
+ for (len = 0; i < count * 32; i++) {
+ bit = getbit(samples,i);
+ if (bit) {
+ break;
+ } else {
+ len++;
+ }
+ }
+
+ /* silence to short */
+ if (len < 7)
+ return 0xffffffff;
+
+ /* go decoding */
+ len = 0;
+ last = 1;
+ value = 0; curBit = 1;
+ for (; i < count * 32; i++) {
+ bit = getbit(samples,i);
+ if (last) {
+ if(bit) {
+ continue;
+ } else {
+ len = 1;
+ }
+ } else {
+ if (bit) {
+ if (len > (low + high) /2)
+ value |= curBit;
+ curBit <<= 1;
+ if (curBit == 1)
+ break;
+ } else {
+ len++;
+ }
+ }
+ last = bit;
+ }
+
+ return value;
+}
+
+/* decode raw samples, biphase coding, used by rc5 for example */
+int ir_decode_biphase(u32 *samples, int count, int low, int high)
+{
+ int i,last,bit,len,flips;
+ u32 value;
+
+ /* find start bit (1) */
+ for (i = 0; i < 32; i++) {
+ bit = getbit(samples,i);
+ if (bit)
+ break;
+ }
+
+ /* go decoding */
+ len = 0;
+ flips = 0;
+ value = 1;
+ for (; i < count * 32; i++) {
+ if (len > high)
+ break;
+ if (flips > 1)
+ break;
+ last = bit;
+ bit = getbit(samples,i);
+ if (last == bit) {
+ len++;
+ continue;
+ }
+ if (len < low) {
+ len++;
+ flips++;
+ continue;
+ }
+ value <<= 1;
+ value |= bit;
+ flips = 0;
+ len = 1;
+ }
+ return value;
+}
+
+EXPORT_SYMBOL_GPL(ir_input_init);
+EXPORT_SYMBOL_GPL(ir_input_nokey);
+EXPORT_SYMBOL_GPL(ir_input_keydown);
+
+EXPORT_SYMBOL_GPL(ir_extract_bits);
+EXPORT_SYMBOL_GPL(ir_dump_samples);
+EXPORT_SYMBOL_GPL(ir_decode_biphase);
+EXPORT_SYMBOL_GPL(ir_decode_pulsedistance);
+
+/*
+ * Local variables:
+ * c-basic-offset: 8
+ * End:
+ */
+

Kyle McMartin

unread,
Mar 20, 2006, 11:00:21 AM3/20/06
to
On Mon, Mar 20, 2006 at 12:08:19PM -0300, mch...@infradead.org wrote:
> This patch series is also available under v4l-dvb.git tree at:
> kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git
>
> Linus, please pull these from master branch.
>

Wow, it would be super nice if you would not patchbomb LKML if you're
already sending a pull request... I definitely didn't need 141 emails...

Cheers,
Kyle

mch...@infradead.org

unread,
Mar 20, 2006, 11:00:22 AM3/20/06
to
From: Chris Pascoe <c.pa...@itee.uq.edu.au>
Date: 1139302151 -0200

Use the parallel transport function of the MT352 in USB demodulator of the
Dual Digital board.

Signed-off-by: Chris Pascoe <c.pa...@itee.uq.edu.au>
Signed-off-by: Michael Krufky <mkr...@linuxtv.org>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c
diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c
index f140037..650536a 100644
--- a/drivers/media/dvb/dvb-usb/cxusb.c
+++ b/drivers/media/dvb/dvb-usb/cxusb.c
@@ -234,7 +234,7 @@ static struct dvb_usb_rc_key dvico_mce_r

static int cxusb_dee1601_demod_init(struct dvb_frontend* fe)
{
- static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x38 };
+ static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x28 };
static u8 reset [] = { RESET, 0x80 };
static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 };
static u8 agc_cfg [] = { AGC_TARGET, 0x28, 0x20 };

mch...@infradead.org

unread,
Mar 20, 2006, 11:00:22 AM3/20/06
to
From: Mauro Carvalho Chehab <mch...@infradead.org>
Date: 1138043468 -0200

- Added iocls to configure VBI on tvp5150

Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c
diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c
index df7f304..20e6359 100644
--- a/drivers/media/video/tvp5150.c
+++ b/drivers/media/video/tvp5150.c
@@ -541,7 +541,7 @@ static struct i2c_vbi_ram_value vbi_ram_
0x69, 0x8c, 0x09, 0x00, 0x00, 0x00, 0x27, 0x00 }
},
{0x110, /* Wide Screen Signal, PAL/SECAM */
- {V4L2_SLICED_WSS_625,20,21,1},
+ {V4L2_SLICED_WSS_625,23,23,1},
{ 0x5b, 0x55, 0xc5, 0xff, 0x00, 0x71, 0x6e, 0x42,
0xa6, 0xcd, 0x0f, 0x00, 0x00, 0x00, 0x3a, 0x00 }
},
@@ -649,7 +649,7 @@ static int tvp5150_set_vbi(struct i2c_cl



if (std == V4L2_STD_ALL) {
tvp5150_err("VBI can't be configured without knowing number of lines\n");

- return -EINVAL;
+ return 0;

} else if (std && V4L2_STD_625_50) {
/* Don't follow NTSC Line number convension */
line += 3;
@@ -686,6 +686,37 @@ static int tvp5150_set_vbi(struct i2c_cl
return type;
}

+static int tvp5150_get_vbi(struct i2c_client *c,
+ const struct i2c_vbi_ram_value *regs, int line)
+{
+ struct tvp5150 *decoder = i2c_get_clientdata(c);
+ v4l2_std_id std=decoder->norm;
+ u8 reg;
+ int pos, type=0;
+
+ if (std == V4L2_STD_ALL) {
+ tvp5150_err("VBI can't be configured without knowing number of lines\n");
+ return 0;
+ } else if (std && V4L2_STD_625_50) {
+ /* Don't follow NTSC Line number convension */
+ line += 3;
+ }
+
+ if (line<6||line>27)
+ return 0;
+
+ reg=((line-6)<<1)+TVP5150_LINE_MODE_INI;
+
+ pos=tvp5150_read(c, reg)&0x0f;
+ if (pos<0x0f)
+ type=regs[pos].type.vbi_type;
+
+ pos=tvp5150_read(c, reg+1)&0x0f;
+ if (pos<0x0f)
+ type|=regs[pos].type.vbi_type;
+
+ return type;
+}


static int tvp5150_set_std(struct i2c_client *c, v4l2_std_id std)

{
struct tvp5150 *decoder = i2c_get_clientdata(c);

@@ -856,9 +887,43 @@ static int tvp5150_command(struct i2c_cl
vbi_ram_default,


svbi->service_lines[0][i],0xf0,i,3);
}

+ /* Enables FIFO */
+ tvp5150_write(c, TVP5150_FIFO_OUT_CTRL,1);
+ } else {
+ /* Disables FIFO*/
+ tvp5150_write(c, TVP5150_FIFO_OUT_CTRL,0);
+
+ /* Disable Full Field */
+ tvp5150_write(c, TVP5150_FULL_FIELD_ENA, 0);
+
+ /* Disable Line modes */
+ for (i=TVP5150_LINE_MODE_INI; i<=TVP5150_LINE_MODE_END; i++)
+ tvp5150_write(c, i, 0xff);
+ }
+ break;
+ }
+ case VIDIOC_G_FMT:


+ {
+ struct v4l2_format *fmt;
+ struct v4l2_sliced_vbi_format *svbi;
+

+ int i, mask=0;
+


+ fmt = arg;
+ if (fmt->type != V4L2_BUF_TYPE_SLICED_VBI_CAPTURE)
+ return -EINVAL;
+ svbi = &fmt->fmt.sliced;

+ memset(svbi, 0, sizeof(*svbi));
+


+ for (i = 0; i <= 23; i++) {

+ svbi->service_lines[0][i]=tvp5150_get_vbi(c,
+ vbi_ram_default,i);
+ mask|=svbi->service_lines[0][i];
}
+ svbi->service_set=mask;


break;
}
+
#ifdef CONFIG_VIDEO_ADV_DEBUG
case VIDIOC_INT_G_REGISTER:
{

@@ -883,6 +948,7 @@ static int tvp5150_command(struct i2c_cl
}
#endif

+ case VIDIOC_LOG_STATUS:
case DECODER_DUMP:
dump_reg(c);
break;
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index d4030a7..11728da 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -160,7 +160,8 @@ struct msp_matrix {

/* Used to generate VBI signals on a video signal. v4l2_sliced_vbi_data is
filled with the data packets that should be output. Note that if you set
- the line field to 0, then that VBI signal is disabled. */
+ the line field to 0, then that VBI signal is disabled. If no
+ valid VBI data was found, then the type field is set to 0 on return. */
#define VIDIOC_INT_S_VBI_DATA _IOW ('d', 105, struct v4l2_sliced_vbi_data)

/* Used to obtain the sliced VBI packet from a readback register. Not all

mch...@infradead.org

unread,
Mar 20, 2006, 11:00:24 AM3/20/06
to
From: Curt Meyers <cme...@boilerbots.com>
Date: 1141009719 -0300

- Enable the tuv1236 tuner on the Kworld-ATSC110 card so that the
tuner can be identified when tuners.ko loads.
- With this change it is no longer necessary to remove and reload
the tuner module in order to get the tuv1236 identified.
- This code was copied from the ATI HDTV Wonder init routine (in cx88-cards.c)
which also uses the TUV1236D.

Signed-off-by: Curt Meyers <cme...@boilerbots.com>
Signed-off-by: Michael Krufky <mkr...@linuxtv.org>

Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
index 99cefdd..e1145a8 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -3549,6 +3549,18 @@ int saa7134_board_init2(struct saa7134_d
i2c_transfer(&dev->i2c_adap, &msg, 1);
}
break;
+ case SAA7134_BOARD_KWORLD_ATSC110:
+ {
+ /* enable tuner */
+ int i;
+ u8 buffer [] = { 0x10,0x12,0x13,0x04,0x16,0x00,0x14,0x04,0x017,0x00 };
+ dev->i2c_client.addr = 0x0a;
+ for (i = 0; i < 5; i++)
+ if (2 != i2c_master_send(&dev->i2c_client,&buffer[i*2],2))
+ printk(KERN_WARNING "%s: Unable to enable tuner(%i).\n",
+ dev->name, i);
+ }
+ break;
}
return 0;

mch...@infradead.org

unread,
Mar 20, 2006, 11:00:24 AM3/20/06
to
From: Hartmut Hackmann <hartmut....@t-online.de>
Date: 1139302150 -0200

Analog and DVB-T are working, Remote not yet.
This card is based on the new LifeView design, there should be many variants.

Signed-off-by: Hartmut Hackmann <hartmut....@t-online.de>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134
diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134
index 1823e4c..ee1618d 100644
--- a/Documentation/video4linux/CARDLIST.saa7134
+++ b/Documentation/video4linux/CARDLIST.saa7134
@@ -85,3 +85,4 @@
84 -> LifeView FlyDVB Trio [5168:0319]
85 -> AverTV DVB-T 777 [1461:2c05]
86 -> LifeView FlyDVB-T [5168:0301]
+ 87 -> ADS Instant TV Duo Cardbus PTV331 [0331:1421]


diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c

index f469f17..d65b9dd 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -2657,7 +2657,23 @@ struct saa7134_board saa7134_boards[] =
.amux = LINE2,
}},
},
-
+ [SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331] = {
+ .name = "ADS Instant TV Duo Cardbus PTV331",
+ .audio_clock = 0x00200000,
+ .tuner_type = TUNER_PHILIPS_TDA8290,
+ .radio_type = UNSET,
+ .tuner_addr = ADDR_UNSET,
+ .radio_addr = ADDR_UNSET,
+ .mpeg = SAA7134_MPEG_DVB,
+ .gpiomask = 0x00600000, /* Bit 21 0=Radio, Bit 22 0=TV */
+ .inputs = {{
+ .name = name_tv,
+ .vmux = 1,
+ .amux = TV,
+ .tv = 1,
+ .gpio = 0x00200000,
+ }},
+ },
};

const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards);
@@ -3141,6 +3157,12 @@ struct pci_device_id saa7134_pci_tbl[] =
.subdevice = 0x0301,
.driver_data = SAA7134_BOARD_FLYDVBT_LR301,
},{
+ .vendor = PCI_VENDOR_ID_PHILIPS,
+ .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
+ .subvendor = 0x0331,
+ .subdevice = 0x1421,
+ .driver_data = SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331,
+ },{
/* --- boards without eeprom + subsystem ID --- */
.vendor = PCI_VENDOR_ID_PHILIPS,
.device = PCI_DEVICE_ID_PHILIPS_SAA7134,
@@ -3263,6 +3285,10 @@ int saa7134_board_init1(struct saa7134_d
saa_writeb(SAA7134_GPIO_GPMODE3, 0x08);
saa_writeb(SAA7134_GPIO_GPSTATUS3, 0x06);
break;
+ case SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331:
+ saa_writeb(SAA7134_GPIO_GPMODE3, 0x08);
+ saa_writeb(SAA7134_GPIO_GPSTATUS3, 0x00);
+ break;
case SAA7134_BOARD_AVERMEDIA_CARDBUS:
/* power-up tuner chip */
saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0xffffffff, 0xffffffff);
@@ -3413,6 +3439,14 @@ int saa7134_board_init2(struct saa7134_d


i2c_transfer(&dev->i2c_adap, &msg, 1);
}
break;

+ case SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331:
+ /* make the tda10046 find its eeprom */
+ {
+ u8 data[] = { 0x3c, 0x33, 0x62};
+ struct i2c_msg msg = {.addr=0x08, .flags=0, .buf=data, .len = sizeof(data)};
+ i2c_transfer(&dev->i2c_adap, &msg, 1);


+ }
+ break;
}
return 0;
}

diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c

index be110b8..a0c8fa3 100644
--- a/drivers/media/video/saa7134/saa7134-dvb.c
+++ b/drivers/media/video/saa7134/saa7134-dvb.c
@@ -846,6 +846,45 @@ static struct tda1004x_config philips_ti
.request_firmware = NULL,
};

+/* ------------------------------------------------------------------ */
+
+static int ads_duo_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
+{
+ int ret;
+
+ ret = philips_tda827xa_pll_set(0x61, fe, params);
+ return ret;
+};
+
+static int ads_duo_dvb_mode(struct dvb_frontend *fe)
+{
+ struct saa7134_dev *dev = fe->dvb->priv;
+ /* route TDA8275a AGC input to the channel decoder */
+ saa_writeb(SAA7134_GPIO_GPSTATUS2, 0x60);


+ return 0;
+}
+

+static void ads_duo_analog_mode(struct dvb_frontend *fe)
+{
+ struct saa7134_dev *dev = fe->dvb->priv;
+ /* route TDA8275a AGC input to the analog IF chip*/
+ saa_writeb(SAA7134_GPIO_GPSTATUS2, 0x20);
+ philips_tda827xa_pll_sleep( 0x61, fe);
+}
+
+static struct tda1004x_config ads_tech_duo_config = {
+ .demod_address = 0x08,
+ .invert = 1,
+ .invert_oclk = 0,
+ .xtal_freq = TDA10046_XTAL_16M,
+ .agc_config = TDA10046_AGC_TDA827X_GPL,
+ .if_freq = TDA10046_FREQ_045,
+ .pll_init = ads_duo_dvb_mode,
+ .pll_set = ads_duo_pll_set,
+ .pll_sleep = ads_duo_analog_mode,
+ .request_firmware = NULL,
+};
+
#endif

/* ------------------------------------------------------------------ */
@@ -928,6 +967,10 @@ static int dvb_init(struct saa7134_dev *
dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config,
&dev->i2c_adap);
break;
+ case SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331:
+ dev->dvb.frontend = tda10046_attach(&ads_tech_duo_config,
+ &dev->i2c_adap);
+ break;
#endif
#ifdef HAVE_NXT200X
case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180:
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h
index ed556e6..4b49ee0 100644
--- a/drivers/media/video/saa7134/saa7134.h
+++ b/drivers/media/video/saa7134/saa7134.h
@@ -213,6 +213,7 @@ struct saa7134_format {
#define SAA7134_BOARD_FLYDVB_TRIO 84
#define SAA7134_BOARD_AVERMEDIA_777 85
#define SAA7134_BOARD_FLYDVBT_LR301 86
+#define SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331 87

#define SAA7134_MAXBOARDS 8
#define SAA7134_INPUT_MAX 8

mch...@infradead.org

unread,
Mar 20, 2006, 11:00:25 AM3/20/06
to
From: Markus Rechberger <mrech...@gmail.com>
Date: 1139302153 -0200

Fixed em28xx based system lockup, device needs to be initialized
before starting the isoc transfer otherwise the system will completly lock up.

Signed-off-by: Markus Rechberger <mrech...@gmail.com>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index 1726b2c..1c1557d 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -383,12 +383,14 @@ static int em28xx_v4l2_open(struct inode
em28xx_capture_start(dev, 1);
em28xx_resolution_set(dev);

+ /* device needs to be initialized before isoc transfer */
+ video_mux(dev, 0);
+
/* start the transfer */
errCode = em28xx_init_isoc(dev);
if (errCode)
goto err;

- video_mux(dev, 0);
}

dev->users++;

mch...@infradead.org

unread,
Mar 20, 2006, 11:00:26 AM3/20/06
to
From: Markus Rechberger <mrech...@gmail.com>
Date: 1139300739 -0200

- Added terratec hybrid xs product/vendorid
- Added gpio audio initialization for kworld pvr 2800rf

Signed-off-by: Markus Rechberger <mrech...@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/Documentation/video4linux/CARDLIST.em28xx b/Documentation/video4linux/CARDLIST.em28xx
diff --git a/Documentation/video4linux/CARDLIST.em28xx b/Documentation/video4linux/CARDLIST.em28xx
index a0c7cad..7a903f7 100644
--- a/Documentation/video4linux/CARDLIST.em28xx
+++ b/Documentation/video4linux/CARDLIST.em28xx
@@ -8,3 +8,4 @@


7 -> Leadtek Winfast USB II (em2800)
8 -> Kworld USB2800 (em2800)
9 -> Pinnacle Dazzle DVC 90 (em2820/em2840) [2304:0207]

+ 12 -> Unknown EM2820/2840 video grabber (em2820/em2840)


diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c

index ed428c5..573d24d 100644
--- a/drivers/media/video/em28xx/em28xx-cards.c
+++ b/drivers/media/video/em28xx/em28xx-cards.c
@@ -72,6 +72,24 @@ struct em28xx_board em28xx_boards[] = {


.amux = 1,
}},
},

+ [EM2820_BOARD_KWORLD_PVRTV2800RF] = {
+ .name = "Unknown EM2820/2840 video grabber",
+ .is_em2800 = 0,
+ .vchannels = 2,
+ .norm = VIDEO_MODE_PAL,
+ .tda9887_conf = TDA9887_PRESENT,
+ .has_tuner = 1,
+ .decoder = EM28XX_SAA7113,
+ .input = {{
+ .type = EM28XX_VMUX_COMPOSITE1,
+ .vmux = 0,
+ .amux = 1,
+ },{
+ .type = EM28XX_VMUX_SVIDEO,
+ .vmux = 9,
+ .amux = 1,
+ }},
+ },
[EM2820_BOARD_TERRATEC_CINERGY_250] = {
.name = "Terratec Cinergy 250 USB",
.vchannels = 3,
@@ -136,8 +154,30 @@ struct em28xx_board em28xx_boards[] = {


.amux = 1,
}},
},

- [EM2880_BOARD_WINTV_HVR_900] = {
- .name = "WinTV HVR 900",
+ [EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900] = {
+ .name = "Hauppauge WinTV HVR 900",
+ .vchannels = 3,
+ .norm = VIDEO_MODE_PAL,
+ .has_tuner = 0,
+ .tda9887_conf = TDA9887_PRESENT,
+ .has_tuner = 1,
+ .decoder = EM28XX_TVP5150,
+ .input = {{
+ .type = EM28XX_VMUX_COMPOSITE1,
+ .vmux = 2,
+ .amux = 0,
+ },{
+ .type = EM28XX_VMUX_TELEVISION,
+ .vmux = 0,
+ .amux = 1,
+ },{
+ .type = EM28XX_VMUX_SVIDEO,
+ .vmux = 9,
+ .amux = 1,
+ }},
+ },
+ [EM2880_BOARD_TERRATEC_HYBRID_XS] = {
+ .name = "Terratec Hybrid XS",
.vchannels = 3,
.norm = VIDEO_MODE_PAL,
.has_tuner = 0,
@@ -276,7 +316,8 @@ struct usb_device_id em28xx_id_table []

{ USB_DEVICE(0x2304, 0x0208), .driver_info = EM2820_BOARD_PINNACLE_USB_2 },
{ USB_DEVICE(0x2040, 0x4200), .driver_info = EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 },
{ USB_DEVICE(0x2304, 0x0207), .driver_info = EM2820_BOARD_PINNACLE_DVC_90 },

- { USB_DEVICE(0x2040, 0x6500), .driver_info = EM2880_BOARD_WINTV_HVR_900 },
+ { USB_DEVICE(0x2040, 0x6500), .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900 },
+ { USB_DEVICE(0x0ccd, 0x0042), .driver_info = EM2880_BOARD_TERRATEC_HYBRID_XS },
{ },
};

@@ -284,7 +325,8 @@ void em28xx_pre_card_setup(struct em28xx
{
/* request some modules */
switch(dev->model){
- case EM2880_BOARD_WINTV_HVR_900:
+ case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
+ case EM2880_BOARD_TERRATEC_HYBRID_XS:
{
em28xx_write_regs_req(dev, 0x00, 0x08, "\x7d", 1); // reset through GPIO?
break;
@@ -317,6 +359,12 @@ void em28xx_card_setup(struct em28xx *de
dev->has_msp34xx=0;
break;
}
+ case EM2820_BOARD_KWORLD_PVRTV2800RF:
+ {
+ em28xx_write_regs_req(dev,0x00,0x08, "\xf9", 1); // GPIO enables sound on KWORLD PVR TV 2800RF
+ break;
+ }
+
}
}

diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h
diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h
index 8269cca..ddf06c5 100644
--- a/drivers/media/video/em28xx/em28xx.h
+++ b/drivers/media/video/em28xx/em28xx.h
@@ -41,7 +41,9 @@
#define EM2800_BOARD_LEADTEK_WINFAST_USBII 7
#define EM2800_BOARD_KWORLD_USB2800 8
#define EM2820_BOARD_PINNACLE_DVC_90 9
-#define EM2880_BOARD_WINTV_HVR_900 10
+#define EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900 10
+#define EM2880_BOARD_TERRATEC_HYBRID_XS 11
+#define EM2820_BOARD_KWORLD_PVRTV2800RF 12

#define UNSET -1

mch...@infradead.org

unread,
Mar 20, 2006, 11:00:26 AM3/20/06
to
From: Adrian Bunk <bu...@stusta.de>
Date: 1141112451 -0300

- make 2 needlessly global functions static

- remove cpia2_setup(): the driver already allows setting parameters
through module_param(), and there's no reason for having two different
ways for setting the same parameters

Signed-off-by: Adrian Bunk <bu...@stusta.de>
Signed-off-by: Andrew Morton <ak...@osdl.org>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/Documentation/video4linux/README.cpia2 b/Documentation/video4linux/README.cpia2
diff --git a/Documentation/video4linux/README.cpia2 b/Documentation/video4linux/README.cpia2
index f3bd343..ce8213d 100644
--- a/Documentation/video4linux/README.cpia2
+++ b/Documentation/video4linux/README.cpia2
@@ -70,7 +70,7 @@ line like this:

If the driver is compiled into the kernel, at boot time specify them
like this:
- cpia2=num_buffers:3,buffer_size:65535
+ cpia2.num_buffers=3 cpia2.buffer_size=65535

What buffer size should I use?
------------------------------
diff --git a/drivers/media/video/cpia2/cpia2_v4l.c b/drivers/media/video/cpia2/cpia2_v4l.c
diff --git a/drivers/media/video/cpia2/cpia2_v4l.c b/drivers/media/video/cpia2/cpia2_v4l.c
index 3480a2c..589283d 100644
--- a/drivers/media/video/cpia2/cpia2_v4l.c
+++ b/drivers/media/video/cpia2/cpia2_v4l.c
@@ -2053,7 +2053,7 @@ static void __init check_parameters(void
* cpia2_init/module_init
*
*****************************************************************************/
-int __init cpia2_init(void)
+static int __init cpia2_init(void)
{
LOG("%s v%d.%d.%d\n",
ABOUT, CPIA2_MAJ_VER, CPIA2_MIN_VER, CPIA2_PATCH_VER);
@@ -2068,37 +2068,12 @@ int __init cpia2_init(void)
* cpia2_exit/module_exit
*
*****************************************************************************/
-void __exit cpia2_exit(void)
+static void __exit cpia2_exit(void)
{
cpia2_usb_cleanup();
schedule_timeout(2 * HZ);
}

-
-int __init cpia2_setup(char *str)
-{
- while(str) {
- if(!strncmp(str, "buffer_size:", 12)) {
- buffer_size = simple_strtoul(str + 13, &str, 10);
- } else if(!strncmp(str, "num_buffers:", 12)) {
- num_buffers = simple_strtoul(str + 13, &str, 10);
- } else if(!strncmp(str, "alternate:", 10)) {
- alternate = simple_strtoul(str + 11, &str, 10);
- } else if(!strncmp(str, "video_nr:", 9)) {
- video_nr = simple_strtoul(str + 10, &str, 10);
- } else if(!strncmp(str, "flicker_freq:",13)) {
- flicker_freq = simple_strtoul(str + 14, &str, 10);
- } else if(!strncmp(str, "flicker_mode:",13)) {
- flicker_mode = simple_strtoul(str + 14, &str, 10);
- } else {
- ++str;
- }
- }
- return 1;
-}
-
-__setup("cpia2=", cpia2_setup);
-
module_init(cpia2_init);
module_exit(cpia2_exit);

mch...@infradead.org

unread,
Mar 20, 2006, 11:00:30 AM3/20/06
to
From: Adrian Bunk <bu...@stusta.de>
Date: 1139302155 -0200

The at76c651 and tda80xx frontends are currently completely unused, IOW
their only effect is making the kernel larger for people accitentially
enabling them.

The current in-kernel drivers differ from the drivers at cvs.tuxbox.org,
and re-adding them when parts of the dbox2 project get merged should be
trivial.


Signed-off-by: Adrian Bunk <bu...@stusta.de>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/dvb/frontends/Kconfig b/drivers/media/dvb/frontends/Kconfig
diff --git a/drivers/media/dvb/frontends/Kconfig b/drivers/media/dvb/frontends/Kconfig
index f09e3da..76b6a2a 100644
--- a/drivers/media/dvb/frontends/Kconfig
+++ b/drivers/media/dvb/frontends/Kconfig
@@ -28,12 +28,6 @@ config DVB_TDA8083
help
A DVB-S tuner module. Say Y when you want to support this frontend.

-config DVB_TDA80XX
- tristate "Philips TDA8044 or TDA8083 based"
- depends on DVB_CORE
- help
- A DVB-S tuner module. Say Y when you want to support this frontend.
-
config DVB_MT312
tristate "Zarlink MT312 based"
depends on DVB_CORE
@@ -139,12 +133,6 @@ config DVB_DIB3000MC
comment "DVB-C (cable) frontends"
depends on DVB_CORE

-config DVB_ATMEL_AT76C651
- tristate "Atmel AT76C651 based"
- depends on DVB_CORE
- help
- A DVB-C tuner module. Say Y when you want to support this frontend.
-
config DVB_VES1820
tristate "VLSI VES1820 based"


depends on DVB_CORE
diff --git a/drivers/media/dvb/frontends/Makefile b/drivers/media/dvb/frontends/Makefile
diff --git a/drivers/media/dvb/frontends/Makefile b/drivers/media/dvb/frontends/Makefile

index 8f30146..1af769c 100644
--- a/drivers/media/dvb/frontends/Makefile
+++ b/drivers/media/dvb/frontends/Makefile
@@ -8,7 +8,6 @@ obj-$(CONFIG_DVB_CORE) += dvb-pll.o
obj-$(CONFIG_DVB_STV0299) += stv0299.o
obj-$(CONFIG_DVB_SP8870) += sp8870.o
obj-$(CONFIG_DVB_CX22700) += cx22700.o
-obj-$(CONFIG_DVB_ATMEL_AT76C651) += at76c651.o
obj-$(CONFIG_DVB_CX24110) += cx24110.o
obj-$(CONFIG_DVB_TDA8083) += tda8083.o
obj-$(CONFIG_DVB_L64781) += l64781.o
@@ -22,7 +21,6 @@ obj-$(CONFIG_DVB_SP887X) += sp887x.o
obj-$(CONFIG_DVB_NXT6000) += nxt6000.o
obj-$(CONFIG_DVB_MT352) += mt352.o
obj-$(CONFIG_DVB_CX22702) += cx22702.o
-obj-$(CONFIG_DVB_TDA80XX) += tda80xx.o


obj-$(CONFIG_DVB_TDA10021) += tda10021.o
obj-$(CONFIG_DVB_STV0297) += stv0297.o

obj-$(CONFIG_DVB_NXT200X) += nxt200x.o
diff --git a/drivers/media/dvb/frontends/at76c651.c b/drivers/media/dvb/frontends/at76c651.c
diff --git a/drivers/media/dvb/frontends/at76c651.c b/drivers/media/dvb/frontends/at76c651.c
deleted file mode 100644
index 8e0f4b3..0000000
--- a/drivers/media/dvb/frontends/at76c651.c
+++ /dev/null
@@ -1,450 +0,0 @@
-/*
- * at76c651.c
- *
- * Atmel DVB-C Frontend Driver (at76c651/tua6010xs)
- *
- * Copyright (C) 2001 fnbrd <fn...@gmx.de>
- * & 2002-2004 Andreas Oberritter <o...@linuxtv.org>
- * & 2003 Wolfram Joost <db...@frokaschwei.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * AT76C651
- * http://www.nalanda.nitc.ac.in/industry/datasheets/atmel/acrobat/doc1293.pdf
- * http://www.atmel.com/atmel/acrobat/doc1320.pdf
- */


-
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/moduleparam.h>

-#include <linux/kernel.h>
-#include <linux/string.h>
-#include <linux/slab.h>
-#include <linux/bitops.h>
-#include "dvb_frontend.h"
-#include "at76c651.h"
-
-
-struct at76c651_state {


-
- struct i2c_adapter* i2c;
-
- struct dvb_frontend_ops ops;
-

- const struct at76c651_config* config;
-


- struct dvb_frontend frontend;
-

- /* revision of the chip */
- u8 revision;
-
- /* last QAM value set */
- u8 qam;


-};
-
-static int debug;
-#define dprintk(args...) \
- do { \

- if (debug) printk(KERN_DEBUG "at76c651: " args); \


- } while (0)
-
-

-#if ! defined(__powerpc__)
-static __inline__ int __ilog2(unsigned long x)
-{
- int i;
-
- if (x == 0)
- return -1;
-
- for (i = 0; x != 0; i++)
- x >>= 1;
-
- return i - 1;
-}
-#endif
-
-static int at76c651_writereg(struct at76c651_state* state, u8 reg, u8 data)
-{
- int ret;
- u8 buf[] = { reg, data };


- struct i2c_msg msg =

- { .addr = state->config->demod_address, .flags = 0, .buf = buf, .len = 2 };
-
- ret = i2c_transfer(state->i2c, &msg, 1);
-
- if (ret != 1)
- dprintk("%s: writereg error "
- "(reg == 0x%02x, val == 0x%02x, ret == %i)\n",
- __FUNCTION__, reg, data, ret);
-
- msleep(10);
-
- return (ret != 1) ? -EREMOTEIO : 0;
-}
-
-static u8 at76c651_readreg(struct at76c651_state* state, u8 reg)
-{
- int ret;
- u8 val;


- struct i2c_msg msg[] = {

- { .addr = state->config->demod_address, .flags = 0, .buf = &reg, .len = 1 },
- { .addr = state->config->demod_address, .flags = I2C_M_RD, .buf = &val, .len = 1 }
- };
-
- ret = i2c_transfer(state->i2c, msg, 2);
-
- if (ret != 2)
- dprintk("%s: readreg error (ret == %i)\n", __FUNCTION__, ret);
-
- return val;
-}
-
-static int at76c651_reset(struct at76c651_state* state)
-{
- return at76c651_writereg(state, 0x07, 0x01);
-}
-
-static void at76c651_disable_interrupts(struct at76c651_state* state)
-{
- at76c651_writereg(state, 0x0b, 0x00);
-}
-
-static int at76c651_set_auto_config(struct at76c651_state *state)
-{
- /*
- * Autoconfig
- */
-
- at76c651_writereg(state, 0x06, 0x01);
-
- /*
- * Performance optimizations, should be done after autoconfig
- */
-
- at76c651_writereg(state, 0x10, 0x06);
- at76c651_writereg(state, 0x11, ((state->qam == 5) || (state->qam == 7)) ? 0x12 : 0x10);
- at76c651_writereg(state, 0x15, 0x28);
- at76c651_writereg(state, 0x20, 0x09);
- at76c651_writereg(state, 0x24, ((state->qam == 5) || (state->qam == 7)) ? 0xC0 : 0x90);
- at76c651_writereg(state, 0x30, 0x90);
- if (state->qam == 5)
- at76c651_writereg(state, 0x35, 0x2A);
-
- /*
- * Initialize A/D-converter
- */
-
- if (state->revision == 0x11) {
- at76c651_writereg(state, 0x2E, 0x38);
- at76c651_writereg(state, 0x2F, 0x13);
- }
-
- at76c651_disable_interrupts(state);
-
- /*
- * Restart operation
- */
-
- at76c651_reset(state);


-
- return 0;
-}
-

-static void at76c651_set_bbfreq(struct at76c651_state* state)
-{
- at76c651_writereg(state, 0x04, 0x3f);
- at76c651_writereg(state, 0x05, 0xee);
-}
-
-static int at76c651_set_symbol_rate(struct at76c651_state* state, u32 symbol_rate)
-{
- u8 exponent;
- u32 mantissa;
-
- if (symbol_rate > 9360000)
- return -EINVAL;
-
- /*
- * FREF = 57800 kHz
- * exponent = 10 + floor (log2(symbol_rate / FREF))
- * mantissa = (symbol_rate / FREF) * (1 << (30 - exponent))
- */
-
- exponent = __ilog2((symbol_rate << 4) / 903125);
- mantissa = ((symbol_rate / 3125) * (1 << (24 - exponent))) / 289;
-
- at76c651_writereg(state, 0x00, mantissa >> 13);
- at76c651_writereg(state, 0x01, mantissa >> 5);
- at76c651_writereg(state, 0x02, (mantissa << 3) | exponent);


-
- return 0;
-}
-

-static int at76c651_set_qam(struct at76c651_state *state, fe_modulation_t qam)
-{
- switch (qam) {
- case QPSK:
- state->qam = 0x02;
- break;
- case QAM_16:
- state->qam = 0x04;
- break;
- case QAM_32:
- state->qam = 0x05;
- break;
- case QAM_64:
- state->qam = 0x06;
- break;
- case QAM_128:
- state->qam = 0x07;


- break;
- case QAM_256:

- state->qam = 0x08;
- break;
-#if 0
- case QAM_512:
- state->qam = 0x09;
- break;
- case QAM_1024:
- state->qam = 0x0A;
- break;
-#endif


- default:
- return -EINVAL;
-

- }
-
- return at76c651_writereg(state, 0x03, state->qam);
-}
-
-static int at76c651_set_inversion(struct at76c651_state* state, fe_spectral_inversion_t inversion)
-{
- u8 feciqinv = at76c651_readreg(state, 0x60);
-
- switch (inversion) {
- case INVERSION_OFF:
- feciqinv |= 0x02;
- feciqinv &= 0xFE;
- break;
-
- case INVERSION_ON:
- feciqinv |= 0x03;
- break;
-
- case INVERSION_AUTO:
- feciqinv &= 0xFC;
- break;
-


- default:
- return -EINVAL;
- }

-
- return at76c651_writereg(state, 0x60, feciqinv);
-}
-
-static int at76c651_set_parameters(struct dvb_frontend* fe,


- struct dvb_frontend_parameters *p)
-{

- int ret;
- struct at76c651_state* state = fe->demodulator_priv;
-
- at76c651_writereg(state, 0x0c, 0xc3);
- state->config->pll_set(fe, p);
- at76c651_writereg(state, 0x0c, 0xc2);
-
- if ((ret = at76c651_set_symbol_rate(state, p->u.qam.symbol_rate)))
- return ret;
-
- if ((ret = at76c651_set_inversion(state, p->inversion)))
- return ret;
-
- return at76c651_set_auto_config(state);
-}
-
-static int at76c651_set_defaults(struct dvb_frontend* fe)
-{
- struct at76c651_state* state = fe->demodulator_priv;
-
- at76c651_set_symbol_rate(state, 6900000);
- at76c651_set_qam(state, QAM_64);
- at76c651_set_bbfreq(state);
- at76c651_set_auto_config(state);
-
- if (state->config->pll_init) {
- at76c651_writereg(state, 0x0c, 0xc3);
- state->config->pll_init(fe);
- at76c651_writereg(state, 0x0c, 0xc2);


- }
-
- return 0;
-}
-

-static int at76c651_read_status(struct dvb_frontend* fe, fe_status_t* status)
-{
- struct at76c651_state* state = fe->demodulator_priv;
- u8 sync;
-
- /*
- * Bits: FEC, CAR, EQU, TIM, AGC2, AGC1, ADC, PLL (PLL=0)
- */
- sync = at76c651_readreg(state, 0x80);


- *status = 0;
-

- if (sync & (0x04 | 0x10)) /* AGC1 || TIM */
- *status |= FE_HAS_SIGNAL;
- if (sync & 0x10) /* TIM */
- *status |= FE_HAS_CARRIER;
- if (sync & 0x80) /* FEC */
- *status |= FE_HAS_VITERBI;
- if (sync & 0x40) /* CAR */
- *status |= FE_HAS_SYNC;
- if ((sync & 0xF0) == 0xF0) /* TIM && EQU && CAR && FEC */


- *status |= FE_HAS_LOCK;
-
- return 0;
-}
-

-static int at76c651_read_ber(struct dvb_frontend* fe, u32* ber)
-{
- struct at76c651_state* state = fe->demodulator_priv;
-
- *ber = (at76c651_readreg(state, 0x81) & 0x0F) << 16;
- *ber |= at76c651_readreg(state, 0x82) << 8;
- *ber |= at76c651_readreg(state, 0x83);
- *ber *= 10;


-
- return 0;
-}
-

-static int at76c651_read_signal_strength(struct dvb_frontend* fe, u16* strength)
-{
- struct at76c651_state* state = fe->demodulator_priv;
-
- u8 gain = ~at76c651_readreg(state, 0x91);
- *strength = (gain << 8) | gain;


-
- return 0;
-}
-

-static int at76c651_read_snr(struct dvb_frontend* fe, u16* snr)
-{
- struct at76c651_state* state = fe->demodulator_priv;
-
- *snr = 0xFFFF -
- ((at76c651_readreg(state, 0x8F) << 8) |
- at76c651_readreg(state, 0x90));


-
- return 0;
-}
-

-static int at76c651_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)
-{
- struct at76c651_state* state = fe->demodulator_priv;
-
- *ucblocks = at76c651_readreg(state, 0x82);


-
- return 0;
-}
-

-static int at76c651_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings *fesettings)
-{
- fesettings->min_delay_ms = 50;


- fesettings->step_size = 0;
- fesettings->max_drift = 0;
- return 0;
-}
-

-static void at76c651_release(struct dvb_frontend* fe)
-{
- struct at76c651_state* state = fe->demodulator_priv;
- kfree(state);
-}
-
-static struct dvb_frontend_ops at76c651_ops;
-
-struct dvb_frontend* at76c651_attach(const struct at76c651_config* config,


- struct i2c_adapter* i2c)
-{

- struct at76c651_state* state = NULL;


-
- /* allocate memory for the internal state */

- state = kmalloc(sizeof(struct at76c651_state), GFP_KERNEL);


- if (state == NULL) goto error;
-
- /* setup the state */
- state->config = config;

- state->qam = 0;
-
- /* check if the demod is there */
- if (at76c651_readreg(state, 0x0e) != 0x65) goto error;
-
- /* finalise state setup */


- state->i2c = i2c;

- state->revision = at76c651_readreg(state, 0x0f) & 0xfe;
- memcpy(&state->ops, &at76c651_ops, sizeof(struct dvb_frontend_ops));


-
- /* create dvb_frontend */
- state->frontend.ops = &state->ops;
- state->frontend.demodulator_priv = state;
- return &state->frontend;
-
-error:
- kfree(state);
- return NULL;
-}
-

-static struct dvb_frontend_ops at76c651_ops = {
-
- .info = {
- .name = "Atmel AT76C651B DVB-C",
- .type = FE_QAM,
- .frequency_min = 48250000,
- .frequency_max = 863250000,
- .frequency_stepsize = 62500,
- /*.frequency_tolerance = */ /* FIXME: 12% of SR */
- .symbol_rate_min = 0, /* FIXME */
- .symbol_rate_max = 9360000, /* FIXME */
- .symbol_rate_tolerance = 4000,
- .caps = FE_CAN_INVERSION_AUTO |
- FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 |
- FE_CAN_FEC_4_5 | FE_CAN_FEC_5_6 | FE_CAN_FEC_6_7 |
- FE_CAN_FEC_7_8 | FE_CAN_FEC_8_9 | FE_CAN_FEC_AUTO |
- FE_CAN_QAM_16 | FE_CAN_QAM_32 | FE_CAN_QAM_64 | FE_CAN_QAM_128 |
- FE_CAN_MUTE_TS | FE_CAN_QAM_256 | FE_CAN_RECOVER
- },
-
- .release = at76c651_release,
-
- .init = at76c651_set_defaults,
-
- .set_frontend = at76c651_set_parameters,
- .get_tune_settings = at76c651_get_tune_settings,
-
- .read_status = at76c651_read_status,
- .read_ber = at76c651_read_ber,
- .read_signal_strength = at76c651_read_signal_strength,
- .read_snr = at76c651_read_snr,
- .read_ucblocks = at76c651_read_ucblocks,


-};
-
-module_param(debug, int, 0644);
-MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off).");
-

-MODULE_DESCRIPTION("Atmel AT76C651 DVB-C Demodulator Driver");
-MODULE_AUTHOR("Andreas Oberritter <o...@linuxtv.org>");
-MODULE_LICENSE("GPL");
-
-EXPORT_SYMBOL(at76c651_attach);
diff --git a/drivers/media/dvb/frontends/at76c651.h b/drivers/media/dvb/frontends/at76c651.h
diff --git a/drivers/media/dvb/frontends/at76c651.h b/drivers/media/dvb/frontends/at76c651.h
deleted file mode 100644
index 34054df..0000000
--- a/drivers/media/dvb/frontends/at76c651.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * at76c651.c
- *
- * Atmel DVB-C Frontend Driver (at76c651)
- *
- * Copyright (C) 2001 fnbrd <fn...@gmx.de>
- * & 2002-2004 Andreas Oberritter <o...@linuxtv.org>
- * & 2003 Wolfram Joost <db...@frokaschwei.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * AT76C651
- * http://www.nalanda.nitc.ac.in/industry/datasheets/atmel/acrobat/doc1293.pdf
- * http://www.atmel.com/atmel/acrobat/doc1320.pdf
- */
-
-#ifndef AT76C651_H
-#define AT76C651_H
-
-#include <linux/dvb/frontend.h>
-
-struct at76c651_config


-{
- /* the demodulator's i2c address */
- u8 demod_address;
-

- /* PLL maintenance */
- int (*pll_init)(struct dvb_frontend* fe);
- int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params);
-};
-
-extern struct dvb_frontend* at76c651_attach(const struct at76c651_config* config,


- struct i2c_adapter* i2c);
-

-#endif // AT76C651_H
diff --git a/drivers/media/dvb/frontends/tda80xx.c b/drivers/media/dvb/frontends/tda80xx.c
diff --git a/drivers/media/dvb/frontends/tda80xx.c b/drivers/media/dvb/frontends/tda80xx.c
deleted file mode 100644
index d1cabb6..0000000
--- a/drivers/media/dvb/frontends/tda80xx.c
+++ /dev/null
@@ -1,734 +0,0 @@
-/*
- * tda80xx.c
- *
- * Philips TDA8044 / TDA8083 QPSK demodulator driver
- *
- * Copyright (C) 2001 Felix Domke <tmb...@elitedvb.net>
- * Copyright (C) 2002-2004 Andreas Oberritter <o...@linuxtv.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <linux/config.h>
-#include <linux/delay.h>
-#include <linux/init.h>
-#include <linux/spinlock.h>
-#include <linux/threads.h>
-#include <linux/interrupt.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/slab.h>
-#include <asm/irq.h>
-#include <asm/div64.h>
-
-#include "dvb_frontend.h"
-#include "tda80xx.h"
-
-enum {
- ID_TDA8044 = 0x04,
- ID_TDA8083 = 0x05,
-};
-
-
-struct tda80xx_state {


-
- struct i2c_adapter* i2c;
-
- struct dvb_frontend_ops ops;
-

- /* configuration settings */
- const struct tda80xx_config* config;
-


- struct dvb_frontend frontend;
-

- u32 clk;
- int afc_loop;
- struct work_struct worklet;
- fe_code_rate_t code_rate;
- fe_spectral_inversion_t spectral_inversion;
- fe_status_t status;
- u8 id;
-};
-
-static int debug = 1;
-#define dprintk if (debug) printk
-
-static u8 tda8044_inittab_pre[] = {
- 0x02, 0x00, 0x6f, 0xb5, 0x86, 0x22, 0x00, 0xea,
- 0x30, 0x42, 0x98, 0x68, 0x70, 0x42, 0x99, 0x58,
- 0x95, 0x10, 0xf5, 0xe7, 0x93, 0x0b, 0x15, 0x68,
- 0x9a, 0x90, 0x61, 0x80, 0x00, 0xe0, 0x40, 0x00,
- 0x0f, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00
-};
-
-static u8 tda8044_inittab_post[] = {
- 0x04, 0x00, 0x6f, 0xb5, 0x86, 0x22, 0x00, 0xea,
- 0x30, 0x42, 0x98, 0x68, 0x70, 0x42, 0x99, 0x50,
- 0x95, 0x10, 0xf5, 0xe7, 0x93, 0x0b, 0x15, 0x68,
- 0x9a, 0x90, 0x61, 0x80, 0x00, 0xe0, 0x40, 0x6c,
- 0x0f, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00
-};
-
-static u8 tda8083_inittab[] = {
- 0x04, 0x00, 0x4a, 0x79, 0x04, 0x00, 0xff, 0xea,
- 0x48, 0x42, 0x79, 0x60, 0x70, 0x52, 0x9a, 0x10,
- 0x0e, 0x10, 0xf2, 0xa7, 0x93, 0x0b, 0x05, 0xc8,
- 0x9d, 0x00, 0x42, 0x80, 0x00, 0x60, 0x40, 0x00,
- 0x00, 0x75, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00
-};
-
-static __inline__ u32 tda80xx_div(u32 a, u32 b)
-{
- return (a + (b / 2)) / b;
-}
-
-static __inline__ u32 tda80xx_gcd(u32 a, u32 b)
-{
- u32 r;
-
- while ((r = a % b)) {
- a = b;
- b = r;
- }
-
- return b;
-}
-
-static int tda80xx_read(struct tda80xx_state* state, u8 reg, u8 *buf, u8 len)
-{
- int ret;
- struct i2c_msg msg[] = { { .addr = state->config->demod_address, .flags = 0, .buf = &reg, .len = 1 },


- { .addr = state->config->demod_address, .flags = I2C_M_RD, .buf = buf, .len = len } };
-

- ret = i2c_transfer(state->i2c, msg, 2);
-
- if (ret != 2)
- dprintk("%s: readreg error (reg %02x, ret == %i)\n",
- __FUNCTION__, reg, ret);
-
- mdelay(10);
-
- return (ret == 2) ? 0 : -EREMOTEIO;
-}
-
-static int tda80xx_write(struct tda80xx_state* state, u8 reg, const u8 *buf, u8 len)
-{
- int ret;
- u8 wbuf[len + 1];
- struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = wbuf, .len = len + 1 };
-
- wbuf[0] = reg;
- memcpy(&wbuf[1], buf, len);
-
- ret = i2c_transfer(state->i2c, &msg, 1);
-
- if (ret != 1)
- dprintk("%s: i2c xfer error (ret == %i)\n", __FUNCTION__, ret);
-
- mdelay(10);
-
- return (ret == 1) ? 0 : -EREMOTEIO;
-}
-
-static __inline__ u8 tda80xx_readreg(struct tda80xx_state* state, u8 reg)
-{
- u8 val;
-
- tda80xx_read(state, reg, &val, 1);
-
- return val;
-}
-
-static __inline__ int tda80xx_writereg(struct tda80xx_state* state, u8 reg, u8 data)
-{
- return tda80xx_write(state, reg, &data, 1);
-}
-
-static int tda80xx_set_parameters(struct tda80xx_state* state,
- fe_spectral_inversion_t inversion,
- u32 symbol_rate,
- fe_code_rate_t fec_inner)
-{
- u8 buf[15];
- u64 ratio;
- u32 clk;
- u32 k;
- u32 sr = symbol_rate;
- u32 gcd;
- u8 scd;
-
- if (symbol_rate > (state->clk * 3) / 16)
- scd = 0;
- else if (symbol_rate > (state->clk * 3) / 32)
- scd = 1;
- else if (symbol_rate > (state->clk * 3) / 64)
- scd = 2;
- else
- scd = 3;
-
- clk = scd ? (state->clk / (scd * 2)) : state->clk;
-
- /*
- * Viterbi decoder:
- * Differential decoding off
- * Spectral inversion unknown
- * QPSK modulation
- */
- if (inversion == INVERSION_ON)


- buf[0] = 0x60;

- else if (inversion == INVERSION_OFF)


- buf[0] = 0x20;

- else


- buf[0] = 0x00;
-

- /*
- * CLK ratio:
- * system clock frequency is up to 64 or 96 MHz
- *
- * formula:
- * r = k * clk / symbol_rate
- *
- * k: 2^21 for caa 0..3,
- * 2^20 for caa 4..5,
- * 2^19 for caa 6..7
- */
- if (symbol_rate <= (clk * 3) / 32)
- k = (1 << 19);
- else if (symbol_rate <= (clk * 3) / 16)
- k = (1 << 20);
- else
- k = (1 << 21);
-
- gcd = tda80xx_gcd(clk, sr);
- clk /= gcd;
- sr /= gcd;
-
- gcd = tda80xx_gcd(k, sr);
- k /= gcd;
- sr /= gcd;
-
- ratio = (u64)k * (u64)clk;
- do_div(ratio, sr);
-
- buf[1] = ratio >> 16;
- buf[2] = ratio >> 8;
- buf[3] = ratio;
-
- /* nyquist filter roll-off factor 35% */
- buf[4] = 0x20;
-
- clk = scd ? (state->clk / (scd * 2)) : state->clk;
-
- /* Anti Alias Filter */
- if (symbol_rate < (clk * 3) / 64)
- printk("tda80xx: unsupported symbol rate: %u\n", symbol_rate);
- else if (symbol_rate <= clk / 16)
- buf[4] |= 0x07;
- else if (symbol_rate <= (clk * 3) / 32)
- buf[4] |= 0x06;
- else if (symbol_rate <= clk / 8)
- buf[4] |= 0x05;
- else if (symbol_rate <= (clk * 3) / 16)
- buf[4] |= 0x04;
- else if (symbol_rate <= clk / 4)
- buf[4] |= 0x03;
- else if (symbol_rate <= (clk * 3) / 8)
- buf[4] |= 0x02;
- else if (symbol_rate <= clk / 2)
- buf[4] |= 0x01;
- else
- buf[4] |= 0x00;
-
- /* Sigma Delta converter */
- buf[5] = 0x00;
-
- /* FEC: Possible puncturing rates */
- if (fec_inner == FEC_NONE)
- buf[6] = 0x00;
- else if ((fec_inner >= FEC_1_2) && (fec_inner <= FEC_8_9))
- buf[6] = (1 << (8 - fec_inner));
- else if (fec_inner == FEC_AUTO)
- buf[6] = 0xff;
- else
- return -EINVAL;
-
- /* carrier lock detector threshold value */
- buf[7] = 0x30;
- /* AFC1: proportional part settings */
- buf[8] = 0x42;
- /* AFC1: integral part settings */
- buf[9] = 0x98;
- /* PD: Leaky integrator SCPC mode */
- buf[10] = 0x28;
- /* AFC2, AFC1 controls */
- buf[11] = 0x30;
- /* PD: proportional part settings */
- buf[12] = 0x42;
- /* PD: integral part settings */
- buf[13] = 0x99;
- /* AGC */
- buf[14] = 0x50 | scd;
-
- printk("symbol_rate=%u clk=%u\n", symbol_rate, clk);
-
- return tda80xx_write(state, 0x01, buf, sizeof(buf));
-}
-
-static int tda80xx_set_clk(struct tda80xx_state* state)
-{
- u8 buf[2];
-
- /* CLK proportional part */
- buf[0] = (0x06 << 5) | 0x08; /* CMP[2:0], CSP[4:0] */
- /* CLK integral part */
- buf[1] = (0x04 << 5) | 0x1a; /* CMI[2:0], CSI[4:0] */
-
- return tda80xx_write(state, 0x17, buf, sizeof(buf));
-}
-
-#if 0
-static int tda80xx_set_scpc_freq_offset(struct tda80xx_state* state)
-{
- /* a constant value is nonsense here imho */
- return tda80xx_writereg(state, 0x22, 0xf9);
-}
-#endif
-
-static int tda80xx_close_loop(struct tda80xx_state* state)
-{
- u8 buf[2];
-
- /* PD: Loop closed, LD: lock detect enable, SCPC: Sweep mode - AFC1 loop closed */
- buf[0] = 0x68;
- /* AFC1: Loop closed, CAR Feedback: 8192 */
- buf[1] = 0x70;
-
- return tda80xx_write(state, 0x0b, buf, sizeof(buf));
-}
-
-static irqreturn_t tda80xx_irq(int irq, void *priv, struct pt_regs *pt)
-{
- schedule_work(priv);
-
- return IRQ_HANDLED;
-}
-
-static void tda80xx_read_status_int(struct tda80xx_state* state)
-{
- u8 val;
-
- static const fe_spectral_inversion_t inv_tab[] = {
- INVERSION_OFF, INVERSION_ON
- };
-
- static const fe_code_rate_t fec_tab[] = {
- FEC_8_9, FEC_1_2, FEC_2_3, FEC_3_4,
- FEC_4_5, FEC_5_6, FEC_6_7, FEC_7_8,
- };
-
- val = tda80xx_readreg(state, 0x02);
-
- state->status = 0;
-
- if (val & 0x01) /* demodulator lock */
- state->status |= FE_HAS_SIGNAL;
- if (val & 0x02) /* clock recovery lock */
- state->status |= FE_HAS_CARRIER;
- if (val & 0x04) /* viterbi lock */
- state->status |= FE_HAS_VITERBI;
- if (val & 0x08) /* deinterleaver lock (packet sync) */
- state->status |= FE_HAS_SYNC;
- if (val & 0x10) /* derandomizer lock (frame sync) */
- state->status |= FE_HAS_LOCK;
- if (val & 0x20) /* frontend can not lock */
- state->status |= FE_TIMEDOUT;
-
- if ((state->status & (FE_HAS_CARRIER)) && (state->afc_loop)) {
- printk("tda80xx: closing loop\n");
- tda80xx_close_loop(state);
- state->afc_loop = 0;
- }
-
- if (state->status & (FE_HAS_VITERBI | FE_HAS_SYNC | FE_HAS_LOCK)) {
- val = tda80xx_readreg(state, 0x0e);
- state->code_rate = fec_tab[val & 0x07];
- if (state->status & (FE_HAS_SYNC | FE_HAS_LOCK))
- state->spectral_inversion = inv_tab[(val >> 7) & 0x01];
- else
- state->spectral_inversion = INVERSION_AUTO;
- }
- else {
- state->code_rate = FEC_AUTO;
- }
-}
-
-static void tda80xx_worklet(void *priv)
-{
- struct tda80xx_state *state = priv;
-
- tda80xx_writereg(state, 0x00, 0x04);
- enable_irq(state->config->irq);
-
- tda80xx_read_status_int(state);
-}
-
-static void tda80xx_wait_diseqc_fifo(struct tda80xx_state* state)
-{
- size_t i;
-
- for (i = 0; i < 100; i++) {
- if (tda80xx_readreg(state, 0x02) & 0x80)
- break;
- msleep(10);
- }
-}
-
-static int tda8044_init(struct dvb_frontend* fe)
-{
- struct tda80xx_state* state = fe->demodulator_priv;
- int ret;
-
- /*
- * this function is a mess...
- */
-
- if ((ret = tda80xx_write(state, 0x00, tda8044_inittab_pre, sizeof(tda8044_inittab_pre))))
- return ret;
-
- tda80xx_writereg(state, 0x0f, 0x50);
-#if 1
- tda80xx_writereg(state, 0x20, 0x8F); /* FIXME */
- tda80xx_writereg(state, 0x20, state->config->volt18setting); /* FIXME */
- //tda80xx_writereg(state, 0x00, 0x04);
- tda80xx_writereg(state, 0x00, 0x0C);
-#endif
- //tda80xx_writereg(state, 0x00, 0x08); /* Reset AFC1 loop filter */
-
- tda80xx_write(state, 0x00, tda8044_inittab_post, sizeof(tda8044_inittab_post));
-
- if (state->config->pll_init) {
- tda80xx_writereg(state, 0x1c, 0x80);
- state->config->pll_init(fe);
- tda80xx_writereg(state, 0x1c, 0x00);


- }
-
- return 0;
-}
-

-static int tda8083_init(struct dvb_frontend* fe)
-{
- struct tda80xx_state* state = fe->demodulator_priv;
-
- tda80xx_write(state, 0x00, tda8083_inittab, sizeof(tda8083_inittab));
-
- if (state->config->pll_init) {
- tda80xx_writereg(state, 0x1c, 0x80);
- state->config->pll_init(fe);
- tda80xx_writereg(state, 0x1c, 0x00);


- }
-
- return 0;
-}
-

-static int tda80xx_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage)
-{
- struct tda80xx_state* state = fe->demodulator_priv;
-
- switch (voltage) {
- case SEC_VOLTAGE_13:
- return tda80xx_writereg(state, 0x20, state->config->volt13setting);
- case SEC_VOLTAGE_18:
- return tda80xx_writereg(state, 0x20, state->config->volt18setting);
- case SEC_VOLTAGE_OFF:
- return tda80xx_writereg(state, 0x20, 0);


- default:
- return -EINVAL;
- }

-}
-
-static int tda80xx_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone)
-{
- struct tda80xx_state* state = fe->demodulator_priv;
-
- switch (tone) {
- case SEC_TONE_OFF:
- return tda80xx_writereg(state, 0x29, 0x00);
- case SEC_TONE_ON:
- return tda80xx_writereg(state, 0x29, 0x80);


- default:
- return -EINVAL;
- }

-}
-
-static int tda80xx_send_diseqc_msg(struct dvb_frontend* fe, struct dvb_diseqc_master_cmd *cmd)
-{
- struct tda80xx_state* state = fe->demodulator_priv;
-
- if (cmd->msg_len > 6)
- return -EINVAL;
-
- tda80xx_writereg(state, 0x29, 0x08 | (cmd->msg_len - 3));
- tda80xx_write(state, 0x23, cmd->msg, cmd->msg_len);
- tda80xx_writereg(state, 0x29, 0x0c | (cmd->msg_len - 3));
- tda80xx_wait_diseqc_fifo(state);


-
- return 0;
-}
-

-static int tda80xx_send_diseqc_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t cmd)
-{
- struct tda80xx_state* state = fe->demodulator_priv;
-
- switch (cmd) {
- case SEC_MINI_A:
- tda80xx_writereg(state, 0x29, 0x14);
- break;
- case SEC_MINI_B:
- tda80xx_writereg(state, 0x29, 0x1c);


- break;
- default:
- return -EINVAL;
- }

-
- tda80xx_wait_diseqc_fifo(state);


-
- return 0;
-}
-

-static int tda80xx_sleep(struct dvb_frontend* fe)
-{
- struct tda80xx_state* state = fe->demodulator_priv;
-
- tda80xx_writereg(state, 0x00, 0x02); /* enter standby */


-
- return 0;
-}
-

-static int tda80xx_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p)
-{
- struct tda80xx_state* state = fe->demodulator_priv;
-
- tda80xx_writereg(state, 0x1c, 0x80);
- state->config->pll_set(fe, p);
- tda80xx_writereg(state, 0x1c, 0x00);
-
- tda80xx_set_parameters(state, p->inversion, p->u.qpsk.symbol_rate, p->u.qpsk.fec_inner);
- tda80xx_set_clk(state);
- //tda80xx_set_scpc_freq_offset(state);
- state->afc_loop = 1;


-
- return 0;
-}
-

-static int tda80xx_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p)
-{
- struct tda80xx_state* state = fe->demodulator_priv;
-
- if (!state->config->irq)
- tda80xx_read_status_int(state);
-
- p->inversion = state->spectral_inversion;
- p->u.qpsk.fec_inner = state->code_rate;


-
- return 0;
-}
-

-static int tda80xx_read_status(struct dvb_frontend* fe, fe_status_t* status)
-{
- struct tda80xx_state* state = fe->demodulator_priv;
-
- if (!state->config->irq)
- tda80xx_read_status_int(state);
- *status = state->status;


-
- return 0;
-}
-

-static int tda80xx_read_ber(struct dvb_frontend* fe, u32* ber)
-{
- struct tda80xx_state* state = fe->demodulator_priv;
- int ret;
- u8 buf[3];
-
- if ((ret = tda80xx_read(state, 0x0b, buf, sizeof(buf))))
- return ret;
-
- *ber = ((buf[0] & 0x1f) << 16) | (buf[1] << 8) | buf[2];


-
- return 0;
-}
-

-static int tda80xx_read_signal_strength(struct dvb_frontend* fe, u16* strength)
-{
- struct tda80xx_state* state = fe->demodulator_priv;
-
- u8 gain = ~tda80xx_readreg(state, 0x01);
- *strength = (gain << 8) | gain;


-
- return 0;
-}
-

-static int tda80xx_read_snr(struct dvb_frontend* fe, u16* snr)
-{
- struct tda80xx_state* state = fe->demodulator_priv;
-
- u8 quality = tda80xx_readreg(state, 0x08);
- *snr = (quality << 8) | quality;


-
- return 0;
-}
-

-static int tda80xx_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)
-{
- struct tda80xx_state* state = fe->demodulator_priv;
-
- *ucblocks = tda80xx_readreg(state, 0x0f);
- if (*ucblocks == 0xff)
- *ucblocks = 0xffffffff;


-
- return 0;
-}
-

-static int tda80xx_init(struct dvb_frontend* fe)
-{
- struct tda80xx_state* state = fe->demodulator_priv;
-
- switch(state->id) {
- case ID_TDA8044:
- return tda8044_init(fe);
-
- case ID_TDA8083:
- return tda8083_init(fe);


- }
- return 0;
-}
-

-static void tda80xx_release(struct dvb_frontend* fe)
-{
- struct tda80xx_state* state = fe->demodulator_priv;
-
- if (state->config->irq)
- free_irq(state->config->irq, &state->worklet);
-
- kfree(state);
-}
-
-static struct dvb_frontend_ops tda80xx_ops;
-
-struct dvb_frontend* tda80xx_attach(const struct tda80xx_config* config,


- struct i2c_adapter* i2c)
-{

- struct tda80xx_state* state = NULL;
- int ret;


-
- /* allocate memory for the internal state */

- state = kmalloc(sizeof(struct tda80xx_state), GFP_KERNEL);


- if (state == NULL) goto error;
-
- /* setup the state */
- state->config = config;
- state->i2c = i2c;

- memcpy(&state->ops, &tda80xx_ops, sizeof(struct dvb_frontend_ops));
- state->spectral_inversion = INVERSION_AUTO;
- state->code_rate = FEC_AUTO;
- state->status = 0;
- state->afc_loop = 0;
-
- /* check if the demod is there */
- if (tda80xx_writereg(state, 0x89, 0x00) < 0) goto error;
- state->id = tda80xx_readreg(state, 0x00);
-
- switch (state->id) {
- case ID_TDA8044:
- state->clk = 96000000;
- printk("tda80xx: Detected tda8044\n");
- break;
-
- case ID_TDA8083:
- state->clk = 64000000;
- printk("tda80xx: Detected tda8083\n");
- break;
-
- default:
- goto error;
- }
-
- /* setup IRQ */
- if (state->config->irq) {
- INIT_WORK(&state->worklet, tda80xx_worklet, state);
- if ((ret = request_irq(state->config->irq, tda80xx_irq, SA_ONESHOT, "tda80xx", &state->worklet)) < 0) {
- printk(KERN_ERR "tda80xx: request_irq failed (%d)\n", ret);
- goto error;
- }
- }


-
- /* create dvb_frontend */
- state->frontend.ops = &state->ops;
- state->frontend.demodulator_priv = state;
- return &state->frontend;
-
-error:
- kfree(state);
- return NULL;
-}
-

-static struct dvb_frontend_ops tda80xx_ops = {
-
- .info = {
- .name = "Philips TDA80xx DVB-S",
- .type = FE_QPSK,
- .frequency_min = 500000,
- .frequency_max = 2700000,
- .frequency_stepsize = 125,
- .symbol_rate_min = 4500000,
- .symbol_rate_max = 45000000,
- .caps = FE_CAN_INVERSION_AUTO |
- FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 |
- FE_CAN_FEC_4_5 | FE_CAN_FEC_5_6 | FE_CAN_FEC_6_7 |
- FE_CAN_FEC_7_8 | FE_CAN_FEC_8_9 | FE_CAN_FEC_AUTO |
- FE_CAN_QPSK |
- FE_CAN_MUTE_TS
- },
-
- .release = tda80xx_release,
-
- .init = tda80xx_init,
- .sleep = tda80xx_sleep,
-
- .set_frontend = tda80xx_set_frontend,
- .get_frontend = tda80xx_get_frontend,
-
- .read_status = tda80xx_read_status,
- .read_ber = tda80xx_read_ber,
- .read_signal_strength = tda80xx_read_signal_strength,
- .read_snr = tda80xx_read_snr,
- .read_ucblocks = tda80xx_read_ucblocks,
-
- .diseqc_send_master_cmd = tda80xx_send_diseqc_msg,
- .diseqc_send_burst = tda80xx_send_diseqc_burst,
- .set_tone = tda80xx_set_tone,
- .set_voltage = tda80xx_set_voltage,


-};
-
-module_param(debug, int, 0644);
-

-MODULE_DESCRIPTION("Philips TDA8044 / TDA8083 DVB-S Demodulator driver");
-MODULE_AUTHOR("Felix Domke, Andreas Oberritter");
-MODULE_LICENSE("GPL");
-
-EXPORT_SYMBOL(tda80xx_attach);
diff --git a/drivers/media/dvb/frontends/tda80xx.h b/drivers/media/dvb/frontends/tda80xx.h
diff --git a/drivers/media/dvb/frontends/tda80xx.h b/drivers/media/dvb/frontends/tda80xx.h
deleted file mode 100644
index cd639a0..0000000
--- a/drivers/media/dvb/frontends/tda80xx.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * tda80xx.c
- *
- * Philips TDA8044 / TDA8083 QPSK demodulator driver
- *
- * Copyright (C) 2001 Felix Domke <tmb...@elitedvb.net>
- * Copyright (C) 2002-2004 Andreas Oberritter <o...@linuxtv.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef TDA80XX_H
-#define TDA80XX_H
-
-#include <linux/dvb/frontend.h>
-
-struct tda80xx_config


-{
- /* the demodulator's i2c address */
- u8 demod_address;
-

- /* IRQ to use (0=>no IRQ used) */
- u32 irq;
-
- /* Register setting to use for 13v */
- u8 volt13setting;
-
- /* Register setting to use for 18v */
- u8 volt18setting;
-
- /* PLL maintenance */
- int (*pll_init)(struct dvb_frontend* fe);
- int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params);
-};
-
-extern struct dvb_frontend* tda80xx_attach(const struct tda80xx_config* config,


- struct i2c_adapter* i2c);
-

-#endif // TDA80XX_H

mch...@infradead.org

unread,
Mar 20, 2006, 11:00:32 AM3/20/06
to
From: Mauro Carvalho Chehab <mch...@infradead.org>
Date: 1141009732 -0300

Previously, only NTSC and PAL/M were associated to 30fps and
525 lines, so, PAL/60 were not handled properly.

Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c
index a241bf7..4908dab 100644
--- a/drivers/media/video/v4l2-common.c
+++ b/drivers/media/video/v4l2-common.c
@@ -97,7 +97,7 @@ int v4l2_video_std_construct(struct v4l2
memset(vs, 0, sizeof(struct v4l2_standard));
vs->index = index;
vs->id = id;
- if (id & (V4L2_STD_NTSC | V4L2_STD_PAL_M)) {
+ if (id & V4L2_STD_525_60) {
vs->frameperiod.numerator = 1001;
vs->frameperiod.denominator = 30000;
vs->framelines = 525;
@@ -110,7 +110,6 @@ int v4l2_video_std_construct(struct v4l2
return 0;
}

-
/* ----------------------------------------------------------------- */
/* priority handling */

mch...@infradead.org

unread,
Mar 20, 2006, 11:00:34 AM3/20/06
to
From: Hartmut Hackmann <hartmut....@t-online.de>
Date: 1139300737 -0200

This patch allows to select AM sound even if NICAM is detected.
Proposed by Alain Frappin

Signed-off-by: Hartmut Hackmann <hartmut....@t-online.de>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/video/saa7134/saa7134-tvaudio.c b/drivers/media/video/saa7134/saa7134-tvaudio.c
diff --git a/drivers/media/video/saa7134/saa7134-tvaudio.c b/drivers/media/video/saa7134/saa7134-tvaudio.c
index afa4dcb..3043233 100644
--- a/drivers/media/video/saa7134/saa7134-tvaudio.c
+++ b/drivers/media/video/saa7134/saa7134-tvaudio.c
@@ -140,6 +140,12 @@ static struct saa7134_tvaudio tvaudio[]
.carr2 = 5850,
.mode = TVAUDIO_NICAM_AM,
},{
+ .name = "SECAM-L MONO",
+ .std = V4L2_STD_SECAM,
+ .carr1 = 6500,
+ .carr2 = -1,
+ .mode = TVAUDIO_AM_MONO,
+ },{
.name = "SECAM-D/K",
.std = V4L2_STD_SECAM,
.carr1 = 6500,
@@ -334,6 +340,12 @@ static void tvaudio_setmode(struct saa71
saa_writeb(SAA7134_STEREO_DAC_OUTPUT_SELECT, 0xa1);
saa_writeb(SAA7134_NICAM_CONFIG, 0x00);
break;
+ case TVAUDIO_AM_MONO:
+ saa_writeb(SAA7134_DEMODULATOR, 0x12);
+ saa_writeb(SAA7134_DCXO_IDENT_CTRL, 0x00);
+ saa_writeb(SAA7134_FM_DEEMPHASIS, 0x44);
+ saa_writeb(SAA7134_STEREO_DAC_OUTPUT_SELECT, 0xa0);
+ break;
case TVAUDIO_FM_SAT_STEREO:
/* not implemented (yet) */
break;
@@ -414,6 +426,7 @@ static int tvaudio_getstereo(struct saa7

switch (audio->mode) {
case TVAUDIO_FM_MONO:
+ case TVAUDIO_AM_MONO:
return V4L2_TUNER_SUB_MONO;
case TVAUDIO_FM_K_STEREO:
case TVAUDIO_FM_BG_STEREO:
@@ -480,6 +493,7 @@ static int tvaudio_setstereo(struct saa7

switch (audio->mode) {
case TVAUDIO_FM_MONO:
+ case TVAUDIO_AM_MONO:
/* nothing to do ... */
break;
case TVAUDIO_FM_K_STEREO:


diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h

index 3b8f466..b638df9 100644
--- a/drivers/media/video/saa7134/saa7134.h
+++ b/drivers/media/video/saa7134/saa7134.h
@@ -60,6 +60,7 @@ enum saa7134_tvaudio_mode {
TVAUDIO_FM_K_STEREO = 4,
TVAUDIO_NICAM_AM = 5,
TVAUDIO_NICAM_FM = 6,
+ TVAUDIO_AM_MONO = 7
};

enum saa7134_audio_in {

mch...@infradead.org

unread,
Mar 20, 2006, 11:00:34 AM3/20/06
to
From: Uwe Bugla <uwe....@gmx.de>
Date: 1141009774 -0300

Signed-off-by: Uwe Bugla <uwe....@gmx.de>
Signed-off-by: Manu Abraham <ma...@linuxtv.org>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/Documentation/dvb/avermedia.txt b/Documentation/dvb/avermedia.txt
diff --git a/Documentation/dvb/avermedia.txt b/Documentation/dvb/avermedia.txt
index 068070f..8bab846 100644
--- a/Documentation/dvb/avermedia.txt
+++ b/Documentation/dvb/avermedia.txt
@@ -1,4 +1,3 @@
-
HOWTO: Get An Avermedia DVB-T working under Linux
______________________________________________

@@ -137,11 +136,8 @@ Getting the card going
To power up the card, load the following modules in the
following order:

- * insmod dvb-core.o
- * modprobe bttv.o
- * insmod bt878.o
- * insmod dvb-bt8xx.o
- * insmod sp887x.o
+ * modprobe bttv (normally loaded automatically)
+ * modprobe dvb-bt8xx (or place dvb-bt8xx in /etc/modules)

Insertion of these modules into the running kernel will
activate the appropriate DVB device nodes. It is then possible
@@ -302,4 +298,4 @@ Further Update
Many thanks to Nigel Pearson for the updates to this document
since the recent revision of the driver.

- January 29th 2004
+ February 14th 2006
diff --git a/Documentation/dvb/readme.txt b/Documentation/dvb/readme.txt
diff --git a/Documentation/dvb/readme.txt b/Documentation/dvb/readme.txt
index f5c50b2..0b0380c 100644
--- a/Documentation/dvb/readme.txt
+++ b/Documentation/dvb/readme.txt
@@ -20,11 +20,23 @@ http://linuxtv.org/downloads/

What's inside this directory:

+"avermedia.txt"
+contains detailed information about the
+Avermedia DVB-T cards. See also "bt8xx.txt".
+
+"bt8xx.txt"
+contains detailed information about the
+various bt8xx based "budget" DVB cards.
+
"cards.txt"
contains a list of supported hardware.

+"ci.txt"
+contains detailed information about the
+CI module as part from TwinHan cards and Clones.
+
"contributors.txt"
-is the who-is-who of DVB development
+is the who-is-who of DVB development.

"faq.txt"
contains frequently asked questions and their answers.
@@ -34,19 +46,17 @@ script to download and extract firmware
that require it.

"ttusb-dec.txt"
-contains detailed informations about the
+contains detailed information about the
TT DEC2000/DEC3000 USB DVB hardware.

-"bt8xx.txt"
-contains detailed installation instructions for the
-various bt8xx based "budget" DVB cards
-(Nebula, Pinnacle PCTV, Twinhan DST)
-
-"README.dibusb"
-contains detailed information about adapters
-based on DiBcom reference design.
-
"udev.txt"
how to get DVB and udev up and running.

+"README.dvb-usb"
+contains detailed information about the DVB USB cards.
+
+"README.flexcop"
+contains detailed information about the
+Technisat- and Flexcop B2C2 drivers.
+
Good luck and have fun!

mch...@infradead.org

unread,
Mar 20, 2006, 11:00:35 AM3/20/06
to
From: Michael Krufky <mkr...@m1k.net>
Date: 1137477023 -0200

- Add PCI ID for DigitalNow DVB-T Dual,
rebranded DViCO FusionHDTV DVB-T Dual.

Signed-off-by: Michael Krufky <mkr...@m1k.net>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/Documentation/video4linux/CARDLIST.cx88 b/Documentation/video4linux/CARDLIST.cx88
diff --git a/Documentation/video4linux/CARDLIST.cx88 b/Documentation/video4linux/CARDLIST.cx88
index 56e194f..8bea3fb 100644
--- a/Documentation/video4linux/CARDLIST.cx88
+++ b/Documentation/video4linux/CARDLIST.cx88
@@ -42,4 +42,4 @@
41 -> Hauppauge WinTV-HVR1100 DVB-T/Hybrid (Low Profile) [0070:9800,0070:9802]
42 -> digitalnow DNTV Live! DVB-T Pro [1822:0025]
43 -> KWorld/VStream XPert DVB-T with cx22702 [17de:08a1]
- 44 -> DViCO FusionHDTV DVB-T Dual Digital [18ac:db50]
+ 44 -> DViCO FusionHDTV DVB-T Dual Digital [18ac:db50,18ac:db54]


diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c

index ad2f565..517257b 100644
--- a/drivers/media/video/cx88/cx88-cards.c
+++ b/drivers/media/video/cx88/cx88-cards.c
@@ -1246,6 +1246,11 @@ struct cx88_subid cx88_subids[] = {
.card = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL,
},{
.subvendor = 0x18ac,
+ .subdevice = 0xdb54,
+ .card = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL,
+ /* Re-branded DViCO: DigitalNow DVB-T Dual */
+ },{
+ .subvendor = 0x18ac,
.subdevice = 0xdb11,
.card = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS,
/* Re-branded DViCO: UltraView DVB-T Plus */

Arjan van de Ven

unread,
Mar 20, 2006, 11:00:35 AM3/20/06
to
On Mon, 2006-03-20 at 12:08 -0300, mch...@infradead.org wrote:
> This patch series is also available under v4l-dvb.git tree at:
> kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git
>
> Linus, please pull these from master branch.


please don't send 141 patch series patchbombs to lkml

mch...@infradead.org

unread,
Mar 20, 2006, 11:10:07 AM3/20/06
to
From: Mauro Carvalho Chehab <mch...@infradead.org>
Date: 1141009641 -0300

Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/MAINTAINERS b/MAINTAINERS
diff --git a/MAINTAINERS b/MAINTAINERS
index 7374be0..9f525ea 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -837,7 +837,6 @@ S: Maintained

DVB SUBSYSTEM AND DRIVERS
P: LinuxTV.org Project
-M: mch...@infradead.org
M: v4l-dvb-m...@linuxtv.org
L: linu...@linuxtv.org (subscription required)
W: http://linuxtv.org/

mch...@infradead.org

unread,
Mar 20, 2006, 11:10:08 AM3/20/06
to
From: Markus Rechberger <mrech...@gmail.com>
Date: 1138043470 -0200

- Hauppauge HVR 900 Composite support

Signed-off-by: Markus Rechberger <mrech...@gmail.com>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
index 58f7b41..ed428c5 100644
--- a/drivers/media/video/em28xx/em28xx-cards.c
+++ b/drivers/media/video/em28xx/em28xx-cards.c
@@ -136,6 +136,28 @@ struct em28xx_board em28xx_boards[] = {


.amux = 1,
}},
},

+ [EM2880_BOARD_WINTV_HVR_900] = {
+ .name = "WinTV HVR 900",


+ .vchannels = 3,
+ .norm = VIDEO_MODE_PAL,
+ .has_tuner = 0,
+ .tda9887_conf = TDA9887_PRESENT,
+ .has_tuner = 1,
+ .decoder = EM28XX_TVP5150,
+ .input = {{
+ .type = EM28XX_VMUX_COMPOSITE1,
+ .vmux = 2,
+ .amux = 0,
+ },{
+ .type = EM28XX_VMUX_TELEVISION,
+ .vmux = 0,
+ .amux = 1,
+ },{
+ .type = EM28XX_VMUX_SVIDEO,
+ .vmux = 9,
+ .amux = 1,
+ }},
+ },

[EM2820_BOARD_MSI_VOX_USB_2] = {
.name = "MSI VOX USB 2.0",
.vchannels = 3,
@@ -254,30 +276,47 @@ struct usb_device_id em28xx_id_table []

{ USB_DEVICE(0x2304, 0x0208), .driver_info = EM2820_BOARD_PINNACLE_USB_2 },
{ USB_DEVICE(0x2040, 0x4200), .driver_info = EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 },
{ USB_DEVICE(0x2304, 0x0207), .driver_info = EM2820_BOARD_PINNACLE_DVC_90 },

+ { USB_DEVICE(0x2040, 0x6500), .driver_info = EM2880_BOARD_WINTV_HVR_900 },
{ },
};

+void em28xx_pre_card_setup(struct em28xx *dev)
+{
+ /* request some modules */
+ switch(dev->model){
+ case EM2880_BOARD_WINTV_HVR_900:
+ {
+ em28xx_write_regs_req(dev, 0x00, 0x08, "\x7d", 1); // reset through GPIO?


+ break;
+ }
+ }
+}

+
void em28xx_card_setup(struct em28xx *dev)


{
/* request some modules */

- if (dev->model == EM2820_BOARD_HAUPPAUGE_WINTV_USB_2) {
- struct tveeprom tv;
+ switch(dev->model){
+ case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2:
+ {
+ struct tveeprom tv;
#ifdef CONFIG_MODULES
- request_module("tveeprom");
- request_module("ir-kbd-i2c");
- request_module("msp3400");
+ request_module("tveeprom");
+ request_module("ir-kbd-i2c");
+ request_module("msp3400");
#endif
- /* Call first TVeeprom */
+ /* Call first TVeeprom */

- dev->i2c_client.addr = 0xa0 >> 1;
- tveeprom_hauppauge_analog(&dev->i2c_client, &tv, dev->eedata);
+ dev->i2c_client.addr = 0xa0 >> 1;
+ tveeprom_hauppauge_analog(&dev->i2c_client, &tv, dev->eedata);

- dev->tuner_type= tv.tuner_type;
- if (tv.audio_processor == AUDIO_CHIP_MSP34XX) {
- dev->i2s_speed=2048000;
- dev->has_msp34xx=1;
- } else
- dev->has_msp34xx=0;
+ dev->tuner_type= tv.tuner_type;
+ if (tv.audio_processor == AUDIO_CHIP_MSP34XX) {
+ dev->i2s_speed=2048000;
+ dev->has_msp34xx=1;
+ } else
+ dev->has_msp34xx=0;
+ break;
+ }


}
}

diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c

index 1b0e10d..1726b2c 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -1766,6 +1766,7 @@ static int em28xx_init_dev(struct em28xx
dev->vpic.depth = 16;
dev->vpic.palette = VIDEO_PALETTE_YUV422;

+ em28xx_pre_card_setup(dev);
#ifdef CONFIG_MODULES


/* request some modules */

if (dev->decoder == EM28XX_SAA7113 || dev->decoder == EM28XX_SAA7114)


diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h
diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h

index 119fdbe..8269cca 100644
--- a/drivers/media/video/em28xx/em28xx.h
+++ b/drivers/media/video/em28xx/em28xx.h
@@ -41,6 +41,7 @@


#define EM2800_BOARD_LEADTEK_WINFAST_USBII 7
#define EM2800_BOARD_KWORLD_USB2800 8
#define EM2820_BOARD_PINNACLE_DVC_90 9

+#define EM2880_BOARD_WINTV_HVR_900 10

#define UNSET -1

@@ -327,6 +328,7 @@ int em28xx_set_alternate(struct em28xx *

/* Provided by em28xx-cards.c */
extern int em2800_variant_detect(struct usb_device* udev,int model);
+extern void em28xx_pre_card_setup(struct em28xx *dev);
extern void em28xx_card_setup(struct em28xx *dev);
extern struct em28xx_board em28xx_boards[];
extern struct usb_device_id em28xx_id_table[];

mch...@infradead.org

unread,
Mar 20, 2006, 11:10:11 AM3/20/06
to
From: Ricardo Cerqueira <v...@cerqueira.org>
Date: 1141009691 -0300

When multiple cards were installed, only the first card would have
audio initialized, because only the first position in the array parameter
defaulted to "1"
To make things worse, the "enable" parameter wasn't enabled, so there
was no workaround.

Signed-off-by: Ricardo Cerqueira <v...@cerqueira.org>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c
diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c
index d3c7345..614f7b9 100644
--- a/drivers/media/video/saa7134/saa7134-alsa.c
+++ b/drivers/media/video/saa7134/saa7134-alsa.c
@@ -54,10 +54,12 @@ MODULE_PARM_DESC(debug,"enable debug mes

static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
-static int enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 0};
+static int enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 1};

module_param_array(index, int, NULL, 0444);
+module_param_array(enable, int, NULL, 0444);
MODULE_PARM_DESC(index, "Index value for SAA7134 capture interface(s).");
+MODULE_PARM_DESC(enable, "Enable (or not) the SAA7134 capture interface(s).");

#define dprintk(fmt, arg...) if (debug) \
printk(KERN_DEBUG "%s/alsa: " fmt, dev->name , ##arg)

mch...@infradead.org

unread,
Mar 20, 2006, 11:10:10 AM3/20/06
to
From: Hans Verkuil <hver...@xs4all.nl>
Date: 1138016860 -0200

- Add probe check for the tda9840 to prevent misdetection of a Micronas
dpl3518a as a tda9840.

Signed-off-by: Hans Verkuil <hver...@xs4all.nl>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c
diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c
index 6d03b9b..c8e5ad0 100644
--- a/drivers/media/video/tvaudio.c
+++ b/drivers/media/video/tvaudio.c
@@ -390,6 +390,14 @@ static void tda9840_setmode(struct CHIPS
chip_write(chip, TDA9840_SW, t);
}

+static int tda9840_checkit(struct CHIPSTATE *chip)
+{
+ int rc;
+ rc = chip_read(chip);
+ /* lower 5 bits should be 0 */
+ return ((rc & 0x1f) == 0) ? 1 : 0;
+}
+
/* ---------------------------------------------------------------------- */
/* audio chip descriptions - defines+functions for tda985x */

@@ -1264,6 +1272,7 @@ static struct CHIPDESC chiplist[] = {
.addr_hi = I2C_TDA9840 >> 1,
.registers = 5,

+ .checkit = tda9840_checkit,
.getmode = tda9840_getmode,
.setmode = tda9840_setmode,
.checkmode = generic_checkmode,

mch...@infradead.org

unread,
Mar 20, 2006, 11:10:14 AM3/20/06
to
From: Markus Rechberger <mrech...@gmail.com>
Date: 1141009651 -0300

Fixed xc3028 firmware extractor for terratec's emBDA.sys firmware
Fixed delay in firmwareupload, now terratec's firmware also works

Signed-off-by: Markus Rechberger <mrech...@gmail.com>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
index e9834c1..fc58907 100644
--- a/drivers/media/video/em28xx/em28xx-cards.c
+++ b/drivers/media/video/em28xx/em28xx-cards.c
@@ -181,8 +181,8 @@ struct em28xx_board em28xx_boards[] = {


.vchannels = 3,
.norm = VIDEO_MODE_PAL,

.tda9887_conf = TDA9887_PRESENT,
- .tuner_type = TUNER_XCEIVE_XC3028,
.has_tuner = 1,
+ .tuner_type = TUNER_XCEIVE_XC3028,
.decoder = EM28XX_TVP5150,
.input = {{
.type = EM28XX_VMUX_COMPOSITE1,
diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c
diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c
index 6ca8631..5b6cece 100644
--- a/drivers/media/video/em28xx/em28xx-i2c.c
+++ b/drivers/media/video/em28xx/em28xx-i2c.c
@@ -420,7 +420,6 @@ static int em28xx_set_tuner(int check_ee
tun_setup.mode_mask = T_ANALOG_TV | T_RADIO;
tun_setup.type = dev->tuner_type;
tun_setup.addr = dev->tuner_addr;
-
em28xx_i2c_call_clients(dev, TUNER_SET_TYPE_ADDR, &tun_setup);
}

diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index 520f274..4a660a4 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -173,7 +173,6 @@ static void set_type(struct i2c_client *
}

t->type = type;
-
switch (t->type) {
case TUNER_MT2032:
microtune_init(c);

mch...@infradead.org

unread,
Mar 20, 2006, 11:10:13 AM3/20/06
to
From: Oliver Endriss <o.en...@gmx.de>
Date: 1141129876 -0300

Moved duplicated code to separate files.
LNBP21 stuff rewritten from scratch, BSBE1 copied from av7110.c.
Modified budget driver to use the new routines.

Signed-off-by: Oliver Endriss <o.en...@gmx.de>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.h b/drivers/media/dvb/dvb-core/dvb_frontend.h
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.h b/drivers/media/dvb/dvb-core/dvb_frontend.h
index 70a6d14..d5aee5a 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.h
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.h
@@ -104,6 +104,7 @@ struct dvb_frontend {
struct dvb_adapter *dvb;
void* demodulator_priv;
void* frontend_priv;
+ void* misc_priv;
};

extern int dvb_register_frontend(struct dvb_adapter* dvb,
diff --git a/drivers/media/dvb/frontends/bsbe1.h b/drivers/media/dvb/frontends/bsbe1.h
diff --git a/drivers/media/dvb/frontends/bsbe1.h b/drivers/media/dvb/frontends/bsbe1.h
new file mode 100644
index 0000000..78573b2
--- /dev/null
+++ b/drivers/media/dvb/frontends/bsbe1.h
@@ -0,0 +1,123 @@
+/*
+ * bsbe1.h - ALPS BSBE1 tuner support (moved from av7110.c)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *


+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software

+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
+ *
+ *
+ * the project's page is at http://www.linuxtv.org
+ */
+
+#ifndef BSBE1_H
+#define BSBE1_H
+
+static u8 alps_bsbe1_inittab[] = {
+ 0x01, 0x15,
+ 0x02, 0x30,
+ 0x03, 0x00,
+ 0x04, 0x7d, /* F22FR = 0x7d, F22 = f_VCO / 128 / 0x7d = 22 kHz */
+ 0x05, 0x35, /* I2CT = 0, SCLT = 1, SDAT = 1 */
+ 0x06, 0x40, /* DAC not used, set to high impendance mode */
+ 0x07, 0x00, /* DAC LSB */
+ 0x08, 0x40, /* DiSEqC off, LNB power on OP2/LOCK pin on */
+ 0x09, 0x00, /* FIFO */
+ 0x0c, 0x51, /* OP1 ctl = Normal, OP1 val = 1 (LNB Power ON) */
+ 0x0d, 0x82, /* DC offset compensation = ON, beta_agc1 = 2 */
+ 0x0e, 0x23, /* alpha_tmg = 2, beta_tmg = 3 */
+ 0x10, 0x3f, // AGC2 0x3d
+ 0x11, 0x84,
+ 0x12, 0xb9,
+ 0x15, 0xc9, // lock detector threshold
+ 0x16, 0x00,
+ 0x17, 0x00,
+ 0x18, 0x00,
+ 0x19, 0x00,
+ 0x1a, 0x00,
+ 0x1f, 0x50,
+ 0x20, 0x00,
+ 0x21, 0x00,
+ 0x22, 0x00,
+ 0x23, 0x00,
+ 0x28, 0x00, // out imp: normal out type: parallel FEC mode:0
+ 0x29, 0x1e, // 1/2 threshold
+ 0x2a, 0x14, // 2/3 threshold
+ 0x2b, 0x0f, // 3/4 threshold
+ 0x2c, 0x09, // 5/6 threshold
+ 0x2d, 0x05, // 7/8 threshold
+ 0x2e, 0x01,
+ 0x31, 0x1f, // test all FECs
+ 0x32, 0x19, // viterbi and synchro search
+ 0x33, 0xfc, // rs control
+ 0x34, 0x93, // error control
+ 0x0f, 0x92,
+ 0xff, 0xff
+};
+
+
+static int alps_bsbe1_set_symbol_rate(struct dvb_frontend* fe, u32 srate, u32 ratio)
+{
+ u8 aclk = 0;
+ u8 bclk = 0;
+
+ if (srate < 1500000) { aclk = 0xb7; bclk = 0x47; }
+ else if (srate < 3000000) { aclk = 0xb7; bclk = 0x4b; }
+ else if (srate < 7000000) { aclk = 0xb7; bclk = 0x4f; }
+ else if (srate < 14000000) { aclk = 0xb7; bclk = 0x53; }
+ else if (srate < 30000000) { aclk = 0xb6; bclk = 0x53; }
+ else if (srate < 45000000) { aclk = 0xb4; bclk = 0x51; }
+
+ stv0299_writereg(fe, 0x13, aclk);
+ stv0299_writereg(fe, 0x14, bclk);
+ stv0299_writereg(fe, 0x1f, (ratio >> 16) & 0xff);
+ stv0299_writereg(fe, 0x20, (ratio >> 8) & 0xff);
+ stv0299_writereg(fe, 0x21, (ratio ) & 0xf0);
+


+ return 0;
+}
+

+static int alps_bsbe1_pll_set(struct dvb_frontend* fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters* params)
+{
+ int ret;
+ u8 data[4];
+ u32 div;
+ struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) };
+
+ if ((params->frequency < 950000) || (params->frequency > 2150000))
+ return -EINVAL;
+
+ div = (params->frequency + (125 - 1)) / 125; // round correctly
+ data[0] = (div >> 8) & 0x7f;
+ data[1] = div & 0xff;
+ data[2] = 0x80 | ((div & 0x18000) >> 10) | 4;
+ data[3] = (params->frequency > 1530000) ? 0xE0 : 0xE4;
+
+ ret = i2c_transfer(i2c, &msg, 1);
+ return (ret != 1) ? -EIO : 0;
+}
+
+static struct stv0299_config alps_bsbe1_config = {
+ .demod_address = 0x68,
+ .inittab = alps_bsbe1_inittab,
+ .mclk = 88000000UL,
+ .invert = 1,
+ .skip_reinit = 0,
+ .min_delay_ms = 100,
+ .set_symbol_rate = alps_bsbe1_set_symbol_rate,
+ .pll_set = alps_bsbe1_pll_set,
+};
+
+#endif
diff --git a/drivers/media/dvb/frontends/lnbp21.h b/drivers/media/dvb/frontends/lnbp21.h
diff --git a/drivers/media/dvb/frontends/lnbp21.h b/drivers/media/dvb/frontends/lnbp21.h
new file mode 100644
index 0000000..0dcbe61
--- /dev/null
+++ b/drivers/media/dvb/frontends/lnbp21.h
@@ -0,0 +1,139 @@
+/*
+ * lnbp21.h - driver for lnb supply and control ic lnbp21
+ *
+ * Copyright (C) 2006 Oliver Endriss
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *


+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software

+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
+ *
+ *
+ * the project's page is at http://www.linuxtv.org
+ */
+
+#ifndef _LNBP21_H
+#define _LNBP21_H
+
+/* system register */
+#define LNBP21_OLF 0x01
+#define LNBP21_OTF 0x02
+#define LNBP21_EN 0x04
+#define LNBP21_VSEL 0x08
+#define LNBP21_LLC 0x10
+#define LNBP21_TEN 0x20
+#define LNBP21_ISEL 0x40
+#define LNBP21_PCL 0x80
+
+struct lnbp21 {
+ u8 config;
+ u8 override_or;
+ u8 override_and;
+ struct i2c_adapter *i2c;
+ void (*release_chain)(struct dvb_frontend* fe);
+};
+
+static int lnbp21_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
+{
+ struct lnbp21 *lnbp21 = (struct lnbp21 *) fe->misc_priv;
+ struct i2c_msg msg = { .addr = 0x08, .flags = 0,
+ .buf = &lnbp21->config,
+ .len = sizeof(lnbp21->config) };
+
+ lnbp21->config &= ~(LNBP21_VSEL | LNBP21_EN);
+
+ switch(voltage) {
+ case SEC_VOLTAGE_OFF:
+ break;
+ case SEC_VOLTAGE_13:
+ lnbp21->config |= LNBP21_EN;
+ break;
+ case SEC_VOLTAGE_18:
+ lnbp21->config |= (LNBP21_EN | LNBP21_VSEL);


+ break;
+ default:
+ return -EINVAL;

+ };
+
+ lnbp21->config |= lnbp21->override_or;
+ lnbp21->config &= lnbp21->override_and;
+
+ return (i2c_transfer(lnbp21->i2c, &msg, 1) == 1) ? 0 : -EIO;
+}
+
+static int lnbp21_enable_high_lnb_voltage(struct dvb_frontend *fe, long arg)
+{
+ struct lnbp21 *lnbp21 = (struct lnbp21 *) fe->misc_priv;
+ struct i2c_msg msg = { .addr = 0x08, .flags = 0,
+ .buf = &lnbp21->config,
+ .len = sizeof(lnbp21->config) };
+
+ if (arg)
+ lnbp21->config |= LNBP21_LLC;
+ else
+ lnbp21->config &= ~LNBP21_LLC;
+
+ lnbp21->config |= lnbp21->override_or;
+ lnbp21->config &= lnbp21->override_and;
+
+ return (i2c_transfer(lnbp21->i2c, &msg, 1) == 1) ? 0 : -EIO;
+}
+
+static void lnbp21_exit(struct dvb_frontend *fe)
+{
+ struct lnbp21 *lnbp21 = (struct lnbp21 *) fe->misc_priv;
+
+ /* LNBP power off */
+ lnbp21_set_voltage(fe, SEC_VOLTAGE_OFF);
+
+ /* free data & call next release routine */
+ fe->ops->release = lnbp21->release_chain;
+ kfree(fe->misc_priv);
+ fe->misc_priv = NULL;
+ if (fe->ops->release)
+ fe->ops->release(fe);
+}
+
+static int lnbp21_init(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 override_set, u8 override_clear)
+{
+ struct lnbp21 *lnbp21 = kmalloc(sizeof(struct lnbp21), GFP_KERNEL);
+
+ if (!lnbp21)
+ return -ENOMEM;
+
+ /* default configuration */
+ lnbp21->config = LNBP21_ISEL;
+
+ /* bits which should be forced to '1' */
+ lnbp21->override_or = override_set;
+
+ /* bits which should be forced to '0' */
+ lnbp21->override_and = ~override_clear;
+
+ /* install release callback */
+ lnbp21->release_chain = fe->ops->release;
+ fe->ops->release = lnbp21_exit;
+
+ /* override frontend ops */
+ fe->ops->set_voltage = lnbp21_set_voltage;
+ fe->ops->enable_high_lnb_voltage = lnbp21_enable_high_lnb_voltage;
+
+ lnbp21->i2c = i2c;
+ fe->misc_priv = lnbp21;
+
+ return lnbp21_set_voltage(fe, SEC_VOLTAGE_OFF);
+}
+
+#endif
diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c
diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c
index 238c77b..2a0e3ef 100644
--- a/drivers/media/dvb/ttpci/budget.c
+++ b/drivers/media/dvb/ttpci/budget.c
@@ -41,6 +41,8 @@
#include "l64781.h"
#include "tda8083.h"
#include "s5h1420.h"
+#include "lnbp21.h"
+#include "bsbe1.h"

static void Set22K (struct budget *budget, int state)
{
@@ -184,64 +186,6 @@ static int budget_diseqc_send_burst(stru
return 0;
}

-static int lnbp21_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage)
-{
- struct budget* budget = (struct budget*) fe->dvb->priv;
- u8 buf;
- struct i2c_msg msg = { .addr = 0x08, .flags = I2C_M_RD, .buf = &buf, .len = sizeof(buf) };
-
- if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO;
-
- switch(voltage) {
- case SEC_VOLTAGE_13:
- buf = (buf & 0xf7) | 0x04;
- break;
-
- case SEC_VOLTAGE_18:
- buf = (buf & 0xf7) | 0x0c;
- break;
-
- case SEC_VOLTAGE_OFF:
- buf = buf & 0xf0;
- break;
- }
-
- msg.flags = 0;
- if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO;


-
- return 0;
-}
-

-static int lnbp21_enable_high_lnb_voltage(struct dvb_frontend* fe, long arg)
-{
- struct budget* budget = (struct budget*) fe->dvb->priv;
- u8 buf;
- struct i2c_msg msg = { .addr = 0x08, .flags = I2C_M_RD, .buf = &buf, .len = sizeof(buf) };
-
- if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO;
-
- if (arg) {
- buf = buf | 0x10;
- } else {
- buf = buf & 0xef;
- }
-
- msg.flags = 0;
- if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO;


-
- return 0;
-}
-

-static int lnbp21_init(struct budget* budget)
-{
- u8 buf = 0x00;
- struct i2c_msg msg = { .addr = 0x08, .flags = 0, .buf = &buf, .len = sizeof(buf) };
-
- if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1)
- return -EIO;


- return 0;
-}
-

static int alps_bsrv2_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params)
{
struct budget* budget = (struct budget*) fe->dvb->priv;
@@ -374,79 +318,6 @@ static struct stv0299_config alps_bsru6_
.pll_set = alps_bsru6_pll_set,
};

-static u8 alps_bsbe1_inittab[] = {
- 0x01, 0x15,
- 0x02, 0x30,
- 0x03, 0x00,
- 0x04, 0x7d, /* F22FR = 0x7d, F22 = f_VCO / 128 / 0x7d = 22 kHz */
- 0x05, 0x35, /* I2CT = 0, SCLT = 1, SDAT = 1 */
- 0x06, 0x40, /* DAC not used, set to high impendance mode */
- 0x07, 0x00, /* DAC LSB */
- 0x08, 0x40, /* DiSEqC off, LNB power on OP2/LOCK pin on */
- 0x09, 0x00, /* FIFO */
- 0x0c, 0x51, /* OP1 ctl = Normal, OP1 val = 1 (LNB Power ON) */
- 0x0d, 0x82, /* DC offset compensation = ON, beta_agc1 = 2 */
- 0x0e, 0x23, /* alpha_tmg = 2, beta_tmg = 3 */
- 0x10, 0x3f, // AGC2 0x3d
- 0x11, 0x84,
- 0x12, 0xb9,
- 0x15, 0xc9, // lock detector threshold
- 0x16, 0x00,
- 0x17, 0x00,
- 0x18, 0x00,
- 0x19, 0x00,
- 0x1a, 0x00,
- 0x1f, 0x50,
- 0x20, 0x00,
- 0x21, 0x00,
- 0x22, 0x00,
- 0x23, 0x00,
- 0x28, 0x00, // out imp: normal out type: parallel FEC mode:0
- 0x29, 0x1e, // 1/2 threshold
- 0x2a, 0x14, // 2/3 threshold
- 0x2b, 0x0f, // 3/4 threshold
- 0x2c, 0x09, // 5/6 threshold
- 0x2d, 0x05, // 7/8 threshold
- 0x2e, 0x01,
- 0x31, 0x1f, // test all FECs
- 0x32, 0x19, // viterbi and synchro search
- 0x33, 0xfc, // rs control
- 0x34, 0x93, // error control
- 0x0f, 0x92, // 0x80 = inverse AGC
- 0xff, 0xff
-};
-
-static int alps_bsbe1_pll_set(struct dvb_frontend* fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters* params)
-{
- int ret;
- u8 data[4];
- u32 div;
- struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) };
-
- if ((params->frequency < 950000) || (params->frequency > 2150000))
- return -EINVAL;
-
- div = (params->frequency + (125 - 1)) / 125; // round correctly
- data[0] = (div >> 8) & 0x7f;
- data[1] = div & 0xff;
- data[2] = 0x80 | ((div & 0x18000) >> 10) | 4;
- data[3] = (params->frequency > 1530000) ? 0xE0 : 0xE4;
-
- ret = i2c_transfer(i2c, &msg, 1);
- return (ret != 1) ? -EIO : 0;
-}
-
-static struct stv0299_config alps_bsbe1_config = {
- .demod_address = 0x68,
- .inittab = alps_bsbe1_inittab,
- .mclk = 88000000UL,
- .invert = 1,
- .skip_reinit = 0,
- .min_delay_ms = 100,
- .set_symbol_rate = alps_bsru6_set_symbol_rate,
- .pll_set = alps_bsbe1_pll_set,
-};
-
static int alps_tdbe2_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params)
{
struct budget* budget = (struct budget*) fe->dvb->priv;
@@ -584,10 +455,8 @@ static void frontend_init(struct budget
// try the ALPS BSBE1 now
budget->dvb_frontend = stv0299_attach(&alps_bsbe1_config, &budget->i2c_adap);
if (budget->dvb_frontend) {
- budget->dvb_frontend->ops->set_voltage = lnbp21_set_voltage;
- budget->dvb_frontend->ops->enable_high_lnb_voltage = lnbp21_enable_high_lnb_voltage;
budget->dvb_frontend->ops->dishnetwork_send_legacy_command = NULL;
- if (lnbp21_init(budget)) {
+ if (lnbp21_init(budget->dvb_frontend, &budget->i2c_adap, LNBP21_LLC, 0)) {
printk("%s: No LNBP21 found!\n", __FUNCTION__);
goto error_out;
}
@@ -646,9 +515,7 @@ static void frontend_init(struct budget
case 0x1016: // Hauppauge/TT Nova-S SE (samsung s5h1420/????(tda8260))
budget->dvb_frontend = s5h1420_attach(&s5h1420_config, &budget->i2c_adap);
if (budget->dvb_frontend) {
- budget->dvb_frontend->ops->set_voltage = lnbp21_set_voltage;
- budget->dvb_frontend->ops->enable_high_lnb_voltage = lnbp21_enable_high_lnb_voltage;
- if (lnbp21_init(budget)) {
+ if (lnbp21_init(budget->dvb_frontend, &budget->i2c_adap, 0, 0)) {
printk("%s: No LNBP21 found!\n", __FUNCTION__);
goto error_out;

mch...@infradead.org

unread,
Mar 20, 2006, 11:10:14 AM3/20/06
to
From: Mauro Carvalho Chehab <mch...@infradead.org>
Date: 1141009729 -0300

Added a new function that allows printing ioctl arguments.
This makes easier to include debug code under v4l ioctl
handling.
Also fixed some declarations on internal ioctl.

Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c
index cd2c447..a241bf7 100644
--- a/drivers/media/video/v4l2-common.c
+++ b/drivers/media/video/v4l2-common.c
@@ -362,6 +362,529 @@ void v4l_printk_ioctl(unsigned int cmd)
}
}

+/* Common ioctl debug function. This function can be used by
+ external ioctl messages as well as internal V4L ioctl and its
+ arguments */
+void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
+{
+ printk(s);
+ printk(": ");
+ v4l_printk_ioctl(cmd);
+ switch (cmd) {
+ case VIDIOC_INT_G_CHIP_IDENT:
+ {
+ enum v4l2_chip_ident *p=arg;
+ printk ("%s: chip ident=%d\n", s, *p);
+ break;
+ }
+ case VIDIOC_G_PRIORITY:
+ case VIDIOC_S_PRIORITY:
+ {
+ enum v4l2_priority *p=arg;
+ printk ("%s: priority=%d\n", s, *p);
+ break;
+ }
+ case VIDIOC_INT_S_TUNER_MODE:
+ {
+ enum v4l2_tuner_type *p=arg;
+ printk ("%s: tuner type=%d\n", s, *p);
+ break;
+ }
+ case DECODER_SET_VBI_BYPASS:
+ case DECODER_ENABLE_OUTPUT:
+ case DECODER_GET_STATUS:
+ case DECODER_SET_OUTPUT:
+ case DECODER_SET_INPUT:
+ case DECODER_SET_GPIO:
+ case DECODER_SET_NORM:
+ case VIDIOCCAPTURE:
+ case VIDIOCSYNC:
+ case VIDIOCSWRITEMODE:
+ case TUNER_SET_TYPE_ADDR:
+ case TUNER_SET_STANDBY:
+ case TDA9887_SET_CONFIG:
+ case AUDC_SET_INPUT:
+ case VIDIOC_OVERLAY_OLD:
+ case VIDIOC_STREAMOFF:
+ case VIDIOC_G_OUTPUT:
+ case VIDIOC_S_OUTPUT:
+ case VIDIOC_STREAMON:
+ case VIDIOC_G_INPUT:
+ case VIDIOC_OVERLAY:
+ case VIDIOC_S_INPUT:
+ {
+ int *p=arg;
+ printk ("%s: value=%d\n", s, *p);
+ break;
+ }
+ case MSP_SET_MATRIX:
+ {
+ struct msp_matrix *p=arg;
+ printk ("%s: input=%d, output=%d\n", s, p->input, p->output);
+ break;
+ }
+ case VIDIOC_G_AUDIO:
+ case VIDIOC_S_AUDIO:
+ case VIDIOC_ENUMAUDIO:
+ case VIDIOC_G_AUDIO_OLD:
+ {
+ struct v4l2_audio *p=arg;
+
+ printk ("%s: index=%d, name=%s, capability=%d, mode=%d\n",
+ s,p->index, p->name,p->capability, p->mode);
+ break;
+ }
+ case VIDIOC_G_AUDOUT:
+ case VIDIOC_S_AUDOUT:
+ case VIDIOC_ENUMAUDOUT:
+ case VIDIOC_G_AUDOUT_OLD:
+ {
+ struct v4l2_audioout *p=arg;
+ printk ("%s: index=%d, name=%s, capability=%d, mode=%d\n", s,
+ p->index, p->name, p->capability,p->mode);
+ break;
+ }
+ case VIDIOC_QBUF:
+ case VIDIOC_DQBUF:
+ case VIDIOC_QUERYBUF:
+ {
+ struct v4l2_buffer *p=arg;
+ struct v4l2_timecode *tc=&p->timecode;
+ printk ("%s: %02ld:%02d:%02d.%08ld index=%d, type=%d, "
+ "bytesused=%d, flags=0x%08d, "
+ "field=%0d, sequence=%d, memory=%d, offset/userptr=0x%08lx,",
+ s,
+ (p->timestamp.tv_sec/3600),
+ (int)(p->timestamp.tv_sec/60)%60,
+ (int)(p->timestamp.tv_sec%60),
+ p->timestamp.tv_usec,
+ p->index,p->type,p->bytesused,p->flags,
+ p->field,p->sequence,p->memory,p->m.userptr);
+ printk ("%s: timecode= %02d:%02d:%02d type=%d, "
+ "flags=0x%08d, frames=%d, userbits=0x%08x",
+ s,tc->hours,tc->minutes,tc->seconds,
+ tc->type, tc->flags, tc->frames, (__u32) tc->userbits);
+ break;
+ }
+ case VIDIOC_QUERYCAP:
+ {
+ struct v4l2_capability *p=arg;
+ printk ("%s: driver=%s, card=%s, bus=%s, version=%d, "
+ "capabilities=%d\n", s,
+ p->driver,p->card,p->bus_info,
+ p->version,
+ p->capabilities);
+ break;
+ }
+ case VIDIOC_G_CTRL:
+ case VIDIOC_S_CTRL:
+ case VIDIOC_S_CTRL_OLD:
+ {
+ struct v4l2_control *p=arg;
+ printk ("%s: id=%d, value=%d\n", s, p->id, p->value);
+ break;
+ }
+ case VIDIOC_G_CROP:
+ case VIDIOC_S_CROP:
+ {
+ struct v4l2_crop *p=arg;
+ /*FIXME: Should also show rect structs */
+ printk ("%s: type=%d\n", s, p->type);
+ break;
+ }
+ case VIDIOC_CROPCAP:
+ case VIDIOC_CROPCAP_OLD:
+ {
+ struct v4l2_cropcap *p=arg;
+ /*FIXME: Should also show rect structs */
+ printk ("%s: type=%d\n", s, p->type);
+ break;
+ }
+ case VIDIOC_INT_DECODE_VBI_LINE:
+ {
+ struct v4l2_decode_vbi_line *p=arg;
+ printk ("%s: is_second_field=%d, ptr=0x%08lx, line=%d, "
+ "type=%d\n", s,
+ p->is_second_field,(unsigned long)p->p,p->line,p->type);
+ break;
+ }
+ case VIDIOC_ENUM_FMT:
+ {
+ struct v4l2_fmtdesc *p=arg;
+ printk ("%s: index=%d, type=%d, flags=%d, description=%s,"
+ " pixelformat=%d\n", s,
+ p->index, p->type, p->flags,p->description,
+ p->pixelformat);


+
+ break;
+ }
+ case VIDIOC_G_FMT:

+ case VIDIOC_S_FMT:
+ case VIDIOC_TRY_FMT:
+ {
+ struct v4l2_format *p=arg;
+ /* FIXME: Should be one dump per type*/
+ printk ("%s: type=%d\n", s,p->type);
+ break;
+ }
+ case VIDIOC_G_FBUF:
+ case VIDIOC_S_FBUF:
+ {
+ struct v4l2_framebuffer *p=arg;
+ /*FIXME: should show also struct v4l2_pix_format p->fmt field */
+ printk ("%s: capability=%d, flags=%d, base=0x%08lx\n", s,
+ p->capability,p->flags, (unsigned long)p->base);
+ break;
+ }
+ case VIDIOC_G_FREQUENCY:
+ case VIDIOC_S_FREQUENCY:
+ {
+ struct v4l2_frequency *p=arg;
+ printk ("%s: tuner=%d, type=%d, frequency=%d\n", s,
+ p->tuner,p->type,p->frequency);
+ break;
+ }
+ case VIDIOC_ENUMINPUT:
+ {
+ struct v4l2_input *p=arg;
+ printk ("%s: index=%d, name=%s, type=%d, audioset=%d, "
+ "tuner=%d, std=%lld, status=%d\n", s,
+ p->index,p->name,p->type,p->audioset,
+ p->tuner,p->std,
+ p->status);
+ break;
+ }
+ case VIDIOC_G_JPEGCOMP:
+ case VIDIOC_S_JPEGCOMP:
+ {
+ struct v4l2_jpegcompression *p=arg;
+ printk ("%s: quality=%d, APPn=%d, APP_len=%d, COM_len=%d,"
+ " jpeg_markers=%d\n", s,
+ p->quality,p->APPn,p->APP_len,
+ p->COM_len,p->jpeg_markers);
+ break;
+ }
+ case VIDIOC_G_MODULATOR:
+ case VIDIOC_S_MODULATOR:
+ {
+ struct v4l2_modulator *p=arg;
+ printk ("%s: index=%d, name=%s, capability=%d, rangelow=%d,"
+ " rangehigh=%d, txsubchans=%d\n", s,
+ p->index, p->name,p->capability,p->rangelow,
+ p->rangehigh,p->txsubchans);
+ break;
+ }
+ case VIDIOC_G_MPEGCOMP:
+ case VIDIOC_S_MPEGCOMP:
+ {
+ struct v4l2_mpeg_compression *p=arg;
+ /*FIXME: Several fields not shown */
+ printk ("%s: ts_pid_pmt=%d, ts_pid_audio=%d, ts_pid_video=%d, "
+ "ts_pid_pcr=%d, ps_size=%d, au_sample_rate=%d, "
+ "au_pesid=%c, vi_frame_rate=%d, vi_frames_per_gop=%d, "
+ "vi_bframes_count=%d, vi_pesid=%c\n", s,
+ p->ts_pid_pmt,p->ts_pid_audio, p->ts_pid_video,
+ p->ts_pid_pcr, p->ps_size, p->au_sample_rate,
+ p->au_pesid, p->vi_frame_rate,
+ p->vi_frames_per_gop, p->vi_bframes_count,
+ p->vi_pesid);
+ break;
+ }
+ case VIDIOC_ENUMOUTPUT:
+ {
+ struct v4l2_output *p=arg;
+ printk ("%s: index=%d, name=%s,type=%d, audioset=%d, "
+ "modulator=%d, std=%lld\n",
+ s,p->index,p->name,p->type,p->audioset,
+ p->modulator,p->std);
+ break;
+ }
+ case VIDIOC_QUERYCTRL:
+ {
+ struct v4l2_queryctrl *p=arg;
+ printk ("%s: id=%d, type=%d, name=%s, min/max=%d/%d,"
+ " step=%d, default=%d, flags=0x%08x\n", s,
+ p->id,p->type,p->name,p->minimum,p->maximum,
+ p->step,p->default_value,p->flags);
+ break;
+ }
+ case VIDIOC_QUERYMENU:
+ {
+ struct v4l2_querymenu *p=arg;
+ printk ("%s: id=%d, index=%d, name=%s\n", s,
+ p->id,p->index,p->name);
+ break;
+ }
+ case VIDIOC_INT_G_REGISTER:
+ case VIDIOC_INT_S_REGISTER:
+ {
+ struct v4l2_register *p=arg;
+ printk ("%s: i2c_id=%d, reg=%lu, val=%d\n", s,
+ p->i2c_id,p->reg,p->val);
+
+ break;
+ }
+ case VIDIOC_REQBUFS:
+ {
+ struct v4l2_requestbuffers *p=arg;
+ printk ("%s: count=%d, type=%d, memory=%d\n", s,
+ p->count,p->type,p->memory);
+ break;
+ }
+ case VIDIOC_INT_S_AUDIO_ROUTING:
+ case VIDIOC_INT_S_VIDEO_ROUTING:
+ case VIDIOC_INT_G_AUDIO_ROUTING:
+ case VIDIOC_INT_G_VIDEO_ROUTING:
+ {
+ struct v4l2_routing *p=arg;
+ printk ("%s: input=%d, output=%d\n", s, p->input, p->output);
+ break;
+ }
+ case VIDIOC_G_SLICED_VBI_CAP:
+ {
+ struct v4l2_sliced_vbi_cap *p=arg;
+ printk ("%s: service_set=%d\n", s,
+ p->service_set);
+ break;
+ }
+ case VIDIOC_INT_S_VBI_DATA:
+ case VIDIOC_INT_G_VBI_DATA:
+ {
+ struct v4l2_sliced_vbi_data *p=arg;
+ printk ("%s: id=%d, field=%d, line=%d\n", s,
+ p->id, p->field, p->line);
+ break;
+ }
+ case VIDIOC_ENUMSTD:
+ {
+ struct v4l2_standard *p=arg;
+ printk ("%s: index=%d, id=%lld, name=%s, fps=%d/%d, framelines=%d\n", s,
+ p->index, p->id, p->name,
+ p->frameperiod.numerator,
+ p->frameperiod.denominator,
+ p->framelines);
+
+ break;
+ }
+ case VIDIOC_G_PARM:
+ case VIDIOC_S_PARM:
+ case VIDIOC_S_PARM_OLD:
+ {
+ struct v4l2_streamparm *p=arg;
+ printk ("%s: type=%d\n", s, p->type);
+
+ break;
+ }
+ case VIDIOC_G_TUNER:
+ case VIDIOC_S_TUNER:
+ {
+ struct v4l2_tuner *p=arg;
+ printk ("%s: index=%d, name=%s, type=%d, capability=%d, "
+ "rangelow=%d, rangehigh=%d, signal=%d, afc=%d, "
+ "rxsubchans=%d, audmode=%d\n", s,
+ p->index, p->name, p->type,
+ p->capability, p->rangelow,p->rangehigh,
+ p->rxsubchans, p->audmode, p->signal,
+ p->afc);
+ break;
+ }
+ case VIDIOCGVBIFMT:
+ case VIDIOCSVBIFMT:
+ {
+ struct vbi_format *p=arg;
+ printk ("%s: sampling_rate=%d, samples_per_line=%d, "
+ "sample_format=%d, start=%d/%d, count=%d/%d, flags=%d\n", s,
+ p->sampling_rate,p->samples_per_line,
+ p->sample_format,p->start[0],p->start[1],
+ p->count[0],p->count[1],p->flags);
+ break;
+ }
+ case VIDIOCGAUDIO:
+ case VIDIOCSAUDIO:
+ {
+ struct video_audio *p=arg;
+ printk ("%s: audio=%d, volume=%d, bass=%d, treble=%d, "
+ "flags=%d, name=%s, mode=%d, balance=%d, step=%d\n",
+ s,p->audio,p->volume,p->bass, p->treble,
+ p->flags,p->name,p->mode,p->balance,p->step);
+ break;
+ }
+ case VIDIOCGFBUF:
+ case VIDIOCSFBUF:
+ {
+ struct video_buffer *p=arg;
+ printk ("%s: base=%08lx, height=%d, width=%d, depth=%d, "
+ "bytesperline=%d\n", s,
+ (unsigned long) p->base, p->height, p->width,
+ p->depth,p->bytesperline);
+ break;
+ }
+ case VIDIOCGCAP:
+ {
+ struct video_capability *p=arg;
+ printk ("%s: name=%s, type=%d, channels=%d, audios=%d, "
+ "maxwidth=%d, maxheight=%d, minwidth=%d, minheight=%d\n",
+ s,p->name,p->type,p->channels,p->audios,
+ p->maxwidth,p->maxheight,p->minwidth,
+ p->minheight);
+
+ break;
+ }
+ case VIDIOCGCAPTURE:
+ case VIDIOCSCAPTURE:
+ {
+ struct video_capture *p=arg;
+ printk ("%s: x=%d, y=%d, width=%d, height=%d, decimation=%d,"
+ " flags=%d\n", s,
+ p->x, p->y,p->width, p->height,
+ p->decimation,p->flags);
+ break;
+ }
+ case VIDIOCGCHAN:
+ case VIDIOCSCHAN:
+ {
+ struct video_channel *p=arg;
+ printk ("%s: channel=%d, name=%s, tuners=%d, flags=%d, "
+ "type=%d, norm=%d\n", s,
+ p->channel,p->name,p->tuners,
+ p->flags,p->type,p->norm);
+
+ break;
+ }
+ case VIDIOCSMICROCODE:
+ {
+ struct video_code *p=arg;
+ printk ("%s: loadwhat=%s, datasize=%d\n", s,
+ p->loadwhat,p->datasize);
+ break;
+ }
+ case DECODER_GET_CAPABILITIES:
+ {
+ struct video_decoder_capability *p=arg;
+ printk ("%s: flags=%d, inputs=%d, outputs=%d\n", s,
+ p->flags,p->inputs,p->outputs);
+ break;
+ }
+ case DECODER_INIT:
+ {
+ struct video_decoder_init *p=arg;
+ printk ("%s: len=%c\n", s, p->len);
+ break;
+ }
+ case VIDIOCGPLAYINFO:
+ {
+ struct video_info *p=arg;
+ printk ("%s: frame_count=%d, h_size=%d, v_size=%d, "
+ "smpte_timecode=%d, picture_type=%d, "
+ "temporal_reference=%d, user_data=%s\n", s,
+ p->frame_count, p->h_size,
+ p->v_size, p->smpte_timecode,
+ p->picture_type, p->temporal_reference,
+ p->user_data);
+ break;
+ }
+ case VIDIOCKEY:
+ {
+ struct video_key *p=arg;
+ printk ("%s: key=%s, flags=%d\n", s,
+ p->key, p->flags);
+ break;
+ }
+ case VIDIOCGMBUF:
+ {
+ struct video_mbuf *p=arg;
+ printk ("%s: size=%d, frames=%d, offsets=0x%08lx\n", s,
+ p->size,
+ p->frames,
+ (unsigned long)p->offsets);
+ break;
+ }
+ case VIDIOCMCAPTURE:
+ {
+ struct video_mmap *p=arg;
+ printk ("%s: frame=%d, height=%d, width=%d, format=%d\n", s,
+ p->frame,
+ p->height, p->width,
+ p->format);
+ break;
+ }
+ case VIDIOCGPICT:
+ case VIDIOCSPICT:
+ case DECODER_SET_PICTURE:
+ {
+ struct video_picture *p=arg;
+
+ printk ("%s: brightness=%d, hue=%d, colour=%d, contrast=%d,"
+ " whiteness=%d, depth=%d, palette=%d\n", s,
+ p->brightness, p->hue, p->colour,
+ p->contrast, p->whiteness, p->depth,
+ p->palette);
+ break;
+ }
+ case VIDIOCSPLAYMODE:
+ {
+ struct video_play_mode *p=arg;
+ printk ("%s: mode=%d, p1=%d, p2=%d\n", s,
+ p->mode,p->p1,p->p2);
+ break;
+ }
+ case VIDIOCGTUNER:
+ case VIDIOCSTUNER:
+ {
+ struct video_tuner *p=arg;
+ printk ("%s: tuner=%d, name=%s, rangelow=%ld, rangehigh=%ld, "
+ "flags=%d, mode=%d, signal=%d\n", s,
+ p->tuner, p->name,p->rangelow, p->rangehigh,
+ p->flags,p->mode, p->signal);
+ break;
+ }
+ case VIDIOCGUNIT:
+ {
+ struct video_unit *p=arg;
+ printk ("%s: video=%d, vbi=%d, radio=%d, audio=%d, "
+ "teletext=%d\n", s,
+ p->video,p->vbi,p->radio,p->audio,p->teletext);
+ break;
+ }
+ case VIDIOCGWIN:
+ case VIDIOCSWIN:
+ {
+ struct video_window *p=arg;
+ printk ("%s: x=%d, y=%d, width=%d, height=%d, chromakey=%d,"
+ " flags=%d, clipcount=%d\n", s,
+ p->x, p->y,p->width, p->height,
+ p->chromakey,p->flags,
+ p->clipcount);
+ break;
+ }
+ case VIDIOC_INT_AUDIO_CLOCK_FREQ:
+ case VIDIOC_INT_I2S_CLOCK_FREQ:
+ case VIDIOC_INT_S_STANDBY:
+ {
+ u32 *p=arg;
+
+ printk ("%s: value=%d\n", s, *p);
+ break;
+ }
+ case VIDIOCGFREQ:
+ case VIDIOCSFREQ:
+ {
+ unsigned long *p=arg;
+ printk ("%s: value=%lu\n", s, *p);
+ break;
+ }
+ case VIDIOC_G_STD:
+ case VIDIOC_S_STD:
+ case VIDIOC_QUERYSTD:
+ {
+ v4l2_std_id *p=arg;
+
+ printk ("%s: value=%llu\n", s, *p);


+ break;
+ }
+ }
+}
+

/* ----------------------------------------------------------------- */

EXPORT_SYMBOL(v4l2_video_std_construct);
@@ -376,6 +899,7 @@ EXPORT_SYMBOL(v4l2_prio_check);
EXPORT_SYMBOL(v4l2_field_names);
EXPORT_SYMBOL(v4l2_type_names);
EXPORT_SYMBOL(v4l_printk_ioctl);
+EXPORT_SYMBOL(v4l_printk_ioctl_arg);

/*
* Local variables:


diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h

index 234e9cf..c44741e 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -58,6 +58,9 @@
/* Prints the ioctl in a human-readable format */
extern void v4l_printk_ioctl(unsigned int cmd);

+/* Prints the ioctl and arg in a human-readable format */
+extern void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg);
+
/* Use this macro for non-I2C drivers. Pass the driver name as the first arg. */
#define v4l_print_ioctl(name, cmd) \
do { \
@@ -185,11 +188,11 @@ struct msp_matrix {
register contains invalid or erroneous data -EIO is returned. Note that
you must fill in the 'id' member and the 'field' member (to determine
whether CC data from the first or second field should be obtained). */
-#define VIDIOC_INT_G_VBI_DATA _IOWR('d', 106, struct v4l2_sliced_vbi_data *)
+#define VIDIOC_INT_G_VBI_DATA _IOWR('d', 106, struct v4l2_sliced_vbi_data)

/* Returns the chip identifier or V4L2_IDENT_UNKNOWN if no identification can
be made. */
-#define VIDIOC_INT_G_CHIP_IDENT _IOR ('d', 107, enum v4l2_chip_ident *)
+#define VIDIOC_INT_G_CHIP_IDENT _IOR ('d', 107, enum v4l2_chip_ident)

/* Sets I2S speed in bps. This is used to provide a standard way to select I2S
clock used by driving digital audio streams at some board designs.
@@ -214,8 +217,8 @@ struct v4l2_routing {
These four commands should only be sent directly to an i2c device, they
should not be broadcast as the routing is very device specific. */
#define VIDIOC_INT_S_AUDIO_ROUTING _IOW ('d', 109, struct v4l2_routing)
-#define VIDIOC_INT_G_AUDIO_ROUTING _IOR ('d', 110, struct v4l2_routing *)
+#define VIDIOC_INT_G_AUDIO_ROUTING _IOR ('d', 110, struct v4l2_routing)
#define VIDIOC_INT_S_VIDEO_ROUTING _IOW ('d', 111, struct v4l2_routing)
-#define VIDIOC_INT_G_VIDEO_ROUTING _IOR ('d', 112, struct v4l2_routing *)
+#define VIDIOC_INT_G_VIDEO_ROUTING _IOR ('d', 112, struct v4l2_routing)

#endif /* V4L2_COMMON_H_ */

mch...@infradead.org

unread,
Mar 20, 2006, 11:10:14 AM3/20/06
to
From: Hartmut Hackmann <hartmut....@t-online.de>
Date: 1141398566 -0300

- fixed tda9886 port 2 setting
- turned remote control receiver off via saa7134 GPIO to avoid i2c hangs
- modified tda9886 client calls to direct i2c access to allow proper return
to analog mode
- allow mode change to V4L2_TUNER_DIGITAL_TV in tuner VIDIOC_S_FREQUENCY
client call

Signed-off-by: Hartmut Hackmann <hartmut....@t-online.de>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
index ccf7231..722ebff 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -1003,7 +1003,7 @@ struct saa7134_board saa7134_boards[] =
.radio_type = UNSET,
.tuner_addr = ADDR_UNSET,
.radio_addr = ADDR_UNSET,
- .tda9887_conf = TDA9887_PRESENT | TDA9887_INTERCARRIER | TDA9887_PORT2_ACTIVE,
+ .tda9887_conf = TDA9887_PRESENT | TDA9887_INTERCARRIER | TDA9887_PORT2_INACTIVE,
.inputs = {{
.name = name_tv,
.vmux = 3,
@@ -1692,7 +1692,7 @@ struct saa7134_board saa7134_boards[] =
.radio_type = UNSET,
.tuner_addr = ADDR_UNSET,
.radio_addr = ADDR_UNSET,
- .tda9887_conf = TDA9887_PRESENT | TDA9887_INTERCARRIER | TDA9887_PORT2_ACTIVE,
+ .tda9887_conf = TDA9887_PRESENT | TDA9887_INTERCARRIER | TDA9887_PORT2_INACTIVE,
.mpeg = SAA7134_MPEG_DVB,
.inputs = {{
.name = name_tv,
@@ -3375,6 +3375,11 @@ int saa7134_board_init1(struct saa7134_d


/* power-up tuner chip */

saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x00040000, 0x00040000);
saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x00040000, 0x00000000);
+ case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL:
+ /* this turns the remote control chip off to work around a bug in it */
+ saa_writeb(SAA7134_GPIO_GPMODE1, 0x80);
+ saa_writeb(SAA7134_GPIO_GPSTATUS1, 0x80);
+ break;
case SAA7134_BOARD_MONSTERTV_MOBILE:


/* power-up tuner chip */

saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x00040000, 0x00040000);


diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c

index 7577962..5969481 100644
--- a/drivers/media/video/saa7134/saa7134-dvb.c
+++ b/drivers/media/video/saa7134/saa7134-dvb.c
@@ -110,6 +110,7 @@ static int mt352_pinnacle_init(struct dv
mt352_write(fe, fsm_ctl_cfg, sizeof(fsm_ctl_cfg));
mt352_write(fe, scan_ctl_cfg, sizeof(scan_ctl_cfg));
mt352_write(fe, irq_cfg, sizeof(irq_cfg));
+
return 0;
}

@@ -135,8 +136,10 @@ static int mt352_pinnacle_pll_set(struct
struct dvb_frontend_parameters* params,
u8* pllbuf)
{
- static int on = TDA9887_PRESENT | TDA9887_PORT2_INACTIVE;
- static int off = TDA9887_PRESENT | TDA9887_PORT2_ACTIVE;
+ u8 off[] = { 0x00, 0xf1};
+ u8 on[] = { 0x00, 0x71};
+ struct i2c_msg msg = {.addr=0x43, .flags=0, .buf=off, .len = sizeof(off)};


+
struct saa7134_dev *dev = fe->dvb->priv;

struct v4l2_frequency f;

@@ -144,9 +147,10 @@ static int mt352_pinnacle_pll_set(struct
f.tuner = 0;
f.type = V4L2_TUNER_DIGITAL_TV;
f.frequency = params->frequency / 1000 * 16 / 1000;
- saa7134_i2c_call_clients(dev,TDA9887_SET_CONFIG,&on);


+ i2c_transfer(&dev->i2c_adap, &msg, 1);

saa7134_i2c_call_clients(dev,VIDIOC_S_FREQUENCY,&f);
- saa7134_i2c_call_clients(dev,TDA9887_SET_CONFIG,&off);
+ msg.buf = on;


+ i2c_transfer(&dev->i2c_adap, &msg, 1);

pinnacle_antenna_pwr(dev, antenna_pwr);



diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c

index 3964244..32e1849 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -713,8 +713,9 @@ static int tuner_command(struct i2c_clie
struct v4l2_frequency *f = arg;

switch_v4l2();
- if (V4L2_TUNER_RADIO == f->type &&
- V4L2_TUNER_RADIO != t->mode) {
+ if ((V4L2_TUNER_RADIO == f->type && V4L2_TUNER_RADIO != t->mode)
+ || (V4L2_TUNER_DIGITAL_TV == f->type
+ && V4L2_TUNER_DIGITAL_TV != t->mode)) {
if (set_mode (client, t, f->type, "VIDIOC_S_FREQUENCY")
== EINVAL)
return 0;

mch...@infradead.org

unread,
Mar 20, 2006, 11:10:15 AM3/20/06
to
From: Michael Krufky <mkr...@linuxtv.org>
Date: 1139300740 -0200

With tuner_debug enabled, if a tuner tries to use a video standard that doesn't
have a matching tuner_params defined, the IFPCoff value and tuner number will
be displayed, and the default tuner_params entry will be used.

Signed-off-by: Michael Krufky <mkr...@linuxtv.org>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c
diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c
index 61dd26a..aba0688 100644
--- a/drivers/media/video/tuner-simple.c
+++ b/drivers/media/video/tuner-simple.c
@@ -164,8 +164,11 @@ static void default_set_tv_freq(struct i
break;
}
/* use default tuner_params if desired_type not available */
- if (desired_type != tun->params[j].type)
+ if (desired_type != tun->params[j].type) {
+ tuner_dbg("IFPCoff = %d: tuner_params undefined for tuner %d\n",
+ IFPCoff,t->type);
j = 0;
+ }

for (i = 0; i < tun->params[j].count; i++) {
if (freq > tun->params[j].ranges[i].limit)

mch...@infradead.org

unread,
Mar 20, 2006, 11:10:15 AM3/20/06
to
From: Hartmut Hackmann <hartmut....@t-online.de>
Date: 1139302149 -0200

This patch
- works around a bug in the I2C bridge that makes the initialization
of the TDA10046 fail on recent LifeView cards
- puts the AGC output to tristate in sleep mode. This is necessary for
recent hybrid cards that switch the AGC via tristateing.

Signed-off-by: Hartmut Hackmann<hartmut....@t-online.de>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/video/tda8290.c b/drivers/media/video/tda8290.c
diff --git a/drivers/media/video/tda8290.c b/drivers/media/video/tda8290.c
index 7b4fb28..2b954b3 100644
--- a/drivers/media/video/tda8290.c
+++ b/drivers/media/video/tda8290.c
@@ -281,7 +281,7 @@ static void tda827xa_agcf(struct i2c_cli
static void tda8290_i2c_bridge(struct i2c_client *c, int close)
{
unsigned char enable[2] = { 0x21, 0xC0 };
- unsigned char disable[2] = { 0x21, 0x80 };
+ unsigned char disable[2] = { 0x21, 0x00 };
unsigned char *msg;
if(close) {
msg = enable;
@@ -302,6 +302,7 @@ static int tda8290_tune(struct i2c_clien
unsigned char soft_reset[] = { 0x00, 0x00 };
unsigned char easy_mode[] = { 0x01, t->tda8290_easy_mode };
unsigned char expert_mode[] = { 0x01, 0x80 };
+ unsigned char agc_out_on[] = { 0x02, 0x00 };
unsigned char gainset_off[] = { 0x28, 0x14 };
unsigned char if_agc_spd[] = { 0x0f, 0x88 };
unsigned char adc_head_6[] = { 0x05, 0x04 };
@@ -320,6 +321,7 @@ static int tda8290_tune(struct i2c_clien
pll_stat;

i2c_master_send(c, easy_mode, 2);
+ i2c_master_send(c, agc_out_on, 2);
i2c_master_send(c, soft_reset, 2);
msleep(1);

@@ -470,6 +472,7 @@ static void standby(struct i2c_client *c
struct tuner *t = i2c_get_clientdata(c);
unsigned char cb1[] = { 0x30, 0xD0 };
unsigned char tda8290_standby[] = { 0x00, 0x02 };
+ unsigned char tda8290_agc_tri[] = { 0x02, 0x20 };
struct i2c_msg msg = {.addr = t->tda827x_addr, .flags=0, .buf=cb1, .len = 2};

tda8290_i2c_bridge(c, 1);
@@ -477,6 +480,7 @@ static void standby(struct i2c_client *c
cb1[1] = 0x90;
i2c_transfer(c->adapter, &msg, 1);
tda8290_i2c_bridge(c, 0);
+ i2c_master_send(c, tda8290_agc_tri, 2);
i2c_master_send(c, tda8290_standby, 2);
}

@@ -565,7 +569,7 @@ int tda8290_init(struct i2c_client *c)
strlcpy(c->name, "tda8290+75a", sizeof(c->name));
t->tda827x_ver = 2;
}
- tuner_info("tuner: type set to %s\n", c->name);
+ tuner_info("type set to %s\n", c->name);

t->set_tv_freq = set_tv_freq;
t->set_radio_freq = set_radio_freq;

mch...@infradead.org

unread,
Mar 20, 2006, 11:10:16 AM3/20/06
to
From: Mauro Carvalho Chehab <mch...@infradead.org>
Date: 1138043465 -0200

- Added other sliced VBI types to videodev2.h
- tvp5150 now uses standard V4L2 API codes from videodev2.h
- Implemented VIDIOC_G_SLICED_VBI_CAP for tvp5150. This is
dynamically filled based on defined VDP C-RAM values filled
by the driver.

Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/video/cx25840/cx25840-vbi.c b/drivers/media/video/cx25840/cx25840-vbi.c
diff --git a/drivers/media/video/cx25840/cx25840-vbi.c b/drivers/media/video/cx25840/cx25840-vbi.c
index 04d879d..e96fd1f 100644
--- a/drivers/media/video/cx25840/cx25840-vbi.c
+++ b/drivers/media/video/cx25840/cx25840-vbi.c
@@ -151,7 +151,7 @@ int cx25840_vbi(struct i2c_client *clien
case VIDIOC_G_FMT:
{
static u16 lcr2vbi[] = {
- 0, V4L2_SLICED_TELETEXT_B, 0, /* 1 */
+ 0, V4L2_SLICED_TELETEXT_PAL_B, 0, /* 1 */
0, V4L2_SLICED_WSS_625, 0, /* 4 */
V4L2_SLICED_CAPTION_525, /* 6 */
0, 0, V4L2_SLICED_VPS, 0, 0, /* 9 */
@@ -231,7 +231,7 @@ int cx25840_vbi(struct i2c_client *clien
for (i = 7; i <= 23; i++) {
for (x = 0; x <= 1; x++) {
switch (svbi->service_lines[1-x][i]) {
- case V4L2_SLICED_TELETEXT_B:
+ case V4L2_SLICED_TELETEXT_PAL_B:
lcr[i] |= 1 << (4 * x);
break;
case V4L2_SLICED_WSS_625:
@@ -282,7 +282,7 @@ int cx25840_vbi(struct i2c_client *clien

switch (id2) {
case 1:
- id2 = V4L2_SLICED_TELETEXT_B;
+ id2 = V4L2_SLICED_TELETEXT_PAL_B;
break;
case 4:
id2 = V4L2_SLICED_WSS_625;
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c
index 048d000..487a429 100644
--- a/drivers/media/video/saa7115.c
+++ b/drivers/media/video/saa7115.c
@@ -791,7 +791,7 @@ static void saa7115_set_lcr(struct i2c_c
case 0:
lcr[i] |= 0xf << (4 * x);
break;
- case V4L2_SLICED_TELETEXT_B:
+ case V4L2_SLICED_TELETEXT_PAL_B:
lcr[i] |= 1 << (4 * x);
break;
case V4L2_SLICED_CAPTION_525:
@@ -820,7 +820,7 @@ static void saa7115_set_lcr(struct i2c_c
static int saa7115_get_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt)
{
static u16 lcr2vbi[] = {
- 0, V4L2_SLICED_TELETEXT_B, 0, /* 1 */
+ 0, V4L2_SLICED_TELETEXT_PAL_B, 0, /* 1 */
0, V4L2_SLICED_CAPTION_525, /* 4 */
V4L2_SLICED_WSS_625, 0, /* 5 */
V4L2_SLICED_VPS, 0, 0, 0, 0, /* 7 */
@@ -985,7 +985,7 @@ static void saa7115_decode_vbi_line(stru
/* decode payloads */
switch (id2) {
case 1:
- vbi->type = V4L2_SLICED_TELETEXT_B;
+ vbi->type = V4L2_SLICED_TELETEXT_PAL_B;
break;
case 4:
if (!saa7115_odd_parity(p[0]) || !saa7115_odd_parity(p[1]))


diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c
diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c

index f7fa93c..17a8dd7 100644
--- a/drivers/media/video/tvp5150.c
+++ b/drivers/media/video/tvp5150.c
@@ -1,8 +1,8 @@
/*
- * tvp5150 - Texas Instruments TVP5150A(M) video decoder driver
+ * tvp5150 - Texas Instruments TVP5150A/AM1 video decoder driver
*
- * Copyright (c) 2005 Mauro Carvalho Chehab (mch...@brturbo.com.br)
- * This code is placed under the terms of the GNU General Public License
+ * Copyright (c) 2005,2006 Mauro Carvalho Chehab (mch...@infradead.org)
+ * This code is placed under the terms of the GNU General Public License v2
*/

#include <linux/i2c.h>
@@ -13,10 +13,11 @@

#include "tvp5150_reg.h"

-MODULE_DESCRIPTION("Texas Instruments TVP5150A video decoder driver"); /* standard i2c insmod options */
+MODULE_DESCRIPTION("Texas Instruments TVP5150A video decoder driver");
MODULE_AUTHOR("Mauro Carvalho Chehab");
MODULE_LICENSE("GPL");

+/* standard i2c insmod options */
static unsigned short normal_i2c[] = {
0xb8 >> 1,
0xba >> 1,
@@ -477,82 +478,101 @@ static const struct i2c_reg_value tvp515
}
};

+struct tvp5150_vbi_type {
+ unsigned int vbi_type;
+ unsigned int ini_line;
+ unsigned int end_line;
+ unsigned int by_field :1;
+};
+
struct i2c_vbi_ram_value {
u16 reg;
- unsigned char values[26];
+ struct tvp5150_vbi_type type;
+ unsigned char values[16];
};

-/* tvp5150_vbi_types should follow the same order as vbi_ram_default
+/* This struct have the values for each supported VBI Standard
+ * by
+ tvp5150_vbi_types should follow the same order as vbi_ram_default
* value 0 means rom position 0x10, value 1 means rom position 0x30
* and so on. There are 16 possible locations from 0 to 15.
*/
-enum tvp5150_vbi_types { /* Video line number Description */
- VBI_WST_SECAM, /* 6-23 (field 1,2) Teletext, SECAM */
- VBI_WST_PAL_B, /* 6-22 (field 1,2) Teletext, PAL, System B */
- VBI_WST_PAL_C, /* 6-22 (field 1,2) Teletext, PAL, System C */
- VBI_WST_NTSC_B, /* 10-21 (field 1,2) Teletext, NTSC, System B */
- VBI_NABTS_NTSC_C, /* 10-21 (field 1,2) Teletext, NTSC, System C */
- VBI_NABTS_NTSC_D, /* 10-21 (field 1,2) Teletext, NTSC, System D */
- VBI_CC_PAL_SECAM, /* 22 (field 1,2) Closed Caption PAL/SECAM */
- VBI_CC_NTSC, /* 21 (field 1,2) Closed Caption NTSC */
- VBI_WSS_PAL_SECAM, /* 23 (field 1,2) Wide Screen Signal PAL/SECAM */
- VBI_WSS_NTSC, /* 20 (field 1,2) Wide Screen Signal NTSC */
- VBI_VITC_PAL_SECAM, /* 6-22 Vertical Interval Timecode PAL/SECAM */
- VBI_VITC_NTSC, /* 10-20 Vertical Interval Timecode NTSC */
- VBI_VPS_PAL, /* 16 Video Program System PAL */
- VBI_EPG_GEMSTAR, /* EPG/Gemstar Electronic program guide */
- VBI_RESERVED, /* not in use on vbi_ram_default table */
- VBI_FULL_FIELD /* Active video/Full Field */
-};

static struct i2c_vbi_ram_value vbi_ram_default[] =
{
- {0x010, /* WST SECAM */
- { 0xaa, 0xaa, 0xff, 0xff , 0xe7, 0x2e, 0x20, 0x26, 0xe6, 0xb4, 0x0e, 0x0, 0x0, 0x0, 0x10, 0x0 }
- },
- {0x030, /* WST PAL B */
- { 0xaa, 0xaa, 0xff, 0xff , 0x27, 0x2e, 0x20, 0x2b, 0xa6, 0x72, 0x10, 0x0, 0x0, 0x0, 0x10, 0x0 }
- },
- {0x050, /* WST PAL C */
- { 0xaa, 0xaa, 0xff, 0xff , 0xe7, 0x2e, 0x20, 0x22, 0xa6, 0x98, 0x0d, 0x0, 0x0, 0x0, 0x10, 0x0 }
- },
- {0x070, /* WST NTSC B */
- { 0xaa, 0xaa, 0xff, 0xff , 0x27, 0x2e, 0x20, 0x23, 0x69, 0x93, 0x0d, 0x0, 0x0, 0x0, 0x10, 0x0 }
- },
- {0x090, /* NABTS, NTSC */
- { 0xaa, 0xaa, 0xff, 0xff , 0xe7, 0x2e, 0x20, 0x22, 0x69, 0x93, 0x0d, 0x0, 0x0, 0x0, 0x15, 0x0 }
- },
- {0x0b0, /* NABTS, NTSC-J */
- { 0xaa, 0xaa, 0xff, 0xff , 0xa7, 0x2e, 0x20, 0x23, 0x69, 0x93, 0x0d, 0x0, 0x0, 0x0, 0x10, 0x0 }
- },
- {0x0d0, /* CC, PAL/SECAM */
- { 0xaa, 0x2a, 0xff, 0x3f , 0x04, 0x51, 0x6e, 0x02, 0xa6, 0x7b, 0x09, 0x0, 0x0, 0x0, 0x27, 0x0 }
- },
- {0x0f0, /* CC, NTSC */
- { 0xaa, 0x2a, 0xff, 0x3f , 0x04, 0x51, 0x6e, 0x02, 0x69, 0x8c, 0x09, 0x0, 0x0, 0x0, 0x27, 0x0 }
- },
- {0x110, /* WSS, PAL/SECAM */
- { 0x5b, 0x55, 0xc5, 0xff , 0x0, 0x71, 0x6e, 0x42, 0xa6, 0xcd, 0x0f, 0x0, 0x0, 0x0, 0x3a, 0x0 }
- },
- {0x130, /* WSS, NTSC C */
- { 0x38, 0x00, 0x3f, 0x00 , 0x0, 0x71, 0x6e, 0x43, 0x69, 0x7c, 0x08, 0x0, 0x0, 0x0, 0x39, 0x0 }
- },
- {0x150, /* VITC, PAL/SECAM */
- { 0x0, 0x0, 0x0, 0x0 , 0x0, 0x8f, 0x6d, 0x49, 0xa6, 0x85, 0x08, 0x0, 0x0, 0x0, 0x4c, 0x0 }
- },
- {0x170, /* VITC, NTSC */
- { 0x0, 0x0, 0x0, 0x0 , 0x0, 0x8f, 0x6d, 0x49, 0x69, 0x94, 0x08, 0x0, 0x0, 0x0, 0x4c, 0x0 }
- },
- {0x190, /* VPS, PAL */
- { 0xaa, 0xaa, 0xff, 0xff, 0xba, 0xce, 0x2b, 0x0d, 0xa6, 0xda, 0x0b, 0x0, 0x0, 0x0, 0x60, 0x0 }
- },
- {0x1b0, /* Gemstar Custom 1 */
- { 0xcc, 0xcc, 0xff, 0xff, 0x05, 0x51, 0x6e, 0x05, 0x69, 0x19, 0x13, 0x0, 0x0, 0x0, 0x60, 0x0 }
+ {0x010, /* Teletext, SECAM, WST System A */
+ {V4L2_SLICED_TELETEXT_SECAM,6,23,1},
+ { 0xaa, 0xaa, 0xff, 0xff, 0xe7, 0x2e, 0x20, 0x26,
+ 0xe6, 0xb4, 0x0e, 0x00, 0x00, 0x00, 0x10, 0x00 }
+ },
+ {0x030, /* Teletext, PAL, WST System B */
+ {V4L2_SLICED_TELETEXT_PAL_B,6,22,1},
+ { 0xaa, 0xaa, 0xff, 0xff, 0x27, 0x2e, 0x20, 0x2b,
+ 0xa6, 0x72, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00 }
+ },
+ {0x050, /* Teletext, PAL, WST System C */
+ {V4L2_SLICED_TELETEXT_PAL_C,6,22,1},
+ { 0xaa, 0xaa, 0xff, 0xff, 0xe7, 0x2e, 0x20, 0x22,
+ 0xa6, 0x98, 0x0d, 0x00, 0x00, 0x00, 0x10, 0x00 }
+ },
+ {0x070, /* Teletext, NTSC, WST System B */
+ {V4L2_SLICED_TELETEXT_NTSC_B,10,21,1},
+ { 0xaa, 0xaa, 0xff, 0xff, 0x27, 0x2e, 0x20, 0x23,
+ 0x69, 0x93, 0x0d, 0x00, 0x00, 0x00, 0x10, 0x00 }
+ },
+ {0x090, /* Tetetext, NTSC NABTS System C */
+ {V4L2_SLICED_TELETEXT_NTSC_C,10,21,1},
+ { 0xaa, 0xaa, 0xff, 0xff, 0xe7, 0x2e, 0x20, 0x22,
+ 0x69, 0x93, 0x0d, 0x00, 0x00, 0x00, 0x15, 0x00 }
+ },
+ {0x0b0, /* Teletext, NTSC-J, NABTS System D */
+ {V4L2_SLICED_TELETEXT_NTSC_D,10,21,1},
+ { 0xaa, 0xaa, 0xff, 0xff, 0xa7, 0x2e, 0x20, 0x23,
+ 0x69, 0x93, 0x0d, 0x00, 0x00, 0x00, 0x10, 0x00 }
+ },
+ {0x0d0, /* Closed Caption, PAL/SECAM */
+ {V4L2_SLICED_CAPTION_625,22,22,1},
+ { 0xaa, 0x2a, 0xff, 0x3f, 0x04, 0x51, 0x6e, 0x02,
+ 0xa6, 0x7b, 0x09, 0x00, 0x00, 0x00, 0x27, 0x00 }
+ },
+ {0x0f0, /* Closed Caption, NTSC */
+ {V4L2_SLICED_CAPTION_525,21,21,1},
+ { 0xaa, 0x2a, 0xff, 0x3f, 0x04, 0x51, 0x6e, 0x02,
+ 0x69, 0x8c, 0x09, 0x00, 0x00, 0x00, 0x27, 0x00 }
+ },
+ {0x110, /* Wide Screen Signal, PAL/SECAM */
+ {V4L2_SLICED_WSS_625,20,21,1},
+ { 0x5b, 0x55, 0xc5, 0xff, 0x00, 0x71, 0x6e, 0x42,
+ 0xa6, 0xcd, 0x0f, 0x00, 0x00, 0x00, 0x3a, 0x00 }
+ },
+ {0x130, /* Wide Screen Signal, NTSC C */
+ {V4L2_SLICED_WSS_525,20,20,1},
+ { 0x38, 0x00, 0x3f, 0x00, 0x00, 0x71, 0x6e, 0x43,
+ 0x69, 0x7c, 0x08, 0x00, 0x00, 0x00, 0x39, 0x00 }
+ },
+ {0x150, /* Vertical Interval Timecode (VITC), PAL/SECAM */
+ {V4l2_SLICED_VITC_625,6,22,0},
+ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x8f, 0x6d, 0x49,
+ 0xa6, 0x85, 0x08, 0x00, 0x00, 0x00, 0x4c, 0x00 }
+ },
+ {0x170, /* Vertical Interval Timecode (VITC), NTSC */
+ {V4l2_SLICED_VITC_525,10,20,0},
+ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x8f, 0x6d, 0x49,
+ 0x69, 0x94, 0x08, 0x00, 0x00, 0x00, 0x4c, 0x00 }
+ },
+ {0x190, /* Video Program System (VPS), PAL */
+ {V4L2_SLICED_VPS,16,16,0},
+ { 0xaa, 0xaa, 0xff, 0xff, 0xba, 0xce, 0x2b, 0x0d,
+ 0xa6, 0xda, 0x0b, 0x00, 0x00, 0x00, 0x60, 0x00 }
},
+ /* 0x1d0 User programmable */
+
+ /* End of struct */
+ { (u16)-1 }
};

static int tvp5150_write_inittab(struct i2c_client *c,
- const struct i2c_reg_value *regs)
+ const struct i2c_reg_value *regs)
{
while (regs->reg != 0xff) {
tvp5150_write(c, regs->reg, regs->value);
@@ -562,7 +582,7 @@ static int tvp5150_write_inittab(struct
}

static int tvp5150_vdp_init(struct i2c_client *c,
- const struct i2c_vbi_ram_value *regs)
+ const struct i2c_vbi_ram_value *regs)
{
unsigned int i;

@@ -586,6 +606,24 @@ static int tvp5150_vdp_init(struct i2c_c
return 0;
}

+/* Fills VBI capabilities based on i2c_vbi_ram_value struct */
+static void tvp5150_vbi_get_cap(const struct i2c_vbi_ram_value *regs,
+ struct v4l2_sliced_vbi_cap *cap)
+{
+ int line;
+
+ memset(cap, 0, sizeof *cap);
+
+ while (regs->reg != (u16)-1 ) {
+ for (line=regs->type.ini_line;line<=regs->type.end_line;line++) {
+ cap->service_lines[0][line] |= regs->type.vbi_type;
+ }
+ cap->service_set |= regs->type.vbi_type;
+
+ regs++;
+ }
+}
+
/* Set vbi processing
* type - one of tvp5150_vbi_types
* line - line to gather data
@@ -599,7 +637,7 @@ static int tvp5150_vdp_init(struct i2c_c
* LSB = field1
* MSB = field2
*/
-static int tvp5150_set_vbi(struct i2c_client *c, enum tvp5150_vbi_types type,
+static int tvp5150_set_vbi(struct i2c_client *c, unsigned int type,
u8 flags, int line, const int fields)


{
struct tvp5150 *decoder = i2c_get_clientdata(c);

@@ -775,6 +813,15 @@ static int tvp5150_command(struct i2c_cl
*(v4l2_std_id *)arg = decoder->norm;
break;

+ case VIDIOC_G_SLICED_VBI_CAP:
+ {
+ struct v4l2_sliced_vbi_cap *cap = arg;
+ tvp5150_dbg(1, "VIDIOC_G_SLICED_VBI_CAP\n");
+
+ tvp5150_vbi_get_cap(vbi_ram_default, cap);
+ break;
+ }


+
#ifdef CONFIG_VIDEO_ADV_DEBUG
case VIDIOC_INT_G_REGISTER:
{

@@ -1021,7 +1068,7 @@ static int tvp5150_detect_client(struct
return rv;
}

- if (debug > 1)
+// if (debug > 1)
dump_reg(c);
return 0;
}
diff --git a/drivers/media/video/tvp5150_reg.h b/drivers/media/video/tvp5150_reg.h
diff --git a/drivers/media/video/tvp5150_reg.h b/drivers/media/video/tvp5150_reg.h
index c81587e..4240043 100644
--- a/drivers/media/video/tvp5150_reg.h
+++ b/drivers/media/video/tvp5150_reg.h
@@ -1,3 +1,10 @@
+/*
+ * tvp5150 - Texas Instruments TVP5150A/AM1 video decoder registers
+ *
+ * Copyright (c) 2005,2006 Mauro Carvalho Chehab (mch...@infradead.org)
+ * This code is placed under the terms of the GNU General Public License v2
+ */
+
#define TVP5150_VD_IN_SRC_SEL_1 0x00 /* Video input source selection #1 */
#define TVP5150_ANAL_CHL_CTL 0x01 /* Analog channel controls */
#define TVP5150_OP_MODE_CTL 0x02 /* Operation mode controls */
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index ce40675..27ae3d6 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -949,13 +949,50 @@ struct v4l2_sliced_vbi_format
__u32 reserved[2]; /* must be zero */
};

-#define V4L2_SLICED_TELETEXT_B (0x0001)
-#define V4L2_SLICED_VPS (0x0400)
-#define V4L2_SLICED_CAPTION_525 (0x1000)
-#define V4L2_SLICED_WSS_625 (0x4000)
-
-#define V4L2_SLICED_VBI_525 (V4L2_SLICED_CAPTION_525)
-#define V4L2_SLICED_VBI_625 (V4L2_SLICED_TELETEXT_B | V4L2_SLICED_VPS | V4L2_SLICED_WSS_625)
+/* Teletext WST, defined on ITU-R BT.653-2 */
+#define V4L2_SLICED_TELETEXT_PAL_B (0x000001)
+#define V4L2_SLICED_TELETEXT_PAL_C (0x000002)
+#define V4L2_SLICED_TELETEXT_NTSC_B (0x000010)
+#define V4L2_SLICED_TELETEXT_SECAM (0x000020)
+
+/* Teletext NABTS, defined on ITU-R BT.653-2 */
+#define V4L2_SLICED_TELETEXT_NTSC_C (0x000040)
+#define V4L2_SLICED_TELETEXT_NTSC_D (0x000080)
+
+/* Video Program System, defined on ETS 300 231*/
+#define V4L2_SLICED_VPS (0x000400)
+
+/* Closed Caption, defined on EIA-608 */
+#define V4L2_SLICED_CAPTION_525 (0x001000)
+#define V4L2_SLICED_CAPTION_625 (0x002000)
+
+/* Wide Screen System, defined on ITU-R BT1119.1 */
+#define V4L2_SLICED_WSS_625 (0x004000)
+
+/* Wide Screen System, defined on IEC 61880 */
+#define V4L2_SLICED_WSS_525 (0x008000)
+
+/* Vertical Interval Timecode (VITC), defined on SMPTE 12M */
+#define V4l2_SLICED_VITC_625 (0x010000)
+#define V4l2_SLICED_VITC_525 (0x020000)
+
+/* Compat macro - Should be removed for 2.6.18 */
+#define V4L2_SLICED_TELETEXT_B V4L2_SLICED_TELETEXT_PAL_B
+
+#define V4L2_SLICED_VBI_525 (V4L2_SLICED_TELETEXT_NTSC_B |\
+ V4L2_SLICED_TELETEXT_NTSC_C |\
+ V4L2_SLICED_TELETEXT_NTSC_D |\
+ V4L2_SLICED_CAPTION_525 |\
+ V4L2_SLICED_WSS_525 |\
+ V4l2_SLICED_VITC_525)
+
+#define V4L2_SLICED_VBI_625 (V4L2_SLICED_TELETEXT_PAL_B |\
+ V4L2_SLICED_TELETEXT_PAL_C |\
+ V4L2_SLICED_TELETEXT_SECAM |\
+ V4L2_SLICED_VPS |\
+ V4L2_SLICED_CAPTION_625 |\
+ V4L2_SLICED_WSS_625 |\
+ V4l2_SLICED_VITC_625)

struct v4l2_sliced_vbi_cap
{

mch...@infradead.org

unread,
Mar 20, 2006, 11:10:16 AM3/20/06
to
From: Mauro Carvalho Chehab <mch...@infradead.org>
Date: 1141009644 -0300

StGit genreates patches-* when you run stg export command.
It makes no sense to show such directories as changes on git status.

Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/.gitignore b/.gitignore
diff --git a/.gitignore b/.gitignore
index 3f8fb68..53e53f2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -30,3 +30,5 @@ include/linux/autoconf.h
include/linux/compile.h
include/linux/version.h

+# stgit generated dirs
+patches-*

mch...@infradead.org

unread,
Mar 20, 2006, 11:10:18 AM3/20/06
to
From: Giampiero Giancipoli <gia...@libero.it>
Date: 1139302149 -0200

Additionally to the card support, this changeset adds the option
tda10046lifeview to get_dvb_firmware to download tda10046 firmware
from LifeView's site.

Signed-off-by: Giampiero Giancipoli <gia...@libero.it>
Signed-off-by: Hartmut Hackmann <hartmut....@t-online.de>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/Documentation/dvb/get_dvb_firmware b/Documentation/dvb/get_dvb_firmware
diff --git a/Documentation/dvb/get_dvb_firmware b/Documentation/dvb/get_dvb_firmware
index 75c28a1..bb55f49 100644
--- a/Documentation/dvb/get_dvb_firmware
+++ b/Documentation/dvb/get_dvb_firmware
@@ -21,8 +21,9 @@
use File::Temp qw/ tempdir /;
use IO::Handle;

-@components = ( "sp8870", "sp887x", "tda10045", "tda10046", "av7110", "dec2000t",
- "dec2540t", "dec3000s", "vp7041", "dibusb", "nxt2002", "nxt2004",
+@components = ( "sp8870", "sp887x", "tda10045", "tda10046",
+ "tda10046lifeview", "av7110", "dec2000t", "dec2540t",
+ "dec3000s", "vp7041", "dibusb", "nxt2002", "nxt2004",
"or51211", "or51132_qam", "or51132_vsb", "bluebird");

# Check args
@@ -126,6 +127,24 @@ sub tda10046 {
$outfile;
}

+sub tda10046lifeview {
+ my $sourcefile = "Drv_2.11.02.zip";
+ my $url = "http://www.lifeview.com.tw/drivers/pci_card/FlyDVB-T/$sourcefile";
+ my $hash = "1ea24dee4eea8fe971686981f34fd2e0";
+ my $outfile = "dvb-fe-tda10046.fw";
+ my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);
+
+ checkstandard();
+
+ wgetfile($sourcefile, $url);
+ unzip($sourcefile, $tmpdir);
+ extract("$tmpdir/LVHybrid.sys", 0x8b088, 24602, "$tmpdir/fwtmp");
+ verify("$tmpdir/fwtmp", $hash);
+ copy("$tmpdir/fwtmp", $outfile);
+
+ $outfile;
+}
+
sub av7110 {
my $sourcefile = "dvb-ttpci-01.fw-261d";
my $url = "http://www.linuxtv.org/downloads/firmware/$sourcefile";


diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134
diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134

index 636792e..1823e4c 100644
--- a/Documentation/video4linux/CARDLIST.saa7134
+++ b/Documentation/video4linux/CARDLIST.saa7134
@@ -84,3 +84,4 @@
83 -> Terratec Cinergy 250 PCI TV [153b:1160]


84 -> LifeView FlyDVB Trio [5168:0319]
85 -> AverTV DVB-T 777 [1461:2c05]

+ 86 -> LifeView FlyDVB-T [5168:0301]


diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c

index 3f964ed..f469f17 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -2637,6 +2637,27 @@ struct saa7134_board saa7134_boards[] =
.amux = LINE1,
}},
},
+ [SAA7134_BOARD_FLYDVBT_LR301] = {
+ /* LifeView FlyDVB-T */
+ /* Giampiero Giancipoli <gia...@libero.it> */
+ .name = "LifeView FlyDVB-T",
+ .audio_clock = 0x00200000,
+ .tuner_type = TUNER_ABSENT,


+ .radio_type = UNSET,
+ .tuner_addr = ADDR_UNSET,
+ .radio_addr = ADDR_UNSET,
+ .mpeg = SAA7134_MPEG_DVB,

+ .inputs = {{
+ .name = name_comp1, /* Composite input */
+ .vmux = 3,
+ .amux = LINE2,
+ },{
+ .name = name_svideo, /* S-Video signal on S-Video input */
+ .vmux = 8,
+ .amux = LINE2,


+ }},
+ },
+

};

const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards);

@@ -3114,6 +3135,12 @@ struct pci_device_id saa7134_pci_tbl[] =
.subdevice = 0x2c05,
.driver_data = SAA7134_BOARD_AVERMEDIA_777,


},{
+ .vendor = PCI_VENDOR_ID_PHILIPS,

+ .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
+ .subvendor = 0x5168,
+ .subdevice = 0x0301,
+ .driver_data = SAA7134_BOARD_FLYDVBT_LR301,


+ },{
/* --- boards without eeprom + subsystem ID --- */
.vendor = PCI_VENDOR_ID_PHILIPS,
.device = PCI_DEVICE_ID_PHILIPS_SAA7134,

@@ -3213,6 +3240,7 @@ int saa7134_board_init1(struct saa7134_d
case SAA7134_BOARD_GOTVIEW_7135:
case SAA7134_BOARD_KWORLD_TERMINATOR:
case SAA7134_BOARD_SEDNA_PC_TV_CARDBUS:
+ case SAA7134_BOARD_FLYDVBT_LR301:
dev->has_remote = SAA7134_REMOTE_GPIO;
break;
case SAA7134_BOARD_MD5044:


diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c

index 45b5257..be110b8 100644
--- a/drivers/media/video/saa7134/saa7134-dvb.c
+++ b/drivers/media/video/saa7134/saa7134-dvb.c
@@ -924,6 +924,10 @@ static int dvb_init(struct saa7134_dev *
dev->dvb.frontend = tda10046_attach(&philips_tiger_config,
&dev->i2c_adap);
break;
+ case SAA7134_BOARD_FLYDVBT_LR301:
+ dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config,


+ &dev->i2c_adap);
+ break;
#endif
#ifdef HAVE_NXT200X
case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180:

diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c
index ecfb6e2..6970334 100644
--- a/drivers/media/video/saa7134/saa7134-input.c
+++ b/drivers/media/video/saa7134/saa7134-input.c
@@ -230,6 +230,11 @@ int saa7134_input_init1(struct saa7134_d
mask_keycode = 0x003F00;
mask_keyup = 0x040000;
break;
+ case SAA7134_BOARD_FLYDVBT_LR301:
+ ir_codes = ir_codes_flydvb;
+ mask_keycode = 0x0001F00;
+ mask_keydown = 0x0040000;
+ break;
}
if (NULL == ir_codes) {
printk("%s: Oops: IR config error [card=%d]\n",


diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h

index b638df9..ed556e6 100644
--- a/drivers/media/video/saa7134/saa7134.h
+++ b/drivers/media/video/saa7134/saa7134.h
@@ -212,6 +212,7 @@ struct saa7134_format {
#define SAA7134_BOARD_CINERGY250PCI 83


#define SAA7134_BOARD_FLYDVB_TRIO 84
#define SAA7134_BOARD_AVERMEDIA_777 85

+#define SAA7134_BOARD_FLYDVBT_LR301 86



#define SAA7134_MAXBOARDS 8
#define SAA7134_INPUT_MAX 8

-

mch...@infradead.org

unread,
Mar 20, 2006, 11:10:18 AM3/20/06
to
From: Manu Abraham <ma...@linxtv.org>
Date: 1141009765 -0300

Ignore invalid messages on cx24110 frontend.
Thanks to Edgar Toernig

Signed-off-by: Manu Abraham <ma...@linuxtv.org>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/dvb/frontends/cx24110.c b/drivers/media/dvb/frontends/cx24110.c
diff --git a/drivers/media/dvb/frontends/cx24110.c b/drivers/media/dvb/frontends/cx24110.c
index d15d32c..cc68b7e 100644
--- a/drivers/media/dvb/frontends/cx24110.c
+++ b/drivers/media/dvb/frontends/cx24110.c
@@ -418,6 +418,9 @@ static int cx24110_send_diseqc_msg(struc
struct cx24110_state *state = fe->demodulator_priv;
unsigned long timeout;

+ if (cmd->msg_len < 3 || cmd->msg_len > 6)
+ return -EINVAL; /* not implemented */
+
for (i = 0; i < cmd->msg_len; i++)
cx24110_writereg(state, 0x79 + i, cmd->msg[i]);

mch...@infradead.org

unread,
Mar 20, 2006, 11:10:19 AM3/20/06
to
From: Mauro Carvalho Chehab <mch...@infradead.org>
Date: 1138043469 -0200

- CodingStyle fixes.

Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index d8d02c4..1b0e10d 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -1012,19 +1012,15 @@ static int em28xx_set_fmt(struct em28xx
width /= 2;
}

- if ((hscale =
- (((unsigned long)maxw) << 12) / width - 4096L) >=
- 0x4000)
+ if ((hscale = (((unsigned long)maxw) << 12) / width - 4096L) >= 0x4000)
hscale = 0x3fff;
- width =
- (((unsigned long)maxw) << 12) / (hscale + 4096L);

- if ((vscale =
- (((unsigned long)maxh) << 12) / height - 4096L) >=
- 0x4000)
+ width = (((unsigned long)maxw) << 12) / (hscale + 4096L);
+
+ if ((vscale = (((unsigned long)maxh) << 12) / height - 4096L) >= 0x4000)
vscale = 0x3fff;
- height =
- (((unsigned long)maxh) << 12) / (vscale + 4096L);
+
+ height = (((unsigned long)maxh) << 12) / (vscale + 4096L);

format->fmt.pix.width = width;
format->fmt.pix.height = height;
@@ -1035,10 +1031,9 @@ static int em28xx_set_fmt(struct em28xx
format->fmt.pix.field = V4L2_FIELD_INTERLACED;

em28xx_videodbg("%s: returned %dx%d (%d, %d)\n",
- cmd ==
- VIDIOC_TRY_FMT ? "VIDIOC_TRY_FMT" :
- "VIDIOC_S_FMT", format->fmt.pix.width,
- format->fmt.pix.height, hscale, vscale);
+ cmd == VIDIOC_TRY_FMT ?
+ "VIDIOC_TRY_FMT" :"VIDIOC_S_FMT",
+ format->fmt.pix.width, format->fmt.pix.height, hscale, vscale);

if (cmd == VIDIOC_TRY_FMT)
return 0;
@@ -1064,7 +1059,7 @@ static int em28xx_set_fmt(struct em28xx
dev->width = width;
dev->height = height;
dev->frame_size = dev->width * dev->height * 2;
- dev->field_size = dev->frame_size >> 1; /*both_fileds ? dev->frame_size>>1 : dev->frame_size; */
+ dev->field_size = dev->frame_size >> 1;
dev->bytesperline = dev->width * 2;
dev->hscale = hscale;
dev->vscale = vscale;
@@ -1092,374 +1087,367 @@ static int em28xx_do_ioctl(struct inode
switch (cmd) {
/* ---------- tv norms ---------- */
case VIDIOC_ENUMSTD:
- {
- struct v4l2_standard *e = arg;
- unsigned int i;
+ {
+ struct v4l2_standard *e = arg;
+ unsigned int i;

- i = e->index;
- if (i >= TVNORMS)
- return -EINVAL;
- ret = v4l2_video_std_construct(e, tvnorms[e->index].id,
- tvnorms[e->index].name);
- e->index = i;
- if (ret < 0)
- return ret;
- return 0;
- }
+ i = e->index;
+ if (i >= TVNORMS)
+ return -EINVAL;
+ ret = v4l2_video_std_construct(e, tvnorms[e->index].id,
+ tvnorms[e->index].name);
+ e->index = i;
+ if (ret < 0)
+ return ret;
+ return 0;
+ }
case VIDIOC_G_STD:
- {
- v4l2_std_id *id = arg;
+ {
+ v4l2_std_id *id = arg;

- *id = dev->tvnorm->id;
- return 0;
- }
+ *id = dev->tvnorm->id;
+ return 0;
+ }
case VIDIOC_S_STD:
- {
- v4l2_std_id *id = arg;
- unsigned int i;
-
+ {
+ v4l2_std_id *id = arg;
+ unsigned int i;
+
+ for (i = 0; i < TVNORMS; i++)
+ if (*id == tvnorms[i].id)
+ break;
+ if (i == TVNORMS)
for (i = 0; i < TVNORMS; i++)
- if (*id == tvnorms[i].id)
+ if (*id & tvnorms[i].id)
break;
- if (i == TVNORMS)
- for (i = 0; i < TVNORMS; i++)
- if (*id & tvnorms[i].id)
- break;
- if (i == TVNORMS)
- return -EINVAL;
+ if (i == TVNORMS)
+ return -EINVAL;

- down(&dev->lock);
- dev->tvnorm = &tvnorms[i];
+ down(&dev->lock);
+ dev->tvnorm = &tvnorms[i];

- em28xx_set_norm(dev, dev->width, dev->height);
+ em28xx_set_norm(dev, dev->width, dev->height);

- em28xx_i2c_call_clients(dev, DECODER_SET_NORM,
- &tvnorms[i].mode);
- em28xx_i2c_call_clients(dev, VIDIOC_S_STD,
- &dev->tvnorm->id);
+ em28xx_i2c_call_clients(dev, DECODER_SET_NORM,
+ &tvnorms[i].mode);
+ em28xx_i2c_call_clients(dev, VIDIOC_S_STD,
+ &dev->tvnorm->id);

- up(&dev->lock);
+ up(&dev->lock);

- return 0;
- }
+ return 0;
+ }

- /* ------ input switching ---------- */
+ /* ------ input switching ---------- */
case VIDIOC_ENUMINPUT:
- {
- struct v4l2_input *i = arg;
- unsigned int n;
- static const char *iname[] = {
- [EM28XX_VMUX_COMPOSITE1] = "Composite1",
- [EM28XX_VMUX_COMPOSITE2] = "Composite2",
- [EM28XX_VMUX_COMPOSITE3] = "Composite3",
- [EM28XX_VMUX_COMPOSITE4] = "Composite4",
- [EM28XX_VMUX_SVIDEO] = "S-Video",
- [EM28XX_VMUX_TELEVISION] = "Television",
- [EM28XX_VMUX_CABLE] = "Cable TV",
- [EM28XX_VMUX_DVB] = "DVB",
- [EM28XX_VMUX_DEBUG] = "for debug only",
- };
-
- n = i->index;
- if (n >= MAX_EM28XX_INPUT)
- return -EINVAL;
- if (0 == INPUT(n)->type)
- return -EINVAL;
- memset(i, 0, sizeof(*i));
- i->index = n;
- i->type = V4L2_INPUT_TYPE_CAMERA;
- strcpy(i->name, iname[INPUT(n)->type]);
- if ((EM28XX_VMUX_TELEVISION == INPUT(n)->type) ||
- (EM28XX_VMUX_CABLE == INPUT(n)->type))
- i->type = V4L2_INPUT_TYPE_TUNER;
- for (n = 0; n < ARRAY_SIZE(tvnorms); n++)
- i->std |= tvnorms[n].id;
- return 0;
- }
+ {
+ struct v4l2_input *i = arg;
+ unsigned int n;
+ static const char *iname[] = {
+ [EM28XX_VMUX_COMPOSITE1] = "Composite1",
+ [EM28XX_VMUX_COMPOSITE2] = "Composite2",
+ [EM28XX_VMUX_COMPOSITE3] = "Composite3",
+ [EM28XX_VMUX_COMPOSITE4] = "Composite4",
+ [EM28XX_VMUX_SVIDEO] = "S-Video",
+ [EM28XX_VMUX_TELEVISION] = "Television",
+ [EM28XX_VMUX_CABLE] = "Cable TV",
+ [EM28XX_VMUX_DVB] = "DVB",
+ [EM28XX_VMUX_DEBUG] = "for debug only",
+ };

+ n = i->index;
+ if (n >= MAX_EM28XX_INPUT)
+ return -EINVAL;
+ if (0 == INPUT(n)->type)
+ return -EINVAL;
+ memset(i, 0, sizeof(*i));
+ i->index = n;
+ i->type = V4L2_INPUT_TYPE_CAMERA;
+ strcpy(i->name, iname[INPUT(n)->type]);
+ if ((EM28XX_VMUX_TELEVISION == INPUT(n)->type) ||
+ (EM28XX_VMUX_CABLE == INPUT(n)->type))
+ i->type = V4L2_INPUT_TYPE_TUNER;
+ for (n = 0; n < ARRAY_SIZE(tvnorms); n++)
+ i->std |= tvnorms[n].id;
+ return 0;
+ }
case VIDIOC_G_INPUT:
- {
- int *i = arg;
- *i = dev->ctl_input;


-
- return 0;
- }

+ {
+ int *i = arg;
+ *i = dev->ctl_input;

+ return 0;
+ }
case VIDIOC_S_INPUT:
- {
- int *index = arg;
-
- if (*index >= MAX_EM28XX_INPUT)
- return -EINVAL;
- if (0 == INPUT(*index)->type)
- return -EINVAL;
+ {
+ int *index = arg;

- down(&dev->lock);
- video_mux(dev, *index);
- up(&dev->lock);
+ if (*index >= MAX_EM28XX_INPUT)
+ return -EINVAL;
+ if (0 == INPUT(*index)->type)
+ return -EINVAL;

- return 0;
- }
+ down(&dev->lock);
+ video_mux(dev, *index);
+ up(&dev->lock);

+ return 0;
+ }
case VIDIOC_G_AUDIO:
- {
- struct v4l2_audio *a = arg;
- unsigned int index = a->index;
+ {
+ struct v4l2_audio *a = arg;
+ unsigned int index = a->index;

- if (a->index > 1)
- return -EINVAL;
- memset(a, 0, sizeof(*a));
- index = dev->ctl_ainput;
+ if (a->index > 1)
+ return -EINVAL;
+ memset(a, 0, sizeof(*a));
+ index = dev->ctl_ainput;

- if (index == 0) {
- strcpy(a->name, "Television");
- } else {
- strcpy(a->name, "Line In");
- }
- a->capability = V4L2_AUDCAP_STEREO;
- a->index = index;
- return 0;
+ if (index == 0) {
+ strcpy(a->name, "Television");
+ } else {
+ strcpy(a->name, "Line In");
}
-
+ a->capability = V4L2_AUDCAP_STEREO;
+ a->index = index;
+ return 0;
+ }
case VIDIOC_S_AUDIO:
- {
- struct v4l2_audio *a = arg;
- if (a->index != dev->ctl_ainput)
- return -EINVAL;
-
- return 0;
- }
+ {
+ struct v4l2_audio *a = arg;

- /* --- controls ---------------------------------------------- */
- case VIDIOC_QUERYCTRL:
- {
- struct v4l2_queryctrl *qc = arg;
- int i, id=qc->id;
+ if (a->index != dev->ctl_ainput)
+ return -EINVAL;

- memset(qc,0,sizeof(*qc));
- qc->id=id;
+ return 0;
+ }

- if (!dev->has_msp34xx) {
- for (i = 0; i < ARRAY_SIZE(em28xx_qctrl); i++) {
- if (qc->id && qc->id == em28xx_qctrl[i].id) {
- memcpy(qc, &(em28xx_qctrl[i]),
- sizeof(*qc));


- return 0;
- }
- }
- }

- if (dev->decoder == EM28XX_TVP5150) {
- em28xx_i2c_call_clients(dev,cmd,qc);
- if (qc->type)
- return 0;
- else
- return -EINVAL;
- }
- for (i = 0; i < ARRAY_SIZE(saa711x_qctrl); i++) {
- if (qc->id && qc->id == saa711x_qctrl[i].id) {
- memcpy(qc, &(saa711x_qctrl[i]),
- sizeof(*qc));
+ /* --- controls ---------------------------------------------- */
+ case VIDIOC_QUERYCTRL:
+ {
+ struct v4l2_queryctrl *qc = arg;
+ int i, id=qc->id;
+
+ memset(qc,0,sizeof(*qc));
+ qc->id=id;
+
+ if (!dev->has_msp34xx) {
+ for (i = 0; i < ARRAY_SIZE(em28xx_qctrl); i++) {
+ if (qc->id && qc->id == em28xx_qctrl[i].id) {
+ memcpy(qc, &(em28xx_qctrl[i]),
+ sizeof(*qc));
return 0;
}
}
-
- return -EINVAL;
+ }
+ if (dev->decoder == EM28XX_TVP5150) {
+ em28xx_i2c_call_clients(dev,cmd,qc);
+ if (qc->type)
+ return 0;
+ else
+ return -EINVAL;
+ }
+ for (i = 0; i < ARRAY_SIZE(saa711x_qctrl); i++) {
+ if (qc->id && qc->id == saa711x_qctrl[i].id) {
+ memcpy(qc, &(saa711x_qctrl[i]),
+ sizeof(*qc));
+ return 0;
+ }
}

+ return -EINVAL;
+ }
case VIDIOC_G_CTRL:
- {
- struct v4l2_control *ctrl = arg;
- int retval=-EINVAL;
-
- if (!dev->has_msp34xx)
- retval=em28xx_get_ctrl(dev, ctrl);
- if (retval==-EINVAL) {
- if (dev->decoder == EM28XX_TVP5150) {
- em28xx_i2c_call_clients(dev,cmd,arg);


- return 0;
- }
-

- return saa711x_get_ctrl(dev, ctrl);
- } else return retval;
- }
+ {
+ struct v4l2_control *ctrl = arg;
+ int retval=-EINVAL;
+
+ if (!dev->has_msp34xx)
+ retval=em28xx_get_ctrl(dev, ctrl);
+ if (retval==-EINVAL) {
+ if (dev->decoder == EM28XX_TVP5150) {
+ em28xx_i2c_call_clients(dev,cmd,arg);
+ return 0;
+ }

+ return saa711x_get_ctrl(dev, ctrl);
+ } else return retval;
+ }
case VIDIOC_S_CTRL:
- {
- struct v4l2_control *ctrl = arg;
- u8 i;
-
- if (!dev->has_msp34xx){
- for (i = 0; i < ARRAY_SIZE(em28xx_qctrl); i++) {
- if (ctrl->id == em28xx_qctrl[i].id) {
- if (ctrl->value <
- em28xx_qctrl[i].minimum
- || ctrl->value >
- em28xx_qctrl[i].maximum)
- return -ERANGE;
- return em28xx_set_ctrl(dev, ctrl);
- }
+ {
+ struct v4l2_control *ctrl = arg;
+ u8 i;
+
+ if (!dev->has_msp34xx){
+ for (i = 0; i < ARRAY_SIZE(em28xx_qctrl); i++) {
+ if (ctrl->id == em28xx_qctrl[i].id) {
+ if (ctrl->value <
+ em28xx_qctrl[i].minimum
+ || ctrl->value >
+ em28xx_qctrl[i].maximum)
+ return -ERANGE;
+ return em28xx_set_ctrl(dev, ctrl);
}
}
+ }

- if (dev->decoder == EM28XX_TVP5150) {
- em28xx_i2c_call_clients(dev,cmd,arg);
- return 0;
- } else if (!dev->has_msp34xx) {
- for (i = 0; i < ARRAY_SIZE(em28xx_qctrl); i++) {
- if (ctrl->id == em28xx_qctrl[i].id) {
- if (ctrl->value <
- em28xx_qctrl[i].minimum
- || ctrl->value >
- em28xx_qctrl[i].maximum)
- return -ERANGE;
- return em28xx_set_ctrl(dev, ctrl);
- }
+ if (dev->decoder == EM28XX_TVP5150) {
+ em28xx_i2c_call_clients(dev,cmd,arg);
+ return 0;
+ } else if (!dev->has_msp34xx) {
+ for (i = 0; i < ARRAY_SIZE(em28xx_qctrl); i++) {
+ if (ctrl->id == em28xx_qctrl[i].id) {
+ if (ctrl->value <
+ em28xx_qctrl[i].minimum
+ || ctrl->value >
+ em28xx_qctrl[i].maximum)
+ return -ERANGE;
+ return em28xx_set_ctrl(dev, ctrl);
}
- for (i = 0; i < ARRAY_SIZE(saa711x_qctrl); i++) {
- if (ctrl->id == saa711x_qctrl[i].id) {
- if (ctrl->value <
- saa711x_qctrl[i].minimum
- || ctrl->value >
- saa711x_qctrl[i].maximum)
- return -ERANGE;
- return saa711x_set_ctrl(dev, ctrl);
- }
+ }
+ for (i = 0; i < ARRAY_SIZE(saa711x_qctrl); i++) {
+ if (ctrl->id == saa711x_qctrl[i].id) {
+ if (ctrl->value <
+ saa711x_qctrl[i].minimum
+ || ctrl->value >
+ saa711x_qctrl[i].maximum)
+ return -ERANGE;
+ return saa711x_set_ctrl(dev, ctrl);
}
}
-
- return -EINVAL;
}

- /* --- tuner ioctls ------------------------------------------ */
+ return -EINVAL;
+ }
+ /* --- tuner ioctls ------------------------------------------ */
case VIDIOC_G_TUNER:
- {
- struct v4l2_tuner *t = arg;
- int status = 0;
+ {
+ struct v4l2_tuner *t = arg;
+ int status = 0;

- if (0 != t->index)
- return -EINVAL;
+ if (0 != t->index)
+ return -EINVAL;

- memset(t, 0, sizeof(*t));
- strcpy(t->name, "Tuner");
- t->type = V4L2_TUNER_ANALOG_TV;
- t->capability = V4L2_TUNER_CAP_NORM;
- t->rangehigh = 0xffffffffUL; /* FIXME: set correct range */
+ memset(t, 0, sizeof(*t));
+ strcpy(t->name, "Tuner");
+ t->type = V4L2_TUNER_ANALOG_TV;
+ t->capability = V4L2_TUNER_CAP_NORM;
+ t->rangehigh = 0xffffffffUL; /* FIXME: set correct range */
/* t->signal = 0xffff;*/
/* em28xx_i2c_call_clients(dev,VIDIOC_G_TUNER,t);*/
- /* No way to get signal strength? */
- down(&dev->lock);
- em28xx_i2c_call_clients(dev, DECODER_GET_STATUS,
- &status);
- up(&dev->lock);
- t->signal =
- (status & DECODER_STATUS_GOOD) != 0 ? 0xffff : 0;
+ /* No way to get signal strength? */
+ down(&dev->lock);
+ em28xx_i2c_call_clients(dev, DECODER_GET_STATUS,
+ &status);
+ up(&dev->lock);
+ t->signal =
+ (status & DECODER_STATUS_GOOD) != 0 ? 0xffff : 0;

- em28xx_videodbg("VIDIO_G_TUNER: signal=%x, afc=%x\n", t->signal,
- t->afc);
- return 0;
- }
+ em28xx_videodbg("VIDIO_G_TUNER: signal=%x, afc=%x\n", t->signal,
+ t->afc);
+ return 0;
+ }
case VIDIOC_S_TUNER:
- {
- struct v4l2_tuner *t = arg;
- int status = 0;
+ {
+ struct v4l2_tuner *t = arg;
+ int status = 0;

- if (0 != t->index)
- return -EINVAL;
- memset(t, 0, sizeof(*t));
- strcpy(t->name, "Tuner");
- t->type = V4L2_TUNER_ANALOG_TV;
- t->capability = V4L2_TUNER_CAP_NORM;
- t->rangehigh = 0xffffffffUL; /* FIXME: set correct range */
+ if (0 != t->index)
+ return -EINVAL;
+ memset(t, 0, sizeof(*t));
+ strcpy(t->name, "Tuner");
+ t->type = V4L2_TUNER_ANALOG_TV;
+ t->capability = V4L2_TUNER_CAP_NORM;
+ t->rangehigh = 0xffffffffUL; /* FIXME: set correct range */
/* t->signal = 0xffff; */
- /* No way to get signal strength? */
- down(&dev->lock);
- em28xx_i2c_call_clients(dev, DECODER_GET_STATUS,
- &status);
- up(&dev->lock);
- t->signal =
- (status & DECODER_STATUS_GOOD) != 0 ? 0xffff : 0;
+ /* No way to get signal strength? */
+ down(&dev->lock);
+ em28xx_i2c_call_clients(dev, DECODER_GET_STATUS,
+ &status);
+ up(&dev->lock);
+ t->signal =
+ (status & DECODER_STATUS_GOOD) != 0 ? 0xffff : 0;

- em28xx_videodbg("VIDIO_S_TUNER: signal=%x, afc=%x\n",
- t->signal, t->afc);
- return 0;
- }
+ em28xx_videodbg("VIDIO_S_TUNER: signal=%x, afc=%x\n",
+ t->signal, t->afc);
+ return 0;
+ }
case VIDIOC_G_FREQUENCY:
- {
- struct v4l2_frequency *f = arg;
+ {
+ struct v4l2_frequency *f = arg;

- memset(f, 0, sizeof(*f));
- f->type = V4L2_TUNER_ANALOG_TV;
- f->frequency = dev->ctl_freq;
+ memset(f, 0, sizeof(*f));
+ f->type = V4L2_TUNER_ANALOG_TV;
+ f->frequency = dev->ctl_freq;

- return 0;
- }
+ return 0;
+ }
case VIDIOC_S_FREQUENCY:
- {
- struct v4l2_frequency *f = arg;
-
- if (0 != f->tuner)
- return -EINVAL;
+ {
+ struct v4l2_frequency *f = arg;

- if (V4L2_TUNER_ANALOG_TV != f->type)
- return -EINVAL;
+ if (0 != f->tuner)
+ return -EINVAL;

- down(&dev->lock);
- dev->ctl_freq = f->frequency;
- em28xx_i2c_call_clients(dev, VIDIOC_S_FREQUENCY, f);
- up(&dev->lock);
- return 0;
- }
+ if (V4L2_TUNER_ANALOG_TV != f->type)
+ return -EINVAL;

+ down(&dev->lock);
+ dev->ctl_freq = f->frequency;
+ em28xx_i2c_call_clients(dev, VIDIOC_S_FREQUENCY, f);
+ up(&dev->lock);
+ return 0;
+ }
case VIDIOC_CROPCAP:
- {
- struct v4l2_cropcap *cc = arg;
+ {
+ struct v4l2_cropcap *cc = arg;

- if (cc->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
- return -EINVAL;
- cc->bounds.left = 0;
- cc->bounds.top = 0;
- cc->bounds.width = dev->width;
- cc->bounds.height = dev->height;
- cc->defrect = cc->bounds;
- cc->pixelaspect.numerator = 54; /* 4:3 FIXME: remove magic numbers */
- cc->pixelaspect.denominator = 59;
- return 0;
- }
+ if (cc->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
+ return -EINVAL;
+ cc->bounds.left = 0;
+ cc->bounds.top = 0;
+ cc->bounds.width = dev->width;
+ cc->bounds.height = dev->height;
+ cc->defrect = cc->bounds;
+ cc->pixelaspect.numerator = 54; /* 4:3 FIXME: remove magic numbers */
+ cc->pixelaspect.denominator = 59;
+ return 0;
+ }
case VIDIOC_STREAMON:
- {
- int *type = arg;
+ {
+ int *type = arg;

- if (*type != V4L2_BUF_TYPE_VIDEO_CAPTURE
- || dev->io != IO_MMAP)
- return -EINVAL;
+ if (*type != V4L2_BUF_TYPE_VIDEO_CAPTURE
+ || dev->io != IO_MMAP)
+ return -EINVAL;

- if (list_empty(&dev->inqueue))
- return -EINVAL;
+ if (list_empty(&dev->inqueue))
+ return -EINVAL;

- dev->stream = STREAM_ON; /* FIXME: Start video capture here? */
+ dev->stream = STREAM_ON; /* FIXME: Start video capture here? */

- em28xx_videodbg("VIDIOC_STREAMON: starting stream\n");
+ em28xx_videodbg("VIDIOC_STREAMON: starting stream\n");

- return 0;
- }
+ return 0;
+ }
case VIDIOC_STREAMOFF:
- {
- int *type = arg;
- int ret;
-
- if (*type != V4L2_BUF_TYPE_VIDEO_CAPTURE
- || dev->io != IO_MMAP)
- return -EINVAL;
+ {
+ int *type = arg;
+ int ret;

- if (dev->stream == STREAM_ON) {
- em28xx_videodbg ("VIDIOC_STREAMOFF: interrupting stream\n");
- if ((ret = em28xx_stream_interrupt(dev)))
- return ret;
- }
- em28xx_empty_framequeues(dev);
+ if (*type != V4L2_BUF_TYPE_VIDEO_CAPTURE
+ || dev->io != IO_MMAP)
+ return -EINVAL;

- return 0;
+ if (dev->stream == STREAM_ON) {
+ em28xx_videodbg ("VIDIOC_STREAMOFF: interrupting stream\n");
+ if ((ret = em28xx_stream_interrupt(dev)))
+ return ret;
}
+ em28xx_empty_framequeues(dev);


+
+ return 0;
+ }

default:
return v4l_compat_translate_ioctl(inode, filp, cmd, arg,
driver_ioctl);
@@ -1489,40 +1477,38 @@ static int em28xx_video_do_ioctl(struct
/* --- capabilities ------------------------------------------ */
case VIDIOC_QUERYCAP:
{
- struct v4l2_capability *cap = arg;
+ struct v4l2_capability *cap = arg;

- memset(cap, 0, sizeof(*cap));
- strlcpy(cap->driver, "em28xx", sizeof(cap->driver));
- strlcpy(cap->card, em28xx_boards[dev->model].name,
- sizeof(cap->card));
- strlcpy(cap->bus_info, dev->udev->dev.bus_id,
- sizeof(cap->bus_info));
- cap->version = EM28XX_VERSION_CODE;
- cap->capabilities =
- V4L2_CAP_SLICED_VBI_CAPTURE |
- V4L2_CAP_VIDEO_CAPTURE |
- V4L2_CAP_AUDIO |
- V4L2_CAP_READWRITE | V4L2_CAP_STREAMING;
- if (dev->has_tuner)
- cap->capabilities |= V4L2_CAP_TUNER;


- return 0;
- }
-

- /* --- capture ioctls ---------------------------------------- */
+ memset(cap, 0, sizeof(*cap));
+ strlcpy(cap->driver, "em28xx", sizeof(cap->driver));
+ strlcpy(cap->card, em28xx_boards[dev->model].name,
+ sizeof(cap->card));
+ strlcpy(cap->bus_info, dev->udev->dev.bus_id,
+ sizeof(cap->bus_info));
+ cap->version = EM28XX_VERSION_CODE;
+ cap->capabilities =
+ V4L2_CAP_SLICED_VBI_CAPTURE |
+ V4L2_CAP_VIDEO_CAPTURE |
+ V4L2_CAP_AUDIO |
+ V4L2_CAP_READWRITE | V4L2_CAP_STREAMING;
+ if (dev->has_tuner)
+ cap->capabilities |= V4L2_CAP_TUNER;
+ return 0;
+ }
+ /* --- capture ioctls ---------------------------------------- */
case VIDIOC_ENUM_FMT:
- {
- struct v4l2_fmtdesc *fmtd = arg;
-
- if (fmtd->index != 0)
- return -EINVAL;
- memset(fmtd, 0, sizeof(*fmtd));
- fmtd->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
- strcpy(fmtd->description, "Packed YUY2");
- fmtd->pixelformat = V4L2_PIX_FMT_YUYV;
- memset(fmtd->reserved, 0, sizeof(fmtd->reserved));
- return 0;
- }
+ {
+ struct v4l2_fmtdesc *fmtd = arg;

+ if (fmtd->index != 0)
+ return -EINVAL;
+ memset(fmtd, 0, sizeof(*fmtd));
+ fmtd->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+ strcpy(fmtd->description, "Packed YUY2");
+ fmtd->pixelformat = V4L2_PIX_FMT_YUYV;
+ memset(fmtd->reserved, 0, sizeof(fmtd->reserved));
+ return 0;
+ }
case VIDIOC_G_FMT:
return em28xx_get_fmt(dev, (struct v4l2_format *) arg);

@@ -1531,131 +1517,130 @@ static int em28xx_video_do_ioctl(struct
return em28xx_set_fmt(dev, cmd, (struct v4l2_format *)arg);

case VIDIOC_REQBUFS:
- {
- struct v4l2_requestbuffers *rb = arg;
- u32 i;
- int ret;
+ {
+ struct v4l2_requestbuffers *rb = arg;
+ u32 i;
+ int ret;

- if (rb->type != V4L2_BUF_TYPE_VIDEO_CAPTURE ||
- rb->memory != V4L2_MEMORY_MMAP)
- return -EINVAL;
-
- if (dev->io == IO_READ) {
- em28xx_videodbg ("method is set to read;"
- " close and open the device again to"
- " choose the mmap I/O method\n");
- return -EINVAL;
- }
+ if (rb->type != V4L2_BUF_TYPE_VIDEO_CAPTURE ||
+ rb->memory != V4L2_MEMORY_MMAP)
+ return -EINVAL;

- for (i = 0; i < dev->num_frames; i++)
- if (dev->frame[i].vma_use_count) {
- em28xx_videodbg ("VIDIOC_REQBUFS failed; previous buffers are still mapped\n");
- return -EINVAL;
- }
+ if (dev->io == IO_READ) {
+ em28xx_videodbg ("method is set to read;"
+ " close and open the device again to"
+ " choose the mmap I/O method\n");
+ return -EINVAL;
+ }

- if (dev->stream == STREAM_ON) {
- em28xx_videodbg("VIDIOC_REQBUFS: interrupting stream\n");
- if ((ret = em28xx_stream_interrupt(dev)))
- return ret;
+ for (i = 0; i < dev->num_frames; i++)
+ if (dev->frame[i].vma_use_count) {
+ em28xx_videodbg ("VIDIOC_REQBUFS failed; previous buffers are still mapped\n");
+ return -EINVAL;
}

- em28xx_empty_framequeues(dev);
-
- em28xx_release_buffers(dev);
- if (rb->count)
- rb->count =
- em28xx_request_buffers(dev, rb->count);
-
- dev->frame_current = NULL;
-
- em28xx_videodbg ("VIDIOC_REQBUFS: setting io method to mmap: num bufs %i\n",
- rb->count);
- dev->io = rb->count ? IO_MMAP : IO_NONE;
- return 0;
+ if (dev->stream == STREAM_ON) {
+ em28xx_videodbg("VIDIOC_REQBUFS: interrupting stream\n");
+ if ((ret = em28xx_stream_interrupt(dev)))
+ return ret;
}

+ em28xx_empty_framequeues(dev);
+
+ em28xx_release_buffers(dev);
+ if (rb->count)
+ rb->count =
+ em28xx_request_buffers(dev, rb->count);
+
+ dev->frame_current = NULL;
+
+ em28xx_videodbg ("VIDIOC_REQBUFS: setting io method to mmap: num bufs %i\n",
+ rb->count);
+ dev->io = rb->count ? IO_MMAP : IO_NONE;
+ return 0;
+ }
case VIDIOC_QUERYBUF:
- {
- struct v4l2_buffer *b = arg;
+ {
+ struct v4l2_buffer *b = arg;

- if (b->type != V4L2_BUF_TYPE_VIDEO_CAPTURE ||
- b->index >= dev->num_frames || dev->io != IO_MMAP)
- return -EINVAL;
+ if (b->type != V4L2_BUF_TYPE_VIDEO_CAPTURE ||
+ b->index >= dev->num_frames || dev->io != IO_MMAP)
+ return -EINVAL;

- memcpy(b, &dev->frame[b->index].buf, sizeof(*b));
+ memcpy(b, &dev->frame[b->index].buf, sizeof(*b));

- if (dev->frame[b->index].vma_use_count) {
- b->flags |= V4L2_BUF_FLAG_MAPPED;
- }
- if (dev->frame[b->index].state == F_DONE)
- b->flags |= V4L2_BUF_FLAG_DONE;
- else if (dev->frame[b->index].state != F_UNUSED)
- b->flags |= V4L2_BUF_FLAG_QUEUED;
- return 0;
+ if (dev->frame[b->index].vma_use_count) {
+ b->flags |= V4L2_BUF_FLAG_MAPPED;
}
+ if (dev->frame[b->index].state == F_DONE)
+ b->flags |= V4L2_BUF_FLAG_DONE;
+ else if (dev->frame[b->index].state != F_UNUSED)
+ b->flags |= V4L2_BUF_FLAG_QUEUED;
+ return 0;
+ }
case VIDIOC_QBUF:
- {
- struct v4l2_buffer *b = arg;
- unsigned long lock_flags;
+ {
+ struct v4l2_buffer *b = arg;
+ unsigned long lock_flags;

- if (b->type != V4L2_BUF_TYPE_VIDEO_CAPTURE ||
- b->index >= dev->num_frames || dev->io != IO_MMAP) {
- return -EINVAL;
- }
+ if (b->type != V4L2_BUF_TYPE_VIDEO_CAPTURE ||
+ b->index >= dev->num_frames || dev->io != IO_MMAP) {
+ return -EINVAL;
+ }

- if (dev->frame[b->index].state != F_UNUSED) {
- return -EAGAIN;
- }
- dev->frame[b->index].state = F_QUEUED;
+ if (dev->frame[b->index].state != F_UNUSED) {
+ return -EAGAIN;
+ }
+ dev->frame[b->index].state = F_QUEUED;

- /* add frame to fifo */
- spin_lock_irqsave(&dev->queue_lock, lock_flags);
- list_add_tail(&dev->frame[b->index].frame,
- &dev->inqueue);
- spin_unlock_irqrestore(&dev->queue_lock, lock_flags);
+ /* add frame to fifo */
+ spin_lock_irqsave(&dev->queue_lock, lock_flags);
+ list_add_tail(&dev->frame[b->index].frame,
+ &dev->inqueue);
+ spin_unlock_irqrestore(&dev->queue_lock, lock_flags);

- return 0;
- }
+ return 0;
+ }
case VIDIOC_DQBUF:
- {
- struct v4l2_buffer *b = arg;
- struct em28xx_frame_t *f;
- unsigned long lock_flags;
- int ret = 0;
+ {
+ struct v4l2_buffer *b = arg;
+ struct em28xx_frame_t *f;
+ unsigned long lock_flags;
+ int ret = 0;

- if (b->type != V4L2_BUF_TYPE_VIDEO_CAPTURE
- || dev->io != IO_MMAP)
- return -EINVAL;
+ if (b->type != V4L2_BUF_TYPE_VIDEO_CAPTURE
+ || dev->io != IO_MMAP)
+ return -EINVAL;

- if (list_empty(&dev->outqueue)) {
- if (dev->stream == STREAM_OFF)
- return -EINVAL;
- if (filp->f_flags & O_NONBLOCK)
- return -EAGAIN;
- ret = wait_event_interruptible
- (dev->wait_frame,
- (!list_empty(&dev->outqueue)) ||
- (dev->state & DEV_DISCONNECTED));
- if (ret)
- return ret;
- if (dev->state & DEV_DISCONNECTED)
- return -ENODEV;
- }
+ if (list_empty(&dev->outqueue)) {
+ if (dev->stream == STREAM_OFF)
+ return -EINVAL;
+ if (filp->f_flags & O_NONBLOCK)
+ return -EAGAIN;
+ ret = wait_event_interruptible
+ (dev->wait_frame,
+ (!list_empty(&dev->outqueue)) ||
+ (dev->state & DEV_DISCONNECTED));
+ if (ret)
+ return ret;
+ if (dev->state & DEV_DISCONNECTED)
+ return -ENODEV;
+ }

- spin_lock_irqsave(&dev->queue_lock, lock_flags);
- f = list_entry(dev->outqueue.next,
- struct em28xx_frame_t, frame);
- list_del(dev->outqueue.next);
- spin_unlock_irqrestore(&dev->queue_lock, lock_flags);
+ spin_lock_irqsave(&dev->queue_lock, lock_flags);
+ f = list_entry(dev->outqueue.next,
+ struct em28xx_frame_t, frame);
+ list_del(dev->outqueue.next);
+ spin_unlock_irqrestore(&dev->queue_lock, lock_flags);

- f->state = F_UNUSED;
- memcpy(b, &f->buf, sizeof(*b));
+ f->state = F_UNUSED;
+ memcpy(b, &f->buf, sizeof(*b));

- if (f->vma_use_count)
- b->flags |= V4L2_BUF_FLAG_MAPPED;
+ if (f->vma_use_count)
+ b->flags |= V4L2_BUF_FLAG_MAPPED;

- return 0;
- }
+ return 0;
+ }
default:
return em28xx_do_ioctl(inode, filp, dev, cmd, arg,
em28xx_video_do_ioctl);

mch...@infradead.org

unread,
Mar 20, 2006, 11:10:19 AM3/20/06
to
From: Manu Abraham <ma...@linuxtv.org>
Date: 1139301930 -0200

With DVB drivers enabled snd_87x (ALSA) don't detect.


Signed-off-by: Manu Abraham <ma...@linuxtv.org>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/dvb/bt8xx/bt878.c b/drivers/media/dvb/bt8xx/bt878.c
diff --git a/drivers/media/dvb/bt8xx/bt878.c b/drivers/media/dvb/bt8xx/bt878.c
index a04bb61..34c3189 100644
--- a/drivers/media/dvb/bt8xx/bt878.c
+++ b/drivers/media/dvb/bt8xx/bt878.c
@@ -381,6 +381,23 @@ bt878_device_control(struct bt878 *bt, u

EXPORT_SYMBOL(bt878_device_control);

+
+struct cards card_list[] __devinitdata = {
+
+ { 0x01010071, BTTV_BOARD_NEBULA_DIGITV, "Nebula Electronics DigiTV" },
+ { 0x07611461, BTTV_BOARD_AVDVBT_761, "AverMedia AverTV DVB-T 761" },
+ { 0x001c11bd, BTTV_BOARD_PINNACLESAT, "Pinnacle PCTV Sat" },
+ { 0x002611bd, BTTV_BOARD_TWINHAN_DST, "Pinnacle PCTV SAT CI" },
+ { 0x00011822, BTTV_BOARD_TWINHAN_DST, "Twinhan VisionPlus DVB" },
+ { 0xfc00270f, BTTV_BOARD_TWINHAN_DST, "ChainTech digitop DST-1000 DVB-S" },
+ { 0x07711461, BTTV_BOARD_AVDVBT_771, "AVermedia AverTV DVB-T 771" },
+ { 0xdb1018ac, BTTV_BOARD_DVICO_DVBT_LITE, "DViCO FusionHDTV DVB-T Lite" },
+ { 0xd50018ac, BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE, "DViCO FusionHDTV 5 Lite" },
+ { 0x20007063, BTTV_BOARD_PC_HDTV, "pcHDTV HD-2000 TV"},
+ { 0, -1, NULL }
+};
+
+
/***********************/
/* PCI device handling */
/***********************/
@@ -388,18 +405,41 @@ EXPORT_SYMBOL(bt878_device_control);
static int __devinit bt878_probe(struct pci_dev *dev,
const struct pci_device_id *pci_id)
{
- int result;
+ int result = 0, has_dvb = 0, i;
unsigned char lat;
struct bt878 *bt;
#if defined(__powerpc__)
unsigned int cmd;
#endif
+ unsigned int cardid;
+ unsigned short id;
+ struct cards *dvb_cards;

printk(KERN_INFO "bt878: Bt878 AUDIO function found (%d).\n",
bt878_num);
if (pci_enable_device(dev))
return -EIO;

+ pci_read_config_word(dev, PCI_SUBSYSTEM_ID, &id);
+ cardid = id << 16;
+ pci_read_config_word(dev, PCI_SUBSYSTEM_VENDOR_ID, &id);
+ cardid |= id;
+
+ for (i = 0, dvb_cards = card_list; i < ARRAY_SIZE(card_list); i++, dvb_cards++) {
+ if (cardid == dvb_cards->pci_id) {
+ printk("%s: card id=[0x%x],[ %s ] has DVB functions.\n",
+ __func__, cardid, dvb_cards->name);
+ has_dvb = 1;
+ }
+ }
+
+ if (!has_dvb) {
+ printk("%s: card id=[0x%x], Unknown card.\nExiting..\n", __func__, cardid);
+ result = -EINVAL;
+
+ goto fail0;
+ }
+
bt = &bt878[bt878_num];
bt->dev = dev;
bt->nr = bt878_num;
@@ -416,6 +456,8 @@ static int __devinit bt878_probe(struct

pci_read_config_byte(dev, PCI_CLASS_REVISION, &bt->revision);
pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lat);
+
+
printk(KERN_INFO "bt878(%d): Bt%x (rev %d) at %02x:%02x.%x, ",
bt878_num, bt->id, bt->revision, dev->bus->number,
PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
diff --git a/drivers/media/dvb/bt8xx/bt878.h b/drivers/media/dvb/bt8xx/bt878.h
diff --git a/drivers/media/dvb/bt8xx/bt878.h b/drivers/media/dvb/bt8xx/bt878.h
index a73baf0..9faf937 100644
--- a/drivers/media/dvb/bt8xx/bt878.h
+++ b/drivers/media/dvb/bt8xx/bt878.h
@@ -88,6 +88,23 @@

#define BT878_RISC_SYNC_MASK (1 << 15)

+
+#define BTTV_BOARD_UNKNOWN 0x00
+#define BTTV_BOARD_PINNACLESAT 0x5e
+#define BTTV_BOARD_NEBULA_DIGITV 0x68
+#define BTTV_BOARD_PC_HDTV 0x70
+#define BTTV_BOARD_TWINHAN_DST 0x71
+#define BTTV_BOARD_AVDVBT_771 0x7b
+#define BTTV_BOARD_AVDVBT_761 0x7c
+#define BTTV_BOARD_DVICO_DVBT_LITE 0x80
+#define BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE 0x87
+
+struct cards {
+ __u32 pci_id;
+ __u16 card_id;
+ char *name;
+};
+
extern int bt878_num;

struct bt878 {

mch...@infradead.org

unread,
Mar 20, 2006, 11:10:20 AM3/20/06
to
From: Andrew Burri <andrew...@gmail.com>
Date: 1141009703 -0300

Signed-off-by: Andrew Burri <andrew...@gmail.com>
Signed-off-by: Michael Krufky <mkr...@linuxtv.org>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134
diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134
index 7d16376..f74d2f9 100644
--- a/Documentation/video4linux/CARDLIST.saa7134
+++ b/Documentation/video4linux/CARDLIST.saa7134
@@ -88,3 +88,4 @@
87 -> ADS Instant TV Duo Cardbus PTV331 [0331:1421]
88 -> Tevion DVB-T 220RF [17de:7201]
89 -> ELSA EX-VISION 700TV [1131:7130]
+ 90 -> KWORLD ATSC110 [17de:7350]


diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c

index 602c614..6ce9c08 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -2731,6 +2731,22 @@ struct saa7134_board saa7134_boards[] =

.amux = LINE1,
},
},

+ [SAA7134_BOARD_KWORLD_ATSC110] = {
+ .name = "KWORLD ATSC110",
+ .audio_clock = 0x00187de7,
+ .tuner_type = TUNER_PHILIPS_TUV1236D,


+ .radio_type = UNSET,
+ .tuner_addr = ADDR_UNSET,
+ .radio_addr = ADDR_UNSET,

+ .tda9887_conf = TDA9887_PRESENT,


+ .mpeg = SAA7134_MPEG_DVB,
+ .inputs = {{

+ .name = name_tv,
+ .vmux = 1,
+ .amux = TV,
+ .tv = 1,
+ }},
+ },


};

const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards);

@@ -3232,6 +3248,12 @@ struct pci_device_id saa7134_pci_tbl[] =
.subdevice = 0x7201,
.driver_data = SAA7134_BOARD_TEVION_DVBT_220RF,


},{
+ .vendor = PCI_VENDOR_ID_PHILIPS,

+ .device = PCI_DEVICE_ID_PHILIPS_SAA7133, /* SAA7135HL */
+ .subvendor = 0x17de,
+ .subdevice = 0x7350,
+ .driver_data = SAA7134_BOARD_KWORLD_ATSC110,


+ },{
/* --- boards without eeprom + subsystem ID --- */
.vendor = PCI_VENDOR_ID_PHILIPS,
.device = PCI_DEVICE_ID_PHILIPS_SAA7134,

diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c

index 56ca3fa..354bbf7 100644
--- a/drivers/media/video/saa7134/saa7134-dvb.c
+++ b/drivers/media/video/saa7134/saa7134-dvb.c
@@ -927,6 +927,12 @@ static struct nxt200x_config avertvhda18
.pll_address = 0x61,
.pll_desc = &dvb_pll_tdhu2,
};
+
+static struct nxt200x_config kworldatsc110 = {
+ .demod_address = 0x0a,
+ .pll_address = 0x61,
+ .pll_desc = &dvb_pll_tuv1236d,
+};
#endif

/* ------------------------------------------------------------------ */
@@ -1012,6 +1018,9 @@ static int dvb_init(struct saa7134_dev *
case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180:
dev->dvb.frontend = nxt200x_attach(&avertvhda180, &dev->i2c_adap);
break;
+ case SAA7134_BOARD_KWORLD_ATSC110:
+ dev->dvb.frontend = nxt200x_attach(&kworldatsc110, &dev->i2c_adap);
+ break;
#endif
default:
printk("%s: Huh? unknown DVB card?\n",dev->name);


diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h

index 55a6733..f8c9b67 100644
--- a/drivers/media/video/saa7134/saa7134.h
+++ b/drivers/media/video/saa7134/saa7134.h
@@ -217,6 +217,7 @@ struct saa7134_format {
#define SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331 87
#define SAA7134_BOARD_TEVION_DVBT_220RF 88
#define SAA7134_BOARD_ELSA_700TV 89
+#define SAA7134_BOARD_KWORLD_ATSC110 90



#define SAA7134_MAXBOARDS 8
#define SAA7134_INPUT_MAX 8

-

mch...@infradead.org

unread,
Mar 20, 2006, 11:10:20 AM3/20/06
to
From: Hans Verkuil <hver...@xs4all.nl>
Date: 1138043469 -0200

- Audmode and rxsubchans fixes in msp3400, tuner, tvaudio and cx25840.
- msp3400 cleanups

Signed-off-by: Hans Verkuil <hver...@xs4all.nl>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c
index c66c2c1..3acd587 100644
--- a/drivers/media/video/cx25840/cx25840-core.c
+++ b/drivers/media/video/cx25840/cx25840-core.c
@@ -753,6 +753,7 @@ static int cx25840_command(struct i2c_cl

memset(input, 0, sizeof(*input));
input->index = state->aud_input;
+ input->capability = V4L2_AUDCAP_STEREO;
break;
}

@@ -763,7 +764,6 @@ static int cx25840_command(struct i2c_cl
case VIDIOC_G_TUNER:
{
u8 mode = cx25840_read(client, 0x804);
- u8 pref = cx25840_read(client, 0x809) & 0xf;
u8 vpres = cx25840_read(client, 0x80a) & 0x10;
int val = 0;

@@ -783,44 +783,49 @@ static int cx25840_command(struct i2c_cl
val |= V4L2_TUNER_SUB_MONO;

if (mode == 2 || mode == 4)
- val |= V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2;
+ val = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2;

if (mode & 0x10)
val |= V4L2_TUNER_SUB_SAP;

vt->rxsubchans = val;
-
- switch (pref) {
- case 0:
- vt->audmode = V4L2_TUNER_MODE_MONO;
- break;
- case 1:
- case 2:
- vt->audmode = V4L2_TUNER_MODE_LANG2;
- break;
- case 4:
- default:
- vt->audmode = V4L2_TUNER_MODE_STEREO;
- }
+ vt->audmode = state->audmode;
break;
}

case VIDIOC_S_TUNER:
+ if (state->radio)
+ break;
+
switch (vt->audmode) {
case V4L2_TUNER_MODE_MONO:
- case V4L2_TUNER_MODE_LANG1:
- /* Force PREF_MODE to MONO */
+ /* mono -> mono
+ stereo -> mono
+ bilingual -> lang1 */
cx25840_and_or(client, 0x809, ~0xf, 0x00);
break;
- case V4L2_TUNER_MODE_STEREO:
- /* Force PREF_MODE to STEREO */
+ case V4L2_TUNER_MODE_LANG1:
+ /* mono -> mono
+ stereo -> stereo
+ bilingual -> lang1 */
cx25840_and_or(client, 0x809, ~0xf, 0x04);
break;
+ case V4L2_TUNER_MODE_STEREO:
+ /* mono -> mono
+ stereo -> stereo
+ bilingual -> lang1/lang2 */
+ cx25840_and_or(client, 0x809, ~0xf, 0x07);
+ break;
case V4L2_TUNER_MODE_LANG2:
- /* Force PREF_MODE to LANG2 */
+ /* mono -> mono
+ stereo ->stereo
+ bilingual -> lang2 */
cx25840_and_or(client, 0x809, ~0xf, 0x01);


break;
+ default:
+ return -EINVAL;
}

+ state->audmode = vt->audmode;
break;

case VIDIOC_G_FMT:
@@ -901,6 +906,7 @@ static int cx25840_detect_client(struct
state->aud_input = CX25840_AUDIO8;
state->audclk_freq = 48000;
state->pvr150_workaround = 0;
+ state->audmode = V4L2_TUNER_MODE_LANG1;

cx25840_initialize(client, 1);

diff --git a/drivers/media/video/cx25840/cx25840.h b/drivers/media/video/cx25840/cx25840.h
diff --git a/drivers/media/video/cx25840/cx25840.h b/drivers/media/video/cx25840/cx25840.h
index fd22f30..dd70664 100644
--- a/drivers/media/video/cx25840/cx25840.h
+++ b/drivers/media/video/cx25840/cx25840.h
@@ -78,6 +78,7 @@ struct cx25840_state {
enum cx25840_video_input vid_input;
enum cx25840_audio_input aud_input;
u32 audclk_freq;
+ int audmode;
};

/* ----------------------------------------------------------------------- */
diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c
diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c
index 994c340..11ea976 100644
--- a/drivers/media/video/msp3400-driver.c
+++ b/drivers/media/video/msp3400-driver.c
@@ -411,9 +411,9 @@ static int msp_mode_v4l2_to_v4l1(int rxs
if (rxsubchans & V4L2_TUNER_SUB_STEREO)
mode |= VIDEO_SOUND_STEREO;
if (rxsubchans & V4L2_TUNER_SUB_LANG2)
- mode |= VIDEO_SOUND_LANG2;
+ mode |= VIDEO_SOUND_LANG2 | VIDEO_SOUND_STEREO;
if (rxsubchans & V4L2_TUNER_SUB_LANG1)
- mode |= VIDEO_SOUND_LANG1;
+ mode |= VIDEO_SOUND_LANG1 | VIDEO_SOUND_STEREO;
if (mode == 0)
mode |= VIDEO_SOUND_MONO;
return mode;
@@ -430,21 +430,6 @@ static int msp_mode_v4l1_to_v4l2(int mod
return V4L2_TUNER_MODE_MONO;
}

-static void msp_any_detect_stereo(struct i2c_client *client)
-{
- struct msp_state *state = i2c_get_clientdata(client);
-
- switch (state->opmode) {
- case OPMODE_MANUAL:
- case OPMODE_AUTODETECT:
- autodetect_stereo(client);
- break;
- case OPMODE_AUTOSELECT:
- msp34xxg_detect_stereo(client);


- break;
- }
-}
-

static struct v4l2_queryctrl msp_qctrl_std[] = {
{
.id = V4L2_CID_AUDIO_VOLUME,
@@ -506,22 +491,6 @@ static struct v4l2_queryctrl msp_qctrl_s
};


-static void msp_any_set_audmode(struct i2c_client *client, int audmode)
-{
- struct msp_state *state = i2c_get_clientdata(client);
-
- switch (state->opmode) {
- case OPMODE_MANUAL:
- case OPMODE_AUTODETECT:
- state->watch_stereo = 0;
- msp3400c_setstereo(client, audmode);
- break;
- case OPMODE_AUTOSELECT:
- msp34xxg_set_audmode(client, audmode);


- break;
- }
-}
-

static int msp_get_ctrl(struct i2c_client *client, struct v4l2_control *ctrl)
{
struct msp_state *state = i2c_get_clientdata(client);
@@ -656,7 +625,7 @@ static int msp_command(struct i2c_client
msp_set_scart(client, scart, 0);
msp_write_dsp(client, 0x000d, 0x1900);
if (state->opmode != OPMODE_AUTOSELECT)
- msp3400c_setstereo(client, state->audmode);
+ msp_set_audmode(client);
}
msp_wake_thread(client);
break;
@@ -670,8 +639,8 @@ static int msp_command(struct i2c_client
switch (state->opmode) {
case OPMODE_MANUAL:
/* set msp3400 to FM radio mode */
- msp3400c_setmode(client, MSP_MODE_FM_RADIO);
- msp3400c_setcarrier(client, MSP_CARRIER(10.7),
+ msp3400c_set_mode(client, MSP_MODE_FM_RADIO);
+ msp3400c_set_carrier(client, MSP_CARRIER(10.7),
MSP_CARRIER(10.7));
msp_set_audio(client);
break;
@@ -705,7 +674,7 @@ static int msp_command(struct i2c_client
if (state->radio)
break;
if (state->opmode == OPMODE_AUTOSELECT)
- msp_any_detect_stereo(client);
+ msp_detect_stereo(client);
va->mode = msp_mode_v4l2_to_v4l1(state->rxsubchans);
break;
}
@@ -721,8 +690,9 @@ static int msp_command(struct i2c_client
state->treble = va->treble;
msp_set_audio(client);

- if (va->mode != 0 && state->radio == 0)
- msp_any_set_audmode(client, msp_mode_v4l1_to_v4l2(va->mode));
+ if (va->mode != 0 && state->radio == 0) {
+ state->audmode = msp_mode_v4l1_to_v4l2(va->mode);
+ }
break;
}

@@ -864,7 +834,7 @@ static int msp_command(struct i2c_client
msp_set_scart(client, scart, 0);
msp_write_dsp(client, 0x000d, 0x1900);
}
- msp_any_set_audmode(client, state->audmode);
+ msp_set_audmode(client);
msp_wake_thread(client);
break;
}
@@ -876,7 +846,7 @@ static int msp_command(struct i2c_client
if (state->radio)
break;
if (state->opmode == OPMODE_AUTOSELECT)
- msp_any_detect_stereo(client);
+ msp_detect_stereo(client);
vt->audmode = state->audmode;
vt->rxsubchans = state->rxsubchans;
vt->capability = V4L2_TUNER_CAP_STEREO |
@@ -890,8 +860,9 @@ static int msp_command(struct i2c_client

if (state->radio) /* TODO: add mono/stereo support for radio */
break;
+ state->audmode = vt->audmode;
/* only set audmode */
- msp_any_set_audmode(client, vt->audmode);
+ msp_set_audmode(client);
break;
}

@@ -981,7 +952,7 @@ static int msp_command(struct i2c_client
const char *p;

if (state->opmode == OPMODE_AUTOSELECT)
- msp_any_detect_stereo(client);
+ msp_detect_stereo(client);
v4l_info(client, "%s rev1 = 0x%04x rev2 = 0x%04x\n",
client->name, state->rev1, state->rev2);
v4l_info(client, "Audio: volume %d%s\n",
@@ -1082,7 +1053,7 @@ static int msp_attach(struct i2c_adapter

memset(state, 0, sizeof(*state));
state->v4l2_std = V4L2_STD_NTSC;
- state->audmode = V4L2_TUNER_MODE_STEREO;
+ state->audmode = V4L2_TUNER_MODE_LANG1;
state->volume = 58880; /* 0db gain */
state->balance = 32768; /* 0db gain */
state->bass = 32768;
diff --git a/drivers/media/video/msp3400-kthreads.c b/drivers/media/video/msp3400-kthreads.c
diff --git a/drivers/media/video/msp3400-kthreads.c b/drivers/media/video/msp3400-kthreads.c
index 3235a15..c4668f4 100644
--- a/drivers/media/video/msp3400-kthreads.c
+++ b/drivers/media/video/msp3400-kthreads.c
@@ -109,7 +109,7 @@ static struct msp3400c_init_data_dem {
{-2, -8, -10, 10, 50, 86},
{-4, -12, -9, 23, 79, 126},
MSP_CARRIER(6.5), MSP_CARRIER(6.5),
- 0x00c6, 0x0140, 0x0120, 0x7c03
+ 0x00c6, 0x0140, 0x0120, 0x7c00
},
};

@@ -154,53 +154,60 @@ const char *msp_standard_std_name(int st
return "unknown";
}

-void msp3400c_setcarrier(struct i2c_client *client, int cdo1, int cdo2)
+void msp_set_source(struct i2c_client *client, u16 src)
+{
+ struct msp_state *state = i2c_get_clientdata(client);
+
+ if (msp_dolby) {
+ msp_write_dsp(client, 0x0008, 0x0520); /* I2S1 */
+ msp_write_dsp(client, 0x0009, 0x0620); /* I2S2 */
+ } else {
+ msp_write_dsp(client, 0x0008, src);
+ msp_write_dsp(client, 0x0009, src);
+ }
+ msp_write_dsp(client, 0x000a, src);
+ msp_write_dsp(client, 0x000b, src);
+ msp_write_dsp(client, 0x000c, src);
+ if (state->has_scart23_in_scart2_out)
+ msp_write_dsp(client, 0x0041, src);
+}
+
+void msp3400c_set_carrier(struct i2c_client *client, int cdo1, int cdo2)
{
msp_write_dem(client, 0x0093, cdo1 & 0xfff);
msp_write_dem(client, 0x009b, cdo1 >> 12);
msp_write_dem(client, 0x00a3, cdo2 & 0xfff);
msp_write_dem(client, 0x00ab, cdo2 >> 12);
- msp_write_dem(client, 0x0056, 0); /*LOAD_REG_1/2*/
+ msp_write_dem(client, 0x0056, 0); /* LOAD_REG_1/2 */
}

-void msp3400c_setmode(struct i2c_client *client, int type)
+void msp3400c_set_mode(struct i2c_client *client, int mode)
{
struct msp_state *state = i2c_get_clientdata(client);
+ struct msp3400c_init_data_dem *data = &msp3400c_init_data[mode];
int i;

- v4l_dbg(1, msp_debug, client, "setmode: %d\n", type);
- state->mode = type;
+ v4l_dbg(1, msp_debug, client, "set_mode: %d\n", mode);
+ state->mode = mode;
state->rxsubchans = V4L2_TUNER_SUB_MONO;

- msp_write_dem(client, 0x00bb, msp3400c_init_data[type].ad_cv);
+ msp_write_dem(client, 0x00bb, data->ad_cv);

for (i = 5; i >= 0; i--) /* fir 1 */
- msp_write_dem(client, 0x0001, msp3400c_init_data[type].fir1[i]);
+ msp_write_dem(client, 0x0001, data->fir1[i]);

msp_write_dem(client, 0x0005, 0x0004); /* fir 2 */
msp_write_dem(client, 0x0005, 0x0040);
msp_write_dem(client, 0x0005, 0x0000);
for (i = 5; i >= 0; i--)
- msp_write_dem(client, 0x0005, msp3400c_init_data[type].fir2[i]);
+ msp_write_dem(client, 0x0005, data->fir2[i]);

- msp_write_dem(client, 0x0083, msp3400c_init_data[type].mode_reg);
+ msp_write_dem(client, 0x0083, data->mode_reg);

- msp3400c_setcarrier(client, msp3400c_init_data[type].cdo1,
- msp3400c_init_data[type].cdo2);
+ msp3400c_set_carrier(client, data->cdo1, data->cdo2);

- msp_write_dem(client, 0x0056, 0); /*LOAD_REG_1/2*/
-
- if (msp_dolby) {
- msp_write_dsp(client, 0x0008, 0x0520); /* I2S1 */
- msp_write_dsp(client, 0x0009, 0x0620); /* I2S2 */
- msp_write_dsp(client, 0x000b, msp3400c_init_data[type].dsp_src);
- } else {
- msp_write_dsp(client, 0x0008, msp3400c_init_data[type].dsp_src);
- msp_write_dsp(client, 0x0009, msp3400c_init_data[type].dsp_src);
- msp_write_dsp(client, 0x000b, msp3400c_init_data[type].dsp_src);
- }
- msp_write_dsp(client, 0x000a, msp3400c_init_data[type].dsp_src);
- msp_write_dsp(client, 0x000e, msp3400c_init_data[type].dsp_matrix);
+ msp_set_source(client, data->dsp_src);
+ msp_write_dsp(client, 0x000e, data->dsp_matrix);

if (state->has_nicam) {
/* nicam prescale */
@@ -208,29 +215,31 @@ void msp3400c_setmode(struct i2c_client
}
}

-/* turn on/off nicam + stereo */
-void msp3400c_setstereo(struct i2c_client *client, int audmode)
+/* Set audio mode. Note that the pre-'G' models do not support BTSC+SAP,
+ nor do they support stereo BTSC. */
+void msp3400c_set_audmode(struct i2c_client *client)
{
static char *strmode[] = { "mono", "stereo", "lang2", "lang1" };
struct msp_state *state = i2c_get_clientdata(client);
- int nicam = 0; /* channel source: FM/AM or nicam */
- int src = 0;
+ char *modestr = (state->audmode >= 0 && state->audmode < 4) ?
+ strmode[state->audmode] : "unknown";
+ int src = 0; /* channel source: FM/AM, nicam or SCART */

if (state->opmode == OPMODE_AUTOSELECT) {
/* this method would break everything, let's make sure
* it's never called
*/
- v4l_dbg(1, msp_debug, client, "setstereo called with mode=%d instead of set_source (ignored)\n",
- audmode);
+ v4l_dbg(1, msp_debug, client,
+ "set_audmode called with mode=%d instead of set_source (ignored)\n",
+ state->audmode);
return;
}

/* switch demodulator */
switch (state->mode) {
case MSP_MODE_FM_TERRA:
- v4l_dbg(1, msp_debug, client, "FM setstereo: %s\n", strmode[audmode]);
- msp3400c_setcarrier(client, state->second, state->main);
- switch (audmode) {
+ v4l_dbg(1, msp_debug, client, "FM set_audmode: %s\n", modestr);
+ switch (state->audmode) {
case V4L2_TUNER_MODE_STEREO:
msp_write_dsp(client, 0x000e, 0x3001);
break;
@@ -242,50 +251,49 @@ void msp3400c_setstereo(struct i2c_clien
}
break;
case MSP_MODE_FM_SAT:
- v4l_dbg(1, msp_debug, client, "SAT setstereo: %s\n", strmode[audmode]);
- switch (audmode) {
+ v4l_dbg(1, msp_debug, client, "SAT set_audmode: %s\n", modestr);
+ switch (state->audmode) {
case V4L2_TUNER_MODE_MONO:
- msp3400c_setcarrier(client, MSP_CARRIER(6.5), MSP_CARRIER(6.5));
+ msp3400c_set_carrier(client, MSP_CARRIER(6.5), MSP_CARRIER(6.5));
break;
case V4L2_TUNER_MODE_STEREO:
- msp3400c_setcarrier(client, MSP_CARRIER(7.2), MSP_CARRIER(7.02));
+ msp3400c_set_carrier(client, MSP_CARRIER(7.2), MSP_CARRIER(7.02));
break;
case V4L2_TUNER_MODE_LANG1:
- msp3400c_setcarrier(client, MSP_CARRIER(7.38), MSP_CARRIER(7.02));
+ msp3400c_set_carrier(client, MSP_CARRIER(7.38), MSP_CARRIER(7.02));
break;
case V4L2_TUNER_MODE_LANG2:
- msp3400c_setcarrier(client, MSP_CARRIER(7.38), MSP_CARRIER(7.02));
+ msp3400c_set_carrier(client, MSP_CARRIER(7.38), MSP_CARRIER(7.02));
break;
}
break;
case MSP_MODE_FM_NICAM1:
case MSP_MODE_FM_NICAM2:
case MSP_MODE_AM_NICAM:
- v4l_dbg(1, msp_debug, client, "NICAM setstereo: %s\n",strmode[audmode]);
- msp3400c_setcarrier(client,state->second,state->main);
+ v4l_dbg(1, msp_debug, client, "NICAM set_audmode: %s\n",modestr);
+ msp3400c_set_carrier(client, state->second, state->main);
if (state->nicam_on)
- nicam=0x0100;
+ src = 0x0100; /* NICAM */
break;
case MSP_MODE_BTSC:
- v4l_dbg(1, msp_debug, client, "BTSC setstereo: %s\n",strmode[audmode]);
- nicam=0x0300;
+ v4l_dbg(1, msp_debug, client, "BTSC set_audmode: %s\n",modestr);
break;
case MSP_MODE_EXTERN:
- v4l_dbg(1, msp_debug, client, "extern setstereo: %s\n",strmode[audmode]);
- nicam = 0x0200;
+ v4l_dbg(1, msp_debug, client, "extern set_audmode: %s\n",modestr);
+ src = 0x0200; /* SCART */
break;
case MSP_MODE_FM_RADIO:
- v4l_dbg(1, msp_debug, client, "FM-Radio setstereo: %s\n",strmode[audmode]);
+ v4l_dbg(1, msp_debug, client, "FM-Radio set_audmode: %s\n",modestr);
break;
default:
- v4l_dbg(1, msp_debug, client, "mono setstereo\n");
+ v4l_dbg(1, msp_debug, client, "mono set_audmode\n");
return;
}

/* switch audio */
- switch (audmode) {
+ switch (state->audmode) {
case V4L2_TUNER_MODE_STEREO:
- src = 0x0020 | nicam;
+ src |= 0x0020;
break;
case V4L2_TUNER_MODE_MONO:
if (state->mode == MSP_MODE_AM_NICAM) {
@@ -296,29 +304,22 @@ void msp3400c_setstereo(struct i2c_clien
src = 0x0200;
break;
}
+ if (state->rxsubchans & V4L2_TUNER_SUB_STEREO)
+ src = 0x0030;
+ break;
case V4L2_TUNER_MODE_LANG1:
- src = 0x0000 | nicam;
+ /* switch to stereo for stereo transmission, otherwise
+ keep first language */
+ if (state->rxsubchans & V4L2_TUNER_SUB_STEREO)
+ src |= 0x0020;
break;
case V4L2_TUNER_MODE_LANG2:
- src = 0x0010 | nicam;
+ src |= 0x0010;
break;
}
- v4l_dbg(1, msp_debug, client, "setstereo final source/matrix = 0x%x\n", src);
+ v4l_dbg(1, msp_debug, client, "set_audmode final source/matrix = 0x%x\n", src);

- if (msp_dolby) {
- msp_write_dsp(client, 0x0008, 0x0520);
- msp_write_dsp(client, 0x0009, 0x0620);
- msp_write_dsp(client, 0x000a, src);
- msp_write_dsp(client, 0x000b, src);
- } else {
- msp_write_dsp(client, 0x0008, src);
- msp_write_dsp(client, 0x0009, src);
- msp_write_dsp(client, 0x000a, src);
- msp_write_dsp(client, 0x000b, src);
- msp_write_dsp(client, 0x000c, src);
- if (state->has_scart23_in_scart2_out)
- msp_write_dsp(client, 0x0041, src);
- }
+ msp_set_source(client, src);
}

static void msp3400c_print_mode(struct i2c_client *client)
@@ -346,12 +347,12 @@ static void msp3400c_print_mode(struct i

/* ----------------------------------------------------------------------- */

-int autodetect_stereo(struct i2c_client *client)
+static int msp3400c_detect_stereo(struct i2c_client *client)
{
struct msp_state *state = i2c_get_clientdata(client);
int val;
int rxsubchans = state->rxsubchans;
- int newnicam = state->nicam_on;
+ int newnicam = state->nicam_on;
int update = 0;

switch (state->mode) {
@@ -361,7 +362,7 @@ int autodetect_stereo(struct i2c_client
val -= 65536;
v4l_dbg(2, msp_debug, client, "stereo detect register: %d\n", val);
if (val > 4096) {
- rxsubchans = V4L2_TUNER_SUB_STEREO | V4L2_TUNER_SUB_MONO;
+ rxsubchans = V4L2_TUNER_SUB_STEREO;
} else if (val < -4096) {
rxsubchans = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2;
} else {
@@ -385,14 +386,11 @@ int autodetect_stereo(struct i2c_client
break;
case 1:
case 9:
- rxsubchans = V4L2_TUNER_SUB_MONO
- | V4L2_TUNER_SUB_LANG1;
+ rxsubchans = V4L2_TUNER_SUB_MONO;
break;
case 2:
case 10:
- rxsubchans = V4L2_TUNER_SUB_MONO
- | V4L2_TUNER_SUB_LANG1
- | V4L2_TUNER_SUB_LANG2;
+ rxsubchans = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2;
break;
default:
rxsubchans = V4L2_TUNER_SUB_MONO;
@@ -404,30 +402,17 @@ int autodetect_stereo(struct i2c_client
rxsubchans = V4L2_TUNER_SUB_MONO;
}
break;
- case MSP_MODE_BTSC:
- val = msp_read_dem(client, 0x200);
- v4l_dbg(2, msp_debug, client, "status=0x%x (pri=%s, sec=%s, %s%s%s)\n",
- val,
- (val & 0x0002) ? "no" : "yes",
- (val & 0x0004) ? "no" : "yes",
- (val & 0x0040) ? "stereo" : "mono",
- (val & 0x0080) ? ", nicam 2nd mono" : "",
- (val & 0x0100) ? ", bilingual/SAP" : "");
- rxsubchans = V4L2_TUNER_SUB_MONO;
- if (val & 0x0040) rxsubchans |= V4L2_TUNER_SUB_STEREO;
- if (val & 0x0100) rxsubchans |= V4L2_TUNER_SUB_LANG1;
- break;
}
if (rxsubchans != state->rxsubchans) {
update = 1;
- v4l_dbg(1, msp_debug, client, "watch: rxsubchans %d => %d\n",
- state->rxsubchans,rxsubchans);
+ v4l_dbg(1, msp_debug, client, "watch: rxsubchans %02x => %02x\n",
+ state->rxsubchans, rxsubchans);
state->rxsubchans = rxsubchans;
}
if (newnicam != state->nicam_on) {
update = 1;
v4l_dbg(1, msp_debug, client, "watch: nicam %d => %d\n",
- state->nicam_on,newnicam);
+ state->nicam_on, newnicam);
state->nicam_on = newnicam;
}
return update;
@@ -442,13 +427,8 @@ static void watch_stereo(struct i2c_clie
{
struct msp_state *state = i2c_get_clientdata(client);

- if (autodetect_stereo(client)) {
- if (state->rxsubchans & V4L2_TUNER_SUB_STEREO)
- msp3400c_setstereo(client, V4L2_TUNER_MODE_STEREO);
- else if (state->rxsubchans & V4L2_TUNER_SUB_LANG1)
- msp3400c_setstereo(client, V4L2_TUNER_MODE_LANG1);
- else
- msp3400c_setstereo(client, V4L2_TUNER_MODE_MONO);
+ if (msp3400c_detect_stereo(client)) {
+ msp3400c_set_audmode(client);
}

if (msp_once)
@@ -460,7 +440,7 @@ int msp3400c_thread(void *data)
struct i2c_client *client = data;
struct msp_state *state = i2c_get_clientdata(client);
struct msp3400c_carrier_detect *cd;
- int count, max1,max2,val1,val2, val,this;
+ int count, max1, max2, val1, val2, val, this;


v4l_dbg(1, msp_debug, client, "msp3400 daemon started\n");
@@ -470,7 +450,7 @@ int msp3400c_thread(void *data)
v4l_dbg(2, msp_debug, client, "msp3400 thread: wakeup\n");

restart:
- v4l_dbg(1, msp_debug, client, "thread: restart scan\n");
+ v4l_dbg(2, msp_debug, client, "thread: restart scan\n");
state->restart = 0;
if (kthread_should_stop())
break;
@@ -484,13 +464,14 @@ int msp3400c_thread(void *data)

/* mute */
msp_set_mute(client);
- msp3400c_setmode(client, MSP_MODE_AM_DETECT /* +1 */ );
+ msp3400c_set_mode(client, MSP_MODE_AM_DETECT /* +1 */ );
val1 = val2 = 0;
max1 = max2 = -1;
state->watch_stereo = 0;
+ state->nicam_on = 0;

/* some time for the tuner to sync */
- if (msp_sleep(state,200))
+ if (msp_sleep(state, 200))
goto restart;

/* carrier detect pass #1 -- main carrier */
@@ -505,7 +486,7 @@ int msp3400c_thread(void *data)
}

for (this = 0; this < count; this++) {
- msp3400c_setcarrier(client, cd[this].cdo,cd[this].cdo);
+ msp3400c_set_carrier(client, cd[this].cdo, cd[this].cdo);
if (msp_sleep(state,100))
goto restart;
val = msp_read_dsp(client, 0x1b);
@@ -541,7 +522,7 @@ int msp3400c_thread(void *data)
max2 = 0;
}
for (this = 0; this < count; this++) {
- msp3400c_setcarrier(client, cd[this].cdo,cd[this].cdo);
+ msp3400c_set_carrier(client, cd[this].cdo, cd[this].cdo);
if (msp_sleep(state,100))
goto restart;
val = msp_read_dsp(client, 0x1b);
@@ -553,22 +534,20 @@ int msp3400c_thread(void *data)
}

/* program the msp3400 according to the results */
- state->main = msp3400c_carrier_detect_main[max1].cdo;
+ state->main = msp3400c_carrier_detect_main[max1].cdo;
switch (max1) {
case 1: /* 5.5 */
if (max2 == 0) {
/* B/G FM-stereo */
state->second = msp3400c_carrier_detect_55[max2].cdo;
- msp3400c_setmode(client, MSP_MODE_FM_TERRA);
- state->nicam_on = 0;
- msp3400c_setstereo(client, V4L2_TUNER_MODE_MONO);
+ msp3400c_set_mode(client, MSP_MODE_FM_TERRA);
state->watch_stereo = 1;
} else if (max2 == 1 && state->has_nicam) {
/* B/G NICAM */
state->second = msp3400c_carrier_detect_55[max2].cdo;
- msp3400c_setmode(client, MSP_MODE_FM_NICAM1);
+ msp3400c_set_mode(client, MSP_MODE_FM_NICAM1);
+ msp3400c_set_carrier(client, state->second, state->main);
state->nicam_on = 1;
- msp3400c_setcarrier(client, state->second, state->main);
state->watch_stereo = 1;
} else {
goto no_second;
@@ -577,35 +556,31 @@ int msp3400c_thread(void *data)
case 2: /* 6.0 */
/* PAL I NICAM */
state->second = MSP_CARRIER(6.552);
- msp3400c_setmode(client, MSP_MODE_FM_NICAM2);
+ msp3400c_set_mode(client, MSP_MODE_FM_NICAM2);
+ msp3400c_set_carrier(client, state->second, state->main);
state->nicam_on = 1;
- msp3400c_setcarrier(client, state->second, state->main);
state->watch_stereo = 1;
break;
case 3: /* 6.5 */
if (max2 == 1 || max2 == 2) {
/* D/K FM-stereo */
state->second = msp3400c_carrier_detect_65[max2].cdo;
- msp3400c_setmode(client, MSP_MODE_FM_TERRA);
- state->nicam_on = 0;
- msp3400c_setstereo(client, V4L2_TUNER_MODE_MONO);
+ msp3400c_set_mode(client, MSP_MODE_FM_TERRA);
state->watch_stereo = 1;
} else if (max2 == 0 && (state->v4l2_std & V4L2_STD_SECAM)) {
/* L NICAM or AM-mono */
state->second = msp3400c_carrier_detect_65[max2].cdo;
- msp3400c_setmode(client, MSP_MODE_AM_NICAM);
- state->nicam_on = 0;
- msp3400c_setstereo(client, V4L2_TUNER_MODE_MONO);
- msp3400c_setcarrier(client, state->second, state->main);
+ msp3400c_set_mode(client, MSP_MODE_AM_NICAM);
+ msp3400c_set_carrier(client, state->second, state->main);
/* volume prescale for SCART (AM mono input) */
msp_write_dsp(client, 0x000d, 0x1900);
state->watch_stereo = 1;
} else if (max2 == 0 && state->has_nicam) {
/* D/K NICAM */
state->second = msp3400c_carrier_detect_65[max2].cdo;
- msp3400c_setmode(client, MSP_MODE_FM_NICAM1);
+ msp3400c_set_mode(client, MSP_MODE_FM_NICAM1);
+ msp3400c_set_carrier(client, state->second, state->main);
state->nicam_on = 1;
- msp3400c_setcarrier(client, state->second, state->main);
state->watch_stereo = 1;
} else {
goto no_second;
@@ -615,23 +590,25 @@ int msp3400c_thread(void *data)
default:
no_second:
state->second = msp3400c_carrier_detect_main[max1].cdo;
- msp3400c_setmode(client, MSP_MODE_FM_TERRA);
- state->nicam_on = 0;
- msp3400c_setcarrier(client, state->second, state->main);
+ msp3400c_set_mode(client, MSP_MODE_FM_TERRA);
+ msp3400c_set_carrier(client, state->second, state->main);
state->rxsubchans = V4L2_TUNER_SUB_MONO;
- msp3400c_setstereo(client, V4L2_TUNER_MODE_MONO);
break;
}

/* unmute */
msp_set_audio(client);
+ msp3400c_set_audmode(client);

if (msp_debug)
msp3400c_print_mode(client);

- /* monitor tv audio mode */
+ /* monitor tv audio mode, the first time don't wait
+ so long to get a quick stereo/bilingual result */
+ if (msp_sleep(state, 1000))
+ goto restart;
while (state->watch_stereo) {
- if (msp_sleep(state,5000))
+ if (msp_sleep(state, 5000))
goto restart;
watch_stereo(client);
}
@@ -655,7 +632,7 @@ int msp3410d_thread(void *data)
v4l_dbg(2, msp_debug, client, "msp3410 thread: wakeup\n");

restart:
- v4l_dbg(1, msp_debug, client, "thread: restart scan\n");
+ v4l_dbg(2, msp_debug, client, "thread: restart scan\n");
state->restart = 0;
if (kthread_should_stop())
break;
@@ -680,9 +657,10 @@ int msp3410d_thread(void *data)
else
std = (state->v4l2_std & V4L2_STD_NTSC) ? 0x20 : 1;
state->watch_stereo = 0;
+ state->nicam_on = 0;

if (msp_debug)
- v4l_dbg(1, msp_debug, client, "setting standard: %s (0x%04x)\n",
+ v4l_dbg(2, msp_debug, client, "setting standard: %s (0x%04x)\n",
msp_standard_std_name(std), std);

if (std != 1) {
@@ -699,7 +677,7 @@ int msp3410d_thread(void *data)
val = msp_read_dem(client, 0x7e);
if (val < 0x07ff)
break;
- v4l_dbg(1, msp_debug, client, "detection still in progress\n");
+ v4l_dbg(2, msp_debug, client, "detection still in progress\n");
}
}
for (i = 0; msp_stdlist[i].name != NULL; i++)
@@ -738,46 +716,34 @@ int msp3410d_thread(void *data)
state->rxsubchans = V4L2_TUNER_SUB_STEREO;
state->nicam_on = 1;
state->watch_stereo = 1;
- msp3400c_setstereo(client,V4L2_TUNER_MODE_STEREO);
break;
case 0x0009:
state->mode = MSP_MODE_AM_NICAM;
state->rxsubchans = V4L2_TUNER_SUB_MONO;
state->nicam_on = 1;
- msp3400c_setstereo(client,V4L2_TUNER_MODE_MONO);
state->watch_stereo = 1;
break;
case 0x0020: /* BTSC */
- /* just turn on stereo */
+ /* The pre-'G' models only have BTSC-mono */
state->mode = MSP_MODE_BTSC;
- state->rxsubchans = V4L2_TUNER_SUB_STEREO;
- state->nicam_on = 0;
- state->watch_stereo = 1;
- msp3400c_setstereo(client,V4L2_TUNER_MODE_STEREO);
+ state->rxsubchans = V4L2_TUNER_SUB_MONO;
break;
case 0x0040: /* FM radio */
state->mode = MSP_MODE_FM_RADIO;
state->rxsubchans = V4L2_TUNER_SUB_STEREO;
- state->nicam_on = 0;
- state->watch_stereo = 0;
/* not needed in theory if we have radio, but
short programming enables carrier mute */
- msp3400c_setmode(client, MSP_MODE_FM_RADIO);
- msp3400c_setcarrier(client, MSP_CARRIER(10.7),
+ msp3400c_set_mode(client, MSP_MODE_FM_RADIO);
+ msp3400c_set_carrier(client, MSP_CARRIER(10.7),
MSP_CARRIER(10.7));
- /* scart routing */
+ /* scart routing (this doesn't belong here I think) */
msp_set_scart(client,SCART_IN2,0);
- /* msp34xx does radio decoding */
- msp_write_dsp(client, 0x08, 0x0020);
- msp_write_dsp(client, 0x09, 0x0020);
- msp_write_dsp(client, 0x0b, 0x0020);
break;
case 0x0003:
case 0x0004:
case 0x0005:
state->mode = MSP_MODE_FM_TERRA;
state->rxsubchans = V4L2_TUNER_SUB_MONO;
- state->nicam_on = 0;
state->watch_stereo = 1;
break;
}
@@ -788,11 +754,16 @@ int msp3410d_thread(void *data)
if (state->has_i2s_conf)
msp_write_dem(client, 0x40, state->i2s_mode);

- /* monitor tv audio mode */
+ msp3400c_set_audmode(client);
+
+ /* monitor tv audio mode, the first time don't wait
+ so long to get a quick stereo/bilingual result */
+ if (msp_sleep(state, 1000))
+ goto restart;
while (state->watch_stereo) {
- if (msp_sleep(state,5000))
- goto restart;
watch_stereo(client);
+ if (msp_sleep(state, 5000))
+ goto restart;
}
}
v4l_dbg(1, msp_debug, client, "thread: exit\n");
@@ -810,7 +781,7 @@ int msp3410d_thread(void *data)
* the value for source is the same as bit 15:8 of DSP registers 0x08,
* 0x0a and 0x0c: 0=mono, 1=stereo or A|B, 2=SCART, 3=stereo or A, 4=stereo or B
*
- * this function replaces msp3400c_setstereo
+ * this function replaces msp3400c_set_audmode
*/
static void msp34xxg_set_source(struct i2c_client *client, int source)
{
@@ -823,12 +794,7 @@ static void msp34xxg_set_source(struct i
int value = (source & 0x07) << 8 | (source == 0 ? 0x30 : 0x20);

v4l_dbg(1, msp_debug, client, "set source to %d (0x%x)\n", source, value);
- /* Loudspeaker Output */
- msp_write_dsp(client, 0x08, value);
- /* SCART1 DA Output */
- msp_write_dsp(client, 0x0a, value);
- /* Quasi-peak detector */
- msp_write_dsp(client, 0x0c, value);
+ msp_set_source(client, value);
/*
* set identification threshold. Personally, I
* I set it to a higher value that the default
@@ -945,13 +911,14 @@ int msp34xxg_thread(void *data)
if (msp_write_dsp(client, 0x13, state->acb))
return -1;

- msp_write_dem(client, 0x40, state->i2s_mode);
+ if (state->has_i2s_conf)
+ msp_write_dem(client, 0x40, state->i2s_mode);
}
v4l_dbg(1, msp_debug, client, "thread: exit\n");
return 0;
}

-void msp34xxg_detect_stereo(struct i2c_client *client)
+static void msp34xxg_detect_stereo(struct i2c_client *client)
{
struct msp_state *state = i2c_get_clientdata(client);

@@ -961,11 +928,11 @@ void msp34xxg_detect_stereo(struct i2c_c

state->rxsubchans = 0;
if (is_stereo)
- state->rxsubchans |= V4L2_TUNER_SUB_STEREO;
+ state->rxsubchans = V4L2_TUNER_SUB_STEREO;
else
- state->rxsubchans |= V4L2_TUNER_SUB_MONO;
+ state->rxsubchans = V4L2_TUNER_SUB_MONO;
if (is_bilingual) {
- state->rxsubchans |= V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2;
+ state->rxsubchans = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2;
/* I'm supposed to check whether it's SAP or not
* and set only LANG2/SAP in this case. Yet, the MSP
* does a lot of work to hide this and handle everything
@@ -977,12 +944,12 @@ void msp34xxg_detect_stereo(struct i2c_c
status, is_stereo, is_bilingual, state->rxsubchans);
}

-void msp34xxg_set_audmode(struct i2c_client *client, int audmode)
+void msp34xxg_set_audmode(struct i2c_client *client)
{
struct msp_state *state = i2c_get_clientdata(client);
int source;

- switch (audmode) {
+ switch (state->audmode) {
case V4L2_TUNER_MODE_MONO:
source = 0; /* mono only */
break;
@@ -997,11 +964,40 @@ void msp34xxg_set_audmode(struct i2c_cli
source = 4; /* stereo or B */
break;
default:
- audmode = 0;
source = 1;
break;
}
- state->audmode = audmode;
msp34xxg_set_source(client, source);
}

+void msp_set_audmode(struct i2c_client *client)
+{
+ struct msp_state *state = i2c_get_clientdata(client);
+
+ switch (state->opmode) {
+ case OPMODE_MANUAL:
+ case OPMODE_AUTODETECT:
+ state->watch_stereo = 0;
+ msp3400c_set_audmode(client);
+ break;
+ case OPMODE_AUTOSELECT:
+ msp34xxg_set_audmode(client);


+ break;
+ }
+}
+

+void msp_detect_stereo(struct i2c_client *client)
+{
+ struct msp_state *state = i2c_get_clientdata(client);
+
+ switch (state->opmode) {
+ case OPMODE_MANUAL:
+ case OPMODE_AUTODETECT:
+ msp3400c_detect_stereo(client);
+ break;
+ case OPMODE_AUTOSELECT:
+ msp34xxg_detect_stereo(client);


+ break;
+ }
+}
+

diff --git a/drivers/media/video/msp3400.h b/drivers/media/video/msp3400.h
diff --git a/drivers/media/video/msp3400.h b/drivers/media/video/msp3400.h
index a9ac57d..4182830 100644
--- a/drivers/media/video/msp3400.h
+++ b/drivers/media/video/msp3400.h
@@ -104,14 +104,13 @@ int msp_sleep(struct msp_state *state, i

/* msp3400-kthreads.c */
const char *msp_standard_std_name(int std);
-void msp3400c_setcarrier(struct i2c_client *client, int cdo1, int cdo2);
-void msp3400c_setmode(struct i2c_client *client, int type);
-void msp3400c_setstereo(struct i2c_client *client, int mode);
-int autodetect_stereo(struct i2c_client *client);
+void msp_set_source(struct i2c_client *client, u16 src);
+void msp_set_audmode(struct i2c_client *client);
+void msp_detect_stereo(struct i2c_client *client);
int msp3400c_thread(void *data);
int msp3410d_thread(void *data);
int msp34xxg_thread(void *data);
-void msp34xxg_detect_stereo(struct i2c_client *client);
-void msp34xxg_set_audmode(struct i2c_client *client, int audmode);
+void msp3400c_set_mode(struct i2c_client *client, int mode);
+void msp3400c_set_carrier(struct i2c_client *client, int cdo1, int cdo2);

#endif /* MSP3400_H */


diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c

index 2995b22..af3e7bb 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -398,15 +398,16 @@ static void tuner_status(struct i2c_clie
tuner_info("Tuner mode: %s\n", p);
tuner_info("Frequency: %lu.%02lu MHz\n", freq, freq_fraction);
tuner_info("Standard: 0x%08llx\n", t->std);
- if (t->mode == V4L2_TUNER_RADIO) {
- if (t->has_signal) {
- tuner_info("Signal strength: %d\n", t->has_signal(client));
- }
- if (t->is_stereo) {
- tuner_info("Stereo: %s\n", t->is_stereo(client) ? "yes" : "no");
- }
+ if (t->mode != V4L2_TUNER_RADIO)
+ return;
+ if (t->has_signal) {
+ tuner_info("Signal strength: %d\n", t->has_signal(client));
+ }
+ if (t->is_stereo) {
+ tuner_info("Stereo: %s\n", t->is_stereo(client) ? "yes" : "no");
}
}
+
/* ---------------------------------------------------------------------- */

/* static var Used only in tuner_attach and tuner_probe */
@@ -737,33 +738,29 @@ static int tuner_command(struct i2c_clie
return 0;
switch_v4l2();

- if (V4L2_TUNER_RADIO == t->mode) {
-
- if (t->has_signal)
- tuner->signal = t->has_signal(client);
-
- if (t->is_stereo) {
- if (t->is_stereo(client)) {
- tuner->rxsubchans =
- V4L2_TUNER_SUB_STEREO |
- V4L2_TUNER_SUB_MONO;
- } else {
- tuner->rxsubchans =
- V4L2_TUNER_SUB_MONO;
- }
- }
-
- tuner->capability |=
- V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO;
-
- tuner->audmode = t->audmode;
-
- tuner->rangelow = radio_range[0] * 16000;
- tuner->rangehigh = radio_range[1] * 16000;
- } else {
+ tuner->type = t->mode;
+ if (t->mode != V4L2_TUNER_RADIO) {
tuner->rangelow = tv_range[0] * 16;
tuner->rangehigh = tv_range[1] * 16;
+ break;
}
+
+ /* radio mode */
+ if (t->has_signal)
+ tuner->signal = t->has_signal(client);
+
+ tuner->rxsubchans =
+ V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO;
+ if (t->is_stereo) {
+ tuner->rxsubchans = t->is_stereo(client) ?
+ V4L2_TUNER_SUB_STEREO : V4L2_TUNER_SUB_MONO;
+ }
+
+ tuner->capability |=
+ V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO;
+ tuner->audmode = t->audmode;
+ tuner->rangelow = radio_range[0] * 16000;
+ tuner->rangehigh = radio_range[1] * 16000;
break;
}
case VIDIOC_S_TUNER:
@@ -775,10 +772,11 @@ static int tuner_command(struct i2c_clie

switch_v4l2();

- if (V4L2_TUNER_RADIO == t->mode) {
- t->audmode = tuner->audmode;
- set_radio_freq(client, t->radio_freq);
- }
+ /* do nothing unless we're a radio tuner */
+ if (t->mode != V4L2_TUNER_RADIO)
+ break;
+ t->audmode = tuner->audmode;
+ set_radio_freq(client, t->radio_freq);
break;
}
case VIDIOC_LOG_STATUS:


diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c
diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c

index c8e5ad0..4efb01b 100644
--- a/drivers/media/video/tvaudio.c
+++ b/drivers/media/video/tvaudio.c
@@ -130,6 +130,7 @@ struct CHIPSTATE {
struct timer_list wt;
int done;
int watch_stereo;
+ int audmode;
};

/* ---------------------------------------------------------------------- */
@@ -1514,6 +1515,7 @@ static int chip_attach(struct i2c_adapte
chip->type = desc-chiplist;
chip->shadow.count = desc->registers+1;
chip->prevmode = -1;
+ chip->audmode = V4L2_TUNER_MODE_LANG1;
/* register */
i2c_attach_client(&chip->c);

@@ -1671,6 +1673,8 @@ static int chip_command(struct i2c_clien
struct v4l2_tuner *vt = arg;
int mode = 0;

+ if (chip->radio)
+ break;
switch (vt->audmode) {
case V4L2_TUNER_MODE_MONO:
mode = VIDEO_SOUND_MONO;
@@ -1685,8 +1689,9 @@ static int chip_command(struct i2c_clien
mode = VIDEO_SOUND_LANG2;
break;
default:
- break;
+ return -EINVAL;
}
+ chip->audmode = vt->audmode;

if (desc->setmode && mode) {
chip->watch_stereo = 0;
@@ -1704,7 +1709,7 @@ static int chip_command(struct i2c_clien

if (chip->radio)
break;
- vt->audmode = 0;
+ vt->audmode = chip->audmode;
vt->rxsubchans = 0;
vt->capability = V4L2_TUNER_CAP_STEREO |
V4L2_TUNER_CAP_LANG1 | V4L2_TUNER_CAP_LANG2;
@@ -1716,19 +1721,12 @@ static int chip_command(struct i2c_clien
vt->rxsubchans |= V4L2_TUNER_SUB_MONO;
if (mode & VIDEO_SOUND_STEREO)
vt->rxsubchans |= V4L2_TUNER_SUB_STEREO;
+ /* Note: for SAP it should be mono/lang2 or stereo/lang2.
+ When this module is converted fully to v4l2, then this
+ should change for those chips that can detect SAP. */
if (mode & VIDEO_SOUND_LANG1)
- vt->rxsubchans |= V4L2_TUNER_SUB_LANG1 |
- V4L2_TUNER_SUB_LANG2;
-
- mode = chip->mode;
- if (mode & VIDEO_SOUND_MONO)
- vt->audmode = V4L2_TUNER_MODE_MONO;
- if (mode & VIDEO_SOUND_STEREO)
- vt->audmode = V4L2_TUNER_MODE_STEREO;
- if (mode & VIDEO_SOUND_LANG1)
- vt->audmode = V4L2_TUNER_MODE_LANG1;
- if (mode & VIDEO_SOUND_LANG2)
- vt->audmode = V4L2_TUNER_MODE_LANG2;
+ vt->rxsubchans = V4L2_TUNER_SUB_LANG1 |
+ V4L2_TUNER_SUB_LANG2;
break;

mch...@infradead.org

unread,
Mar 20, 2006, 11:10:20 AM3/20/06
to
From: Hartmut Hackmann <hartmut....@t-online.de>
Date: 1139302150 -0200

- Set outputs to tristate in sleep mode
- Reduce dangerously high firmware download speed with 16MHz xtal
- added tda827x configuration with GPIOs low
- added comments to stupid looking IIC reads that work around bugs in
the tda10046.
- some minor updates

Signed-off-by: Hartmut Hackmann <hartmut....@t-online.de>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/dvb/frontends/tda1004x.c b/drivers/media/dvb/frontends/tda1004x.c
diff --git a/drivers/media/dvb/frontends/tda1004x.c b/drivers/media/dvb/frontends/tda1004x.c
index c63e9a5..8e8df7b 100644
--- a/drivers/media/dvb/frontends/tda1004x.c
+++ b/drivers/media/dvb/frontends/tda1004x.c
@@ -229,7 +229,7 @@ static int tda1004x_enable_tuner_i2c(str
dprintk("%s\n", __FUNCTION__);

result = tda1004x_write_mask(state, TDA1004X_CONFC4, 2, 2);
- msleep(1);
+ msleep(20);
return result;
}

@@ -502,7 +502,12 @@ static int tda10046_fwupload(struct dvb_
const struct firmware *fw;

/* reset + wake up chip */
- tda1004x_write_byteI(state, TDA1004X_CONFC4, 0);
+ if (state->config->xtal_freq == TDA10046_XTAL_4M) {
+ tda1004x_write_byteI(state, TDA1004X_CONFC4, 0);
+ } else {
+ dprintk("%s: 16MHz Xtal, reducing I2C speed\n", __FUNCTION__);
+ tda1004x_write_byteI(state, TDA1004X_CONFC4, 0x80);
+ }
tda1004x_write_mask(state, TDA10046H_CONF_TRISTATE1, 1, 0);
/* let the clocks recover from sleep */
msleep(5);
@@ -651,7 +656,7 @@ static int tda10046_init(struct dvb_fron
// tda setup
tda1004x_write_mask(state, TDA1004X_CONFC4, 0x20, 0); // disable DSP watchdog timer
tda1004x_write_byteI(state, TDA1004X_AUTO, 0x87); // 100 ppm crystal, select HP stream
- tda1004x_write_byteI(state, TDA1004X_CONFC1, 8); // disable pulse killer
+ tda1004x_write_byteI(state, TDA1004X_CONFC1, 0x88); // enable pulse killer

switch (state->config->agc_config) {
case TDA10046_AGC_DEFAULT:
@@ -672,6 +677,12 @@ static int tda10046_init(struct dvb_fron
tda1004x_write_byteI(state, TDA10046H_AGC_RENORM, 0x08); // Gain Renormalize
tda1004x_write_byteI(state, TDA10046H_CONF_POLARITY, 0x6a); // set AGC polarities
break;
+ case TDA10046_AGC_TDA827X_GPL:
+ tda1004x_write_byteI(state, TDA10046H_AGC_CONF, 0x02); // AGC setup
+ tda1004x_write_byteI(state, TDA10046H_AGC_THR, 0x70); // AGC Threshold
+ tda1004x_write_byteI(state, TDA10046H_AGC_RENORM, 0x08); // Gain Renormalize
+ tda1004x_write_byteI(state, TDA10046H_CONF_POLARITY, 0x60); // set AGC polarities
+ break;
}
tda1004x_write_byteI(state, TDA1004X_CONFADC2, 0x38);
tda1004x_write_byteI(state, TDA10046H_CONF_TRISTATE1, 0x61); // Turn both AGC outputs on
@@ -683,6 +694,7 @@ static int tda10046_init(struct dvb_fron
tda1004x_write_byteI(state, TDA10046H_CVBER_CTRL, 0x1a); // 10^6 VBER measurement bits
tda1004x_write_byteI(state, TDA1004X_CONF_TS1, 7); // MPEG2 interface config
tda1004x_write_byteI(state, TDA1004X_CONF_TS2, 0xc0); // MPEG2 interface config
+ // tda1004x_write_mask(state, 0x50, 0x80, 0x80); // handle out of guard echoes
tda1004x_write_mask(state, 0x3a, 0x80, state->config->invert_oclk << 7);

state->initialised = 1;
@@ -1027,6 +1039,7 @@ static int tda1004x_read_status(struct d
if (status == -1)
return -EIO;
cber |= (status << 8);
+ // The address 0x20 should be read to cope with a TDA10046 bug
tda1004x_read_byte(state, TDA1004X_CBER_RESET);

if (cber != 65535)
@@ -1047,7 +1060,8 @@ static int tda1004x_read_status(struct d
status = tda1004x_read_byte(state, TDA1004X_VBER_MSB);
if (status == -1)
return -EIO;
- vber |= ((status << 16) & 0x0f);
+ vber |= (status & 0x0f) << 16;
+ // The CVBER_LUT should be read to cope with TDA10046 hardware bug
tda1004x_read_byte(state, TDA1004X_CVBER_LUT);

// if RS has passed some valid TS packets, then we must be
@@ -1161,6 +1175,7 @@ static int tda1004x_read_ber(struct dvb_
if (tmp < 0)
return -EIO;
*ber |= (tmp << 9);
+ // The address 0x20 should be read to cope with a TDA10046 bug
tda1004x_read_byte(state, TDA1004X_CBER_RESET);

dprintk("%s: ber=0x%x\n", __FUNCTION__, *ber);
@@ -1187,6 +1202,8 @@ static int tda1004x_sleep(struct dvb_fro
tda1004x_disable_tuner_i2c(state);
}
}
+ /* set outputs to tristate */
+ tda1004x_write_byteI(state, TDA10046H_CONF_TRISTATE1, 0xff);
tda1004x_write_mask(state, TDA1004X_CONFC4, 1, 1);
break;
}
diff --git a/drivers/media/dvb/frontends/tda1004x.h b/drivers/media/dvb/frontends/tda1004x.h
diff --git a/drivers/media/dvb/frontends/tda1004x.h b/drivers/media/dvb/frontends/tda1004x.h
index 8659c52..cc0c4af 100644
--- a/drivers/media/dvb/frontends/tda1004x.h
+++ b/drivers/media/dvb/frontends/tda1004x.h
@@ -35,7 +35,8 @@ enum tda10046_agc {
TDA10046_AGC_DEFAULT, /* original configuration */
TDA10046_AGC_IFO_AUTO_NEG, /* IF AGC only, automatic, negtive */
TDA10046_AGC_IFO_AUTO_POS, /* IF AGC only, automatic, positive */
- TDA10046_AGC_TDA827X, /* IF AGC only, special setup for tda827x */
+ TDA10046_AGC_TDA827X, /* IF AGC only, special setup for tda827x */
+ TDA10046_AGC_TDA827X_GPL, /* same as above, but GPIOs 0 */
};

enum tda10046_if {

mch...@infradead.org

unread,
Mar 20, 2006, 11:10:21 AM3/20/06
to
From: Michael Krufky <mkr...@linuxtv.org>
Date: 1141182282 -0300

- The tuner used in DViCO FusionHDTV DVB-T hybrid is made by Thomson
- renamed tuner and dvb_pll structs accordingly

Signed-off-by: Michael Krufky <mkr...@linuxtv.org>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/Documentation/video4linux/CARDLIST.tuner b/Documentation/video4linux/CARDLIST.tuner
diff --git a/Documentation/video4linux/CARDLIST.tuner b/Documentation/video4linux/CARDLIST.tuner
index ab344c9..603f165 100644
--- a/Documentation/video4linux/CARDLIST.tuner
+++ b/Documentation/video4linux/CARDLIST.tuner
@@ -70,4 +70,4 @@ tuner=68 - Philips TUV1236D ATSC/NTSC du
tuner=69 - Tena TNF 5335 MF
tuner=70 - Samsung TCPN 2121P30A
tuner=71 - Xceive xc3028
-tuner=72 - FE6600
+tuner=72 - Thomson FE6600
diff --git a/drivers/media/dvb/frontends/dvb-pll.c b/drivers/media/dvb/frontends/dvb-pll.c
diff --git a/drivers/media/dvb/frontends/dvb-pll.c b/drivers/media/dvb/frontends/dvb-pll.c
index 8a4c904..b6e2c38 100644
--- a/drivers/media/dvb/frontends/dvb-pll.c
+++ b/drivers/media/dvb/frontends/dvb-pll.c
@@ -405,8 +405,8 @@ struct dvb_pll_desc dvb_pll_philips_td13
EXPORT_SYMBOL(dvb_pll_philips_td1316);

/* FE6600 used on DViCO Hybrid */
-struct dvb_pll_desc dvb_pll_unknown_fe6600 = {
- .name = "FE6600",
+struct dvb_pll_desc dvb_pll_thomson_fe6600 = {
+ .name = "Thomson FE6600",
.min = 44250000,
.max = 858000000,
.count = 4,
@@ -417,7 +417,7 @@ struct dvb_pll_desc dvb_pll_unknown_fe66
{ 999999999, 36213333, 166667, 0xf4, 0x18 },
}
};
-EXPORT_SYMBOL(dvb_pll_unknown_fe6600);
+EXPORT_SYMBOL(dvb_pll_thomson_fe6600);

/* ----------------------------------------------------------- */
/* code */
diff --git a/drivers/media/dvb/frontends/dvb-pll.h b/drivers/media/dvb/frontends/dvb-pll.h
diff --git a/drivers/media/dvb/frontends/dvb-pll.h b/drivers/media/dvb/frontends/dvb-pll.h
index 8a7f0b9..2b84617 100644
--- a/drivers/media/dvb/frontends/dvb-pll.h
+++ b/drivers/media/dvb/frontends/dvb-pll.h
@@ -42,7 +42,7 @@ extern struct dvb_pll_desc dvb_pll_samsu
extern struct dvb_pll_desc dvb_pll_philips_sd1878_tda8261;
extern struct dvb_pll_desc dvb_pll_philips_td1316;

-extern struct dvb_pll_desc dvb_pll_unknown_fe6600;
+extern struct dvb_pll_desc dvb_pll_thomson_fe6600;

int dvb_pll_configure(struct dvb_pll_desc *desc, u8 *buf,
u32 freq, int bandwidth);


diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c

index f655567..c0d1f0b 100644
--- a/drivers/media/video/cx88/cx88-cards.c
+++ b/drivers/media/video/cx88/cx88-cards.c
@@ -1073,7 +1073,7 @@ struct cx88_board cx88_boards[] = {
},
[CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID] = {
.name = "DViCO FusionHDTV DVB-T Hybrid",
- .tuner_type = TUNER_FE6600,
+ .tuner_type = TUNER_THOMSON_FE6600,


.radio_type = UNSET,
.tuner_addr = ADDR_UNSET,
.radio_addr = ADDR_UNSET,

diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c
index 2c97d3f..a9fc269 100644
--- a/drivers/media/video/cx88/cx88-dvb.c
+++ b/drivers/media/video/cx88/cx88-dvb.c
@@ -599,7 +599,7 @@ static int dvb_register(struct cx8802_de
#ifdef HAVE_ZL10353
case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID:
dev->core->pll_addr = 0x61;
- dev->core->pll_desc = &dvb_pll_unknown_fe6600;
+ dev->core->pll_desc = &dvb_pll_thomson_fe6600;
dev->dvb.frontend = zl10353_attach(&dvico_fusionhdtv_hybrid,
&dev->core->i2c_adap);
break;
diff --git a/drivers/media/video/tuner-types.c b/drivers/media/video/tuner-types.c
diff --git a/drivers/media/video/tuner-types.c b/drivers/media/video/tuner-types.c
index d10cfd4..db8b987 100644
--- a/drivers/media/video/tuner-types.c
+++ b/drivers/media/video/tuner-types.c
@@ -983,19 +983,19 @@ static struct tuner_params tuner_samsung
},
};

-/* ------------ TUNER_FE6600 - DViCO Hybrid PAL ------------ */
+/* ------------ TUNER_THOMSON_FE6600 - DViCO Hybrid PAL ------------ */

-static struct tuner_range tuner_fe6600_ranges[] = {
+static struct tuner_range tuner_thomson_fe6600_ranges[] = {
{ 16 * 160.00 /*MHz*/, 0xfe, 0x11, },
{ 16 * 442.00 /*MHz*/, 0xf6, 0x12, },
{ 16 * 999.99 , 0xf6, 0x18, },
};

-static struct tuner_params tuner_fe6600_params[] = {
+static struct tuner_params tuner_thomson_fe6600_params[] = {
{
.type = TUNER_PARAM_TYPE_PAL,
- .ranges = tuner_fe6600_ranges,
- .count = ARRAY_SIZE(tuner_fe6600_ranges),
+ .ranges = tuner_thomson_fe6600_ranges,
+ .count = ARRAY_SIZE(tuner_thomson_fe6600_ranges),
},
};

@@ -1370,9 +1370,9 @@ struct tunertype tuners[] = {
.name = "Xceive xc3028",
/* see xc3028.c for details */
},
- [TUNER_FE6600] = { /* */
- .name = "FE6600",
- .params = tuner_fe6600_params,
+ [TUNER_THOMSON_FE6600] = { /* Thomson PAL / DVB-T */
+ .name = "Thomson FE6600",
+ .params = tuner_thomson_fe6600_params,
},
};

diff --git a/include/media/tuner.h b/include/media/tuner.h
diff --git a/include/media/tuner.h b/include/media/tuner.h
index 039c77e..02d7d9a 100644
--- a/include/media/tuner.h
+++ b/include/media/tuner.h
@@ -118,7 +118,7 @@
#define TUNER_SAMSUNG_TCPN_2121P30A 70 /* Hauppauge PVR-500MCE NTSC */
#define TUNER_XCEIVE_XC3028 71

-#define TUNER_FE6600 72 /* DViCO FusionHDTV DVB-T Hybrid */
+#define TUNER_THOMSON_FE6600 72 /* DViCO FusionHDTV DVB-T Hybrid */

/* tv card specific */
#define TDA9887_PRESENT (1<<0)

mch...@infradead.org

unread,
Mar 20, 2006, 11:10:21 AM3/20/06
to
From: Duncan Sands <duncan...@math.u-psud.fr>
Date: 1141009788 -0300

This patch fixes the strange crashes I was seeing after using
bttv card, caused by a buffer overflow in bttv_risc_packed.
The instruction buffer size calculation contains two errors:
(a) a non-zero padding value can push the start of the next bpl
section to just before a page border, leading to more scanline
splits and thus additional instructions.
(b) the first DMA region can be smaller than one page, so there can
be a scanline split even if bpl*lines is smaller than PAGE_SIZE.
For example, consider the case where offset is 0, bpl is 2, padding
is 4094, lines is smaller than 2048, the first DMA region has size 1
and all others have size PAGE_SIZE, assumed to equal 4096. Then
all bpl regions cross page borders and the number of instructions
written is 2*lines+2, rather than lines+2 (the current estimate).
With this patch the number of instructions for this example is
estimated to be 2*lines+3.
Also, the BUG_ON that was supposed to catch buffer overflows contained
a thinko causing it fire only if the buffer was overrun by a factor of
16 or more, so it fixes the the BUG_ON's (using sizeof rather than "4").

Signed-off-by: Duncan Sands <bald...@free.fr>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/video/bttv-risc.c b/drivers/media/video/bttv-risc.c
diff --git a/drivers/media/video/bttv-risc.c b/drivers/media/video/bttv-risc.c
index b40e973..a60c211 100644
--- a/drivers/media/video/bttv-risc.c
+++ b/drivers/media/video/bttv-risc.c
@@ -51,8 +51,10 @@ bttv_risc_packed(struct bttv *btv, struc
int rc;

/* estimate risc mem: worst case is one write per page border +
- one write per scan line + sync + jump (all 2 dwords) */
- instructions = (bpl * lines) / PAGE_SIZE + lines;
+ one write per scan line + sync + jump (all 2 dwords). padding
+ can cause next bpl to start close to a page border. First DMA
+ region may be smaller than PAGE_SIZE */
+ instructions = 1 + ((bpl + padding) * lines) / PAGE_SIZE + lines;
instructions += 2;
if ((rc = btcx_riscmem_alloc(btv->c.pci,risc,instructions*8)) < 0)
return rc;
@@ -104,7 +106,7 @@ bttv_risc_packed(struct bttv *btv, struc

/* save pointer to jmp instruction address */
risc->jmp = rp;
- BUG_ON((risc->jmp - risc->cpu + 2) / 4 > risc->size);
+ BUG_ON((risc->jmp - risc->cpu + 2) * sizeof(*risc->cpu) > risc->size);
return 0;
}

@@ -222,7 +224,7 @@ bttv_risc_planar(struct bttv *btv, struc

/* save pointer to jmp instruction address */
risc->jmp = rp;
- BUG_ON((risc->jmp - risc->cpu + 2) / 4 > risc->size);
+ BUG_ON((risc->jmp - risc->cpu + 2) * sizeof(*risc->cpu) > risc->size);
return 0;
}

@@ -307,7 +309,7 @@ bttv_risc_overlay(struct bttv *btv, stru

/* save pointer to jmp instruction address */
risc->jmp = rp;
- BUG_ON((risc->jmp - risc->cpu + 2) / 4 > risc->size);
+ BUG_ON((risc->jmp - risc->cpu + 2) * sizeof(*risc->cpu) > risc->size);
kfree(skips);
return 0;
}
diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c
diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c
index eda7cd8..25be3a9 100644
--- a/drivers/media/video/cx88/cx88-core.c
+++ b/drivers/media/video/cx88/cx88-core.c
@@ -163,7 +163,7 @@ int cx88_risc_buffer(struct pci_dev *pci

/* save pointer to jmp instruction address */
risc->jmp = rp;
- BUG_ON((risc->jmp - risc->cpu + 2) / 4 > risc->size);
+ BUG_ON((risc->jmp - risc->cpu + 2) * sizeof (*risc->cpu) > risc->size);
return 0;
}

@@ -188,7 +188,7 @@ int cx88_risc_databuffer(struct pci_dev

/* save pointer to jmp instruction address */
risc->jmp = rp;
- BUG_ON((risc->jmp - risc->cpu + 2) / 4 > risc->size);
+ BUG_ON((risc->jmp - risc->cpu + 2) * sizeof (*risc->cpu) > risc->size);
return 0;

mch...@infradead.org

unread,
Mar 20, 2006, 11:10:23 AM3/20/06
to
From: Michael Krufky <mkr...@m1k.net>
Date: 1139224511 -0200

The tuner_params element is an array of undefined length,
with each array member being a set of parameters for each
video standard type.
The number of members in the tuner_params array
will be stored in tuners[]->count

Signed-off-by: Michael Krufky <mkr...@m1k.net>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/video/tuner-types.c b/drivers/media/video/tuner-types.c
diff --git a/drivers/media/video/tuner-types.c b/drivers/media/video/tuner-types.c
index f77584d..27fc4d0 100644
--- a/drivers/media/video/tuner-types.c
+++ b/drivers/media/video/tuner-types.c
@@ -987,18 +987,22 @@ struct tunertype tuners[] = {
[TUNER_TEMIC_PAL] = { /* TEMIC PAL */
.name = "Temic PAL (4002 FH5)",
.params = tuner_temic_pal_params,
+ .count = ARRAY_SIZE(tuner_temic_pal_params),
},
[TUNER_PHILIPS_PAL_I] = { /* Philips PAL_I */
.name = "Philips PAL_I (FI1246 and compatibles)",
.params = tuner_philips_pal_i_params,
+ .count = ARRAY_SIZE(tuner_philips_pal_i_params),
},
[TUNER_PHILIPS_NTSC] = { /* Philips NTSC */
.name = "Philips NTSC (FI1236,FM1236 and compatibles)",
.params = tuner_philips_ntsc_params,
+ .count = ARRAY_SIZE(tuner_philips_ntsc_params),
},
[TUNER_PHILIPS_SECAM] = { /* Philips SECAM */
.name = "Philips (SECAM+PAL_BG) (FI1216MF, FM1216MF, FR1216MF)",
.params = tuner_philips_secam_params,
+ .count = ARRAY_SIZE(tuner_philips_secam_params),
},
[TUNER_ABSENT] = { /* Tuner Absent */
.name = "NoTuner",
@@ -1006,120 +1010,148 @@ struct tunertype tuners[] = {
[TUNER_PHILIPS_PAL] = { /* Philips PAL */
.name = "Philips PAL_BG (FI1216 and compatibles)",
.params = tuner_philips_pal_params,
+ .count = ARRAY_SIZE(tuner_philips_pal_params),
},
[TUNER_TEMIC_NTSC] = { /* TEMIC NTSC */
.name = "Temic NTSC (4032 FY5)",
.params = tuner_temic_ntsc_params,
+ .count = ARRAY_SIZE(tuner_temic_ntsc_params),
},
[TUNER_TEMIC_PAL_I] = { /* TEMIC PAL_I */
.name = "Temic PAL_I (4062 FY5)",
.params = tuner_temic_pal_i_params,
+ .count = ARRAY_SIZE(tuner_temic_pal_i_params),
},
[TUNER_TEMIC_4036FY5_NTSC] = { /* TEMIC NTSC */
.name = "Temic NTSC (4036 FY5)",
.params = tuner_temic_4036fy5_ntsc_params,
+ .count = ARRAY_SIZE(tuner_temic_4036fy5_ntsc_params),
},
[TUNER_ALPS_TSBH1_NTSC] = { /* TEMIC NTSC */
.name = "Alps HSBH1",
.params = tuner_alps_tsbh1_ntsc_params,
+ .count = ARRAY_SIZE(tuner_alps_tsbh1_ntsc_params),
},

/* 10-19 */
[TUNER_ALPS_TSBE1_PAL] = { /* TEMIC PAL */
.name = "Alps TSBE1",
.params = tuner_alps_tsb_1_params,
+ .count = ARRAY_SIZE(tuner_alps_tsb_1_params),
},
[TUNER_ALPS_TSBB5_PAL_I] = { /* Alps PAL_I */
.name = "Alps TSBB5",
.params = tuner_alps_tsbb5_params,
+ .count = ARRAY_SIZE(tuner_alps_tsbb5_params),
},
[TUNER_ALPS_TSBE5_PAL] = { /* Alps PAL */
.name = "Alps TSBE5",
.params = tuner_alps_tsbe5_params,
+ .count = ARRAY_SIZE(tuner_alps_tsbe5_params),
},
[TUNER_ALPS_TSBC5_PAL] = { /* Alps PAL */
.name = "Alps TSBC5",
.params = tuner_alps_tsbc5_params,
+ .count = ARRAY_SIZE(tuner_alps_tsbc5_params),
},
[TUNER_TEMIC_4006FH5_PAL] = { /* TEMIC PAL */
.name = "Temic PAL_BG (4006FH5)",
.params = tuner_temic_4006fh5_params,
+ .count = ARRAY_SIZE(tuner_temic_4006fh5_params),
},
[TUNER_ALPS_TSHC6_NTSC] = { /* Alps NTSC */
.name = "Alps TSCH6",
.params = tuner_alps_tshc6_params,
+ .count = ARRAY_SIZE(tuner_alps_tshc6_params),
},
[TUNER_TEMIC_PAL_DK] = { /* TEMIC PAL */
.name = "Temic PAL_DK (4016 FY5)",
.params = tuner_temic_pal_dk_params,
+ .count = ARRAY_SIZE(tuner_temic_pal_dk_params),
},
[TUNER_PHILIPS_NTSC_M] = { /* Philips NTSC */
.name = "Philips NTSC_M (MK2)",
.params = tuner_philips_ntsc_m_params,
+ .count = ARRAY_SIZE(tuner_philips_ntsc_m_params),
},
[TUNER_TEMIC_4066FY5_PAL_I] = { /* TEMIC PAL_I */
.name = "Temic PAL_I (4066 FY5)",
.params = tuner_temic_4066fy5_pal_i_params,
+ .count = ARRAY_SIZE(tuner_temic_4066fy5_pal_i_params),
},
[TUNER_TEMIC_4006FN5_MULTI_PAL] = { /* TEMIC PAL */
.name = "Temic PAL* auto (4006 FN5)",
.params = tuner_temic_4006fn5_multi_params,
+ .count = ARRAY_SIZE(tuner_temic_4006fn5_multi_params),
},

/* 20-29 */
[TUNER_TEMIC_4009FR5_PAL] = { /* TEMIC PAL */
.name = "Temic PAL_BG (4009 FR5) or PAL_I (4069 FR5)",
.params = tuner_temic_4009f_5_params,
+ .count = ARRAY_SIZE(tuner_temic_4009f_5_params),
},
[TUNER_TEMIC_4039FR5_NTSC] = { /* TEMIC NTSC */
.name = "Temic NTSC (4039 FR5)",
.params = tuner_temic_4039fr5_params,
+ .count = ARRAY_SIZE(tuner_temic_4039fr5_params),
},
[TUNER_TEMIC_4046FM5] = { /* TEMIC PAL */
.name = "Temic PAL/SECAM multi (4046 FM5)",
.params = tuner_temic_4046fm5_params,
+ .count = ARRAY_SIZE(tuner_temic_4046fm5_params),
},
[TUNER_PHILIPS_PAL_DK] = { /* Philips PAL */
.name = "Philips PAL_DK (FI1256 and compatibles)",
.params = tuner_philips_pal_dk_params,
+ .count = ARRAY_SIZE(tuner_philips_pal_dk_params),
},
[TUNER_PHILIPS_FQ1216ME] = { /* Philips PAL */
.name = "Philips PAL/SECAM multi (FQ1216ME)",
.params = tuner_philips_fq1216me_params,
+ .count = ARRAY_SIZE(tuner_philips_fq1216me_params),
},
[TUNER_LG_PAL_I_FM] = { /* LGINNOTEK PAL_I */
.name = "LG PAL_I+FM (TAPC-I001D)",
.params = tuner_lg_pal_i_fm_params,
+ .count = ARRAY_SIZE(tuner_lg_pal_i_fm_params),
},
[TUNER_LG_PAL_I] = { /* LGINNOTEK PAL_I */
.name = "LG PAL_I (TAPC-I701D)",
.params = tuner_lg_pal_i_params,
+ .count = ARRAY_SIZE(tuner_lg_pal_i_params),
},
[TUNER_LG_NTSC_FM] = { /* LGINNOTEK NTSC */
.name = "LG NTSC+FM (TPI8NSR01F)",
.params = tuner_lg_ntsc_fm_params,
+ .count = ARRAY_SIZE(tuner_lg_ntsc_fm_params),
},
[TUNER_LG_PAL_FM] = { /* LGINNOTEK PAL */
.name = "LG PAL_BG+FM (TPI8PSB01D)",
.params = tuner_lg_pal_fm_params,
+ .count = ARRAY_SIZE(tuner_lg_pal_fm_params),
},
[TUNER_LG_PAL] = { /* LGINNOTEK PAL */
.name = "LG PAL_BG (TPI8PSB11D)",
.params = tuner_lg_pal_params,
+ .count = ARRAY_SIZE(tuner_lg_pal_params),
},

/* 30-39 */
[TUNER_TEMIC_4009FN5_MULTI_PAL_FM] = { /* TEMIC PAL */
.name = "Temic PAL* auto + FM (4009 FN5)",
.params = tuner_temic_4009_fn5_multi_pal_fm_params,
+ .count = ARRAY_SIZE(tuner_temic_4009_fn5_multi_pal_fm_params),
},
[TUNER_SHARP_2U5JF5540_NTSC] = { /* SHARP NTSC */
.name = "SHARP NTSC_JP (2U5JF5540)",
.params = tuner_sharp_2u5jf5540_params,
+ .count = ARRAY_SIZE(tuner_sharp_2u5jf5540_params),
},
[TUNER_Samsung_PAL_TCPM9091PD27] = { /* Samsung PAL */
.name = "Samsung PAL TCPM9091PD27",
.params = tuner_samsung_pal_tcpm9091pd27_params,
+ .count = ARRAY_SIZE(tuner_samsung_pal_tcpm9091pd27_params),
},
[TUNER_MT2032] = { /* Microtune PAL|NTSC */
.name = "MT20xx universal",
@@ -1127,86 +1159,106 @@ struct tunertype tuners[] = {
[TUNER_TEMIC_4106FH5] = { /* TEMIC PAL */
.name = "Temic PAL_BG (4106 FH5)",
.params = tuner_temic_4106fh5_params,
+ .count = ARRAY_SIZE(tuner_temic_4106fh5_params),
},
[TUNER_TEMIC_4012FY5] = { /* TEMIC PAL */
.name = "Temic PAL_DK/SECAM_L (4012 FY5)",
.params = tuner_temic_4012fy5_params,
+ .count = ARRAY_SIZE(tuner_temic_4012fy5_params),
},
[TUNER_TEMIC_4136FY5] = { /* TEMIC NTSC */
.name = "Temic NTSC (4136 FY5)",
.params = tuner_temic_4136_fy5_params,
+ .count = ARRAY_SIZE(tuner_temic_4136_fy5_params),
},
[TUNER_LG_PAL_NEW_TAPC] = { /* LGINNOTEK PAL */
.name = "LG PAL (newer TAPC series)",
.params = tuner_lg_pal_new_tapc_params,
+ .count = ARRAY_SIZE(tuner_lg_pal_new_tapc_params),
},
[TUNER_PHILIPS_FM1216ME_MK3] = { /* Philips PAL */
.name = "Philips PAL/SECAM multi (FM1216ME MK3)",
.params = tuner_fm1216me_mk3_params,
+ .count = ARRAY_SIZE(tuner_fm1216me_mk3_params),
},
[TUNER_LG_NTSC_NEW_TAPC] = { /* LGINNOTEK NTSC */
.name = "LG NTSC (newer TAPC series)",
.params = tuner_lg_ntsc_new_tapc_params,
+ .count = ARRAY_SIZE(tuner_lg_ntsc_new_tapc_params),
},

/* 40-49 */
[TUNER_HITACHI_NTSC] = { /* HITACHI NTSC */
.name = "HITACHI V7-J180AT",
.params = tuner_hitachi_ntsc_params,
+ .count = ARRAY_SIZE(tuner_hitachi_ntsc_params),
},
[TUNER_PHILIPS_PAL_MK] = { /* Philips PAL */
.name = "Philips PAL_MK (FI1216 MK)",
.params = tuner_philips_pal_mk_params,
+ .count = ARRAY_SIZE(tuner_philips_pal_mk_params),
},
[TUNER_PHILIPS_ATSC] = { /* Philips ATSC */
.name = "Philips 1236D ATSC/NTSC dual in",
.params = tuner_philips_atsc_params,
+ .count = ARRAY_SIZE(tuner_philips_atsc_params),
},
[TUNER_PHILIPS_FM1236_MK3] = { /* Philips NTSC */
.name = "Philips NTSC MK3 (FM1236MK3 or FM1236/F)",
.params = tuner_fm1236_mk3_params,
+ .count = ARRAY_SIZE(tuner_fm1236_mk3_params),
},
[TUNER_PHILIPS_4IN1] = { /* Philips NTSC */
.name = "Philips 4 in 1 (ATI TV Wonder Pro/Conexant)",
.params = tuner_philips_4in1_params,
+ .count = ARRAY_SIZE(tuner_philips_4in1_params),
},
[TUNER_MICROTUNE_4049FM5] = { /* Microtune PAL */
.name = "Microtune 4049 FM5",
.params = tuner_microtune_4049_fm5_params,
+ .count = ARRAY_SIZE(tuner_microtune_4049_fm5_params),
},
[TUNER_PANASONIC_VP27] = { /* Panasonic NTSC */
.name = "Panasonic VP27s/ENGE4324D",
.params = tuner_panasonic_vp27_params,
+ .count = ARRAY_SIZE(tuner_panasonic_vp27_params),
},
[TUNER_LG_NTSC_TAPE] = { /* LGINNOTEK NTSC */
.name = "LG NTSC (TAPE series)",
.params = tuner_lg_ntsc_tape_params,
+ .count = ARRAY_SIZE(tuner_lg_ntsc_tape_params),
},
[TUNER_TNF_8831BGFF] = { /* Philips PAL */
.name = "Tenna TNF 8831 BGFF)",
.params = tuner_tnf_8831bgff_params,
+ .count = ARRAY_SIZE(tuner_tnf_8831bgff_params),
},
[TUNER_MICROTUNE_4042FI5] = { /* Microtune NTSC */
.name = "Microtune 4042 FI5 ATSC/NTSC dual in",
.params = tuner_microtune_4042fi5_params,
+ .count = ARRAY_SIZE(tuner_microtune_4042fi5_params),
},

/* 50-59 */
[TUNER_TCL_2002N] = { /* TCL NTSC */
.name = "TCL 2002N",
.params = tuner_tcl_2002n_params,
+ .count = ARRAY_SIZE(tuner_tcl_2002n_params),
},
[TUNER_PHILIPS_FM1256_IH3] = { /* Philips PAL */
.name = "Philips PAL/SECAM_D (FM 1256 I-H3)",
.params = tuner_philips_fm1256_ih3_params,
+ .count = ARRAY_SIZE(tuner_philips_fm1256_ih3_params),
},
[TUNER_THOMSON_DTT7610] = { /* THOMSON ATSC */
.name = "Thomson DTT 7610 (ATSC/NTSC)",
.params = tuner_thomson_dtt7610_params,
+ .count = ARRAY_SIZE(tuner_thomson_dtt7610_params),
},
[TUNER_PHILIPS_FQ1286] = { /* Philips NTSC */
.name = "Philips FQ1286",
.params = tuner_philips_fq1286_params,
+ .count = ARRAY_SIZE(tuner_philips_fq1286_params),
},
[TUNER_PHILIPS_TDA8290] = { /* Philips PAL|NTSC */
.name = "tda8290+75",
@@ -1214,22 +1266,27 @@ struct tunertype tuners[] = {
[TUNER_TCL_2002MB] = { /* TCL PAL */
.name = "TCL 2002MB",
.params = tuner_tcl_2002mb_params,
+ .count = ARRAY_SIZE(tuner_tcl_2002mb_params),
},
[TUNER_PHILIPS_FQ1216AME_MK4] = { /* Philips PAL */
.name = "Philips PAL/SECAM multi (FQ1216AME MK4)",
.params = tuner_philips_fq1216ame_mk4_params,
+ .count = ARRAY_SIZE(tuner_philips_fq1216ame_mk4_params),
},
[TUNER_PHILIPS_FQ1236A_MK4] = { /* Philips NTSC */
.name = "Philips FQ1236A MK4",
.params = tuner_philips_fq1236a_mk4_params,
+ .count = ARRAY_SIZE(tuner_philips_fq1236a_mk4_params),
},
[TUNER_YMEC_TVF_8531MF] = { /* Philips NTSC */
.name = "Ymec TVision TVF-8531MF/8831MF/8731MF",
.params = tuner_ymec_tvf_8531mf_params,
+ .count = ARRAY_SIZE(tuner_ymec_tvf_8531mf_params),
},
[TUNER_YMEC_TVF_5533MF] = { /* Philips NTSC */
.name = "Ymec TVision TVF-5533MF",
.params = tuner_ymec_tvf_5533mf_params,
+ .count = ARRAY_SIZE(tuner_ymec_tvf_5533mf_params),
},

/* 60-69 */
@@ -1237,10 +1294,12 @@ struct tunertype tuners[] = {
/* DTT 7611 7611A 7612 7613 7613A 7614 7615 7615A */
.name = "Thomson DTT 761X (ATSC/NTSC)",
.params = tuner_thomson_dtt761x_params,
+ .count = ARRAY_SIZE(tuner_thomson_dtt761x_params),
},
[TUNER_TENA_9533_DI] = { /* Philips PAL */
.name = "Tena TNF9533-D/IF/TNF9533-B/DF",
.params = tuner_tena_9533_di_params,
+ .count = ARRAY_SIZE(tuner_tena_9533_di_params),
},
[TUNER_TEA5767] = { /* Philips RADIO */
.name = "Philips TEA5767HN FM Radio",
@@ -1249,36 +1308,44 @@ struct tunertype tuners[] = {
[TUNER_PHILIPS_FMD1216ME_MK3] = { /* Philips PAL */
.name = "Philips FMD1216ME MK3 Hybrid Tuner",
.params = tuner_philips_fmd1216me_mk3_params,
+ .count = ARRAY_SIZE(tuner_philips_fmd1216me_mk3_params),
},
[TUNER_LG_TDVS_H062F] = { /* LGINNOTEK ATSC */
.name = "LG TDVS-H062F/TUA6034",
.params = tuner_tua6034_params,
+ .count = ARRAY_SIZE(tuner_tua6034_params),
},
[TUNER_YMEC_TVF66T5_B_DFF] = { /* Philips PAL */
.name = "Ymec TVF66T5-B/DFF",
.params = tuner_ymec_tvf66t5_b_dff_params,
+ .count = ARRAY_SIZE(tuner_ymec_tvf66t5_b_dff_params),
},
[TUNER_LG_NTSC_TALN_MINI] = { /* LGINNOTEK NTSC */
.name = "LG NTSC (TALN mini series)",
.params = tuner_lg_taln_mini_params,
+ .count = ARRAY_SIZE(tuner_lg_taln_mini_params),
},
[TUNER_PHILIPS_TD1316] = { /* Philips PAL */
.name = "Philips TD1316 Hybrid Tuner",
.params = tuner_philips_td1316_params,
+ .count = ARRAY_SIZE(tuner_philips_td1316_params),
},
[TUNER_PHILIPS_TUV1236D] = { /* Philips ATSC */
.name = "Philips TUV1236D ATSC/NTSC dual in",
.params = tuner_tuv1236d_params,
+ .count = ARRAY_SIZE(tuner_tuv1236d_params),
},
[TUNER_TNF_5335MF] = { /* Philips NTSC */
.name = "Tena TNF 5335 MF",
.params = tuner_tnf_5335mf_params,
+ .count = ARRAY_SIZE(tuner_tnf_5335mf_params),
},

/* 70-79 */
[TUNER_SAMSUNG_TCPN_2121P30A] = { /* Samsung NTSC */
.name = "Samsung TCPN 2121P30A",
.params = tuner_samsung_tcpn_2121p30a_params,
+ .count = ARRAY_SIZE(tuner_samsung_tcpn_2121p30a_params),
},
};

diff --git a/include/media/tuner-types.h b/include/media/tuner-types.h
diff --git a/include/media/tuner-types.h b/include/media/tuner-types.h
index 53ac66e..ad9c171 100644
--- a/include/media/tuner-types.h
+++ b/include/media/tuner-types.h
@@ -46,6 +46,7 @@ struct tuner_params {

struct tunertype {
char *name;
+ unsigned int count;
struct tuner_params *params;

mch...@infradead.org

unread,
Mar 20, 2006, 11:10:23 AM3/20/06
to
From: Manu Abraham <ma...@linuxtv.org>
Date: 1141009777 -0300

After a FIFO corruptions occurrs (generally due to buffer overflow), FIFO
contents needs to be discarted.

Signed-off-by: Manu Abraham <ma...@linuxtv.org>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/dvb/bt8xx/dvb-bt8xx.c b/drivers/media/dvb/bt8xx/dvb-bt8xx.c
diff --git a/drivers/media/dvb/bt8xx/dvb-bt8xx.c b/drivers/media/dvb/bt8xx/dvb-bt8xx.c
index f5bfcd2..b8eab69 100644
--- a/drivers/media/dvb/bt8xx/dvb-bt8xx.c
+++ b/drivers/media/dvb/bt8xx/dvb-bt8xx.c
@@ -813,14 +813,14 @@ static int dvb_bt8xx_probe(struct bttv_s
card->gpio_mode = 0x0400c060;
/* should be: BT878_A_GAIN=0,BT878_A_PWRDN,BT878_DA_DPM,BT878_DA_SBR,
BT878_DA_IOM=1,BT878_DA_APP to enable serial highspeed mode. */
- card->op_sync_orin = 0;
- card->irq_err_ignore = 0;
+ card->op_sync_orin = BT878_RISC_SYNC_MASK;
+ card->irq_err_ignore = BT878_AFBUS | BT878_AFDSR;
break;

case BTTV_BOARD_DVICO_DVBT_LITE:
card->gpio_mode = 0x0400C060;
- card->op_sync_orin = 0;
- card->irq_err_ignore = 0;
+ card->op_sync_orin = BT878_RISC_SYNC_MASK;
+ card->irq_err_ignore = BT878_AFBUS | BT878_AFDSR;
/* 26, 15, 14, 6, 5
* A_PWRDN DA_DPM DA_SBR DA_IOM_DA
* DA_APP(parallel) */
@@ -835,15 +835,15 @@ static int dvb_bt8xx_probe(struct bttv_s
case BTTV_BOARD_NEBULA_DIGITV:
case BTTV_BOARD_AVDVBT_761:
card->gpio_mode = (1 << 26) | (1 << 14) | (1 << 5);
- card->op_sync_orin = 0;
- card->irq_err_ignore = 0;
+ card->op_sync_orin = BT878_RISC_SYNC_MASK;
+ card->irq_err_ignore = BT878_AFBUS | BT878_AFDSR;
/* A_PWRDN DA_SBR DA_APP (high speed serial) */
break;

case BTTV_BOARD_AVDVBT_771: //case 0x07711461:
card->gpio_mode = 0x0400402B;
card->op_sync_orin = BT878_RISC_SYNC_MASK;
- card->irq_err_ignore = 0;
+ card->irq_err_ignore = BT878_AFBUS | BT878_AFDSR;
/* A_PWRDN DA_SBR DA_APP[0] PKTP=10 RISC_ENABLE FIFO_ENABLE*/
break;

@@ -867,8 +867,8 @@ static int dvb_bt8xx_probe(struct bttv_s

case BTTV_BOARD_PC_HDTV:
card->gpio_mode = 0x0100EC7B;
- card->op_sync_orin = 0;
- card->irq_err_ignore = 0;
+ card->op_sync_orin = BT878_RISC_SYNC_MASK;
+ card->irq_err_ignore = BT878_AFBUS | BT878_AFDSR;
break;

default:

mch...@infradead.org

unread,
Mar 20, 2006, 11:10:23 AM3/20/06
to
From: Michael Krufky <mkr...@linuxtv.org>
Date: 1139300736 -0200

Right now, all tuners are using the first tuner_params[]
array element for analog mode. We are now ready to begin merging
similar tuner definitions together, such that each tuner definition
will have a tuner_params struct for each available video standard.
The tuner_params[] array element will be chosen based on the video
standard in use.

Signed-off-by: Michael Krufky <mkr...@linuxtv.org>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c
diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c
index 17e29cc..2e680cf 100644
--- a/drivers/media/video/tuner-simple.c
+++ b/drivers/media/video/tuner-simple.c
@@ -79,16 +79,6 @@ MODULE_PARM_DESC(offset,"Allows to speci
#define TUNER_PLL_LOCKED 0x40
#define TUNER_STEREO_MK3 0x04

-/* FIXME:
- * Right now, all tuners are using the first tuner_params[] array element
- * for analog mode. In the future, we will be merging similar tuner
- * definitions together, such that each tuner definition will have a
- * tuner_params struct for each available video standard. At that point,
- * the tuner_params[] array element will be chosen based on the video
- * standard in use.
- *
- */
-
/* ---------------------------------------------------------------------- */

static int tuner_getstatus(struct i2c_client *c)


diff --git a/drivers/media/video/tuner-types.c b/drivers/media/video/tuner-types.c
diff --git a/drivers/media/video/tuner-types.c b/drivers/media/video/tuner-types.c

index 27fc4d0..9786e59 100644
--- a/drivers/media/video/tuner-types.c
+++ b/drivers/media/video/tuner-types.c
@@ -23,13 +23,16 @@
* Each tuner_params array may contain one or more elements, one
* for each video standard.
*
- * FIXME: Some tuner_range definitions are duplicated, and
- * should be eliminated.
+ * FIXME: tuner_params struct contains an element, tda988x. We must
+ * set this for all tuners that contain a tda988x chip, and then we
+ * can remove this setting from the various card structs.
*
- * FIXME: tunertype struct contains an element, has_tda988x.
- * We must set this for all tunertypes that contain a tda988x
- * chip, and then we can remove this setting from the various
- * card structs.
+ * FIXME: Right now, all tuners are using the first tuner_params[]
+ * array element for analog mode. In the future, we will be merging
+ * similar tuner definitions together, such that each tuner definition
+ * will have a tuner_params struct for each available video standard.
+ * At that point, the tuner_params[] array element will be chosen
+ * based on the video standard in use.
*/

/* 0-9 */

mch...@infradead.org

unread,
Mar 20, 2006, 11:10:24 AM3/20/06
to
From: Markus Rechberger <mrech...@gmail.com>
Date: 1141009647 -0300

Added support for xc3028 to v4l which adds support for:
* Terratec Hybrid XS (analogue)
* Hauppauge HVR 900 (analogue)


Signed-off-by: Markus Rechberger <mrech...@gmail.com>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/Documentation/video4linux/CARDLIST.tuner b/Documentation/video4linux/CARDLIST.tuner
diff --git a/Documentation/video4linux/CARDLIST.tuner b/Documentation/video4linux/CARDLIST.tuner
index f6d0cf7..de48438 100644
--- a/Documentation/video4linux/CARDLIST.tuner
+++ b/Documentation/video4linux/CARDLIST.tuner
@@ -69,3 +69,4 @@ tuner=67 - Philips TD1316 Hybrid Tuner
tuner=68 - Philips TUV1236D ATSC/NTSC dual in


tuner=69 - Tena TNF 5335 MF
tuner=70 - Samsung TCPN 2121P30A

+tuner=71 - Xceive xc3028
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
index faf7283..60e9c6e 100644
--- a/drivers/media/video/Makefile
+++ b/drivers/media/video/Makefile
@@ -9,7 +9,7 @@ zoran-objs := zr36120.o zr36120_i2c
zr36067-objs := zoran_procfs.o zoran_device.o \
zoran_driver.o zoran_card.o
tuner-objs := tuner-core.o tuner-types.o tuner-simple.o \
- mt20xx.o tda8290.o tea5767.o
+ mt20xx.o tda8290.o tea5767.o xc3028.o

msp3400-objs := msp3400-driver.o msp3400-kthreads.o



diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c

index 703927e..e9834c1 100644
--- a/drivers/media/video/em28xx/em28xx-cards.c
+++ b/drivers/media/video/em28xx/em28xx-cards.c
@@ -158,8 +158,8 @@ struct em28xx_board em28xx_boards[] = {
.name = "Hauppauge WinTV HVR 900",


.vchannels = 3,
.norm = VIDEO_MODE_PAL,

- .has_tuner = 0,
.tda9887_conf = TDA9887_PRESENT,
+ .tuner_type = TUNER_XCEIVE_XC3028,
.has_tuner = 1,


.decoder = EM28XX_TVP5150,
.input = {{

@@ -180,8 +180,8 @@ struct em28xx_board em28xx_boards[] = {
.name = "Terratec Hybrid XS",


.vchannels = 3,
.norm = VIDEO_MODE_PAL,

- .has_tuner = 0,
.tda9887_conf = TDA9887_PRESENT,
+ .tuner_type = TUNER_XCEIVE_XC3028,
.has_tuner = 1,


.decoder = EM28XX_TVP5150,
.input = {{

diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c

index e34f801..520f274 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -217,6 +217,9 @@ static void set_type(struct i2c_client *
i2c_master_send(c,buffer,4);
default_tuner_init(c);
break;
+ case TUNER_XCEIVE_XC3028:
+ xc3028_init(c);
+ break;
default:
default_tuner_init(c);
break;


diff --git a/drivers/media/video/tuner-types.c b/drivers/media/video/tuner-types.c
diff --git a/drivers/media/video/tuner-types.c b/drivers/media/video/tuner-types.c

index a90bc04..a4384e6 100644
--- a/drivers/media/video/tuner-types.c
+++ b/drivers/media/video/tuner-types.c
@@ -983,6 +983,23 @@ static struct tuner_params tuner_samsung
},
};

+/* ------------ TUNER_XCEIVE_XC3028 - Xceive xc3028 ------------ */
+
+static struct tuner_range tuner_xceive_xc3028_ranges[] = {
+ { 16 * 140.25 /*MHz*/, 0x02, },
+ { 16 * 463.25 /*MHz*/, 0x04, },
+ { 16 * 999.99 , 0x01, },
+};
+
+static struct tuner_params tuner_xceive_xc3028_params[] = {
+ {
+ .type = TUNER_XCEIVE_XC3028,
+ .ranges = tuner_xceive_xc3028_ranges,
+ .count = ARRAY_SIZE(tuner_xceive_xc3028_ranges),
+ },
+};
+
+
/* --------------------------------------------------------------------- */

struct tunertype tuners[] = {
@@ -1350,6 +1367,10 @@ struct tunertype tuners[] = {
.params = tuner_samsung_tcpn_2121p30a_params,
.count = ARRAY_SIZE(tuner_samsung_tcpn_2121p30a_params),
},
+ [TUNER_XCEIVE_XC3028] = { /* Xceive 3028 */
+ .name = "Xceive xc3028",
+ .params = tuner_xceive_xc3028_params,
+ },
};

unsigned const int tuner_count = ARRAY_SIZE(tuners);


diff --git a/include/media/tuner.h b/include/media/tuner.h
diff --git a/include/media/tuner.h b/include/media/tuner.h

index a5beeac..f51759c 100644
--- a/include/media/tuner.h
+++ b/include/media/tuner.h
@@ -117,6 +117,8 @@
#define TUNER_TNF_5335MF 69 /* Sabrent Bt848 */


#define TUNER_SAMSUNG_TCPN_2121P30A 70 /* Hauppauge PVR-500MCE NTSC */

+#define TUNER_XCEIVE_XC3028 71
+


/* tv card specific */
#define TDA9887_PRESENT (1<<0)

#define TDA9887_PORT1_INACTIVE (1<<1)
@@ -209,6 +211,7 @@ struct tuner {
extern unsigned const int tuner_count;

extern int microtune_init(struct i2c_client *c);
+extern int xc3028_init(struct i2c_client *c);
extern int tda8290_init(struct i2c_client *c);
extern int tda8290_probe(struct i2c_client *c);
extern int tea5767_tuner_init(struct i2c_client *c);

mch...@infradead.org

unread,
Mar 20, 2006, 11:10:25 AM3/20/06
to
From: Michael Krufky <mkr...@linuxtv.org>
Date: 1141009723 -0300

Standard video using the cx88 broadcast decoder is
working, but blackbird isn't working yet, audio is only
working correctly for television mode. S-Video and Composite
are working for video-only, so I have them disabled for now.

Signed-off-by: Michael Krufky <mkr...@linuxtv.org>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c
index 09f5739..cc9d660 100644
--- a/drivers/media/video/cx88/cx88-cards.c
+++ b/drivers/media/video/cx88/cx88-cards.c
@@ -1049,9 +1049,7 @@ struct cx88_board cx88_boards[] = {
.dvb = 1,
},
[CX88_BOARD_KWORLD_HARDWARE_MPEG_TV_XPERT] = {
- /* FIXME: This card is shipped without a windows tv app,
- * so I haven't been able to use regspy to figure out the GPIO
- * settings. Standard video using the cx88 broadcast decoder is
+ /* FIXME: Standard video using the cx88 broadcast decoder is
* working, but blackbird isn't working yet, audio is only
* working correctly for television mode. S-Video and Composite
* are working for video-only, so I have them disabled for now.

mch...@infradead.org

unread,
Mar 20, 2006, 11:10:25 AM3/20/06
to
From: Johannes Stezenbach <j...@linuxtv.org>
Date: 1141009760 -0300

use __devinit/__devexit/__devexit_p() where appropriate

Signed-off-by: Johannes Stezenbach <j...@linuxtv.org>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c
diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c
index 1aa61bf..d982a50 100644
--- a/drivers/media/dvb/ttpci/av7110.c
+++ b/drivers/media/dvb/ttpci/av7110.c
@@ -2476,7 +2476,8 @@ static int frontend_init(struct av7110 *
* The same behaviour of missing VSYNC can be duplicated on budget
* cards, by seting DD1_INIT trigger mode 7 in 3rd nibble.
*/
-static int av7110_attach(struct saa7146_dev* dev, struct saa7146_pci_extension_data *pci_ext)
+static int __devinit av7110_attach(struct saa7146_dev* dev,
+ struct saa7146_pci_extension_data *pci_ext)
{
const int length = TS_WIDTH * TS_HEIGHT;
struct pci_dev *pdev = dev->pci;
@@ -2826,7 +2827,7 @@ err_kfree_0:
goto out;
}

-static int av7110_detach(struct saa7146_dev* saa)
+static int __devexit av7110_detach(struct saa7146_dev* saa)
{
struct av7110 *av7110 = saa->ext_priv;
dprintk(4, "%p\n", av7110);
@@ -2973,7 +2974,7 @@ static struct saa7146_extension av7110_e
.module = THIS_MODULE,
.pci_tbl = &pci_tbl[0],
.attach = av7110_attach,
- .detach = av7110_detach,
+ .detach = __devexit_p(av7110_detach),

.irq_mask = MASK_19 | MASK_03 | MASK_10,
.irq_func = av7110_irq,
diff --git a/drivers/media/dvb/ttpci/av7110_ir.c b/drivers/media/dvb/ttpci/av7110_ir.c
diff --git a/drivers/media/dvb/ttpci/av7110_ir.c b/drivers/media/dvb/ttpci/av7110_ir.c
index 617e4f6..d54bbcd 100644
--- a/drivers/media/dvb/ttpci/av7110_ir.c
+++ b/drivers/media/dvb/ttpci/av7110_ir.c
@@ -208,7 +208,7 @@ static void ir_handler(struct av7110 *av
}


-int __init av7110_ir_init(struct av7110 *av7110)
+int __devinit av7110_ir_init(struct av7110 *av7110)
{
static struct proc_dir_entry *e;

@@ -248,7 +248,7 @@ int __init av7110_ir_init(struct av7110
}


-void __exit av7110_ir_exit(struct av7110 *av7110)
+void __devexit av7110_ir_exit(struct av7110 *av7110)
{
int i;

mch...@infradead.org

unread,
Mar 20, 2006, 11:20:05 AM3/20/06
to
From: Michael Krufky <mkr...@linuxtv.org>
Date: 1141009716 -0300

- There is no radio with this tuner card...
Thanks-to: Dwaine Garden <Dwaine...@rogers.com>
- fixed capitalization in card name.

Signed-off-by: Michael Krufky <mkr...@linuxtv.org>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134
diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134
index f74d2f9..e1484df 100644
--- a/Documentation/video4linux/CARDLIST.saa7134
+++ b/Documentation/video4linux/CARDLIST.saa7134
@@ -88,4 +88,4 @@


87 -> ADS Instant TV Duo Cardbus PTV331 [0331:1421]
88 -> Tevion DVB-T 220RF [17de:7201]
89 -> ELSA EX-VISION 700TV [1131:7130]

- 90 -> KWORLD ATSC110 [17de:7350]
+ 90 -> Kworld ATSC110 [17de:7350]


diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c

index 0cc171e..99cefdd 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -2732,7 +2732,7 @@ struct saa7134_board saa7134_boards[] =
},
},
[SAA7134_BOARD_KWORLD_ATSC110] = {
- .name = "KWORLD ATSC110",
+ .name = "Kworld ATSC110",
.audio_clock = 0x00187de7,
.tuner_type = TUNER_PHILIPS_TUV1236D,
.radio_type = UNSET,

mch...@infradead.org

unread,
Mar 20, 2006, 11:20:07 AM3/20/06
to
From: Manu Abraham <ma...@linuxtv.org>
Date: 1141009769 -0300

Fixed broken IF-OUT on pinnacle sat board.
Thanks to Edgar Toernig

Signed-off-by: Manu Abraham <ma...@linuxtv.org>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/dvb/bt8xx/dvb-bt8xx.c b/drivers/media/dvb/bt8xx/dvb-bt8xx.c
diff --git a/drivers/media/dvb/bt8xx/dvb-bt8xx.c b/drivers/media/dvb/bt8xx/dvb-bt8xx.c
index 1649846..f5bfcd2 100644
--- a/drivers/media/dvb/bt8xx/dvb-bt8xx.c
+++ b/drivers/media/dvb/bt8xx/dvb-bt8xx.c
@@ -239,6 +239,20 @@ static int cx24108_pll_set(struct dvb_fr

static int pinnsat_pll_init(struct dvb_frontend* fe)
{
+ struct dvb_bt8xx_card *card = fe->dvb->priv;
+
+ bttv_gpio_enable(card->bttv_nr, 1, 1); /* output */
+ bttv_write_gpio(card->bttv_nr, 1, 1); /* relay on */


+
+ return 0;
+}

+
+static int pinnsat_pll_sleep(struct dvb_frontend* fe)
+{
+ struct dvb_bt8xx_card *card = fe->dvb->priv;
+
+ bttv_write_gpio(card->bttv_nr, 1, 0); /* relay off */
+
return 0;
}

@@ -246,6 +260,7 @@ static struct cx24110_config pctvsat_con
.demod_address = 0x55,
.pll_init = pinnsat_pll_init,
.pll_set = cx24108_pll_set,
+ .pll_sleep = pinnsat_pll_sleep,
};

static int microtune_mt7202dtf_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params)


diff --git a/drivers/media/dvb/frontends/cx24110.c b/drivers/media/dvb/frontends/cx24110.c
diff --git a/drivers/media/dvb/frontends/cx24110.c b/drivers/media/dvb/frontends/cx24110.c

index cc68b7e..f3edf8b 100644
--- a/drivers/media/dvb/frontends/cx24110.c
+++ b/drivers/media/dvb/frontends/cx24110.c
@@ -371,6 +371,15 @@ static int cx24110_initfe(struct dvb_fro
return 0;
}

+static int cx24110_sleep(struct dvb_frontend *fe)
+{
+ struct cx24110_state *state = fe->demodulator_priv;
+
+ if (state->config->pll_sleep)
+ return state->config->pll_sleep(fe);


+ return 0;
+}
+

static int cx24110_set_voltage (struct dvb_frontend* fe, fe_sec_voltage_t voltage)
{


struct cx24110_state *state = fe->demodulator_priv;

@@ -642,6 +651,7 @@ static struct dvb_frontend_ops cx24110_o
.release = cx24110_release,

.init = cx24110_initfe,
+ .sleep = cx24110_sleep,
.set_frontend = cx24110_set_frontend,
.get_frontend = cx24110_get_frontend,
.read_status = cx24110_read_status,
diff --git a/drivers/media/dvb/frontends/cx24110.h b/drivers/media/dvb/frontends/cx24110.h
diff --git a/drivers/media/dvb/frontends/cx24110.h b/drivers/media/dvb/frontends/cx24110.h
index b63ecf2..609ac64 100644
--- a/drivers/media/dvb/frontends/cx24110.h
+++ b/drivers/media/dvb/frontends/cx24110.h
@@ -35,6 +35,7 @@ struct cx24110_config
/* PLL maintenance */
int (*pll_init)(struct dvb_frontend* fe);
int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params);
+ int (*pll_sleep)(struct dvb_frontend* fe);
};

extern struct dvb_frontend* cx24110_attach(const struct cx24110_config* config,

mch...@infradead.org

unread,
Mar 20, 2006, 11:20:07 AM3/20/06
to
From: Michael Krufky <mkr...@m1k.net>
Date: 1138043471 -0200

- rename cb variable names in tuner structures for global consistency

Signed-off-by: Michael Krufky <mkr...@m1k.net>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/dvb/frontends/dvb-pll.c b/drivers/media/dvb/frontends/dvb-pll.c
diff --git a/drivers/media/dvb/frontends/dvb-pll.c b/drivers/media/dvb/frontends/dvb-pll.c
index 4dcb605..cd8f282 100644
--- a/drivers/media/dvb/frontends/dvb-pll.c
+++ b/drivers/media/dvb/frontends/dvb-pll.c
@@ -391,8 +391,8 @@ int dvb_pll_configure(struct dvb_pll_des
div = (freq + desc->entries[i].offset) / desc->entries[i].stepsize;
buf[0] = div >> 8;
buf[1] = div & 0xff;
- buf[2] = desc->entries[i].cb1;
- buf[3] = desc->entries[i].cb2;
+ buf[2] = desc->entries[i].config;
+ buf[3] = desc->entries[i].cb;

if (desc->setbw)
desc->setbw(buf, freq, bandwidth);


diff --git a/drivers/media/dvb/frontends/dvb-pll.h b/drivers/media/dvb/frontends/dvb-pll.h
diff --git a/drivers/media/dvb/frontends/dvb-pll.h b/drivers/media/dvb/frontends/dvb-pll.h

index bb8d4b4..872e3b4 100644
--- a/drivers/media/dvb/frontends/dvb-pll.h
+++ b/drivers/media/dvb/frontends/dvb-pll.h
@@ -15,8 +15,8 @@ struct dvb_pll_desc {
u32 limit;
u32 offset;
u32 stepsize;
- u8 cb1;
- u8 cb2;
+ u8 config;
+ u8 cb;
} entries[12];
};



diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c
diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c

index 37977ff..2c6410c 100644
--- a/drivers/media/video/tuner-simple.c
+++ b/drivers/media/video/tuner-simple.c
@@ -133,7 +133,7 @@ static int tuner_stereo(struct i2c_clien
static void default_set_tv_freq(struct i2c_client *c, unsigned int freq)
{


struct tuner *t = i2c_get_clientdata(c);

- u8 config, tuneraddr;
+ u8 cb, tuneraddr;
u16 div;
struct tunertype *tun;
u8 buffer[4];
@@ -152,7 +152,7 @@ static void default_set_tv_freq(struct i
freq, tun->params[j].ranges[i - 1].limit);
freq = tun->params[j].ranges[--i].limit;
}
- config = tun->params[j].ranges[i].cb;
+ cb = tun->params[j].ranges[i].cb;
/* i == 0 -> VHF_LO */
/* i == 1 -> VHF_HI */
/* i == 2 -> UHF */
@@ -164,40 +164,40 @@ static void default_set_tv_freq(struct i
/* 0x01 -> ??? no change ??? */
/* 0x02 -> PAL BDGHI / SECAM L */
/* 0x04 -> ??? PAL others / SECAM others ??? */
- config &= ~0x02;
+ cb &= ~0x02;
if (t->std & V4L2_STD_SECAM)
- config |= 0x02;
+ cb |= 0x02;
break;

case TUNER_TEMIC_4046FM5:
- config &= ~0x0f;
+ cb &= ~0x0f;

if (t->std & V4L2_STD_PAL_BG) {
- config |= TEMIC_SET_PAL_BG;
+ cb |= TEMIC_SET_PAL_BG;

} else if (t->std & V4L2_STD_PAL_I) {
- config |= TEMIC_SET_PAL_I;
+ cb |= TEMIC_SET_PAL_I;

} else if (t->std & V4L2_STD_PAL_DK) {
- config |= TEMIC_SET_PAL_DK;
+ cb |= TEMIC_SET_PAL_DK;

} else if (t->std & V4L2_STD_SECAM_L) {
- config |= TEMIC_SET_PAL_L;
+ cb |= TEMIC_SET_PAL_L;

}
break;

case TUNER_PHILIPS_FQ1216ME:
- config &= ~0x0f;
+ cb &= ~0x0f;

if (t->std & (V4L2_STD_PAL_BG|V4L2_STD_PAL_DK)) {
- config |= PHILIPS_SET_PAL_BGDK;
+ cb |= PHILIPS_SET_PAL_BGDK;

} else if (t->std & V4L2_STD_PAL_I) {
- config |= PHILIPS_SET_PAL_I;
+ cb |= PHILIPS_SET_PAL_I;

} else if (t->std & V4L2_STD_SECAM_L) {
- config |= PHILIPS_SET_PAL_L;
+ cb |= PHILIPS_SET_PAL_L;

}
break;
@@ -207,9 +207,9 @@ static void default_set_tv_freq(struct i
/* 0x01 -> ATSC antenna input 2 */
/* 0x02 -> NTSC antenna input 1 */
/* 0x03 -> NTSC antenna input 2 */
- config &= ~0x03;
+ cb &= ~0x03;
if (!(t->std & V4L2_STD_ATSC))
- config |= 2;
+ cb |= 2;
/* FIXME: input */
break;

@@ -227,9 +227,9 @@ static void default_set_tv_freq(struct i
buffer[1] = 0x00;
buffer[2] = 0x17;
buffer[3] = 0x00;
- config &= ~0x40;
+ cb &= ~0x40;
if (t->std & V4L2_STD_ATSC) {
- config |= 0x40;
+ cb |= 0x40;
buffer[1] = 0x04;
}
/* set to the correct mode (analog or digital) */
@@ -277,14 +277,14 @@ static void default_set_tv_freq(struct i

if (tuners[t->type].params->cb_first_if_lower_freq && div < t->last_div) {
buffer[0] = tun->params[j].config;
- buffer[1] = config;
+ buffer[1] = cb;
buffer[2] = (div>>8) & 0x7f;
buffer[3] = div & 0xff;
} else {
buffer[0] = (div>>8) & 0x7f;
buffer[1] = div & 0xff;
buffer[2] = tun->params[j].config;
- buffer[3] = config;
+ buffer[3] = cb;
}
t->last_div = div;
tuner_dbg("tv 0x%02x 0x%02x 0x%02x 0x%02x\n",
@@ -316,7 +316,7 @@ static void default_set_tv_freq(struct i
buffer[0] = (div>>8) & 0x7f;
buffer[1] = div & 0xff;
buffer[2] = tun->params[j].config;
- buffer[3] = config;
+ buffer[3] = cb;
tuner_dbg("tv 0x%02x 0x%02x 0x%02x 0x%02x\n",
buffer[0],buffer[1],buffer[2],buffer[3]);

mch...@infradead.org

unread,
Mar 20, 2006, 11:20:09 AM3/20/06
to
From: Randy Dunlap <rdu...@xenotime.net>
Date: 1138043470 -0200

- Fix printk type warning:
drivers/media/dvb/b2c2/flexcop-pci.c:164: warning:
format '%08x' expects type 'unsigned int', but argument 4 has type 'dma_addr_t'

Signed-off-by: Randy Dunlap <rdu...@xenotime.net>


Signed-off-by: Michael Krufky <mkr...@m1k.net>
Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/dvb/b2c2/flexcop-pci.c b/drivers/media/dvb/b2c2/flexcop-pci.c
diff --git a/drivers/media/dvb/b2c2/flexcop-pci.c b/drivers/media/dvb/b2c2/flexcop-pci.c
index 2f76eb3..9bc40bd 100644
--- a/drivers/media/dvb/b2c2/flexcop-pci.c
+++ b/drivers/media/dvb/b2c2/flexcop-pci.c
@@ -161,8 +161,10 @@ static irqreturn_t flexcop_pci_isr(int i
fc->read_ibi_reg(fc,dma1_008).dma_0x8.dma_cur_addr << 2;
u32 cur_pos = cur_addr - fc_pci->dma[0].dma_addr0;

- deb_irq("%u irq: %08x cur_addr: %08x: cur_pos: %08x, last_cur_pos: %08x ",
- jiffies_to_usecs(jiffies - fc_pci->last_irq),v.raw,cur_addr,cur_pos,fc_pci->last_dma1_cur_pos);
+ deb_irq("%u irq: %08x cur_addr: %llx: cur_pos: %08x, last_cur_pos: %08x ",
+ jiffies_to_usecs(jiffies - fc_pci->last_irq),
+ v.raw, (unsigned long long)cur_addr, cur_pos,
+ fc_pci->last_dma1_cur_pos);
fc_pci->last_irq = jiffies;

/* buffer end was reached, restarted from the beginning

mch...@infradead.org

unread,
Mar 20, 2006, 11:20:09 AM3/20/06
to
From: Mauro Carvalho Chehab <mch...@infradead.org>
Date: 1138386722 -0200

- V4L/DVB Maintainers list changed. This patch alters the email to the
new address.

Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>

# Acked-By: Johannes Stezenbach <j...@linuxtv.org>
---

diff --git a/MAINTAINERS b/MAINTAINERS
diff --git a/MAINTAINERS b/MAINTAINERS
index 3f8a90a..7374be0 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -540,7 +540,8 @@ S: Supported

BTTV VIDEO4LINUX DRIVER
P: Mauro Carvalho Chehab
-M: mch...@brturbo.com.br
+M: mch...@infradead.org
+M: v4l-dvb-m...@linuxtv.org
L: video4li...@redhat.com
W: http://linuxtv.org
T: git kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git
@@ -836,11 +837,12 @@ S: Maintained

DVB SUBSYSTEM AND DRIVERS
P: LinuxTV.org Project
-M: linux-dvb-...@linuxtv.org
+M: mch...@infradead.org
+M: v4l-dvb-m...@linuxtv.org
L: linu...@linuxtv.org (subscription required)
W: http://linuxtv.org/
T: git kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git
-S: Supported
+S: Maintained

EATA-DMA SCSI DRIVER
P: Michael Neuffer
@@ -2946,7 +2948,8 @@ S: Maintained

VIDEO FOR LINUX
P: Mauro Carvalho Chehab
-M: mch...@brturbo.com.br
+M: mch...@infradead.org
+M: v4l-dvb-m...@linuxtv.org
L: video4li...@redhat.com
W: http://linuxtv.org
T: git kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git

mch...@infradead.org

unread,
Mar 20, 2006, 11:20:11 AM3/20/06
to
From: Markus Rechberger <mrech...@gmail.com>
Date: 1138043471 -0200

- changed comment in tuner-core.c

Signed-off-by: Markus Rechberger <mrech...@gmail.com>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>

---

diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c

index cd2d5a7..788eada 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -450,7 +450,7 @@ static int tuner_attach(struct i2c_adapt
printk("%02x ",buffer[i]);
printk("\n");
}
- /* TEA5767 autodetection code - only for addr = 0xc0 */
+ /* autodetection code based on the i2c addr */
if (!no_autodetect) {
switch (addr) {
case 0x42:

mch...@infradead.org

unread,
Mar 20, 2006, 11:20:15 AM3/20/06
to
From: Michael Krufky <mkr...@linuxtv.org>
Date: 1141009681 -0300

- KWorld HardwareMpegTV XPert must set gpio2

Signed-off-by: Michael Krufky <mkr...@linuxtv.org>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c
index 8617b08..09f5739 100644
--- a/drivers/media/video/cx88/cx88-cards.c
+++ b/drivers/media/video/cx88/cx88-cards.c
@@ -1065,10 +1065,12 @@ struct cx88_board cx88_boards[] = {
.type = CX88_VMUX_TELEVISION,
.vmux = 0,
.gpio0 = 0x3de2,
+ .gpio2 = 0x00ff,
}},
.radio = {
.type = CX88_RADIO,
.gpio0 = 0x3de6,
+ .gpio2 = 0x00ff,
},
},

mch...@infradead.org

unread,
Mar 20, 2006, 11:20:16 AM3/20/06
to
From: Mike Isely <is...@pobox.com>
Date: 1138043467 -0200

- The tda9887 has an I2C id reserved for it, but it hasn't been using
it. Probably an oversight. Fixed with this patch.

Signed-off-by: Mike Isely <is...@pobox.com>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c
diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c
index 5815649..7c71422 100644
--- a/drivers/media/video/tda9887.c
+++ b/drivers/media/video/tda9887.c
@@ -876,7 +876,7 @@ static int tda9887_resume(struct device
/* ----------------------------------------------------------------------- */

static struct i2c_driver driver = {
- .id = -1, /* FIXME */
+ .id = I2C_DRIVERID_TDA9887,
.attach_adapter = tda9887_probe,
.detach_client = tda9887_detach,
.command = tda9887_command,

mch...@infradead.org

unread,
Mar 20, 2006, 11:20:16 AM3/20/06
to
From: Ian Pickworth <i...@pickworth.me.uk>
Date: 1138043467 -0200

- Recognise Hauppauge card #34519

Signed-off-by: Ian Pickworth <i...@pickworth.me.uk>
Signed-off-by: Michael Krufky <mkr...@m1k.net>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c
index 517257b..1bc9992 100644
--- a/drivers/media/video/cx88/cx88-cards.c
+++ b/drivers/media/video/cx88/cx88-cards.c
@@ -1298,6 +1298,7 @@ static void hauppauge_eeprom(struct cx88
switch (tv.model)
{
case 28552: /* WinTV-PVR 'Roslyn' (No IR) */
+ case 34519: /* WinTV-PCI-FM */
case 90002: /* Nova-T-PCI (9002) */
case 92001: /* Nova-S-Plus (Video and IR) */
case 92002: /* Nova-S-Plus (Video and IR) */

mch...@infradead.org

unread,
Mar 20, 2006, 11:20:17 AM3/20/06
to
From: Marcin Rudowski <mar...@poczta.onet.pl>
Date: 1139224514 -0200

Apparently, having the number of lines fixed at 4 reduces (or even kills)
the buzz found in NICAM stereo with analog sound.

Signed-off-by: Marcin Rudowski <mar...@poczta.onet.pl>
Signed-off-by: Ricardo Cerqueira <v...@cerqueira.org>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c
diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c
index 8d6d6a6..3720f24 100644
--- a/drivers/media/video/cx88/cx88-core.c
+++ b/drivers/media/video/cx88/cx88-core.c
@@ -787,12 +787,14 @@ static int set_pll(struct cx88_core *cor

int cx88_start_audio_dma(struct cx88_core *core)
{
+ /* constant 128 made buzz in analog Nicam-stereo for bigger fifo_size */
+ int bpl = cx88_sram_channels[SRAM_CH25].fifo_size/4;
/* setup fifo + format */
- cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH25], 128, 0);
- cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH26], 128, 0);
+ cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH25], bpl, 0);
+ cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH26], bpl, 0);

- cx_write(MO_AUDD_LNGTH, 128); /* fifo bpl size */
- cx_write(MO_AUDR_LNGTH, 128); /* fifo bpl size */
+ cx_write(MO_AUDD_LNGTH, bpl); /* fifo bpl size */
+ cx_write(MO_AUDR_LNGTH, bpl); /* fifo bpl size */

/* start dma */
cx_write(MO_AUD_DMACNTRL, 0x0003); /* Up and Down fifo enable */

mch...@infradead.org

unread,
Mar 20, 2006, 11:20:18 AM3/20/06
to
From: Hans Verkuil <hver...@xs4all.nl>
Date: 1141009700 -0300

Signed-off-by: Hans Verkuil <hver...@xs4all.nl>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c
index 8d8aa8e..8a25797 100644
--- a/drivers/media/video/cx25840/cx25840-core.c
+++ b/drivers/media/video/cx25840/cx25840-core.c
@@ -567,7 +567,7 @@ static struct v4l2_queryctrl cx25840_qct
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "Contrast",
.minimum = 0,
- .maximum = 255,
+ .maximum = 127,
.step = 1,
.default_value = 64,
.flags = 0,
@@ -576,7 +576,7 @@ static struct v4l2_queryctrl cx25840_qct
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "Saturation",
.minimum = 0,
- .maximum = 255,
+ .maximum = 127,
.step = 1,
.default_value = 64,
.flags = 0,
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c
index 487a429..f0eb985 100644
--- a/drivers/media/video/saa7115.c
+++ b/drivers/media/video/saa7115.c
@@ -1027,7 +1027,7 @@ static struct v4l2_queryctrl saa7115_qct
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "Contrast",
.minimum = 0,
- .maximum = 255,
+ .maximum = 127,
.step = 1,
.default_value = 64,
.flags = 0,
@@ -1036,7 +1036,7 @@ static struct v4l2_queryctrl saa7115_qct
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "Saturation",
.minimum = 0,
- .maximum = 255,
+ .maximum = 127,
.step = 1,
.default_value = 64,
.flags = 0,

mch...@infradead.org

unread,
Mar 20, 2006, 11:20:18 AM3/20/06
to
From: Michael Krufky <mkr...@m1k.net>
Date: 1138043470 -0200

- fixed spelling error, exectuted --> executed.

Signed-off-by: Michael Krufky <mkr...@m1k.net>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c
diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c
index dff3893..82f0c5f 100644
--- a/drivers/media/video/em28xx/em28xx-core.c
+++ b/drivers/media/video/em28xx/em28xx-core.c
@@ -253,7 +253,7 @@ int em28xx_write_ac97(struct em28xx *dev
if ((ret = em28xx_read_reg(dev, AC97BUSY_REG)) < 0)
return ret;
else if (((u8) ret) & 0x01) {
- em28xx_warn ("AC97 command still being exectuted: not handled properly!\n");
+ em28xx_warn ("AC97 command still being executed: not handled properly!\n");
}
return 0;

mch...@infradead.org

unread,
Mar 20, 2006, 11:20:18 AM3/20/06
to
From: Marco Manenti <marco_...@colman.it>
Date: 1139301933 -0200

add IR support to KWorld DVB-T (cx22702-based)

Signed-off-by: Marco Manenti <marco_...@colman.it>
Signed-off-by: Michael Krufky <mkr...@linuxtv.org>


Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c
diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c
index 800e2b3..f2fba57 100644
--- a/drivers/media/video/cx88/cx88-input.c
+++ b/drivers/media/video/cx88/cx88-input.c
@@ -151,6 +151,7 @@ int cx88_ir_init(struct cx88_core *core,
switch (core->board) {
case CX88_BOARD_DNTV_LIVE_DVB_T:
case CX88_BOARD_KWORLD_DVB_T:
+ case CX88_BOARD_KWORLD_DVB_T_CX22702:
ir_codes = ir_codes_dntv_live_dvb_t;
ir->gpio_addr = MO_GP1_IO;
ir->mask_keycode = 0x1f;

mch...@infradead.org

unread,
Mar 20, 2006, 11:20:19 AM3/20/06
to
From: Adrian Bunk <bu...@stusta.de>
Date: 1141009669 -0300

This patch contains the following possible cleanups:
- update the Kconfig help to mention the VP310
- merge vp310_attach and mt312_attach into a new vp310_mt312_attach
to remove some code duplication

Signed-off-by: Adrian Bunk <bu...@stusta.de>


Signed-off-by: Michael Krufky <mkr...@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c
diff --git a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c
index 390cc3a..9c7f122 100644
--- a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c
+++ b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c
@@ -526,7 +526,7 @@ int flexcop_frontend_init(struct flexcop
info("found the stv0297 at i2c address: 0x%02x",alps_tdee4_stv0297_config.demod_address);
} else
/* try the sky v2.3 (vp310/Samsung tbdu18132(tsa5059)) */
- if ((fc->fe = vp310_attach(&skystar23_samsung_tbdu18132_config, &fc->i2c_adap)) != NULL) {
+ if ((fc->fe = vp310_mt312_attach(&skystar23_samsung_tbdu18132_config, &fc->i2c_adap)) != NULL) {
ops = fc->fe->ops;

ops->diseqc_send_master_cmd = flexcop_diseqc_send_master_cmd;
diff --git a/drivers/media/dvb/frontends/Kconfig b/drivers/media/dvb/frontends/Kconfig
diff --git a/drivers/media/dvb/frontends/Kconfig b/drivers/media/dvb/frontends/Kconfig
index 76b6a2a..c676b1e 100644
--- a/drivers/media/dvb/frontends/Kconfig
+++ b/drivers/media/dvb/frontends/Kconfig
@@ -29,7 +29,7 @@ config DVB_TDA8083
A DVB-S tuner module. Say Y when you want to support this frontend.

config DVB_MT312
- tristate "Zarlink MT312 based"
+ tristate "Zarlink VP310/MT312 based"
depends on DVB_CORE
help
A DVB-S tuner module. Say Y when you want to support this frontend.
diff --git a/drivers/media/dvb/frontends/mt312.c b/drivers/media/dvb/frontends/mt312.c
diff --git a/drivers/media/dvb/frontends/mt312.c b/drivers/media/dvb/frontends/mt312.c
index ec4e641..d3aea83 100644
--- a/drivers/media/dvb/frontends/mt312.c
+++ b/drivers/media/dvb/frontends/mt312.c
@@ -612,76 +612,6 @@ static void mt312_release(struct dvb_fro
kfree(state);
}

-static struct dvb_frontend_ops vp310_mt312_ops;
-
-struct dvb_frontend* vp310_attach(const struct mt312_config* config,
- struct i2c_adapter* i2c)
-{
- struct mt312_state* state = NULL;
-
- /* allocate memory for the internal state */
- state = kmalloc(sizeof(struct mt312_state), GFP_KERNEL);
- if (state == NULL)
- goto error;
-
- /* setup the state */
- state->config = config;
- state->i2c = i2c;
- memcpy(&state->ops, &vp310_mt312_ops, sizeof(struct dvb_frontend_ops));
- strcpy(state->ops.info.name, "Zarlink VP310 DVB-S");
-
- /* check if the demod is there */
- if (mt312_readreg(state, ID, &state->id) < 0)
- goto error;
- if (state->id != ID_VP310) {
- goto error;
- }
-
- /* create dvb_frontend */
- state->frequency = 90;
- state->frontend.ops = &state->ops;
- state->frontend.demodulator_priv = state;
- return &state->frontend;
-
-error:
- kfree(state);
- return NULL;
-}
-
-struct dvb_frontend* mt312_attach(const struct mt312_config* config,
- struct i2c_adapter* i2c)
-{
- struct mt312_state* state = NULL;
-
- /* allocate memory for the internal state */
- state = kmalloc(sizeof(struct mt312_state), GFP_KERNEL);
- if (state == NULL)
- goto error;
-
- /* setup the state */
- state->config = config;
- state->i2c = i2c;
- memcpy(&state->ops, &vp310_mt312_ops, sizeof(struct dvb_frontend_ops));
- strcpy(state->ops.info.name, "Zarlink MT312 DVB-S");
-
- /* check if the demod is there */
- if (mt312_readreg(state, ID, &state->id) < 0)
- goto error;
- if (state->id != ID_MT312) {
- goto error;
- }
-
- /* create dvb_frontend */
- state->frequency = 60;
- state->frontend.ops = &state->ops;
- state->frontend.demodulator_priv = state;
- return &state->frontend;
-
-error:
- kfree(state);
- return NULL;
-}
-
static struct dvb_frontend_ops vp310_mt312_ops = {

.info = {
@@ -720,6 +650,49 @@ static struct dvb_frontend_ops vp310_mt3
.set_voltage = mt312_set_voltage,
};

+struct dvb_frontend* vp310_mt312_attach(const struct mt312_config* config,
+ struct i2c_adapter* i2c)
+{
+ struct mt312_state* state = NULL;
+
+ /* allocate memory for the internal state */
+ state = kmalloc(sizeof(struct mt312_state), GFP_KERNEL);
+ if (state == NULL)
+ goto error;
+
+ /* setup the state */
+ state->config = config;
+ state->i2c = i2c;
+ memcpy(&state->ops, &vp310_mt312_ops, sizeof(struct dvb_frontend_ops));
+
+ /* check if the demod is there */
+ if (mt312_readreg(state, ID, &state->id) < 0)
+ goto error;
+
+ switch (state->id) {
+ case ID_VP310:
+ strcpy(state->ops.info.name, "Zarlink VP310 DVB-S");
+ state->frequency = 90;
+ break;
+ case ID_MT312:
+ strcpy(state->ops.info.name, "Zarlink MT312 DVB-S");
+ state->frequency = 60;
+ break;
+ default:
+ printk (KERN_WARNING "Only Zarlink VP310/MT312 are supported chips.\n");
+ goto error;
+ }
+
+ /* create dvb_frontend */
+ state->frontend.ops = &state->ops;
+ state->frontend.demodulator_priv = state;
+ return &state->frontend;
+
+error:
+ kfree(state);
+ return NULL;
+}
+
module_param(debug, int, 0644);
MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off).");

@@ -727,5 +700,4 @@ MODULE_DESCRIPTION("Zarlink VP310/MT312
MODULE_AUTHOR("Andreas Oberritter <o...@linuxtv.org>");
MODULE_LICENSE("GPL");

-EXPORT_SYMBOL(mt312_attach);
-EXPORT_SYMBOL(vp310_attach);
+EXPORT_SYMBOL(vp310_mt312_attach);
diff --git a/drivers/media/dvb/frontends/mt312.h b/drivers/media/dvb/frontends/mt312.h
diff --git a/drivers/media/dvb/frontends/mt312.h b/drivers/media/dvb/frontends/mt312.h
index b3a53a7..074d844 100644
--- a/drivers/media/dvb/frontends/mt312.h
+++ b/drivers/media/dvb/frontends/mt312.h
@@ -38,10 +38,8 @@ struct mt312_config


int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params);

};

-extern struct dvb_frontend* mt312_attach(const struct mt312_config* config,
- struct i2c_adapter* i2c);
+struct dvb_frontend* vp310_mt312_attach(const struct mt312_config* config,
+ struct i2c_adapter* i2c);

-extern struct dvb_frontend* vp310_attach(const struct mt312_config* config,
- struct i2c_adapter* i2c);

#endif // MT312_H

mch...@infradead.org

unread,
Mar 20, 2006, 11:20:19 AM3/20/06
to
From: Michael Krufky <mkr...@linuxtv.org>
Date: 1139300735 -0200

- tuner_dbg will show tuner param and range selected

Signed-off-by: Michael Krufky <mkr...@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mch...@infradead.org>
---

diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c
diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c
index 58fa0d2..17e29cc 100644
--- a/drivers/media/video/tuner-simple.c
+++ b/drivers/media/video/tuner-simple.c
@@ -188,7 +188,7 @@ static void default_set_tv_freq(struct i


/* i == 0 -> VHF_LO

* i == 1 -> VHF_HI

* i == 2 -> UHF */

- tuner_dbg("tv: range %d\n",i);
+ tuner_dbg("tv: param %d, range %d\n",j,i);

div=freq + IFPCoff + offset;

Valdis.K...@vt.edu

unread,
Mar 20, 2006, 1:00:13 PM3/20/06
to
On Mon, 20 Mar 2006 12:08:19 -0300, mch...@infradead.org said:
> This patch series is also available under v4l-dvb.git tree at:
> kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git
>
> Linus, please pull these from master branch.

141 patchbombs. For part 1.

Can we please have a discussion of what happens for part 2?

Mauro Carvalho Chehab

unread,
Mar 20, 2006, 1:00:22 PM3/20/06
to
I broke into two parts to not scare too much... There are 62 patches
remaining.

Maybe I can just send the first email and let people check the patches
at -git.
>
> --
> video4linux-list mailing list
> Unsubscribe mailto:video4linux-...@redhat.com?subject=unsubscribe
> https://www.redhat.com/mailman/listinfo/video4linux-list
Cheers,
Mauro.

Andrew Morton

unread,
Mar 21, 2006, 7:30:13 AM3/21/06
to
mch...@infradead.org wrote:
>
> StGit genreates patches-* when you run stg export command.
> It makes no sense to show such directories as changes on git status.

That's not a DVB patch. Things like this should be submitted separately
please.

Linus Torvalds

unread,
Mar 21, 2006, 10:50:07 AM3/21/06
to

On Mon, 20 Mar 2006, mch...@infradead.org wrote:
>
> Linus, please pull these from master branch.

No. You have totally destroyed your git tree.

In particular, commit e338b736f1aee59b757130ffdc778538b7db18d6 is crap,
crap, CRAP.

It's "Merging Linus tree", but it's not a merge at all: you have just
applied the _patch_ to merge the changes in my tree, but you haven't
actually told git to do so.

I don't know how/why you did that, but it's totally bogus, and I refuse to
pull from that tree. That's a 5000+ line diff, affecting about 180 files!

Now, when I pull from your tree, since the changes are already in mine,
git is smart and it will all _merge_ fine, and there are no changes to
those files as far as the end result is concerned. But that's still damn
bogus.

Have you done things like that before, and I just didn't notice? And why?

Linus

Linus Torvalds

unread,
Mar 21, 2006, 11:40:19 AM3/21/06
to

On Tue, 21 Mar 2006, Linus Torvalds wrote:
>
> In particular, commit e338b736f1aee59b757130ffdc778538b7db18d6 is crap,
> crap, CRAP.

Looking closer, the commit after that is a _real_ merge, and it looks like
you did something strange when that at first conflicted in saa7134-dvb.c
or something. I just don't even see _how_ you created that bogus non-merge
commit. Are you using cogito? It has some problems with conflict
resolution, I think. Real git should not even have allowed you to commit
something that hadn't been resolved.

Anyway, if you want to fix this up without re-doing _everything_, the way
to do so is to just start a new branch, and cherry-pick the non-crap
commits. So you can fix it up, largely automatedly, with git.

I'm actually trying to do that right now, to see if I can re-create your
tree without the errors.

Mauro Carvalho Chehab

unread,
Mar 21, 2006, 12:50:19 PM3/21/06
to
Linus,

Em Ter, 2006-03-21 ąs 08:26 -0800, Linus Torvalds escreveu:
> > In particular, commit e338b736f1aee59b757130ffdc778538b7db18d6 is crap,
> > crap, CRAP.

Sorry for the troubles. I didn't noticed anything here indicating
troubles, otherwise I would never asked you to pull it.

> Looking closer, the commit after that is a _real_ merge, and it looks like
> you did something strange when that at first conflicted in saa7134-dvb.c
> or something. I just don't even see _how_ you created that bogus non-merge
> commit. Are you using cogito? It has some problems with conflict
> resolution, I think. Real git should not even have allowed you to commit
> something that hadn't been resolved.

I'm using stgit. It allows me to export the patches from V4L/DVB
Mercurial tree, removing backward compatible code and correcting the
patches. Is it broken?

Maybe I'm using a bad procedure to keep my -git tree.

My current procedure is:
branch origin - Your tree replica
branch work - my stgit main tree
branch work-fixes - my stgit tree for bug fixes
branch master - patches to current kernel
branch devel - patches to next kernel

All patches are generated against work branch, with stgit.
Branch work-fixes receives patches by using:

stg pick <sha>@work

Before commiting to kernel.org, I do:
at origin:
git pull linus_tree

at master:
git pull . origin
git pull . work-fixes

at devel:
git pull . origin
git pull . work

>
> Anyway, if you want to fix this up without re-doing _everything_, the way
> to do so is to just start a new branch, and cherry-pick the non-crap
> commits. So you can fix it up, largely automatedly, with git.
>
> I'm actually trying to do that right now, to see if I can re-create your
> tree without the errors.

I'll retrieve from your tree and I'll do a double check if something
were misapplied.

>
> Linus
Cheers,
Mauro.

Linus Torvalds

unread,
Mar 21, 2006, 1:10:15 PM3/21/06
to

On Tue, 21 Mar 2006, Mauro Carvalho Chehab wrote:
>
> > Looking closer, the commit after that is a _real_ merge, and it looks like
> > you did something strange when that at first conflicted in saa7134-dvb.c
> > or something. I just don't even see _how_ you created that bogus non-merge
> > commit. Are you using cogito? It has some problems with conflict
> > resolution, I think. Real git should not even have allowed you to commit
> > something that hadn't been resolved.
>
> I'm using stgit. It allows me to export the patches from V4L/DVB
> Mercurial tree, removing backward compatible code and correcting the
> patches. Is it broken?

Hmm. I don't know if it's stgit per se. Maybe the breakage came from a
mercurial merge that got exported to git as a patch, rather than as a
merge.

If that's the case, then I'm afraid that the problem is the mercurial
part, or at least the hg->git conversion. I have no idea how hg does
merges, and maybe the broken merge was done in the hg tree.

The really sad part about this is that it means I have to be much more
careful with dvb merges, since I can't trust the tree any more, when it
apparently has something strange going on. If things like this keep on
happening, I'll have to ask you guys to change your work habits.

That said, I _tried_ to check for similar cases in the past history, and I
couldn't find any. So hopefully this was a one-off occurrence.

Linus

Mauro Carvalho Chehab

unread,
Mar 21, 2006, 1:30:23 PM3/21/06
to

> Hmm. I don't know if it's stgit per se. Maybe the breakage came from a
> mercurial merge that got exported to git as a patch, rather than as a
> merge.
We can't discard any cause, but, at mercurial, I just export the
patches, removing all version-dependent code. After doing, I do a diff
between Mercurial and git trees. Only after that, I proceed.

>
> If that's the case, then I'm afraid that the problem is the mercurial
> part, or at least the hg->git conversion. I have no idea how hg does
> merges, and maybe the broken merge was done in the hg tree.
Patch generation seems to be ok, since I have the habit to check all
patches before commiting. Also, diffstat I sent were generated by
looking at the stg exported patches. I dunno if this is common, but
running git-fsck-objects after working for a while with stgit generates
lots of
>
> The really sad part about this is that it means I have to be much more
> careful with dvb merges, since I can't trust the tree any more, when it
> apparently has something strange going on.
I'll rebuild the entire tree from the beginning, and I'll also update
both git and stg version to latest ones.

> If things like this keep on happening, I'll have to ask you guys to change your work habits.
>
> That said, I _tried_ to check for similar cases in the past history, and I
> couldn't find any. So hopefully this was a one-off occurrence.
I hope this won't happen again.

What is sad is that I can't determinate the root cause of this breakage,
but it seemed to be associated with merging handling at stg or git.

One possibility is that stg pick doesn't seem to be preserving commit
date, so that patches are compared with the wrong versions.

The first 141 patches were committed in the past, starting from the end
of 2.6.15 window and were already committed at stgit. I just did a git
pull . prev to retrieve they.

The newer 49, however, were not committed yesterday, but also in the
past. Yesterday, I just picked them from work branch. However, stgit
marked commit timestamp as if they were just committed. This might have
generated some troubles at resolution conflict code on git.
>
> Linus
Cheers,
Mauro.

Linus Torvalds

unread,
Mar 21, 2006, 1:50:16 PM3/21/06
to

On Tue, 21 Mar 2006, Mauro Carvalho Chehab wrote:
>

> What is sad is that I can't determinate the root cause of this breakage,
> but it seemed to be associated with merging handling at stg or git.

Note that the bad commit has a totally different commit message from any
of your other merges. It was this one:

diff-tree e338b736f1aee59b757130ffdc778538b7db18d6 (from cb31c70cdf1ac7034bed5f83d543f4888c39888a)
Author: Mauro Carvalho Chehab <mch...@infradead.org>
AuthorDate: Fri Mar 10 01:30:04 2006 -0300
Commit: Mauro Carvalho Chehab <mch...@infradead.org>
CommitDate: Fri Mar 10 01:30:04 2006 -0300

Merging Linus tree

:100644 100644 be5ae600f5337dbb14daa8d4cace110486e14f79 81bc51369f59a413108fd8b150c3090541ba49f8 M Documentation/feature-removal-schedule.txt
:100644 100644 75205391b335f85c9b8a599d0d3b4c0dd1a8b41b fc99075e0af47f0b73a2ae2dfb7d19920c604dea M Documentation/kernel-parameters.txt
:100644 100644 9006063e73691da7b68449955a135f7c9317e2cd da677f829f7689966bf09aeda6d89fc4b6a876d1 M arch/alpha/kernel/irq.c
...

ie it does _not_ fit the pattern of your other merges.

Here's an example of a real git merge, with a conflict fixed up:

Merge: 7705a87... 86d720e...
Author: Mauro Carvalho Chehab <mch...@infradead.org>
Date: Mon Mar 20 06:43:08 2006 -0300

Merge branch 'prev'

Conflicts:

drivers/media/video/em28xx/em28xx-video.c

which is the standard commit message for modern git when a conflict
happened that you needed to fix up before committing.

And here's a couple of your non-conflicting merges:

commit 155ec9e63da962bf26ffc65a4088c6cc935f28db
Merge: 8e2cc1a... 8a59822...
Author: Mauro Carvalho Chehab <mch...@infradead.org>
Date: Wed Mar 8 12:34:10 2006 -0300

Merge branch 'work-fixes'

commit cb31c70cdf1ac7034bed5f83d543f4888c39888a
Merge: 06b1c30... 044f324...
Author: Mauro Carvalho Chehab <mch...@infradead.org>
Date: Wed Mar 8 12:33:42 2006 -0300

Merge branch 'work'

which are also clearly generated with git (this is the standard
boilerplate git commit message for a merge with no conflict).

So just the merge message tells me that it wasn't a regular git merge, but
something else.

Linus

Mauro Carvalho Chehab

unread,
Mar 21, 2006, 2:20:13 PM3/21/06
to
Linus,

Em Ter, 2006-03-21 ąs 10:42 -0800, Linus Torvalds escreveu:
>
> On Tue, 21 Mar 2006, Mauro Carvalho Chehab wrote:
> >
> > What is sad is that I can't determinate the root cause of this breakage,
> > but it seemed to be associated with merging handling at stg or git.
>
> Note that the bad commit has a totally different commit message from any
> of your other merges. It was this one:
>
> diff-tree e338b736f1aee59b757130ffdc778538b7db18d6 (from cb31c70cdf1ac7034bed5f83d543f4888c39888a)
> Author: Mauro Carvalho Chehab <mch...@infradead.org>
> AuthorDate: Fri Mar 10 01:30:04 2006 -0300
> Commit: Mauro Carvalho Chehab <mch...@infradead.org>
> CommitDate: Fri Mar 10 01:30:04 2006 -0300
>
> Merging Linus tree
>
> :100644 100644 be5ae600f5337dbb14daa8d4cace110486e14f79 81bc51369f59a413108fd8b150c3090541ba49f8 M Documentation/feature-removal-schedule.txt
> :100644 100644 75205391b335f85c9b8a599d0d3b4c0dd1a8b41b fc99075e0af47f0b73a2ae2dfb7d19920c604dea M Documentation/kernel-parameters.txt
> :100644 100644 9006063e73691da7b68449955a135f7c9317e2cd da677f829f7689966bf09aeda6d89fc4b6a876d1 M arch/alpha/kernel/irq.c
> ...
>
> ie it does _not_ fit the pattern of your other merges.

Weird, I can't see all those stuff here. It shows something like
(running from master copy at kernel.org):

$ git-show e338b736f1aee59b757130ffdc778538b7db18d6


diff-tree e338b736f1aee59b757130ffdc778538b7db18d6 (from
cb31c70cdf1ac7034bed5f83d543f4888c39888a)
Author: Mauro Carvalho Chehab <mch...@infradead.org>

Date: Fri Mar 10 01:30:04 2006 -0300

Merging Linus tree

diff --git a/Documentation/feature-removal-schedule.txt
b/Documentation/feature-removal-schedule.txt
...

So, after the merging message, I have a normal diff with:

179 files changed, 1274 insertions(+), 785 deletions(-)

Seeming all perfect from my knowledge about git.

I don't want to bother you more with this subject. If you don't mind,
I'll make a brief from what we've discussed here, and I'll open a thread
at git mailing list c/c you.

>From my part, I'm not comfortable with a weird situation that generated
such bad merging, so, I'm very concerned about it. I'm here to
contribute, not to disturb with bad patches or bad merges. If this issue
is not addressed, it may generate troubles in the future.

> Linus
Cheers,
Mauro.

Linus Torvalds

unread,
Mar 21, 2006, 2:40:11 PM3/21/06
to

On Tue, 21 Mar 2006, Mauro Carvalho Chehab wrote:
>
> Weird, I can't see all those stuff here. It shows something like
> (running from master copy at kernel.org):

I just did the raw output, so my output was from

git show --pretty=fuller -r e338b7

which isn't the default, but it's useful if you want to see both committer
and author information (and the raw format is just because I wasn't
interested in the diff itself, just looking at how many files where
changed).

> So, after the merging message, I have a normal diff with:
>
> 179 files changed, 1274 insertions(+), 785 deletions(-)

Yeah, we're talking about the same commit.

> Seeming all perfect from my knowledge about git.

It's a perfectly good commit. BUT IT IS NOT A MERGE, AND IT IS NOT A DIFF
THAT I WANT TO SEE COMING IN FROM AN OUTSIDE TREE!

Basically, in the DVB tree you have absolutely _no_ business in "merging"
work from my tree as a patch, especially when the patch you merge has
absolutely zero to do with DVB. You just applied a 5000-line patch to the
tree, with no merge message other than "Merge from Linus tree", and no
attribution about what the f*ck was merged, and why.

THAT is the part I'm unhappy with. The git tree is not "corrupt" from a
technical standpoint (it passes fsck). It's "corrupt" because it contains
a patch that shouldn't be there, that is mis-attributed, and that
incorrectly claims to be a merge when it isn't - it's just a random patch
generated against my tree.

Linus

Daniel Barkalow

unread,
Mar 21, 2006, 7:00:12 PM3/21/06
to
On Tue, 21 Mar 2006, Linus Torvalds wrote:

> On Tue, 21 Mar 2006, Mauro Carvalho Chehab wrote:
> >
> > Weird, I can't see all those stuff here. It shows something like
> > (running from master copy at kernel.org):
>
> I just did the raw output, so my output was from
>
> git show --pretty=fuller -r e338b7
>
> which isn't the default, but it's useful if you want to see both committer
> and author information (and the raw format is just because I wasn't
> interested in the diff itself, just looking at how many files where
> changed).
>
> > So, after the merging message, I have a normal diff with:
> >
> > 179 files changed, 1274 insertions(+), 785 deletions(-)
>
> Yeah, we're talking about the same commit.
>
> > Seeming all perfect from my knowledge about git.
>
> It's a perfectly good commit. BUT IT IS NOT A MERGE, AND IT IS NOT A DIFF
> THAT I WANT TO SEE COMING IN FROM AN OUTSIDE TREE!

Isn't this what you'd get if you accidentally removed .git/MERGE_HEAD
while trying to resolve a merge, and then absent-mindedly described what
you'd done in the commit message (forgetting that it ought to have
generated the commit message for you in this situation)?

I expect the source of the bad commit is losing that, although I don't
know any obvious way to lose it (and still have the index contents which
you're merging).

-Daniel
*This .sig left intentionally blank*

Linus Torvalds

unread,
Mar 21, 2006, 7:40:05 PM3/21/06
to

On Tue, 21 Mar 2006, Daniel Barkalow wrote:
>
> Isn't this what you'd get if you accidentally removed .git/MERGE_HEAD
> while trying to resolve a merge, and then absent-mindedly described what
> you'd done in the commit message (forgetting that it ought to have
> generated the commit message for you in this situation)?

Yes, exactly. But the point is, that if anybody does something like that,
they should be
(a) shot
(b) told that they should never ever do that again

(Not necessarily in that order).

The thing is, the above workflow generates a _buggy_ repository. It will
be entirely "correct" in the sense that it passes all git self-consistency
checks, but it's not really any different from doing

dd if=/dev/urandom of=Makefile count=2
git commit Makefile

and then asking me to pull from the result.

> I expect the source of the bad commit is losing that, although I don't
> know any obvious way to lose it (and still have the index contents which
> you're merging).

Something like "git reset HEAD" + "git commit" might do it.

Linus

Mauro Carvalho Chehab

unread,
Mar 22, 2006, 7:10:11 AM3/22/06
to
Em Ter, 2006-03-21 às 18:53 -0500, Daniel Barkalow escreveu:
> On Tue, 21 Mar 2006, Linus Torvalds wrote:

> Isn't this what you'd get if you accidentally removed .git/MERGE_HEAD
> while trying to resolve a merge, and then absent-mindedly described what
> you'd done in the commit message (forgetting that it ought to have
> generated the commit message for you in this situation)?

For sure I didn't this by hand. The only possibility is that git, for
some unknown reason, decided to remove it by itself. Maybe another git
command in-between git pull and git commit might do it, without
reverting to its previous state?

Cheers,
Mauro.

Junio C Hamano

unread,
Mar 22, 2006, 4:40:09 PM3/22/06
to
Linus Torvalds <torv...@osdl.org> writes:

> The thing is, the above workflow generates a _buggy_ repository. It will
> be entirely "correct" in the sense that it passes all git self-consistency
> checks, but it's not really any different from doing
>
> dd if=/dev/urandom of=Makefile count=2
> git commit Makefile

It would be more like

$ dd if=/dev/urandom of=Makefile count=2
$ git commit Makefile
$ git checkout HEAD^ Makefile
$ git commit Makefile

> and then asking me to pull from the result.

... because the point is that the end-result tree being what is
desired is not the only thing that matters, but the history to
get there should not have unnecessary garbage.

I am curious how you found it initially. After you pulled but
before you did further work on top of the updated HEAD, I am
suspecting that there is some sanity check done by you to detect
that you pulled a faulty tree and decide to discard the merge.
It might help to share that with your subsystem maintainers, so
that they can do the same when merging from their feeders.

Linus Torvalds

unread,
Mar 22, 2006, 10:40:09 PM3/22/06
to

On Wed, 22 Mar 2006, Junio C Hamano wrote:
>
> I am curious how you found it initially. After you pulled but
> before you did further work on top of the updated HEAD, I am
> suspecting that there is some sanity check done by you to detect
> that you pulled a faulty tree and decide to discard the merge.

I tend to have a two-level safety check. The first is that I just check
the diffstat of the result of the pull (I realize that people hate the
fact that the diffstat is often the most expensive part of a pull, but to
me it's one of the more important things).

So I check the diffstat not only for sanity (if somebody asks me to pull a
tree that is ARM-specific, the diffstat should only show ARM files
changing), but also tend to match it up against what the "please pull"
email _claimed_ the diffstat should look like

This is why I ask people to include the diffstat and shortlog in their
"please pull" messages: not only does it mean that I get a high-level idea
of what the pull is going to do even before I do it, it also means that if
my end result is different from the claimed one, it's likely some
confusion with the tree (or I pulled the wrong branch because I didn't
notice that it wasn't the main one).

This first-level safety check generally catches any serious mistakes, and
it's helped me catch cases where the other end did something really stupid
by mistake.

However, in this case, the diffstat didn't actually show anything strange,
because the problem was a bogus merge from my own tree, which obviously
thus merged perfectly and caused no actual _data_ changes as far as the
end result was concerned.

So this one was caught by the fact that I'm just fairly anal about the
history being sensible (as the ACPI people may remember ;), so I usually
also do

gitk ORIG_HEAD..

after pulling. That gives me a nice overview of what the heck the history
looks like, and is what caught this one. I don't _always_ do it, and
especially with people who have been merging with me since BK days I
sometimes don't bother with this thing, but I do it most of the time.

Finally, I do a "git-fsck-cache" after pretty much every "git pull"
sequence just because I'm anal.

Basically, if the history looks sane, and the diffstat doesn't raise any
red flags, I'm then usually happy. Of course, since I only really pull
from people that I trust _anyway_, none of this is about really trying to
find "bad stuff" - it's more about

(a) stupid mistakes. Especially early on, this (and some extra checks,
like doing "git-whatchanged ORIG_HEAD.." - which is just a much
easier way to scan the commits in more detail without actually seeing
the full patches than gitk) caught a number of cases where the other
end had simply done a mistake. We had a number of those. Happily,
people have clearly gotten more used to git, and I also think that
git simply doesn't allow some of those mistakes any more.

(b) keeping the history clean. I _hate_ having an unreadable history. The
"whole project" history inevitably gets very complex after a while,
but I'm personally convinced that as long as the history makes sense
in the "small picture" (ie the "gitk ORIG_HEAD.." kind of thing), it
just helps the big picture.

So for _me_, I don't worry so much about the actual patch itself. I seldom
have the time to look closely and the actual changed lines, although the
merges with Andrew I tend to actually check those (partly because they
aren't git merges and so I actually have to check the emails one by one
_anyway_, but partly because unlike the git merges, Andrew's stuff tends
to be all over the place and often to very core stuff, so I need to be
more aware of them).

Linus

0 new messages