07 Jan, 2012

1 commit

  • The function is not exported to modules, plus we do want to catch anyone
    who tries to create complex hierarchy (in that case we'd need to change
    'powers' symlink to a directory, probably under a different name to not
    break ABI).

    This patch fixes the following build error:

    ERROR: "sysfs_create_link_nowarn" [drivers/power/power_supply.ko] undefined!

    Reported-by: Stephen Rothwell
    Signed-off-by: Anton Vorontsov

    Anton Vorontsov
     

06 Jan, 2012

1 commit

  • If no power class device is found in power_supply_is_system_supplied(),
    the function currently returns 0, which basically means that the system
    is supposed to be running on battery. In practice, mobile devices tend
    to always implement at least one power class device and more often two
    (battery and AC adapter). Systems with no registered power class
    devices are more likely to be desktop systems, where the system is
    always powered by mains.

    So, change the default return value of
    power_supply_is_system_supplied() from 0 (running on battery) to 1
    (running on mains.)

    Signed-off-by: Jean Delvare
    Cc: David Woodhouse
    Cc: Matthew Garrett
    Cc: Alex Deucher
    Signed-off-by: Anton Vorontsov

    Jean Delvare
     

10 Dec, 2011

1 commit

  • If a power supply has a scope of "Device", then allow the power supply
    to indicate what device it actually powers. This is represented in the
    power supply's sysfs directory as a symlink named "powers", which points to
    the sysfs directory of the powered device.

    If the device has children, then the sub-devices are also powered by
    the same power supply.

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

    Jeremy Fitzhardinge
     

22 Feb, 2011

1 commit

  • Calling device_add causes an inital uevent for that device to be generated.
    The power_supply uevent function calls the drivers get_property function,
    which might causes the driver to update its state, which again might
    causes the driver to call power_supply_changed(). Since the power_supplys
    changed_work has not been initialized at this point the behavior is
    undefined and can result in an OOPS.

    This patch fixes the issue by initializing the power_supplys changed_work
    prior to adding the power_supplys device to the device tree.

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

    Lars-Peter Clausen
     

22 Dec, 2010

2 commits

  • flush_scheduled_work() is deprecated and scheduled to be removed.

    In battery drivers, the work can be canceled on probe failure and
    removal and should be flushed on suspend. Replace
    flush_scheduled_work() usages with direct cancels and flushes.

    Signed-off-by: Tejun Heo
    Signed-off-by: Anton Vorontsov

    Tejun Heo
     
  • device_unregister() might free its argument. This leads to freed
    memory use in kfree(). Also use put_device() instead of kfree()
    as dev may be already used in another layer after call to device_add().

    Signed-off-by: Vasiliy Kulikov
    Signed-off-by: Anton Vorontsov

    Vasiliy Kulikov
     

19 May, 2010

1 commit

  • 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 Jul, 2009

2 commits

  • 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
     

19 Oct, 2008

1 commit


17 Oct, 2008

1 commit


01 Sep, 2008

1 commit


22 Jul, 2008

1 commit


21 May, 2008

1 commit

  • There is a race from when a device is created with device_create() and
    then the drvdata is set with a call to dev_set_drvdata() in which a
    sysfs file could be open, yet the drvdata will be NULL, causing all
    sorts of bad things to happen.

    This patch fixes the problem by using the new function,
    device_create_drvdata().

    Cc: Kay Sievers
    Cc: Anton Vorontsov
    Cc: David Woodhouse
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

29 Apr, 2008

1 commit


25 Jan, 2008

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