summaryrefslogtreecommitdiff
path: root/drivers/mfd/palmas.c
AgeCommit message (Collapse)Author
2023-11-01mfd: palmas: Make similar OF and ID tableBiju Das
Make similar OF and ID table to extend support for ID match using i2c_match_data(). Currently it works only for OF match tables as the driver_data is wrong for ID match. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Link: https://lore.kernel.org/r/20230831183153.63750-5-biju.das.jz@bp.renesas.com Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01mfd: palmas: Move OF table closer to its consumerBiju Das
Move OF table near to the user. While at it, arrange compatible and data in single line. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Link: https://lore.kernel.org/r/20230831183153.63750-4-biju.das.jz@bp.renesas.com Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01mfd: palmas: Constify .data in OF table and {palmas,tps65917}_irq_chipBiju Das
Constify .data in OF table and {palmas,tps65917}_irq_chip and replace the variable *features->features in struct palmas_driver_data and drop the {palmas,tps659038}_features variables and use their values directly in the named initialization. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Link: https://lore.kernel.org/r/20230831183153.63750-3-biju.das.jz@bp.renesas.com Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01mfd: palmas: Remove trailing comma in the terminator entryBiju Das
Remove trailing comma in the terminator entry for OF table. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Link: https://lore.kernel.org/r/20230831183153.63750-2-biju.das.jz@bp.renesas.com Signed-off-by: Lee Jones <lee@kernel.org>
2023-08-18mfd: Explicitly include correct DT includesRob Herring
The DT of_device.h and of_platform.h date back to the separate of_platform_bus_type before it as merged into the regular platform bus. As part of that merge prepping Arm DT support 13 years ago, they "temporarily" include each other. They also include platform_device.h and of.h. As a result, there's a pretty much random mix of those include files used throughout the tree. In order to detangle these headers and replace the implicit includes with struct declarations, users need to explicitly include the correct includes. Signed-off-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20230714174731.4059811-1-robh@kernel.org Signed-off-by: Lee Jones <lee@kernel.org>
2023-06-15mfd: Switch i2c drivers back to use .probe()Uwe Kleine-König
After commit b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new() call-back type"), all drivers being converted to .probe_new() and then 03c835f498b5 ("i2c: Switch .probe() to not take an id parameter") convert back to (the new) .probe() to be able to eventually drop .probe_new() from struct i2c_driver. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230515182752.10050-1-u.kleine-koenig@pengutronix.de Signed-off-by: Lee Jones <lee@kernel.org>
2022-12-07mfd: palmas: Use device_get_match_data() to simplify the codeye xingchen
Directly get the match data with device_get_match_data(). Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn> Signed-off-by: Lee Jones <lee@kernel.org> Link: https://lore.kernel.org/r/202211171952240424511@zte.com.cn
2022-12-07mfd: palmas: Convert to i2c's .probe_new()Uwe Kleine-König
The probe function doesn't make use of the i2c_device_id * parameter so it can be trivially converted. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Lee Jones <lee@kernel.org> Link: https://lore.kernel.org/r/20221118224540.619276-450-uwe@kleine-koenig.org
2022-08-16i2c: Make remove callback return voidUwe Kleine-König
The value returned by an i2c driver's remove function is mostly ignored. (Only an error message is printed if the value is non-zero that the error is ignored.) So change the prototype of the remove function to return no value. This way driver authors are not tempted to assume that passing an error to the upper layer is a good idea. All drivers are adapted accordingly. There is no intended change of behaviour, all callbacks were prepared to return 0 before. Reviewed-by: Peter Senna Tschudin <peter.senna@gmail.com> Reviewed-by: Jeremy Kerr <jk@codeconstruct.com.au> Reviewed-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Reviewed-by: Crt Mori <cmo@melexis.com> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Acked-by: Marek Behún <kabel@kernel.org> # for leds-turris-omnia Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Petr Machata <petrm@nvidia.com> # for mlxsw Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com> # for surface3_power Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> # for bmc150-accel-i2c + kxcjk-1013 Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> # for media/* + staging/media/* Acked-by: Miguel Ojeda <ojeda@kernel.org> # for auxdisplay/ht16k33 + auxdisplay/lcd2s Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> # for versaclock5 Reviewed-by: Ajay Gupta <ajayg@nvidia.com> # for ucsi_ccg Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> # for iio Acked-by: Peter Rosin <peda@axentia.se> # for i2c-mux-*, max9860 Acked-by: Adrien Grassein <adrien.grassein@gmail.com> # for lontium-lt8912b Reviewed-by: Jean Delvare <jdelvare@suse.de> # for hwmon, i2c-core and i2c/muxes Acked-by: Corey Minyard <cminyard@mvista.com> # for IPMI Reviewed-by: Vladimir Oltean <olteanv@gmail.com> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com> # for drivers/power Acked-by: Krzysztof Hałasa <khalasa@piap.pl> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Wolfram Sang <wsa@kernel.org>
2019-08-12mfd: palmas: Convert to i2c_new_dummy_deviceWolfram Sang
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-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152Thomas Gleixner
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>
2018-01-08mfd: palmas: Assign the right powerhold mask for tps65917Keerthy
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>
2017-07-06mfd: palmas: Use devm_of_platform_populate()Benjamin Gaignard
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-04-27mfd: palmas: Fixed spelling mistake in error messageWillis Monroe
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-27mfd: palmas: Reset the POWERHOLD mux during power offKeerthy
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>
2016-11-29mfd: palmas: Remove redundant check in palmas_power_offKeerthy
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>
2015-08-11mfd: Drop owner assignment from i2c_driversKrzysztof Kozlowski
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>
2014-06-23regulator: palmas: add driver data and modularize the probeKeerthy
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-23mfd: palmas: shift the palmas_sleep_requestor_info structure definition to ↵Keerthy
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-23mfd: palmas: Add tps65917 supportKeerthy
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>
2013-10-23mfd: palmas: Remove redundant of_match_ptrSachin Kamat
'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-23mfd: palmas: Fix resource leak of i2c_dummy devicesLaxman Dewangan
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-23mfd: palmas: Reset pm_power_off if it is set for the deviceLaxman Dewangan
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-23mfd: palmas: Add MODULE_DEVICE_TABLE for of_device tableLaxman Dewangan
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-10-23mfd: palmas: Remove call of mfd_remove_devicesLaxman Dewangan
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-08-21Merge tag 'mfd-lee-3.12-1' of git://git.linaro.org/people/ljones/mfdSamuel Ortiz
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2013-08-20mfd: palmas: Add support for external control configurationLaxman Dewangan
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-14mfd: palmas: Add power off controlBill Huang
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-06-24mfd: palmas: Add TPS659038 PMIC supportJ Keerthy
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-20mfd: palmas: Add SMPS10_BOOST featureJ Keerthy
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-20mfd: palmas: Check if irq is validJ Keerthy
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-17mfd: palmas: Remove code which is not necessary for a device tree bootJ Keerthy
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-04-08mfd: palmas: Initialise client->of_node for dummy created clientLaxman Dewangan
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-05mfd: palmas: Change the DT node property names to follow the conventionJ Keerthy
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-03-12mfd: palmas: Provide irq flags through DT/platform dataLaxman Dewangan
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-02-14mfd: palmas: Add rtc irq number as irq resource for palmas-rtcLaxman Dewangan
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>
2012-11-28mfd: remove use of __devinitdataBill Pemberton
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-28mfd: remove use of __devinitBill Pemberton
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-09-23mfd: palmas: Add device tree handling to mfdGraeme Gregory
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-23mfd: palmas: Add pdata/data for rest of childrenGraeme Gregory
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-21mfd: palmas: Switch to linear domain in all casesGraeme Gregory
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-21mfd: palmas: Improve the error exit pathGraeme Gregory
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-17mfd: palmas: Drop kfree of devm_kzalloc's dataJulia Lawall
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-14mfd: core: Push irqdomain mapping out into devicesMark Brown
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-07-09mfd: Add missing hunk to change palmas irq to clear on readGraeme Gregory
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-09mfd: Fix palmas regulator pdata missingGraeme Gregory
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-09mfd: Add terminating entry for i2c_device_id palmas tableAxel Lin
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-05-18mfd: palmas PMIC device supportGraeme Gregory
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>