| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * RTC driver for Rockchip RK808 |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Author: Chris Zhong <zyw@rock-chips.com> |
|---|
| 7 | 8 | * Author: Zhang Qing <zhangqing@rock-chips.com> |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 10 | | - * under the terms and conditions of the GNU General Public License, |
|---|
| 11 | | - * version 2, as published by the Free Software Foundation. |
|---|
| 12 | | - * |
|---|
| 13 | | - * This program is distributed in the hope it will be useful, but WITHOUT |
|---|
| 14 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|---|
| 15 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|---|
| 16 | | - * more details. |
|---|
| 17 | 9 | */ |
|---|
| 18 | 10 | |
|---|
| 19 | 11 | #include <linux/module.h> |
|---|
| .. | .. |
|---|
| 241 | 233 | return ret; |
|---|
| 242 | 234 | } |
|---|
| 243 | 235 | |
|---|
| 244 | | - dev_dbg(dev, "alrm read RTC date/time %4d-%02d-%02d(%d) %02d:%02d:%02d\n", |
|---|
| 245 | | - 1900 + alrm->time.tm_year, alrm->time.tm_mon + 1, |
|---|
| 246 | | - alrm->time.tm_mday, alrm->time.tm_wday, alrm->time.tm_hour, |
|---|
| 247 | | - alrm->time.tm_min, alrm->time.tm_sec); |
|---|
| 236 | + dev_dbg(dev, "alrm read RTC date/time %ptRd(%d) %ptRt\n", |
|---|
| 237 | + &alrm->time, alrm->time.tm_wday, &alrm->time); |
|---|
| 248 | 238 | |
|---|
| 249 | 239 | alrm->enabled = (int_reg & BIT_RTC_INTERRUPTS_REG_IT_ALARM_M) ? 1 : 0; |
|---|
| 250 | 240 | |
|---|
| .. | .. |
|---|
| 292 | 282 | dev_err(dev, "Failed to stop alarm: %d\n", ret); |
|---|
| 293 | 283 | return ret; |
|---|
| 294 | 284 | } |
|---|
| 295 | | - dev_dbg(dev, "alrm set RTC date/time %4d-%02d-%02d(%d) %02d:%02d:%02d\n", |
|---|
| 296 | | - 1900 + alrm->time.tm_year, alrm->time.tm_mon + 1, |
|---|
| 297 | | - alrm->time.tm_mday, alrm->time.tm_wday, alrm->time.tm_hour, |
|---|
| 298 | | - alrm->time.tm_min, alrm->time.tm_sec); |
|---|
| 285 | + dev_dbg(dev, "alrm set RTC date/time %ptRd(%d) %ptRt\n", |
|---|
| 286 | + &alrm->time, alrm->time.tm_wday, &alrm->time); |
|---|
| 299 | 287 | |
|---|
| 300 | 288 | if (rk808_rtc->flag & RTC_NEED_TRANSITIONS) |
|---|
| 301 | 289 | gregorian_to_rockchip(&alrm->time); |
|---|
| .. | .. |
|---|
| 378 | 366 | /* Turn off the alarm if it should not be a wake source. */ |
|---|
| 379 | 367 | static int rk808_rtc_suspend(struct device *dev) |
|---|
| 380 | 368 | { |
|---|
| 381 | | - struct platform_device *pdev = to_platform_device(dev); |
|---|
| 382 | | - struct rk808_rtc *rk808_rtc = dev_get_drvdata(&pdev->dev); |
|---|
| 369 | + struct rk808_rtc *rk808_rtc = dev_get_drvdata(dev); |
|---|
| 383 | 370 | |
|---|
| 384 | 371 | if (device_may_wakeup(dev)) |
|---|
| 385 | 372 | enable_irq_wake(rk808_rtc->irq); |
|---|
| .. | .. |
|---|
| 392 | 379 | */ |
|---|
| 393 | 380 | static int rk808_rtc_resume(struct device *dev) |
|---|
| 394 | 381 | { |
|---|
| 395 | | - struct platform_device *pdev = to_platform_device(dev); |
|---|
| 396 | | - struct rk808_rtc *rk808_rtc = dev_get_drvdata(&pdev->dev); |
|---|
| 382 | + struct rk808_rtc *rk808_rtc = dev_get_drvdata(dev); |
|---|
| 397 | 383 | |
|---|
| 398 | 384 | if (device_may_wakeup(dev)) |
|---|
| 399 | 385 | disable_irq_wake(rk808_rtc->irq); |
|---|
| .. | .. |
|---|
| 484 | 470 | if (ret) { |
|---|
| 485 | 471 | dev_err(&pdev->dev, |
|---|
| 486 | 472 | "Failed to write RTC status: %d\n", ret); |
|---|
| 487 | | - return ret; |
|---|
| 473 | + return ret; |
|---|
| 488 | 474 | } |
|---|
| 489 | 475 | |
|---|
| 490 | 476 | device_init_wakeup(&pdev->dev, 1); |
|---|
| .. | .. |
|---|
| 496 | 482 | rk808_rtc->rtc->ops = &rk808_rtc_ops; |
|---|
| 497 | 483 | |
|---|
| 498 | 484 | rk808_rtc->irq = platform_get_irq(pdev, 0); |
|---|
| 499 | | - if (rk808_rtc->irq < 0) { |
|---|
| 500 | | - if (rk808_rtc->irq != -EPROBE_DEFER) |
|---|
| 501 | | - dev_err(&pdev->dev, "Wake up is not possible as irq = %d\n", |
|---|
| 502 | | - rk808_rtc->irq); |
|---|
| 485 | + if (rk808_rtc->irq < 0) |
|---|
| 503 | 486 | return rk808_rtc->irq; |
|---|
| 504 | | - } |
|---|
| 505 | 487 | |
|---|
| 506 | 488 | /* request alarm irq of rk808 */ |
|---|
| 507 | 489 | ret = devm_request_threaded_irq(&pdev->dev, rk808_rtc->irq, NULL, |
|---|