aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/macintosh/adbhid.c
diff options
context:
space:
mode:
authorMichael Hanselmann <linux-kernel@hansmi.ch>2006-06-25 08:47:08 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-25 13:00:59 -0400
commit5474c120aafe78ca54bf272f7a01107c42da2b21 (patch)
treec1b002a27703ce92c816bfb9844752186e33d403 /drivers/macintosh/adbhid.c
parent17660bdd5c1f1a165273c1a59cb5b87670a81cc4 (diff)
[PATCH] Rewritten backlight infrastructure for portable Apple computers
This patch contains a total rewrite of the backlight infrastructure for portable Apple computers. Backward compatibility is retained. A sysfs interface allows userland to control the brightness with more steps than before. Userland is allowed to upload a brightness curve for different monitors, similar to Mac OS X. [akpm@osdl.org: add needed exports] Signed-off-by: Michael Hanselmann <linux-kernel@hansmi.ch> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Richard Purdie <rpurdie@rpsys.net> Cc: "Antonino A. Daplas" <adaplas@pol.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/macintosh/adbhid.c')
-rw-r--r--drivers/macintosh/adbhid.c28
1 files changed, 7 insertions, 21 deletions
diff --git a/drivers/macintosh/adbhid.c b/drivers/macintosh/adbhid.c
index 394334ec5765..c26e1236b275 100644
--- a/drivers/macintosh/adbhid.c
+++ b/drivers/macintosh/adbhid.c
@@ -503,9 +503,7 @@ adbhid_buttons_input(unsigned char *data, int nb, struct pt_regs *regs, int auto
503 case 0x1f: /* Powerbook button device */ 503 case 0x1f: /* Powerbook button device */
504 { 504 {
505 int down = (data[1] == (data[1] & 0xf)); 505 int down = (data[1] == (data[1] & 0xf));
506#ifdef CONFIG_PMAC_BACKLIGHT 506
507 int backlight = get_backlight_level();
508#endif
509 /* 507 /*
510 * XXX: Where is the contrast control for the passive? 508 * XXX: Where is the contrast control for the passive?
511 * -- Cort 509 * -- Cort
@@ -530,29 +528,17 @@ adbhid_buttons_input(unsigned char *data, int nb, struct pt_regs *regs, int auto
530 528
531 case 0xa: /* brightness decrease */ 529 case 0xa: /* brightness decrease */
532#ifdef CONFIG_PMAC_BACKLIGHT 530#ifdef CONFIG_PMAC_BACKLIGHT
533 if (!disable_kernel_backlight) { 531 if (!disable_kernel_backlight && down)
534 if (down && backlight >= 0) { 532 pmac_backlight_key_down();
535 if (backlight > BACKLIGHT_OFF) 533#endif
536 set_backlight_level(backlight-1);
537 else
538 set_backlight_level(BACKLIGHT_OFF);
539 }
540 }
541#endif /* CONFIG_PMAC_BACKLIGHT */
542 input_report_key(adbhid[id]->input, KEY_BRIGHTNESSDOWN, down); 534 input_report_key(adbhid[id]->input, KEY_BRIGHTNESSDOWN, down);
543 break; 535 break;
544 536
545 case 0x9: /* brightness increase */ 537 case 0x9: /* brightness increase */
546#ifdef CONFIG_PMAC_BACKLIGHT 538#ifdef CONFIG_PMAC_BACKLIGHT
547 if (!disable_kernel_backlight) { 539 if (!disable_kernel_backlight && down)
548 if (down && backlight >= 0) { 540 pmac_backlight_key_up();
549 if (backlight < BACKLIGHT_MAX) 541#endif
550 set_backlight_level(backlight+1);
551 else
552 set_backlight_level(BACKLIGHT_MAX);
553 }
554 }
555#endif /* CONFIG_PMAC_BACKLIGHT */
556 input_report_key(adbhid[id]->input, KEY_BRIGHTNESSUP, down); 542 input_report_key(adbhid[id]->input, KEY_BRIGHTNESSUP, down);
557 break; 543 break;
558 544