linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] drm/panel/samsung-sofef00: Add panel for OnePlus 6/T devices
       [not found] <20201112161920.2671430-1-caleb@connolly.tech>
@ 2020-11-12 16:21 ` Caleb Connolly
  2020-11-14 19:58   ` Sam Ravnborg
  2020-11-12 16:21 ` [PATCH 2/5] dt-bindings: panel-simple-dsi: add samsung panels for OnePlus 6/T Caleb Connolly
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 19+ messages in thread
From: Caleb Connolly @ 2020-11-12 16:21 UTC (permalink / raw)
  To: linux-arm-msm, Thierry Reding, Sam Ravnborg, David Airlie, Daniel Vetter
  Cc: phone-devel, ~postmarketos/upstreaming, Caleb Connolly,
	linux-kernel, dri-devel

The OnePlus 6/T devices use different panels however they are
functionally identical with the only differences being the resolution.
The panels also don't seem to be used by any other devices, just combine
them into one driver.

The panels are: samsung,sofef00
and             samsung,s6e3fc2x01

Signed-off-by: Caleb Connolly <caleb@connolly.tech>

---

Changes since v1:
 * Rename driver to samsung-sofef00 rather than be device
 specific.
 * Make use of drm_panel backlight, simplifying the driver.
 * Make reset function do a full reset, instead of simply taking the
 panel out of reset.
 * Removed get_brightness function as it doesn't return correct data.
---
 drivers/gpu/drm/panel/Kconfig                 |  12 +
 drivers/gpu/drm/panel/Makefile                |   1 +
 drivers/gpu/drm/panel/panel-samsung-sofef00.c | 353 ++++++++++++++++++
 3 files changed, 366 insertions(+)
 create mode 100644 drivers/gpu/drm/panel/panel-samsung-sofef00.c

diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index b9dbedf8f15e..c4486b6b4e5a 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -361,6 +361,18 @@ config DRM_PANEL_SAMSUNG_S6E8AA0
 	select DRM_MIPI_DSI
 	select VIDEOMODE_HELPERS
 
+config DRM_PANEL_SAMSUNG_SOFEF00
+	tristate "Samsung sofef00/s6e3fc2x01 OnePlus 6/6T DSI cmd 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_SEIKO_43WVF1G
 	tristate "Seiko 43WVF1G panel"
 	depends on OF
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index 2ba560bca61d..ebb67f3de10e 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -38,6 +38,7 @@ obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E63M0_SPI) += panel-samsung-s6e63m0-spi.o
 obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E63M0_DSI) += panel-samsung-s6e63m0-dsi.o
 obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E88A0_AMS452EF01) += panel-samsung-s6e88a0-ams452ef01.o
 obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0) += panel-samsung-s6e8aa0.o
+obj-$(CONFIG_DRM_PANEL_SAMSUNG_SOFEF00) += panel-samsung-sofef00.o
 obj-$(CONFIG_DRM_PANEL_SEIKO_43WVF1G) += panel-seiko-43wvf1g.o
 obj-$(CONFIG_DRM_PANEL_SHARP_LQ101R1SX01) += panel-sharp-lq101r1sx01.o
 obj-$(CONFIG_DRM_PANEL_SHARP_LS037V7DW01) += panel-sharp-ls037v7dw01.o
diff --git a/drivers/gpu/drm/panel/panel-samsung-sofef00.c b/drivers/gpu/drm/panel/panel-samsung-sofef00.c
new file mode 100644
index 000000000000..84b4f4cb2e6f
--- /dev/null
+++ b/drivers/gpu/drm/panel/panel-samsung-sofef00.c
@@ -0,0 +1,353 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/* Copyright (c) 2020 Caleb Connolly <caleb@connolly.tech>
+ * Generated with linux-mdss-dsi-panel-driver-generator from vendor device tree:
+ * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ */
+
+#include <linux/delay.h>
+#include <linux/gpio/consumer.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/regulator/consumer.h>
+#include <linux/swab.h>
+#include <linux/backlight.h>
+
+#include <video/mipi_display.h>
+
+#include <drm/drm_mipi_dsi.h>
+#include <drm/drm_modes.h>
+#include <drm/drm_panel.h>
+
+struct sofef00_panel {
+	struct drm_panel panel;
+	struct mipi_dsi_device *dsi;
+	struct regulator *supply;
+	struct gpio_desc *reset_gpio;
+	const struct drm_display_mode *mode;
+	bool prepared;
+};
+
+static inline
+struct sofef00_panel *to_sofef00_panel(struct drm_panel *panel)
+{
+	return container_of(panel, struct sofef00_panel, panel);
+}
+
+#define dsi_dcs_write_seq(dsi, seq...) do {				\
+		static const u8 d[] = { seq };				\
+		int ret;						\
+		ret = mipi_dsi_dcs_write_buffer(dsi, d, ARRAY_SIZE(d));	\
+		if (ret < 0)						\
+			return ret;					\
+	} while (0)
+
+static void sofef00_panel_reset(struct sofef00_panel *ctx)
+{
+	gpiod_set_value_cansleep(ctx->reset_gpio, 0);
+	usleep_range(5000, 6000);
+	gpiod_set_value_cansleep(ctx->reset_gpio, 1);
+	usleep_range(2000, 3000);
+	gpiod_set_value_cansleep(ctx->reset_gpio, 0);
+	usleep_range(12000, 13000);
+}
+
+static int sofef00_panel_on(struct sofef00_panel *ctx)
+{
+	struct mipi_dsi_device *dsi = ctx->dsi;
+	struct device *dev = &dsi->dev;
+	int ret;
+
+	dsi->mode_flags |= MIPI_DSI_MODE_LPM;
+
+	ret = mipi_dsi_dcs_exit_sleep_mode(dsi);
+	if (ret < 0) {
+		dev_err(dev, "Failed to exit sleep mode: %d\n", ret);
+		return ret;
+	}
+	usleep_range(10000, 11000);
+
+	dsi_dcs_write_seq(dsi, 0xf0, 0x5a, 0x5a);
+
+	ret = mipi_dsi_dcs_set_tear_on(dsi, MIPI_DSI_DCS_TEAR_MODE_VBLANK);
+	if (ret < 0) {
+		dev_err(dev, "Failed to set tear on: %d\n", ret);
+		return ret;
+	}
+
+	dsi_dcs_write_seq(dsi, 0xf0, 0xa5, 0xa5);
+	dsi_dcs_write_seq(dsi, 0xf0, 0x5a, 0x5a);
+	dsi_dcs_write_seq(dsi, 0xb0, 0x07);
+	dsi_dcs_write_seq(dsi, 0xb6, 0x12);
+	dsi_dcs_write_seq(dsi, 0xf0, 0xa5, 0xa5);
+	dsi_dcs_write_seq(dsi, MIPI_DCS_WRITE_CONTROL_DISPLAY, 0x20);
+	dsi_dcs_write_seq(dsi, MIPI_DCS_WRITE_POWER_SAVE, 0x00);
+
+	ret = mipi_dsi_dcs_set_display_on(dsi);
+	if (ret < 0) {
+		dev_err(dev, "Failed to set display on: %d\n", ret);
+		return ret;
+	}
+
+	return 0;
+}
+
+static int sofef00_panel_off(struct sofef00_panel *ctx)
+{
+	struct mipi_dsi_device *dsi = ctx->dsi;
+	struct device *dev = &dsi->dev;
+	int ret;
+
+	dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
+
+	ret = mipi_dsi_dcs_set_display_off(dsi);
+	if (ret < 0) {
+		dev_err(dev, "Failed to set display off: %d\n", ret);
+		return ret;
+	}
+	msleep(40);
+
+	ret = mipi_dsi_dcs_enter_sleep_mode(dsi);
+	if (ret < 0) {
+		dev_err(dev, "Failed to enter sleep mode: %d\n", ret);
+		return ret;
+	}
+	msleep(160);
+
+	return 0;
+}
+
+static int sofef00_panel_prepare(struct drm_panel *panel)
+{
+	struct sofef00_panel *ctx = to_sofef00_panel(panel);
+	struct device *dev = &ctx->dsi->dev;
+	int ret;
+
+	if (ctx->prepared)
+		return 0;
+
+	ret = regulator_enable(ctx->supply);
+	if (ret < 0) {
+		dev_err(dev, "Failed to enable regulator: %d\n", ret);
+		return ret;
+	}
+
+	sofef00_panel_reset(ctx);
+
+	ret = sofef00_panel_on(ctx);
+	if (ret < 0) {
+		dev_err(dev, "Failed to initialize panel: %d\n", ret);
+		gpiod_set_value_cansleep(ctx->reset_gpio, 1);
+		return ret;
+	}
+
+	ctx->prepared = true;
+	return 0;
+}
+
+static int sofef00_panel_unprepare(struct drm_panel *panel)
+{
+	struct sofef00_panel *ctx = to_sofef00_panel(panel);
+	struct device *dev = &ctx->dsi->dev;
+	int ret;
+
+	if (!ctx->prepared)
+		return 0;
+
+	ret = sofef00_panel_off(ctx);
+	if (ret < 0)
+		dev_err(dev, "Failed to un-initialize panel: %d\n", ret);
+
+	regulator_disable(ctx->supply);
+
+	ctx->prepared = false;
+	return 0;
+}
+
+static const struct drm_display_mode enchilada_panel_mode = {
+	.clock = (1080 + 112 + 16 + 36) * (2280 + 36 + 8 + 12) * 60 / 1000,
+	.hdisplay = 1080,
+	.hsync_start = 1080 + 112,
+	.hsync_end = 1080 + 112 + 16,
+	.htotal = 1080 + 112 + 16 + 36,
+	.vdisplay = 2280,
+	.vsync_start = 2280 + 36,
+	.vsync_end = 2280 + 36 + 8,
+	.vtotal = 2280 + 36 + 8 + 12,
+	.width_mm = 68,
+	.height_mm = 145,
+};
+
+static const struct drm_display_mode fajita_panel_mode = {
+	.clock = (1080 + 72 + 16 + 36) * (2340 + 32 + 4 + 18) * 60 / 1000,
+	.hdisplay = 1080,
+	.hsync_start = 1080 + 72,
+	.hsync_end = 1080 + 72 + 16,
+	.htotal = 1080 + 72 + 16 + 36,
+	.vdisplay = 2340,
+	.vsync_start = 2340 + 32,
+	.vsync_end = 2340 + 32 + 4,
+	.vtotal = 2340 + 32 + 4 + 18,
+	.width_mm = 68,
+	.height_mm = 145,
+};
+
+static int sofef00_panel_get_modes(struct drm_panel *panel,
+			struct drm_connector *connector)
+{
+	struct drm_display_mode *mode;
+	struct sofef00_panel *ctx = to_sofef00_panel(panel);
+
+	mode = drm_mode_duplicate(connector->dev, ctx->mode);
+	if (!mode)
+		return -ENOMEM;
+
+	drm_mode_set_name(mode);
+
+	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
+	connector->display_info.width_mm = mode->width_mm;
+	connector->display_info.height_mm = mode->height_mm;
+	drm_mode_probed_add(connector, mode);
+
+	return 1;
+}
+
+static const struct drm_panel_funcs sofef00_panel_panel_funcs = {
+	.prepare = sofef00_panel_prepare,
+	.unprepare = sofef00_panel_unprepare,
+	.get_modes = sofef00_panel_get_modes,
+};
+
+static int sofef00_panel_bl_update_status(struct backlight_device *bl)
+{
+	struct mipi_dsi_device *dsi = bl_get_data(bl);
+	int err;
+	u16 brightness;
+
+	brightness = (u16)backlight_get_brightness(bl);
+	// This panel needs the high and low bytes swapped for the brightness value
+	brightness = __swab16(brightness);
+
+	err = mipi_dsi_dcs_set_display_brightness(dsi, brightness);
+	if (err < 0)
+		return err;
+
+	return 0;
+}
+
+static const struct backlight_ops sofef00_panel_bl_ops = {
+	.update_status = sofef00_panel_bl_update_status,
+};
+
+static struct backlight_device *
+sofef00_create_backlight(struct mipi_dsi_device *dsi)
+{
+	struct device *dev = &dsi->dev;
+	const struct backlight_properties props = {
+		.type = BACKLIGHT_PLATFORM,
+		.brightness = 1023,
+		.max_brightness = 1023,
+	};
+
+	return devm_backlight_device_register(dev, dev_name(dev), dev, dsi,
+						&sofef00_panel_bl_ops, &props);
+}
+
+
+static int sofef00_panel_probe(struct mipi_dsi_device *dsi)
+{
+	struct device *dev = &dsi->dev;
+	struct sofef00_panel *ctx;
+	int ret;
+
+	ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
+	if (!ctx)
+		return -ENOMEM;
+
+	ctx->mode = of_device_get_match_data(dev);
+
+	if (!ctx->mode) {
+		dev_err(dev, "Missing device mode\n");
+		return -ENODEV;
+	}
+
+	ctx->supply = devm_regulator_get(dev, "vddio");
+	if (IS_ERR(ctx->supply)) {
+		ret = PTR_ERR(ctx->supply);
+		dev_err(dev, "Failed to get vddio regulator: %d\n", ret);
+		return ret;
+	}
+
+	ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
+	if (IS_ERR(ctx->reset_gpio)) {
+		ret = PTR_ERR(ctx->reset_gpio);
+		dev_warn(dev, "Failed to get reset-gpios: %d\n", ret);
+		return ret;
+	}
+
+	ctx->dsi = dsi;
+	mipi_dsi_set_drvdata(dsi, ctx);
+
+	dsi->lanes = 4;
+	dsi->format = MIPI_DSI_FMT_RGB888;
+
+	drm_panel_init(&ctx->panel, dev, &sofef00_panel_panel_funcs,
+				DRM_MODE_CONNECTOR_DSI);
+
+	ctx->panel.backlight = sofef00_create_backlight(dsi);
+	if (IS_ERR(ctx->panel.backlight))
+		return dev_err_probe(dev, PTR_ERR(ctx->panel.backlight),
+					"Failed to create backlight\n");
+
+	drm_panel_add(&ctx->panel);
+
+	ret = mipi_dsi_attach(dsi);
+	if (ret < 0) {
+		dev_err(dev, "Failed to attach to DSI host: %d\n", ret);
+		return ret;
+	}
+
+	return 0;
+}
+
+static int sofef00_panel_remove(struct mipi_dsi_device *dsi)
+{
+	struct sofef00_panel *ctx = mipi_dsi_get_drvdata(dsi);
+	int ret;
+
+	ret = mipi_dsi_detach(dsi);
+	if (ret < 0)
+		dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
+
+	drm_panel_remove(&ctx->panel);
+
+	return 0;
+}
+
+static const struct of_device_id sofef00_panel_of_match[] = {
+	{ // OnePlus 6 / enchilada
+		.compatible = "samsung,sofef00",
+		.data = &enchilada_panel_mode,
+	},
+	{ // OnePlus 6T / fajita
+		.compatible = "samsung,s6e3fc2x01",
+		.data = &fajita_panel_mode,
+	},
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, sofef00_panel_of_match);
+
+static struct mipi_dsi_driver sofef00_panel_driver = {
+	.probe = sofef00_panel_probe,
+	.remove = sofef00_panel_remove,
+	.driver = {
+		.name = "panel-oneplus6",
+		.of_match_table = sofef00_panel_of_match,
+	},
+};
+
+module_mipi_dsi_driver(sofef00_panel_driver);
+
+MODULE_AUTHOR("Caleb Connolly <caleb@connolly.tech>");
+MODULE_DESCRIPTION("DRM driver for Samsung AMOLED DSI panels found in OnePlus 6/6T phones");
+MODULE_LICENSE("GPL v2");
-- 
2.29.2



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 2/5] dt-bindings: panel-simple-dsi: add samsung panels for OnePlus 6/T
       [not found] <20201112161920.2671430-1-caleb@connolly.tech>
  2020-11-12 16:21 ` [PATCH 1/5] drm/panel/samsung-sofef00: Add panel for OnePlus 6/T devices Caleb Connolly
@ 2020-11-12 16:21 ` Caleb Connolly
  2020-11-14 19:59   ` Sam Ravnborg
  2020-11-12 16:21 ` [PATCH 3/5] arm64: dts: sdm845: add oneplus 6/t devices Caleb Connolly
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 19+ messages in thread
From: Caleb Connolly @ 2020-11-12 16:21 UTC (permalink / raw)
  To: linux-arm-msm, Thierry Reding, Sam Ravnborg, David Airlie,
	Daniel Vetter, Rob Herring
  Cc: phone-devel, ~postmarketos/upstreaming, Caleb Connolly,
	dri-devel, devicetree, linux-kernel

Add compatibles for the samsung,sofef00 and samsung,s6e3fc2x01 panels
used in the OnePlus 6 & 6T respectively.

Signed-off-by: Caleb Connolly <caleb@connolly.tech>
---
 .../devicetree/bindings/display/panel/panel-simple-dsi.yaml   | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml b/Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml
index c0dd9fa29f1d..04d829177aa8 100644
--- a/Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml
+++ b/Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml
@@ -47,6 +47,10 @@ properties:
       - panasonic,vvx10f004b00
         # Panasonic 10" WUXGA TFT LCD panel
       - panasonic,vvx10f034n00
+        # Samsung sofef00 1080x2280 AMOLED panel
+      - samsung,sofef00
+        # Samsung s6e3fc2x01 1080x2340 AMOLED panel
+      - samsung,s6e3fc2x01
 
   reg:
     maxItems: 1
-- 
2.29.2



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 3/5] arm64: dts: sdm845: add oneplus 6/t devices
       [not found] <20201112161920.2671430-1-caleb@connolly.tech>
  2020-11-12 16:21 ` [PATCH 1/5] drm/panel/samsung-sofef00: Add panel for OnePlus 6/T devices Caleb Connolly
  2020-11-12 16:21 ` [PATCH 2/5] dt-bindings: panel-simple-dsi: add samsung panels for OnePlus 6/T Caleb Connolly
@ 2020-11-12 16:21 ` Caleb Connolly
  2020-11-16 22:01   ` Pavel Machek
  2020-11-21  4:28   ` Bjorn Andersson
  2020-11-12 16:21 ` [PATCH 4/5] dt-bindings: add vendor bindings for OnePlus Caleb Connolly
  2020-11-12 16:22 ` [PATCH 5/5] i2c: geni: sdm845: dont perform DMA for OnePlus 6 devices Caleb Connolly
  4 siblings, 2 replies; 19+ messages in thread
From: Caleb Connolly @ 2020-11-12 16:21 UTC (permalink / raw)
  To: linux-arm-msm, Andy Gross, Bjorn Andersson, Rob Herring,
	Kees Cook, Anton Vorontsov, Colin Cross, Tony Luck
  Cc: phone-devel, ~postmarketos/upstreaming, Caleb Connolly,
	devicetree, linux-kernel

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

* Display panels and Adreno 630
* Touch screen support with synaptics rmi4
* All remoteprocs start correctly
* WLAN / Bluetooth
* Volume / power buttons and OnePlus Tri-State switch are functional
    The tri-state switch is a 3 state mute slider on the side of the
    phone
* USB support, currently forced to peripheral as type C detection isn't
functional.

Support for this device depends on the following series:
https://lore.kernel.org/linux-iommu/20201017043907.2656013-1-bjorn.andersson@linaro.org/

Signed-off-by: Caleb Connolly <caleb@connolly.tech>
---

Changes since v1
 * Remove unused pinctrl nodes
 * Properly model touchscreen vio supply GPIO
 * Improve comments
 * Remove bq27541 battery as it doesn't work
