diff options
-rw-r--r-- | drivers/video/backlight/Kconfig | 18 | ||||
-rw-r--r-- | drivers/video/backlight/Makefile | 2 | ||||
-rw-r--r-- | drivers/video/backlight/jornada720_bl.c | 161 | ||||
-rw-r--r-- | drivers/video/backlight/jornada720_lcd.c | 153 | ||||
-rw-r--r-- | drivers/video/backlight/mbp_nvidia_bl.c | 191 | ||||
-rw-r--r-- | drivers/video/backlight/pwm_bl.c | 4 |
6 files changed, 491 insertions, 38 deletions
diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig index 72facb9eb7d..f9d19be0554 100644 --- a/drivers/video/backlight/Kconfig +++ b/drivers/video/backlight/Kconfig | |||
@@ -84,6 +84,15 @@ config LCD_TOSA | |||
84 | If you have an Sharp SL-6000 Zaurus say Y to enable a driver | 84 | If you have an Sharp SL-6000 Zaurus say Y to enable a driver |
85 | for its LCD. | 85 | for its LCD. |
86 | 86 | ||
87 | config LCD_HP700 | ||
88 | tristate "HP Jornada 700 series LCD Driver" | ||
89 | depends on LCD_CLASS_DEVICE | ||
90 | depends on SA1100_JORNADA720_SSP && !PREEMPT | ||
91 | default y | ||
92 | help | ||
93 | If you have an HP Jornada 700 series handheld (710/720/728) | ||
94 | say Y to enable LCD control driver. | ||
95 | |||
87 | # | 96 | # |
88 | # Backlight | 97 | # Backlight |
89 | # | 98 | # |
@@ -157,6 +166,15 @@ config BACKLIGHT_HP680 | |||
157 | If you have a HP Jornada 680, say y to enable the | 166 | If you have a HP Jornada 680, say y to enable the |
158 | backlight driver. | 167 | backlight driver. |
159 | 168 | ||
169 | config BACKLIGHT_HP700 | ||
170 | tristate "HP Jornada 700 series Backlight Driver" | ||
171 | depends on BACKLIGHT_CLASS_DEVICE | ||
172 | depends on SA1100_JORNADA720_SSP && !PREEMPT | ||
173 | default y | ||
174 | help | ||
175 | If you have an HP Jornada 700 series, | ||
176 | say Y to include backlight control driver. | ||
177 | |||
160 | config BACKLIGHT_PROGEAR | 178 | config BACKLIGHT_PROGEAR |
161 | tristate "Frontpath ProGear Backlight Driver" | 179 | tristate "Frontpath ProGear Backlight Driver" |
162 | depends on BACKLIGHT_CLASS_DEVICE && PCI && X86 | 180 | depends on BACKLIGHT_CLASS_DEVICE && PCI && X86 |
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile index 63d75949816..4eb178c1d68 100644 --- a/drivers/video/backlight/Makefile +++ b/drivers/video/backlight/Makefile | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | obj-$(CONFIG_LCD_CLASS_DEVICE) += lcd.o | 3 | obj-$(CONFIG_LCD_CLASS_DEVICE) += lcd.o |
4 | obj-$(CONFIG_LCD_CORGI) += corgi_lcd.o | 4 | obj-$(CONFIG_LCD_CORGI) += corgi_lcd.o |
5 | obj-$(CONFIG_LCD_HP700) += jornada720_lcd.o | ||
5 | obj-$(CONFIG_LCD_LTV350QV) += ltv350qv.o | 6 | obj-$(CONFIG_LCD_LTV350QV) += ltv350qv.o |
6 | obj-$(CONFIG_LCD_ILI9320) += ili9320.o | 7 | obj-$(CONFIG_LCD_ILI9320) += ili9320.o |
7 | obj-$(CONFIG_LCD_PLATFORM) += platform_lcd.o | 8 | obj-$(CONFIG_LCD_PLATFORM) += platform_lcd.o |
@@ -12,6 +13,7 @@ obj-$(CONFIG_LCD_TOSA) += tosa_lcd.o | |||
12 | obj-$(CONFIG_BACKLIGHT_CLASS_DEVICE) += backlight.o | 13 | obj-$(CONFIG_BACKLIGHT_CLASS_DEVICE) += backlight.o |
13 | obj-$(CONFIG_BACKLIGHT_ATMEL_PWM) += atmel-pwm-bl.o | 14 | obj-$(CONFIG_BACKLIGHT_ATMEL_PWM) += atmel-pwm-bl.o |
14 | obj-$(CONFIG_BACKLIGHT_GENERIC) += generic_bl.o | 15 | obj-$(CONFIG_BACKLIGHT_GENERIC) += generic_bl.o |
16 | obj-$(CONFIG_BACKLIGHT_HP700) += jornada720_bl.o | ||
15 | obj-$(CONFIG_BACKLIGHT_HP680) += hp680_bl.o | 17 | obj-$(CONFIG_BACKLIGHT_HP680) += hp680_bl.o |
16 | obj-$(CONFIG_BACKLIGHT_LOCOMO) += locomolcd.o | 18 | obj-$(CONFIG_BACKLIGHT_LOCOMO) += locomolcd.o |
17 | obj-$(CONFIG_BACKLIGHT_OMAP1) += omap1_bl.o | 19 | obj-$(CONFIG_BACKLIGHT_OMAP1) += omap1_bl.o |
diff --git a/drivers/video/backlight/jornada720_bl.c b/drivers/video/backlight/jornada720_bl.c new file mode 100644 index 00000000000..c3ebb6b41ce --- /dev/null +++ b/drivers/video/backlight/jornada720_bl.c | |||
@@ -0,0 +1,161 @@ | |||
1 | /* | ||
2 | * | ||
3 | * Backlight driver for HP Jornada 700 series (710/720/728) | ||
4 | * Copyright (C) 2006-2009 Kristoffer Ericson <kristoffer.ericson@gmail.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License version | ||
8 | * 2 or any later version as published by the Free Software Foundation. | ||
9 | * | ||
10 | */ | ||
11 | |||
12 | #include <linux/backlight.h> | ||
13 | #include <linux/device.h> | ||
14 | #include <linux/fb.h> | ||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/module.h> | ||
17 | #include <linux/platform_device.h> | ||
18 | |||
19 | #include <mach/jornada720.h> | ||
20 | #include <mach/hardware.h> | ||
21 | |||
22 | #include <video/s1d13xxxfb.h> | ||
23 | |||
24 | #define BL_MAX_BRIGHT 255 | ||
25 | #define BL_DEF_BRIGHT 25 | ||
26 | |||
27 | static int jornada_bl_get_brightness(struct backlight_device *bd) | ||
28 | { | ||
29 | int ret; | ||
30 | |||
31 | /* check if backlight is on */ | ||
32 | if (!(PPSR & PPC_LDD1)) | ||
33 | return 0; | ||
34 | |||
35 | jornada_ssp_start(); | ||
36 | |||
37 | /* cmd should return txdummy */ | ||
38 | ret = jornada_ssp_byte(GETBRIGHTNESS); | ||
39 | |||
40 | if (jornada_ssp_byte(GETBRIGHTNESS) != TXDUMMY) { | ||
41 | printk(KERN_ERR "bl : get brightness timeout\n"); | ||
42 | jornada_ssp_end(); | ||
43 | return -ETIMEDOUT; | ||
44 | } else /* exchange txdummy for value */ | ||
45 | ret = jornada_ssp_byte(TXDUMMY); | ||
46 | |||
47 | jornada_ssp_end(); | ||
48 | |||
49 | return (BL_MAX_BRIGHT - ret); | ||
50 | } | ||
51 | |||
52 | static int jornada_bl_update_status(struct backlight_device *bd) | ||
53 | { | ||
54 | int ret = 0; | ||
55 | |||
56 | jornada_ssp_start(); | ||
57 | |||
58 | /* If backlight is off then really turn it off */ | ||
59 | if ((bd->props.power != FB_BLANK_UNBLANK) || (bd->props.fb_blank != FB_BLANK_UNBLANK)) { | ||
60 | ret = jornada_ssp_byte(BRIGHTNESSOFF); | ||
61 | if (ret != TXDUMMY) { | ||
62 | printk(KERN_INFO "bl : brightness off timeout\n"); | ||
63 | /* turn off backlight */ | ||
64 | PPSR &= ~PPC_LDD1; | ||
65 | PPDR |= PPC_LDD1; | ||
66 | ret = -ETIMEDOUT; | ||
67 | } | ||
68 | } else /* turn on backlight */ | ||
69 | PPSR |= PPC_LDD1; | ||
70 | |||
71 | /* send command to our mcu */ | ||
72 | if (jornada_ssp_byte(SETBRIGHTNESS) != TXDUMMY) { | ||
73 | printk(KERN_INFO "bl : failed to set brightness\n"); | ||
74 | ret = -ETIMEDOUT; | ||
75 | goto out | ||
76 | } | ||
77 | |||
78 | /* at this point we expect that the mcu has accepted | ||
79 | our command and is waiting for our new value | ||
80 | please note that maximum brightness is 255, | ||
81 | but due to physical layout it is equal to 0, so we simply | ||
82 | invert the value (MAX VALUE - NEW VALUE). */ | ||
83 | if (jornada_ssp_byte(BL_MAX_BRIGHT - bd->props.brightness) != TXDUMMY) { | ||
84 | printk(KERN_ERR "bl : set brightness failed\n"); | ||
85 | ret = -ETIMEDOUT; | ||
86 | } | ||
87 | |||
88 | /* If infact we get an TXDUMMY as output we are happy and dont | ||
89 | make any further comments about it */ | ||
90 | out: | ||
91 | jornada_ssp_end(); | ||
92 | |||
93 | return ret; | ||
94 | } | ||
95 | |||
96 | static struct backlight_ops jornada_bl_ops = { | ||
97 | .get_brightness = jornada_bl_get_brightness, | ||
98 | .update_status = jornada_bl_update_status, | ||
99 | .options = BL_CORE_SUSPENDRESUME, | ||
100 | }; | ||
101 | |||
102 | static int jornada_bl_probe(struct platform_device *pdev) | ||
103 | { | ||
104 | int ret; | ||
105 | struct backlight_device *bd; | ||
106 | |||
107 | bd = backlight_device_register(S1D_DEVICENAME, &pdev->dev, NULL, &jornada_bl_ops); | ||
108 | |||
109 | if (IS_ERR(bd)) { | ||
110 | ret = PTR_ERR(bd); | ||
111 | printk(KERN_ERR "bl : failed to register device, err=%x\n", ret); | ||
112 | return ret; | ||
113 | } | ||
114 | |||
115 | bd->props.power = FB_BLANK_UNBLANK; | ||
116 | bd->props.brightness = BL_DEF_BRIGHT; | ||
117 | /* note. make sure max brightness is set otherwise | ||
118 | you will get seemingly non-related errors when | ||
119 | trying to change brightness */ | ||
120 | bd->props.max_brightness = BL_MAX_BRIGHT; | ||
121 | jornada_bl_update_status(bd); | ||
122 | |||
123 | platform_set_drvdata(pdev, bd); | ||
124 | printk(KERN_INFO "HP Jornada 700 series backlight driver\n"); | ||
125 | |||
126 | return 0; | ||
127 | } | ||
128 | |||
129 | static int jornada_bl_remove(struct platform_device *pdev) | ||
130 | { | ||
131 | struct backlight_device *bd = platform_get_drvdata(pdev); | ||
132 | |||
133 | backlight_device_unregister(bd); | ||
134 | |||
135 | return 0; | ||
136 | } | ||
137 | |||
138 | static struct platform_driver jornada_bl_driver = { | ||
139 | .probe = jornada_bl_probe, | ||
140 | .remove = jornada_bl_remove, | ||
141 | .driver = { | ||
142 | .name = "jornada_bl", | ||
143 | }, | ||
144 | }; | ||
145 | |||
146 | int __init jornada_bl_init(void) | ||
147 | { | ||
148 | return platform_driver_register(&jornada_bl_driver); | ||
149 | } | ||
150 | |||
151 | void __exit jornada_bl_exit(void) | ||
152 | { | ||
153 | platform_driver_unregister(&jornada_bl_driver); | ||
154 | } | ||
155 | |||
156 | MODULE_AUTHOR("Kristoffer Ericson <kristoffer.ericson>"); | ||
157 | MODULE_DESCRIPTION("HP Jornada 710/720/728 Backlight driver"); | ||
158 | MODULE_LICENSE("GPL"); | ||
159 | |||
160 | module_init(jornada_bl_init); | ||
161 | module_exit(jornada_bl_exit); | ||
diff --git a/drivers/video/backlight/jornada720_lcd.c b/drivers/video/backlight/jornada720_lcd.c new file mode 100644 index 00000000000..cbbb167fd26 --- /dev/null +++ b/drivers/video/backlight/jornada720_lcd.c | |||
@@ -0,0 +1,153 @@ | |||
1 | /* | ||
2 | * | ||
3 | * LCD driver for HP Jornada 700 series (710/720/728) | ||
4 | * Copyright (C) 2006-2009 Kristoffer Ericson <kristoffer.ericson@gmail.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License version | ||
8 | * 2 or any later version as published by the Free Software Foundation. | ||
9 | * | ||
10 | */ | ||
11 | |||
12 | #include <linux/device.h> | ||
13 | #include <linux/fb.h> | ||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/lcd.h> | ||
16 | #include <linux/module.h> | ||
17 | #include <linux/platform_device.h> | ||
18 | #include <linux/delay.h> | ||
19 | |||
20 | #include <mach/jornada720.h> | ||
21 | #include <mach/hardware.h> | ||
22 | |||
23 | #include <video/s1d13xxxfb.h> | ||
24 | |||
25 | #define LCD_MAX_CONTRAST 0xff | ||
26 | #define LCD_DEF_CONTRAST 0x80 | ||
27 | |||
28 | static int jornada_lcd_get_power(struct lcd_device *dev) | ||
29 | { | ||
30 | /* LDD2 in PPC = LCD POWER */ | ||
31 | if (PPSR & PPC_LDD2) | ||
32 | return FB_BLANK_UNBLANK; /* PW ON */ | ||
33 | else | ||
34 | return FB_BLANK_POWERDOWN; /* PW OFF */ | ||
35 | } | ||
36 | |||
37 | static int jornada_lcd_get_contrast(struct lcd_device *dev) | ||
38 | { | ||
39 | int ret; | ||
40 | |||
41 | if (jornada_lcd_get_power(dev) != FB_BLANK_UNBLANK) | ||
42 | return 0; | ||
43 | |||
44 | jornada_ssp_start(); | ||
45 | |||
46 | if (jornada_ssp_byte(GETCONTRAST) != TXDUMMY) { | ||
47 | printk(KERN_ERR "lcd: get contrast failed\n"); | ||
48 | jornada_ssp_end(); | ||
49 | return -ETIMEDOUT; | ||
50 | } else { | ||
51 | ret = jornada_ssp_byte(TXDUMMY); | ||
52 | jornada_ssp_end(); | ||
53 | return ret; | ||
54 | } | ||
55 | } | ||
56 | |||
57 | static int jornada_lcd_set_contrast(struct lcd_device *dev, int value) | ||
58 | { | ||
59 | int ret; | ||
60 | |||
61 | jornada_ssp_start(); | ||
62 | |||
63 | /* start by sending our set contrast cmd to mcu */ | ||
64 | ret = jornada_ssp_byte(SETCONTRAST); | ||
65 | |||
66 | /* push the new value */ | ||
67 | if (jornada_ssp_byte(value) != TXDUMMY) { | ||
68 | printk(KERN_ERR "lcd : set contrast failed\n"); | ||
69 | jornada_ssp_end(); | ||
70 | return -ETIMEDOUT; | ||
71 | } | ||
72 | |||
73 | /* if we get here we can assume everything went well */ | ||
74 | jornada_ssp_end(); | ||
75 | |||
76 | return 0; | ||
77 | } | ||
78 | |||
79 | static int jornada_lcd_set_power(struct lcd_device *dev, int power) | ||
80 | { | ||
81 | if (power != FB_BLANK_UNBLANK) { | ||
82 | PPSR &= ~PPC_LDD2; | ||
83 | PPDR |= PPC_LDD2; | ||
84 | } else | ||
85 | PPSR |= PPC_LDD2; | ||
86 | |||
87 | return 0; | ||
88 | } | ||
89 | |||
90 | static struct lcd_ops jornada_lcd_props = { | ||
91 | .get_contrast = jornada_lcd_get_contrast, | ||
92 | .set_contrast = jornada_lcd_set_contrast, | ||
93 | .get_power = jornada_lcd_get_power, | ||
94 | .set_power = jornada_lcd_set_power, | ||
95 | }; | ||
96 | |||
97 | static int jornada_lcd_probe(struct platform_device *pdev) | ||
98 | { | ||
99 | struct lcd_device *lcd_device; | ||
100 | int ret; | ||
101 | |||
102 | lcd_device = lcd_device_register(S1D_DEVICENAME, &pdev->dev, NULL, &jornada_lcd_props); | ||
103 | |||
104 | if (IS_ERR(lcd_device)) { | ||
105 | ret = PTR_ERR(lcd_device); | ||
106 | printk(KERN_ERR "lcd : failed to register device\n"); | ||
107 | return ret; | ||
108 | } | ||
109 | |||
110 | platform_set_drvdata(pdev, lcd_device); | ||
111 | |||
112 | /* lets set our default values */ | ||
113 | jornada_lcd_set_contrast(lcd_device, LCD_DEF_CONTRAST); | ||
114 | jornada_lcd_set_power(lcd_device, FB_BLANK_UNBLANK); | ||
115 | /* give it some time to startup */ | ||
116 | msleep(100); | ||
117 | |||
118 | return 0; | ||
119 | } | ||
120 | |||
121 | static int jornada_lcd_remove(struct platform_device *pdev) | ||
122 | { | ||
123 | struct lcd_device *lcd_device = platform_get_drvdata(pdev); | ||
124 | |||
125 | lcd_device_unregister(lcd_device); | ||
126 | |||
127 | return 0; | ||
128 | } | ||
129 | |||
130 | static struct platform_driver jornada_lcd_driver = { | ||
131 | .probe = jornada_lcd_probe, | ||
132 | .remove = jornada_lcd_remove, | ||
133 | .driver = { | ||
134 | .name = "jornada_lcd", | ||
135 | }, | ||
136 | }; | ||
137 | |||
138 | int __init jornada_lcd_init(void) | ||
139 | { | ||
140 | return platform_driver_register(&jornada_lcd_driver); | ||
141 | } | ||
142 | |||
143 | void __exit jornada_lcd_exit(void) | ||
144 | { | ||
145 | platform_driver_unregister(&jornada_lcd_driver); | ||
146 | } | ||
147 | |||
148 | MODULE_AUTHOR("Kristoffer Ericson <kristoffer.ericson@gmail.com>"); | ||
149 | MODULE_DESCRIPTION("HP Jornada 710/720/728 LCD driver"); | ||
150 | MODULE_LICENSE("GPL"); | ||
151 | |||
152 | module_init(jornada_lcd_init); | ||
153 | module_exit(jornada_lcd_exit); | ||
diff --git a/drivers/video/backlight/mbp_nvidia_bl.c b/drivers/video/backlight/mbp_nvidia_bl.c index 65864c50045..3bb4c0a50c6 100644 --- a/drivers/video/backlight/mbp_nvidia_bl.c +++ b/drivers/video/backlight/mbp_nvidia_bl.c | |||
@@ -27,73 +27,192 @@ | |||
27 | 27 | ||
28 | static struct backlight_device *mbp_backlight_device; | 28 | static struct backlight_device *mbp_backlight_device; |
29 | 29 | ||
30 | static struct dmi_system_id __initdata mbp_device_table[] = { | 30 | /* Structure to be passed to the DMI_MATCH function. */ |
31 | struct dmi_match_data { | ||
32 | /* I/O resource to allocate. */ | ||
33 | unsigned long iostart; | ||
34 | unsigned long iolen; | ||
35 | /* Backlight operations structure. */ | ||
36 | struct backlight_ops backlight_ops; | ||
37 | }; | ||
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 | |||
44 | /* | ||
45 | * Implementation for MacBooks with Intel chipset. | ||
46 | */ | ||
47 | static int intel_chipset_send_intensity(struct backlight_device *bd) | ||
48 | { | ||
49 | int intensity = bd->props.brightness; | ||
50 | |||
51 | if (debug) | ||
52 | printk(KERN_DEBUG "mbp_nvidia_bl: setting brightness to %d\n", | ||
53 | intensity); | ||
54 | |||
55 | outb(0x04 | (intensity << 4), 0xb3); | ||
56 | outb(0xbf, 0xb2); | ||
57 | return 0; | ||
58 | } | ||
59 | |||
60 | static int intel_chipset_get_intensity(struct backlight_device *bd) | ||
61 | { | ||
62 | int intensity; | ||
63 | |||
64 | outb(0x03, 0xb3); | ||
65 | outb(0xbf, 0xb2); | ||
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; | ||
73 | } | ||
74 | |||
75 | static const struct dmi_match_data intel_chipset_data = { | ||
76 | .iostart = 0xb2, | ||
77 | .iolen = 2, | ||
78 | .backlight_ops = { | ||
79 | .options = BL_CORE_SUSPENDRESUME, | ||
80 | .get_brightness = intel_chipset_get_intensity, | ||
81 | .update_status = intel_chipset_send_intensity, | ||
82 | } | ||
83 | }; | ||
84 | |||
85 | /* | ||
86 | * Implementation for MacBooks with Nvidia chipset. | ||
87 | */ | ||
88 | static int nvidia_chipset_send_intensity(struct backlight_device *bd) | ||
89 | { | ||
90 | int intensity = bd->props.brightness; | ||
91 | |||
92 | if (debug) | ||
93 | printk(KERN_DEBUG "mbp_nvidia_bl: setting brightness to %d\n", | ||
94 | intensity); | ||
95 | |||
96 | outb(0x04 | (intensity << 4), 0x52f); | ||
97 | outb(0xbf, 0x52e); | ||
98 | return 0; | ||
99 | } | ||
100 | |||
101 | static int nvidia_chipset_get_intensity(struct backlight_device *bd) | ||
102 | { | ||
103 | int intensity; | ||
104 | |||
105 | outb(0x03, 0x52f); | ||
106 | outb(0xbf, 0x52e); | ||
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; | ||
114 | } | ||
115 | |||
116 | static const struct dmi_match_data nvidia_chipset_data = { | ||
117 | .iostart = 0x52e, | ||
118 | .iolen = 2, | ||
119 | .backlight_ops = { | ||
120 | .options = BL_CORE_SUSPENDRESUME, | ||
121 | .get_brightness = nvidia_chipset_get_intensity, | ||
122 | .update_status = nvidia_chipset_send_intensity | ||
123 | } | ||
124 | }; | ||
125 | |||
126 | /* | ||
127 | * DMI matching. | ||
128 | */ | ||
129 | static /* const */ struct dmi_match_data *driver_data; | ||
130 | |||
131 | static int mbp_dmi_match(const struct dmi_system_id *id) | ||
132 | { | ||
133 | driver_data = id->driver_data; | ||
134 | |||
135 | printk(KERN_INFO "mbp_nvidia_bl: %s detected\n", id->ident); | ||
136 | return 1; | ||
137 | } | ||
138 | |||
139 | static const struct dmi_system_id __initdata mbp_device_table[] = { | ||
31 | { | 140 | { |
32 | .ident = "3,1", | 141 | .callback = mbp_dmi_match, |
33 | .matches = { | 142 | .ident = "MacBookPro 3,1", |
143 | .matches = { | ||
34 | DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), | 144 | DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), |
35 | DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro3,1"), | 145 | DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro3,1"), |
36 | }, | 146 | }, |
147 | .driver_data = (void *)&intel_chipset_data, | ||
37 | }, | 148 | }, |
38 | { | 149 | { |
39 | .ident = "3,2", | 150 | .callback = mbp_dmi_match, |
40 | .matches = { | 151 | .ident = "MacBookPro 3,2", |
152 | .matches = { | ||
41 | DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), | 153 | DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), |
42 | DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro3,2"), | 154 | DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro3,2"), |
43 | }, | 155 | }, |
156 | .driver_data = (void *)&intel_chipset_data, | ||
44 | }, | 157 | }, |
45 | { | 158 | { |
46 | .ident = "4,1", | 159 | .callback = mbp_dmi_match, |
47 | .matches = { | 160 | .ident = "MacBookPro 4,1", |
161 | .matches = { | ||
48 | DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), | 162 | DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), |
49 | DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro4,1"), | 163 | DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro4,1"), |
50 | }, | 164 | }, |
165 | .driver_data = (void *)&intel_chipset_data, | ||
166 | }, | ||
167 | { | ||
168 | .callback = mbp_dmi_match, | ||
169 | .ident = "MacBook 5,1", | ||
170 | .matches = { | ||
171 | DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), | ||
172 | DMI_MATCH(DMI_PRODUCT_NAME, "MacBook5,1"), | ||
173 | }, | ||
174 | .driver_data = (void *)&nvidia_chipset_data, | ||
175 | }, | ||
176 | { | ||
177 | .callback = mbp_dmi_match, | ||
178 | .ident = "MacBookAir 2,1", | ||
179 | .matches = { | ||
180 | DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), | ||
181 | DMI_MATCH(DMI_PRODUCT_NAME, "MacBookAir2,1"), | ||
182 | }, | ||
183 | .driver_data = (void *)&nvidia_chipset_data, | ||
184 | }, | ||
185 | { | ||
186 | .callback = mbp_dmi_match, | ||
187 | .ident = "MacBookPro 5,1", | ||
188 | .matches = { | ||
189 | DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), | ||
190 | DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro5,1"), | ||
191 | }, | ||
192 | .driver_data = (void *)&nvidia_chipset_data, | ||
51 | }, | 193 | }, |
52 | { } | 194 | { } |
53 | }; | 195 | }; |
54 | 196 | ||
55 | static int mbp_send_intensity(struct backlight_device *bd) | ||
56 | { | ||
57 | int intensity = bd->props.brightness; | ||
58 | |||
59 | outb(0x04 | (intensity << 4), 0xb3); | ||
60 | outb(0xbf, 0xb2); | ||
61 | |||
62 | return 0; | ||
63 | } | ||
64 | |||
65 | static int mbp_get_intensity(struct backlight_device *bd) | ||
66 | { | ||
67 | outb(0x03, 0xb3); | ||
68 | outb(0xbf, 0xb2); | ||
69 | return inb(0xb3) >> 4; | ||
70 | } | ||
71 | |||
72 | static struct backlight_ops mbp_ops = { | ||
73 | .options = BL_CORE_SUSPENDRESUME, | ||
74 | .get_brightness = mbp_get_intensity, | ||
75 | .update_status = mbp_send_intensity, | ||
76 | }; | ||
77 | |||
78 | static int __init mbp_init(void) | 197 | static int __init mbp_init(void) |
79 | { | 198 | { |
80 | if (!dmi_check_system(mbp_device_table)) | 199 | if (!dmi_check_system(mbp_device_table)) |
81 | return -ENODEV; | 200 | return -ENODEV; |
82 | 201 | ||
83 | if (!request_region(0xb2, 2, "Macbook Pro backlight")) | 202 | if (!request_region(driver_data->iostart, driver_data->iolen, |
203 | "Macbook Pro backlight")) | ||
84 | return -ENXIO; | 204 | return -ENXIO; |
85 | 205 | ||
86 | mbp_backlight_device = backlight_device_register("mbp_backlight", | 206 | mbp_backlight_device = backlight_device_register("mbp_backlight", |
87 | NULL, NULL, | 207 | NULL, NULL, &driver_data->backlight_ops); |
88 | &mbp_ops); | ||
89 | if (IS_ERR(mbp_backlight_device)) { | 208 | if (IS_ERR(mbp_backlight_device)) { |
90 | release_region(0xb2, 2); | 209 | release_region(driver_data->iostart, driver_data->iolen); |
91 | return PTR_ERR(mbp_backlight_device); | 210 | return PTR_ERR(mbp_backlight_device); |
92 | } | 211 | } |
93 | 212 | ||
94 | mbp_backlight_device->props.max_brightness = 15; | 213 | mbp_backlight_device->props.max_brightness = 15; |
95 | mbp_backlight_device->props.brightness = | 214 | mbp_backlight_device->props.brightness = |
96 | mbp_get_intensity(mbp_backlight_device); | 215 | driver_data->backlight_ops.get_brightness(mbp_backlight_device); |
97 | backlight_update_status(mbp_backlight_device); | 216 | backlight_update_status(mbp_backlight_device); |
98 | 217 | ||
99 | return 0; | 218 | return 0; |
@@ -103,7 +222,7 @@ static void __exit mbp_exit(void) | |||
103 | { | 222 | { |
104 | backlight_device_unregister(mbp_backlight_device); | 223 | backlight_device_unregister(mbp_backlight_device); |
105 | 224 | ||
106 | release_region(0xb2, 2); | 225 | release_region(driver_data->iostart, driver_data->iolen); |
107 | } | 226 | } |
108 | 227 | ||
109 | module_init(mbp_init); | 228 | module_init(mbp_init); |
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index ea07258565f..e641584e212 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * simple PWM based backlight control, board code has to setup | 4 | * simple PWM based backlight control, board code has to setup |
5 | * 1) pin configuration so PWM waveforms can output | 5 | * 1) pin configuration so PWM waveforms can output |
6 | * 2) platform_data casts to the PWM id (0/1/2/3 on PXA) | 6 | * 2) platform_data being correctly configured |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License version 2 as | 9 | * it under the terms of the GNU General Public License version 2 as |
@@ -97,7 +97,7 @@ static int pwm_backlight_probe(struct platform_device *pdev) | |||
97 | } else | 97 | } else |
98 | dev_dbg(&pdev->dev, "got pwm for backlight\n"); | 98 | dev_dbg(&pdev->dev, "got pwm for backlight\n"); |
99 | 99 | ||
100 | bl = backlight_device_register(pdev->name, &pdev->dev, | 100 | bl = backlight_device_register(dev_name(&pdev->dev), &pdev->dev, |
101 | pb, &pwm_backlight_ops); | 101 | pb, &pwm_backlight_ops); |
102 | if (IS_ERR(bl)) { | 102 | if (IS_ERR(bl)) { |
103 | dev_err(&pdev->dev, "failed to register backlight\n"); | 103 | dev_err(&pdev->dev, "failed to register backlight\n"); |