From 59e1a4afaf2c38a8de4cd6ffcf35b10a0a76435a Mon Sep 17 00:00:00 2001 From: Tony Lindgren Date: Sun, 5 Mar 2017 20:11:56 -0800 Subject: [PATCH 01/16] ARM: dts: Add keypad support for droid 4 Let's configure the keypad in a way where it's usable out of the box for Linux console use. We want to have the keyboard usable with Linux console for example when stuck into an initramfs during boot, for when installing a distro. As we need to need to have keys mapped in the user space anyways for some of the keys to match the labels, this non-standard mapping or usability should be OK. Some keys don't match the labels either as they don't follow the PC keyboard style. For example we have "shift + ," produce "<", and "shift + ." produce ">" instead of ";" and ":". So let's follow the standard PC keyboard layout for ctrl, shift and alt keys: Ctrl = what is labeled as shift Alt = what is labeled as SYM Shift = what is lableled as caps lock This way we have Ctrl key for console use. Who knows where they got the caps lock idea.. Probably from some focus group popularity vote or something. For the OK key, let's keep it as the useless KEY_OK unless we can come up with some standard mapping for it we can stick with. We have at least Esc, Delete, Meta, and Page Down keys missing, but none of them seem to be better than others. PC keyboard often has Page Down in that location. Esc would be probably the most usable one when installing a Linux distro but is the opposite of OK. Note that the LCD keys are just touchscreen hot spots, so I'm not sure if the driver or hardware allows setting them up as keys for the console. Anyways, the rest can be mapped in the user space. Cc: Marcel Partap Cc: Mark Rutland Cc: Michael Scott Tested-By: Sebastian Reichel Signed-off-by: Tony Lindgren --- arch/arm/boot/dts/omap4-droid4-xt894.dts | 75 ++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/arch/arm/boot/dts/omap4-droid4-xt894.dts b/arch/arm/boot/dts/omap4-droid4-xt894.dts index f3ccb4ceed9e..2140be87f6fc 100644 --- a/arch/arm/boot/dts/omap4-droid4-xt894.dts +++ b/arch/arm/boot/dts/omap4-droid4-xt894.dts @@ -5,6 +5,7 @@ */ /dts-v1/; +#include #include "omap443x.dtsi" / { @@ -60,6 +61,80 @@ status = "disabled"; }; +&keypad { + keypad,num-rows = <8>; + keypad,num-columns = <8>; + linux,keymap = < + + /* Row 1 */ + MATRIX_KEY(0, 2, KEY_1) + MATRIX_KEY(0, 6, KEY_2) + MATRIX_KEY(2, 3, KEY_3) + MATRIX_KEY(0, 7, KEY_4) + MATRIX_KEY(0, 4, KEY_5) + MATRIX_KEY(5, 5, KEY_6) + MATRIX_KEY(0, 1, KEY_7) + MATRIX_KEY(0, 5, KEY_8) + MATRIX_KEY(0, 0, KEY_9) + MATRIX_KEY(1, 6, KEY_0) + + /* Row 2 */ + MATRIX_KEY(3, 4, KEY_APOSTROPHE) + MATRIX_KEY(7, 6, KEY_Q) + MATRIX_KEY(7, 7, KEY_W) + MATRIX_KEY(7, 2, KEY_E) + MATRIX_KEY(1, 0, KEY_R) + MATRIX_KEY(4, 4, KEY_T) + MATRIX_KEY(1, 2, KEY_Y) + MATRIX_KEY(6, 7, KEY_U) + MATRIX_KEY(2, 2, KEY_I) + MATRIX_KEY(5, 6, KEY_O) + MATRIX_KEY(3, 7, KEY_P) + MATRIX_KEY(6, 5, KEY_BACKSPACE) + + /* Row 3 */ + MATRIX_KEY(5, 4, KEY_TAB) + MATRIX_KEY(5, 7, KEY_A) + MATRIX_KEY(2, 7, KEY_S) + MATRIX_KEY(7, 0, KEY_D) + MATRIX_KEY(2, 6, KEY_F) + MATRIX_KEY(6, 2, KEY_G) + MATRIX_KEY(6, 6, KEY_H) + MATRIX_KEY(1, 4, KEY_J) + MATRIX_KEY(3, 1, KEY_K) + MATRIX_KEY(2, 1, KEY_L) + MATRIX_KEY(4, 6, KEY_ENTER) + + /* Row 4 */ + MATRIX_KEY(3, 6, KEY_LEFTSHIFT) /* KEY_CAPSLOCK */ + MATRIX_KEY(6, 1, KEY_Z) + MATRIX_KEY(7, 4, KEY_X) + MATRIX_KEY(5, 1, KEY_C) + MATRIX_KEY(1, 7, KEY_V) + MATRIX_KEY(2, 4, KEY_B) + MATRIX_KEY(4, 1, KEY_N) + MATRIX_KEY(1, 1, KEY_M) + MATRIX_KEY(3, 5, KEY_COMMA) + MATRIX_KEY(5, 2, KEY_DOT) + MATRIX_KEY(6, 3, KEY_UP) + MATRIX_KEY(7, 3, KEY_OK) + + /* Row 5 */ + MATRIX_KEY(2, 5, KEY_LEFTCTRL) /* KEY_LEFTSHIFT */ + MATRIX_KEY(4, 5, KEY_LEFTALT) /* SYM */ + MATRIX_KEY(6, 0, KEY_MINUS) + MATRIX_KEY(4, 7, KEY_EQUAL) + MATRIX_KEY(1, 5, KEY_SPACE) + MATRIX_KEY(3, 2, KEY_SLASH) + MATRIX_KEY(4, 3, KEY_LEFT) + MATRIX_KEY(5, 3, KEY_DOWN) + MATRIX_KEY(3, 3, KEY_RIGHT) + + /* Side buttons, KEY_VOLUMEDOWN and KEY_PWER are on CPCAP? */ + MATRIX_KEY(5, 0, KEY_VOLUMEUP) + >; +}; + &mmc1 { vmmc-supply = <&vmmc>; bus-width = <4>; From 0d4cb3ccee589a18306b73be6274bf79209a4dcd Mon Sep 17 00:00:00 2001 From: Tony Lindgren Date: Sun, 5 Mar 2017 20:11:56 -0800 Subject: [PATCH 02/16] ARM: dts: Configure regulators for droid 4 With drivers/mfd/motorola-cpcap.c and drivers/regulator/cpcap-regulator.c we can now configure proper regulators for droid 4. Let's add regulator voltages and switch over MMC, eMMC and WLAN to use the CPCAP regulators. Cc: devicetree@vger.kernel.org Cc: Marcel Partap Cc: Michael Scott Tested-By: Sebastian Reichel Signed-off-by: Tony Lindgren --- .../arm/boot/dts/motorola-cpcap-mapphone.dtsi | 151 ++++++++++++++++++ arch/arm/boot/dts/omap4-droid4-xt894.dts | 25 +-- 2 files changed, 155 insertions(+), 21 deletions(-) create mode 100644 arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi diff --git a/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi b/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi new file mode 100644 index 000000000000..b7e12463016e --- /dev/null +++ b/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi @@ -0,0 +1,151 @@ +/* + * Common CPCAP configuration used on Motorola phones + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +&mcspi1 { + cpcap: pmic@0 { + compatible = "motorola,cpcap", "st,6556002"; + reg = <0>; /* cs0 */ + interrupt-parent = <&gpio1>; + interrupts = <7 IRQ_TYPE_EDGE_RISING>; + interrupt-controller; + #interrupt-cells = <2>; + #address-cells = <1>; + #size-cells = <0>; + spi-max-frequency = <3000000>; + spi-cs-high; + + cpcap_regulator: regulator { + compatible = "motorola,mapphone-cpcap-regulator"; + + cpcap_regulators: regulators { + }; + }; + }; +}; + +&cpcap_regulators { + sw5: SW5 { + regulator-min-microvolt = <5050000>; + regulator-max-microvolt = <5050000>; + regulator-enable-ramp-delay = <50000>; + regulator-boot-on; + }; + + vcam: VCAM { + regulator-min-microvolt = <2900000>; + regulator-max-microvolt = <2900000>; + regulator-enable-ramp-delay = <1000>; + }; + + /* Used by DSS */ + vcsi: VCSI { + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-enable-ramp-delay = <1000>; + regulator-boot-on; + }; + + vdac: VDAC { + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-enable-ramp-delay = <1000>; + }; + + vdig: VDIG { + regulator-min-microvolt = <1875000>; + regulator-max-microvolt = <1875000>; + regulator-enable-ramp-delay = <1000>; + }; + + vfuse: VFUSE { + regulator-min-microvolt = <1500000>; + regulator-max-microvolt = <3150000>; + regulator-enable-ramp-delay = <1000>; + }; + + vhvio: VHVIO { + regulator-min-microvolt = <2775000>; + regulator-max-microvolt = <2775000>; + regulator-enable-ramp-delay = <1000>; + regulator-always-on; + }; + + /* Used by eMMC at mmc2 */ + vsdio: VSDIO { + regulator-min-microvolt = <2900000>; + regulator-max-microvolt = <2900000>; + regulator-enable-ramp-delay = <1000>; + }; + + vpll: VPLL { + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1800000>; + regulator-enable-ramp-delay = <100>; + }; + + vrf1: VRF1 { + regulator-min-microvolt = <2775000>; + regulator-max-microvolt = <2775000>; + regulator-enable-ramp-delay = <1000>; + }; + + vrf2: VRF2 { + regulator-min-microvolt = <2775000>; + regulator-max-microvolt = <2775000>; + regulator-enable-ramp-delay = <1000>; + }; + + vrfref: VRFREF { + regulator-min-microvolt = <2500000>; + regulator-max-microvolt = <2775000>; + regulator-enable-ramp-delay = <100>; + }; + + vwlan1: VWLAN1 { + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1900000>; + regulator-enable-ramp-delay = <1000>; + }; + + vwlan2: VWLAN2 { + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-enable-ramp-delay = <1000>; + }; + + vsim: VSIM { + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <2900000>; + regulator-enable-ramp-delay = <1000>; + }; + + /* Used by micro-SDIO at mmc1 */ + vsimcard: VSIMCARD { + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <2900000>; + regulator-enable-ramp-delay = <1000>; + }; + + vvib: VVIB { + regulator-min-microvolt = <1300000>; + regulator-max-microvolt = <3000000>; + regulator-enable-ramp-delay = <500>; + }; + + vusb: VUSB { + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-enable-ramp-delay = <1000>; + }; + + vaudio: VAUDIO { + regulator-min-microvolt = <2775000>; + regulator-max-microvolt = <2775000>; + regulator-enable-ramp-delay = <1000>; + }; +}; diff --git a/arch/arm/boot/dts/omap4-droid4-xt894.dts b/arch/arm/boot/dts/omap4-droid4-xt894.dts index 2140be87f6fc..e5b56fc603c8 100644 --- a/arch/arm/boot/dts/omap4-droid4-xt894.dts +++ b/arch/arm/boot/dts/omap4-droid4-xt894.dts @@ -7,6 +7,7 @@ #include #include "omap443x.dtsi" +#include "motorola-cpcap-mapphone.dtsi" / { model = "Motorola Droid 4 XT894"; @@ -26,25 +27,7 @@ reg = <0x80000000 0x3fd00000>; /* 1021 MB */ }; - /* CPCAP really supports 1650000 to 3400000 range */ - vmmc: regulator-mmc { - compatible = "regulator-fixed"; - regulator-name = "vmmc"; - regulator-min-microvolt = <3000000>; - regulator-max-microvolt = <3000000>; - regulator-always-on; - }; - - /* CPCAP really supports 3000000 to 3100000 range */ - vemmc: regulator-emmc { - compatible = "regulator-fixed"; - regulator-name = "vemmc"; - regulator-min-microvolt = <3000000>; - regulator-max-microvolt = <3000000>; - regulator-always-on; - }; - - /* CPCAP really supports 1650000 to 1950000 range */ + /* This is probably coming straight from the battery.. */ wl12xx_vmmc: regulator-wl12xx { compatible = "regulator-fixed"; regulator-name = "vwl1271"; @@ -136,13 +119,13 @@ }; &mmc1 { - vmmc-supply = <&vmmc>; + vmmc-supply = <&vsimcard>; bus-width = <4>; cd-gpios = <&gpio4 10 GPIO_ACTIVE_LOW>; /* gpio106 */ }; &mmc2 { - vmmc-supply = <&vemmc>; + vmmc-supply = <&vsdio>; bus-width = <8>; non-removable; }; From 5937a55cf9a94214cae83248e73f8e4ddc27db48 Mon Sep 17 00:00:00 2001 From: Sebastian Reichel Date: Sun, 5 Mar 2017 20:11:56 -0800 Subject: [PATCH 03/16] ARM: dts: omap4-droid4: Add gpio-keys On Droid 4 "Volume Down" and "Keypad Slide" keys are connected via SoC GPIOs, "Power Key" via CPCAP and all other keys via SoC keypad Matrix. This adds the GPIO keys. Signed-off-by: Sebastian Reichel [tony@atomide.com: updated to apply on omap4-keypad patch] Signed-off-by: Tony Lindgren --- arch/arm/boot/dts/omap4-droid4-xt894.dts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/arch/arm/boot/dts/omap4-droid4-xt894.dts b/arch/arm/boot/dts/omap4-droid4-xt894.dts index e5b56fc603c8..ac3df1f99131 100644 --- a/arch/arm/boot/dts/omap4-droid4-xt894.dts +++ b/arch/arm/boot/dts/omap4-droid4-xt894.dts @@ -37,6 +37,26 @@ startup-delay-us = <70000>; enable-active-high; }; + + gpio_keys { + compatible = "gpio-keys"; + + volume_down { + label = "Volume Down"; + gpios = <&gpio5 26 GPIO_ACTIVE_LOW>; /* gpio154 */ + linux,code = ; + linux,can-disable; + }; + + slider { + label = "Keypad Slide"; + gpios = <&gpio4 26 GPIO_ACTIVE_HIGH>; /* gpio122 */ + linux,input-type = ; + linux,code = ; + linux,can-disable; + + }; + }; }; /* L3_2 interconnect is unused, SRAM, GPMC and L3_ICLK2 disabled */ From 45ce6cf0c6dc91386a01f14da1a6352c9bce37d1 Mon Sep 17 00:00:00 2001 From: Sebastian Reichel Date: Sun, 5 Mar 2017 20:11:56 -0800 Subject: [PATCH 04/16] ARM: dts: motorola-cpcap-mapphone: add rtc Add rtc. Signed-off-by: Sebastian Reichel Signed-off-by: Tony Lindgren --- arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi b/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi index b7e12463016e..34fb93ba5966 100644 --- a/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi +++ b/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi @@ -25,6 +25,13 @@ cpcap_regulators: regulators { }; }; + + cpcap_rtc: rtc { + compatible = "motorola,cpcap-rtc"; + + interrupt-parent = <&cpcap>; + interrupts = <39 IRQ_TYPE_NONE>, <26 IRQ_TYPE_NONE>; + }; }; }; From 594e808bfa2d296c9e4ce8ff0132c27f2b1259de Mon Sep 17 00:00:00 2001 From: Sebastian Reichel Date: Sun, 5 Mar 2017 20:11:57 -0800 Subject: [PATCH 05/16] ARM: dts: motorola-cpcap-mapphone: add pwrbutton Add power button. Signed-off-by: Sebastian Reichel Signed-off-by: Tony Lindgren --- arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi b/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi index 34fb93ba5966..9970985e685b 100644 --- a/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi +++ b/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi @@ -32,6 +32,12 @@ interrupt-parent = <&cpcap>; interrupts = <39 IRQ_TYPE_NONE>, <26 IRQ_TYPE_NONE>; }; + + power_button: button { + compatible = "motorola,cpcap-pwrbutton"; + + interrupts = <23 IRQ_TYPE_NONE>; + }; }; }; From d2913a69929b777af896f3343edd0dcde5ff700d Mon Sep 17 00:00:00 2001 From: Sebastian Reichel Date: Sun, 5 Mar 2017 20:11:57 -0800 Subject: [PATCH 06/16] ARM: dts: omap4-droid4: Add compass Add compass. Signed-off-by: Sebastian Reichel Signed-off-by: Tony Lindgren --- arch/arm/boot/dts/omap4-droid4-xt894.dts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/arch/arm/boot/dts/omap4-droid4-xt894.dts b/arch/arm/boot/dts/omap4-droid4-xt894.dts index ac3df1f99131..31638598331a 100644 --- a/arch/arm/boot/dts/omap4-droid4-xt894.dts +++ b/arch/arm/boot/dts/omap4-droid4-xt894.dts @@ -264,3 +264,20 @@ mode = <3>; power = <50>; }; + +&i2c4 { + ak8975: magnetometer@c { + compatible = "asahi-kasei,ak8975"; + reg = <0x0c>; + + vdd-supply = <&vhvio>; + + interrupt-parent = <&gpio6>; + interrupts = <15 IRQ_TYPE_EDGE_RISING>; /* gpio175 */ + + rotation-matrix = "-1", "0", "0", + "0", "1", "0", + "0", "0", "-1"; + + }; +}; From 6f1a0744162e54a6d1baae157c8cb27eb6cde42c Mon Sep 17 00:00:00 2001 From: Sebastian Reichel Date: Sun, 5 Mar 2017 20:11:57 -0800 Subject: [PATCH 07/16] ARM: dts: omap4-droid4: Add accelerometer Add accelerometer. Signed-off-by: Sebastian Reichel Signed-off-by: Tony Lindgren --- arch/arm/boot/dts/omap4-droid4-xt894.dts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/arch/arm/boot/dts/omap4-droid4-xt894.dts b/arch/arm/boot/dts/omap4-droid4-xt894.dts index 31638598331a..9070f4b64b08 100644 --- a/arch/arm/boot/dts/omap4-droid4-xt894.dts +++ b/arch/arm/boot/dts/omap4-droid4-xt894.dts @@ -280,4 +280,18 @@ "0", "0", "-1"; }; + + lis3dh: accelerometer@18 { + compatible = "st,lis3dh-accel"; + reg = <0x18>; + + vdd-supply = <&vhvio>; + + interrupt-parent = <&gpio2>; + interrupts = <2 IRQ_TYPE_EDGE_BOTH>; /* gpio34 */ + + rotation-matrix = "0", "-1", "0", + "1", "0", "0", + "0", "0", "1"; + }; }; From 0526364ce48fe586a1b745494be6fe82cb018b7a Mon Sep 17 00:00:00 2001 From: Tony Lindgren Date: Sun, 5 Mar 2017 20:11:58 -0800 Subject: [PATCH 08/16] ARM: dts: omap4-droid4: Add touchscreen Droid4's touchscreen can be used with mainline's maxtouch driver. The touchscreen's lower area is used for four soft buttons (KEY_MENU, KEY_HOME, KEY_BACK, KEY_SEARCH), but that does not seem to be currently supported by the mainline kernel. The mxt224 configuration can be saved with "mxt-app" for the kernel to load. It can be saved after the first boot with: # mxt-app -d i2c-dev:1-004a --save /lib/firmware/maxtouch.cfg Where the mxt-app can be found at: https://github.com/atmel-maxtouch/mxt-app The firmware for the droid 4 mxt224 comes with GPLv2 license in the Motorola Linux kernel sources. This firmware can be dumped out with "droid4-touchscreen-firmware" program at: https://github.com/tmlind/droid4-touchscreen-firmware The related LCD patches are still pending, but when merged, the touchscreen can be rotated in X with something like: # xrandr --output DSI-1 --rotate right # xinput set-prop 6 'Coordinate Transformation Matrix' \ 0 1 0 -1 0 1 0 0 1 For now, we rely on a gpio-hog but later on we can add the reset gpio handling to the driver and have it load the maxtouch.cfg and maxtouch.fw on boot. This patch is based on combined similar patches done by me and Sebastian. Signed-off-by: Sebastian Reichel Signed-off-by: Tony Lindgren --- arch/arm/boot/dts/omap4-droid4-xt894.dts | 36 ++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/arch/arm/boot/dts/omap4-droid4-xt894.dts b/arch/arm/boot/dts/omap4-droid4-xt894.dts index 9070f4b64b08..02fd2d8fa0d1 100644 --- a/arch/arm/boot/dts/omap4-droid4-xt894.dts +++ b/arch/arm/boot/dts/omap4-droid4-xt894.dts @@ -59,6 +59,15 @@ }; }; +&gpio6 { + touchscreen_reset { + gpio-hog; + gpios = <13 0>; + output-high; + line-name = "touchscreen-reset"; + }; +}; + /* L3_2 interconnect is unused, SRAM, GPMC and L3_ICLK2 disabled */ &gpmc { status = "disabled"; @@ -171,6 +180,27 @@ }; }; +/* + * REVISIT: Add gpio173 reset pin handling to the driver, see gpio-hog above. + * If the GPIO reset is used, we probably need to have /lib/firmware/maxtouch.fw + * available. See "mxt-app" and "droid4-touchscreen-firmware" tools for more + * information. + */ +&i2c2 { + tsp@4a { + compatible = "atmel,maxtouch"; + reg = <0x4a>; + pinctrl-names = "default"; + pinctrl-0 = <&touchscreen_pins>; + + /* gpio_183 with sys_nirq2 pad as wakeup */ + interrupts-extended = <&gpio6 23 IRQ_TYPE_EDGE_FALLING + &omap4_pmx_core 0x160>; + interrupt-names = "irq", "wakeup"; + wakeup-source; + }; +}; + /* L3_2 interconnect is unused, SRAM, GPMC and L3_ICLK2 disabled */ &ocmcram { status = "disabled"; @@ -184,6 +214,12 @@ >; }; + touchscreen_pins: pinmux_touchscreen_pins { + pinctrl-single,pins = < + OMAP4_IOPAD(0x1a0, PIN_INPUT_PULLUP | MUX_MODE3) + >; + }; + usb_ulpi_pins: pinmux_usb_ulpi_pins { pinctrl-single,pins = < OMAP4_IOPAD(0x196, MUX_MODE7) From 771e4feb273a98aeccd3e0c3edd05ecde513d280 Mon Sep 17 00:00:00 2001 From: Tony Lindgren Date: Sun, 5 Mar 2017 20:11:58 -0800 Subject: [PATCH 09/16] ARM: dts: omap4-droid4: Add LCD backlight The TI LMU driver has not yet been merged, but the device tree binding for TI LMU drivers has been acked already earlier by Rob Herring . So it should be safe to apply to cut down the number of pending patches. Cc: devicetree@vger.kernel.org Cc: Marcel Partap Cc: Michael Scott Cc: Rob Herring Acked-by: Milo Kim Tested-By: Sebastian Reichel Signed-off-by: Tony Lindgren --- arch/arm/boot/dts/omap4-droid4-xt894.dts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/arch/arm/boot/dts/omap4-droid4-xt894.dts b/arch/arm/boot/dts/omap4-droid4-xt894.dts index 02fd2d8fa0d1..ed07f39d61a2 100644 --- a/arch/arm/boot/dts/omap4-droid4-xt894.dts +++ b/arch/arm/boot/dts/omap4-droid4-xt894.dts @@ -180,6 +180,25 @@ }; }; +&i2c1 { + lm3532@38 { + compatible = "ti,lm3532"; + reg = <0x38>; + + enable-gpios = <&gpio6 12 GPIO_ACTIVE_HIGH>; + + backlight { + compatible = "ti,lm3532-backlight"; + + lcd { + led-sources = <0 1 2>; + ramp-up-msec = <1>; + ramp-down-msec = <0>; + }; + }; + }; +}; + /* * REVISIT: Add gpio173 reset pin handling to the driver, see gpio-hog above. * If the GPIO reset is used, we probably need to have /lib/firmware/maxtouch.fw From 9946f937d482abeb697dde44a58a8d821f45df0c Mon Sep 17 00:00:00 2001 From: Tony Lindgren Date: Sun, 5 Mar 2017 20:11:58 -0800 Subject: [PATCH 10/16] ARM: dts: omap4-droid4: Add GPIO poweroff Droid 4 has a GPIO line that we can use with CONFIG_POWER_RESET_GPIO. It is probably connected to the CPCAP PMIC, and seems to power down the whole device taking power consumption to zero based on what I measured. Cc: devicetree@vger.kernel.org Cc: Marcel Partap Cc: Michael Scott Tested-By: Sebastian Reichel Signed-off-by: Tony Lindgren --- arch/arm/boot/dts/omap4-droid4-xt894.dts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/arch/arm/boot/dts/omap4-droid4-xt894.dts b/arch/arm/boot/dts/omap4-droid4-xt894.dts index ed07f39d61a2..1830f747354f 100644 --- a/arch/arm/boot/dts/omap4-droid4-xt894.dts +++ b/arch/arm/boot/dts/omap4-droid4-xt894.dts @@ -27,6 +27,14 @@ reg = <0x80000000 0x3fd00000>; /* 1021 MB */ }; + /* Poweroff GPIO probably connected to CPCAP */ + gpio-poweroff { + compatible = "gpio-poweroff"; + pinctrl-0 = <&poweroff_gpio>; + pinctrl-names = "default"; + gpios = <&gpio2 18 GPIO_ACTIVE_LOW>; /* gpio50 */ + }; + /* This is probably coming straight from the battery.. */ wl12xx_vmmc: regulator-wl12xx { compatible = "regulator-fixed"; @@ -226,6 +234,14 @@ }; &omap4_pmx_core { + + /* gpmc_ncs0.gpio_50 */ + poweroff_gpio: pinmux_poweroff_pins { + pinctrl-single,pins = < + OMAP4_IOPAD(0x074, PIN_OUTPUT_PULLUP | MUX_MODE3) + >; + }; + usb_gpio_mux_sel1: pinmux_usb_gpio_mux_sel1_pins { /* gpio_60 */ pinctrl-single,pins = < From fdec8edbbee5a9a85ac1aeae48c4d3ae43a6ad27 Mon Sep 17 00:00:00 2001 From: Tony Lindgren Date: Sun, 5 Mar 2017 20:11:58 -0800 Subject: [PATCH 11/16] ARM: dts: omap4-droid4: Add tmp105 sensor for droid 4 Add tmp105 sensor for droid 4. This can be used with modprobe lm75.ko and running sensors from lm-sensors package. Note that the lm75.c driver does not yet support alert interrupt but droid 4 seems to be wired for it. Cc: devicetree@vger.kernel.org Cc: Marcel Partap Cc: Michael Scott Tested-By: Sebastian Reichel Signed-off-by: Tony Lindgren --- arch/arm/boot/dts/omap4-droid4-xt894.dts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/arch/arm/boot/dts/omap4-droid4-xt894.dts b/arch/arm/boot/dts/omap4-droid4-xt894.dts index 1830f747354f..05046edefee7 100644 --- a/arch/arm/boot/dts/omap4-droid4-xt894.dts +++ b/arch/arm/boot/dts/omap4-droid4-xt894.dts @@ -81,6 +81,20 @@ status = "disabled"; }; +&i2c1 { + tmp105@48 { + compatible = "ti,tmp105"; + reg = <0x48>; + pinctrl-0 = <&tmp105_irq>; + pinctrl-names = "default"; + /* kpd_row0.gpio_178 */ + interrupts-extended = <&gpio6 18 IRQ_TYPE_EDGE_FALLING + &omap4_pmx_core 0x14e>; + interrupt-names = "irq", "wakeup"; + wakeup-source; + }; +}; + &keypad { keypad,num-rows = <8>; keypad,num-columns = <8>; @@ -242,6 +256,13 @@ >; }; + /* kpd_row0.gpio_178 */ + tmp105_irq: pinmux_tmp105_irq { + pinctrl-single,pins = < + OMAP4_IOPAD(0x18e, PIN_INPUT_PULLUP | MUX_MODE3) + >; + }; + usb_gpio_mux_sel1: pinmux_usb_gpio_mux_sel1_pins { /* gpio_60 */ pinctrl-single,pins = < From 50cdcc0b01e500eaef02d4298694548f25dd60cb Mon Sep 17 00:00:00 2001 From: Tony Lindgren Date: Sun, 5 Mar 2017 20:11:59 -0800 Subject: [PATCH 12/16] ARM: dts: omap4-droid4: Add HDMI support We can get HDMI working as long as the 5V regulator is on. There is probably an encoder chip there too, but so far no idea what it might be. Let's keep the 5V HDMI regulator always enabled for now as otherwise we cannot detect the monitor properly. Cc: devicetree@vger.kernel.org Cc: Marcel Partap Cc: Michael Scott Cc: Tomi Valkeinen Tested-By: Sebastian Reichel Signed-off-by: Tony Lindgren --- arch/arm/boot/dts/omap4-droid4-xt894.dts | 65 ++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/arch/arm/boot/dts/omap4-droid4-xt894.dts b/arch/arm/boot/dts/omap4-droid4-xt894.dts index 05046edefee7..6b91eb812ea7 100644 --- a/arch/arm/boot/dts/omap4-droid4-xt894.dts +++ b/arch/arm/boot/dts/omap4-droid4-xt894.dts @@ -35,6 +35,37 @@ gpios = <&gpio2 18 GPIO_ACTIVE_LOW>; /* gpio50 */ }; + hdmi0: connector { + compatible = "hdmi-connector"; + pinctrl-0 = <&hdmi_hpd_gpio>; + pinctrl-names = "default"; + label = "hdmi"; + type = "d"; + + hpd-gpios = <&gpio2 31 GPIO_ACTIVE_HIGH>; /* gpio63 */ + + port { + hdmi_connector_in: endpoint { + remote-endpoint = <&hdmi_out>; + }; + }; + }; + + /* + * HDMI 5V regulator probably sourced from battery. Let's keep + * keep this as always enabled for HDMI to work until we've + * figured what the encoder chip is. + */ + hdmi_regulator: regulator-hdmi { + compatible = "regulator-fixed"; + regulator-name = "hdmi"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpio = <&gpio2 27 GPIO_ACTIVE_HIGH>; /* gpio59 */ + enable-active-high; + regulator-always-on; + }; + /* This is probably coming straight from the battery.. */ wl12xx_vmmc: regulator-wl12xx { compatible = "regulator-fixed"; @@ -67,6 +98,10 @@ }; }; +&dss { + status = "okay"; +}; + &gpio6 { touchscreen_reset { gpio-hog; @@ -81,6 +116,20 @@ status = "disabled"; }; +&hdmi { + status = "okay"; + pinctrl-0 = <&dss_hdmi_pins>; + pinctrl-names = "default"; + vdda-supply = <&vdac>; + + port { + hdmi_out: endpoint { + remote-endpoint = <&hdmi_connector_in>; + lanes = <1 0 3 2 5 4 7 6>; + }; + }; +}; + &i2c1 { tmp105@48 { compatible = "ti,tmp105"; @@ -249,6 +298,22 @@ &omap4_pmx_core { + /* hdmi_hpd.gpio_63 */ + hdmi_hpd_gpio: pinmux_hdmi_hpd_pins { + pinctrl-single,pins = < + OMAP4_IOPAD(0x098, PIN_INPUT | MUX_MODE3) + >; + }; + + /* hdmi_cec.hdmi_cec, hdmi_scl.hdmi_scl, hdmi_sda.hdmi_sda */ + dss_hdmi_pins: pinmux_dss_hdmi_pins { + pinctrl-single,pins = < + OMAP4_IOPAD(0x09a, PIN_INPUT_PULLUP | MUX_MODE0) + OMAP4_IOPAD(0x09c, PIN_INPUT | MUX_MODE0) + OMAP4_IOPAD(0x09e, PIN_INPUT | MUX_MODE0) + >; + }; + /* gpmc_ncs0.gpio_50 */ poweroff_gpio: pinmux_poweroff_pins { pinctrl-single,pins = < From d9bed1447988a10bff6101b95ab474ca06b6e33b Mon Sep 17 00:00:00 2001 From: Tony Lindgren Date: Sun, 5 Mar 2017 20:11:59 -0800 Subject: [PATCH 13/16] ARM: dts: omap4-droid4: Add LCD The LCD panel on droid 4 is a command mode LCD. The binding follows the standard omapdrm binding and the changes needed for omapdrm command mode panels are posted separately. Cc: devicetree@vger.kernel.org Cc: Marcel Partap Cc: Michael Scott Cc: Tomi Valkeinen Tested-By: Sebastian Reichel Signed-off-by: Tony Lindgren --- arch/arm/boot/dts/omap4-droid4-xt894.dts | 60 ++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/arch/arm/boot/dts/omap4-droid4-xt894.dts b/arch/arm/boot/dts/omap4-droid4-xt894.dts index 6b91eb812ea7..5d4dcbfcbdbd 100644 --- a/arch/arm/boot/dts/omap4-droid4-xt894.dts +++ b/arch/arm/boot/dts/omap4-droid4-xt894.dts @@ -17,6 +17,11 @@ stdout-path = &uart3; }; + aliases { + display0 = &lcd0; + display1 = &hdmi0; + }; + /* * We seem to have only 1021 MB accessible, 1021 - 1022 is locked, * then 1023 - 1024 seems to contain mbm. For SRAM, see the notes @@ -66,6 +71,17 @@ regulator-always-on; }; + /* LCD regulator from sw5 source */ + lcd_regulator: regulator-lcd { + compatible = "regulator-fixed"; + regulator-name = "lcd"; + regulator-min-microvolt = <5050000>; + regulator-max-microvolt = <5050000>; + gpio = <&gpio4 0 GPIO_ACTIVE_HIGH>; /* gpio96 */ + enable-active-high; + vin-supply = <&sw5>; + }; + /* This is probably coming straight from the battery.. */ wl12xx_vmmc: regulator-wl12xx { compatible = "regulator-fixed"; @@ -111,6 +127,50 @@ }; }; +&dsi1 { + status = "okay"; + vdd-supply = <&vcsi>; + + port { + dsi1_out_ep: endpoint { + remote-endpoint = <&lcd0_in>; + lanes = <0 1 2 3 4 5>; + }; + }; + + lcd0: display { + compatible = "panel-dsi-cm"; + label = "lcd0"; + vddi-supply = <&lcd_regulator>; + reset-gpios = <&gpio4 5 GPIO_ACTIVE_HIGH>; /* gpio101 */ + + panel-timing { + clock-frequency = <0>; /* Calculated by dsi */ + + hback-porch = <2>; + hactive = <540>; + hfront-porch = <0>; + hsync-len = <2>; + + vback-porch = <1>; + vactive = <960>; + vfront-porch = <0>; + vsync-len = <1>; + + hsync-active = <0>; + vsync-active = <0>; + de-active = <1>; + pixelclk-active = <1>; + }; + + port { + lcd0_in: endpoint { + remote-endpoint = <&dsi1_out_ep>; + }; + }; + }; +}; + /* L3_2 interconnect is unused, SRAM, GPMC and L3_ICLK2 disabled */ &gpmc { status = "disabled"; From 836a0b0bb96d7a743c570b89e6655c0217062a42 Mon Sep 17 00:00:00 2001 From: Sebastian Reichel Date: Sun, 5 Mar 2017 18:22:34 +0100 Subject: [PATCH 14/16] ARM: dts: motorola-cpcap-mapphone: add LEDs Add LEDs. Signed-off-by: Sebastian Reichel Signed-off-by: Tony Lindgren --- .../arm/boot/dts/motorola-cpcap-mapphone.dtsi | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi b/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi index 9970985e685b..e02982d69854 100644 --- a/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi +++ b/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi @@ -38,6 +38,36 @@ interrupts = <23 IRQ_TYPE_NONE>; }; + + led_red: led-red { + compatible = "motorola,cpcap-led-red"; + vdd-supply = <&sw5>; + label = "status-led:red"; + }; + + led_green: led-green { + compatible = "motorola,cpcap-led-green"; + vdd-supply = <&sw5>; + label = "status-led:green"; + }; + + led_blue: led-blue { + compatible = "motorola,cpcap-led-blue"; + vdd-supply = <&sw5>; + label = "status-led:blue"; + }; + + led_adl: led-adl { + compatible = "motorola,cpcap-led-adl"; + vdd-supply = <&sw5>; + label = "button-backlight"; + }; + + led_cp: led-cp { + compatible = "motorola,cpcap-led-cp"; + vdd-supply = <&sw5>; + label = "shift-key-light"; + }; }; }; From 7a9b248446dfd7c2d65030159e5c152a911aaf42 Mon Sep 17 00:00:00 2001 From: Tony Lindgren Date: Tue, 14 Mar 2017 17:39:42 -0700 Subject: [PATCH 15/16] ARM: dts: omap4-droid4: Configure EHCI so modems can be accessed Droid 4 has two modems, mdm6600 and w3glte. Both are on the HCI USB controller. Let's add a configuration for the HCI so the modems can be enabled. Note that the modems still need additional GPIO based configuration. Cc: devicetree@vger.kernel.org Cc: Marcel Partap Cc: Michael Scott Tested-by: Sebastian Reichel [tony@atomide.com: left out url] Signed-off-by: Tony Lindgren --- arch/arm/boot/dts/omap4-droid4-xt894.dts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/arch/arm/boot/dts/omap4-droid4-xt894.dts b/arch/arm/boot/dts/omap4-droid4-xt894.dts index 5d4dcbfcbdbd..d381707f33f3 100644 --- a/arch/arm/boot/dts/omap4-droid4-xt894.dts +++ b/arch/arm/boot/dts/omap4-droid4-xt894.dts @@ -71,6 +71,11 @@ regulator-always-on; }; + /* HS USB Host PHY on PORT 1 */ + hsusb1_phy: hsusb1_phy { + compatible = "usb-nop-xceiv"; + }; + /* LCD regulator from sw5 source */ lcd_regulator: regulator-lcd { compatible = "regulator-fixed"; @@ -475,6 +480,15 @@ &omap4_pmx_core 0x17c>; }; +&usbhsehci { + phys = <&hsusb1_phy>; +}; + +&usbhshost { + port1-mode = "ohci-phy-4pin-dpdm"; + port2-mode = "ehci-tll"; +}; + /* Internal UTMI+ PHY used for OTG, CPCAP ULPI PHY for detection and charger */ &usb_otg_hs { interface-type = <1>; From 26bfad63ca896fde674918e36a8b8fd7039a0119 Mon Sep 17 00:00:00 2001 From: Tony Lindgren Date: Mon, 27 Mar 2017 17:40:20 -0700 Subject: [PATCH 16/16] ARM: dts: omap4-droid4: Fix MMC1 card for detect GPIO and regulator There's a typo, it should be GPIO176 and not GPIO106. And it seems I messed up the regulators at some point while trying to figure out what devices the regulators are used. The correct regulator for MMC1 is vwlan2. Fixes: 0d4cb3ccee58 ("ARM: dts: Configure regulators for droid 4") Reported-by: Sebastian Reichel Reviewed-by: Sebastian Reichel Tested-by: Sebastian Reichel Signed-off-by: Tony Lindgren --- arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi | 2 +- arch/arm/boot/dts/omap4-droid4-xt894.dts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi b/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi index e02982d69854..49b76aa16e5f 100644 --- a/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi +++ b/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi @@ -155,6 +155,7 @@ regulator-enable-ramp-delay = <1000>; }; + /* Used by micro-SDIO at mmc1 */ vwlan2: VWLAN2 { regulator-min-microvolt = <3000000>; regulator-max-microvolt = <3000000>; @@ -167,7 +168,6 @@ regulator-enable-ramp-delay = <1000>; }; - /* Used by micro-SDIO at mmc1 */ vsimcard: VSIMCARD { regulator-min-microvolt = <1800000>; regulator-max-microvolt = <2900000>; diff --git a/arch/arm/boot/dts/omap4-droid4-xt894.dts b/arch/arm/boot/dts/omap4-droid4-xt894.dts index d381707f33f3..f27966e3cbc0 100644 --- a/arch/arm/boot/dts/omap4-droid4-xt894.dts +++ b/arch/arm/boot/dts/omap4-droid4-xt894.dts @@ -284,9 +284,9 @@ }; &mmc1 { - vmmc-supply = <&vsimcard>; + vmmc-supply = <&vwlan2>; bus-width = <4>; - cd-gpios = <&gpio4 10 GPIO_ACTIVE_LOW>; /* gpio106 */ + cd-gpios = <&gpio6 16 GPIO_ACTIVE_LOW>; /* gpio176 */ }; &mmc2 {