Re: [PATCH] drm/panel: ili9341: Remove a superfluous else after return

2024-04-29 Thread Jessica Zhang




On 4/29/2024 10:12 AM, Sui Jingfeng wrote:

The else clause after the ruturn clause is not useful.


Hi Sui,

Spelling nit: ruturn --> return

Besides that,

Reviewed-by: Jessica Zhang 

Thanks,

Jessica Zhang



Signed-off-by: Sui Jingfeng 
---
  drivers/gpu/drm/panel/panel-ilitek-ili9341.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9341.c 
b/drivers/gpu/drm/panel/panel-ilitek-ili9341.c
index 3574681891e8..433572c4caf9 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9341.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9341.c
@@ -722,7 +722,8 @@ static int ili9341_probe(struct spi_device *spi)
  
  	if (!strcmp(id->name, "sf-tc240t-9370-t"))

return ili9341_dpi_probe(spi, dc, reset);
-   else if (!strcmp(id->name, "yx240qv29"))
+
+   if (!strcmp(id->name, "yx240qv29"))
return ili9341_dbi_probe(spi, dc, reset);
  
  	return -1;

--
2.34.1



Re: [PATCH 4/6] drm/panel: novatek-nt36672e: stop calling regulator_set_load manually

2024-04-17 Thread Jessica Zhang




On 4/4/2024 3:08 AM, Dmitry Baryshkov wrote:

Use .init_load_uA part of the bulk regulator API instead of calling
register_set_load() manually.


Hi Dmitry,

Reviewed-by: Jessica Zhang 

Thanks,

Jessica Zhang



Signed-off-by: Dmitry Baryshkov 
---
  drivers/gpu/drm/panel/panel-novatek-nt36672e.c | 16 
  1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36672e.c 
b/drivers/gpu/drm/panel/panel-novatek-nt36672e.c
index 9a870b9b6765..20b7bfe4aa12 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt36672e.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt36672e.c
@@ -343,17 +343,7 @@ static int nt36672e_1080x2408_60hz_init(struct 
mipi_dsi_device *dsi)
  static int nt36672e_power_on(struct nt36672e_panel *ctx)
  {
struct mipi_dsi_device *dsi = ctx->dsi;
-   int ret, i;
-
-   for (i = 0; i < ARRAY_SIZE(ctx->supplies); i++) {
-   ret = regulator_set_load(ctx->supplies[i].consumer,
-   regulator_enable_loads[i]);
-   if (ret) {
-   dev_err(>dev, "regulator set load failed for supply %s: 
%d\n",
-   ctx->supplies[i].supply, ret);
-   return ret;
-   }
-   }
+   int ret;
  
  	ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies);

if (ret < 0) {
@@ -550,8 +540,10 @@ static int nt36672e_panel_probe(struct mipi_dsi_device 
*dsi)
return -ENODEV;
}
  
-	for (i = 0; i < ARRAY_SIZE(ctx->supplies); i++)

+   for (i = 0; i < ARRAY_SIZE(ctx->supplies); i++) {
ctx->supplies[i].supply = regulator_names[i];
+   ctx->supplies[i].init_load_uA = regulator_enable_loads[i];
+   }
  
  	ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(ctx->supplies),

ctx->supplies);

--
2.39.2



Re: [PATCH v4 2/2] drm/panel: Add driver for EDO RM69380 OLED panel

2024-04-17 Thread Jessica Zhang




On 4/17/2024 9:29 AM, David Wronek wrote:

Add support for the 2560x1600@90Hz OLED panel by EDO bundled with a
Raydium RM69380 controller, as found on the Lenovo Xiaoxin Pad Pro 2021.

Reviewed-by: Dmitry Baryshkov 
Signed-off-by: David Wronek 


Hi David,

Acked-by: Jessica Zhang 

Thanks,

Jessica Zhang


---
  drivers/gpu/drm/panel/Kconfig |  12 +
  drivers/gpu/drm/panel/Makefile|   1 +
  drivers/gpu/drm/panel/panel-raydium-rm69380.c | 344 ++
  3 files changed, 357 insertions(+)

diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index 154f5bf82980..e2a66c21349f 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -542,6 +542,18 @@ config DRM_PANEL_RAYDIUM_RM692E5
  Say Y here if you want to enable support for Raydium RM692E5-based
  display panels, such as the one found in the Fairphone 5 smartphone.
  
+config DRM_PANEL_RAYDIUM_RM69380

+   tristate "Raydium RM69380-based DSI panel"
+   depends on OF && GPIOLIB
+   depends on DRM_MIPI_DSI
+   depends on BACKLIGHT_CLASS_DEVICE
+   help
+ Say Y here if you want to enable support for Raydium RM69380-based
+ display panels.
+
+ This panel controller can be found in the Lenovo Xiaoxin Pad Pro 2021
+ in combination with an EDO OLED panel.
+
  config DRM_PANEL_RONBO_RB070D30
tristate "Ronbo Electronics RB070D30 panel"
depends on OF
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index 24a02655d726..e2a2807d4ef0 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -55,6 +55,7 @@ obj-$(CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN) += 
panel-raspberrypi-touchscreen
  obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM67191) += panel-raydium-rm67191.o
  obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM68200) += panel-raydium-rm68200.o
  obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM692E5) += panel-raydium-rm692e5.o
+obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM69380) += panel-raydium-rm69380.o
  obj-$(CONFIG_DRM_PANEL_RONBO_RB070D30) += panel-ronbo-rb070d30.o
  obj-$(CONFIG_DRM_PANEL_SAMSUNG_ATNA33XC20) += panel-samsung-atna33xc20.o
  obj-$(CONFIG_DRM_PANEL_SAMSUNG_DB7430) += panel-samsung-db7430.o
diff --git a/drivers/gpu/drm/panel/panel-raydium-rm69380.c 
b/drivers/gpu/drm/panel/panel-raydium-rm69380.c
new file mode 100644
index ..4dca6802faef
--- /dev/null
+++ b/drivers/gpu/drm/panel/panel-raydium-rm69380.c
@@ -0,0 +1,344 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Generated with linux-mdss-dsi-panel-driver-generator from vendor device 
tree.
+ * Copyright (c) 2024 David Wronek 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+struct rm69380_panel {
+   struct drm_panel panel;
+   struct mipi_dsi_device *dsi[2];
+   struct regulator_bulk_data supplies[2];
+   struct gpio_desc *reset_gpio;
+};
+
+static inline
+struct rm69380_panel *to_rm69380_panel(struct drm_panel *panel)
+{
+   return container_of(panel, struct rm69380_panel, panel);
+}
+
+static void rm69380_reset(struct rm69380_panel *ctx)
+{
+   gpiod_set_value_cansleep(ctx->reset_gpio, 0);
+   usleep_range(15000, 16000);
+   gpiod_set_value_cansleep(ctx->reset_gpio, 1);
+   usleep_range(1, 11000);
+   gpiod_set_value_cansleep(ctx->reset_gpio, 0);
+   msleep(30);
+}
+
+static int rm69380_on(struct rm69380_panel *ctx)
+{
+   struct mipi_dsi_device *dsi = ctx->dsi[0];
+   struct device *dev = >dev;
+   int ret;
+
+   dsi->mode_flags |= MIPI_DSI_MODE_LPM;
+   if (ctx->dsi[1])
+   ctx->dsi[1]->mode_flags |= MIPI_DSI_MODE_LPM;
+
+   mipi_dsi_dcs_write_seq(dsi, 0xfe, 0xd4);
+   mipi_dsi_dcs_write_seq(dsi, 0x00, 0x80);
+   mipi_dsi_dcs_write_seq(dsi, 0xfe, 0xd0);
+   mipi_dsi_dcs_write_seq(dsi, 0x48, 0x00);
+   mipi_dsi_dcs_write_seq(dsi, 0xfe, 0x26);
+   mipi_dsi_dcs_write_seq(dsi, 0x75, 0x3f);
+   mipi_dsi_dcs_write_seq(dsi, 0x1d, 0x1a);
+   mipi_dsi_dcs_write_seq(dsi, 0xfe, 0x00);
+   mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_WRITE_CONTROL_DISPLAY, 0x28);
+   mipi_dsi_dcs_write_seq(dsi, 0xc2, 0x08);
+
+   ret = mipi_dsi_dcs_set_tear_on(dsi, MIPI_DSI_DCS_TEAR_MODE_VBLANK);
+   if (ret < 0) {
+   dev_err(dev, "Failed to set tear on: %d\n", ret);
+   return ret;
+   }
+
+   ret = mipi_dsi_dcs_exit_sleep_mode(dsi);
+   if (ret < 0) {
+   dev_err(dev, "Failed to exit sleep mode: %d\n", ret);
+   return ret;
+   }
+   msleep(20);
+
+   ret = mipi_dsi_dcs_set_display_on(dsi);
+   if (ret < 0) {
+   dev_err(dev, "Failed to set display on: %d\n", ret);
+   return ret;
+   }

Re: [PATCH v2 2/2] drm/panel: Add driver for EDO RM69380 OLED panel

2024-04-15 Thread Jessica Zhang




On 4/15/2024 9:10 AM, David Wronek wrote:

Add support for the 2560x1600@90Hz OLED panel by EDO bundled with a
Raydium RM69380 controller, as found on the Lenovo Xiaoxin Pad Pro 2021.

Signed-off-by: David Wronek 
---
  drivers/gpu/drm/panel/Kconfig |  14 +
  drivers/gpu/drm/panel/Makefile|   1 +
  drivers/gpu/drm/panel/panel-raydium-rm69380.c | 366 ++
  3 files changed, 381 insertions(+)

diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index 154f5bf82980..5b3eeb93b1a2 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -542,6 +542,20 @@ config DRM_PANEL_RAYDIUM_RM692E5
  Say Y here if you want to enable support for Raydium RM692E5-based
  display panels, such as the one found in the Fairphone 5 smartphone.
  
+config DRM_PANEL_RAYDIUM_RM69380

+   tristate "Raydium RM69380-based DSI panel"
+   depends on BACKLIGHT_CLASS_DEVICE
+   depends on DRM_DISPLAY_DP_HELPER
+   depends on DRM_DISPLAY_HELPER
+   depends on DRM_MIPI_DSI
+   depends on OF
+   help
+ Say Y here if you want to enable support for Raydium RM69380-based
+ display panels.
+
+ This panel controller can be found in the Lenovo Xiaoxin Pad Pro 2021
+ in combination with an EDO OLED panel.
+
  config DRM_PANEL_RONBO_RB070D30
tristate "Ronbo Electronics RB070D30 panel"
depends on OF
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index 24a02655d726..e2a2807d4ef0 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -55,6 +55,7 @@ obj-$(CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN) += 
panel-raspberrypi-touchscreen
  obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM67191) += panel-raydium-rm67191.o
  obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM68200) += panel-raydium-rm68200.o
  obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM692E5) += panel-raydium-rm692e5.o
+obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM69380) += panel-raydium-rm69380.o
  obj-$(CONFIG_DRM_PANEL_RONBO_RB070D30) += panel-ronbo-rb070d30.o
  obj-$(CONFIG_DRM_PANEL_SAMSUNG_ATNA33XC20) += panel-samsung-atna33xc20.o
  obj-$(CONFIG_DRM_PANEL_SAMSUNG_DB7430) += panel-samsung-db7430.o
diff --git a/drivers/gpu/drm/panel/panel-raydium-rm69380.c 
b/drivers/gpu/drm/panel/panel-raydium-rm69380.c
new file mode 100644
index ..253b9a1c2800
--- /dev/null
+++ b/drivers/gpu/drm/panel/panel-raydium-rm69380.c
@@ -0,0 +1,366 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Generated with linux-mdss-dsi-panel-driver-generator from vendor device 
tree.
+ * Copyright (c) 2024 David Wronek 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+struct rm69380_panel {
+   struct drm_panel panel;
+   struct mipi_dsi_device *dsi[2];
+   struct regulator_bulk_data supplies[2];
+   struct gpio_desc *reset_gpio;
+   bool prepared;


Hi David,

IIRC there's no need for a driver-specific panel::prepared after commit 
d2aacaf0.


Thanks,

Jessica Zhang


+};
+
+static inline
+struct rm69380_panel *to_rm69380_panel(struct drm_panel *panel)
+{
+   return container_of(panel, struct rm69380_panel, panel);
+}
+
+static void rm69380_reset(struct rm69380_panel *ctx)
+{
+   gpiod_set_value_cansleep(ctx->reset_gpio, 0);
+   usleep_range(15000, 16000);
+   gpiod_set_value_cansleep(ctx->reset_gpio, 1);
+   usleep_range(1, 11000);
+   gpiod_set_value_cansleep(ctx->reset_gpio, 0);
+   msleep(30);
+}
+
+static int rm69380_on(struct rm69380_panel *ctx)
+{
+   struct mipi_dsi_device *dsi = ctx->dsi[0];
+   struct device *dev = >dev;
+   int ret;
+
+   dsi->mode_flags |= MIPI_DSI_MODE_LPM;
+   if (ctx->dsi[1])
+   ctx->dsi[1]->mode_flags |= MIPI_DSI_MODE_LPM;
+
+   mipi_dsi_dcs_write_seq(dsi, 0xfe, 0xd4);
+   mipi_dsi_dcs_write_seq(dsi, 0x00, 0x80);
+   mipi_dsi_dcs_write_seq(dsi, 0xfe, 0xd0);
+   mipi_dsi_dcs_write_seq(dsi, 0x48, 0x00);
+   mipi_dsi_dcs_write_seq(dsi, 0xfe, 0x26);
+   mipi_dsi_dcs_write_seq(dsi, 0x75, 0x3f);
+   mipi_dsi_dcs_write_seq(dsi, 0x1d, 0x1a);
+   mipi_dsi_dcs_write_seq(dsi, 0xfe, 0x00);
+   mipi_dsi_dcs_write_seq(dsi, 0x53, 0x28);
+   mipi_dsi_dcs_write_seq(dsi, 0xc2, 0x08);
+   mipi_dsi_dcs_write_seq(dsi, 0x35, 0x00);
+   mipi_dsi_dcs_write_seq(dsi, 0x51, 0x07, 0xff);
+
+   ret = mipi_dsi_dcs_exit_sleep_mode(dsi);
+   if (ret < 0) {
+   dev_err(dev, "Failed to exit sleep mode: %d\n", ret);
+   return ret;
+   }
+   msleep(20);
+
+   ret = mipi_dsi_dcs_set_display_on(dsi);
+   if (ret < 0) {
+   dev_err(dev, "Failed to set display on: %d\n", ret);
+   return ret;
+   }
+   msleep(36);
+
+   return 0;

Re: [PATCH v5 2/4] drm/mipi-dsi: use correct return type for the DSC functions

2024-04-09 Thread Jessica Zhang




On 4/7/2024 4:53 PM, Dmitry Baryshkov wrote:

The functions mipi_dsi_compression_mode() and
mipi_dsi_picture_parameter_set() return 0-or-error rather than a buffer
size. Follow example of other similar MIPI DSI functions and use int
return type instead of size_t.


Hi Dmitry,

Reviewed-by: Jessica Zhang 

Thanks,

Jessica Zhang



Fixes: f4dea1aaa9a1 ("drm/dsi: add helpers for DSI compression mode and PPS 
packets")
Reviewed-by: Marijn Suijten 
Signed-off-by: Dmitry Baryshkov 
---
  drivers/gpu/drm/drm_mipi_dsi.c | 6 +++---
  include/drm/drm_mipi_dsi.h | 6 +++---
  2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index ef6e416522f8..9874ff6d4718 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -654,7 +654,7 @@ EXPORT_SYMBOL(mipi_dsi_set_maximum_return_packet_size);
   *
   * Return: 0 on success or a negative error code on failure.
   */
-ssize_t mipi_dsi_compression_mode(struct mipi_dsi_device *dsi, bool enable)
+int mipi_dsi_compression_mode(struct mipi_dsi_device *dsi, bool enable)
  {
/* Note: Needs updating for non-default PPS or algorithm */
u8 tx[2] = { enable << 0, 0 };
@@ -679,8 +679,8 @@ EXPORT_SYMBOL(mipi_dsi_compression_mode);
   *
   * Return: 0 on success or a negative error code on failure.
   */
-ssize_t mipi_dsi_picture_parameter_set(struct mipi_dsi_device *dsi,
-  const struct 
drm_dsc_picture_parameter_set *pps)
+int mipi_dsi_picture_parameter_set(struct mipi_dsi_device *dsi,
+  const struct drm_dsc_picture_parameter_set 
*pps)
  {
struct mipi_dsi_msg msg = {
.channel = dsi->channel,
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index c0aec0d4d664..3011d33eccbd 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -241,9 +241,9 @@ int mipi_dsi_shutdown_peripheral(struct mipi_dsi_device 
*dsi);
  int mipi_dsi_turn_on_peripheral(struct mipi_dsi_device *dsi);
  int mipi_dsi_set_maximum_return_packet_size(struct mipi_dsi_device *dsi,
u16 value);
-ssize_t mipi_dsi_compression_mode(struct mipi_dsi_device *dsi, bool enable);
-ssize_t mipi_dsi_picture_parameter_set(struct mipi_dsi_device *dsi,
-  const struct 
drm_dsc_picture_parameter_set *pps);
+int mipi_dsi_compression_mode(struct mipi_dsi_device *dsi, bool enable);
+int mipi_dsi_picture_parameter_set(struct mipi_dsi_device *dsi,
+  const struct drm_dsc_picture_parameter_set 
*pps);
  
  ssize_t mipi_dsi_generic_write(struct mipi_dsi_device *dsi, const void *payload,

   size_t size);

--
2.39.2



Re: [PATCH 2/6] drm/panel: novatek-nt36682e: don't unregister DSI device

2024-04-05 Thread Jessica Zhang




On 4/4/2024 3:08 AM, Dmitry Baryshkov wrote:

The DSI device for the panel was registered by the DSI host, so it is an
error to unregister it from the panel driver. Drop the call to
mipi_dsi_device_unregister().

Fixes: ea4f9975625a ("drm/panel: Add support for Novatek NT36672E panel driver")
Signed-off-by: Dmitry Baryshkov 


Reviewed-by: Jessica Zhang 


---
  drivers/gpu/drm/panel/panel-novatek-nt36672e.c | 2 --
  1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36672e.c 
b/drivers/gpu/drm/panel/panel-novatek-nt36672e.c
index cb7406d74466..c39fe0fc5d69 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt36672e.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt36672e.c
@@ -614,8 +614,6 @@ static void nt36672e_panel_remove(struct mipi_dsi_device 
*dsi)
struct nt36672e_panel *ctx = mipi_dsi_get_drvdata(dsi);
  
  	mipi_dsi_detach(ctx->dsi);

-   mipi_dsi_device_unregister(ctx->dsi);
-
drm_panel_remove(>panel);
  }
  


--
2.39.2



Re: [PATCH 1/6] drm/panel: visionox-rm69299: don't unregister DSI device

2024-04-05 Thread Jessica Zhang




On 4/4/2024 3:07 AM, Dmitry Baryshkov wrote:

The DSI device for the panel was registered by the DSI host, so it is an
error to unregister it from the panel driver. Drop the call to
mipi_dsi_device_unregister().


Hi Dmitry,

Reviewed-by: Jessica Zhang 

Thanks,

Jessica Zhang



Fixes: c7f66d32dd43 ("drm/panel: add support for rm69299 visionox panel")
Signed-off-by: Dmitry Baryshkov 
---
  drivers/gpu/drm/panel/panel-visionox-rm69299.c | 2 --
  1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-visionox-rm69299.c 
b/drivers/gpu/drm/panel/panel-visionox-rm69299.c
index 775144695283..b15ca56a09a7 100644
--- a/drivers/gpu/drm/panel/panel-visionox-rm69299.c
+++ b/drivers/gpu/drm/panel/panel-visionox-rm69299.c
@@ -253,8 +253,6 @@ static void visionox_rm69299_remove(struct mipi_dsi_device 
*dsi)
struct visionox_rm69299 *ctx = mipi_dsi_get_drvdata(dsi);
  
  	mipi_dsi_detach(ctx->dsi);

-   mipi_dsi_device_unregister(ctx->dsi);
-
drm_panel_remove(>panel);
  }
  


--
2.39.2



Re: [PATCH 4/4] drm/panel: simple: Add Innolux G121XCE-L01 LVDS display support

2024-03-29 Thread Jessica Zhang




On 3/28/2024 3:27 AM, Marek Vasut wrote:

G121XCE-L01 is a Color Active Matrix Liquid Crystal Display composed of
a TFT LCD panel, a driver circuit, and LED backlight system. The screen
format is intended to support the 4:3, 1024(H) x 768(V) screen and either
262k/16.7M colors (RGB 6-bits or 8-bits) with LED backlight driver circuit.
All input signals are LVDS interface compatible.

Documentation [1] and [2] indicate that G121X1-L03 and G121XCE-L01 are
effectively identical panels, use the former as RGB 6-bits variant and
add the later as RGB 8-bits variant.

[1] 
https://www.distec.de/fileadmin/pdf/produkte/TFT-Displays/Innolux/G121X1-L03_Datasheet.pdf
[2] 
https://www.distec.de/fileadmin/pdf/produkte/TFT-Displays/Innolux/G121XCE-L01_Datasheet.pdf


Hi Marek,

Acked-by: Jessica Zhang 

Thanks,

Jessica Zhang



Signed-off-by: Marek Vasut 
---
Cc: Conor Dooley 
Cc: Daniel Vetter 
Cc: David Airlie 
Cc: Jessica Zhang 
Cc: Krzysztof Kozlowski 
Cc: Maarten Lankhorst 
Cc: Maxime Ripard 
Cc: Neil Armstrong 
Cc: Rob Herring 
Cc: Sam Ravnborg 
Cc: Thierry Reding 
Cc: Thomas Zimmermann 
Cc: devicet...@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
---
  drivers/gpu/drm/panel/panel-simple.c | 21 +
  1 file changed, 21 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index 737c78b3b8a23..5acc9f2941909 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -2623,6 +2623,24 @@ static const struct panel_desc innolux_g121x1_l03 = {
.connector_type = DRM_MODE_CONNECTOR_LVDS,
  };
  
+static const struct panel_desc innolux_g121xce_l01 = {

+   .timings = _g121x1_l03_timings,
+   .num_timings = 1,
+   .bpc = 8,
+   .size = {
+   .width = 246,
+   .height = 185,
+   },
+   .delay = {
+   .enable = 200,
+   .unprepare = 200,
+   .disable = 400,
+   },
+   .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
+   .bus_flags = DRM_BUS_FLAG_DE_HIGH,
+   .connector_type = DRM_MODE_CONNECTOR_LVDS,
+};
+
  static const struct display_timing innolux_g156hce_l01_timings = {
.pixelclock = { 12000, 14186, 15000 },
.hactive = { 1920, 1920, 1920 },
@@ -4596,6 +4614,9 @@ static const struct of_device_id platform_of_match[] = {
}, {
.compatible = "innolux,g121x1-l03",
.data = _g121x1_l03,
+   }, {
+   .compatible = "innolux,g121xce-l01",
+   .data = _g121xce_l01,
}, {
.compatible = "innolux,g156hce-l01",
.data = _g156hce_l01,
--
2.43.0



Re: [PATCH 3/4] drm/panel: simple: Convert Innolux G121X1-L03 to display_timing

2024-03-29 Thread Jessica Zhang




On 3/28/2024 3:27 AM, Marek Vasut wrote:

Use display_timing instead of drm_display_mode to define a range of
possible display timings supported by this panel. This makes the panel
support more flexible and improves compatibility. No functional change
is expected.

The settings are picked from documentation [1] section 6.1 INPUT SIGNAL
TIMING SPECIFICATIONS.

[1] 
https://www.distec.de/fileadmin/pdf/produkte/TFT-Displays/Innolux/G121X1-L03_Datasheet.pdf


Hi Marek,

Acked-by: Jessica Zhang 

Thanks,

Jessica Zhang



Signed-off-by: Marek Vasut 
---
Cc: Conor Dooley 
Cc: Daniel Vetter 
Cc: David Airlie 
Cc: Jessica Zhang 
Cc: Krzysztof Kozlowski 
Cc: Maarten Lankhorst 
Cc: Maxime Ripard 
Cc: Neil Armstrong 
Cc: Rob Herring 
Cc: Sam Ravnborg 
Cc: Thierry Reding 
Cc: Thomas Zimmermann 
Cc: devicet...@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
---
  drivers/gpu/drm/panel/panel-simple.c | 26 +-
  1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index d4c30a86d15d6..737c78b3b8a23 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -2592,22 +2592,22 @@ static const struct panel_desc innolux_g121i1_l01 = {
.connector_type = DRM_MODE_CONNECTOR_LVDS,
  };
  
-static const struct drm_display_mode innolux_g121x1_l03_mode = {

-   .clock = 65000,
-   .hdisplay = 1024,
-   .hsync_start = 1024 + 0,
-   .hsync_end = 1024 + 1,
-   .htotal = 1024 + 0 + 1 + 320,
-   .vdisplay = 768,
-   .vsync_start = 768 + 38,
-   .vsync_end = 768 + 38 + 1,
-   .vtotal = 768 + 38 + 1 + 0,
-   .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
+static const struct display_timing innolux_g121x1_l03_timings = {
+   .pixelclock = { 5750, 6490, 7440 },
+   .hactive = { 1024, 1024, 1024 },
+   .hfront_porch = { 90, 140, 190 },
+   .hback_porch = { 90, 140, 190 },
+   .hsync_len = { 36, 40, 60 },
+   .vactive = { 768, 768, 768 },
+   .vfront_porch = { 2, 15, 30 },
+   .vback_porch = { 2, 15, 30 },
+   .vsync_len = { 2, 8, 20 },
+   .flags = DISPLAY_FLAGS_HSYNC_LOW | DISPLAY_FLAGS_VSYNC_LOW,
  };
  
  static const struct panel_desc innolux_g121x1_l03 = {

-   .modes = _g121x1_l03_mode,
-   .num_modes = 1,
+   .timings = _g121x1_l03_timings,
+   .num_timings = 1,
.bpc = 6,
.size = {
.width = 246,
--
2.43.0



Re: [PATCH 2/4] drm/panel: simple: Add missing Innolux G121X1-L03 format, flags, connector

2024-03-29 Thread Jessica Zhang




On 3/28/2024 3:27 AM, Marek Vasut wrote:

The .bpc = 6 implies .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG ,
add the missing bus_format. Add missing connector type and bus_flags
as well.

Documentation [1] 1.4 GENERAL SPECIFICATI0NS indicates this panel is
capable of both RGB 18bit/24bit panel, the current configuration uses
18bit mode, .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG , .bpc = 6.

Support for the 24bit mode would require another entry in panel-simple
with .bus_format = MEDIA_BUS_FMT_RGB666_1X7X4_SPWG and .bpc = 8, which
is out of scope of this fix.

[1] 
https://www.distec.de/fileadmin/pdf/produkte/TFT-Displays/Innolux/G121X1-L03_Datasheet.pdf


Hi Marek,

Acked-by: Jessica Zhang 

Thanks,

Jessica Zhang



Fixes: f8fa17ba812b ("drm/panel: simple: Add support for Innolux G121X1-L03")
Signed-off-by: Marek Vasut 
---
Cc: Conor Dooley 
Cc: Daniel Vetter 
Cc: David Airlie 
Cc: Jessica Zhang 
Cc: Krzysztof Kozlowski 
Cc: Maarten Lankhorst 
Cc: Maxime Ripard 
Cc: Neil Armstrong 
Cc: Rob Herring 
Cc: Sam Ravnborg 
Cc: Thierry Reding 
Cc: Thomas Zimmermann 
Cc: devicet...@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
---
  drivers/gpu/drm/panel/panel-simple.c | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index d9ddef0e675a7..d4c30a86d15d6 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -2618,6 +2618,9 @@ static const struct panel_desc innolux_g121x1_l03 = {
.unprepare = 200,
.disable = 400,
},
+   .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
+   .bus_flags = DRM_BUS_FLAG_DE_HIGH,
+   .connector_type = DRM_MODE_CONNECTOR_LVDS,
  };
  
  static const struct display_timing innolux_g156hce_l01_timings = {

--
2.43.0



Re: [PATCH 3/5] drm/panel: st7703: Add GameForce Chi Panel Support

2024-03-27 Thread Jessica Zhang




On 3/25/2024 6:49 AM, Chris Morgan wrote:

From: Chris Morgan 

The GameForce Chi is a handheld device with a 3.5" 640x480 ST7703 based
display panel.



Hi Chris,

Acked-by: Jessica Zhang 

Thanks,

Jessica Zhang


Signed-off-by: Chris Morgan 
---
  drivers/gpu/drm/panel/panel-sitronix-st7703.c | 87 +++
  1 file changed, 87 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c 
b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
index a3e142f156d5..7d8302cca091 100644
--- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c
+++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
@@ -612,6 +612,92 @@ static const struct st7703_panel_desc rgb10max3_panel_desc 
= {
.init_sequence = rgb10max3_panel_init_sequence,
  };
  
+static int gameforcechi_init_sequence(struct st7703 *ctx)

+{
+   struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
+
+   /*
+* Init sequence was supplied by the panel vendor. Panel will not
+* respond to commands until it is brought out of sleep mode first.
+*/
+
+   mipi_dsi_dcs_exit_sleep_mode(dsi);
+   msleep(250);
+
+   mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETEXTC, 0xf1, 0x12, 0x83);
+   mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETMIPI, 0x31, 0x81, 0x05, 0xf9,
+  0x0e, 0x0e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x44, 0x25, 0x00, 0x91, 0x0a, 0x00,
+  0x00, 0x02, 0x4f, 0xd1, 0x00, 0x00, 0x37);
+   mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETPOWER_EXT, 0x25);
+   mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_UNKNOWN_BF, 0x02, 0x11, 0x00);
+   mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETRGBIF, 0x0c, 0x10, 0x0a,
+  0x50, 0x03, 0xff, 0x00, 0x00, 0x00, 0x00);
+   mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETSCR, 0x73, 0x73, 0x50, 0x50,
+  0x00, 0x00, 0x08, 0x70, 0x00);
+   mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETVDC, 0x46);
+   mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETPANEL, 0x0b);
+   mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETCYC, 0x80);
+   mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETDISP, 0x00, 0x13, 0xf0);
+   mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETEQ, 0x07, 0x07, 0x0b, 0x0b,
+  0x03, 0x0b, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00,
+  0xc0, 0x10);
+   mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETPOWER, 0x53, 0x00, 0x1e,
+  0x1e, 0x77, 0xe1, 0xcc, 0xdd, 0x67, 0x77, 0x33,
+  0x33);
+   mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETBGP, 0x10, 0x10);
+   mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETVCOM, 0x6c, 0x7c);
+   mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETGIP1, 0x08, 0x00, 0x0e, 0x00,
+  0x00, 0xb0, 0xb1, 0x11, 0x31, 0x23, 0x28, 0x10,
+  0xb0, 0xb1, 0x27, 0x08, 0x00, 0x04, 0x02, 0x00,
+  0x00, 0x00, 0x00, 0x04, 0x02, 0x00, 0x00, 0x00,
+  0x88, 0x88, 0xba, 0x60, 0x24, 0x08, 0x88, 0x88,
+  0x88, 0x88, 0x88, 0x88, 0x88, 0xba, 0x71, 0x35,
+  0x18, 0x88, 0x88, 0x88, 0x88, 0x88, 0x00, 0x00,
+  0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00);
+   mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETGIP2, 0x97, 0x0a, 0x82, 0x02,
+  0x13, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x80, 0x88, 0xba, 0x17, 0x53, 0x88, 0x88, 0x88,
+  0x88, 0x88, 0x88, 0x81, 0x88, 0xba, 0x06, 0x42,
+  0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x23, 0x10,
+  0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00);
+   mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETGAMMA, 0x00, 0x07, 0x0b,
+  0x27, 0x2d, 0x3f, 0x3b, 0x37, 0x05, 0x0a, 0x0b,
+  0x0f, 0x11, 0x0f, 0x12, 0x12, 0x18, 0x00, 0x07,
+  0x0b, 0x27, 0x2d, 0x3f, 0x3b, 0x37, 0x05, 0xa0,
+  0x0b, 0x0f, 0x11, 0x0f, 0x12, 0x12, 0x18);
+
+   return 0;
+}
+
+static const struct drm_display_mode gameforcechi_mode = {
+   .hdisplay   = 640,
+   .hsync_start= 640 + 40,
+   .hsync_end  = 640 + 40 + 2,
+   .htotal = 640 + 40 + 2 + 80,
+   .vdisplay   = 480,
+   .vsync_start= 480 + 17,
+   .vsync_end  = 480 + 17 + 5,
+   .vtotal = 480 + 17 + 5 + 13,
+   .clock  = 23546,
+   .flags  = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLA

Re: [PATCH] drm/panel: replace utf multiply with an ascii x

2024-03-25 Thread Jessica Zhang




On 3/23/2024 12:40 AM, Prasad Pandit wrote:

On Fri, 22 Mar 2024 at 20:54, Jessica Zhang  wrote:

Seems that this also happens in 2 other Kconfig entries. Can you replace those 
as well?


* Yes, I've sent a revised patch.


Acked, thanks!



Thank you.
---
   - Prasad



Re: [PATCH v1] drm/panel: replace utf multiply with an ascii x

2024-03-25 Thread Jessica Zhang




On 3/23/2024 12:39 AM, Prasad Pandit wrote:

From: Prasad Pandit 

Replace unicode multiplication character with an ascii x.
It helps Kconfig parsers to read file without error.


Hi Prasad,

Reviewed-by: Jessica Zhang 

Thanks,

Jessica Zhang



Fixes: 25205087df1f ("drm/panel: Add driver for JDI LPM102A188A")
Fixes: c96f566273bf ("drm/panel: Add JDI LT070ME05000 WUXGA DSI Panel")
Fixes: cf40c6600592 ("drm: panel: add TDO tl070wsh30 panel driver")
Signed-off-by: Prasad Pandit 
---
  drivers/gpu/drm/panel/Kconfig | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

v1:
  - Fix other similar occurrences of utf multiply
v0:
  - 
https://lore.kernel.org/dri-devel/1e546c01-1126-45c8-9104-14e769ded...@quicinc.com/T/#t

diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index 8f3783742208..40a021ee91c3 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -259,7 +259,7 @@ config DRM_PANEL_JDI_LT070ME05000
help
  Say Y here if you want to enable support for JDI DSI video mode
  panel as found in Google Nexus 7 (2013) devices.
- The panel has a 1200(RGB)×1920 (WUXGA) resolution and uses
+ The panel has a 1200(RGB)x1920 (WUXGA) resolution and uses
  24 bit per pixel.
  
  config DRM_PANEL_JDI_LPM102A188A

@@ -270,7 +270,7 @@ config DRM_PANEL_JDI_LPM102A188A
help
  Say Y here if you want to enable support for JDI LPM102A188A DSI
  command mode panel as found in Google Pixel C devices.
- The panel has a 2560×1800 resolution. It provides a MIPI DSI interface
+ The panel has a 2560x1800 resolution. It provides a MIPI DSI interface
  to the host.
  
  config DRM_PANEL_JDI_R63452

@@ -801,7 +801,7 @@ config DRM_PANEL_TDO_TL070WSH30
depends on BACKLIGHT_CLASS_DEVICE
help
  Say Y here if you want to enable support for TDO TL070WSH30 TFT-LCD
- panel module. The panel has a 1024×600 resolution and uses
+ panel module. The panel has a 1024x600 resolution and uses
  24 bit RGB per pixel. It provides a MIPI DSI interface to
  the host, a built-in LED backlight and touch controller.
  
--

2.44.0



Re: [PATCH] drm/panel: replace utf multiply with an ascii x

2024-03-22 Thread Jessica Zhang




On 3/22/2024 5:03 AM, Prasad Pandit wrote:

From: Prasad Pandit 

Replace unicode multiplication character with an ascii x.
It helps Kconfig parsers to read file without error.


Hi Prasad,

Seems that this also happens in 2 other Kconfig entries. Can you replace 
those as well?


Thanks,

Jessica Zhang



Fixes: 25205087df1f ("drm/panel: Add driver for JDI LPM102A188A")
Signed-off-by: Prasad Pandit 
---
  drivers/gpu/drm/panel/Kconfig | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index 8f3783742208..e3970dee089f 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -270,7 +270,7 @@ config DRM_PANEL_JDI_LPM102A188A
help
  Say Y here if you want to enable support for JDI LPM102A188A DSI
  command mode panel as found in Google Pixel C devices.
- The panel has a 2560×1800 resolution. It provides a MIPI DSI interface
+ The panel has a 2560x1800 resolution. It provides a MIPI DSI interface
  to the host.
  
  config DRM_PANEL_JDI_R63452

--
2.44.0



Re: [PATCH 1/2] drm/panel: ltk050h3146w: add MIPI_DSI_MODE_VIDEO to LTK050H3148W flags

2024-03-20 Thread Jessica Zhang




On 3/20/2024 6:12 AM, Heiko Stuebner wrote:

From: Heiko Stuebner 

Similar to other variants, the LTK050H3148W wants to run in video mode
when displaying data. So far only the Synopsis DSI driver was using this
panel and it is always switching to video mode, independent of this flag
being set.

Other DSI drivers might handle this differently, so add the flag.

Fixes: e5f9d543419c ("drm/panel: ltk050h3146w: add support for Leadtek 
LTK050H3148W-CTA6 variant")
Signed-off-by: Heiko Stuebner 


Hi Heiko,

Acked-by: Jessica Zhang 

Thanks,

Jessica Zhang


---
  drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c 
b/drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c
index 30919c872ac8..a50f5330a661 100644
--- a/drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c
+++ b/drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c
@@ -326,7 +326,8 @@ static const struct drm_display_mode ltk050h3148w_mode = {
  static const struct ltk050h3146w_desc ltk050h3148w_data = {
.mode = _mode,
.init = ltk050h3148w_init_sequence,
-   .mode_flags = MIPI_DSI_MODE_VIDEO_SYNC_PULSE | 
MIPI_DSI_MODE_VIDEO_BURST,
+   .mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
+ MIPI_DSI_MODE_VIDEO_BURST,
  };
  
  static int ltk050h3146w_init_sequence(struct ltk050h3146w *ctx)

--
2.39.2



Re: [PATCH 2/2] drm/panel: simple: Add POWERTIP PH128800T006-ZHC01 panel entry

2024-03-18 Thread Jessica Zhang




On 3/18/2024 9:17 AM, Nathan Morrisson wrote:

Add support for the POWERTIP PH128800T006-ZHC01 10.1" (1280x800)
LCD-TFT panel.

Signed-off-by: Nathan Morrisson 


Hi Nathan,

Acked-by: Jessica Zhang 

Thanks,

Jessica Zhang


---
  drivers/gpu/drm/panel/panel-simple.c | 29 
  1 file changed, 29 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index 20e3df1c59d4..02d238123753 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -3465,6 +3465,32 @@ static const struct panel_desc pda_91_00156_a0  = {
.bus_format = MEDIA_BUS_FMT_RGB888_1X24,
  };
  
+static const struct drm_display_mode powertip_ph128800t006_zhc01_mode = {

+   .clock = 66500,
+   .hdisplay = 1280,
+   .hsync_start = 1280 + 12,
+   .hsync_end = 1280 + 12 + 20,
+   .htotal = 1280 + 12 + 20 + 56,
+   .vdisplay = 800,
+   .vsync_start = 800 + 1,
+   .vsync_end = 800 + 1 + 3,
+   .vtotal = 800 + 1 + 3 + 20,
+   .flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC,
+};
+
+static const struct panel_desc powertip_ph128800t006_zhc01 = {
+   .modes = _ph128800t006_zhc01_mode,
+   .num_modes = 1,
+   .bpc = 8,
+   .size = {
+   .width = 216,
+   .height = 135,
+   },
+   .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
+   .bus_flags = DRM_BUS_FLAG_DE_HIGH,
+   .connector_type = DRM_MODE_CONNECTOR_LVDS,
+};
+
  static const struct drm_display_mode powertip_ph800480t013_idf02_mode = {
.clock = 24750,
.hdisplay = 800,
@@ -4639,6 +4665,9 @@ static const struct of_device_id platform_of_match[] = {
}, {
.compatible = "pda,91-00156-a0",
.data = _91_00156_a0,
+   }, {
+   .compatible = "powertip,ph128800t006-zhc01",
+   .data = _ph128800t006_zhc01,
}, {
.compatible = "powertip,ph800480t013-idf02",
.data = _ph800480t013_idf02,
--
2.25.1



Re: [PATCH] drm/panel: atna33xc20: Fix unbalanced regulator in the case HPD doesn't assert

2024-03-14 Thread Jessica Zhang




On 3/13/2024 2:12 PM, Douglas Anderson via B4 Relay wrote:

From: Douglas Anderson 

When the atna33xc20 driver was first written the resume code never
returned an error. If there was a problem waiting for HPD it just
printed a warning and moved on. This changed in response to review
feedback [1] on a future patch but I accidentally didn't account for
rolling back the regulator enable in the error cases. Do so now.

[1] https://lore.kernel.org/all/5f3cf3a6-1cc2-63e4-f76b-4ee686764...@linaro.org/

Fixes: 3b5765df375c ("drm/panel: atna33xc20: Take advantage of wait_hpd_asserted() 
in struct drm_dp_aux")
Signed-off-by: Douglas Anderson 
---
  drivers/gpu/drm/panel/panel-samsung-atna33xc20.c | 22 +-
  1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-samsung-atna33xc20.c 
b/drivers/gpu/drm/panel/panel-samsung-atna33xc20.c
index 76c2a8f6718c..9c336c71562b 100644
--- a/drivers/gpu/drm/panel/panel-samsung-atna33xc20.c
+++ b/drivers/gpu/drm/panel/panel-samsung-atna33xc20.c
@@ -109,19 +109,17 @@ static int atana33xc20_resume(struct device *dev)
if (hpd_asserted < 0)
ret = hpd_asserted;
  
-		if (ret)

+   if (ret) {
dev_warn(dev, "Error waiting for HPD GPIO: %d\n", ret);
-
-   return ret;
-   }
-
-   if (p->aux->wait_hpd_asserted) {
+   goto error;
+   }
+   } else if (p->aux->wait_hpd_asserted) {


Hi Doug,

Acked-by: Jessica Zhang 

Thanks,

Jessica Zhang


ret = p->aux->wait_hpd_asserted(p->aux, HPD_MAX_US);
  
-		if (ret)

+   if (ret) {
dev_warn(dev, "Controller error waiting for HPD: %d\n", 
ret);
-
-   return ret;
+   goto error;
+   }
}
  
  	/*

@@ -133,6 +131,12 @@ static int atana33xc20_resume(struct device *dev)
 * right times.
 */
return 0;
+
+error:
+   drm_dp_dpcd_set_powered(p->aux, false);
+   regulator_disable(p->supply);
+
+   return ret;
  }
  
  static int atana33xc20_disable(struct drm_panel *panel)


---
base-commit: b33651a5c98dbd5a919219d8c129d0674ef74299
change-id: 20240311-homestarpanel-regulator-f4b890ff4b7c

Best regards,
--
Douglas Anderson 



Re: [PATCH 2/8] drm/panel: do not return negative error codes from drm_panel_get_modes()

2024-03-08 Thread Jessica Zhang




On 3/8/2024 8:03 AM, Jani Nikula wrote:

None of the callers of drm_panel_get_modes() expect it to return
negative error codes. Either they propagate the return value in their
struct drm_connector_helper_funcs .get_modes() hook (which is also not
supposed to return negative codes), or add it to other counts leading to
bogus values.

On the other hand, many of the struct drm_panel_funcs .get_modes() hooks
do return negative error codes, so handle them gracefully instead of
propagating further.

Return 0 for no modes, whatever the reason.

Cc: Neil Armstrong 
Cc: Jessica Zhang 
Cc: Sam Ravnborg 
Cc: sta...@vger.kernel.org
Signed-off-by: Jani Nikula 
---
  drivers/gpu/drm/drm_panel.c | 17 +++--
  1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
index e814020bbcd3..cfbe020de54e 100644
--- a/drivers/gpu/drm/drm_panel.c
+++ b/drivers/gpu/drm/drm_panel.c
@@ -274,19 +274,24 @@ EXPORT_SYMBOL(drm_panel_disable);
   * The modes probed from the panel are automatically added to the connector
   * that the panel is attached to.
   *
- * Return: The number of modes available from the panel on success or a
- * negative error code on failure.
+ * Return: The number of modes available from the panel on success, or 0 on
+ * failure (no modes).
   */
  int drm_panel_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
  {
if (!panel)
-   return -EINVAL;
+   return 0;
  
-	if (panel->funcs && panel->funcs->get_modes)

-   return panel->funcs->get_modes(panel, connector);
+   if (panel->funcs && panel->funcs->get_modes) {
+   int num;
  
-	return -EOPNOTSUPP;

+   num = panel->funcs->get_modes(panel, connector);
+   if (num > 0)
+   return num;


Hi Jani,

The change LGTM:

Reviewed-by: Jessica Zhang 

Thanks,

Jessica Zhang


+   }
+
+   return 0;
  }
  EXPORT_SYMBOL(drm_panel_get_modes);
  
--

2.39.2



Re: [PATCH v2 1/2] drm: panel: st7701: Add Hardkernel ODROID-GO Ultra panel support

2024-02-29 Thread Jessica Zhang




On 2/29/2024 9:23 AM, Adam Green wrote:

On 26/02/2024 21:29, Jessica Zhang wrote:
 > Got it. Was the shorter sleep time breaking the display and is it
 > required for the new panel to work?
 >
 > Thanks,
 >
 > Jessica Zhang

Hi Jessica,

I will be submitting a v3 shortly, the change to the sleep time was not 
necessary for the new panel

to work.


Hi Adam,

Got it. If the panel isn't affected by the 20ms sleep time, I'd prefer 
to keep it since 100ms is a pretty big increase.




I have been able to re-use the gip sequence from the kd50t048a panel 
used in the Hardkernel Odroid
Go Super as I have been led to believe it is the same elida panel, 
unfortunately the same modes
used by that device do not work for the Odroid Go Ultra and so its still 
necessary to have the

patchset,
Got it. FWIW, I do see the Odroid Go Ultra being described as having the 
kd50t048a panel [1] [2]. Looking forward to seeing the v3 changes.


Thanks,

Jessica Zhang

[1] https://gitlab.com/amlogic-foss/mainline-linux-issues-tracker/-/issues/7

[2] 441e129cbf81 ("dt-bindings: display: panel: sitronix,st7701: Add 
Elida KD50T048A Panel")




Best regards,

Adam


Re: [PATCH 2/3] drm/panel: add samsung s6e3fa7 panel driver

2024-02-28 Thread Jessica Zhang




On 2/9/2024 3:17 PM, Richard Acayan wrote:

On Thu, Feb 08, 2024 at 05:34:57PM -0800, Jessica Zhang wrote:

On 2/8/2024 4:16 PM, Richard Acayan wrote:

The S6E3FA7 display controller is enabled in every Pixel 3a (non-XL)
variant. Add the driver for it, generated by
linux-mdss-dsi-panel-driver-generator.

There are other panels connected to the same S6E3FA7 display controller,
such as the AMS604NL01 panel, which are incompatible with this driver.
Name the device tree compatible after the panel model according to
iFixit.

Link: https://github.com/msm8916-mainline/linux-mdss-dsi-panel-driver-generator
Link: 
https://android.googlesource.com/kernel/msm/+/7fda1cd7b64710dafac5f34899611c6d35eb4cd2/arch/arm64/boot/dts/google/dsi-panel-s6e3fa7-1080p-cmd.dtsi
Link: 
https://github.com/msm8953-mainline/linux/blob/v6.6.12-r0/drivers/gpu/drm/panel/panel-samsung-s6e3fa7.c
Link: https://www.ifixit.com/Guide/Image/meta/muyjtLQTHu6MDkhK
Signed-off-by: Richard Acayan 
---
   drivers/gpu/drm/panel/Kconfig |   9 +
   drivers/gpu/drm/panel/Makefile|   1 +
   drivers/gpu/drm/panel/panel-samsung-s6e3fa7.c | 285 ++
   3 files changed, 295 insertions(+)
   create mode 100644 drivers/gpu/drm/panel/panel-samsung-s6e3fa7.c

diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index 8f3783742208..a693b03f680e 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -577,6 +577,15 @@ config DRM_PANEL_SAMSUNG_DB7430
  DB7430 DPI display controller used in such devices as the
  LMS397KF04 480x800 DPI panel.
+config DRM_PANEL_SAMSUNG_S6E3FA7
+   tristate "Samsung S6E3FA7 panel driver"
+   depends on OF
+   depends on DRM_MIPI_DSI
+   depends on BACKLIGHT_CLASS_DEVICE
+   help
+ Say Y here if you want to enable support for the Samsung S6E3FA7
+ 1920x2220 panel.
+
   config DRM_PANEL_SAMSUNG_S6D16D0
tristate "Samsung S6D16D0 DSI video mode panel"
depends on OF
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index d94a644d0a6c..560b62129f68 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -59,6 +59,7 @@ obj-$(CONFIG_DRM_PANEL_SAMSUNG_LD9040) += 
panel-samsung-ld9040.o
   obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6D16D0) += panel-samsung-s6d16d0.o
   obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6D27A1) += panel-samsung-s6d27a1.o
   obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6D7AA0) += panel-samsung-s6d7aa0.o
+obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E3FA7) += panel-samsung-s6e3fa7.o
   obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E3HA2) += panel-samsung-s6e3ha2.o
   obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E63J0X03) += panel-samsung-s6e63j0x03.o
   obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E63M0) += panel-samsung-s6e63m0.o
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e3fa7.c 
b/drivers/gpu/drm/panel/panel-samsung-s6e3fa7.c
new file mode 100644
index ..10bc8fb5f1f9
--- /dev/null
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e3fa7.c
@@ -0,0 +1,285 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Driver for the Samsung S6E3FA7 panel.
+ *
+ * Copyright (c) 2022-2024, The Linux Foundation. All rights reserved.



