From: Anatolij Gustschin <agust@denx.de>
To: u-boot@lists.denx.de
Cc: Nikhil M Jain <n-jain1@ti.com>
Subject: [PATCH v3 1/7] drivers: core: ofnode: Add panel timing decode.
Date: Sat, 4 Feb 2023 18:41:25 +0100 [thread overview]
Message-ID: <20230204174125.31446-1-agust@denx.de> (raw)
In-Reply-To: <20230131100520.103093-2-n-jain1@ti.com>
From: Nikhil M Jain <n-jain1@ti.com>
ofnode_decode_display_timing supports reading timing parameters from
subnode of display-timings node, for displays supporting multiple
resolution, in case if a display supports single resolution, it fails
reading directly from display-timings node, to support it
ofnode_decode_panel_timing is added.
Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---
Changes in v3:
- add static inline dev_decode_panel_timing() in include/dm/read.h
to fix sandbox test errors when CONFIG_DM_DEV_READ_INLINE enabled
drivers/core/ofnode.c | 47 +++++++++++++++++++++++++++++++++++++++++++
drivers/core/read.c | 6 ++++++
include/dm/ofnode.h | 12 +++++++++++
include/dm/read.h | 20 ++++++++++++++++++
4 files changed, 85 insertions(+)
diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index 4d56b1a767..d08578e9c4 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -991,6 +991,53 @@ int ofnode_decode_display_timing(ofnode parent, int index,
return ret;
}
+int ofnode_decode_panel_timing(ofnode parent,
+ struct display_timing *dt)
+{
+ ofnode timings;
+ u32 val = 0;
+ int ret = 0;
+
+ timings = ofnode_find_subnode(parent, "panel-timings");
+ if (!ofnode_valid(timings))
+ return -EINVAL;
+ memset(dt, 0, sizeof(*dt));
+ ret |= decode_timing_property(timings, "hback-porch", &dt->hback_porch);
+ ret |= decode_timing_property(timings, "hfront-porch", &dt->hfront_porch);
+ ret |= decode_timing_property(timings, "hactive", &dt->hactive);
+ ret |= decode_timing_property(timings, "hsync-len", &dt->hsync_len);
+ ret |= decode_timing_property(timings, "vback-porch", &dt->vback_porch);
+ ret |= decode_timing_property(timings, "vfront-porch", &dt->vfront_porch);
+ ret |= decode_timing_property(timings, "vactive", &dt->vactive);
+ ret |= decode_timing_property(timings, "vsync-len", &dt->vsync_len);
+ ret |= decode_timing_property(timings, "clock-frequency", &dt->pixelclock);
+ dt->flags = 0;
+ if (!ofnode_read_u32(timings, "vsync-active", &val)) {
+ dt->flags |= val ? DISPLAY_FLAGS_VSYNC_HIGH :
+ DISPLAY_FLAGS_VSYNC_LOW;
+ }
+ if (!ofnode_read_u32(timings, "hsync-active", &val)) {
+ dt->flags |= val ? DISPLAY_FLAGS_HSYNC_HIGH :
+ DISPLAY_FLAGS_HSYNC_LOW;
+ }
+ if (!ofnode_read_u32(timings, "de-active", &val)) {
+ dt->flags |= val ? DISPLAY_FLAGS_DE_HIGH :
+ DISPLAY_FLAGS_DE_LOW;
+ }
+ if (!ofnode_read_u32(timings, "pixelclk-active", &val)) {
+ dt->flags |= val ? DISPLAY_FLAGS_PIXDATA_POSEDGE :
+ DISPLAY_FLAGS_PIXDATA_NEGEDGE;
+ }
+ if (ofnode_read_bool(timings, "interlaced"))
+ dt->flags |= DISPLAY_FLAGS_INTERLACED;
+ if (ofnode_read_bool(timings, "doublescan"))
+ dt->flags |= DISPLAY_FLAGS_DOUBLESCAN;
+ if (ofnode_read_bool(timings, "doubleclk"))
+ dt->flags |= DISPLAY_FLAGS_DOUBLECLK;
+
+ return ret;
+}
+
const void *ofnode_get_property(ofnode node, const char *propname, int *lenp)
{
if (ofnode_is_np(node))
diff --git a/drivers/core/read.c b/drivers/core/read.c
index 3e5fea87d8..e0543bbad5 100644
--- a/drivers/core/read.c
+++ b/drivers/core/read.c
@@ -420,6 +420,12 @@ int dev_decode_display_timing(const struct udevice *dev, int index,
return ofnode_decode_display_timing(dev_ofnode(dev), index, config);
}
+int dev_decode_panel_timing(const struct udevice *dev,
+ struct display_timing *config)
+{
+ return ofnode_decode_panel_timing(dev_ofnode(dev), config);
+}
+
ofnode dev_get_phy_node(const struct udevice *dev)
{
return ofnode_get_phy_node(dev_ofnode(dev));
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
index fa9865602d..3f6b0843c5 100644
--- a/include/dm/ofnode.h
+++ b/include/dm/ofnode.h
@@ -974,6 +974,18 @@ struct display_timing;
int ofnode_decode_display_timing(ofnode node, int index,
struct display_timing *config);
+/**
+ * ofnode_decode_panel_timing() - decode display timings
+ *
+ * Decode panel timings from the supplied 'panel-timings' node.
+ *
+ * @node: 'display-timing' node containing the timing subnodes
+ * @config: Place to put timings
+ * Return: 0 if OK, -FDT_ERR_NOTFOUND if not found
+ */
+int ofnode_decode_panel_timing(ofnode node,
+ struct display_timing *config);
+
/**
* ofnode_get_property() - get a pointer to the value of a node property
*
diff --git a/include/dm/read.h b/include/dm/read.h
index cc4f16196f..56ac076c9f 100644
--- a/include/dm/read.h
+++ b/include/dm/read.h
@@ -784,6 +784,20 @@ int dev_read_pci_bus_range(const struct udevice *dev, struct resource *res);
int dev_decode_display_timing(const struct udevice *dev, int index,
struct display_timing *config);
+/**
+ * dev_decode_panel_timing() - decode panel timings
+ *
+ * Decode display timings from the supplied 'panel-timings' node.
+ *
+ * @dev: device to read DT display timings from. The node linked to the device
+ * contains a child node called 'display-timings' which in turn contains
+ * one or more display timing nodes.
+ * @config: place to put timings
+ * Return: 0 if OK, -FDT_ERR_NOTFOUND if not found
+ */
+int dev_decode_panel_timing(const struct udevice *dev,
+ struct display_timing *config);
+
/**
* dev_get_phy_node() - Get PHY node for a MAC (if not fixed-link)
*
@@ -1183,6 +1197,12 @@ static inline int dev_decode_display_timing(const struct udevice *dev,
return ofnode_decode_display_timing(dev_ofnode(dev), index, config);
}
+static inline int dev_decode_panel_timing(const struct udevice *dev,
+ struct display_timing *config)
+{
+ return ofnode_decode_panel_timing(dev_ofnode(dev), config);
+}
+
static inline ofnode dev_get_phy_node(const struct udevice *dev)
{
return ofnode_get_phy_node(dev_ofnode(dev));
--
2.17.1
next prev parent reply other threads:[~2023-02-04 17:41 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-31 10:05 [PATCH v2 0/7] Add u-boot splash screen support for AM62x Nikhil M Jain
2023-01-31 10:05 ` [PATCH v2 1/7] drivers: core: ofnode: Add panel timing decode Nikhil M Jain
2023-01-31 14:16 ` Simon Glass
2023-02-03 4:31 ` [EXTERNAL] " Nikhil M Jain
2023-02-04 17:41 ` Anatolij Gustschin [this message]
2023-02-04 19:11 ` [PATCH v3 " Anatolij Gustschin
2023-01-31 10:05 ` [PATCH v2 2/7] test: dm: test-fdt: Add decode_panel_timing test Nikhil M Jain
2023-01-31 14:16 ` Simon Glass
2023-02-04 19:12 ` Anatolij Gustschin
2023-01-31 10:05 ` [PATCH v2 3/7] drivers: video: simple_panel: make simple panel independent of backlight Nikhil M Jain
2023-02-04 19:17 ` Anatolij Gustschin
2023-01-31 10:05 ` [PATCH v2 4/7] drivers: video: tidss: TIDSS video driver support for AM62x Nikhil M Jain
2023-02-04 19:18 ` Anatolij Gustschin
2023-01-31 10:05 ` [PATCH v2 5/7] board: ti: am62x: am62x: Add splash screen env variables Nikhil M Jain
2023-02-04 19:27 ` Anatolij Gustschin
2023-02-07 16:50 ` Tom Rini
2023-01-31 10:05 ` [PATCH v2 6/7] board: ti: am62x: evm: Add splash screen support Nikhil M Jain
2023-02-04 19:19 ` Anatolij Gustschin
2023-01-31 10:05 ` [PATCH v2 7/7] tools: logos: Add TI logo files Nikhil M Jain
2023-02-04 19:20 ` Anatolij Gustschin
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=20230204174125.31446-1-agust@denx.de \
--to=agust@denx.de \
--cc=n-jain1@ti.com \
--cc=u-boot@lists.denx.de \
/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