Add Novatek NT37705 panel driver for Fairphone (Gen. 6)
Subsystems (6)
cover Add Novatek NT37705 panel driver for Fairphone (Gen. 6)
Add bindings and a panel driver for the NT37705, and then enable display on the Fairphone (Gen. 6).
Note: Patch 1-3 do not depend on the Milos MDSS bringup series, they can be applied independently.
---
Luca Weiss (4):
dt-bindings: display: panel: Add Novatek NT37705 drm/panel: Add driver for Novatek NT37705 panel
arm64: defconfig: Enable Novatek NT37705 panel
arm64: dts: qcom: milos-fairphone-fp6: Enable display
.../bindings/display/panel/novatek,nt37705.yaml | 72 ++++ arch/arm64/boot/dts/qcom/milos-fairphone-fp6.dts | 64 ++++ arch/arm64/configs/defconfig | 1 + drivers/gpu/drm/panel/Kconfig | 11 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-novatek-nt37705.c | 413 +++++++++++++++++++++ 6 files changed, 562 insertions(+)
---
base-commit: c9bd03db3e792a99e9789fde20e91898e3a29e8a
change-id: 20260501-fp6-panel-3d35c999d894
prerequisite-change-id: 20251219-milos-mdss-fa0763693775:v3
prerequisite-patch-id: eb0d468b35da2b234b281b1223ce3299e49c3146
prerequisite-patch-id: d8de96cf1d5868289b93dd890e1a67868b66ebce
prerequisite-patch-id: 23f8e2e01ae265fe8962a43c788868bc1967640a
prerequisite-patch-id: 34b01b7beea2893cc4dbc3d917b478f334dcef74
prerequisite-patch-id: a1876564bdf2964d4674235559087a2a2a78be30
prerequisite-patch-id: 7e866ca016d2197cc568a9e4a59d2d268d7c67e1
prerequisite-patch-id: 9ec10047940f6136c5728a823446f48ffa4dcf1a
prerequisite-patch-id: 51cb44ac4224d487d435e79e6f7f194b3e631ece
prerequisite-patch-id: cd2b2599074549ef6290b344e4e45b1bf585f815
prerequisite-patch-id: 9bfe20dedf9aca64108de67061f1c92c4010219c
prerequisite-patch-id: e7c15f6889fc82f0f98cfa729cf12ea818c5d733
prerequisite-patch-id: a386fbb74b890e46769d55e8a7ebd85c5f58b165
prerequisite-patch-id: 6e80149f6e03ccfca3050e7dd4c34413921b1218
prerequisite-patch-id: 86a95fa80e3d50962f62c3aed59e4be8d109eb5e
prerequisite-patch-id: 17dbc2de61f51cb511c25bdf5662fd7757c954d4
prerequisite-patch-id: f3b59bd165455ca2f49f7d21711186b47ffb0539
prerequisite-patch-id: 4322a9b6586785464b5b70fe21b23e62f06ca364
prerequisite-patch-id: 37dd052963130e7e2b535aecbe7bdcbd69e54012
prerequisite-patch-id: 1f4c7495a492902dff20d285e2a67c1dabb9d96b
Best regards,
Signature · 1 line
Luca Weiss <[email protected]>
PATCH 1/4 dt-bindings: display: panel: Add Novatek NT37705
Novatek NT37705 is a display driver IC used to drive AMOLED DSI panels.
Describe it and the panel in the Fairphone (Gen. 6) (BJ631JHM-T71-D900 from BOE) using it.
--- .../bindings/display/panel/novatek,nt37705.yaml | 72 ++++++++++++++++++++++ 1 file changed, 72 insertions(+)
Documentation/devicetree/bindings/display/panel/novatek,nt37705.yaml new file +72 -0
@@ -0,0 +1,72 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/panel/novatek,nt37705.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Novatek NT37705-based DSI display panels + +maintainers: + - Luca Weiss <[email protected]> + +description: + The Novatek NT37705 is a generic DSI Panel IC used to control AMOLED panels. + +allOf: + - $ref: panel-common.yaml# + +properties: + compatible: + contains: + const: boe,bj631jhm-t71-d900 + + reg: + maxItems: 1 + + vddio-supply: + description: I/O voltage rail + + dvdd-supply: + description: Digital voltage rail + + vci-supply: + description: Analog voltage rail + +required: + - compatible + - reg + - reset-gpios + - vddio-supply + - dvdd-supply + - vci-supply + - port + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + + dsi { + #address-cells = <1>; + #size-cells = <0>; + + panel@0 { + compatible = "boe,bj631jhm-t71-d900"; + reg = <0>; + + reset-gpios = <&tlmm 12 GPIO_ACTIVE_LOW>; + + vci-supply = <&vreg_l19b>; + vddio-supply = <&vreg_l9b>; + dvdd-supply = <&vreg_oled_dvdd_1p2>; + + port { + panel_in_0: endpoint { + remote-endpoint = <&dsi0_out>; + }; + }; + }; + }; + +...
Signature · 1 line
2.54.0
Re: [PATCH 1/4] dt-bindings: display: panel: Add Novatek NT37705
Quoted 27 lines · Luca Weiss
Novatek NT37705 is a display driver IC used to drive AMOLED DSI panels.
Describe it and the panel in the Fairphone (Gen. 6) (BJ631JHM-T71-D900 from BOE) using it.
Signed-off-by Luca Weiss <[email protected]>--- .../bindings/display/panel/novatek,nt37705.yaml | 72 ++++++++++++++++++++++ 1 file changed, 72 insertions(+)Documentation/devicetree/bindings/display/panel/novatek,nt37705.yaml new file +11
-0@@ -0,0 +1,72 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/panel/novatek,nt37705.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Novatek NT37705-based DSI display panels + +maintainers: + - Luca Weiss <[email protected]> +
Documentation/devicetree/bindings/display/panel/novatek,nt37705.yaml line 21
Quoted 10 lines
Documentation/devicetree/bindings/display/panel/novatek,nt37705.yaml new file +10
-0+description: + The Novatek NT37705 is a generic DSI Panel IC used to control AMOLED panels. + +allOf: + - $ref: panel-common.yaml# + +properties: + compatible: + contains: + const: boe,bj631jhm-t71-d900
Compatible doesn't match the filename, nor does the commit message match what you've got here. Sounds like you're missing a fallback to $filename.
pw-bot: changes-requested
Cheers,
Conor.
Quoted 55 lines
Documentation/devicetree/bindings/display/panel/novatek,nt37705.yaml new file +51
-0+ + reg: + maxItems: 1 + + vddio-supply: + description: I/O voltage rail + + dvdd-supply: + description: Digital voltage rail + + vci-supply: + description: Analog voltage rail + +required: + - compatible + - reg + - reset-gpios + - vddio-supply + - dvdd-supply + - vci-supply + - port + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + + dsi { + #address-cells = <1>; + #size-cells = <0>; + + panel@0 { + compatible = "boe,bj631jhm-t71-d900"; + reg = <0>; + + reset-gpios = <&tlmm 12 GPIO_ACTIVE_LOW>; + + vci-supply = <&vreg_l19b>; + vddio-supply = <&vreg_l9b>; + dvdd-supply = <&vreg_oled_dvdd_1p2>; + + port { + panel_in_0: endpoint { + remote-endpoint = <&dsi0_out>; + }; + }; + }; + }; + +...Signature · 2 lines
-- 2.54.0
Re: [PATCH 1/4] dt-bindings: display: panel: Add Novatek NT37705
Hi Conor,
Quoted 34 lines · Conor Dooley
Quoted 33 lines · Luca Weiss
Novatek NT37705 is a display driver IC used to drive AMOLED DSI panels.
Describe it and the panel in the Fairphone (Gen. 6) (BJ631JHM-T71-D900 from BOE) using it.
Signed-off-by Luca Weiss <[email protected]>--- .../bindings/display/panel/novatek,nt37705.yaml | 72 ++++++++++++++++++++++ 1 file changed, 72 insertions(+)Documentation/devicetree/bindings/display/panel/novatek,nt37705.yaml new file +17
-0@@ -0,0 +1,72 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/panel/novatek,nt37705.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Novatek NT37705-based DSI display panels + +maintainers: + - Luca Weiss <[email protected]> + +description: + The Novatek NT37705 is a generic DSI Panel IC used to control AMOLED panels. + +allOf: + - $ref: panel-common.yaml# +
Quoted 8 lines
Documentation/devicetree/bindings/display/panel/novatek,nt37705.yaml line 21
Quoted 4 lines
Documentation/devicetree/bindings/display/panel/novatek,nt37705.yaml new file +4
-0+properties: + compatible: + contains: + const: boe,bj631jhm-t71-d900Compatible doesn't match the filename, nor does the commit message match what you've got here. Sounds like you're missing a fallback to $filename.
The last times I was upstreaming panel drivers (Feb 2024 and June 2025), this was the requested way of doing things.
Compatible being the company and model number making the actual panel assembly (driver IC + touchscreen + glass etc), while the rest being named after the driver IC manufacturer & number.
As seen in
* himax,hx83112b + djn,98-03057-6598b-i (Fairphone 3)
* himax,hx83112a + djn,9a-3r063-1102b (Fairphone 4)
Fairphone 5 panel (raydium,rm692e5) was upstreamed earlier and follows different naming.
Has the way of doing things changed since then?
Regards
Luca
Re: [PATCH 1/4] dt-bindings: display: panel: Add Novatek NT37705
Quoted 46 lines · Luca Weiss
Hi Conor,
Quoted 34 lines · Conor Dooley
Quoted 33 lines · Luca Weiss
Novatek NT37705 is a display driver IC used to drive AMOLED DSI panels.
Describe it and the panel in the Fairphone (Gen. 6) (BJ631JHM-T71-D900 from BOE) using it.
Signed-off-by Luca Weiss <[email protected]>--- .../bindings/display/panel/novatek,nt37705.yaml | 72 ++++++++++++++++++++++ 1 file changed, 72 insertions(+)Documentation/devicetree/bindings/display/panel/novatek,nt37705.yaml new file +17
-0@@ -0,0 +1,72 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/panel/novatek,nt37705.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Novatek NT37705-based DSI display panels + +maintainers: + - Luca Weiss <[email protected]> + +description: + The Novatek NT37705 is a generic DSI Panel IC used to control AMOLED panels. + +allOf: + - $ref: panel-common.yaml# +Quoted 8 lines
Documentation/devicetree/bindings/display/panel/novatek,nt37705.yaml line 21
Quoted 4 lines
Documentation/devicetree/bindings/display/panel/novatek,nt37705.yaml new file +4
-0+properties: + compatible: + contains: + const: boe,bj631jhm-t71-d900Compatible doesn't match the filename, nor does the commit message match what you've got here. Sounds like you're missing a fallback to $filename.
Quoted 2 lines
The last times I was upstreaming panel drivers (Feb 2024 and June 2025), this was the requested way of doing things.
So this was requested that time and is requested now. What is here uncertain?
Quoted 4 lines
Compatible being the company and model number making the actual panel assembly (driver IC + touchscreen + glass etc), while the rest being named after the driver IC manufacturer & number.
So exactly what was asked for...
Quoted 7 lines
As seen in
* himax,hx83112b + djn,98-03057-6598b-i (Fairphone 3)
* himax,hx83112a + djn,9a-3r063-1102b (Fairphone 4)Fairphone 5 panel (raydium,rm692e5) was upstreamed earlier and follows different naming.
Best regards,
Krzysztof
Re: [PATCH 1/4] dt-bindings: display: panel: Add Novatek NT37705
Quoted 54 lines · Krzysztof Kozlowski
Quoted 46 lines · Luca Weiss
Hi Conor,
Quoted 34 lines · Conor Dooley
Quoted 33 lines · Luca Weiss
Novatek NT37705 is a display driver IC used to drive AMOLED DSI panels.
Describe it and the panel in the Fairphone (Gen. 6) (BJ631JHM-T71-D900 from BOE) using it.
Signed-off-by Luca Weiss <[email protected]>--- .../bindings/display/panel/novatek,nt37705.yaml | 72 ++++++++++++++++++++++ 1 file changed, 72 insertions(+)Documentation/devicetree/bindings/display/panel/novatek,nt37705.yaml new file +17
-0@@ -0,0 +1,72 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/panel/novatek,nt37705.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Novatek NT37705-based DSI display panels + +maintainers: + - Luca Weiss <[email protected]> + +description: + The Novatek NT37705 is a generic DSI Panel IC used to control AMOLED panels. + +allOf: + - $ref: panel-common.yaml# +Quoted 8 lines
Documentation/devicetree/bindings/display/panel/novatek,nt37705.yaml line 21
Quoted 4 lines
Documentation/devicetree/bindings/display/panel/novatek,nt37705.yaml new file +4
-0+properties: + compatible: + contains: + const: boe,bj631jhm-t71-d900Compatible doesn't match the filename, nor does the commit message match what you've got here. Sounds like you're missing a fallback to $filename.
Quoted 2 lines
The last times I was upstreaming panel drivers (Feb 2024 and June 2025), this was the requested way of doing things.
So this was requested that time and is requested now. What is here uncertain?
Quoted 1 line
Quoted 5 lines
Quoted 3 lines
Compatible being the company and model number making the actual panel assembly (driver IC + touchscreen + glass etc), while the rest being named after the driver IC manufacturer & number.
So exactly what was asked for...
Assuming "the rest" you mean the fallback. Just to remind - we talk here about the bindings, not drivers.
Best regards,
Krzysztof
Re: [PATCH 1/4] dt-bindings: display: panel: Add Novatek NT37705
In reply to Krzysztof KozlowskiHi Krzysztof,
Quoted 54 lines · Krzysztof Kozlowski
Quoted 46 lines · Luca Weiss
Hi Conor,
Quoted 34 lines · Conor Dooley
Quoted 33 lines · Luca Weiss
Novatek NT37705 is a display driver IC used to drive AMOLED DSI panels.
Describe it and the panel in the Fairphone (Gen. 6) (BJ631JHM-T71-D900 from BOE) using it.
Signed-off-by Luca Weiss <[email protected]>--- .../bindings/display/panel/novatek,nt37705.yaml | 72 ++++++++++++++++++++++ 1 file changed, 72 insertions(+)Documentation/devicetree/bindings/display/panel/novatek,nt37705.yaml new file +17
-0@@ -0,0 +1,72 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/panel/novatek,nt37705.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Novatek NT37705-based DSI display panels + +maintainers: + - Luca Weiss <[email protected]> + +description: + The Novatek NT37705 is a generic DSI Panel IC used to control AMOLED panels. + +allOf: + - $ref: panel-common.yaml# +Quoted 8 lines
Documentation/devicetree/bindings/display/panel/novatek,nt37705.yaml line 21
Quoted 4 lines
Documentation/devicetree/bindings/display/panel/novatek,nt37705.yaml new file +4
-0+properties: + compatible: + contains: + const: boe,bj631jhm-t71-d900Compatible doesn't match the filename, nor does the commit message match what you've got here. Sounds like you're missing a fallback to $filename.
Quoted 2 lines
The last times I was upstreaming panel drivers (Feb 2024 and June 2025), this was the requested way of doing things.
So this was requested that time and is requested now. What is here uncertain?
Quoted 1 line
Quoted 5 lines
Quoted 3 lines
Compatible being the company and model number making the actual panel assembly (driver IC + touchscreen + glass etc), while the rest being named after the driver IC manufacturer & number.
So exactly what was asked for...
I don't quite understand what is asked for now, that's my issue.
1. Change the filename to boe,bj631jhm-t71-d900.yaml and leave the rest as-is.
2. Add a fallback compatible for novatek,nt37705. IIRC last time it was argued that a "generic" nt37705 driver will never be correct for a specific panel since it's missing a bunch of panel-specific init. So that's why there should not be a fallback to nt37705.
Either way, it's different to what I was working on with the two examples I gave. Please help to clarify.
Regards
Luca
Quoted 6 lines
Quoted 6 lines
As seen in
* himax,hx83112b + djn,98-03057-6598b-i (Fairphone 3)
* himax,hx83112a + djn,9a-3r063-1102b (Fairphone 4)Fairphone 5 panel (raydium,rm692e5) was upstreamed earlier and follows different naming.
Re: [PATCH 1/4] dt-bindings: display: panel: Add Novatek NT37705
Quoted 23 lines · Luca Weiss
Quoted 15 lines
Quoted 10 lines
Quoted 7 lines
Documentation/devicetree/bindings/display/panel/novatek,nt37705.yaml line 21
Quoted 3 lines
Documentation/devicetree/bindings/display/panel/novatek,nt37705.yaml new file +3
-0+ compatible: + contains: + const: boe,bj631jhm-t71-d900Compatible doesn't match the filename, nor does the commit message match what you've got here. Sounds like you're missing a fallback to $filename.
The last times I was upstreaming panel drivers (Feb 2024 and June 2025), this was the requested way of doing things.
So this was requested that time and is requested now. What is here uncertain?
Quoted 1 line
Quoted 5 lines
Quoted 3 lines
Compatible being the company and model number making the actual panel assembly (driver IC + touchscreen + glass etc), while the rest being named after the driver IC manufacturer & number.
So exactly what was asked for...
I don't quite understand what is asked for now, that's my issue.
Quoted 7 lines
1. Change the filename to boe,bj631jhm-t71-d900.yaml and leave the rest as-is.
2. Add a fallback compatible for novatek,nt37705. IIRC last time it was argued that a "generic" nt37705 driver will never be correct for a specific panel since it's missing a bunch of panel-specific init. So that's why there should not be a fallback to nt37705.
To my limited knowledge the (2) with fallback describing the specific IC is preferred, because that compatible although not currently usable is still specific and describes actual IC used. I imagine that such fallback still could be useful to some SW implementation to determine the IC and act based on that.
If you have sources of other preference, please share, but I just gave same review to Neil for his ayaneo,wt0600-2k panels.
Best regards,
Krzysztof
Re: [PATCH 1/4] dt-bindings: display: panel: Add Novatek NT37705
Hi Krzysztof,
Quoted 32 lines · Krzysztof Kozlowski
Quoted 23 lines · Luca Weiss
Quoted 15 lines
Quoted 10 lines
Quoted 7 lines
Documentation/devicetree/bindings/display/panel/novatek,nt37705.yaml line 21
Quoted 3 lines
Documentation/devicetree/bindings/display/panel/novatek,nt37705.yaml new file +3
-0+ compatible: + contains: + const: boe,bj631jhm-t71-d900Compatible doesn't match the filename, nor does the commit message match what you've got here. Sounds like you're missing a fallback to $filename.
The last times I was upstreaming panel drivers (Feb 2024 and June 2025), this was the requested way of doing things.
So this was requested that time and is requested now. What is here uncertain?
Quoted 1 line
Quoted 5 lines
Quoted 3 lines
Compatible being the company and model number making the actual panel assembly (driver IC + touchscreen + glass etc), while the rest being named after the driver IC manufacturer & number.
So exactly what was asked for...
I don't quite understand what is asked for now, that's my issue.
Quoted 7 lines
1. Change the filename to boe,bj631jhm-t71-d900.yaml and leave the rest as-is.
2. Add a fallback compatible for novatek,nt37705. IIRC last time it was argued that a "generic" nt37705 driver will never be correct for a specific panel since it's missing a bunch of panel-specific init. So that's why there should not be a fallback to nt37705.
Quoted 8 lines
To my limited knowledge the (2) with fallback describing the specific IC is preferred, because that compatible although not currently usable is still specific and describes actual IC used. I imagine that such fallback still could be useful to some SW implementation to determine the IC and act based on that.
If you have sources of other preference, please share, but I just gave same review to Neil for his ayaneo,wt0600-2k panels.
I found the discussion from 2024 for the Fairphone 4 panel:
https://lore.kernel.org/lkml/[email protected]/
(quoting)
'''
Not sure if "himax,hx83112a" is needed here, the "djn,9a-3r063-1102b" is enough to know the IC is hx83112a.
I don't think you'll ever find a "djn,9a-3r063-1102b" with another controller IC ?
And "himax,hx83112a" alone as fallback is not enough to describe the panel hardware, so I think it should be dropped.
'''
With Konrad replying "+1" to that.
Regards
Luca
Krzysztof Kozlowski
Reviewed-byRe: [PATCH 1/4] dt-bindings: display: panel: Add Novatek NT37705
Quoted 54 lines · Luca Weiss
Hi Krzysztof,
Quoted 32 lines · Krzysztof Kozlowski
Quoted 23 lines · Luca Weiss
Quoted 15 lines
Quoted 10 lines
Quoted 7 lines
Review
Quoted 3 lines
(quoted diff) +3
-0+ compatible: + contains: + const: boe,bj631jhm-t71-d900Compatible doesn't match the filename, nor does the commit message match what you've got here. Sounds like you're missing a fallback to $filename.
The last times I was upstreaming panel drivers (Feb 2024 and June 2025), this was the requested way of doing things.
So this was requested that time and is requested now. What is here uncertain?
Quoted 1 line
Quoted 5 lines
Quoted 3 lines
Compatible being the company and model number making the actual panel assembly (driver IC + touchscreen + glass etc), while the rest being named after the driver IC manufacturer & number.
So exactly what was asked for...
I don't quite understand what is asked for now, that's my issue.
Quoted 7 lines
1. Change the filename to boe,bj631jhm-t71-d900.yaml and leave the rest as-is.
2. Add a fallback compatible for novatek,nt37705. IIRC last time it was argued that a "generic" nt37705 driver will never be correct for a specific panel since it's missing a bunch of panel-specific init. So that's why there should not be a fallback to nt37705.
Quoted 8 lines
To my limited knowledge the (2) with fallback describing the specific IC is preferred, because that compatible although not currently usable is still specific and describes actual IC used. I imagine that such fallback still could be useful to some SW implementation to determine the IC and act based on that.
If you have sources of other preference, please share, but I just gave same review to Neil for his ayaneo,wt0600-2k panels.
I found the discussion from 2024 for the Fairphone 4 panel:
https://lore.kernel.org/lkml/[email protected]/
(quoting)
'''
Not sure if "himax,hx83112a" is needed here, the "djn,9a-3r063-1102b" is enough to know the IC is hx83112a.
Quoted 8 lines
I don't think you'll ever find a "djn,9a-3r063-1102b" with another controller IC ?
And "himax,hx83112a" alone as fallback is not enough to describe the panel hardware, so I think it should be dropped.
'''With Konrad replying "+1" to that.
The arguments from Linux drivers point of view are correct. And you can apply the same to board-level compatibles. Each most-specific board level compatible already defines the soc, thus soc-compatible fallback is redundant, right?
And also the soc-compatible fallback is too generic to be used alone by the SW in many cases.
Yet we use it. Same here. Why? For the same reasons as we use for board-level compatibles. Because that's convenient way for defining quirks for the controller IC which otherwise would need to match all panel compatibles.
I do not insist on this (for panels, of course), however I would prefer consistency in the code and in the reviews. Heh, I bet you too would prefer consistency. :) All my recent reviews were proposing to have the fallback, thus I consistently propose one here, but I won't object for the patch in current form, thus:
But please also add Link to this exact email I am writing.
( Link: ....)
Best regards,
Krzysztof
Re: [PATCH 1/4] dt-bindings: display: panel: Add Novatek NT37705
Quoted 83 lines · Krzysztof Kozlowski
Quoted 54 lines · Luca Weiss
Hi Krzysztof,
Quoted 32 lines · Krzysztof Kozlowski
Quoted 23 lines · Luca Weiss
Quoted 15 lines
Quoted 10 lines
Quoted 7 lines
Review
Quoted 3 lines
(quoted diff) +3
-0+ compatible: + contains: + const: boe,bj631jhm-t71-d900Compatible doesn't match the filename, nor does the commit message match what you've got here. Sounds like you're missing a fallback to $filename.
The last times I was upstreaming panel drivers (Feb 2024 and June 2025), this was the requested way of doing things.
So this was requested that time and is requested now. What is here uncertain?
Quoted 1 line
Quoted 5 lines
Quoted 3 lines
Compatible being the company and model number making the actual panel assembly (driver IC + touchscreen + glass etc), while the rest being named after the driver IC manufacturer & number.
So exactly what was asked for...
I don't quite understand what is asked for now, that's my issue.
Quoted 7 lines
1. Change the filename to boe,bj631jhm-t71-d900.yaml and leave the rest as-is.
2. Add a fallback compatible for novatek,nt37705. IIRC last time it was argued that a "generic" nt37705 driver will never be correct for a specific panel since it's missing a bunch of panel-specific init. So that's why there should not be a fallback to nt37705.
Quoted 8 lines
To my limited knowledge the (2) with fallback describing the specific IC is preferred, because that compatible although not currently usable is still specific and describes actual IC used. I imagine that such fallback still could be useful to some SW implementation to determine the IC and act based on that.
If you have sources of other preference, please share, but I just gave same review to Neil for his ayaneo,wt0600-2k panels.
I found the discussion from 2024 for the Fairphone 4 panel:
https://lore.kernel.org/lkml/[email protected]/
(quoting)
'''
Not sure if "himax,hx83112a" is needed here, the "djn,9a-3r063-1102b" is enough to know the IC is hx83112a.Quoted 8 lines
I don't think you'll ever find a "djn,9a-3r063-1102b" with another controller IC ?
And "himax,hx83112a" alone as fallback is not enough to describe the panel hardware, so I think it should be dropped.
'''With Konrad replying "+1" to that.
The arguments from Linux drivers point of view are correct. And you can apply the same to board-level compatibles. Each most-specific board level compatible already defines the soc, thus soc-compatible fallback is redundant, right?
And also the soc-compatible fallback is too generic to be used alone by the SW in many cases.
Yet we use it. Same here. Why? For the same reasons as we use for board-level compatibles. Because that's convenient way for defining quirks for the controller IC which otherwise would need to match all panel compatibles.
I do not insist on this (for panels, of course), however I would prefer consistency in the code and in the reviews. Heh, I bet you too would prefer consistency. :) All my recent reviews were proposing to have the fallback, thus I consistently propose one here, but I won't object for the patch in current form, thus:
Quoted 5 lines
Reviewed-by Krzysztof Kozlowski <[email protected]>But please also add Link to this exact email I am writing.
( Link: ....)
Best regards,
Krzysztof
PATCH 2/4 drm/panel: Add driver for Novatek NT37705 panel
In reply to Luca WeissAdd support for the 2484x1116 AMOLED panel from BOE (BJ631JHM-T71-D900) bundled with a NT37705 driver IC, as found on the Fairphone (Gen. 6) smartphone.
The panel can also be configured in 10-bit (RGB101010) mode, however currently it's configured in 8-bit (RGB888) since there's some issues in the Qualcomm DPU driver when driving this panel in 10-bit.
--- drivers/gpu/drm/panel/Kconfig | 11 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-novatek-nt37705.c | 413 ++++++++++++++++++++++++++ 3 files changed, 425 insertions(+)
drivers/gpu/drm/panel/Kconfig +11 -0
@@ -624,6 +624,17 @@ config DRM_PANEL_NOVATEK_NT37700F Say Y here if you want to enable support for Novatek NT37700F DSI panel module. The panel has a resolution of 1080x2160. +config DRM_PANEL_NOVATEK_NT37705 + tristate "Novatek NT37705-based DSI panel" + depends on OF + depends on DRM_MIPI_DSI + depends on BACKLIGHT_CLASS_DEVICE + select DRM_KMS_HELPER + help + Say Y here if you want to enable support for Novatek NT37705-based + display panels, such as the one found in the The Fairphone (Gen. 6) + smartphone. + config DRM_PANEL_NOVATEK_NT37801 tristate "Novatek NT37801/NT37810 AMOLED DSI panel" depends on OF
drivers/gpu/drm/panel/Makefile +1 -0
@@ -61,6 +61,7 @@ obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36523) += panel-novatek-nt36523.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36672A) += panel-novatek-nt36672a.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36672E) += panel-novatek-nt36672e.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT37700F) += panel-novatek-nt37700f.o +obj-$(CONFIG_DRM_PANEL_NOVATEK_NT37705) += panel-novatek-nt37705.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT37801) += panel-novatek-nt37801.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT39016) += panel-novatek-nt39016.o obj-$(CONFIG_DRM_PANEL_MANTIX_MLAF057WE51) += panel-mantix-mlaf057we51.o
drivers/gpu/drm/panel/panel-novatek-nt37705.c new file +413 -0
413 lines not on this page · raw message
Signature · 1 line
2.54.0
Re: [PATCH 2/4] drm/panel: Add driver for Novatek NT37705 panel
Quoted 297 lines · Luca Weiss
Add support for the 2484x1116 AMOLED panel from BOE (BJ631JHM-T71-D900) bundled with a NT37705 driver IC, as found on the Fairphone (Gen. 6) smartphone.
The panel can also be configured in 10-bit (RGB101010) mode, however currently it's configured in 8-bit (RGB888) since there's some issues in the Qualcomm DPU driver when driving this panel in 10-bit.
Signed-off-by Luca Weiss <[email protected]>--- drivers/gpu/drm/panel/Kconfig | 11 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-novatek-nt37705.c | 413 ++++++++++++++++++++++++++ 3 files changed, 425 insertions(+)drivers/gpu/drm/panel/Kconfig +11
-0@@ -624,6 +624,17 @@ config DRM_PANEL_NOVATEK_NT37700F Say Y here if you want to enable support for Novatek NT37700F DSI panel module. The panel has a resolution of 1080x2160. +config DRM_PANEL_NOVATEK_NT37705 + tristate "Novatek NT37705-based DSI panel" + depends on OF + depends on DRM_MIPI_DSI + depends on BACKLIGHT_CLASS_DEVICE + select DRM_KMS_HELPER + help + Say Y here if you want to enable support for Novatek NT37705-based + display panels, such as the one found in the The Fairphone (Gen. 6) + smartphone. + config DRM_PANEL_NOVATEK_NT37801 tristate "Novatek NT37801/NT37810 AMOLED DSI panel" depends on OFdrivers/gpu/drm/panel/Makefile +1
-0@@ -61,6 +61,7 @@ obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36523) += panel-novatek-nt36523.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36672A) += panel-novatek-nt36672a.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36672E) += panel-novatek-nt36672e.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT37700F) += panel-novatek-nt37700f.o +obj-$(CONFIG_DRM_PANEL_NOVATEK_NT37705) += panel-novatek-nt37705.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT37801) += panel-novatek-nt37801.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT39016) += panel-novatek-nt39016.o obj-$(CONFIG_DRM_PANEL_MANTIX_MLAF057WE51) += panel-mantix-mlaf057we51.odrivers/gpu/drm/panel/panel-novatek-nt37705.c new file +242
-0@@ -0,0 +1,413 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Generated with linux-mdss-dsi-panel-driver-generator from vendor device tree. +* Copyright (c) 2026 Luca Weiss <[email protected]> +*/ + +#include <linux/backlight.h> +#include <linux/delay.h> +#include <linux/gpio/consumer.h> +#include <linux/mod_devicetable.h> +#include <linux/module.h> +#include <linux/regulator/consumer.h> + +#include <video/mipi_display.h> + +#include <drm/display/drm_dsc.h> +#include <drm/display/drm_dsc_helper.h> +#include <drm/drm_mipi_dsi.h> +#include <drm/drm_modes.h> +#include <drm/drm_panel.h> +#include <drm/drm_probe_helper.h> + +struct nt37705_panel { +struct drm_panel panel; +struct mipi_dsi_device *dsi; +struct drm_dsc_config dsc; +struct regulator_bulk_data *supplies; +struct gpio_desc *reset_gpio; +}; + +static const struct regulator_bulk_data nt37705_supplies[] = { + { .supply ="vddio" }, + { .supply ="dvdd" }, + { .supply ="vci" }, +}; + +static inline struct nt37705_panel *to_nt37705_panel (struct drm_panel *panel) +{ + return container_of_const(panel, struct nt37705_panel, panel); +} + +static void nt37705_reset (struct nt37705_panel *ctx) +{ +gpiod_set_value_cansleep (ctx->reset_gpio,0 ); +usleep_range (10000 ,11000 ); +gpiod_set_value_cansleep (ctx->reset_gpio,1 ); +usleep_range (5000 ,6000 ); +gpiod_set_value_cansleep (ctx->reset_gpio,0 ); +usleep_range (10000 ,11000 ); +} + +static int nt37705_on (struct nt37705_panel *ctx) +{ +struct mipi_dsi_multi_context dsi_ctx = { .dsi = ctx->dsi }; + + ctx->dsi->mode_flags |=MIPI_DSI_MODE_LPM ; + +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf0 , +0x55 ,0xaa ,0x52 ,0x08 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x1b ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba ,0x18 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x1c ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x01 ,0x01 ,0x01 ,0x01 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x2c ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x00 ,0x01 ,0x01 ,0x01 ,0x00 ,0x05 ,0x05 , +0x05 ,0x00 ,0x05 ,0x05 ,0x05 ,0x00 ,0x00 , +0x00 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x3c ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x00 ,0x00 ,0x01 ,0x01 ,0x00 ,0x00 ,0x0b , +0x0b ,0x00 ,0x00 ,0x0b ,0x0b ,0x00 ,0x00 , +0x00 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x4c ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x00 ,0x00 ,0x00 ,0x01 ,0x00 ,0x00 ,0x00 , +0x1d ,0x00 ,0x00 ,0x00 ,0x1d ,0x00 ,0x00 , +0x00 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x5c ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x01 ,0x01 ,0x01 ,0x01 ,0x01 ,0x01 ,0x01 , +0x01 ,0x01 ,0x01 ,0x01 ,0x01 ,0x01 ,0x01 , +0x01 ,0x01 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x6c ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x00 ,0x01 ,0x02 ,0x03 ,0x04 ,0x05 ,0x0b , +0x77 ,0x77 ,0x00 ,0x00 ,0x0b ,0x00 ,0x1d , +0x00 ,0x1d ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x7c ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x00 ,0x01 ,0x02 ,0x03 ,0x04 ,0x05 ,0x0b , +0x77 ,0x77 ,0x00 ,0x00 ,0x0b ,0x00 ,0x1d , +0x00 ,0x1d ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x8c ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x9c ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x11 ,0x11 ,0x20 ,0x02 ,0x00 ,0x03 ,0x00 , +0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0xa4 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba ,0x00 ,0xc0 ,0x40 ,0x08 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0xa8 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x22 ,0x22 ,0x22 ,0x22 ,0x22 ,0x22 ,0x22 , +0x22 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0xb0 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x22 ,0x22 ,0x22 ,0x22 ,0x22 ,0x22 ,0x22 , +0x22 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf0 , +0x55 ,0xaa ,0x52 ,0x08 ,0x01 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x05 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xc5 ,0x15 ,0x15 ,0x15 ,0xdd ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf0 , +0x55 ,0xaa ,0x52 ,0x08 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x0e ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xb5 ,0x32 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf0 , +0x55 ,0xaa ,0x52 ,0x00 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xff ,0xaa ,0x55 ,0xa5 ,0x80 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x19 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf2 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x1a ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf4 ,0x55 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x11 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf8 ,0x01 ,0x7f ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x2d ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf8 ,0x01 ,0x20 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xff ,0xaa ,0x55 ,0xa5 ,0x81 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x05 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xfe ,0x3c ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x02 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf9 ,0x04 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x1e ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xfb ,0x0f ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x0f ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf5 ,0x20 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x0d ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xfb ,0x80 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xff ,0xaa ,0x55 ,0xa5 ,0x83 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x12 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xfe ,0x41 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x13 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xfd ,0x21 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xff ,0xaa ,0x55 ,0xa5 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x35 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,MIPI_DCS_WRITE_CONTROL_DISPLAY , +0x20 ); +mipi_dsi_dcs_set_column_address_multi (&dsi_ctx,0x0000 ,0x045b ); +mipi_dsi_dcs_set_page_address_multi (&dsi_ctx,0x0000 ,0x09b3 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,MIPI_DCS_SET_GAMMA_CURVE ,0x00 ); +mipi_dsi_dcs_set_display_brightness_multi (&dsi_ctx,0xbb0d ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x04 ); +mipi_dsi_dcs_set_display_brightness_multi (&dsi_ctx,0xfe0f ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x81 ,0x01 ,0x19 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x03 ,0x01 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x90 ,0x03 ,0x03 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x91 , +0x89 ,0x28 ,0x00 ,0x0c ,0xd2 ,0x00 ,0x02 , +0x2f ,0x01 ,0x18 ,0x00 ,0x07 ,0x09 ,0x75 , +0x08 ,0x34 ,0x10 ,0xf0 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x2f ,0x02 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x5a ,0x01 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x2f ,0x30 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6d ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x11 ,0x00 ); +mipi_dsi_msleep (&dsi_ctx,120 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x29 ,0x00 ); +mipi_dsi_msleep (&dsi_ctx,22 ); + +return dsi_ctx.accum_err; +} + +static int nt37705_off (struct nt37705_panel *ctx) +{ +struct mipi_dsi_multi_context dsi_ctx = { .dsi = ctx->dsi }; + + ctx->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM ; + +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x28 ,0x00 ); +mipi_dsi_msleep (&dsi_ctx,20 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x10 ,0x00 ); +mipi_dsi_msleep (&dsi_ctx,120 ); + +return dsi_ctx.accum_err; +} + +static int nt37705_prepare (struct drm_panel *panel) +{ +struct nt37705_panel *ctx =to_nt37705_panel (panel); +struct device *dev = &ctx->dsi->dev; +struct drm_dsc_picture_parameter_set pps; +int ret; + + ret =regulator_bulk_enable (ARRAY_SIZE (nt37705_supplies), ctx->supplies); +if (ret <0 ) { +dev_err (dev,"Failed to enable regulators: %d\n" , ret); +return ret; + } + +nt37705_reset (ctx); + + ret =nt37705_on (ctx); +if (ret <0 ) { +dev_err (dev,"Failed to initialize panel: %d\n" , ret); +gpiod_set_value_cansleep (ctx->reset_gpio,1 ); +regulator_bulk_disable (ARRAY_SIZE (nt37705_supplies), ctx->supplies); +return ret; + } + +drm_dsc_pps_payload_pack (&pps, &ctx->dsc); + + ret =mipi_dsi_picture_parameter_set (ctx->dsi, &pps); +if (ret <0 ) { +dev_err (panel->dev,"failed to transmit PPS: %d\n" , ret); +return ret; + } + + ret =mipi_dsi_compression_mode (ctx->dsi, true); +if (ret <0 ) { +dev_err (dev,"failed to enable compression mode: %d\n" , ret); +return ret; + } + +msleep (28 );/* TODO: Is this panel-dependent? */ + +return 0 ; +} + +static int nt37705_unprepare (struct drm_panel *panel) +{ +struct nt37705_panel *ctx =to_nt37705_panel (panel); +struct device *dev = &ctx->dsi->dev; +int ret; + + ret =nt37705_off (ctx);
drivers/gpu/drm/panel/panel-novatek-nt37705.c line 252
Quoted 10 lines
drivers/gpu/drm/panel/panel-novatek-nt37705.c new file +10
-0+if (ret <0 ) +dev_err (dev,"Failed to un-initialize panel: %d\n" , ret); + +gpiod_set_value_cansleep (ctx->reset_gpio,1 ); +regulator_bulk_disable (ARRAY_SIZE (nt37705_supplies), ctx->supplies); + +return 0 ; +} + +static const struct drm_display_mode nt37705_mode = {
this is definitely related to the panel, not the DDIC, thus naming should reflect that
Quoted 45 lines
drivers/gpu/drm/panel/panel-novatek-nt37705.c new file +45
-0+ .clock = (1116 + 100 + 30 + 100) * (2484 + 70 + 48 + 70) * 120 / 1000, + .hdisplay = 1116, + .hsync_start = 1116 + 100, + .hsync_end = 1116 + 100 + 30, + .htotal = 1116 + 100 + 30 + 100, + .vdisplay = 2484, + .vsync_start = 2484 + 70, + .vsync_end = 2484 + 70 + 48, + .vtotal = 2484 + 70 + 48 + 70, + .width_mm = 66, + .height_mm = 146, + .type = DRM_MODE_TYPE_DRIVER, +}; + +static int nt37705_get_modes (struct drm_panel *panel, +struct drm_connector *connector) +{ +return drm_connector_helper_get_modes_fixed (connector, &nt37705_mode); +} + +static const struct drm_panel_funcs nt37705_panel_funcs = { + .prepare = nt37705_prepare, + .unprepare = nt37705_unprepare, + .get_modes = nt37705_get_modes, +}; + +static int nt37705_bl_update_status (struct backlight_device *bl) +{ +struct mipi_dsi_device *dsi =bl_get_data (bl); +u16 brightness =backlight_get_brightness (bl); +int ret; + + dsi->mode_flags &= ~MIPI_DSI_MODE_LPM ; + + ret =mipi_dsi_dcs_set_display_brightness_large (dsi, brightness); +if (ret <0 ) +return ret; + + dsi->mode_flags |=MIPI_DSI_MODE_LPM ; + +return 0 ; +} + +static const struct backlight_ops nt37705_bl_ops = { + .update_status = nt37705_bl_update_status,
drivers/gpu/drm/panel/panel-novatek-nt37705.c line 307
Quoted 10 lines
drivers/gpu/drm/panel/panel-novatek-nt37705.c new file +10
-0+}; + +static struct backlight_device * +nt37705_create_backlight (struct mipi_dsi_device *dsi) +{ +struct device *dev = &dsi->dev; +const struct backlight_properties props = { + .type =BACKLIGHT_RAW , + .scale =BACKLIGHT_SCALE_NON_LINEAR , + .brightness =4095 ,
maybe setting it to half at boot would be sensible?
Quoted 80 lines
drivers/gpu/drm/panel/panel-novatek-nt37705.c new file +80
-0+ .max_brightness = 4095, + }; + +return devm_backlight_device_register (dev,dev_name (dev), dev, dsi, + &nt37705_bl_ops, &props); +} + +static int nt37705_probe (struct mipi_dsi_device *dsi) +{ +struct device *dev = &dsi->dev; +struct nt37705_panel *ctx; +int ret; + + ctx = devm_drm_panel_alloc(dev, struct nt37705_panel, panel, + &nt37705_panel_funcs, +DRM_MODE_CONNECTOR_DSI ); +if (IS_ERR (ctx)) +return PTR_ERR (ctx); + + ret =devm_regulator_bulk_get_const (dev, +ARRAY_SIZE (nt37705_supplies), + nt37705_supplies, + &ctx->supplies); +if (ret <0 ) +return ret; + + ctx->reset_gpio =devm_gpiod_get (dev,"reset" ,GPIOD_OUT_HIGH ); +if (IS_ERR (ctx->reset_gpio)) +return dev_err_probe (dev,PTR_ERR (ctx->reset_gpio), +"Failed to get reset-gpios\n" ); + + ctx->dsi = dsi; +mipi_dsi_set_drvdata (dsi, ctx); + + dsi->lanes =4 ; + dsi->format =MIPI_DSI_FMT_RGB888 ; + dsi->mode_flags =MIPI_DSI_MODE_NO_EOT_PACKET | +MIPI_DSI_CLOCK_NON_CONTINUOUS ; + + ctx->panel.prepare_prev_first = true; + + ctx->panel.backlight =nt37705_create_backlight (dsi); +if (IS_ERR (ctx->panel.backlight)) +return dev_err_probe (dev,PTR_ERR (ctx->panel.backlight), +"Failed to create backlight\n" ); + +drm_panel_add (&ctx->panel); + +/* This panel only supports DSC; unconditionally enable it */ + dsi->dsc = &ctx->dsc; + + ctx->dsc.dsc_version_major =1 ; + ctx->dsc.dsc_version_minor =1 ; + +/* TODO: Pass slice_per_pkt = 2 */ + ctx->dsc.slice_height =12 ; + ctx->dsc.slice_width =558 ; +/* +* TODO: hdisplay should be read from the selected mode once +* it is passed back to drm_panel (in prepare?) +*/ +WARN_ON (1116 % ctx->dsc.slice_width); + ctx->dsc.slice_count =1116 / ctx->dsc.slice_width; + ctx->dsc.bits_per_component =8 ; + ctx->dsc.bits_per_pixel =8 <<4 ;/* 4 fractional bits */ + ctx->dsc.block_pred_enable = true; + + ret =mipi_dsi_attach (dsi); +if (ret <0 ) { +drm_panel_remove (&ctx->panel); +return dev_err_probe (dev, ret,"Failed to attach to DSI host\n" ); + } + +return 0 ; +} + +static void nt37705_remove (struct mipi_dsi_device *dsi) +{ +struct nt37705_panel *ctx =mipi_dsi_get_drvdata (dsi); +int ret;
drivers/gpu/drm/panel/panel-novatek-nt37705.c line 397
Quoted 10 lines
drivers/gpu/drm/panel/panel-novatek-nt37705.c new file +10
-0+ + ret =mipi_dsi_detach (dsi); +if (ret <0 ) +dev_err (&dsi->dev,"Failed to detach from DSI host: %d\n" , ret); + +drm_panel_remove (&ctx->panel); +} + +static const struct of_device_id nt37705_of_match[] = { + { .compatible ="boe,bj631jhm-t71-d900" },
it would make sense to put DDIC as part of compatible, something like novatek,nt37705-bj631jhm
we communite with DDIC, not with the panel directly.
Quoted 17 lines
drivers/gpu/drm/panel/panel-novatek-nt37705.c new file +16
-0+ {/* sentinel */ } +}; +MODULE_DEVICE_TABLE (of, nt37705_of_match); + +static struct mipi_dsi_driver nt37705_driver = { + .probe = nt37705_probe, + .remove = nt37705_remove, + .driver = { + .name ="panel-novatek-nt37705" , + .of_match_table = nt37705_of_match, + }, +}; +module_mipi_dsi_driver (nt37705_driver); + +MODULE_DESCRIPTION ("DRM driver for NT37705-equipped DSI panels" ); +MODULE_LICENSE ("GPL" );
Signature · 1 line
David Heidelberg
Thomas Zimmermann
maintainerRe: [PATCH 2/4] drm/panel: Add driver for Novatek NT37705 panel
In reply to Luca WeissHi
Am 01.05.26 um 15:52 schrieb Luca Weiss:
Quoted 22 lines
Add support for the 2484x1116 AMOLED panel from BOE (BJ631JHM-T71-D900) bundled with a NT37705 driver IC, as found on the Fairphone (Gen. 6) smartphone.
The panel can also be configured in 10-bit (RGB101010) mode, however currently it's configured in 8-bit (RGB888) since there's some issues in the Qualcomm DPU driver when driving this panel in 10-bit.
Signed-off-by Luca Weiss <[email protected]>--- drivers/gpu/drm/panel/Kconfig | 11 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-novatek-nt37705.c | 413 ++++++++++++++++++++++++++ 3 files changed, 425 insertions(+)drivers/gpu/drm/panel/Kconfig +0
-0@@ -624,6 +624,17 @@ config DRM_PANEL_NOVATEK_NT37700F Say Y here if you want to enable support for Novatek NT37700F DSI panel module. The panel has a resolution of 1080x2160.
drivers/gpu/drm/panel/Kconfig config DRM_PANEL_NOVATEK_NT37700F · line 635
Quoted 10 lines
drivers/gpu/drm/panel/Kconfig +9
-0+config DRM_PANEL_NOVATEK_NT37705 + tristate "Novatek NT37705-based DSI panel" + depends on OF + depends on DRM_MIPI_DSI + depends on BACKLIGHT_CLASS_DEVICE + select DRM_KMS_HELPER + help + Say Y here if you want to enable support for Novatek NT37705-based + display panels, such as the one found in the The Fairphone (Gen. 6)
Duplicate 'the'
Quoted 30 lines
drivers/gpu/drm/panel/Kconfig +2
-0+ smartphone. + config DRM_PANEL_NOVATEK_NT37801 tristate "Novatek NT37801/NT37810 AMOLED DSI panel" depends on OFdrivers/gpu/drm/panel/Makefile +1
-0@@ -61,6 +61,7 @@ obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36523) += panel-novatek-nt36523.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36672A) += panel-novatek-nt36672a.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36672E) += panel-novatek-nt36672e.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT37700F) += panel-novatek-nt37700f.o +obj-$(CONFIG_DRM_PANEL_NOVATEK_NT37705) += panel-novatek-nt37705.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT37801) += panel-novatek-nt37801.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT39016) += panel-novatek-nt39016.o obj-$(CONFIG_DRM_PANEL_MANTIX_MLAF057WE51) += panel-mantix-mlaf057we51.odrivers/gpu/drm/panel/panel-novatek-nt37705.c new file +7
-0@@ -0,0 +1,413 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Generated with linux-mdss-dsi-panel-driver-generator from vendor device tree. +* Copyright (c) 2026 Luca Weiss <[email protected]> +*/ + +#include <linux/backlight.h>
drivers/gpu/drm/panel/panel-novatek-nt37705.c line 17
Quoted 10 lines
drivers/gpu/drm/panel/panel-novatek-nt37705.c new file +10
-0+#include <linux/delay.h> +#include <linux/gpio/consumer.h> +#include <linux/mod_devicetable.h> +#include <linux/module.h> +#include <linux/regulator/consumer.h> + +#include <video/mipi_display.h> + +#include <drm/display/drm_dsc.h> +#include <drm/display/drm_dsc_helper.h>
IIRC this requires
select DRM_DISPLAY_DSC_HELPER
in the Kconfig. Maybe double-check.
Quoted 12 lines
drivers/gpu/drm/panel/panel-novatek-nt37705.c new file +12
-0+#include <drm/drm_mipi_dsi.h> +#include <drm/drm_modes.h> +#include <drm/drm_panel.h> +#include <drm/drm_probe_helper.h> + +struct nt37705_panel { +struct drm_panel panel; +struct mipi_dsi_device *dsi; +struct drm_dsc_config dsc; +struct regulator_bulk_data *supplies; +struct gpio_desc *reset_gpio; +};
drivers/gpu/drm/panel/panel-novatek-nt37705.c line 39
Quoted 10 lines
drivers/gpu/drm/panel/panel-novatek-nt37705.c new file +10
-0+ +static const struct regulator_bulk_data nt37705_supplies[] = { + { .supply ="vddio" }, + { .supply ="dvdd" }, + { .supply ="vci" }, +}; + +static inline struct nt37705_panel *to_nt37705_panel (struct drm_panel *panel) +{ + return container_of_const(panel, struct nt37705_panel, panel);
Either just use container_of or build something that respects the input's const-ness.
Quoted 153 lines
drivers/gpu/drm/panel/panel-novatek-nt37705.c new file +153
-0+} + +static void nt37705_reset (struct nt37705_panel *ctx) +{ +gpiod_set_value_cansleep (ctx->reset_gpio,0 ); +usleep_range (10000 ,11000 ); +gpiod_set_value_cansleep (ctx->reset_gpio,1 ); +usleep_range (5000 ,6000 ); +gpiod_set_value_cansleep (ctx->reset_gpio,0 ); +usleep_range (10000 ,11000 ); +} + +static int nt37705_on (struct nt37705_panel *ctx) +{ +struct mipi_dsi_multi_context dsi_ctx = { .dsi = ctx->dsi }; + + ctx->dsi->mode_flags |=MIPI_DSI_MODE_LPM ; + +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf0 , +0x55 ,0xaa ,0x52 ,0x08 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x1b ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba ,0x18 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x1c ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x01 ,0x01 ,0x01 ,0x01 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x2c ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x00 ,0x01 ,0x01 ,0x01 ,0x00 ,0x05 ,0x05 , +0x05 ,0x00 ,0x05 ,0x05 ,0x05 ,0x00 ,0x00 , +0x00 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x3c ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x00 ,0x00 ,0x01 ,0x01 ,0x00 ,0x00 ,0x0b , +0x0b ,0x00 ,0x00 ,0x0b ,0x0b ,0x00 ,0x00 , +0x00 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x4c ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x00 ,0x00 ,0x00 ,0x01 ,0x00 ,0x00 ,0x00 , +0x1d ,0x00 ,0x00 ,0x00 ,0x1d ,0x00 ,0x00 , +0x00 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x5c ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x01 ,0x01 ,0x01 ,0x01 ,0x01 ,0x01 ,0x01 , +0x01 ,0x01 ,0x01 ,0x01 ,0x01 ,0x01 ,0x01 , +0x01 ,0x01 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x6c ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x00 ,0x01 ,0x02 ,0x03 ,0x04 ,0x05 ,0x0b , +0x77 ,0x77 ,0x00 ,0x00 ,0x0b ,0x00 ,0x1d , +0x00 ,0x1d ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x7c ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x00 ,0x01 ,0x02 ,0x03 ,0x04 ,0x05 ,0x0b , +0x77 ,0x77 ,0x00 ,0x00 ,0x0b ,0x00 ,0x1d , +0x00 ,0x1d ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x8c ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x9c ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x11 ,0x11 ,0x20 ,0x02 ,0x00 ,0x03 ,0x00 , +0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0xa4 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba ,0x00 ,0xc0 ,0x40 ,0x08 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0xa8 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x22 ,0x22 ,0x22 ,0x22 ,0x22 ,0x22 ,0x22 , +0x22 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0xb0 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x22 ,0x22 ,0x22 ,0x22 ,0x22 ,0x22 ,0x22 , +0x22 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf0 , +0x55 ,0xaa ,0x52 ,0x08 ,0x01 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x05 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xc5 ,0x15 ,0x15 ,0x15 ,0xdd ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf0 , +0x55 ,0xaa ,0x52 ,0x08 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x0e ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xb5 ,0x32 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf0 , +0x55 ,0xaa ,0x52 ,0x00 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xff ,0xaa ,0x55 ,0xa5 ,0x80 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x19 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf2 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x1a ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf4 ,0x55 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x11 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf8 ,0x01 ,0x7f ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x2d ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf8 ,0x01 ,0x20 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xff ,0xaa ,0x55 ,0xa5 ,0x81 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x05 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xfe ,0x3c ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x02 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf9 ,0x04 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x1e ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xfb ,0x0f ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x0f ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf5 ,0x20 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x0d ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xfb ,0x80 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xff ,0xaa ,0x55 ,0xa5 ,0x83 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x12 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xfe ,0x41 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x13 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xfd ,0x21 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xff ,0xaa ,0x55 ,0xa5 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x35 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,MIPI_DCS_WRITE_CONTROL_DISPLAY , +0x20 ); +mipi_dsi_dcs_set_column_address_multi (&dsi_ctx,0x0000 ,0x045b ); +mipi_dsi_dcs_set_page_address_multi (&dsi_ctx,0x0000 ,0x09b3 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,MIPI_DCS_SET_GAMMA_CURVE ,0x00 ); +mipi_dsi_dcs_set_display_brightness_multi (&dsi_ctx,0xbb0d ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x04 ); +mipi_dsi_dcs_set_display_brightness_multi (&dsi_ctx,0xfe0f ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x81 ,0x01 ,0x19 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x03 ,0x01 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x90 ,0x03 ,0x03 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x91 , +0x89 ,0x28 ,0x00 ,0x0c ,0xd2 ,0x00 ,0x02 , +0x2f ,0x01 ,0x18 ,0x00 ,0x07 ,0x09 ,0x75 , +0x08 ,0x34 ,0x10 ,0xf0 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x2f ,0x02 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x5a ,0x01 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x2f ,0x30 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6d ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x11 ,0x00 ); +mipi_dsi_msleep (&dsi_ctx,120 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x29 ,0x00 ); +mipi_dsi_msleep (&dsi_ctx,22 ); + +return dsi_ctx.accum_err; +} + +static int nt37705_off (struct nt37705_panel *ctx) +{ +struct mipi_dsi_multi_context dsi_ctx = { .dsi = ctx->dsi }; + + ctx->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM ; + +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x28 ,0x00 ); +mipi_dsi_msleep (&dsi_ctx,20 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x10 ,0x00 ); +mipi_dsi_msleep (&dsi_ctx,120 ); + +return dsi_ctx.accum_err; +}
drivers/gpu/drm/panel/panel-novatek-nt37705.c line 202
Quoted 10 lines
drivers/gpu/drm/panel/panel-novatek-nt37705.c new file +10
-0+ +static int nt37705_prepare (struct drm_panel *panel) +{ +struct nt37705_panel *ctx =to_nt37705_panel (panel); +struct device *dev = &ctx->dsi->dev; +struct drm_dsc_picture_parameter_set pps; +int ret; + + ret =regulator_bulk_enable (ARRAY_SIZE (nt37705_supplies), ctx->supplies); +if (ret <0 ) {
Common style is to check for errors with
if (ret)
Here and everywhere else.
Best regards
Thomas
Quoted 212 lines
drivers/gpu/drm/panel/panel-novatek-nt37705.c new file +211
-0+dev_err (dev,"Failed to enable regulators: %d\n" , ret); +return ret; + } + +nt37705_reset (ctx); + + ret =nt37705_on (ctx); +if (ret <0 ) { +dev_err (dev,"Failed to initialize panel: %d\n" , ret); +gpiod_set_value_cansleep (ctx->reset_gpio,1 ); +regulator_bulk_disable (ARRAY_SIZE (nt37705_supplies), ctx->supplies); +return ret; + } + +drm_dsc_pps_payload_pack (&pps, &ctx->dsc); + + ret =mipi_dsi_picture_parameter_set (ctx->dsi, &pps); +if (ret <0 ) { +dev_err (panel->dev,"failed to transmit PPS: %d\n" , ret); +return ret; + } + + ret =mipi_dsi_compression_mode (ctx->dsi, true); +if (ret <0 ) { +dev_err (dev,"failed to enable compression mode: %d\n" , ret); +return ret; + } + +msleep (28 );/* TODO: Is this panel-dependent? */ + +return 0 ; +} + +static int nt37705_unprepare (struct drm_panel *panel) +{ +struct nt37705_panel *ctx =to_nt37705_panel (panel); +struct device *dev = &ctx->dsi->dev; +int ret; + + ret =nt37705_off (ctx); +if (ret <0 ) +dev_err (dev,"Failed to un-initialize panel: %d\n" , ret); + +gpiod_set_value_cansleep (ctx->reset_gpio,1 ); +regulator_bulk_disable (ARRAY_SIZE (nt37705_supplies), ctx->supplies); + +return 0 ; +} + +static const struct drm_display_mode nt37705_mode = { + .clock = (1116 +100 +30 +100 ) * (2484 +70 +48 +70 ) *120 /1000 , + .hdisplay =1116 , + .hsync_start =1116 +100 , + .hsync_end =1116 +100 +30 , + .htotal =1116 +100 +30 +100 , + .vdisplay =2484 , + .vsync_start =2484 +70 , + .vsync_end =2484 +70 +48 , + .vtotal =2484 +70 +48 +70 , + .width_mm =66 , + .height_mm =146 , + .type =DRM_MODE_TYPE_DRIVER , +}; + +static int nt37705_get_modes (struct drm_panel *panel, +struct drm_connector *connector) +{ +return drm_connector_helper_get_modes_fixed (connector, &nt37705_mode); +} + +static const struct drm_panel_funcs nt37705_panel_funcs = { + .prepare = nt37705_prepare, + .unprepare = nt37705_unprepare, + .get_modes = nt37705_get_modes, +}; + +static int nt37705_bl_update_status (struct backlight_device *bl) +{ +struct mipi_dsi_device *dsi =bl_get_data (bl); +u16 brightness =backlight_get_brightness (bl); +int ret; + + dsi->mode_flags &= ~MIPI_DSI_MODE_LPM ; + + ret =mipi_dsi_dcs_set_display_brightness_large (dsi, brightness); +if (ret <0 ) +return ret; + + dsi->mode_flags |=MIPI_DSI_MODE_LPM ; + +return 0 ; +} + +static const struct backlight_ops nt37705_bl_ops = { + .update_status = nt37705_bl_update_status, +}; + +static struct backlight_device * +nt37705_create_backlight (struct mipi_dsi_device *dsi) +{ +struct device *dev = &dsi->dev; +const struct backlight_properties props = { + .type =BACKLIGHT_RAW , + .scale =BACKLIGHT_SCALE_NON_LINEAR , + .brightness =4095 , + .max_brightness =4095 , + }; + +return devm_backlight_device_register (dev,dev_name (dev), dev, dsi, + &nt37705_bl_ops, &props); +} + +static int nt37705_probe (struct mipi_dsi_device *dsi) +{ +struct device *dev = &dsi->dev; +struct nt37705_panel *ctx; +int ret; + + ctx = devm_drm_panel_alloc(dev, struct nt37705_panel, panel, + &nt37705_panel_funcs, +DRM_MODE_CONNECTOR_DSI ); +if (IS_ERR (ctx)) +return PTR_ERR (ctx); + + ret =devm_regulator_bulk_get_const (dev, +ARRAY_SIZE (nt37705_supplies), + nt37705_supplies, + &ctx->supplies); +if (ret <0 ) +return ret; + + ctx->reset_gpio =devm_gpiod_get (dev,"reset" ,GPIOD_OUT_HIGH ); +if (IS_ERR (ctx->reset_gpio)) +return dev_err_probe (dev,PTR_ERR (ctx->reset_gpio), +"Failed to get reset-gpios\n" ); + + ctx->dsi = dsi; +mipi_dsi_set_drvdata (dsi, ctx); + + dsi->lanes =4 ; + dsi->format =MIPI_DSI_FMT_RGB888 ; + dsi->mode_flags =MIPI_DSI_MODE_NO_EOT_PACKET | +MIPI_DSI_CLOCK_NON_CONTINUOUS ; + + ctx->panel.prepare_prev_first = true; + + ctx->panel.backlight =nt37705_create_backlight (dsi); +if (IS_ERR (ctx->panel.backlight)) +return dev_err_probe (dev,PTR_ERR (ctx->panel.backlight), +"Failed to create backlight\n" ); + +drm_panel_add (&ctx->panel); + +/* This panel only supports DSC; unconditionally enable it */ + dsi->dsc = &ctx->dsc; + + ctx->dsc.dsc_version_major =1 ; + ctx->dsc.dsc_version_minor =1 ; + +/* TODO: Pass slice_per_pkt = 2 */ + ctx->dsc.slice_height =12 ; + ctx->dsc.slice_width =558 ; +/* +* TODO: hdisplay should be read from the selected mode once +* it is passed back to drm_panel (in prepare?) +*/ +WARN_ON (1116 % ctx->dsc.slice_width); + ctx->dsc.slice_count =1116 / ctx->dsc.slice_width; + ctx->dsc.bits_per_component =8 ; + ctx->dsc.bits_per_pixel =8 <<4 ;/* 4 fractional bits */ + ctx->dsc.block_pred_enable = true; + + ret =mipi_dsi_attach (dsi); +if (ret <0 ) { +drm_panel_remove (&ctx->panel); +return dev_err_probe (dev, ret,"Failed to attach to DSI host\n" ); + } + +return 0 ; +} + +static void nt37705_remove (struct mipi_dsi_device *dsi) +{ +struct nt37705_panel *ctx =mipi_dsi_get_drvdata (dsi); +int ret; + + ret =mipi_dsi_detach (dsi); +if (ret <0 ) +dev_err (&dsi->dev,"Failed to detach from DSI host: %d\n" , ret); + +drm_panel_remove (&ctx->panel); +} + +static const struct of_device_id nt37705_of_match[] = { + { .compatible ="boe,bj631jhm-t71-d900" }, + {/* sentinel */ } +}; +MODULE_DEVICE_TABLE (of, nt37705_of_match); + +static struct mipi_dsi_driver nt37705_driver = { + .probe = nt37705_probe, + .remove = nt37705_remove, + .driver = { + .name ="panel-novatek-nt37705" , + .of_match_table = nt37705_of_match, + }, +}; +module_mipi_dsi_driver (nt37705_driver); + +MODULE_DESCRIPTION ("DRM driver for NT37705-equipped DSI panels" ); +MODULE_LICENSE ("GPL" );
Signature · 6 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)
Re: [PATCH 2/4] drm/panel: Add driver for Novatek NT37705 panel
Quoted 26 lines · Thomas Zimmermann
Hi
Am 01.05.26 um 15:52 schrieb Luca Weiss:
Quoted 23 lines
Add support for the 2484x1116 AMOLED panel from BOE (BJ631JHM-T71-D900) bundled with a NT37705 driver IC, as found on the Fairphone (Gen. 6) smartphone.
The panel can also be configured in 10-bit (RGB101010) mode, however currently it's configured in 8-bit (RGB888) since there's some issues in the Qualcomm DPU driver when driving this panel in 10-bit.
Signed-off-by Luca Weiss <[email protected]>--- drivers/gpu/drm/panel/Kconfig | 11 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-novatek-nt37705.c | 413 ++++++++++++++++++++++++++ 3 files changed, 425 insertions(+)drivers/gpu/drm/panel/Kconfig +0
-0@@ -624,6 +624,17 @@ config DRM_PANEL_NOVATEK_NT37700F Say Y here if you want to enable support for Novatek NT37700F DSI panel module. The panel has a resolution of 1080x2160.
Quoted 11 lines
drivers/gpu/drm/panel/Kconfig config DRM_PANEL_NOVATEK_NT37700F · line 635
Quoted 9 lines
drivers/gpu/drm/panel/Kconfig +9
-0+config DRM_PANEL_NOVATEK_NT37705 + tristate "Novatek NT37705-based DSI panel" + depends on OF + depends on DRM_MIPI_DSI + depends on BACKLIGHT_CLASS_DEVICE + select DRM_KMS_HELPER + help + Say Y here if you want to enable support for Novatek NT37705-based + display panels, such as the one found in the The Fairphone (Gen. 6)Duplicate 'the'
Marketing really wanted to have it be "The Fairphone". Will change and make it saner.
Quoted 44 lines
Quoted 31 lines
drivers/gpu/drm/panel/Kconfig +2
-0+ smartphone. + config DRM_PANEL_NOVATEK_NT37801 tristate "Novatek NT37801/NT37810 AMOLED DSI panel" depends on OFdrivers/gpu/drm/panel/Makefile +1
-0@@ -61,6 +61,7 @@ obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36523) += panel-novatek-nt36523.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36672A) += panel-novatek-nt36672a.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36672E) += panel-novatek-nt36672e.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT37700F) += panel-novatek-nt37700f.o +obj-$(CONFIG_DRM_PANEL_NOVATEK_NT37705) += panel-novatek-nt37705.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT37801) += panel-novatek-nt37801.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT39016) += panel-novatek-nt39016.o obj-$(CONFIG_DRM_PANEL_MANTIX_MLAF057WE51) += panel-mantix-mlaf057we51.odrivers/gpu/drm/panel/panel-novatek-nt37705.c new file +7
-0@@ -0,0 +1,413 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Generated with linux-mdss-dsi-panel-driver-generator from vendor device tree. +* Copyright (c) 2026 Luca Weiss <[email protected]> +*/ + +#include <linux/backlight.h> drivers/gpu/drm/panel/panel-novatek-nt37705.c line 17
Quoted 10 lines
drivers/gpu/drm/panel/panel-novatek-nt37705.c new file +10
-0+#include <linux/delay.h> +#include <linux/gpio/consumer.h> +#include <linux/mod_devicetable.h> +#include <linux/module.h> +#include <linux/regulator/consumer.h> + +#include <video/mipi_display.h> + +#include <drm/display/drm_dsc.h> +#include <drm/display/drm_dsc_helper.h> IIRC this requires
Quoted 3 lines
select
DRM_DISPLAY_DSC_HELPERin the
Kconfig. Maybe double-check.
Will check. Always difficult to figure out the proper dependencies in a fully-featured defconfig build.
Quoted 18 lines
Quoted 18 lines
drivers/gpu/drm/panel/panel-novatek-nt37705.c new file +17
-0+#include <drm/drm_mipi_dsi.h> +#include <drm/drm_modes.h> +#include <drm/drm_panel.h> +#include <drm/drm_probe_helper.h> + +struct nt37705_panel { +struct drm_panel panel; +struct mipi_dsi_device *dsi; +struct drm_dsc_config dsc; +struct regulator_bulk_data *supplies; +struct gpio_desc *reset_gpio; +}; + +static const struct regulator_bulk_data nt37705_supplies[] = { + { .supply ="vddio" }, + { .supply ="dvdd" }, + { .supply ="vci" },
Quoted 8 lines
drivers/gpu/drm/panel/panel-novatek-nt37705.c line 39
Quoted 5 lines
drivers/gpu/drm/panel/panel-novatek-nt37705.c new file +5
-0+}; + +static inline struct nt37705_panel *to_nt37705_panel (struct drm_panel *panel) +{ + return container_of_const(panel, struct nt37705_panel, panel);Either just use
container_ofor build something that respects the input's const-ness.
I really don't get what you mean here? Why is container_of_const() bad here?
Quoted 167 lines
Quoted 154 lines
drivers/gpu/drm/panel/panel-novatek-nt37705.c new file +153
-0+} + +static void nt37705_reset (struct nt37705_panel *ctx) +{ +gpiod_set_value_cansleep (ctx->reset_gpio,0 ); +usleep_range (10000 ,11000 ); +gpiod_set_value_cansleep (ctx->reset_gpio,1 ); +usleep_range (5000 ,6000 ); +gpiod_set_value_cansleep (ctx->reset_gpio,0 ); +usleep_range (10000 ,11000 ); +} + +static int nt37705_on (struct nt37705_panel *ctx) +{ +struct mipi_dsi_multi_context dsi_ctx = { .dsi = ctx->dsi }; + + ctx->dsi->mode_flags |=MIPI_DSI_MODE_LPM ; + +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf0 , +0x55 ,0xaa ,0x52 ,0x08 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x1b ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba ,0x18 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x1c ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x01 ,0x01 ,0x01 ,0x01 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x2c ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x00 ,0x01 ,0x01 ,0x01 ,0x00 ,0x05 ,0x05 , +0x05 ,0x00 ,0x05 ,0x05 ,0x05 ,0x00 ,0x00 , +0x00 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x3c ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x00 ,0x00 ,0x01 ,0x01 ,0x00 ,0x00 ,0x0b , +0x0b ,0x00 ,0x00 ,0x0b ,0x0b ,0x00 ,0x00 , +0x00 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x4c ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x00 ,0x00 ,0x00 ,0x01 ,0x00 ,0x00 ,0x00 , +0x1d ,0x00 ,0x00 ,0x00 ,0x1d ,0x00 ,0x00 , +0x00 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x5c ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x01 ,0x01 ,0x01 ,0x01 ,0x01 ,0x01 ,0x01 , +0x01 ,0x01 ,0x01 ,0x01 ,0x01 ,0x01 ,0x01 , +0x01 ,0x01 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x6c ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x00 ,0x01 ,0x02 ,0x03 ,0x04 ,0x05 ,0x0b , +0x77 ,0x77 ,0x00 ,0x00 ,0x0b ,0x00 ,0x1d , +0x00 ,0x1d ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x7c ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x00 ,0x01 ,0x02 ,0x03 ,0x04 ,0x05 ,0x0b , +0x77 ,0x77 ,0x00 ,0x00 ,0x0b ,0x00 ,0x1d , +0x00 ,0x1d ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x8c ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x9c ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x11 ,0x11 ,0x20 ,0x02 ,0x00 ,0x03 ,0x00 , +0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0xa4 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba ,0x00 ,0xc0 ,0x40 ,0x08 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0xa8 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x22 ,0x22 ,0x22 ,0x22 ,0x22 ,0x22 ,0x22 , +0x22 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0xb0 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x22 ,0x22 ,0x22 ,0x22 ,0x22 ,0x22 ,0x22 , +0x22 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf0 , +0x55 ,0xaa ,0x52 ,0x08 ,0x01 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x05 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xc5 ,0x15 ,0x15 ,0x15 ,0xdd ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf0 , +0x55 ,0xaa ,0x52 ,0x08 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x0e ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xb5 ,0x32 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf0 , +0x55 ,0xaa ,0x52 ,0x00 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xff ,0xaa ,0x55 ,0xa5 ,0x80 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x19 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf2 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x1a ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf4 ,0x55 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x11 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf8 ,0x01 ,0x7f ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x2d ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf8 ,0x01 ,0x20 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xff ,0xaa ,0x55 ,0xa5 ,0x81 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x05 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xfe ,0x3c ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x02 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf9 ,0x04 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x1e ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xfb ,0x0f ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x0f ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf5 ,0x20 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x0d ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xfb ,0x80 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xff ,0xaa ,0x55 ,0xa5 ,0x83 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x12 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xfe ,0x41 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x13 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xfd ,0x21 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xff ,0xaa ,0x55 ,0xa5 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x35 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,MIPI_DCS_WRITE_CONTROL_DISPLAY , +0x20 ); +mipi_dsi_dcs_set_column_address_multi (&dsi_ctx,0x0000 ,0x045b ); +mipi_dsi_dcs_set_page_address_multi (&dsi_ctx,0x0000 ,0x09b3 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,MIPI_DCS_SET_GAMMA_CURVE ,0x00 ); +mipi_dsi_dcs_set_display_brightness_multi (&dsi_ctx,0xbb0d ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x04 ); +mipi_dsi_dcs_set_display_brightness_multi (&dsi_ctx,0xfe0f ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x81 ,0x01 ,0x19 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x03 ,0x01 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x90 ,0x03 ,0x03 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x91 , +0x89 ,0x28 ,0x00 ,0x0c ,0xd2 ,0x00 ,0x02 , +0x2f ,0x01 ,0x18 ,0x00 ,0x07 ,0x09 ,0x75 , +0x08 ,0x34 ,0x10 ,0xf0 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x2f ,0x02 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x5a ,0x01 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x2f ,0x30 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6d ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x11 ,0x00 ); +mipi_dsi_msleep (&dsi_ctx,120 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x29 ,0x00 ); +mipi_dsi_msleep (&dsi_ctx,22 ); + +return dsi_ctx.accum_err; +} + +static int nt37705_off (struct nt37705_panel *ctx) +{ +struct mipi_dsi_multi_context dsi_ctx = { .dsi = ctx->dsi }; + + ctx->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM ; + +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x28 ,0x00 ); +mipi_dsi_msleep (&dsi_ctx,20 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x10 ,0x00 ); +mipi_dsi_msleep (&dsi_ctx,120 ); + +return dsi_ctx.accum_err; +}drivers/gpu/drm/panel/panel-novatek-nt37705.c line 202
Quoted 10 lines
drivers/gpu/drm/panel/panel-novatek-nt37705.c new file +10
-0+ +static int nt37705_prepare (struct drm_panel *panel) +{ +struct nt37705_panel *ctx =to_nt37705_panel (panel); +struct device *dev = &ctx->dsi->dev; +struct drm_dsc_picture_parameter_set pps; +int ret; + + ret =regulator_bulk_enable (ARRAY_SIZE (nt37705_supplies), ctx->supplies); +if (ret <0 ) {Common style is to check for errors with
Quoted 3 lines
if (ret)
Here and everywhere else.
At least for regulator_bulk_enable() "ret < 0" is actually more popular than just "ret".
Kernel doc says "Return: 0 on success or a negative error number on failure." so a positive integer should in theory never happen so they're equivalent.
(git grep -h -A2 regulator_bulk_enable | grep if | sed 's|^[ \t]\+||' | sed 's| {$||' | sort | uniq -c)
Thanks for the review!
Regards
Luca
Thomas Zimmermann
maintainerRe: [PATCH 2/4] drm/panel: Add driver for Novatek NT37705 panel
Hi
Am 15.05.26 um 16:31 schrieb Luca Weiss:
Quoted 37 lines · Thomas Zimmermann
Quoted 26 lines
Hi
Am 01.05.26 um 15:52 schrieb Luca Weiss:
Quoted 23 lines
Add support for the 2484x1116 AMOLED panel from BOE (BJ631JHM-T71-D900) bundled with a NT37705 driver IC, as found on the Fairphone (Gen. 6) smartphone.
The panel can also be configured in 10-bit (RGB101010) mode, however currently it's configured in 8-bit (RGB888) since there's some issues in the Qualcomm DPU driver when driving this panel in 10-bit.
Signed-off-by Luca Weiss <[email protected]>--- drivers/gpu/drm/panel/Kconfig | 11 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-novatek-nt37705.c | 413 ++++++++++++++++++++++++++ 3 files changed, 425 insertions(+)drivers/gpu/drm/panel/Kconfig +0
-0@@ -624,6 +624,17 @@ config DRM_PANEL_NOVATEK_NT37700F Say Y here if you want to enable support for Novatek NT37700F DSI panel module. The panel has a resolution of 1080x2160.Quoted 10 lines
drivers/gpu/drm/panel/Kconfig config DRM_PANEL_NOVATEK_NT37700F · line 635
Quoted 9 lines
drivers/gpu/drm/panel/Kconfig +9
-0+config DRM_PANEL_NOVATEK_NT37705 + tristate "Novatek NT37705-based DSI panel" + depends on OF + depends on DRM_MIPI_DSI + depends on BACKLIGHT_CLASS_DEVICE + select DRM_KMS_HELPER + help + Say Y here if you want to enable support for Novatek NT37705-based + display panels, such as the one found in the The Fairphone (Gen. 6)Duplicate 'the'
Quoted 2 lines
Marketing really wanted to have it be "The Fairphone". Will change and make it saner.
How about "as the one found in Gen. 6 of The Fairphone." ?
Quoted 73 lines
Quoted 43 lines
Quoted 31 lines
drivers/gpu/drm/panel/Kconfig +2
-0+ smartphone. + config DRM_PANEL_NOVATEK_NT37801 tristate "Novatek NT37801/NT37810 AMOLED DSI panel" depends on OFdrivers/gpu/drm/panel/Makefile +1
-0@@ -61,6 +61,7 @@ obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36523) += panel-novatek-nt36523.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36672A) += panel-novatek-nt36672a.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36672E) += panel-novatek-nt36672e.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT37700F) += panel-novatek-nt37700f.o +obj-$(CONFIG_DRM_PANEL_NOVATEK_NT37705) += panel-novatek-nt37705.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT37801) += panel-novatek-nt37801.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT39016) += panel-novatek-nt39016.o obj-$(CONFIG_DRM_PANEL_MANTIX_MLAF057WE51) += panel-mantix-mlaf057we51.odrivers/gpu/drm/panel/panel-novatek-nt37705.c new file +7
-0@@ -0,0 +1,413 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Generated with linux-mdss-dsi-panel-driver-generator from vendor device tree. +* Copyright (c) 2026 Luca Weiss <[email protected]> +*/ + +#include <linux/backlight.h> drivers/gpu/drm/panel/panel-novatek-nt37705.c line 17
Quoted 10 lines
drivers/gpu/drm/panel/panel-novatek-nt37705.c new file +10
-0+#include <linux/delay.h> +#include <linux/gpio/consumer.h> +#include <linux/mod_devicetable.h> +#include <linux/module.h> +#include <linux/regulator/consumer.h> + +#include <video/mipi_display.h> + +#include <drm/display/drm_dsc.h> +#include <drm/display/drm_dsc_helper.h> IIRC this requires
Quoted 3 lines
select
DRM_DISPLAY_DSC_HELPERin the
Kconfig. Maybe double-check.Will check. Always difficult to figure out the proper dependencies in a fully-featured defconfig build.
Quoted 16 lines
Quoted 16 lines
drivers/gpu/drm/panel/panel-novatek-nt37705.c new file +16
-0+#include <drm/drm_mipi_dsi.h> +#include <drm/drm_modes.h> +#include <drm/drm_panel.h> +#include <drm/drm_probe_helper.h> + +struct nt37705_panel { +struct drm_panel panel; +struct mipi_dsi_device *dsi; +struct drm_dsc_config dsc; +struct regulator_bulk_data *supplies; +struct gpio_desc *reset_gpio; +}; + +static const struct regulator_bulk_data nt37705_supplies[] = { + { .supply ="vddio" }, + { .supply ="dvdd" },Quoted 8 lines
drivers/gpu/drm/panel/panel-novatek-nt37705.c line 39
Quoted 6 lines
drivers/gpu/drm/panel/panel-novatek-nt37705.c new file +6
-0+ { .supply = "vci" }, +}; + +static inline struct nt37705_panel *to_nt37705_panel (struct drm_panel *panel) +{ + return container_of_const(panel, struct nt37705_panel, panel);Either just use
container_ofor build something that respects the input's const-ness.
Quoted 2 lines
I really don't get what you mean here? Why is
container_of_const()bad here?
Because nothing is const here. It looks like an oversight or as if something should be const.
Quoted 169 lines
Quoted 166 lines
Quoted 154 lines
drivers/gpu/drm/panel/panel-novatek-nt37705.c new file +153
-0+} + +static void nt37705_reset (struct nt37705_panel *ctx) +{ +gpiod_set_value_cansleep (ctx->reset_gpio,0 ); +usleep_range (10000 ,11000 ); +gpiod_set_value_cansleep (ctx->reset_gpio,1 ); +usleep_range (5000 ,6000 ); +gpiod_set_value_cansleep (ctx->reset_gpio,0 ); +usleep_range (10000 ,11000 ); +} + +static int nt37705_on (struct nt37705_panel *ctx) +{ +struct mipi_dsi_multi_context dsi_ctx = { .dsi = ctx->dsi }; + + ctx->dsi->mode_flags |=MIPI_DSI_MODE_LPM ; + +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf0 , +0x55 ,0xaa ,0x52 ,0x08 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x1b ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba ,0x18 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x1c ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x01 ,0x01 ,0x01 ,0x01 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x2c ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x00 ,0x01 ,0x01 ,0x01 ,0x00 ,0x05 ,0x05 , +0x05 ,0x00 ,0x05 ,0x05 ,0x05 ,0x00 ,0x00 , +0x00 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x3c ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x00 ,0x00 ,0x01 ,0x01 ,0x00 ,0x00 ,0x0b , +0x0b ,0x00 ,0x00 ,0x0b ,0x0b ,0x00 ,0x00 , +0x00 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x4c ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x00 ,0x00 ,0x00 ,0x01 ,0x00 ,0x00 ,0x00 , +0x1d ,0x00 ,0x00 ,0x00 ,0x1d ,0x00 ,0x00 , +0x00 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x5c ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x01 ,0x01 ,0x01 ,0x01 ,0x01 ,0x01 ,0x01 , +0x01 ,0x01 ,0x01 ,0x01 ,0x01 ,0x01 ,0x01 , +0x01 ,0x01 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x6c ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x00 ,0x01 ,0x02 ,0x03 ,0x04 ,0x05 ,0x0b , +0x77 ,0x77 ,0x00 ,0x00 ,0x0b ,0x00 ,0x1d , +0x00 ,0x1d ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x7c ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x00 ,0x01 ,0x02 ,0x03 ,0x04 ,0x05 ,0x0b , +0x77 ,0x77 ,0x00 ,0x00 ,0x0b ,0x00 ,0x1d , +0x00 ,0x1d ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x8c ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x9c ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x11 ,0x11 ,0x20 ,0x02 ,0x00 ,0x03 ,0x00 , +0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0xa4 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba ,0x00 ,0xc0 ,0x40 ,0x08 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0xa8 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x22 ,0x22 ,0x22 ,0x22 ,0x22 ,0x22 ,0x22 , +0x22 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0xb0 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xba , +0x22 ,0x22 ,0x22 ,0x22 ,0x22 ,0x22 ,0x22 , +0x22 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf0 , +0x55 ,0xaa ,0x52 ,0x08 ,0x01 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x05 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xc5 ,0x15 ,0x15 ,0x15 ,0xdd ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf0 , +0x55 ,0xaa ,0x52 ,0x08 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x0e ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xb5 ,0x32 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf0 , +0x55 ,0xaa ,0x52 ,0x00 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xff ,0xaa ,0x55 ,0xa5 ,0x80 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x19 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf2 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x1a ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf4 ,0x55 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x11 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf8 ,0x01 ,0x7f ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x2d ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf8 ,0x01 ,0x20 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xff ,0xaa ,0x55 ,0xa5 ,0x81 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x05 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xfe ,0x3c ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x02 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf9 ,0x04 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x1e ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xfb ,0x0f ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x0f ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf5 ,0x20 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x0d ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xfb ,0x80 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xff ,0xaa ,0x55 ,0xa5 ,0x83 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x12 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xfe ,0x41 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x13 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xfd ,0x21 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xff ,0xaa ,0x55 ,0xa5 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x35 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,MIPI_DCS_WRITE_CONTROL_DISPLAY , +0x20 ); +mipi_dsi_dcs_set_column_address_multi (&dsi_ctx,0x0000 ,0x045b ); +mipi_dsi_dcs_set_page_address_multi (&dsi_ctx,0x0000 ,0x09b3 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,MIPI_DCS_SET_GAMMA_CURVE ,0x00 ); +mipi_dsi_dcs_set_display_brightness_multi (&dsi_ctx,0xbb0d ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x04 ); +mipi_dsi_dcs_set_display_brightness_multi (&dsi_ctx,0xfe0f ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x81 ,0x01 ,0x19 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x03 ,0x01 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x90 ,0x03 ,0x03 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x91 , +0x89 ,0x28 ,0x00 ,0x0c ,0xd2 ,0x00 ,0x02 , +0x2f ,0x01 ,0x18 ,0x00 ,0x07 ,0x09 ,0x75 , +0x08 ,0x34 ,0x10 ,0xf0 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x2f ,0x02 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x5a ,0x01 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x2f ,0x30 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6d ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x11 ,0x00 ); +mipi_dsi_msleep (&dsi_ctx,120 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x29 ,0x00 ); +mipi_dsi_msleep (&dsi_ctx,22 ); + +return dsi_ctx.accum_err; +} + +static int nt37705_off (struct nt37705_panel *ctx) +{ +struct mipi_dsi_multi_context dsi_ctx = { .dsi = ctx->dsi }; + + ctx->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM ; + +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x28 ,0x00 ); +mipi_dsi_msleep (&dsi_ctx,20 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x10 ,0x00 ); +mipi_dsi_msleep (&dsi_ctx,120 ); + +return dsi_ctx.accum_err; +}drivers/gpu/drm/panel/panel-novatek-nt37705.c line 202
Quoted 10 lines
drivers/gpu/drm/panel/panel-novatek-nt37705.c new file +10
-0+ +static int nt37705_prepare (struct drm_panel *panel) +{ +struct nt37705_panel *ctx =to_nt37705_panel (panel); +struct device *dev = &ctx->dsi->dev; +struct drm_dsc_picture_parameter_set pps; +int ret; + + ret =regulator_bulk_enable (ARRAY_SIZE (nt37705_supplies), ctx->supplies); +if (ret <0 ) {Common style is to check for errors with
Quoted 3 lines
if (ret)
Here and everywhere else.
Quoted 8 lines
At least for
regulator_bulk_enable()"ret < 0" is actually more popular than just "ret".Kernel doc says "Return: 0 on success or a negative error number on failure." so a positive integer should in theory never happen so they're equivalent.
(git grep -h -A2
regulator_bulk_enable| grep if | sed 's|^[ \t]\+||' | sed 's| {$||' | sort | uniq -c)
It's just nitpicking, not a blocker.
Best regards
Thomas
Quoted 5 lines
Thanks for the review!
Regards
Luca
Signature · 6 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)
Re: [PATCH 2/4] drm/panel: Add driver for Novatek NT37705 panel
Quoted 40 lines · Thomas Zimmermann
Hi
Am 15.05.26 um 16:31 schrieb Luca Weiss:
Quoted 37 lines · Thomas Zimmermann
Quoted 36 lines
Hi
Am 01.05.26 um 15:52 schrieb Luca Weiss:
Quoted 22 lines
Add support for the 2484x1116 AMOLED panel from BOE (BJ631JHM-T71-D900) bundled with a NT37705 driver IC, as found on the Fairphone (Gen. 6) smartphone.
The panel can also be configured in 10-bit (RGB101010) mode, however currently it's configured in 8-bit (RGB888) since there's some issues in the Qualcomm DPU driver when driving this panel in 10-bit.
Signed-off-by Luca Weiss <[email protected]>--- drivers/gpu/drm/panel/Kconfig | 11 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-novatek-nt37705.c | 413 ++++++++++++++++++++++++++ 3 files changed, 425 insertions(+)drivers/gpu/drm/panel/Kconfig +0
-0@@ -624,6 +624,17 @@ config DRM_PANEL_NOVATEK_NT37700F Say Y here if you want to enable support for Novatek NT37700F DSI panel module. The panel has a resolution of 1080x2160.drivers/gpu/drm/panel/Kconfig config DRM_PANEL_NOVATEK_NT37700F · line 635
Quoted 10 lines
drivers/gpu/drm/panel/Kconfig +9
-0+config DRM_PANEL_NOVATEK_NT37705 + tristate "Novatek NT37705-based DSI panel" + depends on OF + depends on DRM_MIPI_DSI + depends on BACKLIGHT_CLASS_DEVICE + select DRM_KMS_HELPER + help + Say Y here if you want to enable support for Novatek NT37705-based + display panels, such as the one found in the The Fairphone (Gen. 6)Duplicate 'the'
Quoted 4 lines
Quoted 2 lines
Marketing really wanted to have it be "The Fairphone". Will change and make it saner.
How about "as the one found in Gen. 6 of The Fairphone." ?
I'll just make it
display panels, such as the one found in the Fairphone (Gen. 6) smartphone.
Quoted 72 lines
Quoted 72 lines
Quoted 42 lines
Quoted 30 lines
drivers/gpu/drm/panel/Kconfig +2
-0+ smartphone. + config DRM_PANEL_NOVATEK_NT37801 tristate "Novatek NT37801/NT37810 AMOLED DSI panel" depends on OFdrivers/gpu/drm/panel/Makefile +1
-0@@ -61,6 +61,7 @@ obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36523) += panel-novatek-nt36523.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36672A) += panel-novatek-nt36672a.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36672E) += panel-novatek-nt36672e.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT37700F) += panel-novatek-nt37700f.o +obj-$(CONFIG_DRM_PANEL_NOVATEK_NT37705) += panel-novatek-nt37705.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT37801) += panel-novatek-nt37801.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT39016) += panel-novatek-nt39016.o obj-$(CONFIG_DRM_PANEL_MANTIX_MLAF057WE51) += panel-mantix-mlaf057we51.odrivers/gpu/drm/panel/panel-novatek-nt37705.c new file +7
-0@@ -0,0 +1,413 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Generated with linux-mdss-dsi-panel-driver-generator from vendor device tree. +* Copyright (c) 2026 Luca Weiss <[email protected]> +*/ + +#include <linux/backlight.h> drivers/gpu/drm/panel/panel-novatek-nt37705.c line 17
Quoted 10 lines
drivers/gpu/drm/panel/panel-novatek-nt37705.c new file +10
-0+#include <linux/delay.h> +#include <linux/gpio/consumer.h> +#include <linux/mod_devicetable.h> +#include <linux/module.h> +#include <linux/regulator/consumer.h> + +#include <video/mipi_display.h> + +#include <drm/display/drm_dsc.h> +#include <drm/display/drm_dsc_helper.h> IIRC this requires
Quoted 3 lines
select
DRM_DISPLAY_DSC_HELPERin the
Kconfig. Maybe double-check.Will check. Always difficult to figure out the proper dependencies in a fully-featured defconfig build.
Quoted 24 lines
Quoted 12 lines
drivers/gpu/drm/panel/panel-novatek-nt37705.c new file +12
-0+#include <drm/drm_mipi_dsi.h> +#include <drm/drm_modes.h> +#include <drm/drm_panel.h> +#include <drm/drm_probe_helper.h> + +struct nt37705_panel { +struct drm_panel panel; +struct mipi_dsi_device *dsi; +struct drm_dsc_config dsc; +struct regulator_bulk_data *supplies; +struct gpio_desc *reset_gpio; +};drivers/gpu/drm/panel/panel-novatek-nt37705.c line 39
Quoted 10 lines
drivers/gpu/drm/panel/panel-novatek-nt37705.c new file +10
-0+ +static const struct regulator_bulk_data nt37705_supplies[] = { + { .supply ="vddio" }, + { .supply ="dvdd" }, + { .supply ="vci" }, +}; + +static inline struct nt37705_panel *to_nt37705_panel (struct drm_panel *panel) +{ + return container_of_const(panel, struct nt37705_panel, panel);Either just use
container_ofor build something that respects the input's const-ness.
Quoted 5 lines
Quoted 2 lines
I really don't get what you mean here? Why is
container_of_const()bad here?Because nothing is const here. It looks like an oversight or as if something should be const.
I checked and include/linux/container_of.h states:
Do not use container_of() in new code.
and
Always prefer container_of_const() instead of container_of() in new code.
So sounds like using container_of_const() is the correct way.
Quoted 11 lines
Quoted 11 lines
Quoted 8 lines
drivers/gpu/drm/panel/panel-novatek-nt37705.c line 202
Quoted 3 lines
drivers/gpu/drm/panel/panel-novatek-nt37705.c new file +3
-0+ + ret =regulator_bulk_enable (ARRAY_SIZE (nt37705_supplies), ctx->supplies); +if (ret <0 ) {Common style is to check for errors with
if (ret)
Here and everywhere else.
At least for
regulator_bulk_enable()"ret < 0" is actually more popular than just "ret".
Quoted 7 lines
Quoted 5 lines
Kernel doc says "Return: 0 on success or a negative error number on failure." so a positive integer should in theory never happen so they're equivalent.
(git grep -h -A2
regulator_bulk_enable| grep if | sed 's|^[ \t]\+||' | sed 's| {$||' | sort | uniq -c)It's just nitpicking, not a blocker.
I was also curious so I dug around a bit :)
Regards
Luca
Thomas Zimmermann
maintainerRe: [PATCH 2/4] drm/panel: Add driver for Novatek NT37705 panel
Hi
Am 15.05.26 um 16:43 schrieb Luca Weiss:
[...]
Quoted 9 lines
I checked and
include/linux/container_of.hstates:Do not use
container_of()in new code.and
Always prefer
container_of_const()instead ofcontainer_of()in new code.So sounds like using
container_of_const()is the correct way.
I didn't know that. Thanks!
Best regards
Thomas
Quoted 22 lines
Quoted 12 lines
Quoted 12 lines
Quoted 9 lines
drivers/gpu/drm/panel/panel-novatek-nt37705.c line 202
Quoted 4 lines
drivers/gpu/drm/panel/panel-novatek-nt37705.c new file +3
-0+ + ret =regulator_bulk_enable (ARRAY_SIZE (nt37705_supplies), ctx->supplies); +if (ret <0 ) {Common style is to check for errors with
if (ret)
Here and everywhere else.
At least for
regulator_bulk_enable()"ret < 0" is actually more popular than just "ret".Quoted 6 lines
Quoted 5 lines
Kernel doc says "Return: 0 on success or a negative error number on failure." so a positive integer should in theory never happen so they're equivalent.
(git grep -h -A2
regulator_bulk_enable| grep if | sed 's|^[ \t]\+||' | sed 's| {$||' | sort | uniq -c)It's just nitpicking, not a blocker.
I was also curious so I dug around a bit :)
Regards
Luca
Signature · 6 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)
PATCH 3/4 arm64: defconfig: Enable Novatek NT37705 panel
In reply to Luca WeissEnable the NT37705 panel driver which is used on Fairphone (Gen. 6).
--- arch/arm64/configs/defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm64/configs/defconfig +1 -0
@@ -1007,6 +1007,7 @@ CONFIG_DRM_PANEL_KHADAS_TS050=m CONFIG_DRM_PANEL_MANTIX_MLAF057WE51=m CONFIG_DRM_PANEL_NOVATEK_NT36672A=m CONFIG_DRM_PANEL_NOVATEK_NT36672E=m +CONFIG_DRM_PANEL_NOVATEK_NT37705=m CONFIG_DRM_PANEL_NOVATEK_NT37801=m CONFIG_DRM_PANEL_RAYDIUM_RM67191=m CONFIG_DRM_PANEL_RAYDIUM_RM692E5=m
Signature · 1 line
2.54.0
Re: [PATCH 3/4] arm64: defconfig: Enable Novatek NT37705 panel
Quoted 7 lines · Luca Weiss
Enable the NT37705 panel driver which is used on Fairphone (Gen. 6).
Signed-off-by Luca Weiss <[email protected]>--- arch/arm64/configs/defconfig | 1 + 1 file changed, 1 insertion(+)
Signature · 2 lines
With best wishes Dmitry
PATCH 4/4 arm64: dts: qcom: milos-fairphone-fp6: Enable display
In reply to Luca WeissConfigure the MDSS nodes for the phone and add the panel node.
--- arch/arm64/boot/dts/qcom/milos-fairphone-fp6.dts | 64 ++++++++++++++++++++++++ 1 file changed, 64 insertions(+)
arch/arm64/boot/dts/qcom/milos-fairphone-fp6.dts +64 -0
@@ -690,6 +690,49 @@ vreg_l7p: ldo7 { /* AW86938FCR vibrator @ 0x5a */ }; +&mdss { + status = "okay"; +}; + +&mdss_dsi0 { + vdda-supply = <&vreg_l4b>; + + status = "okay"; + + panel@0 { + compatible = "boe,bj631jhm-t71-d900"; + reg = <0>; + + reset-gpios = <&tlmm 12 GPIO_ACTIVE_LOW>; + + vci-supply = <&vreg_l19b>; + vddio-supply = <&vreg_l9b>; + dvdd-supply = <&vreg_oled_dvdd_1p2>; + + pinctrl-0 = <&disp_reset_n_active>, <&mdp_vsync>; + pinctrl-1 = <&disp_reset_n_suspend>, <&mdp_vsync>; + pinctrl-names = "default", + "sleep"; + + port { + panel_in: endpoint { + remote-endpoint = <&mdss_dsi0_out>; + }; + }; + }; +}; + +&mdss_dsi0_out { + data-lanes = <0 1 2 3>; + remote-endpoint = <&panel_in>; +}; + +&mdss_dsi0_phy { + vdds-supply = <&vreg_l2b>; + + status = "okay"; +}; + &pm8550vs_c { status = "okay"; };
@@ -848,6 +891,20 @@ &tlmm { <13 1>, /* NC */ <63 2>; /* WLAN UART */ + disp_reset_n_active: disp-reset-n-active-state { + pins = "gpio12"; + function = "gpio"; + drive-strength = <8>; + bias-disable; + }; + + disp_reset_n_suspend: disp-reset-n-suspend-state { + pins = "gpio12"; + function = "gpio"; + drive-strength = <2>; + bias-pull-down; + }; + sdc2_card_det_n: sdc2-card-det-state { pins = "gpio65"; function = "gpio";
@@ -868,6 +925,13 @@ pm8008_int_default: pm8008-int-default-state { drive-strength = <2>; bias-disable; }; + + mdp_vsync: mdp-vsync-state { + pins = "gpio129"; + function = "mdp_vsync"; + drive-strength = <2>; + bias-pull-down; + }; }; &uart5 {
Signature · 1 line
2.54.0
Re: [PATCH 4/4] arm64: dts: qcom: milos-fairphone-fp6: Enable display
Quoted 7 lines · Luca Weiss
Configure the MDSS nodes for the phone and add the panel node.
Signed-off-by Luca Weiss <[email protected]>--- arch/arm64/boot/dts/qcom/milos-fairphone-fp6.dts | 64 ++++++++++++++++++++++++ 1 file changed, 64 insertions(+)
Modulo panel's compatible (which is discussed elsewhere):
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH 4/4] arm64: dts: qcom: milos-fairphone-fp6: Enable display
In reply to Luca WeissQuoted 4 lines · Luca Weiss
Configure the MDSS nodes for the phone and add the panel node.
Signed-off-by Luca Weiss <[email protected]>---
Konrad