Skip to contentSkip to conversation

Add support for the AUO A030JTN01 TFT LCD

PATCH Superseded Christophe Branchereau 3 participants 7 messages Dec 14, 2022 – Dec 15, 2022

Subsystems (4)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover Add support for the AUO A030JTN01 TFT LCD

Changes since v1:
fixed the dt-bindings maintainer email adress

dropped backlight, port, power-supply and reset-gpios as they're provided by panel-common.yaml as pointed by Krzysztof Kozlowski

changed reg: true to reg : maxItems: 1

Christophe Branchereau (2):
drm/panel: add the orisetech ota5601a
dt-bindings: display/panel: Add the Focaltech gpt3

 .../display/panel/focaltech,gpt3.yaml         |  56 +++
 drivers/gpu/drm/panel/Kconfig                 |   9 +
 drivers/gpu/drm/panel/Makefile                |   1 +
 .../gpu/drm/panel/panel-orisetech-ota5601a.c  | 351 ++++++++++++++++++
 4 files changed, 417 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/panel/focaltech,gpt3.yaml
 create mode 100644 drivers/gpu/drm/panel/panel-orisetech-ota5601a.c
Signature · 1 line
2.35.1
#1 lore raw

PATCH v2 1/2 drm/panel: add the orisetech ota5601a

Add the orisetech ota5601a ic driver

For now it only supports the focaltech gpt3 3" 640x480 ips panel found in the ylm rg300x handheld.

---
 drivers/gpu/drm/panel/Kconfig                 |   9 +
 drivers/gpu/drm/panel/Makefile                |   1 +
 .../gpu/drm/panel/panel-orisetech-ota5601a.c  | 351 ++++++++++++++++++
 3 files changed, 361 insertions(+)
 create mode 100644 drivers/gpu/drm/panel/panel-orisetech-ota5601a.c
drivers/gpu/drm/panel/Kconfig +9 -0
index a582ddd583c2..2f492e402cd1 100644
@@ -381,6 +381,15 @@ config DRM_PANEL_OLIMEX_LCD_OLINUXINO
 	  Say Y here if you want to enable support for Olimex Ltd.
 	  LCD-OLinuXino panel.
 
+config DRM_PANEL_ORISETECH_OTA5601A
+	tristate "Orise Technology ota5601a RGB/SPI panel"
+	depends on OF && SPI
+	depends on BACKLIGHT_CLASS_DEVICE
+	select REGMAP_SPI
+	help
+	  Say Y here if you want to enable support for the panels built
+	  around the Orise Technology OTA9601A display controller.
+
 config DRM_PANEL_ORISETECH_OTM8009A
 	tristate "Orise Technology otm8009a 480x800 dsi 2dl panel"
 	depends on OF
drivers/gpu/drm/panel/Makefile +1 -0
index 34e717382dbb..91d1870312af 100644
@@ -35,6 +35,7 @@ obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36672A) += panel-novatek-nt36672a.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
+obj-$(CONFIG_DRM_PANEL_ORISETECH_OTA5601A) += panel-orisetech-ota5601a.o
 obj-$(CONFIG_DRM_PANEL_ORISETECH_OTM8009A) += panel-orisetech-otm8009a.o
 obj-$(CONFIG_DRM_PANEL_OSD_OSD101T2587_53TS) += panel-osd-osd101t2587-53ts.o
 obj-$(CONFIG_DRM_PANEL_PANASONIC_VVX10F034N00) += panel-panasonic-vvx10f034n00.o
drivers/gpu/drm/panel/panel-orisetech-ota5601a.c new file +351 -0

351 lines not on this page · raw message

Signature · 1 line
2.35.1
#2 lore raw

Re: [PATCH v2 1/2] drm/panel: add the orisetech ota5601a

Hi Christophe,

thanks for your patch!

Quoted 6 lines · Christophe Branchereau

Add the orisetech ota5601a ic driver

For now it only supports the focaltech gpt3 3" 640x480 ips panel found in the ylm rg300x handheld.

(...)

drivers/gpu/drm/panel/Kconfig config DRM_PANEL_OLIMEX_LCD_OLINUXINO · line 388

Quoted 5 lines
drivers/gpu/drm/panel/Kconfig +5 -0
+config DRM_PANEL_ORISETECH_OTA5601A
+       tristate "Orise Technology ota5601a RGB/SPI panel"
+       depends on OF && SPI
+       depends on BACKLIGHT_CLASS_DEVICE
+       select REGMAP_SPI

Nice use of regmap in this driver.

