[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACRpkdbZCZiMM_qeqMd9=txVvPVHEzM4szOnPR-gCYdiXW_9eA@mail.gmail.com>
Date: Tue, 7 Mar 2023 23:34:55 +0100
From: Linus Walleij <linus.walleij@...aro.org>
To: Jianhua Lu <lujianhua000@...il.com>,
Konrad Dybcio <konrad.dybcio@...aro.org>
Cc: Thierry Reding <thierry.reding@...il.com>,
Sam Ravnborg <sam@...nborg.org>,
David Airlie <airlied@...il.com>,
Daniel Vetter <daniel@...ll.ch>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
dri-devel@...ts.freedesktop.org,
~postmarketos/upstreaming@...ts.sr.ht, phone-devel@...r.kernel.org
Subject: Re: [PATCH v2 2/2] drm/panel: Add driver for Novatek NT36523
Hi Jianhua,
thanks for your patch!
It appears Konrad is working on a very similar driver, so I suggest merging
them into one Novatek NT36523 driver.
Possibly we can fix this up first and then add Konrads Lenovo-panel with
a patch on top.
On Mon, Feb 20, 2023 at 1:13 PM Jianhua Lu <lujianhua000@...il.com> wrote:
> Add a driver for panels using the Novatek NT36523 display driver IC.
>
> Signed-off-by: Jianhua Lu <lujianhua000@...il.com>
(...)
I like how you abstract the panel with init commands in the panel info.
> +enum dsi_cmd_type {
> + INIT_DCS_CMD,
> + DELAY_CMD,
> +};
> +
> +struct panel_init_cmd {
> + enum dsi_cmd_type type;
> + size_t len;
> + const char *data;
> +};
> +
> +#define _INIT_DCS_CMD(...) { \
> + .type = INIT_DCS_CMD, \
> + .len = sizeof((char[]){__VA_ARGS__}), \
> + .data = (char[]){__VA_ARGS__} }
> +
> +#define _INIT_DELAY_CMD(...) { \
> + .type = DELAY_CMD,\
> + .len = sizeof((char[]){__VA_ARGS__}), \
> + .data = (char[]){__VA_ARGS__} }
I have seen this type of reinvented wheels a few times now. Don't do this.
Look into other recently merged drivers and look how they do it, for example
drivers/gpu/drm/panel/panel-himax-hx8394.c
For example:
- Use mipi_dsi_dcs_write_seq()
- If the delay is just used at one point in the sequence, do not invent
a command language like above for it, open code the delay instead
- Try to decode as much magic as possible, if you look in Konrads
driver you clearly see some standard MIPI commands, I bet you have
some too.
- Maybe use callbacks to send sequences instead of tables, like in
the himax driver?
Other than that it seems like something that could also handle the Lenovo
display, or the other way around, I don't know which driver is the best
starting point, but this one has the right Novatek name at least.
Yours,
Linus Walleij
Powered by blists - more mailing lists