MLK-17275-7: drm/bridge: adv7511: Add dsi-channel property
authorRobert Chiras <robert.chiras@nxp.com>
Thu, 21 Dec 2017 12:10:42 +0000 (14:10 +0200)
committerNitin Garg <nitin.garg@nxp.com>
Tue, 20 Mar 2018 19:52:44 +0000 (14:52 -0500)
Add a new property "adi,dsi-channel" to allow the user specify the DSI
channel to be used when communicating with DSI peripheral.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
Documentation/devicetree/bindings/display/bridge/adi,adv7511.txt
drivers/gpu/drm/bridge/adv7511/adv7511.h
drivers/gpu/drm/bridge/adv7511/adv7533.c

index 8228b29..0e61244 100644 (file)
@@ -57,6 +57,8 @@ Optional properties:
 - adi,disable-timing-generator: Only for ADV7533 and ADV7535. Disables the
   internal timing generator. The chip will rely on the sync signals in the DSI
   data lanes, rather than generate its own timings for HDMI output.
+- adi,dsi-channel: Only for ADV7533 and ADV7535. DSI channel number to be used
+  when communicating with the DSI peripheral. It should be one of 0, 1, 2 or 3.
 
 Required nodes:
 
index f307e64..7e210cb 100644 (file)
@@ -334,6 +334,7 @@ struct adv7511 {
        struct device_node *host_node;
        struct mipi_dsi_device *dsi;
        u8 num_dsi_lanes;
+       u8 channel_id;
        bool use_timing_gen;
 
        enum adv7511_type type;
index d7f7b7c..824d6de 100644 (file)
@@ -184,7 +184,7 @@ int adv7533_attach_dsi(struct adv7511 *adv)
        struct mipi_dsi_device *dsi;
        int ret = 0;
        const struct mipi_dsi_device_info info = { .type = "adv7533",
-                                                  .channel = 0,
+                                                  .channel = adv->channel_id,
                                                   .node = NULL,
                                                 };
 
@@ -230,15 +230,25 @@ void adv7533_detach_dsi(struct adv7511 *adv)
 
 int adv7533_parse_dt(struct device_node *np, struct adv7511 *adv)
 {
-       u32 num_lanes;
+       struct device *dev = &adv->i2c_main->dev;
+       u32 num_lanes = 0, channel_id = 0;
        struct device_node *endpoint;
 
+       of_property_read_u32(np, "adi,dsi-channel", &channel_id);
        of_property_read_u32(np, "adi,dsi-lanes", &num_lanes);
 
-       if (num_lanes < 1 || num_lanes > 4)
+       if (num_lanes < 1 || num_lanes > 4) {
+               dev_err(dev, "Invalid dsi-lanes: %d\n", num_lanes);
                return -EINVAL;
+       }
+
+       if (channel_id > 3) {
+               dev_err(dev, "Invalid dsi-channel: %d\n", channel_id);
+               return -EINVAL;
+       }
 
        adv->num_dsi_lanes = num_lanes;
+       adv->channel_id = channel_id;
 
        endpoint = of_graph_get_next_endpoint(np, NULL);
        if (!endpoint)