From patchwork Thu Aug 7 13:46:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 4691301 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 33C7E9F373 for ; Thu, 7 Aug 2014 13:46:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 68107201B4 for ; Thu, 7 Aug 2014 13:46:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1E79E20148 for ; Thu, 7 Aug 2014 13:46:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757510AbaHGNqk (ORCPT ); Thu, 7 Aug 2014 09:46:40 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:49208 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757254AbaHGNqj (ORCPT ); Thu, 7 Aug 2014 09:46:39 -0400 Received: from [187.57.189.12] (helo=smtp.w2.samsung.com) by bombadil.infradead.org with esmtpsa (Exim 4.80.1 #2 (Red Hat Linux)) id 1XFO1d-0004BW-8f; Thu, 07 Aug 2014 13:46:37 +0000 Received: from mchehab by smtp.w2.samsung.com with local (Exim 4.80.1) (envelope-from ) id 1XFO1Y-0002cQ-AC; Thu, 07 Aug 2014 10:46:32 -0300 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Linux Media Mailing List , Mauro Carvalho Chehab Subject: [PATCH] au0828-input: Be sure that IR is enabled at polling Date: Thu, 7 Aug 2014 10:46:30 -0300 Message-Id: <1407419190-10031-1-git-send-email-m.chehab@samsung.com> X-Mailer: git-send-email 1.9.3 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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));