History log of /linux-master/drivers/mfd/max14577.c
Revision Date Author Comments
# 0db434f5 17-Oct-2023 Rob Herring <robh@kernel.org>

mfd: Use i2c_get_match_data() in a selection of drivers

Use preferred i2c_get_match_data() instead of of_match_device() and
i2c driver_data to get the driver match data. With this, adjust the
includes to explicitly include the correct headers.

Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Link: https://lore.kernel.org/r/20231017203603.2700864-1-robh@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>


# 0f28379e 10-Aug-2023 Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

mfd: max14577: Fix Wvoid-pointer-to-enum-cast warning

'dev_type' is an enum, thus cast of pointer on 64-bit compile test with
W=1 causes:

max14577.c:406:5: error: cast to smaller integer type 'enum maxim_device_type' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Link: https://lore.kernel.org/r/20230810095849.123321-2-krzysztof.kozlowski@linaro.org
Signed-off-by: Lee Jones <lee@kernel.org>


# 9816d859 15-May-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

mfd: Switch i2c drivers back to use .probe()

After commit b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new()
call-back type"), all drivers being converted to .probe_new() and then
03c835f498b5 ("i2c: Switch .probe() to not take an id parameter") convert
back to (the new) .probe() to be able to eventually drop .probe_new() from
struct i2c_driver.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20230515182752.10050-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Lee Jones <lee@kernel.org>


# 911b8b42 12-Nov-2022 Aidan MacDonald <aidanmacdonald.0x0@gmail.com>

mfd: max14577: Replace irqchip mask_invert with unmask_base

Remove use of the deprecated mask_invert flag. Inverted mask
registers (where a '1' bit enables an IRQ) can be described more
directly as an unmask register.

Signed-off-by: Aidan MacDonald <aidanmacdonald.0x0@gmail.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20221112151835.39059-6-aidanmacdonald.0x0@gmail.com


# 8a8d0485 23-Oct-2022 Paul Cercueil <paul@crapouillou.net>

mfd: max14577: Remove #ifdef guards for PM related functions

Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros
to handle the .suspend/.resume callbacks.

These macros allow the suspend and resume functions to be automatically
dropped by the compiler when CONFIG_SUSPEND is disabled, without having
to use #ifdef guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Lee Jones <lee@kernel.org>


# 8df21471 18-Nov-2022 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

mfd: max14577: Convert to i2c's .probe_new()

.probe_new() doesn't get the i2c_device_id * parameter, so determine
that explicitly in the probe function.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20221118224540.619276-439-uwe@kleine-koenig.org


# ed5c2f5f 15-Aug-2022 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

i2c: Make remove callback return void

The value returned by an i2c driver's remove function is mostly ignored.
(Only an error message is printed if the value is non-zero that the
error is ignored.)

So change the prototype of the remove function to return no value. This
way driver authors are not tempted to assume that passing an error to
the upper layer is a good idea. All drivers are adapted accordingly.
There is no intended change of behaviour, all callbacks were prepared to
return 0 before.

Reviewed-by: Peter Senna Tschudin <peter.senna@gmail.com>
Reviewed-by: Jeremy Kerr <jk@codeconstruct.com.au>
Reviewed-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Crt Mori <cmo@melexis.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Marek Behún <kabel@kernel.org> # for leds-turris-omnia
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Petr Machata <petrm@nvidia.com> # for mlxsw
Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com> # for surface3_power
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> # for bmc150-accel-i2c + kxcjk-1013
Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> # for media/* + staging/media/*
Acked-by: Miguel Ojeda <ojeda@kernel.org> # for auxdisplay/ht16k33 + auxdisplay/lcd2s
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> # for versaclock5
Reviewed-by: Ajay Gupta <ajayg@nvidia.com> # for ucsi_ccg
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> # for iio
Acked-by: Peter Rosin <peda@axentia.se> # for i2c-mux-*, max9860
Acked-by: Adrien Grassein <adrien.grassein@gmail.com> # for lontium-lt8912b
Reviewed-by: Jean Delvare <jdelvare@suse.de> # for hwmon, i2c-core and i2c/muxes
Acked-by: Corey Minyard <cminyard@mvista.com> # for IPMI
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com> # for drivers/power
Acked-by: Krzysztof Hałasa <khalasa@piap.pl>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Wolfram Sang <wsa@kernel.org>


# 8163fbd9 02-Jun-2021 Krzysztof Kozlowski <krzk@kernel.org>

mfd: max14577: Do not enforce (incorrect) interrupt trigger type

Interrupt line can be configured on different hardware in different way,
even inverted. Therefore driver should not enforce specific trigger
type - edge falling - but instead rely on Devicetree to configure it.

The Maxim 14577/77836 datasheets describe the interrupt line as active
low with a requirement of acknowledge from the CPU therefore the edge
falling is not correct.

The interrupt line is shared between PMIC and charger driver, so using
level sensitive interrupt is here especially important to avoid races.
With an edge configuration in case if first PMIC signals interrupt
followed shortly after by the RTC, the interrupt might not be yet
cleared/acked thus the second one would not be noticed.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20210602110445.33536-4-krzysztof.kozlowski@canonical.com


# 1f0fa85c 23-Jul-2020 Colin Ian King <colin.king@canonical.com>

mfd: max14577: Remove redundant initialization of variable current_bits

The variable current_bits is being initialized with a value that is
never read and it is being updated later with a new value. The
initialization is redundant and can be removed.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# f6ae8129 22-Jul-2019 Wolfram Sang <wsa+renesas@sang-engineering.com>

mfd: max14577: Convert to i2c_new_dummy_device

Move from i2c_new_dummy() to i2c_new_dummy_device(), so we now get an
ERRPTR which we use in error handling.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# d7d8d7a2 07-Aug-2018 Krzysztof Kozlowski <krzk@kernel.org>

mfd: maxim: Add SPDX license identifiers

Replace GPL v2.0+ license statements with SPDX license identifiers.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# 8c5d0571 17-Aug-2016 Krzysztof Kozlowski <krzk@kernel.org>

mfd: max14577: Change Krzysztof Kozlowski's email to kernel.org

Change my email address to kernel.org instead of Samsung one for the
purpose of any future contact. The copyrights remain untouched and are
attributed to Samsung.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# 9961bf18 25-May-2016 Javier Martinez Canillas <javier@osg.samsung.com>

mfd: max14577: Use module_init() instead of subsys_initcall()

The driver's init function is called at subsys init call level but the
dependencies provided by the driver are looked up by drivers that have
probe deferral support, so manual ordering of init calls isn't needed.

Suggested-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# 1b5420e1 28-Dec-2015 Geliang Tang <geliangtang@163.com>

mfd: Use to_i2c_client() instead of open-coding it

Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# 0e777366 09-Jul-2015 Krzysztof Kozlowski <krzk@kernel.org>

mfd: Drop owner assignment from i2c_drivers

i2c_driver does not need to set an owner because i2c_register_driver()
will set it.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# 2c20f6de 12-Nov-2014 Krzysztof Kozlowski <krzk@kernel.org>

mfd: max14577: Fix obvious typo in company name in copyright

Fix a typo in name of company in copyright comment.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# be69e9e0 04-Sep-2014 Krzysztof Kozlowski <krzk@kernel.org>

mfd: max14577: Don't pass IRQ domain to mfd_add_devices

The max14577 MFD cells do not have any resources so the IRQ domain
passed to mfd_add_devices is not used.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# b8f139f6 12-Sep-2014 Krzysztof Kozlowski <krzk@kernel.org>

regulator/mfd: max14577: Export symbols for calculating charger current

This patch prepares for changing the max14577 charger driver to allow
configuring battery-dependent settings from DTS.

The patch moves from regulator driver to MFD core driver and exports:
- function for calculating register value for charger's current;
- table of limits for chargers (MAX14577, MAX77836).

Previously they were used only by the max14577 regulator driver. In next
patch the charger driver will use them as well. Exporting them will
reduce unnecessary code duplication.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: Mark Brown <broonie@linaro.org>
Acked-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# 4476767c 12-Sep-2014 Krzysztof Kozlowski <krzk@kernel.org>

mfd: max14577: Map charger device to its own of_node

Add a "maxim,max14577-charger" of_compatible to the mfd_cell so the
MFD child device (the charger) will have its own of_node set. This will
be used by the max14577 charger driver in next patches to obtain battery
configuration from DTS.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# fab8445c 20-May-2014 Lee Jones <lee.jones@linaro.org>

mfd: max14577: Cast to architecture agnostic data type

drivers/mfd/max14577.c:334:25:
warning: cast from pointer to integer of different size
max14577->dev_type = (unsigned int)of_id->data;
^
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# 92725493 12-May-2014 Krzysztof Kozlowski <krzk@kernel.org>

mfd: max14577: Make mfd_cell array const

mfd_add_devices() expects array of struct mfd_cell to be const.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# 8f7f6270 12-May-2014 Krzysztof Kozlowski <krzk@kernel.org>

mfd: max14577: Make of_device_id array const

Array of struct of_device_id should be const as expected by both
of_match_table field and of_match_device() call.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# c4f725b5 22-Apr-2014 Krzysztof Kozlowski <krzk@kernel.org>

mfd: max14577: Fix IRQ handling after resume if this is not a wakeup source

During suspend the IRQ should be disabled even if this is not a wakeup
source. This is a proper way of fixing the IRQ handling issue during
resume (IRQ handler fails because I2C bus did not resume yet).

When device is suspended and max14577 interrupt is signaled the irq chip
will try to handle it regardless of wakeup source. Device could be woken
up by different IRQ but still the IRQ handler will try to read the
registers over I2C bus and fail because I2C bus won't be ready yet:
max14577 2-0025: Failed to read IRQ status: -5

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# 4706a525 14-Apr-2014 Krzysztof Kozlowski <krzk@kernel.org>

