[linuxtv-commits] [hg:v4l-dvb] merge: http://linuxtv.org/hg/~awalls/v4l-dvb-bug

2010-02-03 Thread Patch from Douglas Schilling Landgraf
The patch number 14102 was added via Douglas Schilling Landgraf 
dougsl...@redhat.com
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
Linux Media Mailing List linux-me...@vger.kernel.org

--

From: Douglas Schilling Landgraf  dougsl...@redhat.com
merge: http://linuxtv.org/hg/~awalls/v4l-dvb-bug


Signed-off-by: Douglas Schilling Landgraf dougsl...@redhat.com


---

 linux/drivers/media/video/cx18/cx18-alsa-mixer.c |   24 ++-
 linux/drivers/media/video/cx18/cx18-alsa-pcm.c   |   22 ++---
 linux/drivers/media/video/cx18/cx18-alsa.h   |   16 ++
 linux/drivers/media/video/cx18/cx18-dvb.c|4 ++
 linux/drivers/media/video/cx18/cx18-version.h|2 -
 5 files changed, 36 insertions(+), 32 deletions(-)

diff -r 860d29bfa3a7 -r 6619e03338d2 
linux/drivers/media/video/cx18/cx18-alsa-mixer.c
--- a/linux/drivers/media/video/cx18/cx18-alsa-mixer.c  Tue Feb 02 01:40:46 
2010 -0200
+++ b/linux/drivers/media/video/cx18/cx18-alsa-mixer.c  Wed Feb 03 10:16:35 
2010 -0200
@@ -36,22 +36,6 @@
 #include cx18-driver.h
 
 /*
- * Mixer manipulations are like v4l2 ioctl() calls to manipulate controls,
- * just use the same lock we use for ioctl()s for now
- */
-static inline void snd_cx18_mixer_lock(struct snd_cx18_card *cxsc)
-{
-   struct cx18 *cx = to_cx18(cxsc-v4l2_dev);
-   mutex_lock(cx-serialize_lock);
-}
-
-static inline void snd_cx18_mixer_unlock(struct snd_cx18_card *cxsc)
-{
-   struct cx18 *cx = to_cx18(cxsc-v4l2_dev);
-   mutex_unlock(cx-serialize_lock);
-}
-
-/*
  * Note the cx18-av-core volume scale is funny, due to the alignment of the
  * scale with another chip's range:
  *
@@ -108,9 +92,9 @@
vctrl.id = V4L2_CID_AUDIO_VOLUME;
vctrl.value = dB_to_cx18_av_vol(uctl-value.integer.value[0]);
 
-   snd_cx18_mixer_lock(cxsc);
+   snd_cx18_lock(cxsc);
ret = v4l2_subdev_call(cx-sd_av, core, g_ctrl, vctrl);
-   snd_cx18_mixer_unlock(cxsc);
+   snd_cx18_unlock(cxsc);
 
if (!ret)
uctl-value.integer.value[0] = cx18_av_vol_to_dB(vctrl.value);
@@ -128,7 +112,7 @@
vctrl.id = V4L2_CID_AUDIO_VOLUME;
vctrl.value = dB_to_cx18_av_vol(uctl-value.integer.value[0]);
 
-   snd_cx18_mixer_lock(cxsc);
+   snd_cx18_lock(cxsc);
 
/* Fetch current state */
ret = v4l2_subdev_call(cx-sd_av, core, g_ctrl, vctrl);
@@ -142,7 +126,7 @@
if (!ret)
ret = 1; /* Indicate control was changed w/o error */
}
-   snd_cx18_mixer_unlock(cxsc);
+   snd_cx18_unlock(cxsc);
 
return ret;
 }
diff -r 860d29bfa3a7 -r 6619e03338d2 
linux/drivers/media/video/cx18/cx18-alsa-pcm.c
--- a/linux/drivers/media/video/cx18/cx18-alsa-pcm.cTue Feb 02 01:40:46 
2010 -0200
+++ b/linux/drivers/media/video/cx18/cx18-alsa-pcm.cWed Feb 03 10:16:35 
2010 -0200
@@ -167,31 +167,28 @@
struct v4l2_device *v4l2_dev = cxsc-v4l2_dev;
struct cx18 *cx = to_cx18(v4l2_dev);
struct cx18_stream *s;
-   struct cx18_open_id *item;
+   struct cx18_open_id item;
int ret;
 
/* Instruct the cx18 to start sending packets */
+   snd_cx18_lock(cxsc);
s = cx-streams[CX18_ENC_STREAM_TYPE_PCM];
 
-   /* Allocate memory */
-   item = kmalloc(sizeof(struct cx18_open_id), GFP_KERNEL);
-   if (NULL == item)
-   return -ENOMEM;
-
-   item-cx = cx;
-   item-type = s-type;
-   item-open_id = cx-open_id++;
+   item.cx = cx;
+   item.type = s-type;
+   item.open_id = cx-open_id++;
 
/* See if the stream is available */
-   if (cx18_claim_stream(item, item-type)) {
+   if (cx18_claim_stream(item, item.type)) {
/* No, it's already in use */
-   kfree(item);
+   snd_cx18_unlock(cxsc);
return -EBUSY;
}
 
if (test_bit(CX18_F_S_STREAMOFF, s-s_flags) ||
test_and_set_bit(CX18_F_S_STREAMING, s-s_flags)) {
/* We're already streaming.  No additional action required */
+   snd_cx18_unlock(cxsc);
return 0;
}
 
@@ -206,6 +203,7 @@
/* Not currently streaming, so start it up */
set_bit(CX18_F_S_STREAMING, s-s_flags);
ret = cx18_start_v4l2_encode_stream(s);
+   snd_cx18_unlock(cxsc);
 
return 0;
 }
@@ -219,6 +217,7 @@
int ret;
 
/* Instruct the cx18 to stop sending packets */
+   snd_cx18_lock(cxsc);
s = cx-streams[CX18_ENC_STREAM_TYPE_PCM];
ret = cx18_stop_v4l2_encode_stream(s, 0);
clear_bit(CX18_F_S_STREAMING, s-s_flags);
@@ -226,6 +225,7 @@
cx18_release_stream(s);
 

[linuxtv-commits] [hg:v4l-dvb] merge: http://linuxtv.org/hg/~awalls/v4l-dvb-bugfix

2010-01-22 Thread Patch from Douglas Schilling Landgraf
The patch number 14044 was added via Douglas Schilling Landgraf 
dougsl...@redhat.com
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
Linux Media Mailing List linux-me...@vger.kernel.org

--

From: Douglas Schilling Landgraf  dougsl...@redhat.com
merge: http://linuxtv.org/hg/~awalls/v4l-dvb-bugfix


Signed-off-by: Douglas Schilling Landgraf dougsl...@redhat.com


---

 linux/drivers/media/video/cx25840/cx25840-core.c |   48 ---
 linux/drivers/media/video/ivtv/ivtv-irq.c|5 -
 linux/drivers/media/video/ivtv/ivtv-streams.c|6 +
 linux/drivers/media/video/ivtv/ivtv-udma.c   |1 
 linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c  |1 
 linux/include/media/v4l2-subdev.h|1 
 6 files changed, 50 insertions(+), 12 deletions(-)

diff -r b2d6fbf1cce1 -r 044f94c368ed 
linux/drivers/media/video/cx25840/cx25840-core.c
--- a/linux/drivers/media/video/cx25840/cx25840-core.c  Sat Jan 23 00:02:29 
2010 -0200
+++ b/linux/drivers/media/video/cx25840/cx25840-core.c  Sat Jan 23 00:12:14 
2010 -0200
@@ -1379,30 +1379,59 @@
 }
 #endif
 
