MAINTAINERS: drivers/power: add entry for SmartReflex AVS drivers

The SmartReflex AVS driver evolved out of the OMAP kernel and now lives
under drivers/power/avs.

I've historically been maintainer of this but Nishanth Menon is doing most
of the heavy lifting now.  Add us both as co-maintainers.

Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Rafael J. Wysocki <rjw@sisk.pl>
Cc: Nishanth Menon <nm@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
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>
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>
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>
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 9d08d5d77a355510c2f5657c86b0a4b25acfe72c, 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
rx51_battery: Fix channel number when reading adc value

This issue was introduced in commit 8e2747f031bd "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>
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
ARM: OMAP2+: am335x-bone*: add DT for BeagleBone Black

The BeagleBone Black is basically a regular BeagleBone with eMMC and HDMI added,
so create a common dtsi both can use. MMC support for AM335x still isn't in, so
only the LDO change has been added.

Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
v3.11-bone-support