diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2011-11-28 17:19:59 -0500 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2012-03-12 17:40:52 -0400 |
commit | 458981c3886133667e020900f53538f1fbc3ea1d (patch) | |
tree | 6407e8c02cb4715dde31cdef9685f175dae6043b | |
parent | 5864ace19a2546912308e94432c1cf52d5945afe (diff) |
fbdev: sh_mobile_lcdc: Return display connection state in display_on
Return true if the display is connected and false otherwise. Set the fb
info state to FBINFO_STATE_SUSPENDED in the sh_mobile_lcdc driver when
the display is not connected.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r-- | drivers/video/sh_mipi_dsi.c | 2 | ||||
-rw-r--r-- | drivers/video/sh_mobile_hdmi.c | 9 | ||||
-rw-r--r-- | drivers/video/sh_mobile_lcdcfb.c | 8 | ||||
-rw-r--r-- | drivers/video/sh_mobile_lcdcfb.h | 3 |
4 files changed, 16 insertions, 6 deletions
diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c index 1ede247547f9..5ff3742aeb08 100644 --- a/drivers/video/sh_mipi_dsi.c +++ b/drivers/video/sh_mipi_dsi.c | |||
@@ -412,7 +412,7 @@ static int mipi_display_on(struct sh_mobile_lcdc_entity *entity) | |||
412 | 412 | ||
413 | sh_mipi_dsi_enable(mipi, true); | 413 | sh_mipi_dsi_enable(mipi, true); |
414 | 414 | ||
415 | return 0; | 415 | return SH_MOBILE_LCDC_DISPLAY_CONNECTED; |
416 | 416 | ||
417 | mipi_display_on_fail1: | 417 | mipi_display_on_fail1: |
418 | pm_runtime_put_sync(&mipi->pdev->dev); | 418 | pm_runtime_put_sync(&mipi->pdev->dev); |
diff --git a/drivers/video/sh_mobile_hdmi.c b/drivers/video/sh_mobile_hdmi.c index c22e123ec401..1464abf81a40 100644 --- a/drivers/video/sh_mobile_hdmi.c +++ b/drivers/video/sh_mobile_hdmi.c | |||
@@ -1004,9 +1004,9 @@ static int sh_hdmi_display_on(struct sh_mobile_lcdc_entity *entity) | |||
1004 | { | 1004 | { |
1005 | struct sh_hdmi *hdmi = entity_to_sh_hdmi(entity); | 1005 | struct sh_hdmi *hdmi = entity_to_sh_hdmi(entity); |
1006 | struct sh_mobile_lcdc_chan *ch = entity->lcdc; | 1006 | struct sh_mobile_lcdc_chan *ch = entity->lcdc; |
1007 | struct fb_info *info = ch->info; | ||
1008 | 1007 | ||
1009 | dev_dbg(hdmi->dev, "%s(%p): state %x\n", __func__, hdmi, info->state); | 1008 | dev_dbg(hdmi->dev, "%s(%p): state %x\n", __func__, hdmi, |
1009 | hdmi->hp_state); | ||
1010 | 1010 | ||
1011 | /* | 1011 | /* |
1012 | * hp_state can be set to | 1012 | * hp_state can be set to |
@@ -1021,12 +1021,13 @@ static int sh_hdmi_display_on(struct sh_mobile_lcdc_entity *entity) | |||
1021 | dev_dbg(hdmi->dev, "HDMI running\n"); | 1021 | dev_dbg(hdmi->dev, "HDMI running\n"); |
1022 | break; | 1022 | break; |
1023 | case HDMI_HOTPLUG_DISCONNECTED: | 1023 | case HDMI_HOTPLUG_DISCONNECTED: |
1024 | info->state = FBINFO_STATE_SUSPENDED; | ||
1025 | default: | 1024 | default: |
1026 | hdmi->var = ch->display_var; | 1025 | hdmi->var = ch->display_var; |
1027 | } | 1026 | } |
1028 | 1027 | ||
1029 | return 0; | 1028 | return hdmi->hp_state == HDMI_HOTPLUG_DISCONNECTED |
1029 | ? SH_MOBILE_LCDC_DISPLAY_DISCONNECTED | ||
1030 | : SH_MOBILE_LCDC_DISPLAY_CONNECTED; | ||
1030 | } | 1031 | } |
1031 | 1032 | ||
1032 | static void sh_hdmi_display_off(struct sh_mobile_lcdc_entity *entity) | 1033 | static void sh_hdmi_display_off(struct sh_mobile_lcdc_entity *entity) |
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c index 03ee3826fb62..5a19ef3f215c 100644 --- a/drivers/video/sh_mobile_lcdcfb.c +++ b/drivers/video/sh_mobile_lcdcfb.c | |||
@@ -338,8 +338,14 @@ static void sh_mobile_lcdc_display_on(struct sh_mobile_lcdc_chan *ch) | |||
338 | struct sh_mobile_lcdc_panel_cfg *panel = &ch->cfg.panel_cfg; | 338 | struct sh_mobile_lcdc_panel_cfg *panel = &ch->cfg.panel_cfg; |
339 | 339 | ||
340 | if (ch->tx_dev) { | 340 | if (ch->tx_dev) { |
341 | if (ch->tx_dev->ops->display_on(ch->tx_dev) < 0) | 341 | int ret; |
342 | |||
343 | ret = ch->tx_dev->ops->display_on(ch->tx_dev); | ||
344 | if (ret < 0) | ||
342 | return; | 345 | return; |
346 | |||
347 | if (ret == SH_MOBILE_LCDC_DISPLAY_DISCONNECTED) | ||
348 | ch->info->state = FBINFO_STATE_SUSPENDED; | ||
343 | } | 349 | } |
344 | 350 | ||
345 | /* HDMI must be enabled before LCDC configuration */ | 351 | /* HDMI must be enabled before LCDC configuration */ |
diff --git a/drivers/video/sh_mobile_lcdcfb.h b/drivers/video/sh_mobile_lcdcfb.h index b2cb8e6d098c..6fb956c8e603 100644 --- a/drivers/video/sh_mobile_lcdcfb.h +++ b/drivers/video/sh_mobile_lcdcfb.h | |||
@@ -21,6 +21,9 @@ struct sh_mobile_lcdc_entity; | |||
21 | struct sh_mobile_lcdc_priv; | 21 | struct sh_mobile_lcdc_priv; |
22 | struct sh_mobile_lcdc_chan; | 22 | struct sh_mobile_lcdc_chan; |
23 | 23 | ||
24 | #define SH_MOBILE_LCDC_DISPLAY_DISCONNECTED 0 | ||
25 | #define SH_MOBILE_LCDC_DISPLAY_CONNECTED 1 | ||
26 | |||
24 | struct sh_mobile_lcdc_entity_ops { | 27 | struct sh_mobile_lcdc_entity_ops { |
25 | /* Display */ | 28 | /* Display */ |
26 | int (*display_on)(struct sh_mobile_lcdc_entity *entity); | 29 | int (*display_on)(struct sh_mobile_lcdc_entity *entity); |