19 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
21 #include <linux/module.h>
22 #include <linux/kernel.h>
27 #include <linux/pci.h>
53 static void intel_chipset_set_brightness(
int intensity)
55 outb(0x04 | (intensity << 4), 0xb3);
61 int intensity = bd->
props.brightness;
64 pr_debug(
"setting brightness to %d\n", intensity);
66 intel_chipset_set_brightness(intensity);
76 intensity =
inb(0xb3) >> 4;
79 pr_debug(
"read brightness of %d\n", intensity);
84 static const struct hw_data intel_chipset_data = {
89 .get_brightness = intel_chipset_get_intensity,
90 .update_status = intel_chipset_send_intensity,
92 .set_brightness = intel_chipset_set_brightness,
98 static void nvidia_chipset_set_brightness(
int intensity)
100 outb(0x04 | (intensity << 4), 0x52f);
106 int intensity = bd->
props.brightness;
109 pr_debug(
"setting brightness to %d\n", intensity);
111 nvidia_chipset_set_brightness(intensity);
121 intensity =
inb(0x52f) >> 4;
124 pr_debug(
"read brightness of %d\n", intensity);
129 static const struct hw_data nvidia_chipset_data = {
134 .get_brightness = nvidia_chipset_get_intensity,
135 .update_status = nvidia_chipset_send_intensity
137 .set_brightness = nvidia_chipset_set_brightness,
140 static int __devinit apple_bl_add(
struct acpi_device *
dev)
149 pr_err(
"unable to find PCI host\n");
154 hw_data = &intel_chipset_data;
156 hw_data = &nvidia_chipset_data;
161 pr_err(
"unknown hardware\n");
183 props.max_brightness = 15;
187 if (IS_ERR(apple_backlight_device)) {
189 return PTR_ERR(apple_backlight_device);
192 apple_backlight_device->
props.brightness =
193 hw_data->
backlight_ops.get_brightness(apple_backlight_device);
194 backlight_update_status(apple_backlight_device);
199 static int __devexit apple_bl_remove(
struct acpi_device *dev,
int type)
213 static struct acpi_driver apple_bl_driver = {
214 .name =
"Apple backlight",
218 .remove = apple_bl_remove,
240 static int __init apple_bl_init(
void)
245 static void __exit apple_bl_exit(
void)