aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/usb
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2013-01-24 06:47:48 -0500
committerIngo Molnar <mingo@kernel.org>2013-01-24 06:47:48 -0500
commitbefddb21c845f8fb49e637997891ef97c6a869dc (patch)
tree0e7629123184f2dd50291ad6d477b894175f0f26 /drivers/media/usb
parente716efde75267eab919cdb2bef5b2cb77f305326 (diff)
parent7d1f9aeff1ee4a20b1aeb377dd0f579fe9647619 (diff)
Merge tag 'v3.8-rc4' into irq/core
Merge Linux 3.8-rc4 before pulling in new commits - we were on an old v3.7 base. Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'drivers/media/usb')
-rw-r--r--drivers/media/usb/au0828/au0828-cards.c2
-rw-r--r--drivers/media/usb/au0828/au0828-dvb.c5
-rw-r--r--drivers/media/usb/au0828/au0828-video.c16
-rw-r--r--drivers/media/usb/cx231xx/cx231xx-avcore.c9
-rw-r--r--drivers/media/usb/cx231xx/cx231xx-cards.c8
-rw-r--r--drivers/media/usb/cx231xx/cx231xx-i2c.c4
-rw-r--r--drivers/media/usb/cx231xx/cx231xx-input.c2
-rw-r--r--drivers/media/usb/dvb-usb-v2/af9015.c2
-rw-r--r--drivers/media/usb/dvb-usb-v2/af9035.c4
-rw-r--r--drivers/media/usb/dvb-usb-v2/anysee.c4
-rw-r--r--drivers/media/usb/dvb-usb-v2/az6007.c2
-rw-r--r--drivers/media/usb/dvb-usb-v2/dvb_usb.h2
-rw-r--r--drivers/media/usb/dvb-usb-v2/dvb_usb_core.c25
-rw-r--r--drivers/media/usb/dvb-usb-v2/dvb_usb_urb.c4
-rw-r--r--drivers/media/usb/dvb-usb-v2/it913x.c12
-rw-r--r--drivers/media/usb/dvb-usb-v2/lmedm04.c4
-rw-r--r--drivers/media/usb/dvb-usb-v2/rtl28xxu.c10
-rw-r--r--drivers/media/usb/dvb-usb-v2/usb_urb.c8
-rw-r--r--drivers/media/usb/dvb-usb/az6027.c11
-rw-r--r--drivers/media/usb/dvb-usb/dib0700.h2
-rw-r--r--drivers/media/usb/dvb-usb/dib0700_core.c16
-rw-r--r--drivers/media/usb/dvb-usb/dib0700_devices.c146
-rw-r--r--drivers/media/usb/dvb-usb/dvb-usb.h2
-rw-r--r--drivers/media/usb/dvb-usb/pctv452e.c4
-rw-r--r--drivers/media/usb/dvb-usb/technisat-usb2.c2
-rw-r--r--drivers/media/usb/dvb-usb/ttusb2.c2
-rw-r--r--drivers/media/usb/dvb-usb/vp702x.c8
-rw-r--r--drivers/media/usb/em28xx/em28xx-cards.c15
-rw-r--r--drivers/media/usb/em28xx/em28xx-dvb.c84
-rw-r--r--drivers/media/usb/em28xx/em28xx-input.c16
-rw-r--r--drivers/media/usb/em28xx/em28xx.h1
-rw-r--r--drivers/media/usb/gspca/gspca.c3
-rw-r--r--drivers/media/usb/gspca/gspca.h2
-rw-r--r--drivers/media/usb/gspca/jeilinj.c6
-rw-r--r--drivers/media/usb/gspca/m5602/m5602_s5k4aa.c6
-rw-r--r--drivers/media/usb/gspca/pac7302.c62
-rw-r--r--drivers/media/usb/gspca/sonixb.c1
-rw-r--r--drivers/media/usb/gspca/spca506.c3
-rw-r--r--drivers/media/usb/hdpvr/hdpvr-core.c2
-rw-r--r--drivers/media/usb/hdpvr/hdpvr-i2c.c2
-rw-r--r--drivers/media/usb/pvrusb2/pvrusb2-hdw.c6
-rw-r--r--drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c4
-rw-r--r--drivers/media/usb/pvrusb2/pvrusb2-v4l2.c4
-rw-r--r--drivers/media/usb/pwc/pwc-ctrl.c2
-rw-r--r--drivers/media/usb/pwc/pwc-if.c8
-rw-r--r--drivers/media/usb/s2255/s2255drv.c2
-rw-r--r--drivers/media/usb/siano/Kconfig3
-rw-r--r--drivers/media/usb/siano/smsusb.c2
-rw-r--r--drivers/media/usb/sn9c102/sn9c102_core.c2
-rw-r--r--drivers/media/usb/stk1160/stk1160-i2c.c2
-rw-r--r--drivers/media/usb/stk1160/stk1160-video.c23
-rw-r--r--drivers/media/usb/stk1160/stk1160.h5
-rw-r--r--drivers/media/usb/stkwebcam/stk-webcam.c5
-rw-r--r--drivers/media/usb/tlg2300/pd-dvb.c1
-rw-r--r--drivers/media/usb/tlg2300/pd-video.c4
-rw-r--r--drivers/media/usb/tm6000/tm6000-input.c20
-rw-r--r--drivers/media/usb/tm6000/tm6000-video.c1
-rw-r--r--drivers/media/usb/usbvision/usbvision-video.c10
-rw-r--r--drivers/media/usb/usbvision/usbvision.h2
-rw-r--r--drivers/media/usb/uvc/uvc_ctrl.c10
-rw-r--r--drivers/media/usb/uvc/uvc_driver.c10
-rw-r--r--drivers/media/usb/uvc/uvc_entity.c2
-rw-r--r--drivers/media/usb/uvc/uvc_queue.c2
-rw-r--r--drivers/media/usb/uvc/uvc_v4l2.c77
-rw-r--r--drivers/media/usb/uvc/uvc_video.c1
-rw-r--r--drivers/media/usb/uvc/uvcvideo.h8
-rw-r--r--drivers/media/usb/zr364xx/zr364xx.c3
67 files changed, 490 insertions, 248 deletions
diff --git a/drivers/media/usb/au0828/au0828-cards.c b/drivers/media/usb/au0828/au0828-cards.c
index 448361c6a13e..0cb7c28dcb17 100644
--- a/drivers/media/usb/au0828/au0828-cards.c
+++ b/drivers/media/usb/au0828/au0828-cards.c
@@ -25,7 +25,7 @@
25#include "media/tuner.h" 25#include "media/tuner.h"
26#include "media/v4l2-common.h" 26#include "media/v4l2-common.h"
27 27
28void hvr950q_cs5340_audio(void *priv, int enable) 28static void hvr950q_cs5340_audio(void *priv, int enable)
29{ 29{
30 /* Because the HVR-950q shares an i2s bus between the cs5340 and the 30 /* Because the HVR-950q shares an i2s bus between the cs5340 and the
31 au8522, we need to hold cs5340 in reset when using the au8522 */ 31 au8522, we need to hold cs5340 in reset when using the au8522 */
diff --git a/drivers/media/usb/au0828/au0828-dvb.c b/drivers/media/usb/au0828/au0828-dvb.c
index b328f6550d0b..9a6f15613a38 100644
--- a/drivers/media/usb/au0828/au0828-dvb.c
+++ b/drivers/media/usb/au0828/au0828-dvb.c
@@ -272,7 +272,6 @@ static void au0828_restart_dvb_streaming(struct work_struct *work)
272 struct au0828_dev *dev = container_of(work, struct au0828_dev, 272 struct au0828_dev *dev = container_of(work, struct au0828_dev,
273 restart_streaming); 273 restart_streaming);
274 struct au0828_dvb *dvb = &dev->dvb; 274 struct au0828_dvb *dvb = &dev->dvb;
275 int ret;
276 275
277 if (dev->urb_streaming == 0) 276 if (dev->urb_streaming == 0)
278 return; 277 return;
@@ -282,7 +281,7 @@ static void au0828_restart_dvb_streaming(struct work_struct *work)
282 mutex_lock(&dvb->lock); 281 mutex_lock(&dvb->lock);
283 282
284 /* Stop transport */ 283 /* Stop transport */
285 ret = stop_urb_transfer(dev); 284 stop_urb_transfer(dev);
286 au0828_write(dev, 0x608, 0x00); 285 au0828_write(dev, 0x608, 0x00);
287 au0828_write(dev, 0x609, 0x00); 286 au0828_write(dev, 0x609, 0x00);
288 au0828_write(dev, 0x60a, 0x00); 287 au0828_write(dev, 0x60a, 0x00);
@@ -293,7 +292,7 @@ static void au0828_restart_dvb_streaming(struct work_struct *work)
293 au0828_write(dev, 0x609, 0x72); 292 au0828_write(dev, 0x609, 0x72);
294 au0828_write(dev, 0x60a, 0x71); 293 au0828_write(dev, 0x60a, 0x71);
295 au0828_write(dev, 0x60b, 0x01); 294 au0828_write(dev, 0x60b, 0x01);
296 ret = start_urb_transfer(dev); 295 start_urb_transfer(dev);
297 296
298 mutex_unlock(&dvb->lock); 297 mutex_unlock(&dvb->lock);
299} 298}
diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c
index 870585570571..45387aab10c7 100644
--- a/drivers/media/usb/au0828/au0828-video.c
+++ b/drivers/media/usb/au0828/au0828-video.c
@@ -158,7 +158,7 @@ static void au0828_irq_callback(struct urb *urb)
158/* 158/*
159 * Stop and Deallocate URBs 159 * Stop and Deallocate URBs
160 */ 160 */
161void au0828_uninit_isoc(struct au0828_dev *dev) 161static void au0828_uninit_isoc(struct au0828_dev *dev)
162{ 162{
163 struct urb *urb; 163 struct urb *urb;
164 int i; 164 int i;
@@ -197,9 +197,9 @@ void au0828_uninit_isoc(struct au0828_dev *dev)
197/* 197/*
198 * Allocate URBs and start IRQ 198 * Allocate URBs and start IRQ
199 */ 199 */
200int au0828_init_isoc(struct au0828_dev *dev, int max_packets, 200static int au0828_init_isoc(struct au0828_dev *dev, int max_packets,
201 int num_bufs, int max_pkt_size, 201 int num_bufs, int max_pkt_size,
202 int (*isoc_copy) (struct au0828_dev *dev, struct urb *urb)) 202 int (*isoc_copy) (struct au0828_dev *dev, struct urb *urb))
203{ 203{
204 struct au0828_dmaqueue *dma_q = &dev->vidq; 204 struct au0828_dmaqueue *dma_q = &dev->vidq;
205 int i; 205 int i;
@@ -783,7 +783,7 @@ static int au0828_i2s_init(struct au0828_dev *dev)
783 * Auvitek au0828 analog stream enable 783 * Auvitek au0828 analog stream enable
784 * Please set interface0 to AS5 before enable the stream 784 * Please set interface0 to AS5 before enable the stream
785 */ 785 */
786int au0828_analog_stream_enable(struct au0828_dev *d) 786static int au0828_analog_stream_enable(struct au0828_dev *d)
787{ 787{
788 dprintk(1, "au0828_analog_stream_enable called\n"); 788 dprintk(1, "au0828_analog_stream_enable called\n");
789 au0828_writereg(d, AU0828_SENSORCTRL_VBI_103, 0x00); 789 au0828_writereg(d, AU0828_SENSORCTRL_VBI_103, 0x00);
@@ -810,7 +810,7 @@ int au0828_analog_stream_disable(struct au0828_dev *d)
810 return 0; 810 return 0;
811} 811}
812 812
813void au0828_analog_stream_reset(struct au0828_dev *dev) 813static void au0828_analog_stream_reset(struct au0828_dev *dev)
814{ 814{
815 dprintk(1, "au0828_analog_stream_reset called\n"); 815 dprintk(1, "au0828_analog_stream_reset called\n");
816 au0828_writereg(dev, AU0828_SENSORCTRL_100, 0x0); 816 au0828_writereg(dev, AU0828_SENSORCTRL_100, 0x0);
@@ -913,7 +913,7 @@ static int get_ressource(struct au0828_fh *fh)
913/* This function ensures that video frames continue to be delivered even if 913/* This function ensures that video frames continue to be delivered even if
914 the ITU-656 input isn't receiving any data (thereby preventing applications 914 the ITU-656 input isn't receiving any data (thereby preventing applications
915 such as tvtime from hanging) */ 915 such as tvtime from hanging) */
916void au0828_vid_buffer_timeout(unsigned long data) 916static void au0828_vid_buffer_timeout(unsigned long data)
917{ 917{
918 struct au0828_dev *dev = (struct au0828_dev *) data; 918 struct au0828_dev *dev = (struct au0828_dev *) data;
919 struct au0828_dmaqueue *dma_q = &dev->vidq; 919 struct au0828_dmaqueue *dma_q = &dev->vidq;
@@ -937,7 +937,7 @@ void au0828_vid_buffer_timeout(unsigned long data)
937 spin_unlock_irqrestore(&dev->slock, flags); 937 spin_unlock_irqrestore(&dev->slock, flags);
938} 938}
939 939
940void au0828_vbi_buffer_timeout(unsigned long data) 940static void au0828_vbi_buffer_timeout(unsigned long data)
941{ 941{
942 struct au0828_dev *dev = (struct au0828_dev *) data; 942 struct au0828_dev *dev = (struct au0828_dev *) data;
943 struct au0828_dmaqueue *dma_q = &dev->vbiq; 943 struct au0828_dmaqueue *dma_q = &dev->vbiq;
diff --git a/drivers/media/usb/cx231xx/cx231xx-avcore.c b/drivers/media/usb/cx231xx/cx231xx-avcore.c
index 447148eff958..722207913740 100644
--- a/drivers/media/usb/cx231xx/cx231xx-avcore.c
+++ b/drivers/media/usb/cx231xx/cx231xx-avcore.c
@@ -1068,12 +1068,12 @@ int cx231xx_unmute_audio(struct cx231xx *dev)
1068} 1068}
1069EXPORT_SYMBOL_GPL(cx231xx_unmute_audio); 1069EXPORT_SYMBOL_GPL(cx231xx_unmute_audio);
1070 1070
1071int stopAudioFirmware(struct cx231xx *dev) 1071static int stopAudioFirmware(struct cx231xx *dev)
1072{ 1072{
1073 return vid_blk_write_byte(dev, DL_CTL_CONTROL, 0x03); 1073 return vid_blk_write_byte(dev, DL_CTL_CONTROL, 0x03);
1074} 1074}
1075 1075
1076int restartAudioFirmware(struct cx231xx *dev) 1076static int restartAudioFirmware(struct cx231xx *dev)
1077{ 1077{
1078 return vid_blk_write_byte(dev, DL_CTL_CONTROL, 0x13); 1078 return vid_blk_write_byte(dev, DL_CTL_CONTROL, 0x13);
1079} 1079}
@@ -2631,11 +2631,6 @@ int cx231xx_capture_start(struct cx231xx *dev, int start, u8 media_type)
2631 rc = cx231xx_stop_stream(dev, ep_mask); 2631 rc = cx231xx_stop_stream(dev, ep_mask);
2632 } 2632 }
2633 2633
2634 if (dev->mode == CX231XX_ANALOG_MODE)
2635 ;/* do any in Analog mode */
2636 else
2637 ;/* do any in digital mode */
2638
2639 return rc; 2634 return rc;
2640} 2635}
2641EXPORT_SYMBOL_GPL(cx231xx_capture_start); 2636EXPORT_SYMBOL_GPL(cx231xx_capture_start);
diff --git a/drivers/media/usb/cx231xx/cx231xx-cards.c b/drivers/media/usb/cx231xx/cx231xx-cards.c
index b84ebc54d91b..bbed1e40eeda 100644
--- a/drivers/media/usb/cx231xx/cx231xx-cards.c
+++ b/drivers/media/usb/cx231xx/cx231xx-cards.c
@@ -686,7 +686,7 @@ int cx231xx_tuner_callback(void *ptr, int component, int command, int arg)
686} 686}
687EXPORT_SYMBOL_GPL(cx231xx_tuner_callback); 687EXPORT_SYMBOL_GPL(cx231xx_tuner_callback);
688 688
689void cx231xx_reset_out(struct cx231xx *dev) 689static void cx231xx_reset_out(struct cx231xx *dev)
690{ 690{
691 cx231xx_set_gpio_value(dev, CX23417_RESET, 1); 691 cx231xx_set_gpio_value(dev, CX23417_RESET, 1);
692 msleep(200); 692 msleep(200);
@@ -694,11 +694,13 @@ void cx231xx_reset_out(struct cx231xx *dev)
694 msleep(200); 694 msleep(200);
695 cx231xx_set_gpio_value(dev, CX23417_RESET, 1); 695 cx231xx_set_gpio_value(dev, CX23417_RESET, 1);
696} 696}
697void cx231xx_enable_OSC(struct cx231xx *dev) 697
698static void cx231xx_enable_OSC(struct cx231xx *dev)
698{ 699{
699 cx231xx_set_gpio_value(dev, CX23417_OSC_EN, 1); 700 cx231xx_set_gpio_value(dev, CX23417_OSC_EN, 1);
700} 701}
701void cx231xx_sleep_s5h1432(struct cx231xx *dev) 702
703static void cx231xx_sleep_s5h1432(struct cx231xx *dev)
702{ 704{
703 cx231xx_set_gpio_value(dev, SLEEP_S5H1432, 0); 705 cx231xx_set_gpio_value(dev, SLEEP_S5H1432, 0);
704} 706}
diff --git a/drivers/media/usb/cx231xx/cx231xx-i2c.c b/drivers/media/usb/cx231xx/cx231xx-i2c.c
index 781feed406f7..96a5a0965399 100644
--- a/drivers/media/usb/cx231xx/cx231xx-i2c.c
+++ b/drivers/media/usb/cx231xx/cx231xx-i2c.c
@@ -72,8 +72,8 @@ static inline bool is_tuner(struct cx231xx *dev, struct cx231xx_i2c *bus,
72/* 72/*
73 * cx231xx_i2c_send_bytes() 73 * cx231xx_i2c_send_bytes()
74 */ 74 */
75int cx231xx_i2c_send_bytes(struct i2c_adapter *i2c_adap, 75static int cx231xx_i2c_send_bytes(struct i2c_adapter *i2c_adap,
76 const struct i2c_msg *msg) 76 const struct i2c_msg *msg)
77{ 77{
78 struct cx231xx_i2c *bus = i2c_adap->algo_data; 78 struct cx231xx_i2c *bus = i2c_adap->algo_data;
79 struct cx231xx *dev = bus->dev; 79 struct cx231xx *dev = bus->dev;
diff --git a/drivers/media/usb/cx231xx/cx231xx-input.c b/drivers/media/usb/cx231xx/cx231xx-input.c
index 96176e9db5a2..0f7b42446826 100644
--- a/drivers/media/usb/cx231xx/cx231xx-input.c
+++ b/drivers/media/usb/cx231xx/cx231xx-input.c
@@ -99,7 +99,7 @@ int cx231xx_ir_init(struct cx231xx *dev)
99 /* The i2c micro-controller only outputs the cmd part of NEC protocol */ 99 /* The i2c micro-controller only outputs the cmd part of NEC protocol */
100 dev->init_data.rc_dev->scanmask = 0xff; 100 dev->init_data.rc_dev->scanmask = 0xff;
101 dev->init_data.rc_dev->driver_name = "cx231xx"; 101 dev->init_data.rc_dev->driver_name = "cx231xx";
102 dev->init_data.type = RC_TYPE_NEC; 102 dev->init_data.type = RC_BIT_NEC;
103 info.addr = 0x30; 103 info.addr = 0x30;
104 104
105 /* Load and bind ir-kbd-i2c */ 105 /* Load and bind ir-kbd-i2c */
diff --git a/drivers/media/usb/dvb-usb-v2/af9015.c b/drivers/media/usb/dvb-usb-v2/af9015.c
index 3d7526e28d42..943d93423705 100644
--- a/drivers/media/usb/dvb-usb-v2/af9015.c
+++ b/drivers/media/usb/dvb-usb-v2/af9015.c
@@ -1306,7 +1306,7 @@ static int af9015_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc)
1306 if (!rc->map_name) 1306 if (!rc->map_name)
1307 rc->map_name = RC_MAP_EMPTY; 1307 rc->map_name = RC_MAP_EMPTY;
1308 1308
1309 rc->allowed_protos = RC_TYPE_NEC; 1309 rc->allowed_protos = RC_BIT_NEC;
1310 rc->query = af9015_rc_query; 1310 rc->query = af9015_rc_query;
1311 rc->interval = 500; 1311 rc->interval = 500;
1312 1312
diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c
index ea27eaff4e34..61ae7f9d0b27 100644
--- a/drivers/media/usb/dvb-usb-v2/af9035.c
+++ b/drivers/media/usb/dvb-usb-v2/af9035.c
@@ -1023,10 +1023,10 @@ static int af9035_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc)
1023 switch (tmp) { 1023 switch (tmp) {
1024 case 0: /* NEC */ 1024 case 0: /* NEC */
1025 default: 1025 default:
1026 rc->allowed_protos = RC_TYPE_NEC; 1026 rc->allowed_protos = RC_BIT_NEC;
1027 break; 1027 break;
1028 case 1: /* RC6 */ 1028 case 1: /* RC6 */
1029 rc->allowed_protos = RC_TYPE_RC6; 1029 rc->allowed_protos = RC_BIT_RC6_MCE;
1030 break; 1030 break;
1031 } 1031 }
1032 1032
diff --git a/drivers/media/usb/dvb-usb-v2/anysee.c b/drivers/media/usb/dvb-usb-v2/anysee.c
index ec540140c810..d05c5b563dac 100644
--- a/drivers/media/usb/dvb-usb-v2/anysee.c
+++ b/drivers/media/usb/dvb-usb-v2/anysee.c
@@ -1048,7 +1048,7 @@ static int anysee_rc_query(struct dvb_usb_device *d)
1048 1048
1049static int anysee_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc) 1049static int anysee_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc)
1050{ 1050{
1051 rc->allowed_protos = RC_TYPE_NEC; 1051 rc->allowed_protos = RC_BIT_NEC;
1052 rc->query = anysee_rc_query; 1052 rc->query = anysee_rc_query;
1053 rc->interval = 250; /* windows driver uses 500ms */ 1053 rc->interval = 250; /* windows driver uses 500ms */
1054 1054
@@ -1170,7 +1170,7 @@ static int anysee_ci_poll_slot_status(struct dvb_ca_en50221 *ci, int slot,
1170 struct dvb_usb_device *d = ci->data; 1170 struct dvb_usb_device *d = ci->data;
1171 struct anysee_state *state = d_to_priv(d); 1171 struct anysee_state *state = d_to_priv(d);
1172 int ret; 1172 int ret;
1173 u8 tmp; 1173 u8 tmp = 0;
1174 1174
1175 ret = anysee_rd_reg_mask(d, REG_IOC, &tmp, 0x40); 1175 ret = anysee_rd_reg_mask(d, REG_IOC, &tmp, 0x40);
1176 if (ret) 1176 if (ret)
diff --git a/drivers/media/usb/dvb-usb-v2/az6007.c b/drivers/media/usb/dvb-usb-v2/az6007.c
index 54f1221d930d..d75dbf27e99e 100644
--- a/drivers/media/usb/dvb-usb-v2/az6007.c
+++ b/drivers/media/usb/dvb-usb-v2/az6007.c
@@ -826,7 +826,7 @@ static int az6007_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc)
826{ 826{
827 pr_debug("Getting az6007 Remote Control properties\n"); 827 pr_debug("Getting az6007 Remote Control properties\n");
828 828
829 rc->allowed_protos = RC_TYPE_NEC; 829 rc->allowed_protos = RC_BIT_NEC;
830 rc->query = az6007_rc_query; 830 rc->query = az6007_rc_query;
831 rc->interval = 400; 831 rc->interval = 400;
832 832
diff --git a/drivers/media/usb/dvb-usb-v2/dvb_usb.h b/drivers/media/usb/dvb-usb-v2/dvb_usb.h
index bae16a1189d6..059291b892b8 100644
--- a/drivers/media/usb/dvb-usb-v2/dvb_usb.h
+++ b/drivers/media/usb/dvb-usb-v2/dvb_usb.h
@@ -137,7 +137,7 @@ struct dvb_usb_driver_info {
137struct dvb_usb_rc { 137struct dvb_usb_rc {
138 const char *map_name; 138 const char *map_name;
139 u64 allowed_protos; 139 u64 allowed_protos;
140 int (*change_protocol)(struct rc_dev *dev, u64 rc_type); 140 int (*change_protocol)(struct rc_dev *dev, u64 *rc_type);
141 int (*query) (struct dvb_usb_device *d); 141 int (*query) (struct dvb_usb_device *d);
142 unsigned int interval; 142 unsigned int interval;
143 const enum rc_driver_type driver_type; 143 const enum rc_driver_type driver_type;
diff --git a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c
index 9859d2a2449b..671b4fa232b4 100644
--- a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c
+++ b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c
@@ -224,7 +224,7 @@ static void dvb_usb_data_complete_raw(struct usb_data_stream *stream, u8 *buf,
224 dvb_dmx_swfilter_raw(&adap->demux, buf, len); 224 dvb_dmx_swfilter_raw(&adap->demux, buf, len);
225} 225}
226 226
227int dvb_usbv2_adapter_stream_init(struct dvb_usb_adapter *adap) 227static int dvb_usbv2_adapter_stream_init(struct dvb_usb_adapter *adap)
228{ 228{
229 dev_dbg(&adap_to_d(adap)->udev->dev, "%s: adap=%d\n", __func__, 229 dev_dbg(&adap_to_d(adap)->udev->dev, "%s: adap=%d\n", __func__,
230 adap->id); 230 adap->id);
@@ -236,7 +236,7 @@ int dvb_usbv2_adapter_stream_init(struct dvb_usb_adapter *adap)
236 return usb_urb_initv2(&adap->stream, &adap->props->stream); 236 return usb_urb_initv2(&adap->stream, &adap->props->stream);
237} 237}
238 238
239int dvb_usbv2_adapter_stream_exit(struct dvb_usb_adapter *adap) 239static int dvb_usbv2_adapter_stream_exit(struct dvb_usb_adapter *adap)
240{ 240{
241 dev_dbg(&adap_to_d(adap)->udev->dev, "%s: adap=%d\n", __func__, 241 dev_dbg(&adap_to_d(adap)->udev->dev, "%s: adap=%d\n", __func__,
242 adap->id); 242 adap->id);
@@ -283,14 +283,13 @@ static inline int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed,
283 283
284 /* activate the pid on the device pid filter */ 284 /* activate the pid on the device pid filter */
285 if (adap->props->caps & DVB_USB_ADAP_HAS_PID_FILTER && 285 if (adap->props->caps & DVB_USB_ADAP_HAS_PID_FILTER &&
286 adap->pid_filtering && 286 adap->pid_filtering && adap->props->pid_filter) {
287 adap->props->pid_filter)
288 ret = adap->props->pid_filter(adap, dvbdmxfeed->index, 287 ret = adap->props->pid_filter(adap, dvbdmxfeed->index,
289 dvbdmxfeed->pid, (count == 1) ? 1 : 0); 288 dvbdmxfeed->pid, (count == 1) ? 1 : 0);
290 if (ret < 0) 289 if (ret < 0)
291 dev_err(&d->udev->dev, "%s: pid_filter() " \ 290 dev_err(&d->udev->dev, "%s: pid_filter() failed=%d\n",
292 "failed=%d\n", KBUILD_MODNAME, 291 KBUILD_MODNAME, ret);
293 ret); 292 }
294 293
295 /* start feeding if it is first pid */ 294 /* start feeding if it is first pid */
296 if (adap->feed_count == 1 && count == 1) { 295 if (adap->feed_count == 1 && count == 1) {
@@ -369,7 +368,7 @@ static int dvb_usb_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
369 return dvb_usb_ctrl_feed(dvbdmxfeed, -1); 368 return dvb_usb_ctrl_feed(dvbdmxfeed, -1);
370} 369}
371 370
372int dvb_usbv2_adapter_dvb_init(struct dvb_usb_adapter *adap) 371static int dvb_usbv2_adapter_dvb_init(struct dvb_usb_adapter *adap)
373{ 372{
374 int ret; 373 int ret;
375 struct dvb_usb_device *d = adap_to_d(adap); 374 struct dvb_usb_device *d = adap_to_d(adap);
@@ -441,7 +440,7 @@ err_dvb_register_adapter:
441 return ret; 440 return ret;
442} 441}
443 442
444int dvb_usbv2_adapter_dvb_exit(struct dvb_usb_adapter *adap) 443static int dvb_usbv2_adapter_dvb_exit(struct dvb_usb_adapter *adap)
445{ 444{
446 dev_dbg(&adap_to_d(adap)->udev->dev, "%s: adap=%d\n", __func__, 445 dev_dbg(&adap_to_d(adap)->udev->dev, "%s: adap=%d\n", __func__,
447 adap->id); 446 adap->id);
@@ -457,7 +456,7 @@ int dvb_usbv2_adapter_dvb_exit(struct dvb_usb_adapter *adap)
457 return 0; 456 return 0;
458} 457}
459 458
460int dvb_usbv2_device_power_ctrl(struct dvb_usb_device *d, int onoff) 459static int dvb_usbv2_device_power_ctrl(struct dvb_usb_device *d, int onoff)
461{ 460{
462 int ret; 461 int ret;
463 462
@@ -554,7 +553,7 @@ err:
554 return ret; 553 return ret;
555} 554}
556 555
557int dvb_usbv2_adapter_frontend_init(struct dvb_usb_adapter *adap) 556static int dvb_usbv2_adapter_frontend_init(struct dvb_usb_adapter *adap)
558{ 557{
559 int ret, i, count_registered = 0; 558 int ret, i, count_registered = 0;
560 struct dvb_usb_device *d = adap_to_d(adap); 559 struct dvb_usb_device *d = adap_to_d(adap);
@@ -623,7 +622,7 @@ err:
623 return ret; 622 return ret;
624} 623}
625 624
626int dvb_usbv2_adapter_frontend_exit(struct dvb_usb_adapter *adap) 625static int dvb_usbv2_adapter_frontend_exit(struct dvb_usb_adapter *adap)
627{ 626{
628 int i; 627 int i;
629 dev_dbg(&adap_to_d(adap)->udev->dev, "%s: adap=%d\n", __func__, 628 dev_dbg(&adap_to_d(adap)->udev->dev, "%s: adap=%d\n", __func__,
diff --git a/drivers/media/usb/dvb-usb-v2/dvb_usb_urb.c b/drivers/media/usb/dvb-usb-v2/dvb_usb_urb.c
index 0431beed0ef4..5716662b4834 100644
--- a/drivers/media/usb/dvb-usb-v2/dvb_usb_urb.c
+++ b/drivers/media/usb/dvb-usb-v2/dvb_usb_urb.c
@@ -32,9 +32,7 @@ int dvb_usbv2_generic_rw(struct dvb_usb_device *d, u8 *wbuf, u16 wlen, u8 *rbuf,
32 return -EINVAL; 32 return -EINVAL;
33 } 33 }
34 34
35 ret = mutex_lock_interruptible(&d->usb_mutex); 35 mutex_lock(&d->usb_mutex);
36 if (ret < 0)
37 return ret;
38 36
39 dev_dbg(&d->udev->dev, "%s: >>> %*ph\n", __func__, wlen, wbuf); 37 dev_dbg(&d->udev->dev, "%s: >>> %*ph\n", __func__, wlen, wbuf);
40 38
diff --git a/drivers/media/usb/dvb-usb-v2/it913x.c b/drivers/media/usb/dvb-usb-v2/it913x.c
index 695f9106bc54..47204280b8b3 100644
--- a/drivers/media/usb/dvb-usb-v2/it913x.c
+++ b/drivers/media/usb/dvb-usb-v2/it913x.c
@@ -659,13 +659,19 @@ static int it913x_frontend_attach(struct dvb_usb_adapter *adap)
659 it913x_wr_reg(d, DEV_0_DMOD, MP2IF2_SW_RST, 0x1); 659 it913x_wr_reg(d, DEV_0_DMOD, MP2IF2_SW_RST, 0x1);
660 it913x_wr_reg(d, DEV_0, EP0_TX_EN, 0x0f); 660 it913x_wr_reg(d, DEV_0, EP0_TX_EN, 0x0f);
661 it913x_wr_reg(d, DEV_0, EP0_TX_NAK, 0x1b); 661 it913x_wr_reg(d, DEV_0, EP0_TX_NAK, 0x1b);
662 it913x_wr_reg(d, DEV_0, EP0_TX_EN, 0x2f); 662 if (st->proprietary_ir == false) /* Enable endpoint 3 */
663 it913x_wr_reg(d, DEV_0, EP0_TX_EN, 0x3f);
664 else
665 it913x_wr_reg(d, DEV_0, EP0_TX_EN, 0x2f);
663 it913x_wr_reg(d, DEV_0, EP4_TX_LEN_LSB, 666 it913x_wr_reg(d, DEV_0, EP4_TX_LEN_LSB,
664 ep_size & 0xff); 667 ep_size & 0xff);
665 it913x_wr_reg(d, DEV_0, EP4_TX_LEN_MSB, ep_size >> 8); 668 it913x_wr_reg(d, DEV_0, EP4_TX_LEN_MSB, ep_size >> 8);
666 ret = it913x_wr_reg(d, DEV_0, EP4_MAX_PKT, pkt_size); 669 ret = it913x_wr_reg(d, DEV_0, EP4_MAX_PKT, pkt_size);
667 } else if (adap->id == 1 && adap->fe[0]) { 670 } else if (adap->id == 1 && adap->fe[0]) {
668 it913x_wr_reg(d, DEV_0, EP0_TX_EN, 0x6f); 671 if (st->proprietary_ir == false)
672 it913x_wr_reg(d, DEV_0, EP0_TX_EN, 0x7f);
673 else
674 it913x_wr_reg(d, DEV_0, EP0_TX_EN, 0x6f);
669 it913x_wr_reg(d, DEV_0, EP5_TX_LEN_LSB, 675 it913x_wr_reg(d, DEV_0, EP5_TX_LEN_LSB,
670 ep_size & 0xff); 676 ep_size & 0xff);
671 it913x_wr_reg(d, DEV_0, EP5_TX_LEN_MSB, ep_size >> 8); 677 it913x_wr_reg(d, DEV_0, EP5_TX_LEN_MSB, ep_size >> 8);
@@ -698,7 +704,7 @@ static int it913x_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc)
698 return 0; 704 return 0;
699 } 705 }
700 706
701 rc->allowed_protos = RC_TYPE_NEC; 707 rc->allowed_protos = RC_BIT_NEC;
702 rc->query = it913x_rc_query; 708 rc->query = it913x_rc_query;
703 rc->interval = 250; 709 rc->interval = 250;
704 710
diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c
index c41d9d9ec7b5..6427ac359f21 100644
--- a/drivers/media/usb/dvb-usb-v2/lmedm04.c
+++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c
@@ -799,7 +799,7 @@ static const char fw_c_rs2000[] = LME2510_C_RS2000;
799static const char fw_lg[] = LME2510_LG; 799static const char fw_lg[] = LME2510_LG;
800static const char fw_s0194[] = LME2510_S0194; 800static const char fw_s0194[] = LME2510_S0194;
801 801
802const char *lme_firmware_switch(struct dvb_usb_device *d, int cold) 802static const char *lme_firmware_switch(struct dvb_usb_device *d, int cold)
803{ 803{
804 struct lme2510_state *st = d->priv; 804 struct lme2510_state *st = d->priv;
805 struct usb_device *udev = d->udev; 805 struct usb_device *udev = d->udev;
@@ -1253,7 +1253,7 @@ static int lme2510_get_stream_config(struct dvb_frontend *fe, u8 *ts_type,
1253static int lme2510_get_rc_config(struct dvb_usb_device *d, 1253static int lme2510_get_rc_config(struct dvb_usb_device *d,
1254 struct dvb_usb_rc *rc) 1254 struct dvb_usb_rc *rc)
1255{ 1255{
1256 rc->allowed_protos = RC_TYPE_NEC; 1256 rc->allowed_protos = RC_BIT_NEC;
1257 return 0; 1257 return 0;
1258} 1258}
1259 1259
diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
index adabba8d28bc..a4c302d0aa37 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
@@ -1197,7 +1197,7 @@ static int rtl2831u_get_rc_config(struct dvb_usb_device *d,
1197 struct dvb_usb_rc *rc) 1197 struct dvb_usb_rc *rc)
1198{ 1198{
1199 rc->map_name = RC_MAP_EMPTY; 1199 rc->map_name = RC_MAP_EMPTY;
1200 rc->allowed_protos = RC_TYPE_NEC; 1200 rc->allowed_protos = RC_BIT_NEC;
1201 rc->query = rtl2831u_rc_query; 1201 rc->query = rtl2831u_rc_query;
1202 rc->interval = 400; 1202 rc->interval = 400;
1203 1203
@@ -1269,7 +1269,7 @@ static int rtl2832u_get_rc_config(struct dvb_usb_device *d,
1269 struct dvb_usb_rc *rc) 1269 struct dvb_usb_rc *rc)
1270{ 1270{
1271 rc->map_name = RC_MAP_EMPTY; 1271 rc->map_name = RC_MAP_EMPTY;
1272 rc->allowed_protos = RC_TYPE_NEC; 1272 rc->allowed_protos = RC_BIT_NEC;
1273 rc->query = rtl2832u_rc_query; 1273 rc->query = rtl2832u_rc_query;
1274 rc->interval = 400; 1274 rc->interval = 400;
1275 1275
@@ -1338,6 +1338,8 @@ static const struct usb_device_id rtl28xxu_id_table[] = {
1338 &rtl2832u_props, "G-Tek Electronics Group Lifeview LV5TDLX DVB-T", NULL) }, 1338 &rtl2832u_props, "G-Tek Electronics Group Lifeview LV5TDLX DVB-T", NULL) },
1339 { DVB_USB_DEVICE(USB_VID_TERRATEC, USB_PID_NOXON_DAB_STICK, 1339 { DVB_USB_DEVICE(USB_VID_TERRATEC, USB_PID_NOXON_DAB_STICK,
1340 &rtl2832u_props, "NOXON DAB/DAB+ USB dongle", NULL) }, 1340 &rtl2832u_props, "NOXON DAB/DAB+ USB dongle", NULL) },
1341 { DVB_USB_DEVICE(USB_VID_TERRATEC, USB_PID_NOXON_DAB_STICK_REV2,
1342 &rtl2832u_props, "NOXON DAB/DAB+ USB dongle (rev 2)", NULL) },
1341 { DVB_USB_DEVICE(USB_VID_GTEK, USB_PID_TREKSTOR_TERRES_2_0, 1343 { DVB_USB_DEVICE(USB_VID_GTEK, USB_PID_TREKSTOR_TERRES_2_0,
1342 &rtl2832u_props, "Trekstor DVB-T Stick Terres 2.0", NULL) }, 1344 &rtl2832u_props, "Trekstor DVB-T Stick Terres 2.0", NULL) },
1343 { DVB_USB_DEVICE(USB_VID_DEXATEK, 0x1101, 1345 { DVB_USB_DEVICE(USB_VID_DEXATEK, 0x1101,
@@ -1346,6 +1348,10 @@ static const struct usb_device_id rtl28xxu_id_table[] = {
1346 &rtl2832u_props, "DigitalNow Quad DVB-T Receiver", NULL) }, 1348 &rtl2832u_props, "DigitalNow Quad DVB-T Receiver", NULL) },
1347 { DVB_USB_DEVICE(USB_VID_TERRATEC, 0x00d3, 1349 { DVB_USB_DEVICE(USB_VID_TERRATEC, 0x00d3,
1348 &rtl2832u_props, "TerraTec Cinergy T Stick RC (Rev. 3)", NULL) }, 1350 &rtl2832u_props, "TerraTec Cinergy T Stick RC (Rev. 3)", NULL) },
1351 { DVB_USB_DEVICE(USB_VID_DEXATEK, 0x1102,
1352 &rtl2832u_props, "Dexatek DK mini DVB-T Dongle", NULL) },
1353 { DVB_USB_DEVICE(USB_VID_TERRATEC, 0x00d7,
1354 &rtl2832u_props, "TerraTec Cinergy T Stick+", NULL) },
1349 { } 1355 { }
1350}; 1356};
1351MODULE_DEVICE_TABLE(usb, rtl28xxu_id_table); 1357MODULE_DEVICE_TABLE(usb, rtl28xxu_id_table);
diff --git a/drivers/media/usb/dvb-usb-v2/usb_urb.c b/drivers/media/usb/dvb-usb-v2/usb_urb.c
index 5989b6590377..7346f85f3f2f 100644
--- a/drivers/media/usb/dvb-usb-v2/usb_urb.c
+++ b/drivers/media/usb/dvb-usb-v2/usb_urb.c
@@ -112,7 +112,7 @@ int usb_urb_submitv2(struct usb_data_stream *stream,
112 return 0; 112 return 0;
113} 113}
114 114
115int usb_urb_free_urbs(struct usb_data_stream *stream) 115static int usb_urb_free_urbs(struct usb_data_stream *stream)
116{ 116{
117 int i; 117 int i;
118 118
@@ -205,7 +205,7 @@ static int usb_urb_alloc_isoc_urbs(struct usb_data_stream *stream)
205 return 0; 205 return 0;
206} 206}
207 207
208int usb_free_stream_buffers(struct usb_data_stream *stream) 208static int usb_free_stream_buffers(struct usb_data_stream *stream)
209{ 209{
210 if (stream->state & USB_STATE_URB_BUF) { 210 if (stream->state & USB_STATE_URB_BUF) {
211 while (stream->buf_num) { 211 while (stream->buf_num) {
@@ -223,8 +223,8 @@ int usb_free_stream_buffers(struct usb_data_stream *stream)
223 return 0; 223 return 0;
224} 224}
225 225
226int usb_alloc_stream_buffers(struct usb_data_stream *stream, int num, 226static int usb_alloc_stream_buffers(struct usb_data_stream *stream, int num,
227 unsigned long size) 227 unsigned long size)
228{ 228{
229 stream->buf_num = 0; 229 stream->buf_num = 0;
230 stream->buf_size = size; 230 stream->buf_size = size;
diff --git a/drivers/media/usb/dvb-usb/az6027.c b/drivers/media/usb/dvb-usb/az6027.c
index 5e45ae605427..91e0119e8a87 100644
--- a/drivers/media/usb/dvb-usb/az6027.c
+++ b/drivers/media/usb/dvb-usb/az6027.c
@@ -298,7 +298,8 @@ struct stb6100_config az6027_stb6100_config = {
298 298
299 299
300/* check for mutex FIXME */ 300/* check for mutex FIXME */
301int az6027_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen) 301static int az6027_usb_in_op(struct dvb_usb_device *d, u8 req,
302 u16 value, u16 index, u8 *b, int blen)
302{ 303{
303 int ret = -1; 304 int ret = -1;
304 if (mutex_lock_interruptible(&d->usb_mutex)) 305 if (mutex_lock_interruptible(&d->usb_mutex))
@@ -1051,10 +1052,10 @@ static struct i2c_algorithm az6027_i2c_algo = {
1051 .functionality = az6027_i2c_func, 1052 .functionality = az6027_i2c_func,
1052}; 1053};
1053 1054
1054int az6027_identify_state(struct usb_device *udev, 1055static int az6027_identify_state(struct usb_device *udev,
1055 struct dvb_usb_device_properties *props, 1056 struct dvb_usb_device_properties *props,
1056 struct dvb_usb_device_description **desc, 1057 struct dvb_usb_device_description **desc,
1057 int *cold) 1058 int *cold)
1058{ 1059{
1059 u8 *b; 1060 u8 *b;
1060 s16 ret; 1061 s16 ret;
diff --git a/drivers/media/usb/dvb-usb/dib0700.h b/drivers/media/usb/dvb-usb/dib0700.h
index 7de125c0b36f..637b6123f391 100644
--- a/drivers/media/usb/dvb-usb/dib0700.h
+++ b/drivers/media/usb/dvb-usb/dib0700.h
@@ -64,7 +64,7 @@ extern int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff);
64extern struct i2c_algorithm dib0700_i2c_algo; 64extern struct i2c_algorithm dib0700_i2c_algo;
65extern int dib0700_identify_state(struct usb_device *udev, struct dvb_usb_device_properties *props, 65extern int dib0700_identify_state(struct usb_device *udev, struct dvb_usb_device_properties *props,
66 struct dvb_usb_device_description **desc, int *cold); 66 struct dvb_usb_device_description **desc, int *cold);
67extern int dib0700_change_protocol(struct rc_dev *dev, u64 rc_type); 67extern int dib0700_change_protocol(struct rc_dev *dev, u64 *rc_type);
68extern int dib0700_set_i2c_speed(struct dvb_usb_device *d, u16 scl_kHz); 68extern int dib0700_set_i2c_speed(struct dvb_usb_device *d, u16 scl_kHz);
69 69
70extern int dib0700_device_count; 70extern int dib0700_device_count;
diff --git a/drivers/media/usb/dvb-usb/dib0700_core.c b/drivers/media/usb/dvb-usb/dib0700_core.c
index ef87229de6af..19b5ed2825d7 100644
--- a/drivers/media/usb/dvb-usb/dib0700_core.c
+++ b/drivers/media/usb/dvb-usb/dib0700_core.c
@@ -605,7 +605,7 @@ int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
605 return ret; 605 return ret;
606} 606}
607 607
608int dib0700_change_protocol(struct rc_dev *rc, u64 rc_type) 608int dib0700_change_protocol(struct rc_dev *rc, u64 *rc_type)
609{ 609{
610 struct dvb_usb_device *d = rc->priv; 610 struct dvb_usb_device *d = rc->priv;
611 struct dib0700_state *st = d->priv; 611 struct dib0700_state *st = d->priv;
@@ -621,17 +621,19 @@ int dib0700_change_protocol(struct rc_dev *rc, u64 rc_type)
621 st->buf[2] = 0; 621 st->buf[2] = 0;
622 622
623 /* Set the IR mode */ 623 /* Set the IR mode */
624 if (rc_type == RC_TYPE_RC5) 624 if (*rc_type & RC_BIT_RC5) {
625 new_proto = 1; 625 new_proto = 1;
626 else if (rc_type == RC_TYPE_NEC) 626 *rc_type = RC_BIT_RC5;
627 } else if (*rc_type & RC_BIT_NEC) {
627 new_proto = 0; 628 new_proto = 0;
628 else if (rc_type == RC_TYPE_RC6) { 629 *rc_type = RC_BIT_NEC;
630 } else if (*rc_type & RC_BIT_RC6_MCE) {
629 if (st->fw_version < 0x10200) { 631 if (st->fw_version < 0x10200) {
630 ret = -EINVAL; 632 ret = -EINVAL;
631 goto out; 633 goto out;
632 } 634 }
633
634 new_proto = 2; 635 new_proto = 2;
636 *rc_type = RC_BIT_RC6_MCE;
635 } else { 637 } else {
636 ret = -EINVAL; 638 ret = -EINVAL;
637 goto out; 639 goto out;
@@ -645,7 +647,7 @@ int dib0700_change_protocol(struct rc_dev *rc, u64 rc_type)
645 goto out; 647 goto out;
646 } 648 }
647 649
648 d->props.rc.core.protocol = rc_type; 650 d->props.rc.core.protocol = *rc_type;
649 651
650out: 652out:
651 mutex_unlock(&d->usb_mutex); 653 mutex_unlock(&d->usb_mutex);
@@ -707,7 +709,7 @@ static void dib0700_rc_urb_completion(struct urb *purb)
707 purb->actual_length); 709 purb->actual_length);
708 710
709 switch (d->props.rc.core.protocol) { 711 switch (d->props.rc.core.protocol) {
710 case RC_TYPE_NEC: 712 case RC_BIT_NEC:
711 toggle = 0; 713 toggle = 0;
712 714
713 /* NEC protocol sends repeat code as 0 0 0 FF */ 715 /* NEC protocol sends repeat code as 0 0 0 FF */
diff --git a/drivers/media/usb/dvb-usb/dib0700_devices.c b/drivers/media/usb/dvb-usb/dib0700_devices.c
index 510001da6e83..11798426fa88 100644
--- a/drivers/media/usb/dvb-usb/dib0700_devices.c
+++ b/drivers/media/usb/dvb-usb/dib0700_devices.c
@@ -518,7 +518,7 @@ static int dib0700_rc_query_old_firmware(struct dvb_usb_device *d)
518 518
519 d->last_event = 0; 519 d->last_event = 0;
520 switch (d->props.rc.core.protocol) { 520 switch (d->props.rc.core.protocol) {
521 case RC_TYPE_NEC: 521 case RC_BIT_NEC:
522 /* NEC protocol sends repeat code as 0 0 0 FF */ 522 /* NEC protocol sends repeat code as 0 0 0 FF */
523 if ((key[3-2] == 0x00) && (key[3-3] == 0x00) && 523 if ((key[3-2] == 0x00) && (key[3-3] == 0x00) &&
524 (key[3] == 0xff)) 524 (key[3] == 0xff))
@@ -3658,9 +3658,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
3658 .rc_interval = DEFAULT_RC_INTERVAL, 3658 .rc_interval = DEFAULT_RC_INTERVAL,
3659 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 3659 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3660 .rc_query = dib0700_rc_query_old_firmware, 3660 .rc_query = dib0700_rc_query_old_firmware,
3661 .allowed_protos = RC_TYPE_RC5 | 3661 .allowed_protos = RC_BIT_RC5 |
3662 RC_TYPE_RC6 | 3662 RC_BIT_RC6_MCE |
3663 RC_TYPE_NEC, 3663 RC_BIT_NEC,
3664 .change_protocol = dib0700_change_protocol, 3664 .change_protocol = dib0700_change_protocol,
3665 }, 3665 },
3666 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 3666 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -3698,9 +3698,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
3698 .rc_interval = DEFAULT_RC_INTERVAL, 3698 .rc_interval = DEFAULT_RC_INTERVAL,
3699 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 3699 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3700 .rc_query = dib0700_rc_query_old_firmware, 3700 .rc_query = dib0700_rc_query_old_firmware,
3701 .allowed_protos = RC_TYPE_RC5 | 3701 .allowed_protos = RC_BIT_RC5 |
3702 RC_TYPE_RC6 | 3702 RC_BIT_RC6_MCE |
3703 RC_TYPE_NEC, 3703 RC_BIT_NEC,
3704 .change_protocol = dib0700_change_protocol, 3704 .change_protocol = dib0700_change_protocol,
3705 }, 3705 },
3706 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 3706 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -3763,9 +3763,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
3763 .rc_interval = DEFAULT_RC_INTERVAL, 3763 .rc_interval = DEFAULT_RC_INTERVAL,
3764 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 3764 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3765 .rc_query = dib0700_rc_query_old_firmware, 3765 .rc_query = dib0700_rc_query_old_firmware,
3766 .allowed_protos = RC_TYPE_RC5 | 3766 .allowed_protos = RC_BIT_RC5 |
3767 RC_TYPE_RC6 | 3767 RC_BIT_RC6_MCE |
3768 RC_TYPE_NEC, 3768 RC_BIT_NEC,
3769 .change_protocol = dib0700_change_protocol, 3769 .change_protocol = dib0700_change_protocol,
3770 }, 3770 },
3771 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 3771 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -3808,9 +3808,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
3808 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 3808 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3809 .module_name = "dib0700", 3809 .module_name = "dib0700",
3810 .rc_query = dib0700_rc_query_old_firmware, 3810 .rc_query = dib0700_rc_query_old_firmware,
3811 .allowed_protos = RC_TYPE_RC5 | 3811 .allowed_protos = RC_BIT_RC5 |
3812 RC_TYPE_RC6 | 3812 RC_BIT_RC6_MCE |
3813 RC_TYPE_NEC, 3813 RC_BIT_NEC,
3814 .change_protocol = dib0700_change_protocol, 3814 .change_protocol = dib0700_change_protocol,
3815 }, 3815 },
3816 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 3816 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -3890,9 +3890,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
3890 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 3890 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3891 .module_name = "dib0700", 3891 .module_name = "dib0700",
3892 .rc_query = dib0700_rc_query_old_firmware, 3892 .rc_query = dib0700_rc_query_old_firmware,
3893 .allowed_protos = RC_TYPE_RC5 | 3893 .allowed_protos = RC_BIT_RC5 |
3894 RC_TYPE_RC6 | 3894 RC_BIT_RC6_MCE |
3895 RC_TYPE_NEC, 3895 RC_BIT_NEC,
3896 .change_protocol = dib0700_change_protocol, 3896 .change_protocol = dib0700_change_protocol,
3897 }, 3897 },
3898 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 3898 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -3936,9 +3936,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
3936 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 3936 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3937 .module_name = "dib0700", 3937 .module_name = "dib0700",
3938 .rc_query = dib0700_rc_query_old_firmware, 3938 .rc_query = dib0700_rc_query_old_firmware,
3939 .allowed_protos = RC_TYPE_RC5 | 3939 .allowed_protos = RC_BIT_RC5 |
3940 RC_TYPE_RC6 | 3940 RC_BIT_RC6_MCE |
3941 RC_TYPE_NEC, 3941 RC_BIT_NEC,
3942 .change_protocol = dib0700_change_protocol, 3942 .change_protocol = dib0700_change_protocol,
3943 }, 3943 },
3944 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 3944 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -3987,9 +3987,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
3987 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 3987 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3988 .module_name = "dib0700", 3988 .module_name = "dib0700",
3989 .rc_query = dib0700_rc_query_old_firmware, 3989 .rc_query = dib0700_rc_query_old_firmware,
3990 .allowed_protos = RC_TYPE_RC5 | 3990 .allowed_protos = RC_BIT_RC5 |
3991 RC_TYPE_RC6 | 3991 RC_BIT_RC6_MCE |
3992 RC_TYPE_NEC, 3992 RC_BIT_NEC,
3993 .change_protocol = dib0700_change_protocol, 3993 .change_protocol = dib0700_change_protocol,
3994 }, 3994 },
3995 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 3995 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -4055,9 +4055,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
4055 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 4055 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4056 .module_name = "dib0700", 4056 .module_name = "dib0700",
4057 .rc_query = dib0700_rc_query_old_firmware, 4057 .rc_query = dib0700_rc_query_old_firmware,
4058 .allowed_protos = RC_TYPE_RC5 | 4058 .allowed_protos = RC_BIT_RC5 |
4059 RC_TYPE_RC6 | 4059 RC_BIT_RC6_MCE |
4060 RC_TYPE_NEC, 4060 RC_BIT_NEC,
4061 .change_protocol = dib0700_change_protocol, 4061 .change_protocol = dib0700_change_protocol,
4062 }, 4062 },
4063 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 4063 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -4106,9 +4106,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
4106 .rc_codes = RC_MAP_DIB0700_NEC_TABLE, 4106 .rc_codes = RC_MAP_DIB0700_NEC_TABLE,
4107 .module_name = "dib0700", 4107 .module_name = "dib0700",
4108 .rc_query = dib0700_rc_query_old_firmware, 4108 .rc_query = dib0700_rc_query_old_firmware,
4109 .allowed_protos = RC_TYPE_RC5 | 4109 .allowed_protos = RC_BIT_RC5 |
4110 RC_TYPE_RC6 | 4110 RC_BIT_RC6_MCE |
4111 RC_TYPE_NEC, 4111 RC_BIT_NEC,
4112 .change_protocol = dib0700_change_protocol, 4112 .change_protocol = dib0700_change_protocol,
4113 }, 4113 },
4114 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 4114 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -4177,9 +4177,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
4177 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 4177 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4178 .module_name = "dib0700", 4178 .module_name = "dib0700",
4179 .rc_query = dib0700_rc_query_old_firmware, 4179 .rc_query = dib0700_rc_query_old_firmware,
4180 .allowed_protos = RC_TYPE_RC5 | 4180 .allowed_protos = RC_BIT_RC5 |
4181 RC_TYPE_RC6 | 4181 RC_BIT_RC6_MCE |
4182 RC_TYPE_NEC, 4182 RC_BIT_NEC,
4183 .change_protocol = dib0700_change_protocol, 4183 .change_protocol = dib0700_change_protocol,
4184 }, 4184 },
4185 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 4185 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -4215,9 +4215,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
4215 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 4215 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4216 .module_name = "dib0700", 4216 .module_name = "dib0700",
4217 .rc_query = dib0700_rc_query_old_firmware, 4217 .rc_query = dib0700_rc_query_old_firmware,
4218 .allowed_protos = RC_TYPE_RC5 | 4218 .allowed_protos = RC_BIT_RC5 |
4219 RC_TYPE_RC6 | 4219 RC_BIT_RC6_MCE |
4220 RC_TYPE_NEC, 4220 RC_BIT_NEC,
4221 .change_protocol = dib0700_change_protocol, 4221 .change_protocol = dib0700_change_protocol,
4222 }, 4222 },
4223 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 4223 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -4295,9 +4295,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
4295 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 4295 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4296 .module_name = "dib0700", 4296 .module_name = "dib0700",
4297 .rc_query = dib0700_rc_query_old_firmware, 4297 .rc_query = dib0700_rc_query_old_firmware,
4298 .allowed_protos = RC_TYPE_RC5 | 4298 .allowed_protos = RC_BIT_RC5 |
4299 RC_TYPE_RC6 | 4299 RC_BIT_RC6_MCE |
4300 RC_TYPE_NEC, 4300 RC_BIT_NEC,
4301 .change_protocol = dib0700_change_protocol, 4301 .change_protocol = dib0700_change_protocol,
4302 }, 4302 },
4303 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 4303 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -4341,9 +4341,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
4341 .rc_codes = RC_MAP_DIB0700_NEC_TABLE, 4341 .rc_codes = RC_MAP_DIB0700_NEC_TABLE,
4342 .module_name = "dib0700", 4342 .module_name = "dib0700",
4343 .rc_query = dib0700_rc_query_old_firmware, 4343 .rc_query = dib0700_rc_query_old_firmware,
4344 .allowed_protos = RC_TYPE_RC5 | 4344 .allowed_protos = RC_BIT_RC5 |
4345 RC_TYPE_RC6 | 4345 RC_BIT_RC6_MCE |
4346 RC_TYPE_NEC, 4346 RC_BIT_NEC,
4347 .change_protocol = dib0700_change_protocol, 4347 .change_protocol = dib0700_change_protocol,
4348 }, 4348 },
4349 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 4349 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -4394,9 +4394,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
4394 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 4394 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4395 .module_name = "dib0700", 4395 .module_name = "dib0700",
4396 .rc_query = dib0700_rc_query_old_firmware, 4396 .rc_query = dib0700_rc_query_old_firmware,
4397 .allowed_protos = RC_TYPE_RC5 | 4397 .allowed_protos = RC_BIT_RC5 |
4398 RC_TYPE_RC6 | 4398 RC_BIT_RC6_MCE |
4399 RC_TYPE_NEC, 4399 RC_BIT_NEC,
4400 .change_protocol = dib0700_change_protocol, 4400 .change_protocol = dib0700_change_protocol,
4401 }, 4401 },
4402 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 4402 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -4433,9 +4433,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
4433 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 4433 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4434 .module_name = "dib0700", 4434 .module_name = "dib0700",
4435 .rc_query = dib0700_rc_query_old_firmware, 4435 .rc_query = dib0700_rc_query_old_firmware,
4436 .allowed_protos = RC_TYPE_RC5 | 4436 .allowed_protos = RC_BIT_RC5 |
4437 RC_TYPE_RC6 | 4437 RC_BIT_RC6_MCE |
4438 RC_TYPE_NEC, 4438 RC_BIT_NEC,
4439 .change_protocol = dib0700_change_protocol, 4439 .change_protocol = dib0700_change_protocol,
4440 }, 4440 },
4441 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 4441 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -4472,9 +4472,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
4472 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 4472 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4473 .module_name = "dib0700", 4473 .module_name = "dib0700",
4474 .rc_query = dib0700_rc_query_old_firmware, 4474 .rc_query = dib0700_rc_query_old_firmware,
4475 .allowed_protos = RC_TYPE_RC5 | 4475 .allowed_protos = RC_BIT_RC5 |
4476 RC_TYPE_RC6 | 4476 RC_BIT_RC6_MCE |
4477 RC_TYPE_NEC, 4477 RC_BIT_NEC,
4478 .change_protocol = dib0700_change_protocol, 4478 .change_protocol = dib0700_change_protocol,
4479 }, 4479 },
4480 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 4480 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -4511,9 +4511,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
4511 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 4511 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4512 .module_name = "dib0700", 4512 .module_name = "dib0700",
4513 .rc_query = dib0700_rc_query_old_firmware, 4513 .rc_query = dib0700_rc_query_old_firmware,
4514 .allowed_protos = RC_TYPE_RC5 | 4514 .allowed_protos = RC_BIT_RC5 |
4515 RC_TYPE_RC6 | 4515 RC_BIT_RC6_MCE |
4516 RC_TYPE_NEC, 4516 RC_BIT_NEC,
4517 .change_protocol = dib0700_change_protocol, 4517 .change_protocol = dib0700_change_protocol,
4518 }, 4518 },
4519 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 4519 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -4550,9 +4550,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
4550 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 4550 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4551 .module_name = "dib0700", 4551 .module_name = "dib0700",
4552 .rc_query = dib0700_rc_query_old_firmware, 4552 .rc_query = dib0700_rc_query_old_firmware,
4553 .allowed_protos = RC_TYPE_RC5 | 4553 .allowed_protos = RC_BIT_RC5 |
4554 RC_TYPE_RC6 | 4554 RC_BIT_RC6_MCE |
4555 RC_TYPE_NEC, 4555 RC_BIT_NEC,
4556 .change_protocol = dib0700_change_protocol, 4556 .change_protocol = dib0700_change_protocol,
4557 }, 4557 },
4558 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 4558 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -4589,9 +4589,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
4589 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 4589 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4590 .module_name = "dib0700", 4590 .module_name = "dib0700",
4591 .rc_query = dib0700_rc_query_old_firmware, 4591 .rc_query = dib0700_rc_query_old_firmware,
4592 .allowed_protos = RC_TYPE_RC5 | 4592 .allowed_protos = RC_BIT_RC5 |
4593 RC_TYPE_RC6 | 4593 RC_BIT_RC6_MCE |
4594 RC_TYPE_NEC, 4594 RC_BIT_NEC,
4595 .change_protocol = dib0700_change_protocol, 4595 .change_protocol = dib0700_change_protocol,
4596 }, 4596 },
4597 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 4597 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -4644,9 +4644,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
4644 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 4644 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4645 .module_name = "dib0700", 4645 .module_name = "dib0700",
4646 .rc_query = dib0700_rc_query_old_firmware, 4646 .rc_query = dib0700_rc_query_old_firmware,
4647 .allowed_protos = RC_TYPE_RC5 | 4647 .allowed_protos = RC_BIT_RC5 |
4648 RC_TYPE_RC6 | 4648 RC_BIT_RC6_MCE |
4649 RC_TYPE_NEC, 4649 RC_BIT_NEC,
4650 .change_protocol = dib0700_change_protocol, 4650 .change_protocol = dib0700_change_protocol,
4651 }, 4651 },
4652 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 4652 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -4681,9 +4681,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
4681 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 4681 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4682 .module_name = "dib0700", 4682 .module_name = "dib0700",
4683 .rc_query = dib0700_rc_query_old_firmware, 4683 .rc_query = dib0700_rc_query_old_firmware,
4684 .allowed_protos = RC_TYPE_RC5 | 4684 .allowed_protos = RC_BIT_RC5 |
4685 RC_TYPE_RC6 | 4685 RC_BIT_RC6_MCE |
4686 RC_TYPE_NEC, 4686 RC_BIT_NEC,
4687 .change_protocol = dib0700_change_protocol, 4687 .change_protocol = dib0700_change_protocol,
4688 }, 4688 },
4689 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 4689 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -4721,9 +4721,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
4721 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 4721 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4722 .module_name = "dib0700", 4722 .module_name = "dib0700",
4723 .rc_query = dib0700_rc_query_old_firmware, 4723 .rc_query = dib0700_rc_query_old_firmware,
4724 .allowed_protos = RC_TYPE_RC5 | 4724 .allowed_protos = RC_BIT_RC5 |
4725 RC_TYPE_RC6 | 4725 RC_BIT_RC6_MCE |
4726 RC_TYPE_NEC, 4726 RC_BIT_NEC,
4727 .change_protocol = dib0700_change_protocol, 4727 .change_protocol = dib0700_change_protocol,
4728 }, 4728 },
4729 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 4729 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -4761,9 +4761,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
4761 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 4761 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4762 .module_name = "dib0700", 4762 .module_name = "dib0700",
4763 .rc_query = dib0700_rc_query_old_firmware, 4763 .rc_query = dib0700_rc_query_old_firmware,
4764 .allowed_protos = RC_TYPE_RC5 | 4764 .allowed_protos = RC_BIT_RC5 |
4765 RC_TYPE_RC6 | 4765 RC_BIT_RC6_MCE |
4766 RC_TYPE_NEC, 4766 RC_BIT_NEC,
4767 .change_protocol = dib0700_change_protocol, 4767 .change_protocol = dib0700_change_protocol,
4768 }, 4768 },
4769 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 4769 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -4802,9 +4802,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
4802 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 4802 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4803 .module_name = "dib0700", 4803 .module_name = "dib0700",
4804 .rc_query = dib0700_rc_query_old_firmware, 4804 .rc_query = dib0700_rc_query_old_firmware,
4805 .allowed_protos = RC_TYPE_RC5 | 4805 .allowed_protos = RC_BIT_RC5 |
4806 RC_TYPE_RC6 | 4806 RC_BIT_RC6_MCE |
4807 RC_TYPE_NEC, 4807 RC_BIT_NEC,
4808 .change_protocol = dib0700_change_protocol, 4808 .change_protocol = dib0700_change_protocol,
4809 }, 4809 },
4810 }, 4810 },
diff --git a/drivers/media/usb/dvb-usb/dvb-usb.h b/drivers/media/usb/dvb-usb/dvb-usb.h
index aab0f99bc892..ce4c4e3b58bb 100644
--- a/drivers/media/usb/dvb-usb/dvb-usb.h
+++ b/drivers/media/usb/dvb-usb/dvb-usb.h
@@ -202,7 +202,7 @@ struct dvb_rc {
202 u64 protocol; 202 u64 protocol;
203 u64 allowed_protos; 203 u64 allowed_protos;
204 enum rc_driver_type driver_type; 204 enum rc_driver_type driver_type;
205 int (*change_protocol)(struct rc_dev *dev, u64 rc_type); 205 int (*change_protocol)(struct rc_dev *dev, u64 *rc_type);
206 char *module_name; 206 char *module_name;
207 int (*rc_query) (struct dvb_usb_device *d); 207 int (*rc_query) (struct dvb_usb_device *d);
208 int rc_interval; 208 int rc_interval;
diff --git a/drivers/media/usb/dvb-usb/pctv452e.c b/drivers/media/usb/dvb-usb/pctv452e.c
index 02e878577c3d..d1ddfa13de86 100644
--- a/drivers/media/usb/dvb-usb/pctv452e.c
+++ b/drivers/media/usb/dvb-usb/pctv452e.c
@@ -927,7 +927,7 @@ static struct dvb_usb_device_properties pctv452e_properties = {
927 927
928 .rc.core = { 928 .rc.core = {
929 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 929 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
930 .allowed_protos = RC_TYPE_UNKNOWN, 930 .allowed_protos = RC_BIT_UNKNOWN,
931 .rc_query = pctv452e_rc_query, 931 .rc_query = pctv452e_rc_query,
932 .rc_interval = 100, 932 .rc_interval = 100,
933 }, 933 },
@@ -980,7 +980,7 @@ static struct dvb_usb_device_properties tt_connect_s2_3600_properties = {
980 980
981 .rc.core = { 981 .rc.core = {
982 .rc_codes = RC_MAP_TT_1500, 982 .rc_codes = RC_MAP_TT_1500,
983 .allowed_protos = RC_TYPE_UNKNOWN, 983 .allowed_protos = RC_BIT_UNKNOWN,
984 .rc_query = pctv452e_rc_query, 984 .rc_query = pctv452e_rc_query,
985 .rc_interval = 100, 985 .rc_interval = 100,
986 }, 986 },
diff --git a/drivers/media/usb/dvb-usb/technisat-usb2.c b/drivers/media/usb/dvb-usb/technisat-usb2.c
index 7a8c8c18590f..40832a1aef6c 100644
--- a/drivers/media/usb/dvb-usb/technisat-usb2.c
+++ b/drivers/media/usb/dvb-usb/technisat-usb2.c
@@ -732,7 +732,7 @@ static struct dvb_usb_device_properties technisat_usb2_devices = {
732 .rc_codes = RC_MAP_TECHNISAT_USB2, 732 .rc_codes = RC_MAP_TECHNISAT_USB2,
733 .module_name = "technisat-usb2", 733 .module_name = "technisat-usb2",
734 .rc_query = technisat_usb2_rc_query, 734 .rc_query = technisat_usb2_rc_query,
735 .allowed_protos = RC_TYPE_ALL, 735 .allowed_protos = RC_BIT_ALL,
736 .driver_type = RC_DRIVER_IR_RAW, 736 .driver_type = RC_DRIVER_IR_RAW,
737 } 737 }
738}; 738};
diff --git a/drivers/media/usb/dvb-usb/ttusb2.c b/drivers/media/usb/dvb-usb/ttusb2.c
index 6a50cdea3bce..bcdac225ebe1 100644
--- a/drivers/media/usb/dvb-usb/ttusb2.c
+++ b/drivers/media/usb/dvb-usb/ttusb2.c
@@ -741,7 +741,7 @@ static struct dvb_usb_device_properties ttusb2_properties_ct3650 = {
741 .rc_interval = 150, /* Less than IR_KEYPRESS_TIMEOUT */ 741 .rc_interval = 150, /* Less than IR_KEYPRESS_TIMEOUT */
742 .rc_codes = RC_MAP_TT_1500, 742 .rc_codes = RC_MAP_TT_1500,
743 .rc_query = tt3650_rc_query, 743 .rc_query = tt3650_rc_query,
744 .allowed_protos = RC_TYPE_UNKNOWN, 744 .allowed_protos = RC_BIT_UNKNOWN,
745 }, 745 },
746 746
747 .num_adapters = 1, 747 .num_adapters = 1,
diff --git a/drivers/media/usb/dvb-usb/vp702x.c b/drivers/media/usb/dvb-usb/vp702x.c
index 07c673a6e764..22cf9f96cb9e 100644
--- a/drivers/media/usb/dvb-usb/vp702x.c
+++ b/drivers/media/usb/dvb-usb/vp702x.c
@@ -56,7 +56,7 @@ static int vp702x_usb_in_op_unlocked(struct dvb_usb_device *d, u8 req,
56} 56}
57 57
58int vp702x_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, 58int vp702x_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value,
59 u16 index, u8 *b, int blen) 59 u16 index, u8 *b, int blen)
60{ 60{
61 int ret; 61 int ret;
62 62
@@ -67,8 +67,8 @@ int vp702x_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value,
67 return ret; 67 return ret;
68} 68}
69 69
70int vp702x_usb_out_op_unlocked(struct dvb_usb_device *d, u8 req, u16 value, 70static int vp702x_usb_out_op_unlocked(struct dvb_usb_device *d, u8 req,
71 u16 index, u8 *b, int blen) 71 u16 value, u16 index, u8 *b, int blen)
72{ 72{
73 int ret; 73 int ret;
74 deb_xfer("out: req. %02x, val: %04x, ind: %04x, buffer: ",req,value,index); 74 deb_xfer("out: req. %02x, val: %04x, ind: %04x, buffer: ",req,value,index);
@@ -86,7 +86,7 @@ int vp702x_usb_out_op_unlocked(struct dvb_usb_device *d, u8 req, u16 value,
86 return 0; 86 return 0;
87} 87}
88 88
89int vp702x_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value, 89static int vp702x_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value,
90 u16 index, u8 *b, int blen) 90 u16 index, u8 *b, int blen)
91{ 91{
92 int ret; 92 int ret;
diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c
index 16a84f9f46d8..619bffbab3bc 100644
--- a/drivers/media/usb/em28xx/em28xx-cards.c
+++ b/drivers/media/usb/em28xx/em28xx-cards.c
@@ -1979,6 +1979,15 @@ struct em28xx_board em28xx_boards[] = {
1979 EM28XX_I2C_CLK_WAIT_ENABLE | 1979 EM28XX_I2C_CLK_WAIT_ENABLE |
1980 EM28XX_I2C_FREQ_400_KHZ, 1980 EM28XX_I2C_FREQ_400_KHZ,
1981 }, 1981 },
1982 [EM2884_BOARD_TERRATEC_HTC_USB_XS] = {
1983 .name = "Terratec Cinergy HTC USB XS",
1984 .has_dvb = 1,
1985 .ir_codes = RC_MAP_NEC_TERRATEC_CINERGY_XS,
1986 .tuner_type = TUNER_ABSENT,
1987 .i2c_speed = EM2874_I2C_SECONDARY_BUS_SELECT |
1988 EM28XX_I2C_CLK_WAIT_ENABLE |
1989 EM28XX_I2C_FREQ_400_KHZ,
1990 },
1982}; 1991};
1983const unsigned int em28xx_bcount = ARRAY_SIZE(em28xx_boards); 1992const unsigned int em28xx_bcount = ARRAY_SIZE(em28xx_boards);
1984 1993
@@ -2057,9 +2066,9 @@ struct usb_device_id em28xx_id_table[] = {
2057 { USB_DEVICE(0x0ccd, 0x0043), 2066 { USB_DEVICE(0x0ccd, 0x0043),
2058 .driver_info = EM2870_BOARD_TERRATEC_XS }, 2067 .driver_info = EM2870_BOARD_TERRATEC_XS },
2059 { USB_DEVICE(0x0ccd, 0x008e), /* Cinergy HTC USB XS Rev. 1 */ 2068 { USB_DEVICE(0x0ccd, 0x008e), /* Cinergy HTC USB XS Rev. 1 */
2060 .driver_info = EM2884_BOARD_TERRATEC_H5 }, 2069 .driver_info = EM2884_BOARD_TERRATEC_HTC_USB_XS },
2061 { USB_DEVICE(0x0ccd, 0x00ac), /* Cinergy HTC USB XS Rev. 2 */ 2070 { USB_DEVICE(0x0ccd, 0x00ac), /* Cinergy HTC USB XS Rev. 2 */
2062 .driver_info = EM2884_BOARD_TERRATEC_H5 }, 2071 .driver_info = EM2884_BOARD_TERRATEC_HTC_USB_XS },
2063 { USB_DEVICE(0x0ccd, 0x10a2), /* H5 Rev. 1 */ 2072 { USB_DEVICE(0x0ccd, 0x10a2), /* H5 Rev. 1 */
2064 .driver_info = EM2884_BOARD_TERRATEC_H5 }, 2073 .driver_info = EM2884_BOARD_TERRATEC_H5 },
2065 { USB_DEVICE(0x0ccd, 0x10ad), /* H5 Rev. 2 */ 2074 { USB_DEVICE(0x0ccd, 0x10ad), /* H5 Rev. 2 */
@@ -3297,7 +3306,7 @@ static int em28xx_usb_probe(struct usb_interface *interface,
3297 3306
3298 dev->num_alt = interface->num_altsetting; 3307 dev->num_alt = interface->num_altsetting;
3299 3308
3300 if ((card[nr] >= 0) && (card[nr] < em28xx_bcount)) 3309 if ((unsigned)card[nr] < em28xx_bcount)
3301 dev->model = card[nr]; 3310 dev->model = card[nr];
3302 3311
3303 /* save our data pointer in this interface device */ 3312 /* save our data pointer in this interface device */
diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c
index 13ae821949e9..63f2e7070c00 100644
--- a/drivers/media/usb/em28xx/em28xx-dvb.c
+++ b/drivers/media/usb/em28xx/em28xx-dvb.c
@@ -331,7 +331,7 @@ static struct drxk_config hauppauge_930c_drxk = {
331 .load_firmware_sync = true, 331 .load_firmware_sync = true,
332}; 332};
333 333
334struct drxk_config terratec_htc_stick_drxk = { 334static struct drxk_config terratec_htc_stick_drxk = {
335 .adr = 0x29, 335 .adr = 0x29,
336 .single_master = 1, 336 .single_master = 1,
337 .no_i2c_bridge = 1, 337 .no_i2c_bridge = 1,
@@ -520,7 +520,10 @@ static void terratec_htc_stick_init(struct em28xx *dev)
520 { -1, -1, -1, -1}, 520 { -1, -1, -1, -1},
521 }; 521 };
522 522
523 /* Init the analog decoder? */ 523 /*
524 * Init the analog decoder (not yet supported), but
525 * it's probably still a good idea.
526 */
524 struct { 527 struct {
525 unsigned char r[4]; 528 unsigned char r[4];
526 int len; 529 int len;
@@ -547,6 +550,64 @@ static void terratec_htc_stick_init(struct em28xx *dev)
547 em28xx_gpio_set(dev, terratec_htc_stick_end); 550 em28xx_gpio_set(dev, terratec_htc_stick_end);
548}; 551};
549 552
553static void terratec_htc_usb_xs_init(struct em28xx *dev)
554{
555 int i;
556
557 struct em28xx_reg_seq terratec_htc_usb_xs_init[] = {
558 {EM28XX_R08_GPIO, 0xff, 0xff, 10},
559 {EM2874_R80_GPIO, 0xb2, 0xff, 100},
560 {EM2874_R80_GPIO, 0xb2, 0xff, 50},
561 {EM2874_R80_GPIO, 0xb6, 0xff, 100},
562 { -1, -1, -1, -1},
563 };
564 struct em28xx_reg_seq terratec_htc_usb_xs_end[] = {
565 {EM2874_R80_GPIO, 0xa6, 0xff, 100},
566 {EM2874_R80_GPIO, 0xa6, 0xff, 50},
567 {EM2874_R80_GPIO, 0xe6, 0xff, 100},
568 { -1, -1, -1, -1},
569 };
570
571 /*
572 * Init the analog decoder (not yet supported), but
573 * it's probably still a good idea.
574 */
575 struct {
576 unsigned char r[4];
577 int len;
578 } regs[] = {
579 {{ 0x06, 0x02, 0x00, 0x31 }, 4},
580 {{ 0x01, 0x02 }, 2},
581 {{ 0x01, 0x02, 0x00, 0xc6 }, 4},
582 {{ 0x01, 0x00 }, 2},
583 {{ 0x01, 0x00, 0xff, 0xaf }, 4},
584 {{ 0x01, 0x00, 0x03, 0xa0 }, 4},
585 {{ 0x01, 0x00 }, 2},
586 {{ 0x01, 0x00, 0x73, 0xaf }, 4},
587 {{ 0x04, 0x00 }, 2},
588 {{ 0x00, 0x04 }, 2},
589 {{ 0x00, 0x04, 0x00, 0x0a }, 4},
590 {{ 0x04, 0x14 }, 2},
591 {{ 0x04, 0x14, 0x00, 0x00 }, 4},
592 };
593
594 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40);
595
596 em28xx_gpio_set(dev, terratec_htc_usb_xs_init);
597
598 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40);
599 msleep(10);
600 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x44);
601 msleep(10);
602
603 dev->i2c_client.addr = 0x82 >> 1;
604
605 for (i = 0; i < ARRAY_SIZE(regs); i++)
606 i2c_master_send(&dev->i2c_client, regs[i].r, regs[i].len);
607
608 em28xx_gpio_set(dev, terratec_htc_usb_xs_end);
609};
610
550static void pctv_520e_init(struct em28xx *dev) 611static void pctv_520e_init(struct em28xx *dev)
551{ 612{
552 /* 613 /*
@@ -1155,6 +1216,25 @@ static int em28xx_dvb_init(struct em28xx *dev)
1155 goto out_free; 1216 goto out_free;
1156 } 1217 }
1157 break; 1218 break;
1219 case EM2884_BOARD_TERRATEC_HTC_USB_XS:
1220 terratec_htc_usb_xs_init(dev);
1221
1222 /* attach demodulator */
1223 dvb->fe[0] = dvb_attach(drxk_attach, &terratec_htc_stick_drxk,
1224 &dev->i2c_adap);
1225 if (!dvb->fe[0]) {
1226 result = -EINVAL;
1227 goto out_free;
1228 }
1229
1230 /* Attach the demodulator. */
1231 if (!dvb_attach(tda18271_attach, dvb->fe[0], 0x60,
1232 &dev->i2c_adap,
1233 &em28xx_cxd2820r_tda18271_config)) {
1234 result = -EINVAL;
1235 goto out_free;
1236 }
1237 break;
1158 default: 1238 default:
1159 em28xx_errdev("/2: The frontend of your DVB/ATSC card" 1239 em28xx_errdev("/2: The frontend of your DVB/ATSC card"
1160 " isn't supported yet\n"); 1240 " isn't supported yet\n");
diff --git a/drivers/media/usb/em28xx/em28xx-input.c b/drivers/media/usb/em28xx/em28xx-input.c
index 97d36b4f19db..660bf803c9e4 100644
--- a/drivers/media/usb/em28xx/em28xx-input.c
+++ b/drivers/media/usb/em28xx/em28xx-input.c
@@ -345,7 +345,7 @@ static void em28xx_ir_stop(struct rc_dev *rc)
345 cancel_delayed_work_sync(&ir->work); 345 cancel_delayed_work_sync(&ir->work);
346} 346}
347 347
348static int em28xx_ir_change_protocol(struct rc_dev *rc_dev, u64 rc_type) 348static int em28xx_ir_change_protocol(struct rc_dev *rc_dev, u64 *rc_type)
349{ 349{
350 int rc = 0; 350 int rc = 0;
351 struct em28xx_IR *ir = rc_dev->priv; 351 struct em28xx_IR *ir = rc_dev->priv;
@@ -354,14 +354,16 @@ static int em28xx_ir_change_protocol(struct rc_dev *rc_dev, u64 rc_type)
354 354
355 /* Adjust xclk based o IR table for RC5/NEC tables */ 355 /* Adjust xclk based o IR table for RC5/NEC tables */
356 356
357 if (rc_type == RC_TYPE_RC5) { 357 if (*rc_type & RC_BIT_RC5) {
358 dev->board.xclk |= EM28XX_XCLK_IR_RC5_MODE; 358 dev->board.xclk |= EM28XX_XCLK_IR_RC5_MODE;
359 ir->full_code = 1; 359 ir->full_code = 1;
360 } else if (rc_type == RC_TYPE_NEC) { 360 *rc_type = RC_BIT_RC5;
361 } else if (*rc_type & RC_BIT_NEC) {
361 dev->board.xclk &= ~EM28XX_XCLK_IR_RC5_MODE; 362 dev->board.xclk &= ~EM28XX_XCLK_IR_RC5_MODE;
362 ir_config = EM2874_IR_NEC; 363 ir_config = EM2874_IR_NEC;
363 ir->full_code = 1; 364 ir->full_code = 1;
364 } else if (rc_type != RC_TYPE_UNKNOWN) 365 *rc_type = RC_BIT_NEC;
366 } else if (*rc_type != RC_BIT_UNKNOWN)
365 rc = -EINVAL; 367 rc = -EINVAL;
366 368
367 em28xx_write_reg_bits(dev, EM28XX_R0F_XCLK, dev->board.xclk, 369 em28xx_write_reg_bits(dev, EM28XX_R0F_XCLK, dev->board.xclk,
@@ -524,6 +526,7 @@ static int em28xx_ir_init(struct em28xx *dev)
524 struct em28xx_IR *ir; 526 struct em28xx_IR *ir;
525 struct rc_dev *rc; 527 struct rc_dev *rc;
526 int err = -ENOMEM; 528 int err = -ENOMEM;
529 u64 rc_type;
527 530
528 if (dev->board.ir_codes == NULL) { 531 if (dev->board.ir_codes == NULL) {
529 /* No remote control support */ 532 /* No remote control support */
@@ -546,14 +549,15 @@ static int em28xx_ir_init(struct em28xx *dev)
546 * em2874 supports more protocols. For now, let's just announce 549 * em2874 supports more protocols. For now, let's just announce
547 * the two protocols that were already tested 550 * the two protocols that were already tested
548 */ 551 */
549 rc->allowed_protos = RC_TYPE_RC5 | RC_TYPE_NEC; 552 rc->allowed_protos = RC_BIT_RC5 | RC_BIT_NEC;
550 rc->priv = ir; 553 rc->priv = ir;
551 rc->change_protocol = em28xx_ir_change_protocol; 554 rc->change_protocol = em28xx_ir_change_protocol;
552 rc->open = em28xx_ir_start; 555 rc->open = em28xx_ir_start;
553 rc->close = em28xx_ir_stop; 556 rc->close = em28xx_ir_stop;
554 557
555 /* By default, keep protocol field untouched */ 558 /* By default, keep protocol field untouched */
556 err = em28xx_ir_change_protocol(rc, RC_TYPE_UNKNOWN); 559 rc_type = RC_BIT_UNKNOWN;
560 err = em28xx_ir_change_protocol(rc, &rc_type);
557 if (err) 561 if (err)
558 goto err_out_free; 562 goto err_out_free;
559 563
diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h
index 8757523e6863..86e90d86da6d 100644
--- a/drivers/media/usb/em28xx/em28xx.h
+++ b/drivers/media/usb/em28xx/em28xx.h
@@ -128,6 +128,7 @@
128#define EM2874_BOARD_MAXMEDIA_UB425_TC 84 128#define EM2874_BOARD_MAXMEDIA_UB425_TC 84
129#define EM2884_BOARD_PCTV_510E 85 129#define EM2884_BOARD_PCTV_510E 85
130#define EM2884_BOARD_PCTV_520E 86 130#define EM2884_BOARD_PCTV_520E 86
131#define EM2884_BOARD_TERRATEC_HTC_USB_XS 87
131 132
132/* Limits minimum and default number of buffers */ 133/* Limits minimum and default number of buffers */
133#define EM28XX_MIN_BUF 4 134#define EM28XX_MIN_BUF 4
diff --git a/drivers/media/usb/gspca/gspca.c b/drivers/media/usb/gspca/gspca.c
index a2b934146ebf..e0a431bb0d42 100644
--- a/drivers/media/usb/gspca/gspca.c
+++ b/drivers/media/usb/gspca/gspca.c
@@ -1586,8 +1586,7 @@ static int vidioc_querybuf(struct file *file, void *priv,
1586 struct gspca_dev *gspca_dev = video_drvdata(file); 1586 struct gspca_dev *gspca_dev = video_drvdata(file);
1587 struct gspca_frame *frame; 1587 struct gspca_frame *frame;
1588 1588
1589 if (v4l2_buf->index < 0 1589 if (v4l2_buf->index >= gspca_dev->nframes)
1590 || v4l2_buf->index >= gspca_dev->nframes)
1591 return -EINVAL; 1590 return -EINVAL;
1592 1591
1593 frame = &gspca_dev->frame[v4l2_buf->index]; 1592 frame = &gspca_dev->frame[v4l2_buf->index];
diff --git a/drivers/media/usb/gspca/gspca.h b/drivers/media/usb/gspca/gspca.h
index e3eab82cd4e5..352317d7acdb 100644
--- a/drivers/media/usb/gspca/gspca.h
+++ b/drivers/media/usb/gspca/gspca.h
@@ -32,7 +32,7 @@ do { \
32#define D_USBO 0x00 32#define D_USBO 0x00
33#define D_V4L2 0x0100 33#define D_V4L2 0x0100
34#else 34#else
35#define PDEBUG(level, fmt, ...) 35#define PDEBUG(level, fmt, ...) do {} while(0)
36#endif 36#endif
37 37
38#define GSPCA_MAX_FRAMES 16 /* maximum number of video frame buffers */ 38#define GSPCA_MAX_FRAMES 16 /* maximum number of video frame buffers */
diff --git a/drivers/media/usb/gspca/jeilinj.c b/drivers/media/usb/gspca/jeilinj.c
index b897aa86f315..1ba29fe7fada 100644
--- a/drivers/media/usb/gspca/jeilinj.c
+++ b/drivers/media/usb/gspca/jeilinj.c
@@ -114,7 +114,7 @@ static void jlj_write2(struct gspca_dev *gspca_dev, unsigned char *command)
114} 114}
115 115
116/* Responses are one byte only */ 116/* Responses are one byte only */
117static void jlj_read1(struct gspca_dev *gspca_dev, unsigned char response) 117static void jlj_read1(struct gspca_dev *gspca_dev, unsigned char *response)
118{ 118{
119 int retval; 119 int retval;
120 120
@@ -123,7 +123,7 @@ static void jlj_read1(struct gspca_dev *gspca_dev, unsigned char response)
123 retval = usb_bulk_msg(gspca_dev->dev, 123 retval = usb_bulk_msg(gspca_dev->dev,
124 usb_rcvbulkpipe(gspca_dev->dev, 0x84), 124 usb_rcvbulkpipe(gspca_dev->dev, 0x84),
125 gspca_dev->usb_buf, 1, NULL, 500); 125 gspca_dev->usb_buf, 1, NULL, 500);
126 response = gspca_dev->usb_buf[0]; 126 *response = gspca_dev->usb_buf[0];
127 if (retval < 0) { 127 if (retval < 0) {
128 pr_err("read command [%02x] error %d\n", 128 pr_err("read command [%02x] error %d\n",
129 gspca_dev->usb_buf[0], retval); 129 gspca_dev->usb_buf[0], retval);
@@ -260,7 +260,7 @@ static int jlj_start(struct gspca_dev *gspca_dev)
260 if (start_commands[i].delay) 260 if (start_commands[i].delay)
261 msleep(start_commands[i].delay); 261 msleep(start_commands[i].delay);
262 if (start_commands[i].ack_wanted) 262 if (start_commands[i].ack_wanted)
263 jlj_read1(gspca_dev, response); 263 jlj_read1(gspca_dev, &response);
264 } 264 }
265 setcamquality(gspca_dev, v4l2_ctrl_g_ctrl(sd->jpegqual)); 265 setcamquality(gspca_dev, v4l2_ctrl_g_ctrl(sd->jpegqual));
266 msleep(2); 266 msleep(2);
diff --git a/drivers/media/usb/gspca/m5602/m5602_s5k4aa.c b/drivers/media/usb/gspca/m5602/m5602_s5k4aa.c
index cc8ec3f7e8dc..c8e1572eb502 100644
--- a/drivers/media/usb/gspca/m5602/m5602_s5k4aa.c
+++ b/drivers/media/usb/gspca/m5602/m5602_s5k4aa.c
@@ -74,6 +74,12 @@ static
74 DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pa 2548") 74 DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pa 2548")
75 } 75 }
76 }, { 76 }, {
77 .ident = "Fujitsu-Siemens Amilo Pi 2530",
78 .matches = {
79 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
80 DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pi 2530")
81 }
82 }, {
77 .ident = "MSI GX700", 83 .ident = "MSI GX700",
78 .matches = { 84 .matches = {
79 DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International"), 85 DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International"),
diff --git a/drivers/media/usb/gspca/pac7302.c b/drivers/media/usb/gspca/pac7302.c
index 2d5c6d8343a0..4f5869a98082 100644
--- a/drivers/media/usb/gspca/pac7302.c
+++ b/drivers/media/usb/gspca/pac7302.c
@@ -29,14 +29,13 @@
29 * Register page 0: 29 * Register page 0:
30 * 30 *
31 * Address Description 31 * Address Description
32 * 0x02 Red balance control 32 * 0x01 Red balance control
33 * 0x03 Green balance control 33 * 0x02 Green balance control
34 * 0x04 Blue balance control 34 * 0x03 Blue balance control
35 * Valus are inverted (0=max, 255=min).
36 * The Windows driver uses a quadratic approach to map 35 * The Windows driver uses a quadratic approach to map
37 * the settable values (0-200) on register values: 36 * the settable values (0-200) on register values:
38 * min=0x80, default=0x40, max=0x20 37 * min=0x20, default=0x40, max=0x80
39 * 0x0f-0x20 Colors, saturation and exposure control 38 * 0x0f-0x20 Color and saturation control
40 * 0xa2-0xab Brightness, contrast and gamma control 39 * 0xa2-0xab Brightness, contrast and gamma control
41 * 0xb6 Sharpness control (bits 0-4) 40 * 0xb6 Sharpness control (bits 0-4)
42 * 41 *
@@ -78,12 +77,12 @@
78 * 77 *
79 * Page | Register | Function 78 * Page | Register | Function
80 * -----+------------+--------------------------------------------------- 79 * -----+------------+---------------------------------------------------
80 * 0 | 0x01 | setredbalance()
81 * 0 | 0x03 | setbluebalance()
81 * 0 | 0x0f..0x20 | setcolors() 82 * 0 | 0x0f..0x20 | setcolors()
82 * 0 | 0xa2..0xab | setbrightcont() 83 * 0 | 0xa2..0xab | setbrightcont()
83 * 0 | 0xb6 | setsharpness() 84 * 0 | 0xb6 | setsharpness()
84 * 0 | 0xc5 | setredbalance()
85 * 0 | 0xc6 | setwhitebalance() 85 * 0 | 0xc6 | setwhitebalance()
86 * 0 | 0xc7 | setbluebalance()
87 * 0 | 0xdc | setbrightcont(), setcolors() 86 * 0 | 0xdc | setbrightcont(), setcolors()
88 * 3 | 0x02 | setexposure() 87 * 3 | 0x02 | setexposure()
89 * 3 | 0x10, 0x12 | setgain() 88 * 3 | 0x10, 0x12 | setgain()
@@ -99,10 +98,13 @@
99/* Include pac common sof detection functions */ 98/* Include pac common sof detection functions */
100#include "pac_common.h" 99#include "pac_common.h"
101 100
102#define PAC7302_GAIN_DEFAULT 15 101#define PAC7302_RGB_BALANCE_MIN 0
103#define PAC7302_GAIN_KNEE 42 102#define PAC7302_RGB_BALANCE_MAX 200
104#define PAC7302_EXPOSURE_DEFAULT 66 /* 33 ms / 30 fps */ 103#define PAC7302_RGB_BALANCE_DEFAULT 100
105#define PAC7302_EXPOSURE_KNEE 133 /* 66 ms / 15 fps */ 104#define PAC7302_GAIN_DEFAULT 15
105#define PAC7302_GAIN_KNEE 42
106#define PAC7302_EXPOSURE_DEFAULT 66 /* 33 ms / 30 fps */
107#define PAC7302_EXPOSURE_KNEE 133 /* 66 ms / 15 fps */
106 108
107MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>, " 109MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>, "
108 "Thomas Kaiser thomas@kaiser-linux.li"); 110 "Thomas Kaiser thomas@kaiser-linux.li");
@@ -439,12 +441,31 @@ static void setwhitebalance(struct gspca_dev *gspca_dev)
439 reg_w(gspca_dev, 0xdc, 0x01); 441 reg_w(gspca_dev, 0xdc, 0x01);
440} 442}
441 443
444static u8 rgbbalance_ctrl_to_reg_value(s32 rgb_ctrl_val)
445{
446 const unsigned int k = 1000; /* precision factor */
447 unsigned int norm;
448
449 /* Normed value [0...k] */
450 norm = k * (rgb_ctrl_val - PAC7302_RGB_BALANCE_MIN)
451 / (PAC7302_RGB_BALANCE_MAX - PAC7302_RGB_BALANCE_MIN);
452 /* Qudratic apporach improves control at small (register) values: */
453 return 64 * norm * norm / (k*k) + 32 * norm / k + 32;
454 /* Y = 64*X*X + 32*X + 32
455 * => register values 0x20-0x80; Windows driver uses these limits */
456
457 /* NOTE: for full value range (0x00-0xff) use
458 * Y = 254*X*X + X
459 * => 254 * norm * norm / (k*k) + 1 * norm / k */
460}
461
442static void setredbalance(struct gspca_dev *gspca_dev) 462static void setredbalance(struct gspca_dev *gspca_dev)
443{ 463{
444 struct sd *sd = (struct sd *) gspca_dev; 464 struct sd *sd = (struct sd *) gspca_dev;
445 465
446 reg_w(gspca_dev, 0xff, 0x00); /* page 0 */ 466 reg_w(gspca_dev, 0xff, 0x00); /* page 0 */
447 reg_w(gspca_dev, 0xc5, sd->red_balance->val); 467 reg_w(gspca_dev, 0x01,
468 rgbbalance_ctrl_to_reg_value(sd->red_balance->val));
448 469
449 reg_w(gspca_dev, 0xdc, 0x01); 470 reg_w(gspca_dev, 0xdc, 0x01);
450} 471}
@@ -454,7 +475,8 @@ static void setbluebalance(struct gspca_dev *gspca_dev)
454 struct sd *sd = (struct sd *) gspca_dev; 475 struct sd *sd = (struct sd *) gspca_dev;
455 476
456 reg_w(gspca_dev, 0xff, 0x00); /* page 0 */ 477 reg_w(gspca_dev, 0xff, 0x00); /* page 0 */
457 reg_w(gspca_dev, 0xc7, sd->blue_balance->val); 478 reg_w(gspca_dev, 0x03,
479 rgbbalance_ctrl_to_reg_value(sd->blue_balance->val));
458 480
459 reg_w(gspca_dev, 0xdc, 0x01); 481 reg_w(gspca_dev, 0xdc, 0x01);
460} 482}
@@ -643,9 +665,15 @@ static int sd_init_controls(struct gspca_dev *gspca_dev)
643 V4L2_CID_WHITE_BALANCE_TEMPERATURE, 665 V4L2_CID_WHITE_BALANCE_TEMPERATURE,
644 0, 255, 1, 55); 666 0, 255, 1, 55);
645 sd->red_balance = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, 667 sd->red_balance = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
646 V4L2_CID_RED_BALANCE, 0, 3, 1, 1); 668 V4L2_CID_RED_BALANCE,
669 PAC7302_RGB_BALANCE_MIN,
670 PAC7302_RGB_BALANCE_MAX,
671 1, PAC7302_RGB_BALANCE_DEFAULT);
647 sd->blue_balance = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, 672 sd->blue_balance = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
648 V4L2_CID_BLUE_BALANCE, 0, 3, 1, 1); 673 V4L2_CID_BLUE_BALANCE,
674 PAC7302_RGB_BALANCE_MIN,
675 PAC7302_RGB_BALANCE_MAX,
676 1, PAC7302_RGB_BALANCE_DEFAULT);
649 677
650 gspca_dev->autogain = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, 678 gspca_dev->autogain = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
651 V4L2_CID_AUTOGAIN, 0, 1, 1, 1); 679 V4L2_CID_AUTOGAIN, 0, 1, 1, 1);
diff --git a/drivers/media/usb/gspca/sonixb.c b/drivers/media/usb/gspca/sonixb.c
index fd1f8d2d3b0b..70511d5f9538 100644
--- a/drivers/media/usb/gspca/sonixb.c
+++ b/drivers/media/usb/gspca/sonixb.c
@@ -1449,6 +1449,7 @@ static const struct usb_device_id device_table[] = {
1449 {USB_DEVICE(0x0c45, 0x6024), SB(TAS5130CXX, 102)}, 1449 {USB_DEVICE(0x0c45, 0x6024), SB(TAS5130CXX, 102)},
1450 {USB_DEVICE(0x0c45, 0x6025), SB(TAS5130CXX, 102)}, 1450 {USB_DEVICE(0x0c45, 0x6025), SB(TAS5130CXX, 102)},
1451#endif 1451#endif
1452 {USB_DEVICE(0x0c45, 0x6027), SB(OV7630, 101)}, /* Genius Eye 310 */
1452 {USB_DEVICE(0x0c45, 0x6028), SB(PAS202, 102)}, 1453 {USB_DEVICE(0x0c45, 0x6028), SB(PAS202, 102)},
1453 {USB_DEVICE(0x0c45, 0x6029), SB(PAS106, 102)}, 1454 {USB_DEVICE(0x0c45, 0x6029), SB(PAS106, 102)},
1454 {USB_DEVICE(0x0c45, 0x602a), SB(HV7131D, 102)}, 1455 {USB_DEVICE(0x0c45, 0x602a), SB(HV7131D, 102)},
diff --git a/drivers/media/usb/gspca/spca506.c b/drivers/media/usb/gspca/spca506.c
index bab01c86c315..bcd2c04c770e 100644
--- a/drivers/media/usb/gspca/spca506.c
+++ b/drivers/media/usb/gspca/spca506.c
@@ -590,8 +590,7 @@ static const struct usb_device_id device_table[] = {
590MODULE_DEVICE_TABLE(usb, device_table); 590MODULE_DEVICE_TABLE(usb, device_table);
591 591
592/* -- device connect -- */ 592/* -- device connect -- */
593static int __devinit sd_probe(struct usb_interface *intf, 593static int sd_probe(struct usb_interface *intf, const struct usb_device_id *id)
594 const struct usb_device_id *id)
595{ 594{
596 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), 595 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
597 THIS_MODULE); 596 THIS_MODULE);
diff --git a/drivers/media/usb/hdpvr/hdpvr-core.c b/drivers/media/usb/hdpvr/hdpvr-core.c
index 304f43ef59eb..84dc26fe80ee 100644
--- a/drivers/media/usb/hdpvr/hdpvr-core.c
+++ b/drivers/media/usb/hdpvr/hdpvr-core.c
@@ -401,12 +401,14 @@ static int hdpvr_probe(struct usb_interface *interface,
401 client = hdpvr_register_ir_rx_i2c(dev); 401 client = hdpvr_register_ir_rx_i2c(dev);
402 if (!client) { 402 if (!client) {
403 v4l2_err(&dev->v4l2_dev, "i2c IR RX device register failed\n"); 403 v4l2_err(&dev->v4l2_dev, "i2c IR RX device register failed\n");
404 retval = -ENODEV;
404 goto reg_fail; 405 goto reg_fail;
405 } 406 }
406 407
407 client = hdpvr_register_ir_tx_i2c(dev); 408 client = hdpvr_register_ir_tx_i2c(dev);
408 if (!client) { 409 if (!client) {
409 v4l2_err(&dev->v4l2_dev, "i2c IR TX device register failed\n"); 410 v4l2_err(&dev->v4l2_dev, "i2c IR TX device register failed\n");
411 retval = -ENODEV;
410 goto reg_fail; 412 goto reg_fail;
411 } 413 }
412#endif 414#endif
diff --git a/drivers/media/usb/hdpvr/hdpvr-i2c.c b/drivers/media/usb/hdpvr/hdpvr-i2c.c
index 82e819fa91c0..031cf024304c 100644
--- a/drivers/media/usb/hdpvr/hdpvr-i2c.c
+++ b/drivers/media/usb/hdpvr/hdpvr-i2c.c
@@ -55,7 +55,7 @@ struct i2c_client *hdpvr_register_ir_rx_i2c(struct hdpvr_device *dev)
55 /* Our default information for ir-kbd-i2c.c to use */ 55 /* Our default information for ir-kbd-i2c.c to use */
56 init_data->ir_codes = RC_MAP_HAUPPAUGE; 56 init_data->ir_codes = RC_MAP_HAUPPAUGE;
57 init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; 57 init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR;
58 init_data->type = RC_TYPE_RC5; 58 init_data->type = RC_BIT_RC5;
59 init_data->name = "HD-PVR"; 59 init_data->name = "HD-PVR";
60 init_data->polling_interval = 405; /* ms, duplicated from Windows */ 60 init_data->polling_interval = 405; /* ms, duplicated from Windows */
61 hdpvr_ir_rx_i2c_board_info.platform_data = init_data; 61 hdpvr_ir_rx_i2c_board_info.platform_data = init_data;
diff --git a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c
index fb828ba1dbbe..299751a8b06b 100644
--- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c
+++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c
@@ -3563,9 +3563,9 @@ void pvr2_hdw_v4l_store_minor_number(struct pvr2_hdw *hdw,
3563 enum pvr2_v4l_type index,int v) 3563 enum pvr2_v4l_type index,int v)
3564{ 3564{
3565 switch (index) { 3565 switch (index) {
3566 case pvr2_v4l_type_video: hdw->v4l_minor_number_video = v; 3566 case pvr2_v4l_type_video: hdw->v4l_minor_number_video = v;break;
3567 case pvr2_v4l_type_vbi: hdw->v4l_minor_number_vbi = v; 3567 case pvr2_v4l_type_vbi: hdw->v4l_minor_number_vbi = v;break;
3568 case pvr2_v4l_type_radio: hdw->v4l_minor_number_radio = v; 3568 case pvr2_v4l_type_radio: hdw->v4l_minor_number_radio = v;break;
3569 default: break; 3569 default: break;
3570 } 3570 }
3571} 3571}
diff --git a/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c b/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c
index 885ce11f222d..9ab596c78a4e 100644
--- a/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c
+++ b/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c
@@ -581,7 +581,7 @@ static void pvr2_i2c_register_ir(struct pvr2_hdw *hdw)
581 case PVR2_IR_SCHEME_29XXX: /* Original 29xxx device */ 581 case PVR2_IR_SCHEME_29XXX: /* Original 29xxx device */
582 init_data->ir_codes = RC_MAP_HAUPPAUGE; 582 init_data->ir_codes = RC_MAP_HAUPPAUGE;
583 init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP; 583 init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP;
584 init_data->type = RC_TYPE_RC5; 584 init_data->type = RC_BIT_RC5;
585 init_data->name = hdw->hdw_desc->description; 585 init_data->name = hdw->hdw_desc->description;
586 init_data->polling_interval = 100; /* ms From ir-kbd-i2c */ 586 init_data->polling_interval = 100; /* ms From ir-kbd-i2c */
587 /* IR Receiver */ 587 /* IR Receiver */
@@ -596,7 +596,7 @@ static void pvr2_i2c_register_ir(struct pvr2_hdw *hdw)
596 case PVR2_IR_SCHEME_24XXX_MCE: /* 24xxx MCE device */ 596 case PVR2_IR_SCHEME_24XXX_MCE: /* 24xxx MCE device */
597 init_data->ir_codes = RC_MAP_HAUPPAUGE; 597 init_data->ir_codes = RC_MAP_HAUPPAUGE;
598 init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; 598 init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR;
599 init_data->type = RC_TYPE_RC5; 599 init_data->type = RC_BIT_RC5;
600 init_data->name = hdw->hdw_desc->description; 600 init_data->name = hdw->hdw_desc->description;
601 /* IR Receiver */ 601 /* IR Receiver */
602 info.addr = 0x71; 602 info.addr = 0x71;
diff --git a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c
index db249cad3cd9..6930676051e7 100644
--- a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c
+++ b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c
@@ -196,7 +196,7 @@ static int pvr2_g_std(struct file *file, void *priv, v4l2_std_id *std)
196 return ret; 196 return ret;
197} 197}
198 198
199int pvr2_s_std(struct file *file, void *priv, v4l2_std_id *std) 199static int pvr2_s_std(struct file *file, void *priv, v4l2_std_id *std)
200{ 200{
201 struct pvr2_v4l2_fh *fh = file->private_data; 201 struct pvr2_v4l2_fh *fh = file->private_data;
202 struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; 202 struct pvr2_hdw *hdw = fh->channel.mc_head->hdw;
@@ -365,7 +365,7 @@ static int pvr2_s_tuner(struct file *file, void *priv, struct v4l2_tuner *vt)
365 vt->audmode); 365 vt->audmode);
366} 366}
367 367
368int pvr2_s_frequency(struct file *file, void *priv, struct v4l2_frequency *vf) 368static int pvr2_s_frequency(struct file *file, void *priv, struct v4l2_frequency *vf)
369{ 369{
370 struct pvr2_v4l2_fh *fh = file->private_data; 370 struct pvr2_v4l2_fh *fh = file->private_data;
371 struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; 371 struct pvr2_hdw *hdw = fh->channel.mc_head->hdw;
diff --git a/drivers/media/usb/pwc/pwc-ctrl.c b/drivers/media/usb/pwc/pwc-ctrl.c
index 1f506fde97d0..3a1618580ed6 100644
--- a/drivers/media/usb/pwc/pwc-ctrl.c
+++ b/drivers/media/usb/pwc/pwc-ctrl.c
@@ -179,6 +179,8 @@ static int set_video_mode_Nala(struct pwc_device *pdev, int size, int pixfmt,
179 return -EINVAL; 179 return -EINVAL;
180 if (frames < 4) 180 if (frames < 4)
181 frames = 4; 181 frames = 4;
182 else if (size > PSZ_QCIF && frames > 15)
183 frames = 15;
182 else if (frames > 25) 184 else if (frames > 25)
183 frames = 25; 185 frames = 25;
184 frames = frames2frames[frames]; 186 frames = frames2frames[frames];
diff --git a/drivers/media/usb/pwc/pwc-if.c b/drivers/media/usb/pwc/pwc-if.c
index 42e36bac4d72..5210239cbaee 100644
--- a/drivers/media/usb/pwc/pwc-if.c
+++ b/drivers/media/usb/pwc/pwc-if.c
@@ -155,7 +155,7 @@ static struct video_device pwc_template = {
155/***************************************************************************/ 155/***************************************************************************/
156/* Private functions */ 156/* Private functions */
157 157
158struct pwc_frame_buf *pwc_get_next_fill_buf(struct pwc_device *pdev) 158static struct pwc_frame_buf *pwc_get_next_fill_buf(struct pwc_device *pdev)
159{ 159{
160 unsigned long flags = 0; 160 unsigned long flags = 0;
161 struct pwc_frame_buf *buf = NULL; 161 struct pwc_frame_buf *buf = NULL;
@@ -1000,7 +1000,11 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id
1000 pdev->vb_queue.buf_struct_size = sizeof(struct pwc_frame_buf); 1000 pdev->vb_queue.buf_struct_size = sizeof(struct pwc_frame_buf);
1001 pdev->vb_queue.ops = &pwc_vb_queue_ops; 1001 pdev->vb_queue.ops = &pwc_vb_queue_ops;
1002 pdev->vb_queue.mem_ops = &vb2_vmalloc_memops; 1002 pdev->vb_queue.mem_ops = &vb2_vmalloc_memops;
1003 vb2_queue_init(&pdev->vb_queue); 1003 rc = vb2_queue_init(&pdev->vb_queue);
1004 if (rc < 0) {
1005 PWC_ERROR("Oops, could not initialize vb2 queue.\n");
1006 goto err_free_mem;
1007 }
1004 1008
1005 /* Init video_device structure */ 1009 /* Init video_device structure */
1006 memcpy(&pdev->vdev, &pwc_template, sizeof(pwc_template)); 1010 memcpy(&pdev->vdev, &pwc_template, sizeof(pwc_template));
diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c
index 2191f6ddf9e7..8ebec0d7bf59 100644
--- a/drivers/media/usb/s2255/s2255drv.c
+++ b/drivers/media/usb/s2255/s2255drv.c
@@ -1651,7 +1651,7 @@ static int vidioc_enum_frameintervals(struct file *file, void *priv,
1651 int is_ntsc = 0; 1651 int is_ntsc = 0;
1652#define NUM_FRAME_ENUMS 4 1652#define NUM_FRAME_ENUMS 4
1653 int frm_dec[NUM_FRAME_ENUMS] = {1, 2, 3, 5}; 1653 int frm_dec[NUM_FRAME_ENUMS] = {1, 2, 3, 5};
1654 if (fe->index < 0 || fe->index >= NUM_FRAME_ENUMS) 1654 if (fe->index >= NUM_FRAME_ENUMS)
1655 return -EINVAL; 1655 return -EINVAL;
1656 switch (fe->width) { 1656 switch (fe->width) {
1657 case 640: 1657 case 640:
diff --git a/drivers/media/usb/siano/Kconfig b/drivers/media/usb/siano/Kconfig
index 3c76e62d820d..5afbd9a4b55c 100644
--- a/drivers/media/usb/siano/Kconfig
+++ b/drivers/media/usb/siano/Kconfig
@@ -4,7 +4,8 @@
4 4
5config SMS_USB_DRV 5config SMS_USB_DRV
6 tristate "Siano SMS1xxx based MDTV receiver" 6 tristate "Siano SMS1xxx based MDTV receiver"
7 depends on DVB_CORE && RC_CORE && HAS_DMA 7 depends on DVB_CORE && HAS_DMA
8 select MEDIA_COMMON_OPTIONS
8 ---help--- 9 ---help---
9 Choose if you would like to have Siano's support for USB interface 10 Choose if you would like to have Siano's support for USB interface
10 11
diff --git a/drivers/media/usb/siano/smsusb.c b/drivers/media/usb/siano/smsusb.c
index aac622200e99..de2c10289eec 100644
--- a/drivers/media/usb/siano/smsusb.c
+++ b/drivers/media/usb/siano/smsusb.c
@@ -389,7 +389,7 @@ static int smsusb_init_device(struct usb_interface *intf, int board_id)
389 return rc; 389 return rc;
390} 390}
391 391
392static int __devinit smsusb_probe(struct usb_interface *intf, 392static int smsusb_probe(struct usb_interface *intf,
393 const struct usb_device_id *id) 393 const struct usb_device_id *id)
394{ 394{
395 struct usb_device *udev = interface_to_usbdev(intf); 395 struct usb_device *udev = interface_to_usbdev(intf);
diff --git a/drivers/media/usb/sn9c102/sn9c102_core.c b/drivers/media/usb/sn9c102/sn9c102_core.c
index 5bfc8e2f018f..73605864fffa 100644
--- a/drivers/media/usb/sn9c102/sn9c102_core.c
+++ b/drivers/media/usb/sn9c102/sn9c102_core.c
@@ -2481,11 +2481,13 @@ sn9c102_vidioc_enum_framesizes(struct sn9c102_device* cam, void __user * arg)
2481 if (frmsize.pixel_format != V4L2_PIX_FMT_SN9C10X && 2481 if (frmsize.pixel_format != V4L2_PIX_FMT_SN9C10X &&
2482 frmsize.pixel_format != V4L2_PIX_FMT_SBGGR8) 2482 frmsize.pixel_format != V4L2_PIX_FMT_SBGGR8)
2483 return -EINVAL; 2483 return -EINVAL;
2484 break;
2484 case BRIDGE_SN9C105: 2485 case BRIDGE_SN9C105:
2485 case BRIDGE_SN9C120: 2486 case BRIDGE_SN9C120:
2486 if (frmsize.pixel_format != V4L2_PIX_FMT_JPEG && 2487 if (frmsize.pixel_format != V4L2_PIX_FMT_JPEG &&
2487 frmsize.pixel_format != V4L2_PIX_FMT_SBGGR8) 2488 frmsize.pixel_format != V4L2_PIX_FMT_SBGGR8)
2488 return -EINVAL; 2489 return -EINVAL;
2490 break;
2489 } 2491 }
2490 2492
2491 frmsize.type = V4L2_FRMSIZE_TYPE_STEPWISE; 2493 frmsize.type = V4L2_FRMSIZE_TYPE_STEPWISE;
diff --git a/drivers/media/usb/stk1160/stk1160-i2c.c b/drivers/media/usb/stk1160/stk1160-i2c.c
index 176ac937306b..850cf285ada8 100644
--- a/drivers/media/usb/stk1160/stk1160-i2c.c
+++ b/drivers/media/usb/stk1160/stk1160-i2c.c
@@ -116,7 +116,7 @@ static int stk1160_i2c_read_reg(struct stk1160 *dev, u8 addr,
116 if (rc < 0) 116 if (rc < 0)
117 return rc; 117 return rc;
118 118
119 stk1160_read_reg(dev, STK1160_SBUSR_RD, value); 119 rc = stk1160_read_reg(dev, STK1160_SBUSR_RD, value);
120 if (rc < 0) 120 if (rc < 0)
121 return rc; 121 return rc;
122 122
diff --git a/drivers/media/usb/stk1160/stk1160-video.c b/drivers/media/usb/stk1160/stk1160-video.c
index 8bdfb0275313..fa3671de02aa 100644
--- a/drivers/media/usb/stk1160/stk1160-video.c
+++ b/drivers/media/usb/stk1160/stk1160-video.c
@@ -475,7 +475,11 @@ int stk1160_alloc_isoc(struct stk1160 *dev)
475 if (!dev->isoc_ctl.transfer_buffer[i]) { 475 if (!dev->isoc_ctl.transfer_buffer[i]) {
476 stk1160_err("cannot alloc %d bytes for tx[%d] buffer\n", 476 stk1160_err("cannot alloc %d bytes for tx[%d] buffer\n",
477 sb_size, i); 477 sb_size, i);
478 goto free_i_bufs; 478
479 /* Not enough transfer buffers, so just give up */
480 if (i < STK1160_MIN_BUFS)
481 goto free_i_bufs;
482 goto nomore_tx_bufs;
479 } 483 }
480 memset(dev->isoc_ctl.transfer_buffer[i], 0, sb_size); 484 memset(dev->isoc_ctl.transfer_buffer[i], 0, sb_size);
481 485
@@ -506,13 +510,28 @@ int stk1160_alloc_isoc(struct stk1160 *dev)
506 } 510 }
507 } 511 }
508 512
509 stk1160_dbg("urbs allocated\n"); 513 stk1160_dbg("%d urbs allocated\n", num_bufs);
510 514
511 /* At last we can say we have some buffers */ 515 /* At last we can say we have some buffers */
512 dev->isoc_ctl.num_bufs = num_bufs; 516 dev->isoc_ctl.num_bufs = num_bufs;
513 517
514 return 0; 518 return 0;
515 519
520nomore_tx_bufs:
521 /*
522 * Failed to allocate desired buffer count. However, we may have
523 * enough to work fine, so we just free the extra urb,
524 * store the allocated count and keep going, fingers crossed!
525 */
526 usb_free_urb(dev->isoc_ctl.urb[i]);
527 dev->isoc_ctl.urb[i] = NULL;
528
529 stk1160_warn("%d urbs allocated. Trying to continue...\n", i - 1);
530
531 dev->isoc_ctl.num_bufs = i - 1;
532
533 return 0;
534
516free_i_bufs: 535free_i_bufs:
517 /* Save the allocated buffers so far, so we can properly free them */ 536 /* Save the allocated buffers so far, so we can properly free them */
518 dev->isoc_ctl.num_bufs = i+1; 537 dev->isoc_ctl.num_bufs = i+1;
diff --git a/drivers/media/usb/stk1160/stk1160.h b/drivers/media/usb/stk1160/stk1160.h
index 68c8707d36ab..05b05b160e1e 100644
--- a/drivers/media/usb/stk1160/stk1160.h
+++ b/drivers/media/usb/stk1160/stk1160.h
@@ -30,11 +30,12 @@
30#define STK1160_VERSION "0.9.5" 30#define STK1160_VERSION "0.9.5"
31#define STK1160_VERSION_NUM 0x000905 31#define STK1160_VERSION_NUM 0x000905
32 32
33/* TODO: Decide on number of packets for each buffer */ 33/* Decide on number of packets for each buffer */
34#define STK1160_NUM_PACKETS 64 34#define STK1160_NUM_PACKETS 64
35 35
36/* Number of buffers for isoc transfers */ 36/* Number of buffers for isoc transfers */
37#define STK1160_NUM_BUFS 16 /* TODO */ 37#define STK1160_NUM_BUFS 16
38#define STK1160_MIN_BUFS 1
38 39
39/* TODO: This endpoint address should be retrieved */ 40/* TODO: This endpoint address should be retrieved */
40#define STK1160_EP_VIDEO 0x82 41#define STK1160_EP_VIDEO 0x82
diff --git a/drivers/media/usb/stkwebcam/stk-webcam.c b/drivers/media/usb/stkwebcam/stk-webcam.c
index 86a0fc56c330..5d3c032d733c 100644
--- a/drivers/media/usb/stkwebcam/stk-webcam.c
+++ b/drivers/media/usb/stkwebcam/stk-webcam.c
@@ -54,10 +54,6 @@ MODULE_LICENSE("GPL");
54MODULE_AUTHOR("Jaime Velasco Juan <jsagarribay@gmail.com> and Nicolas VIVIEN"); 54MODULE_AUTHOR("Jaime Velasco Juan <jsagarribay@gmail.com> and Nicolas VIVIEN");
55MODULE_DESCRIPTION("Syntek DC1125 webcam driver"); 55MODULE_DESCRIPTION("Syntek DC1125 webcam driver");
56 56
57
58/* bool for webcam LED management */
59int first_init = 1;
60
61/* Some cameras have audio interfaces, we aren't interested in those */ 57/* Some cameras have audio interfaces, we aren't interested in those */
62static struct usb_device_id stkwebcam_table[] = { 58static struct usb_device_id stkwebcam_table[] = {
63 { USB_DEVICE_AND_INTERFACE_INFO(0x174f, 0xa311, 0xff, 0xff, 0xff) }, 59 { USB_DEVICE_AND_INTERFACE_INFO(0x174f, 0xa311, 0xff, 0xff, 0xff) },
@@ -554,6 +550,7 @@ static void stk_free_buffers(struct stk_camera *dev)
554 550
555static int v4l_stk_open(struct file *fp) 551static int v4l_stk_open(struct file *fp)
556{ 552{
553 static int first_init = 1; /* webcam LED management */
557 struct stk_camera *dev; 554 struct stk_camera *dev;
558 struct video_device *vdev; 555 struct video_device *vdev;
559 556
diff --git a/drivers/media/usb/tlg2300/pd-dvb.c b/drivers/media/usb/tlg2300/pd-dvb.c
index 30fcb117e898..ca4994a5190c 100644
--- a/drivers/media/usb/tlg2300/pd-dvb.c
+++ b/drivers/media/usb/tlg2300/pd-dvb.c
@@ -1,6 +1,7 @@
1#include "pd-common.h" 1#include "pd-common.h"
2#include <linux/kernel.h> 2#include <linux/kernel.h>
3#include <linux/usb.h> 3#include <linux/usb.h>
4#include <linux/time.h>
4#include <linux/dvb/dmx.h> 5#include <linux/dvb/dmx.h>
5#include <linux/delay.h> 6#include <linux/delay.h>
6#include <linux/gfp.h> 7#include <linux/gfp.h>
diff --git a/drivers/media/usb/tlg2300/pd-video.c b/drivers/media/usb/tlg2300/pd-video.c
index 1f448ac7a496..3082bfa9b2c5 100644
--- a/drivers/media/usb/tlg2300/pd-video.c
+++ b/drivers/media/usb/tlg2300/pd-video.c
@@ -888,7 +888,7 @@ static int vidioc_enum_input(struct file *file, void *fh, struct v4l2_input *in)
888{ 888{
889 struct front_face *front = fh; 889 struct front_face *front = fh;
890 890
891 if (in->index < 0 || in->index >= POSEIDON_INPUTS) 891 if (in->index >= POSEIDON_INPUTS)
892 return -EINVAL; 892 return -EINVAL;
893 strcpy(in->name, pd_inputs[in->index].name); 893 strcpy(in->name, pd_inputs[in->index].name);
894 in->type = V4L2_INPUT_TYPE_TUNER; 894 in->type = V4L2_INPUT_TYPE_TUNER;
@@ -923,7 +923,7 @@ static int vidioc_s_input(struct file *file, void *fh, unsigned int i)
923 struct poseidon *pd = front->pd; 923 struct poseidon *pd = front->pd;
924 s32 ret, cmd_status; 924 s32 ret, cmd_status;
925 925
926 if (i < 0 || i >= POSEIDON_INPUTS) 926 if (i >= POSEIDON_INPUTS)
927 return -EINVAL; 927 return -EINVAL;
928 ret = send_set_req(pd, SGNL_SRC_SEL, 928 ret = send_set_req(pd, SGNL_SRC_SEL,
929 pd_inputs[i].tlg_src, &cmd_status); 929 pd_inputs[i].tlg_src, &cmd_status);
diff --git a/drivers/media/usb/tm6000/tm6000-input.c b/drivers/media/usb/tm6000/tm6000-input.c
index dffbd4bd47b1..8a6bbf1d80e1 100644
--- a/drivers/media/usb/tm6000/tm6000-input.c
+++ b/drivers/media/usb/tm6000/tm6000-input.c
@@ -109,12 +109,12 @@ static int tm6000_ir_config(struct tm6000_IR *ir)
109 */ 109 */
110 110
111 switch (ir->rc_type) { 111 switch (ir->rc_type) {
112 case RC_TYPE_NEC: 112 case RC_BIT_NEC:
113 leader = 900; /* ms */ 113 leader = 900; /* ms */
114 pulse = 700; /* ms - the actual value would be 562 */ 114 pulse = 700; /* ms - the actual value would be 562 */
115 break; 115 break;
116 default: 116 default:
117 case RC_TYPE_RC5: 117 case RC_BIT_RC5:
118 leader = 900; /* ms - from the NEC decoding */ 118 leader = 900; /* ms - from the NEC decoding */
119 pulse = 1780; /* ms - The actual value would be 1776 */ 119 pulse = 1780; /* ms - The actual value would be 1776 */
120 break; 120 break;
@@ -122,12 +122,12 @@ static int tm6000_ir_config(struct tm6000_IR *ir)
122 122
123 pulse = ir_clock_mhz * pulse; 123 pulse = ir_clock_mhz * pulse;
124 leader = ir_clock_mhz * leader; 124 leader = ir_clock_mhz * leader;
125 if (ir->rc_type == RC_TYPE_NEC) 125 if (ir->rc_type == RC_BIT_NEC)
126 leader = leader | 0x8000; 126 leader = leader | 0x8000;
127 127
128 dprintk(2, "%s: %s, %d MHz, leader = 0x%04x, pulse = 0x%06x \n", 128 dprintk(2, "%s: %s, %d MHz, leader = 0x%04x, pulse = 0x%06x \n",
129 __func__, 129 __func__,
130 (ir->rc_type == RC_TYPE_NEC) ? "NEC" : "RC-5", 130 (ir->rc_type == RC_BIT_NEC) ? "NEC" : "RC-5",
131 ir_clock_mhz, leader, pulse); 131 ir_clock_mhz, leader, pulse);
132 132
133 /* Remote WAKEUP = enable, normal mode, from IR decoder output */ 133 /* Remote WAKEUP = enable, normal mode, from IR decoder output */
@@ -297,7 +297,7 @@ static void tm6000_ir_stop(struct rc_dev *rc)
297 cancel_delayed_work_sync(&ir->work); 297 cancel_delayed_work_sync(&ir->work);
298} 298}
299 299
300static int tm6000_ir_change_protocol(struct rc_dev *rc, u64 rc_type) 300static int tm6000_ir_change_protocol(struct rc_dev *rc, u64 *rc_type)
301{ 301{
302 struct tm6000_IR *ir = rc->priv; 302 struct tm6000_IR *ir = rc->priv;
303 303
@@ -306,10 +306,10 @@ static int tm6000_ir_change_protocol(struct rc_dev *rc, u64 rc_type)
306 306
307 dprintk(2, "%s\n",__func__); 307 dprintk(2, "%s\n",__func__);
308 308
309 if ((rc->rc_map.scan) && (rc_type == RC_TYPE_NEC)) 309 if ((rc->rc_map.scan) && (*rc_type == RC_BIT_NEC))
310 ir->key_addr = ((rc->rc_map.scan[0].scancode >> 8) & 0xffff); 310 ir->key_addr = ((rc->rc_map.scan[0].scancode >> 8) & 0xffff);
311 311
312 ir->rc_type = rc_type; 312 ir->rc_type = *rc_type;
313 313
314 tm6000_ir_config(ir); 314 tm6000_ir_config(ir);
315 /* TODO */ 315 /* TODO */
@@ -398,6 +398,7 @@ int tm6000_ir_init(struct tm6000_core *dev)
398 struct tm6000_IR *ir; 398 struct tm6000_IR *ir;
399 struct rc_dev *rc; 399 struct rc_dev *rc;
400 int err = -ENOMEM; 400 int err = -ENOMEM;
401 u64 rc_type;
401 402
402 if (!enable_ir) 403 if (!enable_ir)
403 return -ENODEV; 404 return -ENODEV;
@@ -421,7 +422,7 @@ int tm6000_ir_init(struct tm6000_core *dev)
421 ir->rc = rc; 422 ir->rc = rc;
422 423
423 /* input setup */ 424 /* input setup */
424 rc->allowed_protos = RC_TYPE_RC5 | RC_TYPE_NEC; 425 rc->allowed_protos = RC_BIT_RC5 | RC_BIT_NEC;
425 /* Neded, in order to support NEC remotes with 24 or 32 bits */ 426 /* Neded, in order to support NEC remotes with 24 or 32 bits */
426 rc->scanmask = 0xffff; 427 rc->scanmask = 0xffff;
427 rc->priv = ir; 428 rc->priv = ir;
@@ -444,7 +445,8 @@ int tm6000_ir_init(struct tm6000_core *dev)
444 usb_make_path(dev->udev, ir->phys, sizeof(ir->phys)); 445 usb_make_path(dev->udev, ir->phys, sizeof(ir->phys));
445 strlcat(ir->phys, "/input0", sizeof(ir->phys)); 446 strlcat(ir->phys, "/input0", sizeof(ir->phys));
446 447
447 tm6000_ir_change_protocol(rc, RC_TYPE_UNKNOWN); 448 rc_type = RC_BIT_UNKNOWN;
449 tm6000_ir_change_protocol(rc, &rc_type);
448 450
449 rc->input_name = ir->name; 451 rc->input_name = ir->name;
450 rc->input_phys = ir->phys; 452 rc->input_phys = ir->phys;
diff --git a/drivers/media/usb/tm6000/tm6000-video.c b/drivers/media/usb/tm6000/tm6000-video.c
index 4342cd4f5c8a..f656fd7a39a2 100644
--- a/drivers/media/usb/tm6000/tm6000-video.c
+++ b/drivers/media/usb/tm6000/tm6000-video.c
@@ -1802,6 +1802,7 @@ int tm6000_v4l2_register(struct tm6000_core *dev)
1802 if (!dev->radio_dev) { 1802 if (!dev->radio_dev) {
1803 printk(KERN_INFO "%s: can't register radio device\n", 1803 printk(KERN_INFO "%s: can't register radio device\n",
1804 dev->name); 1804 dev->name);
1805 ret = -ENXIO;
1805 return ret; /* FIXME release resource */ 1806 return ret; /* FIXME release resource */
1806 } 1807 }
1807 1808
diff --git a/drivers/media/usb/usbvision/usbvision-video.c b/drivers/media/usb/usbvision/usbvision-video.c
index 5c36a57e6590..ad7f7448072e 100644
--- a/drivers/media/usb/usbvision/usbvision-video.c
+++ b/drivers/media/usb/usbvision/usbvision-video.c
@@ -1363,7 +1363,7 @@ static void usbvision_unregister_video(struct usb_usbvision *usbvision)
1363} 1363}
1364 1364
1365/* register video4linux devices */ 1365/* register video4linux devices */
1366static int __devinit usbvision_register_video(struct usb_usbvision *usbvision) 1366static int usbvision_register_video(struct usb_usbvision *usbvision)
1367{ 1367{
1368 /* Video Device: */ 1368 /* Video Device: */
1369 usbvision->vdev = usbvision_vdev_init(usbvision, 1369 usbvision->vdev = usbvision_vdev_init(usbvision,
@@ -1510,8 +1510,8 @@ static void usbvision_configure_video(struct usb_usbvision *usbvision)
1510 * if it looks like USBVISION video device 1510 * if it looks like USBVISION video device
1511 * 1511 *
1512 */ 1512 */
1513static int __devinit usbvision_probe(struct usb_interface *intf, 1513static int usbvision_probe(struct usb_interface *intf,
1514 const struct usb_device_id *devid) 1514 const struct usb_device_id *devid)
1515{ 1515{
1516 struct usb_device *dev = usb_get_dev(interface_to_usbdev(intf)); 1516 struct usb_device *dev = usb_get_dev(interface_to_usbdev(intf));
1517 struct usb_interface *uif; 1517 struct usb_interface *uif;
@@ -1619,7 +1619,7 @@ static int __devinit usbvision_probe(struct usb_interface *intf,
1619 * with no ill consequences. 1619 * with no ill consequences.
1620 * 1620 *
1621 */ 1621 */
1622static void __devexit usbvision_disconnect(struct usb_interface *intf) 1622static void usbvision_disconnect(struct usb_interface *intf)
1623{ 1623{
1624 struct usb_usbvision *usbvision = to_usbvision(usb_get_intfdata(intf)); 1624 struct usb_usbvision *usbvision = to_usbvision(usb_get_intfdata(intf));
1625 1625
@@ -1664,7 +1664,7 @@ static struct usb_driver usbvision_driver = {
1664 .name = "usbvision", 1664 .name = "usbvision",
1665 .id_table = usbvision_table, 1665 .id_table = usbvision_table,
1666 .probe = usbvision_probe, 1666 .probe = usbvision_probe,
1667 .disconnect = __devexit_p(usbvision_disconnect), 1667 .disconnect = usbvision_disconnect,
1668}; 1668};
1669 1669
1670/* 1670/*
diff --git a/drivers/media/usb/usbvision/usbvision.h b/drivers/media/usb/usbvision/usbvision.h
index 43cf61fe4943..8a25876d72c6 100644
--- a/drivers/media/usb/usbvision/usbvision.h
+++ b/drivers/media/usb/usbvision/usbvision.h
@@ -167,7 +167,7 @@ enum {
167 167
168/* This macro restricts an int variable to an inclusive range */ 168/* This macro restricts an int variable to an inclusive range */
169#define RESTRICT_TO_RANGE(v, mi, ma) \ 169#define RESTRICT_TO_RANGE(v, mi, ma) \
170 { if ((v) < (mi)) (v) = (mi); else if ((v) > (ma)) (v) = (ma); } 170 { if (((int)v) < (mi)) (v) = (mi); else if ((v) > (ma)) (v) = (ma); }
171 171
172/* 172/*
173 * We use macros to do YUV -> RGB conversion because this is 173 * We use macros to do YUV -> RGB conversion because this is
diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
index f7061a5ef1d2..2bb7613ddebb 100644
--- a/drivers/media/usb/uvc/uvc_ctrl.c
+++ b/drivers/media/usb/uvc/uvc_ctrl.c
@@ -927,7 +927,7 @@ static int __uvc_ctrl_get(struct uvc_video_chain *chain,
927 int ret; 927 int ret;
928 928
929 if ((ctrl->info.flags & UVC_CTRL_FLAG_GET_CUR) == 0) 929 if ((ctrl->info.flags & UVC_CTRL_FLAG_GET_CUR) == 0)
930 return -EINVAL; 930 return -EACCES;
931 931
932 if (!ctrl->loaded) { 932 if (!ctrl->loaded) {
933 ret = uvc_query_ctrl(chain->dev, UVC_GET_CUR, ctrl->entity->id, 933 ret = uvc_query_ctrl(chain->dev, UVC_GET_CUR, ctrl->entity->id,
@@ -1452,8 +1452,12 @@ int uvc_ctrl_set(struct uvc_video_chain *chain,
1452 if (step == 0) 1452 if (step == 0)
1453 step = 1; 1453 step = 1;
1454 1454
1455 xctrl->value = min + (xctrl->value - min + step/2) / step * step; 1455 xctrl->value = min + ((u32)(xctrl->value - min) + step / 2)
1456 xctrl->value = clamp(xctrl->value, min, max); 1456 / step * step;
1457 if (mapping->data_type == UVC_CTRL_DATA_TYPE_SIGNED)
1458 xctrl->value = clamp(xctrl->value, min, max);
1459 else
1460 xctrl->value = clamp_t(u32, xctrl->value, min, max);
1457 value = xctrl->value; 1461 value = xctrl->value;
1458 break; 1462 break;
1459 1463
diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index 5967081747ce..5dbefa68b1d2 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -1562,6 +1562,9 @@ static int uvc_scan_device(struct uvc_device *dev)
1562 INIT_LIST_HEAD(&chain->entities); 1562 INIT_LIST_HEAD(&chain->entities);
1563 mutex_init(&chain->ctrl_mutex); 1563 mutex_init(&chain->ctrl_mutex);
1564 chain->dev = dev; 1564 chain->dev = dev;
1565 v4l2_prio_init(&chain->prio);
1566
1567 term->flags |= UVC_ENTITY_FLAG_DEFAULT;
1565 1568
1566 if (uvc_scan_chain(chain, term) < 0) { 1569 if (uvc_scan_chain(chain, term) < 0) {
1567 kfree(chain); 1570 kfree(chain);
@@ -1722,6 +1725,8 @@ static int uvc_register_video(struct uvc_device *dev,
1722 vdev->v4l2_dev = &dev->vdev; 1725 vdev->v4l2_dev = &dev->vdev;
1723 vdev->fops = &uvc_fops; 1726 vdev->fops = &uvc_fops;
1724 vdev->release = uvc_release; 1727 vdev->release = uvc_release;
1728 vdev->prio = &stream->chain->prio;
1729 set_bit(V4L2_FL_USE_FH_PRIO, &vdev->flags);
1725 if (stream->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) 1730 if (stream->type == V4L2_BUF_TYPE_VIDEO_OUTPUT)
1726 vdev->vfl_dir = VFL_DIR_TX; 1731 vdev->vfl_dir = VFL_DIR_TX;
1727 strlcpy(vdev->name, dev->name, sizeof vdev->name); 1732 strlcpy(vdev->name, dev->name, sizeof vdev->name);
@@ -1741,6 +1746,11 @@ static int uvc_register_video(struct uvc_device *dev,
1741 return ret; 1746 return ret;
1742 } 1747 }
1743 1748
1749 if (stream->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
1750 stream->chain->caps |= V4L2_CAP_VIDEO_CAPTURE;
1751 else
1752 stream->chain->caps |= V4L2_CAP_VIDEO_OUTPUT;
1753
1744 atomic_inc(&dev->nstreams); 1754 atomic_inc(&dev->nstreams);
1745 return 0; 1755 return 0;
1746} 1756}
diff --git a/drivers/media/usb/uvc/uvc_entity.c b/drivers/media/usb/uvc/uvc_entity.c
index 29e239911d0e..dc56a59ecadc 100644
--- a/drivers/media/usb/uvc/uvc_entity.c
+++ b/drivers/media/usb/uvc/uvc_entity.c
@@ -93,6 +93,8 @@ static int uvc_mc_init_entity(struct uvc_entity *entity)
93 } else if (entity->vdev != NULL) { 93 } else if (entity->vdev != NULL) {
94 ret = media_entity_init(&entity->vdev->entity, 94 ret = media_entity_init(&entity->vdev->entity,
95 entity->num_pads, entity->pads, 0); 95 entity->num_pads, entity->pads, 0);
96 if (entity->flags & UVC_ENTITY_FLAG_DEFAULT)
97 entity->vdev->entity.flags |= MEDIA_ENT_FL_DEFAULT;
96 } else 98 } else
97 ret = 0; 99 ret = 0;
98 100
diff --git a/drivers/media/usb/uvc/uvc_queue.c b/drivers/media/usb/uvc/uvc_queue.c
index 18a91fae6bc1..778addc5caff 100644
--- a/drivers/media/usb/uvc/uvc_queue.c
+++ b/drivers/media/usb/uvc/uvc_queue.c
@@ -128,7 +128,7 @@ int uvc_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type,
128 int ret; 128 int ret;
129 129
130 queue->queue.type = type; 130 queue->queue.type = type;
131 queue->queue.io_modes = VB2_MMAP | VB2_USERPTR; 131 queue->queue.io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF;
132 queue->queue.drv_priv = queue; 132 queue->queue.drv_priv = queue;
133 queue->queue.buf_struct_size = sizeof(struct uvc_buffer); 133 queue->queue.buf_struct_size = sizeof(struct uvc_buffer);
134 queue->queue.ops = &uvc_queue_qops; 134 queue->queue.ops = &uvc_queue_qops;
diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c
index f00db3060e0e..f2ee8c6b0d8d 100644
--- a/drivers/media/usb/uvc/uvc_v4l2.c
+++ b/drivers/media/usb/uvc/uvc_v4l2.c
@@ -165,17 +165,18 @@ static int uvc_v4l2_try_format(struct uvc_streaming *stream,
165 fcc[0], fcc[1], fcc[2], fcc[3], 165 fcc[0], fcc[1], fcc[2], fcc[3],
166 fmt->fmt.pix.width, fmt->fmt.pix.height); 166 fmt->fmt.pix.width, fmt->fmt.pix.height);
167 167
168 /* Check if the hardware supports the requested format. */ 168 /* Check if the hardware supports the requested format, use the default
169 * format otherwise.
170 */
169 for (i = 0; i < stream->nformats; ++i) { 171 for (i = 0; i < stream->nformats; ++i) {
170 format = &stream->format[i]; 172 format = &stream->format[i];
171 if (format->fcc == fmt->fmt.pix.pixelformat) 173 if (format->fcc == fmt->fmt.pix.pixelformat)
172 break; 174 break;
173 } 175 }
174 176
175 if (format == NULL || format->fcc != fmt->fmt.pix.pixelformat) { 177 if (i == stream->nformats) {
176 uvc_trace(UVC_TRACE_FORMAT, "Unsupported format 0x%08x.\n", 178 format = stream->def_format;
177 fmt->fmt.pix.pixelformat); 179 fmt->fmt.pix.pixelformat = format->fcc;
178 return -EINVAL;
179 } 180 }
180 181
181 /* Find the closest image size. The distance between image sizes is 182 /* Find the closest image size. The distance between image sizes is
@@ -564,15 +565,30 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
564 usb_make_path(stream->dev->udev, 565 usb_make_path(stream->dev->udev,
565 cap->bus_info, sizeof(cap->bus_info)); 566 cap->bus_info, sizeof(cap->bus_info));
566 cap->version = LINUX_VERSION_CODE; 567 cap->version = LINUX_VERSION_CODE;
568 cap->capabilities = V4L2_CAP_DEVICE_CAPS | V4L2_CAP_STREAMING
569 | chain->caps;
567 if (stream->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) 570 if (stream->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
568 cap->capabilities = V4L2_CAP_VIDEO_CAPTURE 571 cap->device_caps = V4L2_CAP_VIDEO_CAPTURE
569 | V4L2_CAP_STREAMING; 572 | V4L2_CAP_STREAMING;
570 else 573 else
571 cap->capabilities = V4L2_CAP_VIDEO_OUTPUT 574 cap->device_caps = V4L2_CAP_VIDEO_OUTPUT
572 | V4L2_CAP_STREAMING; 575 | V4L2_CAP_STREAMING;
573 break; 576 break;
574 } 577 }
575 578
579 /* Priority */
580 case VIDIOC_G_PRIORITY:
581 *(u32 *)arg = v4l2_prio_max(vdev->prio);
582 break;
583
584 case VIDIOC_S_PRIORITY:
585 ret = v4l2_prio_check(vdev->prio, handle->vfh.prio);
586 if (ret < 0)
587 return ret;
588
589 return v4l2_prio_change(vdev->prio, &handle->vfh.prio,
590 *(u32 *)arg);
591
576 /* Get, Set & Query control */ 592 /* Get, Set & Query control */
577 case VIDIOC_QUERYCTRL: 593 case VIDIOC_QUERYCTRL:
578 return uvc_query_v4l2_ctrl(chain, arg); 594 return uvc_query_v4l2_ctrl(chain, arg);
@@ -601,6 +617,10 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
601 struct v4l2_control *ctrl = arg; 617 struct v4l2_control *ctrl = arg;
602 struct v4l2_ext_control xctrl; 618 struct v4l2_ext_control xctrl;
603 619
620 ret = v4l2_prio_check(vdev->prio, handle->vfh.prio);
621 if (ret < 0)
622 return ret;
623
604 memset(&xctrl, 0, sizeof xctrl); 624 memset(&xctrl, 0, sizeof xctrl);
605 xctrl.id = ctrl->id; 625 xctrl.id = ctrl->id;
606 xctrl.value = ctrl->value; 626 xctrl.value = ctrl->value;
@@ -637,7 +657,8 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
637 ret = uvc_ctrl_get(chain, ctrl); 657 ret = uvc_ctrl_get(chain, ctrl);
638 if (ret < 0) { 658 if (ret < 0) {
639 uvc_ctrl_rollback(handle); 659 uvc_ctrl_rollback(handle);
640 ctrls->error_idx = i; 660 ctrls->error_idx = ret == -ENOENT
661 ? ctrls->count : i;
641 return ret; 662 return ret;
642 } 663 }
643 } 664 }
@@ -647,6 +668,10 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
647 } 668 }
648 669
649 case VIDIOC_S_EXT_CTRLS: 670 case VIDIOC_S_EXT_CTRLS:
671 ret = v4l2_prio_check(vdev->prio, handle->vfh.prio);
672 if (ret < 0)
673 return ret;
674 /* Fall through */
650 case VIDIOC_TRY_EXT_CTRLS: 675 case VIDIOC_TRY_EXT_CTRLS:
651 { 676 {
652 struct v4l2_ext_controls *ctrls = arg; 677 struct v4l2_ext_controls *ctrls = arg;
@@ -661,7 +686,9 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
661 ret = uvc_ctrl_set(chain, ctrl); 686 ret = uvc_ctrl_set(chain, ctrl);
662 if (ret < 0) { 687 if (ret < 0) {
663 uvc_ctrl_rollback(handle); 688 uvc_ctrl_rollback(handle);
664 ctrls->error_idx = i; 689 ctrls->error_idx = (ret == -ENOENT &&
690 cmd == VIDIOC_S_EXT_CTRLS)
691 ? ctrls->count : i;
665 return ret; 692 return ret;
666 } 693 }
667 } 694 }
@@ -739,6 +766,10 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
739 { 766 {
740 u32 input = *(u32 *)arg + 1; 767 u32 input = *(u32 *)arg + 1;
741 768
769 ret = v4l2_prio_check(vdev->prio, handle->vfh.prio);
770 if (ret < 0)
771 return ret;
772
742 if ((ret = uvc_acquire_privileges(handle)) < 0) 773 if ((ret = uvc_acquire_privileges(handle)) < 0)
743 return ret; 774 return ret;
744 775
@@ -792,6 +823,10 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
792 } 823 }
793 824
794 case VIDIOC_S_FMT: 825 case VIDIOC_S_FMT:
826 ret = v4l2_prio_check(vdev->prio, handle->vfh.prio);
827 if (ret < 0)
828 return ret;
829
795 if ((ret = uvc_acquire_privileges(handle)) < 0) 830 if ((ret = uvc_acquire_privileges(handle)) < 0)
796 return ret; 831 return ret;
797 832
@@ -894,6 +929,10 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
894 return uvc_v4l2_get_streamparm(stream, arg); 929 return uvc_v4l2_get_streamparm(stream, arg);
895 930
896 case VIDIOC_S_PARM: 931 case VIDIOC_S_PARM:
932 ret = v4l2_prio_check(vdev->prio, handle->vfh.prio);
933 if (ret < 0)
934 return ret;
935
897 if ((ret = uvc_acquire_privileges(handle)) < 0) 936 if ((ret = uvc_acquire_privileges(handle)) < 0)
898 return ret; 937 return ret;
899 938
@@ -924,10 +963,14 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
924 963
925 case VIDIOC_G_CROP: 964 case VIDIOC_G_CROP:
926 case VIDIOC_S_CROP: 965 case VIDIOC_S_CROP:
927 return -EINVAL; 966 return -ENOTTY;
928 967
929 /* Buffers & streaming */ 968 /* Buffers & streaming */
930 case VIDIOC_REQBUFS: 969 case VIDIOC_REQBUFS:
970 ret = v4l2_prio_check(vdev->prio, handle->vfh.prio);
971 if (ret < 0)
972 return ret;
973
931 if ((ret = uvc_acquire_privileges(handle)) < 0) 974 if ((ret = uvc_acquire_privileges(handle)) < 0)
932 return ret; 975 return ret;
933 976
@@ -973,6 +1016,10 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
973 if (*type != stream->type) 1016 if (*type != stream->type)
974 return -EINVAL; 1017 return -EINVAL;
975 1018
1019 ret = v4l2_prio_check(vdev->prio, handle->vfh.prio);
1020 if (ret < 0)
1021 return ret;
1022
976 if (!uvc_has_privileges(handle)) 1023 if (!uvc_has_privileges(handle))
977 return -EBUSY; 1024 return -EBUSY;
978 1025
@@ -991,6 +1038,10 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
991 if (*type != stream->type) 1038 if (*type != stream->type)
992 return -EINVAL; 1039 return -EINVAL;
993 1040
1041 ret = v4l2_prio_check(vdev->prio, handle->vfh.prio);
1042 if (ret < 0)
1043 return ret;
1044
994 if (!uvc_has_privileges(handle)) 1045 if (!uvc_has_privileges(handle))
995 return -EBUSY; 1046 return -EBUSY;
996 1047
@@ -1030,7 +1081,7 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
1030 1081
1031 case VIDIOC_ENUMOUTPUT: 1082 case VIDIOC_ENUMOUTPUT:
1032 uvc_trace(UVC_TRACE_IOCTL, "Unsupported ioctl 0x%08x\n", cmd); 1083 uvc_trace(UVC_TRACE_IOCTL, "Unsupported ioctl 0x%08x\n", cmd);
1033 return -EINVAL; 1084 return -ENOTTY;
1034 1085
1035 case UVCIOC_CTRL_MAP: 1086 case UVCIOC_CTRL_MAP:
1036 return uvc_ioctl_ctrl_map(chain, arg); 1087 return uvc_ioctl_ctrl_map(chain, arg);
diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c
index 57c3076a4625..3394c3432011 100644
--- a/drivers/media/usb/uvc/uvc_video.c
+++ b/drivers/media/usb/uvc/uvc_video.c
@@ -1812,6 +1812,7 @@ int uvc_video_init(struct uvc_streaming *stream)
1812 probe->bFormatIndex = format->index; 1812 probe->bFormatIndex = format->index;
1813 probe->bFrameIndex = frame->bFrameIndex; 1813 probe->bFrameIndex = frame->bFrameIndex;
1814 1814
1815 stream->def_format = format;
1815 stream->cur_format = format; 1816 stream->cur_format = format;
1816 stream->cur_frame = frame; 1817 stream->cur_frame = frame;
1817 1818
diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h
index af216ec45e39..af505fdd9b3f 100644
--- a/drivers/media/usb/uvc/uvcvideo.h
+++ b/drivers/media/usb/uvc/uvcvideo.h
@@ -225,10 +225,14 @@ struct uvc_format_desc {
225 * always be accessed with the UVC_ENTITY_* macros and never directly. 225 * always be accessed with the UVC_ENTITY_* macros and never directly.
226 */ 226 */
227 227
228#define UVC_ENTITY_FLAG_DEFAULT (1 << 0)
229
228struct uvc_entity { 230struct uvc_entity {
229 struct list_head list; /* Entity as part of a UVC device. */ 231 struct list_head list; /* Entity as part of a UVC device. */
230 struct list_head chain; /* Entity as part of a video device 232 struct list_head chain; /* Entity as part of a video device
231 * chain. */ 233 * chain. */
234 unsigned int flags;
235
232 __u8 id; 236 __u8 id;
233 __u16 type; 237 __u16 type;
234 char name[64]; 238 char name[64];
@@ -371,6 +375,9 @@ struct uvc_video_chain {
371 struct uvc_entity *selector; /* Selector unit */ 375 struct uvc_entity *selector; /* Selector unit */
372 376
373 struct mutex ctrl_mutex; /* Protects ctrl.info */ 377 struct mutex ctrl_mutex; /* Protects ctrl.info */
378
379 struct v4l2_prio_state prio; /* V4L2 priority state */
380 u32 caps; /* V4L2 chain-wide caps */
374}; 381};
375 382
376struct uvc_stats_frame { 383struct uvc_stats_frame {
@@ -436,6 +443,7 @@ struct uvc_streaming {
436 struct uvc_format *format; 443 struct uvc_format *format;
437 444
438 struct uvc_streaming_control ctrl; 445 struct uvc_streaming_control ctrl;
446 struct uvc_format *def_format;
439 struct uvc_format *cur_format; 447 struct uvc_format *cur_format;
440 struct uvc_frame *cur_frame; 448 struct uvc_frame *cur_frame;
441 /* Protect access to ctrl, cur_format, cur_frame and hardware video 449 /* Protect access to ctrl, cur_format, cur_frame and hardware video
diff --git a/drivers/media/usb/zr364xx/zr364xx.c b/drivers/media/usb/zr364xx/zr364xx.c
index 9afab35878b4..39edd4442932 100644
--- a/drivers/media/usb/zr364xx/zr364xx.c
+++ b/drivers/media/usb/zr364xx/zr364xx.c
@@ -1007,8 +1007,7 @@ static void read_pipe_completion(struct urb *purb)
1007 return; 1007 return;
1008 } 1008 }
1009 1009
1010 if (purb->actual_length < 0 || 1010 if (purb->actual_length > pipe_info->transfer_size) {
1011 purb->actual_length > pipe_info->transfer_size) {
1012 dev_err(&cam->udev->dev, "wrong number of bytes\n"); 1011 dev_err(&cam->udev->dev, "wrong number of bytes\n");
1013 return; 1012 return;
1014 } 1013 }