Skip to content

Commit 4ed094f

Browse files
committed
drm/imx: use bus_flags for pixel clock polarity
This patch allows panels to set pixel clock and data enable pin polarity other than the default of driving data at the falling pixel clock edge and active high display enable. Signed-off-by: Philipp Zabel <[email protected]>
1 parent 7932131 commit 4ed094f

File tree

5 files changed

+25
-15
lines changed

5 files changed

+25
-15
lines changed

drivers/gpu/drm/imx/imx-drm-core.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ static struct imx_drm_crtc *imx_drm_find_crtc(struct drm_crtc *crtc)
9797
return NULL;
9898
}
9999

100-
int imx_drm_set_bus_format_pins(struct drm_encoder *encoder, u32 bus_format,
101-
int hsync_pin, int vsync_pin)
100+
int imx_drm_set_bus_config(struct drm_encoder *encoder, u32 bus_format,
101+
int hsync_pin, int vsync_pin, u32 bus_flags)
102102
{
103103
struct imx_drm_crtc_helper_funcs *helper;
104104
struct imx_drm_crtc *imx_crtc;
@@ -110,14 +110,17 @@ int imx_drm_set_bus_format_pins(struct drm_encoder *encoder, u32 bus_format,
110110
helper = &imx_crtc->imx_drm_helper_funcs;
111111
if (helper->set_interface_pix_fmt)
112112
return helper->set_interface_pix_fmt(encoder->crtc,
113-
bus_format, hsync_pin, vsync_pin);
113+
bus_format, hsync_pin, vsync_pin,
114+
bus_flags);
114115
return 0;
115116
}
116-
EXPORT_SYMBOL_GPL(imx_drm_set_bus_format_pins);
117+
EXPORT_SYMBOL_GPL(imx_drm_set_bus_config);
117118

118119
int imx_drm_set_bus_format(struct drm_encoder *encoder, u32 bus_format)
119120
{
120-
return imx_drm_set_bus_format_pins(encoder, bus_format, 2, 3);
121+
return imx_drm_set_bus_config(encoder, bus_format, 2, 3,
122+
DRM_BUS_FLAG_DE_HIGH |
123+
DRM_BUS_FLAG_PIXDATA_NEGEDGE);
121124
}
122125
EXPORT_SYMBOL_GPL(imx_drm_set_bus_format);
123126

drivers/gpu/drm/imx/imx-drm.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ struct imx_drm_crtc_helper_funcs {
1919
int (*enable_vblank)(struct drm_crtc *crtc);
2020
void (*disable_vblank)(struct drm_crtc *crtc);
2121
int (*set_interface_pix_fmt)(struct drm_crtc *crtc,
22-
u32 bus_format, int hsync_pin, int vsync_pin);
22+
u32 bus_format, int hsync_pin, int vsync_pin,
23+
u32 bus_flags);
2324
const struct drm_crtc_helper_funcs *crtc_helper_funcs;
2425
const struct drm_crtc_funcs *crtc_funcs;
2526
};
@@ -41,8 +42,8 @@ void imx_drm_mode_config_init(struct drm_device *drm);
4142

4243
struct drm_gem_cma_object *imx_drm_fb_get_obj(struct drm_framebuffer *fb);
4344

44-
int imx_drm_set_bus_format_pins(struct drm_encoder *encoder,
45-
u32 bus_format, int hsync_pin, int vsync_pin);
45+
int imx_drm_set_bus_config(struct drm_encoder *encoder, u32 bus_format,
46+
int hsync_pin, int vsync_pin, u32 bus_flags);
4647
int imx_drm_set_bus_format(struct drm_encoder *encoder,
4748
u32 bus_format);
4849

drivers/gpu/drm/imx/imx-tve.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,10 @@ static void imx_tve_encoder_prepare(struct drm_encoder *encoder)
294294

295295
switch (tve->mode) {
296296
case TVE_MODE_VGA:
297-
imx_drm_set_bus_format_pins(encoder, MEDIA_BUS_FMT_GBR888_1X24,
298-
tve->hsync_pin, tve->vsync_pin);
297+
imx_drm_set_bus_config(encoder, MEDIA_BUS_FMT_GBR888_1X24,
298+
tve->hsync_pin, tve->vsync_pin,
299+
DRM_BUS_FLAG_DE_HIGH |
300+
DRM_BUS_FLAG_PIXDATA_NEGEDGE);
299301
break;
300302
case TVE_MODE_TVOUT:
301303
imx_drm_set_bus_format(encoder, MEDIA_BUS_FMT_YUV8_1X24);

drivers/gpu/drm/imx/ipuv3-crtc.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ struct ipu_crtc {
6666
struct ipu_flip_work *flip_work;
6767
int irq;
6868
u32 bus_format;
69+
u32 bus_flags;
6970
int di_hsync_pin;
7071
int di_vsync_pin;
7172
};
@@ -271,8 +272,10 @@ static int ipu_crtc_mode_set(struct drm_crtc *crtc,
271272
else
272273
sig_cfg.clkflags = 0;
273274

274-
sig_cfg.enable_pol = 1;
275-
sig_cfg.clk_pol = 0;
275+
sig_cfg.enable_pol = !(ipu_crtc->bus_flags & DRM_BUS_FLAG_DE_LOW);
276+
/* Default to driving pixel data on negative clock edges */
277+
sig_cfg.clk_pol = !!(ipu_crtc->bus_flags &
278+
DRM_BUS_FLAG_PIXDATA_POSEDGE);
276279
sig_cfg.bus_format = ipu_crtc->bus_format;
277280
sig_cfg.v_to_h_sync = 0;
278281
sig_cfg.hsync_pin = ipu_crtc->di_hsync_pin;
@@ -396,11 +399,12 @@ static void ipu_disable_vblank(struct drm_crtc *crtc)
396399
}
397400

398401
static int ipu_set_interface_pix_fmt(struct drm_crtc *crtc,
399-
u32 bus_format, int hsync_pin, int vsync_pin)
402+
u32 bus_format, int hsync_pin, int vsync_pin, u32 bus_flags)
400403
{
401404
struct ipu_crtc *ipu_crtc = to_ipu_crtc(crtc);
402405

403406
ipu_crtc->bus_format = bus_format;
407+
ipu_crtc->bus_flags = bus_flags;
404408
ipu_crtc->di_hsync_pin = hsync_pin;
405409
ipu_crtc->di_vsync_pin = vsync_pin;
406410

drivers/gpu/drm/imx/parallel-display.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ static void imx_pd_encoder_dpms(struct drm_encoder *encoder, int mode)
115115
static void imx_pd_encoder_prepare(struct drm_encoder *encoder)
116116
{
117117
struct imx_parallel_display *imxpd = enc_to_imxpd(encoder);
118-
119-
imx_drm_set_bus_format(encoder, imxpd->bus_format);
118+
imx_drm_set_bus_config(encoder, imxpd->bus_format, 2, 3,
119+
imxpd->connector.display_info.bus_flags);
120120
}
121121

122122
static void imx_pd_encoder_commit(struct drm_encoder *encoder)

0 commit comments

Comments
 (0)