1
0
Fork 0
Commit Graph

39 Commits (redonkable)

Author SHA1 Message Date
Wolfram Sang ad9fc1f422 mfd: palmas: Convert to i2c_new_dummy_device
Move from i2c_new_dummy() to i2c_new_dummy_device(), so we now get an
ERRPTR which we use in error handling.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2019-08-12 08:54:16 +01:00
Thomas Gleixner 2874c5fd28 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152
Based on 1 normalized pattern(s):

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

extracted by the scancode license scanner the SPDX license identifier

  GPL-2.0-or-later

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

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190527070032.746973796@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-30 11:26:32 -07:00
Keerthy 572ff4d560 mfd: palmas: Assign the right powerhold mask for tps65917
The powerhold mask for TPS65917 is different when comapred to
the other palmas versions. Hence assign the right mask that enables
power off of tps65917 pmic correctly.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2018-01-08 11:03:34 +00:00
Benjamin Gaignard 124e9deb1c mfd: palmas: Use devm_of_platform_populate()
Use devm_of_platform_populate() to be sure that of_platform_depopulate
is called when removing the driver.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-07-06 08:29:12 +01:00
Willis Monroe b5b086abe0 mfd: palmas: Fixed spelling mistake in error message
Fixed a small spelling mistake ("updat" -> "update") in an error message.

Signed-off-by: Willis Monroe <willismonroe@gmail.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-04-27 11:54:44 +01:00
Keerthy 85fdaf8eb9 mfd: palmas: Reset the POWERHOLD mux during power off
POWERHOLD signal has higher priority  over the DEV_ON bit.
So power off will not happen if the POWERHOLD is held high.
Hence reset the MUX to GPIO_7 mode to release the POWERHOLD
and the DEV_ON bit to take effect to power off the PMIC.

PMIC Power off happens in dire situations like thermal shutdown
so irrespective of the POWERHOLD setting go ahead and turn off
the powerhold.  Currently poweroff is broken on boards that have
powerhold enabled. This fixes poweroff on those boards.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-04-27 09:25:05 +01:00
Keerthy 445c93093d mfd: palmas: Remove redundant check in palmas_power_off
palmas_dev and palmas_power_off are always assigned together.
So the check for palmas_dev inside palmas_power_off function
is redundant. Removing the same.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2016-11-29 08:21:38 +00:00
Krzysztof Kozlowski 0e777366fb mfd: Drop owner assignment from i2c_drivers
i2c_driver does not need to set an owner because i2c_register_driver()
will set it.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-08-11 15:08:48 +01:00
Keerthy cac9e91624 regulator: palmas: add driver data and modularize the probe
add driver data and modularize the probe.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-23 12:30:56 +01:00
Keerthy 7ec70c73c9 mfd: palmas: shift the palmas_sleep_requestor_info structure definition to the header file
shift the palmas_sleep_requestor_info structure definition to the header file.

Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-23 12:30:56 +01:00
Keerthy 1c113d83bb mfd: palmas: Add tps65917 support
Add tps65917 PMIC support. tps65917 is a subset of palmas PMIC.
Some of the register definitions and the interrupt mappings
are different.

Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-23 12:30:56 +01:00
Sachin Kamat 84195b7736 mfd: palmas: Remove redundant of_match_ptr
'of_palmas_match_tbl' is always compiled in. Hence of_match_ptr() is
not needed.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-10-23 16:22:01 +01:00
Laxman Dewangan 5e172d7518 mfd: palmas: Fix resource leak of i2c_dummy devices
Palmas device supports multiple i2c device address and the client
for these addressed are created in the driver as i2c_new_dummy().

The new devices are not getting released in error or removal path and
so it is causing resource leak.

Add the unregister of these newly created dummy devices to avoid resource
leaks.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-10-23 16:21:39 +01:00
Laxman Dewangan 7178347e1c mfd: palmas: Reset pm_power_off if it is set for the device
If Palams supports the system power controller and pm_power_off
is implemented through the Palmas driver then reset the pm_power_off
in driver remove.

This will avoid the call of Palmas driver after removal of driver.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-10-23 16:21:36 +01:00
Laxman Dewangan 2d8edaf028 mfd: palmas: Add MODULE_DEVICE_TABLE for of_device table
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-10-23 16:21:34 +01:00
Laxman Dewangan ca471660a2 mfd: palmas: Remove call of mfd_remove_devices
The driver only support the device tree and sub modules are populated
through platform, the registration of sub devices through mfd_add_devices
has been removed.

