01 Jun, 2012

1 commit

  • Pull battery updates from Anton Vorontsov:
    "A bunch of fixes for v3.5, nothing extraordinary."

    * tag 'for-v3.5' of git://git.infradead.org/battery-2.6: (27 commits)
    smb347-charger: Include missing
    smb347-charger: Clean up battery attributes
    max17042_battery: Add support for max17047/50 chip
    sbs-battery.c: Capacity attr = remaining relative capacity
    isp1704_charger: Use after free on probe error
    ds2781_battery: Use DS2781_PARAM_EEPROM_SIZE and DS2781_USER_EEPROM_SIZE
    power_supply: Fix a typo in BATTERY_DS2781 Kconfig entry
    charger-manager: Provide cm_notify_event function for in-kernel use
    charger-manager: Poll battery health in normal state
    smb347-charger: Convert to regmap API
    smb347-charger: Move IRQ enabling to the end of probe
    smb347-charger: Rename few functions to match better what they are doing
    smb347-charger: Convert to use module_i2c_driver()
    smb347_charger: Cleanup power supply registration code in probe
    ab8500: Clean up probe routines
    ab8500_fg: Harden platform data check
    ab8500_btemp: Harden platform data check
    ab8500_charger: Harden platform data check
    MAINTAINERS: Fix 'F' entry for the power supply class
    max17042_battery: Handle irq request failure case
    ...

    Linus Torvalds
     

30 May, 2012

1 commit

  • Pull MFD changes from Samuel Ortiz:
    "Besides the usual cleanups, this one brings:

    * Support for 5 new chipsets: Intel's ICH LPC and SCH Centerton,
    ST-E's STAX211, Samsung's MAX77693 and TI's LM3533.

    * Device tree support for the twl6040, tps65910, da9502 and ab8500
    drivers.

    * Fairly big tps56910, ab8500 and db8500 updates.

    * i2c support for mc13xxx.

    * Our regular update for the wm8xxx driver from Mark."

    Fix up various conflicts with other trees, largely due to ab5500 removal
    etc.

    * tag 'mfd-3.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6: (106 commits)
    mfd: Fix build break of max77693 by adding REGMAP_I2C option
    mfd: Fix twl6040 build failure
    mfd: Fix max77693 build failure
    mfd: ab8500-core should depend on MFD_DB8500_PRCMU
    gpio: tps65910: dt: process gpio specific device node info
    mfd: Remove the parsing of dt info for tps65910 gpio
    mfd: Save device node parsed platform data for tps65910 sub devices
    mfd: Add r_select to lm3533 platform data
    gpio: Add Intel Centerton support to gpio-sch
    mfd: Emulate active low IRQs as well as active high IRQs for wm831x
    mfd: Mark two lm3533 zone registers as volatile
    mfd: Fix return type of lm533 attribute is_visible
    mfd: Enable Device Tree support in the ab8500-pwm driver
    mfd: Enable Device Tree support in the ab8500-sysctrl driver
    mfd: Add support for Device Tree to twl6040
    mfd: Register the twl6040 child for the ASoC codec unconditionally
    mfd: Allocate twl6040 IRQ numbers dynamically
    mfd: twl6040 code cleanup in interrupt initialization part
    mfd: Enable ab8500-gpadc driver for Device Tree
    mfd: Prevent unassigned pointer from being used in ab8500-gpadc driver
    ...

    Linus Torvalds
     

20 May, 2012

1 commit

  • The modern idiom is to use irq_domain to allocate interrupts. This is
    useful partly to allow further infrastructure to be based on the domains
    and partly because it makes it much easier to allocate virtual interrupts
    to devices as we don't need to allocate a contiguous range of interrupt
    numbers.

    Convert the wm831x driver over to this infrastructure, using a legacy
    IRQ mapping if an irq_base is specified in platform data and otherwise
    using a linear mapping, always registering the interrupts even if they
    won't ever be used. Only boards which need to use the GPIOs as
    interrupts should need to use an irq_base.

    This means that we can't use the MFD irq_base management since the
    unless we're using an explicit irq_base from platform data we can't rely
    on a linear mapping of interrupts. Instead we need to map things via
    the irq_domain - provide a conveniencem function wm831x_irq() to save a
    small amount of typing when doing so. Looking at this I couldn't clearly
    see anything the MFD core could do to make this nicer.

    Since we're not supporting device tree yet there's no meaningful
    advantage if we don't do this conversion in one, the fact that the
    interrupt resources are used for repeated IP blocks makes accessor
    functions for the irq_domain more trouble to do than they're worth.

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

    Mark Brown
     

19 May, 2012

1 commit

  • Without the include we get build errors like:

    drivers/power/smb347-charger.c: In function 'smb347_probe':
    drivers/power/smb347-charger.c:1039:2: error: implicit declaration of function 'IS_ERR' [-Werror=implicit-function-declaration]
    drivers/power/smb347-charger.c:1040:3: error: implicit declaration of function 'PTR_ERR' [-Werror=implicit-function-declaration]

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

    Mika Westerberg
     

06 May, 2012

8 commits

  • CURRENT_NOW and VOLTAGE_NOW should be instantaneous readings
    from power supply(ex: battery).

    smb347 charger driver reports charge voltage for VOLTAGE_NOW
    and charge current for CURRENT_NOW attributes which are not
    instantaneous readings.

    This patch removes the battery VOLTAGE_NOW and CURRENT_NOW
    properties from the driver and also removes hw_to_current()
    which is not required anymore.

    Signed-off-by: Ramakrishna Pallala
    Acked-by: Mika Westerberg
    Signed-off-by: Anton Vorontsov

    Ramakrishna Pallala
     
  • max17047 is improved version of max17042 chip. It has few HW bug
    fixes with minor changes in register set.

    max17050 is same as max17047 chip except its silicon packging. So from
    driver's point of view there is no difference btw max1047 and max1050.

    This patch adds the support to dynamically detect the chip type and
    adds steps to initialize the max17047 chip.

    Signed-off-by: Ramakrishna Pallala
    Signed-off-by: Anton Vorontsov

    Ramakrishna Pallala
     
  • Currently, the capacity exported by this driver refers to reg 0x0e,
    which is the absolute state of charge which according to SBS
    refers to the design capacity/ energy of the battery. It can be
    > 100 % and drops below 100 % for a fully charged battery with
    the battery aging.

    This is not what the user exspects of a remaining capacity
    indication between 0 and 100 % with 100 % referring to
    a fully charged battery. This is provided by SBS reg 0x0d,
    which is the relative state of charge referring to the
    full charge capacity.

    Signed-off-by: Nikolaus Voss
    Acked-by: Rhyland Klein
    Signed-off-by: Anton Vorontsov

    Nikolaus Voss
     
  • We can't use "isp" after freeing it.

    Signed-off-by: Dan Carpenter
    Reviewed-by: Felipe Contreras
    Signed-off-by: Anton Vorontsov

    Dan Carpenter
     
  • Since we have defined DS2781_PARAM_EEPROM_SIZE and
    DS2781_USER_EEPROM_SIZE, use them to simplify the code.

    Signed-off-by: Axel Lin
    Acked-by: Evgeniy Polyakov
    Signed-off-by: Anton Vorontsov

    Axel Lin
     
  • Signed-off-by: Axel Lin
    Acked-by: Evgeniy Polyakov
    Signed-off-by: Anton Vorontsov

    Axel Lin
     
  • By using cm_notify_event function, charger driver can report several
    charger events (e.g. battery full and external power in/out, etc) to
    Charger-Manager. Charger-Manager can properly and immediately control
    chargers by the reported event.

    Signed-off-by: MyungJoo Ham
    Signed-off-by: Donggeun Kim
    Signed-off-by: Kyungmin Park
    Signed-off-by: Anton Vorontsov

    Chanwoo Choi
     
  • Charger-Manager needs to check battery health in normal state
    as well as suspend-to-RAM state. When the battery is fully charged,
    Charger-Manager needs to determine when the chargers restart charging.

    This patch allows Charger-Manager to monitor battery health in normal
    state and handle operation for chargers after battery is fully charged.

    Signed-off-by: MyungJoo Ham
    Signed-off-by: Donggeun Kim
    Signed-off-by: Kyungmin Park
    Signed-off-by: Anton Vorontsov

    Chanwoo Choi
     

