]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm: rcar-du: Hardcode encoders types to DRM_MODE_ENCODER_NONE
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Fri, 7 Oct 2016 14:39:21 +0000 (17:39 +0300)
committerLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tue, 4 Apr 2017 14:04:04 +0000 (17:04 +0300)
Unlike the connector type, the encoder type is unused by userspace. As
it is equally unused in the driver, except in a single location where
the connector type can be used instead, hardcode it to
DRM_MODE_ENCODER_NONE. This allow removing all code that tries to
determine (unsuccessfully in case a bridge is used) the encoder type.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
drivers/gpu/drm/rcar-du/rcar_du_drv.c
drivers/gpu/drm/rcar-du/rcar_du_drv.h
drivers/gpu/drm/rcar-du/rcar_du_encoder.c
drivers/gpu/drm/rcar-du/rcar_du_encoder.h
drivers/gpu/drm/rcar-du/rcar_du_kms.c

index a4f5520a9f3ea2f67a52ecb1dc2b3312f9425ca2..a3f71db6d4e794a5f029aaf703e0fb2419e18661 100644 (file)
@@ -44,12 +44,10 @@ static const struct rcar_du_device_info rcar_du_r8a7779_info = {
                 */
                [RCAR_DU_OUTPUT_DPAD0] = {
                        .possible_crtcs = BIT(0),
-                       .encoder_type = DRM_MODE_ENCODER_NONE,
                        .port = 0,
                },
                [RCAR_DU_OUTPUT_DPAD1] = {
                        .possible_crtcs = BIT(1) | BIT(0),
-                       .encoder_type = DRM_MODE_ENCODER_NONE,
                        .port = 1,
                },
        },
@@ -68,17 +66,14 @@ static const struct rcar_du_device_info rcar_du_r8a7790_info = {
                 */
                [RCAR_DU_OUTPUT_DPAD0] = {
                        .possible_crtcs = BIT(2) | BIT(1) | BIT(0),
-                       .encoder_type = DRM_MODE_ENCODER_NONE,
                        .port = 0,
                },
                [RCAR_DU_OUTPUT_LVDS0] = {
                        .possible_crtcs = BIT(0),
-                       .encoder_type = DRM_MODE_ENCODER_LVDS,
                        .port = 1,
                },
                [RCAR_DU_OUTPUT_LVDS1] = {
                        .possible_crtcs = BIT(2) | BIT(1),
-                       .encoder_type = DRM_MODE_ENCODER_LVDS,
                        .port = 2,
                },
        },
@@ -97,12 +92,10 @@ static const struct rcar_du_device_info rcar_du_r8a7791_info = {
                 */
                [RCAR_DU_OUTPUT_DPAD0] = {
                        .possible_crtcs = BIT(1) | BIT(0),
-                       .encoder_type = DRM_MODE_ENCODER_NONE,
                        .port = 0,
                },
                [RCAR_DU_OUTPUT_LVDS0] = {
                        .possible_crtcs = BIT(0),
-                       .encoder_type = DRM_MODE_ENCODER_LVDS,
                        .port = 1,
                },
        },
@@ -118,12 +111,10 @@ static const struct rcar_du_device_info rcar_du_r8a7792_info = {
                /* R8A7792 has two RGB outputs. */
                [RCAR_DU_OUTPUT_DPAD0] = {
                        .possible_crtcs = BIT(0),
-                       .encoder_type = DRM_MODE_ENCODER_NONE,
                        .port = 0,
                },
                [RCAR_DU_OUTPUT_DPAD1] = {
                        .possible_crtcs = BIT(1),
-                       .encoder_type = DRM_MODE_ENCODER_NONE,
                        .port = 1,
                },
        },
@@ -141,12 +132,10 @@ static const struct rcar_du_device_info rcar_du_r8a7794_info = {
                 */
                [RCAR_DU_OUTPUT_DPAD0] = {
                        .possible_crtcs = BIT(0),
-                       .encoder_type = DRM_MODE_ENCODER_NONE,
                        .port = 0,
                },
                [RCAR_DU_OUTPUT_DPAD1] = {
                        .possible_crtcs = BIT(1),
-                       .encoder_type = DRM_MODE_ENCODER_NONE,
                        .port = 1,
                },
        },
@@ -165,12 +154,10 @@ static const struct rcar_du_device_info rcar_du_r8a7795_info = {
                 */
                [RCAR_DU_OUTPUT_DPAD0] = {
                        .possible_crtcs = BIT(3),
-                       .encoder_type = DRM_MODE_ENCODER_NONE,
                        .port = 0,
                },
                [RCAR_DU_OUTPUT_LVDS0] = {
                        .possible_crtcs = BIT(0),
-                       .encoder_type = DRM_MODE_ENCODER_LVDS,
                        .port = 3,
                },
        },
@@ -189,12 +176,10 @@ static const struct rcar_du_device_info rcar_du_r8a7796_info = {
                 */
                [RCAR_DU_OUTPUT_DPAD0] = {
                        .possible_crtcs = BIT(2),
-                       .encoder_type = DRM_MODE_ENCODER_NONE,
                        .port = 0,
                },
                [RCAR_DU_OUTPUT_LVDS0] = {
                        .possible_crtcs = BIT(0),
-                       .encoder_type = DRM_MODE_ENCODER_LVDS,
                        .port = 2,
                },
        },
index 574b3c1c21dfe87d4c5a6217142aa9ad7e4d22e2..90eb209c244ed98704467f57e7f17a3d64bccef0 100644 (file)
@@ -38,7 +38,6 @@ struct rcar_du_lvdsenc;
 /*
  * struct rcar_du_output_routing - Output routing specification
  * @possible_crtcs: bitmask of possible CRTCs for the output
- * @encoder_type: DRM type of the internal encoder associated with the output
  * @port: device tree port number corresponding to this output route
  *
  * The DU has 5 possible outputs (DPAD0/1, LVDS0/1, TCON). Output routing data
@@ -47,7 +46,6 @@ struct rcar_du_lvdsenc;
  */
 struct rcar_du_output_routing {
        unsigned int possible_crtcs;
-       unsigned int encoder_type;
        unsigned int port;
 };
 
index 92a0405c2fb25467b0d70a6258adb2a5c0a621c8..3e048dd98b6421946f7e0c4612b0d991d59e4a45 100644 (file)
@@ -68,7 +68,7 @@ static int rcar_du_encoder_atomic_check(struct drm_encoder *encoder,
         * Only panel-related encoder types require validation here, everything
         * else is handled by the bridge drivers.
         */
-       if (encoder->encoder_type == DRM_MODE_ENCODER_LVDS) {
+       if (connector->connector_type == DRM_MODE_CONNECTOR_LVDS) {
                const struct drm_display_mode *panel_mode;
 
                if (list_empty(&connector->modes)) {
@@ -156,7 +156,6 @@ static const struct drm_encoder_funcs encoder_funcs = {
 };
 
 int rcar_du_encoder_init(struct rcar_du_device *rcdu,
-                        enum rcar_du_encoder_type type,
                         enum rcar_du_output output,
                         struct device_node *enc_node,
                         struct device_node *con_node)
@@ -164,7 +163,6 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
        struct rcar_du_encoder *renc;
        struct drm_encoder *encoder;
        struct drm_bridge *bridge = NULL;
-       unsigned int encoder_type;
        int ret;
 
        renc = devm_kzalloc(rcdu->dev, sizeof(*renc), GFP_KERNEL);
@@ -188,33 +186,23 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
        }
 
        if (enc_node) {
+               dev_dbg(rcdu->dev, "initializing encoder %s for output %u\n",
+                       of_node_full_name(enc_node), output);
+
                /* Locate the DRM bridge from the encoder DT node. */
                bridge = of_drm_find_bridge(enc_node);
                if (!bridge) {
                        ret = -EPROBE_DEFER;
                        goto done;
                }
-       }
-
-       switch (type) {
-       case RCAR_DU_ENCODER_VGA:
-               encoder_type = DRM_MODE_ENCODER_DAC;
-               break;
-       case RCAR_DU_ENCODER_LVDS:
-               encoder_type = DRM_MODE_ENCODER_LVDS;
-               break;
-       case RCAR_DU_ENCODER_HDMI:
-               encoder_type = DRM_MODE_ENCODER_TMDS;
-               break;
-       case RCAR_DU_ENCODER_NONE:
-       default:
-               /* No external encoder, use the internal encoder type. */
-               encoder_type = rcdu->info->routes[output].encoder_type;
-               break;
+       } else {
+               dev_dbg(rcdu->dev,
+                       "initializing internal encoder for output %u\n",
+                       output);
        }
 
        ret = drm_encoder_init(rcdu->ddev, encoder, &encoder_funcs,
-                              encoder_type, NULL);
+                              DRM_MODE_ENCODER_NONE, NULL);
        if (ret < 0)
                goto done;
 
index c1cfbe0d54ceb0ed1005352b27b0fd40d4c42541..5422fa4df2727518356e66825d86321f119ff445 100644 (file)
@@ -21,14 +21,6 @@ struct drm_panel;
 struct rcar_du_device;
 struct rcar_du_lvdsenc;
 
-enum rcar_du_encoder_type {
-       RCAR_DU_ENCODER_UNUSED = 0,
-       RCAR_DU_ENCODER_NONE,
-       RCAR_DU_ENCODER_VGA,
-       RCAR_DU_ENCODER_LVDS,
-       RCAR_DU_ENCODER_HDMI,
-};
-
 struct rcar_du_encoder {
        struct drm_encoder base;
        enum rcar_du_output output;
@@ -51,7 +43,6 @@ struct rcar_du_connector {
        container_of(c, struct rcar_du_connector, connector)
 
 int rcar_du_encoder_init(struct rcar_du_device *rcdu,
-                        enum rcar_du_encoder_type type,
                         enum rcar_du_output output,
                         struct device_node *enc_node,
                         struct device_node *con_node);
index 2e0b35afa69f4d274c3b38d4af126cf30de6003b..f38fc2f3f93d9c196380be1d1ac632ccd1965e89 100644 (file)
@@ -284,16 +284,6 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu,
                                     enum rcar_du_output output,
                                     struct of_endpoint *ep)
 {
-       static const struct {
-               const char *compatible;
-               enum rcar_du_encoder_type type;
-       } encoders[] = {
-               { "adi,adv7123", RCAR_DU_ENCODER_VGA },
-               { "adi,adv7511w", RCAR_DU_ENCODER_HDMI },
-               { "thine,thc63lvdm83d", RCAR_DU_ENCODER_LVDS },
-       };
-
-       enum rcar_du_encoder_type enc_type = RCAR_DU_ENCODER_NONE;
        struct device_node *connector = NULL;
        struct device_node *encoder = NULL;
        struct device_node *ep_node = NULL;
@@ -340,30 +330,7 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu,
 
        of_node_put(entity_ep_node);
 
-       if (encoder) {
-               /*
-                * If an encoder has been found, get its type based on its
-                * compatible string.
-                */
-               unsigned int i;
-
-               for (i = 0; i < ARRAY_SIZE(encoders); ++i) {
-                       if (of_device_is_compatible(encoder,
-                                                   encoders[i].compatible)) {
-                               enc_type = encoders[i].type;
-                               break;
-                       }
-               }
-
-               if (i == ARRAY_SIZE(encoders)) {
-                       dev_warn(rcdu->dev,
-                                "unknown encoder type for %s, skipping\n",
-                                encoder->full_name);
-                       of_node_put(encoder);
-                       of_node_put(connector);
-                       return -EINVAL;
-               }
-       } else {
+       if (!encoder) {
                /*
                 * If no encoder has been found the entity must be the
                 * connector.
@@ -371,7 +338,7 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu,
                connector = entity;
        }
 
-       ret = rcar_du_encoder_init(rcdu, enc_type, output, encoder, connector);
+       ret = rcar_du_encoder_init(rcdu, output, encoder, connector);
        if (ret && ret != -EPROBE_DEFER)
                dev_warn(rcdu->dev,
                         "failed to initialize encoder %s on output %u (%d), skipping\n",