Stylus: merge kernel code of detecting pen
Leavitt Zhang [Mon, 25 Nov 2013 05:37:27 +0000 (13:37 +0800)]
Add 2 gpio keys for tn8 only.
Separate tn8 dt files from e1780.
------------------------------
commit 4012682d01e5c7538ccf9b259547d082b62aafe9
Author: Youngjin Kim <nkim@nvidia.com>
    Change stylus pen detect hall sensor GPIO for P1640-A01 revision.
    Change-Id: I50549fd168a03946e3370e6d23d61203e299d0d6
    Reviewed-on: http://git-master/r/237187

commit ad89dd3f769058560a5e5576c503cbd5af954a8d
Author: Youngjin Kim <nkim@nvidia.com>
    ARM: tegra: tegratab: add lid and pen detect switch support
    Change-Id: Idd0bc903354970352b0f451595249d1209569924
    Reviewed-on: http://git-master/r/224883
------------------------------

Bug 1380492

Change-Id: I9aa85424359a05b4cafbaa157b668c56e4430f97
Signed-off-by: Leavitt Zhang <leavittz@nvidia.com>
Reviewed-on: http://git-master/r/336063
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit

13 files changed:
arch/arm/boot/dts/tegra124-platforms/tegra124-tn8-keys.dtsi [new file with mode: 0644]
arch/arm/boot/dts/tegra124-tn8-a03-00-battery.dts
arch/arm/boot/dts/tegra124-tn8-a03-00.dts
arch/arm/boot/dts/tegra124-tn8-a03-01-battery.dts
arch/arm/boot/dts/tegra124-tn8-a03-01.dts
arch/arm/boot/dts/tegra124-tn8-aio.dts
arch/arm/boot/dts/tegra124-tn8-battery.dts
arch/arm/boot/dts/tegra124-tn8-p1761-2gb.dts
arch/arm/boot/dts/tegra124-tn8-p1761-battery-2gb.dts
arch/arm/boot/dts/tegra124-tn8-p1761-battery.dts
arch/arm/boot/dts/tegra124-tn8-p1761.dts
arch/arm/boot/dts/tegra124-tn8.dts
include/dt-bindings/input/input.h

diff --git a/arch/arm/boot/dts/tegra124-platforms/tegra124-tn8-keys.dtsi b/arch/arm/boot/dts/tegra124-platforms/tegra124-tn8-keys.dtsi
new file mode 100644 (file)
index 0000000..9d2266c
--- /dev/null
@@ -0,0 +1,55 @@
+#include <dt-bindings/gpio/tegra-gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+       gpio-keys {
+               compatible = "gpio-keys";
+
+               camera_focus {
+                       label = "Camera Focus";
+                       gpios = <&gpio TEGRA_GPIO(Q, 2) GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_CAMERA_FOCUS>;
+               };
+
+               home {
+                       label = "Home";
+                       gpios = <&gpio TEGRA_GPIO(I, 5) GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_HOME>;
+               };
+
+               power {
+                       label = "Power";
+                       gpios = <&gpio TEGRA_GPIO(Q, 0) GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_POWER>;
+                       gpio-key,wakeup;
+               };
+
+               volume_down {
+                       label = "Volume Down";
+                       gpios = <&gpio TEGRA_GPIO(Q, 7) GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_VOLUMEDOWN>;
+               };
+
+               volume_up {
+                       label = "Volume Up";
+                       gpios = <&gpio TEGRA_GPIO(Q, 6) GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_VOLUMEUP>;
+               };
+
+               lid {
+                       label = "LID";
+                       gpios = <&gpio TEGRA_GPIO(R, 4) GPIO_ACTIVE_LOW>;
+                       linux,code = <SW_LID>;
+                       linux,input-type = <EV_SW>;
+                       gpio-key,wakeup;
+               };
+
+               tablet_mode {
+                       label = "Tablet Mode";
+                       gpios = <&gpio TEGRA_GPIO(W, 3) GPIO_ACTIVE_HIGH>;
+                       linux,code = <SW_TABLET_MODE>;
+                       linux,input-type = <EV_SW>;
+                       gpio-key,wakeup;
+               };
+       };
+};
index 84dd919..3840d94 100644 (file)
@@ -7,7 +7,7 @@
 #include "tegra124-platforms/tegra124-tn8-e1736-fixed.dtsi"
 #include "tegra124-platforms/tegra124-e1780-gpio-default.dtsi"
 #include "tegra124-platforms/tegra124-e1780-pinmux.dtsi"
