mbox series

[v6,00/13] Add support for PinePhone LCD panel

Message ID 20200701103126.1512615-1-megous@megous.com (mailing list archive)
Headers show
Series Add support for PinePhone LCD panel | expand

Message

Ondřej Jirman July 1, 2020, 10:31 a.m. UTC
This patchset adds support for the LCD panel of PinePhone.

I've tested this on PinePhone 1.0 and 1.2.

Please take a look.

thank you and regards,
  Ondrej Jirman

Changes in v6:
- Fixed spacing in yaml
- Fixed wrong vccio->iovcc supply name in the bindings doc
- I noticed that the original driver uses a delay of 20ms in the init
  function to achieve a combined total of 120ms required from post-reset
  to display_on. I've added a similar delay to xbd599_init, so that
  xbd599 panel also has the right timing. (patch 9)
- v5->v6 diff: https://megous.com/dl/tmp/v5-v6.patch
- Added review/ack tags
- Learned to run dt_binding_check by myself ;)

Changes in v5:
- rewritten on top of rocktech-jh057n00900 driver
- rocktech-jh057n00900 renamed to st7703 (controller name)
- converted rocktech-jh057n00900 bindings to yaml and extended for xbd599

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 (2):
  dt-bindings: vendor-prefixes: Add Xingbangda
  arm64: dts: sun50i-a64-pinephone: Enable LCD support on PinePhone

Ondrej Jirman (11):
  dt-bindings: panel: Convert rocktech,jh057n00900 to yaml
  dt-bindings: panel: Add compatible for Xingbangda XBD599 panel
  drm/panel: rocktech-jh057n00900: Rename the driver to st7703
  drm/panel: st7703: Rename functions from jh057n prefix to st7703
  drm/panel: st7703: Prepare for supporting multiple panels
  drm/panel: st7703: Move code specific to jh057n closer together
  drm/panel: st7703: Move generic part of init sequence to enable
    callback
  drm/panel: st7703: Add support for Xingbangda XBD599
  drm/panel: st7703: Enter sleep after display off
  drm/panel: st7703: Assert reset prior to powering down the regulators
  arm64: dts: sun50i-a64-pinephone: Add touchscreen support

 .../display/panel/rocktech,jh057n00900.txt    |  23 -
 .../display/panel/rocktech,jh057n00900.yaml   |  70 ++
 .../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                 |  26 +-
 drivers/gpu/drm/panel/Makefile                |   2 +-
 .../drm/panel/panel-rocktech-jh057n00900.c    | 424 -----------
 drivers/gpu/drm/panel/panel-sitronix-st7703.c | 656 ++++++++++++++++++
 9 files changed, 815 insertions(+), 461 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.txt
 create mode 100644 Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.yaml
 delete mode 100644 drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
 create mode 100644 drivers/gpu/drm/panel/panel-sitronix-st7703.c

Comments

Icenowy Zheng July 1, 2020, 12:01 p.m. UTC | #1
于 2020年7月1日 GMT+08:00 下午6:31:26, Ondrej Jirman <megous@megous.com> 写到:
>Pinephone has a Goodix GT917S capacitive touchscreen controller on
>I2C0 bus. Add support for it.
>
>Signed-off-by: Ondrej Jirman <megous@megous.com>
>Acked-by: Linus Walleij <linus.walleij@linaro.org>
>---
> .../dts/allwinner/sun50i-a64-pinephone.dtsi   | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
>diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
>b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
>index 85a7aa5efd32..2d5694446d17 100644
>--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
>+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
>@@ -123,6 +123,25 @@ &ehci1 {
> 	status = "okay";
> };
> 
>+&i2c0 {
>+	pinctrl-names = "default";
>+	pinctrl-0 = <&i2c0_pins>;
>+	status = "okay";
>+
>+	touchscreen@5d {
>+		compatible = "goodix,gt917s", "goodix,gt911";

Please drop gt911 here. GT917S belong to the GT1x product line, not the same line with GT911.

You will see this in the driver.

>+		reg = <0x5d>;
>+		interrupt-parent = <&pio>;
>+		interrupts = <7 4 IRQ_TYPE_LEVEL_HIGH>; /* PH4 */
>+		irq-gpios = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
>+		reset-gpios = <&pio 7 11 GPIO_ACTIVE_HIGH>; /* PH11 */
>+		AVDD28-supply = <&reg_ldo_io0>;
>+		VDDIO-supply = <&reg_ldo_io0>;
>+		touchscreen-size-x = <720>;
>+		touchscreen-size-y = <1440>;
>+	};
>+};
>+
> &i2c1 {
> 	status = "okay";
>
Ondřej Jirman July 1, 2020, 4:30 p.m. UTC | #2
Hello Sam,

On Wed, Jul 01, 2020 at 05:25:32PM +0200, Sam Ravnborg wrote:
> Hi Ondrej.
> 
> On Wed, Jul 01, 2020 at 12:31:13PM +0200, Ondrej Jirman wrote:
> > This patchset adds support for the LCD panel of PinePhone.
> > 
> > I've tested this on PinePhone 1.0 and 1.2.
> > 
> > Please take a look.
> > 
> > thank you and regards,
> >   Ondrej Jirman
> > 
> > Changes in v6:
> > - Fixed spacing in yaml
> > - Fixed wrong vccio->iovcc supply name in the bindings doc
> > - I noticed that the original driver uses a delay of 20ms in the init
> >   function to achieve a combined total of 120ms required from post-reset
> >   to display_on. I've added a similar delay to xbd599_init, so that
> >   xbd599 panel also has the right timing. (patch 9)
> > - v5->v6 diff: https://megous.com/dl/tmp/v5-v6.patch
> > - Added review/ack tags
> > - Learned to run dt_binding_check by myself ;)
> The patch-set does not apply clean on top of drm-misc-next - due to
> vrefresh removal.
> Please re-spin.

Sorry for that. Rebased and retested.

thank you,
	o.

> 	Sam
Ondřej Jirman July 1, 2020, 4:42 p.m. UTC | #3
Hello,

On Wed, Jul 01, 2020 at 05:54:05PM +0200, Guido Günther wrote:
> Hi,
> On Wed, Jul 01, 2020 at 12:31:13PM +0200, Ondrej Jirman wrote:
> > This patchset adds support for the LCD panel of PinePhone.
> 
> I gave this a quick spin on the Librem5 devkit so
> 
> Tested-by: Guido Günther <agx@sigxcpu.org>
> 
> but please also adjust MAINTAINERS so we stay in the loop on driver
> changes.

Ah, right. I'll send a quick followup patch[1] after this gets merged,
or add it to v8 if there will be a need for v8. Thanks for noticing.

[1] https://megous.com/dl/tmp/0001-MAINTAINERS-Update-entry-for-st7703-driver-after-the.patch

And thanks for testing, too. :)

regards,
	o.

