1. LCD
1.1怎样新建一个LCD驱动
LCD模组主要包括LCD显示屏和驱动IC。比如LF040DNYB16a模组的驱动IC型号为NT35510。要在MT577平台上新建这个lcd的驱动,步骤如下:
A. 新建文件夹nt35510:
\mediatek\custom\common\kernel\lcm\nt35510
\mediatek\custom\common\lk\lcm\nt35510 //\mediatek\custom\common\uboot\lcm\nt35510
B.修改\mediatek\custom\common\kernel\lcm\mt65xx_lcm_list.c, 在lcm_driver_list [ lcm_count ] 中增加nt35510_lcm_drv。
C.打开mediatek\config\ginwave73_gb\ProjectConfig.mk:
BUILD_LK=yes //BUILD_UBOOT=yes
BOOT_LOGO=wsvganl
CUSTOM_KERNEL_LCM = nt35510
CUSTOM_LK_LCM= nt35510 // CUSTOM_UBOOT_LCM =nt35510
LCM_WIDTH=600
LCM_HEIGHT=1024
驱动文件移植原则:
根据具体平台,填充对应的函数,不能直接复制整个文件,避免不必要编译和接口错误。
1.3 LCD显示旋转(横竖屏旋转,关联到很多界面,需要统一修改)
方式一:横竖屏分辨率修改(还需要修改TP驱动):
LCM_WIDTH=1024
LCM_HEIGHT=600
方式二:lcm显示旋转,只需要修改:(还需要旋转camera驱动)
MTK_LCM_PHYSICAL_ROTATION=90
MTK_TOUCH_PHYSICAL_ROTATION_RELATIVE_TO_LCM=90
camera 旋转
Z:\jb2\_131217\alps\mediatek\custom\\hal\imgsensor\src\cfg_setting_imgsensor.cpp
static SensorOrientation_T const inst = {
u4Degree_0 : 180,//90, // main sensor in degree (0, 90,180, 270)
u4Degree_1 : 0,//90, // sub sensor in degree (0, 90, 180, 270)
1.4 lcm参数修改
\mediatek\custom\common\kernel\lcm\rgb_mt8193
staticvoid lcm_get_params(LCM_PARAMS *params){}
lcd rgb频率:
//params->dpi.mipi_pll_clk_ref =536870912;
params->dpi.mipi_pll_clk_ref= (33.3*(16777216*8*2))/26; //33.3MHz
//params->dpi.mipi_pll_clk_ref= 536870912; //52.0MHz
colorformat 修改
params->dpi.format = LCM_DPI_FORMAT_RGB888; // format is 24 bit//LCM_DPI_FORMAT_RGB666
1.5 修改显示分辨率:
1.5.1配置修改:
打开mediatek\config\ginwave73_gb\ProjectConfig.mk:
LCM_WIDTH=600
LCM_HEIGHT=1024
Lk_logo= wsvganl 及相关logo文件修改
15.2 lcm驱动分辨率修改,可自行手动修改(注意横竖数值对应)
对应的lcm :\mediatek\custom\common\kernel\lcm\rgb_mt8193
#defineFRAME_WIDTH (1024)
#defineFRAME_HEIGHT (600)
15.3 tpsensor driver修改,对应分辨率驱动(fae sensor提供驱动代码)。
\alps\mediatek\custom\prj\kernel\touchpanel\GSLx680\GSLx680.h
#defineSCREEN_MAX_X 480
#defineSCREEN_MAX_Y 800
2. leds 配置
CUSTOM_KERNEL_LEDS= mt65xx
mediatek\custom\prj\kernel\leds\mt65xx\cust_leds.c
mediatek\custom\prj\lk\cust_leds.c
static structcust_mt65xx_led cust_led_list[MT65XX_LED_TYPE_TOTAL] = {
{"red",MT65XX_LED_MODE_NONE, -1,{0}},
{"green",MT65XX_LED_MODE_NONE, -1,{0}},
{"blue",MT65XX_LED_MODE_NONE, -1,{0}},
{"jogball-backlight",MT65XX_LED_MODE_NONE, -1,{0}},
{"keyboard-backlight",MT65XX_LED_MODE_NONE,-1,{0}},
{"button-backlight", MT65XX_LED_MODE_NONE, -1,{0}}, // modify
{"lcd-backlight",MT65XX_LED_MODE_PWM,PWM1,{PWM_CLK_NEW_MODE_BLOCK,CLK_DIV128,4,4}}, //modify
//{"lcd-backlight",MT65XX_LED_MODE_CUST,(int)DISP_SetBacklight,{0}},
};
..\mediatek\platform\mt6582\kernel\drivers\leds\leds.c
mt65xx_flashlight_on(){}
mt65xx_flashlight_off(){}
2.1 LED背光亮度修改:
mediatek\source\kernel\drivers\leds\leds.c
验证方式:adb shell查看:
shell@android:/sys/class/leds/lcd-backlight$ cat max_brightness
备注:MMI层最亮、最暗背光调节代码:
./config.xml:
<integername="config_screenBrightnessDim">20</integer>
\alps\frameworks\base\core\java\android\os\PowerManager.java:
private staticfinal int MAXIMUM_BACKLIGHT = android.os.PowerManager.BRIGHTNESS_ON;
3. Flash配置:
3.1 型号配置:
3.1.1 CUSTOM_MEMORY_HDR(需要确认是否是MTK认证的flash ic)
mediatek\custom\$(PROJECT)\preloader\inc\custom_MemoryDevice.h
#defineBOARD_ID MT6577_EVB
#defineCS_PART_NUMBER[0] H9TP32A4GDMCPR_KDM
#defineCS_PART_NUMBER[1] KMKUS000VM_B410
备注:新增flash ic添加到此处,flash可以做到兼容;不能兼容相同IC Id的memeory ic.
3.2 特定项目不同类型分区定义信息(是否定义、顺序):
mediatek\custom\\kernel\core\src\partition.c
structpart_name_map g_part_name_map[PART_MAX_COUNT] = {
{"preloader", PART_PRELOADER, "rawdata", 0, 0, 0},
{"dsp_bl", PART_DSP_DL, "rawdata", 1, 0, 0},
{"mbr", PART_MBR, "raw data", 2, 1, 1},
{"ebr1", PART_EBR1, "raw data", 3, 1, 1},
{"pmt", PART_PMT, "raw data", 4, 0, 0},
{"nvram", PART_NVRAM, "rawdata", 5, 0, 0},
{"seccfg", PART_SECURE, "raw data", 6, 0, 0},
{"uboot", PART_UBOOT, "raw data", 7, 1, 1},
{"boot", PART_BOOTIMG, "raw data", 8, 1, 1},
{"recovery", PART_RECOVERY, "rawdata", 9, 1, 1},
{"sec_ro", PART_SECSTATIC, "ext4", 10, 0, 0},
{"misc", PART_MISC, "raw data", 11, 0, 0},
{"logo", PART_LOGO, "raw data", 12, 1, 1},
{"expdb", PART_APANIC, "raw data", 13, 0, 0},
{"system", PART_ANDSYSIMG, "ext4", 14, 1, 1},
{"cache", PART_CACHE, "ext4", 15, 1, 1},
{"userdata", PART_USER, "ext4", 16, 1, 1},
{"fat", PART_FAT, "fat", 17, 0, 0},
};
3.3 emmc scat 分区大小设置(emmc) :
可对emmc进行分区,修改preloader\systemimage\userdata\FAT等各个分区。
\alps\mediatek\build\tools\ptgen\MT6577\partition_table_MT6577.xls
备注:Cache分区需要保持在512mb左右,否则系统会比较慢,响应迟缓。
3.4 FLASH参数配置文件位置(MemoryDeviceList_MT6577.xls):
MEMORY_DEVICE_XLS =
mediatek\build\tools\emigen\$(MTK_PLATFORM)\MemoryDeviceList_$(MTK_PLATFORM).xls
.xls文件含三个页面:
MT6577(page one):配置Flash Vendor Id 对应的硬件参数。
NAND(page two):
emmc_region(pagethree)
3.5 Flash驱动电压修改,读写速度方式修改:
mediatek\custom\konka73_gb\kernel\core\src\board.c
struct msdc_hw msdc0_hw = {
.clk_src = 1,
.cmd_edge =MSDC_SMPL_FALLING,
.data_edge =MSDC_SMPL_FALLING,
.clk_drv = 5, //: 0 //memory驱动电压
.cmd_drv = 5, //: 0
.dat_drv = 5, // : 0
#ifdefMTK_EMMC_SUPPORT
.data_pins = 8,
#else
.data_pins = 4,
#endif
.data_offset = 0,
#ifdefMTK_EMMC_SUPPORT
.flags = MSDC_SYS_SUSPEND | MSDC_HIGHSPEED,//memory读写速度
// .flags = MSDC_SYS_SUSPEND | MSDC_HIGHSPEED |MSDC_UHS1 | MSDC_DDR,
//.flags = MSDC_SYS_SUSPEND,
#else
.flags =MSDC_SDCARD_FLAG,
#endif
3.6 emmc FAT分区划分:
emmc型号、emmc软件分区都会影响FAT分区的大小。
验证FAT Size需要对应emmc型号机器下载对应emmc软件分区的软件,不能预先下载FAT部分(影响实际FAT分区大小):
adb shell
cat /proc/emmc
cat /proc/partition获取大小。
4.GPIO/EINT/ADC/KEYPAD/PMIC 配置(根据原理图设计,可有原理硬件工程师指导填写即可):
4.1工具及dws文件位置:
mediatek\source\dct\DrvGen
mediatek\custom\$(PROJECT)\kernel\dct\dct\codegen.dws
4.2 dws配置文件位置:
.\mediatek\build\makemtk.mk
4.3 gpio设置方法:
mt_set_gpio_mode(GPIO_CTP_EN_PIN,GPIO_CTP_EN_PIN_M_GPIO);
mt_set_gpio_dir(GPIO_CTP_EN_PIN,GPIO_DIR_OUT); //GPIO_DIR_IN);
mt_set_gpio_out(GPIO_CTP_EN_PIN,GPIO_OUT_ZERO); // GPIO_OUT_ONE);
5.keypad
5.1按键配置(根据原理图):DCT(Driver Customization Tool):
..\mediatek\custom\prj\kernel\dct\dct\codegen.dws
.. \mediatek\source\dct\DrvGen.exe
客制化:按键定义表、de-bounce time 、Power key Eint Gpio、DownLoadKey、|Mode Key、Factory Key、Recovery Key
5.2factory mode工厂模式按键定义
..\mediatek\custom\\factory\inc\cust_keys.h
//工厂按键测试映射表,在.dws中配置按键映射表后自动生成
\alps\mediatek\custom\prj\kernel\dct\dct\cust_kpd.h
#defineKEYS_PWRKEY_MAP { KEY_POWER,"Power" }
#defineDEFINE_KEYS_KEYMAP(x) \
struct key x[] = { \
KEYS_PWRKEY_MAP, \
{ KEY_HOME, "Home" }, \
{ KEY_MENU, "Menu" }, \
{ KEY_HOMEPAGE, "HomePage" }, \
}
//工厂模式按键定义
#define CUST_KEY_UP KEY_UP
#defineCUST_KEY_VOLUP KEY_PAGEUP // KEY_VOLUMEUP
#defineCUST_KEY_DOWN KEY_DOWN
#defineCUST_KEY_VOLDOWN KEY_VOLUMEDOWN // KEY_VOLUMEDOWN
#defineCUST_KEY_LEFT KEY_MENU
#defineCUST_KEY_CENTER KEY_HOMEPAGE
#define CUST_KEY_RIGHT KEY_BACK
#defineCUST_KEY_CONFIRM KEY_VOLUMEUP // KEY_HOME
#defineCUST_KEY_BACK KEY_POWER
5.3 recoverymode恢复模式按键定义
\mediatek\custom\prj\recovery\inc\cust_keys.h
#defineRECOVERY_KEY_DOWN KEY_VOLUMEDOWN
#defineRECOVERY_KEY_UP KEY_VOLUMEDOWN
#defineRECOVERY_KEY_ENTER KEY_VOLUMEUP
#defineRECOVERY_KEY_MENU KEY_POWER
5.4 home键配置(直接引出的,不需要在.dws中定义按键映射)
\alps\mediatek\custom\prj\kernel\kpd\kpd\mtk_kpd.h
#defineKPD_PMIC_RSTKEY_MAP KEY_HOME
home键添加唤醒功能
\alps\mediatek\config\prj\mtk-kpd.kl
key 102 HOME WAKE
6.PM 充电
6.1 配置文件位置:
CUSTOM_KERNEL_BATTERY= battery
mediatek\custom\\kernel\battery\battery\cust_battery.h
mediatek\custom\\kernel\battery\battery\custom_fuel_gauge.h
6.2充电常用参数修改:
..\mediatek\custom\\kernel\battery\battery\cust_battery.h
6.2.1充电电流修改:
#defineUSB_CHARGER_CURRENT Cust_CC_550MA // :Cust_CC_450MA
#define AC_CHARGER_CURRENT Cust_CC_800MA // : Cust_CC_650MA
6.2.2.充电电阻设定(根据硬件的bom):
#defineR_CURRENT_SENSE 2 //0.2 Ohm// 0.2欧姆
6.2.3 充电温度检测设定
#defineBAT_TEMP_PROTECT_ENABLE 1 //
// #defineBAT_NTC_TSM_1
NTC修改为10K电阻或者47K电阻(NTC 为电池温度保护NegativeTemperature Coefficient)
#define BAT_NTC_101 //#define BAT_NTC_47 0
其他:
#defineV_CHARGER_MIN 4400 //modify //4400 // 4.4 V
#defineV_CHARGER_ENABLE 1 //1:ON , 0:OFF //
6.7充电界面显示修改:
\mediatek\custom\\lk\include\target\cust_display.h//坐标
\mediatek\platform\mt6577\lk\mt_logo.c//显示
6.8 电池容量、电池曲线修改:
电池容量修改:
mediatek\custom\\kernel\battery\battery\custom_fuel_gauge.h
#define Q_MAX_POS_50 ((2168* 1316) / 1307)
#define Q_MAX_POS_25 2168
#define Q_MAX_POS_0 ((2168 * 1220) / 1307)
#define Q_MAX_NEG_10 ((2168 * 1162) / 1307)
#define Q_MAX_POS_50_H_CURRENT ((2168 * 1295) / 1307)
#define Q_MAX_POS_25_H_CURRENT ((2168 * 1270) / 1307)
#define Q_MAX_POS_0_H_CURRENT ((2168 * 1102) / 1307)
#define Q_MAX_NEG_10_H_CURRENT ((2168 * 599) / 1307)
电池曲线集成方式:(电压-百分比对应表需要电池厂商提供)
mediatek\custom\\kernel\battery\battery\cust_fuel_gauge.h
BATTERY_PROFILE_STRUCbattery_profile_t1[] =// T1 0C
BATTERY_PROFILE_STRUCbattery_profile_t2[] =// T2 25C
7.camera
7.1 相关代码位置:
mediatek\config\XXXX(红色字为具体的项目名)
文件:ProjectConfig.mk
CUSTOM_KERNEL_IMGSENSOR = …… gc2235_raw
CUSTOM_KERNEL_MAIN_IMGSENSOR = …… gc2235_raw
CUSTOM_HAL_IMGSENSOR = …… gc2235_raw
CUSTOM_HAL_MAIN_IMGSENSOR = …… gc2235_raw
kernel:
\mediatek\custom\common\kernel\imgsensor\gc2235_raw
mediatek\custom\common\kernel\imgsensor\src
文件:kd_sensorlist.h
添加内容:
UINT32 GC2235SensorInit(PSENSOR_FUNCTION_STRUCT *pfFunc);
ACDK_KD_SENSOR_INIT_FUNCTION_STRUCT
kdSensorList[MAX_NUM_OF_SUPPORT_SENSOR+1] =
{
#if defined(GC2235_RAW)
{GC2235_SENSOR_ID, SENSOR_DRVNAME_GC2235_RAW, GC2235SensorInit},
#endif
};
mediatek\custom\common\kernel\imgsensor\inc
文件:kd_imgsensor.h
添加内容:
#define GC2235_SENSOR_ID 0x2235
#define SENSOR_DRVNAME_GC2235_RAW "gc2235"
hal
\mediatek\custom\common\hal\imgsensor\gc2235_raw
mediatek\custom\common\hal\imgsensor\src
文件:sensorlist.cpp
添加内容:
MSDK_SENSOR_INIT_FUNCTION_STRUCT SensorList[] =
{
…………
#if defined(GC2235_RAW)
RAW_INFO(GC2235_SENSOR_ID, SENSOR_DRVNAME_GC2235_RAW, NULL),
#endif
…………
};
注意:在 kdSensorList 和 SensorList里面添加驱动的时候要注意,Sensor添加的位置要一样。否则驱动会跑乱,轻则ISP参数不对,重则 Sensor 无法启动。
7.2 拍照图片尺寸设置:
..\mediatek\custom\\hal\camera\camera\cfg_ftbl_$prj$_raw_main.h
//Capture Size
CONFIG_FEATURE(FID_CAP_SIZE,
BY_DEFAULT(CAPTURE_SIZE_1600_1200),
/*BY_DEFAULT(CAPTURE_SIZE_2560_1920), modify*/
CAPTURE_SIZE_640_480,
CAPTURE_SIZE_1280_960,CAPTURE_SIZE_1600_1200,
)
7.3 Camera物理角度旋转
90度:
\alps\mediatek\custom\$prj$\hal\imgsensor\src\cfg_setting_imgsensor.cpp
static SensorOrientation_T const inst = {
u4Degree_0 : 180,//90, // main sensor in degree (0, 90,180, 270)
u4Degree_1 : 0,//90, // sub sensor in degree (0, 90, 180, 270)
180度:
Sensor FAE提供修改方法。
7.4Camera 相同sensor id兼容方式(前后sensor id一致):
//配置区分:
CUSTOM_KERNEL_IMGSENSOR = gc0308_yuv# gc0308_sub_yuv
CUSTOM_KERNEL_MAIN_IMGSENSOR =gc0308_yuv # gc0308_sub_yuv
CUSTOM_HAL_IMGSENSOR = gc0308_yuv# gc0308_sub_yuv
CUSTOM_HAL_MAIN_IMGSENSOR = gc0308_yuv# gc0308_sub_yuv
//kernel:函数名也要区分
\alps\mediatek\custom\common\kernel\imgsensor\gc0308_sub_yuv
\alps\mediatek\custom\common\kernel\imgsensor\gc0308_yuv
//hal: 函数名也要区分
\alps\mediatek\custom\common\hal\imgsensor\gc0308_sub_yuv
\alps\mediatek\custom\common\hal\imgsensor\gc0308_yuv
//kdSensorList 和 SensorList里面添加驱动也要区分,sensor id不要区分,写成一致,根据前后摄像头开关代码区分。
#define GC0328_SENSOR_ID 0x009D
#defineGC0328_SUB_SENSOR_ID 0x9D9D
\alps\mediatek\custom\common\kernel\imgsensor\gc0328frontyuv_Sensor.c
GC0328_FRONTGetSensorID(){
if (sensor_id == GC0328_SENSOR_ID) {
sensor_id = GC0328_FRONT_SENSOR_ID; //---lcz
break;
}
if(sensor_id != GC0328_FRONT_SENSOR_ID) //---lcz
{
return ERROR_SENSOR_CONNECT_FAIL;
}
}
GC0328_FRONTOpen(){
if (sensor_id == GC0328_SENSOR_ID) {
sensor_id = GC0328_FRONT_SENSOR_ID; //---lcz
break;
}
if(sensor_id != GC0328_FRONT_SENSOR_ID) {
return ERROR_SENSOR_CONNECT_FAIL;
}
}
8. Voice coil motor摄像头上的自动调焦音圈马达
CUSTOM_HAL_LENS =dummy_lens dummy_lens
CUSTOM_KERNEL_LENS= dummy_lens dummy_lens
CUSTOM_HAL_MAIN_LENS= dummy_lens
CUSTOM_HAL_MAIN_BACKUP_LENS=
CUSTOM_HAL_SUB_LENS= dummy_lens
CUSTOM_HAL_SUB_BACKUP_LENS=
CUSTOM_KERNEL_MAIN_LENS= dummy_lens
CUSTOM_KERNEL_MAIN_BACKUP_LENS=
CUSTOM_KERNEL_SUB_LENS= dummy_lens
CUSTOM_KERNEL_SUB_BACKUP_LENS=
mediatek\custom\common\kernel\lens\dummy_lens\dummy_lens.c
10. TouchPanel
10.1配置
CUSTOM_KERNEL_TOUCHPANEL= gt818b
..\mediatek\custom\common\kernel\touchpanel\src\mtk_tpd.c
..\mediatek\custom\common\kernel\touchpanel\gt818b
module_init(tpd_driver_init);
module_exit(tpd_driver_exit);
tpd_driver_add(&tpd_device_driver);
tpd_driver_remove(&tpd_device_driver);
10.2 TP原点由IC商现场调试后释放方案设计公司。
10.3 引脚定义
复位脚、中断、I2C
10.4 物理概念
T+G 双层玻璃
P+G 单层玻璃
10.5 TP实现距离感应功能宏开关:
mediatek\custom\common\kernel\touchpanel\gslX680\ gslX680_driver.c
//#defineTPD_PS_SUPPORT
11 震动马达
CUSTOM_KERNEL_VIBRATOR=vibrator
a.马达震动幅度(MT6582及其他最新平台):
..\mediatek\custom\\kernel\vibrator\cust_vibrator.c
static structvibrator_hw cust_vibrator_hw = {
.vib_timer = 80,//30, //振动时长
.vib_limit = 9,//振动??
.vib_vol = 0x5, //2.8V for vibr // :0x5//振动电压
};
b.马达震动幅度MT6577直接修改pmic驱动电压:
此文件可以修改各个gpio驱动电压:
\alps\mediatek\platform\mt6577\lk\mt_pmic.c
voidPMIC_CUSTOM_SETTING_V1(void) {}
ret=pmic_config_interface(BANK0_DIGLDO_CON33,0x3,
BANK_0_RG_VIBR_VOSEL_MASK,BANK_0_RG_VIBR_VOSEL_SHIFT);//0x4
12. RTC
12.1配置文件位置:
CUSTOM_KERNEL_RTC =rtc
mediatek\custom\konka73_gb\kernel\rtc\rtc\rtc-mt6573.h
mediatek\platform\mt6573\kernel\drivers\rtc\mtk_rtc.c
12.2. RTC默认日期
\alps\mediatek\custom\[project]\preloader\inc\cust_rtc.h
\alps\mediatek\custom\[project]\kernel\rtc\rtc\rtc-mt65XX.h
#defineRTC_DEFAULT_YEA 2013//2010//cbk..default.date.2013.07.12
#defineRTC_DEFAULT_MTH 7// 1ff
13. wifi
CUSTOM_KERNEL_WIFI=
MTK_SCREEN_OFF_WIFI_OFF= no
MTK_WIFI_P2P_SUPPORT= yes
MTK_WIFI_HOTSPOT_SUPPORT= yes
mediatek\custom\common\kernel\wifi\mt592x\dummy.c
14.. HEADSET
CUSTOM_KERNEL_HEADSET= accdet
MTK_HEADSET_ICON_SUPPORT= yes
mediatek\custom\konka73_gb\kernel\headset\accdet\accdet_custom.h
14 SIM
14.1双卡、单卡版本切换:
(具体定义方法参考基线代码释放的ReleaseNote_for_MT6582_****.xlsx文件的page:Switchable_Features)
Double SIM
GEMINI = yes
MTK_GEMINI_ENHANCEMENT= yes
MTK_SHARE_MODEM_SUPPORT= 2
MTK_SHARE_MODEM_CURRENT= 2
Single SIM
GEMINI = no
MTK_GEMINI_ENHANCEMENT= no
MTK_SHARE_MODEM_SUPPORT= 2
MTK_SHARE_MODEM_CURRENT= 1
14.2 simcard热插拔功能
MTK_SIM_HOT_SWAP=yes
MTK_SIM_HOT_SWAP_COMMON_SLOT=yes
.dws配置方法(由原理图设计填写):
16. 传感器
MTK_SENSOR_SUPPORT= yes
CUSTOM_KERNEL_ACCELEROMETER= auto//重力加速度传感器
CUSTOM_KERNEL_MAGNETOMETER=akm8975//磁力感应器//
CUSTOM_KERNEL_ALSPS= tmd2771//光感距离传感器
CUSTOM_KERNEL_BAROMETER=//气压计
CUSTOM_KERNEL_GYROSCOPE=//陀螺仪
16.1 重力加速度传感器(G-sensor感应器)
CUSTOM_KERNEL_ACCELEROMETER= auto//传感器
#ifdefined(MTK_AUTO_DETECT_ACCELEROMETER)
\mediatek\source\kernel\drivers\hwmon\hwmsen\Hwmsen_dev.c
inthwmsen_gsensor_add(struct sensor_init_info* obj)
\mediatek\custom\common\kernel\accelerometer\auto\
重力传感方向设置:
\alps\mediatek\custom\\kernel\accelerometer\mc3210\cust_acc.c
static structacc_hw cust_acc_hw = {
.i2c_num = 2,
.direction = 5, // modify//重力传感方向
16.2 ALS\PS 光感距离传感器
CUSTOM_KERNEL_ALSPS= tmd2771
mediatek\custom\common\kernel\alsps\tmd2771\tmd2771.c
mediatek\custom\common\kernel\alsps\tmd2771\tmd2771.h
mediatek\custom\prj\kernel\alsps\tmd2771\cust_alsps.c
16.3 GYRO-sensormotion sensor 陀螺仪
CUSTOM_KERNEL_GYROSCOPE= l3g4200d
mediatek\custom\common\kernel\gyroscope\l3g4200d\l3g4200d.c
mediatek\custom\prj\kernel\gyroscope\l3g4200d\cust_gyro.c
16.4BAROMETER-sensor 气压计
CUSTOM_KERNEL_BAROMETER= ms5607
mediatek\custom\prj\kernel\barometer\ms5607\cust_baro.c
mediatek\custom\common\kernel\barometer\ms5607\ms5607.c
16.5 MAGNETOMETER 磁感应器
\alps\mediatek\custom\\kernel\magnetometer\yamaha532\cust_mag.c
磁感应方向设置:
static structmag_hw cust_mag_hw = {
.i2c_num = 2,
.direction = 3,//磁感应方向//参照规格书
.power_id = MT65XX_POWER_NONE, /*!< LDO is not used */
.power_vol= VOL_DEFAULT, /*!< LDO is not used */
};
16.6 compass 指南针
CUSTOM_KERNEL_MAGNETOMETER= akm8975
mediatek\custom\common\kernel\magnetometer\akm8975\akm8975.c
mediatek\custom\konka73_gb\kernel\magnetometer\akm8975\cust_mag.c
17. flashlight
CUSTOM_HAL_FLASHLIGHT= dummy_flashlight
CUSTOM_KERNEL_FLASHLIGHT= dummy_flashlight
闪光灯类型:
#constant_flashlight 补光灯(camera闪光灯)
#peak_flashlight
#torch_flashlight 手电筒
# dummy_flashlight
备注:camera闪光灯与camera驱动无关,只需要打开开关,这是由MTK开发的独立功能。
mediatek\custom\common\kernel\flashlight\dummy_flashlight\dummy_flashlight.c
mediatek\custom\common\kernel\flashlight\src\kd_flashlightlist.c
mediatek\custom\common\kernel\flashlight\
17.1 LED闪光灯配置为手电筒模式:???
18. jogball 轨迹球
CUSTOM_KERNEL_JOGBALL=
mediatek\custom\common\kernel\jogball\
18. atv
CUSTOM_HAL_MATV =
CUSTOM_KERNEL_MATV=
HAVE_MATV_FEATURE=yes#no #Armin
MTK_ATV_CHIP=MTK_MT5193 # Armin
MTK_MATV_ANALOG_SUPPORT=yes#no//模拟通道、数字通道切换功能开关
mediatek\custom\common\kernel\matv\mt5193\matv.c
19. sound
MTK_SOUNDRECORDER_APP= yes
CUSTOM_KERNEL_SOUND= speaker
mediatek\custom\common\kernel\sound\inc\yusu_android_speaker.h
mediatek\custom\konka73_gb\kernel\sound\speaker\yusu_android_speaker.c
20. USB
CUSTOM_KERNEL_USB =mt6577
mediatek\custom\common\kernel\usb\src\Makefile
mediatek\custom\mt6573\kernel\usb\src\mtk_usb_custom.c
mediatek\custom\mt6573\kernel\usb\src\mtk_usb_custom.h
mediatek\custom\mt6573\uboot\inc\cust_sdc.h
mediatek\platform\mt6573\kernel\drivers\usb-gadget\
mediatek\platform\mt6573\kernel\drivers\power\
20.1 USB OTG功能(终端连接外接U盘)
alps/mediatek/config/{project}/autoconfig/kconfig/project中打开
CONFIG_USB_MTK_OTG=y
CONFIG_USB_MTK_HDRC_HCD= y
20.2 MTP(MediaTransfer Protocol)
USB连接设备,可选存储方式介绍:
USB存储设备、MTP(媒体设备)、PTP(相机)、只充电、内置光盘。
21. BT
MTK_WLAN_CHIP =MT6620 # candidate settings: MT6620
MTK_BT_CHIP =MTK_MT6620 # candidate settings:MTK_MT6611\MTK_MT6612\MTK_MT6616\MTK_MT6620
MTK_WLAN_SUPPORT =yes
MTK_BT_SUPPORT = yes
MTK_WLAN_SUPPORT =yes
MTK_WLANBT_SINGLEANT= no
MTK_BT_30_HS_SUPPORT= yes
####config BTfeature###########
# please do notmodify these options
MTK_BT_21_SUPPORT =yes
MTK_BT_30_SUPPORT =yes
MTK_BT_40_SUPPORT =yes
MTK_BT_FM_OVER_BT_VIA_CONTROLLER= yes
MTK_BT_PROFILE_OPP= yes
MTK_BT_PROFILE_SIMAP= yes
MTK_BT_PROFILE_PRXM= yes//蓝牙距离感应装置
MTK_BT_PROFILE_PRXR= yes//蓝牙距离感应装置
MTK_BT_PROFILE_HIDH= yes//无线输入设备
MTK_BT_PROFILE_FTP= yes
MTK_BT_PROFILE_PBAP= yes
MTK_BT_PROFILE_MANAGER= yes
MTK_BT_PROFILE_BPP= yes
MTK_BT_PROFILE_BIP= yes
MTK_BT_PROFILE_DUN= yes
MTK_BT_PROFILE_PAN= yes
MTK_BT_PROFILE_HFP= yes
MTK_BT_PROFILE_A2DP= yes
MTK_BT_PROFILE_AVRCP= yes
MTK_BT_PROFILE_AVRCP14= yes
MTK_BT_PROFILE_TIMEC= no
MTK_BT_PROFILE_TIMES= no
MTK_BT_PROFILE_MAPS= no
MTK_BT_PROFILE_MAPC= no
MTK_BT_PROFILE_SPP= yes
####config BTfeature end ####
mediatek\custom\common\kernel\btwlanem\btwlanem\btwlanem.c
22. FM
MTK_FM_CHIP =MT6620_FM
MTK_FM_SUPPORT =yes
MTK_FM_TX_SUPPORT =yes
MTK_FM_AUDIO =FM_ANALOG_INPUT
#FM_DIGITAL_INPUT
mediatek\custom\common\kernel\fm\mt6620\dummy.c
24. OFN 光学手指鼠标
CUSTOM_KERNEL_OFN =ofn1090
mediatek\custom\common\kernel\ofn\inc
mediatek\custom\konka73_gb\kernel\ofn\ofn1090\cust_ofn.c
26.modem
3g: \modem\make\PRJ_HSPA.mak
2g: \modem\make\PRJ_GPRS.mak
26.1modem模块位置及组成
配置文件位置:\prj\modem\make\PRJ_HSPA.mak
工程名称配置:BOARD_VER = PRJ_BB
26.2 modem源码工程编译(../prj/modem)
./make.shPRJ_HSPA.mak new
26.3 modem文件修改:
RF模块名配置:(安装项目区分定义文件夹名称)
\prj\modem\make\PRJ_HSPA.mak
GSM射频模块:RF_MODULE = MT6162_CUSTOM
3G射频模块:UMTS_RF_MODULE = CUSTOM_MT6162
射频参数配置:
GSM射频参数:
\prj\modem\custom\l1_rf\MT6162_CUSTOM\m12193.c
\prj\modem\custom\l1_rf\MT6162_CUSTOM\l1d_custom_rf.h
\prj\modem\custom\l1_rf\MT6162_CUSTOM\l1d_custom_rf_.h
\prj\modem\custom\l1_rf\MT6162_CUSTOM\l1d_custom_rf_.h
3G射频参数:
\prj\modem\custom\ul1_rf\CUSTOM_MT6162\u12193.c
\prj\modem\custom\ul1_rf\CUSTOM_MT6162\ul1d_custom_rf.h
\prj\modem\custom\ul1_rf\CUSTOM_MT6162\ul1d_custom_rf_.h
\prj\modem\custom\ul1_rf\CUSTOM_MT6162\ul1d_custom_rf_.h
26.4 编译好文件修改名称并拷贝:
\modem\build\_PRJ\DEFAULT\bin:
DbgInfo_WR8.W1315.MD.WG.MP__PRJ_MOLY_WR8_W1315_MD_WG_MP_V15_2013_12_10_11_50_PRJ.mak
PRJ_PCB01_MT6582_S00.elf
PRJ_PCB01_MT6582_S00.MOLY_WR8_W1315_MD_WG_MP_V15.bin
\modem\build\_PRJ\DEFAULT\tst\database
BPLGUInfoCustomAppSrcP_MT6582_S00_MOLY_WR8_W1315_MD_WG_MP_V15
catcher_filter.bin
修改名称,分别修改为:
DbgInfo_WR8.W1315.MD.WG.MP__PRJ_MOLY_WR8_W1315_MD_WG_MP_V15_2013_12_10_11_50_1_wg_n
modem_1_wg_n.mak
PRJ_PCB01_MT6582_S00_1_wg_n.elf
modem_1_wg_n.img
BPLGUInfoCustomAppSrcP_MT6582_S00_MOLY_WR8_W1315_MD_WG_MP_V15_1_wg_n
catcher_filter_1_wg_n.bin
26.5 modem库替换编译(..prj/alps/mediate/custom/common/modem)
CUSTOM_MODEM=YOUR_MODEM
此编译表示:已将在modem源码工程中编译好的镜像放入MTKAndroid 工程中后,存放位置:
./mediatek/custom/common/modem/YOUR_MODEM
执行如下编译命令:./mk update-modem,这个命令会依次做如下步骤:
1. custgen 2. check modem 3. sign modem 4.update modem
gmodemband2 band7调换:
\modem\custom\modem\ul1_rf\_PCBV1P1_PAAIR_B1258\ul1d_custom_rf.h
/*MT6166*/#define PDATA_BAND2_PR1 0x0007
/*MT6166*/#define PDATA_BAND2_PR2 0x0007
/*MT6166*/#define PDATA_BAND2_PR2B 0x0007
/*MT6166*/#define PDATA_BAND2_PR3 0x0000
/*MT6166*/#define PDATA_BAND2_PT1 0x0007
/*MT6166*/#define PDATA_BAND2_PT2 0x0107
/*MT6166*/#define PDATA_BAND2_PT2B 0x0107
/*MT6166*/#define PDATA_BAND2_PT3 0x0000
/*MT6166*/ /*--------------------- PDATA_BAND2 End ------------------------------*/
/*MT6166*/ /*--------------------- PDATA_BAND5 Start ----------------------------*/
/*MT6166*/#define PDATA_BAND5_PR1 0x0002
/*MT6166*/#define PDATA_BAND5_PR2 0x0002
/*MT6166*/#define PDATA_BAND5_PR2B 0x0002
/*MT6166*/#define PDATA_BAND5_PR3 0x0000
/*MT6166*/#define PDATA_BAND5_PT1 0x0002
/*MT6166*/#define PDATA_BAND5_PT2 0x0202
/*MT6166*/#define PDATA_BAND5_PT2B 0x0202
射频频段
2G:850/900/1800/1900
3G:
Band1 –2100???(其他)
Band2 --
Band5 --
Band8 --
WCDMA B1+B8:主要是欧洲
Wcdma B1+B2+B5:南美
Wcdma B2+B4+B5:北美
29.SD卡
27.1热插拔功能
1,sd卡热插拔机制的实现需要软件和硬件同时配合才能实现。
2,在电路上,需要一根单独的检测pin脚,通过检测pin脚的高低电平来检测sd卡的插拔动作,并在dws中将其配置成上拉或下拉
3,软件上的配置主要就是在\mediatek\custom\<proj>\kernel\core\src\board.c中,msdc1_hw 结构体中的 flags 的 MSDC_CD_PIN_EN 和MSDC_REMOVABLE,这两个flag是热插拔的flag,如果不需要热插拔,请把这两个flag移除。
4,如果是低电平触发,将msdc1_hw中的.cd_level 设置成 MSDC_CD_LOW,否则设置成MSDC_CD_HIGH
备注:
(1),从hardware的角度,sd 卡槽中的CD 引脚与chip的EINT的某个脚连在一起,且chip内部会有上拉电阻。
(2),dct的配置如下:
注:EINT16使用的哪个GPIO,可以参考硬件hw_config.xls文档
30.module(四合一芯片:FM/BT/WIFI/GPS)MT6628、MT6620
CUSTOM_HAL_COMBO=mt6628
CUSTOM_KERNEL_FM=mt6628
MTK_BT_CHIP=MTK_MT6628
MTK_FM_CHIP=MT6628_FM
MTK_WLAN_CHIP=MT6628
MTK_COMBO_CHIP=MT6628
MTK_GPS_CHIP=MTK_GPS_MT6628
31.音频参数集成(全部参数由硬件提供,直接合成)
参照:[FAQ09151][Audio Drv]各个音频参数的功能说明
30.1 ring/key/mic/fmr/speech/sidetone/media/matv分别normal/headset/handfree三个模式的不同音量等级修改:
\mediatek\custom\\cgen\inc\audio_volume_custom_default.h//8个等级
\mediatek\custom\\cgen\inc\audio_ver1_volume_custom_default.h//16个等级
30.2 med/speech音频参数修改:
\mediatek\custom\\cgen\inc\med_audio_default.h
\mediatek\custom\\cgen\inc\sph_coeff_default.h
30.3 voip音频参数修改:
\mediatek\custom\\cgen\inc\audio_voip_custom.h
原文:http://blog.csdn.net/cbk861110/article/details/9385439