Skip to contentSkip to conversation

Add support for the OnePlus 6 and 6T SDM845 devices

PATCH New Caleb Connolly 1 participant 6 messages Oct 7, 2020

Subsystems (8)
lore
Share & tools
lore
#0 lore raw

Add a device tree with support for the following:
* Display panel (with the oneplus-6 panel driver)
* Hardware accelerated graphics
* Touch screen support with Synaptics rmi4
* RTC support
* Remoteprocessors boot and can be interacted with over QRTR.
* ath10k WLAN using pd-mapper, rmts and tqftpserv daemons
* Bluetooth
* Volume / power buttons and OnePlus Tri-State switch are functional
* USB

The only differences between the devices is the different panels, fingerprint readers and that the 6T lacks a headphone jack and notification LED.

Current limitations:
* Bluetooth does not appear in rfkill, this is most likely the reason it doesn't appear in UI bluetooth settings, it can be interacted with using bluez-utils bluetoothctl.
* USB is forced to peripheral mode as cable type detection is broken

drm/panel/oneplus6: Add panel-oneplus6
dt-bindings: panel: add documentation for oneplus6 panel
arm64: dts: sdm845: add oneplus 6/t devices
dt-bindings: add vendor bindings for OnePlus
i2c: geni: sdm845: dont perform DMA for the oneplus6

Documentation/devicetree/bindings/arm/oneplus/oneplus-boards.yaml   |  25 --
Documentation/devicetree/bindings/display/panel/panel-oneplus6.yaml |  73 ----
Documentation/devicetree/bindings/vendor-prefixes.yaml              |   2 -
arch/arm64/boot/dts/qcom/Makefile                                   |   2 -
arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi                 | 860 ---------------------------------------
arch/arm64/boot/dts/qcom/sdm845-oneplus-enchilada.dts               |  19 -
arch/arm64/boot/dts/qcom/sdm845-oneplus-fajita.dts                  |  19 -
drivers/gpu/drm/panel/Kconfig                                       |  10 -
drivers/gpu/drm/panel/Makefile                                      |   1 -
#1 lore raw

PATCH 1/5 drm/panel/oneplus6: Add panel-oneplus6

This commit adds support for the display panels used in the OnePlus 6 / T devices.

The OnePlus 6/T devices use different panels however they are functionally identical with much of the commands being shared. The panels don't appear to be used by any other devices some combine them as one driver that is specific to the devices.

The panels are: samsung,sofef00
and samsung,s6e3fc2x01

---
 drivers/gpu/drm/panel/Kconfig          |  12 +
 drivers/gpu/drm/panel/Makefile         |   1 +
 drivers/gpu/drm/panel/panel-oneplus6.c | 418 +++++++++++++++++++++++++
 3 files changed, 431 insertions(+)
 create mode 100644 drivers/gpu/drm/panel/panel-oneplus6.c
drivers/gpu/drm/panel/Kconfig +12 -0
index de2f2a452be5..d72862265400 100644
@@ -229,6 +229,18 @@ config DRM_PANEL_OLIMEX_LCD_OLINUXINO
 	  Say Y here if you want to enable support for Olimex Ltd.
 	  LCD-OLinuXino panel.
 
+config DRM_PANEL_ONEPLUS6
+	tristate "OnePlus 6/6T Samsung AMOLED DSI command mode panels"
+	depends on OF
+	depends on DRM_MIPI_DSI
+	depends on BACKLIGHT_CLASS_DEVICE
+	select VIDEOMODE_HELPERS
+	help
+	  Say Y or M here if you want to enable support for the Samsung AMOLED
+	  command mode panels found in the OnePlus 6/6T smartphones.
+
+	  The panels are 2280x1080@60Hz and 2340x1080@60Hz respectively
+
 config DRM_PANEL_ORISETECH_OTM8009A
 	tristate "Orise Technology otm8009a 480x800 dsi 2dl panel"
 	depends on OF
drivers/gpu/drm/panel/Makefile +1 -0
index e45ceac6286f..017539056f53 100644
@@ -21,6 +21,7 @@ obj-$(CONFIG_DRM_PANEL_NEC_NL8048HL11) += panel-nec-nl8048hl11.o
 obj-$(CONFIG_DRM_PANEL_NOVATEK_NT35510) += panel-novatek-nt35510.o
 obj-$(CONFIG_DRM_PANEL_NOVATEK_NT39016) += panel-novatek-nt39016.o
 obj-$(CONFIG_DRM_PANEL_OLIMEX_LCD_OLINUXINO) += panel-olimex-lcd-olinuxino.o
