Skip to main content
Visitor II
September 13, 2021
Solved

PWM Kernel Driver API

  • September 13, 2021
  • 1 reply
  • 1694 views

Hi all,

I wish to perform PWM for certain leds connected to STM32MP1 pins.

I wish to do it from the user space application.

I got it working via sysfs interface , but I am more interested in controlling it via a user space application based on some logic. How can I do this ?

Is there API documentation for it?

TIA

    This topic has been closed for replies.
    Best answer by PatrickF

    Hi,

    I'm not SW expert, but for me the pwm_device content is retrieved (mostly from DT I guess) by some available pwm kernel functions.

    See https://www.kernel.org/doc/html/latest/driver-api/miscellaneous.html#c.pwm_get

    This is not related to ST drivers, but supported by kernel, I think the example for Rockchip you pointed is probably working on STM32MP1 without much issues.

    Regards.

    In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'

    1 reply

    Technical Moderator
    September 13, 2021
    NPal.2Author
    Visitor II
    September 14, 2021

    Hi @PatrickF​ ,

    Thanks for the response.

    I did went through it but it just mentions data for device tree configuration. There is no help around how can I use the driver in custom application.

    Can you please help me get more details around this ? I really appreciate the help.

    Technical Moderator
    September 15, 2021

    Hi,

    Have you seen this 'C' example links on that wiki page ?

    Several in-kernel drivers use kernel PWM API. Below a few examples:

    API is documented here : https://www.kernel.org/doc/html/latest/driver-api/pwm.html

    Regards.