I have a question about building a kernel driver for my PRU software pwm that mimics the hardware pwm sysfs interface.
Background:
I have a simple kernel driver[1] now working with my PRU based pwd code.
Once you have the code running on the PRU you can:
bone$ insmod pwm.ko channel=1
bone$ cd /sys/kernel/pwm/pwm1
bone$ ls
duty_cycle enable period
bone$ echo 2000 > period
bone$ echo 1000 > duty_cycle
Now you have a pwm signal on channel 1 with a period of 2000ns and an on time of 1000 ns.
The hardware pwms appear in /sys/class/pwm. You can use them via:
bone$ cd /sys/class/pwm/pwmchip0
bone$ echo 0 > export
bone$ cd pwm0
bone$ echo 2000 > period
bone$ echo 1000 > duty_cycle
The question:
How do I build a kernel module so my software pwms will appear along with the hardware pwms? That is, I want my software pwms to appear as pwmchipX and then you could:
bone$ cd /sys/class/pwm/pwmchipX
bone$ echo 0 > export
bone$ cd pwm0
bone$ echo 2000 > period
bone$ echo 1000 > duty_cycle
To run the PRU pwms.
Does anyone have pointers to kernel tutorials to do this?
Thanks...
--Mark