Skip to content

Commit

Permalink
video: FB driver v4.3 update
Browse files Browse the repository at this point in the history
Added:
- v4.3 update, see RELEASE_NOTES.md for changes from v4.0
  • Loading branch information
gpantar-xylon committed Feb 27, 2018
1 parent 1601e4a commit f7038fe
Show file tree
Hide file tree
Showing 14 changed files with 430 additions and 508 deletions.
46 changes: 46 additions & 0 deletions RELEASE_NOTES.md
Expand Up @@ -7,6 +7,52 @@ History
This history table shows versions of all subcomponents used by the xylonfb in the moment of the release.


v4.3
----
- release date (YYMMDD):180227
- released by: GP
- added param put-vscreeninfo-exact in dts that enables setting the
exact video mode over the ioctl FBIOPUT_VSCREENINFO, when not set
mode is determined only from xres and yres param of fb_var_screeninfo

Component SW/HW | Version | Note
------------------|-------------|--------
Linux Kernel | 4.9 | -
logiCVC IP | 5.4.1 | -
u-boot xilinx | 2017.1 | -

v4.2
----
- release date (YYMMDD):170522
- released by: DS
- adv7511 driver updated for compiling on 4.5 kernel version

Component SW/HW | Version | Note
------------------|-------------|--------
Linux Kernel | 4.9 | -
logiCVC IP | 5.1.1 | -
u-boot xilinx | 2017.1 | -


v4.1
----
- release date (YYMMDD):170411
- released by: DS
- pixel variable defined, xylonfb_set_color_hw function
- added XYLONFB_HW_ACCESS_INT_STAT_REG ioctl
- removed unnecessary code in pan_display that wrote to the layer position registers.
- added XYLONFB_HW_ACCESS_CTRL_REG ioctl used in layers synchronization
- 1. If console-layer is not specified in dts, layer type is not checked for console compatibility
- 2. video-mode is preferred mode, even if EDID is obtained. EDID-preferred mode is used only if video-mode is not specified in dts

Component SW/HW | Version | Note
------------------|-------------|--------
Linux Kernel | 4.4 | Tested on Linux Kernel 4.4
logiCVC IP | 5.1.1 | -
u-boot xilinx | 2016.01 | used for testing



v4.0
----
- release date (YYMMDD):160707
Expand Down
3 changes: 2 additions & 1 deletion doc/users_manual.txt
Expand Up @@ -467,7 +467,7 @@ selected logiCVC layer. To show that application can work on different logiCVC
layer types and formats, same colored rectangles will be drawn to different
logiCVC layers regarding color depth and alpha pixel byte formats. On 8 bpp, 16 bpp
and 32 bpp layers test application will draw two images - Xylon and Xilinx logos.
On 8 bpp alpha layers test application will draw grayscale lena.bmp image.
On 8 bpp alpha layers test application will draw grayscale lena512.pgm image.

Xylon FB driver interface functions:
The test application tests specific Xylon FB driver IOCTL functions which can
Expand Down Expand Up @@ -601,6 +601,7 @@ xylon_fb {
console-layer = <3>;
vsync-irq;
video-mode = "1280x1024";
//video-mode = "800x480"; // select custom mode for TM050RBH01
};

