Skip to content

Commit 4e20bda

Browse files
pinchartltomba
authored andcommitted
drm/omap: dss: Replace omap_dss_device port number with bitmask
The omap_dss_device port_num field stores the DT port number associated with the device. The field is used in different ways depending on the device type: - For DPI outputs, the port number is used as an identifier of the DPI instance - For sources, the port number is used to look up the omap_dss_device by DT port node As omap_dss_device instances are only looked up as sources by sinks, setting the field to the number of the source port works for both use cases. However, to enable looking up sinks, we need to record all the ports associated with an omap_dss_device. Do so by turning the port_num field into an of_ports bitmask. For DPI outputs the port number is additionally stored in the dpi_data structure as the output ID. 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 5c718e0 commit 4e20bda

22 files changed

+31
-16
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ static int tvc_probe(struct platform_device *pdev)
169169
dssdev->dev = &pdev->dev;
170170
dssdev->type = OMAP_DISPLAY_TYPE_VENC;
171171
dssdev->owner = THIS_MODULE;
172+
dssdev->of_ports = BIT(0);
172173

173174
omapdss_display_init(dssdev);
174175
omapdss_device_register(dssdev);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ static int dvic_probe(struct platform_device *pdev)
389389
dssdev->dev = &pdev->dev;
390390
dssdev->type = OMAP_DISPLAY_TYPE_DVI;
391391
dssdev->owner = THIS_MODULE;
392+
dssdev->of_ports = BIT(0);
392393

393394
omapdss_display_init(dssdev);
394395
omapdss_device_register(dssdev);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ static int hdmic_probe(struct platform_device *pdev)
349349
dssdev->dev = &pdev->dev;
350350
dssdev->type = OMAP_DISPLAY_TYPE_HDMI;
351351
dssdev->owner = THIS_MODULE;
352+
dssdev->of_ports = BIT(0);
352353

353354
omapdss_display_init(dssdev);
354355
omapdss_device_register(dssdev);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ static int opa362_probe(struct platform_device *pdev)
167167
dssdev->type = OMAP_DISPLAY_TYPE_VENC;
168168
dssdev->output_type = OMAP_DISPLAY_TYPE_VENC;
169169
dssdev->owner = THIS_MODULE;
170+
dssdev->of_ports = BIT(1) | BIT(0);
170171

171172
omapdss_device_register(dssdev);
172173

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ static int tfp410_probe(struct platform_device *pdev)
190190
dssdev->type = OMAP_DISPLAY_TYPE_DPI;
191191
dssdev->output_type = OMAP_DISPLAY_TYPE_DVI;
192192
dssdev->owner = THIS_MODULE;
193-
dssdev->port_num = 1;
193+
dssdev->of_ports = BIT(1) | BIT(0);
194194

195195
omapdss_device_register(dssdev);
196196

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ static int tpd_probe(struct platform_device *pdev)
299299
dssdev->type = OMAP_DISPLAY_TYPE_HDMI;
300300
dssdev->output_type = OMAP_DISPLAY_TYPE_HDMI;
301301
dssdev->owner = THIS_MODULE;
302-
dssdev->port_num = 1;
302+
dssdev->of_ports = BIT(1) | BIT(0);
303303

304304
omapdss_device_register(dssdev);
305305

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ static int panel_dpi_probe(struct platform_device *pdev)
217217
dssdev->driver = &panel_dpi_ops;
218218
dssdev->type = OMAP_DISPLAY_TYPE_DPI;
219219
dssdev->owner = THIS_MODULE;
220+
dssdev->of_ports = BIT(0);
220221

221222
omapdss_display_init(dssdev);
222223
omapdss_device_register(dssdev);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,6 +1324,7 @@ static int dsicm_probe(struct platform_device *pdev)
13241324
dssdev->driver = &dsicm_ops;
13251325
dssdev->type = OMAP_DISPLAY_TYPE_DSI;
13261326
dssdev->owner = THIS_MODULE;
1327+
dssdev->of_ports = BIT(0);
13271328

