Skip to content

Commit b4935e3

Browse files
pinchartltomba
authored andcommitted
drm/omap: Store bus flags in the omap_dss_device structure
Source components in the display pipeline need to configure their output signals polarities and clock driving edge based on the requirements of the sink component. Those requirements are currently shared across the whole pipeline in the flags of a videomode structure, instead of being local to each bus. This both prevents multiple buses from having different configurations (when the hardware supports it), and makes it difficult to move from videomode to drm_display_mode as the latter doesn't contain bus polarities and clock edge flags. Add a bus_flags field to the omap_dss_device structure and move the DISPLAY_FLAGS_DE_(LOW|HIGH), DISPLAY_FLAGS_PIXDATA_(POS|NEG)EDGE and DISPLAY_FLAGS_SYNC_(POS|NEG)EDGE videomode flags to bus_flags in all external encoders, connectors and panels. The videomode flags are still used internally for internal encoders, this will be addressed in a second step. The related videomode flags in the default mode of the DVI connector can simply be dropped, as they are always overridden by the TFP410 driver. Note that this results in both the DISPLAY_FLAGS_SYNC_POSEDGE and DISPLAY_FLAGS_SYNC_NEGEDGE flags being set, which is invalid, but only the former is tested for when programming the DISPC, so the DVI connector flags are effectively overridden by the TFP410 flags. 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 26c91a3 commit b4935e3

12 files changed

+79
-66
lines changed

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ static const struct videomode dvic_default_vm = {
3333
.vsync_len = 4,
3434
.vback_porch = 7,
3535

36-
.flags = DISPLAY_FLAGS_HSYNC_HIGH | DISPLAY_FLAGS_VSYNC_HIGH |
37-
DISPLAY_FLAGS_SYNC_NEGEDGE | DISPLAY_FLAGS_DE_HIGH |
38-
DISPLAY_FLAGS_PIXDATA_POSEDGE,
36+
.flags = DISPLAY_FLAGS_HSYNC_HIGH | DISPLAY_FLAGS_VSYNC_HIGH,
3937
};
4038

4139
struct panel_drv_data {

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

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,6 @@ static void tfp410_disable(struct omap_dss_device *dssdev)
7676
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
7777
}
7878

