Skip to contentSkip to conversation

dt-bindings: display: add VIEWE JD9365TX panel binding

PATCH Superseded Hefei 4 participants 15 messages Nov 25 1 message not in the archive

Subsystems (9)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Hefei

author
#1 lore raw

PATCH v3 1/6 dt-bindings: display: add VIEWE JD9365TX panel binding

---
 .../display/panel/viewe,jd9365tx.yaml         | 70 +++++++++++++++++++
 1 file changed, 70 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/panel/viewe,jd9365tx.yaml
Documentation/devicetree/bindings/display/panel/viewe,jd9365tx.yaml new file +70 -0
new file mode 100644
index 0000000..1043f93
@@ -0,0 +1,70 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/panel/viewe,jd9365tx.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: VIEWE 7.0" 720x1280 Jadard JD9365TX MIPI-DSI in-cell panel
+
+maintainers:
+  - Hefei <[email protected]>
+
+description: |
+  The VIEWE 7KF82 module is a 720x1280 RGB888 video-mode MIPI-DSI panel
+  based on Jadard JD9365TX. It uses two DSI data lanes and exposes in-cell
+  touch over I2C on the same FPC.
+
+allOf:
+  - $ref: panel-common.yaml#
+
+properties:
+  compatible:
+    const: viewe,7kf82
+
+  reg:
+    maxItems: 1
+
+  vdd-supply:
+    description: Panel VDD supply, usually 3.3V
+
+  iovcc-supply:
+    description: Panel IO voltage supply, usually 3.3V
+
+  reset-gpios:
+    description: Optional panel reset GPIO (omit if board uses POR only).
+    maxItems: 1
+
+  backlight: true
+  rotation: true
+  port: true
+
+required:
+  - compatible
+  - reg
+  - vdd-supply
+  - iovcc-supply
+  - port
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    dsi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        panel@0 {
+            compatible = "viewe,7kf82";
+            reg = <0>;
+            vdd-supply = <&reg_vdd>;
+            iovcc-supply = <&reg_iovcc>;
+            backlight = <&viewe_bl>;
+
+            port {
+                endpoint {
+                    remote-endpoint = <&dsi_out>;
+                };
+            };
+        };
+    };
+...
Signature · 1 line
2.55.0.windows.5
#2 lore raw
Thank you for your contribution! Sashiko AI review found 4 potential issues to consider: - [Medium] dt-bindings: display: undocumented vendor prefix viewe in viewe,7kf82 - [Low] dt-bindings…

Thank you for your contribution! Sashiko AI review found 4 potential issues to consider:
- [Medium] dt-bindings: display: undocumented vendor prefix viewe in viewe,7kf82
- [Low] dt-bindings: display: filename viewe,jd9365tx.yaml mismatches viewe,7kf82
- [Low] dt-bindings: display: ineffective unevaluatedProperties with panel-common
- [Low] dt-bindings: display: redundant word binding in subject and empty changelog
--

commit a9b7d0a0eec32791c0cd039ed3f37fff50e2bf3a
Author: Hefei <[email protected]>

Quoted 3 lines

dt-bindings: display: add VIEWE JD9365TX panel binding

[Severity: Low]
The "dt-bindings:" prefix already indicates that this adds a binding, so "binding" at the end of the subject line is redundant. Could you also add a commit description explaining the VIEWE 7KF82 panel module and its hardware interface?

Quoted 18 lines
Documentation/devicetree/bindings/display/panel/viewe,jd9365tx.yaml new file +12 -0
new file mode 100644
index 0000000000000..1043f93623c00
@@ -0,0 +1,70 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/panel/viewe,jd9365tx.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: VIEWE 7.0" 720x1280 Jadard JD9365TX MIPI-DSI in-cell panel
+
+maintainers:
+  - Hefei <[email protected]>
+
+description: |

Documentation/devicetree/bindings/display/panel/viewe,jd9365tx.yaml line 22

Quoted 10 lines
Documentation/devicetree/bindings/display/panel/viewe,jd9365tx.yaml new file +10 -0
+  The VIEWE 7KF82 module is a 720x1280 RGB888 video-mode MIPI-DSI panel
+  based on Jadard JD9365TX. It uses two DSI data lanes and exposes in-cell
+  touch over I2C on the same FPC.
+
+allOf:
+  - $ref: panel-common.yaml#
+
+properties:
+  compatible:
+    const: viewe,7kf82

[Severity: Medium]
Is the "viewe" vendor prefix documented in Documentation/devicetree/bindings/vendor-prefixes.yaml? Without a vendor prefix entry there, both make dt_binding_check and checkpatch.pl fail on "viewe,7kf82".

[Severity: Low]
Should the schema filename and $id match the compatible string? The file and $id are named viewe,jd9365tx.yaml, whereas the compatible string is "viewe,7kf82".

Quoted 16 lines
Documentation/devicetree/bindings/display/panel/viewe,jd9365tx.yaml new file +16 -0
+
+  reg:
+    maxItems: 1
+
+  vdd-supply:
+    description: Panel VDD supply, usually 3.3V
+
+  iovcc-supply:
+    description: Panel IO voltage supply, usually 3.3V
+
+  reset-gpios:
+    description: Optional panel reset GPIO (omit if board uses POR only).
+    maxItems: 1
+
+  backlight: true
+  rotation: true

Documentation/devicetree/bindings/display/panel/viewe,jd9365tx.yaml line 48

Quoted 10 lines
Documentation/devicetree/bindings/display/panel/viewe,jd9365tx.yaml new file +10 -0
+  port: true
+
+required:
+  - compatible
+  - reg
+  - vdd-supply
+  - iovcc-supply
+  - port
+
+unevaluatedProperties: false

[Severity: Low]
Does using unevaluatedProperties: false with panel-common.yaml# allow every property from panel-common.yaml (such as power-supply, enable-gpios, and panel-timing) instead of restricting the binding to the subset listed here? Using additionalProperties: false along with reset-gpios: true would enforce that subset and avoid restating the maxItems: 1 constraint and optionality already defined in panel-common.yaml.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#3 lore raw
In reply to Hefei
Quoted 6 lines · Hefei
---
 .../display/panel/viewe,jd9365tx.yaml         | 70 +++++++++++++++++++
 1 file changed, 70 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/panel/viewe,jd9365tx.yaml

Please run scripts/checkpatch.pl on the patches and fix reported warnings. After that, run also 'scripts/checkpatch.pl --strict' on the patches and (probably) fix more warnings. Some warnings can be ignored, especially from --strict run, but the code here looks like it needs a fix. Feel free to get in touch if the warning is not clear.

At v3 I do not expect such feedback to be given...

Documentation/devicetree/bindings/display/panel/viewe,jd9365tx.yaml

Quoted 5 lines
Documentation/devicetree/bindings/display/panel/viewe,jd9365tx.yaml new file +0 -0
new file mode 100644
index 0000000..1043f93

