From patchwork Fri Jul 23 04:06:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dillon Min X-Patchwork-Id: 485444 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A1DEC432BE for ; Fri, 23 Jul 2021 04:07:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3192F60E75 for ; Fri, 23 Jul 2021 04:07:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233732AbhGWD0b (ORCPT ); Thu, 22 Jul 2021 23:26:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233670AbhGWD0a (ORCPT ); Thu, 22 Jul 2021 23:26:30 -0400 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E99CC0613D3; Thu, 22 Jul 2021 21:07:02 -0700 (PDT) Received: by mail-pl1-x636.google.com with SMTP id n10so1815373plf.4; Thu, 22 Jul 2021 21:07:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=IQRKRQq+ppZZQjhzVhSUB/UHn9VMaT6QTfTpkIDhRQI=; b=H3lo744reWojIp1GyZdVK46sIiZYEgZmDLiO3ezCXeRfWjbB1x3fwuFCCCxuD/gNmA vjvBPnSj0sKiRnBCm+IWP2HMaOsAby6blAGtXjUbxaiheLl87r4Ya1EJYeQRKLZZmQXJ a2IShTcRzDdT7cD1+YE/Yaa5n4WF06jmtnn3RoXUqNBvpqD4jG1gGpFvbkuZLGJy9ggb eOLN0pV150Ty/F8EoLUXzbKQ0N+ZTTAbiqw1RALixwXWkUTp2MzBU0r2d0ss5YghBshq erodpU73DmGmYqEQX9s5yOqu2Dr0EkEKOFx5AlnHbJXXh0NNCG9O1ZIfutNB4ofyMBXW OouQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=IQRKRQq+ppZZQjhzVhSUB/UHn9VMaT6QTfTpkIDhRQI=; b=KK8YX15KHBzO4NSnJdQ84zRQSHmBZVIy17nVWshyq/ckDGljsPRMS/89yjPs9F9XL9 cdG/8OcaJbefVTu9MhYe+Nqd6C4k9ZzfSGMYG0ySOqAyudF8Aq4N3ThALHAdyhJ6Twfo yQFA8Ne5znqFc8iwieybcVVShiktl70HfNn9Ph9y0EC48J/mWVgbdV/oPOXbeMqaykiS ggZgPyYo7OsXjxfFXATCrukqE3pQ8gfr9cHlMgrOGjQLNHyoYqXl31TI/1z7ITKB8Vr0 0ytb6156MTIg/IB8doRnVwSlCvMH6YjfmZOHIqpcjn84qa2KC6KK1TKoAuKjnhCW7o1b 5gCg== X-Gm-Message-State: AOAM533V1+WvdQsKxmARUWuFz9otefphEfpheX7glXoJy/EKiG5Wnz+g SLgnwSndRPcXw/rb0tMQn8w= X-Google-Smtp-Source: ABdhPJxFM/fWD2b9j1qBQ4Ym72CYy11R5S3mpGG3J3quDTLTGgaP9q3pqclAaA/ykXpOnbBuPRLkDg== X-Received: by 2002:a63:fd07:: with SMTP id d7mr3116268pgh.288.1627013221679; Thu, 22 Jul 2021 21:07:01 -0700 (PDT) Received: from fmin-OptiPlex-7060.nreal.work ([137.59.103.165]) by smtp.gmail.com with ESMTPSA id p3sm35474910pgi.20.2021.07.22.21.06.57 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Jul 2021 21:07:01 -0700 (PDT) From: dillon.minfei@gmail.com To: laurent.pinchart@ideasonboard.com, thierry.reding@gmail.com, sam@ravnborg.org, airlied@linux.ie, daniel@ffwll.ch, robh+dt@kernel.org, linus.walleij@linaro.org, alexandre.torgue@foss.st.com, mcoquelin.stm32@gmail.com Cc: noralf@tronnes.org, dianders@chromium.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Dillon Min Subject: [PATCH v3 3/3] drm/panel: Add ilitek ili9341 panel driver Date: Fri, 23 Jul 2021 12:06:43 +0800 Message-Id: <1627013203-23099-4-git-send-email-dillon.minfei@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1627013203-23099-1-git-send-email-dillon.minfei@gmail.com> References: <1627013203-23099-1-git-send-email-dillon.minfei@gmail.com> Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Dillon Min This driver combines tiny/ili9341.c mipi_dbi_interface driver with mipi_dpi_interface driver, and can support ili9341 with serial mode or parallel rgb interface mode by register configuration. Signed-off-by: Dillon Min Reviewed-by: Linus Walleij Reviewed-by: Jagan Teki --- v3: all the v3 updates are based on Sam and Jagan's review. - collect reviewed-by tags from linus and jagan. - replace DRM_ERROR() with dev_err() or drm_err(). - remove kernel-doc markers from struct ili9341_config{}. - reorder include headers. - remove the struct device *dev from struct ili9341{}. - restructure the ili9341_probe() function, add two ili9341_{dbi,dpi)_probe() to make it more readable according to jagan's suggestion, thanks. For "So this is a full display driver. The more relevant home for this driver is inside drm/tiny/." I'm not sure if this is to ask me move the dpi code to drm/tiny/ili9341.c, and remove this driver. or just remove the dbi code from this driver, but this will result in two drivers to support the same panel (as Noralf does not agree with it). so, waiting for the decision from Sam, Laurent, then will update in v4, thanks. drivers/gpu/drm/panel/Kconfig | 12 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-ilitek-ili9341.c | 786 +++++++++++++++++++++++++++ 3 files changed, 799 insertions(+) create mode 100644 drivers/gpu/drm/panel/panel-ilitek-ili9341.c diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index ef87d92cdf49..eb34b8d1b19a 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -124,6 +124,18 @@ config DRM_PANEL_ILITEK_IL9322 Say Y here if you want to enable support for Ilitek IL9322 QVGA (320x240) RGB, YUV and ITU-T BT.656 panels. +config DRM_PANEL_ILITEK_ILI9341 + tristate "Ilitek ILI9341 240x320 QVGA panels" + depends on OF && SPI + depends on DRM_KMS_HELPER + depends on DRM_KMS_CMA_HELPER + depends on BACKLIGHT_CLASS_DEVICE + select DRM_MIPI_DBI + help + Say Y here if you want to enable support for Ilitek IL9341 + QVGA (240x320) RGB panels. support serial & parallel rgb + interface. + config DRM_PANEL_ILITEK_ILI9881C tristate "Ilitek ILI9881C-based panels" depends on OF diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile index cae4d976c069..0ecde184665d 100644 --- a/drivers/gpu/drm/panel/Makefile +++ b/drivers/gpu/drm/panel/Makefile @@ -11,6 +11,7 @@ obj-$(CONFIG_DRM_PANEL_ELIDA_KD35T133) += panel-elida-kd35t133.o obj-$(CONFIG_DRM_PANEL_FEIXIN_K101_IM2BA02) += panel-feixin-k101-im2ba02.o obj-$(CONFIG_DRM_PANEL_FEIYANG_FY07024DI26A30D) += panel-feiyang-fy07024di26a30d.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_ILI9881C) += panel-ilitek-ili9881c.o obj-$(CONFIG_DRM_PANEL_INNOLUX_P079ZCA) += panel-innolux-p079zca.o obj-$(CONFIG_DRM_PANEL_JDI_LT070ME05000) += panel-jdi-lt070me05000.o diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9341.c b/drivers/gpu/drm/panel/panel-ilitek-ili9341.c new file mode 100644 index 000000000000..5ab6f18c3ce1 --- /dev/null +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9341.c @@ -0,0 +1,786 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Ilitek ILI9341 TFT LCD drm_panel driver. + * + * This panel can be configured to support: + * - 16-bit parallel RGB interface + * - 18-bit parallel RGB interface + * - 4-line serial spi interface + * + * Copyright (C) 2021 Dillon Min + * Derived from drivers/drm/gpu/panel/panel-ilitek-ili9322.c + * the reuse of DBI abstraction part referred from Linus's patch + * "drm/panel: s6e63m0: Switch to DBI abstraction for SPI" + */ + +#include +#include +#include +#include +#include +#include +#include + +#include