13 May, 2017

1 commit

  • Pull more power-supply updates from Sebastian Reichel:
    "The power-supply subsystem has a few more changes for the v4.12 merge
    window:

    - New battery driver for AXP20X and AXP22X PMICs

    - Improve max17042_battery for usage on x86

    - Misc small cleanups & fixes"

    * tag 'for-v4.12-2' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (34 commits)
    power: supply: cpcap-charger: Keep trickle charger bits disabled
    power: supply: cpcap-charger: Fix enable for 3.8V charge setting
    power: supply: cpcap-charger: Fix charge voltage configuration
    power: supply: cpcap-charger: Fix charger name
    power: supply: twl4030-charger: make twl4030_bci_property_is_writeable static
    power: supply: sbs-battery: Add alert callback
    mailmap: add Sebastian Reichel
    power: supply: avoid unused twl4030-madc.h
    power: supply: sbs-battery: Correct supply status with current draw
    power: supply: sbs-battery: Don't ignore the first external power change
    power: supply: pda_power: move from timer to delayed_work
    power: supply: max17042_battery: Add support for the SCOPE property
    power: supply: max17042_battery: Add support for the CHARGE_NOW property
    power: supply: max17042_battery: Add support for the CHARGE_FULL_DESIGN property
    power: supply: max17042_battery: mAh readings depend on r_sns value
    power: supply: max17042_battery: Add support for the VOLT_MIN property
    power: supply: max17042_battery: Add support for the TECHNOLOGY attribute
    power: supply: max17042_battery: Add external_power_changed callback
    power: supply: max17042_battery: Add support for the STATUS property
    power: supply: max17042_battery: Add default platform_data fallback data
    ...

    Linus Torvalds
     

04 May, 2017

