From de263f6e253976d8371da7e7b7089f1d9b79e92b Mon Sep 17 00:00:00 2001 From: Kevin Huang Date: Thu, 31 May 2012 16:55:15 -0700 Subject: video: tegra: dc: Export dispay feature table. Bug 992947 Change-Id: I0d1ecc9f8f042956cbe631779260a38573936616 Signed-off-by: Kevin Huang Reviewed-on: http://git-master/r/105776 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Jon Mayo --- drivers/video/tegra/dc/dc_config.h | 6 +++--- drivers/video/tegra/dc/ext/dev.c | 31 +++++++++++++++++++++++++++++++ include/video/tegra_dc_ext.h | 8 ++++++++ 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/drivers/video/tegra/dc/dc_config.h b/drivers/video/tegra/dc/dc_config.h index f513cd06dc45..314cd11e77f9 100644 --- a/drivers/video/tegra/dc/dc_config.h +++ b/drivers/video/tegra/dc/dc_config.h @@ -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; }; diff --git a/drivers/video/tegra/dc/ext/dev.c b/drivers/video/tegra/dc/ext/dev.c index c349a4720d2e..a8de7a7a26e0 100644 --- a/drivers/video/tegra/dc/ext/dev.c +++ b/drivers/video/tegra/dc/ext/dev.c @@ -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; } diff --git a/include/video/tegra_dc_ext.h b/include/video/tegra_dc_ext.h index 76bb34b01af1..8f9d0423f516 100644 --- a/include/video/tegra_dc_ext.h +++ b/include/video/tegra_dc_ext.h @@ -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, -- cgit v1.2.3