aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/video/Makefile8
-rw-r--r--drivers/video/console/fbcon.c113
-rw-r--r--drivers/video/console/fbcon.h1
-rw-r--r--drivers/video/fbmem.c25
-rw-r--r--drivers/video/fbsysfs.c41
-rw-r--r--include/linux/fb.h7
6 files changed, 112 insertions, 83 deletions
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index b7dfee209cd0..c335e9bc3b20 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -4,15 +4,15 @@
4 4
5# Each configuration option enables a list of files. 5# Each configuration option enables a list of files.
6 6
7obj-$(CONFIG_VT) += console/
8obj-$(CONFIG_LOGO) += logo/
9obj-$(CONFIG_SYSFS) += backlight/
10
11obj-$(CONFIG_FB) += fb.o 7obj-$(CONFIG_FB) += fb.o
12fb-y := fbmem.o fbmon.o fbcmap.o fbsysfs.o \ 8fb-y := fbmem.o fbmon.o fbcmap.o fbsysfs.o \
13 modedb.o fbcvt.o 9 modedb.o fbcvt.o
14fb-objs := $(fb-y) 10fb-objs := $(fb-y)
15 11
12obj-$(CONFIG_VT) += console/
13obj-$(CONFIG_LOGO) += logo/
14obj-$(CONFIG_SYSFS) += backlight/
15
16obj-$(CONFIG_FB_CFB_FILLRECT) += cfbfillrect.o 16obj-$(CONFIG_FB_CFB_FILLRECT) += cfbfillrect.o
17obj-$(CONFIG_FB_CFB_COPYAREA) += cfbcopyarea.o 17obj-$(CONFIG_FB_CFB_COPYAREA) += cfbcopyarea.o
18obj-$(CONFIG_FB_CFB_IMAGEBLIT) += cfbimgblt.o 18obj-$(CONFIG_FB_CFB_IMAGEBLIT) += cfbimgblt.o
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index 47ba1a79adcd..746225bf8c44 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -195,6 +195,8 @@ static void fbcon_redraw_move(struct vc_data *vc, struct display *p,
195static void fbcon_modechanged(struct fb_info *info); 195static void fbcon_modechanged(struct fb_info *info);
196static void fbcon_set_all_vcs(struct fb_info *info); 196static void fbcon_set_all_vcs(struct fb_info *info);
197 197
198static struct class_device *fbcon_class_device;
199
198#ifdef CONFIG_MAC 200#ifdef CONFIG_MAC
199/* 201/*
200 * On the Macintoy, there may or may not be a working VBL int. We need to probe 202 * On the Macintoy, there may or may not be a working VBL int. We need to probe
@@ -2945,14 +2947,6 @@ static int fbcon_event_notify(struct notifier_block *self,
2945 case FB_EVENT_NEW_MODELIST: 2947 case FB_EVENT_NEW_MODELIST:
2946 fbcon_new_modelist(info); 2948 fbcon_new_modelist(info);
2947 break; 2949 break;
2948 case FB_EVENT_SET_CON_ROTATE:
2949 fbcon_rotate(info, *(int *)event->data);
2950 break;
2951 case FB_EVENT_GET_CON_ROTATE:
2952 ret = fbcon_get_rotate(info);
2953 break;
2954 case FB_EVENT_SET_CON_ROTATE_ALL:
2955 fbcon_rotate_all(info, *(int *)event->data);
2956 } 2950 }
2957 2951
2958 return ret; 2952 return ret;
@@ -2992,6 +2986,81 @@ static struct notifier_block fbcon_event_notifier = {
2992 .notifier_call = fbcon_event_notify, 2986 .notifier_call = fbcon_event_notify,
2993}; 2987};
2994 2988
2989static ssize_t store_rotate(struct class_device *class_device,
2990 const char *buf, size_t count)
2991{
2992 struct fb_info *info;
2993 int rotate, idx;
2994 char **last = NULL;
2995
2996 acquire_console_sem();
2997 idx = con2fb_map[fg_console];
2998
2999 if (idx == -1 || registered_fb[idx] == NULL)
3000 goto err;
3001
3002 info = registered_fb[idx];
3003 rotate = simple_strtoul(buf, last, 0);
3004 fbcon_rotate(info, rotate);
3005err:
3006 release_console_sem();
3007 return count;
3008}
3009
3010static ssize_t store_rotate_all(struct class_device *class_device,
3011 const char *buf, size_t count)
3012{
3013 struct fb_info *info;
3014 int rotate, idx;
3015 char **last = NULL;
3016
3017 acquire_console_sem();
3018 idx = con2fb_map[fg_console];
3019
3020 if (idx == -1 || registered_fb[idx] == NULL)
3021 goto err;
3022
3023 info = registered_fb[idx];
3024 rotate = simple_strtoul(buf, last, 0);
3025 fbcon_rotate_all(info, rotate);
3026err:
3027 release_console_sem();
3028 return count;
3029}
3030
3031static ssize_t show_rotate(struct class_device *class_device, char *buf)
3032{
3033 struct fb_info *info;
3034 int rotate = 0, idx;
3035
3036 acquire_console_sem();
3037 idx = con2fb_map[fg_console];
3038
3039 if (idx == -1 || registered_fb[idx] == NULL)
3040 goto err;
3041
3042 info = registered_fb[idx];
3043 rotate = fbcon_get_rotate(info);
3044err:
3045 release_console_sem();
3046 return snprintf(buf, PAGE_SIZE, "%d\n", rotate);
3047}
3048
3049static struct class_device_attribute class_device_attrs[] = {
3050 __ATTR(rotate, S_IRUGO|S_IWUSR, show_rotate, store_rotate),
3051 __ATTR(rotate_all, S_IWUSR, NULL, store_rotate_all),
3052};
3053
3054static int fbcon_init_class_device(void)
3055{
3056 int i;
3057
3058 for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++)
3059 class_device_create_file(fbcon_class_device,
3060 &class_device_attrs[i]);
3061 return 0;
3062}
3063
2995static int __init fb_console_init(void) 3064static int __init fb_console_init(void)
2996{ 3065{
2997 int i; 3066 int i;
@@ -3000,6 +3069,18 @@ static int __init fb_console_init(void)
3000 fb_register_client(&fbcon_event_notifier); 3069 fb_register_client(&fbcon_event_notifier);
3001 release_console_sem(); 3070 release_console_sem();
3002 3071
3072 fbcon_class_device =
3073 class_device_create(fb_class, NULL,
3074 MKDEV(FB_MAJOR, FB_MAX), NULL,
3075 "fbcon");
3076 if (IS_ERR(fbcon_class_device)) {
3077 printk(KERN_WARNING "Unable to create class_device "
3078 "for fbcon; errno = %ld\n",
3079 PTR_ERR(fbcon_class_device));
3080 fbcon_class_device = NULL;
3081 } else
3082 fbcon_init_class_device();
3083
3003 for (i = 0; i < MAX_NR_CONSOLES; i++) 3084 for (i = 0; i < MAX_NR_CONSOLES; i++)
3004 con2fb_map[i] = -1; 3085 con2fb_map[i] = -1;
3005 3086
@@ -3020,10 +3101,26 @@ module_init(fb_console_init);
3020 3101
3021#ifdef MODULE 3102#ifdef MODULE
3022 3103
3104static void __exit fbcon_deinit_class_device(void)
3105{
3106 int i;
3107
3108 for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++)
3109 class_device_remove_file(fbcon_class_device,
3110 &class_device_attrs[i]);
3111}
3112
3113static void __exit fbcon_exit(void)
3114{
3115 fbcon_deinit_class_device();
3116 class_device_destroy(fb_class, MKDEV(FB_MAJOR, FB_MAX));
3117}
3118
3023static void __exit fb_console_exit(void) 3119static void __exit fb_console_exit(void)
3024{ 3120{
3025 acquire_console_sem(); 3121 acquire_console_sem();
3026 fb_unregister_client(&fbcon_event_notifier); 3122 fb_unregister_client(&fbcon_event_notifier);
3123 fbcon_exit();
3027 release_console_sem(); 3124 release_console_sem();
3028 give_up_console(&fb_con); 3125 give_up_console(&fb_con);
3029} 3126}
diff --git a/drivers/video/console/fbcon.h b/drivers/video/console/fbcon.h
index c38c3d8e7a74..3487a636370a 100644
--- a/drivers/video/console/fbcon.h
+++ b/drivers/video/console/fbcon.h
@@ -175,6 +175,7 @@ extern void fbcon_set_tileops(struct vc_data *vc, struct fb_info *info);
175#endif 175#endif
176extern void fbcon_set_bitops(struct fbcon_ops *ops); 176extern void fbcon_set_bitops(struct fbcon_ops *ops);
177extern int soft_cursor(struct fb_info *info, struct fb_cursor *cursor); 177extern int soft_cursor(struct fb_info *info, struct fb_cursor *cursor);
178extern struct class *fb_class;
178 179
179#define FBCON_ATTRIBUTE_UNDERLINE 1 180#define FBCON_ATTRIBUTE_UNDERLINE 1
180#define FBCON_ATTRIBUTE_REVERSE 2 181#define FBCON_ATTRIBUTE_REVERSE 2
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index e9af5e61018d..a2102a543ee7 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -1276,8 +1276,8 @@ static struct file_operations fb_fops = {
1276#endif 1276#endif
1277}; 1277};
1278 1278
1279static struct class *fb_class; 1279struct class *fb_class;
1280 1280EXPORT_SYMBOL(fb_class);
1281/** 1281/**
1282 * register_framebuffer - registers a frame buffer device 1282 * register_framebuffer - registers a frame buffer device
1283 * @fb_info: frame buffer info structure 1283 * @fb_info: frame buffer info structure
@@ -1489,27 +1489,6 @@ int fb_new_modelist(struct fb_info *info)
1489 return err; 1489 return err;
1490} 1490}
1491 1491
1492/**
1493 * fb_con_duit - user<->fbcon passthrough
1494 * @info: struct fb_info
1495 * @event: notification event to be passed to fbcon
1496 * @data: private data
1497 *
1498 * DESCRIPTION
1499 * This function is an fbcon-user event passing channel
1500 * which bypasses fbdev. This is hopefully temporary
1501 * until a user interface for fbcon is created
1502 */
1503int fb_con_duit(struct fb_info *info, int event, void *data)
1504{
1505 struct fb_event evnt;
1506
1507 evnt.info = info;
1508 evnt.data = data;
1509
1510 return blocking_notifier_call_chain(&fb_notifier_list, event, &evnt);
1511}
1512
1513static char *video_options[FB_MAX]; 1492static char *video_options[FB_MAX];
1514static int ofonly; 1493static int ofonly;
1515 1494
diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c
index 6de02189abbe..4f78f234473d 100644
--- a/drivers/video/fbsysfs.c
+++ b/drivers/video/fbsysfs.c
@@ -247,45 +247,6 @@ static ssize_t show_rotate(struct class_device *class_device, char *buf)
247 return snprintf(buf, PAGE_SIZE, "%d\n", fb_info->var.rotate); 247 return snprintf(buf, PAGE_SIZE, "%d\n", fb_info->var.rotate);
248} 248}
249 249
250static ssize_t store_con_rotate(struct class_device *class_device,
251 const char *buf, size_t count)
252{
253 struct fb_info *fb_info = class_get_devdata(class_device);
254 int rotate;
255 char **last = NULL;
256
257 acquire_console_sem();
258 rotate = simple_strtoul(buf, last, 0);
259 fb_con_duit(fb_info, FB_EVENT_SET_CON_ROTATE, &rotate);
260 release_console_sem();
261 return count;
262}
263
264static ssize_t store_con_rotate_all(struct class_device *class_device,
265 const char *buf, size_t count)
266{
267 struct fb_info *fb_info = class_get_devdata(class_device);
268 int rotate;
269 char **last = NULL;
270
271 acquire_console_sem();
272 rotate = simple_strtoul(buf, last, 0);
273 fb_con_duit(fb_info, FB_EVENT_SET_CON_ROTATE_ALL, &rotate);
274 release_console_sem();
275 return count;
276}
277
278static ssize_t show_con_rotate(struct class_device *class_device, char *buf)
279{
280 struct fb_info *fb_info = class_get_devdata(class_device);
281 int rotate;
282
283 acquire_console_sem();
284 rotate = fb_con_duit(fb_info, FB_EVENT_GET_CON_ROTATE, NULL);
285 release_console_sem();
286 return snprintf(buf, PAGE_SIZE, "%d\n", rotate);
287}
288
289static ssize_t store_virtual(struct class_device *class_device, 250static ssize_t store_virtual(struct class_device *class_device,
290 const char * buf, size_t count) 251 const char * buf, size_t count)
291{ 252{
@@ -502,8 +463,6 @@ static struct class_device_attribute class_device_attrs[] = {
502 __ATTR(name, S_IRUGO, show_name, NULL), 463 __ATTR(name, S_IRUGO, show_name, NULL),
503 __ATTR(stride, S_IRUGO, show_stride, NULL), 464 __ATTR(stride, S_IRUGO, show_stride, NULL),
504 __ATTR(rotate, S_IRUGO|S_IWUSR, show_rotate, store_rotate), 465 __ATTR(rotate, S_IRUGO|S_IWUSR, show_rotate, store_rotate),
505 __ATTR(con_rotate, S_IRUGO|S_IWUSR, show_con_rotate, store_con_rotate),
506 __ATTR(con_rotate_all, S_IWUSR, NULL, store_con_rotate_all),
507 __ATTR(state, S_IRUGO|S_IWUSR, show_fbstate, store_fbstate), 466 __ATTR(state, S_IRUGO|S_IWUSR, show_fbstate, store_fbstate),
508#ifdef CONFIG_FB_BACKLIGHT 467#ifdef CONFIG_FB_BACKLIGHT
509 __ATTR(bl_curve, S_IRUGO|S_IWUSR, show_bl_curve, store_bl_curve), 468 __ATTR(bl_curve, S_IRUGO|S_IWUSR, show_bl_curve, store_bl_curve),
diff --git a/include/linux/fb.h b/include/linux/fb.h
index f1281687e549..c64f25255286 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -515,12 +515,6 @@ struct fb_cursor_user {
515/* The resolution of the passed in fb_info about to change and 515/* The resolution of the passed in fb_info about to change and
516 all vc's should be changed */ 516 all vc's should be changed */
517#define FB_EVENT_MODE_CHANGE_ALL 0x0A 517#define FB_EVENT_MODE_CHANGE_ALL 0x0A
518/* CONSOLE-SPECIFIC: set console rotation */
519#define FB_EVENT_SET_CON_ROTATE 0x0B
520/* CONSOLE-SPECIFIC: get console rotation */
521#define FB_EVENT_GET_CON_ROTATE 0x0C
522/* CONSOLE-SPECIFIC: rotate all consoles */
523#define FB_EVENT_SET_CON_ROTATE_ALL 0x0D
524 518
525struct fb_event { 519struct fb_event {
526 struct fb_info *info; 520 struct fb_info *info;
@@ -892,7 +886,6 @@ extern int fb_get_color_depth(struct fb_var_screeninfo *var,
892 struct fb_fix_screeninfo *fix); 886 struct fb_fix_screeninfo *fix);
893extern int fb_get_options(char *name, char **option); 887extern int fb_get_options(char *name, char **option);
894extern int fb_new_modelist(struct fb_info *info); 888extern int fb_new_modelist(struct fb_info *info);
895extern int fb_con_duit(struct fb_info *info, int event, void *data);
896 889
897extern struct fb_info *registered_fb[FB_MAX]; 890extern struct fb_info *registered_fb[FB_MAX];
898extern int num_registered_fb; 891extern int num_registered_fb;