Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/macppc/dev Add read/set LCD brightness and eject PC...



details:   https://anonhg.NetBSD.org/src/rev/72160ea04dba
branches:  trunk
changeset: 474605:72160ea04dba
user:      tsubai <tsubai%NetBSD.org@localhost>
date:      Mon Jul 12 15:54:55 1999 +0000

description:
Add read/set LCD brightness and eject PCMCIA card function.

diffstat:

 sys/arch/macppc/dev/pm_direct.c |  62 +++++++++++++++++++++++++++++++++++++++-
 sys/arch/macppc/dev/pm_direct.h |   6 +++-
 2 files changed, 65 insertions(+), 3 deletions(-)

diffs (103 lines):

diff -r 8273e3cf2aa3 -r 72160ea04dba sys/arch/macppc/dev/pm_direct.c
--- a/sys/arch/macppc/dev/pm_direct.c   Mon Jul 12 15:22:18 1999 +0000
+++ b/sys/arch/macppc/dev/pm_direct.c   Mon Jul 12 15:54:55 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pm_direct.c,v 1.6 1999/07/11 16:59:31 tsubai Exp $     */
+/*     $NetBSD: pm_direct.c,v 1.7 1999/07/12 15:54:55 tsubai Exp $     */
 
 /*
  * Copyright (C) 1997 Takashi Hamada
@@ -99,7 +99,7 @@
        0x04, 0x14,   -1, 0x03,   -1,   -1,   -1,   -1,
        0x00, 0x00, 0x02, 0x02,   -1,   -1,   -1,   -1,
        0x01, 0x01,   -1,   -1,   -1,   -1,   -1,   -1,
-       0x00, 0x00,   -1,   -1,   -1,   -1,   -1,   -1,
+       0x00, 0x00,   -1,   -1, 0x01,   -1,   -1,   -1,
        0x01, 0x00, 0x02, 0x02,   -1, 0x01, 0x03, 0x01,
        0x00, 0x01, 0x00, 0x00, 0x00,   -1,   -1,   -1,
        0x02,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
@@ -1214,6 +1214,64 @@
 }
 
 int
+pm_read_brightness()
+{
+       PMData p;
+
+       p.command = PMU_READ_BRIGHTNESS;
+       p.num_data = 1;         /* XXX why 1? */
+       p.s_buf = p.r_buf = p.data;
+       p.data[0] = 0;
+       pmgrop(&p);
+
+       return p.data[0];
+}
+
+void
+pm_set_brightness(val)
+       int val;
+{
+       PMData p;
+
+       val = 0x7f - val / 2;
+       if (val < 0x08)
+               val = 0x08;
+       if (val > 0x78)
+               val = 0x78;
+
+       p.command = PMU_SET_BRIGHTNESS;
+       p.num_data = 1;
+       p.s_buf = p.r_buf = p.data;
+       p.data[0] = val;
+       pmgrop(&p);
+}
+
+void
+pm_init_brightness()
+{
+       int val;
+
+       val = pm_read_brightness();
+       pm_set_brightness(val);
+}
+
+void
+pm_eject_pcmcia(slot)
+       int slot;
+{
+       PMData p;
+
+       if (slot != 0 && slot != 1)
+               return;
+
+       p.command = PMU_EJECT_PCMCIA;
+       p.num_data = 1;
+       p.s_buf = p.r_buf = p.data;
+       p.data[0] = slot * 18;  /* XXX */
+       pmgrop(&p);
+}
+
+int
 pm_read_nvram(addr)
        int addr;
 {
diff -r 8273e3cf2aa3 -r 72160ea04dba sys/arch/macppc/dev/pm_direct.h
--- a/sys/arch/macppc/dev/pm_direct.h   Mon Jul 12 15:22:18 1999 +0000
+++ b/sys/arch/macppc/dev/pm_direct.h   Mon Jul 12 15:54:55 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pm_direct.h,v 1.4 1999/07/11 16:59:31 tsubai Exp $     */
+/*     $NetBSD: pm_direct.h,v 1.5 1999/07/12 15:54:55 tsubai Exp $     */
 
 /*
  * Copyright (C) 1997 Takashi Hamada
@@ -51,6 +51,10 @@
 void pm_set_date_time __P((u_long));
 int pm_read_nvram __P((int));
 void pm_write_nvram __P((int, int));
+int pm_read_brightness __P((void));
+void pm_set_brightness __P((int));
+void pm_init_brightness __P((void));
+void pm_eject_pcmcia __P((int));
 
 /* PMU commands */
 #define PMU_POWER_OFF          0x7e    /* Turn Power off */



Home | Main Index | Thread Index | Old Index