+obj-$(CONFIG_DRM_PANEL_ONEPLUS6) += panel-oneplus6.o
 obj-$(CONFIG_DRM_PANEL_ORISETECH_OTM8009A) += panel-orisetech-otm8009a.o
 obj-$(CONFIG_DRM_PANEL_OSD_OSD101T2587_53TS) += panel-osd-osd101t2587-53ts.o
 obj-$(CONFIG_DRM_PANEL_PANASONIC_VVX10F034N00) += panel-panasonic-vvx10f034n00.o
drivers/gpu/drm/panel/panel-oneplus6.c new file +418 -0

418 lines not on this page · raw message

Signature · 1 line
2.28.0
#2 lore raw

PATCH 2/5 dt-bindings: panel: add documentation for oneplus6 panel

In reply to Caleb Connolly

Document the OnePlus 6/T common panel driver, example from arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi

---
 .../display/panel/panel-oneplus6.yaml         | 73 +++++++++++++++++++
 1 file changed, 73 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/panel/panel-oneplus6.yaml
Documentation/devicetree/bindings/display/panel/panel-oneplus6.yaml new file +73 -0
new file mode 100644
index 000000000000..23ba369cc2f5
@@ -0,0 +1,73 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/panel/panel-oneplus6.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: OnePlus 6/T panel driver
+
+description: |
+  The OnePlus 6 panel driver encompasses the display panels found in the
+  OnePlus 6 and 6T devices, the panels have almost identical behaviour and
+  are not used by any other devices.
+
+maintainers:
+  - Caleb Connolly <[email protected]>
+
+allOf:
+  - $ref: panel-common.yaml#
+
+properties:
+  compatible:
+    enum:
+      - samsung,sofef00
+      - samsung,s6e3fc2x01
+
+  reg: true
+  reset-gpios: true
+  port: true
+
+  vddio-supply:
+    description: VDDIO regulator
+
+required:
+  - compatible
+  - reset-gpios
+  - vddio-supply
+  - port
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    &dsi0 {
+      status = "okay";
+      vdda-supply = <&vdda_mipi_dsi0_1p2>;
+
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      display_panel: panel@0 {
+        status = "okay";
+        compatible = "samsung,sofef00";
+
+        #address-cells = <1>;
+        #size-cells = <0>;
+        reg = <0>;
+
+        vddio-supply = <&vreg_l14a_1p88>;
+
+        reset-gpios = <&tlmm 6 GPIO_ACTIVE_HIGH>;
+
+        pinctrl-names = "default";
+        pinctrl-0 = <&panel_reset_pins &panel_te_pin &panel_esd_pin>;
+
+        port {
+          panel_in: endpoint {
+            remote-endpoint = <&dsi0_out>;
+          };
+        };
+      };
+    };
+
+...
Signature · 1 line
2.28.0
#3 lore raw

PATCH 3/5 arm64: dts: sdm845: add oneplus 6/t devices

In reply to Caleb Connolly

Add initial support for the OnePlus 6 (enchilada) and 6T (fajita) based on the sdm845-mtp DT. Support includes:

* Both display panels work
* Touch screen support with rmi4
* RTC support
* Remoteprocs boot and can be interacted with over QRTR.
* WLAN + Bluetooth both work, although bluetooth doesn't appear in rfkill.
* Volume / power buttons and OnePlus Tri-State switch are functional
* USB gadget support is forced as it doesn't seem to be able to detect USB cable connect/disconnect, perhaps to do with OnePlus' propriatery fast charge IC.

The device successfully boots into Phosh using postmarketOS.

---
 arch/arm64/boot/dts/qcom/Makefile             |   2 +
 .../boot/dts/qcom/sdm845-oneplus-common.dtsi  | 860 ++++++++++++++++++
 .../dts/qcom/sdm845-oneplus-enchilada.dts     |  19 +
 .../boot/dts/qcom/sdm845-oneplus-fajita.dts   |  19 +
 4 files changed, 900 insertions(+)
 create mode 100644 arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
 create mode 100644 arch/arm64/boot/dts/qcom/sdm845-oneplus-enchilada.dts
 create mode 100644 arch/arm64/boot/dts/qcom/sdm845-oneplus-fajita.dts
arch/arm64/boot/dts/qcom/Makefile +2 -0
index d8f1466e6758..a14f246e2367 100644
@@ -30,6 +30,8 @@ dtb-$(CONFIG_ARCH_QCOM)	+= sdm845-cheza-r2.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sdm845-cheza-r3.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sdm845-db845c.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sdm845-mtp.dtb
+dtb-$(CONFIG_ARCH_QCOM)	+= sdm845-oneplus-enchilada.dtb
+dtb-$(CONFIG_ARCH_QCOM)	+= sdm845-oneplus-fajita.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sdm850-lenovo-yoga-c630.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sm8150-mtp.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sm8250-mtp.dtb
arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi new file +860 -0

