Commit graph

5368 commits

Author SHA1 Message Date
Linus Torvalds
27bc0782ef - Core Frameworks
- Allow all MFD Cell properties to be filled in dynamically at runtime
    - Skip disabled device nodes and continue to look for subsequent devices
 
  - New Device Support
    - Add support for Lunar Lake-M PCI to Intel LPSS PCI
    - Add support for Denverton to Intel ICH LPC
 
  - New Functionality
    - Add support for Clocks to Texas Instruments TWL* Core
    - Add support for Interrupts to STMicroelectronics STM32 Timers
 
  - Fix-ups
    - Convert to new devm-* (managed) power-off API
    - Remove superfluous code
    - Bunch of Device Tree additions, conversions and adaptions
    - Simplify obtaining resources (memory, device data) using unified API helpers
    - Trivial coding-style / spelling type clean-ups
    - Constify / staticify changes
    - Expand or edit on existing documentation
    - Convert some Regmap configurations to use the Maple Tree cache
    - Apply new __counted_by() annotation to several data structures containing flexible arrays
    - Replace strncpy() with strscpy()
 
  - Bug Fixes
    - Remove double put creating reference imbalances
    - Ensure headphone/lineout detection sets set when booting with ACPI
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEdrbJNaO+IJqU8IdIUa+KL4f8d2EFAmVDsQcACgkQUa+KL4f8
 d2FvXRAAjCwKTtj1cUOw7aiCknPuwHj5NoOvannEZN47/kzzbi35YX2oTOE3mSqc
 11U6OLLZ8kpLAvKEy6l82puvDmXRDkQ7eXTFicDgLM2c+FNt3RnfffH+Njr6L8fx
 a5ncAMTesnCXJAfS/8PfsONvRylGl/zQ/zmeSWvukfVa4BVAWIYcJiRnjjOL/jGf
 /POTf8ihUjScCeNlRbsx28jOHDZo6RWCMauKywShuSweX/wMuRD8FwBXp8YmcsLH
 LsYng06Xm+pNtMXv7VB4MQRztRAW7oHduvh/OQ0HkjzlxN8M+wpeZveyq3/i6ut2
 q54TlnlLsmmOh42tmgC7sSwmVmegLTnsoEpNJeYl0AJzNvuJ7W+VdDRuUe6mYwDV
 5MBThe0MGtLtthglNRR1s7pII18ffz4hDQQFExQ5Ai6ZvYu4b57TB+mKas4cTt9T
 7WnoLuPiQW0SPNPWQAYtUDAF16pQmIRME2KYaNIUxGqfDK6GX4EaEQ7//0PHOchE
 kdip5vDFhiTunHLOjf1Se7ZJO0KFEg/hECTq1tcYUDHSopO5hTwhy6Wcd56xyrKP
 dkFn+6dl0bGqBCgxDjlJ7tPJ1m2PEDv1MbV1yO3vIU89PPTPotfUPBud1I/H2IN5
 wDWTULgWxyCJqlWXZ3HjwCsRXF6H4F4A57ffJukmvivqDcXam9Y=
 =rwPH
 -----END PGP SIGNATURE-----

Merge tag 'mfd-next-6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd

Pull MFD updates from Lee Jones:
 "Core Frameworks:
   - Allow all MFD Cell properties to be filled in dynamically at
     runtime
   - Skip disabled device nodes and continue to look for subsequent
     devices

  New Device Support:
   - Add support for Lunar Lake-M PCI to Intel LPSS PCI
   - Add support for Denverton to Intel ICH LPC

  New Functionality:
   - Add support for Clocks to Texas Instruments TWL* Core
   - Add support for Interrupts to STMicroelectronics STM32 Timers

  Fix-ups:
   - Convert to new devm-* (managed) power-off API
   - Remove superfluous code
   - Bunch of Device Tree additions, conversions and adaptions
   - Simplify obtaining resources (memory, device data) using unified
     API helpers
   - Trivial coding-style / spelling type clean-ups
   - Constify / staticify changes
   - Expand or edit on existing documentation
   - Convert some Regmap configurations to use the Maple Tree cache
   - Apply new __counted_by() annotation to several data structures
     containing flexible arrays
   - Replace strncpy() with strscpy()

  Bug Fixes:
   - Remove double put creating reference imbalances
   - Ensure headphone/lineout detection gets set when booting with ACPI"

* tag 'mfd-next-6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (73 commits)
  mfd: lpc_ich: Mark *_gpio_offsets data with const
  spmi: rename spmi device lookup helper
  spmi: document spmi_device_from_of() refcounting
  dt-bindings: mfd: armltd: Move Arm board syscon's to separate schema
  mfd: rk8xx: Add support for RK806 power off
  mfd: rk8xx: Add support for standard system-power-controller property
  dt-bindings: mfd: rk806: Allow system-power-controller property
  dt-bindings: mfd: rk8xx: Deprecate rockchip,system-power-controller
  dt-bindings: mfd: max8925: Convert to DT schema format
  mfd: Use i2c_get_match_data() in a selection of drivers
  mfd: Use device_get_match_data() in a bunch of drivers
  mfd: mc13xxx-spi/wm831x-spi: Use spi_get_device_match_data()
  mfd: motorola-cpcap: Drop unnecessary of_match_device() call
  mfd: arizona-spi: Set pdata.hpdet_channel for ACPI enumerated devs
  mfd: qcom-spmi-pmic: Switch to EXPORT_SYMBOL_GPL()
  mfd: qcom-spmi-pmic: Fix revid implementation
  mfd: qcom-spmi-pmic: Fix reference leaks in revid helper
  mfd: intel-m10-bmc: Change contact for ABI docs
  mfd: max8907: Convert to use maple tree register cache
  mfd: max77686: Convert to use maple tree register cache
  ...
2023-11-02 14:40:51 -10:00
Andy Shevchenko
2b48182244 mfd: lpc_ich: Mark *_gpio_offsets data with const
There is no reason why the GPIO resource offsets should not be const.
Mark them accordingly and update a qualifier in struct lpc_ich_gpio_info
definition.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20231024160650.3898959-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:18 +00:00
Johan Hovold
272f99edab spmi: rename spmi device lookup helper
Rename the SPMI device helper which is used to lookup a device from its
OF node as spmi_find_device_by_of_node() so that it reflects the
implementation and matches how other helpers like this are named.

This will specifically make it more clear that this is a lookup function
which returns a reference counted structure.

Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Acked-by: Stephen Boyd <sboyd@kernel.org>
Link: https://lore.kernel.org/r/20231003152927.15000-6-johan+linaro@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:18 +00:00
Ondrej Jirman
b0227e7081 mfd: rk8xx: Add support for RK806 power off
Use DEV_OFF bit to power off the RK806 PMIC, when system-power-controller
is used in DTS.

Signed-off-by: Ondrej Jirman <megi@xff.cz>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Link: https://lore.kernel.org/r/20231019165732.3818789-5-megi@xff.cz
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:17 +00:00
Ondrej Jirman
2a46cd97f4 mfd: rk8xx: Add support for standard system-power-controller property
DT property rockchip,system-power-controller is now deprecated.

