/*****************************************************************************
* Copyright Statement:
* --------------------
* This software is protected by Copyright and the information contained
* herein is confidential. The software may not be copied and the information
* contained herein may not be used or disclosed except with the written
* permission of MediaTek Inc. (C) 2005
*
* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
*
* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
*
*****************************************************************************/
/*****************************************************************************
*
* Filename:
* ---------
* lcd.c
*
* Project:
* --------
* Maui_Software
*
* Description:
* ------------
* This Module defines the LCD driver.
*
* Author:
* -------
* -------
*
*============================================================================
* HISTORY
* Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*------------------------------------------------------------------------------
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
*------------------------------------------------------------------------------
* Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*============================================================================
****************************************************************************/
#include "drv_comm.h"
#include "reg_base.h"
#include "lcd_sw_inc.h"
#include "lcd_sw.h"
#include "lcd_hw.h"
/*Serial interface*/
#include "lcd_if.h"
#include "lcd_sw_rnd.h"
extern void GPIO_ModeSetup(kal_uint16 pin, kal_uint16 conf_dada);
extern void GPIO_WriteIO(char data, char port);
extern void PWM2_level(kal_uint8 level);
kal_bool lcd_assert_fail=KAL_FALSE;
kal_uint8 lcd_check = 0;
kal_uint8 lcd_reg_index=0;
const lcd_data_struct lcd_check_reg = {
{
{0x0001,0x011B}, {0x0002,0x0700}, {0x0003,0x1230}, {0x0007,0x0037}, {0x0009,0x0000},
{0x000B,0x0000}, {0x000C,0x0003}, {0x0010,0x4140}, {0x0011,0x0000}, {0x0012,0x0013},
{0x0013,0x3611}, {0x0040,0x0000}, {0x0041,0x00EF}, {0x0042,0xDB00}, {0x0043,0xDB00},
{0x0047,0x0000}, {0x0008,0x0202}, {0x0004,0x0000}, {0x0005,0x0000}, {0x0023,0x0000},
{0x0024,0x0000}, {0x0053,0x0000}
}
};
/* default value for SOLOMON SSD1288 */
kal_uint16 lcd_power_ctrl_shadow1,lcd_power_ctrl_shadow3,lcd_power_ctrl_shadow4;
#ifdef DUAL_LCD
#ifndef COLOR_SUBLCD
const kal_uint8 SubLCDSetArray[]=
{
0x01, // 0000 0001
0x02, // 0000 0010
0x04, // 0000 0100
0x08, // 0000 1000
0x10, // 0001 0000
0x20, // 0010 0000
0x40, // 0100 0000
0x80 // 1000 0000
};
const kal_uint8 SubLCDReSetArray[]=
{
0xFE, // 1111 1110
0xFD, // 1111 1101
0xFB, // 1111 1011
0xF7, // 1111 0111
0xEF, // 1110 1111
0xDF, // 1101 1111
0xBF, // 1011 1111
0x7F // 0111 1111
};
#endif
#endif
void LCD_Delay(kal_uint32 delay_count)
{
volatile kal_uint32 delay;
for (delay =0;delay <(delay_count*800);delay++) {}
}
void spi_ini(void)
{
}
#define LCD_LGDP4531_MOD
#if (defined(MT6218B)||defined(MT6219)||defined(MT6217)||defined(MT6226)||defined(MT6226M)||defined(MT6227))
void init_lcd_interface(void)
{
kal_uint32 i;
DRV_Reg(DRVPDN_CON1) &= (~DRVPDN_CON1_LCD); /* Power on LCD */
*((volatile unsigned short *) 0x801201C0) &= 0xFFCF;
*((volatile unsigned short *) 0x80120010) |= 0x04;
*((volatile unsigned short *) 0x80120100) |= 0x4;
REG_LCD_ROI_CTRL=0;
CLEAR_LCD_CTRL_RESET_PIN;
#if (defined(MT6219)||defined(MT6226)||defined(MT6226M)||defined(MT6227))
#if defined(LCD_8312_MOD) || defined(LCD_IS2320_MOD)
SET_LCD_PARALLEL_CE2WR_SETUP_TIME(3);///3
SET_LCD_PARALLEL_CE2WR_HOLD_TIME(1);///2
SET_LCD_PARALLEL_CE2RD_SETUP_TIME(1);///1
SET_LCD_PARALLEL_WRITE_WAIT_STATE(6);///6
SET_LCD_PARALLEL_READ_LATENCY_TIME(3);///3
SET_LCD_ROI_CTRL_CMD_LATENCY(3);///3
#elif (defined(LCD_LGDP4531_MOD))
SET_LCD_PARALLEL_CE2WR_SETUP_TIME(1);
SET_LCD_PARALLEL_CE2WR_HOLD_TIME(0);
SET_LCD_PARALLEL_CE2RD_SETUP_TIME(0);
SET_LCD_PARALLEL_WRITE_WAIT_STATE(4);
SET_LCD_PARALLEL_READ_LATENCY_TIME(2);
SET_LCD_ROI_CTRL_CMD_LATENCY(2);
#elif defined(LCD_R61505_MOD) || defined(LCD_SSD1289_MOD) || defined(LCD_TL1763_MOD)
SET_LCD_PARALLEL_CE2WR_SETUP_TIME(1);
SET_LCD_PARALLEL_CE2WR_HOLD_TIME(0);
SET_LCD_PARALLEL_CE2RD_SETUP_TIME(0);
SET_LCD_PARALLEL_WRITE_WAIT_STATE(4);
SET_LCD_PARALLEL_READ_LATENCY_TIME(2);
SET_LCD_ROI_CTRL_CMD_LATENCY(2);
#endif
#if (defined(MT6226)||defined(MT6226M)||defined(MT6227))
#if (defined(LCD_8BIT_MODE))
SET_LCD_PARALLEL_8BIT_DATA_BUS;
#elif (defined(LCD_9BIT_MODE))
SET_LCD_PARALLEL_9BIT_DATA_BUS;
#elif (defined(LCD_16BIT_MODE))
SET_LCD_PARALLEL_16BIT_DATA_BUS;
#if (defined(MT6228)||defined(MT6229))
GPIO_ModeSetup(54, 0);
GPIO_ModeSetup(55, 0);
GPIO_ModeSetup(56, 0);
GPIO_ModeSetup(57, 0);
GPIO_ModeSetup(58, 0);
GPIO_ModeSetup(59, 0);
GPIO_ModeSetup(60, 0);
GPIO_ModeSetup(61, 0);
#elif (defined(MT6226)||defined(MT6227))
GPIO_ModeSetup(55, 1);
*((volatile unsigned short *) 0x801201B0) |= 0x4000;
*((volatile unsigned short *) 0x801201D0) |= 0x0001;
#endif
#elif (defined(MAIN_LCD_18BIT_MODE))
SET_LCD_PARALLEL_18BIT_DATA_BUS;
#if (defined(MT6228)||defined(MT6229))
GPIO_ModeSetup(10, 1);
GPIO_ModeSetup(11, 1);
GPIO_ModeSetup(54, 0);
GPIO_ModeSetup(55, 0);
GPIO_ModeSetup(56, 0);
GPIO_ModeSetup(57, 0);
GPIO_ModeSetup(58, 0);
GPIO_ModeSetup(59, 0);
GPIO_ModeSetup(60, 0);
GPIO_ModeSetup(61, 0);
#elif (defined(MT6226)||defined(MT6227))
GPIO_ModeSetup(55, 1);
*((volatile unsigned short *) 0x801201B0) |= 0x4000;
*((volatile unsigned short *) 0x801201D0) |= 0x0001;
#endif