Skip to contentSkip to conversation

Add Samsung S6D7AA0 panel controller driver

PATCH Superseded Artur Weber 3 participants 8 messages Apr 16, 2023 – Apr 22, 2023

Subsystems (5)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Artur Weber

author maintainer
#0 lore raw

v3 cover Add Samsung S6D7AA0 panel controller driver

This patchset adds initial support for Samsung S6D7AA0-based panels. Currently, only the S6D7AA0-LSL080AL02 panel used in the Samsung Galaxy Tab 3 8.0 family of tablets is supported; other panels can be added in the future.

Changed in v2:
- Added commit messages for dt-bindings and MAINTAINERS entry commits
- dt-bindings: Applied suggestions from Krzysztof Kozlowski
- driver: Removed unused panel_name property from desc struct

Changed in v3:
- Correctly applied patch for dt-bindings

Artur Weber (3):
dt-bindings: display: panel: Add Samsung S6D7AA0 LCD panel controller drm/panel: Add Samsung S6D7AA0 panel controller driver
MAINTAINERS: Add entry for Samsung S6D7AA0 LCD panel controller driver

 .../display/panel/samsung,s6d7aa0.yaml        |  52 +++
 MAINTAINERS                                   |   6 +
 drivers/gpu/drm/panel/Kconfig                 |   7 +
 drivers/gpu/drm/panel/Makefile                |   1 +
 drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c | 395 ++++++++++++++++++
 5 files changed, 461 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/panel/samsung,s6d7aa0.yaml
 create mode 100644 drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c
Signature · 1 line
2.40.0
author maintainer
#1 lore raw

PATCH v3 1/3 dt-bindings: display: panel: Add Samsung S6D7AA0 LCD panel controller

Add bindings for the S6D7AA0 LCD panel controller, including the S6D7AA0-LSL080AL02 panel used in the Samsung Galaxy Tab 3 8.0 family of tablets.

---
Changed in v2:
- Updated commit message
- Applied suggestions from Krzysztof Kozlowski
Changed in v3:
- Correctly applied suggestions

---
 .../display/panel/samsung,s6d7aa0.yaml        | 52 +++++++++++++++++++
 1 file changed, 52 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/panel/samsung,s6d7aa0.yaml
Documentation/devicetree/bindings/display/panel/samsung,s6d7aa0.yaml new file +52 -0
new file mode 100644
index 000000000000..079e2b3a9eaf
@@ -0,0 +1,52 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/panel/samsung,s6d7aa0.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Samsung S6D7AA0 MIPI-DSI LCD panel controller
+
+maintainers:
+  - Artur Weber <[email protected]>
+
+allOf:
+  - $ref: panel-common.yaml#
+
+properties:
+  compatible:
+    const: samsung,s6d7aa0-lsl080al02
+
+  reg: true
+  reset-gpios: true
+  backlight: true
+
+  enable-supply:
+    description: Enable supply
+
+required:
+  - compatible
+  - reg
+  - reset-gpios
+  - backlight
+  - enable-supply
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    dsi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        panel@0 {
+            compatible = "samsung,s6d7aa0-lsl080al02";
+            reg = <0>;
+            reset-gpios = <&gpf0 4 GPIO_ACTIVE_LOW>;
+            backlight = <&backlight>;
+            enable-supply = <&lcd_enable_supply>;
+        };
+    };
+
+...
Signature · 1 line
2.40.0
author maintainer
#4 lore raw

PATCH v3 2/3 drm/panel: Add Samsung S6D7AA0 panel controller driver

In reply to Artur Weber

Initial driver for S6D7AA0-controlled panels, currently only for the LSL080AL02 panel used in the Samsung Galaxy Tab 3 8.0 family of tablets.

It should be possible to extend this driver to work with other panels using this IC.

---
Changed in v2:
- Removed unused panel_name property from desc struct

---
 drivers/gpu/drm/panel/Kconfig                 |   7 +
 drivers/gpu/drm/panel/Makefile                |   1 +
 drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c | 395 ++++++++++++++++++
 3 files changed, 403 insertions(+)
 create mode 100644 drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c
drivers/gpu/drm/panel/Kconfig +7 -0
index 8eeee71c0000..2ce9d1a45625 100644
@@ -532,6 +532,13 @@ config DRM_PANEL_SAMSUNG_S6D27A1
 	  This panel can be found in Samsung Galaxy Ace 2
 	  GT-I8160 mobile phone.
 
