Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-6]: src/sys/dev/pci Pull up following revision(s) (requested by m...
details: https://anonhg.NetBSD.org/src/rev/d2c72c881d97
branches: netbsd-6
changeset: 773947:d2c72c881d97
user: riz <riz%NetBSD.org@localhost>
date: Wed Mar 21 16:12:18 2012 +0000
description:
Pull up following revision(s) (requested by macallan in ticket #132):
sys/dev/pci/radeonfb.c: revision 1.59
sys/dev/pci/radeonfbvar.h: revision 1.16
adjust the backlight control interface to match the other drivers ( genfb,
r128fb, voyagerfb etc. ) so the lid_switch script does the right thing
noticed by riz, I thought I fixed that a long time ago
diffstat:
sys/dev/pci/radeonfb.c | 59 ++++++++++++++++++++++++++++++++++++----------
sys/dev/pci/radeonfbvar.h | 4 ++-
2 files changed, 49 insertions(+), 14 deletions(-)
diffs (160 lines):
diff -r 1be06fed56cf -r d2c72c881d97 sys/dev/pci/radeonfb.c
--- a/sys/dev/pci/radeonfb.c Wed Mar 21 16:10:21 2012 +0000
+++ b/sys/dev/pci/radeonfb.c Wed Mar 21 16:12:18 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: radeonfb.c,v 1.53 2012/01/30 19:41:23 drochner Exp $ */
+/* $NetBSD: radeonfb.c,v 1.53.2.1 2012/03/21 16:12:18 riz Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@@ -70,7 +70,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.53 2012/01/30 19:41:23 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.53.2.1 2012/03/21 16:12:18 riz Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -169,8 +169,9 @@
static void radeonfb_putchar_aa32(void *, int, int, unsigned, long);
static void radeonfb_putchar_wrapper(void *, int, int, unsigned, long);
+static int radeonfb_set_backlight(struct radeonfb_display *, int);
static int radeonfb_get_backlight(struct radeonfb_display *);
-static int radeonfb_set_backlight(struct radeonfb_display *, int);
+static void radeonfb_switch_backlight(struct radeonfb_display *, int);
static void radeonfb_lvds_callout(void *);
static void radeonfb_brightness_up(device_t);
@@ -900,11 +901,14 @@
config_found(sc->sc_dev, &aa, wsemuldisplaydevprint);
radeonfb_blank(dp, 0);
-
+
/* Initialise delayed lvds operations for backlight. */
callout_init(&dp->rd_bl_lvds_co, 0);
callout_setfunc(&dp->rd_bl_lvds_co,
radeonfb_lvds_callout, dp);
+ dp->rd_bl_on = 1;
+ dp->rd_bl_level = radeonfb_get_backlight(dp);
+ radeonfb_set_backlight(dp, dp->rd_bl_level);
}
/*
@@ -1051,18 +1055,29 @@
#endif
case WSDISPLAYIO_GETPARAM:
param = (struct wsdisplay_param *)d;
- if (param->param == WSDISPLAYIO_PARAM_BACKLIGHT) {
+ switch (param->param) {
+ case WSDISPLAYIO_PARAM_BRIGHTNESS:
+ param->min = 0;
+ param->max = 255;
+ param->curval = dp->rd_bl_level;
+ return 0;
+ case WSDISPLAYIO_PARAM_BACKLIGHT:
param->min = 0;
param->max = RADEONFB_BACKLIGHT_MAX;
- param->curval = radeonfb_get_backlight(dp);
+ param->curval = dp->rd_bl_on;
return 0;
}
return EPASSTHROUGH;
case WSDISPLAYIO_SETPARAM:
param = (struct wsdisplay_param *)d;
- if (param->param == WSDISPLAYIO_PARAM_BACKLIGHT) {
- return radeonfb_set_backlight(dp, param->curval);
+ switch (param->param) {
+ case WSDISPLAYIO_PARAM_BRIGHTNESS:
+ radeonfb_set_backlight(dp, param->curval);
+ return 0;
+ case WSDISPLAYIO_PARAM_BACKLIGHT:
+ radeonfb_switch_backlight(dp, param->curval);
+ return 0;
}
return EPASSTHROUGH;
@@ -3578,6 +3593,14 @@
}
/* Set the backlight to the given level for the display. */
+static void
+radeonfb_switch_backlight(struct radeonfb_display *dp, int on)
+{
+ if (dp->rd_bl_on == on)
+ return;
+ dp->rd_bl_on = on;
+ radeonfb_set_backlight(dp, dp->rd_bl_level);
+}
static int
radeonfb_set_backlight(struct radeonfb_display *dp, int level)
@@ -3587,7 +3610,11 @@
uint32_t lvds;
s = spltty();
-
+
+ dp->rd_bl_level = level;
+ if (dp->rd_bl_on == 0)
+ level = 0;
+
if (level < 0)
level = 0;
else if (level >= RADEONFB_BACKLIGHT_MAX)
@@ -3663,24 +3690,30 @@
radeonfb_brightness_up(device_t dev)
{
struct radeonfb_softc *sc = device_private(dev);
+ struct radeonfb_display *dp = &sc->sc_displays[0];
int level;
/* we assume the main display is the first one - need a better way */
if (sc->sc_ndisplays < 1) return;
- level = radeonfb_get_backlight(&sc->sc_displays[0]);
+ /* make sure pushing the hotkeys always has an effect */
+ dp->rd_bl_on = 1;
+ level = dp->rd_bl_level;
level = min(RADEONFB_BACKLIGHT_MAX, level + 5);
- radeonfb_set_backlight(&sc->sc_displays[0], level);
+ radeonfb_set_backlight(dp, level);
}
static void
radeonfb_brightness_down(device_t dev)
{
struct radeonfb_softc *sc = device_private(dev);
+ struct radeonfb_display *dp = &sc->sc_displays[0];
int level;
/* we assume the main display is the first one - need a better way */
if (sc->sc_ndisplays < 1) return;
- level = radeonfb_get_backlight(&sc->sc_displays[0]);
+ /* make sure pushing the hotkeys always has an effect */
+ dp->rd_bl_on = 1;
+ level = dp->rd_bl_level;
level = max(0, level - 5);
- radeonfb_set_backlight(&sc->sc_displays[0], level);
+ radeonfb_set_backlight(dp, level);
}
diff -r 1be06fed56cf -r d2c72c881d97 sys/dev/pci/radeonfbvar.h
--- a/sys/dev/pci/radeonfbvar.h Wed Mar 21 16:10:21 2012 +0000
+++ b/sys/dev/pci/radeonfbvar.h Wed Mar 21 16:12:18 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: radeonfbvar.h,v 1.13 2012/01/30 19:41:23 drochner Exp $ */
+/* $NetBSD: radeonfbvar.h,v 1.13.2.1 2012/03/21 16:12:19 riz Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@@ -175,6 +175,8 @@
struct callout rd_bl_lvds_co; /* delayed lvds operation */
uint32_t rd_bl_lvds_val; /* value of delayed lvds */
+ int rd_bl_on;
+ int rd_bl_level;
int rd_wsmode;
Home |
Main Index |
Thread Index |
Old Index