From: John Watts <contact@jookia.org>
To: dri-devel@lists.freedesktop.org
Cc: Neil Armstrong <neil.armstrong@linaro.org>,
Jessica Zhang <quic_jesszhan@quicinc.com>,
Sam Ravnborg <sam@ravnborg.org>, David Airlie <airlied@gmail.com>,
Daniel Vetter <daniel@ffwll.ch>, Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Conor Dooley <conor+dt@kernel.org>,
Shawn Guo <shawnguo@kernel.org>, Heiko Stuebner <heiko@sntech.de>,
Chris Morgan <macromorgan@hotmail.com>,
Jagan Teki <jagan@edgeble.ai>, John Watts <contact@jookia.org>,
Paul Cercueil <paul@crapouillou.net>,
Christophe Branchereau <cbranchereau@gmail.com>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [RFC PATCH v3 3/7] drm/panel: nv3052c: Allow specifying registers per panel
Date: Mon, 25 Sep 2023 12:10:54 +1000 [thread overview]
Message-ID: <20230925021059.451019-4-contact@jookia.org> (raw)
In-Reply-To: <20230925021059.451019-1-contact@jookia.org>
Panel initialization registers are per-display and not tied to the
controller itself. Different panels will specify their own registers.
Attach the sequences to the panel info struct so future panels
can specify their own sequences.
Signed-off-by: John Watts <contact@jookia.org>
Reviewed-by: Jessica Zhang <quic_jesszhan@quicinc.com>
---
.../gpu/drm/panel/panel-newvision-nv3052c.c | 24 ++++++++++++-------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-newvision-nv3052c.c b/drivers/gpu/drm/panel/panel-newvision-nv3052c.c
index 90dea21f9856..382062a79ba8 100644
--- a/drivers/gpu/drm/panel/panel-newvision-nv3052c.c
+++ b/drivers/gpu/drm/panel/panel-newvision-nv3052c.c
@@ -20,11 +20,18 @@
#include <drm/drm_modes.h>
#include <drm/drm_panel.h>
+struct nv3052c_reg {
+ u8 cmd;
+ u8 val;
+};
+
struct nv3052c_panel_info {
const struct drm_display_mode *display_modes;
unsigned int num_modes;
u16 width_mm, height_mm;
u32 bus_format, bus_flags;
+ const struct nv3052c_reg *panel_regs;
+ int panel_regs_len;
};
struct nv3052c {
@@ -36,12 +43,7 @@ struct nv3052c {
struct gpio_desc *reset_gpio;
};
-struct nv3052c_reg {
- u8 cmd;
- u8 val;
-};
-
-static const struct nv3052c_reg nv3052c_panel_regs[] = {
+static const struct nv3052c_reg ltk035c5444t_panel_regs[] = {
// EXTC Command set enable, select page 1
{ 0xff, 0x30 }, { 0xff, 0x52 }, { 0xff, 0x01 },
// Mostly unknown registers
@@ -244,6 +246,8 @@ static inline struct nv3052c *to_nv3052c(struct drm_panel *panel)
static int nv3052c_prepare(struct drm_panel *panel)
{
struct nv3052c *priv = to_nv3052c(panel);
+ const struct nv3052c_reg *panel_regs = priv->panel_info->panel_regs;
+ int panel_regs_len = priv->panel_info->panel_regs_len;
struct mipi_dbi *dbi = &priv->dbi;
unsigned int i;
int err;
@@ -260,9 +264,9 @@ static int nv3052c_prepare(struct drm_panel *panel)
gpiod_set_value_cansleep(priv->reset_gpio, 0);
usleep_range(5000, 20000);
- for (i = 0; i < ARRAY_SIZE(nv3052c_panel_regs); i++) {
- err = mipi_dbi_command(dbi, nv3052c_panel_regs[i].cmd,
- nv3052c_panel_regs[i].val);
+ for (i = 0; i < panel_regs_len; i++) {
+ err = mipi_dbi_command(dbi, panel_regs[i].cmd,
+ panel_regs[i].val);
if (err) {
dev_err(priv->dev, "Unable to set register: %d\n", err);
@@ -463,6 +467,8 @@ static const struct nv3052c_panel_info ltk035c5444t_panel_info = {
.height_mm = 64,
.bus_format = MEDIA_BUS_FMT_RGB888_1X24,
.bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE,
+ .panel_regs = ltk035c5444t_panel_regs,
+ .panel_regs_len = ARRAY_SIZE(ltk035c5444t_panel_regs),
};
static const struct spi_device_id nv3052c_ids[] = {
--
2.42.0
next prev parent reply other threads:[~2023-09-25 2:11 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-25 2:10 [RFC PATCH v3 0/7] Add FS035VG158 panel John Watts
2023-09-25 2:10 ` [RFC PATCH v3 1/7] drm/panel: nv3052c: Document known register names John Watts
2023-09-25 2:10 ` [RFC PATCH v3 2/7] drm/panel: nv3052c: Add SPI device IDs John Watts
2023-09-25 2:10 ` John Watts [this message]
2023-09-25 9:04 ` [RFC PATCH v3 3/7] drm/panel: nv3052c: Allow specifying registers per panel Paul Cercueil
2023-09-25 2:10 ` [RFC PATCH v3 4/7] drm/panel: nv3052c: Add Fascontek FS035VG158 LCD display John Watts
2023-09-25 9:12 ` Paul Cercueil
2023-09-25 9:21 ` John Watts
2023-09-25 9:43 ` Paul Cercueil
2023-09-25 9:48 ` John Watts
2023-09-25 10:34 ` Paul Cercueil
2023-09-25 20:09 ` John Watts
2023-09-25 2:10 ` [RFC PATCH v3 5/7] dt-bindings: display: panel: Clean up leadtek,ltk035c5444t properties John Watts
2023-09-25 2:10 ` [RFC PATCH v3 6/7] dt-bindings: vendor-prefixes: Add fascontek John Watts
2023-09-25 2:10 ` [RFC PATCH v3 7/7] dt-bindings: display: panel: add Fascontek FS035VG158 panel John Watts
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=20230925021059.451019-4-contact@jookia.org \
--to=contact@jookia.org \
--cc=airlied@gmail.com \
--cc=cbranchereau@gmail.com \
--cc=conor+dt@kernel.org \
--cc=daniel@ffwll.ch \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=heiko@sntech.de \
--cc=jagan@edgeble.ai \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=macromorgan@hotmail.com \
--cc=neil.armstrong@linaro.org \
--cc=paul@crapouillou.net \
--cc=quic_jesszhan@quicinc.com \
--cc=robh+dt@kernel.org \
--cc=sam@ravnborg.org \
--cc=shawnguo@kernel.org \
/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
all inboxes | Powered by JetHome®