Ticket #781 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

LM4857 should be turned off on a reboot notifier

Reported by: cesarb@… Owned by: willie_chen@…
Priority: high Milestone:
Component: System Software Version: unspecified
Severity: normal Keywords:
Cc: buglog@…, cw@…, jserv@…, willie_chen@… HasPatchForReview:
Blocked By: Estimated Completion (week):
PatchReviewResult: Blocking:
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@… 2 years ago.
allow LM4857 to be off'ed on suspend and shutdown
LM4857.patch (1.4 KB) - added by willie_chen@… 2 years ago.
some changes about Alex's patch

Change History

Changed 2 years ago by cesarb@…

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

Changed 2 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?

Changed 2 years ago by willie_chen@…

  • cc willie_chen@… added

Changed 2 years ago by jserv@…

  • status changed from new to assigned

Changed 2 years ago by alex@…

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

Changed 2 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 2 years ago by alex@…

allow LM4857 to be off'ed on suspend and shutdown

Changed 2 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. :(

Changed 2 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.

Changed 2 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.

Changed 2 years ago by laforge@…

  • owner changed from laforge@… to willie_chen@…
  • status changed from assigned to new

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.

Changed 2 years ago by willie_chen@…

  • cc willie_chen@… added

Changed 2 years ago by willie_chen@…

  • owner changed from willie_chen@… to willie_chen@…

Changed 2 years ago by willie_chen@…

  • cc willie_chen@… removed

Changed 2 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

Changed 2 years ago by alex@…

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

Changed 2 years ago by cw@…

  • cc cw@… added

Changed 2 years ago by willie_chen@…

some changes about Alex's patch

Changed 2 years ago by willie_chen@…

  • status changed from new to assigned

Changed 2 years ago by alex@…

  • blocked set to 842

Changed 2 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.

Changed 2 years ago by laforge@…

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

Changed 2 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.

Changed 2 years ago by alex@…

Thanks Harald !

Note: See TracTickets for help on using tickets.