extcon: max14577: Add support for MAX77836

Add support for MAX77836 chipset to the max14577 extcon driver. The
MAX77836 MUIC has additional interrupts (VIDRM, ADC1K) so IRQ handling
is split up into two functions: max14577_parse_irq() and
max77836_parse_irq().

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# aee2a57c 14-Apr-2014 Krzysztof Kozlowski <krzk@kernel.org>

mfd: max77836: Add MAX77836 support to max14577 driver

Add Maxim 77836 support to max14577 driver. The chipsets have same MUIC
component so the extcon, charger and regulators are almost the same. The
MAX77836 however has also PMIC and Fuel Gauge.

The MAX77836 uses three I2C slave addresses and has additional interrupts
(related to PMIC and Fuel Gauge). It has also Interrupt Source register,
just like MAX77686 and MAX77693.

The MAX77836 PMIC's TOPSYS and INTSRC interrupts are reported in the
PMIC block. The PMIC block has different I2C slave address and uses own
regmap so another regmap_irq_chip is needed.

Since we have two regmap_irq_chip, use shared interrupts on MAX77836.

This patch adds additional defines and functions to the max14577 MFD core
driver so the driver will handle both chipsets. Also this patch replaces
"0x1 << N" with BIT(N) in defines for register masks.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# c7846852 14-Apr-2014 Krzysztof Kozlowski <krzk@kernel.org>

mfd: max14577: Add MAX14577 prefix to IRQ defines

This patch prepares for adding support for MAX77836 device to existing
max14577 driver by adding MAX14577 prefix to defines of interrupts.

This is only a rename-like patch, new code is not added.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# eccb80cc 14-Apr-2014 Krzysztof Kozlowski <krzk@kernel.org>

mfd: max14577: Add detection of device type

This patch continues the preparation for adding support for MAX77836
device to existing max14577 driver.

Add enum for types of devices supported by this driver. The device type
will be detected by matching of_device_id, or i2c_device_id as a
fallback.

The patch also moves to separate function the code related to displaying
DeviceID register values.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# 575343d1 14-Apr-2014 Krzysztof Kozlowski <krzk@kernel.org>

mfd: max14577: Add muic prefix to regmap config

Add muic prefix to regmap config to differentiate between another regmap
config for MAX77836 PMIC node. Additionally remove unused
symbols: MAX14577_REG_INVALID and max14577_irq_source.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# c8016d45 12-Feb-2014 Sachin Kamat <sachin.kamat@linaro.org>

mfd: max14577: Include missing err.h

Add this header explicitly for IS_ERR and friends.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# a0b0ea49 28-Jan-2014 Krzysztof Kozlowski <krzk@kernel.org>

mfd: max14577: Add of_compatible to extcon mfd_cell

Add of_compatible ("maxim,max14577-muic") to the mfd_cell for extcon
driver. If entry with such compatible is present in the DTS, the extcon
driver will have of_node set.

This may be useful for extcon consumers and it is documented in
bindings documentation.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# 3edeb1e4 26-Jan-2014 Geert Uytterhoeven <geert@linux-m68k.org>

mfd: max14577: max14577_{suspend,resume}() should depend on CONFIG_PM_SLEEP

If CONFIG_PM_SLEEP=n:

drivers/mfd/max14577.c:177: warning: ‘max14577_suspend’ defined but not used
drivers/mfd/max14577.c:200: warning: ‘max14577_resume’ defined but not used

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# ae679c12 21-Dec-2013 Sachin Kamat <sachin.kamat@linaro.org>

mfd: max14577: Remove redundant of_match_ptr helper

'max14577_dt_match' is always compiled in. Hence the helper macro
is not needed.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# aab5dc68 04-Dec-2013 Dan Carpenter <dan.carpenter@oracle.com>

mfd: max14577: Cleanup an error message

"pdata" is a NULL not an ERR_PTR so there is no use printing it.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# 41096801 27-Nov-2013 Krzysztof Kozlowski <krzk@kernel.org>

mfd: max14577: Match regulator by of_compatible string

Match max14577 regulator driver by of_compatible specified in mfd_cell.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# 3008ddbe 22-Nov-2013 Chanwoo Choi <cw00.choi@samsung.com>

mfd: max14577: Add max14577 MFD driver core

This patch adds max14577 core/irq driver to support MUIC(Micro USB IC)
device and charger device and support irq domain method to control
internal interrupt of max14577 device. Also, this patch supports DT
binding with max14577_i2c_parse_dt().

The MAXIM 14577 chip contains Micro-USB Interface Circuit and Li+ Battery
Charger. It contains accessory and USB charger detection logic. It supports
USB 2.0 Hi-Speed, UART and stereo audio signals over Micro-USB connector.

The battery charger is compliant with the USB Battery Charging Specification
Revision 1.1. It has also SFOUT LDO output for powering USB devices.

Reviewed-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>