21 Sep, 2016

1 commit

  • There where still a few lingering references to pdata after commit
    power: supply: sbs-battery: simplify DT parsing.

    Remove pdata from struct·sbs_info and conditional checks to ser if this
    was set from the i2c read / write functions.
    Instead of call max in each function for incrementing poll_retry_count
    do it once in the probe function.
    Fixup null pointer dereference in to pdata in sbs_external_power_changed.
    Change retry counts to u32 to avoid need for max.

    Signed-off-by: Phil Reid
    Signed-off-by: Sebastian Reichel

    Phil Reid
     

20 Sep, 2016

1 commit

  • According to the Smart Battery Data Specification, the use
    of ManufacturerAcess (register 0x0) is implementation-defined.
    It appears that some batteries use writes to this register
    in order to implement certain functionality, but others may
    simply NAK all writes to it. As a result, write failures to
    ManufacturerAccess should not be used as an indicator of
    battery presence, nor as a failure to enter sleep mode.

    The failed write access was seen with SANYO AP13J3K.

    Cc: Brian Norris
    Signed-off-by: Guenter Roeck
    Signed-off-by: Sebastian Reichel

    Guenter Roeck
     

07 Sep, 2016

1 commit

  • After the change to use the gpio descriptor interface, we get a warning if
    -Wmaybe-uninitialized is added back to the build flags (it is currently
    disabled:

    drivers/power/supply/sbs-battery.c: In function 'sbs_probe':
    drivers/power/supply/sbs-battery.c:760:28: error: 'pdata' may be used uninitialized in this function [-Werror=maybe-uninitialized]

    The problem is that if neither the DT properties nor a platform_data
    pointer are provided, the chip->pdata pointer gets set to an uninitialized
    value.

    Looking at the code some more, I found that the sbs_of_populate_pdata
    function is more complex than necessary and has confusing calling
    conventions of possibly returning a valid pointer, a NULL pointer
    or an ERR_PTR pointer (in addition to the uninitialized pointer).

    To fix all of that, this gets rid of the chip->pdata pointer and
    simply moves the two integers into the sbs_info structure. This
    makes it much clearer from reading sbs_probe() what the precedence
    of the three possible values are (pdata, DT, hardcoded defaults)
    and completely avoids the #ifdef CONFIG_OF guards as
    of_property_read_u32() gets replaced with a compile-time stub
    when that is disabled, and returns an error if passed a NULL of_node
    pointer.

    Signed-off-by: Arnd Bergmann
    Fixes: 3b5dd3a49496 ("power: supply: sbs-battery: Use gpio_desc and sleeping calls for battery detect")
    Signed-off-by: Sebastian Reichel

    Arnd Bergmann
     

01 Sep, 2016

1 commit

  • Switch to using new gpio_desc interface and devm gpio get calls to
    automatically manage gpio resource. Use gpiod_get_value which handles
    active high / low calls.

    If gpio_detect is set then force loading of the driver as it is
    reasonable to assume that the battery may not be present.

    Update the is_present flag immediately in the IRQ.

    Remove legacy gpio specification from platform data.

    Signed-off-by: Phil Reid
    Signed-off-by: Sebastian Reichel

    Phil Reid
     

16 Aug, 2016

4 commits


11 Aug, 2016

1 commit