Age | Commit message (Collapse) | Author | Files | Lines |
|
Add 'polling_ms' sysfs node to change charger-manager's monitoring rate
in runtime. It can set only bigger than 2 jiffies (for 200 HZ system it
is 10 msecs.) as it's allowed for minimum poling rate in previous.
It resets poller and re-configure polling rate based on new input if next
polling time is far enough. Otherwise, it just waits expiration of timer
and new polling rate will affects the next scheduling.
Change-Id: I6a9a07b96db2554e2ec047224df818dcc4ab1a17
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
|
|
Add additional polling mode for sleep state to define different mode with
normal state. With this change, charger-manager can work differently in
normal state or sleep state. e.g, polling aways for normal and polling
only when charing for sleep. If there is no defined polling mode for
sleep state it just follows the normal state's.
In addition to, polling rate is still same in sleep.
Change-Id: I787a3abd646bdc0be81dccbafbd635c22c84951c
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
|
|
No information about actual meaning of using 19 bits, it's just copied
from vendor's code. However, It is clear that it represents doubled SoC
if the chip is marked with 'using 19 bits'. Rinato needs to half the SoC
register's value to get correct one.
Change-Id: I0d873de3e7671c2494955735364934156ab756d9
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
|
|
Even max17040 fuelgauge chip's registers are segmented in size of 8bits
(MSB, LSB), it transfers data only in 16bits. So, it should read both of
MSB, LSB registers at once.
Change-Id: I87150fbf9b14adf65fc9fdf912f963ab591586e3
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
|
|
In current code, charger-manager may attemps to read battery state more
than once in a same period. And it already did such when user accesses
uevent, it reads battery voltage several times.
This patch makes charger-manager to read current battery state including
SoC, voltage and temperature at the start of monitoring and re-use it
during whole period.
Change-Id: Ic69ddb465a75237ded0488cb3eb41f47bb909311
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
|
|
This patch prevents direct charging control in cable notification.
It sets only input current limit according to cable type and yields charging
control to be done by cm_monitor() where charging management proceeds.
It may loose few ms to enable charging compared to before, even though it's
more important that charging is enabled only for safe context.
Change-Id: Ic736b9d18829f6d6dab946515dd0fe62fe7b75c4
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
|
|
In cm_monitor() where charging management starts, it checks various charging
condition sequentially to decide next charging operation. However, as it
follows sequential process, cascade if statements, it does some duplicated
jobs which is already done in previous stage. It results delay in decision
making. And moreover, starting point of charing is spreaded all around, so
it makes maintain codes and debugging difficult.
Both of problems mentioned above becomes clean if it manages battery charging
with focusing battery status not following sequential condition checking.
Now, cm_monitor() moves battery state diagram and does optimal operation for
current state. As a result, it reduces whole monitoring time almost in half.
Change-Id: I1c8cfe57cea6fc8c02a4c0bf7bde6a0d8395b786
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
|
|
When charger-manager checks whether external power source is available,
it gets information from charger IC driver. However, it's not correct source,
charger IC doesn't have responsibilty to give cable connection status.
The charger-manager already gets cable information from EXTCON susbsystem,
so it can re-use it.
Change-Id: I408546beefe63707fcb927db7d92c4005f3848f8
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
|
|
Current charger-manager calls power_suuply_changed() whenever charging
status is changed. This patch removes seperated power_supply_changed()
use and let it be called at end of try_charger_enable() function which
is called to set charging/discharging.
Change-Id: I98c823268207a891fba9d38dc71692e2e0791ae7
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
|
|
It shows '1' even for none-typed cable that might mislead user or
charging managment to understand that there is a charge-able cable
which is truly not. It should return 0 for none-typed cable to prevent
wrong attempt for charging.
Change-Id: I851ac424b6895867e611f6786bdb18e540d7f2d4
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
|
|
This is workaround to let userspace notice about battery's status
chaiging during suspend and resume. It holds wakeup event to prevent
system goes into sleep. Holding wakeup event time is heuristic value
and it could be varied.
To make this works, it needs CONFIG_PM_AUTOSLEEP kernel option.
Change-Id: I22a818e69632574a2d684cd957f62b3329d57c8f
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
|
|
When charger-manager sets alarmtimer, it has used nanoseconds converted
from polling period which is in milliseconds. However ktimer's nanoseconds
is limited to represent as size of unsinged long type, and the previous
use often exceeds its limitation. It fixes to divide target timer period
into seconds part and remains in nanoseconds to prevent abnormal timer period
is set.
Change-Id: I7a5cad5569505c901a4822bbd7a4ad0fa149570b
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
|
|
To confirm NULL point exception and also follow the common convention
of 'for loop' control, fix the driver to use scalar variable,
'num_chargers' when it retrieves the power_supply pointer array.
Change-Id: Iab834cf93822b1a03419ca9933e82d6396cc0474
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
|
|
The POWER_SUPPLY_CHARGE_NOW/FULL property reflects battery's charges
in uAh unit, but charger-manager has been used it wrongly. This patch
makes it to use those propeties correctly and change to be optional.
Change-Id: I68b3940a9388a095f47205207f1bc6bc863bd407
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
|
|
Whenever battery status is changed, charger manager tries to trigger uevent
through private interface. This patch modifies it to use power_supply_changed()
since it belongs to power supply subsystem.
Change-Id: I9f25664a2196745f3a303d57ded073f5eb604180
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
|
|
cm_notify_event() is introduced to get event associated with battery status
externally, but no one had been used. Moreover it makes charger manager
driver more complicated. This patch tries to drop the function and all data
related to simplify the driver.
Change-Id: I89d802f57a3005c9102e8d342318f2bf77ccce48
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
|
|
Monitoring battery temperature becomes mandatory for charger manager working.
If there is no way to measure temperature, it stops probing and won't work.
And also it will use thermal susbsystem inteface only to make driver simple.
Change-Id: Idef5f8f29a104f5f51532c3321f6bebe887deb24
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
|
|
To guerantee proper charing and managing batteries even in suspend,
charger-manager has used rtc device with rtc framework interface.
However, it is better to use alarmtimer for cleaner and more appropriate
operation.
This patch makes driver to use alamtimer for polling work in suspend and
removes all deprecated codes related with using rtc interface.
Change-Id: I0c84ccd62653b50fc9c9b687fddcaba7ea58e8ca
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
|
|
Drop all local commits and adjust it to up-to-date version of mainline
to make it easy to maintain.
Change-Id: Id5dc3314afd6498e704bcc1bdebe2c226b8fa07c
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
|
|
Currently, all the power supply devices are registered with wakeup source,
this results in that every power_supply_changed() invocation brings
the system out of suspend-to-freeze state.
This is overkill as some device drivers, e.g. ACPI battery driver,
have the ability to check the device status and wake up the system
from sleeping only when necessary.
Thus introduce a new API which allows device to be registered
w/o wakeup source.
Change-Id: If0ea9720c9c2161e3a33db0988bcd464b79f2b91
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
|
|
Add method to get power supply by device tree phandle.
Change-Id: I486cb12098d96a0c0b1a930b194dd899fb5a61c8
Signed-off-by: Sebastian Reichel <sre@debian.org>
Reviewed-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
|
|
This patch adds a notifier chain to the power_supply, this helps drivers
in other subsystem to listen to changes in power supply subsystem.
This would help to take some actions in those drivers on changing the
power supply properties. One such scenario is to increase/decrease system
performance based on the battery capacity/voltage. Another scenario is to
adjust the h/w peak current detection voltage/current thresholds based on
battery voltage/capacity. The notifier helps drivers to listen to changes
in power_suppy susbystem without polling the power_supply properties
Change-Id: I06d5b614d1ad836826f87f24791c94d2fa6c4aa6
Signed-off-by: Jenny TC <jenny.tc@intel.com>
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Acked-by: Jenny TC <jenny.tc@intel.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
|
|
power_supply_register() calls device_init_wakeup() to register a wakeup
source before initializing dev_name. As a result, device_wakeup_enable()
end up registering wakeup source with a null name when
wakeup_source_register() gets called with dev_name(dev) which is null at
the time.
When kernel is booted with wakeup_source_activate enabled, it will panic
when the trace point code tries to dereference ws->name.
Fixed the problem by moving up the kobject_set_name() call prior to
accesses to dev_name(). Replaced kobject_set_name() with dev_set_name()
which is the right interface to be called from drivers. Fixed the call to
device_del() prior to device_add() in for wakeup_init_failed error
handling code.
Trace after the change:
bash-2143 [003] d... 132.280697: wakeup_source_activate: BAT1 state=0x20001
kworker/3:2-1169 [003] d... 132.281305: wakeup_source_deactivate: BAT1 state=0x30000
Oops message:
[ 819.769934] device: 'BAT1': device_add
[ 819.770078] PM: Adding info for No Bus:BAT1
[ 819.770235] BUG: unable to handle kernel NULL pointer dereference at (null)
[ 819.770435] IP: [<ffffffff813381c0>] skip_spaces+0x30/0x30
[ 819.770572] PGD 3efd90067 PUD 3eff61067 PMD 0
[ 819.770716] Oops: 0000 [#1] SMP
[ 819.770829] Modules linked in: arc4 iwldvm mac80211 x86_pkg_temp_thermal coretemp kvm_intel joydev i915 kvm uvcvideo ghash_clmulni_intel videobuf2_vmalloc aesni_intel videobuf2_memops videobuf2_core aes_x86_64 ablk_helper cryptd videodev iwlwifi lrw rfcomm gf128mul glue_helper bnep btusb media bluetooth parport_pc hid_generic ppdev snd_hda_codec_hdmi drm_kms_helper snd_hda_codec_realtek cfg80211 drm tpm_infineon samsung_laptop snd_hda_intel usbhid snd_hda_codec hid snd_hwdep snd_pcm microcode snd_page_alloc snd_timer psmouse i2c_algo_bit lpc_ich tpm_tis video wmi mac_hid serio_raw ext2 lp parport r8169 mii
[ 819.771802] CPU: 0 PID: 2167 Comm: bash Not tainted 3.12.0+ #25
[ 819.771876] Hardware name: SAMSUNG ELECTRONICS CO., LTD. 900X3C/900X3D/900X4C/900X4D/SAMSUNG_NP1234567890, BIOS P03AAC 07/12/2012
[ 819.772022] task: ffff88002e6ddcc0 ti: ffff8804015ca000 task.ti: ffff8804015ca000
[ 819.772119] RIP: 0010:[<ffffffff813381c0>] [<ffffffff813381c0>] skip_spaces+0x30/0x30
[ 819.772242] RSP: 0018:ffff8804015cbc70 EFLAGS: 00010046
[ 819.772310] RAX: 0000000000000003 RBX: ffff88040cfd6d40 RCX: 0000000000000018
[ 819.772397] RDX: 0000000000020001 RSI: 0000000000000000 RDI: 0000000000000000
[ 819.772484] RBP: ffff8804015cbcc0 R08: 0000000000000000 R09: ffff8803f0768d40
[ 819.772570] R10: ffffea001033b800 R11: 0000000000000000 R12: ffffffff81c519c0
[ 819.772656] R13: 0000000000020001 R14: 0000000000000000 R15: 0000000000020001
[ 819.772744] FS: 00007ff98309b740(0000) GS:ffff88041f200000(0000) knlGS:0000000000000000
[ 819.772845] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 819.772917] CR2: 0000000000000000 CR3: 00000003f59dc000 CR4: 00000000001407f0
[ 819.773001] Stack:
[ 819.773030] ffffffff81114003 ffff8804015cbcb0 0000000000000000 0000000000000046
[ 819.773146] ffff880409757a18 ffff8803f065a160 0000000000000000 0000000000020001
[ 819.773273] 0000000000000000 0000000000000000 ffff8804015cbce8 ffffffff8143e388
[ 819.773387] Call Trace:
[ 819.773434] [<ffffffff81114003>] ? ftrace_raw_event_wakeup_source+0x43/0xe0
[ 819.773520] [<ffffffff8143e388>] wakeup_source_report_event+0xb8/0xd0
[ 819.773595] [<ffffffff8143e3cd>] __pm_stay_awake+0x2d/0x50
[ 819.773724] [<ffffffff8153395c>] power_supply_changed+0x3c/0x90
[ 819.773795] [<ffffffff8153407c>] power_supply_register+0x18c/0x250
[ 819.773869] [<ffffffff813d8d18>] sysfs_add_battery+0x61/0x7b
[ 819.773935] [<ffffffff813d8d69>] battery_notify+0x37/0x3f
[ 819.774001] [<ffffffff816ccb7c>] notifier_call_chain+0x4c/0x70
[ 819.774071] [<ffffffff81073ded>] __blocking_notifier_call_chain+0x4d/0x70
[ 819.774149] [<ffffffff81073e26>] blocking_notifier_call_chain+0x16/0x20
[ 819.774227] [<ffffffff8109397a>] pm_notifier_call_chain+0x1a/0x40
[ 819.774316] [<ffffffff81095b66>] hibernate+0x66/0x1c0
[ 819.774407] [<ffffffff81093931>] state_store+0x71/0xa0
[ 819.774507] [<ffffffff81331d8f>] kobj_attr_store+0xf/0x20
[ 819.774613] [<ffffffff811f8618>] sysfs_write_file+0x128/0x1c0
[ 819.774735] [<ffffffff8118579d>] vfs_write+0xbd/0x1e0
[ 819.774841] [<ffffffff811861d9>] SyS_write+0x49/0xa0
[ 819.774939] [<ffffffff816d1052>] system_call_fastpath+0x16/0x1b
[ 819.775055] Code: 89 f8 48 89 e5 f6 82 c0 a6 84 81 20 74 15 0f 1f 44 00 00 48 83 c0 01 0f b6 10 f6 82 c0 a6 84 81 20 75 f0 5d c3 66 0f 1f 44 00 00 <80> 3f 00 55 48 89 e5 74 15 48 89 f8 0f 1f 40 00 48 83 c0 01 80
[ 819.775760] RIP [<ffffffff813381c0>] skip_spaces+0x30/0x30
[ 819.775881] RSP <ffff8804015cbc70>
[ 819.775949] CR2: 0000000000000000
[ 819.794175] ---[ end trace c4ef25127039952e ]---
Change-Id: I69c2ff4750e66344e28b7fed6f4bf3357614d77c
Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Acked-by: Anton Vorontsov <anton@enomsg.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: stable@vger.kernel.org
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
|
|
This patch, originally authored by Arve Hjonnevag and Todd Poynor,
prevents the system from entering suspend mode until the power supply
plug, unplug, or any other change of state event is fully processed. This
guarantees that the screen lights up and displays the battery charging
state. The implementation uses the power supply wakeup_source object.
Change-Id: I541e6a5d0567f2a731f14abc16fda30256ae93fe
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Arve Hjonnevag <arve@android.com>
Cc: Todd Poynor <toddpoynor@google.com>
Cc: John Stultz <john.stultz@linaro.org>
Signed-off-by: Zoran Markovic <zoran.markovic@linaro.org>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
|
|
of_parse_phandle increments the refcount for a dt node before returning
it. Add of_node_put where needed to properly decrement the refcount when
we are done using a given node.
Change-Id: I49584e6d17ba5cc7f431a8a0b193fcbc2b6a2f34
Signed-off-by: Rhyland Klein <rklein@nvidia.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
|
|
Charger-manager works with cable notification from extcon sub system,
and it has to notify users when charging status is updated due to the
cable connection.
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
|
|
Some system might want to notice changing of battery soc, so this patch
makes charger-manager to trigger uevent whenver battery soc changes.
It is configurable operation via setting flag, 'cm-poll-batt-soc', in dt.
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
|
|
This patch update max17040 fuel-gague device as following:
- Use regmap instead of old i2c interface
- Normalize capacity and vcell values
- Add ID for MAX77836 fuel-gauge block
- Add basic support for pdata-less operation
- Add match table entry for MAX17048
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Tomasz Figa <t.figa@samsung.com>
|
|
MAX14577/77836 chip is a multi-function device which includes MUIC, charger and
voltage regulator. The driver is located in drivers/mfd.
This patch supports battery charging control of MAX14577/77836 chip and provides
power supply class information to userspace.
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
|
|
Fix temperature unit to follow the standard as document describes.
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
|
|
This reverts commit 79b1d3591b35022b93f2d70c299e74eb54bfec09.
|
|
With this patch, charger-manager can support device tree fully.
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
|
|
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
|
|
During the charger manager driver's probing time, it can't succeed
if there's no pre-defined .temperature_out_of_range callback function.
But if fuel gauge supports battery temperature measurement, we
can use it directly. That's what cm_default_get_temp() function does.
With flag measure_batter_temp ON, we normally use cm_default_get_temp()
for .temperature_out_of_range callback funtion.
The TEMP_AMBIENT property is only used for pre-defined one.
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
|
|
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
|
|
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
|
|
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
|
|
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
|
|
CHARGE_NOW property has beed used in wrong way, it should be fixed
as it is planned initially. But for now, we just leave it for
upper layer (e.g. OAL) for a while.
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
|
|
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
|
|
- Remove duplicated macro data.
- Improve readability.
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
|
|
max77693_charger_of_match with __initconst flag is referenced from
max77693_charger_driver which is non init data and this causes
section mismatch. So flag __initconst is removed.
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
|
|
This patch prevents NULL pointer error cauesed by unregistering unregistered
exton notifier block. At the probing time of charger manager, it tries to
remove extcon notifier block when it fails to initialize them. It has to be
applied for only registered one. Otherwise, it'd make kernel panic. To make it
work right, it checks extcon_specific_cable_nb's extcon_dev node. If extcon
cable notifier block was registered successfully, it has proper extcon_dev
pointer if not so it has NULL pointer.
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
|
|
This patch fixes return value checking of regulator_get() in charger-manager
driver. The API, regulator_get(), returns ERR_PTR() when it fails to get
regulator with given name, not NULL.
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
|
|
All data will be move into DT later.
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
|
|
There is no need to defer chip initialization from probe. In addition,
current implementation caused a deadlock, which made boot hang from time
to time.
This patch removes deferred initialization and adds chip initialization
to probe, before the power supply is registered.
Signed-off-by: Tomasz Figa <t.figa@samsung.com>
|
|
Fixed :
- Read battery capacity from VFG(voltage fuel gauge) for ModelGuage M1.
- Fix error of registering alarm irq to generic irq framework.
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
|
|
The patch 'power: max77693: Add max77693 charger driver.'
omitted CHARGER_MAX77693 kerenel configuration.
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
|
|
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
|
|
This patch fixes incorrect way of getting platform data, which should be
read from MFD private data structure instead.
Signed-off-by: Tomasz Figa <t.figa@samsung.com>
|