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))
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
*
* @node: node to read
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)
*
* This function parses PHY handle from the Ethernet controller's ofnode
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));