All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@redhat.com>
To: linux-media@vger.kernel.org,
	Linux Media Mailing List <linux-media@vger.kernel.org>
Subject: [PATCH 19/26] ir-nec-decoder: Cleanups
Date: Tue, 6 Apr 2010 15:18:01 -0300	[thread overview]
Message-ID: <20100406151801.3367584c@pedra> (raw)
In-Reply-To: <cover.1270577768.git.mchehab@redhat.com>

Remove dead code and properly name a few constants

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

diff --git a/drivers/media/IR/ir-nec-decoder.c b/drivers/media/IR/ir-nec-decoder.c
index 33b260f..087211c 100644
--- a/drivers/media/IR/ir-nec-decoder.c
+++ b/drivers/media/IR/ir-nec-decoder.c
@@ -14,38 +14,14 @@
 
 #include <media/ir-core.h>
 
+#define NEC_NBITS		32
 #define NEC_UNIT		559979 /* ns */
 #define NEC_HEADER_MARK		(16 * NEC_UNIT)
 #define NEC_HEADER_SPACE	(8 * NEC_UNIT)
 #define NEC_REPEAT_SPACE	(4 * NEC_UNIT)
 #define NEC_MARK		(NEC_UNIT)
-#define NEC_0_SYMBOL		(NEC_UNIT)
-#define NEC_1_SYMBOL		(3 * NEC_UNIT)
-
-/* Start time: 4.5 ms + 560 us of the next pulse */
-#define MIN_START_TIME	(3900000 + 560000)
-#define MAX_START_TIME	(5100000 + 560000)
-
-/* Bit 1 time: 2.25ms us */
-#define MIN_BIT1_TIME	2050000
-#define MAX_BIT1_TIME	2450000
-
-/* Bit 0 time: 1.12ms us */
-#define MIN_BIT0_TIME	920000
-#define MAX_BIT0_TIME	1320000
-
-/* Total IR code is 110 ms, including the 9 ms for the start pulse */
-#define MAX_NEC_TIME	4000000
-
-/* Total IR code is 110 ms, including the 9 ms for the start pulse */
-#define MIN_REPEAT_TIME	99000000
-#define MAX_REPEAT_TIME	112000000
-
-/* Repeat time: 2.25ms us */
-#define MIN_REPEAT_START_TIME	2050000
-#define MAX_REPEAT_START_TIME	3000000
-
-#define REPEAT_TIME	240 /* ms */
+#define NEC_0_SPACE		(NEC_UNIT)
+#define NEC_1_SPACE		(3 * NEC_UNIT)
 
 /* Used to register nec_decoder clients */
 static LIST_HEAD(decoder_list);
