Commit 19b4200d authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Tomi Valkeinen
Browse files

drm/omap: Reverse direction of the DSS device enable/disable operations



The omapdrm and omapdss drivers are architectured based on display
pipelines made of multiple components handled from sink (display) to
source (DSS output). This is incompatible with the DRM bridge and panel
APIs that handle components from source to sink.

Reconcile the omapdrm and omapdss drivers with the DRM bridge and panel
model by reversing the direction of the DSS device .enable() and
.disable() operations. This completes the move to the DRM bridge model,
with the notable exception of the DSI pipelines that will require more
work.

We also adapt the omapdss shutdown handler dss_shutdown() to shut down
all active pipelines starting from the pipeline output device instead of
the display device.

As a consequence the for_each_dss_display() macro isn't used and can be
removed, and the omapdss_device_get_next() function underlying the macro
can be simplified to search for output devices only.

Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
Tested-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent 3f3623dd
Loading
Loading
Loading
Loading
+0 −21
Original line number Diff line number Diff line
@@ -35,26 +35,9 @@ static void tvc_disconnect(struct omap_dss_device *src,
{
}

static int tvc_enable(struct omap_dss_device *dssdev)
{
	struct omap_dss_device *src = dssdev->src;

	return src->ops->enable(src);
}

static void tvc_disable(struct omap_dss_device *dssdev)
{
	struct omap_dss_device *src = dssdev->src;

	src->ops->disable(src);
}

static const struct omap_dss_device_ops tvc_ops = {
	.connect		= tvc_connect,
	.disconnect		= tvc_disconnect,

	.enable			= tvc_enable,
	.disable		= tvc_disable,
};

static int tvc_probe(struct platform_device *pdev)
@@ -85,13 +68,9 @@ static int tvc_probe(struct platform_device *pdev)
static int __exit tvc_remove(struct platform_device *pdev)
{
	struct panel_drv_data *ddata = platform_get_drvdata(pdev);
	struct omap_dss_device *dssdev = &ddata->dssdev;

	omapdss_device_unregister(&ddata->dssdev);

	if (omapdss_device_is_enabled(dssdev))
		tvc_disable(dssdev);

	return 0;
}

+0 −21
Original line number Diff line number Diff line
@@ -46,20 +46,6 @@ static void dvic_disconnect(struct omap_dss_device *src,
{
}

static int dvic_enable(struct omap_dss_device *dssdev)
{
	struct omap_dss_device *src = dssdev->src;

	return src->ops->enable(src);
}

static void dvic_disable(struct omap_dss_device *dssdev)
{
	struct omap_dss_device *src = dssdev->src;

	src->ops->disable(src);
}

static int dvic_ddc_read(struct i2c_adapter *adapter,
		unsigned char *buf, u16 count, u8 offset)
{
@@ -163,9 +149,6 @@ static const struct omap_dss_device_ops dvic_ops = {
	.connect	= dvic_connect,
	.disconnect	= dvic_disconnect,

	.enable		= dvic_enable,
	.disable	= dvic_disable,

	.read_edid	= dvic_read_edid,
	.detect		= dvic_detect,

@@ -275,13 +258,9 @@ static int dvic_probe(struct platform_device *pdev)
static int __exit dvic_remove(struct platform_device *pdev)
{
	struct panel_drv_data *ddata = platform_get_drvdata(pdev);
	struct omap_dss_device *dssdev = &ddata->dssdev;

	omapdss_device_unregister(&ddata->dssdev);

	if (omapdss_device_is_enabled(dssdev))
		dvic_disable(dssdev);

	i2c_put_adapter(ddata->i2c_adapter);

	mutex_destroy(&ddata->hpd_lock);
+0 −21
Original line number Diff line number Diff line
@@ -41,20 +41,6 @@ static void hdmic_disconnect(struct omap_dss_device *src,
{
}

static int hdmic_enable(struct omap_dss_device *dssdev)
{
	struct omap_dss_device *src = dssdev->src;

	return src->ops->enable(src);
}

static void hdmic_disable(struct omap_dss_device *dssdev)
{
	struct omap_dss_device *src = dssdev->src;

	src->ops->disable(src);
}

static bool hdmic_detect(struct omap_dss_device *dssdev)
{
	struct panel_drv_data *ddata = to_panel_data(dssdev);
@@ -89,9 +75,6 @@ static const struct omap_dss_device_ops hdmic_ops = {
	.connect		= hdmic_connect,
	.disconnect		= hdmic_disconnect,

	.enable			= hdmic_enable,
	.disable		= hdmic_disable,

	.detect			= hdmic_detect,
	.register_hpd_cb	= hdmic_register_hpd_cb,
	.unregister_hpd_cb	= hdmic_unregister_hpd_cb,
@@ -172,13 +155,9 @@ static int hdmic_probe(struct platform_device *pdev)
static int __exit hdmic_remove(struct platform_device *pdev)
{
	struct panel_drv_data *ddata = platform_get_drvdata(pdev);
	struct omap_dss_device *dssdev = &ddata->dssdev;

	omapdss_device_unregister(&ddata->dssdev);

	if (omapdss_device_is_enabled(dssdev))
		hdmic_disable(dssdev);

	return 0;
}

+2 −23
Original line number Diff line number Diff line
@@ -41,39 +41,20 @@ static void opa362_disconnect(struct omap_dss_device *src,
	omapdss_device_disconnect(dst, dst->next);
}

static int opa362_enable(struct omap_dss_device *dssdev)
static void opa362_enable(struct omap_dss_device *dssdev)
{
	struct panel_drv_data *ddata = to_panel_data(dssdev);
	struct omap_dss_device *src = dssdev->src;
	int r;

	dev_dbg(dssdev->dev, "enable\n");

	r = src->ops->enable(src);
	if (r)
		return r;

	if (ddata->enable_gpio)
		gpiod_set_value_cansleep(ddata->enable_gpio, 1);

	dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;

	return 0;
}

static void opa362_disable(struct omap_dss_device *dssdev)
{
	struct panel_drv_data *ddata = to_panel_data(dssdev);
	struct omap_dss_device *src = dssdev->src;

	dev_dbg(dssdev->dev, "disable\n");

	if (ddata->enable_gpio)
		gpiod_set_value_cansleep(ddata->enable_gpio, 0);

	src->ops->disable(src);

	dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
}

static const struct omap_dss_device_ops opa362_ops = {
@@ -132,8 +113,6 @@ static int __exit opa362_remove(struct platform_device *pdev)
		omapdss_device_put(dssdev->next);
	omapdss_device_unregister(&ddata->dssdev);

	WARN_ON(omapdss_device_is_enabled(dssdev));
	if (omapdss_device_is_enabled(dssdev))
	opa362_disable(dssdev);

	return 0;
+2 −19
Original line number Diff line number Diff line
@@ -36,35 +36,20 @@ static void tfp410_disconnect(struct omap_dss_device *src,
	omapdss_device_disconnect(dst, dst->next);
}

static int tfp410_enable(struct omap_dss_device *dssdev)
static void tfp410_enable(struct omap_dss_device *dssdev)
{
	struct panel_drv_data *ddata = to_panel_data(dssdev);
	struct omap_dss_device *src = dssdev->src;
	int r;

	r = src->ops->enable(src);
	if (r)
		return r;

	if (ddata->pd_gpio)
		gpiod_set_value_cansleep(ddata->pd_gpio, 0);

	dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;

	return 0;
}

static void tfp410_disable(struct omap_dss_device *dssdev)
{
	struct panel_drv_data *ddata = to_panel_data(dssdev);
	struct omap_dss_device *src = dssdev->src;

	if (ddata->pd_gpio)
		gpiod_set_value_cansleep(ddata->pd_gpio, 0);

	src->ops->disable(src);

	dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
}

static const struct omap_dss_device_ops tfp410_ops = {
@@ -126,8 +111,6 @@ static int __exit tfp410_remove(struct platform_device *pdev)
		omapdss_device_put(dssdev->next);
	omapdss_device_unregister(&ddata->dssdev);

	WARN_ON(omapdss_device_is_enabled(dssdev));
	if (omapdss_device_is_enabled(dssdev))
	tfp410_disable(dssdev);

	return 0;
Loading