Commit 1f507968 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Tomi Valkeinen

drm/omap: dss: Move debug message and checks to connection handlers

The connectors, encoders and display duplicate the same debug messages
and connection checks in their omap_dss_device connect and disconnect
handlers. Move the code to the connect and disconnect wrappers.

To simplify the code the connect function returns -EBUSY unconditionally
if the device is already connected. This doesn't cause any change in
practice: the connect handler of displays is never called on a connected
device as it is only invoked during omapdrm initialization.
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 ec727e3f
......@@ -48,11 +48,6 @@ static int tvc_connect(struct omap_dss_device *dssdev)
struct omap_dss_device *in;
int r;
dev_dbg(ddata->dev, "connect\n");
if (omapdss_device_is_connected(dssdev))
return 0;
in = omapdss_of_find_source_for_first_ep(ddata->dev->of_node);
if (IS_ERR(in)) {
dev_err(ddata->dev, "failed to find video source\n");
......@@ -74,11 +69,6 @@ static void tvc_disconnect(struct omap_dss_device *dssdev)
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
dev_dbg(ddata->dev, "disconnect\n");
if (!omapdss_device_is_connected(dssdev))
return;
omapdss_device_disconnect(in, dssdev);
omap_dss_put_device(in);
......
......@@ -63,9 +63,6 @@ static int dvic_connect(struct omap_dss_device *dssdev)
struct omap_dss_device *in;
int r;
if (omapdss_device_is_connected(dssdev))
return 0;
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(in)) {
dev_err(dssdev->dev, "failed to find video source\n");
......@@ -87,9 +84,6 @@ static void dvic_disconnect(struct omap_dss_device *dssdev)
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
if (!omapdss_device_is_connected(dssdev))
return;
omapdss_device_disconnect(in, dssdev);
omap_dss_put_device(in);
......
......@@ -58,11 +58,6 @@ static int hdmic_connect(struct omap_dss_device *dssdev)
struct omap_dss_device *in;
int r;
dev_dbg(ddata->dev, "connect\n");
if (omapdss_device_is_connected(dssdev))
return 0;
in = omapdss_of_find_source_for_first_ep(ddata->dev->of_node);
if (IS_ERR(in)) {
dev_err(ddata->dev, "failed to find video source\n");
......@@ -84,11 +79,6 @@ static void hdmic_disconnect(struct omap_dss_device *dssdev)
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
dev_dbg(ddata->dev, "disconnect\n");
if (!omapdss_device_is_connected(dssdev))
return;
omapdss_device_disconnect(in, dssdev);
omap_dss_put_device(in);
......
......@@ -39,11 +39,6 @@ static int opa362_connect(struct omap_dss_device *dssdev,
struct omap_dss_device *in;
int r;
dev_dbg(dssdev->dev, "connect\n");
if (omapdss_device_is_connected(dssdev))
return -EBUSY;
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(in)) {
dev_err(dssdev->dev, "failed to find video source\n");
......@@ -69,12 +64,6 @@ static void opa362_disconnect(struct omap_dss_device *dssdev,
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
dev_dbg(dssdev->dev, "disconnect\n");
WARN_ON(!omapdss_device_is_connected(dssdev));
if (!omapdss_device_is_connected(dssdev))
return;
WARN_ON(dst != dssdev->dst);
if (dst != dssdev->dst)
return;
......
......@@ -35,9 +35,6 @@ static int tfp410_connect(struct omap_dss_device *dssdev,
struct omap_dss_device *in;
int r;
if (omapdss_device_is_connected(dssdev))
return -EBUSY;
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(in)) {
dev_err(dssdev->dev, "failed to find video source\n");
......@@ -63,10 +60,6 @@ static void tfp410_disconnect(struct omap_dss_device *dssdev,
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
WARN_ON(!omapdss_device_is_connected(dssdev));
if (!omapdss_device_is_connected(dssdev))
return;
WARN_ON(dst != dssdev->dst);
if (dst != dssdev->dst)
return;
......
......@@ -41,9 +41,6 @@ static int panel_dpi_connect(struct omap_dss_device *dssdev)
struct omap_dss_device *in;
int r;
if (omapdss_device_is_connected(dssdev))
return 0;
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(in)) {
dev_err(dssdev->dev, "failed to find video source\n");
......@@ -65,9 +62,6 @@ static void panel_dpi_disconnect(struct omap_dss_device *dssdev)
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
if (!omapdss_device_is_connected(dssdev))
return;
omapdss_device_disconnect(in, dssdev);
omap_dss_put_device(in);
......
......@@ -763,9 +763,6 @@ static int dsicm_connect(struct omap_dss_device *dssdev)
struct omap_dss_device *in;
int r;
if (omapdss_device_is_connected(dssdev))
return 0;
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(in)) {
dev_err(dssdev->dev, "failed to find video source\n");
......@@ -807,9 +804,6 @@ static void dsicm_disconnect(struct omap_dss_device *dssdev)
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
if (!omapdss_device_is_connected(dssdev))
return;
in->ops->dsi.release_vc(in, ddata->channel);
omapdss_device_disconnect(in, dssdev);
......
......@@ -122,9 +122,6 @@ static int lb035q02_connect(struct omap_dss_device *dssdev)
struct omap_dss_device *in;
int r;
if (omapdss_device_is_connected(dssdev))
return 0;
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(in)) {
dev_err(dssdev->dev, "failed to find video source\n");
......@@ -148,9 +145,6 @@ static void lb035q02_disconnect(struct omap_dss_device *dssdev)
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
if (!omapdss_device_is_connected(dssdev))
return;
omapdss_device_disconnect(in, dssdev);
omap_dss_put_device(in);
......
......@@ -118,9 +118,6 @@ static int nec_8048_connect(struct omap_dss_device *dssdev)
struct omap_dss_device *in;
int r;
if (omapdss_device_is_connected(dssdev))
return 0;
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(in)) {
dev_err(dssdev->dev, "failed to find video source\n");
......@@ -142,9 +139,6 @@ static void nec_8048_disconnect(struct omap_dss_device *dssdev)
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
if (!omapdss_device_is_connected(dssdev))
return;
omapdss_device_disconnect(in, dssdev);
omap_dss_put_device(in);
......
......@@ -64,9 +64,6 @@ static int sharp_ls_connect(struct omap_dss_device *dssdev)
struct omap_dss_device *in;
int r;
if (omapdss_device_is_connected(dssdev))
return 0;
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(in)) {
dev_err(dssdev->dev, "failed to find video source\n");
......@@ -88,9 +85,6 @@ static void sharp_ls_disconnect(struct omap_dss_device *dssdev)
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
if (!omapdss_device_is_connected(dssdev))
return;
omapdss_device_disconnect(in, dssdev);
omap_dss_put_device(in);
......
......@@ -513,9 +513,6 @@ static int acx565akm_connect(struct omap_dss_device *dssdev)
struct omap_dss_device *in;
int r;
if (omapdss_device_is_connected(dssdev))
return 0;
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(in)) {
dev_err(dssdev->dev, "failed to find video source\n");
......@@ -537,9 +534,6 @@ static void acx565akm_disconnect(struct omap_dss_device *dssdev)
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
if (!omapdss_device_is_connected(dssdev))
return;
omapdss_device_disconnect(in, dssdev);
omap_dss_put_device(in);
......
......@@ -172,9 +172,6 @@ static int td028ttec1_panel_connect(struct omap_dss_device *dssdev)
struct omap_dss_device *in;
int r;
if (omapdss_device_is_connected(dssdev))
return 0;
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(in)) {
dev_err(dssdev->dev, "failed to find video source\n");
......@@ -196,9 +193,6 @@ static void td028ttec1_panel_disconnect(struct omap_dss_device *dssdev)
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
if (!omapdss_device_is_connected(dssdev))
return;
omapdss_device_disconnect(in, dssdev);
omap_dss_put_device(in);
......
......@@ -343,9 +343,6 @@ static int tpo_td043_connect(struct omap_dss_device *dssdev)
struct omap_dss_device *in;
int r;
if (omapdss_device_is_connected(dssdev))
return 0;
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(in)) {
dev_err(dssdev->dev, "failed to find video source\n");
......@@ -367,9 +364,6 @@ static void tpo_td043_disconnect(struct omap_dss_device *dssdev)
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
if (!omapdss_device_is_connected(dssdev))
return;
omapdss_device_disconnect(in, dssdev);
omap_dss_put_device(in);
......
......@@ -105,6 +105,11 @@ struct omap_dss_device *omapdss_find_device_by_port(struct device_node *src,
int omapdss_device_connect(struct omap_dss_device *src,
struct omap_dss_device *dst)
{
dev_dbg(src->dev, "connect\n");
if (omapdss_device_is_connected(src))
return -EBUSY;
if (src->driver)
return src->driver->connect(src);
else
......@@ -115,6 +120,13 @@ EXPORT_SYMBOL_GPL(omapdss_device_connect);
void omapdss_device_disconnect(struct omap_dss_device *src,
struct omap_dss_device *dst)
{
dev_dbg(src->dev, "disconnect\n");
if (!src->id && !omapdss_device_is_connected(src)) {
WARN_ON(!src->driver);
return;
}
if (src->driver)
src->driver->disconnect(src);
else
......
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