video: tegra: dc: Export dispay feature table.
Kevin Huang [Thu, 31 May 2012 23:55:15 +0000 (16:55 -0700)]
Bug 992947

Change-Id: I0d1ecc9f8f042956cbe631779260a38573936616
Signed-off-by: Kevin Huang <kevinh@nvidia.com>
Reviewed-on: http://git-master/r/105776
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Jon Mayo <jmayo@nvidia.com>

drivers/video/tegra/dc/dc_config.h
drivers/video/tegra/dc/ext/dev.c
include/video/tegra_dc_ext.h

index f513cd0..314cd11 100644 (file)
@@ -129,13 +129,13 @@ enum tegra_dc_feature_option {
 };
 
 struct tegra_dc_feature_entry {
-       int window_index;
-       enum tegra_dc_feature_option option;
+       u32 window_index;
+       u32 option;
        long arg[ENTRY_SIZE];
 };
 
 struct tegra_dc_feature {
-       unsigned num_entries;
+       u32 num_entries;
        struct tegra_dc_feature_entry *entries;
 };
 
index c349a47..a8de7a7 100644 (file)
@@ -708,6 +708,21 @@ static int tegra_dc_ext_get_status(struct tegra_dc_ext_user *user,
        return 0;
 }
 
+static int tegra_dc_ext_get_feature(struct tegra_dc_ext_user *user,
+                                  struct tegra_dc_ext_feature *feature)
+{
+       struct tegra_dc *dc = user->ext->dc;
+       struct tegra_dc_feature *table = dc->feature;
+
+       if (dc->enabled && feature->entries) {
+               feature->length = table->num_entries;
+               memcpy(feature->entries, table->entries, table->num_entries *
+                                       sizeof(struct tegra_dc_feature_entry));
+       }
+
+       return 0;
+}
+
 static long tegra_dc_ioctl(struct file *filp, unsigned int cmd,
                           unsigned long arg)
 {
@@ -805,6 +820,22 @@ static long tegra_dc_ioctl(struct file *filp, unsigned int cmd,
                return tegra_dc_ext_set_lut(user, &args);
        }
 
+       case TEGRA_DC_EXT_GET_FEATURES:
+       {
+               struct tegra_dc_ext_feature args;
+               int ret;
+
+               if (copy_from_user(&args, user_arg, sizeof(args)))
+                       return -EFAULT;
+
+               ret = tegra_dc_ext_get_feature(user, &args);
+
+               if (copy_to_user(user_arg, &args, sizeof(args)))
+                       return -EFAULT;
+
+               return ret;
+       }
+
        default:
                return -EINVAL;
        }
index 76bb34b..8f9d042 100644 (file)
@@ -211,6 +211,11 @@ struct tegra_dc_ext_status {
        __u32 pad[3];
 };
 
+struct tegra_dc_ext_feature {
+       __u32 length;
+       __u32 *entries;
+};
+
 #define TEGRA_DC_EXT_SET_NVMAP_FD \
        _IOW('D', 0x00, __s32)
 
@@ -247,6 +252,9 @@ struct tegra_dc_ext_status {
 #define TEGRA_DC_EXT_SET_LUT \
        _IOW('D', 0x0A, struct tegra_dc_ext_lut)
 
+#define TEGRA_DC_EXT_GET_FEATURES \
+       _IOW('D', 0x0B, struct tegra_dc_ext_feature)
+
 enum tegra_dc_ext_control_output_type {
        TEGRA_DC_EXT_DSI,
        TEGRA_DC_EXT_LVDS,