summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2007-03-13 13:50:15 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-03-13 13:50:15 -0300
commitdbc0579cac0ed9f9af0bcf361a5c3fc56f4f8395 (patch)
tree8e9f703aba9ff7c66ddf4fef5a740a6ef44c71a4
parentb4bd63c6ce993e0bf2bf3aaecc3384740b495845 (diff)
parenta73981e95b53d62cc7e42ce54e54473f3758d2e7 (diff)
downloadmediapointer-dvb-s2-dbc0579cac0ed9f9af0bcf361a5c3fc56f4f8395.tar.gz
mediapointer-dvb-s2-dbc0579cac0ed9f9af0bcf361a5c3fc56f4f8395.tar.bz2
merge: http://linuxtv.org/hg/~mkrufky/v4l-dvb
From: Mauro Carvalho Chehab <mchehab@infradead.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--linux/Documentation/video4linux/CARDLIST.ivtv18
-rw-r--r--linux/Documentation/video4linux/README.ivtv187
-rw-r--r--linux/drivers/media/dvb/dvb-usb/au6610.c6
-rw-r--r--linux/drivers/media/dvb/dvb-usb/gl861.c6
-rw-r--r--linux/drivers/media/dvb/dvb-usb/m920x.c141
-rw-r--r--linux/drivers/media/dvb/dvb-usb/m920x.h46
-rw-r--r--linux/drivers/media/video/ivtv/ivtv-driver.c86
-rw-r--r--linux/drivers/media/video/ivtv/ivtv-driver.h2
-rw-r--r--linux/drivers/media/video/ivtv/ivtv-fileops.c3
-rw-r--r--linux/drivers/media/video/ivtv/ivtv-ioctl.c310
-rw-r--r--linux/drivers/media/video/msp3400-driver.c22
-rw-r--r--linux/drivers/media/video/saa7115.c3
-rw-r--r--linux/drivers/media/video/tuner-core.c18
-rw-r--r--linux/include/linux/dvb/video.h7
14 files changed, 565 insertions, 290 deletions
diff --git a/linux/Documentation/video4linux/CARDLIST.ivtv b/linux/Documentation/video4linux/CARDLIST.ivtv
new file mode 100644
index 000000000..ddd76a0eb
--- /dev/null
+++ b/linux/Documentation/video4linux/CARDLIST.ivtv
@@ -0,0 +1,18 @@
+ 1 -> Hauppauge WinTV PVR-250
+ 2 -> Hauppauge WinTV PVR-350
+ 3 -> Hauppauge WinTV PVR-150 or PVR-500
+ 4 -> AVerMedia M179 [1461:a3ce,1461:a3cf]
+ 5 -> Yuan MPG600/Kuroutoshikou iTVC16-STVLP [12ab:fff3,12ab:ffff]
+ 6 -> Yuan MPG160/Kuroutoshikou iTVC15-STVLP [12ab:0000,10fc:40a0]
+ 7 -> Yuan PG600/DiamondMM PVR-550 [ff92:0070,ffab:0600]
+ 8 -> Adaptec AVC-2410 [9005:0093]
+ 9 -> Adaptec AVC-2010 [9005:0092]
+10 -> NAGASE TRANSGEAR 5000TV [1461:bfff]
+11 -> AOpen VA2000MAX-STN6 [0000:ff5f]
+12 -> YUAN MPG600GR/Kuroutoshikou CX23416GYC-STVLP [12ab:0600,fbab:0600,1154:0523]
+13 -> I/O Data GV-MVP/RX [10fc:d01e,10fc:d038,10fc:d039]
+14 -> I/O Data GV-MVP/RX2E [10fc:d025]
+15 -> GOTVIEW PCI DVD (partial support only) [12ab:0600]
+16 -> GOTVIEW PCI DVD2 Deluxe [ffac:0600]
+17 -> Yuan MPC622 [ff01:d998]
+18 -> Digital Cowboy DCT-MTVP1 [1461:bfff]
diff --git a/linux/Documentation/video4linux/README.ivtv b/linux/Documentation/video4linux/README.ivtv
new file mode 100644
index 000000000..73df22c40
--- /dev/null
+++ b/linux/Documentation/video4linux/README.ivtv
@@ -0,0 +1,187 @@
+
+ivtv release notes
+==================
+
+This is a v4l2 device driver for the Conexant cx23415/6 MPEG encoder/decoder.
+The cx23415 can do both encoding and decoding, the cx23416 can only do MPEG
+encoding. Currently the only card featuring full decoding support is the
+Hauppauge PVR-350.
+
+NOTE: this driver requires the latest encoder firmware (version 2.06.039, size
+376836 bytes). Get the firmware from here:
+
+http://dl.ivtvdriver.org/ivtv/firmware/firmware.tar.gz
+
+NOTE: 'normal' TV applications do not work with this driver, you need
+an application that can handle MPEG input such as mplayer, xine, MythTV,
+etc.
+
+The primary goal of the IVTV project is to provide a "clean room" Linux
+Open Source driver implementation for video capture cards based on the
+iCompression iTVC15 or Conexant CX23415/CX23416 MPEG Codec.
+
+Features:
+ * Hardware mpeg2 capture of broadcast video (and sound) via the tuner or
+ S-Video/Composite and audio line-in.
+ * Hardware mpeg2 capture of FM radio where hardware support exists
+ * Supports NTSC, PAL, SECAM with stereo sound
+ * Supports SAP and bilingual transmissions.
+ * Supports raw VBI (closed captions and teletext).
+ * Supports sliced VBI (closed captions and teletext) and is able to insert
+ this into the captured MPEG stream.
+ * Supports raw YUV and PCM input.
+
+Additional features for the PVR-350 (CX23415 based):
+ * Provides hardware mpeg2 playback
+ * Provides comprehensive OSD (On Screen Display: ie. graphics overlaying the
+ video signal)
+ * Provides a framebuffer (allowing X applications to appear on the video
+ device) (this framebuffer is not yet part of the kernel. In the meantime it
+ is available from www.ivtvdriver.org).
+ * Supports raw YUV output.
+
+IMPORTANT: In case of problems first read this page:
+ http://www.ivtvdriver.org/index.php/Troubleshooting
+
+See also:
+
+Homepage + Wiki
+http://www.ivtvdriver.org
+
+IRC
+irc://irc.freenode.net/ivtv-dev
+
+----------------------------------------------------------
+
+Devices
+=======
+
+A maximum of 12 ivtv boards are allowed at the moment.
+
+Cards that don't have a video output capability (i.e. non PVR350 cards)
+lack the vbi8, vbi16, video16 and video48 devices. They also do not
+support the framebuffer device /dev/fbx for OSD.
+
+The radio0 device may or may not be present, depending on whether the
+card has a radio tuner or not.
+
+Here is a list of the base v4l devices:
+crw-rw---- 1 root video 81, 0 Jun 19 22:22 /dev/video0
+crw-rw---- 1 root video 81, 16 Jun 19 22:22 /dev/video16
+crw-rw---- 1 root video 81, 24 Jun 19 22:22 /dev/video24
+crw-rw---- 1 root video 81, 32 Jun 19 22:22 /dev/video32
+crw-rw---- 1 root video 81, 48 Jun 19 22:22 /dev/video48
+crw-rw---- 1 root video 81, 64 Jun 19 22:22 /dev/radio0
+crw-rw---- 1 root video 81, 224 Jun 19 22:22 /dev/vbi0
+crw-rw---- 1 root video 81, 228 Jun 19 22:22 /dev/vbi8
+crw-rw---- 1 root video 81, 232 Jun 19 22:22 /dev/vbi16
+
+Base devices
+============
+
+For every extra card you have the numbers increased by one. For example,
+/dev/video0 is listed as the 'base' encoding capture device so we have:
+
+ /dev/video0 is the encoding capture device for the first card (card 0)
+ /dev/video1 is the encoding capture device for the second card (card 1)
+ /dev/video2 is the encoding capture device for the third card (card 2)
+
+Note that if the first card doesn't have a feature (eg no decoder, so no
+video16, the second card will still use video17. The simple rule is 'add
+the card number to the base device number'. If you have other capture
+cards (e.g. WinTV PCI) that are detected first, then you have to tell
+the ivtv module about it so that it will start counting at 1 (or 2, or
+whatever). Otherwise the device numbers can get confusing. The ivtv
+'ivtv_first_minor' module option can be used for that.
+
+
+/dev/video0
+The encoding capture device(s).
+Read-only.
+
+Reading from this device gets you the MPEG1/2 program stream.
+Example:
+
+cat /dev/video0 > my.mpg (you need to hit ctrl-c to exit)
+
+
+/dev/video16
+The decoder output device(s)
+Write-only. Only present if the MPEG decoder (i.e. CX23415) exists.
+
+An mpeg2 stream sent to this device will appear on the selected video
+display, audio will appear on the line-out/audio out. It is only
+available for cards that support video out. Example:
+
+cat my.mpg >/dev/video16
+
+
+/dev/video24
+The raw audio capture device(s).
+Read-only
+
+The raw audio PCM stereo stream from the currently selected
+tuner or audio line-in. Reading from this device results in a raw
+(signed 16 bit Little Endian, 48000 Hz, stereo pcm) capture.
+This device only captures audio. This should be replaced by an ALSA
+device in the future.
+Note that there is no corresponding raw audio output device, this is
+not supported in the decoder firmware.
+
+
+/dev/video32
+The raw video capture device(s)
+Read-only
+
+The raw YUV video output from the current video input. The YUV format
+is non-standard (V4L2_PIX_FMT_HM12).
+
+Note that the YUV and PCM streams are not synchronized, so they are of
+limited use.
+
+
+/dev/video48
+The raw video display device(s)
+Write-only. Only present if the MPEG decoder (i.e. CX23415) exists.
+
+Writes a YUV stream to the decoder of the card.
+
+
+/dev/radio0
+The radio tuner device(s)
+Cannot be read or written.
+
+Used to enable the radio tuner and tune to a frequency. You cannot
+read or write audio streams with this device. Once you use this
+device to tune the radio, use /dev/video24 to read the raw pcm stream
+or /dev/video0 to get an mpeg2 stream with black video.
+
+
+/dev/vbi0
+The 'vertical blank interval' (Teletext, CC, WSS etc) capture device(s)
+Read-only
+
+Captures the raw (or sliced) video data sent during the Vertical Blank
+Interval. This data is used to encode teletext, closed captions, VPS,
+widescreen signalling, electronic program guide information, and other
+services.
+
+
+/dev/vbi8
+Processed vbi feedback device(s)
+Read-only. Only present if the MPEG decoder (i.e. CX23415) exists.
+
+The sliced VBI data embedded in an MPEG stream is reproduced on this
+device. So while playing back a recording on /dev/video16, you can
+read the embedded VBI data from /dev/vbi8.
+
+
+/dev/vbi16
+The vbi 'display' device(s)
+Write-only. Only present if the MPEG decoder (i.e. CX23415) exists.
+
+Can be used to send sliced VBI data to the video-out connector.
+
+---------------------------------
+
+Hans Verkuil <hverkuil@xs4all.nl>
diff --git a/linux/drivers/media/dvb/dvb-usb/au6610.c b/linux/drivers/media/dvb/dvb-usb/au6610.c
index 91079891d..3314f8c0c 100644
--- a/linux/drivers/media/dvb/dvb-usb/au6610.c
+++ b/linux/drivers/media/dvb/dvb-usb/au6610.c
@@ -40,7 +40,7 @@ static int au6610_usb_msg(struct dvb_usb_device *d, u8 operation, u8 addr,
}
ret = usb_control_msg(d->udev, usb_rcvctrlpipe(d->udev, 0), operation,
- USB_TYPE_VENDOR|USB_DIR_IN, addr, index, usb_buf,
+ USB_TYPE_VENDOR|USB_DIR_IN, addr << 1, index, usb_buf,
sizeof(usb_buf), AU6610_USB_TIMEOUT);
if (ret < 0)
@@ -124,7 +124,7 @@ static int au6610_identify_state(struct usb_device *udev,
}
static struct zl10353_config au6610_zl10353_config = {
- .demod_address = 0x1e,
+ .demod_address = 0x0f,
.no_tuner = 1,
.parallel_ts = 1,
};
@@ -140,7 +140,7 @@ static int au6610_zl10353_frontend_attach(struct dvb_usb_adapter *adap)
}
static struct qt1010_config au6610_qt1010_config = {
- .i2c_address = 0xc4
+ .i2c_address = 0x62
};
static int au6610_qt1010_tuner_attach(struct dvb_usb_adapter *adap)
diff --git a/linux/drivers/media/dvb/dvb-usb/gl861.c b/linux/drivers/media/dvb/dvb-usb/gl861.c
index 1e5e2c1b9..ce06395b8 100644
--- a/linux/drivers/media/dvb/dvb-usb/gl861.c
+++ b/linux/drivers/media/dvb/dvb-usb/gl861.c
@@ -20,7 +20,7 @@ static int gl861_i2c_msg(struct dvb_usb_device *d, u8 addr,
u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen)
{
u16 index;
- u16 value = addr << 8;
+ u16 value = addr << (8 + 1);
int wo = (rbuf == NULL || rlen == 0); /* write-only */
u8 req, type;
@@ -101,7 +101,7 @@ static int gl861_identify_state(struct usb_device *udev,
}
static struct zl10353_config gl861_zl10353_config = {
- .demod_address = 0x1e,
+ .demod_address = 0x0f,
.no_tuner = 1,
.parallel_ts = 1,
};
@@ -117,7 +117,7 @@ static int gl861_frontend_attach(struct dvb_usb_adapter *adap)
}
static struct qt1010_config gl861_qt1010_config = {
- .i2c_address = 0xc4
+ .i2c_address = 0x62
};
static int gl861_tuner_attach(struct dvb_usb_adapter *adap)
diff --git a/linux/drivers/media/dvb/dvb-usb/m920x.c b/linux/drivers/media/dvb/dvb-usb/m920x.c
index 1a411316f..e63f1edba 100644
--- a/linux/drivers/media/dvb/dvb-usb/m920x.c
+++ b/linux/drivers/media/dvb/dvb-usb/m920x.c
@@ -67,16 +67,18 @@ static inline int m9206_write(struct usb_device *udev, u8 request,
return ret;
}
-static int m9206_rc_init(struct usb_device *udev)
+static int m9206_init(struct dvb_usb_device *d)
{
int ret = 0;
/* Remote controller init. */
- if ((ret = m9206_write(udev, M9206_CORE, 0xa8, M9206_RC_INIT2)) != 0)
- return ret;
+ if (d->props.rc_query) {
+ if ((ret = m9206_write(d->udev, M9206_CORE, 0xa8, M9206_RC_INIT2)) != 0)
+ return ret;
- if ((ret = m9206_write(udev, M9206_CORE, 0x51, M9206_RC_INIT1)) != 0)
- return ret;
+ if ((ret = m9206_write(d->udev, M9206_CORE, 0x51, M9206_RC_INIT1)) != 0)
+ return ret;
+ }
return ret;
}
@@ -87,20 +89,15 @@ static int m9206_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
int i, ret = 0;
u8 rc_state[2];
-#if 0
- if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
- return -EAGAIN;
-#endif
-
if ((ret = m9206_read(d->udev, M9206_CORE, 0x0, M9206_RC_STATE, rc_state, 1)) != 0)
goto unlock;
if ((ret = m9206_read(d->udev, M9206_CORE, 0x0, M9206_RC_KEY, rc_state + 1, 1)) != 0)
goto unlock;
- for (i = 0; i < ARRAY_SIZE(megasky_rc_keys); i++)
- if (megasky_rc_keys[i].data == rc_state[1]) {
- *event = megasky_rc_keys[i].event;
+ for (i = 0; i < d->props.rc_key_map_size; i++)
+ if (d->props.rc_key_map[i].data == rc_state[1]) {
+ *event = d->props.rc_key_map[i].event;
switch(rc_state[0]) {
case 0x80:
@@ -132,9 +129,6 @@ static int m9206_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
*state = REMOTE_NO_KEY_PRESSED;
unlock:
-#if 0
- mutex_unlock(&d->i2c_mutex);
-#endif
return ret;
}
@@ -144,53 +138,51 @@ static int m9206_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
int num)
{
struct dvb_usb_device *d = i2c_get_adapdata(adap);
- struct m9206_state *m = d->priv;
- int i;
+ int i, j;
int ret = 0;
+ if (!num)
+ return -EINVAL;
+
if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
return -EAGAIN;
- if (num > 2)
- return -EINVAL;
-
for (i = 0; i < num; i++) {
- if ((ret = m9206_write(d->udev, M9206_I2C, msg[i].addr, 0x80)) != 0)
+ if (msg[i].flags & (I2C_M_NO_RD_ACK|I2C_M_IGNORE_NAK|I2C_M_TEN) ||
+ msg[i].len == 0) {
+ /* For a 0 byte message, I think sending the address to index 0x80|0x40
+ * would be the correct thing to do. However, zero byte messages are
+ * only used for probing, and since we don't know how to get the slave's
+ * ack, we can't probe. */
+ ret = -ENOTSUPP;
goto unlock;
-
- if ((ret = m9206_write(d->udev, M9206_I2C, msg[i].buf[0], 0x0)) != 0)
- goto unlock;
-
- if (i + 1 < num && msg[i + 1].flags & I2C_M_RD) {
- int i2c_i;
-
- for (i2c_i = 0; i2c_i < M9206_I2C_MAX; i2c_i++)
- if (msg[i].addr == m->i2c_r[i2c_i].addr)
- break;
-
- if (i2c_i >= M9206_I2C_MAX) {
- deb_rc("No magic for i2c addr!\n");
- ret = -EINVAL;
+ }
+ /* Send START & address/RW bit */
+ if (!(msg[i].flags & I2C_M_NOSTART)) {
+ if ((ret = m9206_write(d->udev, M9206_I2C, (msg[i].addr<<1)|(msg[i].flags&I2C_M_RD?0x01:0), 0x80)) != 0)
goto unlock;
+ /* Should check for ack here, if we knew how. */
+ }
+ if (msg[i].flags & I2C_M_RD) {
+ for (j = 0; j < msg[i].len; j++) {
+ /* Last byte of transaction? Send STOP, otherwise send ACK. */
+ int stop = (i+1 == num && j+1 == msg[i].len)?0x40:0x01;
+ if ((ret = m9206_read(d->udev, M9206_I2C, 0x0, 0x20|stop, &msg[i].buf[j], 1)) != 0)
+ goto unlock;
}
-
- if ((ret = m9206_write(d->udev, M9206_I2C, m->i2c_r[i2c_i].magic, 0x80)) != 0)
- goto unlock;
-
- if ((ret = m9206_read(d->udev, M9206_I2C, 0x0, 0x60, msg[i + 1].buf, msg[i + 1].len)) != 0)
- goto unlock;
-
- i++;
} else {
- if (msg[i].len != 2)
- return -EINVAL;
-
- if ((ret = m9206_write(d->udev, M9206_I2C, msg[i].buf[1], 0x40)) != 0)
- goto unlock;
+ for (j = 0; j < msg[i].len; j++) {
+ /* Last byte of transaction? Then send STOP. */
+ int stop = (i+1 == num && j+1 == msg[i].len)?0x40:0x00;
+ if ((ret = m9206_write(d->udev, M9206_I2C, msg[i].buf[j], stop)) != 0)
+ goto unlock;
+ /* Should check for ack here too. */
+ }
}
}
- ret = i;
- unlock:
+ ret = num;
+
+unlock:
mutex_unlock(&d->i2c_mutex);
return ret;
@@ -388,20 +380,15 @@ static int megasky_mt352_demod_init(struct dvb_frontend *fe)
}
static struct mt352_config megasky_mt352_config = {
- .demod_address = 0x1e,
+ .demod_address = 0x0f,
.no_tuner = 1,
.demod_init = megasky_mt352_demod_init,
};
static int megasky_mt352_frontend_attach(struct dvb_usb_adapter *adap)
{
- struct m9206_state *m = adap->dev->priv;
-
deb_rc("megasky_frontend_attach!\n");
- m->i2c_r[M9206_I2C_DEMOD].addr = megasky_mt352_config.demod_address;
- m->i2c_r[M9206_I2C_DEMOD].magic = 0x1f;
-
if ((adap->fe = dvb_attach(mt352_attach, &megasky_mt352_config, &adap->dev->i2c_adap)) == NULL)
return -EIO;
@@ -409,16 +396,11 @@ static int megasky_mt352_frontend_attach(struct dvb_usb_adapter *adap)
}
static struct qt1010_config megasky_qt1010_config = {
- .i2c_address = 0xc4
+ .i2c_address = 0x62
};
static int megasky_qt1010_tuner_attach(struct dvb_usb_adapter *adap)
{
- struct m9206_state *m = adap->dev->priv;
-
- m->i2c_r[M9206_I2C_TUNER].addr = megasky_qt1010_config.i2c_address;
- m->i2c_r[M9206_I2C_TUNER].magic = 0xc5;
-
if (dvb_attach(qt1010_attach, adap->fe, &adap->dev->i2c_adap,
&megasky_qt1010_config) == NULL)
return -ENODEV;
@@ -436,25 +418,28 @@ static int m920x_probe(struct usb_interface *intf,
struct usb_host_interface *alt;
int ret;
- if ((ret = dvb_usb_device_init(intf, &megasky_properties, THIS_MODULE, &d)) == 0) {
- deb_rc("probed!\n");
+ deb_rc("Probed!\n");
- alt = usb_altnum_to_altsetting(intf, 1);
- if (alt == NULL) {
- deb_rc("not alt found!\n");
- return -ENODEV;
- }
-
- ret = usb_set_interface(d->udev, alt->desc.bInterfaceNumber,
- alt->desc.bAlternateSetting);
- if (ret < 0)
- return ret;
+ if ((ret = dvb_usb_device_init(intf, &megasky_properties, THIS_MODULE, &d)) == 0)
+ goto found;
- deb_rc("Changed to alternate setting!\n");
+ return ret;
- if ((ret = m9206_rc_init(d->udev)) != 0)
- return ret;
+found:
+ alt = usb_altnum_to_altsetting(intf, 1);
+ if (alt == NULL) {
+ deb_rc("No alt found!\n");
+ return -ENODEV;
}
+
+ ret = usb_set_interface(d->udev, alt->desc.bInterfaceNumber,
+ alt->desc.bAlternateSetting);
+ if (ret < 0)
+ return ret;
+
+ if ((ret = m9206_init(d)) != 0)
+ return ret;
+
return ret;
}
diff --git a/linux/drivers/media/dvb/dvb-usb/m920x.h b/linux/drivers/media/dvb/dvb-usb/m920x.h
index c354196ff..7dd3db65c 100644
--- a/linux/drivers/media/dvb/dvb-usb/m920x.h
+++ b/linux/drivers/media/dvb/dvb-usb/m920x.h
@@ -19,17 +19,49 @@
#define M9206_MAX_FILTERS 8
-#define M9206_I2C_TUNER 0
-#define M9206_I2C_DEMOD 1
-#define M9206_I2C_MAX 2
+/*
+sequences found in logs:
+[index value]
+0x80 write addr
+(0x00 out byte)*
+0x40 out byte
+
+0x80 write addr
+(0x00 out byte)*
+0x80 read addr
+(0x21 in byte)*
+0x60 in byte
+
+this sequence works:
+0x80 read addr
+(0x21 in byte)*
+0x60 in byte
+
+Guess at API of the I2C function:
+I2C operation is done one byte at a time with USB control messages. The
+index the messages is sent to is made up of a set of flags that control
+the I2C bus state:
+0x80: Send START condition. After a START condition, one would normally
+ always send the 7-bit slave I2C address as the 7 MSB, followed by
+ the read/write bit as the LSB.
+0x40: Send STOP condition. This should be set on the last byte of an
+ I2C transaction.
+0x20: Read a byte from the slave. As opposed to writing a byte to the
+ slave. The slave will normally not produce any data unless you
+ set the R/W bit to 1 when sending the slave's address after the
+ START condition.
+0x01: Respond with ACK, as opposed to a NACK. For a multi-byte read,
+ the master should send an ACK, that is pull SDA low during the 9th
+ clock cycle, after every byte but the last. This flags only makes
+ sense when bit 0x20 is set, indicating a read.
+
+What any other bits might mean, or how to get the slave's ACK/NACK
+response to a write, is unknown.
+*/
struct m9206_state {
u16 filters[M9206_MAX_FILTERS];
int filtering_enabled;
int rep_count;
- struct {
- unsigned char addr;
- unsigned char magic;
- }i2c_r[M9206_I2C_MAX];
};
#endif
diff --git a/linux/drivers/media/video/ivtv/ivtv-driver.c b/linux/drivers/media/video/ivtv/ivtv-driver.c
index adfc8a869..2fcf3e7c3 100644
--- a/linux/drivers/media/video/ivtv/ivtv-driver.c
+++ b/linux/drivers/media/video/ivtv/ivtv-driver.c
@@ -625,8 +625,8 @@ static int __devinit ivtv_init_struct1(struct ivtv *itv)
mutex_init(&itv->i2c_bus_lock);
mutex_init(&itv->udma.lock);
- itv->lock = SPIN_LOCK_UNLOCKED;
- itv->dma_reg_lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&itv->lock);
+ spin_lock_init(&itv->dma_reg_lock);
itv->irq_work_queues = create_workqueue(itv->name);
if (itv->irq_work_queues == NULL) {
@@ -1138,46 +1138,6 @@ static int __devinit ivtv_probe(struct pci_dev *dev,
if (itv->options.radio > 0)
itv->v4l2_cap |= V4L2_CAP_RADIO;
- retval = ivtv_streams_setup(itv);
- if (retval) {
- IVTV_ERR("Error %d setting up streams\n", retval);
- goto free_i2c;
- }
-
- /* Start Threads */
- IVTV_DEBUG_INFO("Starting Threads\n");
-
- /* Decoder Thread */
- if (itv->card->v4l2_capabilities & V4L2_CAP_VIDEO_OUTPUT) {
- ivtv_init_mpeg_decoder(itv);
- }
-
- IVTV_DEBUG_IRQ("Masking interrupts\n");
- /* clear interrupt mask, effectively disabling interrupts */
- ivtv_set_irq_mask(itv, 0xffffffff);
-
- /* Register IRQ */
- retval = request_irq(itv->dev->irq, ivtv_irq_handler,
- IRQF_SHARED | IRQF_DISABLED, itv->name, (void *)itv);
- if (retval) {
- IVTV_ERR("Failed to register irq %d\n", retval);
- goto free_streams;
- }
-
- /* On a cx23416 this seems to be able to enable DMA to the chip? */
- if (!itv->has_cx23415)
- write_reg_sync(0x03, IVTV_REG_DMACONTROL);
-
- /* Default interrupts enabled. For the PVR350 this includes the
- decoder VSYNC interrupt, which is always on. It is not only used
- during decoding but also by the OSD.
- Some old PVR250 cards had a cx23415, so testing for that is too
- general. Instead test if the card has video output capability. */
- if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)
- ivtv_clear_irq_mask(itv, IVTV_IRQ_MASK_INIT | IVTV_IRQ_DEC_VSYNC);
- else
- ivtv_clear_irq_mask(itv, IVTV_IRQ_MASK_INIT);
-
if (itv->options.tuner > -1) {
struct tuner_setup setup;
@@ -1216,6 +1176,43 @@ static int __devinit ivtv_probe(struct pci_dev *dev,
itv->std_out = itv->std;
ivtv_v4l2_ioctls(itv, NULL, VIDIOC_S_STD, &itv->tuner_std);
ivtv_v4l2_ioctls(itv, NULL, VIDIOC_S_FREQUENCY, &vf);
+
+ retval = ivtv_streams_setup(itv);
+ if (retval) {
+ IVTV_ERR("Error %d setting up streams\n", retval);
+ goto free_i2c;
+ }
+
+ if (itv->card->v4l2_capabilities & V4L2_CAP_VIDEO_OUTPUT) {
+ ivtv_init_mpeg_decoder(itv);
+ }
+
+ IVTV_DEBUG_IRQ("Masking interrupts\n");
+ /* clear interrupt mask, effectively disabling interrupts */
+ ivtv_set_irq_mask(itv, 0xffffffff);
+
+ /* Register IRQ */
+ retval = request_irq(itv->dev->irq, ivtv_irq_handler,
+ IRQF_SHARED | IRQF_DISABLED, itv->name, (void *)itv);
+ if (retval) {
+ IVTV_ERR("Failed to register irq %d\n", retval);
+ goto free_streams;
+ }
+
+ /* On a cx23416 this seems to be able to enable DMA to the chip? */
+ if (!itv->has_cx23415)
+ write_reg_sync(0x03, IVTV_REG_DMACONTROL);
+
+ /* Default interrupts enabled. For the PVR350 this includes the
+ decoder VSYNC interrupt, which is always on. It is not only used
+ during decoding but also by the OSD.
+ Some old PVR250 cards had a cx23415, so testing for that is too
+ general. Instead test if the card has video output capability. */
+ if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)
+ ivtv_clear_irq_mask(itv, IVTV_IRQ_MASK_INIT | IVTV_IRQ_DEC_VSYNC);
+ else
+ ivtv_clear_irq_mask(itv, IVTV_IRQ_MASK_INIT);
+
if (itv->has_cx23415)
ivtv_set_osd_alpha(itv);
@@ -1337,7 +1334,7 @@ static int module_start(void)
printk(KERN_INFO "ivtv: debug value must be >= 0 and <= 511!\n");
}
- if (pci_module_init(&ivtv_pci_driver)) {
+ if (pci_register_driver(&ivtv_pci_driver)) {
printk(KERN_ERR "ivtv: Error detecting PCI card\n");
return -ENODEV;
}
@@ -1349,6 +1346,8 @@ static void module_cleanup(void)
{
int i, j;
+ pci_unregister_driver(&ivtv_pci_driver);
+
for (i = 0; i < ivtv_cards_active; i++) {
if (ivtv_cards[i] == NULL)
continue;
@@ -1357,7 +1356,6 @@ static void module_cleanup(void)
}
kfree(ivtv_cards[i]);
}
- pci_unregister_driver(&ivtv_pci_driver);
}
/* Note: These symbols are exported because they are used by the ivtv-fb
diff --git a/linux/drivers/media/video/ivtv/ivtv-driver.h b/linux/drivers/media/video/ivtv/ivtv-driver.h
index cb87caa63..e84caa59b 100644
--- a/linux/drivers/media/video/ivtv/ivtv-driver.h
+++ b/linux/drivers/media/video/ivtv/ivtv-driver.h
@@ -509,6 +509,7 @@ struct ivtv_stream {
struct ivtv_open_id {
u32 open_id;
int type;
+ enum v4l2_priority prio;
struct ivtv *itv;
};
@@ -739,6 +740,7 @@ struct ivtv {
u32 base_addr;
u32 irqmask;
+ struct v4l2_prio_state prio;
struct workqueue_struct *irq_work_queues;
struct work_struct irq_work_queue;
struct timer_list dma_timer; /* Timer used to catch unfinished DMAs */
diff --git a/linux/drivers/media/video/ivtv/ivtv-fileops.c b/linux/drivers/media/video/ivtv/ivtv-fileops.c
index 2f38bb14a..1637097dd 100644
--- a/linux/drivers/media/video/ivtv/ivtv-fileops.c
+++ b/linux/drivers/media/video/ivtv/ivtv-fileops.c
@@ -766,6 +766,8 @@ int ivtv_v4l2_close(struct inode *inode, struct file *filp)
IVTV_DEBUG_IOCTL("close() of %s\n", s->name);
+ v4l2_prio_close(&itv->prio, &id->prio);
+
/* Easy case first: this stream was never claimed by us */
if (s->id != id->open_id) {
kfree(id);
@@ -849,6 +851,7 @@ int ivtv_v4l2_open(struct inode *inode, struct file *filp)
}
item->itv = itv;
item->type = y;
+ v4l2_prio_open(&itv->prio, &item->prio);
item->open_id = itv->open_id++;
filp->private_data = item;
diff --git a/linux/drivers/media/video/ivtv/ivtv-ioctl.c b/linux/drivers/media/video/ivtv/ivtv-ioctl.c
index 8c99b8024..d6f0b0235 100644
--- a/linux/drivers/media/video/ivtv/ivtv-ioctl.c
+++ b/linux/drivers/media/video/ivtv/ivtv-ioctl.c
@@ -277,6 +277,7 @@ static int ivtv_video_command(struct ivtv *itv, struct ivtv_open_id *id,
switch (vc->cmd) {
case VIDEO_CMD_PLAY: {
+ vc->flags = 0;
vc->play.speed = ivtv_validate_speed(itv->speed, vc->play.speed);
if (vc->play.speed < 0)
vc->play.format = VIDEO_PLAY_FMT_GOP;
@@ -288,6 +289,7 @@ static int ivtv_video_command(struct ivtv *itv, struct ivtv_open_id *id,
}
case VIDEO_CMD_STOP:
+ vc->flags &= ~(VIDEO_CMD_STOP_IMMEDIATELY|VIDEO_CMD_STOP_TO_BLACK);
if (vc->flags & VIDEO_CMD_STOP_IMMEDIATELY)
vc->stop.pts = 0;
if (try) break;
@@ -300,6 +302,7 @@ static int ivtv_video_command(struct ivtv *itv, struct ivtv_open_id *id,
return ivtv_stop_v4l2_decode_stream(s, vc->flags, vc->stop.pts);
case VIDEO_CMD_FREEZE:
+ vc->flags &= ~VIDEO_CMD_FREEZE_TO_BLACK;
if (try) break;
if (itv->output_mode != OUT_MPG)
return -EBUSY;
@@ -310,6 +313,7 @@ static int ivtv_video_command(struct ivtv *itv, struct ivtv_open_id *id,
break;
case VIDEO_CMD_CONTINUE:
+ vc->flags = 0;
if (try) break;
if (itv->output_mode != OUT_MPG)
return -EBUSY;
@@ -638,7 +642,7 @@ static int ivtv_try_or_set_fmt(struct ivtv *itv, int streamtype,
return 0;
}
-static int ivtv_internal_ioctls(struct file *filp, unsigned int cmd, void *arg)
+static int ivtv_debug_ioctls(struct file *filp, unsigned int cmd, void *arg)
{
struct ivtv_open_id *id = (struct ivtv_open_id *)filp->private_data;
struct ivtv *itv = id->itv;
@@ -647,7 +651,6 @@ static int ivtv_internal_ioctls(struct file *filp, unsigned int cmd, void *arg)
switch (cmd) {
/* ioctls to allow direct access to the encoder registers for testing */
case VIDIOC_DBG_G_REGISTER:
- IVTV_DEBUG_IOCTL("VIDIOC_DBG_G_REGISTER\n");
if (v4l2_chip_match_host(reg->match_type, reg->match_chip))
return ivtv_itvc(itv, cmd, arg);
if (reg->match_type == V4L2_CHIP_MATCH_I2C_DRIVER)
@@ -655,7 +658,6 @@ static int ivtv_internal_ioctls(struct file *filp, unsigned int cmd, void *arg)
return ivtv_call_i2c_client(itv, reg->match_chip, cmd, arg);
case VIDIOC_DBG_S_REGISTER:
- IVTV_DEBUG_IOCTL("VIDIOC_DBG_S_REGISTER\n");
if (v4l2_chip_match_host(reg->match_type, reg->match_chip))
return ivtv_itvc(itv, cmd, arg);
if (reg->match_type == V4L2_CHIP_MATCH_I2C_DRIVER)
@@ -665,7 +667,6 @@ static int ivtv_internal_ioctls(struct file *filp, unsigned int cmd, void *arg)
case VIDIOC_G_CHIP_IDENT: {
struct v4l2_chip_ident *chip = arg;
- IVTV_DEBUG_IOCTL("VIDIOC_G_CHIP_IDENT\n");
chip->ident = V4L2_IDENT_NONE;
chip->revision = 0;
if (reg->match_type == V4L2_CHIP_MATCH_HOST) {
@@ -686,13 +687,11 @@ static int ivtv_internal_ioctls(struct file *filp, unsigned int cmd, void *arg)
case VIDIOC_INT_S_AUDIO_ROUTING: {
struct v4l2_routing *route = arg;
- IVTV_DEBUG_IOCTL("VIDIOC_INT_S_AUDIO_ROUTING\n");
ivtv_audio_set_route(itv, route);
break;
}
case VIDIOC_INT_RESET:
- IVTV_DEBUG_IOCTL("VIDIOC_INT_RESET\n");
ivtv_reset_ir_gpio(itv);
break;
@@ -709,11 +708,24 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
if (filp) id = (struct ivtv_open_id *)filp->private_data;
switch (cmd) {
+ case VIDIOC_G_PRIORITY:
+ {
+ enum v4l2_priority *p = arg;
+
+ *p = v4l2_prio_max(&itv->prio);
+ break;
+ }
+
+ case VIDIOC_S_PRIORITY:
+ {
+ enum v4l2_priority *prio = arg;
+
+ return v4l2_prio_change(&itv->prio, &id->prio, *prio);
+ }
+
case VIDIOC_QUERYCAP:{
struct v4l2_capability *vcap = arg;
- IVTV_DEBUG_IOCTL("VIDIOC_QUERYCAP\n");
-
memset(vcap, 0, sizeof(*vcap));
strcpy(vcap->driver, IVTV_DRIVER_NAME); /* driver name */
strcpy(vcap->card, itv->card_name); /* card type */
@@ -730,15 +742,12 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
case VIDIOC_ENUMAUDIO:{
struct v4l2_audio *vin = arg;
- IVTV_DEBUG_IOCTL("VIDIOC_ENUMAUDIO\n");
-
return ivtv_get_audio_input(itv, vin->index, vin);
}
case VIDIOC_G_AUDIO:{
struct v4l2_audio *vin = arg;
- IVTV_DEBUG_IOCTL("VIDIOC_G_AUDIO\n");
vin->index = itv->audio_input;
return ivtv_get_audio_input(itv, vin->index, vin);
}
@@ -746,8 +755,6 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
case VIDIOC_S_AUDIO:{
struct v4l2_audio *vout = arg;
- IVTV_DEBUG_IOCTL("VIDIOC_S_AUDIO\n");
-
if (vout->index >= itv->nof_audio_inputs)
return -EINVAL;
itv->audio_input = vout->index;
@@ -758,8 +765,6 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
case VIDIOC_ENUMAUDOUT:{
struct v4l2_audioout *vin = arg;
- IVTV_DEBUG_IOCTL("VIDIOC_ENUMAUDOUT\n");
-
/* set it to defaults from our table */
return ivtv_get_audio_output(itv, vin->index, vin);
}
@@ -767,7 +772,6 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
case VIDIOC_G_AUDOUT:{
struct v4l2_audioout *vin = arg;
- IVTV_DEBUG_IOCTL("VIDIOC_G_AUDOUT\n");
vin->index = 0;
return ivtv_get_audio_output(itv, vin->index, vin);
}
@@ -775,16 +779,12 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
case VIDIOC_S_AUDOUT:{
struct v4l2_audioout *vout = arg;
- IVTV_DEBUG_IOCTL("VIDIOC_S_AUDOUT\n");
-
return ivtv_get_audio_output(itv, vout->index, vout);
}
case VIDIOC_ENUMINPUT:{
struct v4l2_input *vin = arg;
- IVTV_DEBUG_IOCTL("VIDIOC_ENUMINPUT\n");
-
/* set it to defaults from our table */
return ivtv_get_input(itv, vin->index, vin);
}
@@ -792,8 +792,6 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
case VIDIOC_ENUMOUTPUT:{
struct v4l2_output *vout = arg;
- IVTV_DEBUG_IOCTL("VIDIOC_ENUMOUTPUT\n");
-
return ivtv_get_output(itv, vout->index, vout);
}
@@ -801,11 +799,6 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
case VIDIOC_S_FMT: {
struct v4l2_format *fmt = arg;
- if (cmd == VIDIOC_S_FMT) {
- IVTV_DEBUG_IOCTL("VIDIOC_S_FMT\n");
- } else {
- IVTV_DEBUG_IOCTL("VIDIOC_TRY_FMT\n");
- }
return ivtv_try_or_set_fmt(itv, id->type, fmt, cmd == VIDIOC_S_FMT);
}
@@ -813,7 +806,6 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
struct v4l2_format *fmt = arg;
int type = fmt->type;
- IVTV_DEBUG_IOCTL("VIDIOC_G_FMT\n");
memset(fmt, 0, sizeof(*fmt));
fmt->type = type;
return ivtv_get_fmt(itv, id->type, fmt);
@@ -822,7 +814,6 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
case VIDIOC_S_CROP: {
struct v4l2_crop *crop = arg;
- IVTV_DEBUG_IOCTL("VIDIOC_S_CROP\n");
if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -EINVAL;
return itv->video_dec_func(itv, VIDIOC_S_CROP, arg);
@@ -831,7 +822,6 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
case VIDIOC_G_CROP: {
struct v4l2_crop *crop = arg;
- IVTV_DEBUG_IOCTL("VIDIOC_G_CROP\n");
if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -EINVAL;
return itv->video_dec_func(itv, VIDIOC_G_CROP, arg);
@@ -869,8 +859,6 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
}
case VIDIOC_G_INPUT:{
- IVTV_DEBUG_IOCTL("VIDIOC_G_INPUT\n");
-
*(int *)arg = itv->active_input;
break;
}
@@ -878,8 +866,6 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
case VIDIOC_S_INPUT:{
int inp = *(int *)arg;
- IVTV_DEBUG_IOCTL("VIDIOC_S_INPUT\n");
-
if (inp < 0 || inp >= itv->nof_inputs)
return -EINVAL;
@@ -905,8 +891,6 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
}
case VIDIOC_G_OUTPUT:{
- IVTV_DEBUG_IOCTL("VIDIOC_G_OUTPUT\n");
-
if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT))
return -EINVAL;
*(int *)arg = itv->active_output;
@@ -917,8 +901,6 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
int outp = *(int *)arg;
struct v4l2_routing route;
- IVTV_DEBUG_IOCTL("VIDIOC_S_OUTPUT\n");
-
if (outp >= itv->card->nof_outputs)
return -EINVAL;
@@ -939,8 +921,6 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
case VIDIOC_G_FREQUENCY:{
struct v4l2_frequency *vf = arg;
- IVTV_DEBUG_IOCTL("VIDIOC_G_FREQUENCY\n");
-
if (vf->tuner != 0)
return -EINVAL;
ivtv_call_i2c_clients(itv, cmd, arg);
@@ -950,8 +930,6 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
case VIDIOC_S_FREQUENCY:{
struct v4l2_frequency vf = *(struct v4l2_frequency *)arg;
- IVTV_DEBUG_IOCTL("VIDIOC_S_FREQUENCY\n");
-
if (vf.tuner != 0)
return -EINVAL;
@@ -966,8 +944,6 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
struct v4l2_standard *vs = arg;
int idx = vs->index;
- IVTV_DEBUG_IOCTL("VIDIOC_ENUMSTD\n");
-
if (idx < 0 || idx >= ARRAY_SIZE(enum_stds))
return -EINVAL;
@@ -980,7 +956,6 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
}
case VIDIOC_G_STD:{
- IVTV_DEBUG_IOCTL("VIDIOC_G_STD\n");
*(v4l2_std_id *) arg = itv->std;
break;
}
@@ -988,8 +963,6 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
case VIDIOC_S_STD: {
v4l2_std_id std = *(v4l2_std_id *) arg;
- IVTV_DEBUG_IOCTL("VIDIOC_S_STD\n");
-
if ((std & V4L2_STD_ALL) == 0)
return -EINVAL;
@@ -1040,8 +1013,6 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
case VIDIOC_S_TUNER: { /* Setting tuner can only set audio mode */
struct v4l2_tuner *vt = arg;
- IVTV_DEBUG_IOCTL("VIDIOC_S_TUNER\n");
-
if (vt->index != 0)
return -EINVAL;
@@ -1052,8 +1023,6 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
case VIDIOC_G_TUNER: {
struct v4l2_tuner *vt = arg;
- IVTV_DEBUG_IOCTL("VIDIOC_G_TUNER\n");
-
if (vt->index != 0)
return -EINVAL;
@@ -1080,7 +1049,6 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
enum v4l2_buf_type type = VIDIOC_G_SLICED_VBI_CAP;
#endif
- IVTV_DEBUG_IOCTL("VIDIOC_G_SLICED_VBI_CAP\n");
memset(cap, 0, sizeof(*cap));
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)
cap->type = type;
@@ -1110,6 +1078,104 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
return -EINVAL;
}
+ case VIDIOC_G_ENC_INDEX: {
+ struct v4l2_enc_idx *idx = arg;
+ int i;
+
+ idx->entries = (itv->pgm_info_write_idx + IVTV_MAX_PGM_INDEX - itv->pgm_info_read_idx) %
+ IVTV_MAX_PGM_INDEX;
+ if (idx->entries > V4L2_ENC_IDX_ENTRIES)
+ idx->entries = V4L2_ENC_IDX_ENTRIES;
+ for (i = 0; i < idx->entries; i++) {
+ idx->entry[i] = itv->pgm_info[(itv->pgm_info_read_idx + i) % IVTV_MAX_PGM_INDEX];
+ }
+ itv->pgm_info_read_idx = (itv->pgm_info_read_idx + idx->entries) % IVTV_MAX_PGM_INDEX;
+ break;
+ }
+
+ case VIDIOC_ENCODER_CMD:
+ case VIDIOC_TRY_ENCODER_CMD: {
+ struct v4l2_encoder_cmd *enc = arg;
+ int try = cmd == VIDIOC_TRY_ENCODER_CMD;
+
+ memset(&enc->raw, 0, sizeof(enc->raw));
+ switch (enc->cmd) {
+ case V4L2_ENC_CMD_START:
+ enc->flags = 0;
+ if (try)
+ return 0;
+ return ivtv_start_capture(id);
+
+ case V4L2_ENC_CMD_STOP:
+ enc->flags &= ~V4L2_ENC_CMD_STOP_AT_GOP_END;
+ if (try)
+ return 0;
+ ivtv_stop_capture(id, enc->flags & V4L2_ENC_CMD_STOP_AT_GOP_END);
+ return 0;
+
+ case V4L2_ENC_CMD_PAUSE:
+ enc->flags = 0;
+ if (try)
+ return 0;
+ if (!atomic_read(&itv->capturing))
+ return -EPERM;
+ if (test_and_set_bit(IVTV_F_I_ENC_PAUSED, &itv->i_flags))
+ return 0;
+ ivtv_mute(itv);
+ ivtv_vapi(itv, CX2341X_ENC_PAUSE_ENCODER, 1, 0);
+ break;
+
+ case V4L2_ENC_CMD_RESUME:
+ enc->flags = 0;
+ if (try)
+ return 0;
+ if (!atomic_read(&itv->capturing))
+ return -EPERM;
+ if (!test_and_clear_bit(IVTV_F_I_ENC_PAUSED, &itv->i_flags))
+ return 0;
+ ivtv_vapi(itv, CX2341X_ENC_PAUSE_ENCODER, 1, 1);
+ ivtv_unmute(itv);
+ break;
+ default:
+ return -EINVAL;
+ }
+ break;
+ }
+
+ case VIDIOC_G_FBUF: {
+ struct v4l2_framebuffer *fb = arg;
+
+ memset(fb, 0, sizeof(*fb));
+ if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT_OVERLAY))
+ break;
+ fb->capability = V4L2_FBUF_CAP_EXTERNOVERLAY | V4L2_FBUF_CAP_CHROMAKEY |
+ V4L2_FBUF_CAP_LOCAL_ALPHA | V4L2_FBUF_CAP_GLOBAL_ALPHA;
+ fb->fmt.pixelformat = itv->osd_pixelformat;
+ fb->fmt.width = itv->osd_rect.width;
+ fb->fmt.height = itv->osd_rect.height;
+ fb->fmt.left = itv->osd_rect.left;
+ fb->fmt.top = itv->osd_rect.top;
+ fb->base = (void *)itv->osd_video_pbase;
+ if (itv->osd_global_alpha_state)
+ fb->flags |= V4L2_FBUF_FLAG_GLOBAL_ALPHA;
+ if (itv->osd_local_alpha_state)
+ fb->flags |= V4L2_FBUF_FLAG_LOCAL_ALPHA;
+ if (itv->osd_color_key_state)
+ fb->flags |= V4L2_FBUF_FLAG_CHROMAKEY;
+ break;
+ }
+
+ case VIDIOC_S_FBUF: {
+ struct v4l2_framebuffer *fb = arg;
+
+ if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT_OVERLAY))
+ break;
+ itv->osd_global_alpha_state = (fb->flags & V4L2_FBUF_FLAG_GLOBAL_ALPHA) != 0;
+ itv->osd_local_alpha_state = (fb->flags & V4L2_FBUF_FLAG_LOCAL_ALPHA) != 0;
+ itv->osd_color_key_state = (fb->flags & V4L2_FBUF_FLAG_CHROMAKEY) != 0;
+ break;
+ }
+
case VIDIOC_LOG_STATUS:
{
int has_output = itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT;
@@ -1172,7 +1238,7 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
return 0;
}
-static int ivtv_ivtv_ioctls(struct file *filp, unsigned int cmd, void *arg)
+static int ivtv_decoder_ioctls(struct file *filp, unsigned int cmd, void *arg)
{
struct ivtv_open_id *id = (struct ivtv_open_id *)filp->private_data;
struct ivtv *itv = id->itv;
@@ -1352,96 +1418,6 @@ static int ivtv_ivtv_ioctls(struct file *filp, unsigned int cmd, void *arg)
break;
}
- case VIDIOC_G_ENC_INDEX: {
- struct v4l2_enc_idx *idx = arg;
- int i;
-
- IVTV_DEBUG_IOCTL("VIDIOC_G_ENC_INDEX\n");
- idx->entries = (itv->pgm_info_write_idx + IVTV_MAX_PGM_INDEX - itv->pgm_info_read_idx) %
- IVTV_MAX_PGM_INDEX;
- if (idx->entries > V4L2_ENC_IDX_ENTRIES)
- idx->entries = V4L2_ENC_IDX_ENTRIES;
- for (i = 0; i < idx->entries; i++) {
- idx->entry[i] = itv->pgm_info[(itv->pgm_info_read_idx + i) % IVTV_MAX_PGM_INDEX];
- }
- itv->pgm_info_read_idx = (itv->pgm_info_read_idx + idx->entries) % IVTV_MAX_PGM_INDEX;
- break;
- }
-
- case VIDIOC_ENCODER_CMD:
- case VIDIOC_TRY_ENCODER_CMD: {
- struct v4l2_encoder_cmd *enc = arg;
- int try = cmd == VIDIOC_TRY_ENCODER_CMD;
-
- if (try)
- IVTV_DEBUG_IOCTL("VIDIOC_TRY_ENCODER_CMD\n");
- else
- IVTV_DEBUG_IOCTL("VIDIOC_ENCODER_CMD\n");
- switch (enc->cmd) {
- case V4L2_ENC_CMD_START:
- return ivtv_start_capture(id);
-
- case V4L2_ENC_CMD_STOP:
- ivtv_stop_capture(id, enc->flags & V4L2_ENC_CMD_STOP_AT_GOP_END);
- return 0;
-
- case V4L2_ENC_CMD_PAUSE:
- if (!atomic_read(&itv->capturing))
- return -EPERM;
- if (test_and_set_bit(IVTV_F_I_ENC_PAUSED, &itv->i_flags))
- return 0;
- ivtv_mute(itv);
- ivtv_vapi(itv, CX2341X_ENC_PAUSE_ENCODER, 1, 0);
- break;
-
- case V4L2_ENC_CMD_RESUME:
- if (!atomic_read(&itv->capturing))
- return -EPERM;
- if (!test_and_clear_bit(IVTV_F_I_ENC_PAUSED, &itv->i_flags))
- return 0;
- ivtv_vapi(itv, CX2341X_ENC_PAUSE_ENCODER, 1, 1);
- ivtv_unmute(itv);
- break;
- }
- break;
- }
-
- case VIDIOC_G_FBUF: {
- struct v4l2_framebuffer *fb = arg;
-
- IVTV_DEBUG_IOCTL("VIDIOC_G_FBUF\n");
- memset(fb, 0, sizeof(*fb));
- if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT_OVERLAY))
- break;
- fb->capability = V4L2_FBUF_CAP_EXTERNOVERLAY | V4L2_FBUF_CAP_CHROMAKEY |
- V4L2_FBUF_CAP_LOCAL_ALPHA | V4L2_FBUF_CAP_GLOBAL_ALPHA;
- fb->fmt.pixelformat = itv->osd_pixelformat;
- fb->fmt.width = itv->osd_rect.width;
- fb->fmt.height = itv->osd_rect.height;
- fb->fmt.left = itv->osd_rect.left;
- fb->fmt.top = itv->osd_rect.top;
- fb->base = (void *)itv->osd_video_pbase;
- if (itv->osd_global_alpha_state)
- fb->flags |= V4L2_FBUF_FLAG_GLOBAL_ALPHA;
- if (itv->osd_local_alpha_state)
- fb->flags |= V4L2_FBUF_FLAG_LOCAL_ALPHA;
- if (itv->osd_color_key_state)
- fb->flags |= V4L2_FBUF_FLAG_CHROMAKEY;
- break;
- }
-
- case VIDIOC_S_FBUF: {
- struct v4l2_framebuffer *fb = arg;
-
- IVTV_DEBUG_IOCTL("VIDIOC_S_FBUF\n");
- if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT_OVERLAY))
- break;
- itv->osd_global_alpha_state = (fb->flags & V4L2_FBUF_FLAG_GLOBAL_ALPHA) != 0;
- itv->osd_local_alpha_state = (fb->flags & V4L2_FBUF_FLAG_LOCAL_ALPHA) != 0;
- itv->osd_color_key_state = (fb->flags & V4L2_FBUF_FLAG_CHROMAKEY) != 0;
- break;
- }
-
default:
return -EINVAL;
}
@@ -1453,8 +1429,26 @@ static int ivtv_v4l2_do_ioctl(struct inode *inode, struct file *filp,
{
struct ivtv_open_id *id = (struct ivtv_open_id *)filp->private_data;
struct ivtv *itv = id->itv;
+ int ret;
- IVTV_DEBUG_IOCTL("v4l2 ioctl 0x%08x\n", cmd);
+ /* check priority */
+ switch (cmd) {
+ case VIDIOC_S_CTRL:
+ case VIDIOC_S_STD:
+ case VIDIOC_S_INPUT:
+ case VIDIOC_S_OUTPUT:
+ case VIDIOC_S_TUNER:
+ case VIDIOC_S_FREQUENCY:
+ case VIDIOC_S_FMT:
+ case VIDIOC_S_CROP:
+ case VIDIOC_S_AUDIO:
+ case VIDIOC_S_AUDOUT:
+ case VIDIOC_S_EXT_CTRLS:
+ case VIDIOC_S_FBUF:
+ ret = v4l2_prio_check(&itv->prio, &id->prio);
+ if (ret)
+ return ret;
+ }
switch (cmd) {
case VIDIOC_DBG_G_REGISTER:
@@ -1462,8 +1456,14 @@ static int ivtv_v4l2_do_ioctl(struct inode *inode, struct file *filp,
case VIDIOC_G_CHIP_IDENT:
case VIDIOC_INT_S_AUDIO_ROUTING:
case VIDIOC_INT_RESET:
- return ivtv_internal_ioctls(filp, cmd, arg);
+ if (ivtv_debug & IVTV_DBGFLG_IOCTL) {
+ printk(KERN_INFO "ivtv%d ioctl: ", itv->num);
+ v4l_printk_ioctl(cmd);
+ }
+ return ivtv_debug_ioctls(filp, cmd, arg);
+ case VIDIOC_G_PRIORITY:
+ case VIDIOC_S_PRIORITY:
case VIDIOC_QUERYCAP:
case VIDIOC_ENUMINPUT:
case VIDIOC_G_INPUT:
@@ -1492,6 +1492,15 @@ static int ivtv_v4l2_do_ioctl(struct inode *inode, struct file *filp,
case VIDIOC_G_AUDOUT:
case VIDIOC_G_SLICED_VBI_CAP:
case VIDIOC_LOG_STATUS:
+ case VIDIOC_G_ENC_INDEX:
+ case VIDIOC_ENCODER_CMD:
+ case VIDIOC_TRY_ENCODER_CMD:
+ case VIDIOC_G_FBUF:
+ case VIDIOC_S_FBUF:
+ if (ivtv_debug & IVTV_DBGFLG_IOCTL) {
+ printk(KERN_INFO "ivtv%d ioctl: ", itv->num);
+ v4l_printk_ioctl(cmd);
+ }
return ivtv_v4l2_ioctls(itv, filp, cmd, arg);
case VIDIOC_QUERYMENU:
@@ -1501,6 +1510,10 @@ static int ivtv_v4l2_do_ioctl(struct inode *inode, struct file *filp,
case VIDIOC_S_EXT_CTRLS:
case VIDIOC_G_EXT_CTRLS:
case VIDIOC_TRY_EXT_CTRLS:
+ if (ivtv_debug & IVTV_DBGFLG_IOCTL) {
+ printk(KERN_INFO "ivtv%d ioctl: ", itv->num);
+ v4l_printk_ioctl(cmd);
+ }
return ivtv_control_ioctls(itv, cmd, arg);
case IVTV_IOC_DMA_FRAME:
@@ -1513,12 +1526,7 @@ static int ivtv_v4l2_do_ioctl(struct inode *inode, struct file *filp,
case VIDEO_CONTINUE:
case VIDEO_COMMAND:
case VIDEO_TRY_COMMAND:
- case VIDIOC_G_ENC_INDEX:
- case VIDIOC_ENCODER_CMD:
- case VIDIOC_TRY_ENCODER_CMD:
- case VIDIOC_G_FBUF:
- case VIDIOC_S_FBUF:
- return ivtv_ivtv_ioctls(filp, cmd, arg);
+ return ivtv_decoder_ioctls(filp, cmd, arg);
case 0x00005401: /* Handle isatty() calls */
return -EINVAL;
diff --git a/linux/drivers/media/video/msp3400-driver.c b/linux/drivers/media/video/msp3400-driver.c
index 0e21a5b57..d6364b01f 100644
--- a/linux/drivers/media/video/msp3400-driver.c
+++ b/linux/drivers/media/video/msp3400-driver.c
@@ -829,7 +829,11 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,14)
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,20)
+static int msp_suspend(struct i2c_client *client, pm_message_t state)
+#else
static int msp_suspend(struct device * dev, pm_message_t state)
+#endif
#else
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13)
static int msp_suspend(struct device * dev, pm_message_t state, u32 level)
@@ -838,7 +842,9 @@ static int msp_suspend(struct device * dev, u32 state, u32 level)
#endif
#endif
{
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,20)
struct i2c_client *client = container_of(dev, struct i2c_client, dev);
+#endif
v4l_dbg(1, msp_debug, client, "suspend\n");
msp_reset(client);
@@ -846,12 +852,18 @@ static int msp_suspend(struct device * dev, u32 state, u32 level)
}
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,14)
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,20)
+static int msp_resume(struct i2c_client *client)
+#else
static int msp_resume(struct device * dev)
+#endif
#else
static int msp_resume(struct device * dev, u32 level)
#endif
{
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,20)
struct i2c_client *client = container_of(dev, struct i2c_client, dev);
+#endif
v4l_dbg(1, msp_debug, client, "resume\n");
msp_wake_thread(client);
@@ -894,7 +906,7 @@ static int msp_attach(struct i2c_adapter *adapter, int address, int kind)
if (msp_reset(client) == -1) {
v4l_dbg(1, msp_debug, client, "msp3400 not found\n");
kfree(client);
- return -1;
+ return 0;
}
state = kmalloc(sizeof(*state), GFP_KERNEL);
@@ -928,7 +940,7 @@ static int msp_attach(struct i2c_adapter *adapter, int address, int kind)
v4l_dbg(1, msp_debug, client, "not an msp3400 (cannot read chip version)\n");
kfree(state);
kfree(client);
- return -1;
+ return 0;
}
#if 0
@@ -1110,14 +1122,20 @@ static struct i2c_driver i2c_driver = {
.id = I2C_DRIVERID_MSP3400,
.attach_adapter = msp_probe,
.detach_client = msp_detach,
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,20)
+ .suspend = msp_suspend,
+ .resume = msp_resume,
+#endif
.command = msp_command,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
.driver = {
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
.name = "msp3400",
#endif
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,20)
.suspend = msp_suspend,
.resume = msp_resume,
+#endif
},
#endif
};
diff --git a/linux/drivers/media/video/saa7115.c b/linux/drivers/media/video/saa7115.c
index 064a81334..74c89b458 100644
--- a/linux/drivers/media/video/saa7115.c
+++ b/linux/drivers/media/video/saa7115.c
@@ -973,7 +973,7 @@ static void saa711x_set_v4lstd(struct i2c_client *client, v4l2_std_id std)
reg |= 0x10;
} else if (std == V4L2_STD_NTSC_M_JP) {
reg |= 0x40;
- } else if (std == V4L2_STD_SECAM) {
+ } else if (std & V4L2_STD_SECAM) {
reg |= 0x50;
}
saa711x_write(client, R_0E_CHROMA_CNTL_1, reg);
@@ -1505,6 +1505,7 @@ static int saa711x_attach(struct i2c_adapter *adapter, int address, int kind)
if (memcmp(name, "1f711", 5)) {
v4l_dbg(1, debug, client, "chip found @ 0x%x (ID %s) does not match a known saa711x chip.\n",
address << 1, name);
+ kfree(client);
return 0;
}
diff --git a/linux/drivers/media/video/tuner-core.c b/linux/drivers/media/video/tuner-core.c
index 02fb067e2..e7bc60a5e 100644
--- a/linux/drivers/media/video/tuner-core.c
+++ b/linux/drivers/media/video/tuner-core.c
@@ -903,7 +903,11 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,14)
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,20)
+static int tuner_suspend(struct i2c_client *c, pm_message_t state)
+#else
static int tuner_suspend(struct device *dev, pm_message_t state)
+#endif
#else
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13)
static int tuner_suspend(struct device *dev, pm_message_t state, u32 level)
@@ -912,7 +916,9 @@ static int tuner_suspend(struct device *dev, u32 state, u32 level)
#endif
#endif
{
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,20)
struct i2c_client *c = container_of (dev, struct i2c_client, dev);
+#endif
struct tuner *t = i2c_get_clientdata (c);
tuner_dbg ("suspend\n");
@@ -921,12 +927,18 @@ static int tuner_suspend(struct device *dev, u32 state, u32 level)
}
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,14)
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,20)
+static int tuner_resume(struct i2c_client *c)
+#else
static int tuner_resume(struct device *dev)
+#endif
#else
static int tuner_resume(struct device *dev, u32 level)
#endif
{
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,20)
struct i2c_client *c = container_of (dev, struct i2c_client, dev);
+#endif
struct tuner *t = i2c_get_clientdata (c);
tuner_dbg ("resume\n");
@@ -955,13 +967,19 @@ static struct i2c_driver driver = {
.attach_adapter = tuner_probe,
.detach_client = tuner_detach,
.command = tuner_command,
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,20)
+ .suspend = tuner_suspend,
+ .resume = tuner_resume,
+#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
.driver = {
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
.name = "tuner",
#endif
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,20)
.suspend = tuner_suspend,
.resume = tuner_resume,
+#endif
},
#endif
};
diff --git a/linux/include/linux/dvb/video.h b/linux/include/linux/dvb/video.h
index 0c2a1c7c5..93e4c3a6d 100644
--- a/linux/include/linux/dvb/video.h
+++ b/linux/include/linux/dvb/video.h
@@ -110,7 +110,12 @@ struct video_command {
} stop;
struct {
- __u32 speed;
+ /* 0 or 1000 specifies normal speed,
+ 1 specifies forward single stepping,
+ -1 specifies backward single stepping,
+ >1: playback at speed/1000 of the normal speed,
+ <-1: reverse playback at (-speed/1000) of the normal speed. */
+ __s32 speed;
__u32 format;
} play;