diff options
author | Timur Tabi <timur@freescale.com> | 2012-10-16 18:33:44 -0400 |
---|---|---|
committer | Timur Tabi <timur@freescale.com> | 2012-11-26 14:41:19 -0500 |
commit | e95c17e9caff4b106cc95b761f3e07964a5a0d9f (patch) | |
tree | 64ab7ac3f0382de82b32e8a17176b1c677355f99 | |
parent | 2867173572d5ca5084e8836c8a1d0cafa95b729b (diff) |
drivers/video: fsl-diu-fb: add support for set_gamma ioctls
The MPC5121 BSP comes with a gamma_set utility that initializes the gamma
table via an ioctl. Unfortunately, the ioctl number that utility uses
is defined improperly, but we can still support it.
Signed-off-by: Timur Tabi <timur@freescale.com>
-rw-r--r-- | drivers/video/fsl-diu-fb.c | 17 | ||||
-rw-r--r-- | include/linux/fsl-diu-fb.h | 9 |
2 files changed, 26 insertions, 0 deletions
diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c index 5b12e1783fac..9c4054760627 100644 --- a/drivers/video/fsl-diu-fb.c +++ b/drivers/video/fsl-diu-fb.c | |||
@@ -1181,6 +1181,23 @@ static int fsl_diu_ioctl(struct fb_info *info, unsigned int cmd, | |||
1181 | ad->ckmin_b = ck.blue_min; | 1181 | ad->ckmin_b = ck.blue_min; |
1182 | } | 1182 | } |
1183 | break; | 1183 | break; |
1184 | #ifdef CONFIG_PPC_MPC512x | ||
1185 | case MFB_SET_GAMMA: { | ||
1186 | struct fsl_diu_data *data = mfbi->parent; | ||
1187 | |||
1188 | if (copy_from_user(data->gamma, buf, sizeof(data->gamma))) | ||
1189 | return -EFAULT; | ||
1190 | setbits32(&data->diu_reg->gamma, 0); /* Force table reload */ | ||
1191 | break; | ||
1192 | } | ||
1193 | case MFB_GET_GAMMA: { | ||
1194 | struct fsl_diu_data *data = mfbi->parent; | ||
1195 | |||
1196 | if (copy_to_user(buf, data->gamma, sizeof(data->gamma))) | ||
1197 | return -EFAULT; | ||
1198 | break; | ||
1199 | } | ||
1200 | #endif | ||
1184 | default: | 1201 | default: |
1185 | dev_err(info->dev, "unknown ioctl command (0x%08X)\n", cmd); | 1202 | dev_err(info->dev, "unknown ioctl command (0x%08X)\n", cmd); |
1186 | return -ENOIOCTLCMD; | 1203 | return -ENOIOCTLCMD; |
diff --git a/include/linux/fsl-diu-fb.h b/include/linux/fsl-diu-fb.h index 11c16a1fb9e3..a1e8277120c7 100644 --- a/include/linux/fsl-diu-fb.h +++ b/include/linux/fsl-diu-fb.h | |||
@@ -47,6 +47,15 @@ struct aoi_display_offset { | |||
47 | #define MFB_GET_PIXFMT _IOR('M', 8, __u32) | 47 | #define MFB_GET_PIXFMT _IOR('M', 8, __u32) |
48 | 48 | ||
49 | /* | 49 | /* |
50 | * The MPC5121 BSP comes with a gamma_set utility that initializes the | ||
51 | * gamma table. Unfortunately, it uses bad values for the IOCTL commands, | ||
52 | * but there's nothing we can do about it now. These ioctls are only | ||
53 | * supported on the MPC5121. | ||
54 | */ | ||
55 | #define MFB_SET_GAMMA _IOW('M', 1, __u8) | ||
56 | #define MFB_GET_GAMMA _IOR('M', 1, __u8) | ||
57 | |||
58 | /* | ||
50 | * The original definitions of MFB_SET_PIXFMT and MFB_GET_PIXFMT used the | 59 | * The original definitions of MFB_SET_PIXFMT and MFB_GET_PIXFMT used the |
51 | * wrong value for 'size' field of the ioctl. The current macros above use the | 60 | * wrong value for 'size' field of the ioctl. The current macros above use the |
52 | * right size, but we still need to provide backwards compatibility, at least | 61 | * right size, but we still need to provide backwards compatibility, at least |