Add support for the OnePlus 6 and 6T SDM845 devices
Subsystems (8)
The OnePlus 6/T handsets are based on the SDM845 platform and were released in late 2017.
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 -
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
@@ -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
@@ -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
Re: [PATCH 1/5] drm/panel/oneplus6: Add panel-oneplus6
Hi Caleb.
I have missed to provice review feedback so here goes. There is some improvements that can be made as the infrastructure has evolved since the driver was started.
But despite the number of comments below it is all trivial and the driver looks good in general.
I look forward to see the next revision.
Sam
Quoted 8 lines · Caleb Connolly
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.
Quoted 8 lines
The panels are: samsung,sofef00
and samsung,s6e3fc2x01Signed-off-by Caleb Connolly <[email protected]>--- drivers/gpu/drm/panel/Kconfig | 12 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-oneplus6.c | 418 +++++++++++++++++++++++++
It would be better to name the driver after the panels and not their user. So something like panel-samsung-sofef00.
It is OK to name it after one panel and let it support mroe than one panel. The Kconfig description could then expain where it is used.
Quoted 55 lines
3 files changed, 431 insertions(+) create mode 100644 drivers/gpu/drm/panel/panel-oneplus6.cdrivers/gpu/drm/panel/Kconfig +12
-0@@ -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 OFdrivers/gpu/drm/panel/Makefile +1
-0@@ -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.odrivers/gpu/drm/panel/panel-oneplus6.c new file +11
-0@@ -0,0 +1,418 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* Copyright (c) 2020 Caleb Connolly <[email protected]> +* Generated with linux-mdss-dsi-panel-driver-generator from vendor device tree: +* Copyright (c) 2020, The Linux Foundation. All rights reserved. +* +* Caleb Connolly <[email protected]> +*/ + +#include <linux/delay.h> +#include <linux/gpio/consumer.h> +#include <linux/module.h>
drivers/gpu/drm/panel/panel-oneplus6.c line 21
Quoted 10 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +10
-0+#include <linux/of.h> +#include <linux/of_device.h> +#include <linux/regulator/consumer.h> + +#include <video/mipi_display.h> + +#include <drm/drm_mipi_dsi.h> +#include <drm/drm_modes.h> +#include <drm/drm_panel.h> +#include <linux/backlight.h>
Keep all linux include together.
drivers/gpu/drm/panel/panel-oneplus6.c line 26
Quoted 5 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +5
-0+ +struct oneplus6_panel { +struct drm_panel panel; +struct mipi_dsi_device *dsi; +struct backlight_device *backlight;
Use drm_panel backlight support - so you can drop this variable and simplify some of the code below.
drivers/gpu/drm/panel/panel-oneplus6.c line 29
Quoted 3 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +3
-0+struct regulator *supply; +struct gpio_desc *reset_gpio; +struct gpio_desc *enable_gpio;
The enable_gpio is not used.
Quoted 14 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +14
-0+const struct drm_display_mode *mode; +bool prepared; +bool enabled; +}; + +static inline +struct oneplus6_panel *to_oneplus6_panel (struct drm_panel *panel) +{ + return container_of(panel, struct oneplus6_panel, panel); +} + +#define dsi_dcs_write_seq(dsi, seq...) do { \ + static const u8 d[] = { seq }; \ + int ret; \
drivers/gpu/drm/panel/panel-oneplus6.c line 53
Quoted 10 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +10
-0+ ret =mipi_dsi_dcs_write_buffer (dsi, d,ARRAY_SIZE (d)); \ +if (ret <0 ) \ +return ret; \ + }while (0 ) + +static void oneplus6_panel_reset(struct oneplus6_panel *ctx) +{ +gpiod_set_value_cansleep (ctx->reset_gpio,1 ); +usleep_range (5000 ,6000 ); +}
IT is not obvious if this helper reset the panel or de-assert the reset signal. It does not help me that there is only one helper despite both operatiosn are needed.
Quoted 65 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +65
-0+ +static int oneplus6_panel_on (struct oneplus6_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 oneplus6_panel_off (struct oneplus6_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 ; +}
drivers/gpu/drm/panel/panel-oneplus6.c line 128
Quoted 10 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +10
-0+ +static int oneplus6_panel_prepare (struct drm_panel *panel) +{ +struct oneplus6_panel *ctx =to_oneplus6_panel (panel); +struct device *dev = &ctx->dsi->dev; +int ret; + +if (ctx->prepared) +return 0 ; +
Do you not need to do a regulator_enable() here to get power supply to the panel?
Quoted 13 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +13
-0+oneplus6_panel_reset (ctx); + + ret =oneplus6_panel_on (ctx); +if (ret <0 ) { +dev_err (dev,"Failed to initialize panel: %d\n" , ret); +gpiod_set_value_cansleep (ctx->reset_gpio,0 ); +return ret; + } + + ctx->prepared = true; +return 0 ; +} +
drivers/gpu/drm/panel/panel-oneplus6.c line 151
Quoted 10 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +10
-0+static int oneplus6_panel_unprepare (struct drm_panel *panel) +{ +struct oneplus6_panel *ctx =to_oneplus6_panel (panel); +struct device *dev = &ctx->dsi->dev; +int ret; + +if (!ctx->prepared) +return 0 ; + + ret =regulator_enable (ctx->supply);
Looks strange that the power supply is enabled here - was it not enabled before to use the panel?
Quoted 42 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +42
-0+if (ret <0 ) { +dev_err (dev,"Failed to enable regulator: %d\n" , ret); +return ret; + } + + ret =oneplus6_panel_off (ctx); +if (ret <0 ) +dev_err (dev,"Failed to un-initialize panel: %d\n" , ret); + +gpiod_set_value_cansleep (ctx->reset_gpio,0 ); +regulator_disable (ctx->supply); + + ctx->prepared = false; +return 0 ; +} + + +static int oneplus6_panel_enable (struct drm_panel *panel) +{ +struct oneplus6_panel *ctx =to_oneplus6_panel (panel); +int ret; + +if (ctx->enabled) +return 0 ; + + ret =backlight_enable (ctx->backlight); +if (ret <0 ) { +dev_err (&ctx->dsi->dev,"Failed to enable backlight: %d\n" , ret); +return ret; + } + + ctx->enabled = true; +return 0 ; +} + +static int oneplus6_panel_disable (struct drm_panel *panel) +{ +struct oneplus6_panel *ctx =to_oneplus6_panel (panel); +int ret; + +if (!ctx->enabled) +return 0 ;
drivers/gpu/drm/panel/panel-oneplus6.c line 203
Quoted 10 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +10
-0+ + ret =backlight_disable (ctx->backlight); +if (ret <0 ) { +dev_err (&ctx->dsi->dev,"Failed to disable backlight: %d\n" , ret); +return ret; + } + + ctx->enabled = false; +return 0 ; +}
When backlight support in drm_panel is used the two enabled/disable functions can be dropped and the enabled flag is then no longer sued and can be dropped too.
Quoted 22 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +22
-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 ,
drivers/gpu/drm/panel/panel-oneplus6.c line 235
Quoted 10 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +10
-0+ .vdisplay = 2340, + .vsync_start = 2340 + 32, + .vsync_end = 2340 + 32 + 4, + .vtotal = 2340 + 32 + 4 + 18, + .width_mm = 68, + .height_mm = 145, +}; + +static int oneplus6_panel_get_modes (struct drm_panel *panel, +struct drm_connector *connector)
Some indent looks fishy here.
Try to check the driver using checkpatch --strict - it should be clean.
Quoted 21 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +21
-0+{ +struct drm_display_mode *mode; +struct oneplus6_panel *ctx =to_oneplus6_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 oneplus6_panel_panel_funcs = { + .disable = oneplus6_panel_disable, + .enable = oneplus6_panel_enable,
drivers/gpu/drm/panel/panel-oneplus6.c line 266
Quoted 10 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +10
-0+ .prepare = oneplus6_panel_prepare, + .unprepare = oneplus6_panel_unprepare, + .get_modes = oneplus6_panel_get_modes, +}; + +static int oneplus6_panel_bl_get_brightness (struct backlight_device *bl) +{ +struct mipi_dsi_device *dsi =bl_get_data (bl); +int err; +u16 brightness = bl->props.brightness;
No need to read the brightness here. It will be set if mipi_dsi_dcs_get_display_brightness() succeeds.
Quoted 5 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +5
-0+ + err =mipi_dsi_dcs_get_display_brightness (dsi, &brightness); +if (err <0 ) { +return err; + }
drivers/gpu/drm/panel/panel-oneplus6.c line 281
Quoted 10 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +10
-0+ +return brightness &0xff ; +} + +static int oneplus6_panel_bl_update_status (struct backlight_device *bl) +{ +struct mipi_dsi_device *dsi =bl_get_data (bl); +int err; +unsigned short brightness; +
Use backlight_get_brightness() to get the current brightness from the backlight device. Do not access the properties direct.
Quoted 11 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +11
-0+// This panel needs the high and low bytes swapped for the brightness value + brightness = ((bl->props.brightness<<8 )&0xff00 )|((bl->props.brightness>>8 )&0x00ff ); + + err =mipi_dsi_dcs_set_display_brightness (dsi, brightness); +if (err <0 ) { +return err; + } + +return 0 ; +} +
drivers/gpu/drm/panel/panel-oneplus6.c line 302
Quoted 10 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +10
-0+static const struct backlight_ops oneplus6_panel_bl_ops = { + .update_status = oneplus6_panel_bl_update_status, + .get_brightness = oneplus6_panel_bl_get_brightness, +}; + +static struct backlight_device * +oneplus6_panel_create_backlight (struct mipi_dsi_device *dsi) +{ +struct device *dev = &dsi->dev; +struct backlight_properties props = {
const
Quoted 48 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +48
-0+ .type = BACKLIGHT_PLATFORM, + .scale = BACKLIGHT_SCALE_LINEAR, + .brightness = 255, + .max_brightness = 512, + }; + +return devm_backlight_device_register (dev,dev_name (dev), dev, dsi, + &oneplus6_panel_bl_ops, &props); +} + + +static int oneplus6_panel_probe (struct mipi_dsi_device *dsi) +{ +struct device *dev = &dsi->dev; +struct oneplus6_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->backlight =oneplus6_panel_create_backlight (dsi); +if (IS_ERR (ctx->backlight)) { + ret =PTR_ERR (ctx->backlight); +dev_err (dev,"Failed to create backlight: %d\n" , ret); +return ret; + }
drivers/gpu/drm/panel/panel-oneplus6.c line 360
Quoted 10 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +10
-0+ + ctx->dsi = dsi; +mipi_dsi_set_drvdata (dsi, ctx); + + dsi->lanes =4 ; + dsi->format =MIPI_DSI_FMT_RGB888 ; + +drm_panel_init (&ctx->panel, dev, &oneplus6_panel_panel_funcs, +DRM_MODE_CONNECTOR_DSI ); +
When using backlight support from drm_panel remember to assing pane-backlight after drm_panel_init()
drivers/gpu/drm/panel/panel-oneplus6.c line 373
Quoted 13 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +13
-0+ ret =drm_panel_add (&ctx->panel); +if (ret <0 ) { +dev_err (dev,"Failed to add panel: %d\n" , ret); +return ret; + } + + ret =mipi_dsi_attach (dsi); +if (ret <0 ) { +dev_err (dev,"Failed to attach to DSI host: %d\n" , ret); +return ret; + } + +dev_info (dev,"Successfully added oneplus6 panel" );
This is just noide, drop it.
Quoted 48 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +45
-0+ +return 0 ; +} + +static int oneplus6_panel_remove (struct mipi_dsi_device *dsi) +{ +struct oneplus6_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 oneplus6_panel_of_match[] = { + { + .compatible ="samsung,sofef00" , + .data = &enchilada_panel_mode, + }, + { + .compatible ="samsung,s6e3fc2x01" , + .data = &fajita_panel_mode, + }, + {/* sentinel */ } +}; +MODULE_DEVICE_TABLE (of, oneplus6_panel_of_match); + +static struct mipi_dsi_driver oneplus6_panel_driver = { + .probe = oneplus6_panel_probe, + .remove = oneplus6_panel_remove, + .driver = { + .name ="panel-oneplus6" , + .of_match_table = oneplus6_panel_of_match, + }, +}; + +module_mipi_dsi_driver (oneplus6_panel_driver); + +MODULE_AUTHOR ("Caleb Connolly <[email protected]>" ); +MODULE_DESCRIPTION ("DRM driver for Samsung AMOLED DSI panels found in OnePlus 6/6T phones" ); +MODULE_LICENSE ("GPL v2" );Signature · 1 line
2.28.0
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/5] drm/panel/oneplus6: Add panel-oneplus6
Hi Sam,
Thanks a lot for the feedback! I'll get those issues resolved for the next revision.
Caleb
Quoted 532 lines · Sam Ravnborg
Hi Caleb.
I have missed to provice review feedback so here goes. There is some improvements that can be made as the infrastructure has evolved since the driver was started.
But despite the number of comments below it is all trivial and the driver looks good in general.I look forward to see the next revision.
Sam
Quoted 8 lines · Caleb Connolly
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.
Quoted 8 lines
The panels are: samsung,sofef00
and samsung,s6e3fc2x01Signed-off-by Caleb Connolly <[email protected]>--- drivers/gpu/drm/panel/Kconfig | 12 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-oneplus6.c | 418 +++++++++++++++++++++++++It would be better to name the driver after the panels and not their user. So something like panel-samsung-sofef00.
It is OK to name it after one panel and let it support mroe than one panel. TheKconfigdescription could then expain where it is used.Quoted 55 lines
3 files changed, 431 insertions(+)create mode 100644
drivers/gpu/drm/panel/panel-oneplus6.cdrivers/gpu/drm/panel/Kconfig +12
-0@@ -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 OFdrivers/gpu/drm/panel/Makefile +1
-0@@ -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.odrivers/gpu/drm/panel/panel-oneplus6.c new file +11
-0@@ -0,0 +1,418 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* Copyright (c) 2020 Caleb Connolly <[email protected]> +* Generated with linux-mdss-dsi-panel-driver-generator from vendor device tree: +* Copyright (c) 2020, The Linux Foundation. All rights reserved. +* +* Caleb Connolly <[email protected]> +*/ + +#include <linux/delay.h> +#include <linux/gpio/consumer.h> +#include <linux/module.h> drivers/gpu/drm/panel/panel-oneplus6.c line 21
Quoted 10 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +10
-0+#include <linux/of.h> +#include <linux/of_device.h> +#include <linux/regulator/consumer.h> + +#include <video/mipi_display.h> + +#include <drm/drm_mipi_dsi.h> +#include <drm/drm_modes.h> +#include <drm/drm_panel.h> +#include <linux/backlight.h> Keep all linux include together.
drivers/gpu/drm/panel/panel-oneplus6.c line 26
Quoted 5 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +5
-0+ +struct oneplus6_panel { +struct drm_panel panel; +struct mipi_dsi_device *dsi; +struct backlight_device *backlight;Use
drm_panelbacklight support - so you can drop this variable and simplify some of the code below.drivers/gpu/drm/panel/panel-oneplus6.c line 29
Quoted 3 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +3
-0+struct regulator *supply; +struct gpio_desc *reset_gpio; +struct gpio_desc *enable_gpio;The
enable_gpiois not used.Quoted 14 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +14
-0+const struct drm_display_mode *mode; +bool prepared; +bool enabled; +}; + +static inline +struct oneplus6_panel *to_oneplus6_panel (struct drm_panel *panel) +{ + return container_of(panel, struct oneplus6_panel, panel); +} + +#define dsi_dcs_write_seq(dsi, seq...) do { \ + static const u8 d[] = { seq }; \ + int ret; \drivers/gpu/drm/panel/panel-oneplus6.c line 53
Quoted 10 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +10
-0+ ret =mipi_dsi_dcs_write_buffer (dsi, d,ARRAY_SIZE (d)); \ +if (ret <0 ) \ +return ret; \ + }while (0 ) + +static void oneplus6_panel_reset(struct oneplus6_panel *ctx) +{ +gpiod_set_value_cansleep (ctx->reset_gpio,1 ); +usleep_range (5000 ,6000 ); +}IT is not obvious if this helper reset the panel or de-assert the reset signal. It does not help me that there is only one helper despite both operatiosn are needed.
Quoted 65 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +65
-0+ +static int oneplus6_panel_on (struct oneplus6_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 oneplus6_panel_off (struct oneplus6_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 ; +}drivers/gpu/drm/panel/panel-oneplus6.c line 128
Quoted 10 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +10
-0+ +static int oneplus6_panel_prepare (struct drm_panel *panel) +{ +struct oneplus6_panel *ctx =to_oneplus6_panel (panel); +struct device *dev = &ctx->dsi->dev; +int ret; + +if (ctx->prepared) +return 0 ; +Do you not need to do a
regulator_enable()here to get power supply to the panel?Quoted 13 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +13
-0+oneplus6_panel_reset (ctx); + + ret =oneplus6_panel_on (ctx); +if (ret <0 ) { +dev_err (dev,"Failed to initialize panel: %d\n" , ret); +gpiod_set_value_cansleep (ctx->reset_gpio,0 ); +return ret; + } + + ctx->prepared = true; +return 0 ; +} +drivers/gpu/drm/panel/panel-oneplus6.c line 151
Quoted 10 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +10
-0+static int oneplus6_panel_unprepare (struct drm_panel *panel) +{ +struct oneplus6_panel *ctx =to_oneplus6_panel (panel); +struct device *dev = &ctx->dsi->dev; +int ret; + +if (!ctx->prepared) +return 0 ; + + ret =regulator_enable (ctx->supply);Looks strange that the power supply is enabled here - was it not enabled before to use the panel?
Quoted 42 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +42
-0+if (ret <0 ) { +dev_err (dev,"Failed to enable regulator: %d\n" , ret); +return ret; + } + + ret =oneplus6_panel_off (ctx); +if (ret <0 ) +dev_err (dev,"Failed to un-initialize panel: %d\n" , ret); + +gpiod_set_value_cansleep (ctx->reset_gpio,0 ); +regulator_disable (ctx->supply); + + ctx->prepared = false; +return 0 ; +} + + +static int oneplus6_panel_enable (struct drm_panel *panel) +{ +struct oneplus6_panel *ctx =to_oneplus6_panel (panel); +int ret; + +if (ctx->enabled) +return 0 ; + + ret =backlight_enable (ctx->backlight); +if (ret <0 ) { +dev_err (&ctx->dsi->dev,"Failed to enable backlight: %d\n" , ret); +return ret; + } + + ctx->enabled = true; +return 0 ; +} + +static int oneplus6_panel_disable (struct drm_panel *panel) +{ +struct oneplus6_panel *ctx =to_oneplus6_panel (panel); +int ret; + +if (!ctx->enabled) +return 0 ;drivers/gpu/drm/panel/panel-oneplus6.c line 203
Quoted 10 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +10
-0+ + ret =backlight_disable (ctx->backlight); +if (ret <0 ) { +dev_err (&ctx->dsi->dev,"Failed to disable backlight: %d\n" , ret); +return ret; + } + + ctx->enabled = false; +return 0 ; +}When backlight support in
drm_panelis used the two enabled/disable functions can be dropped and the enabled flag is then no longer sued and can be dropped too.Quoted 22 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +22
-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 ,drivers/gpu/drm/panel/panel-oneplus6.c line 235
Quoted 10 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +10
-0+ .vdisplay = 2340, + .vsync_start = 2340 + 32, + .vsync_end = 2340 + 32 + 4, + .vtotal = 2340 + 32 + 4 + 18, + .width_mm = 68, + .height_mm = 145, +}; + +static int oneplus6_panel_get_modes (struct drm_panel *panel, +struct drm_connector *connector)Some indent looks fishy here.
Try to check the driver using checkpatch --strict - it should be clean.Quoted 21 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +21
-0+{ +struct drm_display_mode *mode; +struct oneplus6_panel *ctx =to_oneplus6_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 oneplus6_panel_panel_funcs = { + .disable = oneplus6_panel_disable, + .enable = oneplus6_panel_enable,drivers/gpu/drm/panel/panel-oneplus6.c line 266
Quoted 10 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +10
-0+ .prepare = oneplus6_panel_prepare, + .unprepare = oneplus6_panel_unprepare, + .get_modes = oneplus6_panel_get_modes, +}; + +static int oneplus6_panel_bl_get_brightness (struct backlight_device *bl) +{ +struct mipi_dsi_device *dsi =bl_get_data (bl); +int err; +u16 brightness = bl->props.brightness;No need to read the brightness here. It will be set if
mipi_dsi_dcs_get_display_brightness()succeeds.Quoted 5 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +5
-0+ + err =mipi_dsi_dcs_get_display_brightness (dsi, &brightness); +if (err <0 ) { +return err; + }drivers/gpu/drm/panel/panel-oneplus6.c line 281
Quoted 10 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +10
-0+ +return brightness &0xff ; +} + +static int oneplus6_panel_bl_update_status (struct backlight_device *bl) +{ +struct mipi_dsi_device *dsi =bl_get_data (bl); +int err; +unsigned short brightness; +Use
backlight_get_brightness()to get the current brightness from the backlight device. Do not access the properties direct.Quoted 11 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +11
-0+// This panel needs the high and low bytes swapped for the brightness value + brightness = ((bl->props.brightness<<8 )&0xff00 )|((bl->props.brightness>>8 )&0x00ff ); + + err =mipi_dsi_dcs_set_display_brightness (dsi, brightness); +if (err <0 ) { +return err; + } + +return 0 ; +} +drivers/gpu/drm/panel/panel-oneplus6.c line 302
Quoted 10 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +10
-0+static const struct backlight_ops oneplus6_panel_bl_ops = { + .update_status = oneplus6_panel_bl_update_status, + .get_brightness = oneplus6_panel_bl_get_brightness, +}; + +static struct backlight_device * +oneplus6_panel_create_backlight (struct mipi_dsi_device *dsi) +{ +struct device *dev = &dsi->dev; +struct backlight_properties props = {const
Quoted 48 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +48
-0+ .type = BACKLIGHT_PLATFORM, + .scale = BACKLIGHT_SCALE_LINEAR, + .brightness = 255, + .max_brightness = 512, + }; + +return devm_backlight_device_register (dev,dev_name (dev), dev, dsi, + &oneplus6_panel_bl_ops, &props); +} + + +static int oneplus6_panel_probe (struct mipi_dsi_device *dsi) +{ +struct device *dev = &dsi->dev; +struct oneplus6_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->backlight =oneplus6_panel_create_backlight (dsi); +if (IS_ERR (ctx->backlight)) { + ret =PTR_ERR (ctx->backlight); +dev_err (dev,"Failed to create backlight: %d\n" , ret); +return ret; + }drivers/gpu/drm/panel/panel-oneplus6.c line 360
Quoted 10 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +10
-0+ + ctx->dsi = dsi; +mipi_dsi_set_drvdata (dsi, ctx); + + dsi->lanes =4 ; + dsi->format =MIPI_DSI_FMT_RGB888 ; + +drm_panel_init (&ctx->panel, dev, &oneplus6_panel_panel_funcs, +DRM_MODE_CONNECTOR_DSI ); +When using backlight support from
drm_panelremember to assing pane-backlight afterdrm_panel_init()drivers/gpu/drm/panel/panel-oneplus6.c line 373
Quoted 13 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +13
-0+ ret =drm_panel_add (&ctx->panel); +if (ret <0 ) { +dev_err (dev,"Failed to add panel: %d\n" , ret); +return ret; + } + + ret =mipi_dsi_attach (dsi); +if (ret <0 ) { +dev_err (dev,"Failed to attach to DSI host: %d\n" , ret); +return ret; + } + +dev_info (dev,"Successfully added oneplus6 panel" );This is just noide, drop it.
Quoted 48 lines
drivers/gpu/drm/panel/panel-oneplus6.c new file +45
-1+ +return 0 ; +} + +static int oneplus6_panel_remove (struct mipi_dsi_device *dsi) +{ +struct oneplus6_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 oneplus6_panel_of_match[] = { + { + .compatible ="samsung,sofef00" , + .data = &enchilada_panel_mode, + }, + { + .compatible ="samsung,s6e3fc2x01" , + .data = &fajita_panel_mode, + }, + {/* sentinel */ } +}; +MODULE_DEVICE_TABLE (of, oneplus6_panel_of_match); + +static struct mipi_dsi_driver oneplus6_panel_driver = { + .probe = oneplus6_panel_probe, + .remove = oneplus6_panel_remove, + .driver = { + .name ="panel-oneplus6" , + .of_match_table = oneplus6_panel_of_match, + }, +}; + +module_mipi_dsi_driver (oneplus6_panel_driver); + +MODULE_AUTHOR ("Caleb Connolly <[email protected]>" ); +MODULE_DESCRIPTION ("DRM driver for Samsung AMOLED DSI panels found in OnePlus 6/6T phones" ); +MODULE_LICENSE ("GPL v2" ); --2.28.0
PATCH 2/5 dt-bindings: panel: add documentation for oneplus6 panel
In reply to Caleb ConnollyDocument 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
@@ -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
Rob Herring
maintainerRe: [PATCH 2/5] dt-bindings: panel: add documentation for oneplus6 panel
Quoted 9 lines · Caleb Connolly
Document the OnePlus 6/T common panel driver, example from
arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsiSigned-off-by Caleb Connolly <[email protected]>--- .../display/panel/panel-oneplus6.yaml | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/panel-oneplus6.yaml
My bot found errors running 'make dt_binding_check' on your patch:
Error: Documentation/devicetree/bindings/display/panel/panel-oneplus6.example.dts:19.9-14 syntax error FATAL ERROR: Unable to parse input tree
make[1]: *** [scripts/Makefile.lib:342: Documentation/devicetree/bindings/display/panel/panel-oneplus6.example.dt.yaml] Error 1 make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1366: dt_binding_check] Error 2
See https://patchwork.ozlabs.org/patch/1378187
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure dt-schema is up to date:
pip3 install git+https://github.com/devicetree-org/dt-schema.git@master --upgrade
Please check and re-submit.
Rob Herring
maintainerRe: [PATCH 2/5] dt-bindings: panel: add documentation for oneplus6 panel
In reply to Caleb ConnollyQuoted 36 lines · Caleb Connolly
Document the OnePlus 6/T common panel driver, example from
arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsiSigned-off-by Caleb Connolly <[email protected]>--- .../display/panel/panel-oneplus6.yaml | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/panel-oneplus6.yamlDocumentation/devicetree/bindings/display/panel/panel-oneplus6.yaml new file +21
-0@@ -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:
Documentation/devicetree/bindings/display/panel/panel-oneplus6.yaml line 31
Quoted 10 lines
Documentation/devicetree/bindings/display/panel/panel-oneplus6.yaml new file +10
-0+ enum: + - samsung,sofef00 + - samsung,s6e3fc2x01 + + reg: true + reset-gpios: true + port: true + + vddio-supply: + description: VDDIO regulator
A panel with a single supply can use panel-simple-dsi.yaml.
'reset-gpios' was missing, but has been added recently.
Rob
Re: [PATCH 2/5] dt-bindings: panel: add documentation for oneplus6 panel
Quoted 49 lines · Rob Herring
Quoted 36 lines · Caleb Connolly
Document the OnePlus 6/T common panel driver, example from
arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsiSigned-off-by Caleb Connolly <[email protected]>--- .../display/panel/panel-oneplus6.yaml | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+)create mode 100644
Documentation/devicetree/bindings/display/panel/panel-oneplus6.yamlDocumentation/devicetree/bindings/display/panel/panel-oneplus6.yaml new file +21
-0@@ -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:Documentation/devicetree/bindings/display/panel/panel-oneplus6.yaml line 31
Quoted 10 lines
Documentation/devicetree/bindings/display/panel/panel-oneplus6.yaml new file +10
-0+ enum: + - samsung,sofef00 + - samsung,s6e3fc2x01 + + reg: true + reset-gpios: true + port: true + + vddio-supply: + description: VDDIO regulatorA panel with a single supply can use
panel-simple-dsi.yaml.
Quoted 3 lines
'reset-gpios' was missing, but has been added recently.
Rob
Thanks, I'll move docs into panel-simple-dsi.yaml
Caleb
PATCH 3/5 arm64: dts: sdm845: add oneplus 6/t devices
In reply to Caleb ConnollyAdd 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
@@ -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
@@ -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
@@ -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
PATCH 4/5 dt-bindings: add vendor bindings for OnePlus
In reply to Caleb ConnollyUsed 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
@@ -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
@@ -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
PATCH 5/5 i2c: geni: sdm845: dont perform DMA for the oneplus6
In reply to Caleb ConnollyThe 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
@@ -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
Re: [PATCH 5/5] i2c: geni: sdm845: dont perform DMA for the oneplus6
Quoted 5 lines · 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/
Signed-off-by Caleb Connolly <[email protected]>
May I ask for a quick review here, so we can get this into 5.9 if qcom-geni maintainers agree this is good to go?
Quoted 32 lines
--- drivers/i2c/busses/i2c-qcom-geni.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/i2c/busses/i2c-qcom-geni.c +4
-2@@ -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
Re: Re: [PATCH 5/5] i2c: geni: sdm845: dont perform DMA for the oneplus6
Quoted 8 lines · Wolfram Sang
Quoted 5 lines · 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/
Signed-off-by Caleb Connolly <[email protected]>May I ask for a quick review here, so we can get this into 5.9 if qcom-geni maintainers agree this is good to go?
Sorry it wasn't mentioned in my first message, this patch depends on the rest in the series found here:
https://lore.kernel.org/linux-arm-msm/[email protected]/#r
Quoted 32 lines
Quoted 32 lines
--- drivers/i2c/busses/i2c-qcom-geni.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/i2c/busses/i2c-qcom-geni.c +4
-2@@ -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
Re: Re: [PATCH 5/5] i2c: geni: sdm845: dont perform DMA for the oneplus6
Quoted 5 lines · Caleb Connolly
Quoted 4 lines · Wolfram Sang
Quoted 3 lines · 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.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
https://patchwork.kernel.org/patch/11133827/
Signed-off-by Caleb Connolly <[email protected]>May I ask for a quick review here, so we can get this into 5.9 if qcom-geni maintainers agree this is good to go?
Sorry it wasn't mentioned in my first message, this patch depends on the rest in the series found here:
https://lore.kernel.org/linux-arm-msm/[email protected]/#r
Ah, so the device is not upstream yet and there is no hurry. Good to know. Thanks!
Mukesh, Savaliya
Reviewed-byRe: [PATCH 5/5] i2c: geni: sdm845: dont perform DMA for the oneplus6
In reply to Wolfram SangQuoted 6 lines · Wolfram Sang
Quoted 5 lines · 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/
Signed-off-by Caleb Connolly <[email protected]>
Quoted 35 lines
May I ask for a quick review here, so we can get this into 5.9 if qcom-geni maintainers agree this is good to go?
Quoted 32 lines
--- drivers/i2c/busses/i2c-qcom-geni.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/i2c/busses/i2c-qcom-geni.c +4
-2@@ -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
Re: [PATCH 5/5] i2c: geni: sdm845: dont perform DMA for the oneplus6
In reply to Caleb ConnollyQuoted 4 lines · 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.
Quoted 29 lines
Signed-off-by Caleb Connolly <[email protected]>--- drivers/i2c/busses/i2c-qcom-geni.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/i2c/busses/i2c-qcom-geni.c +4
-2@@ -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
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,\na Linux Foundation Collaborative Project
Wolfram Sang
Acked-byRe: [PATCH 5/5] i2c: geni: sdm845: dont perform DMA for the oneplus6
Quoted 7 lines · Akash Asthana
Quoted 4 lines · 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.
Reviewed-by Akash Asthana <[email protected]>
Thanks!
So, this patch can go in via whatever tree seems apropriate. Let me know if I should take this patch individually.
Quoted 18 lines · Caleb Connolly
The OnePlus 6/T handsets are based on the SDM845 platform and were released in late 2017.
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
* USBThe only differences between the devices is the different panels, fingerprint readers and that the 6T lacks a headphone jack and notification LED.
Quoted 5 lines
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
Missed here, these patches depend on Bjorns SMMU patches to boot with the display enabled, and disabling the display is not possible on newer firmware.
https://lore.kernel.org/linux-arm-msm/[email protected]/t/
Quoted 19 lines
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 oneplus6Documentation/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 -