30 Mar, 2010

1 commit

  • …it slab.h inclusion from percpu.h

    percpu.h is included by sched.h and module.h and thus ends up being
    included when building most .c files. percpu.h includes slab.h which
    in turn includes gfp.h making everything defined by the two files
    universally available and complicating inclusion dependencies.

    percpu.h -> slab.h dependency is about to be removed. Prepare for
    this change by updating users of gfp and slab facilities include those
    headers directly instead of assuming availability. As this conversion
    needs to touch large number of source files, the following script is
    used as the basis of conversion.

    http://userweb.kernel.org/~tj/misc/slabh-sweep.py

    The script does the followings.

    * Scan files for gfp and slab usages and update includes such that
    only the necessary includes are there. ie. if only gfp is used,
    gfp.h, if slab is used, slab.h.

    * When the script inserts a new include, it looks at the include
    blocks and try to put the new include such that its order conforms
    to its surrounding. It's put in the include block which contains
    core kernel includes, in the same order that the rest are ordered -
    alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
    doesn't seem to be any matching order.

    * If the script can't find a place to put a new include (mostly
    because the file doesn't have fitting include block), it prints out
    an error message indicating which .h file needs to be added to the
    file.

    The conversion was done in the following steps.

    1. The initial automatic conversion of all .c files updated slightly
    over 4000 files, deleting around 700 includes and adding ~480 gfp.h
    and ~3000 slab.h inclusions. The script emitted errors for ~400
    files.

    2. Each error was manually checked. Some didn't need the inclusion,
    some needed manual addition while adding it to implementation .h or
    embedding .c file was more appropriate for others. This step added
    inclusions to around 150 files.

    3. The script was run again and the output was compared to the edits
    from #2 to make sure no file was left behind.

    4. Several build tests were done and a couple of problems were fixed.
    e.g. lib/decompress_*.c used malloc/free() wrappers around slab
    APIs requiring slab.h to be added manually.

    5. The script was run on all .h files but without automatically
    editing them as sprinkling gfp.h and slab.h inclusions around .h
    files could easily lead to inclusion dependency hell. Most gfp.h
    inclusion directives were ignored as stuff from gfp.h was usually
    wildly available and often used in preprocessor macros. Each
    slab.h inclusion directive was examined and added manually as
    necessary.

    6. percpu.h was updated not to include slab.h.

    7. Build test were done on the following configurations and failures
    were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
    distributed build env didn't work with gcov compiles) and a few
    more options had to be turned off depending on archs to make things
    build (like ipr on powerpc/64 which failed due to missing writeq).

    * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
    * powerpc and powerpc64 SMP allmodconfig
    * sparc and sparc64 SMP allmodconfig
    * ia64 SMP allmodconfig
    * s390 SMP allmodconfig
    * alpha SMP allmodconfig
    * um on x86_64 SMP allmodconfig

    8. percpu.h modifications were reverted so that it could be applied as
    a separate patch and serve as bisection point.

    Given the fact that I had only a couple of failures from tests on step
    6, I'm fairly confident about the coverage of this conversion patch.
    If there is a breakage, it's likely to be something in one of the arch
    headers which should be easily discoverable easily on most builds of
    the specific arch.

    Signed-off-by: Tejun Heo <tj@kernel.org>
    Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>

    Tejun Heo
     

15 Mar, 2010

1 commit


08 Mar, 2010

3 commits


27 Feb, 2010

2 commits


17 Feb, 2010

4 commits


03 Feb, 2010

1 commit


29 Jan, 2010

2 commits


16 Jan, 2010

1 commit


18 Dec, 2009

1 commit

  • Prior to this patch, pmu_battery was unable to report battery full
    status. This patch fixes the issue by adding a proper handling code
    into pmu_bat_get_property(): if we're on AC and the battery isn't
    charging, then the battery is considered full.

    Signed-off-by: Thomas Champagne
    Acked-By: David Woodhouse
    Signed-off-by: Anton Vorontsov

    Thomas Champagne
     

16 Dec, 2009

2 commits

  • * git://git.infradead.org/battery-2.6:
    power_supply_sysfs: Handle -ENODATA in a special way
    wm831x_backup: Remove unused variables
    gta02: Set pcf50633 charger_reference_current_ma
    pcf50633: Query charger status directly
    pcf50633: Properly reenable charging when the supply conditions change
    pcf50633: Get rid of charging restart software auto-triggering
    pcf50633: introduces battery charging current control
    pcf50633: Add ac power supply class to the charger
    wm831x: Factor out WM831x backup battery charger

    Linus Torvalds
     
  • Signed-off-by: Alexey Dobriyan
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     

14 Dec, 2009

