Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/hpcarm/dev Move sed1356_softc definition to a heade...



details:   https://anonhg.NetBSD.org/src/rev/2fe31ef7f047
branches:  trunk
changeset: 511627:2fe31ef7f047
user:      toshii <toshii%NetBSD.org@localhost>
date:      Sat Jun 23 09:13:06 2001 +0000

description:
Move sed1356_softc definition to a header file.  Setup a backlight
power control hook.

diffstat:

 sys/arch/hpcarm/dev/sed1356var.h |  68 ++++++++++++++++++++++++++++++++++++++++
 sys/arch/hpcarm/dev/sed_saip.c   |  51 ++++++++++++-----------------
 2 files changed, 90 insertions(+), 29 deletions(-)

diffs (181 lines):

diff -r f6e052dced9c -r 2fe31ef7f047 sys/arch/hpcarm/dev/sed1356var.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/hpcarm/dev/sed1356var.h  Sat Jun 23 09:13:06 2001 +0000
@@ -0,0 +1,68 @@
+/*     $NetBSD: sed1356var.h,v 1.1 2001/06/23 09:13:06 toshii Exp $    */
+
+/*-
+ * Copyright (c) 1999-2001
+ *         Shin Takemura and PocketBSD Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the PocketBSD project
+ *     and its contributors.
+ * 4. Neither the name of the project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#include <dev/hpc/hpcfbio.h>
+
+struct sed1356_softc {
+       struct device           sc_dev;
+       bus_space_tag_t         sc_iot;
+       bus_space_handle_t      sc_regh;
+       struct sa11x0_softc     *sc_parent;
+
+       struct hpcfb_fbconf     sc_fbconf;
+       struct hpcfb_dspconf    sc_dspconf;
+
+       void                    *sc_powerhook;  /* power management hook */
+       int                     sc_powerstate;
+#define PWRSTAT_SUSPEND                (1<<0)
+#define PWRSTAT_VIDEOOFF       (1<<1)
+#define PWRSTAT_LCD            (1<<2)
+#define PWRSTAT_BACKLIGHT      (1<<3)
+#define PWRSTAT_ALL            (0xffffffff)
+       int                     sc_lcd_inited;
+#define BACKLIGHT_INITED       (1<<0)
+#define BRIGHTNESS_INITED      (1<<1)
+#define CONTRAST_INITED                (1<<2)
+       int                     sc_brightness;
+       int                     sc_brightness_save;
+       int                     sc_max_brightness;
+       int                     sc_contrast;
+       int                     sc_max_contrast;
+
+};
+
+void   sed1356_init_brightness(struct sed1356_softc *, int);
+void   sed1356_init_contrast(struct sed1356_softc *, int);
diff -r f6e052dced9c -r 2fe31ef7f047 sys/arch/hpcarm/dev/sed_saip.c
--- a/sys/arch/hpcarm/dev/sed_saip.c    Sat Jun 23 08:38:43 2001 +0000
+++ b/sys/arch/hpcarm/dev/sed_saip.c    Sat Jun 23 09:13:06 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sed_saip.c,v 1.3 2001/06/22 14:38:44 toshii Exp $      */
+/*     $NetBSD: sed_saip.c,v 1.4 2001/06/23 09:13:06 toshii Exp $      */
 
 /*-
  * Copyright (c) 1999-2001
@@ -33,11 +33,6 @@
  * SUCH DAMAGE.
  *
  */
-#define FBDEBUG
-static const char _copyright[] __attribute__ ((unused)) =
-    "Copyright (c) 1999 Shin Takemura.  All rights reserved.";
-static const char _rcsid[] __attribute__ ((unused)) =
-    "$NetBSD: sed_saip.c,v 1.3 2001/06/22 14:38:44 toshii Exp $";
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -51,6 +46,8 @@
 #include <machine/bus.h>
 #include <machine/bootinfo.h>
 #include <machine/config_hook.h>
+#include <machine/platid.h>
+#include <machine/platid_mask.h>
 
 #include <dev/wscons/wsconsio.h>
 #include <dev/wscons/wsdisplayvar.h>
@@ -61,6 +58,8 @@
 #include <dev/hpc/hpcfbio.h>
 #include <dev/hpc/hpccmapvar.h>
 
+#include <arch/hpcarm/dev/sed1356var.h>
+
 #define VPRINTF(arg)   do { if (bootverbose) printf arg; } while(0);
 
 /*
@@ -71,31 +70,9 @@
 int    sed1356_ioctl(void *, u_long, caddr_t, int, struct proc *);
 paddr_t        sed1356_mmap(void *, off_t, int);
 
-struct sed1356_softc {
-       struct device           sc_dev;
-       struct hpcfb_fbconf     sc_fbconf;
-       struct hpcfb_dspconf    sc_dspconf;
-
-       void                    *sc_powerhook;  /* power management hook */
-       int                     sc_powerstate;
-#define PWRSTAT_SUSPEND                (1<<0)
-#define PWRSTAT_VIDEOOFF       (1<<1)
-#define PWRSTAT_LCD            (1<<2)
-#define PWRSTAT_BACKLIGHT      (1<<3)
-#define PWRSTAT_ALL            (0xffffffff)
-       int                     sc_lcd_inited;
-#define BACKLIGHT_INITED       (1<<0)
-#define BRIGHTNESS_INITED      (1<<1)
-#define CONTRAST_INITED                (1<<2)
-       int                     sc_brightness;
-       int                     sc_brightness_save;
-       int                     sc_max_brightness;
-       int                     sc_contrast;
-       int                     sc_max_contrast;
-
-};
 
 extern struct bus_space sa11x0_bs_tag;
+extern int j720lcdpower(void *, int, long, void *);    /* XXX */
 
 static int sed1356_init(struct hpcfb_fbconf *);
 static void sed1356_power(int, void *);
@@ -153,6 +130,14 @@
                return;
        }
 
+       sc->sc_iot = &sa11x0_bs_tag;
+       sc->sc_parent = (struct sa11x0_softc *)parent;
+       if (bus_space_map(sc->sc_iot, (bus_addr_t)bootinfo->fb_addr & ~0x3fffff,
+                         0x200, 0, &sc->sc_regh)) {
+               printf("%s: unable to map register\n", sc->sc_dev.dv_xname);
+               return;
+       }
+
        printf("%s: Epson SED1356", sc->sc_dev.dv_xname);
        if (console_flag) {
                printf(", console");
@@ -184,6 +169,13 @@
        ha.ha_ndspconf = 1;
        ha.ha_dspconflist = &sc->sc_dspconf;
 
+       /* XXX */
+       if (platid_match(&platid, &platid_mask_MACH_HP_JORNADA_7XX)) {
+               config_hook(CONFIG_HOOK_POWERCONTROL,
+                           CONFIG_HOOK_POWERCONTROL_LCDLIGHT,
+                           CONFIG_HOOK_SHARE, j720lcdpower, sc);
+       }
+
        config_found(self, &ha, hpcfbprint);
 }
 
@@ -221,6 +213,7 @@
                                        /* configuration name           */
        fb->hf_height           = bootinfo->fb_height;
        fb->hf_width            = bootinfo->fb_width;
+
        if (bus_space_map(&sa11x0_bs_tag, (bus_addr_t)bootinfo->fb_addr,
                           bootinfo->fb_height * bootinfo->fb_line_bytes,
                           0, &fb->hf_baseaddr)) {



Home | Main Index | Thread Index | Old Index