diff --git a/BUILD.bazel b/BUILD.bazel index 2fd6e201b2793..5d66655907b52 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -752,6 +752,7 @@ copy_to_dist_dir( ) _RPI_OVERLAY_OUTS = [ + "arch/arm64/boot/dts/overlays/productshop-devboard.dtbo", "arch/arm64/boot/dts/overlays/act-led.dtbo", "arch/arm64/boot/dts/overlays/adafruit18.dtbo", "arch/arm64/boot/dts/overlays/adafruit-st7735r.dtbo", diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile index b75387ff6a5b7..c95a24114ad67 100644 --- a/arch/arm/boot/dts/overlays/Makefile +++ b/arch/arm/boot/dts/overlays/Makefile @@ -3,6 +3,7 @@ dtb-$(CONFIG_ARCH_BCM2835) += overlay_map.dtb hat_map.dtb dtbo-$(CONFIG_ARCH_BCM2835) += \ + productshop-devboard.dtbo \ act-led.dtbo \ adafruit-st7735r.dtbo \ adafruit18.dtbo \ diff --git a/arch/arm/boot/dts/overlays/goodix-overlay.dts b/arch/arm/boot/dts/overlays/goodix-overlay.dts index 8a5035df9daa6..161986746a422 100644 --- a/arch/arm/boot/dts/overlays/goodix-overlay.dts +++ b/arch/arm/boot/dts/overlays/goodix-overlay.dts @@ -6,18 +6,25 @@ compatible = "brcm,bcm2835"; fragment@0 { + target = <&i2c1>; + __overlay__ { + status = "disabled"; + }; +}; + + fragment@1 { target = <&gpio>; __overlay__ { goodix_pins: goodix_pins { - brcm,pins = <4 17>; // interrupt and reset + brcm,pins = <3 2>; // interrupt and reset brcm,function = <0 0>; // in brcm,pull = <2 2>; // pull-up }; }; }; - i2c_frag: fragment@1 { - target = <&i2c1>; + i2c_frag: fragment@2 { + target = <&i2c6>; __overlay__ { #address-cells = <1>; #size-cells = <0>; @@ -30,8 +37,8 @@ pinctrl-0 = <&goodix_pins>; interrupt-parent = <&gpio>; interrupts = <4 2>; // high-to-low edge triggered - irq-gpios = <&gpio 4 0>; // Pin7 on GPIO header - reset-gpios = <&gpio 17 0>; // Pin11 on GPIO header + irq-gpios = <&gpio 3 0>; // Pin3 on GPIO header + reset-gpios = <&gpio 2 0>; // Pin2 on GPIO header }; }; }; @@ -40,9 +47,9 @@ addr = <>9271>,"reg:0"; interrupt = <&goodix_pins>,"brcm,pins:0", <>9271>,"interrupts:0", - <>9271>,"irq-gpios:4"; - reset = <&goodix_pins>,"brcm,pins:4", - <>9271>,"reset-gpios:4"; + <>9271>,"irq-gpios:3"; + reset = <&goodix_pins>,"brcm,pins:2", + <>9271>,"reset-gpios:2"; i2c-path = <&i2c_frag>, "target?=0", <&i2c_frag>, "target-path"; }; diff --git a/arch/arm/boot/dts/overlays/productshop-devboard-overlay.dts b/arch/arm/boot/dts/overlays/productshop-devboard-overlay.dts new file mode 100644 index 0000000000000..f00e7d9ddfce5 --- /dev/null +++ b/arch/arm/boot/dts/overlays/productshop-devboard-overlay.dts @@ -0,0 +1,218 @@ +/dts-v1/; +/plugin/; + +/ { + compatible = "brcm,bcm2712"; + + /* + * ------------------------------------------------------------------ + * fragment@0: Configure i2c1 on pins 10/11 + * ------------------------------------------------------------------ + */ + fragment@0 { + target = <&i2c1>; + __overlay__ { + pinctrl-0 = <&rp1_i2c1_10_11>; + status = "okay"; + }; + }; + + /* + * ------------------------------------------------------------------ + * fragment@1: GPIO pins for Goodix touchscreen (interrupt, reset) + * ------------------------------------------------------------------ + */ + fragment@1 { + target = <&gpio>; + __overlay__ { + goodix_pins: goodix_pins { + brcm,pins = <3 2>; // GPIO3=interrupt, GPIO2=reset + brcm,function = <0 0>; // 0 = input + brcm,pull = <2 2>; // 2 = pull-up + }; + }; + }; + + /* + * ------------------------------------------------------------------ + * fragment@2: Goodix touchscreen on i2c6 + * ------------------------------------------------------------------ + */ + i2c_frag: fragment@2 { + target = <&i2c6>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + gt9110: gt9110@14 { + compatible = "goodix,gt9110"; + reg = <0x14>; + pinctrl-names = "default"; + pinctrl-0 = <&goodix_pins>; + + interrupt-parent = <&gpio>; + interrupts = <3 1>; // GPIO3, rising edge (adjust if needed) + irq-gpios = <&gpio 3 0>; + reset-gpios = <&gpio 2 0>; + + touchscreen-size-x = <1280>; + touchscreen-size-y = <800>; + touchscreen-swapped-x-y; + touchscreen-inverted-y; + }; + }; + }; + + /* + * ------------------------------------------------------------------ + * fragment@3: DSI panel at dsi1 + * ------------------------------------------------------------------ + */ + dsi_frag: fragment@3 { + 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,4lane"; + + port { + panel_in: endpoint { + remote-endpoint = <&dsi_out>; + }; + }; + }; + }; + }; + + /* + * ------------------------------------------------------------------ + * fragment@4: LSM6DSL IMU on i2c1 at 0x6A + * ------------------------------------------------------------------ + */ + fragment@4 { + target = <&i2c1>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + lsm6dsl: lsm6dsl@6a { + compatible = "st,lsm6dsl"; + reg = <0x6a>; + status = "okay"; + }; + }; + }; + + /* + * ------------------------------------------------------------------ + * fragment@5: Enable i2c3 on pins 22/23 and add BQ2589x + BQ274xx + * ------------------------------------------------------------------ + */ + fragment@5 { + target = <&i2c3>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; + pinctrl-0 = <&rp1_i2c3_22_23>; + status = "okay"; + + charger: charger@6a { + compatible = "ti,bq25890"; + reg = <0x6a>; + + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_charger>; // references fragment@6 below + + /* + * interrupt on GPIO24, falling edge (2). + */ + interrupt-parent = <&gpio>; + interrupts = <24 2>; + + ti,battery-regulation-voltage = <4192000>; + ti,charge-current = <1600000>; + ti,termination-current = <66000>; + ti,precharge-current = <130000>; + ti,minimum-sys-voltage = <2700000>; + ti,boost-voltage = <5000000>; + ti,boost-max-current = <50000>; + }; + + bq27441_fg: bq27441-battery@55 { + compatible = "ti,bq27411"; + reg = <0x55>; + status = "okay"; + }; + }; + }; + + /* + * ------------------------------------------------------------------ + * fragment@6: Define pinctrl_charger to set GPIO24 as input + pull-up + * ------------------------------------------------------------------ + */ + fragment@6 { + target = <&gpio>; /* or the correct pinctrl node label in Pi 5 base DT */ + __overlay__ { + pinctrl_charger: pinctrl_charger { + brcm,pins = <24>; + brcm,function = <0>; // 0 = GPIO input + brcm,pull = <2>; // 2 = pull-up + }; + }; + }; + + /* + * ------------------------------------------------------------------ + * __overrides__ Section + * ------------------------------------------------------------------ + */ + __overrides__ { + /* Touchscreen & LSM6DSL address override */ + addr = <>9110>,"reg:0", + <&lsm6dsl>,"reg:0"; + + /* Touchscreen interrupt override */ + interrupt = <&goodix_pins>,"brcm,pins:0", + <>9110>,"interrupts:0", + <>9110>,"irq-gpios:3"; + + /* Touchscreen reset override */ + reset = <&goodix_pins>,"brcm,pins:2", + <>9110>,"reset-gpios:2"; + + /* i2c path for Goodix */ + i2c-path = <&i2c_frag>, "target?=0", + <&i2c_frag>, "target-path"; + + /* DSI panel compatibility string overrides */ + 4_0_inch_a = <&dsi_panel>, "compatible=waveshare,4.0-dsi-touch-a"; + 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_a = <&dsi_panel>, "compatible=waveshare,7.0-dsi-touch-a"; + 7_0_inch_b = <&dsi_panel>, "compatible=waveshare,7.0-dsi-touch-b"; + 7_0_inch_c = <&dsi_panel>, "compatible=waveshare,7.0-dsi-touch-c"; + 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"; + 8_1_inch_a = <&dsi_panel>, "compatible=waveshare,8.1-dsi-touch-a"; + 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"; + 10_1_inch_b = <&dsi_panel>, "compatible=waveshare,10.1-dsi-touch-b"; + 10_1_inch_b_4lane = <&dsi_panel>, "compatible=waveshare,10.1-dsi-touch-b,4lane"; + + /* Optional named parameter to enable LSM6DSL if needed */ + lsm6dsl = <0>,"+0"; + }; +}; \ No newline at end of file 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 0000000000000..7275978cac220 --- /dev/null +++ b/arch/arm/boot/dts/overlays/vc4-kms-dsi-waveshare-panel-v2-overlay.dts @@ -0,0 +1,54 @@ +/* + * vc4-kms-dsi-ili9881-5inch-overlay.dts + */ + +/dts-v1/; +/plugin/; + +/ { + compatible = "brcm,bcm2835"; + + + dsi_frag: fragment@0 { + 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,4lane"; + // panel-orientation = "left_side_up"; + + port { + panel_in: endpoint { + remote-endpoint = <&dsi_out>; + }; + }; + }; + }; + }; + + __overrides__ { + 4_0_inch_a = <&dsi_panel>, "compatible=waveshare,4.0-dsi-touch-a"; + 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_a = <&dsi_panel>, "compatible=waveshare,7.0-dsi-touch-a"; + 7_0_inch_b = <&dsi_panel>, "compatible=waveshare,7.0-dsi-touch-b"; + 7_0_inch_c = <&dsi_panel>, "compatible=waveshare,7.0-dsi-touch-c"; + 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"; + 8_1_inch_a = <&dsi_panel>, "compatible=waveshare,8.1-dsi-touch-a"; + 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"; + 10_1_inch_b = <&dsi_panel>, "compatible=waveshare,10.1-dsi-touch-b"; + 10_1_inch_b_4lane = <&dsi_panel>, "compatible=waveshare,10.1-dsi-touch-b,4lane"; + }; +}; diff --git a/arch/arm64/configs/android_rpi5_defconfig b/arch/arm64/configs/android_rpi5_defconfig index 5c39f8abf3fff..f88859fb573a9 100644 --- a/arch/arm64/configs/android_rpi5_defconfig +++ b/arch/arm64/configs/android_rpi5_defconfig @@ -3153,7 +3153,7 @@ CONFIG_RPI_POE_POWER=y # CONFIG_BATTERY_SBS is not set # CONFIG_CHARGER_SBS is not set # CONFIG_MANAGER_SBS is not set -# CONFIG_BATTERY_BQ27XXX is not set +CONFIG_BATTERY_BQ27XXX=y # CONFIG_BATTERY_MAX17040 is not set # CONFIG_BATTERY_MAX17042 is not set # CONFIG_CHARGER_ISP1704 is not set @@ -3170,7 +3170,7 @@ CONFIG_RPI_POE_POWER=y # CONFIG_CHARGER_BQ24257 is not set # CONFIG_CHARGER_BQ24735 is not set # CONFIG_CHARGER_BQ2515X is not set -# CONFIG_CHARGER_BQ25890 is not set +CONFIG_CHARGER_BQ25890=y # CONFIG_CHARGER_BQ25980 is not set # CONFIG_CHARGER_BQ256XX is not set # CONFIG_CHARGER_SMB347 is not set @@ -4234,6 +4234,8 @@ CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN=y # CONFIG_DRM_PANEL_VISIONOX_VTDR6130 is not set # CONFIG_DRM_PANEL_VISIONOX_R66451 is not set CONFIG_DRM_PANEL_WAVESHARE_TOUCHSCREEN=y +CONFIG_DRM_PANEL_WAVESHARE_DSI_V2=y +CONFIG_REGULATOR_WAVESHARE_PANEL=y # CONFIG_DRM_PANEL_WIDECHIPS_WS2401 is not set # CONFIG_DRM_PANEL_XINPENG_XPP055C272 is not set # end of Display Panels diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index 307dd2c0fae41..e27ea84a146ae 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -867,4 +867,14 @@ config DRM_PANEL_XINPENG_XPP055C272 Say Y here if you want to enable support for the Xinpeng XPP055C272 controller for 720x1280 LCD panels with MIPI/RGB/SPI system interfaces. + +config DRM_PANEL_WAVESHARE_DSI_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 v2. To compile this driver as a module, + choose M here. endmenu diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile index 9dd9b35038027..0a95d4b6ecdef 100644 --- a/drivers/gpu/drm/panel/Makefile +++ b/drivers/gpu/drm/panel/Makefile @@ -88,3 +88,4 @@ obj-$(CONFIG_DRM_PANEL_VISIONOX_R66451) += panel-visionox-r66451.o obj-$(CONFIG_DRM_PANEL_WAVESHARE_TOUCHSCREEN) += panel-waveshare-dsi.o obj-$(CONFIG_DRM_PANEL_WIDECHIPS_WS2401) += panel-widechips-ws2401.o obj-$(CONFIG_DRM_PANEL_XINPENG_XPP055C272) += panel-xinpeng-xpp055c272.o +obj-$(CONFIG_DRM_PANEL_WAVESHARE_DSI_V2) += panel-waveshare-dsi-v2.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 0000000000000..cd2e9f2fc75d5 --- /dev/null +++ b/drivers/gpu/drm/panel/panel-waveshare-dsi-v2.c @@ -0,0 +1,2418 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright © 2023 Raspberry Pi Ltd + * + * Based on panel-raspberrypi-touchscreen by Broadcom + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include