Merge tag 'cleanup-for-3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/arm...
[cascardo/linux.git] / drivers / gpu / drm / tegra / sor.c
index 7f8ca5d..7829e81 100644 (file)
@@ -517,7 +517,7 @@ static int tegra_output_sor_enable(struct tegra_output *output)
                if (err < 0) {
                        dev_err(sor->dev, "failed to probe eDP link: %d\n",
                                err);
-                       return err;
+                       goto unlock;
                }
        }
 
@@ -526,7 +526,7 @@ static int tegra_output_sor_enable(struct tegra_output *output)
                dev_err(sor->dev, "failed to set safe parent clock: %d\n", err);
 
        memset(&config, 0, sizeof(config));
-       config.bits_per_pixel = 24; /* XXX: don't hardcode? */
+       config.bits_per_pixel = output->connector.display_info.bpc * 3;
 
        err = tegra_sor_calc_config(sor, mode, &config, &link);
        if (err < 0)
@@ -816,12 +816,22 @@ static int tegra_output_sor_enable(struct tegra_output *output)
         * configure panel (24bpp, vsync-, hsync-, DP-A protocol, complete
         * raster, associate with display controller)
         */
-       value = SOR_STATE_ASY_VSYNCPOL |
-               SOR_STATE_ASY_HSYNCPOL |
-               SOR_STATE_ASY_PROTOCOL_DP_A |
+       value = SOR_STATE_ASY_PROTOCOL_DP_A |
                SOR_STATE_ASY_CRC_MODE_COMPLETE |
                SOR_STATE_ASY_OWNER(dc->pipe + 1);
 
+       if (mode->flags & DRM_MODE_FLAG_PHSYNC)
+               value &= ~SOR_STATE_ASY_HSYNCPOL;
+
+       if (mode->flags & DRM_MODE_FLAG_NHSYNC)
+               value |= SOR_STATE_ASY_HSYNCPOL;
+
+       if (mode->flags & DRM_MODE_FLAG_PVSYNC)
+               value &= ~SOR_STATE_ASY_VSYNCPOL;
+
+       if (mode->flags & DRM_MODE_FLAG_NVSYNC)
+               value |= SOR_STATE_ASY_VSYNCPOL;
+
        switch (config.bits_per_pixel) {
        case 24:
                value |= SOR_STATE_ASY_PIXELDEPTH_BPP_24_444;
@@ -1456,6 +1466,7 @@ static const struct of_device_id tegra_sor_of_match[] = {
        { .compatible = "nvidia,tegra124-sor", },
        { },
 };
+MODULE_DEVICE_TABLE(of, tegra_sor_of_match);
 
 struct platform_driver tegra_sor_driver = {
        .driver = {