79-
static void tfp410_fix_timings(struct videomode *vm)
80-
{
81-
vm->flags |= DISPLAY_FLAGS_DE_HIGH | DISPLAY_FLAGS_PIXDATA_POSEDGE |
82-
DISPLAY_FLAGS_SYNC_POSEDGE;
83-
}
84-
8579
static void tfp410_set_timings(struct omap_dss_device *dssdev,
8680
const struct videomode *vm)
8781
{
@@ -95,8 +89,6 @@ static int tfp410_check_timings(struct omap_dss_device *dssdev,
9589
{
9690
struct omap_dss_device *src = dssdev->src;
9791

98-
tfp410_fix_timings(vm);
99-
10092
return src->ops->check_timings(src, vm);
10193
}
10294

@@ -137,6 +129,8 @@ static int tfp410_probe(struct platform_device *pdev)
137129
dssdev->output_type = OMAP_DISPLAY_TYPE_DVI;
138130
dssdev->owner = THIS_MODULE;
139131
dssdev->of_ports = BIT(1) | BIT(0);
132+
dssdev->bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_SYNC_POSEDGE
133+
| DRM_BUS_FLAG_PIXDATA_POSEDGE;
140134

141135
dssdev->next = omapdss_of_find_connected_device(pdev->dev.of_node, 1);
142136
if (IS_ERR(dssdev->next)) {

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,7 @@ static const struct videomode lb035q02_vm = {
3333
.vfront_porch = 4,
3434
.vback_porch = 18,
3535

36-
.flags = DISPLAY_FLAGS_HSYNC_LOW | DISPLAY_FLAGS_VSYNC_LOW |
37-
DISPLAY_FLAGS_DE_HIGH | DISPLAY_FLAGS_SYNC_NEGEDGE |
38-
DISPLAY_FLAGS_PIXDATA_POSEDGE,
39-
/*
40-
* Note: According to the panel documentation:
41-
* DE is active LOW
42-
* DATA needs to be driven on the FALLING edge
43-
*/
36+
.flags = DISPLAY_FLAGS_HSYNC_LOW | DISPLAY_FLAGS_VSYNC_LOW,
4437
};
4538

4639
struct panel_drv_data {
@@ -252,6 +245,14 @@ static int lb035q02_panel_spi_probe(struct spi_device *spi)
252245
dssdev->owner = THIS_MODULE;
253246
dssdev->of_ports = BIT(0);
254247

248+
/*
249+
* Note: According to the panel documentation:
250+
* DE is active LOW
251+
* DATA needs to be driven on the FALLING edge
252+
*/
253+
dssdev->bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_SYNC_NEGEDGE
254+
| DRM_BUS_FLAG_PIXDATA_POSEDGE;
255+
255256
omapdss_display_init(dssdev);
256257
omapdss_device_register(dssdev);
257258

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,7 @@ static const struct videomode nec_8048_panel_vm = {
7171
.vsync_len = 1,
7272
.vback_porch = 4,
7373

74-
.flags = DISPLAY_FLAGS_HSYNC_LOW | DISPLAY_FLAGS_VSYNC_LOW |
75-
DISPLAY_FLAGS_DE_HIGH | DISPLAY_FLAGS_SYNC_POSEDGE |
76-
DISPLAY_FLAGS_PIXDATA_POSEDGE,
74+
.flags = DISPLAY_FLAGS_HSYNC_LOW | DISPLAY_FLAGS_VSYNC_LOW,
7775
};
7876

7977
#define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev)
@@ -241,6 +239,8 @@ static int nec_8048_probe(struct spi_device *spi)
241239
dssdev->type = OMAP_DISPLAY_TYPE_DPI;
242240
dssdev->owner = THIS_MODULE;
243241
dssdev->of_ports = BIT(0);
242+
dssdev->bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_SYNC_POSEDGE
243+
| DRM_BUS_FLAG_PIXDATA_POSEDGE;
244244

245245
omapdss_display_init(dssdev);
246246
omapdss_device_register(dssdev);

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,7 @@ static const struct videomode sharp_ls_vm = {
4646
.vfront_porch = 1,
4747
.vback_porch = 1,
4848

49-
.flags = DISPLAY_FLAGS_HSYNC_LOW | DISPLAY_FLAGS_VSYNC_LOW |
50-
DISPLAY_FLAGS_DE_HIGH | DISPLAY_FLAGS_SYNC_NEGEDGE |
51-
DISPLAY_FLAGS_PIXDATA_POSEDGE,
52-
/*
53-
* Note: According to the panel documentation:
54-
* DATA needs to be driven on the FALLING edge
55-
*/
49+
.flags = DISPLAY_FLAGS_HSYNC_LOW | DISPLAY_FLAGS_VSYNC_LOW,
5650
};
5751

5852
#define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev)
@@ -250,6 +244,13 @@ static int sharp_ls_probe(struct platform_device *pdev)
250244
dssdev->owner = THIS_MODULE;
251245
dssdev->of_ports = BIT(0);
252246

247+
/*
248+
* Note: According to the panel documentation:
249+
* DATA needs to be driven on the FALLING edge
250+
*/
251+
dssdev->bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_SYNC_NEGEDGE
252+
| DRM_BUS_FLAG_PIXDATA_POSEDGE;
253+
253254
omapdss_display_init(dssdev);
254255
omapdss_device_register(dssdev);
255256

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,7 @@ static const struct videomode acx565akm_panel_vm = {
9797
.vsync_len = 3,
9898
.vback_porch = 4,
9999

100-
.flags = DISPLAY_FLAGS_HSYNC_LOW | DISPLAY_FLAGS_VSYNC_LOW |
101-
DISPLAY_FLAGS_DE_HIGH | DISPLAY_FLAGS_SYNC_NEGEDGE |
102-
DISPLAY_FLAGS_PIXDATA_POSEDGE,
100+
.flags = DISPLAY_FLAGS_HSYNC_LOW | DISPLAY_FLAGS_VSYNC_LOW,
103101
};
104102

105103
#define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev)
@@ -764,6 +762,8 @@ static int acx565akm_probe(struct spi_device *spi)
764762
dssdev->type = OMAP_DISPLAY_TYPE_SDI;
765763
dssdev->owner = THIS_MODULE;
766764
dssdev->of_ports = BIT(0);
765+
dssdev->bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_SYNC_NEGEDGE
766+
| DRM_BUS_FLAG_PIXDATA_POSEDGE;
767767

768768
omapdss_display_init(dssdev);
769769
omapdss_device_register(dssdev);

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,7 @@ static const struct videomode td028ttec1_panel_vm = {
4949
.vsync_len = 2,
5050
.vback_porch = 2,
5151

52-
.flags = DISPLAY_FLAGS_HSYNC_LOW | DISPLAY_FLAGS_VSYNC_LOW |
53-
DISPLAY_FLAGS_DE_HIGH | DISPLAY_FLAGS_SYNC_POSEDGE |
54-
DISPLAY_FLAGS_PIXDATA_NEGEDGE,
55-
/*
56-
* Note: According to the panel documentation:
57-
* SYNC needs to be driven on the FALLING edge
58-
*/
52+
.flags = DISPLAY_FLAGS_HSYNC_LOW | DISPLAY_FLAGS_VSYNC_LOW,
5953
};
6054

6155
#define JBT_COMMAND 0x000
@@ -374,6 +368,13 @@ static int td028ttec1_panel_probe(struct spi_device *spi)
374368
dssdev->owner = THIS_MODULE;
375369
dssdev->of_ports = BIT(0);
376370

371+
/*
372+
* Note: According to the panel documentation:
373+
* SYNC needs to be driven on the FALLING edge
374+
*/
375+
dssdev->bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_SYNC_POSEDGE
376+
| DRM_BUS_FLAG_PIXDATA_NEGEDGE;
377+
377378
omapdss_display_init(dssdev);
378379
omapdss_device_register(dssdev);
379380

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,7 @@ static const struct videomode tpo_td043_vm = {
8181
.vfront_porch = 39,
8282
.vback_porch = 34,
8383

84-
.flags = DISPLAY_FLAGS_HSYNC_LOW | DISPLAY_FLAGS_VSYNC_LOW |
85-
DISPLAY_FLAGS_DE_HIGH | DISPLAY_FLAGS_SYNC_POSEDGE |
86-
DISPLAY_FLAGS_PIXDATA_NEGEDGE,
87-
/*
88-
* Note: According to the panel documentation:
89-
* SYNC needs to be driven on the FALLING edge
90-
*/
84+
.flags = DISPLAY_FLAGS_HSYNC_LOW | DISPLAY_FLAGS_VSYNC_LOW,
9185
};
9286

9387
#define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev)
@@ -472,6 +466,13 @@ static int tpo_td043_probe(struct spi_device *spi)
472466
dssdev->owner = THIS_MODULE;
473467
dssdev->of_ports = BIT(0);
474468

469+
/*
470+
* Note: According to the panel documentation:
471+
* SYNC needs to be driven on the FALLING edge
472+
*/
473+
dssdev->bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_SYNC_POSEDGE
474+
| DRM_BUS_FLAG_PIXDATA_NEGEDGE;
475+
475476
omapdss_display_init(dssdev);
476477
omapdss_device_register(dssdev);
477478

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4053,12 +4053,6 @@ static int dsi_display_init_dispc(struct dsi_data *dsi)
40534053
dsi->vm.flags |= DISPLAY_FLAGS_HSYNC_HIGH;
40544054
dsi->vm.flags &= ~DISPLAY_FLAGS_VSYNC_LOW;
40554055
dsi->vm.flags |= DISPLAY_FLAGS_VSYNC_HIGH;
4056-
dsi->vm.flags &= ~DISPLAY_FLAGS_PIXDATA_NEGEDGE;
4057-
dsi->vm.flags |= DISPLAY_FLAGS_PIXDATA_POSEDGE;
4058-
dsi->vm.flags &= ~DISPLAY_FLAGS_DE_LOW;
4059-
dsi->vm.flags |= DISPLAY_FLAGS_DE_HIGH;
4060-
dsi->vm.flags &= ~DISPLAY_FLAGS_SYNC_POSEDGE;
4061-
dsi->vm.flags |= DISPLAY_FLAGS_SYNC_NEGEDGE;
40624056

40634057
dss_mgr_set_timings(&dsi->output, &dsi->vm);
40644058

@@ -5142,6 +5136,9 @@ static int dsi_init_output(struct dsi_data *dsi)
51425136
out->ops = &dsi_ops;
51435137
out->owner = THIS_MODULE;
51445138
out->of_ports = BIT(0);
5139+
out->bus_flags = DRM_BUS_FLAG_PIXDATA_POSEDGE
5140+
| DRM_BUS_FLAG_DE_HIGH
5141+
| DRM_BUS_FLAG_SYNC_NEGEDGE;
51455142

51465143
out->next = omapdss_of_find_connected_device(out->dev->of_node, 0);
51475144
if (IS_ERR(out->next)) {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,7 @@ struct omap_dss_device {
432432
const struct omap_dss_driver *driver;
433433
const struct omap_dss_device_ops *ops;
434434
unsigned long ops_flags;
435+
unsigned long bus_flags;
435436

436437
/* helper variable for driver suspend/resume */
437438
bool activate_after_resume;

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,6 @@ static int sdi_display_enable(struct omap_dss_device *dssdev)
151151
if (r)
152152
goto err_get_dispc;
153153

154-
/* 15.5.9.1.2 */
155-
vm->flags |= DISPLAY_FLAGS_PIXDATA_POSEDGE | DISPLAY_FLAGS_SYNC_POSEDGE;
156-
157154
r = sdi_calc_clock_div(sdi, vm->pixelclock, &fck, &dispc_cinfo);
158155
if (r)
159156
goto err_calc_clock_div;
@@ -298,6 +295,8 @@ static int sdi_init_output(struct sdi_device *sdi)
298295
out->of_ports = BIT(1);
299296
out->ops = &sdi_ops;
300297
out->owner = THIS_MODULE;
298+
out->bus_flags = DRM_BUS_FLAG_PIXDATA_POSEDGE /* 15.5.9.1.2 */
299+
| DRM_BUS_FLAG_SYNC_POSEDGE;
301300

302301
out->next = omapdss_of_find_connected_device(out->dev->of_node, 1);
303302
if (IS_ERR(out->next)) {

drivers/gpu/drm/omapdrm/omap_crtc.c

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -419,12 +419,9 @@ static enum drm_mode_status omap_crtc_mode_valid(struct drm_crtc *crtc,
419419
static void omap_crtc_mode_set_nofb(struct drm_crtc *crtc)
420420
{
421421
struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
422-
struct omap_dss_device *display = omap_crtc->pipe->display;
423422
struct drm_display_mode *mode = &crtc->state->adjusted_mode;
424-
const u32 flags_mask = DISPLAY_FLAGS_DE_HIGH | DISPLAY_FLAGS_DE_LOW |
425-
DISPLAY_FLAGS_PIXDATA_POSEDGE | DISPLAY_FLAGS_PIXDATA_NEGEDGE |
426-
DISPLAY_FLAGS_SYNC_POSEDGE | DISPLAY_FLAGS_SYNC_NEGEDGE;
427-
struct videomode vm = {0};
423+
struct videomode *vm = &omap_crtc->vm;
424+
struct omap_dss_device *dssdev;
428425

429426
DBG("%s: set mode: %d:\"%s\" %d %d %d %d %d %d %d %d %d %d 0x%x 0x%x",
430427
omap_crtc->name, mode->base.id, mode->name,
@@ -433,7 +430,7 @@ static void omap_crtc_mode_set_nofb(struct drm_crtc *crtc)
433430
mode->vdisplay, mode->vsync_start, mode->vsync_end, mode->vtotal,
434431
mode->type, mode->flags);
435432

436-
drm_display_mode_to_videomode(mode, &omap_crtc->vm);
433+
drm_display_mode_to_videomode(mode, vm);
437434

438435
/*
439436
* HACK: This fixes the vm flags.
@@ -442,13 +439,36 @@ static void omap_crtc_mode_set_nofb(struct drm_crtc *crtc)
442439
* struct drm_display_mode and struct videomode. The hack below
443440
* goes and fetches the missing flags from the panel drivers.
444441
*
445-
* Correct solution would be to use DRM's bus-flags, but that's not
446-
* easily possible before the omapdrm's panel/encoder driver model
447-
* has been changed to the DRM model.
442+
* A better solution is to use DRM's bus-flags through the whole driver.
448443
*/
449444

450-
display->ops->get_timings(display, &vm);
451-
omap_crtc->vm.flags |= vm.flags & flags_mask;
445+
for (dssdev = omap_crtc->pipe->output; dssdev; dssdev = dssdev->next) {
446+
unsigned long bus_flags = dssdev->bus_flags;
447+
448+
if (!(vm->flags & (DISPLAY_FLAGS_DE_LOW |
449+
DISPLAY_FLAGS_DE_HIGH))) {
450+
if (bus_flags & DRM_BUS_FLAG_DE_LOW)
451+
vm->flags |= DISPLAY_FLAGS_DE_LOW;
452+
else if (bus_flags & DRM_BUS_FLAG_DE_HIGH)
453+
vm->flags |= DISPLAY_FLAGS_DE_HIGH;
454+
}
455+
456+
if (!(vm->flags & (DISPLAY_FLAGS_PIXDATA_POSEDGE |
457+
DISPLAY_FLAGS_PIXDATA_NEGEDGE))) {
458+
if (bus_flags & DRM_BUS_FLAG_PIXDATA_POSEDGE)
459+
vm->flags |= DISPLAY_FLAGS_PIXDATA_POSEDGE;
460+
else if (bus_flags & DRM_BUS_FLAG_PIXDATA_NEGEDGE)
461+
vm->flags |= DISPLAY_FLAGS_PIXDATA_NEGEDGE;
462+
}
463+
464+
if (!(vm->flags & (DISPLAY_FLAGS_SYNC_POSEDGE |
465+
DISPLAY_FLAGS_SYNC_NEGEDGE))) {
466+
if (bus_flags & DRM_BUS_FLAG_SYNC_POSEDGE)
467+
vm->flags |= DISPLAY_FLAGS_SYNC_POSEDGE;
468+
else if (bus_flags & DRM_BUS_FLAG_SYNC_NEGEDGE)
469+
vm->flags |= DISPLAY_FLAGS_SYNC_NEGEDGE;
470+
}
471+
}
452472
}
453473

454474
static int omap_crtc_atomic_check(struct drm_crtc *crtc,

0 commit comments

Comments
 (0)