05 May, 2012

17 commits

  • The smb347-charger driver does a lot of read-modify-write to the device
    registers. Instead of open-coding everything we can take advantage of
    regmap API which provides nice functions to do this kind of things.

    In addition there is no need for custom debugfs file for dumping
    registers as this is already provided by the regmap API.

    Signed-off-by: Mika Westerberg
    Signed-off-by: Anton Vorontsov

    Mika Westerberg
     
  • There is a potential problem if we call smb347_irq_enable() from
    smb347_irq_init() because smb347_irq_enable() makes the device registers
    read-only once it returns and smb347_irq_init() expects them to still be
    read-write. Currently no harm happens because it is the last call we make
    in smb347_irq_init().

    Anyway a better place for enabling IRQs is at the end of probe function
    and this is also symmetric to call smb347_irq_disable() which is done at
    the beginning of remove function.

    Signed-off-by: Mika Westerberg
    Signed-off-by: Anton Vorontsov

    Mika Westerberg
     
  • The naming used in the driver for some functions is not very clear what
    the functions are really doing. To make this a bit easier to understand
    we rename few functions which were badly named.

    Signed-off-by: Mika Westerberg
    Signed-off-by: Anton Vorontsov

    Mika Westerberg
     
  • This reduces the amount of boilerplate code in the driver and
    makes it a bit simpler.

    Signed-off-by: Mika Westerberg
    Signed-off-by: Anton Vorontsov

    Mika Westerberg
     
  • This patch checks if the usb or mains charging is enabled by the
    platform before registering with the power supply class.

    Signed-off-by: Ramakrishna Pallala
    Signed-off-by: Anton Vorontsov

    Ramakrishna Pallala
     
  • These patches clean up some ugliness and brings the variable
    initialisation formatting more into line with other drivers.

    Signed-off-by: Lee Jones
    Signed-off-by: Anton Vorontsov

    Lee Jones
     
  • If no platform data at all is supplied the driver crashes,
    extend the checks to be more careful so we can compile in the
    driver and boot also without platform data present.

    Acked-by: Arun Murthy
    Signed-off-by: Linus Walleij
    Signed-off-by: Anton Vorontsov

    Linus Walleij
     
  • If no platform data at all is supplied the driver crashes,
    extend the checks to be more careful so we can compile in the
    driver and boot also without platform data present.

    Acked-by: Arun Murthy
    Signed-off-by: Linus Walleij
    Signed-off-by: Anton Vorontsov

    Linus Walleij
     
  • If no platform data at all is supplied the driver crashes,
    extend the checks to be more careful so we can compile in the
    driver and boot also without platform data present.

    Acked-by: Arun Murthy
    Signed-off-by: Linus Walleij
    Signed-off-by: Anton Vorontsov

    Linus Walleij
     
  • suspend/resume functions take action based upon the fuel gauge
    interrupt. If the rquest irq fails we should assign 0 to client->irq.

    Signed-off-by: Ramakrishna Pallala
    Signed-off-by: Anton Vorontsov

    Ramakrishna Pallala
     
  • IRQ registration should happen only after power supply object usable.
    This patch fixes the ordering of power supply and irq registration
    calls.

    Signed-off-by: Ramakrishna Pallala
    Signed-off-by: Anton Vorontsov

    Ramakrishna Pallala
     
  • On Mon, Apr 02, 2012 at 01:53:23PM +1000, Benjamin Herrenschmidt wrote:
    > > drivers/built-in.o: In function `.nouveau_pm_trigger':
    > > (.text+0xa56e8): undefined reference to `.power_supply_is_system_supplied'
    > >
    > > nouveau probably needs to depends on CONFIG_POWER_SUPPLY to force a module
    > > build with the latter is =m
    >
    > Ok, not that trivial...
    >
    > The problem is more like POWER_SUPPLY should be a bool, not a tristate.
    >
    > If you think about it: you don't want things like nouveau to depend on a
    > random subsystem like that, people will never get it. In fact,
    > POWER_SUPPLY provides empty inline stubs when not enabled, so that's
    > really designed to not have depends...
    >
    > However that -cannot- work if POWER_SUPPLY is modular and the drivers
    > who use it are not.
    >
    > The only fixes here that make sense I can think of
    > that don't also involve Kconfig horrors are:
    >
    > - Ugly: in power_supply.h, use the extern variant if
    >
    > defined(CONFIG_POWER_SUPPLY) ||
    > (defined(CONFIG_POWER_SUPPLY_MODULE) && defined(MODULE))
    >
    > IE. use the stub if power supply is a module and what is being built is
    > built-in. Of course that's not only ugly, it somewhat sucks from a user
    > perspective as the subsystem now exists but can't be used by some
    > drivers...
    >
    > - Better: Just make the bloody thing a bool :-) The power supply
    > framework itself is small enough, just make it a boolean option and
    > avoid the problem entirely. The actual power supply sub drivers can
    > remain modular of course.

    Suggested-by: Benjamin Herrenschmidt
    Signed-off-by: Anton Vorontsov

    Anton Vorontsov
     
  • This adds a new sysfs file called 'voltage_ocv' which gives the
    Open Circuit Voltage of the battery.

    This property can be used for platform shutdown policies and
    can be useful for initial capacity estimations.

    Note: This patch is generated against linux-next branch.

    Signed-off-by: Ramakrishna Pallala
    Signed-off-by: Anton Vorontsov

    Ramakrishna Pallala
     
  • This is what we do for the rest of the drivers, saves some bytes.

    Plus a small style change while at it.

    Signed-off-by: Anton Vorontsov

    Anton Vorontsov
     
  • This patch adds suspend/resume methods to the driver.

    In suspend method irq line is disabled to avoid i2c
    read/write errors from the interrupt handler as the
    i2c bus itself could be in suspend state.
    In resume function irq line will be re-enabled.

    Signed-off-by: Ramakrishna Pallala
    Signed-off-by: Anton Vorontsov

    Ramakrishna Pallala
     
  • This patch fixes driver's remove function: it should free the IRQ.

    Signed-off-by: Ramakrishna Pallala
    Signed-off-by: Anton Vorontsov

    Ramakrishna Pallala
     
  • There are a couple issues here caused by confusion between sizeof()
    and ARRAY_SIZE(). "table_size" should be the number of elements, but we
    should allocate it with kcalloc() so that we allocate the correct number
    of bytes.

    In max17042_init_model() we don't allocate enough space so we go past
    the end of the array in max17042_read_model_data() and
    max17042_model_data_compare().

    In max17042_verify_model_lock() we allocate the right amount of space
    but we call max17042_read_model_data() with the wrong number of elements
    and also in the for loop we go past the end of the array.

    Signed-off-by: Dan Carpenter
    Acked-by: Dirk Brandewie
    Signed-off-by: Anton Vorontsov

    Dan Carpenter
     