13281329
dssdev->caps = OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE |
13291330
OMAP_DSS_DISPLAY_CAP_TEAR_ELIM;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ static int lb035q02_panel_spi_probe(struct spi_device *spi)
269269
dssdev->driver = &lb035q02_ops;
270270
dssdev->type = OMAP_DISPLAY_TYPE_DPI;
271271
dssdev->owner = THIS_MODULE;
272+
dssdev->of_ports = BIT(0);
272273

273274
omapdss_display_init(dssdev);
274275
omapdss_device_register(dssdev);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ static int nec_8048_probe(struct spi_device *spi)
292292
dssdev->driver = &nec_8048_ops;
293293
dssdev->type = OMAP_DISPLAY_TYPE_DPI;
294294
dssdev->owner = THIS_MODULE;
295+
dssdev->of_ports = BIT(0);
295296

296297
omapdss_display_init(dssdev);
297298
omapdss_device_register(dssdev);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ static int sharp_ls_probe(struct platform_device *pdev)
268268
dssdev->driver = &sharp_ls_ops;
269269
dssdev->type = OMAP_DISPLAY_TYPE_DPI;
270270
dssdev->owner = THIS_MODULE;
271+
dssdev->of_ports = BIT(0);
271272

272273
omapdss_display_init(dssdev);
273274
omapdss_device_register(dssdev);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -797,6 +797,7 @@ static int acx565akm_probe(struct spi_device *spi)
797797
dssdev->driver = &acx565akm_ops;
798798
dssdev->type = OMAP_DISPLAY_TYPE_SDI;
799799
dssdev->owner = THIS_MODULE;
800+
dssdev->of_ports = BIT(0);
800801

801802
omapdss_display_init(dssdev);
802803
omapdss_device_register(dssdev);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,7 @@ static int td028ttec1_panel_probe(struct spi_device *spi)
393393
dssdev->driver = &td028ttec1_ops;
394394
dssdev->type = OMAP_DISPLAY_TYPE_DPI;
395395
dssdev->owner = THIS_MODULE;
396+
dssdev->of_ports = BIT(0);
396397

397398
omapdss_display_init(dssdev);
398399
omapdss_device_register(dssdev);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,7 @@ static int tpo_td043_probe(struct spi_device *spi)
535535
dssdev->driver = &tpo_td043_ops;
536536
dssdev->type = OMAP_DISPLAY_TYPE_DPI;
537537
dssdev->owner = THIS_MODULE;
538+
dssdev->of_ports = BIT(0);
538539

