mirror of
https://github.com/openwrt/openwrt.git
synced 2025-01-27 06:39:51 +00:00
3a5584e0df
Adds latest 6.6 patches from the Raspberry Pi repository. These patches were generated from: https://github.com/raspberrypi/linux/commits/rpi-6.6.y/ With the following command: git format-patch -N v6.6.67..HEAD (HEAD -> 811ff707533bcd67cdcd368bbd46223082009b12) Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> (cherry picked from commit 692205305db14deeff1a2dc4a6d7f87e19fc418b)
310 lines
9.0 KiB
Diff
310 lines
9.0 KiB
Diff
From 4a89fda8f73df89e009a6188ef07ab97b1d03c7f Mon Sep 17 00:00:00 2001
|
|
From: eng33 <eng33@waveshare.com>
|
|
Date: Thu, 5 Dec 2024 17:20:22 +0800
|
|
Subject: [PATCH] drivers:gpu:drm:panel: Added waveshare 13.3inch panel(support
|
|
2/4lane)
|
|
|
|
Signed-off-by: eng33 <eng33@waveshare.com>
|
|
---
|
|
drivers/gpu/drm/panel/panel-waveshare-dsi.c | 155 +++++++++++++++++---
|
|
1 file changed, 138 insertions(+), 17 deletions(-)
|
|
|
|
--- a/drivers/gpu/drm/panel/panel-waveshare-dsi.c
|
|
+++ b/drivers/gpu/drm/panel/panel-waveshare-dsi.c
|
|
@@ -32,6 +32,12 @@ struct ws_panel {
|
|
enum drm_panel_orientation orientation;
|
|
};
|
|
|
|
+struct ws_panel_data {
|
|
+ const struct drm_display_mode *mode;
|
|
+ int lanes;
|
|
+ unsigned long mode_flags;
|
|
+};
|
|
+
|
|
/* 2.8inch 480x640
|
|
* https://www.waveshare.com/product/raspberry-pi/displays/2.8inch-dsi-lcd.htm
|
|
*/
|
|
@@ -47,6 +53,12 @@ static const struct drm_display_mode ws_
|
|
.vtotal = 640 + 150 + 50 + 150,
|
|
};
|
|
|
|
+static const struct ws_panel_data ws_panel_2_8_data = {
|
|
+ .mode = &ws_panel_2_8_mode,
|
|
+ .lanes = 2,
|
|
+ .mode_flags = MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS,
|
|
+};
|
|
+
|
|
/* 3.4inch 800x800 Round
|
|
* https://www.waveshare.com/product/displays/lcd-oled/3.4inch-dsi-lcd-c.htm
|
|
*/
|
|
@@ -62,6 +74,12 @@ static const struct drm_display_mode ws_
|
|
.vtotal = 800 + 8 + 4 + 16,
|
|
};
|
|
|
|
+static const struct ws_panel_data ws_panel_3_4_data = {
|
|
+ .mode = &ws_panel_3_4_mode,
|
|
+ .lanes = 2,
|
|
+ .mode_flags = MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS,
|
|
+};
|
|
+
|
|
/* 4.0inch 480x800
|
|
* https://www.waveshare.com/product/raspberry-pi/displays/4inch-dsi-lcd.htm
|
|
*/
|
|
@@ -77,6 +95,12 @@ static const struct drm_display_mode ws_
|
|
.vtotal = 800 + 20 + 100 + 20,
|
|
};
|
|
|
|
+static const struct ws_panel_data ws_panel_4_0_data = {
|
|
+ .mode = &ws_panel_4_0_mode,
|
|
+ .lanes = 2,
|
|
+ .mode_flags = MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS,
|
|
+};
|
|
+
|
|
/* 7.0inch C 1024x600
|
|
* https://www.waveshare.com/product/raspberry-pi/displays/lcd-oled/7inch-dsi-lcd-c-with-case-a.htm
|
|
*/
|
|
@@ -92,6 +116,12 @@ static const struct drm_display_mode ws_
|
|
.vtotal = 600 + 10 + 10 + 10,
|
|
};
|
|
|
|
+static const struct ws_panel_data ws_panel_7_0_c_data = {
|
|
+ .mode = &ws_panel_7_0_c_mode,
|
|
+ .lanes = 2,
|
|
+ .mode_flags = MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS,
|
|
+};
|
|
+
|
|
/* 7.9inch 400x1280
|
|
* https://www.waveshare.com/product/raspberry-pi/displays/7.9inch-dsi-lcd.htm
|
|
*/
|
|
@@ -107,6 +137,12 @@ static const struct drm_display_mode ws_
|
|
.vtotal = 1280 + 20 + 10 + 20,
|
|
};
|
|
|
|
+static const struct ws_panel_data ws_panel_7_9_data = {
|
|
+ .mode = &ws_panel_7_9_mode,
|
|
+ .lanes = 2,
|
|
+ .mode_flags = MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS,
|
|
+};
|
|
+
|
|
/* 8.0inch or 10.1inch 1280x800
|
|
* https://www.waveshare.com/product/raspberry-pi/displays/8inch-dsi-lcd-c.htm
|
|
* https://www.waveshare.com/product/raspberry-pi/displays/10.1inch-dsi-lcd-c.htm
|
|
@@ -123,6 +159,12 @@ static const struct drm_display_mode ws_
|
|
.vtotal = 800 + 40 + 48 + 40,
|
|
};
|
|
|
|
+static const struct ws_panel_data ws_panel_10_1_data = {
|
|
+ .mode = &ws_panel_10_1_mode,
|
|
+ .lanes = 2,
|
|
+ .mode_flags = MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS,
|
|
+};
|
|
+
|
|
/* 11.9inch 320x1480
|
|
* https://www.waveshare.com/product/raspberry-pi/displays/11.9inch-dsi-lcd.htm
|
|
*/
|
|
@@ -138,6 +180,12 @@ static const struct drm_display_mode ws_
|
|
.vtotal = 1480 + 60 + 60 + 60,
|
|
};
|
|
|
|
+static const struct ws_panel_data ws_panel_11_9_data = {
|
|
+ .mode = &ws_panel_11_9_mode,
|
|
+ .lanes = 2,
|
|
+ .mode_flags = MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS,
|
|
+};
|
|
+
|
|
static const struct drm_display_mode ws_panel_4_mode = {
|
|
.clock = 50000,
|
|
.hdisplay = 720,
|
|
@@ -150,6 +198,12 @@ static const struct drm_display_mode ws_
|
|
.vtotal = 720 + 8 + 4 + 16,
|
|
};
|
|
|
|
+static const struct ws_panel_data ws_panel_4_data = {
|
|
+ .mode = &ws_panel_4_mode,
|
|
+ .lanes = 2,
|
|
+ .mode_flags = MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS,
|
|
+};
|
|
+
|
|
/* 5.0inch 720x1280
|
|
* https://www.waveshare.com/5inch-dsi-lcd-d.htm
|
|
*/
|
|
@@ -165,6 +219,12 @@ static const struct drm_display_mode ws_
|
|
.vtotal = 1280 + 20 + 20 + 20,
|
|
};
|
|
|
|
+static const struct ws_panel_data ws_panel_5_0_data = {
|
|
+ .mode = &ws_panel_5_0_mode,
|
|
+ .lanes = 2,
|
|
+ .mode_flags = MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS,
|
|
+};
|
|
+
|
|
/* 6.25inch 720x1560
|
|
* https://www.waveshare.com/6.25inch-dsi-lcd.htm
|
|
*/
|
|
@@ -180,6 +240,12 @@ static const struct drm_display_mode ws_
|
|
.vtotal = 1560 + 20 + 20 + 20,
|
|
};
|
|
|
|
+static const struct ws_panel_data ws_panel_6_25_data = {
|
|
+ .mode = &ws_panel_6_25_mode,
|
|
+ .lanes = 2,
|
|
+ .mode_flags = MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS,
|
|
+};
|
|
+
|
|
/* 8.8inch 480x1920
|
|
* https://www.waveshare.com/8.8inch-dsi-lcd.htm
|
|
*/
|
|
@@ -195,6 +261,48 @@ static const struct drm_display_mode ws_
|
|
.vtotal = 1920 + 20 + 20 + 20,
|
|
};
|
|
|
|
+static const struct ws_panel_data ws_panel_8_8_data = {
|
|
+ .mode = &ws_panel_8_8_mode,
|
|
+ .lanes = 2,
|
|
+ .mode_flags = MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS,
|
|
+};
|
|
+
|
|
+static const struct drm_display_mode ws_panel_13_3_4lane_mode = {
|
|
+ .clock = 148500,
|
|
+ .hdisplay = 1920,
|
|
+ .hsync_start = 1920 + 88,
|
|
+ .hsync_end = 1920 + 88 + 44,
|
|
+ .htotal = 1920 + 88 + 44 + 148,
|
|
+ .vdisplay = 1080,
|
|
+ .vsync_start = 1080 + 4,
|
|
+ .vsync_end = 1080 + 4 + 5,
|
|
+ .vtotal = 1080 + 4 + 5 + 36,
|
|
+};
|
|
+
|
|
+static const struct ws_panel_data ws_panel_13_3_4lane_data = {
|
|
+ .mode = &ws_panel_13_3_4lane_mode,
|
|
+ .lanes = 4,
|
|
+ .mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_LPM,
|
|
+};
|
|
+
|
|
+static const struct drm_display_mode ws_panel_13_3_2lane_mode = {
|
|
+ .clock = 83333,
|
|
+ .hdisplay = 1920,
|
|
+ .hsync_start = 1920 + 88,
|
|
+ .hsync_end = 1920 + 88 + 44,
|
|
+ .htotal = 1920 + 88 + 44 + 148,
|
|
+ .vdisplay = 1080,
|
|
+ .vsync_start = 1080 + 4,
|
|
+ .vsync_end = 1080 + 4 + 5,
|
|
+ .vtotal = 1080 + 4 + 5 + 36,
|
|
+};
|
|
+
|
|
+static const struct ws_panel_data ws_panel_13_3_2lane_data = {
|
|
+ .mode = &ws_panel_13_3_2lane_mode,
|
|
+ .lanes = 2,
|
|
+ .mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_LPM,
|
|
+};
|
|
+
|
|
static struct ws_panel *panel_to_ts(struct drm_panel *panel)
|
|
{
|
|
return container_of(panel, struct ws_panel, base);
|
|
@@ -232,7 +340,10 @@ static int ws_panel_enable(struct drm_pa
|
|
{
|
|
struct ws_panel *ts = panel_to_ts(panel);
|
|
|
|
- ws_panel_i2c_write(ts, 0xad, 0x01);
|
|
+ if (ts->mode == &ws_panel_13_3_2lane_mode)
|
|
+ ws_panel_i2c_write(ts, 0xad, 0x02);
|
|
+ else
|
|
+ ws_panel_i2c_write(ts, 0xad, 0x01);
|
|
|
|
return 0;
|
|
}
|
|
@@ -328,13 +439,18 @@ static int ws_panel_probe(struct i2c_cli
|
|
.channel = 0,
|
|
.node = NULL,
|
|
};
|
|
+ const struct ws_panel_data *_ws_panel_data;
|
|
int ret;
|
|
|
|
ts = devm_kzalloc(dev, sizeof(*ts), GFP_KERNEL);
|
|
if (!ts)
|
|
return -ENOMEM;
|
|
|
|
- ts->mode = of_device_get_match_data(dev);
|
|
+ _ws_panel_data = of_device_get_match_data(dev);
|
|
+ if (!_ws_panel_data)
|
|
+ return -EINVAL;
|
|
+
|
|
+ ts->mode = _ws_panel_data->mode;
|
|
if (!ts->mode)
|
|
return -EINVAL;
|
|
|
|
@@ -396,10 +512,9 @@ static int ws_panel_probe(struct i2c_cli
|
|
*/
|
|
drm_panel_add(&ts->base);
|
|
|
|
- ts->dsi->mode_flags = MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_MODE_VIDEO |
|
|
- MIPI_DSI_CLOCK_NON_CONTINUOUS;
|
|
+ ts->dsi->mode_flags = _ws_panel_data->mode_flags;
|
|
ts->dsi->format = MIPI_DSI_FMT_RGB888;
|
|
- ts->dsi->lanes = 2;
|
|
+ ts->dsi->lanes = _ws_panel_data->lanes;
|
|
|
|
ret = devm_mipi_dsi_attach(dev, ts->dsi);
|
|
|
|
@@ -432,40 +547,46 @@ static void ws_panel_shutdown(struct i2c
|
|
static const struct of_device_id ws_panel_of_ids[] = {
|
|
{
|
|
.compatible = "waveshare,2.8inch-panel",
|
|
- .data = &ws_panel_2_8_mode,
|
|
+ .data = &ws_panel_2_8_data,
|
|
}, {
|
|
.compatible = "waveshare,3.4inch-panel",
|
|
- .data = &ws_panel_3_4_mode,
|
|
+ .data = &ws_panel_3_4_data,
|
|
}, {
|
|
.compatible = "waveshare,4.0inch-panel",
|
|
- .data = &ws_panel_4_0_mode,
|
|
+ .data = &ws_panel_4_0_data,
|
|
}, {
|
|
.compatible = "waveshare,7.0inch-c-panel",
|
|
- .data = &ws_panel_7_0_c_mode,
|
|
+ .data = &ws_panel_7_0_c_data,
|
|
}, {
|
|
.compatible = "waveshare,7.9inch-panel",
|
|
- .data = &ws_panel_7_9_mode,
|
|
+ .data = &ws_panel_7_9_data,
|
|
}, {
|
|
.compatible = "waveshare,8.0inch-panel",
|
|
- .data = &ws_panel_10_1_mode,
|
|
+ .data = &ws_panel_10_1_data,
|
|
}, {
|
|
.compatible = "waveshare,10.1inch-panel",
|
|
- .data = &ws_panel_10_1_mode,
|
|
+ .data = &ws_panel_10_1_data,
|
|
}, {
|
|
.compatible = "waveshare,11.9inch-panel",
|
|
- .data = &ws_panel_11_9_mode,
|
|
+ .data = &ws_panel_11_9_data,
|
|
}, {
|
|
.compatible = "waveshare,4inch-panel",
|
|
- .data = &ws_panel_4_mode,
|
|
+ .data = &ws_panel_4_data,
|
|
}, {
|
|
.compatible = "waveshare,5.0inch-panel",
|
|
- .data = &ws_panel_5_0_mode,
|
|
+ .data = &ws_panel_5_0_data,
|
|
}, {
|
|
.compatible = "waveshare,6.25inch-panel",
|
|
- .data = &ws_panel_6_25_mode,
|
|
+ .data = &ws_panel_6_25_data,
|
|
}, {
|
|
.compatible = "waveshare,8.8inch-panel",
|
|
- .data = &ws_panel_8_8_mode,
|
|
+ .data = &ws_panel_8_8_data,
|
|
+ }, {
|
|
+ .compatible = "waveshare,13.3inch-4lane-panel",
|
|
+ .data = &ws_panel_13_3_4lane_data,
|
|
+ }, {
|
|
+ .compatible = "waveshare,13.3inch-2lane-panel",
|
|
+ .data = &ws_panel_13_3_2lane_data,
|
|
}, {
|
|
/* sentinel */
|
|
}
|