diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile index 367cbf437e1b0f..ddaa4628416eb9 100644 --- a/arch/arm/boot/dts/overlays/Makefile +++ b/arch/arm/boot/dts/overlays/Makefile @@ -326,6 +326,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \ vc4-kms-dsi-lt070me05000-v2.dtbo \ vc4-kms-dsi-waveshare-800x480.dtbo \ vc4-kms-dsi-waveshare-panel.dtbo \ + vc4-kms-dsi-waveshare-panel-v2.dtbo \ vc4-kms-kippah-7inch.dtbo \ vc4-kms-v3d.dtbo \ vc4-kms-v3d-pi4.dtbo \ diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README index 4cde0bacd25397..bf3fbd627e2ce9 100644 --- a/arch/arm/boot/dts/overlays/README +++ b/arch/arm/boot/dts/overlays/README @@ -5411,6 +5411,25 @@ Params: 2_8_inch 2.8" 480x640 the default DSI1 and i2c_csi_dsi). +Name: vc4-kms-dsi-waveshare-panel-v2 +Info: Enable the Waveshare DSI-TOUCH series screen + Requires vc4-kms-v3d to be loaded. +Load: dtoverlay=vc4-kms-dsi-waveshare-panel-v2, +Params: 5_0_inch_a 5.0" 720x1280 2lane + 5_5_inch_a 5.5" 720x1280 2lane + 7_0_inch_b 7.0" B 720x1280 2lane + 8_0_inch_a 8.0" 800x1280 2lane + 8_0_inch_a_4lane 8.0" 800x1280 4lane + 10_1_inch_a 10.1" 800x1280 2lane + 10_1_inch_a_4lane 10.1" 800x1280 4lane + disable_touch Disable the touch controller + invx Touchscreen inverted x axis + invy Touchscreen inverted y axis + swapxy Touchscreen swapped x y axis + dsi0 Use DSI0 and i2c_csi_dsi0 (rather than + the default DSI1 and i2c_csi_dsi). + + Name: vc4-kms-kippah-7inch Info: This overlay is now deprecated - see vc4-kms-dpi-panel,kippah-7inch Load: diff --git a/arch/arm/boot/dts/overlays/vc4-kms-dsi-waveshare-panel-v2-overlay.dts b/arch/arm/boot/dts/overlays/vc4-kms-dsi-waveshare-panel-v2-overlay.dts new file mode 100644 index 00000000000000..4f913529fadfcc --- /dev/null +++ b/arch/arm/boot/dts/overlays/vc4-kms-dsi-waveshare-panel-v2-overlay.dts @@ -0,0 +1,92 @@ +/* + * vc4-kms-dsi-waveshare-panel-v2-overlay.dts + */ + +/dts-v1/; +/plugin/; + +#include + +/ { + compatible = "brcm,bcm2835"; + + i2c_frag: fragment@0 { + target = <&i2c_csi_dsi>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + display_mcu: display_mcu@45 { + compatible = "waveshare,touchscreen-panel-regulator"; + reg = <0x45>; + gpio-controller; + #gpio-cells = <2>; + }; + + touch: goodix@5d { + compatible = "goodix,gt9271"; + reg = <0x5d>; + reset-gpio = <&display_mcu 9 GPIO_ACTIVE_HIGH>; + }; + }; + }; + + dsi_frag: fragment@1 { + target = <&dsi1>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + port { + dsi_out: endpoint { + remote-endpoint = <&panel_in>; + }; + }; + + dsi_panel: dsi_panel@0 { + reg = <0>; + compatible = "waveshare,10.1-dsi-touch-a"; + reset-gpio = <&display_mcu 1 GPIO_ACTIVE_HIGH>; + backlight = <&display_mcu>; + + port { + panel_in: endpoint { + remote-endpoint = <&dsi_out>; + }; + }; + }; + }; + }; + + fragment@2 { + target = <&i2c0if>; + __overlay__ { + status = "okay"; + }; + }; + + fragment@3 { + target = <&i2c0mux>; + __overlay__ { + status = "okay"; + }; + }; + + __overrides__ { + 5_0_inch_a = <&dsi_panel>, "compatible=waveshare,5.0-dsi-touch-a"; + 5_5_inch_a = <&dsi_panel>, "compatible=waveshare,5.5-dsi-touch-a"; + 7_0_inch_b = <&dsi_panel>, "compatible=waveshare,7.0-dsi-touch-b"; + 8_0_inch_a = <&dsi_panel>, "compatible=waveshare,8.0-dsi-touch-a"; + 8_0_inch_a_4lane = <&dsi_panel>, "compatible=waveshare,8.0-dsi-touch-a,4lane"; + 10_1_inch_a = <&dsi_panel>, "compatible=waveshare,10.1-dsi-touch-a"; + 10_1_inch_a_4lane = <&dsi_panel>, "compatible=waveshare,10.1-dsi-touch-a,4lane"; + disable_touch = <&touch>, "status=disabled"; + invx = <&touch>,"touchscreen-inverted-x?"; + invy = <&touch>,"touchscreen-inverted-y?"; + swapxy = <&touch>,"touchscreen-swapped-x-y?"; + dsi0 = <&dsi_frag>, "target:0=",<&dsi0>, + <&i2c_frag>, "target:0=",<&i2c_csi_dsi0>; + }; +}; diff --git a/arch/arm/configs/bcm2711_defconfig b/arch/arm/configs/bcm2711_defconfig index 3d61292e2b8e71..65362c6954c02e 100644 --- a/arch/arm/configs/bcm2711_defconfig +++ b/arch/arm/configs/bcm2711_defconfig @@ -793,6 +793,7 @@ CONFIG_REGULATOR_ARIZONA_MICSUPP=m CONFIG_REGULATOR_GPIO=y CONFIG_REGULATOR_RASPBERRYPI_TOUCHSCREEN_ATTINY=m CONFIG_REGULATOR_RASPBERRYPI_TOUCHSCREEN_V2=m +CONFIG_REGULATOR_WAVESHARE_TOUCHSCREEN=m CONFIG_RC_CORE=y CONFIG_BPF_LIRC_MODE2=y CONFIG_LIRC=y @@ -998,6 +999,7 @@ CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN=m CONFIG_DRM_PANEL_SITRONIX_ST7701=m CONFIG_DRM_PANEL_TPO_Y17P=m CONFIG_DRM_PANEL_WAVESHARE_TOUCHSCREEN=m +CONFIG_DRM_PANEL_WAVESHARE_TOUCHSCREEN_V2=m CONFIG_DRM_DISPLAY_CONNECTOR=m CONFIG_DRM_SIMPLE_BRIDGE=m CONFIG_DRM_TOSHIBA_TC358762=m diff --git a/arch/arm64/configs/bcm2711_defconfig b/arch/arm64/configs/bcm2711_defconfig index 221ae9410f2443..6f70bf6466f83f 100644 --- a/arch/arm64/configs/bcm2711_defconfig +++ b/arch/arm64/configs/bcm2711_defconfig @@ -826,6 +826,7 @@ CONFIG_REGULATOR_ARIZONA_MICSUPP=m CONFIG_REGULATOR_GPIO=y CONFIG_REGULATOR_RASPBERRYPI_TOUCHSCREEN_ATTINY=m CONFIG_REGULATOR_RASPBERRYPI_TOUCHSCREEN_V2=m +CONFIG_REGULATOR_WAVESHARE_TOUCHSCREEN=m CONFIG_RC_CORE=y CONFIG_BPF_LIRC_MODE2=y CONFIG_LIRC=y @@ -1038,6 +1039,7 @@ CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN=m CONFIG_DRM_PANEL_SITRONIX_ST7701=m CONFIG_DRM_PANEL_TPO_Y17P=m CONFIG_DRM_PANEL_WAVESHARE_TOUCHSCREEN=m +CONFIG_DRM_PANEL_WAVESHARE_TOUCHSCREEN_V2=m CONFIG_DRM_DISPLAY_CONNECTOR=m CONFIG_DRM_SIMPLE_BRIDGE=m CONFIG_DRM_TOSHIBA_TC358762=m diff --git a/arch/arm64/configs/bcm2712_defconfig b/arch/arm64/configs/bcm2712_defconfig index 3373df51f285ee..df3f494d86bbe0 100644 --- a/arch/arm64/configs/bcm2712_defconfig +++ b/arch/arm64/configs/bcm2712_defconfig @@ -828,6 +828,7 @@ CONFIG_REGULATOR_ARIZONA_MICSUPP=m CONFIG_REGULATOR_GPIO=y CONFIG_REGULATOR_RASPBERRYPI_TOUCHSCREEN_ATTINY=m CONFIG_REGULATOR_RASPBERRYPI_TOUCHSCREEN_V2=m +CONFIG_REGULATOR_WAVESHARE_TOUCHSCREEN=m CONFIG_RC_CORE=y CONFIG_BPF_LIRC_MODE2=y CONFIG_LIRC=y @@ -1040,6 +1041,7 @@ CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN=m CONFIG_DRM_PANEL_SITRONIX_ST7701=m CONFIG_DRM_PANEL_TPO_Y17P=m CONFIG_DRM_PANEL_WAVESHARE_TOUCHSCREEN=m +CONFIG_DRM_PANEL_WAVESHARE_TOUCHSCREEN_V2=m CONFIG_DRM_DISPLAY_CONNECTOR=m CONFIG_DRM_SIMPLE_BRIDGE=m CONFIG_DRM_TOSHIBA_TC358762=m diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index 307dd2c0fae413..1989f5ed56cd54 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -848,6 +848,16 @@ config DRM_PANEL_WAVESHARE_TOUCHSCREEN DSI Touchscreens. To compile this driver as a module, choose M here. +config DRM_PANEL_WAVESHARE_TOUCHSCREEN_V2 + tristate "Waveshare touchscreen panels V2" + depends on DRM_MIPI_DSI + depends on I2C + depends on BACKLIGHT_CLASS_DEVICE + help + Say Y here if you want to enable support for the Waveshare + DSI Touchscreens. To compile this driver as a module, + choose M here. + config DRM_PANEL_WIDECHIPS_WS2401 tristate "Widechips WS2401 DPI panel driver" depends on SPI && GPIOLIB diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile index 9dd9b350380273..e19d1c03a1c679 100644 --- a/drivers/gpu/drm/panel/Makefile +++ b/drivers/gpu/drm/panel/Makefile @@ -86,5 +86,6 @@ obj-$(CONFIG_DRM_PANEL_VISIONOX_RM69299) += panel-visionox-rm69299.o obj-$(CONFIG_DRM_PANEL_VISIONOX_VTDR6130) += panel-visionox-vtdr6130.o obj-$(CONFIG_DRM_PANEL_VISIONOX_R66451) += panel-visionox-r66451.o obj-$(CONFIG_DRM_PANEL_WAVESHARE_TOUCHSCREEN) += panel-waveshare-dsi.o +obj-$(CONFIG_DRM_PANEL_WAVESHARE_TOUCHSCREEN_V2) += panel-waveshare-dsi-v2.o obj-$(CONFIG_DRM_PANEL_WIDECHIPS_WS2401) += panel-widechips-ws2401.o obj-$(CONFIG_DRM_PANEL_XINPENG_XPP055C272) += panel-xinpeng-xpp055c272.o diff --git a/drivers/gpu/drm/panel/panel-waveshare-dsi-v2.c b/drivers/gpu/drm/panel/panel-waveshare-dsi-v2.c new file mode 100644 index 00000000000000..863bec39a291e2 --- /dev/null +++ b/drivers/gpu/drm/panel/panel-waveshare-dsi-v2.c @@ -0,0 +1,1353 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2024 Waveshare International Limited + * + * Based on panel-raspberrypi-touchscreen by Broadcom + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include