-#include "tegra124-platforms/tegra124-e1780-keys.dtsi"
+#include "tegra124-platforms/tegra124-tn8-keys.dtsi"
 #include "tegra124-platforms/tegra124-e1845-senosr.dtsi"
 #include "tegra124-platforms/tegra124-tn8-sysedp.dtsi"
 
index b9111f0..b85849e 100644 (file)
@@ -26,7 +26,7 @@
 #include "tegra124-platforms/tegra124-tn8-e1736-fixed.dtsi"
 #include "tegra124-platforms/tegra124-e1780-gpio-default.dtsi"
 #include "tegra124-platforms/tegra124-e1780-pinmux.dtsi"
-#include "tegra124-platforms/tegra124-e1780-keys.dtsi"
+#include "tegra124-platforms/tegra124-tn8-keys.dtsi"
 #include "tegra124-platforms/tegra124-e1845-senosr.dtsi"
 #include "panel-l-wxga-7.dtsi"
 #include "tegra124-platforms/tegra124-tn8-hdmi.dtsi"
index 51f6adc..8868591 100644 (file)
@@ -7,7 +7,7 @@
 #include "tegra124-platforms/tegra124-tn8-e1769-fixed.dtsi"
 #include "tegra124-platforms/tegra124-e1780-gpio-default.dtsi"
 #include "tegra124-platforms/tegra124-e1780-pinmux.dtsi"
-#include "tegra124-platforms/tegra124-e1780-keys.dtsi"
+#include "tegra124-platforms/tegra124-tn8-keys.dtsi"
 #include "tegra124-platforms/tegra124-tn8-sysedp.dtsi"
 
 / {
index 4672d3b..292f604 100644 (file)
@@ -26,7 +26,7 @@
 #include "tegra124-platforms/tegra124-tn8-e1769-fixed.dtsi"
 #include "tegra124-platforms/tegra124-e1780-gpio-default.dtsi"
 #include "tegra124-platforms/tegra124-e1780-pinmux.dtsi"
-#include "tegra124-platforms/tegra124-e1780-keys.dtsi"
+#include "tegra124-platforms/tegra124-tn8-keys.dtsi"
 #include "tegra124-platforms/tegra124-e1845-senosr.dtsi"
 #include "panel-l-wxga-7.dtsi"
 #include "tegra124-platforms/tegra124-tn8-hdmi.dtsi"
index 26cfbb4..9dca3d2 100644 (file)
@@ -7,7 +7,7 @@
 #include "tegra124-platforms/tegra124-tn8-e1736-fixed.dtsi"
 #include "tegra124-platforms/tegra124-e1780-gpio-default.dtsi"
 #include "tegra124-platforms/tegra124-e1780-pinmux.dtsi"
-#include "tegra124-platforms/tegra124-e1780-keys.dtsi"
+#include "tegra124-platforms/tegra124-tn8-keys.dtsi"
 #include "tegra124-platforms/tegra124-e1794-sensor.dtsi"
 
 / {
index f1f4ef2..a202f53 100644 (file)
@@ -7,7 +7,7 @@
 #include "tegra124-platforms/tegra124-tn8-e1736-fixed.dtsi"
 #include "tegra124-platforms/tegra124-e1780-gpio-default.dtsi"
 #include "tegra124-platforms/tegra124-e1780-pinmux.dtsi"
-#include "tegra124-platforms/tegra124-e1780-keys.dtsi"
+#include "tegra124-platforms/tegra124-tn8-keys.dtsi"
 #include "tegra124-platforms/tegra124-e1794-sensor.dtsi"
 #include "tegra124-platforms/tegra124-tn8-sysedp.dtsi"
 
index de1e1cd..60259df 100644 (file)
@@ -8,7 +8,7 @@
 #include "tegra124-platforms/tegra124-tn8-sensors.dtsi"
 #include "tegra124-platforms/tegra124-p1761-pinmux.dtsi"
 #include "tegra124-platforms/tegra124-p1761-gpio-default.dtsi"
-#include "tegra124-platforms/tegra124-e1780-keys.dtsi"
+#include "tegra124-platforms/tegra124-tn8-keys.dtsi"
 
 / {
        model = "NVIDIA Tegra124 TN8 FFD";
index 8483e67..f4e0f93 100644 (file)
@@ -8,7 +8,7 @@
 #include "tegra124-platforms/tegra124-tn8-sensors.dtsi"
 #include "tegra124-platforms/tegra124-p1761-pinmux.dtsi"
 #include "tegra124-platforms/tegra124-p1761-gpio-default.dtsi"
-#include "tegra124-platforms/tegra124-e1780-keys.dtsi"
+#include "tegra124-platforms/tegra124-tn8-keys.dtsi"
 
 / {
        model = "NVIDIA Tegra124 TN8 FFD";
index c8bf9dd..4ef1376 100644 (file)
@@ -8,7 +8,7 @@
 #include "tegra124-platforms/tegra124-tn8-sensors.dtsi"
 #include "tegra124-platforms/tegra124-p1761-pinmux.dtsi"
 #include "tegra124-platforms/tegra124-p1761-gpio-default.dtsi"
-#include "tegra124-platforms/tegra124-e1780-keys.dtsi"
+#include "tegra124-platforms/tegra124-tn8-keys.dtsi"
 #include "tegra124-platforms/tegra124-tn8-sysedp.dtsi"
 
 / {
index de1a08d..81be87f 100644 (file)
@@ -8,7 +8,7 @@
 #include "tegra124-platforms/tegra124-tn8-sensors.dtsi"
 #include "tegra124-platforms/tegra124-p1761-pinmux.dtsi"
 #include "tegra124-platforms/tegra124-p1761-gpio-default.dtsi"
-#include "tegra124-platforms/tegra124-e1780-keys.dtsi"
+#include "tegra124-platforms/tegra124-tn8-keys.dtsi"
 
 / {
        model = "NVIDIA Tegra124 TN8 FFD";
index 1174482..3c53f5c 100644 (file)
@@ -7,7 +7,7 @@
 #include "tegra124-platforms/tegra124-tn8-e1736-fixed.dtsi"
 #include "tegra124-platforms/tegra124-e1780-gpio-default.dtsi"
 #include "tegra124-platforms/tegra124-e1780-pinmux.dtsi"
-#include "tegra124-platforms/tegra124-e1780-keys.dtsi"
+#include "tegra124-platforms/tegra124-tn8-keys.dtsi"
 #include "tegra124-platforms/tegra124-e1794-sensor.dtsi"
 
 / {
index 042e7b3..b5a94e1 100644 (file)
 #define BTN_DPAD_LEFT          0x222
 #define BTN_DPAD_RIGHT         0x223
 
+/*
+ * Event types
+ */
+
+#define EV_SYN                 0x00
+#define EV_KEY                 0x01
+#define EV_REL                 0x02
+#define EV_ABS                 0x03
+#define EV_MSC                 0x04
+#define EV_SW                  0x05
+#define EV_LED                 0x11
+#define EV_SND                 0x12
+#define EV_REP                 0x14
+#define EV_FF                  0x15
+#define EV_PWR                 0x16
+#define EV_FF_STATUS           0x17
+#define EV_MAX                 0x1f
+#define EV_CNT                 (EV_MAX+1)
+
+/*
+ * Switch events
+ */
+
+#define SW_LID                 0x00  /* set = lid shut */
+#define SW_TABLET_MODE         0x01  /* set = tablet mode */
+#define SW_HEADPHONE_INSERT    0x02  /* set = inserted */
+#define SW_RFKILL_ALL          0x03  /* rfkill master switch, type "any"
+                                        set = radio enabled */
+#define SW_RADIO               SW_RFKILL_ALL   /* deprecated */
+#define SW_MICROPHONE_INSERT   0x04  /* set = inserted */
+#define SW_DOCK                        0x05  /* set = plugged into dock */
+#define SW_LINEOUT_INSERT      0x06  /* set = inserted */
+#define SW_JACK_PHYSICAL_INSERT 0x07  /* set = mechanical switch set */
+#define SW_VIDEOOUT_INSERT     0x08  /* set = inserted */
+#define SW_CAMERA_LENS_COVER   0x09  /* set = lens covered */
+#define SW_KEYPAD_SLIDE                0x0a  /* set = keypad slide out */
+#define SW_FRONT_PROXIMITY     0x0b  /* set = front proximity sensor active */
+#define SW_ROTATE_LOCK         0x0c  /* set = rotate locked/disabled */
+#define SW_LINEIN_INSERT       0x0d  /* set = inserted */
+#define SW_MAX                 0x0f
+#define SW_CNT                 (SW_MAX+1)
+
 #define MATRIX_KEY(row, col, code)     \
        ((((row) & 0xFF) << 24) | (((col) & 0xFF) << 16) | ((code) & 0xFFFF))