diff options
author | Vaibhav Jain <vaibhav@linux.vnet.ibm.com> | 2015-07-14 03:58:28 -0400 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@free-electrons.com> | 2015-09-05 07:19:06 -0400 |
commit | f4a2eecb3ff9f51b179b213e7cc3766f920f2dc5 (patch) | |
tree | 29894bee75c6f1fb720da5f89a5c530153cba63b /drivers/rtc | |
parent | c28b42e3aee03fe869a3f73039cf92686ccbc8fb (diff) |
rtc: opal: Enable alarms only when opal supports tpo
rtc-opal driver provides support for rtc alarms via
timed-power-on(tpo). However some Power platforms like BML use a fake
rtc clock and don't support tpo. Such platforms are indicated by the
missing 'has-tpo' property in the device tree.
Current implementation however enables callback for
rtc_class_ops.read/set alarm irrespective of the tpo support from the
platform. This results in a failed opal call when kernel tries to read
an existing alarms via opal_get_tpo_time during rtc device registration.
This patch fixes this issue by setting opal_rtc_ops.read/set_alarm
callback pointers only when tpo is supported.
Acked-by: Michael Neuling <mikey@neuling.org>
Acked-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com>
Signed-off-by: Vaibhav Jain <vaibhav@linux.vnet.ibm.com>
Acked-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-opal.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/rtc/rtc-opal.c b/drivers/rtc/rtc-opal.c index 417d7b4a5cd8..6fbf9e617151 100644 --- a/drivers/rtc/rtc-opal.c +++ b/drivers/rtc/rtc-opal.c | |||
@@ -190,11 +190,9 @@ exit: | |||
190 | return rc; | 190 | return rc; |
191 | } | 191 | } |
192 | 192 | ||
193 | static const struct rtc_class_ops opal_rtc_ops = { | 193 | static struct rtc_class_ops opal_rtc_ops = { |
194 | .read_time = opal_get_rtc_time, | 194 | .read_time = opal_get_rtc_time, |
195 | .set_time = opal_set_rtc_time, | 195 | .set_time = opal_set_rtc_time, |
196 | .read_alarm = opal_get_tpo_time, | ||
197 | .set_alarm = opal_set_tpo_time, | ||
198 | }; | 196 | }; |
199 | 197 | ||
200 | static int opal_rtc_probe(struct platform_device *pdev) | 198 | static int opal_rtc_probe(struct platform_device *pdev) |
@@ -202,8 +200,11 @@ static int opal_rtc_probe(struct platform_device *pdev) | |||
202 | struct rtc_device *rtc; | 200 | struct rtc_device *rtc; |
203 | 201 | ||
204 | if (pdev->dev.of_node && of_get_property(pdev->dev.of_node, "has-tpo", | 202 | if (pdev->dev.of_node && of_get_property(pdev->dev.of_node, "has-tpo", |
205 | NULL)) | 203 | NULL)) { |
206 | device_set_wakeup_capable(&pdev->dev, true); | 204 | device_set_wakeup_capable(&pdev->dev, true); |
205 | opal_rtc_ops.read_alarm = opal_get_tpo_time; | ||
206 | opal_rtc_ops.set_alarm = opal_set_tpo_time; | ||
207 | } | ||
207 | 208 | ||
208 | rtc = devm_rtc_device_register(&pdev->dev, DRVNAME, &opal_rtc_ops, | 209 | rtc = devm_rtc_device_register(&pdev->dev, DRVNAME, &opal_rtc_ops, |
209 | THIS_MODULE); | 210 | THIS_MODULE); |