Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/hpcsh/dev/hd64461 Use CONFIG_HOOK_BRIGHTNESS* to su...
details: https://anonhg.NetBSD.org/src/rev/862e35fb6d54
branches: trunk
changeset: 556348:862e35fb6d54
user: uwe <uwe%NetBSD.org@localhost>
date: Sun Dec 14 02:52:15 2003 +0000
description:
Use CONFIG_HOOK_BRIGHTNESS* to support WSDISPLAYIO_PARAM_BRIGHTNESS.
Use CONFIG_HOOK_POWERCONTROL_LCDLIGHT to turn on/off the LCD in
response to WSDISPLAYIO_SVIDEO.
Implementation of these hooks for Jornada 680 is to follow shortly.
diffstat:
sys/arch/hpcsh/dev/hd64461/hd64461video.c | 80 +++++++++++++++++++++++++++++-
1 files changed, 76 insertions(+), 4 deletions(-)
diffs (163 lines):
diff -r bbcd9084f64b -r 862e35fb6d54 sys/arch/hpcsh/dev/hd64461/hd64461video.c
--- a/sys/arch/hpcsh/dev/hd64461/hd64461video.c Sun Dec 14 02:48:36 2003 +0000
+++ b/sys/arch/hpcsh/dev/hd64461/hd64461video.c Sun Dec 14 02:52:15 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hd64461video.c,v 1.22 2003/11/13 03:09:28 chs Exp $ */
+/* $NetBSD: hd64461video.c,v 1.23 2003/12/14 02:52:15 uwe Exp $ */
/*-
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -37,12 +37,13 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hd64461video.c,v 1.22 2003/11/13 03:09:28 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hd64461video.c,v 1.23 2003/12/14 02:52:15 uwe Exp $");
#include "debug_hpcsh.h"
// #define HD64461VIDEO_HWACCEL
#include <sys/param.h>
+#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <sys/malloc.h>
@@ -70,6 +71,7 @@
#include <dev/hpc/hpcfbio.h>
#include <dev/hpc/video_subr.h>
+#include <machine/config_hook.h>
#include <machine/bootinfo.h>
#ifdef HD64461VIDEO_DEBUG
@@ -111,6 +113,8 @@
struct hpcfb_fbconf hf;
u_int8_t *off_screen_addr;
size_t off_screen_size;
+
+ struct callout unblank_ch;
int blanked;
int console;
@@ -133,6 +137,7 @@
u_int8_t *, u_int8_t *, u_int8_t *);
STATIC void hd64461video_off(struct hd64461video_chip *vc);
STATIC void hd64461video_on(struct hd64461video_chip *vc);
+STATIC void hd64461video_display_on(void *);
#if notyet
STATIC void hd64461video_set_display_mode(struct hd64461video_chip *);
@@ -407,6 +412,7 @@
struct hpcfb_fbconf *fbconf;
struct hpcfb_dspconf *dspconf;
struct wsdisplay_cmap *cmap;
+ struct wsdisplay_param *dispparam;
int turnoff;
u_int8_t *r, *g, *b;
int error;
@@ -430,6 +436,44 @@
return (0);
+ case WSDISPLAYIO_GETPARAM:
+ dispparam = (struct wsdisplay_param*)data;
+ switch (dispparam->param) {
+ case WSDISPLAYIO_PARAM_BRIGHTNESS:
+ dispparam->min = 0;
+ error = config_hook_call(CONFIG_HOOK_GET,
+ CONFIG_HOOK_BRIGHTNESS_MAX,
+ &dispparam->max);
+ if (error == 0)
+ error = config_hook_call(CONFIG_HOOK_GET,
+ CONFIG_HOOK_BRIGHTNESS,
+ &dispparam->curval);
+ if (error == 0)
+ return (0);
+ else
+ return (EINVAL);
+ default:
+ return (EINVAL);
+ }
+ return (0);
+
+ case WSDISPLAYIO_SETPARAM:
+ dispparam = (struct wsdisplay_param*)data;
+ switch (dispparam->param) {
+ case WSDISPLAYIO_PARAM_BRIGHTNESS:
+ error = config_hook_call(CONFIG_HOOK_SET,
+ CONFIG_HOOK_BRIGHTNESS,
+ &dispparam->curval);
+ if (error == 0)
+ return (0);
+ else
+ return (EINVAL);
+ default:
+ return (EINVAL);
+ }
+ return (0);
+
+
case WSDISPLAYIO_GETCMAP:
cmap = (struct wsdisplay_cmap *)data;
cnt = cmap->count;
@@ -921,7 +965,8 @@
break;
}
- hvc->blanked = 0; /* XXX */
+ callout_init(&hvc->unblank_ch);
+ hvc->blanked = 0;
width = bootinfo->fb_width;
height = bootinfo->fb_height;
@@ -1081,22 +1126,49 @@
{
u_int16_t r;
+ callout_stop(&vc->unblank_ch);
+
+ /* turn off display in LCDC */
r = hd64461_reg_read_2(HD64461_LCDLDR1_REG16);
r &= ~HD64461_LCDLDR1_DON;
hd64461_reg_write_2(HD64461_LCDLDR1_REG16, r);
+
+ /* turn off the LCD */
+ config_hook_call(CONFIG_HOOK_POWERCONTROL,
+ CONFIG_HOOK_POWERCONTROL_LCDLIGHT,
+ (void *)0);
}
void
hd64461video_on(struct hd64461video_chip *vc)
{
+ int err;
+
+ /* turn on the LCD */
+ err = config_hook_call(CONFIG_HOOK_POWERCONTROL,
+ CONFIG_HOOK_POWERCONTROL_LCDLIGHT,
+ (void *)1);
+
+ if (err == 0)
+ /* let the LCD warm up before turning on the display */
+ callout_reset(&vc->unblank_ch, hz/2,
+ hd64461video_display_on, vc);
+ else
+ hd64461video_display_on(vc);
+}
+
+void
+hd64461video_display_on(void *arg)
+{
+ /* struct hd64461video_chip *vc = arg; */
u_int16_t r;
+ /* turn on display in LCDC */
r = hd64461_reg_read_2(HD64461_LCDLDR1_REG16);
r |= HD64461_LCDLDR1_DON;
hd64461_reg_write_2(HD64461_LCDLDR1_REG16, r);
}
-
#ifdef HD64461VIDEO_DEBUG
void
hd64461video_info(struct hd64461video_softc *sc)
Home |
Main Index |
Thread Index |
Old Index