2021-10-21 21:36:17

by Julian Braha

[permalink] [raw]
Subject: [PATCH RESEND v2 1/2] dt-bindings: panel-simple-dsi: add Tianma TL057FVXP01

Adds the bindings for the Tianma TL057FVXP01 DSI panel,
found on the Motorola Moto G6.

v2:
Fixed accidental whitespace deletion.

Signed-off-by: Julian Braha <[email protected]>
---
.../devicetree/bindings/display/panel/panel-simple-dsi.yaml | 2 ++
1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml b/Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml
index fbd71669248f..92a702d141e1 100644
--- a/Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml
+++ b/Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml
@@ -55,6 +55,8 @@ properties:
- samsung,sofef00
# Shangai Top Display Optoelectronics 7" TL070WSH30 1024x600 TFT LCD panel
- tdo,tl070wsh30
+ # Tianma Micro-electronics TL057FVXP01 5.7" 2160x1080 LCD panel
+ - tianma,tl057fvxp01

reg:
maxItems: 1
--
2.30.2


2021-10-21 21:36:24

by Julian Braha

[permalink] [raw]
Subject: [PATCH RESEND v2 2/2] drm/panel/tianma-tl057fvxp01: add panel for Motorola Moto G6

This is a 5.7" 2160x1080 panel found on the Motorola Moto G6.
There may be other smartphones using it, as well.

Signed-off-by: Julian Braha <[email protected]>
---
drivers/gpu/drm/panel/Kconfig | 7 +
drivers/gpu/drm/panel/Makefile | 1 +
.../gpu/drm/panel/panel-tianma-tl057fvxp01.c | 262 ++++++++++++++++++
3 files changed, 270 insertions(+)
create mode 100644 drivers/gpu/drm/panel/panel-tianma-tl057fvxp01.c

diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index 418638e6e3b0..5b1aff067d8f 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -558,6 +558,13 @@ config DRM_PANEL_TDO_TL070WSH30
24 bit RGB per pixel. It provides a MIPI DSI interface to
the host, a built-in LED backlight and touch controller.

