upstream: au0828-input: Be sure that IR is enabled at polling
authorMauro Carvalho Chehab <m.chehab@samsung.com>
Thu, 7 Aug 2014 13:46:30 +0000 (10:46 -0300)
committerChanho Park <chanho61.park@samsung.com>
Tue, 18 Nov 2014 03:00:25 +0000 (12:00 +0900)
When the DVB code sets the frontend, it disables the IR
INT, probably due to some hardware bug, as there's no code
there at au8522 frontend that writes on register 0xe0.

Fixing it at au8522 code is hard, as it doesn't know if the
IR is enabled or disabled, and just restoring the value of
register 0xe0 could cause other nasty effects. So, better
to add a hack at au0828-input polling interval to enable int,
if disabled.

Backports http://git.linuxtv.org/cgit.cgi/media_tree.git/commit/?id=a623ff64e71e
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Change-Id: Ie75c8e04ddefb0ab5571a5721204e79ed92de1f1

drivers/media/usb/au0828/au0828-input.c

index b4374de..fcb9065 100644 (file)
@@ -94,14 +94,19 @@ static int au8522_rc_read(struct au0828_rc *ir, u16 reg, int val,
 static int au8522_rc_andor(struct au0828_rc *ir, u16 reg, u8 mask, u8 value)
 {
        int rc;
-       char buf;
+       char buf, oldbuf;
 
        rc = au8522_rc_read(ir, reg, -1, &buf, 1);
        if (rc < 0)
                return rc;
 
+       oldbuf = buf;
        buf = (buf & ~mask) | (value & mask);
 
+       /* Nothing to do, just return */
+       if (buf == oldbuf)
+               return 0;
+
        return au8522_rc_write(ir, reg, buf);
 }
 
@@ -126,8 +131,11 @@ static int au0828_get_key_au8522(struct au0828_rc *ir)
 
        /* Check IR int */
        rc = au8522_rc_read(ir, 0xe1, -1, buf, 1);
-       if (rc < 0 || !(buf[0] & (1 << 4)))
+       if (rc < 0 || !(buf[0] & (1 << 4))) {
+               /* Be sure that IR is enabled */
+               au8522_rc_set(ir, 0xe0, 1 << 4);
                return 0;
+       }
 
        /* Something arrived. Get the data */
        rc = au8522_rc_read(ir, 0xe3, 0x11, buf, sizeof(buf));