via-pmu: add input device
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 via-pmu: add input device
Almost forgot to make a new patch. Bah. Here it is, also containing the cleanups by Andrew, thanks.
---
This patch adds an input device for the button and lid switch so that userspace gets notified about the user pressing them via the standard input layer.
Signed-off-by Johannes Berg <[email protected]>
drivers/macintosh/Makefile +1 -1
@@ -11,7 +11,7 @@ obj-$(CONFIG_MAC_EMUMOUSEBTN) += mac_hid obj-$(CONFIG_INPUT_ADBHID) += adbhid.o obj-$(CONFIG_ANSLCD) += ans-lcd.o -obj-$(CONFIG_ADB_PMU) += via-pmu.o +obj-$(CONFIG_ADB_PMU) += via-pmu.o via-pmu-event.o obj-$(CONFIG_ADB_PMU_LED) += via-pmu-led.o obj-$(CONFIG_ADB_CUDA) += via-cuda.o obj-$(CONFIG_PMAC_APM_EMU) += apm_emu.o
drivers/macintosh/via-pmu-event.c new file +80 -0
80 lines not on this page · raw message
drivers/macintosh/via-pmu-event.h new file +8 -0
@@ -0,0 +1,8 @@ +#ifndef __VIA_PMU_EVENT_H +#define __VIA_PMU_EVENT_H + +#define PMU_EVT_POWER 0 +#define PMU_EVT_LID 1 +extern void via_pmu_event (int key,int down); + +#endif /* __VIA_PMU_EVENT_H */
drivers/macintosh/via-pmu.c +8 -0
@@ -69,6 +69,8 @@#include <asm/open_pic.h> #endif +#include "via-pmu-event.h" +/* Some compile options */ #undef SUSPEND_USES_PMU#define DEBUG_SLEEP
@@ -1441,6 +1443,12 @@ next:if (pmu_battery_count)query_battery_state ();pmu_pass_intr (data, len); +/* len == 6 is probably a bad check. But how do I +* know what PMU versions send what events here? */ +if (len ==6 ) { +via_pmu_event (PMU_EVT_POWER , !!(data[1 ]&8 )); +via_pmu_event (PMU_EVT_LID , data[1 ]&1 ); + } }else {pmu_pass_intr (data, len); }