via-pmu: add input device
Subsystems (2)
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
New version of this patch.
Should I split it up into two, one for the change to input.h and one for the change in via-pmu?
Ben, what about recognising the PMU here? What else can it report/what else should I pick up? What about older versions?
---
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.
Cc Pavel Machek <[email protected]>
Cc Richard Purdie <[email protected]>
Cc Matthew Garrett <[email protected]>
Cc Benjamin Herrenschmidt <[email protected]>
Cc Dmitry Torokhov <[email protected]>
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 +75 -0
75 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 pmu_event (int key,int down); + +#endif /* __VIA_PMU_EVENT_H */
include/linux/input.h +3 -1
@@ -577,7 +577,9 @@ struct input_absinfo {* Switch events */ -#define SW_0 0x00 +#define SW_LID 0x00 +/* numeric ones should go away */ +#define SW_0 SW_LID#define SW_1 0x01#define SW_2 0x02#define SW_3 0x03
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 ) { +pmu_event (PMU_EVT_POWER , !!(data[1 ]&8 )); +pmu_event (PMU_EVT_LID , data[1 ]&1 ); + } }else {pmu_pass_intr (data, len); }