Skip to contentSkip to conversation

drm/panel: Add support for Truly NT35597 panel

PATCH Superseded Abhinav Kumar 4 participants 10 messages Aug 3, 2018 – Aug 10, 2018

Subsystems (5)

v5 of 10 Superseded Latest is v10 →

lore
Share & tools
lore
#0 lore raw

PATCH v5 1/2 drm/panel: Add support for Truly NT35597 panel

From: "[email protected]" <[email protected]>

Add support for Truly NT35597 panel used
in MSM reference platforms.

This panel supports both single DSI and dual DSI
modes.

However, this patch series adds support only for
dual DSI mode.

Changes in v5:
- Added comments for the delays
- Fix error messages and return code
- Start using backlight_enable/disable helpers
- Start using ARRAY_SIZE everywhere
- Split the panel commands into three sets to
remove redundant structure fields and simplify
the DCS command sending method
- Use of_get_drm_display_mode() and simplify
get_modes function
- Remove truly_wqxga_panel_del and do necessary
cleanup
- Replace dev_err with DRM_DEV_ERROR

---
 drivers/gpu/drm/panel/Kconfig               |   8 +
 drivers/gpu/drm/panel/Makefile              |   1 +
 drivers/gpu/drm/panel/panel-truly-nt35597.c | 680 ++++++++++++++++++++++++++++
 3 files changed, 689 insertions(+)
 create mode 100644 drivers/gpu/drm/panel/panel-truly-nt35597.c
drivers/gpu/drm/panel/Kconfig +8 -0
index 6020c30..7ae74c2 100644
@@ -186,4 +186,12 @@ config DRM_PANEL_SITRONIX_ST7789V
 	  Say Y here if you want to enable support for the Sitronix
 	  ST7789V controller for 240x320 LCD panels
 
+config DRM_PANEL_TRULY_NT35597_WQXGA
+	tristate "Truly WQXGA"
+	depends on OF
+	depends on DRM_MIPI_DSI
+	select VIDEOMODE_HELPERS
+	help
+	  Say Y here if you want to enable support for Truly NT35597 WQXGA Dual DSI
+	  Video Mode panel
 endmenu
drivers/gpu/drm/panel/Makefile +1 -0
index 5ccaaa9..80fd19f 100644
@@ -19,3 +19,4 @@ obj-$(CONFIG_DRM_PANEL_SEIKO_43WVF1G) += panel-seiko-43wvf1g.o
 obj-$(CONFIG_DRM_PANEL_SHARP_LQ101R1SX01) += panel-sharp-lq101r1sx01.o
 obj-$(CONFIG_DRM_PANEL_SHARP_LS043T1LE01) += panel-sharp-ls043t1le01.o
 obj-$(CONFIG_DRM_PANEL_SITRONIX_ST7789V) += panel-sitronix-st7789v.o
+obj-$(CONFIG_DRM_PANEL_TRULY_NT35597_WQXGA) += panel-truly-nt35597.o
drivers/gpu/drm/panel/panel-truly-nt35597.c new file +680 -0

680 lines not on this page · raw message

Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

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

PATCH v5 2/2 dt-bindings: Add Truly NT35597 panel bindings

From: "[email protected]" <[email protected]>

Add the device tree bindings for Truly NT35597 panel. This panel supports both single DSI and dual DSI.

However, this patch series supports only dual DSI.

Changes in v5:
- None

---
 .../devicetree/bindings/display/truly,nt35597.txt  | 69 ++++++++++++++++++++++
 1 file changed, 69 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/truly,nt35597.txt
Documentation/devicetree/bindings/display/truly,nt35597.txt new file +69 -0
new file mode 100644
index 0000000..5d297b8
@@ -0,0 +1,69 @@
+Truly model NT35597 1440x2560 DSI Panel
+
+Required properties:
+- compatible: should be "truly,nt35597"
+- vdda-supply: phandle of the regulator that provides the supply voltage
+  Power IC supply
+- vdispp-supply: phandle of the regulator that provides the supply voltage
+  for positive LCD bias
+- vdispn-supply: phandle of the regulator that provides the supply voltage
+  for negative LCD bias
+- reset-gpios: phandle of gpio for reset line
+  This should be 8mA, gpio can be configured using mux, pinctrl, pinctrl-names
+- mode-gpios: phandle of the gpio for choosing the mode of the display
+  for single DSI or Dual DSI
+  This should be low for dual DSI and high for single DSI mode
+- display-timings: Node for the Panel timings
+- ports: This device has two video ports driven by two DSIs. Their connections
+  are modelled using the OF graph bindings specified in
+  Documentation/devicetree/bindings/graph.txt.
+  - port@0: DSI input port driven by master DSI
+  - port@1: DSI input port driven by secondary DSI
+
+Example:
+
+	dsi@ae94000 {
+		panel@0 {
+			compatible = "truly,nt35597";
+			reg = <0>;
+			vdda-supply = <&pm8998_l14>;
+			vdispp-supply = <&lab_regulator>;
+			vdispn-supply = <&ibb_regulator>;
+			pinctrl-names = "default", "suspend";
+			pinctrl-0 = <&dpu_dsi_active>;
+			pinctrl-1 = <&dpu_dsi_suspend>;
+
+			reset-gpios = <&tlmm 6 0>;
+			mode-gpios = <&tlmm 52 0>;
+			display-timings {
+				timing0: timing-0 {
+					clock-frequency = <268316138>;
+					hactive = <1440>;
+					vactive = <2560>;
+					hfront-porch = <200>;
+					hback-porch = <64>;
+					hsync-len = <32>;
+					vfront-porch = <8>;
+					vback-porch = <7>;
+					vsync-len = <1>;
+				};
+			};
+			ports {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				port@0 {
+					reg = <0>;
+					panel0_in: endpoint {
+						remote-endpoint = <&dsi0_out>;
+					};
+				};
+
+				port@1 {
+					reg = <1>;
+					panel1_in: endpoint {
+						remote-endpoint = <&dsi1_out>;
+					};
+				};
+			};
+		};
+	};
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#4 lore raw
In reply to Abhinav Kumar

On Fri, Aug 3, 2018 at 4:49 AM Abhinav Kumar <[email protected]> wrote:

Hi Abhinav,

Quoted 25 lines

From: "[email protected]" <[email protected]>

Add support for Truly NT35597 panel used
in MSM reference platforms.

This panel supports both single DSI and dual DSI
modes.

However, this patch series adds support only for
dual DSI mode.

Changes in v5:
- Added comments for the delays
- Fix error messages and return code
- Start using backlight_enable/disable helpers
- Start using ARRAY_SIZE everywhere
- Split the panel commands into three sets to
remove redundant structure fields and simplify
the DCS command sending method
- Use of_get_drm_display_mode() and simplify
get_modes function
- Remove truly_wqxga_panel_del and do necessary
cleanup
- Replace dev_err with DRM_DEV_ERROR

Quoted 2 lines

Overall this driver looks good to me.

Just a question:

drivers/gpu/drm/panel/panel-truly-nt35597.c line 72

Quoted 5 lines
drivers/gpu/drm/panel/panel-truly-nt35597.c new file +5 -0
+struct cmd_set panel_cmds_set_1[] = {
+       /* CMD2_P0 */
+       { { 0xff, 0x20 } },
+       { { 0xfb, 0x01 } },
+       { { 0x00, 0x01 } },

This is what we call a jam table, I guess "magic init sequence".

There are some comments on what the different sections do, but in cases like this where there is no public datasheet, it would be nice to use some #defines rather than opaque hex codes, if you know what the different commands actually mean.

This is in order to help others with hacking on the driver.

If you don't have more info than this it's fine, just asking.

drivers/gpu/drm/panel/panel-truly-nt35597.c line 174

Quoted 2 lines
drivers/gpu/drm/panel/panel-truly-nt35597.c new file +2 -0
+       /* Resolution:1440x2560 */
+       { { 0x72, 0x02 } },

This is for example quite hard-coded. One gets the idea that the resolution is dynamic and that this is not really a panel per se but a panel driver, so the Truly NT35597 is not a panel but a panel driver that can be configured to be used with several physical panels.

Compare to other panel drivers such as Ilitek ILI9322 that is in this driver dir. There I make it a bit more transparent what the panel driver is actually doing on the inside, so if we find it is used with other physical panels we can reuse the code more easily.

drivers/gpu/drm/panel/panel-truly-nt35597.c line 398

Quoted 4 lines
drivers/gpu/drm/panel/panel-truly-nt35597.c new file +4 -0
+       truly_write_buf_func(ret, truly_dcs_write_buf,
+               panel, SHORT_PACKET,
+               ARRAY_SIZE(panel_cmds_set_1),
+               panel_cmds_set_1);

Instead of calling these "cmd_set_1" name them after what the command set actually does so we can follow the init flow. If you don't know what the commands do you could as well call it "magic 1", "magic 2" etc so we know it is magic.

drivers/gpu/drm/panel/panel-truly-nt35597.c line 664

Quoted 2 lines
drivers/gpu/drm/panel/panel-truly-nt35597.c new file +2 -0
+static const struct of_device_id truly_wqxga_of_match[] = {
+       { .compatible = "truly,nt35597", },

If this is a panel driver that not only configurable for wqxga but actually also other resolutions this is misleading.

I suspect this is indeed a panel driver and not a panel with integrated driver. I think the best is to define two compatible strings like we do for ILI9322:
"truly,nt35597", "qcom,reference-design-name-display";

The command sequence is probably just applicable for these Qcom reference designs with a certain physical display, unless the display controller can self-describe, e.g. by electric straps.

So only run these command sets for wqxga etc for this specific qcom reference design, bail out if subsystem (reference design) compatible string is not defined for now and match on the reference design-display compatible.

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

#2 lore raw

Re: [PATCH v5 2/2] dt-bindings: Add Truly NT35597 panel bindings

In reply to Abhinav Kumar
Quoted 4 lines · Abhinav Kumar

From: "[email protected]" <[email protected]>

Add the device tree bindings for Truly NT35597 panel. This panel supports both single DSI and dual DSI.

I do not think this is a panel but a panel driver that can be used with several physical panels. Can you confirm?

I suspect this since the command sequence in the driver seems to contain a command for setting up the actual resolution and a bunch of clocking properties for the physical panel.

Quoted 2 lines

+Required properties:
+- compatible: should be "truly,nt35597"

As with eg ili9322 I think this should have dual compatible strings identifying the system it is used with since the resolution, clocking etc is apparently
actually configurable.

compatible:
"truly,nt35597", "qcom,reference-design1-name-display"; "truly,nt35597", "qcom,reference-design2-name-display";

Then you send the command setting up resolution etc only for that one system.

Documentation/devicetree/bindings/display/truly,nt35597.txt line 16

Quoted 12 lines

+- vdda-supply: phandle of the regulator that provides the supply voltage

Documentation/devicetree/bindings/display/truly,nt35597.txt new file +11 -0
+  Power IC supply
+- vdispp-supply: phandle of the regulator that provides the supply voltage
+  for positive LCD bias
+- vdispn-supply: phandle of the regulator that provides the supply voltage
+  for negative LCD bias
+- reset-gpios: phandle of gpio for reset line
+  This should be 8mA, gpio can be configured using mux, pinctrl, pinctrl-names
+- mode-gpios: phandle of the gpio for choosing the mode of the display
+  for single DSI or Dual DSI
+  This should be low for dual DSI and high for single DSI mode
+- display-timings: Node for the Panel timings

I don't think this belongs in the device tree at all.

Provide the timings from the driver based on the compatible string instead, as you actually send commands to set up a certain timing in the display controller.

(See ili9322 driver for an example of how I do this.)

Documentation/devicetree/bindings/display/truly,nt35597.txt line 21

Quoted 5 lines

+- ports: This device has two video ports driven by two DSIs. Their connections

Documentation/devicetree/bindings/display/truly,nt35597.txt new file +4 -0
+  are modelled using the OF graph bindings specified in
+  Documentation/devicetree/bindings/graph.txt.
+  - port@0: DSI input port driven by master DSI
+  - port@1: DSI input port driven by secondary DSI

The rest seems fine.

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

#5 lore raw
In reply to Linus Walleij

Hi Linus

Thanks for your valuable comments.

We agree with your ideas and will address them.

Some details below on how we will address them.

Thanks

Abhinav

Quoted 44 lines · Linus Walleij

On Fri, Aug 3, 2018 at 4:49 AM Abhinav Kumar <[email protected]> wrote:

Hi Abhinav,

Quoted 25 lines

From: "[email protected]" <[email protected]>

Add support for Truly NT35597 panel used
in MSM reference platforms.

This panel supports both single DSI and dual DSI
modes.

However, this patch series adds support only for
dual DSI mode.

Changes in v5:
- Added comments for the delays
- Fix error messages and return code
- Start using backlight_enable/disable helpers
- Start using ARRAY_SIZE everywhere
- Split the panel commands into three sets to
remove redundant structure fields and simplify
the DCS command sending method
- Use of_get_drm_display_mode() and simplify
get_modes function
- Remove truly_wqxga_panel_del and do necessary
cleanup
- Replace dev_err with DRM_DEV_ERROR

Quoted 2 lines

Overall this driver looks good to me.

Just a question:

drivers/gpu/drm/panel/panel-truly-nt35597.c line 72

Quoted 5 lines
drivers/gpu/drm/panel/panel-truly-nt35597.c new file +5 -0
+struct cmd_set panel_cmds_set_1[] = {
+       /* CMD2_P0 */
+       { { 0xff, 0x20 } },
+       { { 0xfb, 0x01 } },
+       { { 0x00, 0x01 } },

This is what we call a jam table, I guess "magic init sequence".

Quoted 9 lines

There are some comments on what the different sections do, but in cases like this where there is no public datasheet, it would be nice to use some #defines rather than opaque hex codes, if you know what the different commands actually mean.

This is in order to help others with hacking on the driver.

If you don't have more info than this it's fine, just asking.

Unfortunately, I do not have more info than this on each of them. The documentation I have does not speak more in detail about what each command does.

Quoted 18 lines

drivers/gpu/drm/panel/panel-truly-nt35597.c line 174

Quoted 2 lines
drivers/gpu/drm/panel/panel-truly-nt35597.c new file +2 -0
+       /* Resolution:1440x2560 */
+       { { 0x72, 0x02 } },

This is for example quite hard-coded. One gets the idea that the resolution is dynamic and that this is not really a panel per se but a panel driver, so the Truly NT35597 is not a panel but a panel driver that can be configured to be used with several physical panels.

Compare to other panel drivers such as Ilitek ILI9322 that is in this driver dir. There I make it a bit more transparent what the panel driver is actually doing on the inside, so if we find it is used with other physical panels we can reuse the code more easily.

drivers/gpu/drm/panel/panel-truly-nt35597.c line 398

Quoted 4 lines
drivers/gpu/drm/panel/panel-truly-nt35597.c new file +4 -0
+       truly_write_buf_func(ret, truly_dcs_write_buf,
+               panel, SHORT_PACKET,
+               ARRAY_SIZE(panel_cmds_set_1),
+               panel_cmds_set_1);
Quoted 5 lines

Instead of calling these "cmd_set_1" name them after what the command set actually does so we can follow the init flow. If you don't know what the commands do you could as well call it "magic 1", "magic 2" etc so we know it is magic.

After going through the documentation I have, Yes i agree that this is a panel driver and can support other panels/resolutions.

Yes, since I dont have more documentation to add here will change these sets to magic_set_1, magic_set_2 etc.

Quoted 11 lines

drivers/gpu/drm/panel/panel-truly-nt35597.c line 664

Quoted 2 lines
drivers/gpu/drm/panel/panel-truly-nt35597.c new file +2 -0
+static const struct of_device_id truly_wqxga_of_match[] = {
+       { .compatible = "truly,nt35597", },

If this is a panel driver that not only configurable for wqxga but actually also other resolutions this is misleading.

I suspect this is indeed a panel driver and not a panel with integrated driver. I think the best is to define two compatible strings like we do for ILI9322:
"truly,nt35597", "qcom,reference-design-name-display";

Quoted 9 lines

The command sequence is probably just applicable for these Qcom reference designs with a certain physical display, unless the display controller can self-describe, e.g. by electric straps.

So only run these command sets for wqxga etc for this specific qcom reference design, bail out if subsystem (reference design) compatible string is not defined for now and match on the reference design-display compatible.

Yes, we agree to have two compatible strings, and shall bail out for now if it doesnt match our reference design one similar to what is present here:

https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/panel/panel-ilitek-ili9322.c#L757

Quoted 6 lines

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

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

#3 lore raw

Re: [PATCH v5 2/2] dt-bindings: Add Truly NT35597 panel bindings

In reply to Linus Walleij

Hi Linus

Thanks for your valuable comments.

Yes, we agree with your comments here and will address them.

Some details below on how we will take care of it.

Thanks

Abhinav

Quoted 9 lines · Linus Walleij
Quoted 4 lines · Abhinav Kumar

From: "[email protected]" <[email protected]>

Add the device tree bindings for Truly NT35597 panel. This panel supports both single DSI and dual DSI.

I do not think this is a panel but a panel driver that can be used with several physical panels. Can you confirm?

Yes, from the documentation I have I can see that this is a panel driver and can support other panels/resolutions.

Quoted 13 lines

I suspect this since the command sequence in the driver seems to contain a command for setting up the actual resolution and a bunch of clocking properties for the physical panel.

Quoted 2 lines

+Required properties:
+- compatible: should be "truly,nt35597"

As with eg ili9322 I think this should have dual compatible strings identifying the system it is used with since the resolution, clocking etc is apparently
actually configurable.

Quoted 7 lines

compatible:
"truly,nt35597", "qcom,reference-design1-name-display"; "truly,nt35597", "qcom,reference-design2-name-display";

Then you send the command setting up resolution etc only for that one system.

Yes, I agree we will can have dual compatible strings and we will pick resolution/modes based on the compatible string similar to this:

https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/panel/panel-ilitek-ili9322.c#L659

Quoted 18 lines
Quoted 14 lines

+- vdda-supply: phandle of the regulator that provides the supply voltage
+ Power IC supply
+- vdispp-supply: phandle of the regulator that provides the supply voltage
+ for positive LCD bias
+- vdispn-supply: phandle of the regulator that provides the supply voltage

Documentation/devicetree/bindings/display/truly,nt35597.txt new file +3 -0
+  for negative LCD bias
+- reset-gpios: phandle of gpio for reset line
+  This should be 8mA, gpio can be configured using mux, pinctrl, 

pinctrl-names
+- mode-gpios: phandle of the gpio for choosing the mode of the display

Documentation/devicetree/bindings/display/truly,nt35597.txt line 16

Quoted 3 lines
Documentation/devicetree/bindings/display/truly,nt35597.txt new file +3 -0
+  for single DSI or Dual DSI
+  This should be low for dual DSI and high for single DSI mode
+- display-timings: Node for the Panel timings
Quoted 7 lines

I don't think this belongs in the device tree at all.

Provide the timings from the driver based on the compatible string instead, as you actually send commands to set up a certain timing in the display controller.

(See ili9322 driver for an example of how I do this.)

Yes, will follow the example of ili9322 and do the same.

Quoted 8 lines

Documentation/devicetree/bindings/display/truly,nt35597.txt line 21

Quoted 7 lines

+- ports: This device has two video ports driven by two DSIs. Their connections

Documentation/devicetree/bindings/display/truly,nt35597.txt new file +4 -0
+  are modelled using the OF graph bindings specified in
+  Documentation/devicetree/bindings/graph.txt.
+  - port@0: DSI input port driven by master DSI
+  - port@1: DSI input port driven by secondary DSI
Quoted 4 lines

The rest seems fine.

Yours,
Linus Walleij

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

#6 lore raw
In reply to Linus Walleij
Quoted 79 lines · Linus Walleij

On Fri, Aug 3, 2018 at 4:49 AM Abhinav Kumar <[email protected]> wrote:

Hi Abhinav,

Quoted 25 lines

From: "[email protected]" <[email protected]>

Add support for Truly NT35597 panel used
in MSM reference platforms.

This panel supports both single DSI and dual DSI
modes.

However, this patch series adds support only for
dual DSI mode.

Changes in v5:
- Added comments for the delays
- Fix error messages and return code
- Start using backlight_enable/disable helpers
- Start using ARRAY_SIZE everywhere
- Split the panel commands into three sets to
remove redundant structure fields and simplify
the DCS command sending method
- Use of_get_drm_display_mode() and simplify
get_modes function
- Remove truly_wqxga_panel_del and do necessary
cleanup
- Replace dev_err with DRM_DEV_ERROR

Quoted 2 lines

Overall this driver looks good to me.

Just a question:

drivers/gpu/drm/panel/panel-truly-nt35597.c line 72

Quoted 5 lines
drivers/gpu/drm/panel/panel-truly-nt35597.c new file +5 -0
+struct cmd_set panel_cmds_set_1[] = {
+       /* CMD2_P0 */
+       { { 0xff, 0x20 } },
+       { { 0xfb, 0x01 } },
+       { { 0x00, 0x01 } },

This is what we call a jam table, I guess "magic init sequence".

There are some comments on what the different sections do, but in cases like this where there is no public datasheet, it would be nice to use some #defines rather than opaque hex codes, if you know what the different commands actually mean.

This is in order to help others with hacking on the driver.

If you don't have more info than this it's fine, just asking.

drivers/gpu/drm/panel/panel-truly-nt35597.c line 174

Quoted 2 lines
drivers/gpu/drm/panel/panel-truly-nt35597.c new file +2 -0
+       /* Resolution:1440x2560 */
+       { { 0x72, 0x02 } },

This is for example quite hard-coded. One gets the idea that the resolution is dynamic and that this is not really a panel per se but a panel driver, so the Truly NT35597 is not a panel but a panel driver that can be configured to be used with several physical panels.

Compare to other panel drivers such as Ilitek ILI9322 that is in this driver dir. There I make it a bit more transparent what the panel driver is actually doing on the inside, so if we find it is used with other physical panels we can reuse the code more easily.

drivers/gpu/drm/panel/panel-truly-nt35597.c line 398

Quoted 4 lines
drivers/gpu/drm/panel/panel-truly-nt35597.c new file +4 -0
+       truly_write_buf_func(ret, truly_dcs_write_buf,
+               panel, SHORT_PACKET,
+               ARRAY_SIZE(panel_cmds_set_1),
+               panel_cmds_set_1);

Instead of calling these "cmd_set_1" name them after what the command set actually does so we can follow the init flow. If you don't know what the commands do you could as well call it "magic 1", "magic 2" etc so we know it is magic.

drivers/gpu/drm/panel/panel-truly-nt35597.c line 664

Quoted 2 lines
drivers/gpu/drm/panel/panel-truly-nt35597.c new file +2 -0
+static const struct of_device_id truly_wqxga_of_match[] = {
+       { .compatible = "truly,nt35597", },
Quoted 7 lines

If this is a panel driver that not only configurable for wqxga but actually also other resolutions this is misleading.

I suspect this is indeed a panel driver and not a panel with integrated driver. I think the best is to define two compatible strings like we do for ILI9322:
"truly,nt35597", "qcom,reference-design-name-display";

I don't understand why we need the two compatible strings for this. Having "truly,nt35597" isn't quite correct in that case, because in itself that doesn't contain enough information for any programming.

If that chip can indeed be used to drive different panels, what we really need is the a compatible string that describes the complete assembly. In the driver we could then rely on parameterized common code that the panel driver can call into in order to program the driver chip.

Note that a driver is assumed to know what to do with a device that it gets bound to based on the compatible string. If some OS implements a driver for "truly,nt35597" but not "qcom,reference-design-name-display", then what is it supposed to do if it encounters the above list of compatible strings? It can't really program a mode because its missing essential information such as resolution or timings.

Thierry

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

#7 lore raw
Quoted 92 lines · Thierry Reding
Quoted 79 lines · Linus Walleij

On Fri, Aug 3, 2018 at 4:49 AM Abhinav Kumar <[email protected]> wrote:

Hi Abhinav,

Quoted 25 lines

From: "[email protected]" <[email protected]>

Add support for Truly NT35597 panel used
in MSM reference platforms.

This panel supports both single DSI and dual DSI
modes.

However, this patch series adds support only for
dual DSI mode.

Changes in v5:
- Added comments for the delays
- Fix error messages and return code
- Start using backlight_enable/disable helpers
- Start using ARRAY_SIZE everywhere
- Split the panel commands into three sets to
remove redundant structure fields and simplify
the DCS command sending method
- Use of_get_drm_display_mode() and simplify
get_modes function
- Remove truly_wqxga_panel_del and do necessary
cleanup
- Replace dev_err with DRM_DEV_ERROR

Quoted 2 lines

Overall this driver looks good to me.

Just a question:

drivers/gpu/drm/panel/panel-truly-nt35597.c line 72

Quoted 5 lines
drivers/gpu/drm/panel/panel-truly-nt35597.c new file +5 -0
+struct cmd_set panel_cmds_set_1[] = {
+       /* CMD2_P0 */
+       { { 0xff, 0x20 } },
+       { { 0xfb, 0x01 } },
+       { { 0x00, 0x01 } },

This is what we call a jam table, I guess "magic init sequence".

There are some comments on what the different sections do, but in cases like this where there is no public datasheet, it would be nice to use some #defines rather than opaque hex codes, if you know what the different commands actually mean.

This is in order to help others with hacking on the driver.

If you don't have more info than this it's fine, just asking.

drivers/gpu/drm/panel/panel-truly-nt35597.c line 174

Quoted 2 lines
drivers/gpu/drm/panel/panel-truly-nt35597.c new file +2 -0
+       /* Resolution:1440x2560 */
+       { { 0x72, 0x02 } },

This is for example quite hard-coded. One gets the idea that the resolution is dynamic and that this is not really a panel per se but a panel driver, so the Truly NT35597 is not a panel but a panel driver that can be configured to be used with several physical panels.

Compare to other panel drivers such as Ilitek ILI9322 that is in this driver dir. There I make it a bit more transparent what the panel driver is actually doing on the inside, so if we find it is used with other physical panels we can reuse the code more easily.

drivers/gpu/drm/panel/panel-truly-nt35597.c line 398

Quoted 4 lines
drivers/gpu/drm/panel/panel-truly-nt35597.c new file +4 -0
+       truly_write_buf_func(ret, truly_dcs_write_buf,
+               panel, SHORT_PACKET,
+               ARRAY_SIZE(panel_cmds_set_1),
+               panel_cmds_set_1);

Instead of calling these "cmd_set_1" name them after what the command set actually does so we can follow the init flow. If you don't know what the commands do you could as well call it "magic 1", "magic 2" etc so we know it is magic.

drivers/gpu/drm/panel/panel-truly-nt35597.c line 664

Quoted 2 lines
drivers/gpu/drm/panel/panel-truly-nt35597.c new file +2 -0
+static const struct of_device_id truly_wqxga_of_match[] = {
+       { .compatible = "truly,nt35597", },
Quoted 7 lines

If this is a panel driver that not only configurable for wqxga but actually also other resolutions this is misleading.

I suspect this is indeed a panel driver and not a panel with integrated driver. I think the best is to define two compatible strings like we do for ILI9322:
"truly,nt35597", "qcom,reference-design-name-display";

I don't understand why we need the two compatible strings for this. Having "truly,nt35597" isn't quite correct in that case, because in itself that doesn't contain enough information for any programming.

Quoted 5 lines

If that chip can indeed be used to drive different panels, what we really need is the a compatible string that describes the complete assembly. In the driver we could then rely on parameterized common code that the panel driver can call into in order to program the driver chip.

+1 (fwiw)

I doubt the generic string is ever going to be useful on its own, but it could always be added later with a refactor of the code to tease out the generic bits. Given that the TCON vendor won't give up the docs for the magic initialization sequance, getting to a generic implementation is going to take a bit of work anyways.

Sean

Quoted 9 lines

Note that a driver is assumed to know what to do with a device that it gets bound to based on the compatible string. If some OS implements a driver for "truly,nt35597" but not "qcom,reference-design-name-display", then what is it supposed to do if it encounters the above list of compatible strings? It can't really program a mode because its missing essential information such as resolution or timings.

Thierry

Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#8 lore raw

Hi Thierry/Sean

Thanks for your comments.

Yes, I agree with you as well at the moment the generic "truly,nt35597" string doesnt have enough information to support multiple panels.

I am more comfortable renaming the compatible to "qcom,sdm845-mtp-2k-display" as we have all the pieces needed for this compatible string.

When we have more information about what other panels this can support, we can generalize it with multiple strings.

Hi Linus

If you agree with us, I will go ahead with changing the compatible string of this driver from "truly,nt35597" to "qcom,sdm845-mtp-2k-display".

When we have more information of some other panel resolution which can be supported we can add other generic strings.

But yes, I will still implement the parts of moving the display timings from the DT to the panel driver which lay the groundwork for extending this in the future to other resolutions.

Let me know your comments.

Thanks

Abhinav

Quoted 101 lines · Sean Paul
Quoted 92 lines · Thierry Reding
Quoted 79 lines · Linus Walleij

On Fri, Aug 3, 2018 at 4:49 AM Abhinav Kumar <[email protected]> wrote:

Hi Abhinav,

Quoted 25 lines

From: "[email protected]" <[email protected]>

Add support for Truly NT35597 panel used
in MSM reference platforms.

This panel supports both single DSI and dual DSI
modes.

However, this patch series adds support only for
dual DSI mode.

Changes in v5:
- Added comments for the delays
- Fix error messages and return code
- Start using backlight_enable/disable helpers
- Start using ARRAY_SIZE everywhere
- Split the panel commands into three sets to
remove redundant structure fields and simplify
the DCS command sending method
- Use of_get_drm_display_mode() and simplify
get_modes function
- Remove truly_wqxga_panel_del and do necessary
cleanup
- Replace dev_err with DRM_DEV_ERROR

Quoted 2 lines

Overall this driver looks good to me.

Just a question:

drivers/gpu/drm/panel/panel-truly-nt35597.c line 72

Quoted 5 lines
drivers/gpu/drm/panel/panel-truly-nt35597.c new file +5 -0
+struct cmd_set panel_cmds_set_1[] = {
+       /* CMD2_P0 */
+       { { 0xff, 0x20 } },
+       { { 0xfb, 0x01 } },
+       { { 0x00, 0x01 } },

This is what we call a jam table, I guess "magic init sequence".

There are some comments on what the different sections do, but in cases like this where there is no public datasheet, it would be nice to use some #defines rather than opaque hex codes, if you know what the different commands actually mean.

This is in order to help others with hacking on the driver.

If you don't have more info than this it's fine, just asking.

drivers/gpu/drm/panel/panel-truly-nt35597.c line 174

Quoted 2 lines
drivers/gpu/drm/panel/panel-truly-nt35597.c new file +2 -0
+       /* Resolution:1440x2560 */
+       { { 0x72, 0x02 } },

This is for example quite hard-coded. One gets the idea that the resolution is dynamic and that this is not really a panel per se but a panel driver, so the Truly NT35597 is not a panel but a panel driver that can be configured to be used with several physical panels.

Compare to other panel drivers such as Ilitek ILI9322 that is in this driver dir. There I make it a bit more transparent what the panel driver is actually doing on the inside, so if we find it is used with other physical panels we can reuse the code more easily.

drivers/gpu/drm/panel/panel-truly-nt35597.c line 398

Quoted 4 lines
drivers/gpu/drm/panel/panel-truly-nt35597.c new file +4 -0
+       truly_write_buf_func(ret, truly_dcs_write_buf,
+               panel, SHORT_PACKET,
+               ARRAY_SIZE(panel_cmds_set_1),
+               panel_cmds_set_1);

Instead of calling these "cmd_set_1" name them after what the command set actually does so we can follow the init flow. If you don't know what the commands do you could as well call it "magic 1", "magic 2" etc so we know it is magic.

drivers/gpu/drm/panel/panel-truly-nt35597.c line 664

Quoted 2 lines
drivers/gpu/drm/panel/panel-truly-nt35597.c new file +2 -0
+static const struct of_device_id truly_wqxga_of_match[] = {
+       { .compatible = "truly,nt35597", },
Quoted 7 lines

If this is a panel driver that not only configurable for wqxga but actually also other resolutions this is misleading.

I suspect this is indeed a panel driver and not a panel with integrated driver. I think the best is to define two compatible strings like we do for ILI9322:
"truly,nt35597", "qcom,reference-design-name-display";

I don't understand why we need the two compatible strings for this. Having "truly,nt35597" isn't quite correct in that case, because in itself that doesn't contain enough information for any programming.

Quoted 5 lines

If that chip can indeed be used to drive different panels, what we really need is the a compatible string that describes the complete assembly. In the driver we could then rely on parameterized common code that the panel driver can call into in order to program the driver chip.

+1 (fwiw)

Quoted 17 lines

I doubt the generic string is ever going to be useful on its own, but it could always be added later with a refactor of the code to tease out the generic bits. Given that the TCON vendor won't give up the docs for the magic initialization sequance, getting to a generic implementation is going to take a bit of work anyways.

Sean

Quoted 9 lines

Note that a driver is assumed to know what to do with a device that it gets bound to based on the compatible string. If some OS implements a driver for "truly,nt35597" but not "qcom,reference-design-name-display", then what is it supposed to do if it encounters the above list of compatible strings? It can't really program a mode because its missing essential information such as resolution or timings.

Thierry

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

#9 lore raw
In reply to Thierry Reding

On Thu, Aug 9, 2018 at 12:53 PM Thierry Reding <[email protected]> wrote:

[Me]

Quoted 9 lines
Quoted 4 lines

I suspect this is indeed a panel driver and not a panel with integrated driver. I think the best is to define two compatible strings like we do for ILI9322:
"truly,nt35597", "qcom,reference-design-name-display";

I don't understand why we need the two compatible strings for this. Having "truly,nt35597" isn't quite correct in that case, because in itself that doesn't contain enough information for any programming.

Quoted 5 lines

If that chip can indeed be used to drive different panels, what we really need is the a compatible string that describes the complete assembly. In the driver we could then rely on parameterized common code that the panel driver can call into in order to program the driver chip.

Good point.

Rob asked the same for the TPO driver, but that case is different.

For the TPO driver we had a situation where the display driver was kind of self-identifying, using HW straps to set up the mode, so the kernel driver only needed to read some registers to get basic functionality up, so it could use the compatible of the display driver itself.

In such cases it is useful with two compatible strings as there are always quirks (that is why we always have two compatible strings for SoCs) and a specific display/system may need e.g. specific gamma correction values even if basic graphics come up with just the display driver compatible strings.

So I would say it depens on how "plug-n-playsy" the display driver is.

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