summaryrefslogtreecommitdiff
path: root/drivers/mfd/da9062-core.c
AgeCommit message (Collapse)AuthorFilesLines
2024-02-23mfd: dialog: Convert to use maple tree register cacheBo Liu1-2/+2
The maple tree register cache is based on a much more modern data structure than the rbtree cache and makes optimisation choices which are probably more appropriate for modern systems than those made by the rbtree cache. Signed-off-by: Bo Liu <liubo03@inspur.com> Link: https://lore.kernel.org/r/20240206071314.8721-8-liubo03@inspur.com Signed-off-by: Lee Jones <lee@kernel.org>
2023-12-07mfd: da9062: Simplify obtaining I2C match dataBiju Das1-13/+9
Simplify probe() by replacing of_device_get_match_data() and ID lookup for retrieving match data by i2c_get_match_data(). Some minor cleanups: * Remove the trailing comma in the terminator entry for the ID table making code robust against (theoretical) misrebases or other similar things where the new entry goes _after_ the termination without the compiler noticing. * Move OF table near to the user. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/r/20231204124507.124758-1-biju.das.jz@bp.renesas.com Signed-off-by: Lee Jones <lee@kernel.org>
2023-08-18mfd: Explicitly include correct DT includesRob Herring1-1/+1
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önig1-1/+1
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>
2023-04-26mfd: da9062: Remove IRQ requirementChristoph Niedermaier1-29/+55
This patch removes the requirement for an IRQ, because for the core functionality IRQ isn't needed. So this makes the DA9061/62 chip usable for designs which haven't connected the IRQ pin. Signed-off-by: Christoph Niedermaier <cniedermaier@dh-electronics.com> Acked-by: Adam Ward <DLG-Adam.Ward.opensource@dm.renesas.com> Signed-off-by: Lee Jones <lee@kernel.org> Link: https://lore.kernel.org/r/20230309092254.56279-2-cniedermaier@dh-electronics.com
2023-04-26mfd: da9062: Use MFD_CELL_OF macroChristoph Niedermaier1-68/+24
Use MFD_CELL_OF macro helper instead of plain struct properties, which makes the code a bit shorter and to have commonly defined MFD cell attributes. Signed-off-by: Christoph Niedermaier <cniedermaier@dh-electronics.com> Acked-by: Adam Ward <DLG-Adam.Ward.opensource@dm.renesas.com> Signed-off-by: Lee Jones <lee@kernel.org> Link: https://lore.kernel.org/r/20230309092254.56279-1-cniedermaier@dh-electronics.com
2022-12-07mfd: da9062-core: Convert to i2c's .probe_new()Uwe Kleine-König1-3/+3
.probe_new() doesn't get the i2c_device_id * parameter, so determine that explicitly in the probe function. 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-429-uwe@kleine-koenig.org
2022-10-07Merge tag 'mfd-next-6.1' of ↵Linus Torvalds1-0/+1
git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd Pull MFD updates from Lee Jones: "Core Frameworks: - Fix 'mfd_of_node_list' OF node entry resource leak New Drivers: - Add support for Ocelot VSC7512 Networking Chip - Add support for MediaTek MT6370 subPMIC - Add support for Richtek RT5120 (I2C) PMIC New Device Support: - Add support for Rockchip RV1126 and RK3588 to Syscon - Add support for Rockchip RK817 Battery Charger to RK808 - Add support for Silergy SY7636a Voltage Regulator to Simple MFD - Add support for Qualcomm PMP8074 PMIC to QCOM SPMI - Add support for Secure Update to Intel M10 BMC New Functionality: - Provide SSP type to Intel's LPSS (PCI) SPI driver Fix-ups: - Remove legacy / unused code; stmpe, intel_soc_pmic_crc, syscon - Unify / simplify; intel_soc_pmic_crc - Trivial reordering / spelling, etc; Makefile, twl-core - Convert to managed resources; intel_soc_pmic_crc - Use appropriate APIs; intel_soc_pmic_crc - strscpy() conversion; htc-i2cpld, lpc_ich, mfd-core - GPIOD conversion; htc-i2cpld, stmpe - Add missing header file includes; twl4030-irq - DT goodies; stmpe, mediatek,mt6370, x-powers,axp152, aspeed,ast2x00-scu, mediatek,mt8195-scpsys, qcom,spmi-pmic, syscon, qcom,tcsr, rockchip,rk817, sprd,ums512-glbreg, dlg,da9063 Bug Fixes: - Properly check return values; sm501, htc-i2cpld - Repair Two-Wire Bus Mode; da9062-core - Fix error handling; intel_soc_pmic_core, fsl-imx25-tsadc, lp8788, lp8788-irq" * tag 'mfd-next-6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (60 commits) mfd: syscon: Remove repetition of the regmap_get_val_endian() mfd: ocelot-spi: Add missing MODULE_DEVICE_TABLE power: supply: Add charger driver for Rockchip RK817 dt-bindings: mfd: mt6370: Fix the indentation in the example mfd: da9061: Fix Failed to set Two-Wire Bus Mode. mfd: htc-i2cpld: Fix an IS_ERR() vs NULL bug in htcpld_core_probe() dt-bindings: mfd: qcom,tcsr: Drop simple-mfd from IPQ6018 mfd: sm501: Add check for platform_driver_register() dt-bindings: mfd: mediatek: Add scpsys compatible for mt8186 mfd: twl4030: Add missed linux/device.h header dt-bindings: mfd: dlg,da9063: Add missing regulator patterns dt-bindings: mfd: sprd: Add bindings for ums512 global registers mfd: intel_soc_pmic_chtdc_ti: Switch from __maybe_unused to pm_sleep_ptr() etc dt-bindings: mfd: syscon: Add rk3588 QoS register compatible mfd: stmpe: Switch to using gpiod API mfd: qcom-spmi-pmic: Add pm7250b compatible dt-bindings: mfd: Add missing (unevaluated|additional)Properties on child nodes mfd/omap1: htc-i2cpld: Convert to a pure GPIO driver mfd: intel-m10-bmc: Add d5005 bmc secure update driver dt-bindings: mfd: syscon: Drop ref from reg-io-width ...
2022-09-28mfd: da9061: Fix Failed to set Two-Wire Bus Mode.Jens Hillenstedt1-0/+1
In da9062_i2c_probe() regmap_clear_bits() tries to access CONFIG_J register. As CONFIG_J is not present in da9061_aa_writeable_ranges[] probe of da9061 fails: da9062 2-0058: Entering I2C mode! da9062 2-0058: Failed to set Two-Wire Bus Mode. da9062: probe of 2-0058 failed with error -5 Add CONFIG_J register to da9061_aa_writeable_ranges[]. Fixes: 5c6f0f456351 ("mfd: da9062: Support SMBus and I2C mode") Signed-off-by: Jens Hillenstedt <jens.hillenstedt@ise.de> Reviewed-by: Adam Ward <DLG-Adam.Ward.opensource@dm.renesas.com> Signed-off-by: Lee Jones <lee@kernel.org> Link: https://lore.kernel.org/r/20220915092004.168744-1-jens.hillenstedt@ise.de
2022-08-16i2c: Make remove callback return voidUwe Kleine-König1-3/+1
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>
2021-11-29mfd: da9062: Support SMBus and I2C modeAndrej Picej1-0/+12
Enable the I2C bus mode if I2C_FUNC_I2C is set. Based on da6093 commit: "586478bfc9f7 mfd: da9063: Support SMBus and I2C mode" Signed-off-by: Andrej Picej <andrej.picej@norik.com> Reviewed-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211124065119.2514872-1-andrej.picej@norik.com
2021-06-02mfd: da9062: Simplify getting of_device_id match dataKrzysztof Kozlowski1-9/+4
Use of_device_get_match_data() to make the code slightly smaller. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> Acked-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-11-27mfd: da9062: Drop of_match_ptr from of_device_id tableKrzysztof Kozlowski1-1/+1
The driver can match only via the DT table so the table should be always used and the of_match_ptr does not have any sense (this also allows ACPI matching via PRP0001, even though it is not relevant here). This fixes compile warning (!CONFIG_OF on x86_64): drivers/mfd/da9062-core.c:614:34: warning: ‘da9062_dt_ids’ defined but not used [-Wunused-const-variable=] Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-11-19mfd: da9xxx-core: Constify static struct resourceRikard Falkeborn1-12/+12
Constify a number of static struct resource. The only usage of the structs are to assign their address to the resources field in the mfd_cell struct. This allows the compiler to put them in read-only memory. Done with the help of Coccinelle. Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com> Acked-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-03-30mfd: da9062: Add support for interrupt polarity defined in device treeShreyas Joshi1-3/+41
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-01-24mfd: da9062: Fix watchdog compatible stringMarco Felsch1-1/+1
The watchdog driver compatible is "dlg,da9062-watchdog" and not "dlg,da9062-wdt". Therefore the mfd-core can't populate the of_node and fwnode. As result the watchdog driver can't parse the devicetree. Fixes: 9b40b030c4ad ("mfd: da9062: Supply core driver") Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Acked-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-01-24mfd: da9062: add support for the DA9062 GPIOs in the coreMarco Felsch1-1/+15
Currently the da9062 GPIO's aren't available. The patch adds the support to make these available by adding a gpio device with the corresponding irq resources. Furthermore the patch fixes a minor style issue for the onkey device. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Acked-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>
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157Thomas Gleixner1-10/+1
Based on 3 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 this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details 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 [author] [kishon] [vijay] [abraham] [i] [kishon]@[ti] [com] this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details 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 [author] [graeme] [gregory] [gg]@[slimlogic] [co] [uk] [author] [kishon] [vijay] [abraham] [i] [kishon]@[ti] [com] [based] [on] [twl6030]_[usb] [c] [author] [hema] [hk] [hemahk]@[ti] [com] this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 1105 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Richard Fontana <rfontana@redhat.com> Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070033.202006027@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-16mfd: da9062: Use core helper regmap_reg_range macrosSteve Twiss1-348/+114
Replace multi-line entries in the regmap_range arrays with single line macros: regmap_reg_range(). This will leave the static structure array entries for regmap_range unaltered. It will significantly reduce the line count in the DA9062/61 core file. Signed-off-by: Steve Twiss <stwiss.opensource@diasemi.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-08-22Revert "mfd: da9061: Fix to remove BBAT_CONT register from chip model"Lee Jones1-0/+6
This patch was applied to the MFD twice, causing unwanted behavour. This reverts commit b77eb79acca3203883e8d8dbc7f2b842def1bff8. Fixes: b77eb79acca3 ("mfd: da9061: Fix to remove BBAT_CONT register from chip model") Reported-by: Steve Twiss <stwiss.opensource@diasemi.com> Reviewed-by: Steve Twiss <stwiss.opensource@diasemi.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-07-06mfd: da9061: Fix to remove BBAT_CONT register from chip modelSteve Twiss1-6/+0
Remove the register DA9062AA_BBAT_CONT (0x0C5) from the DA9061 chip model regmap access ranges. This applies to both da9061_aa_readable_ranges[] and da9061_aa_writeable_ranges[]. This change is to correct the DA9061 chip model and align it with the latest DA9061 Datasheet. This register previously appeared in the DA9061 Datasheet, Revision 3.2, 01-Mar-2016 and has been removed from later DA9061 datasheet from Dialog, Revision 3.3, 04-Apr-2017. Signed-off-by: Steve Twiss <stwiss.opensource@diasemi.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-07-06mfd: da9061: Fix to remove BBAT_CONT register from chip modelSteve Twiss1-6/+0
Remove the register DA9062AA_BBAT_CONT (0x0C5) from the DA9061 chip model regmap access ranges. This applies to both da9061_aa_readable_ranges[] and da9061_aa_writeable_ranges[]. This change is to correct the DA9061 chip model and align it with the latest DA9061 Datasheet. This register previously appeared in the DA9061 Datasheet, Revision 3.2, 01-Mar-2016 and has been removed from later DA9061 datasheet from Dialog, Revision 3.3, 04-Apr-2017. Signed-off-by: Steve Twiss <stwiss.opensource@diasemi.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-04-27mfd: Add support for DA9061Steve Twiss1-17/+410
MFD support for DA9061 is provided as part of the DA9062 device driver. The registers header file adds two new chip variant IDs defined in DA9061 and DA9062 hardware. The core header file adds new software enumerations for listing the valid DA9061 IRQs and a da9062_compatible_types enumeration for distinguishing between DA9061/62 devices in software. The core source code adds a new .compatible of_device_id entry. This is extended from DA9062 to support both "dlg,da9061" and "dlg,da9062". The .data entry now holds a reference to the enumerated device type. A new regmap_irq_chip model is added for DA9061 and this supports the new list of regmap_irq entries. A new mfd_cell da9061_devs[] array lists the new sub system components for DA9061. Support is added for a new DA9061 regmap_config which lists the correct readable, writable and volatile ranges for this chip. The probe function uses the device tree compatible string to switch on the da9062_compatible_types and configure the correct mfd cells, irq chip and regmap config. Kconfig is updated to reflect support for DA9061 and DA9062 PMICs. Signed-off-by: Steve Twiss <stwiss.opensource@diasemi.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2016-03-16mfd: da9062: Fix missing volatile registers in the core regmap_range ↵Steve Twiss1-1/+22
volatile lists Add an updated set of registers listed in the core regmap_range volatile ranges defined for the DA9062. These new registers contain bits that cannot be considered under the full control of software. Under various conditions the hardware will set and/or automatically clear bit(s) contained in these registers. When using a cached version of regmap, the volatility of these registers must be identified otherwise the regmap operations may not ensure the registers are explicitly altered. As well as updating the list of volatile registers, this change will fix a corner case discovered in the DA9063 ONKEY which is used by the DA9062 core. In the ONKEY case, the CONTROL_B register is now listed as volatile in the regmap_range because it contains the bit field NONKEY_LOCK. This bit can be altered by hardware, in which case regmap must be notified of its ability to be manpiulated outside of software control. Signed-off-by: Steve Twiss <stwiss.opensource@diasemi.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-10-30mfd: da9062-core: Rename get_device_type to da9062_get_device_typeAxel Lin1-2/+2
Rename get_device_type() to da9062_get_device_type(). This function is only used in this file so make it static. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-08-11mfd: da9062: Support for the DA9063 OnKey in the DA9062 coreS Twiss1-0/+10
Add MFD core driver support for a OnKey component - MFD core adds the resource da9062_onkey_resources[] for the OnKey - An appropriate value has been added into mfd_cell da9062_devs[] to support component .name = "da9062-onkey" and .of_compatible = "dlg,da9062-onkey" Signed-off-by: Steve Twiss <stwiss.opensource@diasemi.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-08-11mfd: da9062: Support for the DA9063 RTC in the DA9062 coreS Twiss1-0/+11
Add MFD core driver support for a RTC component - MFD core adds the RTC resources da9062_rtc_resources[] for the RTC alarm and tick timer IRQ - An appropriate mfd_cell has been added into da9062_devs[] to support a component .name = "da9062-rtc" and .of_compatible = "dlg,da9062-rtc" Signed-off-by: Steve Twiss <stwiss.opensource@diasemi.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-08-11mfd: da9062: Supply core driverS Twiss1-0/+512
Add MFD core driver support for DA9062 Signed-off-by: Steve Twiss <stwiss.opensource@diasemi.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>