static int exynos_dp_dt_parse_panel(struct exynos_dp_device *dp) { int ret; ret = of_get_videomode(dp->dev->of_node, &dp->vm, OF_USE_NATIVE_MODE); if (ret) { DRM_ERROR("failed: of_get_videomode() : %d\n", ret); return ret; } return 0; }
/** * of_get_drm_display_mode - get a drm_display_mode from devicetree * @np: device_node with the timing specification * @dmode: will be set to the return value * @index: index into the list of display timings in devicetree * * This function is expensive and should only be used, if only one mode is to be * read from DT. To get multiple modes start with of_get_display_timings and * work with that instead. */ int of_get_drm_display_mode(struct device_node *np, struct drm_display_mode *dmode, int index) { struct videomode vm; int ret; ret = of_get_videomode(np, &vm, index); if (ret) return ret; drm_display_mode_from_videomode(&vm, dmode); pr_debug("%s: got %dx%d display mode from %s\n", of_node_full_name(np), vm.hactive, vm.vactive, np->name); drm_mode_debug_printmodeline(dmode); return 0; }
static int s6e8aa0_parse_dt(struct s6e8aa0 *ctx) { struct device *dev = ctx->dev; struct device_node *np = dev->of_node; int ret; ret = of_get_videomode(np, &ctx->vm, 0); if (ret < 0) return ret; of_property_read_u32(np, "power-on-delay", &ctx->power_on_delay); of_property_read_u32(np, "reset-delay", &ctx->reset_delay); of_property_read_u32(np, "init-delay", &ctx->init_delay); of_property_read_u32(np, "panel-width-mm", &ctx->width_mm); of_property_read_u32(np, "panel-height-mm", &ctx->height_mm); ctx->flip_horizontal = of_property_read_bool(np, "flip-horizontal"); ctx->flip_vertical = of_property_read_bool(np, "flip-vertical"); return 0; }
static int xylonfb_get_logicvc_configuration(struct xylonfb_data *data) { struct device *dev = &data->pdev->dev; struct device_node *dn = data->device; const struct of_device_id *match; struct videomode vm; int i, ret; XYLONFB_DBG(INFO, "%s", __func__); match = of_match_node(logicvc_of_match, dn); if (!match) { dev_err(dev, "failed match logicvc\n"); return -ENODEV; } ret = of_address_to_resource(dn, 0, &data->resource_mem); if (ret) { dev_err(dev, "failed get mem resource\n"); return ret; } data->irq = of_irq_to_resource(dn, 0, &data->resource_irq); if (data->irq == 0) { dev_err(dev, "failed get irq resource\n"); return ret; } ret = xylon_parse_hw_info(dn, data); if (ret) return ret; for (i = 0; i < LOGICVC_MAX_LAYERS; i++) { ret = xylonfb_parse_layer_info(dn, data, i); if (ret < 0) return ret; if (ret == 0) break; } if (data->flags & XYLONFB_FLAGS_BACKGROUND_LAYER && data->layers == LOGICVC_MAX_LAYERS) { data->flags &= ~XYLONFB_FLAGS_BACKGROUND_LAYER; data->layers--; if (data->console_layer == data->layers) data->console_layer--; dev_warn(dev, "invalid last layer configuration\n"); } memset(&vm, 0, sizeof(vm)); if (!(data->flags & XYLONFB_FLAGS_EDID_VMODE) && (data->vm.name[0] == 0)) { ret = of_get_videomode(dn, &vm, OF_USE_NATIVE_MODE); if (!ret) { fb_videomode_from_videomode(&vm, &data->vm.vmode); sprintf(data->vm.name, "%dx%d", data->vm.vmode.xres, data->vm.vmode.yres); data->flags |= XYLONFB_FLAGS_VMODE_CUSTOM; } } xylonfb_init_ctrl(dn, vm.flags, &data->vm.ctrl); return 0; }