+config DRM_PANEL_SAMSUNG_S6D7AA0
+	tristate "Samsung S6D7AA0 MIPI-DSI video mode panel controller"
+	depends on OF
+	depends on BACKLIGHT_CLASS_DEVICE
+	select 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 c05aa9e23907..193f3067865d 100644
@@ -52,6 +52,7 @@ obj-$(CONFIG_DRM_PANEL_SAMSUNG_DB7430) += panel-samsung-db7430.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_S6D27A1) += panel-samsung-s6d27a1.o
+obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6D7AA0) += panel-samsung-s6d7aa0.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-s6d7aa0.c new file +395 -0

395 lines not on this page · raw message

Signature · 1 line
2.40.0
author maintainer
#7 lore raw

PATCH v3 3/3 MAINTAINERS: Add entry for Samsung S6D7AA0 LCD panel controller driver

In reply to Artur Weber

Add myself as maintainer of the Samsung S6D7AA0 panel driver.

---
 MAINTAINERS | 6 ++++++
 1 file changed, 6 insertions(+)
MAINTAINERS +6 -0
index 90abe83c02f3..6a55e6e3ac59 100644
@@ -6623,6 +6623,12 @@ S:	Maintained
 F:	Documentation/devicetree/bindings/display/panel/samsung,s6d27a1.yaml
 F:	drivers/gpu/drm/panel/panel-samsung-s6d27a1.c
 
+DRM DRIVER FOR SAMSUNG S6D7AA0 PANELS
+M:	Artur Weber <[email protected]>
+S:	Maintained
+F:	Documentation/devicetree/bindings/display/panel/samsung,s6d7aa0.yaml
+F:	drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c
+
 DRM DRIVER FOR SITRONIX ST7703 PANELS
 M:	Guido Günther <[email protected]>
 R:	Purism Kernel Team <[email protected]>
Signature · 1 line
2.40.0
maintainer
#2 lore raw

Re: [PATCH v3 1/3] dt-bindings: display: panel: Add Samsung S6D7AA0 LCD panel controller

In reply to Artur Weber
Quoted 36 lines · Artur Weber

Add bindings for the S6D7AA0 LCD panel controller, including the S6D7AA0-LSL080AL02 panel used in the Samsung Galaxy Tab 3 8.0 family of tablets.

---
Changed in v2:
- Updated commit message
- Applied suggestions from Krzysztof Kozlowski
Changed in v3:
- Correctly applied suggestions

---
 .../display/panel/samsung,s6d7aa0.yaml        | 52 +++++++++++++++++++
 1 file changed, 52 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/panel/samsung,s6d7aa0.yaml
Documentation/devicetree/bindings/display/panel/samsung,s6d7aa0.yaml new file +14 -0
new file mode 100644
index 000000000000..079e2b3a9eaf
@@ -0,0 +1,52 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/panel/samsung,s6d7aa0.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Samsung S6D7AA0 MIPI-DSI LCD panel controller
+
+maintainers:
+  - Artur Weber <[email protected]>
+
+allOf:
+  - $ref: panel-common.yaml#
+

Documentation/devicetree/bindings/display/panel/samsung,s6d7aa0.yaml line 24

Quoted 10 lines
Documentation/devicetree/bindings/display/panel/samsung,s6d7aa0.yaml new file +10 -0
+properties:
+  compatible:
+    const: samsung,s6d7aa0-lsl080al02
+
+  reg: true
+  reset-gpios: true
+  backlight: true
+
+  enable-supply:
+    description: Enable supply

Comments on v1 apply here.

Rob

#3 lore raw

Re: [PATCH v3 1/3] dt-bindings: display: panel: Add Samsung S6D7AA0 LCD panel controller

In reply to Artur Weber

Hi Artur,

thanks for your patch!

Quoted 5 lines · Artur Weber

Add bindings for the S6D7AA0 LCD panel controller, including the S6D7AA0-LSL080AL02 panel used in the Samsung Galaxy Tab 3 8.0 family of tablets.

(...)

Quoted 1 line

+ reset-gpios: true

(...)

Quoted 1 line

+ reset-gpios = <&gpf0 4 GPIO_ACTIVE_LOW>;

Since reset-gpios is always active low, add a description: to reset-gpios saying that it should nominally be tagged GPIO_ACTIVE_LOW.

Yours.
Linus Walleij

#5 lore raw

Re: [PATCH v3 2/3] drm/panel: Add Samsung S6D7AA0 panel controller driver

In reply to Artur Weber

Hi Artur,

thanks for your patch!

Quoted 10 lines · Artur Weber

Initial driver for S6D7AA0-controlled panels, currently only for the LSL080AL02 panel used in the Samsung Galaxy Tab 3 8.0 family of tablets.

It should be possible to extend this driver to work with other panels using this IC.

---
Changed in v2:
- Removed unused panel_name property from desc struct