+config DRM_PANEL_TIANMA_TL057FVXP01
+ tristate "Tianma TL057FVXP01 panel"
+ select DRM_PANEL_MIPI_DSI_COMMON
+ help
+ Say Y here if you want to enable support for the Tianma TL057FVXP01
+ 2160x1080 5.7" panel (found on the Motorola Moto G6).
+
config DRM_PANEL_TPO_TD028TTEC1
tristate "Toppoly (TPO) TD028TTEC1 panel driver"
depends on OF && SPI
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index c8132050bcec..9bdc2a12e719 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -57,6 +57,7 @@ obj-$(CONFIG_DRM_PANEL_SITRONIX_ST7789V) += panel-sitronix-st7789v.o
obj-$(CONFIG_DRM_PANEL_SONY_ACX424AKP) += panel-sony-acx424akp.o
obj-$(CONFIG_DRM_PANEL_SONY_ACX565AKM) += panel-sony-acx565akm.o
obj-$(CONFIG_DRM_PANEL_TDO_TL070WSH30) += panel-tdo-tl070wsh30.o
+obj-$(CONFIG_DRM_PANEL_TIANMA_TL057FVXP01) += panel-tianma-tl057fvxp01.o
obj-$(CONFIG_DRM_PANEL_TPO_TD028TTEC1) += panel-tpo-td028ttec1.o
obj-$(CONFIG_DRM_PANEL_TPO_TD043MTEA1) += panel-tpo-td043mtea1.o
obj-$(CONFIG_DRM_PANEL_TPO_TPG110) += panel-tpo-tpg110.o
diff --git a/drivers/gpu/drm/panel/panel-tianma-tl057fvxp01.c b/drivers/gpu/drm/panel/panel-tianma-tl057fvxp01.c
new file mode 100644
index 000000000000..7dcdcbd8ef5f
--- /dev/null
+++ b/drivers/gpu/drm/panel/panel-tianma-tl057fvxp01.c
@@ -0,0 +1,262 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2021 Julian Braha <[email protected]>
+ * Copyright (c) 2021, The Linux Foundation. All rights reserved.
+ * Generated with linux-mdss-dsi-panel-driver-generator from vendor device tree
+ */
+
+#include <linux/delay.h>
+#include <linux/gpio/consumer.h>
+#include <linux/module.h>
+#include <linux/of.h>
+
+#include <video/mipi_display.h>
+
+#include <drm/drm_mipi_dsi.h>
+#include <drm/drm_modes.h>
+#include <drm/drm_panel.h>
+
+struct tianma_tl057fvxp01 {
+ struct drm_panel panel;
+ struct mipi_dsi_device *dsi;
+ struct gpio_desc *reset_gpio;
+ bool prepared;
+};
+
+static inline struct tianma_tl057fvxp01 *to_tianma_tl057fvxp01(struct drm_panel *panel)
+{
+ return container_of(panel, struct tianma_tl057fvxp01, panel);
+}
+
+#define dsi_dcs_write_seq(dsi, seq...) do { \
+ static const u8 d[] = { seq }; \
+ int ret; \
+ ret = mipi_dsi_dcs_write_buffer(dsi, d, ARRAY_SIZE(d)); \
+ if (ret < 0) \
+ return ret; \
+ } while (0)
+
+static void tianma_tl057fvxp01_reset(struct tianma_tl057fvxp01 *ctx)
+{
+ gpiod_set_value_cansleep(ctx->reset_gpio, 0);
+ usleep_range(5000, 6000);
+ gpiod_set_value_cansleep(ctx->reset_gpio, 1);
+ usleep_range(1000, 2000);
+ gpiod_set_value_cansleep(ctx->reset_gpio, 0);
+ usleep_range(10000, 11000);
+}
+
+static int tianma_tl057fvxp01_on(struct tianma_tl057fvxp01 *ctx)
+{
+ struct mipi_dsi_device *dsi = ctx->dsi;
+ struct device *dev = &dsi->dev;
+ int ret;
+
+ dsi_dcs_write_seq(dsi, 0x00, 0x00);
+ dsi_dcs_write_seq(dsi, 0xff, 0x19, 0x11, 0x01);
+ dsi_dcs_write_seq(dsi, 0x00, 0x80);
+ dsi_dcs_write_seq(dsi, 0xff, 0x19, 0x11);
+ dsi_dcs_write_seq(dsi, 0x00, 0xb0);
+ dsi_dcs_write_seq(dsi, 0xb3, 0x04, 0x38, 0x08, 0x70);
+ dsi_dcs_write_seq(dsi, 0x00, 0x00);
+ dsi_dcs_write_seq(dsi, 0xff, 0xff, 0xff, 0xff);
+ dsi_dcs_write_seq(dsi, 0x35, 0x00);
+ dsi_dcs_write_seq(dsi, 0x51, 0xcc, 0x08);
+ dsi_dcs_write_seq(dsi, 0x53, 0x2c);
+ dsi_dcs_write_seq(dsi, 0x55, 0x01);
+
+ 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 display on: %d\n", ret);
+ return ret;
+ }
+ usleep_range(10000, 11000);
+
+ return 0;
+}
+
+static int tianma_tl057fvxp01_off(struct tianma_tl057fvxp01 *ctx)
+{
+ struct mipi_dsi_device *dsi = ctx->dsi;
+ struct device *dev = &dsi->dev;
+ int ret;
+
+ ret = mipi_dsi_dcs_set_display_off(dsi);
+ if (ret < 0) {
+ dev_err(dev, "Failed to set display off: %d\n", ret);
+ return ret;
+ }
+ msleep(50);
+
+ ret = mipi_dsi_dcs_enter_sleep_mode(dsi);
+ if (ret < 0) {
+ dev_err(dev, "Failed to enter sleep mode: %d\n", ret);
+ return ret;
+ }
+ msleep(70);
+
+ return 0;
+}
+
+static int tianma_tl057fvxp01_prepare(struct drm_panel *panel)
+{
+ struct tianma_tl057fvxp01 *ctx = to_tianma_tl057fvxp01(panel);
+ struct device *dev = &ctx->dsi->dev;
+ int ret;
+
+ if (ctx->prepared)
+ return 0;
+
+ tianma_tl057fvxp01_reset(ctx);
+
+ ret = tianma_tl057fvxp01_on(ctx);
+ if (ret < 0) {
+ dev_err(dev, "Failed to initialize panel: %d\n", ret);
+ gpiod_set_value_cansleep(ctx->reset_gpio, 1);
+ return ret;
+ }
+
+ ctx->prepared = true;
+ return 0;
+}
+
+static int tianma_tl057fvxp01_unprepare(struct drm_panel *panel)
+{
+ struct tianma_tl057fvxp01 *ctx = to_tianma_tl057fvxp01(panel);
+ struct device *dev = &ctx->dsi->dev;
+ int ret;
+
+ if (!ctx->prepared)
+ return 0;
+
+ ret = tianma_tl057fvxp01_off(ctx);
+ if (ret < 0)
+ dev_err(dev, "Failed to un-initialize panel: %d\n", ret);
+
+ gpiod_set_value_cansleep(ctx->reset_gpio, 1);
+
+ ctx->prepared = false;
+ return 0;
+}
+
+static const struct drm_display_mode tianma_tl057fvxp01_mode = {
+ .clock = (1080 + 53 + 4 + 53) * (2160 + 14 + 1 + 11) * 60 / 1000,
+ .hdisplay = 1080,
+ .hsync_start = 1080 + 53,
+ .hsync_end = 1080 + 53 + 4,
+ .htotal = 1080 + 53 + 4 + 53,
+ .vdisplay = 2160,
+ .vsync_start = 2160 + 14,
+ .vsync_end = 2160 + 14 + 1,
+ .vtotal = 2160 + 14 + 1 + 11,
+ .width_mm = 62,
+ .height_mm = 110,
+};
+
+static int tianma_tl057fvxp01_get_modes(struct drm_panel *panel,
+ struct drm_connector *connector)
+{
+ struct drm_display_mode *mode;
+
+ mode = drm_mode_duplicate(connector->dev, &tianma_tl057fvxp01_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 tianma_tl057fvxp01_panel_funcs = {
+ .prepare = tianma_tl057fvxp01_prepare,
+ .unprepare = tianma_tl057fvxp01_unprepare,
+ .get_modes = tianma_tl057fvxp01_get_modes,
+};
+
+static int tianma_tl057fvxp01_probe(struct mipi_dsi_device *dsi)
+{
+ struct device *dev = &dsi->dev;
+ struct tianma_tl057fvxp01 *ctx;
+ int ret;
+
+ ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
+ if (!ctx)
+ return -ENOMEM;
+
+ ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
+ if (IS_ERR(ctx->reset_gpio))
+ return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio),
+ "Failed to get reset-gpios\n");
+
+ ctx->dsi = dsi;
+ mipi_dsi_set_drvdata(dsi, ctx);
+
+ dsi->lanes = 4;
+ dsi->format = MIPI_DSI_FMT_RGB888;
+ dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
+ MIPI_DSI_CLOCK_NON_CONTINUOUS | MIPI_DSI_MODE_LPM;
+
+ drm_panel_init(&ctx->panel, dev, &tianma_tl057fvxp01_panel_funcs,
+ DRM_MODE_CONNECTOR_DSI);
+
+ ret = drm_panel_of_backlight(&ctx->panel);
+ if (ret)
+ return dev_err_probe(dev, ret, "Failed to get backlight\n");
+
+ drm_panel_add(&ctx->panel);
+
+ ret = mipi_dsi_attach(dsi);
+ if (ret < 0) {
+ dev_err(dev, "Failed to attach to DSI host: %d\n", ret);
+ drm_panel_remove(&ctx->panel);
+ return ret;
+ }
+
+ return 0;
+}
+
+static int tianma_tl057fvxp01_remove(struct mipi_dsi_device *dsi)
+{
+ struct tianma_tl057fvxp01 *ctx = mipi_dsi_get_drvdata(dsi);
+ int ret;
+
+ ret = mipi_dsi_detach(dsi);
+ if (ret < 0)
+ dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
+
+ drm_panel_remove(&ctx->panel);
+
+ return 0;
+}
+
+static const struct of_device_id tianma_tl057fvxp01_of_match[] = {
+ { .compatible = "tianma,tl057fvxp01" },
+ { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, tianma_tl057fvxp01_of_match);
+
+static struct mipi_dsi_driver tianma_tl057fvxp01_driver = {
+ .probe = tianma_tl057fvxp01_probe,
+ .remove = tianma_tl057fvxp01_remove,
+ .driver = {
+ .name = "panel-tianma-tl057fvxp01",
+ .of_match_table = tianma_tl057fvxp01_of_match,
+ },
+};
+module_mipi_dsi_driver(tianma_tl057fvxp01_driver);
+
+MODULE_AUTHOR("Julian Braha <[email protected]>");
+MODULE_DESCRIPTION("Tianma TL057FVXP01 panel driver");
+MODULE_LICENSE("GPL v2");
--
2.30.2

2021-10-27 21:36:03

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH RESEND v2 2/2] drm/panel/tianma-tl057fvxp01: add panel for Motorola Moto G6

Hi Julian,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on robh/for-next]
[also build test ERROR on linus/master v5.15-rc7]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Julian-Braha/dt-bindings-panel-simple-dsi-add-Tianma-TL057FVXP01/20211022-053527
base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: parisc-randconfig-s031-20211027 (attached as .config)
compiler: hppa-linux-gcc (GCC) 11.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://github.com/0day-ci/linux/commit/442609f70aeb8f5321b32055a026eed85609ccfe
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Julian-Braha/dt-bindings-panel-simple-dsi-add-Tianma-TL057FVXP01/20211022-053527
git checkout 442609f70aeb8f5321b32055a026eed85609ccfe
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=parisc SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

hppa-linux-ld: drivers/gpu/drm/panel/panel-tianma-tl057fvxp01.o: in function `tianma_tl057fvxp01_remove':
>> (.text+0x24): undefined reference to `mipi_dsi_detach'
hppa-linux-ld: drivers/gpu/drm/panel/panel-tianma-tl057fvxp01.o: in function `tianma_tl057fvxp01_probe':
>> (.text+0x228): undefined reference to `mipi_dsi_attach'
hppa-linux-ld: drivers/gpu/drm/panel/panel-tianma-tl057fvxp01.o: in function `tianma_tl057fvxp01_unprepare':
>> (.text+0x2fc): undefined reference to `mipi_dsi_dcs_set_display_off'
>> hppa-linux-ld: (.text+0x330): undefined reference to `mipi_dsi_dcs_enter_sleep_mode'
hppa-linux-ld: drivers/gpu/drm/panel/panel-tianma-tl057fvxp01.o: in function `tianma_tl057fvxp01_on.isra.0':
>> (.text+0x3f0): undefined reference to `mipi_dsi_dcs_write_buffer'
>> hppa-linux-ld: (.text+0x408): undefined reference to `mipi_dsi_dcs_write_buffer'
hppa-linux-ld: (.text+0x420): undefined reference to `mipi_dsi_dcs_write_buffer'
hppa-linux-ld: (.text+0x438): undefined reference to `mipi_dsi_dcs_write_buffer'
hppa-linux-ld: (.text+0x450): undefined reference to `mipi_dsi_dcs_write_buffer'
hppa-linux-ld: drivers/gpu/drm/panel/panel-tianma-tl057fvxp01.o:(.text+0x468): more undefined references to `mipi_dsi_dcs_write_buffer' follow
hppa-linux-ld: drivers/gpu/drm/panel/panel-tianma-tl057fvxp01.o: in function `tianma_tl057fvxp01_on.isra.0':
>> (.text+0x508): undefined reference to `mipi_dsi_dcs_exit_sleep_mode'
>> hppa-linux-ld: (.text+0x53c): undefined reference to `mipi_dsi_dcs_set_display_on'
hppa-linux-ld: drivers/gpu/drm/panel/panel-tianma-tl057fvxp01.o: in function `tianma_tl057fvxp01_driver_init':
>> (.init.text+0x24): undefined reference to `mipi_dsi_driver_register_full'
hppa-linux-ld: drivers/gpu/drm/panel/panel-tianma-tl057fvxp01.o: in function `tianma_tl057fvxp01_driver_exit':
>> (.exit.text+0x10): undefined reference to `mipi_dsi_driver_unregister'

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (3.59 kB)
.config.gz (23.47 kB)
Download all attachments

2021-10-27 21:38:15

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH RESEND v2 2/2] drm/panel/tianma-tl057fvxp01: add panel for Motorola Moto G6

Hi Julian,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on robh/for-next]
[also build test ERROR on linus/master v5.15-rc7 next-20211027]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Julian-Braha/dt-bindings-panel-simple-dsi-add-Tianma-TL057FVXP01/20211022-053527
base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: mips-randconfig-c023-20211027 (attached as .config)
compiler: mips-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/442609f70aeb8f5321b32055a026eed85609ccfe
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Julian-Braha/dt-bindings-panel-simple-dsi-add-Tianma-TL057FVXP01/20211022-053527
git checkout 442609f70aeb8f5321b32055a026eed85609ccfe
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=mips

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>, old ones prefixed by <<):

ERROR: modpost: "die" [drivers/watchdog/bcm63xx_wdt.ko] undefined!
>> ERROR: modpost: "mipi_dsi_driver_unregister" [drivers/gpu/drm/panel/panel-tianma-tl057fvxp01.ko] undefined!
>> ERROR: modpost: "mipi_dsi_driver_register_full" [drivers/gpu/drm/panel/panel-tianma-tl057fvxp01.ko] undefined!
>> ERROR: modpost: "mipi_dsi_dcs_set_display_on" [drivers/gpu/drm/panel/panel-tianma-tl057fvxp01.ko] undefined!
>> ERROR: modpost: "mipi_dsi_dcs_exit_sleep_mode" [drivers/gpu/drm/panel/panel-tianma-tl057fvxp01.ko] undefined!
>> ERROR: modpost: "mipi_dsi_dcs_write_buffer" [drivers/gpu/drm/panel/panel-tianma-tl057fvxp01.ko] undefined!
>> ERROR: modpost: "mipi_dsi_dcs_enter_sleep_mode" [drivers/gpu/drm/panel/panel-tianma-tl057fvxp01.ko] undefined!
>> ERROR: modpost: "mipi_dsi_dcs_set_display_off" [drivers/gpu/drm/panel/panel-tianma-tl057fvxp01.ko] undefined!
>> ERROR: modpost: "mipi_dsi_attach" [drivers/gpu/drm/panel/panel-tianma-tl057fvxp01.ko] undefined!
>> ERROR: modpost: "mipi_dsi_detach" [drivers/gpu/drm/panel/panel-tianma-tl057fvxp01.ko] undefined!

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (2.64 kB)
.config.gz (36.58 kB)
Download all attachments

2021-10-29 01:53:19

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH RESEND v2 1/2] dt-bindings: panel-simple-dsi: add Tianma TL057FVXP01

On Thu, 21 Oct 2021 17:34:44 -0400, Julian Braha wrote:
> Adds the bindings for the Tianma TL057FVXP01 DSI panel,
> found on the Motorola Moto G6.
>
> v2:
> Fixed accidental whitespace deletion.
>
> Signed-off-by: Julian Braha <[email protected]>
> ---
> .../devicetree/bindings/display/panel/panel-simple-dsi.yaml | 2 ++
> 1 file changed, 2 insertions(+)
>

Acked-by: Rob Herring <[email protected]>