Signed-off-by: Ondrej Jirman <megi@xff.cz>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Link: https://lore.kernel.org/r/20231019165732.3818789-4-megi@xff.cz
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:17 +00:00
Rob Herring
0db434f513 mfd: Use i2c_get_match_data() in a selection of drivers
Use preferred i2c_get_match_data() instead of of_match_device() and
i2c driver_data to get the driver match data. With this, adjust the
includes to explicitly include the correct headers.

Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Link: https://lore.kernel.org/r/20231017203603.2700864-1-robh@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:17 +00:00
Rob Herring
830fafce06 mfd: Use device_get_match_data() in a bunch of drivers
Use preferred device_get_match_data() instead of of_match_device() to
get the driver match data. With this, adjust the includes to explicitly
include the correct headers.

Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20231017203612.2701060-1-robh@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:17 +00:00
Rob Herring
15d71e678e mfd: mc13xxx-spi/wm831x-spi: Use spi_get_device_match_data()
Use preferred spi_get_device_match_data() instead of of_match_device() and
spi_get_device_id() to get the driver match data. With this, adjust the
includes to explicitly include the correct headers.

Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20231017203550.2700601-1-robh@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>

tils.feedkeys.call.run(35)
all.run(37)
all.run(39)
2023-11-01 10:02:16 +00:00
Rob Herring
9f58744c5e mfd: motorola-cpcap: Drop unnecessary of_match_device() call
If probe is reached, we've already matched the device and in the case of
DT matching, the struct device_node pointer will be set. Therefore, there
is no need to call of_match_device() in probe.

Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20231017203537.2700340-1-robh@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:16 +00:00
Hans de Goede
831d1af851 mfd: arizona-spi: Set pdata.hpdet_channel for ACPI enumerated devs
Commit 9e86b2ad4c changed the channel used for HPDET detection
(headphones vs lineout detection) from being hardcoded to
ARIZONA_ACCDET_MODE_HPL (HP left channel) to it being configurable
through arizona_pdata.hpdet_channel the DT/OF parsing added for
filling arizona_pdata on devicetree platforms ensures that
arizona_pdata.hpdet_channel gets set to ARIZONA_ACCDET_MODE_HPL
when not specified in the devicetree-node.

But on ACPI platforms where arizona_pdata is filled by
arizona_spi_acpi_probe() arizona_pdata.hpdet_channel was not
getting set, causing it to default to 0 aka ARIZONA_ACCDET_MODE_MIC.

This causes headphones to get misdetected as line-out on some models.
Fix this by setting hpdet_channel = ARIZONA_ACCDET_MODE_HPL.

Fixes: e933836744 ("mfd: arizona: Add support for ACPI enumeration of WM5102 connected over SPI")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20231014205414.59415-1-hdegoede@redhat.com
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:16 +00:00
Johan Hovold
10450565b4 mfd: qcom-spmi-pmic: Switch to EXPORT_SYMBOL_GPL()
Switch to using EXPORT_SYMBOL_GPL() for the revid helper as there is no
reason not to use it.

Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Acked-by: Caleb Connolly <caleb.connolly@linaro.org>
Link: https://lore.kernel.org/r/20231003152927.15000-4-johan+linaro@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:16 +00:00
Johan Hovold
7b439aaa62 mfd: qcom-spmi-pmic: Fix revid implementation
The Qualcomm SPMI PMIC revid implementation is broken in multiple ways.

First, it assumes that just because the sibling base device has been
registered that means that it is also bound to a driver, which may not
be the case (e.g. due to probe deferral or asynchronous probe). This
could trigger a NULL-pointer dereference when attempting to access the
driver data of the unbound device.

Second, it accesses driver data of a sibling device directly and without
any locking, which means that the driver data may be freed while it is
being accessed (e.g. on driver unbind).

Third, it leaks a struct device reference to the sibling device which is
looked up using the spmi_device_from_of() every time a function (child)
device is calling the revid function (e.g. on probe).

Fix this mess by reimplementing the revid lookup so that it is done only
at probe of the PMIC device; the base device fetches the revid info from
the hardware, while any secondary SPMI device fetches the information
from the base device and caches it so that it can be accessed safely
from its children. If the base device has not been probed yet then probe
of a secondary device is deferred.

Fixes: e9c11c6e3a ("mfd: qcom-spmi-pmic: expose the PMIC revid information to clients")
Cc: stable@vger.kernel.org      # 6.0
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Acked-by: Caleb Connolly <caleb.connolly@linaro.org>
Link: https://lore.kernel.org/r/20231003152927.15000-3-johan+linaro@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:16 +00:00
Johan Hovold
a0fa44c261 mfd: qcom-spmi-pmic: Fix reference leaks in revid helper
The Qualcomm SPMI PMIC revid implementation is broken in multiple ways.

First, it totally ignores struct device_node reference counting and
leaks references to the parent bus node as well as each child it
iterates over using an open-coded for_each_child_of_node().

Second, it leaks references to each spmi device on the bus that it
iterates over by failing to drop the reference taken by the
spmi_device_from_of() helper.

Fix the struct device_node leaks by reimplementing the lookup using
for_each_child_of_node() and adding the missing reference count
decrements. Fix the sibling struct device leaks by dropping the
unnecessary lookups of devices with the wrong USID.

Note that this still leaves one struct device reference leak in case a
base device is found but it is not the parent of the device used for the
lookup. This will be addressed in a follow-on patch.

Fixes: e9c11c6e3a ("mfd: qcom-spmi-pmic: expose the PMIC revid information to clients")
Cc: stable@vger.kernel.org	# 6.0
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Acked-by: Caleb Connolly <caleb.connolly@linaro.org>
Link: https://lore.kernel.org/r/20231003152927.15000-2-johan+linaro@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:16 +00:00
Mark Brown
4fddf148f7 mfd: max8907: Convert to use maple tree register cache
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: Mark Brown <broonie@kernel.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20231001-mfd-maxim-maple-v1-3-cdfeb48a4d15@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:15 +00:00
Mark Brown
728f337477 mfd: max77686: Convert to use maple tree register cache
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: Mark Brown <broonie@kernel.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Link: https://lore.kernel.org/r/20231001-mfd-maxim-maple-v1-2-cdfeb48a4d15@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:15 +00:00
Mark Brown
fc12429b40 mfd: max77620: Convert to use maple tree register cache
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: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20231001-mfd-maxim-maple-v1-1-cdfeb48a4d15@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:15 +00:00
Jarkko Nikula
e53b22b10c mfd: intel-lpss: Add Intel Lunar Lake-M PCI IDs
Add Intel Lunar Lake-M SoC PCI IDs.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Link: https://lore.kernel.org/r/20231002083344.75611-1-jarkko.nikula@linux.intel.com
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:15 +00:00
Mark Brown
7f70d4590d mfd: rk8xx: Convert to use maple tree register cache
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: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20231001-mfd-rk88x-maple-v1-1-90434cfb2f90@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:15 +00:00
Mark Brown
1c943dfd80 mfd: twl: Convert to use maple tree register cache
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: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20231001-mfd-ti-maple-v1-7-0657862de3f6@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:15 +00:00
Mark Brown
214fbbd05b mfd: tps65912: Convert to use maple tree register cache
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: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20231001-mfd-ti-maple-v1-6-0657862de3f6@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:15 +00:00
Mark Brown
535cd579bc mfd: tps65910: Convert to use maple tree register cache
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: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20231001-mfd-ti-maple-v1-5-0657862de3f6@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:14 +00:00
Mark Brown
e142b022b3 mfd: tps6586x: Convert to use maple tree register cache
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: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20231001-mfd-ti-maple-v1-4-0657862de3f6@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:14 +00:00
Mark Brown
2e9a3fc2f9 mfd: tps65128: Convert to use maple tree register cache
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: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20231001-mfd-ti-maple-v1-3-0657862de3f6@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:14 +00:00
Mark Brown
778eea25bf mfd: tps65090: Convert to use maple tree register cache
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: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20231001-mfd-ti-maple-v1-2-0657862de3f6@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:14 +00:00
Mark Brown
6917c33322 mfd: tps65086: Convert to use maple tree register cache
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: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20231001-mfd-ti-maple-v1-1-0657862de3f6@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:14 +00:00
Justin Stitt
6bce629689 mfd: db8500-prcmu: Replace deprecated strncpy with strscpy
`strncpy` is deprecated for use on NUL-terminated destination strings
[1] and as such we should prefer more robust and less ambiguous string
interfaces.

