rockchip: video: Convert to use APIs which support live DT
authorKever Yang <kever.yang@rock-chips.com>
Wed, 19 Feb 2020 01:45:38 +0000 (09:45 +0800)
committerKever Yang <kever.yang@rock-chips.com>
Tue, 28 Apr 2020 10:05:08 +0000 (18:05 +0800)
Use ofnode_ or dev_ APIs instead of fdt_ and fdtdec_ APIs so that the
driver can support live DT.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
drivers/video/rockchip/rk3288_mipi.c
drivers/video/rockchip/rk3399_mipi.c
drivers/video/rockchip/rk_edp.c
drivers/video/rockchip/rk_lvds.c
drivers/video/rockchip/rk_mipi.c

index f4444b9c3487494d20ef524967ea512d3bd354b1..71d3faf169dec23b4e9801a91736ddcbac3a1b80 100644 (file)
@@ -8,7 +8,6 @@
 #include <clk.h>
 #include <display.h>
 #include <dm.h>
-#include <fdtdec.h>
 #include <panel.h>
 #include <regmap.h>
 #include "rk_mipi.h"
index 74ebe770a9521b13d7b515aa79592de404fb3fed..cfaa37797eda6f1f3bd70a5cf21a64999e0e1083 100644 (file)
@@ -8,7 +8,6 @@
 #include <clk.h>
 #include <display.h>
 #include <dm.h>
-#include <fdtdec.h>
 #include <panel.h>
 #include <regmap.h>
 #include "rk_mipi.h"
index cf84b886e72d2dc700cda202bec250f122309e16..99b16cd95edc021fe96f9481d31807a3497340c9 100644 (file)
@@ -997,7 +997,7 @@ static int rk_edp_ofdata_to_platdata(struct udevice *dev)
 {
        struct rk_edp_priv *priv = dev_get_priv(dev);
 
-       priv->regs = (struct rk3288_edp *)devfdt_get_addr(dev);
+       priv->regs = dev_read_addr_ptr(dev);
        priv->grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
 
        return 0;
index 404af7eb6e88bd44dbd0b502959a6756d5667722..c92c2e3c6c0eaaa9de020d96ec3b60b3bb4386d0 100644 (file)
@@ -172,13 +172,11 @@ int rk_lvds_read_timing(struct udevice *dev, struct display_timing *timing)
 static int rk_lvds_ofdata_to_platdata(struct udevice *dev)
 {
        struct rk_lvds_priv *priv = dev_get_priv(dev);
-       const void *blob = gd->fdt_blob;
-       int node = dev_of_offset(dev);
        int ret;
-       priv->regs = (void *)devfdt_get_addr(dev);
+       priv->regs = dev_read_addr_ptr(dev);
        priv->grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
 
-       ret = fdtdec_get_int(blob, node, "rockchip,output", -1);
+       ret = dev_read_s32_default(dev, "rockchip,output", -1);
        if (ret != -1) {
                priv->output = ret;
                debug("LVDS output : %d\n", ret);
@@ -187,7 +185,7 @@ static int rk_lvds_ofdata_to_platdata(struct udevice *dev)
                priv->output = LVDS_OUTPUT_RGB;
        }
 
-       ret = fdtdec_get_int(blob, node, "rockchip,data-mapping", -1);
+       ret = dev_read_s32_default(dev, "rockchip,data-mapping", -1);
        if (ret != -1) {
                priv->format = ret;
                debug("LVDS data-mapping : %d\n", ret);
@@ -196,7 +194,7 @@ static int rk_lvds_ofdata_to_platdata(struct udevice *dev)
                priv->format = LVDS_FORMAT_JEIDA;
        }
 
-       ret = fdtdec_get_int(blob, node, "rockchip,data-width", -1);
+       ret = dev_read_s32_default(dev, "rockchip,data-width", -1);
        if (ret != -1) {
                debug("LVDS data-width : %d\n", ret);
                if (ret == 24) {
index a77bdfd24ddacf0d67cd2fdb9d27b364caf0d9ec..f1c21bb8d7e436d1743f77675afbaf783f59df4e 100644 (file)
@@ -8,7 +8,6 @@
 #include <clk.h>
 #include <display.h>
 #include <dm.h>
-#include <fdtdec.h>
 #include <panel.h>
 #include <regmap.h>
 #include "rk_mipi.h"
@@ -76,7 +75,7 @@ static void rk_mipi_dsi_write(uintptr_t regs, u32 reg, u32 val)
 int rk_mipi_dsi_enable(struct udevice *dev,
                       const struct display_timing *timing)
 {
-       int node, timing_node;
+       ofnode node, timing_node;
        int val;
        struct rk_mipi_priv *priv = dev_get_priv(dev);
        uintptr_t regs = priv->regs;
@@ -119,10 +118,10 @@ int rk_mipi_dsi_enable(struct udevice *dev,
        rk_mipi_dsi_write(regs, VID_PKT_SIZE, 0x4b0);
 
        /* Set dpi color coding depth 24 bit */
-       timing_node = fdt_subnode_offset(gd->fdt_blob, dev_of_offset(dev),
-                                                                        "display-timings");
-       node = fdt_first_subnode(gd->fdt_blob, timing_node);
-       val = fdtdec_get_int(gd->fdt_blob, node, "bits-per-pixel", -1);
+       timing_node = ofnode_find_subnode(dev->node, "display-timings");
+       node = ofnode_first_subnode(timing_node);
+
+       val = ofnode_read_u32_default(node, "bits-per-pixel", -1);
        switch (val) {
        case 16:
                rk_mipi_dsi_write(regs, DPI_COLOR_CODING, DPI_16BIT_CFG_1);