Hence in remove path of the driver, it is not require to call
mfd_remove_devices.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-10-23 16:21:31 +01:00
Samuel Ortiz 828fa1e601 Hi Sam,
These are the patches due for the MFD Next tree.
 
 If there are any dramas with them, please let me know.
 
 Kind regards,
 Lee
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJSE3XBAAoJEFGvii+H/HdhvboP/RNRXbRufJ1/9NGHLafcWE8C
 5d71o9xy7mBdeGzhNRH5mWRB8bdse0cRXEjTavQGv52ohxUdoNG95RwHO1xCZpvF
 hAITRfIoVbpmPXG4KTfmEEW97yPkrUEIB7zH/yJtYi8gyPW0JeNFk2tlpdGsPc1g
 rTNic5RGo89zoQPw0HsCOkO4DWIQe+2y6FqbOjykjWNJTzcSW4YjRg3IuoiXKtHd
 Q2LBsgpv6gofKa9ZWdbKQfdt0/V+snw/hGEMhpEqcBZgSuvivv3hLjSc8K5OCDY7
 /z5ynE1WdLf9sJK8GAY6DuGUA6HsfDHQKACEtOf9AWP4cYheGoE/JGvC7KkQS86X
 1z+nw5LfrQf8SVkFLEaCroTC0X7UJodVdRnmcZmAWz4dcTKhKdRV6aXOYhzHK6cP
 1iXQmpNzWL5Jz8YXwNQ9MlXggv8qCrRGB4sTsj2bTOrDb44xBFzAYwtpIb+w8J7K
 NrNoEq8MwUBYTOXjzMdYlb0PjsLXmZLMqeMBjx0VH/TR39Jj3qX2kEnIRisIliEc
 qYP4FMi/rshTv67OSMvUfvkOZ3uTSgG1ufdvAYUSDCQ5T+a+7b63tOVwX64Hzx7P
 YPPIeO/7VXNOP8XYEtNyRhsmJtdT1JruT00PBKYL9NRuMOmBxoF6pdK3TsOZzRBb
 pNmJJPnVaF221LKfQ0q7
 =e/El
 -----END PGP SIGNATURE-----

Merge tag 'mfd-lee-3.12-1' of git://git.linaro.org/people/ljones/mfd

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2013-08-21 12:08:14 +02:00
Laxman Dewangan cc01b4639c mfd: palmas: Add support for external control configuration
Some of Palmas resources like clock, SMPSs, LDOs etc can be controlled
by external pins ENABLE1, ENABLE2 or NSLEEP.

Add support to configure these resources to externally controlled.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2013-08-20 03:23:52 +02:00
Bill Huang b81eec09a4 mfd: palmas: Add power off control
Hook up "pm_power_off" to palmas power off routine if there is DT
property "ti,system-power-controller" defined, so platform which is
powered by this regulator can be powered off properly.

Acked-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Mallikarjun Kasoju <mkasoju@nvidia.com>
Signed-off-by: Bill Huang <bilhuang@nvidia.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-08-14 18:53:17 +01:00
J Keerthy 4124e6e291 mfd: palmas: Add TPS659038 PMIC support
The Patch adds TPS659038 PMIC support in the palmas mfd driver.
The TPS659038 has almost the same registers as of the earlier
supported variants of PALMAS family such as the TWL6035.

The critical differences between TPS659038 and TWL6035 being:

1) TPS659038 has nothing related to battery charging and back up battery stuff.
2) TPS659038 does not have does not have SMPS10(Boost) step up convertor.
3) TPS659038 does not have Battery detection and anything related to battery.
4) SD card detection, Battery presence detection, Vibrator, USB OTG are missing
   when compared to TWL6035.

Signed-off-by: J Keerthy <j-keerthy@ti.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2013-06-24 13:42:48 +02:00
J Keerthy 1ffb0be3ad mfd: palmas: Add SMPS10_BOOST feature
The SMPS10 regulator is not presesnt in all the variants
of the PALMAS PMIC family. Hence adding a feature to distingush
between them.

Signed-off-by: J Keerthy <j-keerthy@ti.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2013-06-20 11:29:18 +02:00
J Keerthy ad522f4e35 mfd: palmas: Check if irq is valid
Check if irq value obtained is valid. If it is not valid
then skip the irq request step and go ahead with the probe.

Signed-off-by: J Keerthy <j-keerthy@ti.com>
Reviewed-by: Mark Brown <broonie@linaro.org>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2013-06-20 10:50:55 +02:00
J Keerthy 1ee5d8c85a mfd: palmas: Remove code which is not necessary for a device tree boot
Remove code which is not necessary for a device tree boot.

Boot tested on OMAP5-UEVM board.

Signed-off-by: J Keerthy <j-keerthy@ti.com>
Acked-by: Laxman Dewangan  <ldewangan@nvidia.com>
Acked-by: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2013-06-17 15:10:04 +02:00
Laxman Dewangan c4fbec3c6b mfd: palmas: Initialise client->of_node for dummy created client
Palmas device have three different i2c addresses. The device creates
the two new dummy i2c clients for accessing the register by using
primary client adapter. This new dummy i2c client have their of_node
as NULL.

The dummy i2c client is used for registering interrupt and on this,
it creates irq domain handle. This created irq domain handle has
their of_node as NULL.

