rk30 hdmi: support switch class to detect hotplug status.

This commit is contained in:
Zheng Yang
2012-05-02 11:49:51 +08:00
parent 0a51812bef
commit a1c15deb2b
3 changed files with 29 additions and 8 deletions

View File

@@ -154,10 +154,13 @@ static int __devinit rk30_hdmi_probe (struct platform_device *pdev)
hdmi->early_suspend.level = EARLY_SUSPEND_LEVEL_DISABLE_FB - 10;
register_early_suspend(&hdmi->early_suspend);
#endif
hdmi_register_display_sysfs(hdmi, hdmi->dev);
#ifdef CONFIG_SWITCH
hdmi->switch_hdmi.name="hdmi";
switch_dev_register(&(hdmi->switch_hdmi));
#endif
spin_lock_init(&hdmi->irq_lock);
mutex_init(&hdmi->enable_mutex);
@@ -180,9 +183,12 @@ static int __devinit rk30_hdmi_probe (struct platform_device *pdev)
hdmi_dbg(hdmi->dev, "rk30 hdmi probe sucess.\n");
return 0;
err2:
#ifdef CONFIG_HAS_EARLYSUSPEND
#ifdef CONFIG_SWITCH
switch_dev_unregister(&(hdmi->switch_hdmi));
#endif
#ifdef CONFIG_HAS_EARLYSUSPEND
unregister_early_suspend(&hdmi->early_suspend);
#endif
#endif
iounmap((void*)hdmi->regbase);
err1:
release_mem_region(res->start,(res->end - res->start) + 1);
@@ -197,6 +203,9 @@ static int __devexit rk30_hdmi_remove(struct platform_device *pdev)
{
flush_scheduled_work();
destroy_workqueue(hdmi->workqueue);
#ifdef CONFIG_SWITCH
switch_dev_unregister(&(hdmi->switch_hdmi));
#endif
#ifdef CONFIG_HAS_EARLYSUSPEND
unregister_early_suspend(&hdmi->early_suspend);
#endif

View File

@@ -1,18 +1,20 @@
#ifndef __RK30_HDMI_H__
#define __RK30_HDMI_H__
#include <linux/kernel.h>
#include <linux/fb.h>
#include <linux/spinlock.h>
#include <linux/mutex.h>
#include <linux/device.h>
#include <linux/workqueue.h>
#include <linux/display-sys.h>
#ifdef CONFIG_SWITCH
#include <linux/switch.h>
#endif
#ifdef CONFIG_HAS_EARLYSUSPEND
#include <linux/earlysuspend.h>
#endif
//#include "../../display/screen/screen.h"
#include<linux/rk_screen.h>
#include <linux/rk_fb.h>
#include "rk_hdmi.h"
@@ -45,6 +47,10 @@ struct hdmi {
int irq;
struct rk_lcdc_device_driver *lcdc;
#ifdef CONFIG_SWITCH
struct switch_dev switch_hdmi;
#endif
struct workqueue_struct *workqueue;
struct delayed_work delay_work;

View File

@@ -78,6 +78,10 @@ void hdmi_sys_remove(void)
memset(&hdmi->edid, 0, sizeof(struct hdmi_edid));
INIT_LIST_HEAD(&hdmi->edid.modelist);
hdmi->display = HDMI_DISABLE;
kobject_uevent_env(&hdmi->dev->kobj, KOBJ_REMOVE, envp);
#ifdef CONFIG_SWITCH
switch_set_state(&(hdmi->switch_hdmi), 0);
#endif
}
static void hdmi_sys_sleep(void)
@@ -188,7 +192,6 @@ void hdmi_work(struct work_struct *work)
complete(&hdmi->complete);
hdmi->wait = 0;
}
kobject_uevent_env(&hdmi->dev->kobj, KOBJ_REMOVE, envp);
mutex_unlock(&work_mutex);
return;
}
@@ -210,6 +213,9 @@ void hdmi_work(struct work_struct *work)
{
hdmi->state = SYSTEM_CONFIG;
kobject_uevent_env(&hdmi->dev->kobj, KOBJ_ADD, envp);
#ifdef CONFIG_SWITCH
switch_set_state(&(hdmi->switch_hdmi), 1);
#endif
}
break;
case SYSTEM_CONFIG: