14 Jan, 2016
1 commit
-
Currently in bq27541 driver, the average power register address is
incorrectly set to 0x76, which would result in an error:
bq27xxx-battery 2-0055: error reading average power register 10: -11
According to the bq27541 datasheet, fix this problem by setting
the average power register address to 0x24.Fixes: d74534c27775 ("power: bq27xxx_battery: Add support for additional bq27xxx family devices")
Signed-off-by: Liu Xiang
Acked-by: Andrew F. Davis
Signed-off-by: Sebastian Reichel
08 Jan, 2016
1 commit
-
Writing 0 length data into test_power makes it access an invalid array
location and kill the system.Fixes: f17ef9b2d ("power: Make test_power driver more dynamic.")
Signed-off-by: Sasha Levin
Signed-off-by: Sebastian Reichel
07 Jan, 2016
4 commits
-
Use to_delayed_work() instead of open-coding it.
Signed-off-by: Geliang Tang
Signed-off-by: Sebastian Reichel -
All calls to isp1704_write() are using parameter sequence of
isp1704_write(isp, reg, val) but the function is defined as
isp1704_write(isp, val, reg). Fix isp1704_write function definition so
that the driver to be functional.Signed-off-by: Ivaylo Dimitrov
Reviewed-by: Pali Rohár
Signed-off-by: Sebastian Reichel -
bug: according to data sheet some register numbers are wrong.
tested: no
Fixes: d74534c27775 ("power: bq27xxx_battery: Add support for additional bq27xxx family devices")
Signed-off-by: H. Nikolaus Schaller
Acked-by: Andrew F. Davis
Signed-off-by: Sebastian Reichel -
bug: the driver reports funny capacity values:
root@letux:/sys/class/power_supply/bq27000-battery# cat uevent
POWER_SUPPLY_NAME=bq27000-battery
POWER_SUPPLY_STATUS=Charging
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_VOLTAGE_NOW=3702000
POWER_SUPPLY_CURRENT_NOW=-464635
POWER_SUPPLY_CAPACITY=1536
Acked-by: Andrew F. Davis
Reviewed-by: Pali Rohár
Signed-off-by: Sebastian Reichel
08 Dec, 2015
1 commit
-
Currently the reset/power off handlers (POWER_RESET) and Adaptive Voltage
Scaling class (POWER_AVS) are not built when POWER_SUPPLY is disabled.
The POWER_RESET is also not visible in drivers main section of config.However they do not really depend on power supply so they can be built
always. The objects for power supply drivers already depend on
particular Kconfig symbols so there is no need for any changes in
drivers/power/Makefile.This allows selecting POWER_RESET from main drivers config section and
fixes following build warning (encountered on ARM exynos defconfig when
POWER_SUPPLY is disabled manually):warning: (ARCH_HISI && ARCH_INTEGRATOR && ARCH_EXYNOS && ARCH_VEXPRESS && REALVIEW_DT) selects POWER_RESET which has unmet direct dependencies (POWER_SUPPLY)
warning: (ARCH_EXYNOS) selects POWER_RESET_SYSCON which has unmet direct dependencies (POWER_SUPPLY && POWER_RESET && OF)
warning: (ARCH_EXYNOS) selects POWER_RESET_SYSCON_POWEROFF which has unmet direct dependencies (POWER_SUPPLY && POWER_RESET && OF)Reported-by: Pavel Fedin
Signed-off-by: Krzysztof Kozlowski
Signed-off-by: Sebastian Reichel
05 Dec, 2015
6 commits
-
Separate out I2C functionality into a module. This fixes several small
issues and simplifies the driver initialization.Signed-off-by: Andrew F. Davis
Signed-off-by: Sebastian Reichel -
Print message that battery is not calibrated only once
to avoid spamming the log.Suggested-By: H. Nikolaus Schaller
Suggested-By: Pali Rohár
Signed-off-by: Sebastian Reichel -
If no primary handler is specified for threaded_irq then a
default one is assigned which always returns IRQ_WAKE_THREAD.
This handler requires the IRQF_ONESHOT, because the source of
interrupt is not disabled.Signed-off-by: Saurabh Sengar
Signed-off-by: Sebastian Reichel -
for_each_matching_node performs an of_node_get on each iteration, so
a break out of the loop requires an of_node_put.A simplified version of the semantic patch that fixes this problem is as
follows (http://coccinelle.lip6.fr)://
@@
expression e,e1;
local idexpression np;
@@for_each_matching_node(np, e1) {
... when != of_node_put(np)
when != e = np
(
return np;
|
+ of_node_put(np);
? return ...;
)
...
}
//Signed-off-by: Julia Lawall
Signed-off-by: Sebastian Reichel -
The ds278x_battery_ops structure is never modified, so declare it as const.
Done with the help of Coccinelle.
Signed-off-by: Julia Lawall
Signed-off-by: Sebastian Reichel -
The of_node_put() function tests whether its argument is NULL and then
returns immediately. Thus the test around the calls is not needed.This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring
Acked-by: Pali Rohár
Signed-off-by: Sebastian Reichel
07 Nov, 2015
1 commit
-
Pull MFD updates from Lee Jones:
"New Device Support:
- Add support for 88pm860; 88pm80x
- Add support for 24c08 EEPROM; at24
- Add support for Broxton Whiskey Cove; intel*
- Add support for RTS522A; rts5227
- Add support for I2C devices; intel_quark_i2c_gpioNew Functionality:
- Add microphone support; arizona
- Add general purpose switch support; arizona
- Add fuel-gauge support; da9150-core
- Add shutdown support; sec-core
- Add charger support; tps65217
- Add flexible serial communication unit support; atmel-flexcom
- Add power button support; axp20x
- Add led-flash support; rt5033Core Frameworks:
- Supply a generic macro for defining Regmap IRQs
- Rework ACPI child device matchingFix-ups:
- Use Regmap to access registers; tps6105x
- Use DEFINE_RES_IRQ_NAMED() macro; da9150
- Re-arrange device registration order; intel_quark_i2c_gpio
- Allow OF matching; cros_ec_i2c, atmel-hlcdc, hi6421-pmic, max8997, sm501
- Handle deferred probe; twl6040
- Improve accuracy of headphone detect; arizona
- Unnecessary MODULE_ALIAS() removal; bcm590xx, rt5033
- Remove unused code; htc-i2cpld, arizona, pcf50633-irq, sec-core
- Simplify code; kempld, rts5209, da903x, lm3533, da9052, arizona
- Remove #iffery; arizona
- DT binding adaptions; manyBug Fixes:
- Fix possible NULL pointer dereference; wm831x, tps6105x
- Fix 64bit bug; intel_soc_pmic_bxtwc
- Fix signedness issue; arizona"* tag 'mfd-for-linus-4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (73 commits)
bindings: mfd: s2mps11: Add documentation for s2mps15 PMIC
mfd: sec-core: Remove unused s2mpu02-rtc and s2mpu02-clk children
extcon: arizona: Add extcon specific device tree binding document
MAINTAINERS: Add binding docs for Cirrus Logic/Wolfson Arizona devices
mfd: arizona: Remove bindings covered in new subsystem specific docs
mfd: rt5033: Add RT5033 Flash led sub device
mfd: lpss: Add Intel Broxton PCI IDs
mfd: lpss: Add Broxton ACPI IDs
mfd: arizona: Signedness bug in arizona_runtime_suspend()
mfd: axp20x: Add a cell for the power button part of the, axp288 PMICs
mfd: dt-bindings: Document pulled down WRSTBI pin on S2MPS1X
mfd: sec-core: Disable buck voltage reset on watchdog falling edge
mfd: sec-core: Dump PMIC revision to find out the HW
mfd: arizona: Use correct type ID for device tree config
mfd: arizona: Remove use of codec build config #ifdefs
mfd: arizona: Simplify adding subdevices
mfd: arizona: Downgrade type mismatch messages to dev_warn
mfd: arizona: Factor out checking of jack detection state
mfd: arizona: Factor out DCVDD isolation control
mfd: Make TPS6105X select REGMAP_I2C
...
06 Nov, 2015
1 commit
-
Pull power supply and reset updates from Sebastian Reichel:
- new AXP20X USB Power driver
- new Qualcomm SMBB driver
- new TPS65217 Charger driver
- BQ24257: add BQ24250/BQ24251 support
- overhaul bq27x00 battery driver, rename to bq27xxx
- misc fixes and cleanups* tag 'for-v4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (54 commits)
power: bq27xxx_battery: Remove unneeded dependency in Kconfig
power: bq27xxx_battery: move irq handler to i2c section
power: bq27xxx_battery: fix platform probe
twl4030_charger: add missing iio dependency
power_supply: charger-manager: add missing of_node_put
Documentation: power: bq24257: Document exported sysfs entries
power: bq24257: Add various device-specific sysfs properties
power: bq24257: Allow input current limit sysfs access
power: bq24257: Add input DPM voltage threshold setting support
power: bq24257: Add over voltage protection setting support
power: bq24257: Add SW-based approach for Power Good determination
power: bq24257: Allow manual setting of input current limit
power: bq24257: Add bit definition for temp sense enable
power: bq24257: Add basic support for bq24250/bq24251
dt: power: bq24257-charger: Cover additional devices
power: bq24257: Simplify bq24257_power_supply_init()
power: bq24257: Use managed power supply register
power: bq24257: Streamline input current limit setup
power: bq24257: Remove IRQ config through stat-gpios
power: bq27xxx_battery: fix signedness bug in bq27xxx_battery_read_health()
...
19 Oct, 2015
3 commits
-
I2C is only required when using the config item BATTERY_BQ27XXX_I2C which
already depends on the I2C subsystem, remove the unneeded dependency from
BATTERY_BQ27XXX.Signed-off-by: Andrew F. Davis
Acked-by: Pali Rohár
Signed-off-by: Sebastian Reichel -
The IRQ handler is not used by the platform based
code resulting in a 'defined but not used' warning,
if CONFIG_BQ27XXX_I2C is not enabled.Signed-off-by: Sebastian Reichel
Acked-by: Pali Rohár
Acked-by: Andrew F. Davis -
Add missing initialization of register mapping table to
platform probe function.Signed-off-by: Sebastian Reichel
Acked-by: Pali Rohár
Acked-by: Andrew F. Davis
16 Oct, 2015
1 commit
-
This driver fails to link without CONFIG_IIO, since
there are no stubs for the iio_channels functions.Signed-off-by: Sebastian Reichel
Acked-by: Marek Belisko
Acked-by: Nikolaus Schaller
15 Oct, 2015
1 commit
-
for_each_child_of_node performs an of_node_get on each iteration, so
a break out of the loop requires an of_node_put.The semantic patch that fixes this problem is as follows
(http://coccinelle.lip6.fr)://
@@
expression root,e;
local idexpression child;
@@for_each_child_of_node(root, child) {
... when != of_node_put(child)
when != e = child
(
return child;
|
+ of_node_put(child);
? return ...;
)
...
}
//Signed-off-by: Julia Lawall
Reviewed-by: Krzysztof Kozlowski
Signed-off-by: Sebastian Reichel
14 Oct, 2015
1 commit
-
This platform driver has a OF device ID table but the OF module
alias information is not created so module autoloading won't work.Signed-off-by: Luis de Bethencourt
Reviewed-by: Heiko Stuebner
Acked-by: Kevin Hilman
Signed-off-by: Rafael J. Wysocki
13 Oct, 2015
1 commit
-
This adds power supply driver support for the Fuel-Gauge part of
the DA9150 combined Charger and Fuel-Gauge device.Signed-off-by: Adam Thomson
Acked-by: Sebastian Reichel
Signed-off-by: Lee Jones
29 Sep, 2015
13 commits
-
This patch adds support for enabling/disabling optional device specific
features through sysfs properties at runtime.* High-impedance mode enable/disable
* Sysoff enable/disableRefer to the respective device datasheets for more information:
http://www.ti.com/product/bq24250
http://www.ti.com/product/bq24251
http://www.ti.com/product/bq24257Signed-off-by: Andreas Dannenberg
Reviewed-by: Krzysztof Kozlowski
Signed-off-by: Sebastian Reichel -
This patch allows reading and writing of the input current limit through
the power supply's input_current_limit sysfs property. This allows
userspace to see what charger was detected (if the D+/D- USB signal-
based charger type detection is enabled) and to re-configure the maximum
current drawn from the external supply at runtime based on system-level
knowledge or user input. Note that upon charger disconnection and
re-connection the limit configured through firmware becomes active again
(or the D+/D- USB signal-based charger detection will be run again).Signed-off-by: Andreas Dannenberg
Reviewed-by: Krzysztof Kozlowski
Signed-off-by: Sebastian Reichel -
A new optional device property called "ti,in-dpm-voltage" is introduced
to allow configuring the input voltage threshold for the devices'
dynamic power path management (DPM) feature. In short, it can be used to
prevent the input voltage from dropping below a certain value as current
is drawn to charge the battery or supply the system.Signed-off-by: Andreas Dannenberg
Reviewed-by: Laurentiu Palcu
Reviewed-by: Krzysztof Kozlowski
Signed-off-by: Sebastian Reichel -
A new optional device property called "ti,ovp-voltage" is introduced to
allow configuring the input over voltage protection setting.This commit also adds the basic sysfs support for custom properties
which is being used to allow userspace to read the current ovp-voltage
setting.Signed-off-by: Andreas Dannenberg
Reviewed-by: Laurentiu Palcu
Reviewed-by: Krzysztof Kozlowski
Signed-off-by: Sebastian Reichel -
A software-based approach for determining the charger's input voltage
"Power Good" state is introduced for devices like the bq24250 which
don't have a dedicated hardware pin for that purpose. This SW-based
approach is also used for other devices (with dedicated PG pin) as a
fall back solution if that pin is not configured to be used through
"pg-gpios".Signed-off-by: Andreas Dannenberg
Reviewed-by: Krzysztof Kozlowski
Signed-off-by: Sebastian Reichel -
A new optional device property called "ti,current-limit" is introduced
to allow disabling the D+/D- USB signal-based charger type auto-
detection algorithm used to set the input current limit and instead to
use a fixed input current limit.Signed-off-by: Andreas Dannenberg
Reviewed-by: Krzysztof Kozlowski
Signed-off-by: Sebastian Reichel -
Adding a missing bit definition for the sake of consistency device model
vs. bit field representation. No change in functionality.Signed-off-by: Andreas Dannenberg
Reviewed-by: Laurentiu Palcu
Signed-off-by: Sebastian Reichel -
This patch adds basic support for bq24250 and bq24251 which are very
similar to the bq24257 the driver was originally written for. Basic
support means the ability to select a device through Kconfig, DT and
ACPI, an instance variable allowing to check which chip is active, and
the reporting back of the selected device through the model_name power
supply sysfs property.This patch by itself is not sufficient to actually use those two added
devices in a real-world setting due to some feature differences which
are addressed by other patches in this series.Signed-off-by: Andreas Dannenberg
Reviewed-by: Krzysztof Kozlowski
Signed-off-by: Sebastian Reichel -
Eliminate a few lines of code by using the PTR_ERR_OR_ZERO() macro.
Signed-off-by: Andreas Dannenberg
Reviewed-by: Krzysztof Kozlowski
Signed-off-by: Sebastian Reichel -
Use the devm_* managed version of the function to register the power
supply and remove the associated unregister function. This will simplify
error handling moving forward as it allows the unregister to happen
automatically. It also saves a few lines of code.As this changes the order of putting the bq24257 into reset vs.
unregistering the power-supply during driver remove re-tested various
driver unload scenario to make sure that this doesn't cause any
unintended side effects such as erroneous interrupts.Signed-off-by: Andreas Dannenberg
Reviewed-by: Krzysztof Kozlowski
Signed-off-by: Sebastian Reichel -
The maximum amount of input current the charger should draw is dependent
on the power supply and should only be (re-)configured when the power
supply gets connected and disconnected. However the driver was also
lowering the bq24257's input current limit setting to 500mA when the
battery was removed and restored the previous setting according to the
power supply capabilities when the battery was reconnected although
these events are not impacting the amount of power that can be drawn
from the supply. Furthermore, a re-configuration of the input current
limit to 500mA when the battery gets disconnected is actually dangerous
if the limit was set higher previously and the system draws more than
500mA in which case the system voltage would be reduced in order to
maintain 500mA which could result in the system getting too low of a
supply to maintain operation. Last but not least the mechanism itself
used for battery re-connection detection did not work in corner cases
such as when the device's input current loop becomes active and the
bq24257 device clears its battery fault error resulting in incorrectly
reporting that the battery got reconnected.This patches removes the impact the battery removal/insertion has on the
input current limit configured for the bq24257 and simplifies the
associated handler routine.Signed-off-by: Andreas Dannenberg
Signed-off-by: Sebastian Reichel -
At the time the driver was written GpioInt resources in ACPI were not
passed to the driver in client->irq, as opposed to DT enumeration. To
accommodate this use case, a "stat-gpios" property was introduced to
allow configuring the IRQ.However this issue with ACPI was fixed in commit "845c877 i2c / ACPI:
Assign IRQ for devices that have GpioInt automatically" and makes this
workaround no longer necessary, hence we can remove the support for the
"stat-gpios" property and the associated code from the bq24257 driver.Signed-off-by: Andreas Dannenberg
Signed-off-by: Sebastian Reichel -
We need flags to be signed for the error handling to work.
The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci [1].[1]: http://permalink.gmane.org/gmane.linux.kernel/2038576
Fixes: 74aab849f342 ('power: bq27xxx_battery: Cleanup health checking')
Signed-off-by: Andrzej Hajda
Signed-off-by: Dan Carpenter
Acked-By: Pali Rohár
Acked-by: Andrew F. Davis
Signed-off-by: Sebastian Reichel
27 Sep, 2015
2 commits
-
If either twl4030_charger or twl4030_madc is configured as MODULE,
we get build (link) errors.To solve, the direct call of twl4030_get_madc_conversion() is replaced
by a call to iio_read_channel_processed().Signed-off-by: H. Nikolaus Schaller
Signed-off-by: Marek Belisko
Signed-off-by: Sebastian Reichel -
Since commit 1c6c69525b40 ("genirq: Reject bogus threaded irq requests")
threaded IRQs without a primary handler need to be requested with
IRQF_ONESHOT, otherwise the request will fail.scripts/coccinelle/misc/irqf_oneshot.cocci detected this issue.
Fixes: b5874f33bbaf ("wm831x_power: Use genirq")
Signed-off-by: Valentin Rothberg
Signed-off-by: Sebastian Reichel
25 Sep, 2015
2 commits
-
This patch adds support for the tps65217 charger driver. This driver is
responsible for controlling the charger aspect of the tps65217 mfd.
Currently, this mainly consists of turning on and off the charger, but
some other features of the charger can be supported through this driver.Signed-off-by: Enric Balletbo i Serra
Signed-off-by: Sebastian Reichel -
"state" is a bool so it's never less than zero. The intent was to test
"ret" instead.Fixes: 56d7df8716b2 ('power: Add Qualcomm SMBB driver')
Signed-off-by: Dan Carpenter
Signed-off-by: Sebastian Reichel
24 Sep, 2015
1 commit
-
Commit b68c3161430a (bq2415x_charger: Allow to load and use driver even if
notify device is not registered yet) introduced null pointer dereference in
case bq is NULL. This patch fixes it.Fixes: b68c3161430a ("bq2415x_charger: Allow to load and use driver even if notify device is not registered yet")
Reported-by: Dan Carpenter
Signed-off-by: Pali Rohár
Signed-off-by: Sebastian Reichel