diff options
Diffstat (limited to 'drivers/video/mxc/mxc_hdmi.c')
-rw-r--r-- | drivers/video/mxc/mxc_hdmi.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/drivers/video/mxc/mxc_hdmi.c b/drivers/video/mxc/mxc_hdmi.c index 76716d9429f8..fb17c89cb27d 100644 --- a/drivers/video/mxc/mxc_hdmi.c +++ b/drivers/video/mxc/mxc_hdmi.c @@ -54,6 +54,7 @@ #include <linux/console.h> #include <linux/types.h> +#include <linux/switch.h> #include "../edid.h" #include <video/mxc_edid.h> @@ -176,6 +177,8 @@ struct mxc_hdmi { struct fb_videomode default_mode; struct fb_videomode previous_non_vga_mode; bool requesting_vga_for_initialization; + struct switch_dev sdev_audio; + struct switch_dev sdev_display; int *gpr_base; int *gpr_hdmi_base; @@ -2012,14 +2015,22 @@ static void hotplug_worker(struct work_struct *work) hdmi_set_cable_state(1); + if (!hdmi->hdmi_data.video_mode.mDVI) + switch_set_state(&hdmi->sdev_audio, 1); + switch_set_state(&hdmi->sdev_display, 1); + sprintf(event_string, "EVENT=plugin"); kobject_uevent_env(&hdmi->pdev->dev.kobj, KOBJ_CHANGE, envp); #ifdef CONFIG_MXC_HDMI_CEC mxc_hdmi_cec_handle(0x80); #endif + } else if (!(phy_int_pol & HDMI_PHY_HPD)) { /* Plugout event */ dev_dbg(&hdmi->pdev->dev, "EVENT=plugout\n"); + switch_set_state(&hdmi->sdev_audio, 0); + switch_set_state(&hdmi->sdev_display, 0); + hdmi_set_cable_state(0); mxc_hdmi_abort_stream(); mxc_hdmi_cable_disconnected(hdmi); @@ -2286,6 +2297,7 @@ static int mxc_hdmi_fb_event(struct notifier_block *nb, { struct fb_event *event = v; struct mxc_hdmi *hdmi = container_of(nb, struct mxc_hdmi, nb); + struct fb_videomode *mode; if (strcmp(event->info->fix.id, hdmi->fbi->fix.id)) return 0; @@ -2305,7 +2317,10 @@ static int mxc_hdmi_fb_event(struct notifier_block *nb, case FB_EVENT_MODE_CHANGE: dev_dbg(&hdmi->pdev->dev, "event=FB_EVENT_MODE_CHANGE\n"); - if (hdmi->fb_reg) + mode = (struct fb_videomode *)event->data; + if ((hdmi->fb_reg) && + (mode != NULL) && + !fb_mode_is_equal(&hdmi->previous_non_vga_mode, mode)) mxc_hdmi_setup(hdmi, val); break; @@ -2798,10 +2813,18 @@ static int mxc_hdmi_probe(struct platform_device *pdev) ret = (int)hdmi->disp_mxc_hdmi; goto edispdrv; } + + hdmi->sdev_audio.name = "hdmi_audio"; + hdmi->sdev_display.name = "hdmi"; + switch_dev_register(&hdmi->sdev_audio); + switch_dev_register(&hdmi->sdev_display); + mxc_dispdrv_setdata(hdmi->disp_mxc_hdmi, hdmi); platform_set_drvdata(pdev, hdmi); + mxc_dispdrv_setdev(hdmi->disp_mxc_hdmi, &pdev->dev); + return 0; edispdrv: iounmap(hdmi->gpr_base); @@ -2825,6 +2848,9 @@ static int mxc_hdmi_remove(struct platform_device *pdev) fb_unregister_client(&hdmi->nb); + switch_dev_unregister(&hdmi->sdev_audio); + switch_dev_unregister(&hdmi->sdev_display); + mxc_dispdrv_puthandle(hdmi->disp_mxc_hdmi); mxc_dispdrv_unregister(hdmi->disp_mxc_hdmi); iounmap(hdmi->gpr_base); |