[PATCH] au0828-input: Be sure that IR is enabled at polling
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. Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com --- drivers/media/usb/au0828/au0828-input.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/media/usb/au0828/au0828-input.c b/drivers/media/usb/au0828/au0828-input.c index 94d29c2a6fcf..b4475706dfd2 100644 --- a/drivers/media/usb/au0828/au0828-input.c +++ b/drivers/media/usb/au0828/au0828-input.c @@ -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); } @@ -127,8 +132,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)); -- 1.9.3 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] au0828-input: Be sure that IR is enabled at polling
On Thu, Aug 7, 2014 at 9:46 AM, Mauro Carvalho Chehab m.che...@samsung.com wrote: 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. Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com --- drivers/media/usb/au0828/au0828-input.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/media/usb/au0828/au0828-input.c b/drivers/media/usb/au0828/au0828-input.c index 94d29c2a6fcf..b4475706dfd2 100644 --- a/drivers/media/usb/au0828/au0828-input.c +++ b/drivers/media/usb/au0828/au0828-input.c @@ -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); } @@ -127,8 +132,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); Shouldn't this be a call to au8522_rc_andor() rather than au8522_rc_set()? Devin -- Devin J. Heitmueller - Kernel Labs http://www.kernellabs.com -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] au0828-input: Be sure that IR is enabled at polling
Em Thu, 07 Aug 2014 10:00:31 -0400 Devin Heitmueller dheitmuel...@kernellabs.com escreveu: On Thu, Aug 7, 2014 at 9:46 AM, Mauro Carvalho Chehab m.che...@samsung.com wrote: 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. Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com --- drivers/media/usb/au0828/au0828-input.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/media/usb/au0828/au0828-input.c b/drivers/media/usb/au0828/au0828-input.c index 94d29c2a6fcf..b4475706dfd2 100644 --- a/drivers/media/usb/au0828/au0828-input.c +++ b/drivers/media/usb/au0828/au0828-input.c @@ -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); } @@ -127,8 +132,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); Shouldn't this be a call to au8522_rc_andor() rather than au8522_rc_set()? Well, au8522_rc_set is defined as: #define au8522_rc_set(ir, reg, bit) au8522_rc_andor(ir, (reg), (bit), (bit)) Regards, Mauro -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] au0828-input: Be sure that IR is enabled at polling
Well, au8522_rc_set is defined as: #define au8522_rc_set(ir, reg, bit) au8522_rc_andor(ir, (reg), (bit), (bit)) Ah, ok. It's just a really poorly named macro. Nevermind then. Devin -- Devin J. Heitmueller - Kernel Labs http://www.kernellabs.com -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] au0828-input: Be sure that IR is enabled at polling
Em Thu, 07 Aug 2014 10:14:45 -0400 Devin Heitmueller dheitmuel...@kernellabs.com escreveu: Well, au8522_rc_set is defined as: #define au8522_rc_set(ir, reg, bit) au8522_rc_andor(ir, (reg), (bit), (bit)) Ah, ok. It's just a really poorly named macro. Nevermind then. Yep. calling it au8522_rc_setbits would likely be better. I tried to stick with the same name convention as this macro: drivers/media/usb/au0828/au0828.h:#define au0828_set(dev, reg, bit) au0828_andor(dev, (reg), (bit), (bit)) Regards, Mauro -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html