Difference between revisions of "APF51 PMIC"
From ArmadeusWiki
(→Usage) |
|||
Line 90: | Line 90: | ||
===Usage=== | ===Usage=== | ||
− | Then you can use standard [[GPIOlib]] instructions with GPIO numbers 245 | + | Then you can use standard [[GPIOlib]] instructions with GPIO numbers 245 (PMIC_GPIO6) or 246 (PMIC_GPIO7). |
+ | For example to put PMIC_GPIO7 in input and read its value: | ||
<pre class="apf"> | <pre class="apf"> | ||
# echo 246 > /sys/class/gpio/export | # echo 246 > /sys/class/gpio/export | ||
− | + | # cat /sys/class/gpio/246/direction | |
− | + | in | |
− | + | # cat /sys/class/gpio/246/value | |
+ | 0 | ||
</pre> | </pre> | ||
Revision as of 22:10, 11 March 2013
APF51 has a Wolfson WM8311 Power Management IC (PMIC), which adds to the i.MX51 some useful functionalities. This page explain how to use them.
Contents
RTC
Voltage supervisor / Battery charger
- Load driver:
# modprobe wm831x_power wm831x 1-0034: No battery charger configuration
- If power supplied with Wall (main power supply):
# cat /sys/class/power_supply/wm831x-wall/online 1 # cat /sys/class/power_supply/wm831x-wall/voltage_now 4550290 (? micro volts ?)
- others:
# ls /sys/class/power_supply/ wm831x-battery wm831x-usb wm831x-wall
ADC / Temperature
- Load driver:
# modprobe wm831x-hwmon
- Show what we can do:
# ls /sys/class/hwmon/hwmon0/device/ driver in3_input in6_input in8_label temp1_input hwmon in4_input in6_label modalias temp1_label in0_input in4_label in7_input name temp2_input in1_input in5_input in7_label power temp2_label in2_input in5_label in8_input subsystem uevent
- temperatures:
# cat /sys/class/hwmon/hwmon0/device/temp1_label PMIC # cat /sys/class/hwmon/hwmon0/device/temp1_input 65720 (m°C, internal temp) # cat /sys/class/hwmon/hwmon0/device/temp2_label Battery # cat /sys/class/hwmon/hwmon0/device/temp2_input 1327 (a battery should be connected)
- analog values:
- in[0-3]_input corresponds to AUXADCIN[1-4] of APF51 connector
- in[4-8]_input are monitoring system voltage:
# cat /sys/class/hwmon/hwmon0/device/in4_label SYSVDD # cat /sys/class/hwmon/hwmon0/device/in5_label USB # cat /sys/class/hwmon/hwmon0/device/in6_label Battery # cat /sys/class/hwmon/hwmon0/device/in7_label WALL # cat /sys/class/hwmon/hwmon0/device/in8_label Backup battery
Touchscreen
- Driver is present in default kernel, everything else is generic and driven by Tslib
GPIO
Only GPIO6 and GPIO7 are usable on the APF51 (others are reserved or not available on connector).
Load driver
# modprobe wm831x-gpio
and locate corresponding interface:
# ls /sys/class/gpio/ export gpiochip240 gpiochip64 unexport gpiochip0 gpiochip32 gpiochip96 # cd /sys/class/gpio/gpiochip240/ # ls base device label ngpio power subsystem uevent # cat label wm831x # cat ngpio 16
Usage
Then you can use standard GPIOlib instructions with GPIO numbers 245 (PMIC_GPIO6) or 246 (PMIC_GPIO7).
For example to put PMIC_GPIO7 in input and read its value:
# echo 246 > /sys/class/gpio/export # cat /sys/class/gpio/246/direction in # cat /sys/class/gpio/246/value 0
LEDs
LED1 and LED2 of APF51Dev board are controlled by the PMIC and are software programmable thanks to the LED API of Linux.
Load driver
# modprobe leds-wm831x-status # ls /sys/class/leds/ /sys/class/leds/LED1:red:/ /sys/class/leds/LED2:green:/
Choose LED functionality
# cd /sys/class/leds/LED1\:red\:/ # cat src otp [power] charger soft # echo soft > src # cat src otp power charger [soft]
Blink it
# echo 0 > brightness # echo 255 > brightness
Links
- WM8311 Datasheet: