Commit Graph

121 Commits

Author SHA1 Message Date
Marc Zyngier 32280649f0 mfd: Don't use irq_create_mapping() to resolve a mapping
[ Upstream commit 9ff80e2de36d0554e3a6da18a171719fe8663c17 ]

Although irq_create_mapping() is able to deal with duplicate
mappings, it really isn't supposed to be a substitute for
irq_find_mapping(), and can result in allocations that take place
in atomic context if the mapping didn't exist.

Fix the handful of MFD drivers that use irq_create_mapping() in
interrupt context by using irq_find_mapping() instead.

Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-09-22 12:26:43 +02:00
Thomas Gleixner 0376148f30 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 197
Based on 1 normalized pattern(s):

  license terms gnu general public license v2

extracted by the scancode license scanner the SPDX license identifier

  GPL-2.0-only

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

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Steve Winslow <swinslow@gmail.com>
Reviewed-by: Alexios Zavras <alexios.zavras@intel.com>
Reviewed-by: Richard Fontana <rfontana@redhat.com>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190528170027.724130665@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-30 11:29:22 -07:00
Dan Carpenter 10628e3ecf mfd: ab8500-core: Return zero in get_register_interruptible()
This function is supposed to return zero on success or negative error
codes on error.  Unfortunately, there is a bug so it sometimes returns
non-zero, positive numbers on success.

I noticed this bug during review and I can't test it.  It does appear
that the return is sometimes propogated back to _regmap_read() where all
non-zero returns are treated as failure so this may affect run time.

Fixes: 47c1697508 ("mfd: Align ab8500 with the abx500 interface")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2019-01-03 08:32:42 +00:00
Arvind Yadav 52557dc624 mfd: ab8500-core: Constify attribute_group structures
attribute_groups are not supposed to change at runtime. All functions
working with attribute_groups provided by <linux/sysfs.h> work with const
attribute_group. So mark the non-const structs as const.

File size before:
   text	   data	    bss	    dec	    hex	filename
  16298	   1009	    184	  17491	   4453	drivers/mfd/ab8500-core.o

File size After adding 'const':
   text	   data	    bss	    dec	    hex	filename
  16490	    817	    184	  17491	   4453	drivers/mfd/ab8500-core.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-09-05 08:46:00 +01:00
Linus Walleij 91549e8723 mfd: ab8500-core: Rename clock device and compatible
We didn't have proper device tree bindings for this clock,
I standardized it to use the exact chipname so let's rename
it "ab8500-clk" and rectify the device tree compatible string
to "stericsson,ab8500-clk".

Cc: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-02-13 09:29:43 +00:00
Paul Gortmaker 31cbae2224 mfd: ab8500-core: Make it explicitly non-modular
The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config AB8500_CORE
drivers/mfd/Kconfig:    bool "ST-Ericsson AB8500 Mixed Signal 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.

We explicitly disallow a driver unbind, since that doesn't have a
sensible use case anyway, and it allows us to drop the ".remove"
code for non-modular drivers.

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

We replace module.h with moduleparam.h ; the latter since this file
was implicitly relying on getting it.

We also delete the MODULE_LICENSE tag etc. since all that information
is already 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>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2016-11-29 08:21:30 +00:00
Arnd Bergmann 4e657946cb mfd: db8500 stop passing around platform data
Except for the constant DB8500_PRCMU_FW_VERSION_OFFSET number, nothing
is ever passed through the platform data and used in a driver, so we
can simply stop passing it around.

Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-07-12 11:23:58 +02:00
Lee Jones 500e69a101 mfd: ab8500-core: Fix many warnings reported by Checkpatch
WARNING: Block comments use a trailing */ on a separate line
+        * */

WARNING: Block comments use a trailing */ on a separate line
+        * bank on higher 8 bits and reg in lower */

WARNING: Block comments use a trailing */ on a separate line
+        * bank on higher 8 bits and reg in lower */

WARNING: suspect code indent for conditional statements (8, 24)
+       if (unlikely(*offset == 17))
+                       *offset = 24;

WARNING: suspect code indent for conditional statements (8, 24)
+       if (unlikely(*offset == 16))
+                       *offset = 25;

WARNING: suspect code indent for conditional statements (8, 24)
+       if ((i == 3) && (*offset >= 24))
+                       *offset += 2;

WARNING: ENOSYS means 'invalid syscall nr' and nothing else
+               return -ENOSYS;

WARNING: static const char * array should probably be static const char * const
+       static const char *switch_off_status[] = {

WARNING: static const char * array should probably be static const char * const
+       static const char *turn_on_status[] = {

total: 0 errors, 9 warnings, 1867 lines checked

Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2016-01-14 08:43:54 +00:00
Linus Walleij bdd5dcf513 mfd: ab8500: Delete static IRQ resources
The platforms that use the AB8500 define all IRQ resources in the
device tree and they are automatically populated by matching
the .of_compatible string. These static resources are just
surplus baggage these days.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-12-04 08:46:17 +00:00
Rob Herring 9bd09f345e mfd: Kill off set_irq_flags usage
set_irq_flags is ARM specific with custom flags which have genirq
equivalents. Convert drivers to use the genirq interfaces directly, so we
can kill off set_irq_flags. The translation of flags is as follows:

IRQF_VALID -> !IRQ_NOREQUEST
IRQF_PROBE -> !IRQ_NOPROBE
IRQF_NOAUTOEN -> IRQ_NOAUTOEN

For IRQs managed by an irqdomain, the irqdomain core code handles clearing
and setting IRQ_NOREQUEST already, so there is no need to do this in
.map() functions and we can simply remove the set_irq_flags calls. Some
users also modify IRQ_NOPROBE and this has been maintained although it
is not clear that is really needed. There appears to be a great deal of
blind copy and paste of this code.

Signed-off-by: Rob Herring <robh@kernel.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-08-11 15:09:01 +01:00
Krzysztof Kozlowski 7ce7b26f84 mfd: Constify regmap and irq configuration data
Constify in various drivers configuration data which is not modified:
 - regmap_irq_chip,
 - individual regmap_irq's in array,
 - regmap_config,
 - irq_domain_ops,

Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-06-22 12:25:01 +01:00
Wolfram Sang 78a835416a mfd: drop owner assignment from platform_drivers
A platform_driver does not need to set an owner, it will be populated by the
driver core.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-10-20 16:20:53 +02:00
Fabio Estevam 72ef8e4b3b 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>
2014-08-20 13:28:02 +01:00
Lee Jones 7ccf40b1a1 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>
2014-07-09 16:38:12 +01:00
Lee Jones f35563027f 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>
2014-07-09 16:37:27 +01:00
Grygorii Strashko 7602e05df7 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>
2014-06-26 13:34:15 +01:00
Linus Walleij f864c46aae 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>
2014-03-04 08:58:11 +08:00
Linus Walleij ed83d301ea 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>
2014-01-21 08:27:49 +00:00
Geert Uytterhoeven 5ac98553af mfd: Constify struct mfd_cell where possible
As of commit 03e361b25e ("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>
2014-01-06 09:13:29 +00:00
Lee Jones 53f325be2f 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>
2013-06-13 10:52:00 +01:00
Fabio Baltieri fccf14ad1e 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>
2013-06-13 10:51:54 +01:00
Alexandre Torgue 9c717cf3fa 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>
2013-06-13 10:51:52 +01:00
Lee Jones 2809126512 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>
2013-06-13 10:51:50 +01:00
Lee Jones 955de2eab3 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>
2013-05-17 00:42:33 +02:00
Lee Jones eb696c3181 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>
2013-05-17 00:42:32 +02:00
Linus Walleij 6999181eec 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>
2013-05-17 00:42:31 +02:00
Fabio Baltieri f201f730b8 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>
2013-04-09 11:04:23 +02:00
Fabio Baltieri 7a93fb3754 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>
2013-04-09 10:19:45 +02:00
Lee Jones 93ff722e88 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>
2013-03-07 12:35:36 +08:00
Dariusz Szymczak f348fefd2a 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>
2013-03-07 12:29:31 +08:00
Ulf Hansson 9ee17676a5 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>
2013-03-07 12:29:15 +08:00
Mattias Wallin abee26cdb6 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>
2013-03-07 12:29:00 +08:00
Lee Jones 492390c8fd 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>
2013-03-07 12:28:40 +08:00
Lee Jones e436ddff57 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>
2013-03-07 12:28:06 +08:00
Lee Jones 3e1a498f27 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>
2013-03-07 12:27:47 +08:00
Lee Jones 4b106fb989 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>
2013-03-07 12:27:41 +08:00
Lee Jones c0eda9aef1 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>
2013-03-07 12:27:36 +08:00
Lee Jones a29264b68a 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>
2013-03-07 12:27:20 +08:00
Rajkumar Kasirajan f04a9d8adf 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>
2013-03-07 12:26:47 +08:00
Linus Torvalds ab7826595e This is the MFD pull request for the 3.9 merge window.
No new drivers this time, but a bunch of fairly big cleanups:
 
 - Roger Quadros worked on a OMAP USBHS and TLL platform data consolidation,
   OMAP5 support and clock management code cleanup.
 
 - The first step of a major sync for the ab8500 driver from Lee Jones. In
   particular, the debugfs and the sysct interfaces got extended and improved.
 
 - Peter Ujfalusi sent a nice patchset for cleaning and fixing the twl-core
   driver, with a much needed module id lookup code improvement.
 
 - The regular wm5102 and arizona cleanups and fixes from Mark Brown.
 
 - Laxman Dewangan extended the palmas APIs in order to implement the palmas
   GPIO and rt drivers.
 
 - Laxman also added DT support for the tps65090 driver.
 
 - The Intel SCH and ICH drivers got a couple fixes from Aaron Sierra and
   Darren Hart.
 
 - Linus Walleij patchset for the ab8500 driver allowed ab8500 and ab9540 based
   devices to switch to the new abx500 pin-ctrl driver.
 
 - The max8925 now has device tree and irqdomain support thanks to Qing Xu.
 
 - The recently added rtsx driver got a few cleanups and fixes for a better
   card detection code path and now also supports the RTS5227 chipset, thanks
   to Wei Wang and Roger Tseng.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJRJWtoAAoJEIqAPN1PVmxKHvEP/2B0uUJQpRjTjc9lgrzaUdFO
 QdSyj8Vpz1fZPF3cDuik/Be91U1nICyJWZZ7Yvngih3kbqiGw8nbp9AATwdF4Anl
 +QEtPS9YIpu1w5NS4r01q+cx3NxFsaR5yfNPKLWWnLtN8zHq4qQS8SF8jjdrsgkz
 zUJrjn1GfPPeuyR6Fuko9Mxk6oQ6TUazWJwmxzSCcrKKQ7GlAnbRWcwv2Qnv3GTg
 xi9S85xmLtVhLmMIQ2OR4JP56Vc49OL2/+hv1uShtFVDR4JLeZ5l8j0IPjgXJTrv
 ZbcrzEfJkV+zkY5RmDQrZzNLIWQmH9lj0bzitrS8Ii622J/mfnvQEgnC5fObphjg
 sYKJuBtO9o7XtFJxH7/oXdwM2gC5jDy43FmRv9J2mIDVoX8kNZMzY/sqmL8jm7KD
 MZU0D7liOyF3/1VbZHGSplKp+HKd5XYXCDQEesG/urkDr2edYHdb52iUVYGC32yV
 MaTqXnRMGURdjhCorAZPV8hoQOSWV8pj6oskk+E3upCmWjQWdhKMw3/HzasDLO9B
 eoQSgwZXJLTV8hJjAdgPUjZbxyOyW+9jKA12nyqwX3noq0NseSSJaeZUWmLecmbF
 vXcg4LAwSUycNJ0DxtWC2oEUV9jv4B+dOE7avVT6BDSvth4nzDlO9gOTtxBLcgTz
 JKrAPxY1nS4AUXJbsYTq
 =BhC1
 -----END PGP SIGNATURE-----

Merge tag 'mfd-3.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6

Pull MFS updates from Samuel Ortiz:
 "This is the MFD pull request for the 3.9 merge window.

  No new drivers this time, but a bunch of fairly big cleanups:

   - Roger Quadros worked on a OMAP USBHS and TLL platform data
     consolidation, OMAP5 support and clock management code cleanup.

   - The first step of a major sync for the ab8500 driver from Lee
     Jones.  In particular, the debugfs and the sysct interfaces got
     extended and improved.

   - Peter Ujfalusi sent a nice patchset for cleaning and fixing the
     twl-core driver, with a much needed module id lookup code
     improvement.

   - The regular wm5102 and arizona cleanups and fixes from Mark Brown.

   - Laxman Dewangan extended the palmas APIs in order to implement the
     palmas GPIO and rt drivers.

   - Laxman also added DT support for the tps65090 driver.

   - The Intel SCH and ICH drivers got a couple fixes from Aaron Sierra
     and Darren Hart.

   - Linus Walleij patchset for the ab8500 driver allowed ab8500 and
     ab9540 based devices to switch to the new abx500 pin-ctrl driver.

   - The max8925 now has device tree and irqdomain support thanks to
     Qing Xu.

   - The recently added rtsx driver got a few cleanups and fixes for a
     better card detection code path and now also supports the RTS5227
     chipset, thanks to Wei Wang and Roger Tseng."

* tag 'mfd-3.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6: (109 commits)
  mfd: lpc_ich: Use devres API to allocate private data
  mfd: lpc_ich: Add Device IDs for Intel Wellsburg PCH
  mfd: lpc_sch: Accomodate partial population of the MFD devices
  mfd: da9052-i2c: Staticize da9052_i2c_fix()
  mfd: syscon: Fix sparse warning
  mfd: twl-core: Fix kernel panic on boot
  mfd: rtsx: Fix issue that booting OS with SD card inserted
  mfd: ab8500: Fix compile error
  mfd: Add missing GENERIC_HARDIRQS dependecies
  Documentation: Add docs for max8925 dt
  mfd: max8925: Add dts
  mfd: max8925: Support dt for backlight
  mfd: max8925: Fix onkey driver irq base
  mfd: max8925: Fix mfd device register failure
  mfd: max8925: Add irqdomain for dt
  mfd: vexpress: Allow vexpress-sysreg to self-initialise
  mfd: rtsx: Support RTS5227
  mfd: rtsx: Implement driving adjustment to device-dependent callbacks
  mfd: vexpress: Add pseudo-GPIO based LEDs
  mfd: ab8500: Rename ab8500 to abx500 for hwmon driver
  ...
2013-02-24 20:00:58 -08:00
Linus Torvalds 5a1203914a - Four new drivers:
o goldfish_battery:
     This is Android Emulator battery driver. Originally from Google, but
     Intel folks reshaped it for mainline;
 
   o pm2301_charger:
     A new driver for ST-Ericsson 2301 Power Management chip, uses AB8500
     battery management core;
 
   o qnap-poweroff:
     The driver adds poweroff functionality for QNAP NAS boxes;
 
   o restart-poweroff:
     A generic driver that implements 'power off by restarting'. The actual
     poweroff functionality is implemented through a bootloader, so Linux'
     task is just to restart the box. The driver is useful on Buffalo
     Linkstation LS-XHL and LS-CHLv2 boards. Andrew Lunn worked on
     submitting the driver (as well as qnap-poweroff above).
 
 - A lot of fixes for ab8500 drivers. This is a part of efforts of syncing
   internal ST-Ericsson development tree with the mainline. Lee Jones @
   Linaro worked on compilation and reshaping these series;
 
 - New health properties for the power supplies: "Watchdog timer expire"
   and "Safety timer expire";
 
 - As usual, a bunch of fixes/cleanups here and there.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.19 (GNU/Linux)
 
 iQIcBAABAgAGBQJRIww1AAoJEGgI9fZJve1bJ7sP/1hR8SYQZ/k0ayxA/kIxNEDA
 Qa2sAcdP5pa4F/A2Wi5MTrckSHuLlRRigWRCPM09emVOvt6g2MdM3Eq6ShuYb2p0
 g2bX0F9KBEa9gdiJC1wNVe9DilXbrJsk86V5E+ZkuVnNzM3S1FA1sPWGhdH66YVq
 9IKxm2XntyXFpuvhSYE01KQoFY+Crv1NEGXoIR7tB6Q1KOf3XswnsFwdKJ95IO5r
 8f/lVYRAYUfeplhrYd3eJTtb/GHhK7CutFV/E6kWlumGCWNVH2xt+dTlAmTUdQvO
 jKe9R5iq5eXFTQmN8QZDH7QdXO1DdmJZ9F112hIAud/93bmNrnc0WqMKM7CFHkfH
 S6ptGgeIdpGEM1KMgzKTNrQeNIYsVNtqbEiIiodR8S4e0cX2pb2n5IfzmELIVc0n
 QMZylORpGaH1lBxTE2RoT4raGeWF5jH0t0b0YRqccRPvQ4VjCJslDOq9IOETUe+/
 YxWpELJigW7FGLMfx0SB2/3s1P4EUaufWvHANCVaPuBsOZga854R4dzms4hKyKsL
 JQg+OKp/Bt78yAj/8/n0FWdxgldp/NjF4485ITQ1eOZyg8VSeIp93Lk6lgSTukux
 R1xLruxfPgdynpmYFCGF99JG2G8RmRuJFSTf8JttvyztkAxQw6zBtdmdiPk38wst
 qpUxdPpNDIvt65Ix7x+D
 =955B
 -----END PGP SIGNATURE-----

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

Pull battery updates from Anton Vorontsov:
 "Four new drivers:

   - goldfish_battery:

     This is Android Emulator battery driver.  Originally from Google,
     but Intel folks reshaped it for mainline

   - pm2301_charger:

     A new driver for ST-Ericsson 2301 Power Management chip, uses
     AB8500 battery management core

   - qnap-poweroff:

     The driver adds poweroff functionality for QNAP NAS boxes

   - restart-poweroff:

     A generic driver that implements 'power off by restarting'.  The
     actual poweroff functionality is implemented through a bootloader,
     so Linux' task is just to restart the box.  The driver is useful on
     Buffalo Linkstation LS-XHL and LS-CHLv2 boards.  Andrew Lunn worked
     on submitting the driver (as well as qnap-poweroff above).

  Additionally:

   - A lot of fixes for ab8500 drivers.  This is a part of efforts of
     syncing internal ST-Ericsson development tree with the mainline.
     Lee Jones @ Linaro worked on compilation and reshaping these
     series.

   - New health properties for the power supplies: "Watchdog timer
     expire" and "Safety timer expire"

   - As usual, a bunch of fixes/cleanups here and there"

* tag 'for-v3.9' of git://git.infradead.org/battery-2.6: (81 commits)
  bq2415x_charger: Add support for offline and 100mA mode
  generic-adc-battery: Fix forever loop in gab_remove()
  goldfish_battery: Add missing GENERIC_HARDIRQS dependency
  da9030_battery: Include notifier.h
  bq27x00_battery: Fix reporting battery temperature
  power/reset: Remove newly introduced __dev* annotations
  lp8727_charger: Small cleanup in naming
  ab8500_btemp: Demote initcall sequence
  ds2782_battery: Add power_supply_changed() calls for proper uevent support
  power: Add battery driver for goldfish emulator
  u8500-charger: Delay for USB enumeration
  ab8500-bm: Remove individual [charger|btemp|fg|chargalg] pdata structures
  ab8500-charger: Do not touch VBUSOVV bits
  ab8500-fg: Use correct battery charge full design
  pm2301: LPN mode control support
  pm2301: Enable vbat low monitoring
  ab8500-bm: Flush all work queues before suspending
  ab8500-fg: Go to INIT_RECOVERY when charger removed
  ab8500-charger: Add support for autopower on AB8505 and AB9540
  abx500-chargalg: Add new sysfs interface to get current charge status
  ...

Fix up fairly straightforward conflicts in the ab8500 driver.  But since
it seems to be ARM-specific, I can't even compile-test the result..
2013-02-20 10:19:07 -08:00
Samuel Ortiz 6ed8b0400c Merge branch 'abx500-pinctrl-for-mfd' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl into for-next
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2013-02-14 00:24:51 +01:00
Samuel Ortiz dce7886e80 Merge branch 'for-mfd' of git://git.linaro.org/people/ljones/linux-3.0-ux500 into for-next
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2013-02-14 00:23:17 +01:00
Hongbo Zhang 151621a704 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>
2013-02-14 00:22:58 +01:00
Lee Jones e64d905e28 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>
2013-02-08 14:25:34 +01:00
Lee Jones 7d56a46e87 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>
2013-02-08 14:25:34 +01:00
Lee Jones 40f6e5a2b5 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>
2013-02-08 14:25:33 +01:00
Linus Walleij e2ddf46ab4 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>
2013-02-08 14:25:32 +01:00
Lee Jones 9c677b9b74 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>
2013-02-08 14:25:30 +01:00
Bengt Jonsson 8f0eb43be5 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>
2013-02-04 08:31:50 +00:00