- 04 Jan, 2017 40 commits
-
-
Hans de Goede authored
Setting the irq_enable bits is taken care of by the irq chip when we request the irqs and the driver should not be meddling with the irq?_en registers itself. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-
Peter Rosin authored
If there is no ti,ac-detect-gpios configured, it is normal to have failed reads of the options register. So, hold back on the log spamming. Signed-off-by: Peter Rosin <peda@axentia.se> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-
Peter Rosin authored
It is possible to verify AC adapter presence via a register read, without any physical connection to the ACOK pin on the charger. Allow this. Signed-off-by: Peter Rosin <peda@axentia.se> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-
Hans de Goede authored
Prior to this commit the code was using 1 notifier_block for all types of charger cable, this is incorrect as the notifier_block becomes part of a linked-list and now the same notifier_block is part of 3 linked lists. This commit fixes this by using a separate nb per extcon cable. Note this happened to work fine sofar because axp288_charger was the only listener, so when added to each of the 3 notifier chains, the next pointer in the nb would be set to 0, so we've 3 heads pointing to the same nb, with its next pointing to NULL. But as soon as we mix in a second extcon consumer things will go boom. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-
Hans de Goede authored
Add a MODULE_DEVICE_TABLE to fix the module not auto-loading. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-
Hans de Goede authored
Setting the irq_enable bits is taken care of by the irq chip when we request the irqs and the driver should not be meddling with the irq?_en registers itself. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-
Hans de Goede authored
To set a bit to 1 one needs to pass the mask for the bit to set as second argument into regmap_update_bits, not "1". Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-
Hans de Goede authored
Do not wait for an extcon notification before processing the cable states, instead queue the otg / cable work on probe to make sure we immediately process the initial hardware state. Note this also requiree moving the getting of the USB_HOST cable state from the extcon notifier to the workqueue function. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-
Hans de Goede authored
Remove info->health, info->present and info->online caching, as no code is reading the cached values. Remove if (changed) check before calling power_supply_changed(), we return early from axp288_charger_extcon_evt_worker if nothing has changed, so the check is not needed. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-
Hans de Goede authored
Deal with the charger type changing without a vbus-disconnect being reported in between the 2 charger type states: -Do not return from axp288_charger_extcon_evt_worker early in this case (track old_chg_type) -Make calling axp288_charger_enable_charger with the same value as before a nop, to avoid the need for the caller to check this -Do no do a dev_err when axp288_charger_enable_charger returns an error, axp288_charger_enable_charger already returns an error itself -Disable the charger before changing the charge-current setting (nop if vbus was seen as disconnected before the change) Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-
Hans de Goede authored
Nothing was setting info->otg.cable, so the extcon_get_cable_state_ calls on it would always return -EINVAL. This commit fixes this by actually setting info->otg.cable using the new extcon_get_extcon_dev_by_cable_id function. This commit also makes failing to register the extcon notifier for the USB_HOST cable an error rather then a warning, because we MUST have this notfier to properly disable the VBUS path when in host mode so that we're not drawing current from the 5V boost converter which is supplying power to the otg port when in host mode. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-
Hans de Goede authored
Move the charger_init_hw_regs() above the power_supply_register call, the axp288_charger_usb_set_property() uses axp288_chrg_info.max_cv and .max_cc which get set by charger_init_hw_regs(). Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-
Hans de Goede authored
The extcon notifier work calls power_supply_changed on the power_supply we register, so the extcon notifiers should be registered after we register the power_supply. While touching this code anyways, refactor the code for the 3 cable types into a loop to avoid code repetition. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-
Hans de Goede authored
Use devm_power_supply_register instead of power_supply_register, this avoids the need to do manual cleanup and results in quite a nice code cleanup. Note it may seem excessive to add a "struct device *dev" helper local variable for the 1 time it is used in this patch, but future patches in this series also use it. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-
Sebastian Reichel authored
-
Nicolas Saenz Julienne authored
This adds support for sbs-charger compilant chips as defined here: http://sbs-forum.org/specs/sbc110.pdf This was tested on a arm board connected to an LTC4100 battery charger chip. Signed-off-by: Nicolas Saenz Julienne <nicolas.saenz@prodys.net> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-
Nicolas Saenz Julienne authored
Adds device tree documentation for SBS charger compilant devices as defined here: http://sbs-forum.org/specs/sbc110.pdfSigned-off-by: Nicolas Saenz Julienne <nicolas.saenz@prodys.net> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-
Peter Rosin authored
So what if there is a status_gpio specified? bq24735_charger_is_present() do have a working fallback for the case of no status_gpio. Simplify this by not special casing setups w/o status_gpio, folding two consecutive if-blocks in the process. Signed-off-by: Peter Rosin <peda@axentia.se> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-
Peter Rosin authored
During probe, it makes no sense to take care to first not issue any i2c commands to verify if the connected part really is a bq24735, to later simply fail the probe in the next step when trying to configure the charger. So, delay configuration of the charging parameters until the charger is accessible (i.e. when the AC adapter is present) as part of enabling the charging. This also fixes the rather serious issue that the charging parameters are lost when the AC adapter is disconnected. Signed-off-by: Peter Rosin <peda@axentia.se> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-
Peter Rosin authored
bq24735_enable_charging() needs to call bq24735_config_charging(), which is something to change later, this is just a preparatory patch. Signed-off-by: Peter Rosin <peda@axentia.se> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-
Milo Kim authored
"tps65217-charger" is more appropriate name because the driver supports not only AC but also USB charger. Signed-off-by: Milo Kim <woogyom.kim@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-
Milo Kim authored
Rename it as tps65217_charger_get_property(). Signed-off-by: Milo Kim <woogyom.kim@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-
Milo Kim authored
Replace 'ac_props' with 'charger_props'. Signed-off-by: Milo Kim <woogyom.kim@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-
Milo Kim authored
Replace 'ac' of tps65217_charger structure with 'psy'. Signed-off-by: Milo Kim <woogyom.kim@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-
Milo Kim authored
This driver supports AC and USB chargers. Generic name is preferred. Replace 'ac_online' with 'online'. Signed-off-by: Milo Kim <woogyom.kim@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-
Milo Kim authored
TPS65217 has two charger interrupts - AC and USB power status change. Interrupt number in the TPS65217 driver data: IRQ number is only used on requesting the interrupt, so no need to keep it inside the driver data. Interrupt handler: Check not only AC but also USB charger status. In both cases, enable charging operation. Interrupt request: If an interrupt number is invalid, then use legacy polling thread. Otherwise, create IRQ threads to handle AC and USB charger event. Signed-off-by: Milo Kim <woogyom.kim@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-
Milo Kim authored
Use the task_struct variable for running polling thread. If polling task is activated, then use it to stop running thread. This is a preceding step of supporting two interrupts of TPS65217 charger, so checking single IRQ number is not appropriate when the module is removed. Signed-off-by: Milo Kim <woogyom.kim@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-
Chanwoo Choi authored
This patch replaces the deprecated extcon API as following: - extcon_set_cable_state_() -> extcon_set_state_sync() Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-
Chanwoo Choi authored
This patch uses the resource-managed extcon API for extcon_register_notifier() and replaces the deprecated extcon API as following: - extcon_get_cable_state_() -> extcon_get_state() Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-
Srikant Ritolia authored
Use managed resource function devm_power_supply_register instead of power_supply_register to simplify the error path by allowing unregistering to happen automatically on error and remove. Removing max8997_battery_remove function also as it is now redundant. Also removing out of memory printk message after kzalloc as there is already enough information on failure. Signed-off-by: Srikant Ritolia <s.ritolia@samsung.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-
Quentin Schulz authored
The X-Powers AXP223 shares most of its behaviour with the AXP221 PMIC but allows the VBUS power supply max current to be set to 100mA (like the AXP209 PMIC). This basically adds a new compatible to the VBUS power supply driver and adds a check on the compatible when setting current max limit. Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com> Acked-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-
Quentin Schulz authored
This adds the "x-powers,axp223-usb-power-supply" to the list of compatibles for AXP20X VBUS power supply driver. Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Acked-by: Rob Herring <robh@kernel.org> Acked-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-
Quentin Schulz authored
AXP20X and AXP22X PMICs allow setting the min voltage and max current of VBUS power supply. This adds entries in sysfs to allow to do so. Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com> Acked-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-
Quentin Schulz authored
This replaces calls to of_device_is_compatible to check data field of of_device_id matched when probing the driver. Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com> Acked-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-
Peter Rosin authored
If the ac-detect gpio does not support interrupts, provide a fallback to poll the gpio at a configurable interval. Signed-off-by: Peter Rosin <peda@axentia.se> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-
Hans de Goede authored
In order for the MSB -> LSB latching to work correctly we must read the 2 8 bit registers of a 12 bit value in one consecutive read. This fixes voltage_ocv reporting inconsistent values on my tablet. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-
Hans de Goede authored
In order for the MSB -> LSB latching to work correctly we must read the 2 8 bit registers of a 15 bit value in one consecutive read. This fixes charge_full reporting 3498768 on some reads and 3354624 one other reads on my tablet (for the 3354624 value the raw LSB is 0x00). Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-
Hans de Goede authored
If reading the register fails, return the actual error code, instead of the uninitialized val variable; Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-
Peter Rosin authored
The ACOK pin on the bq24735 is active-high, of course meaning that when AC is OK the pin is high. However, all Tegra dts files have incorrectly specified active-high even though the signal is inverted on the Tegra boards. This has worked since the Linux driver has also inverted the meaning of the GPIO. Fix this situation by simply specifying in the bindings what everybody else agrees on; that the ti,ac-detect-gpios is active on AC adapter absence. Signed-off-by: Peter Rosin <peda@axentia.se> Acked-by: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-
Peter Rosin authored
Providing value bits outside of the mask is pointless. Signed-off-by: Peter Rosin <peda@axentia.se> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-