drm/imx: convey the pixelclk-active and de-active flags from DT to the ipu-di driver
authorLothar Waßmann <LW@KARO-electronics.de>
Tue, 12 Jul 2016 13:30:03 +0000 (15:30 +0200)
committerPhilipp Zabel <p.zabel@pengutronix.de>
Mon, 8 Aug 2016 09:44:20 +0000 (11:44 +0200)
The 'de-active' and 'pixelclk-active' DT properties are evaluated
by of_parse_display_timing() called from  of_get_drm_display_mode(),
but later lost in the conversion from videomode.flags to
drm_display_mode.flags.
Enhance of_get_drm_display_mode() to also return the bus flags in a
separate variable, so that they can be passed on to the ipu-di
driver.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
drivers/gpu/drm/drm_modes.c
drivers/gpu/drm/imx/imx-ldb.c
drivers/gpu/drm/imx/parallel-display.c
include/drm/drm_modes.h

index 51804e5c58b948b47f11230a70837dd8c02b242d..15704873fd611e9a8a1ed032438342907a9545ee 100644 (file)
@@ -687,7 +687,8 @@ EXPORT_SYMBOL_GPL(drm_bus_flags_from_videomode);
  * 0 on success, a negative errno code when no of videomode node was found.
  */
 int of_get_drm_display_mode(struct device_node *np,
-                           struct drm_display_mode *dmode, int index)
+                           struct drm_display_mode *dmode, u32 *bus_flags,
+                           int index)
 {
        struct videomode vm;
        int ret;
@@ -697,6 +698,8 @@ int of_get_drm_display_mode(struct device_node *np,
                return ret;
 
        drm_display_mode_from_videomode(&vm, dmode);
+       if (bus_flags)
+               drm_bus_flags_from_videomode(&vm, bus_flags);
 
        pr_debug("%s: got %dx%d display mode from %s\n",
                of_node_full_name(np), vm.hactive, vm.vactive, np->name);
index b03919ed60bade2f2051aeb4fc41389f64843608..3ed2d5037fe2b037582fc238cf76c6e12f6e4d6c 100644 (file)
@@ -66,6 +66,7 @@ struct imx_ldb_channel {
        struct drm_display_mode mode;
        int mode_valid;
        u32 bus_format;
+       u32 bus_flags;
 };
 
 static inline struct imx_ldb_channel *con_to_imx_ldb_ch(struct drm_connector *c)
@@ -379,8 +380,13 @@ static int imx_ldb_encoder_atomic_check(struct drm_encoder *encoder,
        u32 bus_format = imx_ldb_ch->bus_format;
 
        /* Bus format description in DT overrides connector display info. */
-       if (!bus_format && di->num_bus_formats)
+       if (!bus_format && di->num_bus_formats) {
                bus_format = di->bus_formats[0];
+               imx_crtc_state->bus_flags = di->bus_flags;
+       } else {
+               bus_format = imx_ldb_ch->bus_format;
+               imx_crtc_state->bus_flags = imx_ldb_ch->bus_flags;
+       }
        switch (bus_format) {
        case MEDIA_BUS_FMT_RGB666_1X7X3_SPWG:
                imx_crtc_state->bus_format = MEDIA_BUS_FMT_RGB666_1X18;
@@ -674,6 +680,7 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data)
                                /* fallback to display-timings node */
                                ret = of_get_drm_display_mode(child,
                                                              &channel->mode,
+                                                             &channel->bus_flags,
                                                              OF_USE_NATIVE_MODE);
                                if (!ret)
                                        channel->mode_valid = 1;
index 1dad297b01fd5a5723b5cba7dd92b352057c7d7a..74b0ac06fdab57fcd69218e9c45be3f7d88276e0 100644 (file)
@@ -33,6 +33,7 @@ struct imx_parallel_display {
        void *edid;
        int edid_len;
        u32 bus_format;
+       u32 bus_flags;
        struct drm_display_mode mode;
        struct drm_panel *panel;
        struct drm_bridge *bridge;
@@ -80,6 +81,7 @@ static int imx_pd_connector_get_modes(struct drm_connector *connector)
                        return -EINVAL;
 
                ret = of_get_drm_display_mode(np, &imxpd->mode,
+                                             &imxpd->bus_flags,
                                              OF_USE_NATIVE_MODE);
                if (ret)
                        return ret;
@@ -125,11 +127,13 @@ static int imx_pd_encoder_atomic_check(struct drm_encoder *encoder,
        struct drm_display_info *di = &conn_state->connector->display_info;
        struct imx_parallel_display *imxpd = enc_to_imxpd(encoder);
 
-       imx_crtc_state->bus_flags = di->bus_flags;
-       if (!imxpd->bus_format && di->num_bus_formats)
+       if (!imxpd->bus_format && di->num_bus_formats) {
+               imx_crtc_state->bus_flags = di->bus_flags;
                imx_crtc_state->bus_format = di->bus_formats[0];
-       else
+       } else {
+               imx_crtc_state->bus_flags = imxpd->bus_flags;
                imx_crtc_state->bus_format = imxpd->bus_format;
+       }
        imx_crtc_state->di_hsync_pin = 2;
        imx_crtc_state->di_vsync_pin = 3;
 
index a8164d2336e6fee9c26e1b34574ff464656e4942..48e1a56ea283b7c898312290f652ed36bbc668d5 100644 (file)
@@ -459,7 +459,7 @@ void drm_display_mode_to_videomode(const struct drm_display_mode *dmode,
                                   struct videomode *vm);
 void drm_bus_flags_from_videomode(const struct videomode *vm, u32 *bus_flags);
 int of_get_drm_display_mode(struct device_node *np,
-                           struct drm_display_mode *dmode,
+                           struct drm_display_mode *dmode, u32 *bus_flags,
                            int index);
 
 void drm_mode_set_name(struct drm_display_mode *mode);