+static int cx25840_s_audio_stream(struct v4l2_subdev *sd, int enable)
+{
+   struct cx25840_state *state = to_state(sd);
+   struct i2c_client *client = v4l2_get_subdevdata(sd);
+   u8 v;
+
+   if (is_cx2583x(state) || is_cx2388x(state) || is_cx231xx(state))
+   return 0;
+
+   v4l_dbg(1, cx25840_debug, client, %s audio output\n,
+   enable ? enable : disable);
+
+   if (enable) {
+   v = cx25840_read(client, 0x115) | 0x80;
+   cx25840_write(client, 0x115, v);
+   v = cx25840_read(client, 0x116) | 0x03;
+   cx25840_write(client, 0x116, v);
+   } else {
+   v = cx25840_read(client, 0x115)  ~(0x80);
+   cx25840_write(client, 0x115, v);
+   v = cx25840_read(client, 0x116)  ~(0x03);
+   cx25840_write(client, 0x116, v);
+   }
+   return 0;
+}
+
 static int cx25840_s_stream(struct v4l2_subdev *sd, int enable)
 {
struct cx25840_state *state = to_state(sd);
struct i2c_client *client = v4l2_get_subdevdata(sd);
+   u8 v;
 
-   v4l_dbg(1, cx25840_debug, client, %s output\n,
+   v4l_dbg(1, cx25840_debug, client, %s video output\n,
enable ? enable : disable);
if (enable) {
if (is_cx2388x(state) || is_cx231xx(state)) {
-   u8 v = (cx25840_read(client, 0x421) | 0x0b);
+   v = cx25840_read(client, 0x421) | 0x0b;
cx25840_write(client, 0x421, v);
} else {
-   cx25840_write(client, 0x115,
-   is_cx2583x(state) ? 0x0c : 0x8c);
-   cx25840_write(client, 0x116,
-   is_cx2583x(state) ? 0x04 : 0x07);
+   v = cx25840_read(client, 0x115) | 0x0c;
+   cx25840_write(client, 0x115, v);
+   v = cx25840_read(client, 0x116) | 0x04;
+   cx25840_write(client, 0x116, v);
}
} else {
if (is_cx2388x(state) || is_cx231xx(state)) {
-   u8 v = cx25840_read(client, 0x421)  ~(0x0b);
+   v = cx25840_read(client, 0x421)  ~(0x0b);
cx25840_write(client, 0x421, v);
} else {
-   cx25840_write(client, 0x115, 0x00);
-   cx25840_write(client, 0x116, 0x00);
+   v = cx25840_read(client, 0x115)  ~(0x0c);
+   cx25840_write(client, 0x115, v);
+   v = cx25840_read(client, 0x116)  ~(0x04);
+   cx25840_write(client, 0x116, v);
}
}
return 0;
@@ -1633,6 +1662,7 @@
 static const struct v4l2_subdev_audio_ops cx25840_audio_ops = {
.s_clock_freq = cx25840_s_clock_freq,
.s_routing = cx25840_s_audio_routing,
+   .s_stream = cx25840_s_audio_stream,
 };
 
 static const struct v4l2_subdev_video_ops cx25840_video_ops = {
diff -r b2d6fbf1cce1 -r 044f94c368ed linux/drivers/media/video/ivtv/ivtv-irq.c
--- a/linux/drivers/media/video/ivtv/ivtv-irq.c Sat Jan 23 00:02:29 2010 -0200
+++ b/linux/drivers/media/video/ivtv/ivtv-irq.c Sat Jan 23 00:12:14 2010 -0200
@@ -950,9 +950,10 @@
ivtv_dma_enc_start(s);
break;
}
-   if (i == IVTV_MAX_STREAMS  
test_and_clear_bit(IVTV_F_I_UDMA_PENDING, itv-i_flags)) {
+
+   if (i == IVTV_MAX_STREAMS 
+ 

[linuxtv-commits] [hg:v4l-dvb] merge: http://linuxtv.org/hg/~awalls/v4l-dvb-misc

2009-11-24 Thread Patch from Mauro Carvalho Chehab
The patch number 13447 was added via Mauro Carvalho Chehab mche...@redhat.com
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
Linux Media Mailing List linux-me...@vger.kernel.org

--

From: Mauro Carvalho Chehab  mche...@redhat.com
merge: http://linuxtv.org/hg/~awalls/v4l-dvb-misc


Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com


---

 linux/drivers/media/video/cx18/cx18-cards.h  |3 
 linux/drivers/media/video/cx18/cx18-driver.h |7 
 linux/drivers/media/video/cx18/cx18-i2c.c|   31 +--
 linux/drivers/media/video/ivtv/ivtv-cards.c  |   16 +
 linux/drivers/media/video/ivtv/ivtv-cards.h  |   51 +++--
 linux/drivers/media/video/ivtv/ivtv-driver.c |   23 ++
 linux/drivers/media/video/ivtv/ivtv-driver.h |   10 +
 linux/drivers/media/video/ivtv/ivtv-i2c.c|  168 ++-
 linux/drivers/media/video/ivtv/ivtv-i2c.h|1 
 9 files changed, 234 insertions(+), 76 deletions(-)

diff -r a794f91db93f -r ea9443a530e1 linux/drivers/media/video/cx18/cx18-cards.h
--- a/linux/drivers/media/video/cx18/cx18-cards.h   Tue Nov 24 14:29:58 
2009 -0200
+++ b/linux/drivers/media/video/cx18/cx18-cards.h   Tue Nov 24 14:34:26 
2009 -0200
@@ -34,6 +34,9 @@
 #define CX18_HW_Z8F0811_IR_HAUP(CX18_HW_Z8F0811_IR_RX_HAUP | \
 CX18_HW_Z8F0811_IR_TX_HAUP)
 
+#define CX18_HW_IR_ANY (CX18_HW_Z8F0811_IR_RX_HAUP | \
+   CX18_HW_Z8F0811_IR_TX_HAUP)
+
 /* video inputs */
 #defineCX18_CARD_INPUT_VID_TUNER   1
 #defineCX18_CARD_INPUT_SVIDEO1 2
diff -r a794f91db93f -r ea9443a530e1 
linux/drivers/media/video/cx18/cx18-driver.h
--- a/linux/drivers/media/video/cx18/cx18-driver.h  Tue Nov 24 14:29:58 
2009 -0200
+++ b/linux/drivers/media/video/cx18/cx18-driver.h  Tue Nov 24 14:34:26 
2009 -0200
@@ -50,6 +50,9 @@
 #include media/v4l2-ioctl.h
 #include media/v4l2-device.h
 #include media/tuner.h
+#if LINUX_VERSION_CODE = KERNEL_VERSION(2, 6, 30)
+#include media/ir-kbd-i2c.h
+#endif
 #include cx18-mailbox.h
 #include cx18-av-core.h
 #include cx23418.h
@@ -606,6 +609,10 @@
struct i2c_algo_bit_data i2c_algo[2];
struct cx18_i2c_algo_callback_data i2c_algo_cb_data[2];
 
+#if LINUX_VERSION_CODE = KERNEL_VERSION(2, 6, 30)
+   struct IR_i2c_init_data ir_i2c_init_data;
+#endif
+
/* gpio */
u32 gpio_dir;
u32 gpio_val;
diff -r a794f91db93f -r ea9443a530e1 linux/drivers/media/video/cx18/cx18-i2c.c
--- a/linux/drivers/media/video/cx18/cx18-i2c.c Tue Nov 24 14:29:58 2009 -0200
+++ b/linux/drivers/media/video/cx18/cx18-i2c.c Tue Nov 24 14:34:26 2009 -0200
@@ -28,9 +28,6 @@
 #include cx18-gpio.h
 #include cx18-i2c.h
 #include cx18-irq.h
-#if LINUX_VERSION_CODE = KERNEL_VERSION(2, 6, 30)
-#include media/ir-kbd-i2c.h
-#endif
 
 #define CX18_REG_I2C_1_WR   0xf15000
 #define CX18_REG_I2C_1_RD   0xf15008
@@ -100,17 +97,11 @@
 };
 
 #if LINUX_VERSION_CODE = KERNEL_VERSION(2, 6, 30)
-static const struct IR_i2c_init_data z8f0811_ir_init_data = {
-   .ir_codes = ir_codes_hauppauge_new_table,
-   .internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR,
-   .type = IR_TYPE_RC5,
-   .name = CX23418 Z8F0811 Hauppauge,
-};
-
-static int cx18_i2c_new_ir(struct i2c_adapter *adap, u32 hw, const char *type,
-  u8 addr)
+static int cx18_i2c_new_ir(struct cx18 *cx, struct i2c_adapter *adap, u32 hw,
+  const char *type, u8 addr)
 {
struct i2c_board_info info;
+   struct IR_i2c_init_data *init_data = cx-ir_i2c_init_data;
unsigned short addr_list[2] = { addr, I2C_CLIENT_END };
 
memset(info, 0, sizeof(struct i2c_board_info));
@@ -119,17 +110,19 @@
/* Our default information for ir-kbd-i2c.c to use */
switch (hw) {
case CX18_HW_Z8F0811_IR_RX_HAUP:
-   info.platform_data = (void *) z8f0811_ir_init_data;
-   break;
-   default:
+   init_data-ir_codes = ir_codes_hauppauge_new_table;
+   init_data-internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR;
+   init_data-type = IR_TYPE_RC5;
+   init_data-name = cx-card_name;
+   info.platform_data = init_data;
break;
}
 
return i2c_new_probed_device(adap, info, addr_list) == NULL ? -1 : 0;
 }
 #else
-static int cx18_i2c_new_ir(struct i2c_adapter *adap, u32 hw, const char *type,
-  u8 addr)
+static int cx18_i2c_new_ir(struct cx18 *cx, struct i2c_adapter *adap, u32 hw,
+  const char *type, u8 addr)
 {
return -1;
 }
@@ -164,8 +157,8 @@
return sd != NULL ? 0 : -1;
}
 
