diff --git a/Documentation/devicetree/bindings/arm/qcom.yaml b/Documentation/devicetree/bindings/arm/qcom.yaml index a82c342ce9a79d..5ced2989f0a721 100644 --- a/Documentation/devicetree/bindings/arm/qcom.yaml +++ b/Documentation/devicetree/bindings/arm/qcom.yaml @@ -819,6 +819,7 @@ properties: - xiaomi,whyred - motorola,beckham - bbry,luna-boe + - bbry,luna-syna - const: qcom,sdm636 - items: @@ -832,6 +833,7 @@ properties: - xiaomi,lavender-tianma - xiaomi,platina - bbry,athena-boe + - bbry,athena-syna - const: qcom,sdm660 - items: diff --git a/Documentation/devicetree/bindings/display/panel/syna,td4310.yaml b/Documentation/devicetree/bindings/display/panel/syna,td4310.yaml new file mode 100644 index 00000000000000..52af91dce328de --- /dev/null +++ b/Documentation/devicetree/bindings/display/panel/syna,td4310.yaml @@ -0,0 +1,60 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/panel/syna,td4310.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Synaptics TD4310 DSI Display Panel + +maintainers: + - Paul Sajna + +allOf: + - $ref: panel-common.yaml# + +properties: + compatible: + enum: + - syna,td4310 + + reg: + maxItems: 1 + + reset-gpios: + description: specifies a GPIO used for the rest pin + + backlight: + description: phandle of the backlight device attached to the panel + + port: true + width-mm: true + height-mm: true + +required: + - compatible + - reg + - reset-gpios + +unevaluatedProperties: false + +examples: + - | + #include + dsi { + #address-cells = <1>; + #size-cells = <0>; + panel@0 { + compatible = "syna,td4310"; + reg = <0>; + reset-gpios = <&tlmm 53 GPIO_ACTIVE_LOW>; + backlight = <&pm660l_wled>; + width-mm = <63>; + height-mm = <95>; + + port { + panel_in: endpoint { + remote-endpoint = <&mdss_dsi0_out>; + }; + }; + }; + }; diff --git a/arch/arm64/boot/dts/qcom/Makefile b/arch/arm64/boot/dts/qcom/Makefile index a34dc753cd3596..7e632183fa83e0 100644 --- a/arch/arm64/boot/dts/qcom/Makefile +++ b/arch/arm64/boot/dts/qcom/Makefile @@ -241,11 +241,13 @@ dtb-$(CONFIG_ARCH_QCOM) += sdm632-fairphone-fp3.dtb dtb-$(CONFIG_ARCH_QCOM) += sdm632-motorola-ocean.dtb dtb-$(CONFIG_ARCH_QCOM) += sdm636-asus-x00td.dtb dtb-$(CONFIG_ARCH_QCOM) += sdm636-bbry-luna-boe.dtb +dtb-$(CONFIG_ARCH_QCOM) += sdm636-bbry-luna-syna.dtb dtb-$(CONFIG_ARCH_QCOM) += sdm636-motorola-beckham.dtb dtb-$(CONFIG_ARCH_QCOM) += sdm636-sony-xperia-ganges-mermaid.dtb dtb-$(CONFIG_ARCH_QCOM) += sdm636-xiaomi-tulip.dtb dtb-$(CONFIG_ARCH_QCOM) += sdm636-xiaomi-whyred.dtb dtb-$(CONFIG_ARCH_QCOM) += sdm660-bbry-athena-boe.dtb +dtb-$(CONFIG_ARCH_QCOM) += sdm660-bbry-athena-syna.dtb dtb-$(CONFIG_ARCH_QCOM) += sdm660-xiaomi-clover-lte.dtb dtb-$(CONFIG_ARCH_QCOM) += sdm660-xiaomi-clover-plus.dtb dtb-$(CONFIG_ARCH_QCOM) += sdm660-xiaomi-jasmine.dtb diff --git a/arch/arm64/boot/dts/qcom/sdm636-bbry-luna-boe.dts b/arch/arm64/boot/dts/qcom/sdm636-bbry-luna-boe.dts index 44df0eeca1bccb..077f00e8c64446 100755 --- a/arch/arm64/boot/dts/qcom/sdm636-bbry-luna-boe.dts +++ b/arch/arm64/boot/dts/qcom/sdm636-bbry-luna-boe.dts @@ -14,3 +14,7 @@ &panel { compatible = "boe,bv045fhm-l00"; }; + +&focaltech_touchscreen { + status = "okay"; +}; diff --git a/arch/arm64/boot/dts/qcom/sdm636-bbry-luna-common.dtsi b/arch/arm64/boot/dts/qcom/sdm636-bbry-luna-common.dtsi index 1e1082db393166..5be8096361edb0 100755 --- a/arch/arm64/boot/dts/qcom/sdm636-bbry-luna-common.dtsi +++ b/arch/arm64/boot/dts/qcom/sdm636-bbry-luna-common.dtsi @@ -5,7 +5,6 @@ /* * There are two variants of bbry-luna, one with synaptics panel and one with boe panel. - * Currently only boe panel is supported */ diff --git a/arch/arm64/boot/dts/qcom/sdm636-bbry-luna-syna.dts b/arch/arm64/boot/dts/qcom/sdm636-bbry-luna-syna.dts new file mode 100755 index 00000000000000..ddb66db5408fd8 --- /dev/null +++ b/arch/arm64/boot/dts/qcom/sdm636-bbry-luna-syna.dts @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (c) 2026, Paul Sajna + */ + +/dts-v1/; + +#include "sdm636-bbry-luna-common.dtsi" + +/ { + compatible = "bbry,luna-syna", "qcom,sdm636"; +}; + +&panel { + compatible = "syna,td4310"; +}; + +&synaptics_touchscreen { + status = "okay"; +}; + diff --git a/arch/arm64/boot/dts/qcom/sdm660-bbry-athena-boe.dts b/arch/arm64/boot/dts/qcom/sdm660-bbry-athena-boe.dts index 06c3c5d2c0a6ec..ad2c10cacd2e5d 100755 --- a/arch/arm64/boot/dts/qcom/sdm660-bbry-athena-boe.dts +++ b/arch/arm64/boot/dts/qcom/sdm660-bbry-athena-boe.dts @@ -14,3 +14,7 @@ &panel { compatible = "boe,bv045fhm-l00"; }; + +&focaltech_touchscreen { + status = "okay"; +}; diff --git a/arch/arm64/boot/dts/qcom/sdm660-bbry-athena-common.dtsi b/arch/arm64/boot/dts/qcom/sdm660-bbry-athena-common.dtsi index 2f9930756a7e03..6569ab43f10f4c 100755 --- a/arch/arm64/boot/dts/qcom/sdm660-bbry-athena-common.dtsi +++ b/arch/arm64/boot/dts/qcom/sdm660-bbry-athena-common.dtsi @@ -5,7 +5,6 @@ /* * There are two variants of bbry-athena, one with synaptics panel and one with boe panel. - * Currently only boe panel is supported */ /dts-v1/; diff --git a/arch/arm64/boot/dts/qcom/sdm660-bbry-athena-syna.dts b/arch/arm64/boot/dts/qcom/sdm660-bbry-athena-syna.dts new file mode 100755 index 00000000000000..da7cfab0474dfa --- /dev/null +++ b/arch/arm64/boot/dts/qcom/sdm660-bbry-athena-syna.dts @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (c) 2026, Paul Sajna + */ + +/dts-v1/; + +#include "sdm660-bbry-athena-common.dtsi" + +/ { + compatible = "bbry,athena-syna", "qcom,sdm660"; +}; + +&panel { + compatible = "syna,td4310"; +}; + +&synaptics_touchscreen { + status = "okay"; +}; + diff --git a/arch/arm64/boot/dts/qcom/sdm660-bbry-common.dtsi b/arch/arm64/boot/dts/qcom/sdm660-bbry-common.dtsi index b348ab735a0a3e..39b7bb66364819 100755 --- a/arch/arm64/boot/dts/qcom/sdm660-bbry-common.dtsi +++ b/arch/arm64/boot/dts/qcom/sdm660-bbry-common.dtsi @@ -235,6 +235,8 @@ &blsp_i2c1 { + #address-cells = <1>; + #size-cells = <0>; status = "okay"; stmpe1801: port-expander@40 @@ -309,7 +311,7 @@ status = "okay"; /* Focaltech ft8707 */ - touchscreen@38 { + focaltech_touchscreen: touchscreen@38 { compatible = "focaltech,ft8719"; reg = <0x38>; pinctrl-0 = <&ts_int_active &ts_reset_active>; @@ -323,6 +325,32 @@ touchscreen-size-x = <1080>; touchscreen-size-y = <1620>; wakeup-source; + status = "disabled"; + }; + + synaptics_touchscreen: touchscreen@70 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "syna,rmi4-i2c"; + reg = <0x70>; + pinctrl-0 = <&ts_int_active>; + pinctrl-1 = <&ts_int_sleep>; + pinctrl-names = "default", "sleep"; + interrupts-extended = <&tlmm 67 IRQ_TYPE_EDGE_FALLING>; + syna,reset-delay-ms = <220>; + syna,startup-delay-ms = <600>; + vio-supply = <&vreg_l11a_1p8>; + status = "disabled"; + + rmi4-f01@1 { + reg = <0x01>; + syna,nosleep-mode = <1>; + }; + + rmi4-f11@11 { + reg = <0x11>; + syna,sensor-type = <1>; + }; }; }; @@ -339,10 +367,8 @@ status = "okay"; - panel: panel@0 { reg = <0>; - reset-gpios = <&tlmm 53 GPIO_ACTIVE_LOW>; backlight = <&pm660l_wled>; width-mm = <63>; @@ -513,6 +539,14 @@ regulator-enable-ramp-delay = <250>; regulator-allow-set-load; }; + + vreg_l11a_1p8: l11 { + regulator-min-microvolt = <1780000>; + regulator-max-microvolt = <1950000>; + regulator-enable-ramp-delay = <250>; + regulator-allow-set-load; + }; + }; regulators-1 { diff --git a/arch/arm64/configs/sdm660_defconfig b/arch/arm64/configs/sdm660_defconfig index 283112565b75f5..69c8ea919686fd 100644 --- a/arch/arm64/configs/sdm660_defconfig +++ b/arch/arm64/configs/sdm660_defconfig @@ -467,6 +467,7 @@ CONFIG_DRM_PANEL_NOVATEK_NT36672A=m CONFIG_DRM_PANEL_NOVATEK_NT51021=m CONFIG_DRM_PANEL_SAMSUNG_AMS601NT12=m CONFIG_DRM_PANEL_SIMPLE=y +CONFIG_DRM_PANEL_SYNAPTICS_TD4310=m CONFIG_DRM_PANEL_TIANMA_TD4310=m CONFIG_DRM_PANEL_TRULY_TD4322=m CONFIG_DRM_GUD=m diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index 70db3326655c87..d1b186ce86d511 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -1083,6 +1083,15 @@ config DRM_PANEL_SYNAPTICS_R63353 Say Y if you want to enable support for panels based on the Synaptics R63353 controller. +config DRM_PANEL_SYNAPTICS_TD4310 + tristate "Synaptics TD4310-based panels" + depends on OF + depends on DRM_MIPI_DSI + depends on BACKLIGHT_CLASS_DEVICE + help + Say Y if you want to enable support for panels based on the + Synaptics TD4310 controller. + config DRM_PANEL_TDO_TL070WSH30 tristate "TDO TL070WSH30 DSI panel" depends on OF diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile index be5faef8100508..6a6e729b117524 100644 --- a/drivers/gpu/drm/panel/Makefile +++ b/drivers/gpu/drm/panel/Makefile @@ -105,6 +105,7 @@ obj-$(CONFIG_DRM_PANEL_SITRONIX_ST7703) += panel-sitronix-st7703.o obj-$(CONFIG_DRM_PANEL_SITRONIX_ST7789V) += panel-sitronix-st7789v.o obj-$(CONFIG_DRM_PANEL_SUMMIT) += panel-summit.o obj-$(CONFIG_DRM_PANEL_SYNAPTICS_R63353) += panel-synaptics-r63353.o +obj-$(CONFIG_DRM_PANEL_SYNAPTICS_TD4310) += panel-synaptics-td4310.o obj-$(CONFIG_DRM_PANEL_SONY_ACX565AKM) += panel-sony-acx565akm.o obj-$(CONFIG_DRM_PANEL_SONY_TD4353_JDI) += panel-sony-td4353-jdi.o obj-$(CONFIG_DRM_PANEL_SONY_TULIP_TRULY_NT35521) += panel-sony-tulip-truly-nt35521.o diff --git a/drivers/gpu/drm/panel/panel-synaptics-td4310.c b/drivers/gpu/drm/panel/panel-synaptics-td4310.c new file mode 100644 index 00000000000000..f42de87d7fe35b --- /dev/null +++ b/drivers/gpu/drm/panel/panel-synaptics-td4310.c @@ -0,0 +1,201 @@ +// SPDX-License-Identifier: GPL-2.0-only +// Copyright (c) 2026 Paul Sajna +// Generated with linux-mdss-dsi-panel-driver-generator from vendor device tree +// Copyright (c) 2013, The Linux Foundation. All rights reserved. + +#include +#include +#include +#include + +#include +#include +#include +#include + +struct synaptics_td4310 { + struct drm_panel panel; + struct mipi_dsi_device *dsi; + struct gpio_desc *reset_gpio; +}; + +static inline struct synaptics_td4310 *to_synaptics_td4310(struct drm_panel *panel) +{ + return container_of(panel, struct synaptics_td4310, panel); +} + +static void synaptics_td4310_reset(struct synaptics_td4310 *ctx) +{ + gpiod_set_value_cansleep(ctx->reset_gpio, 0); + msleep(20); + gpiod_set_value_cansleep(ctx->reset_gpio, 1); + usleep_range(2000, 3000); + gpiod_set_value_cansleep(ctx->reset_gpio, 0); + msleep(20); +} + +static int synaptics_td4310_on(struct synaptics_td4310 *ctx) +{ + struct mipi_dsi_multi_context dsi_ctx = { .dsi = ctx->dsi }; + + ctx->dsi->mode_flags |= MIPI_DSI_MODE_LPM; + + mipi_dsi_generic_write_seq_multi(&dsi_ctx, 0xb0, 0x00); + mipi_dsi_generic_write_seq_multi(&dsi_ctx, 0xbb, 0x20, 0x00); + mipi_dsi_generic_write_seq_multi(&dsi_ctx, 0xd6, 0x01); + 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, 20); + + return dsi_ctx.accum_err; +} + +static int synaptics_td4310_off(struct synaptics_td4310 *ctx) +{ + struct mipi_dsi_multi_context dsi_ctx = { .dsi = ctx->dsi }; + + ctx->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM; + + mipi_dsi_dcs_set_display_off_multi(&dsi_ctx); + mipi_dsi_msleep(&dsi_ctx, 34); + mipi_dsi_dcs_enter_sleep_mode_multi(&dsi_ctx); + mipi_dsi_msleep(&dsi_ctx, 120); + + return dsi_ctx.accum_err; +} + +static int synaptics_td4310_prepare(struct drm_panel *panel) +{ + struct synaptics_td4310 *ctx = to_synaptics_td4310(panel); + struct device *dev = &ctx->dsi->dev; + int ret; + + synaptics_td4310_reset(ctx); + + ret = synaptics_td4310_on(ctx); + if (ret < 0) { + dev_err(dev, "Failed to initialize panel: %d\n", ret); + gpiod_set_value_cansleep(ctx->reset_gpio, 1); + return ret; + } + + return 0; +} + +static int synaptics_td4310_unprepare(struct drm_panel *panel) +{ + struct synaptics_td4310 *ctx = to_synaptics_td4310(panel); + struct device *dev = &ctx->dsi->dev; + int ret; + + ret = synaptics_td4310_off(ctx); + if (ret < 0) + dev_err(dev, "Failed to un-initialize panel: %d\n", ret); + + gpiod_set_value_cansleep(ctx->reset_gpio, 1); + + return 0; +} + +static const struct drm_display_mode synaptics_td4310_mode = { + .clock = (1080 + 120 + 2 + 40) * (1620 + 8 + 2 + 6) * 60 / 1000, + .hdisplay = 1080, + .hsync_start = 1080 + 120, + .hsync_end = 1080 + 120 + 2, + .htotal = 1080 + 120 + 2 + 40, + .vdisplay = 1620, + .vsync_start = 1620 + 8, + .vsync_end = 1620 + 8 + 2, + .vtotal = 1620 + 8 + 2 + 6, + .width_mm = 63, + .height_mm = 95, + .type = DRM_MODE_TYPE_DRIVER, +}; + +static int synaptics_td4310_get_modes(struct drm_panel *panel, + struct drm_connector *connector) +{ + return drm_connector_helper_get_modes_fixed(connector, &synaptics_td4310_mode); +} + +static const struct drm_panel_funcs synaptics_panel_funcs = { + .prepare = synaptics_td4310_prepare, + .unprepare = synaptics_td4310_unprepare, + .get_modes = synaptics_td4310_get_modes, +}; + +static int synaptics_td4310_probe(struct mipi_dsi_device *dsi) +{ + struct device *dev = &dsi->dev; + struct synaptics_td4310 *ctx; + int ret; + + ctx = devm_drm_panel_alloc(dev, struct synaptics_td4310, panel, + &synaptics_panel_funcs, + DRM_MODE_CONNECTOR_DSI); + if (IS_ERR(ctx)) + return PTR_ERR(ctx); + + ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); + if (IS_ERR(ctx->reset_gpio)) + return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio), + "Failed to get reset-gpios\n"); + + ctx->dsi = dsi; + mipi_dsi_set_drvdata(dsi, ctx); + + dsi->lanes = 4; + dsi->format = MIPI_DSI_FMT_RGB888; + dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | + MIPI_DSI_MODE_VIDEO_HSE | + MIPI_DSI_CLOCK_NON_CONTINUOUS; + + ctx->panel.prepare_prev_first = true; + + ret = drm_panel_of_backlight(&ctx->panel); + if (ret) + return dev_err_probe(dev, ret, "Failed to get backlight\n"); + + drm_panel_add(&ctx->panel); + + ret = mipi_dsi_attach(dsi); + if (ret < 0) { + drm_panel_remove(&ctx->panel); + return dev_err_probe(dev, ret, "Failed to attach to DSI host\n"); + } + + return 0; +} + +static void synaptics_td4310_remove(struct mipi_dsi_device *dsi) +{ + struct synaptics_td4310 *ctx = mipi_dsi_get_drvdata(dsi); + int ret; + + ret = mipi_dsi_detach(dsi); + if (ret < 0) + dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret); + + drm_panel_remove(&ctx->panel); +} + +static const struct of_device_id synaptics_td4310_of_match[] = { + { .compatible = "syna,td4310" }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, synaptics_td4310_of_match); + +static struct mipi_dsi_driver synaptics_td4310_driver = { + .probe = synaptics_td4310_probe, + .remove = synaptics_td4310_remove, + .driver = { + .name = "panel-synaptics-td4310", + .of_match_table = synaptics_td4310_of_match, + }, +}; +module_mipi_dsi_driver(synaptics_td4310_driver); + +MODULE_AUTHOR("Paul Sajna "); +MODULE_DESCRIPTION("DRM driver for Synaptics TD4310 dsi panel"); +MODULE_LICENSE("GPL");