12 Jan, 2012

1 commit

  • * git://git.infradead.org/battery-2.6: (68 commits)
    power_supply: Mark da9052 driver as broken
    power_supply: Drop usage of nowarn variant of sysfs_create_link()
    s3c_adc_battery: Average over more than one adc sample
    power_supply: Add DA9052 battery driver
    isp1704_charger: Fix missing check
    jz4740-battery: Fix signedness bug
    power_supply: Assume mains power by default
    sbs-battery: Fix devicetree match table
    ARM: rx51: Add bq27200 i2c board info
    sbs-battery: Change power supply name
    devicetree-bindings: Propagate bq20z75->sbs rename to dt bindings
    devicetree-bindings: Add vendor entry for Smart Battery Systems
    sbs-battery: Rename internals to new name
    bq20z75: Rename to sbs-battery
    wm97xx_battery: Use DEFINE_MUTEX() for work_lock
    max8997_charger: Remove duplicate module.h
    lp8727_charger: Some minor fixes for the header
    lp8727_charger: Add header file
    power_supply: Convert drivers/power/* to use module_platform_driver()
    power_supply: Add "unknown" in power supply type
    ...

    Linus Torvalds
     

04 Jan, 2012

3 commits


10 Dec, 2011

1 commit

  • This adds a "scope" attribute to a power_supply, which indicates how
    much of the system it powers. It appears in sysfs as "scope" or in
    the uevent file as POWER_SUPPLY_SCOPE=. There are presently three
    possible values:
    Unknown - unknown power topology
    System - the power supply powers the whole system
    Device - it powers a specific device, or tree of devices

    A power supply which doesn't have a "scope" attribute should be assumed to
    have "System" scope.

    In general, usermode should assume that loss of all System-scoped power
    supplies will power off the whole system, but any single one is sufficient
    to power the system.

    Signed-off-by: Jeremy Fitzhardinge
    Cc: Richard Hughes

    Jeremy Fitzhardinge
     

01 Nov, 2011

1 commit

  • It was actually getting this before by a tangled mess of implict
    includes that is going to be cleaned up. Fix it now, so we don't
    get this after the cleanup.

    power_supply_sysfs.c: In function ‘power_supply_attr_is_visible’:
    power_supply_sysfs.c:184: error: ‘S_IRUSR’ undeclared (first use in this function)
    power_supply_sysfs.c:184: error: (Each undeclared identifier is reported only once
    power_supply_sysfs.c:184: error: for each function it appears in.)
    power_supply_sysfs.c:184: error: ‘S_IRGRP’ undeclared (first use in this function)
    power_supply_sysfs.c:184: error: ‘S_IROTH’ undeclared (first use in this function)
    power_supply_sysfs.c:196: error: ‘S_IWUSR’ undeclared (first use in this function)
    make[3]: *** [drivers/power/power_supply_sysfs.o] Error 1

    Signed-off-by: Paul Gortmaker

    Paul Gortmaker
     

23 Aug, 2011

1 commit


20 Aug, 2011

1 commit

  • Don't tell the system about the battery charger if it's not enabled, we
    can reasonably assume that if the charger is not enabled then no battery
    will ever be connected so reporting state is at best going to waste time
    and at worst going to cause confusing information in the UI.

    For simplicity and robustness we continue to register and handle interrupts
    from the charger.

    Signed-off-by: Mark Brown
    Signed-off-by: Anton Vorontsov

    Mark Brown
     

22 Feb, 2011

1 commit

  • Sometimes a driver can not report a meaningful value for a certain property
    and returns -ENODATA.

    Currently when generating a uevent and a property return -ENODATA it is
    treated as an error an no uevent is generated at all. This is not an
    desirable behavior.

    This patch adds a special case for -ENODATA and ignores properties which
    return this error code when generating the uevent.

    Signed-off-by: Lars-Peter Clausen
    Tested-by: Grazvydas Ignotas

    Lars-Peter Clausen
     

06 Oct, 2010

2 commits


25 May, 2010

1 commit

  • Commit 5f487cd34f4337f9bc27ca19da72a39d1b0a0ab4 (power_supply: Use
    attribute groups) causes a regression the power supply core does not
    export the 'type' attribute anymore.

    POWER_SUPPLY_PROP_TYPE is handled by the power supply core without the
    low-level driver, so power_supply_attr_is_visible() must always return
    the entry as readable.

    Reported-by: Rafael J. Wysocki
    Signed-off-by: Daniel Mack
    Tested-by: Rafael J. Wysocki
    Signed-off-by: Anton Vorontsov

    Daniel Mack
     

19 May, 2010

2 commits

  • This patch adds support for writeable power supply properties and
    exposes them as writeable to sysfs.

    A power supply implementation must implement two new function calls in
    order to use that feature:

    int set_property(struct power_supply *psy,
    enum power_supply_property psp,
    const union power_supply_propval *val);

    int property_is_writeable(struct power_supply *psy,
    enum power_supply_property psp);

    Signed-off-by: Daniel Mack
    Cc: David Woodhouse
    Cc: Alexey Starikovskiy
    Cc: Len Brown
    Cc: Mark Brown
    Cc: Matt Reimer
    Cc: Evgeniy Polyakov
    Cc: Tejun Heo
    Signed-off-by: Anton Vorontsov

    Daniel Mack
     
  • This fixes a race between power supply device and initial
    attributes creation, plus makes it possible to implement
    writable properties.

    [Daniel Mack - removed superflous return statement
    and dropped .mode attribute from POWER_SUPPLY_ATTR]

    Suggested-by: Greg KH
    Suggested-by: Kay Sievers
    Signed-off-by: Anton Vorontsov
    Tested-by: Daniel Mack

    Anton Vorontsov
     

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
     

16 Jan, 2010

1 commit


03 Dec, 2009

1 commit


02 Jul, 2009

1 commit


01 Jul, 2009

1 commit

  • This reverts commit 8efe444038a205e79b38b7ad03878824901849a8 and
    4cbc76eadf56399cd11fb736b33c53aec9caab8c.

    Richard@laptop.org was apparently using CAPACITY_LEVEL for debugging
    battery/EC problems, and was upset that it was removed. This readds it.

    Conflicts:

    Documentation/power_supply_class.txt

    Signed-off-by: Andres Salomon
    Signed-off-by: Anton Vorontsov

    Andres Salomon
     

28 Mar, 2009

1 commit


04 Jan, 2009

1 commit


20 Oct, 2008

1 commit

  • Tejun's commit 7b595756ec1f49e0049a9e01a1298d53a7faaa15 made sysfs
    attribute->owner unnecessary. But the field was left in the structure to
    ease the merge. It's been over a year since that change and it is now
    time to start killing attribute->owner along with its users - one arch at
    a time!

    This patch is attempt #1 to get rid of attribute->owner only for
    CONFIG_X86_64 or CONFIG_X86_32 . We will deal with other arches later on
    as and when possible - avr32 will be the next since that is something I
    can test. Compile (make allyesconfig / make allmodconfig / custom config)
    and boot tested.

    akpm: the idea is that we put the declaration of sttribute.owner inside
    `#ifndef CONFIG_X86'. But that proved to be too ambitious for now because
    new usages kept on turning up in subsystem trees.

    [akpm: remove the ifdef for now]
    Signed-off-by: Parag Warudkar
    Cc: Greg KH
    Cc: Ingo Molnar
    Cc: Tejun Heo
    Cc: Len Brown
    Cc: Jens Axboe
    Cc: Jean Delvare
    Cc: Roland Dreier
    Cc: David Brownell
    Cc: Alessandro Zummo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Parag Warudkar
     

30 Jul, 2008

1 commit


10 Jun, 2008

1 commit

  • Commit 54d29ad33e3483bcc7ca433a21cf294854e5154a (Power Supply: fix race
    in device_create) introduced a race in power_supply_uevent. Previously it
    checked that power_supply is available by checking for dev->driver_data.
    But now dev->driver_data is set before power_supply->dev is initialised.

    Signed-off-by: Dmitry Baryshkov
    Signed-off-by: Anton Vorontsov

    Dmitry Baryshkov
     

13 May, 2008

1 commit

  • This adds PROP_CHARGE_COUNTER to the power supply class (documenting it
    as well). The OLPC battery driver uses this for spitting out its ACR
    values (in uAh). We have some rounding errors (the data sheet claims
    416.7, the math actually works out to 416.666667, so we're forced to
    choose between overflows or precision loss. I chose precision loss,
    and stuck w/ data sheet values), but I don't think anyone will care
    that much.

    Signed-off-by: Andres Salomon
    Signed-off-by: Anton Vorontsov

    Andres Salomon
     

08 Feb, 2008

2 commits

  • * 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: (112 commits)
    ACPI: fix build warning
    Revert "cpuidle: build fix for non-x86"
    ACPI: update intrd DSDT override console messages
    ACPI: update DSDT override documentation
    ACPI: Add "acpi_no_initrd_override" kernel parameter
    ACPI: its a directory not a folder....
    ACPI: misc cleanups
    ACPI: add missing prink prefix strings
    ACPI: cleanup acpi.h
    ACPICA: fix CONFIG_ACPI_DEBUG_FUNC_TRACE build
    ACPI: video: Ignore ACPI video devices that aren't present in hardware
    ACPI: video: reset brightness on resume
    ACPI: video: call ACPI notifier chain for ACPI video notifications
    ACPI: create notifier chain to get hotkey events to graphics driver
    ACPI: video: delete unused display switch on hotkey event code
    ACPI: video: create "brightness_switch_enabled" modparam
    cpuidle: Add a poll_idle method
    ACPI: cpuidle: Support C1 idle time accounting
    ACPI: enable MWAIT for C1 idle
    ACPI: idle: Fix acpi_safe_halt usages and interrupt enabling/disabling
    ...

    Linus Torvalds
     
  • This commit:

    commit 8efe444038a205e79b38b7ad03878824901849a8
    Author: Andres Salomon
    Date: Wed Dec 12 14:12:56 2007 -0500

    power: remove POWER_SUPPLY_PROP_CAPACITY_LEVEL

    Removed CAPACITY_LEVEL from every other code, leaving the array with sysfs
    attributes with one more entry than the number of enums in power_supply.h.
    This leads to some attributes containing the value of the attribute right
    after it. For example, temp_ambient would have the value of
    time_to_empty_now. In my case, I had time_to_full_avg have the value which
    should be in model_name, when the former was usually empty.

    Cc: Andres Salomon
    Cc: David Woodhouse
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Thadeu Lima de Souza Cascardo
     

06 Feb, 2008

1 commit


02 Feb, 2008

4 commits

  • Add LiMn (one of the most common for small non-rechargable batteries)
    battery technology and voltage_min/_max properties support.

    Signed-off-by: Dmitry Baryshkov
    Signed-off-by: Anton Vorontsov

    Dmitry Baryshkov
     
  • In power_supply_create_attrs(), we create static attributes as referenced
    by power_supply_static_attrs[i]. After that, if we fail, we unregister
    via power_supply_static_attrs[psy->properties[i]]. This is incorrect, as
    psy->properties has absolutely no bearing on static attribs. This patch
    fixes it to unregister the correct attrib.

    Another line which was unnecessarily line wrapped is also unwrapped.

    Signed-off-by: Andres Salomon
    Signed-off-by: David Woodhouse

    Andres Salomon
     
  • The CAPACITY_LEVEL stuff defines various levels of charge; however, what
    is the difference between them? What differentiates between HIGH and NORMAL,
    LOW and CRITICAL, etc?

    As it appears that these are fairly arbitrary, we end up making such policy
    decisions in the kernel (or in hardware). This is the sort of decision that
    should be made in userspace, not in the kernel.

    If the hardware does not support _CAPACITY and it cannot be easily calculated,
    then perhaps the driver should register a custom CAPACITY_LEVEL attribute;
    however, userspace should not become accustomed to looking for such a thing,
    and we should certainly not encourage drivers to provide CAPACITY_LEVEL
    stubs.

    The following removes support for POWER_SUPPLY_PROP_CAPACITY_LEVEL. The
    OLPC battery driver is the only driver making use of this, so it's
    removed from there as well.

    Signed-off-by: Andres Salomon
    Signed-off-by: David Woodhouse

    Andres Salomon
     
  • Signed-off-by: Adrian Bunk
    Signed-off-by: Andrew Morton
    Signed-off-by: Anton Vorontsov

    Adrian Bunk
     

13 Oct, 2007

1 commit

  • This changes the uevent buffer functions to use a struct instead of a
    long list of parameters. It does no longer require the caller to do the
    proper buffer termination and size accounting, which is currently wrong
    in some places. It fixes a known bug where parts of the uevent
    environment are overwritten because of wrong index calculations.

    Many thanks to Mathieu Desnoyers for finding bugs and improving the
    error handling.

    Signed-off-by: Kay Sievers
    Cc: Mathieu Desnoyers
    Cc: Cornelia Huck
    Signed-off-by: Greg Kroah-Hartman

    Kay Sievers
     

21 Sep, 2007

1 commit


16 Jul, 2007

1 commit


10 Jul, 2007

1 commit

  • This class is result of "external power" and "battery" classes merge,
    as suggested by David Woodhouse. He also implemented uevent support.

    Here how userspace seeing it now:

    # ls /sys/class/power\ supply/
    ac main-battery usb

    # cat /sys/class/power\ supply/ac/type
    AC

    # cat /sys/class/power\ supply/usb/type
    USB

    # cat /sys/class/power\ supply/main-battery/type
    Battery

    # cat /sys/class/power\ supply/ac/online
    1

    # cat /sys/class/power\ supply/usb/online
    0

    # cat /sys/class/power\ supply/main-battery/status
    Charging

    # cat /sys/class/leds/h5400\:red-left/trigger
    none h5400-radio timer hwtimer ac-online usb-online
    main-battery-charging-or-full [main-battery-charging]
    main-battery-full

    Signed-off-by: Anton Vorontsov
    Signed-off-by: David Woodhouse
    Signed-off-by: Andrew Morton

    Anton Vorontsov