rtc: as3722: add shutdown support
Bibek Basu [Wed, 28 Jan 2015 06:11:13 +0000 (11:11 +0530)]
When shutdown process is ongoing, dont allow rtc
read/write/irq activity.Add shutdown hook to the
driver to disable irq and cancel any pending
irq_work

Bug 200072946

Change-Id: I1a68d17ec49ee32e849ad965a144b84be19ba6c5
Signed-off-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-on: http://git-master/r/677751
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>
Reviewed-by: Matthew Pedro <mapedro@nvidia.com>

drivers/rtc/rtc-as3722.c

index 555deef..8898339 100644 (file)
@@ -2,7 +2,7 @@
  * rtc-as3722.c - Real Time Clock driver for ams AS3722 PMICs
  *
  * Copyright (C) 2013 ams AG
- * Copyright (c) 2013, NVIDIA Corporation. All rights reserved.
+ * Copyright (c) 2013-2015, NVIDIA Corporation. All rights reserved.
  *
  * Author: Florian Lobmaier <florian.lobmaier@ams.com>
  * Author: Laxman Dewangan <ldewangan@nvidia.com>
@@ -239,6 +239,14 @@ static int as3722_rtc_remove(struct platform_device *pdev)
        return 0;
 }
 
+void as3722_rtc_shutdown(struct platform_device *pdev)
+{
+       struct as3722_rtc *as3722_rtc = platform_get_drvdata(pdev);
+
+       as3722_rtc_alarm_irq_enable(as3722_rtc->dev, 0);
+       rtc_device_shutdown(as3722_rtc->rtc);
+}
+
 #ifdef CONFIG_PM_SLEEP
 static int as3722_rtc_suspend(struct device *dev)
 {
@@ -286,6 +294,7 @@ static const struct dev_pm_ops as3722_rtc_pm_ops = {
 static struct platform_driver as3722_rtc_driver = {
        .probe = as3722_rtc_probe,
        .remove = as3722_rtc_remove,
+       .shutdown = as3722_rtc_shutdown,
        .driver = {
                .name = "as3722-rtc",
                .pm = &as3722_rtc_pm_ops,