[Intel-gfx] [PATCH] read and parse sdvo data in bios
ling.ma at intel.com
ling.ma at intel.com
Wed Jun 10 09:54:12 CEST 2009
The patch intends to read bios data block #22,
and block #23, then parse them, then print sdvo
lvds options, detailed timings for different
pannel types.
Signed-off-by: Ma Ling <ling.ma at intel.com>
---
src/bios_reader/bios_reader.c | 173 ++++++++++++++++++++++++++++++++++++++++-
1 files changed, 172 insertions(+), 1 deletions(-)
diff --git a/src/bios_reader/bios_reader.c b/src/bios_reader/bios_reader.c
index 328cacf..f8b4ac2 100644
--- a/src/bios_reader/bios_reader.c
+++ b/src/bios_reader/bios_reader.c
@@ -423,6 +423,176 @@ static void dump_driver_feature(void)
free(block);
}
+#define SDVO_LVDS_DITHERING (1 << 5)
+#define SDVO_LVDS_PANEL_FITTING (1 << 4)
+#define SDVO_LVDS_PANEL_EDID (1 << 3)
+#define SDVO_LVDS_MONITOR_PIXEL_CLK (1 << 2)
+#define SDVO_LVDS_MONITOR_VSYNC (1 << 1)
+#define SDVO_LVDS_MONITOR_HSYNC (1 << 0)
+#define SDVO_LVDS_SSE_ENABLE (1 << 7)
+#define SDVO_LVDS_SSE_IN_DUAL_TWIN_DISPLAY (1 << 6)
+#define SDVO_LVDS_SSE_CHANNEL (3 << 4)
+#define SDVO_LVDS_PANNEL_CONNECTOR (3 << 2)
+#define SDVO_LVDS_PANNEL_COLOR_DEPTH (3 << 0)
+#define SDVO_LVDS_PANNEL4_SINGLE_CHANNEL (1 << 3)
+#define SDVO_LVDS_PANNEL3_SINGLE_CHANNEL (1 << 2)
+#define SDVO_LVDS_PANNEL2_SINGLE_CHANNEL (1 << 1)
+#define SDVO_LVDS_PANNEL1_SINGLE_CHANNEL (1 << 0)
+#define SDVO_LVDS_PANNEL4_COLOR_DEPTH (3 << 6)
+#define SDVO_LVDS_PANNEL3_COLOR_DEPTH (3 << 4)
+#define SDVO_LVDS_PANNEL2_COLOR_DEPTH (3 << 2)
+#define SDVO_LVDS_PANNEL1_COLOR_DEPTH (3 << 0)
+
+static void dump_sdvo_lvds_options(void)
+{
+ struct bdb_block *block;
+ struct bdb_sdvo_lvds_options *options;
+
+ block = find_section(BDB_SDVO_LVDS_OPTIONS);
+ if (!block) {
+ printf("No SDVO LVDS options block\n");
+ return;
+ }
+
+ options = block->data;
+
+ printf("SDVO LVDS options block:\n");
+
+ panel_type = options->panel_type;
+ printf("\tSDVO Panel backlight: %d\n", options->panel_backlight);
+ printf("\tSDVO H40 Set Panel type: %d\n", options->h40_set_panel_type);
+ printf("\tSDVO Panel type: %d\n", options->panel_type);
+ printf("\tSDVO Panel SSC CLK Frequence: %d\n", options->ssc_clk_freq);
+ printf("\tSDVO Panel ALS Low Strip: %d\n", options->als_low_trip);
+ printf("\tSDVO Panel ALS High Strip: %d\n", options->als_high_trip);
+ printf("\tSDVO Panel ScalarCoeff Tab Row Num: %d\n", options->sclalarcoeff_tab_row_num);
+ printf("\tSDVO Panel ScalarCoeff Tab Row Size: %d\n", options->sclalarcoeff_tab_row_size);
+ printf("\tSDVO Panel Coefficent 0: %d\n", options->coefficient[0]);
+ printf("\tSDVO Panel Coefficent 1: %d\n", options->coefficient[1]);
+ printf("\tSDVO Panel Coefficent 2: %d\n", options->coefficient[2]);
+ printf("\tSDVO Panel Coefficent 3: %d\n", options->coefficient[3]);
+ printf("\tSDVO Panel Coefficent 4: %d\n", options->coefficient[4]);
+ printf("\tSDVO Panel Coefficent 5: %d\n", options->coefficient[5]);
+ printf("\tSDVO Panel Coefficent 6: %d\n", options->coefficient[6]);
+ printf("\tSDVO Panel Coefficent 7: %d\n", options->coefficient[7]);
+ printf("\tSDVO Panel Dithering Enable: %s\n",
+ YESNO(options->panel_misc_bits_1 & SDVO_LVDS_DITHERING ));
+ printf("\tSDVO Panel Fitting Enable: %s\n",
+ YESNO(options->panel_misc_bits_1 & SDVO_LVDS_PANEL_FITTING));
+ printf("\tSDVO Panel EDID support: %s\n",
+ YESNO(options->panel_misc_bits_1 & SDVO_LVDS_PANEL_EDID));
+ printf("\tSDVO Panel Monitor Pixel Clk on: %s\n",
+ YESNO(options->panel_misc_bits_1 & SDVO_LVDS_MONITOR_PIXEL_CLK));
+ printf("\tSDVO Panel Monitor Vsync on: %s\n",
+ YESNO(options->panel_misc_bits_1 & SDVO_LVDS_MONITOR_VSYNC));
+ printf("\tSDVO Panel Monitor Hsync on: %s\n",
+ YESNO(options->panel_misc_bits_1 & SDVO_LVDS_MONITOR_HSYNC));
+ printf("\tSDVO Panel LVDS SSE Enable: %s\n",
+ YESNO(options->panel_misc_bits_2 & SDVO_LVDS_SSE_ENABLE));
+ printf("\tSDVO Panel SSE in Dual Twin Display Disable: %s\n",
+ YESNO(options->panel_misc_bits_2 & SDVO_LVDS_SSE_IN_DUAL_TWIN_DISPLAY));
+ printf("\tSDVO Panel LVDS Dual Channle: %s\n",
+ YESNO((options->panel_misc_bits_2 & SDVO_LVDS_SSE_CHANNEL) == 1));
+ printf("\tSDVO Panel LVDS Single Channle: %s\n",
+ YESNO((options->panel_misc_bits_2 & SDVO_LVDS_SSE_CHANNEL) == 0));
+ printf("\tSDVO Panel LVDS Panel Connector is OpenLDI: %s\n",
+ YESNO((options->panel_misc_bits_2 & SDVO_LVDS_PANNEL_CONNECTOR) == 1));
+ printf("\tSDVO Panel LVDS Panel Connector is SPGW: %s\n",
+ YESNO((options->panel_misc_bits_2 & SDVO_LVDS_PANNEL_CONNECTOR) == 0));
+ printf("\tSDVO Panel LVDS Color depth is 24 bit: %s\n",
+ YESNO((options->panel_misc_bits_2 &
+ SDVO_LVDS_PANNEL_COLOR_DEPTH) == 1));
+ printf("\tSDVO Panel LVDS Color depth is 18 bit: %s\n",
+ YESNO((options->panel_misc_bits_2 &
+ SDVO_LVDS_PANNEL_COLOR_DEPTH) == 0));
+ printf("\tSDVO Panel #4 is Dual Channel: %s\n",
+ YESNO(options->panel_misc_bits_3 & SDVO_LVDS_PANNEL4_SINGLE_CHANNEL));
+ printf("\tSDVO Panel #3 is Dual Channel: %s\n",
+ YESNO(options->panel_misc_bits_3 & SDVO_LVDS_PANNEL3_SINGLE_CHANNEL));
+ printf("\tSDVO Panel #2 is Dual Channel: %s\n",
+ YESNO(options->panel_misc_bits_3 & SDVO_LVDS_PANNEL2_SINGLE_CHANNEL));
+ printf("\tSDVO Panel #1 is Dual Channel: %s\n",
+ YESNO(options->panel_misc_bits_3 & SDVO_LVDS_PANNEL1_SINGLE_CHANNEL));
+ printf("\tSDVO Panel #4 Color Depth is 24 bit: %s\n",
+ YESNO((options->panel_misc_bits_4 &
+ SDVO_LVDS_PANNEL4_COLOR_DEPTH) == 1));
+ printf("\tSDVO Panel #4 Color Depth is 18 bit: %s\n",
+ YESNO((options->panel_misc_bits_4 &
+ SDVO_LVDS_PANNEL4_COLOR_DEPTH) == 0));
+
+ printf("\tSDVO Panel #3 Color Depth is 24 bit: %s\n",
+ YESNO((options->panel_misc_bits_4 &
+ SDVO_LVDS_PANNEL3_COLOR_DEPTH) == 1));
+ printf("\tSDVO Panel #3 Color Depth is 18 bit: %s\n",
+ YESNO((options->panel_misc_bits_4 &
+ SDVO_LVDS_PANNEL3_COLOR_DEPTH) == 0));
+ printf("\tSDVO Panel #2 Color Depth is 24 bit: %s\n",
+ YESNO((options->panel_misc_bits_4 &
+ SDVO_LVDS_PANNEL2_COLOR_DEPTH) == 1));
+ printf("\tSDVO Panel #2 Color Depth is 18 bit: %s\n",
+ YESNO((options->panel_misc_bits_4 &
+ SDVO_LVDS_PANNEL2_COLOR_DEPTH) == 0));
+ printf("\tSDVO Panel #1 Color Depth is 24 bit: %s\n",
+ YESNO((options->panel_misc_bits_4 &
+ SDVO_LVDS_PANNEL1_COLOR_DEPTH) == 1));
+ printf("\tSDVO Panel #1 Color Depth is 18 bit: %s\n",
+ YESNO((options->panel_misc_bits_4 &
+ SDVO_LVDS_PANNEL1_COLOR_DEPTH) == 0));
+ free(block);
+}
+
+static void dump_sdvo_lvds_data(void)
+{
+ struct bdb_block *block;
+ int num_entries;
+ int i;
+ int hdisplay, hsyncstart, hsyncend, htotal;
+ int vdisplay, vsyncstart, vsyncend, vtotal;
+ float clock;
+
+ block = find_section(BDB_SDVO_PANEL_DTDS);
+ if (!block) {
+ printf("No SDVO LVDS data block\n");
+ return;
+ }
+
+ num_entries = block->size / sizeof(struct lvds_dvo_timing);
+
+ printf("SDVO LVDS Number of entries: %d\n", num_entries);
+
+ for (i = 0; i < num_entries; i++) {
+ uint8_t *timing_data = (uint8_t *)block->data + (i * sizeof(struct lvds_dvo_timing));
+ char marker;
+
+ if (i == panel_type)
+ marker = '*';
+ else
+ marker = ' ';
+
+ hdisplay = _H_ACTIVE(timing_data);
+ hsyncstart = hdisplay + _H_SYNC_OFF(timing_data);
+ hsyncend = hsyncstart + _H_SYNC_WIDTH(timing_data);
+ htotal = hdisplay + _H_BLANK(timing_data);
+
+ vdisplay = _V_ACTIVE(timing_data);
+ vsyncstart = vdisplay + _V_SYNC_OFF(timing_data);
+ vsyncend = vsyncstart + _V_SYNC_WIDTH(timing_data);
+ vtotal = vdisplay + _V_BLANK(timing_data);
+ clock = _PIXEL_CLOCK(timing_data) / 1000;
+
+ printf("%c\tpanel type %02i: %dx%d clock %d\n", marker,
+ i, hdisplay, vdisplay,
+ _PIXEL_CLOCK(timing_data));
+ printf("\t\tinfo:\n");
+ printf("\t\ttimings: %d %d %d %d %d %d %d %d %.2f (%s)\n",
+ hdisplay, hsyncstart, hsyncend, htotal,
+ vdisplay, vsyncstart, vsyncend, vtotal, clock,
+ (hsyncend > htotal || vsyncend > vtotal) ?
+ "BAD!" : "good");
+ }
+ free(block);
+}
+
int main(int argc, char **argv)
{
int fd;
@@ -496,7 +666,8 @@ int main(int argc, char **argv)
dump_lvds_options();
dump_lvds_data();
dump_lvds_ptr_data();
-
+ dump_sdvo_lvds_options();
+ dump_sdvo_lvds_data();
dump_driver_feature();
return 0;
--
1.5.4.4
More information about the Intel-gfx
mailing list