Skip to content

Commit

Permalink
drm/omap: Move most omap_dss_driver operations to omap_dss_device_ops
Browse files Browse the repository at this point in the history
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: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
  • Loading branch information
Laurent Pinchart authored and Tomi Valkeinen committed Sep 3, 2018
1 parent e7df657 commit 83910ad
Show file tree
Hide file tree
Showing 21 changed files with 106 additions and 137 deletions.
4 changes: 2 additions & 2 deletions drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/omapdrm/displays/connector-dvi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand Down Expand Up @@ -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;
Expand Down
31 changes: 17 additions & 14 deletions drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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);
}
}

Expand All @@ -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);
}
}

Expand All @@ -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);
}
}

Expand All @@ -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,

Expand All @@ -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,
.set_hdmi_mode = hdmic_set_hdmi_mode,
.set_hdmi_infoframe = hdmic_set_infoframe,

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

static irqreturn_t hdmic_hpd_isr(int irq, void *data)
Expand Down Expand Up @@ -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;
Expand Down
14 changes: 7 additions & 7 deletions drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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,
.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 = {
.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,
.set_infoframe = tpd_set_infoframe,
.set_hdmi_mode = tpd_set_hdmi_mode,
},
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/omapdrm/displays/panel-dpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand Down Expand Up @@ -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);
Expand Down
12 changes: 8 additions & 4 deletions drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1179,18 +1179,21 @@ static void dsicm_get_size(struct omap_dss_device *dssdev,
*height = ddata->height_mm;
}