09 Apr, 2012

1 commit


06 Apr, 2012

1 commit


31 Mar, 2012

1 commit

  • Pull battery updates from Anton Vorontsov:
    "Various small bugfixes and enhancements, plus two new drivers:
    - A quite complex ab8500 charger driver, submitted by Arun Murthy @
    ST-Ericsson;
    - Summit Microelectronics SMB347 Battery Charger, submitted by Bruce
    E Robertson and Alan Cox @ Intel.

    And that's all."

    * tag 'for-v3.4-rc1' of git://git.infradead.org/battery-2.6: (36 commits)
    max17042_battery: Clean up interrupt handling
    Revert "max8998_charger: Include linux/module.h just once"
    ab8500_fg: Fix some build warnings on x86_64
    max17042_battery: Fix CHARGE_FULL representation.
    max8998_charger: Include linux/module.h just once
    power_supply: Convert i2c drivers to module_i2c_driver
    lp8727_charger: Add MODULE_DEVICE_TABLE
    charger-manager: Simplify charger_get_property(), get rid of a warning
    charger-manager: Clean up for better readability
    da9052-battery: Convert to use module_platform_driver
    da9052-battery: Fix a memory leak when unload the module
    da9052-battery: Add missing platform_set_drvdata
    ab8500: Turn unneeded global symbols into local ones
    ab8500_fg: Fix copy-paste error
    ab8500_fg: Get rid of 'struct battery_type'
    ab8500_fg: Get rid of 'struct v_to_cap'
    ab8500_btemp: Get rid of 'enum adc_therm'
    ab8500_charger: Convert to the new USB OTG calls
    ab8500-btemp: AB8500 battery temperature driver
    ab8500-fg: A8500 fuel gauge driver
    ...

    Linus Torvalds
     

