[go: nahoru, domu]

History log of /drivers/mfd/ab8500-core.c
Revision Date Author Comments
72ef8e4b3bff21e62bba82c40d7b412a305c3a78 30-Jul-2014 Fabio Estevam <fabio.estevam@freescale.com> mfd: ab8500-core: Use 'ifdef' for config options

The config symbol 'CONFIG_DEBUG_FS' should be protected by a 'ifdef' instead
of a plain 'if'.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
7ccf40b1a1aa060cc0c95bf00cf66f9e88636404 08-May-2014 Lee Jones <lee.jones@linaro.org> mfd: ab8500-core: Resolve code style issues

Soothes the following checkpatch warnings:

WARNING: line over 80 characters
#151: FILE: drivers/mfd/ab8500-core.c:151:
+ 0, 1, 2, 3, 4, -1, -1, -1, -1, 11, 18, 19, 20, 21, 12, 13, 24, 5, 22, 23,

ERROR: spaces required around that '=' (ctx:VxW)
#325: FILE: drivers/mfd/ab8500-core.c:325:
+ ret= mask_and_set_register_interruptible(ab8500, bank, reg,
^

WARNING: line over 80 characters
#418: FILE: drivers/mfd/ab8500-core.c:418:
+ else if (offset >= AB9540_INT_GPIO50R && offset <= AB9540_INT_GPIO54R)

WARNING: line over 80 characters
#420: FILE: drivers/mfd/ab8500-core.c:420:
+ else if (offset == AB8540_INT_GPIO43R || offset == AB8540_INT_GPIO44R)

ERROR: spaces required around that '==' (ctx:VxV)
#454: FILE: drivers/mfd/ab8500-core.c:454:
+ if ((i==3) && (*offset >= 24))
^

ERROR: code indent should use tabs where possible
#576: FILE: drivers/mfd/ab8500-core.c:576:
+ .map = ab8500_irq_map,$

WARNING: please, no spaces at the start of a line
#576: FILE: drivers/mfd/ab8500-core.c:576:
+ .map = ab8500_irq_map,$

ERROR: code indent should use tabs where possible
#577: FILE: drivers/mfd/ab8500-core.c:577:
+ .xlate = irq_domain_xlate_twocell,$

WARNING: please, no spaces at the start of a line
#577: FILE: drivers/mfd/ab8500-core.c:577:
+ .xlate = irq_domain_xlate_twocell,$

WARNING: char * array declaration might be better as static const
#1554: FILE: drivers/mfd/ab8500-core.c:1554:
+ static char *switch_off_status[] = {

WARNING: char * array declaration might be better as static const
#1563: FILE: drivers/mfd/ab8500-core.c:1563:
+ static char *turn_on_status[] = {

WARNING: sizeof *ab8500 should be sizeof(*ab8500)
#1582: FILE: drivers/mfd/ab8500-core.c:1582:
+ ab8500 = devm_kzalloc(&pdev->dev, sizeof *ab8500, GFP_KERNEL);

ERROR: space required after that close brace '}'
#1639: FILE: drivers/mfd/ab8500-core.c:1639:
+ }/* Configure AB8500 or AB9540 IRQ */

WARNING: line over 80 characters
#1652: FILE: drivers/mfd/ab8500-core.c:1652:
+ ab8500->oldmask = devm_kzalloc(&pdev->dev, ab8500->mask_size, GFP_KERNEL);

WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1677: FILE: drivers/mfd/ab8500-core.c:1677:
+ printk(KERN_CONT " \"%s\"",

WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1682: FILE: drivers/mfd/ab8500-core.c:1682:
+ printk(KERN_CONT "\n");

WARNING: Prefer [subsystem eg: netdev]_cont([subsystem]dev, ... then dev_cont(dev, ... then pr_cont(... to printk(KERN_CONT ...
#1684: FILE: drivers/mfd/ab8500-core.c:1684:
+ printk(KERN_CONT " None\n");

WARNING: printk() should include KERN_ facility level
#1695: FILE: drivers/mfd/ab8500-core.c:1695:
+ printk("\"%s\" ", turn_on_status[i]);

WARNING: printk() should include KERN_ facility level
#1700: FILE: drivers/mfd/ab8500-core.c:1700:
+ printk("None\n");

total: 5 errors, 14 warnings, 1869 lines checked

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
f35563027f4555fee8a6ee5a8c775cbf0c9ad4ef 02-Jul-2014 Lee Jones <lee.jones@linaro.org> mfd: ab8500-core: Remove pointless else in if statement

Save a line of code (albeit, it's replaced by a blank line, but
still), as the else is superfluous.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
7602e05df73f3c775d5ef808c0bc4af9711e4438 02-Jun-2014 Grygorii Strashko <grygorii.strashko@ti.com> mfd: ab8500: Fix dt irq mapping

The AD8500 defines itself as interrupt-controller in DT,
but it doesn't assign DT node to IRQ domain when creates it.
As result, of_irq_xx() helpers don't work because they can't
find necessary IRQ domain.

Hence, fix it by assigning AD8500 core device DT node to IRQ
domain when it's created.

This patch fixes STE u8500 Snowball boot failure reported by Kevin Hilman
https://lkml.org/lkml/2014/5/27/624

Reported-and-tested-by: Kevin Hilman <khilman@linaro.org>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
f864c46aae4cb6aed09e98615c427fcc4f1de104 04-Feb-2014 Linus Walleij <linus.walleij@linaro.org> mfd: dbx500/abx500: root out hardcoded IRQ assignments

The DBx500 and ABx500 should be getting their IRQs from the
device tree and nowhere else. Get rid of all the static assignments
everywhere, delete it from the driver, platform data and the
board files in one swift strike.

Lots of cross-dependencies in the MFD drivers for PRCMU and
AB8500 makes it necessary to strike everywhere at once to
eradicate IRQs passed as resources and platform data to the left
and right around the platform.

Cc: Mark Brown <broonie@kernel.org>
Cc: Samuel Ortiz <sameo@linux.intel.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
ed83d301eac2ca7c1315d0e283e1c14c07a53e16 03-Dec-2013 Linus Walleij <linus.walleij@linaro.org> mfd: ab8500: Use irqdomain to map interrupts

All subdrivers use the irqdomain to demux AB8500 IRQs but here
in the hierarchical path we find a leftover instance using the
hard-coded IRQ base. Convert it to use irqdomain with a
oneliner.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
5ac98553afe41ffb5513fa8aac6df699a70231a3 18-Nov-2013 Geert Uytterhoeven <geert@linux-m68k.org> mfd: 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>
53f325be2f99fb1e5dbbfc1f7707a9a6c97c83c2 07-Jun-2013 Lee Jones <lee.jones@linaro.org> mfd: ab8500-core: Add AB8500 external regulators as MFD devices

The AB8500 external regulator driver is now a device in its own right,
so it requires registering and probing in the normal way. This patch
will ensure the driver is probed once registered for all devices which
support them.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
fccf14ad1e4f09a4033908ead9bf3f393979d54b 30-May-2013 Fabio Baltieri <fabio.baltieri@linaro.org> mfd: ab8500-core: Add of_compatible property for ab8500-codec

Add of_compatible string to the ab8500-codec cell to allow the driver to
grab handlers such as regulators from device-tree when available.

Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
9c717cf3fa16f8ae8c6ccb8f4f8e784404ac9689 24-May-2013 Alexandre Torgue <alexandre.torgue@st.com> mfd: ab8500-core: Add device for new RTC version for AB8540 cut2

AB8540 RTC have changed between AB8540_cut1 and AB8540_cut2.Different
ressources to define for those two version.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Julien Delacou <julien.delacou@stericsson.com>
Signed-off-by: Alexandre Torgue <alexandre.torgue@st.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2809126512fcbd61ce3140af0bc255b441fcdaf9 13-Jun-2013 Lee Jones <lee.jones@linaro.org> mfd: ab8500-core: Drop references to ab8500-leds

The ab8500-leds driver has never been upstreamed and was replaced by a
PWM framework based driver, so these references are not needed anymore.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
955de2eab3fd89bc6d5735817710926ba5817450 08-May-2013 Lee Jones <lee.jones@linaro.org> mfd: ab8500-core: Pass GPADC compatible string to MFD core

When booting with Device Tree enabled the MFD core uses each device's
compatible string to find and allocate its associated of_node pointer,
which in turn is passed to the driver via the platform_device struct.
Without it, the driver won't be able to interrogate the Device Tree or
locate suitable regulators and will most likely fail to probe.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
eb696c3181dd5b2266794776519120abdfe127d9 07-May-2013 Lee Jones <lee.jones@linaro.org> mfd: ab8500-core: Use the correct driver name when enabling gpio/pinctrl

When we're using Device Tree to enable GPIO drivers we're forced to be
OS agnostic, thus we are forbidden use names like pinctrl as they are
specific only to Linux, at least for the time being. However, when we
are registering devices using internal systems such as MFD or platform
registration, we can use such terminology. In this case we can and
should use the platform device ID mechanism to specify which device we
wish to utilise by detailing pinctrl-<device_name>.

This patch fixes a regression that when booting with Device Tree
enabled the ABx500 GPIO/Pinctrl devices are not probed.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
6999181eecb11863b78030c68037a9f851522735 12-Apr-2013 Linus Walleij <linus.walleij@linaro.org> mfd: ab8500: Pass AB8500 IRQ to debugfs code by resource

The AB8500 debug code which was merged in parallell with the
multiplatform work incidentally introduced a new instance using
the <mach/irqs.h> header which is now deleted, causing this
build regression:

drivers/mfd/ab8500-debugfs.c:95:23:
fatal error: mach/irqs.h: No such file or directory
compilation terminated.
make[4]: *** [drivers/mfd/ab8500-debugfs.o] Error 1

The code most certainly never worked with device tree either
since that does not rely on this kind of hard-coded interrupt
numbers.

Fix the problem at the root by passing it as a named resource
from the ab8500-core driver. Use an untyped resource to
stop the MFD core from remapping this IRQ relative to the
AB8500 irqdomain.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
f201f730b82393aa4969171d724025a82f7099da 09-Apr-2013 Fabio Baltieri <fabio.baltieri@linaro.org> mfd: ab8500-core: Add of_compatilbe property for ab8500-usb

Add of_comptabile string to the ab8500-usb cell to allow the driver to
grab properties from device-tree when available.

Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
7a93fb375437225ee89a15652a887547450f3d2a 21-Mar-2013 Fabio Baltieri <fabio.baltieri@linaro.org> mfd: ab8500-core: Ignore masked out interrupts

AB8500 asserts LATCH bits for masked out interrupts. This patch
explicitly masks those out using the cached mask value to prevent
handle_nested_irq() being called for masked IRQ on the same register as
unmasked ones.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
93ff722e88530b9719cbf53be4f3197722461394 31-May-2012 Lee Jones <lee.jones@linaro.org> ab8500-fg: Add power cut feature for ab8505 and ab8540

Add support for a power cut feature which allows user to
configure when ab8505 and ab8540 based platforms should shut
down system due to low battery.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
f348fefd2a227122eb2d723e255c60cf491d0557 26-Nov-2012 Dariusz Szymczak <dariusz.xd.szymczak@stericsson.com> mfd: ab8500-core: Hierarchical interrupt registers

Make use of the hierarchical interrupt rergister called
ITLatchHier1 - 3 also for the 8500 platform (currently the
hierarchical interrupt registers are used only for the 8540
and 9540 platforms). This will make the interrupt routing
go faster since fewer i2c reads need to made in the most
common cases.

Signed-off-by: Dariusz Szymczak <dariusz.xd.szymczak@stericsson.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Mian Yousaf KAUKAB <mian.yousaf.kaukab@stericsson.com>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
9ee17676a5a36621db020c596e766fec24aae959 20-Nov-2012 Ulf Hansson <ulf.hansson@stericsson.com> mfd: ab8500-core: Add abx500-clk as an mfd child device

Hierarchically, the abx500-clk shall be considered as a child of the
ab8500 core. The abx500-clk is intiated at arch init and thus the clks
will be available when clients needs them.

Signed-off-by: Ulf Hansson <ulf.hansson@stericsson.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Philippe LANGLAIS <philippe.langlais@stericsson.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@stericsson.com>
Reviewed-by: Gabriel FERNANDEZ <gabriel.fernandez@stericsson.com>
Reviewed-by: Philippe BEGNIC <philippe.begnic@stericsson.com>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
abee26cdb685fa47d3d17ec9cf39f6149ce67083 28-Sep-2012 Mattias Wallin <mattias.wallin@stericsson.com> mfd: ab8500-core: Show turn on status at boot

Several states can be detected when a device is initially turned on.
This patch displays these states in the log. If none of the states
are true, then we report that too.

Signed-off-by: Mattias Wallin <mattias.wallin@stericsson.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Marcus COOPER <marcus.xm.cooper@stericsson.com>
Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
492390c8fd4a90b1e4ca371c8f8a23c63b04d7f9 25-Feb-2013 Lee Jones <lee.jones@linaro.org> mfd: ab8500-core: Add additional resources to ab8505_iddet_resources

Add VBUS_DET_R, VBUS_DET_F IRQ, ID_DET_PLUGR and ID_DET_PLUGF IRQ
information to ab8505_iddet_resources. These are required to get
interrupts for AB8505 cut-2.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
e436ddff5748c459853bb3fb97550a9b8b647b8d 26-Feb-2013 Lee Jones <lee.jones@linaro.org> mfd: ab8500-debugfs: Add tests for ab8540 based platform initialisations

Signed-off-by: Alexandre Torgue <alexandre.torgue@stericsson.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Marcus COOPER <marcus.xm.cooper@stericsson.com>
Reviewed-by: Mattias WALLIN <mattias.wallin@stericsson.com>
Tested-by: Maxime COQUELIN <maxime.coquelin@stericsson.com>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
3e1a498f2728476535571d270081a17fdfceaf26 25-Feb-2013 Lee Jones <lee.jones@linaro.org> mfd: ab8500-core: Add Interrupt support for ab8540

ITSource/ITLatch 7, 8, 9 and 10 don't exist on AB8540. This patch
replaces them with '-1' in the interrupt list, and handles the '-1'
in the code accordingly.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
4b106fb9895c7edba2acd41c152e8f6edf724651 25-Feb-2013 Lee Jones <lee.jones@linaro.org> mfd: ab8500-core: Rework MFD sub-device initialisation structures

Here we're separating Battery Management devices into their own
structure, removing the common device structure & redistribute them
amongst the individual platform structs and completing the population
of them.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
c0eda9aef1c0ef7bb2812b739ddf400405568bef 12-Feb-2013 Lee Jones <lee.jones@linaro.org> mfd: ab8500-core: Add ADC support for ab8540

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
a29264b68a93556a09005b9f18cbd3f61f6fd355 25-Feb-2013 Lee Jones <lee.jones@linaro.org> mfd: ab8500-core: APE Interrupts are not cleared

There are missing register descriptions from the AB8505 user manual
and these need to be masked so that the APEINT line can toggle.
This patch also affects the behaviour of AB9540.

Signed-off-by: Marcus Cooper <marcus.xm.cooper@stericsson.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Maxime COQUELIN <maxime.coquelin@stericsson.com>
Reviewed-by: Alexandre TORGUE <alexandre.torgue@stericsson.com>
Reviewed-by: Mattias WALLIN <mattias.wallin@stericsson.com>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
f04a9d8adf766c480353c0f2427e641251c9b059 30-May-2012 Rajkumar Kasirajan <rajkumar.kasirajan@stericsson.com> mfd: ab8500-sysctrl: Update correct turn on status

In L9540, turn_on_status register is not updated correctly if
the device is rebooted with AC/USB charger connected. Due to
this, the device boots android instead of entering into charge
only mode. Read the AC/USB status register to detect the charger
presence and update the turn on status manually.

Signed-off-by: Rajkumar Kasirajan <rajkumar.kasirajan@stericsson.com>
Signed-off-by: Per Forlin <per.forlin@stericsson.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Rupesh KUMAR <rupesh.kumar@stericsson.com>
Reviewed-by: Philippe LANGLAIS <philippe.langlais@stericsson.com>
Tested-by: Rupesh KUMAR <rupesh.kumar@stericsson.com>
Tested-by: Philippe LANGLAIS <philippe.langlais@stericsson.com>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
151621a704fc7b8eaa1d6905bec0c6388b0a57af 30-Jan-2013 Hongbo Zhang <hongbo.zhang@linaro.org> mfd: ab8500: Rename ab8500 to abx500 for hwmon driver

We are using a generic abx500 hwmon layer, so rename specific ab8500 to generic
abx500 for hwmon device and driver matching.

Signed-off-by: Hongbo Zhang <hongbo.zhang@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
e64d905e28031031c52db403826cd3bfe060b181 16-Jan-2013 Lee Jones <lee.jones@linaro.org> mfd: ab8500: allow AB9540 based devices to use ABX500 pinctrl

The old AB8500 GPIO driver has been un-BROKEN and converted into a
multi-platform pinctrl driver. If any AB9540 based devices wish to
request any GPIO pins that it offers, they can after this patch.

Cc: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
7d56a46e876aa89dcac921d3afab5cccace15e63 16-Jan-2013 Lee Jones <lee.jones@linaro.org> mfd: ab8500: ensure new AB8500 pinctrl driver is probed correctly

The old, BROKEN AB8500 GPIO driver has been revamped as a shiny
new pinctrl driver and has been renamed as such. So, if we would
like to make use of it, we need to register it via its new name.

Cc: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
40f6e5a2b52eda7864b7167fb5af1c310b464766 07-Jan-2013 Lee Jones <lee.jones@linaro.org> mfd: ab8500: provide a irq_set_type() function

In the AB8500 IRQ mask and unmask functions, we rely on testing for
IRQ_TYPE_EDGE_RISING and IRQ_TYPE_EDGE_FALLING interrupts to
physically mask and unmask the correct interrupt lines. In order
for us to do that, the trigger needs to be set in the associated
flags. However, unless a irq_set_type() function pointer is passed
when registering the IRQ chip, the IRQ subsystem will refuse to do
it. For that reason, we're providing one.

Cc: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
e2ddf46ab4ab40a657a1808cf4e358c46ae1ba68 06-Feb-2013 Linus Walleij <linus.walleij@stericsson.com> mfd: ab8500: actually handle the AB8500 GPIO IRQs correctly

The patch:
"mfd: ab8500: prepare to handle AB8500 GPIO's IRQs correctly"
altered the AB8500 IRQ mask/unmask functions such that they
would handle masking on/off the falling edge IRQ if this was
requested by the consumer. However the bit mask for hwirqs
43 and 44 was shifting the bit mask incorrectly, resulting in
the wrong IRQ being mased/unmasked.

Further while the patch would mask/unmask the correct line,
when the interrupt actually came in, it would still be treated
as a valid hwirq. The offsetting applied when masking/unmasking
was not applied when handling the IRQ, i.e. the falling edge
lines were not routed back to the rising edge lines.

This fixes both cases. The end result has been tested with
the SIM detect IRQ, GPIO12, hwirq 46 and 62.

Cc: Samuel Ortiz <sameo@linux.intel.com>
Cc: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
9c677b9b74d4314ed7f222bf802d6d1e7585eb65 20-Dec-2012 Lee Jones <lee.jones@linaro.org> mfd: ab8500: prepare to handle AB8500 GPIO's IRQs correctly

In an upcoming patch, the gpio-ab8500 driver will relinquish all
IRQ handling capability and pass it back into the AB8500 core
driver. This will aid in reducing massive code duplication within
the kernel. Also, most of the functionality is already in the
AB8500 core driver, as the GPIO IRQs are actually sandwiched
between lots of other IRQs which the core driver already handles.

All we're doing here is providing the core driver with knowledge
that each GPIO has two IRQs assigned to it; one for rising and
a separate one for falling.

Cc: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8f0eb43be5f461a28341fe724686f265b0719dd3 14-Feb-2012 Bengt Jonsson <bengt.g.jonsson@stericsson.com> mfd: ab8500-debugfs: Add interrupt debug

This patch adds an entry in debugfs to check number of interrupts
from the AB.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com>
Reviewed-by: Rabin VINCENT <rabin.vincent@stericsson.com>
1d843a6c8c2067615fea0ff8cb62d4a5c4a6f8ae 27-Jan-2012 Mian Yousaf Kaukab <mian.yousaf.kaukab@stericsson.com> mfd: ab8500-core: Allow the possibility to dump all AB8500 registers

Implement an API so that a user may dump all AB8500 registers
via debugfs file access.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mian Yousaf Kaukab <mian.yousaf.kaukab@stericsson.com>
Reviewed-by: Linus WALLEIJ <linus.walleij@stericsson.com>
Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com>
34c11a709e928090cf34ecd706f7d3170f4e5026 22-Feb-2012 Paer-Olof Haakansson <par-olof.hakansson@stericsson.com> u8500-charger: Delay for USB enumeration

If charging is started before USB enumeration of an Accessory
Charger Adapter has finished, the AB8500 will generate a
VBUS_ERROR. This in turn results in timeouts and delays the
enumeration with around 15 seconds. This patch delays the
charging and then ramps currents slowly to avoid VBUS errors.
The delay allows the enumeration to have finished before
charging is turned on.

Signed-off-by: Martin Sjoblom <martin.w.sjoblom@stericsson.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com>
Tested-by: Jonas ABERG <jonas.aberg@stericsson.com>
00441b5e6b98ad6a50b5cb7f88d473e3ea1e0d75 09-Jan-2013 Lee Jones <lee.jones@linaro.org> mfd: Fix compile errors and warnings when !CONFIG_AB8500_BM

drivers/mfd/ab8500-core.c:1015:21: error: ‘ab8500_bm_data’ undeclared here

include/linux/mfd/abx500/ab8500-bm.h:445:13: warning: ‘ab8500_fg_reinit’ defined but not used
include/linux/mfd/abx500/ab8500-bm.h:448:13: warning: ‘ab8500_charger_usb_state_changed’ defined but not used
include/linux/mfd/abx500/ab8500-bm.h:451:29: warning: ‘ab8500_btemp_get’ defined but not used
include/linux/mfd/abx500/ab8500-bm.h:455:12: warning: ‘ab8500_btemp_get_batctrl_temp’ defined but not used
include/linux/mfd/abx500/ab8500-bm.h:463:12: warning: ‘ab8500_fg_inst_curr_blocking’ defined but not used
include/linux/mfd/abx500/ab8500-bm.h:442:12: warning: ‘ab8500_fg_inst_curr_done’ defined but not used
include/linux/mfd/abx500/ab8500-bm.h:447:26: warning: ‘ab8500_fg_get’ defined but not used

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
23a04f9f40f2b32ee593b768483105b1c776814d 29-Nov-2012 Lee Jones <lee.jones@linaro.org> ab8500_bm: Always send platform specific battery information via pdata

Currently the AB8500 battery management subsystem receives platform
specific information via two different means depending on how the
platform is booted. If DT is not enabled, a reference to a *_bm_data
data structure containing each platform specific attribute is passed
though platform_data. However, if DT is enabled, then platform_data
is empty and the reference is gained though a DT specific probe
function. There are two issues here 1) the same reference is
being collected each time and 2) the DT way doesn't allow any
provisions to select different platform specific attributes, which
kind of defeats the object.

Cc: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
4e1328be4d4e4967d54bf7ae3b0805ec53fc4f91 23-Nov-2012 Tushar Behera <tushar.behera@linaro.org> mfd: ab8500-core: Fix invalid free of devm_ allocated data

The objects allocated by devm_* APIs are managed by devres and are
freed when the device is detached. Hence there is no need to remove
them explicitly in remove function.

Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
4740f73fe5388ab5d22d552d2a0dacc62418a70c 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>
a9e9ce4c41672cf3f6fcb1288bfd6b26c1f2a917 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu> mfd: remove use of __devinitdata

CONFIG_HOTPLUG is going away as an option so __devinitdata 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>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
f791be492f76dea7b0641ed227a60eeb2fa7e255 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>
84449216b01f9c2b4c9b1882f9d6abba07b7b7ca 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>
916a871c48ef3ecbc4cac8f185c03160d0b42bfd 22-Nov-2012 Ulf Hansson <ulf.hansson@linaro.org> mfd: ab8500-core: Add abx500-clk as an mfd child device

Hierarchically, the abx500-clk shall be considered as a child of the
ab8500 core. The abx500-clk is intiated at arch init and thus the clks
will be available when clients needs them.

Cc: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
a12810ab9fcf0c9fd5e50b5e350a3ffbeaa571be 31-Oct-2012 Rajanikanth H.V <rajanikanth.hv@stericsson.com> ab8500: Add devicetree support for chargalg

This patch adds device tree support for charging algorithm driver

Signed-off-by: Rajanikanth H.V <rajanikanth.hv@stericsson.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
4aef72dbb2e8997e627dd94ae2b9109dc09fffaa 19-Nov-2012 Rajanikanth H.V <rajanikanth.hv@stericsson.com> ab8500: Add devicetree support for charger

This patch adds device tree support for ab8500-charger driver

Signed-off-by: Rajanikanth H.V <rajanikanth.hv@stericsson.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
bd9e8ab2d58d2183aa723bf0eb8e07d4362b4975 19-Nov-2012 Rajanikanth H.V <rajanikanth.hv@stericsson.com> ab8500: Add devicetree support for btemp

This patch adds device tree support for battery-temperature-monitor driver

Signed-off-by: Rajanikanth H.V <rajanikanth.hv@stericsson.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
e0f1abeba5c2d8a2183566717d99294fd1a29c2e 19-Nov-2012 Rajanikanth H.V <rajanikanth.hv@stericsson.com> ab8500: Add devicetree support for fuelgauge

- This patch adds device tree support for fuelgauge driver
- optimize bm devices platform_data usage and of_probe(...)
Note: of_probe() routine for battery managed devices is made
common across all bm drivers.
- test status:
- interrupt numbers assigned differs between legacy and FDT mode.

Signed-off-by: Rajanikanth H.V <rajanikanth.hv@stericsson.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
8c4203cb5814f53169dc4ff084a65dcf509b6f60 05-Nov-2012 Lee Jones <lee.jones@linaro.org> mfd: ab8500-core: Use devm_* memory/IRQ and allocation/free routines

It is better to use devm_* calls, as they allow for easier
and more automatic clean-up. Resources are device allocated,
so when a device is freed, so are all associated resources.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
8ae754ebd5edffa0b2a2bafa4879a9ace01d5477 05-Nov-2012 Lee Jones <lee.jones@linaro.org> mfd: ab8500-core: Remove unused ab8500-gpio IRQ ranges

The IRQ ranges provided in ab8500-core to be passed on to the
ab8500-gpio driver are not only redundant, but they are also
causing a warning in the boot log. These IRQ ranges, like any
other MFD related IRQ resource are passed though MFD core for
automatic conversion to virtual IRQs; however, MFD core does
not support IRQ mapping of IRQ ranges. Let's just remove them.

Acked-by: Arnd Bergmann <arnd@arndb.de>
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
f1d11f394f6e3fc0368e72244fb5ddc4142e804b 18-Oct-2012 Linus Walleij <linus.walleij@linaro.org> mfd/ab8500-core: use irq_domain_add_simple()

To be able to use SPARSE_IRQ while yet not using device tree,
we need to use irq_domain_add_simple() that will allocate
descriptors for the IRQs in the non-DT case, and fall back
to using the linear irqdomain in the DT case.

Cc: Lee Jones <lee.jones@linaro.org>
Cc: Samuel Ortiz <sameo@linux.intel.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
81a21cddaf14bd1144c2d173add7cbdeb95a07ca 27-Jul-2012 Lee Jones <lee.jones@linaro.org> mfd: ab8500-core: Apply the AB8500 CODEC's compatible string to its MFD cell

Provide a compatible string for the AB8500 CODEC to aid in
configuration property look-up from its associated Device Tree
node.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
0a37fc56888c37049f60aab398fddceafd33fe72 09-Aug-2012 Lee Jones <lee.jones@linaro.org> mfd: Use the AB8500's IRQ domain to convert hwirq to virq

Before the AB8500 had its own IRQ domain, the IRQ handler would take
the fired local IRQ (hwirq) and add it to the irq_base to convert it
to an IRQ number which Linux would understand (virq). However, the
IRQ base is not always used anymore since we can make use of Linear
domains. It's better to use the AB8500 hwirq -> virq mapping helper
function to convert them instead. That's what we do here.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
0848c94fb4a5cc213a7fb0fb3a5721ad6e16f096 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>
80633f05b0dbf5819ef28f626f2f0b7c885d1f88 20-Aug-2012 Lee Jones <lee.jones@linaro.org> mfd: ab8500: Make ab8500_irq_get_virq() static

MFD core now takes care of HWIRQ <-> VIRQ mapping, so the helper
ab8500_irq_get_virq() is no longer used by ab8500 subordinate devices
to obtain a Linux wide Virtual IRQ. The AB8500 IRQ controller still
uses it internally though, so we'll just hide it from the rest of the
world by making it static instead.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
55692af5eb587f7592d6c2713e1e0eeaab0f6c31 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>
bad76991d7847b7877ae797cc79745d82ffd9120 02-Jul-2012 Lee Jones <lee.jones@linaro.org> mfd: Register ab8500 devices using the newly DT:ed MFD API

Now the MFD API is Device Tree aware we can use it for platform
registration again, even when booting with DT enabled. To aid in
Device Node pointer allocation we provide each cell with the
associative compatible string.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
b04c530c78464a02963adeed6b6e458535d7cd8f 29-Jun-2012 Jonas Aaberg <jonas.aberg@stericsson.com> mfd: Print ab8500 switch off cause

Instead of just printing the register value, also output some
description of the value.

Signed-off-by: Jonas Aaberg <jonas.aberg@stericsson.com>
Reviewed-by: Mattias Wallin <mattias.wallin@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
6d11d1356cb3b1c009a90b273350f6a88c0b90e0 29-Jun-2012 Lee Jones <lee.jones@linaro.org> mfd: Register the ab8500 from db8500-prcmu using the MFD API

Hierarchically, the AB8500 is a child of the DB8500 PRCMU. So now that
Device Tree is being used and MFD core code is Device Tree aware, we
can simply register DB8500 PRCMU from Device Tree in the normal way
then allow the DB8500 PRCMU driver to register the AB8500 as a simple
MFD device at probe time.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
ba7cbc3e15df1eb34a3a986b52ac82db3a569ab9 11-Jun-2012 Lee Jones <lee.jones@linaro.org> mfd: Initialise the AB8500 driver at core_initcall time

The AB8500 is soon to have its own IRQ domain. For this to be useful
the driver needs to be initialised earlier in the boot sequence. Here
we move initialisation forward from arch_initcall to core_initcall time.

Cc: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
822672a7b496e724f879af703693f342e2215163 20-Jun-2012 Lee Jones <lee.jones@linaro.org> mfd: Generically describe interactions with the DB8500 PRCMU

There is only one method used to communicate with the DB8500 PRCMU, via I2C.
Now this can be assumed, there is no requirement to specify the protocol in
the function name. This patch removes protocol specifics and uses a more
generic naming convention.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
06e589efa5b75e6a38a8e8b9c6cd774b5f679cdc 20-Jun-2012 Lee Jones <lee.jones@linaro.org> mfd: Add IRQ domain support for the AB8500

As the AB8500 is an IRQ controller in its own right, here we provide
the AB8500 driver with IRQ domain support. This is required if we wish
to reference any of its IRQs from a platform's Device Tree.

Cc: Naga Radheshy <naga.radheshy@stericsson.com>
Cc: Mattias Wallin <mattias.wallin@stericsson.com>
Cc: Daniel Willerud <daniel.willerud@stericsson.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
6bc4a568414caab05424b702165a732177daccd0 17-May-2012 Lee Jones <lee.jones@linaro.org> mfd: Enable Device Tree for ab8500-core driver

This patch will allow the ab8500-core driver to be probed and set up
when booting when Device Tree is enabled. This includes platform ID
look-up which identifies the machine it is currently running on. If
we are undergoing a DT enabled boot, we will refuse to setup each of
the other ab8500-* devices, as they will be probed individually by DT.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
d28f1db8187dd1ddc1fa6f380ff0402cf8e4d44d 19-May-2012 Lee Jones <lee.jones@linaro.org> mfd: Remove confusing ab8500-i2c file and merge into ab8500-core

ab8500-i2c is used as core code to register the ab8500 device.
After allocating ab8500 memory, it immediately calls into
ab8500-core where the real initialisation takes place. This
patch moves all core registration and memory allocation into
the true ab8500-core file and removes ab8500-i2c completely.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
7ccfe9b1d58ef5cf8fdbd50b6ee2ae0e9aa9cb36 07-May-2012 Michel JAOUEN <michel.jaouen@stericsson.com> mfd: Support of hierachical interrupt for ab8500

Hierarchical interrupt is supported since ab8500 V2.
However, it is not implemented in the ab8500-core driver.
With the current implementation, when an ab9540 interrupt
occurs, 17 Latch registers are read through i2c. With
hierarchical interrupt implementation, there are only 4 i2c
accesses.

Signed-off-by: Maxime Coquelin <maxime.coquelin@stericsson.com>
Reviewed-by: Michel Jaouen <michel.jaouen@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
6ef9418c9e6fc41e6c1066b6423f3a1625e4b822 17-Apr-2012 Rickard Andersson <rickard.andersson@stericsson.com> mfd: Add parameter to disable ab8500 battery management

This patch makes it possible to disable battery management
via a module boot parameter. When 'ab8500-core.no_bm=1' then
ab8500_btemp, ab8500_chargalg, ab8500_charger and ab8500_fg will
not be probed. This boot parameter is used for scripted testing
of the system.

Signed-off-by: Rickard Andersson <rickard.andersson@stericsson.com>
Reviewed-by: Jonas Aberg <jonas.aberg@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
112a80d29b529d4057777ac2cb4ec15ff5b6d210 17-Apr-2012 Jonas Aaberg <jonas.aberg@stericsson.com> mfd: Deny ab8500 suspend if i2c transfer is ongoing

If we are in the middle of an I2C transfer we need to deny suspend
of the AB8500 core. Implement an atomic reference counter for the
I2C operations to make sure we don't do this.

Signed-off-by: Jonas Aaberg <jonas.aberg@stericsson.com>
Reviewed-by: Mattias Wallin <mattias.wallin@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
44f72e53382c9c673fd54c3bab67a6b9a2d4526e 17-Apr-2012 Virupax Sadashivpetimath <virupax.sadashivpetimath@stericsson.com> mfd: Add new resources on ab8500 AB8505 and AB9540

The AB8505 and AB9540 has extended support for micro USB
resistance detection, used for detecting chargers. Let's
register resources for this resource. Let's also split off the
separate codec device for AB9540.

Signed-off-by: Virupax Sadashivpetimath <virupax.sadashivpetimath@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
bc628fd19d2d1d053b88fa225bb599be026c048b 08-Mar-2012 Mattias Nilsson <mattias.i.nilsson@stericsson.com> mfd: Make use of the ab8500 firmware read-modify-write service

This patch updates the AB8500 driver to make use of the I2C
read-modify-write service in the PRCMU firmware.

Signed-off-by: Mattias Nilsson <mattias.i.nilsson@stericsson.com>
Reviewed-by: Mattias Wallin <mattias.wallin@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
a982362c1723464fec0414f6460684844f2638f3 08-Mar-2012 Bengt Jonsson <bengt.g.jonsson@stericsson.com> mfd: Support for the AB8500 AB8505 variant

This builds upon the changes done to support AB9540 so as
also to support the AB8505 derivative of the AB8500
circuit.

Signed-off-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
392cbd1e608ba79bd2da652eb3a28d841e51eaee 08-Mar-2012 Rabin Vincent <rabin.vincent@stericsson.com> mfd: Don't use mutex_lock_interruptible in ab8500-core

This disadvantage of having it interruptible is that it would
appear to work OK in most situations, but in the rare case
that this call does fail, it can lead to misconfiguration
of the AB, such as a regulator not being turned off and
leading to a platform power consumption increase.

There's no real benefit to having this interruptible.

Make it a plain mutex_lock. The non-interruptability matches
other low-level I/O functions such as SPI and I2C.

Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
d6255529b2639de542324f314b93939b7996a7c5 20-Feb-2012 Linus Walleij <linus.walleij@linaro.org> mfd: Support AB9540 ab8500 variant

The AB9540 variant of the AB8500 is basically close enough
to use the same driver. This adds the new registers and
deviations for this new chip variant.

Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@stericsson.com>
Signed-off-by: Alex Macro <alex.macro@stericsson.com>
Signed-off-by: Michel Jaouen <michel.jaouen@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2ced445e2ddf65f484a489161accddf475676965 20-Feb-2012 Linus Walleij <linus.walleij@linaro.org> mfd: Parametrize ab8500 IRQ masks and registers

This makes the AB8500 state struct contain the IRQ mask and
register offsets previously hard-coded so as to make room for
more AB8500 variants.

Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@stericsson.com>
Signed-off-by: Alex Macro <alex.macro@stericsson.com>
Signed-off-by: Michel Jaouen <michel.jaouen@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
0f620837595145cd42be1c9dc6b619146fbeaf88 20-Feb-2012 Linus Walleij <linus.walleij@linaro.org> mfd: Add ab8500 version detection and enforcing

There are currently four different versions of the AB8500
around: AB8500, AB8505, AB9540 and AB8540. Unfortunately:

- Some of the chips (AB8500, AB8505, AB9540) cannot read
the AB8500_REV_REG register but return errors

- Some of them have the same ID value in the hardware
register AB8500_REV_REV, for example the first versions
of AB8505 and AB9540 have 0xFF in this register -
just like the AB8500.

So we need to be able to enforce a certain version from
the platform. We do this by using the id of the platform
device that provides the read/write functions.

Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@stericsson.com>
Signed-off-by: Alex Macro <alex.macro@stericsson.com>
Signed-off-by: Michel Jaouen <michel.jaouen@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
6d95b7fdd0bd2e28ef651da6863d75edca4c2aca 20-Feb-2012 Linus Walleij <linus.walleij@linaro.org> mfd: Fix ab8500 error path bug

We were not freeing the irq properly in the error path in
the AB8500 driver.

Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@stericsson.com>
Signed-off-by: Alex Macro <alex.macro@stericsson.com>
Signed-off-by: Michel Jaouen <michel.jaouen@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
a60e8df64ddc6bd79c85a970f59f2967c968cfac 20-Feb-2012 Linus Walleij <linus.walleij@linaro.org> mfd: Fix ab8500 error path bug

We were not freeing the irq properly in the error path in
the AB8500 driver.

Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@stericsson.com>
Signed-off-by: Alex Macro <alex.macro@stericsson.com>
Signed-off-by: Michel Jaouen <michel.jaouen@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
ee66e653ca7425bc8ffca4e00f19a8057cd14e4d 02-Dec-2011 Linus Walleij <linus.walleij@linaro.org> mfd: Unify abx500 headers in mfd/abx500

This moves all the header files related to the abx500 family into
a common include directory below mfd. From now on we place any
subchip header in that directory. Headers previously in e.g.
<linux/mfd/ab8500/gpio.h> get prefixed and are now e.g.
<linux/mfd/abx500/ab8500-gpio.h>. The top-level abstract interface
remains in <linux/mfd/abx500.h>.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
df7206477e36bb73e81b99c2cbbc1b91e4b1c8ac 10-Nov-2011 Axel Lin <axel.lin@gmail.com> mfd: add #ifdef CONFIG_DEBUG_FS guard for ab8500_debug_resources

Fix below build warning if CONFIG_DEBUG_FS is disabled.

CC drivers/mfd/ab8500-core.o
drivers/mfd/ab8500-core.c:623: warning: 'ab8500_debug_resources' defined but not used

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
b4a310373209b87ba455f45227b5361cb746b946 11-Oct-2011 Andrew Lynn <andrew.lynn@stericsson.com> mfd: Expose TurnOnStatus in ab8500 sysfs

Expose TurnOnStatus (Power key, RTC alarm, Vbus detect, etc) in
sysfs. This magic value can be read by system users to determine
what caused the platform to turn on last (this) time.

Signed-off-by: Andrew Lynn <andrew.lynn@stericsson.com>
Reviewed-by: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
Reviewed-by: Jonas Aaberg <jonas.aberg@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
9b626ddd7f87f9443e9b6dfac54b5e8f52fb8f52 11-Oct-2011 Mattias Wallin <mattias.wallin@stericsson.com> mfd: Remove support for early drop ab8500 chip

This patch removes the early drop version of ab8500 which have
the really bad version nr 0x0. This chip should not be found in
the wild and only exist as ST-Ericsson scrap equipment.

Signed-off-by: Mattias Wallin <mattias.wallin@stericsson.com>
Reviewed-by: Jonas Aaberg <jonas.aberg@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
0e9049ecc251e721e6ddc4cda7f33062b2e338c7 11-Oct-2011 Mattias Wallin <mattias.wallin@stericsson.com> mfd: Add support for ab8500 v3.3

This patch adds support for ab8500 cut 3, MetalFix 3 or v3.3.

Signed-off-by: Mattias Wallin <mattias.wallin@stericsson.com>
Reviewed-by: Jonas Aaberg <jonas.aberg@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
e6f9306e2762a651fe6b735a36fcb696d05e8ed2 11-Oct-2011 Virupax Sadashivpetimath <virupax.sadashivpetimath@stericsson.com> mfd: Add ab8500 interrupt disable hook

Add the missing interrupt disable hook in the irq_chip
callbacks for ab8500.

Signed-off-by: Virupax Sadashivpetimath <virupax.sadashivpetimath@stericsson.com>
Reviewed-by: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
Signed-off-by: Philippe Langlais <philippe.langlais@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
6af75ecd5772eee4d7be974a881fd5a25f218b0b 09-Jun-2011 Linus Walleij <linus.walleij@linaro.org> mfd: Update ab8500 subdevice list

This synchronize the subdevice entries for the AB8500 MFD driver
with the latest development of subdrivers for things like battery
charging and temperature monitoring.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
5cef8df5e335a5bc9147c5cafdce348981f5c5b5 09-Jun-2011 Robert Rosengren <robert.rosengren@stericsson.com> mfd: ab8500-core MFD devices marked as initdata

Internal MFD device structs are marked as __devinitdata since the kernel
will allocate memory for the same when calling mfd_add_devices.

Signed-off-by: Robert Rosengren <robert.rosengren@stericsson.com>
Reviewed-by: Mattias Wallin <mattias.wallin@stericsson.com>
Reviewed-by: Johan Palsson <johan.palsson@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
863dde5bfa3c48f459c6302daf64f94a11c7c1e5 08-May-2011 Linus Walleij <linus.walleij@linaro.org> mfd: Provide ab8500-core enumerators for chip cuts

Since functionality in MFD cells may need to be adjusted according to
chip revision, let's enumerate them and keep track of them.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
0cb3fcd72cc3e6dd88f0e769746d294e5e6bafa9 09-Feb-2011 Bibek Basu <bibek.basu@stericsson.com> gpio: driver for 42 AB8500 GPIO pins

To get rid of port expanders, the free GPIOs of ab8500
can be used. There are 42 GPIO pins. Out of which 16
are interrupt capable.This patch implements 16 virtual
IRQ mapped to 16 interrupt capable AB8500 GPIOs.

Signed-off-by: Bibek Basu <bibek.basu@stericsson.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
[Renamed header file as per MFD structure]
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
d5bb122165981aed327845c32a9916d1b8ae0e4b 25-Mar-2011 Thomas Gleixner <tglx@linutronix.de> mfd: Cleanup irq namespace

Converted with coccinelle.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
e5c238c3fde93afdddef36aec2642155c709d93a 02-Mar-2011 Mattias Wallin <mattias.wallin@stericsson.com> mfd: ab8500-core switch off status added

This patch adds a sysfs file with the ab8500 switch off status.
The switch off status contains information of what caused the ab8500
chip to power off. A print during boot is also added.

Signed-off-by: Mattias Wallin <mattias.wallin@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
adceed6263887e04721b477e6504aa24789f827d 02-Mar-2011 Mattias Wallin <mattias.wallin@stericsson.com> mfd: ab8500 chip revision 3.0 support

This patch adds support for ab8500 chip revision cut 3.0.
Also rephrased from Changes to Author in the header.

Signed-off-by: Mattias Wallin <mattias.wallin@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
92d50a4132977b932ed830fa58c05deeb5c524f0 07-Dec-2010 Mattias Wallin <mattias.wallin@stericsson.com> mfd: ab8500-core chip version cut 2.0 support

This patch adds support for chip version 2.0 or cut 2.0.
One new interrupt latch register - latch 12 - is introduced.

Signed-off-by: Mattias Wallin <mattias.wallin@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
9505a0a0ac6160480eaab8d592dce6161e67e05d 11-Dec-2010 Mark Brown <broonie@opensource.wolfsonmicro.com> mfd: Convert AB8500 to new irq_ methods

The genirq core is being converted to supply struct irq_data to chips
rather than the interrupt number.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Mattias Wallin <mattias.wallin@stericsson.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
e098aded79f24e2024139e82f778ff9db6dc142a 02-Dec-2010 Mattias Wallin <mattias.wallin@stericsson.com> mfd: ab8500-core ioresources irq for subdrivers added

This patch adds the ioresources used by subdrivers to
retrieve their interrupt.

Signed-off-by: Mattias Wallin <mattias.wallin@stericsson.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
4f079985b2caacfda5103dd85fb028a2848c84ab 02-Dec-2010 Mattias Wallin <mattias.wallin@stericsson.com> mfd: ab8500-core wake up from suspend

This patch makes the system wake up from suspend when an
ab8500 interrupt occur. This can for example be USB cable
insert or an RTC alarm.

Signed-off-by: Mattias Wallin <mattias.wallin@stericsson.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
cca69b67b3ba954ed8642583295b51933f902227 02-Dec-2010 Mattias Wallin <mattias.wallin@stericsson.com> mfd: Export ab8500 chip id to sysfs

This patch adds a file into sysfs for reading out chip id.
It has been requested for modem silent reboot.

Signed-off-by: Mattias Wallin <mattias.wallin@stericsson.com>
Signed-off-by: Ludovic Barre <ludovic.barre@stericsson.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
6bce7bf1a1f8a79a57ff69910c115e1d2ed8913d 02-Dec-2010 Mattias Wallin <mattias.wallin@stericsson.com> mfd: ab8500-core improved error handling in get_chip_id

We check for dev before dereferencing it.

Signed-off-by: Mattias Wallin <mattias.wallin@stericsson.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
88aec4f7b67b5889ba5b4beac2d2c1400451c318 02-Dec-2010 Mattias Wallin <mattias.wallin@stericsson.com> mfd: Fix ab8500-core interrupt ffs bit bug

We want to find the first set bit on value, not status.

Signed-off-by: Mattias Wallin <mattias.wallin@stericsson.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
5814fc35e1837e30b82c3d57f41310d4c4c52824 13-Sep-2010 Mattias Wallin <mattias.wallin@stericsson.com> mfd: AB8500 debugfs

This patch adds the possibility to read and write registers
via the debug_fs. It also adds ranges of registers sorted by bank
which makes it possible to read all defined registers in a bank.

Signed-off-by: Mattias Wallin <mattias.wallin@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
f0f05b1c751772d19c9c8f36d75e97b1d9687407 05-Sep-2010 Arun Murthy <arun.murthy@stericsson.com> misc: Add ab8500 pwm driver

This patch adds a Pulse Width Modulation driver for Analog Baseband
Chip AB8500.

Signed-off-by: Arun Murthy <arun.murthy@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Acked-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
47c1697508f2ec9f6b31ce6c825fe1017871dea6 10-Sep-2010 Mattias Wallin <mattias.wallin@stericsson.com> mfd: Align ab8500 with the abx500 interface

This patch makes the ab8500 mixed signal chip expose the same
interface for register access as the ab3100, ab3550 and ab5500 chip.
The ab8500_read() and ab8500_write() is removed and replaced with
abx500_get_register_interruptible() and
abx500_set_register_interruptible().

Signed-off-by: Mattias Wallin <mattias.wallin@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
77686517977e77d101c8a7b397717df00a88922b 05-Sep-2010 Sundar R Iyer <sundar.iyer@stericsson.com> Input: add support for PowerOn button on the AB8500 MFD

Add the PowerOn (PonKey) button support to detect power on/off events.

Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Sundar R Iyer <sundar.iyer@stericsson.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
549931f99e030d63a437c23943fd8dc9b7c0e41c 13-Jul-2010 Sundar R Iyer <sundar.iyer@stericsson.com> ab8500-mfd: add regulator support to ab8500 mfd device

Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Acked-By: Mattias Wallin <mattias.wallin@stericsson.com>
Acked-By: Bengt JONSSON <bengt.g.jonsson@stericsson.com>
Signed-off-by: Sundar R Iyer <sundar.iyer@stericsson.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
62579266cf9caca5b999560be2b5ceee42fc4d4d 19-May-2010 Rabin Vincent <rabin.vincent@stericsson.com> mfd: New AB8500 driver

Add a new driver to support the AB8500 Power Management chip, replacing
the current AB4500. The new driver replaces the old one, instead of an
incremental modification, because this is a substantial overhaul
including:

- Split of the driver into -core and -spi portions, to allow another
interface layer to be added

- Addition of interrupt support

- Switch to MFD core API for handling subdevices

- Simplification of the APIs to remove a redundant block parameter

- Rename of the APIs and macros from ab4500_* to ab8500_*

- Rename of the files from ab4500* to ab8500*

- Change of the driver name from ab4500 to ab8500

Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Acked-by: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>