From patchwork Tue Nov 9 21:11:04 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarod Wilson X-Patchwork-Id: 4831 Return-path: Envelope-to: mchehab@pedra Delivery-date: Tue, 09 Nov 2010 19:12:17 -0200 Received: from mchehab by pedra with local (Exim 4.72) (envelope-from ) id 1PFvUG-00020S-NX for mchehab@pedra; Tue, 09 Nov 2010 19:12:17 -0200 Received: from casper.infradead.org [85.118.1.10] by pedra with IMAP (fetchmail-6.3.17) for (single-drop); Tue, 09 Nov 2010 19:12:16 -0200 (BRST) Received: from vger.kernel.org ([209.132.180.67]) by casper.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1PFvTW-0007cc-Sp; Tue, 09 Nov 2010 21:11:31 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753827Ab0KIVLH (ORCPT + 1 other); Tue, 9 Nov 2010 16:11:07 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56787 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752720Ab0KIVLF (ORCPT ); Tue, 9 Nov 2010 16:11:05 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oA9LB5CA015242 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 9 Nov 2010 16:11:05 -0500 Received: from xavier.bos.redhat.com (xavier.bos.redhat.com [10.16.16.50]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id oA9LB4ic009196; Tue, 9 Nov 2010 16:11:05 -0500 Received: by xavier.bos.redhat.com (Postfix, from userid 500) id BC155816F7; Tue, 9 Nov 2010 16:11:04 -0500 (EST) Date: Tue, 9 Nov 2010 16:11:04 -0500 From: Jarod Wilson To: linux-media@vger.kernel.org Cc: mchehab@redhat.com Subject: [PATCH] nuvoton-cir: improve buffer parsing responsiveness Message-ID: <20101109211104.GC11073@redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Sender: Rather than waiting for trigger bits, the formula for which was slightly messy, and apparently, not actually 100% complete for some remotes, just call ir_raw_event_handle whenever we finish parsing a chunk of data from the rx fifo, similar to mceusb, as well as whenever we see an 'end of signal data' 0x80 packet. Signed-off-by: Jarod Wilson --- Note: this patch should really go into 2.6.37, imo, as non-mce remotes frequently don't behave without it. drivers/media/IR/nuvoton-cir.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/media/IR/nuvoton-cir.c b/drivers/media/IR/nuvoton-cir.c index 301be53..acc729c 100644 --- a/drivers/media/IR/nuvoton-cir.c +++ b/drivers/media/IR/nuvoton-cir.c @@ -603,6 +603,8 @@ static void nvt_process_rx_ir_data(struct nvt_dev *nvt) count = nvt->pkts; nvt_dbg_verbose("Processing buffer of len %d", count); + init_ir_raw_event(&rawir); + for (i = 0; i < count; i++) { nvt->pkts--; sample = nvt->buf[i]; @@ -643,11 +645,15 @@ static void nvt_process_rx_ir_data(struct nvt_dev *nvt) * indicates end of IR signal, but new data incoming. In both * cases, it means we're ready to call ir_raw_event_handle */ - if (sample == BUF_PULSE_BIT || ((sample != BUF_LEN_MASK) && - (sample & BUF_REPEAT_MASK) == BUF_REPEAT_BYTE)) + if ((sample == BUF_PULSE_BIT) && nvt->pkts) { + nvt_dbg("Calling ir_raw_event_handle (signal end)\n"); ir_raw_event_handle(nvt->rdev); + } } + nvt_dbg("Calling ir_raw_event_handle (buffer empty)\n"); + ir_raw_event_handle(nvt->rdev); + if (nvt->pkts) { nvt_dbg("Odd, pkts should be 0 now... (its %u)", nvt->pkts); nvt->pkts = 0;