You are here: Digi Embedded Yocto > System development > Linux v3.14 Board Support Package > Devices and interfaces > Pulse-Width Modulation (PWM)

Pulse-Width Modulation (PWM)

Pulse-width modulation (PWM) is a technique that modifies the duty-cycle of a pulsing signal to encode information or to control the amount of energy provided to a charge.

On the ConnectCore 6 system-on-module there are:

On the ConnectCore 6 SBC:

Kernel configuration

You can manage the PWM driver support through the following kernel configuration options:

These options are enabled as built-in on the default ConnectCore 6 SBC kernel configuration file.

Digi Embedded Yocto only supports the Dialog DA9063 LEDs interface.

Platform driver mapping

The i.MX6 PWM driver is located at drivers/pwm/pwm-imx.c.

The DA9063 PMIC PWM LEDs driver is located at drivers/leds/leds-da9063.c.

Device tree bindings and customization

The i.MX6 PWM interface device tree binding is documented at Documentation/devicetree/bindings/pwm/imx-pwm.txt.

The DA9063 PMIC’s leds binding is documented at Documentation/devicetree/bindings/leds/leds-da9063.txt.

For information about backlight control in Linux, refer to the kernel documentation at Documentation/ABI/testing/sysfs-class-led.

i.MX6 PWM interfaces

The i.MX6 PWM interfaces are defined in the i.MX6 CPU device tree file.

Common i.MX6 device tree
pwm1: pwm@02080000 {
    #pwm-cells = <2>;
    compatible = "fsl,imx6q-pwm", "fsl,imx27-pwm";
    reg = <0x02080000 0x4000>;
    interrupts = <0 83 IRQ_TYPE_LEVEL_HIGH>;
    clocks = <&clks IMX6QDL_CLK_IPG>,
         <&clks IMX6QDL_CLK_PWM1>;
    clock-names = "ipg", "per";
};
pwm2: pwm@02084000 {
    #pwm-cells = <2>;
    compatible = "fsl,imx6q-pwm", "fsl,imx27-pwm";
    reg = <0x02084000 0x4000>;
    interrupts = <0 84 IRQ_TYPE_LEVEL_HIGH>;
    clocks = <&clks IMX6QDL_CLK_IPG>,
         <&clks IMX6QDL_CLK_PWM2>;
    clock-names = "ipg", "per";
};
pwm3: pwm@02088000 {
    #pwm-cells = <2>;
    compatible = "fsl,imx6q-pwm", "fsl,imx27-pwm";
    reg = <0x02088000 0x4000>;
    interrupts = <0 85 IRQ_TYPE_LEVEL_HIGH>;
    clocks = <&clks IMX6QDL_CLK_IPG>,
         <&clks IMX6QDL_CLK_PWM3>;
    clock-names = "ipg", "per";
};
pwm4: pwm@0208c000 {
    #pwm-cells = <2>;
    compatible = "fsl,imx6q-pwm", "fsl,imx27-pwm";
    reg = <0x0208c000 0x4000>;
    interrupts = <0 86 IRQ_TYPE_LEVEL_HIGH>;
    clocks = <&clks IMX6QDL_CLK_IPG>,
         <&clks IMX6QDL_CLK_PWM4>;
    clock-names = "ipg", "per";
};

All i.MX6 PWM devices are enabled by default.

IOMUX configuration

Neither the ConnectCore 6 system-on-module nor the ConnectCore 6 SBC use the i.MX6 PWM outputs, so no GPIO pins are specifically configured on the device tree for PWM functionality.

The ConnectCore 6 SBC uses the DA9063 PMIC PWM interfaces to drive LVDS displays' backlights, but these require no IOMUX configuration.

DA9063 PMIC PWM interfaces

The DA9063 PMIC PWM interfaces are defined in the ConnectCore 6 SBC device tree file.

PWM11 and PWM15 (LVDS0 and LVDS1 backlight)

ConnectCore 6 SBC device tree
&i2c2 {
        pmic_dialog: dialog@58 {
                leds {
                        compatible = "dlg,da9063-leds";
                        lvds0-backlight@0xc6 {
                                dlg,led-gpio-reg = <0x1a 0xf0>;
                                dlg,led-reg = <0xc6>;
                                linux,default-trigger = "backlight";
                        };
                        lvds1-backlight@0xc6 {
                                dlg,led-gpio-reg = <0x1c 0xf0>;
                                dlg,led-reg = <0xc8>;
                                linux,default-trigger = "backlight";
                        };
                };
        };
};

PWM user space usage examples

PWM LED for backlight control

You can access the PWM LED interface for backlight through the sysfs at /sys/class/leds/. A backlight interface typically contains two controls:

Examples

To read the max allowed brightness of LVDS0 interface on ConnectCore 6 SBC:

root@ccimx6sbc:~# cat /sys/class/leds/lvds0-backlight/max_brightness
95

To set the brightness of LVDS0 interface on ConnectCore 6 SBC to the maximum brightness:

root@ccimx6sbc:~# echo 95 > /sys/class/leds/lvds0-backlight/brightness

To set the brightness of LVDS0 interface on ConnectCore 6 SBC to the minimum brightness:

root@ccimx6sbc:~# echo 0 > /sys/class/leds/lvds0-backlight/brightness

 

© 2017 Digi International Inc. All rights reserved.
Pulse-Width Modulation (PWM) updated on 24 April 2017 11:48:26 PM