Skip to contentSkip to conversation

dt-bindings: panel: Add Samsung S6E3FA2 panel

PATCH In review Iskren Chernev 3 participants 6 messages Feb 1, 2021 – Jul 26, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/2 dt-bindings: panel: Add Samsung S6E3FA2 panel

The Samsung S6E3FA2 AMOLED cmd LCD panel is used on the Samsung Galaxy S5 (klte).

---
Add a simple generated panel driver that supports on/off and the corresponding binding documentation.

Changes in v3:
- fix dt_binding_check issue with missing include
- fix panel type (cmd) in kconfig description

Changes in v2:
- move bindings to separate file, add 2 regulators
- add standalone panel driver

v1: https://lkml.org/lkml/2020/12/30/293
v2: https://lkml.org/lkml/2021/2/1/313

 .../display/panel/samsung,s6e3fa2.yaml        | 64 +++++++++++++++++++
 1 file changed, 64 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/panel/samsung,s6e3fa2.yaml
Documentation/devicetree/bindings/display/panel/samsung,s6e3fa2.yaml new file +64 -0
new file mode 100644
index 000000000000..c751ad589480
@@ -0,0 +1,64 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/panel/samsung,s6e3fa2.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Samsung s6e3fa2 AMOLED CMD LCD panel
+
+maintainers:
+  - Iskren Chernev <[email protected]>
+
+allOf:
+  - $ref: panel-common.yaml#
+
+properties:
+  compatible:
+    const: samsung,s6e3fa2
+
+  reg: true
+  reset-gpios: true
+  port: true
+
+  iovdd-supply:
+    description: IOVDD regulator
+
+  vddr-supply:
+    description: VDDR regulator
+
+required:
+  - compatible
+  - reset-gpios
+  - iovdd-supply
+  - vddr-supply
+  - port
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    /* from Samsung Galaxy S5 klte */
+    #include <dt-bindings/gpio/gpio.h>
+
+    dsi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        panel@0 {
+            compatible = "samsung,s6e3fa2";
+            reg = <0>;
+
+            reset-gpios = <&pma8084_gpios 17 GPIO_ACTIVE_LOW>;
+
+            iovdd-supply = <&pma8084_lvs4>;
+            vddr-supply = <&vreg_panel>;
+
+            port {
+                panel_in: endpoint {
+                    remote-endpoint = <&dsi0_out>;
+                };
+            };
+        };
+    };
+
+...

base-commit: fd821bf0ed9a7db09d2e007df697f4d9ecfda99a --
2.30.0

#1 lore raw

PATCH v3 2/2 drm/panel: Add panel for Samsung Galaxy S5

The Samsung Galaxy S5 uses the samsung s6e3fa2 AMOLED cmd LCD panel.

This driver was generated with [1], with the addition of mipi_dsi_dcs_set_display_on at the end of the on method.

[1] https://github.com/msm8916-mainline/linux-mdss-dsi-panel-driver-generator

---
 drivers/gpu/drm/panel/Kconfig                 |   6 +
 drivers/gpu/drm/panel/Makefile                |   1 +
 drivers/gpu/drm/panel/panel-samsung-s6e3fa2.c | 299 ++++++++++++++++++
 3 files changed, 306 insertions(+)
 create mode 100644 drivers/gpu/drm/panel/panel-samsung-s6e3fa2.c
drivers/gpu/drm/panel/Kconfig +6 -0
index 4894913936e9..82dff2afd5f1 100644
@@ -348,6 +348,12 @@ config DRM_PANEL_SAMSUNG_S6D16D0
 	depends on DRM_MIPI_DSI
 	select VIDEOMODE_HELPERS
 
+config DRM_PANEL_SAMSUNG_S6E3FA2
+	tristate "Samsung S6E3FA2 DSI cmd mode panel"
+	depends on OF
+	depends on DRM_MIPI_DSI
+	select VIDEOMODE_HELPERS
+
 config DRM_PANEL_SAMSUNG_S6E3HA2
 	tristate "Samsung S6E3HA2 DSI video mode panel"
 	depends on OF
drivers/gpu/drm/panel/Makefile +1 -0
index cae4d976c069..87d3f76f050e 100644
@@ -35,6 +35,7 @@ obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM68200) += panel-raydium-rm68200.o
 obj-$(CONFIG_DRM_PANEL_RONBO_RB070D30) += panel-ronbo-rb070d30.o
 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_S6E3FA2) += panel-samsung-s6e3fa2.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
drivers/gpu/drm/panel/panel-samsung-s6e3fa2.c new file +299 -0

299 lines not on this page · raw message

Signature · 1 line
2.30.0
#2 lore raw

Re: [PATCH v3 2/2] drm/panel: Add panel for Samsung Galaxy S5

