Ticket #781 (closed defect: fixed)

Opened 12 years ago

Last modified 12 years ago

LM4857 should be turned off on a reboot notifier

Reported by: cesarb@… Owned by: willie_chen@…
Priority: high Milestone:
Component: kernel Version: unspecified
Severity: normal Keywords:
Cc: buglog@…, cw@…, jserv@…, willie_chen@… Blocked By:
Blocking: Estimated Completion (week):
HasPatchForReview: PatchReviewResult:
Reproducible:

Description

According to http://wiki.openmoko.org/wiki/Neo1973_GTA01_Power_Management, the
LM4857 is connected directly to the battery, and its datasheet shows it uses
several mA when not off. If it is not turned off when shutting down, it will
drain the battery even with the phone off. To avoid this, it should be turned
off when rebooting or powering off the phone.

The best place to turn it off would be by the sound driver in the reboot
notifier chain (register_reboot_notifier). As a workaround, you can set the "Amp
Mode" mixer to "Off" (0) before shutting down the phone.

Thanks to SpeedEvil? for guessing the LM4857 was not being turned off and for
measuring the currents.

Attachments

lm4857_off_on_suspend_and_shutdown.patch (1.3 KB) - added by alex@… 12 years ago.
allow LM4857 to be off'ed on suspend and shutdown
LM4857.patch (1.4 KB) - added by willie_chen@… 12 years ago.
some changes about Alex's patch

Change History

comment:1 Changed 12 years ago by cesarb@…

It would also probably be a good idea to turn if off/on on suspend/resume

comment:2 Changed 12 years ago by laforge@…

  • Cc jserv@… added

of course it is a good idea, and in fact it has always been the plan to do so.

This issue is again one of the many known issues for which our hand full of
internal developers just didn't have the time yet :(

If somebody would implement a kernel patch, I'm happy to review and/or apply.

jserv: can somebody of your team look into this issue?

comment:3 Changed 12 years ago by willie_chen@…

  • Cc willie_chen@… added

comment:4 Changed 12 years ago by jserv@…

  • Status changed from new to assigned

comment:5 Changed 12 years ago by alex@…

I'm volunteer for implementing that this week end if that helps.

comment:6 Changed 12 years ago by willie_chen@…

I make a test on GTA01bv4 as follows:

  1. Cut off power for GSM. So GSM module can't work.
  2. Power on GTA01, then enter into x-windows and power off GTA01.
  3. Power supply displays 11.4 mV is draining.
  4. I use alsactl to control amplifier enter "Amp Mode", before power off.
  5. This time, power supply displays 0 mV.

So the LM4857 will drain the power.

Changed 12 years ago by alex@…

allow LM4857 to be off'ed on suspend and shutdown

comment:7 Changed 12 years ago by willie_chen@…

Hi Alex,

I have tested your patch. Currently, The lm4857 driver didn't receive
suspend/shutdown message when neo1973 suspended/powered off. So far, I still
trace the relation between lm4857 and power manager. :(

comment:8 Changed 12 years ago by alex@…

My patch is in fact doing the same actual processing that is done when the Amp
Mode is set to 'Off', if the suspend message is not issued the same way, then
this is expected.
Do you know the actual command in order to suspend the chip so I can modify the
patch accordingly ?
meanwhile, I'll check on the chip datasheet to validate the way I did it.
Thanks for testing it anyway.

comment:9 Changed 12 years ago by alex@…

In fact I miss-understood your comment, you were saying that in fact the
suspend/shutdown functions of the driver are not called at all. I do not have a
clue here but when I've tested, the shutdown and resume printk were issued.

comment:10 Changed 12 years ago by laforge@…

  • Status changed from assigned to new
  • Owner changed from laforge@… to willie_chen@…

the lack of a call to shutdown/resume might be related to i2c power management
API changes that were introduced somewhere between 2.6.17 and the current kernel...

you might want to compare the suspend/resume functions with other i2c drivers.

comment:11 Changed 12 years ago by willie_chen@…

  • Cc willie_chen@… added

comment:12 Changed 12 years ago by willie_chen@…

  • Owner changed from willie_chen@… to willie_chen@…

comment:13 Changed 12 years ago by willie_chen@…

  • Cc willie_chen@… removed

comment:14 Changed 12 years ago by willie_chen@…

Today I trace the code. The power manager will call i2c_device_suspend function
in i2c-core.c, when neo1973 enters suspend mode. I compare the kernel between
2.6.21.6 and 2.6.17.14. There are two different methods to call device's suspend
function.

Now PM can't find the driver's suspend function. the code is as follows

driver = to_i2c_driver(dev->driver);
if (!driver->suspend)
return 0;

So I will check this part why it always can't find the suspend function

comment:15 Changed 12 years ago by alex@…

That makes me believe that you maybe forgot to update the module in the root
filesystem.

comment:16 Changed 12 years ago by cw@…

  • Cc cw@… added

Changed 12 years ago by willie_chen@…

some changes about Alex's patch

comment:17 Changed 12 years ago by willie_chen@…

  • Status changed from new to assigned

comment:18 Changed 12 years ago by alex@…

  • blocked set to 842

comment:19 Changed 12 years ago by alex@…

Could that patch be included in the openmoko kernel ? it saves battery power
while powered off and seems to have been forgotten.
Thanks,
Alex.

comment:20 Changed 12 years ago by laforge@…

looks fine to me, is in the list of pending-to-be-merged patches for the kernel

comment:21 Changed 12 years ago by laforge@…

  • Status changed from assigned to closed
  • Resolution set to fixed

I've modified the patch slightly (coding style) and applied it to svn as
http://svn.openmoko.org/trunk/src/target/kernel/patches/asoc-neo1973_wm8753-power.patch

All kernels => 3166 have this fix.

comment:22 Changed 12 years ago by alex@…

Thanks Harald !

Note: See TracTickets for help on using tickets.