summaryrefslogtreecommitdiff
path: root/drivers/mfd
AgeCommit message (Collapse)Author
2020-05-26mfd: wm8994: Silence warning about supplies during deferred probeMarek Szyprowski
Don't confuse user with meaningless warning about the failure in getting supplies in case of deferred probe. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-05-26mfd: wm8994: Fix unbalanced calls to regulator_bulk_disable()Marek Szyprowski
When runtime PM is enabled, regulators are being controlled by the driver's suspend and resume callbacks. They are also unconditionally enabled at driver's probe(), and disabled in remove() functions. Add more calls to runtime PM framework to ensure that the device's runtime PM state matches the regulators state: 1. at the end of probe() function: set runtime PM state to active, so there will be no spurious call to resume(); 2. in remove(), ensure that resume() is called before disabling runtime PM management and unconditionally disabling the regulators. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-05-26mfd: wm8994: Fix driver operation if loaded as modulesMarek Szyprowski
WM8994 chip has built-in regulators, which might be used for chip operation. They are controlled by a separate wm8994-regulator driver, which should be loaded before this driver calls regulator_get(), because that driver also provides consumer-supply mapping for the them. If that driver is not yet loaded, regulator core substitute them with dummy regulator, what breaks chip operation, because the built-in regulators are never enabled. Fix this by annotating this driver with MODULE_SOFTDEP() "pre" dependency to "wm8994_regulator" module. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-05-26mfd: stm32-timers: Use dma_request_chan() instead dma_request_slave_channel()Peter Ujfalusi
dma_request_slave_channel() is a wrapper on top of dma_request_chan() eating up the error code. By using dma_request_chan() directly the driver can support deferred probing against DMA. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Acked-by: Fabrice Gasnier <fabrice.gasnier@st.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-05-26mfd: sprd: Remove unnecessary spi_bus_type settingBaolin Wang
The spi_register_driver() will set the spi_bus_type for the spi_driver, thus remove the redundant setting in this driver. Signed-off-by: Baolin Wang <baolin.wang7@gmail.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-05-26mfd: intel-lpss: Update LPSS UART #2 PCI ID for Jasper LakeAndy Shevchenko
It appears that preliminary documentation has a typo in the ID list, i.e. LPSS UART #2 had been advertised wrongly. Fix the driver according to the EDS v0.9. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-05-26mfd: tqmx86: Fix a typo in MODULE_DESCRIPTIONChristophe JAILLET
Based on the file name and code of the driver, it is likely that this module is related to TQMx86 and not TQx86. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-05-26mfd: stpmic1: Make stpmic1_regmap_config staticYueHaibing
Fix sparse warning: drivers/mfd/stpmic1.c:62:28: warning: symbol 'stpmic1_regmap_config' was not declared. Should it be static? Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: YueHaibing <yuehaibing@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-05-26mfd: htc-i2cpld: Convert to use i2c_new_client_device()Wolfram Sang
Move away from the deprecated API and return the shiny new ERRPTR where useful. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-05-26Merge branches 'ib-mfd-x86-usb-watchdog-5.8', 'ib-mfd-power-rtc-5.8', ↵Lee Jones
'ib-mfd-iio-power-5.8' and 'ib-mfd-hwmon-5.8' into ibs-for-mfd-merged
2020-05-26mfd: mp2629: Add support for mps battery chargerSaravanan Sekar
mp2629 is a highly-integrated switching-mode battery charge management device for single-cell Li-ion or Li-polymer battery. Add MFD core enables chip access for ADC driver for battery readings, and a power supply battery-charger driver Signed-off-by: Saravanan Sekar <sravanhome@gmail.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-05-25gpio: dwapb: Remove unneeded has_irq member in struct dwapb_port_propertyAndy Shevchenko
has_irq member of struct dwapb_port_property is used only in one place, so, make it local test instead and remove from the structure. This local test is using memchr_inv() which is quite efficient in comparison to the original loop and possible little overhead can be neglected. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Tested-by: Serge Semin <fancer.lancer@gmail.com> Acked-by: Lee Jones <lee.jones@linaro.org> Acked-by: Serge Semin <fancer.lancer@gmail.com> Link: https://lore.kernel.org/r/20200519131233.59032-4-andriy.shevchenko@linux.intel.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-05-21mfd: Add support for the MediaTek MT6358 PMICHsin-Hsiung Wang
This adds support for the MediaTek MT6358 PMIC. This is a multifunction device with the following sub modules: - Regulator - RTC - Codec - Interrupt It is interfaced to the host controller using SPI interface by a proprietary hardware called PMIC wrapper or pwrap. MT6358 MFD is a child device of the pwrap. Signed-off-by: Hsin-Hsiung Wang <hsin-hsiung.wang@mediatek.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-05-21mfd: mt6397: Trim probe function to support different chips more cleanlyHsin-Hsiung Wang
Add new struct members for mfd-cells and irq initial function, so we can call devm_mfd_add_devices() only once. Signed-off-by: Hsin-Hsiung Wang <hsin-hsiung.wang@mediatek.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-05-21mfd: mt6397: Modify suspend/resume behaviorHsin-Hsiung Wang
Some pmics don't need backup interrupt settings, so we change to use pm notifier for the pmics which are necessary to store settings. Signed-off-by: Hsin-Hsiung Wang <hsin-hsiung.wang@mediatek.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-05-20mfd: Add Gateworks System Controller core driverTim Harvey
The Gateworks System Controller (GSC) is an I2C slave controller implemented with an MSP430 micro-controller whose firmware embeds the following features: - I/O expander (16 GPIO's) using PCA955x protocol - Real Time Clock using DS1672 protocol - User EEPROM using AT24 protocol - HWMON using custom protocol - Interrupt controller with tamper detect, user pushbotton - Watchdog controller capable of full board power-cycle - Power Control capable of full board power-cycle see http://trac.gateworks.com/wiki/gsc for more details Signed-off-by: Tim Harvey <tharvey@gateworks.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-05-18mfd: sm501: Use GPIO_LOOKUP_IDX() helper macroGeert Uytterhoeven
i801_add_mux() fills in the GPIO lookup table by manually populating an array of gpiod_lookup structures. Use the existing GPIO_LOOKUP_IDX() helper macro instead, to relax a dependency on the gpiod_lookup structure's member names. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Acked-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20200511145257.22970-3-geert+renesas@glider.be Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-05-13vexpress: Move setting master site to vexpress-config busRob Herring
There's only a single caller of vexpress_config_set_master() from vexpress-sysreg.c. Let's just make the registers needed available to vexpress-config and move all the code there. The registers needed aren't used anywhere else either. With this, we can get rid of the private API between these 2 drivers. Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Cc: Linus Walleij <linus.walleij@linaro.org> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Acked-by: Liviu Dudau <liviu.dudau@arm.com> Acked-by: Sudeep Holla <sudeep.holla@arm.com> Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Rob Herring <robh@kernel.org>
2020-05-13mfd: vexpress-sysreg: Support building as a moduleRob Herring
Enable building the vexpress-sysreg driver as a module. As deferred probe between the vexpress components works now, we don't need to create struct devices early with of_platform_device_create(). Cc: Liviu Dudau <liviu.dudau@arm.com> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Cc: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Sudeep Holla <sudeep.holla@arm.com> Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Rob Herring <robh@kernel.org>
2020-05-13mfd: vexpress-sysreg: Use devres API variantsRob Herring
Use the managed devm_gpiochip_add_data() and devm_mfd_add_devices() instead of their unmanaged counterparts. With this, no .remove() hook is needed for driver unbind. Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Cc: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Sudeep Holla <sudeep.holla@arm.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Liviu Dudau <liviu.dudau@arm.com> Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Rob Herring <robh@kernel.org>
2020-05-13mfd: vexpress-sysreg: Drop unused syscon child devicesRob Herring
The "sys_id", "sys_misc" and "sys_procid" devices don't have a user anywhere in the tree and do nothing more than create a syscon regmap for a single register or 2. That's an overkill for creating child devices. Let's just remove them. Cc: Liviu Dudau <liviu.dudau@arm.com> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Cc: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Sudeep Holla <sudeep.holla@arm.com> Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Rob Herring <robh@kernel.org>
2020-05-13mfd: vexpress-sysreg: Drop selecting CONFIG_CLKSRC_MMIORob Herring
Nothing in the VExpress sysregs nor the MFD child drivers use CONFIG_CLKSRC_MMIO. There's the 24MHz counter, but that's handled by drivers/clocksource/timer-versatile.c which doesn't use CONFIG_CLKSRC_MMIO either. So let's just drop CONFIG_CLKSRC_MMIO. As the !ARCH_USES_GETTIMEOFFSET dependency was added for CONFIG_CLKSRC_MMIO, that can be dropped, too. Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Cc: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Sudeep Holla <sudeep.holla@arm.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Liviu Dudau <liviu.dudau@arm.com> Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Rob Herring <robh@kernel.org>
2020-05-05ARM: vexpress: Move vexpress_flags_set() into arch codeRob Herring
vexpress_flags_set() is only used by the platform SMP related code and has nothing to do with the vexpress-sysreg MFD driver other than both access the same h/w block. It's also only needed for 32-bit systems and must be built-in for them. Let's move vexpress_flags_set() closer to where it is being used. This will allow for vexpress-sysreg to be built as a module. Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Cc: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Sudeep Holla <sudeep.holla@arm.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Liviu Dudau <liviu.dudau@arm.com> Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Rob Herring <robh@kernel.org>
2020-04-24platform/x86: intel_pmc_ipc: Convert to MFDMika Westerberg
This driver only creates a bunch of platform devices sharing resources belonging to the PMC device. This is pretty much what MFD subsystem is for so move the driver there, renaming it to intel_pmc_bxt.c which should be more clear what it is. MFD subsystem provides nice helper APIs for subdevice creation so convert the driver to use those. Unfortunately the ACPI device includes separate resources for most of the subdevices so we cannot simply call mfd_add_devices() to create all of them but instead we need to call it separately for each device. The new MFD driver continues to expose two sysfs attributes that allow userspace to send IPC commands to the PMC/SCU to avoid breaking any existing applications that may use these. Generally this is bad idea so document this in the ABI documentation. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-04-24mfd: intel_soc_pmic_mrfld: Convert to use new SCU IPC APIMika Westerberg
This converts the Intel Merrifield PMIC driver over the new SCU IPC API where the SCU IPC instance is passed to the functions. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-04-24mfd: intel_soc_pmic_bxtwc: Convert to use new SCU IPC APIMika Westerberg
Convert the Intel Broxton Whiskey Cover PMIC driver to use the new SCU IPC API. This allows us to get rid of the PMC IPC implementation which is now covered in SCU IPC driver. We drop the error log if the IPC command fails because intel_scu_ipc_dev_command() does that already. Also move PMIC specific IPC message constants to the PMIC driver from the intel_pmc_ipc.h header. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-04-24platform/x86: intel_scu_ipc: Split out SCU IPC functionality from the SCU driverMika Westerberg
The SCU IPC functionality is usable outside of Intel MID devices. For example modern Intel CPUs include the same thing but now it is called PMC (Power Management Controller) instead of SCU. To make the IPC available for those split the driver into core part (intel_scu_ipc.c) and the SCU PCI driver part (intel_scu_pcidrv.c) which then calls the former before it goes and creates rest of the SCU devices. The SCU IPC will also register a new class that gets assigned to the device that is created under the parent PCI device. We also split the Kconfig symbols so that INTEL_SCU_IPC enables the SCU IPC library and INTEL_SCU_PCI the SCU driver and convert the users accordingly. While there remove default y from the INTEL_SCU_PCI symbol as it is already selected by X86_INTEL_MID. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-03-30mfd: intel-lpss: Fix Intel Elkhart Lake LPSS I2C input clockJarkko Nikula
Intel Elkhart Lake LPSS I2C has 100 MHz input clock instead of 133 MHz that was our preliminary information. This will result slower I2C bus clock when driver calculates its timing parameters in case ACPI tables don't provide them. Slower I2C bus clock is allowed but let's fix this to match with reality. While at it, keep the same default I2C device properties as Intel Broxton since it is not known do they need any update. Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-03-30mfd: aat2870: Use scnprintf() for avoiding potential buffer overflowTakashi Iwai
There is still one call of sprintf() without checking the proper buffer overflow in aat2870_dump_reg(). Replace it with scnprintf() call for covering that. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-03-30mfd: dln2: Allow to be enumerated via ACPIAndy Shevchenko
On some platforms user may want to enumerate DLN2 device, its children, to be enumerated via ACPI. In order to achieve this, let's distinguish children by _ADR value. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-03-30mfd: da9062: Add support for interrupt polarity defined in device treeShreyas Joshi
The da9062 interrupt handler cannot necessarily be low active. Add a function to configure the interrupt type based on what is defined in the device tree. The allowable interrupt type is either low or high level trigger. Signed-off-by: Shreyas Joshi <shreyas.joshi@biamp.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-03-30mfd: dln2: Fix sanity checking for endpointsAndy Shevchenko
While the commit 2b8bd606b1e6 ("mfd: dln2: More sanity checking for endpoints") tries to harden the sanity checks it made at the same time a regression, i.e. mixed in and out endpoints. Obviously it should have been not tested on real hardware at that time, but unluckily it didn't happen. So, fix above mentioned typo and make device being enumerated again. While here, introduce an enumerator for magic values to prevent similar issue to happen in the future. Fixes: 2b8bd606b1e6 ("mfd: dln2: More sanity checking for endpoints") Cc: Oliver Neukum <oneukum@suse.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-03-30mfd: intel-lpss: Add Intel Comet Lake PCH-V PCI IDsAndy Shevchenko
Intel Comet Lake PCH-V has the same LPSS than Intel Kaby Lake. Add the new IDs to the list of supported devices. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-03-30mfd: sc27xx: Add USB charger type detection supportBaolin Wang
The Spreadtrum SC27XX series PMICs supply the USB charger type detection function, and related registers are located on the PMIC global registers region, thus we implement and export this function in the MFD driver for users to get the USB charger type. Signed-off-by: Baolin Wang <baolin.wang7@gmail.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-03-30mfd: rk808: Convert RK805 to shutdown/suspend hooksRobin Murphy
RK805 has the same kind of dual-role sleep/shutdown pin as RK809/RK817, so it makes little sense for the driver to have to have two completely different mechanisms to handle essentially the same thing. Move RK805 over to the shutdown/suspend flow to clean things up. Signed-off-by: Robin Murphy <robin.murphy@arm.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-03-30mfd: rk808: Reduce shutdown duplicationRobin Murphy
Rather than having 3 almost-identical functions plus the machinery to keep track of them, it's far simpler to just dynamically select the appropriate register field per variant. Signed-off-by: Robin Murphy <robin.murphy@arm.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-03-30mfd: rk808: Stop using syscore opsRobin Murphy
Setting the SLEEP pin to its shutdown function for appropriate PMICs doesn't need to happen in single-CPU context, so there's really no point involving the syscore machinery. Hook it up to the standard driver model shutdown method instead. This also obviates the issue that the syscore ops weren't being unregistered on probe failure or module removal. Signed-off-by: Robin Murphy <robin.murphy@arm.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-03-30mfd: rk808: Ensure suspend/resume hooks always workRobin Murphy
The RK809/RK817 suspend/resume hooks should not have to depend on whether this driver owns the pm_power_off hook, and thus the global rk808_i2c_client is set - indeed, the GPIO-based control is really only relevant when PSCI firmware is in charge of power rather than the kernel. As driver model callbacks, they have an appropriate device argument to hand, so can just always use that. Signed-off-by: Robin Murphy <robin.murphy@arm.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-03-30mfd: rk808: Always use poweroff when requestedSoeren Moch
With the device tree property "rockchip,system-power-controller" we explicitly request to use this PMIC to power off the system. So always register our poweroff function, even if some other handler (probably PSCI poweroff) was registered before. This does tend to reveal a warning on shutdown due to the Rockchip I2C driver not implementing an atomic transfer method, however since the write to DEV_OFF takes effect immediately the I2C completion interrupt is moot anyway, and as the very last thing written to the console it is only visible to users going out of their way to capture serial output. Signed-off-by: Soeren Moch <smoch@web.de> Reviewed-by: Heiko Stuebner <heiko@sntech.de> [ rm: note potential warning in commit message ] Signed-off-by: Robin Murphy <robin.murphy@arm.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-03-30mfd: omap: Remove useless cast for driver.nameCorentin Labbe
device_driver name is const char pointer, so it not useful to cast xx_driver_name (which is already const char). Signed-off-by: Corentin Labbe <clabbe@baylibre.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-03-30mfd: Kconfig: Fix some misspelling of the word functionalityChristophe JAILLET
Fix several variations of typo around functionali{ty,es}. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-03-30mfd: pm8xxx: Replace zero-length array with flexible-array memberGustavo A. R. Silva
The current codebase makes use of the zero-length array language extension to the C90 standard, but the preferred mechanism to declare variable-length types such as these ones is a flexible array member[1][2], introduced in C99: struct foo { int stuff; struct boo array[]; }; By making use of the mechanism above, we will get a compiler warning in case the flexible array does not occur last in the structure, which will help us prevent some kind of undefined behavior bugs from being inadvertently introduced[3] to the codebase from now on. Also, notice that, dynamic memory allocations won't be affected by this change: "Flexible array members have incomplete type, and so the sizeof operator may not be applied. As a quirk of the original implementation of zero-length arrays, sizeof evaluates to zero."[1] This issue was found with the help of Coccinelle. [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html [2] https://github.com/KSPP/linux/issues/21 [3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour") Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-03-30mfd: omap-usb-tll: Replace zero-length array with flexible-array memberGustavo A. R. Silva
The current codebase makes use of the zero-length array language extension to the C90 standard, but the preferred mechanism to declare variable-length types such as these ones is a flexible array member[1][2], introduced in C99: struct foo { int stuff; struct boo array[]; }; By making use of the mechanism above, we will get a compiler warning in case the flexible array does not occur last in the structure, which will help us prevent some kind of undefined behavior bugs from being inadvertently introduced[3] to the codebase from now on. Also, notice that, dynamic memory allocations won't be affected by this change: "Flexible array members have incomplete type, and so the sizeof operator may not be applied. As a quirk of the original implementation of zero-length arrays, sizeof evaluates to zero."[1] This issue was found with the help of Coccinelle. [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html [2] https://github.com/KSPP/linux/issues/21 [3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour") Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-03-30mfd: cpcap: Fix compile if MFD_CORE is not selectedTony Lindgren
If only cpcap mfd driver is selected we will get: ERROR: "devm_mfd_add_devices" [drivers/mfd/motorola-cpcap.ko] undefined! This is because Kconfig is missing select for MFD_CORE. Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-03-30mfd: cros_ec: Check DT node for usbpd-notify addPrashant Malani
Add a check to ensure there is indeed an EC device tree entry before adding the cros-usbpd-notify device. This covers configs where both CONFIG_ACPI and CONFIG_OF are defined, but the EC device is defined using device tree and not in ACPI. Fixes: 4602dce0361e ("mfd: cros_ec: Add cros-usbpd-notify subdevice") Signed-off-by: Prashant Malani <pmalani@chromium.org> Tested-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-03-30Merge branches 'ib-mfd-iio-input-5.7' and 'ib-mfd-iio-rtc-5.7' into ↵Lee Jones
ibs-for-mfd-merged
2020-03-27mfd: rn5t618: Cleanup i2c_device_idAndreas Kemnade
That list was just empty, so it can be removed if .probe_new instead of .probe is used Suggested-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Andreas Kemnade <andreas@kemnade.info> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-03-27mfd: rn5t618: Add more subdevicesAndreas Kemnade
Since the RC5T619 has a RTC, use a separate subdevice list for that. The ADC should be the same as in the RN5T618, according to drivers in the wild, but since it is not tested, the ADC is only added for the RC5T619. Signed-off-by: Andreas Kemnade <andreas@kemnade.info> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-03-27mfd: rn5t618: Add RTC related registersAndreas Kemnade
Defines for some RTC related registers were missing, also they were not included in the volatile register list Signed-off-by: Andreas Kemnade <andreas@kemnade.info> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-03-27mfd: rn5t618: Add IRQ supportAndreas Kemnade
This adds support for IRQ handling in the RC5T619 which is required for properly implementing subdevices like RTC. For now only definitions for the variant RC5T619 are included. Signed-off-by: Andreas Kemnade <andreas@kemnade.info> Signed-off-by: Lee Jones <lee.jones@linaro.org>