0

I'm beginner in kernel module development.

I'm running Debian 8 in BeagleBone Black with cape-universaln loaded. The module pwm_tiehrpwm is loaded. I can configure pwm signal through the respective /sys/class/pwm/pwmchipN. I have checked the signal using a scope. Everything is working.

My question is how can I configure pwm channel, duty/period, enable and disable in kernel space, in the other words, inside of the kernel module?

dczanella
  • 1
  • 2
  • Perhaps look at the PWM driver code. – user253751 Dec 15 '16 at 21:08
  • I've tried to make changes on PWM driver, but there is a lack of documentation. So, I don't know which functions and which order I should to use. I've made some attempts, but without success, the kernel always crashes. – dczanella Dec 16 '16 at 11:48
  • 2
    @dczanella Look at [Documentation/pwm.txt](http://lxr.free-electrons.com/source/Documentation/pwm.txt), especially "Using PWMs" section. For usage examples see `drivers/hwmon/pwm-fan.c` and `drivers/leds/leds-pwm.c`. – Sam Protsenko Dec 18 '16 at 11:13
  • @SamProtsenko I've looked these source codes and they use <.compatible = "pwm-fan"> and <.compatible = "pwm-leds">, but I don't have these devices in my Device Tree configuration, I have . So how can I use this device? Or how can I match the device tree device with my driver? – dczanella Dec 19 '16 at 12:00
  • 1
    @dczanella If you can't modify your board's Device Tree file, you should create and load corresponding Device Tree overlay file with definition of your devices. – Sam Protsenko Dec 19 '16 at 17:37

0 Answers0