static const struct omap_dss_driver dsicm_ops = {
static const struct omap_dss_device_ops dsicm_ops = {
.connect = dsicm_connect,
.disconnect = dsicm_disconnect,

.enable = dsicm_enable,
.disable = dsicm_disable,

.get_timings = dsicm_get_timings,
.check_timings = dsicm_check_timings,
};

static const struct omap_dss_driver dsicm_dss_driver = {
.update = dsicm_update,
.sync = dsicm_sync,

.get_timings = dsicm_get_timings,
.check_timings = dsicm_check_timings,
.get_size = dsicm_get_size,

.enable_te = dsicm_enable_te,
Expand Down Expand Up @@ -1299,7 +1302,8 @@ static int dsicm_probe(struct platform_device *pdev)

dssdev = &ddata->dssdev;
dssdev->dev = dev;
dssdev->driver = &dsicm_ops;
dssdev->ops = &dsicm_ops;
dssdev->driver = &dsicm_dss_driver;
dssdev->type = OMAP_DISPLAY_TYPE_DSI;
dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(0);
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ static int lb035q02_check_timings(struct omap_dss_device *dssdev,
return src->ops->check_timings(src, vm);
}

static const struct omap_dss_driver lb035q02_ops = {
static const struct omap_dss_device_ops lb035q02_ops = {
.connect = lb035q02_connect,
.disconnect = lb035q02_disconnect,

Expand Down Expand Up @@ -249,7 +249,7 @@ static int lb035q02_panel_spi_probe(struct spi_device *spi)

dssdev = &ddata->dssdev;
dssdev->dev = &spi->dev;
dssdev->driver = &lb035q02_ops;
dssdev->ops = &lb035q02_ops;
dssdev->type = OMAP_DISPLAY_TYPE_DPI;
dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(0);
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ static int nec_8048_check_timings(struct omap_dss_device *dssdev,
return src->ops->check_timings(src, vm);
}

static const struct omap_dss_driver nec_8048_ops = {
static const struct omap_dss_device_ops nec_8048_ops = {
.connect = nec_8048_connect,
.disconnect = nec_8048_disconnect,

Expand Down Expand Up @@ -239,7 +239,7 @@ static int nec_8048_probe(struct spi_device *spi)

dssdev = &ddata->dssdev;
dssdev->dev = &spi->dev;
dssdev->driver = &nec_8048_ops;
dssdev->ops = &nec_8048_ops;
dssdev->type = OMAP_DISPLAY_TYPE_DPI;
dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(0);
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ static int sharp_ls_check_timings(struct omap_dss_device *dssdev,
return src->ops->check_timings(src, vm);
}

static const struct omap_dss_driver sharp_ls_ops = {
static const struct omap_dss_device_ops sharp_ls_ops = {
.connect = sharp_ls_connect,
.disconnect = sharp_ls_disconnect,

Expand Down Expand Up @@ -247,7 +247,7 @@ static int sharp_ls_probe(struct platform_device *pdev)

dssdev = &ddata->dssdev;
dssdev->dev = &pdev->dev;
dssdev->driver = &sharp_ls_ops;
dssdev->ops = &sharp_ls_ops;
dssdev->type = OMAP_DISPLAY_TYPE_DPI;
dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(0);
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ static int acx565akm_check_timings(struct omap_dss_device *dssdev,
return src->ops->check_timings(src, vm);
}

static const struct omap_dss_driver acx565akm_ops = {
static const struct omap_dss_device_ops acx565akm_ops = {
.connect = acx565akm_connect,
.disconnect = acx565akm_disconnect,

Expand Down Expand Up @@ -762,7 +762,7 @@ static int acx565akm_probe(struct spi_device *spi)

dssdev = &ddata->dssdev;
dssdev->dev = &spi->dev;
dssdev->driver = &acx565akm_ops;
dssdev->ops = &acx565akm_ops;
dssdev->type = OMAP_DISPLAY_TYPE_SDI;
dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(0);
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ static int td028ttec1_panel_check_timings(struct omap_dss_device *dssdev,
return src->ops->check_timings(src, vm);
}

static const struct omap_dss_driver td028ttec1_ops = {
static const struct omap_dss_device_ops td028ttec1_ops = {
.connect = td028ttec1_panel_connect,
.disconnect = td028ttec1_panel_disconnect,

Expand Down Expand Up @@ -371,7 +371,7 @@ static int td028ttec1_panel_probe(struct spi_device *spi)

dssdev = &ddata->dssdev;
dssdev->dev = &spi->dev;
dssdev->driver = &td028ttec1_ops;
dssdev->ops = &td028ttec1_ops;
dssdev->type = OMAP_DISPLAY_TYPE_DPI;
dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(0);
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ static int tpo_td043_check_timings(struct omap_dss_device *dssdev,
return src->ops->check_timings(src, vm);
}

static const struct omap_dss_driver tpo_td043_ops = {
static const struct omap_dss_device_ops tpo_td043_ops = {
.connect = tpo_td043_connect,
.disconnect = tpo_td043_disconnect,

Expand Down Expand Up @@ -469,7 +469,7 @@ static int tpo_td043_probe(struct spi_device *spi)

dssdev = &ddata->dssdev;
dssdev->dev = &spi->dev;
dssdev->driver = &tpo_td043_ops;
dssdev->ops = &tpo_td043_ops;
dssdev->type = OMAP_DISPLAY_TYPE_DPI;
dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(0);
Expand Down
12 changes: 2 additions & 10 deletions drivers/gpu/drm/omapdrm/dss/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,7 @@ int omapdss_device_connect(struct dss_device *dss,

dst->dss = dss;

if (dst->driver)
ret = dst->driver->connect(src, dst);
else
ret = dst->ops->connect(src, dst);

ret = dst->ops->connect(src, dst);
if (ret < 0) {
dst->dss = NULL;
return ret;
Expand Down Expand Up @@ -238,11 +234,7 @@ void omapdss_device_disconnect(struct omap_dss_device *src,

WARN_ON(dst->state != OMAP_DSS_DISPLAY_DISABLED);

if (dst->driver)
dst->driver->disconnect(src, dst);
else
dst->ops->disconnect(src, dst);

dst->ops->disconnect(src, dst);
dst->dss = NULL;
}
EXPORT_SYMBOL_GPL(omapdss_device_disconnect);
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/omapdrm/dss/dss.c
Original file line number Diff line number Diff line change
Expand Up @@ -1553,7 +1553,7 @@ static void dss_shutdown(struct platform_device *pdev)

for_each_dss_display(dssdev) {
if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
dssdev->driver->disable(dssdev);
dssdev->ops->disable(dssdev);
}
}

Expand Down
3 changes: 2 additions & 1 deletion drivers/gpu/drm/omapdrm/dss/hdmi4.c
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,9 @@ static const struct omap_dss_device_ops hdmi_ops = {
.check_timings = hdmi_display_check_timing,
.set_timings = hdmi_display_set_timing,

.read_edid = hdmi_read_edid,

.hdmi = {
.read_edid = hdmi_read_edid,
.lost_hotplug = hdmi_lost_hotplug,
.set_infoframe = hdmi_set_infoframe,
.set_hdmi_mode = hdmi_set_hdmi_mode,
Expand Down
3 changes: 2 additions & 1 deletion drivers/gpu/drm/omapdrm/dss/hdmi5.c
Original file line number Diff line number Diff line change
Expand Up @@ -505,8 +505,9 @@ static const struct omap_dss_device_ops hdmi_ops = {
.check_timings = hdmi_display_check_timing,
.set_timings = hdmi_display_set_timing,

.read_edid = hdmi_read_edid,

.hdmi = {
.read_edid = hdmi_read_edid,
.set_infoframe = hdmi_set_infoframe,
.set_hdmi_mode = hdmi_set_hdmi_mode,
},
Expand Down
Loading

0 comments on commit 83910ad

Please sign in to comment.