Commit Graph

4974 Commits

Author SHA1 Message Date
Andy Shevchenko 7c06d47850 mfd: intel_soc_pmic_bxtwc: Drop unneeded casting
The casting from size_t to ssize_t is not needed in addr_store(),
drop it.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220628221747.33956-10-andriy.shevchenko@linux.intel.com
2022-07-19 10:54:42 +01:00
Andy Shevchenko 86da8be35c mfd: intel_soc_pmic_bxtwc: Use sysfs_emit() instead of sprintf()
sysfs_emit() is preferred over sprintf() when formatting the value to be
returned to user space in show() functions, because it knows about sysfs
buffer specifics and has sanity checks.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220628221747.33956-9-andriy.shevchenko@linux.intel.com
2022-07-19 10:54:42 +01:00
Andy Shevchenko f801556a84 mfd: intel_soc_pmic_bxtwc: Use bits.h macros for all masks
Currently we are using BIT(), but GENMASK(). Make use of the latter one
as well (far less error-prone, far more concise).

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220628221747.33956-8-andriy.shevchenko@linux.intel.com
2022-07-19 10:54:42 +01:00
Andy Shevchenko cd58c84034 mfd: intel_soc_pmic_bxtwc: Drop redundant ACPI_PTR()
The driver depends on ACPI (via MFD_INTEL_PMC_BXT), ACPI_PTR() resolution
is always the same. Otherwise a compiler may produce a warning.

That said, the rule of thumb either ugly ifdeffery with ACPI_PTR or
none should be used in a driver.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220628221747.33956-7-andriy.shevchenko@linux.intel.com
2022-07-19 10:54:42 +01:00
Andy Shevchenko 05879b125a mfd: intel_soc_pmic_bxtwc: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
Letting the compiler remove these functions when the kernel is built
without CONFIG_PM_SLEEP support is simpler and less error prone than the
use of #ifdef based kernel configuration guards.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220628221747.33956-6-andriy.shevchenko@linux.intel.com
2022-07-19 10:54:42 +01:00
Andy Shevchenko ba3ea04a25 mfd: intel_soc_pmic_bxtwc: Extend use of temporary variable for struct device
Extend use of temporary variable for struct device to make code neater.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220628221747.33956-5-andriy.shevchenko@linux.intel.com
2022-07-19 10:54:42 +01:00
Andy Shevchenko d30e2c30a4 mfd: intel_soc_pmic_bxtwc: Use dev_err_probe()
Simplify the mux error path a bit by using dev_err_probe().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220628221747.33956-4-andriy.shevchenko@linux.intel.com
2022-07-19 10:54:42 +01:00
Andy Shevchenko 2790a70c88 mfd: intel_soc_pmic_bxtwc: Convert to use platform_get/set_drvdata()
We have the specific helpers for platform device to set and get
its driver data. Convert driver to use them instead of open coded
variants.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220628221747.33956-3-andriy.shevchenko@linux.intel.com
2022-07-19 10:54:41 +01:00
Andy Shevchenko 929a4d289d mfd: intel_soc_pmic_bxtwc: Create sysfs attributes using core driver's facility
Driver core takes care of sysfs attributes. Use this facility instead of
doing it explicitly in ->probe() and ->remove().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220628221747.33956-2-andriy.shevchenko@linux.intel.com
2022-07-19 10:54:41 +01:00
Andy Shevchenko 5189952238 mfd: intel_soc_pmic_bxtwc: Don't shadow error codes in show()/store()
kstrtox() along with regmap API can return different error codes based on
circumstances.

Don't shadow them when returning to the caller.

While at it, remove rather confusing message from addr_store().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220628221747.33956-1-andriy.shevchenko@linux.intel.com
2022-07-19 10:54:41 +01:00
Andy Shevchenko 37e8ba74d1 mfd: intel-lpss: Add Intel Meteor Lake-P PCI IDs
Add Intel Meteor Lake-P LPSS PCI IDs.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220628223047.34301-1-andriy.shevchenko@linux.intel.com
2022-07-19 10:54:41 +01:00
AngeloGioacchino Del Regno d9cd0bc604 mfd: mt6397: Add basic support for MT6331+MT6332 PMIC
Add support for the MT6331 PMIC with MT6332 Companion PMIC, found
in MT6795 Helio X10 smartphone platforms.

