diff --git a/Documentation/devicetree/bindings/display/panel/dlc,dlc0697.yaml b/Documentation/devicetree/bindings/display/panel/ilitek,ili7807s.yaml similarity index 50% rename from Documentation/devicetree/bindings/display/panel/dlc,dlc0697.yaml rename to Documentation/devicetree/bindings/display/panel/ilitek,ili7807s.yaml index 8ae72a8265e61..ba8c5bbf8ffc4 100644 --- a/Documentation/devicetree/bindings/display/panel/dlc,dlc0697.yaml +++ b/Documentation/devicetree/bindings/display/panel/ilitek,ili7807s.yaml @@ -1,10 +1,10 @@ # SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause %YAML 1.2 --- -$id: http://devicetree.org/schemas/display/panel/dlc,dlc0697.yaml# +$id: http://devicetree.org/schemas/display/panel/ilitek,ili7807s.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# -title: DLC DLC0697 1080x1920 video-mode DSI panel +title: Ilitek ILI7807S-based DSI panels maintainers: - Arpit Saini @@ -14,32 +14,36 @@ allOf: properties: compatible: - const: dlc,dlc0697 + items: + - enum: + - dlc,dlc0697 + - const: ilitek,ili7807s reg: maxItems: 1 description: DSI virtual channel - reset-gpios: true - - enable-gpios: true - - vddio-supply: + vddi-supply: description: I/O voltage supply (1.8V) - bias-supply: - description: LCD bias supply (3.3V), typically a GPIO-controlled fixed regulator + avdd-supply: + description: Positive LCD bias supply (AVDD), typically +5.5V + (range 4.5V to 6.3V) - port: true + avee-supply: + description: Negative LCD bias supply (AVEE), typically -5.5V + (range -6.3V to -4.5V) required: - compatible - reg - reset-gpios - - vddio-supply + - vddi-supply + - avdd-supply + - avee-supply - port -additionalProperties: false +unevaluatedProperties: false examples: - | @@ -50,11 +54,13 @@ examples: #size-cells = <0>; panel@0 { - compatible = "dlc,dlc0697"; + compatible = "dlc,dlc0697", "ilitek,ili7807s"; reg = <0>; - reset-gpios = <&tlmm 41 GPIO_ACTIVE_LOW>; - vddio-supply = <&vreg_l15>; + reset-gpios = <&tlmm 3 GPIO_ACTIVE_LOW>; + vddi-supply = <&pm4125_l15>; + avdd-supply = <&avdd>; + avee-supply = <&avee>; port { panel_in: endpoint { @@ -63,4 +69,3 @@ examples: }; }; }; -... diff --git a/MAINTAINERS b/MAINTAINERS index 275c7254ccf2f..7c73a69998d40 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8027,13 +8027,6 @@ S: Maintained F: Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml F: drivers/gpu/drm/bridge/chipone-icn6211.c -DRM DRIVER FOR DLC DLC0697 DSI PANEL -M: Arpit Saini -S: Maintained -T: git https://gitlab.freedesktop.org/drm/misc/kernel.git -F: Documentation/devicetree/bindings/display/panel/dlc,dlc0697.yaml -F: drivers/gpu/drm/panel/panel-dlc0697.c - DRM DRIVER FOR EBBG FT8719 PANEL M: Joel Selvaraj S: Maintained diff --git a/arch/arm64/boot/dts/qcom/shikra-cqm-evk.dts b/arch/arm64/boot/dts/qcom/shikra-cqm-evk.dts index 01464ef826d98..374922f80210b 100644 --- a/arch/arm64/boot/dts/qcom/shikra-cqm-evk.dts +++ b/arch/arm64/boot/dts/qcom/shikra-cqm-evk.dts @@ -28,18 +28,6 @@ stdout-path = "serial0:115200n8"; }; - lcd_bias: regulator-lcd-bias { - compatible = "regulator-fixed"; - regulator-name = "lcd_bias"; - regulator-min-microvolt = <3300000>; - regulator-max-microvolt = <3300000>; - vin-supply = <&pm4125_l17>; - gpio = <&tlmm 151 GPIO_ACTIVE_HIGH>; - enable-active-high; - pinctrl-0 = <&lcd_bias_en>; - pinctrl-names = "default"; - }; - mi2s_tdm_sen: mi2s-tdm-sen-qaif-aif { qcom,qaif-aif-bits-per-lane = <2>; qcom,qaif-aif-ctrl-data-oe = <1>; @@ -151,6 +139,39 @@ }; }; + lcd_bias: regulator-lcd-bias { + compatible = "regulator-fixed"; + regulator-name = "lcd_bias"; + vin-supply = <&vph_pwr>; + gpio = <&tlmm 151 GPIO_ACTIVE_HIGH>; + enable-active-high; + pinctrl-0 = <&lcd_bias_en>; + pinctrl-names = "default"; + }; + + vph_pwr: vph-pwr-regulator { + compatible = "regulator-fixed"; + regulator-name = "vph_pwr"; + regulator-always-on; + regulator-boot-on; + }; + + vreg_disp_n: regulator-vreg-disp-n { + compatible = "regulator-fixed"; + regulator-name = "vreg_disp_n"; + regulator-min-microvolt = <5500000>; + regulator-max-microvolt = <5500000>; + vin-supply = <&lcd_bias>; + }; + + vreg_disp_p: regulator-vreg-disp-p { + compatible = "regulator-fixed"; + regulator-name = "vreg_disp_p"; + regulator-min-microvolt = <5500000>; + regulator-max-microvolt = <5500000>; + vin-supply = <&lcd_bias>; + }; + wcn3988-pmu { compatible = "qcom,wcn3988-pmu"; @@ -338,29 +359,23 @@ status = "okay"; }; -&pm4125_l5 { - /* DSI VDDA - must be at NOM voltage for PHY PLL lock */ - regulator-min-microvolt = <1232000>; - regulator-max-microvolt = <1232000>; - regulator-allow-set-load; -}; - &mdss_dsi0 { vdda-supply = <&pm4125_l5>; + status = "okay"; panel@0 { - compatible = "dlc,dlc0697"; + compatible = "dlc,dlc0697", "ilitek,ili7807s"; reg = <0>; reset-gpios = <&tlmm 3 GPIO_ACTIVE_LOW>; - enable-gpios = <&tlmm 91 GPIO_ACTIVE_HIGH>; - vddio-supply = <&pm4125_l15>; - bias-supply = <&lcd_bias>; + vddi-supply = <&pm4125_l15>; + avdd-supply = <&vreg_disp_p>; + avee-supply = <&vreg_disp_n>; - pinctrl-0 = <&panel_rst_n &panel_te_pin>; - pinctrl-1 = <&panel_rst_n_suspend>; + pinctrl-0 = <&panel_rst_n &panel_te_pin &panel_bl_en>; + pinctrl-1 = <&panel_rst_n_suspend &panel_bl_en_suspend>; pinctrl-names = "default", "sleep"; port { @@ -501,6 +516,13 @@ status = "okay"; }; +&pm4125_l5 { + /* DSI VDDA - must be at NOM voltage for PHY PLL lock */ + regulator-min-microvolt = <1232000>; + regulator-max-microvolt = <1232000>; + regulator-allow-set-load; +}; + &remoteproc_cdsp { firmware-name = "qcom/shikra/cdsp.mbn"; @@ -692,6 +714,22 @@ bias-disable; }; + panel_bl_en: panel-bl-en-state { + pins = "gpio91"; + function = "gpio"; + drive-strength = <2>; + bias-disable; + output-high; + }; + + panel_bl_en_suspend: panel-bl-en-suspend-state { + pins = "gpio91"; + function = "gpio"; + drive-strength = <2>; + bias-pull-down; + output-low; + }; + panel_rst_n: panel-rst-n-state { pins = "gpio3"; function = "gpio"; diff --git a/arch/arm64/boot/dts/qcom/shikra-cqs-evk.dts b/arch/arm64/boot/dts/qcom/shikra-cqs-evk.dts index 5ea41a9f8241e..44b9fdc0c44ed 100644 --- a/arch/arm64/boot/dts/qcom/shikra-cqs-evk.dts +++ b/arch/arm64/boot/dts/qcom/shikra-cqs-evk.dts @@ -84,18 +84,6 @@ }; }; - lcd_bias: regulator-lcd-bias { - compatible = "regulator-fixed"; - regulator-name = "lcd_bias"; - regulator-min-microvolt = <3300000>; - regulator-max-microvolt = <3300000>; - vin-supply = <&pm4125_l17>; - gpio = <&tlmm 151 GPIO_ACTIVE_HIGH>; - enable-active-high; - pinctrl-0 = <&lcd_bias_en>; - pinctrl-names = "default"; - }; - vreg_0p9: regulator-0v9 { compatible = "regulator-fixed"; regulator-name = "VREG_0P9"; @@ -116,6 +104,39 @@ regulator-boot-on; }; + lcd_bias: regulator-lcd-bias { + compatible = "regulator-fixed"; + regulator-name = "lcd_bias"; + vin-supply = <&vph_pwr>; + gpio = <&tlmm 151 GPIO_ACTIVE_HIGH>; + enable-active-high; + pinctrl-0 = <&lcd_bias_en>; + pinctrl-names = "default"; + }; + + vph_pwr: vph-pwr-regulator { + compatible = "regulator-fixed"; + regulator-name = "vph_pwr"; + regulator-always-on; + regulator-boot-on; + }; + + vreg_disp_n: regulator-vreg-disp-n { + compatible = "regulator-fixed"; + regulator-name = "vreg_disp_n"; + regulator-min-microvolt = <5500000>; + regulator-max-microvolt = <5500000>; + vin-supply = <&lcd_bias>; + }; + + vreg_disp_p: regulator-vreg-disp-p { + compatible = "regulator-fixed"; + regulator-name = "vreg_disp_p"; + regulator-min-microvolt = <5500000>; + regulator-max-microvolt = <5500000>; + vin-supply = <&lcd_bias>; + }; + wcn3988-pmu { compatible = "qcom,wcn3988-pmu"; @@ -306,20 +327,21 @@ &mdss_dsi0 { vdda-supply = <&pm4125_l5>; + status = "okay"; panel@0 { - compatible = "dlc,dlc0697"; + compatible = "dlc,dlc0697", "ilitek,ili7807s"; reg = <0>; reset-gpios = <&tlmm 3 GPIO_ACTIVE_LOW>; - enable-gpios = <&tlmm 91 GPIO_ACTIVE_HIGH>; - vddio-supply = <&pm4125_l15>; - bias-supply = <&lcd_bias>; + vddi-supply = <&pm4125_l15>; + avdd-supply = <&vreg_disp_p>; + avee-supply = <&vreg_disp_n>; - pinctrl-0 = <&panel_rst_n &panel_te_pin>; - pinctrl-1 = <&panel_rst_n_suspend>; + pinctrl-0 = <&panel_rst_n &panel_te_pin &panel_bl_en>; + pinctrl-1 = <&panel_rst_n_suspend &panel_bl_en_suspend>; pinctrl-names = "default", "sleep"; port { @@ -451,13 +473,6 @@ remote-endpoint = <&usb_1_dwc3_hs>; }; -&pm4125_l5 { - /* DSI VDDA - must be at NOM voltage for PHY PLL lock */ - regulator-min-microvolt = <1232000>; - regulator-max-microvolt = <1232000>; - regulator-allow-set-load; -}; - &pm4125_ss_in { remote-endpoint = <&usb_qmpphy_out>; }; @@ -473,6 +488,13 @@ }; }; +&pm4125_l5 { + /* DSI VDDA - must be at NOM voltage for PHY PLL lock */ + regulator-min-microvolt = <1232000>; + regulator-max-microvolt = <1232000>; + regulator-allow-set-load; +}; + &remoteproc_cdsp { firmware-name = "qcom/shikra/cdsp.mbn"; @@ -671,13 +693,6 @@ bias-disable; }; - wsa885x_i2c_spkr_sd_n: wsa885x-i2c-spkr-sd-n-active-state { - pins = "gpio2"; - function = "gpio"; - drive-strength = <8>; - input-disable; - output-enable; - }; lcd_bias_en: lcd-bias-en-state { pins = "gpio151"; function = "gpio"; @@ -685,6 +700,22 @@ bias-disable; }; + panel_bl_en: panel-bl-en-state { + pins = "gpio91"; + function = "gpio"; + drive-strength = <2>; + bias-disable; + output-high; + }; + + panel_bl_en_suspend: panel-bl-en-suspend-state { + pins = "gpio91"; + function = "gpio"; + drive-strength = <2>; + bias-pull-down; + output-low; + }; + panel_rst_n: panel-rst-n-state { pins = "gpio3"; function = "gpio"; @@ -706,6 +737,14 @@ bias-pull-down; }; + wsa885x_i2c_spkr_sd_n: wsa885x-i2c-spkr-sd-n-active-state { + pins = "gpio2"; + function = "gpio"; + drive-strength = <8>; + input-disable; + output-enable; + }; + pcie_default_state: pcie-default-state { clkreq-pins { pins = "gpio117"; diff --git a/arch/arm64/boot/dts/qcom/shikra.dtsi b/arch/arm64/boot/dts/qcom/shikra.dtsi index d9c5e137b3f52..7be2b39e17377 100644 --- a/arch/arm64/boot/dts/qcom/shikra.dtsi +++ b/arch/arm64/boot/dts/qcom/shikra.dtsi @@ -4,8 +4,8 @@ */ #include -#include #include +#include #include #include #include @@ -2115,7 +2115,7 @@ }; mdss: display-subsystem@5e00000 { - compatible = "qcom,shikra-mdss"; + compatible = "qcom,shikra-mdss", "qcom,qcm2290-mdss"; reg = <0x0 0x05e00000 0x0 0x1000>; reg-names = "mdss"; interrupts = ; @@ -2148,7 +2148,7 @@ status = "disabled"; mdp: display-controller@5e01000 { - compatible = "qcom,shikra-dpu"; + compatible = "qcom,shikra-dpu", "qcom,qcm2290-dpu"; reg = <0x0 0x05e01000 0x0 0x8f000>, <0x0 0x05eb0000 0x0 0x3000>; reg-names = "mdp", @@ -2169,7 +2169,7 @@ "vsync"; operating-points-v2 = <&mdp_opp_table>; - power-domains = <&rpmpd QCM2290_VDDCX>; + power-domains = <&rpmpd RPMPD_VDDCX>; ports { #address-cells = <1>; @@ -2215,6 +2215,7 @@ mdss_dsi0: dsi@5e94000 { compatible = "qcom,shikra-dsi-ctrl", + "qcom,qcm2290-dsi-ctrl", "qcom,mdss-dsi-ctrl"; reg = <0x0 0x05e94000 0x0 0x400>; reg-names = "dsi_ctrl"; @@ -2241,7 +2242,7 @@ <&mdss_dsi0_phy DSI_PIXEL_PLL_CLK>; operating-points-v2 = <&dsi_opp_table>; - power-domains = <&rpmpd QCM2290_VDDCX>; + power-domains = <&rpmpd RPMPD_VDDCX>; phys = <&mdss_dsi0_phy>; #address-cells = <1>; @@ -2301,7 +2302,7 @@ clock-names = "iface", "ref"; - power-domains = <&rpmpd QCM2290_VDDMX>; + power-domains = <&rpmpd RPMPD_VDDMX>; required-opps = <&rpmpd_opp_nom>; #clock-cells = <1>; diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig index f5ec9fe6bc944..6567d60aa0005 100644 --- a/arch/arm64/configs/defconfig +++ b/arch/arm64/configs/defconfig @@ -1017,11 +1017,11 @@ CONFIG_DRM_MXSFB=m CONFIG_DRM_IMX_LCDIF=m CONFIG_DRM_NOUVEAU=m CONFIG_DRM_PANEL_BOE_TV101WUM_NL6=m -CONFIG_DRM_PANEL_DLC0697=m CONFIG_DRM_PANEL_LVDS=m CONFIG_DRM_PANEL_HIMAX_HX8279=m CONFIG_DRM_PANEL_HIMAX_HX83112A=m CONFIG_DRM_PANEL_HIMAX_HX83112B=m +CONFIG_DRM_PANEL_ILITEK_ILI7807S=m CONFIG_DRM_PANEL_ILITEK_ILI9882T=m CONFIG_DRM_PANEL_KHADAS_TS050=m CONFIG_DRM_PANEL_MANTIX_MLAF057WE51=m diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index 70556c00ce1a5..0b3eff4ac7520 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -116,17 +116,6 @@ config DRM_PANEL_CHIPWEALTH_CH13726A Say Y here if you want to enable support for ChipWealth CH13726A-based display panels. -config DRM_PANEL_DLC0697 - tristate "DLC0697 1080x1920 video mode DSI panel" - depends on OF - depends on DRM_MIPI_DSI - depends on BACKLIGHT_CLASS_DEVICE - help - Say Y here if you want to enable support for the DLC DLC0697 - 1080x1920 60Hz MIPI-DSI video mode panel found on Qualcomm - Shikra (QCM2290-based) EVK boards. The panel supports hardware - backlight control via the MIPI DCS brightness command. - config DRM_PANEL_EBBG_FT8719 tristate "EBBG FT8719 panel driver" depends on GPIOLIB @@ -276,6 +265,18 @@ config DRM_PANEL_HYDIS_HV101HD1 If M is selected the module will be called panel-hydis-hv101hd1 +config DRM_PANEL_ILITEK_ILI7807S + tristate "Ilitek ILI7807S-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 + Ilitek ILI7807S display controller, such as the DLC DLC0697 + 1080x1920 MIPI DSI panel. + + If M is selected the module will be called panel-ilitek-ili7807s. + config DRM_PANEL_ILITEK_IL9322 tristate "Ilitek ILI9322 320x240 QVGA panels" depends on OF && SPI diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile index 3a8314b438361..c3002b351cb82 100644 --- a/drivers/gpu/drm/panel/Makefile +++ b/drivers/gpu/drm/panel/Makefile @@ -11,7 +11,6 @@ obj-$(CONFIG_DRM_PANEL_BOE_TV101WUM_LL2) += panel-boe-tv101wum-ll2.o obj-$(CONFIG_DRM_PANEL_BOE_TV101WUM_NL6) += panel-boe-tv101wum-nl6.o obj-$(CONFIG_DRM_PANEL_CHIPWEALTH_CH13726A) += panel-chipwealth-ch13726a.o obj-$(CONFIG_DRM_PANEL_DSI_CM) += panel-dsi-cm.o -obj-$(CONFIG_DRM_PANEL_DLC0697) += panel-dlc0697.o obj-$(CONFIG_DRM_PANEL_LVDS) += panel-lvds.o obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o obj-$(CONFIG_DRM_PANEL_EDP) += panel-edp.o @@ -27,6 +26,7 @@ obj-$(CONFIG_DRM_PANEL_HIMAX_HX83112B) += panel-himax-hx83112b.o obj-$(CONFIG_DRM_PANEL_HIMAX_HX83121A) += panel-himax-hx83121a.o obj-$(CONFIG_DRM_PANEL_HIMAX_HX8394) += panel-himax-hx8394.o obj-$(CONFIG_DRM_PANEL_HYDIS_HV101HD1) += panel-hydis-hv101hd1.o +obj-$(CONFIG_DRM_PANEL_ILITEK_ILI7807S) += panel-ilitek-ili7807s.o obj-$(CONFIG_DRM_PANEL_ILITEK_IL9322) += panel-ilitek-ili9322.o obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9341) += panel-ilitek-ili9341.o obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9805) += panel-ilitek-ili9805.o diff --git a/drivers/gpu/drm/panel/panel-dlc0697.c b/drivers/gpu/drm/panel/panel-dlc0697.c deleted file mode 100644 index f0ef07cb0160f..0000000000000 --- a/drivers/gpu/drm/panel/panel-dlc0697.c +++ /dev/null @@ -1,339 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. - -/* - * DRM panel driver for DLC0697 1080x1920 60Hz video-mode DSI panel - * - * Derived from downstream Qualcomm panel DT data. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -struct dlc0697 { - struct drm_panel panel; - struct mipi_dsi_device *dsi; - - struct regulator_bulk_data *supplies; - struct gpio_desc *reset_gpio; - struct gpio_desc *enable_gpio; - - struct pinctrl *pinctrl; - struct pinctrl_state *state_active; - struct pinctrl_state *state_suspend; -}; - -static const struct regulator_bulk_data dlc0697_supplies[] = { - { .supply = "vddio" }, - { .supply = "bias" }, -}; - -static inline struct dlc0697 *to_dlc0697(struct drm_panel *panel) -{ - return container_of(panel, struct dlc0697, panel); -} - -static const struct drm_display_mode dlc0697_mode = { - .clock = 131911, - - .hdisplay = 1080, - .hsync_start = 1080 + 18, - .hsync_end = 1080 + 18 + 2, - .htotal = 1080 + 18 + 2 + 16, - - .vdisplay = 1920, - .vsync_start = 1920 + 26, - .vsync_end = 1920 + 26 + 4, - .vtotal = 1920 + 26 + 4 + 20, - - .width_mm = 0, - .height_mm = 0, -}; - -static void dlc0697_reset(struct dlc0697 *ctx) -{ - gpiod_set_value_cansleep(ctx->reset_gpio, 0); - usleep_range(10000, 11000); - gpiod_set_value_cansleep(ctx->reset_gpio, 1); - usleep_range(10000, 11000); - gpiod_set_value_cansleep(ctx->reset_gpio, 0); - usleep_range(10000, 11000); -} - -static int dlc0697_on(struct dlc0697 *ctx) -{ - struct mipi_dsi_multi_context dsi_ctx = { .dsi = ctx->dsi }; - - ctx->dsi->mode_flags |= MIPI_DSI_MODE_LPM; - - mipi_dsi_dcs_soft_reset_multi(&dsi_ctx); - mipi_dsi_msleep(&dsi_ctx, 120); - - mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xff, 0x78, 0x07, 0x00); - mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x35, 0x00); - mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x5e, 0x09, 0x99); - mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x53, 0x24); - mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x55, 0x01); - mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x51, 0x3f, 0xff); - - 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); - - ctx->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM; - - if (dsi_ctx.accum_err) - dev_err(&ctx->dsi->dev, "panel on sequence failed: %d\n", dsi_ctx.accum_err); - - return dsi_ctx.accum_err; -} - -static int dlc0697_off(struct dlc0697 *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, 20); - - mipi_dsi_dcs_enter_sleep_mode_multi(&dsi_ctx); - mipi_dsi_msleep(&dsi_ctx, 120); - - ctx->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM; - - if (dsi_ctx.accum_err) - dev_err(&ctx->dsi->dev, "panel off sequence failed: %d\n", dsi_ctx.accum_err); - - return dsi_ctx.accum_err; -} - -static int dlc0697_enable(struct drm_panel *panel) -{ - struct dlc0697 *ctx = to_dlc0697(panel); - - if (ctx->enable_gpio) - gpiod_set_value_cansleep(ctx->enable_gpio, 1); - - return 0; -} - -static int dlc0697_disable(struct drm_panel *panel) -{ - struct dlc0697 *ctx = to_dlc0697(panel); - - if (ctx->enable_gpio) - gpiod_set_value_cansleep(ctx->enable_gpio, 0); - - return 0; -} - -static int dlc0697_prepare(struct drm_panel *panel) -{ - struct dlc0697 *ctx = to_dlc0697(panel); - int ret; - - if (ctx->pinctrl && ctx->state_active) { - ret = pinctrl_select_state(ctx->pinctrl, ctx->state_active); - if (ret < 0) - return ret; - } - - ret = regulator_bulk_enable(ARRAY_SIZE(dlc0697_supplies), ctx->supplies); - if (ret < 0) { - dev_err(ctx->panel.dev, "failed to enable regulators: %d\n", ret); - return ret; - } - - /* qcom,supply-post-on-sleep = <20> */ - msleep(20); - - dlc0697_reset(ctx); - - ret = dlc0697_on(ctx); - if (ret < 0) - goto err; - - return 0; - -err: - gpiod_set_value_cansleep(ctx->reset_gpio, 1); - - if (ctx->pinctrl && ctx->state_suspend) - pinctrl_select_state(ctx->pinctrl, ctx->state_suspend); - - regulator_bulk_disable(ARRAY_SIZE(dlc0697_supplies), ctx->supplies); - - return ret; -} - -static int dlc0697_unprepare(struct drm_panel *panel) -{ - struct dlc0697 *ctx = to_dlc0697(panel); - - dlc0697_off(ctx); - - gpiod_set_value_cansleep(ctx->reset_gpio, 1); - - if (ctx->pinctrl && ctx->state_suspend) - pinctrl_select_state(ctx->pinctrl, ctx->state_suspend); - - regulator_bulk_disable(ARRAY_SIZE(dlc0697_supplies), ctx->supplies); - - return 0; -} - -static int dlc0697_get_modes(struct drm_panel *panel, - struct drm_connector *connector) -{ - return drm_connector_helper_get_modes_fixed(connector, &dlc0697_mode); -} - -static const struct drm_panel_funcs dlc0697_panel_funcs = { - .prepare = dlc0697_prepare, - .unprepare = dlc0697_unprepare, - .enable = dlc0697_enable, - .disable = dlc0697_disable, - .get_modes = dlc0697_get_modes, -}; - -static int dlc0697_bl_update_status(struct backlight_device *bl) -{ - struct mipi_dsi_device *dsi = bl_get_data(bl); - u16 brightness = backlight_get_brightness(bl); - int ret; - - dsi->mode_flags &= ~MIPI_DSI_MODE_LPM; - ret = mipi_dsi_dcs_set_display_brightness_large(dsi, brightness); - if (ret < 0) - return ret; - - dsi->mode_flags |= MIPI_DSI_MODE_LPM; - return 0; -} - -static const struct backlight_ops dlc0697_bl_ops = { - .update_status = dlc0697_bl_update_status, -}; - -static struct backlight_device *dlc0697_create_backlight(struct mipi_dsi_device *dsi) -{ - struct device *dev = &dsi->dev; - const struct backlight_properties props = { - .type = BACKLIGHT_RAW, - .brightness = 4095, - .max_brightness = 4095, - }; - - return devm_backlight_device_register(dev, dev_name(dev), dev, dsi, - &dlc0697_bl_ops, &props); -} - -static int dlc0697_probe(struct mipi_dsi_device *dsi) -{ - struct device *dev = &dsi->dev; - struct dlc0697 *ctx; - int ret; - - ctx = devm_drm_panel_alloc(dev, struct dlc0697, panel, - &dlc0697_panel_funcs, - DRM_MODE_CONNECTOR_DSI); - if (IS_ERR(ctx)) - return PTR_ERR(ctx); - - ret = devm_regulator_bulk_get_const(dev, ARRAY_SIZE(dlc0697_supplies), - dlc0697_supplies, &ctx->supplies); - if (ret < 0) - return dev_err_probe(dev, ret, "failed to get regulators\n"); - - ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW); - if (IS_ERR(ctx->reset_gpio)) - return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio), - "failed to get reset gpio\n"); - - ctx->enable_gpio = devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_LOW); - if (IS_ERR(ctx->enable_gpio)) - return dev_err_probe(dev, PTR_ERR(ctx->enable_gpio), - "failed to get enable gpio\n"); - - ctx->pinctrl = devm_pinctrl_get(dev); - if (IS_ERR(ctx->pinctrl)) { - if (PTR_ERR(ctx->pinctrl) == -ENODEV) { - ctx->pinctrl = NULL; - } else { - return dev_err_probe(dev, PTR_ERR(ctx->pinctrl), - "failed to get pinctrl\n"); - } - } - - if (ctx->pinctrl) { - ctx->state_active = pinctrl_lookup_state(ctx->pinctrl, "default"); - if (IS_ERR(ctx->state_active)) - ctx->state_active = NULL; - - ctx->state_suspend = pinctrl_lookup_state(ctx->pinctrl, "sleep"); - if (IS_ERR(ctx->state_suspend)) - ctx->state_suspend = NULL; - } - - 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; - - ctx->panel.prepare_prev_first = true; - - ctx->panel.backlight = dlc0697_create_backlight(dsi); - if (IS_ERR(ctx->panel.backlight)) - return dev_err_probe(dev, PTR_ERR(ctx->panel.backlight), - "failed to create backlight\n"); - - drm_panel_add(&ctx->panel); - - ret = devm_mipi_dsi_attach(dev, dsi); - if (ret < 0) { - drm_panel_remove(&ctx->panel); - return dev_err_probe(dev, ret, "failed to attach dsi\n"); - } - - return 0; -} - -static void dlc0697_remove(struct mipi_dsi_device *dsi) -{ - drm_panel_remove(mipi_dsi_get_drvdata(dsi)); -} - -static const struct of_device_id dlc0697_of_match[] = { - { .compatible = "dlc,dlc0697" }, - { /* sentinel */ } -}; -MODULE_DEVICE_TABLE(of, dlc0697_of_match); - -static struct mipi_dsi_driver dlc0697_driver = { - .probe = dlc0697_probe, - .remove = dlc0697_remove, - .driver = { - .name = "panel-dlc0697", - .of_match_table = dlc0697_of_match, - }, -}; -module_mipi_dsi_driver(dlc0697_driver); - -MODULE_AUTHOR("Arpit Saini "); -MODULE_DESCRIPTION("DLC0697 1080x1920 video mode DSI panel"); -MODULE_LICENSE("GPL"); diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili7807s.c b/drivers/gpu/drm/panel/panel-ilitek-ili7807s.c new file mode 100644 index 0000000000000..12b491b0bca4c --- /dev/null +++ b/drivers/gpu/drm/panel/panel-ilitek-ili7807s.c @@ -0,0 +1,285 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. + */ + +#include +#include +#include +#include +#include +#include + +#include