diff options
Diffstat (limited to 'drivers/video/backlight/mbp_nvidia_bl.c')
-rw-r--r-- | drivers/video/backlight/mbp_nvidia_bl.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/drivers/video/backlight/mbp_nvidia_bl.c b/drivers/video/backlight/mbp_nvidia_bl.c index ce09b83244ac..3bb4c0a50c62 100644 --- a/drivers/video/backlight/mbp_nvidia_bl.c +++ b/drivers/video/backlight/mbp_nvidia_bl.c | |||
@@ -36,6 +36,11 @@ struct dmi_match_data { | |||
36 | struct backlight_ops backlight_ops; | 36 | struct backlight_ops backlight_ops; |
37 | }; | 37 | }; |
38 | 38 | ||
39 | /* Module parameters. */ | ||
40 | static int debug; | ||
41 | module_param_named(debug, debug, int, 0644); | ||
42 | MODULE_PARM_DESC(debug, "Set to one to enable debugging messages."); | ||
43 | |||
39 | /* | 44 | /* |
40 | * Implementation for MacBooks with Intel chipset. | 45 | * Implementation for MacBooks with Intel chipset. |
41 | */ | 46 | */ |
@@ -43,6 +48,10 @@ static int intel_chipset_send_intensity(struct backlight_device *bd) | |||
43 | { | 48 | { |
44 | int intensity = bd->props.brightness; | 49 | int intensity = bd->props.brightness; |
45 | 50 | ||
51 | if (debug) | ||
52 | printk(KERN_DEBUG "mbp_nvidia_bl: setting brightness to %d\n", | ||
53 | intensity); | ||
54 | |||
46 | outb(0x04 | (intensity << 4), 0xb3); | 55 | outb(0x04 | (intensity << 4), 0xb3); |
47 | outb(0xbf, 0xb2); | 56 | outb(0xbf, 0xb2); |
48 | return 0; | 57 | return 0; |
@@ -50,9 +59,17 @@ static int intel_chipset_send_intensity(struct backlight_device *bd) | |||
50 | 59 | ||
51 | static int intel_chipset_get_intensity(struct backlight_device *bd) | 60 | static int intel_chipset_get_intensity(struct backlight_device *bd) |
52 | { | 61 | { |
62 | int intensity; | ||
63 | |||
53 | outb(0x03, 0xb3); | 64 | outb(0x03, 0xb3); |
54 | outb(0xbf, 0xb2); | 65 | outb(0xbf, 0xb2); |
55 | return inb(0xb3) >> 4; | 66 | intensity = inb(0xb3) >> 4; |
67 | |||
68 | if (debug) | ||
69 | printk(KERN_DEBUG "mbp_nvidia_bl: read brightness of %d\n", | ||
70 | intensity); | ||
71 | |||
72 | return intensity; | ||
56 | } | 73 | } |
57 | 74 | ||
58 | static const struct dmi_match_data intel_chipset_data = { | 75 | static const struct dmi_match_data intel_chipset_data = { |
@@ -72,6 +89,10 @@ static int nvidia_chipset_send_intensity(struct backlight_device *bd) | |||
72 | { | 89 | { |
73 | int intensity = bd->props.brightness; | 90 | int intensity = bd->props.brightness; |
74 | 91 | ||
92 | if (debug) | ||
93 | printk(KERN_DEBUG "mbp_nvidia_bl: setting brightness to %d\n", | ||
94 | intensity); | ||
95 | |||
75 | outb(0x04 | (intensity << 4), 0x52f); | 96 | outb(0x04 | (intensity << 4), 0x52f); |
76 | outb(0xbf, 0x52e); | 97 | outb(0xbf, 0x52e); |
77 | return 0; | 98 | return 0; |
@@ -79,9 +100,17 @@ static int nvidia_chipset_send_intensity(struct backlight_device *bd) | |||
79 | 100 | ||
80 | static int nvidia_chipset_get_intensity(struct backlight_device *bd) | 101 | static int nvidia_chipset_get_intensity(struct backlight_device *bd) |
81 | { | 102 | { |
103 | int intensity; | ||
104 | |||
82 | outb(0x03, 0x52f); | 105 | outb(0x03, 0x52f); |
83 | outb(0xbf, 0x52e); | 106 | outb(0xbf, 0x52e); |
84 | return inb(0x52f) >> 4; | 107 | intensity = inb(0x52f) >> 4; |
108 | |||
109 | if (debug) | ||
110 | printk(KERN_DEBUG "mbp_nvidia_bl: read brightness of %d\n", | ||
111 | intensity); | ||
112 | |||
113 | return intensity; | ||
85 | } | 114 | } |
86 | 115 | ||
87 | static const struct dmi_match_data nvidia_chipset_data = { | 116 | static const struct dmi_match_data nvidia_chipset_data = { |