static int kgm803a0_panel_reset(void)
{
     int err;
     err = gpio_request(102, "gpio_panel_reset");
     if (err) 
     	{
		printk(KERN_ERR "gpio_request failed for 102\n");
		return -1;
	}
     
     err = gpio_configure(102, GPIOF_DRIVE_OUTPUT | GPIOF_OUTPUT_HIGH);
     if (err) 
     	{
		printk(KERN_ERR "gpio_config failed for 102 HIGH\n");
	       return -1;
	}
     WAIT_USEC(5);
     err = gpio_configure(102, GPIOF_DRIVE_OUTPUT | GPIOF_OUTPUT_LOW);
     if (err) 
     	{
		printk(KERN_ERR "gpio_config failed for 102 LOW\n");
	       return -1;
	}
       WAIT_SEC(10000);
       err = gpio_configure(102, GPIOF_DRIVE_OUTPUT | GPIOF_OUTPUT_HIGH);
     if (err) 
     	{
		printk(KERN_ERR "gpio_config failed for 102\n");
	       return -1;
	}
        WAIT_SEC(10000);
}
Ejemplo n.º 2
0
static void epsonQcif_disp_set_display_area(word start_row, word end_row)
{
	if (!disp_initialized)
		return;

	if ((start_row == disp_area_start_row)
	    && (end_row == disp_area_end_row))
		return;
	disp_area_start_row = start_row;
	disp_area_end_row = end_row;

	/* Range checking
	 */
	if (end_row >= QCIF_HEIGHT)
		end_row = QCIF_HEIGHT - 1;
	if (start_row > end_row)
		start_row = end_row;

	/* When display is not the full screen, gray scale is set to
	 ** 2; otherwise it is set to 64.
	 */
	if ((start_row == 0) && (end_row == (QCIF_HEIGHT - 1))) {
		/* The whole screen */
		DISP_CMD_OUT(DISP_CMD_PTLOUT);
		WAIT_SEC(10000);
		DISP_CMD_OUT(DISP_CMD_DISOFF);
		WAIT_SEC(100000);
		DISP_CMD_OUT(DISP_CMD_GSSET);
		DISP_DATA_OUT(DISP_GS_64);
		WAIT_SEC(100000);
		DISP_CMD_OUT(DISP_CMD_DISON);
	} else {
		/* partial screen */
		DISP_CMD_OUT(DISP_CMD_PTLIN);
		DISP_DATA_OUT(start_row);
		DISP_DATA_OUT(start_row >> 8);
		DISP_DATA_OUT(end_row);
		DISP_DATA_OUT(end_row >> 8);
		DISP_CMD_OUT(DISP_CMD_GSSET);
		DISP_DATA_OUT(DISP_GS_2);
	}
}
static int kgm803a0_disp_off(struct platform_device *pdev)
{
	if (!disp_initialized)
		return -EFAULT;

	if (display_on) 
	{
		DISP_WRITE_OUT(0x0007,0x0000);
		WAIT_SEC(50000);
		DISP_WRITE_OUT(0x0010,0x0004);
		display_on = FALSE;
	}

	return 0;
}
Ejemplo n.º 4
0
static int epsonQcif_disp_on(struct platform_device *pdev)
{
	if (!disp_initialized)
		epsonQcif_disp_init(pdev);

	if (!display_on) {
		DISP_CMD_OUT(DISP_CMD_SLPOUT);
		WAIT_SEC(40000);
		DISP_CMD_OUT(DISP_CMD_DISON);
		epsonQcif_disp_set_contrast(disp_contrast);
		display_on = TRUE;
	}

	return 0;
}
Ejemplo n.º 5
0
static void epsonQcif_disp_set_contrast(word contrast)
{
	if (!disp_initialized)
		return;

	/* Initialize power IC, d'24 */
	DISP_CMD_OUT(DISP_CMD_VOLCTL);
	DISP_DATA_OUT(DISP_VOLCTL_TONE);

	WAIT_SEC(40000);

	/* Set electronic volume, d'xx */
	DISP_CMD_OUT(DISP_CMD_VOLCTL);
	if (contrast > 127)
		contrast = 127;
	DISP_DATA_OUT(contrast);	/* value from 0 to 127 */
	disp_contrast = (byte) contrast;
}				/* End disp_set_contrast */
static int kgm803a0_disp_on(struct platform_device *pdev)
{
	struct msm_fb_data_type *mfd;

	if (disp_initialized)
		return 0;

	kgm803a0_panel_reset();/*lcd panel reset*/
	kgm803a0_set_backlight(TRUE);/*´ò¿ª±³¹â*/

	mfd = platform_get_drvdata(pdev);

	DISP_CMD_PORT = mfd->cmd_port;
	DISP_DATA_PORT = mfd->data_port;
	
      DISP_WRITE_OUT(0x0000,0x0000);
      DISP_WRITE_OUT(0x0001,0x0100);
      DISP_WRITE_OUT(0x0002,0x0700);
      DISP_WRITE_OUT(0x0003,0x10B0);
      DISP_WRITE_OUT(0x0004,0x0000);
      DISP_WRITE_OUT(0x0008,0x0204);
      DISP_WRITE_OUT(0x0009,0x0000);
      DISP_WRITE_OUT(0x000A,0x0000);
      DISP_WRITE_OUT(0x000C,0x0000);
      DISP_WRITE_OUT(0x000D,0x0000);
      DISP_WRITE_OUT(0x000F,0x0002);
      /********GAMMA CONTROL*******/
     DISP_WRITE_OUT(0x0030,0x0707);
     DISP_WRITE_OUT(0x0031,0x1421);
     DISP_WRITE_OUT(0x0032,0x1A24);
     DISP_WRITE_OUT(0x0033,0x241A);
     DISP_WRITE_OUT(0x0034,0x2114);
     DISP_WRITE_OUT(0x0035,0x0707);
     DISP_WRITE_OUT(0x0036,0x1504);
     DISP_WRITE_OUT(0x0037,0x0515);
     DISP_WRITE_OUT(0x0038,0x0706);
     DISP_WRITE_OUT(0x0039,0x0304);
     DISP_WRITE_OUT(0x003A,0x0F04);
     DISP_WRITE_OUT(0x003B,0x0F00);
     DISP_WRITE_OUT(0x003C,0x000F);
     DISP_WRITE_OUT(0x003D,0x040F);
     DISP_WRITE_OUT(0x003E,0x0403);
     DISP_WRITE_OUT(0x003F,0x0607);
      /*******RAM ADDR CONTROL******/
     DISP_WRITE_OUT(0x0050,0x0000);
     DISP_WRITE_OUT(0x0051,0x00EF);
     DISP_WRITE_OUT(0x0052,0x0000);
     DISP_WRITE_OUT(0x0053,0x013F);
      /*****PANEL IMAGE CONTROL*****/
      DISP_WRITE_OUT(0x0060,0xA700);
      DISP_WRITE_OUT(0x0061,0x0001);
      DISP_WRITE_OUT(0x006A,0x0000);
      /*****PANEL IMAGE CONTROL*****/
      DISP_WRITE_OUT(0x0080,0x0000);
      DISP_WRITE_OUT(0x0081,0x0000);
      DISP_WRITE_OUT(0x0082,0x0000);
      DISP_WRITE_OUT(0x0083,0x0000);
      DISP_WRITE_OUT(0x0084,0x0000);
      DISP_WRITE_OUT(0x0085,0x0000);
      /******panel interface control*****/
      DISP_WRITE_OUT(0x0090,0x0018);
      DISP_WRITE_OUT(0x0092,0x0000);
      DISP_WRITE_OUT(0x0093,0x0103);
      DISP_WRITE_OUT(0x0095,0x0110);
      DISP_WRITE_OUT(0x0097,0x0000);
      DISP_WRITE_OUT(0x0098,0x0000);
      /*****orise mode*****/
      DISP_WRITE_OUT(0x00F0,0x5408);
      DISP_WRITE_OUT(0x00E0,0x0006);
      DISP_WRITE_OUT(0x00F2,0x00DF);
      DISP_WRITE_OUT(0x00F3,0x6D06);
      DISP_WRITE_OUT(0x00F4,0x0011);
      DISP_WRITE_OUT(0x00F0,0x0000);
      /*****POWER ON SEQUENCE*****/
      DISP_WRITE_OUT(0x0011,0x0007);
      WAIT_SEC(5000);
      DISP_WRITE_OUT(0x0010,0x12B0);
      WAIT_SEC(5000);
      DISP_WRITE_OUT(0x0012,0x01BD);
      /*****Vcom setting*****/
      DISP_WRITE_OUT(0x0013,0x1200);
      DISP_WRITE_OUT(0x0029,0x000c);
      DISP_WRITE_OUT(0x0007,0x0112);


	  disp_initialized = TRUE;
	
}
Ejemplo n.º 7
0
static void epsonQcif_disp_init(struct platform_device *pdev)
{
	struct msm_fb_data_type *mfd;

	int i;

	if (disp_initialized)
		return;

	mfd = platform_get_drvdata(pdev);

	DISP_CMD_PORT = mfd->cmd_port;
	DISP_DATA_PORT = mfd->data_port;

	/* Sleep in */
	DISP_CMD_OUT(DISP_CMD_SLPIN);

	/* Display off */
	DISP_CMD_OUT(DISP_CMD_DISOFF);

	/* Display normal */
	DISP_CMD_OUT(DISP_CMD_DISNOR);

	/* Set data mode */
	DISP_CMD_OUT(DISP_CMD_DATCTL);
	DISP_DATA_OUT(DISP_DATCTL_565);

	/* Set display timing */
	DISP_CMD_OUT(DISP_CMD_DISCTL);
	DISP_DATA_OUT(0x1c);	/* p1 */
	DISP_DATA_OUT(0x02);	/* p1 */
	DISP_DATA_OUT(0x82);	/* p2 */
	DISP_DATA_OUT(0x00);	/* p3 */
	DISP_DATA_OUT(0x00);	/* p4 */
	DISP_DATA_OUT(0xe0);	/* p5 */
	DISP_DATA_OUT(0x00);	/* p5 */
	DISP_DATA_OUT(0xdc);	/* p6 */
	DISP_DATA_OUT(0x00);	/* p6 */
	DISP_DATA_OUT(0x02);	/* p7 */
	DISP_DATA_OUT(0x00);	/* p8 */

	/* Set 64 gray scale level */
	DISP_CMD_OUT(DISP_CMD_GCP64);
	DISP_DATA_OUT(0x08);	/* p01 */
	DISP_DATA_OUT(0x00);
	DISP_DATA_OUT(0x2a);	/* p02 */
	DISP_DATA_OUT(0x00);
	DISP_DATA_OUT(0x4e);	/* p03 */
	DISP_DATA_OUT(0x00);
	DISP_DATA_OUT(0x6b);	/* p04 */
	DISP_DATA_OUT(0x00);
	DISP_DATA_OUT(0x88);	/* p05 */
	DISP_DATA_OUT(0x00);
	DISP_DATA_OUT(0xa3);	/* p06 */
	DISP_DATA_OUT(0x00);
	DISP_DATA_OUT(0xba);	/* p07 */
	DISP_DATA_OUT(0x00);
	DISP_DATA_OUT(0xd1);	/* p08 */
	DISP_DATA_OUT(0x00);
	DISP_DATA_OUT(0xe5);	/* p09 */
	DISP_DATA_OUT(0x00);
	DISP_DATA_OUT(0xf3);	/* p10 */
	DISP_DATA_OUT(0x00);
	DISP_DATA_OUT(0x03);	/* p11 */
	DISP_DATA_OUT(0x01);
	DISP_DATA_OUT(0x13);	/* p12 */
	DISP_DATA_OUT(0x01);
	DISP_DATA_OUT(0x22);	/* p13 */
	DISP_DATA_OUT(0x01);
	DISP_DATA_OUT(0x2f);	/* p14 */
	DISP_DATA_OUT(0x01);
	DISP_DATA_OUT(0x3b);	/* p15 */
	DISP_DATA_OUT(0x01);
	DISP_DATA_OUT(0x46);	/* p16 */
	DISP_DATA_OUT(0x01);
	DISP_DATA_OUT(0x51);	/* p17 */
	DISP_DATA_OUT(0x01);
	DISP_DATA_OUT(0x5b);	/* p18 */
	DISP_DATA_OUT(0x01);
	DISP_DATA_OUT(0x64);	/* p19 */
	DISP_DATA_OUT(0x01);
	DISP_DATA_OUT(0x6c);	/* p20 */
	DISP_DATA_OUT(0x01);
	DISP_DATA_OUT(0x74);	/* p21 */
	DISP_DATA_OUT(0x01);
	DISP_DATA_OUT(0x7c);	/* p22 */
	DISP_DATA_OUT(0x01);
	DISP_DATA_OUT(0x83);	/* p23 */
	DISP_DATA_OUT(0x01);
	DISP_DATA_OUT(0x8a);	/* p24 */
	DISP_DATA_OUT(0x01);
	DISP_DATA_OUT(0x91);	/* p25 */
	DISP_DATA_OUT(0x01);
	DISP_DATA_OUT(0x98);	/* p26 */
	DISP_DATA_OUT(0x01);
	DISP_DATA_OUT(0x9f);	/* p27 */
	DISP_DATA_OUT(0x01);
	DISP_DATA_OUT(0xa6);	/* p28 */
	DISP_DATA_OUT(0x01);
	DISP_DATA_OUT(0xac);	/* p29 */
	DISP_DATA_OUT(0x01);
	DISP_DATA_OUT(0xb2);	/* p30 */
	DISP_DATA_OUT(0x01);
	DISP_DATA_OUT(0xb7);	/* p31 */
	DISP_DATA_OUT(0x01);
	DISP_DATA_OUT(0xbc);	/* p32 */
	DISP_DATA_OUT(0x01);
	DISP_DATA_OUT(0xc1);	/* p33 */
	DISP_DATA_OUT(0x01);
	DISP_DATA_OUT(0xc6);	/* p34 */
	DISP_DATA_OUT(0x01);
	DISP_DATA_OUT(0xcb);	/* p35 */
	DISP_DATA_OUT(0x01);
	DISP_DATA_OUT(0xd0);	/* p36 */
	DISP_DATA_OUT(0x01);
	DISP_DATA_OUT(0xd4);	/* p37 */
	DISP_DATA_OUT(0x01);
	DISP_DATA_OUT(0xd8);	/* p38 */
	DISP_DATA_OUT(0x01);
	DISP_DATA_OUT(0xdc);	/* p39 */
	DISP_DATA_OUT(0x01);
	DISP_DATA_OUT(0xe0);	/* p40 */
	DISP_DATA_OUT(0x01);
	DISP_DATA_OUT(0xe4);	/* p41 */
	DISP_DATA_OUT(0x01);
	DISP_DATA_OUT(0xe8);	/* p42 */
	DISP_DATA_OUT(0x01);
	DISP_DATA_OUT(0xec);	/* p43 */
	DISP_DATA_OUT(0x01);
	DISP_DATA_OUT(0xf0);	/* p44 */
	DISP_DATA_OUT(0x01);
	DISP_DATA_OUT(0xf4);	/* p45 */
	DISP_DATA_OUT(0x01);
	DISP_DATA_OUT(0xf8);	/* p46 */
	DISP_DATA_OUT(0x01);
	DISP_DATA_OUT(0xfb);	/* p47 */
	DISP_DATA_OUT(0x01);
	DISP_DATA_OUT(0xfe);	/* p48 */
	DISP_DATA_OUT(0x01);
	DISP_DATA_OUT(0x01);	/* p49 */
	DISP_DATA_OUT(0x02);
	DISP_DATA_OUT(0x03);	/* p50 */
	DISP_DATA_OUT(0x02);
	DISP_DATA_OUT(0x05);	/* p51 */
	DISP_DATA_OUT(0x02);
	DISP_DATA_OUT(0x07);	/* p52 */
	DISP_DATA_OUT(0x02);
	DISP_DATA_OUT(0x09);	/* p53 */
	DISP_DATA_OUT(0x02);
	DISP_DATA_OUT(0x0b);	/* p54 */
	DISP_DATA_OUT(0x02);
	DISP_DATA_OUT(0x0d);	/* p55 */
	DISP_DATA_OUT(0x02);
	DISP_DATA_OUT(0x0f);	/* p56 */
	DISP_DATA_OUT(0x02);
	DISP_DATA_OUT(0x11);	/* p57 */
	DISP_DATA_OUT(0x02);
	DISP_DATA_OUT(0x13);	/* p58 */
	DISP_DATA_OUT(0x02);
	DISP_DATA_OUT(0x15);	/* p59 */
	DISP_DATA_OUT(0x02);
	DISP_DATA_OUT(0x17);	/* p60 */
	DISP_DATA_OUT(0x02);
	DISP_DATA_OUT(0x19);	/* p61 */
	DISP_DATA_OUT(0x02);
	DISP_DATA_OUT(0x1b);	/* p62 */
	DISP_DATA_OUT(0x02);
	DISP_DATA_OUT(0x1c);	/* p63 */
	DISP_DATA_OUT(0x02);

	/* Set 16 gray scale level */
	DISP_CMD_OUT(DISP_CMD_GCP16);
	DISP_DATA_OUT(0x1a);	/* p01 */
	DISP_DATA_OUT(0x32);	/* p02 */
	DISP_DATA_OUT(0x42);	/* p03 */
	DISP_DATA_OUT(0x4c);	/* p04 */
	DISP_DATA_OUT(0x58);	/* p05 */
	DISP_DATA_OUT(0x5f);	/* p06 */
	DISP_DATA_OUT(0x66);	/* p07 */
	DISP_DATA_OUT(0x6b);	/* p08 */
	DISP_DATA_OUT(0x70);	/* p09 */
	DISP_DATA_OUT(0x74);	/* p10 */
	DISP_DATA_OUT(0x78);	/* p11 */
	DISP_DATA_OUT(0x7b);	/* p12 */
	DISP_DATA_OUT(0x7e);	/* p13 */
	DISP_DATA_OUT(0x80);	/* p14 */
	DISP_DATA_OUT(0x82);	/* p15 */

	/* Set DSP column */
	DISP_CMD_OUT(DISP_CMD_MD_CSET);
	DISP_DATA_OUT(0xff);
	DISP_DATA_OUT(0x03);
	DISP_DATA_OUT(0xff);
	DISP_DATA_OUT(0x03);

	/* Set DSP page */
	DISP_CMD_OUT(DISP_CMD_MD_PSET);
	DISP_DATA_OUT(0xff);
	DISP_DATA_OUT(0x01);
	DISP_DATA_OUT(0xff);
	DISP_DATA_OUT(0x01);

	/* Set ARM column */
	DISP_CMD_OUT(DISP_CMD_SD_CSET);
	DISP_DATA_OUT(0x02);
	DISP_DATA_OUT(0x00);
	DISP_DATA_OUT((QCIF_WIDTH + 1) & 0xFF);
	DISP_DATA_OUT((QCIF_WIDTH + 1) >> 8);

	/* Set ARM page */
	DISP_CMD_OUT(DISP_CMD_SD_PSET);
	DISP_DATA_OUT(0x00);
	DISP_DATA_OUT(0x00);
	DISP_DATA_OUT((QCIF_HEIGHT - 1) & 0xFF);
	DISP_DATA_OUT((QCIF_HEIGHT - 1) >> 8);

	/* Set 64 gray scales */
	DISP_CMD_OUT(DISP_CMD_GSSET);
	DISP_DATA_OUT(DISP_GS_64);

	DISP_CMD_OUT(DISP_CMD_OSSEL);
	DISP_DATA_OUT(0);

	/* Sleep out */
	DISP_CMD_OUT(DISP_CMD_SLPOUT);

	WAIT_SEC(40000);

	/* Initialize power IC */
	DISP_CMD_OUT(DISP_CMD_VOLCTL);
	DISP_DATA_OUT(DISP_VOLCTL_TONE);

	WAIT_SEC(40000);

	/* Set electronic volume, d'xx */
	DISP_CMD_OUT(DISP_CMD_VOLCTL);
	DISP_DATA_OUT(DISP_DEFAULT_CONTRAST);	/* value from 0 to 127 */

	/* Initialize display data */
	DISP_SET_RECT(0, (QCIF_HEIGHT - 1), 0, (QCIF_WIDTH - 1));
	DISP_CMD_OUT(DISP_CMD_RAMWR);
	for (i = 0; i < QCIF_HEIGHT * QCIF_WIDTH; i++)
		DISP_DATA_OUT(0xffff);

	DISP_CMD_OUT(DISP_CMD_RAMRD);
	databack = DISP_DATA_IN();
	databack = DISP_DATA_IN();
	databack = DISP_DATA_IN();
	databack = DISP_DATA_IN();

	WAIT_SEC(80000);

	DISP_CMD_OUT(DISP_CMD_DISON);

	disp_area_start_row = 0;
	disp_area_end_row = QCIF_HEIGHT - 1;
	disp_powered_up = TRUE;
	disp_initialized = TRUE;
	epsonQcif_disp_set_display_area(0, QCIF_HEIGHT - 1);
	display_on = TRUE;
}