adv7511: adv7511@39 {
Expand Down
45 changes: 33 additions & 12 deletions doc/xylon-fb.txt
Expand Up @@ -20,31 +20,43 @@ Optional properties:
8 rgb clut16
8 rgb clut32
8 rgb layer
8 rgb pixel
8 rgb pixel
16 rgb layer
16 rgb pixel
16 rgb pixel
30 rgb layer
32 rgb layer
32 rgb layer
32 rgb pixel
16 yuv layer
20 yuv layer
30 yuv layer
32 yuv layer
16 yuv layer
20 yuv layer
30 yuv layer
32 yuv layer
32 yuv pixel

======================================

- edid-video-mode: video mode set to preferred EDID resolution
If omitted, configured according to "video-mode" property.
If "video-mode" is also present, it is used as guidance for selecting
closest resolution supported by EDID.
- edid-print: prints EDID parameters to the system log
Must be used only with "edid-video-mode".
If omitted, functionality is not available.
- vsync-irq: generate interrupt on vertical synchronization pulse
- video-mode: preferred video mode resolution
If omitted, configures logiCVC to default video resolution "1024x768".
- M: Coordinated Video Timings (CVT)
If omitted, configures logiCVC to default video resolution "1024x768" or
custom video mode defined in display-timings (inside logiCVC block).
- put-vscreeninfo-exact: when enabled then ioctl FBIOPUT_VSCREENINFO applies exact video mode,
If omitted video mode is retrieved from xres and yres param of fb_var_screeninfo,
by looking in the linux video mode database (fb_find_mode)
Following flags are related only to VESA Coordinated Video Timings (CVT).
CVT allows using any (i.e. nonstandard) resolution - all video timings are
calculated (! -> no predefined timings) using resolution and other timing flags.
Use CVT only if display supports that exact resolution and timings.
Format: <xres>x<yres>[M][R][-<bpp>][@<refresh>][i][m] (e.g. 1024x768MR-8@60m).
If 'M' is not present, other flags are ignored.
- M: enable VESA Coordinated Video Timings (CVT)
- R: reduced video timings for digital displays
- i: calculate for an interlaced mode
- m: add margins to calculation calculation
- m: add margins to calculation
(1.8% of xres rounded down to 8 pixels and 1.8% of yres).
Example:

Expand All @@ -56,5 +68,14 @@ Example:
edid-video-mode;
edid-print;
vsync-irq;
video-mode = "1920x1080MR";
// Video Mode :
video-mode = "1920x1080MR"; // HD video mode VESA calculated (reduced timnigs)
//video-mode = "1920x1080M"; // HD video mode VESA calculated
//video-mode = "1280x720"; // HD video mode from Linux Kernel video mode databese
// if no video mode is defined then display-timings are used (defined inside logiCVC),
// or if they are not defined then default 1024x768 is used
put-vscreeninfo-exact; // if enabled then ioctl FBIOPUT_VSCREENINFO applies exact video mode,
// othervise video mode is retrieved from xres and yres param of fb_var_screeninfo
// by looking in the linux video mode database (fb_find_mode)

};
2 changes: 1 addition & 1 deletion doc/xylon-logicvc.txt
Expand Up @@ -151,7 +151,7 @@ Example:
};