Hi Iskren,

thanks for your patch!

Quoted 8 lines · Iskren Chernev

The Samsung Galaxy S5 uses the samsung s6e3fa2 AMOLED cmd LCD panel.

This driver was generated with [1], with the addition of mipi_dsi_dcs_set_display_on at the end of the on method.

[1] https://github.com/msm8916-mainline/linux-mdss-dsi-panel-driver-generator

(...)

drivers/gpu/drm/panel/Kconfig config DRM_PANEL_SAMSUNG_S6D16D0 · line 352

Quoted 2 lines
drivers/gpu/drm/panel/Kconfig +2 -0
+config DRM_PANEL_SAMSUNG_S6E3FA2
+       tristate "Samsung S6E3FA2 DSI cmd mode panel"

Spell it out "command mode" no need to abbreviate.

drivers/gpu/drm/panel/panel-samsung-s6e3fa2.c line 21

Quoted 6 lines
drivers/gpu/drm/panel/panel-samsung-s6e3fa2.c new file +6 -0
+struct samsung_s6e3fa2 {
+       struct drm_panel panel;
+       struct mipi_dsi_device *dsi;
+       struct regulator_bulk_data supplies[2];
+       struct gpio_desc *reset_gpio;
+       bool prepared;

Why do you need to keep track of prepared?
The framework already does that and that is why it keeps different callbacks for prepare and enable.

Quoted 5 lines
drivers/gpu/drm/panel/panel-samsung-s6e3fa2.c new file +5 -0
+#define dsi_generic_write_seq(dsi, seq...) do {                                \
+               static const u8 d[] = { seq };                          \
+               int ret;                                                \
+               ret = mipi_dsi_generic_write(dsi, d, ARRAY_SIZE(d));    \
+               if (ret < 0)                                            \

drivers/gpu/drm/panel/panel-samsung-s6e3fa2.c line 44

Quoted 10 lines
drivers/gpu/drm/panel/panel-samsung-s6e3fa2.c new file +10 -0
+                       return ret;                                     \
+       } while (0)
+
+#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)

Maybe this is something we should add to
include/drm/drm_mipi_dsi.h?
It looks very generic and helpful.

drivers/gpu/drm/panel/panel-samsung-s6e3fa2.c line 49

