Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/zaurus/dev Allow calling scoop_set_backlight() even...
details: https://anonhg.NetBSD.org/src/rev/f95867015707
branches: trunk
changeset: 773077:f95867015707
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Fri Jan 27 14:48:22 2012 +0000
description:
Allow calling scoop_set_backlight() even before scoop is attached and
schedule initial values in that case as ioexp does. Suggested by nonaka@.
Now lcdctl no longer has to defer lcdctl_set_brightness() by
config_finalize_register(9), which is a bit too late.
(i.e. no backlight during USB/SD probe by config_interrupt(9) in previous)
diffstat:
sys/arch/zaurus/dev/lcdctl.c | 24 ++++++------------------
sys/arch/zaurus/dev/scoop.c | 40 +++++++++++++++++++++-------------------
2 files changed, 27 insertions(+), 37 deletions(-)
diffs (139 lines):
diff -r a03601811128 -r f95867015707 sys/arch/zaurus/dev/lcdctl.c
--- a/sys/arch/zaurus/dev/lcdctl.c Fri Jan 27 14:34:30 2012 +0000
+++ b/sys/arch/zaurus/dev/lcdctl.c Fri Jan 27 14:48:22 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lcdctl.c,v 1.1 2012/01/25 16:51:17 tsutsui Exp $ */
+/* $NetBSD: lcdctl.c,v 1.2 2012/01/27 14:48:22 tsutsui Exp $ */
/*-
* Copyright (C) 2012 NONAKA Kimihiro <nonaka%netbsd.org@localhost>
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lcdctl.c,v 1.1 2012/01/25 16:51:17 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lcdctl.c,v 1.2 2012/01/27 14:48:22 tsutsui Exp $");
#include "ioexp.h"
@@ -79,7 +79,6 @@
CFATTACH_DECL_NEW(lcdctl, sizeof(struct lcdctl_softc),
lcdctl_match, lcdctl_attach, NULL, NULL);
-static int lcdctl_finalize(device_t);
static void lcdctl_brightness_up(device_t);
static void lcdctl_brightness_down(device_t);
static void lcdctl_display_on(device_t);
@@ -119,8 +118,10 @@
sc->sc_nbacklighttbl = __arraycount(lcdctl_backlight_c3000);
sc->sc_backlighttbl = lcdctl_backlight_c3000;
- /* schedule adjustment of LCD brightness after all devices are ready */
- config_finalize_register(self, lcdctl_finalize);
+ /* Start with approximately 40% of full brightness. */
+ lcdctl_set_brightness(sc, 3);
+
+ lcdctl_sc = sc;
if (!pmf_event_register(self, PMFE_DISPLAY_BRIGHTNESS_UP,
lcdctl_brightness_up, true))
@@ -136,19 +137,6 @@
aprint_error_dev(self, "couldn't register event handler\n");
}
-static int
-lcdctl_finalize(device_t dv)
-{
- struct lcdctl_softc *sc = device_private(dv);
-
- /* Start with approximately 40% of full brightness. */
- lcdctl_set_brightness(sc, 3);
-
- lcdctl_sc = sc;
-
- return 0;
-}
-
static void
lcdctl_brightness_up(device_t dv)
{
diff -r a03601811128 -r f95867015707 sys/arch/zaurus/dev/scoop.c
--- a/sys/arch/zaurus/dev/scoop.c Fri Jan 27 14:34:30 2012 +0000
+++ b/sys/arch/zaurus/dev/scoop.c Fri Jan 27 14:48:22 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: scoop.c,v 1.9 2011/07/19 15:11:49 dyoung Exp $ */
+/* $NetBSD: scoop.c,v 1.10 2012/01/27 14:48:22 tsutsui Exp $ */
/* $OpenBSD: zaurus_scoop.c,v 1.12 2005/11/17 05:26:31 uwe Exp $ */
/*
@@ -18,7 +18,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: scoop.c,v 1.9 2011/07/19 15:11:49 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scoop.c,v 1.10 2012/01/27 14:48:22 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -58,6 +58,10 @@
static void scoop_gpio_pin_write(struct scoop_softc *, int, int);
static void scoop_gpio_pin_ctl(struct scoop_softc *, int, int);
+static struct scoop_softc *backlight_sc;
+static uint8_t backlight_on_init = 1;
+static uint8_t backlight_cont_init = 0;
+
enum scoop_card {
SD_CARD,
CF_CARD /* socket 0 (external) */
@@ -108,9 +112,13 @@
if (ZAURUS_ISC3000 && sc->sc_dev->dv_unit == 1) {
scoop_gpio_pin_ctl(sc, SCOOP1_AKIN_PULLUP, GPIO_PIN_OUTPUT);
scoop_gpio_pin_write(sc, SCOOP1_AKIN_PULLUP, GPIO_PIN_LOW);
+ backlight_sc = sc;
+ scoop_set_backlight(backlight_on_init, backlight_cont_init);
} else if (ZAURUS_ISC860) {
scoop_gpio_pin_ctl(sc, SCOOP0_AKIN_PULLUP, GPIO_PIN_OUTPUT);
scoop_gpio_pin_write(sc, SCOOP0_AKIN_PULLUP, GPIO_PIN_LOW);
+ backlight_sc = sc;
+ scoop_set_backlight(backlight_on_init, backlight_cont_init);
}
}
@@ -161,25 +169,19 @@
void
scoop_set_backlight(int on, int cont)
{
- struct scoop_softc *sc;
-#if 0
- struct scoop_softc *sc0;
-
- sc0 = device_lookup_private(&scoop_cd, 0);
-#endif
+ struct scoop_softc *sc = backlight_sc;
- sc = device_lookup_private(&scoop_cd, 1);
- if (sc != NULL) {
- /* C3000 */
- scoop_gpio_pin_write(sc, SCOOP1_BACKLIGHT_CONT, !cont);
- scoop_gpio_pin_write(sc, SCOOP1_BACKLIGHT_ON, on);
+ if (sc == NULL) {
+ backlight_cont_init = cont;
+ backlight_on_init = on;
+ } else {
+ if (ZAURUS_ISC3000) {
+ scoop_gpio_pin_write(sc, SCOOP1_BACKLIGHT_CONT, !cont);
+ scoop_gpio_pin_write(sc, SCOOP1_BACKLIGHT_ON, on);
+ } else if (ZAURUS_ISC860) {
+ scoop_gpio_pin_write(sc, SCOOP0_BACKLIGHT_CONT, cont);
+ }
}
-#if 0
- else if (sc0 != NULL) {
- scoop_gpio_pin_write(sc0,
- SCOOP0_BACKLIGHT_CONT, cont);
- }
-#endif
}
/*
Home |
Main Index |
Thread Index |
Old Index