Difference between revisions of "PinePhone Power Management"
(Created page with "How to handle power management on PinePhone. == Related == * Projects:PinePhone Daily Driver == External Links == * xnux.eu on power saving[https://xnux.eu/devices/f...") |
|||
| (3 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
How to handle power management on [[PinePhone]]. | How to handle power management on [[PinePhone]]. | ||
| + | |||
| + | == Input Current Limit == | ||
| + | By default the [[AXP803]] limits the input current to 500 mA which is way too low to use the phone and charge it. It is possible to manually increase this limit (assuming the power source can handle it): | ||
| + | |||
| + | {{code|1=echo 900000 > /sys/class/power_supply/axp20x-usb/input_current_limit}} | ||
| + | |||
| + | === Current Fixing Daemon === | ||
| + | The above can be automatically executed every few minutes as a systemd daemon or via cron. This is an example of a systemd timer: | ||
| + | |||
| + | ==== /usr/local/sbin/powermax ==== | ||
| + | <syntaxhighlight lang="bash"> | ||
| + | #!/bin/bash | ||
| + | FONLINE=/sys/class/power_supply/axp20x-usb/online | ||
| + | FLIMIT=/sys/class/power_supply/axp20x-usb/input_current_limit | ||
| + | if [[ `cat $FONLINE` -eq 0 ]]; then | ||
| + | return 0; | ||
| + | fi | ||
| + | if [[ `cat $FLIMIT` -eq 500000 ]]; then | ||
| + | echo 900000 > $FLIMIT | ||
| + | fi | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | ==== /etc/systemd/system/... ==== | ||
| + | {{codeblock|title=/etc/systemd/system/powermax.service|1=[Unit] | ||
| + | Description=Powermax | ||
| + | [Service] | ||
| + | Type=oneshot | ||
| + | ExecStart=/usr/local/sbin/powermax}} | ||
| + | |||
| + | {{codeblock|title=/etc/systemd/system/powermax.timer|1=[Unit] | ||
| + | Description=Powermax | ||
| + | [Timer] | ||
| + | OnBootSec=1min | ||
| + | OnUnitActiveSec=2min | ||
| + | [Install] | ||
| + | WantedBy=timers.target}} | ||
| + | |||
| + | ==== Activation ==== | ||
| + | {{codeblock|1=systemctl daemon-reload | ||
| + | systemctl enable powermax.timer}} | ||
== Related == | == Related == | ||
| Line 5: | Line 45: | ||
== External Links == | == External Links == | ||
| − | * xnux.eu | + | * xnux.eu |
| + | ** [https://xnux.eu/devices/feature/anx7688.html ANX7688] | ||
| + | ** [https://xnux.eu/devices/feature/backlight.html#toc-power-saving power saving] | ||
Latest revision as of 19:52, 14 September 2020
How to handle power management on PinePhone.
Contents
Input Current Limit
By default the AXP803 limits the input current to 500 mA which is way too low to use the phone and charge it. It is possible to manually increase this limit (assuming the power source can handle it):
echo 900000 > /sys/class/power_supply/axp20x-usb/input_current_limit
Current Fixing Daemon
The above can be automatically executed every few minutes as a systemd daemon or via cron. This is an example of a systemd timer:
/usr/local/sbin/powermax
#!/bin/bash
FONLINE=/sys/class/power_supply/axp20x-usb/online
FLIMIT=/sys/class/power_supply/axp20x-usb/input_current_limit
if [[ `cat $FONLINE` -eq 0 ]]; then
return 0;
fi
if [[ `cat $FLIMIT` -eq 500000 ]]; then
echo 900000 > $FLIMIT
fi
/etc/systemd/system/...
/etc/systemd/system/powermax.service[Unit]
Description=Powermax
[Service]
Type=oneshot
ExecStart=/usr/local/sbin/powermax
/etc/systemd/system/powermax.timer[Unit]
Description=Powermax
[Timer]
OnBootSec=1min
OnUnitActiveSec=2min
[Install]
WantedBy=timers.target
Activation
systemctl daemon-reload
systemctl enable powermax.timer
Related
External Links
- xnux.eu