Age | Commit message (Collapse) | Author | Files | Lines |
|
'max77686_rtc_read_time()'
In case of error, we return 0.
This is spurious and not consistent with the other functions of the driver.
Commit e115a2bf1426 has modified more than what is said in the commit
message. Reverse part of it znd return an error when needed, as it was
previously.
Fixes: e115a2bf1426 ("rtc: max77686: stop validating rtc_time in .read_time")
Signed-off-by: Christophe JAILLET <[email protected]>
Reviewed-by: Chanwoo Choi <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
|
|
Replace GPL v2.0+ license statements with SPDX license
identifiers.
Signed-off-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
|
|
The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.
Signed-off-by: Alexandre Belloni <[email protected]>
|
|
Use macro REGMAP_IRQ_REG from regmap.h to initialise the
regmap irq table for max77686 to have better coding style
and improve readability.
Signed-off-by: Laxman Dewangan <[email protected]>
Reviewed-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
|
|
Maxim Semiconductor's PMIC MAX77686 has RTC IP which is
reused in the MAX77620/MAX20024 PMICs.
Add support for these devices in MAX77686 RTC driver. This
device does not have RTC alarm pending status outside of
RTC IP. The RTC IP is having separate I2C address for its
register access.
Signed-off-by: Laxman Dewangan <[email protected]>
Reviewed-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
|
|
To make RTC block of MAX77686/MAX77802 as independent driver,
move the registration of i2c device, regmap for register access
and irq_chip for interrupt support inside the RTC driver.
Removed the same initialisation from MFD driver.
Having this change will allow to reuse this driver for different
PMIC/devices from Maxim Semiconductor if they kept same RTC IP on
different PMIC. Some of examples as PMIC MAX77620, MAX20024 where
same RTC IP used and hence driver for these chips will use this
driver only for RTC support.
Suggested-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Laxman Dewangan <[email protected]>
Tested-by: Javier Martinez Canillas <[email protected]>
Reviewed-by: Javier Martinez Canillas <[email protected]>
Acked-by: Lee Jones <[email protected]>
Tested-by: Krzysztof Kozlowski <[email protected]>
Reviewed-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
|
|
Get rid of referring parent device info for register access
all the places by making regmap as part of max77686 rtc
device info. This will also remove the need of storing parent
device info in max77686 rtc device info as this is no more required.
Signed-off-by: Laxman Dewangan <[email protected]>
Tested-by: Krzysztof Kozlowski <[email protected]>
Reviewed-by: Krzysztof Kozlowski <[email protected]>
Tested-by: Javier Martinez Canillas <[email protected]>
Reviewed-by: Javier Martinez Canillas <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
|
|
rtc_regmap should be used to access all RTC registers instead
of parent regmap regardless of what chip or property have it.
This makes the register access uniform and extendible for other
chips.
Signed-off-by: Laxman Dewangan <[email protected]>
Tested-by: Krzysztof Kozlowski <[email protected]>
Reviewed-by: Krzysztof Kozlowski <[email protected]>
Tested-by: Javier Martinez Canillas <[email protected]>
Reviewed-by: Javier Martinez Canillas <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
|
|
Fix following check patch error in rtc-max77686 driver:
- Alignment should match open parenthesis.
- braces {} should be used on all arms of this statement.
- Prefer using the BIT macro
Signed-off-by: Laxman Dewangan <[email protected]>
Tested-by: Krzysztof Kozlowski <[email protected]>
Reviewed-by: Krzysztof Kozlowski <[email protected]>
Tested-by: Javier Martinez Canillas <[email protected]>
Reviewed-by: Javier Martinez Canillas <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
|
|
Cleanup of entire driver of its dmesg output:
1. Remove printing of the function name, because printing device name is
sufficient. This also makes the dev_err()-like functions more compact
and readable (not need of line break).
2. Lower from info to debug printing of each RTC interrupt (no need to
make noise on each alarm).
3. Remove dev_info() at beginning of probe because a message is already
always printed by either probe failure or from registering the RTC
device as /dev/rtcX.
Signed-off-by: Krzysztof Kozlowski <[email protected]>
Reviewed-by: Javier Martinez Canillas <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
|
|
The regmap_irq_get_virq() can return 0 or -EINVAL in error conditions
but driver checked only for value of 0.
This could lead to a cast of -EINVAL to an unsigned int used as a
interrupt number for devm_request_threaded_irq(). Although this is not
yet fatal (devm_request_threaded_irq() will just fail with -EINVAL) but
might be a misleading when diagnosing errors.
Signed-off-by: Krzysztof Kozlowski <[email protected]>
Fixes: 6f1c1e71d933 ("mfd: max77686: Convert to use regmap_irq")
Reviewed-by: Javier Martinez Canillas <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
|
|
The max77686 RTC only supports a range of 99 years so instead of using
year 1900 as the base, the year 2000 is used. This means that 1900 to
1999 are unsupported years.
The driver was printing a warning for those values but was returning a
error so for consistency, print an error message instead and don't say
that a year 2000 is assumed, since the year is not set.
Also, it is better to use dev_* log functions instead of pr_* to print
information about the device in the kernel log in a standardized way.
This also allows to remove the local pr_fmt() defined macro.
Suggested-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Javier Martinez Canillas <[email protected]>
Reviewed-by: Krzysztof Kozlowski <[email protected]>
Reviewed-by: Andi Shyti <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
|
|
The MAX77686 and MAX77802 RTC IP blocks are very similar with only
these differences:
0) The RTC registers layout and addresses are different.
1) The MAX77686 use 1 bit of the sec/min/hour/etc registers as the
alarm enable while MAX77802 has a separate register for that.
2) The MAX77686 RTCYEAR register valid values range is 0..99 while
for MAX77802 is 0..199.
3) The MAX77686 has a separate I2C address for the RTC registers
while the MAX77802 uses the same I2C address as the PMIC regs.
5) The minimum delay before a RTC update (16 msecs vs 200 usecs).
There are separate drivers for MAX77686 and MAX77802 RTC IP blocks
but the differences are not that big so the driver can be extended
to support both instead of duplicating a lot of code in 2 drivers.
Suggested-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Javier Martinez Canillas <[email protected]>
Acked-by: Laxman Dewangan <[email protected]>
Tested-by: Krzysztof Kozlowski <[email protected]>
Reviewed-by: Andi Shyti <[email protected]>
Reviewed-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
|
|
The max77686 driver is generic enough that can be used for other
Maxim RTC IP blocks but these might not have the same registers
layout so instead of accessing the registers directly, add a map
to translate offsets to the real registers addresses for each IP.
Signed-off-by: Javier Martinez Canillas <[email protected]>
Acked-by: Laxman Dewangan <[email protected]>
Tested-by: Krzysztof Kozlowski <[email protected]>
Reviewed-by: Krzysztof Kozlowski <[email protected]>
Reviewed-by: Andi Shyti <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
|
|
The driver has some hard-coded values such as the minimum delay needed
before a RTC update or the mask used for the sec/min/hour/etc registers.
Use a data structure that contains these values and pass as driver data
using the platform device ID table for each device.
This allows to make the driver's ops callbacks more generic so other RTC
that are similar but don't have the same values can also be supported.
Signed-off-by: Javier Martinez Canillas <[email protected]>
Acked-by: Laxman Dewangan <[email protected]>
Reviewed-by: Andi Shyti <[email protected]>
Tested-by: Krzysztof Kozlowski <[email protected]>
Reviewed-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
|
|
Documentation/timers/timers-howto.txt suggest to use usleep_range()
instead of msleep() for small msec (1ms - 20ms) since msleep() will
often sleep for 20ms for any value in that range.
This is fine in this case since 16ms is the _minimum_ delay required
by max77686 for an RTC update but by using usleep_range() instead of
msleep(), the driver can support other RTC IP blocks with a shorter
minimum delay (i.e: in the range of usecs instead of msecs).
Signed-off-by: Javier Martinez Canillas <[email protected]>
Reviewed-by: Krzysztof Kozlowski <[email protected]>
Tested-by: Krzysztof Kozlowski <[email protected]>
Reviewed-by: Andi Shyti <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
|
|
It is better to use the ARRAY_SIZE() macro instead of the array length
to avoid bugs if the array is later changed and the length not updated.
Signed-off-by: Javier Martinez Canillas <[email protected]>
Reviewed-by: Krzysztof Kozlowski <[email protected]>
Tested-by: Krzysztof Kozlowski <[email protected]>
Reviewed-by: Andi Shyti <[email protected]>
Acked-by: Laxman Dewangan <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
|
|
The function is always returning zero even in case of failures since
the ret value was not propagated to the callers. Fix the error path.
Reported-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Javier Martinez Canillas <[email protected]>
Reviewed-by: Krzysztof Kozlowski <[email protected]>
Tested-by: Krzysztof Kozlowski <[email protected]>
Acked-by: Laxman Dewangan <[email protected]>
Reviewed-by: Andi Shyti <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
|
|
If the rtc-max77686 driver is built as a module, modalias information is
not filled so the module is not autoloaded. Use the MODULE_DEVICE_TABLE()
macro to export the platform ID table so the module contains that data.
Signed-off-by: Javier Martinez Canillas <[email protected]>
Reviewed-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
|
|
Neaten the logging a bit by adding #define pr_fmt
Miscellanea:
o Remove __FILE__/__func__ uses
o Coalesce formats adding missing spaces
o Align arguments
o (rtc-cmos) Integrated 2 consecutive messages
Signed-off-by: Joe Perches <[email protected]>
Acked-by: Alexandre Belloni <[email protected]>
Cc: Alessandro Zummo <[email protected]>
Cc: Joshua Kinard <[email protected]>
Cc: Chanwoo Choi <[email protected]>
Reviewed-by: Krzysztof Kozlowski <[email protected]>
Tested-by: Krzysztof Kozlowski <[email protected]>
Cc: Aaro Koskinen <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
|
A platform_driver does not need to set an owner, it will be populated by the
driver core.
Signed-off-by: Wolfram Sang <[email protected]>
|
|
max77686_rtc_calculate_wday() is used to calculate the day of the week
to be filled in struct rtc_time but that function only calculates the
number of bits shifted. So the ffs() function can be used to find the
first bit set instead of a special function.
[[email protected]: add comment clarifying ffs() use]
Signed-off-by: Javier Martinez Canillas <[email protected]>
Cc: Joe Perches <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
|
If devm_rtc_device_register() fails a dev_err() is already reported so
there is no need to do an additional dev_info().
Signed-off-by: Javier Martinez Canillas <[email protected]>
Cc: Doug Anderson <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Alessandro Zummo <[email protected]>
Cc: Olof Johansson <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
|
The max77686 mfd driver adds a regmap IRQ chip which creates an IRQ
domain that is used to map the virtual RTC alarm1 interrupt.
The RTC driver assumes that this will always be true since the PMIC IRQ
is a required property according to the max77686 DT binding doc. If an
"interrupts" property is not defined for a max77686 PMIC, then the mfd
probe function will fail and the RTC platform driver will never be
probed.
But even when it is not possible to probe the rtc-max77686 driver
without a regmap IRQ chip, it's better to explicitly check if the IRQ
chip data is not NULL and gracefully fail instead of getting an OOPS.
Signed-off-by: Javier Martinez Canillas <[email protected]>
Reported-by: Krzysztof Kozlowski <[email protected]>
Cc: Doug Anderson <[email protected]>
Cc: Alessandro Zummo <[email protected]>
Cc: Olof Johansson <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
|
The MAX77686 RTC chip has two features called SMPL (Sudden Momentary
Power Loss) and WTSR (Watchdog Timeout and Software Resets). Support
for these features seems to be implemented in the driver but compilation
is disabled using a C pre-processor conditional.
This code has been disabled since the driver was original merged in
commit fca1dd031a28 ("rtc: max77686: add Maxim 77686 driver").
So, since this code has never been built, let's just remove it.
Signed-off-by: Javier Martinez Canillas <[email protected]>
Reviewed-by: Krzysztof Kozlowski <[email protected]>
Cc: Doug Anderson <[email protected]>
Cc: Alessandro Zummo <[email protected]>
Cc: Olof Johansson <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
|
This series add support for the Real Time clock present in the Maxim 77802
Power Managment IC. The version number is quite high because it
previously was part of a bigger series [0] that aimed to add support for
all the devices in the max77802 PMIC. But now that the max77802
dependencies were already merged for 3.17, the series were split but I
kept the version numbering.
While working on the max77802 rtc support a lot of feedback was given and
the issues pointed out also apply to a driver for a similar PMIC RTC
(max77686). So patches 01/06 to 05/06 in the series are cleanups for the
max77686 driver and patch 06/06 adds the support for the max77802 RTC.
The series were tested on an Exynos5250 Snow (max77686) and
Exynos5420 Peach Pit (max77802) machines.
This patch (of 6):
The max77686 includes an RTC that keeps power during suspend. It's
convenient to be able to use it as a wakeup source.
Signed-off-by: Doug Anderson <[email protected]>
Signed-off-by: Javier Martinez Canillas <[email protected]>
Reviewed-by: Krzysztof Kozlowski <[email protected]>
Cc: Alessandro Zummo <[email protected]>
Cc: Olof Johansson <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[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]>
|
|
Fix a read of the wrong register when checking whether the RTC timer has
reached the alarm time.
Signed-off-by: Sangjung Woo <[email protected]>
Signed-off-by: Myugnjoo Ham <[email protected]>
Reviewed-by: Jonghwa Lee <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
|
After the switch to devm_* functions and the removal of
rtc_device_unregister(), the 'remove' function does not do anything.
Delete it.
Signed-off-by: Sachin Kamat <[email protected]>
Cc: Chiwoong Byun <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
|
Fixes the following warning:
WARNING: space prohibited before semicolon
Signed-off-by: Sachin Kamat <[email protected]>
Cc: Jingoo Han <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
|
This driver already uses other devm_* APIs.
Convert regmap_init_i2c too.
Signed-off-by: Sachin Kamat <[email protected]>
Cc: Chiwoong Byun <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
|
'ret' was not initialized to error code before returning. While
at it also remove some redundant code and cleanup.
Signed-off-by: Sachin Kamat <[email protected]>
Cc: Chiwoong Byun <[email protected]>
Cc: Jonghwa Lee <[email protected]>
Cc: Laxman dewangan <[email protected]>
Cc: Venu Byravarasu <[email protected]>
Cc: Jingoo Han <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
|
devm_rtc_device_register() is device managed and makes cleanup
paths simpler. Also, this patch uses devm_request_threaded_irq().
Signed-off-by: Jingoo Han <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
|
pr_info()/pr_emerg()
dev_info()/dev_emerg() are preferred to pr_info()/pr_emerg().
Signed-off-by: Jingoo Han <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
|
Fix indentation of bit definitions to enhance the readability.
Signed-off-by: Jingoo Han <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
|
Use devm_kzalloc() to make cleanup paths more simple.
Signed-off-by: Jingoo Han <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
|
Add missing module author name to MODULE_AUTHOR macro.
Signed-off-by: Jingoo Han <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
|
Use module_platform_driver() macro which makes the code smaller and
simpler.
Signed-off-by: Jingoo Han <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
|
Fix the checkpatch warning as below:
WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
Signed-off-by: Jingoo Han <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
|
Add a driver to support max77686 rtc. MAX77686 rtc support smpl and wtsr
mode. It has two alarm register which can be used for alarming to wake
system up. This drvier uses regmap to access its register.
[[email protected]: remove inline, __devinit annotations]
[[email protected]: fix build warnings]
[[email protected]: simplify code]
Signed-off-by: Chiwoong Byun <[email protected]>
Signed-off-by: Jonghwa Lee <[email protected]>
Signed-off-by: Myugnjoo Ham <[email protected]>
Signed-off-by: Kyungmin Park <[email protected]>
Signed-off-by: Jingoo Han <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|