---
 arch/arm64/boot/dts/qcom/Makefile             |   2 +
 .../boot/dts/qcom/sdm845-oneplus-common.dtsi  | 822 ++++++++++++++++++
 .../dts/qcom/sdm845-oneplus-enchilada.dts     |  19 +
 .../boot/dts/qcom/sdm845-oneplus-fajita.dts   |  23 +
 4 files changed, 866 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

diff --git a/arch/arm64/boot/dts/qcom/Makefile b/arch/arm64/boot/dts/qcom/Makefile
index fb4631f898fd..f45eddfb7dc5 100644
--- a/arch/arm64/boot/dts/qcom/Makefile
+++ b/arch/arm64/boot/dts/qcom/Makefile
@@ -40,6 +40,8 @@ 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-xiaomi-beryllium.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
diff --git a/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi b/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
new file mode 100644
index 000000000000..4e6477f1e574
--- /dev/null
+++ b/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
@@ -0,0 +1,822 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * SDM845 OnePlus 6(T) (enchilada / fajita) common device tree source
+ *
+ * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ */
+
+/dts-v1/;
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/regulator/qcom,rpmh-regulator.h>
+#include <dt-bindings/input/linux-event-codes.h>
+#include "sdm845.dtsi"
+
+// Needed for some GPIO (like the volume buttons)
+#include "pm8998.dtsi"
+#include "pmi8998.dtsi"
+
+/ {
+
+	aliases {
+		hsuart0 = &uart6;
+	};
+
+	vph_pwr: vph-pwr-regulator {
+		compatible = "regulator-fixed";
+		regulator-name = "vph_pwr";
+		regulator-min-microvolt = <3700000>;
+		regulator-max-microvolt = <3700000>;
+	};
+
+	/*
+	 * Apparently RPMh does not provide support for PM8998 S4 because it
+	 * is always-on; model it as a fixed regulator.
+	 */
+	vreg_s4a_1p8: pm8998-smps4 {
+		compatible = "regulator-fixed";
+		regulator-name = "vreg_s4a_1p8";
+
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+
+		regulator-always-on;
+		regulator-boot-on;
+
+		vin-supply = <&vph_pwr>;
+	};
+
+	/*
+	 * The touchscreen regulator seems to be controlled somehow by a gpio.
+	 */
+	ts_1p8_supply: ts_1v8_regulator {
+		compatible = "regulator-fixed";
+		regulator-name = "ts_1p8_supply";
+
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+
+		gpio = <&tlmm 88 0>;
+		enable-active-high;
+		regulator-boot-on;
+	};
+
+	gpio_tristate_key: gpio-keys {
+		compatible = "gpio-keys";
+		label = "Tri-state keys";
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&tri_state_key_default>;
+
+		state-top {
+			label = "Tri-state key top";
+			linux,code = <KEY_MACRO1>;
+			interrupt-parent = <&tlmm>;
+			interrupts = <24 IRQ_TYPE_EDGE_FALLING>;
+			debounce-interval = <500>;
+			linux,can-disable;
+		};
+
+		state-middle {
+			label = "Tri-state key middle";
+			linux,code = <KEY_MACRO2>;
+			interrupt-parent = <&tlmm>;
+			interrupts = <52 IRQ_TYPE_EDGE_FALLING>;
+			debounce-interval = <500>;
+			linux,can-disable;
+		};
+
+		state-bottom {
+			label = "Tri-state key bottom";
+			linux,code = <KEY_MACRO3>;
+			interrupt-parent = <&tlmm>;
+			interrupts = <126 IRQ_TYPE_EDGE_FALLING>;
+			debounce-interval = <500>;
+			linux,can-disable;
+		};
+	};
+
+	gpio_vol_keys: gpio-keys {
+		compatible = "gpio-keys";
+		label = "Volume keys";
+		autorepeat;
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&volume_down_gpio &volume_up_gpio>;
+
+		vol-down {
+			label = "Volume down";
+			linux,code = <KEY_VOLUMEDOWN>;
+			gpios = <&pm8998_gpio 5 GPIO_ACTIVE_LOW>;
+			debounce-interval = <15>;
+		};
+
+		vol-up {
+			label = "Volume up";
+			linux,code = <KEY_VOLUMEUP>;
+			gpios = <&pm8998_gpio 6 GPIO_ACTIVE_LOW>;
+			debounce-interval = <15>;
+		};
+	};
+
+	extcon_usb1_detect: extcon-usb-1 {
+		compatible = "linux,extcon-usb-gpio";
+		id-gpio = <&tlmm 38 GPIO_ACTIVE_HIGH>;
+	};
+};
+
+&apps_rsc {
+	pm8998-rpmh-regulators {
+		compatible = "qcom,pm8998-rpmh-regulators";
+		qcom,pmic-id = "a";
+
+		vdd-s1-supply = <&vph_pwr>;
+		vdd-s2-supply = <&vph_pwr>;
+		vdd-s3-supply = <&vph_pwr>;
+		vdd-s4-supply = <&vph_pwr>;
+		vdd-s5-supply = <&vph_pwr>;
+		vdd-s6-supply = <&vph_pwr>;
+		vdd-s7-supply = <&vph_pwr>;
+		vdd-s8-supply = <&vph_pwr>;
+		vdd-s9-supply = <&vph_pwr>;
+		vdd-s10-supply = <&vph_pwr>;
+		vdd-s11-supply = <&vph_pwr>;
+		vdd-s12-supply = <&vph_pwr>;
+		vdd-s13-supply = <&vph_pwr>;
+		vdd-l1-l27-supply = <&vreg_s7a_1p025>;
+		vdd-l2-l8-l17-supply = <&vreg_s3a_1p35>;
+		vdd-l3-l11-supply = <&vreg_s7a_1p025>;
+		vdd-l4-l5-supply = <&vreg_s7a_1p025>;
+		vdd-l6-supply = <&vph_pwr>;
+		vdd-l7-l12-l14-l15-supply = <&vreg_s5a_2p04>;
+		vdd-l9-supply = <&vreg_bob>;
+		vdd-l10-l23-l25-supply = <&vreg_bob>;
+		vdd-l13-l19-l21-supply = <&vreg_bob>;
+		vdd-l16-l28-supply = <&vreg_bob>;
+		vdd-l18-l22-supply = <&vreg_bob>;
+		vdd-l20-l24-supply = <&vreg_bob>;
+		vdd-l26-supply = <&vreg_s3a_1p35>;
+		vin-lvs-1-2-supply = <&vreg_s4a_1p8>;
+
+		vreg_s2a_1p125: smps2 {
+			regulator-min-microvolt = <1100000>;
+			regulator-max-microvolt = <1100000>;
+		};
+
+		vreg_s3a_1p35: smps3 {
+			regulator-min-microvolt = <1352000>;
+			regulator-max-microvolt = <1352000>;
+		};
+
+		vreg_s5a_2p04: smps5 {
+			regulator-min-microvolt = <1904000>;
+			regulator-max-microvolt = <2040000>;
+		};
+
+		vreg_s7a_1p025: smps7 {
+			regulator-min-microvolt = <900000>;
+			regulator-max-microvolt = <1028000>;
+		};
+
+		vdd_qusb_hs0:
+		vdda_hp_pcie_core:
+		vdda_mipi_csi0_0p9:
+		vdda_mipi_csi1_0p9:
+		vdda_mipi_csi2_0p9:
+		vdda_mipi_dsi0_pll:
+		vdda_mipi_dsi1_pll:
+		vdda_qlink_lv:
+		vdda_qlink_lv_ck:
+		vdda_qrefs_0p875:
+		vdda_pcie_core:
+		vdda_pll_cc_ebi01:
+		vdda_pll_cc_ebi23:
+		vdda_sp_sensor:
+		vdda_ufs1_core:
+		vdda_ufs2_core:
+		vdda_usb1_ss_core:
+		vdda_usb2_ss_core:
+		vreg_l1a_0p875: ldo1 {
+			regulator-min-microvolt = <880000>;
+			regulator-max-microvolt = <880000>;
+			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+		};
+
+		vddpx_10:
+		vreg_l2a_1p2: ldo2 {
+			regulator-min-microvolt = <1200000>;
+			regulator-max-microvolt = <1200000>;
+			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+			regulator-always-on;
+		};
+
+		vreg_l3a_1p0: ldo3 {
+			regulator-min-microvolt = <1000000>;
+			regulator-max-microvolt = <1000000>;
+			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+		};
+
+		vdd_wcss_cx:
+		vdd_wcss_mx:
+		vdda_wcss_pll:
+		vreg_l5a_0p8: ldo5 {
+			regulator-min-microvolt = <800000>;
+			regulator-max-microvolt = <800000>;
+			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+		};
+
+		vddpx_13:
+		vreg_l6a_1p8: ldo6 {
+			regulator-min-microvolt = <1856000>;
+			regulator-max-microvolt = <1856000>;
+			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+		};
+
+		vreg_l7a_1p8: ldo7 {
+			regulator-min-microvolt = <1800000>;
+			regulator-max-microvolt = <1800000>;
+			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+		};
+
+		vreg_l8a_1p2: ldo8 {
+			regulator-min-microvolt = <1200000>;
+			regulator-max-microvolt = <1248000>;
+			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+		};
+
+		vreg_l9a_1p8: ldo9 {
+			regulator-min-microvolt = <1704000>;
+			regulator-max-microvolt = <2928000>;
+			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+		};
+
+		vreg_l10a_1p8: ldo10 {
+			regulator-min-microvolt = <1704000>;
+			regulator-max-microvolt = <2928000>;
+			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+		};
+
+		vreg_l11a_1p0: ldo11 {
+			regulator-min-microvolt = <1000000>;
+			regulator-max-microvolt = <1048000>;
+			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+		};
+
+		vdd_qfprom:
+		vdd_qfprom_sp:
+		vdda_apc1_cs_1p8:
+		vdda_gfx_cs_1p8:
+		vdda_qrefs_1p8:
+		vdda_qusb_hs0_1p8:
+		vddpx_11:
+		vreg_l12a_1p8: ldo12 {
+			regulator-min-microvolt = <1800000>;
+			regulator-max-microvolt = <1800000>;
+			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+		};
+
+		vddpx_2:
+		vreg_l13a_2p95: ldo13 {
+			regulator-min-microvolt = <1800000>;
+			regulator-max-microvolt = <2960000>;
+			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+		};
+
+		vreg_l14a_1p88: ldo14 {
+			regulator-min-microvolt = <1800000>;
+			regulator-max-microvolt = <1800000>;
+			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+			regulator-always-on;
+		};
+
+		vreg_l15a_1p8: ldo15 {
+			regulator-min-microvolt = <1800000>;
+			regulator-max-microvolt = <1800000>;
+			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+		};
+
+		vreg_l16a_2p7: ldo16 {
+			regulator-min-microvolt = <2704000>;
+			regulator-max-microvolt = <2704000>;
+			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+		};
+
+		vreg_l17a_1p3: ldo17 {
+			regulator-min-microvolt = <1304000>;
+			regulator-max-microvolt = <1304000>;
+			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+		};
+
+		vreg_l18a_2p7: ldo18 {
+			regulator-min-microvolt = <2704000>;
+			regulator-max-microvolt = <2960000>;
+			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+		};
+
+		vreg_l19a_3p0: ldo19 {
+			regulator-min-microvolt = <2856000>;
+			regulator-max-microvolt = <3104000>;
+			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+		};
+
+		vreg_l20a_2p95: ldo20 {
+			regulator-min-microvolt = <2704000>;
+			regulator-max-microvolt = <2960000>;
+			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+		};
+
+		vreg_l21a_2p95: ldo21 {
+			regulator-min-microvolt = <2704000>;
+			regulator-max-microvolt = <2960000>;
+			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+		};
+
+		vreg_l22a_2p85: ldo22 {
+			regulator-min-microvolt = <2864000>;
+			regulator-max-microvolt = <3312000>;
+			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+		};
+
+		vreg_l23a_3p3: ldo23 {
+			regulator-min-microvolt = <3000000>;
+			regulator-max-microvolt = <3312000>;
+			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+		};
+
+		vdda_qusb_hs0_3p1:
+		vreg_l24a_3p075: ldo24 {
+			regulator-min-microvolt = <3088000>;
+			regulator-max-microvolt = <3088000>;
+			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+		};
+
+		vreg_l25a_3p3: ldo25 {
+			regulator-min-microvolt = <3300000>;
+			regulator-max-microvolt = <3312000>;
+			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+		};
+
+		vdda_hp_pcie_1p2:
+		vdda_hv_ebi0:
+		vdda_hv_ebi1:
+		vdda_hv_ebi2:
+		vdda_hv_ebi3:
+		vdda_mipi_csi_1p25:
+		vdda_mipi_dsi0_1p2:
+		vdda_mipi_dsi1_1p2:
+		vdda_pcie_1p2:
+		vdda_ufs1_1p2:
+		vdda_ufs2_1p2:
+		vdda_usb1_ss_1p2:
+		vdda_usb2_ss_1p2:
+		vreg_l26a_1p2: ldo26 {
+			regulator-min-microvolt = <1200000>;
+			regulator-max-microvolt = <1200000>;
+			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+		};
+
+		vreg_l28a_3p0: ldo28 {
+			regulator-min-microvolt = <2856000>;
+			regulator-max-microvolt = <3008000>;
+			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+		};
+
+		vreg_lvs1a_1p8: lvs1 {
+			regulator-min-microvolt = <1800000>;
+			regulator-max-microvolt = <1800000>;
+		};
+
+		vreg_lvs2a_1p8: lvs2 {
+			regulator-min-microvolt = <1800000>;
+			regulator-max-microvolt = <1800000>;
+		};
+	};
+
+	pmi8998-rpmh-regulators {
+		compatible = "qcom,pmi8998-rpmh-regulators";
+		qcom,pmic-id = "b";
+
+		vdd-bob-supply = <&vph_pwr>;
+
+		vreg_bob: bob {
+			regulator-min-microvolt = <3312000>;
+			regulator-max-microvolt = <3600000>;
+			regulator-initial-mode = <RPMH_REGULATOR_MODE_AUTO>;
+			regulator-allow-bypass;
+		};
+	};
+
+	pm8005-rpmh-regulators {
+		compatible = "qcom,pm8005-rpmh-regulators";
+		qcom,pmic-id = "c";
+
+		vdd-s1-supply = <&vph_pwr>;
+		vdd-s2-supply = <&vph_pwr>;
+		vdd-s3-supply = <&vph_pwr>;
+		vdd-s4-supply = <&vph_pwr>;
+
+		vreg_s3c_0p6: smps3 {
+			regulator-min-microvolt = <600000>;
+			regulator-max-microvolt = <600000>;
+		};
+	};
+};
+
+/* Reserved memory changes */
+/delete-node/ &rmtfs_mem;
+
+/ {
+	reserved-memory {
+		/*
+		 * The rmtfs memory region in downstream is 'dynamically allocated'
+		 * but given the same address every time. Hard code it as this address is
+		 * where the modem firmware expects it to be.
+		 */
+		rmtfs_mem: memory@f5b01000 {
+			compatible = "qcom,rmtfs-mem";
+			reg = <0 0xf5b01000 0 0x200000>;
+			no-map;
+
+			qcom,client-id = <1>;
+			qcom,vmid = <15>;
+		};
+
+		/*
+		 * This must be reserved as the device will
+		 * crash if memory is allocated here due to
+		 * vendor quirks.
+		 */
+		removed_region: memory@88f00000 {
+			no-map;
+			reg = <0 0x88f00000 0 0x1c00000>;
+		};
+
+		ramoops: ramoops@ac300000 {
+			compatible = "ramoops";
+			reg = <0 0xac300000 0 0x400000>;
+			record-size = <0x40000>;
+			console-size = <0x40000>;
+			ftrace-size = <0x40000>;
+			pmsg-size = <0x200000>;
+			devinfo-size = <0x1000>;
+			ecc-size = <16>;
+		};
+	};
+};
+
+&gcc {
+	protected-clocks = <GCC_QSPI_CORE_CLK>,
+				<GCC_QSPI_CORE_CLK_SRC>,
+				<GCC_QSPI_CNOC_PERIPH_AHB_CLK>,
+				<GCC_LPASS_Q6_AXI_CLK>,
+				<GCC_LPASS_SWAY_CLK>;
+};
+
+&gpu {
+	zap-shader {
+		memory-region = <&gpu_mem>;
+		firmware-name = "qcom/sdm845/oneplus6/a630_zap.mbn";
+	};
+};
+
+&adsp_pas {
+	status = "okay";
+	firmware-name = "qcom/sdm845/oneplus6/adsp.mbn";
+};
+
+&cdsp_pas {
+	status = "okay";
+	firmware-name = "qcom/sdm845/oneplus6/cdsp.mbn";
+};
+
+/* Modem/wifi*/
+&mss_pil {
+	status = "okay";
+	firmware-name = "qcom/sdm845/oneplus6/mba.mbn", "qcom/sdm845/oneplus6/modem.mbn";
+};
+
+&uart6 {
+	status = "okay";
+
+	bluetooth {
+		compatible = "qcom,wcn3990-bt";
+
+		/* This path is relative to the qca/
+		 * subdir under lib/firmware.
+		 */
+		firmware-name = "oneplus6/crnv21.bin";
+
+		vddio-supply = <&vreg_s4a_1p8>;
+		vddxo-supply = <&vreg_l7a_1p8>;
+		vddrf-supply = <&vreg_l17a_1p3>;
+		vddch0-supply = <&vreg_l25a_3p3>;
+		max-speed = <3200000>;
+	};
+};
+
+&qup_uart6_default {
+	pinmux {
+		pins = "gpio45", "gpio46", "gpio47", "gpio48";
+		function = "qup6";
+	};
+
+	cts {
+		pins = "gpio45";
+		bias-pull-down;
+	};
+
+	rts-tx {
+		pins = "gpio46", "gpio47";
+		drive-strength = <2>;
+		bias-disable;
+	};
+
+	rx {
+		pins = "gpio48";
+		bias-pull-up;
+	};
+};
+
+&ufs_mem_hc {
+	status = "okay";
+
+	reset-gpios = <&tlmm 150 GPIO_ACTIVE_LOW>;
+
+	vcc-supply = <&vreg_l20a_2p95>;
+	vcc-max-microamp = <600000>;
+};
+
+&ufs_mem_phy {
+	status = "okay";
+
+	vdda-phy-supply = <&vdda_ufs1_core>;
+	vdda-pll-supply = <&vdda_ufs1_1p2>;
+};
+
+&usb_1 {
+	status = "okay";
+
+	/*
+	 * disable USB3 clock requirement as the device only supports
+	 * USB2.
+	 */
+	qcom,select-utmi-as-pipe-clk;
+};
+
+&usb_1_dwc3 {
+	/*
+	 * We don't have the capability to switch modes yet.
+	 */
+	dr_mode = "peripheral";
+
+	/* fastest mode for USB 2 */
+	maximum-speed = "high-speed";
+
+	extcon = <&extcon_usb1_detect>;
+
+	/* Remove USB3 phy as it's unused on this device. */
+	phys = <&usb_1_hsphy>;
+	phy-names = "usb2-phy";
+};
+
+&usb_1_hsphy {
+	status = "okay";
+
+	vdd-supply = <&vdda_usb1_ss_core>;
+	vdda-pll-supply = <&vdda_qusb_hs0_1p8>;
+	vdda-phy-dpdm-supply = <&vdda_qusb_hs0_3p1>;
+
+	qcom,imp-res-offset-value = <8>;
+	qcom,hstx-trim-value = <QUSB2_V2_HSTX_TRIM_21_6_MA>;
+	qcom,preemphasis-level = <QUSB2_V2_PREEMPHASIS_5_PERCENT>;
+	qcom,preemphasis-width = <QUSB2_V2_PREEMPHASIS_WIDTH_HALF_BIT>;
+};
+
+&wifi {
+	status = "okay";
+	vdd-0.8-cx-mx-supply = <&vreg_l5a_0p8>;
+	vdd-1.8-xo-supply = <&vreg_l7a_1p8>;
+	vdd-1.3-rfa-supply = <&vreg_l17a_1p3>;
+	vdd-3.3-ch0-supply = <&vreg_l25a_3p3>;
+
+	qcom,snoc-host-cap-8bit-quirk;
+};
+
+&mdss {
+	status = "okay";
+};
+
+&mdss_mdp {
+	status = "okay";
+};
+
+&dsi0 {
+	status = "okay";
+	vdda-supply = <&vdda_mipi_dsi0_1p2>;
+
+	#address-cells = <1>;
+	#size-cells = <0>;
+
+	/*
+	 * Both devices use different panels but all other properties
+	 * are common. Compatible line is declared in device dts.
+	 */
+	display_panel: panel@0 {
+		status = "disabled";
+
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0>;
+
+		vddio-supply = <&vreg_l14a_1p88>;
+
+		reset-gpios = <&tlmm 6 GPIO_ACTIVE_LOW>;
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&panel_reset_pins &panel_te_pin &panel_esd_pin>;
+
+		port {
+			panel_in: endpoint {
+				remote-endpoint = <&dsi0_out>;
+			};
+		};
+	};
+};
+
+&dsi0_out {
+	remote-endpoint = <&panel_in>;
+	data-lanes = <0 1 2 3>;
+};
+
+&dsi0_phy {
+	status = "okay";
+	vdds-supply = <&vdda_mipi_dsi0_pll>;
+};
+
+&qupv3_id_1 {
+	status = "okay";
+};
+
+&qupv3_id_0 {
+	status = "okay";
+};
+
+&i2c12 {
+	status = "okay";
+
+	touchscreen: synaptics-rmi4-i2c@20 {
+		compatible = "syna,rmi4-i2c";
+		reg = <0x20>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		interrupts-extended = <&tlmm 125 IRQ_TYPE_EDGE_FALLING>;
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&ts_default_pins>;
+
+		vdd-supply = <&vreg_l28a_3p0>;
+		vio-supply = <&ts_1p8_supply>;
+
+		syna,reset-delay-ms = <200>;
+		syna,startup-delay-ms = <200>;
+
+		rmi4-f01@1 {
+			reg = <0x01>;
+			syna,nosleep-mode = <1>;
+		};
+
+		rmi4_f12: rmi4-f12@12 {
+			reg = <0x12>;
+			touchscreen-x-mm = <68>;
+			touchscreen-y-mm = <144>;
+			syna,sensor-type = <1>;
+			syna,rezero-wait-ms = <200>;
+		};
+	};
+};
+
+&qup_i2c12_default {
+	mux {
+		pins = "gpio49", "gpio50";
+		function = "qup12";
+	};
+	config {
+		pins = "gpio49", "gpio50";
+		drive-strength = <2>;
+		bias-disable;
+	};
+};
+
+&qup_i2c10_default {
+	pinconf {
+		pins = "gpio55", "gpio56";
+		drive-strength = <2>;
+		bias-disable;
+	};
+};
+
+&qup_uart9_default {
+	pinconf-tx {
+		pins = "gpio4";
+		drive-strength = <2>;
+		bias-disable;
+	};
+
+	pinconf-rx {
+		pins = "gpio5";
+		drive-strength = <2>;
+		bias-pull-up;
+	};
+};
+
+&pm8998_gpio {
+	volume_down_gpio: pm8998_gpio5 {
+		pinconf {
+			pins = "gpio5";
+			function = "normal";
+			input-enable;
+			bias-pull-up;
+			qcom,drive-strength = <0>;
+		};
+	};
+
+	volume_up_gpio: pm8998_gpio6 {
+		pinconf {
+			pins = "gpio6";
+			function = "normal";
+			input-enable;
+			bias-pull-up;
+			qcom,drive-strength = <0>;
+		};
+	};
+};
+
+&tlmm {
+	gpio-reserved-ranges = <0 4>, <81 4>;
+
+	tri_state_key_default: tri_state_key_default {
+		mux {
+			pins = "gpio40", "gpio42", "gpio26";
+			function = "gpio";
+		};
+
+		config {
+			pins = "gpio40", "gpio42", "gpio26";
+			drive-strength = <2>;
+			bias-disable;
+		};
+	};
+
+	ts_default_pins: ts-int {
+		mux {
+			pins = "gpio99", "gpio125";
+			function = "gpio";
+		};
+
+		config {
+			pins = "gpio99", "gpio125";
+			drive-strength = <16>;
+			bias-pull-up;
+		};
+	};
+
+	panel_reset_pins: panel-reset {
+		mux {
+			pins = "gpio6", "gpio25", "gpio26";
+			function = "gpio";
+		};
+
+		config {
+			pins = "gpio6", "gpio25", "gpio26";
+			drive-strength = <8>;
+			bias-disable = <0>;
+		};
+	};
+
+	panel_te_pin: panel-te {
+		mux {
+			pins = "gpio10";
+			function = "mdp_vsync";
+		};
+
+		config {
+			pins = "gpio10";
+			drive-strength = <2>;
+			bias-disable;
+			input-enable;
+		};
+	};
+
+	panel_esd_pin: panel-esd {
+		mux {
+			pins = "gpio30";
+			function = "gpio";
+		};
+		config {
+			pins = "gpio30";
+			drive-strength = <2>;
+			bias-pull-down;
+			input-enable;
+		};
+	};
+};
diff --git a/arch/arm64/boot/dts/qcom/sdm845-oneplus-enchilada.dts b/arch/arm64/boot/dts/qcom/sdm845-oneplus-enchilada.dts
new file mode 100644
index 000000000000..a02f1b99a64f
--- /dev/null
+++ b/arch/arm64/boot/dts/qcom/sdm845-oneplus-enchilada.dts
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * SDM845 OnePlus 6 (enchilada) 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";
+};
diff --git a/arch/arm64/boot/dts/qcom/sdm845-oneplus-fajita.dts b/arch/arm64/boot/dts/qcom/sdm845-oneplus-fajita.dts
new file mode 100644
index 000000000000..3a05e3b64c03
--- /dev/null
+++ b/arch/arm64/boot/dts/qcom/sdm845-oneplus-fajita.dts
@@ -0,0 +1,23 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * SDM845 OnePlus 6T (fajita) 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";
+};
+
+&rmi4_f12 {
+	touchscreen-y-mm = <148>;
+};
-- 
2.29.2



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 4/5] dt-bindings: add vendor bindings for OnePlus
       [not found] <20201112161920.2671430-1-caleb@connolly.tech>
                   ` (2 preceding siblings ...)
  2020-11-12 16:21 ` [PATCH 3/5] arm64: dts: sdm845: add oneplus 6/t devices Caleb Connolly
@ 2020-11-12 16:21 ` Caleb Connolly
  2020-11-16 14:47   ` Rob Herring
  2020-11-16 14:53   ` Rob Herring
  2020-11-12 16:22 ` [PATCH 5/5] i2c: geni: sdm845: dont perform DMA for OnePlus 6 devices Caleb Connolly
  4 siblings, 2 replies; 19+ messages in thread
From: Caleb Connolly @ 2020-11-12 16:21 UTC (permalink / raw)
  To: linux-arm-msm, Rob Herring, Caleb Connolly
  Cc: phone-devel, ~postmarketos/upstreaming, Rob Herring, devicetree,
	linux-kernel

Used by the OnePlus 6/T device trees

Signed-off-by: Caleb Connolly <caleb@connolly.tech>
---
 .../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

diff --git a/Documentation/devicetree/bindings/arm/oneplus/oneplus-boards.yaml b/Documentation/devicetree/bindings/arm/oneplus/oneplus-boards.yaml
new file mode 100644
index 000000000000..a4d9bbd5681f
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/oneplus/oneplus-boards.yaml
@@ -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 <caleb@connolly.tech>
+
+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
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml
index 2735be1a8470..372c1136081e 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.yaml
+++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml
@@ -768,6 +768,8 @@ patternProperties:
     description: OLIMEX Ltd.
   "^olpc,.*":
     description: One Laptop Per Child
