Skip to content

Commit 1f50796

Browse files
pinchartltomba
authored andcommitted
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: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
1 parent ec727e3 commit 1f50796

14 files changed

+12
-92
lines changed

drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,6 @@ static int tvc_connect(struct omap_dss_device *dssdev)
4848
struct omap_dss_device *in;
4949
int r;
5050

51-
dev_dbg(ddata->dev, "connect\n");
52-
53-
if (omapdss_device_is_connected(dssdev))
54-
return 0;
55-
5651
in = omapdss_of_find_source_for_first_ep(ddata->dev->of_node);
5752
if (IS_ERR(in)) {
5853
dev_err(ddata->dev, "failed to find video source\n");
@@ -74,11 +69,6 @@ static void tvc_disconnect(struct omap_dss_device *dssdev)
7469
struct panel_drv_data *ddata = to_panel_data(dssdev);
7570
struct omap_dss_device *in = ddata->in;
7671

77-
dev_dbg(ddata->dev, "disconnect\n");
78-
79-
if (!omapdss_device_is_connected(dssdev))
80-
return;
81-
8272
omapdss_device_disconnect(in, dssdev);
8373

8474
omap_dss_put_device(in);

drivers/gpu/drm/omapdrm/displays/connector-dvi.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,6 @@ static int dvic_connect(struct omap_dss_device *dssdev)
6363
struct omap_dss_device *in;
6464
int r;
6565

66-
if (omapdss_device_is_connected(dssdev))
67-
return 0;
68-
6966
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
7067
if (IS_ERR(in)) {
7168
dev_err(dssdev->dev, "failed to find video source\n");
@@ -87,9 +84,6 @@ static void dvic_disconnect(struct omap_dss_device *dssdev)
8784
struct panel_drv_data *ddata = to_panel_data(dssdev);
8885
struct omap_dss_device *in = ddata->in;
8986

90-
if (!omapdss_device_is_connected(dssdev))
91-
return;
92-
9387
omapdss_device_disconnect(in, dssdev);
9488

9589
omap_dss_put_device(in);

drivers/gpu/drm/omapdrm/displays/connector-hdmi.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,6 @@ static int hdmic_connect(struct omap_dss_device *dssdev)
5858
struct omap_dss_device *in;
5959
int r;
6060

61-
dev_dbg(ddata->dev, "connect\n");
62-
63-
if (omapdss_device_is_connected(dssdev))
64-
return 0;
65-
6661
in = omapdss_of_find_source_for_first_ep(ddata->dev->of_node);
6762
if (IS_ERR(in)) {
6863
dev_err(ddata->dev, "failed to find video source\n");
@@ -84,11 +79,6 @@ static void hdmic_disconnect(struct omap_dss_device *dssdev)
8479
struct panel_drv_data *ddata = to_panel_data(dssdev);
8580
struct omap_dss_device *in = ddata->in;
8681

87-
dev_dbg(ddata->dev, "disconnect\n");
88-
89-
if (!omapdss_device_is_connected(dssdev))
90-
return;
91-
9282
omapdss_device_disconnect(in, dssdev);
9383

9484
omap_dss_put_device(in);

drivers/gpu/drm/omapdrm/displays/encoder-opa362.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,6 @@ static int opa362_connect(struct omap_dss_device *dssdev,
3939
struct omap_dss_device *in;
4040
int r;
4141

42-
dev_dbg(dssdev->dev, "connect\n");
43-
44-
if (omapdss_device_is_connected(dssdev))
45-
return -EBUSY;
46-
4742
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
4843
if (IS_ERR(in)) {
4944
dev_err(dssdev->dev, "failed to find video source\n");
@@ -69,12 +64,6 @@ static void opa362_disconnect(struct omap_dss_device *dssdev,
6964
struct panel_drv_data *ddata = to_panel_data(dssdev);
7065
struct omap_dss_device *in = ddata->in;
7166

72-
dev_dbg(dssdev->dev, "disconnect\n");
73-
74-
WARN_ON(!omapdss_device_is_connected(dssdev));
75-
if (!omapdss_device_is_connected(dssdev))
76-
return;
77-
7867
WARN_ON(dst != dssdev->dst);
7968
if (dst != dssdev->dst)
8069
return;

drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ static int tfp410_connect(struct omap_dss_device *dssdev,
3535
struct omap_dss_device *in;
3636
int r;
3737

38-
if (omapdss_device_is_connected(dssdev))
39-
return -EBUSY;
40-
4138
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
4239
if (IS_ERR(in)) {
4340
dev_err(dssdev->dev, "failed to find video source\n");
@@ -63,10 +60,6 @@ static void tfp410_disconnect(struct omap_dss_device *dssdev,
6360
struct panel_drv_data *ddata = to_panel_data(dssdev);
6461
struct omap_dss_device *in = ddata->in;
6562

66-
WARN_ON(!omapdss_device_is_connected(dssdev));
67-
if (!omapdss_device_is_connected(dssdev))
68-
return;
69-
7063
WARN_ON(dst != dssdev->dst);
7164
if (dst != dssdev->dst)
7265
return;

drivers/gpu/drm/omapdrm/displays/panel-dpi.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ static int panel_dpi_connect(struct omap_dss_device *dssdev)
4141
struct omap_dss_device *in;
4242
int r;
4343

44-
if (omapdss_device_is_connected(dssdev))
45-
return 0;
46-
4744
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
4845
if (IS_ERR(in)) {
4946
dev_err(dssdev->dev, "failed to find video source\n");
@@ -65,9 +62,6 @@ static void panel_dpi_disconnect(struct omap_dss_device *dssdev)
6562
struct panel_drv_data *ddata = to_panel_data(dssdev);
6663
struct omap_dss_device *in = ddata->in;
6764

68-
if (!omapdss_device_is_connected(dssdev))
69-
return;
70-
7165
omapdss_device_disconnect(in, dssdev);
7266

7367
omap_dss_put_device(in);

drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -763,9 +763,6 @@ static int dsicm_connect(struct omap_dss_device *dssdev)
763763
struct omap_dss_device *in;
764764
int r;
765765

766-
if (omapdss_device_is_connected(dssdev))
767-
return 0;
768-
769766
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
770767
if (IS_ERR(in)) {
771768
dev_err(dssdev->dev, "failed to find video source\n");
@@ -807,9 +804,6 @@ static void dsicm_disconnect(struct omap_dss_device *dssdev)
807804
struct panel_drv_data *ddata = to_panel_data(dssdev);
808805
struct omap_dss_device *in = ddata->in;
809806

810-
if (!omapdss_device_is_connected(dssdev))
811-
return;
812-
813807
in->ops->dsi.release_vc(in, ddata->channel);
814808
omapdss_device_disconnect(in, dssdev);
815809

drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,6 @@ static int lb035q02_connect(struct omap_dss_device *dssdev)
122122
struct omap_dss_device *in;
123123
int r;
124124

125-
if (omapdss_device_is_connected(dssdev))
126-
return 0;
127-
128125
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
129126
if (IS_ERR(in)) {
130127
dev_err(dssdev->dev, "failed to find video source\n");
@@ -148,9 +145,6 @@ static void lb035q02_disconnect(struct omap_dss_device *dssdev)
148145
struct panel_drv_data *ddata = to_panel_data(dssdev);
149146
struct omap_dss_device *in = ddata->in;
150147

151-
if (!omapdss_device_is_connected(dssdev))
152-
return;
153-
154148
omapdss_device_disconnect(in, dssdev);
155149

156150
omap_dss_put_device(in);

drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,6 @@ static int nec_8048_connect(struct omap_dss_device *dssdev)
118118
struct omap_dss_device *in;
119119
int r;
120120

121-
if (omapdss_device_is_connected(dssdev))
122-
return 0;
123-
124121
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
125122
if (IS_ERR(in)) {
126123
dev_err(dssdev->dev, "failed to find video source\n");
@@ -142,9 +139,6 @@ static void nec_8048_disconnect(struct omap_dss_device *dssdev)
142139
struct panel_drv_data *ddata = to_panel_data(dssdev);
143140
struct omap_dss_device *in = ddata->in;
144141

145-
if (!omapdss_device_is_connected(dssdev))
146-
return;
147-
148142
omapdss_device_disconnect(in, dssdev);
149143

150144
omap_dss_put_device(in);

drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ static int sharp_ls_connect(struct omap_dss_device *dssdev)
6464
struct omap_dss_device *in;
6565
int r;
6666

67-
if (omapdss_device_is_connected(dssdev))
68-
return 0;
69-
7067
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
7168
if (IS_ERR(in)) {
7269
dev_err(dssdev->dev, "failed to find video source\n");
@@ -88,9 +85,6 @@ static void sharp_ls_disconnect(struct omap_dss_device *dssdev)
8885
struct panel_drv_data *ddata = to_panel_data(dssdev);
8986
struct omap_dss_device *in = ddata->in;
9087

91-
if (!omapdss_device_is_connected(dssdev))
92-
return;
93-
9488
omapdss_device_disconnect(in, dssdev);
9589

9690
omap_dss_put_device(in);

drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -513,9 +513,6 @@ static int acx565akm_connect(struct omap_dss_device *dssdev)
513513
struct omap_dss_device *in;
514514
int r;
515515

516-
if (omapdss_device_is_connected(dssdev))
517-
return 0;
518-
519516
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
520517
if (IS_ERR(in)) {
521518
dev_err(dssdev->dev, "failed to find video source\n");
@@ -537,9 +534,6 @@ static void acx565akm_disconnect(struct omap_dss_device *dssdev)
537534
struct panel_drv_data *ddata = to_panel_data(dssdev);
538535
struct omap_dss_device *in = ddata->in;
539536

540-
if (!omapdss_device_is_connected(dssdev))
541-
return;
542-
543537
omapdss_device_disconnect(in, dssdev);
544538

545539
omap_dss_put_device(in);

drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,6 @@ static int td028ttec1_panel_connect(struct omap_dss_device *dssdev)
172172
struct omap_dss_device *in;
173173
int r;
174174

175-
if (omapdss_device_is_connected(dssdev))
176-
return 0;
177-
178175
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
179176
if (IS_ERR(in)) {
180177
dev_err(dssdev->dev, "failed to find video source\n");
@@ -196,9 +193,6 @@ static void td028ttec1_panel_disconnect(struct omap_dss_device *dssdev)
196193
struct panel_drv_data *ddata = to_panel_data(dssdev);
197194
struct omap_dss_device *in = ddata->in;
198195

199-
if (!omapdss_device_is_connected(dssdev))
200-
return;
201-
202196
omapdss_device_disconnect(in, dssdev);
203197

204198
omap_dss_put_device(in);

drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -343,9 +343,6 @@ static int tpo_td043_connect(struct omap_dss_device *dssdev)
343343
struct omap_dss_device *in;
344344
int r;
345345

346-
if (omapdss_device_is_connected(dssdev))
347-
return 0;
348-
349346
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
350347
if (IS_ERR(in)) {
351348
dev_err(dssdev->dev, "failed to find video source\n");
@@ -367,9 +364,6 @@ static void tpo_td043_disconnect(struct omap_dss_device *dssdev)
367364
struct panel_drv_data *ddata = to_panel_data(dssdev);
368365
struct omap_dss_device *in = ddata->in;
369366

370-
if (!omapdss_device_is_connected(dssdev))
371-
return;
372-
373367
omapdss_device_disconnect(in, dssdev);
374368

375369
omap_dss_put_device(in);

drivers/gpu/drm/omapdrm/dss/base.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ struct omap_dss_device *omapdss_find_device_by_port(struct device_node *src,
105105
int omapdss_device_connect(struct omap_dss_device *src,
106106
struct omap_dss_device *dst)
107107
{
108+
dev_dbg(src->dev, "connect\n");
109+
110+
if (omapdss_device_is_connected(src))
111+
return -EBUSY;
112+
108113
if (src->driver)
109114
return src->driver->connect(src);
110115
else
@@ -115,6 +120,13 @@ EXPORT_SYMBOL_GPL(omapdss_device_connect);
115120
void omapdss_device_disconnect(struct omap_dss_device *src,
116121
struct omap_dss_device *dst)
117122
{
123+
dev_dbg(src->dev, "disconnect\n");
124+
125+
if (!src->id && !omapdss_device_is_connected(src)) {
126+
WARN_ON(!src->driver);
127+
return;
128+
}
129+
118130
if (src->driver)
119131
src->driver->disconnect(src);
120132
else

0 commit comments

Comments
 (0)