1. 01 May, 2017 7 commits
    • Quentin Schulz's avatar
      power: supply: add battery driver for AXP20X and AXP22X PMICs · 46c202b5
      Quentin Schulz authored
      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: default avatarQuentin Schulz <quentin.schulz@free-electrons.com>
      Acked-by: default avatarJonathan Cameron <jic23@kernel.org>
      Acked-by: default avatarMaxime Ripard <maxime.ripard@free-electrons.com>
      Acked-by: default avatarChen-Yu Tsai <wens@csie.org>
      Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.co.uk>
      46c202b5
    • Quentin Schulz's avatar
      dt-bindings: power: supply: add AXP20X/AXP22X battery DT binding · 7221675c
      Quentin Schulz authored
      The X-Powers AXP20X and AXP22X PMICs can have a battery as power supply.
      
      This patch adds the DT binding documentation for the battery power
      supply which gets 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).
      Signed-off-by: default avatarQuentin Schulz <quentin.schulz@free-electrons.com>
      Acked-by: default avatarChen-Yu Tsai <wens@csie.org>
      Acked-by: default avatarMaxime Ripard <maxime.ripard@free-electrons.com>
      Acked-by: default avatarRob Herring <robh@kernel.org>
      Acked-by: default avatarChen-Yu Tsai <wens@csie.org>
      Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.co.uk>
      7221675c
    • Liam Breck's avatar
      power: supply: bq24190_charger: Deprecate battery class and replicate its features in charger · 1eb2869b
      Liam Breck authored
      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 <tony@atomide.com>
      Cc: Hans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarLiam Breck <kernel@networkimprov.net>
      Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.co.uk>
      1eb2869b
    • Hans de Goede's avatar
      power: supply: Make power_supply_am_i_supplied return -ENODEV if there are no suppliers · 2848e039
      Hans de Goede authored
      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: default avatarHans de Goede <hdegoede@redhat.com>
      Reviewed-by: default avatarKrzysztof Kozlowski <krzk@kernel.org>
      Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.co.uk>
      2848e039
    • H. Nikolaus Schaller's avatar
      power: supply: twl4030-charger: don't check if battery is present · 19a2ee69
      H. Nikolaus Schaller authored
      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: default avatarH. Nikolaus Schaller <hns@goldelico.com>
      Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.co.uk>
      19a2ee69
    • H. Nikolaus Schaller's avatar
      power: supply: twl4030-charger: add writable INPUT_CURRENT_LIMIT property · 3fb319c2
      H. Nikolaus Schaller authored
      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: default avatarH. Nikolaus Schaller <hns@goldelico.com>
      Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.co.uk>
      3fb319c2
    • Hans de Goede's avatar
      power: supply: bq24190_charger: Add disable-reset device-property · 6cf62a3b
      Hans de Goede authored
      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 <kernel@networkimprov.net>
      Cc: Tony Lindgren <tony@atomide.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Acked-by: default avatarLiam Breck <kernel@networkimprov.net>
      Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.co.uk>
      6cf62a3b
  2. 13 Apr, 2017 29 commits
  3. 04 Apr, 2017 1 commit
    • Chanwoo Choi's avatar
      extcon: Add new extcon_register_notifier_all() to monitor all external connectors · 815429b3
      Chanwoo Choi authored
      The extcon core already provides the extcon_register_notifier() function
      in order to register the notifier block which is used to monitor
      the state change for the specific external connector such as EXTCON_USB,
      EXTCON_USB_HOST and so on. The extcon consumer uses the this function.
      
      The extcon consumer might need to monitor the all supported external
      connectors from the extcon device. In this case, The extcon consumer
      should have each notifier_block structure for each external connector.
      
      This patch adds the new extcon_register_notifier_all() function
      that extcon consumer is able to monitor the state change of all
      supported external connectors by using only one notifier_block structure.
      
      - List of new added functions:
      int extcon_register_notifier_all(struct extcon_dev *edev,
      			struct notifier_block *nb);
      int extcon_unregister_notifier_all(struct extcon_dev *edev,
      			struct notifier_block *nb);
      int devm_extcon_register_notifier_all(struct device *dev,
      			struct extcon_dev *edev, struct notifier_block *nb);
      void devm_extcon_unregister_notifier_all(struct device *dev,
      			struct extcon_dev *edev, struct notifier_block *nb);
      Suggested-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarChanwoo Choi <cw00.choi@samsung.com>
      Tested-by: default avatarHans de Goede <hdegoede@redhat.com>
      Acked-by: default avatarHans de Goede <hdegoede@redhat.com>
      815429b3
  4. 26 Mar, 2017 3 commits
    • Linus Torvalds's avatar
      Linux 4.11-rc4 · c02ed2e7
      Linus Torvalds authored
      c02ed2e7
    • Linus Torvalds's avatar
      Merge tag 'char-misc-4.11-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc · 0dc82fa5
      Linus Torvalds authored
      Pull char/misc driver fixes from Greg KH:
       "A smattering of different small fixes for some random driver
        subsystems. Nothing all that major, just resolutions for reported
        issues and bugs.
      
        All have been in linux-next with no reported issues"
      
      * tag 'char-misc-4.11-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (21 commits)
        extcon: int3496: Set the id pin to direction-input if necessary
        extcon: int3496: Use gpiod_get instead of gpiod_get_index
        extcon: int3496: Add dependency on X86 as it's Intel specific
        extcon: int3496: Add GPIO ACPI mapping table
        extcon: int3496: Rename GPIO pins in accordance with binding
        vmw_vmci: handle the return value from pci_alloc_irq_vectors correctly
        ppdev: fix registering same device name
        parport: fix attempt to write duplicate procfiles
        auxdisplay: img-ascii-lcd: add missing sentinel entry in img_ascii_lcd_matches
        Drivers: hv: vmbus: Don't leak memory when a channel is rescinded
        Drivers: hv: vmbus: Don't leak channel ids
        Drivers: hv: util: don't forget to init host_ts.lock
        Drivers: hv: util: move waiting for release to hv_utils_transport itself
        vmbus: remove hv_event_tasklet_disable/enable
        vmbus: use rcu for per-cpu channel list
        mei: don't wait for os version message reply
        mei: fix deadlock on mei reset
        intel_th: pci: Add Gemini Lake support
        intel_th: pci: Add Denverton SOC support
        intel_th: Don't leak module refcount on failure to activate
        ...
      0dc82fa5
    • Linus Torvalds's avatar
      Merge tag 'driver-core-4.11-rc4' of... · 9e54ef9d
      Linus Torvalds authored
      Merge tag 'driver-core-4.11-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
      
      Pull driver core fix from Greg KH:
       "Here is a single kernfs fix for 4.11-rc4 that resolves a reported
        issue.
      
        It has been in linux-next with no reported issues"
      
      * tag 'driver-core-4.11-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
        kernfs: Check KERNFS_HAS_RELEASE before calling kernfs_release_file()
      9e54ef9d