Commit Graph

846 Commits

Author SHA1 Message Date
Sebastian Reichel 34a109610e isp1704_charger: Add DT support
This patch introduces device tree support to the isp1704 charger driver.
Adding support involved moving the handling of the enable GPIO from board
code into the driver.

Signed-off-by: Sebastian Reichel <sre@debian.org>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-12-23 18:34:58 -08:00
Anton Vorontsov 434a09f9c4 charger-manager: of_cm_parse_desc() should be static
Fixes the following warning:

drivers/power/charger-manager.c:1539:21: warning: symbol
'of_cm_parse_desc' was not declared. Should it be static?

Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-12-23 18:21:35 -08:00
Sebastian Reichel faffd234cf bq2415x_charger: Add DT support
This adds DT support to the bq2415x driver.

Signed-off-by: Sebastian Reichel <sre@debian.org>
Reviewed-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-12-23 18:21:32 -08:00
Sebastian Reichel abce97708a power_supply: Add power_supply_get_by_phandle
Add method to get power supply by device tree phandle.

Signed-off-by: Sebastian Reichel <sre@debian.org>
Reviewed-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-12-23 18:21:11 -08:00
Pali Rohár 32260308b4 bq2415x_charger: Use power_supply notifier for automode
This patch removing set_mode_hook function from board data and replacing
it with new string variable of notifier power supply device. After this
change it is possible to add DT support because driver does not need
specific board function anymore. Only static data and name of power supply
device is required.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Reviewed-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-12-23 17:58:03 -08:00
Laxman Dewangan 56fb8de53e power: reset: Add as3722 power-off driver
ams AS3722 supports the power off functionality to turn off system.

This commit adds power off driver for ams AS3722.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Tested-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-12-23 17:20:37 -08:00
Jonghwa Lee 856ee6115e charger-manager: Support deivce tree in charger manager driver
Charger-manager can parse charger_desc data from devicetree which is used
to register charger manager.

Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-12-23 17:10:07 -08:00
Jonghwa Lee 5c49a6256b charger-manager: Modify the way of checking battery's temperature
Charger-manager driver used to check battery temperature through the
callback function passed by platform data. Unfortunatley, without that
pre-defined callback function, charger-manager can't get battery's
temperature at all. Also passing callback function through platform data
ruins DT support for charger-manager.

This patch mondifies charger-manager driver to get temperature of battery
without pre-defined callback function. Now, charger-manager can use either
of battery thermometer in fuel-gauge and ouside of battery. It uses
thermal framework interface for outer thermometer if thermal fw is
enabled. Otherwise, it tries to use fuel-gauge's through the power supply
interface.

Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-12-23 17:09:09 -08:00
Pali Rohár d36240d260 power_supply: Add power_supply notifier
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

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>
2013-12-01 14:27:24 -08:00
Austin Boyle 93353e8088 max17042_battery: Fix build errors caused by missing REGMAP_I2C config
max17042 now uses regmap interface but does not enable config option. This
patch fixes the following build errors:

drivers/power/max17042_battery.c:661:15: error: variable ‘max17042_regmap_config’ has initializer but incomplete type
drivers/power/max17042_battery.c:662:2: error: unknown field ‘reg_bits’ specified in initializer
drivers/power/max17042_battery.c:662:2: warning: excess elements in struct initializer
drivers/power/max17042_battery.c:662:2: warning: (near initialization for ‘max17042_regmap_config’)
drivers/power/max17042_battery.c:663:2: error: unknown field ‘val_bits’ specified in initializer
drivers/power/max17042_battery.c:663:2: warning: excess elements in struct initializer
drivers/power/max17042_battery.c:663:2: warning: (near initialization for ‘max17042_regmap_config’)
drivers/power/max17042_battery.c:664:2: error: unknown field ‘val_format_endian’ specified in initializer
drivers/power/max17042_battery.c:664:23: error: ‘REGMAP_ENDIAN_NATIVE’ undeclared here (not in a function)
drivers/power/max17042_battery.c:664:2: warning: excess elements in struct initializer
drivers/power/max17042_battery.c:664:2: warning: (near initialization for ‘max17042_regmap_config’)
drivers/power/max17042_battery.c: In function ‘max17042_probe’:
drivers/power/max17042_battery.c:684:2: error: implicit declaration of function ‘devm_regmap_init_i2c’

Signed-off-by: Austin Boyle <boyle.austin@gmail.com>
Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-12-01 14:25:03 -08:00
Shuah Khan 80c6463e2f power_supply: Fix Oops from NULL pointer dereference from wakeup_source_activate
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 ]---

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>
2013-12-01 13:41:31 -08:00
Linus Torvalds a709bd585f Highlights:
- A new driver for TI BQ24735 Battery Chargers, courtesy of NVidia.
 
 - Device tree bindings for TWL4030 chips.
 
 - Random fixes and cleanups.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.14 (GNU/Linux)
 
 iQIcBAABAgAGBQJSiXSwAAoJEGgI9fZJve1bJBgQAJKXIYXqZG5AwCqtFXltN0S5
 qYmxiaxUekQyesBxRNNb6LwgWEBUF+lQtmfhDpSaHwi6aRc7pmSQaVw6tfD1dpBe
 bAEHrWu1YD8v6rwhrhB91kv9F81ea06pfUtyUAwDpbchGq/VaN/tsUT4uO5E/AIT
 K7tWZzjmGyQ79186HUnDxmgb0lA1PPDypsuv/pP1KgrioKNPHskDqhLeS2YuCe6J
 WUHiGb3cDB8Tu2+Af5OIxXio5J74486KvjlH1K9+ziixUrU0P380D26JshklgIsG
 qWc1hu9DSO+r76N7HV0EzbpJNqZNEFJiXaXSozgA/yRtJy+ISEIVXJE9oDwW7SxH
 thLveZTck6VQ6CyggAh2nn9KPVrpFYUcy+HFshpM7V4xugjcAe9Bq9i5cWwJHvn9
 Xy4G2s2MS81PFdKEGc9JjSwvXULTRTMAe5gMMfwAqnn+Xuf2+KSCtTlOnPkON/sa
 cNraBFTSVi33yCEHS9BO7BKbb5ikPNtAaAB+4VszwMQbUysPld7WvEpEOIUOaoJO
 EYgsM1VOLV0cYO5Qwu9Yxplrjmz/l+kNxAgtCW21SV14DjUbnV9ZuhL5Gx4jbLyY
 T1uiREtzpTUGoKhZHqWHKXtoEUW+d48nkDXbO+IbKmKPTF6bn0TuZmW0sNU/ZHb8
 yNJPZKinHfUE6heJCX2X
 =rT+j
 -----END PGP SIGNATURE-----

Merge tag 'for-v3.13' of git://git.infradead.org/battery-2.6

Pull battery updates from Anton Vorontsov:
 "Highlights:
   - A new driver for TI BQ24735 Battery Chargers, courtesy of NVidia.
   - Device tree bindings for TWL4030 chips.
   - Random fixes and cleanups"

* tag 'for-v3.13' of git://git.infradead.org/battery-2.6:
  pm2301-charger: Remove unneeded NULL checks
  twl4030_charger: Add devicetree support
  power_supply: Fix documentation for TEMP_*ALERT* properties
  max17042_battery: Support regmap to access device's registers
  max17042_battery: Use SIMPLE_DEV_PM_OPS
  charger-manager : Replace kzalloc to devm_kzalloc and remove uneccessary code
  bq2415x_charger: Fix max battery regulation voltage
  tps65090-charger: Use "IS_ENABLED(CONFIG_OF)" for DT code
  tps65090-charger: Drop devm_free_irq of devm_ allocated irq
  power_supply: Add support for bq24735 charger
  pm2301-charger: Staticize pm2xxx_charger_die_therm_mngt
  pm2301-charger: Check return value of regulator_enable
  ab8500-charger: Remove redundant break
  ab8500-charger: Check return value of regulator_enable
  isp1704_charger: Fix driver to work with changes introduced in v3.5
2013-11-18 15:35:09 -08:00
Wolfram Sang 16735d022f tree-wide: use reinit_completion instead of INIT_COMPLETION
Use this new function to make code more comprehensible, since we are
reinitialzing the completion, not initializing.

[akpm@linux-foundation.org: linux-next resyncs]
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Acked-by: Linus Walleij <linus.walleij@linaro.org> (personally at LCE13)
Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-11-15 09:32:21 +09:00
Dan Carpenter c8024234c2 pm2301-charger: Remove unneeded NULL checks
If "pm2" were NULL we would oops printing the error message.
Fortunately, that's not possible so I have removed the NULL checks.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-11-12 22:36:34 -08:00
NeilBrown ec0b380245 twl4030_charger: Add devicetree support
This allows the charger to be enabled with devicetree, and allows the
parameters for charging the backup battery to be set.

Signed-off-by: NeilBrown <neilb@suse.de>
Acked-by: Kumar Gala <galak@codeaurora.org>
Acked-by: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-11-12 22:35:45 -08:00
Jonghwa Lee 39e7213edc max17042_battery: Support regmap to access device's registers
This patch makes max17042 fuelguage driver uses regmap API to access its
device's registers.

Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-10-25 16:54:33 -07:00
Manish Badarkhe 3d23c7f457 max17042_battery: Use SIMPLE_DEV_PM_OPS
Use the SIMPLE_DEV_PM_OPS macro to declare the driver's pm_ops.

Signed-off-by: Manish Badarkhe <badarkhe.manish@gmail.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-10-25 16:48:30 -07:00
Jonghwa Lee 883c10a9dd charger-manager : Replace kzalloc to devm_kzalloc and remove uneccessary code
Use devm function for dynamic memory allocation.

Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-10-25 16:28:54 -07:00
Alexandre Belloni 3ed5cd79b8 bq2415x_charger: Fix max battery regulation voltage
As per the datasheets, maximum battery regulation voltage is 4440mV.

The formula is (voltage - offset) / step, so the maximum value is:
(4440 - 3500) / 20 = 47

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Thanks-to: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-10-25 16:24:22 -07:00
Manish Badarkhe e47bcba4a1 tps65090-charger: Use "IS_ENABLED(CONFIG_OF)" for DT code
Instead of "#if defined(CONFIG_OF)" use "IS_ENABLED(CONFIG_OF)" option
for DT code to avoid if-deffery in code.

Also, arranged header files in alphabetically.

Signed-off-by: Manish Badarkhe <badarkhe.manish@gmail.com>
Acked-by: Rhyland Klein <rklein@nvidia.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-10-25 16:07:07 -07:00
Wei Yongjun 0ed8139323 tps65090-charger: Drop devm_free_irq of devm_ allocated irq
The devm_request_irq function allocates irq that is released when a driver
detaches. Thus, there is no reason to explicitly call devm_free_irq in
probe or remove functions.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-10-25 16:06:10 -07:00
Darbha Sriharsha ce77399226 power_supply: Add support for bq24735 charger
Adds support for the bq24735 charger chipset. The bq24735 is a
high-efficiency, synchronous battery charger.

It allows control of the charging current, input current, and the charger
voltage DAC's through SMBus.

Signed-off-by: Darbha Sriharsha <dsriharsha@nvidia.com>
Signed-off-by: Rhyland Klein <rklein@nvidia.com>
Thanks-to: Stephen Warren <swarren@wwwdotorg.org>
Thanks-to: Thierry Reding <thierry.reding@gmail.com>
Thanks-to: Manish Badarkhe <badarkhe.manish@gmail.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-10-25 15:56:51 -07:00
Sachin Kamat 83bd57aeb0 pm2301-charger: Staticize pm2xxx_charger_die_therm_mngt
pm2xxx_charger_die_therm_mngt is used only in this file. Make it static.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-10-25 15:36:52 -07:00
Sachin Kamat 508b2c1349 pm2301-charger: Check return value of regulator_enable
Check the return value of regulator_enable to silence the following
warning:
drivers/power/pm2301_charger.c:725:20: warning:
ignoring return value of ‘regulator_enable’, declared with
attribute warn_unused_result [-Wunused-result]

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-10-25 15:36:40 -07:00
Sachin Kamat 08a5c7e684 ab8500-charger: Remove redundant break
Each of the if-else blocks has a break statement. Remove the additional
one which is unreachable.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-10-25 15:36:23 -07:00
Sachin Kamat 6de7ef3e30 ab8500-charger: Check return value of regulator_enable
Check the return value of regulator_enable to silence the following
type of warnings:
drivers/power/ab8500_charger.c:1390:20: warning: ignoring return value
of ‘regulator_enable’, declared with attribute warn_unused_result
[-Wunused-result]

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-10-25 15:36:05 -07:00
Pali Rohár f07c11ea32 isp1704_charger: Fix driver to work with changes introduced in v3.5
* omap musb driver does not report USB_EVENT_ENUMERATED event anymore
* omap musb driver reporting USB_EVENT_VBUS when charger is connected
* read last event from phy->last_event (instead from ulpi register)
* do not call wall charger detection more times

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-10-22 13:57:16 -07:00
Martin Schwidefsky 0244ad004a Remove GENERIC_HARDIRQ config option
After the last architecture switched to generic hard irqs the config
options HAVE_GENERIC_HARDIRQS & GENERIC_HARDIRQS and the related code
for !CONFIG_GENERIC_HARDIRQS can be removed.

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2013-09-13 15:09:52 +02:00
Linus Torvalds a22a0fdba4 New drivers:
- APM X-Gene system reboot driver by Feng Kan and Loc Ho (APM).
 
 - Qualcomm MSM reboot/poweroff driver by Abhimanyu Kapur (Codeaurora).
 
 - Texas Instruments BQ24190 charger driver by Mark A. Greer (Animal Creek
   Technologies).
 
 - Texas Instruments TWL4030 MADC battery driver by Lukas Märdian and Marek
   Belisko (Golden Delicious Computers). The driver is used on Freerunner
   GTA04 phones.
 
 Highlighted fixes and improvements:
 
 - Suspend/wakeup logic improvements: power supply objects will block
   system suspend until all power supply events are processed. Thanks to
   Zoran Markovic (Linaro), Arve Hjonnevag and Todd Poynor (Google).
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.19 (GNU/Linux)
 
 iQIcBAABAgAGBQJSL/sOAAoJEGgI9fZJve1bDMAP/ih4C5NsuRsQxZMzTWIft80+
 S9r/co8Q/1LXgxqdMe1xq0pPgceuXCTHXjSK+ZM+/A9Qi/jFVg1S8skrAlUzMq2m
 PaRbyAVxtahU1uUIXqQLNbYO/IuRKNdXnREVt6w4K9BMjbjhsNdIRG6zOdsLxhKL
 r64sm3fqEJNRxIGuGzXPnMLNTL99uDJmMs1oPHAJwGXqWQA74K8iBHRgzi+kTAxG
 juDerMGoxU7modEQMlK4jKYj2bju4liYsrQ9pQBU1QUmHgPl7QLigXHtnkbWivrN
 nPPSJCNdtCXXtazU0ptkI717aPo0SBtEVQETF960ZTASdoqt2Ver8h4RW7dBAOIw
 tc4hdbJjZvuaDz4Os2Wy0NW+1uXVmj/Jyl9WtNtI8XYBMT0GWNN16xZZYKX303UG
 h0Myw2XhNko95g6XxQBfiat5VlH8aSIDz3LVTM1RC9zrDvjmpsI7bx+17Tw2+McK
 WdPNNHjCcgRNOIVt/vLYxQYxbJWfPf6IW2nn1v9Kc96K5WD2+3n6bn833szxFu75
 FnNghYLKkp9iXKXgGysHKoczAQa0eUxjAE/UAo10i4Eg7JmXF2Q4A+wwa2QrMutK
 FlfQo8pJGAiw0xGjkbPw8DkgBEkY8v9cJEIr0BUI6LwUoraeAjlkLjC5Im3V9bYM
 YRSzcSEESc3J/1YTGmam
 =k4RI
 -----END PGP SIGNATURE-----

Merge tag 'for-v3.12' of git://git.infradead.org/battery-2.6

Pull battery/power supply driver updates from Anton Vorontsov:
 "New drivers:

   - APM X-Gene system reboot driver by Feng Kan and Loc Ho (APM).

   - Qualcomm MSM reboot/poweroff driver by Abhimanyu Kapur (Codeaurora).

   - Texas Instruments BQ24190 charger driver by Mark A.  Greer (Animal
     Creek Technologies).

   - Texas Instruments TWL4030 MADC battery driver by Lukas Märdian and
     Marek Belisko (Golden Delicious Computers).  The driver is used on
     Freerunner GTA04 phones.

  Highlighted fixes and improvements:

   - Suspend/wakeup logic improvements: power supply objects will block
     system suspend until all power supply events are processed.  Thanks
     to Zoran Markovic (Linaro), Arve Hjonnevag and Todd Poynor (Google)"

* tag 'for-v3.12' of git://git.infradead.org/battery-2.6:
  rx51_battery: Fix channel number when reading adc value
  power: Add twl4030_madc battery driver.
  bq24190_charger: Workaround SS definition problem on i386 builds
  power_supply: Prevent suspend until power supply events are processed
  vexpress-poweroff: Should depend on the required infrastructure
  twl4030-charger: Fix compiler warning with regulator_enable()
  rx51_battery: Replace hardcoded channels values.
  bq24190_charger: Add support for TI BQ24190 Battery Charger
  ab8500-charger: We print an unintended error message
  max8925_power: Fix missing of_node_put
  power_supply: Replace strict_strtol() with kstrtol()
  power: Add APM X-Gene system reboot driver
  power_supply: tosa_battery: Get rid of irq_to_gpio usage
  power supply: collie_battery: Convert to use dev_pm_ops
  power_supply: Make goldfish_battery depend on GOLDFISH || COMPILE_TEST
  power: reset: Add msm restart support
  MAINTAINERS: drivers/power: add entry for SmartReflex AVS drivers
2013-09-10 22:58:14 -07:00
Marek Belisko db15e6312e rx51_battery: Fix channel number when reading adc value
This issue was introduced in commit 8e2747f031 "power: rx51_battery:
Replace hardcoded channels values."

Original code use channel as argument which was shifted by one in
function. After mentioned commit argument is already shifted so we need to
get index back.

Signed-off-by: Marek Belisko <marek.belisko@open-nandra.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-08-30 17:49:15 -07:00
Marek Belisko da0a00ebc2 power: Add twl4030_madc battery driver.
This driver is used and tested on gta04 phone. It's using twl4030_madc
(similar to rx51 existing driver). Driver also implement charging and
discharging calibration data so user can define ranges and level.

Signed-off-by: Marek Belisko <marek@goldelico.com>
Signed-off-by: Lukas Märdian <lukas@goldelico.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-08-30 17:34:52 -07:00
Anton Vorontsov d24fed391d bq24190_charger: Workaround SS definition problem on i386 builds
For __i386__ builds we have:

arch/x86/include/uapi/asm/ptrace-abi.h:#define SS   16

And in the driver:

BQ24190_SYSFS_FIELD_RO(vbus_stat,       SS,     VBUS_STAT)

That breaks the build like this:

drivers/power/bq24190_charger.c:375:138: error: ‘BQ24190_REG_16’
undeclared here (not in a function)
drivers/power/bq24190_charger.c:375:162: error:
‘BQ24190_REG_16_THERM_STAT_MASK’ undeclared here (not in a function)
drivers/power/bq24190_charger.c:375:203: error:
‘BQ24190_REG_16_THERM_STAT_SHIFT’ undeclared here (not
 in a function)

With this commit we workaround the problem by undefining 'SS'.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-08-28 17:52:50 -07:00
Zoran Markovic 948dcf9662 power_supply: Prevent suspend until power supply events are processed
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.

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>
2013-08-27 18:42:48 -07:00
Pawel Moll a2c0206ad6 vexpress-poweroff: Should depend on the required infrastructure
ARM Versatile Express reset driver requires platform-specific config
infrastructure to be present in the kernel. When VEXPRESS_CONFIG is not
selected, the build will fail like this:

drivers/built-in.o: In function `vexpress_reset_do.clone.0':
iio-trig-interrupt.c:(.text+0x1aff38): undefined reference to `__vexpress_config_func_get'
iio-trig-interrupt.c:(.text+0x1aff4c): undefined reference to `vexpress_config_write'

Added required dependency to the Kconfig entry.

Signed-off-by: Pawel Moll <pawel.moll@arm.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-08-27 18:30:57 -07:00
Peter Ujfalusi 697be361d2 twl4030-charger: Fix compiler warning with regulator_enable()
The return value of regulator_enable need to be checked. This patch fixes
the following warning:
drivers/power/twl4030_charger.c: In function ‘twl4030_charger_enable_usb’:
drivers/power/twl4030_charger.c:192:20: warning: ignoring return value of ‘regulator_enable’, declared with attribute warn_unused_result [-Wunused-result]

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-08-27 18:28:30 -07:00
Marek Belisko 8e2747f031 rx51_battery: Replace hardcoded channels values.
In twl4030_madc header exist defines for fixed channels + add rx51
specific channels and replace all hardcoded channels values.

Signed-off-by: Marek Belisko <marek.belisko@open-nandra.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-08-27 18:26:44 -07:00
Mark A. Greer d7bf353fd0 bq24190_charger: Add support for TI BQ24190 Battery Charger
Add driver support for the Texas Instruments BQ24190 battery charger.
Some of the information provided by the device is about the charger and
other information is about the battery so create two power_supply objects
(one for each) and provide the appropriate information for each one.

The device has many fields that go beyond what is reasonable to report or
modify using the existing 'POWER_SUPPLY_PROP_*' properties so the driver
exports the register fields via sysfs.  They are prefixed by 'f_' (for
'field') to make it easier to distinguish between a register field and a
"normal" sysfs file exported by the power_supply infrastructure.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-08-27 18:17:54 -07:00
Dan Carpenter ed5243f8ab ab8500-charger: We print an unintended error message
There is a missing break statement here, so we print an error message that
the USB type is invalid.  The original code still works fine though except
for the error message.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-08-27 18:12:40 -07:00
Libo Chen 68f429d558 max8925_power: Fix missing of_node_put
Decrease np device_node refcount after we are done with the node.

Signed-off-by: Libo Chen <libo.chen@huawei.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-08-27 18:11:54 -07:00
Masanari Iida 0b1587b18b treewide: Fix typo in printk
Correct spelling typo in printk

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2013-08-20 12:44:03 +02:00
Jingoo Han f107ae11f0 power_supply: Replace strict_strtol() with kstrtol()
The usage of strict_strtol() is not preferred, because strict_strtol() is
obsolete. Thus, kstrtol() should be used.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-08-09 14:49:49 -07:00
Loc Ho 67778e0eda power: Add APM X-Gene system reboot driver
Add APM X-Gene SoC system reboot driver. This driver handles only system
reboot. System shutdown is board specific and can be handled by board
driver or GPIO based shutdown driver.

Signed-off-by: Loc Ho <lho@apm.com>
Signed-off-by: Feng Kan <fkan@apm.com>
Signed-off-by: Kumar Sankaran <ksankaran@apm.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-08-09 14:28:17 -07:00
Andrea Adami 0e81ef5880 power_supply: tosa_battery: Get rid of irq_to_gpio usage
This commit fixes the following error:

 linux/drivers/power/tosa_battery.c:153:2: error: implicit declaration of
 function 'irq_to_gpio' [-Werror=implicit-function-declaration]

Since 9d08d5d77a, irq_to_gpio() is no longer
available but still in use by collie_battery.c. As it's just for a debug
message, just get rid of this call.

Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-08-09 13:41:52 -07:00
Andrea Adami 1ba6411497 power supply: collie_battery: Convert to use dev_pm_ops
This commit fixes the following warnings:

 linux/drivers/power/collie_battery.c:372:2: warning: initialization from
 incompatible pointer type [enabled by default]
 linux/drivers/power/collie_battery.c:372:2: warning: (near initialization
 for 'collie_bat_driver.suspend') [enabled by default]

Referencess:

MFD: ucb1x00-core: convert to use dev_pm_ops
https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/include/linux/mfd?id=5a09b7120a965a7d7e8494d0ed509135bbce0118

MFD: mcp-core: remove legacy driver suspend/resume methods
https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/include/linux/mfd?id=cf4abfcc0df2985ff6061f74e63b8353f2a1d0bc

Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-08-09 13:41:06 -07:00
Paul Gortmaker e2e077cdde power_supply: Make goldfish_battery depend on GOLDFISH || COMPILE_TEST
Nearly all the other goldfish peripherals (mtd, keyboard, etc) have a
dependency on the main platform's GOLDFISH Kconfig item, but this one got
skipped.  Even with consistency as a justification, there was initial
resistance[1] from some people to adding it however, as they wanted the
extra compile coverage.

Now, with CONFIG_COMPILE_TEST, we have the middle ground that will give
people the coverage who want it, and let those who don't want it to skip
ever seeing the option presented.

[1] https://lkml.org/lkml/2013/2/27/333

Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-08-09 13:28:47 -07:00
Abhimanyu Kapur 78be3176c4 power: reset: Add msm restart support
Add support for restart and poweroff functionality present on MSM chipsets
with the MPM2 ps-hold hardware.

Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org>
Tested-by: Ivan T. Ivanov <iivanov@mm-sol.com>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-08-09 11:47:53 -07:00
Linus Torvalds 7d3107d26b Nothing exciting this time, just assorted fixes and cleanups.
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.13 (GNU/Linux)
 
 iQIcBAABAgAGBQJR22dXAAoJEGgI9fZJve1b56QP/Aq4UhbWz5V0Apnl1RgELAU6
 3l74FCp2GG6ykwU95HBCt7OeXQurWkDPvdQUalGoSsQZGndP/thcAB0n0PPgLoP0
 E5ZGkKYg8QaiVUx8Bb/egtU79QBU54qUmA2TxQqFdf9U6VwF80OmLU8TKqSbX53X
 GYstF7XeRrxBqlVZ0ctziXFB4+RtJTSUP4RfKFe35a+J/0lghxGv8niJVnbUxAZt
 ReUfM/6kJhjuAf1sQPsPZQNwMiFJzarlrQ+xIgzARkmrU1LtQ1yBAG8vVQ4+ozOv
 zZDsvWKbeUWavNvMY4at9XBkJvpMutuzYnYH6xaoGA8pLEnsZ6ckIwNFMuqh1NOF
 BUh0aAGi+DfaUk2POd8pGuR6z7oYUKGDSO5maPurOqQDMZ0VRgNXiIt79tWQrG7g
 TmtNLxkWGNFHCvAIRGLD3SQt0AgpyGatov59ukllqMxDF+z0an3Tf7WNS6C4nf7C
 mU22yX67lhDKyEVIcGwLM9w6wgG1Xtv6HX50uYcroyiMcRGD1bxGyUsYxl+sqlh1
 +GAoL8b+8vhpl2FMmGO6TMhlL0fW8orLI3pnqxgvKDlq41hq9Ok23h0H29ZOBckx
 2egEGQHpOllrgMfvrju9BWh3TzFpmlp0hi5evkawMHMcZKAkhMc20GDNujKYlNOb
 j3yzXbnZHOq9y9/QcE+r
 =K+7Q
 -----END PGP SIGNATURE-----

Merge tag 'for-v3.11' of git://git.infradead.org/battery-2.6

Pull battery subsystem update from Anton Vorontsov:
 "Nothing exciting this time, just assorted fixes and cleanups"

* tag 'for-v3.11' of git://git.infradead.org/battery-2.6: (25 commits)
  charger-manager: Fix regulator_get() return check
  charger-manager: Fix a bug when it unregisters notifier block of extcon
  tps65090-charger: Add dt node to power_supply
  sbs-battery: Add dt to power_supply struct
  power_supply: Add of_node_put to fix refcount
  power_supply: Move of_node out of the #ifdef CONFIG_OF
  power/reset: Make the vexpress driver optional on arm and arm64
  charger-manager: Add missing newlines, fix a couple of typos, add pr_fmt
  tps65090-charger: Fix AC detect
  MAINTAINERS: Update email address for Anton Vorontsov
  charger-manager: Ensure event is not used as format string
  power_supply: Replace strict_strtoul() with kstrtoul()
  generic-adc-battery: Fix checking if none of the channels are supported
  power: Use platform_{get,set}_drvdata()
  pm2301_charger: Return error if create_singlethread_workqueue fails
  pm2301_charger: Fix NULL pointer dereference
  lp8727_charger: Support the device tree feature
  twl4030_charger: Remove unnecessary platform_set_drvdata()
  rx51_battery: Remove unnecessary platform_set_drvdata()
  jz4740-battery: Remove unnecessary platform_set_drvdata()
  ...
2013-07-10 11:13:00 -07:00
Robin Holt 7b6d864b48 reboot: arm: change reboot_mode to use enum reboot_mode
Preparing to move the parsing of reboot= to generic kernel code forces
the change in reboot_mode handling to use the enum.

[akpm@linux-foundation.org: fix arch/arm/mach-socfpga/socfpga.c]
Signed-off-by: Robin Holt <holt@sgi.com>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: Russ Anderson <rja@sgi.com>
Cc: Robin Holt <holt@sgi.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-07-09 10:33:29 -07:00
Jonghwa Lee 5a6c220845 charger-manager: Fix regulator_get() return check
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>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-06-28 18:37:03 -07:00
Jonghwa Lee 3cc9d26966 charger-manager: Fix a bug when it unregisters notifier block of extcon
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>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-06-28 18:35:49 -07:00