VIDEO_INPUT_COLOR_YCBCR422,
VIDEO_INPUT_COLOR_YCBCR420
};
-/********************************************************************
-** ½á¹¹¶¨Òå *
-********************************************************************/
+
/* HDMI video mode code according CEA-861-E */
enum hdmi_video_mode {
HDMI_640x480p_60Hz = 1,
struct hdmi_audio *audio; /* Device supported audio info */
int audio_num; /* Device supported audio type number */
int base_audio_support; /* Device supported base audio */
- unsigned int cecaddress; //CEC physical address
+ unsigned int cecaddress; /* CEC physical address */
};
/* RK HDMI Video Configure Parameters */
int irq;
struct rk_lcdc_driver *lcdc;
struct rk_hdmi_drvdata *data;
-
+ struct rk_display_device *ddev;
#ifdef CONFIG_SWITCH
struct switch_dev switch_hdmi;
#endif
struct list_head pwrlist_head;
- int (*insert) (struct hdmi *hdmi);
- int (*remove) (struct hdmi *hdmi);
- void (*control_output) (struct hdmi *hdmi, int enable);
- int (*config_video) (struct hdmi *hdmi,
+ int (*insert)(struct hdmi *hdmi);
+ int (*remove)(struct hdmi *hdmi);
+ void (*control_output)(struct hdmi *hdmi, int enable);
+ int (*config_video)(struct hdmi *hdmi,
struct hdmi_video_para *vpara);
- int (*config_audio) (struct hdmi *hdmi, struct hdmi_audio *audio);
- int (*detect_hotplug) (struct hdmi *hdmi);
+ int (*config_audio)(struct hdmi *hdmi, struct hdmi_audio *audio);
+ int (*detect_hotplug)(struct hdmi *hdmi);
/* call back for edid */
- int (*read_edid) (struct hdmi *hdmi, int block, unsigned char *buff);
- int (*set_vif) (struct hdmi *hdmi, struct rk_screen *screen,
+ int (*read_edid)(struct hdmi *hdmi, int block, unsigned char *buff);
+ int (*set_vif)(struct hdmi *hdmi, struct rk_screen *screen,
bool connect);
/* call back for hdcp operation */
- void (*hdcp_cb) (void);
- void (*hdcp_irq_cb) (int);
- int (*hdcp_power_on_cb) (void);
- void (*hdcp_power_off_cb) (void);
+ void (*hdcp_cb)(void);
+ void (*hdcp_irq_cb)(int);
+ int (*hdcp_power_on_cb)(void);
+ void (*hdcp_power_off_cb)(void);
/*call back for cec operation*/
- void (*cec_irq) (void);
- void (*cec_set_device_pa) (int);
- int (*cec_enumerate) (void);
+ void (*cec_irq)(void);
+ void (*cec_set_device_pa)(int);
+ int (*cec_enumerate)(void);
};
#define hdmi_err(dev, format, arg...) \
#define hdmi_dbg(dev, format, arg...)
#endif
-extern int hdmi_drv_register(struct hdmi *hdmi_drv);
-extern int hdmi_get_hotplug(void);
-extern int hdmi_set_info(struct rk_screen *screen, unsigned int vic);
-extern void hdmi_init_lcdc(struct rk_screen *screen,
+int hdmi_drv_register(struct hdmi *hdmi_drv);
+int hdmi_get_hotplug(void);
+int hdmi_set_info(struct rk_screen *screen, unsigned int vic);
+void hdmi_init_lcdc(struct rk_screen *screen,
struct rk29lcd_info *lcd_info);
-extern int hdmi_sys_init(struct hdmi *hdmi_drv);
-extern int hdmi_sys_parse_edid(struct hdmi *hdmi_drv);
-extern const char *hdmi_get_video_mode_name(unsigned char vic);
-extern int hdmi_videomode_to_vic(struct fb_videomode *vmode);
-extern const struct fb_videomode *hdmi_vic_to_videomode(int vic);
-extern int hdmi_add_videomode(const struct fb_videomode *mode,
+int hdmi_sys_init(struct hdmi *hdmi_drv);
+int hdmi_sys_parse_edid(struct hdmi *hdmi_drv);
+const char *hdmi_get_video_mode_name(unsigned char vic);
+int hdmi_videomode_to_vic(struct fb_videomode *vmode);
+const struct fb_videomode *hdmi_vic_to_videomode(int vic);
+int hdmi_add_videomode(const struct fb_videomode *mode,
struct list_head *head);
-extern struct hdmi_video_timing *hdmi_find_mode(int vic);
-extern int hdmi_find_best_mode(struct hdmi *hdmi_drv, int vic);
-extern int hdmi_ouputmode_select(struct hdmi *hdmi_drv, int edid_ok);
-extern int hdmi_switch_fb(struct hdmi *hdmi_drv, int vic);
-extern int hdmi_init_video_para(struct hdmi *hdmi_drv,
+struct hdmi_video_timing *hdmi_find_mode(int vic);
+int hdmi_find_best_mode(struct hdmi *hdmi_drv, int vic);
+int hdmi_ouputmode_select(struct hdmi *hdmi_drv, int edid_ok);
+int hdmi_switch_fb(struct hdmi *hdmi_drv, int vic);
+int hdmi_init_video_para(struct hdmi *hdmi_drv,
struct hdmi_video_para *video);
-extern void hdmi_work(struct work_struct *work);
-extern void hdmi_register_display_sysfs(struct hdmi *hdmi_drv,
+void hdmi_work(struct work_struct *work);
+void hdmi_register_display_sysfs(struct hdmi *hdmi_drv,
struct device *parent);
-extern void hdmi_unregister_display_sysfs(struct hdmi *hdmi_drv);
+void hdmi_unregister_display_sysfs(struct hdmi *hdmi_drv);
int rk_hdmi_parse_dt(struct hdmi *hdmi_drv);
int rk_hdmi_pwr_enable(struct hdmi *dev_drv);
static int hdmi_get_status(struct rk_display_device *device)
{
struct hdmi *hdmi = device->priv_data;
+
if (hdmi->hotplug == HDMI_HPD_ACTIVED)
return 1;
else
struct list_head **modelist)
{
struct hdmi *hdmi = device->priv_data;
+
if (!hdmi->hotplug)
return -1;
*modelist = &hdmi->edid.modelist;
.probe = hdmi_display_probe,
};
-static struct rk_display_device *display_device_hdmi;
#ifdef CONFIG_DRM_ROCKCHIP
extern void rk_drm_display_register(struct rk_display_ops *extend_ops,
void *displaydata, int type);
void hdmi_register_display_sysfs(struct hdmi *hdmi, struct device *parent)
{
- display_device_hdmi =
+ hdmi->ddev =
rk_display_device_register(&display_hdmi, parent, hdmi);
#ifdef CONFIG_DRM_ROCKCHIP
rk_drm_display_register(&hdmi_display_ops, hdmi, SCREEN_HDMI);
void hdmi_unregister_display_sysfs(struct hdmi *hdmi)
{
- if (display_device_hdmi)
- rk_display_device_unregister(display_device_hdmi);
+ if (hdmi->ddev)
+ rk_display_device_unregister(hdmi->ddev);
}
#endif
{
int audio_need;
- audio_need = hdmi->edid.base_audio_support == 1
- && hdmi->edid.sink_hdmi == 1;
+ audio_need = hdmi->edid.base_audio_support == 1 &&
+ hdmi->edid.sink_hdmi == 1;
fb_destroy_modelist(&hdmi->edid.modelist);
kfree(hdmi->edid.audio);
if (hdmi->set_vif)
hdmi->set_vif(hdmi, hdmi->lcdc->screen1, 0);
rk_fb_switch_screen(hdmi->lcdc->screen1, 0, hdmi->lcdc->id);
- kobject_uevent_env(&hdmi->dev->kobj, KOBJ_REMOVE, envp);
+ kobject_uevent_env(&hdmi->ddev->dev->kobj, KOBJ_REMOVE, envp);
#ifdef CONFIG_SWITCH
if (audio_need)
break;
case HDMI_CONFIG_VIDEO:
default:
- if (state > SYSTEM_CONFIG)
+ if (state > SYSTEM_CONFIG) {
state = SYSTEM_CONFIG;
- else {
+ } else {
if (hdmi->wait == 1) {
complete(&hdmi->complete);
hdmi->wait = 0;
}
break;
}
- } else if (state == HDMI_SLEEP)
+ } else if (state == HDMI_SLEEP) {
state = WAIT_HOTPLUG;
+ }
return state;
}
} else if (hdmi->hotplug == HDMI_HPD_ACTIVED) {
hdmi->hotplug = hotplug;
hdmi_sys_remove(hdmi);
- if (hotplug == HDMI_HPD_REMOVED)
+ if (hotplug == HDMI_HPD_REMOVED) {
hdmi_sys_sleep(hdmi);
- else {
+ } else {
hdmi->state = WAIT_HOTPLUG;
hdmi->remove(hdmi);
}
hdmi->remove(hdmi);
}
hdmi->hotplug = hotplug;
- } else if (hotplug == HDMI_HPD_REMOVED)
+ } else if (hotplug == HDMI_HPD_REMOVED) {
hdmi_sys_sleep(hdmi);
-
+ }
do {
hdmi_sys_show_state(hdmi);
state_last = hdmi->state;
case READ_PARSE_EDID:
rc = hdmi_sys_parse_edid(hdmi);
if (rc == HDMI_ERROR_SUCESS) {
- if(hdmi->cec_set_device_pa)
+ if (hdmi->cec_set_device_pa)
hdmi->cec_set_device_pa(hdmi->edid.cecaddress);
- if(hdmi->cec_enumerate)
+ if (hdmi->cec_enumerate)
hdmi->cec_enumerate();
hdmi->state = SYSTEM_CONFIG;
- kobject_uevent_env(&hdmi->dev->kobj, KOBJ_ADD,
- envp);
+ kobject_uevent_env(&hdmi->ddev->dev->kobj,
+ KOBJ_ADD, envp);
hdmi_dbg(hdmi->dev,
"[%s] base_audio_support =%d,sink_hdmi = %d\n",
__func__,
hdmi->edid.base_audio_support,
hdmi->edid.sink_hdmi);
#ifdef CONFIG_SWITCH
- if (hdmi->edid.base_audio_support == 1
- && hdmi->edid.sink_hdmi == 1)
+ if (hdmi->edid.base_audio_support == 1 &&
+ hdmi->edid.sink_hdmi == 1)
switch_set_state(&(hdmi->switch_hdmi),
1);
#endif
if (hdmi->display != HDMI_ENABLE) {
hdmi->control_output(hdmi, HDMI_ENABLE);
hdmi->display = HDMI_ENABLE;
- if (hdmi->hdcp_cb) {
+ if (hdmi->hdcp_cb)
hdmi->hdcp_cb();
- }
}
if (hdmi->wait == 1) {
if (hdmi->state != state_last)
trytimes = 0;
- } while ((hdmi->state != state_last || (rc != HDMI_ERROR_SUCESS))
- && trytimes < HDMI_MAX_TRY_TIMES);
+ } while ((hdmi->state != state_last ||
+ (rc != HDMI_ERROR_SUCESS)) &&
+ trytimes < HDMI_MAX_TRY_TIMES);
hdmi_dbg(hdmi->dev, "[%s] done\n", __func__);
mutex_unlock(&work_mutex);