Fan Enable¶
The fan on the development kit is controlled by the FAN_EN GPIO, which is driven from Linux with libgpiod. The pin is named "FAN_EN" in the device tree on both the MitySOM and MitySOM-Mini development kits, so addressing it by name works on either board without looking anything up. The underlying line offset is not the same on the two kits, so prefer the name over an offset or a number.
Turning the fan on¶
Use gpioset with the --daemonize option:
root@mity-a5e:~# gpioset --daemonize FAN_EN=1
Note: the --daemonize option is required here. gpioset holds a line only for as long as the process runs, and releases it on exit, so a plain gpioset FAN_EN=1 would drive the pin and then immediately give it up when the command returned. --daemonize sets the value and detaches, leaving a background process holding the line so the fan stays on after you log out.
Checking and releasing the line¶
gpioinfo FAN_EN reports the line state, and shows a consumer= annotation while something is holding it. The holding process can be found with pgrep, and stopping it releases the line. Below is a full sequence of checking the pin, turning the fan on, and releasing it again:
root@mity-a5e:~# gpioinfo FAN_EN gpiochip2 23 "FAN_EN" input root@mity-a5e:~# gpioset --daemonize FAN_EN=1 root@mity-a5e:~# gpioinfo FAN_EN gpiochip2 23 "FAN_EN" output consumer="gpioset" root@mity-a5e:~# pgrep -l gpioset 256 gpioset root@mity-a5e:~# kill $(pgrep gpioset) root@mity-a5e:~# gpioinfo FAN_EN gpiochip2 23 "FAN_EN" output
While the line is held, a second gpioset on the same pin fails with "Device or resource busy". Release the first holder before setting a new value.
Note: killing the holder releases the line, but the level it settles at afterwards is not guaranteed. To positively drive the pin low, release the holder first and then run gpioset --daemonize FAN_EN=0.
Note: kill $(pgrep gpioset) stops every gpioset process on the system. If you are holding other lines the same way, pick the specific PID out of pgrep -l gpioset instead.