aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/rc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-10-10 22:04:49 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-10-10 22:04:49 -0400
commit4d9708ea5e5a45973df7cf965805fdfb185dd5bf (patch)
tree833a918e85f1e3bff8cb182517707d12836d10a8 /drivers/media/rc
parent754c780953397dd5ee5191b7b3ca67e09088ce7a (diff)
parenta66d05d504a24894a8fdf11e4569752f313e5764 (diff)
Merge tag 'media/v3.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media updates from Mauro Carvalho Chehab: - new IR driver: hix5hd2-ir - the virtual test driver (vivi) was replaced by vivid, with has an almost complete set of features to emulate most v4l2 devices and properly test all sorts of userspace apps - the as102 driver had several bugs fixed and was properly split into a frontend and a core driver. With that, it got promoted from staging into mainstream - one new CI driver got added for CIMaX SP2/SP2HF (sp2 driver) - one new frontend driver for Toshiba ISDB-T/ISDB-S demod (tc90522) - one new PCI driver for ISDB-T/ISDB-S (pt3 driver) - saa7134 driver got support for go7007-based devices - added a new PCI driver for Techwell 68xx chipsets (tw68) - a new platform driver was added (coda) - new tuner drivers: mxl301rf and qm1d1c0042 - a new DVB USB driver was added for DVBSky S860 & similar devices - added a new SDR driver (hackrf) - usbtv got audio support - several platform drivers are now compiled with COMPILE_TEST - a series of compiler fixup patches, making sparse/spatch happier with the media stuff and removing several warnings, especially on those platform drivers that didn't use to compile on x86 - Support for several new modern devices got added - lots of other fixes, improvements and cleanups * tag 'media/v3.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (544 commits) [media] ir-hix5hd2: fix build on c6x arch [media] pt3: fix DTV FE I2C driver load error paths Revert "[media] media: em28xx - remove reset_resume interface" [media] exynos4-is: fix some warnings when compiling on arm64 [media] usb drivers: use %zu instead of %zd [media] pci drivers: use %zu instead of %zd [media] dvb-frontends: use %zu instead of %zd [media] s5p-mfc: Fix several printk warnings [media] s5p_mfc_opr: Fix warnings [media] ti-vpe: Fix typecast [media] s3c-camif: fix dma_addr_t printks [media] s5p_mfc_opr_v6: get rid of warnings when compiled with 64 bits [media] s5p_mfc_opr_v5: Fix lots of warnings on x86_64 [media] em28xx: Fix identation [media] drxd: remove a dead code [media] saa7146: remove return after BUG() [media] cx88: remove return after BUG() [media] cx88: fix cards table CodingStyle [media] radio-sf16fmr2: declare some structs as static [media] radio-sf16fmi: declare pnp_attached as static ...
Diffstat (limited to 'drivers/media/rc')
-rw-r--r--drivers/media/rc/Kconfig15
-rw-r--r--drivers/media/rc/Makefile1
-rw-r--r--drivers/media/rc/ene_ir.c2
-rw-r--r--drivers/media/rc/fintek-cir.c6
-rw-r--r--drivers/media/rc/img-ir/img-ir-hw.c6
-rw-r--r--drivers/media/rc/img-ir/img-ir-hw.h6
-rw-r--r--drivers/media/rc/imon.c304
-rw-r--r--drivers/media/rc/ir-hix5hd2.c351
-rw-r--r--drivers/media/rc/ite-cir.c3
-rw-r--r--drivers/media/rc/keymaps/Makefile1
-rw-r--r--drivers/media/rc/keymaps/rc-dvbsky.c78
-rw-r--r--drivers/media/rc/lirc_dev.c14
-rw-r--r--drivers/media/rc/mceusb.c15
-rw-r--r--drivers/media/rc/nuvoton-cir.c6
-rw-r--r--drivers/media/rc/st_rc.c16
-rw-r--r--drivers/media/rc/streamzap.c6
16 files changed, 688 insertions, 142 deletions
diff --git a/drivers/media/rc/Kconfig b/drivers/media/rc/Kconfig
index 5e626af8e313..8ce08107a69d 100644
--- a/drivers/media/rc/Kconfig
+++ b/drivers/media/rc/Kconfig
@@ -164,6 +164,16 @@ config IR_ENE
164 To compile this driver as a module, choose M here: the 164 To compile this driver as a module, choose M here: the
165 module will be called ene_ir. 165 module will be called ene_ir.
166 166
167config IR_HIX5HD2
168 tristate "Hisilicon hix5hd2 IR remote control"
169 depends on RC_CORE
170 help
171 Say Y here if you want to use hisilicon hix5hd2 remote control.
172 To compile this driver as a module, choose M here: the module will be
173 called ir-hix5hd2.
174
175 If you're not sure, select N here
176
167config IR_IMON 177config IR_IMON
168 tristate "SoundGraph iMON Receiver and Display" 178 tristate "SoundGraph iMON Receiver and Display"
169 depends on USB_ARCH_HAS_HCD 179 depends on USB_ARCH_HAS_HCD
@@ -333,7 +343,8 @@ config IR_GPIO_CIR
333 343
334config RC_ST 344config RC_ST
335 tristate "ST remote control receiver" 345 tristate "ST remote control receiver"
336 depends on ARCH_STI && RC_CORE 346 depends on RC_CORE
347 depends on ARCH_STI || COMPILE_TEST
337 help 348 help
338 Say Y here if you want support for ST remote control driver 349 Say Y here if you want support for ST remote control driver
339 which allows both IR and UHF RX. 350 which allows both IR and UHF RX.
@@ -344,7 +355,7 @@ config RC_ST
344config IR_SUNXI 355config IR_SUNXI
345 tristate "SUNXI IR remote control" 356 tristate "SUNXI IR remote control"
346 depends on RC_CORE 357 depends on RC_CORE
347 depends on ARCH_SUNXI 358 depends on ARCH_SUNXI || COMPILE_TEST
348 ---help--- 359 ---help---
349 Say Y if you want to use sunXi internal IR Controller 360 Say Y if you want to use sunXi internal IR Controller
350 361
diff --git a/drivers/media/rc/Makefile b/drivers/media/rc/Makefile
index 9f9843a1af5f..0989f940e9cf 100644
--- a/drivers/media/rc/Makefile
+++ b/drivers/media/rc/Makefile
@@ -17,6 +17,7 @@ obj-$(CONFIG_IR_XMP_DECODER) += ir-xmp-decoder.o
17 17
18# stand-alone IR receivers/transmitters 18# stand-alone IR receivers/transmitters
19obj-$(CONFIG_RC_ATI_REMOTE) += ati_remote.o 19obj-$(CONFIG_RC_ATI_REMOTE) += ati_remote.o
20obj-$(CONFIG_IR_HIX5HD2) += ir-hix5hd2.o
20obj-$(CONFIG_IR_IMON) += imon.o 21obj-$(CONFIG_IR_IMON) += imon.o
21obj-$(CONFIG_IR_ITE_CIR) += ite-cir.o 22obj-$(CONFIG_IR_ITE_CIR) += ite-cir.o
22obj-$(CONFIG_IR_MCEUSB) += mceusb.o 23obj-$(CONFIG_IR_MCEUSB) += mceusb.o
diff --git a/drivers/media/rc/ene_ir.c b/drivers/media/rc/ene_ir.c
index d16d9b496b92..e80f2c6c5f1a 100644
--- a/drivers/media/rc/ene_ir.c
+++ b/drivers/media/rc/ene_ir.c
@@ -979,7 +979,7 @@ static int ene_transmit(struct rc_dev *rdev, unsigned *buf, unsigned n)
979 dev->tx_reg = 0; 979 dev->tx_reg = 0;
980 dev->tx_done = 0; 980 dev->tx_done = 0;
981 dev->tx_sample = 0; 981 dev->tx_sample = 0;
982 dev->tx_sample_pulse = 0; 982 dev->tx_sample_pulse = false;
983 983
984 dbg("TX: %d samples", dev->tx_len); 984 dbg("TX: %d samples", dev->tx_len);
985 985
diff --git a/drivers/media/rc/fintek-cir.c b/drivers/media/rc/fintek-cir.c
index f0a1f7d31ee6..b5167573240e 100644
--- a/drivers/media/rc/fintek-cir.c
+++ b/drivers/media/rc/fintek-cir.c
@@ -148,7 +148,6 @@ static int fintek_hw_detect(struct fintek_dev *fintek)
148 u8 vendor_major, vendor_minor; 148 u8 vendor_major, vendor_minor;
149 u8 portsel, ir_class; 149 u8 portsel, ir_class;
150 u16 vendor, chip; 150 u16 vendor, chip;
151 int ret = 0;
152 151
153 fintek_config_mode_enable(fintek); 152 fintek_config_mode_enable(fintek);
154 153
@@ -208,7 +207,7 @@ static int fintek_hw_detect(struct fintek_dev *fintek)
208 207
209 spin_unlock_irqrestore(&fintek->fintek_lock, flags); 208 spin_unlock_irqrestore(&fintek->fintek_lock, flags);
210 209
211 return ret; 210 return 0;
212} 211}
213 212
214static void fintek_cir_ldev_init(struct fintek_dev *fintek) 213static void fintek_cir_ldev_init(struct fintek_dev *fintek)
@@ -644,7 +643,6 @@ static int fintek_suspend(struct pnp_dev *pdev, pm_message_t state)
644 643
645static int fintek_resume(struct pnp_dev *pdev) 644static int fintek_resume(struct pnp_dev *pdev)
646{ 645{
647 int ret = 0;
648 struct fintek_dev *fintek = pnp_get_drvdata(pdev); 646 struct fintek_dev *fintek = pnp_get_drvdata(pdev);
649 647
650 fit_dbg("%s called", __func__); 648 fit_dbg("%s called", __func__);
@@ -661,7 +659,7 @@ static int fintek_resume(struct pnp_dev *pdev)
661 659
662 fintek_cir_regs_init(fintek); 660 fintek_cir_regs_init(fintek);
663 661
664 return ret; 662 return 0;
665} 663}
666 664
667static void fintek_shutdown(struct pnp_dev *pdev) 665static void fintek_shutdown(struct pnp_dev *pdev)
diff --git a/drivers/media/rc/img-ir/img-ir-hw.c b/drivers/media/rc/img-ir/img-ir-hw.c
index bfb282a714e8..ec49f94425fc 100644
--- a/drivers/media/rc/img-ir/img-ir-hw.c
+++ b/drivers/media/rc/img-ir/img-ir-hw.c
@@ -25,12 +25,6 @@
25/* Decoders lock (only modified to preprocess them) */ 25/* Decoders lock (only modified to preprocess them) */
26static DEFINE_SPINLOCK(img_ir_decoders_lock); 26static DEFINE_SPINLOCK(img_ir_decoders_lock);
27 27
28extern struct img_ir_decoder img_ir_nec;
29extern struct img_ir_decoder img_ir_jvc;
30extern struct img_ir_decoder img_ir_sony;
31extern struct img_ir_decoder img_ir_sharp;
32extern struct img_ir_decoder img_ir_sanyo;
33
34static bool img_ir_decoders_preprocessed; 28static bool img_ir_decoders_preprocessed;
35static struct img_ir_decoder *img_ir_decoders[] = { 29static struct img_ir_decoder *img_ir_decoders[] = {
36#ifdef CONFIG_IR_IMG_NEC 30#ifdef CONFIG_IR_IMG_NEC
diff --git a/drivers/media/rc/img-ir/img-ir-hw.h b/drivers/media/rc/img-ir/img-ir-hw.h
index 3e40ce87b898..8fcc16c32c5b 100644
--- a/drivers/media/rc/img-ir/img-ir-hw.h
+++ b/drivers/media/rc/img-ir/img-ir-hw.h
@@ -168,6 +168,12 @@ struct img_ir_decoder {
168 struct img_ir_filter *out, u64 protocols); 168 struct img_ir_filter *out, u64 protocols);
169}; 169};
170 170
171extern struct img_ir_decoder img_ir_nec;
172extern struct img_ir_decoder img_ir_jvc;
173extern struct img_ir_decoder img_ir_sony;
174extern struct img_ir_decoder img_ir_sharp;
175extern struct img_ir_decoder img_ir_sanyo;
176
171/** 177/**
172 * struct img_ir_reg_timings - Reg values for decoder timings at clock rate. 178 * struct img_ir_reg_timings - Reg values for decoder timings at clock rate.
173 * @ctrl: Processed control register value. 179 * @ctrl: Processed control register value.
diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c
index 7115e68ba697..b8837dd39bb2 100644
--- a/drivers/media/rc/imon.c
+++ b/drivers/media/rc/imon.c
@@ -87,6 +87,18 @@ static ssize_t lcd_write(struct file *file, const char __user *buf,
87 87
88/*** G L O B A L S ***/ 88/*** G L O B A L S ***/
89 89
90struct imon_panel_key_table {
91 u64 hw_code;
92 u32 keycode;
93};
94
95struct imon_usb_dev_descr {
96 __u16 flags;
97#define IMON_NO_FLAGS 0
98#define IMON_NEED_20MS_PKT_DELAY 1
99 struct imon_panel_key_table key_table[];
100};
101
90struct imon_context { 102struct imon_context {
91 struct device *dev; 103 struct device *dev;
92 /* Newer devices have two interfaces */ 104 /* Newer devices have two interfaces */
@@ -150,6 +162,8 @@ struct imon_context {
150 struct timer_list ttimer; /* touch screen timer */ 162 struct timer_list ttimer; /* touch screen timer */
151 int touch_x; /* x coordinate on touchscreen */ 163 int touch_x; /* x coordinate on touchscreen */
152 int touch_y; /* y coordinate on touchscreen */ 164 int touch_y; /* y coordinate on touchscreen */
165 struct imon_usb_dev_descr *dev_descr; /* device description with key
166 table for front panels */
153}; 167};
154 168
155#define TOUCH_TIMEOUT (HZ/30) 169#define TOUCH_TIMEOUT (HZ/30)
@@ -186,8 +200,132 @@ enum {
186 IMON_KEY_PANEL = 2, 200 IMON_KEY_PANEL = 2,
187}; 201};
188 202
189enum { 203static struct usb_class_driver imon_vfd_class = {
190 IMON_NEED_20MS_PKT_DELAY = 1 204 .name = DEVICE_NAME,
205 .fops = &vfd_fops,
206 .minor_base = DISPLAY_MINOR_BASE,
207};
208
209static struct usb_class_driver imon_lcd_class = {
210 .name = DEVICE_NAME,
211 .fops = &lcd_fops,
212 .minor_base = DISPLAY_MINOR_BASE,
213};
214
215/* imon receiver front panel/knob key table */
216static const struct imon_usb_dev_descr imon_default_table = {
217 .flags = IMON_NO_FLAGS,
218 .key_table = {
219 { 0x000000000f00ffeell, KEY_MEDIA }, /* Go */
220 { 0x000000001200ffeell, KEY_UP },
221 { 0x000000001300ffeell, KEY_DOWN },
222 { 0x000000001400ffeell, KEY_LEFT },
223 { 0x000000001500ffeell, KEY_RIGHT },
224 { 0x000000001600ffeell, KEY_ENTER },
225 { 0x000000001700ffeell, KEY_ESC },
226 { 0x000000001f00ffeell, KEY_AUDIO },
227 { 0x000000002000ffeell, KEY_VIDEO },
228 { 0x000000002100ffeell, KEY_CAMERA },
229 { 0x000000002700ffeell, KEY_DVD },
230 { 0x000000002300ffeell, KEY_TV },
231 { 0x000000002b00ffeell, KEY_EXIT },
232 { 0x000000002c00ffeell, KEY_SELECT },
233 { 0x000000002d00ffeell, KEY_MENU },
234 { 0x000000000500ffeell, KEY_PREVIOUS },
235 { 0x000000000700ffeell, KEY_REWIND },
236 { 0x000000000400ffeell, KEY_STOP },
237 { 0x000000003c00ffeell, KEY_PLAYPAUSE },
238 { 0x000000000800ffeell, KEY_FASTFORWARD },
239 { 0x000000000600ffeell, KEY_NEXT },
240 { 0x000000010000ffeell, KEY_RIGHT },
241 { 0x000001000000ffeell, KEY_LEFT },
242 { 0x000000003d00ffeell, KEY_SELECT },
243 { 0x000100000000ffeell, KEY_VOLUMEUP },
244 { 0x010000000000ffeell, KEY_VOLUMEDOWN },
245 { 0x000000000100ffeell, KEY_MUTE },
246 /* 0xffdc iMON MCE VFD */
247 { 0x00010000ffffffeell, KEY_VOLUMEUP },
248 { 0x01000000ffffffeell, KEY_VOLUMEDOWN },
249 { 0x00000001ffffffeell, KEY_MUTE },
250 { 0x0000000fffffffeell, KEY_MEDIA },
251 { 0x00000012ffffffeell, KEY_UP },
252 { 0x00000013ffffffeell, KEY_DOWN },
253 { 0x00000014ffffffeell, KEY_LEFT },
254 { 0x00000015ffffffeell, KEY_RIGHT },
255 { 0x00000016ffffffeell, KEY_ENTER },
256 { 0x00000017ffffffeell, KEY_ESC },
257 /* iMON Knob values */
258 { 0x000100ffffffffeell, KEY_VOLUMEUP },
259 { 0x010000ffffffffeell, KEY_VOLUMEDOWN },
260 { 0x000008ffffffffeell, KEY_MUTE },
261 { 0, KEY_RESERVED },
262 }
263};
264
265static const struct imon_usb_dev_descr imon_OEM_VFD = {
266 .flags = IMON_NEED_20MS_PKT_DELAY,
267 .key_table = {
268 { 0x000000000f00ffeell, KEY_MEDIA }, /* Go */
269 { 0x000000001200ffeell, KEY_UP },
270 { 0x000000001300ffeell, KEY_DOWN },
271 { 0x000000001400ffeell, KEY_LEFT },
272 { 0x000000001500ffeell, KEY_RIGHT },
273 { 0x000000001600ffeell, KEY_ENTER },
274 { 0x000000001700ffeell, KEY_ESC },
275 { 0x000000001f00ffeell, KEY_AUDIO },
276 { 0x000000002b00ffeell, KEY_EXIT },
277 { 0x000000002c00ffeell, KEY_SELECT },
278 { 0x000000002d00ffeell, KEY_MENU },
279 { 0x000000000500ffeell, KEY_PREVIOUS },
280 { 0x000000000700ffeell, KEY_REWIND },
281 { 0x000000000400ffeell, KEY_STOP },
282 { 0x000000003c00ffeell, KEY_PLAYPAUSE },
283 { 0x000000000800ffeell, KEY_FASTFORWARD },
284 { 0x000000000600ffeell, KEY_NEXT },
285 { 0x000000010000ffeell, KEY_RIGHT },
286 { 0x000001000000ffeell, KEY_LEFT },
287 { 0x000000003d00ffeell, KEY_SELECT },
288 { 0x000100000000ffeell, KEY_VOLUMEUP },
289 { 0x010000000000ffeell, KEY_VOLUMEDOWN },
290 { 0x000000000100ffeell, KEY_MUTE },
291 /* 0xffdc iMON MCE VFD */
292 { 0x00010000ffffffeell, KEY_VOLUMEUP },
293 { 0x01000000ffffffeell, KEY_VOLUMEDOWN },
294 { 0x00000001ffffffeell, KEY_MUTE },
295 { 0x0000000fffffffeell, KEY_MEDIA },
296 { 0x00000012ffffffeell, KEY_UP },
297 { 0x00000013ffffffeell, KEY_DOWN },
298 { 0x00000014ffffffeell, KEY_LEFT },
299 { 0x00000015ffffffeell, KEY_RIGHT },
300 { 0x00000016ffffffeell, KEY_ENTER },
301 { 0x00000017ffffffeell, KEY_ESC },
302 /* iMON Knob values */
303 { 0x000100ffffffffeell, KEY_VOLUMEUP },
304 { 0x010000ffffffffeell, KEY_VOLUMEDOWN },
305 { 0x000008ffffffffeell, KEY_MUTE },
306 { 0, KEY_RESERVED },
307 }
308};
309
310/* imon receiver front panel/knob key table for DH102*/
311static const struct imon_usb_dev_descr imon_DH102 = {
312 .flags = IMON_NO_FLAGS,
313 .key_table = {
314 { 0x000100000000ffeell, KEY_VOLUMEUP },
315 { 0x010000000000ffeell, KEY_VOLUMEDOWN },
316 { 0x000000010000ffeell, KEY_MUTE },
317 { 0x0000000f0000ffeell, KEY_MEDIA },
318 { 0x000000120000ffeell, KEY_UP },
319 { 0x000000130000ffeell, KEY_DOWN },
320 { 0x000000140000ffeell, KEY_LEFT },
321 { 0x000000150000ffeell, KEY_RIGHT },
322 { 0x000000160000ffeell, KEY_ENTER },
323 { 0x000000170000ffeell, KEY_ESC },
324 { 0x0000002b0000ffeell, KEY_EXIT },
325 { 0x0000002c0000ffeell, KEY_SELECT },
326 { 0x0000002d0000ffeell, KEY_MENU },
327 { 0, KEY_RESERVED }
328 }
191}; 329};
192 330
193/* 331/*
@@ -208,7 +346,8 @@ static struct usb_device_id imon_usb_id_table[] = {
208 * SoundGraph iMON PAD (IR & LCD) 346 * SoundGraph iMON PAD (IR & LCD)
209 * SoundGraph iMON Knob (IR only) 347 * SoundGraph iMON Knob (IR only)
210 */ 348 */
211 { USB_DEVICE(0x15c2, 0xffdc) }, 349 { USB_DEVICE(0x15c2, 0xffdc),
350 .driver_info = (unsigned long)&imon_default_table },
212 351
213 /* 352 /*
214 * Newer devices, all driven by the latest iMON Windows driver, full 353 * Newer devices, all driven by the latest iMON Windows driver, full
@@ -216,43 +355,62 @@ static struct usb_device_id imon_usb_id_table[] = {
216 * Need user input to fill in details on unknown devices. 355 * Need user input to fill in details on unknown devices.
217 */ 356 */
218 /* SoundGraph iMON OEM Touch LCD (IR & 7" VGA LCD) */ 357 /* SoundGraph iMON OEM Touch LCD (IR & 7" VGA LCD) */
219 { USB_DEVICE(0x15c2, 0x0034) }, 358 { USB_DEVICE(0x15c2, 0x0034),
359 .driver_info = (unsigned long)&imon_DH102 },
220 /* SoundGraph iMON OEM Touch LCD (IR & 4.3" VGA LCD) */ 360 /* SoundGraph iMON OEM Touch LCD (IR & 4.3" VGA LCD) */
221 { USB_DEVICE(0x15c2, 0x0035) }, 361 { USB_DEVICE(0x15c2, 0x0035),
362 .driver_info = (unsigned long)&imon_default_table},
222 /* SoundGraph iMON OEM VFD (IR & VFD) */ 363 /* SoundGraph iMON OEM VFD (IR & VFD) */
223 { USB_DEVICE(0x15c2, 0x0036), .driver_info = IMON_NEED_20MS_PKT_DELAY }, 364 { USB_DEVICE(0x15c2, 0x0036),
365 .driver_info = (unsigned long)&imon_OEM_VFD },
224 /* device specifics unknown */ 366 /* device specifics unknown */
225 { USB_DEVICE(0x15c2, 0x0037) }, 367 { USB_DEVICE(0x15c2, 0x0037),
368 .driver_info = (unsigned long)&imon_default_table},
226 /* SoundGraph iMON OEM LCD (IR & LCD) */ 369 /* SoundGraph iMON OEM LCD (IR & LCD) */
227 { USB_DEVICE(0x15c2, 0x0038) }, 370 { USB_DEVICE(0x15c2, 0x0038),
371 .driver_info = (unsigned long)&imon_default_table},
228 /* SoundGraph iMON UltraBay (IR & LCD) */ 372 /* SoundGraph iMON UltraBay (IR & LCD) */
229 { USB_DEVICE(0x15c2, 0x0039) }, 373 { USB_DEVICE(0x15c2, 0x0039),
374 .driver_info = (unsigned long)&imon_default_table},
230 /* device specifics unknown */ 375 /* device specifics unknown */
231 { USB_DEVICE(0x15c2, 0x003a) }, 376 { USB_DEVICE(0x15c2, 0x003a),
377 .driver_info = (unsigned long)&imon_default_table},
232 /* device specifics unknown */ 378 /* device specifics unknown */
233 { USB_DEVICE(0x15c2, 0x003b) }, 379 { USB_DEVICE(0x15c2, 0x003b),
380 .driver_info = (unsigned long)&imon_default_table},
234 /* SoundGraph iMON OEM Inside (IR only) */ 381 /* SoundGraph iMON OEM Inside (IR only) */
235 { USB_DEVICE(0x15c2, 0x003c) }, 382 { USB_DEVICE(0x15c2, 0x003c),
383 .driver_info = (unsigned long)&imon_default_table},
236 /* device specifics unknown */ 384 /* device specifics unknown */
237 { USB_DEVICE(0x15c2, 0x003d) }, 385 { USB_DEVICE(0x15c2, 0x003d),
386 .driver_info = (unsigned long)&imon_default_table},
238 /* device specifics unknown */ 387 /* device specifics unknown */
239 { USB_DEVICE(0x15c2, 0x003e) }, 388 { USB_DEVICE(0x15c2, 0x003e),
389 .driver_info = (unsigned long)&imon_default_table},
240 /* device specifics unknown */ 390 /* device specifics unknown */
241 { USB_DEVICE(0x15c2, 0x003f) }, 391 { USB_DEVICE(0x15c2, 0x003f),
392 .driver_info = (unsigned long)&imon_default_table},
242 /* device specifics unknown */ 393 /* device specifics unknown */
243 { USB_DEVICE(0x15c2, 0x0040) }, 394 { USB_DEVICE(0x15c2, 0x0040),
395 .driver_info = (unsigned long)&imon_default_table},
244 /* SoundGraph iMON MINI (IR only) */ 396 /* SoundGraph iMON MINI (IR only) */
245 { USB_DEVICE(0x15c2, 0x0041) }, 397 { USB_DEVICE(0x15c2, 0x0041),
398 .driver_info = (unsigned long)&imon_default_table},
246 /* Antec Veris Multimedia Station EZ External (IR only) */ 399 /* Antec Veris Multimedia Station EZ External (IR only) */
247 { USB_DEVICE(0x15c2, 0x0042) }, 400 { USB_DEVICE(0x15c2, 0x0042),
401 .driver_info = (unsigned long)&imon_default_table},
248 /* Antec Veris Multimedia Station Basic Internal (IR only) */ 402 /* Antec Veris Multimedia Station Basic Internal (IR only) */
249 { USB_DEVICE(0x15c2, 0x0043) }, 403 { USB_DEVICE(0x15c2, 0x0043),
404 .driver_info = (unsigned long)&imon_default_table},
250 /* Antec Veris Multimedia Station Elite (IR & VFD) */ 405 /* Antec Veris Multimedia Station Elite (IR & VFD) */
251 { USB_DEVICE(0x15c2, 0x0044) }, 406 { USB_DEVICE(0x15c2, 0x0044),
407 .driver_info = (unsigned long)&imon_default_table},
252 /* Antec Veris Multimedia Station Premiere (IR & LCD) */ 408 /* Antec Veris Multimedia Station Premiere (IR & LCD) */
253 { USB_DEVICE(0x15c2, 0x0045) }, 409 { USB_DEVICE(0x15c2, 0x0045),
410 .driver_info = (unsigned long)&imon_default_table},
254 /* device specifics unknown */ 411 /* device specifics unknown */
255 { USB_DEVICE(0x15c2, 0x0046) }, 412 { USB_DEVICE(0x15c2, 0x0046),
413 .driver_info = (unsigned long)&imon_default_table},
256 {} 414 {}
257}; 415};
258 416
@@ -266,67 +424,6 @@ static struct usb_driver imon_driver = {
266 .id_table = imon_usb_id_table, 424 .id_table = imon_usb_id_table,
267}; 425};
268 426
269static struct usb_class_driver imon_vfd_class = {
270 .name = DEVICE_NAME,
271 .fops = &vfd_fops,
272 .minor_base = DISPLAY_MINOR_BASE,
273};
274
275static struct usb_class_driver imon_lcd_class = {
276 .name = DEVICE_NAME,
277 .fops = &lcd_fops,
278 .minor_base = DISPLAY_MINOR_BASE,
279};
280
281/* imon receiver front panel/knob key table */
282static const struct {
283 u64 hw_code;
284 u32 keycode;
285} imon_panel_key_table[] = {
286 { 0x000000000f00ffeell, KEY_MEDIA }, /* Go */
287 { 0x000000001200ffeell, KEY_UP },
288 { 0x000000001300ffeell, KEY_DOWN },
289 { 0x000000001400ffeell, KEY_LEFT },
290 { 0x000000001500ffeell, KEY_RIGHT },
291 { 0x000000001600ffeell, KEY_ENTER },
292 { 0x000000001700ffeell, KEY_ESC },
293 { 0x000000001f00ffeell, KEY_AUDIO },
294 { 0x000000002000ffeell, KEY_VIDEO },
295 { 0x000000002100ffeell, KEY_CAMERA },
296 { 0x000000002700ffeell, KEY_DVD },
297 { 0x000000002300ffeell, KEY_TV },
298 { 0x000000002b00ffeell, KEY_EXIT },
299 { 0x000000002c00ffeell, KEY_SELECT },
300 { 0x000000002d00ffeell, KEY_MENU },
301 { 0x000000000500ffeell, KEY_PREVIOUS },
302 { 0x000000000700ffeell, KEY_REWIND },
303 { 0x000000000400ffeell, KEY_STOP },
304 { 0x000000003c00ffeell, KEY_PLAYPAUSE },
305 { 0x000000000800ffeell, KEY_FASTFORWARD },
306 { 0x000000000600ffeell, KEY_NEXT },
307 { 0x000000010000ffeell, KEY_RIGHT },
308 { 0x000001000000ffeell, KEY_LEFT },
309 { 0x000000003d00ffeell, KEY_SELECT },
310 { 0x000100000000ffeell, KEY_VOLUMEUP },
311 { 0x010000000000ffeell, KEY_VOLUMEDOWN },
312 { 0x000000000100ffeell, KEY_MUTE },
313 /* 0xffdc iMON MCE VFD */
314 { 0x00010000ffffffeell, KEY_VOLUMEUP },
315 { 0x01000000ffffffeell, KEY_VOLUMEDOWN },
316 { 0x00000001ffffffeell, KEY_MUTE },
317 { 0x0000000fffffffeell, KEY_MEDIA },
318 { 0x00000012ffffffeell, KEY_UP },
319 { 0x00000013ffffffeell, KEY_DOWN },
320 { 0x00000014ffffffeell, KEY_LEFT },
321 { 0x00000015ffffffeell, KEY_RIGHT },
322 { 0x00000016ffffffeell, KEY_ENTER },
323 { 0x00000017ffffffeell, KEY_ESC },
324 /* iMON Knob values */
325 { 0x000100ffffffffeell, KEY_VOLUMEUP },
326 { 0x010000ffffffffeell, KEY_VOLUMEDOWN },
327 { 0x000008ffffffffeell, KEY_MUTE },
328};
329
330/* to prevent races between open() and disconnect(), probing, etc */ 427/* to prevent races between open() and disconnect(), probing, etc */
331static DEFINE_MUTEX(driver_lock); 428static DEFINE_MUTEX(driver_lock);
332 429
@@ -1210,18 +1307,19 @@ static u32 imon_mce_key_lookup(struct imon_context *ictx, u32 scancode)
1210 return keycode; 1307 return keycode;
1211} 1308}
1212 1309
1213static u32 imon_panel_key_lookup(u64 code) 1310static u32 imon_panel_key_lookup(struct imon_context *ictx, u64 code)
1214{ 1311{
1215 int i; 1312 int i;
1216 u32 keycode = KEY_RESERVED; 1313 u32 keycode = KEY_RESERVED;
1314 struct imon_panel_key_table *key_table = ictx->dev_descr->key_table;
1217 1315
1218 for (i = 0; i < ARRAY_SIZE(imon_panel_key_table); i++) { 1316 for (i = 0; key_table[i].hw_code != 0; i++) {
1219 if (imon_panel_key_table[i].hw_code == (code | 0xffee)) { 1317 if (key_table[i].hw_code == (code | 0xffee)) {
1220 keycode = imon_panel_key_table[i].keycode; 1318 keycode = key_table[i].keycode;
1221 break; 1319 break;
1222 } 1320 }
1223 } 1321 }
1224 1322 ictx->release_code = false;
1225 return keycode; 1323 return keycode;
1226} 1324}
1227 1325
@@ -1340,7 +1438,7 @@ static void imon_pad_to_keys(struct imon_context *ictx, unsigned char *buf)
1340 } 1438 }
1341 buf[2] = dir & 0xFF; 1439 buf[2] = dir & 0xFF;
1342 buf[3] = (dir >> 8) & 0xFF; 1440 buf[3] = (dir >> 8) & 0xFF;
1343 scancode = be32_to_cpu(*((u32 *)buf)); 1441 scancode = be32_to_cpu(*((__be32 *)buf));
1344 } 1442 }
1345 } else { 1443 } else {
1346 /* 1444 /*
@@ -1404,7 +1502,7 @@ static void imon_pad_to_keys(struct imon_context *ictx, unsigned char *buf)
1404 } 1502 }
1405 buf[2] = dir & 0xFF; 1503 buf[2] = dir & 0xFF;
1406 buf[3] = (dir >> 8) & 0xFF; 1504 buf[3] = (dir >> 8) & 0xFF;
1407 scancode = be32_to_cpu(*((u32 *)buf)); 1505 scancode = be32_to_cpu(*((__be32 *)buf));
1408 } else { 1506 } else {
1409 /* 1507 /*
1410 * Hack alert: instead of using keycodes, we have 1508 * Hack alert: instead of using keycodes, we have
@@ -1509,11 +1607,12 @@ static void imon_incoming_packet(struct imon_context *ictx,
1509 1607
1510 /* Figure out what key was pressed */ 1608 /* Figure out what key was pressed */
1511 if (len == 8 && buf[7] == 0xee) { 1609 if (len == 8 && buf[7] == 0xee) {
1512 scancode = be64_to_cpu(*((u64 *)buf)); 1610 scancode = be64_to_cpu(*((__be64 *)buf));
1513 ktype = IMON_KEY_PANEL; 1611 ktype = IMON_KEY_PANEL;
1514 kc = imon_panel_key_lookup(scancode); 1612 kc = imon_panel_key_lookup(ictx, scancode);
1613 ictx->release_code = false;
1515 } else { 1614 } else {
1516 scancode = be32_to_cpu(*((u32 *)buf)); 1615 scancode = be32_to_cpu(*((__be32 *)buf));
1517 if (ictx->rc_type == RC_BIT_RC6_MCE) { 1616 if (ictx->rc_type == RC_BIT_RC6_MCE) {
1518 ktype = IMON_KEY_IMON; 1617 ktype = IMON_KEY_IMON;
1519 if (buf[0] == 0x80) 1618 if (buf[0] == 0x80)
@@ -1908,6 +2007,7 @@ out:
1908 2007
1909static struct input_dev *imon_init_idev(struct imon_context *ictx) 2008static struct input_dev *imon_init_idev(struct imon_context *ictx)
1910{ 2009{
2010 struct imon_panel_key_table *key_table = ictx->dev_descr->key_table;
1911 struct input_dev *idev; 2011 struct input_dev *idev;
1912 int ret, i; 2012 int ret, i;
1913 2013
@@ -1933,8 +2033,8 @@ static struct input_dev *imon_init_idev(struct imon_context *ictx)
1933 BIT_MASK(REL_WHEEL); 2033 BIT_MASK(REL_WHEEL);
1934 2034
1935 /* panel and/or knob code support */ 2035 /* panel and/or knob code support */
1936 for (i = 0; i < ARRAY_SIZE(imon_panel_key_table); i++) { 2036 for (i = 0; key_table[i].hw_code != 0; i++) {
1937 u32 kc = imon_panel_key_table[i].keycode; 2037 u32 kc = key_table[i].keycode;
1938 __set_bit(kc, idev->keybit); 2038 __set_bit(kc, idev->keybit);
1939 } 2039 }
1940 2040
@@ -2023,7 +2123,7 @@ static bool imon_find_endpoints(struct imon_context *ictx,
2023 for (i = 0; i < num_endpts && !(ir_ep_found && display_ep_found); ++i) { 2123 for (i = 0; i < num_endpts && !(ir_ep_found && display_ep_found); ++i) {
2024 ep = &iface_desc->endpoint[i].desc; 2124 ep = &iface_desc->endpoint[i].desc;
2025 ep_dir = ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK; 2125 ep_dir = ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK;
2026 ep_type = ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK; 2126 ep_type = usb_endpoint_type(ep);
2027 2127
2028 if (!ir_ep_found && ep_dir == USB_DIR_IN && 2128 if (!ir_ep_found && ep_dir == USB_DIR_IN &&
2029 ep_type == USB_ENDPOINT_XFER_INT) { 2129 ep_type == USB_ENDPOINT_XFER_INT) {
@@ -2135,9 +2235,11 @@ static struct imon_context *imon_init_intf0(struct usb_interface *intf,
2135 ictx->vendor = le16_to_cpu(ictx->usbdev_intf0->descriptor.idVendor); 2235 ictx->vendor = le16_to_cpu(ictx->usbdev_intf0->descriptor.idVendor);
2136 ictx->product = le16_to_cpu(ictx->usbdev_intf0->descriptor.idProduct); 2236 ictx->product = le16_to_cpu(ictx->usbdev_intf0->descriptor.idProduct);
2137 2237
2238 /* save drive info for later accessing the panel/knob key table */
2239 ictx->dev_descr = (struct imon_usb_dev_descr *)id->driver_info;
2138 /* default send_packet delay is 5ms but some devices need more */ 2240 /* default send_packet delay is 5ms but some devices need more */
2139 ictx->send_packet_delay = id->driver_info & IMON_NEED_20MS_PKT_DELAY ? 2241 ictx->send_packet_delay = ictx->dev_descr->flags &
2140 20 : 5; 2242 IMON_NEED_20MS_PKT_DELAY ? 20 : 5;
2141 2243
2142 ret = -ENODEV; 2244 ret = -ENODEV;
2143 iface_desc = intf->cur_altsetting; 2245 iface_desc = intf->cur_altsetting;
@@ -2181,6 +2283,7 @@ idev_setup_failed:
2181 usb_kill_urb(ictx->rx_urb_intf0); 2283 usb_kill_urb(ictx->rx_urb_intf0);
2182urb_submit_failed: 2284urb_submit_failed:
2183find_endpoint_failed: 2285find_endpoint_failed:
2286 usb_put_dev(ictx->usbdev_intf0);
2184 mutex_unlock(&ictx->lock); 2287 mutex_unlock(&ictx->lock);
2185 usb_free_urb(tx_urb); 2288 usb_free_urb(tx_urb);
2186tx_urb_alloc_failed: 2289tx_urb_alloc_failed:
@@ -2253,6 +2356,7 @@ urb_submit_failed:
2253 input_unregister_device(ictx->touch); 2356 input_unregister_device(ictx->touch);
2254touch_setup_failed: 2357touch_setup_failed:
2255find_endpoint_failed: 2358find_endpoint_failed:
2359 usb_put_dev(ictx->usbdev_intf1);
2256 mutex_unlock(&ictx->lock); 2360 mutex_unlock(&ictx->lock);
2257 usb_free_urb(rx_urb); 2361 usb_free_urb(rx_urb);
2258rx_urb_alloc_failed: 2362rx_urb_alloc_failed:
@@ -2366,11 +2470,13 @@ static int imon_probe(struct usb_interface *interface,
2366 usbdev->bus->busnum, usbdev->devnum); 2470 usbdev->bus->busnum, usbdev->devnum);
2367 2471
2368 mutex_unlock(&driver_lock); 2472 mutex_unlock(&driver_lock);
2473 usb_put_dev(usbdev);
2369 2474
2370 return 0; 2475 return 0;
2371 2476
2372fail: 2477fail:
2373 mutex_unlock(&driver_lock); 2478 mutex_unlock(&driver_lock);
2479 usb_put_dev(usbdev);
2374 dev_err(dev, "unable to register, err %d\n", ret); 2480 dev_err(dev, "unable to register, err %d\n", ret);
2375 2481
2376 return ret; 2482 return ret;
@@ -2410,6 +2516,7 @@ static void imon_disconnect(struct usb_interface *interface)
2410 if (ifnum == 0) { 2516 if (ifnum == 0) {
2411 ictx->dev_present_intf0 = false; 2517 ictx->dev_present_intf0 = false;
2412 usb_kill_urb(ictx->rx_urb_intf0); 2518 usb_kill_urb(ictx->rx_urb_intf0);
2519 usb_put_dev(ictx->usbdev_intf0);
2413 input_unregister_device(ictx->idev); 2520 input_unregister_device(ictx->idev);
2414 rc_unregister_device(ictx->rdev); 2521 rc_unregister_device(ictx->rdev);
2415 if (ictx->display_supported) { 2522 if (ictx->display_supported) {
@@ -2421,6 +2528,7 @@ static void imon_disconnect(struct usb_interface *interface)
2421 } else { 2528 } else {
2422 ictx->dev_present_intf1 = false; 2529 ictx->dev_present_intf1 = false;
2423 usb_kill_urb(ictx->rx_urb_intf1); 2530 usb_kill_urb(ictx->rx_urb_intf1);
2531 usb_put_dev(ictx->usbdev_intf1);
2424 if (ictx->display_type == IMON_DISPLAY_TYPE_VGA) { 2532 if (ictx->display_type == IMON_DISPLAY_TYPE_VGA) {
2425 input_unregister_device(ictx->touch); 2533 input_unregister_device(ictx->touch);
2426 del_timer_sync(&ictx->ttimer); 2534 del_timer_sync(&ictx->ttimer);
diff --git a/drivers/media/rc/ir-hix5hd2.c b/drivers/media/rc/ir-hix5hd2.c
new file mode 100644
index 000000000000..08bbd4f508cd
--- /dev/null
+++ b/drivers/media/rc/ir-hix5hd2.c
@@ -0,0 +1,351 @@
1/*
2 * Copyright (c) 2014 Linaro Ltd.
3 * Copyright (c) 2014 Hisilicon Limited.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 */
9
10#include <linux/clk.h>
11#include <linux/delay.h>
12#include <linux/interrupt.h>
13#include <linux/mfd/syscon.h>
14#include <linux/module.h>
15#include <linux/of_device.h>
16#include <linux/regmap.h>
17#include <media/rc-core.h>
18
19/* Allow the driver to compile on all architectures */
20#ifndef writel_relaxed
21# define writel_relaxed writel
22#endif
23#ifndef readl_relaxed
24# define readl_relaxed readl
25#endif
26
27#define IR_ENABLE 0x00
28#define IR_CONFIG 0x04
29#define CNT_LEADS 0x08
30#define CNT_LEADE 0x0c
31#define CNT_SLEADE 0x10
32#define CNT0_B 0x14
33#define CNT1_B 0x18
34#define IR_BUSY 0x1c
35#define IR_DATAH 0x20
36#define IR_DATAL 0x24
37#define IR_INTM 0x28
38#define IR_INTS 0x2c
39#define IR_INTC 0x30
40#define IR_START 0x34
41
42/* interrupt mask */
43#define INTMS_SYMBRCV (BIT(24) | BIT(8))
44#define INTMS_TIMEOUT (BIT(25) | BIT(9))
45#define INTMS_OVERFLOW (BIT(26) | BIT(10))
46#define INT_CLR_OVERFLOW BIT(18)
47#define INT_CLR_TIMEOUT BIT(17)
48#define INT_CLR_RCV BIT(16)
49#define INT_CLR_RCVTIMEOUT (BIT(16) | BIT(17))
50
51#define IR_CLK 0x48
52#define IR_CLK_ENABLE BIT(4)
53#define IR_CLK_RESET BIT(5)
54
55#define IR_CFG_WIDTH_MASK 0xffff
56#define IR_CFG_WIDTH_SHIFT 16
57#define IR_CFG_FORMAT_MASK 0x3
58#define IR_CFG_FORMAT_SHIFT 14
59#define IR_CFG_INT_LEVEL_MASK 0x3f
60#define IR_CFG_INT_LEVEL_SHIFT 8
61/* only support raw mode */
62#define IR_CFG_MODE_RAW BIT(7)
63#define IR_CFG_FREQ_MASK 0x7f
64#define IR_CFG_FREQ_SHIFT 0
65#define IR_CFG_INT_THRESHOLD 1
66/* symbol start from low to high, symbol stream end at high*/
67#define IR_CFG_SYMBOL_FMT 0
68#define IR_CFG_SYMBOL_MAXWIDTH 0x3e80
69
70#define IR_HIX5HD2_NAME "hix5hd2-ir"
71
72struct hix5hd2_ir_priv {
73 int irq;
74 void volatile __iomem *base;
75 struct device *dev;
76 struct rc_dev *rdev;
77 struct regmap *regmap;
78 struct clk *clock;
79 unsigned long rate;
80};
81
82static void hix5hd2_ir_enable(struct hix5hd2_ir_priv *dev, bool on)
83{
84 u32 val;
85
86 regmap_read(dev->regmap, IR_CLK, &val);
87 if (on) {
88 val &= ~IR_CLK_RESET;
89 val |= IR_CLK_ENABLE;
90 } else {
91 val &= ~IR_CLK_ENABLE;
92 val |= IR_CLK_RESET;
93 }
94 regmap_write(dev->regmap, IR_CLK, val);
95}
96
97static int hix5hd2_ir_config(struct hix5hd2_ir_priv *priv)
98{
99 int timeout = 10000;
100 u32 val, rate;
101
102 writel_relaxed(0x01, priv->base + IR_ENABLE);
103 while (readl_relaxed(priv->base + IR_BUSY)) {
104 if (timeout--) {
105 udelay(1);
106 } else {
107 dev_err(priv->dev, "IR_BUSY timeout\n");
108 return -ETIMEDOUT;
109 }
110 }
111
112 /* Now only support raw mode, with symbol start from low to high */
113 rate = DIV_ROUND_CLOSEST(priv->rate, 1000000);
114 val = IR_CFG_SYMBOL_MAXWIDTH & IR_CFG_WIDTH_MASK << IR_CFG_WIDTH_SHIFT;
115 val |= IR_CFG_SYMBOL_FMT & IR_CFG_FORMAT_MASK << IR_CFG_FORMAT_SHIFT;
116 val |= (IR_CFG_INT_THRESHOLD - 1) & IR_CFG_INT_LEVEL_MASK
117 << IR_CFG_INT_LEVEL_SHIFT;
118 val |= IR_CFG_MODE_RAW;
119 val |= (rate - 1) & IR_CFG_FREQ_MASK << IR_CFG_FREQ_SHIFT;
120 writel_relaxed(val, priv->base + IR_CONFIG);
121
122 writel_relaxed(0x00, priv->base + IR_INTM);
123 /* write arbitrary value to start */
124 writel_relaxed(0x01, priv->base + IR_START);
125 return 0;
126}
127
128static int hix5hd2_ir_open(struct rc_dev *rdev)
129{
130 struct hix5hd2_ir_priv *priv = rdev->priv;
131
132 hix5hd2_ir_enable(priv, true);
133 return hix5hd2_ir_config(priv);
134}
135
136static void hix5hd2_ir_close(struct rc_dev *rdev)
137{
138 struct hix5hd2_ir_priv *priv = rdev->priv;
139
140 hix5hd2_ir_enable(priv, false);
141}
142
143static irqreturn_t hix5hd2_ir_rx_interrupt(int irq, void *data)
144{
145 u32 symb_num, symb_val, symb_time;
146 u32 data_l, data_h;
147 u32 irq_sr, i;
148 struct hix5hd2_ir_priv *priv = data;
149
150 irq_sr = readl_relaxed(priv->base + IR_INTS);
151 if (irq_sr & INTMS_OVERFLOW) {
152 /*
153 * we must read IR_DATAL first, then we can clean up
154 * IR_INTS availably since logic would not clear
155 * fifo when overflow, drv do the job
156 */
157 ir_raw_event_reset(priv->rdev);
158 symb_num = readl_relaxed(priv->base + IR_DATAH);
159 for (i = 0; i < symb_num; i++)
160 readl_relaxed(priv->base + IR_DATAL);
161
162 writel_relaxed(INT_CLR_OVERFLOW, priv->base + IR_INTC);
163 dev_info(priv->dev, "overflow, level=%d\n",
164 IR_CFG_INT_THRESHOLD);
165 }
166
167 if ((irq_sr & INTMS_SYMBRCV) || (irq_sr & INTMS_TIMEOUT)) {
168 DEFINE_IR_RAW_EVENT(ev);
169
170 symb_num = readl_relaxed(priv->base + IR_DATAH);
171 for (i = 0; i < symb_num; i++) {
172 symb_val = readl_relaxed(priv->base + IR_DATAL);
173 data_l = ((symb_val & 0xffff) * 10);
174 data_h = ((symb_val >> 16) & 0xffff) * 10;
175 symb_time = (data_l + data_h) / 10;
176
177 ev.duration = US_TO_NS(data_l);
178 ev.pulse = true;
179 ir_raw_event_store(priv->rdev, &ev);
180
181 if (symb_time < IR_CFG_SYMBOL_MAXWIDTH) {
182 ev.duration = US_TO_NS(data_h);
183 ev.pulse = false;
184 ir_raw_event_store(priv->rdev, &ev);
185 } else {
186 ir_raw_event_set_idle(priv->rdev, true);
187 }
188 }
189
190 if (irq_sr & INTMS_SYMBRCV)
191 writel_relaxed(INT_CLR_RCV, priv->base + IR_INTC);
192 if (irq_sr & INTMS_TIMEOUT)
193 writel_relaxed(INT_CLR_TIMEOUT, priv->base + IR_INTC);
194 }
195
196 /* Empty software fifo */
197 ir_raw_event_handle(priv->rdev);
198 return IRQ_HANDLED;
199}
200
201static int hix5hd2_ir_probe(struct platform_device *pdev)
202{
203 struct rc_dev *rdev;
204 struct device *dev = &pdev->dev;
205 struct resource *res;
206 struct hix5hd2_ir_priv *priv;
207 struct device_node *node = pdev->dev.of_node;
208 const char *map_name;
209 int ret;
210
211 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
212 if (!priv)
213 return -ENOMEM;
214
215 priv->regmap = syscon_regmap_lookup_by_phandle(node,
216 "hisilicon,power-syscon");
217 if (IS_ERR(priv->regmap)) {
218 dev_err(dev, "no power-reg\n");
219 return -EINVAL;
220 }
221
222 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
223 priv->base = devm_ioremap_resource(dev, res);
224 if (IS_ERR((__force void *)priv->base))
225 return PTR_ERR((__force void *)priv->base);
226
227 priv->irq = platform_get_irq(pdev, 0);
228 if (priv->irq < 0) {
229 dev_err(dev, "irq can not get\n");
230 return priv->irq;
231 }
232
233 rdev = rc_allocate_device();
234 if (!rdev)
235 return -ENOMEM;
236
237 priv->clock = devm_clk_get(dev, NULL);
238 if (IS_ERR(priv->clock)) {
239 dev_err(dev, "clock not found\n");
240 ret = PTR_ERR(priv->clock);
241 goto err;
242 }
243 clk_prepare_enable(priv->clock);
244 priv->rate = clk_get_rate(priv->clock);
245
246 rdev->driver_type = RC_DRIVER_IR_RAW;
247 rdev->allowed_protocols = RC_BIT_ALL;
248 rdev->priv = priv;
249 rdev->open = hix5hd2_ir_open;
250 rdev->close = hix5hd2_ir_close;
251 rdev->driver_name = IR_HIX5HD2_NAME;
252 map_name = of_get_property(node, "linux,rc-map-name", NULL);
253 rdev->map_name = map_name ?: RC_MAP_EMPTY;
254 rdev->input_name = IR_HIX5HD2_NAME;
255 rdev->input_phys = IR_HIX5HD2_NAME "/input0";
256 rdev->input_id.bustype = BUS_HOST;
257 rdev->input_id.vendor = 0x0001;
258 rdev->input_id.product = 0x0001;
259 rdev->input_id.version = 0x0100;
260 rdev->rx_resolution = US_TO_NS(10);
261 rdev->timeout = US_TO_NS(IR_CFG_SYMBOL_MAXWIDTH * 10);
262
263 ret = rc_register_device(rdev);
264 if (ret < 0)
265 goto clkerr;
266
267 if (devm_request_irq(dev, priv->irq, hix5hd2_ir_rx_interrupt,
268 IRQF_NO_SUSPEND, pdev->name, priv) < 0) {
269 dev_err(dev, "IRQ %d register failed\n", priv->irq);
270 ret = -EINVAL;
271 goto regerr;
272 }
273
274 priv->rdev = rdev;
275 priv->dev = dev;
276 platform_set_drvdata(pdev, priv);
277
278 return ret;
279
280regerr:
281 rc_unregister_device(rdev);
282 rdev = NULL;
283clkerr:
284 clk_disable_unprepare(priv->clock);
285err:
286 rc_free_device(rdev);
287 dev_err(dev, "Unable to register device (%d)\n", ret);
288 return ret;
289}
290
291static int hix5hd2_ir_remove(struct platform_device *pdev)
292{
293 struct hix5hd2_ir_priv *priv = platform_get_drvdata(pdev);
294
295 clk_disable_unprepare(priv->clock);
296 rc_unregister_device(priv->rdev);
297 return 0;
298}
299
300#ifdef CONFIG_PM
301static int hix5hd2_ir_suspend(struct device *dev)
302{
303 struct hix5hd2_ir_priv *priv = dev_get_drvdata(dev);
304
305 clk_disable_unprepare(priv->clock);
306 hix5hd2_ir_enable(priv, false);
307
308 return 0;
309}
310
311static int hix5hd2_ir_resume(struct device *dev)
312{
313 struct hix5hd2_ir_priv *priv = dev_get_drvdata(dev);
314
315 hix5hd2_ir_enable(priv, true);
316 clk_prepare_enable(priv->clock);
317
318 writel_relaxed(0x01, priv->base + IR_ENABLE);
319 writel_relaxed(0x00, priv->base + IR_INTM);
320 writel_relaxed(0xff, priv->base + IR_INTC);
321 writel_relaxed(0x01, priv->base + IR_START);
322
323 return 0;
324}
325#endif
326
327static SIMPLE_DEV_PM_OPS(hix5hd2_ir_pm_ops, hix5hd2_ir_suspend,
328 hix5hd2_ir_resume);
329
330static struct of_device_id hix5hd2_ir_table[] = {
331 { .compatible = "hisilicon,hix5hd2-ir", },
332 {},
333};
334MODULE_DEVICE_TABLE(of, hix5hd2_ir_table);
335
336static struct platform_driver hix5hd2_ir_driver = {
337 .driver = {
338 .name = IR_HIX5HD2_NAME,
339 .of_match_table = hix5hd2_ir_table,
340 .pm = &hix5hd2_ir_pm_ops,
341 },
342 .probe = hix5hd2_ir_probe,
343 .remove = hix5hd2_ir_remove,
344};
345
346module_platform_driver(hix5hd2_ir_driver);
347
348MODULE_DESCRIPTION("IR controller driver for hix5hd2 platforms");
349MODULE_AUTHOR("Guoxiong Yan <yanguoxiong@huawei.com>");
350MODULE_LICENSE("GPL v2");
351MODULE_ALIAS("platform:hix5hd2-ir");
diff --git a/drivers/media/rc/ite-cir.c b/drivers/media/rc/ite-cir.c
index 447fe35862dc..56abf9120cc2 100644
--- a/drivers/media/rc/ite-cir.c
+++ b/drivers/media/rc/ite-cir.c
@@ -1666,7 +1666,6 @@ static int ite_suspend(struct pnp_dev *pdev, pm_message_t state)
1666 1666
1667static int ite_resume(struct pnp_dev *pdev) 1667static int ite_resume(struct pnp_dev *pdev)
1668{ 1668{
1669 int ret = 0;
1670 struct ite_dev *dev = pnp_get_drvdata(pdev); 1669 struct ite_dev *dev = pnp_get_drvdata(pdev);
1671 unsigned long flags; 1670 unsigned long flags;
1672 1671
@@ -1681,7 +1680,7 @@ static int ite_resume(struct pnp_dev *pdev)
1681 1680
1682 spin_unlock_irqrestore(&dev->lock, flags); 1681 spin_unlock_irqrestore(&dev->lock, flags);
1683 1682
1684 return ret; 1683 return 0;
1685} 1684}
1686 1685
1687static void ite_shutdown(struct pnp_dev *pdev) 1686static void ite_shutdown(struct pnp_dev *pdev)
diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile
index 0b8c54919010..abf60794223d 100644
--- a/drivers/media/rc/keymaps/Makefile
+++ b/drivers/media/rc/keymaps/Makefile
@@ -28,6 +28,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
28 rc-dm1105-nec.o \ 28 rc-dm1105-nec.o \
29 rc-dntv-live-dvb-t.o \ 29 rc-dntv-live-dvb-t.o \
30 rc-dntv-live-dvbt-pro.o \ 30 rc-dntv-live-dvbt-pro.o \
31 rc-dvbsky.o \
31 rc-em-terratec.o \ 32 rc-em-terratec.o \
32 rc-encore-enltv2.o \ 33 rc-encore-enltv2.o \
33 rc-encore-enltv.o \ 34 rc-encore-enltv.o \
diff --git a/drivers/media/rc/keymaps/rc-dvbsky.c b/drivers/media/rc/keymaps/rc-dvbsky.c
new file mode 100644
index 000000000000..c5115a1165d1
--- /dev/null
+++ b/drivers/media/rc/keymaps/rc-dvbsky.c
@@ -0,0 +1,78 @@
1/* rc-dvbsky.c - Keytable for DVBSky Remote Controllers
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 *
6 * Copyright (c) 2010-2012 by Nibble Max <nibble.max@gmail.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 */
13
14#include <media/rc-map.h>
15#include <linux/module.h>
16/*
17 * This table contains the complete RC5 code, instead of just the data part
18 */
19
20static struct rc_map_table rc5_dvbsky[] = {
21 { 0x0000, KEY_0 },
22 { 0x0001, KEY_1 },
23 { 0x0002, KEY_2 },
24 { 0x0003, KEY_3 },
25 { 0x0004, KEY_4 },
26 { 0x0005, KEY_5 },
27 { 0x0006, KEY_6 },
28 { 0x0007, KEY_7 },
29 { 0x0008, KEY_8 },
30 { 0x0009, KEY_9 },
31 { 0x000a, KEY_MUTE },
32 { 0x000d, KEY_OK },
33 { 0x000b, KEY_STOP },
34 { 0x000c, KEY_EXIT },
35 { 0x000e, KEY_CAMERA }, /*Snap shot*/
36 { 0x000f, KEY_SUBTITLE }, /*PIP*/
37 { 0x0010, KEY_VOLUMEUP },
38 { 0x0011, KEY_VOLUMEDOWN },
39 { 0x0012, KEY_FAVORITES },
40 { 0x0013, KEY_LIST }, /*Info*/
41 { 0x0016, KEY_PAUSE },
42 { 0x0017, KEY_PLAY },
43 { 0x001f, KEY_RECORD },
44 { 0x0020, KEY_CHANNELDOWN },
45 { 0x0021, KEY_CHANNELUP },
46 { 0x0025, KEY_POWER2 },
47 { 0x0026, KEY_REWIND },
48 { 0x0027, KEY_FASTFORWARD },
49 { 0x0029, KEY_LAST },
50 { 0x002b, KEY_MENU },
51 { 0x002c, KEY_EPG },
52 { 0x002d, KEY_ZOOM },
53};
54
55static struct rc_map_list rc5_dvbsky_map = {
56 .map = {
57 .scan = rc5_dvbsky,
58 .size = ARRAY_SIZE(rc5_dvbsky),
59 .rc_type = RC_TYPE_RC5,
60 .name = RC_MAP_DVBSKY,
61 }
62};
63
64static int __init init_rc_map_rc5_dvbsky(void)
65{
66 return rc_map_register(&rc5_dvbsky_map);
67}
68
69static void __exit exit_rc_map_rc5_dvbsky(void)
70{
71 rc_map_unregister(&rc5_dvbsky_map);
72}
73
74module_init(init_rc_map_rc5_dvbsky)
75module_exit(exit_rc_map_rc5_dvbsky)
76
77MODULE_LICENSE("GPL");
78MODULE_AUTHOR("Nibble Max <nibble.max@gmail.com>");
diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c
index dc5cbffcd5a2..249d2fbc8f37 100644
--- a/drivers/media/rc/lirc_dev.c
+++ b/drivers/media/rc/lirc_dev.c
@@ -595,7 +595,7 @@ long lirc_dev_fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
595 595
596 switch (cmd) { 596 switch (cmd) {
597 case LIRC_GET_FEATURES: 597 case LIRC_GET_FEATURES:
598 result = put_user(ir->d.features, (__u32 *)arg); 598 result = put_user(ir->d.features, (__u32 __user *)arg);
599 break; 599 break;
600 case LIRC_GET_REC_MODE: 600 case LIRC_GET_REC_MODE:
601 if (!(ir->d.features & LIRC_CAN_REC_MASK)) { 601 if (!(ir->d.features & LIRC_CAN_REC_MASK)) {
@@ -605,7 +605,7 @@ long lirc_dev_fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
605 605
606 result = put_user(LIRC_REC2MODE 606 result = put_user(LIRC_REC2MODE
607 (ir->d.features & LIRC_CAN_REC_MASK), 607 (ir->d.features & LIRC_CAN_REC_MASK),
608 (__u32 *)arg); 608 (__u32 __user *)arg);
609 break; 609 break;
610 case LIRC_SET_REC_MODE: 610 case LIRC_SET_REC_MODE:
611 if (!(ir->d.features & LIRC_CAN_REC_MASK)) { 611 if (!(ir->d.features & LIRC_CAN_REC_MASK)) {
@@ -613,7 +613,7 @@ long lirc_dev_fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
613 break; 613 break;
614 } 614 }
615 615
616 result = get_user(mode, (__u32 *)arg); 616 result = get_user(mode, (__u32 __user *)arg);
617 if (!result && !(LIRC_MODE2REC(mode) & ir->d.features)) 617 if (!result && !(LIRC_MODE2REC(mode) & ir->d.features))
618 result = -EINVAL; 618 result = -EINVAL;
619 /* 619 /*
@@ -622,7 +622,7 @@ long lirc_dev_fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
622 */ 622 */
623 break; 623 break;
624 case LIRC_GET_LENGTH: 624 case LIRC_GET_LENGTH:
625 result = put_user(ir->d.code_length, (__u32 *)arg); 625 result = put_user(ir->d.code_length, (__u32 __user *)arg);
626 break; 626 break;
627 case LIRC_GET_MIN_TIMEOUT: 627 case LIRC_GET_MIN_TIMEOUT:
628 if (!(ir->d.features & LIRC_CAN_SET_REC_TIMEOUT) || 628 if (!(ir->d.features & LIRC_CAN_SET_REC_TIMEOUT) ||
@@ -631,7 +631,7 @@ long lirc_dev_fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
631 break; 631 break;
632 } 632 }
633 633
634 result = put_user(ir->d.min_timeout, (__u32 *)arg); 634 result = put_user(ir->d.min_timeout, (__u32 __user *)arg);
635 break; 635 break;
636 case LIRC_GET_MAX_TIMEOUT: 636 case LIRC_GET_MAX_TIMEOUT:
637 if (!(ir->d.features & LIRC_CAN_SET_REC_TIMEOUT) || 637 if (!(ir->d.features & LIRC_CAN_SET_REC_TIMEOUT) ||
@@ -640,7 +640,7 @@ long lirc_dev_fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
640 break; 640 break;
641 } 641 }
642 642
643 result = put_user(ir->d.max_timeout, (__u32 *)arg); 643 result = put_user(ir->d.max_timeout, (__u32 __user *)arg);
644 break; 644 break;
645 default: 645 default:
646 result = -EINVAL; 646 result = -EINVAL;
@@ -736,7 +736,7 @@ ssize_t lirc_dev_fop_read(struct file *file,
736 } 736 }
737 } else { 737 } else {
738 lirc_buffer_read(ir->buf, buf); 738 lirc_buffer_read(ir->buf, buf);
739 ret = copy_to_user((void *)buffer+written, buf, 739 ret = copy_to_user((void __user *)buffer+written, buf,
740 ir->buf->chunk_size); 740 ir->buf->chunk_size);
741 if (!ret) 741 if (!ret)
742 written += ir->buf->chunk_size; 742 written += ir->buf->chunk_size;
diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c
index 45b0894288e5..2cdb740cde48 100644
--- a/drivers/media/rc/mceusb.c
+++ b/drivers/media/rc/mceusb.c
@@ -397,6 +397,10 @@ static struct usb_device_id mceusb_dev_table[] = {
397 .driver_info = HAUPPAUGE_CX_HYBRID_TV }, 397 .driver_info = HAUPPAUGE_CX_HYBRID_TV },
398 { USB_DEVICE(VENDOR_HAUPPAUGE, 0xb131), 398 { USB_DEVICE(VENDOR_HAUPPAUGE, 0xb131),
399 .driver_info = HAUPPAUGE_CX_HYBRID_TV }, 399 .driver_info = HAUPPAUGE_CX_HYBRID_TV },
400 { USB_DEVICE(VENDOR_HAUPPAUGE, 0xb138),
401 .driver_info = HAUPPAUGE_CX_HYBRID_TV },
402 { USB_DEVICE(VENDOR_HAUPPAUGE, 0xb139),
403 .driver_info = HAUPPAUGE_CX_HYBRID_TV },
400 { USB_DEVICE(VENDOR_PCTV, 0x0259), 404 { USB_DEVICE(VENDOR_PCTV, 0x0259),
401 .driver_info = HAUPPAUGE_CX_HYBRID_TV }, 405 .driver_info = HAUPPAUGE_CX_HYBRID_TV },
402 { USB_DEVICE(VENDOR_PCTV, 0x025e), 406 { USB_DEVICE(VENDOR_PCTV, 0x025e),
@@ -1198,10 +1202,9 @@ static void mceusb_flash_led(struct mceusb_dev *ir)
1198 mce_async_out(ir, FLASH_LED, sizeof(FLASH_LED)); 1202 mce_async_out(ir, FLASH_LED, sizeof(FLASH_LED));
1199} 1203}
1200 1204
1201static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir, 1205static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir)
1202 struct usb_interface *intf)
1203{ 1206{
1204 struct usb_device *udev = usb_get_dev(interface_to_usbdev(intf)); 1207 struct usb_device *udev = ir->usbdev;
1205 struct device *dev = ir->dev; 1208 struct device *dev = ir->dev;
1206 struct rc_dev *rc; 1209 struct rc_dev *rc;
1207 int ret; 1210 int ret;
@@ -1341,7 +1344,7 @@ static int mceusb_dev_probe(struct usb_interface *intf,
1341 if (!ir->urb_in) 1344 if (!ir->urb_in)
1342 goto urb_in_alloc_fail; 1345 goto urb_in_alloc_fail;
1343 1346
1344 ir->usbdev = dev; 1347 ir->usbdev = usb_get_dev(dev);
1345 ir->dev = &intf->dev; 1348 ir->dev = &intf->dev;
1346 ir->len_in = maxp; 1349 ir->len_in = maxp;
1347 ir->flags.microsoft_gen1 = is_microsoft_gen1; 1350 ir->flags.microsoft_gen1 = is_microsoft_gen1;
@@ -1362,7 +1365,7 @@ static int mceusb_dev_probe(struct usb_interface *intf,
1362 snprintf(name + strlen(name), sizeof(name) - strlen(name), 1365 snprintf(name + strlen(name), sizeof(name) - strlen(name),
1363 " %s", buf); 1366 " %s", buf);
1364 1367
1365 ir->rc = mceusb_init_rc_dev(ir, intf); 1368 ir->rc = mceusb_init_rc_dev(ir);
1366 if (!ir->rc) 1369 if (!ir->rc)
1367 goto rc_dev_fail; 1370 goto rc_dev_fail;
1368 1371
@@ -1408,6 +1411,7 @@ static int mceusb_dev_probe(struct usb_interface *intf,
1408 1411
1409 /* Error-handling path */ 1412 /* Error-handling path */
1410rc_dev_fail: 1413rc_dev_fail:
1414 usb_put_dev(ir->usbdev);
1411 usb_free_urb(ir->urb_in); 1415 usb_free_urb(ir->urb_in);
1412urb_in_alloc_fail: 1416urb_in_alloc_fail:
1413 usb_free_coherent(dev, maxp, ir->buf_in, ir->dma_in); 1417 usb_free_coherent(dev, maxp, ir->buf_in, ir->dma_in);
@@ -1435,6 +1439,7 @@ static void mceusb_dev_disconnect(struct usb_interface *intf)
1435 usb_kill_urb(ir->urb_in); 1439 usb_kill_urb(ir->urb_in);
1436 usb_free_urb(ir->urb_in); 1440 usb_free_urb(ir->urb_in);
1437 usb_free_coherent(dev, ir->len_in, ir->buf_in, ir->dma_in); 1441 usb_free_coherent(dev, ir->len_in, ir->buf_in, ir->dma_in);
1442 usb_put_dev(dev);
1438 1443
1439 kfree(ir); 1444 kfree(ir);
1440} 1445}
diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c
index 7f4fd859bba5..9c2c8635ff33 100644
--- a/drivers/media/rc/nuvoton-cir.c
+++ b/drivers/media/rc/nuvoton-cir.c
@@ -229,7 +229,6 @@ static int nvt_hw_detect(struct nvt_dev *nvt)
229{ 229{
230 unsigned long flags; 230 unsigned long flags;
231 u8 chip_major, chip_minor; 231 u8 chip_major, chip_minor;
232 int ret = 0;
233 char chip_id[12]; 232 char chip_id[12];
234 bool chip_unknown = false; 233 bool chip_unknown = false;
235 234
@@ -285,7 +284,7 @@ static int nvt_hw_detect(struct nvt_dev *nvt)
285 nvt->chip_minor = chip_minor; 284 nvt->chip_minor = chip_minor;
286 spin_unlock_irqrestore(&nvt->nvt_lock, flags); 285 spin_unlock_irqrestore(&nvt->nvt_lock, flags);
287 286
288 return ret; 287 return 0;
289} 288}
290 289
291static void nvt_cir_ldev_init(struct nvt_dev *nvt) 290static void nvt_cir_ldev_init(struct nvt_dev *nvt)
@@ -1177,7 +1176,6 @@ static int nvt_suspend(struct pnp_dev *pdev, pm_message_t state)
1177 1176
1178static int nvt_resume(struct pnp_dev *pdev) 1177static int nvt_resume(struct pnp_dev *pdev)
1179{ 1178{
1180 int ret = 0;
1181 struct nvt_dev *nvt = pnp_get_drvdata(pdev); 1179 struct nvt_dev *nvt = pnp_get_drvdata(pdev);
1182 1180
1183 nvt_dbg("%s called", __func__); 1181 nvt_dbg("%s called", __func__);
@@ -1195,7 +1193,7 @@ static int nvt_resume(struct pnp_dev *pdev)
1195 nvt_cir_regs_init(nvt); 1193 nvt_cir_regs_init(nvt);
1196 nvt_cir_wake_regs_init(nvt); 1194 nvt_cir_wake_regs_init(nvt);
1197 1195
1198 return ret; 1196 return 0;
1199} 1197}
1200 1198
1201static void nvt_shutdown(struct pnp_dev *pdev) 1199static void nvt_shutdown(struct pnp_dev *pdev)
diff --git a/drivers/media/rc/st_rc.c b/drivers/media/rc/st_rc.c
index 5c151351afa4..0e758ae2e529 100644
--- a/drivers/media/rc/st_rc.c
+++ b/drivers/media/rc/st_rc.c
@@ -22,8 +22,8 @@ struct st_rc_device {
22 int irq; 22 int irq;
23 int irq_wake; 23 int irq_wake;
24 struct clk *sys_clock; 24 struct clk *sys_clock;
25 void *base; /* Register base address */ 25 volatile void __iomem *base; /* Register base address */
26 void *rx_base;/* RX Register base address */ 26 volatile void __iomem *rx_base;/* RX Register base address */
27 struct rc_dev *rdev; 27 struct rc_dev *rdev;
28 bool overclocking; 28 bool overclocking;
29 int sample_mult; 29 int sample_mult;
@@ -267,8 +267,8 @@ static int st_rc_probe(struct platform_device *pdev)
267 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 267 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
268 268
269 rc_dev->base = devm_ioremap_resource(dev, res); 269 rc_dev->base = devm_ioremap_resource(dev, res);
270 if (IS_ERR(rc_dev->base)) { 270 if (IS_ERR((__force void *)rc_dev->base)) {
271 ret = PTR_ERR(rc_dev->base); 271 ret = PTR_ERR((__force void *)rc_dev->base);
272 goto err; 272 goto err;
273 } 273 }
274 274
@@ -278,7 +278,7 @@ static int st_rc_probe(struct platform_device *pdev)
278 rc_dev->rx_base = rc_dev->base; 278 rc_dev->rx_base = rc_dev->base;
279 279
280 280
281 rc_dev->rstc = reset_control_get(dev, NULL); 281 rc_dev->rstc = reset_control_get_optional(dev, NULL);
282 if (IS_ERR(rc_dev->rstc)) 282 if (IS_ERR(rc_dev->rstc))
283 rc_dev->rstc = NULL; 283 rc_dev->rstc = NULL;
284 284
@@ -376,9 +376,10 @@ static int st_rc_resume(struct device *dev)
376 return 0; 376 return 0;
377} 377}
378 378
379static SIMPLE_DEV_PM_OPS(st_rc_pm_ops, st_rc_suspend, st_rc_resume);
380#endif 379#endif
381 380
381static SIMPLE_DEV_PM_OPS(st_rc_pm_ops, st_rc_suspend, st_rc_resume);
382
382#ifdef CONFIG_OF 383#ifdef CONFIG_OF
383static struct of_device_id st_rc_match[] = { 384static struct of_device_id st_rc_match[] = {
384 { .compatible = "st,comms-irb", }, 385 { .compatible = "st,comms-irb", },
@@ -391,11 +392,8 @@ MODULE_DEVICE_TABLE(of, st_rc_match);
391static struct platform_driver st_rc_driver = { 392static struct platform_driver st_rc_driver = {
392 .driver = { 393 .driver = {
393 .name = IR_ST_NAME, 394 .name = IR_ST_NAME,
394 .owner = THIS_MODULE,
395 .of_match_table = of_match_ptr(st_rc_match), 395 .of_match_table = of_match_ptr(st_rc_match),
396#ifdef CONFIG_PM
397 .pm = &st_rc_pm_ops, 396 .pm = &st_rc_pm_ops,
398#endif
399 }, 397 },
400 .probe = st_rc_probe, 398 .probe = st_rc_probe,
401 .remove = st_rc_remove, 399 .remove = st_rc_remove,
diff --git a/drivers/media/rc/streamzap.c b/drivers/media/rc/streamzap.c
index 80c4feeb01ea..bf4a44272f0e 100644
--- a/drivers/media/rc/streamzap.c
+++ b/drivers/media/rc/streamzap.c
@@ -362,16 +362,14 @@ static int streamzap_probe(struct usb_interface *intf,
362 } 362 }
363 363
364 sz->endpoint = &(iface_host->endpoint[0].desc); 364 sz->endpoint = &(iface_host->endpoint[0].desc);
365 if ((sz->endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK) 365 if (!usb_endpoint_dir_in(sz->endpoint)) {
366 != USB_DIR_IN) {
367 dev_err(&intf->dev, "%s: endpoint doesn't match input device " 366 dev_err(&intf->dev, "%s: endpoint doesn't match input device "
368 "02%02x\n", __func__, sz->endpoint->bEndpointAddress); 367 "02%02x\n", __func__, sz->endpoint->bEndpointAddress);
369 retval = -ENODEV; 368 retval = -ENODEV;
370 goto free_sz; 369 goto free_sz;
371 } 370 }
372 371
373 if ((sz->endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) 372 if (!usb_endpoint_xfer_int(sz->endpoint)) {
374 != USB_ENDPOINT_XFER_INT) {
375 dev_err(&intf->dev, "%s: endpoint attributes don't match xfer " 373 dev_err(&intf->dev, "%s: endpoint attributes don't match xfer "
376 "02%02x\n", __func__, sz->endpoint->bmAttributes); 374 "02%02x\n", __func__, sz->endpoint->bmAttributes);
377 retval = -ENODEV; 375 retval = -ENODEV;