rtc-opal.c (6dc1cf6f932bb0ea4d8f5e913a0a401ecacd2f03) | rtc-opal.c (0ec7769a98b00866e37740328d65cba6594d178d) |
---|---|
1/* 2 * IBM OPAL RTC driver 3 * Copyright (C) 2014 IBM 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. --- 153 unchanged lines hidden (view full) --- 162/* Set Timed Power-On */ 163static int opal_set_tpo_time(struct device *dev, struct rtc_wkalrm *alarm) 164{ 165 u64 h_m_s_ms = 0; 166 struct opal_msg msg; 167 u32 y_m_d = 0; 168 int token, rc; 169 | 1/* 2 * IBM OPAL RTC driver 3 * Copyright (C) 2014 IBM 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. --- 153 unchanged lines hidden (view full) --- 162/* Set Timed Power-On */ 163static int opal_set_tpo_time(struct device *dev, struct rtc_wkalrm *alarm) 164{ 165 u64 h_m_s_ms = 0; 166 struct opal_msg msg; 167 u32 y_m_d = 0; 168 int token, rc; 169 |
170 tm_to_opal(&alarm->time, &y_m_d, &h_m_s_ms); | 170 /* if alarm is enabled */ 171 if (alarm->enabled) { 172 tm_to_opal(&alarm->time, &y_m_d, &h_m_s_ms); 173 pr_debug("Alarm set to %x %llx\n", y_m_d, h_m_s_ms); |
171 | 174 |
175 } else { 176 pr_debug("Alarm getting disabled\n"); 177 } 178 |
|
172 token = opal_async_get_token_interruptible(); 173 if (token < 0) { 174 if (token != -ERESTARTSYS) 175 pr_err("Failed to get the async token\n"); 176 177 return token; 178 } 179 --- 15 unchanged lines hidden (view full) --- 195 if (rc != OPAL_SUCCESS) 196 rc = -EIO; 197 198exit: 199 opal_async_release_token(token); 200 return rc; 201} 202 | 179 token = opal_async_get_token_interruptible(); 180 if (token < 0) { 181 if (token != -ERESTARTSYS) 182 pr_err("Failed to get the async token\n"); 183 184 return token; 185 } 186 --- 15 unchanged lines hidden (view full) --- 202 if (rc != OPAL_SUCCESS) 203 rc = -EIO; 204 205exit: 206 opal_async_release_token(token); 207 return rc; 208} 209 |
210int opal_tpo_alarm_irq_enable(struct device *dev, unsigned int enabled) 211{ 212 struct rtc_wkalrm alarm = { .enabled = 0 }; 213 214 /* 215 * TPO is automatically enabled when opal_set_tpo_time() is called with 216 * non-zero rtc-time. We only handle disable case which needs to be 217 * explicitly told to opal. 218 */ 219 return enabled ? 0 : opal_set_tpo_time(dev, &alarm); 220} 221 |
|
203static struct rtc_class_ops opal_rtc_ops = { 204 .read_time = opal_get_rtc_time, 205 .set_time = opal_set_rtc_time, 206}; 207 208static int opal_rtc_probe(struct platform_device *pdev) 209{ 210 struct rtc_device *rtc; 211 212 if (pdev->dev.of_node && 213 (of_property_read_bool(pdev->dev.of_node, "wakeup-source") || 214 of_property_read_bool(pdev->dev.of_node, "has-tpo")/* legacy */)) { 215 device_set_wakeup_capable(&pdev->dev, true); 216 opal_rtc_ops.read_alarm = opal_get_tpo_time; 217 opal_rtc_ops.set_alarm = opal_set_tpo_time; | 222static struct rtc_class_ops opal_rtc_ops = { 223 .read_time = opal_get_rtc_time, 224 .set_time = opal_set_rtc_time, 225}; 226 227static int opal_rtc_probe(struct platform_device *pdev) 228{ 229 struct rtc_device *rtc; 230 231 if (pdev->dev.of_node && 232 (of_property_read_bool(pdev->dev.of_node, "wakeup-source") || 233 of_property_read_bool(pdev->dev.of_node, "has-tpo")/* legacy */)) { 234 device_set_wakeup_capable(&pdev->dev, true); 235 opal_rtc_ops.read_alarm = opal_get_tpo_time; 236 opal_rtc_ops.set_alarm = opal_set_tpo_time; |
237 opal_rtc_ops.alarm_irq_enable = opal_tpo_alarm_irq_enable; |
|
218 } 219 220 rtc = devm_rtc_device_register(&pdev->dev, DRVNAME, &opal_rtc_ops, 221 THIS_MODULE); 222 if (IS_ERR(rtc)) 223 return PTR_ERR(rtc); 224 225 rtc->uie_unsupported = 1; --- 48 unchanged lines hidden --- | 238 } 239 240 rtc = devm_rtc_device_register(&pdev->dev, DRVNAME, &opal_rtc_ops, 241 THIS_MODULE); 242 if (IS_ERR(rtc)) 243 return PTR_ERR(rtc); 244 245 rtc->uie_unsupported = 1; --- 48 unchanged lines hidden --- |