The driver is used only on Exynos based boards with DTS support.
After removal of board file support from max77686 and max77802 regulator
drivers, the MFD driver can be converted to DTS-only version. This
simplifies a little the code:
1. No dead (unused) entries in platform_data structure.
2. More code removed.
3. Regulator driver does not depend on allocated memory
from MFD driver.
4. It makes also easier extending the regulator driver.
Add to the max77686 MFD driver dependency on CONFIG_OF because without
DTS the regulator drivers (max77686 and max77802) won't bind.
Signed-off-by: Krzysztof Kozlowski <[email protected]>
Reviewed-by: Javier Martinez Canillas <[email protected]>
Tested-by: Javier Martinez Canillas <[email protected]>
Signed-off-by: Lee Jones <[email protected]>
The regmap_config struct may be const because it is not modified by the
driver and regmap_init() accepts pointer to const.
Signed-off-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Lee Jones <[email protected]>
As 'reg' is unsigned, it can't be less than 0, so checking if it is
greater than or equal to 0 will always result in a true condition.
Signed-off-by: Lee Jones <[email protected]>
Extinguishes:
../drivers/mfd/max77686.c: In function ‘max77686_i2c_probe’:
../drivers/mfd/max77686.c:254:20:
warning: cast from pointer to integer of different size
Signed-off-by: Lee Jones <[email protected]>
Maxim MAX77802 is a power management chip that contains 10 high
efficiency Buck regulators, 32 Low-dropout (LDO) regulators used
to power up application processors and peripherals, a 2-channel
32kHz clock outputs, a Real-Time-Clock (RTC) and a I2C interface
to program the individual regulators, clocks outputs and the RTC.
This patch adds support for MAX77802 to the MAX77686 driver and is
based on a driver added to the Chrome OS kernel 3.8 by Simon Glass.
Signed-off-by: Javier Martinez Canillas <[email protected]>
Reviewed-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Lee Jones <[email protected]>
This is part of an effort to clean-up the MFD subsystem.
+WARNING: line over 80 characters
+ &max77686_rtc_regmap_config);
total: 0 errors, 1 warnings, 299 lines checked
Signed-off-by: Lee Jones <[email protected]>
There is no need to print out-of-memory errors since this is already
done by the memory management subsystem which even calls dump_stack().
Signed-off-by: Javier Martinez Canillas <[email protected]>
Signed-off-by: Lee Jones <[email protected]>
Error checking across the driver is mostly consistent besides
a few exceptions, so change these exceptions for consistency.
Signed-off-by: Javier Martinez Canillas <[email protected]>
Reviewed-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Lee Jones <[email protected]>
When platform data is not found an -EIO (I/O error) code is returned.
This doesn't seem to be the correct error so better return -EINVAL
(Invalid argument) which is what most drivers do in this case.
Signed-off-by: Javier Martinez Canillas <[email protected]>
Signed-off-by: Lee Jones <[email protected]>
The function max77802_i2c_parse_dt_pdata() should only be called
if there isn't already platform data for the device.
Signed-off-by: Javier Martinez Canillas <[email protected]>
Signed-off-by: Lee Jones <[email protected]>
When the CONFIG_OF option was not enabled, a dummy function
max77686_i2c_parse_dt_pdata() was defined since this is called
unconditionally on probe(). Just always define the real function
and conditionally call it if CONFIG_OF is enabled instead.
Signed-off-by: Javier Martinez Canillas <[email protected]>
Signed-off-by: Lee Jones <[email protected]>
The driver doesn't have PM operations defined so add a suspend
and resume function handlers to allow the PMIC IRQ to wakeup
the system when it is put into a sleep state.
Signed-off-by: Javier Martinez Canillas <[email protected]>
Reviewed-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Lee Jones <[email protected]>
By using the generic IRQ support in the Register map API, it
is possible to get rid max77686-irq.c and simplify the code.
Suggested-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Javier Martinez Canillas <[email protected]>
Reviewed-by: Doug Anderson <[email protected]>
Tested-by: Doug Anderson <[email protected]>
Signed-off-by: Lee Jones <[email protected]>
Array of struct of_device_id may be be const as expected by
of_match_table field.
Signed-off-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Lee Jones <[email protected]>
During probe the driver allocates dummy I2C device for RTC with
i2c_new_dummy() but it does not check the return value of this call.
In case of error (i2c_new_device(): memory allocation failure or I2C
address cannot be used) this function returns NULL which is later used
by i2c_unregister_device().
If i2c_new_dummy() fails for RTC device, fail also the probe for main
MFD driver.
Cc: [email protected]
Signed-off-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Lee Jones <[email protected]>
The regmap used by max77686 MFD driver was not freed with regmap_exit()
on driver exit. This lead to leak of resources.
Replace regmap_init_i2c() call in driver probe with initialization of
managed register map so the regmap will be properly freed by the device
management code.
Cc: [email protected]
Signed-off-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Lee Jones <[email protected]>
As of commit 03e361b25e ("mfd: Stop setting
refcounting pointers in original mfd_cell arrays"), the "cell" parameter of
mfd_add_devices() is "const" again. Hence make all cell data passed to
mfd_add_devices() const where possible.
Signed-off-by: Geert Uytterhoeven <[email protected]>
Signed-off-by: Lee Jones <[email protected]>
'of_match_ptr' is defined in linux/of.h. Include it explicitly to
avoid breakage in the future.
Signed-off-by: Sachin Kamat <[email protected]>
Signed-off-by: Lee Jones <[email protected]>
Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly.
Signed-off-by: Jingoo Han <[email protected]>
Signed-off-by: Lee Jones <[email protected]>
The MAX77686 clock driver has been in-tree for over 6 months, but never
actually enabled through the MFD registration before.
Add it to the table so the device will probe and configure properly.
Signed-off-by: Olof Johansson <[email protected]>
Signed-off-by: Samuel Ortiz <[email protected]>
'data' is a pointer and hence use NULL instead of 0.
Silences the following warning:
drivers/mfd/max77686.c:49:50: warning: Using plain integer as NULL pointer
Signed-off-by: Sachin Kamat <[email protected]>
Cc: Jonghwa Lee <[email protected]>
Signed-off-by: Samuel Ortiz <[email protected]>
Current code uses max77686->dev in the dev_err call before setting it to
&i2c->dev. Fix it.
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Samuel Ortiz <[email protected]>
Currently the MFD core supports remapping MFD cell interrupts using an
irqdomain but only if the MFD is being instantiated using device tree
and only if the device tree bindings use the pattern of registering IPs
in the device tree with compatible properties. This will be actively
harmful for drivers which support non-DT platforms and use this pattern
for their DT bindings as it will mean that the core will silently change
remapping behaviour and it is also limiting for drivers which don't do
DT with this particular pattern. There is also a potential fragility if
there are interrupts not associated with MFD cells and all the cells are
omitted from the device tree for some reason.
Instead change the code to take an IRQ domain as an optional argument,
allowing drivers to take the decision about the parent domain for their
interrupts. The one current user of this feature is ab8500-core, it has
the domain lookup pushed out into the driver.
Signed-off-by: Mark Brown <[email protected]>
Signed-off-by: Samuel Ortiz <[email protected]>
This fixes below build warning if CONFIG_OF is not set.
CC drivers/mfd/max77686.o
drivers/mfd/max77686.c:37:42: warning: 'max77686_pmic_dt_match' defined but not used [-Wunused-variable]
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Samuel Ortiz <[email protected]>
This patch adds device tree support for mfd driver and adds
Documentation/devicetree/bindings/mfd/max77686.txt.
This patch also intialize max77686 pointer to NULL in max77686_i2c_probe
to silent a compile time warning.
Signed-off-by: Yadwinder Singh Brar <[email protected]>
Reviwed-by: Mark Brown <[email protected]>
Signed-off-by: Samuel Ortiz <[email protected]>
Presently driver expects irq_gpio pin in platform data and maps it to irq
itself. But we can also directly specify the interrupt in DT or platform file.
Signed-off-by: Yadwinder Singh Brar <[email protected]>
Signed-off-by: Samuel Ortiz <[email protected]>
Now this driver is using regmap API, the iolock mutex is not used and
can be removed.
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Samuel Ortiz <[email protected]>
This patch is device driver for MAX77686 chip.
MAX77686 is PMIC and includes regulator and rtc on it.
This driver is core of MAX77686 chip, so provides common support for
accessing on-chip devices. It uses irq_domain to manage irq and regmap
to read/write data to its register with i2c bus.
Signed-off-by: Chiwoong Byun <[email protected]>
Signed-off-by: Jonghwa Lee <[email protected]>
Signed-off-by: Myungjoo Ham <[email protected]>
Signed-off-by: Kyungmin Park <[email protected]>
Reviewed-by: Mark Brown <[email protected]>
Signed-off-by: Samuel Ortiz <[email protected]>