summaryrefslogtreecommitdiffstats
path: root/drivers/mfd
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'for-next/stm32'Sascha Hauer2019-11-071-1/+0
|\
| * mfd: stpmic1: use dev_get_regmap instead of priv memberAhmad Fatoum2019-11-061-1/+0
| | | | | | | | | | | | | | | | | | When we call regmap_init, the regmap is associated with the device supplied and can be queried with dev_get_regmap. This is more natural than expecting cell drivers to cast dev->parent->priv. Do it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mfd: superio: use strerrorp helper instead of open-codingAhmad Fatoum2019-10-281-1/+1
|/ | | | | | | Apparently, we have a helper for strerror(-PTR_ERR(regmap)). Use it. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mfd: superio: add base SMSC MFD driverAhmad Fatoum2019-10-143-0/+122
| | | | | | | | | The SMSC FDC37C93xAPM is the Super I/O chip on the Dell Latitude 7490. This adds device detection for it and its siblings, so device drivers can be written against it or init scripts can use its regmap interface. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mfd: superio: add Fintek MFD driverAhmad Fatoum2019-10-143-0/+129
| | | | | | | | | Super I/O chips require a password to unlock access to the I/O ports. Add a driver that pokes the password and registers the appropriate GPIO and Watchdog devices as well as a regmap reflecting the Super I/O chip. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mfd: add basic Super I/O chip helpersAhmad Fatoum2019-10-143-0/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Super I/O chips are ICs common to x86 that are used for interfacing to low-bandwidth peripherals. They often contain serial ports, watchdog timers and hardware monitoring units. They are usually addressable via one of two I/O port pairs, either 0x2e-0x2f or 0x4e-0x4f, but they don't typically respond to reads from their range unless a device-specific 'password' has been poked in. After this is done, they are read and written in the same manner however. On Linux, these devices aren't subject to any device/driver model. Each driver for some function (e.g. watchdog or GPIO) duplicates the device probe in the module_init and board-specific configuration is handled via module parameters. Lets do it a bit fancier in barebox and add a helper to register chips and a regmap for the control and configuration registers as well as a helper to register child devices for each function contained within the Super I/O chip. Board-specific configuration, e.g. which pin to use as a watchdog reset, can then be realized using barebox device-specific parameters. The regmap will be more of a debugging aid, however. For ease of porting from Linux, it's expected that access to the I/O ports won't happen via the regmap. For this reason, the new <superio.h> header offers functions to read/write these chips' registers as well. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* gpio: add DA9062 MFD gpio supportMarco Felsch2019-10-141-0/+136
| | | | | | | | | The DA9062 PMIC is a mfd device which have 5 gpios. These can be configured to work as input/output or to have an alternate function. This commit adds the support to configure the gpios as input or output. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mfd: da9063: add support to populate subdevsMarco Felsch2019-10-141-0/+3
| | | | | | | | | | The upstream dt-bindings abstracts the DA9063/2 PMIC MFD by multiple of-subnodes and the linux-mfd core creates platform-devices for each node. Due to the lack of a mfd fw we need to add the platform-devices by our own to reuse the upstream bindings. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/stm32'Sascha Hauer2019-09-123-0/+106
|\
| * mfd: add support for STPMIC1Ahmad Fatoum2019-09-093-0/+106
| | | | | | | | | | | | | | | | | | The PMIC is addressable over I2C and, besides power management, integrates a watchdog, a user power on key handling and 64 bit of non-volatile memory. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/reset-source'Sascha Hauer2019-09-122-8/+2
|\ \
| * | mfd: da9063: use new reset_source_set_device()Uwe Kleine-König2019-09-091-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | Make use of the just introduced reset_source_set_device() to save some boilerplate. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | mfd: da9053: use new reset_source_set_device()Uwe Kleine-König2019-09-091-4/+1
| |/ | | | | | | | | | | | | | | Make use of the just introduced reset_source_set_device() to save some boilerplate. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / mfd: rave-sp: Emulate firmware/bootloader mode reporting on RDU2Andrey Smirnov2019-09-091-2/+16
|/ | | | | | | | | Add code to emulate firmware/bootloader mode reporting via "general_status" field on RDU2. This is needed to correctly report if RAVE SP is in bootloader of application mode during startup. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mfd: syscon: add syscon_regmap_lookup_by_phandle()Marcin Niestroj2019-07-021-0/+19
| | | | | | | | This function is handy when syscon is passed as phandle to device_node property. Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: Add missing includesSascha Hauer2019-03-181-0/+1
| | | | | | | | | Many files in the tree implement functions, but do not include the header files which provide the prototypes for these functions. This means conflicting prototypes remain undetected. Add the missing includes. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* regmap: Implement syscon_regmap_lookup_by_compatible()Ahmad Fatoum2019-02-251-0/+14
| | | | | | | | | Implement syscon_regmap_lookup_by_compatible() to simplify porting kernel code. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Tested-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* devfs: Drop dev_lseek_default()Andrey Smirnov2019-01-296-6/+0
| | | | | | | | | | | | | | | | | | | | | Only the following cdevs do not declare an .lseek() operation: - Console devices in common/console.c - Firmware framework in common/firmware.c - JTAG driver in drivers/misc/jtag.c - UBI in drivers/mtd/ubi/barebox.c Of those four, first two are marked DEVFS_IS_CHARACTER_DEV and implement only .write() operation and the last two don't implement anything but .ioctl(). While there's probably no meaningful way to use lseek() against any of those devices, there doesn't seem to be any harm in allowing it either. Change devfs_lseek() to ignore absense of .lseek() callback and drop dev_lseek_default() and all references to it in the codebase. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2019-01-152-7/+3
|\
| * mfd: syscon: Switch to using %pa to print memory addressesAndrey Smirnov2019-01-091-1/+1
| | | | | | | | | | | | | | | | Switch to using %pa to print memory addresses in order to be able to support both 64 and 32 bit builds. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mfd: rave-sp: Make use of wait_on_timeout()Andrey Smirnov2018-12-101-6/+2
| | | | | | | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mfd: rave-sp: Add parameters to query IP address/netmaskAndrey Smirnov2018-12-131-0/+72
|/ | | | | | | | | | | | Unlike LCD type information, IP address as well as netmaks are not stored in an easily usable format in RAVE SP EEPROM. In order to obtain them we need to issue a special command to RAVE SP. For that purpose add device "sp" and expose that data as a device parameters (sp.ipaddr and sp.netmask, correspondingly) Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mfd: da9063: fix wrong NULL pointer testOleksij Rempel2018-11-211-1/+1
| | | | | | | | checking for priv == NULL and using in this case priv->dev makes no sense. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: introduce device_i2c_driver() macroMarco Felsch2018-10-199-79/+9
| | | | | | | | | Add macro and dependency to avoid boilerplate code. Since now simple i2c drivers only have to include the i2c.h header and call the device_i2c_driver() macro to register a i2c device driver. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mfd: rave-sp: Emulate CMD_GET_STATUS on device that don't support itAndrey Smirnov2018-08-311-34/+66
| | | | | | | | | | | | | | CMD_GET_STATUS is not supported by some devices implementing RDU2-compatible ICD as well as "legacy" devices. To account for that fact, add code that obtains the same information (app/bootloader FW version) using several different commands. This is a backport of Linux kernel patch [1] [1] https://lore.kernel.org/lkml/20180707024108.32373-5-andrew.smirnov@gmail.com/T/#md1b7130a992235d57cabadc8e59fc74ee3b21d9e Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mfd: rave-sp: Add legacy watchdog ping command translationAndrey Smirnov2018-08-311-0/+2
| | | | | | | | | | | | This is needed to make rave-sp-wdt driver to properly ping the watchdog on "legacy" firmware. This is a backport of Linux kernel patch [1] [1] https://lore.kernel.org/lkml/20180707024108.32373-5-andrew.smirnov@gmail.com/T/#m767615239f8aa681a2dc0ccfe1c877e4cbb0edf6 Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mfd: rave-sp: Add mapping for legacy EEPROM commandAndrey Smirnov2018-08-311-0/+2
| | | | | | | | | | | | This is needed to make rave-sp-eeprom driver work on "legacy" firmware. This is a backport of Linux kernel patch [1] [1] https://lore.kernel.org/lkml/20180707024108.32373-5-andrew.smirnov@gmail.com/T/#mae2272763ae092b5b11ab128f5c22039d55557cb Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mfd: rave-sp: Fix incorrectly specified checksum typeAndrey Smirnov2018-08-311-1/+1
| | | | | | | | | | | | RAVE SP firmware covered by "legacy" variant uses 16-bit CCITT checksum algorithm. Change the code to correctly reflect that. This is a backport of Linux kernel patch [1] [1] https://lore.kernel.org/lkml/20180707024108.32373-5-andrew.smirnov@gmail.com/T/#m6251b0a4869dd303c21910fc99f2ce127cf8aae0 Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mfd: rave-sp: Remove unused definesAndrey Smirnov2018-08-311-10/+0
| | | | | | | | | | | | Remove unusded defines that are a leftover from earlier iterations of the driver. This is a backport of Linux kernel patch [1] [1] https://lore.kernel.org/lkml/20180707024108.32373-5-andrew.smirnov@gmail.com/T/#m02a75392c729828f822e2cd52f86e541b1649a27 Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* wdt: da9053: fix missed dev->hwdev conversionLucas Stach2018-06-081-1/+1
| | | | | | Fixes: 1ef7cd07a304 (watchdog: rename dev to hwdev) Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2018-05-093-0/+767
|\
| * mfd: Port RAVE SP driver from Linux kernelAndrey Smirnov2018-05-043-0/+767
| | | | | | | | | | | | | | Port MFD driver for RAVE SP from Linux kernel. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/mfd-dialog'Sascha Hauer2018-05-092-12/+149
|\ \
| * | mfd: da9063: update Kconfig for DA9062Stefan Christ2018-04-121-1/+1
| | | | | | | | | | | | | | | Signed-off-by: Stefan Christ <s.christ@phytec.de> Signed-off-by: Christian Hemp <c.hemp@phytec.de>
| * | mfd: da9063: read out and report device idEnrico Scholz2018-04-121-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | just some kind of debugging atm... Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Tested-by: Stefan Christ <s.christ@phytec.de> Signed-off-by: Christian Hemp <c.hemp@phytec.de>
| * | mfd: da9063: added of_device_id informationEnrico Scholz2018-04-121-0/+47
| | | | | | | | | | | | | | | | | | Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Tested-by: Stefan Christ <s.christ@phytec.de> Signed-off-by: Christian Hemp <c.hemp@phytec.de>
| * | mfd: da9063: add device specific init functionEnrico Scholz2018-04-121-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | Provide some more information about the used PMIC type; later patches will add support for DA9062 which needs a custom init function. Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Tested-by: Stefan Christ <s.christ@phytec.de> Signed-off-by: Christian Hemp <c.hemp@phytec.de>
| * | mfd: da9063: use da906x_reg_update()Enrico Scholz2018-04-121-9/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use the previously added da906x_reg_update() function. NOTE: patch depends on another patchset ("da9063: reset watchdog timer"), Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Tested-by: Stefan Christ <s.christ@phytec.de> Signed-off-by: Christian Hemp <c.hemp@phytec.de>
| * | mfd: da9063: added generic reg_update() functionEnrico Scholz2018-04-121-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Used to set or clear bits of a register. The calculation of 'client' might look odd and unnecessary complicated. But style prepares access to other register banks which is added in following patches. Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Tested-by: Stefan Christ <s.christ@phytec.de> Signed-off-by: Christian Hemp <c.hemp@phytec.de>
| * | mfd: da9063: reset watchdog timerEnrico Scholz2018-04-121-2/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Setting the new timeout does not suffice for restarting the watchdog; the self-clearing bit in CONTROL_F must be set too. barebox does not provide a ping function in its watchdog api to restart the watchdog timer. Detect ping vs. set_timeout() by comparing the actual with the previous timeout value. Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Tested-by: Stefan Christ <s.christ@phytec.de> Signed-off-by: Christian Hemp <c.hemp@phytec.de>
* | | Merge branch 'for-next/aiodev'Sascha Hauer2018-05-091-0/+15
|\ \ \ | |/ / |/| |
| * | aiodev: mc13xxx: add adc supportAndrey Gusakov2018-04-101-0/+3
| | | | | | | | | | | | | | | Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | mfd: mc13xxx: add function returning mc13xxx typeAndrey Gusakov2018-04-101-0/+12
| |/ | | | | | | | | Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / mfd: da9063: Fix compilationSascha Hauer2018-04-121-1/+1
|/ | | | | | Fixes: 1ef7cd07a3 watchdog: rename dev to hwdev Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* rename file_operations -> cdev_operationsSascha Hauer2018-04-066-6/+6
| | | | | | | | Linux also has struct file_operations which are something different. Rename our file_operations to cdev_operations which better matches what we have. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* regmap: Implement syscon_node_to_regmap()Andrey Smirnov2017-03-091-1/+53
| | | | | | | Implement syscon_node_to_regmap() to simplify porting kernel code. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* da9053: add dt_ids to be probed by devicetreeMichael Grzeschik2017-01-101-0/+9
| | | | | | | | We add the da9052 compatible to get this driver probed by devicetree users. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* da9053: reset FAULTLOG after readMichael Grzeschik2017-01-101-0/+4
| | | | | | | | | | The driver has to reset the FAULTLOG register after every read by writing the value back. In the current case the FALUTLOG register keep its value over every software reset and will only reset on power-off. This drives the reset-source value unreliable. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mfd: syscon: drop EXPORT_SYMBOL for static functionLucas Stach2016-10-041-2/+0
| | | | | Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mfd mc13xxx: add MC13892_REVISION_2_4Alexander Kurz2016-08-181-0/+1
| | | | | | | | An MC13892CJ having REV[4:0]=0x14 can be found in the kindle-d01100. Add the revision to the list to support this device. Signed-off-by: Alexander Kurz <akurz@blala.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>