* [PATCH v3 1/6] dt-bindings: display: add VIEWE JD9365TX panel binding [not found] <20261125021127.1430-1-3066883572@qq.com> @ 2026-11-25 2:11 ` Hefei 2026-11-25 7:13 ` Krzysztof Kozlowski 2026-11-25 2:11 ` [PATCH v3 2/6] dt-bindings: input: add Jadard JD9365TX touchscreen binding Hefei ` (4 subsequent siblings) 5 siblings, 1 reply; 12+ messages in thread From: Hefei @ 2026-11-25 2:11 UTC (permalink / raw) To: dri-devel; +Cc: linux-input, devicetree, linux-kernel, robh, conor, Hefei Signed-off-by: Hefei <3066883572@qq.com> --- .../display/panel/viewe,jd9365tx.yaml | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/viewe,jd9365tx.yaml diff --git a/Documentation/devicetree/bindings/display/panel/viewe,jd9365tx.yaml b/Documentation/devicetree/bindings/display/panel/viewe,jd9365tx.yaml new file mode 100644 index 0000000..1043f93 --- /dev/null +++ b/Documentation/devicetree/bindings/display/panel/viewe,jd9365tx.yaml @@ -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 <3066883572@qq.com> + +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 = <®_vdd>; + iovcc-supply = <®_iovcc>; + backlight = <&viewe_bl>; + + port { + endpoint { + remote-endpoint = <&dsi_out>; + }; + }; + }; + }; +... -- 2.55.0.windows.5 ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 1/6] dt-bindings: display: add VIEWE JD9365TX panel binding 2026-11-25 2:11 ` [PATCH v3 1/6] dt-bindings: display: add VIEWE JD9365TX panel binding Hefei @ 2026-11-25 7:13 ` Krzysztof Kozlowski 2026-11-25 10:22 ` Hefei 0 siblings, 1 reply; 12+ messages in thread From: Krzysztof Kozlowski @ 2026-11-25 7:13 UTC (permalink / raw) To: Hefei Cc: dri-devel, linux-input, devicetree, linux-kernel, robh, conor, Krzysztof Kozlowski On 2026-11-25 10:11 +0800, Hefei wrote: > Signed-off-by: Hefei <3066883572@qq.com> > --- > .../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... > diff --git a/Documentation/devicetree/bindings/display/panel/viewe,jd9365tx.yaml b/Documentation/devicetree/bindings/display/panel/viewe,jd9365tx.yaml > new file mode 100644 > index 0000000..1043f93 > --- /dev/null > +++ b/Documentation/devicetree/bindings/display/panel/viewe,jd9365tx.yaml Best regards, Krzysztof -- Krzysztof Kozlowski <krzk@kernel.org> ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 1/6] dt-bindings: display: add VIEWE JD9365TX panel binding 2026-11-25 7:13 ` Krzysztof Kozlowski @ 2026-11-25 10:22 ` Hefei 0 siblings, 0 replies; 12+ messages in thread From: Hefei @ 2026-11-25 10:22 UTC (permalink / raw) To: Krzysztof Kozlowski Cc: dri-devel, linux-input, devicetree, linux-kernel, robh, conor+dt Hi Krzysztof, Thanks for the feedback. I ran checkpatch and checkpatch --strict and addressed the reported issues. Please see PATCH v6 of this series (Message-ID: <20261125102130.256-1-3066883572@qq.com>). Sorry for the noise on the earlier revisions. Best regards, Hefei ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v3 2/6] dt-bindings: input: add Jadard JD9365TX touchscreen binding [not found] <20261125021127.1430-1-3066883572@qq.com> 2026-11-25 2:11 ` [PATCH v3 1/6] dt-bindings: display: add VIEWE JD9365TX panel binding Hefei @ 2026-11-25 2:11 ` Hefei 2026-11-25 7:14 ` Krzysztof Kozlowski 2026-11-25 2:11 ` [PATCH v3 3/6] dt-bindings: backlight: add VIEWE I2C backlight binding Hefei ` (3 subsequent siblings) 5 siblings, 1 reply; 12+ messages in thread From: Hefei @ 2026-11-25 2:11 UTC (permalink / raw) To: dri-devel; +Cc: linux-input, devicetree, linux-kernel, robh, conor, Hefei Signed-off-by: Hefei <3066883572@qq.com> --- .../input/touchscreen/jadard,jd9365tx.yaml | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/touchscreen/jadard,jd9365tx.yaml diff --git a/Documentation/devicetree/bindings/input/touchscreen/jadard,jd9365tx.yaml b/Documentation/devicetree/bindings/input/touchscreen/jadard,jd9365tx.yaml new file mode 100644 index 0000000..aaf2a7e --- /dev/null +++ b/Documentation/devicetree/bindings/input/touchscreen/jadard,jd9365tx.yaml @@ -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 <3066883572@qq.com> + +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 = <®_vdd>; + iovcc-supply = <®_iovcc>; + touchscreen-size-x = <720>; + touchscreen-size-y = <1280>; + poll-interval = <16>; + }; + }; +... -- 2.55.0.windows.5 ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 2/6] dt-bindings: input: add Jadard JD9365TX touchscreen binding 2026-11-25 2:11 ` [PATCH v3 2/6] dt-bindings: input: add Jadard JD9365TX touchscreen binding Hefei @ 2026-11-25 7:14 ` Krzysztof Kozlowski 0 siblings, 0 replies; 12+ messages in thread From: Krzysztof Kozlowski @ 2026-11-25 7:14 UTC (permalink / raw) To: Hefei Cc: dri-devel, linux-input, devicetree, linux-kernel, robh, conor, Krzysztof Kozlowski On 2026-11-25 10:11 +0800, Hefei wrote: > Signed-off-by: Hefei <3066883572@qq.com> > --- > .../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 -- Krzysztof Kozlowski <krzk@kernel.org> ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v3 3/6] dt-bindings: backlight: add VIEWE I2C backlight binding [not found] <20261125021127.1430-1-3066883572@qq.com> 2026-11-25 2:11 ` [PATCH v3 1/6] dt-bindings: display: add VIEWE JD9365TX panel binding Hefei 2026-11-25 2:11 ` [PATCH v3 2/6] dt-bindings: input: add Jadard JD9365TX touchscreen binding Hefei @ 2026-11-25 2:11 ` Hefei 2026-11-25 2:11 ` [PATCH v3 4/6] drm/panel: add VIEWE JD9365TX 7 inch DSI panel Hefei ` (2 subsequent siblings) 5 siblings, 0 replies; 12+ messages in thread From: Hefei @ 2026-11-25 2:11 UTC (permalink / raw) To: dri-devel; +Cc: linux-input, devicetree, linux-kernel, robh, conor, Hefei Signed-off-by: Hefei <3066883572@qq.com> --- .../leds/backlight/viewe,i2c-backlight.yaml | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/backlight/viewe,i2c-backlight.yaml diff --git a/Documentation/devicetree/bindings/leds/backlight/viewe,i2c-backlight.yaml b/Documentation/devicetree/bindings/leds/backlight/viewe,i2c-backlight.yaml new file mode 100644 index 0000000..9be4bc9 --- /dev/null +++ b/Documentation/devicetree/bindings/leds/backlight/viewe,i2c-backlight.yaml @@ -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 <3066883572@qq.com> + +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>; + }; + }; +... -- 2.55.0.windows.5 ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v3 4/6] drm/panel: add VIEWE JD9365TX 7 inch DSI panel [not found] <20261125021127.1430-1-3066883572@qq.com> ` (2 preceding siblings ...) 2026-11-25 2:11 ` [PATCH v3 3/6] dt-bindings: backlight: add VIEWE I2C backlight binding Hefei @ 2026-11-25 2:11 ` Hefei 2026-11-25 14:06 ` kernel test robot 2026-11-25 16:03 ` kernel test robot 2026-11-25 2:11 ` [PATCH v3 5/6] Input: add Jadard JD9365TX in-cell touchscreen driver Hefei 2026-11-25 2:11 ` [PATCH v3 6/6] backlight: add VIEWE I2C backlight driver Hefei 5 siblings, 2 replies; 12+ messages in thread From: Hefei @ 2026-11-25 2:11 UTC (permalink / raw) To: dri-devel; +Cc: linux-input, devicetree, linux-kernel, robh, conor, Hefei Signed-off-by: Hefei <3066883572@qq.com> --- 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 diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index 3100640..ad1eee3 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -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 diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile index 75f6bf2..2933489 100644 --- a/drivers/gpu/drm/panel/Makefile +++ b/drivers/gpu/drm/panel/Makefile @@ -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 diff --git a/drivers/gpu/drm/panel/panel-viewe-jd9365tx.c b/drivers/gpu/drm/panel/panel-viewe-jd9365tx.c new file mode 100644 index 0000000..b511dd6 --- /dev/null +++ b/drivers/gpu/drm/panel/panel-viewe-jd9365tx.c @@ -0,0 +1,353 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2026 VIEWE + * + * DRM panel driver for VIEWE 7" 720x1280 Jadard JD9365TX (module 7KF82). + * 2-lane MIPI-DSI video mode. Optional reset-gpios; many FPCs use POR only. + */ + +#include <linux/delay.h> +#include <linux/gpio/consumer.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/regulator/consumer.h> + +#include <video/mipi_display.h> + +#include <drm/drm_mipi_dsi.h> +#include <drm/drm_modes.h> +#include <drm/drm_panel.h> + +#define JD9365TX_DISPOFF_DELAY_MS 80 +#define JD9365TX_SLPIN_DELAY_MS 200 +#define JD9365TX_DISPON_DELAY_MS 20 + +struct jd9365tx_panel { + struct drm_panel panel; + struct mipi_dsi_device *dsi; + struct gpio_desc *reset; + struct regulator *vdd; + struct regulator *iovcc; + enum drm_panel_orientation orientation; +}; + +struct jd9365tx_cmd { + u8 len; + u8 data[64]; + u16 delay_ms; +}; + +#define JD_CMD(...) { \ + .len = sizeof((u8[]){ __VA_ARGS__ }), \ + .data = { __VA_ARGS__ }, \ + .delay_ms = 0, \ +} + +#define JD_CMD_DELAY(ms, ...) { \ + .len = sizeof((u8[]){ __VA_ARGS__ }), \ + .data = { __VA_ARGS__ }, \ + .delay_ms = (ms), \ +} + +static const struct jd9365tx_cmd jd9365tx_7kf82_init[] = { + JD_CMD(0xDF, 0x90, 0x84, 0x14), + JD_CMD(0xDE, 0x00), + JD_CMD(0xBB, 0x46, 0x55, 0xB5, 0x22, 0x22, 0x55), + JD_CMD(0xDE, 0x02), + JD_CMD(0xB7, 0x16, 0x00, 0x6E, 0x44, 0x77), + JD_CMD(0xDE, 0x00), + JD_CMD(0xB3, 0x00, 0x01, 0x50, 0x50, 0x3C, 0x3C, 0xA0, 0x00, 0x20, 0xB6), + JD_CMD(0xBC, 0x0C, 0x28, 0x88), + JD_CMD(0xBD, 0x00, 0x5C, 0x56), + JD_CMD(0xBF, 0x10, 0x35, 0xC3), + JD_CMD(0xC0, 0xBD, 0xBD), + JD_CMD(0xC3, 0x03, 0x09, 0x00, 0x04, 0x2B, 0xE2), + JD_CMD(0xC4, 0x05, 0xE3, 0x0D, 0xD1, 0x05, 0x2C, 0x06, 0x51, 0x06, 0x51, 0x06, 0x51, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0), + JD_CMD(0xC5, 0x01, 0x00, 0x8C, 0x00, 0x5E, 0x01, 0x7D, 0x09, 0x60, 0x02, 0xD0, 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0E, 0x01, 0x92, 0x02, 0x00, 0x02, 0xB0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00), + JD_CMD(0xC6, 0x00, 0xE4, 0x00, 0xC8, 0x00, 0x1D, 0x28, 0x82, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01), + JD_CMD(0xC8, 0x20, 0x80, 0xB4), + JD_CMD(0xCB, 0x7C, 0x66, 0x57, 0x42, 0x32, 0x2A, 0x1B, 0x1F, 0x0A, 0x26, 0x27, 0x25, 0x44, 0x32, 0x41, 0x35, 0x35, 0x2B, 0x1E, 0x14, 0x06, 0x7C, 0x66, 0x57, 0x42, 0x32, 0x2A, 0x1B, 0x1F, 0x0A, 0x26, 0x27, 0x2D, 0x4C, 0x3A, 0x41, 0x35, 0x35, 0x2B, 0x1E, 0x14, 0x06), + /* 2-lane: 0x31, 4-lane: 0x33 */ + JD_CMD(0xCC, 0x31), + JD_CMD(0xCD, 0x23, 0x0E, 0x23, 0x0E, 0x23, 0x0E, 0x23, 0x0E, 0x23, 0x23, 0x22, 0x22), + JD_CMD(0xCE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA), + JD_CMD(0xCF, 0x40, 0x00, 0x00, 0x3F, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xFF, 0xFF, 0x00, 0x00, 0x00), + JD_CMD(0xD0, 0x00, 0x3F, 0x3F, 0x64, 0x64, 0x3F, 0x3F, 0x3E, 0x3E, 0x2A, 0x2B, 0x3F, 0x3F, 0x1F, 0x1D, 0x1B, 0x19, 0x17, 0x15, 0x13, 0x11, 0x01, 0x03), + JD_CMD(0xD1, 0x00, 0x3F, 0x3F, 0x64, 0x64, 0x3F, 0x3F, 0x3E, 0x3E, 0x2A, 0x2B, 0x3F, 0x3F, 0x1E, 0x1C, 0x1A, 0x18, 0x16, 0x14, 0x12, 0x10, 0x00, 0x02), + JD_CMD(0xD2, 0x00, 0x3F, 0x3F, 0x24, 0x24, 0x3F, 0x3F, 0x3E, 0x3E, 0x2A, 0x2B, 0x3F, 0x3F, 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E, 0x02, 0x00), + JD_CMD(0xD3, 0x00, 0xBF, 0xBF, 0xA4, 0xA4, 0xBF, 0x3F, 0x3E, 0x3E, 0x2A, 0x2B, 0x3F, 0x3F, 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F, 0x03, 0x01), + JD_CMD(0xD4, 0x00, 0x60, 0x0C, 0x01, 0x03, 0x20, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x05, 0x1D, 0x01, 0x23, 0x45, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x05, 0x20, 0x05, 0x22, 0x01, 0x03, 0x80, 0x0A, 0x00, 0x0A, 0x05, 0x24, 0x05, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x20, 0x00), + JD_CMD(0xD5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x0A, 0x78, 0x00, 0x00, 0x05, 0xE6, 0xF7, 0xA0, 0x0F, 0x08, 0x08, 0x10, 0x00, 0x2F, 0x04), + JD_CMD(0xD7, 0x00, 0x09, 0x7D, 0x09, 0x7D, 0x09, 0x7D, 0x09, 0x7D, 0x09, 0x7D, 0x09, 0x7D, 0x09, 0x7D), + JD_CMD(0xDE, 0x01), + JD_CMD(0xC7, 0x14, 0x14, 0x04, 0x04, 0x47), + JD_CMD(0xCD, 0x30, 0x53), + JD_CMD(0xCE, 0x09, 0x00, 0xE0, 0x00, 0xE0), + JD_CMD(0xDE, 0x02), + JD_CMD(0xB3, 0x4A, 0xA3, 0xE2, 0x2F, 0x43), + JD_CMD(0xB4, 0x7F), + JD_CMD(0xBB, 0x00, 0x7D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x40, 0x43, 0x04), + JD_CMD(0xBD, 0x1B), + JD_CMD(0xBF, 0x0F, 0x03), + JD_CMD(0xC1, 0x50, 0x40, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00), + JD_CMD(0xC2, 0x02, 0x42, 0x50, 0x00, 0x02, 0xE0, 0x31), + JD_CMD(0xC3, 0x20, 0xFF), + JD_CMD(0xC4, 0x00, 0x11, 0x07, 0x00, 0x0E, 0x01, 0x08), + JD_CMD(0xC6, 0x4A, 0x00), + JD_CMD(0xE5, 0x00, 0x70, 0x70, 0x19, 0xC8, 0x09, 0x00, 0x42, 0x01, 0x30, 0x05, 0x00, 0x00, 0x05, 0x07), + JD_CMD(0xE6, 0x10, 0x0F, 0x88, 0x00, 0x00), + JD_CMD(0xE9, 0x10, 0xA0, 0xA0), + JD_CMD(0xEC, 0x10, 0x77, 0x0D), + JD_CMD(0xDE, 0x03), + JD_CMD(0xD1, 0x00, 0x00, 0x39, 0xFF, 0x08), + JD_CMD(0xED, 0x00), + JD_CMD(0xDE, 0x00), + /* TEAR_ON; Sleep Out / Display On follow in prepare() */ + JD_CMD_DELAY(30, 0x35), +}; + +static inline struct jd9365tx_panel *to_jd9365tx(struct drm_panel *panel) +{ + return container_of(panel, struct jd9365tx_panel, panel); +} + +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; +} + +static void jd9365tx_panel_reset(struct jd9365tx_panel *ctx) +{ + if (!ctx->reset) + return; + + gpiod_set_value_cansleep(ctx->reset, 1); + msleep(20); + gpiod_set_value_cansleep(ctx->reset, 0); + msleep(20); +} + +static int jd9365tx_prepare(struct drm_panel *panel) +{ + struct jd9365tx_panel *ctx = to_jd9365tx(panel); + struct mipi_dsi_device *dsi = ctx->dsi; + struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi }; + int ret; + + ret = regulator_enable(ctx->iovcc); + if (ret) + return ret; + + ret = regulator_enable(ctx->vdd); + if (ret) { + regulator_disable(ctx->iovcc); + return ret; + } + + msleep(150); + + jd9365tx_panel_reset(ctx); + + ret = jd9365tx_send_cmds(dsi, jd9365tx_7kf82_init, + ARRAY_SIZE(jd9365tx_7kf82_init)); + if (ret) + goto err_power; + + mipi_dsi_dcs_exit_sleep_mode_multi(&dsi_ctx); + mipi_dsi_msleep(&dsi_ctx, 120); + mipi_dsi_dcs_set_display_on_multi(&dsi_ctx); + mipi_dsi_msleep(&dsi_ctx, JD9365TX_DISPON_DELAY_MS); + if (dsi_ctx.accum_err) + goto err_power; + + return 0; + +err_power: + gpiod_set_value_cansleep(ctx->reset, 1); + regulator_disable(ctx->vdd); + regulator_disable(ctx->iovcc); + return ret ? ret : dsi_ctx.accum_err; +} + +static int jd9365tx_disable(struct drm_panel *panel) +{ + struct jd9365tx_panel *ctx = to_jd9365tx(panel); + struct mipi_dsi_multi_context dsi_ctx = { .dsi = ctx->dsi }; + + mipi_dsi_dcs_set_display_off_multi(&dsi_ctx); + mipi_dsi_msleep(&dsi_ctx, JD9365TX_DISPOFF_DELAY_MS); + return 0; +} + +static int jd9365tx_unprepare(struct drm_panel *panel) +{ + struct jd9365tx_panel *ctx = to_jd9365tx(panel); + struct mipi_dsi_multi_context dsi_ctx = { .dsi = ctx->dsi }; + + mipi_dsi_dcs_enter_sleep_mode_multi(&dsi_ctx); + mipi_dsi_msleep(&dsi_ctx, JD9365TX_SLPIN_DELAY_MS); + + if (ctx->reset) { + gpiod_set_value_cansleep(ctx->reset, 1); + msleep(20); + } + + regulator_disable(ctx->vdd); + regulator_disable(ctx->iovcc); + msleep(20); + + return 0; +} + +/* 800 * 1510 * 50 / 1000 = 60400 */ +static const struct drm_display_mode jd9365tx_7kf82_mode = { + .clock = 60400, + .hdisplay = 720, + .hsync_start = 720 + 20, + .hsync_end = 720 + 20 + 20, + .htotal = 720 + 20 + 20 + 40, + .vdisplay = 1280, + .vsync_start = 1280 + 200, + .vsync_end = 1280 + 200 + 2, + .vtotal = 1280 + 200 + 2 + 28, + .width_mm = 87, + .height_mm = 155, + .type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED, +}; + +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; + + 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; +} + +static enum drm_panel_orientation +jd9365tx_get_orientation(struct drm_panel *panel) +{ + struct jd9365tx_panel *ctx = to_jd9365tx(panel); + + return ctx->orientation; +} + +static const struct drm_panel_funcs jd9365tx_funcs = { + .prepare = jd9365tx_prepare, + .disable = jd9365tx_disable, + .unprepare = jd9365tx_unprepare, + .get_modes = jd9365tx_get_modes, + .get_orientation = jd9365tx_get_orientation, +}; + +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"); + 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; + + drm_panel_init(&ctx->panel, dev, &jd9365tx_funcs, DRM_MODE_CONNECTOR_DSI); + ctx->panel.prepare_prev_first = true; + + ret = drm_panel_of_backlight(&ctx->panel); + if (ret) + return ret; + + drm_panel_add(&ctx->panel); + + ret = mipi_dsi_attach(dsi); + if (ret < 0) { + drm_panel_remove(&ctx->panel); + return ret; + } + + return 0; +} + +static void jd9365tx_remove(struct mipi_dsi_device *dsi) +{ + struct jd9365tx_panel *ctx = mipi_dsi_get_drvdata(dsi); + + mipi_dsi_detach(dsi); + drm_panel_remove(&ctx->panel); +} + +static const struct of_device_id jd9365tx_of_match[] = { + { .compatible = "viewe,7kf82" }, + { .compatible = "jadard,jd9365tx-7kf82" }, + { } +}; +MODULE_DEVICE_TABLE(of, jd9365tx_of_match); + +static struct mipi_dsi_driver jd9365tx_driver = { + .probe = jd9365tx_probe, + .remove = jd9365tx_remove, + .driver = { + .name = "panel-viewe-jd9365tx", + .of_match_table = jd9365tx_of_match, + }, +}; +module_mipi_dsi_driver(jd9365tx_driver); + +MODULE_AUTHOR("Hefei <3066883572@qq.com>"); +MODULE_DESCRIPTION("VIEWE 7\" JD9365TX MIPI-DSI panel"); +MODULE_LICENSE("GPL"); -- 2.55.0.windows.5 ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 4/6] drm/panel: add VIEWE JD9365TX 7 inch DSI panel 2026-11-25 2:11 ` [PATCH v3 4/6] drm/panel: add VIEWE JD9365TX 7 inch DSI panel Hefei @ 2026-11-25 14:06 ` kernel test robot 2026-11-25 16:03 ` kernel test robot 1 sibling, 0 replies; 12+ messages in thread From: kernel test robot @ 2026-11-25 14:06 UTC (permalink / raw) To: Hefei, dri-devel Cc: oe-kbuild-all, linux-input, devicetree, linux-kernel, robh, conor, Hefei Hi Hefei, kernel test robot noticed the following build errors: [auto build test ERROR on drm-misc/drm-misc-next] [also build test ERROR on dtor-input/next dtor-input/for-linus lee-backlight/for-backlight-next lee-backlight/for-backlight-fixes linus/master v7.4-rc4 next-20261124] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Hefei/dt-bindings-input-add-Jadard-JD9365TX-touchscreen-binding/20261125-101123 base: https://gitlab.freedesktop.org/drm/misc/kernel.git drm-misc-next patch link: https://lore.kernel.org/r/tencent_3D3EC29E27E9DF37D4C9F1A60F2F2BA3EF07%40qq.com patch subject: [PATCH v3 4/6] drm/panel: add VIEWE JD9365TX 7 inch DSI panel config: nios2-allmodconfig (https://download.01.org/0day-ci/archive/20261125/20261125220244.8Pj15HWb-lkp@intel.com/config) compiler: nios2-linux-gcc (GCC) 11.5.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261125/20261125220244.8Pj15HWb-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/20261125220244.8Pj15HWb-lkp@intel.com/ All errors (new ones prefixed by >>): drivers/gpu/drm/panel/panel-viewe-jd9365tx.c: In function 'jd9365tx_probe': drivers/gpu/drm/panel/panel-viewe-jd9365tx.c:304:15: error: implicit declaration of function 'of_drm_get_panel_orientation' [-Werror=implicit-function-declaration] 304 | ret = of_drm_get_panel_orientation(dev->of_node, &ctx->orientation); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> drivers/gpu/drm/panel/panel-viewe-jd9365tx.c:308:9: error: implicit declaration of function 'drm_panel_init'; did you mean 'drm_panel_put'? [-Werror=implicit-function-declaration] 308 | drm_panel_init(&ctx->panel, dev, &jd9365tx_funcs, DRM_MODE_CONNECTOR_DSI); | ^~~~~~~~~~~~~~ | drm_panel_put cc1: some warnings being treated as errors vim +308 drivers/gpu/drm/panel/panel-viewe-jd9365tx.c 273 274 static int jd9365tx_probe(struct mipi_dsi_device *dsi) 275 { 276 struct device *dev = &dsi->dev; 277 struct jd9365tx_panel *ctx; 278 int ret; 279 280 ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); 281 if (!ctx) 282 return -ENOMEM; 283 284 ctx->dsi = dsi; 285 mipi_dsi_set_drvdata(dsi, ctx); 286 287 dsi->lanes = 2; 288 dsi->format = MIPI_DSI_FMT_RGB888; 289 dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | 290 MIPI_DSI_MODE_LPM; 291 292 ctx->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); 293 if (IS_ERR(ctx->reset)) 294 return PTR_ERR(ctx->reset); 295 296 ctx->vdd = devm_regulator_get(dev, "vdd"); 297 if (IS_ERR(ctx->vdd)) 298 return PTR_ERR(ctx->vdd); 299 300 ctx->iovcc = devm_regulator_get(dev, "iovcc"); 301 if (IS_ERR(ctx->iovcc)) 302 return PTR_ERR(ctx->iovcc); 303 304 ret = of_drm_get_panel_orientation(dev->of_node, &ctx->orientation); 305 if (ret) 306 return ret; 307 > 308 drm_panel_init(&ctx->panel, dev, &jd9365tx_funcs, DRM_MODE_CONNECTOR_DSI); 309 ctx->panel.prepare_prev_first = true; 310 311 ret = drm_panel_of_backlight(&ctx->panel); 312 if (ret) 313 return ret; 314 315 drm_panel_add(&ctx->panel); 316 317 ret = mipi_dsi_attach(dsi); 318 if (ret < 0) { 319 drm_panel_remove(&ctx->panel); 320 return ret; 321 } 322 323 return 0; 324 } 325 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 4/6] drm/panel: add VIEWE JD9365TX 7 inch DSI panel 2026-11-25 2:11 ` [PATCH v3 4/6] drm/panel: add VIEWE JD9365TX 7 inch DSI panel Hefei 2026-11-25 14:06 ` kernel test robot @ 2026-11-25 16:03 ` kernel test robot 1 sibling, 0 replies; 12+ messages in thread From: kernel test robot @ 2026-11-25 16:03 UTC (permalink / raw) To: Hefei, dri-devel Cc: llvm, oe-kbuild-all, linux-input, devicetree, linux-kernel, robh, conor, Hefei Hi Hefei, kernel test robot noticed the following build errors: [auto build test ERROR on drm-misc/drm-misc-next] [also build test ERROR on dtor-input/next dtor-input/for-linus lee-backlight/for-backlight-next lee-backlight/for-backlight-fixes linus/master v7.4-rc4 next-20261124] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Hefei/dt-bindings-input-add-Jadard-JD9365TX-touchscreen-binding/20261125-101123 base: https://gitlab.freedesktop.org/drm/misc/kernel.git drm-misc-next patch link: https://lore.kernel.org/r/tencent_3D3EC29E27E9DF37D4C9F1A60F2F2BA3EF07%40qq.com patch subject: [PATCH v3 4/6] drm/panel: add VIEWE JD9365TX 7 inch DSI panel config: hexagon-allmodconfig (https://download.01.org/0day-ci/archive/20261125/20261125235231.H9Nhpv9l-lkp@intel.com/config) compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project 2012344e5da8e03ea4b8283ecd6fad6e13f09d64) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261125/20261125235231.H9Nhpv9l-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/20261125235231.H9Nhpv9l-lkp@intel.com/ All errors (new ones prefixed by >>): drivers/gpu/drm/panel/panel-viewe-jd9365tx.c:304:8: error: call to undeclared function 'of_drm_get_panel_orientation'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 304 | ret = of_drm_get_panel_orientation(dev->of_node, &ctx->orientation); | ^ >> drivers/gpu/drm/panel/panel-viewe-jd9365tx.c:308:2: error: call to undeclared function 'drm_panel_init'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 308 | drm_panel_init(&ctx->panel, dev, &jd9365tx_funcs, DRM_MODE_CONNECTOR_DSI); | ^ 2 errors generated. vim +/drm_panel_init +308 drivers/gpu/drm/panel/panel-viewe-jd9365tx.c 273 274 static int jd9365tx_probe(struct mipi_dsi_device *dsi) 275 { 276 struct device *dev = &dsi->dev; 277 struct jd9365tx_panel *ctx; 278 int ret; 279 280 ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); 281 if (!ctx) 282 return -ENOMEM; 283 284 ctx->dsi = dsi; 285 mipi_dsi_set_drvdata(dsi, ctx); 286 287 dsi->lanes = 2; 288 dsi->format = MIPI_DSI_FMT_RGB888; 289 dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | 290 MIPI_DSI_MODE_LPM; 291 292 ctx->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); 293 if (IS_ERR(ctx->reset)) 294 return PTR_ERR(ctx->reset); 295 296 ctx->vdd = devm_regulator_get(dev, "vdd"); 297 if (IS_ERR(ctx->vdd)) 298 return PTR_ERR(ctx->vdd); 299 300 ctx->iovcc = devm_regulator_get(dev, "iovcc"); 301 if (IS_ERR(ctx->iovcc)) 302 return PTR_ERR(ctx->iovcc); 303 304 ret = of_drm_get_panel_orientation(dev->of_node, &ctx->orientation); 305 if (ret) 306 return ret; 307 > 308 drm_panel_init(&ctx->panel, dev, &jd9365tx_funcs, DRM_MODE_CONNECTOR_DSI); 309 ctx->panel.prepare_prev_first = true; 310 311 ret = drm_panel_of_backlight(&ctx->panel); 312 if (ret) 313 return ret; 314 315 drm_panel_add(&ctx->panel); 316 317 ret = mipi_dsi_attach(dsi); 318 if (ret < 0) { 319 drm_panel_remove(&ctx->panel); 320 return ret; 321 } 322 323 return 0; 324 } 325 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v3 5/6] Input: add Jadard JD9365TX in-cell touchscreen driver [not found] <20261125021127.1430-1-3066883572@qq.com> ` (3 preceding siblings ...) 2026-11-25 2:11 ` [PATCH v3 4/6] drm/panel: add VIEWE JD9365TX 7 inch DSI panel Hefei @ 2026-11-25 2:11 ` Hefei 2026-11-25 2:32 ` Dmitry Torokhov 2026-11-25 2:11 ` [PATCH v3 6/6] backlight: add VIEWE I2C backlight driver Hefei 5 siblings, 1 reply; 12+ messages in thread From: Hefei @ 2026-11-25 2:11 UTC (permalink / raw) To: dri-devel; +Cc: linux-input, devicetree, linux-kernel, robh, conor, Hefei Signed-off-by: Hefei <3066883572@qq.com> --- 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 diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index e2ee722..da425c8 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -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 diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index 58094f2..5846f4d 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile @@ -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 diff --git a/drivers/input/touchscreen/jadard_jd9365tx.c b/drivers/input/touchscreen/jadard_jd9365tx.c new file mode 100644 index 0000000..2030157 --- /dev/null +++ b/drivers/input/touchscreen/jadard_jd9365tx.c @@ -0,0 +1,373 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2026 VIEWE + * + * Jadard JD9365TX in-cell touchscreen (I2C @0x68, polling). + * Typical DSI FPC has no interrupt line. + */ + +#include <linux/delay.h> +#include <linux/i2c.h> +#include <linux/input.h> +#include <linux/input/mt.h> +#include <linux/input/touchscreen.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/property.h> +#include <linux/regulator/consumer.h> +#include <linux/slab.h> + +#define JD_CHIP_ID 0x9084 +#define JD_CHIP_ID_ALT 0x9032 +#define JD_SOC_CHIP_ID2 0x40008076 +#define JD_ERAM_BASE 0x20011000 +#define JD_SECTION_READY_VAL 0xA55A +#define JD_MAX_DSRAM_NUM 25 +#define JD_ESRAM_COORD_IDX 1 +#define JD_ESRAM_SECTION_NUM 6 +#define JD_DEFAULT_COORD_ADDR 0x20011120 +#define JD_TOUCH_DATA_SIZE 78 +#define JD_FINGER_DATA_SIZE 5 +#define JD_FINGER_NUM_ADDR 0 +#define JD_TOUCH_COORD_INFO_ADDR 3 +#define JD_MAX_POINTS 10 +#define JD_DEFAULT_POLL_MS 16 + +struct jadard_tp { + struct i2c_client *client; + struct input_dev *input; + struct touchscreen_properties prop; + struct regulator *vdd; + struct regulator *iovcc; + u32 coord_addr; + u16 touch_data_size; + u16 max_points; + u16 abs_x_max; + u16 abs_y_max; + unsigned int poll_interval_ms; + bool ready; +}; + +static int jd_bus_write(struct i2c_client *client, const u8 *cmd, u8 cmd_len, + const u8 *data, u16 data_len) +{ + u8 buf[64]; + struct i2c_msg msg; + int ret; + + if (cmd_len + data_len > sizeof(buf)) + return -EINVAL; + + memcpy(buf, cmd, cmd_len); + if (data_len) + memcpy(buf + cmd_len, data, data_len); + + msg.addr = client->addr; + msg.flags = 0; + msg.len = cmd_len + data_len; + msg.buf = buf; + + ret = i2c_transfer(client->adapter, &msg, 1); + return ret == 1 ? 0 : (ret < 0 ? ret : -EIO); +} + +static int jd_bus_read(struct i2c_client *client, const u8 *cmd, u8 cmd_len, + u8 *data, u16 data_len) +{ + struct i2c_msg msg[2]; + int ret; + + msg[0].addr = client->addr; + msg[0].flags = 0; + msg[0].len = cmd_len; + msg[0].buf = (u8 *)cmd; + msg[1].addr = client->addr; + msg[1].flags = I2C_M_RD; + msg[1].len = data_len; + msg[1].buf = data; + + ret = i2c_transfer(client->adapter, msg, 2); + return ret == 2 ? 0 : (ret < 0 ? ret : -EIO); +} + +static int jd_enter_backdoor(struct i2c_client *client) +{ + const u8 cmd[5] = { 0xF2, 0xAA, 0xF0, 0x0F, 0x55 }; + const u8 data = 0x68; + + return jd_bus_write(client, cmd, sizeof(cmd), &data, 1); +} + +static int jd_read_reg(struct i2c_client *client, u32 addr, u8 *rdata, u16 rlen) +{ + u8 cmd[6]; + + cmd[0] = 0xF3; + cmd[1] = (addr >> 24) & 0xFF; + cmd[2] = (addr >> 16) & 0xFF; + cmd[3] = (addr >> 8) & 0xFF; + cmd[4] = addr & 0xFF; + cmd[5] = 0x03; + + return jd_bus_read(client, cmd, sizeof(cmd), rdata, rlen); +} + +static int jd_get_chip_id(struct i2c_client *client, u16 *id) +{ + u8 rbuf[2]; + int ret; + + ret = jd_read_reg(client, JD_SOC_CHIP_ID2, rbuf, sizeof(rbuf)); + if (ret) + return ret; + + *id = (u16)((rbuf[1] << 8) | rbuf[0]); + return 0; +} + +static bool jd_section_ready(struct i2c_client *client) +{ + u8 rbuf[2]; + unsigned int waited = 0; + + do { + msleep(2); + if (jd_read_reg(client, JD_ERAM_BASE, rbuf, sizeof(rbuf))) + return false; + waited += 2; + if (((rbuf[1] << 8) | rbuf[0]) == JD_SECTION_READY_VAL) + return true; + } while (waited < 100); + + return false; +} + +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) + 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); + + 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; +} + +static int jd_hw_init(struct jadard_tp *ts) +{ + u16 chip_id = 0; + int ret; + + ret = jd_enter_backdoor(ts->client); + if (ret) + return ret; + + ret = jd_get_chip_id(ts->client, &chip_id); + if (ret) + return ret; + + if (chip_id != JD_CHIP_ID && chip_id != JD_CHIP_ID_ALT) + return -ENODEV; + + if (jd_section_ready(ts->client) && !jd_resolve_coord_addr(ts)) + return 0; + + ts->coord_addr = JD_DEFAULT_COORD_ADDR; + ts->touch_data_size = JD_TOUCH_DATA_SIZE; + + return 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 + + 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; + + 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) { + 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); +} + +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); + + ret = regulator_enable(ts->vdd); + if (ret) + return ret; + + ret = regulator_enable(ts->iovcc); + if (ret) { + regulator_disable(ts->vdd); + return ret; + } + + ret = devm_add_action_or_reset(dev, jadard_tp_disable_regulators, ts); + if (ret) + return ret; + + 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; + + 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; + 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); +} + +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 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, jadard_tp_id); + +static struct i2c_driver jadard_tp_driver = { + .driver = { + .name = "jadard-tp-jd9365tx", + .of_match_table = jadard_tp_of_match, + }, + .probe = jadard_tp_probe, + .id_table = jadard_tp_id, +}; +module_i2c_driver(jadard_tp_driver); + +MODULE_AUTHOR("Hefei <3066883572@qq.com>"); +MODULE_DESCRIPTION("Jadard JD9365TX in-cell touchscreen"); +MODULE_LICENSE("GPL"); -- 2.55.0.windows.5 ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 5/6] Input: add Jadard JD9365TX in-cell touchscreen driver 2026-11-25 2:11 ` [PATCH v3 5/6] Input: add Jadard JD9365TX in-cell touchscreen driver Hefei @ 2026-11-25 2:32 ` Dmitry Torokhov 0 siblings, 0 replies; 12+ messages in thread From: Dmitry Torokhov @ 2026-11-25 2:32 UTC (permalink / raw) To: Hefei; +Cc: dri-devel, linux-input, devicetree, linux-kernel, robh, conor On Wed, Nov 25, 2026 at 10:11:26AM +0800, Hefei wrote: > Signed-off-by: Hefei <3066883572@qq.com> Spare a few words (or maybe even a paragraph) for patch description. Thanks. -- Dmitry ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v3 6/6] backlight: add VIEWE I2C backlight driver [not found] <20261125021127.1430-1-3066883572@qq.com> ` (4 preceding siblings ...) 2026-11-25 2:11 ` [PATCH v3 5/6] Input: add Jadard JD9365TX in-cell touchscreen driver Hefei @ 2026-11-25 2:11 ` Hefei 5 siblings, 0 replies; 12+ messages in thread From: Hefei @ 2026-11-25 2:11 UTC (permalink / raw) To: dri-devel; +Cc: linux-input, devicetree, linux-kernel, robh, conor, Hefei Signed-off-by: Hefei <3066883572@qq.com> --- 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 diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig index 7b836f9..8ea7332 100644 --- a/drivers/video/backlight/Kconfig +++ b/drivers/video/backlight/Kconfig @@ -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 diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile index bcb568a..b82d959 100644 --- a/drivers/video/backlight/Makefile +++ b/drivers/video/backlight/Makefile @@ -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 diff --git a/drivers/video/backlight/viewe_bl_i2c.c b/drivers/video/backlight/viewe_bl_i2c.c new file mode 100644 index 0000000..53dcf08 --- /dev/null +++ b/drivers/video/backlight/viewe_bl_i2c.c @@ -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 = { + .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); +} + +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, + }; + 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); + return 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 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, viewe_bl_id); + +static struct i2c_driver viewe_bl_driver = { + .driver = { + .name = "viewe_bl_i2c", + .of_match_table = viewe_bl_of_match, + }, + .probe = viewe_bl_probe, + .id_table = viewe_bl_id, +}; +module_i2c_driver(viewe_bl_driver); + +MODULE_AUTHOR("Hefei <3066883572@qq.com>"); +MODULE_DESCRIPTION("VIEWE 7KF82 I2C backlight"); +MODULE_LICENSE("GPL"); -- 2.55.0.windows.5 ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2026-11-25 16:18 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20261125021127.1430-1-3066883572@qq.com>
2026-11-25 2:11 ` [PATCH v3 1/6] dt-bindings: display: add VIEWE JD9365TX panel binding Hefei
2026-11-25 7:13 ` Krzysztof Kozlowski
2026-11-25 10:22 ` Hefei
2026-11-25 2:11 ` [PATCH v3 2/6] dt-bindings: input: add Jadard JD9365TX touchscreen binding Hefei
2026-11-25 7:14 ` Krzysztof Kozlowski
2026-11-25 2:11 ` [PATCH v3 3/6] dt-bindings: backlight: add VIEWE I2C backlight binding Hefei
2026-11-25 2:11 ` [PATCH v3 4/6] drm/panel: add VIEWE JD9365TX 7 inch DSI panel Hefei
2026-11-25 14:06 ` kernel test robot
2026-11-25 16:03 ` kernel test robot
2026-11-25 2:11 ` [PATCH v3 5/6] Input: add Jadard JD9365TX in-cell touchscreen driver Hefei
2026-11-25 2:32 ` Dmitry Torokhov
2026-11-25 2:11 ` [PATCH v3 6/6] backlight: add VIEWE I2C backlight driver Hefei
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®