diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2004-05-10 09:05:53 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2004-05-10 09:05:53 +0000 |
commit | b2de25f1ae98d6dec4e2cdb1a364c395ba22b03a (patch) | |
tree | 5b288e092e9e31a7f782cbbd5e64d3479266c757 /sys | |
parent | cf95fddb632f317b2e0ee6fab22a0528aa387a3b (diff) |
When external power is not available, the tadpole video hardware gets
stuck in a weird mode, where not all acceleration functions are
available, and I could not figure out how to reset the chip strongly
enough to leave this mode.
Try to compensate by checking whether the external power has been removed,
when we set up the accelerated rasops (this will not cope with power being
removed after bootup, yet).
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/sparc/dev/p9000.c | 17 | ||||
-rw-r--r-- | sys/arch/sparc/dev/p9100.c | 20 | ||||
-rw-r--r-- | sys/arch/sparc/dev/tctrl.c | 45 | ||||
-rw-r--r-- | sys/arch/sparc/dev/tctrlvar.h | 12 |
4 files changed, 64 insertions, 30 deletions
diff --git a/sys/arch/sparc/dev/p9000.c b/sys/arch/sparc/dev/p9000.c index df0bcb274a6..5b95402a206 100644 --- a/sys/arch/sparc/dev/p9000.c +++ b/sys/arch/sparc/dev/p9000.c @@ -1,4 +1,4 @@ -/* $OpenBSD: p9000.c,v 1.6 2004/03/09 22:59:09 miod Exp $ */ +/* $OpenBSD: p9000.c,v 1.7 2004/05/10 09:05:52 miod Exp $ */ /* * Copyright (c) 2003, Miodrag Vallat. @@ -281,11 +281,6 @@ p9000attach(struct device *parent, struct device *self, void *args) /* * Plug-in accelerated console operations. */ - sc->sc_sunfb.sf_ro.ri_ops.copycols = p9000_ras_copycols; - sc->sc_sunfb.sf_ro.ri_ops.copyrows = p9000_ras_copyrows; - sc->sc_sunfb.sf_ro.ri_ops.erasecols = p9000_ras_erasecols; - sc->sc_sunfb.sf_ro.ri_ops.eraserows = p9000_ras_eraserows; - sc->sc_sunfb.sf_ro.ri_do_cursor = p9000_ras_do_cursor; p9000_ras_init(sc); p9000_stdscreen.capabilities = sc->sc_sunfb.sf_ro.ri_caps; @@ -379,7 +374,7 @@ p9000_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p) case WSDISPLAYIO_PARAM_BACKLIGHT: dp->min = 0; dp->max = 1; - dp->curval = tadpole_get_video(); + dp->curval = tadpole_get_video() & TV_ON; break; default: return (-1); @@ -557,6 +552,14 @@ p9000_drain(struct p9000_softc *sc) void p9000_ras_init(struct p9000_softc *sc) { + sc->sc_sunfb.sf_ro.ri_ops.copycols = p9000_ras_copycols; + sc->sc_sunfb.sf_ro.ri_ops.copyrows = p9000_ras_copyrows; + if (tadpole_get_video() & TV_ACCEL) { + sc->sc_sunfb.sf_ro.ri_ops.erasecols = p9000_ras_erasecols; + sc->sc_sunfb.sf_ro.ri_ops.eraserows = p9000_ras_eraserows; + sc->sc_sunfb.sf_ro.ri_do_cursor = p9000_ras_do_cursor; + } + /* * Setup safe defaults for the parameter and drawing engines, in * order to minimize the operations to do for ri_ops. diff --git a/sys/arch/sparc/dev/p9100.c b/sys/arch/sparc/dev/p9100.c index fca5eb2051a..622bd7eca2e 100644 --- a/sys/arch/sparc/dev/p9100.c +++ b/sys/arch/sparc/dev/p9100.c @@ -1,4 +1,4 @@ -/* $OpenBSD: p9100.c,v 1.27 2004/03/09 22:59:09 miod Exp $ */ +/* $OpenBSD: p9100.c,v 1.28 2004/05/10 09:05:52 miod Exp $ */ /* * Copyright (c) 2003, Miodrag Vallat. @@ -323,14 +323,8 @@ p9100attach(struct device *parent, struct device *self, void *args) /* * Plug-in accelerated console operations if we can. */ - if (sc->sc_sunfb.sf_depth == 8) { - sc->sc_sunfb.sf_ro.ri_ops.copycols = p9100_ras_copycols; - sc->sc_sunfb.sf_ro.ri_ops.copyrows = p9100_ras_copyrows; - sc->sc_sunfb.sf_ro.ri_ops.erasecols = p9100_ras_erasecols; - sc->sc_sunfb.sf_ro.ri_ops.eraserows = p9100_ras_eraserows; - sc->sc_sunfb.sf_ro.ri_do_cursor = p9100_ras_do_cursor; + if (sc->sc_sunfb.sf_depth == 8) p9100_ras_init(sc); - } p9100_stdscreen.capabilities = sc->sc_sunfb.sf_ro.ri_caps; p9100_stdscreen.nrows = sc->sc_sunfb.sf_ro.ri_rows; @@ -424,7 +418,7 @@ p9100_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p) case WSDISPLAYIO_PARAM_BACKLIGHT: dp->min = 0; dp->max = 1; - dp->curval = tadpole_get_video(); + dp->curval = tadpole_get_video() & TV_ON; break; default: return (-1); @@ -612,6 +606,14 @@ p9100_drain(struct p9100_softc *sc) void p9100_ras_init(struct p9100_softc *sc) { + sc->sc_sunfb.sf_ro.ri_ops.copycols = p9100_ras_copycols; + sc->sc_sunfb.sf_ro.ri_ops.copyrows = p9100_ras_copyrows; + if (tadpole_get_video() & TV_ACCEL) { + sc->sc_sunfb.sf_ro.ri_ops.erasecols = p9100_ras_erasecols; + sc->sc_sunfb.sf_ro.ri_ops.eraserows = p9100_ras_eraserows; + sc->sc_sunfb.sf_ro.ri_do_cursor = p9100_ras_do_cursor; + } + /* * Setup safe defaults for the parameter and drawing engines, in * order to minimize the operations to do for ri_ops. diff --git a/sys/arch/sparc/dev/tctrl.c b/sys/arch/sparc/dev/tctrl.c index 576ce9819cb..fbdeddb00db 100644 --- a/sys/arch/sparc/dev/tctrl.c +++ b/sys/arch/sparc/dev/tctrl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tctrl.c,v 1.5 2003/05/16 18:40:32 miod Exp $ */ +/* $OpenBSD: tctrl.c,v 1.6 2004/05/10 09:05:52 miod Exp $ */ /* $NetBSD: tctrl.c,v 1.2 1999/08/11 00:46:06 matt Exp $ */ /*- @@ -79,6 +79,7 @@ struct tctrl_softc { int sc_node; unsigned int sc_junk; unsigned int sc_ext_status; + unsigned int sc_video_accel; unsigned int sc_pending; #define TCTRL_SEND_BITPORT 0x0001 #define TCTRL_SEND_POWEROFF 0x0002 @@ -214,6 +215,8 @@ tctrl_attach(parent, self, aux) /* * Get a few status values. */ + sc->sc_video_accel = + sc->sc_ext_status & TS102_EXT_STATUS_MAIN_POWER_AVAILABLE; sc->sc_pending |= TCTRL_SEND_BITPORT_NOP; do { tctrl_intr(sc); @@ -407,7 +410,24 @@ tctrl_process_response(struct tctrl_softc *sc) { switch (sc->sc_op) { case TS102_OP_RD_EXT_STATUS: { + unsigned int status = sc->sc_ext_status; sc->sc_ext_status = sc->sc_rspbuf[0] * 256 + sc->sc_rspbuf[1]; + status ^= sc->sc_ext_status; + if (status & TS102_EXT_STATUS_MAIN_POWER_AVAILABLE) { + printf("%s: main power %s\n", sc->sc_dev.dv_xname, + (sc->sc_ext_status & TS102_EXT_STATUS_MAIN_POWER_AVAILABLE) ? + "restored" : "removed"); + + /* XXX reset video */ + sc->sc_video_accel = 0; + } +#if 0 + if (status & TS102_EXT_STATUS_LID_DOWN) { + printf("%s: lid %s\n", sc->sc_dev.dv_xname, + (sc->sc_ext_status & TS102_EXT_STATUS_LID_DOWN) ? + "closed" : "opened"); + } +#endif break; } case TS102_OP_RD_EVENT_STATUS: { @@ -415,24 +435,21 @@ tctrl_process_response(struct tctrl_softc *sc) if (v & TS102_EVENT_STATUS_SHUTDOWN_REQUEST) { printf("%s: SHUTDOWN REQUEST!\n", sc->sc_dev.dv_xname); } +#if 0 +/* Obviously status change */ if (v & TS102_EVENT_STATUS_VERY_LOW_POWER_WARNING) { printf("%s: VERY LOW POWER WARNING!\n", sc->sc_dev.dv_xname); } +#endif if (v & TS102_EVENT_STATUS_LOW_POWER_WARNING) { printf("%s: LOW POWER WARNING!\n", sc->sc_dev.dv_xname); } if (v & TS102_EVENT_STATUS_DC_STATUS_CHANGE) { sc->sc_pending |= TCTRL_SEND_RD_EXT_STATUS; - printf("%s: main power %s\n", sc->sc_dev.dv_xname, - (sc->sc_ext_status & TS102_EXT_STATUS_MAIN_POWER_AVAILABLE) ? "removed" : "restored"); } if (v & TS102_EVENT_STATUS_LID_STATUS_CHANGE) { sc->sc_pending |= TCTRL_SEND_RD_EXT_STATUS; sc->sc_pending |= TCTRL_SEND_BITPORT; -#if 0 - printf("%s: lid %s\n", sc->sc_dev.dv_xname, - (sc->sc_ext_status & TS102_EXT_STATUS_LID_DOWN) ? "opened" : "closed"); -#endif } break; } @@ -519,7 +536,7 @@ tadpole_set_video(int enabled) sc = (struct tctrl_softc *) tctrl_cd.cd_devs[0]; s = splhigh(); - if ((sc->sc_tft_on && !enabled) || (!sc->sc_tft_on && enabled)) { + if (sc->sc_tft_on ^ enabled) { sc->sc_tft_on = enabled; if (sc->sc_ext_status & TS102_EXT_STATUS_LID_DOWN) { splx(s); @@ -531,10 +548,11 @@ tadpole_set_video(int enabled) splx(s); } -int +unsigned int tadpole_get_video() { struct tctrl_softc *sc; + unsigned int status; if (tctrl_cd.cd_devs == NULL || tctrl_cd.cd_ndevs == 0 @@ -543,7 +561,14 @@ tadpole_get_video() } sc = (struct tctrl_softc *) tctrl_cd.cd_devs[0]; - return sc->sc_tft_on; + status = 0; + + if (sc->sc_tft_on) + status |= TV_ON; + if (sc->sc_video_accel) + status |= TV_ACCEL; + + return status; } void diff --git a/sys/arch/sparc/dev/tctrlvar.h b/sys/arch/sparc/dev/tctrlvar.h index 74780e8476b..984cbe9dbc2 100644 --- a/sys/arch/sparc/dev/tctrlvar.h +++ b/sys/arch/sparc/dev/tctrlvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tctrlvar.h,v 1.2 2003/05/16 18:40:32 miod Exp $ */ +/* $OpenBSD: tctrlvar.h,v 1.3 2004/05/10 09:05:52 miod Exp $ */ /* $NetBSD: tctrlvar.h,v 1.1 1999/08/09 18:39:58 matt Exp $ */ /*- @@ -41,8 +41,12 @@ void tadpole_powerdown(void); int tadpole_get_brightness(void); -int tadpole_get_video(void); -void tadpole_set_brightness(int value); -void tadpole_set_video(int enabled); +unsigned int tadpole_get_video(void); +void tadpole_set_brightness(int); +void tadpole_set_video(int); + +/* Values for get_video */ +#define TV_ON 0x01 +#define TV_ACCEL 0x02 #endif /* _SPARC_DEV_TCTRLVAR_H */ |