aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@rpsys.net>2005-09-13 04:25:33 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-13 11:22:31 -0400
commit1351e6e093271d0f5056f3ac272864cf4383041a (patch)
treebf96bf863b242529b56b7941c650b1cf0164c3be /drivers/video
parent513b6e1afaf81b42cacbb24ef1aa7eea5e9661c2 (diff)
[PATCH] SharpSL: Abstract model specifics from Corgi Backlight driver
Separate out the Sharp Zaurus c7x0 series specific code from the Corgi backlight driver. Abstract model/machine specific functions to corgi_lcd.c via sharpsl.h This enables the driver to be used by the Zaurus cxx00 series. Signed-Off-by: Richard Purdie <rpurdie@rpsys.net> Cc: Vojtech Pavlik <vojtech@suse.cz> Cc: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/backlight/corgi_bl.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/drivers/video/backlight/corgi_bl.c b/drivers/video/backlight/corgi_bl.c
index 353cb3f73cf2..a32817678552 100644
--- a/drivers/video/backlight/corgi_bl.c
+++ b/drivers/video/backlight/corgi_bl.c
@@ -43,18 +43,10 @@ static void corgibl_send_intensity(int intensity)
43 intensity &= CORGI_LIMIT_MASK; 43 intensity &= CORGI_LIMIT_MASK;
44 } 44 }
45 45
46 /* Skip 0x20 as it will blank the display */
47 if (intensity >= 0x20)
48 intensity++;
49
50 spin_lock_irqsave(&bl_lock, flags); 46 spin_lock_irqsave(&bl_lock, flags);
51 /* Bits 0-4 are accessed via the SSP interface */ 47
52 corgi_ssp_blduty_set(intensity & 0x1f); 48 corgibl_mach_set_intensity(intensity);
53 /* Bit 5 is via SCOOP */ 49
54 if (intensity & 0x0020)
55 set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_BACKLIGHT_CONT);
56 else
57 reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_BACKLIGHT_CONT);
58 spin_unlock_irqrestore(&bl_lock, flags); 50 spin_unlock_irqrestore(&bl_lock, flags);
59} 51}
60 52
@@ -113,8 +105,8 @@ static int corgibl_get_power(struct backlight_device *bd)
113 105
114static int corgibl_set_intensity(struct backlight_device *bd, int intensity) 106static int corgibl_set_intensity(struct backlight_device *bd, int intensity)
115{ 107{
116 if (intensity > CORGI_MAX_INTENSITY) 108 if (intensity > corgibl_data.max_brightness)
117 intensity = CORGI_MAX_INTENSITY; 109 intensity = corgibl_data.max_brightness;
118 corgibl_send_intensity(intensity); 110 corgibl_send_intensity(intensity);
119 current_intensity=intensity; 111 current_intensity=intensity;
120 return 0; 112 return 0;
@@ -141,7 +133,6 @@ static struct backlight_properties corgibl_data = {
141 .owner = THIS_MODULE, 133 .owner = THIS_MODULE,
142 .get_power = corgibl_get_power, 134 .get_power = corgibl_get_power,
143 .set_power = corgibl_set_power, 135 .set_power = corgibl_set_power,
144 .max_brightness = CORGI_MAX_INTENSITY,
145 .get_brightness = corgibl_get_intensity, 136 .get_brightness = corgibl_get_intensity,
146 .set_brightness = corgibl_set_intensity, 137 .set_brightness = corgibl_set_intensity,
147}; 138};
@@ -150,12 +141,18 @@ static struct backlight_device *corgi_backlight_device;
150 141
151static int __init corgibl_probe(struct device *dev) 142static int __init corgibl_probe(struct device *dev)
152{ 143{
144 struct corgibl_machinfo *machinfo = dev->platform_data;
145
146 corgibl_data.max_brightness = machinfo->max_intensity;
147 corgibl_mach_set_intensity = machinfo->set_bl_intensity;
148
153 corgi_backlight_device = backlight_device_register ("corgi-bl", 149 corgi_backlight_device = backlight_device_register ("corgi-bl",
154 NULL, &corgibl_data); 150 NULL, &corgibl_data);
155 if (IS_ERR (corgi_backlight_device)) 151 if (IS_ERR (corgi_backlight_device))
156 return PTR_ERR (corgi_backlight_device); 152 return PTR_ERR (corgi_backlight_device);
157 153
158 corgibl_set_intensity(NULL, CORGI_DEFAULT_INTENSITY); 154 corgibl_set_intensity(NULL, CORGI_DEFAULT_INTENSITY);
155 corgibl_limit_intensity(0);
159 156
160 printk("Corgi Backlight Driver Initialized.\n"); 157 printk("Corgi Backlight Driver Initialized.\n");
161 return 0; 158 return 0;