09 Jun, 2017
1 commit
-
The touchscreen driver, max11801, which is on 12c2 bus, won't be probed
when using the hdcp specific DTS (this is disabling 12c2, since it
will acquire it for DDC communications). Since this driver won't be
probed, it will spam the dmesg with the pr_err from max11801_read_adc()
function. This function is periodically called by the battery driver. For
this reason, I removed the pr_err() call.
Also, to be noticed that the function signature is u32, but in case of an
error it will return a negative integer. In order to correctly propagate
errors, I changed the function signature to int. This is safe, since the
read value from i2c is on 16 bits (MSB and LSB on 8 bits).Also, the function calibration_voltage is calling max11801_read_adc from
touchscreen driverm which can return negative values in case of an
error. I case of an error, just stop reading ADC data and return 0 as
voltage_data.Signed-off-by: Robert Chiras
08 Jun, 2017
3 commits
-
Charger interrupt can't be caught anymore after plug in DC 5V in/out dozens of
times, that caused by VBUS_I or CHG_I pending interrupt not cleared in time. The root
cause is VBUS_I and CHG_I will be triggered in very narrow window, and VBUS_I/CHG_I
act as the sub-interrupt of charger and share the same interrupt handler. Thus if CHG_I
interrupt status is coming while VBUS_I handler is running, CHG_I interrupt status will
never be cleared, since interrupt has been disabled in ISR. The unclear CHG_I interrupt
status make pf1550 never trigger next interrupt again. So clear all charger interrupt
status in ISR to workaround instead of ack for every sub-intterrupt.Signed-off-by: Robin Gong
-
remove useless DPMI interrupt in pf1550 charger.
Signed-off-by: Robin Gong
-
Add basic pf1550 charger driver.
Signed-off-by: Robin Gong
23 Feb, 2017
3 commits
-
cherry-pick below patch:
ENGR00288351 sabresd_battery: fix usb charger detect when resume back on mx6sl
Fix below redundant log after first resume back on mx6slevk:
max8903-charger max8903.12: USB Charger ConnectedIt's caused by not add enough prepare for uok&dok which are connected, such as
i.MX6SL-EVK. In this case the board only support DC charger detect, so we
didn't need judge the uok pin for USB charger detect, although uok share with
dok pin.Signed-off-by: Robin Gong
(cherry picked from commit c5ba4940a72e8124db7ef91a67b337df4e45e3b0)
(cherry picked from commit bcd7f8e5e19528abfc1c095049b55b3d409b27af) -
cherry-pick below patch:
ENGR00277663-3 power: sabresd_battery: remove check charger offset on mx6slevk
No need check the charger offset on mx6slevk, since there is no adc converter
Signed-off-by: Robin Gong
(cherry picked from commit 7683c62cf2290629f09983744d5a3987a4d64669)
(cherry picked from commit 5f29715585ae82a435aa5ba0fe6393a53c10f87d) -
cherry-pick below patch:
ENGR00275004-4: power: sabresd_battery: add sabresd_battery driverAdd sabresd battery driver which based on Max8903 charger IC.
Signed-off-by: Robin Gong
(cherry picked from commit 19ac2dfcd1e0ea3f1ae231cfc230315eaa9a41be)
(cherry picked from commit b9e81012c21d3318a633a4447797e4a52676c760)
20 Jan, 2017
2 commits
-
commit 3bee9ea1de687925d116670f036599cbed8b66b0 upstream.
The BQ27510 and BQ27520 use a slightly different register map than the
BQ27500, add a new type enum and add these gauges to it.Fixes: d74534c27775 ("power: bq27xxx_battery: Add support for additional bq27xxx family devices")
Based-on-patch-by: Kenneth R. Crudup
Signed-off-by: Andrew F. Davis
Signed-off-by: Sebastian Reichel
Signed-off-by: Greg Kroah-Hartman -
commit 075eb5719d53e8bb4a406ad87e1de99319aa50f0 upstream.
There's a typo, it should do pm_runtime_get_sync, not put.
Fixes: d7bf353fd0aa3 ("bq24190_charger: Add support for TI BQ24190 Battery Charger")
Cc: Mark A. Greer
Signed-off-by: Tony Lindgren
Reviewed-by: Mark Greer
Signed-off-by: Sebastian Reichel
Signed-off-by: Greg Kroah-Hartman
07 Oct, 2016
1 commit
-
Pull power supply and reset updates from Sebastian Reichel:
- move power supply drivers to drivers/power/supply
- unify location of power supply DT documentation
- tps65217-charger: IRQ support
- act8945a-charger: misc. cleanups & improvements
- sbs-battery cleanup
- fix users of deprecated create_singlethread_workqueue()
- misc fixes.* tag 'for-v4.9' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (46 commits)
power: supply: bq27xxx_battery: allow kernel poll_interval parameter runtime update
power: supply: sbs-battery: Cleanup removal of chip->pdata
power: reset: st: Remove obsolete platforms from dt doc
power: reset: st-poweroff: Remove obsolete platforms.
power: reset: zx-reboot: Unmap region obtained by of_iomap
power: reset: xgene-reboot: Unmap region obtained by of_iomap
power: supply: ab8500: cleanup with list_first_entry_or_null()
power: reset: add in missing white space in error message text
sbs-battery: make writes to ManufacturerAccess optional
power: bq24257: Fix use of uninitialized pointer bq->charger
power: supply: sbs-battery: simplify DT parsing
power: supply: bq24735-charger: Request status GPIO with initial input setup
power: supply: sbs-battery: Use gpio_desc and sleeping calls for battery detect
power: supply: act8945a_charger: Add max current property
power: supply: act8945a_charger: Add capacity level property
doc: bindings: power: act8945a-charger: Update properties.
power: supply: act8945a_charger: Fix the power supply type
power: supply: act8945a_charger: Add status change update support
power: supply: act8945a_charger: Improve state handling
power: supply: act8945a_charger: Remove "battery_temperature"
...
21 Sep, 2016
2 commits
-
Fix issue with poll_interval being not updated till the previous
interval expired.Cc: Tony Lindgren
Cc: Liam Breck
Signed-off-by: Matt Ranostay
Signed-off-by: Sebastian Reichel -
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
20 Sep, 2016
7 commits
-
This patch removes support for STiH415/6 SoC's from the
st-poweroff driver, as support for these platforms is
being removed from the kernel.Signed-off-by: Peter Griffin
Cc:
Signed-off-by: Sebastian Reichel -
Free memory mapping, if probe is not successful.
Signed-off-by: Arvind Yadav
Signed-off-by: Sebastian Reichel -
Free memory mapping, if probe is not successful.
Signed-off-by: Arvind Yadav
Signed-off-by: Sebastian Reichel -
The combo of list_empty() check and return list_first_entry()
can be replaced with list_first_entry_or_null().Signed-off-by: Masahiro Yamada
Signed-off-by: Sebastian Reichel -
A dev_err message spans two lines and the literal string is missing
a white space between words. Add the white space.Signed-off-by: Colin Ian King
Signed-off-by: Sebastian Reichel -
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 -
bq->charger is initialized in bq24257_power_supply_init.
Therefore, bq24257_power_supply_init should be called before the
registration of the IRQ handler bq24257_irq_handler_thread that calls
power_supply_changed(bq->charger).Signed-off-by: Georges Savoundararadj
Cc: Aurelien Chanot
Cc: Andreas Dannenberg
Cc: Sebastian Reichel
Cc: David Woodhouse
Fixes: 2219a935963e ("power_supply: Add TI BQ24257 charger driver")
Signed-off-by: Sebastian Reichel
13 Sep, 2016
1 commit
-
Use a more common logging style.
Miscellanea:
o Use pr_warn
o Coalesce formats adding missing spaces
o Argument alignment
o Remove unnecessary OOM messages as k.alloc does stack dumpsSigned-off-by: Joe Perches
Acked-by: Nishanth Menon
[khilman: update shortlog]
Signed-off-by: Kevin Hilman
Signed-off-by: Rafael J. Wysocki
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
05 Sep, 2016
1 commit
-
This requests the status GPIO with initial input setup. It is required
to read the GPIO status at probe time and thus correctly avoid sending
I2C messages when AC is not plugged.When requesting the GPIO without initial input setup, it always reads 0
which causes probe to fail as it assumes the charger is connected, sends
I2C messages and fails.While at it, this switches the driver over to gpiod API.
Signed-off-by: Paul Kocialkowski
Signed-off-by: Sebastian Reichel
01 Sep, 2016
3 commits
-
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 -
Add the power supply's current max property,
POWER_SUPPLY_PROP_CURRENT_MAX.Signed-off-by: Wenyou Yang
Signed-off-by: Sebastian Reichel -
Add the power supply capacity level property, it corresponds to
POWER_SUPPLY_CAPACITY_LEVEL_*.It also utilizes the precision voltage detector function module
to catch the low battery voltage.Signed-off-by: Wenyou Yang
Signed-off-by: Sebastian Reichel
31 Aug, 2016
5 commits
-
The power supply type property is varying as the external power
supply changes. It is not a constant.Signed-off-by: Wenyou Yang
Signed-off-by: Sebastian Reichel -
Add the charger status change interrupt support, it will report
the power supply changed event.This interrupt is generated by one of the conditions as below:
- the state machine jumps out of or into the EOC state
- the CHGIN input voltage goes out of or into the valid range.
- the battery temperature goes out of or into the valid range.
- the PRECHARGE time-out occurs.
- the total charge time-out occurs.Signed-off-by: Wenyou Yang
Signed-off-by: Sebastian Reichel -
When get the property, first check the charger state machine,
then check the status bit to decide what value is assigned to
the corresponding property.Retain the SUSCHG bit of REG 0x71 when configure the timers to
avoid losting the charger suspending info after boot.Signed-off-by: Wenyou Yang
Signed-off-by: Fengguang Wu
Signed-off-by: Sebastian Reichel -
Remove "battery_temperature" member, it is redundant, it is the
hardware's responsibility to handle TH pin properly.
It is unnecessary to use the dt property to check if there is
a battery temperature monitor or not.Signed-off-by: Wenyou Yang
Signed-off-by: Sebastian Reichel -
Since the act8945a_charger is regarded as a sub-device, all properties will
be assigned to its own device node. All properties can be achieved from its
own node, instead of from its parent device.Signed-off-by: Wenyou Yang
Signed-off-by: Sebastian Reichel
29 Aug, 2016
1 commit
-
When the charger is missing (disconnected), it is safe to assume that
the charger chip is no charging.This is especially relevant when a status GPIO is present and the
charger is getting disconnected. bq24735_charger_is_charging will be
triggered due to the interrupt then, it will attempt to read whether it
is charging through i2c, which will fail as the charger is disconnected.This also fixes that specific issue.
Signed-off-by: Paul Kocialkowski
Signed-off-by: Sebastian Reichel
17 Aug, 2016
1 commit
-
Change my email address to kernel.org instead of Samsung one for the
purpose of any future contact. The copyrights remain untouched and are
attributed to Samsung.Signed-off-by: Krzysztof Kozlowski
Signed-off-by: Sebastian Reichel
16 Aug, 2016
8 commits
-
Power Supply Fixes for 4.8 cycle
-
alloc_ordered_workqueue() with WQ_MEM_RECLAIM set replaces
deprecated create_singlethread_workqueue(). This is the identity
conversion.The workqueue "monitor_wqueue" is used to monitor the battery
status. It has been identity converted.It queues multiple work items viz &di->monitor_work,
&di->set_charged_work, which require execution ordering.
Hence, alloc_workqueue has been used to replace the
deprecated create_singlethread_workqueue instance.WQ_MEM_RECLAIM flag has been set to ensure forward progress under
memory pressure.Signed-off-by: Bhaktipriya Shridhar
Signed-off-by: Sebastian Reichel -
alloc_ordered_workqueue() with WQ_MEM_RECLAIM set replaces
deprecated create_singlethread_workqueue(). This is the identity
conversion.The workqueue "fg_wq" is used for running the FG algorithm periodically.
It has been identity converted.It has multiple work items viz fg_periodic_work, fg_low_bat_work,
fg_reinit_work, fg_work, fg_acc_cur_work and fg_check_hw_failure_work,
which require execution ordering. Hence, a dedicated ordered workqueue
has been used here.The WQ_MEM_RECLAIM flag has been set to guarantee forward progress under
memory pressure.Signed-off-by: Bhaktipriya Shridhar
Signed-off-by: Sebastian Reichel -
The workqueue "wq" is used for handling battery related tasks.
It has a single work item viz &mb->update and hence it doesn't require
execution ordering. Hence, alloc_workqueue has been used to replace the
deprecated create_singlethread_workqueue instance.The WQ_MEM_RECLAIM flag has been set to ensure forward progress under
memory pressure.Since there is a single work item, explicit concurrency
limit is unnecessary here.Signed-off-by: Bhaktipriya Shridhar
Signed-off-by: Sebastian Reichel -
alloc_ordered_workqueue() with WQ_MEM_RECLAIM set replaces
deprecated create_singlethread_workqueue(). This is the identity
conversion.The workqueue "charger_wq" is used for the IRQs and checking HW state of
the charger. It has been identity converted.It has multiple work items viz usb_charger_attached_work, kick_wd_work,
check_vbat_work, check_hw_failure_work, usb_charger_attached_work,
ac_work, ac_charger_attached_work, attach_work and check_usbchgnotok_work,
which require execution ordering. Hence, a dedicated ordered workqueue
has been used here.The WQ_MEM_RECLAIM flag has also been set to ensure
forward progress under memory pressure.Signed-off-by: Bhaktipriya Shridhar
Signed-off-by: Sebastian Reichel -
The workqueue "monitor_wqueue" is used to monitor the PMIC battery status.
It queues a single work item (pbi->monitor_battery) and hence doesn't
require ordering. Hence, alloc_workqueue has been used to replace the
deprecated create_singlethread_workqueue instance.Since PMIC battery status needs to be monitored for any change, the
WQ_MEM_RECLAIM flag has been set to ensure forward progress under memory
pressure.Since there is a single work item, explicit concurrency
limit is unnecessary here.Signed-off-by: Bhaktipriya Shridhar
Signed-off-by: Sebastian Reichel -
alloc_ordered_workqueue() with WQ_MEM_RECLAIM set replaces
deprecated create_singlethread_workqueue(). This is the identity
conversion.The workqueue "charger_wq" is used for running all the charger related
tasks. This involves charger detection, checking for HW failure and HW
status. This workqueue has been identity converted.It queues multiple workitems viz &pm2->check_main_thermal_prot_work,
&pm2->check_hw_failure_work, &pm2->ac_work. Hence, the deprecated
create_singlethread_workqueue() instance has been replaced with a
dedicated ordered workqueue.The WQ_MEM_RECLAIM flag has been set to ensure forward progress under
memory pressure.Signed-off-by: Bhaktipriya Shridhar
Signed-off-by: Sebastian Reichel -
The workqueue "btemp_wq" is used for measuring the temperature
periodically. It queues a single workitem (btemp_periodic_work) and
hence doesn't require ordering. Thus, the deprecated
create_singlethread_workqueue() instance has been replaced with
alloc_workqueue().The WQ_MEM_RECLAIM flag has been set to ensure forward progress under
memory pressure.Since there is a single work item, explicit concurrency
limit is unnecessary here.Signed-off-by: Bhaktipriya Shridhar
Signed-off-by: Sebastian Reichel