Skip to contentSkip to conversation

fix hardcoded values in collie frontlight

PATCH In review Pavel Machek 2 participants 5 messages Mar 5, 2006 – Mar 6, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix hardcoded values in collie frontlight

In frontlight support, we should really use values from flash-ROM instead of hardcoding our own.

drivers/video/backlight/locomolcd.c +7 -4
index ada6e75..2bcff84 100644
@@ -20,6 +20,7 @@
 
 #include <asm/hardware/locomo.h>
 #include <asm/irq.h>
+#include <asm/mach/sharpsl_param.h>
 
 #ifdef CONFIG_SA1100_COLLIE
 #include <asm/arch/collie.h>
@@ -27,7 +28,7 @@
 #include <asm/arch/poodle.h>
 #endif
 
-extern void (*sa1100fb_lcd_power)(int on);
+#include "../../../arch/arm/mach-sa1100/generic.h"
 
 static struct locomo_dev *locomolcd_dev;
 
@@ -82,7 +83,7 @@ static void locomolcd_off(int comadj)
 
 void locomolcd_power(int on)
 {
-	int comadj = 118;
+	int comadj = sharpsl_param.comadj;
 	unsigned long flags;
 
 	local_irq_save(flags);
@@ -93,11 +94,13 @@ void locomolcd_power(int on)
 	}
 
 	/* read comadj */
+	if (comadj == -1) {
 #ifdef CONFIG_MACH_POODLE
-	comadj = 118;
+		comadj = 118;
 #else
-	comadj = 128;
+		comadj = 128;
 #endif
+	}
 
 	if (on)
 		locomolcd_on(comadj);
Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#1 lore raw
Quoted 10 lines · Pavel Machek

In frontlight support, we should really use values from flash-ROM instead of hardcoding our own.

drivers/video/backlight/locomolcd.c +0 -0
index ada6e75..2bcff84 100644

drivers/video/backlight/locomolcd.c line 31

Quoted 5 lines
drivers/video/backlight/locomolcd.c +1 -1
@@ -27,7 +28,7 @@
 #include <asm/arch/poodle.h>
 #endif
 
-extern void (*sa1100fb_lcd_power)(int on);
+#include "../../../arch/arm/mach-sa1100/generic.h"

This would be neater if that was in some more accessible header in asm/arch. I'm not sure which header that would be though. Russell?

drivers/video/backlight/locomolcd.c void locomolcd_power(int on) · line 103

Quoted 13 lines
drivers/video/backlight/locomolcd.c +4 -2
@@ -93,11 +94,13 @@ void locomolcd_power(int on)
 	}
 
 	/* read comadj */
+	if (comadj == -1) {
 #ifdef CONFIG_MACH_POODLE
-	comadj = 118;
+		comadj = 118;
 #else
-	comadj = 128;
+		comadj = 128;
 #endif
+	}

Perhaps use machine_is_poodle() and machine_is_collie() here?

I agree with the changes in principle though.

Richard

#2 lore raw

PATCH 1/1 fix hardcoded values in collie frontlight

In frontlight support, we should really use values from flash-ROM instead of hardcoding our own. Cleanup includes.

drivers/video/backlight/locomolcd.c +10 -13
@@ -20,14 +20,10 @@
 
 #include <asm/hardware/locomo.h>
 #include <asm/irq.h>
+#include <asm/mach/sharpsl_param.h>
+#include <asm/mach-types.h>
 
-#ifdef CONFIG_SA1100_COLLIE
-#include <asm/arch/collie.h>
-#else
-#include <asm/arch/poodle.h>
-#endif
-
-extern void (*sa1100fb_lcd_power)(int on);
+#include "../../../arch/arm/mach-sa1100/generic.h"
 
 static struct locomo_dev *locomolcd_dev;
 
@@ -82,7 +78,7 @@ static void locomolcd_off(int comadj)
 
 void locomolcd_power(int on)
 {
-	int comadj = 118;
+	int comadj = sharpsl_param.comadj;
 	unsigned long flags;
 
 	local_irq_save(flags);
@@ -93,11 +89,12 @@ void locomolcd_power(int on)
 	}
 
 	/* read comadj */
-#ifdef CONFIG_MACH_POODLE
-	comadj = 118;
-#else
-	comadj = 128;
-#endif
+	if (comadj == -1) {
+		if (machine_is_poodle())
+			comadj = 118;
+		if (machine_is_collie())
+			comadj = 128;
+	}
 
 	if (on)
 		locomolcd_on(comadj);
Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#3 lore raw
Quoted 4 lines · Pavel Machek

In frontlight support, we should really use values from flash-ROM instead of hardcoding our own. Cleanup includes.

Quoted 50 lines
drivers/video/backlight/locomolcd.c +10 -13
@@ -20,14 +20,10 @@
 
 #include <asm/hardware/locomo.h>
 #include <asm/irq.h>
+#include <asm/mach/sharpsl_param.h>
+#include <asm/mach-types.h>
 
-#ifdef CONFIG_SA1100_COLLIE
-#include <asm/arch/collie.h>
-#else
-#include <asm/arch/poodle.h>
-#endif
-
-extern void (*sa1100fb_lcd_power)(int on);
+#include "../../../arch/arm/mach-sa1100/generic.h"
 
 static struct locomo_dev *locomolcd_dev;
 
@@ -82,7 +78,7 @@ static void locomolcd_off(int comadj)
 
 void locomolcd_power(int on)
 {
-	int comadj = 118;
+	int comadj = sharpsl_param.comadj;
 	unsigned long flags;
 
 	local_irq_save(flags);
@@ -93,11 +89,12 @@ void locomolcd_power(int on)
 	}
 
 	/* read comadj */
-#ifdef CONFIG_MACH_POODLE
-	comadj = 118;
-#else
-	comadj = 128;
-#endif
+	if (comadj == -1) {
+		if (machine_is_poodle())
+			comadj = 118;
+		if (machine_is_collie())
+			comadj = 128;
+	}
 
 	if (on)
 		locomolcd_on(comadj);
#4 lore raw
In reply to Richard Purdie
Quoted 15 lines

drivers/video/backlight/locomolcd.c void locomolcd_power(int on) · line 103

Quoted 13 lines
drivers/video/backlight/locomolcd.c +4 -2
@@ -93,11 +94,13 @@ void locomolcd_power(int on)
 	}
 
 	/* read comadj */
+	if (comadj == -1) {
 #ifdef CONFIG_MACH_POODLE
-	comadj = 118;
+		comadj = 118;
 #else
-	comadj = 128;
+		comadj = 128;
 #endif
+	}

Perhaps use machine_is_poodle() and machine_is_collie() here?

Yep, and unneccesssary includes can be killed. Thanks.
Pavel

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...