static int display_update_config_from_edid(struct udevice *dp_dev, int *panel_bppp, struct display_timing *timing) { int ret; ret = display_read_timing(dp_dev, timing); if (ret) return ret; return 0; }
/** * rk_display_init() - Try to enable the given display device * * This function performs many steps: * - Finds the display device being referenced by @ep_node * - Puts the VOP's ID into its uclass platform data * - Probes the device to set it up * - Reads the EDID timing information * - Sets up the VOP clocks, etc. for the selected pixel clock and display mode * - Enables the display (the display device handles this and will do different * things depending on the display type) * - Tells the uclass about the display resolution so that the console will * appear correctly * * @dev: VOP device that we want to connect to the display * @fbbase: Frame buffer address * @l2bpp Log2 of bits-per-pixels for the display * @ep_node: Device tree node to process - this is the offset of an endpoint * node within the VOP's 'port' list. * @return 0 if OK, -ve if something went wrong */ int rk_display_init(struct udevice *dev, ulong fbbase, enum video_log2_bpp l2bpp, int ep_node) { struct video_priv *uc_priv = dev_get_uclass_priv(dev); const void *blob = gd->fdt_blob; struct rk_vop_priv *priv = dev_get_priv(dev); int vop_id, remote_vop_id; struct rk3288_vop *regs = priv->regs; struct display_timing timing; struct udevice *disp; int ret, remote, i, offset; struct display_plat *disp_uc_plat; struct udevice *clk; vop_id = fdtdec_get_int(blob, ep_node, "reg", -1); debug("vop_id=%d\n", vop_id); remote = fdtdec_lookup_phandle(blob, ep_node, "remote-endpoint"); if (remote < 0) return -EINVAL; remote_vop_id = fdtdec_get_int(blob, remote, "reg", -1); debug("remote vop_id=%d\n", remote_vop_id); for (i = 0, offset = remote; i < 3 && offset > 0; i++) offset = fdt_parent_offset(blob, offset); if (offset < 0) { debug("%s: Invalid remote-endpoint position\n", dev->name); return -EINVAL; } ret = uclass_find_device_by_of_offset(UCLASS_DISPLAY, offset, &disp); if (ret) { debug("%s: device '%s' display not found (ret=%d)\n", __func__, dev->name, ret); return ret; } disp_uc_plat = dev_get_uclass_platdata(disp); debug("Found device '%s', disp_uc_priv=%p\n", disp->name, disp_uc_plat); disp_uc_plat->source_id = remote_vop_id; disp_uc_plat->src_dev = dev; ret = device_probe(disp); if (ret) { debug("%s: device '%s' display won't probe (ret=%d)\n", __func__, dev->name, ret); return ret; } ret = display_read_timing(disp, &timing); if (ret) { debug("%s: Failed to read timings\n", __func__); return ret; } ret = rkclk_get_clk(CLK_NEW, &clk); if (!ret) { ret = clk_set_periph_rate(clk, DCLK_VOP0 + remote_vop_id, timing.pixelclock.typ); } if (ret) { debug("%s: Failed to set pixel clock: ret=%d\n", __func__, ret); return ret; } rkvop_mode_set(regs, &timing, vop_id); rkvop_enable(regs, fbbase, 1 << l2bpp, &timing); ret = display_enable(disp, 1 << l2bpp, &timing); if (ret) return ret; uc_priv->xsize = timing.hactive.typ; uc_priv->ysize = timing.vactive.typ; uc_priv->bpix = l2bpp; debug("fb=%lx, size=%d %d\n", fbbase, uc_priv->xsize, uc_priv->ysize); return 0; }
static int display_update_config_from_edid(struct udevice *dp_dev, int *panel_bppp, struct display_timing *timing) { return display_read_timing(dp_dev, timing); }