diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-04-10 10:22:27 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-04-10 10:22:27 -0700 |
commit | fbe173e3ffbd897b5a859020d714c0eaf4af2a1a (patch) | |
tree | 602fd9da34454d934fcee56b8a74ebed05ba7d1c /drivers/rtc/rtc-ab8500.c | |
parent | 5e630afdcb82779f5bf03fd4a5e86adc56fe7c8a (diff) | |
parent | 1485991c024603b2fb4ae77beb7a0d741128a48e (diff) | |
download | linux-fbe173e3ffbd897b5a859020d714c0eaf4af2a1a.tar.bz2 |
Merge tag 'rtc-4.17' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux
Pull RTC updates from Alexandre Belloni:
"This contains a few series that have been in preparation for a while
and that will help systems with RTCs that will fail in 2038, 2069 or
2100.
Subsystem:
- Add tracepoints
- Rework of the RTC/nvmem API to allow drivers to discard struct
nvmem_config after registration
- New range API, drivers can now expose the useful range of the RTC
- New offset API the core is now able to add an offset to the RTC
time, modifying the supported range.
- Multiple rtc_time64_to_tm fixes
- Handle time_t overflow on 32 bit platforms in the core instead of
letting drivers do crazy things.
- remove rtc_control API
New driver:
- Intersil ISL12026
Drivers:
- Drivers exposing the RTC non volatile memory have been converted to
use nvmem
- Removed useless time and date validation
- Removed an indirection pattern that was a cargo cult from ancient
drivers
- Removed VLA usage
- Fixed a possible race condition in probe functions
- AB8540 support is dropped from ab8500
- pcf85363 now has alarm support"
* tag 'rtc-4.17' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (128 commits)
rtc: snvs: Fix usage of snvs_rtc_enable
rtc: mt7622: fix module autoloading for OF platform drivers
rtc: isl12022: use true and false for boolean values
rtc: ab8500: Drop AB8540 support
rtc: remove a warning during scripts/kernel-doc step
rtc: 88pm860x: remove artificial limitation
rtc: 88pm80x: remove artificial limitation
rtc: st-lpc: remove artificial limitation
rtc: mrst: remove artificial limitation
rtc: mv: remove artificial limitation
rtc: hctosys: Ensure system time doesn't overflow time_t
parisc: time: stop validating rtc_time in .read_time
rtc: pcf85063: fix clearing bits in pcf85063_start_clock
rtc: at91sam9: Set name of regmap_config
rtc: s5m: Remove VLA usage
rtc: s5m: Move enum from rtc.h to rtc-s5m.c
rtc: remove VLA usage
rtc: Add useful timestamp definitions
rtc: Add one offset seconds to expand RTC range
rtc: Factor out the RTC range validation into rtc_valid_range()
...
Diffstat (limited to 'drivers/rtc/rtc-ab8500.c')
-rw-r--r-- | drivers/rtc/rtc-ab8500.c | 57 |
1 files changed, 1 insertions, 56 deletions
diff --git a/drivers/rtc/rtc-ab8500.c b/drivers/rtc/rtc-ab8500.c index 24a0af650a1b..e28f4401fd35 100644 --- a/drivers/rtc/rtc-ab8500.c +++ b/drivers/rtc/rtc-ab8500.c @@ -36,10 +36,6 @@ #define AB8500_RTC_FORCE_BKUP_REG 0x0D #define AB8500_RTC_CALIB_REG 0x0E #define AB8500_RTC_SWITCH_STAT_REG 0x0F -#define AB8540_RTC_ALRM_SEC 0x22 -#define AB8540_RTC_ALRM_MIN_LOW_REG 0x23 -#define AB8540_RTC_ALRM_MIN_MID_REG 0x24 -#define AB8540_RTC_ALRM_MIN_HI_REG 0x25 /* RtcReadRequest bits */ #define RTC_READ_REQUEST 0x01 @@ -63,11 +59,6 @@ static const u8 ab8500_rtc_alarm_regs[] = { AB8500_RTC_ALRM_MIN_LOW_REG }; -static const u8 ab8540_rtc_alarm_regs[] = { - AB8540_RTC_ALRM_MIN_HI_REG, AB8540_RTC_ALRM_MIN_MID_REG, - AB8540_RTC_ALRM_MIN_LOW_REG, AB8540_RTC_ALRM_SEC -}; - /* Calculate the seconds from 1970 to 01-01-2000 00:00:00 */ static unsigned long get_elapsed_seconds(int year) { @@ -131,7 +122,7 @@ static int ab8500_rtc_read_time(struct device *dev, struct rtc_time *tm) secs += get_elapsed_seconds(AB8500_RTC_EPOCH); rtc_time_to_tm(secs, tm); - return rtc_valid_tm(tm); + return 0; } static int ab8500_rtc_set_time(struct device *dev, struct rtc_time *tm) @@ -277,43 +268,6 @@ static int ab8500_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm) return ab8500_rtc_irq_enable(dev, alarm->enabled); } -static int ab8540_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm) -{ - int retval, i; - unsigned char buf[ARRAY_SIZE(ab8540_rtc_alarm_regs)]; - unsigned long mins, secs = 0; - - if (alarm->time.tm_year < (AB8500_RTC_EPOCH - 1900)) { - dev_dbg(dev, "year should be equal to or greater than %d\n", - AB8500_RTC_EPOCH); - return -EINVAL; - } - - /* Get the number of seconds since 1970 */ - rtc_tm_to_time(&alarm->time, &secs); - - /* - * Convert it to the number of seconds since 01-01-2000 00:00:00 - */ - secs -= get_elapsed_seconds(AB8500_RTC_EPOCH); - mins = secs / 60; - - buf[3] = secs % 60; - buf[2] = mins & 0xFF; - buf[1] = (mins >> 8) & 0xFF; - buf[0] = (mins >> 16) & 0xFF; - - /* Set the alarm time */ - for (i = 0; i < ARRAY_SIZE(ab8540_rtc_alarm_regs); i++) { - retval = abx500_set_register_interruptible(dev, AB8500_RTC, - ab8540_rtc_alarm_regs[i], buf[i]); - if (retval < 0) - return retval; - } - - return ab8500_rtc_irq_enable(dev, alarm->enabled); -} - static int ab8500_rtc_set_calibration(struct device *dev, int calibration) { int retval; @@ -435,17 +389,8 @@ static const struct rtc_class_ops ab8500_rtc_ops = { .alarm_irq_enable = ab8500_rtc_irq_enable, }; -static const struct rtc_class_ops ab8540_rtc_ops = { - .read_time = ab8500_rtc_read_time, - .set_time = ab8500_rtc_set_time, - .read_alarm = ab8500_rtc_read_alarm, - .set_alarm = ab8540_rtc_set_alarm, - .alarm_irq_enable = ab8500_rtc_irq_enable, -}; - static const struct platform_device_id ab85xx_rtc_ids[] = { { "ab8500-rtc", (kernel_ulong_t)&ab8500_rtc_ops, }, - { "ab8540-rtc", (kernel_ulong_t)&ab8540_rtc_ops, }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(platform, ab85xx_rtc_ids); |