Skip to content

Commit 79891d5

Browse files
wensmripard
authored andcommitted
drm/sun4i: tcon: Pass drm_encoder * into sun4i_tcon0_mode_set_cpu
sun4i_tcon0_mode_set_cpu() currently accepts struct mipi_dsi_device * as its second parameter. This is derived from drm_encoder. The DSI encoder is tied to the CPU interface mode of the TCON as a special case. In theory, if hardware were available, we could also support normal CPU interface modes. It is better to pass the generic encoder instead of the specialized mipi_dsi_device, and handle the differences inside the function. Passing the encoder would also enable the function to pass it, or any other data structures related to it, to other functions expecting it. One such example would be dithering support that will be added in a later patch, which looks at properties tied to the connector to determine whether dithering should be enabled or not. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com> Link: https://patchwork.freedesktop.org/patch/msgid/20180907041948.19913-2-wens@csie.org
1 parent 9a09a42 commit 79891d5

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

drivers/gpu/drm/sun4i/sun4i_tcon.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,12 @@ static void sun4i_tcon0_mode_set_common(struct sun4i_tcon *tcon,
278278
}
279279

280280
static void sun4i_tcon0_mode_set_cpu(struct sun4i_tcon *tcon,
281-
struct mipi_dsi_device *device,
281+
const struct drm_encoder *encoder,
282282
const struct drm_display_mode *mode)
283283
{
284+
/* TODO support normal CPU interface modes */
285+
struct sun6i_dsi *dsi = encoder_to_sun6i_dsi(encoder);
286+
struct mipi_dsi_device *device = dsi->device;
284287
u8 bpp = mipi_dsi_pixel_format_to_bpp(device->format);
285288
u8 lanes = device->lanes;
286289
u32 block_space, start_delay;
@@ -610,16 +613,10 @@ void sun4i_tcon_mode_set(struct sun4i_tcon *tcon,
610613
const struct drm_encoder *encoder,
611614
const struct drm_display_mode *mode)
612615
{
613-
struct sun6i_dsi *dsi;
614-
615616
switch (encoder->encoder_type) {
616617
case DRM_MODE_ENCODER_DSI:
617-
/*
618-
* This is not really elegant, but it's the "cleaner"
619-
* way I could think of...
620-
*/
621-
dsi = encoder_to_sun6i_dsi(encoder);
622-
sun4i_tcon0_mode_set_cpu(tcon, dsi->device, mode);
618+
/* DSI is tied to special case of CPU interface */
619+
sun4i_tcon0_mode_set_cpu(tcon, encoder, mode);
623620
break;
624621
case DRM_MODE_ENCODER_LVDS:
625622
sun4i_tcon0_mode_set_lvds(tcon, encoder, mode);

0 commit comments

Comments
 (0)