aboutsummaryrefslogtreecommitdiff
path: root/drivers/video
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/atmel_hlcdfb.c2
-rw-r--r--drivers/video/bcm2835.c18
-rw-r--r--drivers/video/console_core.c2
-rw-r--r--drivers/video/console_truetype.c10
-rw-r--r--drivers/video/mali_dp.c11
-rw-r--r--drivers/video/rockchip/rk3288_hdmi.c4
-rw-r--r--drivers/video/rockchip/rk_edp.c8
-rw-r--r--drivers/video/tidss/tidss_drv.c10
-rw-r--r--drivers/video/video-uclass.c40
9 files changed, 63 insertions, 42 deletions
diff --git a/drivers/video/atmel_hlcdfb.c b/drivers/video/atmel_hlcdfb.c
index 2bf19a6684..652ba14180 100644
--- a/drivers/video/atmel_hlcdfb.c
+++ b/drivers/video/atmel_hlcdfb.c
@@ -62,8 +62,6 @@ static int at91_hlcdc_enable_clk(struct udevice *dev)
priv->clk_rate = clk_rate;
- clk_free(&clk);
-
return 0;
}
diff --git a/drivers/video/bcm2835.c b/drivers/video/bcm2835.c
index 14942526f1..63efa762db 100644
--- a/drivers/video/bcm2835.c
+++ b/drivers/video/bcm2835.c
@@ -16,7 +16,7 @@ static int bcm2835_video_probe(struct udevice *dev)
struct video_uc_plat *plat = dev_get_uclass_plat(dev);
struct video_priv *uc_priv = dev_get_uclass_priv(dev);
int ret;
- int w, h, pitch;
+ int w, h, pitch, bpp;
ulong fb_base, fb_size, fb_start, fb_end;
debug("bcm2835: Query resolution...\n");
@@ -41,9 +41,23 @@ static int bcm2835_video_probe(struct udevice *dev)
DCACHE_WRITEBACK);
video_set_flush_dcache(dev, true);
+ bpp = pitch / w;
+ switch (bpp) {
+ case 2:
+ uc_priv->bpix = VIDEO_BPP16;
+ break;
+ case 4:
+ uc_priv->bpix = VIDEO_BPP32;
+ break;
+ default:
+ printf("bcm2835: unexpected bpp %d, pitch %d, width %d\n",
+ bpp, pitch, w);
+ uc_priv->bpix = VIDEO_BPP32;
+ break;
+ }
+
uc_priv->xsize = w;
uc_priv->ysize = h;
- uc_priv->bpix = VIDEO_BPP32;
plat->base = fb_base;
plat->size = fb_size;
diff --git a/drivers/video/console_core.c b/drivers/video/console_core.c
index d17764d0b0..939363653f 100644
--- a/drivers/video/console_core.c
+++ b/drivers/video/console_core.c
@@ -225,7 +225,7 @@ int console_simple_get_font(struct udevice *dev, int seq, struct vidfont_info *i
{
info->name = fonts[seq].name;
- return 0;
+ return info->name ? 0 : -ENOENT;
}
int console_simple_select_font(struct udevice *dev, const char *name, uint size)
diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c
index 14fb81e956..547e5a8d9c 100644
--- a/drivers/video/console_truetype.c
+++ b/drivers/video/console_truetype.c
@@ -397,7 +397,10 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y,
if (vid_priv->colour_bg)
val = 255 - val;
- out = val | val << 8 | val << 16;
+ if (vid_priv->format == VIDEO_X2R10G10B10)
+ out = val << 2 | val << 12 | val << 22;
+ else
+ out = val | val << 8 | val << 16;
if (vid_priv->colour_fg)
*dst++ |= out;
else
@@ -911,7 +914,10 @@ static int truetype_set_cursor_visible(struct udevice *dev, bool visible,
for (i = 0; i < width; i++) {
int out;
- out = val | val << 8 | val << 16;
+ if (vid_priv->format == VIDEO_X2R10G10B10)
+ out = val << 2 | val << 12 | val << 22;
+ else
+ out = val | val << 8 | val << 16;
if (vid_priv->colour_fg)
*dst++ |= out;
else
diff --git a/drivers/video/mali_dp.c b/drivers/video/mali_dp.c
index cbcdb99e1f..dbb2f53861 100644
--- a/drivers/video/mali_dp.c
+++ b/drivers/video/mali_dp.c
@@ -360,25 +360,18 @@ static int malidp_probe(struct udevice *dev)
err = malidp_setup_mode(priv, &timings);
if (err)
- goto fail_timings;
+ return err;
malidp_setup_layer(priv, &timings, MALIDP_LAYER_LV1,
(phys_addr_t)uc_plat->base);
err = malidp_leave_config(priv);
if (err)
- goto fail_timings;
+ return err;
malidp_set_configvalid(priv);
return 0;
-
-fail_timings:
- clk_free(&priv->aclk);
-fail_aclk:
- clk_free(&priv->pxlclk);
-
- return err;
}
static int malidp_bind(struct udevice *dev)
diff --git a/drivers/video/rockchip/rk3288_hdmi.c b/drivers/video/rockchip/rk3288_hdmi.c
index 327ae78712..8bedee55ad 100644
--- a/drivers/video/rockchip/rk3288_hdmi.c
+++ b/drivers/video/rockchip/rk3288_hdmi.c
@@ -67,10 +67,8 @@ static int rk3288_clk_config(struct udevice *dev)
* monitor wants
*/
ret = clk_get_by_index(uc_plat->src_dev, 0, &clk);
- if (ret >= 0) {
+ if (ret >= 0)
ret = clk_set_rate(&clk, 384000000);
- clk_free(&clk);
- }
if (ret < 0) {
debug("%s: Failed to set clock in source device '%s': ret=%d\n",
__func__, uc_plat->src_dev->name, ret);
diff --git a/drivers/video/rockchip/rk_edp.c b/drivers/video/rockchip/rk_edp.c
index 3697d58251..dbd70ad583 100644
--- a/drivers/video/rockchip/rk_edp.c
+++ b/drivers/video/rockchip/rk_edp.c
@@ -1095,20 +1095,16 @@ static int rk_edp_probe(struct udevice *dev)
if (edp_data->chip_type == RK3288_DP) {
ret = clk_get_by_index(dev, 1, &clk);
- if (ret >= 0) {
+ if (ret >= 0)
ret = clk_set_rate(&clk, 0);
- clk_free(&clk);
- }
if (ret) {
debug("%s: Failed to set EDP clock: ret=%d\n", __func__, ret);
return ret;
}
}
ret = clk_get_by_index(uc_plat->src_dev, 0, &clk);
- if (ret >= 0) {
+ if (ret >= 0)
ret = clk_set_rate(&clk, 192000000);
- clk_free(&clk);
- }
if (ret < 0) {
debug("%s: Failed to set clock in source device '%s': ret=%d\n",
__func__, uc_plat->src_dev->name, ret);
diff --git a/drivers/video/tidss/tidss_drv.c b/drivers/video/tidss/tidss_drv.c
index e285f255d7..1380c6b693 100644
--- a/drivers/video/tidss/tidss_drv.c
+++ b/drivers/video/tidss/tidss_drv.c
@@ -107,7 +107,7 @@ const struct dss_features dss_am625_feats = {
.num_planes = 2,
/* note: vid is plane_id 0 and vidl1 is plane_id 1 */
- .vid_name = { "vidl1", "vid1" },
+ .vid_name = { "vidl1", "vid" },
.vid_lite = { true, false },
.vid_order = { 1, 0 },
};
@@ -814,13 +814,13 @@ static int tidss_drv_probe(struct udevice *dev)
priv->bus_format = &dss_bus_formats[8];
/* Common address */
- priv->base_common = dev_remap_addr_index(dev, 0);
+ priv->base_common = dev_remap_addr_name(dev, priv->feat->common);
if (!priv->base_common)
return -EINVAL;
/* plane address setup and enable */
for (i = 0; i < priv->feat->num_planes; i++) {
- priv->base_vid[i] = dev_remap_addr_index(dev, i + 2);
+ priv->base_vid[i] = dev_remap_addr_name(dev, priv->feat->vid_name[i]);
if (!priv->base_vid[i])
return -EINVAL;
}
@@ -841,8 +841,8 @@ static int tidss_drv_probe(struct udevice *dev)
/* video port address clocks and enable */
for (i = 0; i < priv->feat->num_vps; i++) {
- priv->base_ovr[i] = dev_remap_addr_index(dev, i + 4);
- priv->base_vp[i] = dev_remap_addr_index(dev, i + 6);
+ priv->base_ovr[i] = dev_remap_addr_name(dev, priv->feat->ovr_name[i]);
+ priv->base_vp[i] = dev_remap_addr_name(dev, priv->feat->vp_name[i]);
}
ret = clk_get_by_name(dev, "vp1", &priv->vp_clk[0]);
diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c
index f743ed74c8..3571e62ba2 100644
--- a/drivers/video/video-uclass.c
+++ b/drivers/video/video-uclass.c
@@ -123,6 +123,9 @@ int video_reserve(ulong *addrp)
struct udevice *dev;
ulong size;
+ if (IS_ENABLED(CONFIG_SPL_VIDEO_HANDOFF) && spl_phase() == PHASE_BOARD_F)
+ return 0;
+
gd->video_top = *addrp;
for (uclass_find_first_device(UCLASS_VIDEO, &dev);
dev;
@@ -141,16 +144,6 @@ int video_reserve(ulong *addrp)
debug("Video frame buffers from %lx to %lx\n", gd->video_bottom,
gd->video_top);
- if (spl_phase() == PHASE_SPL && CONFIG_IS_ENABLED(VIDEO_HANDOFF)) {
- struct video_handoff *ho;
-
- ho = bloblist_add(BLOBLISTT_U_BOOT_VIDEO, sizeof(*ho), 0);
- if (!ho)
- return log_msg_ret("blf", -ENOENT);
- ho->fb = *addrp;
- ho->size = size;
- }
-
return 0;
}
@@ -208,11 +201,14 @@ int video_fill_part(struct udevice *dev, int xstart, int ystart, int xend,
int video_reserve_from_bloblist(struct video_handoff *ho)
{
+ if (!ho->fb || ho->size == 0)
+ return -ENOENT;
+
gd->video_bottom = ho->fb;
gd->fb_base = ho->fb;
gd->video_top = ho->fb + ho->size;
- debug("Reserving %luk for video using blob at: %08x\n",
- ((unsigned long)ho->size) >> 10, (u32)ho->fb);
+ debug("%s: Reserving %lx bytes at %08x as per bloblist received\n",
+ __func__, (unsigned long)ho->size, (u32)ho->fb);
return 0;
}
@@ -546,6 +542,26 @@ static int video_post_probe(struct udevice *dev)
priv->fb_size = priv->line_length * priv->ysize;
+ /*
+ * Set up video handoff fields for passing video blob to next stage
+ * NOTE:
+ * This assumes that reserved video memory only uses a single framebuffer
+ */
+ if (spl_phase() == PHASE_SPL && CONFIG_IS_ENABLED(BLOBLIST)) {
+ struct video_handoff *ho;
+
+ ho = bloblist_add(BLOBLISTT_U_BOOT_VIDEO, sizeof(*ho), 0);
+ if (!ho)
+ return log_msg_ret("blf", -ENOENT);
+ ho->fb = gd->video_bottom;
+ /* Fill aligned size here as calculated in video_reserve() */
+ ho->size = gd->video_top - gd->video_bottom;
+ ho->xsize = priv->xsize;
+ ho->ysize = priv->ysize;
+ ho->line_length = priv->line_length;
+ ho->bpix = priv->bpix;
+ }
+
if (IS_ENABLED(CONFIG_VIDEO_COPY) && plat->copy_base)
priv->copy_fb = map_sysmem(plat->copy_base, plat->size);