Lines Matching +full:timeout +full:- +full:secs
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) ST-Ericsson SA 2010
63 unsigned long timeout = jiffies + HZ; in ab8500_rtc_read_time() local
65 unsigned long mins, secs; in ab8500_rtc_read_time() local
76 while (time_before(jiffies, timeout)) { in ab8500_rtc_read_time()
99 secs = (buf[3] << 8) | buf[4]; in ab8500_rtc_read_time()
100 secs = secs / COUNTS_PER_SEC; in ab8500_rtc_read_time()
101 secs = secs + (mins * 60); in ab8500_rtc_read_time()
103 rtc_time64_to_tm(secs, tm); in ab8500_rtc_read_time()
111 unsigned long no_secs, no_mins, secs = 0; in ab8500_rtc_set_time() local
113 secs = rtc_tm_to_time64(tm); in ab8500_rtc_set_time()
115 no_mins = secs / 60; in ab8500_rtc_set_time()
117 no_secs = secs % 60; in ab8500_rtc_set_time()
145 unsigned long secs, mins; in ab8500_rtc_read_alarm() local
154 alarm->enabled = 1; in ab8500_rtc_read_alarm()
156 alarm->enabled = 0; in ab8500_rtc_read_alarm()
158 alarm->pending = 0; in ab8500_rtc_read_alarm()
169 secs = mins * 60; in ab8500_rtc_read_alarm()
171 rtc_time64_to_tm(secs, &alarm->time); in ab8500_rtc_read_alarm()
189 mins = (unsigned long)rtc_tm_to_time64(&alarm->time) / 60; in ab8500_rtc_set_alarm()
203 return ab8500_rtc_irq_enable(dev, alarm->enabled); in ab8500_rtc_set_alarm()
213 * parts-per-million) is in the AB8500's range for RtcCalibration in ab8500_rtc_set_calibration()
214 * register. -128 (0x80) is not permitted because the AB8500 uses in ab8500_rtc_set_calibration()
215 * a sign-bit rather than two's complement, so 0x80 is just another in ab8500_rtc_set_calibration()
218 if ((calibration < -127) || (calibration > 127)) { in ab8500_rtc_set_calibration()
220 return -EINVAL; in ab8500_rtc_set_calibration()
224 * The AB8500 uses sign (in bit7) and magnitude (in bits0-7) in ab8500_rtc_set_calibration()
231 rtccal = ~(calibration - 1) | 0x80; in ab8500_rtc_set_calibration()
248 * The AB8500 uses sign (in bit7) and magnitude (in bits0-7) in ab8500_rtc_get_calibration()
253 *calibration = 0 - (rtccal & 0x7F); in ab8500_rtc_get_calibration()
270 return -EINVAL; in ab8500_sysfs_store_rtc_calibration()
312 dev_dbg(&rtc->dev, "%s\n", __func__); in rtc_alarm_handler()
327 { "ab8500-rtc", (kernel_ulong_t)&ab8500_rtc_ops, },
345 err = abx500_mask_and_set_register_interruptible(&pdev->dev, AB8500_RTC, in ab8500_rtc_probe()
353 err = abx500_get_register_interruptible(&pdev->dev, AB8500_RTC, in ab8500_rtc_probe()
360 dev_err(&pdev->dev, "RTC supply failure\n"); in ab8500_rtc_probe()
361 return -ENODEV; in ab8500_rtc_probe()
364 device_init_wakeup(&pdev->dev, true); in ab8500_rtc_probe()
366 rtc = devm_rtc_allocate_device(&pdev->dev); in ab8500_rtc_probe()
370 rtc->ops = (struct rtc_class_ops *)platid->driver_data; in ab8500_rtc_probe()
372 err = devm_request_threaded_irq(&pdev->dev, irq, NULL, in ab8500_rtc_probe()
374 "ab8500-rtc", rtc); in ab8500_rtc_probe()
378 dev_pm_set_wake_irq(&pdev->dev, irq); in ab8500_rtc_probe()
381 set_bit(RTC_FEATURE_ALARM_RES_MINUTE, rtc->features); in ab8500_rtc_probe()
382 clear_bit(RTC_FEATURE_UPDATE_INTERRUPT, rtc->features); in ab8500_rtc_probe()
384 rtc->range_max = (1ULL << 24) * 60 - 1; // 24-bit minutes + 59 secs in ab8500_rtc_probe()
385 rtc->start_secs = RTC_TIMESTAMP_BEGIN_2000; in ab8500_rtc_probe()
386 rtc->set_start_time = true; in ab8500_rtc_probe()
397 dev_pm_clear_wake_irq(&pdev->dev); in ab8500_rtc_remove()
398 device_init_wakeup(&pdev->dev, false); in ab8500_rtc_remove()
403 .name = "ab8500-rtc",