Best regards,
Krzysztof

Signature · 1 line
Krzysztof Kozlowski <[email protected]>
author
#4 lore raw

PATCH v3 2/6 dt-bindings: input: add Jadard JD9365TX touchscreen binding

In reply to a message not in the archive
---
 .../input/touchscreen/jadard,jd9365tx.yaml    | 64 +++++++++++++++++++
 1 file changed, 64 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/jadard,jd9365tx.yaml
Documentation/devicetree/bindings/input/touchscreen/jadard,jd9365tx.yaml new file +64 -0
new file mode 100644
index 0000000..aaf2a7e
@@ -0,0 +1,64 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/input/touchscreen/jadard,jd9365tx.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Jadard JD9365TX in-cell touchscreen
+
+maintainers:
+  - Hefei <[email protected]>
+
+description: |
+  In-cell touch integrated with Jadard JD9365TX DSI panels. The module FPC
+  often exposes only I2C (no interrupt GPIO); the driver polls coordinate
+  reports. The touch controller is commonly powered from the same rails as
+  the panel; those supplies should still be described here when dedicated
+  regulators exist.
+
+allOf:
+  - $ref: touchscreen.yaml#
+
+properties:
+  compatible:
+    const: jadard,jd9365tx
+
+  reg:
+    maxItems: 1
+
+  poll-interval: true
+
+  vdd-supply:
+    description: Analog / touch power supply
+
+  iovcc-supply:
+    description: Digital I/O power supply
+
+  reset-gpios:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - vdd-supply
+  - iovcc-supply
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        touchscreen@68 {
+            compatible = "jadard,jd9365tx";
+            reg = <0x68>;
+            vdd-supply = <&reg_vdd>;
+            iovcc-supply = <&reg_iovcc>;
+            touchscreen-size-x = <720>;
+            touchscreen-size-y = <1280>;
+            poll-interval = <16>;
+        };
+    };
+...
Signature · 1 line
2.55.0.windows.5
#5 lore raw

Re: [PATCH v3 2/6] dt-bindings: input: add Jadard JD9365TX touchscreen binding

Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Low] dt-bindings: input: redundant binding in subject and empty commit message - [Low] dt-bindings: input…

Thank you for your contribution! Sashiko AI review found 2 potential issues to consider:
- [Low] dt-bindings: input: redundant binding in subject and empty commit message
- [Low] dt-bindings: input: jadard,jd9365tx: inconsistent supplies and missing irq
--

commit c7b2ac3eb48ad13c122965f49f5eb842ca510a8c
Author: Hefei <[email protected]>

Quoted 3 lines

dt-bindings: input: add Jadard JD9365TX touchscreen binding

[Severity: Low]
The dt-bindings: prefix already indicates a Device Tree binding, so the trailing word "binding" in the subject can be dropped:

dt-bindings: input: add Jadard JD9365TX touchscreen

Also, please add a commit message body describing the Jadard JD9365TX hardware and why the binding is being added.

Quoted 42 lines
Documentation/devicetree/bindings/input/touchscreen/jadard,jd9365tx.yaml new file +36 -0
new file mode 100644
index 0000000000000..aaf2a7e00ff04
@@ -0,0 +1,64 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/input/touchscreen/jadard,jd9365tx.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Jadard JD9365TX in-cell touchscreen
+
+maintainers:
+  - Hefei <[email protected]>
+
+description: |
+  In-cell touch integrated with Jadard JD9365TX DSI panels. The module FPC
+  often exposes only I2C (no interrupt GPIO); the driver polls coordinate
+  reports. The touch controller is commonly powered from the same rails as
+  the panel; those supplies should still be described here when dedicated
+  regulators exist.
+
+allOf:
+  - $ref: touchscreen.yaml#
+
+properties:
+  compatible:
+    const: jadard,jd9365tx
+
+  reg:
+    maxItems: 1
+
+  poll-interval: true
+
+  vdd-supply:
+    description: Analog / touch power supply
+
+  iovcc-supply:
+    description: Digital I/O power supply
+

Documentation/devicetree/bindings/input/touchscreen/jadard,jd9365tx.yaml line 46

Quoted 10 lines
Documentation/devicetree/bindings/input/touchscreen/jadard,jd9365tx.yaml new file +10 -0
+  reset-gpios:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - vdd-supply
+  - iovcc-supply
+
+unevaluatedProperties: false

[Severity: Low]
Does the schema match the hardware description above?

The description says that vdd-supply and iovcc-supply should be described when dedicated regulators exist, yet both are listed under required:. In addition, the description notes that the module FPC often omits the interrupt GPIO (and mentions Linux driver polling, which is OS policy rather than hardware description), but the schema uses the chip-level compatible jadard,jd9365tx with unevaluatedProperties: false without allowing an optional interrupts property (maxItems: 1) for modules or boards that wire the interrupt line.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
#6 lore raw

Re: [PATCH v3 2/6] dt-bindings: input: add Jadard JD9365TX touchscreen binding

In reply to Hefei
Quoted 6 lines · Hefei
---
 .../input/touchscreen/jadard,jd9365tx.yaml    | 64 +++++++++++++++++++
 1 file changed, 64 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/jadard,jd9365tx.yaml

Dropping all your patches from DT patchwork.

Best regards,
Krzysztof

Signature · 1 line
Krzysztof Kozlowski <[email protected]>
author
#7 lore raw

PATCH v3 3/6 dt-bindings: backlight: add VIEWE I2C backlight binding

In reply to a message not in the archive
---
 .../leds/backlight/viewe,i2c-backlight.yaml   | 46 +++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/backlight/viewe,i2c-backlight.yaml
Documentation/devicetree/bindings/leds/backlight/viewe,i2c-backlight.yaml new file +46 -0
new file mode 100644
index 0000000..9be4bc9
@@ -0,0 +1,46 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/backlight/viewe,i2c-backlight.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: VIEWE 7KF82 I2C panel backlight
+
+maintainers:
+  - Hefei <[email protected]>
+
+description: |
+  I2C backlight MCU used on the VIEWE 7KF82 DSI module. Protocol is device
+  address 0x45, register 0x86, brightness 0..255. A discrete MCU part number
+  is not exposed on the FPC silk; the binding is therefore keyed to the
+  module.
+
+allOf:
+  - $ref: common.yaml#
+
+properties:
+  compatible:
+    const: viewe,7kf82-backlight
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        backlight@45 {
+            compatible = "viewe,7kf82-backlight";
+            reg = <0x45>;
+            default-brightness = <200>;
+        };
+    };
+...
Signature · 1 line
2.55.0.windows.5
#8 lore raw

Re: [PATCH v3 3/6] dt-bindings: backlight: add VIEWE I2C backlight binding

Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [Low] dt-bindings: backlight: undocumented vendor prefix viewe in compatible - [Low] dt-bindings…