860 lines not on this page · raw message

arch/arm64/boot/dts/qcom/sdm845-oneplus-enchilada.dts new file +19 -0
new file mode 100644
index 000000000000..a62e211a2797
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * SDM845 OnePlus 6 (enchilada) specific device tree
+ *
+ * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ */
+
+#include "sdm845-oneplus-common.dtsi"
+
+/ {
+	model = "OnePlus 6";
+	compatible = "oneplus,enchilada", "oneplus,oneplus6", "qcom,sdm845";
+};
+
+&display_panel {
+	status = "okay";
+
+	compatible = "samsung,sofef00";
+};
arch/arm64/boot/dts/qcom/sdm845-oneplus-fajita.dts new file +19 -0
new file mode 100644
index 000000000000..d418389bb2d0
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * SDM845 OnePlus 6T (fajita) specific device tree
+ *
+ * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ */
+
+#include "sdm845-oneplus-common.dtsi"
+
+/ {
+	model = "OnePlus 6T";
+	compatible = "oneplus,fajita", "oneplus,oneplus6", "qcom,sdm845";
+};
+
+&display_panel {
+	status = "okay";
+
+	compatible = "samsung,s6e3fc2x01";
+};
Signature · 1 line
2.28.0
#4 lore raw

PATCH 4/5 dt-bindings: add vendor bindings for OnePlus

In reply to Caleb Connolly

Used by the OnePlus 6/T device trees

---
 .../bindings/arm/oneplus/oneplus-boards.yaml  | 25 +++++++++++++++++++
 .../devicetree/bindings/vendor-prefixes.yaml  |  2 ++
 2 files changed, 27 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/oneplus/oneplus-boards.yaml
Documentation/devicetree/bindings/arm/oneplus/oneplus-boards.yaml new file +25 -0
new file mode 100644
index 000000000000..a4d9bbd5681f
@@ -0,0 +1,25 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/arm/oneplus/oneplus-boards.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: OnePlus based boards
+
+maintainers:
+  - Caleb Connolly <[email protected]>
+
+properties:
+  $nodename:
+    const: '/'
+  compatible:
+    oneOf:
+      - description: SDM845 based boards
+        items:
+          - enum:
+              - oneplus,enchilada               # OnePlus 6
+              - oneplus,fajita                  # OnePlus 6T
+          - const: oneplus,oneplus6             # OnePlus 6 and derivatives
+
+required:
+  - compatible
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
index 63996ab03521..6672d7242d54 100644
@@ -754,6 +754,8 @@ patternProperties:
     description: OLIMEX Ltd.
   "^olpc,.*":
     description: One Laptop Per Child
+  "^oneplus,.*":
+    description: One Plus Technology (Shenzhen) Co., Ltd..
   "^onion,.*":
     description: Onion Corporation
   "^onnn,.*":
Signature · 1 line
2.28.0
#5 lore raw

PATCH 5/5 i2c: geni: sdm845: dont perform DMA for the oneplus6

In reply to Caleb Connolly

The OnePlus 6/T has the same issues as the c630 causing a crash when DMA is used for i2c, so disable it.

https://patchwork.kernel.org/patch/11133827/

---
 drivers/i2c/busses/i2c-qcom-geni.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-qcom-geni.c +4 -2
index dead5db3315a..50a0674a6553 100644
@@ -358,7 +358,8 @@ static int geni_i2c_rx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg,
 	struct geni_se *se = &gi2c->se;
 	size_t len = msg->len;
 
-	if (!of_machine_is_compatible("lenovo,yoga-c630"))
+	if (!of_machine_is_compatible("lenovo,yoga-c630") &&
+	    !of_machine_is_compatible("oneplus,oneplus6"))
 		dma_buf = i2c_get_dma_safe_msg_buf(msg, 32);
 
 	if (dma_buf)
@@ -400,7 +401,8 @@ static int geni_i2c_tx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg,
 	struct geni_se *se = &gi2c->se;
 	size_t len = msg->len;
 
-	if (!of_machine_is_compatible("lenovo,yoga-c630"))
+	if (!of_machine_is_compatible("lenovo,yoga-c630") &&
+	    !of_machine_is_compatible("oneplus,oneplus6"))
 		dma_buf = i2c_get_dma_safe_msg_buf(msg, 32);
 
 	if (dma_buf)
Signature · 1 line
2.28.0