Kernel Module to support pwm for the sun4i (and others???)
Switch branches/tags
Nothing to show
Clone or download
dwilkins Prescale Explorer Spreadsheet
Added a link to a google spreadsheet for exploring prescale, period and duty values.
Latest commit d07d3bb Jul 13, 2013


Kernel Module to support pwm for the sun4i (and others???)

Creates a sysfs structure like the following:

   -- pwm-sunxi

Period values can be a bit confusing - I have a google spreadsheet that you can use to explore what will happen with different period and duty values

Allwinner A10 Prescale explorer

  • period (r/w)

    period that makes up a cycle. Can be expressed as hz, khz, ms, or us. Whole numbers only.Examples:

    echo 10hz > /sys/class/pwm-sunxi/pwm0/period
    echo 1khz > /sys/class/pwm-sunxi/pwm0/period
    echo 100ms > /sys/class/pwm-sunxi/pwm0/period
    echo 100us > /sys/class/pwm-sunxi/pwm0/period
    echo 150khz > /sys/class/pwm-sunxi/pwm0/period
  • duty (r/w)

    portion of the period above that is "active" or on. Same units as above

  • duty_percent (r/w)

    duty expressed as a percentage. Whole numbers only

    echo 50 > /sys/class/pwm-sunxi/pwm0/duty_percent
  • polarity(r/w)

    polarity of the pin during the duty portion. 1 = high, 0 = low during

  • pulse (r/w)

    Output one pulse at the specified period and duty

  • pin (ro)

    Name of the A10 pin this pwm outputs on. This is hardwired and informational only. Example: PB2

  • run (r/w) Enable the PWM with the previously set parameters. Example:

    echo 1 > /sys/class/pwm-sunxi/pwm0/run
    echo 0 > /sys/class/pwm-sunxi/pwm0/run