mt6735 设备信息的XDPI,YDPI显示问题
时间:10-02
整理:3721RD
点击:
[DESCRIPTION]
CTS报告中反馈设备信息需要修改:
默认如下:
例如:
客制化: 需要修改成实际值
[SOLUTION]
请先到alps\mediatek\kernel\drivers\video\mtkfb.c
(或者alps\mediatek\platform\commonkernel\drivers\video\mtkfb.c KK版本)
这只文件中的mtkf_ioctl函数MTKFB_GET_DISPLAY_IF_INFORMATION分支中确认是否有包含如下标灰
部分代码:
如果有,那么只需要在对应的LCM driver中的lcm_get_params函数中添加如下参数即可
params->physical_width = xxx;
params->physical_height = xxx;
xxx为当前使用的屏的实际size,单位是mm,且为是整数
如果没有,那么请按照如下添加:
1.alps\mediatek\custom\common\kernel\lcm\inc\lcm_drv.h 中
typedef struct
{
LCM_TYPE type;
LCM_CTRL ctrl; //! how to control LCM registers
/* common parameters */
unsigned int width;
unsigned int height;
unsigned int io_select_mode; //DBI or DPI should select IO mode according to chip spec
/* particular parameters */
LCM_DBI_PARAMS dbi;
LCM_DPI_PARAMS dpi;
LCM_DSI_PARAMS dsi;
//MTK begin
unsigned int active_width;
unsigned int active_height;
//MTK end
} LCM_PARAMS;
2.alps\mediatek\source\kernel\drivers\video\disp_drv.c中添加
//MTK begin
UINT32 DISP_GetActiveHeight(void)
{
disp_drv_init_context();
if(lcm_params)
{
printk("[wwy]lcm_pARMs->active_height = %d\n",lcm_params->active_height);
return lcm_params->active_height;
}
else
{
printk("WARNING! get active_height before display driver inited!\n");
return 0;
}
}
UINT32 DISP_GetActiveWidth(void)
{
disp_drv_init_context();
if(lcm_params)
{
printk("[wwy]lcm_parms->active_width = %d\n",lcm_params->active_width);
return lcm_params->active_width;
}
else
{
printk("WARNING! get active_width before display driver inited!\n");
return 0;
}
}
//MTK end
3.alps\mediatek\source\kernel\drivers\video\disp_drv.h中申明
//MTK begin
UINT32 DISP_GetActiveWidth(void);
UINT32 DISP_GetActiveHeight(void);
//MTK end
4.alps\mediatek\source\kernel\drivers\video\mtkfb.c 添加
static int mtkfb_check_var(struct fb_var_screeninfo *var, struct fb_info *fbi)
{
.............
var->red.msb_right = var->green.msb_right =
var->blue.msb_right = var->transp.msb_right = 0;
var->activate = FB_ACTIVATE_NOW;
//MTK begin
if(var->height <= 0)
{
var->height = UINT_MAX;
}
if(var->width <= 0)
{
var->width = UINT_MAX;
}
//MTK end
var->grayscale = 0;
var->nonstd = 0;
var->pixclock = UINT_MAX;
var->left_margin = UINT_MAX;
var->right_margin = UINT_MAX;
var->upper_margin = UINT_MAX;
var->lower_margin = UINT_MAX;
var->hsync_len = UINT_MAX;
var->vsync_len = UINT_MAX;
..........
}
static int mtkfb_fbinfo_init(struct fb_info *info)
{
struct mtkfb_device *fbdev = (struct mtkfb_device *)info->par;
struct fb_var_screeninfo var;
int r = 0;
MSG_FUNC_ENTER();
BUG_ON(!fbdev->fb_va_base);
info->fbops = &mtkfb_ops;
info->flags = FBINFO_FLAG_DEFAULT;
info->screen_base = (char *) fbdev->fb_va_base;
info->screen_size = fbdev->fb_size_in_byte;
info->pseudo_palette = fbdev->pseudo_palette;
r = fb_alloc_cmap(&info->cmap, 16, 0);
if (r != 0)
PRNERR("unable to allocate color map memory\n");
// setup the initial video mode (RGB565)
mEMSet(&var, 0, sizeof(var));
var.xres = MTK_FB_XRES;
var.yres = MTK_FB_YRES;
var.xres_virtual = MTK_FB_XRESV;
var.yres_virtual = MTK_FB_YRESV;
var.bits_per_pixel = 16;
var.red.offset = 11; var.red.length = 5;
var.green.offset = 5; var.green.length = 6;
var.blue.offset = 0; var.blue.length = 5;
//MTK begin
var.width = DISP_GetActiveWidth();
var.height = DISP_GetActiveHeight();
//MTK end
var.activate = FB_ACTIVATE_NOW;
r = mtkfb_check_var(&var, info);
if (r != 0)
PRNERR("failed to mtkfb_check_var\n");
info->var = var;
r = mtkfb_set_par(info);
if (r != 0)
PRNERR("failed to mtkfb_set_par\n");
MSG_FUNC_LEAVE();
return r;
}
5.在实际用到的屏的.c文件中(类似这样nt35516_qhd_dsi_cmd_ipsboe.c的文件)
做如下修改:
在lcm_get_params(LCM_PARAMS *params)中增加:
params->active_width = active_width;
params->active_height = active_height;
这样就能根据实际的屏幕尺寸算出准确的xdpi,ydpi.
另外請注意這裡的active_width/active_height 是指屏的physical size. 也就是寬高的实际大小,单位mm,且需要为整数
而不是resolution.. 請從panel spec找出對應的physical size.
Example:
–var->active_width = 90 (mm)
–var->active_height = 154 (mm)
–And we can get
–X DPI = 600 * 25.4 / 90 = 169.33
–Y DPI = 1024 * 25.4 / 153 = 169.99
CTS报告中反馈设备信息需要修改:
默认如下:
例如:
客制化: 需要修改成实际值
[SOLUTION]
请先到alps\mediatek\kernel\drivers\video\mtkfb.c
(或者alps\mediatek\platform\commonkernel\drivers\video\mtkfb.c KK版本)
这只文件中的mtkf_ioctl函数MTKFB_GET_DISPLAY_IF_INFORMATION分支中确认是否有包含如下标灰
部分代码:
如果有,那么只需要在对应的LCM driver中的lcm_get_params函数中添加如下参数即可
params->physical_width = xxx;
params->physical_height = xxx;
xxx为当前使用的屏的实际size,单位是mm,且为是整数
如果没有,那么请按照如下添加:
1.alps\mediatek\custom\common\kernel\lcm\inc\lcm_drv.h 中
typedef struct
{
LCM_TYPE type;
LCM_CTRL ctrl; //! how to control LCM registers
/* common parameters */
unsigned int width;
unsigned int height;
unsigned int io_select_mode; //DBI or DPI should select IO mode according to chip spec
/* particular parameters */
LCM_DBI_PARAMS dbi;
LCM_DPI_PARAMS dpi;
LCM_DSI_PARAMS dsi;
//MTK begin
unsigned int active_width;
unsigned int active_height;
//MTK end
} LCM_PARAMS;
2.alps\mediatek\source\kernel\drivers\video\disp_drv.c中添加
//MTK begin
UINT32 DISP_GetActiveHeight(void)
{
disp_drv_init_context();
if(lcm_params)
{
printk("[wwy]lcm_pARMs->active_height = %d\n",lcm_params->active_height);
return lcm_params->active_height;
}
else
{
printk("WARNING! get active_height before display driver inited!\n");
return 0;
}
}
UINT32 DISP_GetActiveWidth(void)
{
disp_drv_init_context();
if(lcm_params)
{
printk("[wwy]lcm_parms->active_width = %d\n",lcm_params->active_width);
return lcm_params->active_width;
}
else
{
printk("WARNING! get active_width before display driver inited!\n");
return 0;
}
}
//MTK end
3.alps\mediatek\source\kernel\drivers\video\disp_drv.h中申明
//MTK begin
UINT32 DISP_GetActiveWidth(void);
UINT32 DISP_GetActiveHeight(void);
//MTK end
4.alps\mediatek\source\kernel\drivers\video\mtkfb.c 添加
static int mtkfb_check_var(struct fb_var_screeninfo *var, struct fb_info *fbi)
{
.............
var->red.msb_right = var->green.msb_right =
var->blue.msb_right = var->transp.msb_right = 0;
var->activate = FB_ACTIVATE_NOW;
//MTK begin
if(var->height <= 0)
{
var->height = UINT_MAX;
}
if(var->width <= 0)
{
var->width = UINT_MAX;
}
//MTK end
var->grayscale = 0;
var->nonstd = 0;
var->pixclock = UINT_MAX;
var->left_margin = UINT_MAX;
var->right_margin = UINT_MAX;
var->upper_margin = UINT_MAX;
var->lower_margin = UINT_MAX;
var->hsync_len = UINT_MAX;
var->vsync_len = UINT_MAX;
..........
}
static int mtkfb_fbinfo_init(struct fb_info *info)
{
struct mtkfb_device *fbdev = (struct mtkfb_device *)info->par;
struct fb_var_screeninfo var;
int r = 0;
MSG_FUNC_ENTER();
BUG_ON(!fbdev->fb_va_base);
info->fbops = &mtkfb_ops;
info->flags = FBINFO_FLAG_DEFAULT;
info->screen_base = (char *) fbdev->fb_va_base;
info->screen_size = fbdev->fb_size_in_byte;
info->pseudo_palette = fbdev->pseudo_palette;
r = fb_alloc_cmap(&info->cmap, 16, 0);
if (r != 0)
PRNERR("unable to allocate color map memory\n");
// setup the initial video mode (RGB565)
mEMSet(&var, 0, sizeof(var));
var.xres = MTK_FB_XRES;
var.yres = MTK_FB_YRES;
var.xres_virtual = MTK_FB_XRESV;
var.yres_virtual = MTK_FB_YRESV;
var.bits_per_pixel = 16;
var.red.offset = 11; var.red.length = 5;
var.green.offset = 5; var.green.length = 6;
var.blue.offset = 0; var.blue.length = 5;
//MTK begin
var.width = DISP_GetActiveWidth();
var.height = DISP_GetActiveHeight();
//MTK end
var.activate = FB_ACTIVATE_NOW;
r = mtkfb_check_var(&var, info);
if (r != 0)
PRNERR("failed to mtkfb_check_var\n");
info->var = var;
r = mtkfb_set_par(info);
if (r != 0)
PRNERR("failed to mtkfb_set_par\n");
MSG_FUNC_LEAVE();
return r;
}
5.在实际用到的屏的.c文件中(类似这样nt35516_qhd_dsi_cmd_ipsboe.c的文件)
做如下修改:
在lcm_get_params(LCM_PARAMS *params)中增加:
params->active_width = active_width;
params->active_height = active_height;
这样就能根据实际的屏幕尺寸算出准确的xdpi,ydpi.
另外請注意這裡的active_width/active_height 是指屏的physical size. 也就是寬高的实际大小,单位mm,且需要为整数
而不是resolution.. 請從panel spec找出對應的physical size.
Example:
–var->active_width = 90 (mm)
–var->active_height = 154 (mm)
–And we can get
–X DPI = 600 * 25.4 / 90 = 169.33
–Y DPI = 1024 * 25.4 / 153 = 169.99