We expect project_name to be NUL-terminated based on its use with
pr_info:
| 	pr_info("PRCMU firmware: %s(%d), version %d.%d.%d\n",
| 		fw_info.version.project_name,
| 		fw_info.version.project,
| 		fw_info.version.api_version,
| 		fw_info.version.func_version,
| 		fw_info.version.errata);

Moreover, NUL-padding does not seem to be needed.

Considering the above, a suitable replacement is `strscpy` [2] due to
the fact that it guarantees NUL-termination on the destination buffer
without unnecessarily NUL-padding.

Let's also change `PRCMU_FW_PROJECT_NAME_LEN` to just
sizeof(fw_info.version.project_name) as this is more idiomatic strscpy
usage.

Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1]
Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2]
Link: https://github.com/KSPP/linux/issues/90
Cc: linux-hardening@vger.kernel.org
Signed-off-by: Justin Stitt <justinstitt@google.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20230927-strncpy-drivers-mfd-db8500-prcmu-c-v1-1-db9693f92a68@google.com
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:14 +00:00
Andy Shevchenko
b4e40505f9 mfd: lpc_ich: Add a platform device for pinctrl Denverton
This is to cater the need in non-ACPI system whereby a platform device
has to be created in order to bind with the Denverton pinctrl driver.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230926190834.932233-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:13 +00:00
Andy Shevchenko
1f84f88dc1 mfd: lpc_ich: Move APL GPIO resources to a custom structure
We are expecting more platforms that want to instantiate
the GPIO device via P2SB. For them prepare the custom structure
and move Apollo Lake data there. Refactor the code accordingly.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230926190834.932233-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:13 +00:00
Andy Shevchenko
b0eb61880f mfd: lpc_ich: Make struct lpc_ich_priv use enum for chipset member
We have a specific enum for the supported chipsets.
Make struct lpc_ich_priv use better type for the chipset member.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230926190834.932233-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:13 +00:00
Dinghao Liu
759c409bc5 mfd: dln2: Fix double put in dln2_probe
The dln2_free() already contains usb_put_dev(). Therefore,
the redundant usb_put_dev() before dln2_free() may lead to
a double free.

Fixes: 96da8f1483 ("mfd: dln2: Fix memory leak in dln2_probe()")
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Link: https://lore.kernel.org/r/20230925024134.9683-1-dinghao.liu@zju.edu.cn
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:13 +00:00
Biju Das
c4974eea6c mfd: max8998: Simplify obtaining I2C match data and drop max8998_i2c_get_driver_data()
Simplify probe() by using i2c_get_match_data() instead of
max8998_i2c_get_driver_data() for retrieving match data from
OF/ID tables.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230923174928.56824-5-biju.das.jz@bp.renesas.com
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:13 +00:00
Biju Das
bffa42885f mfd: max77541: Simplify obtaining I2C match data
Simplify probe() by replacing device_get_match_data() and ID lookup for
retrieving match data by i2c_get_match_data().

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20230923174928.56824-4-biju.das.jz@bp.renesas.com
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:12 +00:00
Biju Das
f1f23a1a79 mfd: madera-i2c: Simplify obtaining I2C match data
Simplify probe() by replacing of_device_get_match_data() and ID lookup for
retrieving match data by i2c_get_match_data().

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230923174928.56824-3-biju.das.jz@bp.renesas.com
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:12 +00:00
Biju Das
7ec9f1f31d mfd: arizona-i2c: Simplify obtaining I2C match data
Simplify probe() by replacing device_get_match_data() and ID lookup for
retrieving match data by i2c_get_match_data(). After this drop
intializing the variable type.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Tested-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230923174928.56824-2-biju.das.jz@bp.renesas.com
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:12 +00:00
Kees Cook
69c3f91545 mfd: iqs62x: Annotate struct iqs62x_fw_blk with __counted_by
Prepare for the coming implementation by GCC and Clang of the __counted_by
attribute. Flexible array members annotated with __counted_by can have
their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS
(for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family
functions).

As found with Coccinelle[1], add __counted_by for struct iqs62x_fw_blk.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/20230922175337.work.150-kees@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:12 +00:00
Fabrice Gasnier
1c7ea43fc4 mfd: stm32-timers: Add support for interrupts
There are two types of STM32 timers that may have:

- a global interrupt line
- 4 dedicated interrupt lines.

Those interrupts are optional as defined in the dt-bindings. Enforce checks
on either one, four or no interrupts are provided with their names.
Optionally get them here, to be used by child devices.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Link: https://lore.kernel.org/r/20230829134029.2402868-5-fabrice.gasnier@foss.st.com
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:12 +00:00
Andreas Kemnade
6341632041 mfd: twl-core: Add a clock subdevice for the TWL6032
Clock device needs no separate devicetree node, so add it as
a platform device. Other devices in the family also have controllable
clocks, but due to the lack of testing, just add it for the TWL6032
now.

Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
Link: https://lore.kernel.org/r/20230916100515.1650336-4-andreas@kemnade.info
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:12 +00:00
Manikandan Muralidharan
ad3a3c6e4a mfd: atmel-hlcdc: Add compatible for sam9x75 XLCD controller
Add compatible for sam9x75 XLCD controller.

Signed-off-by: Manikandan Muralidharan <manikandan.m@microchip.com>
Link: https://lore.kernel.org/r/20230915104849.187146-2-manikandan.m@microchip.com
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:11 +00:00
Mark Brown
a50afa310d mfd: wcd934x: Update to use maple tree register cache
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. In
v6.5 it has also acquired the ability to generate multi-register writes in
sync operations, bringing performance up to parity with the rbtree cache
there.

Update the wcd934x to use the more modern data structure.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230912-mfd-wcd934x-maple-v2-1-292a154113e3@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:11 +00:00
Andre Przywara
b2cb2ae222 mfd: axp20x: Generalise handling without interrupt
At the moment we allow the AXP15060 and the AXP806 PMICs to omit the
interrupt line to the SoC, and we skip registering the PEK (power key)
driver in this case, since that crashes when no IRQ is described in the
DT node.
The IRQ pin potentially not being connected to anything does affect more
PMICs, though, and the PEK driver is not the only one requiring an
interrupt: at least the AC power supply driver crashes in a similar
fashion.

Generalise the handling of AXP MFD devices when the platform tables
describe no interrupt, by allowing each device to specify an alternative
MFD list for this case. If no specific alternative is specified, we go
with the safe default of "just the regulators", which matches the current
situation.

This enables new devices using the AXP313a PMIC, but not connecting the
IRQ pin.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Link: https://lore.kernel.org/r/20230828213229.20332-1-andre.przywara@arm.com
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:10 +00:00
Biju Das
9a41c31e40 mfd: palmas: Make similar OF and ID table
Make similar OF and ID table to extend support for ID match using
i2c_match_data(). Currently it works only for OF match tables as the
driver_data is wrong for ID match.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20230831183153.63750-5-biju.das.jz@bp.renesas.com
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:10 +00:00
Biju Das
a17e0bc66f mfd: palmas: Move OF table closer to its consumer
Move OF table near to the user.

