[Pommed-commits] r410 - trunk/pommed/mactel

jblache at alioth.debian.org jblache at alioth.debian.org
Sat Dec 1 21:43:38 UTC 2007


Author: jblache
Date: 2007-12-01 21:43:38 +0000 (Sat, 01 Dec 2007)
New Revision: 410

Modified:
   trunk/pommed/mactel/gma950_backlight.c
Log:
Both the 950 and 965 write the backlight value at 0x61254.
On the 965, the control register is at 0x61250, but it's not the same thing.


Modified: trunk/pommed/mactel/gma950_backlight.c
===================================================================
--- trunk/pommed/mactel/gma950_backlight.c	2007-12-01 18:41:41 UTC (rev 409)
+++ trunk/pommed/mactel/gma950_backlight.c	2007-12-01 21:43:38 UTC (rev 410)
@@ -35,12 +35,15 @@
  *
  *
  * The GMA965 is slightly different; the backlight control register is at
- * offset 0x00061250 in its PCI memory space (512K region):
+ * offset 0x00061250 in its PCI memory space (first 512K in the 1M region):
  *  - bits 0-15 represent the backlight value
  *  - bits 16-31 hold the max backlight value
  *  - bit 30 indicates legacy mode is in use when set
  *
  *
+ * For BOTH cards, the register for the backlight value is at offset 0x00061254.
+ *
+ *
  * For both cards, in the code below, max value and current value are expressed
  * on 15 bits; the values are shifted as appropriate when appropriate.
  */
@@ -68,18 +71,19 @@
 
 
 static unsigned int GMA950_BACKLIGHT_MAX;
-static unsigned int REGISTER_OFFSET;
 
 static int fd = -1;
 static char *memory = NULL;
 static long address = 0;
 static long length = 0;
 
+#define REGISTER_OFFSET           0x00061254
+
 #define GMA950_LEGACY_MODE        (1 << 16)
-#define GMA950_REGISTER_OFFSET    0x00061254
+#define GMA950_CONTROL_REGISTER   0x00061254
 
 #define GMA965_LEGACY_MODE        (1 << 30)
-#define GMA965_REGISTER_OFFSET    0x00061250
+#define GMA965_CONTROL_REGISTER   0x00061250
 
 static inline unsigned int
 readl(const volatile void *addr)
@@ -288,10 +292,9 @@
   struct pci_access *pacc;
   struct pci_dev *dev;
 
+  int card;
   int ret;
 
-  int card;
-
   pacc = pci_alloc();
   if (pacc == NULL)
     {
@@ -338,27 +341,23 @@
 
   if (card == PCI_ID_PRODUCT_GMA950)
     {
-      if (INREG(GMA950_REGISTER_OFFSET) & GMA950_LEGACY_MODE)
+      if (INREG(GMA950_CONTROL_REGISTER) & GMA950_LEGACY_MODE)
 	{
 	  logdebug("GMA950 is in legacy backlight control mode, unsupported\n");
 
 	  gma950_backlight_unmap();
 	  return -1;
 	}
-
-      REGISTER_OFFSET = GMA950_REGISTER_OFFSET;
     }
   else if (card == PCI_ID_PRODUCT_GMA965)
     {
-      if (INREG(GMA965_REGISTER_OFFSET) & GMA965_LEGACY_MODE)
+      if (INREG(GMA965_CONTROL_REGISTER) & GMA965_LEGACY_MODE)
 	{
 	  logdebug("GMA965 is in legacy backlight control mode, unsupported\n");
 
 	  gma950_backlight_unmap();
 	  return -1;
 	}
-
-      REGISTER_OFFSET = GMA965_REGISTER_OFFSET;
     }
 
   /* Get the maximum backlight value */




More information about the Pommed-commits mailing list