+  "^oneplus,.*":
+    description: One Plus Technology (Shenzhen) Co., Ltd.
   "^onion,.*":
     description: Onion Corporation
   "^onnn,.*":
-- 
2.29.2



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 5/5] i2c: geni: sdm845: dont perform DMA for OnePlus 6 devices
       [not found] <20201112161920.2671430-1-caleb@connolly.tech>
                   ` (3 preceding siblings ...)
  2020-11-12 16:21 ` [PATCH 4/5] dt-bindings: add vendor bindings for OnePlus Caleb Connolly
@ 2020-11-12 16:22 ` Caleb Connolly
  2020-11-17 11:47   ` Akash Asthana
  2020-11-22  3:47   ` Bjorn Andersson
  4 siblings, 2 replies; 19+ messages in thread
From: Caleb Connolly @ 2020-11-12 16:22 UTC (permalink / raw)
  To: linux-arm-msm, Andy Gross, Bjorn Andersson, Akash Asthana,
	Mukesh Savaliya
  Cc: phone-devel, ~postmarketos/upstreaming, Caleb Connolly,
	linux-i2c, linux-kernel

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

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

Signed-off-by: Caleb Connolly <caleb@connolly.tech>
---
 drivers/i2c/busses/i2c-qcom-geni.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c
index 8b4c35f47a70..9acdcfe73be2 100644
--- a/drivers/i2c/busses/i2c-qcom-geni.c
+++ b/drivers/i2c/busses/i2c-qcom-geni.c
@@ -357,7 +357,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)
@@ -399,7 +400,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)
-- 
2.29.2



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH 1/5] drm/panel/samsung-sofef00: Add panel for OnePlus 6/T devices
  2020-11-12 16:21 ` [PATCH 1/5] drm/panel/samsung-sofef00: Add panel for OnePlus 6/T devices Caleb Connolly
