Commit b93109d7 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Tomi Valkeinen

drm/omap: dss: Move common device operations to common structure

The various types of omapdss_*_ops structures define multiple operations
that are not specific to a bus type. To simplify the code and remove
dependencies on specific bus types move those operations to a common
structure. Operations that are specific to a bus type are kept in the
specialized ops structures.
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 e10bd354
......@@ -59,7 +59,7 @@ static int tvc_connect(struct omap_dss_device *dssdev)
return PTR_ERR(in);
}
r = in->ops.atv->connect(in, dssdev);
r = in->ops->connect(in, dssdev);
if (r) {
omap_dss_put_device(in);
return r;
......@@ -79,7 +79,7 @@ static void tvc_disconnect(struct omap_dss_device *dssdev)
if (!omapdss_device_is_connected(dssdev))
return;
in->ops.atv->disconnect(in, dssdev);
in->ops->disconnect(in, dssdev);
omap_dss_put_device(in);
ddata->in = NULL;
......@@ -99,9 +99,9 @@ static int tvc_enable(struct omap_dss_device *dssdev)
if (omapdss_device_is_enabled(dssdev))
return 0;
in->ops.atv->set_timings(in, &ddata->vm);
in->ops->set_timings(in, &ddata->vm);
r = in->ops.atv->enable(in);
r = in->ops->enable(in);
if (r)
return r;
......@@ -120,7 +120,7 @@ static void tvc_disable(struct omap_dss_device *dssdev)
if (!omapdss_device_is_enabled(dssdev))
return;
in->ops.atv->disable(in);
in->ops->disable(in);
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
}
......@@ -133,7 +133,7 @@ static void tvc_set_timings(struct omap_dss_device *dssdev,
ddata->vm = *vm;
in->ops.atv->set_timings(in, vm);
in->ops->set_timings(in, vm);
}
static void tvc_get_timings(struct omap_dss_device *dssdev,
......@@ -150,7 +150,7 @@ static int tvc_check_timings(struct omap_dss_device *dssdev,
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
return in->ops.atv->check_timings(in, vm);
return in->ops->check_timings(in, vm);
}
static const struct omap_dss_driver tvc_driver = {
......
......@@ -72,7 +72,7 @@ static int dvic_connect(struct omap_dss_device *dssdev)
return PTR_ERR(in);
}
r = in->ops.dvi->connect(in, dssdev);
r = in->ops->connect(in, dssdev);
if (r) {
omap_dss_put_device(in);
return r;
......@@ -90,7 +90,7 @@ static void dvic_disconnect(struct omap_dss_device *dssdev)
if (!omapdss_device_is_connected(dssdev))
return;
in->ops.dvi->disconnect(in, dssdev);
in->ops->disconnect(in, dssdev);
omap_dss_put_device(in);
ddata->in = NULL;
......@@ -108,9 +108,9 @@ static int dvic_enable(struct omap_dss_device *dssdev)
if (omapdss_device_is_enabled(dssdev))
return 0;
in->ops.dvi->set_timings(in, &ddata->vm);
in->ops->set_timings(in, &ddata->vm);
r = in->ops.dvi->enable(in);
r = in->ops->enable(in);
if (r)
return r;
......@@ -127,7 +127,7 @@ static void dvic_disable(struct omap_dss_device *dssdev)
if (!omapdss_device_is_enabled(dssdev))
return;
in->ops.dvi->disable(in);
in->ops->disable(in);
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
}
......@@ -140,7 +140,7 @@ static void dvic_set_timings(struct omap_dss_device *dssdev,
ddata->vm = *vm;
in->ops.dvi->set_timings(in, vm);
in->ops->set_timings(in, vm);
}
static void dvic_get_timings(struct omap_dss_device *dssdev,
......@@ -157,7 +157,7 @@ static int dvic_check_timings(struct omap_dss_device *dssdev,
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
return in->ops.dvi->check_timings(in, vm);
return in->ops->check_timings(in, vm);
}
static int dvic_ddc_read(struct i2c_adapter *adapter,
......
......@@ -69,7 +69,7 @@ static int hdmic_connect(struct omap_dss_device *dssdev)
return PTR_ERR(in);
}
r = in->ops.hdmi->connect(in, dssdev);
r = in->ops->connect(in, dssdev);
if (r) {
omap_dss_put_device(in);
return r;
......@@ -89,7 +89,7 @@ static void hdmic_disconnect(struct omap_dss_device *dssdev)
if (!omapdss_device_is_connected(dssdev))
return;
in->ops.hdmi->disconnect(in, dssdev);
in->ops->disconnect(in, dssdev);
omap_dss_put_device(in);
ddata->in = NULL;
......@@ -109,9 +109,9 @@ static int hdmic_enable(struct omap_dss_device *dssdev)
if (omapdss_device_is_enabled(dssdev))
return 0;
in->ops.hdmi->set_timings(in, &ddata->vm);
in->ops->set_timings(in, &ddata->vm);
r = in->ops.hdmi->enable(in);
r = in->ops->enable(in);
if (r)
return r;
......@@ -130,7 +130,7 @@ static void hdmic_disable(struct omap_dss_device *dssdev)
if (!omapdss_device_is_enabled(dssdev))
return;
in->ops.hdmi->disable(in);
in->ops->disable(in);
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
}
......@@ -143,7 +143,7 @@ static void hdmic_set_timings(struct omap_dss_device *dssdev,
ddata->vm = *vm;
in->ops.hdmi->set_timings(in, vm);
in->ops->set_timings(in, vm);
}
static void hdmic_get_timings(struct omap_dss_device *dssdev,
......@@ -160,7 +160,7 @@ static int hdmic_check_timings(struct omap_dss_device *dssdev,
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
return in->ops.hdmi->check_timings(in, vm);
return in->ops->check_timings(in, vm);
}
static int hdmic_read_edid(struct omap_dss_device *dssdev,
......@@ -169,7 +169,7 @@ static int hdmic_read_edid(struct omap_dss_device *dssdev,
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
return in->ops.hdmi->read_edid(in, edid, len);
return in->ops->hdmi.read_edid(in, edid, len);
}
static bool hdmic_detect(struct omap_dss_device *dssdev)
......@@ -181,9 +181,9 @@ static bool hdmic_detect(struct omap_dss_device *dssdev)
if (gpio_is_valid(ddata->hpd_gpio))
connected = gpio_get_value_cansleep(ddata->hpd_gpio);
else
connected = in->ops.hdmi->detect(in);
if (!connected && in->ops.hdmi->lost_hotplug)
in->ops.hdmi->lost_hotplug(in);
connected = in->ops->hdmi.detect(in);
if (!connected && in->ops->hdmi.lost_hotplug)
in->ops->hdmi.lost_hotplug(in);
return connected;
}
......@@ -201,8 +201,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 (in->ops.hdmi->register_hpd_cb) {
return in->ops.hdmi->register_hpd_cb(in, cb, cb_data);
} else if (in->ops->hdmi.register_hpd_cb) {
return in->ops->hdmi.register_hpd_cb(in, cb, cb_data);
}
return -ENOTSUPP;
......@@ -218,8 +218,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 (in->ops.hdmi->unregister_hpd_cb) {
in->ops.hdmi->unregister_hpd_cb(in);
} else if (in->ops->hdmi.unregister_hpd_cb) {
in->ops->hdmi.unregister_hpd_cb(in);
}
}
......@@ -232,8 +232,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 (in->ops.hdmi->enable_hpd) {
in->ops.hdmi->enable_hpd(in);
} else if (in->ops->hdmi.enable_hpd) {
in->ops->hdmi.enable_hpd(in);
}
}
......@@ -246,8 +246,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 (in->ops.hdmi->disable_hpd) {
in->ops.hdmi->disable_hpd(in);
} else if (in->ops->hdmi.disable_hpd) {
in->ops->hdmi.disable_hpd(in);
}
}
......@@ -256,7 +256,7 @@ static int hdmic_set_hdmi_mode(struct omap_dss_device *dssdev, bool hdmi_mode)
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
return in->ops.hdmi->set_hdmi_mode(in, hdmi_mode);
return in->ops->hdmi.set_hdmi_mode(in, hdmi_mode);
}
static int hdmic_set_infoframe(struct omap_dss_device *dssdev,
......@@ -265,7 +265,7 @@ static int hdmic_set_infoframe(struct omap_dss_device *dssdev,
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
return in->ops.hdmi->set_infoframe(in, avi);
return in->ops->hdmi.set_infoframe(in, avi);
}
static const struct omap_dss_driver hdmic_driver = {
......
......@@ -50,7 +50,7 @@ static int opa362_connect(struct omap_dss_device *dssdev,
return PTR_ERR(in);
}
r = in->ops.atv->connect(in, dssdev);
r = in->ops->connect(in, dssdev);
if (r) {
omap_dss_put_device(in);
return r;
......@@ -82,7 +82,7 @@ static void opa362_disconnect(struct omap_dss_device *dssdev,
dst->src = NULL;
dssdev->dst = NULL;
in->ops.atv->disconnect(in, &ddata->dssdev);
in->ops->disconnect(in, &ddata->dssdev);
omap_dss_put_device(in);
ddata->in = NULL;
......@@ -102,9 +102,9 @@ static int opa362_enable(struct omap_dss_device *dssdev)
if (omapdss_device_is_enabled(dssdev))
return 0;
in->ops.atv->set_timings(in, &ddata->vm);
in->ops->set_timings(in, &ddata->vm);
r = in->ops.atv->enable(in);
r = in->ops->enable(in);
if (r)
return r;
......@@ -129,7 +129,7 @@ static void opa362_disable(struct omap_dss_device *dssdev)
if (ddata->enable_gpio)
gpiod_set_value_cansleep(ddata->enable_gpio, 0);
in->ops.atv->disable(in);
in->ops->disable(in);
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
}
......@@ -144,7 +144,7 @@ static void opa362_set_timings(struct omap_dss_device *dssdev,
ddata->vm = *vm;
in->ops.atv->set_timings(in, vm);
in->ops->set_timings(in, vm);
}
static int opa362_check_timings(struct omap_dss_device *dssdev,
......@@ -155,16 +155,14 @@ static int opa362_check_timings(struct omap_dss_device *dssdev,
dev_dbg(dssdev->dev, "check_timings\n");
return in->ops.atv->check_timings(in, vm);
return in->ops->check_timings(in, vm);
}
static const struct omapdss_atv_ops opa362_atv_ops = {
static const struct omap_dss_device_ops opa362_ops = {
.connect = opa362_connect,
.disconnect = opa362_disconnect,
.enable = opa362_enable,
.disable = opa362_disable,
.check_timings = opa362_check_timings,
.set_timings = opa362_set_timings,
};
......@@ -191,7 +189,7 @@ static int opa362_probe(struct platform_device *pdev)
ddata->enable_gpio = gpio;
dssdev = &ddata->dssdev;
dssdev->ops.atv = &opa362_atv_ops;
dssdev->ops = &opa362_ops;
dssdev->dev = &pdev->dev;
dssdev->type = OMAP_DISPLAY_TYPE_VENC;
dssdev->output_type = OMAP_DISPLAY_TYPE_VENC;
......
......@@ -44,7 +44,7 @@ static int tfp410_connect(struct omap_dss_device *dssdev,
return PTR_ERR(in);
}
r = in->ops.dpi->connect(in, dssdev);
r = in->ops->connect(in, dssdev);
if (r) {
omap_dss_put_device(in);
return r;
......@@ -74,7 +74,7 @@ static void tfp410_disconnect(struct omap_dss_device *dssdev,
dst->src = NULL;
dssdev->dst = NULL;
in->ops.dpi->disconnect(in, &ddata->dssdev);
in->ops->disconnect(in, &ddata->dssdev);
omap_dss_put_device(in);
ddata->in = NULL;
......@@ -92,9 +92,9 @@ static int tfp410_enable(struct omap_dss_device *dssdev)
if (omapdss_device_is_enabled(dssdev))
return 0;
in->ops.dpi->set_timings(in, &ddata->vm);
in->ops->set_timings(in, &ddata->vm);
r = in->ops.dpi->enable(in);
r = in->ops->enable(in);
if (r)
return r;
......@@ -117,7 +117,7 @@ static void tfp410_disable(struct omap_dss_device *dssdev)
if (gpio_is_valid(ddata->pd_gpio))
gpio_set_value_cansleep(ddata->pd_gpio, 0);
in->ops.dpi->disable(in);
in->ops->disable(in);
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
}
......@@ -138,7 +138,7 @@ static void tfp410_set_timings(struct omap_dss_device *dssdev,
ddata->vm = *vm;
in->ops.dpi->set_timings(in, vm);
in->ops->set_timings(in, vm);
}
static int tfp410_check_timings(struct omap_dss_device *dssdev,
......@@ -149,16 +149,14 @@ static int tfp410_check_timings(struct omap_dss_device *dssdev,
tfp410_fix_timings(vm);
return in->ops.dpi->check_timings(in, vm);
return in->ops->check_timings(in, vm);
}
static const struct omapdss_dvi_ops tfp410_dvi_ops = {
static const struct omap_dss_device_ops tfp410_ops = {
.connect = tfp410_connect,
.disconnect = tfp410_disconnect,
.enable = tfp410_enable,
.disable = tfp410_disable,
.check_timings = tfp410_check_timings,
.set_timings = tfp410_set_timings,
};
......@@ -209,7 +207,7 @@ static int tfp410_probe(struct platform_device *pdev)
}
dssdev = &ddata->dssdev;
dssdev->ops.dvi = &tfp410_dvi_ops;
dssdev->ops = &tfp410_ops;
dssdev->dev = &pdev->dev;
dssdev->type = OMAP_DISPLAY_TYPE_DPI;
dssdev->output_type = OMAP_DISPLAY_TYPE_DVI;
......
......@@ -49,7 +49,7 @@ static int tpd_connect(struct omap_dss_device *dssdev,
return PTR_ERR(in);
}
r = in->ops.hdmi->connect(in, dssdev);
r = in->ops->connect(in, dssdev);
if (r) {
omap_dss_put_device(in);
return r;
......@@ -85,7 +85,7 @@ static void tpd_disconnect(struct omap_dss_device *dssdev,
dst->src = NULL;
dssdev->dst = NULL;
in->ops.hdmi->disconnect(in, &ddata->dssdev);
in->ops->disconnect(in, &ddata->dssdev);
omap_dss_put_device(in);
ddata->in = NULL;
......@@ -100,9 +100,9 @@ static int tpd_enable(struct omap_dss_device *dssdev)
if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
return 0;
in->ops.hdmi->set_timings(in, &ddata->vm);
in->ops->set_timings(in, &ddata->vm);
r = in->ops.hdmi->enable(in);
r = in->ops->enable(in);
if (r)
return r;
......@@ -119,7 +119,7 @@ static void tpd_disable(struct omap_dss_device *dssdev)
if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
return;
in->ops.hdmi->disable(in);
in->ops->disable(in);
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
}
......@@ -132,7 +132,7 @@ static void tpd_set_timings(struct omap_dss_device *dssdev,
ddata->vm = *vm;
in->ops.hdmi->set_timings(in, vm);
in->ops->set_timings(in, vm);
}
static int tpd_check_timings(struct omap_dss_device *dssdev,
......@@ -142,7 +142,7 @@ static int tpd_check_timings(struct omap_dss_device *dssdev,
struct omap_dss_device *in = ddata->in;
int r;
r = in->ops.hdmi->check_timings(in, vm);
r = in->ops->check_timings(in, vm);
return r;
}
......@@ -156,7 +156,7 @@ static int tpd_read_edid(struct omap_dss_device *dssdev,
if (!gpiod_get_value_cansleep(ddata->hpd_gpio))
return -ENODEV;
return in->ops.hdmi->read_edid(in, edid, len);
return in->ops->hdmi.read_edid(in, edid, len);
}
static bool tpd_detect(struct omap_dss_device *dssdev)
......@@ -165,8 +165,8 @@ static bool tpd_detect(struct omap_dss_device *dssdev)
struct omap_dss_device *in = ddata->in;
bool connected = gpiod_get_value_cansleep(ddata->hpd_gpio);
if (!connected && in->ops.hdmi->lost_hotplug)
in->ops.hdmi->lost_hotplug(in);
if (!connected && in->ops->hdmi.lost_hotplug)
in->ops->hdmi.lost_hotplug(in);
return connected;
}
......@@ -219,7 +219,7 @@ static int tpd_set_infoframe(struct omap_dss_device *dssdev,
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
return in->ops.hdmi->set_infoframe(in, avi);
return in->ops->hdmi.set_infoframe(in, avi);
}
static int tpd_set_hdmi_mode(struct omap_dss_device *dssdev,
......@@ -228,27 +228,27 @@ static int tpd_set_hdmi_mode(struct omap_dss_device *dssdev,
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
return in->ops.hdmi->set_hdmi_mode(in, hdmi_mode);
return in->ops->hdmi.set_hdmi_mode(in, hdmi_mode);
}
static const struct omapdss_hdmi_ops tpd_hdmi_ops = {
static const struct omap_dss_device_ops tpd_ops = {
.connect = tpd_connect,
.disconnect = tpd_disconnect,
.enable = tpd_enable,
.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,
.set_infoframe = tpd_set_infoframe,
.set_hdmi_mode = tpd_set_hdmi_mode,
.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,
},
};
static irqreturn_t tpd_hpd_isr(int irq, void *data)
......@@ -315,7 +315,7 @@ static int tpd_probe(struct platform_device *pdev)
return r;
dssdev = &ddata->dssdev;
dssdev->ops.hdmi = &tpd_hdmi_ops;
dssdev->ops = &tpd_ops;
dssdev->dev = &pdev->dev;
dssdev->type = OMAP_DISPLAY_TYPE_HDMI;
dssdev->output_type = OMAP_DISPLAY_TYPE_HDMI;
......
......@@ -50,7 +50,7 @@ static int panel_dpi_connect(struct omap_dss_device *dssdev)
return PTR_ERR(in);
}
r = in->ops.dpi->connect(in, dssdev);
r = in->ops->connect(in, dssdev);
if (r) {
omap_dss_put_device(in);
return r;
......@@ -68,7 +68,7 @@ static void panel_dpi_disconnect(struct omap_dss_device *dssdev)
if (!omapdss_device_is_connected(dssdev))
return;
in->ops.dpi->disconnect(in, dssdev);
in->ops->disconnect(in, dssdev);
omap_dss_put_device(in);
ddata->in = NULL;
......@@ -86,15 +86,15 @@ static int panel_dpi_enable(struct omap_dss_device *dssdev)
if (omapdss_device_is_enabled(dssdev))
return 0;
in->ops.dpi->set_timings(in, &ddata->vm);
in->ops->set_timings(in, &ddata->vm);
r = in->ops.dpi->enable(in);
r = in->ops->enable(in);
if (r)
return r;
r = regulator_enable(ddata->vcc_supply);
if (r) {
in->ops.dpi->disable(in);
in->ops->disable(in);
return r;
}
......@@ -119,7 +119,7 @@ static void panel_dpi_disable(struct omap_dss_device *dssdev)
gpiod_set_value_cansleep(ddata->enable_gpio, 0);
regulator_disable(ddata->vcc_supply);
in->ops.dpi->disable(in);
in->ops->disable(in);
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
}
......@@ -132,7 +132,7 @@ static void panel_dpi_set_timings(struct omap_dss_device *dssdev,
ddata->vm = *vm;
in->ops.dpi->set_timings(in, vm);
in->ops->set_timings(in, vm);
}
static void panel_dpi_get_timings(struct omap_dss_device *dssdev,
......@@ -149,7 +149,7 @@ static int panel_dpi_check_timings(struct omap_dss_device *dssdev,
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
return in->ops.dpi->check_timings(in, vm);
return in->ops->check_timings(in, vm);
}
static const struct omap_dss_driver panel_dpi_ops = {
......
......@@ -131,7 +131,7 @@ static int lb035q02_connect(struct omap_dss_device *dssdev)
return PTR_ERR(in);
}
r = in->ops.dpi->connect(in, dssdev);
r = in->ops->connect(in, dssdev);
if (r) {
omap_dss_put_device(in);
return r;
......@@ -151,7 +151,7 @@ static void lb035q02_disconnect(struct omap_dss_device *dssdev)
if (!omapdss_device_is_connected(dssdev))
return;
in->ops.dpi->disconnect(in, dssdev);
in->ops->disconnect(in, dssdev);
omap_dss_put_device(in);
ddata->in = NULL;
......@@ -169,9 +169,9 @@ static int lb035q02_enable(struct omap_dss_device *dssdev)
if (omapdss_device_is_enabled(dssdev))
return 0;
in->ops.dpi->set_timings(in, &ddata->vm);
in->ops->set_timings(in, &ddata->vm);
r = in->ops.dpi->enable(in);
r = in->ops->enable(in);
if (r)
return r;
......@@ -194,7 +194,7 @@ static void lb035q02_disable(struct omap_dss_device *dssdev)
if (ddata->enable_gpio)
gpiod_set_value_cansleep(ddata->enable_gpio, 0);
in->ops.dpi->disable(in);
in->ops->disable(in);
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
}
......@@ -207,7 +207,7 @@ static void lb035q02_set_timings(struct omap_dss_device *dssdev,
ddata->vm = *vm;
in->ops.dpi->set_timings(in, vm);
in->ops->set_timings(in, vm);
}
static void lb035q02_get_timings(struct omap_dss_device *dssdev,
......@@ -224,7 +224,7 @@ static int lb035q02_check_timings(struct omap_dss_device *dssdev,
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
return in->ops.dpi->check_timings(in, vm);
return in->ops->check_timings(in, vm);
}
static const struct omap_dss_driver lb035q02_ops = {
......
......@@ -127,7 +127,7 @@ static int nec_8048_connect(struct omap_dss_device *dssdev)
return PTR_ERR(in);
}
r = in->ops.dpi->connect(in, dssdev);
r = in->ops->connect(in, dssdev);
if (r) {
omap_dss_put_device(in);
return r;
......@@ -145,7 +145,7 @@ static void nec_8048_disconnect(struct omap_dss_device *dssdev)
if (!omapdss_device_is_connected(dssdev))
return;
in->ops.dpi->disconnect(in, dssdev);
in->ops->disconnect(in, dssdev);
omap_dss_put_device(in);
ddata->in = NULL;
......@@ -163,9 +163,9 @@ static int nec_8048_enable(struct omap_dss_device *dssdev)
if (omapdss_device_is_enabled(dssdev))
return 0;
in->ops.dpi->set_timings(in, &ddata->vm);
in->ops->set_timings(in, &ddata->vm);
r = in->ops.dpi->enable(in);
r = in->ops->enable(in);
if (r)
return r;
......@@ -188,7 +188,7 @@ static void nec_8048_disable(struct omap_dss_device *dssdev)
if (gpio_is_valid(ddata->res_gpio))
gpio_set_value_cansleep(ddata->res_gpio, 0);
in->ops.dpi->disable(in);
in->ops->disable(in);
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
}
......@@ -201,7 +201,7 @@ static void nec_8048_set_timings(struct omap_dss_device *dssdev,
ddata->vm = *vm;
in->ops.dpi->set_timings(in, vm);
in->ops->set_timings(in, vm);
}
static void nec_8048_get_timings(struct omap_dss_device *dssdev,
......@@ -218,7 +218,7 @@ static int nec_8048_check_timings(struct omap_dss_device *dssdev,
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
return in->ops.dpi->check_timings(in, vm);
return in->ops->check_timings(in, vm);
}
static const struct omap_dss_driver nec_8048_ops = {
......
......@@ -73,7 +73,7 @@ static int sharp_ls_connect(struct omap_dss_device *dssdev)
return PTR_ERR(in);
}
r = in->ops.dpi->connect(in, dssdev);
r = in->ops->connect(in, dssdev);
if (r) {
omap_dss_put_device(in);
return r;
......@@ -91,7 +91,7 @@ static void sharp_ls_disconnect(struct omap_dss_device *dssdev)
if (!omapdss_device_is_connected(dssdev))
return;
in->ops.dpi->disconnect(in, dssdev);
in->ops->disconnect(in, dssdev);
omap_dss_put_device(in);
ddata->in = NULL;
......@@ -109,7 +109,7 @@ static int sharp_ls_enable(struct omap_dss_device *dssdev)
if (omapdss_device_is_enabled(dssdev))
return 0;
in->ops.dpi->set_timings(in, &ddata->vm);
in->ops->set_timings(in, &ddata->vm);
if (ddata->vcc) {
r = regulator_enable(ddata->vcc);
......@@ -117,7 +117,7 @@ static int sharp_ls_enable(struct omap_dss_device *dssdev)
return r;
}
r = in->ops.dpi->enable(in);
r = in->ops->enable(in);
if (r) {
regulator_disable(ddata->vcc);
return r;
......@@ -155,7 +155,7 @@ static void sharp_ls_disable(struct omap_dss_device *dssdev)
msleep(100);
in->ops.dpi->disable(in);
in->ops->disable(in);
if (ddata->vcc)
regulator_disable(ddata->vcc);
......@@ -171,7 +171,7 @@ static void sharp_ls_set_timings(struct omap_dss_device *dssdev,
ddata->vm = *vm;
in->ops.dpi->set_timings(in, vm);
in->ops->set_timings(in, vm);
}
static void sharp_ls_get_timings(struct omap_dss_device *dssdev,
......@@ -188,7 +188,7 @@ static int sharp_ls_check_timings(struct omap_dss_device *dssdev,
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
return in->ops.dpi->check_timings(in, vm);
return in->ops->check_timings(in, vm);
}
static const struct omap_dss_driver sharp_ls_ops = {
......
......@@ -522,7 +522,7 @@ static int acx565akm_connect(struct omap_dss_device *dssdev)
return PTR_ERR(in);
}
r = in->ops.sdi->connect(in, dssdev);
r = in->ops->connect(in, dssdev);
if (r) {
omap_dss_put_device(in);
return r;
......@@ -540,7 +540,7 @@ static void acx565akm_disconnect(struct omap_dss_device *dssdev)
if (!omapdss_device_is_connected(dssdev))
return;
in->ops.sdi->disconnect(in, dssdev);
in->ops->disconnect(in, dssdev);
omap_dss_put_device(in);
ddata->in = NULL;
......@@ -554,9 +554,9 @@ static int acx565akm_panel_power_on(struct omap_dss_device *dssdev)
dev_dbg(&ddata->spi->dev, "%s\n", __func__);
in->ops.sdi->set_timings(in, &ddata->vm);
in->ops->set_timings(in, &ddata->vm);
r = in->ops.sdi->enable(in);
r = in->ops->enable(in);
if (r) {
pr_err("%s sdi enable failed\n", __func__);
return r;
......@@ -621,7 +621,7 @@ static void acx565akm_panel_power_off(struct omap_dss_device *dssdev)
/* FIXME need to tweak this delay */
msleep(100);
in->ops.sdi->disable(in);
in->ops->disable(in);
}
static int acx565akm_enable(struct omap_dss_device *dssdev)
......@@ -672,7 +672,7 @@ static void acx565akm_set_timings(struct omap_dss_device *dssdev,
ddata->vm = *vm;
in->ops.sdi->set_timings(in, vm);
in->ops->set_timings(in, vm);
}
static void acx565akm_get_timings(struct omap_dss_device *dssdev,
......@@ -689,7 +689,7 @@ static int acx565akm_check_timings(struct omap_dss_device *dssdev,
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
return in->ops.sdi->check_timings(in, vm);
return in->ops->check_timings(in, vm);
}
static const struct omap_dss_driver acx565akm_ops = {
......
......@@ -181,7 +181,7 @@ static int td028ttec1_panel_connect(struct omap_dss_device *dssdev)
return PTR_ERR(in);
}
r = in->ops.dpi->connect(in, dssdev);
r = in->ops->connect(in, dssdev);
if (r) {
omap_dss_put_device(in);
return r;
......@@ -199,7 +199,7 @@ static void td028ttec1_panel_disconnect(struct omap_dss_device *dssdev)
if (!omapdss_device_is_connected(dssdev))
return;
in->ops.dpi->disconnect(in, dssdev);
in->ops->disconnect(in, dssdev);
omap_dss_put_device(in);
ddata->in = NULL;
......@@ -217,9 +217,9 @@ static int td028ttec1_panel_enable(struct omap_dss_device *dssdev)
if (omapdss_device_is_enabled(dssdev))
return 0;
in->ops.dpi->set_timings(in, &ddata->vm);
in->ops->set_timings(in, &ddata->vm);
r = in->ops.dpi->enable(in);
r = in->ops->enable(in);
if (r)
return r;
......@@ -328,7 +328,7 @@ static void td028ttec1_panel_disable(struct omap_dss_device *dssdev)
jbt_ret_write_0(ddata, JBT_REG_SLEEP_IN);
jbt_reg_write_1(ddata, JBT_REG_POWER_ON_OFF, 0x00);
in->ops.dpi->disable(in);
in->ops->disable(in);
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
}
......@@ -341,7 +341,7 @@ static void td028ttec1_panel_set_timings(struct omap_dss_device *dssdev,
ddata->vm = *vm;
in->ops.dpi->set_timings(in, vm);
in->ops->set_timings(in, vm);
}
static void td028ttec1_panel_get_timings(struct omap_dss_device *dssdev,
......@@ -358,7 +358,7 @@ static int td028ttec1_panel_check_timings(struct omap_dss_device *dssdev,
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
return in->ops.dpi->check_timings(in, vm);
return in->ops->check_timings(in, vm);
}
static const struct omap_dss_driver td028ttec1_ops = {
......
......@@ -352,7 +352,7 @@ static int tpo_td043_connect(struct omap_dss_device *dssdev)
return PTR_ERR(in);
}
r = in->ops.dpi->connect(in, dssdev);
r = in->ops->connect(in, dssdev);
if (r) {
omap_dss_put_device(in);
return r;
......@@ -370,7 +370,7 @@ static void tpo_td043_disconnect(struct omap_dss_device *dssdev)
if (!omapdss_device_is_connected(dssdev))
return;
in->ops.dpi->disconnect(in, dssdev);
in->ops->disconnect(in, dssdev);
omap_dss_put_device(in);
ddata->in = NULL;
......@@ -388,9 +388,9 @@ static int tpo_td043_enable(struct omap_dss_device *dssdev)
if (omapdss_device_is_enabled(dssdev))
return 0;
in->ops.dpi->set_timings(in, &ddata->vm);
in->ops->set_timings(in, &ddata->vm);
r = in->ops.dpi->enable(in);
r = in->ops->enable(in);
if (r)
return r;
......@@ -401,7 +401,7 @@ static int tpo_td043_enable(struct omap_dss_device *dssdev)
if (!ddata->spi_suspended) {
r = tpo_td043_power_on(ddata);
if (r) {
in->ops.dpi->disable(in);
in->ops->disable(in);
return r;
}
}
......@@ -419,7 +419,7 @@ static void tpo_td043_disable(struct omap_dss_device *dssdev)
if (!omapdss_device_is_enabled(dssdev))
return;
in->ops.dpi->disable(in);
in->ops->disable(in);
if (!ddata->spi_suspended)
tpo_td043_power_off(ddata);
......@@ -435,7 +435,7 @@ static void tpo_td043_set_timings(struct omap_dss_device *dssdev,
ddata->vm = *vm;
in->ops.dpi->set_timings(in, vm);
in->ops->set_timings(in, vm);
}
static void tpo_td043_get_timings(struct omap_dss_device *dssdev,
......@@ -452,7 +452,7 @@ static int tpo_td043_check_timings(struct omap_dss_device *dssdev,
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
return in->ops.dpi->check_timings(in, vm);
return in->ops->check_timings(in, vm);
}
static const struct omap_dss_driver tpo_td043_ops = {
......
......@@ -681,7 +681,7 @@ static void dpi_disconnect(struct omap_dss_device *dssdev,
dss_mgr_disconnect(&dpi->output, dssdev);
}
static const struct omapdss_dpi_ops dpi_ops = {
static const struct omap_dss_device_ops dpi_ops = {
.connect = dpi_connect,
.disconnect = dpi_disconnect,
......@@ -720,7 +720,7 @@ static void dpi_init_output_port(struct dpi_data *dpi, struct device_node *port)
out->output_type = OMAP_DISPLAY_TYPE_DPI;
out->dispc_channel = dpi_get_channel(dpi, port_num);
out->port_num = port_num;
out->ops.dpi = &dpi_ops;
out->ops = &dpi_ops;
out->owner = THIS_MODULE;
omapdss_register_output(out);
......
......@@ -5000,43 +5000,45 @@ static void dsi_disconnect(struct omap_dss_device *dssdev,
dss_mgr_disconnect(&dsi->output, dssdev);
}
static const struct omapdss_dsi_ops dsi_ops = {
static const struct omap_dss_device_ops dsi_ops = {
.connect = dsi_connect,
.disconnect = dsi_disconnect,
.enable = dsi_display_enable,
.bus_lock = dsi_bus_lock,
.bus_unlock = dsi_bus_unlock,
.dsi = {
.bus_lock = dsi_bus_lock,
.bus_unlock = dsi_bus_unlock,
.enable = dsi_display_enable,
.disable = dsi_display_disable,
.disable = dsi_display_disable,
.enable_hs = dsi_vc_enable_hs,
.enable_hs = dsi_vc_enable_hs,
.configure_pins = dsi_configure_pins,
.set_config = dsi_set_config,
.configure_pins = dsi_configure_pins,
.set_config = dsi_set_config,
.enable_video_output = dsi_enable_video_output,
.disable_video_output = dsi_disable_video_output,
.enable_video_output = dsi_enable_video_output,
.disable_video_output = dsi_disable_video_output,
.update = dsi_update,
.update = dsi_update,
.enable_te = dsi_enable_te,
.enable_te = dsi_enable_te,
.request_vc = dsi_request_vc,
.set_vc_id = dsi_set_vc_id,
.release_vc = dsi_release_vc,
.request_vc = dsi_request_vc,
.set_vc_id = dsi_set_vc_id,
.release_vc = dsi_release_vc,
.dcs_write = dsi_vc_dcs_write,
.dcs_write_nosync = dsi_vc_dcs_write_nosync,
.dcs_read = dsi_vc_dcs_read,
.dcs_write = dsi_vc_dcs_write,
.dcs_write_nosync = dsi_vc_dcs_write_nosync,
.dcs_read = dsi_vc_dcs_read,
.gen_write = dsi_vc_generic_write,
.gen_write_nosync = dsi_vc_generic_write_nosync,
.gen_read = dsi_vc_generic_read,
.gen_write = dsi_vc_generic_write,
.gen_write_nosync = dsi_vc_generic_write_nosync,
.gen_read = dsi_vc_generic_read,
.bta_sync = dsi_vc_send_bta_sync,
.bta_sync = dsi_vc_send_bta_sync,
.set_max_rx_packet_size = dsi_vc_set_max_rx_packet_size,
.set_max_rx_packet_size = dsi_vc_set_max_rx_packet_size,
},
};
static void dsi_init_output(struct dsi_data *dsi)
......@@ -5050,7 +5052,7 @@ static void dsi_init_output(struct dsi_data *dsi)
out->output_type = OMAP_DISPLAY_TYPE_DSI;
out->name = dsi->module_id == 0 ? "dsi.0" : "dsi.1";
out->dispc_channel = dsi_get_channel(dsi);
out->ops.dsi = &dsi_ops;
out->ops = &dsi_ops;
out->owner = THIS_MODULE;
omapdss_register_output(out);
......
......@@ -540,7 +540,7 @@ static int hdmi_set_hdmi_mode(struct omap_dss_device *dssdev,
return 0;
}
static const struct omapdss_hdmi_ops hdmi_ops = {
static const struct omap_dss_device_ops hdmi_ops = {
.connect = hdmi_connect,
.disconnect = hdmi_disconnect,
......@@ -550,10 +550,12 @@ static const struct omapdss_hdmi_ops hdmi_ops = {
.check_timings = hdmi_display_check_timing,
.set_timings = hdmi_display_set_timing,
.read_edid = hdmi_read_edid,
.lost_hotplug = hdmi_lost_hotplug,
.set_infoframe = hdmi_set_infoframe,
.set_hdmi_mode = hdmi_set_hdmi_mode,
.hdmi = {
.read_edid = hdmi_read_edid,
.lost_hotplug = hdmi_lost_hotplug,
.set_infoframe = hdmi_set_infoframe,
.set_hdmi_mode = hdmi_set_hdmi_mode,
},
};
static void hdmi_init_output(struct omap_hdmi *hdmi)
......@@ -565,7 +567,7 @@ static void hdmi_init_output(struct omap_hdmi *hdmi)
out->output_type = OMAP_DISPLAY_TYPE_HDMI;
out->name = "hdmi.0";
out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
out->ops.hdmi = &hdmi_ops;
out->ops = &hdmi_ops;
out->owner = THIS_MODULE;
omapdss_register_output(out);
......
......@@ -532,7 +532,7 @@ static int hdmi_set_hdmi_mode(struct omap_dss_device *dssdev,
return 0;
}
static const struct omapdss_hdmi_ops hdmi_ops = {
static const struct omap_dss_device_ops hdmi_ops = {
.connect = hdmi_connect,
.disconnect = hdmi_disconnect,
......@@ -542,9 +542,11 @@ static const struct omapdss_hdmi_ops hdmi_ops = {
.check_timings = hdmi_display_check_timing,
.set_timings = hdmi_display_set_timing,
.read_edid = hdmi_read_edid,
.set_infoframe = hdmi_set_infoframe,
.set_hdmi_mode = hdmi_set_hdmi_mode,
.hdmi = {
.read_edid = hdmi_read_edid,
.set_infoframe = hdmi_set_infoframe,
.set_hdmi_mode = hdmi_set_hdmi_mode,
},
};
static void hdmi_init_output(struct omap_hdmi *hdmi)
......@@ -556,7 +558,7 @@ static void hdmi_init_output(struct omap_hdmi *hdmi)
out->output_type = OMAP_DISPLAY_TYPE_HDMI;
out->name = "hdmi.0";
out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
out->ops.hdmi = &hdmi_ops;
out->ops = &hdmi_ops;
out->owner = THIS_MODULE;
omapdss_register_output(out);
......
......@@ -296,80 +296,7 @@ struct omap_dss_writeback_info {
u8 pre_mult_alpha;
};
struct omapdss_dpi_ops {
int (*connect)(struct omap_dss_device *dssdev,
struct omap_dss_device *dst);
void (*disconnect)(struct omap_dss_device *dssdev,
struct omap_dss_device *dst);
int (*enable)(struct omap_dss_device *dssdev);
void (*disable)(struct omap_dss_device *dssdev);
int (*check_timings)(struct omap_dss_device *dssdev,
struct videomode *vm);
void (*set_timings)(struct omap_dss_device *dssdev,
struct videomode *vm);
};
struct omapdss_sdi_ops {
int (*connect)(struct omap_dss_device *dssdev,
struct omap_dss_device *dst);
void (*disconnect)(struct omap_dss_device *dssdev,
struct omap_dss_device *dst);
int (*enable)(struct omap_dss_device *dssdev);
void (*disable)(struct omap_dss_device *dssdev);
int (*check_timings)(struct omap_dss_device *dssdev,
struct videomode *vm);
void (*set_timings)(struct omap_dss_device *dssdev,
struct videomode *vm);
};
struct omapdss_dvi_ops {
int (*connect)(struct omap_dss_device *dssdev,
struct omap_dss_device *dst);
void (*disconnect)(struct omap_dss_device *dssdev,
struct omap_dss_device *dst);
int (*enable)(struct omap_dss_device *dssdev);
void (*disable)(struct omap_dss_device *dssdev);
int (*check_timings)(struct omap_dss_device *dssdev,
struct videomode *vm);
void (*set_timings)(struct omap_dss_device *dssdev,
struct videomode *vm);
};
struct omapdss_atv_ops {
int (*connect)(struct omap_dss_device *dssdev,
struct omap_dss_device *dst);
void (*disconnect)(struct omap_dss_device *dssdev,
struct omap_dss_device *dst);
int (*enable)(struct omap_dss_device *dssdev);
void (*disable)(struct omap_dss_device *dssdev);
int (*check_timings)(struct omap_dss_device *dssdev,
struct videomode *vm);
void (*set_timings)(struct omap_dss_device *dssdev,
struct videomode *vm);
};
struct omapdss_hdmi_ops {
int (*connect)(struct omap_dss_device *dssdev,
struct omap_dss_device *dst);
void (*disconnect)(struct omap_dss_device *dssdev,
struct omap_dss_device *dst);
int (*enable)(struct omap_dss_device *dssdev);
void (*disable)(struct omap_dss_device *dssdev);
int (*check_timings)(struct omap_dss_device *dssdev,
struct videomode *vm);
void (*set_timings)(struct omap_dss_device *dssdev,
struct videomode *vm);
int (*read_edid)(struct omap_dss_device *dssdev, u8 *buf, int len);
void (*lost_hotplug)(struct omap_dss_device *dssdev);
bool (*detect)(struct omap_dss_device *dssdev);
......@@ -388,12 +315,6 @@ struct omapdss_hdmi_ops {
};
struct omapdss_dsi_ops {
int (*connect)(struct omap_dss_device *dssdev,
struct omap_dss_device *dst);
void (*disconnect)(struct omap_dss_device *dssdev,
struct omap_dss_device *dst);
int (*enable)(struct omap_dss_device *dssdev);
void (*disable)(struct omap_dss_device *dssdev, bool disconnect_lanes,
bool enter_ulps);
......@@ -444,6 +365,26 @@ struct omapdss_dsi_ops {
int channel, u16 plen);
};
struct omap_dss_device_ops {
int (*connect)(struct omap_dss_device *dssdev,
struct omap_dss_device *dst);
void (*disconnect)(struct omap_dss_device *dssdev,
struct omap_dss_device *dst);
int (*enable)(struct omap_dss_device *dssdev);
void (*disable)(struct omap_dss_device *dssdev);
int (*check_timings)(struct omap_dss_device *dssdev,
struct videomode *vm);
void (*set_timings)(struct omap_dss_device *dssdev,
struct videomode *vm);
union {
const struct omapdss_hdmi_ops hdmi;
const struct omapdss_dsi_ops dsi;
};
};
struct omap_dss_device {
struct kobject kobj;
struct device *dev;
......@@ -461,15 +402,7 @@ struct omap_dss_device {
const char *name;
const struct omap_dss_driver *driver;
union {
const struct omapdss_dpi_ops *dpi;
const struct omapdss_sdi_ops *sdi;
const struct omapdss_dvi_ops *dvi;
const struct omapdss_hdmi_ops *hdmi;
const struct omapdss_atv_ops *atv;
const struct omapdss_dsi_ops *dsi;
} ops;
const struct omap_dss_device_ops *ops;
/* helper variable for driver suspend/resume */
bool activate_after_resume;
......
......@@ -311,7 +311,7 @@ static void sdi_disconnect(struct omap_dss_device *dssdev,
dss_mgr_disconnect(&sdi->output, dssdev);
}
static const struct omapdss_sdi_ops sdi_ops = {
static const struct omap_dss_device_ops sdi_ops = {
.connect = sdi_connect,
.disconnect = sdi_disconnect,
......@@ -333,7 +333,7 @@ static void sdi_init_output(struct sdi_device *sdi)
out->dispc_channel = OMAP_DSS_CHANNEL_LCD;
/* We have SDI only on OMAP3, where it's on port 1 */
out->port_num = 1;
out->ops.sdi = &sdi_ops;
out->ops = &sdi_ops;
out->owner = THIS_MODULE;
omapdss_register_output(out);
......
......@@ -750,7 +750,7 @@ static void venc_disconnect(struct omap_dss_device *dssdev,
dss_mgr_disconnect(&venc->output, dssdev);
}
static const struct omapdss_atv_ops venc_ops = {
static const struct omap_dss_device_ops venc_ops = {
.connect = venc_connect,
.disconnect = venc_disconnect,
......@@ -770,7 +770,7 @@ static void venc_init_output(struct venc_device *venc)
out->output_type = OMAP_DISPLAY_TYPE_VENC;
out->name = "venc.0";
out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
out->ops.atv = &venc_ops;
out->ops = &venc_ops;
out->owner = THIS_MODULE;
omapdss_register_output(out);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment