aboutsummaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--arch/arm/mach-pxa/corgi.c6
-rw-r--r--arch/arm/mach-pxa/corgi_lcd.c65
-rw-r--r--arch/arm/mach-pxa/sharpsl.h8
-rw-r--r--drivers/video/backlight/corgi_bl.c25
-rw-r--r--include/asm-arm/arch-pxa/sharpsl.h10
5 files changed, 100 insertions, 14 deletions
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
index fc428b827671..426c2bc517eb 100644
--- a/arch/arm/mach-pxa/corgi.c
+++ b/arch/arm/mach-pxa/corgi.c
@@ -109,10 +109,16 @@ struct corgissp_machinfo corgi_ssp_machinfo = {
109/* 109/*
110 * Corgi Backlight Device 110 * Corgi Backlight Device
111 */ 111 */
112static struct corgibl_machinfo corgi_bl_machinfo = {
113 .max_intensity = 0x2f,
114 .set_bl_intensity = corgi_bl_set_intensity,
115};
116
112static struct platform_device corgibl_device = { 117static struct platform_device corgibl_device = {
113 .name = "corgi-bl", 118 .name = "corgi-bl",
114 .dev = { 119 .dev = {
115 .parent = &corgifb_device.dev, 120 .parent = &corgifb_device.dev,
121 .platform_data = &corgi_bl_machinfo,
116 }, 122 },
117 .id = -1, 123 .id = -1,
118}; 124};
diff --git a/arch/arm/mach-pxa/corgi_lcd.c b/arch/arm/mach-pxa/corgi_lcd.c
index bfe5efc11b8a..c5efcd04fcbc 100644
--- a/arch/arm/mach-pxa/corgi_lcd.c
+++ b/arch/arm/mach-pxa/corgi_lcd.c
@@ -498,3 +498,68 @@ void spitz_wait_hsync(void)
498 sharpsl_wait_sync(SPITZ_GPIO_HSYNC); 498 sharpsl_wait_sync(SPITZ_GPIO_HSYNC);
499} 499}
500#endif 500#endif
501
502/*
503 * Corgi/Spitz Backlight Power
504 */
505#ifdef CONFIG_PXA_SHARP_C7xx
506void corgi_bl_set_intensity(int intensity)
507{
508 if (intensity > 0x10)
509 intensity += 0x10;
510
511 /* Bits 0-4 are accessed via the SSP interface */
512 corgi_ssp_blduty_set(intensity & 0x1f);
513
514 /* Bit 5 is via SCOOP */
515 if (intensity & 0x0020)
516 set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_BACKLIGHT_CONT);
517 else
518 reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_BACKLIGHT_CONT);
519}
520#endif
521
522
523#if defined(CONFIG_MACH_SPITZ) || defined(CONFIG_MACH_BORZOI)
524void spitz_bl_set_intensity(int intensity)
525{
526 if (intensity > 0x10)
527 intensity += 0x10;
528
529 /* Bits 0-4 are accessed via the SSP interface */
530 corgi_ssp_blduty_set(intensity & 0x1f);
531
532 /* Bit 5 is via SCOOP */
533 if (intensity & 0x0020)
534 reset_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_CONT);
535 else
536 set_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_CONT);
537
538 if (intensity)
539 set_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_ON);
540 else
541 reset_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_ON);
542}
543#endif
544
545#ifdef CONFIG_MACH_AKITA
546void akita_bl_set_intensity(int intensity)
547{
548 if (intensity > 0x10)
549 intensity += 0x10;
550
551 /* Bits 0-4 are accessed via the SSP interface */
552 corgi_ssp_blduty_set(intensity & 0x1f);
553
554 /* Bit 5 is via IO-Expander */
555 if (intensity & 0x0020)
556 akita_reset_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_CONT);
557 else
558 akita_set_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_CONT);
559
560 if (intensity)
561 akita_set_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_ON);
562 else
563 akita_reset_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_ON);
564}
565#endif
diff --git a/arch/arm/mach-pxa/sharpsl.h b/arch/arm/mach-pxa/sharpsl.h
index 7007d8a1c5c5..3977a77aacdd 100644
--- a/arch/arm/mach-pxa/sharpsl.h
+++ b/arch/arm/mach-pxa/sharpsl.h
@@ -15,6 +15,14 @@ struct corgissp_machinfo {
15void corgi_ssp_set_machinfo(struct corgissp_machinfo *machinfo); 15void corgi_ssp_set_machinfo(struct corgissp_machinfo *machinfo);
16 16
17/* 17/*
18 * SharpSL Backlight
19 */
20
21void corgi_bl_set_intensity(int intensity);
22void spitz_bl_set_intensity(int intensity);
23void akita_bl_set_intensity(int intensity);
24
25/*
18 * SharpSL Touchscreen Driver 26 * SharpSL Touchscreen Driver
19 */ 27 */
20 28
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;
diff --git a/include/asm-arm/arch-pxa/sharpsl.h b/include/asm-arm/arch-pxa/sharpsl.h
index 1e1d11033940..311f2bb5386a 100644
--- a/include/asm-arm/arch-pxa/sharpsl.h
+++ b/include/asm-arm/arch-pxa/sharpsl.h
@@ -20,3 +20,13 @@ struct corgits_machinfo {
20 void (*put_hsync)(void); 20 void (*put_hsync)(void);
21 void (*wait_hsync)(void); 21 void (*wait_hsync)(void);
22}; 22};
23
24/*
25 * SharpSL Backlight
26 */
27
28struct corgibl_machinfo {
29 int max_intensity;
30 void (*set_bl_intensity)(int intensity);
31};
32