-   if (hw  

[linuxtv-commits] [hg:v4l-dvb] merge: http://linuxtv.org/hg/~awalls/v4l-dvb

2009-09-15 Thread Patch from Mauro Carvalho Chehab
The patch number 12885 was added via Mauro Carvalho Chehab mche...@redhat.com
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
Linux Media Mailing List linux-me...@vger.kernel.org

--

From: Mauro Carvalho Chehab  mche...@redhat.com
merge: http://linuxtv.org/hg/~awalls/v4l-dvb


Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com


---

 linux/drivers/media/video/cx18/cx18-i2c.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -r 74dfef9640ca -r 35f39943de0c linux/drivers/media/video/cx18/cx18-i2c.c
--- a/linux/drivers/media/video/cx18/cx18-i2c.c Tue Sep 15 14:07:18 2009 -0300
+++ b/linux/drivers/media/video/cx18/cx18-i2c.c Tue Sep 15 14:09:03 2009 -0300
@@ -119,7 +119,7 @@
/* Our default information for ir-kbd-i2c.c to use */
switch (hw) {
case CX18_HW_Z8F0811_IR_RX_HAUP:
-   info.platform_data = z8f0811_ir_init_data;
+   info.platform_data = (void *) z8f0811_ir_init_data;
break;
default:
break;


---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/35f39943de0cb8e586b27609baae0edcf9de732e

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[linuxtv-commits] [hg:v4l-dvb] merge: http://linuxtv.org/hg/~awalls/v4l-dvb

2009-09-06 Thread Patch from Mauro Carvalho Chehab
The patch number 12700 was added via Mauro Carvalho Chehab mche...@redhat.com
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
Linux Media Mailing List linux-me...@vger.kernel.org

--

From: Mauro Carvalho Chehab  mche...@redhat.com
merge: http://linuxtv.org/hg/~awalls/v4l-dvb


Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com


---

 linux/drivers/media/video/cx18/cx18-i2c.c |   23 +-
 1 file changed, 14 insertions(+), 9 deletions(-)

diff -r 465731645fc4 -r 5b1e893c2614 linux/drivers/media/video/cx18/cx18-i2c.c
--- a/linux/drivers/media/video/cx18/cx18-i2c.c Mon Sep 07 01:16:50 2009 -0300
+++ b/linux/drivers/media/video/cx18/cx18-i2c.c Mon Sep 07 01:17:45 2009 -0300
@@ -99,12 +99,18 @@
ir_rx_z8f0811_haup,
 };
 
+#if LINUX_VERSION_CODE = KERNEL_VERSION(2, 6, 30)
+static const struct IR_i2c_init_data z8f0811_ir_init_data = {
+   .ir_codes = ir_codes_hauppauge_new_table,
+   .internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR,
+   .type = IR_TYPE_RC5,
+   .name = CX23418 Z8F0811 Hauppauge,
+};
+
 static int cx18_i2c_new_ir(struct i2c_adapter *adap, u32 hw, const char *type,
   u8 addr)
 {
-#if LINUX_VERSION_CODE = KERNEL_VERSION(2, 6, 30)
struct i2c_board_info info;
-   struct IR_i2c_init_data ir_init_data;
unsigned short addr_list[2] = { addr, I2C_CLIENT_END };
 
memset(info, 0, sizeof(struct i2c_board_info));
@@ -113,22 +119,21 @@
/* Our default information for ir-kbd-i2c.c to use */
switch (hw) {
case CX18_HW_Z8F0811_IR_RX_HAUP:
-   memset(ir_init_data, 0, sizeof(struct IR_i2c_init_data));
-   ir_init_data.ir_codes = ir_codes_hauppauge_new_table;
-   ir_init_data.internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR;
-   ir_init_data.type = IR_TYPE_RC5;
-   ir_init_data.name = CX23418 Z8F0811 Hauppauge;
-   info.platform_data = ir_init_data;
+   info.platform_data = z8f0811_ir_init_data;
break;
default:
break;
}
 
return i2c_new_probed_device(adap, info, addr_list) == NULL ? -1 : 0;
+}
 #else
+static int cx18_i2c_new_ir(struct i2c_adapter *adap, u32 hw, const char *type,
+  u8 addr)
+{
return -1;
+}
 #endif
-}
 
 int cx18_i2c_register(struct cx18 *cx, unsigned idx)
 {


---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/5b1e893c2614a728c4ad90cba2774b470a34f10f

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[linuxtv-commits] [hg:v4l-dvb] merge: http://linuxtv.org/hg/~awalls/v4l-dvb

2009-07-24 Thread Patch from Mauro Carvalho Chehab
The patch number 12339 was added via Mauro Carvalho Chehab mche...@redhat.com
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
Linux Media Mailing List linux-me...@vger.kernel.org

--

From: Mauro Carvalho Chehab  mche...@redhat.com
merge: http://linuxtv.org/hg/~awalls/v4l-dvb


Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com


---

 linux/Documentation/video4linux/CARDLIST.tuner  |1 
 linux/drivers/media/common/tuners/tuner-types.c |   25 
 linux/drivers/media/video/cx18/cx18-controls.c  |3 
 linux/drivers/media/video/ivtv/ivtv-cards.c |   95 
 linux/drivers/media/video/ivtv/ivtv-controls.c  |3 
 linux/drivers/media/video/ivtv/ivtv-gpio.c  |   13 --
 linux/include/media/tuner.h |1 
 7 files changed, 81 insertions(+), 60 deletions(-)

diff -r 26dc2ccd00b2 -r f8f134705b65 
linux/Documentation/video4linux/CARDLIST.tuner
--- a/linux/Documentation/video4linux/CARDLIST.tunerFri Jul 24 16:11:31 
2009 -0300
+++ b/linux/Documentation/video4linux/CARDLIST.tunerFri Jul 24 16:19:39 
2009 -0300
@@ -78,3 +78,4 @@ tuner=78 - Philips FMD1216MEX MK3 Hybrid
 tuner=78 - Philips FMD1216MEX MK3 Hybrid Tuner
 tuner=79 - Philips PAL/SECAM multi (FM1216 MK5)
 tuner=80 - Philips FQ1216LME MK3 PAL/SECAM w/active loopthrough
+tuner=81 - Partsnic (Daewoo) PTI-5NF05
diff -r 26dc2ccd00b2 -r f8f134705b65 
linux/drivers/media/common/tuners/tuner-types.c
--- a/linux/drivers/media/common/tuners/tuner-types.c   Fri Jul 24 16:11:31 
2009 -0300
+++ b/linux/drivers/media/common/tuners/tuner-types.c   Fri Jul 24 16:19:39 
2009 -0300
@@ -1302,6 +1302,25 @@ static struct tuner_params tuner_fq1216l
},
 };
 
+/* - TUNER_PARTSNIC_PTI_5NF05 - Partsnic (Daewoo) PTI-5NF05 NTSC - */
+
+static struct tuner_range tuner_partsnic_pti_5nf05_ranges[] = {
+   /* The datasheet specified channel ranges and the bandswitch byte */
+   /* The control byte value of 0x8e is just a guess */
+   { 16 * 133.25 /*MHz*/, 0x8e, 0x01, }, /* Channels2 -B */
+   { 16 * 367.25 /*MHz*/, 0x8e, 0x02, }, /* ChannelsC - W+11 */
+   { 16 * 999.99, 0x8e, 0x08, }, /* Channels W+12 -   69 */
+};
+
+static struct tuner_params tuner_partsnic_pti_5nf05_params[] = {
+   {
+   .type   = TUNER_PARAM_TYPE_NTSC,
+   .ranges = tuner_partsnic_pti_5nf05_ranges,
+   .count  = ARRAY_SIZE(tuner_partsnic_pti_5nf05_ranges),
+   .cb_first_if_lower_freq = 1, /* not specified but safe to do */
+   },
+};
+
 /* - */
 
 struct tunertype tuners[] = {
@@ -1754,6 +1773,12 @@ struct tunertype tuners[] = {
.params = tuner_fq1216lme_mk3_params,
.count  = ARRAY_SIZE(tuner_fq1216lme_mk3_params),
},
+
+   [TUNER_PARTSNIC_PTI_5NF05] = {
+   .name = Partsnic (Daewoo) PTI-5NF05,
+   .params = tuner_partsnic_pti_5nf05_params,
+   .count  = ARRAY_SIZE(tuner_partsnic_pti_5nf05_params),
+   },
 };
 EXPORT_SYMBOL(tuners);
 
diff -r 26dc2ccd00b2 -r f8f134705b65 
linux/drivers/media/video/cx18/cx18-controls.c
--- a/linux/drivers/media/video/cx18/cx18-controls.cFri Jul 24 16:11:31 
2009 -0300
+++ b/linux/drivers/media/video/cx18/cx18-controls.cFri Jul 24 16:19:39 
2009 -0300
@@ -20,6 +20,7 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  *  02111-1307  USA
  */
+#include linux/kernel.h
 
 #include cx18-driver.h
 #include cx18-cards.h
@@ -317,7 +318,7 @@ int cx18_s_ext_ctrls(struct file *file, 
idx = p.audio_properties  0x03;
/* The audio clock of the digitizer must match the codec sample
   rate otherwise you get some very strange effects. */
-   if (idx  sizeof(freqs))
+   if (idx  ARRAY_SIZE(freqs))
cx18_call_all(cx, audio, s_clock_freq, freqs[idx]);
return err;
}
diff -r 26dc2ccd00b2 -r f8f134705b65 linux/drivers/media/video/ivtv/ivtv-cards.c
--- a/linux/drivers/media/video/ivtv/ivtv-cards.c   Fri Jul 24 16:11:31 
2009 -0300
+++ b/linux/drivers/media/video/ivtv/ivtv-cards.c   Fri Jul 24 16:19:39 
2009 -0300
@@ -977,55 +977,17 @@ static const struct ivtv_card ivtv_card_
 
 /* - */
 
-/* AVerMedia PVR-150 Plus (M113) card */
+/* AVerMedia PVR-150 Plus / AVerTV M113 cards with a Daewoo/Partsnic Tuner */
 
 static const struct ivtv_card_pci_info ivtv_pci_aver_pvr150[] = {
-   { PCI_DEVICE_ID_IVTV16, IVTV_PCI_ID_AVERMEDIA, 0xc035 },
+   { PCI_DEVICE_ID_IVTV16, 

[linuxtv-commits] [hg:v4l-dvb] merge: http://linuxtv.org/hg/~awalls/v4l-dvb

2009-07-05 Thread Patch from Mauro Carvalho Chehab
The patch number 12183 was added via Mauro Carvalho Chehab mche...@redhat.com
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
Linux Media Mailing List linux-me...@vger.kernel.org

--

From: Mauro Carvalho Chehab  mche...@redhat.com
merge: http://linuxtv.org/hg/~awalls/v4l-dvb


Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com


---

 linux/Documentation/dvb/get_dvb_firmware|   52 ++
 linux/drivers/media/video/cx18/cx18-cards.c |   42 +++--
 linux/drivers/media/video/cx18/cx18-dvb.c   |  160 
 3 files changed, 237 insertions(+), 17 deletions(-)

diff -r 431c2fa27fd1 -r 7f829941fb9a linux/Documentation/dvb/get_dvb_firmware
--- a/linux/Documentation/dvb/get_dvb_firmware  Sun Jul 05 09:25:04 2009 -0300
+++ b/linux/Documentation/dvb/get_dvb_firmware  Sun Jul 05 09:27:45 2009 -0300
@@ -25,7 +25,7 @@ use IO::Handle;
tda10046lifeview, av7110, dec2000t, dec2540t,
dec3000s, vp7041, dibusb, nxt2002, nxt2004,
or51211, or51132_qam, or51132_vsb, bluebird,
-   opera1, cx231xx, cx18, cx23885, pvrusb2 );
+   opera1, cx231xx, cx18, cx23885, pvrusb2, mpc718 );
 
 # Check args
 syntax() if (scalar(@ARGV) != 1);
@@ -381,6 +381,56 @@ sub cx18 {
 $allfiles;
 }
 
