Run “gpio poll 17”. It show value changing when press RESET. Then check “/src/router/rc/resetbutton.c”.
For DD, no need export file and just execute “gpio enable 1” like http://www.dd-wrt.com/wiki/index.php/LED_Scripts ?
When run “nvram commit”, I saw led blink blue. It is a clue.
In src/router/nvram/nvram_linux.c nvram_commit, it execute “system(“/sbin/ledtool 1”);”.
set_bit defined at libutils/gpio.c, it operate on “/dev/gpio/outen”(direction) & “/dev/gpio/out”(value). Then kernel(./brcm/arm/shared/siutils.c) will be invoked.
“gpio(libutils/gpio.c) enable 259 (0x103) or 41” will full turn fan. Because it will goto “set_hc595(pin - 40, value);”. I used “gpiowatcher -g 259” but can’t find changes.
set_hc595 defined at linux/brcm/arm/shared/siutils.c. Get clue from the file and found “gpio enable 8” will get full fan speed. But how a GPIO(1 or 0) output PWM signal(0~255)?
In miwifi rootfs, there is a “usr/sbin/fan_tmp_ctrl“ & usr/sbin/fan_tmp.sh & etc/init.d/fantmp.
. ./linux-2.6.36/arch/arm/plat-brcm/shared/siutils.c has method to set GPIO. But I am not sure.
use “strings fan_tmp_ctrl” get “echo “0 1 20 3” > /proc/pwm/config”.
It has a TMP75 Digital Temperature Sensor. It used I2C bus. Use i2cdetect to get information of it? lm-sensors has supported it. http://www.lm-sensors.org/wiki/Devices It also has TI TPS5432, STEP DOWN CONVERTER, why use it?
Why “make modules” didn’t give any error?After add GPL to 3.5 gpio-pwm.c, above issue gone. But but it have to accept platform_data to get gpio info.
https://forum.openwrt.org/viewtopic.php?id=42079 has same issue and has a patch.
But after few second, fan get full speed then back. CPU usage? By siboqi, when full speed, the duty is “50-50-50”. SMP? I add “smp_processor_id” and it always return 1.
It use High Precision Event Timer( http://www.ibm.com/developerworks/cn/linux/l-cn-timerm/ ), init by “hrtimer_init(&gp->t, CLOCK_MONOTONIC, HRTIMER_MODE_REL);”. gpio_direction_output do the real set_gpio operation.
RPi(bcm2835) hardware PWM http://hertaville.com/2014/07/07/rpipwm/ it use /dev/mem & mmap to write soc register.
adafruit also provide a kernel module in it’s Occidentalis distribution. But it looks no difference with above nmap way.
Broadcom Kona(bcm28155) PWM driver http://lwn.net/Articles/592310/ exit at git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc.git (on my dreamhost).
http://lwn.net/Articles/596601/ Add Allwinner SoCs PWM support. Looks complex.
S5P PWM code look here.
linux-3.10/brcm/arm/include/sbchipc.h has lots of PWM definition.
Some user find after several days, ksoftirqd (sirq)take 40% CPU. It would lead by this software PWM.
arch/arm/plat-brcm/bcm5301x_dmu.c has provide many clock, which would be used for PWM.
was it enabled at default? Right. Has _dmu*.o file.
RPi can just use nmap to set PWM. But how to set the output pin? dsti as sunxi?(arch/arm/boot/dts/bcm2835-rpi-b.dts did say that) So RPi didn’t need a separate driver? WRT1900AC looks using same way?
https://github.com/torvalds/linux/blob/master/arch/arm/boot/dts/bcm5301x.dtsi it is base dts file for BCM4708.
in bcm5301x, uart was added on iproc_slow_clk. dmesg can prove this. iproc means “Broadcom iProc common SoC platform”.
But I still find no clue on which pin/gpio was set as PWM target/output. Fixed? So I just need to enable it?
bcm2835_init_clocks(drivers/clk/clk-bcm2835.c), from it’s pdf, the PWM didn’t need software to driver?
Looks the code is much specific to platform.
Not sure it was software PWM or not. It use ‘setitimer’.
To start it at boot, I add it in rc/init.c. Need to use FORK(eval(“phy_tempsense”));. sysprintf will block boot process.
when reboot, fan is very noise.
how to let it run at auto-mode? looks the 1~5 is reversed when in auto-mode.
RTAC5300 is quite new. It used BCM8709. Not sure it has fan or not.