Thank you for your contribution! Sashiko AI review found 3 potential issues to consider:
- [Low] dt-bindings: backlight: undocumented vendor prefix viewe in compatible
- [Low] dt-bindings: backlight: schema filename mismatches viewe,7kf82-backlight
- [Low] dt-bindings: backlight: redundant binding in subject and empty changelog
--

commit b74671fa2d89ece52daffc3be1232b5909e8c227
Author: Hefei <[email protected]>

Quoted 3 lines

dt-bindings: backlight: add VIEWE I2C backlight binding

[Severity: Low]
The dt-bindings: prefix already indicates a binding patch, so the trailing word "binding" in the subject is redundant. Could you drop it and add a commit message body describing the hardware?

Documentation/devicetree/bindings/leds/backlight/viewe,i2c-backlight.yaml line 4

Quoted 10 lines
Documentation/devicetree/bindings/leds/backlight/viewe,i2c-backlight.yaml new file +4 -0
new file mode 100644
index 0000000000000..9be4bc93087ae
@@ -0,0 +1,46 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/backlight/viewe,i2c-backlight.yaml#

[Severity: Low]
Should the schema filename and $id be viewe,7kf82-backlight.yaml to match the sole compatible string defined below, as required by Documentation/devicetree/bindings/writing-bindings.rst?

Quoted 9 lines
Documentation/devicetree/bindings/leds/backlight/viewe,i2c-backlight.yaml new file +9 -0
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: VIEWE 7KF82 I2C panel backlight
+
+maintainers:
+  - Hefei <[email protected]>
+
+description: |
+  I2C backlight MCU used on the VIEWE 7KF82 DSI module. Protocol is device

Documentation/devicetree/bindings/leds/backlight/viewe,i2c-backlight.yaml line 23

Quoted 10 lines
Documentation/devicetree/bindings/leds/backlight/viewe,i2c-backlight.yaml new file +10 -0
+  address 0x45, register 0x86, brightness 0..255. A discrete MCU part number
+  is not exposed on the FPC silk; the binding is therefore keyed to the
+  module.
+
+allOf:
+  - $ref: common.yaml#
+
+properties:
+  compatible:
+    const: viewe,7kf82-backlight

[Severity: Low]
Is there a patch registering the viewe vendor prefix in Documentation/devicetree/bindings/vendor-prefixes.yaml? Without an entry for ^viewe,.*, make dt_binding_check and checkpatch.pl fail on viewe,7kf82-backlight.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
author
#9 lore raw

PATCH v3 4/6 drm/panel: add VIEWE JD9365TX 7 inch DSI panel

In reply to a message not in the archive
---
 drivers/gpu/drm/panel/Kconfig                |  11 +
 drivers/gpu/drm/panel/Makefile               |   1 +
 drivers/gpu/drm/panel/panel-viewe-jd9365tx.c | 353 +++++++++++++++++++
 3 files changed, 365 insertions(+)
 create mode 100644 drivers/gpu/drm/panel/panel-viewe-jd9365tx.c
drivers/gpu/drm/panel/Kconfig +11 -0
index 3100640..ad1eee3 100644
@@ -324,6 +324,17 @@ config DRM_PANEL_INNOLUX_P079ZCA
 	  24 bit RGB per pixel. It provides a MIPI DSI interface to
 	  the host and has a built-in LED backlight.
 
+config DRM_PANEL_VIEWE_JD9365TX
+	tristate "VIEWE 7\" JD9365TX DSI panel"
+	depends on OF
+	depends on DRM_MIPI_DSI
+	depends on BACKLIGHT_CLASS_DEVICE
+	help
+	  Say Y here to enable the VIEWE 7" 720x1280 Jadard JD9365TX
+	  MIPI-DSI panel.
+
+	  If unsure, say N.
+
 config DRM_PANEL_JADARD_JD9365DA_H3
 	tristate "Jadard JD9365DA-H3 WXGA DSI panel"
 	depends on OF
drivers/gpu/drm/panel/Makefile +1 -0
index 75f6bf2..2933489 100644
@@ -33,6 +33,7 @@ obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9881C) += panel-ilitek-ili9881c.o
 obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9882T) += panel-ilitek-ili9882t.o
 obj-$(CONFIG_DRM_PANEL_INNOLUX_EJ030NA) += panel-innolux-ej030na.o
 obj-$(CONFIG_DRM_PANEL_INNOLUX_P079ZCA) += panel-innolux-p079zca.o
+obj-$(CONFIG_DRM_PANEL_VIEWE_JD9365TX) += panel-viewe-jd9365tx.o
 obj-$(CONFIG_DRM_PANEL_JADARD_JD9365DA_H3) += panel-jadard-jd9365da-h3.o
 obj-$(CONFIG_DRM_PANEL_JDI_LT070ME05000) += panel-jdi-lt070me05000.o
 obj-$(CONFIG_DRM_PANEL_JDI_LPM102A188A) += panel-jdi-lpm102a188a.o
drivers/gpu/drm/panel/panel-viewe-jd9365tx.c new file +353 -0

353 lines not on this page · raw message

Signature · 1 line
2.55.0.windows.5
#10 lore raw

Re: [PATCH v3 4/6] drm/panel: add VIEWE JD9365TX 7 inch DSI panel

Thank you for your contribution! Sashiko AI review found 5 potential issues to consider: - [High] drm/panel: call to removed of_drm_get_panel_orientation() in jd9365tx_probe() - [High] drm/panel…

Thank you for your contribution! Sashiko AI review found 5 potential issues to consider:
- [High] drm/panel: call to removed of_drm_get_panel_orientation() in jd9365tx_probe()
- [High] drm/panel: call to static drm_panel_init() in jd9365tx_probe()
- [Low] drm/panel: undocumented compatible jadard,jd9365tx-7kf82 in jd9365tx_of_match
- [Low] drm/panel: open-coded DSI command sender and helpers in panel-viewe-jd9365tx
- [Low] drm/panel: non-alphabetical Kconfig and Makefile order for VIEWE_JD9365TX
--

commit 0ea4165795cc39804999640f1fa6be9c2c2143db
Author: Hefei <[email protected]>

drm/panel: add VIEWE JD9365TX 7 inch DSI panel

This commit adds a DRM panel driver for the VIEWE 7" 720x1280 Jadard JD9365TX (7KF82) 2-lane MIPI-DSI panel.

Quoted 27 lines
drivers/gpu/drm/panel/Kconfig +11 -0
index 26ffa2378f55c..9a3038bf60987 100644
@@ -427,6 +427,17 @@ config DRM_PANEL_INNOLUX_P079ZCA
 	  24 bit RGB per pixel. It provides a MIPI DSI interface to
 	  the host and has a built-in LED backlight.
 
