From nobody Sat Jun 20 17:33:38 2026 Received: from out-171.mta0.migadu.com (out-171.mta0.migadu.com [91.218.175.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EB0EF3793B5 for ; Sun, 12 Apr 2026 11:39:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775993994; cv=none; b=EHGF9oymSxkC05Pxv+8dcqvyFp5JSzbNEaue+P1/s0d0gt3cwkGJa3ICITDFHDm1edZIcowbFEdapjizl9J3OwWUluzAcEkckxvQdosCHgEsxxYSu+4zVEVvPyI0lGV8zFwMjKzlpS+FlDW+FLDUpgazQy2xsbEv4R52qR1QcRw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775993994; c=relaxed/simple; bh=xrfRUIrV2OJwkuyjS0qFcxRuUcN0YbINCj7HmwcMIlk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Z/+Xdp16GMCsd6TiwcXCzFki3NvAefWKbRYUqpc1n5vBiYOPPIHhIOA3c9rz3obLXF+taRJBEU7ItQlGJ0+WnOgW+DAZkxBJLS3zSlH8AafZpneC505/C96KjD4EtEb8zJ4EoKIeyHNrcOrm/IkwKTCXNfRuIB3KA8sT4Hzo5N4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=packett.cool; spf=pass smtp.mailfrom=packett.cool; dkim=pass (2048-bit key) header.d=packett.cool header.i=@packett.cool header.b=EG2oawCT; arc=none smtp.client-ip=91.218.175.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=packett.cool Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=packett.cool Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=packett.cool header.i=@packett.cool header.b="EG2oawCT" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=packett.cool; s=key1; t=1775993990; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2OH1Z0TNgtSZYQtC6LvXeqJrvu4DIRwbjIKNvB0ZrPY=; b=EG2oawCT/jk/ZN0za55wTPeH9HRJaHp3JA3faX9B2saeo13p6pU/8H6cx9Xw1TSkw9jvqp v/SXT9DI6IgAXmdXCVoQ9thQ2Oa+Q+7wxvE1in5Me66RKJjxyDO/Lbba2jaeeUtavUVrYg KPIDJnkNkLadcooVV/XqzfycqblrKo5DJB7Db9HWrRny6/zICDkVcUZ4GGz58By5CLVvoY 0wPEkZj6F4toGVzBeEsZSQAaA9pUVupFg9zWmVkH3gxzV66fPlSb9BV/A7Va1p11tWRBkd k0zF85IrfLzABMdZ+KL0mtg1eTVnQvidsKDTRaMUmR4dk0Fp3I7FQ0nauyldWA== From: Val Packett To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Jessica Zhang Cc: Val Packett , Rob Clark , Dmitry Baryshkov , Krzysztof Kozlowski , Alicja Michalska , dri-devel@lists.freedesktop.org, ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 1/2] drm: Introduce drm_panel_prepare_for_mode callback Date: Sun, 12 Apr 2026 08:00:44 -0300 Message-ID: <20260412113851.355944-2-val@packett.cool> In-Reply-To: <20260412113851.355944-1-val@packett.cool> References: <20260412113851.355944-1-val@packett.cool> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" Modern OLED panels often need to vary their prepare commands based on the mode being set (resolution and refresh rate). Introduce a new variant of the drm_panel_prepare callback that passes the chosen mode as an argument to allow for this. Signed-off-by: Val Packett --- drivers/gpu/drm/bridge/panel.c | 8 ++++++-- drivers/gpu/drm/drm_panel.c | 15 +++++++++++++-- include/drm/drm_panel.h | 12 ++++++++++++ 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c index 184a8b7049a7..58c9d9c44363 100644 --- a/drivers/gpu/drm/bridge/panel.c +++ b/drivers/gpu/drm/bridge/panel.c @@ -116,7 +116,7 @@ static void panel_bridge_atomic_pre_enable(struct drm_b= ridge *bridge, struct panel_bridge *panel_bridge =3D drm_bridge_to_panel_bridge(bridge); struct drm_encoder *encoder =3D bridge->encoder; struct drm_crtc *crtc; - struct drm_crtc_state *old_crtc_state; + struct drm_crtc_state *old_crtc_state, *new_crtc_state; =20 crtc =3D drm_atomic_get_new_crtc_for_encoder(atomic_state, encoder); if (!crtc) @@ -126,7 +126,11 @@ static void panel_bridge_atomic_pre_enable(struct drm_= bridge *bridge, if (old_crtc_state && old_crtc_state->self_refresh_active) return; =20 - drm_panel_prepare(panel_bridge->panel); + new_crtc_state =3D drm_atomic_get_new_crtc_state(atomic_state, crtc); + if (!new_crtc_state) + return; + + drm_panel_prepare_for_mode(panel_bridge->panel, &new_crtc_state->mode); } =20 static void panel_bridge_atomic_enable(struct drm_bridge *bridge, diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c index d1e6598ea3bc..cc313f778253 100644 --- a/drivers/gpu/drm/drm_panel.c +++ b/drivers/gpu/drm/drm_panel.c @@ -112,6 +112,13 @@ EXPORT_SYMBOL(drm_panel_remove); * drm_panel_disable() afterwards. */ void drm_panel_prepare(struct drm_panel *panel) +{ + drm_panel_prepare_for_mode(panel, NULL); +} +EXPORT_SYMBOL(drm_panel_prepare); + +void drm_panel_prepare_for_mode(struct drm_panel *panel, + struct drm_display_mode *mode) { struct drm_panel_follower *follower; int ret; @@ -126,7 +133,11 @@ void drm_panel_prepare(struct drm_panel *panel) =20 mutex_lock(&panel->follower_lock); =20 - if (panel->funcs && panel->funcs->prepare) { + if (panel->funcs && panel->funcs->prepare_for_mode && mode) { + ret =3D panel->funcs->prepare_for_mode(panel, mode); + if (ret < 0) + goto exit; + } else if (panel->funcs && panel->funcs->prepare) { ret =3D panel->funcs->prepare(panel); if (ret < 0) goto exit; @@ -146,7 +157,7 @@ void drm_panel_prepare(struct drm_panel *panel) exit: mutex_unlock(&panel->follower_lock); } -EXPORT_SYMBOL(drm_panel_prepare); +EXPORT_SYMBOL(drm_panel_prepare_for_mode); =20 /** * drm_panel_unprepare - power off a panel diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h index 2407bfa60236..0c2e5232ab20 100644 --- a/include/drm/drm_panel.h +++ b/include/drm/drm_panel.h @@ -80,6 +80,16 @@ struct drm_panel_funcs { */ int (*prepare)(struct drm_panel *panel); =20 + /** + * @prepare_for_mode: + * + * Turn on panel and perform set up, with awareness of the mode being set. + * + * This function is optional. + */ + int (*prepare_for_mode)(struct drm_panel *panel, + struct drm_display_mode *mode); + /** * @enable: * @@ -331,6 +341,8 @@ void drm_panel_add(struct drm_panel *panel); void drm_panel_remove(struct drm_panel *panel); =20 void drm_panel_prepare(struct drm_panel *panel); +void drm_panel_prepare_for_mode(struct drm_panel *panel, + struct drm_display_mode *mode); void drm_panel_unprepare(struct drm_panel *panel); =20 void drm_panel_enable(struct drm_panel *panel); --=20 2.53.0 From nobody Sat Jun 20 17:33:38 2026 Received: from out-184.mta0.migadu.com (out-184.mta0.migadu.com [91.218.175.184]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 77A4D375AA8 for ; Sun, 12 Apr 2026 11:39:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.184 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775994000; cv=none; b=nJ0tJ8oqGeI4DwnSGmHl9Xp7ZOJoX/j2BbRjRJcfxI6d0b9sTnsTBkTCavy0coJRzk1MCh+7eIiUB3mF91iAj0H1aQ6trUwgsGt5oT5Ex5BTcxHRrSSS8rqqoy642b+sNUDWpilzvCOdZcgQ/LUgcVeyj8bndE0YBbbfxgdpPEw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775994000; c=relaxed/simple; bh=+7YAwx+nEicA0T9X0WiQfktNQ2hqHZFTJEduc/8Ww+k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oqYZZXqk2FA+uSW8CS3VCDCw1HFkukn9fGSIjdTUzejJvlF5tXHUL5KafwaHUxVIl892ZzHuhTvARvGg3bs+rEbv14lXYtzeHV5/e/DzQHWsqVohqE1yDcoBT6NkBUTdz1n/5I15l8L7p2QNiB5YByk4uydzBSdFkWWYkfouOA4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=packett.cool; spf=pass smtp.mailfrom=packett.cool; dkim=pass (2048-bit key) header.d=packett.cool header.i=@packett.cool header.b=lU6nKKel; arc=none smtp.client-ip=91.218.175.184 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=packett.cool Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=packett.cool Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=packett.cool header.i=@packett.cool header.b="lU6nKKel" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=packett.cool; s=key1; t=1775993996; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ylsu9Y5o2SCxsYagGgX6pZIWYd0qVXmNywyb7btE/gk=; b=lU6nKKelfxByzWMT8Ea0wt2Cp+0w8AmkL8V+oQ7x2LtQBC4si5GFxgOJ3FdwIziKjb47zC T0QwBYnPcPuyccBtltDUgZLU9SbBb+fHguxJjHV7N27uik7gAd1PNxa1cdJt6m9XRbiIMw iYM2glph7ygxy65nMBiVPfrtoggmxMiUSudSuL/aU0BepcKNyiXsbHtPaIPKgK74caXzrt O1b5aJrlameRQ2ExdTMd9gdn8lRrkXDLGQJr0ykQwcke3fvQ38OAqZH0l91XYatBDWNXiz ckUoB4P0RebSrYhn20fVE9tKu/hw0atcjNkVKwfBxQ2NgZGUVC3OxRFAQjrJOA== From: Val Packett To: Neil Armstrong , Jessica Zhang , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: Val Packett , Rob Clark , Dmitry Baryshkov , Krzysztof Kozlowski , Alicja Michalska , dri-devel@lists.freedesktop.org, ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 2/2] drm/panel: Add driver for Novatek NT37701 based OLED panels Date: Sun, 12 Apr 2026 08:00:45 -0300 Message-ID: <20260412113851.355944-3-val@packett.cool> In-Reply-To: <20260412113851.355944-1-val@packett.cool> References: <20260412113851.355944-1-val@packett.cool> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" Add a driver for panels with the NT37701 DDIC, starting with the Tianma panel (unknown model) used in the Motorola Edge 30 (dubai) smartphone. Signed-off-by: Val Packett --- drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-novatek-nt37701.c | 532 ++++++++++++++++++ 2 files changed, 533 insertions(+) create mode 100644 drivers/gpu/drm/panel/panel-novatek-nt37701.c diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile index a4291dc3905b..183f968a5333 100644 --- a/drivers/gpu/drm/panel/Makefile +++ b/drivers/gpu/drm/panel/Makefile @@ -60,6 +60,7 @@ obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36523) +=3D panel-novate= k-nt36523.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36672A) +=3D panel-novatek-nt36672a.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36672E) +=3D panel-novatek-nt36672e.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT37700F) +=3D panel-novatek-nt37700f.o +obj-m +=3D panel-novatek-nt37701.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT37801) +=3D panel-novatek-nt37801.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT39016) +=3D panel-novatek-nt39016.o obj-$(CONFIG_DRM_PANEL_MANTIX_MLAF057WE51) +=3D panel-mantix-mlaf057we51.o diff --git a/drivers/gpu/drm/panel/panel-novatek-nt37701.c b/drivers/gpu/dr= m/panel/panel-novatek-nt37701.c new file mode 100644 index 000000000000..ea8a208fecb2 --- /dev/null +++ b/drivers/gpu/drm/panel/panel-novatek-nt37701.c @@ -0,0 +1,532 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (c) 2026, The Linux Foundation. All rights reserved. + * Generated with linux-mdss-dsi-panel-driver-generator from vendor device= tree: + * Copyright (c) 2013, The Linux Foundation. All rights reserved. + */ + +#include +#include +#include +#include +#include +#include + +#include