========================= Driver start ============
在/mediatek/custom下会有好多重名的文件,在不同的文件夹里,最终会编译哪个文件是根据目录的优先级来判断
brighter89_evdo_jb2 > mt6589 > common
也就是说如果brighter89_evdo_jb2,mt6589,common同时存在一文件,最终编译的会是brighter89_evdo_jb2目录下的文件
也可以通过/mediatek/custom/out/开判断,此文件时最终编译的文件
1. GPIO
运行/mediatek/dct/DrvGen.exe,
选择文件/mediatek/custom/brighter89_evdo_jb2/kernel/dct/dct/codegen.dws
Edit,打开后可以修改GPIO的模式,上拉,下拉,输入,输出
修改后点击“Save”和“Gen Code”
重新编译:./makeMtk brighter89_evdo_jb2 codegen
./makeMtk brighter89_evdo_jb2 new pl lk kernel
./makeMtk brighter89_evdo_jb2 bootimage
提交时替换bw/custom/project/g616/mediate/custom/brighter89_evdo_jb2/kernel/dct/dct
2. LCD
修改ProjectConfig.mk
CUSTOM_LK_LCM=hx8389b_qhd_dsi_vdo
BOOT_LOGO=qhd //根据屏的分辨率
CUSTOM_KERNEL_LCM=hx8389b_qhd_dsi_vdo
LCM_HEIGHT=960
LCM_WIDTH=540
/mediatek/custom/common/kernel/lcm目录名与ProjectConfig.mk 下hx8389b_qhd_dsi_vdo名字相同,目录下为驱动文件
在/mediatek/custom/common/kernel/lcm/mt65xx_lcm_list.c下添加要添加的屏
#if defined(HX8389B_QHD_DSI_VDO)
&hx8389b_qhd_dsi_vdo_lcm_drv,
#endif
3. CAMERA
ProjectConfig.mk下修改
CUSTOM_HAL_IMGSENSOR=ov5648_mipi_raw hi257_yuv //前后camera
CUSTOM_HAL_MAIN_IMGSENSOR=ov5648_mipi_raw
CUSTOM_HAL_SUB_IMGSENSOR=hi257_yuv
CUSTOM_KERNEL_IMGSENSOR=ov5648_mipi_raw hi257_yuv //前后camera
CUSTOM_KERNEL_MAIN_IMGSENSOR=ov5648_mipi_raw
CUSTOM_KERNEL_SUB_IMGSENSOR=hi257_yuv
驱动要添加的文件:
/mediatek/custom/common/kernel/imgsensor/ov5648_mipi_raw
/mediatek/custom/common/hal/imgsensor/ov5648_mipi_raw
//hi257前camera同理
/mediatek/custom/common/hal/imgsensor/src/sensorlist.cpp
#if defined(OV5648_MIPI_RAW)
RAW_INFO(OV5648MIPI_SENSOR_ID, SENSOR_DRVNAME_OV5648_MIPI_RAW, NULL),
#endif
/mediatek/custom/common/kernel/imgsensor/src/kd_sensorlist.h
#if defined(OV5648_MIPI_RAW)
{OV5648MIPI_SENSOR_ID, SENSOR_DRVNAME_OV5648_MIPI_RAW, OV5648MIPISensorInit},
#endif
Camera电所在文件:
/mediatek/custom/brighter89_evdo_jb2/kernel/camera/camera/kd_camera_hw.c 核心驱动文件:
/mediatek/custom/common/kernel/imgsensor/src/kd_sensorlist.c
如果修改HAL层参数 编译命令如下:
./makeMtk -t brighter89_evdo_jb2 mm mediatek/platform/mt6589/hardware/camera/
4. AF
ProjectConfig.mk下修改:
CUSTOM_HAL_LENS=dw9714af
CUSTOM_HAL_MAIN_LENS=dw9714af
CUSTOM_KERNEL_LENS=dw9714af
CUSTOM_KERNEL_MAIN_LENS=dw9714af
添加对应的文件夹和驱动文件
/G616/mediatek/custom/common/kernel/lens/dw9714af/DW9714AF.c
M config/mt6589/init.rc
M custom/brighter89_evdo_jb2/hal/lens/src/lenslist.cpp
M custom/common/hal/inc/camera_custom_lens.h
A custom/common/hal/lens/dw9714af/lens_para_DW9714AF.cpp
M custom/common/hal/lens/src/lenslist.cpp
A custom/common/kernel/lens/dw9714af/DW9714AF.c
A custom/common/kernel/lens/inc/DW9714AF.h
M platform/mt6589/hardware/camera/core/featureio/drv/lens/mcu_drv.cpp
5. flashled
ProjectConfig.mk下修改:
CUSTOM_KERNEL_FLASHLIGHT=constant_flashlight
CUSTOM_HAL_FLASHLIGHT=constant_flashlight
驱动核心:
/mediatek/custom/common/kernel/flashlight/src/kd_flashlightlist.c
/mediatek/custom/common/kernel/flashlight/constant_flashlight/leds_strobe.c
G616用的bd7710gwl driver IC,leds_strobe.c会有相应的更改,文件修改都放到bw目录下 HAL tunning 文件:
mediatek/custom/brighter89_evdo_jb2/hal/camera/camera/flash_tuning_custom.cpp
6. TP
ProjectConfig.mk下修改:
CUSTOM_KERNEL_TOUCHPANEL=ft5336
驱动文件:
mediatek/custom/common/kernel/touchpanel/ft5336/ft5336_driver.c
/home/chenjian/CJ_WORK/code/G616/mediatek/custom/brighter89_evdo_jb2/kernel/touchpanel/ft5336/tpd_custom_ft5336.h
7. sensor
ProjectConfig.mk下修改:
CUSTOM_KERNEL_ACCELEROMETER=lis3dh
CUSTOM_KERNEL_ALSPS=tmd2772
驱动文件:
/mediatek/custom/common/kernel/accelerometer/lis3dh/lis3dh.c //gsensor
配置I2c和Gsensor的position
/mediatek/custom/brighter89_evdo_jb2/kernel/accelerometer/lis3dh/cust_acc.c
static struct acc_hw cust_acc_hw = {
.i2c_num = 3,
.direction = 6, //chenjian 2013-12-26 modify gsensor position
.power_id = MT65XX_POWER_NONE, /*!< LDO is not used */
.power_vol= VOL_DEFAULT, /*!< LDO is not used */
.firlen = 0, //old value 16 /*!< don't enable low pass fileter */ };
/mediatek/custom/common/kernel/alsps/tmd2772/tmd2772.c //psensor light sensor
配置I2c和 light sensor上报数据
/mediatek/custom/brighter89_evdo_jb2/kernel/alsps/tmd2772/cust_alsps.c
.als_level = { 4, 40, 80, 120, 160, 240, 400, 800, 1200, 1600, 2000, 3000, 5000, 8000, 65535},
.als_value = {0,20, 60, 100, 150, 240, 400, 600, 1000, 1500, 2000, 3000, 5000, 8000, 10000, 10000},
8. memory
配置xls
/mediatek/build/tools/emigen/MT6589/MemoryDeviceList_MT6589.xls
都是MTK release的,需要添加的memory要在MemoryDeviceList_MT6589.xls表里,且名字与/mediatek/custom/brighter89_evdo_jb2/preloader/inc/custom_MemoryDevice.h名字需一样
如H9TP32A8JDBCPR_KGM 需和MemoryDeviceList_MT6589.xls表的名字一样
#define BOARD_ID MT6589_EVB
#define CS_PART_NUMBER[0] SD7DP28C_4G
#define CS_PART_NUMBER[1] H9TP32A8JDBCPR_KGM
Memory兼容: 向下添加即可
#define CS_PART_NUMBER[2]
#define CS_PART_NUMBER[3]
….
….
9. 音频参数
硬件同事,通过工具修改,导出文件,替换如下目录 /mediatek/custom/brighter89_evdo_jb2/cgen/inc/
======================= Driver end ======================
======================= Record start =====================
1. 调屏配置电压
(1)屏驱动源文件 sl006_ti_n_nmi.c
#ifdef BUILD_LK
pmic_config_interface( (kal_uint32)(DIGLDO_CON28), (kal_uint32)(0x3), (kal_uint32)( PMIC_RG_VGP1_VOSEL_MASK), (kal_uint32)(PMIC_RG_VGP1_VOSEL_SHIFT));
pmic_config_interface( (kal_uint32)(DIGLDO_CON7), (kal_uint32)(0x1), (kal_uint32)( PMIC_RG_VGP1_EN_MASK), (kal_uint32)( PMIC_RG_VGP1_EN_SHIFT));
#endif
(2)在 pmic_mt6323.c 搜 void dct_pmic_VGP1_sel(kal_uint32 volt) 或 void dct_pmic_VGP2_sel(kal_uint32 volt)
查看对应电压
0x3 对应 1.8V
0x5 对应 2.8V
2. 取消开机检测Camera,导致未检测到时没有Camera图标显示
\packages\apps\Camera\src\com\android\camera\DisableCameraReceiver.java
public void onReceive(Context context, Intent intent) {
//整个函数全注释掉
}
3. 点亮屏之后TP滑动是无效的,要过个3-5秒钟再滑才有效,有如下四种方法:
1)可以的话将i2c速度提高至400K
2) ts->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 1;
3) check_mem_data(ts->client);屏蔽掉内存数据检查函数,减去唤醒后因检查数据用掉的时间。
4)加个工作任务去单独处理load_fw.
注:一般选用第三种方法,在TP的源文件修改。
4. 开机后G-sensor有时有效,有时无效。
在 \mediatek\platform\mt6572\kernel\core\mt_devs.c
把G-sensor初始化部分放置 __init int mt_board_init(void){...}比较靠后的地方。
__init int mt_board_init(void){
...
...
#if defined(CUSTOM_KERNEL_ACCELEROMETER)
retval = platform_device_register(&sensor_gsensor);
printk("sensor_gsensor device!");
if (retval != 0)
return retval;
#endif
...
}
5. 调摄像头相关流程,请查看如下文档:
MTK平台camera(摄像头)调试教程.doc
6. Android4.4 NavigationBar
\mediatek\custom\common\resource_overlay\navbar\frameworks\base\core\res\res\values\config.xml
<bool name="config_showNavigationBar">true</bool>
7. 背光延时
Kernel层:\mediatek\platform\mt6572\kernel\drivers\leds\leds.c
int mt_mt65xx_led_set_cust(struct cust_mt65xx_led *cust, int level)
{
switch (cust->mode) {
case MT65XX_LED_MODE_PWM:
...
mdelay(200);//add
...
}
....
}
LK层:\mediatek\platform\mt6572\lk\mt_leds.c
static int mt65xx_led_set_cust(struct cust_mt65xx_led *cust, int level)
{
switch (cust->mode) {
case MT65XX_LED_MODE_PWM:
...
mdelay(200);//add
...
}
....
}
8. Q:开机点亮背光和显示第一张Logo,在时间顺序上显示不同步,也就是说开机先点亮了背光,再过两秒才显示Logo。
A:在屏初始化的地方手动加了打开背光 lcd_bl_enable(1);把此处去掉即可。
9. 进Camera时,SD卡会自动移除,退出Camera,SD卡自动识别的问题
答:那是因为SD卡热拔插的问题,因为GPIO73是Camera MIPI接口用到了些IO口。SD不支持热拔插,所以要去掉热拔插功能。
(注:SD卡热拔插默认是GPIO73,配成MC1_INS, GPIO_SDHC_EINT_PIN)
去掉SD卡热拔插在如下文件:\mediatek\custom\q600\kernel\core\src\board.c
#define MSDC_SDCARD_FLAG (MSDC_SYS_SUSPEND | MSDC_HIGHSPEED| MSDC_UHS1 |MSDC_DDR) //去掉 MSDC_CD_PIN_EN | MSDC_REMOVABLE
或
struct msdc_hw msdc1_hw = {
...
.flags = MSDC_EXT_SDIO_IRQ | MSDC_HIGHSPEED,//| MSDC_CD_PIN_EN | MSDC_REMOVABLE,
...};
10. OV5645Camera一进入时马达振动问题解决
(1)在 kd_camera_hw.c 上电时序,屏蔽掉AF上电(CAMERA_POWER_VCAM_A2)
(2)在ov5645mipiyuv_Sensor.c的
static bool AF_Power = false;
UINT32 OV5645MIPIOpen(void)
{...
//AF_Power(1);//motor power 在此处对马达上电
if(false == AF_Power)
{
OV5645MIPISENSORDB("[OV5645Sensor] AF Power on.\n");
if(TRUE != hwPowerOn(CAMERA_POWER_VCAM_A2, VOL_2800,"OV5645_AF"))//PMIC_APP_MAIN_CAMERA_POWER_AF
{
printk("[CAMERA SENSOR AF] Fail to enable analog power\n");
return -EIO;
}
AF_Power = true;
}
else
{
OV5645MIPISENSORDB("[OV5645Sensor] AF Power has already on.\n");
}
}
(3)在UINT32 OV5645MIPIClose(void){
//AF_Power(0);//motor power 在此处对马达下电
if(true == AF_Power)
{
OV5645MIPISENSORDB("[OV5645Sensor] AF Power down.\n");
if(TRUE != hwPowerDown(CAMERA_POWER_VCAM_A2,"OV5645_AF"))
{
printk("[CAMERA SENSOR AF] Fail to enable analog power\n");
return -EIO;
}
AF_Power = false;
}
else
{
OV5645MIPISENSORDB("[OV5645Sensor] AF Power is already off.\n");
}
}
11. 上拉电阻的作用
上拉电阻: 就是从电源高电平引出的电阻接到输出.
上拉就是将不确定的信号通过一个电阻嵌位在高电平,电阻同时起限流作用.
上拉是对器件注入电流,下拉是输出电流,弱强只是上拉电阻的阻值不同,没有什么严格区分.
上,就是指高电平;所谓下,是指低电平。
上拉,就是通过一个电阻将信号接电源,一般用于时钟信号数据信号等。
下拉,就是通过一个电阻将信号接地,一般用于保护信号。这是根据电路需要设计的,主要目的是为了防止干扰,增加电路的稳定性。
12. 锁屏旋转
搜索
<bool name="config_enableLockScreenRotation">false</bool>
<bool name="lockscreen_isPortrait">true</bool>
改为:
<bool name="config_enableLockScreenRotation">true</bool>
<bool name="lockscreen_isPortrait">false</bool>
13. User版本打开Root权限
(1)路径: \system\extras\su
int main(int argc, char **argv)
{
struct passwd *pw;
int uid, gid, myuid;
/* Until we have something better, only root and the shell can use su. */
myuid = getuid();
#if 0 //注释掉如下if模块,就是su的时候不检查uid的权限了
if (myuid != AID_ROOT && myuid != AID_SHELL) {
fprintf(stderr,"su: uid %d not allowed to su\n", myuid);
return 1;
}
#endif //
(2)然后需要在init.rc中添加chmod 4777 /system/xbin/su 修改su的属性
修改su.c后,可以直接用adb把重新生成的su push到手机里
但是修改了init.rc需要刷boot.img
(3)如有必要:如果涉及到/data目录而非/data/data/<你的包名>/的修改,则修改system/core/rootdir/init.rc
将 mount yaffs2 mtd@userdata /data nosuid nodev 改为 mount yaffs2 mtd@userdata /data nodev
在/mediatek/custom下会有好多重名的文件,在不同的文件夹里,最终会编译哪个文件是根据目录的优先级来判断
brighter89_evdo_jb2 > mt6589 > common
也就是说如果brighter89_evdo_jb2,mt6589,common同时存在一文件,最终编译的会是brighter89_evdo_jb2目录下的文件
也可以通过/mediatek/custom/out/开判断,此文件时最终编译的文件
1. GPIO
运行/mediatek/dct/DrvGen.exe,
选择文件/mediatek/custom/brighter89_evdo_jb2/kernel/dct/dct/codegen.dws
Edit,打开后可以修改GPIO的模式,上拉,下拉,输入,输出
修改后点击“Save”和“Gen Code”
重新编译:./makeMtk brighter89_evdo_jb2 codegen
./makeMtk brighter89_evdo_jb2 new pl lk kernel
./makeMtk brighter89_evdo_jb2 bootimage
提交时替换bw/custom/project/g616/mediate/custom/brighter89_evdo_jb2/kernel/dct/dct
2. LCD
修改ProjectConfig.mk
CUSTOM_LK_LCM=hx8389b_qhd_dsi_vdo
BOOT_LOGO=qhd //根据屏的分辨率
CUSTOM_KERNEL_LCM=hx8389b_qhd_dsi_vdo
LCM_HEIGHT=960
LCM_WIDTH=540
/mediatek/custom/common/kernel/lcm目录名与ProjectConfig.mk 下hx8389b_qhd_dsi_vdo名字相同,目录下为驱动文件
在/mediatek/custom/common/kernel/lcm/mt65xx_lcm_list.c下添加要添加的屏
#if defined(HX8389B_QHD_DSI_VDO)
&hx8389b_qhd_dsi_vdo_lcm_drv,
#endif
3. CAMERA
ProjectConfig.mk下修改
CUSTOM_HAL_IMGSENSOR=ov5648_mipi_raw hi257_yuv //前后camera
CUSTOM_HAL_MAIN_IMGSENSOR=ov5648_mipi_raw
CUSTOM_HAL_SUB_IMGSENSOR=hi257_yuv
CUSTOM_KERNEL_IMGSENSOR=ov5648_mipi_raw hi257_yuv //前后camera
CUSTOM_KERNEL_MAIN_IMGSENSOR=ov5648_mipi_raw
CUSTOM_KERNEL_SUB_IMGSENSOR=hi257_yuv
驱动要添加的文件:
/mediatek/custom/common/kernel/imgsensor/ov5648_mipi_raw
/mediatek/custom/common/hal/imgsensor/ov5648_mipi_raw
//hi257前camera同理
/mediatek/custom/common/hal/imgsensor/src/sensorlist.cpp
#if defined(OV5648_MIPI_RAW)
RAW_INFO(OV5648MIPI_SENSOR_ID, SENSOR_DRVNAME_OV5648_MIPI_RAW, NULL),
#endif
/mediatek/custom/common/kernel/imgsensor/src/kd_sensorlist.h
#if defined(OV5648_MIPI_RAW)
{OV5648MIPI_SENSOR_ID, SENSOR_DRVNAME_OV5648_MIPI_RAW, OV5648MIPISensorInit},
#endif
Camera电所在文件:
/mediatek/custom/brighter89_evdo_jb2/kernel/camera/camera/kd_camera_hw.c 核心驱动文件:
/mediatek/custom/common/kernel/imgsensor/src/kd_sensorlist.c
如果修改HAL层参数 编译命令如下:
./makeMtk -t brighter89_evdo_jb2 mm mediatek/platform/mt6589/hardware/camera/
4. AF
ProjectConfig.mk下修改:
CUSTOM_HAL_LENS=dw9714af
CUSTOM_HAL_MAIN_LENS=dw9714af
CUSTOM_KERNEL_LENS=dw9714af
CUSTOM_KERNEL_MAIN_LENS=dw9714af
添加对应的文件夹和驱动文件
/G616/mediatek/custom/common/kernel/lens/dw9714af/DW9714AF.c
M config/mt6589/init.rc
M custom/brighter89_evdo_jb2/hal/lens/src/lenslist.cpp
M custom/common/hal/inc/camera_custom_lens.h
A custom/common/hal/lens/dw9714af/lens_para_DW9714AF.cpp
M custom/common/hal/lens/src/lenslist.cpp
A custom/common/kernel/lens/dw9714af/DW9714AF.c
A custom/common/kernel/lens/inc/DW9714AF.h
M platform/mt6589/hardware/camera/core/featureio/drv/lens/mcu_drv.cpp
5. flashled
ProjectConfig.mk下修改:
CUSTOM_KERNEL_FLASHLIGHT=constant_flashlight
CUSTOM_HAL_FLASHLIGHT=constant_flashlight
驱动核心:
/mediatek/custom/common/kernel/flashlight/src/kd_flashlightlist.c
/mediatek/custom/common/kernel/flashlight/constant_flashlight/leds_strobe.c
G616用的bd7710gwl driver IC,leds_strobe.c会有相应的更改,文件修改都放到bw目录下 HAL tunning 文件:
mediatek/custom/brighter89_evdo_jb2/hal/camera/camera/flash_tuning_custom.cpp
6. TP
ProjectConfig.mk下修改:
CUSTOM_KERNEL_TOUCHPANEL=ft5336
驱动文件:
mediatek/custom/common/kernel/touchpanel/ft5336/ft5336_driver.c
/home/chenjian/CJ_WORK/code/G616/mediatek/custom/brighter89_evdo_jb2/kernel/touchpanel/ft5336/tpd_custom_ft5336.h
7. sensor
ProjectConfig.mk下修改:
CUSTOM_KERNEL_ACCELEROMETER=lis3dh
CUSTOM_KERNEL_ALSPS=tmd2772
驱动文件:
/mediatek/custom/common/kernel/accelerometer/lis3dh/lis3dh.c //gsensor
配置I2c和Gsensor的position
/mediatek/custom/brighter89_evdo_jb2/kernel/accelerometer/lis3dh/cust_acc.c
static struct acc_hw cust_acc_hw = {
.i2c_num = 3,
.direction = 6, //chenjian 2013-12-26 modify gsensor position
.power_id = MT65XX_POWER_NONE, /*!< LDO is not used */
.power_vol= VOL_DEFAULT, /*!< LDO is not used */
.firlen = 0, //old value 16 /*!< don't enable low pass fileter */ };
/mediatek/custom/common/kernel/alsps/tmd2772/tmd2772.c //psensor light sensor
配置I2c和 light sensor上报数据
/mediatek/custom/brighter89_evdo_jb2/kernel/alsps/tmd2772/cust_alsps.c
.als_level = { 4, 40, 80, 120, 160, 240, 400, 800, 1200, 1600, 2000, 3000, 5000, 8000, 65535},
.als_value = {0,20, 60, 100, 150, 240, 400, 600, 1000, 1500, 2000, 3000, 5000, 8000, 10000, 10000},
8. memory
配置xls
/mediatek/build/tools/emigen/MT6589/MemoryDeviceList_MT6589.xls
都是MTK release的,需要添加的memory要在MemoryDeviceList_MT6589.xls表里,且名字与/mediatek/custom/brighter89_evdo_jb2/preloader/inc/custom_MemoryDevice.h名字需一样
如H9TP32A8JDBCPR_KGM 需和MemoryDeviceList_MT6589.xls表的名字一样
#define BOARD_ID MT6589_EVB
#define CS_PART_NUMBER[0] SD7DP28C_4G
#define CS_PART_NUMBER[1] H9TP32A8JDBCPR_KGM
Memory兼容: 向下添加即可
#define CS_PART_NUMBER[2]
#define CS_PART_NUMBER[3]
….
….
9. 音频参数
硬件同事,通过工具修改,导出文件,替换如下目录 /mediatek/custom/brighter89_evdo_jb2/cgen/inc/
======================= Driver end ======================
======================= Record start =====================
1. 调屏配置电压
(1)屏驱动源文件 sl006_ti_n_nmi.c
#ifdef BUILD_LK
pmic_config_interface( (kal_uint32)(DIGLDO_CON28), (kal_uint32)(0x3), (kal_uint32)( PMIC_RG_VGP1_VOSEL_MASK), (kal_uint32)(PMIC_RG_VGP1_VOSEL_SHIFT));
pmic_config_interface( (kal_uint32)(DIGLDO_CON7), (kal_uint32)(0x1), (kal_uint32)( PMIC_RG_VGP1_EN_MASK), (kal_uint32)( PMIC_RG_VGP1_EN_SHIFT));
#endif
(2)在 pmic_mt6323.c 搜 void dct_pmic_VGP1_sel(kal_uint32 volt) 或 void dct_pmic_VGP2_sel(kal_uint32 volt)
查看对应电压
0x3 对应 1.8V
0x5 对应 2.8V
2. 取消开机检测Camera,导致未检测到时没有Camera图标显示
\packages\apps\Camera\src\com\android\camera\DisableCameraReceiver.java
public void onReceive(Context context, Intent intent) {
//整个函数全注释掉
}
3. 点亮屏之后TP滑动是无效的,要过个3-5秒钟再滑才有效,有如下四种方法:
1)可以的话将i2c速度提高至400K
2) ts->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 1;
3) check_mem_data(ts->client);屏蔽掉内存数据检查函数,减去唤醒后因检查数据用掉的时间。
4)加个工作任务去单独处理load_fw.
注:一般选用第三种方法,在TP的源文件修改。
4. 开机后G-sensor有时有效,有时无效。
在 \mediatek\platform\mt6572\kernel\core\mt_devs.c
把G-sensor初始化部分放置 __init int mt_board_init(void){...}比较靠后的地方。
__init int mt_board_init(void){
...
...
#if defined(CUSTOM_KERNEL_ACCELEROMETER)
retval = platform_device_register(&sensor_gsensor);
printk("sensor_gsensor device!");
if (retval != 0)
return retval;
#endif
...
}
5. 调摄像头相关流程,请查看如下文档:
MTK平台camera(摄像头)调试教程.doc
6. Android4.4 NavigationBar
\mediatek\custom\common\resource_overlay\navbar\frameworks\base\core\res\res\values\config.xml
<bool name="config_showNavigationBar">true</bool>
7. 背光延时
Kernel层:\mediatek\platform\mt6572\kernel\drivers\leds\leds.c
int mt_mt65xx_led_set_cust(struct cust_mt65xx_led *cust, int level)
{
switch (cust->mode) {
case MT65XX_LED_MODE_PWM:
...
mdelay(200);//add
...
}
....
}
LK层:\mediatek\platform\mt6572\lk\mt_leds.c
static int mt65xx_led_set_cust(struct cust_mt65xx_led *cust, int level)
{
switch (cust->mode) {
case MT65XX_LED_MODE_PWM:
...
mdelay(200);//add
...
}
....
}
8. Q:开机点亮背光和显示第一张Logo,在时间顺序上显示不同步,也就是说开机先点亮了背光,再过两秒才显示Logo。
A:在屏初始化的地方手动加了打开背光 lcd_bl_enable(1);把此处去掉即可。
9. 进Camera时,SD卡会自动移除,退出Camera,SD卡自动识别的问题
答:那是因为SD卡热拔插的问题,因为GPIO73是Camera MIPI接口用到了些IO口。SD不支持热拔插,所以要去掉热拔插功能。
(注:SD卡热拔插默认是GPIO73,配成MC1_INS, GPIO_SDHC_EINT_PIN)
去掉SD卡热拔插在如下文件:\mediatek\custom\q600\kernel\core\src\board.c
#define MSDC_SDCARD_FLAG (MSDC_SYS_SUSPEND | MSDC_HIGHSPEED| MSDC_UHS1 |MSDC_DDR) //去掉 MSDC_CD_PIN_EN | MSDC_REMOVABLE
或
struct msdc_hw msdc1_hw = {
...
.flags = MSDC_EXT_SDIO_IRQ | MSDC_HIGHSPEED,//| MSDC_CD_PIN_EN | MSDC_REMOVABLE,
...};
10. OV5645Camera一进入时马达振动问题解决
(1)在 kd_camera_hw.c 上电时序,屏蔽掉AF上电(CAMERA_POWER_VCAM_A2)
(2)在ov5645mipiyuv_Sensor.c的
static bool AF_Power = false;
UINT32 OV5645MIPIOpen(void)
{...
//AF_Power(1);//motor power 在此处对马达上电
if(false == AF_Power)
{
OV5645MIPISENSORDB("[OV5645Sensor] AF Power on.\n");
if(TRUE != hwPowerOn(CAMERA_POWER_VCAM_A2, VOL_2800,"OV5645_AF"))//PMIC_APP_MAIN_CAMERA_POWER_AF
{
printk("[CAMERA SENSOR AF] Fail to enable analog power\n");
return -EIO;
}
AF_Power = true;
}
else
{
OV5645MIPISENSORDB("[OV5645Sensor] AF Power has already on.\n");
}
}
(3)在UINT32 OV5645MIPIClose(void){
//AF_Power(0);//motor power 在此处对马达下电
if(true == AF_Power)
{
OV5645MIPISENSORDB("[OV5645Sensor] AF Power down.\n");
if(TRUE != hwPowerDown(CAMERA_POWER_VCAM_A2,"OV5645_AF"))
{
printk("[CAMERA SENSOR AF] Fail to enable analog power\n");
return -EIO;
}
AF_Power = false;
}
else
{
OV5645MIPISENSORDB("[OV5645Sensor] AF Power is already off.\n");
}
}
11. 上拉电阻的作用
上拉电阻: 就是从电源高电平引出的电阻接到输出.
上拉就是将不确定的信号通过一个电阻嵌位在高电平,电阻同时起限流作用.
上拉是对器件注入电流,下拉是输出电流,弱强只是上拉电阻的阻值不同,没有什么严格区分.
上,就是指高电平;所谓下,是指低电平。
上拉,就是通过一个电阻将信号接电源,一般用于时钟信号数据信号等。
下拉,就是通过一个电阻将信号接地,一般用于保护信号。这是根据电路需要设计的,主要目的是为了防止干扰,增加电路的稳定性。
12. 锁屏旋转
搜索
<bool name="config_enableLockScreenRotation">false</bool>
<bool name="lockscreen_isPortrait">true</bool>
改为:
<bool name="config_enableLockScreenRotation">true</bool>
<bool name="lockscreen_isPortrait">false</bool>
13. User版本打开Root权限
(1)路径: \system\extras\su
int main(int argc, char **argv)
{
struct passwd *pw;
int uid, gid, myuid;
/* Until we have something better, only root and the shell can use su. */
myuid = getuid();
#if 0 //注释掉如下if模块,就是su的时候不检查uid的权限了
if (myuid != AID_ROOT && myuid != AID_SHELL) {
fprintf(stderr,"su: uid %d not allowed to su\n", myuid);
return 1;
}
#endif //
(2)然后需要在init.rc中添加chmod 4777 /system/xbin/su 修改su的属性
修改su.c后,可以直接用adb把重新生成的su push到手机里
但是修改了init.rc需要刷boot.img
(3)如有必要:如果涉及到/data目录而非/data/data/<你的包名>/的修改,则修改system/core/rootdir/init.rc
将 mount yaffs2 mtd@userdata /data nosuid nodev 改为 mount yaffs2 mtd@userdata /data nodev