@ 2020-11-14 19:58   ` Sam Ravnborg
  0 siblings, 0 replies; 19+ messages in thread
From: Sam Ravnborg @ 2020-11-14 19:58 UTC (permalink / raw)
  To: Caleb Connolly
  Cc: linux-arm-msm, Thierry Reding, David Airlie, Daniel Vetter,
	phone-devel, ~postmarketos/upstreaming, linux-kernel, dri-devel

Hi Caleb,
On Thu, Nov 12, 2020 at 04:21:13PM +0000, Caleb Connolly wrote:
> The OnePlus 6/T devices use different panels however they are
> functionally identical with the only differences being the resolution.
> The panels also don't seem to be used by any other devices, just combine
> them into one driver.
> 
> The panels are: samsung,sofef00
> and             samsung,s6e3fc2x01
> 
> Signed-off-by: Caleb Connolly <caleb@connolly.tech>

Thanks, applied to drm-misc-next.
Fixed a few checkpatch --strict warnings when applying.
Please check with --strict in the future.

	Sam

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/5] dt-bindings: panel-simple-dsi: add samsung panels for OnePlus 6/T
  2020-11-12 16:21 ` [PATCH 2/5] dt-bindings: panel-simple-dsi: add samsung panels for OnePlus 6/T Caleb Connolly
@ 2020-11-14 19:59   ` Sam Ravnborg
  0 siblings, 0 replies; 19+ messages in thread
From: Sam Ravnborg @ 2020-11-14 19:59 UTC (permalink / raw)
  To: Caleb Connolly
  Cc: linux-arm-msm, Thierry Reding, David Airlie, Daniel Vetter,
	Rob Herring, phone-devel, ~postmarketos/upstreaming, dri-devel,
	devicetree, linux-kernel

Hi Caleb,
On Thu, Nov 12, 2020 at 04:21:30PM +0000, Caleb Connolly wrote:
> Add compatibles for the samsung,sofef00 and samsung,s6e3fc2x01 panels
> used in the OnePlus 6 & 6T respectively.
> 
> Signed-off-by: Caleb Connolly <caleb@connolly.tech>

Thansk, applied to drm-misc-next.
Fixed so entries are sorted alphabetically when applying.

	Sam

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 4/5] dt-bindings: add vendor bindings for OnePlus
  2020-11-12 16:21 ` [PATCH 4/5] dt-bindings: add vendor bindings for OnePlus Caleb Connolly
@ 2020-11-16 14:47   ` Rob Herring
  2020-11-16 14:53   ` Rob Herring
  1 sibling, 0 replies; 19+ messages in thread
From: Rob Herring @ 2020-11-16 14:47 UTC (permalink / raw)
  To: Caleb Connolly
  Cc: phone-devel, devicetree, ~postmarketos/upstreaming,
	linux-arm-msm, Rob Herring, linux-kernel

On Thu, 12 Nov 2020 16:21:54 +0000, Caleb Connolly wrote:
> Used by the OnePlus 6/T device trees
> 
> Signed-off-by: Caleb Connolly <caleb@connolly.tech>
> ---
>  .../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
> 


My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/arm/oneplus/oneplus-boards.yaml: 'additionalProperties' is a required property
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/arm/oneplus/oneplus-boards.yaml: ignoring, error in schema: 
warning: no schema found in file: ./Documentation/devicetree/bindings/arm/oneplus/oneplus-boards.yaml


See https://patchwork.ozlabs.org/patch/1399086

The base for the patch is generally the last rc1. Any dependencies
should be noted.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit.


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 4/5] dt-bindings: add vendor bindings for OnePlus
  2020-11-12 16:21 ` [PATCH 4/5] dt-bindings: add vendor bindings for OnePlus Caleb Connolly
  2020-11-16 14:47   ` Rob Herring
@ 2020-11-16 14:53   ` Rob Herring
  1 sibling, 0 replies; 19+ messages in thread
From: Rob Herring @ 2020-11-16 14:53 UTC (permalink / raw)
  To: Caleb Connolly
  Cc: linux-arm-msm, phone-devel, ~postmarketos/upstreaming,
	devicetree, linux-kernel

On Thu, Nov 12, 2020 at 04:21:54PM +0000, Caleb Connolly wrote:
> Used by the OnePlus 6/T device trees
> 
> Signed-off-by: Caleb Connolly <caleb@connolly.tech>
> ---
>  .../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
> 
> diff --git a/Documentation/devicetree/bindings/arm/oneplus/oneplus-boards.yaml b/Documentation/devicetree/bindings/arm/oneplus/oneplus-boards.yaml
> new file mode 100644
> index 000000000000..a4d9bbd5681f
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/arm/oneplus/oneplus-boards.yaml
> @@ -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 <caleb@connolly.tech>
> +
> +properties:
> +  $nodename:
> +    const: '/'
> +  compatible:
> +    oneOf:
> +      - description: SDM845 based boards

There should be a sdm845 fallback compatible. Also, board level 
compatibles are documented in a per SoC family schema (qcom.yaml) which 
should already define the fallback.

> +        items:
> +          - enum:
> +              - oneplus,enchilada               # OnePlus 6
> +              - oneplus,fajita                  # OnePlus 6T
> +          - const: oneplus,oneplus6             # OnePlus 6 and derivatives

With a SoC fallback, having this as a 3rd compatible probably isn't too 
useful. 3 levels of compatible is mainly done when there's a SoM plus 
baseboard.

> +
> +required:
> +  - compatible
> diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml
> index 2735be1a8470..372c1136081e 100644
> --- a/Documentation/devicetree/bindings/vendor-prefixes.yaml
> +++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml
> @@ -768,6 +768,8 @@ patternProperties:
>      description: OLIMEX Ltd.
>    "^olpc,.*":
>      description: One Laptop Per Child
> +  "^oneplus,.*":
> +    description: One Plus Technology (Shenzhen) Co., Ltd.
>    "^onion,.*":
>      description: Onion Corporation
>    "^onnn,.*":
> -- 
> 2.29.2
> 
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 3/5] arm64: dts: sdm845: add oneplus 6/t devices
  2020-11-12 16:21 ` [PATCH 3/5] arm64: dts: sdm845: add oneplus 6/t devices Caleb Connolly
@ 2020-11-16 22:01   ` Pavel Machek
  2020-11-16 23:49     ` Caleb Connolly
  2020-11-21  4:28   ` Bjorn Andersson
  1 sibling, 1 reply; 19+ messages in thread
From: Pavel Machek @ 2020-11-16 22:01 UTC (permalink / raw)
  To: Caleb Connolly
  Cc: linux-arm-msm, Andy Gross, Bjorn Andersson, Rob Herring,
	Kees Cook, Anton Vorontsov, Colin Cross, Tony Luck, phone-devel,
	~postmarketos/upstreaming, devicetree, linux-kernel

Hi!

> Add initial support for the OnePlus 6 (enchilada) and 6T (fajita) based
> on the sdm845-mtp DT. Support includes:
> 
> * Display panels and Adreno 630
> * Touch screen support with synaptics rmi4
> * All remoteprocs start correctly
> * WLAN / Bluetooth
> * Volume / power buttons and OnePlus Tri-State switch are functional
>     The tri-state switch is a 3 state mute slider on the side of the phone * USB 
> support, currently forced to peripheral as type C detection isn't functional.

I have similar switches on my joystick... but I don't believe modelling it as 3 separate
keys with "macro" keysym is the right way to go.

> +		state-top {
> +			label = "Tri-state key top";
> +			linux,code = <KEY_MACRO1>;
> +			interrupt-parent = <&tlmm>;
> +			interrupts = <24 IRQ_TYPE_EDGE_FALLING>;
> +			debounce-interval = <500>;
> +			linux,can-disable;
> +		};
> +
> +		state-middle {
> +			label = "Tri-state key middle";
> +			linux,code = <KEY_MACRO2>;
> +			interrupt-parent = <&tlmm>;
> +			interrupts = <52 IRQ_TYPE_EDGE_FALLING>;
> +			debounce-interval = <500>;
> +			linux,can-disable;
> +		};
> +
> +		state-bottom {
> +			label = "Tri-state key bottom";
> +			linux,code = <KEY_MACRO3>;
> +			interrupt-parent = <&tlmm>;
> +			interrupts = <126 IRQ_TYPE_EDGE_FALLING>;
> +			debounce-interval = <500>;
> +			linux,can-disable;
> +		};

Best regards,
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 3/5] arm64: dts: sdm845: add oneplus 6/t devices
  2020-11-16 22:01   ` Pavel Machek
@ 2020-11-16 23:49     ` Caleb Connolly
  2020-11-21 17:44       ` Pavel Machek
  0 siblings, 1 reply; 19+ messages in thread
From: Caleb Connolly @ 2020-11-16 23:49 UTC (permalink / raw)
  To: Pavel Machek
  Cc: linux-arm-msm, Andy Gross, Bjorn Andersson, Rob Herring,
	Kees Cook, Anton Vorontsov, Colin Cross, Tony Luck, phone-devel,
	~postmarketos/upstreaming, devicetree, linux-kernel

On 2020-11-16 22:01, Pavel Machek wrote:
> Hi!
>
>> Add initial support for the OnePlus 6 (enchilada) and 6T (fajita) based
>> on the sdm845-mtp DT. Support includes:
>>
>> * Display panels and Adreno 630
>> * Touch screen support with synaptics rmi4
>> * All remoteprocs start correctly
>> * WLAN / Bluetooth
>> * Volume / power buttons and OnePlus Tri-State switch are functional
>>      The tri-state switch is a 3 state mute slider on the side of the phone * USB
>> support, currently forced to peripheral as type C detection isn't functional.
> I have similar switches on my joystick... but I don't believe modelling it as 3 separate
> keys with "macro" keysym is the right way to go.