Hi Richard,

Not really sure about the copyright dates -- since this is a completely new
file to this tree, wouldn't the year be just 2024?


That would be more concise, but the original driver was generated and
added to a kernel fork [1] in 2022 and amendments have been made since then.


Ah, got it. Sounds good.

In that case

Reviewed-by: Jessica Zhang 

Thanks,

Jessica Zhang



[1] 
https://gitlab.com/sdm670-mainline/linux/-/blob/sdm670-v6.2.6/drivers/gpu/drm/panel/panel-samsung-s6e3fa7.c?ref_type=tags



The rest LGTM.

Thanks,

Jessica Zhang


+ * Generated with linux-mdss-dsi-panel-driver-generator from vendor device 
tree:
+ * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ */ > +
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+
+struct s6e3fa7_panel {
+   struct drm_panel panel;
+   struct mipi_dsi_device *dsi;
+   struct gpio_desc *reset_gpio;
+};
+
+static inline struct s6e3fa7_panel *to_s6e3fa7_panel(struct drm_panel *panel)
+{
+   return container_of(panel, struct s6e3fa7_panel, panel);
+}
+
+static void s6e3fa7_panel_reset(struct s6e3fa7_panel *ctx)
+{
+   gpiod_set_value_cansleep(ctx->reset_gpio, 1);
+   usleep_range(1000, 2000);
+   gpiod_set_value_cansleep(ctx->reset_gpio, 0);
+   usleep_range(1, 11000);
+}
+
+static int s6e3fa7_panel_on(struct s6e3fa7_panel *ctx)
+{
+   struct mipi_dsi_device *dsi = ctx->dsi;
+   struct device *dev = >dev;
+   int ret;
+
+   ret = mipi_dsi_dcs_exit_sleep_mode(dsi);
+   if (ret < 0) {
+   dev_err(dev, "Failed to exit sleep mode: %d\n", ret);
+   return ret;
+   }
+   msleep(12

Re: [PATCH RFC 0/4] Support for Simulated Panels

2024-02-28 Thread Jessica Zhang




On 2/2/2024 2:15 AM, Maxime Ripard wrote:

On Tue, Jan 30, 2024 at 09:53:13AM +0100, Daniel Vetter wrote:

Wouldn't it be simpler if we had a vkms-like panel that we could either
configure from DT or from debugfs that would just be registered the
usual way and would be the only panel we register?




No, we need to have validate actual hardware pipeline with the simulated
panel. With vkms, actual display pipeline will not be validated. With
incorrect display pipeline misconfigurations arising from different panel
combinations, this can easily be caught with any existing IGT CRC testing.
In addition, all performance related bugs can also be easily caught by
simulating high resolution displays.


That's not what I meant. What I meant was that something like a
user-configurable, generic, panel driver would be a good idea. Just like
vkms (with the debugfs patches) is for a full blown KMS device.



Let me respond for both this question and the one below from you/Jani.

Certainly having user-configurable information is a goal here. The end-goal
is to make everything there in the existing panels such as below like I
wrote:

1) Display resolution with timings (drm_display_mode)
2) Compression/non-compression
3) Command mode/Video mode
4) MIPI mode flags
5) DCS commands for panel enable/disable and other panel sequences
6) Power-up/Power-down sequence for the panel

But, we also have to see what all is feasible today from the DRM fwk
standpoint. There are some limitations about what is boot-time configurable
using bootparams and what is runtime configurable (across a modeset) using
debugfs.

1) Today, everything part of struct mipi_dsi_device needs to be available at
boot time from what I can see as we need that while calling
mipi_dsi_attach(). So for that we went with boot-params.

2) For the list of modes, we can move this to a debugfs like
"populate_modes" which the client using a sim panel can call before picking
a mode and triggering a commit.

But we need to have some default mode and configuration.


Uh, at the risk of sounding a bit like I'm just chasing the latest
buzzwords, but this sounds like something that's screaming for ebpf.


I make a half-joke to Jani on IRC about it, but I was also being
half-serious. If the goal we want to have is to fully emulate any panel
variation, ebpf really looks like the best and most flexible way
forward.


Hi Maxime and Daniel,

For our current sim panel requirements, we can go with implementing the 
configfs first then add ebpf if requirements get more complex.


Thanks,

Jessica Zhang



Maxime


Re: [PATCH 3/3] drm/panel: simple: add CMT430B19N00 LCD panel support

2024-02-26 Thread Jessica Zhang




On 2/23/2024 5:45 AM, Jérémie Dautheribes wrote:

Add support for Crystal Clear Technology CMT430B19N00 4.3" 480x272
TFT-LCD panel.

Signed-off-by: Jérémie Dautheribes 


Hi Jérémie,

Reviewed-by: Jessica Zhang 

Thanks,

Jessica Zhang


---
  drivers/gpu/drm/panel/panel-simple.c | 29 
  1 file changed, 29 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index 20e3df1c59d4..b940220f56e2 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -1457,6 +1457,32 @@ static const struct panel_desc boe_hv070wsa = {
.connector_type = DRM_MODE_CONNECTOR_LVDS,
  };
  
+static const struct drm_display_mode cct_cmt430b19n00_mode = {

+   .clock = 9000,
+   .hdisplay = 480,
+   .hsync_start = 480 + 43,
+   .hsync_end = 480 + 43 + 8,
+   .htotal = 480 + 43 + 8 + 4,
+   .vdisplay = 272,
+   .vsync_start = 272 + 12,
+   .vsync_end = 272 + 12 + 8,
+   .vtotal = 272 + 12 + 8 + 4,
+   .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
+};
+
+static const struct panel_desc cct_cmt430b19n00 = {
+   .modes = _cmt430b19n00_mode,
+   .num_modes = 1,
+   .bpc = 8,
+   .size = {
+   .width = 95,
+   .height = 53,
+   },
+   .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
+   .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE,
+   .connector_type = DRM_MODE_CONNECTOR_DPI,
+};
+
  static const struct drm_display_mode cdtech_s043wq26h_ct7_mode = {
.clock = 9000,
.hdisplay = 480,
@@ -4402,6 +4428,9 @@ static const struct of_device_id platform_of_match[] = {
}, {
.compatible = "boe,hv070wsa-100",
.data = _hv070wsa
+   }, {
+   .compatible = "cct,cmt430b19n00",
+   .data = _cmt430b19n00,
}, {
.compatible = "cdtech,s043wq26h-ct7",
.data = _s043wq26h_ct7,
--
2.34.1



Re: [PATCH v2 1/2] drm: panel: st7701: Add Hardkernel ODROID-GO Ultra panel support

2024-02-26 Thread Jessica Zhang




On 2/22/2024 9:47 AM, Adam Green wrote:

On 22/02/2024 17:14, Jessica Zhang wrote:

Hi Adam,

Just wondering, why the change to 120 here?

Thanks,

Jessica Zhang


Hi,

The 120ms is taken from the datasheet specification for the controller 
as maximum time it takes for the display to reset,


Got it. Was the shorter sleep time breaking the display and is it 
required for the new panel to work?


Thanks,

Jessica Zhang



Kind regards,

Adam


Re: [PATCH v2 1/2] drm: panel: st7701: Add Hardkernel ODROID-GO Ultra panel support

2024-02-22 Thread Jessica Zhang




On 2/22/2024 8:43 AM, Adam Green wrote:

The Hardkernel ODROID-GO Ultra is a handheld gaming devices, with
a 5 inch 480x854 display. Add support for the display.

Signed-off-by: Adam Green 
---
  drivers/gpu/drm/panel/panel-sitronix-st7701.c | 158 +-
  1 file changed, 157 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7701.c 
b/drivers/gpu/drm/panel/panel-sitronix-st7701.c
index 421eb4592b61..d08e8f4c39dd 100644
--- a/drivers/gpu/drm/panel/panel-sitronix-st7701.c
+++ b/drivers/gpu/drm/panel/panel-sitronix-st7701.c
@@ -423,6 +423,62 @@ static void kd50t048a_gip_sequence(struct st7701 *st7701)
   0xFF, 0xFF, 0xFF, 0xFF, 0x10, 0x45, 0x67, 0x98, 0xBA);
  }
  
+static void odroid_go_ultra_gip_sequence(struct st7701 *st7701)

+{
+   ST7701_DSI(st7701, 0x01);
+   msleep(20);
+   ST7701_DSI(st7701, 0x11);
+   msleep(120);
+
+   ST7701_DSI(st7701, 0xFF, 0x77, 0x01, 0x00, 0x00, 0x10);
+   ST7701_DSI(st7701, 0xC0, 0xE9, 0x03);
+   ST7701_DSI(st7701, 0xC1, 0x11, 0x02);
+   ST7701_DSI(st7701, 0xC2, 0x31, 0x08);
+   ST7701_DSI(st7701, 0xCC, 0x10);
+   ST7701_DSI(st7701, 0xB0, 0x00, 0x0D, 0x14, 0x0D, 0x10, 0x05, 0x02, 0x08,
+  0x08, 0x1E, 0x05, 0x13, 0x11, 0xA3, 0x29, 0x18);
+   ST7701_DSI(st7701, 0xB1, 0x00, 0x0C, 0x14, 0x0C, 0x10, 0x05, 0x03, 0x08,
+  0x07, 0x20, 0x05, 0x13, 0x11, 0xA4, 0x29, 0x18);
+   ST7701_DSI(st7701, 0xFF, 0x77, 0x01, 0x00, 0x00, 0x11);
+   ST7701_DSI(st7701, 0xB0, 0x6C);
+   ST7701_DSI(st7701, 0xB1, 0x43);
+   ST7701_DSI(st7701, 0xB2, 0x07);
+   ST7701_DSI(st7701, 0xB3, 0x80);
+   ST7701_DSI(st7701, 0xB5, 0x47);
+   ST7701_DSI(st7701, 0xB7, 0x85);
+   ST7701_DSI(st7701, 0xB8, 0x20);
+   ST7701_DSI(st7701, 0xB9, 0x10);
+   ST7701_DSI(st7701, 0xC1, 0x78);
+   ST7701_DSI(st7701, 0xC3, 0x78);
+   ST7701_DSI(st7701, 0xD0, 0x88);
+   msleep(120);
+
+   ST7701_DSI(st7701, 0xE0, 0x00, 0x00, 0x02);
+   ST7701_DSI(st7701, 0xE1, 0x08, 0x00, 0x0A, 0x00, 0x07, 0x00, 0x09,
+  0x00, 0x00, 0x33, 0x33);
+   ST7701_DSI(st7701, 0xE2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
+   ST7701_DSI(st7701, 0xE3, 0x00, 0x00, 0x33, 0x33);
+   ST7701_DSI(st7701, 0xE4, 0x44, 0x44);
+   ST7701_DSI(st7701, 0xE5, 0x0E, 0x60, 0xA0, 0xA0, 0x10, 0x60, 0xA0,
+  0xA0, 0x0A, 0x60, 0xA0, 0xA0, 0x0C, 0x60, 0xA0, 0xA0);
+   ST7701_DSI(st7701, 0xE6, 0x00, 0x00, 0x33, 0x33);
+   ST7701_DSI(st7701, 0xE7, 0x44, 0x44);
+   ST7701_DSI(st7701, 0xE8, 0x0D, 0x60, 0xA0, 0xA0, 0x0F, 0x60, 0xA0,
+  0xA0, 0x09, 0x60, 0xA0, 0xA0, 0x0B, 0x60, 0xA0, 0xA0);
+   ST7701_DSI(st7701, 0xEB, 0x02, 0x01, 0xE4, 0xE4, 0x44, 0x00, 0x40);
+   ST7701_DSI(st7701, 0xEC, 0x02, 0x01);
+   ST7701_DSI(st7701, 0xED, 0xAB, 0x89, 0x76, 0x54, 0x01, 0xFF, 0xFF,
+  0xFF, 0xFF, 0xFF, 0xFF, 0x10, 0x45, 0x67, 0x98, 0xBA);
+   ST7701_DSI(st7701, 0xFF, 0x77, 0x01, 0x00, 0x00, 0x00);
+   ST7701_DSI(st7701, 0x3A, 0x70);
+   ST7701_DSI(st7701, 0x53, 0xEC);
+   ST7701_DSI(st7701, 0x55, 0xB3);
+   ST7701_DSI(st7701, 0x5E, 0xFF);
+   ST7701_DSI(st7701, 0x29);
+   msleep(50);
+}
+
  static void rg_arc_gip_sequence(struct st7701 *st7701)
  {
st7701_switch_cmd_bkx(st7701, true, 3);
@@ -470,7 +526,7 @@ static int st7701_prepare(struct drm_panel *panel)
st7701->supplies);
if (ret < 0)
return ret;
-   msleep(20);
+   msleep(120);


Hi Adam,

Just wondering, why the change to 120 here?

Thanks,

Jessica Zhang

  
  	gpiod_set_value(st7701->reset, 1);

msleep(150);
@@ -875,6 +931,105 @@ static const struct st7701_panel_desc kd50t048a_desc = {
.gip_sequence = kd50t048a_gip_sequence,
  };
  
+static const struct drm_display_mode odroid_go_ultra_mode = {

+   .clock  = 29170,
+
+   .hdisplay   = 480,
+   .hsync_start= 480 + 12,
+   .hsync_end  = 480 + 12 + 12,
+   .htotal = 480 + 12 + 12 + 38,
+
+   .vdisplay   = 854,
+   .vsync_start= 854 + 2,
+   .vsync_end  = 854 + 2 + 19,
+   .vtotal = 854 + 2 + 19 + 22,
+
+   .width_mm   = 70,
+   .height_mm  = 140,
+
+   .type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED,
+};
+
+static const struct st7701_panel_desc odroid_go_ultra_desc = {
+   .mode = _go_ultra_mode,
+   .lanes = 2,
+   .format = MIPI_DSI_FMT_RGB888,
+   .panel_sleep_delay = 120,
+
+   .pv_gamma = {
+   CFIELD_PREP(DSI_CMD2_BK0_GAMCTRL_AJ_MASK, 0) |
+   CFIELD_PREP(DSI_CMD2_BK0_GAMCTRL_VC0_MASK, 0),
+   CFIELD_PREP(DSI_CMD2_BK0_GAMCTRL_AJ_MASK, 0) |
+   CFIELD_PREP(DSI_CMD2_BK0_GAMCTRL_VC4_MASK, 0xd),
+   CF

Re: [PATCH] drm/panel: boe-tv101wum-nl6: make use of prepare_prev_first

2024-02-16 Thread Jessica Zhang




On 2/16/2024 12:31 PM, Douglas Anderson wrote:

The panel on sc7180-trogdor-wormdingler and
sc7180-trogdor-quackingstick hasn't been coming up since commit
9e15123eca79 ("drm/msm/dsi: Stop unconditionally powering up DSI hosts
at modeset"). Let's add "prepare_prev_first" as has been done for many
other DSI panels.

Fixes: 9e15123eca79 ("drm/msm/dsi: Stop unconditionally powering up DSI hosts at 
modeset")
Signed-off-by: Douglas Anderson 


Hi Doug,

Reviewed-by: Jessica Zhang 

Thanks,

Jessica Zhang


---
This of course gets into debates about getting a nicer solution that
doesn't involve adding "prepare_prev_first" to every DSI panel out
there, maybe building on Dmitry's work [1]. While it would be nice if
we could get there, getting this landed is easy to backport to stable
trees and gets the panel working again.

[1] 
https://lore.kernel.org/r/20231016165355.1327217-4-dmitry.barysh...@linaro.org

  drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c 
b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
index c4c0f08e9202..bc08814954f9 100644
--- a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
+++ b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
@@ -1871,6 +1871,8 @@ static int boe_panel_add(struct boe_panel *boe)
  
  	gpiod_set_value(boe->enable_gpio, 0);
  
+	boe->base.prepare_prev_first = true;

+
drm_panel_init(>base, dev, _panel_funcs,
   DRM_MODE_CONNECTOR_DSI);
err = of_drm_get_panel_orientation(dev->of_node, >orientation);
--
2.44.0.rc0.258.g7320e95886-goog



Re: [PATCH 3/3] drm/panel: ltk500hd1829: add panel type for ltk101b4029w

2024-02-15 Thread Jessica Zhang




On 2/15/2024 1:05 AM, Heiko Stuebner wrote:

From: Heiko Stuebner 

The ltk101b4029w ist a 10.1 inch DSI panel and shares the same supplies
and startup timings with the existing ltk500hd1829.

So simply add it as a variant with its own init sequence and display-mode.

Signed-off-by: Heiko Stuebner 


Hi Heiko,

Acked-by: Jessica Zhang 

Thanks,

Jessica Zhang


---
  .../drm/panel/panel-leadtek-ltk500hd1829.c| 196 ++
  1 file changed, 196 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c 
b/drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c
index 42f4e2584af18..7bc538b7c6b7c 100644
--- a/drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c
+++ b/drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c
@@ -43,6 +43,198 @@ struct ltk500hd1829 {
bool prepared;
  };
  
+static const struct ltk500hd1829_cmd ltk101b4029w_init[] = {

+   /* Page0 */
+   { 0xE0, 0x00 },
+   /* PASSWORD */
+   { 0xE1, 0x93 },
+   { 0xE2, 0x65 },
+   { 0xE3, 0xF8 },
+   { 0x80, 0x03 }, /* 0X03:4-LANE; 0X02:3-LANE; 0X01:2-LANE */
+   /* Page1 */
+   { 0xE0, 0x01 },
+   /* Set VCOM */
+   { 0x00, 0x00 },
+   { 0x01, 0x6F },
+   /* Set Gamma Power, VGMP,VGMN,VGSP,VGSN */
+   { 0x17, 0x00 },
+   { 0x18, 0xAF }, /* 4.3V */
+   { 0x19, 0x01 }, /* 0.3V */
+   { 0x1A, 0x00 },
+   { 0x1B, 0xAF }, /* 4.3V */
+   { 0x1C, 0x01 }, /* 0.3V */
+   /* Set Gate Power */
+   { 0x1F, 0x3E }, /* VGH_R  = 15V */
+   { 0x20, 0x28 }, /* VGL_R  = -12V */
+   { 0x21, 0x28 }, /* VGL_R2 = -12V */
+   { 0x22, 0x7E },
+   /* SETPANEL */
+   { 0x35, 0x26 },
+   { 0x37, 0x09 },
+   /* SET RGBCYC */
+   { 0x38, 0x04 },
+   { 0x39, 0x00 },
+   { 0x3A, 0x01 },
+   { 0x3C, 0x7C },
+   { 0x3D, 0xFF },
+   { 0x3E, 0xFF },
+   { 0x3F, 0x7F },
+   /* Set TCON */
+   { 0x40, 0x06 }, /* RSO = 800 RGB */
+   { 0x41, 0xA0 }, /* LN = 640->1280 line */
+   { 0x42, 0x81 },
+   { 0x43, 0x08 }, /* VFP = 8 */
+   { 0x44, 0x0B }, /* VBP = 12 */
+   { 0x45, 0x28 }, /* HBP = 40 */
+   /* power voltage */
+   { 0x55, 0x0F }, /* DCDCM = 0001, JD PWR_IC */
+   { 0x57, 0x69 },
+   { 0x59, 0x0A }, /* VCL = -2.9V */
+   { 0x5A, 0x28 }, /* VGH = 15V */
+   { 0x5B, 0x14 }, /* VGL = -11V */
+   /* Gamma */
+   { 0x5D, 0x7C },
+   { 0x5E, 0x65 },
+   { 0x5F, 0x55 },
+   { 0x60, 0x47 },
+   { 0x61, 0x43 },
+   { 0x62, 0x32 },
+   { 0x63, 0x34 },
+   { 0x64, 0x1C },
+   { 0x65, 0x33 },
+   { 0x66, 0x31 },
+   { 0x67, 0x30 },
+   { 0x68, 0x4E },
+   { 0x69, 0x3C },
+   { 0x6A, 0x44 },
+   { 0x6B, 0x35 },
+   { 0x6C, 0x31 },
+   { 0x6D, 0x23 },
+   { 0x6E, 0x11 },
+   { 0x6F, 0x00 },
+   { 0x70, 0x7C },
+   { 0x71, 0x65 },
+   { 0x72, 0x55 },
+   { 0x73, 0x47 },
+   { 0x74, 0x43 },
+   { 0x75, 0x32 },
+   { 0x76, 0x34 },
+   { 0x77, 0x1C },
+   { 0x78, 0x33 },
+   { 0x79, 0x31 },
+   { 0x7A, 0x30 },
+   { 0x7B, 0x4E },
+   { 0x7C, 0x3C },
+   { 0x7D, 0x44 },
+   { 0x7E, 0x35 },
+   { 0x7F, 0x31 },
+   { 0x80, 0x23 },
+   { 0x81, 0x11 },
+   { 0x82, 0x00 },
+/* Page2, for GIP */
+   { 0xE0, 0x02 },
+   /* GIP_L Pin mapping */
+   { 0x00, 0x1E },
+   { 0x01, 0x1E },
+   { 0x02, 0x41 },
+   { 0x03, 0x41 },
+   { 0x04, 0x43 },
+   { 0x05, 0x43 },
+   { 0x06, 0x1F },
+   { 0x07, 0x1F },
+   { 0x08, 0x35 },
+   { 0x09, 0x1F },
+   { 0x0A, 0x15 },
+   { 0x0B, 0x15 },
+   { 0x0C, 0x1F },
+   { 0x0D, 0x47 },
+   { 0x0E, 0x47 },
+   { 0x0F, 0x45 },
+   { 0x10, 0x45 },
+   { 0x11, 0x4B },
+   { 0x12, 0x4B },
+   { 0x13, 0x49 },
+   { 0x14, 0x49 },
+   { 0x15, 0x1F },
+   /* GIP_R Pin mapping */
+   { 0x16, 0x1E },
+   { 0x17, 0x1E },
+   { 0x18, 0x40 },
+   { 0x19, 0x40 },
+   { 0x1A, 0x42 },
+   { 0x1B, 0x42 },
+   { 0x1C, 0x1F },
+   { 0x1D, 0x1F },
+   { 0x1E, 0x35 },
+   { 0x1F, 0x1F },
+   { 0x20, 0x15 },
+   { 0x21, 0x15 },
+   { 0x22, 0x1f },
+   { 0x23, 0x46 },
+   { 0x24, 0x46 },
+   { 0x25, 0x44 },
+   { 0x26, 0x44 },
+   { 0x27, 0x4A },
+   { 0x28, 0x4A },
+   { 0x29, 0x48 },
+   { 0x2A, 0x48 },
+   { 0x2B, 0x1F },
+   /* GIP Timing */
+   { 0x58, 0x40 },
+   { 0x5B, 0x30 },
+   { 0x5C, 0x03 },
+   { 0x5D, 0x30 },
+   { 0x5E, 0x01 },
+   { 0x5F, 0x02 },
+   { 0x63, 0x14 },
+   { 0x64, 0x6A },
+   { 0x67, 0x73 },
+   { 0x68, 0x05 },
+   { 0x69, 0x14 },
+   { 0x6A, 0x6A },
+   { 0x6B, 0x08 },
+   { 0x6C, 0x00 },
+   { 0x6D, 0x00 },
+   { 0x6E, 0x00 },
+   { 0x6F, 0x88 },
+   { 0x77, 0xDD },
+   { 0x79, 0x0E },
+   { 0x7A, 0

Re: [PATCH 1/3] drm/panel: ltk500hd1829: make room for more similar panels

2024-02-15 Thread Jessica Zhang




On 2/15/2024 1:05 AM, Heiko Stuebner wrote:

From: Heiko Stuebner 

There exist more dsi-panels from Leadtek sharing supplies and timings
with only the panel-mode and init commands differing.

So make room in the driver to also keep variants here instead of
requiring additional drivers per panel.

Signed-off-by: Heiko Stuebner 


Hi Heiko,

Reviewed-by: Jessica Zhang 

Thanks,

Jessica Zhang


---
  .../drm/panel/panel-leadtek-ltk500hd1829.c| 73 ---
  1 file changed, 47 insertions(+), 26 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c 
b/drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c
index 39e408c9f762f..42f4e2584af18 100644
--- a/drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c
+++ b/drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c
@@ -11,6 +11,7 @@
  #include 
  #include 
  #include 
+#include 
  #include 
  
  #include 

@@ -21,25 +22,32 @@
  #include 
  #include 
  
+struct ltk500hd1829_cmd {

+   char cmd;
+   char data;
+};
+
+struct ltk500hd1829_desc {
+   const struct drm_display_mode *mode;
+   const struct ltk500hd1829_cmd *init;
+   unsigned int num_init;
+};
+
  struct ltk500hd1829 {
struct device *dev;
struct drm_panel panel;
struct gpio_desc *reset_gpio;
struct regulator *vcc;
struct regulator *iovcc;
+   const struct ltk500hd1829_desc *panel_desc;
bool prepared;
  };
  
-struct ltk500hd1829_cmd {

-   char cmd;
-   char data;
-};
-
  /*
   * There is no description in the Reference Manual about these commands.
   * We received them from the vendor, so just use them as is.
   */
-static const struct ltk500hd1829_cmd init_code[] = {
+static const struct ltk500hd1829_cmd ltk500hd1829_init[] = {
{ 0xE0, 0x00 },
{ 0xE1, 0x93 },
{ 0xE2, 0x65 },
@@ -260,6 +268,26 @@ static const struct ltk500hd1829_cmd init_code[] = {
{ 0x35, 0x00 },
  };
  
+static const struct drm_display_mode ltk500hd1829_mode = {

+   .hdisplay   = 720,
+   .hsync_start= 720 + 50,
+   .hsync_end  = 720 + 50 + 50,
+   .htotal = 720 + 50 + 50 + 50,
+   .vdisplay   = 1280,
+   .vsync_start= 1280 + 30,
+   .vsync_end  = 1280 + 30 + 4,
+   .vtotal = 1280 + 30 + 4 + 12,
+   .clock  = 69217,
+   .width_mm   = 62,
+   .height_mm  = 110,
+};
+
+static const struct ltk500hd1829_desc ltk500hd1829_data = {
+   .mode = _mode,
+   .init = ltk500hd1829_init,
+   .num_init = ARRAY_SIZE(ltk500hd1829_init),
+};
+
  static inline
  struct ltk500hd1829 *panel_to_ltk500hd1829(struct drm_panel *panel)
  {
@@ -324,8 +352,8 @@ static int ltk500hd1829_prepare(struct drm_panel *panel)
/* tRT: >= 5ms */
usleep_range(5000, 6000);
  
-	for (i = 0; i < ARRAY_SIZE(init_code); i++) {

-   ret = mipi_dsi_generic_write(dsi, _code[i],
+   for (i = 0; i < ctx->panel_desc->num_init; i++) {
+   ret = mipi_dsi_generic_write(dsi, >panel_desc->init[i],
 sizeof(struct ltk500hd1829_cmd));
if (ret < 0) {
dev_err(panel->dev, "failed to write init cmds: %d\n", 
ret);
@@ -359,31 +387,17 @@ static int ltk500hd1829_prepare(struct drm_panel *panel)
return ret;
  }
  
-static const struct drm_display_mode default_mode = {

-   .hdisplay   = 720,
-   .hsync_start= 720 + 50,
-   .hsync_end  = 720 + 50 + 50,
-   .htotal = 720 + 50 + 50 + 50,
-   .vdisplay   = 1280,
-   .vsync_start= 1280 + 30,
-   .vsync_end  = 1280 + 30 + 4,
-   .vtotal = 1280 + 30 + 4 + 12,
-   .clock  = 69217,
-   .width_mm   = 62,
-   .height_mm  = 110,
-};
-
  static int ltk500hd1829_get_modes(struct drm_panel *panel,
  struct drm_connector *connector)
  {
struct ltk500hd1829 *ctx = panel_to_ltk500hd1829(panel);
struct drm_display_mode *mode;
  
-	mode = drm_mode_duplicate(connector->dev, _mode);

+   mode = drm_mode_duplicate(connector->dev, ctx->panel_desc->mode);
if (!mode) {
dev_err(ctx->dev, "failed to add mode %ux%u@%u\n",
-   default_mode.hdisplay, default_mode.vdisplay,
-   drm_mode_vrefresh(_mode));
+   ctx->panel_desc->mode->hdisplay, 
ctx->panel_desc->mode->vdisplay,
+   drm_mode_vrefresh(ctx->panel_desc->mode));
return -ENOMEM;
}
  
@@ -413,6 +427,10 @@ static int ltk500hd1829_probe(struct mipi_dsi_device *dsi)

if (!ctx)
return -ENOMEM;
  
+	ctx->panel_desc = of_device_get_match_data(dev);

+   if (!ctx->panel_desc)
+   return -EINVAL;
+
ctx->reset_

Re: [PATCH 2/7] drm/panel: st7703: Add Powkiddy RGB10MAX3 Panel Support

2024-02-12 Thread Jessica Zhang




On 2/12/2024 10:49 AM, Chris Morgan wrote:

From: Chris Morgan 

The Powkiddy RGB10MAX3 is a handheld device with a 5 inch 720x1280
display panel with a Sitronix ST7703 display controller. The panel
is installed rotated 270 degrees.

Signed-off-by: Chris Morgan 


Hi Chris,

Reviewed-by: Jessica Zhang 

Thanks,

Jessica Zhang


---
  drivers/gpu/drm/panel/panel-sitronix-st7703.c | 91 +++
  1 file changed, 91 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c 
b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
index b55bafd1a8be..939ba05c9b58 100644
--- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c
+++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
@@ -521,6 +521,96 @@ static const struct st7703_panel_desc rgb30panel_desc = {
.init_sequence = rgb30panel_init_sequence,
  };
  
+static int rgb10max3_panel_init_sequence(struct st7703 *ctx)

+{
+   struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
+
+   /* Init sequence extracted from Powkiddy RGB10MAX3 BSP kernel. */
+
+   mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETEXTC, 0xf1, 0x12, 0x83);
+   mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETAPID, 0x00, 0x00, 0x00, 0xda,
+  0x80);
+   mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETDISP, 0xc8, 0x02, 0x30);
+   mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETRGBIF, 0x10, 0x10, 0x28,
+  0x28, 0x03, 0xff, 0x00, 0x00, 0x00, 0x00);
+   mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETCYC, 0x80);
+   mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETBGP, 0x04, 0x04);
+   mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETVCOM, 0x78, 0x78);
+   mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETPOWER_EXT, 0x25, 0x22, 0xf0,
+  0x63);
+   mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETMIPI, 0x33, 0x81, 0x05, 0xf9,
+  0x0e, 0x0e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x44, 0x25, 0x00, 0x90, 0x0a, 0x00,
+  0x00, 0x01, 0x4f, 0x01, 0x00, 0x00, 0x37);
+   mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETVDC, 0x47);
+   mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_UNKNOWN_BF, 0x02, 0x11, 0x00);
+   mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETSCR, 0x73, 0x73, 0x50, 0x50,
+  0x00, 0x00, 0x12, 0x70, 0x00);
+   mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETPOWER, 0x25, 0x00, 0x32,
+  0x32, 0x77, 0xe1, 0xff, 0xff, 0xcc, 0xcc, 0x77,
+  0x77);
+   mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETECO, 0x82, 0x00, 0xbf, 0xff,
+  0x00, 0xff);
+   mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETIO, 0xb8, 0x00, 0x0a, 0x00,
+  0x00, 0x00);
+   mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETCABC, 0x10, 0x40, 0x1e,
+  0x02);
+   mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETPANEL, 0x0b);
+   mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETGAMMA, 0x00, 0x04, 0x07,
+  0x2a, 0x39, 0x3f, 0x36, 0x31, 0x06, 0x0b, 0x0e,
+  0x12, 0x14, 0x12, 0x13, 0x0f, 0x17, 0x00, 0x04,
+  0x07, 0x2a, 0x39, 0x3f, 0x36, 0x31, 0x06, 0x0b,
+  0x0e, 0x12, 0x14, 0x12, 0x13, 0x0f, 0x17);
+   mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETEQ, 0x03, 0x03, 0x03, 0x03,
+  0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0xff, 0x80,
+  0xc0, 0x10);
+   mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETGIP1, 0xc8, 0x10, 0x08, 0x00,
+  0x00, 0x41, 0xf8, 0x12, 0x31, 0x23, 0x37, 0x86,
+  0x11, 0xc8, 0x37, 0x2a, 0x00, 0x00, 0x0c, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+  0x88, 0x20, 0x46, 0x02, 0x88, 0x88, 0x88, 0x88,
+  0x88, 0x88, 0xff, 0x88, 0x31, 0x57, 0x13, 0x88,
+  0x88, 0x88, 0x88, 0x88, 0x88, 0xff, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00);
+   mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETGIP2, 0x00, 0x1a, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x8f, 0x13, 0x31, 0x75, 0x88, 0x88, 0x88, 0x88,
+  0x88, 0x88, 0xf8, 0x8f, 0x02, 0x20, 0x64, 0x88,
+  0x88, 0x88, 0x88, 0x88, 0x88, 0xf8, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00);
+   mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_UNKNOWN_EF, 0xff, 0

Re: [PATCH 2/3] drm/panel: add samsung s6e3fa7 panel driver

2024-02-08 Thread Jessica Zhang




On 2/8/2024 4:16 PM, Richard Acayan wrote:

The S6E3FA7 display controller is enabled in every Pixel 3a (non-XL)
variant. Add the driver for it, generated by
linux-mdss-dsi-panel-driver-generator.

There are other panels connected to the same S6E3FA7 display controller,
such as the AMS604NL01 panel, which are incompatible with this driver.
Name the device tree compatible after the panel model according to
iFixit.

Link: https://github.com/msm8916-mainline/linux-mdss-dsi-panel-driver-generator
Link: 
https://android.googlesource.com/kernel/msm/+/7fda1cd7b64710dafac5f34899611c6d35eb4cd2/arch/arm64/boot/dts/google/dsi-panel-s6e3fa7-1080p-cmd.dtsi
Link: 
https://github.com/msm8953-mainline/linux/blob/v6.6.12-r0/drivers/gpu/drm/panel/panel-samsung-s6e3fa7.c
Link: https://www.ifixit.com/Guide/Image/meta/muyjtLQTHu6MDkhK
Signed-off-by: Richard Acayan 
---
  drivers/gpu/drm/panel/Kconfig |   9 +
  drivers/gpu/drm/panel/Makefile|   1 +
  drivers/gpu/drm/panel/panel-samsung-s6e3fa7.c | 285 ++
  3 files changed, 295 insertions(+)
  create mode 100644 drivers/gpu/drm/panel/panel-samsung-s6e3fa7.c

diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index 8f3783742208..a693b03f680e 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -577,6 +577,15 @@ config DRM_PANEL_SAMSUNG_DB7430
  DB7430 DPI display controller used in such devices as the
  LMS397KF04 480x800 DPI panel.
  
+config DRM_PANEL_SAMSUNG_S6E3FA7

+   tristate "Samsung S6E3FA7 panel driver"
+   depends on OF
+   depends on DRM_MIPI_DSI
+   depends on BACKLIGHT_CLASS_DEVICE
+   help
+ Say Y here if you want to enable support for the Samsung S6E3FA7
+ 1920x2220 panel.
+
  config DRM_PANEL_SAMSUNG_S6D16D0
tristate "Samsung S6D16D0 DSI video mode panel"
depends on OF
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index d94a644d0a6c..560b62129f68 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -59,6 +59,7 @@ obj-$(CONFIG_DRM_PANEL_SAMSUNG_LD9040) += 
panel-samsung-ld9040.o
  obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6D16D0) += panel-samsung-s6d16d0.o
  obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6D27A1) += panel-samsung-s6d27a1.o
  obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6D7AA0) += panel-samsung-s6d7aa0.o
+obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E3FA7) += panel-samsung-s6e3fa7.o
  obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E3HA2) += panel-samsung-s6e3ha2.o
  obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E63J0X03) += panel-samsung-s6e63j0x03.o
  obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E63M0) += panel-samsung-s6e63m0.o
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e3fa7.c 
b/drivers/gpu/drm/panel/panel-samsung-s6e3fa7.c
new file mode 100644
index ..10bc8fb5f1f9
--- /dev/null
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e3fa7.c
@@ -0,0 +1,285 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Driver for the Samsung S6E3FA7 panel.
+ *
+ * Copyright (c) 2022-2024, The Linux Foundation. All rights reserved.



Hi Richard,

Not really sure about the copyright dates -- since this is a completely 
new file to this tree, wouldn't the year be just 2024?


The rest LGTM.

Thanks,

Jessica Zhang


+ * Generated with linux-mdss-dsi-panel-driver-generator from vendor device 
tree:
+ * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ */ > +
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+
+struct s6e3fa7_panel {
+   struct drm_panel panel;
+   struct mipi_dsi_device *dsi;
+   struct gpio_desc *reset_gpio;
+};
+
+static inline struct s6e3fa7_panel *to_s6e3fa7_panel(struct drm_panel *panel)
+{
+   return container_of(panel, struct s6e3fa7_panel, panel);
+}
+
+static void s6e3fa7_panel_reset(struct s6e3fa7_panel *ctx)
+{
+   gpiod_set_value_cansleep(ctx->reset_gpio, 1);
+   usleep_range(1000, 2000);
+   gpiod_set_value_cansleep(ctx->reset_gpio, 0);
+   usleep_range(1, 11000);
+}
+
+static int s6e3fa7_panel_on(struct s6e3fa7_panel *ctx)
+{
+   struct mipi_dsi_device *dsi = ctx->dsi;
+   struct device *dev = >dev;
+   int ret;
+
+   ret = mipi_dsi_dcs_exit_sleep_mode(dsi);
+   if (ret < 0) {
+   dev_err(dev, "Failed to exit sleep mode: %d\n", ret);
+   return ret;
+   }
+   msleep(120);
+
+   ret = mipi_dsi_dcs_set_tear_on(dsi, MIPI_DSI_DCS_TEAR_MODE_VBLANK);
+   if (ret < 0) {
+   dev_err(dev, "Failed to set tear on: %d\n", ret);
+   return ret;
+   }
+
+   mipi_dsi_dcs_write_seq(dsi, 0xf0, 0x5a, 0x5a);
+   mipi_dsi_dcs_write_seq(dsi, 0xf4,
+  0xbb, 0x23, 0x19, 0x3a, 0x9f, 0x0f, 0x09, 0xc0,
+  0x00, 0xb4, 0x37, 0x70, 0x79, 0x69);
+   mipi_dsi_dcs_write_s

Re: [PATCH 5/5] drm/panel: simple: push blanking limit on RK32FN48H

2024-02-06 Thread Jessica Zhang




On 2/5/2024 1:26 AM, Raphael Gallais-Pou wrote:

Push horizontal front porch and vertical back porch blanking limit.
This allows to get a 60 fps sharp.

Signed-off-by: Raphael Gallais-Pou 


Hi Raphael,

Reviewed-by: Jessica Zhang 

Thanks,

Jessica Zhang


---
  drivers/gpu/drm/panel/panel-simple.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index 7b286382ffb4..10b361d603be 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -3516,10 +3516,10 @@ static const struct display_timing 
rocktech_rk043fn48h_timing = {
.pixelclock = { 600, 900, 1200 },
.hactive = { 480, 480, 480 },
.hback_porch = { 8, 43, 43 },
-   .hfront_porch = { 2, 8, 8 },
+   .hfront_porch = { 2, 8, 10 },
.hsync_len = { 1, 1, 1 },
.vactive = { 272, 272, 272 },
-   .vback_porch = { 2, 12, 12 },
+   .vback_porch = { 2, 12, 26 },
.vfront_porch = { 1, 4, 4 },
.vsync_len = { 1, 10, 10 },
.flags = DISPLAY_FLAGS_VSYNC_LOW | DISPLAY_FLAGS_HSYNC_LOW |

--
2.25.1



Re: [PATCH 4/5] drm/panel: simple: fix flags on RK043FN48H

2024-02-06 Thread Jessica Zhang




On 2/5/2024 1:06 AM, Raphael Gallais-Pou wrote:

DISPLAY_FLAGS_SYNC_POSEDGE is missing in the flags on the default
timings. When overriding the default mode with one described in the
device tree, the mode does not get acked because of this missing flag.
Moreover since the panel is driven by the positive edge it makes sense
to add it here.

Signed-off-by: Raphael Gallais-Pou 


Hi Raphael,

Reviewed-by: Jessica Zhang 

Thanks,

Jessica Zhang


---
  drivers/gpu/drm/panel/panel-simple.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index 2214cb09678c..7b286382ffb4 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -3523,7 +3523,8 @@ static const struct display_timing 
rocktech_rk043fn48h_timing = {
.vfront_porch = { 1, 4, 4 },
.vsync_len = { 1, 10, 10 },
.flags = DISPLAY_FLAGS_VSYNC_LOW | DISPLAY_FLAGS_HSYNC_LOW |
-DISPLAY_FLAGS_DE_HIGH | DISPLAY_FLAGS_PIXDATA_POSEDGE,
+DISPLAY_FLAGS_DE_HIGH | DISPLAY_FLAGS_PIXDATA_POSEDGE |
+DISPLAY_FLAGS_SYNC_POSEDGE,
  };
  
  static const struct panel_desc rocktech_rk043fn48h = {


--
2.25.1



[PATCH] drm/panel: visionox-r66451: Set prepare_prev_first flag

2024-02-02 Thread Jessica Zhang
The DSI host needs to be enabled for the panel to be initialized in
prepare(). Ensure this happens by setting prepare_prev_first.

Signed-off-by: Jessica Zhang 
---
 drivers/gpu/drm/panel/panel-visionox-r66451.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/panel/panel-visionox-r66451.c 
b/drivers/gpu/drm/panel/panel-visionox-r66451.c
index fbb73464de332..493f2a6076f8d 100644
--- a/drivers/gpu/drm/panel/panel-visionox-r66451.c
+++ b/drivers/gpu/drm/panel/panel-visionox-r66451.c
@@ -322,6 +322,7 @@ static int visionox_r66451_probe(struct mipi_dsi_device 
*dsi)
dsi->lanes = 4;
dsi->format = MIPI_DSI_FMT_RGB888;
dsi->mode_flags = MIPI_DSI_MODE_LPM | MIPI_DSI_CLOCK_NON_CONTINUOUS;
+   ctx->panel.prepare_prev_first = true;
 
drm_panel_init(>panel, dev, _r66451_funcs, 
DRM_MODE_CONNECTOR_DSI);
ctx->panel.backlight = visionox_r66451_create_backlight(dsi);

---
base-commit: 51b70ff55ed88edd19b080a524063446bcc34b62
change-id: 20230717-visionox-r66451-prev-first-67b036160e32

Best regards,
-- 
Jessica Zhang 



[PATCH] dt-bindings: visionox-rm69299: Update maintainers

2024-02-02 Thread Jessica Zhang
The current maintainer (Harigovindan P) is no longer reachable through
the listed email. Update maintainers list to be Abhinav and I.

Signed-off-by: Jessica Zhang 
---
 Documentation/devicetree/bindings/display/panel/visionox,rm69299.yaml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/Documentation/devicetree/bindings/display/panel/visionox,rm69299.yaml 
b/Documentation/devicetree/bindings/display/panel/visionox,rm69299.yaml
index fa745a6f4456c..7723990675158 100644
--- a/Documentation/devicetree/bindings/display/panel/visionox,rm69299.yaml
+++ b/Documentation/devicetree/bindings/display/panel/visionox,rm69299.yaml
@@ -7,7 +7,8 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
 title: Visionox model RM69299 Panels
 
 maintainers:
-  - Harigovindan P 
+  - Abhinav Kumar 
+  - Jessica Zhang 
 
 description: |
   This binding is for display panels using a Visionox RM692999 panel.

---
base-commit: 51b70ff55ed88edd19b080a524063446bcc34b62
change-id: 20240202-rm69299-maintainers-7e069f78334f

Best regards,
-- 
Jessica Zhang 



[PATCH v2] drm/panel: visionox-vtdr6130: Set prepare_prev_first flag

2024-02-01 Thread Jessica Zhang
The DSI host must be enabled for the panel to be initialized in
prepare(). Set the prepare_prev_first flag to guarantee this.

Signed-off-by: Jessica Zhang 
---
To: Neil Armstrong 
To: Sam Ravnborg 
To: David Airlie 
To: Daniel Vetter 
To: Jessica Zhang 
To: Maarten Lankhorst 
To: Maxime Ripard 
To: Thomas Zimmermann 
Cc: quic_abhin...@quicinc.com
Cc: quic_parel...@quicinc.com
Cc: dri-devel@lists.freedesktop.org
Cc: linux-ker...@vger.kernel.org

Changes in v2:
- Corrected commit message to mention that DCS on commands are sent during
  prepare() instead of probe()
- Dropped Fixes tag
- Rebased onto tip of linux-next
- Link to v1: 
https://lore.kernel.org/r/20230725-visionox-vtdr-prev-first-v1-1-3bc44cec7...@quicinc.com
---
 drivers/gpu/drm/panel/panel-visionox-vtdr6130.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/panel/panel-visionox-vtdr6130.c 
b/drivers/gpu/drm/panel/panel-visionox-vtdr6130.c
index a23407b9f6fb6..540099253e1bd 100644
--- a/drivers/gpu/drm/panel/panel-visionox-vtdr6130.c
+++ b/drivers/gpu/drm/panel/panel-visionox-vtdr6130.c
@@ -287,6 +287,7 @@ static int visionox_vtdr6130_probe(struct mipi_dsi_device 
*dsi)
dsi->format = MIPI_DSI_FMT_RGB888;
dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_NO_EOT_PACKET |
  MIPI_DSI_CLOCK_NON_CONTINUOUS;
+   ctx->panel.prepare_prev_first = true;
 
drm_panel_init(>panel, dev, _vtdr6130_panel_funcs,
   DRM_MODE_CONNECTOR_DSI);

---
base-commit: 51b70ff55ed88edd19b080a524063446bcc34b62
change-id: 20230717-visionox-vtdr-prev-first-e00ae02eec9f

Best regards,
-- 
Jessica Zhang 



Re: [PATCH] drm/panel: novatek-nt36523: Set prepare_prev_first

2024-02-01 Thread Jessica Zhang




On 2/1/2024 2:17 PM, Konrad Dybcio wrote:

The .prepare callback contains the init sequence, so the DSI host *must*
be enabled at that point. Set the prepare_prev_first flag to ensure that.

Signed-off-by: Konrad Dybcio 


Hi Konrad,

Reviewed-by: Jessica Zhang 

Thanks,

Jessica Zhang


---
  drivers/gpu/drm/panel/panel-novatek-nt36523.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36523.c 
b/drivers/gpu/drm/panel/panel-novatek-nt36523.c
index a189ce236328..32cae1bc9162 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt36523.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt36523.c
@@ -1270,6 +1270,8 @@ static int nt36523_probe(struct mipi_dsi_device *dsi)
return ret;
}
  
+	pinfo->panel.prepare_prev_first = true;

+
if (pinfo->desc->has_dcs_backlight) {
pinfo->panel.backlight = nt36523_create_backlight(dsi);
if (IS_ERR(pinfo->panel.backlight))

---
base-commit: 51b70ff55ed88edd19b080a524063446bcc34b62
change-id: 20240201-topic-3623_fix-9198419e5e47

Best regards,
--
Konrad Dybcio 



Re: [PATCH RFC for upstream 2/4] drm/panel: simple: Add EDT ETML1010G3DRA panel

2024-01-26 Thread Jessica Zhang




On 1/26/2024 12:57 AM, Yannic Moog wrote:

From: Primoz Fiser 

Add support for the EDT ETML1010G3DRA 10.1" 1280x800 LVDS panel.
Datasheet can be found at [1].

[1] 
https://www.glynshop.com/erp/owweb/Daten/DSS/EDT/Products/Specifications/Active%20Displays/ETML1010G3DRA%20Ver.3-RoHS.pdf

Signed-off-by: Primoz Fiser 
Signed-off-by: Yannic Moog 


Hi Yannic,

Reviewed-by: Jessica Zhang 

Thanks,

Jessica Zhang


---
  drivers/gpu/drm/panel/panel-simple.c | 30 ++
  1 file changed, 30 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index 9367a4572dcf..662cf8d10a8a 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -1920,6 +1920,33 @@ static const struct panel_desc edt_etml0700y5dha = {
.connector_type = DRM_MODE_CONNECTOR_LVDS,
  };
  
+static const struct display_timing edt_etml1010g3dra_timing = {

+   .pixelclock = { 6630, 7240, 7890 },
+   .hactive = { 1280, 1280, 1280 },
+   .hfront_porch = { 12, 72, 132 },
+   .hback_porch = { 86, 86, 86 },
+   .hsync_len = { 2, 2, 2 },
+   .vactive = { 800, 800, 800 },
+   .vfront_porch = { 1, 15, 49 },
+   .vback_porch = { 21, 21, 21 },
+   .vsync_len = { 2, 2, 2 },
+   .flags = DISPLAY_FLAGS_VSYNC_LOW | DISPLAY_FLAGS_HSYNC_LOW |
+DISPLAY_FLAGS_DE_HIGH,
+};
+
+static const struct panel_desc edt_etml1010g3dra = {
+   .timings = _etml1010g3dra_timing,
+   .num_timings = 1,
+   .bpc = 8,
+   .size = {
+   .width = 216,
+   .height = 135,
+   },
+   .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
+   .bus_flags = DRM_BUS_FLAG_DE_HIGH,
+   .connector_type = DRM_MODE_CONNECTOR_LVDS,
+};
+
  static const struct drm_display_mode edt_etmv570g2dhu_mode = {
.clock = 25175,
.hdisplay = 640,
@@ -4328,6 +4355,9 @@ static const struct of_device_id platform_of_match[] = {
}, {
.compatible = "edt,etml0700y5dha",
.data = _etml0700y5dha,
+   }, {
+   .compatible = "edt,etml1010g3dra",
+   .data = _etml1010g3dra,
}, {
.compatible = "edt,etmv570g2dhu",
.data = _etmv570g2dhu,

--
2.34.1



[PATCH RFC 2/4] drm/dsi: Add API to register simulated DSI panel

2024-01-16 Thread Jessica Zhang
Add new APIs to register a simulated panel.

For drivers that want to support a simulated panel, they must call
mipi_dsi_host_register_sim_panel().

Signed-off-by: Jessica Zhang 
---
 drivers/gpu/drm/drm_mipi_dsi.c | 30 ++
 include/drm/drm_mipi_dsi.h |  1 +
 2 files changed, 31 insertions(+)

diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index 843a6dbda93a0..6996014990979 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -153,6 +153,24 @@ static int mipi_dsi_device_add(struct mipi_dsi_device *dsi)
return device_add(>dev);
 }
 
+#if IS_ENABLED(CONFIG_DRM_PANEL_SIMULATION)
+static struct mipi_dsi_device *mipi_dsi_device_add_sim_panel(struct 
mipi_dsi_host *host)
+{
+   struct mipi_dsi_device_info info = { };
+
+   info.channel = 0;
+   info.node = NULL;
+   strscpy(info.type, "panel_simulation", sizeof(info.type));
+
+   return mipi_dsi_device_register_full(host, );
+}
+#else
+static struct mipi_dsi_device *mipi_dsi_device_add_sim_panel(struct 
mipi_dsi_host *host)
+{
+   return ERR_PTR(-ENODEV);
+}
+#endif
+
 #if IS_ENABLED(CONFIG_OF)
 static struct mipi_dsi_device *
 of_mipi_dsi_device_add(struct mipi_dsi_host *host, struct device_node *node)
@@ -324,6 +342,18 @@ struct mipi_dsi_host *of_find_mipi_dsi_host_by_node(struct 
device_node *node)
 }
 EXPORT_SYMBOL(of_find_mipi_dsi_host_by_node);
 
+int mipi_dsi_host_register_sim_panel(struct mipi_dsi_host *host)
+{
+   mipi_dsi_device_add_sim_panel(host);
+
+   mutex_lock(_lock);
+   list_add_tail(>list, _list);
+   mutex_unlock(_lock);
+
+   return 0;
+}
+EXPORT_SYMBOL(mipi_dsi_host_register_sim_panel);
+
 int mipi_dsi_host_register(struct mipi_dsi_host *host)
 {
struct device_node *node;
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index c0aec0d4d664e..4ca44b7b3efdb 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -107,6 +107,7 @@ struct mipi_dsi_host {
struct list_head list;
 };
 
+int mipi_dsi_host_register_sim_panel(struct mipi_dsi_host *host);
 int mipi_dsi_host_register(struct mipi_dsi_host *host);
 void mipi_dsi_host_unregister(struct mipi_dsi_host *host);
 struct mipi_dsi_host *of_find_mipi_dsi_host_by_node(struct device_node *node);

-- 
2.43.0



[PATCH RFC 4/4] drm/msm/dsi: Add simulated panel support

2024-01-16 Thread Jessica Zhang
Introduce the sim_panel_enabled module parameter.

When set, this parameter will force DSI to select the simulated panel
instead of the physical panel.

Signed-off-by: Jessica Zhang 
---
 drivers/gpu/drm/msm/dsi/dsi.c | 4 
 drivers/gpu/drm/msm/dsi/dsi_host.c| 9 -
 drivers/gpu/drm/msm/dsi/dsi_manager.c | 8 +++-
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c
index c6bd7bf15605c..daea84f5e3c0c 100644
--- a/drivers/gpu/drm/msm/dsi/dsi.c
+++ b/drivers/gpu/drm/msm/dsi/dsi.c
@@ -5,6 +5,10 @@
 
 #include "dsi.h"
 
+bool sim_panel_enabled;
+MODULE_PARM_DESC(sim_panel_enabled, "Use simulated panel");
+module_param(sim_panel_enabled, bool, 0444);
+
 bool msm_dsi_is_cmd_mode(struct msm_dsi *msm_dsi)
 {
unsigned long host_flags = msm_dsi_host_get_mode_flags(msm_dsi->host);
diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c 
b/drivers/gpu/drm/msm/dsi/dsi_host.c
index deeecdfd6c4e4..fa0cab09fff71 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -35,6 +35,8 @@
 
 #define DSI_RESET_TOGGLE_DELAY_MS 20
 
+extern bool sim_panel_enabled;
+
 static int dsi_populate_dsc_params(struct msm_dsi_host *msm_host, struct 
drm_dsc_config *dsc);
 
 static int dsi_get_version(const void __iomem *base, u32 *major, u32 *minor)
@@ -2009,7 +2011,12 @@ int msm_dsi_host_register(struct mipi_dsi_host *host)
if (!msm_host->registered) {
host->dev = _host->pdev->dev;
host->ops = _host_ops;
-   ret = mipi_dsi_host_register(host);
+
+   if (sim_panel_enabled)
+   ret = mipi_dsi_host_register_sim_panel(host);
+   else
+   ret = mipi_dsi_host_register(host);
+
if (ret)
return ret;
 
diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c 
b/drivers/gpu/drm/msm/dsi/dsi_manager.c
index 896f369fdd535..e33e6be7309f2 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_manager.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c
@@ -30,6 +30,8 @@ struct msm_dsi_manager {
 
 static struct msm_dsi_manager msm_dsim_glb;
 
+extern bool sim_panel_enabled;
+
 #define IS_BONDED_DSI()(msm_dsim_glb.is_bonded_dsi)
 #define IS_SYNC_NEEDED()   (msm_dsim_glb.is_sync_needed)
 #define IS_MASTER_DSI_LINK(id) (msm_dsim_glb.master_dsi_link_id == id)
@@ -507,7 +509,11 @@ int msm_dsi_manager_ext_bridge_init(u8 id)
int ret;
 
int_bridge = msm_dsi->bridge;
-   ext_bridge = devm_drm_of_get_bridge(_dsi->pdev->dev,
+
+   if (sim_panel_enabled)
+   ext_bridge = drm_get_sim_panel_bridge(_dsi->pdev->dev);
+   else
+   ext_bridge = devm_drm_of_get_bridge(_dsi->pdev->dev,
msm_dsi->pdev->dev.of_node, 1, 0);
if (IS_ERR(ext_bridge))
return PTR_ERR(ext_bridge);

-- 
2.43.0



[PATCH RFC 1/4] drm/panel: add driver for simulated panel

2024-01-16 Thread Jessica Zhang
Add a driver for simulating panels. This module also supports a mode
parameter for users to specify a custom mode. If no custom mode is set,
it will fall back to a custom, hard-coded mode.

Signed-off-by: Jessica Zhang 
---
 drivers/gpu/drm/panel/Kconfig|   9 ++
 drivers/gpu/drm/panel/Makefile   |   1 +
 drivers/gpu/drm/panel/panel-simulation.c | 147 +++
 3 files changed, 157 insertions(+)

diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index 99e14dc212ecb..d711ec170c586 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -107,6 +107,15 @@ config DRM_PANEL_SIMPLE
  that it can be automatically turned off when the panel goes into a
  low power state.
 
+config DRM_PANEL_SIMULATION
+   tristate "support for simulation panels"
+   depends on DRM_MIPI_DSI
+   help
+ DRM panel driver for simulated DSI panels. Enabling this config will
+ cause the physical panel driver to not be attached to the DT panel
+ node. After the kernel boots, users can load the module and specify a
+ custom mode using the driver modparams.
+
 config DRM_PANEL_EDP
tristate "support for simple Embedded DisplayPort panels"
depends on OF
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index d10c3de51c6db..5bc55357714ad 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -9,6 +9,7 @@ obj-$(CONFIG_DRM_PANEL_BOE_TV101WUM_NL6) += 
panel-boe-tv101wum-nl6.o
 obj-$(CONFIG_DRM_PANEL_DSI_CM) += panel-dsi-cm.o
 obj-$(CONFIG_DRM_PANEL_LVDS) += panel-lvds.o
 obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o
+obj-$(CONFIG_DRM_PANEL_SIMULATION) += panel-simulation.o
 obj-$(CONFIG_DRM_PANEL_EDP) += panel-edp.o
 obj-$(CONFIG_DRM_PANEL_EBBG_FT8719) += panel-ebbg-ft8719.o
 obj-$(CONFIG_DRM_PANEL_ELIDA_KD35T133) += panel-elida-kd35t133.o
diff --git a/drivers/gpu/drm/panel/panel-simulation.c 
b/drivers/gpu/drm/panel/panel-simulation.c
new file mode 100644
index 0..081c03bea188d
--- /dev/null
+++ b/drivers/gpu/drm/panel/panel-simulation.c
@@ -0,0 +1,147 @@
+// SPDX-License-Identifier: GPL-2.0-only
+// Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static char sim_panel_mode[PATH_MAX];
+
+module_param_string(mode, sim_panel_mode, sizeof(sim_panel_mode), 0644);
+MODULE_PARM_DESC(mode, "Sim panel mode");
+
+struct panel_simulation {
+   struct drm_panel base;
+   struct platform_device *platform;
+} *sim_panel;
+
+static struct drm_display_mode panel_simulation_mode = {
+   .clock = 345830,
+   .hdisplay = 1080,
+   .hsync_start = 1175,
+   .hsync_end = 1176,
+   .htotal = 1216,
+   .vdisplay = 2340,
+   .vsync_start = 2365,
+   .vsync_end = 2366,
+   .vtotal = 2370,
+   .width_mm = 0,
+   .height_mm = 0,
+   .type = DRM_MODE_TYPE_DRIVER,
+};
+
+static int panel_simulation_parse_mode(void)
+{
+   int count;
+   struct drm_display_mode user_mode = { 0 };
+   unsigned int vrefresh;
+
+   if (sim_panel_mode[0] == '\0')
+   return 0;
+
+   count = sscanf(sim_panel_mode, "%hu,%hu,%hu,%hu,%hu,%hu,%hu,%hu-%u",
+_mode.hdisplay, _mode.hsync_start,
+_mode.hsync_end, _mode.htotal,
+_mode.vdisplay, _mode.vsync_start,
+_mode.vsync_end, _mode.vtotal, 
);
+
+   if (count != 9)
+   return -EINVAL;
+
+   user_mode.clock = user_mode.htotal * user_mode.vtotal * vrefresh / 1000;
+   memcpy(_simulation_mode, _mode, sizeof(struct 
drm_display_mode));
+
+   return 0;
+}
+
+static int panel_simulation_get_modes(struct drm_panel *panel,
+   struct drm_connector *connector)
+{
+   struct drm_display_mode *mode;
+   int ret;
+
+   ret = panel_simulation_parse_mode();
+
+   mode = drm_mode_duplicate(connector->dev, _simulation_mode);
+   if (!mode)
+   return -ENOMEM;
+
+   drm_mode_set_name(mode);
+   mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
+   connector->display_info.width_mm = mode->width_mm;
+   connector->display_info.height_mm = mode->height_mm;
+   drm_mode_probed_add(connector, mode);
+
+   return 1;
+}
+
+static const struct drm_panel_funcs panel_simulation_funcs = {
+   .get_modes = panel_simulation_get_modes,
+};
+
+static int panel_simulation_probe(struct mipi_dsi_device *dsi)
+{
+   struct panel_simulation *panel;
+   struct device *dev = >dev;
+   int ret;
+
+   panel = devm_kzalloc(dev, sizeof(*panel), GFP_KERNEL);
+   if (!panel)
+   return -ENOMEM;
+
+   mipi_dsi_set_drvda

[PATCH RFC 3/4] drm/panel: Introduce simulated panel bridge API

2024-01-16 Thread Jessica Zhang
Add separate bridge and drm_panel API for getting the simulated panel.

Signed-off-by: Jessica Zhang 
---
 drivers/gpu/drm/bridge/panel.c | 24 
 drivers/gpu/drm/drm_panel.c| 33 +
 include/drm/drm_bridge.h   |  1 +
 include/drm/drm_panel.h|  1 +
 4 files changed, 59 insertions(+)

diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c
index e48823a4f1ede..87a83f4ce68a1 100644
--- a/drivers/gpu/drm/bridge/panel.c
+++ b/drivers/gpu/drm/bridge/panel.c
@@ -499,6 +499,30 @@ struct drm_connector *drm_panel_bridge_connector(struct 
drm_bridge *bridge)
 }
 EXPORT_SYMBOL(drm_panel_bridge_connector);
 
+/**
+ * drm_get_sim_panel_bridge - return the simulated panel bridge
+ * @dev: device to tie the bridge lifetime to
+ *
+ * This function will return a bridge for the simulated panel.
+ *
+ * Returns a pointer to the bridge if successful, or an error pointer
+ * otherwise.
+ */
+struct drm_bridge *drm_get_sim_panel_bridge(struct device *dev)
+{
+   struct drm_bridge *bridge;
+   struct drm_panel *panel;
+
+   panel = drm_find_sim_panel();
+   if (IS_ERR(panel))
+   return ERR_PTR(-EPROBE_DEFER);
+
+   bridge = devm_drm_panel_bridge_add(dev, panel);
+
+   return bridge;
+}
+EXPORT_SYMBOL(drm_get_sim_panel_bridge);
+
 #ifdef CONFIG_OF
 /**
  * devm_drm_of_get_bridge - Return next bridge in the chain
diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
index e814020bbcd3b..062541505fa74 100644
--- a/drivers/gpu/drm/drm_panel.c
+++ b/drivers/gpu/drm/drm_panel.c
@@ -290,6 +290,39 @@ int drm_panel_get_modes(struct drm_panel *panel,
 }
 EXPORT_SYMBOL(drm_panel_get_modes);
 
+/**
+ * drm_find_sim_panel - look up the simulated panel
+ *
+ * Searches for the simulated panel in the panel list.
+ *
+ * Return: A pointer to the simulated panel or an ERR_PTR() if the simulated
+ * panel was not found in the panel list.
+ *
+ * Possible error codes returned by this function:
+ * - EPROBE_DEFER: the panel device has not been probed yet, and the caller
+ *   should retry later
+*/
+struct drm_panel *drm_find_sim_panel(void)
+{
+   struct drm_panel *panel;
+
+   mutex_lock(_lock);
+
+   list_for_each_entry(panel, _list, list) {
+   bool is_sim_panel = !strncmp(panel->dev->driver->name,
+   "panel_simulation",
+   strlen("panel_simulation"));
+   if (is_sim_panel) {
+   mutex_unlock(_lock);
+   return panel;
+   }
+   }
+
+   mutex_unlock(_lock);
+   return ERR_PTR(-EPROBE_DEFER);
+}
+EXPORT_SYMBOL(drm_find_sim_panel);
+
 #ifdef CONFIG_OF
 /**
  * of_drm_find_panel - look up a panel using a device tree node
diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
index e39da5807ba71..941f1f825e2c6 100644
--- a/include/drm/drm_bridge.h
+++ b/include/drm/drm_bridge.h
@@ -927,6 +927,7 @@ static inline int drm_panel_bridge_set_orientation(struct 
drm_connector *connect
 }
 #endif
 
+struct drm_bridge *drm_get_sim_panel_bridge(struct device *dev);
 #if defined(CONFIG_OF) && defined(CONFIG_DRM_PANEL_BRIDGE)
 struct drm_bridge *devm_drm_of_get_bridge(struct device *dev, struct 
device_node *node,
  u32 port, u32 endpoint);
diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
index 10015891b056f..c3a5944c35a91 100644
--- a/include/drm/drm_panel.h
+++ b/include/drm/drm_panel.h
@@ -283,6 +283,7 @@ int drm_panel_enable(struct drm_panel *panel);
 int drm_panel_disable(struct drm_panel *panel);
 
 int drm_panel_get_modes(struct drm_panel *panel, struct drm_connector 
*connector);
+struct drm_panel *drm_find_sim_panel(void);
 
 #if defined(CONFIG_OF) && defined(CONFIG_DRM_PANEL)
 struct drm_panel *of_drm_find_panel(const struct device_node *np);

-- 
2.43.0



[PATCH RFC 0/4] Support for Simulated Panels

2024-01-16 Thread Jessica Zhang
This series introduces a simulated MIPI DSI panel.

Currently, the only way to validate DSI connectors is with a physical
panel. Since obtaining physical panels for all possible DSI configurations
is logistically infeasible, introduce a way for DSI drivers to simulate a
panel.

This will be helpful in catching DSI misconfiguration bugs and catching
performance issues for high FPS panels that might not be easily
obtainable.

For now, the simulated panel driver only supports setting customized
modes via the panel_simlation.mode modparam. Eventually, we would like
to add more customizations (such as configuring DSC, dual DSI, etc.).

---
Jessica Zhang (4):
  drm/panel: add driver for simulated panel
  drm/dsi: Add API to register simulated DSI panel
  drm/panel: Introduce simulated panel bridge API
  drm/msm/dsi: Add simulated panel support

 drivers/gpu/drm/bridge/panel.c   |  24 +
 drivers/gpu/drm/drm_mipi_dsi.c   |  30 +++
 drivers/gpu/drm/drm_panel.c  |  33 +++
 drivers/gpu/drm/msm/dsi/dsi.c|   4 +
 drivers/gpu/drm/msm/dsi/dsi_host.c   |   9 +-
 drivers/gpu/drm/msm/dsi/dsi_manager.c|   8 +-
 drivers/gpu/drm/panel/Kconfig|   9 ++
 drivers/gpu/drm/panel/Makefile   |   1 +
 drivers/gpu/drm/panel/panel-simulation.c | 147 +++
 include/drm/drm_bridge.h |   1 +
 include/drm/drm_mipi_dsi.h   |   1 +
 include/drm/drm_panel.h  |   1 +
 12 files changed, 266 insertions(+), 2 deletions(-)
---
base-commit: 9ba3471618f1ab8df2f2689a34a505a72e05760a
change-id: 20240102-jz-test-sim-panel-71c14a56716e

Best regards,
-- 
Jessica Zhang 



Re: [PATCH] drm/panel: nt36523: Set 120Hz fps for xiaomi, elish panels

2024-01-12 Thread Jessica Zhang




On 1/12/2024 6:00 AM, Jianhua Lu wrote:

After commit e6c0de5f4450 ("drm/msm/dpu: try multirect based on mdp clock 
limits")
merged, 120Hz is working on xiaomi,elish panels, so feature it.

Signed-off-by: Jianhua Lu 


Reviewed-by: Jessica Zhang 


---
  drivers/gpu/drm/panel/panel-novatek-nt36523.c | 6 ++
  1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36523.c 
b/drivers/gpu/drm/panel/panel-novatek-nt36523.c
index a189ce236328..d6fa76dbf948 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt36523.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt36523.c
@@ -933,8 +933,7 @@ static int j606f_boe_init_sequence(struct panel_info *pinfo)
  
  static const struct drm_display_mode elish_boe_modes[] = {

{
-   /* There is only one 120 Hz timing, but it doesn't work 
perfectly, 104 Hz preferred */
-   .clock = (1600 + 60 + 8 + 60) * (2560 + 26 + 4 + 168) * 104 / 
1000,
+   .clock = (1600 + 60 + 8 + 60) * (2560 + 26 + 4 + 168) * 120 / 
1000,
.hdisplay = 1600,
.hsync_start = 1600 + 60,
.hsync_end = 1600 + 60 + 8,
@@ -948,8 +947,7 @@ static const struct drm_display_mode elish_boe_modes[] = {
  
  static const struct drm_display_mode elish_csot_modes[] = {

{
-   /* There is only one 120 Hz timing, but it doesn't work 
perfectly, 104 Hz preferred */
-   .clock = (1600 + 200 + 40 + 52) * (2560 + 26 + 4 + 168) * 104 / 
1000,
+   .clock = (1600 + 200 + 40 + 52) * (2560 + 26 + 4 + 168) * 120 / 
1000,
.hdisplay = 1600,
.hsync_start = 1600 + 200,
.hsync_end = 1600 + 200 + 40,
--
2.41.0



Re: [v2 2/2] drm/panel: Add support for Novatek NT36672E panel driver

2024-01-11 Thread Jessica Zhang




On 1/8/2024 1:59 AM, Ritesh Kumar wrote:

Add support for the 1080x2408 Novatek NT36672E video mode
DSI panel driver.

Signed-off-by: Ritesh Kumar 


Reviewed-by: Jessica Zhang 



---
v2: Fixed review comments from Krzysztof
   - renamed the panel driver file to reflect that this is a novatek IC.
   - adjusted internal function names to reflect the same.
   - corrected compatible string accordingly.
   - updated CONFIG for the same.
---
  drivers/gpu/drm/panel/Kconfig |  10 +
  drivers/gpu/drm/panel/Makefile|   1 +
  .../gpu/drm/panel/panel-novatek-nt36672e.c| 643 ++
  3 files changed, 654 insertions(+)
  create mode 100644 drivers/gpu/drm/panel/panel-novatek-nt36672e.c

diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index 99e14dc212ec..052aaef7d6a2 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -429,6 +429,16 @@ config DRM_PANEL_NOVATEK_NT36672A
  around the Novatek NT36672A display controller, such as some
  Tianma panels used in a few Xiaomi Poco F1 mobile phones.
  
+config DRM_PANEL_NOVATEK_NT36672E

+   tristate "Novatek NT36672E DSI panel"
+   depends on OF
+   depends on DRM_MIPI_DSI
+   depends on BACKLIGHT_CLASS_DEVICE
+   help
+ Say Y here if you want to enable support for Novatek NT36672E DSI 
Video Mode
+ LCD panel module. The panel has a resolution of 1080x2408 and uses 24 
bit
+ RGB per pixel.
+
  config DRM_PANEL_NOVATEK_NT39016
tristate "Novatek NT39016 RGB/SPI panel"
depends on OF && SPI
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index d10c3de51c6d..93a544a8937c 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -40,6 +40,7 @@ obj-$(CONFIG_DRM_PANEL_NOVATEK_NT35560) += 
panel-novatek-nt35560.o
  obj-$(CONFIG_DRM_PANEL_NOVATEK_NT35950) += panel-novatek-nt35950.o
  obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36523) += panel-novatek-nt36523.o
  obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36672A) += panel-novatek-nt36672a.o
+obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36672E) += panel-novatek-nt36672e.o
  obj-$(CONFIG_DRM_PANEL_NOVATEK_NT39016) += panel-novatek-nt39016.o
  obj-$(CONFIG_DRM_PANEL_MANTIX_MLAF057WE51) += panel-mantix-mlaf057we51.o
  obj-$(CONFIG_DRM_PANEL_OLIMEX_LCD_OLINUXINO) += panel-olimex-lcd-olinuxino.o
diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36672e.c 
b/drivers/gpu/drm/panel/panel-novatek-nt36672e.c
new file mode 100644
index ..d4e85c2fc899
--- /dev/null
+++ b/drivers/gpu/drm/panel/panel-novatek-nt36672e.c
@@ -0,0 +1,643 @@
+// SPDX-License-Identifier: GPL-2.0-only
+// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+
+static const char * const regulator_names[] = {
+   "vddi",
+   "avdd",
+   "avee",
+};
+
+static const unsigned long regulator_enable_loads[] = {
+   62000,
+   10,
+   10,
+};
+
+static const unsigned long regulator_disable_loads[] = {
+   80,
+   100,
+   100,
+};
+
+struct panel_desc {
+   const struct drm_display_mode *display_mode;
+   u32 width_mm;
+   u32 height_mm;
+   unsigned long mode_flags;
+   enum mipi_dsi_pixel_format format;
+   unsigned int lanes;
+   const char *panel_name;
+   int (*init_sequence)(struct mipi_dsi_device *dsi);
+};
+
+struct nt36672e_panel {
+   struct drm_panel panel;
+   struct mipi_dsi_device *dsi;
+   struct gpio_desc *reset_gpio;
+   struct regulator_bulk_data supplies[3];
+   const struct panel_desc *desc;
+};
+
+static inline struct nt36672e_panel *to_nt36672e_panel(struct drm_panel *panel)
+{
+   return container_of(panel, struct nt36672e_panel, panel);
+}
+
+static int nt36672e_1080x2408_60hz_init(struct mipi_dsi_device *dsi)
+{
+   mipi_dsi_dcs_write_seq(dsi, 0xff, 0x10);
+   mipi_dsi_dcs_write_seq(dsi, 0xfb, 0x01);
+   mipi_dsi_dcs_write_seq(dsi, 0xb0, 0x00);
+   mipi_dsi_dcs_write_seq(dsi, 0xc0, 0x00);
+   mipi_dsi_dcs_write_seq(dsi, 0xc1, 0x89, 0x28, 0x00, 0x08, 0x00, 0xaa, 
0x02,
+   0x0e, 0x00, 0x2b, 0x00, 0x07, 0x0d, 0xb7, 0x0c, 
0xb7);
+
+   mipi_dsi_dcs_write_seq(dsi, 0xc2, 0x1b, 0xa0);
+   mipi_dsi_dcs_write_seq(dsi, 0xff, 0x20);
+   mipi_dsi_dcs_write_seq(dsi, 0xfb, 0x01);
+   mipi_dsi_dcs_write_seq(dsi, 0x01, 0x66);
+   mipi_dsi_dcs_write_seq(dsi, 0x06, 0x40);
+   mipi_dsi_dcs_write_seq(dsi, 0x07, 0x38);
+   mipi_dsi_dcs_write_seq(dsi, 0x2f, 0x83);
+   mipi_dsi_dcs_write_seq(dsi, 0x69, 0x91);
+   mipi_dsi_dcs_write_seq(dsi, 0x95, 0xd1);
+   mipi_dsi_dcs_write_seq(dsi, 0x96, 0xd1);
+   mipi_dsi_dcs_write_seq(dsi, 0xf2, 0x64);
+   mipi_dsi_dcs_write_seq(dsi, 0

Re: [PATCH v2 2/2] gpu: drm: panel: panel-simple: add new display mode for waveshare 7inch touchscreen panel

2024-01-09 Thread Jessica Zhang




On 1/8/2024 11:09 PM, Shengyang Chen wrote:

The waveshare 7" 800x480 panel is a clone of Raspberry Pi 7" 800x480 panel
It also uses a Toshiba TC358762 DSI to DPI bridge chip but it needs different
timing from Raspberry Pi panel. Add new timing for it.


Hi Shengyang,

The patch itself LGTM, but in case you have to put out a new revision, 
can you please use the "drm/panel: :" prefix format that 
other drm/panel commits use?


Reviewed-by: Jessica Zhang 

Thanks,

Jessica Zhang



Signed-off-by: Keith Zhao 
Signed-off-by: Shengyang Chen 
---
  drivers/gpu/drm/panel/panel-simple.c | 28 
  1 file changed, 28 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index 9367a4572dcf..e0896873ea33 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -4110,6 +4110,31 @@ static const struct panel_desc vl050_8048nt_c01 = {
.bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE,
  };
  
+static const struct drm_display_mode waveshare_7inch_mode = {

+   .clock = 2970 / 1000,
+   .hdisplay = 800,
+   .hsync_start = 800 + 90,
+   .hsync_end = 800 + 90 + 5,
+   .htotal = 800 + 90 + 5 + 5,
+   .vdisplay = 480,
+   .vsync_start = 480 + 60,
+   .vsync_end = 480 + 60 + 5,
+   .vtotal = 480 + 60 + 5 + 5,
+   .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
+};
+
+static const struct panel_desc waveshare_7inch = {
+   .modes = _7inch_mode,
+   .num_modes = 1,
+   .bpc = 8,
+   .size = {
+   .width = 154,
+   .height = 86,
+   },
+   .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
+   .connector_type = DRM_MODE_CONNECTOR_DSI,
+};
+
  static const struct drm_display_mode winstar_wf35ltiacd_mode = {
.clock = 6410,
.hdisplay = 320,
@@ -4592,6 +4617,9 @@ static const struct of_device_id platform_of_match[] = {
}, {
.compatible = "vxt,vl050-8048nt-c01",
.data = _8048nt_c01,
+   }, {
+   .compatible = "waveshare,7inch-touchscreen",
+   .data = _7inch,
}, {
.compatible = "winstar,wf35ltiacd",
.data = _wf35ltiacd,
--
2.17.1



Re: [PATCH v3 2/4] drm/panel: Add driver for BOE TH101MB31IG002-28A panel

2024-01-08 Thread Jessica Zhang
 0xC1);


Hi Manuel,

(I'm assuming the `0x00` here is not MIPI_DCS_NOP)

Reviewed-by: Jessica Zhang 

Thanks,

Jessica Zhang


+   mipi_dsi_dcs_write_seq(dsi, 0xC1, 0x54, 0x94, 0x02, 0x85, 0x9F, 0x00,
+   0x7F, 0x00, 0x54, 0x00);
+   mipi_dsi_dcs_write_seq(dsi, 0xC2, 0x17, 0x09, 0x08, 0x89, 0x08, 0x11,
+   0x22, 0x20, 0x44, 0xFF, 0x18, 0x00);
+   mipi_dsi_dcs_write_seq(dsi, 0xC3, 0x86, 0x46, 0x05, 0x05, 0x1C, 0x1C,
+   0x1D, 0x1D, 0x02, 0x1F, 0x1F, 0x1E, 0x1E,
+   0x0F, 0x0F, 0x0D, 0x0D, 0x13, 0x13, 0x11,
+   0x11, 0x00);
+   mipi_dsi_dcs_write_seq(dsi, 0xC4, 0x07, 0x07, 0x04, 0x04, 0x1C, 0x1C,
+   0x1D, 0x1D, 0x02, 0x1F, 0x1F, 0x1E, 0x1E,
+   0x0E, 0x0E, 0x0C, 0x0C, 0x12, 0x12, 0x10,
+   0x10, 0x00);
+   mipi_dsi_dcs_write_seq(dsi, 0xC6, 0x2A, 0x2A);
+   mipi_dsi_dcs_write_seq(dsi, 0xC8, 0x21, 0x00, 0x31, 0x42, 0x34, 0x16);
+   mipi_dsi_dcs_write_seq(dsi, 0xCA, 0xCB, 0x43);
+   mipi_dsi_dcs_write_seq(dsi, 0xCD, 0x0E, 0x4B, 0x4B, 0x20, 0x19, 0x6B,
+   0x06, 0xB3);
+   mipi_dsi_dcs_write_seq(dsi, 0xD2, 0xE3, 0x2B, 0x38, 0x00);
+   mipi_dsi_dcs_write_seq(dsi, 0xD4, 0x00, 0x01, 0x00, 0x0E, 0x04, 0x44,
+   0x08, 0x10, 0x00, 0x00, 0x00);
+   mipi_dsi_dcs_write_seq(dsi, 0xE6, 0x80, 0x01, 0xFF, 0xFF, 0xFF, 0xFF,
+   0xFF, 0xFF);
+   mipi_dsi_dcs_write_seq(dsi, 0xF0, 0x12, 0x03, 0x20, 0x00, 0xFF);
+   mipi_dsi_dcs_write_seq(dsi, 0xF3, 0x00);
+
+   ret = mipi_dsi_dcs_exit_sleep_mode(dsi);
+   if (ret < 0) {
+   dev_err(dev, "Failed to exit sleep mode: %d\n", ret);
+   return ret;
+   }
+
+   msleep(120);
+
+   ret = mipi_dsi_dcs_set_display_on(dsi);
+   if (ret < 0) {
+   dev_err(dev, "Failed to set panel on: %d\n", ret);
+   return ret;
+   }
+
+   return 0;
+}
+
+static int boe_th101mb31ig002_disable(struct drm_panel *panel)
+{
+   struct boe_th101mb31ig002 *ctx = container_of(panel,
+ struct boe_th101mb31ig002,
+ panel);
+   struct mipi_dsi_device *dsi = ctx->dsi;
+   struct device *dev = >dev;
+   int ret;
+
+   ret = mipi_dsi_dcs_set_display_off(dsi);
+   if (ret < 0)
+   dev_err(dev, "Failed to set panel off: %d\n", ret);
+
+   msleep(120);
+
+   ret = mipi_dsi_dcs_enter_sleep_mode(dsi);
+   if (ret < 0)
+   dev_err(dev, "Failed to enter sleep mode: %d\n", ret);
+
+   return 0;
+}
+
+static int boe_th101mb31ig002_unprepare(struct drm_panel *panel)
+{
+   struct boe_th101mb31ig002 *ctx = container_of(panel,
+ struct boe_th101mb31ig002,
+ panel);
+
+   gpiod_set_value_cansleep(ctx->reset, 1);
+   gpiod_set_value_cansleep(ctx->enable, 0);
+   regulator_disable(ctx->power);
+
+   return 0;
+}
+
+static int boe_th101mb31ig002_prepare(struct drm_panel *panel)
+{
+   struct boe_th101mb31ig002 *ctx = container_of(panel,
+ struct boe_th101mb31ig002,
+ panel);
+   struct device *dev = >dsi->dev;
+   int ret;
+
+   ret = regulator_enable(ctx->power);
+   if (ret) {
+   dev_err(dev, "Failed to enable power supply: %d\n", ret);
+   return ret;
+   }
+
+   gpiod_set_value_cansleep(ctx->enable, 1);
+   msleep(50);
+   boe_th101mb31ig002_reset(ctx);
+   boe_th101mb31ig002_enable(panel);
+
+   return 0;
+}
+
+static const struct drm_display_mode boe_th101mb31ig002_default_mode = {
+   .clock  = 73500,
+   .hdisplay   = 800,
+   .hsync_start= 800 + 64,
+   .hsync_end  = 800 + 64 + 16,
+   .htotal = 800 + 64 + 16 + 64,
+   .vdisplay   = 1280,
+   .vsync_start= 1280 + 2,
+   .vsync_end  = 1280 + 2 + 4,
+   .vtotal = 1280 + 2 + 4 + 12,
+   .width_mm   = 135,
+   .height_mm  = 216,
+   .type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED,
+};
+
+static int boe_th101mb31ig002_get_modes(struct drm_panel *panel,
+   struct drm_connector *connector)
+{
+   struct boe_th101mb31ig002 *ctx = container_of(panel,
+ struct boe_th101mb31ig002,
+ panel);
+   struct drm_display_mo

Re: [PATCH linux-next] drm/panel: samsung: Simplify with dev_err_probe()

2024-01-03 Thread Jessica Zhang




On 1/3/2024 6:17 AM, chenguanxi11...@163.com wrote:

From: Chen Haonan 

dev_err_probe() can check if the error code is -EPROBE_DEFER
and can return the error code, replacing dev_err() with it
simplifies the code.

Signed-off-by: Chen Haonan 


Reviewed-by: Jessica Zhang 


---
  drivers/gpu/drm/panel/panel-samsung-s6d16d0.c | 6 ++
  1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c 
b/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
index 79f611963c61..f4103e762b53 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c
@@ -194,10 +194,8 @@ static int s6d16d0_probe(struct mipi_dsi_device *dsi)
s6->reset_gpio = devm_gpiod_get_optional(dev, "reset",
GPIOD_OUT_HIGH);
if (IS_ERR(s6->reset_gpio)) {
-   ret = PTR_ERR(s6->reset_gpio);
-   if (ret != -EPROBE_DEFER)
-   dev_err(dev, "failed to request GPIO (%d)\n", ret);
-   return ret;
+   return dev_err_probe(dev, PTR_ERR(s6->reset_gpio),
+"failed to request 
GPIO\n");
}
  
  	drm_panel_init(>panel, dev, _drm_funcs,

--
2.25.1



Re: [PATCH linux-next v2] drm/panel: Simplify with dev_err_probe()

2024-01-03 Thread Jessica Zhang




On 12/25/2023 6:26 AM, chenguanxi11...@163.com wrote:

From: Chen Haonan 

dev_err_probe() can check if the error code is -EPROBE_DEFER
and can return the error code, replacing dev_err() with it
simplifies the code.

Signed-off-by: Chen Haonan 


Reviewed-by: Jessica Zhang 


---
  drivers/gpu/drm/panel/panel-boe-himax8279d.c | 18 ++
  1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-boe-himax8279d.c 
b/drivers/gpu/drm/panel/panel-boe-himax8279d.c
index 11b64acbe8a9..e225840b0d67 100644
--- a/drivers/gpu/drm/panel/panel-boe-himax8279d.c
+++ b/drivers/gpu/drm/panel/panel-boe-himax8279d.c
@@ -854,26 +854,20 @@ static int panel_add(struct panel_info *pinfo)
  
  	pinfo->pp18_gpio = devm_gpiod_get(dev, "pp18", GPIOD_OUT_HIGH);

if (IS_ERR(pinfo->pp18_gpio)) {
-   ret = PTR_ERR(pinfo->pp18_gpio);
-   if (ret != -EPROBE_DEFER)
-   dev_err(dev, "failed to get pp18 gpio: %d\n", ret);
-   return ret;
+   return dev_err_probe(dev, PTR_ERR(pinfo->pp18_gpio),
+"failed to get pp18 
gpio\n");
}
  
  	pinfo->pp33_gpio = devm_gpiod_get(dev, "pp33", GPIOD_OUT_HIGH);

if (IS_ERR(pinfo->pp33_gpio)) {
-   ret = PTR_ERR(pinfo->pp33_gpio);
-   if (ret != -EPROBE_DEFER)
-   dev_err(dev, "failed to get pp33 gpio: %d\n", ret);
-   return ret;
+   return  dev_err_probe(dev, PTR_ERR(pinfo->pp33_gpio),
+"failed to get pp33 
gpio\n");
}
  
  	pinfo->enable_gpio = devm_gpiod_get(dev, "enable", GPIOD_OUT_HIGH);

if (IS_ERR(pinfo->enable_gpio)) {
-   ret = PTR_ERR(pinfo->enable_gpio);
-   if (ret != -EPROBE_DEFER)
-   dev_err(dev, "failed to get enable gpio: %d\n", ret);
-   return ret;
+   return  dev_err_probe(dev, PTR_ERR(pinfo->enable_gpio),
+"failed to get enable gpio\n");
}
  
  	drm_panel_init(>base, dev, _funcs,

--
2.25.1



Re: [PATCH 2/2] drm/panel: samsung-s6d7aa0: drop DRM_BUS_FLAG_DE_HIGH for lsl080al02

2024-01-02 Thread Jessica Zhang




On 1/1/2024 1:00 PM, Artur Weber wrote:

It turns out that I had misconfigured the device I was using the panel
with; the bus data polarity is not high for this panel, I had to change
the config on the display controller's side.

Fix the panel config to properly reflect its accurate settings.

Signed-off-by: Artur Weber 


Hi Artur,

With Henrik's suggestion to add the Fixes tag,

Reviewed-by: Jessica Zhang 

Thanks,

Jessica Zhang


---
  drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c 
b/drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c
index ea5a85779382..f23d8832a1ad 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c
@@ -309,7 +309,7 @@ static const struct s6d7aa0_panel_desc 
s6d7aa0_lsl080al02_desc = {
.off_func = s6d7aa0_lsl080al02_off,
.drm_mode = _lsl080al02_mode,
.mode_flags = MIPI_DSI_MODE_VSYNC_FLUSH | MIPI_DSI_MODE_VIDEO_NO_HFP,
-   .bus_flags = DRM_BUS_FLAG_DE_HIGH,
+   .bus_flags = 0,
  
  	.has_backlight = false,

.use_passwd3 = false,

--
2.43.0



Re: [PATCH v2 2/4] drm/panel: Add driver for BOE TH101MB31IG002-28A panel

2023-12-26 Thread Jessica Zhang




On 12/23/2023 7:20 AM, Manuel Traut wrote:

From: Alexander Warnecke 

The BOE TH101MB31IG002-28A panel is a WXGA panel.
It is used in Pine64 Pinetab2 and PinetabV.

Signed-off-by: Alexander Warnecke 
Signed-off-by: Manuel Traut 
---
  drivers/gpu/drm/panel/Kconfig  |  11 +
  drivers/gpu/drm/panel/Makefile |   1 +
  .../gpu/drm/panel/panel-boe-th101mb31ig002-28a.c   | 348 +
  3 files changed, 360 insertions(+)

diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index 99e14dc212ec..927ddd10e688 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -67,6 +67,17 @@ config DRM_PANEL_BOE_HIMAX8279D
  24 bit RGB per pixel. It provides a MIPI DSI interface to
  the host and has a built-in LED backlight.
  
+config DRM_PANEL_BOE_TH101MB31UIG002_28A

+   tristate "Boe TH101MB31UIG002-28A panel"
+   depends on OF
+   depends on DRM_MIPI_DSI
+   depends on BACKLIGHT_CLASS_DEVICE
+   help
+ Say Y here if you want to enable support for Boe
+ TH101MB31UIG002-28A TFT-LCD modules. The panel has a 800x1280
+ resolution and uses 24 bit RGB per pixel. It provides a MIPI DSI
+ interface to the host and has a built-in LED backlight.
+
  config DRM_PANEL_BOE_TV101WUM_NL6
tristate "BOE TV101WUM and AUO KD101N80 45NA 1200x1920 panel"
depends on OF
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index d10c3de51c6d..dd6e1ac9d0a2 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -5,6 +5,7 @@ obj-$(CONFIG_DRM_PANEL_ASUS_Z00T_TM5P5_NT35596) += 
panel-asus-z00t-tm5p5-n35596.
  obj-$(CONFIG_DRM_PANEL_AUO_A030JTN01) += panel-auo-a030jtn01.o
  obj-$(CONFIG_DRM_PANEL_BOE_BF060Y8M_AJ0) += panel-boe-bf060y8m-aj0.o
  obj-$(CONFIG_DRM_PANEL_BOE_HIMAX8279D) += panel-boe-himax8279d.o
+obj-$(CONFIG_DRM_PANEL_BOE_TH101MB31UIG002_28A) += 
panel-boe-th101mb31ig002-28a.o
  obj-$(CONFIG_DRM_PANEL_BOE_TV101WUM_NL6) += panel-boe-tv101wum-nl6.o
  obj-$(CONFIG_DRM_PANEL_DSI_CM) += panel-dsi-cm.o
  obj-$(CONFIG_DRM_PANEL_LVDS) += panel-lvds.o
diff --git a/drivers/gpu/drm/panel/panel-boe-th101mb31ig002-28a.c 
b/drivers/gpu/drm/panel/panel-boe-th101mb31ig002-28a.c
new file mode 100644
index ..ffe4047b7434
--- /dev/null
+++ b/drivers/gpu/drm/panel/panel-boe-th101mb31ig002-28a.c
@@ -0,0 +1,348 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2023 Alexander Warnecke 
+ * Copyright (c) 2023 Manuel Traut 
+ * Copyright (c) 2023 Dang Huynh 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+struct boe_th101mb31ig002 {
+   struct drm_panel panel;
+   bool enabled;
+   bool prepared;


Hi Manuel,

Sorry, I responded to the v1 instead of the latest version. Carrying my 
comment over to here:


If I remember correctly, commit d2aacaf07395bd798373cbec6af05fff4147aff3 
should have introduced prepared/enabled do the drm_panel struct.


Thanks,

Jessica Zhang


+
+   struct mipi_dsi_device *dsi;
+
+   struct regulator *power;
+   struct gpio_desc *enable;
+   struct gpio_desc *reset;
+
+   enum drm_panel_orientation orientation;
+};
+
+static void boe_th101mb31ig002_reset(struct boe_th101mb31ig002 *ctx)
+{
+   gpiod_direction_output(ctx->reset, 0);
+   usleep_range(10, 100);
+   gpiod_direction_output(ctx->reset, 1);
+   usleep_range(10, 100);
+   gpiod_direction_output(ctx->reset, 0);
+   usleep_range(5000, 6000);
+}
+
+static int boe_th101mb31ig002_enable(struct drm_panel *panel)
+{
+   struct boe_th101mb31ig002 *ctx = container_of(panel,
+ struct boe_th101mb31ig002,
+ panel);
+   struct mipi_dsi_device *dsi = ctx->dsi;
+   struct device *dev = >dev;
+   int ret;
+
+   if (ctx->enabled)
+   return 0;
+
+   mipi_dsi_dcs_write_seq(dsi, 0xE0, 0xAB, 0xBA);
+   mipi_dsi_dcs_write_seq(dsi, 0xE1, 0xBA, 0xAB);
+   mipi_dsi_dcs_write_seq(dsi, 0xB1, 0x10, 0x01, 0x47, 0xFF);
+   mipi_dsi_dcs_write_seq(dsi, 0xB2, 0x0C, 0x14, 0x04, 0x50, 0x50, 0x14);
+   mipi_dsi_dcs_write_seq(dsi, 0xB3, 0x56, 0x53, 0x00);
+   mipi_dsi_dcs_write_seq(dsi, 0xB4, 0x33, 0x30, 0x04);
+   mipi_dsi_dcs_write_seq(dsi, 0xB6, 0xB0, 0x00, 0x00, 0x10, 0x00, 0x10,
+   0x00);
+   mipi_dsi_dcs_write_seq(dsi, 0xB8, 0x05, 0x12, 0x29, 0x49, 0x48, 0x00,
+   0x00);
+   mipi_dsi_dcs_write_seq(dsi, 0xB9, 0x7C, 0x65, 0x55, 0x49, 0x46, 0x36,
+   0x3B, 0x24, 0x3D, 0x3C, 0x3D, 0x5C, 0x4C,
+   0x55, 0x47, 0x46, 0x39, 0x26, 0x06, 0x7C,
+   0x

Re: [PATCH 2/6] drm/panel: Add driver for BOE TH101MB31IG002-28A panel

2023-12-26 Thread Jessica Zhang




On 12/22/2023 3:05 AM, Manuel Traut wrote:

From: Segfault 

The BOE TH101MB31IG002-28A panel is a WXGA panel.
It is used in Pine64 Pinetab2 and PinetabV.

Signed-off-by: Segfault 
Signed-off-by: Manuel Traut 
---
  drivers/gpu/drm/panel/Kconfig  |  11 +
  drivers/gpu/drm/panel/Makefile |   1 +
  .../gpu/drm/panel/panel-boe-th101mb31ig002-28a.c   | 307 +
  3 files changed, 319 insertions(+)

diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index 99e14dc212ec..927ddd10e688 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -67,6 +67,17 @@ config DRM_PANEL_BOE_HIMAX8279D
  24 bit RGB per pixel. It provides a MIPI DSI interface to
  the host and has a built-in LED backlight.
  
+config DRM_PANEL_BOE_TH101MB31UIG002_28A

+   tristate "Boe TH101MB31UIG002-28A panel"
+   depends on OF
+   depends on DRM_MIPI_DSI
+   depends on BACKLIGHT_CLASS_DEVICE
+   help
+ Say Y here if you want to enable support for Boe
+ TH101MB31UIG002-28A TFT-LCD modules. The panel has a 800x1280
+ resolution and uses 24 bit RGB per pixel. It provides a MIPI DSI
+ interface to the host and has a built-in LED backlight.
+
  config DRM_PANEL_BOE_TV101WUM_NL6
tristate "BOE TV101WUM and AUO KD101N80 45NA 1200x1920 panel"
depends on OF
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index d10c3de51c6d..dd6e1ac9d0a2 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -5,6 +5,7 @@ obj-$(CONFIG_DRM_PANEL_ASUS_Z00T_TM5P5_NT35596) += 
panel-asus-z00t-tm5p5-n35596.
  obj-$(CONFIG_DRM_PANEL_AUO_A030JTN01) += panel-auo-a030jtn01.o
  obj-$(CONFIG_DRM_PANEL_BOE_BF060Y8M_AJ0) += panel-boe-bf060y8m-aj0.o
  obj-$(CONFIG_DRM_PANEL_BOE_HIMAX8279D) += panel-boe-himax8279d.o
+obj-$(CONFIG_DRM_PANEL_BOE_TH101MB31UIG002_28A) += 
panel-boe-th101mb31ig002-28a.o
  obj-$(CONFIG_DRM_PANEL_BOE_TV101WUM_NL6) += panel-boe-tv101wum-nl6.o
  obj-$(CONFIG_DRM_PANEL_DSI_CM) += panel-dsi-cm.o
  obj-$(CONFIG_DRM_PANEL_LVDS) += panel-lvds.o
diff --git a/drivers/gpu/drm/panel/panel-boe-th101mb31ig002-28a.c 
b/drivers/gpu/drm/panel/panel-boe-th101mb31ig002-28a.c
new file mode 100644
index ..ac1dc99a0300
--- /dev/null
+++ b/drivers/gpu/drm/panel/panel-boe-th101mb31ig002-28a.c
@@ -0,0 +1,307 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2023 Alexander Warnecke 
+ * Copyright (c) 2023 Manuel Traut 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+struct boe_th101mb31ig002 {
+   struct drm_panel panel;
+   bool enabled;
+   bool prepared;


Hi Manuel,

If I remember correctly, commit 
d2aacaf07395bd798373cbec6af05fff4147aff3 should have introduced 
prepared/enabled do the drm_panel struct.


Thanks,

Jessica Zhang


+
+   struct mipi_dsi_device *dsi;
+
+   struct regulator *power;
+   struct gpio_desc *enable;
+   struct gpio_desc *reset;
+
+   enum drm_panel_orientation orientation;
+};
+
+static int boe_th101mb31ig002_disable(struct drm_panel *panel)
+{
+   struct boe_th101mb31ig002 *ctx = container_of(panel,
+ struct boe_th101mb31ig002,
+ panel);
+
+   if (!ctx->enabled)
+   return 0;
+
+   mipi_dsi_dcs_set_display_off(ctx->dsi);
+   msleep(120);
+   ctx->enabled = false;
+
+   return 0;
+}
+
+static int boe_th101mb31ig002_unprepare(struct drm_panel *panel)
+{
+   struct boe_th101mb31ig002 *ctx = container_of(panel,
+ struct boe_th101mb31ig002,
+ panel);
+
+   if (!ctx->prepared)
+   return 0;
+
+   mipi_dsi_dcs_enter_sleep_mode(ctx->dsi);
+   msleep(220);
+   gpiod_set_value_cansleep(ctx->reset, 1);
+   gpiod_set_value_cansleep(ctx->enable, 0);
+   regulator_disable(ctx->power);
+   ctx->prepared = false;
+
+   return 0;
+}
+
+static int boe_th101mb31ig002_prepare(struct drm_panel *panel)
+{
+   struct boe_th101mb31ig002 *ctx = container_of(panel,
+ struct boe_th101mb31ig002,
+ panel);
+   struct mipi_dsi_device *dsi = ctx->dsi;
+   int ret;
+
+   if (ctx->prepared)
+   return 0;
+
+   ret = regulator_enable(ctx->power);
+   if (ret) {
+   dev_err(>dev, "Failed to enable power supply: %d\n", ret);
+   return ret;
+   }
+
+   gpiod_set_value_cansleep(ctx->enable, 1);
+   msleep(120);
+   gpiod_direction_output(ctx->reset, 1);
+   msl

Re: [PATCH linux-next] drm/panel: Simplify with dev_err_probe()

2023-12-20 Thread Jessica Zhang




On 12/19/2023 6:48 PM, yang.gua...@zte.com.cn wrote:

From: Yang Guang 

dev_err_probe() can check if the error code is -EPROBE_DEFER
and can return the error code, replacing dev_err() with it
simplifies the code.

Signed-off-by: Chen Haonan 

Reviewed-by: Jessica Zhang 

Thanks,

Jessica Zhang


---
  drivers/gpu/drm/panel/panel-boe-himax8279d.c | 18 ++
  1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-boe-himax8279d.c 
b/drivers/gpu/drm/panel/panel-boe-himax8279d.c
index 11b64acbe8a9..e225840b0d67 100644
--- a/drivers/gpu/drm/panel/panel-boe-himax8279d.c
+++ b/drivers/gpu/drm/panel/panel-boe-himax8279d.c
@@ -854,26 +854,20 @@ static int panel_add(struct panel_info *pinfo)

pinfo->pp18_gpio = devm_gpiod_get(dev, "pp18", GPIOD_OUT_HIGH);
if (IS_ERR(pinfo->pp18_gpio)) {
-   ret = PTR_ERR(pinfo->pp18_gpio);
-   if (ret != -EPROBE_DEFER)
-   dev_err(dev, "failed to get pp18 gpio: %d\n", ret);
-   return ret;
+   return dev_err_probe(dev, PTR_ERR(pinfo->pp18_gpio),
+"failed to get pp18 
gpio\n");
}

pinfo->pp33_gpio = devm_gpiod_get(dev, "pp33", GPIOD_OUT_HIGH);
if (IS_ERR(pinfo->pp33_gpio)) {
-   ret = PTR_ERR(pinfo->pp33_gpio);
-   if (ret != -EPROBE_DEFER)
-   dev_err(dev, "failed to get pp33 gpio: %d\n", ret);
-   return ret;
+   return  dev_err_probe(dev, PTR_ERR(pinfo->pp33_gpio),
+"failed to get pp33 
gpio\n");
}

pinfo->enable_gpio = devm_gpiod_get(dev, "enable", GPIOD_OUT_HIGH);
if (IS_ERR(pinfo->enable_gpio)) {
-   ret = PTR_ERR(pinfo->enable_gpio);
-   if (ret != -EPROBE_DEFER)
-   dev_err(dev, "failed to get enable gpio: %d\n", ret);
-   return ret;
+   return  dev_err_probe(dev, PTR_ERR(pinfo->enable_gpio),
+"failed to get enable gpio\n");
}

drm_panel_init(>base, dev, _funcs,
--
2.25.1


[PATCH v4 2/2] drm/msm/dpu: Drop enable and frame_count parameters from dpu_hw_setup_misr()

2023-12-13 Thread Jessica Zhang
Drop the enable and frame_count parameters from dpu_hw_setup_misr() as they
are always set to the same values.

In addition, replace MISR_FRAME_COUNT_MASK with MISR_FRAME_COUNT as
frame_count is always set to the same value.

Fixes: 7b37523fb1d1 ("drm/msm/dpu: Move MISR methods to dpu_hw_util")
Reviewed-by: Dmitry Baryshkov 
Signed-off-by: Jessica Zhang 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c|  4 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c |  4 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c |  6 +++---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h |  4 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c   |  6 +++---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.h   |  3 ++-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c | 19 +--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h |  9 +++--
 8 files changed, 22 insertions(+), 33 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index 8ebed048a193..555182201b8e 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights 
reserved.
  * Copyright (c) 2014-2021 The Linux Foundation. All rights reserved.
  * Copyright (C) 2013 Red Hat
  * Author: Rob Clark 
@@ -114,7 +114,7 @@ static void dpu_crtc_setup_lm_misr(struct dpu_crtc_state 
*crtc_state)
continue;
 
/* Calculate MISR over 1 frame */
-   m->hw_lm->ops.setup_misr(m->hw_lm, true, 1);
+   m->hw_lm->ops.setup_misr(m->hw_lm);
}
 }
 
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
index aa1a1646b322..1d8eb3b509b4 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
@@ -2,7 +2,7 @@
 /*
  * Copyright (C) 2013 Red Hat
  * Copyright (c) 2014-2018, 2020-2021 The Linux Foundation. All rights 
reserved.
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights 
reserved.
  *
  * Author: Rob Clark 
  */
@@ -258,7 +258,7 @@ void dpu_encoder_setup_misr(const struct drm_encoder 
*drm_enc)
if (!phys->hw_intf || !phys->hw_intf->ops.setup_misr)
continue;
 
-   phys->hw_intf->ops.setup_misr(phys->hw_intf, true, 1);
+   phys->hw_intf->ops.setup_misr(phys->hw_intf);
}
 }
 
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
index 226133af7840..6bba531d6dc4 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights 
reserved.
  * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
  */
 
@@ -320,9 +320,9 @@ static u32 dpu_hw_intf_get_line_count(struct dpu_hw_intf 
*intf)
return DPU_REG_READ(c, INTF_LINE_COUNT);
 }
 
-static void dpu_hw_intf_setup_misr(struct dpu_hw_intf *intf, bool enable, u32 
frame_count)
+static void dpu_hw_intf_setup_misr(struct dpu_hw_intf *intf)
 {
-   dpu_hw_setup_misr(>hw, INTF_MISR_CTRL, enable, frame_count, 0x1);
+   dpu_hw_setup_misr(>hw, INTF_MISR_CTRL, 0x1);
 }
 
 static int dpu_hw_intf_collect_misr(struct dpu_hw_intf *intf, u32 *misr_value)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h
index 215401bb042e..0bd57a32144a 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights 
reserved.
  * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
  */
 
@@ -95,7 +95,7 @@ struct dpu_hw_intf_ops {
 
void (*bind_pingpong_blk)(struct dpu_hw_intf *intf,
const enum dpu_pingpong pp);
-   void (*setup_misr)(struct dpu_hw_intf *intf, bool enable, u32 
frame_count);
+   void (*setup_misr)(struct dpu_hw_intf *intf);
int (*collect_misr)(struct dpu_hw_intf *intf, u32 *misr_value);
 
// Tearcheck on INTF since DPU 5.0.0
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c
index bbc9756ecde9..1d3ccf3228c6 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c
@@ -1,6 +1,6 @

[PATCH v4 1/2] drm/msm/dpu: Set input_sel bit for INTF

2023-12-13 Thread Jessica Zhang
Set the input_sel bit for encoders as it was missed in the initial
implementation.

Reported-by: Rob Clark 
Closes: https://gitlab.freedesktop.org/drm/msm/-/issues/39
Fixes: 91143873a05d ("drm/msm/dpu: Add MISR register support for interface")
Signed-off-by: Jessica Zhang 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 2 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c   | 2 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c | 9 +++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h | 3 ++-
 4 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
index 0b6a0a7dcc39..226133af7840 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
@@ -322,7 +322,7 @@ static u32 dpu_hw_intf_get_line_count(struct dpu_hw_intf 
*intf)
 
 static void dpu_hw_intf_setup_misr(struct dpu_hw_intf *intf, bool enable, u32 
frame_count)
 {
-   dpu_hw_setup_misr(>hw, INTF_MISR_CTRL, enable, frame_count);
+   dpu_hw_setup_misr(>hw, INTF_MISR_CTRL, enable, frame_count, 0x1);
 }
 
 static int dpu_hw_intf_collect_misr(struct dpu_hw_intf *intf, u32 *misr_value)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c
index 25af52ab602f..bbc9756ecde9 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c
@@ -85,7 +85,7 @@ static void dpu_hw_lm_setup_border_color(struct dpu_hw_mixer 
*ctx,
 
 static void dpu_hw_lm_setup_misr(struct dpu_hw_mixer *ctx, bool enable, u32 
frame_count)
 {
-   dpu_hw_setup_misr(>hw, LM_MISR_CTRL, enable, frame_count);
+   dpu_hw_setup_misr(>hw, LM_MISR_CTRL, enable, frame_count, 0x0);
 }
 
 static int dpu_hw_lm_collect_misr(struct dpu_hw_mixer *ctx, u32 *misr_value)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c
index 0b05061e3e62..6752cfe62481 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c
@@ -475,9 +475,13 @@ void _dpu_hw_setup_qos_lut(struct dpu_hw_blk_reg_map *c, 
u32 offset,
  cfg->danger_safe_en ? QOS_QOS_CTRL_DANGER_SAFE_EN : 0);
 }
 
+/*
+ * note: Aside from encoders, input_sel should be set to 0x0 by default
+ */
 void dpu_hw_setup_misr(struct dpu_hw_blk_reg_map *c,
u32 misr_ctrl_offset,
-   bool enable, u32 frame_count)
+   bool enable, u32 frame_count,
+   u8 input_sel)
 {
u32 config = 0;
 
@@ -488,7 +492,8 @@ void dpu_hw_setup_misr(struct dpu_hw_blk_reg_map *c,
 
if (enable) {
config = (frame_count & MISR_FRAME_COUNT_MASK) |
-   MISR_CTRL_ENABLE | MISR_CTRL_FREE_RUN_MASK;
+   MISR_CTRL_ENABLE | MISR_CTRL_FREE_RUN_MASK |
+   ((input_sel & 0xF) << 24);
 
DPU_REG_WRITE(c, misr_ctrl_offset, config);
} else {
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h
index fe083b2e5696..cd0fa1d0984e 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h
@@ -357,7 +357,8 @@ void _dpu_hw_setup_qos_lut(struct dpu_hw_blk_reg_map *c, 
u32 offset,
 void dpu_hw_setup_misr(struct dpu_hw_blk_reg_map *c,
u32 misr_ctrl_offset,
bool enable,
-   u32 frame_count);
+   u32 frame_count,
+   u8 input_sel);
 
 int dpu_hw_collect_misr(struct dpu_hw_blk_reg_map *c,
u32 misr_ctrl_offset,

-- 
2.43.0



[PATCH v4 0/2] drm/msm/dpu: INTF CRC configuration cleanups and fix

2023-12-13 Thread Jessica Zhang
This series drops the frame_count and enable parameters (as they're always
set to the same value). It also sets input_sel=0x1 for INTF.

---
Changes in v4:
- Moved comment about input_sel to outside of dpu_hw_setup_misr()
- Link to v3: 
https://lore.kernel.org/r/20231213-encoder-fixup-v3-0-b5cd2cda6...@quicinc.com

Changes in v3:
- Changed input_sel to u8
- Link to v2: 
https://lore.kernel.org/r/20231213-encoder-fixup-v2-0-b11a4ad35...@quicinc.com

Changes in v2:
- Switched patch order
- Changed input_sel parameter from bool to u8
- Link to v1: 
https://lore.kernel.org/r/20231130-encoder-fixup-v1-0-585c54cd0...@quicinc.com

---
Jessica Zhang (2):
  drm/msm/dpu: Set input_sel bit for INTF
  drm/msm/dpu: Drop enable and frame_count parameters from 
dpu_hw_setup_misr()

 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c|  4 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c |  4 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c |  6 +++---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h |  4 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c   |  6 +++---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.h   |  3 ++-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c | 20 
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h |  8 +++-
 8 files changed, 25 insertions(+), 30 deletions(-)
---
base-commit: 0d9372c346d4cdf347354382e0659de8c1cc0236
change-id: 20231122-encoder-fixup-61c190b16085

Best regards,
-- 
Jessica Zhang 



Re: [PATCH v2 1/2] drm/msm/dpu: Set input_sel bit for INTF

2023-12-13 Thread Jessica Zhang




On 12/13/2023 1:20 PM, Dmitry Baryshkov wrote:

On Wed, 13 Dec 2023 at 22:51, Jessica Zhang  wrote:


Set the input_sel bit for encoders as it was missed in the initial
implementation.

Reported-by: Rob Clark 
Closes: https://gitlab.freedesktop.org/drm/msm/-/issues/39
Fixes: 91143873a05d ("drm/msm/dpu: Add MISR register support for interface")
Signed-off-by: Jessica Zhang 
---
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c |  2 +-
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c   |  2 +-
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c | 10 --
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h |  3 ++-
  4 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
index 0b6a0a7dcc39..226133af7840 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
@@ -322,7 +322,7 @@ static u32 dpu_hw_intf_get_line_count(struct dpu_hw_intf 
*intf)

  static void dpu_hw_intf_setup_misr(struct dpu_hw_intf *intf, bool enable, u32 
frame_count)
  {
-   dpu_hw_setup_misr(>hw, INTF_MISR_CTRL, enable, frame_count);
+   dpu_hw_setup_misr(>hw, INTF_MISR_CTRL, enable, frame_count, 0x1);
  }

  static int dpu_hw_intf_collect_misr(struct dpu_hw_intf *intf, u32 *misr_value)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c
index 25af52ab602f..bbc9756ecde9 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c
@@ -85,7 +85,7 @@ static void dpu_hw_lm_setup_border_color(struct dpu_hw_mixer 
*ctx,

  static void dpu_hw_lm_setup_misr(struct dpu_hw_mixer *ctx, bool enable, u32 
frame_count)
  {
-   dpu_hw_setup_misr(>hw, LM_MISR_CTRL, enable, frame_count);
+   dpu_hw_setup_misr(>hw, LM_MISR_CTRL, enable, frame_count, 0x0);
  }

  static int dpu_hw_lm_collect_misr(struct dpu_hw_mixer *ctx, u32 *misr_value)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c
index 0b05061e3e62..87716a60332e 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c
@@ -477,7 +477,8 @@ void _dpu_hw_setup_qos_lut(struct dpu_hw_blk_reg_map *c, 
u32 offset,

  void dpu_hw_setup_misr(struct dpu_hw_blk_reg_map *c,
 u32 misr_ctrl_offset,
-   bool enable, u32 frame_count)
+   bool enable, u32 frame_count,
+   u32 input_sel)
  {
 u32 config = 0;

@@ -487,8 +488,13 @@ void dpu_hw_setup_misr(struct dpu_hw_blk_reg_map *c,
 wmb();

 if (enable) {
+   /*
+* note: Aside from encoders, input_sel should be
+* set to 0x0 by default
+*/


Even if it is not a proper kernedoc, please move this comment before
the function.


Acked.




 config = (frame_count & MISR_FRAME_COUNT_MASK) |
-   MISR_CTRL_ENABLE | MISR_CTRL_FREE_RUN_MASK;
+   MISR_CTRL_ENABLE | MISR_CTRL_FREE_RUN_MASK |
+   ((input_sel & 0xF) << 24);

 DPU_REG_WRITE(c, misr_ctrl_offset, config);
 } else {
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h
index fe083b2e5696..761056be272b 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h
@@ -357,7 +357,8 @@ void _dpu_hw_setup_qos_lut(struct dpu_hw_blk_reg_map *c, 
u32 offset,
  void dpu_hw_setup_misr(struct dpu_hw_blk_reg_map *c,
 u32 misr_ctrl_offset,
 bool enable,
-   u32 frame_count);
+   u32 frame_count,
+   u32 input_sel);

  int dpu_hw_collect_misr(struct dpu_hw_blk_reg_map *c,
 u32 misr_ctrl_offset,

--
2.43.0




--
With best wishes
Dmitry


[PATCH v3 1/2] drm/msm/dpu: Set input_sel bit for INTF

2023-12-13 Thread Jessica Zhang
Set the input_sel bit for encoders as it was missed in the initial
implementation.

Reported-by: Rob Clark 
Closes: https://gitlab.freedesktop.org/drm/msm/-/issues/39
Fixes: 91143873a05d ("drm/msm/dpu: Add MISR register support for interface")
Signed-off-by: Jessica Zhang 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c |  2 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c   |  2 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c | 10 --
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h |  3 ++-
 4 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
index 0b6a0a7dcc39..226133af7840 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
@@ -322,7 +322,7 @@ static u32 dpu_hw_intf_get_line_count(struct dpu_hw_intf 
*intf)
 
 static void dpu_hw_intf_setup_misr(struct dpu_hw_intf *intf, bool enable, u32 
frame_count)
 {
-   dpu_hw_setup_misr(>hw, INTF_MISR_CTRL, enable, frame_count);
+   dpu_hw_setup_misr(>hw, INTF_MISR_CTRL, enable, frame_count, 0x1);
 }
 
 static int dpu_hw_intf_collect_misr(struct dpu_hw_intf *intf, u32 *misr_value)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c
index 25af52ab602f..bbc9756ecde9 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c
@@ -85,7 +85,7 @@ static void dpu_hw_lm_setup_border_color(struct dpu_hw_mixer 
*ctx,
 
 static void dpu_hw_lm_setup_misr(struct dpu_hw_mixer *ctx, bool enable, u32 
frame_count)
 {
-   dpu_hw_setup_misr(>hw, LM_MISR_CTRL, enable, frame_count);
+   dpu_hw_setup_misr(>hw, LM_MISR_CTRL, enable, frame_count, 0x0);
 }
 
 static int dpu_hw_lm_collect_misr(struct dpu_hw_mixer *ctx, u32 *misr_value)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c
index 0b05061e3e62..9a882ba2ab17 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c
@@ -477,7 +477,8 @@ void _dpu_hw_setup_qos_lut(struct dpu_hw_blk_reg_map *c, 
u32 offset,
 
 void dpu_hw_setup_misr(struct dpu_hw_blk_reg_map *c,
u32 misr_ctrl_offset,
-   bool enable, u32 frame_count)
+   bool enable, u32 frame_count,
+   u8 input_sel)
 {
u32 config = 0;
 
@@ -487,8 +488,13 @@ void dpu_hw_setup_misr(struct dpu_hw_blk_reg_map *c,
wmb();
 
if (enable) {
+   /*
+* note: Aside from encoders, input_sel should be
+* set to 0x0 by default
+*/
config = (frame_count & MISR_FRAME_COUNT_MASK) |
-   MISR_CTRL_ENABLE | MISR_CTRL_FREE_RUN_MASK;
+   MISR_CTRL_ENABLE | MISR_CTRL_FREE_RUN_MASK |
+   ((input_sel & 0xF) << 24);
 
DPU_REG_WRITE(c, misr_ctrl_offset, config);
} else {
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h
index fe083b2e5696..cd0fa1d0984e 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h
@@ -357,7 +357,8 @@ void _dpu_hw_setup_qos_lut(struct dpu_hw_blk_reg_map *c, 
u32 offset,
 void dpu_hw_setup_misr(struct dpu_hw_blk_reg_map *c,
u32 misr_ctrl_offset,
bool enable,
-   u32 frame_count);
+   u32 frame_count,
+   u8 input_sel);
 
 int dpu_hw_collect_misr(struct dpu_hw_blk_reg_map *c,
u32 misr_ctrl_offset,

-- 
2.43.0



[PATCH v3 0/2] drm/msm/dpu: INTF CRC configuration cleanups and fix

2023-12-13 Thread Jessica Zhang
This series drops the frame_count and enable parameters (as they're always
set to the same value). It also sets input_sel=0x1 for INTF.

---
Changes in v3:
- Changed input_sel to u8
- Link to v2: 
https://lore.kernel.org/r/20231213-encoder-fixup-v2-0-b11a4ad35...@quicinc.com

Changes in v2:
- Switched patch order
- Changed input_sel parameter from bool to u8
- Link to v1: 
https://lore.kernel.org/r/20231130-encoder-fixup-v1-0-585c54cd0...@quicinc.com

---
Jessica Zhang (2):
  drm/msm/dpu: Set input_sel bit for INTF
  drm/msm/dpu: Drop enable and frame_count parameters from 
dpu_hw_setup_misr()

 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c|  4 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c |  4 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c |  6 +++---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h |  4 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c   |  6 +++---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.h   |  3 ++-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c | 20 
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h |  8 +++-
 8 files changed, 25 insertions(+), 30 deletions(-)
---
base-commit: 0d9372c346d4cdf347354382e0659de8c1cc0236
change-id: 20231122-encoder-fixup-61c190b16085

Best regards,
-- 
Jessica Zhang 



[PATCH v3 2/2] drm/msm/dpu: Drop enable and frame_count parameters from dpu_hw_setup_misr()

2023-12-13 Thread Jessica Zhang
Drop the enable and frame_count parameters from dpu_hw_setup_misr() as they
are always set to the same values.

In addition, replace MISR_FRAME_COUNT_MASK with MISR_FRAME_COUNT as
frame_count is always set to the same value.

Fixes: 7b37523fb1d1 ("drm/msm/dpu: Move MISR methods to dpu_hw_util")
Reviewed-by: Dmitry Baryshkov 
Signed-off-by: Jessica Zhang 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c|  4 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c |  4 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c |  6 +++---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h |  4 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c   |  6 +++---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.h   |  3 ++-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c | 26 --
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h |  9 +++--
 8 files changed, 25 insertions(+), 37 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index 8ebed048a193..555182201b8e 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights 
reserved.
  * Copyright (c) 2014-2021 The Linux Foundation. All rights reserved.
  * Copyright (C) 2013 Red Hat
  * Author: Rob Clark 
@@ -114,7 +114,7 @@ static void dpu_crtc_setup_lm_misr(struct dpu_crtc_state 
*crtc_state)
continue;
 
/* Calculate MISR over 1 frame */
-   m->hw_lm->ops.setup_misr(m->hw_lm, true, 1);
+   m->hw_lm->ops.setup_misr(m->hw_lm);
}
 }
 
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
index aa1a1646b322..1d8eb3b509b4 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
@@ -2,7 +2,7 @@
 /*
  * Copyright (C) 2013 Red Hat
  * Copyright (c) 2014-2018, 2020-2021 The Linux Foundation. All rights 
reserved.
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights 
reserved.
  *
  * Author: Rob Clark 
  */
@@ -258,7 +258,7 @@ void dpu_encoder_setup_misr(const struct drm_encoder 
*drm_enc)
if (!phys->hw_intf || !phys->hw_intf->ops.setup_misr)
continue;
 
-   phys->hw_intf->ops.setup_misr(phys->hw_intf, true, 1);
+   phys->hw_intf->ops.setup_misr(phys->hw_intf);
}
 }
 
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
index 226133af7840..6bba531d6dc4 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights 
reserved.
  * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
  */
 
@@ -320,9 +320,9 @@ static u32 dpu_hw_intf_get_line_count(struct dpu_hw_intf 
*intf)
return DPU_REG_READ(c, INTF_LINE_COUNT);
 }
 
-static void dpu_hw_intf_setup_misr(struct dpu_hw_intf *intf, bool enable, u32 
frame_count)
+static void dpu_hw_intf_setup_misr(struct dpu_hw_intf *intf)
 {
-   dpu_hw_setup_misr(>hw, INTF_MISR_CTRL, enable, frame_count, 0x1);
+   dpu_hw_setup_misr(>hw, INTF_MISR_CTRL, 0x1);
 }
 
 static int dpu_hw_intf_collect_misr(struct dpu_hw_intf *intf, u32 *misr_value)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h
index 215401bb042e..0bd57a32144a 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights 
reserved.
  * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
  */
 
@@ -95,7 +95,7 @@ struct dpu_hw_intf_ops {
 
void (*bind_pingpong_blk)(struct dpu_hw_intf *intf,
const enum dpu_pingpong pp);
-   void (*setup_misr)(struct dpu_hw_intf *intf, bool enable, u32 
frame_count);
+   void (*setup_misr)(struct dpu_hw_intf *intf);
int (*collect_misr)(struct dpu_hw_intf *intf, u32 *misr_value);
 
// Tearcheck on INTF since DPU 5.0.0
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c
index bbc9756ecde9..1d3ccf3228c6 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_l

Re: [PATCH v2 2/2] drm/msm/dpu: Drop enable and frame_count parameters from dpu_hw_setup_misr()

2023-12-13 Thread Jessica Zhang




On 12/13/2023 1:00 PM, Abhinav Kumar wrote:



On 12/13/2023 12:51 PM, Jessica Zhang wrote:
Drop the enable and frame_count parameters from dpu_hw_setup_misr() as 
they

are always set to the same values.

In addition, replace MISR_FRAME_COUNT_MASK with MISR_FRAME_COUNT as
frame_count is always set to the same value.

Fixes: 7b37523fb1d1 ("drm/msm/dpu: Move MISR methods to dpu_hw_util")
Reviewed-by: Dmitry Baryshkov 
Signed-off-by: Jessica Zhang 
---
  drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c    |  4 ++--
  drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c |  4 ++--
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c |  6 +++---
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h |  4 ++--
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c   |  6 +++---
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.h   |  3 ++-
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c | 26 
--

  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h |  9 +++--
  8 files changed, 25 insertions(+), 37 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c

index 8ebed048a193..555182201b8e 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -1,6 +1,6 @@
  // SPDX-License-Identifier: GPL-2.0-only
  /*
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights 
reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All 
rights reserved.

   * Copyright (c) 2014-2021 The Linux Foundation. All rights reserved.
   * Copyright (C) 2013 Red Hat
   * Author: Rob Clark 
@@ -114,7 +114,7 @@ static void dpu_crtc_setup_lm_misr(struct 
dpu_crtc_state *crtc_state)

  continue;
  /* Calculate MISR over 1 frame */
-    m->hw_lm->ops.setup_misr(m->hw_lm, true, 1);
+    m->hw_lm->ops.setup_misr(m->hw_lm);
  }
  }
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c

index aa1a1646b322..1d8eb3b509b4 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
@@ -2,7 +2,7 @@
  /*
   * Copyright (C) 2013 Red Hat
   * Copyright (c) 2014-2018, 2020-2021 The Linux Foundation. All 
rights reserved.
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights 
reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All 
rights reserved.

   *
   * Author: Rob Clark 
   */
@@ -258,7 +258,7 @@ void dpu_encoder_setup_misr(const struct 
drm_encoder *drm_enc)

  if (!phys->hw_intf || !phys->hw_intf->ops.setup_misr)
  continue;
-    phys->hw_intf->ops.setup_misr(phys->hw_intf, true, 1);
+    phys->hw_intf->ops.setup_misr(phys->hw_intf);
  }
  }
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c

index 226133af7840..6bba531d6dc4 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
@@ -1,6 +1,6 @@
  // SPDX-License-Identifier: GPL-2.0-only
  /*
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights 
reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All 
rights reserved.

   * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
   */
@@ -320,9 +320,9 @@ static u32 dpu_hw_intf_get_line_count(struct 
dpu_hw_intf *intf)

  return DPU_REG_READ(c, INTF_LINE_COUNT);
  }
-static void dpu_hw_intf_setup_misr(struct dpu_hw_intf *intf, bool 
enable, u32 frame_count)

+static void dpu_hw_intf_setup_misr(struct dpu_hw_intf *intf)
  {
-    dpu_hw_setup_misr(>hw, INTF_MISR_CTRL, enable, frame_count, 
0x1);

+    dpu_hw_setup_misr(>hw, INTF_MISR_CTRL, 0x1);
  }
  static int dpu_hw_intf_collect_misr(struct dpu_hw_intf *intf, u32 
*misr_value)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h

index 215401bb042e..0bd57a32144a 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h
@@ -1,6 +1,6 @@
  /* SPDX-License-Identifier: GPL-2.0-only */
  /*
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights 
reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All 
rights reserved.

   * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
   */
@@ -95,7 +95,7 @@ struct dpu_hw_intf_ops {
  void (*bind_pingpong_blk)(struct dpu_hw_intf *intf,
  const enum dpu_pingpong pp);
-    void (*setup_misr)(struct dpu_hw_intf *intf, bool enable, u32 
frame_count);

+    void (*setup_misr)(struct dpu_hw_intf *intf);
  int (*collect_misr)(struct dpu_hw_intf *intf, u32 *misr_value);
  // Tearcheck on INTF since DPU 5.0.0
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c

index bbc9756ecde9..1d3ccf3228c6 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c
+++ b/driver

[PATCH v2 2/2] drm/msm/dpu: Drop enable and frame_count parameters from dpu_hw_setup_misr()

2023-12-13 Thread Jessica Zhang
Drop the enable and frame_count parameters from dpu_hw_setup_misr() as they
are always set to the same values.

In addition, replace MISR_FRAME_COUNT_MASK with MISR_FRAME_COUNT as
frame_count is always set to the same value.

Fixes: 7b37523fb1d1 ("drm/msm/dpu: Move MISR methods to dpu_hw_util")
Reviewed-by: Dmitry Baryshkov 
Signed-off-by: Jessica Zhang 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c|  4 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c |  4 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c |  6 +++---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h |  4 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c   |  6 +++---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.h   |  3 ++-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c | 26 --
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h |  9 +++--
 8 files changed, 25 insertions(+), 37 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index 8ebed048a193..555182201b8e 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights 
reserved.
  * Copyright (c) 2014-2021 The Linux Foundation. All rights reserved.
  * Copyright (C) 2013 Red Hat
  * Author: Rob Clark 
@@ -114,7 +114,7 @@ static void dpu_crtc_setup_lm_misr(struct dpu_crtc_state 
*crtc_state)
continue;
 
/* Calculate MISR over 1 frame */
-   m->hw_lm->ops.setup_misr(m->hw_lm, true, 1);
+   m->hw_lm->ops.setup_misr(m->hw_lm);
}
 }
 
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
index aa1a1646b322..1d8eb3b509b4 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
@@ -2,7 +2,7 @@
 /*
  * Copyright (C) 2013 Red Hat
  * Copyright (c) 2014-2018, 2020-2021 The Linux Foundation. All rights 
reserved.
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights 
reserved.
  *
  * Author: Rob Clark 
  */
@@ -258,7 +258,7 @@ void dpu_encoder_setup_misr(const struct drm_encoder 
*drm_enc)
if (!phys->hw_intf || !phys->hw_intf->ops.setup_misr)
continue;
 
-   phys->hw_intf->ops.setup_misr(phys->hw_intf, true, 1);
+   phys->hw_intf->ops.setup_misr(phys->hw_intf);
}
 }
 
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
index 226133af7840..6bba531d6dc4 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights 
reserved.
  * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
  */
 
@@ -320,9 +320,9 @@ static u32 dpu_hw_intf_get_line_count(struct dpu_hw_intf 
*intf)
return DPU_REG_READ(c, INTF_LINE_COUNT);
 }
 
-static void dpu_hw_intf_setup_misr(struct dpu_hw_intf *intf, bool enable, u32 
frame_count)
+static void dpu_hw_intf_setup_misr(struct dpu_hw_intf *intf)
 {
-   dpu_hw_setup_misr(>hw, INTF_MISR_CTRL, enable, frame_count, 0x1);
+   dpu_hw_setup_misr(>hw, INTF_MISR_CTRL, 0x1);
 }
 
 static int dpu_hw_intf_collect_misr(struct dpu_hw_intf *intf, u32 *misr_value)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h
index 215401bb042e..0bd57a32144a 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights 
reserved.
  * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
  */
 
@@ -95,7 +95,7 @@ struct dpu_hw_intf_ops {
 
void (*bind_pingpong_blk)(struct dpu_hw_intf *intf,
const enum dpu_pingpong pp);
-   void (*setup_misr)(struct dpu_hw_intf *intf, bool enable, u32 
frame_count);
+   void (*setup_misr)(struct dpu_hw_intf *intf);
int (*collect_misr)(struct dpu_hw_intf *intf, u32 *misr_value);
 
// Tearcheck on INTF since DPU 5.0.0
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c
index bbc9756ecde9..1d3ccf3228c6 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_l

[PATCH v2 1/2] drm/msm/dpu: Set input_sel bit for INTF

2023-12-13 Thread Jessica Zhang
Set the input_sel bit for encoders as it was missed in the initial
implementation.

Reported-by: Rob Clark 
Closes: https://gitlab.freedesktop.org/drm/msm/-/issues/39
Fixes: 91143873a05d ("drm/msm/dpu: Add MISR register support for interface")
Signed-off-by: Jessica Zhang 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c |  2 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c   |  2 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c | 10 --
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h |  3 ++-
 4 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
index 0b6a0a7dcc39..226133af7840 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
@@ -322,7 +322,7 @@ static u32 dpu_hw_intf_get_line_count(struct dpu_hw_intf 
*intf)
 
 static void dpu_hw_intf_setup_misr(struct dpu_hw_intf *intf, bool enable, u32 
frame_count)
 {
-   dpu_hw_setup_misr(>hw, INTF_MISR_CTRL, enable, frame_count);
+   dpu_hw_setup_misr(>hw, INTF_MISR_CTRL, enable, frame_count, 0x1);
 }
 
 static int dpu_hw_intf_collect_misr(struct dpu_hw_intf *intf, u32 *misr_value)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c
index 25af52ab602f..bbc9756ecde9 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c
@@ -85,7 +85,7 @@ static void dpu_hw_lm_setup_border_color(struct dpu_hw_mixer 
*ctx,
 
 static void dpu_hw_lm_setup_misr(struct dpu_hw_mixer *ctx, bool enable, u32 
frame_count)
 {
-   dpu_hw_setup_misr(>hw, LM_MISR_CTRL, enable, frame_count);
+   dpu_hw_setup_misr(>hw, LM_MISR_CTRL, enable, frame_count, 0x0);
 }
 
 static int dpu_hw_lm_collect_misr(struct dpu_hw_mixer *ctx, u32 *misr_value)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c
index 0b05061e3e62..87716a60332e 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c
@@ -477,7 +477,8 @@ void _dpu_hw_setup_qos_lut(struct dpu_hw_blk_reg_map *c, 
u32 offset,
 
 void dpu_hw_setup_misr(struct dpu_hw_blk_reg_map *c,
u32 misr_ctrl_offset,
-   bool enable, u32 frame_count)
+   bool enable, u32 frame_count,
+   u32 input_sel)
 {
u32 config = 0;
 
@@ -487,8 +488,13 @@ void dpu_hw_setup_misr(struct dpu_hw_blk_reg_map *c,
wmb();
 
if (enable) {
+   /*
+* note: Aside from encoders, input_sel should be
+* set to 0x0 by default
+*/
config = (frame_count & MISR_FRAME_COUNT_MASK) |
-   MISR_CTRL_ENABLE | MISR_CTRL_FREE_RUN_MASK;
+   MISR_CTRL_ENABLE | MISR_CTRL_FREE_RUN_MASK |
+   ((input_sel & 0xF) << 24);
 
DPU_REG_WRITE(c, misr_ctrl_offset, config);
} else {
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h
index fe083b2e5696..761056be272b 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h
@@ -357,7 +357,8 @@ void _dpu_hw_setup_qos_lut(struct dpu_hw_blk_reg_map *c, 
u32 offset,
 void dpu_hw_setup_misr(struct dpu_hw_blk_reg_map *c,
u32 misr_ctrl_offset,
bool enable,
-   u32 frame_count);
+   u32 frame_count,
+   u32 input_sel);
 
 int dpu_hw_collect_misr(struct dpu_hw_blk_reg_map *c,
u32 misr_ctrl_offset,

-- 
2.43.0



[PATCH v2 0/2] drm/msm/dpu: INTF CRC configuration cleanups and fix

2023-12-13 Thread Jessica Zhang
This series drops the frame_count and enable parameters (as they're always
set to the same value). It also sets input_sel=0x1 for INTF.

---
Changes in v2:
- Switched patch order
- Changed input_sel parameter from bool to u8
- Link to v1: 
https://lore.kernel.org/r/20231130-encoder-fixup-v1-0-585c54cd0...@quicinc.com

---
Jessica Zhang (2):
  drm/msm/dpu: Set input_sel bit for INTF
  drm/msm/dpu: Drop enable and frame_count parameters from 
dpu_hw_setup_misr()

 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c|  4 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c |  4 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c |  6 +++---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h |  4 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c   |  6 +++---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.h   |  3 ++-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c | 20 
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h |  8 +++-
 8 files changed, 25 insertions(+), 30 deletions(-)
---
base-commit: 0d9372c346d4cdf347354382e0659de8c1cc0236
change-id: 20231122-encoder-fixup-61c190b16085

Best regards,
-- 
Jessica Zhang 



Re: [PATCH 2/2] drm/msm/dpu: Set input_sel bit for INTF

2023-12-13 Thread Jessica Zhang




On 12/2/2023 11:54 AM, Dmitry Baryshkov wrote:

On 01/12/2023 23:29, Abhinav Kumar wrote:



On 11/30/2023 11:36 PM, Dmitry Baryshkov wrote:
On Fri, 1 Dec 2023 at 03:31, Jessica Zhang 
 wrote:


Set the input_sel bit for encoders as it was missed in the initial
implementation.

Reported-by: Rob Clark 
Fixes: 91143873a05d ("drm/msm/dpu: Add MISR register support for 
interface")

Closes: https://gitlab.freedesktop.org/drm/msm/-/issues/39
Signed-off-by: Jessica Zhang 
---
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 2 +-
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c   | 2 +-
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c | 7 ++-
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h | 4 +++-
  4 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c

index 3442cf65b86f..d0884997ecb7 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
@@ -320,7 +320,7 @@ static u32 dpu_hw_intf_get_line_count(struct 
dpu_hw_intf *intf)


  static void dpu_hw_intf_setup_misr(struct dpu_hw_intf *intf)
  {
-   dpu_hw_setup_misr(>hw, INTF_MISR_CTRL);
+   dpu_hw_setup_misr(>hw, INTF_MISR_CTRL, true);
  }

  static int dpu_hw_intf_collect_misr(struct dpu_hw_intf *intf, u32 
*misr_value)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c

index f38473e68f79..77b14107c84a 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c
@@ -83,7 +83,7 @@ static void dpu_hw_lm_setup_border_color(struct 
dpu_hw_mixer *ctx,


  static void dpu_hw_lm_setup_misr(struct dpu_hw_mixer *ctx)
  {
-   dpu_hw_setup_misr(>hw, LM_MISR_CTRL);
+   dpu_hw_setup_misr(>hw, LM_MISR_CTRL, false);
  }

  static int dpu_hw_lm_collect_misr(struct dpu_hw_mixer *ctx, u32 
*misr_value)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c

index a8a0a4e76b94..f441df47fdde 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c
@@ -481,7 +481,8 @@ void _dpu_hw_setup_qos_lut(struct 
dpu_hw_blk_reg_map *c, u32 offset,
   cfg->danger_safe_en ? 
QOS_QOS_CTRL_DANGER_SAFE_EN : 0);

  }

-void dpu_hw_setup_misr(struct dpu_hw_blk_reg_map *c, u32 
misr_ctrl_offset)
+void dpu_hw_setup_misr(struct dpu_hw_blk_reg_map *c, u32 
misr_ctrl_offset,

+   bool set_input_sel)
  {
 u32 config = 0;

@@ -491,6 +492,10 @@ void dpu_hw_setup_misr(struct 
dpu_hw_blk_reg_map *c, u32 misr_ctrl_offset)

 wmb();

 config = MISR_FRAME_COUNT | MISR_CTRL_ENABLE | 
MISR_CTRL_FREE_RUN_MASK;

+
+   if (set_input_sel)
+   config |= MISR_CTRL_INPUT_SEL;
+
 DPU_REG_WRITE(c, misr_ctrl_offset, config);
  }

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h

index bb496ebe283b..793670d62414 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h
@@ -17,6 +17,7 @@
  #define MISR_CTRL_ENABLE    BIT(8)
  #define MISR_CTRL_STATUS    BIT(9)
  #define MISR_CTRL_STATUS_CLEAR  BIT(10)
+#define MISR_CTRL_INPUT_SEL BIT(24)


The public apq8916 TRM documents this as a 4-bit field. I think this
was followed into the later generations. Can we please document it
correctly and use an uint instead of just bool for set_input_sel?



Can you pls point us to this document you are referring?


I have this link in my bookmarks, which doesn't seem to work no longer:

https://developer.qualcomm.com/download/sd410/snapdragon-410e-technical-reference-manual.pdf?referrer=node/29241

96boards forum has several links and mentions of this doc.



I was not aware that bit level details are revealed in external 
documents :)


Even though its a 4-bit field, it only takes a 0 or 1 as others are 
undefined.


Exposing all the bits will only cause more confusion like it did for 
others thinking that input select is actually configurable when its not.


I think what we should do is just pass "misr_type" to this API to tell 
whether its lm misr or intf misr and set BIT(24) based on that.


This would be another simplification. Can we instead just use values 0 
and 1 instead and maybe document that by default everybody should use 0.


Hi Dmitry,

Acked. Will change the input_sel parameter to a u8 and add a note that 
it should be 0x0 by default with an exception for encoders.


Thanks,

Jessica Zhang







  #define MISR_CTRL_FREE_RUN_MASK BIT(31)

  /*
@@ -357,7 +358,8 @@ void _dpu_hw_setup_qos_lut(struct 
dpu_hw_blk_reg_map *c, u32 offset,

    bool qos_8lvl,
    const struct dpu_hw_qos_cfg *cfg);

-void dpu_hw_setup_misr(struct dpu_hw_blk_reg_map *c, u32 
misr_ctrl_offs

Re: [PATCH] drm/panel: ltk050h3146w: Set burst mode for ltk050h3148w

2023-12-13 Thread Jessica Zhang




On 12/13/2023 6:50 AM, Farouk Bouabid wrote:

The ltk050h3148w variant expects the horizontal component lane byte clock
cycle(lbcc) to be calculated using lane_mbps (burst mode) instead of the
pixel clock.
Using the pixel clock rate by default for this calculation was introduced
in commit ac87d23694f4 ("drm/bridge: synopsys: dw-mipi-dsi: Use pixel clock
rate to calculate lbcc") and starting from commit 93e82bb4de01
("drm/bridge: synopsys: dw-mipi-dsi: Fix hcomponent lbcc for burst mode")
only panels that support burst mode can keep using the lane_mbps. So add
MIPI_DSI_MODE_VIDEO_BURST as part of the mode_flags for the dsi host.

Fixes: 93e82bb4de01 ("drm/bridge: synopsys: dw-mipi-dsi: Fix hcomponent lbcc for 
burst mode")
Signed-off-by: Farouk Bouabid 


Reviewed-by: Jessica Zhang 

Thanks,

Jessica Zhang


---
  drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c 
b/drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c
index 6e3670508e3a..30919c872ac8 100644
--- a/drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c
+++ b/drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c
@@ -326,7 +326,7 @@ static const struct drm_display_mode ltk050h3148w_mode = {
  static const struct ltk050h3146w_desc ltk050h3148w_data = {
.mode = _mode,
.init = ltk050h3148w_init_sequence,
-   .mode_flags = MIPI_DSI_MODE_VIDEO_SYNC_PULSE,
+   .mode_flags = MIPI_DSI_MODE_VIDEO_SYNC_PULSE | 
MIPI_DSI_MODE_VIDEO_BURST,
  };
  
  static int ltk050h3146w_init_sequence(struct ltk050h3146w *ctx)

--
2.34.1



Re: [Freedreno] [PATCH 0/2] drm/msm/dpu: INTF CRC configuration cleanups and fix

2023-12-12 Thread Jessica Zhang




On 11/30/2023 11:39 PM, Dmitry Baryshkov wrote:

On Fri, 1 Dec 2023 at 03:31, Jessica Zhang  wrote:


This series drops the frame_count and enable parameters (as they're always
set to the same value). It also sets input_sel=0x1 for INTF.

Signed-off-by: Jessica Zhang 
---
Jessica Zhang (2):
   drm/msm/dpu: Drop enable and frame_count parameters from 
dpu_hw_setup_misr()
   drm/msm/dpu: Set input_sel bit for INTF


Please change the order of the commits: fix (input_sel) comes first,
then comes the improvement.
Otherwise if one needs to backport this fix, they either need to pick
up the irrelevant patch, or they have to rework the fix.


Acked.

Thanks,

Jessica Zhang





  drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c|  4 ++--
  drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c |  4 ++--
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c |  6 +++---
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h |  4 ++--
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c   |  6 +++---
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.h   |  3 ++-
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c | 18 +++---
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h | 11 +--
  8 files changed, 26 insertions(+), 30 deletions(-)
---
base-commit: 4047f50eb64d980fcd581a19bbe6164dab25ebc7
change-id: 20231122-encoder-fixup-61c190b16085

Best regards,
--
Jessica Zhang 




--
With best wishes
Dmitry


Re: [PATCH v2] dt-bindings: panel-simple-dsi: move LG 5" HD TFT LCD panel into DSI yaml

2023-12-12 Thread Jessica Zhang




On 12/12/2023 12:09 PM, David Heidelberg wrote:

Originally was in the panel-simple, but belongs to panel-simple-dsi.

See arch/arm/boot/dts/nvidia/tegra114-roth.dts for more details.

Resolves the following warning:
```
arch/arm/boot/dts/tegra114-roth.dt.yaml: panel@0: 'reg' does not match any of 
the regexes: 'pinctrl-[0-9]+'
 From schema: 
Documentation/devicetree/bindings/display/panel/panel-simple.yaml
```

Fixes: 310abcea76e9 ("dt-bindings: display: convert simple lg panels to DT 
Schema")
Signed-off-by: David Heidelberg 


Acked-by: Jessica Zhang 


---
v2: added Fixes tag (thx to Jessica)

  .../devicetree/bindings/display/panel/panel-simple-dsi.yaml | 2 ++
  .../devicetree/bindings/display/panel/panel-simple.yaml | 2 --
  2 files changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml 
b/Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml
index 73674baea75d..f9160d7bac3c 100644
--- a/Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml
+++ b/Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml
@@ -42,6 +42,8 @@ properties:
- lg,acx467akm-7
  # LG Corporation 7" WXGA TFT LCD panel
- lg,ld070wx3-sl01
+# LG Corporation 5" HD TFT LCD panel
+  - lg,lh500wx1-sd03
  # One Stop Displays OSD101T2587-53TS 10.1" 1920x1200 panel
- osddisplays,osd101t2587-53ts
  # Panasonic 10" WUXGA TFT LCD panel
diff --git a/Documentation/devicetree/bindings/display/panel/panel-simple.yaml 
b/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
index 2021aa82871a..634a10c6f2dd 100644
--- a/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
+++ b/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
@@ -212,8 +212,6 @@ properties:
- lemaker,bl035-rgb-002
  # LG 7" (800x480 pixels) TFT LCD panel
- lg,lb070wv8
-# LG Corporation 5" HD TFT LCD panel
-  - lg,lh500wx1-sd03
  # LG LP079QX1-SP0V 7.9" (1536x2048 pixels) TFT LCD panel
- lg,lp079qx1-sp0v
  # LG 9.7" (2048x1536 pixels) TFT LCD panel
--
2.43.0



Re: [PATCH] dt-bindings: panel-simple-dsi: move LG 5" HD TFT LCD panel into DSI yaml

2023-12-12 Thread Jessica Zhang




On 12/12/2023 9:53 AM, David Heidelberg wrote:

Originally was in the panel-simple, but belongs to panel-simple-dsi.

See arch/arm/boot/dts/nvidia/tegra114-roth.dts for more details.

Fixes:
```
arch/arm/boot/dts/tegra114-roth.dt.yaml: panel@0: 'reg' does not match any of 
the regexes: 'pinctrl-[0-9]+'
 From schema: 
Documentation/devicetree/bindings/display/panel/panel-simple.yaml
```


Hi David,

Would "Fixes: 310abcea76e9 ("dt-bindings: display: convert simple lg 
panels to DT Schema")" be appropriate here?


Thanks,

Jessica Zhang



Signed-off-by: David Heidelberg 
---
  .../devicetree/bindings/display/panel/panel-simple-dsi.yaml | 2 ++
  .../devicetree/bindings/display/panel/panel-simple.yaml | 2 --
  2 files changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml 
b/Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml
index 73674baea75d..f9160d7bac3c 100644
--- a/Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml
+++ b/Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml
@@ -42,6 +42,8 @@ properties:
- lg,acx467akm-7
  # LG Corporation 7" WXGA TFT LCD panel
- lg,ld070wx3-sl01
+# LG Corporation 5" HD TFT LCD panel
+  - lg,lh500wx1-sd03
  # One Stop Displays OSD101T2587-53TS 10.1" 1920x1200 panel
- osddisplays,osd101t2587-53ts
  # Panasonic 10" WUXGA TFT LCD panel
diff --git a/Documentation/devicetree/bindings/display/panel/panel-simple.yaml 
b/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
index 2021aa82871a..634a10c6f2dd 100644
--- a/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
+++ b/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
@@ -212,8 +212,6 @@ properties:
- lemaker,bl035-rgb-002
  # LG 7" (800x480 pixels) TFT LCD panel
- lg,lb070wv8
-# LG Corporation 5" HD TFT LCD panel
-  - lg,lh500wx1-sd03
  # LG LP079QX1-SP0V 7.9" (1536x2048 pixels) TFT LCD panel
- lg,lp079qx1-sp0v
  # LG 9.7" (2048x1536 pixels) TFT LCD panel
--
2.43.0



Re: [PATCH v2 2/6] drm/msm/dsi: set video mode widebus enable bit when widebus is enabled

2023-12-07 Thread Jessica Zhang




On 11/14/2023 2:58 PM, Jonathan Marek wrote:

The value returned by msm_dsi_wide_bus_enabled() doesn't match what the
driver is doing in video mode. Fix that by actually enabling widebus for
video mode.

Fixes: efcbd6f9cdeb ("drm/msm/dsi: Enable widebus for DSI")
Signed-off-by: Jonathan Marek 
---
  drivers/gpu/drm/msm/dsi/dsi.xml.h  | 1 +
  drivers/gpu/drm/msm/dsi/dsi_host.c | 2 ++
  2 files changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/msm/dsi/dsi.xml.h 
b/drivers/gpu/drm/msm/dsi/dsi.xml.h
index 2a7d980e12c3..f0b3cdc020a1 100644
--- a/drivers/gpu/drm/msm/dsi/dsi.xml.h
+++ b/drivers/gpu/drm/msm/dsi/dsi.xml.h
@@ -231,6 +231,7 @@ static inline uint32_t DSI_VID_CFG0_TRAFFIC_MODE(enum 
dsi_traffic_mode val)
  #define DSI_VID_CFG0_HSA_POWER_STOP   0x0001
  #define DSI_VID_CFG0_HBP_POWER_STOP   0x0010
  #define DSI_VID_CFG0_HFP_POWER_STOP   0x0100
+#define DSI_VID_CFG0_DATABUS_WIDEN 0x0200
  #define DSI_VID_CFG0_PULSE_MODE_HSA_HE
0x1000
  
  #define REG_DSI_VID_CFG1	0x001c

diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c 
b/drivers/gpu/drm/msm/dsi/dsi_host.c
index deeecdfd6c4e..f2c1cbd08d4d 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -745,6 +745,8 @@ static void dsi_ctrl_enable(struct msm_dsi_host *msm_host,
data |= DSI_VID_CFG0_TRAFFIC_MODE(dsi_get_traffic_mode(flags));
data |= DSI_VID_CFG0_DST_FORMAT(dsi_get_vid_fmt(mipi_fmt));
data |= DSI_VID_CFG0_VIRT_CHANNEL(msm_host->channel);
+   if (msm_dsi_host_is_wide_bus_enabled(_host->base))
+   data |= DSI_VID_CFG0_DATABUS_WIDEN;


Hi Jonathan,

Now that widebus is enabled for video mode, I think you can also drop 
the TODO here [1]. Other than that, this LGTM.


Reviewed-by: Jessica Zhang 

Thanks,

Jessica Zhang

[1] 
https://elixir.bootlin.com/linux/v6.7-rc3/source/drivers/gpu/drm/msm/dsi/dsi_host.c#L772



dsi_write(msm_host, REG_DSI_VID_CFG0, data);
  
  		/* Do not swap RGB colors */

--
2.26.1



Re: [PATCH v2 5/6] drm/msm/dsi: support DSC configurations with slice_per_pkt > 1

2023-12-07 Thread Jessica Zhang




On 11/14/2023 2:58 PM, Jonathan Marek wrote:

Add a dsc_slice_per_pkt field to mipi_dsi_device struct and the necessary
changes to msm driver to support this field.

Note that the removed "pkt_per_line = slice_per_intf * slice_per_pkt"
comment is incorrect.


Hi John,

Thanks for catching the typo.



Signed-off-by: Jonathan Marek 
---
  drivers/gpu/drm/msm/dsi/dsi_host.c | 25 ++---
  include/drm/drm_mipi_dsi.h |  1 +
  2 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c 
b/drivers/gpu/drm/msm/dsi/dsi_host.c
index 842765063b1b..892a463a7e03 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -161,6 +161,7 @@ struct msm_dsi_host {
  
  	struct drm_display_mode *mode;

struct drm_dsc_config *dsc;
+   unsigned int dsc_slice_per_pkt;
  
  	/* connected device info */

unsigned int channel;
@@ -857,17 +858,10 @@ static void dsi_update_dsc_timing(struct msm_dsi_host 
*msm_host, bool is_cmd_mod
slice_per_intf = msm_dsc_get_slices_per_intf(dsc, hdisplay);
  
  	total_bytes_per_intf = dsc->slice_chunk_size * slice_per_intf;

-   bytes_per_pkt = dsc->slice_chunk_size; /* * slice_per_pkt; */
+   bytes_per_pkt = dsc->slice_chunk_size * msm_host->dsc_slice_per_pkt;
  
  	eol_byte_num = total_bytes_per_intf % 3;

-
-   /*
-* Typically, pkt_per_line = slice_per_intf * slice_per_pkt.
-*
-* Since the current driver only supports slice_per_pkt = 1,
-* pkt_per_line will be equal to slice per intf for now.
-*/
-   pkt_per_line = slice_per_intf;
+   pkt_per_line = slice_per_intf / msm_host->dsc_slice_per_pkt;
  
  	if (is_cmd_mode) /* packet data type */

reg = 
DSI_COMMAND_COMPRESSION_MODE_CTRL_STREAM0_DATATYPE(MIPI_DSI_DCS_LONG_WRITE);
@@ -1004,12 +998,8 @@ static void dsi_timing_setup(struct msm_dsi_host 
*msm_host, bool is_bonded_dsi)
else
/*
 * When DSC is enabled, WC = slice_chunk_size * 
slice_per_pkt + 1.
-* Currently, the driver only supports default value of 
slice_per_pkt = 1
-*
-* TODO: Expand mipi_dsi_device struct to hold 
slice_per_pkt info
-*   and adjust DSC math to account for 
slice_per_pkt.
 */
-   wc = msm_host->dsc->slice_chunk_size + 1;
+   wc = msm_host->dsc->slice_chunk_size * 
msm_host->dsc_slice_per_pkt + 1;


Maybe we can reuse bytes_per_pkt here.

  
  		dsi_write(msm_host, REG_DSI_CMD_MDP_STREAM0_CTRL,

DSI_CMD_MDP_STREAM0_CTRL_WORD_COUNT(wc) |
@@ -1636,8 +1626,13 @@ static int dsi_host_attach(struct mipi_dsi_host *host,
msm_host->lanes = dsi->lanes;
msm_host->format = dsi->format;
msm_host->mode_flags = dsi->mode_flags;
-   if (dsi->dsc)
+   if (dsi->dsc) {
msm_host->dsc = dsi->dsc;
+   msm_host->dsc_slice_per_pkt = dsi->dsc_slice_per_pkt;
+   /* for backwards compatibility, assume 1 if not set */
+   if (!msm_host->dsc_slice_per_pkt)
+   msm_host->dsc_slice_per_pkt = 1;
+   }
  
  	/* Some gpios defined in panel DT need to be controlled by host */

ret = dsi_host_init_panel_gpios(msm_host, >dev);
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index c9df0407980c..3e32fa52d94b 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -193,6 +193,7 @@ struct mipi_dsi_device {
unsigned long hs_rate;
unsigned long lp_rate;
struct drm_dsc_config *dsc;


Any reason for not putting this in drm_dsc_config?

Thanks,

Jessica Zhang


+   unsigned int dsc_slice_per_pkt;
  };
  
  #define MIPI_DSI_MODULE_PREFIX "mipi-dsi:"

--
2.26.1



Re: [PATCH v3 08/13] drm/msm/dpu: remove QoS teardown on plane destruction

2023-12-01 Thread Jessica Zhang




On 7/29/2023 6:19 PM, Dmitry Baryshkov wrote:

There is little point in disabling QoS on plane destruction: it happens
during DPU device destruction process, after which there will be no
running planes.

Signed-off-by: Dmitry Baryshkov 


Reviewed-by: Jessica Zhang 


---
  drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 7 ---
  1 file changed, 7 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
index aba5185e1d66..f114efee1b57 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
@@ -1173,17 +1173,10 @@ static void dpu_plane_atomic_update(struct drm_plane 
*plane,
  static void dpu_plane_destroy(struct drm_plane *plane)
  {
struct dpu_plane *pdpu = plane ? to_dpu_plane(plane) : NULL;
-   struct dpu_plane_state *pstate;
  
  	DPU_DEBUG_PLANE(pdpu, "\n");
  
  	if (pdpu) {

-   pstate = to_dpu_plane_state(plane->state);
-   _dpu_plane_set_qos_ctrl(plane, >pipe, false);
-
-   if (pstate->r_pipe.sspp)
-   _dpu_plane_set_qos_ctrl(plane, >r_pipe, false);
-
/* this will destroy the states as well */
drm_plane_cleanup(plane);
  
--

2.39.2



Re: [PATCH v3 13/13] drm/msm/dpu: use drmm-managed allocation for dpu_encoder_virt

2023-12-01 Thread Jessica Zhang




On 7/29/2023 6:19 PM, Dmitry Baryshkov wrote:

It is incorrect to use devm-managed memory allocations for DRM data
structures exposed to userspace. They should use drmm_ allocations.
Change struct dpu_encoder allocation to use drmm_encoder_alloc(). This
removes the need to perform any actions on encoder destruction.

Signed-off-by: Dmitry Baryshkov 


Reviewed-by: Jessica Zhang 


---
  drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 50 +
  1 file changed, 10 insertions(+), 40 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
index 2b94ff3d08a1..6d9ec3ac065c 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
@@ -443,23 +443,6 @@ int dpu_encoder_get_linecount(struct drm_encoder *drm_enc)
return linecount;
  }
  
-static void dpu_encoder_destroy(struct drm_encoder *drm_enc)

-{
-   struct dpu_encoder_virt *dpu_enc = NULL;
-   int i = 0;
-
-   if (!drm_enc) {
-   DPU_ERROR("invalid encoder\n");
-   return;
-   }
-
-   dpu_enc = to_dpu_encoder_virt(drm_enc);
-   DPU_DEBUG_ENC(dpu_enc, "\n");
-
-   drm_encoder_cleanup(drm_enc);
-   mutex_destroy(_enc->enc_lock);
-}
-
  void dpu_encoder_helper_split_config(
struct dpu_encoder_phys *phys_enc,
enum dpu_intf interface)
@@ -2381,7 +2364,6 @@ static const struct drm_encoder_helper_funcs 
dpu_encoder_helper_funcs = {
  };
  
  static const struct drm_encoder_funcs dpu_encoder_funcs = {

-   .destroy = dpu_encoder_destroy,
.late_register = dpu_encoder_late_register,
.early_unregister = dpu_encoder_early_unregister,
  };
@@ -2392,20 +2374,13 @@ struct drm_encoder *dpu_encoder_init(struct drm_device 
*dev,
  {
struct msm_drm_private *priv = dev->dev_private;
struct dpu_kms *dpu_kms = to_dpu_kms(priv->kms);
-   struct drm_encoder *drm_enc = NULL;
-   struct dpu_encoder_virt *dpu_enc = NULL;
-   int ret = 0;
+   struct dpu_encoder_virt *dpu_enc;
+   int ret;
  
-	dpu_enc = devm_kzalloc(dev->dev, sizeof(*dpu_enc), GFP_KERNEL);

-   if (!dpu_enc)
-   return ERR_PTR(-ENOMEM);
-
-   ret = drm_encoder_init(dev, _enc->base, _encoder_funcs,
-  drm_enc_mode, NULL);
-   if (ret) {
-   devm_kfree(dev->dev, dpu_enc);
-   return ERR_PTR(ret);
-   }
+   dpu_enc = drmm_encoder_alloc(dev, struct dpu_encoder_virt, base,
+_encoder_funcs, drm_enc_mode, NULL);
+   if (IS_ERR(dpu_enc))
+   return ERR_CAST(dpu_enc);
  
  	drm_encoder_helper_add(_enc->base, _encoder_helper_funcs);
  
@@ -2415,8 +2390,10 @@ struct drm_encoder *dpu_encoder_init(struct drm_device *dev,

mutex_init(_enc->rc_lock);
  
  	ret = dpu_encoder_setup_display(dpu_enc, dpu_kms, disp_info);

-   if (ret)
-   goto fail;
+   if (ret) {
+   DPU_ERROR("failed to setup encoder\n");
+   return ERR_PTR(-ENOMEM);
+   }
  
  	atomic_set(_enc->frame_done_timeout_ms, 0);

timer_setup(_enc->frame_done_timer,
@@ -2442,13 +2419,6 @@ struct drm_encoder *dpu_encoder_init(struct drm_device 
*dev,
DPU_DEBUG_ENC(dpu_enc, "created\n");
  
  	return _enc->base;

-
-fail:
-   DPU_ERROR("failed to create encoder\n");
-   if (drm_enc)
-   dpu_encoder_destroy(drm_enc);
-
-   return ERR_PTR(ret);
  }
  
  int dpu_encoder_wait_for_event(struct drm_encoder *drm_enc,

--
2.39.2



Re: [Freedreno] [PATCH v3 01/13] drm/msm/dpu: cleanup dpu_kms_hw_init error path

2023-12-01 Thread Jessica Zhang




On 7/29/2023 6:19 PM, Dmitry Baryshkov wrote:

It was noticed that dpu_kms_hw_init()'s error path contains several
labels which point to the same code path. Replace all of them with a
single label.

Suggested-by: Konrad Dybcio 
Signed-off-by: Dmitry Baryshkov 


Reviewed-by: Jessica Zhang 


---
  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 21 +
  1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index 31782a6d821f..77a79bc42492 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -1077,7 +1077,7 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
if (!dpu_kms->catalog) {
DPU_ERROR("device config not known!\n");
rc = -EINVAL;
-   goto power_error;
+   goto err_pm_put;
}
  
  	/*

@@ -1087,13 +1087,13 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
rc = _dpu_kms_mmu_init(dpu_kms);
if (rc) {
DPU_ERROR("dpu_kms_mmu_init failed: %d\n", rc);
-   goto power_error;
+   goto err_pm_put;
}
  
  	rc = dpu_rm_init(_kms->rm, dpu_kms->catalog, dpu_kms->mmio);

if (rc) {
DPU_ERROR("rm init failed: %d\n", rc);
-   goto power_error;
+   goto err_pm_put;
}
  
  	dpu_kms->rm_init = true;

@@ -1105,7 +1105,7 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
rc = PTR_ERR(dpu_kms->hw_mdp);
DPU_ERROR("failed to get hw_mdp: %d\n", rc);
dpu_kms->hw_mdp = NULL;
-   goto power_error;
+   goto err_pm_put;
}
  
  	for (i = 0; i < dpu_kms->catalog->vbif_count; i++) {

@@ -1116,7 +1116,7 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
if (IS_ERR(hw)) {
rc = PTR_ERR(hw);
DPU_ERROR("failed to init vbif %d: %d\n", vbif->id, rc);
-   goto power_error;
+   goto err_pm_put;
}
  
  		dpu_kms->hw_vbif[vbif->id] = hw;

@@ -1132,7 +1132,7 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
rc = dpu_core_perf_init(_kms->perf, dpu_kms->catalog->perf, 
max_core_clk_rate);
if (rc) {
DPU_ERROR("failed to init perf %d\n", rc);
-   goto perf_err;
+   goto err_pm_put;
}
  
  	dpu_kms->hw_intr = dpu_hw_intr_init(dpu_kms->mmio, dpu_kms->catalog);

@@ -1140,7 +1140,7 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
rc = PTR_ERR(dpu_kms->hw_intr);
DPU_ERROR("hw_intr init failed: %d\n", rc);
dpu_kms->hw_intr = NULL;
-   goto hw_intr_init_err;
+   goto err_pm_put;
}
  
  	dev->mode_config.min_width = 0;

@@ -1165,7 +1165,7 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
rc = _dpu_kms_drm_obj_init(dpu_kms);
if (rc) {
DPU_ERROR("modeset init failed: %d\n", rc);
-   goto drm_obj_init_err;
+   goto err_pm_put;
}
  
  	dpu_vbif_init_memtypes(dpu_kms);

@@ -1174,10 +1174,7 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
  
  	return 0;
  
-drm_obj_init_err:

-hw_intr_init_err:
-perf_err:
-power_error:
+err_pm_put:
pm_runtime_put_sync(_kms->pdev->dev);
  error:
_dpu_kms_hw_destroy(dpu_kms);
--
2.39.2



Re: [PATCH v3 05/13] drm/msm/dpu: use devres-managed allocation for MDP TOP

2023-12-01 Thread Jessica Zhang




On 8/16/2023 12:27 AM, Dmitry Baryshkov wrote:

Hi Jessica,

On Tue, 15 Aug 2023 at 23:17, Jessica Zhang  wrote:




On 7/29/2023 6:19 PM, Dmitry Baryshkov wrote:

Use devm_kzalloc to create MDP TOP structure. This allows us to remove
corresponding kfree and drop dpu_hw_mdp_destroy() function.

Signed-off-by: Dmitry Baryshkov 
---
   drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c | 17 +++--
   drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.h |  8 +---
   drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c|  5 ++---
   3 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c
index cff48763ce25..481b373d9ccb 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c
@@ -2,6 +2,8 @@
   /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
*/

+#include 


Hi Dmitry,

Is it possible to put this #include in a common header? Since it seems
that this is a common change for a lot of patches in this series.


I personally do not like putting unused includes into common headers.
Each file should contain includes that are used by the particular file
only. Header should include only the files required to process
definitions in this header.


Acked. In that case, the rest of this LGTM:

Reviewed-by: Jessica Zhang 

Thanks,

Jessica Zhang





Thanks,

Jessica Zhang


+
   #include "dpu_hwio.h"
   #include "dpu_hw_catalog.h"
   #include "dpu_hw_top.h"
@@ -268,16 +270,17 @@ static void _setup_mdp_ops(struct dpu_hw_mdp_ops *ops,
   ops->intf_audio_select = dpu_hw_intf_audio_select;
   }

-struct dpu_hw_mdp *dpu_hw_mdptop_init(const struct dpu_mdp_cfg *cfg,
- void __iomem *addr,
- const struct dpu_mdss_cfg *m)
+struct dpu_hw_mdp *dpu_hw_mdptop_init(struct drm_device *dev,
+   const struct dpu_mdp_cfg *cfg,
+   void __iomem *addr,
+   const struct dpu_mdss_cfg *m)
   {
   struct dpu_hw_mdp *mdp;

   if (!addr)
   return ERR_PTR(-EINVAL);

- mdp = kzalloc(sizeof(*mdp), GFP_KERNEL);
+ mdp = drmm_kzalloc(dev, sizeof(*mdp), GFP_KERNEL);
   if (!mdp)
   return ERR_PTR(-ENOMEM);

@@ -292,9 +295,3 @@ struct dpu_hw_mdp *dpu_hw_mdptop_init(const struct 
dpu_mdp_cfg *cfg,

   return mdp;
   }
-
-void dpu_hw_mdp_destroy(struct dpu_hw_mdp *mdp)
-{
- kfree(mdp);
-}
-
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.h
index 8b1463d2b2f0..6f3dc98087df 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.h
@@ -145,13 +145,15 @@ struct dpu_hw_mdp {

   /**
* dpu_hw_mdptop_init - initializes the top driver for the passed config
+ * @dev:  Corresponding device for devres management
* @cfg:  MDP TOP configuration from catalog
* @addr: Mapped register io address of MDP
* @m:Pointer to mdss catalog data
*/
-struct dpu_hw_mdp *dpu_hw_mdptop_init(const struct dpu_mdp_cfg *cfg,
- void __iomem *addr,
- const struct dpu_mdss_cfg *m);
+struct dpu_hw_mdp *dpu_hw_mdptop_init(struct drm_device *dev,
+   const struct dpu_mdp_cfg *cfg,
+   void __iomem *addr,
+   const struct dpu_mdss_cfg *m);

   void dpu_hw_mdp_destroy(struct dpu_hw_mdp *mdp);

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index 6e0643ea4868..d4f4cb402663 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -820,8 +820,6 @@ static void _dpu_kms_hw_destroy(struct dpu_kms *dpu_kms)

   dpu_kms->catalog = NULL;

- if (dpu_kms->hw_mdp)
- dpu_hw_mdp_destroy(dpu_kms->hw_mdp);
   dpu_kms->hw_mdp = NULL;
   }

@@ -1091,7 +1089,8 @@ static int dpu_kms_hw_init(struct msm_kms *kms)

   dpu_kms->rm_init = true;

- dpu_kms->hw_mdp = dpu_hw_mdptop_init(dpu_kms->catalog->mdp,
+ dpu_kms->hw_mdp = dpu_hw_mdptop_init(dev,
+  dpu_kms->catalog->mdp,
dpu_kms->mmio,
dpu_kms->catalog);
   if (IS_ERR(dpu_kms->hw_mdp)) {
--
2.39.2





--
With best wishes
Dmitry


[PATCH 2/2] drm/msm/dpu: Set input_sel bit for INTF

2023-11-30 Thread Jessica Zhang
Set the input_sel bit for encoders as it was missed in the initial
implementation.

Reported-by: Rob Clark 
Fixes: 91143873a05d ("drm/msm/dpu: Add MISR register support for interface")
Closes: https://gitlab.freedesktop.org/drm/msm/-/issues/39
Signed-off-by: Jessica Zhang 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 2 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c   | 2 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c | 7 ++-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h | 4 +++-
 4 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
index 3442cf65b86f..d0884997ecb7 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
@@ -320,7 +320,7 @@ static u32 dpu_hw_intf_get_line_count(struct dpu_hw_intf 
*intf)
 
 static void dpu_hw_intf_setup_misr(struct dpu_hw_intf *intf)
 {
-   dpu_hw_setup_misr(>hw, INTF_MISR_CTRL);
+   dpu_hw_setup_misr(>hw, INTF_MISR_CTRL, true);
 }
 
 static int dpu_hw_intf_collect_misr(struct dpu_hw_intf *intf, u32 *misr_value)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c
index f38473e68f79..77b14107c84a 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c
@@ -83,7 +83,7 @@ static void dpu_hw_lm_setup_border_color(struct dpu_hw_mixer 
*ctx,
 
 static void dpu_hw_lm_setup_misr(struct dpu_hw_mixer *ctx)
 {
-   dpu_hw_setup_misr(>hw, LM_MISR_CTRL);
+   dpu_hw_setup_misr(>hw, LM_MISR_CTRL, false);
 }
 
 static int dpu_hw_lm_collect_misr(struct dpu_hw_mixer *ctx, u32 *misr_value)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c
index a8a0a4e76b94..f441df47fdde 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c
@@ -481,7 +481,8 @@ void _dpu_hw_setup_qos_lut(struct dpu_hw_blk_reg_map *c, 
u32 offset,
  cfg->danger_safe_en ? QOS_QOS_CTRL_DANGER_SAFE_EN : 0);
 }
 
-void dpu_hw_setup_misr(struct dpu_hw_blk_reg_map *c, u32 misr_ctrl_offset)
+void dpu_hw_setup_misr(struct dpu_hw_blk_reg_map *c, u32 misr_ctrl_offset,
+   bool set_input_sel)
 {
u32 config = 0;
 
@@ -491,6 +492,10 @@ void dpu_hw_setup_misr(struct dpu_hw_blk_reg_map *c, u32 
misr_ctrl_offset)
wmb();
 
config = MISR_FRAME_COUNT | MISR_CTRL_ENABLE | MISR_CTRL_FREE_RUN_MASK;
+
+   if (set_input_sel)
+   config |= MISR_CTRL_INPUT_SEL;
+
DPU_REG_WRITE(c, misr_ctrl_offset, config);
 }
 
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h
index bb496ebe283b..793670d62414 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h
@@ -17,6 +17,7 @@
 #define MISR_CTRL_ENABLEBIT(8)
 #define MISR_CTRL_STATUSBIT(9)
 #define MISR_CTRL_STATUS_CLEAR  BIT(10)
+#define MISR_CTRL_INPUT_SEL BIT(24)
 #define MISR_CTRL_FREE_RUN_MASK BIT(31)
 
 /*
@@ -357,7 +358,8 @@ void _dpu_hw_setup_qos_lut(struct dpu_hw_blk_reg_map *c, 
u32 offset,
   bool qos_8lvl,
   const struct dpu_hw_qos_cfg *cfg);
 
-void dpu_hw_setup_misr(struct dpu_hw_blk_reg_map *c, u32 misr_ctrl_offset);
+void dpu_hw_setup_misr(struct dpu_hw_blk_reg_map *c, u32 misr_ctrl_offset,
+  bool set_input_sel);
 
 int dpu_hw_collect_misr(struct dpu_hw_blk_reg_map *c,
u32 misr_ctrl_offset,

-- 
2.43.0



[PATCH 1/2] drm/msm/dpu: Drop enable and frame_count parameters from dpu_hw_setup_misr()

2023-11-30 Thread Jessica Zhang
Drop the enable and frame_count parameters from dpu_hw_setup_misr() as they
are always set to the same values.

In addition, replace MISR_FRAME_COUNT_MASK with MISR_FRAME_COUNT as
frame_count is always set to the same value.

Fixes: 7b37523fb1d1 ("drm/msm/dpu: Move MISR methods to dpu_hw_util")
Signed-off-by: Jessica Zhang 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c|  4 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c |  4 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c |  6 +++---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h |  4 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c   |  6 +++---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.h   |  3 ++-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c | 17 -
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h |  9 +++--
 8 files changed, 21 insertions(+), 32 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index 2b83a13b3aa9..79f2b69429c8 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights 
reserved.
  * Copyright (c) 2014-2021 The Linux Foundation. All rights reserved.
  * Copyright (C) 2013 Red Hat
  * Author: Rob Clark 
@@ -125,7 +125,7 @@ static void dpu_crtc_setup_lm_misr(struct dpu_crtc_state 
*crtc_state)
continue;
 
/* Calculate MISR over 1 frame */
-   m->hw_lm->ops.setup_misr(m->hw_lm, true, 1);
+   m->hw_lm->ops.setup_misr(m->hw_lm);
}
 }
 
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
index 1cf7ff6caff4..5dbb5d27bbea 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
@@ -2,7 +2,7 @@
 /*
  * Copyright (C) 2013 Red Hat
  * Copyright (c) 2014-2018, 2020-2021 The Linux Foundation. All rights 
reserved.
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights 
reserved.
  *
  * Author: Rob Clark 
  */
@@ -255,7 +255,7 @@ void dpu_encoder_setup_misr(const struct drm_encoder 
*drm_enc)
if (!phys->hw_intf || !phys->hw_intf->ops.setup_misr)
continue;
 
-   phys->hw_intf->ops.setup_misr(phys->hw_intf, true, 1);
+   phys->hw_intf->ops.setup_misr(phys->hw_intf);
}
 }
 
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
index e8b8908d3e12..3442cf65b86f 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights 
reserved.
  * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
  */
 
@@ -318,9 +318,9 @@ static u32 dpu_hw_intf_get_line_count(struct dpu_hw_intf 
*intf)
return DPU_REG_READ(c, INTF_LINE_COUNT);
 }
 
-static void dpu_hw_intf_setup_misr(struct dpu_hw_intf *intf, bool enable, u32 
frame_count)
+static void dpu_hw_intf_setup_misr(struct dpu_hw_intf *intf)
 {
-   dpu_hw_setup_misr(>hw, INTF_MISR_CTRL, enable, frame_count);
+   dpu_hw_setup_misr(>hw, INTF_MISR_CTRL);
 }
 
 static int dpu_hw_intf_collect_misr(struct dpu_hw_intf *intf, u32 *misr_value)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h
index c539025c418b..66a5603dc7ed 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights 
reserved.
  * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
  */
 
@@ -95,7 +95,7 @@ struct dpu_hw_intf_ops {
 
void (*bind_pingpong_blk)(struct dpu_hw_intf *intf,
const enum dpu_pingpong pp);
-   void (*setup_misr)(struct dpu_hw_intf *intf, bool enable, u32 
frame_count);
+   void (*setup_misr)(struct dpu_hw_intf *intf);
int (*collect_misr)(struct dpu_hw_intf *intf, u32 *misr_value);
 
// Tearcheck on INTF since DPU 5.0.0
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c
index d1c3bd8379ea..f38473e68f79 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-on

[PATCH 0/2] drm/msm/dpu: INTF CRC configuration cleanups and fix

2023-11-30 Thread Jessica Zhang
This series drops the frame_count and enable parameters (as they're always
set to the same value). It also sets input_sel=0x1 for INTF.

Signed-off-by: Jessica Zhang 
---
Jessica Zhang (2):
  drm/msm/dpu: Drop enable and frame_count parameters from 
dpu_hw_setup_misr()
  drm/msm/dpu: Set input_sel bit for INTF

 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c|  4 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c |  4 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c |  6 +++---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h |  4 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c   |  6 +++---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.h   |  3 ++-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c | 18 +++---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h | 11 +--
 8 files changed, 26 insertions(+), 30 deletions(-)
---
base-commit: 4047f50eb64d980fcd581a19bbe6164dab25ebc7
change-id: 20231122-encoder-fixup-61c190b16085

Best regards,
-- 
Jessica Zhang 



Re: [PATCH V2 2/5] drm/panel-elida-kd35t133: hold panel in reset for unprepare

2023-11-17 Thread Jessica Zhang




On 11/17/2023 11:44 AM, Chris Morgan wrote:

From: Chris Morgan 

For devices like the Anbernic RG351M and RG351P the panel is wired to
an always on regulator. When the device suspends and wakes up, there
are some slight artifacts on the screen that go away over time. If
instead we hold the panel in reset status after it is unprepared,
this does not happen.

Fixes: 5b6603360c12 ("drm/panel: add panel driver for Elida KD35T133 panels")
Signed-off-by: Chris Morgan 


Reviewed-by: Jessica Zhang 


---
  drivers/gpu/drm/panel/panel-elida-kd35t133.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-elida-kd35t133.c 
b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
index 6cd8536c09ff..f1fc4a26f447 100644
--- a/drivers/gpu/drm/panel/panel-elida-kd35t133.c
+++ b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
@@ -104,6 +104,8 @@ static int kd35t133_unprepare(struct drm_panel *panel)
return ret;
}
  
+	gpiod_set_value_cansleep(ctx->reset_gpio, 1);

+
regulator_disable(ctx->iovcc);
regulator_disable(ctx->vdd);
  
--

2.34.1



Re: [PATCH 2/4] drm/panel-elida-kd35t133: hold panel in reset for unprepare

2023-11-16 Thread Jessica Zhang




On 11/16/2023 7:17 AM, Chris Morgan wrote:

On Wed, Nov 15, 2023 at 01:38:11PM -0800, Jessica Zhang wrote:



On 11/15/2023 7:26 AM, Chris Morgan wrote:

From: Chris Morgan 

For devices like the Anbernic RG351M and RG351P the panel is wired to
an always on regulator. When the device suspends and wakes up, there
are some slight artifacts on the screen that go away over time. If
instead we hold the panel in reset status after it is unprepared,
this does not happen.


Hi Chris,

LGTM, though if this is fixing something maybe we can add

Fixes: 5b6603360c12 ("drm/panel: add panel driver for Elida KD35T133
panels")


It *may* fix an intermittent issue with the panel resuming from
suspend, but it really more solves an issue with devices for which
we're still adding support.

Should I still tag it as a "fixes" then?


From my understanding of the submitting patches docs [1], I think this 
warrants a "Fixes" since it's fixing an issue you're seeing with the 
original driver.


Thanks,

Jessica Zhang

[1] 
https://docs.kernel.org/process/submitting-patches.html#using-reported-by-tested-by-reviewed-by-suggested-by-and-fixes




Thank you.





Signed-off-by: Chris Morgan 


Reviewed-by: Jessica Zhang 

Thanks,

Jessica Zhang


---
   drivers/gpu/drm/panel/panel-elida-kd35t133.c | 2 ++
   1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-elida-kd35t133.c 
b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
index 6cd8536c09ff..f1fc4a26f447 100644
--- a/drivers/gpu/drm/panel/panel-elida-kd35t133.c
+++ b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
@@ -104,6 +104,8 @@ static int kd35t133_unprepare(struct drm_panel *panel)
return ret;
}
+   gpiod_set_value_cansleep(ctx->reset_gpio, 1);
+
regulator_disable(ctx->iovcc);
regulator_disable(ctx->vdd);
--
2.34.1



Re: [PATCH V3 3/6] nv3051d: Add Powkiddy RK2023 Panel Support

2023-11-15 Thread Jessica Zhang




On 11/15/2023 4:17 PM, Chris Morgan wrote:

From: Chris Morgan 

Refactor the driver to add support for the powkiddy,rk2023-panel
panel. This panel is extremely similar to the rg353p-panel but
requires a smaller vertical back porch and isn't as tolerant of
higher speeds. Note that while all of these panels are identical in
size (70x57) it is possible future panels may not be.

Tested on my RG351V, RG353P, RG353V, and RK2023.

Signed-off-by: Chris Morgan 


Reviewed-by: Jessica Zhang 


---
  .../gpu/drm/panel/panel-newvision-nv3051d.c   | 55 +++
  1 file changed, 44 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-newvision-nv3051d.c 
b/drivers/gpu/drm/panel/panel-newvision-nv3051d.c
index c44c6945662f..94d89ffd596b 100644
--- a/drivers/gpu/drm/panel/panel-newvision-nv3051d.c
+++ b/drivers/gpu/drm/panel/panel-newvision-nv3051d.c
@@ -28,6 +28,7 @@ struct nv3051d_panel_info {
unsigned int num_modes;
u16 width_mm, height_mm;
u32 bus_flags;
+   u32 mode_flags;
  };
  
  struct panel_nv3051d {

@@ -387,15 +388,7 @@ static int panel_nv3051d_probe(struct mipi_dsi_device *dsi)
  
  	dsi->lanes = 4;

dsi->format = MIPI_DSI_FMT_RGB888;
-   dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
- MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_NO_EOT_PACKET;
-
-   /*
-* The panel in the RG351V is identical to the 353P, except it
-* requires MIPI_DSI_CLOCK_NON_CONTINUOUS to operate correctly.
-*/
-   if (of_device_is_compatible(dev->of_node, "anbernic,rg351v-panel"))
-   dsi->mode_flags |= MIPI_DSI_CLOCK_NON_CONTINUOUS;
+   dsi->mode_flags = ctx->panel_info->mode_flags;
  
  	drm_panel_init(>panel, >dev, _nv3051d_funcs,

   DRM_MODE_CONNECTOR_DSI);
@@ -483,16 +476,56 @@ static const struct drm_display_mode 
nv3051d_rgxx3_modes[] = {
},
  };
  
-static const struct nv3051d_panel_info nv3051d_rgxx3_info = {

+static const struct drm_display_mode nv3051d_rk2023_modes[] = {
+   {
+   .hdisplay   = 640,
+   .hsync_start= 640 + 40,
+   .hsync_end  = 640 + 40 + 2,
+   .htotal = 640 + 40 + 2 + 80,
+   .vdisplay   = 480,
+   .vsync_start= 480 + 18,
+   .vsync_end  = 480 + 18 + 2,
+   .vtotal = 480 + 18 + 2 + 4,
+   .clock  = 24150,
+   .flags  = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
+   },
+};
+
+static const struct nv3051d_panel_info nv3051d_rg351v_info = {
.display_modes = nv3051d_rgxx3_modes,
.num_modes = ARRAY_SIZE(nv3051d_rgxx3_modes),
.width_mm = 70,
.height_mm = 57,
.bus_flags = DRM_BUS_FLAG_DE_LOW | DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE,
+   .mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
+ MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_NO_EOT_PACKET |
+ MIPI_DSI_CLOCK_NON_CONTINUOUS,
+};
+
+static const struct nv3051d_panel_info nv3051d_rg353p_info = {
+   .display_modes = nv3051d_rgxx3_modes,
+   .num_modes = ARRAY_SIZE(nv3051d_rgxx3_modes),
+   .width_mm = 70,
+   .height_mm = 57,
+   .bus_flags = DRM_BUS_FLAG_DE_LOW | DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE,
+   .mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
+ MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_NO_EOT_PACKET,
+};
+
+static const struct nv3051d_panel_info nv3051d_rk2023_info = {
+   .display_modes = nv3051d_rk2023_modes,
+   .num_modes = ARRAY_SIZE(nv3051d_rk2023_modes),
+   .width_mm = 70,
+   .height_mm = 57,
+   .bus_flags = DRM_BUS_FLAG_DE_LOW | DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE,
+   .mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
+ MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_NO_EOT_PACKET,
  };
  
  static const struct of_device_id newvision_nv3051d_of_match[] = {

-   { .compatible = "newvision,nv3051d", .data = _rgxx3_info },
+   { .compatible = "anbernic,rg351v-panel", .data = _rg351v_info },
+   { .compatible = "anbernic,rg353p-panel", .data = _rg353p_info },
+   { .compatible = "powkiddy,rk2023-panel", .data = _rk2023_info },
{ /* sentinel */ }
  };
  MODULE_DEVICE_TABLE(of, newvision_nv3051d_of_match);
--
2.34.1



Re: [PATCH V3 2/6] drm/panel: nv3051d: Hold panel in reset for unprepare

2023-11-15 Thread Jessica Zhang




On 11/15/2023 4:17 PM, Chris Morgan wrote:

From: Chris Morgan 

Improve the panel's ability to restore from suspend by holding the
panel in suspend after unprepare.

Fixes: b1d39f0f4264 ("drm/panel: Add NewVision NV3051D MIPI-DSI LCD panel")
Signed-off-by: Chris Morgan 


Thanks!

Reviewed-by: Jessica Zhang 


---
  drivers/gpu/drm/panel/panel-newvision-nv3051d.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-newvision-nv3051d.c 
b/drivers/gpu/drm/panel/panel-newvision-nv3051d.c
index 79de6c886292..c44c6945662f 100644
--- a/drivers/gpu/drm/panel/panel-newvision-nv3051d.c
+++ b/drivers/gpu/drm/panel/panel-newvision-nv3051d.c
@@ -261,6 +261,8 @@ static int panel_nv3051d_unprepare(struct drm_panel *panel)
  
  	usleep_range(1, 15000);
  
+	gpiod_set_value_cansleep(ctx->reset_gpio, 1);

+
regulator_disable(ctx->vdd);
  
  	return 0;

--
2.34.1



Re: [PATCH V2 2/4] nv3051d: Add Powkiddy RK2023 Panel Support

2023-11-15 Thread Jessica Zhang




On 11/9/2023 1:50 PM, Chris Morgan wrote:

From: Chris Morgan 

Refactor the driver to add support for the powkiddy,rk2023-panel
panel. This panel is extremely similar to the rg353p-panel but
requires a smaller vertical back porch and isn't as tolerant of
higher speeds. Note that while all of these panels are identical in
size (70x57) it is possible future panels may not be.

Tested on my RG351V, RG353P, RG353V, and RK2023.

Signed-off-by: Chris Morgan 
---
  .../gpu/drm/panel/panel-newvision-nv3051d.c   | 57 +++
  1 file changed, 46 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-newvision-nv3051d.c 
b/drivers/gpu/drm/panel/panel-newvision-nv3051d.c
index 79de6c886292..94d89ffd596b 100644
--- a/drivers/gpu/drm/panel/panel-newvision-nv3051d.c
+++ b/drivers/gpu/drm/panel/panel-newvision-nv3051d.c
@@ -28,6 +28,7 @@ struct nv3051d_panel_info {
unsigned int num_modes;
u16 width_mm, height_mm;
u32 bus_flags;
+   u32 mode_flags;
  };
  
  struct panel_nv3051d {

@@ -261,6 +262,8 @@ static int panel_nv3051d_unprepare(struct drm_panel *panel)
  
  	usleep_range(1, 15000);
  
+	gpiod_set_value_cansleep(ctx->reset_gpio, 1);

+


Hi Chris,

Is this to address a suspend/resume issue similar to what was done here [1]?

If so, I think maybe this can go as a separate Fixes patch.

Thanks,

Jessica Zhang

[1] https://patchwork.freedesktop.org/patch/567670/?series=126479=1


regulator_disable(ctx->vdd);
  
  	return 0;

@@ -385,15 +388,7 @@ static int panel_nv3051d_probe(struct mipi_dsi_device *dsi)
  
  	dsi->lanes = 4;

dsi->format = MIPI_DSI_FMT_RGB888;
-   dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
- MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_NO_EOT_PACKET;
-
-   /*
-* The panel in the RG351V is identical to the 353P, except it
-* requires MIPI_DSI_CLOCK_NON_CONTINUOUS to operate correctly.
-*/
-   if (of_device_is_compatible(dev->of_node, "anbernic,rg351v-panel"))
-   dsi->mode_flags |= MIPI_DSI_CLOCK_NON_CONTINUOUS;
+   dsi->mode_flags = ctx->panel_info->mode_flags;
  
  	drm_panel_init(>panel, >dev, _nv3051d_funcs,

   DRM_MODE_CONNECTOR_DSI);
@@ -481,16 +476,56 @@ static const struct drm_display_mode 
nv3051d_rgxx3_modes[] = {
},
  };
  
-static const struct nv3051d_panel_info nv3051d_rgxx3_info = {

+static const struct drm_display_mode nv3051d_rk2023_modes[] = {
+   {
+   .hdisplay   = 640,
+   .hsync_start= 640 + 40,
+   .hsync_end  = 640 + 40 + 2,
+   .htotal = 640 + 40 + 2 + 80,
+   .vdisplay   = 480,
+   .vsync_start= 480 + 18,
+   .vsync_end  = 480 + 18 + 2,
+   .vtotal = 480 + 18 + 2 + 4,
+   .clock  = 24150,
+   .flags  = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
+   },
+};
+
+static const struct nv3051d_panel_info nv3051d_rg351v_info = {
.display_modes = nv3051d_rgxx3_modes,
.num_modes = ARRAY_SIZE(nv3051d_rgxx3_modes),
.width_mm = 70,
.height_mm = 57,
.bus_flags = DRM_BUS_FLAG_DE_LOW | DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE,
+   .mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
+ MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_NO_EOT_PACKET |
+ MIPI_DSI_CLOCK_NON_CONTINUOUS,
+};
+
+static const struct nv3051d_panel_info nv3051d_rg353p_info = {
+   .display_modes = nv3051d_rgxx3_modes,
+   .num_modes = ARRAY_SIZE(nv3051d_rgxx3_modes),
+   .width_mm = 70,
+   .height_mm = 57,
+   .bus_flags = DRM_BUS_FLAG_DE_LOW | DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE,
+   .mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
+ MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_NO_EOT_PACKET,
+};
+
+static const struct nv3051d_panel_info nv3051d_rk2023_info = {
+   .display_modes = nv3051d_rk2023_modes,
+   .num_modes = ARRAY_SIZE(nv3051d_rk2023_modes),
+   .width_mm = 70,
+   .height_mm = 57,
+   .bus_flags = DRM_BUS_FLAG_DE_LOW | DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE,
+   .mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
+ MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_NO_EOT_PACKET,
  };
  
  static const struct of_device_id newvision_nv3051d_of_match[] = {

-   { .compatible = "newvision,nv3051d", .data = _rgxx3_info },
+   { .compatible = "anbernic,rg351v-panel", .data = _rg351v_info },
+   { .compatible = "anbernic,rg353p-panel", .data = _rg353p_info },
+   { .compatible = "powkiddy,rk2023-panel", .data = _rk2023_info },
{ /* sentinel */ }
  };
  MODULE_DEVICE_TABLE(of, newvision_nv3051d_of_match);
--
2.34.1



Re: [PATCH 4/4] drm/panel-elida-kd35t133: Drop prepare/unprepare logic

2023-11-15 Thread Jessica Zhang




On 11/15/2023 7:26 AM, Chris Morgan wrote:

From: Chris Morgan 

Drop the prepare/unprepare logic, as this is now tracked elsewhere.
Additionally, the driver shutdown is also duplicate as it calls
drm_unprepare and drm_disable which are called anyway when
associated drivers are shutdown/removed.


Hi Chris,

In the commit message, can you mention that this [1] was the change that 
made tracking the prepared flag common?


Also, it seems to me that this patch squashes 2 different changes 
together. Maybe we can split this into 2 patches -- one to drop the 
prepared flag checks and another to drop shutdown().


Thanks,

Jessica Zhang

[1] d2aacaf07395 ("drm/panel: Check for already prepared/enabled in 
drm_panel")




Signed-off-by: Chris Morgan 
---
  drivers/gpu/drm/panel/panel-elida-kd35t133.c | 28 
  1 file changed, 28 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-elida-kd35t133.c 
b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
index 29b4ee63d83b..00791ea81e90 100644
--- a/drivers/gpu/drm/panel/panel-elida-kd35t133.c
+++ b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
@@ -43,7 +43,6 @@ struct kd35t133 {
struct regulator *vdd;
struct regulator *iovcc;
enum drm_panel_orientation orientation;
-   bool prepared;
  };
  
  static inline struct kd35t133 *panel_to_kd35t133(struct drm_panel *panel)

@@ -91,9 +90,6 @@ static int kd35t133_unprepare(struct drm_panel *panel)
struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
int ret;
  
-	if (!ctx->prepared)

-   return 0;
-
ret = mipi_dsi_dcs_set_display_off(dsi);
if (ret < 0)
dev_err(ctx->dev, "failed to set display off: %d\n", ret);
@@ -109,8 +105,6 @@ static int kd35t133_unprepare(struct drm_panel *panel)
regulator_disable(ctx->iovcc);
regulator_disable(ctx->vdd);
  
-	ctx->prepared = false;

-
return 0;
  }
  
@@ -120,9 +114,6 @@ static int kd35t133_prepare(struct drm_panel *panel)

struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
int ret;
  
-	if (ctx->prepared)

-   return 0;
-
dev_dbg(ctx->dev, "Resetting the panel\n");
ret = regulator_enable(ctx->vdd);
if (ret < 0) {
@@ -166,8 +157,6 @@ static int kd35t133_prepare(struct drm_panel *panel)
  
  	msleep(50);
  
-	ctx->prepared = true;

-
return 0;
  
  disable_iovcc:

@@ -296,27 +285,11 @@ static int kd35t133_probe(struct mipi_dsi_device *dsi)
return 0;
  }
  
-static void kd35t133_shutdown(struct mipi_dsi_device *dsi)

-{
-   struct kd35t133 *ctx = mipi_dsi_get_drvdata(dsi);
-   int ret;
-
-   ret = drm_panel_unprepare(>panel);
-   if (ret < 0)
-   dev_err(>dev, "Failed to unprepare panel: %d\n", ret);
-
-   ret = drm_panel_disable(>panel);
-   if (ret < 0)
-   dev_err(>dev, "Failed to disable panel: %d\n", ret);
-}
-
  static void kd35t133_remove(struct mipi_dsi_device *dsi)
  {
struct kd35t133 *ctx = mipi_dsi_get_drvdata(dsi);
int ret;
  
-	kd35t133_shutdown(dsi);

-
ret = mipi_dsi_detach(dsi);
if (ret < 0)
dev_err(>dev, "Failed to detach from DSI host: %d\n", ret);
@@ -337,7 +310,6 @@ static struct mipi_dsi_driver kd35t133_driver = {
},
.probe  = kd35t133_probe,
.remove = kd35t133_remove,
-   .shutdown = kd35t133_shutdown,
  };
  module_mipi_dsi_driver(kd35t133_driver);
  
--

2.34.1



Re: [PATCH 3/4] drm/panel-elida-kd35t133: drop drm_connector_set_orientation_from_panel

2023-11-15 Thread Jessica Zhang




On 11/15/2023 7:26 AM, Chris Morgan wrote:

From: Chris Morgan 

Stop calling drm_connector_set_orientation_from_panel() as its now
called by the panel bridge directly when it is initialized.

Signed-off-by: Chris Morgan 


Reviewed-by: Jessica Zhang 


---
  drivers/gpu/drm/panel/panel-elida-kd35t133.c | 5 -
  1 file changed, 5 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-elida-kd35t133.c 
b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
index f1fc4a26f447..29b4ee63d83b 100644
--- a/drivers/gpu/drm/panel/panel-elida-kd35t133.c
+++ b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
@@ -211,11 +211,6 @@ static int kd35t133_get_modes(struct drm_panel *panel,
connector->display_info.width_mm = mode->width_mm;
connector->display_info.height_mm = mode->height_mm;
drm_mode_probed_add(connector, mode);
-   /*
-* TODO: Remove once all drm drivers call
-* drm_connector_set_orientation_from_panel()
-*/
-   drm_connector_set_panel_orientation(connector, ctx->orientation);
  
  	return 1;

  }
--
2.34.1



Re: [PATCH 2/4] drm/panel-elida-kd35t133: hold panel in reset for unprepare

2023-11-15 Thread Jessica Zhang




On 11/15/2023 7:26 AM, Chris Morgan wrote:

From: Chris Morgan 

For devices like the Anbernic RG351M and RG351P the panel is wired to
an always on regulator. When the device suspends and wakes up, there
are some slight artifacts on the screen that go away over time. If
instead we hold the panel in reset status after it is unprepared,
this does not happen.


Hi Chris,

LGTM, though if this is fixing something maybe we can add

Fixes: 5b6603360c12 ("drm/panel: add panel driver for Elida KD35T133 
panels")




Signed-off-by: Chris Morgan 


Reviewed-by: Jessica Zhang 

Thanks,

Jessica Zhang


---
  drivers/gpu/drm/panel/panel-elida-kd35t133.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-elida-kd35t133.c 
b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
index 6cd8536c09ff..f1fc4a26f447 100644
--- a/drivers/gpu/drm/panel/panel-elida-kd35t133.c
+++ b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
@@ -104,6 +104,8 @@ static int kd35t133_unprepare(struct drm_panel *panel)
return ret;
}
  
+	gpiod_set_value_cansleep(ctx->reset_gpio, 1);

+
regulator_disable(ctx->iovcc);
regulator_disable(ctx->vdd);
  
--

2.34.1



Re: [PATCH 1/4] drm/panel-elida-kd35t133: trival: update panel size from 5.5 to 3.5

2023-11-15 Thread Jessica Zhang




On 11/15/2023 7:26 AM, Chris Morgan wrote:

From: Chris Morgan 

The comments at the top of the driver state the panel size incorrectly
as 5.5" instead of 3.5".

Signed-off-by: Chris Morgan 


Reviewed-by: Jessica Zhang 


---
  drivers/gpu/drm/panel/panel-elida-kd35t133.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-elida-kd35t133.c 
b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
index e7be15b68102..6cd8536c09ff 100644
--- a/drivers/gpu/drm/panel/panel-elida-kd35t133.c
+++ b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
@@ -1,6 +1,6 @@
  // SPDX-License-Identifier: GPL-2.0
  /*
- * Elida kd35t133 5.5" MIPI-DSI panel driver
+ * Elida kd35t133 3.5" MIPI-DSI panel driver
   * Copyright (C) 2020 Theobroma Systems Design und Consulting GmbH
   *
   * based on
--
2.34.1



Re: [PATCH 0/3] drm/ci: Add support for SM8250 Gitlab Runner

2023-11-07 Thread Jessica Zhang




On 11/6/2023 9:35 AM, Jessica Zhang wrote:



On 11/4/2023 6:02 AM, Helen Koike wrote:

Hi Jessica,

On 10/10/2023 19:25, Jessica Zhang wrote:
Recently, we've registered a Gitlab runner for a Qualcomm RB5 device 
that will be

hosted and maintained in Qualcomm labs.

This series will add a corresponding CI job for testing SM8250 
devices and add the
skip/fails/flakes list. We were able to complete a successful run [1] 
with these

changes.

For now, we will keep the job as manual trigger only and drop that 
rule later

after we stabilize the tests.

[1] https://gitlab.freedesktop.org/drm/msm/-/jobs/50092719

---


Thank you for you patchset.

I'm getting the following error:

"serial.serialutil.SerialException: [Errno 2] could not open port 
/dev/ttyUSB0: [Errno 2] No such file or directory: '/dev/ttyUSB0'"


https://gitlab.freedesktop.org/helen.fornazier/linux/-/jobs/51193215#L146

I'm wondering if I'm missing some configuration.

I tested on top of drm-misc-next.


Hi Helen,

Sorry for the inconvenience, but I had to temporarily take down the 
runner last Friday to physically move the setup (as part of a 
reorganization of our lab here).


I'll update this thread as soon as the runner is back up -- the move 
will be complete by the end of this week.
The RB5 runner is back up -- please let me know if you run into any 
issues with it.


Thanks,

Jessica Zhang





Also, I'd like to add in the docs an entry about the devices we have, 
which tag they need, which dts they correspond to, which farm they are 
located, who to contact if there is any problem and maybe some comment 
about the device (how it is hooked up, the logs comes from uart or 
ssh, does it use fastboot, etc) if you find it useful.
Would you mind adding an entry in the docs with this information for 
the sm8250? (Than I'll add the info of the other devices after yours).


Sure, sounds good.





Jessica Zhang (3):
   drm/ci: Add SM8250 job to CI


I would also move this patch to last, so we don't have a commit where 
things shouldn't work properly.

Or maybe squash them all.


Acked -- I'll move this patch to the end.

Thanks,

Jessica Zhang



Regards,
Helen


   drm/ci: enable CONFIG_INTERCONNECT_QCOM_SM8250 for arm64 config
   drm/ci: Add skips, fails and flakes for SM8250

  drivers/gpu/drm/ci/arm64.config |  1 +
  drivers/gpu/drm/ci/build.sh |  1 +
  drivers/gpu/drm/ci/test.yml | 15 +
  drivers/gpu/drm/ci/xfails/msm-sm8250-fails.txt  | 29 
+

  drivers/gpu/drm/ci/xfails/msm-sm8250-flakes.txt |  3 +++
  drivers/gpu/drm/ci/xfails/msm-sm8250-skips.txt  |  8 +++
  6 files changed, 57 insertions(+)
---
base-commit: dcd88f8c63341ed11a8c5019408f62202cd9d1f2
change-id: 20230919-rb5-runner-77ec32bd61e7

Best regards,


Re: [PATCH] drm/panel: starry-2081101qfh032011-53g: Fine tune the panel power sequence

2023-11-06 Thread Jessica Zhang




On 11/3/2023 11:55 PM, Zhengqiao Xia wrote:

Hi  Jessica ,


Fixes: 6069b66cd962 ("drm/panel: support for STARRY 2081101QFH032011-53G

MIPI-DSI panel")

I'm not very familiar with this upstream process, Where should I add these?


You can add the Fixes tag before the signed-off-by. For example [1]:

Fixes: 01d6c3578379 ("drm/syncobj: add support for timeline point wait v8")
Signed-off-by: Erik Kurzinger 
<...>

Thanks,

Jessica Zhang

[1] 
https://cgit.freedesktop.org/drm/drm-misc/commit/?h=drm-misc-fixes=101c9f637efa1655f55876644d4439e552267527




Thanks


On Sat, Nov 4, 2023 at 2:40 AM Jessica Zhang 

wrote:


On 11/2/2023 6:08 AM, xiazhengqiao wrote:

For "starry, 2081101qfh032011-53g" this panel, it is stipulated in the

Hi Zhengqiao,
Nit: Can you reword this to "For the "starry, 2081101qfh032011-53g"
panel..."?

panel spec that MIPI needs to keep the LP11 state before the
lcm_reset pin is pulled high.

Was this fixing some panel issue? If so, maybe we can add
Fixes: 6069b66cd962 ("drm/panel: support for STARRY 2081101QFH032011-53G
MIPI-DSI panel")
Otherwise, with the commit msg fix, this looks good to me:
Reviewed-by: Jessica Zhang 
Thanks,
Jessica Zhang




Signed-off-by: xiazhengqiao 

---

   drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c | 1 +
   1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c

b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c

index 4f370bc6dca8..4ed8c2e28d37 100644
--- a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
+++ b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
@@ -1765,6 +1765,7 @@ static const struct panel_desc

starry_qfh032011_53g_desc = {

   .mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE

|

 MIPI_DSI_MODE_LPM,
   .init_cmds = starry_qfh032011_53g_init_cmd,
+ .lp11_before_reset = true,
   };

   static const struct drm_display_mode

starry_himax83102_j02_default_mode = {

--
2.17.1







Re: [PATCH 0/3] drm/ci: Add support for SM8250 Gitlab Runner

2023-11-06 Thread Jessica Zhang




On 11/4/2023 6:02 AM, Helen Koike wrote:

Hi Jessica,

On 10/10/2023 19:25, Jessica Zhang wrote:
Recently, we've registered a Gitlab runner for a Qualcomm RB5 device 
that will be

hosted and maintained in Qualcomm labs.

This series will add a corresponding CI job for testing SM8250 devices 
and add the
skip/fails/flakes list. We were able to complete a successful run [1] 
with these

changes.

For now, we will keep the job as manual trigger only and drop that 
rule later

after we stabilize the tests.

[1] https://gitlab.freedesktop.org/drm/msm/-/jobs/50092719

---


Thank you for you patchset.

I'm getting the following error:

"serial.serialutil.SerialException: [Errno 2] could not open port 
/dev/ttyUSB0: [Errno 2] No such file or directory: '/dev/ttyUSB0'"


https://gitlab.freedesktop.org/helen.fornazier/linux/-/jobs/51193215#L146

I'm wondering if I'm missing some configuration.

I tested on top of drm-misc-next.


Hi Helen,

Sorry for the inconvenience, but I had to temporarily take down the 
runner last Friday to physically move the setup (as part of a 
reorganization of our lab here).


I'll update this thread as soon as the runner is back up -- the move 
will be complete by the end of this week.




Also, I'd like to add in the docs an entry about the devices we have, 
which tag they need, which dts they correspond to, which farm they are 
located, who to contact if there is any problem and maybe some comment 
about the device (how it is hooked up, the logs comes from uart or ssh, 
does it use fastboot, etc) if you find it useful.
Would you mind adding an entry in the docs with this information for the 
sm8250? (Than I'll add the info of the other devices after yours).


Sure, sounds good.





Jessica Zhang (3):
   drm/ci: Add SM8250 job to CI


I would also move this patch to last, so we don't have a commit where 
things shouldn't work properly.

Or maybe squash them all.


Acked -- I'll move this patch to the end.

Thanks,

Jessica Zhang



Regards,
Helen


   drm/ci: enable CONFIG_INTERCONNECT_QCOM_SM8250 for arm64 config
   drm/ci: Add skips, fails and flakes for SM8250

  drivers/gpu/drm/ci/arm64.config |  1 +
  drivers/gpu/drm/ci/build.sh |  1 +
  drivers/gpu/drm/ci/test.yml | 15 +
  drivers/gpu/drm/ci/xfails/msm-sm8250-fails.txt  | 29 
+

  drivers/gpu/drm/ci/xfails/msm-sm8250-flakes.txt |  3 +++
  drivers/gpu/drm/ci/xfails/msm-sm8250-skips.txt  |  8 +++
  6 files changed, 57 insertions(+)
---
base-commit: dcd88f8c63341ed11a8c5019408f62202cd9d1f2
change-id: 20230919-rb5-runner-77ec32bd61e7

Best regards,


Re: [PATCH] drm/panel: starry-2081101qfh032011-53g: Fine tune the panel power sequence

2023-11-03 Thread Jessica Zhang




On 11/2/2023 6:08 AM, xiazhengqiao wrote:

For "starry, 2081101qfh032011-53g" this panel, it is stipulated in the


Hi Zhengqiao,

Nit: Can you reword this to "For the "starry, 2081101qfh032011-53g" 
panel..."?



panel spec that MIPI needs to keep the LP11 state before the
lcm_reset pin is pulled high.


Was this fixing some panel issue? If so, maybe we can add

Fixes: 6069b66cd962 ("drm/panel: support for STARRY 2081101QFH032011-53G 
MIPI-DSI panel")


Otherwise, with the commit msg fix, this looks good to me:

Reviewed-by: Jessica Zhang 

Thanks,

Jessica Zhang



Signed-off-by: xiazhengqiao 
---
  drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c | 1 +
  1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c 
b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
index 4f370bc6dca8..4ed8c2e28d37 100644
--- a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
+++ b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
@@ -1765,6 +1765,7 @@ static const struct panel_desc starry_qfh032011_53g_desc 
= {
.mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
  MIPI_DSI_MODE_LPM,
.init_cmds = starry_qfh032011_53g_init_cmd,
+   .lp11_before_reset = true,
  };
  
  static const struct drm_display_mode starry_himax83102_j02_default_mode = {

--
2.17.1



Re: [PATCH v2] drm/panel-edp: Add timings for BOE NV133WUM-N63

2023-11-03 Thread Jessica Zhang




On 11/2/2023 11:19 AM, Clayton Craft wrote:

This panel is found on laptops e.g., variants of the Thinkpad X13s.
Configuration was collected from the panel's EDID.

Signed-off-by: Clayton Craft 


LGTM

Reviewed-by: Jessica Zhang 

Thanks,

Jessica Zhang



---

V2: renamed to "*_mode" since there is only 1 mode listed

  drivers/gpu/drm/panel/panel-edp.c | 27 +++
  1 file changed, 27 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-edp.c 
b/drivers/gpu/drm/panel/panel-edp.c
index 95c8472d878a..e2e4d88a5159 100644
--- a/drivers/gpu/drm/panel/panel-edp.c
+++ b/drivers/gpu/drm/panel/panel-edp.c
@@ -1204,6 +1204,29 @@ static const struct panel_desc boe_nv133fhm_n61 = {
},
  };
  
+static const struct drm_display_mode boe_nv133wum_n63_mode = {

+   .clock = 157760,
+   .hdisplay = 1920,
+   .hsync_start = 1920 + 48,
+   .hsync_end = 1920 + 48 + 32,
+   .htotal = 1920 + 48 + 32 + 80,
+   .vdisplay = 1200,
+   .vsync_start = 1200 + 3,
+   .vsync_end = 1200 + 3 + 6,
+   .vtotal = 1200 + 3 + 6 + 31,
+   .flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC,
+};
+
+static const struct panel_desc boe_nv133wum_n63 = {
+   .modes = _nv133wum_n63_mode,
+   .num_modes = 1,
+   .bpc = 8,
+   .size = {
+   .width = 286,
+   .height = 179,
+   },
+};
+
  static const struct drm_display_mode boe_nv140fhmn49_modes[] = {
{
.clock = 148500,
@@ -1723,6 +1746,9 @@ static const struct of_device_id platform_of_match[] = {
}, {
.compatible = "boe,nv133fhm-n62",
.data = _nv133fhm_n61,
+   }, {
+   .compatible = "boe,nv133wum-n63",
+   .data = _nv133wum_n63,
}, {
.compatible = "boe,nv140fhmn49",
.data = _nv140fhmn49,
@@ -1852,6 +1878,7 @@ static const struct edp_panel_entry edp_panels[] = {
EDP_PANEL_ENTRY('B', 'O', 'E', 0x095f, _200_500_e50, "NE135FBM-N41 
v8.1"),
EDP_PANEL_ENTRY('B', 'O', 'E', 0x098d, _nv110wtm_n61.delay, 
"NV110WTM-N61"),
EDP_PANEL_ENTRY('B', 'O', 'E', 0x09dd, _200_500_e50, 
"NT116WHM-N21"),
+   EDP_PANEL_ENTRY('B', 'O', 'E', 0x0a1b, _200_500_e50, 
"NV133WUM-N63"),
EDP_PANEL_ENTRY('B', 'O', 'E', 0x0a5d, _200_500_e50, 
"NV116WHM-N45"),
EDP_PANEL_ENTRY('B', 'O', 'E', 0x0ac5, _200_500_e50, 
"NV116WHM-N4C"),
  
--

2.40.1



Re: [PATCH v2 2/2] drm/msm/dp: attach the DP subconnector property

2023-11-01 Thread Jessica Zhang




On 10/25/2023 2:23 AM, Dmitry Baryshkov wrote:

While developing and testing the commit bfcc3d8f94f4 ("drm/msm/dp:
support setting the DP subconnector type") I had the patch [1] in my
tree. I haven't noticed that it was a dependency for the commit in
question. Mea culpa.

Since the patch has not landed yet (and even was not reviewed)
and since one of the bridges erroneously uses USB connector type instead
of DP, attach the property directly from the MSM DP driver.

This fixes the following oops on DP HPD event:

  drm_object_property_set_value (drivers/gpu/drm/drm_mode_object.c:288)
  dp_display_process_hpd_high (drivers/gpu/drm/msm/dp/dp_display.c:402)
  dp_hpd_plug_handle.isra.0 (drivers/gpu/drm/msm/dp/dp_display.c:604)
  hpd_event_thread (drivers/gpu/drm/msm/dp/dp_display.c:1110)
  kthread (kernel/kthread.c:388)
  ret_from_fork (arch/arm64/kernel/entry.S:858)

[1] https://patchwork.freedesktop.org/patch/30/


Tested-by: Jessica Zhang  # SC7280



Fixes: bfcc3d8f94f4 ("drm/msm/dp: support setting the DP subconnector type")
Reviewed-by: Abhinav Kumar 
Signed-off-by: Dmitry Baryshkov 
---
  drivers/gpu/drm/msm/dp/dp_drm.c | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/msm/dp/dp_drm.c b/drivers/gpu/drm/msm/dp/dp_drm.c
index 40e7344180e3..e3bdd7dd4cdc 100644
--- a/drivers/gpu/drm/msm/dp/dp_drm.c
+++ b/drivers/gpu/drm/msm/dp/dp_drm.c
@@ -345,6 +345,9 @@ struct drm_connector *dp_drm_connector_init(struct msm_dp 
*dp_display, struct dr
if (IS_ERR(connector))
return connector;
  
+	if (!dp_display->is_edp)

+   drm_connector_attach_dp_subconnector_property(connector);
+
drm_connector_attach_encoder(connector, encoder);
  
  	return connector;

--
2.42.0



Re: [PATCH v2 1/2] drm/msm/dp: don't touch DP subconnector property in eDP case

2023-11-01 Thread Jessica Zhang




On 10/25/2023 2:23 AM, Dmitry Baryshkov wrote:

From: Abel Vesa 

In case of the eDP connection there is no subconnetor and as such no
subconnector property. Put drm_dp_set_subconnector_property() calls
under the !is_edp condition.

Fixes: bfcc3d8f94f4 ("drm/msm/dp: support setting the DP subconnector type")
Signed-off-by: Abel Vesa 
Signed-off-by: Dmitry Baryshkov 


Tested-by: Jessica Zhang  # SC7280


---
  drivers/gpu/drm/msm/dp/dp_display.c | 15 ++-
  1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/msm/dp/dp_display.c 
b/drivers/gpu/drm/msm/dp/dp_display.c
index e329e03e068d..1b88fb52726f 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.c
+++ b/drivers/gpu/drm/msm/dp/dp_display.c
@@ -365,9 +365,11 @@ static int dp_display_send_hpd_notification(struct 
dp_display_private *dp,
/* reset video pattern flag on disconnect */
if (!hpd) {
dp->panel->video_test = false;
-   drm_dp_set_subconnector_property(dp->dp_display.connector,
-connector_status_disconnected,
-dp->panel->dpcd, 
dp->panel->downstream_ports);
+   if (!dp->dp_display.is_edp)
+   
drm_dp_set_subconnector_property(dp->dp_display.connector,
+
connector_status_disconnected,
+dp->panel->dpcd,
+
dp->panel->downstream_ports);
}
  
  	dp->dp_display.is_connected = hpd;

@@ -396,8 +398,11 @@ static int dp_display_process_hpd_high(struct 
dp_display_private *dp)
  
  	dp_link_process_request(dp->link);
  
-	drm_dp_set_subconnector_property(dp->dp_display.connector, connector_status_connected,

-dp->panel->dpcd, 
dp->panel->downstream_ports);
+   if (!dp->dp_display.is_edp)
+   drm_dp_set_subconnector_property(dp->dp_display.connector,
+connector_status_connected,
+dp->panel->dpcd,
+dp->panel->downstream_ports);
  
  	edid = dp->panel->edid;
  
--

2.42.0



Re: [RFC PATCH v4 3/7] drm/panel: nv3052c: Allow specifying registers per panel

2023-10-30 Thread Jessica Zhang




On 10/30/2023 12:23 AM, John Watts wrote:

Panel initialization registers are per-display and not tied to the
controller itself. Different panels will specify their own registers.
Attach the sequences to the panel info struct so future panels
can specify their own sequences.


Hi John,

Reviewed-by: Jessica Zhang 

Thanks,

Jessica Zhang



Signed-off-by: John Watts 
---
  .../gpu/drm/panel/panel-newvision-nv3052c.c   | 24 ---
  1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-newvision-nv3052c.c 
b/drivers/gpu/drm/panel/panel-newvision-nv3052c.c
index 90dea21f9856..b0114b5e8554 100644
--- a/drivers/gpu/drm/panel/panel-newvision-nv3052c.c
+++ b/drivers/gpu/drm/panel/panel-newvision-nv3052c.c
@@ -20,11 +20,18 @@
  #include 
  #include 
  
+struct nv3052c_reg {

+   u8 cmd;
+   u8 val;
+};
+
  struct nv3052c_panel_info {
const struct drm_display_mode *display_modes;
unsigned int num_modes;
u16 width_mm, height_mm;
u32 bus_format, bus_flags;
+   const struct nv3052c_reg *panel_regs;
+   unsigned int panel_regs_len;
  };
  
  struct nv3052c {

@@ -36,12 +43,7 @@ struct nv3052c {
struct gpio_desc *reset_gpio;
  };
  
-struct nv3052c_reg {

-   u8 cmd;
-   u8 val;
-};
-
-static const struct nv3052c_reg nv3052c_panel_regs[] = {
+static const struct nv3052c_reg ltk035c5444t_panel_regs[] = {
// EXTC Command set enable, select page 1
{ 0xff, 0x30 }, { 0xff, 0x52 }, { 0xff, 0x01 },
// Mostly unknown registers
@@ -244,6 +246,8 @@ static inline struct nv3052c *to_nv3052c(struct drm_panel 
*panel)
  static int nv3052c_prepare(struct drm_panel *panel)
  {
struct nv3052c *priv = to_nv3052c(panel);
+   const struct nv3052c_reg *panel_regs = priv->panel_info->panel_regs;
+   unsigned int panel_regs_len = priv->panel_info->panel_regs_len;
struct mipi_dbi *dbi = >dbi;
unsigned int i;
int err;
@@ -260,9 +264,9 @@ static int nv3052c_prepare(struct drm_panel *panel)
gpiod_set_value_cansleep(priv->reset_gpio, 0);
usleep_range(5000, 2);
  
-	for (i = 0; i < ARRAY_SIZE(nv3052c_panel_regs); i++) {

-   err = mipi_dbi_command(dbi, nv3052c_panel_regs[i].cmd,
-  nv3052c_panel_regs[i].val);
+   for (i = 0; i < panel_regs_len; i++) {
+   err = mipi_dbi_command(dbi, panel_regs[i].cmd,
+  panel_regs[i].val);
  
  		if (err) {

dev_err(priv->dev, "Unable to set register: %d\n", err);
@@ -463,6 +467,8 @@ static const struct nv3052c_panel_info 
ltk035c5444t_panel_info = {
.height_mm = 64,
.bus_format = MEDIA_BUS_FMT_RGB888_1X24,
.bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE,
+   .panel_regs = ltk035c5444t_panel_regs,
+   .panel_regs_len = ARRAY_SIZE(ltk035c5444t_panel_regs),
  };
  
  static const struct spi_device_id nv3052c_ids[] = {

--
2.42.0



Re: [PATCH] drm/panel-edp: Add timings for BOE NV133WUM-N63

2023-10-30 Thread Jessica Zhang




On 10/27/2023 7:19 PM, Clayton Craft wrote:

This panel is found on laptops e.g., variants of the Thinkpad X13s.
Configuration was collected from the panel's EDID.


Hi Clayton,

Thanks for the patch -- it looks good to me aside from one minor comment 
below.




Signed-off-by: Clayton Craft 
---
  drivers/gpu/drm/panel/panel-edp.c | 27 +++
  1 file changed, 27 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-edp.c 
b/drivers/gpu/drm/panel/panel-edp.c
index 95c8472d878a..5db283f014f3 100644
--- a/drivers/gpu/drm/panel/panel-edp.c
+++ b/drivers/gpu/drm/panel/panel-edp.c
@@ -1204,6 +1204,29 @@ static const struct panel_desc boe_nv133fhm_n61 = {
},
  };
  
+static const struct drm_display_mode boe_nv133wum_n63_modes = {


Will other modes be added to this struct in the future? If so, I think 
we can probably turn this into an array to make it easier to extend.


Otherwise, can you change the name to "*_mode"? Seems to me that almost 
all other panels with a single mode have the name as "*_mode" with the 
only exception being a carry-over from older panel-simple.c code.


Thanks,

Jessica Zhang


+   .clock = 157760,
+   .hdisplay = 1920,
+   .hsync_start = 1920 + 48,
+   .hsync_end = 1920 + 48 + 32,
+   .htotal = 1920 + 48 + 32 + 80,
+   .vdisplay = 1200,
+   .vsync_start = 1200 + 3,
+   .vsync_end = 1200 + 3 + 6,
+   .vtotal = 1200 + 3 + 6 + 31,
+   .flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC,
+};
+
+static const struct panel_desc boe_nv133wum_n63 = {
+   .modes = _nv133wum_n63_modes,
+   .num_modes = 1,
+   .bpc = 8,
+   .size = {
+   .width = 286,
+   .height = 179,
+   },
+};
+
  static const struct drm_display_mode boe_nv140fhmn49_modes[] = {
{
.clock = 148500,
@@ -1723,6 +1746,9 @@ static const struct of_device_id platform_of_match[] = {
}, {
.compatible = "boe,nv133fhm-n62",
.data = _nv133fhm_n61,
+   }, {
+   .compatible = "boe,nv133wum-n63",
+   .data = _nv133wum_n63,
}, {
.compatible = "boe,nv140fhmn49",
.data = _nv140fhmn49,
@@ -1852,6 +1878,7 @@ static const struct edp_panel_entry edp_panels[] = {
EDP_PANEL_ENTRY('B', 'O', 'E', 0x095f, _200_500_e50, "NE135FBM-N41 
v8.1"),
EDP_PANEL_ENTRY('B', 'O', 'E', 0x098d, _nv110wtm_n61.delay, 
"NV110WTM-N61"),
EDP_PANEL_ENTRY('B', 'O', 'E', 0x09dd, _200_500_e50, 
"NT116WHM-N21"),
+   EDP_PANEL_ENTRY('B', 'O', 'E', 0x0a1b, _200_500_e50, 
"NV133WUM-N63"),
EDP_PANEL_ENTRY('B', 'O', 'E', 0x0a5d, _200_500_e50, 
"NV116WHM-N45"),
EDP_PANEL_ENTRY('B', 'O', 'E', 0x0ac5, _200_500_e50, 
"NV116WHM-N4C"),
  
--

2.40.1



Re: [PATCH 2/5] drm/panel: nv3051d: Add Powkiddy RK2023 Panel Support

2023-10-27 Thread Jessica Zhang




On 10/20/2023 8:02 AM, Chris Morgan wrote:

On Thu, Oct 19, 2023 at 10:22:24AM -0700, Jessica Zhang wrote:



On 10/18/2023 9:18 AM, Chris Morgan wrote:

From: Chris Morgan 

Refactor the driver to add support for the powkiddy,rk2023-panel
panel. This panel is extremely similar to the rg353p-panel but
requires a smaller vertical back porch and isn't as tolerant of
higher speeds.

Tested on my RG351V, RG353P, RG353V, and RK2023.

Signed-off-by: Chris Morgan 


Hi Chris,

Thanks for the patch. Just have a minor question below.


---
   .../gpu/drm/panel/panel-newvision-nv3051d.c   | 56 +++
   1 file changed, 45 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-newvision-nv3051d.c 
b/drivers/gpu/drm/panel/panel-newvision-nv3051d.c
index 79de6c886292..d24c51503d68 100644
--- a/drivers/gpu/drm/panel/panel-newvision-nv3051d.c
+++ b/drivers/gpu/drm/panel/panel-newvision-nv3051d.c
@@ -28,6 +28,7 @@ struct nv3051d_panel_info {
unsigned int num_modes;
u16 width_mm, height_mm;
u32 bus_flags;
+   u32 mode_flags;
   };
   struct panel_nv3051d {
@@ -385,15 +386,7 @@ static int panel_nv3051d_probe(struct mipi_dsi_device *dsi)
dsi->lanes = 4;
dsi->format = MIPI_DSI_FMT_RGB888;
-   dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
- MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_NO_EOT_PACKET;
-
-   /*
-* The panel in the RG351V is identical to the 353P, except it
-* requires MIPI_DSI_CLOCK_NON_CONTINUOUS to operate correctly.
-*/
-   if (of_device_is_compatible(dev->of_node, "anbernic,rg351v-panel"))
-   dsi->mode_flags |= MIPI_DSI_CLOCK_NON_CONTINUOUS;
+   dsi->mode_flags = ctx->panel_info->mode_flags;
drm_panel_init(>panel, >dev, _nv3051d_funcs,
   DRM_MODE_CONNECTOR_DSI);
@@ -481,18 +474,59 @@ static const struct drm_display_mode 
nv3051d_rgxx3_modes[] = {
},
   };
-static const struct nv3051d_panel_info nv3051d_rgxx3_info = {
+static const struct drm_display_mode nv3051d_rk2023_modes[] = {
+   {
+   .hdisplay   = 640,
+   .hsync_start= 640 + 40,
+   .hsync_end  = 640 + 40 + 2,
+   .htotal = 640 + 40 + 2 + 80,
+   .vdisplay   = 480,
+   .vsync_start= 480 + 18,
+   .vsync_end  = 480 + 18 + 2,
+   .vtotal = 480 + 18 + 2 + 4,
+   .clock  = 24150,
+   .flags  = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
+   },
+};
+
+static const struct nv3051d_panel_info nv3051d_rg351v_info = {
.display_modes = nv3051d_rgxx3_modes,
.num_modes = ARRAY_SIZE(nv3051d_rgxx3_modes),
.width_mm = 70,
.height_mm = 57,
.bus_flags = DRM_BUS_FLAG_DE_LOW | DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE,
+   .mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
+ MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_NO_EOT_PACKET |
+ MIPI_DSI_CLOCK_NON_CONTINUOUS,
+};
+
+static const struct nv3051d_panel_info nv3051d_rg353p_info = {
+   .display_modes = nv3051d_rgxx3_modes,
+   .num_modes = ARRAY_SIZE(nv3051d_rgxx3_modes),
+   .width_mm = 70,
+   .height_mm = 57,


Will all the panels for this driver be 70x57? If so, would it be better to
set display_info.[width_mm|height_mm] directly?


They are all so far the same size, but I can't guarantee that going forward.
To my knowledge this is the last of the nv3051d devices I'll be working on
in the foreseeable future though, and so far they're all identical in size.


Got it, if it's not guaranteed might be better to leave it as it then. 
Thanks for clarifying.


BR,

Jessica Zhang






+   .bus_flags = DRM_BUS_FLAG_DE_LOW | DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE,
+   .mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
+ MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_NO_EOT_PACKET,
+};
+
+static const struct nv3051d_panel_info nv3051d_rk2023_info = {
+   .display_modes = nv3051d_rk2023_modes,
+   .num_modes = ARRAY_SIZE(nv3051d_rk2023_modes),
+   .width_mm = 70,
+   .height_mm = 57,
+   .bus_flags = DRM_BUS_FLAG_DE_LOW | DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE,
+   .mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
+ MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_NO_EOT_PACKET,
   };
   static const struct of_device_id newvision_nv3051d_of_match[] = {
-   { .compatible = "newvision,nv3051d", .data = _rgxx3_info },
+   { .compatible = "anbernic,rg351v-panel", .data = _rg351v_info },
+   { .compatible = "anbernic,rg353p-panel", .data = _rg353p_info },
+   { .compatible = "powkiddy,rk2023-panel", .data = _rk2023_info },
{ /* sentinel */ }
   };
+


Sorry, will fix that in a V2

[PATCH RFC v7 09/10] drm/msm/dpu: Use DRM solid_fill property

2023-10-27 Thread Jessica Zhang
Drop DPU_PLANE_COLOR_FILL_FLAG and check the DRM solid_fill property to
determine if the plane is solid fill. In addition drop the DPU plane
color_fill field as we can now use drm_plane_state.solid_fill instead,
and pass in drm_plane_state.alpha to _dpu_plane_color_fill_pipe() to
allow userspace to configure the alpha value for the solid fill color.

Reviewed-by: Dmitry Baryshkov 
Signed-off-by: Jessica Zhang 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 38 ---
 1 file changed, 25 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
index 9615653db787..832747080daf 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
@@ -42,7 +42,6 @@
 #define SHARP_SMOOTH_THR_DEFAULT   8
 #define SHARP_NOISE_THR_DEFAULT2
 
-#define DPU_PLANE_COLOR_FILL_FLAG  BIT(31)
 #define DPU_ZPOS_MAX 255
 
 /*
@@ -84,7 +83,6 @@ struct dpu_plane {
 
enum dpu_sspp pipe;
 
-   uint32_t color_fill;
bool is_error;
bool is_rt_pipe;
const struct dpu_mdss_cfg *catalog;
@@ -640,19 +638,34 @@ static void _dpu_plane_color_fill_pipe(struct 
dpu_plane_state *pstate,
_dpu_plane_setup_scaler(pipe, fmt, true, _cfg, pstate->rotation);
 }
 
+static uint32_t _dpu_plane_get_abgr_fill_color(struct drm_plane_state *state)
+{
+   struct drm_solid_fill solid_fill = state->solid_fill;
+
+   uint32_t ret = 0;
+   uint8_t a = state->alpha & 0xFF;
+   uint8_t b = solid_fill.b >> 24;
+   uint8_t g = solid_fill.g >> 24;
+   uint8_t r = solid_fill.r >> 24;
+
+   ret |= a << 24;
+   ret |= b << 16;
+   ret |= g << 8;
+   ret |= r;
+
+   return ret;
+}
+
 /**
  * _dpu_plane_color_fill - enables color fill on plane
  * @pdpu:   Pointer to DPU plane object
  * @color:  RGB fill color value, [23..16] Blue, [15..8] Green, [7..0] Red
- * @alpha:  8-bit fill alpha value, 255 selects 100% alpha
  */
-static void _dpu_plane_color_fill(struct dpu_plane *pdpu,
-   uint32_t color, uint32_t alpha)
+static void _dpu_plane_color_fill(struct dpu_plane *pdpu, uint32_t color)
 {
const struct dpu_format *fmt;
const struct drm_plane *plane = >base;
struct dpu_plane_state *pstate = to_dpu_plane_state(plane->state);
-   u32 fill_color = (color & 0xFF) | ((alpha & 0xFF) << 24);
 
DPU_DEBUG_PLANE(pdpu, "\n");
 
@@ -667,11 +680,11 @@ static void _dpu_plane_color_fill(struct dpu_plane *pdpu,
 
/* update sspp */
_dpu_plane_color_fill_pipe(pstate, >pipe, 
>pipe_cfg.dst_rect,
-  fill_color, fmt);
+  color, fmt);
 
if (pstate->r_pipe.sspp)
_dpu_plane_color_fill_pipe(pstate, >r_pipe, 
>r_pipe_cfg.dst_rect,
-  fill_color, fmt);
+  color, fmt);
 }
 
 static int dpu_plane_prepare_fb(struct drm_plane *plane,
@@ -1019,10 +1032,9 @@ void dpu_plane_flush(struct drm_plane *plane)
 */
if (pdpu->is_error)
/* force white frame with 100% alpha pipe output on error */
-   _dpu_plane_color_fill(pdpu, 0xFF, 0xFF);
-   else if (pdpu->color_fill & DPU_PLANE_COLOR_FILL_FLAG)
-   /* force 100% alpha */
-   _dpu_plane_color_fill(pdpu, pdpu->color_fill, 0xFF);
+   _dpu_plane_color_fill(pdpu, 0x);
+   else if (drm_plane_solid_fill_enabled(plane->state))
+   _dpu_plane_color_fill(pdpu, 
_dpu_plane_get_abgr_fill_color(plane->state));
else {
dpu_plane_flush_csc(pdpu, >pipe);
dpu_plane_flush_csc(pdpu, >r_pipe);
@@ -1067,7 +1079,7 @@ static void dpu_plane_sspp_update_pipe(struct drm_plane 
*plane,
}
 
/* override for color fill */
-   if (pdpu->color_fill & DPU_PLANE_COLOR_FILL_FLAG) {
+   if (drm_plane_solid_fill_enabled(plane->state)) {
_dpu_plane_set_qos_ctrl(plane, pipe, false);
 
/* skip remaining processing on color fill */

-- 
2.42.0



[PATCH RFC v7 01/10] drm: Introduce pixel_source DRM plane property

2023-10-27 Thread Jessica Zhang
Add support for pixel_source property to drm_plane and related
documentation. In addition, force pixel_source to
DRM_PLANE_PIXEL_SOURCE_FB in DRM_IOCTL_MODE_SETPLANE as to not break
legacy userspace.

This enum property will allow user to specify a pixel source for the
plane. Possible pixel sources will be defined in the
drm_plane_pixel_source enum.

Currently, the only pixel sources are DRM_PLANE_PIXEL_SOURCE_FB (the
default value) and DRM_PLANE_PIXEL_SOURCE_NONE.

Acked-by: Dmitry Baryshkov 
Acked-by: Pekka Paalanen 
Acked-by: Harry Wentland 
Acked-by: Sebastian Wick 
Acked-by: Simon Ser 
Signed-off-by: Jessica Zhang 
---
 drivers/gpu/drm/drm_atomic_state_helper.c |  1 +
 drivers/gpu/drm/drm_atomic_uapi.c |  4 ++
 drivers/gpu/drm/drm_blend.c   | 94 +++
 drivers/gpu/drm/drm_plane.c   | 19 +--
 include/drm/drm_blend.h   |  2 +
 include/drm/drm_plane.h   | 21 +++
 6 files changed, 137 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c 
b/drivers/gpu/drm/drm_atomic_state_helper.c
index 784e63d70a42..01638c51ce0a 100644
--- a/drivers/gpu/drm/drm_atomic_state_helper.c
+++ b/drivers/gpu/drm/drm_atomic_state_helper.c
@@ -252,6 +252,7 @@ void __drm_atomic_helper_plane_state_reset(struct 
drm_plane_state *plane_state,
 
plane_state->alpha = DRM_BLEND_ALPHA_OPAQUE;
plane_state->pixel_blend_mode = DRM_MODE_BLEND_PREMULTI;
+   plane_state->pixel_source = DRM_PLANE_PIXEL_SOURCE_FB;
 
if (plane->color_encoding_property) {
if (!drm_object_property_get_default_value(>base,
diff --git a/drivers/gpu/drm/drm_atomic_uapi.c 
b/drivers/gpu/drm/drm_atomic_uapi.c
index 98d3b10c08ae..46c78b87803d 100644
--- a/drivers/gpu/drm/drm_atomic_uapi.c
+++ b/drivers/gpu/drm/drm_atomic_uapi.c
@@ -562,6 +562,8 @@ static int drm_atomic_plane_set_property(struct drm_plane 
*plane,
state->src_w = val;
} else if (property == config->prop_src_h) {
state->src_h = val;
+   } else if (property == plane->pixel_source_property) {
+   state->pixel_source = val;
} else if (property == plane->alpha_property) {
state->alpha = val;
} else if (property == plane->blend_mode_property) {
@@ -634,6 +636,8 @@ drm_atomic_plane_get_property(struct drm_plane *plane,
*val = state->src_w;
} else if (property == config->prop_src_h) {
*val = state->src_h;
+   } else if (property == plane->pixel_source_property) {
+   *val = state->pixel_source;
} else if (property == plane->alpha_property) {
*val = state->alpha;
} else if (property == plane->blend_mode_property) {
diff --git a/drivers/gpu/drm/drm_blend.c b/drivers/gpu/drm/drm_blend.c
index 6e74de833466..fce734cdb85b 100644
--- a/drivers/gpu/drm/drm_blend.c
+++ b/drivers/gpu/drm/drm_blend.c
@@ -185,6 +185,25 @@
  *  plane does not expose the "alpha" property, then this is
  *  assumed to be 1.0
  *
+ * pixel_source:
+ * pixel_source is set up with drm_plane_create_pixel_source_property().
+ * It is used to toggle the active source of pixel data for the plane.
+ * The plane will only display data from the set pixel_source -- any
+ * data from other sources will be ignored.
+ *
+ * For non-framebuffer sources, if pixel_source is set to a non-framebuffer
+ * and non-NONE source, and the corresponding source property is NULL, then
+ * the atomic commit should return an error.
+ *
+ * Possible values:
+ *
+ * "NONE":
+ * No active pixel source.
+ * Committing with a NONE pixel source will disable the plane.
+ *
+ * "FB":
+ * Framebuffer source set by the "FB_ID" property.
+ *
  * Note that all the property extensions described here apply either to the
  * plane or the CRTC (e.g. for the background color, which currently is not
  * exposed and assumed to be black).
@@ -615,3 +634,78 @@ int drm_plane_create_blend_mode_property(struct drm_plane 
*plane,
return 0;
 }
 EXPORT_SYMBOL(drm_plane_create_blend_mode_property);
+
+static const struct drm_prop_enum_list drm_pixel_source_enum_list[] = {
+   { DRM_PLANE_PIXEL_SOURCE_NONE, "NONE" },
+   { DRM_PLANE_PIXEL_SOURCE_FB, "FB" },
+};
+
+/**
+ * drm_plane_create_pixel_source_property - create a new pixel source property
+ * @plane: DRM plane
+ * @extra_sources: Bitmask of additional supported pixel_sources for the 
driver.
+ *DRM_PLANE_PIXEL_SOURCE_FB and DRM_PLANE_PIXEL_SOURCE_NONE 
will
+ *always be enabled as supported sources.
+ *
+ * This creates a new property describing the current source of pixel data for 
the
+ * plane. The pixel_source will be initializ

[PATCH RFC v7 06/10] drm/atomic: Move framebuffer checks to helper

2023-10-27 Thread Jessica Zhang
Currently framebuffer checks happen directly in
drm_atomic_plane_check(). Move these checks into their own helper
method.

Reviewed-by: Dmitry Baryshkov 
Acked-by: Harry Wentland 
Acked-by: Sebastian Wick 
Signed-off-by: Jessica Zhang 
---
 drivers/gpu/drm/drm_atomic.c | 130 ---
 1 file changed, 73 insertions(+), 57 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index af778d32785b..48a2df4e3d27 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -589,6 +589,76 @@ plane_switching_crtc(const struct drm_plane_state 
*old_plane_state,
return true;
 }
 
+static int drm_atomic_plane_check_fb(const struct drm_plane_state *state)
+{
+   struct drm_plane *plane = state->plane;
+   const struct drm_framebuffer *fb = state->fb;
+   struct drm_mode_rect *clips;
+
+   uint32_t num_clips;
+   unsigned int fb_width, fb_height;
+   int ret;
+
+   /* Check whether this plane supports the fb pixel format. */
+   ret = drm_plane_check_pixel_format(plane, fb->format->format,
+  fb->modifier);
+
+   if (ret) {
+   drm_dbg_atomic(plane->dev,
+  "[PLANE:%d:%s] invalid pixel format %p4cc, 
modifier 0x%llx\n",
+  plane->base.id, plane->name,
+  >format->format, fb->modifier);
+   return ret;
+   }
+
+   fb_width = fb->width << 16;
+   fb_height = fb->height << 16;
+
+   /* Make sure source coordinates are inside the fb. */
+   if (state->src_w > fb_width ||
+   state->src_x > fb_width - state->src_w ||
+   state->src_h > fb_height ||
+   state->src_y > fb_height - state->src_h) {
+   drm_dbg_atomic(plane->dev,
+  "[PLANE:%d:%s] invalid source coordinates "
+  "%u.%06ux%u.%06u+%u.%06u+%u.%06u (fb %ux%u)\n",
+  plane->base.id, plane->name,
+  state->src_w >> 16,
+  ((state->src_w & 0x) * 15625) >> 10,
+  state->src_h >> 16,
+  ((state->src_h & 0x) * 15625) >> 10,
+  state->src_x >> 16,
+  ((state->src_x & 0x) * 15625) >> 10,
+  state->src_y >> 16,
+  ((state->src_y & 0x) * 15625) >> 10,
+  fb->width, fb->height);
+   return -ENOSPC;
+   }
+
+   clips = __drm_plane_get_damage_clips(state);
+   num_clips = drm_plane_get_damage_clips_count(state);
+
+   /* Make sure damage clips are valid and inside the fb. */
+   while (num_clips > 0) {
+   if (clips->x1 >= clips->x2 ||
+   clips->y1 >= clips->y2 ||
+   clips->x1 < 0 ||
+   clips->y1 < 0 ||
+   clips->x2 > fb_width ||
+   clips->y2 > fb_height) {
+   drm_dbg_atomic(plane->dev,
+  "[PLANE:%d:%s] invalid damage clip %d %d 
%d %d\n",
+  plane->base.id, plane->name, clips->x1,
+  clips->y1, clips->x2, clips->y2);
+   return -EINVAL;
+   }
+   clips++;
+   num_clips--;
+   }
+
+   return 0;
+}
+
 /**
  * drm_atomic_plane_check - check plane state
  * @old_plane_state: old plane state to check
@@ -605,9 +675,6 @@ static int drm_atomic_plane_check(const struct 
drm_plane_state *old_plane_state,
struct drm_plane *plane = new_plane_state->plane;
struct drm_crtc *crtc = new_plane_state->crtc;
const struct drm_framebuffer *fb = new_plane_state->fb;
-   unsigned int fb_width, fb_height;
-   struct drm_mode_rect *clips;
-   uint32_t num_clips;
int ret;
 
/* either *both* CRTC and FB must be set, or neither */
@@ -634,17 +701,6 @@ static int drm_atomic_plane_check(const struct 
drm_plane_state *old_plane_state,
return -EINVAL;
}
 
-   /* Check whether this plane supports the fb pixel format. */
-   ret = drm_plane_check_pixel_format(plane, fb->format->format,
-  fb->modifier);
-   if (ret) {
-   drm_dbg_atomic(plane->dev,
-  "[PLANE:%d:%s] invalid pixel format %p4cc, 
modifier 0x%llx\n",
- 

[PATCH RFC v7 00/10] Support for Solid Fill Planes

2023-10-27 Thread Jessica Zhang
 atomic checks (Dmitry)
- Introduced drm_plane_has_visible_data() and drm_atomic_check_fb() helper
  methods (Dmitry)
- Fixed typo in drm_solid_fill struct documentation
- Created drm_plane_has_visible_data() helper and corrected CRTC and FB
  NULL-check logic (Dmitry)
- Merged `if (fb)` blocks in drm_atomic_plane_check() and abstracted
  them into helper method (Dmitry)
- Inverted `if (solid_fill_enabled) else if (fb)` check order (Dmitry)
- Fixed indentation (Dmitry)

Changes in v2:
- Dropped SOLID_FILL_FORMAT property (Simon)
- Switched to implementing solid_fill property as a blob (Simon, Dmitry)
- Added drm_solid_fill and drm_solid_fill_info structs (Simon)
- Changed to checks for if solid_fill_blob is set (Dmitry)
- Abstracted (plane_state && !solid_fill_blob) checks to helper method
  (Dmitry)
- Removed DPU_PLANE_COLOR_FILL_FLAG
- Fixed whitespace and indentation issues (Dmitry)
- Changed to checks for if solid_fill_blob is set (Dmitry)
- Abstracted (plane_state && !solid_fill_blob) checks to helper method
  (Dmitry)
- Fixed dropped 'const' warning
- Added helper to convert color fill to BGR888 (Rob)
- Fixed indentation issue (Dmitry)
- Added support for solid fill on planes of varying sizes

---
Jessica Zhang (10):
  drm: Introduce pixel_source DRM plane property
  drm: Introduce solid fill DRM plane property
  drm: Add solid fill pixel source
  drm/atomic: Add pixel source to plane state dump
  drm/atomic: Add solid fill data to plane state dump
  drm/atomic: Move framebuffer checks to helper
  drm/atomic: Loosen FB atomic checks
  drm/msm/dpu: Allow NULL FBs in atomic commit
  drm/msm/dpu: Use DRM solid_fill property
  drm/msm/dpu: Add solid fill and pixel source properties

 drivers/gpu/drm/drm_atomic.c  | 148 +-
 drivers/gpu/drm/drm_atomic_helper.c   |  39 
 drivers/gpu/drm/drm_atomic_state_helper.c |  10 ++
 drivers/gpu/drm/drm_atomic_uapi.c |  30 ++
 drivers/gpu/drm/drm_blend.c   | 133 +++
 drivers/gpu/drm/drm_crtc_internal.h   |   1 +
 drivers/gpu/drm/drm_plane.c   |  27 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c  |   9 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c |  75 ++-
 include/drm/drm_atomic_helper.h   |   4 +-
 include/drm/drm_blend.h   |   3 +
 include/drm/drm_plane.h   |  90 ++
 include/uapi/drm/drm_mode.h   |  24 +
 13 files changed, 481 insertions(+), 112 deletions(-)
---
base-commit: b08d26dac1a1075c874f40ee02ec8ddc39e20146
change-id: 20230404-solid-fill-05016175db36

Best regards,
-- 
Jessica Zhang 



[PATCH RFC v7 05/10] drm/atomic: Add solid fill data to plane state dump

2023-10-27 Thread Jessica Zhang
Add solid_fill property data to the atomic plane state dump.

Reviewed-by: Dmitry Baryshkov 
Acked-by: Harry Wentland 
Acked-by: Sebastian Wick 
Signed-off-by: Jessica Zhang 
---
 drivers/gpu/drm/drm_atomic.c | 4 
 drivers/gpu/drm/drm_plane.c  | 8 
 include/drm/drm_plane.h  | 3 +++
 3 files changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 9f9abbe76369..af778d32785b 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -726,6 +726,10 @@ static void drm_atomic_plane_print_state(struct 
drm_printer *p,
drm_printf(p, "\tfb=%u\n", state->fb ? state->fb->base.id : 0);
if (state->fb)
drm_framebuffer_print_info(p, 2, state->fb);
+   drm_printf(p, "\tsolid_fill=%u\n",
+   state->solid_fill_blob ? 
state->solid_fill_blob->base.id : 0);
+   if (state->solid_fill_blob)
+   drm_plane_solid_fill_print_info(p, 2, state);
drm_printf(p, "\tcrtc-pos=" DRM_RECT_FMT "\n", DRM_RECT_ARG());
drm_printf(p, "\tsrc-pos=" DRM_RECT_FP_FMT "\n", DRM_RECT_FP_ARG());
drm_printf(p, "\trotation=%x\n", state->rotation);
diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 559d101162ba..289b3be86d52 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -1495,6 +1495,14 @@ __drm_plane_get_damage_clips(const struct 
drm_plane_state *state)
state->fb_damage_clips->data : NULL);
 }
 
+void drm_plane_solid_fill_print_info(struct drm_printer *p, unsigned int 
indent,
+const struct drm_plane_state *state)
+{
+   drm_printf_indent(p, indent, "r=0x%08x\n", state->solid_fill.r);
+   drm_printf_indent(p, indent, "g=0x%08x\n", state->solid_fill.g);
+   drm_printf_indent(p, indent, "b=0x%08x\n", state->solid_fill.b);
+}
+
 /**
  * drm_plane_get_damage_clips - Returns damage clips.
  * @state: Plane state.
diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
index baaf737392bc..6171fb1a0b47 100644
--- a/include/drm/drm_plane.h
+++ b/include/drm/drm_plane.h
@@ -1001,6 +1001,9 @@ drm_plane_get_damage_clips_count(const struct 
drm_plane_state *state);
 struct drm_mode_rect *
 drm_plane_get_damage_clips(const struct drm_plane_state *state);
 
+void drm_plane_solid_fill_print_info(struct drm_printer *p, unsigned int 
indent,
+const struct drm_plane_state *state);
+
 int drm_plane_create_scaling_filter_property(struct drm_plane *plane,
 unsigned int supported_filters);
 

-- 
2.42.0



  1   2   3   4   5   6   7   >