CHROMIUM: input: Add "inhibited" property for input devices

Under certain circumstances, we want to disable some input devices from
userspace. In particular, when we detect that the lid of a laptop is
closed, we want to be able to disable touchpad and touchscreen to avoid
bogus input.

To facilitate this, we introduce the "inhibited" sysfs property for
input devices. Using this property, userspace can tell a driver that the
events it can provide are not currently of interest and should be
ignored. We provide hooks so that the driver can take additional
actions, such as powering down the device.

We deliberately keep this limited to input devices for now to keep the
implementation as straightforward as possible.

BUG=chromium:391046
TEST=Tested on peppy.
1. evtest /dev/input/input7 &
2. verify that touchpad works
3. echo 1 > /sys/bus/i2c/drivers/cyapa/8-0067/input/input7/inhibited
4. touchpad stops working
5. echo 0 > /sys/bus/i2c/drivers/cyapa/8-0067/input/input7/inhibited
6. touchpad works again

Change-Id: I43a87cb5b52a3a83b375d7fbcf20f792554adb6a
Signed-off-by: Patrik Fimml <patrikf@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/207989
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
Reviewed-by: Benson Leung <bleung@chromium.org>

Conflicts:
	drivers/input/input.c

[rebase49(groeck): Resolved conflicts;
	squashed: "CHROMIUM: input: Revise inhibit interface"
		  "CHROMIUM: Input: fix lockdep complaint"]
Signed-off-by: Guenter Roeck <groeck@chromium.org>

Conflicts:
	include/linux/input.h

[rebase54(groeck): Context conflicts]
Signed-off-by: Guenter Roeck <groeck@chromium.org>
2 files changed