Quoted 4 lines
drivers/gpu/drm/panel/panel-samsung-s6e3fa2.c new file +4 -0
+static void samsung_s6e3fa2_reset(struct samsung_s6e3fa2 *ctx)
+{
+       gpiod_set_value_cansleep(ctx->reset_gpio, 0);
+       usleep_range(5000, 6000);

There is really no need to do this, the next statement asserts reset. It looks like a copy/paste thing from a less informed framework.

drivers/gpu/drm/panel/panel-samsung-s6e3fa2.c line 53

Quoted 4 lines
drivers/gpu/drm/panel/panel-samsung-s6e3fa2.c new file +4 -0
+       gpiod_set_value_cansleep(ctx->reset_gpio, 1);
+       usleep_range(5000, 6000);
+       gpiod_set_value_cansleep(ctx->reset_gpio, 0);
+       usleep_range(7000, 8000);

These two look good.

drivers/gpu/drm/panel/panel-samsung-s6e3fa2.c line 65

Quoted 10 lines
drivers/gpu/drm/panel/panel-samsung-s6e3fa2.c new file +10 -0
+static int samsung_s6e3fa2_on(struct samsung_s6e3fa2 *ctx)
+{
+       struct mipi_dsi_device *dsi = ctx->dsi;
+       struct device *dev = &dsi->dev;
+       int ret;
+
+       dsi->mode_flags |= MIPI_DSI_MODE_LPM;
+
+       dsi_generic_write_seq(dsi, 0xf0, 0x5a, 0x5a);
+       dsi_generic_write_seq(dsi, 0xfc, 0x5a, 0x5a);

These are very similar to other Samsung panels so you can definately add this to your driver:

#define S6E3FA2_LEVEL_2_KEY 0xf0

drivers/gpu/drm/panel/panel-samsung-s6e3fa2.c line 98

Quoted 2 lines
drivers/gpu/drm/panel/panel-samsung-s6e3fa2.c new file +2 -0
+       dsi_generic_write_seq(dsi, 0xf0, 0xa5, 0xa5);
+       dsi_generic_write_seq(dsi, 0xfc, 0xa5, 0xa5);

Add a comment that this locks level 2 control again.

drivers/gpu/drm/panel/panel-samsung-s6e3fa2.c line 141

Quoted 8 lines
drivers/gpu/drm/panel/panel-samsung-s6e3fa2.c new file +8 -0
+static int samsung_s6e3fa2_prepare(struct drm_panel *panel)
+{
+       struct samsung_s6e3fa2 *ctx = to_samsung_s6e3fa2(panel);
+       struct device *dev = &ctx->dsi->dev;
+       int ret;
+
+       if (ctx->prepared)
+               return 0;

Looks unnecessary. The framework should keep track of this.

drivers/gpu/drm/panel/panel-samsung-s6e3fa2.c line 250

Quoted 4 lines
drivers/gpu/drm/panel/panel-samsung-s6e3fa2.c new file +4 -0
+       dsi->lanes = 4;
+       dsi->format = MIPI_DSI_FMT_RGB888;
+       dsi->mode_flags = MIPI_DSI_MODE_VIDEO_BURST |
+                         MIPI_DSI_CLOCK_NON_CONTINUOUS;

You are not setting dsi->hs_rate and dsi->lp_rate. The panel definitely has these max timings so when you don't set them the DSI host will just go with some defaults (some of them don't even allow you to configure this).

For reusability it would be great if you know roughly what these clocks are, sometimes board files in vendor trees give a hint.

Worst case drop a comment that HS and LP rates are unknown.

I also wonder if the panel can report an MTP ID?

If you add some code like this and call from prepare(), what happens?

#define READ_ID1                 0xda /* Read panel ID 1 */
#define READ_ID2                 0xdb /* Read panel ID 2 */
#define READ_ID3                 0xdc /* Read panel ID 3 */

static int s6e3fa2_read_id(struct samsung_s6e3fa2 *ctx)

{
        struct mipi_dsi_device *dsi = ctx->dsi;
        struct device *dev = &dsi->dev;
        u8 id1, id2, id3;
        int ret;

        ret = mipi_dsi_dcs_read(dsi, READ_ID1, &id1, 1);
        if (ret < 0) {
                dev_err(dev, "could not read MTP ID1\n");
                return ret;
        }
        ret = mipi_dsi_dcs_read(dsi, READ_ID2, &id2, 1);
        if (ret < 0) {
                dev_err(dev, "could not read MTP ID2\n");
                return ret;
        }
        ret = mipi_dsi_dcs_read(dsi, READ_ID3, &id3, 1);
        if (ret < 0) {
                dev_err(dev, "could not read MTP ID3\n");
                return ret;
        }

        dev_info(dev, "MTP ID manufacturer: %02x version: %02x driver:

%02x\n", id1, id2, id3);

        return 0;
}

(Dry coded, but you get the idea.)

Yours,
Linus Walleij

#3 lore raw

Re: [PATCH v3 2/2] drm/panel: Add panel for Samsung Galaxy S5

Quoted 3 lines · Linus Walleij

Hi Iskren,

thanks for your patch!

Thanks a lot for reviewing this. Alexey wrote a new version of the patch [1] that was recently reviewed by Sam, and it also includes support for brightness and another panel found on the S5. My patch is pretty much untouched out of the panel driver generator, so we can definitely improve the generated code based on your comments.

[1] https://lists.freedesktop.org/archives/dri-devel/2021-July/316804.html

I guess Alexey will submit a new version with the two panels split, and he might incorporate your suggestions (as his code comes from the generator as well).

Regards,
Iskren

maintainer Reviewed-by on v3 1/2
#4 lore raw
In reply to Iskren Chernev
Quoted 16 lines · Iskren Chernev

The Samsung S6E3FA2 AMOLED cmd LCD panel is used on the Samsung Galaxy S5 (klte).

---
Add a simple generated panel driver that supports on/off and the corresponding binding documentation.

Changes in v3:
- fix dt_binding_check issue with missing include
- fix panel type (cmd) in kconfig description

Changes in v2:
- move bindings to separate file, add 2 regulators
- add standalone panel driver

Quoted 7 lines

v1: https://lkml.org/lkml/2020/12/30/293
v2: https://lkml.org/lkml/2021/2/1/313

 .../display/panel/samsung,s6e3fa2.yaml        | 64 +++++++++++++++++++
 1 file changed, 64 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/panel/samsung,s6e3fa2.yaml

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#5 lore raw
In reply to Iskren Chernev

Hi Iskren,

thanks for your patch!

Documentation/devicetree/bindings/display/panel/samsung,s6e3fa2.yaml line 34

Quoted 6 lines · Iskren Chernev
Documentation/devicetree/bindings/display/panel/samsung,s6e3fa2.yaml new file +6 -0
+required:
+  - compatible
+  - reset-gpios
+  - iovdd-supply
+  - vddr-supply
+  - port

I do not think port should be required because the DSI framework allows panels to be put as children right inside the DSI controller node without any port linking the two.

Other than that it looks good!

Yours,
Linus Walleij