Quoted 48 lines
drivers/gpu/drm/panel/panel-orisetech-ota5601a.c new file +48 -0
+static const struct reg_sequence ota5601a_panel_regs[] = {
+       { 0xfd, 0x00 },
+       { 0x02, 0x00 },
+
+       { 0x18, 0x00 },
+       { 0x34, 0x20 },
+
+       { 0x0c, 0x01 },
+       { 0x0d, 0x48 },
+       { 0x0e, 0x48 },
+       { 0x0f, 0x48 },
+       { 0x07, 0x40 },
+       { 0x08, 0x33 },
+       { 0x09, 0x3a },
+
+       { 0x16, 0x01 },
+       { 0x19, 0x8d },
+       { 0x1a, 0x28 },
+       { 0x1c, 0x00 },
+
+       { 0xfd, 0xc5 },
+       { 0x82, 0x0c },
+       { 0xa2, 0xb4 },
+
+       { 0xfd, 0xc4 },
+       { 0x82, 0x45 },
+
+       { 0xfd, 0xc1 },
+       { 0x91, 0x02 },
+
+       { 0xfd, 0xc0 },
+       { 0xa1, 0x01 },
+       { 0xa2, 0x1f },
+       { 0xa3, 0x0b },
+       { 0xa4, 0x38 },
+       { 0xa5, 0x00 },
+       { 0xa6, 0x0a },
+       { 0xa7, 0x38 },
+       { 0xa8, 0x00 },
+       { 0xa9, 0x0a },
+       { 0xaa, 0x37 },
+
+       { 0xfd, 0xce },
+       { 0x81, 0x18 },
+       { 0x82, 0x43 },
+       { 0x83, 0x43 },
+       { 0x91, 0x06 },
+       { 0x93, 0x38 },

drivers/gpu/drm/panel/panel-orisetech-ota5601a.c line 100

Quoted 10 lines
drivers/gpu/drm/panel/panel-orisetech-ota5601a.c new file +10 -0
+       { 0x94, 0x02 },
+       { 0x95, 0x06 },
+       { 0x97, 0x38 },
+       { 0x98, 0x02 },
+       { 0x99, 0x06 },
+       { 0x9b, 0x38 },
+       { 0x9c, 0x02 },
+
+       { 0xfd, 0x00 },
+};

If these are registers, why is register 0xfd written 7 times with different values?

This is rather a jam table or intializations sequence, so it should be names something like that and a comment about undocumented registers added probably as well.

drivers/gpu/drm/panel/panel-orisetech-ota5601a.c line 157

Quoted 6 lines
drivers/gpu/drm/panel/panel-orisetech-ota5601a.c new file +6 -0
+static int ota5601a_enable(struct drm_panel *drm_panel)
+{
+       struct ota5601a *panel = to_ota5601a(drm_panel);
+       int err;
+
+       err = regmap_write(panel->map, 0x01, 0x01);

Since you know what this register does, what about:

#include <linux/bits.h>

#define OTA5601A_CTL 0x01
#define OTA5601A_CTL_OFF 0x00
#define OTA5601A_CTL_ON BIT(0)

Quoted 8 lines
drivers/gpu/drm/panel/panel-orisetech-ota5601a.c new file +8 -0
+static int ota5601a_get_modes(struct drm_panel *drm_panel,
+                            struct drm_connector *connector)
+{
+       struct ota5601a *panel = to_ota5601a(drm_panel);
+       const struct ota5601a_panel_info *panel_info = panel->panel_info;
+       struct drm_display_mode *mode;
+       unsigned int i;
+

drivers/gpu/drm/panel/panel-orisetech-ota5601a.c line 204

Quoted 10 lines
drivers/gpu/drm/panel/panel-orisetech-ota5601a.c new file +10 -0
+       for (i = 0; i < panel_info->num_modes; i++) {
+               mode = drm_mode_duplicate(connector->dev,
+                                         &panel_info->display_modes[i]);
+               if (!mode)
+                       return -ENOMEM;
+
+               drm_mode_set_name(mode);
+
+               mode->type = DRM_MODE_TYPE_DRIVER;
+               if (panel_info->num_modes == 1)

But ... you have just added an array that contains 2 elements, you KNOW it will not be 1.

Quoted 1 line

+ mode->type |= DRM_MODE_TYPE_PREFERRED;

I think you should probably set this on the preferred resolution anyways, take the one you actually use.

drivers/gpu/drm/panel/panel-orisetech-ota5601a.c line 337

Quoted 5 lines
drivers/gpu/drm/panel/panel-orisetech-ota5601a.c new file +5 -0
+static const struct of_device_id ota5601a_of_match[] = {
+       { .compatible = "focaltech,gpt3", .data = &gpt3_info },
+       { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, ota5601a_of_match);

Does this mean the display controller is ota5601a and the display manufacturer and product is focaltech gpt3? Then it's fine.

Overall the driver looks very good, just the above little details.

Yours,
Linus Walleij

#3 lore raw

Re: [PATCH v2 1/2] drm/panel: add the orisetech ota5601a

Hello Linus

Quoted 76 lines · Linus Walleij

Hi Christophe,

thanks for your patch!

Quoted 6 lines · Christophe Branchereau

Add the orisetech ota5601a ic driver

For now it only supports the focaltech gpt3 3" 640x480 ips panel found in the ylm rg300x handheld.

(...)

drivers/gpu/drm/panel/Kconfig config DRM_PANEL_OLIMEX_LCD_OLINUXINO · line 388

Quoted 5 lines
drivers/gpu/drm/panel/Kconfig +5 -0
+config DRM_PANEL_ORISETECH_OTA5601A
+       tristate "Orise Technology ota5601a RGB/SPI panel"
+       depends on OF && SPI
+       depends on BACKLIGHT_CLASS_DEVICE
+       select REGMAP_SPI

Nice use of regmap in this driver.

Quoted 53 lines
drivers/gpu/drm/panel/panel-orisetech-ota5601a.c new file +53 -0
+static const struct reg_sequence ota5601a_panel_regs[] = {
+       { 0xfd, 0x00 },
+       { 0x02, 0x00 },
+
+       { 0x18, 0x00 },
+       { 0x34, 0x20 },
+
+       { 0x0c, 0x01 },
+       { 0x0d, 0x48 },
+       { 0x0e, 0x48 },
+       { 0x0f, 0x48 },
+       { 0x07, 0x40 },
+       { 0x08, 0x33 },
+       { 0x09, 0x3a },
+
+       { 0x16, 0x01 },
+       { 0x19, 0x8d },
+       { 0x1a, 0x28 },
+       { 0x1c, 0x00 },
+
+       { 0xfd, 0xc5 },
+       { 0x82, 0x0c },
+       { 0xa2, 0xb4 },
+
+       { 0xfd, 0xc4 },
+       { 0x82, 0x45 },
+
+       { 0xfd, 0xc1 },
+       { 0x91, 0x02 },
+
+       { 0xfd, 0xc0 },
+       { 0xa1, 0x01 },
+       { 0xa2, 0x1f },
+       { 0xa3, 0x0b },
+       { 0xa4, 0x38 },
+       { 0xa5, 0x00 },
+       { 0xa6, 0x0a },
+       { 0xa7, 0x38 },
+       { 0xa8, 0x00 },
+       { 0xa9, 0x0a },
+       { 0xaa, 0x37 },
+
+       { 0xfd, 0xce },
+       { 0x81, 0x18 },
+       { 0x82, 0x43 },
+       { 0x83, 0x43 },
+       { 0x91, 0x06 },
+       { 0x93, 0x38 },
+       { 0x94, 0x02 },
+       { 0x95, 0x06 },
+       { 0x97, 0x38 },
+       { 0x98, 0x02 },
+       { 0x99, 0x06 },
Quoted 8 lines

drivers/gpu/drm/panel/panel-orisetech-ota5601a.c line 100

Quoted 5 lines
drivers/gpu/drm/panel/panel-orisetech-ota5601a.c new file +5 -0
+       { 0x9b, 0x38 },
+       { 0x9c, 0x02 },
+
+       { 0xfd, 0x00 },
+};

If these are registers, why is register 0xfd written 7 times with different values?

It initiates a page shift

Quoted 3 lines

This is rather a jam table or intializations sequence, so it should be names something like that and a comment about undocumented registers added probably as well.

Honestly I don't remember how I got the panel specsheet, thought it was widely available but I can't find it anymore online, so yes I guess at least documenting what each page does could be good for future reference

Quoted 9 lines

drivers/gpu/drm/panel/panel-orisetech-ota5601a.c line 157

Quoted 6 lines
drivers/gpu/drm/panel/panel-orisetech-ota5601a.c new file +6 -0
+static int ota5601a_enable(struct drm_panel *drm_panel)
+{
+       struct ota5601a *panel = to_ota5601a(drm_panel);
+       int err;
+
+       err = regmap_write(panel->map, 0x01, 0x01);

Since you know what this register does, what about:

Quoted 5 lines

#include <linux/bits.h>

#define OTA5601A_CTL 0x01
#define OTA5601A_CTL_OFF 0x00
#define OTA5601A_CTL_ON BIT(0)

I can definitely do that if it improves clarity

Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/panel/panel-orisetech-ota5601a.c new file +13 -0
+static int ota5601a_get_modes(struct drm_panel *drm_panel,
+                            struct drm_connector *connector)
+{
+       struct ota5601a *panel = to_ota5601a(drm_panel);
+       const struct ota5601a_panel_info *panel_info = panel->panel_info;
+       struct drm_display_mode *mode;
+       unsigned int i;
+
+       for (i = 0; i < panel_info->num_modes; i++) {
+               mode = drm_mode_duplicate(connector->dev,
+                                         &panel_info->display_modes[i]);
+               if (!mode)
+                       return -ENOMEM;
Quoted 8 lines

drivers/gpu/drm/panel/panel-orisetech-ota5601a.c line 204

Quoted 5 lines
drivers/gpu/drm/panel/panel-orisetech-ota5601a.c new file +5 -0
+
+               drm_mode_set_name(mode);
+
+               mode->type = DRM_MODE_TYPE_DRIVER;
+               if (panel_info->num_modes == 1)

But ... you have just added an array that contains 2 elements, you KNOW it will not be 1.

I know that for the specific panel supported by this driver there are 2 modes, however in the future someone could want to add a panel using the same IC, which could have any number of modes

Quoted 6 lines
Quoted 2 lines

+ mode->type |= DRM_MODE_TYPE_PREFERRED;

I think you should probably set this on the preferred resolution anyways, take the one you actually use.

Quoted 8 lines

drivers/gpu/drm/panel/panel-orisetech-ota5601a.c line 337

Quoted 5 lines
drivers/gpu/drm/panel/panel-orisetech-ota5601a.c new file +5 -0
+static const struct of_device_id ota5601a_of_match[] = {
+       { .compatible = "focaltech,gpt3", .data = &gpt3_info },
+       { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, ota5601a_of_match);

Does this mean the display controller is ota5601a and the display manufacturer and product is focaltech gpt3? Then it's fine.

Yes

Quoted 1 line

Overall the driver looks very good, just the above little details.

Ok, will do the v3 next week, holidays etc :)

Quoted 2 lines

Yours,
Linus Walleij

#4 lore raw

PATCH v2 2/2 dt-bindings: display/panel: Add the Focaltech gpt3

In reply to Christophe Branchereau

Add bindings for the Forcaltech gpt3, which is a 640x480 3.0" 4:3 IPS LCD Panel found in the YLM/Anbernic RG300X handheld.

---
 .../display/panel/focaltech,gpt3.yaml         | 56 +++++++++++++++++++
 1 file changed, 56 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/panel/focaltech,gpt3.yaml
Documentation/devicetree/bindings/display/panel/focaltech,gpt3.yaml new file +56 -0
new file mode 100644
index 000000000000..d54e96b2a9e1
@@ -0,0 +1,56 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/panel/focaltech,gpt3.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Focaltech GPT3 3.0" (640x480 pixels) IPS LCD panel
+
+maintainers:
+  - Christophe Branchereau <[email protected]>
+
+allOf:
+  - $ref: panel-common.yaml#
+  - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+properties:
+  compatible:
+    const: focaltech,gpt3
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - power-supply
+  - reset-gpios
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    spi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        panel@0 {
+            compatible = "focaltech,gpt3";
+            reg = <0>;
+
+            spi-max-frequency = <3125000>;
+
+            reset-gpios = <&gpe 2 GPIO_ACTIVE_LOW>;
+
+            backlight = <&backlight>;
+            power-supply = <&vcc>;
+
+            port {
+                panel_input: endpoint {
+                    remote-endpoint = <&panel_output>;
+                };
+            };
+        };
+    };
Signature · 1 line
2.35.1
#6 lore raw
In reply to Christophe Branchereau

Wrong cover title, should be "Add support for the orisetech ota5601" sorry...

Quoted 24 lines · Christophe Branchereau

Changes since v1:
fixed the dt-bindings maintainer email adress

dropped backlight, port, power-supply and reset-gpios as they're provided by panel-common.yaml as pointed by Krzysztof Kozlowski

changed reg: true to reg : maxItems: 1

Christophe Branchereau (2):
drm/panel: add the orisetech ota5601a
dt-bindings: display/panel: Add the Focaltech gpt3

 .../display/panel/focaltech,gpt3.yaml         |  56 +++
 drivers/gpu/drm/panel/Kconfig                 |   9 +
 drivers/gpu/drm/panel/Makefile                |   1 +
 .../gpu/drm/panel/panel-orisetech-ota5601a.c  | 351 ++++++++++++++++++
 4 files changed, 417 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/panel/focaltech,gpt3.yaml
 create mode 100644 drivers/gpu/drm/panel/panel-orisetech-ota5601a.c

--
2.35.1