From: jarod@redhat.com (Jarod Wilson)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 1/1] rc: Add support for GPIO based IR Receiver driver.
Date: Mon, 23 Apr 2012 16:11:31 -0400 [thread overview]
Message-ID: <20120423201131.GG31244@redhat.com> (raw)
In-Reply-To: <1330408300-21939-1-git-send-email-kumarrav@codeaurora.org>
On Tue, Feb 28, 2012 at 11:21:40AM +0530, Ravi Kumar V wrote:
> Adds GPIO based IR Receiver driver. It decodes signals using decoders
> available in rc framework.
Been meaning to look at this, but it looks like its already merged
upstream. Just one question though, inlined below.
> --- /dev/null
> +++ b/drivers/media/rc/gpio-ir-recv.c
> @@ -0,0 +1,205 @@
> +/* Copyright (c) 2012, Code Aurora Forum. All rights reserved.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 and
> + * only version 2 as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/init.h>
> +#include <linux/module.h>
> +#include <linux/interrupt.h>
> +#include <linux/gpio.h>
> +#include <linux/slab.h>
> +#include <linux/platform_device.h>
> +#include <linux/irq.h>
> +#include <media/rc-core.h>
> +#include <media/gpio-ir-recv.h>
> +
> +#define GPIO_IR_DRIVER_NAME "gpio-rc-recv"
> +#define GPIO_IR_DEVICE_NAME "gpio_ir_recv"
> +
> +struct gpio_rc_dev {
> + struct rc_dev *rcdev;
> + unsigned int gpio_nr;
> + bool active_low;
> +};
> +
> +static irqreturn_t gpio_ir_recv_irq(int irq, void *dev_id)
> +{
> + struct gpio_rc_dev *gpio_dev = dev_id;
> + unsigned int gval;
> + int rc = 0;
> + enum raw_event_type type = IR_SPACE;
> +
> + gval = gpio_get_value_cansleep(gpio_dev->gpio_nr);
> +
> + if (gval < 0)
> + goto err_get_value;
> +
> + if (gpio_dev->active_low)
> + gval = !gval;
> +
> + if (gval == 1)
> + type = IR_PULSE;
What happens if gval is > 1?
> + rc = ir_raw_event_store_edge(gpio_dev->rcdev, type);
> + if (rc < 0)
> + goto err_get_value;
> +
> + ir_raw_event_handle(gpio_dev->rcdev);
> +
> +err_get_value:
> + return IRQ_HANDLED;
> +}
Looks like you'll store a space any time you get gval > 1, which may or
may not be intended here...
--
Jarod Wilson
jarod at redhat.com
next prev parent reply other threads:[~2012-04-23 20:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-28 5:51 [PATCH v3 1/1] rc: Add support for GPIO based IR Receiver driver Ravi Kumar V
2012-02-28 20:29 ` James Hogan
2012-02-29 5:57 ` Ravi Kumar V
2012-02-29 12:24 ` Trilok Soni
2012-03-02 7:02 ` Trilok Soni
2012-03-23 20:22 ` Trilok Soni
2012-04-23 20:11 ` Jarod Wilson [this message]
2012-06-12 12:56 ` Ravi Kumar V
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=20120423201131.GG31244@redhat.com \
--to=jarod@redhat.com \
--cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).