3 commits

  • Bring the WM8350 IRQ API more in line with the generic IRQ API by
    masking and unmasking interrupts as they are requested and freed.
    This is mostly just a case of deleting the mask and unmask calls
    from the individual drivers.

    The RTC driver is changed to mask the periodic IRQ after requesting
    it rather than only unmasking the alarm IRQ. If the periodic IRQ
    fires in the period where it is reqested then there will be a
    spurious notification but there should be no serious consequences
    from this.

    The CODEC drive is changed to explicitly disable headphone jack
    detection prior to requesting the IRQs. This will avoid the IRQ
    firing with no jack set up.

    Signed-off-by: Mark Brown
    Signed-off-by: Samuel Ortiz

    Mark Brown
     
  • This is done as simple code transformation, the semantics of the
    IRQ API provided by the core are are still very different to those
    of genirq (mainly with regard to masking).

    Signed-off-by: Mark Brown
    Signed-off-by: Samuel Ortiz

    Mark Brown
     
  • Since platform_device_add_data copies the passed data, the allocated
    subdev_pdata is never freed. A simple fix would be to either free subdev_pdata
    or put it onto the stack. But since the pcf50633 child devices can rely on
    beeing children of the pcf50633 core device it's much more elegant to get access
    to pcf50633 core structure through that link. This allows to get completly rid
    of pcf5033_subdev_pdata.

    Signed-off-by: Lars-Peter Clausen
    Signed-off-by: Paul Fertser
    Signed-off-by: Samuel Ortiz

    Lars-Peter Clausen
     

03 Dec, 2009

1 commit


28 Nov, 2009

1 commit


18 Nov, 2009

1 commit


16 Nov, 2009

6 commits

  • Current scheme is fragile and is likely to go off sync, especially on
    batfull->adapter charging automatic MBC transition.

    Query the status bit every time we need it instead.

    We need to export another function to query for USB presence because
    we can't read anything from PCF50633 (via I2C) inside irq context and
    that is needed by usb gadgets.

    Signed-off-by: Paul Fertser
    Signed-off-by: Anton Vorontsov

    Paul Fertser
     
  • If chgmod == BATFULL, setting chgena has no effect. Datasheet says we
    need to set resume instead but when autoresume is used resume doesn't
    work. Clear and set chgena instead.

    This enables a user to force charging by re-plugging USB even when the
    charger entered Battery Full mode, might be handy before a long trip.

    Signed-off-by: Paul Fertser
    Signed-off-by: Anton Vorontsov

    Paul Fertser
     
  • After reaching Battery Full condition MBC state machine switches back
    into charging mode when the battery voltage falls below 96% of a
    battery float voltage. The voltage drop in Li-Ion batteries is
    marginal (1-2%) till about 80% of its capacity - which means, after a
    BATFULL, charging won't be restarted until 75-80%.

    That is a desired behaviour recommended by battery manufacturers,
    don't mess with it.

    Signed-off-by: Paul Fertser
    Signed-off-by: Anton Vorontsov

    Paul Fertser
     
  • Implement a new sysfs attribute to allow changing MBC charging limit on
    the fly independently of usb current limit. It also gets set
    automatically every time usb current limit is changed.

    Limiting charging current also prevents violating USB specification in
    the case when the whole device is shut down and usb current limit is
    reset to the factory default by the pcf50633 state transition.

    Signed-off-by: Balaji Rao
    Signed-off-by: Paul Fertser
    Signed-off-by: Anton Vorontsov

    Balaji Rao
     
  • This adds an appropriate ac power_supply class and shows usb only when
    at the appropriate current limit.

    Signed-off-by: Sean McNeil
    Signed-off-by: Paul Fertser
    Signed-off-by: Anton Vorontsov

    Sean McNeil
     
  • The backup battery on WM831x is a separate IP block to the main PMU
    and is largely unrelated to the main supply functionality. Factor it
    out into a separate driver in order to reflect this and better support
    future hardware versions.

    Signed-off-by: Mark Brown
    Acked-by: Samuel Ortiz
    Signed-off-by: Anton Vorontsov

    Mark Brown
     

23 Sep, 2009

1 commit


05 Sep, 2009

5 commits


31 Jul, 2009

1 commit


30 Jul, 2009

3 commits

  • The ds2760's internal current meter is not reliable enough as it has an
    inacurracy of around ~15%. Without any correction for that error, the
    current accumulator is couting up all the time, even though the battery
    is already fully charged and hence destroys the static information. The
    longer it is connected, the worse is the aberration.

    Fortunately, this can be corrected by the DS2760_CURRENT_OFFSET_BIAS
    register. Using the external power_supply_set_battery_charged()
    function, this register is now gauging the measurement.

    A delayed work is used to debounce flaky GPIO signals and to let the
    current value settle. Also see Maxim's application note AN4188.

    Signed-off-by: Daniel Mack
    Cc: Szabolcs Gyurko
    Cc: Matt Reimer
    Cc: Anton Vorontsov
    Signed-off-by: Anton Vorontsov

    Daniel Mack
     
  • This adds a function that indicates that a battery is fully charged.
    It also includes functions to get a power_supply device from the class
    of registered devices by name reference. These can be used to find a
    specific battery to call power_supply_set_battery_charged() on.

    Some battery drivers might need this information to calibrate
    themselves.

    Signed-off-by: Daniel Mack
    Cc: Ian Molton
    Cc: Anton Vorontsov
    Cc: Matt Reimer
    Signed-off-by: Anton Vorontsov

    Daniel Mack
     
  • While I'm at it, cleanup the power supply code so that EXPORT_SYMBOL_GPL
    appears directly after the symbole declaration. checkpatch.pl wants it
    that way.

    Signed-off-by: Daniel Mack
    Cc: Ian Molton
    Cc: Matt Reimer
    Signed-off-by: Anton Vorontsov

    Daniel Mack