539540
omapdss_display_init(dssdev);
540541
omapdss_device_register(dssdev);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ struct omap_dss_device *omapdss_find_device_by_port(struct device_node *src,
118118
struct omap_dss_device *dssdev;
119119

120120
list_for_each_entry(dssdev, &omapdss_devices_list, list) {
121-
if (dssdev->dev->of_node == src && dssdev->port_num == port)
121+
if (dssdev->dev->of_node == src && dssdev->of_ports & BIT(port))
122122
return omapdss_device_get(dssdev);
123123
}
124124

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

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ struct dpi_data {
3939
struct platform_device *pdev;
4040
enum dss_model dss_model;
4141
struct dss_device *dss;
42+
unsigned int id;
4243

4344
struct regulator *vdds_dsi_reg;
4445
enum dss_clk_source clk_src;
@@ -413,7 +414,7 @@ static int dpi_display_enable(struct omap_dss_device *dssdev)
413414
if (r)
414415
goto err_get_dispc;
415416

416-
r = dss_dpi_select_source(dpi->dss, out->port_num, out->dispc_channel);
417+
r = dss_dpi_select_source(dpi->dss, dpi->id, out->dispc_channel);
417418
if (r)
418419
goto err_src_sel;
419420

@@ -609,15 +610,15 @@ static void dpi_init_pll(struct dpi_data *dpi)
609610
* the channel in some more dynamic manner, or get the channel as a user
610611
* parameter.
611612
*/
612-
static enum omap_channel dpi_get_channel(struct dpi_data *dpi, int port_num)
613+
static enum omap_channel dpi_get_channel(struct dpi_data *dpi)
613614
{
614615
switch (dpi->dss_model) {
615616
case DSS_MODEL_OMAP2:
616617
case DSS_MODEL_OMAP3:
617618
return OMAP_DSS_CHANNEL_LCD;
618619

619620
case DSS_MODEL_DRA7:
620-
switch (port_num) {
621+
switch (dpi->id) {
621622
case 2:
622623
return OMAP_DSS_CHANNEL_LCD3;
623624
case 1:
@@ -690,12 +691,10 @@ static const struct omap_dss_device_ops dpi_ops = {
690691
static void dpi_init_output_port(struct dpi_data *dpi, struct device_node *port)
691692
{
692693
struct omap_dss_device *out = &dpi->output;
693-
int r;
694-
u32 port_num;
694+
u32 port_num = 0;
695695

696-
r = of_property_read_u32(port, "reg", &port_num);
697-
if (r)
698-
port_num = 0;
696+
of_property_read_u32(port, "reg", &port_num);
697+
dpi->id = port_num <= 2 ? port_num : 0;
699698

700699
switch (port_num) {
701700
case 2:
@@ -713,8 +712,8 @@ static void dpi_init_output_port(struct dpi_data *dpi, struct device_node *port)
713712
out->dev = &dpi->pdev->dev;
714713
out->id = OMAP_DSS_OUTPUT_DPI;
715714
out->output_type = OMAP_DISPLAY_TYPE_DPI;
716-
out->dispc_channel = dpi_get_channel(dpi, port_num);
717-
out->port_num = port_num;
715+
out->dispc_channel = dpi_get_channel(dpi);
716+
out->of_ports = BIT(port_num);
718717
out->ops = &dpi_ops;
719718
out->owner = THIS_MODULE;
720719

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4994,6 +4994,7 @@ static void dsi_init_output(struct dsi_data *dsi)
49944994
out->dispc_channel = dsi_get_channel(dsi);
49954995
out->ops = &dsi_ops;
49964996
out->owner = THIS_MODULE;
4997+
out->of_ports = BIT(0);
49974998

49984999
omapdss_device_register(out);
49995000
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,7 @@ static void hdmi_init_output(struct omap_hdmi *hdmi)
564564
out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
565565
out->ops = &hdmi_ops;
566566
out->owner = THIS_MODULE;
567+
out->of_ports = BIT(0);
567568

568569
omapdss_device_register(out);
569570
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,7 @@ static void hdmi_init_output(struct omap_hdmi *hdmi)
555555
out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
556556
out->ops = &hdmi_ops;
557557
out->owner = THIS_MODULE;
558+
out->of_ports = BIT(0);
558559

559560
omapdss_device_register(out);
560561
}

drivers/gpu/drm/omapdrm/dss/omapdss.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,8 +423,8 @@ struct omap_dss_device {
423423
/* output instance */
424424
enum omap_dss_output_id id;
425425

426-
/* the port number in the DT node */
427-
int port_num;
426+
/* bitmask of port numbers in DT */
427+
unsigned int of_ports;
428428
};
429429

430430
struct omap_dss_driver {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ static void sdi_init_output(struct sdi_device *sdi)
327327
out->name = "sdi.0";
328328
out->dispc_channel = OMAP_DSS_CHANNEL_LCD;
329329
/* We have SDI only on OMAP3, where it's on port 1 */
330-
out->port_num = 1;
330+
out->of_ports = BIT(1);
331331
out->ops = &sdi_ops;
332332
out->owner = THIS_MODULE;
333333

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,7 @@ static void venc_init_output(struct venc_device *venc)
767767
out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
768768
out->ops = &venc_ops;
769769
out->owner = THIS_MODULE;
770+
out->of_ports = BIT(0);
770771

771772
omapdss_device_register(out);
772773
}

0 commit comments

Comments
 (0)