video: tegra: dc: report correct display output type
Jon Mayo [Wed, 7 Nov 2012 21:16:21 +0000 (13:16 -0800)]
Remove hardcoded output types, and report the configured display type
through the ioctl TEGRA_DC_EXT_CONTROL_GET_OUTPUT_PROPERTIES.

Bug 1003636

Change-Id: Iff0c28a348c14280516dd40c822cbeab7a8a2724
Signed-off-by: Jon Mayo <jmayo@nvidia.com>
Reviewed-on: http://git-master/r/162119
Reviewed-by: Automatic_Commit_Validation_User

arch/arm/mach-tegra/include/mach/dc.h
drivers/video/tegra/dc/dc.c
drivers/video/tegra/dc/ext/control.c

index 72744fb..0bc520d 100644 (file)
@@ -742,4 +742,6 @@ int tegra_dc_set_flip_callback(void (*callback)(void));
 int tegra_dc_unset_flip_callback(void);
 int tegra_dc_get_panel_sync_rate(void);
 
+int tegra_dc_get_out(const struct tegra_dc *dc);
+
 #endif
index 4dfc189..5bd3d69 100644 (file)
@@ -1088,6 +1088,15 @@ static void tegra_dc_set_out(struct tegra_dc *dc, struct tegra_dc_out *out)
                dc->out_ops->init(dc);
 }
 
+/* returns on error: -EINVAL
+ * on success: TEGRA_DC_OUT_RGB, TEGRA_DC_OUT_HDMI, or TEGRA_DC_OUT_DSI. */
+int tegra_dc_get_out(const struct tegra_dc *dc)
+{
+       if (dc && dc->out)
+               return dc->out->type;
+       return -EINVAL;
+}
+
 unsigned tegra_dc_get_out_height(const struct tegra_dc *dc)
 {
        if (dc->out)
index ed812be..3e30f2e 100644 (file)
@@ -42,21 +42,23 @@ get_output_properties(struct tegra_dc_ext_control_output_properties *properties)
        if (properties->handle > 2)
                return -EINVAL;
 
-       switch (properties->handle) {
-       case 0:
+       properties->associated_head = properties->handle;
+       properties->head_mask = (1 << properties->associated_head);
+
+       dc = tegra_dc_get_dc(properties->associated_head);
+       switch (tegra_dc_get_out(dc)) {
+       case TEGRA_DC_OUT_DSI:
+               properties->type = TEGRA_DC_EXT_DSI;
+               break;
+       case TEGRA_DC_OUT_RGB:
                properties->type = TEGRA_DC_EXT_LVDS;
                break;
-       case 1:
+       case TEGRA_DC_OUT_HDMI:
                properties->type = TEGRA_DC_EXT_HDMI;
                break;
        default:
                return -EINVAL;
        }
-
-       properties->associated_head = properties->handle;
-       properties->head_mask = (1 << properties->associated_head);
-
-       dc = tegra_dc_get_dc(properties->associated_head);
        properties->connected = tegra_dc_get_connected(dc);
 
        return 0;