Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 458981c3 authored by Laurent Pinchart's avatar Laurent Pinchart
Browse files

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: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
parent 5864ace1
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -412,7 +412,7 @@ static int mipi_display_on(struct sh_mobile_lcdc_entity *entity)


	sh_mipi_dsi_enable(mipi, true);
	sh_mipi_dsi_enable(mipi, true);


	return 0;
	return SH_MOBILE_LCDC_DISPLAY_CONNECTED;


mipi_display_on_fail1:
mipi_display_on_fail1:
	pm_runtime_put_sync(&mipi->pdev->dev);
	pm_runtime_put_sync(&mipi->pdev->dev);
+5 −4
Original line number Original line Diff line number Diff line
@@ -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_hdmi *hdmi = entity_to_sh_hdmi(entity);
	struct sh_mobile_lcdc_chan *ch = entity->lcdc;
	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
	 * 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");
		dev_dbg(hdmi->dev, "HDMI running\n");
		break;
		break;
	case HDMI_HOTPLUG_DISCONNECTED:
	case HDMI_HOTPLUG_DISCONNECTED:
		info->state = FBINFO_STATE_SUSPENDED;
	default:
	default:
		hdmi->var = ch->display_var;
		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)
static void sh_hdmi_display_off(struct sh_mobile_lcdc_entity *entity)
+7 −1
Original line number Original line Diff line number Diff line
@@ -338,8 +338,14 @@ static void sh_mobile_lcdc_display_on(struct sh_mobile_lcdc_chan *ch)
	struct sh_mobile_lcdc_panel_cfg *panel = &ch->cfg.panel_cfg;
	struct sh_mobile_lcdc_panel_cfg *panel = &ch->cfg.panel_cfg;


	if (ch->tx_dev) {
	if (ch->tx_dev) {
		if (ch->tx_dev->ops->display_on(ch->tx_dev) < 0)
		int ret;

		ret = ch->tx_dev->ops->display_on(ch->tx_dev);
		if (ret < 0)
			return;
			return;

		if (ret == SH_MOBILE_LCDC_DISPLAY_DISCONNECTED)
			ch->info->state = FBINFO_STATE_SUSPENDED;
	}
	}


	/* HDMI must be enabled before LCDC configuration */
	/* HDMI must be enabled before LCDC configuration */
+3 −0
Original line number Original line Diff line number Diff line
@@ -21,6 +21,9 @@ struct sh_mobile_lcdc_entity;
struct sh_mobile_lcdc_priv;
struct sh_mobile_lcdc_priv;
struct sh_mobile_lcdc_chan;
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 {
struct sh_mobile_lcdc_entity_ops {
	/* Display */
	/* Display */
	int (*display_on)(struct sh_mobile_lcdc_entity *entity);
	int (*display_on)(struct sh_mobile_lcdc_entity *entity);