Hi! I agree that this is a bit of a weird way to model the switch, do 
you have any ideas for a better solution?

I'm happy to drop this from the patch for now and come up with a better 
method down the line.

Regards,

Caleb

>> +		state-top {
>> +			label = "Tri-state key top";
>> +			linux,code = <KEY_MACRO1>;
>> +			interrupt-parent = <&tlmm>;
>> +			interrupts = <24 IRQ_TYPE_EDGE_FALLING>;
>> +			debounce-interval = <500>;
>> +			linux,can-disable;
>> +		};
>> +
>> +		state-middle {
>> +			label = "Tri-state key middle";
>> +			linux,code = <KEY_MACRO2>;
>> +			interrupt-parent = <&tlmm>;
>> +			interrupts = <52 IRQ_TYPE_EDGE_FALLING>;
>> +			debounce-interval = <500>;
>> +			linux,can-disable;
>> +		};
>> +
>> +		state-bottom {
>> +			label = "Tri-state key bottom";
>> +			linux,code = <KEY_MACRO3>;
>> +			interrupt-parent = <&tlmm>;
>> +			interrupts = <126 IRQ_TYPE_EDGE_FALLING>;
>> +			debounce-interval = <500>;
>> +			linux,can-disable;
>> +		};
> Best regards,
> 									Pavel
> --
> (english) http://www.livejournal.com/~pavelmachek
> (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html




^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 5/5] i2c: geni: sdm845: dont perform DMA for OnePlus 6 devices
  2020-11-12 16:22 ` [PATCH 5/5] i2c: geni: sdm845: dont perform DMA for OnePlus 6 devices Caleb Connolly
@ 2020-11-17 11:47   ` Akash Asthana
  2020-11-22  3:47   ` Bjorn Andersson
  1 sibling, 0 replies; 19+ messages in thread
From: Akash Asthana @ 2020-11-17 11:47 UTC (permalink / raw)
  To: Caleb Connolly, linux-arm-msm, Andy Gross, Bjorn Andersson,
	Mukesh Savaliya
  Cc: phone-devel, ~postmarketos/upstreaming, linux-i2c, linux-kernel


On 11/12/2020 9:52 PM, Caleb Connolly wrote:
> The OnePlus 6/T has the same issue as the Yoga c630 causing a crash when DMA
> is used for i2c, so disable it.
>
> https://patchwork.kernel.org/patch/11133827/
>
> Signed-off-by: Caleb Connolly <caleb@connolly.tech>
Reviewed-by : Akash Asthana <akashast@codeaurora.org>

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,\na Linux Foundation Collaborative Project


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 3/5] arm64: dts: sdm845: add oneplus 6/t devices
  2020-11-12 16:21 ` [PATCH 3/5] arm64: dts: sdm845: add oneplus 6/t devices Caleb Connolly
  2020-11-16 22:01   ` Pavel Machek
@ 2020-11-21  4:28   ` Bjorn Andersson
  1 sibling, 0 replies; 19+ messages in thread
From: Bjorn Andersson @ 2020-11-21  4:28 UTC (permalink / raw)
  To: Caleb Connolly
  Cc: linux-arm-msm, Andy Gross, Rob Herring, Kees Cook,
	Anton Vorontsov, Colin Cross, Tony Luck, phone-devel,
	~postmarketos/upstreaming, devicetree, linux-kernel

On Thu 12 Nov 10:21 CST 2020, Caleb Connolly wrote:
[..]
> diff --git a/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi b/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
> new file mode 100644
> index 000000000000..4e6477f1e574
> --- /dev/null
> +++ b/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
> @@ -0,0 +1,822 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * SDM845 OnePlus 6(T) (enchilada / fajita) common device tree source
> + *
> + * Copyright (c) 2020, The Linux Foundation. All rights reserved.
> + */
> +
> +/dts-v1/;
> +
> +#include <dt-bindings/gpio/gpio.h>
> +#include <dt-bindings/regulator/qcom,rpmh-regulator.h>
> +#include <dt-bindings/input/linux-event-codes.h>

Please keep these sorted alphabetically.

> +#include "sdm845.dtsi"
> +
> +// Needed for some GPIO (like the volume buttons)

This is or is going to be needed for more things, so feel free to skip
this comment.

> +#include "pm8998.dtsi"
> +#include "pmi8998.dtsi"
> +
> +/ {
> +
> +	aliases {
> +		hsuart0 = &uart6;
> +	};
> +
> +	vph_pwr: vph-pwr-regulator {
> +		compatible = "regulator-fixed";
> +		regulator-name = "vph_pwr";
> +		regulator-min-microvolt = <3700000>;
> +		regulator-max-microvolt = <3700000>;
> +	};
> +
> +	/*
> +	 * Apparently RPMh does not provide support for PM8998 S4 because it
> +	 * is always-on; model it as a fixed regulator.
> +	 */
> +	vreg_s4a_1p8: pm8998-smps4 {
> +		compatible = "regulator-fixed";
> +		regulator-name = "vreg_s4a_1p8";
> +
> +		regulator-min-microvolt = <1800000>;
> +		regulator-max-microvolt = <1800000>;
> +
> +		regulator-always-on;
> +		regulator-boot-on;
> +
> +		vin-supply = <&vph_pwr>;
> +	};
> +
> +	/*
> +	 * The touchscreen regulator seems to be controlled somehow by a gpio.
> +	 */
> +	ts_1p8_supply: ts_1v8_regulator {

Please don't use _ in the node name.

> +		compatible = "regulator-fixed";
> +		regulator-name = "ts_1p8_supply";
> +
> +		regulator-min-microvolt = <1800000>;
> +		regulator-max-microvolt = <1800000>;
> +
> +		gpio = <&tlmm 88 0>;
> +		enable-active-high;
> +		regulator-boot-on;
> +	};
> +
> +	gpio_tristate_key: gpio-keys {
> +		compatible = "gpio-keys";
> +		label = "Tri-state keys";

What kind of button is this?

> +
> +		pinctrl-names = "default";
> +		pinctrl-0 = <&tri_state_key_default>;
> +
> +		state-top {
> +			label = "Tri-state key top";
> +			linux,code = <KEY_MACRO1>;
> +			interrupt-parent = <&tlmm>;
> +			interrupts = <24 IRQ_TYPE_EDGE_FALLING>;
> +			debounce-interval = <500>;
> +			linux,can-disable;
> +		};
> +
> +		state-middle {
> +			label = "Tri-state key middle";
> +			linux,code = <KEY_MACRO2>;
> +			interrupt-parent = <&tlmm>;
> +			interrupts = <52 IRQ_TYPE_EDGE_FALLING>;
> +			debounce-interval = <500>;
> +			linux,can-disable;
> +		};
> +
> +		state-bottom {
> +			label = "Tri-state key bottom";
> +			linux,code = <KEY_MACRO3>;
> +			interrupt-parent = <&tlmm>;
> +			interrupts = <126 IRQ_TYPE_EDGE_FALLING>;
> +			debounce-interval = <500>;
> +			linux,can-disable;
> +		};
> +	};
[..]
> +/* Reserved memory changes */
> +/delete-node/ &rmtfs_mem;
> +
> +/ {

You already have one top-level section higher up, please group this in
there as well.

> +	reserved-memory {
[..]
> +&mdss {

To avoid trouble finding your way around this file in the future I would
prefer if you sorted the nodes alphabetically.

> +	status = "okay";
> +};
> +
[..]
> +&i2c12 {
> +	status = "okay";
> +
> +	touchscreen: synaptics-rmi4-i2c@20 {

You don't reference &touchscreen, so please omit this..

Regards,
Bjorn

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 3/5] arm64: dts: sdm845: add oneplus 6/t devices
  2020-11-16 23:49     ` Caleb Connolly
@ 2020-11-21 17:44       ` Pavel Machek
  0 siblings, 0 replies; 19+ messages in thread
From: Pavel Machek @ 2020-11-21 17:44 UTC (permalink / raw)
  To: Caleb Connolly
  Cc: linux-arm-msm, Andy Gross, Bjorn Andersson, Rob Herring,
	Kees Cook, Anton Vorontsov, Colin Cross, Tony Luck, phone-devel,
	~postmarketos/upstreaming, devicetree, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1042 bytes --]

On Mon 2020-11-16 23:49:32, Caleb Connolly wrote:
> On 2020-11-16 22:01, Pavel Machek wrote:
> > Hi!
> >
> >> Add initial support for the OnePlus 6 (enchilada) and 6T (fajita) based
> >> on the sdm845-mtp DT. Support includes:
> >>
> >> * Display panels and Adreno 630
> >> * Touch screen support with synaptics rmi4
> >> * All remoteprocs start correctly
> >> * WLAN / Bluetooth
> >> * Volume / power buttons and OnePlus Tri-State switch are functional
> >>      The tri-state switch is a 3 state mute slider on the side of the phone * USB
> >> support, currently forced to peripheral as type C detection isn't functional.
> > I have similar switches on my joystick... but I don't believe modelling it as 3 separate
> > keys with "macro" keysym is the right way to go.
> 
> Hi! I agree that this is a bit of a weird way to model the switch, do 
> you have any ideas for a better solution?

You should ask on the input mailing list, I guess.

Best regards,
									Pavel
-- 
http://www.livejournal.com/~pavelmachek

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 5/5] i2c: geni: sdm845: dont perform DMA for OnePlus 6 devices
  2020-11-12 16:22 ` [PATCH 5/5] i2c: geni: sdm845: dont perform DMA for OnePlus 6 devices Caleb Connolly
  2020-11-17 11:47   ` Akash Asthana
@ 2020-11-22  3:47   ` Bjorn Andersson
  2020-11-22 17:59     ` Caleb Connolly
  1 sibling, 1 reply; 19+ messages in thread
From: Bjorn Andersson @ 2020-11-22  3:47 UTC (permalink / raw)
  To: Caleb Connolly
  Cc: linux-arm-msm, Andy Gross, Akash Asthana, Mukesh Savaliya,
	phone-devel, ~postmarketos/upstreaming, linux-i2c, linux-kernel

On Thu 12 Nov 10:22 CST 2020, Caleb Connolly wrote:

> The OnePlus 6/T has the same issue as the Yoga c630 causing a crash when DMA
> is used for i2c, so disable it.
> 
> https://patchwork.kernel.org/patch/11133827/
> 
> Signed-off-by: Caleb Connolly <caleb@connolly.tech>
> ---
>  drivers/i2c/busses/i2c-qcom-geni.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c
> index 8b4c35f47a70..9acdcfe73be2 100644
> --- a/drivers/i2c/busses/i2c-qcom-geni.c
> +++ b/drivers/i2c/busses/i2c-qcom-geni.c
> @@ -357,7 +357,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"))

This hack seems to have been working around two separate issues. First
with iommu active the GENI wrappers needs to have their stream mapping
configured. Secondly there was a bug in the transaction setup that was
recently fixed by Doug Anderson.

So can you please give the following patch a go? I've yet to test it on
the Lenovo machine, but I think it allows us to remove the quirk.

https://lore.kernel.org/lkml/20201122034149.626045-1-bjorn.andersson@linaro.org/T/#u

Regards,
Bjorn

>  		dma_buf = i2c_get_dma_safe_msg_buf(msg, 32);
>  
>  	if (dma_buf)
> @@ -399,7 +400,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)
> -- 
> 2.29.2
> 
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 5/5] i2c: geni: sdm845: dont perform DMA for OnePlus 6 devices
  2020-11-22  3:47   ` Bjorn Andersson
@ 2020-11-22 17:59     ` Caleb Connolly
  2020-12-02 15:39       ` Wolfram Sang
  0 siblings, 1 reply; 19+ messages in thread
From: Caleb Connolly @ 2020-11-22 17:59 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: linux-arm-msm, Andy Gross, Akash Asthana, Mukesh Savaliya,
	phone-devel, ~postmarketos/upstreaming, linux-i2c, linux-kernel

Hi Bjorn,

It looks like I still have the same issue even with this patch applied.

Regards,
Caleb

On 2020-11-22 03:47, Bjorn Andersson wrote:
> On Thu 12 Nov 10:22 CST 2020, Caleb Connolly wrote:
>
>> The OnePlus 6/T has the same issue as the Yoga c630 causing a crash when DMA
>> is used for i2c, so disable it.
>>
>> https://patchwork.kernel.org/patch/11133827/
>>
>> Signed-off-by: Caleb Connolly <caleb@connolly.tech>
>> ---
>>   drivers/i2c/busses/i2c-qcom-geni.c | 6 ++++--
>>   1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c
>> index 8b4c35f47a70..9acdcfe73be2 100644
>> --- a/drivers/i2c/busses/i2c-qcom-geni.c
>> +++ b/drivers/i2c/busses/i2c-qcom-geni.c
>> @@ -357,7 +357,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"))
> This hack seems to have been working around two separate issues. First
> with iommu active the GENI wrappers needs to have their stream mapping
> configured. Secondly there was a bug in the transaction setup that was
> recently fixed by Doug Anderson.
>
> So can you please give the following patch a go? I've yet to test it on
> the Lenovo machine, but I think it allows us to remove the quirk.
>
> https://lore.kernel.org/lkml/20201122034149.626045-1-bjorn.andersson@linaro.org/T/#u
>
> Regards,
> Bjorn
>
>>   		dma_buf = i2c_get_dma_safe_msg_buf(msg, 32);
>>
>>   	if (dma_buf)
>> @@ -399,7 +400,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)
>> --
>> 2.29.2
>>
>>



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 5/5] i2c: geni: sdm845: dont perform DMA for OnePlus 6 devices
  2020-11-22 17:59     ` Caleb Connolly
@ 2020-12-02 15:39       ` Wolfram Sang
  2020-12-02 16:36         ` Bjorn Andersson
  0 siblings, 1 reply; 19+ messages in thread
From: Wolfram Sang @ 2020-12-02 15:39 UTC (permalink / raw)
  To: Caleb Connolly
  Cc: Bjorn Andersson, linux-arm-msm, Andy Gross, Akash Asthana,
	Mukesh Savaliya, phone-devel, ~postmarketos/upstreaming,
	linux-i2c, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 858 bytes --]


> >> -	if (!of_machine_is_compatible("lenovo,yoga-c630"))
> >> +	if (!of_machine_is_compatible("lenovo,yoga-c630") &&
> >> +	    !of_machine_is_compatible("oneplus,oneplus6"))
> > This hack seems to have been working around two separate issues. First
> > with iommu active the GENI wrappers needs to have their stream mapping
> > configured. Secondly there was a bug in the transaction setup that was
> > recently fixed by Doug Anderson.
> >
> > So can you please give the following patch a go? I've yet to test it on
> > the Lenovo machine, but I think it allows us to remove the quirk.
> >
> > https://lore.kernel.org/lkml/20201122034149.626045-1-bjorn.andersson@linaro.org/T/#u

Please don't top-post. I fixed it this time.

> It looks like I still have the same issue even with this patch applied.

So we still need your patch, am I reading correctly?


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 5/5] i2c: geni: sdm845: dont perform DMA for OnePlus 6 devices
  2020-12-02 15:39       ` Wolfram Sang
@ 2020-12-02 16:36         ` Bjorn Andersson
  2020-12-02 20:21           ` Wolfram Sang
  0 siblings, 1 reply; 19+ messages in thread
From: Bjorn Andersson @ 2020-12-02 16:36 UTC (permalink / raw)
  To: Wolfram Sang, Caleb Connolly
  Cc: linux-arm-msm, Andy Gross, Akash Asthana, Mukesh Savaliya,
	phone-devel, ~postmarketos/upstreaming, linux-i2c, linux-kernel

On Wed 02 Dec 09:39 CST 2020, Wolfram Sang wrote:

> 
> > >> -	if (!of_machine_is_compatible("lenovo,yoga-c630"))
> > >> +	if (!of_machine_is_compatible("lenovo,yoga-c630") &&
> > >> +	    !of_machine_is_compatible("oneplus,oneplus6"))
> > > This hack seems to have been working around two separate issues. First
> > > with iommu active the GENI wrappers needs to have their stream mapping
> > > configured. Secondly there was a bug in the transaction setup that was
> > > recently fixed by Doug Anderson.
> > >
> > > So can you please give the following patch a go? I've yet to test it on
> > > the Lenovo machine, but I think it allows us to remove the quirk.
> > >
> > > https://lore.kernel.org/lkml/20201122034149.626045-1-bjorn.andersson@linaro.org/T/#u
> 
> Please don't top-post. I fixed it this time.
> 
> > It looks like I still have the same issue even with this patch applied.
> 
> So we still need your patch, am I reading correctly?
> 

With Doug's recent fixes in the DMA handling and the introduction of
proper iommu configuration, which Caleb tested [1], I think we're good
without this on the OnePlus. Caleb, please confirm.

If I understood Caleb's report he saw exactly the same problem that Lee
Jones did that lead to the workaround for the Lenovo Yoga C630, and with
the two changes the i2c-hid keyboard came up nicely on my Yoga. So I
posted [2].

[1] https://lore.kernel.org/linux-arm-msm/3ba39a64-122b-ebe9-04b3-3a23478334a4@connolly.tech/
[2] https://lore.kernel.org/linux-arm-msm/20201124185743.401946-1-bjorn.andersson@linaro.org/

Regards,
Bjorn

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 5/5] i2c: geni: sdm845: dont perform DMA for OnePlus 6 devices
  2020-12-02 16:36         ` Bjorn Andersson
@ 2020-12-02 20:21           ` Wolfram Sang
  0 siblings, 0 replies; 19+ messages in thread
From: Wolfram Sang @ 2020-12-02 20:21 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Caleb Connolly, linux-arm-msm, Andy Gross, Akash Asthana,
	Mukesh Savaliya, phone-devel, ~postmarketos/upstreaming,
	linux-i2c, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 290 bytes --]


> With Doug's recent fixes in the DMA handling and the introduction of
> proper iommu configuration, which Caleb tested [1], I think we're good
> without this on the OnePlus. Caleb, please confirm.

Yes, he confirmed already. I missed it was private only.

Thanks for your heads up, too!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2020-12-02 20:23 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20201112161920.2671430-1-caleb@connolly.tech>
2020-11-12 16:21 ` [PATCH 1/5] drm/panel/samsung-sofef00: Add panel for OnePlus 6/T devices Caleb Connolly
2020-11-14 19:58   ` Sam Ravnborg
2020-11-12 16:21 ` [PATCH 2/5] dt-bindings: panel-simple-dsi: add samsung panels for OnePlus 6/T Caleb Connolly
2020-11-14 19:59   ` Sam Ravnborg
2020-11-12 16:21 ` [PATCH 3/5] arm64: dts: sdm845: add oneplus 6/t devices Caleb Connolly
2020-11-16 22:01   ` Pavel Machek
2020-11-16 23:49     ` Caleb Connolly
2020-11-21 17:44       ` Pavel Machek
2020-11-21  4:28   ` Bjorn Andersson
2020-11-12 16:21 ` [PATCH 4/5] dt-bindings: add vendor bindings for OnePlus Caleb Connolly
2020-11-16 14:47   ` Rob Herring
2020-11-16 14:53   ` Rob Herring
2020-11-12 16:22 ` [PATCH 5/5] i2c: geni: sdm845: dont perform DMA for OnePlus 6 devices Caleb Connolly
2020-11-17 11:47   ` Akash Asthana
2020-11-22  3:47   ` Bjorn Andersson
2020-11-22 17:59     ` Caleb Connolly
2020-12-02 15:39       ` Wolfram Sang
2020-12-02 16:36         ` Bjorn Andersson
2020-12-02 20:21           ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).