@@ -223,11 +199,11 @@ static int handle_event(struct input_dev *input_dev,
 		if (last_bit)
 			goto err;
 
-		if ((ev->delta.tv_nsec >= NEC_0_SYMBOL - NEC_UNIT / 2) &&
-		    (ev->delta.tv_nsec < NEC_0_SYMBOL + NEC_UNIT / 2))
+		if ((ev->delta.tv_nsec >= NEC_0_SPACE - NEC_UNIT / 2) &&
+		    (ev->delta.tv_nsec < NEC_0_SPACE + NEC_UNIT / 2))
 			bit = 0;
-		else if ((ev->delta.tv_nsec >= NEC_1_SYMBOL - NEC_UNIT / 2) &&
-		         (ev->delta.tv_nsec < NEC_1_SYMBOL + NEC_UNIT / 2))
+		else if ((ev->delta.tv_nsec >= NEC_1_SPACE - NEC_UNIT / 2) &&
+		         (ev->delta.tv_nsec < NEC_1_SPACE + NEC_UNIT / 2))
 			bit = 1;
 		else {
 			IR_dprintk(1, "Decode failed at %d-th bit (%s) @%luus\n",
@@ -256,7 +232,7 @@ static int handle_event(struct input_dev *input_dev,
 				data->nec_code.not_command |= 1 << (shift - 24);
 			}
 		}
-		if (++data->count == 32) {
+		if (++data->count == NEC_NBITS) {
 			u32 scancode;
 			/*
 			 * Fixme: may need to accept Extended NEC protocol?
-- 
1.6.6.1



  parent reply	other threads:[~2010-04-06 18:18 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1270577768.git.mchehab@redhat.com>
2010-04-06 18:18 ` [PATCH 22/26] V4L-DVB: ir-core: remove the ancillary buffer Mauro Carvalho Chehab
2010-04-06 18:18 ` [PATCH 24/26] V4L/DVB: ir-core: Add support for badly-implemented hardware decoders Mauro Carvalho Chehab
2010-04-06 18:18 ` [PATCH 26/26] V4L/DVB: ir-rc5-decoder: fix state machine Mauro Carvalho Chehab
2010-04-06 18:18 ` [PATCH 23/26] V4L/DVB: ir-core: move rc map code to rc-map.h Mauro Carvalho Chehab
2010-04-06 18:18 ` [PATCH 25/26] V4L/DVB: re-add enable/disable check to the IR decoders Mauro Carvalho Chehab
2010-04-06 18:18 ` Mauro Carvalho Chehab [this message]
2010-04-06 18:18 ` [PATCH 15/26] V4L/DVB: ir-core: re-add some debug functions for keytable changes Mauro Carvalho Chehab
2010-04-06 18:18 ` [PATCH 20/26] V4L-DVB: ir-rc5-decoder: Add a decoder for RC-5 IR protocol Mauro Carvalho Chehab
2010-04-06 18:18 ` [PATCH 13/26] V4L/DVB: saa7134: Add support for both positive and negative edge IRQ Mauro Carvalho Chehab
2010-04-06 18:18 ` [PATCH 18/26] V4L/DVB: ir-nec-decoder: Reimplement the entire decoder Mauro Carvalho Chehab
2010-04-06 18:18 ` [PATCH 21/26] V4L/DVB: cx88: don't handle IR on Pixelview too fast Mauro Carvalho Chehab
2010-04-06 18:18 ` [PATCH 14/26] V4L/DVB: drivers/media/IR - improve keytable code Mauro Carvalho Chehab
2010-04-06 18:18 ` [PATCH 10/26] V4L/DVB: ir-core: Make use of the new IR keymap modules Mauro Carvalho Chehab
2010-04-06 18:18 ` [PATCH 11/26] V4L/DVB: ir-common: remove keymap tables from the module Mauro Carvalho Chehab
2010-04-06 18:18 ` [PATCH 17/26] V4L/DVB: Convert drivers/media/dvb/ttpci/budget-ci.c to use ir-core Mauro Carvalho Chehab
2010-04-06 18:18 ` [PATCH 12/26] V4L/DVB: saa7134: Fix IRQ2 bit names for the register map Mauro Carvalho Chehab
2010-04-06 18:18 ` [PATCH 07/26] V4L/DVB: ir-core: Add support for RC map code register Mauro Carvalho Chehab
2010-04-06 18:18 ` [PATCH 06/26] V4L/DVB: ir-common: move IR tables from ir-keymaps.c to a separate file Mauro Carvalho Chehab
2010-04-06 18:18 ` [PATCH 09/26] V4L/DVB: ir: prepare IR code for a parameter change at register function Mauro Carvalho Chehab
2010-04-06 18:18 ` [PATCH 05/26] V4L/DVB: ir-common: Use macros to define the keytables Mauro Carvalho Chehab
2010-04-06 18:18 ` [PATCH 08/26] V4L/DVB: Break Remote Controller keymaps into modules Mauro Carvalho Chehab
2010-04-10 12:27   ` Andy Walls
2010-04-10 16:06     ` Mauro Carvalho Chehab
2010-04-10 17:26       ` Andy Walls
2010-04-06 18:18 ` [PATCH 04/26] V4L/DVB: rename all *_rc_keys to ir_codes_*_nec_table Mauro Carvalho Chehab
2010-04-06 18:18 ` [PATCH 03/26] V4L/DVB: IR: use IR_KEYTABLE where an IR table is needed Mauro Carvalho Chehab
2010-04-06 18:18 ` [PATCH 01/26] V4L/DVB: ir-common: Use a function to declare an IR table Mauro Carvalho Chehab
2010-04-06 18:18 ` [PATCH 02/26] V4L/DVB: ir-common: re-order keytables by name and remove duplicates Mauro Carvalho Chehab
2010-04-06 19:13 ` [PATCH 16/26] V4L/DVB: ir-core: improve keyup/keydown logic Mauro Carvalho Chehab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100406151801.3367584c@pedra \
    --to=mchehab@redhat.com \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.