+sub mpc718 {
+my $archive = 'Yuan MPC718 TV Tuner Card 2.13.10.1016.zip';
+my $url = 
ftp://ftp.work.acer-euro.com/desktop/aspire_idea510/vista/Drivers/$archive;;
+my $fwfile = dvb-cx18-mpc718-mt352.fw;
+my $tmpdir = tempdir(DIR = /tmp, CLEANUP = 1);
+
+checkstandard();
+wgetfile($archive, $url);
+unzip($archive, $tmpdir);
+
+my $sourcefile = $tmpdir/Yuan MPC718 TV Tuner Card 
2.13.10.1016/mpc718_32bit/yuanrap.sys;
+my $found = 0;
+
+open IN, '', $sourcefile or die Couldn't open $sourcefile to extract 
$fwfile data\n;
+binmode IN;
+open OUT, '', $fwfile;
+binmode OUT;
+{
+   # Block scope because we change the line terminator variable $/
+   my $prevlen = 0;
+   my $currlen;
+
+   # Buried in the data segment are 3 runs of almost identical
+   # register-value pairs that end in 0x5d 0x01 which is a TUNER GO
+   # command for the MT352.
+   # Pull out the middle run (because it's easy) of register-value
+   # pairs to make the firmware file.
+
+   local $/ = \x5d\x01; # MT352 TUNER GO
+
+   while (IN) {
+   $currlen = length($_);
+   if ($prevlen == $currlen || $currlen = 64) {
+   chop; chop; # Get rid of TUNER GO
+   s/^\0\0//;  # get rid of leading 00 00 if it's there
+   printf OUT $_;
+   $found = 1;
+   last;
+   }
+   }
+}
+close OUT;
+close IN;
+if (!$found) {
+   unlink $fwfile;
+   die Couldn't find valid register-value sequence in $sourcefile for 
$fwfile\n;
+}
+$fwfile;
+}
+
 sub cx23885 {
 my $url = http://linuxtv.org/downloads/firmware/;;
 
diff -r 431c2fa27fd1 -r 7f829941fb9a linux/drivers/media/video/cx18/cx18-cards.c
--- a/linux/drivers/media/video/cx18/cx18-cards.c   Sun Jul 05 09:25:04 
2009 -0300
+++ b/linux/drivers/media/video/cx18/cx18-cards.c   Sun Jul 05 09:27:45 
2009 -0300
@@ -198,11 +198,14 @@ static const struct cx18_card_pci_info c
 
 static const struct cx18_card cx18_card_mpc718 = {
.type = CX18_CARD_YUAN_MPC718,
-   .name = Yuan MPC718,
-   .comment = Analog video capture works; some audio line in may not.\n,
-   .v4l2_capabilities = CX18_CAP_ENCODER,
-   .hw_audio_ctrl = CX18_HW_418_AV,
-   .hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_RESET_CTRL,
+   .name = Yuan MPC718 MiniPCI DVB-T/Analog,
+   .comment = Experimenters needed for device to work well.\n
+ \tTo help, mail the ivtv-devel list (www.ivtvdriver.org).\n,
+   .v4l2_capabilities = CX18_CAP_ENCODER,
+   .hw_audio_ctrl = CX18_HW_418_AV,
+   .hw_muxer = CX18_HW_GPIO_MUX,
+   .hw_all = CX18_HW_418_AV | CX18_HW_TUNER |
+ CX18_HW_GPIO_MUX | CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL,
.video_inputs = {
{ CX18_CARD_INPUT_VID_TUNER,  0, CX18_AV_COMPOSITE2 },
{ CX18_CARD_INPUT_SVIDEO1,1,
@@ -211,27 +214,34 @@ static const struct cx18_card cx18_card_
{ CX18_CARD_INPUT_SVIDEO2,2,
CX18_AV_SVIDEO_LUMA7 | CX18_AV_SVIDEO_CHROMA8 },
{ CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE6 },
-   { CX18_CARD_INPUT_COMPOSITE3, 2, CX18_AV_COMPOSITE3 },
},
.audio_inputs = {
{ CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5,0 },
-   { 

[linuxtv-commits] [hg:v4l-dvb] merge: http://linuxtv.org/hg/~awalls/v4l-dvb

2009-07-05 Thread Patch from Mauro Carvalho Chehab
The patch number 12208 was added via Mauro Carvalho Chehab mche...@redhat.com
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
Linux Media Mailing List linux-me...@vger.kernel.org

--

From: Mauro Carvalho Chehab  mche...@redhat.com
merge: http://linuxtv.org/hg/~awalls/v4l-dvb


Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com


---

 linux/Documentation/dvb/get_dvb_firmware |3 -
 linux/drivers/media/video/cx18/cx18-cards.c  |2 
 linux/drivers/media/video/cx18/cx18-driver.c |   41 ++-
 3 files changed, 42 insertions(+), 4 deletions(-)

diff -r 83656a73573d -r 29c1e81eaf1b linux/Documentation/dvb/get_dvb_firmware
--- a/linux/Documentation/dvb/get_dvb_firmware  Sun Jul 05 18:52:23 2009 -0300
+++ b/linux/Documentation/dvb/get_dvb_firmware  Sun Jul 05 18:58:38 2009 -0300
@@ -413,13 +413,14 @@ sub mpc718 {
 
while (IN) {
$currlen = length($_);
-   if ($prevlen == $currlen || $currlen = 64) {
+   if ($prevlen == $currlen  $currlen = 64) {
chop; chop; # Get rid of TUNER GO
s/^\0\0//;  # get rid of leading 00 00 if it's there
printf OUT $_;
$found = 1;
last;
}
+   $prevlen = $currlen;
}
 }
 close OUT;
diff -r 83656a73573d -r 29c1e81eaf1b linux/drivers/media/video/cx18/cx18-cards.c
--- a/linux/drivers/media/video/cx18/cx18-cards.c   Sun Jul 05 18:52:23 
2009 -0300
+++ b/linux/drivers/media/video/cx18/cx18-cards.c   Sun Jul 05 18:58:38 
2009 -0300
@@ -204,7 +204,7 @@ static const struct cx18_card cx18_card_
.v4l2_capabilities = CX18_CAP_ENCODER,
.hw_audio_ctrl = CX18_HW_418_AV,
.hw_muxer = CX18_HW_GPIO_MUX,
-   .hw_all = CX18_HW_418_AV | CX18_HW_TUNER |
+   .hw_all = CX18_HW_TVEEPROM | CX18_HW_418_AV | CX18_HW_TUNER |
  CX18_HW_GPIO_MUX | CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL,
.video_inputs = {
{ CX18_CARD_INPUT_VID_TUNER,  0, CX18_AV_COMPOSITE2 },
diff -r 83656a73573d -r 29c1e81eaf1b 
linux/drivers/media/video/cx18/cx18-driver.c
--- a/linux/drivers/media/video/cx18/cx18-driver.c  Sun Jul 05 18:52:23 
2009 -0300
+++ b/linux/drivers/media/video/cx18/cx18-driver.c  Sun Jul 05 18:58:38 
2009 -0300
@@ -268,6 +268,20 @@ static void cx18_iounmap(struct cx18 *cx
}
 }
 
+static void cx18_eeprom_dump(struct cx18 *cx, unsigned char *eedata, int len)
+{
+   int i;
+
+   CX18_INFO(eeprom dump:\n);
+   for (i = 0; i  len; i++) {
+   if (0 == (i % 16))
+   CX18_INFO(eeprom %02x:, i);
+   printk(KERN_CONT  %02x, eedata[i]);
+   if (15 == (i % 16))
+   printk(KERN_CONT \n);
+   }
+}
+
 /* Hauppauge card? get values from tveeprom */
 void cx18_read_eeprom(struct cx18 *cx, struct tveeprom *tv)
 {
@@ -279,8 +293,26 @@ void cx18_read_eeprom(struct cx18 *cx, s
c.adapter = cx-i2c_adap[0];
c.addr = 0xA0  1;
 
-   tveeprom_read(c, eedata, sizeof(eedata));
-   tveeprom_hauppauge_analog(c, tv, eedata);
+   memset(tv, 0, sizeof(*tv));
+   if (tveeprom_read(c, eedata, sizeof(eedata)))
+   return;
+
+   switch (cx-card-type) {
+   case CX18_CARD_HVR_1600_ESMT:
+   case CX18_CARD_HVR_1600_SAMSUNG:
+   tveeprom_hauppauge_analog(c, tv, eedata);
+   break;
+   case CX18_CARD_YUAN_MPC718:
+   tv-model = 0x718;
+   cx18_eeprom_dump(cx, eedata, sizeof(eedata));
+   CX18_INFO(eeprom PCI ID: %02x%02x:%02x%02x\n,
+ eedata[2], eedata[1], eedata[4], eedata[3]);
+   break;
+   default:
+   tv-model = 0x;
+   cx18_eeprom_dump(cx, eedata, sizeof(eedata));
+   break;
+   }
 }
 
 static void cx18_process_eeprom(struct cx18 *cx)
@@ -298,6 +330,11 @@ static void cx18_process_eeprom(struct c
case 74000 ... 74999:
cx-card = cx18_get_card(CX18_CARD_HVR_1600_ESMT);
break;
+   case 0x718:
+   return;
+   case 0x:
+   CX18_INFO(Unknown EEPROM encoding\n);
+   return;
case 0:
CX18_ERR(Invalid EEPROM\n);
return;


---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/29c1e81eaf1bb8777accfb40e5e3d553df1357a2

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[linuxtv-commits] [hg:v4l-dvb] merge: http://linuxtv.org/hg/~awalls/v4l-dvb

2009-06-11 Thread Patch from Mauro Carvalho Chehab
The patch number 11952 was added via Mauro Carvalho Chehab mche...@redhat.com
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
Linux Media Mailing List linux-me...@vger.kernel.org

--

From: Mauro Carvalho Chehab  mche...@redhat.com
merge: http://linuxtv.org/hg/~awalls/v4l-dvb


Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com


---

 linux/drivers/media/video/cx18/cx18-cards.c  |   63 ---
 linux/drivers/media/video/cx18/cx18-driver.c |3 
 linux/drivers/media/video/cx18/cx18-driver.h |5 -
 linux/drivers/media/video/cx18/cx18-dvb.c|   59 -
 4 files changed, 115 insertions(+), 15 deletions(-)

diff -r 8b9708d43261 -r 679f92507285 linux/drivers/media/video/cx18/cx18-cards.c
--- a/linux/drivers/media/video/cx18/cx18-cards.c   Thu Jun 11 17:48:11 
2009 -0300
+++ b/linux/drivers/media/video/cx18/cx18-cards.c   Thu Jun 11 18:17:50 
2009 -0300
@@ -351,13 +351,12 @@ static const struct cx18_card cx18_card_
 
 static const struct cx18_card_pci_info cx18_pci_leadtek_pvr2100[] = {
{ PCI_DEVICE_ID_CX23418, CX18_PCI_ID_LEADTEK, 0x6f27 }, /* PVR2100   */
-   { PCI_DEVICE_ID_CX23418, CX18_PCI_ID_LEADTEK, 0x6690 }, /* DVR3100 H */
{ 0, 0, 0 }
 };
 
 static const struct cx18_card cx18_card_leadtek_pvr2100 = {
.type = CX18_CARD_LEADTEK_PVR2100,
-   .name = Leadtek WinFast PVR2100/DVR3100 H,
+   .name = Leadtek WinFast PVR2100,
.comment = Experimenters and photos needed for device to work well.\n
  \tTo help, mail the ivtv-devel list (www.ivtvdriver.org).\n,
.v4l2_capabilities = CX18_CAP_ENCODER,
@@ -376,15 +375,12 @@ static const struct cx18_card cx18_card_
{ CX18_CARD_INPUT_LINE_IN1,  CX18_AV_AUDIO_SERIAL1, 1 },
},
.tuners = {
-   /* XC3028 tuner */
+   /* XC2028 tuner */
{ .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
},
.radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 2 },
.ddr = {
-   /*
-* Pointer to proper DDR config values provided by
-* Terry Wu terrywu at leadtek.com.tw
-*/
+   /* Pointer to proper DDR config values provided by Terry Wu */
.chip_config = 0x303,
.refresh = 0x3bb,
.timing1 = 0x24220e83,
@@ -398,6 +394,58 @@ static const struct cx18_card cx18_card_
  .tuner  = 0x6, .linein = 0x2, .radio  = 0x2 },
.xceive_pin = 15,
.pci_list = cx18_pci_leadtek_pvr2100,
+   .i2c = cx18_i2c_std,
+};
+
+/* - */
+
+/* Leadtek WinFast DVR3100 H */
+
+static const struct cx18_card_pci_info cx18_pci_leadtek_dvr3100h[] = {
+   { PCI_DEVICE_ID_CX23418, CX18_PCI_ID_LEADTEK, 0x6690 }, /* DVR3100 H */
+   { 0, 0, 0 }
+};
+
+static const struct cx18_card cx18_card_leadtek_dvr3100h = {
+   .type = CX18_CARD_LEADTEK_DVR3100H,
+   .name = Leadtek WinFast DVR3100 H,
+   .comment = Simultaneous DVB-T and Analog capture supported,\n
+ \texcept when capturing Analog from the antenna input.\n,
+   .v4l2_capabilities = CX18_CAP_ENCODER,
+   .hw_audio_ctrl = CX18_HW_418_AV,
+   .hw_muxer = CX18_HW_GPIO_MUX,
+   .hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_MUX |
+ CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL,
+   .video_inputs = {
+   { CX18_CARD_INPUT_VID_TUNER,  0, CX18_AV_COMPOSITE2 },
+   { CX18_CARD_INPUT_SVIDEO1,1,
+   CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },
+   { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE7 },
+   },
+   .audio_inputs = {
+   { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5,0 },
+   { CX18_CARD_INPUT_LINE_IN1,  CX18_AV_AUDIO_SERIAL1, 1 },
+   },
+   .tuners = {
+   /* XC3028 tuner */
+   { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
+   },
+   .radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 2 },
+   .ddr = {
+   /* Pointer to proper DDR config values provided by Terry Wu */
+   .chip_config = 0x303,
+   .refresh = 0x3bb,
+   .timing1 = 0x24220e83,
+   .timing2 = 0x1f,
+   .tune_lane = 0,
+   .initial_emrs = 0x2,
+   },
+   .gpio_init.initial_value = 0x6,
+   .gpio_init.direction = 0x7,
+   .gpio_audio_input = { .mask   = 0x7,
+ .tuner  = 0x6, .linein = 0x2, .radio  = 0x2 },
+   .xceive_pin = 1,
+   

[linuxtv-commits] [hg:v4l-dvb] merge: http://linuxtv.org/hg/~awalls/v4l-dvb

2009-04-28 Thread Patch from Mauro Carvalho Chehab
The patch number 11625 was added via Mauro Carvalho Chehab mche...@redhat.com
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
Linux Media Mailing List linux-me...@vger.kernel.org

--

From: Mauro Carvalho Chehab  mche...@redhat.com
merge: http://linuxtv.org/hg/~awalls/v4l-dvb


Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com


---

 linux/drivers/media/video/cx18/cx18-audio.c   |   44 ++-
 linux/drivers/media/video/cx18/cx18-av-firmware.c |   82 +-
 linux/drivers/media/video/cx18/cx18-controls.c|6 -
 linux/drivers/media/video/cx18/cx18-fileops.c |7 +
 4 files changed, 126 insertions(+), 13 deletions(-)

diff -r e6593df11736 -r 0471fb0f32a3 linux/drivers/media/video/cx18/cx18-audio.c
--- a/linux/drivers/media/video/cx18/cx18-audio.c   Tue Apr 28 19:24:32 
2009 -0300
+++ b/linux/drivers/media/video/cx18/cx18-audio.c   Tue Apr 28 19:41:55 
2009 -0300
@@ -26,14 +26,18 @@
 #include cx18-cards.h
 #include cx18-audio.h
 
-#define CX18_AUDIO_ENABLE 0xc72014
+#define CX18_AUDIO_ENABLE0xc72014
+#define CX18_AI1_MUX_MASK0x30
+#define CX18_AI1_MUX_I2S10x00
+#define CX18_AI1_MUX_I2S20x10
+#define CX18_AI1_MUX_843_I2S 0x20
 
 /* Selects the audio input and output according to the current
settings. */
 int cx18_audio_set_io(struct cx18 *cx)
 {
const struct cx18_card_audio_input *in;
-   u32 val;
+   u32 u, v;
int err;
 
/* Determine which input to use */
@@ -52,9 +56,37 @@ int cx18_audio_set_io(struct cx18 *cx)
return err;
 
/* FIXME - this internal mux should be abstracted to a subdev */
-   val = cx18_read_reg(cx, CX18_AUDIO_ENABLE)  ~0x30;
-   val |= (in-audio_input  CX18_AV_AUDIO_SERIAL2) ? 0x20 :
-   (in-audio_input  4);
-   cx18_write_reg_expect(cx, val | 0xb00, CX18_AUDIO_ENABLE, val, 0x30);
+   u = cx18_read_reg(cx, CX18_AUDIO_ENABLE);
+   v = u  ~CX18_AI1_MUX_MASK;
+   switch (in-audio_input) {
+   case CX18_AV_AUDIO_SERIAL1:
+   v |= CX18_AI1_MUX_I2S1;
+   break;
+   case CX18_AV_AUDIO_SERIAL2:
+   v |= CX18_AI1_MUX_I2S2;
+   break;
+   default:
+   v |= CX18_AI1_MUX_843_I2S;
+   break;
+   }
+   if (v == u) {
+   /* force a toggle of some AI1 MUX control bits */
+   u = ~CX18_AI1_MUX_MASK;
+   switch (in-audio_input) {
+   case CX18_AV_AUDIO_SERIAL1:
+   u |= CX18_AI1_MUX_843_I2S;
+   break;
+   case CX18_AV_AUDIO_SERIAL2:
+   u |= CX18_AI1_MUX_843_I2S;
+   break;
+   default:
+   u |= CX18_AI1_MUX_I2S1;
+   break;
+   }
+   cx18_write_reg_expect(cx, u | 0xb00, CX18_AUDIO_ENABLE,
+ u, CX18_AI1_MUX_MASK);
+   }
+   cx18_write_reg_expect(cx, v | 0xb00, CX18_AUDIO_ENABLE,
+ v, CX18_AI1_MUX_MASK);
return 0;
 }
diff -r e6593df11736 -r 0471fb0f32a3 
linux/drivers/media/video/cx18/cx18-av-firmware.c
--- a/linux/drivers/media/video/cx18/cx18-av-firmware.c Tue Apr 28 19:24:32 
2009 -0300
+++ b/linux/drivers/media/video/cx18/cx18-av-firmware.c Tue Apr 28 19:41:55 
2009 -0300
@@ -24,15 +24,63 @@
 #include cx18-io.h
 #include linux/firmware.h
 
-#define CX18_AUDIO_ENABLE 0xc72014
+#define CX18_AUDIO_ENABLE0xc72014
+#define CX18_AI1_MUX_MASK0x30
+#define CX18_AI1_MUX_I2S10x00
+#define CX18_AI1_MUX_I2S20x10
+#define CX18_AI1_MUX_843_I2S 0x20
+#define CX18_AI1_MUX_INVALID 0x30
+
 #define FWFILE v4l-cx23418-dig.fw
+
+static int cx18_av_verifyfw(struct cx18 *cx, const struct firmware *fw)
+{
+   struct v4l2_subdev *sd = cx-av_state.sd;
+   int ret = 0;
+   const u8 *data;
+   u32 size;
+   int addr;
+   u32 expected, dl_control;
+
+   /* Ensure we put the 8051 in reset and enable firmware upload mode */
+   dl_control = cx18_av_read4(cx, CXADEC_DL_CTL);
+   do {
+   dl_control = 0x00ff;
+   dl_control |= 0x0f00;
+   cx18_av_write4_noretry(cx, CXADEC_DL_CTL, dl_control);
+   dl_control = cx18_av_read4(cx, CXADEC_DL_CTL);
+   } while ((dl_control  0xff00) != 0x0f00);
+
+   /* Read and auto increment until at address 0x */
+   while (dl_control  0x3fff)
+   dl_control = cx18_av_read4(cx, CXADEC_DL_CTL);
+
+   data = fw-data;
+   size = fw-size;
+   for (addr = 0; addr  size; addr++) {
+   dl_control = 0x3fff; /* 

[linuxtv-commits] [hg:v4l-dvb] merge: http://linuxtv.org/hg/~awalls/v4l-dvb

2009-03-26 Thread Patch from Mauro Carvalho Chehab
The patch number 11234 was added via Mauro Carvalho Chehab mche...@redhat.com
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
Linux Media Mailing List linux-me...@vger.kernel.org

--

From: Mauro Carvalho Chehab  mche...@redhat.com
merge: http://linuxtv.org/hg/~awalls/v4l-dvb


Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com


---

 linux/drivers/media/common/tuners/mxl5005s.c |7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff -r d563d87c415a -r 2276e777f950 
linux/drivers/media/common/tuners/mxl5005s.c
--- a/linux/drivers/media/common/tuners/mxl5005s.c  Thu Mar 26 22:15:48 
2009 -0300
+++ b/linux/drivers/media/common/tuners/mxl5005s.c  Thu Mar 26 22:17:48 
2009 -0300
@@ -4005,12 +4005,11 @@ static int mxl5005s_set_params(struct dv
/* Change tuner for new modulation type if reqd */
if (req_mode != state-current_mode) {
switch (req_mode) {
-   case VSB_8:
-   case QAM_64:
-   case QAM_256:
-   case QAM_AUTO:
+   case MXL_ATSC:
+   case MXL_QAM:
req_bw  = MXL5005S_BANDWIDTH_6MHZ;
break;
+   case MXL_DVBT:
default:
/* Assume DVB-T */
switch (params-u.ofdm.bandwidth) {


---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/2276e777f950e5be2a4250602ebf57ea50ba75d7

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[linuxtv-commits] [hg:v4l-dvb] merge: http://linuxtv.org/hg/~awalls/v4l-dvb

2009-03-18 Thread Patch from Mauro Carvalho Chehab
The patch number 11043 was added via Mauro Carvalho Chehab mche...@redhat.com
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
Linux Media Mailing List linux-me...@vger.kernel.org

--

From: Mauro Carvalho Chehab  mche...@redhat.com
merge: http://linuxtv.org/hg/~awalls/v4l-dvb


Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com


---

 linux/include/linux/ivtv.h  |   10 -
 linux/include/linux/videodev2.h |   47 
 v4l2-spec/Makefile  |1 
 v4l2-spec/dev-sliced-vbi.sgml   |  315 +++-
 v4l2-spec/v4l2.sgml |   17 +
 5 files changed, 382 insertions(+), 8 deletions(-)

diff -r 6f0889fda317 -r 39fdce10c0ea linux/include/linux/ivtv.h
--- a/linux/include/linux/ivtv.hMon Mar 02 10:40:52 2009 +0100
+++ b/linux/include/linux/ivtv.hWed Mar 18 11:35:10 2009 -0300
@@ -60,10 +60,10 @@ struct ivtv_dma_frame {
 
 #define IVTV_IOC_DMA_FRAME  _IOW ('V', BASE_VIDIOC_PRIVATE+0, struct 
ivtv_dma_frame)
 
-/* These are the VBI types as they appear in the embedded VBI private packets. 
*/
-#define IVTV_SLICED_TYPE_TELETEXT_B (1)
-#define IVTV_SLICED_TYPE_CAPTION_525(4)
-#define IVTV_SLICED_TYPE_WSS_625(5)
-#define IVTV_SLICED_TYPE_VPS(7)
+/* Deprecated defines: applications should use the defines from videodev2.h */
+#define IVTV_SLICED_TYPE_TELETEXT_B V4L2_MPEG_VBI_IVTV_TELETEXT_B
+#define IVTV_SLICED_TYPE_CAPTION_525V4L2_MPEG_VBI_IVTV_CAPTION_525
+#define IVTV_SLICED_TYPE_WSS_625V4L2_MPEG_VBI_IVTV_WSS_625
+#define IVTV_SLICED_TYPE_VPSV4L2_MPEG_VBI_IVTV_VPS
 
 #endif /* _LINUX_IVTV_H */
diff -r 6f0889fda317 -r 39fdce10c0ea linux/include/linux/videodev2.h
--- a/linux/include/linux/videodev2.h   Mon Mar 02 10:40:52 2009 +0100
+++ b/linux/include/linux/videodev2.h   Wed Mar 18 11:35:10 2009 -0300
@@ -1346,6 +1346,53 @@ struct v4l2_sliced_vbi_data {
__u32   reserved;   /* must be 0 */
__u8data[48];
 };
+
+/*
+ * Sliced VBI data inserted into MPEG Streams
+ */
+
+/*
+ * V4L2_MPEG_STREAM_VBI_FMT_IVTV:
+ *
+ * Structure of payload contained in an MPEG 2 Private Stream 1 PES Packet in 
an
+ * MPEG-2 Program Pack that contains V4L2_MPEG_STREAM_VBI_FMT_IVTV Sliced VBI
+ * data
+ *
+ * Note, the MPEG-2 Program Pack and Private Stream 1 PES packet header
+ * definitions are not included here.  See the MPEG-2 specifications for 
details
+ * on these headers.
+ */
+
+/* Line type IDs */
+#define V4L2_MPEG_VBI_IVTV_TELETEXT_B (1)
+#define V4L2_MPEG_VBI_IVTV_CAPTION_525(4)
+#define V4L2_MPEG_VBI_IVTV_WSS_625(5)
+#define V4L2_MPEG_VBI_IVTV_VPS(7)
+
+struct v4l2_mpeg_vbi_itv0_line {
+   __u8 id;/* One of V4L2_MPEG_VBI_IVTV_* above */
+   __u8 data[42];  /* Sliced VBI data for the line */
+} __attribute__ ((packed));
+
+struct v4l2_mpeg_vbi_itv0 {
+   __le32 linemask[2]; /* Bitmasks of VBI service lines present */
+   struct v4l2_mpeg_vbi_itv0_line line[35];
+} __attribute__ ((packed));
+
+struct v4l2_mpeg_vbi_ITV0 {
+   struct v4l2_mpeg_vbi_itv0_line line[36];
+} __attribute__ ((packed));
+
+#define V4L2_MPEG_VBI_IVTV_MAGIC0  itv0
+#define V4L2_MPEG_VBI_IVTV_MAGIC1  ITV0
+
+struct v4l2_mpeg_vbi_fmt_ivtv {
+   __u8 magic[4];
+   union {
+   struct v4l2_mpeg_vbi_itv0 itv0;
+   struct v4l2_mpeg_vbi_ITV0 ITV0;
+   };
+} __attribute__ ((packed));
 
 /*
  * A G G R E G A T E   S T R U C T U R E S
diff -r 6f0889fda317 -r 39fdce10c0ea v4l2-spec/Makefile
--- a/v4l2-spec/MakefileMon Mar 02 10:40:52 2009 +0100
+++ b/v4l2-spec/MakefileWed Mar 18 11:35:10 2009 -0300
@@ -274,6 +274,7 @@ STRUCTS = \
v4l2_input \
v4l2_jpegcompression \
v4l2_modulator \
+   v4l2_mpeg_vbi_fmt_ivtv \
v4l2_output \
v4l2_outputparm \
v4l2_pix_format \
diff -r 6f0889fda317 -r 39fdce10c0ea v4l2-spec/dev-sliced-vbi.sgml
--- a/v4l2-spec/dev-sliced-vbi.sgml Mon Mar 02 10:40:52 2009 +0100
+++ b/v4l2-spec/dev-sliced-vbi.sgml Wed Mar 18 11:35:10 2009 -0300
@@ -48,7 +48,7 @@ supported./para
 supported./para
   /section
 
-  section
+  section id=sliced-vbi-format-negotitation
 titleSliced VBI Format Negotiation/title
 
 paraTo find out which data services are supported by the
@@ -386,6 +386,319 @@ video and VBI data by using buffer times
 
   /section
 
+  section
+titleSliced VBI Data in MPEG Streams/title
+
+paraIf a device can produce an MPEG output stream, it may be
+capable of providing link
+linkend=sliced-vbi-format-negotitationnegotiated sliced VBI
+services/link as data embedded in the MPEG stream.  Users or
+applications control this sliced VBI 

[linuxtv-commits] [hg:v4l-dvb] merge: http://linuxtv.org/hg/~awalls/v4l-dvb

2009-03-08 Thread Patch from Mauro Carvalho Chehab
The patch number 10857 was added via Mauro Carvalho Chehab mche...@redhat.com
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
Linux Media Mailing List linux-me...@vger.kernel.org

--

From: Mauro Carvalho Chehab  mche...@redhat.com
merge: http://linuxtv.org/hg/~awalls/v4l-dvb


commit  make  hg push

Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com


---

 linux/drivers/media/video/cx18/cx18-audio.c|1 
 linux/drivers/media/video/cx18/cx18-av-core.c  |   46 -
 linux/drivers/media/video/cx18/cx18-av-core.h  |   19 ---
 linux/drivers/media/video/cx18/cx18-av-vbi.c   |6 +-
 linux/drivers/media/video/cx18/cx18-controls.c |   42 +++
 linux/drivers/media/video/cx18/cx18-driver.c   |3 -
 linux/drivers/media/video/cx18/cx18-streams.c  |5 -
 linux/drivers/media/video/cx18/cx18-vbi.c  |9 +--
 8 files changed, 89 insertions(+), 42 deletions(-)

diff -r 4f0dae5b5afb -r 4552dc2948e0 linux/drivers/media/video/cx18/cx18-audio.c
--- a/linux/drivers/media/video/cx18/cx18-audio.c   Mon Mar 09 00:49:16 
2009 -0300
+++ b/linux/drivers/media/video/cx18/cx18-audio.c   Mon Mar 09 00:54:19 
2009 -0300
@@ -24,6 +24,7 @@
 #include cx18-driver.h
 #include cx18-io.h
 #include cx18-cards.h
+#include cx18-audio.h
 
 #define CX18_AUDIO_ENABLE 0xc72014
 
diff -r 4f0dae5b5afb -r 4552dc2948e0 
linux/drivers/media/video/cx18/cx18-av-core.c
--- a/linux/drivers/media/video/cx18/cx18-av-core.c Mon Mar 09 00:49:16 
2009 -0300
+++ b/linux/drivers/media/video/cx18/cx18-av-core.c Mon Mar 09 00:54:19 
2009 -0300
@@ -292,23 +292,29 @@ void cx18_av_std_setup(struct cx18 *cx)
 *
 * vsync: always 6 half-lines of vsync pulses
 * vactive:   half lines of active video
-* vblank656: half lines, after line 3, of blanked video
-* vblank:half lines, after line 9, of blanked video
+* vblank656: half lines, after line 3/mid-266, of blanked video
+* vblank:half lines, after line 9/272, of blanked video
 *
+* As far as I can tell:
 * vblank656 starts counting from the falling edge of the first
-*  vsync pulse (start of line 4)
+*  vsync pulse (start of line 4 or mid-266)
 * vblank starts counting from the after the 6 vsync pulses and
-*  6 equalization pulses (start of line 10)
+*  6 or 5 equalization pulses (start of line 10 or 272)
 *
 * For 525 line systems the driver will extract VBI information
-* from lines 10 through 21.  To avoid the EAV RP code from
-* toggling at the start of hblank at line 22, where sliced VBI
-* data from line 21 is stuffed, also treat line 22 as blanked.
+* from lines 10-21 and lines 273-284.
 */
-   vblank656 = 38; /* lines  4 through  22 */
-   vblank = 26;/* lines 10 through  22 */
-   vactive = 481;  /* lines 23 through 262.5 */
-
+   vblank656 = 38; /* lines  4 -  22266 - 284 */
+   vblank = 26;/* lines 10 -  22272 - 284 */
+   vactive = 481;  /* lines 23 - 263285 - 525 */
+
+   /*
+* For a 13.5 Mpps clock and 15,734.26 Hz line rate, a line is
+* is 858 pixels = 720 active + 138 blanking.  The Hsync leading
+* edge should happen 1.2 us * 13.5 Mpps ~= 16 pixels after the
+* end of active video, leaving 122 pixels of hblank to ignore
+* before active video starts.
+*/
hactive = 720;
hblank = 122;
luma_lpf = 1;
@@ -867,8 +873,22 @@ static int cx18_av_s_fmt(struct v4l2_sub
Hsrc = (cx18_av_read(cx, 0x472)  0x3f)  4;
Hsrc |= (cx18_av_read(cx, 0x471)  0xf0)  4;
 
-   Vlines = pix-height + (is_50Hz ? 4 : 7);
-
+   /*
+* This adjustment reflects the excess of vactive, set in
+* cx18_av_std_setup(), above standard values:
+*
+* 480 + 1 for 60 Hz systems
+* 576 + 4 for 50 Hz systems
+*/
+   Vlines = pix-height + (is_50Hz ? 4 : 1);
+
+   /*
+* Invalid height and width scaling requests are:
+* 1. width less than 1/16 of the source width
+* 2. width greater than the source width
+* 3. height less than 1/8 of the source height
+ 

[linuxtv-commits] [hg:v4l-dvb] merge: http://linuxtv.org/hg/~awalls/v4l-dvb

2008-12-17 Thread Patch from Mauro Carvalho Chehab
The patch number 9807 was added via Mauro Carvalho Chehab mche...@redhat.com
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
v4l-dvb-maintai...@linuxtv.org

--

From: Mauro Carvalho Chehab  mche...@redhat.com
merge: http://linuxtv.org/hg/~awalls/v4l-dvb


Priority: normal

Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com


---

 linux/drivers/media/video/cx18/cx18-av-vbi.c  |5 
 linux/drivers/media/video/cx18/cx18-cards.c   |8 
 linux/drivers/media/video/cx18/cx18-cards.h   |5 
 linux/drivers/media/video/cx18/cx18-driver.c  |  205 --
 linux/drivers/media/video/cx18/cx18-driver.h  |   22 +
 linux/drivers/media/video/cx18/cx18-dvb.c |4 
 linux/drivers/media/video/cx18/cx18-fileops.c |   37 +--
 linux/drivers/media/video/cx18/cx18-ioctl.c   |   14 -
 linux/drivers/media/video/cx18/cx18-mailbox.c |   26 --
 linux/drivers/media/video/cx18/cx18-queue.c   |   81 +++
 linux/drivers/media/video/cx18/cx18-queue.h   |   19 +
 linux/drivers/media/video/cx18/cx18-streams.c |  106 ++---
 linux/drivers/media/video/cx18/cx18-streams.h |3 
 linux/drivers/media/video/cx18/cx18-vbi.c |5 
 linux/drivers/media/video/cx18/cx18-version.h |2 
 15 files changed, 388 insertions(+), 154 deletions(-)

diff discarded since it is too big

---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/534afb274f2f4575675b6cbb58561cb00dcfaae8

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[linuxtv-commits] [hg:v4l-dvb] merge: http://linuxtv.org/hg/~awalls/v4l-dvb

2008-12-08 Thread Patch from Mauro Carvalho Chehab
The patch number 9779 was added via Mauro Carvalho Chehab [EMAIL PROTECTED]
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
[EMAIL PROTECTED]

--

From: Mauro Carvalho Chehab  [EMAIL PROTECTED]
merge: http://linuxtv.org/hg/~awalls/v4l-dvb


Signed-off-by: Mauro Carvalho Chehab [EMAIL PROTECTED]


---

 linux/drivers/media/video/cx18/cx18-driver.c  |   44 +-
 linux/drivers/media/video/cx18/cx18-driver.h  |2 
 linux/drivers/media/video/cx18/cx18-io.h  |6 ++
 linux/drivers/media/video/cx18/cx18-mailbox.c |2 
 v4l/versions.txt  |2 
 5 files changed, 30 insertions(+), 26 deletions(-)

diff -r e9fe49f4edf9 -r b744ab025ab6 
linux/drivers/media/video/cx18/cx18-driver.c
--- a/linux/drivers/media/video/cx18/cx18-driver.c  Mon Dec 08 11:36:57 
2008 -0200
+++ b/linux/drivers/media/video/cx18/cx18-driver.c  Mon Dec 08 18:40:34 
2008 -0200
@@ -55,9 +55,6 @@ struct cx18 *cx18_cards[CX18_MAX_CARDS];
 
 /* Protects cx18_cards_active */
 DEFINE_SPINLOCK(cx18_cards_lock);
-
-/* Queue for deferrable IRQ handling work for all cx18 cards in system */
-struct workqueue_struct *cx18_work_queue;
 
 /* add your revision and whatnot here */
 static struct pci_device_id cx18_pci_tbl[] __devinitdata = {
@@ -446,6 +443,12 @@ static int __devinit cx18_init_struct1(s
 
spin_lock_init(cx-lock);
 
+   cx-work_queue = create_singlethread_workqueue(cx-name);
+   if (cx-work_queue == NULL) {
+   CX18_ERR(Unable to create work hander thread\n);
+   return -ENOMEM;
+   }
+
for (i = 0; i  CX18_MAX_EPU_WORK_ORDERS; i++) {
cx-epu_work_order[i].cx = cx;
cx-epu_work_order[i].str = cx-epu_debug_str;
@@ -660,12 +663,9 @@ static int __devinit cx18_probe(struct p
 
/* PCI Device Setup */
retval = cx18_setup_pci(cx, dev, pci_id);
-   if (retval != 0) {
-   if (retval == -EIO)
-   goto free_workqueue;
-   else if (retval == -ENXIO)
-   goto free_mem;
-   }
+   if (retval != 0)
+   goto free_workqueue;
+
/* save cx in the pci struct for later use */
pci_set_drvdata(dev, cx);
 
@@ -835,6 +835,7 @@ free_mem:
 free_mem:
release_mem_region(cx-base_addr, CX18_MEM_SIZE);
 free_workqueue:
+   destroy_workqueue(cx-work_queue);
 err:
if (retval == 0)
retval = -ENODEV;
@@ -917,6 +918,7 @@ int cx18_init_on_first_open(struct cx18 
return 0;
 }
 
+#if LINUX_VERSION_CODE = KERNEL_VERSION(2, 6, 22)
 static void cx18_cancel_epu_work_orders(struct cx18 *cx)
 {
int i;
@@ -924,6 +926,7 @@ static void cx18_cancel_epu_work_orders(
cancel_work_sync(cx-epu_work_order[i].work);
 }
 
+#endif
 static void cx18_remove(struct pci_dev *pci_dev)
 {
struct cx18 *cx = pci_get_drvdata(pci_dev);
@@ -937,11 +940,22 @@ static void cx18_remove(struct pci_dev *
 
/* Interrupts */
cx18_sw1_irq_disable(cx, IRQ_CPU_TO_EPU | IRQ_APU_TO_EPU);
+#if LINUX_VERSION_CODE = KERNEL_VERSION(2, 6, 22)
cx18_sw2_irq_disable(cx, IRQ_CPU_TO_EPU_ACK | IRQ_APU_TO_EPU_ACK);
 
cx18_halt_firmware(cx);
 
cx18_cancel_epu_work_orders(cx);
+#else
+
+   flush_workqueue(cx-work_queue);
+
+   cx18_sw2_irq_disable(cx, IRQ_CPU_TO_EPU_ACK | IRQ_APU_TO_EPU_ACK);
+
+   cx18_halt_firmware(cx);
+#endif
+
+   destroy_workqueue(cx-work_queue);
 
cx18_streams_cleanup(cx, 1);
 
@@ -984,17 +998,8 @@ static int module_start(void)
printk(KERN_INFO cx18:   Debug value must be = 0 and = 
511!\n);
}
 
-   cx18_work_queue = create_singlethread_workqueue(cx18);
-   if (cx18_work_queue == NULL) {
-   printk(KERN_ERR
-  cx18:   Unable to create work hander thread\n);
-   return -ENOMEM;
-   }
-
if (pci_register_driver(cx18_pci_driver)) {
printk(KERN_ERR cx18:   Error detecting PCI card\n);
-   destroy_workqueue(cx18_work_queue);
-   cx18_work_queue = NULL;
return -ENODEV;
}
printk(KERN_INFO cx18:  End initialization\n);
@@ -1006,9 +1011,6 @@ static void module_cleanup(void)
int i;
 
pci_unregister_driver(cx18_pci_driver);
-
-   destroy_workqueue(cx18_work_queue);
-   cx18_work_queue = NULL;
 
for (i = 0; i  cx18_cards_active; i++) {
if (cx18_cards[i] == NULL)
diff -r e9fe49f4edf9 -r b744ab025ab6 
linux/drivers/media/video/cx18/cx18-driver.h
--- a/linux/drivers/media/video/cx18/cx18-driver.h  Mon Dec 08 11:36:57 
2008 -0200
+++ 

[linuxtv-commits] [hg:v4l-dvb] merge: http://linuxtv.org/hg/~awalls/v4l-dvb

2008-08-29 Thread Patch from Mauro Carvalho Chehab
The patch number 8775 was added via Mauro Carvalho Chehab [EMAIL PROTECTED]
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
[EMAIL PROTECTED]

--

From: Mauro Carvalho Chehab  [EMAIL PROTECTED]
merge: http://linuxtv.org/hg/~awalls/v4l-dvb




Signed-off-by: Mauro Carvalho Chehab [EMAIL PROTECTED]


---

 linux/drivers/media/video/cx18/cx18-driver.h  |6 
 linux/drivers/media/video/cx18/cx18-fileops.c |   51 +--
 linux/drivers/media/video/cx18/cx18-ioctl.c   |   20 ++
 linux/drivers/media/video/cx18/cx18-mailbox.c |1 
 linux/drivers/media/video/cx18/cx18-queue.c   |  122 +++---
 linux/drivers/media/video/cx18/cx18-streams.c |   21 ++-
 linux/drivers/media/video/cx18/cx23418.h  |2 
 7 files changed, 95 insertions(+), 128 deletions(-)

diff -r b3f843ea3306 -r 308121fcdc32 
linux/drivers/media/video/cx18/cx18-driver.h
--- a/linux/drivers/media/video/cx18/cx18-driver.h  Fri Aug 29 14:46:21 
2008 -0300
+++ b/linux/drivers/media/video/cx18/cx18-driver.h  Fri Aug 29 14:50:35 
2008 -0300
@@ -216,8 +216,7 @@ struct cx18_buffer {
 
 struct cx18_queue {
struct list_head list;
-   u32 buffers;
-   u32 length;
+   atomic_t buffers;
u32 bytesused;
 };
 
@@ -237,6 +236,8 @@ struct cx18; /* forward reference */
 struct cx18;/* forward reference */
 struct cx18_scb; /* forward reference */
 
+#define CX18_INVALID_TASK_HANDLE 0x
+
 struct cx18_stream {
/* These first four fields are always set, even if the stream
   is not actually created. */
@@ -259,7 +260,6 @@ struct cx18_stream {
/* Buffer Stats */
u32 buffers;
u32 buf_size;
-   u32 buffers_stolen;
 
/* Buffer Queues */
struct cx18_queue q_free;   /* free buffers */
diff -r b3f843ea3306 -r 308121fcdc32 
linux/drivers/media/video/cx18/cx18-fileops.c
--- a/linux/drivers/media/video/cx18/cx18-fileops.c Fri Aug 29 14:46:21 
2008 -0300
+++ b/linux/drivers/media/video/cx18/cx18-fileops.c Fri Aug 29 14:50:35 
2008 -0300
@@ -132,6 +132,7 @@ static void cx18_dualwatch(struct cx18 *
u16 new_stereo_mode;
const u16 stereo_mask = 0x0300;
const u16 dual = 0x0200;
+   u32 h;
 
new_stereo_mode = cx-params.audio_properties  stereo_mask;
memset(vt, 0, sizeof(vt));
@@ -143,13 +144,21 @@ static void cx18_dualwatch(struct cx18 *
if (new_stereo_mode == cx-dualwatch_stereo_mode)
return;
 
-   new_bitmap = new_stereo_mode | (cx-params.audio_properties  
~stereo_mask);
-
-   CX18_DEBUG_INFO(dualwatch: change stereo flag from 0x%x to 0x%x. new 
audio_bitmask=0x%ux\n,
-  cx-dualwatch_stereo_mode, new_stereo_mode, 
new_bitmap);
-
-   if (cx18_vapi(cx, CX18_CPU_SET_AUDIO_PARAMETERS, 2,
-   cx18_find_handle(cx), new_bitmap) == 0) {
+   new_bitmap = new_stereo_mode
+   | (cx-params.audio_properties  ~stereo_mask);
+
+   CX18_DEBUG_INFO(dualwatch: change stereo flag from 0x%x to 0x%x. 
+   new audio_bitmask=0x%ux\n,
+   cx-dualwatch_stereo_mode, new_stereo_mode, new_bitmap);
+
+   h = cx18_find_handle(cx);
+   if (h == CX18_INVALID_TASK_HANDLE) {
+   CX18_DEBUG_INFO(dualwatch: can't find valid task handle\n);
+   return;
+   }
+
+   if (cx18_vapi(cx,
+ CX18_CPU_SET_AUDIO_PARAMETERS, 2, h, new_bitmap) == 0) {
cx-dualwatch_stereo_mode = new_stereo_mode;
return;
}
@@ -258,7 +267,7 @@ static struct cx18_buffer *cx18_get_buff
prepare_to_wait(s-waitq, wait, TASK_INTERRUPTIBLE);
/* New buffers might have become available before we were added
   to the waitqueue */
-   if (!s-q_full.buffers)
+   if (!atomic_read(s-q_full.buffers))
schedule();
finish_wait(s-waitq, wait);
if (signal_pending(current)) {
@@ -544,7 +553,7 @@ unsigned int cx18_v4l2_enc_poll(struct f
CX18_DEBUG_HI_FILE(Encoder poll\n);
poll_wait(filp, s-waitq, wait);
 
-   if (s-q_full.length || s-q_io.length)
+   if (atomic_read(s-q_full.buffers) || atomic_read(s-q_io.buffers))
return POLLIN | POLLRDNORM;
if (eof)
return POLLHUP;
@@ -730,20 +739,28 @@ int cx18_v4l2_open(struct inode *inode, 
 
 void cx18_mute(struct cx18 *cx)
 {
-   if (atomic_read(cx-ana_capturing))
-   cx18_vapi(cx, CX18_CPU_SET_AUDIO_MUTE, 2,
-   cx18_find_handle(cx), 1);
+   u32 h;
+   if 

[linuxtv-commits] [hg:v4l-dvb] merge: http://linuxtv.org/hg/~awalls/v4l-dvb-critical

2008-08-22 Thread Patch from Mauro Carvalho Chehab
The patch number 8702 was added via Mauro Carvalho Chehab [EMAIL PROTECTED]
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
[EMAIL PROTECTED]

--

From: Mauro Carvalho Chehab  [EMAIL PROTECTED]
merge: http://linuxtv.org/hg/~awalls/v4l-dvb-critical




Signed-off-by: Mauro Carvalho Chehab [EMAIL PROTECTED]


---

 linux/drivers/media/video/cx18/cx18-irq.c   |2 -
 linux/drivers/media/video/cx18/cx18-queue.c |   23 +++-
 linux/drivers/media/video/cx18/cx18-queue.h |2 -
 3 files changed, 15 insertions(+), 12 deletions(-)

diff -r ba53c96b4b19 -r 0c912139c932 linux/drivers/media/video/cx18/cx18-irq.c
--- a/linux/drivers/media/video/cx18/cx18-irq.c Fri Aug 22 10:02:43 2008 -0300
+++ b/linux/drivers/media/video/cx18/cx18-irq.c Fri Aug 22 10:09:25 2008 -0300
@@ -61,7 +61,7 @@ static void epu_dma_done(struct cx18 *cx
CX18_WARN(Ack struct = %d for %s\n,
mb-args[2], s-name);
id = read_enc(off);
-   buf = cx18_queue_find_buf(s, id, read_enc(off + 4));
+   buf = cx18_queue_get_buf_irq(s, id, read_enc(off + 4));
CX18_DEBUG_HI_DMA(DMA DONE for %s (buffer %d)\n, s-name, id);
if (buf) {
cx18_buf_sync_for_cpu(s, buf);
diff -r ba53c96b4b19 -r 0c912139c932 linux/drivers/media/video/cx18/cx18-queue.c
--- a/linux/drivers/media/video/cx18/cx18-queue.c   Fri Aug 22 10:02:43 
2008 -0300
+++ b/linux/drivers/media/video/cx18/cx18-queue.c   Fri Aug 22 10:09:25 
2008 -0300
@@ -78,12 +78,13 @@ struct cx18_buffer *cx18_dequeue(struct 
return buf;
 }
 
-struct cx18_buffer *cx18_queue_find_buf(struct cx18_stream *s, u32 id,
+struct cx18_buffer *cx18_queue_get_buf_irq(struct cx18_stream *s, u32 id,
u32 bytesused)
 {
struct cx18 *cx = s-cx;
struct list_head *p;
 
+   spin_lock(s-qlock);
list_for_each(p, s-q_free.list) {
struct cx18_buffer *buf =
list_entry(p, struct cx18_buffer, list);
@@ -92,17 +93,19 @@ struct cx18_buffer *cx18_queue_find_buf(
continue;
buf-bytesused = bytesused;
/* the transport buffers are handled differently,
-  so there is no need to move them to the full queue */
-   if (s-type == CX18_ENC_STREAM_TYPE_TS)
-   return buf;
-   s-q_free.buffers--;
-   s-q_free.length -= s-buf_size;
-   s-q_full.buffers++;
-   s-q_full.length += s-buf_size;
-   s-q_full.bytesused += buf-bytesused;
-   list_move_tail(buf-list, s-q_full.list);
+  they are not moved to the full queue */
+   if (s-type != CX18_ENC_STREAM_TYPE_TS) {
+   s-q_free.buffers--;
+   s-q_free.length -= s-buf_size;
+   s-q_full.buffers++;
+   s-q_full.length += s-buf_size;
+   s-q_full.bytesused += buf-bytesused;
+   list_move_tail(buf-list, s-q_full.list);
+   }
+   spin_unlock(s-qlock);
return buf;
}
+   spin_unlock(s-qlock);
CX18_ERR(Cannot find buffer %d for stream %s\n, id, s-name);
return NULL;
 }
diff -r ba53c96b4b19 -r 0c912139c932 linux/drivers/media/video/cx18/cx18-queue.h
--- a/linux/drivers/media/video/cx18/cx18-queue.h   Fri Aug 22 10:02:43 
2008 -0300
+++ b/linux/drivers/media/video/cx18/cx18-queue.h   Fri Aug 22 10:09:25 
2008 -0300
@@ -46,7 +46,7 @@ void cx18_enqueue(struct cx18_stream *s,
 void cx18_enqueue(struct cx18_stream *s, struct cx18_buffer *buf,
struct cx18_queue *q);
 struct cx18_buffer *cx18_dequeue(struct cx18_stream *s, struct cx18_queue *q);
-struct cx18_buffer *cx18_queue_find_buf(struct cx18_stream *s, u32 id,
+struct cx18_buffer *cx18_queue_get_buf_irq(struct cx18_stream *s, u32 id,
u32 bytesused);
 void cx18_flush_queues(struct cx18_stream *s);
 


---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/0c912139c93289f84f5a75f0fbe8457dfbeaa85b

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits