extern void hdmi_work(struct work_struct *work);\r
extern struct rk_lcdc_device_driver * rk_get_lcdc_drv(char *name);\r
extern void hdmi_register_display_sysfs(struct hdmi *hdmi, struct device *parent);\r
+extern void hdmi_unregister_display_sysfs(struct hdmi *hdmi);\r
\r
#ifdef CONFIG_HAS_EARLYSUSPEND\r
static void hdmi_early_suspend(struct early_suspend *h)\r
hdmi = kmalloc(sizeof(struct hdmi), GFP_KERNEL);\r
if(!hdmi)\r
{\r
- dev_err(&pdev->dev, ">>rk30 lcdc inf kmalloc fail!");\r
+ dev_err(&pdev->dev, ">>rk30 hdmi kmalloc fail!");\r
return -ENOMEM;\r
}\r
memset(hdmi, 0, sizeof(struct hdmi));\r
register_early_suspend(&hdmi->early_suspend);\r
#endif\r
\r
- hdmi_register_display_sysfs(hdmi, hdmi->dev);\r
+ hdmi_register_display_sysfs(hdmi, NULL);\r
#ifdef CONFIG_SWITCH\r
hdmi->switch_hdmi.name="hdmi";\r
switch_dev_register(&(hdmi->switch_hdmi));\r
#ifdef CONFIG_SWITCH\r
switch_dev_unregister(&(hdmi->switch_hdmi));\r
#endif\r
+ hdmi_unregister_display_sysfs(hdmi);\r
#ifdef CONFIG_HAS_EARLYSUSPEND\r
unregister_early_suspend(&hdmi->early_suspend);\r
#endif\r
\r
static int __devexit rk30_hdmi_remove(struct platform_device *pdev)\r
{\r
- flush_scheduled_work();\r
- destroy_workqueue(hdmi->workqueue);\r
- #ifdef CONFIG_SWITCH\r
- switch_dev_unregister(&(hdmi->switch_hdmi));\r
- #endif\r
- #ifdef CONFIG_HAS_EARLYSUSPEND\r
- unregister_early_suspend(&hdmi->early_suspend);\r
- #endif\r
- iounmap((void*)hdmi->regbase);\r
-// release_mem_region(res->start,(res->end - res->start) + 1);\r
- clk_disable(hdmi->hclk);\r
- kfree(hdmi);\r
- hdmi_dbg(hdmi->dev, "rk30 hdmi unregistered.\n");\r
+ if(hdmi) {\r
+ flush_workqueue(hdmi->workqueue);\r
+ destroy_workqueue(hdmi->workqueue);\r
+ #ifdef CONFIG_SWITCH\r
+ switch_dev_unregister(&(hdmi->switch_hdmi));\r
+ #endif\r
+ hdmi_unregister_display_sysfs(hdmi);\r
+ #ifdef CONFIG_HAS_EARLYSUSPEND\r
+ unregister_early_suspend(&hdmi->early_suspend);\r
+ #endif\r
+ iounmap((void*)hdmi->regbase);\r
+ // release_mem_region(res->start,(res->end - res->start) + 1);\r
+ clk_disable(hdmi->hclk);\r
+ kfree(hdmi);\r
+ hdmi = NULL;\r
+ }\r
+ printk(KERN_INFO "rk30 hdmi removed.\n");\r
return 0;\r
}\r
\r
static void rk30_hdmi_shutdown(struct platform_device *pdev)\r
{\r
- /* this func is called twice, bug? */\r
- static bool first = true;\r
-\r
- if (first) {\r
- first = false;\r
- return;\r
+ if(hdmi) {\r
+ flush_workqueue(hdmi->workqueue);\r
+ destroy_workqueue(hdmi->workqueue);\r
+ #ifdef CONFIG_SWITCH\r
+ switch_dev_unregister(&(hdmi->switch_hdmi));\r
+ #endif\r
+ hdmi_unregister_display_sysfs(hdmi);\r
+ #ifdef CONFIG_HAS_EARLYSUSPEND\r
+ unregister_early_suspend(&hdmi->early_suspend);\r
+ #endif\r
+ clk_disable(hdmi->hclk);\r
+ kfree(hdmi);\r
+ hdmi = NULL;\r
}\r
- if (!hdmi)\r
- return;\r
-#ifdef CONFIG_HAS_EARLYSUSPEND\r
- unregister_early_suspend(&hdmi->early_suspend);\r
-#endif\r
+ printk(KERN_INFO "rk30 hdmi shut down.\n");\r
}\r
\r
static struct platform_driver rk30_hdmi_driver = {\r