From patchwork Thu Jul 26 06:14:24 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ravi Kumar V X-Patchwork-Id: 1240391 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 774633FC5A for ; Thu, 26 Jul 2012 06:14:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751812Ab2GZGOj (ORCPT ); Thu, 26 Jul 2012 02:14:39 -0400 Received: from wolverine02.qualcomm.com ([199.106.114.251]:34966 "EHLO wolverine02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751266Ab2GZGOg (ORCPT ); Thu, 26 Jul 2012 02:14:36 -0400 X-IronPort-AV: E=McAfee;i="5400,1158,6783"; a="212290090" Received: from pdmz-ns-snip_115_219.qualcomm.com (HELO mostmsg01.qualcomm.com) ([199.106.115.219]) by wolverine02.qualcomm.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 25 Jul 2012 23:14:37 -0700 Received: from kumarrav-linux.in.qualcomm.com (pdmz-ns-snip_218_1.qualcomm.com [192.168.218.1]) by mostmsg01.qualcomm.com (Postfix) with ESMTPA id 6393510004B7; Wed, 25 Jul 2012 23:14:33 -0700 (PDT) From: Ravi Kumar V To: mchehab@infradead.org Cc: paul.gortmaker@windriver.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, davidb@codequrora.org, bryanh@codeaurora.org, tsoni@codeaurora.org, Ravi Kumar V Subject: [PATCH] media: rc: Add support to decode Remotes using NECx IR protocol Date: Thu, 26 Jul 2012 11:44:24 +0530 Message-Id: <1343283264-25367-1-git-send-email-kumarrav@codeaurora.org> X-Mailer: git-send-email 1.7.8 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Some remotes use NECx IR protocol to send remote control key events. Present nec decoder in rc framework is assuming to have 2 stop bits (pulse width of 560us & space width 5600us) in NECx, but in reality NECx sends only pulse of 560us and space untill next frame.So here we can ignore the space width in stop bit as it is variable. Signed-off-by: Ravi Kumar V --- drivers/media/rc/ir-nec-decoder.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/drivers/media/rc/ir-nec-decoder.c b/drivers/media/rc/ir-nec-decoder.c index 3c9431a..a3fe1c8 100644 --- a/drivers/media/rc/ir-nec-decoder.c +++ b/drivers/media/rc/ir-nec-decoder.c @@ -149,6 +149,10 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev) break; data->state = STATE_TRAILER_SPACE; + + if (data->is_nec_x) + goto rc_data; + return 0; case STATE_TRAILER_SPACE: @@ -157,7 +161,7 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev) if (!geq_margin(ev.duration, NEC_TRAILER_SPACE, NEC_UNIT / 2)) break; - +rc_data: address = bitrev8((data->bits >> 24) & 0xff); not_address = bitrev8((data->bits >> 16) & 0xff); command = bitrev8((data->bits >> 8) & 0xff);