devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Alexander Bersenev <bay-d8LqKIyZzER6k2ZkT/Rh8A@public.gmane.org>,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
	grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org,
	james.hogan-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org,
	m.chehab-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
	mark.rutland-5wv7dgnIgG8@public.gmane.org,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org,
	pawel.moll-5wv7dgnIgG8@public.gmane.org,
	rdunlap-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	sean-hENCXIMQXOg@public.gmane.org,
	srinivas.kandagatla-qxv4g6HH51o@public.gmane.org,
	wingrime-3kdeTeqwOZ9EV1b7eY7vFQ@public.gmane.org,
	linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v7 2/3] [media] rc: add sunxi-ir driver
Date: Tue, 20 May 2014 09:18:59 +0200	[thread overview]
Message-ID: <537B01E3.2060206@redhat.com> (raw)
In-Reply-To: <20140519202616.GA25415-0WFrdVpeebksCylrc8G9yg@public.gmane.org>

Hi,

On 05/19/2014 10:26 PM, David Härdeman wrote:
> On Thu, May 15, 2014 at 03:56:41AM +0600, Alexander Bersenev wrote:
>> This patch adds driver for sunxi IR controller.
>> It is based on Alexsey Shestacov's work based on the original driver
>> supplied by Allwinner.
>>
> 
> ...
> 
>> +static irqreturn_t sunxi_ir_irq(int irqno, void *dev_id)
>> +{
>> +	unsigned long status;
>> +	unsigned char dt;
>> +	unsigned int cnt, rc;
>> +	struct sunxi_ir *ir = dev_id;
>> +	DEFINE_IR_RAW_EVENT(rawir);
>> +
>> +	spin_lock(&ir->ir_lock);
>> +
>> +	status = readl(ir->base + SUNXI_IR_RXSTA_REG);
>> +
>> +	/* clean all pending statuses */
>> +	writel(status | REG_RXSTA_CLEARALL, ir->base + SUNXI_IR_RXSTA_REG);
>> +
>> +	if (status & REG_RXINT_RAI_EN) {
>> +		/* How many messages in fifo */
>> +		rc  = (status >> REG_RXSTA_RAC__SHIFT) & REG_RXSTA_RAC__MASK;
>> +		/* Sanity check */
>> +		rc = rc > SUNXI_IR_FIFO_SIZE ? SUNXI_IR_FIFO_SIZE : rc;
>> +		/* If we have data */
>> +		for (cnt = 0; cnt < rc; cnt++) {
>> +			/* for each bit in fifo */
>> +			dt = readb(ir->base + SUNXI_IR_RXFIFO_REG);
>> +			rawir.pulse = (dt & 0x80) != 0;
>> +			rawir.duration = (dt & 0x7f) * SUNXI_IR_SAMPLE;
> 
> Can the hardware actually return a zero duration or should that be dt &
> 0x7f + 1?
> 
> (Not familiar with this particular hardware but I know I've seen that
> behaviour before).

Good point, I've just checked and the datasheet says the reported pulse
duration can be up to 128, so that would make the range 1-128 not 0-127,
so I believe we indeed need to add 1 to this.

Regards,

Hans


-- 
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

  parent reply	other threads:[~2014-05-20  7:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-14 21:56 [PATCH v7 0/3] ARM: sunxi: Add support for consumer infrared devices Alexander Bersenev
     [not found] ` <1400104602-16431-1-git-send-email-bay-d8LqKIyZzER6k2ZkT/Rh8A@public.gmane.org>
2014-05-14 21:56   ` [PATCH v7 1/3] ARM: sunxi: Add documentation for sunxi " Alexander Bersenev
2014-05-14 21:56   ` [PATCH v7 2/3] [media] rc: add sunxi-ir driver Alexander Bersenev
     [not found]     ` <1400104602-16431-3-git-send-email-bay-d8LqKIyZzER6k2ZkT/Rh8A@public.gmane.org>
2014-05-15  7:24       ` Maxime Ripard
2014-05-19  8:17       ` Maxime Ripard
2014-05-19 20:26       ` David Härdeman
     [not found]         ` <20140519202616.GA25415-0WFrdVpeebksCylrc8G9yg@public.gmane.org>
2014-05-20  7:18           ` Hans de Goede [this message]
2014-05-14 21:56   ` [PATCH v7 3/3] ARM: sunxi: Add IR controller support in DT on A20 Alexander Bersenev

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=537B01E3.2060206@redhat.com \
    --to=hdegoede-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=bay-d8LqKIyZzER6k2ZkT/Rh8A@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org \
    --cc=james.hogan-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org \
    --cc=linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    --cc=m.chehab-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
    --cc=pawel.moll-5wv7dgnIgG8@public.gmane.org \
    --cc=rdunlap-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=sean-hENCXIMQXOg@public.gmane.org \
    --cc=srinivas.kandagatla-qxv4g6HH51o@public.gmane.org \
    --cc=wingrime-3kdeTeqwOZ9EV1b7eY7vFQ@public.gmane.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).