This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/DRA71XEVM: how to config pwm in dts?

Part Number: DRA71XEVM

Tool/software: Linux

hi,

colud you help give a sample?

1. dts config pwm

2. sample pwm driver

thanks

  • Hi Jack,

    can you check this document:
    software-dl.ti.com/.../Foundational_Components_Kernel_Drivers.html

    also check :
    <kernel_dir>/arch/arm/boot/dts/dra7.dtsi
    <kernel_dir>/Documentation/pwm.txt
    <kernel_dir>/Documentation/devicetree/bindings/pwm/pwm.txt
    <kernel_dir>/drivers/pwm/pwm-tiehrpwm.c

    Regards,
    Yordan

  • Hi Yordan,

    Thanks for your help.

    We add enable in dra71-evm.dts

    &epwmss0 {
       status = "okay";
    };

    &ehrpwm0 {
        status = "okay";
    };

    &ecap0 {
        status = "okay";
    };

    &epwmss1 {
       status = "okay";
    };

    &ehrpwm1 {
        status = "okay";
    };

    &ecap1 {
        status = "okay";
    };

    And we config in i2c device.

      
    i2c_p3_exp: &i2c5 {
        status = "okay";
        clock-frequency = <400000>;

        ov10633@37 {
            compatible = "ovti,ov10633";
            reg = <0x37>;
            pwms = <&ehrpwm0 0 5000000 1>;
            pwm-names = "trigger";

            mux-gpios = <&pcf_hdmi 2    GPIO_ACTIVE_HIGH>, /* VIN2_S0 */
                    <&pcf_hdmi 6    GPIO_ACTIVE_LOW>; /* VIN2_S2 */
            port {
                onboardLI: endpoint {
                    remote-endpoint = <&vin2a>;
                    hsync-active = <1>;
                    vsync-active = <1>;
                    pclk-sample = <0>;
                };
            };
        };

    .....

    But we don't know how binding GPIO and PWM.

    Our requirement is using PWM control GPIO output sync signal.

    Could you give us some advice?

    Thanks

  • Hi,

    This is a generic Linux kernel question on PWM.

    You can learn more about PWM API from documentation https://www.kernel.org/doc/Documentation/pwm.txt

    You can use the pwm_ (request/free/enable/disable/config/set_polarity) APIs for using the PWM.

    Use these APIs in the driver to setup the PWM as required.

    You can find more in details at "drivers/pwm/pwm-tiehrpwm.c"

    I hope this helps.

    Regards,

    Nikhil D