[ltp] Re: tp_smapi resume behavior

Henrique de Moraes Holschuh linux-thinkpad@linux-thinkpad.org
Mon, 15 Dec 2008 10:50:09 -0200


On Sun, 14 Dec 2008, Shem Multinymous wrote:
> On Sat, Dec 13, 2008 at 10:07 AM, Henrique de Moraes Holschuh
> <hmh@hmh.eng.br> wrote:
> > Would it be possible to differentiate resume from STR from resume from
> > STD on tp_smapi, and drop the SMAPI calls to restore battery charge
> > thresholds when resuming from STR?
> >
> > The reason I ask for this is that, at least on the T4x, SMAPI battery
> > calls disturb the EC, and it pauses an ongoing charge for ~2s only to
> > immediately resume it.  That is not very optimal for the battery.
> >
> > Besides, we *KNOW* the EC will retain all relevant data over STR
> > anyway, and the less SMAPI calls we do in the resume path, the better
> > (as they cause SMIs, and SMIs are ALWAYS a bad idea when clocks are
> > being recalibrated, devices are being reset, etc).
> >
> > The current behaviour of restoring all thresholds when resuming would
> > have to be reatained when resuming from STD, though.
> 
> Good idea. This amounts to restoring the thresholds in the resume()
> handler only if the most recent suspend() handler was called with
> PM_EVENT_HIBERNATE or PM_EVENT_FREEZE, right?

I think that's a way to do it, yes.  But if any of the power management
structures available at resume time have that information, it would be safer
to use them instead of something stored during suspend.

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh