History log of /linux-master/drivers/mfd/tps65910.c
Revision Date Author Comments
# 830fafce 17-Oct-2023 Rob Herring <robh@kernel.org>

mfd: Use device_get_match_data() in a bunch of drivers

Use preferred device_get_match_data() instead of of_match_device() to
get the driver match data. With this, adjust the includes to explicitly
include the correct headers.

Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20231017203612.2701060-1-robh@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>


# 535cd579 01-Oct-2023 Mark Brown <broonie@kernel.org>

mfd: tps65910: Convert to use maple tree register cache

The maple tree register cache is based on a much more modern data structure
than the rbtree cache and makes optimisation choices which are probably
more appropriate for modern systems than those made by the rbtree cache.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20231001-mfd-ti-maple-v1-5-0657862de3f6@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>


# 9816d859 15-May-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

mfd: Switch i2c drivers back to use .probe()

After commit b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new()
call-back type"), all drivers being converted to .probe_new() and then
03c835f498b5 ("i2c: Switch .probe() to not take an id parameter") convert
back to (the new) .probe() to be able to eventually drop .probe_new() from
struct i2c_driver.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20230515182752.10050-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Lee Jones <lee@kernel.org>


# 74e52d31 18-Nov-2022 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

mfd: tps65910: Convert to i2c's .probe_new()

.probe_new() doesn't get the i2c_device_id * parameter, so determine
that explicitly in the probe function.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20221118224540.619276-474-uwe@kleine-koenig.org


# 7620ad0b 24-Nov-2021 Dmitry Osipenko <digetx@gmail.com>

mfd: tps65910: Set PWR_OFF bit during driver probe

The PWR_OFF bit needs to be set in order to power off properly, without
hanging PMIC. This bit needs to be set early in order to allow thermal
protection of NVIDIA Terga SoCs to power off hardware properly, otherwise
a battery re-plug may be needed on some devices to recover after the hang.

Cc: <stable@vger.kernel.org>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Tested-by: Svyatoslav Ryhel <clamor95@gmail.com> # ASUS TF201
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20211124190104.23554-1-digetx@gmail.com


# 129989d5 15-Nov-2020 Dmitry Osipenko <digetx@gmail.com>

mfd: tps65910: Correct power-off programming sequence

Correct power-off programming sequence in order to fix shutting down
devices which are using TPS65910 PMIC.

In accordance to the TPS65910 datasheet, the PMIC's state-machine
transitions into the OFF state only when DEV_OFF bit of DEVCTRL_REG is
set. The ON / SLEEP states also should be cleared, otherwise PMIC won't
get into a proper state on shutdown. Devices like Nexus 7 tablet and Ouya
game console are shutting down properly now.

Tested-by: Peter Geis <pgwipeout@gmail.com>
Tested-by: Zack Pearsall <zpearsall@yahoo.com>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# 4f278593 04-Nov-2020 Lee Jones <lee.jones@linaro.org>

mfd: tps65910: Fix a bunch of alignment issues reported-by Checkpatch

CHECK: Alignment should match open parenthesis
#24: FILE: drivers/mfd/tps65910.c:296:
+ ret = regmap_clear_bits(tps65910->regmap, TPS65910_DEVCTRL,
DEVCTRL_CK32K_CTRL_MASK);

CHECK: Alignment should match open parenthesis
#33: FILE: drivers/mfd/tps65910.c:318:
+ ret = regmap_set_bits(tps65910->regmap, TPS65910_DEVCTRL,
DEVCTRL_DEV_SLP_MASK);

CHECK: Alignment should match open parenthesis
#42: FILE: drivers/mfd/tps65910.c:326:
+ ret = regmap_set_bits(tps65910->regmap,
TPS65910_SLEEP_KEEP_RES_ON,

CHECK: Alignment should match open parenthesis
#51: FILE: drivers/mfd/tps65910.c:336:
+ ret = regmap_set_bits(tps65910->regmap,
TPS65910_SLEEP_KEEP_RES_ON,

CHECK: Alignment should match open parenthesis
#60: FILE: drivers/mfd/tps65910.c:346:
+ ret = regmap_set_bits(tps65910->regmap,
TPS65910_SLEEP_KEEP_RES_ON,

CHECK: Alignment should match open parenthesis
#69: FILE: drivers/mfd/tps65910.c:358:
+ regmap_clear_bits(tps65910->regmap, TPS65910_DEVCTRL,
DEVCTRL_DEV_SLP_MASK);

CHECK: Alignment should match open parenthesis
#78: FILE: drivers/mfd/tps65910.c:440:
+ if (regmap_set_bits(tps65910->regmap, TPS65910_DEVCTRL,
DEVCTRL_PWR_OFF_MASK) < 0)

CHECK: Alignment should match open parenthesis
#83: FILE: drivers/mfd/tps65910.c:444:
+ regmap_clear_bits(tps65910->regmap, TPS65910_DEVCTRL,
DEVCTRL_DEV_ON_MASK);

Signed-off-by: Lee Jones <lee.jones@linaro.org>


# 28faad77 26-Sep-2020 Michał Mirosław <mirq-linux@rere.qmqm.pl>

mfd: tps65910: Clean up after switching to regmap

Remove wrappers around regmap calls to remove now-useless indirection.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# 0aefed0e 22-Sep-2020 Rikard Falkeborn <rikard.falkeborn@gmail.com>

mfd: tps65xxx: Constify static struct resource in OMAP2+ drivers

Constify a number of static struct resource. The only usage of the
structs are to assign their address to the resources field in the
mfd_cell struct. This allows the compiler to put them in read-only
memory. Done with the help of Coccinelle.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# 2874c5fd 27-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152

Based on 1 normalized pattern(s):

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license as published by
the free software foundation either version 2 of the license or at
your option any later version

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-or-later

has been chosen to replace the boilerplate/reference in 3029 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190527070032.746973796@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# a8799def 13-Jan-2019 Paul Gortmaker <paul.gortmaker@windriver.com>

mfd: tps65910: Make it explicitly non-modular

The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_TPS65910
drivers/mfd/Kconfig- bool "TI TPS65910 Power Management chip"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this code, the init ordering
remains unchanged with this commit.

We don't replace module.h with init.h since the file already has that.
We do delete an unused moduleparam.h include though.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# 71bc4f1d 09-Mar-2018 Markus Elfring <elfring@users.sourceforge.net>

mfd: tps65910: Move an assignment in tps65910_sleepinit()

Move the assignment for the local variable "dev" so that its setting
will be performed after a configuration check by this function.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# da257efa 09-Mar-2018 Markus Elfring <elfring@users.sourceforge.net>

mfd: tps65910: Delete an unnecessary variable initialisation in tps65910_sleepinit()

The local variable "dev" will be reassigned by a following statement.
Thus omit the explicit initialisation at the beginning.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# dae3be36 09-Mar-2018 Markus Elfring <elfring@users.sourceforge.net>

mfd: tps65910: Delete an unnecessary variable initialisation in four functions

The local variable "ret" will be set to an appropriate value a bit later.
Thus omit the explicit initialisation at the beginning.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# 93e879ef 09-Mar-2018 Markus Elfring <elfring@users.sourceforge.net>

mfd: tps65910: Delete an error message for a failed memory allocation in tps65910_parse_dt()

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# a9bc67de 14-Jun-2017 Michał Mirosław <mirq-linux@rere.qmqm.pl>

regulator: tps65910: wire up sleep control configuration

This enables configuring the PMIC's sleep mode via device-tree.

A pointer indirection to sleep mode data is removed, as it simplifies
the implementation slightly. In current kernel tree, platform data
structure is not used outside MFD cell drivers.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 6167c5bc 21-Apr-2016 Laxman Dewangan <ldewangan@nvidia.com>

mfd: tps65910: Use devm_mfd_add_devices and devm_regmap_add_irq_chip

Use devm_mfd_add_devices() for adding MFD child devices and
devm_regmap_add_irq_chip() for IRQ chip registration.

This reduces the error code path and .remove callback for removing
MFD child devices and deleting IRQ chip data.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# f3466e77 07-Apr-2016 Laxman Dewangan <ldewangan@nvidia.com>

mfd: tps65910: Use devm_mfd_add_devices() for mfd_device registration

Use devm_mfd_add_devices() for MFD devices registration and remove
the call of mfd_remove_devices() from .remove callback to remove
MFD child-devices. This is done by managed device framework.

CC: Tony Lindgren <tony@atomide.com>
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# 0e777366 09-Jul-2015 Krzysztof Kozlowski <krzk@kernel.org>

mfd: Drop owner assignment from i2c_drivers

i2c_driver does not need to set an owner because i2c_register_driver()
will set it.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# be1c7700 22-Aug-2014 Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

mfd: tps65910: Work around silicon erratum SWCZ010

http://www.ti.com/lit/pdf/SWCZ010:
Glitch on SDA-SCL not managed correctly by the I2C IP

Impact:
The standard specifies that the I2C transfer should restart on a start
event in all cases. The current design does not support two consecutive
Start conditions. This can cause the first real access after such a
glitch to be corrupted.

Description:
An unexpected glitch on SDA and SCL can generate a wrong start event.
In the current design, the SCL line must toggle two times to detect a
new start event and completely restart the I2C access; hence the real
start event is not detected in the case of a single SCL toggle.

Workaround:
Repeat I2C access.

A simpler workaround is to make a dummy transfer just before the first
access to the tps65910 chip. This can be done unconditionally.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# 01a0f4aa 02-Jul-2014 Lee Jones <lee.jones@linaro.org>

mfd: tps65910: Rid data size incompatibility warn when building for 64bit

Extinguishes:

../drivers/mfd/tps65910.c: In function ‘tps65910_parse_dt’:
../drivers/mfd/tps65910.c:404:14:
warning: cast from pointer to integer of different size

Signed-off-by: Lee Jones <lee.jones@linaro.org>


# c0dfbfe2 07-May-2014 Jingoo Han <jg1.han@samsung.com>

mfd: tps65910: Make of_device_id array const

Make of_device_id array const, because all OF functions
handle it as const.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# 742766aa 12-Mar-2014 Krzysztof Kozlowski <krzk@kernel.org>

mfd: tps65910: Fix regmap_irq_chip_data leak on mfd_add_devices fail

The tps65910_i2c_probe() allocates regmap_irq_chip in
tps65910_irq_init() but it does not clean this up in case of
mfd_add_devices() failure.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# 483e2dfd 12-Mar-2014 Krzysztof Kozlowski <krzk@kernel.org>

mfd: tps65910: Fix possible invalid pointer dereference on regmap_add_irq_chip fail

Fixes: 4aab3fadad32 ("mfd: tps65910: Move interrupt implementation code to mfd file")

tps65910_irq_init() sets 'tps65910->chip_irq' before calling
regmap_add_irq_chip(). If the regmap_add_irq_chip() call fails in
memory allocation of regmap_irq_chip_data members then:

1. The 'tps65910->chip_irq' will still hold some value
2. 'tps65910->irq_data' will be pointing to already freed memory
(because regmap_add_irq_chip() will free it on error)

This results in invalid memory access during driver remove because the
tps65910_irq_exit() tests whether 'tps65910->chip_irq' is not zero.

Cc: <stable@vger.kernel.org>
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# 30fe2b5b 18-Nov-2013 Geert Uytterhoeven <geert@linux-m68k.org>

mfd: ti: Constify struct mfd_cell where possible

As of commit 03e361b25ee8dfb1fd9b890072c23c4aae01c6c7 ("mfd: Stop setting
refcounting pointers in original mfd_cell arrays"), the "cell" parameter of
mfd_add_devices() is "const" again. Hence make all cell data passed to
mfd_add_devices() const where possible.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# 34c5c735 26-Sep-2012 Laxman Dewangan <ldewangan@nvidia.com>

mfd: tps65910: Remove warning during dt node parsing

Driver throw the warning message if dt node does not
have the info for VMBCH-Threshold and VMBCH2-Threshold.
These properties are optional property and hence it
is not mandatory to have these on DT node and in this case
it should not throw the warning message.
It creates noise from driver as follows:
[ 0.384605] tps65910 4-002d: VMBCH-Threshold not specified
[ 0.384616] tps65910 4-002d: VMBCH2-Threshold not specified

Removing the warning message from driver.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>


# 1fead3f3 16-Oct-2013 Sachin Kamat <sachin.kamat@linaro.org>

mfd: tps65910: Include linux/of.h header

'of_match_ptr' is defined in linux/of.h. Include it explicitly to
avoid breakage in the future.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# 0582c0fa 28-Nov-2012 Kim, Milo <Milo.Kim@ti.com>

mfd: tps65910: Fix wrong ack_base register

The interrupt status registers of TPS65910/1 should be cleared
when the associated interrupt event occurs.
This work is done in the regmap irq thread - using 'ack_base' register.
The ACK registers should be fixed as status register, not mask registers.

This patch fixes the infinite interrupt event problem by clearing
interrupt status registers.

Tested on the AM3517 Craneboard.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>


# 0e5fca81 29-Nov-2012 Kim, Milo <Milo.Kim@ti.com>

mfd: tps65910: Remove unused data

The 'io_mutex' is not used anywhere.
The regmap API supports the mutex internally, so no additional mutex
is required.

And 'domain' private data is unnecessary because the irq domain is
already registered by using regmap_add_irq_chip().

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>


# 4740f73f 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu>

mfd: remove use of __devexit

CONFIG_HOTPLUG is going away as an option so __devexit is no
longer needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
Cc: Peter Tyser <ptyser@xes-inc.com>
Cc: Daniel Walker <dwalker@fifo99.com>
Cc: Bryan Huntsman <bryanh@codeaurora.org>
Acked-by: David Brown <davidb@codeaurora.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# f791be49 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu>

mfd: remove use of __devinit

CONFIG_HOTPLUG is going away as an option so __devinit is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
Cc: Peter Tyser <ptyser@xes-inc.com>
Cc: Daniel Walker <dwalker@fifo99.com>
Cc: Bryan Huntsman <bryanh@codeaurora.org>
Acked-by: David Brown <davidb@codeaurora.org>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 84449216 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu>

mfd: remove use of __devexit_p

CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
Cc: Peter Tyser <ptyser@xes-inc.com>
Cc: Daniel Walker <dwalker@fifo99.com>
Cc: Bryan Huntsman <bryanh@codeaurora.org>
Acked-by: David Brown <davidb@codeaurora.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 17143e38 13-Nov-2012 Laxman Dewangan <ldewangan@nvidia.com>

mfd: tps65910: Pass irq_domain when adding mfd sub devices

When adding the sub device "tps65910-rtc", is it passed the
IO resource IRQ for the interrupt number. This interrupt needs
to map in the device irq domain. Pass the irq domain of device
in mfd_add_devices() so that proper irq mapping can be done when
adding the sub device RTC.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>


# 4aab3fad 13-Nov-2012 Laxman Dewangan <ldewangan@nvidia.com>

mfd: tps65910: Move interrupt implementation code to mfd file

In place of implementing the irq support in separate file,
moving implementation to main mfd file.
The irq files only contains the table and init steps only
and does not need extra file to have this only for this
purpose.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>


# 10ecb80e 13-Nov-2012 Laxman Dewangan <ldewangan@nvidia.com>

mfd: tps65910: Initialize mfd devices after all initialization done

Add sub devices of tps65910 after all initialization like interrupt,
clock etc. is done. This will make sure that require data gets
initialized properly before sub devices probe's get called.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>


# 5863eabb 21-Sep-2012 Venu Byravarasu <vbyravarasu@nvidia.com>

mfd: tps65910: Add alarm interrupt of TPS65910 RTC to mfd device list

Add RTC alarm interrupt details to TPS65910 MFD device list, to support
RTC alarm events.

Signed-off-by: Venu Byravarasu <vbyravarasu@nvidia.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>


# 0848c94f 11-Sep-2012 Mark Brown <broonie@opensource.wolfsonmicro.com>

mfd: core: Push irqdomain mapping out into devices

Currently the MFD core supports remapping MFD cell interrupts using an
irqdomain but only if the MFD is being instantiated using device tree
and only if the device tree bindings use the pattern of registering IPs
in the device tree with compatible properties. This will be actively
harmful for drivers which support non-DT platforms and use this pattern
for their DT bindings as it will mean that the core will silently change
remapping behaviour and it is also limiting for drivers which don't do
DT with this particular pattern. There is also a potential fragility if
there are interrupts not associated with MFD cells and all the cells are
omitted from the device tree for some reason.

Instead change the code to take an IRQ domain as an optional argument,
allowing drivers to take the decision about the parent domain for their
interrupts. The one current user of this feature is ab8500-core, it has
the domain lookup pushed out into the driver.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>


# b079fa72 19-Aug-2012 Bill Huang <bilhuang@nvidia.com>

mfd: dt: tps65910: Add power off control

Add DT property "ti,system-power-controller" telling whether or not this
pmic is in charge of controlling the system power, so the power off
routine can be hooked up to system call "pm_power_off".

Based on the work by:
Dan Willemsen <dwillemsen@nvidia.com>

Signed-off-by: Bill Huang <bilhuang@nvidia.com>
Tested-by: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>


# 55692af5 11-Sep-2012 Mark Brown <broonie@opensource.wolfsonmicro.com>

mfd: core: Push irqdomain mapping out into devices

Currently the MFD core supports remapping MFD cell interrupts using an
irqdomain but only if the MFD is being instantiated using device tree
and only if the device tree bindings use the pattern of registering IPs
in the device tree with compatible properties. This will be actively
harmful for drivers which support non-DT platforms and use this pattern
for their DT bindings as it will mean that the core will silently change
remapping behaviour and it is also limiting for drivers which don't do
DT with this particular pattern. There is also a potential fragility if
there are interrupts not associated with MFD cells and all the cells are
omitted from the device tree for some reason.

Instead change the code to take an IRQ domain as an optional argument,
allowing drivers to take the decision about the parent domain for their
interrupts. The one current user of this feature is ab8500-core, it has
the domain lookup pushed out into the driver.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>


# d02e83cb 11-Jul-2012 Johan Hovold <johan@kernel.org>

mfd: Add tps65910 32-kHz-crystal-input init

Replace tps65910_misc_init with a dedicated init function for the
32-kHz-crystal input, and make the code more readable.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>


# bcc1dd4c 27-Jun-2012 Johan Hovold <johan@kernel.org>

mfd: Add device-tree entry to enable tps65910 external 32-kHz oscillator

Add device-tree entry to enable external 32-kHz crystal oscillator
input.

Compile-only tested.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>


# 712db99d 27-Jun-2012 Johan Hovold <johan@kernel.org>

mfd: Add support for enabling tps65910 external 32-kHz oscillator

Add flag to platform data to enable external 32-kHz crystal oscillator
(or square wave) input.

The tps6591x can use either an internal 32-kHz RC oscillator or an
external crystal (or square wave) to generate the 32-kHz clock.

The default setting depends on the selected boot mode. In boot mode 00
the internal RC oscillator is used at power-on, but the external crystal
oscillator (or square wave) can be enabled by clearing the ck32k_ctrl
flag in the device control register.

Note that there is no way to switch from the external crystal oscillator
to the internal RC oscillator.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>


# dcc7dabd 18-May-2012 Laxman Dewangan <ldewangan@nvidia.com>

mfd: Remove the parsing of dt info for tps65910 gpio

Remove the parsing of device node information for sub devices
from core file.
The sub devices will parse the information as per the sub-devices
specific information.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>


# cb8d8654 18-May-2012 Laxman Dewangan <ldewangan@nvidia.com>

mfd: Save device node parsed platform data for tps65910 sub devices

Save the allocated memory to store the parsed device node information
to the global device structure so that sub devices can directly use this
pointer.
In this way, the sub devices does not require to re-allocate the
memory for storing the sub-devices specific device node information.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>


# 7f65f74c 11-May-2012 Samuel Ortiz <sameo@linux.intel.com>

mfd: Fix tps65910 build failure

The tps65910_parse_dt() prototype for !CONFIG_OF was not correct, leading to:

drivers/mfd/tps65910.c: In function ‘tps65910_i2c_probe’:
drivers/mfd/tps65910.c:218:3: error: too many arguments to function ‘tps65910_parse_dt’

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>


# 32df986e 11-May-2012 Laxman Dewangan <ldewangan@nvidia.com>

mfd: Register tps65910 gpios as an mfd device

As gpio support for tps65910 is on gpio driver, registering
gpio support as the mfd sub devices instead of calling gpio_init()
from the core probe.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>


# 63fe7dee 10-May-2012 Laxman Dewangan <ldewangan@nvidia.com>

mfd: Convert all tps65910 allocation to devm_*

Convert memory allocation and regmap initialization to
use devm_* functions.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>


# 3bf6bf9b 09-May-2012 Laxman Dewangan <ldewangan@nvidia.com>

mfd: Cache tps65910 register when we need it

During regmap initialization, we do not provide the default value and
hence in place of caching register during regmap_init(), cache it
when actually we need it i.e. after reading of that register.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>


# cd4209ce 11-May-2012 Rhyland Klein <rklein@nvidia.com>

mfd: Add tps65910 device-tree support

Add device tree based initialization support for TI's tps65910 pmic.

Signed-off-by: Rhyland Klein <rklein@nvidia.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>


# 3f7e8275 08-May-2012 Rhyland Klein <rklein@nvidia.com>

mfd: Commonize tps65910 regmap access through header

This change removes the read/write callback functions in favor of common
regmap accessors inside the header file. This change also makes use of
regmap_read/write for single register access which maps better onto what this
driver actually needs.

Signed-off-by: Rhyland Klein <rklein@nvidia.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>


# 63745d40 07-May-2012 Mark Brown <broonie@opensource.wolfsonmicro.com>

mfd: Fix tps65910 section annotations

A warning was being generated by the reference from tps65910_i2c_probe()
to tps65910_sleepinit() since the latter was annotated as __init but the
former was unannotated. Since these functions can only be called during
device init make them both __devinit, and while we're at it also annotate
tps65910_i2c_remove() __devexit for symmetry.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>


# 201cf052 17-Apr-2012 Laxman Dewangan <ldewangan@nvidia.com>

mfd: Add support for tps65910 device sleep

Adding support for device sleep through the external input control
signal "SLEEP".
Changing the SLEEP signal state can switch the device into SLEEP and
ACTIVE state.
Also adding sleep configuration for different resources so that they
should be keep on during sleep state of device.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>


# 39ecb037 07-Mar-2012 Laxman Dewangan <ldewangan@nvidia.com>

mfd: Use correct variable name for tps65910 regmap config

This was the copy-paste issue in reg cache support code where
variable name for regmap config was not really starting from
the device name, it was starting from some other device name.
Fixing this so that variable name contains actual device name.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>


# dc9913a0 21-Feb-2012 Laxman Dewangan <ldewangan@nvidia.com>

mfd: Use regmap for tps65910 register access.

Using regmap apis for accessing the device registers and
using RBTREE caching mechanims for caching registers.

Enabling caching of the registers which is used for voltage
controls. By doing this, the modify_bits operation is faster as
it does not involve the i2c register read from device, just read
from cache. This results faster set voltage operation.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>


# 1773140f 18-Jan-2012 Laxman Dewangan <ldewangan@nvidia.com>

mfd: Initialize tps65910 irq platform data properly

irq_base of the tps65910 irq platform data should be
initialized with the board provided irq_base data.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>


# 0a35ee47 18-Jan-2012 Laxman Dewangan <ldewangan@nvidia.com>

mfd: Initialize tps65910 irq platform data properly

irq_base of the tps65910 irq platform data should be
initialized with the board provided irq_base data.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>


# 1e351a95 14-Dec-2011 Afzal Mohammed <afzal@ti.com>

mfd: Make TPS65910 usable without interrupts

TPS65910 can be used without interrupts.
Hence let probe succeed in case interrupt can't be
configured and let Kernel only to complain about it

Signed-off-by: Afzal Mohammed <afzal@ti.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>


# 8f6a459a 22-Nov-2011 Marcus Folkesson <marcus.folkesson@gmail.com>

mfd: Handle tps65910 clear-mask correctly

The function is not actually cleaing the bitmask.

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>


# b1224cd1 13-Jul-2011 Jesper Juhl <jj@chaosbits.net>

mfd: Avoid two assignments if failures happen in tps65910_i2c_probe

In drivers/mfd/tps65910.c:tps65910_i2c_probe() there's potential for a
tiny optimization.

We assign to init_data->irq and init_data->irq_base long before we
need them, and there are two potential exits from the function before
they are needed.

Moving the assignments below these two potential exits means we
completely avoid doing them in these two (failure) cases.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Acked-by: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>


# dc7e412d 05-Jul-2011 Jesper Juhl <jj@chaosbits.net>

mfd: Don't leak init_data in tps65910_i2c_probe

There are a couple of situations where we leak init_data in
drivers/mfd/tps65910.c:tps65910_i2c_probe() - this patch should take
care of them.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>


# ec2328c3 20-Jun-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

mfd: Implement tps65910 IRQ cleanup

The tps65910_irq_exit() cleanup function was generating a warning from
sparse due to the lack of a prototype. This wasn't causing GCC warnings
as the driver wasn't cleaning up its IRQs on exit at all so there was no
use of an unprototyped function.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>


# 79557056 16-May-2011 Jorge Eduardo Candelaria <jedu@slimlogic.co.uk>

MFD: TPS65910: Add support for TPS65911 device

The TPS65911 is the next generation of the TPS65910 family of
PMIC chips. It adds a few features:

- Watchdog Timer
- PWM & LED generators
- Comparators for system control status

It also adds a set of Interrupts and GPIOs, among other things.

The driver exports a function to identify between different
versions of the tps65910 family, allowing other modules to
identify the capabilities of the current chip.

Signed-off-by: Jorge Eduardo Candelaria <jedu@slimlogic.co.uk>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>


# 0514e9ac 16-May-2011 Axel Lin <axel.lin@gmail.com>

mfd: Fix off-by-one value range checking for tps65910_i2c_write

If bytes == (TPS65910_MAX_REGISTER + 1), we have a buffer overflow when
doing memcpy(&msg[1], src, bytes).

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>


# e3471bdc 02-May-2011 Graeme Gregory <gg@slimlogic.co.uk>

TPS65910: IRQ: Add interrupt controller

This module controls the interrupt handling for the tps chip. The
interrupt sources are the following:

- GPIO falling/rising edge detection
- Battery voltage below/above threshold
- PWRON signal
- PWRHOLD signal
- Temperature detection
- RTC alarm and periodic event

Signed-off-by: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Jorge Eduardo Candelaria <jedu@slimlogic.co.uk>
Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>


# 2537df72 02-May-2011 Graeme Gregory <gg@slimlogic.co.uk>

TPS65910: GPIO: Add GPIO driver

TPS65910 has one configurable GPIO that can be used for several
purposes. Subsequent versions of the TPS chip support more than
one GPIO.

Signed-off-by: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Jorge Eduardo Candelaria <jedu@slimlogic.co.uk>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>


# 27c6750e 02-May-2011 Graeme Gregory <gg@slimlogic.co.uk>

MFD: TPS65910: Add new mfd device for TPS65910

The TPS65910 chip is a power management IC for multimedia and handheld
devices. It contains the following components:

- Regulators
- GPIO controller
- RTC

The tps65910 core driver is registered as a platform driver and provides
communication through I2C with the host device for the different
components.

Signed-off-by: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Jorge Eduardo Candelaria <jedu@slimlogic.co.uk>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>