While at it, arrange compatible and data in single line.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20230831183153.63750-4-biju.das.jz@bp.renesas.com
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:10 +00:00
Biju Das
93ec3d0e02 mfd: palmas: Constify .data in OF table and {palmas,tps65917}_irq_chip
Constify .data in OF table and {palmas,tps65917}_irq_chip and replace
the variable *features->features in struct palmas_driver_data and
drop the {palmas,tps659038}_features variables and use their values
directly in the named initialization.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20230831183153.63750-3-biju.das.jz@bp.renesas.com
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:10 +00:00
Biju Das
3f9a06dc79 mfd: palmas: Remove trailing comma in the terminator entry
Remove trailing comma in the terminator entry for OF table.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20230831183153.63750-2-biju.das.jz@bp.renesas.com
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:10 +00:00
Herve Codina
7ba7bdef4d mfd: core: Ensure disabled devices are skipped without aborting
The loop searching for a matching device based on its compatible
string is aborted when a matching disabled device is found.
This abort prevents to add devices as soon as one disabled device
is found.

Continue searching for an other device instead of aborting on the
first disabled one fixes the issue.

Fixes: 22380b65dc ("mfd: mfd-core: Ensure disabled devices are ignored without error")
Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Link: https://lore.kernel.org/r/528425d6472176bb1d02d79596b51f8c28a551cc.1692376361.git.christophe.leroy@csgroup.eu
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:10 +00:00
Biju Das
676c267223 mfd: max8997: Simplify obtaining I2C match data and drop max8997_i2c_get_driver_data()
Simplify probe() by using i2c_get_match_data() instead of
max8997_i2c_get_driver_data() for retrieving match data from
OF/ID tables.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230828160224.92037-1-biju.das.jz@bp.renesas.com
Signed-off-by: Lee Jones <lee@kernel.org>
2023-11-01 10:02:09 +00:00
Lee Jones
55bb1a507f Immutable branch between MFD, I2C and Reboot due for the v6.7 merge window
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEdrbJNaO+IJqU8IdIUa+KL4f8d2EFAmUJs9wACgkQUa+KL4f8
 d2H3dxAAnWy5w8P8abSO2j8HAh9sRBvNqYYRB8/YvLVbplYROrzoS4OS+14OfDLB
 UC1X3vafG0AcQFzXr+HyYFEGUYGAqSrDSA1JkzSd9l1HKNyDSfiCnvaofV0SaDIE
 4v4rBXhC7Se5nuw3+wTfPJ/q59FluNEmnA1rBS8xCI7QXTVluilofmLZnPzb3/Ie
 +5WqWiMt2MSzfxzdGF4VgCgwjmH/Cr/CPJWQlXaKzw4gS0V5GGSw0kN/8BOJrXCP
 bm2XYt5j1S/kIdl4dTQPIEmaUjbNX4eToKz/Okp7kwgr9wzZJbqxKJrEEujAf/5c
 R+Pz+Zbwa4sggR73rnMxSa9ZRbhC9rV9ImAlFSKXF9Qe5eObP5wp2KgfBntMEObH
 W3B/YQOTGkt4YuzNqjQEo/zfxUPDLsiXyNQARQDF/03VJY3xVTAfj3LYUeoq8Nms
 ELgZjNd6hEMGdSN1hdzPfXR2rBZwTHC+f/187OzxPu26ofwMEPpQDgoekZ2a4U1v
 9B7iIkbg40MuYjOKGKPElQH80N6DSeeEBZuk+xXAfszW1GRRrxvRZX02nT1ytZHO
 GKkAZq7GjgfoMjWVCremqwXQ3wDeXDa8uN6M1AZWa8WUTVdUZcwBeOFgBGEd85bN
 i1cES5dcoNn3XbrO8qZneu6K0WLmOLw2cnU5LmRJqvXev/SKNMM=
 =XwZD
 -----END PGP SIGNATURE-----

Merge tag 'ib-mfd-i2c-reboot-v6.7' into ibs-for-mfd-merged

