This patchset adds support for the LCD panel of PinePhone.
The first 3 patches are for the panel itself, and the last 2 patches are
for enabling it on PinePhone.
I've tested this on PinePhone 1.0 and 1.2.
Please take a look.
thank you and regards,
Ondrej Jirman
Changes in v4:
- use ->type from the mode instead of hardcoding (Samuel)
- move init_sequence to ->prepare (Samuel)
- move anti-flicker delay to ->enable, explain it (Samuel)
- add enter_sleep after display_off (Samuel)
- drop ->disable (move code to ->unprepare)
- add ID bytes dumping (Linus)
(I can't test it since allwinner DSI driver has a broken
dcs_read function, and I didn't manage to fix it.)
- document magic bytes (Linus)
- assert reset during powerup
- cleanup powerup timings according to the datasheet
Changes in v3:
- Panel driver renamed to the name of the LCD controller
- Re-organize the driver slightly to more easily support more panels
based on the same controller.
- Add patch to enable the touchscreen to complete the LCD support
on PinePhone.
- Dropped the "DSI fix" patch (the driver seems to work for me without it)
- Improved brightness levels handling:
- PinePhone 1.0 uses default levels generated by the driver
- On PinePhone 1.1 duty cycles < 20% lead to black screen, so
default levels can't be used. Martijn Braam came up with a
list of duty cycle values that lead to perception of linear
brigtness level <-> light intensity on PinePhone 1.1
- There was some feedback on v2 about this being similar to st7701.
It's only similar in name. Most of the "user commands" are different,
so I opted to keep this in a new driver instead of creating st770x.
Anyone who likes to check the differences, here are datasheets:
- https://megous.com/dl/tmp/ST7703_DS_v01_20160128.pdf
- https://megous.com/dl/tmp/ST7701.pdf
Changes in v2:
- DT Example fix.
- DT Format fix.
- Raised copyright info to 2020.
- Sort panel operation functions.
- Sort inclusion.
-- For phone owners: --
There's an open question on how to set the backlight brightness values
on post 1.0 revision phone, since lower duty cycles (< 10-20%) lead
to backlight being black. It would be nice if more people can test
the various backlight levels on 1.1 and 1.2 revision with this change
in dts:
brightness-levels = <0 1000>;
num-interpolated-steps = <1000>;
and report at what brightness level the backlight turns on. So far it
seems this has a wide range. Lowest useable duty cycle for me is ~7%
on 1.2 and for Martijn ~20% on 1.1.
Icenowy Zheng (4):
dt-bindings: vendor-prefixes: Add Xingbangda
dt-bindings: panel: Add binding for Xingbangda XBD599 panel
drm: panel: Add Xingbangda XBD599 panel (ST7703 controller)
arm64: dts: sun50i-a64-pinephone: Enable LCD support on PinePhone
Ondrej Jirman (1):
arm64: dts: sun50i-a64-pinephone: Add touchscreen support
.../display/panel/sitronix,st7703.yaml | 63 +++
.../devicetree/bindings/vendor-prefixes.yaml | 2 +
.../allwinner/sun50i-a64-pinephone-1.1.dts | 19 +
.../dts/allwinner/sun50i-a64-pinephone.dtsi | 54 ++
drivers/gpu/drm/panel/Kconfig | 10 +
drivers/gpu/drm/panel/Makefile | 1 +
drivers/gpu/drm/panel/panel-sitronix-st7703.c | 535 ++++++++++++++++++
7 files changed, 684 insertions(+)
create mode 100644 Documentation/devicetree/bindings/display/panel/sitronix,st7703.yaml
create mode 100644 drivers/gpu/drm/panel/panel-sitronix-st7703.c
--
2.27.0
From: Icenowy Zheng <[email protected]>
Shenzhen Xingbangda Display Technology Co., Ltd is a company which
produces LCD modules. It supplies the LCD panels for the PinePhone.
Add the vendor prefix of it.
Signed-off-by: Icenowy Zheng <[email protected]>
Signed-off-by: Ondrej Jirman <[email protected]>
Acked-by: Rob Herring <[email protected]>
---
Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml
index 9aeab66be85f..740b116b179f 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.yaml
+++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml
@@ -1157,6 +1157,8 @@ patternProperties:
description: Xiaomi Technology Co., Ltd.
"^xillybus,.*":
description: Xillybus Ltd.
+ "^xingbangda,.*":
+ description: Shenzhen Xingbangda Display Technology Co., Ltd
"^xinpeng,.*":
description: Shenzhen Xinpeng Technology Co., Ltd
"^xlnx,.*":
--
2.27.0
From: Icenowy Zheng <[email protected]>
Xingbangda XBD599 is a 5.99" 720x1440 MIPI-DSI LCD panel. It is based on
Sitronix ST7703 LCD controller.
Add its device tree binding.
Signed-off-by: Icenowy Zheng <[email protected]>
Signed-off-by: Ondrej Jirman <[email protected]>
Reviewed-by: Linus Walleij <[email protected]>
Reviewed-by: Rob Herring <[email protected]>
---
.../display/panel/sitronix,st7703.yaml | 63 +++++++++++++++++++
1 file changed, 63 insertions(+)
create mode 100644 Documentation/devicetree/bindings/display/panel/sitronix,st7703.yaml
diff --git a/Documentation/devicetree/bindings/display/panel/sitronix,st7703.yaml b/Documentation/devicetree/bindings/display/panel/sitronix,st7703.yaml
new file mode 100644
index 000000000000..6e1606db4ab4
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/sitronix,st7703.yaml
@@ -0,0 +1,63 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/panel/sitronix,st7703.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Sitronix ST7703 MIPI DSI panel
+
+maintainers:
+ - Icenowy Zheng <[email protected]>
+ - Ondrej Jirman <[email protected]>
+
+allOf:
+ - $ref: panel-common.yaml#
+
+properties:
+ compatible:
+ items:
+ - enum:
+ - xingbangda,xbd599
+ - const: sitronix,st7703
+
+ reg:
+ description: DSI virtual channel used by that screen
+ maxItems: 1
+
+ vcc-supply:
+ description: regulator that supplies the VCC voltage
+
+ iovcc-supply:
+ description: regulator that supplies the IOVCC voltage
+
+ reset-gpios: true
+
+ backlight: true
+
+required:
+ - compatible
+ - reg
+ - vcc-supply
+ - iovcc-supply
+ - reset-gpios
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/gpio/gpio.h>
+
+ dsi {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ panel@0 {
+ compatible = "xingbangda,xbd599", "sitronix,st7703";
+ reg = <0>;
+ reset-gpios = <&pio 3 24 GPIO_ACTIVE_HIGH>; /* LCD-RST: PD24 */
+ iovcc-supply = <®_dldo2>;
+ vcc-supply = <®_ldo_io0>;
+ backlight = <&backlight>;
+ };
+ };
+
--
2.27.0
From: Icenowy Zheng <[email protected]>
PinePhone uses PWM backlight and a XBD599 LCD panel over DSI for
display.
Backlight levels curve was optimized by Martijn Braam using a
lux meter.
Add its device nodes.
Signed-off-by: Icenowy Zheng <[email protected]>
Signed-off-by: Martijn Braam <[email protected]>
Signed-off-by: Ondrej Jirman <[email protected]>
---
.../allwinner/sun50i-a64-pinephone-1.1.dts | 19 ++++++++++
.../dts/allwinner/sun50i-a64-pinephone.dtsi | 35 +++++++++++++++++++
2 files changed, 54 insertions(+)
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.1.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.1.dts
index 06a775c41664..3e99a87e9ce5 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.1.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.1.dts
@@ -9,3 +9,22 @@ / {
model = "Pine64 PinePhone Braveheart (1.1)";
compatible = "pine64,pinephone-1.1", "allwinner,sun50i-a64";
};
+
+&backlight {
+ power-supply = <®_ldo_io0>;
+ /*
+ * PWM backlight circuit on this PinePhone revision was changed since
+ * 1.0, and the lowest PWM duty cycle that doesn't lead to backlight
+ * being off is around 20%. Duty cycle for the lowest brightness level
+ * also varries quite a bit between individual boards, so the lowest
+ * value here was chosen as a safe default.
+ */
+ brightness-levels = <
+ 774 793 814 842
+ 882 935 1003 1088
+ 1192 1316 1462 1633
+ 1830 2054 2309 2596
+ 2916 3271 3664 4096>;
+ num-interpolated-steps = <50>;
+ default-brightness-level = <400>;
+};
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
index cefda145c3c9..e60b57f8ac14 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
@@ -16,6 +16,13 @@ aliases {
serial0 = &uart0;
};
+ backlight: backlight {
+ compatible = "pwm-backlight";
+ pwms = <&r_pwm 0 50000 PWM_POLARITY_INVERTED>;
+ enable-gpios = <&pio 7 10 GPIO_ACTIVE_HIGH>; /* PH10 */
+ /* Backlight configuration differs per PinePhone revision. */
+ };
+
chosen {
stdout-path = "serial0:115200n8";
};
@@ -84,6 +91,30 @@ &dai {
status = "okay";
};
+&de {
+ status = "okay";
+};
+
+&dphy {
+ status = "okay";
+};
+
+&dsi {
+ vcc-dsi-supply = <®_dldo1>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ status = "okay";
+
+ panel@0 {
+ compatible = "xingbangda,xbd599", "sitronix,st7703";
+ reg = <0>;
+ reset-gpios = <&pio 3 23 GPIO_ACTIVE_LOW>; /* PD23 */
+ iovcc-supply = <®_dldo2>;
+ vcc-supply = <®_ldo_io0>;
+ backlight = <&backlight>;
+ };
+};
+
&ehci0 {
status = "okay";
};
@@ -188,6 +219,10 @@ &r_pio {
*/
};
+&r_pwm {
+ status = "okay";
+};
+
&r_rsb {
status = "okay";
--
2.27.0