-/* $OpenBSD: adb.c,v 1.50 2023/04/11 00:45:07 jsg Exp $ */
+/* $OpenBSD: adb.c,v 1.51 2023/11/22 18:14:35 tobhe Exp $ */
/* $NetBSD: adb.c,v 1.6 1999/08/16 06:28:09 tsubai Exp $ */
/* $NetBSD: adb_direct.c,v 1.14 2000/06/08 22:10:45 tsubai Exp $ */
#include <machine/autoconf.h>
#include <machine/cpu.h>
#include <dev/ofw/openfirm.h>
+#include <dev/wscons/wsconsio.h>
#include <dev/adb/adb.h>
#include <macppc/dev/adbvar.h>
int adb_intr(void *arg);
void adb_cuda_autopoll(void);
void adb_cuda_fileserver_mode(void);
+uint8_t pmu_backlight; /* keyboard backlight value */
+int pmu_get_backlight(struct wskbd_backlight *);
+int pmu_set_backlight(struct wskbd_backlight *);
+extern int (*wskbd_get_backlight)(struct wskbd_backlight *);
+extern int (*wskbd_set_backlight)(struct wskbd_backlight *);
+
#ifndef SMALL_KERNEL
void adb_shutdown(void *);
if (adbHardware == ADB_HW_CUDA)
adb_cuda_fileserver_mode();
- if (adbHardware == ADB_HW_PMU)
+ if (adbHardware == ADB_HW_PMU) {
+ wskbd_get_backlight = pmu_get_backlight;
+ wskbd_set_backlight = pmu_set_backlight;
pmu_fileserver_mode(1);
+ }
/*
* XXX If the machine doesn't have an ADB bus (PowerBook5,6+)
adb_cuda_autopoll();
adb_polling = 0;
}
+
+int
+pmu_get_backlight(struct wskbd_backlight *kbl)
+{
+ kbl->min = 0;
+ kbl->max = 0xff;
+ kbl->curval = pmu_backlight;
+ return 0;
+}
+
+int
+pmu_set_backlight(struct wskbd_backlight *kbl)
+{
+ pmu_backlight = kbl->curval;
+ return pmu_set_kbl(pmu_backlight);
+}
-/* $OpenBSD: pm_direct.c,v 1.34 2022/12/28 07:40:23 jca Exp $ */
+/* $OpenBSD: pm_direct.c,v 1.35 2023/11/22 18:14:35 tobhe Exp $ */
/* $NetBSD: pm_direct.c,v 1.9 2000/06/08 22:10:46 tsubai Exp $ */
/*
}
pmgrop(&p);
}
+
+int
+pmu_set_kbl(unsigned int level)
+{
+ if (level > 0xff)
+ return (EINVAL);
+
+ PMData p;
+
+ p.command = 0x4F;
+ p.num_data = 3;
+ p.s_buf = p.r_buf = p.data;
+ p.data[0] = 0;
+ p.data[1] = 0;
+ p.data[2] = level;
+ pmgrop(&p);
+ return (0);
+}
+
-/* $OpenBSD: pm_direct.h,v 1.15 2022/10/21 22:42:36 gkoehler Exp $ */
+/* $OpenBSD: pm_direct.h,v 1.16 2023/11/22 18:14:35 tobhe Exp $ */
/* $NetBSD: pm_direct.h,v 1.7 2005/01/07 04:59:58 briggs Exp $ */
/*
};
int pm_battery_info(int, struct pmu_battery_info *);
+int pmu_set_kbl(unsigned int);
void pm_eject_pcmcia(int);
void pmu_fileserver_mode(int);