summaryrefslogtreecommitdiff
path: root/drivers/mfd/mc13xxx-core.c
AgeCommit message (Collapse)Author
2019-01-03mfd: mc13xxx: Fix a missing check of a register-read failureKangjie Lu
When mc13xxx_reg_read() fails, "old_adc0" is uninitialized and will contain random value. Further execution uses "old_adc0" even when mc13xxx_reg_read() fails. The fix checks the return value of mc13xxx_reg_read(), and exits the execution when it fails. Signed-off-by: Kangjie Lu <kjlu@umn.edu> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2018-10-23mfd: mc13xxx-core: Fix PMIC shutdown when reading ADC valuesFabio Estevam
When trying to read any MC13892 ADC channel on a imx51-babbage board: The MC13892 PMIC shutdowns completely. After debugging this issue and comparing the MC13892 and MC13783 initializations done in the vendor kernel, it was noticed that the CHRGRAWDIV bit of the ADC0 register was not being set. This bit is set by default after power on, but the driver was clearing it. After setting this bit it is possible to read the ADC values correctly. Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Tested-by: Chris Healy <cphealy@gmail.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2018-04-16hwmon: MC13783: Add uid and die temperature sensor inputsAndrey Gusakov
The uid and die temperature can be read out on the ADIN7 using input mux. Map uid and die temperature sensor to channels 16 and 17. Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com> Acked-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-12-04mfd: mc13xxx-core: Use of_property_read_bool()Saurabh Sengar
For checking if a property is present or not, use of_property_read_bool instead of of_get_property() Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-06-22mfd: mc13xxx-core: Pass the IRQF_ONESHOT flagFabio Estevam
Since commit 1c6c69525b40eb76de8adf039409722015927dc3 ("genirq: Reject bogus threaded irq requests") threaded IRQs without a primary handler need to be requested with IRQF_ONESHOT, otherwise the request will fail. So pass the IRQF_ONESHOT flag in this case. The semantic patch that makes this change is available in scripts/coccinelle/misc/irqf_oneshot.cocci. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-03-23mfd: mc13xxx-core: %pF is only for function pointersScott Wood
Use %pS for actual addresses, otherwise you'll get bad output on arches like ppc64 where %pF expects a function descriptor. Signed-off-by: Scott Wood <scottwood@freescale.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-09-26mfd: mc13xxx: Configure WDI resetMarkus Pargmann
Setup the PMIC to make a restart when a watchdog interrupt occures. If this is not configured, the PMIC will shut down the power supply without a restart. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-07-09mfd: mc13xxx: Use regmap irq framework for interruptsAlexander Shiyan
This patch convert mc13xxx MFD driver to use regmap irq framework for interrupt registration. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-06-03mfd: mc13xxx: Do not use platform data with devicetreeAlexander Shiyan
This patch removes platform data usage for codec and touchscreen when driver is used with devicetree. This fixes possible "null pointer dereference" error if DTS uses "fsl,mc13xxx-uses-codec" or "fsl,mc13xxx-uses-touch" options. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-06-03mfd: mc13xxx-core: Initialize the lock prior to using itFabio Estevam
After request_threaded_irq() is called there is a chance that an interrupt may occur before the 'mc13xxx->lock' is initialized, which will trigger a kernel oops. In order to prevent that, move the initialization of 'mc13xxx->lock' prior to requesting the interrupts. Suggested-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Acked-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-04-29ASoC: mc13783: Add devicetree supportAlexander Shiyan
This patch adds devicetree support for mc13783-codec. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-21mfd: mc13xxx: Simplify probe() & remove()Alexander Shiyan
This patch simplifies probe() and remove() functions by moving some initialisation code out from the I2C/SPI init() and exit() functions and into the core driver. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-01-21mfd: mc13xxx: Remove redundant checksAlexander Shiyan
Checking for maximal register is already provided by regmap API, so remove redundant checks. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-09-25mfd: mc13xxx: Don't require lock for simple register I/OMark Brown
Since the conversion to regmap there has been no need for device level locking for I/O as regmap provides locking so remove the locks. Signed-off-by: Mark Brown <broonie@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2012-11-06mfd: mc13xxx: Add support for mc34708Uwe Kleine-König
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Marc Reilly <marc@cpdesign.com.au> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-11-06mfd: mc13xxx: Change probing details for mc13xxx devicesUwe Kleine-König
This removes auto-detection of which variant of mc13xxx is used because mc34708 uses a different layout in the revision register that doesn't allow differentiation any more. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Marc Reilly <marc@cpdesign.com.au> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-09-21mfd: Use devm_* APIs for mc13xxx: remove leftover kfreeAndreas Pretzsch
commit e7c706b1e5ccf28eaaf76c7a4613e80b0ca52863 migrated the allocation of struct mc13xxx to devm_* functions, but left a kfree(mc13xxx) in the mc13xxx_common_init error path. Remove it to prevent memory corruption. Signed-off-by: Andreas Pretzsch <apr@cn-eng.de> Reviewed-by: Axel Lin <axel.lin@gmail.com> 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: Use devm_* APIs for mc13xxxAxel Lin
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-05-29Merge tag 'mfd-3.5-1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6 Pull MFD changes from Samuel Ortiz: "Besides the usual cleanups, this one brings: * Support for 5 new chipsets: Intel's ICH LPC and SCH Centerton, ST-E's STAX211, Samsung's MAX77693 and TI's LM3533. * Device tree support for the twl6040, tps65910, da9502 and ab8500 drivers. * Fairly big tps56910, ab8500 and db8500 updates. * i2c support for mc13xxx. * Our regular update for the wm8xxx driver from Mark." Fix up various conflicts with other trees, largely due to ab5500 removal etc. * tag 'mfd-3.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6: (106 commits) mfd: Fix build break of max77693 by adding REGMAP_I2C option mfd: Fix twl6040 build failure mfd: Fix max77693 build failure mfd: ab8500-core should depend on MFD_DB8500_PRCMU gpio: tps65910: dt: process gpio specific device node info mfd: Remove the parsing of dt info for tps65910 gpio mfd: Save device node parsed platform data for tps65910 sub devices mfd: Add r_select to lm3533 platform data gpio: Add Intel Centerton support to gpio-sch mfd: Emulate active low IRQs as well as active high IRQs for wm831x mfd: Mark two lm3533 zone registers as volatile mfd: Fix return type of lm533 attribute is_visible mfd: Enable Device Tree support in the ab8500-pwm driver mfd: Enable Device Tree support in the ab8500-sysctrl driver mfd: Add support for Device Tree to twl6040 mfd: Register the twl6040 child for the ASoC codec unconditionally mfd: Allocate twl6040 IRQ numbers dynamically mfd: twl6040 code cleanup in interrupt initialization part mfd: Enable ab8500-gpadc driver for Device Tree mfd: Prevent unassigned pointer from being used in ab8500-gpadc driver ...
2012-05-18mfd: mc13xxx: add codec platform dataPhilippe Rétornaz
Signed-off-by: Philippe Rétornaz <philippe.retornaz@epfl.ch> Acked-by: Samuel Ortiz <sameo@linux.intel.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-01mfd: Move the mc13xxx-core spi specific code into a separate moduleMarc Reilly
All spi specific code is moved into a new module. The mc13xxx struct moves to a new local include file by necessity. A new config choice selects the SPI bus type support and by default is value of SPI_MASTER to remain compatible with existing configs. Signed-off-by: Marc Reilly <marc@cpdesign.com.au> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-05-01mfd: Use regmap for the mc13xxx-core register accessMarc Reilly
This change converts the mc13xxx core to use regmap rather than direct spi r/w. The spidev member of mc13xxx struct becomes redundant and is removed. Extra debugging aids are added to mc13xxx_reg_rmw. Mutex init is moved to before regmap init. Signed-off-by: Marc Reilly <marc@cpdesign.com.au> Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-05-01mfd: Prepare for separating spi and i2c mc13xxx-core backendsMarc Reilly
This patch abstracts the bus specific operations from the driver core. Generic init and cleanup is consolidated into mc13xxx_common_*. spi specific functions are renamed to reflect such. (The irq member of the mc13xxx struct is no longer redundant, it's used to store the irq for cleanup time). Signed-off-by: Marc Reilly <marc@cpdesign.com.au> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-03-06mfd: Add pdata to set mc13783-ts conversion delayMichael Thalmeier
MC13783 can be programmed to wait some clock cycles between the touchscreen polarization and the resistance conversion. This is needed to adjust for touchscreens with high capacitance between plates. Signed-off-by: Michael Thalmeier <michael.thalmeier@hale.at> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Dmitry Torokhov <dtor@mail.ru> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-01-09mfd: Add device tree probe support for mc13xxxShawn Guo
This adds device tree probe support for mc13xxx mfd driver. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-01-09mfd: Fixed unconditional reset of the mc13xxx ADC reading enable bitsRobin van der Gracht
When the ADC is being prepared for a single or multiple channel reading, the adc0 register is reconfigured without taking the lithium cell, charge current and battery current reading enable bits into account. Which results in clearing the bits. Signed-off-by: Robin van der Gracht <robin@protonic.nl> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-01-09mfd: Remove redundant spi driver bus initializationLars-Peter Clausen
In ancient times it was necessary to manually initialize the bus field of an spi_driver to spi_bus_type. These days this is done in spi_driver_register(), so we can drop the manual assignment. The patch was generated using the following coccinelle semantic patch: // <smpl> @@ identifier _driver; @@ struct spi_driver _driver = { .driver = { - .bus = &spi_bus_type, }, }; // </smpl> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2011-10-24mfd: Fix a sparse warning about mc13xxx_chipname not being declaredUwe Kleine-König
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2011-10-24input: Add power button support for mc13783Philippe Rétornaz
This adds support for the power-on buttons of MC13783 PMIC. Signed-off-by: Philippe Rétornaz <philippe.retornaz@epfl.ch> Acked-by: Dmitry Torokhov <dtor@mail.ru> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2011-10-24mfd: Implicitly register mc13xxx led subdevicePhilippe Rétornaz
A led subdevice is registered now iff the corresponding platform data is available. Without platform data the device isn't usable so this is a sound check. Signed-off-by: Philippe Rétornaz <philippe.retornaz@epfl.ch> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2011-10-24mfd: Unconditionally register mc13xxx regulator subdevicePhilippe Rétornaz
Signed-off-by: Philippe Rétornaz <philippe.retornaz@epfl.ch> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2011-10-24mfd: Remove mc13783 API functions and symbolsUwe Kleine-König
Now that all in-tree users are fixed to use the more general mc13xxx API the obsolete stuff can go away. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2011-10-24mfd: Provide a generic version of mc13xxx adc_do_conversionUwe Kleine-König
This is needed to convert the touch driver away from using struct mc13783. Note this patch drops MC13783_ADC0_ADREFMODE. This is unused and doesn't exist on mc13892. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2011-05-26mfd: Use mfd cell platform_data for mc13xxx cells platform bitsSamuel Ortiz
With the addition of a platform device mfd_cell pointer, MFD drivers can go back to passing platform data back to their sub drivers. This allows for an mfd_cell->mfd_data removal and thus keep the sub drivers MFD agnostic. This is mostly needed for non MFD aware sub drivers. Cc: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: Liam Girdwood <lrg@slimlogic.co.uk> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2011-03-23mfd: Add MODULE_DEVICE_TABLE to mc13xxx-coreAxel Lin
The device table is required to load modules based on modaliases. After adding the MODULE_DEVICE_TABLE, below entries will be added to modules.alias: alias spi:mc13892 mc13xxx_core alias spi:mc13783 mc13xxx_core Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2011-03-23mfd: Rename platform_data field of mfd_cell to mfd_dataAndres Salomon
Rename the platform_data variable to imply a distinction between common platform_data driver usage (typically accessed via pdev->dev.platform_data) and the way MFD passes data down to clients (using a wrapper named mfd_get_data). All clients have already been changed to use the wrapper function, so this can be a quick single-commit change that only touches things in drivers/mfd. Signed-off-by: Andres Salomon <dilinger@queued.net> Acked-by: Linus Walleij <linus.walleij@stericsson.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2011-03-23mfd: mfd_cell is now implicitly available to mc13xxx driversAndres Salomon
The cell's platform_data is now accessed with a helper function; change clients to use that, and remove the now-unused data_size. Note that mfd-core no longer makes a copy of platform_data, but the mc13xxx-core driver creates the pdata structures on the stack. In order to get around that, the various ARM mach types that set the pdata have been changed to hold the variable in static (global) memory. Also note that __initdata references in aforementioned pdata structs have been dropped. Signed-off-by: Andres Salomon <dilinger@queued.net> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2011-01-14mfd: Don't open-code mc13xxx_unlockUwe Kleine-König
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2010-10-29mfd: Fix a memory leak when unload mc13xxx-core moduleAxel Lin
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2010-10-29mfd: Remove DEBUG defines from mc13xxx-coreSamuel Ortiz
DEBUG and VERBOSE_DEBUG are not used. Reported-by: David Jander <david@protonic.nl> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2010-10-29mfd: Add mc13892 support to mc13xxxUwe Kleine-König
mc13892 is the companion PMIC for Freescale's i.MX51. It's similar enough to mc13782 to support it in a single driver. This patch introduces enough compatibility cruft to keep all users of the superseded mc13783 driver unchanged. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>