+config DRM_PANEL_VIEWE_JD9365TX
+	tristate "VIEWE 7\" JD9365TX DSI panel"
+	depends on OF
+	depends on DRM_MIPI_DSI
+	depends on BACKLIGHT_CLASS_DEVICE
+	help
+	  Say Y here to enable the VIEWE 7" 720x1280 Jadard JD9365TX
+	  MIPI-DSI panel.
+
+	  If unsure, say N.
+
 config DRM_PANEL_JADARD_JD9365DA_H3
 	tristate "Jadard JD9365DA-H3 WXGA DSI panel"
 	depends on OF
drivers/gpu/drm/panel/Makefile +0 -0
index 365f2e73f6b45..84ed0891a40d1 100644

drivers/gpu/drm/panel/Makefile obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9881C) += panel-ilitek-ili9881c.o · line 48

Quoted 7 lines
drivers/gpu/drm/panel/Makefile +1 -0
@@ -42,6 +42,7 @@ obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9881C) += panel-ilitek-ili9881c.o
 obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9882T) += panel-ilitek-ili9882t.o
 obj-$(CONFIG_DRM_PANEL_INNOLUX_EJ030NA) += panel-innolux-ej030na.o
 obj-$(CONFIG_DRM_PANEL_INNOLUX_P079ZCA) += panel-innolux-p079zca.o
+obj-$(CONFIG_DRM_PANEL_VIEWE_JD9365TX) += panel-viewe-jd9365tx.o
 obj-$(CONFIG_DRM_PANEL_JADARD_JD9365DA_H3) += panel-jadard-jd9365da-h3.o
 obj-$(CONFIG_DRM_PANEL_JDI_LT070ME05000) += panel-jdi-lt070me05000.o
 obj-$(CONFIG_DRM_PANEL_JDI_LPM102A188A) += panel-jdi-lpm102a188a.o

[Severity: Low]
This isn't a bug, but DRM_PANEL_VIEWE_JD9365TX is placed between the INNOLUX and JADARD entries instead of in alphabetical order in both Kconfig and Makefile.

Quoted 5 lines
drivers/gpu/drm/panel/panel-viewe-jd9365tx.c new file +0 -0
new file mode 100644
index 0000000000000..b511dd6bfed96

[ ... ]

Quoted 24 lines
drivers/gpu/drm/panel/panel-viewe-jd9365tx.c new file +24 -0
+static int jd9365tx_send_cmds(struct mipi_dsi_device *dsi,
+			      const struct jd9365tx_cmd *cmds,
+			      unsigned int count)
+{
+	unsigned int i;
+	int ret;
+
+	for (i = 0; i < count; i++) {
+		const struct jd9365tx_cmd *cmd = &cmds[i];
+
+		if (cmd->len) {
+			ret = mipi_dsi_dcs_write_buffer(dsi, cmd->data, cmd->len);
+			if (ret < 0) {
+				dev_err(&dsi->dev,
+					"DCS write 0x%02x failed: %d\n",
+					cmd->data[0], ret);
+				return ret;
+			}
+		}
+		if (cmd->delay_ms)
+			msleep(cmd->delay_ms);
+	}
+	return 0;
+}

[ ... ]

Quoted 9 lines
drivers/gpu/drm/panel/panel-viewe-jd9365tx.c new file +9 -0
+static int jd9365tx_get_modes(struct drm_panel *panel,
+			      struct drm_connector *connector)
+{
+	struct jd9365tx_panel *ctx = to_jd9365tx(panel);
+	struct drm_display_mode *mode;
+
+	mode = drm_mode_duplicate(connector->dev, &jd9365tx_7kf82_mode);
+	if (!mode)
+		return -ENOMEM;

drivers/gpu/drm/panel/panel-viewe-jd9365tx.c line 256

Quoted 10 lines
drivers/gpu/drm/panel/panel-viewe-jd9365tx.c new file +10 -0
+
+	drm_mode_set_name(mode);
+	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
+	drm_mode_probed_add(connector, mode);
+
+	connector->display_info.width_mm = mode->width_mm;
+	connector->display_info.height_mm = mode->height_mm;
+	drm_connector_set_panel_orientation(connector, ctx->orientation);
+	return 1;
+}

[Severity: Low]
Can this driver use the existing DRM and MIPI-DSI helpers instead of open-coding them?

Since jd9365tx_prepare() already sets up a struct mipi_dsi_multi_context, using mipi_dsi_dcs_write_seq_multi() and mipi_dsi_msleep() avoids the custom struct jd9365tx_cmd table and jd9365tx_send_cmds() loop.

In jd9365tx_get_modes(), using drm_connector_helper_get_modes_fixed() avoids returning a negative errno from .get_modes on allocation failure and drops the redundant drm_connector_set_panel_orientation() call (which panel_bridge_attach() already handles via .get_orientation). Using devm_drm_panel_add() and devm_mipi_dsi_attach() in jd9365tx_probe() would also allow dropping jd9365tx_remove(), and a brief commit message body describing the panel hardware would be helpful.

[ ... ]

