From patchwork Wed Jul 28 15:14:04 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Levitsky X-Patchwork-Id: 114818 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6SFEWgY017833 for ; Wed, 28 Jul 2010 15:14:32 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754857Ab0G1POa (ORCPT ); Wed, 28 Jul 2010 11:14:30 -0400 Received: from mail-bw0-f46.google.com ([209.85.214.46]:59260 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754822Ab0G1PO3 (ORCPT ); Wed, 28 Jul 2010 11:14:29 -0400 Received: by mail-bw0-f46.google.com with SMTP id 1so4014228bwz.19 for ; Wed, 28 Jul 2010 08:14:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=wJLdhtF73/zq7k5tlfKBFgSkM/H016eSwLwclrK6VwE=; b=VvWeQYYpg+IKeSIOTa6HMblhlWDc9ht+9cEAqxsd/gUaj7zz1SAZ4KkgbYHfX4uCrW SGZ0aAQe85wYSBWaVZuqpK3nXPoreHR+FZSlB1A8ctYjTtrCRnmT8rCojcL3XWgXzkRa VzcbmgjwYCp8FKhdDWVlaPU8/V3O7zIGJJ2bc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=RJ9g5c2U+x0vjZPt8oaxT+jxF9PrTWh5oEQU5izq6WN9xwexWVYgVZeZEXlzZTKOFH GbnQueeByV9Yq89+MYm70mmhUSN8bf1FdaxC1u2c0iQD1Q3uujiptob7d0VPTP/pkZYh zpa06T14AkfxpYG6u5OdiZyPq64Uc7edYnkzQ= Received: by 10.204.177.79 with SMTP id bh15mr7884324bkb.121.1280330068395; Wed, 28 Jul 2010 08:14:28 -0700 (PDT) Received: from localhost.localdomain (IGLD-84-229-112-176.inter.net.il [84.229.112.176]) by mx.google.com with ESMTPS id bq20sm4855282bkb.16.2010.07.28.08.14.25 (version=SSLv3 cipher=RC4-MD5); Wed, 28 Jul 2010 08:14:26 -0700 (PDT) From: Maxim Levitsky To: lirc-list@lists.sourceforge.net Cc: Jarod Wilson , linux-input@vger.kernel.org, linux-media@vger.kernel.org, Mauro Carvalho Chehab , Maxim Levitsky Subject: [PATCH 2/9] IR: minor fixes: Date: Wed, 28 Jul 2010 18:14:04 +0300 Message-Id: <1280330051-27732-3-git-send-email-maximlevitsky@gmail.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1280330051-27732-1-git-send-email-maximlevitsky@gmail.com> References: <1280330051-27732-1-git-send-email-maximlevitsky@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 28 Jul 2010 15:14:32 +0000 (UTC) diff --git a/drivers/media/IR/ir-core-priv.h b/drivers/media/IR/ir-core-priv.h index babd520..8ce80e4 100644 --- a/drivers/media/IR/ir-core-priv.h +++ b/drivers/media/IR/ir-core-priv.h @@ -76,7 +76,6 @@ struct ir_raw_event_ctrl { struct lirc_codec { struct ir_input_dev *ir_dev; struct lirc_driver *drv; - int lircdata; } lirc; }; @@ -104,7 +103,7 @@ static inline void decrease_duration(struct ir_raw_event *ev, unsigned duration) ev->duration -= duration; } -#define TO_US(duration) (((duration) + 500) / 1000) +#define TO_US(duration) ((duration) / 1000) #define TO_STR(is_pulse) ((is_pulse) ? "pulse" : "space") #define IS_RESET(ev) (ev.duration == 0) diff --git a/drivers/media/IR/ir-lirc-codec.c b/drivers/media/IR/ir-lirc-codec.c index 3ba482d..8ca01fd 100644 --- a/drivers/media/IR/ir-lirc-codec.c +++ b/drivers/media/IR/ir-lirc-codec.c @@ -32,6 +32,7 @@ static int ir_lirc_decode(struct input_dev *input_dev, struct ir_raw_event ev) { struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); + int sample; if (!(ir_dev->raw->enabled_protocols & IR_TYPE_LIRC)) return 0; @@ -39,18 +40,21 @@ static int ir_lirc_decode(struct input_dev *input_dev, struct ir_raw_event ev) if (!ir_dev->raw->lirc.drv || !ir_dev->raw->lirc.drv->rbuf) return -EINVAL; + if (IS_RESET(ev)) + return 0; + IR_dprintk(2, "LIRC data transfer started (%uus %s)\n", TO_US(ev.duration), TO_STR(ev.pulse)); - ir_dev->raw->lirc.lircdata += ev.duration / 1000; + + sample = ev.duration / 1000; if (ev.pulse) - ir_dev->raw->lirc.lircdata |= PULSE_BIT; + sample |= PULSE_BIT; lirc_buffer_write(ir_dev->raw->lirc.drv->rbuf, - (unsigned char *) &ir_dev->raw->lirc.lircdata); + (unsigned char *) &sample); wake_up(&ir_dev->raw->lirc.drv->rbuf->wait_poll); - ir_dev->raw->lirc.lircdata = 0; return 0; } @@ -224,8 +228,6 @@ static int ir_lirc_register(struct input_dev *input_dev) ir_dev->raw->lirc.drv = drv; ir_dev->raw->lirc.ir_dev = ir_dev; - ir_dev->raw->lirc.lircdata = PULSE_MASK; - return 0; lirc_register_failed: diff --git a/drivers/media/IR/ir-raw-event.c b/drivers/media/IR/ir-raw-event.c index 6f192ef..ab9c4da 100644 --- a/drivers/media/IR/ir-raw-event.c +++ b/drivers/media/IR/ir-raw-event.c @@ -66,6 +66,9 @@ int ir_raw_event_store(struct input_dev *input_dev, struct ir_raw_event *ev) if (!ir->raw) return -EINVAL; + IR_dprintk(2, "sample: (05%dus %s)\n", TO_US(ev->duration), + TO_STR(ev->pulse)); + if (kfifo_in(&ir->raw->kfifo, ev, sizeof(*ev)) != sizeof(*ev)) return -ENOMEM;