tegra: dc: default HDMI VRR capability 0, and set on hotplug
Mitch Luban [Thu, 5 Nov 2015 21:19:05 +0000 (13:19 -0800)]
For DSI, vrr capability should be 1 by default when vrr nodes are
supplied. The same is not true for HDMI/DP - those should default
to 0 and only be marked as capable when hotplug a VRR monitor.

This change also adds checks for correct OR type for each type of vrr
settings.

Bug 1689933

Change-Id: Ifd0b7b4bde8927b532cea254b08a35b01b72c717
Signed-off-by: Jonathan McCaffrey <jmccaffrey@nvidia.com>
Signed-off-by: Daniel Solomon <daniels@nvidia.com>
Reviewed-on: http://git-master/r/828628
GVS: Gerrit_Virtual_Submit
Reviewed-by: Mitch Luban <mluban@nvidia.com>

drivers/video/tegra/dc/hdmi2.0.c
drivers/video/tegra/dc/of_dc.c

index 34f3782..1652b08 100644 (file)
@@ -551,12 +551,12 @@ static int tegra_hdmi_vrr_authentication(struct tegra_hdmi *hdmi)
        struct tegra_vrr *vrr  = dc->out->vrr;
 
        /*
-        * vrr panel authentication, the estimated time delay is about 200ms
-        * will be replaced with actual authentication code with subsequent
-        * change.
+        * TODO: vrr panel authentication, the estimated time delay is
+        * about 200ms will be replaced with actual authentication code
+        * with subsequent change.
         */
        mdelay(200);
-       vrr->authenticated = 1;
+       vrr->authenticated = 0;
 
        return err;
 }
index 47dec70..1e75e34 100644 (file)
@@ -2414,6 +2414,9 @@ struct tegra_dc_platform_data
        vrr_np = of_get_child_by_name(np_target_disp, "vrr-settings");
        if (!vrr_np || (pdata->default_out->n_modes < 2)) {
                pr_info("%s: could not find vrr-settings node\n", __func__);
+       } else if (pdata->default_out->type != TEGRA_DC_OUT_DSI) {
+               dev_err(&ndev->dev,
+                       "vrr-settings specified for a non-DSI head, disregarded\n");
        } else {
                dma_addr_t dma_addr;
                struct tegra_vrr *vrr;
@@ -2443,17 +2446,23 @@ struct tegra_dc_platform_data
 
        if (!of_property_read_u32(np_target_disp,
                                "nvidia,hdmi-vrr-caps", &temp)) {
-               struct tegra_vrr *vrr;
+               if (pdata->default_out->type != TEGRA_DC_OUT_HDMI) {
+                       dev_err(&ndev->dev,
+                               "nvidia,hdmi-vrr-caps specified for a non-HDMI head, disregarded\n");
+               } else {
+                       struct tegra_vrr *vrr;
 
-               pdata->default_out->vrr = devm_kzalloc(&ndev->dev,
-                               sizeof(struct tegra_vrr), GFP_KERNEL);
-               if (!pdata->default_out->vrr) {
-                       dev_err(&ndev->dev, "not enough memory\n");
-                       goto fail_parse;
+                       pdata->default_out->vrr = devm_kzalloc(&ndev->dev,
+                                       sizeof(struct tegra_vrr), GFP_KERNEL);
+                       if (!pdata->default_out->vrr) {
+                               dev_err(&ndev->dev, "not enough memory\n");
+                               goto fail_parse;
+                       }
+                       vrr = pdata->default_out->vrr;
+                       vrr->capability = 0;
+                       OF_DC_LOG("Vrr available, init vrr->capability to %d\n",
+                               vrr->capability);
                }
-               vrr = pdata->default_out->vrr;
-               vrr->capability = (unsigned) temp;
-               OF_DC_LOG("vrr->capability %d\n", vrr->capability);
        } else
                pr_info("%s: nvidia,hdmi-vrr-caps not present\n", __func__);