Skip to content
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/display/panel/waveshare,dsi-touch.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Waveshare DSI Touchscreen Panels

maintainers:
- Waveshare_Team <support@waveshare.com>

description: |
Waveshare DSI touchscreen panels with integrated touch controller.
These panels use MIPI DSI interface and come in various sizes from
3.4" to 12.3".

properties:
compatible:
items:
- enum:
- waveshare,3.4-dsi-touch-c
- waveshare,4.0-dsi-touch-a
- waveshare,4.0-dsi-touch-c
- waveshare,4.3-dsi-touch-a
- waveshare,5.0-dsi-touch-a
- waveshare,5.5-dsi-touch-a
- waveshare,7.0-dsi-touch-a
- waveshare,7.0-dsi-touch-b
- waveshare,7.0-dsi-touch-c
- waveshare,8.0-dsi-touch-a
- waveshare,8.0-dsi-touch-a-4lane
- waveshare,8.8-dsi-touch-a
- waveshare,9.0-dsi-touch-b
- waveshare,9.0-dsi-touch-b,4lane
- waveshare,10.1-dsi-touch-a
- waveshare,10.1-dsi-touch-a-4lane
- waveshare,10.1-dsi-touch-b
- waveshare,10.1-dsi-touch-b,4lane
- waveshare,12.3-dsi-touch-a,4lane

reg:
description: DSI virtual channel
maxItems: 1

port: true
reset-gpios: true
rotation: true
backlight: true

required:
- compatible
- reg
- port

allOf:
- $ref: panel-common.yaml#

unevaluatedProperties: false

examples:
- |
dsi {
#address-cells = <1>;
#size-cells = <0>;

panel@0 {
compatible = "waveshare,4.0-dsi-touch-a";
reg = <0>;
reset-gpios = <&gpio 4 1 GPIO_ACTIVE_HIGH>;
backlight = <&backlight>;

port {
panel_in: endpoint {
remote-endpoint = <&dsi_out>;
};
};
};
};
2 changes: 2 additions & 0 deletions arch/arm/boot/dts/overlays/README
Original file line number Diff line number Diff line change
Expand Up @@ -5961,7 +5961,9 @@ Info: Enable the Waveshare DSI-TOUCH series screen
Requires vc4-kms-v3d to be loaded.
Load: dtoverlay=vc4-kms-dsi-waveshare-panel-v2,<param>
Params: 3_4_inch_c 3.4" 800x800 2lane
4_0_inch_a 4.0" 480x800 2lane
4_0_inch_c 4.0" 720x720 2lane
4_3_inch_a 4.3" 480x800 2lane
5_0_inch_a 5.0" 720x1280 2lane
5_5_inch_a 5.5" 720x1280 2lane
7_0_inch_a 7.0" A 720x1280 2lane
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,18 @@

