PWM Kernel Driver API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-09-13 4:12 AM
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
Solved! Go to Solution.
- Labels:
-
STM32MP15 Lines
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-09-15 5:10 AM
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'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-09-13 4:45 AM
Hi,
Did you already found this wiki https://wiki.st.com/stm32mpu/wiki/PWM_overview#Example_of_PWM_usage_with_kernel_PWM_API ?
Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-09-14 2:50 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-09-15 12:02 AM
Hi,
Have you seen this 'C' example links on that wiki page ?
Several in-kernel drivers use kernel PWM API. Below a few examples:
- pwm-beeper: drivers/input/misc/pwm-beeper.c driver, Documentation/devicetree/bindings/input/pwm-beeper.txt DT binding documentation.
- pwm-vibrator: drivers/input/misc/pwm-vibra.c driver, Documentation/devicetree/bindings/input/pwm-vibrator.txt DT binding documentation.
API is documented here : https://www.kernel.org/doc/html/latest/driver-api/pwm.html
Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-09-15 4:39 AM
Hi @PatrickF​ : Thanks for the response. I can see how the API is used in the pwm-beeper.c but my concern is again at the ground level as to what data is passed into the struct pwm_device which is used in beeper.
I am looking for an example which somewhat guides to use STM32MP1 PWM like this. Also there isn't much documentation as to how to populate that structure with correct value though API interface seems clean.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-09-15 5:10 AM
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'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-09-16 4:35 AM
Hi @PatrickF​ : Thank you so much for response will take a look.
