public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Green <andy@warmcat.com>
To: Eric Miao <eric.y.miao@gmail.com>
Cc: Jon Smirl <jonsmirl@gmail.com>,
	ARM Linux Mailing List  <linux-arm-kernel@lists.arm.linux.org.uk>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: Toggling GPIO at 38Khz
Date: Thu, 09 Oct 2008 09:38:21 +0100	[thread overview]
Message-ID: <48EDC2FD.60809@warmcat.com> (raw)
In-Reply-To: <f17812d70810072340n6cb9bd21w1fcf73b56b4f8dff@mail.gmail.com>

Eric Miao wrote:

> This isn't easy, 38KHz is quite a high frequency, I'd prefer to
> use an interrupt or fiq based on a accurate clock event source,
> but that will have impact on the system anyway.

Many SoC can elevate PWM interrupt to FIQ.  It's definitely possible to
run a FIQ ISR at >50kHz on a slow system; you'd need 2 x the actual
modulation frequency on the PWM though in order to be able to put it on
and off in one cycle.

Then with the PWM regulating the clock rate, you will definitely get
consistent overall timing, and with FIQ service you will get very low
jitter on individual clock issue.  In the meanwhile the CPU will
continue servicing interrupts and running foreground code normally in
the cycles left inbetween FIQ service, so it is pretty friendly.

I have an implementation for sc32442 on Openmoko Freerunner kernel that
allows a FIQ ISR written in C, I wrote it to implement HDQ (1-bit
battery protocol that is time based) just using a GPIO and no hardware.
 I'm interested in making this more general for ARM to allow wider use
of FIQ stuff and try to get it upstream, but because FIQ itself has some
"special needs" I am not sure what changes are needed to make it more
palatable.

The main guts of it are here:

http://git.openmoko.org/?p=kernel.git;a=blob;f=arch/arm/mach-s3c2440/fiq_c_isr.h;h=e92b103cdfbf115947df5acb4312ef9fc39e1f6e;hb=andy-tracking
http://git.openmoko.org/?p=kernel.git;a=blob;f=arch/arm/mach-s3c2440/fiq_c_isr.c;h=c47d1630081f69dcb82a52a3db18765b10f35384;hb=andy-tracking

...and the FIQ ISR we use with those wrappers is here:

http://git.openmoko.org/?p=kernel.git;a=blob;f=arch/arm/mach-s3c2440/mach-gta02.c;h=cdf2a33b553157208457d1139307c83591d14704;hb=andy-tracking#l136

-Andy


  reply	other threads:[~2008-10-09  9:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-08  3:43 Toggling GPIO at 38Khz Jon Smirl
2008-10-08  6:40 ` Eric Miao
2008-10-09  8:38   ` Andy Green [this message]
2008-10-08 12:01 ` Bill Gatliff
2008-10-08 13:06   ` Jon Smirl
2008-10-08 17:00     ` Chris Friesen
2008-10-08 21:58     ` Krzysztof Halasa
2008-10-08 18:57 ` Remy Bohmer
2008-10-08 22:24   ` Dave Hylands
2008-10-09  2:26     ` Bill Gatliff
2008-10-09 17:53     ` linux-os (Dick Johnson)
     [not found] <bkydL-21G-5@gated-at.bofh.it>
2008-10-08 12:15 ` Bodo Eggert

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=48EDC2FD.60809@warmcat.com \
    --to=andy@warmcat.com \
    --cc=eric.y.miao@gmail.com \
    --cc=jonsmirl@gmail.com \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox