diff options
Diffstat (limited to 'drivers/media/rc/imon.c')
-rw-r--r-- | drivers/media/rc/imon.c | 55 |
1 files changed, 19 insertions, 36 deletions
diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c index eb943e862515..950d068ba806 100644 --- a/drivers/media/rc/imon.c +++ b/drivers/media/rc/imon.c @@ -27,6 +27,7 @@ #include <linux/errno.h> #include <linux/init.h> #include <linux/kernel.h> +#include <linux/ktime.h> #include <linux/module.h> #include <linux/slab.h> #include <linux/uaccess.h> @@ -37,7 +38,6 @@ #include <linux/usb/input.h> #include <media/rc-core.h> -#include <linux/time.h> #include <linux/timer.h> #define MOD_AUTHOR "Jarod Wilson <jarod@wilsonet.com>" @@ -1168,29 +1168,6 @@ out: return retval; } -static inline int tv2int(const struct timeval *a, const struct timeval *b) -{ - int usecs = 0; - int sec = 0; - - if (b->tv_usec > a->tv_usec) { - usecs = 1000000; - sec--; - } - - usecs += a->tv_usec - b->tv_usec; - - sec += a->tv_sec - b->tv_sec; - sec *= 1000; - usecs /= 1000; - sec += usecs; - - if (sec < 0) - sec = 1000; - - return sec; -} - /* * The directional pad behaves a bit differently, depending on whether this is * one of the older ffdc devices or a newer device. Newer devices appear to @@ -1201,16 +1178,16 @@ static inline int tv2int(const struct timeval *a, const struct timeval *b) */ static int stabilize(int a, int b, u16 timeout, u16 threshold) { - struct timeval ct; - static struct timeval prev_time = {0, 0}; - static struct timeval hit_time = {0, 0}; + ktime_t ct; + static ktime_t prev_time; + static ktime_t hit_time; static int x, y, prev_result, hits; int result = 0; - int msec, msec_hit; + long msec, msec_hit; - do_gettimeofday(&ct); - msec = tv2int(&ct, &prev_time); - msec_hit = tv2int(&ct, &hit_time); + ct = ktime_get(); + msec = ktime_ms_delta(ct, prev_time); + msec_hit = ktime_ms_delta(ct, hit_time); if (msec > 100) { x = 0; @@ -1688,9 +1665,9 @@ static void imon_incoming_scancode(struct imon_context *ictx, u32 kc; u64 scancode; int press_type = 0; - int msec; - struct timeval t; - static struct timeval prev_time = { 0, 0 }; + long msec; + ktime_t t; + static ktime_t prev_time; u8 ktype; /* filter out junk data on the older 0xffdc imon devices */ @@ -1783,10 +1760,10 @@ static void imon_incoming_scancode(struct imon_context *ictx, /* Only panel type events left to process now */ spin_lock_irqsave(&ictx->kc_lock, flags); - do_gettimeofday(&t); + t = ktime_get(); /* KEY_MUTE repeats from knob need to be suppressed */ if (ictx->kc == KEY_MUTE && ictx->kc == ictx->last_keycode) { - msec = tv2int(&t, &prev_time); + msec = ktime_ms_delta(t, prev_time); if (msec < ictx->idev->rep[REP_DELAY]) { spin_unlock_irqrestore(&ictx->kc_lock, flags); return; @@ -1956,6 +1933,7 @@ static void imon_get_ffdc_type(struct imon_context *ictx) break; /* iMON VFD, iMON IR */ case 0x24: + case 0x30: case 0x85: dev_info(ictx->dev, "0xffdc iMON VFD, iMON IR"); detected_display_type = IMON_DISPLAY_TYPE_VFD; @@ -1974,6 +1952,11 @@ static void imon_get_ffdc_type(struct imon_context *ictx) detected_display_type = IMON_DISPLAY_TYPE_LCD; allowed_protos = RC_PROTO_BIT_RC6_MCE; break; + /* no display, iMON IR */ + case 0x26: + dev_info(ictx->dev, "0xffdc iMON Inside, iMON IR"); + ictx->display_supported = false; + break; default: dev_info(ictx->dev, "Unknown 0xffdc device, defaulting to VFD and iMON IR"); detected_display_type = IMON_DISPLAY_TYPE_VFD; |