Quoted 23 lines
drivers/gpu/drm/panel/panel-viewe-jd9365tx.c new file +23 -0
+static int jd9365tx_probe(struct mipi_dsi_device *dsi)
+{
+	struct device *dev = &dsi->dev;
+	struct jd9365tx_panel *ctx;
+	int ret;
+
+	ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
+	if (!ctx)
+		return -ENOMEM;
+
+	ctx->dsi = dsi;
+	mipi_dsi_set_drvdata(dsi, ctx);
+
+	dsi->lanes = 2;
+	dsi->format = MIPI_DSI_FMT_RGB888;
+	dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
+			  MIPI_DSI_MODE_LPM;
+
+	ctx->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
+	if (IS_ERR(ctx->reset))
+		return PTR_ERR(ctx->reset);
+
+	ctx->vdd = devm_regulator_get(dev, "vdd");

drivers/gpu/drm/panel/panel-viewe-jd9365tx.c line 306

Quoted 10 lines
drivers/gpu/drm/panel/panel-viewe-jd9365tx.c new file +10 -0
+	if (IS_ERR(ctx->vdd))
+		return PTR_ERR(ctx->vdd);
+
+	ctx->iovcc = devm_regulator_get(dev, "iovcc");
+	if (IS_ERR(ctx->iovcc))
+		return PTR_ERR(ctx->iovcc);
+
+	ret = of_drm_get_panel_orientation(dev->of_node, &ctx->orientation);
+	if (ret)
+		return ret;

[Severity: High]
Does calling of_drm_get_panel_orientation() fail to compile when CONFIG_DRM_PANEL_VIEWE_JD9365TX is enabled?

Commit b5a8b1f2a973 ("drm/panel: Use drm_of_get_panel_orientation()") removed of_drm_get_panel_orientation() in favor of drm_of_get_panel_orientation() declared in include/drm/drm_of.h.

drivers/gpu/drm/panel/panel-viewe-jd9365tx.c line 308

Quoted 2 lines
drivers/gpu/drm/panel/panel-viewe-jd9365tx.c new file +2 -0
+
+	drm_panel_init(&ctx->panel, dev, &jd9365tx_funcs, DRM_MODE_CONNECTOR_DSI);

[Severity: High]
Does calling drm_panel_init() here also break the build and leave ctx->panel.bridge uninitialized?

Commit fe417df954a9 ("drm/panel: Make drm_panel_init() static") made drm_panel_init() static to drivers/gpu/drm/drm_panel.c. Allocating ctx with devm_kzalloc() instead of devm_drm_panel_alloc() also skips initializing the embedded refcounted struct drm_bridge that drm_panel_add() registers.

[ ... ]

drivers/gpu/drm/panel/panel-viewe-jd9365tx.c line 338

Quoted 5 lines
drivers/gpu/drm/panel/panel-viewe-jd9365tx.c new file +5 -0
+static const struct of_device_id jd9365tx_of_match[] = {
+	{ .compatible = "viewe,7kf82" },
+	{ .compatible = "jadard,jd9365tx-7kf82" },
+	{ }
+};

[Severity: Low]
Is "jadard,jd9365tx-7kf82" documented in the Device Tree bindings? Documentation/devicetree/bindings/display/panel/viewe,jd9365tx.yaml only documents "viewe,7kf82".

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
author
#11 lore raw

PATCH v3 5/6 Input: add Jadard JD9365TX in-cell touchscreen driver

In reply to a message not in the archive
---
 drivers/input/touchscreen/Kconfig           |  12 +
 drivers/input/touchscreen/Makefile          |   1 +
 drivers/input/touchscreen/jadard_jd9365tx.c | 373 ++++++++++++++++++++
 3 files changed, 386 insertions(+)
 create mode 100644 drivers/input/touchscreen/jadard_jd9365tx.c
drivers/input/touchscreen/Kconfig +12 -0
index e2ee722..da425c8 100644
@@ -540,6 +540,18 @@ config TOUCHSCREEN_IPROC
 	  To compile this driver as a module, choose M here: the
 	  module will be called bcm_iproc_tsc.
 
+config TOUCHSCREEN_JADARD_JD9365TX
+	tristate "Jadard JD9365TX in-cell touchscreen"
+	depends on I2C
+	help
+	  Say Y here if you have a Jadard JD9365TX in-cell touchscreen.
+	  The driver polls over I2C when no interrupt line is wired.
+
+	  If unsure, say N.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called jadard_jd9365tx.
+
 config TOUCHSCREEN_S6SY761
 	tristate "Samsung S6SY761 Touchscreen driver"
 	depends on I2C
drivers/input/touchscreen/Makefile +1 -0
index 58094f2..5846f4d 100644
@@ -59,6 +59,7 @@ obj-$(CONFIG_TOUCHSCREEN_IMAGIS)	+= imagis.o
 obj-$(CONFIG_TOUCHSCREEN_IMX6UL_TSC)	+= imx6ul_tsc.o
 obj-$(CONFIG_TOUCHSCREEN_INEXIO)	+= inexio.o
 obj-$(CONFIG_TOUCHSCREEN_IPROC)		+= bcm_iproc_tsc.o
+obj-$(CONFIG_TOUCHSCREEN_JADARD_JD9365TX) += jadard_jd9365tx.o
 obj-$(CONFIG_TOUCHSCREEN_LPC32XX)	+= lpc32xx_ts.o
 obj-$(CONFIG_TOUCHSCREEN_MAX11801)	+= max11801_ts.o
 obj-$(CONFIG_TOUCHSCREEN_MXS_LRADC)     += mxs-lradc-ts.o
drivers/input/touchscreen/jadard_jd9365tx.c new file +373 -0

373 lines not on this page · raw message

Signature · 1 line
2.55.0.windows.5
#12 lore raw

Re: [PATCH v3 5/6] Input: add Jadard JD9365TX in-cell touchscreen driver

Thank you for your contribution! Sashiko AI review found 9 potential issues to consider: - [High] Input: jadard_jd9365tx: broken slot check in jd_report_touches() - [High] Input: jadard_jd9365tx…

Thank you for your contribution! Sashiko AI review found 9 potential issues to consider:
- [High] Input: jadard_jd9365tx: broken slot check in jd_report_touches()
- [High] Input: jadard_jd9365tx: deferred init in jd_poll() and no reset recovery
- [Medium] Input: jadard_jd9365tx: uninitialized stack read in jd_report_touches()
- [Medium] Input: jadard_jd9365tx: missing reset-gpios handling in jadard_tp_probe()
- [Low] Input: jadard_jd9365tx: signed shift overflow in jd_resolve_coord_addr()
- [Low] Input: jadard_jd9365tx: duplicate OF-only size parsing in jadard_tp_probe()
- [Low] Input: jadard_jd9365tx: redundant capabilities, BTN_TOUCH, and parent setup
- [Low] Input: jadard_jd9365tx: positional initializer in jadard_tp_id table
- [Low] Input: jadard_jd9365tx: empty commit message body for new driver --

commit 7d4899901ebf2b5cd58796c8a16ba3f15ed92ab7
Author: Hefei <[email protected]>

Quoted 3 lines

Input: add Jadard JD9365TX in-cell touchscreen driver

[Severity: Low]
This commit adds a new touchscreen driver with an empty commit message body. Please add a description of the Jadard JD9365TX hardware and explain why the driver uses I2C polling and defers hardware initialization.

Quoted 6 lines
drivers/input/touchscreen/jadard_jd9365tx.c new file +0 -0
new file mode 100644
index 0000000000000..2030157c3a5b8
@@ -0,0 +1,373 @@

[ ... ]

Quoted 10 lines
drivers/input/touchscreen/jadard_jd9365tx.c new file +10 -0
+static int jd_resolve_coord_addr(struct jadard_tp *ts)
+{
+	u32 esram_num_addr = JD_ERAM_BASE + 4 + JD_MAX_DSRAM_NUM * 8;
+	u32 esram_sec_addr = esram_num_addr + 4;
+	u8 buf[JD_ESRAM_SECTION_NUM * 8];
+	u32 addr, len;
+	int ret;
+
+	ret = jd_read_reg(ts->client, esram_sec_addr, buf, sizeof(buf));
+	if (ret)

drivers/input/touchscreen/jadard_jd9365tx.c line 164

Quoted 10 lines
drivers/input/touchscreen/jadard_jd9365tx.c new file +10 -0
+		return ret;
+
+	addr = buf[JD_ESRAM_COORD_IDX * 8 + 0] |
+	       (buf[JD_ESRAM_COORD_IDX * 8 + 1] << 8) |
+	       (buf[JD_ESRAM_COORD_IDX * 8 + 2] << 16) |
+	       (buf[JD_ESRAM_COORD_IDX * 8 + 3] << 24);
+	len = buf[JD_ESRAM_COORD_IDX * 8 + 4] |
+	      (buf[JD_ESRAM_COORD_IDX * 8 + 5] << 8) |
+	      (buf[JD_ESRAM_COORD_IDX * 8 + 6] << 16) |
+	      (buf[JD_ESRAM_COORD_IDX * 8 + 7] << 24);

[Severity: Low]
Can shifting buf[JD_ESRAM_COORD_IDX * 8 + 3] and buf[JD_ESRAM_COORD_IDX * 8 + 7] left by 24 bits overflow a 32-bit signed int? In C, u8 values are promoted to signed int before << 24, which triggers undefined behavior under UBSAN when bit 7 of the high byte is set. Using get_unaligned_le32() avoids this.

drivers/input/touchscreen/jadard_jd9365tx.c line 173

Quoted 9 lines
drivers/input/touchscreen/jadard_jd9365tx.c new file +9 -0
+
+	if (addr < JD_ERAM_BASE || addr >= JD_ERAM_BASE + 0x1000 ||
+	    len == 0 || len > JD_TOUCH_DATA_SIZE)
+		return -EINVAL;
+
+	ts->coord_addr = addr;
+	ts->touch_data_size = (u16)len;
+	return 0;
+}

[Severity: Medium]
Can jd_report_touches() read uninitialized stack memory from buf[] when jd_resolve_coord_addr() accepts a section length smaller than 53 bytes?

jd_resolve_coord_addr() accepts any len from 1 to JD_TOUCH_DATA_SIZE (78), and jd_poll() declares u8 buf[JD_TOUCH_DATA_SIZE] uninitialized on the stack before reading ts->touch_data_size bytes into it. However, jd_report_touches() unconditionally reads JD_TOUCH_COORD_INFO_ADDR + ts->max_points * JD_FINGER_DATA_SIZE (53) bytes from buf[], reporting uninitialized stack bytes as touch coordinates whenever len < 53. The bounds check also does not verify that addr + len stays within JD_ERAM_BASE + 0x1000.

[ ... ]

Quoted 11 lines
drivers/input/touchscreen/jadard_jd9365tx.c new file +11 -0
+static void jd_report_touches(struct jadard_tp *ts, const u8 *buf)
+{
+	u8 finger_num = buf[JD_FINGER_NUM_ADDR];
+	unsigned int i;
+	bool any = false;
+
+	if (finger_num > ts->max_points)
+		finger_num = ts->max_points;
+
+	for (i = 0; i < ts->max_points; i++) {
+		const u8 *c = buf + JD_TOUCH_COORD_INFO_ADDR +

drivers/input/touchscreen/jadard_jd9365tx.c line 220

Quoted 10 lines
drivers/input/touchscreen/jadard_jd9365tx.c new file +10 -0
+			      i * JD_FINGER_DATA_SIZE;
+		u16 x = (c[0] << 8) | c[1];
+		u16 y = (c[2] << 8) | c[3];
+		u8 w = c[4];
+		bool down = false;
+
+		if (i < finger_num &&
+		    x <= ts->abs_x_max && y <= ts->abs_y_max &&
+		    x != 0xFFFF && y != 0xFFFF)
+			down = true;

[Severity: High]
Does gating down on i < finger_num drop active contacts whenever a lower-numbered slot lifts before a higher-numbered slot?

The packet uses fixed slots where inactive slots carry 0xFFFF/0xFFFF and finger_num is the total active contact count. If fingers are down in slots 0 and 1 (finger_num == 2) and finger 0 lifts while finger 1 stays on the screen, finger_num becomes 1 while slot 1 retains its coordinates; on the next poll, slot 1 (i == 1) fails i < finger_num and is reported as released. In addition, clamping finger_num > ts->max_points to ts->max_points instead of discarding the packet treats an invalid 0xFF header byte as 10 active fingers.

Quoted 23 lines
drivers/input/touchscreen/jadard_jd9365tx.c new file +23 -0
+
+		input_mt_slot(ts->input, i);
+		input_mt_report_slot_state(ts->input, MT_TOOL_FINGER, down);
+
+		if (down) {
+			touchscreen_report_pos(ts->input, &ts->prop, x, y, true);
+			input_report_abs(ts->input, ABS_MT_TOUCH_MAJOR, w);
+			any = true;
+		}
+	}
+
+	input_mt_sync_frame(ts->input);
+	input_report_key(ts->input, BTN_TOUCH, any);
+	input_sync(ts->input);
+}
+
+static void jd_poll(struct input_dev *input)
+{
+	struct jadard_tp *ts = input_get_drvdata(input);
+	u8 buf[JD_TOUCH_DATA_SIZE];
+	int ret;
+
+	if (!ts->ready) {

drivers/input/touchscreen/jadard_jd9365tx.c line 253

Quoted 10 lines
drivers/input/touchscreen/jadard_jd9365tx.c new file +10 -0
+		ret = jd_hw_init(ts);
+		if (ret)
+			return;
+		ts->ready = true;
+	}
+
+	ret = jd_read_reg(ts->client, ts->coord_addr, buf, ts->touch_data_size);
+	if (!ret)
+		jd_report_touches(ts, buf);
+}

[Severity: High]
Does deferring jd_hw_init() to jd_poll() break probe detection, block the poller workqueue, and leave the touchscreen unable to recover after panel or system resets?

Because jadard_tp_probe() registers the input device without checking hardware presence, an absent device or chip ID mismatch (-ENODEV) still binds, keeps vdd and iovcc enabled, and retries jd_hw_init() every 16 ms while the device is open. Inside jd_hw_init(), jd_section_ready() loops up to 50 times calling msleep(2) and jd_read_reg(), blocking input_open_device() (under input->mutex) or system_freezable_wq for hundreds of milliseconds. Once ts->ready is set to true, it is never cleared on read failures or across suspend/resume, so any reset or power cycle of the shared JD9365TX controller drops the 0xF2 I2C backdoor mode and causes subsequent touch reads to fail permanently.

Quoted 35 lines
drivers/input/touchscreen/jadard_jd9365tx.c new file +35 -0
+
+static void jadard_tp_disable_regulators(void *data)
+{
+	struct jadard_tp *ts = data;
+
+	regulator_disable(ts->iovcc);
+	regulator_disable(ts->vdd);
+}
+
+static int jadard_tp_probe(struct i2c_client *client)
+{
+	struct device *dev = &client->dev;
+	struct jadard_tp *ts;
+	struct input_dev *input;
+	u32 val;
+	int ret;
+
+	ts = devm_kzalloc(dev, sizeof(*ts), GFP_KERNEL);
+	if (!ts)
+		return -ENOMEM;
+
+	ts->client = client;
+	ts->max_points = JD_MAX_POINTS;
+	ts->abs_x_max = 719;
+	ts->abs_y_max = 1279;
+	ts->poll_interval_ms = JD_DEFAULT_POLL_MS;
+	ts->touch_data_size = JD_TOUCH_DATA_SIZE;
+
+	ts->vdd = devm_regulator_get(dev, "vdd");
+	if (IS_ERR(ts->vdd))
+		return PTR_ERR(ts->vdd);
+
+	ts->iovcc = devm_regulator_get(dev, "iovcc");
+	if (IS_ERR(ts->iovcc))
+		return PTR_ERR(ts->iovcc);

drivers/input/touchscreen/jadard_jd9365tx.c line 298

Quoted 10 lines
drivers/input/touchscreen/jadard_jd9365tx.c new file +10 -0
+
+	ret = regulator_enable(ts->vdd);
+	if (ret)
+		return ret;
+
+	ret = regulator_enable(ts->iovcc);
+	if (ret) {
+		regulator_disable(ts->vdd);
+		return ret;
+	}

[Severity: Medium]
Does jadard_tp_probe() leave the controller held in reset on boards that wire reset-gpios to the touchscreen node? The jadard,jd9365tx DT binding defines reset-gpios, but jadard_tp_probe() never requests or deasserts it after enabling vdd and iovcc.

Quoted 4 lines
drivers/input/touchscreen/jadard_jd9365tx.c new file +4 -0
+
+	ret = devm_add_action_or_reset(dev, jadard_tp_disable_regulators, ts);
+	if (ret)
+		return ret;

drivers/input/touchscreen/jadard_jd9365tx.c line 312

Quoted 10 lines
drivers/input/touchscreen/jadard_jd9365tx.c new file +10 -0
+
+	if (!device_property_read_u32(dev, "poll-interval", &val) &&
+	    val >= 8 && val <= 100)
+		ts->poll_interval_ms = val;
+
+	if (!of_property_read_u32(dev->of_node, "touchscreen-size-x", &val) && val)
+		ts->abs_x_max = val - 1;
+
+	if (!of_property_read_u32(dev->of_node, "touchscreen-size-y", &val) && val)
+		ts->abs_y_max = val - 1;

[Severity: Low]
Why parse touchscreen-size-x and touchscreen-size-y manually with of_property_read_u32() into ts->abs_x_max and ts->abs_y_max when touchscreen_parse_properties() is called right below? touchscreen_parse_properties() already parses these via the generic device property API and stores the pre-swap axis maxima in ts->prop.max_x and ts->prop.max_y; if properties come from non-OF firmware nodes or touchscreen-min-x/y is used, ts->abs_x_max and ts->abs_y_max stay at 719x1279 and jd_report_touches() drops coordinates above those defaults.

Quoted 25 lines
drivers/input/touchscreen/jadard_jd9365tx.c new file +25 -0
+
+	input = devm_input_allocate_device(dev);
+	if (!input)
+		return -ENOMEM;
+
+	input->name = "Jadard JD9365TX Touchscreen";
+	input->id.bustype = BUS_I2C;
+	input->dev.parent = dev;
+
+	__set_bit(EV_ABS, input->evbit);
+	__set_bit(EV_KEY, input->evbit);
+	__set_bit(BTN_TOUCH, input->keybit);
+
+	input_set_abs_params(input, ABS_MT_POSITION_X, 0, ts->abs_x_max, 0, 0);
+	input_set_abs_params(input, ABS_MT_POSITION_Y, 0, ts->abs_y_max, 0, 0);
+	input_set_abs_params(input, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0);
+
+	touchscreen_parse_properties(input, true, &ts->prop);
+
+	ret = input_mt_init_slots(input, ts->max_points, INPUT_MT_DIRECT);
+	if (ret)
+		return ret;
+
+	input_set_drvdata(input, ts);
+	ts->input = input;

drivers/input/touchscreen/jadard_jd9365tx.c line 347

Quoted 10 lines
drivers/input/touchscreen/jadard_jd9365tx.c new file +10 -0
+	i2c_set_clientdata(client, ts);
+
+	ret = input_setup_polling(input, jd_poll);
+	if (ret)
+		return ret;
+
+	input_set_poll_interval(input, ts->poll_interval_ms);
+
+	return input_register_device(input);
+}

[Severity: Low]
This isn't a bug, but several parts of jadard_tp_probe() and jd_report_touches() duplicate work already done by the input and regulator helpers:
- devm_input_allocate_device(dev) already sets input->dev.parent = dev.
- input_set_abs_params() and input_mt_init_slots(..., INPUT_MT_DIRECT) already set EV_ABS, EV_KEY, and BTN_TOUCH, so the raw __set_bit() calls are redundant.
- input_mt_sync_frame() with INPUT_MT_DIRECT already reports BTN_TOUCH via pointer emulation, so input_report_key(ts->input, BTN_TOUCH, any) in jd_report_touches() is redundant.
- vdd and iovcc can be managed with devm_regulator_bulk_get_enable() instead of manual regulator_enable() calls and jadard_tp_disable_regulators().
- Per input subsystem style, please name the error status variable error and check the return value of input_register_device() before explicitly returning 0.

drivers/input/touchscreen/jadard_jd9365tx.c line 358

Quoted 11 lines
drivers/input/touchscreen/jadard_jd9365tx.c new file +11 -0
+
+static const struct of_device_id jadard_tp_of_match[] = {
+	{ .compatible = "jadard,jd9365tx" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, jadard_tp_of_match);
+
+static const struct i2c_device_id jadard_tp_id[] = {
+	{ "jd9365tx", 0 },
+	{ }
+};

[Severity: Low]
This isn't a bug, but new struct i2c_device_id entries should use named initializers ({ .name = "jd9365tx" }).

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=5
author
#14 lore raw

PATCH v3 6/6 backlight: add VIEWE I2C backlight driver

In reply to a message not in the archive
---
 drivers/video/backlight/Kconfig        |  7 +++
 drivers/video/backlight/Makefile       |  1 +
 drivers/video/backlight/viewe_bl_i2c.c | 79 ++++++++++++++++++++++++++
 3 files changed, 87 insertions(+)
 create mode 100644 drivers/video/backlight/viewe_bl_i2c.c
drivers/video/backlight/Kconfig +7 -0
index 7b836f9..8ea7332 100644
@@ -501,6 +501,13 @@ config BACKLIGHT_LED
 	  If you have a LCD backlight adjustable by LED class driver, say Y
 	  to enable this driver.
 
+config BACKLIGHT_VIEWE_I2C
+	tristate "VIEWE I2C backlight"
+	depends on I2C
+	help
+	  Backlight driver for VIEWE DSI panels. Brightness is written to
+	  the panel MCU at I2C address 0x45, register 0x86.
+
 endif # BACKLIGHT_CLASS_DEVICE
 
 endmenu
drivers/video/backlight/Makefile +1 -0
index bcb568a..b82d959 100644
@@ -61,3 +61,4 @@ obj-$(CONFIG_BACKLIGHT_WM831X)		+= wm831x_bl.o
 obj-$(CONFIG_BACKLIGHT_ARCXCNN) 	+= arcxcnn_bl.o
 obj-$(CONFIG_BACKLIGHT_RAVE_SP)		+= rave-sp-backlight.o
 obj-$(CONFIG_BACKLIGHT_LED)		+= led_bl.o
+obj-$(CONFIG_BACKLIGHT_VIEWE_I2C)	+= viewe_bl_i2c.o
drivers/video/backlight/viewe_bl_i2c.c new file +79 -0

79 lines not on this page · raw message

Signature · 1 line
2.55.0.windows.5
#15 lore raw

Re: [PATCH v3 6/6] backlight: add VIEWE I2C backlight driver

Thank you for your contribution! Sashiko AI review found 5 potential issues to consider: - [Medium] backlight: viewe_bl_i2c: missing DT property parsing and initial HW sync in viewe_bl_probe()…

Thank you for your contribution! Sashiko AI review found 5 potential issues to consider:
- [Medium] backlight: viewe_bl_i2c: missing DT property parsing and initial HW sync in viewe_bl_probe()
- [Low] backlight: viewe_bl_i2c: positional initializer and mismatched ID in viewe_bl_id
- [Low] backlight: viewe_bl_i2c: open-coded byte write in viewe_bl_update_status()
- [Low] backlight: viewe_bl_i2c: hardcoded device name in viewe_bl_probe() breaks multi-instance probe
- [Low] backlight: viewe_bl_i2c: empty commit message body lacking hardware and driver description
--

commit 4e7ef9a994e068f00aa52e87d93462c70437631d
Author: Hefei <[email protected]>

Quoted 3 lines

backlight: add VIEWE I2C backlight driver

[Severity: Low]
The commit message has an empty body. Could you add a description of the VIEWE 7KF82 I2C backlight MCU hardware and explain why a dedicated driver is needed?

Quoted 26 lines
drivers/video/backlight/viewe_bl_i2c.c new file +20 -0
new file mode 100644
index 0000000000000..53dcf0834dcb2
@@ -0,0 +1,79 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2026 VIEWE
+ *
+ * I2C backlight for VIEWE 7KF82 DSI modules (MCU @0x45, register 0x86, 0..255).
+ */
+
+#include <linux/backlight.h>
+#include <linux/i2c.h>
+#include <linux/module.h>
+
+#define VIEWE_BL_REG		0x86
+#define VIEWE_BL_MAX		255
+#define VIEWE_BL_DEFAULT	200
+
+static int viewe_bl_update_status(struct backlight_device *bd)
+{
+	struct i2c_client *client = bl_get_data(bd);
+	u8 buf[2] = { VIEWE_BL_REG, (u8)backlight_get_brightness(bd) };
+	struct i2c_msg msg = {

drivers/video/backlight/viewe_bl_i2c.c line 30

Quoted 10 lines
drivers/video/backlight/viewe_bl_i2c.c new file +10 -0
+		.addr = client->addr,
+		.flags = 0,
+		.len = sizeof(buf),
+		.buf = buf,
+	};
+	int ret;
+
+	ret = i2c_transfer(client->adapter, &msg, 1);
+	return ret == 1 ? 0 : (ret < 0 ? ret : -EIO);
+}

[Severity: Low]
Could viewe_bl_update_status() use i2c_smbus_write_byte_data(client, VIEWE_BL_REG, backlight_get_brightness(bd)) instead of open-coding a raw i2c_transfer()? Using the SMBus helper preserves client->flags and works on SMBus-only adapters that do not implement raw I2C master_xfer.

Quoted 11 lines
drivers/video/backlight/viewe_bl_i2c.c new file +11 -0
+
+static const struct backlight_ops viewe_bl_ops = {
+	.update_status = viewe_bl_update_status,
+};
+
+static int viewe_bl_probe(struct i2c_client *client)
+{
+	struct backlight_properties props = {
+		.type = BACKLIGHT_RAW,
+		.brightness = VIEWE_BL_DEFAULT,
+		.max_brightness = VIEWE_BL_MAX,

drivers/video/backlight/viewe_bl_i2c.c line 51

Quoted 10 lines
drivers/video/backlight/viewe_bl_i2c.c new file +10 -0
+	};
+	struct backlight_device *bd;
+
+	bd = devm_backlight_device_register(&client->dev, "viewe_bl",
+					   &client->dev, client, &viewe_bl_ops,
+					   &props);
+	if (IS_ERR(bd))
+		return PTR_ERR(bd);
+
+	i2c_set_clientdata(client, bd);

[Severity: Low]
Does passing the constant string "viewe_bl" to devm_backlight_device_register() cause probing a second panel instance to fail with -EEXIST when creating /sys/class/backlight/viewe_bl? Passing dev_name(&client->dev) avoids the name collision, and the i2c_set_clientdata() call can be dropped since client data is never read.

drivers/video/backlight/viewe_bl_i2c.c line 53

Quoted 2 lines
drivers/video/backlight/viewe_bl_i2c.c new file +2 -0
+	return 0;
+}

[Severity: Medium]
Does viewe_bl_probe() ignore the default-brightness property from Device Tree and leave the hardware brightness uninitialized at probe?

devm_backlight_device_register() neither parses default-brightness (or max-brightness) from device properties nor calls backlight_update_status(). Any default-brightness configured per the viewe,7kf82-backlight binding is silently ignored in favor of VIEWE_BL_DEFAULT, sysfs brightness is out of sync with register 0x86 until userspace writes to it, and probe succeeds even if the MCU at 0x45 does not respond. In addition, viewe_bl_ops omits .options = BL_CORE_SUSPENDRESUME, so the backlight is not blanked and restored across system suspend and resume.

drivers/video/backlight/viewe_bl_i2c.c line 64

Quoted 11 lines
drivers/video/backlight/viewe_bl_i2c.c new file +11 -0
+
+static const struct of_device_id viewe_bl_of_match[] = {
+	{ .compatible = "viewe,7kf82-backlight" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, viewe_bl_of_match);
+
+static const struct i2c_device_id viewe_bl_id[] = {
+	{ "viewe_bl", 0 },
+	{ }
+};

[Severity: Low]
New struct i2c_device_id entries should use named initializers (such as { .name = "7kf82-backlight" }), and the ID string should match the vendor-stripped compatible name ("7kf82-backlight" rather than "viewe_bl") so fallback I2C ID matching works with the OF compatible string.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=6