27 Mar, 2012

8 commits

  • Max17042 driver has dummy hardIRQ function which
    does nothing but waking the threaded handler.

    This patch removes the hardIRQ function and also
    modifies the interrupt type to falling edge. While
    we are there, change the macros to comply with the
    Data sheet.

    Signed-off-by: Ramakrishna Pallala
    Signed-off-by: Anton Vorontsov

    Ramakrishna Pallala
     
  • This reverts commit 0c7b5558ecc0a508bb7199776afbf18279595539.

    linux-next has the following patch:

    - - - -
    commit 13ae246db4a02971ef4f557af1f6d3e21d64b710
    Author: Paul Gortmaker
    Date: Sun Jan 29 15:44:45 2012 -0500

    includecheck: delete any duplicate instances of module.h
    - - - -

    It removes the other instance of include/module.h in this
    driver, and so both gets removed. This makes max8998 driver
    non-buildable.

    Signed-off-by: Anton Vorontsov

    Anton Vorontsov
     
  • Noticed the following warnings:

    CC drivers/power/ab8500_fg.o
    drivers/power/ab8500_fg.c: In function 'charge_full_store':
    drivers/power/ab8500_fg.c:2258:2: warning: format '%d' expects argument of type 'int', but argument 4 has type 'ssize_t' [-Wformat]
    drivers/power/ab8500_fg.c: In function ‘charge_now_store’:
    drivers/power/ab8500_fg.c:2280:2: warning: format '%d' expects argument of type 'int', but argument 4 has type 'ssize_t' [-Wformat]

    This patch fixes the issues.

    Signed-off-by: Anton Vorontsov

    Anton Vorontsov
     
  • CHARGE_FULL should represent the full capacity of the battery in uAh.
    The 0x10 (FullCAP) register shows the compensated full capacity in
    mAh * 2; e.g., reg(0x10) = 0xBB8 means that it is 1500mAh.

    Signed-off-by: MyungJoo Ham
    Signed-off-by: Anton Vorontsov

    MyungJoo Ham
     
  • Remove the duplicate.

    Signed-off-by: Jesper Juhl
    Acked-by: MyungJoo Ham
    Signed-off-by: Anton Vorontsov

    Jesper Juhl
     
  • Factor out some boilerplate code for i2c driver registration
    into module_i2c_driver.

    Signed-off-by: Axel Lin
    Cc: Woogyom Kim
    Cc: Daniel Jeong
    Cc: Minkyu Kang
    Cc: Peter Edwards
    Acked-by: Milo(Woogyom) Kim
    Acked-by: Rhyland Klein
    Acked-by: Ryan Mallon
    Signed-off-by: Anton Vorontsov

    Axel Lin
     
  • Add MODULE_DEVICE_TABLE to setup modalias for lp8727. Allows auto
    modprobing.

    Signed-off-by: Axel Lin
    Signed-off-by: Anton Vorontsov

    Axel Lin
     
  • This patch fixes the following warning and makes the code a little
    bit more simpler:

    CC drivers/power/charger-manager.o
    charger-manager.c: In function 'charger_get_property':
    charger-manager.c:429:15: warning: 'i' may be used uninitialized in this function [-Wuninitialized]

    Signed-off-by: Anton Vorontsov

    Anton Vorontsov