| .. | .. |
|---|
| 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> |
|---|
| .. | .. |
|---|
| 240 | 232 | return ret; |
|---|
| 241 | 233 | } |
|---|
| 242 | 234 | |
|---|
| 243 | | - dev_dbg(dev, "alrm read RTC date/time %4d-%02d-%02d(%d) %02d:%02d:%02d\n", |
|---|
| 244 | | - 1900 + alrm->time.tm_year, alrm->time.tm_mon + 1, |
|---|
| 245 | | - alrm->time.tm_mday, alrm->time.tm_wday, alrm->time.tm_hour, |
|---|
| 246 | | - alrm->time.tm_min, alrm->time.tm_sec); |
|---|
| 235 | + dev_dbg(dev, "alrm read RTC date/time %ptRd(%d) %ptRt\n", |
|---|
| 236 | + &alrm->time, alrm->time.tm_wday, &alrm->time); |
|---|
| 247 | 237 | |
|---|
| 248 | 238 | alrm->enabled = (int_reg & BIT_RTC_INTERRUPTS_REG_IT_ALARM_M) ? 1 : 0; |
|---|
| 249 | 239 | |
|---|
| .. | .. |
|---|
| 285 | 275 | dev_err(dev, "Failed to stop alarm: %d\n", ret); |
|---|
| 286 | 276 | return ret; |
|---|
| 287 | 277 | } |
|---|
| 288 | | - dev_dbg(dev, "alrm set RTC date/time %4d-%02d-%02d(%d) %02d:%02d:%02d\n", |
|---|
| 289 | | - 1900 + alrm->time.tm_year, alrm->time.tm_mon + 1, |
|---|
| 290 | | - alrm->time.tm_mday, alrm->time.tm_wday, alrm->time.tm_hour, |
|---|
| 291 | | - alrm->time.tm_min, alrm->time.tm_sec); |
|---|
| 278 | + dev_dbg(dev, "alrm set RTC date/time %ptRd(%d) %ptRt\n", |
|---|
| 279 | + &alrm->time, alrm->time.tm_wday, &alrm->time); |
|---|
| 292 | 280 | |
|---|
| 293 | 281 | if (rk808_rtc->flag & RTC_NEED_TRANSITIONS) |
|---|
| 294 | 282 | gregorian_to_rockchip(&alrm->time); |
|---|
| .. | .. |
|---|
| 371 | 359 | /* Turn off the alarm if it should not be a wake source. */ |
|---|
| 372 | 360 | static int rk808_rtc_suspend(struct device *dev) |
|---|
| 373 | 361 | { |
|---|
| 374 | | - struct platform_device *pdev = to_platform_device(dev); |
|---|
| 375 | | - struct rk808_rtc *rk808_rtc = dev_get_drvdata(&pdev->dev); |
|---|
| 362 | + struct rk808_rtc *rk808_rtc = dev_get_drvdata(dev); |
|---|
| 376 | 363 | |
|---|
| 377 | 364 | if (device_may_wakeup(dev)) |
|---|
| 378 | 365 | enable_irq_wake(rk808_rtc->irq); |
|---|
| .. | .. |
|---|
| 385 | 372 | */ |
|---|
| 386 | 373 | static int rk808_rtc_resume(struct device *dev) |
|---|
| 387 | 374 | { |
|---|
| 388 | | - struct platform_device *pdev = to_platform_device(dev); |
|---|
| 389 | | - struct rk808_rtc *rk808_rtc = dev_get_drvdata(&pdev->dev); |
|---|
| 375 | + struct rk808_rtc *rk808_rtc = dev_get_drvdata(dev); |
|---|
| 390 | 376 | |
|---|
| 391 | 377 | if (device_may_wakeup(dev)) |
|---|
| 392 | 378 | disable_irq_wake(rk808_rtc->irq); |
|---|
| .. | .. |
|---|
| 477 | 463 | if (ret) { |
|---|
| 478 | 464 | dev_err(&pdev->dev, |
|---|
| 479 | 465 | "Failed to write RTC status: %d\n", ret); |
|---|
| 480 | | - return ret; |
|---|
| 466 | + return ret; |
|---|
| 481 | 467 | } |
|---|
| 482 | 468 | |
|---|
| 483 | 469 | device_init_wakeup(&pdev->dev, 1); |
|---|
| .. | .. |
|---|
| 489 | 475 | rk808_rtc->rtc->ops = &rk808_rtc_ops; |
|---|
| 490 | 476 | |
|---|
| 491 | 477 | rk808_rtc->irq = platform_get_irq(pdev, 0); |
|---|
| 492 | | - if (rk808_rtc->irq < 0) { |
|---|
| 493 | | - if (rk808_rtc->irq != -EPROBE_DEFER) |
|---|
| 494 | | - dev_err(&pdev->dev, "Wake up is not possible as irq = %d\n", |
|---|
| 495 | | - rk808_rtc->irq); |
|---|
| 478 | + if (rk808_rtc->irq < 0) |
|---|
| 496 | 479 | return rk808_rtc->irq; |
|---|
| 497 | | - } |
|---|
| 498 | 480 | |
|---|
| 499 | 481 | /* request alarm irq of rk808 */ |
|---|
| 500 | 482 | ret = devm_request_threaded_irq(&pdev->dev, rk808_rtc->irq, NULL, |
|---|