/*
 * OMAP LCD timings: Angelo Arrifano <miknix@gmail.com>
 */

#include <stdio.h>
#include <asm/types.h>

#define PRINTX(N,X) printf(N": %d\n", (unsigned int)X)

#define OMAP_LCDC_PANEL_TFT      0x0100
#define OMAP_LCDC_CTRL_LCD_TFT      (1 << 7)

int main()
{
	__u32 t;

	printf("CONTROL 0xfffec000 value: ");
	scanf("%x", &t);

	PRINTX("OMAP_LCDC_PANEL_TFT", (t | OMAP_LCDC_CTRL_LCD_TFT) == t);

	printf("TIMING0 0xfffec004 value: ");
	scanf("%x", &t);

	PRINTX("x_res", (t & 511) + 1);
	PRINTX("hsw",   ((t >> 10) & 31) + 1);
	PRINTX("hfp",   ((t >> 16) & 127) + 1);
	PRINTX("hbp",   ((t >> 24) & 127) + 1);

	printf("TIMING1 0xfffec008 value: ");
	scanf("%x", &t);

	PRINTX("y_res", (t & 511) + 1);
	PRINTX("vsw",   ((t >> 10) & 31) + 1);
	PRINTX("vfp",   (t >> 16) & 127);
	PRINTX("vbp",   (t >> 24) & 127);

	printf("TIMING2 0xfffec00c value: ");
	scanf("%x", &t);

	PRINTX("pcd", t & 0xff);

	printf("SUBPANEL reg is 0xfffec014\n");
}