Immutable branch between MFD, I2C and Reboot due for the v6.7 merge window
2023-11-01 10:00:28 +00:00
Linus Torvalds
bc622f16c1 Couple of small fixes, including:
- Potential build failure in CS42L43
   - Device Tree bindings clean-up for a superseded patch
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEdrbJNaO+IJqU8IdIUa+KL4f8d2EFAmUe1V0ACgkQUa+KL4f8
 d2FhOA/9G0L0+sCd5kYKInfNcZklY/R9XKNoX5g5DQA8vyVllWIycbPL6VlPli0d
 IRyw7uQLdWba4mlNWXql5pU7wGWgBqr268VwFhCGK6/vbJLpMFYEWGmOq306x6wz
 poSrKmAKJeFswb0GSEyLeDtt/3c0k9bYV+ZUxavNTwoYmLaApP0NKQmNuH0mptA6
 pZ825PCEWbNS++FI5lv+dPfOzWDlh691n8ea41HRD/svGDdNCS+EpTLcX9L+81P+
 EIx+GWtW7CUGNYP2jJhMU7WW4/+3Uxdyrojmx+t9vkiD6t6sZkclDBxMzf7x+vLt
 NtcWpUdeHR0phAFTUxR74w7vIgfiHb2HWNdpmzNB7ZWuGsClQDIVU8KL2JtvDZ6X
 hcByEKnz7QwOXaZo5qwfWmmc5rVQkZG5CKrVN23/DVHlseyFShmllI4yw7fjfAGn
 JWAF5IwrfZFgVPAeTmmZwmuNFx4pZiPj4ajBLmEvF5OxuHsaNjE1W7WOZnITwRdn
 22EL9Q/DRsdzDci4eW7AHDwqwMJhUW7HIVMWEOMknuS/aEdrtJhNB2X8TDC9/zBi
 p50K+mxGs/RB/uvHDDCce/fVgDpTDhuovAJRncigGZmDvWgXHMR7+UIgNW9opHwl
 i8833UANGOEfBi68quVcAr7EI3CnTsMtr0b/JTibmTcrV0vZb10=
 =g4wJ
 -----END PGP SIGNATURE-----

Merge tag 'mfd-fixes-6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd

Pull MFD fixes from Lee Jones:
 "A couple of small fixes:

   - Potential build failure in CS42L43

   - Device Tree bindings clean-up for a superseded patch"

* tag 'mfd-fixes-6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd:
  dt-bindings: mfd: Revert "dt-bindings: mfd: maxim,max77693: Add USB connector"
  mfd: cs42l43: Fix MFD_CS42L43 dependency on REGMAP_IRQ
2023-10-05 11:03:20 -07:00
Charles Keepax
eb72d52070 mfd: cs42l43: Use correct macro for new-style PM runtime ops
The code was accidentally mixing new and old style macros, update the
macros used to remove an unused function warning whilst building with
no PM enabled in the config.

Fixes: ace6d14481 ("mfd: cs42l43: Add support for cs42l43 core driver")
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/all/20230822114914.340359-1-ckeepax@opensource.cirrus.com/
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Lee Jones <lee@kernel.org>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2023-09-23 11:10:23 -07:00
Woody Zhang
9ef4dc24eb mfd: cs42l43: Fix MFD_CS42L43 dependency on REGMAP_IRQ
MFD_CS42L43 depends on REGMAP_IRQ as it uses devm_regmap_add_irq_chip.
Otherwise the build may fail with following log.

  AR      drivers/built-in.a
  AR      built-in.a
  AR      vmlinux.a
  LD      vmlinux.o
  OBJCOPY modules.builtin.modinfo
  GEN     modules.builtin
  MODPOST Module.symvers
ERROR: modpost: "devm_regmap_add_irq_chip" [drivers/mfd/cs42l43.ko] undefined!

Fixes: ace6d14481 ("mfd: cs42l43: Add support for cs42l43 core driver")
Signed-off-by: Woody Zhang <woodylab@foxmail.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/tencent_E54C7156F583E15FFE320E576E3389C39A08@qq.com
Signed-off-by: Lee Jones <lee@kernel.org>
2023-09-19 15:05:20 +01:00