Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp256965pxk; Tue, 1 Sep 2020 23:46:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfsqDO9icBU/btNm8+7Nd0HsekhEo5uGgqHLBk2TpQ8lt9w2SYSSSnNGH40EWnVIQtsuvk X-Received: by 2002:a17:906:a4b:: with SMTP id x11mr5207140ejf.83.1599029162071; Tue, 01 Sep 2020 23:46:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599029162; cv=none; d=google.com; s=arc-20160816; b=pAzd7G0XSz6PT7l/jOzoX05ogxD7EwIJ9+F8CbFd656snJZC+v6cV/owy6et4zn+54 xnGVdnCdoi8SkjpwKlXNyd9kL1G/ykGEoIg3JuQAGdkpJwVbnZOORE9s6g7064zd4uWY 28cdTdMVajH+J0UgdcCF/pe+Q7k3gjoY8jrPDsg8ap2zLX0u5cFOcTvrXeJxTUE52UKC wcaIf760FI6r4yZAoxfPOKzvAo6kOVWsUNy7bg3flXgqYnyadiuxWUlhg7I9bsnLZ9si AXk9xS43XnaL1Tq3ZOL+ZLK1yC3AOoli903xplP5WY0OuUuIOZ3e/V/Nhk8M5V2oqvUB qEcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=glSU4ZaH3aMBVnbdfwsUklIig+uauBfubDY6DwFqnA8=; b=Sdbv9NOXiq4o+9Mq+YSJEd4Xf9tUwo5oU5/TgIfhQpVL1nma+OY8l1LkdQXyNaqA/u TmByIxea7BInTcZFHOIaDcvuSvJVyOUagyd5NOI3Jh1kLeKbgNhoO7iLK9I9ws/2UnaJ t+hpNoHXmhow8mDtX+EvOxBKLVsZyQ9LoAZVg4fAyGrZ1G1UUbplFdUmG1d9bqC7bFCt CkU2hCIuq88kF8lpJxA7e1SrgjmXtvwy2r/TNhDG3jwYezggOebDQVVVm6cO6MrrLM/Q lG+Ow2+pYbdBbj4MRlW+9BInHsOrMRAoc6upSQbH5kOfg9GZmSpXmJDwHhl9o3QOUuGI nxAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="hvm/l+pQ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n13si1955012edq.92.2020.09.01.23.45.38; Tue, 01 Sep 2020 23:46:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="hvm/l+pQ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726726AbgIBGo2 (ORCPT + 99 others); Wed, 2 Sep 2020 02:44:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726510AbgIBGoZ (ORCPT ); Wed, 2 Sep 2020 02:44:25 -0400 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76DA4C061244 for ; Tue, 1 Sep 2020 23:44:25 -0700 (PDT) Received: by mail-pf1-x441.google.com with SMTP id w7so2302666pfi.4 for ; Tue, 01 Sep 2020 23:44:25 -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=glSU4ZaH3aMBVnbdfwsUklIig+uauBfubDY6DwFqnA8=; b=hvm/l+pQvFq6kscuhhgYdDWtIYibh8mbWjhcrHofIPaDSYdOTrYVuJFOkEB2EB6u9z FeFe75hkNb3AQFAyUNwRxpVp+3bPP5DMvZanY/aiEmXu1sSi3MQKgAT3bp0eMZ4vft1Q aOdMfW+HJrcpIQjycCAyOa1bOZXaC3m0KbNoxYfZwWXP/X2FwEAivZgKnacda0FYzNuh TceH1C0Ti5JH1LNzGxPhwsIqlGQ014WOekcyZCeMhOd9ox/psE0tACFPy0lArpmnz9dS eBFO8grNhlqazv0X6XvGck79cFS33TjmfsEVcmwvmD52JQSuog1AJ4RUH8jwqKtOnk4Q L1yw== 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=glSU4ZaH3aMBVnbdfwsUklIig+uauBfubDY6DwFqnA8=; b=sfU5Yz2QxIuvp7PlR1I09mrA/Egx0BhIgnB+6cDFaDIM1F8N0aXO91tDSNbo9yO/gh vaNOoMyfwc7P9QDqqURXMPTwZ7Wu2PcoT7NCSIX7Q9hl/6NXGXGGZTHpeOp9N0RzYiGY bpyFi8d8VvNKFJZboDGE1n8t0B6wX3s8JpsuA6wYOfrEXGSu05iQbuIJBjIBiRhOQEmG xbLdboJMHJlTLZ0wJti8YIksyNs1HEIg4VsAS7ZSK5nRecbdYEXRwWcVqzFDyiWd9b6r GwDC+GoSWaoMDWp3PyhCqhIgkkApPHAy9xOHFH/BqlE47VUbSacUEaBK7jD/LQ5hJ7l4 kMdA== X-Gm-Message-State: AOAM531Bp/bZEHOICpwOSOKW6j5OFoQcc22qmBMF0Q6UURHGXgbFBiCl 9qW2NdFhIk8wywrrU/WBkJlWDA== X-Received: by 2002:a63:ba49:: with SMTP id l9mr859105pgu.101.1599029064744; Tue, 01 Sep 2020 23:44:24 -0700 (PDT) Received: from nagraj.local ([49.206.21.239]) by smtp.gmail.com with ESMTPSA id i23sm4317434pfo.207.2020.09.01.23.44.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Sep 2020 23:44:23 -0700 (PDT) From: Sumit Semwal To: Thierry Reding , Sam Ravnborg 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, Bjorn Andersson , Sumit Semwal , Benni Steini Subject: [PATCH v7 2/2] drm: panel: Add novatek nt36672a panel driver Date: Wed, 2 Sep 2020 12:14:07 +0530 Message-Id: <20200902064407.30712-3-sumit.semwal@linaro.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200902064407.30712-1-sumit.semwal@linaro.org> References: <20200902064407.30712-1-sumit.semwal@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 v6: Fixed few review comments on v5 from Sam: - add dev_err_probe() support - move DRM_* error printing to dev_err() - removed a few unnecessary bits v7: Fixed review comments on v6 from Bjorn: - Reworked the send_mipi_commands functionality - removed regulator disable_loads; moved active_load setting to probe time - made function names and struct less generic - updated the reset_gpio working to active_low - update MAINTAINERS for file name changes --- MAINTAINERS | 7 + drivers/gpu/drm/panel/Kconfig | 10 + drivers/gpu/drm/panel/Makefile | 1 + .../gpu/drm/panel/panel-novatek-nt36672a.c | 711 ++++++++++++++++++ 4 files changed, 729 insertions(+) create mode 100644 drivers/gpu/drm/panel/panel-novatek-nt36672a.c diff --git a/MAINTAINERS b/MAINTAINERS index 01fb9ee6b951..c6fb966c0959 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -5517,6 +5517,13 @@ T: git git://anongit.freedesktop.org/drm/drm-misc F: Documentation/devicetree/bindings/display/panel/novatek,nt35510.yaml F: drivers/gpu/drm/panel/panel-novatek-nt35510.c +DRM DRIVER FOR NOVATEK NT36672A PANELS +M: Sumit Semwal +S: Maintained +T: git git://anongit.freedesktop.org/drm/drm-misc +F: Documentation/devicetree/bindings/display/panel/novatek,nt36672a.yaml +F: drivers/gpu/drm/panel/panel-novatek-nt36672a.c + DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS M: Ben Skeggs L: dri-devel@lists.freedesktop.org diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index 8d97d07c5871..51e6cb6c7826 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 phones. + 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..533cd3934b8b --- /dev/null +++ b/drivers/gpu/drm/panel/panel-novatek-nt36672a.c @@ -0,0 +1,711 @@ +// 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