* [PATCH 24/57] fbdev: sh_mobile_lcdc: Return display connection state in display_on
@ 2011-12-13 14:02 Laurent Pinchart
2011-12-15 17:11 ` [PATCH 24/57] fbdev: sh_mobile_lcdc: Return display connection Guennadi Liakhovetski
2011-12-19 0:21 ` [PATCH 24/57] fbdev: sh_mobile_lcdc: Return display connection state in display_on Laurent Pinchart
0 siblings, 2 replies; 3+ messages in thread
From: Laurent Pinchart @ 2011-12-13 14:02 UTC (permalink / raw)
To: linux-fbdev
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>
---
drivers/video/sh_mipi_dsi.c | 2 +-
drivers/video/sh_mobile_hdmi.c | 9 +++++----
drivers/video/sh_mobile_lcdcfb.c | 3 +++
drivers/video/sh_mobile_lcdcfb.h | 3 +++
4 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c
index 1ede247..5ff3742 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)
sh_mipi_dsi_enable(mipi, true);
- return 0;
+ return SH_MOBILE_LCDC_DISPLAY_CONNECTED;
mipi_display_on_fail1:
pm_runtime_put_sync(&mipi->pdev->dev);
diff --git a/drivers/video/sh_mobile_hdmi.c b/drivers/video/sh_mobile_hdmi.c
index c22e123..1464abf 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)
{
struct sh_hdmi *hdmi = entity_to_sh_hdmi(entity);
struct sh_mobile_lcdc_chan *ch = entity->lcdc;
- struct fb_info *info = ch->info;
- dev_dbg(hdmi->dev, "%s(%p): state %x\n", __func__, hdmi, info->state);
+ dev_dbg(hdmi->dev, "%s(%p): state %x\n", __func__, hdmi,
+ hdmi->hp_state);
/*
* hp_state can be set to
@@ -1021,12 +1021,13 @@ static int sh_hdmi_display_on(struct sh_mobile_lcdc_entity *entity)
dev_dbg(hdmi->dev, "HDMI running\n");
break;
case HDMI_HOTPLUG_DISCONNECTED:
- info->state = FBINFO_STATE_SUSPENDED;
default:
hdmi->var = ch->display_var;
}
- return 0;
+ return hdmi->hp_state = HDMI_HOTPLUG_DISCONNECTED
+ ? SH_MOBILE_LCDC_DISPLAY_DISCONNECTED
+ : SH_MOBILE_LCDC_DISPLAY_CONNECTED;
}
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 47108aa..4b03aa5 100644
--- a/drivers/video/sh_mobile_lcdcfb.c
+++ b/drivers/video/sh_mobile_lcdcfb.c
@@ -342,6 +342,9 @@ static void sh_mobile_lcdc_display_on(struct sh_mobile_lcdc_chan *ch)
ret = ch->tx_dev->ops->display_on(ch->tx_dev);
if (ret < 0)
return;
+
+ if (ret = SH_MOBILE_LCDC_DISPLAY_DISCONNECTED)
+ ch->info->state = FBINFO_STATE_SUSPENDED;
}
/* HDMI must be enabled before LCDC configuration */
diff --git a/drivers/video/sh_mobile_lcdcfb.h b/drivers/video/sh_mobile_lcdcfb.h
index b2cb8e6..6fb956c 100644
--- a/drivers/video/sh_mobile_lcdcfb.h
+++ b/drivers/video/sh_mobile_lcdcfb.h
@@ -21,6 +21,9 @@ struct sh_mobile_lcdc_entity;
struct sh_mobile_lcdc_priv;
struct sh_mobile_lcdc_chan;
+#define SH_MOBILE_LCDC_DISPLAY_DISCONNECTED 0
+#define SH_MOBILE_LCDC_DISPLAY_CONNECTED 1
+
struct sh_mobile_lcdc_entity_ops {
/* Display */
int (*display_on)(struct sh_mobile_lcdc_entity *entity);
--
1.7.3.4
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH 24/57] fbdev: sh_mobile_lcdc: Return display connection
2011-12-13 14:02 [PATCH 24/57] fbdev: sh_mobile_lcdc: Return display connection state in display_on Laurent Pinchart
@ 2011-12-15 17:11 ` Guennadi Liakhovetski
2011-12-19 0:21 ` [PATCH 24/57] fbdev: sh_mobile_lcdc: Return display connection state in display_on Laurent Pinchart
1 sibling, 0 replies; 3+ messages in thread
From: Guennadi Liakhovetski @ 2011-12-15 17:11 UTC (permalink / raw)
To: linux-fbdev
On Tue, 13 Dec 2011, Laurent Pinchart wrote:
> 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.
Hmm... I'm not sure I like functions, that return either a negative error,
or _several_ non-negative success values. How about returning -ENODEV?
Thanks
Guennadi
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
> drivers/video/sh_mipi_dsi.c | 2 +-
> drivers/video/sh_mobile_hdmi.c | 9 +++++----
> drivers/video/sh_mobile_lcdcfb.c | 3 +++
> drivers/video/sh_mobile_lcdcfb.h | 3 +++
> 4 files changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c
> index 1ede247..5ff3742 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)
>
> sh_mipi_dsi_enable(mipi, true);
>
> - return 0;
> + return SH_MOBILE_LCDC_DISPLAY_CONNECTED;
>
> mipi_display_on_fail1:
> pm_runtime_put_sync(&mipi->pdev->dev);
> diff --git a/drivers/video/sh_mobile_hdmi.c b/drivers/video/sh_mobile_hdmi.c
> index c22e123..1464abf 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)
> {
> struct sh_hdmi *hdmi = entity_to_sh_hdmi(entity);
> struct sh_mobile_lcdc_chan *ch = entity->lcdc;
> - struct fb_info *info = ch->info;
>
> - dev_dbg(hdmi->dev, "%s(%p): state %x\n", __func__, hdmi, info->state);
> + dev_dbg(hdmi->dev, "%s(%p): state %x\n", __func__, hdmi,
> + hdmi->hp_state);
>
> /*
> * hp_state can be set to
> @@ -1021,12 +1021,13 @@ static int sh_hdmi_display_on(struct sh_mobile_lcdc_entity *entity)
> dev_dbg(hdmi->dev, "HDMI running\n");
> break;
> case HDMI_HOTPLUG_DISCONNECTED:
> - info->state = FBINFO_STATE_SUSPENDED;
> default:
> hdmi->var = ch->display_var;
> }
>
> - return 0;
> + return hdmi->hp_state = HDMI_HOTPLUG_DISCONNECTED
> + ? SH_MOBILE_LCDC_DISPLAY_DISCONNECTED
> + : SH_MOBILE_LCDC_DISPLAY_CONNECTED;
> }
>
> 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 47108aa..4b03aa5 100644
> --- a/drivers/video/sh_mobile_lcdcfb.c
> +++ b/drivers/video/sh_mobile_lcdcfb.c
> @@ -342,6 +342,9 @@ static void sh_mobile_lcdc_display_on(struct sh_mobile_lcdc_chan *ch)
> ret = ch->tx_dev->ops->display_on(ch->tx_dev);
> if (ret < 0)
> return;
> +
> + if (ret = SH_MOBILE_LCDC_DISPLAY_DISCONNECTED)
> + ch->info->state = FBINFO_STATE_SUSPENDED;
> }
>
> /* HDMI must be enabled before LCDC configuration */
> diff --git a/drivers/video/sh_mobile_lcdcfb.h b/drivers/video/sh_mobile_lcdcfb.h
> index b2cb8e6..6fb956c 100644
> --- a/drivers/video/sh_mobile_lcdcfb.h
> +++ b/drivers/video/sh_mobile_lcdcfb.h
> @@ -21,6 +21,9 @@ struct sh_mobile_lcdc_entity;
> struct sh_mobile_lcdc_priv;
> struct sh_mobile_lcdc_chan;
>
> +#define SH_MOBILE_LCDC_DISPLAY_DISCONNECTED 0
> +#define SH_MOBILE_LCDC_DISPLAY_CONNECTED 1
> +
> struct sh_mobile_lcdc_entity_ops {
> /* Display */
> int (*display_on)(struct sh_mobile_lcdc_entity *entity);
> --
> 1.7.3.4
>
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH 24/57] fbdev: sh_mobile_lcdc: Return display connection state in display_on
2011-12-13 14:02 [PATCH 24/57] fbdev: sh_mobile_lcdc: Return display connection state in display_on Laurent Pinchart
2011-12-15 17:11 ` [PATCH 24/57] fbdev: sh_mobile_lcdc: Return display connection Guennadi Liakhovetski
@ 2011-12-19 0:21 ` Laurent Pinchart
1 sibling, 0 replies; 3+ messages in thread
From: Laurent Pinchart @ 2011-12-19 0:21 UTC (permalink / raw)
To: linux-fbdev
Hi Guennadi,
On Thursday 15 December 2011 18:11:03 Guennadi Liakhovetski wrote:
> On Tue, 13 Dec 2011, Laurent Pinchart wrote:
> > 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.
>
> Hmm... I'm not sure I like functions, that return either a negative error,
> or _several_ non-negative success values. How about returning -ENODEV?
That would be returning a negative error on success. Is that better ? :-)
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-12-19 0:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-13 14:02 [PATCH 24/57] fbdev: sh_mobile_lcdc: Return display connection state in display_on Laurent Pinchart
2011-12-15 17:11 ` [PATCH 24/57] fbdev: sh_mobile_lcdc: Return display connection Guennadi Liakhovetski
2011-12-19 0:21 ` [PATCH 24/57] fbdev: sh_mobile_lcdc: Return display connection state in display_on Laurent Pinchart
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox