Skip to content

[6.15] Switch ALL Novatek nt36672a based panels to common driver #89

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: qcom-sdm660-6.15.y
Choose a base branch
from

Conversation

minlexx
Copy link
Member

@minlexx minlexx commented May 29, 2025

Start with lavender. Later add jasmine, tulip, maybe something else?

Fixes #70

@minlexx minlexx changed the title WIP: [6.15] Switch ALL nt36672a based panels to common driver WIP: [6.15] Switch ALL Novatek nt36672a based panels to common driver May 29, 2025
@minlexx minlexx force-pushed the alexeymin/6.15-novatek-tianma-panels branch 4 times, most recently from b5b6c39 to ee6b473 Compare May 30, 2025 13:08
Copy link

@barni2000 barni2000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this driver naming the iovcc supply as vddio

@minlexx minlexx changed the title WIP: [6.15] Switch ALL Novatek nt36672a based panels to common driver [6.15] Switch ALL Novatek nt36672a based panels to common driver May 31, 2025
@minlexx minlexx force-pushed the alexeymin/6.15-novatek-tianma-panels branch from a04cdbe to 4298a2f Compare June 5, 2025 11:34
@minlexx minlexx force-pushed the qcom-sdm660-6.15.y branch from efa5eae to 2116061 Compare June 20, 2025 08:08
@minlexx minlexx force-pushed the alexeymin/6.15-novatek-tianma-panels branch from a6c8128 to 0685fd8 Compare June 20, 2025 08:10
@minlexx minlexx force-pushed the qcom-sdm660-6.15.y branch from 3e83c63 to 9a0feed Compare June 24, 2025 18:00
@minlexx minlexx force-pushed the alexeymin/6.15-novatek-tianma-panels branch from 0685fd8 to 711a648 Compare June 24, 2025 18:02
@minlexx minlexx force-pushed the qcom-sdm660-6.15.y branch from e1fff71 to 70f47ab Compare June 25, 2025 07:35
minlexx and others added 7 commits June 25, 2025 16:34
Use the new refcounted allocation API devm_drm_panel_alloc() to allocate
the panel in place of devm_kzalloc().

Remove call to drm_panel_init() because it's part of devm_drm_panel_alloc().

Signed-off-by: Alexey Minnekhanov <alexeymin@postmarketos.org>
The driver was made with extensibility in mind, but it is not enough.
In preparation for extending the driver with support for more panels,
stop using arrays of nt36672a_panel_cmd, which incorrectly assumed
that all panels have init sequences consisting of 2 bytes. This is
not true for all panels using nt36672a controller. Instead, use
dedicated init and shutdown functions for each panel. This allows
for more flexibility, solving at least 2 problems:

 * different DSI commands length for different panels
 * different delays for msleep() calls for different panels

Make it so that each panel can initialize the way it prefers.

Combine init sequences in .on_cmds_1 and .on_cmds_2 into a new init
finction, and code from .off_cmds to new off_cmds function. Struct
nt36672a_panel_cmd and function nt36672a_send_cmds() are no longer
needed, so remove them.

While doing this, also switch to modern multi-api for sending
commands, which greatly simplifies error handling using accumulated
error counter.

This refactoring change should have no functional effect on existing
devices.

Signed-off-by: Alexey Minnekhanov <alexeymin@postmarketos.org>
Since this driver should represent not only devices manufactured by
Tianma Micro-electronics, but also from other companies, it makes more
sense to name it according to what driver file name already is: novatek.

This does not change neither module file name nor Kconfig symbol, only
driver identification in dmesg. This makes it possible to e.g. grep
dmesg for "novatek" and get messages from both nt36672a-based panel and
Novatek touchscreen.

Signed-off-by: Alexey Minnekhanov <alexeymin@postmarketos.org>
Add support for Tianma video mode panel based on nt36672a, used in
Xiaomi Redmi Note 7 smartphone (xiaomi-lavender). Tianma panel is
one of the 3 panel variants that you can find inside xiaomi-lavender.

Signed-off-by: Alexey Minnekhanov <alexeymin@postmarketos.org>
Add support for Tianma video mode panel based on nt36672a, used in
Xiaomi Mi A2 smartphone (xiaomi-jasmine). It shares some code with
already supported panel in this driver for xiaomi-lavender.

Signed-off-by: Alexey Minnekhanov <alexeymin@postmarketos.org>
Add support for Tianma video mode panel based on nt36672a, used in
Xiaomi Redmi Note 6 Pro smartphone (xiaomi-tulip). It shares almost
exactly the same init/off sequences with already supported panel in this
driver for Redmi Note 7 (xiaomi-lavender).

Signed-off-by: Alexey Minnekhanov <alexeymin@postmarketos.org>
Add support for TXD video mode panel based on nt36672a, used in
Asus Zenfone Max Pro M1 smartphone (asus-x00td).

Signed-off-by: iAboothahir <aboothahirpkd@gmail.com>
@minlexx minlexx force-pushed the alexeymin/6.15-novatek-tianma-panels branch from 711a648 to 17d37f6 Compare June 25, 2025 13:35
minlexx and others added 5 commits June 26, 2025 00:56
use touch in follower mode

Signed-off-by: Alexey Minnekhanov <alexeymin@postmarketos.org>
…smine)

use touch in follower mode

Signed-off-by: Alexey Minnekhanov <alexeymin@postmarketos.org>
Sometimes Novatek touchscreen is paired together with Novatek panel,
and they both need to be powered together in sync.

Add support for nvt-ts driver to operate in panel follower mode, in
which touchscreen isn't in full control of its lifecycle.
This is managed using callbacks from panel, to get informed when the
panel is powered on and off. From there we can match the nvt-ts
device's power state to that of the panel.

Without this probing touchscreen before panel sometimes randomly fails
with I2C read errors.

 * split some code from probe function to separate initial_power_on
   function, which is called once from panel_prepared callback, or
   from probe function, depending on mode;
 * update Kconfig to depend on DRM.

Signed-off-by: Alexey Minnekhanov <alexeymin@postmarketos.org>
@minlexx minlexx force-pushed the alexeymin/6.15-novatek-tianma-panels branch from 17d37f6 to 0f5e5ed Compare June 26, 2025 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Add real panel driver for lavender and panel-follower mode for nvt-ts
3 participants