From 893aa61ff3eb6c10520ea14a8b90633819264c3e Mon Sep 17 00:00:00 2001 From: Wang Quanxian Date: Fri, 10 Aug 2012 11:33:20 +0800 Subject: [PATCH] staging: emgd: IVI display configuration This patch configures the emgd driver for the IVI HW displays. In theory, we should only change "user_config.[ch] files, but we also change "emgd_drv.c" and "emgd_interface.c". This should be worked on later. Signed-off-by: Quanxian Wang --- emgd/drm/emgd_drv.c | 4 +- emgd/drm/emgd_interface.c | 4 +- emgd/drm/user_config.c | 288 +++++++++++++++++++++++++++++++++++++++------- emgd/drm/user_config.h | 5 +- 4 files changed, 254 insertions(+), 47 deletions(-) diff --git a/emgd/drm/emgd_drv.c b/emgd/drm/emgd_drv.c index c8709cf..3a87fd6 100644 --- a/emgd/drm/emgd_drv.c +++ b/emgd/drm/emgd_drv.c @@ -83,6 +83,7 @@ extern int msvdx_shutdown_plb(igd_context_t *context); extern emgd_drm_config_t config_drm; extern int context_count; +extern void emgd_drm_override_user_config(int type); /* This must be defined whether debug or release build */ igd_debug_t emgd_debug_flag = { { @@ -1197,9 +1198,10 @@ int emgd_driver_load(struct drm_device *dev, unsigned long flags) /* Obtain the user-configurable set of parameter values: */ if (drm_emgd_configid < 0) { - params = config_drm.hal_params[0]; + params = config_drm.hal_params[2]; } else { params = config_drm.hal_params[drm_emgd_configid-1]; + emgd_drm_override_user_config(drm_emgd_configid); } diff --git a/emgd/drm/emgd_interface.c b/emgd/drm/emgd_interface.c index 4fb5c24..fc2c918 100644 --- a/emgd/drm/emgd_interface.c +++ b/emgd/drm/emgd_interface.c @@ -837,7 +837,7 @@ int emgd_get_drm_config(struct drm_device *dev, void *arg, * Return the igd_param_t parameter values used at module load time: */ if (drm_emgd_configid < 0) { - params = config_drm.hal_params[0]; + params = config_drm.hal_params[2]; } else { params = config_drm.hal_params[drm_emgd_configid-1]; } @@ -1855,7 +1855,7 @@ int emgd_driver_pre_init(struct drm_device *dev, void *arg, * looked up and copied). */ if (drm_emgd_configid < 0) { - uc_params = config_drm.hal_params[0]; + uc_params = config_drm.hal_params[2]; } else { uc_params = config_drm.hal_params[drm_emgd_configid-1]; } diff --git a/emgd/drm/user_config.c b/emgd/drm/user_config.c index cea78e1..84142dd 100644 --- a/emgd/drm/user_config.c +++ b/emgd/drm/user_config.c @@ -49,12 +49,40 @@ * for analog/VGA ports. */ -#define TUNNELCREEK 1 -#define POULSBO 0 - -#if TUNNELCREEK +/* Crossville 7' */ static igd_display_info_t dtd_config1_port4_dtdlist[] = { { + 800, /* Width */ + 480, /* Height */ + 0, /* Refresh Rate */ + 31746, /* Dot Clock */ + 999, /* Horizontal Total (horizontal synch end) */ + 799, /* Horizontal Blank Start (h_active-1) */ + 999, /* Horizontal Blank End (start + h_blank) */ + 859, /* Horizontal Sync Start (h_active+h_synch-1) */ + 999, /* Horizontal Sync End (start + h_syncp) */ + 524, /* Vertical Total (Vertical synch end) */ + 479, /* Vertical Blank Start (v_active-1) */ + 524, /* Vertical Blank End (start + v_blank) */ + 507, /* Vertical Sync Start (v_active+v_synch-1) */ + 538, /* Vertical Sync End (start + v_synchp) */ + 0, /* Mode Number */ + 0x8020000, /* Flags */ + 0, /* X Offset */ + 0, /* Y Offset */ + NULL, /* pd extension pointer */ + 0, 0 /* mode extension pointer */ + }, +}; +static igd_param_attr_t attrs_config1_port4[] = { + {0x46, 100}, + {0x1a, 24}, + {0x47, 20300}, +}; + +/* CrownBay 13' */ +static igd_display_info_t dtd_config2_port4_dtdlist[] = { + { 1366, /* Width */ 768, /* Height */ 60, /* Refresh Rate */ @@ -77,43 +105,38 @@ static igd_display_info_t dtd_config1_port4_dtdlist[] = { 0, 0 /* mode extension pointer */ }, }; -#endif +/* shares attributes with config1 */ -#if POULSBO -static igd_display_info_t dtd_config1_port4_dtdlist[] = { +/* NexCom VCT1000 7' */ +static igd_display_info_t dtd_config3_port4_dtdlist[] = { { - 1024, /* Width */ - 768, /* Height */ - 60, /* Refresh Rate */ - 65000, /* Dot Clock (in KHz) */ - 1343, /* Horizontal Total (horizontal synch end) */ - 1023, /* Horizontal Blank Start (h_active-1) */ - 1343, /* Horizontal Blank End (start + h_blank) */ - 1047, /* Horizontal Sync Start (h_active+h_synch-1) */ - 1183, /* Horizontal Sync End (start + h_syncp) */ - 805, /* Vertical Total (Vertical synch end) */ - 767, /* Vertical Blank Start (v_active-1) */ - 805, /* Vertical Blank End (start + v_blank) */ - 770, /* Vertical Sync Start (v_active+v_synch-1) */ - 776, /* Vertical Sync End (start + v_synchp) */ - 0, /* Mode Number */ - 0x20000, /* Flags */ - 0, /* X Offset */ - 0, /* Y Offset */ - NULL, /* pd extension pointer */ - 0, 0 /* mode extension pointer */ + 800, /* Width */ + 480, /* Height */ + 0, /* Refresh Rate */ + 31746, /* Dot Clock */ + 999, /* Horizontal Total (horizontal synch end) */ + 799, /* Horizontal Blank Start (h_active-1) */ + 999, /* Horizontal Blank End (start + h_blank) */ + 859, /* Horizontal Sync Start (h_active+h_synch-1) */ + 999, /* Horizontal Sync End (start + h_syncp) */ + 524, /* Vertical Total (Vertical synch end) */ + 479, /* Vertical Blank Start (v_active-1) */ + 524, /* Vertical Blank End (start + v_blank) */ + 507, /* Vertical Sync Start (v_active+v_synch-1) */ + 538, /* Vertical Sync End (start + v_synchp) */ + 0, /* Mode Number */ + 0x8020000, /* Flags */ + 0, /* X Offset */ + 0, /* Y Offset */ + NULL, /* pd extension pointer */ + 0, 0 /* mode extension pointer */ }, }; -#endif - -static igd_param_attr_t attrs_config1_port4[] = { +static igd_param_attr_t attrs_config3_port4[] = { {0x46, 100}, -#if POULSBO {0x1a, 24}, -#endif -#if TUNNELCREEK {0x47, 20300}, -#endif + {0x31, 1}, }; static emgd_drm_splash_screen_t splash_screen_data = { @@ -136,19 +159,20 @@ static emgd_drm_splash_video_t splash_video_data = { 0, /* dst_height */ }; +/* Config #1: Crossville 7' */ static igd_param_t config_params_config1 = { 1*256*1024, /* Page request */ 0, /* Max frame buffer size */ 1, /* Preserve registers */ 0x6, /* Display flags */ - { 4, 2, 0, 0, 0 }, /* Display port order */ + { 4, 0, 0, 0, 0 }, /* Display port order */ { /* Display Params */ { /* Port */ 4, /* Display port number */ 0x180, /* Parameters present */ 0x0, /* EDID flag */ - 0x5, /* Flags when EDID is available */ - 0x5, /* Flags when EDID is not available */ + 0x0, /* Flags when EDID is available */ + 0x4, /* Flags when EDID is not available */ 0, /* DDC GPIO pins */ 0, /* DDC speed */ 0, /* DDC DAB */ @@ -211,14 +235,164 @@ static igd_param_t config_params_config1 = { 0 /* Polling (1 = override interrupt support and use polling) */ }; -igd_param_t *config_params = {&config_params_config1}; +/* Config #2: CrownBay 13' */ +static igd_param_t config_params_config2 = { + 1*256*1024, /* Page request */ + 0, /* Max frame buffer size */ + 1, /* Preserve registers */ + 0x6, /* Display flags */ + { 4, 0, 0, 0, 0 }, /* Display port order */ + { /* Display Params */ + { /* Port */ + 4, /* Display port number */ + 0x80, /* Parameters present */ + 0x0, /* EDID flag */ + 0x5, /* Flags when EDID is available */ + 0x5, /* Flags when EDID is not available */ + 0, /* DDC GPIO pins */ + 0, /* DDC speed */ + 0, /* DDC DAB */ + 0, /* I2C GPIO pins */ + 0, /* I2C speed */ + 0, /* I2C DAB */ + { /* Flat Panel Info */ + 0, /* Flat Panel width */ + 0, /* Flat Panel height */ + 0, /* Flat Panel power method */ + 0, /* VDD active & DVO clock/data active */ + 0, /* DVO clock/data active & backlight enable */ + 0, /* backlight disable & DVO clock/data inactive */ + 0, /* DVO clock/data inactive & VDD inactive */ + 0 /* VDD inactive & VDD active */ + }, + { /* DTD Info */ + sizeof(dtd_config2_port4_dtdlist)/sizeof(igd_display_info_t), /* Number of DTDs */ + dtd_config2_port4_dtdlist /* DTD name */ + }, + { /* Attribute Info */ + sizeof(attrs_config1_port4)/sizeof(igd_param_attr_t), /* Number of attributes */ + attrs_config1_port4 /* Attr name */ + } + }, + { /* Port */ + 2, /* Display port number */ + 0x0, /* Parameters present */ + 0x0, /* EDID flag */ + 0x5, /* Flags when EDID is available */ + 0x5, /* Flags when EDID is not available */ + 0, /* DDC GPIO pins */ + 0, /* DDC speed */ + 0, /* DDC DAB */ + 0, /* I2C GPIO pins */ + 0, /* I2C speed */ + 0, /* I2C DAB */ + { /* Flat Panel Info */ + 0, /* Flat Panel width */ + 0, /* Flat Panel height */ + 0, /* Flat Panel power method */ + 0, /* VDD active & DVO clock/data active */ + 0, /* DVO clock/data active & backlight enable */ + 0, /* backlight disable & DVO clock/data inactive */ + 0, /* DVO clock/data inactive & VDD inactive */ + 0 /* VDD inactive & VDD active */ + }, + { /* DTD Info */ + 0, NULL + }, + { /* Attribute Info */ + 0, NULL + } + }, + }, + 0, /* 24-bit RGB color that framebuffer is cleared to */ + 1, /* Quickboot (1 = enabled) */ + 0, /* Quickboot seamless (1 = enabled) */ + 0, /* Quickboot video input (1 = enabled) */ + 0 /* Polling (1 = override interrupt support and use polling) */ +}; + +/* Config #3: NexCom VCT1000 7' */ +static igd_param_t config_params_config3 = { + 1*256*1024, /* Page request */ + 0, /* Max frame buffer size */ + 1, /* Preserve registers */ + 0x6, /* Display flags */ + { 4, 0, 0, 0, 0 }, /* Display port order */ + { /* Display Params */ + { /* Port */ + 4, /* Display port number */ + 0x180, /* Parameters present */ + 0x0, /* EDID flag */ + 0x0, /* Flags when EDID is available */ + 0x4, /* Flags when EDID is not available */ + 0, /* DDC GPIO pins */ + 0, /* DDC speed */ + 0, /* DDC DAB */ + 0, /* I2C GPIO pins */ + 0, /* I2C speed */ + 0, /* I2C DAB */ + { /* Flat Panel Info */ + 0, /* Flat Panel width */ + 0, /* Flat Panel height */ + 0, /* Flat Panel power method */ + 0, /* VDD active & DVO clock/data active */ + 0, /* DVO clock/data active & backlight enable */ + 0, /* backlight disable & DVO clock/data inactive */ + 0, /* DVO clock/data inactive & VDD inactive */ + 0 /* VDD inactive & VDD active */ + }, + { /* DTD Info */ + sizeof(dtd_config3_port4_dtdlist)/sizeof(igd_display_info_t), /* Number of DTDs */ + dtd_config3_port4_dtdlist /* DTD name */ + }, + { /* Attribute Info */ + sizeof(attrs_config3_port4)/sizeof(igd_param_attr_t), /* Number of attributes */ + attrs_config3_port4 /* Attr name */ + } + }, + { /* Port */ + 2, /* Display port number */ + 0x0, /* Parameters present */ + 0x0, /* EDID flag */ + 0x5, /* Flags when EDID is available */ + 0x5, /* Flags when EDID is not available */ + 0, /* DDC GPIO pins */ + 0, /* DDC speed */ + 0, /* DDC DAB */ + 0, /* I2C GPIO pins */ + 0, /* I2C speed */ + 0, /* I2C DAB */ + { /* Flat Panel Info */ + 0, /* Flat Panel width */ + 0, /* Flat Panel height */ + 0, /* Flat Panel power method */ + 0, /* VDD active & DVO clock/data active */ + 0, /* DVO clock/data active & backlight enable */ + 0, /* backlight disable & DVO clock/data inactive */ + 0, /* DVO clock/data inactive & VDD inactive */ + 0 /* VDD inactive & VDD active */ + }, + { /* DTD Info */ + 0, NULL + }, + { /* Attribute Info */ + 0, NULL + } + }, + }, + 0, /* 24-bit RGB color that framebuffer is cleared to */ + 1, /* Quickboot (1 = enabled) */ + 0, /* Quickboot seamless (1 = enabled) */ + 0, /* Quickboot video input (1 = enabled) */ + 0 /* Polling (1 = override interrupt support and use polling) */ +}; /* * The emgd_drm_config_t structure is the main configuration structure * for the EMGD kernel module. */ emgd_drm_config_t config_drm = { - 0, /* Whether to initialize the display at EMGD module startup time + 1, /* Whether to initialize the display at EMGD module startup time * (corresponds to the "init" module parameter) */ 1, /* The display configuration to use if initializing the display @@ -229,16 +403,16 @@ emgd_drm_config_t config_drm = { * Note: Twin is NOT CURRENTLY SUPPORTED * - 8 = Extended displays (e.g. LVDS + CRT displaying different images) */ - 1366,/* Display width to use if initializing the display + 800,/* Display width to use if initializing the display * (corresponds to the "width" module parameter) */ - 768,/* Display height to use if initializing the display + 480,/* Display height to use if initializing the display * (corresponds to the "height" module parameter) */ 60, /* Display refresh rate to use if initializing the display * (corresponds to the "refresh" module parameter) */ - 0, /* KMS */ + 1, /* KMS */ 0, /* ovl_brightness */ 0, /* ovl_contrast */ 0, /* ovl_saturation */ @@ -247,6 +421,34 @@ emgd_drm_config_t config_drm = { 0, /* ovl_gamma_blue */ &splash_screen_data, &splash_video_data, - &config_params /* driver parameters from above */ + { /* driver parameters from above */ + &config_params_config1, + &config_params_config2, + &config_params_config3 + } }; + +/* type: 2:crownbay else:crossvile */ +void emgd_drm_override_user_config(int configid) +{ + if ( configid == 1 ) + { + /* Crossville 7inch */ + config_drm.width = 800; + config_drm.height = 480; + } + else if ( configid == 2 ) + { + /* CrownBay 13inch LVDS */ + config_drm.width = 1366; + config_drm.height = 768; + } + else /* default */ + { + /* NexCom VCT1000 7inch LVDS*/ + config_drm.width = 800; + config_drm.height = 480; + } + return; +} diff --git a/emgd/drm/user_config.h b/emgd/drm/user_config.h index 5aca4d8..7be2c37 100644 --- a/emgd/drm/user_config.h +++ b/emgd/drm/user_config.h @@ -72,6 +72,9 @@ typedef struct _emgd_drm_splash_video { * parameter ("portorder") that corresponds to the port_order member of the * igd_param_t structure. */ + +#define USER_CONFIG_NUM 3 + typedef struct _emgd_drm_config { /** * Whether the EMGD kernel/DRM module should initialize the display at @@ -107,7 +110,7 @@ typedef struct _emgd_drm_config { /** Array of other parameters (one per configid), used by the hardware * abstraction layer code. */ - igd_param_t **hal_params; + igd_param_t *hal_params[USER_CONFIG_NUM]; } emgd_drm_config_t; #endif -- 2.7.4