2018-07-25 20:03:26

by Pavel Machek

[permalink] [raw]
Subject: Droid 4: suspend to RAM?

Hi!

I have two big problems with droid 4. #1 is that it lost 2 SMS.. and I
have no idea why. Second is power consumption -- it seems to be rather
high even before modem (and thus USB) is enabled.

Interestingly, CyanogenMod and Jolla seem to have higher power
consumption than stock operating system.

(My Linux can survive for 10 hours, stock system could survive for 4
days if I'm not mistaken).

I thought I would experiment with suspend to RAM.. and it indeed
seemed to suspend ok, but I could not wake it up. Do I need to set up
wakeup with button somehow? Is suspend to RAM required for good power
consumption?

Best regards, Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


Attachments:
(No filename) (803.00 B)
signature.asc (188.00 B)
Digital signature
Download all attachments
Subject: Re: Droid 4: suspend to RAM?

Hi Pavel

On Wed, Jul 25, 2018 at 10:02 PM, Pavel Machek <[email protected]> wrote:
> Hi!
>
> I have two big problems with droid 4. #1 is that it lost 2 SMS.. and I
> have no idea why. Second is power consumption -- it seems to be rather

Depend how do you set the SMS buffering using CNMI if I remember. Modem
has 1024bytes of memory most of the time that can buffer more then 1 sms.
Modem rise a irq when they receive a call or sms, or you an use the serial but
omap family can loose the first char coming from the serial so you can lost the
sms because parsing fail

> high even before modem (and thus USB) is enabled.
>
> Interestingly, CyanogenMod and Jolla seem to have higher power
> consumption than stock operating system.
>
> (My Linux can survive for 10 hours, stock system could survive for 4
> days if I'm not mistaken).
>
> I thought I would experiment with suspend to RAM.. and it indeed
> seemed to suspend ok, but I could not wake it up. Do I need to set up
> wakeup with button somehow? Is suspend to RAM required for good power
> consumption?

Sorry but pm subsystem has debug mode that you can test in a easy way.
You can even wakeup by any rtc alarm easily.

Michael

>
> Best regards, Pavel
> --
> (english) http://www.livejournal.com/~pavelmachek
> (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html



--
| Michael Nazzareno Trimarchi Amarula Solutions BV |
| COO - Founder Cruquiuskade 47 |
| +31(0)851119172 Amsterdam 1018 AM NL |
| [`as] http://www.amarulasolutions.com |

2018-07-25 21:30:34

by Pavel Machek

[permalink] [raw]
Subject: Re: Droid 4: suspend to RAM?

HI!
> >
> > I have two big problems with droid 4. #1 is that it lost 2 SMS.. and I
> > have no idea why. Second is power consumption -- it seems to be rather
>
> Depend how do you set the SMS buffering using CNMI if I remember. Modem
> has 1024bytes of memory most of the time that can buffer more then 1 sms.
> Modem rise a irq when they receive a call or sms, or you an use the serial but
> omap family can loose the first char coming from the serial so you can lost the
> sms because parsing fail

I am using USB connection to the modem. And yes, I'm using rather
strange CNMI settings (but other did not work).

> > high even before modem (and thus USB) is enabled.
> >
> > Interestingly, CyanogenMod and Jolla seem to have higher power
> > consumption than stock operating system.
> >
> > (My Linux can survive for 10 hours, stock system could survive for 4
> > days if I'm not mistaken).
> >
> > I thought I would experiment with suspend to RAM.. and it indeed
> > seemed to suspend ok, but I could not wake it up. Do I need to set up
> > wakeup with button somehow? Is suspend to RAM required for good power
> > consumption?
>
> Sorry but pm subsystem has debug mode that you can test in a easy way.
> You can even wakeup by any rtc alarm easily.

Yes, that is how it works on PC (but there power button works,
too). Is it expected to work on Droid in v4.18?

Thanks,
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


Attachments:
(No filename) (1.53 kB)
signature.asc (188.00 B)
Digital signature
Download all attachments

2018-07-27 11:33:35

by Pavel Machek

[permalink] [raw]
Subject: Re: Droid 4: suspend to RAM?

Hi!
> > > high even before modem (and thus USB) is enabled.
> > >
> > > Interestingly, CyanogenMod and Jolla seem to have higher power
> > > consumption than stock operating system.
> > >
> > > (My Linux can survive for 10 hours, stock system could survive for 4
> > > days if I'm not mistaken).
> > >
> > > I thought I would experiment with suspend to RAM.. and it indeed
> > > seemed to suspend ok, but I could not wake it up. Do I need to set up
> > > wakeup with button somehow? Is suspend to RAM required for good power
> > > consumption?
> >
> > Sorry but pm subsystem has debug mode that you can test in a easy way.
> > You can even wakeup by any rtc alarm easily.
>
> Yes, that is how it works on PC (but there power button works,
> too). Is it expected to work on Droid in v4.18?

I tried setting up wakeup using RTC, but no, it does not seem to work:

root@devuan:/my/tui/d4# rtcwake -m no -s 5
rtcwake: wakeup using /dev/rtc0 at Fri Jul 27 11:28:44 2018
root@devuan:/my/tui/d4# echo mem > /sys/power/state

Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


Attachments:
(No filename) (1.17 kB)
signature.asc (188.00 B)
Digital signature
Download all attachments

2018-08-08 09:06:20

by Tony Lindgren

[permalink] [raw]
Subject: Re: Droid 4: suspend to RAM?

* Pavel Machek <[email protected]> [180727 11:35]:
> Hi!
> > > > high even before modem (and thus USB) is enabled.
> > > >
> > > > Interestingly, CyanogenMod and Jolla seem to have higher power
> > > > consumption than stock operating system.
> > > >
> > > > (My Linux can survive for 10 hours, stock system could survive for 4
> > > > days if I'm not mistaken).
> > > >
> > > > I thought I would experiment with suspend to RAM.. and it indeed
> > > > seemed to suspend ok, but I could not wake it up. Do I need to set up
> > > > wakeup with button somehow? Is suspend to RAM required for good power
> > > > consumption?
> > >
> > > Sorry but pm subsystem has debug mode that you can test in a easy way.
> > > You can even wakeup by any rtc alarm easily.
> >
> > Yes, that is how it works on PC (but there power button works,
> > too). Is it expected to work on Droid in v4.18?
>
> I tried setting up wakeup using RTC, but no, it does not seem to work:
>
> root@devuan:/my/tui/d4# rtcwake -m no -s 5
> rtcwake: wakeup using /dev/rtc0 at Fri Jul 27 11:28:44 2018
> root@devuan:/my/tui/d4# echo mem > /sys/power/state

Works for me here as tested on next-20180808, maybe you don't have
CONFIG_RTC_DRV_CPCAP? Maybe you are trying to use CONFIG_RTC_DRV_OMAP?

Then for deeper idle modes, you need to also idle UARTs, and unbind or
unload USB related modules. You should get to something like 160mW
power consumption with mdm6600 enabled and SoC suspended that way.

Then again system running idle is about the same with timers and
interrupts working so I'd just idle UARTs and unload USB modules :)

My UART idle script below for reference.

Regards,

Tony

8< ----------------
#!/bin/bash

# Configure PM runtime autosuspend
uarts=$(find /sys/bus/platform/devices/4*.serial/power/ -type d)
for uart in $uarts; do
echo -n 3000 > $uart/autosuspend_delay_ms
echo -n enabled > $uart/wakeup
echo -n auto > $uart/control
done

# Configure wake-up from suspend
uarts=$(find /sys/class/tty/tty[SO]*/power/ -type d 2>/dev/null)
for uart in $uarts; do
echo -n enabled > $uart/wakeup
done

echo -n 1 > /sys/kernel/debug/pm_debug/enable_off_mode






2018-08-08 21:33:41

by Pavel Machek

[permalink] [raw]
Subject: Re: Droid 4: suspend to RAM?

On Wed 2018-08-08 02:05:12, Tony Lindgren wrote:
> * Pavel Machek <[email protected]> [180727 11:35]:
> > Hi!
> > > > > high even before modem (and thus USB) is enabled.
> > > > >
> > > > > Interestingly, CyanogenMod and Jolla seem to have higher power
> > > > > consumption than stock operating system.
> > > > >
> > > > > (My Linux can survive for 10 hours, stock system could survive for 4
> > > > > days if I'm not mistaken).
> > > > >
> > > > > I thought I would experiment with suspend to RAM.. and it indeed
> > > > > seemed to suspend ok, but I could not wake it up. Do I need to set up
> > > > > wakeup with button somehow? Is suspend to RAM required for good power
> > > > > consumption?
> > > >
> > > > Sorry but pm subsystem has debug mode that you can test in a easy way.
> > > > You can even wakeup by any rtc alarm easily.
> > >
> > > Yes, that is how it works on PC (but there power button works,
> > > too). Is it expected to work on Droid in v4.18?
> >
> > I tried setting up wakeup using RTC, but no, it does not seem to work:
> >
> > root@devuan:/my/tui/d4# rtcwake -m no -s 5
> > rtcwake: wakeup using /dev/rtc0 at Fri Jul 27 11:28:44 2018
> > root@devuan:/my/tui/d4# echo mem > /sys/power/state
>
> Works for me here as tested on next-20180808, maybe you don't have
> CONFIG_RTC_DRV_CPCAP? Maybe you are trying to use
>CONFIG_RTC_DRV_OMAP?

I tried with mainline... there will be no graphics in next, right? And
yes, I had CONFIG_RTC_DRV_CPCAP and not CONFIG_RTC_DRV_OMAP.

> Then for deeper idle modes, you need to also idle UARTs, and unbind or
> unload USB related modules. You should get to something like 160mW
> power consumption with mdm6600 enabled and SoC suspended that way.

That's slightly interesting. echo mem > /sys/power/state should do all
the work, right? Disable UARTs etc. Plus, is 160mW still a bit high?

> Then again system running idle is about the same with timers and
> interrupts working so I'd just idle UARTs and unload USB modules :)
>
> My UART idle script below for reference.

Thanks, let me try...

Pavel

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


Attachments:
(No filename) (2.22 kB)
signature.asc (188.00 B)
Digital signature
Download all attachments

2018-08-09 08:23:42

by Tony Lindgren

[permalink] [raw]
Subject: Re: Droid 4: suspend to RAM?

* Pavel Machek <[email protected]> [180808 21:35]:
> On Wed 2018-08-08 02:05:12, Tony Lindgren wrote:
> > Then for deeper idle modes, you need to also idle UARTs, and unbind or
> > unload USB related modules. You should get to something like 160mW
> > power consumption with mdm6600 enabled and SoC suspended that way.
>
> That's slightly interesting. echo mem > /sys/power/state should do all
> the work, right? Disable UARTs etc. Plus, is 160mW still a bit high?

Yes suspend will do it, you still need to configure wake-up events
though at least for the UARTs. I think I got enabled mdm6600 to low-power
state after connecting over UART ts27010 and then suspending OHCI:

ohci=$(find /sys/bus/platform/devices -name \*.ohci)
devices=$(find ${ohci}/ -type d -name control)
for device in ${devices}; do
echo -n "auto" > ${device}/level
echo -n "control" > ${device}/level
done

echo "usb-phy@1" > /sys/bus/platform/drivers/phy-mapphone-mdm6600/unbind

For power consumption, 160mW is high yeah. We currently cannot hit core
retention on omap4 until some GPIO issues are fixed. I've been trying to
think for a good fix for that, but need to debug it more when I get a chance.

From few months ago, I recall I got droid4 to run at around 65mW idle
with WLAN connected and modem off with my test hacks. With modem on
and USB suspended I think I got to around 100mW.

Then I recall measuring droid4 with stock android in flight mode
measuring at around 15 - 30mW. But that requires off mode to work on
omap4, maybe we'll get to that too at some point after core retention.

Regards,

Tony

2018-08-10 10:47:12

by Pavel Machek

[permalink] [raw]
Subject: Re: Droid 4: suspend to RAM?

On Wed 2018-08-08 02:05:12, Tony Lindgren wrote:
> * Pavel Machek <[email protected]> [180727 11:35]:
> > Hi!
> > > > > high even before modem (and thus USB) is enabled.
> > > > >
> > > > > Interestingly, CyanogenMod and Jolla seem to have higher power
> > > > > consumption than stock operating system.
> > > > >
> > > > > (My Linux can survive for 10 hours, stock system could survive for 4
> > > > > days if I'm not mistaken).
> > > > >
> > > > > I thought I would experiment with suspend to RAM.. and it indeed
> > > > > seemed to suspend ok, but I could not wake it up. Do I need to set up
> > > > > wakeup with button somehow? Is suspend to RAM required for good power
> > > > > consumption?
> > > >
> > > > Sorry but pm subsystem has debug mode that you can test in a easy way.
> > > > You can even wakeup by any rtc alarm easily.
> > >
> > > Yes, that is how it works on PC (but there power button works,
> > > too). Is it expected to work on Droid in v4.18?
> >
> > I tried setting up wakeup using RTC, but no, it does not seem to work:
> >
> > root@devuan:/my/tui/d4# rtcwake -m no -s 5
> > rtcwake: wakeup using /dev/rtc0 at Fri Jul 27 11:28:44 2018
> > root@devuan:/my/tui/d4# echo mem > /sys/power/state
>
> Works for me here as tested on next-20180808, maybe you don't have
> CONFIG_RTC_DRV_CPCAP? Maybe you are trying to use
CONFIG_RTC_DRV_OMAP?

I have right config, and it works for me on next-20180808. Power
button wakes it up, as expected, and even usbnet connections survive,
which is good.

Unfortunately, next-20180808 has no video support, which may also be
reason why it works. I guess I'll need to dust off serial cable and
look for logs...
Pavel

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


Attachments:
(No filename) (1.82 kB)
signature.asc (188.00 B)
Digital signature
Download all attachments

2018-08-10 11:14:01

by Pavel Machek

[permalink] [raw]
Subject: Re: Droid 4: suspend to RAM?

Hi!

> * Pavel Machek <[email protected]> [180727 11:35]:
> > Hi!
> > > > > high even before modem (and thus USB) is enabled.
> > > > >
> > > > > Interestingly, CyanogenMod and Jolla seem to have higher power
> > > > > consumption than stock operating system.
> > > > >
> > > > > (My Linux can survive for 10 hours, stock system could survive for 4
> > > > > days if I'm not mistaken).
> > > > >
> > > > > I thought I would experiment with suspend to RAM.. and it indeed
> > > > > seemed to suspend ok, but I could not wake it up. Do I need to set up
> > > > > wakeup with button somehow? Is suspend to RAM required for good power
> > > > > consumption?
> > > >
> > > > Sorry but pm subsystem has debug mode that you can test in a easy way.
> > > > You can even wakeup by any rtc alarm easily.
> > >
> > > Yes, that is how it works on PC (but there power button works,
> > > too). Is it expected to work on Droid in v4.18?
> >
> > I tried setting up wakeup using RTC, but no, it does not seem to work:
> >
> > root@devuan:/my/tui/d4# rtcwake -m no -s 5
> > rtcwake: wakeup using /dev/rtc0 at Fri Jul 27 11:28:44 2018
> > root@devuan:/my/tui/d4# echo mem > /sys/power/state
>
> Works for me here as tested on next-20180808, maybe you don't have
> CONFIG_RTC_DRV_CPCAP? Maybe you are trying to use CONFIG_RTC_DRV_OMAP?

Mainline seems to fail suspend, with CONFIG_DRM turned off. Aha, and
same behaviour with CONFIG_DRM on. Why is it different today?


[ 334.933532] Charging, 4350000 uV, 532000 uA
[ 338.093109] PM: suspend entry (deep)
[ 338.096710] PM: Syncing filesystems ... done.
[ 338.138977] Freezing user space processes ... (elapsed 0.001
seconds) done.
[ 338.147338] OOM killer disabled.
[ 338.150604] Freezing remaining freezable tasks ... (elapsed 0.001
seconds) done.
[ 338.159240] Suspending console(s) (use no_console_suspend to debug)
[ 338.168212] phy [email protected]: phy poweroff failed --> -19
[ 338.181518] l4_wkup_cm:clk:0018:0: failed to disable
[ 338.183227] PM: noirq suspend of devices failed
[ 338.187377] g_ether gadget: reset config
[ 338.187408] g_ether gadget: ecm deactivated
[ 338.187408] usb0: gether_disconnect
[ 338.513092] OOM killer enabled.
[ 338.516296] Restarting tasks ... done.
[ 338.529266] PM: suspend exit
[ 338.698577] g_ether gadget: high-speed config #1: CDC Ethernet
(ECM)
[ 338.704986] g_ether gadget: init ecm
[ 338.708587] g_ether gadget: notify connect true
[ 338.713958] g_ether gadget: activate ecm
[ 338.717895] usb0: qlen 10
[ 338.720550] g_ether gadget: ecm_open
[ 338.724151] usb0: eth_start
[ 338.727111] g_ether gadget: packet filter 0c
[ 338.731414] g_ether gadget: ecm req21.43 v000c i0000 l0
[ 338.993835] cpcap_usb_detect: 27 callbacks suppressed

With USB unplugged, suspend seems to behave as expected, even on
v4.18-rc8, and it seems to work even with X running and modem
online. Good.


> Then for deeper idle modes, you need to also idle UARTs, and unbind or
> unload USB related modules. You should get to something like 160mW
> power consumption with mdm6600 enabled and SoC suspended that way.
>
> Then again system running idle is about the same with timers and
> interrupts working so I'd just idle UARTs and unload USB modules :)

Ok, let me play with it some more.

Thanks for help,
Pavel

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


Attachments:
(No filename) (3.45 kB)
signature.asc (188.00 B)
Digital signature
Download all attachments