Now when any child of this device is registered through the DT as
follows:
         palmas: tps65913@58 {
         	::::::::::::::::::

         	#interrupt-cells = <2>;
                interrupt-controller;

                palmas_rtc {
                       compatible = "ti,palmas-rtc";
                       interrupt-parent = <&palmas>;
                       interrupts = <8 0>;
                };
                ::::::::::;;;
         };

And child driver (palam-rtc in this case) get their irq number as
	irq = platform_get_irq(pdev, 0);

The returned irq number is error in this case. The reason is that
the created irq_domain handle for the palmas interrupt does not have
valid node and so matching of node fails with palmas node.

Hence initialising the newly dummy created client->of_node with the
primary clients of_node so that irq_domain handle have proper of_node
for matching.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2013-04-08 18:13:20 +02:00
J Keerthy 2154a2b347 mfd: palmas: Change the DT node property names to follow the convention
DT node properties should not have "_". Replacing them by "-".

Signed-off-by: J Keerthy <j-keerthy@ti.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2013-04-05 17:53:42 +02:00
Laxman Dewangan df545d1cd0 mfd: palmas: Provide irq flags through DT/platform data
Currently driver sets the irq type to IRQF_TRIGGER_LOW which is
causing interrupt registration failure in ARM based SoCs as:
[    0.208479] genirq: Setting trigger mode 8 for irq 118 failed (gic_set_type+0x0/0xf0)
[    0.208513] dummy 0-0059: Failed to request IRQ 118: -22

Provide the irq flags through platform data if device is registered
through board file or get the irq type from DT node property in place
of hardcoding the irq flag in driver to support multiple platforms.

Also configure the device to generate the interrupt signal according to
flag type.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2013-03-12 09:25:49 +01:00
Laxman Dewangan a36516b016 mfd: palmas: Add rtc irq number as irq resource for palmas-rtc
Palma RTC is capable of generating alarm interrupt. Pass the alarm interrupt
as IRQ_RESOURCE for palmas-rtc sub device driver so that rtc driver can get
irq as platform_get_irq().

Also pass the irq domain in mfd_add_devices() to properly offset the irqs for
sub devices. This is needed when adding device through DT.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2013-02-14 00:22:44 +01:00
Bill Pemberton a9e9ce4c41 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>
2012-11-28 12:21:11 -08:00
Bill Pemberton f791be492f 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>
2012-11-28 12:20:19 -08:00
Graeme Gregory 9c14ac3345 mfd: palmas: Add device tree handling to mfd
Add device tree handling to the palmas MFD. This takes the values
that can be set from platform data from the device tree nodes instead.

Signed-off-by: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-09-23 20:41:59 +02:00
Graeme Gregory 190ef1a6e1 mfd: palmas: Add pdata/data for rest of children
Add the platform data and data structures for children that shall be
added by a future set of commits.

Signed-off-by: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-09-23 20:41:44 +02:00
Graeme Gregory 8664fade0d mfd: palmas: Switch to linear domain in all cases
Swith the palmas to linear domain in all cases so in future DT and non
DT cases will work the same.

With this patch children no longer need IRQ resources as it's easier
for them to use regmap_get_virq. So we can remove the resources
definitions.

Signed-off-by: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-09-21 23:40:37 +02:00
Graeme Gregory 3f78decc32 mfd: palmas: Improve the error exit path
Improve the error exit path so that we correctly de-allocate resources
that have been allocated upto the point where error occurs.

Signed-off-by: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-09-21 23:40:36 +02:00
Julia Lawall 8d2493781a mfd: palmas: Drop kfree of devm_kzalloc's data
Using kfree to free data allocated with devm_kzalloc causes double frees.

The semantic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression x;
@@

x = devm_kzalloc(...)
...
?-kfree(x);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-09-17 15:03:37 +02:00
Mark Brown 55692af5eb 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>
2012-09-14 09:51:54 +02:00
Graeme Gregory b330f85d3d mfd: Add missing hunk to change palmas irq to clear on read
During conversion to regmap_irq this hunk was missing being moved
to MFD driver to put the chip into clear on read mode. Also as slave
is now set use it to determine which slave for the register call.

Signed-off-by: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09 00:16:26 +02:00
Graeme Gregory adc20e02ae mfd: Fix palmas regulator pdata missing
Due to a merge error the section of code passing the pdata for the
regulator driver to the mfd_add_devices via the children structure
was missing. This corrects this problem.

Signed-off-by: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09 00:16:25 +02:00
Axel Lin 00ba81c152 mfd: Add terminating entry for i2c_device_id palmas table
The i2c_device_id table is supposed to be zero-terminated.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09 00:16:24 +02:00
Graeme Gregory 2945fbc2fc mfd: palmas PMIC device support
Palmas is a PMIC from Texas Instruments and this is the MFD part of the
driver for this chip. The PMIC has SMPS and LDO regulators, a general
purpose ADC, GPIO, USB OTG mode detection, watchdog and RTC features.

Signed-off-by: Graeme Gregory <gg@slimlogic.co.uk>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-18 16:54:47 +01:00