From: "Luca Weiss" <luca.weiss@fairphone.com>
To: "Thomas Zimmermann" <tzimmermann@suse.de>,
"Luca Weiss" <luca.weiss@fairphone.com>,
"Neil Armstrong" <neil.armstrong@linaro.org>,
"Jessica Zhang" <jesszhan0024@gmail.com>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Bjorn Andersson" <andersson@kernel.org>,
"Konrad Dybcio" <konradybcio@kernel.org>
Cc: <~postmarketos/upstreaming@lists.sr.ht>,
<phone-devel@vger.kernel.org>, <dri-devel@lists.freedesktop.org>,
<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-arm-msm@vger.kernel.org>
Subject: Re: [PATCH 2/4] drm/panel: Add driver for Novatek NT37705 panel
Date: Fri, 15 May 2026 16:31:51 +0200 [thread overview]
Message-ID: <DIJBNGDNXE0L.2I0H4PBDDODOP@fairphone.com> (raw)
In-Reply-To: <c06623ba-b19c-471a-becb-2fafddb3583c@suse.de>
On Fri May 8, 2026 at 10:06 AM CEST, Thomas Zimmermann wrote:
> Hi
>
> Am 01.05.26 um 15:52 schrieb Luca Weiss:
>> Add support for the 2484x1116 AMOLED panel from BOE (BJ631JHM-T71-D900)
>> bundled with a NT37705 driver IC, as found on the Fairphone (Gen. 6)
>> smartphone.
>>
>> The panel can also be configured in 10-bit (RGB101010) mode, however
>> currently it's configured in 8-bit (RGB888) since there's some issues in
>> the Qualcomm DPU driver when driving this panel in 10-bit.
>>
>> Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
>> ---
>> drivers/gpu/drm/panel/Kconfig | 11 +
>> drivers/gpu/drm/panel/Makefile | 1 +
>> drivers/gpu/drm/panel/panel-novatek-nt37705.c | 413 ++++++++++++++++++++++++++
>> 3 files changed, 425 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
>> index 979109c27b9b..59ab3f29d8ef 100644
>> --- a/drivers/gpu/drm/panel/Kconfig
>> +++ b/drivers/gpu/drm/panel/Kconfig
>> @@ -624,6 +624,17 @@ config DRM_PANEL_NOVATEK_NT37700F
>> Say Y here if you want to enable support for Novatek NT37700F DSI
>> panel module. The panel has a resolution of 1080x2160.
>>
>> +config DRM_PANEL_NOVATEK_NT37705
>> + tristate "Novatek NT37705-based DSI panel"
>> + depends on OF
>> + depends on DRM_MIPI_DSI
>> + depends on BACKLIGHT_CLASS_DEVICE
>> + select DRM_KMS_HELPER
>> + help
>> + Say Y here if you want to enable support for Novatek NT37705-based
>> + display panels, such as the one found in the The Fairphone (Gen. 6)
>
> Duplicate 'the'
Marketing really wanted to have it be "The Fairphone". Will change and
make it saner.
>
>> + smartphone.
>> +
>> config DRM_PANEL_NOVATEK_NT37801
>> tristate "Novatek NT37801/NT37810 AMOLED DSI panel"
>> depends on OF
>> diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
>> index 0d694acbfbb6..94639bc58ca8 100644
>> --- a/drivers/gpu/drm/panel/Makefile
>> +++ b/drivers/gpu/drm/panel/Makefile
>> @@ -61,6 +61,7 @@ obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36523) += panel-novatek-nt36523.o
>> obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36672A) += panel-novatek-nt36672a.o
>> obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36672E) += panel-novatek-nt36672e.o
>> obj-$(CONFIG_DRM_PANEL_NOVATEK_NT37700F) += panel-novatek-nt37700f.o
>> +obj-$(CONFIG_DRM_PANEL_NOVATEK_NT37705) += panel-novatek-nt37705.o
>> obj-$(CONFIG_DRM_PANEL_NOVATEK_NT37801) += panel-novatek-nt37801.o
>> obj-$(CONFIG_DRM_PANEL_NOVATEK_NT39016) += panel-novatek-nt39016.o
>> obj-$(CONFIG_DRM_PANEL_MANTIX_MLAF057WE51) += panel-mantix-mlaf057we51.o
>> diff --git a/drivers/gpu/drm/panel/panel-novatek-nt37705.c b/drivers/gpu/drm/panel/panel-novatek-nt37705.c
>> new file mode 100644
>> index 000000000000..27bd8072ccd1
>> --- /dev/null
>> +++ b/drivers/gpu/drm/panel/panel-novatek-nt37705.c
>> @@ -0,0 +1,413 @@
>> +// SPDX-License-Identifier: GPL-2.0-only
>> +/*
>> + * Generated with linux-mdss-dsi-panel-driver-generator from vendor device tree.
>> + * Copyright (c) 2026 Luca Weiss <luca.weiss@fairphone.com>
>> + */
>> +
>> +#include <linux/backlight.h>
>> +#include <linux/delay.h>
>> +#include <linux/gpio/consumer.h>
>> +#include <linux/mod_devicetable.h>
>> +#include <linux/module.h>
>> +#include <linux/regulator/consumer.h>
>> +
>> +#include <video/mipi_display.h>
>> +
>> +#include <drm/display/drm_dsc.h>
>> +#include <drm/display/drm_dsc_helper.h>
>
> IIRC this requires
>
> select DRM_DISPLAY_DSC_HELPER
>
> in the Kconfig. Maybe double-check.
Will check. Always difficult to figure out the proper dependencies in a
fully-featured defconfig build.
>
>> +#include <drm/drm_mipi_dsi.h>
>> +#include <drm/drm_modes.h>
>> +#include <drm/drm_panel.h>
>> +#include <drm/drm_probe_helper.h>
>> +
>> +struct nt37705_panel {
>> + struct drm_panel panel;
>> + struct mipi_dsi_device *dsi;
>> + struct drm_dsc_config dsc;
>> + struct regulator_bulk_data *supplies;
>> + struct gpio_desc *reset_gpio;
>> +};
>> +
>> +static const struct regulator_bulk_data nt37705_supplies[] = {
>> + { .supply = "vddio" },
>> + { .supply = "dvdd" },
>> + { .supply = "vci" },
>> +};
>> +
>> +static inline struct nt37705_panel *to_nt37705_panel(struct drm_panel *panel)
>> +{
>> + return container_of_const(panel, struct nt37705_panel, panel);
>
> Either just use container_of or build something that respects the
> input's const-ness.
I really don't get what you mean here? Why is container_of_const() bad
here?
>
>> +}
>> +
>> +static void nt37705_reset(struct nt37705_panel *ctx)
>> +{
>> + gpiod_set_value_cansleep(ctx->reset_gpio, 0);
>> + usleep_range(10000, 11000);
>> + gpiod_set_value_cansleep(ctx->reset_gpio, 1);
>> + usleep_range(5000, 6000);
>> + gpiod_set_value_cansleep(ctx->reset_gpio, 0);
>> + usleep_range(10000, 11000);
>> +}
>> +
>> +static int nt37705_on(struct nt37705_panel *ctx)
>> +{
>> + struct mipi_dsi_multi_context dsi_ctx = { .dsi = ctx->dsi };
>> +
>> + ctx->dsi->mode_flags |= MIPI_DSI_MODE_LPM;
>> +
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf0,
>> + 0x55, 0xaa, 0x52, 0x08, 0x00);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x6f, 0x1b);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xba, 0x18);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x6f, 0x1c);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xba,
>> + 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00,
>> + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
>> + 0x00, 0x00);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x6f, 0x2c);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xba,
>> + 0x00, 0x01, 0x01, 0x01, 0x00, 0x05, 0x05,
>> + 0x05, 0x00, 0x05, 0x05, 0x05, 0x00, 0x00,
>> + 0x00, 0x00);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x6f, 0x3c);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xba,
>> + 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x0b,
>> + 0x0b, 0x00, 0x00, 0x0b, 0x0b, 0x00, 0x00,
>> + 0x00, 0x00);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x6f, 0x4c);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xba,
>> + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
>> + 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00,
>> + 0x00, 0x00);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x6f, 0x5c);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xba,
>> + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
>> + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
>> + 0x01, 0x01);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x6f, 0x6c);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xba,
>> + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x0b,
>> + 0x77, 0x77, 0x00, 0x00, 0x0b, 0x00, 0x1d,
>> + 0x00, 0x1d);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x6f, 0x7c);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xba,
>> + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x0b,
>> + 0x77, 0x77, 0x00, 0x00, 0x0b, 0x00, 0x1d,
>> + 0x00, 0x1d);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x6f, 0x8c);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xba,
>> + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
>> + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
>> + 0x00, 0x00);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x6f, 0x9c);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xba,
>> + 0x11, 0x11, 0x20, 0x02, 0x00, 0x03, 0x00,
>> + 0x00);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x6f, 0xa4);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xba, 0x00, 0xc0, 0x40, 0x08);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x6f, 0xa8);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xba,
>> + 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
>> + 0x22);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x6f, 0xb0);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xba,
>> + 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
>> + 0x22);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf0,
>> + 0x55, 0xaa, 0x52, 0x08, 0x01);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x6f, 0x05);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xc5, 0x15, 0x15, 0x15, 0xdd);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf0,
>> + 0x55, 0xaa, 0x52, 0x08, 0x00);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x6f, 0x0e);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xb5, 0x32);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf0,
>> + 0x55, 0xaa, 0x52, 0x00, 0x00);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xff, 0xaa, 0x55, 0xa5, 0x80);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x6f, 0x19);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf2, 0x00);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x6f, 0x1a);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf4, 0x55);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x6f, 0x11);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf8, 0x01, 0x7f);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x6f, 0x2d);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf8, 0x01, 0x20);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xff, 0xaa, 0x55, 0xa5, 0x81);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x6f, 0x05);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xfe, 0x3c);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x6f, 0x02);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf9, 0x04);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x6f, 0x1e);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xfb, 0x0f);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x6f, 0x0f);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf5, 0x20);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x6f, 0x0d);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xfb, 0x80);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xff, 0xaa, 0x55, 0xa5, 0x83);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x6f, 0x12);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xfe, 0x41);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x6f, 0x13);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xfd, 0x21);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xff, 0xaa, 0x55, 0xa5, 0x00);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x35);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, MIPI_DCS_WRITE_CONTROL_DISPLAY,
>> + 0x20);
>> + mipi_dsi_dcs_set_column_address_multi(&dsi_ctx, 0x0000, 0x045b);
>> + mipi_dsi_dcs_set_page_address_multi(&dsi_ctx, 0x0000, 0x09b3);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, MIPI_DCS_SET_GAMMA_CURVE, 0x00);
>> + mipi_dsi_dcs_set_display_brightness_multi(&dsi_ctx, 0xbb0d);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x6f, 0x04);
>> + mipi_dsi_dcs_set_display_brightness_multi(&dsi_ctx, 0xfe0f);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x81, 0x01, 0x19);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x03, 0x01);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x90, 0x03, 0x03);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x91,
>> + 0x89, 0x28, 0x00, 0x0c, 0xd2, 0x00, 0x02,
>> + 0x2f, 0x01, 0x18, 0x00, 0x07, 0x09, 0x75,
>> + 0x08, 0x34, 0x10, 0xf0);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x2f, 0x02);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x5a, 0x01);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x2f, 0x30);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x6d, 0x00);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x11, 0x00);
>> + mipi_dsi_msleep(&dsi_ctx, 120);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x29, 0x00);
>> + mipi_dsi_msleep(&dsi_ctx, 22);
>> +
>> + return dsi_ctx.accum_err;
>> +}
>> +
>> +static int nt37705_off(struct nt37705_panel *ctx)
>> +{
>> + struct mipi_dsi_multi_context dsi_ctx = { .dsi = ctx->dsi };
>> +
>> + ctx->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
>> +
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x28, 0x00);
>> + mipi_dsi_msleep(&dsi_ctx, 20);
>> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x10, 0x00);
>> + mipi_dsi_msleep(&dsi_ctx, 120);
>> +
>> + return dsi_ctx.accum_err;
>> +}
>> +
>> +static int nt37705_prepare(struct drm_panel *panel)
>> +{
>> + struct nt37705_panel *ctx = to_nt37705_panel(panel);
>> + struct device *dev = &ctx->dsi->dev;
>> + struct drm_dsc_picture_parameter_set pps;
>> + int ret;
>> +
>> + ret = regulator_bulk_enable(ARRAY_SIZE(nt37705_supplies), ctx->supplies);
>> + if (ret < 0) {
>
> Common style is to check for errors with
>
> if (ret)
>
> Here and everywhere else.
At least for regulator_bulk_enable() "ret < 0" is actually more popular
than just "ret".
Kernel doc says "Return: 0 on success or a negative error number on
failure." so a positive integer should in theory never happen so they're
equivalent.
(git grep -h -A2 regulator_bulk_enable | grep if | sed 's|^[ \t]\+||' | sed 's| {$||' | sort | uniq -c)
Thanks for the review!
Regards
Luca
next prev parent reply other threads:[~2026-05-15 14:31 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-01 13:52 [PATCH 0/4] Add Novatek NT37705 panel driver for Fairphone (Gen. 6) Luca Weiss
2026-05-01 13:52 ` [PATCH 1/4] dt-bindings: display: panel: Add Novatek NT37705 Luca Weiss
2026-05-01 15:51 ` Conor Dooley
2026-05-04 13:36 ` Luca Weiss
2026-05-04 20:45 ` Krzysztof Kozlowski
2026-05-04 20:47 ` Krzysztof Kozlowski
2026-05-05 6:40 ` Luca Weiss
2026-05-05 7:25 ` Krzysztof Kozlowski
2026-05-08 7:44 ` Luca Weiss
2026-05-14 15:11 ` Krzysztof Kozlowski
2026-05-14 15:12 ` Krzysztof Kozlowski
2026-05-01 13:52 ` [PATCH 2/4] drm/panel: Add driver for Novatek NT37705 panel Luca Weiss
2026-05-01 18:17 ` David Heidelberg
2026-05-08 8:06 ` Thomas Zimmermann
2026-05-15 14:31 ` Luca Weiss [this message]
2026-05-15 14:36 ` Thomas Zimmermann
2026-05-15 14:43 ` Luca Weiss
2026-05-15 14:49 ` Thomas Zimmermann
2026-05-01 13:52 ` [PATCH 3/4] arm64: defconfig: Enable " Luca Weiss
2026-05-04 22:41 ` Dmitry Baryshkov
2026-05-01 13:52 ` [PATCH 4/4] arm64: dts: qcom: milos-fairphone-fp6: Enable display Luca Weiss
2026-05-04 22:40 ` Dmitry Baryshkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DIJBNGDNXE0L.2I0H4PBDDODOP@fairphone.com \
--to=luca.weiss@fairphone.com \
--cc=airlied@gmail.com \
--cc=andersson@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=jesszhan0024@gmail.com \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=phone-devel@vger.kernel.org \
--cc=robh@kernel.org \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
--cc=~postmarketos/upstreaming@lists.sr.ht \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox