Linux PWM subsystem development
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: randy <lxr1234@hotmail.com>
Cc: linux-pwm@vger.kernel.org
Subject: Re: [exynos4412]How to test a pwm device, is there a test program?
Date: Mon, 9 Dec 2013 09:52:27 +0100	[thread overview]
Message-ID: <20131209085225.GA27868@ulmo.nvidia.com> (raw)
In-Reply-To: <BLU0-SMTP2611DD3F4485EEE457F4920ADD00@phx.gbl>

[-- Attachment #1: Type: text/plain, Size: 1128 bytes --]

On Mon, Dec 09, 2013 at 01:22:02AM +0800, randy wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> The dts for my board tiny4412 is ready, in my board, the pwm 0 is
> connect to a buzzer. I want to test whether it works, but I don't know
> any test util. As I have a oscillograph, there is no problem for me to
> measure whether the output is correct.
> Thanks

You can use the sysfs interface to easily test the PWM functionality.
The documentation for that is in Documentation/pwm.txt and
Documentation/ABI/testing/sysfs-class-pwm.

Generally this should work somewhat like this:

	# echo 0 > /sys/class/pwm/pwmchip0/export
	# echo 50000 > /sys/class/pwm/pwmchip0/pwm0/period
	# echo 25000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle
	# echo 1 > /sys/class/pwm/pwmchip0/pwm0/enable

Which should configure PWM 0 to run at a period of 50000 ns and a 50%
duty-cycle.

	# echo 0 > /sys/class/pwm/pwmchip0/pwm0/disable

Stops the PWM signal and when you're done with all the testing you can
export the PWM (so that it can be reused):

	# echo 0 > /sys/class/pwm/pwmchip0/unexport

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2013-12-09  8:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-08 17:22 [exynos4412]How to test a pwm device, is there a test program? randy
2013-12-09  8:52 ` Thierry Reding [this message]
2013-12-09 11:04   ` randy
2013-12-09 11:55     ` Thierry Reding
2013-12-09 13:06       ` randy
2013-12-12 12:22         ` Thierry Reding
2013-12-12 14:27           ` randy
2013-12-14 12:44             ` Thierry Reding
2013-12-14 13:05               ` Tomasz Figa

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=20131209085225.GA27868@ulmo.nvidia.com \
    --to=thierry.reding@gmail.com \
    --cc=linux-pwm@vger.kernel.org \
    --cc=lxr1234@hotmail.com \
    /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