How can pwm be access via the sysfs? I've put some debug into the kernel...
[750000] mxs-pwm 80064000.pwm: PWM: MXS found
find -name \*pwm*
found the following..
./sys/bus/platform/devices/80064000.pwm
./sys/bus/platform/drivers/leds_pwm
./sys/bus/platform/drivers/mxs-pwm
./sys/bus/platform/drivers/mxs-pwm/80064000.pwm
updated imx23.dtsi
pwm0_pins_a: pwm0@0 {
reg = <0>;
fsl,pinmux-ids = <
0x11a0 /* MX23_PAD_PWM1__DUART_TX */
>;
fsl,drive-strength = <0>;
fsl,voltage = <1>;
fsl,pull-up = <0>;
};
pwm1_pins_a: pwm1@0 {
reg = <0>;
fsl,pinmux-ids = <
0x11b0 /* MX23_PAD_PWM1__DUART_TX */
>;
fsl,drive-strength = <0>;
fsl,voltage = <1>;
fsl,pull-up = <0>;
};
pwm2_pins_a: pwm2@0 {
reg = <0>;
fsl,pinmux-ids = <
0x11c0 /* MX23_PAD_PWM2__PWM2 */
>;
fsl,drive-strength = <0>;
fsl,voltage = <1>;
fsl,pull-up = <0>;
};
updated imx23-olimyxino.dtb
apbx@80040000 {
/*duart: serial@80070000 {
pinctrl-names = "default";
pinctrl-0 = <&duart_pins_a>;
status = "okay";
}; */
auart0: serial@8006c000 {
pinctrl-names = "default";
pinctrl-0 = <&auart0_2pins_a>;
status = "okay";
};
usbphy0: usbphy@8007c000 {
status = "okay";
};
pwm: pwm@80064000 {
pinctrl-names = "default";
pinctrl-0 = <&pwm0_pins_a &pwm1_pins_a &pwm2_pins_a>;
status = "okay";
};
Please notice the duart is not configured..
# mount -t debugfs none /sys/kernel/debug
# cd /sys/kernel/debug/
# ls
bdi ieee80211 mwifiex suspend_stats wakeup_sources
clk iio pinctrl tracing
extfrag lbs_wireless pwm ubi
gpio memblock regulator ubifs
hid mmc0 sched_features usb
# cd pwm
-sh: cd: can't cd to pwm
# cat pwm
platform/80064000.pwm, 5 PWM devices
pwm-0 ((null) ):
pwm-1 ((null) ):
pwm-2 ((null) ):
pwm-3 ((null) ):
pwm-4 ((null) ):
# pwm
-sh: pwm: not found
# pwm
-sh: pwm: not found
# pwd
/sys/kernel/debug
#
The sysfs interface to the PWM subsystem was introduced in kernel 3.11.
https://lkml.org/lkml/2013/6/21/134
Check the kernel version you're using.
upgraded to 3.11.6 and everything works as advertised How to for pwm2:
Modify imx23-olinuxion.dts to include the pwm..
apbx@80040000 {
....
pwm: pwm@80064000 {
pinctrl-names = "default";
pinctrl-0 = <&pwm2_pins_a>;
status = "okay";
};
}
From bash:
# cd /sys/class/pwm/pwmchip0/
# ls
device export npwm power subsystem uevent unexport
# echo 2 > export
The above enables pwm2
# ls
device npwm pwm2 uevent
export power subsystem unexport
Notice pwm2 appears in the sysfs
# cd pwm2
#ls
duty_cycle enable period polarity power uevent
# echo 10000 > period
# echo 1000 > duty_cycle
# echo 1 > enable
off and running...
fyi.. I'm going to use just two pwm, but need to disable he current ttyAMA0 and use ttyAPP0 This was shown in the other posts..
This is super cool! Thanks :D