display-timings {
native-mode = <&wsxga>;
native-mode = <&wsxga>; /* native mode is selected here */
hd720p: 1280x720 {
clock-frequency = <74250000>;
hactive = <1280>;
Expand Down
4 changes: 4 additions & 0 deletions kernel_src/drivers/video/fbdev/xylon/adv7511.c
Expand Up @@ -1584,7 +1584,11 @@ static int adv7511_probe(struct i2c_client *client, const struct i2c_device_id *
state->rgb_quantization_range_ctrl->is_private = true;

state->pad.flags = MEDIA_PAD_FL_SINK;
#if LINUX_VERSION_CODE <= KERNEL_VERSION(4, 4, 0)
err = media_entity_init(&sd->entity, 1, &state->pad, 0);
#else
err = media_entity_pads_init(&sd->entity, 1, &state->pad);
#endif
if (err)
goto err_hdl;

Expand Down
83 changes: 58 additions & 25 deletions kernel_src/drivers/video/fbdev/xylon/xylonfb_core.c
Expand Up @@ -133,8 +133,6 @@ static irqreturn_t xylonfb_isr(int irq, void *dev_id)
void __iomem *dev_base = data->dev_base;
u32 isr;

XYLONFB_DBG(CORE, "%s", __func__);

isr = readl(dev_base + LOGICVC_INT_STAT_ROFF);
if (isr & LOGICVC_INT_V_SYNC) {
writel(LOGICVC_INT_V_SYNC, dev_base + LOGICVC_INT_STAT_ROFF);
Expand Down Expand Up @@ -225,6 +223,10 @@ static int xylonfb_check_var(struct fb_var_screeninfo *var,
var->yres = LOGICVC_MIN_VRES;
if (var->yres > data->max_v_res)
var->yres = data->max_v_res;
if (fd->buffer_offset) {
if (var->yres > fd->buffer_offset)
return -EINVAL;
}

if (var->xres_virtual < var->xres)
var->xres_virtual = var->xres;
Expand Down Expand Up @@ -290,15 +292,40 @@ static int xylonfb_set_par(struct fb_info *fbi)

XYLONFB_DBG(INFO, "%s", __func__);

XYLONFB_DBG(INFO, "%s var mode: [%dx%d]&%d, (%d %d)(%d %d)(%d %d)",
__func__,
fbi->var.xres, fbi->var.yres, fbi->var.pixclock,
fbi->var.left_margin, fbi->var.right_margin,
fbi->var.upper_margin, fbi->var.lower_margin,
fbi->var.hsync_len, fbi->var.vsync_len);

if (data->flags & XYLONFB_FLAGS_VMODE_SET)
return 0;

if (!(data->flags & XYLONFB_FLAGS_EDID_VMODE) &&
((fbi->var.xres == data->vm_active.vmode.xres) ||
(fbi->var.yres == data->vm_active.vmode.yres)))
resolution_change = false;
else
/* check if params changed */
resolution_change = true;
if (!(data->flags & XYLONFB_FLAGS_EDID_VMODE)) {
struct fb_videomode *vmact = &data->vm_active.vmode;
if (data->flags & XYLONFB_FLAGS_PUT_VSCREENINFO_EXACT) {
if ((fbi->var.xres == vmact->xres) &&
(fbi->var.yres == vmact->yres) &&
(fbi->var.left_margin == vmact->left_margin) &&
(fbi->var.right_margin == vmact->right_margin) &&
(fbi->var.upper_margin == vmact->upper_margin) &&
(fbi->var.lower_margin == vmact->lower_margin) &&
(fbi->var.hsync_len == vmact->hsync_len) &&
(fbi->var.vsync_len == vmact->vsync_len) &&
(fbi->var.pixclock == vmact->pixclock))
{
resolution_change = false;
}
}
else {
if ((fbi->var.xres == vmact->xres) &&
(fbi->var.yres == vmact->yres))
resolution_change = false;
}
}

if (resolution_change || (data->flags & XYLONFB_FLAGS_VMODE_INIT)) {
if (!(data->flags & XYLONFB_FLAGS_VMODE_INIT)) {
Expand Down Expand Up @@ -520,11 +547,10 @@ static int xylonfb_set_color_hw(u16 *t, u16 *r, u16 *g, u16 *b,
while (len > 0) {
if (t)
a = t[id];
((u32 *)(fbi->pseudo_palette))[id] =
(((a & 0xE0) << to) |
((r[id] & 0xE0) << ro) |
((g[id] & 0xE0) << go) |
((b[id] & 0xC0) << bo));
pixel = ((((a & 0xE0) >> 5) << to) |
(((r[id] & 0xE0) >> 5) << ro) |
(((g[id] & 0xE0) >> 5) << go) |
(((b[id] & 0xC0) >> 6) << bo));
((u32 *)(fbi->pseudo_palette))[id] =
(pixel << 16) | pixel;
len--;
Expand All @@ -536,10 +562,10 @@ static int xylonfb_set_color_hw(u16 *t, u16 *r, u16 *g, u16 *b,
if (t)
a = t[id];
((u32 *)(fbi->pseudo_palette))[id] =
(((a & 0xFC) << to) |
((r[id] & 0xF8) << ro) |
((g[id] & 0xFC) << go) |
((b[id] & 0xF8) << bo));
((((a & 0xFC) >> 2) << to) |
(((r[id] & 0xF8) >> 3) << ro) |
(((g[id] & 0xFC) >> 2) << go) |
(((b[id] & 0xF8) >> 3) << bo));
len--;
id++;
} break;
Expand Down Expand Up @@ -760,10 +786,7 @@ static int xylonfb_pan_display(struct fb_var_screeninfo *var,
data->reg_access.set_reg_val(var->yoffset, ld->base,
LOGICVC_LAYER_VOFF_ROFF, ld);
}
data->reg_access.set_reg_val((fbi->var.xres - 1), ld->base,
LOGICVC_LAYER_HPOS_ROFF, ld);
data->reg_access.set_reg_val((fbi->var.yres - 1), ld->base,
LOGICVC_LAYER_VPOS_ROFF, ld);

if (data->flags & XYLONFB_FLAGS_DYNAMIC_LAYER_ADDRESS) {
ld->fb_pbase_active = ld->fb_pbase +
((var->xoffset * (fd->bpp / 8)) +
Expand Down Expand Up @@ -1228,7 +1251,7 @@ static int xylonfb_set_timings(struct fb_info *fbi, int bpp)
u32 xres, yres;
#endif

XYLONFB_DBG(INFO, "%s", __func__);
XYLONFB_DBG(INFO, "%s flags 0x%x", __func__, data->flags);

if ((data->flags & XYLONFB_FLAGS_VMODE_INIT) &&
(data->flags & XYLONFB_FLAGS_VMODE_CUSTOM) &&
Expand All @@ -1248,9 +1271,12 @@ static int xylonfb_set_timings(struct fb_info *fbi, int bpp)
if ((data->flags & XYLONFB_FLAGS_EDID_VMODE) &&
(data->flags & XYLONFB_FLAGS_EDID_READY)) {
if (data->flags & XYLONFB_FLAGS_VMODE_INIT) {
#if defined(CONFIG_FB_XYLON_MISC)
fb_var = *(data->misc.var_screeninfo);
#endif
rc = fb_find_mode(&fb_var, fbi, xylonfb_mode_option,
fbi->monspecs.modedb,
fbi->monspecs.modedb_len,
&xylonfb_vm.vmode, bpp);
if (!rc)
return -EINVAL;
} else {
rc = fb_find_mode(&fb_var, fbi, xylonfb_mode_option,
fbi->monspecs.modedb,
Expand All @@ -1272,7 +1298,14 @@ static int xylonfb_set_timings(struct fb_info *fbi, int bpp)
&fbi->monspecs.modedb[0]);
#endif
}
} else {
}
/* get video mode directly from fb_var_screeninfo */
else if ( data->flags & XYLONFB_FLAGS_PUT_VSCREENINFO_EXACT) {
fb_var = fbi->var;
XYLONFB_DBG(INFO, "%s exact mode", __func__);
}
else {
XYLONFB_DBG(INFO, "%s fb_find_mode %s ", __func__, xylonfb_mode_option);
rc = fb_find_mode(&fb_var, fbi, xylonfb_mode_option, NULL, 0,
&xylonfb_vm.vmode, bpp);
}
Expand Down
3 changes: 2 additions & 1 deletion kernel_src/drivers/video/fbdev/xylon/xylonfb_core.h
Expand Up @@ -28,7 +28,7 @@
#define XYLONFB_DRIVER_NAME "xylonfb"
#define XYLONFB_DEVICE_NAME "logicvc"
#define XYLONFB_DRIVER_DESCRIPTION "Xylon logiCVC frame buffer driver"
#define XYLONFB_DRIVER_VERSION "4.0"
#define XYLONFB_DRIVER_VERSION "4.3"

#define INFO 1
#define CORE 2
Expand Down Expand Up @@ -72,6 +72,7 @@
#define XYLONFB_FLAGS_MISC_ADV7511 (1 << 19)
#define XYLONFB_FLAGS_ADV7511_SKIP (1 << 20)
#define XYLONFB_FLAGS_ACTIVATE_NEXT_OPEN (1 << 21)
#define XYLONFB_FLAGS_PUT_VSCREENINFO_EXACT (1 << 22)

/* Xylon FB driver color formats */
enum xylonfb_color_format {
Expand Down

0 comments on commit f7038fe

Please sign in to comment.