[Pommed-commits] r525 - in trunk: . pommed
jblache at alioth.debian.org
jblache at alioth.debian.org
Thu Dec 11 14:35:53 UTC 2008
Author: jblache
Date: 2008-12-11 14:35:53 +0000 (Thu, 11 Dec 2008)
New Revision: 525
Modified:
trunk/ChangeLog
trunk/pommed.conf.mactel
trunk/pommed/Makefile
trunk/pommed/conffile.c
trunk/pommed/conffile.h
trunk/pommed/lcd_backlight.h
trunk/pommed/pommed.c
trunk/pommed/sysfs_backlight.c
Log:
Use the sysfs backlight driver for nVidia machines; fall back to the native nv8600mgt driver if not supported.
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-12-11 14:07:26 UTC (rev 524)
+++ trunk/ChangeLog 2008-12-11 14:35:53 UTC (rev 525)
@@ -3,6 +3,9 @@
version 1.23:
- pommed: add backlight support for late 2008 laptops.
+ - pommed: default to sysfs backlight driver for nVidia machines,
+ with the mbp_nvidia_bl kernel driver; fall back to native
+ nv8600mgt if not supported.
version 1.22:
- pommed: do not probe for LMU controller on pmac machines that do
Modified: trunk/pommed/Makefile
===================================================================
--- trunk/pommed/Makefile 2008-12-11 14:07:26 UTC (rev 524)
+++ trunk/pommed/Makefile 2008-12-11 14:35:53 UTC (rev 525)
@@ -57,6 +57,7 @@
SOURCES = pommed.c cd_eject.c evdev.c conffile.c audio.c \
evloop.c dbus.c power.c beep.c video.c \
+ sysfs_backlight.c \
mactel/x1600_backlight.c mactel/gma950_backlight.c \
mactel/nv8600mgt_backlight.c \
mactel/kbd_backlight.c mactel/ambient.c mactel/acpi.c
@@ -87,12 +88,11 @@
video.o: video.c video.h pommed.h dbus.h
+sysfs_backlight.o: sysfs_backlight.c pommed.h lcd_backlight.h conffile.h dbus.h
# PowerMac-specific files
pmac/kbd_backlight.o: pmac/kbd_backlight.c kbd_auto.c kbd_backlight.h evloop.h pommed.h ambient.h conffile.h dbus.h
-sysfs_backlight.o: sysfs_backlight.c pommed.h lcd_backlight.h conffile.h dbus.h
-
pmac/ambient.o: pmac/ambient.c ambient.h pommed.h dbus.h
pmac/pmu.o: pmac/pmu.c power.h
Modified: trunk/pommed/conffile.c
===================================================================
--- trunk/pommed/conffile.c 2008-12-11 14:07:26 UTC (rev 524)
+++ trunk/pommed/conffile.c 2008-12-11 14:35:53 UTC (rev 525)
@@ -37,9 +37,8 @@
struct _general_cfg general_cfg;
-#ifdef __powerpc__
struct _lcd_sysfs_cfg lcd_sysfs_cfg;
-#else
+#ifndef __powerpc__
struct _lcd_x1600_cfg lcd_x1600_cfg;
struct _lcd_gma950_cfg lcd_gma950_cfg;
struct _lcd_nv8600mgt_cfg lcd_nv8600mgt_cfg;
@@ -60,7 +59,6 @@
CFG_END()
};
-#ifdef __powerpc__
static cfg_opt_t lcd_sysfs_opts[] =
{
CFG_INT("init", -1, CFGF_NONE),
@@ -69,8 +67,8 @@
CFG_END()
};
-#else
+#ifndef __powerpc__
static cfg_opt_t lcd_x1600_opts[] =
{
CFG_INT("init", -1, CFGF_NONE),
@@ -94,7 +92,7 @@
CFG_INT("on_batt", 0, CFGF_NONE),
CFG_END()
};
-#endif /* __powerpc__ */
+#endif /* !__powerpc__ */
static cfg_opt_t audio_opts[] =
@@ -145,9 +143,8 @@
static cfg_opt_t opts[] =
{
CFG_SEC("general", general_opts, CFGF_NONE),
-#ifdef __powerpc__
CFG_SEC("lcd_sysfs", lcd_sysfs_opts, CFGF_NONE),
-#else
+#ifndef __powerpc__
CFG_SEC("lcd_x1600", lcd_x1600_opts, CFGF_NONE),
CFG_SEC("lcd_gma950", lcd_gma950_opts, CFGF_NONE),
CFG_SEC("lcd_nv8600mgt", lcd_nv8600mgt_opts, CFGF_NONE),
@@ -198,12 +195,11 @@
printf("pommed configuration:\n");
printf(" + General settings:\n");
printf(" fnmode: %d\n", general_cfg.fnmode);
-#ifdef __powerpc__
printf(" + sysfs backlight control:\n");
printf(" initial level: %d\n", lcd_sysfs_cfg.init);
printf(" step: %d\n", lcd_sysfs_cfg.step);
printf(" on_batt: %d\n", lcd_sysfs_cfg.on_batt);
-#else
+#ifndef __powerpc__
printf(" + ATI X1600 backlight control:\n");
printf(" initial level: %d\n", lcd_x1600_cfg.init);
printf(" step: %d\n", lcd_x1600_cfg.step);
@@ -216,7 +212,7 @@
printf(" initial level: %d\n", lcd_nv8600mgt_cfg.init);
printf(" step: %d\n", lcd_nv8600mgt_cfg.step);
printf(" on_batt: %d\n", lcd_nv8600mgt_cfg.on_batt);
-#endif /* __powerpc__ */
+#endif /* !__powerpc__ */
printf(" + Audio volume control:\n");
printf(" card: %s\n", audio_cfg.card);
printf(" initial volume: %d%s\n", audio_cfg.init, (audio_cfg.init > -1) ? "%" : "");
@@ -265,11 +261,10 @@
/* Set up config values validation */
/* general */
cfg_set_validate_func(cfg, "general|fnmode", config_validate_positive_integer);
-#ifdef __powerpc__
/* lcd_sysfs */
cfg_set_validate_func(cfg, "lcd_sysfs|step", config_validate_positive_integer);
cfg_set_validate_func(cfg, "lcd_sysfs|on_batt", config_validate_positive_integer);
-#else
+#ifndef __powerpc__
/* lcd_x1600 */
cfg_set_validate_func(cfg, "lcd_x1600|step", config_validate_positive_integer);
cfg_set_validate_func(cfg, "lcd_x1600|on_batt", config_validate_positive_integer);
@@ -279,7 +274,7 @@
/* lcd_nv8600mgt */
cfg_set_validate_func(cfg, "lcd_nv8600mgt|step", config_validate_positive_integer);
cfg_set_validate_func(cfg, "lcd_nv8600mgt|on_batt", config_validate_positive_integer);
-#endif /* __powerpc__ */
+#endif /* !__powerpc__ */
/* audio */
cfg_set_validate_func(cfg, "audio|card", config_validate_string);
cfg_set_validate_func(cfg, "audio|step", config_validate_positive_integer);
@@ -322,13 +317,12 @@
sec = cfg_getsec(cfg, "general");
general_cfg.fnmode = cfg_getint(sec, "fnmode");
-#ifdef __powerpc__
sec = cfg_getsec(cfg, "lcd_sysfs");
lcd_sysfs_cfg.init = cfg_getint(sec, "init");
lcd_sysfs_cfg.step = cfg_getint(sec, "step");
lcd_sysfs_cfg.on_batt = cfg_getint(sec, "on_batt");
/* No _fix_config() call here, it's done at probe time */
-#else
+#ifndef __powerpc__
sec = cfg_getsec(cfg, "lcd_x1600");
lcd_x1600_cfg.init = cfg_getint(sec, "init");
lcd_x1600_cfg.step = cfg_getint(sec, "step");
@@ -347,7 +341,7 @@
lcd_nv8600mgt_cfg.step = cfg_getint(sec, "step");
lcd_nv8600mgt_cfg.on_batt = cfg_getint(sec, "on_batt");
nv8600mgt_backlight_fix_config();
-#endif /* __powerpc__ */
+#endif /* !__powerpc__ */
sec = cfg_getsec(cfg, "audio");
audio_cfg.card = strdup(cfg_getstr(sec, "card"));
Modified: trunk/pommed/conffile.h
===================================================================
--- trunk/pommed/conffile.h 2008-12-11 14:07:26 UTC (rev 524)
+++ trunk/pommed/conffile.h 2008-12-11 14:35:53 UTC (rev 525)
@@ -9,15 +9,14 @@
int fnmode;
};
-#ifdef __powerpc__
struct _lcd_sysfs_cfg {
int init;
int step;
int on_batt;
};
-#else
+#ifndef __powerpc__
struct _lcd_x1600_cfg {
int init;
int step;
@@ -35,9 +34,8 @@
int step;
int on_batt;
};
+#endif /* !__powerpc__ */
-#endif /* __powerpc__ */
-
struct _audio_cfg {
char *card;
int init;
@@ -75,9 +73,8 @@
extern struct _general_cfg general_cfg;
-#ifdef __powerpc__
extern struct _lcd_sysfs_cfg lcd_sysfs_cfg;
-#else
+#ifndef __powerpc__
extern struct _lcd_x1600_cfg lcd_x1600_cfg;
extern struct _lcd_gma950_cfg lcd_gma950_cfg;
extern struct _lcd_nv8600mgt_cfg lcd_nv8600mgt_cfg;
Modified: trunk/pommed/lcd_backlight.h
===================================================================
--- trunk/pommed/lcd_backlight.h 2008-12-11 14:07:26 UTC (rev 524)
+++ trunk/pommed/lcd_backlight.h 2008-12-11 14:35:53 UTC (rev 525)
@@ -70,12 +70,9 @@
void
nv8600mgt_backlight_fix_config(void);
+#endif /* !__powerpc__ */
-
-#else
-
-
/* sysfs_backlight.c */
#define SYSFS_BACKLIGHT_OFF 0
@@ -85,6 +82,7 @@
void
sysfs_backlight_toggle(int lvl);
+#ifdef __powerpc__
void
sysfs_backlight_step_kernel(int dir);
@@ -99,7 +97,10 @@
int
nvidia_sysfs_backlight_probe(void);
+#else
+int
+mbp_sysfs_backlight_probe(void);
+#endif
-#endif /* !__powerpc__ */
#endif /* !__LCD_BACKLIGHT_H__ */
Modified: trunk/pommed/pommed.c
===================================================================
--- trunk/pommed/pommed.c 2008-12-11 14:07:26 UTC (rev 524)
+++ trunk/pommed/pommed.c 2008-12-11 14:35:53 UTC (rev 525)
@@ -263,25 +263,25 @@
{ /* MacBookPro3,1 (15" & 17", Core2 Duo, June 2007) */
.type = MACHINE_MACBOOKPRO_3,
- .lcd_backlight_probe = nv8600mgt_backlight_probe,
- .lcd_backlight_step = nv8600mgt_backlight_step,
- .lcd_backlight_toggle = nv8600mgt_backlight_toggle,
+ .lcd_backlight_probe = mbp_sysfs_backlight_probe,
+ .lcd_backlight_step = sysfs_backlight_step,
+ .lcd_backlight_toggle = sysfs_backlight_toggle,
/* .evdev_identify = evdev_is_geyser4, */
},
{ /* MacBookPro4,1 (15" & 17", Core2 Duo, February 2008) */
.type = MACHINE_MACBOOKPRO_4,
- .lcd_backlight_probe = nv8600mgt_backlight_probe,
- .lcd_backlight_step = nv8600mgt_backlight_step,
- .lcd_backlight_toggle = nv8600mgt_backlight_toggle,
+ .lcd_backlight_probe = mbp_sysfs_backlight_probe,
+ .lcd_backlight_step = sysfs_backlight_step,
+ .lcd_backlight_toggle = sysfs_backlight_toggle,
/* .evdev_identify = evdev_is_wellspring2, */
},
{ /* MacBookPro5,1 (15" & 17", Core2 Duo, October 2008) */
.type = MACHINE_MACBOOKPRO_5,
- .lcd_backlight_probe = nv8600mgt_backlight_probe,
- .lcd_backlight_step = nv8600mgt_backlight_step,
- .lcd_backlight_toggle = nv8600mgt_backlight_toggle,
+ .lcd_backlight_probe = mbp_sysfs_backlight_probe,
+ .lcd_backlight_step = sysfs_backlight_step,
+ .lcd_backlight_toggle = sysfs_backlight_toggle,
/* .evdev_identify = evdev_is_wellspring3, */
},
@@ -321,9 +321,9 @@
{ /* MacBook5,1 (Core2 Duo, October 2008) */
.type = MACHINE_MACBOOK_5,
- .lcd_backlight_probe = nv8600mgt_backlight_probe,
- .lcd_backlight_step = nv8600mgt_backlight_step,
- .lcd_backlight_toggle = nv8600mgt_backlight_toggle,
+ .lcd_backlight_probe = mbp_sysfs_backlight_probe,
+ .lcd_backlight_step = sysfs_backlight_step,
+ .lcd_backlight_toggle = sysfs_backlight_toggle,
/* .evdev_identify = evdev_is_wellspring3, */
},
@@ -339,9 +339,9 @@
{ /* MacBookAir2,1 (October 2008) */
.type = MACHINE_MACBOOKAIR_2,
- .lcd_backlight_probe = nv8600mgt_backlight_probe,
- .lcd_backlight_step = nv8600mgt_backlight_step,
- .lcd_backlight_toggle = nv8600mgt_backlight_toggle,
+ .lcd_backlight_probe = mbp_sysfs_backlight_probe,
+ .lcd_backlight_step = sysfs_backlight_step,
+ .lcd_backlight_toggle = sysfs_backlight_toggle,
/* .evdev_identify = evdev_is_wellspring3, */
}
};
Modified: trunk/pommed/sysfs_backlight.c
===================================================================
--- trunk/pommed/sysfs_backlight.c 2008-12-11 14:07:26 UTC (rev 524)
+++ trunk/pommed/sysfs_backlight.c 2008-12-11 14:35:53 UTC (rev 525)
@@ -380,9 +380,17 @@
case MACHINE_MACBOOKPRO_5:
case MACHINE_MACBOOK_5:
case MACHINE_MACBOOKAIR_2:
- logmsg(LOG_INFO, "sysfs backlight probe failed, falling back to native");
- return zobe;
+ logmsg(LOG_INFO, "sysfs backlight probe failed, falling back to nv8600mgt");
+ ret = nv8600mgt_backlight_probe();
+ if (ret == 0)
+ {
+ /* Wire up fallback native driver */
+ mops->lcd_backlight_step = nv8600mgt_backlight_step;
+ mops->lcd_backlight_toggle = nv8600mgt_backlight_toggle;
+ }
+ return ret;
+
default:
logmsg(LOG_ERR, "sysfs backlight probe failed, no fallback for this machine");
return -1;
Modified: trunk/pommed.conf.mactel
===================================================================
--- trunk/pommed.conf.mactel 2008-12-11 14:07:26 UTC (rev 524)
+++ trunk/pommed.conf.mactel 2008-12-11 14:35:53 UTC (rev 525)
@@ -9,6 +9,21 @@
fnmode = 1
}
+# sysfs backlight control
+# nVidia machines, will fall back to nv8600gmt if not supported by the kernel
+lcd_sysfs {
+ # The sysfs backlight control is a generic interface provided
+ # by the Linux kernel for backlight control on most graphic cards.
+ # The brightness range can differ depending on the hardware.
+
+ # initial backlight level [12] (0 - 15, -1 to disable)
+ init = -1
+ # step value (1 - 2)
+ step = 1
+ # backlight level when on battery [6] (1 - 15, 0 to disable)
+ on_batt = 6
+}
+
# ATI X1600 backlight control (MacBook Pro v1 & v2)
lcd_x1600 {
# initial backlight level [200] (0 - 255, -1 to disable)
@@ -29,7 +44,8 @@
on_batt = 0x40
}
-# nVidia GeForce 8600M GT/9400M/9600M GT backlight control (MacBook Pro v3-v5, MacBook v5, MacBook v2)
+# nVidia GeForce 8600M GT/9400M/9600M GT backlight control
+# (MacBook Pro v3-v5, MacBook v5, MacBook v2)
lcd_nv8600mgt {
# initial backlight level [12] (0 - 15, -1 to disable)
init = -1
More information about the Pommed-commits
mailing list