> Cheers,
>  -- Guido
> 
> > 
> > I've tested this on PinePhone 1.0 and 1.2.
> > 
> > Please take a look.
> > 
> > thank you and regards,
> >   Ondrej Jirman
> > 
> > Changes in v6:
> > - Fixed spacing in yaml
> > - Fixed wrong vccio->iovcc supply name in the bindings doc
> > - I noticed that the original driver uses a delay of 20ms in the init
> >   function to achieve a combined total of 120ms required from post-reset
> >   to display_on. I've added a similar delay to xbd599_init, so that
> >   xbd599 panel also has the right timing. (patch 9)
> > - v5->v6 diff: https://megous.com/dl/tmp/v5-v6.patch
> > - Added review/ack tags
> > - Learned to run dt_binding_check by myself ;)
> > 
> > Changes in v5:
> > - rewritten on top of rocktech-jh057n00900 driver
> > - rocktech-jh057n00900 renamed to st7703 (controller name)
> > - converted rocktech-jh057n00900 bindings to yaml and extended for xbd599
> > 
> > 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 (2):
> >   dt-bindings: vendor-prefixes: Add Xingbangda
> >   arm64: dts: sun50i-a64-pinephone: Enable LCD support on PinePhone
> > 
> > Ondrej Jirman (11):
> >   dt-bindings: panel: Convert rocktech,jh057n00900 to yaml
> >   dt-bindings: panel: Add compatible for Xingbangda XBD599 panel
> >   drm/panel: rocktech-jh057n00900: Rename the driver to st7703
> >   drm/panel: st7703: Rename functions from jh057n prefix to st7703
> >   drm/panel: st7703: Prepare for supporting multiple panels
> >   drm/panel: st7703: Move code specific to jh057n closer together
> >   drm/panel: st7703: Move generic part of init sequence to enable
> >     callback
> >   drm/panel: st7703: Add support for Xingbangda XBD599
> >   drm/panel: st7703: Enter sleep after display off
> >   drm/panel: st7703: Assert reset prior to powering down the regulators
> >   arm64: dts: sun50i-a64-pinephone: Add touchscreen support
> > 
> >  .../display/panel/rocktech,jh057n00900.txt    |  23 -
> >  .../display/panel/rocktech,jh057n00900.yaml   |  70 ++
> >  .../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                 |  26 +-
> >  drivers/gpu/drm/panel/Makefile                |   2 +-
> >  .../drm/panel/panel-rocktech-jh057n00900.c    | 424 -----------
> >  drivers/gpu/drm/panel/panel-sitronix-st7703.c | 656 ++++++++++++++++++
> >  9 files changed, 815 insertions(+), 461 deletions(-)
> >  delete mode 100644 Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.txt
> >  create mode 100644 Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.yaml
> >  delete mode 100644 drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
> >  create mode 100644 drivers/gpu/drm/panel/panel-sitronix-st7703.c
> > 
> > -- 
> > 2.27.0
> >
Ondřej Jirman July 1, 2020, 6:57 p.m. UTC | #4
Hi Icenowy,

On Wed, Jul 01, 2020 at 08:01:14PM +0800, Icenowy Zheng wrote:
> 
> 
> 于 2020年7月1日 GMT+08:00 下午6:31:26, Ondrej Jirman <megous@megous.com> 写到:
> >Pinephone has a Goodix GT917S capacitive touchscreen controller on
> >I2C0 bus. Add support for it.
> >
> >Signed-off-by: Ondrej Jirman <megous@megous.com>
> >Acked-by: Linus Walleij <linus.walleij@linaro.org>
> >---
> > .../dts/allwinner/sun50i-a64-pinephone.dtsi   | 19 +++++++++++++++++++
> > 1 file changed, 19 insertions(+)
> >
> >diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> >b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> >index 85a7aa5efd32..2d5694446d17 100644
> >--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> >+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> >@@ -123,6 +123,25 @@ &ehci1 {
> > 	status = "okay";
> > };
> > 
> >+&i2c0 {
> >+	pinctrl-names = "default";
> >+	pinctrl-0 = <&i2c0_pins>;
> >+	status = "okay";
> >+
> >+	touchscreen@5d {
> >+		compatible = "goodix,gt917s", "goodix,gt911";
> 
> Please drop gt911 here. GT917S belong to the GT1x product line, not the same line with GT911.
> 
> You will see this in the driver.

Right. I'll do so in v8.

thnk you and regards,
	o.

> >+		reg = <0x5d>;
> >+		interrupt-parent = <&pio>;
> >+		interrupts = <7 4 IRQ_TYPE_LEVEL_HIGH>; /* PH4 */
> >+		irq-gpios = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
> >+		reset-gpios = <&pio 7 11 GPIO_ACTIVE_HIGH>; /* PH11 */
> >+		AVDD28-supply = <&reg_ldo_io0>;
> >+		VDDIO-supply = <&reg_ldo_io0>;
> >+		touchscreen-size-x = <720>;
> >+		touchscreen-size-y = <1440>;
> >+	};
> >+};
> >+
> > &i2c1 {
> > 	status = "okay";
> >