From patchwork Wed Aug 26 16:03:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Semwal X-Patchwork-Id: 253353 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=-17.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 A307FC433E4 for ; Wed, 26 Aug 2020 16:03:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 73E732075E for ; Wed, 26 Aug 2020 16:03:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="mnj3bGV4" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726990AbgHZQDl (ORCPT ); Wed, 26 Aug 2020 12:03:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727906AbgHZQDd (ORCPT ); Wed, 26 Aug 2020 12:03:33 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24216C061796 for ; Wed, 26 Aug 2020 09:03:30 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id p37so1261138pgl.3 for ; Wed, 26 Aug 2020 09:03:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mDvqA9e7YqPVVUpVK+0rldhqRRsbzhwmsYKe/Rz7kas=; b=mnj3bGV40uTj3hbXN+wSBNEwkhRxr3rXQtrJYm6XMTVY8t69dbYpBMYpFwLk8AfrJa 3WGDur0G6wub47174wr38ZKU0Xs8KHBP7zK/HrEDFCsNDpUIO/a9rtF7IOjo+xEjnj81 GFKiaKLCeoA0LmYdG00kOUyISgiLHgABRgaZcZH1wi/sXaiIwk5VipD0qYFx7N7t0B4I YlvRI+uVp+1zQBs3VUzLxhmIFAb0IVNPTHBnmv1suLigv6/ewXDW6ZdIflqcMZiWpxry BIyx1nIIJ+90YV1HPMymxybFQuu73+O/0O3qdjLSM6wGTmJ3zydQWKeKAdceLLy/DGtJ L/Yg== 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:mime-version:content-transfer-encoding; bh=mDvqA9e7YqPVVUpVK+0rldhqRRsbzhwmsYKe/Rz7kas=; b=lGMMWhLtIYIYjDGHDlwinEDvK00b6knThRMfh5ZeG+pzctQm+daJPK15mOhM+Z6aMs Iyprpt1EhZ3waXCDL7dduV8aCvJ+KJAbymB1v2XtTtgmWSQ1vghaJTAzpmInKnaRpKam FlCXha4iIQ9wZIEtvsUk3KAg2VZl2A3F7Hrv+o8pws6JUHCjWy4CdpbgODqneRExQMT7 IsgX8bmkMPvJbKPjR8LqH3Hzs8p/drlHkw47OIAuV/0XF0EwcQXCAGiIPRBj65XtpRA3 nTc42eE5B9K69zb2PbOIbOTp1Am2kqq8hQ8pkaWSbdiar0bzKthwMOZhcm7UPuDhCpiN JWGg== X-Gm-Message-State: AOAM533pZINnYYw7koy6M/nG6RDZsaKJt7v6IlCIyQxhItK2Vv3iRojq 1PCq+rWNL/0gjJfMfXh5iMCcLg== X-Google-Smtp-Source: ABdhPJz9fI11jnbMjht2HJYH9hLke9r49ps298mbHDwJJYglh/C5UkGyg9AdBjvVd0kSXoT8k48TDA== X-Received: by 2002:a62:8f51:: with SMTP id n78mr12806308pfd.74.1598457809263; Wed, 26 Aug 2020 09:03:29 -0700 (PDT) Received: from nagraj.local ([49.206.21.239]) by smtp.gmail.com with ESMTPSA id u3sm2487555pjn.29.2020.08.26.09.03.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Aug 2020 09:03:28 -0700 (PDT) From: Sumit Semwal To: Thierry Reding , Sam Ravnborg , Rob Herring Cc: David Airlie , Daniel Vetter , Mauro Carvalho Chehab , "David S . Miller" , Rob Herring , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, Sumit Semwal , Benni Steini Subject: [PATCH v5 2/2] drm: panel: Add novatek nt36672a panel driver Date: Wed, 26 Aug 2020 21:33:08 +0530 Message-Id: <20200826160308.18911-3-sumit.semwal@linaro.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200826160308.18911-1-sumit.semwal@linaro.org> References: <20200826160308.18911-1-sumit.semwal@linaro.org> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Novatek NT36672a is a generic DSI IC that drives command and video mode panels. Add the driver for it. Right now adding support for some Poco F1 phones that have an LCD panel from Tianma connected with this IC, with a resolution of 1080x2246 that operates in DSI video mode. During testing, Benni Steini helped us fix the reset sequence timing (from 10ms to 20ms), to get the bootanimation to work on Android. With current AOSP, we need to increase it to 200ms - this seems to be a safe high value to avoid a white screen occasionally. Signed-off-by: Sumit Semwal Cc: Benni Steini --- v2: increase reset sequence timing to a safe 200ms v4: Since "0425662fdf05: drm: Nuke mode->vrefresh", we have to calculate vrefresh on demand. Update for it. v5: Fixed review comments from Sam: - rebased on top of drm-misc-next remove return of drm_panel_add() remove drm_panel_detach() - renamed the panel driver file to reflect that this is a novatek nt36672a display driver and not only for tianma panels. Adjusted some internal names also to reflect the same. - corrected changelog to add info about the generic Novatek DSI IC - corrected compatible string accordingly - removed pinctrl - used drm_panel* API for prepare/unprepare/disable/remove --- MAINTAINERS | 7 + drivers/gpu/drm/panel/Kconfig | 10 + drivers/gpu/drm/panel/Makefile | 1 + .../gpu/drm/panel/panel-novatek-nt36672a.c | 767 ++++++++++++++++++ 4 files changed, 785 insertions(+) create mode 100644 drivers/gpu/drm/panel/panel-novatek-nt36672a.c diff --git a/MAINTAINERS b/MAINTAINERS index 01fb9ee6b951..aeecade2d65f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -5619,6 +5619,13 @@ T: git git://anongit.freedesktop.org/drm/drm-misc F: Documentation/devicetree/bindings/display/ste,mcde.txt F: drivers/gpu/drm/mcde/ +DRM DRIVER FOR TIANMA NT36672A PANELS +M: Sumit Semwal +S: Maintained +T: git git://anongit.freedesktop.org/drm/drm-misc +F: Documentation/devicetree/bindings/display/panel/tianma,nt36672a-panel.yaml +F: drivers/gpu/drm/panel/panel-tianma-nt36672a.c + DRM DRIVER FOR TDFX VIDEO CARDS S: Orphan / Obsolete F: drivers/gpu/drm/tdfx/ diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index 8d97d07c5871..02600f12a063 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -208,6 +208,16 @@ config DRM_PANEL_NOVATEK_NT35510 around the Novatek NT35510 display controller, such as some Hydis panels. +config DRM_PANEL_NOVATEK_NT36672A + tristate "Novatek NT36672A 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 panels built + around the Novatek NT36672A display controller, such as some + Tianma panels used in a few Xiaomi Poco F1 mobile phone. + config DRM_PANEL_NOVATEK_NT39016 tristate "Novatek NT39016 RGB/SPI panel" depends on OF && SPI diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile index 15a4e7752951..4a36eb45f670 100644 --- a/drivers/gpu/drm/panel/Makefile +++ b/drivers/gpu/drm/panel/Makefile @@ -19,6 +19,7 @@ obj-$(CONFIG_DRM_PANEL_LG_LB035Q02) += panel-lg-lb035q02.o obj-$(CONFIG_DRM_PANEL_LG_LG4573) += panel-lg-lg4573.o obj-$(CONFIG_DRM_PANEL_NEC_NL8048HL11) += panel-nec-nl8048hl11.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT35510) += panel-novatek-nt35510.o +obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36672A) += panel-novatek-nt36672a.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT39016) += panel-novatek-nt39016.o obj-$(CONFIG_DRM_PANEL_MANTIX_MLAF057WE51) += panel-mantix-mlaf057we51.o obj-$(CONFIG_DRM_PANEL_OLIMEX_LCD_OLINUXINO) += panel-olimex-lcd-olinuxino.o diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36672a.c b/drivers/gpu/drm/panel/panel-novatek-nt36672a.c new file mode 100644 index 000000000000..3f0c18e46818 --- /dev/null +++ b/drivers/gpu/drm/panel/panel-novatek-nt36672a.c @@ -0,0 +1,767 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2020 Linaro Ltd + * Author: Sumit Semwal + * + * This driver is for the DSI interface to panels using the NT36672A display driver IC + * from Novatek. + * Currently supported are the Tianma FHD+ panels found in some Xiaomi phones, including + * some variants of the Poco F1 phone. + * + * Panels using the Novatek NT37762A IC should add appropriate configuration per-panel and + * use this driver. + */ + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include