rtc: tps65910: allow using RTC without alarm interrupt
If tps65910 INT1 pin (IRQ output) is not wired to any IRQ controller, then it can't be used as system wakeup/alarm source, but it is still possible to read/write time from/to RTC. Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com> Link: https://lore.kernel.org/r/20191116203748.27166-1-andrej.skvortzov@gmail.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
This commit is contained in:
parent
5ba03f8f68
commit
db96d571a7
|
@ -361,6 +361,13 @@ static const struct rtc_class_ops tps65910_rtc_ops = {
|
||||||
.set_offset = tps65910_set_offset,
|
.set_offset = tps65910_set_offset,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const struct rtc_class_ops tps65910_rtc_ops_noirq = {
|
||||||
|
.read_time = tps65910_rtc_read_time,
|
||||||
|
.set_time = tps65910_rtc_set_time,
|
||||||
|
.read_offset = tps65910_read_offset,
|
||||||
|
.set_offset = tps65910_set_offset,
|
||||||
|
};
|
||||||
|
|
||||||
static int tps65910_rtc_probe(struct platform_device *pdev)
|
static int tps65910_rtc_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct tps65910 *tps65910 = NULL;
|
struct tps65910 *tps65910 = NULL;
|
||||||
|
@ -414,14 +421,16 @@ static int tps65910_rtc_probe(struct platform_device *pdev)
|
||||||
ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
|
ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
|
||||||
tps65910_rtc_interrupt, IRQF_TRIGGER_LOW,
|
tps65910_rtc_interrupt, IRQF_TRIGGER_LOW,
|
||||||
dev_name(&pdev->dev), &pdev->dev);
|
dev_name(&pdev->dev), &pdev->dev);
|
||||||
if (ret < 0) {
|
if (ret < 0)
|
||||||
dev_err(&pdev->dev, "IRQ is not free.\n");
|
irq = -1;
|
||||||
return ret;
|
|
||||||
}
|
tps_rtc->irq = irq;
|
||||||
tps_rtc->irq = irq;
|
if (irq != -1) {
|
||||||
device_set_wakeup_capable(&pdev->dev, 1);
|
device_set_wakeup_capable(&pdev->dev, 1);
|
||||||
|
tps_rtc->rtc->ops = &tps65910_rtc_ops;
|
||||||
|
} else
|
||||||
|
tps_rtc->rtc->ops = &tps65910_rtc_ops_noirq;
|
||||||
|
|
||||||
tps_rtc->rtc->ops = &tps65910_rtc_ops;
|
|
||||||
tps_rtc->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
|
tps_rtc->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
|
||||||
tps_rtc->rtc->range_max = RTC_TIMESTAMP_END_2099;
|
tps_rtc->rtc->range_max = RTC_TIMESTAMP_END_2099;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue