Skip to content

Waveshare v2 panel support #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions arch/arm/boot/dts/overlays/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
23 changes: 15 additions & 8 deletions arch/arm/boot/dts/overlays/goodix-overlay.dts
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
Expand All @@ -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
};
};
};
Expand All @@ -40,9 +47,9 @@
addr = <&gt9271>,"reg:0";
interrupt = <&goodix_pins>,"brcm,pins:0",
<&gt9271>,"interrupts:0",
<&gt9271>,"irq-gpios:4";
reset = <&goodix_pins>,"brcm,pins:4",
<&gt9271>,"reset-gpios:4";
<&gt9271>,"irq-gpios:3";
reset = <&goodix_pins>,"brcm,pins:2",
<&gt9271>,"reset-gpios:2";
i2c-path = <&i2c_frag>, "target?=0",
<&i2c_frag>, "target-path";
};
Expand Down
218 changes: 218 additions & 0 deletions arch/arm/boot/dts/overlays/productshop-devboard-overlay.dts
Original file line number Diff line number Diff line change
@@ -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 = <&gt9110>,"reg:0",
<&lsm6dsl>,"reg:0";

/* Touchscreen interrupt override */
interrupt = <&goodix_pins>,"brcm,pins:0",
<&gt9110>,"interrupts:0",
<&gt9110>,"irq-gpios:3";

/* Touchscreen reset override */
reset = <&goodix_pins>,"brcm,pins:2",
<&gt9110>,"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";
};
};
Original file line number Diff line number Diff line change
@@ -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";
};
};
6 changes: 4 additions & 2 deletions arch/arm64/configs/android_rpi5_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions drivers/gpu/drm/panel/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions drivers/gpu/drm/panel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading