Add driver for Novatek NT35596S panel
Subsystems (5)
v5 cover Add driver for Novatek NT35596S panel
These patches add support for Novatek NT35596S based JDI FHD panels, found in Xiaomi Mi Mix2S mobile phones.
Notes:
- I'm taking over this series as the original submitter is no longer able to work on/test those patches.
- Re-sending as I messed the1st attempt by not including the mailing lists; sorry to those impacted by the noise
Changes in v5:
- Move changelogs out of commit messages.
- Wrap comment/text lines around 80 chars.
Changes in v4:
- Correct numeric order of the items in binding.
Changes in v3:
- Embed the support into existing driver (panel-novatek-nt36672a), as these two IC are similar with different initialization commands.
Changes in v2:
- Correct items order in Makefile and improve failure handling.
Molly Sophia (2):
dt-bindings: display: panel: Add Novatek NT35596S panel bindings
drm: panel: Add novatek nt35596s panel driver
.../display/panel/novatek,nt36672a.yaml | 21 +- drivers/gpu/drm/panel/Kconfig | 7 +- .../gpu/drm/panel/panel-novatek-nt36672a.c | 251 ++++++++++++++++-- 3 files changed, 251 insertions(+), 28 deletions(-)
Signature · 1 line
2.40.1
PATCH RESEND v5 1/2 dt-bindings: display: panel: Add Novatek NT35596S panel bindings
From: Molly Sophia <[email protected]>
Add documentation for "novatek,nt35596s" panel.
---
Changes in v5:
- Move changelog out of commit message.
- Wrap header comment block lines around 80 chars.
Changes in v4:
- No change.
Changes in v3:
- Embed the support into existing driver (panel-novatek-nt36672a), as these two IC are similar with different initialization commands.
.../display/panel/novatek,nt36672a.yaml | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
Documentation/devicetree/bindings/display/panel/novatek,nt36672a.yaml +14 -7
@@ -20,14 +20,21 @@ allOf: properties: compatible: - items: - - enum: - - tianma,fhd-video - - const: novatek,nt36672a + oneOf: + - items: + - enum: + - jdi,fhd-nt35596s + - const: novatek,nt35596s + + - items: + - enum: + - tianma,fhd-video + - const: novatek,nt36672a + description: This indicates the panel manufacturer of the panel that is - in turn using the NT36672A panel driver. This compatible string - determines how the NT36672A panel driver is configured for the indicated - panel. The novatek,nt36672a compatible shall always be provided as a fallback. + in turn using the NT36672A or the NT35596S panel driver. This compatible + string determines how the panel driver is configured for the indicated + panel. reset-gpios: maxItems: 1
Signature · 1 line
2.40.1
PATCH RESEND v5 2/2 drm: panel: Add novatek nt35596s panel driver
In reply to Arnaud FerrarisFrom: Molly Sophia <[email protected]>
Novatek NT35596s is a generic DSI IC that drives command and video mode panels. Add the driver for it. Currently add support for the LCD panel from JDI connected with this IC, as found on Xiaomi Mi Mix2s phones.
---
Changes in v5:
- Move changelog out of commit message.
- Wrap description lines around 80 chars.
Changes in v4:
- Correct numeric order of the items.
Changes in v3:
- Embed the documentation into existing one (novatek,nt36672a).
drivers/gpu/drm/panel/Kconfig | 7 +- .../gpu/drm/panel/panel-novatek-nt36672a.c | 251 ++++++++++++++++-- 2 files changed, 237 insertions(+), 21 deletions(-)
drivers/gpu/drm/panel/Kconfig +4 -3
@@ -399,14 +399,15 @@ config DRM_PANEL_NOVATEK_NT36523 Boe panels used in Xiaomi Mi Pad 5 and 5 Pro tablets. config DRM_PANEL_NOVATEK_NT36672A - tristate "Novatek NT36672A DSI panel" + tristate "Novatek NT36672A/NT35596S DSI panel" depends on OF depends on DRM_MIPI_DSI depends on BACKLIGHT_CLASS_DEVICE help Say Y here if you want to enable support for the panels built - around the Novatek NT36672A display controller, such as some - Tianma panels used in a few Xiaomi Poco F1 mobile phones. + around the Novatek NT36672A or NT35596S display controller, such + as some Tianma panels used in a few Xiaomi Poco F1 mobile phones + or the JDI panels used in Xiaomi Mi Mix2S mobile phones. config DRM_PANEL_NOVATEK_NT39016 tristate "Novatek NT39016 RGB/SPI panel"
drivers/gpu/drm/panel/panel-novatek-nt36672a.c +233 -18
288 lines not on this page · raw message
Signature · 1 line
2.40.1
Re: [PATCH v5 2/2 RESEND] drm: panel: Add novatek nt35596s panel driver
Hi Arnaud & Molly,
overall the driver looks very good!
Quoted 8 lines · Arnaud Ferraris
From: Molly Sophia <[email protected]>
Novatek NT35596s is a generic DSI IC that drives command and video mode panels. Add the driver for it. Currently add support for the LCD panel from JDI connected with this IC, as found on Xiaomi Mi Mix2s phones.
Signed-off-by Molly Sophia <[email protected]>Signed-off-by Arnaud Ferraris <[email protected]>
(...)
Quoted 1 line
.../gpu/drm/panel/panel-novatek-nt36672a.c | 251 ++++++++++++++++--
So are you sure the nt35596s panel driver is so similar to nt36672a that they should share the same driver?
With all the magic number sequences I'm not so sure, do they really share any of the magic numbers?
If not, consider creating a new driver, and then base it on the nt35510 instead.
drivers/gpu/drm/panel/panel-novatek-nt36672a.c static const struct nt36672a_panel_desc tianma_fhd_video_panel_desc = { · line 613
Quoted 3 lines
drivers/gpu/drm/panel/panel-novatek-nt36672a.c +3
-0+static const struct nt36672a_panel_cmd jdi_nt35596s_video_on_cmds[] = { + { .data = {0xff ,0x24 } }, + { .data = {0x9d ,0x34 } },
(...)
These are never nice. Do you have a datasheet so you can provide defines for the magic hex values?
The construction with these .data seqence array
should be replaces with some open coded sequences
I feel, bit this pattern is already in the driver so I guess it's OK.
Yours,
Linus Walleij
Re: [PATCH v5 2/2 RESEND] drm: panel: Add novatek nt35596s panel driver
Hi Linus,
Le 23/07/2023 à 18:45, Linus Walleij a écrit :
Quoted 15 lines
Hi Arnaud & Molly,
overall the driver looks very good!
Quoted 8 lines · Arnaud Ferraris
From: Molly Sophia<[email protected]>
Novatek NT35596s is a generic DSI IC that drives command and video mode panels. Add the driver for it. Currently add support for the LCD panel from JDI connected with this IC, as found on Xiaomi Mi Mix2s phones.
Signed-off-by Molly Sophia<[email protected]>Signed-off-by Arnaud Ferraris<[email protected]>
Quoted 7 lines
(...)
Quoted 1 line
.../gpu/drm/panel/panel-novatek-nt36672a.c | 251 ++++++++++++++++--So are you sure the nt35596s panel driver is so similar to nt36672a that they should share the same driver?
With all the magic number sequences I'm not so sure, do they really share any of the magic numbers?
Their magic number sequences are quite different, however all the other bits (power/reset sequences and timings) fit in, which isn't the case of the other novatek panel drivers. Moreover, they have similar (although not identical) resolutions.
Quoted 2 lines
If not, consider creating a new driver, and then base it on the nt35510 instead.
I would gladly make this a new driver, but I'd rather base it on the nt36672a for the reasons mentioned above. I do fear, however, that this would lead to unnecessary code duplication, as 90% of the driver (magic number sequences excluded) would be identical to the nt36672a (and to be fully honest, I don't think I have the needed knowledge to make it "better").
Quoted 7 lines
drivers/gpu/drm/panel/panel-novatek-nt36672a.c static const struct nt36672a_panel_desc tianma_fhd_video_panel_desc = { · line 613
Quoted 3 lines
drivers/gpu/drm/panel/panel-novatek-nt36672a.c +3
-0+static const struct nt36672a_panel_cmd jdi_nt35596s_video_on_cmds[] = { + { .data = {0xff ,0x24 } }, + { .data = {0x9d ,0x34 } },(...)
These are never nice. Do you have a datasheet so you can provide defines for the magic hex values?
I found an old (2012) datasheet for the NT35596 (without the final "S") which is marked "Draft", so I'm really unsure this will be enough to make sense of those numbers.
Quoted 5 lines
The construction with these .data seqence array
should be replaces with some open coded sequences
I feel, bit this pattern is already in the driver so I guess it's OK. Yours,
Linus Walleij
Cheers,
Arnaud
Re: [PATCH v5 2/2 RESEND] drm: panel: Add novatek nt35596s panel driver
Quoted 4 lines · Arnaud Ferraris
Their magic number sequences are quite different, however all the other bits (power/reset sequences and timings) fit in, which isn't the case of the other novatek panel drivers. Moreover, they have similar (although not identical) resolutions.
Hm OK I guess.
Quoted 3 lines
I found an old (2012) datasheet for the NT35596 (without the final "S") which is marked "Draft", so I'm really unsure this will be enough to make sense of those numbers.
I would try to add the most obvious cases. (Such as "command FF", I am pretty sure it is clear what that does.)
As I pointed out in some other review, long term we want to support things such as gamma correction for panels, and then this kind of information will help greatly, even small pieces.
Yours,
Linus Walleij