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/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