5 commits

  • Android does not seem to set the trickle charger bits, and these
    seem to be only used by the bootloader when bringing up a
    completely discharged battery. So let's keep the trickle charging
    bits disabled and avoid misconfiguring the hardware.

    Fixes: 0c9888e3c192 ("power: supply: cpcap-charger: Add minimal
    CPCAP PMIC battery charger")
    Cc: Marcel Partap
    Cc: Michael Scott
    Signed-off-by: Tony Lindgren
    Signed-off-by: Sebastian Reichel

    Tony Lindgren
     
  • Zero is a valid register value for for 3.8V charging.

    Fixes: 0c9888e3c192 ("power: supply: cpcap-charger: Add minimal
    CPCAP PMIC battery charger")
    Cc: Marcel Partap
    Cc: Michael Scott
    Signed-off-by: Tony Lindgren
    Signed-off-by: Sebastian Reichel

    Tony Lindgren
     
  • We have the charge voltage wrong, it should be 4.35V instead of 4.2V.
    This will cause the battery to never get fully charged.

    I noticed this when looking at the Andoid kernel battery and charger
    status for a fully charged battery:

    POWER_SUPPLY_VOLTAGE_NOW=4351000

    Also the battery on droid 4 says "4.35, 1735/1785mAh (min/typ),
    6.6/6.8 Wh (min/typ)". Presumably the 4.35 on the battery is the
    charge voltage.

    And finally, on Android the CPCAP CRM register is set to 0x03b5 where
    the b is the charge voltage.

    Let's fix the charge voltage define and update the charge configuration
    to use the 4.35V setting.

    Fixes: 0c9888e3c192 ("power: supply: cpcap-charger: Add minimal
    CPCAP PMIC battery charger")
    Cc: Marcel Partap
    Cc: Michael Scott
    Signed-off-by: Tony Lindgren
    Signed-off-by: Sebastian Reichel

    Tony Lindgren
     
  • I noticed we have a different name from what Android is using.
    Let's not break the /sys/class/power user space interface here
    and use the same naming as Android has.

    On Android we have the following for droid 4:

    $ ls /sys/class/power_supply/
    ac battery usb

    So let's use the usb naming here for charger too.

    Fixes: 0c9888e3c192 ("power: supply: cpcap-charger: Add minimal
    CPCAP PMIC battery charger")
    Cc: Marcel Partap
    Cc: Michael Scott
    Signed-off-by: Tony Lindgren
    Signed-off-by: Sebastian Reichel

    Tony Lindgren
     
  • The function twl4030_bci_property_is_writeable can be made static
    as it does not need to be in global scope.

    Signed-off-by: Colin Ian King
    Tested-by: "H. Nikolaus Schaller"
    Signed-off-by: Sebastian Reichel

    Sebastian Reichel
     

02 May, 2017

2 commits

  • Pull ACPI updates from Rafael Wysocki:
    "These are some device enumeration code changes, updates of the AC and
    battery drivers to help them avoid attaching to devices that cannot be
    handled by them, new operation region driver for the Intel CHT Whiskey
    Cove PMIC, new sysfs entries for CPPC performance capabilities, a new
    _REV quirk blacklist entry and a couple of assorted minor fixes and
    cleanups.

    Specifics:

    - Update the core device enumeration code to make it more internally
    consistent and robust and drop the force_remove sysfs attribute
    that could be used to tell it to ignore errors on device
    hot-removal which was dangerous in general and no real and still
    relevant use cases for it could be found (Rafael Wysocki, Michal
    Hocko).

    - Make the core device enumeration code use _PXM to associate
    platform devices created by it with specific NUMA nodes (Shanker
    Donthineni).

    - Extend the CPPC library by adding more sysfs entries for
    performance capabilities to it and making it use the lowest
    nonlinear performance parameter (Prashanth Prakash).

    - Make the CPU online more consistent with CPU initialization in the
    ACPI processor driver (Prashanth Prakash).

    - Update the AC and battery drivers to help them avoid attaching to
    devices that cannot be handled by them and update the
    axp288_charger power supply driver to work correctly on ACPI
    systems without the INT3496 device (Hans de Goede).

    - Add an ACPI operation region driver for the Intel CHT Whiskey Cove
    PMIC and update the xpower operation region driver to work without
    IIO which isn't really necessary for it to work (Hans de Goede).

    - Add a new entry for Dell Inspiron 7537 to the _REV quirk blacklist
    (Kai Heng Feng).

    - Make the code in the ACPI video driver easier to follow by adding
    symbols and comments to it (Dmitry Frank).

    - Update ACPI documentation and drop a function that has no users
    from the tables-handling code (Cao jin, Baoquan He)"

    * tag 'acpi-4.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
    ACPI / PMIC: Stop xpower OPRegion handler relying on IIO
    ACPI / PMIC: Add opregion driver for Intel CHT Whiskey Cove PMIC
    ACPI / scan: Avoid enumerating devices more than once
    ACPI / scan: Apply default enumeration to devices with ACPI drivers
    power: supply: axp288_charger: Only wait for INT3496 device if present
    ACPI / AC: Add a blacklist with PMIC ACPI HIDs with a native charger driver
    ACPI / battery: Add a blacklist with PMIC ACPI HIDs with a native battery driver
    ACPI / battery: Fix acpi_battery_exit on acpi_battery_init_async errors
    ACPI / utils: Add new acpi_dev_present helper
    ACPI / video: add comments about subtle cases
    ACPI / video: get rid of magic numbers and use enum instead
    ACPI / doc: linuxized-acpica.txt: fix typos
    ACPI / blacklist: add _REV quirk for Dell Inspiron 7537
    ACPI / tables: Drop acpi_parse_entries() which is not used
    ACPI / CPPC: add sysfs entries for CPPC perf capabilities
    ACPI / CPPC: Read lowest nonlinear perf in cppc_get_perf_caps()
    ACPI / platform: Update platform device NUMA node based on _PXM method
    ACPI / Processor: Drop setup_max_cpus check from acpi_processor_add()
    ACPI / scan: Drop support for force_remove

    Linus Torvalds
     
  • Pull power management updates from Rafael Wysocki:
    "This time the majority of changes go to the cpufreq subsystem (and to
    the intel_pstate driver in particular) and there are some updates in
    the generic power domains framework, cpuidle, tools and a couple of
    other places.

    One thing worth mentioning is that the intel_pstate's sysfs interface
    has been reworked to be more consistent with the general expectations
    of the cpufreq core and less confusing, hopefully for the better.
    Also, we have a new cpufreq driver for Tegra186 and new hardware
    support in intel_pstata and the Mediatek cpufreq driver.

    Apart from that, the AnalyzeSuspend utility for system suspend
    profiling gets a companion called AnalyzeBoot for the analogous
    profiling of system boot and they both go into one place under
    tools/power/pm-graph/.

    The rest is mostly fixes, cleanups and code reorganization.

    Specifics:

    - Rework the intel_pstate driver's sysfs interface to make it more
    straightforward and more intuitive (Rafael Wysocki).

    - Make intel_pstate support all processors which advertise HWP
    (hardware-managed P-states) to the kernel in all operation modes
    and make it use the load-based P-state selection algorithm on a
    wider range of systems in the active mode (Rafael Wysocki).

    - Add cpufreq driver for Tegra186 (Mikko Perttunen).

    - Add support for Gemini Lake SoCs to intel_pstate (David Box).

    - Add support for MT8176 and MT817x to the Mediatek cpufreq driver
    and clean up that driver a bit (Daniel Kurtz).

    - Clean up intel_pstate and optimize it slightly (Rafael Wysocki).

    - Update the schedutil cpufreq governor, mostly to fix a couple of
    issues with it related to specific workloads, and rework its sysfs
    tunable and initialization a bit (Rafael Wysocki, Viresh Kumar).

    - Fix minor issues in the imx6q, dbx500 and qoriq cpufreq drivers
    (Christophe Jaillet, Irina Tirdea, Leonard Crestez, Viresh Kumar,
    YuanTian Tang).

    - Add file patterns for cpufreq DT bindings to MAINTAINERS (Geert
    Uytterhoeven).

    - Add support for "always on" power domains to the genpd (generic
    power domains) framework and clean up that code somewhat (Ulf
    Hansson, Lina Iyer, Viresh Kumar).

    - Fix minor issues in the powernv cpuidle driver and clean it up
    (Anton Blanchard, Gautham Shenoy).

    - Move the AnalyzeSuspend utility under tools/power/pm-graph/ and add
    an analogous boot-profiling utility called AnalyzeBoot to it (Todd
    Brandt).

    - Add rk3328 support to the rockchip-io AVS (Adaptive Voltage
    Scaling) driver (David Wu).

    - Fix minor issues in the cpuidle core, the intel_pstate_tracer
    utility, the devfreq framework and the PM core documentation
    (Chanwoo Choi, Doug Smythies, Johan Hovold, Marcin Nowakowski)"

    * tag 'pm-4.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (56 commits)
    PM / runtime: Document autosuspend-helper side effects
    PM / runtime: Fix autosuspend documentation
    tools: power: pm-graph: Package makefile and man pages
    tools: power: pm-graph: AnalyzeBoot v2.0
    tools: power: pm-graph: AnalyzeSuspend v4.6
    cpufreq: Add Tegra186 cpufreq driver
    cpufreq: imx6q: Fix error handling code
    cpufreq: imx6q: Set max suspend_freq to avoid changes during suspend
    cpufreq: imx6q: Fix handling EPROBE_DEFER from regulator
    cpuidle: powernv: Avoid a branch in the core snooze_loop() loop
    cpuidle: powernv: Don't continually set thread priority in snooze_loop()
    cpuidle: powernv: Don't bounce between low and very low thread priority
    cpuidle: cpuidle-cps: remove unused variable
    tools/power/x86/intel_pstate_tracer: Adjust directory ownership
    cpufreq: schedutil: Use policy-dependent transition delays
    cpufreq: schedutil: Reduce frequencies slower
    PM / devfreq: Move struct devfreq_governor to devfreq directory
    PM / Domains: Ignore domain-idle-states that are not compatible
    cpufreq: intel_pstate: Add support for Gemini Lake
    powernv-cpuidle: Validate DT property array size
    ...

    Linus Torvalds
     

01 May, 2017

27 commits

  • To simplify the sbs-manager code and notification of battery removal
    use the i2c alert callback to notify the sbs-battery driver that an
    event has occurred.

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

    Phil Reid
     
  • Avoid inclusion of unused twl4030-madc.h. This
    will allow twl4030-madc.h to be merged into the
    iio driver.

    Signed-off-by: Sebastian Reichel

    Sebastian Reichel
     
  • The status reported directly by the battery controller is not always
    reliable and should be corrected based on the current draw information.

    This implements such a correction with a dedicated function, called
    where the supply status is retrieved.

    Signed-off-by: Paul Kocialkowski
    Signed-off-by: Sebastian Reichel

    Paul Kocialkowski
     
  • A mechanism to ignore the first external power change notification was
    put in place years ago to ignore the power_supply_register notification.

    However, this doesn't apply to the current situation anymore, as the
    first notification is always the result of a legitimate power change.

    This removes this deprecated mechanism, which puts back the driver's
    state machine to a sane state (an ignored first notification previously
    caused a charging/discharging status inversion).

    Signed-off-by: Paul Kocialkowski
    Signed-off-by: Sebastian Reichel

    Paul Kocialkowski
     
  • This changed is needed to avoid locking problem during
    boot as shown:

    [ 8.824096] Registering SWP/SWPB emulation handler
    [ 8.977294] clock: disabling unused clocks to save power
    [ 9.108154] BUG: sleeping function called from invalid context at kernel_albert/kernel/mutex.c:269
    [ 9.122894] in_atomic(): 1, irqs_disabled(): 0, pid: 1, name: swapper/0
    [ 9.130249] 3 locks held by swapper/0/1:
    [ 9.134613] #0: (&__lockdep_no_validate__){......}, at: [] __driver_attach+0x58/0xa8
    [ 9.144500] #1: (&__lockdep_no_validate__){......}, at: [] __driver_attach+0x68/0xa8
    [ 9.154357] #2: (&polling_timer){......}, at: [] run_timer_softirq+0x108/0x3ec
    [ 9.163726] Backtrace:
    [ 9.166473] [] (dump_backtrace+0x0/0x114) from [] (dump_stack+0x20/0x24)
    [ 9.175811] r6:00203230 r5:0000010d r4:d782e000 r3:60000113
    [ 9.182250] [] (dump_stack+0x0/0x24) from [] (__might_sleep+0x10c/0x128)
    [ 9.191650] [] (__might_sleep+0x0/0x128) from [] (mutex_lock_nested+0x34/0x36c)
    [ 9.201660] r5:c02d5350 r4:d79a0c64
    [ 9.205688] [] (mutex_lock_nested+0x0/0x36c) from [] (regulator_set_current_limit+0x30/0x118)
    [ 9.217071] [] (regulator_set_current_limit+0x0/0x118) from [] (update_charger+0x84/0xc4)
    [ 9.228027] r7:d782fb20 r6:00000101 r5:c1767e94 r4:00000000
    [ 9.234436] [] (update_charger+0x0/0xc4) from [] (psy_changed+0x20/0x48)
    [ 9.243804] r5:d782e000 r4:c1767e94
    [ 9.247802] [] (psy_changed+0x0/0x48) from [] (polling_timer_func+0x84/0xb8)
    [ 9.257537] r4:c1767e94 r3:00000002
    [ 9.261566] [] (polling_timer_func+0x0/0xb8) from [] (run_timer_softirq+0x17c/0x3ec)
    [ 9.272033] r4:c1767eb0 r3:00000000
    [ 9.276062] [] (run_timer_softirq+0x0/0x3ec) from [] (__do_softirq+0xf0/0x298)
    [ 9.286010] [] (__do_softirq+0x0/0x298) from [] (irq_exit+0x98/0xa0)
    [ 9.295013] [] (irq_exit+0x0/0xa0) from [] (handle_IRQ+0x60/0xc0)
    [ 9.303680] r4:c1194e98 r3:c00bc778
    [ 9.307708] [] (handle_IRQ+0x0/0xc0) from [] (gic_handle_irq+0x34/0x68)
    [ 9.316955] r8:000ac383 r7:d782fc3c r6:d782fc08 r5:c11936c4 r4:e0802100
    [ 9.324310] r3:c026ba48
    [ 9.327301] [] (gic_handle_irq+0x0/0x68) from [] (__irq_svc+0x40/0x74)
    [ 9.336456] Exception stack(0xd782fc08 to 0xd782fc50)
    [ 9.342041] fc00: d6e30e6c ac383627 00000000 ac383417 ea19c000 ea200000
    [ 9.351104] fc20: beffffff 00000667 000ac383 d6e30670 d6e3066c d782fc94 d782fbe8 d782fc50
    [ 9.360168] fc40: c026ba48 c001d1f0 00000113 ffffffff

    Fixes: b2998049cfae ("[BATTERY] pda_power platform driver")
    Signed-off-by: Michael Trimarchi
    Signed-off-by: Anthony Brandon
    Signed-off-by: Sebastian Reichel

    Michael Trimarchi
     
  • Add support for the SCOPE property, always return SCOPE_SYSTEM,
    as the max170xx is used for the main battery on all known systems
    with a max170xx.

    Signed-off-by: Hans de Goede
    Reviewed-by: Krzysztof Kozlowski
    Signed-off-by: Sebastian Reichel

    Hans de Goede
     
  • At least upower prefers the more precise charge_now sysfs value over
    capacity and the max17042 has the info, so lets export it.

    Signed-off-by: Hans de Goede
    Reviewed-by: Krzysztof Kozlowski
    Signed-off-by: Sebastian Reichel

    Hans de Goede
     
  • The info is there, lets export it as a property.

    Signed-off-by: Hans de Goede
    Reviewed-by: Krzysztof Kozlowski
    Signed-off-by: Sebastian Reichel

    Hans de Goede
     
  • The PROP_CHARGE_FULL code was hardcoded for the default sense
    resistor of 0.010 Ohm, make it use r_sns which contains the
    actual sense resistor value in micro-Ohms instead.

    Signed-off-by: Hans de Goede
    Reviewed-by: Krzysztof Kozlowski
    Signed-off-by: Sebastian Reichel

    Hans de Goede
     
  • The info is there, so lets export it, like we already do for VOLT_MAX.

    Signed-off-by: Hans de Goede
    Reviewed-by: Krzysztof Kozlowski
    Signed-off-by: Sebastian Reichel

    Hans de Goede
     
  • The max17042 is intended for Li-Ion or Li-Po batteries, add a TECHNOLOGY
    attribute to reflect this. Note this is hardcoded to Li-Ion as there is
    no way to tell the difference, and Lithium-Ion Polymer batteries are
    a sub-family of Lithium-Ion so Li-Ion technically is correct for both.

    Using Li-Ion for both is already done by many drivers and is much
    better then not providing any technology info at all.

    Suggested-by: Wolfgang Wiedmeyer
    Signed-off-by: Hans de Goede
    Reviewed-by: Krzysztof Kozlowski
    Signed-off-by: Sebastian Reichel

    Hans de Goede
     
  • If our supplier changes status, chances are we've changed status too,
    let any listeners know about this.

    Signed-off-by: Hans de Goede
    Reviewed-by: Krzysztof Kozlowski
    Signed-off-by: Sebastian Reichel

    Hans de Goede
     
  • Userspace prefers the driver having a status property over having to guess
    itself. Specifically this will properly make the GNOME3 UI (and likely
    others) properly show discharging / charging / full status, instead
    of always showing discharging as status.

    Note that in the case there is no charger driver supplying the max17042,
    then a status of unknown will get returned. At least upower treats
    this the same as not having a status attribute, so in this case nothing
    changes from a userspace pov.

    Signed-off-by: Hans de Goede
    Reviewed-by: Krzysztof Kozlowski
    Signed-off-by: Sebastian Reichel

    Hans de Goede
     
  • Some x86 machines use a max17047 fuel-gauge and x86 might be missing
    platform_data if not provided by SFI.

    This commit adds default platform_data as fallback option so that the
    driver can work on boards where no platform_data is provided.

    Since not all boards have a thermistor hooked up, set temp_min to 0 and
    change the health checks from temp < temp_min to
    not trigger on such boards (where temp reads 0).

    Signed-off-by: Hans de Goede
    Reviewed-by: Krzysztof Kozlowski
    Signed-off-by: Sebastian Reichel

    Hans de Goede
     
  • The temp alert values are 8-bit 2's complement, so sign-extend them
    before reporting them back to the caller.

    Signed-off-by: Hans de Goede
    Reviewed-by: Krzysztof Kozlowski
    Signed-off-by: Sebastian Reichel

    Hans de Goede
     
  • Use sign_extend32 to sign-extend variables where necessary instead of
    DIY code.

    Signed-off-by: Hans de Goede
    Reviewed-by: Krzysztof Kozlowski
    Signed-off-by: Sebastian Reichel

    Hans de Goede
     
  • trivial fix to spelling mistake in dev_error message.

    Signed-off-by: Colin Ian King
    Signed-off-by: Sebastian Reichel

    Colin Ian King
     
  • When CONFIG_IIO=m and the axp20x_usb_power driver is built-in, we get
    a link time error:

    drivers/power/built-in.o: In function `axp20x_usb_power_get_property':
    undefined reference to `iio_read_channel_processed'
    drivers/power/built-in.o: In function `axp20x_usb_power_probe':
    undefined reference to `devm_iio_channel_get'
    undefined reference to `devm_iio_channel_get'

    This adds the same dependency that we already have for the AC power driver
    to the USB power driver. For consistency, I'm also moving the two closer
    together in the Kconfig file.

    Fixes: 33863c938caa ("power: supply: axp20x_usb_power: use IIO channels when available")
    Signed-off-by: Arnd Bergmann
    Signed-off-by: Sebastian Reichel

    Arnd Bergmann
     
  • Function devm_kzalloc() will return a NULL pointer. However, in function
    isp1704_charger_probe(), the return value of devm_kzalloc() is directly
    used without validation. This may result in a bad memory access bug.

    Fixes: 34a109610e2a ("isp1704_charger: Add DT support")
    Signed-off-by: Pan Bian
    Reviewed-by: Pali Rohár
    Signed-off-by: Sebastian Reichel

    Pan Bian
     
  • Replace ifdefs with SIMPLE_DEV_PM_OPS helper macro.

    Signed-off-by: Rahul Bedarkar
    Signed-off-by: Sebastian Reichel

    Rahul Bedarkar
     
  • Since we use the default primary handler for the irq, IRQF_ONESHOT must
    be set. Otherwise the request fails and the following errors are
    displayed:

    genirq: Threaded irq requested with handler=NULL and !ONESHOT for irq 129
    sbs-battery 0-000b: Failed to request irq: -22

    Signed-off-by: Ryosuke Saito
    Signed-off-by: Sebastian Reichel

    Ryosuke Saito
     
  • The X-Powers AXP20X and AXP22X PMICs can have a battery as power supply.

    This patch adds the battery power supply driver to get various data from
    the PMIC, such as the battery status (charging, discharging, full,
    dead), current max limit, current current, battery capacity (in
    percentage), voltage max and min limits, current voltage and battery
    capacity (in Ah).

    This battery driver uses the AXP20X/AXP22X ADC driver as PMIC data
    provider.

    Signed-off-by: Quentin Schulz
    Acked-by: Jonathan Cameron
    Acked-by: Maxime Ripard
    Acked-by: Chen-Yu Tsai
    Signed-off-by: Sebastian Reichel

    Quentin Schulz
     
  • The driver was registering two classes, bq24190-battery & -charger.
    Because the power supply framework cannot surface features from multiple
    drivers in a single class, a fuel gauge driver would create a third class,
    which some power management utilities cannot see.

    Deprecate the -battery class for future removal and replicate its features
    in -charger. Set /sys/class...-charger/online = pg_stat && !batfet_disable.
    If device_property "omit-battery-class" is set, don't register -battery.

    Cc: Tony Lindgren
    Cc: Hans de Goede
    Signed-off-by: Liam Breck
    Reviewed-by: Hans de Goede
    Signed-off-by: Sebastian Reichel

    Liam Breck
     
  • It is sensible to assume that the hardware actually always has a
    way of charging the battery so when power_supply_am_i_supplied does not
    find any suppliers, that does not mean that there are none, but simply
    that no power_supply-drivers are registered / bound for any suppliers for
    the supply calling power_supply_am_i_supplied.

    At which point a fuel-gauge driver calling power_supply_am_i_supplied()
    cannot determine whether the battery is being charged or not.

    Allow a caller of power_supply_am_i_supplied to differentiate between
    there not being any suppliers, vs no suppliers being online by returning
    -ENODEV if there are no suppliers matching supplied_to / supplied_from,
    which allows fuel-gauge drivers to return POWER_SUPPLY_STATUS_UNKNOWN
    rather then POWER_SUPPLY_STATUS_DISCHARGING if there are no suppliers.

    Signed-off-by: Hans de Goede
    Reviewed-by: Krzysztof Kozlowski
    Signed-off-by: Sebastian Reichel

    Hans de Goede
     
  • We can't assume that the battery is or stays present after probing
    on devices with replaceable battery.

    On some devices (e.g. GTA04 or OpenPanodra) it can be removed
    and even be hot swapped by the user while device continues to operate
    through external AC or USB power (as long as system power consumption
    remains below ca. 500mA as provided by USB). Under certain conditions
    it is possible to boot without battery.

    So it makes no sense to check for this situation during probe and make
    the charger driver (and its status reports) completely non-operational if
    the battery can be inserted later.

    Tested on: GTA04 and OpenPandora.

    Signed-off-by: H. Nikolaus Schaller
    Signed-off-by: Sebastian Reichel

    H. Nikolaus Schaller
     
  • Currently, the twl4030 charger defines its own max_current by directly
    creating sysfs nodes. It should use the input_current_limit property
    which is e.g. used by the bq24257 driver.

    This patch adds the input_current_property with the same semantics as
    the max_current property. The code to manage the max_current property
    is removed by a separate patch.

    Signed-off-by: H. Nikolaus Schaller
    Signed-off-by: Sebastian Reichel

    H. Nikolaus Schaller
     
  • Allow platform-code to disable the reset on probe and suspend/resume
    by setting a "disable-reset" boolean device property on the device.

    There are several reasons why the platform-code may want to disable
    the reset on probe and suspend/resume:

    1) Resetting the charger should never be necessary it should always have
    sane values programmed. If it is running with invalid values while we
    are not running (system turned off or suspended) there is a big problem
    as that may lead to overcharging the battery.

    2) The reset in suspend() is meant to put the charger back into default
    mode, but this is not necessary and not a good idea. If the charger has
    been programmed with a higher max charge_current / charge_voltage then
    putting it back in default-mode will reset those to the safe power-on
    defaults, leading to slower charging, or charging to a lower voltage
    (and thus not using the full capacity) while suspended which is
    undesirable. Reprogramming the max charge_current / charge_voltage
    after the reset will not help here as that will put the charger back
    in host mode and start the i2c watchdog if the host then does not do
    anything for 40s (iow if we're suspended for more then 40s) the watchdog
    expires resetting the device to default-mode, including resetting all
    the registers to there safe power-on defaults. So the only way to keep
    using custom charge settings while suspending is to keep the charger in
    its normal running state with the i2c watchdog disabled. This is fine
    as the charger will still automatically switch from constant current
    to constant voltage and stop charging when the battery is full.

    3) Besides never being necessary resetting the charger also causes
    problems on systems where the charge voltage limit is set higher then the
    reset value, if this is the case and the charger is reset while charging
    and the battery voltage is between the 2 voltages, then about half the
    time the charger gets confused and claims to be charging (REG08 contains
    0x64) but in reality the charger has decoupled itself from VBUS (Q1 off)
    and is drawing 0A from VBUS, leaving the system running from the battery.

    This last problem is happening on a GPD-win mini PC with a bq24292i
    charger chip combined with a max17047 fuel-gauge and a LiHV battery.
    I've checked and TI does not list any errata for the bq24292i which
    could explain this (there are no errata at all).

    Cc: Liam Breck
    Cc: Tony Lindgren
    Signed-off-by: Hans de Goede
    Acked-by: Liam Breck
    Signed-off-by: Sebastian Reichel

    Hans de Goede
     

20 Apr, 2017

1 commit

  • On some devices with an axp288 pmic setting vbus path based on the
    id-pin is handled by an ACPI _AIE interrupt on the gpio and the
    INT3496 device is disabled.

    Instead of returning -EPROBE_DEFER on these devices waiting for the
    never to show up INT3496 device, check for its presence and only
    request and monitor the matching extcon if the device is there,
    otherwise let the firmware handle the vbus path control.

    Signed-off-by: Hans de Goede
    Acked-by: Sebastian Reichel
    Signed-off-by: Rafael J. Wysocki

    Hans de Goede
     

14 Apr, 2017

4 commits