ARM64: dts: rk3399: add trackpad for gru/kevin boards
authorDouglas Anderson <dianders@chromium.org>
Fri, 22 Apr 2016 18:32:48 +0000 (11:32 -0700)
committerHuang, Tao <huangtao@rock-chips.com>
Tue, 26 Apr 2016 10:51:57 +0000 (18:51 +0800)
The trackpad bits in the DTS needed some love.  This adds some basic
infrastructure support in the main gru dts file and then adds the
specific trackpad used on kevin-r0 and kevin-r1.  For now just duplicate
between kevin-r0 and kevin-r1 and we'll decide if we want to share
later (perhaps we want an "atmel" snippet?).

Note that gpio-keymap here makes the driver appear as a trackpad rather
than a touchscreen (driver assumes that anything with buttons is a
trackpad).  Input entry corresponding to the button on the trackpad was
found by experimentation as suggested in the device tree bindings.

BUG=chrome-os-partner:52637
TEST=With series, trackpad works in browser; button works.

Change-Id: Ia62cff90449625778fd99054b914e22a55c13550
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-on: https://chrome-internal-review.googlesource.com/256510
Commit-Ready: Doug Anderson <dianders@google.com>
Tested-by: Doug Anderson <dianders@google.com>
Reviewed-by: Brian Norris <briannorris@google.com>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
arch/arm64/boot/dts/rockchip/rk3399-gru-kevin-r0.dts
arch/arm64/boot/dts/rockchip/rk3399-gru-kevin-r1.dts
arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi

index 84d2c6990694089f7e66b1b0bbe772acb465e4e1..78fe59da7085814593ec9f9d236367faad8e8327 100644 (file)
                     "google,kevin", "google,gru", "rockchip,rk3399";
 };
 
+&ap_i2c_tp {
+       trackpad@4a {
+               compatible = "atmel,maxtouch";
+               reg = <0x4a>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&trackpad_int_l>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
+               linux,gpio-keymap = <KEY_RESERVED
+                                    KEY_RESERVED
+                                    KEY_RESERVED
+                                    BTN_LEFT>;
+       };
+};
+
 /* GPIO overrides for -r0; in same order as parent */
 
 &pp3000 {
index 858e80397841dc5a359f4939bf467c16188c5484..3ae059f34cb4248615d7f0684e431db7dc0ded65 100644 (file)
                     "google,gru", "rockchip,rk3399";
 };
 
+&ap_i2c_tp {
+       trackpad@4a {
+               compatible = "atmel,maxtouch";
+               reg = <0x4a>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&trackpad_int_l>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
+               linux,gpio-keymap = <KEY_RESERVED
+                                    KEY_RESERVED
+                                    KEY_RESERVED
+                                    BTN_LEFT>;
+       };
+};
+
 /* PINCTRL: always below everything else */
 
 &pinctrl {
index ba69a950c2197f43f38f870e679681ec93e05072..43d3fa8df8d8191ab6ead5744f9212276512f565 100644 (file)
@@ -42,6 +42,7 @@
  *     OTHER DEALINGS IN THE SOFTWARE.
  */
 
+#include <dt-bindings/input/input.h>
 #include <dt-bindings/pwm/pwm.h>
 #include "rk3399.dtsi"
 
@@ -575,6 +576,8 @@ ap_i2c_ts: &i2c3 {
 };
 
 ap_i2c_tp: &i2c5 {
+       status = "okay";
+
        /*
         * Note strange pullup enable.  Apparently this avoids leakage but
         * still allows us to get nice 4.7K pullups for high speed i2c
@@ -583,13 +586,11 @@ ap_i2c_tp: &i2c5 {
         */
        pinctrl-0 = <&i2c5_xfer &ap_i2c_tp_pu_en>;
 
-       status = "okay";
+       clock-frequency = <400000>;
 
-       // TODO: bus speed
-       //       ...with no speed, it should just use 100kHz
-       // TODO: rise / fall times?
-
-       // TODO: Add the proper touchpanel reference...
+       /* These are relatively safe rise/fall times; TODO: measure */
+       i2c-scl-falling-time-ns = <50>;
+       i2c-scl-rising-time-ns = <300>;
 };
 
 ap_i2c_audio: &i2c8 {
@@ -1051,10 +1052,14 @@ ap_i2c_audio: &i2c8 {
                };
        };
 
-       touchpanel {
+       trackpad {
                ap_i2c_tp_pu_en: ap-i2c-tp-pu-en {
                        rockchip,pins = <3 12 RK_FUNC_GPIO &pcfg_output_high>;
                };
+
+               trackpad_int_l: trackpad-int-l {
+                       rockchip,pins = <1 4 RK_FUNC_GPIO &pcfg_pull_up>;
+               };
        };
 
        backlight-enable {