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

Commit 83910ad3 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Tomi Valkeinen
Browse files

drm/omap: Move most omap_dss_driver operations to omap_dss_device_ops



omap_dss_device instances have two ops structures, omap_dss_driver and
omap_dss_device_ops. The former is used for devices at the end of the
pipeline (a.k.a. display devices), and the latter for intermediate
devices.

Having two sets of operations isn't convenient as code that iterates
over omap_dss_device instances need to take them both into account.
There's currently a reasonably small amount of such code, but more will
be introduced to move the driver away from recursive operations. To
simplify current and future code, move all operations that are not
specific to the display device to the omap_dss_device_ops.

Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: default avatarSebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent e7df6571
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -119,7 +119,7 @@ static int tvc_check_timings(struct omap_dss_device *dssdev,
	return src->ops->check_timings(src, vm);
}

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

@@ -146,7 +146,7 @@ static int tvc_probe(struct platform_device *pdev)
	ddata->vm = tvc_pal_vm;

	dssdev = &ddata->dssdev;
	dssdev->driver = &tvc_driver;
	dssdev->ops = &tvc_ops;
	dssdev->dev = &pdev->dev;
	dssdev->type = OMAP_DISPLAY_TYPE_VENC;
	dssdev->owner = THIS_MODULE;
+2 −2
Original line number Diff line number Diff line
@@ -265,7 +265,7 @@ static void dvic_disable_hpd(struct omap_dss_device *dssdev)
	mutex_unlock(&ddata->hpd_lock);
}

static const struct omap_dss_driver dvic_driver = {
static const struct omap_dss_device_ops dvic_ops = {
	.connect	= dvic_connect,
	.disconnect	= dvic_disconnect,

@@ -367,7 +367,7 @@ static int dvic_probe(struct platform_device *pdev)
	ddata->vm = dvic_default_vm;

	dssdev = &ddata->dssdev;
	dssdev->driver = &dvic_driver;
	dssdev->ops = &dvic_ops;
	dssdev->dev = &pdev->dev;
	dssdev->type = OMAP_DISPLAY_TYPE_DVI;
	dssdev->owner = THIS_MODULE;
+17 −14
Original line number Diff line number Diff line
@@ -132,7 +132,7 @@ static int hdmic_read_edid(struct omap_dss_device *dssdev,
{
	struct omap_dss_device *src = dssdev->src;

	return src->ops->hdmi.read_edid(src, edid, len);
	return src->ops->read_edid(src, edid, len);
}

static bool hdmic_detect(struct omap_dss_device *dssdev)
@@ -144,7 +144,7 @@ static bool hdmic_detect(struct omap_dss_device *dssdev)
	if (ddata->hpd_gpio)
		connected = gpiod_get_value_cansleep(ddata->hpd_gpio);
	else
		connected = src->ops->hdmi.detect(src);
		connected = src->ops->detect(src);
	if (!connected && src->ops->hdmi.lost_hotplug)
		src->ops->hdmi.lost_hotplug(src);
	return connected;
@@ -164,8 +164,8 @@ static int hdmic_register_hpd_cb(struct omap_dss_device *dssdev,
		ddata->hpd_cb_data = cb_data;
		mutex_unlock(&ddata->hpd_lock);
		return 0;
	} else if (src->ops->hdmi.register_hpd_cb) {
		return src->ops->hdmi.register_hpd_cb(src, cb, cb_data);
	} else if (src->ops->register_hpd_cb) {
		return src->ops->register_hpd_cb(src, cb, cb_data);
	}

	return -ENOTSUPP;
@@ -181,8 +181,8 @@ static void hdmic_unregister_hpd_cb(struct omap_dss_device *dssdev)
		ddata->hpd_cb = NULL;
		ddata->hpd_cb_data = NULL;
		mutex_unlock(&ddata->hpd_lock);
	} else if (src->ops->hdmi.unregister_hpd_cb) {
		src->ops->hdmi.unregister_hpd_cb(src);
	} else if (src->ops->unregister_hpd_cb) {
		src->ops->unregister_hpd_cb(src);
	}
}

@@ -195,8 +195,8 @@ static void hdmic_enable_hpd(struct omap_dss_device *dssdev)
		mutex_lock(&ddata->hpd_lock);
		ddata->hpd_enabled = true;
		mutex_unlock(&ddata->hpd_lock);
	} else if (src->ops->hdmi.enable_hpd) {
		src->ops->hdmi.enable_hpd(src);
	} else if (src->ops->enable_hpd) {
		src->ops->enable_hpd(src);
	}
}