Overall this driver looks very good. I could merge it once the DT bindings are ACKed by the DT maintainers and some minor stuff fixed.

Some comments below:

drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c line 26

Quoted 6 lines
drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c new file +6 -0
+/* Manufacturer command set */
+#define CMD_BL_CTL             0xc3
+#define CMD_OTP_RELOAD         0xd0
+#define CMD_PASSWD1            0xf0
+#define CMD_PASSWD2            0xf1
+#define CMD_PASSWD3            0xfc

Some drivers prefix these commands with "MCS" such as MCS_BL_CTL.

MCS = Manufacturer Command Set (I think)

Some just name the identifers after the panel such as s6d27a1 which has S6D27A1_RESCTL etc.

CMD seems a bit general to me and may be mistaken for the actual DCS commands.

drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c line 34

Quoted 7 lines
drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c new file +7 -0
+struct s6d7aa0 {
+       struct drm_panel panel;
+       struct mipi_dsi_device *dsi;
+       struct gpio_desc *reset_gpio;
+       struct regulator *enable_supply;
+       const struct s6d7aa0_panel_desc *desc;
+       bool prepared;

Skip this state variable, the core keeps track of whether the panel is enabled or not.

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

Quoted 4 lines
drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c new file +4 -0
+static void s6d7aa0_reset(struct s6d7aa0 *ctx)
+{
+       gpiod_set_value_cansleep(ctx->reset_gpio, 0);
+       msleep(50);

This first de-assertion is unnecessary isn't it?

The reset line will just be asserted longer if it is already asserted.

Quoted 5 lines
drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c new file +5 -0
+       gpiod_set_value_cansleep(ctx->reset_gpio, 1);
+       msleep(50);
+       gpiod_set_value_cansleep(ctx->reset_gpio, 0);
+       msleep(50);
+}

(...)

Quoted 7 lines
drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c new file +7 -0
+static int s6d7aa0_on(struct s6d7aa0 *ctx)
+{
+       struct mipi_dsi_device *dsi = ctx->dsi;
+       struct device *dev = &dsi->dev;
+       int ret;
+
+       dsi->mode_flags |= MIPI_DSI_MODE_LPM;

(...)

drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c line 123

Quoted 7 lines
drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c new file +7 -0
+static int s6d7aa0_off(struct s6d7aa0 *ctx)
+{
+       struct mipi_dsi_device *dsi = ctx->dsi;
+       struct device *dev = &dsi->dev;
+       int ret;
+
+       dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;

I haven't seen this mode flag MIPI_DSI_MODE_LPM set and masked in other DSI panel drivers! Is this something we should fix everywhere then? Or even something the core should be doing?

Yours,
Linus Walleij

author maintainer
#6 lore raw

Re: [PATCH v3 2/3] drm/panel: Add Samsung S6D7AA0 panel controller driver

Hi,

thank you for the review.

Quoted 10 lines · Linus Walleij
Quoted 7 lines
drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c new file +7 -0
+static int s6d7aa0_on(struct s6d7aa0 *ctx)
+{
+       struct mipi_dsi_device *dsi = ctx->dsi;
+       struct device *dev = &dsi->dev;
+       int ret;
+
+       dsi->mode_flags |= MIPI_DSI_MODE_LPM;

(...)

Quoted 12 lines

drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c line 123

Quoted 7 lines
drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c new file +7 -0
+static int s6d7aa0_off(struct s6d7aa0 *ctx)
+{
+       struct mipi_dsi_device *dsi = ctx->dsi;
+       struct device *dev = &dsi->dev;
+       int ret;
+
+       dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;

I haven't seen this mode flag MIPI_DSI_MODE_LPM set and masked in other DSI panel drivers! Is this something we should fix everywhere then? Or even something the core should be doing?

These bits were included in a driver for a similar panel with the same controller in an MSM8916 close-to-mainline kernel fork[1]; that driver was generated with lmdpdg[2], which adds the LPM mode flag automatically based on some downstream DTS property. In this case, I left it in, since it didn't seem to break anything... but I just re-tested without it and it seems that it might've fixed some odd issues I'd get sometimes when going out of sleep mode. I'll get rid of it in the next version.

(I based my panel driver off that driver; now that I think about it, it might be worth mentioning somewhere in the copyright notice...?)

Best regards
Artur Weber

[1]
https://github.com/msm8916-mainline/linux/blob/msm8916/6.3-rc7/drivers/gpu/drm/panel/msm8916-generated/panel-samsung-s6d7aa0-lsl080al03.c
[2]
https://github.com/msm8916-mainline/linux-mdss-dsi-panel-driver-generator