diff options
author | Matthew Garrett <mjg59@srcf.ucam.org> | 2006-01-09 23:53:01 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-10 11:01:44 -0500 |
commit | 30420f8f464975f7f26e8195f60569dfed6ac060 (patch) | |
tree | db9f694f6fedbc984aa42144a46000a6527a8640 /drivers/video/fbsysfs.c | |
parent | c35dba601728412f67801792107d3dddd1f3ada1 (diff) |
[PATCH] Add sysfs entry to disable framebuffer access
What
Diffstat (limited to 'drivers/video/fbsysfs.c')
-rw-r--r-- | drivers/video/fbsysfs.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c index 08dac9580d15..0a1dc1b4b509 100644 --- a/drivers/video/fbsysfs.c +++ b/drivers/video/fbsysfs.c | |||
@@ -492,6 +492,28 @@ static ssize_t show_name(struct class_device *class_device, char *buf) | |||
492 | return snprintf(buf, PAGE_SIZE, "%s\n", fb_info->fix.id); | 492 | return snprintf(buf, PAGE_SIZE, "%s\n", fb_info->fix.id); |
493 | } | 493 | } |
494 | 494 | ||
495 | static ssize_t store_fbstate(struct class_device *class_device, | ||
496 | const char *buf, size_t count) | ||
497 | { | ||
498 | struct fb_info *fb_info = class_get_devdata(class_device); | ||
499 | u32 state; | ||
500 | char *last = NULL; | ||
501 | |||
502 | state = simple_strtoul(buf, &last, 0); | ||
503 | |||
504 | acquire_console_sem(); | ||
505 | fb_set_suspend(fb_info, (int)state); | ||
506 | release_console_sem(); | ||
507 | |||
508 | return count; | ||
509 | } | ||
510 | |||
511 | static ssize_t show_fbstate(struct class_device *class_device, char *buf) | ||
512 | { | ||
513 | struct fb_info *fb_info = class_get_devdata(class_device); | ||
514 | return snprintf(buf, PAGE_SIZE, "%d\n", fb_info->state); | ||
515 | } | ||
516 | |||
495 | static struct class_device_attribute class_device_attrs[] = { | 517 | static struct class_device_attribute class_device_attrs[] = { |
496 | __ATTR(bits_per_pixel, S_IRUGO|S_IWUSR, show_bpp, store_bpp), | 518 | __ATTR(bits_per_pixel, S_IRUGO|S_IWUSR, show_bpp, store_bpp), |
497 | __ATTR(blank, S_IRUGO|S_IWUSR, show_blank, store_blank), | 519 | __ATTR(blank, S_IRUGO|S_IWUSR, show_blank, store_blank), |
@@ -507,6 +529,7 @@ static struct class_device_attribute class_device_attrs[] = { | |||
507 | __ATTR(rotate, S_IRUGO|S_IWUSR, show_rotate, store_rotate), | 529 | __ATTR(rotate, S_IRUGO|S_IWUSR, show_rotate, store_rotate), |
508 | __ATTR(con_rotate, S_IRUGO|S_IWUSR, show_con_rotate, store_con_rotate), | 530 | __ATTR(con_rotate, S_IRUGO|S_IWUSR, show_con_rotate, store_con_rotate), |
509 | __ATTR(con_rotate_all, S_IWUSR, NULL, store_con_rotate_all), | 531 | __ATTR(con_rotate_all, S_IWUSR, NULL, store_con_rotate_all), |
532 | __ATTR(state, S_IRUGO|S_IWUSR, show_fbstate, store_fbstate), | ||
510 | }; | 533 | }; |
511 | 534 | ||
512 | int fb_init_class_device(struct fb_info *fb_info) | 535 | int fb_init_class_device(struct fb_info *fb_info) |