misc: cec: add worker handler for resume
Shridhar Rasal [Tue, 14 May 2013 09:30:33 +0000 (14:30 +0530)]
HDMI CEC needs 1 sec delay for reset hardware in resume
Adding work handler for CEC init

Bug 1283088

Change-Id: I4498584ec93c1a5eefddfad9966cb5a1e7776e6e
Signed-off-by: Shridhar Rasal <srasal@nvidia.com>
Reviewed-on: http://git-master/r/228332
(cherry picked from commit 596245cee4b2c239843c2f920d83c21721af2ffb)
Signed-off-by: Xia Yang <xiay@nvidia.com>
Reviewed-on: http://git-master/r/346038
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

drivers/misc/tegra-cec/tegra_cec.c
drivers/misc/tegra-cec/tegra_cec.h

index 85eb47a..f0a1e53 100644 (file)
@@ -233,6 +233,13 @@ static void tegra_cec_init(struct tegra_cec *cec)
           cec->cec_base + TEGRA_CEC_INT_MASK);
 }
 
+static void tegra_cec_init_worker(struct work_struct *work)
+{
+       struct tegra_cec *cec = container_of(work, struct tegra_cec, work);
+
+       tegra_cec_init(cec);
+}
+
 static int tegra_cec_probe(struct platform_device *pdev)
 {
        struct tegra_cec *cec;
@@ -297,7 +304,8 @@ static int tegra_cec_probe(struct platform_device *pdev)
        platform_set_drvdata(pdev, cec);
        /* clear out the hardware. */
 
-       tegra_cec_init(cec);
+       INIT_WORK(&cec->work, tegra_cec_init_worker);
+       schedule_work(&cec->work);
 
        device_init_wakeup(&pdev->dev, 1);
 
@@ -339,6 +347,7 @@ static int tegra_cec_remove(struct platform_device *pdev)
        clk_put(cec->clk);
 
        misc_deregister(&cec->misc_dev);
+       cancel_work_sync(&cec->work);
 
        return 0;
 }
@@ -355,10 +364,11 @@ static int tegra_cec_suspend(struct platform_device *pdev, pm_message_t state)
 
 static int tegra_cec_resume(struct platform_device *pdev)
 {
-
        struct tegra_cec *cec = platform_get_drvdata(pdev);
+
        clk_enable(cec->clk);
-       tegra_cec_init(cec);
+       schedule_work(&cec->work);
+
        return 0;
 }
 #endif
index 4f908cc..c94f399 100644 (file)
@@ -30,6 +30,7 @@ struct tegra_cec {
        unsigned int            rx_wake;
        unsigned int            tx_wake;
        unsigned short          rx_buffer;
+       struct work_struct      work;
 };
 static int tegra_cec_remove(struct platform_device *pdev);