@@ -209,8 +209,8 @@ static void hdmic_disable_hpd(struct omap_dss_device *dssdev)
		mutex_lock(&ddata->hpd_lock);
		ddata->hpd_enabled = false;
		mutex_unlock(&ddata->hpd_lock);
	} else if (src->ops->hdmi.disable_hpd) {
		src->ops->hdmi.disable_hpd(src);
	} else if (src->ops->disable_hpd) {
		src->ops->disable_hpd(src);
	}
}

@@ -229,7 +229,7 @@ static int hdmic_set_infoframe(struct omap_dss_device *dssdev,
	return src->ops->hdmi.set_infoframe(src, avi);
}

static const struct omap_dss_driver hdmic_driver = {
static const struct omap_dss_device_ops hdmic_ops = {
	.connect		= hdmic_connect,
	.disconnect		= hdmic_disconnect,

@@ -246,8 +246,11 @@ static const struct omap_dss_driver hdmic_driver = {
	.unregister_hpd_cb	= hdmic_unregister_hpd_cb,
	.enable_hpd		= hdmic_enable_hpd,
	.disable_hpd		= hdmic_disable_hpd,

	.hdmi = {
		.set_hdmi_mode	= hdmic_set_hdmi_mode,
	.set_hdmi_infoframe	= hdmic_set_infoframe,
		.set_infoframe	= hdmic_set_infoframe,
	},
};

static irqreturn_t hdmic_hpd_isr(int irq, void *data)
@@ -309,7 +312,7 @@ static int hdmic_probe(struct platform_device *pdev)
	ddata->vm = hdmic_default_vm;

	dssdev = &ddata->dssdev;
	dssdev->driver = &hdmic_driver;
	dssdev->ops = &hdmic_ops;
	dssdev->dev = &pdev->dev;
	dssdev->type = OMAP_DISPLAY_TYPE_HDMI;
	dssdev->owner = THIS_MODULE;
+7 −7
Original line number Diff line number Diff line
@@ -125,7 +125,7 @@ static int tpd_read_edid(struct omap_dss_device *dssdev,
	if (!gpiod_get_value_cansleep(ddata->hpd_gpio))
		return -ENODEV;

	return src->ops->hdmi.read_edid(src, edid, len);
	return src->ops->read_edid(src, edid, len);
}

static bool tpd_detect(struct omap_dss_device *dssdev)
@@ -205,14 +205,14 @@ static const struct omap_dss_device_ops tpd_ops = {
	.disable		= tpd_disable,
	.check_timings		= tpd_check_timings,
	.set_timings		= tpd_set_timings,

	.hdmi = {
	.read_edid		= tpd_read_edid,
	.detect			= tpd_detect,
	.register_hpd_cb	= tpd_register_hpd_cb,
	.unregister_hpd_cb	= tpd_unregister_hpd_cb,
	.enable_hpd		= tpd_enable_hpd,
	.disable_hpd		= tpd_disable_hpd,

	.hdmi = {
		.set_infoframe		= tpd_set_infoframe,
		.set_hdmi_mode		= tpd_set_hdmi_mode,
	},
+2 −2
Original line number Diff line number Diff line
@@ -122,7 +122,7 @@ static int panel_dpi_check_timings(struct omap_dss_device *dssdev,
	return src->ops->check_timings(src, vm);
}

static const struct omap_dss_driver panel_dpi_ops = {
static const struct omap_dss_device_ops panel_dpi_ops = {
	.connect	= panel_dpi_connect,
	.disconnect	= panel_dpi_disconnect,

@@ -196,7 +196,7 @@ static int panel_dpi_probe(struct platform_device *pdev)

	dssdev = &ddata->dssdev;
	dssdev->dev = &pdev->dev;
	dssdev->driver = &panel_dpi_ops;
	dssdev->ops = &panel_dpi_ops;
	dssdev->type = OMAP_DISPLAY_TYPE_DPI;
	dssdev->owner = THIS_MODULE;
	dssdev->of_ports = BIT(0);
Loading