__overrides__ {
3_4_inch_c = <&dsi_panel>, "compatible=waveshare,3.4-dsi-touch-c";
4_0_inch_a = <&dsi_panel>, "compatible=waveshare,4.0-dsi-touch-a";
4_0_inch_c = <&dsi_panel>, "compatible=waveshare,4.0-dsi-touch-c";
4_3_inch_a = <&dsi_panel>, "compatible=waveshare,4.3-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_8_inch_a = <&dsi_panel>, "compatible=waveshare,8.8-dsi-touch-a";
8_8_inch_a = <&dsi_panel>, "compatible=waveshare,8.8-dsi-touch-a",
<&display_mcu>, "pre-power-on?";
9_0_inch_b = <&dsi_panel>, "compatible=waveshare,9.0-dsi-touch-b",
<&touch>, "touchscreen-inverted-x";
9_0_inch_b_4lane = <&dsi_panel>, "compatible=waveshare,9.0-dsi-touch-b,4lane",
Expand Down
151 changes: 148 additions & 3 deletions drivers/gpu/drm/panel/panel-waveshare-dsi-v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1490,6 +1490,103 @@ static const struct panel_init_cmd ws_panel_5_a_init[] = {
{},
};

static const struct panel_init_cmd ws_panel_4_3_a_init[] = {
_INIT_DCS_CMD(0xFF, 0x77, 0x01, 0x00, 0x00, 0x13),
_INIT_DCS_CMD(0xEF, 0x08),
_INIT_DCS_CMD(0xFF, 0x77, 0x01, 0x00, 0x00, 0x10),
_INIT_DCS_CMD(0xC0, 0x63, 0x00),
_INIT_DCS_CMD(0xC1, 0x0D, 0x02),
_INIT_DCS_CMD(0xC2, 0x17, 0x08),
_INIT_DCS_CMD(0xCC, 0x10),
_INIT_DCS_CMD(0xB0, 0x40, 0xC9, 0x94, 0x0E, 0x10, 0x05, 0x0B, 0x09,
0x08, 0x26, 0x04, 0x52, 0x10, 0x69, 0x6B, 0x69),
_INIT_DCS_CMD(0xB1, 0x40, 0xD2, 0x98, 0x0C, 0x92, 0x07, 0x09, 0x08,
0x07, 0x25, 0x02, 0x0E, 0x0C, 0x6E, 0x78, 0x55),
_INIT_DCS_CMD(0xFF, 0x77, 0x01, 0x00, 0x00, 0x11),
_INIT_DCS_CMD(0xB0, 0x5D),
_INIT_DCS_CMD(0xB1, 0x4E),
_INIT_DCS_CMD(0xB2, 0x87),
_INIT_DCS_CMD(0xB3, 0x80),
_INIT_DCS_CMD(0xB5, 0x4E),
_INIT_DCS_CMD(0xB7, 0x85),
_INIT_DCS_CMD(0xB8, 0x21),
_INIT_DCS_CMD(0xB9, 0x10, 0x1F),
_INIT_DCS_CMD(0xBB, 0x03),
_INIT_DCS_CMD(0xBC, 0x00),
_INIT_DCS_CMD(0xC1, 0x78),
_INIT_DCS_CMD(0xC2, 0x78),
_INIT_DCS_CMD(0xD0, 0x88),
_INIT_DCS_CMD(0xE0, 0x00, 0x3A, 0x02),
_INIT_DCS_CMD(0xE1, 0x04, 0xA0, 0x00, 0xA0, 0x05, 0xA0, 0x00, 0xA0,
0x00, 0x40, 0x40),
_INIT_DCS_CMD(0xE2, 0x30, 0x00, 0x40, 0x40, 0x32, 0xA0, 0x00, 0xA0,
0x00, 0xA0, 0x00, 0xA0, 0x00),
_INIT_DCS_CMD(0xE3, 0x00, 0x00, 0x33, 0x33),
_INIT_DCS_CMD(0xE4, 0x44, 0x44),
_INIT_DCS_CMD(0xE5, 0x09, 0x2E, 0xA0, 0xA0, 0x0B, 0x30, 0xA0, 0xA0,
0x05, 0x2A, 0xA0, 0xA0, 0x07, 0x2C, 0xA0, 0xA0),
_INIT_DCS_CMD(0xE6, 0x00, 0x00, 0x33, 0x33),
_INIT_DCS_CMD(0xE7, 0x44, 0x44),
_INIT_DCS_CMD(0xE8, 0x08, 0x2D, 0xA0, 0xA0, 0x0A, 0x2F, 0xA0, 0xA0,
0x04, 0x29, 0xA0, 0xA0, 0x06, 0x2B, 0xA0, 0xA0),
_INIT_DCS_CMD(0xEB, 0x00, 0x00, 0x4E, 0x4E, 0x00, 0x00, 0x00),
_INIT_DCS_CMD(0xEC, 0x08, 0x01),
_INIT_DCS_CMD(0xED, 0xB0, 0x2B, 0x98, 0xA4, 0x56, 0x7F, 0xFF, 0xFF,
0xFF, 0xFF, 0xF7, 0x65, 0x4A, 0x89, 0xB2, 0x0B),
_INIT_DCS_CMD(0xEF, 0x08, 0x08, 0x08, 0x45, 0x3F, 0x54),
_INIT_DCS_CMD(0xFF, 0x77, 0x01, 0x00, 0x00, 0x00),
_INIT_DCS_CMD(0x11),
_INIT_DELAY_CMD(120),
_INIT_DCS_CMD(0x29),
_INIT_DELAY_CMD(20),
{},
};

static const struct panel_init_cmd ws_panel_4_a_init[] = {
_INIT_DCS_CMD(0x11),
_INIT_DELAY_CMD(200),
_INIT_DCS_CMD(0xFF, 0x77, 0x01, 0x00, 0x00, 0x10),
_INIT_DCS_CMD(0xC0, 0x63, 0x00),
_INIT_DCS_CMD(0xC1, 0x0A, 0x02),
_INIT_DCS_CMD(0xC2, 0x31, 0x08),
_INIT_DCS_CMD(0xB0, 0x00, 0x11, 0x19, 0x0C, 0x10, 0x06, 0x07, 0x0A,
0x09, 0x22, 0x04, 0x10, 0x0E, 0x28, 0x30, 0x1C),
_INIT_DCS_CMD(0xB1, 0x00, 0x12, 0x19, 0x0D, 0x10, 0x04, 0x06, 0x07,
0x08, 0x23, 0x04, 0x12, 0x11, 0x28, 0x30, 0x1C),
_INIT_DCS_CMD(0xFF, 0x77, 0x01, 0x00, 0x00, 0x11),
_INIT_DCS_CMD(0xB0, 0x4D),
_INIT_DCS_CMD(0xB1, 0x3E),
_INIT_DCS_CMD(0xB2, 0x07),
_INIT_DCS_CMD(0xB3, 0x80),
_INIT_DCS_CMD(0xB5, 0x47),
_INIT_DCS_CMD(0xB7, 0x8A),
_INIT_DCS_CMD(0xB8, 0x21),
_INIT_DCS_CMD(0xC1, 0x78),
_INIT_DCS_CMD(0xC2, 0x78),
_INIT_DCS_CMD(0xD0, 0x88),
_INIT_DELAY_CMD(100),
_INIT_DCS_CMD(0xE0, 0x00, 0x00, 0x02),
_INIT_DCS_CMD(0xE1, 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
0x00, 0x20, 0x20),
_INIT_DCS_CMD(0xE2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00),
_INIT_DCS_CMD(0xE3, 0x00, 0x00, 0x33, 0x00),
_INIT_DCS_CMD(0xE4, 0x22, 0x00),
_INIT_DCS_CMD(0xE5, 0x04, 0x34, 0xAA, 0xAA, 0x06, 0x34, 0xAA, 0xAA,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00),
_INIT_DCS_CMD(0xE6, 0x00, 0x00, 0x33, 0x00),
_INIT_DCS_CMD(0xE7, 0x22, 0x00),
_INIT_DCS_CMD(0xE8, 0x05, 0x34, 0xAA, 0xAA, 0x07, 0x34, 0xAA, 0xAA,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00),
_INIT_DCS_CMD(0xEB, 0x02, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00),
_INIT_DCS_CMD(0xED, 0xFA, 0x45, 0x0B, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xB0, 0x54, 0xAF),
_INIT_DCS_CMD(0xFF, 0x77, 0x01, 0x00, 0x00, 0x00),
_INIT_DELAY_CMD(10),
_INIT_DCS_CMD(0x29),
{},
};

static const struct panel_init_cmd ws_panel_4_c_init[] = {
_INIT_DCS_CMD(0xE0, 0x00), _INIT_DCS_CMD(0xE1, 0x93),
_INIT_DCS_CMD(0xE2, 0x65), _INIT_DCS_CMD(0xE3, 0xF8),
Expand Down Expand Up @@ -1963,6 +2060,34 @@ static const struct drm_display_mode ws_panel_5_a_mode = {
.height_mm = 110,
};

static const struct drm_display_mode ws_panel_4_3_a_mode = {
.clock = 30000,
.hdisplay = 480,
.hsync_start = 480 + 42,
.hsync_end = 480 + 42 + 12,
.htotal = 480 + 42 + 12 + 42,
.vdisplay = 800,
.vsync_start = 800 + 60,
.vsync_end = 800 + 60 + 8,
.vtotal = 800 + 60 + 8 + 2,
.width_mm = 56,
.height_mm = 93,
};

static const struct drm_display_mode ws_panel_4_a_mode = {
.clock = 27200,
.hdisplay = 480,
.hsync_start = 480 + 30,
.hsync_end = 480 + 30 + 30,
.htotal = 480 + 30 + 30 + 8,
.vdisplay = 800,
.vsync_start = 800 + 12,
.vsync_end = 800 + 12 + 12,
.vtotal = 800 + 12 + 12 + 2,
.width_mm = 51,
.height_mm = 86,
};

static const struct drm_display_mode ws_panel_4_c_mode = {
.clock = 36500,
.hdisplay = 720,
Expand Down Expand Up @@ -2052,17 +2177,17 @@ static int ws_panel_dsi_probe(struct mipi_dsi_device *dsi)
drm_panel_init(&ctx->panel, &dsi->dev, &ws_panel_funcs,
DRM_MODE_CONNECTOR_DSI);

ctx->reset = devm_gpiod_get_optional(&dsi->dev, "reset", GPIOD_OUT_LOW);
ctx->reset = devm_gpiod_get_optional(&dsi->dev, "reset", GPIOD_ASIS);
if (IS_ERR(ctx->reset))
return dev_err_probe(&dsi->dev, PTR_ERR(ctx->reset),
"Couldn't get our reset GPIO\n");

ctx->iovcc = devm_gpiod_get_optional(&dsi->dev, "iovcc", GPIOD_OUT_LOW);
ctx->iovcc = devm_gpiod_get_optional(&dsi->dev, "iovcc", GPIOD_ASIS);
if (IS_ERR(ctx->iovcc))
return dev_err_probe(&dsi->dev, PTR_ERR(ctx->iovcc),
"Couldn't get our iovcc GPIO\n");

ctx->avdd = devm_gpiod_get_optional(&dsi->dev, "avdd", GPIOD_OUT_LOW);
ctx->avdd = devm_gpiod_get_optional(&dsi->dev, "avdd", GPIOD_ASIS);
if (IS_ERR(ctx->avdd))
return dev_err_probe(&dsi->dev, PTR_ERR(ctx->avdd),
"Couldn't get our avdd GPIO\n");
Expand Down Expand Up @@ -2261,6 +2386,24 @@ static const struct ws_panel_desc ws_panel_5_inch_a_desc = {
.format = MIPI_DSI_FMT_RGB888,
};

static const struct ws_panel_desc ws_panel_4_3_inch_a_desc = {
.init = ws_panel_4_3_a_init,
.mode = &ws_panel_4_3_a_mode,
.mode_flags = MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_MODE_VIDEO |
MIPI_DSI_MODE_LPM | MIPI_DSI_CLOCK_NON_CONTINUOUS,
.lanes = 2,
.format = MIPI_DSI_FMT_RGB888,
};

static const struct ws_panel_desc ws_panel_4_inch_a_desc = {
.init = ws_panel_4_a_init,
.mode = &ws_panel_4_a_mode,
.mode_flags = MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_MODE_VIDEO |
MIPI_DSI_MODE_LPM | MIPI_DSI_CLOCK_NON_CONTINUOUS,
.lanes = 2,
.format = MIPI_DSI_FMT_RGB888,
};

static const struct ws_panel_desc ws_panel_4_inch_c_desc = {
.init = ws_panel_4_c_init,
.mode = &ws_panel_4_c_mode,
Expand Down Expand Up @@ -2304,6 +2447,8 @@ static const struct of_device_id ws_panel_of_match[] = {
{ .compatible = "waveshare,5.5-dsi-touch-a",
&ws_panel_5_5_inch_a_desc },
{ .compatible = "waveshare,5.0-dsi-touch-a", &ws_panel_5_inch_a_desc },
{ .compatible = "waveshare,4.3-dsi-touch-a", &ws_panel_4_3_inch_a_desc },
{ .compatible = "waveshare,4.0-dsi-touch-a", &ws_panel_4_inch_a_desc },
{ .compatible = "waveshare,4.0-dsi-touch-c", &ws_panel_4_inch_c_desc },
{ .compatible = "waveshare,3.4-dsi-touch-c",
&ws_panel_3_4_inch_c_desc },
Expand Down
10 changes: 9 additions & 1 deletion drivers/regulator/waveshare-panel-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ static int waveshare_panel_i2c_probe(struct i2c_client *i2c)
struct waveshare_panel_lcd *state;
struct regmap *regmap;
unsigned int data;
bool pre_power_on;
int ret;

state = devm_kzalloc(&i2c->dev, sizeof(*state), GFP_KERNEL);
Expand All @@ -226,6 +227,8 @@ static int waveshare_panel_i2c_probe(struct i2c_client *i2c)
goto error;
}

pre_power_on = device_property_read_bool(&i2c->dev, "pre-power-on");

ret = waveshare_panel_i2c_read(i2c, REG_ID, &data);
if (ret == 0)
dev_info(&i2c->dev, "waveshare panel hw id = 0x%x\n", data);
Expand All @@ -241,9 +244,14 @@ static int waveshare_panel_i2c_probe(struct i2c_client *i2c)

state->direction_state = 0;
state->poweron_state = BIT(9) | BIT(8); // Enable VCC
if (pre_power_on)
state->poweron_state |= BIT(4) | BIT(1) | BIT(0);
regmap_write(regmap, REG_TP, state->poweron_state >> 8);
regmap_write(regmap, REG_LCD, state->poweron_state & 0xff);
msleep(20);
if (pre_power_on)
msleep(200);
else
msleep(20);

state->regmap = regmap;
state->gc.parent = &i2c->dev;
Expand Down
Loading