This combo has support for multiple devices but, for a start,
only the following have been implemented:
- Regulators (two instances, one in MT6331, one in MT6332)
- RTC (MT6331)
- Keys (MT6331)
- Interrupts (MT6331 also dispatches MT6332's interrupts)

There's more to be implemented, especially for MT6332, which
will come at a later stage.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220627123954.64299-1-angelogioacchino.delregno@collabora.com
2022-07-19 10:54:41 +01:00
Samuel Holland 371a9fcac4 mfd: axp20x: Add AXP221/AXP223/AXP809 GPIO cells
These PMICs all contain a compatible GPIO controller.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220616060915.48325-3-samuel@sholland.org
2022-07-19 10:54:41 +01:00
Jiang Jian 15ff0bbc3d mfd: db8500-prcmu: Drop duplicated word "the" in the comments
There is an unexpected word "the" in the comments that needs to be dropped.

Line 801: * This function sets the the operating point of the ARM.
                               -------

Signed-off-by: Jiang Jian <jiangjian@cdjrlc.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220621103839.96847-1-jiangjian@cdjrlc.com
2022-07-19 10:54:41 +01:00
Andy Shevchenko 1074c4252f mfd: intel_soc_pmic_chtwc: Switch from __maybe_unused to pm_sleep_ptr() etc
Letting the compiler remove these functions when the kernel is built
without CONFIG_PM_SLEEP support is simpler and less heavier for builds
than the use of __maybe_unused attributes.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220616171009.43524-2-andriy.shevchenko@linux.intel.com
2022-07-19 10:54:40 +01:00
Andy Shevchenko 352de78076 mfd: intel_soc_pmic_chtwc: Use dev_err_probe()
Simplify the mux error path a bit by using dev_err_probe().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220616171009.43524-1-andriy.shevchenko@linux.intel.com
2022-07-19 10:54:40 +01:00
Uwe Kleine-König c55333064d mfd: tc6393xb: Make disable callback return void
All implementations return 0, so simplify accordingly.

This is a preparation for making platform remove callbacks return void.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220619082655.53728-1-u.kleine-koenig@pengutronix.de
2022-07-19 10:54:40 +01:00
Andy Shevchenko 99a7ec2f36 mfd: dln2: Automatically detect and fill endpoint pointers
The usb_find_common_endpoints() finds and fills the endpoints
in accordance with their types. Use it to automatically detect
and fill endpoint pointers.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220617182338.32402-1-andriy.shevchenko@linux.intel.com
2022-07-19 10:54:40 +01:00
Lee Jones 915696927c mfd: pm8008: Remove driver data structure pm8008_data
Maintaining a local driver data structure that is never shared
outside of the core device is an unnecessary complexity.  Half of the
attributes were not used outside of a single function, one of which
was not used at all.  The remaining 2 are generic and can be passed
around as required.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
2022-07-19 10:54:40 +01:00
Uwe Kleine-König 4a346a03a6 mfd: twl: Remove platform data support
There is no in-tree machine that provides a struct twl4030_platform_data
since commit e92fc4f04a ("ARM: OMAP2+: Drop legacy board file for
LDP"). So assume dev_get_platdata() returns NULL in twl_probe() and
simplify accordingly.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220614152148.252820-1-u.kleine-koenig@pengutronix.de
2022-07-19 10:54:40 +01:00
Tinghan Shen 66ee379d74 mfd: cros_ec: Add SCP Core-1 as a new CrOS EC MCU
MT8195 System Companion Processors(SCP) is a dual-core RISC-V MCU.
Add a new CrOS feature ID to represent the SCP's 2nd core.

The 1st core is referred to as 'core 0', and the 2nd core is referred
to as 'core 1'.

Signed-off-by: Tinghan Shen <tinghan.shen@mediatek.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220601112201.15510-16-tinghan.shen@mediatek.com
2022-07-19 10:54:39 +01:00
Fabien Parent 738654be3c mfd: mt6358-irq: Add MT6357 PMIC support
Add MT6357 PMIC IRQ support.

Signed-off-by: Fabien Parent <fparent@baylibre.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220531124959.202787-6-fparent@baylibre.com
2022-07-19 10:54:39 +01:00
Fabien Parent de58cee8c6 mfd: mt6397-core: Add MT6357 PMIC support
Adds support for PMIC keys, Regulator, and RTC for the MT6357 PMIC.

Signed-off-by: Fabien Parent <fparent@baylibre.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220531124959.202787-5-fparent@baylibre.com
2022-07-19 10:54:39 +01:00
Miaoqian Lin 1520669c82 mfd: max77620: Fix refcount leak in max77620_initialise_fps
of_get_child_by_name() returns a node pointer with refcount
incremented, we should use of_node_put() on it when not need anymore.
Add missing of_node_put() to avoid refcount leak.

Fixes: 327156c593 ("mfd: max77620: Add core driver for MAX77620/MAX20024")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220601043222.64441-1-linmq006@gmail.com
2022-07-19 10:54:39 +01:00
Andy Shevchenko 7ff7d5ffb7 syscon: Use %pa to format the variable of resource_size_t type
Instead of explicit casting, use %pa specifier to format
the variable of resource_size_t type.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220531202404.70282-1-andriy.shevchenko@linux.intel.com
2022-07-19 10:54:39 +01:00
Uwe Kleine-König 128ac294e1 mfd: t7l66xb: Drop platform disable callback
None of the in-tree instantiations of struct t7l66xb_platform_data
provides a disable callback. So better don't dereference this function
pointer unconditionally. As there is no user, drop it completely instead
of calling it conditional.

This is a preparation for making platform remove callbacks return void.

Fixes: 1f192015ca ("mfd: driver for the T7L66XB TMIO SoC")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220530192430.2108217-3-u.kleine-koenig@pengutronix.de
2022-07-19 10:54:38 +01:00
Uwe Kleine-König 2598f6ec54 mfd: asic3: Make asic3_gpio_remove() return void
Up to now asic3_gpio_remove() returns zero unconditionally. This makes it
easier to see in the caller that there is no error to handle.

This is a preparation for making platform remove callbacks return void.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220530192430.2108217-2-u.kleine-koenig@pengutronix.de
2022-07-19 10:54:38 +01:00
Luca Ceresoli 62fa5c9800 mfd: max77714: Update Luca Ceresoli's e-mail address
My Bootlin address is preferred from now on.

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220603155727.1232061-4-luca@lucaceresoli.net
2022-07-19 10:54:38 +01:00
Lee Jones c1cd6c305e Merge branches 'ib-mfd-acpi-for-rafael-5.20', 'ib-mfd-edac-i2c-leds-pinctrl-platform-watchdog-5.20' and 'ib-mfd-soc-bcm-5.20' into ibs-for-mfd-merged 2022-07-19 10:53:48 +01:00
Uwe Kleine-König 7e55b33d3f gpio: ucb1400: Remove platform setup and teardown support
There is no user of these callbacks. The motivation for this change is
to stop returning an error code from the remove callback.

This is a preparation for making platform remove callbacks return void.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
2022-07-19 09:56:51 +02:00
Greg Kroah-Hartman 2a3c8f8a44 IIO new device support, features and minor fixes for 5.20
Several on-running cleanup efforts dominate this time, plus the DMA
 safety alignment issue identified due to improved understanding of
 the restrictions as a result of Catalin Marinas' efforts in that area.
 
 One immutable branch in here due to MFD and SPMI elements needed for
 the qcom-rradc driver.
 
 Device support
 * bmi088
   - Add support for bmi085 (accelerometer part of IMU)
   - Add support for bmi090l (accelerometer part of IMU)
 * mcp4922
   - Add support for single channel device MCP4921
 * rzg2l-adc
   - Add compatible and minor tweaks to support RZ/G2UL ADC
 * sca3300
   - Add support for scl3300 including refactoring driver to support
     multiple device types and cleanup noticed whilst working on driver.
 * spmi-rradc
   - New driver for Qualcomm SPMI Round Robin ADC including necessary
     additional utility functions in SPMI core and related MFD driver.
 * ti-dac55781
   - Add compatible for DAC121C081 which is very similar to existing parts.
 
 Features
 * core
   - Warn on iio_trigger_get() on an unregistered IIO trigger.
 * bma400
   - Triggered buffer support
   - Activity and step counting
   - Misc driver improvements such as devm and header ordering
 * cm32181
   - Add PM support.
 * cros_ec
   - Sensor location support
 * sx9324
   - Add precharge resistor setting
   - Add internal compensation resistor setting
   - Add CS idle/sleep mode.
 * sx9360
   - Add precharge resistor setting
 * vl53l0x
   - Handle reset GPIO, regulator and relax handling of irq type.
 
 Cleanup and minor fixes:
 
 Treewide changes
 - Cleanup of error handling in remove functions in many drivers.
 - Update dt-binding maintainers for a number of ADI bindings.
 - Several sets of conversion of drivers from device tree specific to
   generic device properties. Includes fixing up various related
   header and Kconfig issues.
 - Drop include of of.h from iio.h and fix up drivers that need to include
   it directly.
 - More moves of clusters of drivers into appropriate IIO_XXX namespaces.
 - Tree wide fix of a long running bug around DMA safety requirements.
   IIO was using __cacheline_aligned to pad iio_priv() structures. This
   worked for a long time by coincidence, but correct alignment is
   ARCH_KMALLOC_MINALIGN.  As there is activity around this area, introduce
   an IIO local IIO_DMA_MINALIGN to allow for changing it in one place rather
   than every driver in future. Note, there have been no reports of this
   bug in the wild, and it may not happen on any platforms supported by
   upstream, so no rush to backport these fixes.
 
 Other cleanup
 * core
   - Switch to ida_alloc()/free()
   - Drop unused iio_get_time_res()
   - Octal permissions and DEVICE_ATTR_* macros.
   - Cleanup bared unsigned usage.
 * MAINTAINERS
   - Add include/dt-bindings/iio/ to the main IIO entry.
 * ad5380
   - Comment syntax fix.
 * ad74413r
   - Call to for_each_set_bit_from(), with from value as 0 replaced.
 * ad7768-1
   - Drop explicit setting of INDIO_BUFFER_TRIGGERED as now done by the core.
 * adxl345
   - Fix wrong address in dt-binding example.
 * adxl367
   - Drop extra update of FIFO watermark.
 * at91-sama5d2
   - Limit requested watermark to the hwfifo size.
 * bmg160, bme680
   - Typos
 * cio-dac
   - Switch to iomap rather than direct use of ioports
 * kxsd9
   - Replace CONFIG_PM guards with new PM macros that let the compiler
     cleanly remove the unused code and structures when !CONFIG_PM
 * lsm6dsx
   - Use new pm_sleep_ptr() and EXPORT_SIMPLE_DEV_PM_OPS(). Then move
     to Namespace.
 * meson_saradc - general cleanup.
   - Avoid attaching resources to iio_dev->dev
   - Use same struct device for all error messages
   - Convert to dev_err_probe() and use local struct device *dev to
     reduce code complexity.
   - Use devm_clk_get_optional() instead of hand rolling.
   - Use regmap_read_poll_timeout() instead of hand rolling.
 * mma7660
   - Drop ACPI_PTR() use that is unhelpful.
 * mpu3050
   - Stop exporting symbols not used outside of module
   - Switch to new DEFINE_RUNTIME_DEV_PM_OPS() macro and move to Namespace.
 * ping
   - Typo fix
 * qcom-spmi-rradc
   - Typo fix
 * sc27xx
   - Convert to generic struct u32_fract
 * srf08
   - Drop a redundant check on !val
 * st_lsm6dsx
   - Limit the requested watermark to the hwfifo size.
 * stm32-adc
   - Use generic_handle_domain_irq() instead of opencoding.
   - Fix handling of ADC disable.
 * stm32-dac
   - Use str_enabled_disable() instead of open coding.
 * stx104
   - Switch to iomap rather than direct use of ioports
 * tsc2046
   - Drop explicit setting of INDIO_BUFFER_TRIGGERED as now done by the core.
 * tsl2563
   - Replace flush_scheduled_work() with cancel_delayed_work_sync()
   - Replace cancel_delayed_work() with cancel_delayed_work_sync()
 * vl53l0x
   - Make the VDD regulator optional by allowing a dummy regulator.
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAmLQBwARHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0FohMHRAAi3nPM3IchXe886olumRgX5ke75vU+FNT
 sqQjqlpl6X7j5yNLU+HF6lC7zg3QzDnfWJ3Uo4C7s2sW7zO0997lkFx4jvF3yW9y
 0nLDgYm1Y1te/qR84BE355pMEsYEJVZyPI/Z8UfuBh6IfnSDeTE5ZwCvlRMAchtp
 AX+j1114FQvZ8yfdIlFjlN4vYSxCGgEZzfWYhpch/Jv1y2Q0L17bpv/KWGt1AYaF
 VugmKoNTM3WzIABBNGWQ4l4ZVVuVpuiVUL90AKv6Qf+yDSqw94tuIM0NZpJ1rqLr
 7tH568m7Eewh7zBp88PRB9XDiZVERvzdVQaT22+wlX+Vhn/SKeoK8PPpdLWD1YyG
 hXB0p+FGKncoKKgK1w9L7qRRNmsQDHowNHYMSjnzeBuyGQyEqwAXzNvvbiCqHh8y
 7b8GW+CYo7//wIarg74Xl+/4LwdCGcMUJNuTm1efEgC7yGToY7JD63DNo3sylaII
 bfoT06/yogaay/rVLZs5n+MvDONaDt4AbTTErG48s0TzqD/O8Ys85AF0IvKwQ80N
 WMxe4y+gdJ6VuU+ww9+6WdUzxnx+5gt+ZA2iLxZFekOIUi3Tj+q47F+17Jvwyt7U
 2wQzdtvNhHPwD5CqYpxD4iH/z5YFCtIHKjmUsVyAWGVbeuSS/QvFzpf39YWxBWO+
 W1w6RStUbXo=
 =IcsE
 -----END PGP SIGNATURE-----

Merge tag 'iio-for-5.20a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-next

Jonathan writes:

IIO new device support, features and minor fixes for 5.20

Several on-running cleanup efforts dominate this time, plus the DMA
safety alignment issue identified due to improved understanding of
the restrictions as a result of Catalin Marinas' efforts in that area.

One immutable branch in here due to MFD and SPMI elements needed for
the qcom-rradc driver.

Device support
* bmi088
  - Add support for bmi085 (accelerometer part of IMU)
  - Add support for bmi090l (accelerometer part of IMU)
* mcp4922
  - Add support for single channel device MCP4921
* rzg2l-adc
  - Add compatible and minor tweaks to support RZ/G2UL ADC
* sca3300
  - Add support for scl3300 including refactoring driver to support
    multiple device types and cleanup noticed whilst working on driver.
* spmi-rradc
  - New driver for Qualcomm SPMI Round Robin ADC including necessary
    additional utility functions in SPMI core and related MFD driver.
* ti-dac55781
  - Add compatible for DAC121C081 which is very similar to existing parts.

Features
* core
  - Warn on iio_trigger_get() on an unregistered IIO trigger.
* bma400
  - Triggered buffer support
  - Activity and step counting
  - Misc driver improvements such as devm and header ordering
* cm32181
  - Add PM support.
* cros_ec
  - Sensor location support
* sx9324
  - Add precharge resistor setting
  - Add internal compensation resistor setting
  - Add CS idle/sleep mode.
* sx9360
  - Add precharge resistor setting
* vl53l0x
  - Handle reset GPIO, regulator and relax handling of irq type.

Cleanup and minor fixes:

Treewide changes
- Cleanup of error handling in remove functions in many drivers.
- Update dt-binding maintainers for a number of ADI bindings.
- Several sets of conversion of drivers from device tree specific to
  generic device properties. Includes fixing up various related
  header and Kconfig issues.
- Drop include of of.h from iio.h and fix up drivers that need to include
  it directly.
- More moves of clusters of drivers into appropriate IIO_XXX namespaces.
- Tree wide fix of a long running bug around DMA safety requirements.
  IIO was using __cacheline_aligned to pad iio_priv() structures. This
  worked for a long time by coincidence, but correct alignment is
  ARCH_KMALLOC_MINALIGN.  As there is activity around this area, introduce
  an IIO local IIO_DMA_MINALIGN to allow for changing it in one place rather
  than every driver in future. Note, there have been no reports of this
  bug in the wild, and it may not happen on any platforms supported by
  upstream, so no rush to backport these fixes.

Other cleanup
* core
  - Switch to ida_alloc()/free()
  - Drop unused iio_get_time_res()
  - Octal permissions and DEVICE_ATTR_* macros.
  - Cleanup bared unsigned usage.
* MAINTAINERS
  - Add include/dt-bindings/iio/ to the main IIO entry.
* ad5380
  - Comment syntax fix.
* ad74413r
  - Call to for_each_set_bit_from(), with from value as 0 replaced.
* ad7768-1
  - Drop explicit setting of INDIO_BUFFER_TRIGGERED as now done by the core.
* adxl345
  - Fix wrong address in dt-binding example.
* adxl367
  - Drop extra update of FIFO watermark.
* at91-sama5d2
  - Limit requested watermark to the hwfifo size.
* bmg160, bme680
  - Typos
* cio-dac
  - Switch to iomap rather than direct use of ioports
* kxsd9
  - Replace CONFIG_PM guards with new PM macros that let the compiler
    cleanly remove the unused code and structures when !CONFIG_PM
* lsm6dsx
  - Use new pm_sleep_ptr() and EXPORT_SIMPLE_DEV_PM_OPS(). Then move
    to Namespace.
* meson_saradc - general cleanup.
  - Avoid attaching resources to iio_dev->dev
  - Use same struct device for all error messages
  - Convert to dev_err_probe() and use local struct device *dev to
    reduce code complexity.
  - Use devm_clk_get_optional() instead of hand rolling.
  - Use regmap_read_poll_timeout() instead of hand rolling.
* mma7660
  - Drop ACPI_PTR() use that is unhelpful.
* mpu3050
  - Stop exporting symbols not used outside of module
  - Switch to new DEFINE_RUNTIME_DEV_PM_OPS() macro and move to Namespace.
* ping
  - Typo fix
* qcom-spmi-rradc
  - Typo fix
* sc27xx
  - Convert to generic struct u32_fract
* srf08
  - Drop a redundant check on !val
* st_lsm6dsx
  - Limit the requested watermark to the hwfifo size.
* stm32-adc
  - Use generic_handle_domain_irq() instead of opencoding.
  - Fix handling of ADC disable.
* stm32-dac
  - Use str_enabled_disable() instead of open coding.
* stx104
  - Switch to iomap rather than direct use of ioports
* tsc2046
  - Drop explicit setting of INDIO_BUFFER_TRIGGERED as now done by the core.
* tsl2563
  - Replace flush_scheduled_work() with cancel_delayed_work_sync()
  - Replace cancel_delayed_work() with cancel_delayed_work_sync()
* vl53l0x
  - Make the VDD regulator optional by allowing a dummy regulator.

* tag 'iio-for-5.20a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (244 commits)
  iio: adc: xilinx-xadc: Drop duplicate NULL check in xadc_parse_dt()
  iio: adc: xilinx-xadc: Make use of device properties
  iio: light: cm32181: Add PM support
  iio: adc: ad778-1: do not explicity set INDIO_BUFFER_TRIGGERED mode
  iio: adc: ti-tsc2046: do not explicity set INDIO_BUFFER_TRIGGERED mode
  iio: adc: stm32-adc: disable adc before calibration
  iio: adc: stm32-adc: make safe adc disable
  iio: dac: ad5380: align '*' each line and drop unneeded blank line
  iio: adc: qcom-spmi-rradc: Fix spelling mistake "coherrency" -> "coherency"
  iio: Don't use bare "unsigned"
  dt-bindings: iio: dac: mcp4922: expand for mcp4921 support
  iio: dac: mcp4922: add support to mcp4921
  iio: chemical: sps30: Move symbol exports into IIO_SPS30 namespace
  iio: pressure: bmp280: Move symbol exports to IIO_BMP280 namespace
  iio: imu: bmi160: Move exported symbols to IIO_BMI160 namespace
  iio: adc: stm32-adc: Use generic_handle_domain_irq()
  proximity: vl53l0x: Make VDD regulator actually optional
  MAINTAINERS: add include/dt-bindings/iio to IIO SUBSYSTEM AND DRIVERS
  dt-bindings: iio/accel: Fix adi,adxl345/6 example I2C address
  iio: gyro: bmg160: Fix typo in comment
  ...
2022-07-14 15:04:49 +02:00
Tan Jui Nee 7064d7d88b mfd: lpc_ich: Add support for pinctrl in non-ACPI system
Add support for non-ACPI systems, such as system that uses
Advanced Boot Loader (ABL) whereby a platform device has to be created
in order to bind with pin control and GPIO.

At the moment, Intel Apollo Lake In-Vehicle Infotainment (IVI) system
requires a driver to hide and unhide P2SB to lookup P2SB BAR and pass
the PCI BAR address to GPIO.

Signed-off-by: Tan Jui Nee <jui.nee.tan@intel.com>
Co-developed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Henning Schild <henning.schild@siemens.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee@kernel.org>
2022-07-14 10:50:31 +01:00
Andy Shevchenko 559793198f mfd: lpc_ich: Switch to generic p2sb_bar()
Instead of open coding p2sb_bar() functionality we are going to
use generic library. There is one more user en route.

This is more than just a clean-up. It also fixes a potential issue
seen when SPI BAR is 64-bit. The current code works if and only if
the PCI BAR of the hidden device is inside 4G address space. In case
when firmware decides to go above 4G, we will get a wrong address.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Henning Schild <henning.schild@siemens.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee@kernel.org>
2022-07-14 10:50:25 +01:00
Andy Shevchenko 6e3b29dbc1 mfd: lpc_ich: Factor out lpc_ich_enable_spi_write()
Factor out duplicate code to lpc_ich_enable_spi_write() helper function.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Henning Schild <henning.schild@siemens.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee@kernel.org>
2022-07-14 10:50:14 +01:00
Stefan Wahren df76234276 mfd: bcm2835-pm: Add support for BCM2711
In BCM2711 the new RPiVid ASB took over V3D. The old ASB is still present
with the ISP and H264 bits, and V3D is in the same place in the new ASB
as the old one.

As per the devicetree bindings, BCM2711 will provide both the old and
new ASB resources, so get both of them and pass them into
'bcm2835-power,' which will take care of selecting which one to use
accordingly.

Since the RPiVid ASB's resources were being provided prior to formalizing
the bindings[1], also support the old DT files that didn't use
'reg-names.'

[1] See: 7dbe8c62ce ("ARM: dts: Add minimal Raspberry Pi 4 support")
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Peter Robinson <pbrobinson@gmail.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220625113619.15944-8-stefan.wahren@i2se.com
2022-07-04 11:42:20 +01:00
Nicolas Saenz Julienne 01e7865d18 mfd: bcm2835-pm: Use 'reg-names' to get resources
If available in firmware, find resources by their 'reg-names' position
instead of relying on hardcoded offsets. Care is taken to support old
firmware nonetheless.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220625113619.15944-7-stefan.wahren@i2se.com
2022-07-04 11:41:27 +01:00
Rafael J. Wysocki 0c9b9c2ac0 mfd: core: Use acpi_dev_for_each_child()
Instead of walking the list of children of an ACPI device directly,
use acpi_dev_for_each_child() to carry out an action for all of
the given ACPI device's children.

This will help to eliminate the children list head from struct
acpi_device as it is redundant and it is used in questionable ways
in some places (in particular, locking is needed for walking the
list pointed to it safely, but it is often missing).

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/2726954.BEx9A2HvPv@kreacher
2022-06-27 12:22:06 +01:00
Caleb Connolly d23c3c085a mfd: qcom-spmi-pmic: read fab id on supported PMICs
The PMI8998 and PM660 expose the fab_id, this is needed by drivers like
the RRADC to calibrate ADC values.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Tested-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220429220904.137297-4-caleb.connolly@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-06-18 14:01:16 +01:00
Caleb Connolly e9c11c6e3a mfd: qcom-spmi-pmic: expose the PMIC revid information to clients
Some PMIC functions such as the RRADC need to be aware of the PMIC
chip revision information to implement errata or otherwise adjust
behaviour, export the PMIC information to enable this.

This is specifically required to enable the RRADC to adjust
coefficients based on which chip fab the PMIC was produced in,
this can vary per unique device and therefore has to be read at
runtime.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Tested-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220429220904.137297-3-caleb.connolly@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-06-18 14:01:16 +01:00
Thomas Gleixner abd4627475 treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_319.RULE
Based on the normalized pattern:

    this program is free software you can redistribute it and/or modify it
    under the terms of the gnu general public license version 2 as
    published by the free software foundation  this program is distributed
    as is without any warranty of any kind whether expressed or implied
    without even the implied warranty of merchantability or fitness for a
    particular purpose see the gnu general public license version 2 for
    more details

extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

has been chosen to replace the boilerplate/reference.

Reviewed-by: Allison Randal <allison@lohutok.net>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-10 14:51:36 +02:00
Thomas Gleixner 2aec85b26f treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_30.RULE (part 2)
Based on the normalized pattern:

    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 version 2  this program is distributed as is
    without any warranty of any kind whether express or implied 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-only

has been chosen to replace the boilerplate/reference.

Reviewed-by: Allison Randal <allison@lohutok.net>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-10 14:51:35 +02:00
Russ Weight 3f83b62a7b
mfd: intel-m10-bmc: Rename n3000bmc-secure driver
The n3000bmc-secure driver has changed to n3000bmc-sec-update. Update
the name in the list of the intel-m10-bmc sub-drivers.

Tested-by: Tianfei Zhang <tianfei.zhang@intel.com>
Signed-off-by: Russ Weight <russell.h.weight@intel.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220606160038.846236-2-russell.h.weight@intel.com
Signed-off-by: Xu Yilun <yilun.xu@intel.com>
2022-06-08 17:04:19 +08:00
Prashant Malani b1d288d9c3 platform/chrome: cros_ec_proto: Rename cros_ec_command function
cros_ec_command() is the name of a function as well as a struct, as such
it can confuse indexing tools (like ctags). Avoid this by renaming it to
cros_ec_cmd(). Update all the callsites to use the new name.

This patch is a find-and-replace, so should not introduce any functional
changes.

Suggested-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Prashant Malani <pmalani@chromium.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
Link: https://lore.kernel.org/r/20220606201825.763788-3-pmalani@chromium.org
2022-06-08 08:14:53 +00:00
Linus Torvalds 96479c0980 ARM: multiplatform changes, part 2
The second part of the multiplatform changes now converts the
 Intel/Marvell PXA platform along with the rest. The patches went through
 several rebases before the merge window as bugs were found, so they
 remained separate.
 
 This has to touch a lot of drivers, in particular the touchscreen,
 pcmcia, sound and clk bits, to detach the driver files from the
 platform and board specific header files.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEo6/YBQwIrVS28WGKmmx57+YAGNkFAmKZKqsACgkQmmx57+YA
 GNnO/w//dgJBlkmoIIKlG2eJsvoUKwDt7MuLEMCqSqYYUSvMENFwKK66INMDIJ3l
 PmKf94JadlpBm2OB2vzW+D1EtaLGX9eXZkKD+vyB1I1yFkKdzEPcAfitfrRwe58E
 pR4nQd/jVL4UCY+pp442O1q9VvMpMV9P4ILJGPS/PpsD5CT9Gn8m9svIIuNuDRFd
 nwpyZC3l32jVLo9iuLmwZUvxtOWI3hTqZrnxhByBhlvtnGexRsq/VhfubK2uzBi1
 CyWHjqzOSmseGmsUDwv9LFqVV9YRCeisS3IElA5L0VgM0XvHKA+f9qyF7V6zI20g
 y9LtqhdAtiTpE/aUrOW2LDYaM/bc7RilYZrWchoZbCEsHhV4C+ld3QoTyxvGscvG
 tbznhvZKdUNX8LHS0J9NqIj1q1YGN5ei5r/C5R8DBj1q8VcTVnq3dms8xzVTd35o
 xS5BbLFliiI96jc7S6LaQizXheYjAfdPhmXUAxNXvWIVQ6SXnf8/U/RB9Zzjb8hm
 FH2Gu8m/Dh2MHKBBRWSVw8VahV0V7WiEaWeYuwwTbW1wUrsWiizVaPnqrt6Cq9DW
 oJZgBvktWEXUQz73qrnvwo9GjcKqAxaWKWq05hHKHKuLGezsPAyIhIKr51V2xqqw
 cp2OIMCsN5GYENOhHvt6BMRAI5iA4VyFDtWAqw9B6EIwno6N7Z4=
 =cnSb
 -----END PGP SIGNATURE-----

Merge tag 'arm-multiplatform-5.19-2' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc

Pull more ARM multiplatform updates from Arnd Bergmann:
 "The second part of the multiplatform changes now converts the
  Intel/Marvell PXA platform along with the rest. The patches went
  through several rebases before the merge window as bugs were found, so
  they remained separate.

  This has to touch a lot of drivers, in particular the touchscreen,
  pcmcia, sound and clk bits, to detach the driver files from the
  platform and board specific header files"

* tag 'arm-multiplatform-5.19-2' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (48 commits)
  ARM: pxa/mmp: remove traces of plat-pxa
  ARM: pxa: convert to multiplatform
  ARM: pxa/sa1100: move I/O space to PCI_IOBASE
  ARM: pxa: remove support for MTD_XIP
  ARM: pxa: move mach/*.h to mach-pxa/
  ARM: PXA: fix multi-cpu build of xsc3
  ARM: pxa: move plat-pxa to drivers/soc/
  ARM: mmp: rename pxa_register_device
  ARM: mmp: remove tavorevb board support
  ARM: pxa: remove unused mach/bitfield.h
  ARM: pxa: move clk register definitions to driver
  ARM: pxa: move smemc register access from clk to platform
  cpufreq: pxa3: move clk register access to clk driver
  ARM: pxa: remove get_clk_frequency_khz()
  ARM: pxa: pcmcia: move smemc configuration back to arch
  ASoC: pxa: i2s: use normal MMIO accessors
  ASoC: pxa: ac97: use normal MMIO accessors
  ASoC: pxa: use pdev resource for FIFO regs
  Input: wm97xx - get rid of irq_enable method in wm97xx_mach_ops
  Input: wm97xx - switch to using threaded IRQ
  ...
2022-06-02 15:23:54 -07:00
Uwe Kleine-König ade0642d7d mfd: rt4831: Improve error reporting for problems during .remove()
Returning an error value in an i2c remove callback results in a generic
error message being emitted by the i2c core, but otherwise it doesn't make
a difference. The device goes away anyhow and the devm cleanups are
called.

So instead of triggering the generic i2c error message, emit a more helpful
message if a problem occurs and return 0 to suppress the generic message.

This patch is a preparation for making i2c remove callbacks return void.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220502191012.53259-1-u.kleine-koenig@pengutronix.de
2022-05-23 15:08:04 +01:00
Yang Yingliang 311242c770 mfd: davinci_voicecodec: Fix possible null-ptr-deref davinci_vc_probe()
It will cause null-ptr-deref when using 'res', if platform_get_resource()
returns NULL, so move using 'res' after devm_ioremap_resource() that
will check it to avoid null-ptr-deref.
And use devm_platform_get_and_ioremap_resource() to simplify code.

Fixes: b5e29aa880 ("mfd: davinci_voicecodec: Remove pointless #include")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220426030857.3539336-1-yangyingliang@huawei.com
2022-05-23 14:52:45 +01:00
Gaggery Tsai eeb0a442da mfd: intel-lpss: Add support for ADL-P i2c6 and i2c7
Added 8086:51d8 and 8086:51d9 to the intel_lpss_pci driver. They are
Intel Alder Lake-P i2c controllers.

Signed-off-by: Gaggery Tsai <gaggery.tsai@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220520193537.26090-1-gaggery.tsai@intel.com
2022-05-23 14:08:45 +01:00
Linus Walleij 813c2aee51 ARM/pxa/mfd/power/sound: Switch Tosa to GPIO descriptors
The Tosa device (Sharp SL-6000) has a mishmash driver set-up
for the Toshiba TC6393xb MFD that includes a battery charger
and touchscreen and has some kind of relationship to the SoC
sound driver for the AC97 codec. Other devices define a chip
like this but seem only half-implemented, not really handling
battery charging etc.

This patch switches the Toshiba MFD device to provide GPIO
descriptors to the battery charger and SoC codec. As a result
some descriptors need to be moved out of the Tosa boardfile
and new one added: all SoC GPIO resources to these drivers
now comes from the main boardfile, while the MFD provide
GPIOs for its portions.

As a result we can request one GPIO from our own GPIO chip
and drop two hairy callbacks into the board file.

This platform badly needs to have its drivers split up and
converted to device tree probing to handle this quite complex
relationship in an orderly manner. I just do my best in solving
the GPIO descriptor part of the puzzle. Please don't ask me
to fix everything that is wrong with these driver to todays
standards, I am just trying to fix one aspect. I do try to
use modern devres resource management and handle deferred
probe using new functions where appropriate.

Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: Dirk Opfer <dirk@opfer-online.de>
Cc: Robert Jarzmik <robert.jarzmik@free.fr>
Cc: Daniel Mack <daniel@zonque.org>
Cc: Haojian Zhuang <haojian.zhuang@gmail.com>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Reviewed-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Acked-by: Mark Brown <broonie@kernel.org>
Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2022-05-07 22:55:33 +02:00
Uwe Kleine-König 724c3be3db mfd: twl4030: Make twl4030_exit_irq() return void
If twl4030_exit_irq() returns an error, the effect is that the caller
(twl_remove()) forwards the error to the i2c core without unregistering
its dummy slave devices. This only makes the i2c core emit another
error message and then it still removes the device.

In this situation it doesn't make sense to abort the remove cleanup and not
unregister the slave devices. So do that. Then return value is actually
unused and twl4030_exit_irq() can better be changed to return no value at
all.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220113101430.12869-3-u.kleine-koenig@pengutronix.de
2022-04-28 17:24:40 +01:00
Uwe Kleine-König b6f2943182 mfd: twl6030: Make twl6030_exit_irq() return void
This function returns 0 unconditionally, so there is no benefit in
returning a value at all and make the caller do error checking.

Also the caller (twl_remove()) cannot do anything sensible with an error
code. Passing it up the call stack isn't a good option because the i2c core
ignores error codes (apart from emitting an error message).

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220113101430.12869-2-u.kleine-koenig@pengutronix.de
2022-04-28 17:24:10 +01:00
Cixi Geng d95ab6d2af mfd: sprd: Jugle {of,spi}_device_id tables into numerical order
Ordered with the smallest number at the top.

Signed-off-by: Cixi Geng <cixi.geng1@unisoc.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220427075212.3409407-1-gengcixi@gmail.com
2022-04-27 10:33:11 +01:00
Cixi Geng 875709f978 mfd: sprd: Add SC2730 PMIC to SPI device ID table
Add the SC2730 PMIC support for module autoloading
through SPI modalises.

Signed-off-by: Cixi Geng <cixi.geng1@unisoc.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220425132410.2708304-1-gengcixi@gmail.com
2022-04-27 08:36:48 +01:00
Stephen Boyd ff23a46e46 mfd: cros_ec_dev: Only register PCHG device if present
Don't create a device for the peripheral charger (PCHG) if there aren't
any peripheral charger ports. This removes a device on most ChromeOS
systems, because the peripheral charger functionality isn't always
present.

Cc: Prashant Malani <pmalani@chromium.org>
Cc: Tzung-Bi Shih <tzungbi@kernel.org>
Cc: Daisuke Nojiri <dnojiri@chromium.org>
Cc: Benson Leung <bleung@chromium.org>
Cc: Guenter Roeck <groeck@chromium.org>
Cc: <chrome-platform@lists.linux.dev>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Prashant Malani <pmalani@chromium.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220419000408.3202635-1-swboyd@chromium.org
2022-04-26 19:23:24 +01:00
Fabien Parent 4a901e3050 mfd: mt6397-core: Add resources for PMIC keys for MT6359
Add the MFD resources in order to be able to probe and use the keyboard
driver for the MT6359 PMIC.

Signed-off-by: Fabien Parent <fparent@baylibre.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220415153629.1817202-4-fparent@baylibre.com
2022-04-26 19:23:19 +01:00
Lv Ruyi 3b49ae380c mfd: ipaq-micro: Fix error check return value of platform_get_irq()
platform_get_irq() return negative value on failure, so null check of
irq is incorrect. Fix it by comparing whether it is less than zero.

Fixes: dcc21cc09e ("mfd: Add driver for Atmel Microcontroller on iPaq h3xxx")
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220412085305.2533030-1-lv.ruyi@zte.com.cn
2022-04-26 15:12:22 +01:00
Maíra Canal 7f5aaa4a0a mfd: hi655x-pmic: Replace legacy gpio interface for gpiod interface
Considering the current transition of the GPIO subsystem, remove all
dependencies of the legacy GPIO interface (linux/gpio.h and linux
/of_gpio.h) and replace it with the descriptor-based GPIO approach.

Signed-off-by: Maíra Canal <maira.canal@usp.br>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/Yk2maZuf+5FGL+eg@fedora
2022-04-26 15:10:29 +01:00
Linus Torvalds 8350e8331b - New Drivers
- Add support for Maxim MAX77714 PMIC
 
  - Remove Drivers
    - Remove support for ST-Ericsson AB8500 DebugFS
 
  - New Device Support
    - Add support for Silergy SY7636A to Simple MFD I2C
    - Add support for MediaTek MT6366 PMIC to MT6358 IRQ
    - Add support for Charger to Intel PMIC CRC
    - Add support for Raptor Lake to Intel LPSS PCI
 
  - New Functionality
    - Add support for Reboot to Rockchip RK808
 
  - Fix-ups
    - Device Tree changes (inc. YAML conversion); silergy,sy7636a, maxim,max77843,
                                   google,cros-ec, maxim,max14577, maxim,max77802,
 				  maxim,max77714, qcom,tcsr, qcom,spmi-pmic,
 				  stericsson,ab8500, stericsson,db8500-prcmu,
 				  samsung,exynos5433-lpass, mt6397, syscon, brcm,cru
    - Visible to menuconfig; simple-mfd-i2c
    - Clean-up or clarify code; max77686, intel_soc_pmic_crc
    - Improve error handling; mc13xxx-core, stmfx, asic3
    - Pass device information to child devices; iqs62x, intel-lpss-acpi
    - Individually identify IRQ domains; intel_soc_pmic_core
    - Remove superfluous code; dbx500-prcmu, exynos-lpass
    - Staticify and constify; arizona-i2c
    - Mark sometimes used data as __maybe_unused; atmel-flexcom
    - Account for different ACPI tables on AOSP/Windows platforms; arizona-spi
    - Use provided (platform) APIs; ab8500-core
    - Trivial (whitespace, spelling); rohm-bd9576
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEdrbJNaO+IJqU8IdIUa+KL4f8d2EFAmI9n1YACgkQUa+KL4f8
 d2F59RAAi3zTun+i7NEvaPs4awcXgUv9ZFJmP/AcCTvKwmAnom4JHc56c86yE/Fz
 IwQ/yug60AQPMe05jw4+KxD87URLGKb/IDTzmRvnC29gwg1FR5A2bFNJ+wveK6od
 cN0r40lvHCzVASwOeF2E63RzXcWHFg+tuNq6qm+HQ6LX31MpMe/dfMOCvVm+1A50
 aOn2cnEiUw7mhEiEy0CPtd01hjBEu4QS8xzZwGu/4lHEbInDxpAakQP8ixYE0THF
 KEvR2gFS6G6wYHO3ZQOJHQJnnzL1nmLtsUX3q+5+DIKnLcY/1xofdxloHAH18i+9
 8e9nDB4TVPAHCpiSVFmPtzS7TR5ofkaYIvpxKlolBVgXGkAivYrtcQUMPEG6ZbNL
 wpe6j2IB7EeQeh0z8k9mzr6zZ3Dw5EGcytvAMP3SZAsHpy+uiZ0TOqPdFs1NXLJ7
 7rlpUhlgn2Ar5TI+z5DLeZsKSO8Lb9+X6BlXfblT0dNBclmh52suWwp1yx7hCehD
 mFm7JfkU7+/9XlzkxYqyyl/3qmmuiXfrxf5Uc96kwcczFkXli8z2Q5Jli6dmCq5+
 LE9hkLk6JC5m5QpRv8cg06sHraDbPbTnrrhf5w6txukU+HsldxcQNaJMqLhHCPQ4
 CUYWRImr0no8PJZQkslIgWaqkpQejS5UzPQbFnkQblvP2XMvOFU=
 =1xnI
 -----END PGP SIGNATURE-----

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

Pull MFD updates from Lee Jones:
 "New Drivers:
   - Add support for Maxim MAX77714 PMIC

  Removed Drivers:
   - Remove support for ST-Ericsson AB8500 DebugFS

  New Device Support:
   - Add support for Silergy SY7636A to Simple MFD I2C
   - Add support for MediaTek MT6366 PMIC to MT6358 IRQ
   - Add support for Charger to Intel PMIC CRC
   - Add support for Raptor Lake to Intel LPSS PCI

  New Functionality:
   - Add support for Reboot to Rockchip RK808

  Fix-ups:
   - Device Tree changes (includcing YAML conversion) for
     silergy,sy7636a, maxim,max77843, google,cros-ec, maxim,max14577,
     maxim,max77802, maxim,max77714, qcom,tcsr, qcom,spmi-pmic,
     stericsson,ab8500, stericsson,db8500-prcmu,
     samsung,exynos5433-lpass, mt6397, syscon, brcm,cru
   - Visible to menuconfig; simple-mfd-i2c
   - Clean-up or clarify code; max77686, intel_soc_pmic_crc
   - Improve error handling; mc13xxx-core, stmfx, asic3
   - Pass device information to child devices; iqs62x, intel-lpss-acpi
   - Individually identify IRQ domains; intel_soc_pmic_core
   - Remove superfluous code; dbx500-prcmu, exynos-lpass
   - Staticify and constify; arizona-i2c
   - Mark sometimes used data as __maybe_unused; atmel-flexcom
   - Account for different ACPI tables on AOSP/Windows platforms; arizona-spi
   - Use provided (platform) APIs; ab8500-core
   - Trivial (whitespace, spelling); rohm-bd9576"

* tag 'mfd-next-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (50 commits)
  dt-bindings: mfd: syscon: Add microchip,lan966x-cpu-syscon compatible
  mfd: bd9576: fix typos in comments
  mfd: Use platform_get_irq() to get the interrupt
  mfd: db8500-prcmu: Remove unused inline function
  mfd: arizona-spi: Add Android board ACPI table handling
  mfd: arizona-spi: Split Windows ACPI init code into its own function
  mfd: asic3: Add missing iounmap() on error asic3_mfd_probe
  MAINTAINERS: Rectify entry for ROHM MULTIFUNCTION BD9571MWV-M PMIC DEVICE DRIVERS
  mfd: intel-lpss: Provide an SSP type to the driver
  dt-bindings: mfd: brcm,cru: Rename pinctrl node
  dt-bindings: Add compatibles for undocumented trivial syscons
  mfd: atmel-flexcom: Fix compilation warning
  dt-bindings: mfd: Add compatible for the MediaTek MT6366 PMIC
  dt-bindings: mfd: samsung,exynos5433-lpass: Convert to dtschema
  mfd: exynos-lpass: Drop unneeded syscon.h include
  mfd: intel-lpss: Add Intel Raptor Lake PCH-S PCI IDs
  mfd: ab8500: Drop debugfs module
  mfd: sta2x11: Use GFP_KERNEL instead of GFP_ATOMIC
  mfd: ab8500: Rewrite bindings in YAML
  mfd: qcom-spmi-pmic: Add pm8953 compatible
  ...
2022-03-25 13:56:18 -07:00
Linus Torvalds 8eb48fc7c5 power supply and reset changes for the v5.18 series
power-supply core:
  - Introduce "Bypass" charging type used by USB PPS standard
  - Refactor power_supply_set_input_current_limit_from_supplier()
  - Add fwnode support to power_supply_get_battery_info()
 
 Drivers:
  - ab8500: continue migrating towards using standard core APIs
  - axp288 fuel-gauge: refactor driver to be fully resource managed
  - battery-samsung-sdi: new in-kernel provider for (constant) Samsung battery info
  - bq24190: disable boost regulator on shutdown
  - bq24190: add support for battery-info on ACPI based systems
  - bq25890: prepare driver for usage on ACPI based systems
  - bq25890: add boost regulator support
  - cpcap-battery: add NVMEM based battery detection support
  - injoinic ip5xxx: new driver for power bank IC
  - upi ug3105: new battery driver
  - misc. small improvements and fixes
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEE72YNB0Y/i3JqeVQT2O7X88g7+poFAmI4ub0ACgkQ2O7X88g7
 +poBBg/+OTb2O+dJsigwT9q2HKz98oPSwd+Zd0L/s1hCtc4AhlsNPHimEOYslvOl
 WN3auTQO1rjB4gi73p9A5NKTiAMTnXuCXoY0pLRgkcKybHGzliDqPY99Em1VqLHT
 OdJ+xG1qdk34T5hLW6ZfHV1VlB1J6u/JZbXyGbBzZ2r1mP3sLpWCW87cRTuBpaXD
 vmdWBRhYdz47pJS0PQs4TI7nFWoCvLB6Hmqe79zTI4hgRkKS05XeU3HXu+npdtdS
 2OmPKwVcHIeuI3blTvtn7pHiX1j4Le319mmlOtwtdeEr70ONng9p2L6GPhW88ewH
 1AZG58V6hFInMKKVHBbftEHybZ7wEc9CmjQ+l6VVdwHAgWwQEijsY3aG+fQ41Yw/
 x1IRMMv5SO0A2amZ+mMxmIs7aQ0OXe78n8DiDPnhSWdh7q7+KgzXlBawmWDEZ9LZ
 HUcfDOQ+EISfg9F81Q7KKVDsSClUk2zIVbs944Y/4emT78XQjPq/NPlLpfwy0kMC
 46lIO5prhWqe8WXtqkyR7x04nkrzo9Q/yWuj959l+bYACAtns8zQNZ+f8O2TvJ7V
 Is2DoaT5fELUD2D8NOla5RYZAtPzkfDf3iaNOLG7mkzGuz1RPcn3mgl0+a760AiZ
 poNmjfaKlY0d1WHc8AoxZgoKZxDZ3ckjAt8YzI/QT0RXEvoBEtY=
 =OiYc
 -----END PGP SIGNATURE-----

Merge tag 'for-v5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply

Pull power supply and reset updates from Sebastian Reichel:
 "Power-supply core:

   - Introduce "Bypass" charging type used by USB PPS standard

   - Refactor power_supply_set_input_current_limit_from_supplier()

   - Add fwnode support to power_supply_get_battery_info()

  Drivers:

   - ab8500: continue migrating towards using standard core APIs

   - axp288 fuel-gauge: refactor driver to be fully resource managed

   - battery-samsung-sdi: new in-kernel provider for (constant) Samsung
     battery info

   - bq24190: disable boost regulator on shutdown

   - bq24190: add support for battery-info on ACPI based systems

   - bq25890: prepare driver for usage on ACPI based systems

   - bq25890: add boost regulator support

   - cpcap-battery: add NVMEM based battery detection support

   - injoinic ip5xxx: new driver for power bank IC

   - upi ug3105: new battery driver

   - misc small improvements and fixes"

* tag 'for-v5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (94 commits)
  power: ab8500_chargalg: Use CLOCK_MONOTONIC
  power: supply: Add a driver for Injoinic power bank ICs
  dt-bindings: trivial-devices: Add Injoinic power bank ICs
  dt-bindings: vendor-prefixes: Add Injoinic
  power: supply: ab8500: Remove unused variable
  power: supply: da9150-fg: Remove unnecessary print function dev_err()
  power: supply: ab8500: fix a handful of spelling mistakes
  power: supply: ab8500_fg: Account for line impedance
  dt-bindings: power: supply: ab8500_fg: Add line impedance
  power: supply: axp20x_usb_power: fix platform_get_irq.cocci warnings
  power: supply: axp20x_ac_power: fix platform_get_irq.cocci warning
  power: supply: wm8350-power: Add missing free in free_charger_irq
  power: supply: wm8350-power: Handle error for wm8350_register_irq
  power: supply: Static data for Samsung batteries
  power: supply: ab8500_fg: Use VBAT-to-Ri if possible
  power: supply: Support VBAT-to-Ri lookup tables
  power: supply: ab8500: Standardize BTI resistance
  power: supply: ab8500: Standardize alert mode charging
  power: supply: ab8500: Standardize maintenance charging
  power: supply: bq24190_charger: Delay applying charge_type changes when OTG 5V Vbus boost is on
  ...
2022-03-25 13:31:02 -07:00
Julia Lawall def387a239 mfd: bd9576: fix typos in comments
Various spelling mistakes in comments.
Detected with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Reviewed-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220314115354.144023-29-Julia.Lawall@inria.fr
2022-03-23 14:51:51 +00:00
Minghao Chi (CGEL ZTE) fc832ac987 mfd: Use platform_get_irq() to get the interrupt
It is not recommened to use platform_get_resource(pdev, IORESOURCE_IRQ)
for requesting IRQ's resources any more, as they can be not ready yet in
case of DT-booting.

platform_get_irq() instead is a recommended way for getting IRQ even if
it was not retrieved earlier.

It also makes code simpler because we're getting "int" value right away
and no conversion from resource to int is required.

The print function dev_err() is redundant because platform_get_irq()
already prints an error.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220309035607.2080884-1-chi.minghao@zte.com.cn
2022-03-23 14:51:51 +00:00
Hans de Goede 9ed55e9ac5 mfd: arizona-spi: Add Android board ACPI table handling
x86/ACPI boards with an arizona WM5102 codec ship with either Windows or
Android as factory installed OS.

The ACPI fwnode for the codec on Android boards misses 2 things compared
to the Windows boards (this is hardcoded in the Android board kernels):

1. There is no CLKE ACPI method to enabe the 32 KHz clock the codec needs
   for jack-detection.

2. The GPIOs used by the codec are not listed in the fwnode for the codec.

The ACPI tables on x86/ACPI boards shipped with Android being incomplete
happens a lot. The special drivers/platform/x86/x86-android-tablets.c
module contains DMI based per model handling to compensate for this.

This module will enable the 32KHz clock through the pinctrl framework
to fix 1. and it will also register a gpio-lookup table for all GPIOs
needed by the codec + machine driver, including the GPIOs coming from
the codec itself.

Add an arizona_spi_acpi_android_probe() function which waits for the
x86-android-tablets to have set things up before continue with probing
the arizona WM5102 codec.

Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220307173844.199135-2-hdegoede@redhat.com
2022-03-23 14:51:51 +00:00
Hans de Goede 3cf2b4344b mfd: arizona-spi: Split Windows ACPI init code into its own function
x86/ACPI boards with an arizona WM5102 codec ship with either Windows or
Android as factory installed OS.

The ACPI fwnode describing the codec differs depending on the factory OS,
and the current arizona_spi_acpi_probe() function is tailored for use
with the Windows board ACPI tables.

Split out the Windows board ACPI tables specific bits into a new
arizona_spi_acpi_windows_probe() function in preparation for also
adding support for the Android board ACPI tables.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220307173844.199135-1-hdegoede@redhat.com
2022-03-23 14:51:50 +00:00
Miaoqian Lin e84ee1a75f mfd: asic3: Add missing iounmap() on error asic3_mfd_probe
Add the missing iounmap() before return from asic3_mfd_probe
in the error handling case.

Fixes: 64e8867ba8 ("mfd: tmio_mmc hardware abstraction for CNF area")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220307072947.5369-1-linmq006@gmail.com
2022-03-23 14:51:50 +00:00
Andy Shevchenko 5a2d27c283 mfd: intel-lpss: Provide an SSP type to the driver
The SPI driver wants to know the exact type of the controller.
Provide this information to it, hence it allows to fix the
Intel Cannon Lake and others in the future.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220301205056.79810-1-andriy.shevchenko@linux.intel.com
2022-03-23 14:51:44 +00:00
Claudiu Beznea 748718bcc0 mfd: atmel-flexcom: Fix compilation warning
Fix "unused variable 'atmel_flexcom_pm_ops' [-Wunused-const-variable]"
compilation warning by using __maybe_unused on PM ops.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20211207111515.814653-1-claudiu.beznea@microchip.com
2022-03-23 14:51:38 +00:00
Linus Torvalds ad9c6ee642 spi: Updates for v5.18
The overwhelming bulk of this pull request is a change from Uwe
 Kleine-König which changes the return type of the remove() function to
 void as part of some wider work he's doing to do this for all bus types,
 causing updates to most SPI device drivers.  The branch with that on has
 been cross merged with a couple of other trees which added new SPI
 drivers this cycle, I'm not expecting any build issues resulting from
 the change.
 
 Otherwise it's been a relatively quiet release with some new device
 support, a few minor features and the welcome completion of the
 conversion of the subsystem to use GPIO descriptors rather than numbers:
 
  - Change return type of remove() to void.
  - Completion of the conversion of SPI controller drivers to use GPIO
    descriptors rather than numbers.
  - Quite a few DT schema conversions.
  - Support for multiple SPI devices on a bus in ACPI systems.
  - Big overhaul of the PXA2xx SPI driver.
  - Support for AMD AMDI0062, Intel Raptor Lake, Mediatek MT7986 and
    MT8186, nVidia Tegra210 and Tegra234, Renesas RZ/V2L, Tesla FSD and
    Sunplus SP7021.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmI4b+8ACgkQJNaLcl1U
 h9AB+Qf/WhPzDSCdhK1repnSmEpRNs/J6hItmY2H6pTQaWALpfTB0+p1Nb5tAotg
 fHbu6a2AsiiwWt+tDal44GFYhS0CDSOT4hqgLV8msyDDPPJqqr7A2dbu7YrCjTVI
 TgNZNwxW7c2LgqBXR9GV7NPWYoxYxveoYh+L+05MSuSQxSOvPl6LUZiZPnPufQM6
 dCpEh19atrtasFg3rFnslWBd2C3h8hb6YT7vUZs9gxhg3FvSgpYQwzz5SfFgHXK6
 Rg07m8fDTSjf2qo1C4pc/d1Ni1xBe7aHKMtjtR3jJ4q8QqiawfCcvvOep/Iaec1+
 s3qnDthohWMJoF1W6ERf3HiAgNIfhg==
 =4tlR
 -----END PGP SIGNATURE-----

Merge tag 'spi-v5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi

Pull spi updates from Mark Brown:
 "The overwhelming bulk of this pull request is a change from Uwe
  Kleine-König which changes the return type of the remove() function to
  void as part of some wider work he's doing to do this for all bus
  types, causing updates to most SPI device drivers. The branch with
  that on has been cross merged with a couple of other trees which added
  new SPI drivers this cycle, I'm not expecting any build issues
  resulting from the change.

  Otherwise it's been a relatively quiet release with some new device
  support, a few minor features and the welcome completion of the
  conversion of the subsystem to use GPIO descriptors rather than
  numbers:

   - Change return type of remove() to void.

   - Completion of the conversion of SPI controller drivers to use GPIO
     descriptors rather than numbers.

   - Quite a few DT schema conversions.

   - Support for multiple SPI devices on a bus in ACPI systems.

   - Big overhaul of the PXA2xx SPI driver.

   - Support for AMD AMDI0062, Intel Raptor Lake, Mediatek MT7986 and
     MT8186, nVidia Tegra210 and Tegra234, Renesas RZ/V2L, Tesla FSD and
     Sunplus SP7021"

[ And this is obviously where that spi change that snuck into the
  regulator tree _should_ have been :^]

* tag 'spi-v5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: (124 commits)
  spi: fsi: Implement a timeout for polling status
  spi: Fix erroneous sgs value with min_t()
  spi: tegra20: Use of_device_get_match_data()
  spi: mediatek: add ipm design support for MT7986
  spi: Add compatible for MT7986
  spi: sun4i: fix typos in comments
  spi: mediatek: support tick_delay without enhance_timing
  spi: Update clock-names property for arm pl022
  spi: rockchip-sfc: fix platform_get_irq.cocci warning
  spi: s3c64xx: Add spi port configuration for Tesla FSD SoC
  spi: dt-bindings: samsung: Add fsd spi compatible
  spi: topcliff-pch: Prevent usage of potentially stale DMA device
  spi: tegra210-quad: combined sequence mode
  spi: tegra210-quad: add acpi support
  spi: npcm-fiu: Fix typo ("npxm")
  spi: Fix Tegra QSPI example
  spi: qup: replace spin_lock_irqsave by spin_lock in hard IRQ
  spi: cadence: fix platform_get_irq.cocci warning
  spi: Update NXP Flexspi maintainer details
  dt-bindings: mfd: maxim,max77802: Convert to dtschema
  ...
2022-03-21 18:33:57 -07:00
Krzysztof Kozlowski 8d73aa0e6b mfd: exynos-lpass: Drop unneeded syscon.h include
syscon regmap is not used since commit addebf1588 ("mfd: exynos-lpass:
Remove pad retention control").

Fixes: addebf1588 ("mfd: exynos-lpass: Remove pad retention control")
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220202151310.285561-3-krzysztof.kozlowski@canonical.com
2022-03-08 09:44:06 +00:00
Jarkko Nikula 8c70bd5802 mfd: intel-lpss: Add Intel Raptor Lake PCH-S PCI IDs
Add Intel Raptor Lake PCH-S LPSS PCI IDs.

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>
Link: https://lore.kernel.org/r/20220211145055.992179-1-jarkko.nikula@linux.intel.com
2022-03-08 09:44:06 +00:00
Linus Walleij 3d4d126659 mfd: ab8500: Drop debugfs module
This debugfs isn't used by anyone, if we want to dump the contents
of registers we should just convert the driver to regmap instead.
I'm also excluding this from the device tree bindings when converting
to YAML because it is not a real device, and device trees should
only contain real physical devices.

Delete it.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220212214724.681530-1-linus.walleij@linaro.org
2022-03-08 09:44:06 +00:00
Julia Lawall 6ceb5f173f mfd: sta2x11: Use GFP_KERNEL instead of GFP_ATOMIC
pci_driver probe functions aren't called with locks held and
thus don't need GFP_ATOMIC. Use GFP_KERNEL instead.

Problem found with Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220210204223.104181-10-Julia.Lawall@inria.fr
2022-03-08 09:44:05 +00:00
Uwe Kleine-König c788f6e6aa mfd: stmfx: Improve error message triggered by regulator fault in .remove()
Returning a non-zero value in an i2c remove callback results in the i2c
core emitting a very generic error message ("remove failed (-ESOMETHING),
will be ignored") and as the message indicates not further error handling
is done.

Instead emit a more specific error message and then return zero in
.remove().

The long-term goal is to make the i2c remove prototype return void, making
all implementations return 0 is preparatory work for this change.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220214150710.312269-1-u.kleine-koenig@pengutronix.de
2022-03-08 09:44:05 +00:00
Peter Geis 56f216d8ef mfd: rk808: Add reboot support to rk808.c
This adds reboot support to the rk808 pmic driver and enables it for
the rk809 and rk817 devices.
This only enables if the rockchip,system-power-controller flag is set.

Signed-off-by: Peter Geis <pgwipeout@gmail.com>
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220208194023.929720-1-pgwipeout@gmail.com
2022-03-08 09:44:05 +00:00
Charles Keepax 10377bb293 mfd: arizona: Add missing statics to the of_match_tables
When the match tables were split for I2C and SPI a static should have
been added since the tables are no longer exported.

Fixes: 3f65555c41 ("mfd: arizona: Split of_match table into I2C and SPI versions")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220104165435.26782-1-ckeepax@opensource.cirrus.com
2022-03-08 09:44:05 +00:00
Hans de Goede f49f43371b mfd: intel_soc_pmic_crc: Set main IRQ domain bus token to DOMAIN_BUS_NEXUS
For the CRC PMIC we end up with multiple IRQ domains with the same fwnode.
One for the irqchip which demultiplexes the actual PMIC interrupt into
interrupts for the various cells (known as the level 1 interrupts);

And 2 more for the irqchips which are part of the crystal_cove_gpio
and crystal_cove_charger cells.

This leads to the following error being printed when
CONFIG_GENERIC_IRQ_DEBUGFS is enabled:
 debugfs: File '\_SB.I2C7.PMIC' in directory 'domains' already present!

Set the bus token of the main IRQ domain to DOMAIN_BUS_NEXUS to avoid
this error, this also allows irq_find_matching_fwspec() to find the
right domain if necessary.

Note all 3 domain registering drivers need to set the IRQ domain bus token.
This is necessary because the IRQ domain code defaults to creating
the debugfs dir with just the fwnode name and then renames it when
the bus token is set. So each one starts with the same default name and
all 3 must be given a different name to avoid problems when one of the
other drivers loads and starts with the same default name.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20211225115509.94891-4-hdegoede@redhat.com
2022-03-08 09:44:04 +00:00
Hans de Goede 50904e9bd6 mfd: intel_soc_pmic_crc: Add crystal_cove_charger cell to BYT cells
The Crystal Cove PMIC has a pin which can be used to connect the IRQ of
an external charger IC. On some boards this is used and we need to have
a cell for this, with a driver which creates its own irqchip with
a single IRQ for the charger driver to consume.

The charger driver cannot directly consume the IRQ from the MFD level
irqchip because the PMIC has 2 levels of interrupts and the second
level interrupt status register, which is handled by the cell drivers,
needs to have the IRQ acked to avoid an IRQ storm.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20211225115509.94891-3-hdegoede@redhat.com
2022-03-08 09:44:04 +00:00
Hans de Goede 4946d58dbb mfd: intel_soc_pmic_crc: Sort cells by IRQ order
The cells for the Crystal Cove PMIC are already mostly sorted by
function / IRQ order. Move the ADC cell so that they are fully sorted.

Also move some of the resource definitions so that their order matches
the (new) order of the cells.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20211225115509.94891-2-hdegoede@redhat.com
2022-03-08 09:44:04 +00:00
Lee Jones afb67df31a Merge branches 'ib-mfd-hwmon-regulator-5.18', 'ib-mfd-iio-5.18', 'ib-mfd-led-power-regulator-5.18', 'ib-mfd-mediatek-mt6366-5.18', 'ib-mfd-rtc-watchdog-5.18' and 'ib-mfd-spi-dt-5.18' into ibs-for-mfd-merged 2022-03-08 09:42:41 +00:00
Johnson Wang c47383f849 mfd: Add support for the MediaTek MT6366 PMIC
This adds support for the MediaTek MT6366 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.
MT6366 MFD is a child device of the pwrap.

Signed-off-by: Johnson Wang <johnson.wang@mediatek.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220106065407.16036-2-johnson.wang@mediatek.com
2022-03-07 14:59:44 +00:00
Jiasheng Jiang e477e51a41 mfd: mc13xxx: Add check for mc13xxx_irq_request
As the potential failure of the devm_request_threaded_irq(),
it should be better to check the return value of the
mc13xxx_irq_request() and return error if fails.

Fixes: 8e00593557 ("mfd: Add mc13892 support to mc13xxx")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220224022331.3208275-1-jiasheng@iscas.ac.cn
2022-03-07 14:00:27 +00:00
Luca Ceresoli 60b050ff3a mfd: max77714: Add driver for Maxim MAX77714 PMIC
Add a simple driver for the Maxim MAX77714 PMIC, supporting RTC and
watchdog only.

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2022-03-07 13:54:44 +00:00
Luca Ceresoli a26d84633c rtc: max77686: Rename day-of-month defines
RTC_DATE and REG_RTC_DATE are used for the registers holding the day of
month. Rename these constants to mean what they mean.

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2022-03-07 13:54:24 +00:00
Sebastian Andrzej Siewior 83d9b7e395 mfd: ezx-pcap: Use generic_handle_irq_safe().
Instead of manually disabling interrupts before invoking use
generic_handle_irq_safe() which can be invoked with enabled and disabled
interrupts.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220211181500.1856198-6-bigeasy@linutronix.de
2022-03-02 22:28:50 +01:00
Mark Brown 0177212e27
mtd: spi-nor / spi / MFD: Convert intel-spi to SPI MEM
Merge series from Mika Westerberg <mika.westerberg@linux.intel.com>:

Based on discussion on the patch I sent some time ago here:

  http://lists.infradead.org/pipermail/linux-mtd/2021-June/086867.html

it turns out that the preferred way to deal with the SPI flash controller
drivers is through SPI MEM which is part of Linux SPI subsystem.

This series does that for the intel-spi driver. This also renames the
driver to follow the convention used in the SPI subsystem. The first patch
improves the write protection handling to be slightly more safer. The
following two patches do the conversion itself. Note the Intel SPI flash
controller only allows commands such as read, write and so on and it
internally uses whatever addressing etc. it figured from the SFDP on the
flash device.

base-commit: e783362eb5
2022-02-15 12:53:31 +00:00
Jeff LaBundy 1de785a580 mfd: iqs62x: Provide device revision to sub-devices
Individual sub-devices may elect to make decisions based on the
specific revision of silicon encountered at probe. This data is
already read from the device, but is not retained.

Pass this data on to the sub-devices by adding the software and
hardware numbers (registers 0x01 and 0x02, respectively) to the
iqs62x_core struct.

Signed-off-by: Jeff LaBundy <jeff@labundy.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2022-02-14 13:07:22 +00:00
Mika Westerberg cd149eff8d
mtd: spi-nor: intel-spi: Disable write protection only if asked
Currently the driver tries to disable the BIOS write protection
automatically even if this is not what the user wants. For this reason
modify the driver so that by default it does not touch the write
protection. Only if specifically asked by the user (setting writeable=1
command line parameter) the driver tries to disable the BIOS write
protection.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Mauro Lima <mauro.lima@eclypsium.com>
Reviewed-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220209122706.42439-2-mika.westerberg@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-02-14 12:53:08 +00:00
Uwe Kleine-König a0386bba70
spi: make remove callback a void function
The value returned by an spi 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.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: Claudius Heine <ch@denx.de>
Acked-by: Stefan Schmidt <stefan@datenfreihafen.org>
Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org> # For MMC
Acked-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Acked-by: Łukasz Stelmach <l.stelmach@samsung.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220123175201.34839-6-u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-02-09 13:00:45 +00:00
Alistair Francis 5913eb45d0 mfd: simple-mfd-i2c: Enable support for the silergy,sy7636a
Signed-off-by: Alistair Francis <alistair@alistair23.me>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2022-02-08 09:27:22 +00:00
Alistair Francis bae5a4acef mfd: simple-mfd-i2c: Add a Kconfig name
Add a Kconfig name to the "Simple Multi-Functional Device support (I2C)"
device so that it can be enabled via menuconfig.

Signed-off-by: Alistair Francis <alistair@alistair23.me>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2022-02-08 09:27:15 +00:00
Hans de Goede 3afcbe0947 mfd: intel_soc_pmic_chtwc: Add cht_wc_model data to struct intel_soc_pmic
Tablet / laptop designs using an Intel Cherry Trail x86 main SoC with
an Intel Whiskey Cove PMIC do not use a single standard setup for
the charger, fuel-gauge and other chips surrounding the PMIC /
charging+data USB port.

Unlike what is normal on x86 this diversity in designs is not handled
by the ACPI tables. On 2 of the 3 known designs there are no standard
(PNP0C0A) ACPI battery devices and on the 3th design the ACPI battery
device does not work under Linux due to it requiring non-standard
and undocumented ACPI behavior.

So to make things work under Linux we use native charger and fuel-gauge
drivers on these devices, re-using the native drivers used on ARM boards
with the same charger / fuel-gauge ICs.

This requires various MFD-cell drivers for the CHT-WC PMIC cells to
know which model they are exactly running on so that they can e.g.
instantiate an I2C-client for the right model charger-IC (the charger
is connected to an I2C-controller which is part of the PMIC).

Rather then duplicating DMI-id matching to check which model we are
running on in each MFD-cell driver, add a check for this to the
shared drivers/mfd/intel_soc_pmic_chtwc.c code by using a
DMI table for all 3 known models:

1. The GPD Win and GPD Pocket mini-laptops, these are really 2 models
but the Pocket re-uses the GPD Win's design in a different housing:

The WC PMIC is connected to a TI BQ24292i charger, paired with
a Maxim MAX17047 fuelgauge + a FUSB302 USB Type-C Controller +
a PI3USB30532 USB switch, for a fully functional Type-C port.

2. The Xiaomi Mi Pad 2:

The WC PMIC is connected to a TI BQ25890 charger, paired with
a TI BQ27520 fuelgauge, using the TI BQ25890 for BC1.2 charger type
detection, for a USB-2 only Type-C port without PD.

3. The Lenovo Yoga Book YB1-X90 / Lenovo Yoga Book YB1-X91 series:

The WC PMIC is connected to a TI BQ25892 charger, paired with
a TI BQ27542 fuelgauge, using the WC PMIC for BC1.2 charger type
detection and using the BQ25892's Mediatek Pump Express+ (1.0)
support to enable charging with up to 12V through a micro-USB port.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2022-02-01 14:55:12 +01:00
Linus Torvalds 6dc69d3d0d driver core changes for 5.17-rc1
Here is the set of changes for the driver core for 5.17-rc1.
 
 Lots of little things here, including:
 	- kobj_type cleanups
 	- auxiliary_bus documentation updates
 	- auxiliary_device conversions for some drivers (relevant
 	  subsystems all have provided acks for these)
 	- kernfs lock contention reduction for some workloads
 	- other tiny cleanups and changes.
 
 All of these have been in linux-next for a while with no reported
 issues.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCYd7deA8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+ym8ngCgw0ANwrRPE5b1dthEmfU2f8Knk5kAn0pHQv6R
 VRZJypgNfU/Pt0ykstZD
 =CO9J
 -----END PGP SIGNATURE-----

Merge tag 'driver-core-5.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core

Pull driver core updates from Greg KH:
 "Here is the set of changes for the driver core for 5.17-rc1.

  Lots of little things here, including:

   - kobj_type cleanups

   - auxiliary_bus documentation updates

   - auxiliary_device conversions for some drivers (relevant subsystems
     all have provided acks for these)

   - kernfs lock contention reduction for some workloads

   - other tiny cleanups and changes.

  All of these have been in linux-next for a while with no reported
  issues"

* tag 'driver-core-5.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (43 commits)
  kobject documentation: remove default_attrs information
  drivers/firmware: Add missing platform_device_put() in sysfb_create_simplefb
  debugfs: lockdown: Allow reading debugfs files that are not world readable
  driver core: Make bus notifiers in right order in really_probe()
  driver core: Move driver_sysfs_remove() after driver_sysfs_add()
  firmware: edd: remove empty default_attrs array
  firmware: dmi-sysfs: use default_groups in kobj_type
  qemu_fw_cfg: use default_groups in kobj_type
  firmware: memmap: use default_groups in kobj_type
  sh: sq: use default_groups in kobj_type
  headers/uninline: Uninline single-use function: kobject_has_children()
  devtmpfs: mount with noexec and nosuid
  driver core: Simplify async probe test code by using ktime_ms_delta()
  nilfs2: use default_groups in kobj_type
  kobject: remove kset from struct kset_uevent_ops callbacks
  driver core: make kobj_type constant.
  driver core: platform: document registration-failure requirement
  vdpa/mlx5: Use auxiliary_device driver data helpers
  net/mlx5e: Use auxiliary_device driver data helpers
  soundwire: intel: Use auxiliary_device driver data helpers
  ...
2022-01-12 11:11:34 -08:00
Dmitry Osipenko 7620ad0bdf mfd: tps65910: Set PWR_OFF bit during driver probe
The PWR_OFF bit needs to be set in order to power off properly, without
hanging PMIC. This bit needs to be set early in order to allow thermal
protection of NVIDIA Terga SoCs to power off hardware properly, otherwise
a battery re-plug may be needed on some devices to recover after the hang.

Cc: <stable@vger.kernel.org>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Tested-by: Svyatoslav Ryhel <clamor95@gmail.com> # ASUS TF201
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20211124190104.23554-1-digetx@gmail.com
2021-12-29 13:36:16 +00:00
Hans de Goede 5b78223f55 mfd: intel_soc_pmic: Use CPU-id check instead of _HRV check to differentiate variants
The Intel Crystal Cove PMIC has 2 different variants, one for use with
Bay Trail (BYT) SoCs and one for use with Cherry Trail (CHT) SoCs.

So far we have been using an ACPI _HRV check to differentiate between
the 2, but at least on the Microsoft Surface 3, which is a CHT device,
the wrong _HRV value is reported by ACPI.

So instead switch to a CPU-ID check which prevents us from relying on
the possibly wrong ACPI _HRV value.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reported-by: Tsuchiya Yuto <kitakar@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20211206174806.197772-2-hdegoede@redhat.com
2021-12-29 13:32:08 +00:00
Hans de Goede e6b142060b mfd: intel-lpss: Fix I2C4 not being available on the Microsoft Surface Go & Go 2
Many DSDTs for Kaby Lake and Kaby Lake Refresh models contain a
_SB.PCI0.GEXP ACPI Device node describing an I2C attached PCA953x
GPIO expander.

This seems to be something which is copy and pasted from the DSDT
from some reference design since this ACPI Device is present even on
models where no such GPIO expander is used at all, such as on the
Microsoft Surface Go & Go 2.

This ACPI Device is a problem because it contains a SystemMemory
OperationRegion which covers the MMIO for the I2C4 I2C controller. This
causes the MFD cell for the I2C4 controller to not be instantiated due
to a resource conflict, requiring the use of acpi_enforce_resources=lax
to work around this.

I have done an extensive analysis of all the ACPI tables on the
Microsoft Surface Go and the _SB.PCI0.GEXP ACPI Device's methods are
not used by any code in the ACPI tables, neither are any of them
directly called by any Linux kernel code. This is unsurprising since
running i2cdetect on the I2C4 bus shows that there is no GPIO
expander chip present on these devices at all.

This commit adds a PCI subsystem vendor:device table listing PCI devices
where it is known to be safe to ignore resource conflicts with ACPI
declared SystemMemory regions.

This makes the I2C4 bus work out of the box on the Microsoft Surface
Go & Go 2, which is necessary for the cameras on these devices to work.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20211203115108.89661-1-hdegoede@redhat.com
2021-12-29 13:17:01 +00:00
David E. Box a3c8f906ed platform/x86/intel: Move intel_pmt from MFD to Auxiliary Bus
Intel Platform Monitoring Technology (PMT) support is indicated by presence
of an Intel defined PCIe Designated Vendor Specific Extended Capabilities
(DVSEC) structure with a PMT specific ID. The current MFD implementation
creates child devices for each PMT feature, currently telemetry, watcher,
and crashlog. However DVSEC structures may also be used by Intel to
indicate support for other features. The Out Of Band Management Services
Module (OOBMSM) uses DVSEC to enumerate several features, including PMT.
In order to support them it is necessary to modify the intel_pmt driver to
handle the creation of the child devices more generically. To that end,
modify the driver to create child devices for any VSEC/DVSEC features on
supported devices (indicated by PCI ID).  Additionally, move the
implementation from MFD to the Auxiliary bus.  VSEC/DVSEC features are
really multifunctional PCI devices, not platform devices as MFD was
designed for. Auxiliary bus gives more flexibility by allowing the
definition of custom structures that can be shared between associated
auxiliary devices and the parent device. Also, rename the driver from
intel_pmt to intel_vsec to better reflect the purpose.

This series also removes the current runtime pm support which was not
complete to begin with. None of the current devices require runtime pm.
However the support will be replaced when a device is added that requires
it.

Reviewed-by: Mark Gross <markgross@kernel.org>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: David E. Box <david.e.box@linux.intel.com>
Link: https://lore.kernel.org/r/20211208015015.891275-4-david.e.box@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-12-22 13:56:19 +01:00
Mauro Carvalho Chehab 54d4c88b37 mfd: Kconfig: Change INTEL_SOC_PMIC_CHTDC_TI to bool
The INTEL_SOC_PMIC_CHTDC_TI should be initialized early, before
loading the fbcon driver, as otherwise the i915 driver will
fail to configure pwm:

[   13.674287] fb0: switching to inteldrmfb from EFI VGA
[   13.682380] Console: switching to colour dummy device 80x25
[   13.682468] i915 0000:00:02.0: vgaarb: deactivate vga console
[   13.682686] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[   13.685773] i915 0000:00:02.0: vgaarb: changed VGA decodes: olddecodes=io+mem,decodes=io+mem:owns=io+mem
[   13.686219] i915 0000:00:02.0: [drm] *ERROR* Failed to configure the pwm chip
[   13.699572] [drm] Initialized i915 1.6.0 20200313 for 0000:00:02.0 on minor 0
[   13.739044] fbcon: i915drmfb (fb0) is primary device
[   14.037792] intel_soc_pmic_exec_mipi_pmic_seq_element: No PMIC registered
...
[   24.621403] intel_pmic_install_opregion_handler: Ask to register OpRegion for bus ID=PMI2, HID=INT33F5
[   24.630540] intel_pmic_install_opregion_handler: OpRegion registered

(some extra debug printk's were added to the above)

As suggested by Hans, this patch also addresses an issue with
the dependencies, as, for this driver to be a bool, it also
need the I2C core and the I2C_DESIGNWARE driver to be builtin.

Suggested-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/86f546b3233fd799b0c39b83afc521440ebfe004.1638192232.git.mchehab+huawei@kernel.org
2021-11-29 15:12:46 +00:00
Andrej Picej 5c6f0f4563 mfd: da9062: Support SMBus and I2C mode
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-11-29 13:17:00 +00:00
Orlando Chamberlain 9651cf2cb1 mfd: intel-lpss-pci: Fix clock speed for 38a8 UART
This device is found in the MacBookPro16,2, and as the MacBookPro16,1 is
from the same generation of MacBooks and has a UART with bxt_uart_info,
it was incorrectly assumed that the MacBookPro16,2's UART would have the
same info.

This led to the wrong clock speed being used, and the Bluetooth
controller exposed by the UART receiving and sending random data, which
was incorrectly assumed to be an issue with the Bluetooth stuff, not an
error with the UART side of things.

Changing the info to spt_uart_info changes the clock speed and makes it
send and receive data correctly.

Fixes: ddb1ada416 ("mfd: intel-lpss: Add support for MacBookPro16,2 ICL-N UART")
Signed-off-by: Orlando Chamberlain <redecorating@protonmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20211124091846.11114-1-redecorating@protonmail.com
2021-11-29 13:17:00 +00:00
Andy Shevchenko c9e143084d mfd: intel-lpss: Fix too early PM enablement in the ACPI ->probe()
The runtime PM callback may be called as soon as the runtime PM facility
is enabled and activated. It means that ->suspend() may be called before
we finish probing the device in the ACPI case. Hence, NULL pointer
dereference:

  intel-lpss INT34BA:00: IRQ index 0 not found
  BUG: kernel NULL pointer dereference, address: 0000000000000030
  ...
  Workqueue: pm pm_runtime_work
  RIP: 0010:intel_lpss_suspend+0xb/0x40 [intel_lpss]

To fix this, first try to register the device and only after that enable
runtime PM facility.

Fixes: 4b45efe852 ("mfd: Add support for Intel Sunrisepoint LPSS devices")
Reported-by: Orlando Chamberlain <redecorating@protonmail.com>
Reported-by: Aditya Garg <gargaditya08@live.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Aditya Garg <gargaditya08@live.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20211101190008.86473-1-andriy.shevchenko@linux.intel.com
2021-11-29 13:17:00 +00:00
Oleksandr Suvorov 786c6f140b mfd: stmpe: Support disabling sub-functions
Add support of sub-functions disabling. It allows one to define
an stmpe sub-function device in devicetree, but keep it disabled.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20211027082155.206449-1-francesco.dolcini@toradex.com
2021-11-29 13:17:00 +00:00
Claudiu Beznea 5d051cf94f mfd: atmel-flexcom: Use .resume_noirq
Flexcom IP embeds 3 other IPs: usart, i2c, spi and selects the operation
mode (usart, i2c, spi) via mode register (FLEX_MR). On i2c bus there might
be connected critical devices (like PMIC) which on suspend/resume should
be suspended/resumed at the end/beginning. i2c uses
.suspend_noirq/.resume_noirq for this kind of purposes. Align flexcom
to use .resume_noirq as it should be resumed before the embedded IPs.
Otherwise the embedded devices might behave badly.

Fixes: 7fdec11015 ("atmel_flexcom: Support resuming after a chip reset")
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Tested-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20211028135138.3481166-3-claudiu.beznea@microchip.com
2021-11-29 13:16:59 +00:00