Commit 1bf3e6cc authored by Alexandre Belloni's avatar Alexandre Belloni

rtc: opal: set range

It is a BCD RTC with 4 digits for the year.
Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20210110224606.1414307-1-alexandre.belloni@bootlin.com
parent 446667df
...@@ -233,6 +233,10 @@ static int opal_rtc_probe(struct platform_device *pdev) ...@@ -233,6 +233,10 @@ static int opal_rtc_probe(struct platform_device *pdev)
{ {
struct rtc_device *rtc; struct rtc_device *rtc;
rtc = devm_rtc_allocate_device(&pdev->dev);
if (IS_ERR(rtc))
return PTR_ERR(rtc);
if (pdev->dev.of_node && if (pdev->dev.of_node &&
(of_property_read_bool(pdev->dev.of_node, "wakeup-source") || (of_property_read_bool(pdev->dev.of_node, "wakeup-source") ||
of_property_read_bool(pdev->dev.of_node, "has-tpo")/* legacy */)) { of_property_read_bool(pdev->dev.of_node, "has-tpo")/* legacy */)) {
...@@ -242,14 +246,12 @@ static int opal_rtc_probe(struct platform_device *pdev) ...@@ -242,14 +246,12 @@ static int opal_rtc_probe(struct platform_device *pdev)
opal_rtc_ops.alarm_irq_enable = opal_tpo_alarm_irq_enable; opal_rtc_ops.alarm_irq_enable = opal_tpo_alarm_irq_enable;
} }
rtc = devm_rtc_device_register(&pdev->dev, DRVNAME, &opal_rtc_ops, rtc->ops = &opal_rtc_ops;
THIS_MODULE); rtc->range_min = RTC_TIMESTAMP_BEGIN_0000;
if (IS_ERR(rtc)) rtc->range_max = RTC_TIMESTAMP_END_9999;
return PTR_ERR(rtc);
rtc->uie_unsupported = 1; rtc->uie_unsupported = 1;
return 0; return devm_rtc_register_device(rtc);
} }
static const struct of_device_id opal_rtc_match[] = { static const struct of_device_id opal_rtc_match[] = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment