From: Ben Gardiner <bengardiner@nanometrics.ca>
To: Bill Gatliff <bgat@billgatliff.com>
Cc: linux-kernel@vger.kernel.org, linux-embedded@vger.kernel.org
Subject: Re: [PWM v9 2/3] PWM: GPIO+hrtimer device emulation
Date: Wed, 6 Apr 2011 09:17:58 -0400 [thread overview]
Message-ID: <BANLkTikzBHJxToLPXQZCLN-GjbYHMfASLw@mail.gmail.com> (raw)
In-Reply-To: <1301630392-20793-3-git-send-email-bgat@billgatliff.com>
Hi Bill,
I tested this series on da850evm from commit
60124de319dc2800c0f75f44bf84471a8de0dbc5 of
git://git.billgatliff.com/pwm.git.
With the following commands I was able to observe the production of a
100Hz 50% output on a GPIO (specifically GPIO #125 which is GPIO7[13]
on the SoC and J15[13] on the baseboard for other da850 users).
mount config /config -t configfs
mkdir /config/gpio_pwm/125
echo 1 > /sys/class/pwm/gpio_pwm\:125/export
echo 10000000 > /sys/class/pwm/gpio_pwm\:125/period_ns
echo 5000000 > /sys/class/pwm/gpio_pwm\:125/duty_ns
echo 1 > /sys/class/pwm/gpio_pwm\:125/run
I noticed that the following command did not stop the pwm output.
echo 0 > /sys/class/pwm/gpio_pwm\:125/run
But the following command did (and I did not need to echo 1 >
/sys/class/pwm/gpio_pwm\:125/unexport first)
rm -rf /config/gpio_pwm/125
The observations from my testing above are repeated in context below:
On Thu, Mar 31, 2011 at 11:59 PM, Bill Gatliff <bgat@billgatliff.com> wrote:
> Emulates a PWM device using a GPIO pin and an hrtimer. Subject
> to CPU, scheduler and hardware limitations, can support many
> PWM outputs, e.g. as many as you have GPIO pins available for.
>
> On a 200 MHz ARM9 processor, a PWM frequency of 100 Hz can be attained
> with this code so long as the duty cycle remains between about 20-80%.
> At higher or lower duty cycles, the transition events may arrive too
> close for the scheduler and CPU to reliably service.
>
> This driver supports creation of new GPIO+hrtimer PWM devices via
> configfs:
>
> # mount config /config -t configfs
> # mkdir /config/gpio-pwm/<gpio number>
minor: I observed that the configfs directory was 'gpio_pwm' not 'gpio-pwm.'
> The new PWM device will appear as /sys/class/pwm/gpio-pwm.<gpio number>.
>
> Caveats:
> * The GPIO pin number must be valid, not already in use
> * The output state of the GPIO pin is configured when the PWM starts
> running i.e. not immediately upon request, because the polarity of
> the inactive state of the pin isn't known until the pwm device's
> 'polarity' attribute is configured
> * After creating and binding the pwm device, you must then request
> it by writing to /sys/class/pwm/gpio-pwm.<gpio number>/export
>
> Unbind and destroy the pwm device by first stopping and unexporting
> the pwm device under sysfs as usual; then do:
I observed that
# echo 0 > /sys/class/pwm/gpio_pwm\:125/run
did not stop the pwm output and that
# echo 1 > /sys/class/pwm/gpio_pwm\:125/unexport
was not required before rm -rf'ing the /config directory:
> # rm -rf /config/gpio-pwm/<gpio number>
> Signed-off-by: Bill Gatliff <bgat@billgatliff.com>
Overall this is a really easy to user userspace interface -- it was a
pleasure to setup and test.
Tested-by: Ben Gardiner <bengardiner@nanometrics.ca>
Best Regards,
Ben Gardiner
---
Nanometrics Inc.
http://www.nanometrics.ca
next prev parent reply other threads:[~2011-04-06 13:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-01 3:59 [PWM v9 0/3] Implement a generic PWM framework Bill Gatliff
2011-04-01 3:59 ` [PWM v9 1/3] PWM: " Bill Gatliff
2011-04-14 19:49 ` Grant Likely
2011-04-14 19:58 ` Greg KH
2011-04-01 3:59 ` [PWM v9 2/3] PWM: GPIO+hrtimer device emulation Bill Gatliff
2011-04-06 13:17 ` Ben Gardiner [this message]
2011-04-01 3:59 ` [PWM v9 3/3] PWM: Atmel PWMC driver Bill Gatliff
2011-04-14 15:12 ` [PWM v9 0/3] Implement a generic PWM framework Bill Gatliff
2011-04-14 18:26 ` H Hartley Sweeten
2011-06-15 15:33 ` Mike Frysinger
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=BANLkTikzBHJxToLPXQZCLN-GjbYHMfASLw@mail.gmail.com \
--to=bengardiner@nanometrics.ca \
--cc=bgat@billgatliff.com \
--cc=linux-embedded@vger.kernel.org \
--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
all inboxes | Powered by JetHome®