aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/console
diff options
context:
space:
mode:
authorAntonino A. Daplas <adaplas@gmail.com>2007-07-17 07:05:26 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-17 13:23:11 -0400
commitacba9cd01974353294ecd0c750581a6707d1ebe1 (patch)
tree440432eca5a634227e45f30fc15c6c6d8d34a5ee /drivers/video/console
parent01b15bd4bfae794246c047b961a282e19014e240 (diff)
fbcon: cursor blink control
Add sysfs attribute to enable or disable cursor blinking. This will also disable cursor blinking if the VT layer's softcursor is active. These changes are required to enable some machines to enter low-power states properly. Signed-off-by: Antonino Daplas <adaplas@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/console')
-rw-r--r--drivers/video/console/fbcon.c74
1 files changed, 73 insertions, 1 deletions
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index 7888e319f9e1..b7e143efa81d 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -152,6 +152,7 @@ static int fbcon_set_origin(struct vc_data *);
152#define DEFAULT_CURSOR_BLINK_RATE (20) 152#define DEFAULT_CURSOR_BLINK_RATE (20)
153 153
154static int vbl_cursor_cnt; 154static int vbl_cursor_cnt;
155static int fbcon_cursor_noblink;
155 156
156#define divides(a, b) ((!(a) || (b)%(a)) ? 0 : 1) 157#define divides(a, b) ((!(a) || (b)%(a)) ? 0 : 1)
157 158
@@ -441,7 +442,8 @@ static void fbcon_add_cursor_timer(struct fb_info *info)
441 struct fbcon_ops *ops = info->fbcon_par; 442 struct fbcon_ops *ops = info->fbcon_par;
442 443
443 if ((!info->queue.func || info->queue.func == fb_flashcursor) && 444 if ((!info->queue.func || info->queue.func == fb_flashcursor) &&
444 !(ops->flags & FBCON_FLAGS_CURSOR_TIMER)) { 445 !(ops->flags & FBCON_FLAGS_CURSOR_TIMER) &&
446 !fbcon_cursor_noblink) {
445 if (!info->queue.func) 447 if (!info->queue.func)
446 INIT_WORK(&info->queue, fb_flashcursor); 448 INIT_WORK(&info->queue, fb_flashcursor);
447 449
@@ -1349,6 +1351,11 @@ static void fbcon_cursor(struct vc_data *vc, int mode)
1349 if (fbcon_is_inactive(vc, info) || vc->vc_deccm != 1) 1351 if (fbcon_is_inactive(vc, info) || vc->vc_deccm != 1)
1350 return; 1352 return;
1351 1353
1354 if (vc->vc_cursor_type & 0x10)
1355 fbcon_del_cursor_timer(info);
1356 else
1357 fbcon_add_cursor_timer(info);
1358
1352 ops->cursor_flash = (mode == CM_ERASE) ? 0 : 1; 1359 ops->cursor_flash = (mode == CM_ERASE) ? 0 : 1;
1353 if (mode & CM_SOFTBACK) { 1360 if (mode & CM_SOFTBACK) {
1354 mode &= ~CM_SOFTBACK; 1361 mode &= ~CM_SOFTBACK;
@@ -3308,9 +3315,74 @@ err:
3308 return snprintf(buf, PAGE_SIZE, "%d\n", rotate); 3315 return snprintf(buf, PAGE_SIZE, "%d\n", rotate);
3309} 3316}
3310 3317
3318static ssize_t show_cursor_blink(struct class_device *class_device, char *buf)
3319{
3320 struct fb_info *info;
3321 struct fbcon_ops *ops;
3322 int idx, blink = -1;
3323
3324 if (fbcon_has_exited)
3325 return 0;
3326
3327 acquire_console_sem();
3328 idx = con2fb_map[fg_console];
3329
3330 if (idx == -1 || registered_fb[idx] == NULL)
3331 goto err;
3332
3333 info = registered_fb[idx];
3334 ops = info->fbcon_par;
3335
3336 if (!ops)
3337 goto err;
3338
3339 blink = (ops->flags & FBCON_FLAGS_CURSOR_TIMER) ? 1 : 0;
3340err:
3341 release_console_sem();
3342 return snprintf(buf, PAGE_SIZE, "%d\n", blink);
3343}
3344
3345static ssize_t store_cursor_blink(struct class_device *clas_device,
3346 const char *buf, size_t count)
3347{
3348 struct fb_info *info;
3349 int blink, idx;
3350 char **last = NULL;
3351
3352 if (fbcon_has_exited)
3353 return count;
3354
3355 acquire_console_sem();
3356 idx = con2fb_map[fg_console];
3357
3358 if (idx == -1 || registered_fb[idx] == NULL)
3359 goto err;
3360
3361 info = registered_fb[idx];
3362
3363 if (!info->fbcon_par)
3364 goto err;
3365
3366 blink = simple_strtoul(buf, last, 0);
3367
3368 if (blink) {
3369 fbcon_cursor_noblink = 0;
3370 fbcon_add_cursor_timer(info);
3371 } else {
3372 fbcon_cursor_noblink = 1;
3373 fbcon_del_cursor_timer(info);
3374 }
3375
3376err:
3377 release_console_sem();
3378 return count;
3379}
3380
3311static struct class_device_attribute class_device_attrs[] = { 3381static struct class_device_attribute class_device_attrs[] = {
3312 __ATTR(rotate, S_IRUGO|S_IWUSR, show_rotate, store_rotate), 3382 __ATTR(rotate, S_IRUGO|S_IWUSR, show_rotate, store_rotate),
3313 __ATTR(rotate_all, S_IWUSR, NULL, store_rotate_all), 3383 __ATTR(rotate_all, S_IWUSR, NULL, store_rotate_all),
3384 __ATTR(cursor_blink, S_IRUGO|S_IWUSR, show_cursor_blink,
3385 store_cursor_blink),
3314}; 3386};
3315 3387
3316static int fbcon_init_class_device(void) 3388static int fbcon_init_class_device(void)