summaryrefslogtreecommitdiff
path: root/drivers/mfd/adp5585.c
AgeCommit message (Collapse)Author
2025-07-01mfd: adp5585: Add support for a reset pinNuno Sá
Make sure to perform an Hardware reset during probe if the pin is given in FW. Signed-off-by: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20250701-dev-adp5589-fw-v7-20-b1fcfe9e9826@analog.com Signed-off-by: Lee Jones <lee@kernel.org>
2025-07-01mfd: adp5585: Support getting vdd regulatorNuno Sá
Make sure we get and enable the VDD supply (if available). Reviewed-by: Lee Jones <lee@kernel.org> Signed-off-by: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20250701-dev-adp5589-fw-v7-18-b1fcfe9e9826@analog.com Signed-off-by: Lee Jones <lee@kernel.org>
2025-07-01mfd: adp5585: Add support for input devicesNuno Sá
The ADP558x family supports a built in keypad matrix decoder which can be added as an Input device. In order to both support the Input and the GPIO device, we need to create a bitmap of the supported pins and track their usage since they can either be used as GPIOs (GPIs) or as part of the keymap. We also need to mark special pins busy in case some features are being used (ex: pwm or reset events). Signed-off-by: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20250701-dev-adp5589-fw-v7-14-b1fcfe9e9826@analog.com Signed-off-by: Lee Jones <lee@kernel.org>
2025-07-01mfd: adp5585: Support reset and unlock eventsNuno Sá
The ADP558x family of devices can be programmed to respond to some especial events, In case of the unlock events, one can lock the keypad and use KEYS or GPIs events to unlock it. For the reset events, one can again use a combinations of GPIs/KEYs in order to generate an event that will trigger the device to generate an output reset pulse. Signed-off-by: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20250701-dev-adp5589-fw-v7-13-b1fcfe9e9826@analog.com Signed-off-by: Lee Jones <lee@kernel.org>
2025-07-01mfd: adp5585: Add support for event handlingNuno Sá
These devices are capable of generate FIFO based events based on KEY or GPI presses. Add support for handling these events. This is in preparation of adding full support for keymap and gpis based events. Reviewed-by: Lee Jones <lee@kernel.org> Signed-off-by: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20250701-dev-adp5589-fw-v7-12-b1fcfe9e9826@analog.com Signed-off-by: Lee Jones <lee@kernel.org>
2025-07-01mfd: adp5585: Add a per chip reg strutureNuno Sá
There are some differences in the register map between the devices. Hence, add a register structure per device. This will be needed in following patches. On top of that adp5585_fill_regmap_config() is renamed and reworked so that the current struct adp5585_info act as template (they indeed contain all the different data between variants) which can then be complemented depending on the device (as identified by the id register). This is done like this since a lot of the data is pretty much the same between variants of the same device. Reviewed-by: Lee Jones <lee@kernel.org> Signed-off-by: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20250701-dev-adp5589-fw-v7-8-b1fcfe9e9826@analog.com Signed-off-by: Lee Jones <lee@kernel.org>
2025-07-01mfd: adp5585: Add support for adp5589Nuno Sá
The ADP5589 is a 19 I/O port expander with built-in keypad matrix decoder, programmable logic, reset generator, and PWM generator. Signed-off-by: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20250701-dev-adp5589-fw-v7-7-b1fcfe9e9826@analog.com Signed-off-by: Lee Jones <lee@kernel.org>
2025-07-01mfd: adp5585: Refactor how regmap defaults are handledNuno Sá
The only thing changing between variants is the regmap default registers. Hence, instead of having a regmap configuration for every variant (duplicating lots of fields), add a chip info type of structure with a regmap ID to identify which defaults to use and populate regmap_config at runtime given a template plus the id. Also note that between variants, the defaults can be the same which means the chip info structure can be used in more than one compatible. This will also make it simpler adding new chips with more variants. Also note that the chip info structures are deliberately not const as they will also contain lots of members that are the same between the different devices variants and so we will fill those at runtime. Signed-off-by: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20250701-dev-adp5589-fw-v7-6-b1fcfe9e9826@analog.com Signed-off-by: Lee Jones <lee@kernel.org>
2025-07-01mfd: adp5585: Make use of MFD_CELL_NAME()Nuno Sá
Use the helper macro. No functional change intended... Whilst we're at it, now seems like a good time to update the Copyright. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20250701-dev-adp5589-fw-v7-4-b1fcfe9e9826@analog.com Signed-off-by: Lee Jones <lee@kernel.org>
2025-07-01mfd: adp5585: Enable oscillator during probeNuno Sá
Make sure to enable the oscillator in the top device. This will allow to not control this in the child PWM device as that would not work with future support for keyboard matrix where the oscillator needs to be always enabled (and so cannot be disabled by disabling PWM). Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Nuno Sá <nuno.sa@analog.com> Acked-by: Uwe Kleine-König <ukleinek@kernel.org> Link: https://lore.kernel.org/r/20250701-dev-adp5589-fw-v7-3-b1fcfe9e9826@analog.com Signed-off-by: Lee Jones <lee@kernel.org>
2025-07-01mfd: adp5585: Only add devices given in FWNuno Sá
Not all devices (features) of the adp5585 device are mandatory to be used in all platforms. Hence, check what's given in FW and dynamically create the mfd_cell array to be given to devm_mfd_add_devices(). Signed-off-by: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20250701-dev-adp5589-fw-v7-2-b1fcfe9e9826@analog.com Signed-off-by: Lee Jones <lee@kernel.org>
2024-08-01mfd: adp5585: Add Analog Devices ADP5585 core supportHaibo Chen
The ADP5585 is a 10/11 input/output port expander with a built in keypad matrix decoder, programmable logic, reset generator, and PWM generator. This driver supports the chip by modelling it as an MFD device, with two child devices for the GPIO and PWM functions. The driver is derived from an initial implementation from NXP, available in commit 8059835bee19 ("MLK-25917-1 mfd: adp5585: add ADI adp5585 core support") in their BSP kernel tree. It has been extensively rewritten. Signed-off-by: Haibo Chen <haibo.chen@nxp.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Frank Li <Frank.Li@nxp.com> Link: https://lore.kernel.org/r/20240722121100.2855-3-laurent.pinchart@ideasonboard.com Signed-off-by: Lee Jones <lee@kernel.org>