[Pommed-commits] r263 - in trunk/pommed: . pmac

Julien Blache jblache at alioth.debian.org
Thu Feb 22 13:51:05 CET 2007


Author: jblache
Date: 2007-02-22 13:51:05 +0100 (Thu, 22 Feb 2007)
New Revision: 263

Modified:
   trunk/pommed/conffile.c
   trunk/pommed/conffile.h
   trunk/pommed/pmac/sysfs_backlight.c
Log:
Turn sysfs_backlight into a generic backend.

The lcd_r9600 config section becomes lcd_sysfs.


Modified: trunk/pommed/conffile.c
===================================================================
--- trunk/pommed/conffile.c	2007-02-22 12:42:11 UTC (rev 262)
+++ trunk/pommed/conffile.c	2007-02-22 12:51:05 UTC (rev 263)
@@ -3,7 +3,7 @@
  *
  * $Id$
  *
- * Copyright (C) 2006 Julien BLACHE <jb at jblache.org>
+ * Copyright (C) 2006-2007 Julien BLACHE <jb at jblache.org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -37,7 +37,7 @@
 
 struct _general_cfg general_cfg;
 #ifdef __powerpc__
-struct _lcd_r9600_cfg lcd_r9600_cfg;
+struct _lcd_sysfs_cfg lcd_sysfs_cfg;
 struct _lcd_r128_cfg lcd_r128_cfg;
 #else
 struct _lcd_x1600_cfg lcd_x1600_cfg;
@@ -59,7 +59,7 @@
   };
 
 #ifdef __powerpc__
-static cfg_opt_t lcd_r9600_opts[] =
+static cfg_opt_t lcd_sysfs_opts[] =
   {
     CFG_INT("init", -1, CFGF_NONE),
     CFG_INT("step", 8, CFGF_NONE),
@@ -139,7 +139,7 @@
   {
     CFG_SEC("general", general_opts, CFGF_NONE),
 #ifdef __powerpc__ 
-    CFG_SEC("lcd_r9600", lcd_r9600_opts, CFGF_NONE),
+    CFG_SEC("lcd_sysfs", lcd_sysfs_opts, CFGF_NONE),
     CFG_SEC("lcd_r128", lcd_r128_opts, CFGF_NONE),
 #else
     CFG_SEC("lcd_x1600", lcd_x1600_opts, CFGF_NONE),
@@ -191,9 +191,9 @@
   printf(" + General settings:\n");
   printf("    fnmode: %d\n", general_cfg.fnmode);
 #ifdef __powerpc__
-  printf(" + ATI Radeon 9600 backlight control:\n");
-  printf("    initial level: %d\n", lcd_r9600_cfg.init);
-  printf("    step: %d\n", lcd_r9600_cfg.step);
+  printf(" + sysfs backlight control:\n");
+  printf("    initial level: %d\n", lcd_sysfs_cfg.init);
+  printf("    step: %d\n", lcd_sysfs_cfg.step);
   printf(" + ATI Rage128 backlight control:\n");
   printf("    initial level: %d\n", lcd_r128_cfg.init);
 #else
@@ -249,7 +249,7 @@
   cfg_set_validate_func(cfg, "general|fnmode", config_validate_positive_integer);
 #ifdef __powerpc__
   /* lcd_r9600 */
-  cfg_set_validate_func(cfg, "lcd_r9600|step", config_validate_positive_integer);
+  cfg_set_validate_func(cfg, "lcd_sysfs|step", config_validate_positive_integer);
 #else
   /* lcd_x1600 */
   cfg_set_validate_func(cfg, "lcd_x1600|step", config_validate_positive_integer);
@@ -297,9 +297,9 @@
   general_cfg.fnmode = cfg_getint(sec, "fnmode");
 
 #ifdef __powerpc__
-  sec = cfg_getsec(cfg, "lcd_r9600");
-  lcd_r9600_cfg.init = cfg_getint(sec, "init");
-  lcd_r9600_cfg.step = cfg_getint(sec, "step");
+  sec = cfg_getsec(cfg, "lcd_sysfs");
+  lcd_sysfs_cfg.init = cfg_getint(sec, "init");
+  lcd_sysfs_cfg.step = cfg_getint(sec, "step");
   /* No _fix_config() call here, it's done at probe time */
 
   sec = cfg_getsec(cfg, "lcd_r128");

Modified: trunk/pommed/conffile.h
===================================================================
--- trunk/pommed/conffile.h	2007-02-22 12:42:11 UTC (rev 262)
+++ trunk/pommed/conffile.h	2007-02-22 12:51:05 UTC (rev 263)
@@ -10,7 +10,7 @@
 };
 
 #ifdef __powerpc__
-struct _lcd_r9600_cfg {
+struct _lcd_sysfs_cfg {
   int init;
   int step;
 };
@@ -63,7 +63,7 @@
 
 extern struct _general_cfg general_cfg;
 #ifdef __powerpc__
-extern struct _lcd_r9600_cfg lcd_r9600_cfg;
+extern struct _lcd_sysfs_cfg lcd_sysfs_cfg;
 extern struct _lcd_r128_cfg lcd_r128_cfg;
 #else
 extern struct _lcd_x1600_cfg lcd_x1600_cfg;

Modified: trunk/pommed/pmac/sysfs_backlight.c
===================================================================
--- trunk/pommed/pmac/sysfs_backlight.c	2007-02-22 12:42:11 UTC (rev 262)
+++ trunk/pommed/pmac/sysfs_backlight.c	2007-02-22 12:51:05 UTC (rev 263)
@@ -163,21 +163,21 @@
 
   if (dir == STEP_UP)
     {
-      newval = val + lcd_r9600_cfg.step;
+      newval = val + lcd_sysfs_cfg.step;
 
       if (newval > lcd_bck_info.max)
 	newval = lcd_bck_info.max;
 
-      logdebug("LCD stepping +%d -> %d\n", lcd_r9600_cfg.step, newval);
+      logdebug("LCD stepping +%d -> %d\n", lcd_sysfs_cfg.step, newval);
     }
   else if (dir == STEP_DOWN)
     {
-      newval = val - lcd_r9600_cfg.step;
+      newval = val - lcd_sysfs_cfg.step;
 
       if (newval < SYSFS_BACKLIGHT_OFF)
 	newval = SYSFS_BACKLIGHT_OFF;
 
-      logdebug("LCD stepping -%d -> %d\n", lcd_r9600_cfg.step, newval);
+      logdebug("LCD stepping -%d -> %d\n", lcd_sysfs_cfg.step, newval);
     }
   else
     return;
@@ -196,17 +196,17 @@
 static void
 sysfs_backlight_fix_config(void)
 {
-  if (lcd_r9600_cfg.init < 0)
-    lcd_r9600_cfg.init = -1;
+  if (lcd_sysfs_cfg.init < 0)
+    lcd_sysfs_cfg.init = -1;
 
-  if (lcd_r9600_cfg.init > lcd_bck_info.max)
-    lcd_r9600_cfg.init = lcd_bck_info.max;
+  if (lcd_sysfs_cfg.init > lcd_bck_info.max)
+    lcd_sysfs_cfg.init = lcd_bck_info.max;
 
-  if (lcd_r9600_cfg.step < 1)
-    lcd_r9600_cfg.step = 1;
+  if (lcd_sysfs_cfg.step < 1)
+    lcd_sysfs_cfg.step = 1;
 
-  if (lcd_r9600_cfg.step > (lcd_bck_info.max / 2))
-    lcd_r9600_cfg.step = lcd_bck_info.max / 2;
+  if (lcd_sysfs_cfg.step > (lcd_bck_info.max / 2))
+    lcd_sysfs_cfg.step = lcd_bck_info.max / 2;
 }
 
 
@@ -237,9 +237,9 @@
    * Set the initial backlight level
    * The value has been sanity checked already
    */
-  if (lcd_r9600_cfg.init > -1)
+  if (lcd_sysfs_cfg.init > -1)
     {
-      sysfs_backlight_set(lcd_r9600_cfg.init);
+      sysfs_backlight_set(lcd_sysfs_cfg.init);
     }
 
   lcd_bck_info.level = sysfs_backlight_get();




More information about the Pommed-commits mailing list