diff options
-rw-r--r-- | drivers/video/tegra/fb.c | 26 | ||||
-rw-r--r-- | include/video/tegrafb.h | 7 |
2 files changed, 33 insertions, 0 deletions
diff --git a/drivers/video/tegra/fb.c b/drivers/video/tegra/fb.c index ef4e4c3e3708..a1045957bdae 100644 --- a/drivers/video/tegra/fb.c +++ b/drivers/video/tegra/fb.c @@ -499,6 +499,9 @@ static int tegra_fb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long { struct tegra_fb_info *tegra_fb = info->par; struct tegra_fb_flip_args flip_args; + struct tegra_fb_modedb modedb; + struct fb_modelist *modelist; + int i; int fd; int ret; @@ -520,6 +523,29 @@ static int tegra_fb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long return ret; + case FBIO_TEGRA_GET_MODEDB: + if (copy_from_user(&modedb, (void __user *)arg, sizeof(modedb))) + return -EFAULT; + + i = 0; + list_for_each_entry(modelist, &info->modelist, list) { + struct fb_var_screeninfo var; + + if (i >= modedb.modedb_len) + break; + fb_videomode_to_var(&var, &modelist->mode); + + if (copy_to_user((void __user *)&modedb.modedb[i], + &var, sizeof(var))) + return -EFAULT; + i++; + } + modedb.modedb_len = i; + + if (copy_to_user((void __user *)arg, &modedb, sizeof(modedb))) + return -EFAULT; + break; + default: return -ENOTTY; } diff --git a/include/video/tegrafb.h b/include/video/tegrafb.h index 3d7a5a9d66e9..79578c3d7bd4 100644 --- a/include/video/tegrafb.h +++ b/include/video/tegrafb.h @@ -18,6 +18,7 @@ #ifndef _LINUX_TEGRAFB_H_ #define _LINUX_TEGRAFB_H_ +#include <linux/fb.h> #include <linux/types.h> #include <asm/ioctl.h> @@ -77,7 +78,13 @@ struct tegra_fb_flip_args { __u32 post_syncpt_val; }; +struct tegra_fb_modedb { + struct fb_var_screeninfo *modedb; + __u32 modedb_len; +}; + #define FBIO_TEGRA_SET_NVMAP_FD _IOW('F', 0x40, __u32) #define FBIO_TEGRA_FLIP _IOW('F', 0x41, struct tegra_fb_flip_args) +#define FBIO_TEGRA_GET_MODEDB _IOWR('F', 0x42, struct tegra_fb_modedb) #endif |