note_2019_8

:-)编译过程如果提示缺少ssl头文件

ubuntu14.04,在原有msm8953的编译环境下增加安装工具sudo apt-get install libssl-dev

即可编译通过
==================================================================================
修改系统DPI
msm8953:/ # wm density 400(V6 默认DPI 480)
代码修改:
root@msm8953_64:/ # getprop | grep "density"
[ro.sf.lcd_density]: [480]
思路:修改ro.sf.lcd_density默認值即可
搜索代码的ro.sf.lcd_density:
device/qcom/common/rootdir/etc/init.qcom.rc:1134:    setprop ro.sf.lcd_density ${vendor.display.lcd_density}
再搜索vendor.display.lcd_density
wanghl@server:~/work/sdm632_android$ find device/ -name "*" | xargs grep "setprop vendor.display.lcd_density 480" -n --color 2>/dev/null
device/qcom/common/rootdir/etc/init.qcom.early_boot.sh:81:           setprop vendor.display.lcd_density 480
device/qcom/common/rootdir/etc/init.qcom.early_boot.sh:208:                setprop vendor.display.lcd_density 480//另外一个平台的
打开device/qcom/common/rootdir/etc/init.qcom.early_boot.sh:81
function set_density_by_fb() {
    #put default density based on width
    if [ -z $fb_width ]; then
        setprop vendor.display.lcd_density 320
    else
        if [ $fb_width -ge 1600 ]; then
           setprop vendor.display.lcd_density 640
        elif [ $fb_width -ge 1440 ]; then
           setprop vendor.display.lcd_density 560
        elif [ $fb_width -ge 1080 ]; then
           setprop vendor.display.lcd_density 480//就是设置这里默认值为480
        elif [ $fb_width -ge 720 ]; then
           setprop vendor.display.lcd_density 320 #for 720X1280 resolution
        elif [ $fb_width -ge 480 ]; then
            setprop vendor.display.lcd_density 240 #for 480X854 QRD resolution
        else
            setprop vendor.display.lcd_density 160
        fi
    fi
}
具体修改方法如下:
diff --git a/device/qcom/common/rootdir/Android.mk b/device/qcom/common/rootdir/Android.mk
index 64c8cab87f..7cea98ba1d 100644
--- a/device/qcom/common/rootdir/Android.mk
+++ b/device/qcom/common/rootdir/Android.mk
@@ -7,7 +7,12 @@ include $(CLEAR_VARS)
 LOCAL_MODULE       := init.qcom.early_boot.sh
 LOCAL_MODULE_TAGS  := optional eng
 LOCAL_MODULE_CLASS := ETC
+# modify dpi as 420 for msm8953
+ifneq ($(TARGET_OEM_CONFIG_FILE_SUFFIX),)//受自定义的开关宏控制
+LOCAL_SRC_FILES    := etc/init.qcom.early_boot_$(TARGET_OEM_CONFIG_FILE_SUFFIX).sh//为msm8953项目定制一个脚本文件
+else
 LOCAL_SRC_FILES    := etc/init.qcom.early_boot.sh//脚本文件为空则用默认的
+endif
 LOCAL_MODULE_PATH  := $(TARGET_OUT_VENDOR_EXECUTABLES)
 include $(BUILD_PREBUILT)

具体看下宏在哪里定义的:
device/pubtron/v6/v6.mk:100:TARGET_OEM_CONFIG_FILE_SUFFIX := v6
device/pubtron/v5/v5.mk:100:TARGET_OEM_CONFIG_FILE_SUFFIX := v5
device/pubtron/msm8953/msm8953.mk:101:TARGET_OEM_CONFIG_FILE_SUFFIX := msm8953//这就根据项目来划分了。
device/pubtron/v51/v51.mk:100:TARGET_OEM_CONFIG_FILE_SUFFIX := v51
==================================================================================
linux分层/分离设计思想:
linux驱动模型 采用总线管理的模式,比如platform虚拟总线,这个东西其实就是个虚拟的的东西,只是为了帮你做driver端与device端匹配、维护下注册的driver链表和device链表而已,貌似没有其他更加重要的作用,所以你写驱动的话不采用这个总线,也是可以写好一个驱动的;至于具体的如何做匹配,可以参考内核目录driver/base下的platform.c文件,里面就是这个总线的机制:简单来说就是稳定的driver端向这个文件注册driver,device也向这个文件注册设备,然后开始查找注册的链表里面是否有和自己名字一样的东西,有的话就开始connect,connect成功后就调用driver端的probe函数,然后就成功建立了匹配,一个设备也就动态的加入了系统;除了platform总线,还有实实在在存在的总线:比如I2C总线、USB总线、PCI总线等等……采用这些总线就可以不用platform虚拟总线了。
以上便是linux分层/分离思想的简单介绍;

1)对于input输入子系统,也可以采用platform的分离结构,driver端向platform虚拟总线注册设备驱动:platform_driver_register ( struct platform_driver *drv ),device端向platform虚拟总线注册设备:platform_device_register ( struct platform_device *pdev ),在driver端和device端匹配成功后,在driver端的probe函数里面调用input_register_device(struct input_dev *input),这样就完成了一个输入子系统的分层/分离设计;
kernel/msm-4.9/drivers/input/keyboard/gpio_keys.c:897:    return platform_driver_register(&gpio_keys_device_driver);
2)LCD字符设备也是一样的处理:向platform虚拟总线注册设备驱动:platform_driver_register ( struct platform_driver *drv ),device端向platform虚拟总线注册设备:platform_device_register ( struct platform_device *pdev ),在driver端和device端匹配成功后,在driver端的probe函数里面调用register_framebuffer ( struct fb_info *fb_info ),这样就完成了一个LCD设备的分层/分离设计;
kernel/msm-4.9/drivers/video/fbdev/msm/mdss_qpic.c:816:    ret = platform_driver_register(&mdss_qpic_driver);
kernel/msm-4.9/drivers/video/fbdev/msm/mdss_dsi.c:4460:    return platform_driver_register(&mdss_dsi_driver);
kernel/msm-4.9/drivers/video/fbdev/msm/mdss_dsi.c:4480:    return platform_driver_register(&mdss_dsi_ctrl_driver);
kernel/msm-4.9/drivers/video/fbdev/msm/mdss_rotator.c:3047:    return platform_driver_register(&mdss_rotator_driver);
kernel/msm-4.9/drivers/video/fbdev/msm/mdp3.c:2727:    ret = platform_driver_register(&mdp3_driver);
kernel/msm-4.9/drivers/video/fbdev/msm/mdss_edp.c:1251:    ret = platform_driver_register(&mdss_edp_driver);
kernel/msm-4.9/drivers/video/fbdev/msm/mdss_spi_panel.c:1707:    ret = platform_driver_register(&this_driver);
kernel/msm-4.9/drivers/video/fbdev/msm/mdss_qpic_panel.c:302:    return platform_driver_register(&this_driver);
kernel/msm-4.9/drivers/video/fbdev/msm/mdss_hdmi_tx.c:4605:    rc = platform_driver_register(&this_driver);
kernel/msm-4.9/drivers/video/fbdev/msm/dsi_host_v2.c:1868:    return platform_driver_register(&msm_dsi_v2_driver);
kernel/msm-4.9/drivers/video/fbdev/msm/mdss_fb.c:5122:    if (platform_driver_register(&mdss_fb_driver))
kernel/msm-4.9/drivers/video/fbdev/msm/mdss_smmu.c:923:    return platform_driver_register(&mdss_smmu_driver);
kernel/msm-4.9/drivers/video/fbdev/msm/mdss_mdp.c:5239:    return platform_driver_register(&mdss_mdp_driver);
kernel/msm-4.9/drivers/video/fbdev/msm/mdss_wb.c:218:    rc = platform_driver_register(&mdss_wb_driver);
==================================================================================
关于dm-verify 的一点总结:
首先看一个OTA版本升级之后的串口log:
[    6.711326] device-mapper: init: attempting early device configuration.                                                                                               
[    6.719634] device-mapper: init: adding target '0 6192024 verity 1 PARTUUID=9d3aac46-65a7-5f1a-4209-ccdb9ad35fff PARTUUID=9d3aac46-65a7-5f1a-4209-ccdb9ad35fff 4096 4'
[    6.742744] device-mapper: init: dm-0 is ready                                                                                                                        
[    6.779869] device-mapper: verity-fec: 179:28: FEC: recursion too deep                                                                                            
[    6.779920] device-mapper: verity: 179:28: metadata block 774003 is corrupted //坏块                                                                                        
[    6.787467] mmc-cmdqd/0 (370) used greatest stack depth: 12096 bytes left                                                                                             
[    6.816336] mdss_fb_release_all: try to close unopened fb 1! from pid:387 name:kworker/u16:7                                                                        
[    6.816444] mdss_fb_release_all: try to close unopened fb 0! from pid:387 name:kworker/u16:7                                                                          
[    6.826389] reboot: Restarting system with command 'dm-verity device corrupted'     //dm-verity device corrupted                                                                                  
[    6.832352] Going down for restart nAndroid Bootloader - UART_DM Initialized!!!                                                                                       
[0] welcome to lk        
搜索:dm-verity device corrupted
dm-android-verity.c (msm-4.9\drivers\md):        kernel_restart("dm-verity device corrupted");
dm-verity-target.c (msm-4.9\drivers\md):        kernel_restart("dm-verity device corrupted");
msm-poweroff.c (msm-4.9\drivers\power\reset):        } else if (!strcmp(cmd, "dm-verity device corrupted")) { 
先看:
当dm-verity扫描出分区有损坏的时候,会触发dm-verity-target.c中一个回调函数:verity_handle_err。
dm-verity-target.c (msm-4.9\drivers\md):        kernel_restart("dm-verity device corrupted");
/*
 * Handle verification errors.
 */
static int verity_handle_err(struct dm_verity *v, enum verity_block_type type,
                 unsigned long long block)
{
    char verity_env[DM_VERITY_ENV_LENGTH];
    char *envp[] = { verity_env, NULL };
    const char *type_str = "";
    struct mapped_device *md = dm_table_get_md(v->ti->table);

    /* Corruption should be visible in device status in all modes */
    v->hash_failed = 1;

    if (v->corrupted_errs >= DM_VERITY_MAX_CORRUPTED_ERRS)
        goto out;//跳到out

    v->corrupted_errs++;

    switch (type) {
    case DM_VERITY_BLOCK_TYPE_DATA:
        type_str = "data";
        break;
    case DM_VERITY_BLOCK_TYPE_METADATA:
        type_str = "metadata";
        break;
    default:
        BUG();
    }

    DMERR("%s: %s block %llu is corrupted", v->data_dev->name, type_str,
        block);

    if (v->corrupted_errs == DM_VERITY_MAX_CORRUPTED_ERRS)
        DMERR("%s: reached maximum errors", v->data_dev->name);

    snprintf(verity_env, DM_VERITY_ENV_LENGTH, "%s=%d,%llu",
        DM_VERITY_ENV_VAR_NAME, type, block);

    kobject_uevent_env(&disk_to_dev(dm_disk(md))->kobj, KOBJ_CHANGE, envp);

out:
    if (v->mode == DM_VERITY_MODE_LOGGING)
        return 0;//如果是DM_VERITY_MODE_LOGGING的状态1,就返回0,那么系统在mount那块的代码就会忽略破坏,继续挂载该分区。

    if (v->mode == DM_VERITY_MODE_RESTART)
        kernel_restart("dm-verity device corrupted");//如果是DM_VERITY_MODE_RESTART,就是状态2, 那么就重启系统。

    return 1;//如果是默认状态,就返回1,返回1之后,系统在mount的那边的代码就会不去挂载该被破坏的分区。其实我觉得这种模式确实没什么用,这种模式在发生corruption之后直接选择不挂载,这样会导致系统hang住,也没什么意义
}    
再看msm-poweroff.c (msm-4.9\drivers\power\reset):        } else if (!strcmp(cmd, "dm-verity device corrupted")) { 
高通平台关机支持的命令在 体现出来了:
static void msm_restart_prepare(const char *cmd)
{
    bool need_warm_reset = false;
#ifdef CONFIG_QCOM_DLOAD_MODE
    /* Write download mode flags if we're panic'ing
     * Write download mode flags if restart_mode says so
     * Kill download mode if master-kill switch is set
     */

    set_dload_mode(download_mode &&
            (in_panic || restart_mode == RESTART_DLOAD));
#endif

    if (qpnp_pon_check_hard_reset_stored()) {
        /* Set warm reset as true when device is in dload mode */
        if (get_dload_mode() ||
            ((cmd != NULL && cmd[0] != '\0') &&
            !strcmp(cmd, "edl")))
            need_warm_reset = true;
    } else {
        need_warm_reset = (get_dload_mode() ||
                (cmd != NULL && cmd[0] != '\0'));
    }

    /* Hard reset the PMIC unless memory contents must be maintained. */
    if (need_warm_reset)
        qpnp_pon_system_pwr_off(PON_POWER_OFF_WARM_RESET);
    else
        qpnp_pon_system_pwr_off(PON_POWER_OFF_HARD_RESET);

    if (cmd != NULL) {
        if (!strncmp(cmd, "bootloader", 10)) {//reboot bootloader
            qpnp_pon_set_restart_reason(
                PON_RESTART_REASON_BOOTLOADER);
            __raw_writel(0x77665500, restart_reason);
        } else if (!strncmp(cmd, "recovery", 8)) {//reboot recovery
            qpnp_pon_set_restart_reason(
                PON_RESTART_REASON_RECOVERY);
            __raw_writel(0x77665502, restart_reason);
        } else if (!strcmp(cmd, "rtc")) {
            qpnp_pon_set_restart_reason(
                PON_RESTART_REASON_RTC);
            __raw_writel(0x77665503, restart_reason);
        } else if (!strcmp(cmd, "dm-verity device corrupted")) {
            qpnp_pon_set_restart_reason(
                PON_RESTART_REASON_DMVERITY_CORRUPTED);
            __raw_writel(0x77665508, restart_reason);
        } else if (!strcmp(cmd, "dm-verity enforcing")) {
            qpnp_pon_set_restart_reason(
                PON_RESTART_REASON_DMVERITY_ENFORCE);
            __raw_writel(0x77665509, restart_reason);
        } else if (!strcmp(cmd, "keys clear")) {
            qpnp_pon_set_restart_reason(
                PON_RESTART_REASON_KEYS_CLEAR);
            __raw_writel(0x7766550a, restart_reason);
        } else if (!strncmp(cmd, "oem-", 4)) {
            unsigned long code;
            unsigned long reset_reason;
            int ret;

            ret = kstrtoul(cmd + 4, 16, &code);
            if (!ret) {
                /* Bit-2 to bit-7 of SOFT_RB_SPARE for hard
                 * reset reason:
                 * Value 0 to 31 for common defined features
                 * Value 32 to 63 for oem specific features
                 */
                reset_reason = code +
                        PON_RESTART_REASON_OEM_MIN;
                if (reset_reason > PON_RESTART_REASON_OEM_MAX ||
                   reset_reason < PON_RESTART_REASON_OEM_MIN) {
                    pr_err("Invalid oem reset reason: %lx\n",
                        reset_reason);
                } else {
                    qpnp_pon_set_restart_reason(
                        reset_reason);
                }
                __raw_writel(0x6f656d00 | (code & 0xff),
                         restart_reason);
            }
        } else if (!strncmp(cmd, "edl", 3)) {//reboot edl
            enable_emergency_dload_mode();
        } else {
            __raw_writel(0x77665501, restart_reason);
        }
    }

    flush_cache_all();

    /*outer_flush_all is not supported by 64bit kernel*/
#ifndef CONFIG_ARM64
    outer_flush_all();
#endif

}   

首先要知道dm-verity有三种工作模式,如下:

EIO:不挂载被破坏的分区。0
LOGGIN:忽略破坏的分区,继续挂载该分区。1
RESTART:发现分区被破坏,直接重启系统。2          

当bootloader的verify过了之后就进入到system分区等的verify,这个时候就是dm-verity出场的时候。此时就到了图中start的这个问题,先判断dm-verity是否是enforcing的状态,如果是,就去扫描一把需要verity的分区,具体实现就是验证一下这个对应分区的metadata。如果扫描出没问题,ok,mount系统,如果扫描出有问题,dm-verity会向kernel发一个reboot的信号,并且将dm-verity的状态设置成loggin。重启之后,再回到start的地方,此时dm-verity的状态已经是loggin了,所以走向红色的那一块区域,此时就会显示出一个警告的界面,让用户去选择mount还是不mount。后面的工作都会围绕这张流程图展开。在不同的板块去分解这张流程图的实现。

内核使用hash tree来描述system.img的变化
叶节点就是dm-verity所需要verify的分区的划分的一个个小块,它这里规定了每个块以4k的大小来划分。所以举个例子,要验证的system分区如果有800M,那么就有200万个块。所以说通过叶节点以及他的父hash到根hash就是描述了system.img的变化情况。

解释下几个概念:

Verified Boot 是 Android 4.4 开始引入的一个新特性,配合可选的 dm-verify 功能,可以检测系统是否被篡改,以此保存系统的完整性。          

dm-verity 基于kernel 的 Device mapper 框架,Device mapper 是Linux 2.6 内核中提供的一种从逻辑设备到物理设备的映射框架机制,在该机制下,用户可以很方便的根据自己的需要制定实现存储资源的管理策略。dm-verity 用一个 hash 树来描述整个 system 镜像。这种机制允许 system 分区在读写的时候进行校验,而不是一次性将整个 system 镜像进行校验。当校验 hash 值不一致的时候,返回 IO 错误.相关代码
用户空间代码:system/core/fs_mgr/fs_mgr_verity.cpp//用户空间对dm-verity进行初始化,验签hash_table的签名,传入hash_table等参数
内核空间代码:kernel/msm-4.9/drivers/md/dm-verity* //内核空间根据传入的参数,进行初始化,当有IO操作时,对相应的data block进行验签。data block读取时,不仅当前data block需要hash 校验,上一层的hash block也需要进行校验,知道root hash.每一个data block如果已经验证过,再次读取时就不用进行层层的校验,只校验当前data block的hash是否正确即可。

如何启用:
1.内核配置文件使能:CONFIG_DM_VERITY
2.android相关mk文件配置:
device/qcom/msm8953_64/msm8953_64.mk:373:  PRODUCT_SUPPORTS_VERITY := true
device/pubtron/msm8953/msm8953.mk:412:  PRODUCT_SUPPORTS_VERITY := true
device/qcom/common/base.mk:1162:   PRODUCT_SYSTEM_VERITY_PARTITION=/dev/block/bootdevice/by-name/system
验证:
root@msm8953_64:/ # ls /dev/block/bootdevice/by-name/system                    
/dev/block/bootdevice/by-name/system
root@msm8953_64:/ # mount | grep "system"
/dev/block/bootdevice/by-name/system /system ext4 ro,seclabel,relatime,discard,data=ordered 0 0

3.更新fstab,system分区添加verify标志 
/dev/block/bootdevice/by-name/system         /system      ext4    ro,barrier=1,discard                                wait,verify
device/pubtron/msm8953/fstabs-3.18/fstab_non_AB_variant.qti:36:/dev/block/bootdevice/by-name/system        /            ext4    ro,barrier=1,discard                        wait,verify
验证:
wanghl@server:~/work/sdm632_android$ cat fstab.qcom | grep "verify"
/dev/block/bootdevice/by-name/system         /system      ext4    ro,barrier=1,discard                                wait,verify

关于我们常用的"adb disable-verity"://其实就是关闭verity功能,不去检查系统是否发生了改变
adb remount
adb disable-verity
adb reboot
If you do not,remount may succeed,however,you will not be able to write to these volumes.
remount of system failed:Read-only file system
remount failed

DM(Device Mapper)即设备映射(逻辑设备)。Device Mapper 是 Linux2.6 内核中支持逻辑卷管理的通用设备映射机制,它为实现用于存储资源管理的块设备驱动提供了一个高度模块化的内核架构,Device mapper 是能让用户自己定制管理块设备的策略的一套框架,使用这套框架去写管理块设备的策略比直接去管理块设备肯定要轻松许多。      

Device mapper 进一步体现了在 Linux 内核设计中策略和机制分离的原则,将所有与策略相关的工作放到用户空间完成,内核中主要提供完成这些策略所需要的机制。Device mapper 用户空间相关部分主要负责配置具体的策略和控制逻辑,比如逻辑设备和哪些物理设备建立映射,怎么建立这些映射关系等等,而具体过滤和重定向 IO 请求的工作由内核中相关代码完成。因此整个 device mapper 机制由两部分组成--内核空间的 device mapper 驱动、用户空间的device mapper 库以及它提供的 dmsetup 工具。在下文中,我们分内核和用户空间两部分进行介绍。  

Device mapper 的内核相关代码已经作为 Linux 2.6 内核发布版的一部分集成到内核源码中了,相关代码在内核源码的 driver/md/ 目录中,其代码文件可以划分为实现 device mapper 内核中基本架构的文件和实现具体映射工作的 target driver 插件文件两部分。

Device mapper 在内核中作为一个块设备驱动被注册的,它包含三个重要的对象概念,mapped device、映射表、target device。

RAID:(Redundant Array of indenpensive Disk) 独立磁盘冗余阵列: 磁盘阵列是把多个磁盘组成一个阵列,当作单一磁盘使用,它将数据以分段(striping)的方式储存在不同的磁盘中,存取数据时,阵列中的相关磁盘一起动作,大幅减低数据的存取时间,同时有更佳的空间利用率。磁盘阵列利用的不同的技术,称为RAID level,不同的level针对不同的系统及应用,以解决数据安全的问题。简单来说,RAID把多个硬盘组合成为一个逻辑扇区,因此,操作系统只会把它当作一个硬盘。

1. 硬件RAID:用RAId接口卡来实现;需要内核支持其驱动,并且该类设备设备显示为SCSI设备,代号为/dev/sd*
2. 软件RAID:用内核中的MD(multiple devices)模块实现,该类设备在/etc/下表示为:md*;在现在的RH 5版本中使用mdadm(mdadm是multiple devices admin的简称,它是Linux下的一款标准的软件 RAID 管理工具)工具管理软RAID;(虽然来说可以用软件模拟实现raid,但是相对对磁盘控制的功能及性能不如硬件实现的好,生产环境中最好使用硬件raid)         

DM 和 MD 。。。 一个用于逻辑卷 一个用于软RAID 。都是虚拟的。。。
==================================================================================
camera如何制定编译效果文件的版本:
vendor/qcom/proprietary/mm-camera/Android.mk
ifeq ($(BUILD_SERVER), true)
  CHROMATIX_VERSION := 0208
else ifeq ($(BUILD_MM_CAMERA2), true)
  ifeq ($(OEM_CHROMATIX_0308), 1)
    CHROMATIX_VERSION := 0308E
  else ifeq ($(call is-board-platform-in-list,msm8937 msm8953 sdm660 msm8998 apq8098_latv),true)
    CHROMATIX_VERSION := 0310//可以看出MSM8953平台指定的效果文件版本是0310,所以我们需要使用0310版本的效果文件,如果强制使用0309版本会编译不过。
  else
    CHROMATIX_VERSION := 0309
  endif
else
  ifeq ($(MSM_VERSION),7x27A)
    CHROMATIX_VERSION := 0207
  else
    CHROMATIX_VERSION := 0205
  endif
endif

0.首先sensor需要probe成功,kernel log应该看到诸如s5k4h8下面的log:
[   13.646010] camera id 2 Slave addr 0x20 addr_type 2
[   13.646018] sensor_id_reg_addr 0x0 sensor_id 0x4088 sensor id mask 0
[   13.646018] power up size 8 power down size 6
[   13.646024] position 1
[   13.646027] mount 90
[   13.646067] bypass video node creation 0
[   13.646067] msm_sensor_fill_eeprom_subdevid_by_name:222 Eeprom userspace probe for s5k4h8//E2PROM probe成功
[   13.668733] msm_cci_init:1442: hw_version = 0x10020005
[   13.668982] ===msm_sensor_match_id: read id: 0x4088 expected id 0x4088://读到ID
[   13.677138] s5k4h8 probe succeeded//probe成功
1.EEPROM如果没配,adb logcat的log会提示EEPROM相关的错误
2.效果文件一开始没有使用0310版本,而是使用0309版本,根本没有生成对应的libchromatix_*.so的库文件,所以adb logcat也会提示加载效果文件失败
11-12 10:07:30.700 15286 15286 E mm-camera: 65: load_chromatix: failed//加载效果文件失败
11-12 10:07:30.700 15286 15286 E mm-camera: 84: load_chromatix: /data/vendor/camera/chromatix_s5k4h8_snapshot.bin fopen failed (non-fatal)//没有对应效果文件
11-12 10:07:30.700 15286 15286 E mm-camera: 237: addLib_getSymbol: fail : load_chromatix s5k4h8_snapshot
11-12 10:07:30.700 15286 15286 E mm-camera: 208: addLib: failed to add chromatix to hash
11-12 10:07:30.700 15286 15286 E mm-camera: 77: cm_create: failed
11-12 10:07:30.700 15286 15286 E mm-camera: 116: cm_create: failed
11-12 10:07:30.700 15286 15286 E mm-camera: 7726: module_sensor_init_chromatix: failed: create cm
11-12 10:07:30.700 15286 15286 E mm-camera: 8195: module_sensor_init: failed//初始化失败

sensor初始化失败导致后面一系列错误,最终导致camera打不开。

正常打开的kernel log:
    修改:     kernel/msm-4.9/drivers/media/platform/msm/camera_v2/sensor/msm_sensor.c
    修改:     kernel/msm-4.9/drivers/media/platform/msm/camera_v2/sensor/msm_sensor_driver.c
wanghl@server:~/work/sdm632_android$ adb shell cat proc/kmsg
<6>[ 5384.040568] MSM-CPP cpp_release_hardware:1214 cpp hw release done
<6>[ 5385.470084] msm_pm_qos_update_request: update request 100
<6>[ 5385.470136] msm_pm_qos_update_request: update request -1
<6>[ 5385.486952] msm_csid_init: CSID_VERSION = 0x30050001
<3>[ 5385.488100] msm_csid_irq CSID2_IRQ_STATUS_ADDR = 0x800
<6>[ 5385.502127] MSM-CPP cpp_init_hardware:1133 CPP HW Version: 0x40030003
<3>[ 5385.502156] MSM-CPP cpp_init_hardware:1151 stream_cnt:0
<3>[ 5385.646820] msm_csid_irq CSID2_IRQ_STATUS_ADDR = 0x800

正常的logcat:
wanghl@server:~/work/sdm632_android$ adb logcat -c//关闭摄像头,清除log
wanghl@server:~/work/sdm632_android$ adb logcat | grep "mm-camera"
11-13 23:20:36.469   566  1439 I mm-camera: < INFO> 118: mct_controller_new: Creating new mct_controller with session-id 1
11-13 23:20:36.470   566  5013 I mm-camera: < INFO> 5154: mct_pipeline_start_session_thread: E sensor
11-13 23:20:36.470   566  5013 I mm-camera: < INFO> 5161: mct_pipeline_start_session_thread: Calling start_session on Module sensor
11-13 23:20:36.471   566  5014 I mm-camera: < INFO> 5154: mct_pipeline_start_session_thread: E iface
11-13 23:20:36.472   566  5014 I mm-camera: < INFO> 5161: mct_pipeline_start_session_thread: Calling start_session on Module iface
11-13 23:20:36.472   566  5016 I mm-camera: < INFO> 5154: mct_pipeline_start_session_thread: E isp
11-13 23:20:36.472   566  5016 I mm-camera: < INFO> 5161: mct_pipeline_start_session_thread: Calling start_session on Module isp
11-13 23:20:36.472   566  5016 I mm-camera: < INFO> 214: isp_module_start_session: session id 1 
11-13 23:20:36.473   566  5017 I mm-camera: < INFO> 5154: mct_pipeline_start_session_thread: E stats
11-13 23:20:36.473   566  5017 I mm-camera: < INFO> 5161: mct_pipeline_start_session_thread: Calling start_session on Module stats
11-13 23:20:36.473   566  5019 I mm-camera: < INFO> 5154: mct_pipeline_start_session_thread: E pproc
11-13 23:20:36.473   566  5019 I mm-camera: < INFO> 5161: mct_pipeline_start_session_thread: Calling start_session on Module pproc
11-13 23:20:36.477   566  5021 I mm-camera: < INFO> 5154: mct_pipeline_start_session_thread: E imglib
11-13 23:20:36.477   566  5021 I mm-camera: < INFO> 5161: mct_pipeline_start_session_thread: Calling start_session on Module imglib
11-13 23:20:36.479   566  5021 I mm-camera: < INFO> 5164: mct_pipeline_start_session_thread: Module imglib start_session rc = 1
11-13 23:20:36.479   566  5021 I mm-camera: < INFO> 5172: mct_pipeline_start_session_thread: started_num = 1, success = 1
11-13 23:20:36.479   566  5021 I mm-camera: < INFO> 5179: mct_pipeline_start_session_thread: X imglib
11-13 23:20:36.479   566  5014 I mm-camera: < INFO> 5164: mct_pipeline_start_session_thread: Module iface start_session rc = 1
11-13 23:20:36.479   566  5014 I mm-camera: < INFO> 5172: mct_pipeline_start_session_thread: started_num = 2, success = 2
11-13 23:20:36.479   566  5014 I mm-camera: < INFO> 5179: mct_pipeline_start_session_thread: X iface
11-13 23:20:36.482   566  5013 I mm-camera: < INFO> 5164: mct_pipeline_start_session_thread: Module sensor start_session rc = 1
11-13 23:20:36.482   566  5013 I mm-camera: < INFO> 5172: mct_pipeline_start_session_thread: started_num = 3, success = 3
11-13 23:20:36.482   566  5013 I mm-camera: < INFO> 5179: mct_pipeline_start_session_thread: X sensor
11-13 23:20:36.482   566  5017 I mm-camera: < INFO> 5164: mct_pipeline_start_session_thread: Module stats start_session rc = 1
11-13 23:20:36.482   566  5017 I mm-camera: < INFO> 5172: mct_pipeline_start_session_thread: started_num = 4, success = 4
11-13 23:20:36.482   566  5017 I mm-camera: < INFO> 5179: mct_pipeline_start_session_thread: X stats
11-13 23:20:36.487   566  5019 I mm-camera: < INFO> 5164: mct_pipeline_start_session_thread: Module pproc start_session rc = 1
11-13 23:20:36.487   566  5019 I mm-camera: < INFO> 5172: mct_pipeline_start_session_thread: started_num = 5, success = 5
11-13 23:20:36.487   566  5019 I mm-camera: < INFO> 5179: mct_pipeline_start_session_thread: X pproc
11-13 23:20:36.487   566  5016 I mm-camera: < INFO> 5164: mct_pipeline_start_session_thread: Module isp start_session rc = 1
11-13 23:20:36.487   566  5016 I mm-camera: < INFO> 5172: mct_pipeline_start_session_thread: started_num = 6, success = 6
11-13 23:20:36.487   566  5016 I mm-camera: < INFO> 5179: mct_pipeline_start_session_thread: X isp
11-13 23:20:36.500   566  1439 I mm-camera: < INFO> 5075: mct_pipeline_start_stream_internal: Adding session stream streamid= 0xf for session=1
11-13 23:20:36.500   566  1439 I mm-camera: < INFO> 5123: mct_pipeline_start_stream_internal: Linking session stream for session 1
11-13 23:20:36.500   566  1439 I mm-camera: < INFO> 523: mct_stream_start_link: Start linking Session-stream 0x1000f
11-13 23:20:36.501   566  1439 I mm-camera: < INFO> 849: isp_port_check_caps_reserve: port 0xe45f7340 ide 1000f type 10 dim 0 0
11-13 23:20:36.501   566  1439 I mm-camera: < INFO> 449: pproc_port_add_modules_to_stream: in identity 1000f stream 10 int_link = 0xe45fb940
11-13 23:20:36.501   566  1439 I mm-camera: < INFO> 461: pproc_port_add_modules_to_stream: :LINK linking mods tmod and paaf for identity 1000f
11-13 23:20:36.502   566  1439 I mm-camera: < INFO> 461: pproc_port_add_modules_to_stream: :LINK linking mods paaf and sat for identity 1000f
11-13 23:20:36.503   566  1439 I mm-camera: < INFO> 461: pproc_port_add_modules_to_stream: :LINK linking mods sat and c2d for identity 1000f
11-13 23:20:36.503   566  1439 I mm-camera: < INFO> 1557: c2d_module_notify_add_stream: width 0, height 0, stride 0, scanline 0, is_type 0
11-13 23:20:36.503   566  1439 I mm-camera: < INFO> 461: pproc_port_add_modules_to_stream: :LINK linking mods c2d and cpp for identity 1000f
11-13 23:20:36.503   566  1439 I mm-camera: < INFO> 2439: cpp_module_notify_add_stream: :stream 10, width 0, height 0, stride 0,scanline 0, framelen 0
11-13 23:20:36.503   566  1439 I mm-camera: < INFO> 2596: cpp_module_notify_add_stream: : stream 10, fmt 1, asf_mode 0, sharpness_level 0.000000,asf mask 0, denoise 0, denoise_mask 0, dsdn mask 0,dsdn enable 0, tnr mask 0, tnr enable 0, ds_mask 0, luma dsdn 0
11-13 23:20:36.503   566  1439 I mm-camera: < INFO> 461: pproc_port_add_modules_to_stream: :LINK linking mods cpp and rtbdm for identity 1000f
11-13 23:20:36.504   566  1439 I mm-camera: < INFO> 461: pproc_port_add_modules_to_stream: :LINK linking mods rtbdm and depth_map for identity 1000f
11-13 23:20:36.505   566  1439 I mm-camera: < INFO> 461: pproc_port_add_modules_to_stream: :LINK linking mods depth_map and ezt for identity 1000f
11-13 23:20:36.505   566  1439 I mm-camera: < INFO> 461: pproc_port_add_modules_to_stream: :LINK linking mods ezt and quadracfa for identity 1000f
11-13 23:20:36.507   566  1439 E mm-camera: 3011: stats_port_check_caps_reserve: Invalid Port capability type!
11-13 23:20:36.507   566  1439 E mm-camera: 3011: stats_port_check_caps_reserve: Invalid Port capability type!
11-13 23:20:36.508   566  5015 E mm-camera: 247: module_sensor_offload_init_config: func_tbl for submodule 4 is NULL
11-13 23:20:36.509   566  5015 E mm-camera: 249: module_sensor_offload_init_config: failed to get led off frame skip time
11-13 23:20:36.510   566  1439 I mm-camera: < INFO> 5132: mct_pipeline_start_stream_internal: Session stream linked successfully session 1
11-13 23:20:36.516   566  5011 E mm-camera: 322: module_depth_map_handle_ctrl_parm: E
11-13 23:20:36.516   566  5011 E mm-camera: 430: module_depth_map_set_config_param: X
11-13 23:20:36.516   566  5011 E mm-camera: 254: module_depth_map_send_config_data: CAM_STREAM_TYPE_DEPTH not set !!
11-13 23:20:36.516   566  5011 E mm-camera: 369: module_depth_map_handle_ctrl_parm: Error module_depth_map_send_config_data
11-13 23:20:36.516   566  5011 E mm-camera: 373: module_depth_map_handle_ctrl_parm: X
11-13 23:20:36.516   566  5011 E mm-camera: 880: module_imgbase_process_param: [depth_map] handle_ctrl_parm error : type=10, rc=-5
11-13 23:20:36.516   566  5011 I mm-camera: < INFO> 6268: iface_util_set_dis_enable_flag: iface_util_set_dis_enable_flag:6268 DIS enable flag = 0
11-13 23:20:36.517   566  5011 E mm-camera: 5310: module_sensor_event_control_set_parm: func_tbl for submodule 4 is NULL
11-13 23:20:36.519   566  5011 E mm-camera: 322: module_depth_map_handle_ctrl_parm: E
11-13 23:20:36.519   566  5011 E mm-camera: 430: module_depth_map_set_config_param: X
11-13 23:20:36.519   566  5011 E mm-camera: 254: module_depth_map_send_config_data: CAM_STREAM_TYPE_DEPTH not set !!
11-13 23:20:36.519   566  5011 E mm-camera: 369: module_depth_map_handle_ctrl_parm: Error module_depth_map_send_config_data
11-13 23:20:36.519   566  5011 E mm-camera: 373: module_depth_map_handle_ctrl_parm: X
11-13 23:20:36.519   566  5011 E mm-camera: 880: module_imgbase_process_param: [depth_map] handle_ctrl_parm error : type=10, rc=-5
11-13 23:20:36.520   566  5011 E mm-camera: 322: module_depth_map_handle_ctrl_parm: E
11-13 23:20:36.520   566  5011 E mm-camera: 430: module_depth_map_set_config_param: X
11-13 23:20:36.520   566  5011 E mm-camera: 254: module_depth_map_send_config_data: CAM_STREAM_TYPE_DEPTH not set !!
11-13 23:20:36.520   566  5011 E mm-camera: 369: module_depth_map_handle_ctrl_parm: Error module_depth_map_send_config_data
11-13 23:20:36.520   566  5011 E mm-camera: 373: module_depth_map_handle_ctrl_parm: X
11-13 23:20:36.520   566  5011 E mm-camera: 880: module_imgbase_process_param: [depth_map] handle_ctrl_parm error : type=10, rc=-5
11-13 23:20:36.600   566  5011 I mm-camera: < INFO> 1959: c2d_module_handle_set_parm_event: META_STREAM_INFO type = 1 w x h : 1440 x 1080 pp_mask = 0x882
11-13 23:20:36.600   566  5011 I mm-camera: < INFO> 1959: c2d_module_handle_set_parm_event: META_STREAM_INFO type = 11 w x h : 640 x 480 pp_mask = 0x882
11-13 23:20:36.600   566  5011 I mm-camera: < INFO> 1959: c2d_module_handle_set_parm_event: META_STREAM_INFO type = 3 w x h : 3264 x 2448 pp_mask = 0x0
11-13 23:20:36.600   566  5011 I mm-camera: < INFO> 7155: isp_util_print_meta_stream_info: Stream type 1 Resolution: 1440x1080 pp_mask: 0x882
11-13 23:20:36.600   566  5011 I mm-camera: < INFO> 7155: isp_util_print_meta_stream_info: Stream type 11 Resolution: 640x480 pp_mask: 0x882
11-13 23:20:36.600   566  5011 I mm-camera: < INFO> 7155: isp_util_print_meta_stream_info: Stream type 3 Resolution: 3264x2448 pp_mask: 0x0
11-13 23:20:36.600   566  5011 I mm-camera: < INFO> 1144: isp_resource_reserve_isp: Allocate num_isp 1 for session 1 request_dual_isp 0
11-13 23:20:36.601   566  5011 I mm-camera: < INFO> 2619: isp_resource_allocate: INFO: ISP resource acquired: session 1 num_isp 1
11-13 23:20:36.601   566  5011 I mm-camera: < INFO> 2621: isp_resource_allocate: INFO: ISP resource acquired: hw_id 1
11-13 23:20:36.601   566  5011 I mm-camera: < INFO> 7001: isp_util_decide_stream_mapping: stream_port_map num streams 3
11-13 23:20:36.601   566  5011 I mm-camera: < INFO> 7015: isp_util_decide_stream_mapping: INFO: type 3 resolution 3264x2448 hw_stream 1 need_native_buff 0 controllable_output 0 shared_output 0is_changed 0 changed_dim 3264x2448
11-13 23:20:36.601   566  5011 I mm-camera: < INFO> 7015: isp_util_decide_stream_mapping: INFO: type 1 resolution 1440x1080 hw_stream 0 need_native_buff 1 controllable_output 0 shared_output 0is_changed 0 changed_dim 1440x1080
11-13 23:20:36.601   566  5011 I mm-camera: < INFO> 7015: isp_util_decide_stream_mapping: INFO: type 11 resolution 640x480 hw_stream 0 need_native_buff 1 controllable_output 0 shared_output 0is_changed 0 changed_dim 640x480
11-13 23:20:36.603   566  5011 I mm-camera: < INFO> 6378: iface_util_handle_meta_stream_info: iface_util_handle_meta_stream_info: ms_type 0 num streams 3
11-13 23:20:36.604   566  5011 W mm-camera: < WARN> 2851: iface_util_modify_plane_info_for_native_buf: iface_util_modify_plane_info_for_native_buf: Invalid cam_format -2088533117
11-13 23:20:36.604   566  5011 W mm-camera: < WARN> 2886: iface_util_calculate_frame_length_for_native_buf: iface_util_calculate_frame_length_for_native_buf: returned fail=-1
11-13 23:20:36.604   566  5011 W mm-camera: < WARN> 2851: iface_util_modify_plane_info_for_native_buf: iface_util_modify_plane_info_for_native_buf: Invalid cam_format -2088533117
11-13 23:20:36.604   566  5011 W mm-camera: < WARN> 2886: iface_util_calculate_frame_length_for_native_buf: iface_util_calculate_frame_length_for_native_buf: returned fail=-1
11-13 23:20:36.606   566  5011 I mm-camera: < INFO> 4146: mct_pipeline_process_set: command=800000a
11-13 23:20:36.607   566  5011 I mm-camera: < INFO> 4146: mct_pipeline_process_set: command=8000018
11-13 23:20:36.607   566  5011 I mm-camera: < INFO> 623: mct_stream_start_link: Link Metadata stream 0x10001: do nothing
11-13 23:20:36.607   566  5011 I mm-camera: < INFO> 4244: mct_pipeline_process_set: Linking successful for stream 0x10001 stream type=7
11-13 23:20:36.607   566  5011 I mm-camera: < INFO> 4146: mct_pipeline_process_set: command=8000004
11-13 23:20:36.608   566  5011 I mm-camera: < INFO> 4146: mct_pipeline_process_set: command=800000a
11-13 23:20:36.609   566  5011 I mm-camera: < INFO> 4146: mct_pipeline_process_set: command=8000018
11-13 23:20:36.609   566  5011 I mm-camera: < INFO> 498: mct_stream_start_link: Start linking preview stream 0x10002
11-13 23:20:36.609   566  5011 I mm-camera: < INFO> 509: mct_stream_start_link: non secure stream linking
11-13 23:20:36.609   566  5011 I mm-camera: < INFO> 849: isp_port_check_caps_reserve: port 0xe45f7340 ide 10002 type 1 dim 1440 1080
11-13 23:20:36.610   566  5011 I mm-camera: < INFO> 449: pproc_port_add_modules_to_stream: in identity 10002 stream 1 int_link = 0xe45fbbc0
11-13 23:20:36.610   566  5011 I mm-camera: < INFO> 461: pproc_port_add_modules_to_stream: :LINK linking mods tmod and paaf for identity 10002
11-13 23:20:36.611   566  5011 I mm-camera: < INFO> 461: pproc_port_add_modules_to_stream: :LINK linking mods paaf and cpp for identity 10002
11-13 23:20:36.612   566  5011 I mm-camera: < INFO> 3702: cpp_module_util_update_dim: offset_x 0, offset_y 0, offset 0, meta_len 0,meta_scanline 0, meta_stride 0, plane_len 1589760
11-13 23:20:36.612   566  5011 I mm-camera: < INFO> 3702: cpp_module_util_update_dim: offset_x 0, offset_y 0, offset 0, meta_len 0,meta_scanline 0, meta_stride 0, plane_len 794880
11-13 23:20:36.612   566  5011 I mm-camera: < INFO> 2439: cpp_module_notify_add_stream: :stream 1, width 1440, height 1080, stride 1472,scanline 1080, framelen 2387968
11-13 23:20:36.612   566  5011 I mm-camera: < INFO> 2596: cpp_module_notify_add_stream: : stream 1, fmt 2, asf_mode 1, sharpness_level 1.000000,asf mask 1, denoise 1, denoise_mask 1, dsdn mask 0,dsdn enable 0, tnr mask 0, tnr enable 0, ds_mask 0, luma dsdn 0
11-13 23:20:36.612   566  5011 W mm-camera: < WARN> 5724: faceproc_hw_comp_create: Library not loaded, handle=0x0, p_ops=0xe034e58c
11-13 23:20:36.612   566  5011 W mm-camera: < WARN> 3827: module_faceproc_comp_create: create comp failed, eng_type=0
11-13 23:20:36.612   566  5011 W mm-camera: < WARN> 1060: faceproc_dsp_comp_create: fddsp stub library not loaded
11-13 23:20:36.612   566  5011 W mm-camera: < WARN> 3827: module_faceproc_comp_create: create comp failed, eng_type=1
11-13 23:20:36.612   566  5011 I mm-camera: < INFO> 4244: mct_pipeline_process_set: Linking successful for stream 0x10002 stream type=1
11-13 23:20:36.612   566  5011 I mm-camera: < INFO> 4146: mct_pipeline_process_set: command=8000004
11-13 23:20:36.614   566  5011 I mm-camera: < INFO> 4146: mct_pipeline_process_set: command=800000a
11-13 23:20:36.614   566  5011 I mm-camera: < INFO> 4146: mct_pipeline_process_set: command=8000018
11-13 23:20:36.615   566  5011 I mm-camera: < INFO> 546: mct_stream_start_link: Start linking snapshot stream 0x10003
11-13 23:20:36.615   566  5011 I mm-camera: < INFO> 849: isp_port_check_caps_reserve: port 0xe45f7340 ide 10003 type 3 dim 3264 2448
11-13 23:20:36.615   566  5011 I mm-camera: < INFO> 4244: mct_pipeline_process_set: Linking successful for stream 0x10003 stream type=3
11-13 23:20:36.616   566  5011 I mm-camera: < INFO> 4146: mct_pipeline_process_set: command=8000004
11-13 23:20:36.619   566  5011 I mm-camera: < INFO> 4146: mct_pipeline_process_set: command=800000a
11-13 23:20:36.620   566  5011 I mm-camera: < INFO> 4146: mct_pipeline_process_set: command=8000018
11-13 23:20:36.620   566  5011 I mm-camera: < INFO> 609: mct_stream_start_link: Starting Analysis stream linking
11-13 23:20:36.620   566  5011 I mm-camera: < INFO> 849: isp_port_check_caps_reserve: port 0xe45f7340 ide 10004 type 11 dim 640 480
11-13 23:20:36.622   566  5011 I mm-camera: < INFO> 449: pproc_port_add_modules_to_stream: in identity 10004 stream 11 int_link = 0xe45fbbc0
11-13 23:20:36.622   566  5011 I mm-camera: < INFO> 4244: mct_pipeline_process_set: Linking successful for stream 0x10004 stream type=11
11-13 23:20:36.622   566  5011 I mm-camera: < INFO> 4146: mct_pipeline_process_set: command=8000004
11-13 23:20:36.627   566  5011 E mm-camera: 322: module_depth_map_handle_ctrl_parm: E
11-13 23:20:36.627   566  5011 E mm-camera: 430: module_depth_map_set_config_param: X
11-13 23:20:36.627   566  5011 E mm-camera: 254: module_depth_map_send_config_data: CAM_STREAM_TYPE_DEPTH not set !!
11-13 23:20:36.627   566  5011 E mm-camera: 369: module_depth_map_handle_ctrl_parm: Error module_depth_map_send_config_data
11-13 23:20:36.627   566  5011 E mm-camera: 373: module_depth_map_handle_ctrl_parm: X
11-13 23:20:36.627   566  5011 E mm-camera: 880: module_imgbase_process_param: [depth_map] handle_ctrl_parm error : type=10, rc=-5
11-13 23:20:36.628   566  5011 I mm-camera: < INFO> 4146: mct_pipeline_process_set: command=8000019
11-13 23:20:36.628   566  5011 I mm-camera: < INFO> 4146: mct_pipeline_process_set: command=8000019
11-13 23:20:36.642   566  5011 I mm-camera: < INFO> 4146: mct_pipeline_process_set: command=8000008
11-13 23:20:36.642   566  5011 I mm-camera: < INFO> 4285: mct_pipeline_process_set:  STREAM-ON on stream 0x10001 stream type=7
11-13 23:20:36.642   566  5011 I mm-camera: < INFO> 4300: mct_pipeline_process_set:  STREAM-ON success for stream 0x10001, stream type=7
11-13 23:20:36.664   566  5011 I mm-camera: < INFO> 4146: mct_pipeline_process_set: command=8000008
11-13 23:20:36.664   566  5011 I mm-camera: < INFO> 4285: mct_pipeline_process_set:  STREAM-ON on stream 0x10002 stream type=1
11-13 23:20:36.664   566  5011 I mm-camera: < INFO> 4088: sensor_get_resolution_info: sensor info: name: s5k4h8, res: 0, max_fps: 15.000000, w: 3264, h: 2448 op pix clk: 128400000, FLL: 2498, LLPCK: 3744, mode: 1, PDAF support: 0
11-13 23:20:36.665   566  5027 I mm-camera: < INFO> 2614: aec_set_param: SHDR LIMITS:0 0 (0 0) (0 0)
11-13 23:20:36.665   566  5011 E mm-camera: 3456: af_port_handle_sensor_update: Depth_Err: actuator sensitivity: 0.000000 is invalid
11-13 23:20:36.666   566  5011 I mm-camera: < INFO> 2388: cpp_module_handle_stream_cfg_event: frame_offset=3, input_fps=15.00, identity=0x1000f
11-13 23:20:36.666   566  5011 I mm-camera: < INFO> 2388: cpp_module_handle_stream_cfg_event: frame_offset=3, input_fps=15.00, identity=0x10002
11-13 23:20:36.666   566  5011 E mm-camera: 7785: module_sensor_set_decode_format_based_on_pack_mode: Pack mode is 0
11-13 23:20:36.669   566  5027 E mm-camera: 579: aec_led_cal_apply_calibration: Calibrate data size 0 not expected with tuning size: 0
11-13 23:20:36.669   566  5028 E mm-camera: 596: af_haf_default_mixer_active_algo_selection: ERROR! Unable to find active mixer algo !! 
11-13 23:20:36.669   566  5028 E mm-camera: 1298: port_sensor_handle_upstream_module_event: failed
11-13 23:20:36.669   566  5028 E mm-camera: 1622: port_sensor_port_process_event: failed: port_sensor_handle_upstream_module_event
11-13 23:20:36.669   566  5028 E mm-camera: 1451: isp_util_forward_event: failed: mct_port_send_event_to_peer event->type 2
11-13 23:20:36.670   566  5011 E mm-camera: 2263: iface_util_set_chromatix: iface_util_set_chromatix:2263 failed: iface_hvx_open rc 0
11-13 23:20:36.670   566  5011 I mm-camera: < INFO> 429: iface_util_dump_sensor_cfg: iface_util_dump_sensor_cfg: sensor dim: width = 3264, heght = 2448, fmt = 29, is_bayer = 1, init_skip = 2
11-13 23:20:36.681   566  5011 I mm-camera: < INFO> 3636: iface_util_dump_isp_resource_request:  =====DUMP RESOURCE: PIX STREAM=== 
11-13 23:20:36.681   566  5011 I mm-camera: < INFO> 3637: iface_util_dump_isp_resource_request: num pix stream = 2
11-13 23:20:36.681   566  5011 I mm-camera: < INFO> 3640: iface_util_dump_isp_resource_request: num_isp = 1, isp_mask = 2, request_op_pix_clk = 0
11-13 23:20:36.681   566  5011 I mm-camera: < INFO> 3644: iface_util_dump_isp_resource_request: ispif stripe info: split 0, overlap 0, stripe offset 0
11-13 23:20:36.681   566  5011 I mm-camera: < INFO> 3647: iface_util_dump_isp_resource_request: pix stream 0
11-13 23:20:36.681   566  5011 I mm-camera: < INFO> 3650: iface_util_dump_isp_resource_request: num mct stream mapped = 2(Mapped stream ID[0] = 2)
11-13 23:20:36.681   566  5011 I mm-camera: < INFO> 3653: iface_util_dump_isp_resource_request: axi path = 1(ENC-0/VIEW-1/CAMIF-2/IDEAL-3), cam_fmt 2
11-13 23:20:36.681   566  5011 I mm-camera: < INFO> 3647: iface_util_dump_isp_resource_request: pix stream 1
11-13 23:20:36.681   566  5011 I mm-camera: < INFO> 3650: iface_util_dump_isp_resource_request: num mct stream mapped = 1(Mapped stream ID[0] = 3)
11-13 23:20:36.681   566  5011 I mm-camera: < INFO> 3653: iface_util_dump_isp_resource_request: axi path = 0(ENC-0/VIEW-1/CAMIF-2/IDEAL-3), cam_fmt 2
11-13 23:20:36.681   566  5011 I mm-camera: < INFO> 3675: iface_util_dump_isp_resource_request: num STATS stream = 5
11-13 23:20:36.682   566  5011 I mm-camera: < INFO> 3702: cpp_module_util_update_dim: offset_x 0, offset_y 0, offset 0, meta_len 0,meta_scanline 0, meta_stride 0, plane_len 1566720
11-13 23:20:36.682   566  5011 I mm-camera: < INFO> 3702: cpp_module_util_update_dim: offset_x 0, offset_y 0, offset 0, meta_len 0,meta_scanline 0, meta_stride 0, plane_len 783360
11-13 23:20:36.682   566  5011 I mm-camera: < INFO> 1108: cpp_module_handle_isp_out_dim_event: [STREAM_PARAMS]  stream type 1, width 1440, height 1080,stride 1472, scanline 1080, planes 2
11-13 23:20:36.683   566  5011 I mm-camera: < INFO> 3983: iface_create_axi: iface_create_axi:3983: Create axi hw for session 1 on VFE 1
11-13 23:20:36.690   566  5011 I mm-camera: < INFO> 9565: iface_util_dump_camif_cfg: =====Camif DUMP cfg for PIX interface====
11-13 23:20:36.690   566  5011 I mm-camera: < INFO> 9567: iface_util_dump_camif_cfg: camif input type = 3(MIPI=3), op_pix_clk = 124727145
11-13 23:20:36.690   566  5011 I mm-camera: < INFO> 9569: iface_util_dump_camif_cfg: camif pix_pattern(RGRG-0/GRGR-1/BGBG-2/GBGB-3) = 1
11-13 23:20:36.690   566  5011 I mm-camera: < INFO> 9571: iface_util_dump_camif_cfg: camif first_pix = 0, last_pix = 3263
11-13 23:20:36.690   566  5011 I mm-camera: < INFO> 9573: iface_util_dump_camif_cfg: camif first_line = 0, last_line = 2447
11-13 23:20:36.690   566  5011 I mm-camera: < INFO> 9575: iface_util_dump_camif_cfg: camif pixels_per_line = 3264, lines_per_frame = 2448
11-13 23:20:36.690   566  5011 I mm-camera: < INFO> 9579: iface_util_dump_camif_cfg: camif irq subsample pattern = 0, period = 0 sof_step 1
11-13 23:20:36.690   566  5053 I mm-camera: < INFO> 569: iface_dump_axi_plane_config: === AXI DUMP: VFE session_id 1, hw_stream_id 10002 ===
11-13 23:20:36.690   566  5053 I mm-camera: < INFO> 573: iface_dump_axi_plane_config:     AXI DUMP Axi_src: VIEWFINDER hw_stream width 1440, height 1080
11-13 23:20:36.690   566  5053 I mm-camera: < INFO> 575: iface_dump_axi_plane_config: need buf divert = 1, burst count = 0
11-13 23:20:36.690   566  5053 I mm-camera: < INFO> 578: iface_dump_axi_plane_config: hfr mode = 0, skip pattern = 0, init_frame_drop = 2
11-13 23:20:36.690   566  5053 I mm-camera: < INFO> 611: iface_dump_axi_plane_config: plane[0]: plane_fmt 0(Y-0/CB-1/Cr-2/CrCb-3/CbCr-4)
11-13 23:20:36.690   566  5053 I mm-camera: < INFO> 613: iface_dump_axi_plane_config: plane[0]: width = 1440, height = 1080
11-13 23:20:36.690   566  5053 I mm-camera: < INFO> 615: iface_dump_axi_plane_config: plane[0]: stride = 1440, scanlines = 1088
11-13 23:20:36.690   566  5053 I mm-camera: < INFO> 617: iface_dump_axi_plane_config: plane[0]: address_offset 0
11-13 23:20:36.690   566  5053 I mm-camera: < INFO> 611: iface_dump_axi_plane_config: plane[1]: plane_fmt 3(Y-0/CB-1/Cr-2/CrCb-3/CbCr-4)
11-13 23:20:36.690   566  5053 I mm-camera: < INFO> 613: iface_dump_axi_plane_config: plane[1]: width = 1440, height = 540
11-13 23:20:36.690   566  5053 I mm-camera: < INFO> 615: iface_dump_axi_plane_config: plane[1]: stride = 1440, scanlines = 544
11-13 23:20:36.690   566  5053 I mm-camera: < INFO> 617: iface_dump_axi_plane_config: plane[1]: address_offset 0
11-13 23:20:36.691   566  5053 I mm-camera: < INFO> 569: iface_dump_axi_plane_config: === AXI DUMP: VFE session_id 1, hw_stream_id 3 ===
11-13 23:20:36.691   566  5053 I mm-camera: < INFO> 573: iface_dump_axi_plane_config:     AXI DUMP Axi_src: ENCODER hw_stream width 3264, height 2448
11-13 23:20:36.691   566  5053 I mm-camera: < INFO> 575: iface_dump_axi_plane_config: need buf divert = 0, burst count = 0
11-13 23:20:36.691   566  5053 I mm-camera: < INFO> 578: iface_dump_axi_plane_config: hfr mode = 0, skip pattern = 0, init_frame_drop = 2
11-13 23:20:36.691   566  5053 I mm-camera: < INFO> 611: iface_dump_axi_plane_config: plane[0]: plane_fmt 0(Y-0/CB-1/Cr-2/CrCb-3/CbCr-4)
11-13 23:20:36.691   566  5053 I mm-camera: < INFO> 613: iface_dump_axi_plane_config: plane[0]: width = 3264, height = 2448
11-13 23:20:36.691   566  5053 I mm-camera: < INFO> 615: iface_dump_axi_plane_config: plane[0]: stride = 3264, scanlines = 2496
11-13 23:20:36.691   566  5053 I mm-camera: < INFO> 617: iface_dump_axi_plane_config: plane[0]: address_offset 0
11-13 23:20:36.691   566  5053 I mm-camera: < INFO> 611: iface_dump_axi_plane_config: plane[1]: plane_fmt 3(Y-0/CB-1/Cr-2/CrCb-3/CbCr-4)
11-13 23:20:36.691   566  5053 I mm-camera: < INFO> 613: iface_dump_axi_plane_config: plane[1]: width = 3264, height = 1224
11-13 23:20:36.691   566  5053 I mm-camera: < INFO> 615: iface_dump_axi_plane_config: plane[1]: stride = 3264, scanlines = 1248
11-13 23:20:36.691   566  5053 I mm-camera: < INFO> 617: iface_dump_axi_plane_config: plane[1]: address_offset 0
11-13 23:20:36.700   566  5011 I mm-camera: < INFO> 1748: iface_streamon_to_thread: iface_streamon_to_thread: E, session id = 1, user stream id = 2
11-13 23:20:36.700   566  5022 I mm-camera: < INFO> 2095: iface_streamon: E, session_id 1 mct_stream_id = 2
11-13 23:20:36.700   566  5022 I mm-camera: < INFO> 12106: iface_util_get_user_streams_by_bundle: got No.1 bundled streamon, mct stream id 2total bundled stream num = 3
11-13 23:20:36.706   566  5011 E mm-camera: 281: module_linearization40_update_sudmod_enable: failed !! linearization40_update_base_tables
11-13 23:20:36.707   566  5011 I mm-camera: < INFO> 192: mesh_rolloff40_normalize_table: full 3264 2448 out 3264 2448 offset 0 0 scale 1
11-13 23:20:36.712   566  5029 I mm-camera: < INFO> 90: rs_stats44_stats_config_update: warning: max_support_h_rgn invalid 8
11-13 23:20:36.714   566  5011 I mm-camera: < INFO> 4722: cpp_module_handle_streamon_event: identity=0x10002, stream-on done
11-13 23:20:36.714   566  5011 I mm-camera: < INFO> 1777: iface_streamon_to_thread: iface_streamon_to_thread: X, session id = 1, user stream id = 2
11-13 23:20:36.715   566  5011 I mm-camera: < INFO> 4300: mct_pipeline_process_set:  STREAM-ON success for stream 0x10002, stream type=1
11-13 23:20:36.716   566  5020 I mm-camera: < INFO> 371: cpp_hardware_set_clock: Set clock 400000000 BW avg 78732000 BW inst 78732000
11-13 23:20:36.716   566  5011 I mm-camera: < INFO> 4146: mct_pipeline_process_set: command=8000008
11-13 23:20:36.716   566  5011 I mm-camera: < INFO> 4285: mct_pipeline_process_set:  STREAM-ON on stream 0x10003 stream type=3
11-13 23:20:36.716   566  5011 I mm-camera: < INFO> 4088: sensor_get_resolution_info: sensor info: name: s5k4h8, res: 0, max_fps: 15.000000, w: 3264, h: 2448 op pix clk: 128400000, FLL: 2498, LLPCK: 3744, mode: 1, PDAF support: 0
11-13 23:20:36.716   566  5027 I mm-camera: < INFO> 2614: aec_set_param: SHDR LIMITS:0 0 (0 0) (0 0)
11-13 23:20:36.716   566  5011 E mm-camera: 3456: af_port_handle_sensor_update: Depth_Err: actuator sensitivity: 0.000000 is invalid
11-13 23:20:36.716   566  5011 I mm-camera: < INFO> 2388: cpp_module_handle_stream_cfg_event: frame_offset=3, input_fps=15.00, identity=0x1000f
11-13 23:20:36.716   566  5011 I mm-camera: < INFO> 2388: cpp_module_handle_stream_cfg_event: frame_offset=3, input_fps=15.00, identity=0x10002
11-13 23:20:36.717   566  5011 E mm-camera: 7785: module_sensor_set_decode_format_based_on_pack_mode: Pack mode is 0
11-13 23:20:36.717   566  5011 I mm-camera: < INFO> 1748: iface_streamon_to_thread: iface_streamon_to_thread: E, session id = 1, user stream id = 3
11-13 23:20:36.717   566  5022 I mm-camera: < INFO> 2095: iface_streamon: E, session_id 1 mct_stream_id = 3
11-13 23:20:36.717   566  5022 I mm-camera: < INFO> 12106: iface_util_get_user_streams_by_bundle: got No.2 bundled streamon, mct stream id 3total bundled stream num = 3
11-13 23:20:36.717   566  5011 E mm-camera: 281: module_linearization40_update_sudmod_enable: failed !! linearization40_update_base_tables
11-13 23:20:36.718   566  5029 I mm-camera: < INFO> 90: rs_stats44_stats_config_update: warning: max_support_h_rgn invalid 8
11-13 23:20:36.718   566  5011 I mm-camera: < INFO> 1777: iface_streamon_to_thread: iface_streamon_to_thread: X, session id = 1, user stream id = 3
11-13 23:20:36.719   566  5011 I mm-camera: < INFO> 4300: mct_pipeline_process_set:  STREAM-ON success for stream 0x10003, stream type=3
11-13 23:20:36.720   566  5011 I mm-camera: < INFO> 4146: mct_pipeline_process_set: command=8000008
11-13 23:20:36.720   566  5011 I mm-camera: < INFO> 4285: mct_pipeline_process_set:  STREAM-ON on stream 0x10004 stream type=11
11-13 23:20:36.720   566  5011 I mm-camera: < INFO> 4088: sensor_get_resolution_info: sensor info: name: s5k4h8, res: 0, max_fps: 15.000000, w: 3264, h: 2448 op pix clk: 128400000, FLL: 2498, LLPCK: 3744, mode: 1, PDAF support: 0
11-13 23:20:36.720   566  5027 I mm-camera: < INFO> 2614: aec_set_param: SHDR LIMITS:0 0 (0 0) (0 0)
11-13 23:20:36.720   566  5011 E mm-camera: 3456: af_port_handle_sensor_update: Depth_Err: actuator sensitivity: 0.000000 is invalid
11-13 23:20:36.721   566  5011 I mm-camera: < INFO> 2388: cpp_module_handle_stream_cfg_event: frame_offset=3, input_fps=15.00, identity=0x1000f
11-13 23:20:36.721   566  5011 I mm-camera: < INFO> 2388: cpp_module_handle_stream_cfg_event: frame_offset=3, input_fps=15.00, identity=0x10002
11-13 23:20:36.721   566  5011 E mm-camera: 7785: module_sensor_set_decode_format_based_on_pack_mode: Pack mode is 0
11-13 23:20:36.721   566  5011 I mm-camera: < INFO> 1748: iface_streamon_to_thread: iface_streamon_to_thread: E, session id = 1, user stream id = 4
11-13 23:20:36.721   566  5011 E mm-camera: 281: module_linearization40_update_sudmod_enable: failed !! linearization40_update_base_tables
11-13 23:20:36.722   566  5022 I mm-camera: < INFO> 2095: iface_streamon: E, session_id 1 mct_stream_id = 4
11-13 23:20:36.722   566  5022 I mm-camera: < INFO> 12100: iface_util_get_user_streams_by_bundle: streamon, got all bundled streamon!
11-13 23:20:36.723   566  5029 I mm-camera: < INFO> 90: rs_stats44_stats_config_update: warning: max_support_h_rgn invalid 8
11-13 23:20:36.729   566  5011 I mm-camera: < INFO> 451: be_stats44_trigger_update: warning: Denomitor is zero hnum 0 vnum 0
11-13 23:20:36.730   566  5011 I mm-camera: < INFO> 539: isp_pipeline42_create_module_cfg_mask: invalid module id 42
11-13 23:20:36.730   566  5011 I mm-camera: < INFO> 539: isp_pipeline42_create_module_cfg_mask: invalid module id 43
11-13 23:20:36.730   566  5011 E mm-camera: 281: module_linearization40_update_sudmod_enable: failed !! linearization40_update_base_tables
11-13 23:20:36.735   566  5022 I mm-camera: < INFO> 2386: iface_streamon: X
11-13 23:20:36.735   566  5011 I mm-camera: < INFO> 1777: iface_streamon_to_thread: iface_streamon_to_thread: X, session id = 1, user stream id = 4
11-13 23:20:36.736   566  5011 I mm-camera: < INFO> 156: start_sof_check_thread: Starting SOF timeout thread session id =1//timer有开起来,不会提示timer没初始化
11-13 23:20:36.737   566  5011 I mm-camera: < INFO> 4300: mct_pipeline_process_set:  STREAM-ON success for stream 0x10004, stream type=11
11-13 23:20:36.758   566  5052 I mm-camera: < INFO> 1403: isp_handler_module_handle_reg_update:  Warning! Invalid reg_update state 0
11-13 23:20:36.765   566  5028 E mm-camera: 1298: port_sensor_handle_upstream_module_event: failed
11-13 23:20:36.765   566  5028 E mm-camera: 1622: port_sensor_port_process_event: failed: port_sensor_handle_upstream_module_event
11-13 23:20:36.765   566  5028 E mm-camera: 1451: isp_util_forward_event: failed: mct_port_send_event_to_peer event->type 2
11-13 23:20:37.025   566  5020 I mm-camera: < INFO> 371: cpp_hardware_set_clock: Set clock 100000000 BW avg 78732000 BW inst 78732000
11-13 23:20:37.026   566  5018 I mm-camera: < INFO> 451: be_stats44_trigger_update: warning: Denomitor is zero hnum 0 vnum 0

查找out目录下有没有效果文件:vendor/qcom/proprietary/common/config/device-vendor.mk
MM_CAMERA += libchromatix_s5k3l8_f13s10m_common
MM_CAMERA += libchromatix_s5k3l8_f13s10m_cpp_hfr_120
MM_CAMERA += libchromatix_s5k3l8_f13s10m_cpp_hfr_60
MM_CAMERA += libchromatix_s5k3l8_f13s10m_cpp_hfr_90
MM_CAMERA += libchromatix_s5k3l8_f13s10m_cpp_liveshot
MM_CAMERA += libchromatix_s5k3l8_f13s10m_cpp_preview
MM_CAMERA += libchromatix_s5k3l8_f13s10m_cpp_snapshot
MM_CAMERA += libchromatix_s5k3l8_f13s10m_cpp_video
MM_CAMERA += libchromatix_s5k3l8_f13s10m_default_preview_dw9767
MM_CAMERA += libchromatix_s5k3l8_f13s10m_default_video_dw9767
MM_CAMERA += libchromatix_s5k3l8_f13s10m_default_video
MM_CAMERA += libchromatix_s5k3l8_f13s10m_hfr_120_dw9767
MM_CAMERA += libchromatix_s5k3l8_f13s10m_hfr_120
MM_CAMERA += libchromatix_s5k3l8_f13s10m_hfr_60_dw9767
MM_CAMERA += libchromatix_s5k3l8_f13s10m_hfr_60
MM_CAMERA += libchromatix_s5k3l8_f13s10m_hfr_90_dw9767
MM_CAMERA += libchromatix_s5k3l8_f13s10m_hfr_90
MM_CAMERA += libchromatix_s5k3l8_f13s10m_liveshot
MM_CAMERA += libchromatix_s5k3l8_f13s10m_postproc
MM_CAMERA += libchromatix_s5k3l8_f13s10m_preview
MM_CAMERA += libchromatix_s5k3l8_f13s10m_snapshot
MM_CAMERA += libchromatix_s5k3l8_f13s10m_zsl_preview_dw9767
MM_CAMERA += libchromatix_s5k3l8_f13s10m_zsl_video_dw9767

如果直接拷贝0309版本的效果文件到0310,编译报错,跑不起来,所以拷贝0310版本的chromatix_s5k3l8的效果头文件给chromatix_s5k4h8和chromatix_s5k3l8_f13s10m,
至少能跑起来,能够点亮。

找到以下文件,说明效果文件已经生成了。
out/target/product/msm8953/vendor/lib/libchromatix_s5k3l8_f13s10m_cpp_video.so
out/target/product/msm8953/vendor/lib/libchromatix_s5k3l8_f13s10m_snapshot.so
out/target/product/msm8953/vendor/lib/libchromatix_s5k3l8_f13s10m_cpp_snapshot.so
out/target/product/msm8953/vendor/lib/libchromatix_s5k3l8_f13s10m_common.so
out/target/product/msm8953/vendor/lib/libchromatix_s5k3l8_f13s10m_default_video_dw9767.so
out/target/product/msm8953/vendor/lib/libchromatix_s5k3l8_f13s10m_zsl_video_dw9767.so
out/target/product/msm8953/vendor/lib/libchromatix_s5k3l8_f13s10m_cpp_liveshot.so
out/target/product/msm8953/vendor/lib/libchromatix_s5k3l8_f13s10m_cpp_hfr_60.so
out/target/product/msm8953/vendor/lib/libchromatix_s5k3l8_f13s10m_cpp_preview.so
out/target/product/msm8953/vendor/lib/libchromatix_s5k3l8_f13s10m_preview.so
out/target/product/msm8953/vendor/lib/libchromatix_s5k3l8_f13s10m_hfr_60.so
out/target/product/msm8953/vendor/lib/libchromatix_s5k3l8_f13s10m_postproc.so
out/target/product/msm8953/vendor/lib/libchromatix_s5k3l8_f13s10m_cpp_hfr_120.so
out/target/product/msm8953/vendor/lib/libchromatix_s5k3l8_f13s10m_default_video.so
out/target/product/msm8953/vendor/lib/libchromatix_s5k3l8_f13s10m_zsl_preview_dw9767.so
out/target/product/msm8953/vendor/lib/libchromatix_s5k3l8_f13s10m_cpp_hfr_90.so
out/target/product/msm8953/vendor/lib/libchromatix_s5k3l8_f13s10m_hfr_60_dw9767.so
out/target/product/msm8953/vendor/lib/libchromatix_s5k3l8_f13s10m_hfr_90_dw9767.so
out/target/product/msm8953/vendor/lib/libchromatix_s5k3l8_f13s10m_hfr_90.so
out/target/product/msm8953/vendor/lib/libchromatix_s5k3l8_f13s10m_hfr_120.so
out/target/product/msm8953/vendor/lib/libchromatix_s5k3l8_f13s10m_hfr_120_dw9767.so
out/target/product/msm8953/vendor/lib/libchromatix_s5k3l8_f13s10m_default_preview_dw9767.so

移植完s5k3l8后出现以下错误:
11-14 07:24:37.107   562  4173 E mm-camera: 644: actuator_load_lib: failed NULL pointer detected: af_actuator_ptr->driver_lib_handle : dlopen() failed to load libactuator_dw9767.so
11-14 07:24:37.107   562  4173 E mm-camera: 700: af_actuator_init: actuator_load_lib failed so loading binary
11-14 07:24:37.107   562  4173 E mm-camera: 552: actuator_load_bin: failed NULL pointer detected: fp : fopen /data/vendor/camera/actuator_dw9767.bin failed
11-14 07:24:37.107   562  4173 E mm-camera: 703: af_actuator_init: actuator_load_bin failed: rc = -22
11-14 07:24:37.107   562  4173 E mm-camera: 1084: actuator_process: failed rc -22
11-14 07:24:37.107   562  4173 E mm-camera: 1125: module_sensor_actuator_init_calibrate: sensor_failure : ACTUATOR_INIT failed
11-14 07:24:37.107   562  4173 E mm-camera: 259: module_sensor_offload_init_config: module_sensor_actuator_init_calibrate failed
11-14 07:24:37.107   562  4173 E mm-camera: 315: module_sensor_offload_init_config: failed
11-14 07:24:37.191   562   770 E mm-camera: 297: AllocateBuffers: Invalid dimensions 0x0
11-14 07:24:37.191   562  4170 I mm-camera: < INFO> 7159: isp_util_print_meta_stream_info: Deallocate resources
11-14 07:24:37.191   562   770 E mm-camera: 197: img_algo_preload: Preload: Failed to allocate buffer, rc -4

加载马达制动器失败!有空指针!
发现out目录下没有找到libactuator_dw9767.so库文件

发现eeprom和actuator都没有加入模块编译
需要在vendor/qcom/proprietary/common/config/device-vendor.mk增加以下两个
MM_CAMERA += libactuator_dw9767
MM_CAMERA += libmmcamera_dw9767_eeprom

加了之后就有了:
out/target/product/msm8953/vendor/lib/libactuator_dw9767.so
out/target/product/msm8953/vendor/lib/libmmcamera_dw9767_eeprom.so

但是要去掉dw9767_eeprom_format_pdafgain,编译会报错,提示pdaf_2D_calibration_param_t没找到,所以版本不一样,把这个函数和他的调用去掉就可以编译过并且能够点亮.
去掉PDAF,PDAF版本不一样,打开会挂。

============================================================================================================================================================
关于Camera OTP/EEPROM调查报告:
一、为什么需要校准?
摄像头模块本身存在生产差异以及各种公差,即使在相同的外部环境下使用,摄像头模块的响应也有所不同。因为摄像头颜色调试无法在生产的所有摄像头模块中执行(可能是太繁琐和麻烦吧?),所以选择标准模块 (GM) 和极限模块调试并验证图像质量。图像质量调试利用 GM 完成,调试参数根据编程写入各摄像机模块 EEPROM/OTP ROM中的校准数据加以调整,根据校准数据补偿模块偏差。
二、模组厂商怎么烧录EEPROM/OTP校准数据
1)OTP烧录流程
置入摄像头模块的 EEPROM/OTP ROM要根据高通的参考步骤和做法来,模组厂家(比如盛泰)流程也是和高通文档描述一致,他们也有参照的文档(只是可能版本不同而已),厂商使用的校准工具是自己写的工具,vs做的,已经集成了高通的校准工具源代码,假如需要烧录平台的LSC或PDAF就需要用到平台的测试软件,LSC需要将raw data导入到高通的测试软件,自动生成一套setting,将这套setting存储到EEPROM相应的位置。AWB和AF就和平台无关,因为高通生成的AWB和模组厂商自己的AWB算法算出来一样,所以模组厂商一般用自己的算法算AWB,厂商一般烧录一个色温,D50光源的。LSC分成17*13个block,每个block 4个通道10bit,total=17*13*4*2=1768,另外文档没有提到的PDAF数据分成两块数据,分别是gainmap(用来矫正pd点亮度的数据,调用PDAF_Cal_get_gainmap()函数产生数据,写入相应的寄存器)和DCC(pd线性数据,通过高通提供的Dll工具的得到),大小分别是442*2和96,msm8953的供应商合力泰S5K3L8 Programming Guide for Qualcomm_Version1.0.pdf就指出PDAF版本是基于高通L4版本进行平台校准,包含了GainMap校准和DCC校准,到时候厂商会提供一份OTP programming guide给我们,详细描述OTP烧录的内容以及读取方法以及示例代码等等。
2)OTP格式要求
参照文档80-n5126-1sc_m_presentation__2d_camera_module_calibration.pdf 14页的介绍,
EEPROM/OTP ROM 中的格式和内存映射示例如下:
-----------------------------------
项目 数据内容 大小(字节)
厂商代码 厂商 ID 1
版本 校准工具版本 1
校准数据 校准数据 3
模块信息 模块 ID 1 2
模块信息 模块 ID 2 2
-----------------------------------
AWB 校准数据
-----------------------------------
AF 校准数据
----------------------------------
LSC 数据
---------------------------------
总校验和 校验和 2
总大小    5349
------------------------------
等等包含模组基本信息,以及不同光源不同场景下的AWB 校准数据,AF 校准数据,LSC(镜头阴影校准 (Lens Shading Calibration)) 数据,模组厂商存储校准数据到摄像机模块的ROM。每个厂商的寄存器地址和内容可能大同小异,具体差异参照厂商提供的OTP programming guide。

三、校准流程
1)平台校准流程
校准的时候,以AWB校准为例,流程是这样的:
1.读取 EEPROM/OTP ROM 中的校准数据
2.读取 ChromatixTM 头文件中的 GM 校准数据
3.计算 R/Gr、B/Gr 和 Gb/Gr 的校准调整系数(计算 TM/GM 之比)
4.将校准系数应用于具体的调校当中

AWB校准流程的代码参考:
eeprom需要填充的接口:
static eeprom_lib_func_t dw9767_eeprom_lib_func_ptr = {
  .get_calibration_items   = dw9767_eeprom_get_calibration_items,//get_calibration_items 和OTP的存储方式有关,用于指定EEPROM的校准项目哪个是有用的
  .format_calibration_data = dw9767_eeprom_format_calibration_data,//format_calibration_data 和OTP的格式有关,与具体使用的OTP/EEPROM关联性强,包含了awb,af,lsc,pdaf的数据结构的生成。
  .do_af_calibration  = eeprom_autofocus_calibration,//common的部分,只要在get和format两步拿到合适的数据并整理好格式就可以直接使用。
  .do_wbc_calibration = eeprom_whitebalance_calibration,//common的部分,只要在get和format两步拿到合适的数据并整理好格式就可以直接使用。
  .do_lsc_calibration = eeprom_lensshading_calibration,//common的部分,只要在get和format两步拿到合适的数据并整理好格式就可以直接使用。
  ...
}

vendor/qcom/proprietary/mm-camera/mm-camera2/media-controller/modules/sensors/eeprom/libs/eeprom_util/eeprom_util.c的
void eeprom_whitebalance_calibration(void *e_ctrl)//白平衡校准函数
int eeprom_autofocus_calibration(void *e_ctrl) //自动对焦校准函数
void eeprom_lensshading_calibration(void *e_ctrl)//镜头阴影校准函数

vendor/qcom/proprietary/mm-camera/mm-camera2/media-controller/modules/sensors/eeprom/libs/dw9767/dw9767_eeprom.c//msm8953后摄外挂EEPROM
void dw9767_eeprom_format_calibration_data(void *e_ctrl)
{
  sensor_eeprom_data_t * ctrl = (sensor_eeprom_data_t *)e_ctrl;

  SDBG("Enter");
  RETURN_VOID_ON_NULL(ctrl);
  SLOW("Total bytes in OTP buffer: %d", ctrl->eeprom_params.num_bytes);

  if (!ctrl->eeprom_params.buffer || !ctrl->eeprom_params.num_bytes) {
    SERR("failed: Buff pointer %p buffer size %d", ctrl->eeprom_params.buffer,
      ctrl->eeprom_params.num_bytes);
    return;
  }

  dw9767_eeprom_format_wbdata(ctrl);//格式化白平衡数据
  dw9767_eeprom_format_lensshading(ctrl);//生成AF校准数据结构
  dw9767_eeprom_format_afdata(ctrl);//生成LSC校准数据结构
  //dw9767_eeprom_format_pdafgain(ctrl);//生成PDAF校准数据结构,因为版本匹配问题被暂时注释掉了

  SDBG("dw9767_eeprom_format_calibration_data Exit");
}

以生成AWB的校准数据为例子:dw9767_eeprom_format_wbdata(ctrl);//格式化白平衡数据
输入参数:
OTP得来的(不同色温)R/G, B/G;
Golden module 的 (不同色温)R/G, B/G (来自Chromatix头文件)
AWB reference point,和MWB gains (来自Chromatix与头文件)
Green balance gains (来自Chromatix与头文件)
处理流程:
用OTP R/G,B/G数据比Golden module R/G, B/G, 从而得到特定模组和Golden
模组的差异,进而修正相关参数(这里关注点在于Reference point 和MWB gain).
输出结果:
修正后的AWB reference point,和MWB gains (AWB算法会进行使用)
修正后的Green balance gains (VFE使用)

2)关于效果文件
效果文件的内容是通过chromatix软件生成的,因为版本不同内容也不同,0310比0309多了一项内容:float ext_data[EXT_CPP_ENTRIES];
具体效果文件的内容格式可以参看:
sdm632_android/vendor/qcom/proprietary/mm-camerasdk/sensor/includes/0310/chromatix_cpp.h
sdm632_android/vendor/qcom/proprietary/mm-camerasdk/sensor/includes/0309/chromatix_cpp.h
typedef struct
{
    //=========================================================================
    // Chromatix header version info (MUST BE THE FIRST PARAMETER)
    //=========================================================================
    ChromatixVersionInfoType                chromatix_version_info;

    //=========================================================================
    // 7x7 ASF
    //=========================================================================
    chromatix_ASF_7x7_type                  chromatix_ASF_7x7;

    //=========================================================================
    // 9x9 ASF
    //=========================================================================
    chromatix_ASF_9x9_type                  chromatix_ASF_9x9;

    Chromatix_HDR_ASF_adj_type              chromatix_hdr_asf_adj_data;
    //=========================================================================
    // wavelet Denoise for 8974,8084,8994,8916,8936,8992
    //=========================================================================
    // 0x0304 Header
    chromatix_wavelet_type                  chromatix_wavelet;

    //=========================================================================
    // wavelet Denoise for 8996 & 8993
    //=========================================================================
    // 305 Header
    Chromatix_hardware_wavelet_type         chromatix_hw_denoise_data;

    Chromatix_HDR_WNR_adj_type              chromatix_hdr_wnr_adj_data;
    Chromatix_ADRC_WNR_adj_type             chromatix_adrc_wnr_adj_data;

    //=========================================================================
    // HW temporal denoise
    //=========================================================================
    chromatixWNRDenoise_type                chromatix_temporal_denoise; //0x304

    //=========================================================================
    // Pre Scaler Bilateral Filter ( PBF )
    //=========================================================================
    Chromatix_prescaler_bf_type             chromatix_pbf_data;

    //=========================================================================
    // CPP Output Clamp
    //=========================================================================
    Chromatix_cpp_clamp_type                chromatix_clamp_data; // Y,Cb,Cr

    //=========================================================================
    // VDP temporal denoise
    //=========================================================================
    chromatix_VDP_temporal_denoise_type     chromatix_VDP_temporal_denoise;  //0x303

    float                                   up_scale_threshold;
    float                                   down_scale_threshold;
    Chromatix_hardware_wavelet_type         chromatix_hw_denoise_data_lpm;

    // 0x310 Updates
    float                                   ext_data[EXT_CPP_ENTRIES];
} chromatix_cpp_type;

chromatix工具生成的头文件也就是按照这个格式来填充的。

四.Camera相关的代码结构和相关基础知识
1)显示调用和非显示调用区别
a.hal层
硬件抽象层HAL(初始化,第三方等没有显示调用的时候生效),代码位置如下:
    hardware/qcom/camera/QCamera2/HAL/QCameraParameters.cpp
b.SnapdragonCamera应用
我们的源代码应用SnapdragonCamera(显示调用生效),代码位置如下:
    packages/apps/SnapdragonCamera/

2)Camera方向
Camera的方向关系到成像的方向,不仅仅是camera 应用,很多用到摄像头的应用都会应用得到,如QQ,微信,易信等等;也许你设置成270,camera应用预览方向是对了,但是别的应用就不一定了,所以必须按照规则设置。
规则如下:
后摄:.sensor_mount_angle = 90
前摄:.sensor_mount_angle = 270

3)
camera 设备由下边几部分构成:
a) lens(镜头) 一般 camera 的镜头结构是有几片透镜组成,分有塑胶透镜(Plastic)和玻璃透 镜(Glass) ,通常镜头结构有:1P,2P,1G1P,1G3P,2G2P,4G 等。
b) sensor(图像传感器) Senor 是一种半导体芯片,有两种类型:CCD 和 CMOS。Sensor 将从 lens 上传导过来的光线转换为电信号, 再通过内部的 AD 转换为数字信号。 由于 Sensor 的每个 pixel 只能感光 R 光或者 B 光或者 G 光, 因此每个像素此时存贮的是单色的, 我们称之为 RAW DATA 数据。 要想将每个像素的 RAW DATA 数据还原成三基色,就需要 ISP 来处理。
c)ISP(图像信号处理) 主要完成数字图像的处理工作,把 sensor 采集到的原始数据转换为显示支持 的格式。
d)CAMIF(camera 控制器) 芯片上的 camera 接口电路,对设备进行控制,接收 sensor 采集的数据交给 CPU,并送入 LCD 进行显示。

如果集成 了 DSP, RAW DATA 数据经过 AWB、 则 color matrix、 lens shading、 gamma、 sharpness、 AE 和 de-noise 处理,后输出 YUV 或者 RGB 格式的数据。
最后会由 CPU 送到 framebuffer 中进行显示,这样我们就看到 camera 拍摄到的景象了。在 YUV 家族中, YCbCr 是在计算机系统中应用最多的成员, 其应用领域很广泛,JPEG、 MPEG均采用此格式。 一般人们所讲的 YUV 大多是指 YCbCr

五、Camera 驱动 
V4L2.
1)简介:在 Linux 中,摄像头方面的标准化程度比较高,这个标准就是 V4L2 驱动程序,这也是业界比较公认的方式.V4L全称是 Video for Linux,是 Linux 内核中标准的关于视频设备的驱动程序,目前使用比较多的版本是 Video for Linux 2, 简称 V4L2。 它为 Linux 下的视频驱动提供了统一的接口, 使得应用程序可以使用统一的 API 操作不同的视频设备。从内核空间到用户空间,主要的数据流和控制类均由 V4L2 驱动程序的框架来定义。 V4L2 驱动程序一般只提供 Video 数据的获得,而如何实现视频预览,如何向上层发送数据,如何把纯视频流和取景器、视频录制等实际业务组织起来,都是 camera 的硬件抽象层需要负责的工作。V4L2 驱动核心实现为如下文件:kernel/msm-4.9/drivers/media/v4l2-core/v4l2-dev.c。 
kernel/msm-4.9/include/media/v4l2-dev.h 中定义的 video_device 是 V4L2 驱动程序的核心数据结构,它为具体的摄像头 sensor 驱动提供了接口调用。在Linux中,视频设备是设备文件,可以像访问普通文件一样对其进行读写,摄像头在/dev/video0下。 V4l2 的采集过程(应用程序):
1. 打开设备文件。 int fd=open(”/dev/video0″,O_RDWR);
2. 取得设备的capability,看看设备具有什么功能,比如是否具有视频输入,或者音频输入输出等。VIDIOC_QUERYCAP,struct v4l2_capability
3. 选择视频输入,一个视频设备可以有多个视频输入。VIDIOC_S_INPUT,struct v4l2_input
4. 设置视频的制式和帧格式,制式包括PAL,NTSC,帧的格式个包括宽度和高度等。
VIDIOC_S_STD,VIDIOC_S_FMT,struct v4l2_std_id,struct v4l2_format
5. 向驱动申请帧缓冲,一般不超过5个。struct v4l2_requestbuffers
6. 将申请到的帧缓冲映射到用户空间,这样就可以直接操作采集到的帧了,而不必去复制。mmap
7. 将申请到的帧缓冲全部入队列,以便存放采集到的数据.VIDIOC_QBUF,struct v4l2_buffer
8. 开始视频的采集。VIDIOC_STREAMON
9. 出队列以取得已采集数据的帧缓冲,取得原始采集数据。VIDIOC_DQBUF
10. 将缓冲重新入队列尾,这样可以循环采集。VIDIOC_QBUF
11. 停止视频的采集。VIDIOC_STREAMOFF
12. 关闭视频设备。close(fd);

2)数据结构
V4L2 的主要数据结构是 video_device,定义在 v4l2_dev.h 中: 
/*
 * Newer version of video_device, handled by videodev2.c
 *     This version moves redundant code from video device code to
 *    the common handler
 */

/**
 * struct video_device - Structure used to create and manage the V4L2 device
 *    nodes.
 *
 * @entity: &struct media_entity
 * @intf_devnode: pointer to &struct media_intf_devnode
 * @pipe: &struct media_pipeline
 * @fops: pointer to &struct v4l2_file_operations for the video device
 * @device_caps: device capabilities as used in v4l2_capabilities
 * @dev: &struct device for the video device
 * @cdev: character device
 * @v4l2_dev: pointer to &struct v4l2_device parent
 * @dev_parent: pointer to &struct device parent
 * @ctrl_handler: Control handler associated with this device node.
 *     May be NULL.
 * @queue: &struct vb2_queue associated with this device node. May be NULL.
 * @prio: pointer to &struct v4l2_prio_state with device's Priority state.
 *     If NULL, then v4l2_dev->prio will be used.
 * @name: video device name
 * @vfl_type: V4L device type
 * @vfl_dir: V4L receiver, transmitter or m2m
 * @minor: device node 'minor'. It is set to -1 if the registration failed
 * @num: number of the video device node
 * @flags: video device flags. Use bitops to set/clear/test flags
 * @index: attribute to differentiate multiple indices on one physical device
 * @fh_lock: Lock for all v4l2_fhs
 * @fh_list: List of &struct v4l2_fh
 * @dev_debug: Internal device debug flags, not for use by drivers
 * @tvnorms: Supported tv norms
 *
 * @release: video device release() callback
 * @ioctl_ops: pointer to &struct v4l2_ioctl_ops with ioctl callbacks
 *
 * @valid_ioctls: bitmap with the valid ioctls for this device
 * @disable_locking: bitmap with the ioctls that don't require locking
 * @lock: pointer to &struct mutex serialization lock
 *
 * .. note::
 *    Only set @dev_parent if that can't be deduced from @v4l2_dev.
 */

struct video_device
{
#if defined(CONFIG_MEDIA_CONTROLLER)
    struct media_entity entity;
    struct media_intf_devnode *intf_devnode;
    struct media_pipeline pipe;
#endif
    const struct v4l2_file_operations *fops; /*接口函数指针*/

    u32 device_caps;

    /* sysfs */
    struct device dev;/* v4l 设备结构 */ 
    struct cdev *cdev;/* 字符设备结构*/

    struct v4l2_device *v4l2_dev;/* v4l2 设备指针*/
    struct device *dev_parent;/* 设备父指针 */ 

    struct v4l2_ctrl_handler *ctrl_handler;

    struct vb2_queue *queue;

    struct v4l2_prio_state *prio;

    /* device info */
    char name[32];/*设备名称*/
    int vfl_type;
    int vfl_dir;
    int minor;
    u16 num;
    unsigned long flags;
    int index;

    /* V4L2 file handles */
    spinlock_t        fh_lock;
    struct list_head    fh_list;

    int dev_debug;/* debug 级别*/

    v4l2_std_id tvnorms;

    /* callbacks */
    void (*release)(struct video_device *vdev);
    const struct v4l2_ioctl_ops *ioctl_ops;/* ioctl 回调函数 */ 
    DECLARE_BITMAP(valid_ioctls, BASE_VIDIOC_PRIVATE);

    DECLARE_BITMAP(disable_locking, BASE_VIDIOC_PRIVATE);
    struct mutex *lock;
};
其他常用的结构体:
struct v4l2_requestbuffers reqbufs;//向驱动申请帧缓冲的请求,里面包含申请的个数
struct v4l2_capability cap;//这个设备的功能,比如是否是视频输入设备
struct v4l2_input input; //视频输入
struct v4l2_standard std;//视频的制式,比如PAL,NTSC
struct v4l2_format fmt;//帧的格式,比如宽度,高度等

struct v4l2_buffer buf;//代表驱动中的一帧
v4l2_std_id stdid;//视频制式,例如:V4L2_STD_PAL_B
struct v4l2_queryctrl query;//查询的控制
struct v4l2_control control;//具体控制的值

确认配置 menuconfig
在 qcom 平台上,已经弱化了 menuconfig,但是有的也需要配置下,如各种传感器等等。对
于 camera 部分,主要检查以下配置既可:
CONFIG_MEDIA_CAMERA_SUPPORT=y 有
CONFIG_MEDIA_RADIO_SUPPORT=y //无该配置
CONFIG_MEDIA_CONTROLLER=y 有
CONFIG_VIDEO_V4L2_SUBDEV_API=y 有
CONFIG_VIDEOBUF2_MSM_MEM=y //无该配置
CONFIG_V4L_PLATFORM_DRIVERS=y 有
CONFIG_MSMB_CAMERA=y 有

camera在kernel层的主文件为msm.c,负责设备的具体注册及相关方法的填充;在msm_sensor.c文件中,主要维护高通自己的一个sensor相关结构体—msm_sensor_ctrl_t,同时把dts文件中的配置信息读取出来;
struct msm_sensor_ctrl_t {
    struct platform_device *pdev;
    struct mutex *msm_sensor_mutex;

    enum msm_camera_device_type_t sensor_device_type;
    struct msm_camera_sensor_board_info *sensordata;
    struct msm_sensor_power_setting_array power_setting_array;
    struct msm_sensor_packed_cfg_t *cfg_override;
    struct msm_sd_subdev msm_sd;
    enum cci_i2c_master_t cci_i2c_master;

    struct msm_camera_i2c_client *sensor_i2c_client;
    struct v4l2_subdev_info *sensor_v4l2_subdev_info;
    uint8_t sensor_v4l2_subdev_info_size;
    struct v4l2_subdev_ops *sensor_v4l2_subdev_ops;
    struct msm_sensor_fn_t *func_tbl;
    struct msm_camera_i2c_reg_setting stop_setting;
    void *misc_regulator;
    enum msm_sensor_state_t sensor_state;
    uint8_t is_probe_succeed;
    uint32_t id;
    struct device_node *of_node;
    enum msm_camera_stream_type_t camera_stream_type;
    uint32_t set_mclk_23880000;
    uint8_t is_csid_tg_mode;
    uint32_t is_secure;
    uint8_t bypass_video_node_creation;
};

网上的具体流程:
打开视频设备

在V4L2中,视频设备被看做一个文件。使用open函数打开这个设备:

// 用非阻塞模式打开摄像头设备

int cameraFd;

cameraFd = open(“/dev/video0″, O_RDWR | O_NONBLOCK, 0);

// 如果用阻塞模式打开摄像头设备,上述代码变为:

//cameraFd = open(”/dev/video0″, O_RDWR, 0);

关于阻塞模式和非阻塞模式

应用程序能够使用阻塞模式或非阻塞模式打开视频设备,如果使用非阻塞模式调用视频设备,即使尚未捕获到信息,驱动依旧会把缓存(DQBUFF)里的东西返回给应用程序。

设定属性及采集方式

打开视频设备后,可以设置该视频设备的属性,例如裁剪、缩放等。这一步是可选的。在Linux编程中,一般使用ioctl函数来对设备的I/O通道进行管理:

extern int ioctl (int __fd, unsigned long int __request, …) __THROW;

__fd:设备的ID,例如刚才用open函数打开视频通道后返回的cameraFd;

__request:具体的命令标志符。

在进行V4L2开发中,一般会用到以下的命令标志符:

    VIDIOC_REQBUFS:分配内存
    VIDIOC_QUERYBUF:把VIDIOC_REQBUFS中分配的数据缓存转换成物理地址
    VIDIOC_QUERYCAP:查询驱动功能
    VIDIOC_ENUM_FMT:获取当前驱动支持的视频格式
    VIDIOC_S_FMT:设置当前驱动的频捕获格式
    VIDIOC_G_FMT:读取当前驱动的频捕获格式
    VIDIOC_TRY_FMT:验证当前驱动的显示格式
    VIDIOC_CROPCAP:查询驱动的修剪能力
    VIDIOC_S_CROP:设置视频信号的边框
    VIDIOC_G_CROP:读取视频信号的边框
    VIDIOC_QBUF:把数据从缓存中读取出来
    VIDIOC_DQBUF:把数据放回缓存队列
    VIDIOC_STREAMON:开始视频显示函数
    VIDIOC_STREAMOFF:结束视频显示函数
    VIDIOC_QUERYSTD:检查当前视频设备支持的标准,例如PAL或NTSC。

这些IO调用,有些是必须的,有些是可选择的。

检查当前视频设备支持的标准

在亚洲,一般使用PAL(720X576)制式的摄像头,而欧洲一般使用NTSC(720X480),使用VIDIOC_QUERYSTD来检测:

v4l2_std_id std;

do {

ret = ioctl(fd, VIDIOC_QUERYSTD, &std);

} while (ret == -1 && errno == EAGAIN);

switch (std) {

case V4L2_STD_NTSC:

//……

case V4L2_STD_PAL:

//……

}

设置视频捕获格式

当检测完视频设备支持的标准后,还需要设定视频捕获格式:

struct v4l2_format    fmt;

memset ( &fmt, 0, sizeof(fmt) );

fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;

fmt.fmt.pix.width = 720;

fmt.fmt.pix.height = 576;

fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV;

fmt.fmt.pix.field = V4L2_FIELD_INTERLACED;

if (ioctl(fd, VIDIOC_S_FMT, &fmt) == -1) {

return -1;

}

v4l2_format结构体定义如下:

struct v4l2_format

{

enum v4l2_buf_type type;    // 数据流类型,必须永远是//V4L2_BUF_TYPE_VIDEO_CAPTURE

union

{

struct v4l2_pix_format    pix;

struct v4l2_window        win;

struct v4l2_vbi_format    vbi;

__u8    raw_data[200];

} fmt;

};

struct v4l2_pix_format

{

__u32                   width;         // 宽,必须是16的倍数

__u32                   height;        // 高,必须是16的倍数

__u32                   pixelformat;   // 视频数据存储类型,例如是//YUV4:2:2还是RGB

enum v4l2_field         field;

__u32                   bytesperline;

__u32                   sizeimage;

enum v4l2_colorspace    colorspace;

__u32                   priv;

};

分配内存

接下来可以为视频捕获分配内存:

struct v4l2_requestbuffers  req;

if (ioctl(fd, VIDIOC_REQBUFS, &req) == -1) {

return -1;

}

v4l2_requestbuffers定义如下:

struct v4l2_requestbuffers

{

__u32               count;  // 缓存数量,也就是说在缓存队列里保持多少张照片

enum v4l2_buf_type  type;   // 数据流类型,必须永远是V4L2_BUF_TYPE_VIDEO_CAPTURE

enum v4l2_memory    memory; // V4L2_MEMORY_MMAP 或V4L2_MEMORY_USERPTR

__u32               reserved[2];

};

获取并记录缓存的物理空间

使用VIDIOC_REQBUFS,我们获取了req.count个缓存,下一步通过调用VIDIOC_QUERYBUF命令来获取这些缓存的地址,然后使用mmap函数转换成应用程序中的绝对地址,最后把这段缓存放入缓存队列:

typedef struct VideoBuffer {

void *start;

size_t  length;

} VideoBuffer;

VideoBuffer*          buffers = calloc( req.count, sizeof(*buffers) );

struct v4l2_buffer    buf;

for (numBufs = 0; numBufs < req.count; numBufs++) {

memset( &buf, 0, sizeof(buf) );

buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;

buf.memory = V4L2_MEMORY_MMAP;

buf.index = numBufs;

// 读取缓存

if (ioctl(fd, VIDIOC_QUERYBUF, &buf) == -1) {

return -1;

}

buffers[numBufs].length = buf.length;

// 转换成相对地址

buffers[numBufs].start = mmap(NULL, buf.length,

PROT_READ | PROT_WRITE,

MAP_SHARED,

fd, buf.m.offset);

if (buffers[numBufs].start == MAP_FAILED) {

return -1;

}

// 放入缓存队列

if (ioctl(fd, VIDIOC_QBUF, &buf) == -1) {

return -1;

}

}

关于视频采集方式

操作系统一般把系统使用的内存划分成用户空间和内核空间,分别由应用程序管理和操作系统管理。应用程序可以直接访问内存的地址,而内核空间存放的是 供内核访问的代码和数据,用户不能直接访问。v4l2捕获的数据,最初是存放在内核空间的,这意味着用户不能直接访问该段内存,必须通过某些手段来转换地 址。

一共有三种视频采集方式:使用read、write方式;内存映射方式和用户指针模式。

read、write方式:在用户空间和内核空间不断拷贝数据,占用了大量用户内存空间,效率不高。

内存映射方式:把设备里的内存映射到应用程序中的内存控件,直接处理设备内存,这是一种有效的方式。上面的mmap函数就是使用这种方式。

用户指针模式:内存片段由应用程序自己分配。这点需要在v4l2_requestbuffers里将memory字段设置成V4L2_MEMORY_USERPTR。

处理采集数据

V4L2有一个数据缓存,存放req.count数量的缓存数据。数据缓存采用FIFO的方式,当应用程序调用缓存数据时,缓存队列将最先采集到的 视频数据缓存送出,并重新采集一张视频数据。这个过程需要用到两个ioctl命令,VIDIOC_DQBUF和VIDIOC_QBUF:

struct v4l2_buffer buf;

memset(&buf,0,sizeof(buf));

buf.type=V4L2_BUF_TYPE_VIDEO_CAPTURE;

buf.memory=V4L2_MEMORY_MMAP;

buf.index=0;

//读取缓存

if (ioctl(cameraFd, VIDIOC_DQBUF, &buf) == -1)

{

return -1;

}

//…………视频处理算法

//重新放入缓存队列

if (ioctl(cameraFd, VIDIOC_QBUF, &buf) == -1) {

return -1;

}

关闭视频设备

使用close函数关闭一个视频设备

close(cameraFd)

还需要使用munmap方法。
===========================================================================
关于PDAF(Phase Difference Auto Focus相位差自动聚焦)
VCM(Voice Coil Motor),电子学里面的音圈电机,是马达的一种。因为原理和扬声器类似,所以叫音圈电机,具有高频响、高精度的特点。其主要原理是在一个永久磁场内,通过改变马达内线圈的直流电流大小,来控制弹簧片的拉伸位置,从而带动上下运动。手机摄像头广泛的使用VCM实现自动对焦功能,通过VCM可以调节镜头的位置,呈现清晰的图像。

PDAF基本原理:
是在原本的ImageSensor中有规律的插入一些Shield pixel,他们成对出现,其功能相当于人的眼睛一样,用来感应当前VCM所处位置的相位差,通过该值来求出得到清晰图像VCM的运动方向和移动的距离。
PDAF与Contrast AF对比,它的对焦速度更加快,第一步粗调直接一步到位,之后可进行细调得到更加清晰的图像。

使用PDAF功能是需要进行模组校正(Calibration),包括SPC(shield pixel calibration)与DCC(defocus conversion coefficient散焦转换系数 )。严格意义上讲,SPC功能才是正常的校正动作,而DCC功能非校正而是生成DAC与Focus的系数关系,进而实现PDAF功能。DCC:在讨论PDAF功能的时候,大部分情况下我们都会声称通过该功能模组能够知道当前被摄物的距离。其实我们并非物理上知道被摄物的距离,而是通过左右shield pixel之间的差异来将被摄物映射到镜头移动距离中的某个位置。系统在进行对焦的时候,需要将检测到的相位差(phase difference)转换为离焦率(Defocus Value),这个转换过程应用到的表单数据称为DCC(defocus conversion coefficient)。
DCC=delta lens position[dac]/delta phase disparity[pixel]

主流Sensor的PDAF算法可以分为两类:
1)Sensor端自带PDAF算法:IMX230(MeiTu)
2)平台端支持:S5K3M2XM(MTK,Qualcomm)
两种校准算法步骤基本一致:
1).Shield Pixeld点能量值补偿,该步骤是后续的操作的前提。
2).计算马达位移量于PD值(Phase difference)之间的关系系数K=Coefficient。
3).需要考虑精准度及相应功耗

高通的PDAF校准流程分为两步:
1).GainMap校准
作用:是将L/R Shield Pixel点的能量值与周围的点补偿到一致,并且将两者的偏移设置为最小。
2).PD Conversion Coefficient Calibration
3).Verify
目的:高通的验证是在所有步骤之后,主要用来验证当前计算的斜率K值是否正确

PDAF功能模组和常规模组的差异性对比:
相同点:
1.PDAF模组与常规模组一致都需要烧录AF远近焦,AWB,Shading等常规数据。
2.制程方面与常规模组一致
不同点:
1.Sony:需要额外烧录SPC(11*8*2Byte)和DCC(不同模组烧录个数不同)
2.MTK:需要额外烧录三个校准步骤生成的数据。Proc1:4096 byte,Proc2:806 byte,Proc3:102 byte 一共生成1404 byte的数据
3.Qualcomm:除了需要烧录校准产生的Gainmap数据(131*2*2+3*2byte)和K(2byte),另外在测远近焦时需要再加上一个20cm图像清晰的马达code值。

模组工艺和产线情况:
a.产线中PDAF校准放在AWB和SHADING之后,能够保证模组的整体效果OK的情况下再去进行PDAF操作,提高模组的良率
b.PDAF校准对模组的远近焦烧录要求很高,不正确的远近焦值会造成PDAF斜率值计算错误,导致模组经过PDAF后无法到达清晰位置。

----------------------------------------
log等级:
msm8953 log开关

  typedef enum {
      SENSOR_DBG_NONE   = 0,
      SENSOR_DBG_ERR    = 1,
      SENSOR_DBG_WARN   = 2,
      SENSOR_DBG_HIGH   = 3,
      SENSOR_DBG_LOW    = 4,
      SENSOR_DBG_DEBUG  = 5,
      SENSOR_DBG_INFO   = 6,
      SENSOR_DBG_MAX
  } sensor_debug_level_t;

  typedef enum {
      CAM_GLBL_DBG_NONE  = 0,
      CAM_GLBL_DBG_ERR   = 1,
      CAM_GLBL_DBG_WARN  = 2,
      CAM_GLBL_DBG_HIGH  = 3,
      CAM_GLBL_DBG_LOW   = 4,
      CAM_GLBL_DBG_DEBUG = 5,
      CAM_GLBL_DBG_INFO  = 6
  } cam_global_debug_level_t;

1)不打开log开关的adb logcat 的log:
wanghl@server:~/work/msm8953a_android$ adb logcat | grep "pdaf"
06-20 23:30:55.631   859  4070 E mm-camera: 200: pdaf_init: ===PDAF_init ===//自己添加的
06-20 23:30:56.154   859  4076 I mm-camera: < INFO> 635: af_map_input_pdaf_info: initiating / PDAF disabled . HAF EVENT BYPASSED: af_algorithm->status = 0, PDAF_Enable = 1
06-20 23:30:56.212   859  4076 I mm-camera: < INFO> 635: af_map_input_pdaf_info: initiating / PDAF disabled . HAF EVENT BYPASSED: af_algorithm->status = 0, PDAF_Enable = 1

2)打开相关的log开关:
adb root
adb remount
adb shell setprop persist.camera.global.debug 1 //打印ERR级别的log
adb shell setprop persist.camera.pdaf_logging 1
重启打开相机:
wanghl@server:~/work/msm8953a_android$ adb logcat | grep "pdaf"
wanghl@server:~/work/msm8953a_android$ adb logcat | grep "pdaf"
06-20 23:48:27.924   772  3723 E mm-camera: 200: pdaf_init: ===PDAF_init ===
06-20 23:48:27.924   772  3723 E         : flag 0  file name: /data/misc/camera/pdaf_camif_init_param.bin//多打印的
06-20 23:48:27.924   772  3723 E         : flag 0  file name: /data/misc/camera/pdaf_init_param.bin
06-20 23:48:27.924   772  3723 E         : flag 0  file name: /data/misc/camera/pdaf_cali_dump.bin
06-20 23:48:28.088   772  3749 E         : flag 0  file name: /data/misc/camera/pdaf_param.bin
06-20 23:48:28.120   772  3749 E         : flag 0  file name: /data/misc/camera/pdaf_param.bin
06-20 23:48:28.154   772  3749 E         : flag 0  file name: /data/misc/camera/pdaf_param.bin
06-20 23:48:28.187   772  3749 E         : flag 0  file name: /data/misc/camera/pdaf_param.bin
06-20 23:48:28.221   772  3749 E         : flag 0  file name: /data/misc/camera/pdaf_param.bin
06-20 23:48:28.271   772  3749 E         : flag 0  file name: /data/misc/camera/pdaf_param.bin
06-20 23:48:28.338   772  3749 E         : flag 0  file name: /data/misc/camera/pdaf_param.bin
06-20 23:48:28.405   772  3749 E         : flag 0  file name: /data/misc/camera/pdaf_param.bin
06-20 23:48:28.460   772  3726 I mm-camera: < INFO> 635: af_map_input_pdaf_info: initiating / PDAF disabled . HAF EVENT BYPASSED: af_algorithm->status = 0, PDAF_Enable = 1
06-20 23:48:28.472   772  3749 E         : flag 0  file name: /data/misc/camera/pdaf_param.bin
06-20 23:48:28.527   772  3726 I mm-camera: < INFO> 635: af_map_input_pdaf_info: initiating / PDAF disabled . HAF EVENT BYPASSED: af_algorithm->status = 0, PDAF_Enable = 1
06-20 23:48:28.539   772  3749 E         : flag 0  file name: /data/misc/camera/pdaf_param.bin
06-20 23:48:28.607   772  3749 E         : flag 0  file name: /data/misc/camera/pdaf_param.bin
06-20 23:48:28.674   772  3749 E         : flag 0  file name: /data/misc/camera/pdaf_param.bin

3)
adb root
adb remount
adb shell setprop persist.camera.global.debug 6 //打印INFO级别的log
adb shell setprop persist.camera.pdaf_logging 1
//打印了更多的log,但是骁龙相机会挂,打不开
wanghl@server:~/work/msm8953a_android$ adb logcat -c
wanghl@server:~/work/msm8953a_android$ adb logcat | grep "pdaf"
06-20 23:51:36.996  4050  4050 D mm-camera: < HIGH> 6810: module_sensor_init: PDAF SDK capabilities: Type 2 and Type 3,        CANONICAL, FLIP, MIRROR and crop sensor readout        1D, 2D pdaf calibration
06-20 23:51:37.002  4050  4050 D mm-camera: <  LOW> 126: sensor_load_custom_library: no customer pdaf lib name definition
06-20 23:51:37.014  4050  4050 D mm-camera: <  LOW> 126: sensor_load_custom_library: no customer pdaf lib name definition
06-20 23:51:37.048  4050  4050 D mm-camera: <  DBG> dw9767_eeprom_format_pdafgain: 319: Enter
06-20 23:51:37.048  4050  4050 E mm-camera: dw9767_eeprom_format_pdafgain: 320: ===dw9767_eeprom_format_pdafgain===
06-20 23:51:37.048  4050  4050 D mm-camera: <  LOW> dw9767_eeprom_format_pdafgain: 334: dw9767 gain data valid !
06-20 23:51:37.048  4050  4050 D mm-camera: <  LOW> dw9767_eeprom_format_pdafgain: 342: VersionNum : 2//J:2,L3:3,L4:4,所以OTP是J版本
06-20 23:51:37.048  4050  4050 D mm-camera: <  LOW> dw9767_eeprom_format_pdafgain: 379: dw9767 DCC data valid !
06-20 23:51:37.048  4050  4050 D mm-camera: <  LOW> dw9767_eeprom_format_pdafgain: 413: -------------PDAF GAIN DUMP------------
06-20 23:51:37.048  4050  4050 D mm-camera: <  LOW> dw9767_eeprom_format_pdafgain: 421: OffsetX 24, OffsetY 24, RatioX 4, RatioY 4,MapWidth 17, MapHeight 13
06-20 23:51:37.048  4050  4050 D mm-camera: <  LOW> dw9767_eeprom_format_pdafgain: 422: -----------Left_GainMap----------------
06-20 23:51:37.048  4050  4050 D mm-camera: <  LOW> dw9767_eeprom_format_pdafgain: 434: 164, 160, 159, 161, 163, 168, 174, 182, 194, 208, 223, 238, 247, 252, 257, 257, 257
06-20 23:51:37.048  4050  4050 D mm-camera: <  LOW> dw9767_eeprom_format_pdafgain: 434: 161, 158, 156, 157, 160, 165, 171, 180, 193, 208, 225, 241, 252, 261, 266, 266, 263
06-20 23:51:37.048  4050  4050 D mm-camera: <  LOW> dw9767_eeprom_format_pdafgain: 434: 159, 156, 153, 154, 157, 162, 169, 178, 192, 209, 227, 244, 258, 270, 277, 275, 270
06-20 23:51:37.048  4050  4050 D mm-camera: <  LOW> dw9767_eeprom_format_pdafgain: 434: 158, 154, 152, 152, 155, 160, 166, 176, 191, 209, 228, 246, 262, 276, 285, 284, 277
06-20 23:51:37.049  4050  4050 D mm-camera: <  LOW> dw9767_eeprom_format_pdafgain: 434: 157, 153, 151, 151, 153, 158, 164, 174, 190, 209, 230, 248, 264, 280, 290, 290, 281
06-20 23:51:37.049  4050  4050 D mm-camera: <  LOW> dw9767_eeprom_format_pdafgain: 434: 157, 153, 150, 150, 152, 156, 162, 172, 188, 209, 231, 249, 265, 281, 291, 291, 282
06-20 23:51:37.049  4050  4050 D mm-camera: <  LOW> dw9767_eeprom_format_pdafgain: 434: 157, 153, 150, 150, 152, 156, 162, 171, 188, 210, 231, 249, 265, 281, 290, 288, 282
06-20 23:51:37.049  4050  4050 D mm-camera: <  LOW> dw9767_eeprom_format_pdafgain: 434: 158, 153, 151, 150, 152, 157, 163, 173, 189, 210, 231, 249, 265, 280, 287, 285, 281
06-20 23:51:37.049  4050  4050 D mm-camera: <  LOW> dw9767_eeprom_format_pdafgain: 434: 159, 154, 151, 151, 154, 159, 166, 176, 191, 211, 232, 249, 264, 278, 285, 282, 277
06-20 23:51:37.049  4050  4050 D mm-camera: <  LOW> dw9767_eeprom_format_pdafgain: 434: 160, 156, 152, 153, 156, 162, 169, 178, 193, 212, 231, 248, 262, 275, 282, 277, 274
06-20 23:51:37.049  4050  4050 D mm-camera: <  LOW> dw9767_eeprom_format_pdafgain: 434: 161, 157, 154, 155, 158, 164, 171, 180, 194, 212, 230, 247, 259, 270, 275, 271, 269
06-20 23:51:37.049  4050  4050 D mm-camera: <  LOW> dw9767_eeprom_format_pdafgain: 434: 163, 159, 157, 157, 161, 166, 173, 182, 196, 212, 229, 243, 254, 262, 266, 264, 262
06-20 23:51:37.049  4050  4050 D mm-camera: <  LOW> dw9767_eeprom_format_pdafgain: 434: 165, 162, 160, 160, 163, 168, 175, 184, 197, 212, 229, 241, 250, 257, 261, 260, 256
06-20 23:51:37.049  4050  4050 D mm-camera: <  LOW> dw9767_eeprom_format_pdafgain: 436: -----------Right_GainMap----------------
06-20 23:51:37.049  4050  4050 D mm-camera: <  LOW> dw9767_eeprom_format_pdafgain: 448: 285, 288, 287, 281, 271, 257, 239, 222, 206, 192, 181, 174, 171, 169, 167, 168, 170
06-20 23:51:37.049  4050  4050 D mm-camera: <  LOW> dw9767_eeprom_format_pdafgain: 448: 299, 301, 299, 292, 279, 261, 242, 223, 204, 190, 179, 173, 168, 166, 164, 166, 166
06-20 23:51:37.049  4050  4050 D mm-camera: <  LOW> dw9767_eeprom_format_pdafgain: 448: 308, 313, 313, 304, 286, 266, 244, 223, 202, 187, 176, 170, 165, 162, 161, 162, 165
06-20 23:51:37.049  4050  4050 D mm-camera: <  LOW> dw9767_eeprom_format_pdafgain: 448: 319, 322, 321, 310, 291, 267, 244, 222, 200, 184, 173, 167, 163, 160, 158, 159, 162
06-20 23:51:37.049  4050  4050 D mm-camera: <  LOW> dw9767_eeprom_format_pdafgain: 448: 327, 330, 327, 313, 293, 269, 245, 221, 199, 181, 170, 164, 160, 158, 157, 157, 158
06-20 23:51:37.049  4050  4050 D mm-camera: <  LOW> dw9767_eeprom_format_pdafgain: 448: 327, 333, 331, 317, 295, 271, 246, 222, 198, 179, 168, 163, 159, 157, 156, 156, 158
06-20 23:51:37.049  4050  4050 D mm-camera: <  LOW> dw9767_eeprom_format_pdafgain: 448: 328, 335, 332, 319, 297, 272, 248, 223, 198, 179, 168, 162, 159, 156, 154, 156, 160
06-20 23:51:37.049  4050  4050 D mm-camera: <  LOW> dw9767_eeprom_format_pdafgain: 448: 325, 332, 330, 317, 296, 272, 247, 222, 198, 180, 169, 163, 159, 156, 154, 157, 161
06-20 23:51:37.049  4050  4050 D mm-camera: <  LOW> dw9767_eeprom_format_pdafgain: 448: 319, 326, 326, 315, 293, 269, 245, 221, 199, 182, 170, 164, 160, 157, 155, 158, 161
06-20 23:51:37.049  4050  4050 D mm-camera: <  LOW> dw9767_eeprom_format_pdafgain: 448: 312, 319, 319, 310, 289, 266, 243, 221, 201, 184, 173, 166, 162, 159, 157, 160, 162
06-20 23:51:37.049  4050  4050 D mm-camera: <  LOW> dw9767_eeprom_format_pdafgain: 448: 306, 309, 311, 304, 286, 264, 243, 223, 204, 188, 176, 169, 165, 162, 161, 163, 164
06-20 23:51:37.049  4050  4050 D mm-camera: <  LOW> dw9767_eeprom_format_pdafgain: 448: 295, 300, 301, 294, 280, 261, 243, 224, 206, 190, 179, 172, 168, 165, 164, 165, 166
06-20 23:51:37.049  4050  4050 D mm-camera: <  LOW> dw9767_eeprom_format_pdafgain: 448: 289, 295, 296, 289, 276, 258, 242, 224, 207, 191, 181, 174, 170, 167, 166, 167, 168
06-20 23:51:37.049  4050  4050 D mm-camera: <  LOW> dw9767_eeprom_format_pdafgain: 450: -----------DCC----------------
06-20 23:51:37.049  4050  4050 D mm-camera: <  LOW> dw9767_eeprom_format_pdafgain: 457: PD_conversion value : 21011//L4 是最新的工具版本, 而 LA.UM.5.3-07210-89xx.0-1 对应的PDLIB 3.3, 版本比较老,L4 版本有48 个DCC 值, 而PDLIB 3.3, 只需要输入一个DCC 值,所以msm8953的代码赋值的时候只有一个DCC值
06-20 23:51:37.049  4050  4050 D mm-camera: <  DBG> dw9767_eeprom_format_pdafgain: 459: Exit
//Qualcomm PDAF version now have (J, L3 and L4), LSC version (M, P, R). 
---------------------------------------------
SDM632的开关换成了persist.vendor.camera.global.debug
adb shell setprop persist.vendor.camera.global.debug 4//打印LOW级别的log
但这个开关不会直接影响EEPROM相关log的打印:
真正打印的地方是:
vendor/qcom/proprietary/mm-camera/mm-camera2/media-controller/modules/sensors/module/sensor_debug.h
#define SERR(fmt, args...) CLOGE(CAM_SENSOR_MODULE, fmt, ##args)

vendor/qcom/proprietary/mm-camera/mm-camera2/includes/camera_dbg.h
  #define CLOGE(module, fmt, args...)                \
      CLOGx(module, CAM_GLBL_DBG_ERR, fmt, ##args)

  #define CLOGx(module, level, fmt, args...)                         \
    if (g_cam_log[module][level]) {                                  \
      cam_debug_log(module, level, __func__, __LINE__, fmt, ##args); \
    }

vendor/qcom/proprietary/mm-camera/mm-camera2/log_debug/android/camera_dbg.c
  void cam_debug_log(const cam_modules_t module,
                     const cam_global_debug_level_t level,
                     const char *func, const int line, const char *fmt, ...) {
    char    str_buffer[CDBG_MAX_STR_LEN];
    va_list args;

    va_start(args, fmt);
    cam_vsnprintf(str_buffer, CDBG_MAX_STR_LEN, fmt, args);
    va_end(args);

    switch (level) {
    case CAM_GLBL_DBG_WARN:
      ALOGW("%s%s %d: %s: %s", cam_loginfo[module].name,
        cam_dbg_level_to_str[level], line, func, str_buffer);
      break;
    case CAM_GLBL_DBG_ERR:
      ALOGE("===%s%s %d: %s: %s", cam_loginfo[module].name,//故意添加的===会打印出来,说明走的是这个log打印的方法
        cam_dbg_level_to_str[level], line, func, str_buffer);
      break;
    case CAM_GLBL_DBG_INFO://这个级别的log也会打印
      ALOGI("%s%s %d: %s: %s", cam_loginfo[module].name,
        cam_dbg_level_to_str[level], line, func, str_buffer);
      break;
    case CAM_GLBL_DBG_HIGH:
    case CAM_GLBL_DBG_DEBUG:
    case CAM_GLBL_DBG_LOW:
    default:
      ALOGD("==%s%s %d: %s: %s", cam_loginfo[module].name,
        cam_dbg_level_to_str[level], line, func, str_buffer);
    }
...
}
12-27 04:21:38.644   571  9202 E mm-camera: 720: eeprom_process: ===eeprom_process,event = 116===,EEPROM_GET_ISINSENSOR_CALIB
12-27 04:21:38.651   571  9202 E mm-camera: 720: eeprom_process: ===eeprom_process,event = 115===,EEPROM_CALIBRATE_FOCUS_DATA
12-27 04:21:38.742   571  9199 E mm-camera: 720: eeprom_process: ===eeprom_process,event = 126===,EEPROM_DUMP_CALIB_DATA
12-27 04:21:38.742   571  9199 E mm-camera: 720: eeprom_process: ===eeprom_process,event = 120===,EEPROM_GET_WB_GRGB
12-27 04:21:38.742   571  9199 E mm-camera: 720: eeprom_process: ===eeprom_process,event = 123===,EEPROM_GET_ISDPC_CALIB

-------------
关于PDAF版本:
SDM632:
除了一些注释还可以搜索到:
匹配到二进制文件 vendor/qcom/proprietary/prebuilt_HY11/target/product/msm8953_64/vendor/lib/libmmcamera_pdaf.so

vendor/qcom/proprietary/prebuilt_HY11/target/product/msm8953_64/vendor/lib/libmmcamera_pdaf.so
objdump -s vendor/qcom/proprietary/prebuilt_HY11/target/product/msm8953_64/vendor/lib/libmmcamera_pdaf.so > 1.txt
可以看到:
 11d50 74707574 20627566 6665722e 0a005044  tput buffer...PD
 11d60 4c696220 56657273 696f6e3a 204d616a  Lib Version: Maj
 11d70 6f723a20 2564204d 696e6f72 3a202564  or: %d Minor: %d
 11d80 20526576 6973696f 6e3a2025 64007065   Revision: %d.

正如高通回复的通过log来看PDAF版本信息:
You can check from log.
adb shell setprop persist.camera.pdaf_logging 1
such as
01-14 03:23:24.565 854 3361 E : PDLib Version: Major: 4 Minor: 4 Revision: 0

pdaf_lib.h
/*
 * pdaf driver version is given by:
 * ..
 */
#define PDAF_DRIVER_VERSION "2.3.3"
#define PDAF_SDK_CAPABILITIES "Type 1, Type 2 and Type 3,\
                             CANONICAL, FLIP, MIRROR and crop sensor readout,\
                             1D, 2D pdaf calibration, touch PDAF, 2PD,data-driven,\
                             actuator_sensitivity, logical_lens pos support"

msm8953:
objdump -s vendor/qcom/proprietary/prebuilt_HY11/target/product/msm8953_64/system/vendor/lib/libmmcamera_pdaf.so > 1.txt
未找到PDLib相关,代码里也没有搜到
pdaf_lib.h
/*
 * pdaf driver version is given by:
 * ..
 */
#define PDAF_DRIVER_VERSION "2.0.0"
#define PDAF_SDK_CAPABILITIES "Type 2 and Type 3,\
        CANONICAL, FLIP, MIRROR and crop sensor readout\
        1D, 2D pdaf calibration"

H10:
objdump -s vendor/qcom/proprietary/prebuilt_HY11/target/product/msm8909/system/vendor/lib/libmmcamera_pdaf.so > 1.txt
未找到PDLib相关,代码里也没有搜到
高通回复MSM8909不支持PDAF,版本信息只能通过libmmcamera_pdaf.so的log打印出来:
01-14 03:23:24.565 854 3361 E : PDLib Version: Major: 4 Minor: 4 Revision: 0

摘抄自网上:
(高通平台)pdaf log打印不出来的检查步骤:
检查自己写的pdaf驱动是否正确主要就是依据打印出来的pdaf log,那如果log出不来肯定是有问题的,接下来说下如何排查问题:

1:首先我们要检查sensor驱动h文件有没有打开pdaf,如果没有打开pdaf的log肯定出不来的。
2:然后要检查otp驱动是否加载正确,因为otp中有pdaf相关的校正。
3:效果目录3A文件的log有没有打开(举个例子)
sensors\chromatix\0309\chromatix_ov13850_q13v06k\3A\zsl_preview\chromatix_ov13850_q13v06k_zsl_preview_bu64297.h 文件中
 修改:
          1, / Enable /
         / Algo Enable /
         {
            0, 1, 0, 0 //从0, 0, 1, 0修改为0, 1, 0, 0
         },

并adb push libchromatix_ov13850_q13v06k_zsl_preview_bu64297.so文件(push相关的库文件进手机对应目录)
4:如果还是出不来log,那就要检查pdaf驱动是否正确了。pdaf驱动写不对的原因很多个,例如像素左右点坐标森马的,需要自己好好检查。
--------------------------------------------------------------------------------------------------------------------
(一)高通camera驱动结构
高通新的camera驱动架构设计大致的原理如此:将camera的所有功能划分为不同的模块,让模块自己来决定自己的事情(高内聚,低耦合),模块需要有统一的接口和格式。模块中有端口,通过端口把模块连接起来,又把模块挂在总线上。每一个端口的连接就是一个流,把这些流用pipeline来管理。每次启动一个camera就创建一个会话,由这个会话来管理此camera的一切事物。对于每一个会话,模块是共享的,它可以是camera的硬件资源也可以是其它资源(如一些软件算法等资源)。

从代码结构上来看这种新的驱动架构
高通的camera deamon代码放置在vendor/qcom/proprietary/mm-camera/目录下,而此目录下的mm-camera2就是新的camera架构位置,进入里面可以看到media-controller、server-imaging、server-tuning及其它几个目录,我们这里需要关注的就是media-controller目录。
media-controller
    |- mct——应该就是camera的引擎部分,里面包含了引擎、pipiline、bus、module、stream及event等定义及封装。
    |- modules——这里面就是划分好的一些模块代码,各模块大致功能如下
        |- sensors —— sensor 的驱动模块?                                                                                   —— src模块
        |- iface2 —— ISP interface模块                                                                                         —— inter模块
        |- isp —— 主要是ISP的处理,其内部又包含了众多的模块                                                         —— inter模块
        |- isp2 —— 主要是ISP的处理,其内部又包含了众多的模块                                                         —— inter模块
        |- stats —— 一些统计算法模块,如3A,ASD,AFD,IS,GRRO等数据统计的处理                             —— sink模块
        |- pproc —— post process处理                                                                                        —— inter模块
        |- pproc-new —— post process处理                                                                                        —— inter模块
        |- imglib —— 主要是图片的一些后端处理,如HDR等                                                              —— sink模块
以上各模块内部又包含了众多的模块,具体需要看代码分析。

管道、引擎与会话
管道有两端,一端用于读,一端用于写。camera引擎负责对管道的监控,而会话管理camera引擎。

(二)高通camera daemon进程
1.概述
  高通在Android的camera架构中,依旧沿用了其传统的方式,将其自身的一些处理放在一个daemon进程中。这部分内容出于应用于driver之间,是为了保护自身及硬件厂商的利益而专门弄出来的一个东东。其它各家平台也采用类似的方式将这部分的处理放在HAL层处理。

2.进程的入口
   做为一个单独的进程,那肯定是有其main函数入口的。在vendor/qcom/proprietary/mm-camera/mm-camera2/server-imaging/server.c文件中可以看到这个main函数。在这个函数中主要做了以下几件事情。
    1.找到服务节点的名字并打开此节点
        get_server_node_name(serv_hal_node_name)
        ......
        hal_fd->fd[0] = open(dev_name, O_RDWR | O_NONBLOCK); //这里dev_name为节点名如"/dev/serv_hal_node_name"
    2.初始化模块。目前有sensor、iface、isp、stats、pproc及imglib六个模块(见笔记一)
        server_process_module_sensor_init()
    static mct_module_init_name_t modules_list[] = {
      {"sensor", module_sensor_init,   module_sensor_deinit, NULL},
      {"iface",  module_iface_init,   module_iface_deinit, NULL},
      {"isp",    module_isp_init,      module_isp_deinit, NULL},
      {"stats",  stats_module_init,    stats_module_deinit, NULL},
      {"pproc",  pproc_module_init,    pproc_module_deinit, NULL},
      {"imglib", module_imglib_init, module_imglib_deinit, NULL},
    };
    3.进入主循环来处理来自HAL及MCT的事件及消息,处理完之后的结果反馈给kernel(msm.c)
        RD_FD_HAL
            ----> server_process_hal_event(&event)。此函数如果返回真,表示事件消息已经传给了MCT,这时不需要发送CMD ACK给kernel,因为MCT处理结束后会发出通知。如果返回假,表示没有传到MCT,此时需要立即发送CMD ACK到kernel,以便HAL发送此消息的线程阻塞住。
        RD_DS_FD_HAL —— 通过domain socket传自HAL的消息
            ----> server_process_hal_ds_packet(fd_info->fd
        RD_PIPE_FD_MCT —— 来自media controller通过管道传来的消息
(三)media controller线程
1.概述
    MCT线程是camera新架构的引擎部分,负责对管道的监控,由此来完成一个camera设备的控制运转。它运行在daemon进程空间,由MSM_CAMERA_NEW_SESSION事件来开启,具体开启函数为mct_controller_new()。可以从log上看出:
11-13 23:20:36.469   566  1439 I mm-camera: < INFO> 118: mct_controller_new: Creating new mct_controller with session-id 1

2.mct_controller_new()函数
    此函数创建一个新的MCT引擎,这将对应一个事务的pipeline。我们知道上层可以创建多个事务,每个对应一个camera,也对应自己的MCT及pipeline等。因此这个函数的主要完成以下几件事情:
    1.mct_pipeline_new()
        ---->创建一个Pipeline及其bus,并完成pipeline函数的映射。
    2.pthread_create(..., mct_controller_thread_run, ...)
        ---->创建mct线程并开始执行
    3.pthread_create(..., mct_bus_handler_thread_run, ...)
        ---->创建bus处理线程
    4.mct_pipeline_start_session()
        ---->开启camera的所有模块并查询其能力

3.mct_list_traverse()函数
    此函数在整个mct线程中大量使用,主要用来遍历所有模块并执行一些处理工作。结合前面所讲,camera各模块都具有统一的接口,通过流来连接,模块中又包含模块,根据这种特性高通使用链表结构来保存这些模块并设计了此函数用来完成遍历操作。
    1.先来看看此链表的节点结构。链表的节点其实也是一个链表,整个链表就好像是一串串同级的节点搭建而成,整个数据结构组成一颗树结构。
        struct _mct_list {
            void             *data;  // 节点数据
            mct_list_t    *prev;  // 上一个节点地址
            mct_list_t    **next; // 下一个节点节点元素数组首地址
            uint32_t       next_num; // 下一个节点节点元素数,大部分情况下为1
        }mct_list_t;
    2.通过递归的深度优先算法来遍历整棵树。
4.MCT线程运行
    MCT整个引擎部分主要处理server及bus两类事情,对应前面提到的MCT及bus两个线程。MCT线程主要用来处理来自image server的消息,先pop MCT queue,查看是否有消息,如果有则执行mct_controller_proc_serv_msg_internal()函数来处理。mct_controller_proc_serv_msg_internal函数用来处理来自image server的消息,并返回类型MCT_PROCESS_RET_SERVER_MSG。这里处理的消息类型主要有SERV_MSG_DS与SERV_MSG_HAL两种,分别在pipline中给出了相应的处理函数,具体查看源码可知。

5.bus线程运行
    bus线程跟MCT线程流程一样。从代码上我们看到两个线程都是从同一个queue上面pop消息,他们是通过各自的线程条件变量来进行区分,完成线程的阻塞及运行工作。MCT的条件变量mctl_cond可以看到是在server_process.c文件中标记的,而bus的条件变量mctl_bus_handle_cond未在源码中找到标志的位置?
============================================================================================================================================
1)vi删除每行前10个字符:
:%s/^.\{10\}//
其中,%表示所有行,s表示替换,"%s"可用"1,$"代替(下同);正则表达式"/^.\{10\}//"中,^表示行首;"."表示要删除的字符个数,".\{10\}"表示删除10个字符,可用10个"."表示;

2)vi在每行行首插入指定字符:
行首 :%s/^/your_word/

3)替换每一行中所有 vivian 为 sky 
:%s/vivian/sky/g(等同于 :g/vivian/s//sky/g) 

4)在每一行行尾插入@@
:%s/$/@@
========================
SDM439 android9.0新基线新增dtbo.img,所以修改设备树文件单独编译kernel没有用了,make bootimage没用,需要单独编译设备树文件,可以make dtboimage,单烧录dtbo.img才会生效.
====================================
Camera一些关键宏的设置于判定:
device/vinet/vs5/vs5.mk:98:TARGET_OEM_CONFIG_FILE_SUFFIX := vs5
vendor/qcom/proprietary/common/vs5/BoardConfigVendor.mk:27:OEM_SENSOR_CONFIG_XML_SUFFIX := s5k3l6_s5k4h7yx_gc2375

ifneq ($(OEM_SENSOR_CONFIG_XML_SUFFIX),)
LOCAL_SRC_FILES := msm8937_$(TARGET_OEM_CONFIG_FILE_SUFFIX)_camera_$(OEM_SENSOR_CONFIG_XML_SUFFIX).xml//msm8937_vs5_camera_s5k3l6_s5k4h7yx_gc2375.xml,假如走这里,但是这个文件msm8937_vs5_camera_s5k3l6_s5k4h7yx_gc2375.xml不存在,编译将会停下来报错:ninja: error: 'vendor/qcom/proprietary/mm-camera/mm-camera2/media-controller/modules/sensors/configs/msm8937_vs5_camera_s5k3l6_s5k4h7yx_gc2375.xml', needed by 'out/target/product/vs5/obj/EXECUTABLES/camera_config.xml_intermediates/camera_config.xml', missing and no known rule to make it 16:25:32 ninja failed with: exit status 1
else
LOCAL_SRC_FILES := msm8937_$(TARGET_OEM_CONFIG_FILE_SUFFIX)_camera.xml//msm8937_vs5_camera.xml
endif

ifeq ($(TARGET_PRODUCT),vs5)
...
endif


代码:
vendor/qcom/proprietary/common/config/device-vendor.mk
2910 ifeq ($(TARGET_USE_SENSOR_S5K318_F13S10M),true)
2911 $(warning define TARGET_USE_SENSOR_S5K318_F13S10M true)
    ......
2939 else
2940 $(warning not define TARGET_USE_SENSOR_S5K318_F13S10M true)//编译过程中会打印出来
2941 endif
编译log如下:
vendor/qcom/proprietary/common/config/device-vendor.mk:2940: warning: not define TARGET_USE_SENSOR_S5K318_F13S10M true
vendor/qcom/proprietary/common/config/device-vendor.mk:2944: warning: define TARGET_USE_SENSOR_S5K4H7YX true
vendor/qcom/proprietary/common/config/device-vendor.mk:2986: warning: not define TARGET_USE_SENSOR_S5K4H8 true

代码:vendor/qcom/proprietary/mm-camera/mm-camera2/media-controller/modules/sensors/configs/Android.mk
else ifeq ($(call is-board-platform-in-list, msm8937),true)
$(warning warning: TARGET_OEM_CONFIG_FILE_SUFFIX =wanghl $(TARGET_OEM_CONFIG_FILE_SUFFIX))//编译log将会打印出来
ifneq ($(TARGET_OEM_CONFIG_FILE_SUFFIX),)
include $(CLEAR_VARS)
LOCAL_MODULE:= camera_config.xml
LOCAL_MODULE_CLASS := EXECUTABLES
ifneq ($(OEM_SENSOR_CONFIG_XML_SUFFIX),)
LOCAL_SRC_FILES := msm8937_$(TARGET_OEM_CONFIG_FILE_SUFFIX)_camera_$(OEM_SENSOR_CONFIG_XML_SUFFIX).xml
else
LOCAL_SRC_FILES := msm8937_$(TARGET_OEM_CONFIG_FILE_SUFFIX)_camera.xml
endif
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/etc/camera
LOCAL_MODULE_OWNER := qti
include $(BUILD_PREBUILT)
else
include $(CLEAR_VARS)
LOCAL_MODULE:= camera_config.xml
LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_SRC_FILES := msm8937_camera.xml
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/etc/camera
LOCAL_MODULE_OWNER := qti
include $(BUILD_PREBUILT)
endif
编译log:
vendor/qcom/proprietary/mm-camera/mm-camera2/media-controller/modules/sensors/../../../../mm-camera2/media-controller/modules/sensors//configs/Android.mk:49: warning: TARGET_OEM_CONFIG_FILE_SUFFIX =wanghl vs5
device/vinet/vs5/BoardConfig.mk:53:TARGET_BOOTLOADER_OEM_CONFIG_SUFFIX := vs5
===================================
1.在lk中只需要在panel_XXX_video.h 中增加如下数据结构
调试AMOLED屏,调试AMOLED屏的重要点在于给屏提供的两个电,OVDD(4.6V)与OVSS(-2.9V)
static struct labibb_desc panel_truly_1080p_video_labibb = {
    1, // lcd = 0, amoled = 1
    1, // force_config 0 to use default value
    2900000, // IBB minimum voltage in µV 这个电压由屏的SPEC决定。
    2900000, // IBB maximum voltage in µV
    4600000, // LAB minimum voltage in µV
    4600000, // LAB maximum voltage in µV
    3, // power up delay
    3, //power down delay
    1, //IBB discharge enable
    1 // SWIRE control
};

struct labibb_desc {
    char amoled_panel; /* lcd = 0, amoled = 1*/
    char force_config; /* 0 to use default value */
    uint32_t ibb_min_volt;
    uint32_t ibb_max_volt;
    uint32_t lab_min_volt;
    uint32_t lab_max_volt;
    char pwr_up_delay; /* ndx to => 1250, 2500, 5000 and 10000 us */
    char pwr_down_delay; /* ndx to => 1250, 2500, 5000 and 10000 us */
    char ibb_discharge_en;
    bool swire_control;
};

labibb_desc应该是AMOLED相关的。

增加了这个节点后还是不能点亮。器测量电压发现LAB与IBB不受SWIRE信号控制。通过对比旧基线与新基线发现是高通代码bug,缺失了一部分代码,然后发现AVDD上电比较早导致时序不对.是mpp信号不对.在xbl中增加代码,拉低mpp.就可以了。

msm8953的屏幕:
static struct labibb_desc s6d6a1_video_labibb = {
    //0, 1, 5700000, 5700000, 5700000, 5700000, 3, 3, 1, 0
    0, 1, 5700000, 5700000, 5700000, 5700000, 4, 4, 1, 0
};
-----------------
ili9881c kernel跑起来后闪屏的问题是因为ESD检测出的问题:
    qcom,esd-check-enabled;
    qcom,mdss-dsi-panel-status-check-mode = "reg_read";
    qcom,mdss-dsi-panel-status-command = [06 01 00 01 00 00 01 0a];
    qcom,mdss-dsi-panel-status-command-state = "dsi_lp_mode";
    qcom,mdss-dsi-panel-status-value = <0x9d 0x9d 0x9d 0x9d>;
    qcom,mdss-dsi-panel-on-check-value = <0x9d 0x9d 0x9d 0x9d>;
    qcom,mdss-dsi-panel-status-read-length = <4>;
    qcom,mdss-dsi-panel-max-error-count = <3>;

串口log:
[  323.980811] mdss_dsi_fifo_status: status=55551000
[  323.981377] mdss_dsi_gen_read_status: Read back value from panel is incorrect
[  324.000997] mdss_fb_report_panel_dead: Panel has gone bad, sending uevent - PANEL_ALIVE=0

屏蔽掉ESD监测://qcom,mdss-dsi-panel-status-check-mode = "reg_read";
就不会闪烁,串口log:
[   55.292851] mdss_dsi_fifo_status: status=55551000
[   55.292891] mdss_dsi_ack_err_status: status=1000040
说明简单粗暴的屏蔽虽然能解决闪烁的问题,但是状态读取还是错的,咨询联创杨工:
ESD check指令是IC 提供的,方法就是读IC的寄存器值,跟正常状态的值比较,不对就会重新下代码,如果不成功,就会固定频率的闪,因为check值不对,就会重新点亮,闪一下,LCD点亮是一行一行扫描的,必须要在一行一行之间的间隙时间内完成,必须在PORCH时间内完成,不能在active内读比较,要不就会影响显示,出现比如屏幕闪烁的问题,比如之前msm8953出现的玩游戏闪屏的问题就是通过高通patch改法,将ESD check读的位置固定在VFP里(或者把VFP的时间设置长点,保障有足够的时间来做ESD check),固定在VFP(帧之间)就会比杨工说的固定在HFP间隔没有那么频繁。
所以可能有两个原因:1.check值不对2.proch设置不合理
ILI9881C的ESD check的读取指令是直接读0A,读回的值应该是0x0C(值是唯一的,也只需要读一位),所以明显就是读的寄存器对了,但是值设置的不对,长度也不对,修改如下即可:
    //ESD check,if read back incorrect(e.g. wrong status-read-length = <4>) gonna cause panel blink
    qcom,esd-check-enabled;
    qcom,mdss-dsi-panel-status-check-mode = "reg_read";
    qcom,mdss-dsi-panel-status-command = [06 01 00 01 00 00 01 0A];// universal command
    qcom,mdss-dsi-panel-status-command-state = "dsi_lp_mode";
    qcom,mdss-dsi-panel-status-value = <0x9C>; //universal read back value
    qcom,mdss-dsi-panel-on-check-value = <0x9C>;
    qcom,mdss-dsi-panel-status-read-length = <1>;//length should be right ref to ili9881c
    qcom,mdss-dsi-panel-max-error-count = <3>;
log:
[  177.586283] mdss_dsi_fifo_status: status=55551000
不会再有错误提示。

另外一个问题,暂且记录如下,因为:
===enable = 0, ctrl->shared_data->phy_rev = 3===
所以走的timing表是qcom,mdss-dsi-panel-timings-phy-12nm
并没有使用Excel表格计算出来的timing.LK部分也是使用的带有12nm的timing. 

11指令最小延时可以设置到60-80ms,一般是120ms
======================================================================
[    4.849247] [FTS][Info]fw upgrade init function                                                                                                                       
[    4.849291] [FTS][Info]fw upgrade work function                                                                                                                       
[    4.849296] [FTS]fts_irq_disable: Enter                                                                                                                               
[    4.849303] [FTS]fts_irq_disable: Exit(278)                                                                                                                           
[    4.849307] [FTS][Info]get upgrade fw file                                                                                                                            
[    4.849311] [FTS][Info]upgrade fw file len:0                                                                                                                          
[    4.849315] [FTS][Error]fw file len(0) fail                                                                                                                           
[    4.849319] [FTS][Error]get file fail, can't upgrade

[ 1148.020641] [FTS][Error][IIC]: i2c_transfer(write) error, ret=-2!!
[ 1148.061096] i2c-msm-v2 78b7000.i2c: error timeout on polling for valid state. check core_clk

cat /sys/bus/i2c/devices/3-0038/fts_dump_reg

正确的寄存器:
wanghl@server:~/work/sdm439_android$ adb root;adb shell cat /sys/bus/i2c/devices/3-0038/fts_dump_reg
restarting adbd as root
Power Mode:0x01
FW Ver:0x05
LCD Initcode Ver:0xff
Param Ver:0x00
Param status:0x00
Vendor ID:0x87
LCD Busy Number:0x00
Gesture Mode:0x00
charge stat:0x00
INT count:0x00
ESD count:0x23


echo 1 > /sys/kernel/debug/clk/debug_suspend
[  313.877288]  bimc_msmbus_a_clk:1:1 [383909888] -> bimc_a_clk:1:1 [383909888]
[  313.877288]  pnoc_keepalive_a_clk:1:1 [19200000] -> pnoc_a_clk:1:1 [19200000]
[  313.877288]  qdss_clk:24:24 [1]
[  313.877288]  gpll0_ao_clk_src_8937:1:1 [800000000] -> xo_a_clk_src:5:4 [19200000]
[  313.877288]  gpll0_ao_clk_src:1:1 [800000000] -> gpll0_ao_clk_src_8937:1:1 [8000]
[  313.877288]  a53ss_c1_pll:1:1 [1305600000, 2] -> xo_a_clk_src:5:4 [19200000]
[  313.877288]  gcc_boot_rom_ahb_clk:1:1 [0]
[  313.877288]  apss_ahb_clk_src:1:1 [19200000] -> xo_a_clk_src:5:4 [19200000]
[  313.877288]  gcc_mss_cfg_ahb_clk:1:1 [0]
[  313.877288]  gcc_mss_q6_bimc_axi_clk:1:1 [0]
[  313.877288]  gcc_usb2a_phy_sleep_clk:1:1 [0]
[  313.877288]  a53ss_c0_pll:1:0 [768000000, 1] -> xo_a_clk_src:5:4 [19200000]
[  313.877288]  gcc_dcc_clk:1:1 [0]
[  313.877288]  a53ssmux_lc:1:0 [768000000] -> a53ss_c0_pll:1:0 [768000000, 1] -> x]
[  313.877288]  a53ssmux_bc:1:1 [1305600000] -> a53ss_c1_pll:1:1 [1305600000, 2] ->]
[  313.877288]  a53ssmux_cci:1:1 [400000000] -> gpll0_ao_clk_src:1:1 [800000000] ->]
[  313.877288]  a53_bc_clk:2:1 [1305600000, 2] -> a53ssmux_bc:1:1 [1305600000] -> a]
[  313.877288]  a53_lc_clk:1:0 [768000000, 1] -> a53ssmux_lc:1:0 [768000000] -> a53]
[  313.877288]  cci_clk:2:1 [400000000, 1] -> a53ssmux_cci:1:1 [400000000] -> gpll0]
[  313.877288] Enabled clock count: 22
[  313.877288] Suspended for 58.734 seconds


[   24.569834] init: Service 'vendor.vm_bms' (pid 1494) exited with status 255
[   24.569898] init: Sending signal 9 to service 'vendor.vm_bms' (pid 1494) process group...
[   24.576972] libprocessgroup: Successfully killed process cgroup uid 0 pid 1494 in 0ms
[   28.535066] ===fts_ts_interrupt===
[   28.538698] [FTS][B]P0(634, 1555)[p:30,tm:1] DOWN!
[   28.538849] ===fts_ts_interrupt===
[   28.546000] [FTS][B]P0(634, 1555)[p:30,tm:1] DOWN!
[   28.546755] ===fts_ts_interrupt===
[   28.554065] [FTS][B]P0(634, 1555)[p:30,tm:1] DOWN!
[   28.554154] ===fts_ts_interrupt===
[   28.562223] [FTS][B]P0(634, 1555)[p:30,tm:1] DOWN!
[   28.562313] ===fts_ts_interrupt===
[   28.570374] [FTS][B]P0(634, 1555)[p:30,tm:1] DOWN!
[   28.570462] ===fts_ts_interrupt===
[   28.578590] [FTS][B]P0 UP!
[   28.578615] [FTS][B]Points All Up!
[   29.537297] init: starting service 'vendor.vm_bms'...
[   29.565197] init: Service 'vendor.vm_bms' (pid 1551) exited with status 255
[   29.565261] init: Sending signal 9 to service 'vendor.vm_bms' (pid 1551) process group...
[   29.571403] libprocessgroup: Successfully killed process cgroup uid 0 pid 1551 in 0ms
[   31.694758] type=1400 audit(16401.249:59): avc: denied { read } for pid=1218 comm="system_server" name="hctosys" dev="sysfs" ino=33315 scontext=u:r:system_server:s0 0
[   31.694850] type=1400 audit(1547698150.929:60): avc: denied { read } for pid=1218 comm="system_server" name="u:object_r:vendor_default_prop:s0" dev="tmpfs" ino=174900
[   31.871833] acc_open
[   31.871873] acc_release
[   31.934344] type=1400 audit(1547698151.149:61): avc: denied { read } for pid=1218 comm="system_server" name="u:object_r:vendor_default_prop:s0" dev="tmpfs" ino=174900
[   31.934443] type=1400 audit(1547698151.169:62): avc: denied { search } for pid=483 comm="Binder:483_2" name="vendor" dev="tmpfs" ino=13455 scontext=u:r:vold:s0 tcont0
[   33.362659] sdcardfs version 2.0
[   33.362689] sdcardfs: dev_name -> /data/media
[   33.364953] sdcardfs: options -> fsuid=1023,fsgid=1023,multiuser,derive_gid,default_normal,mask=6,userid=0,gid=1015
[   33.369221] sdcardfs: mnt -> fffffffb8ec34020
[   33.379664] sdcardfs: mounted on top of /data/media type ext4
[   33.386101] Remount options were mask=23,gid=9997 for vfsmnt fffffffb8ec34e20.
[   33.389713] sdcardfs : options - debug:1
[   33.396958] sdcardfs : options - gid:9997
[   33.400965] sdcardfs : options - mask:23
[   33.406175] Remount options were mask=7,gid=9997 for vfsmnt fffffffb8ec358a0.
[   33.408809] sdcardfs : options - debug:1
[   33.415956] sdcardfs : options - gid:9997
[   33.419822] sdcardfs : options - mask:7
[   33.507075] type=1400 audit(1547698151.169:62): avc: denied { search } for pid=483 comm="Binder:483_2" name="vendor" dev="tmpfs" ino=13455 scontext=u:r:vold:s0 tcont0
[   33.507171] type=1400 audit(1547698152.739:63): avc: denied { read } for pid=580 comm="[email protected]" name="name" dev="sysfs" ino=41291 scontext=u:r:hal_gnss_qti:s0
[   33.597817] type=1400 audit(1547698152.739:63): avc: denied { read } for pid=580 comm="[email protected]" name="name" dev="sysfs" ino=41291 scontext=u:r:hal_gnss_qti:s0
[   33.597913] type=1400 audit(1547698152.829:64): avc: denied { read } for pid=580 comm="Loc_hal" name="name" dev="sysfs" ino=41291 scontext=u:r:hal_gnss_qti:s0 tconte0
[   33.701217] type=1400 audit(1547698152.829:64): avc: denied { read } for pid=580 comm="Loc_hal" name="name" dev="sysfs" ino=41291 scontext=u:r:hal_gnss_qti:s0 tconte0
[   33.701311] type=1400 audit(1547698152.929:65): avc: denied { read } for pid=580 comm="[email protected]" name="name" dev="sysfs" ino=41291 scontext=u:r:hal_gnss_qti:s0
[   33.856497] msm_vidc: info: Opening video instance: 0000000000000000, 1
[   33.862939] subsys-restart: __subsystem_get(): Changing subsys fw_name to venus
[   33.887471] subsys-pil-tz 1de0000.qcom,venus: loading /vendor/firmware_mnt/image/venus.mdt failed with error -13
[   33.904079] ueventd: firmware: loading 'venus.mdt' for '/devices/platform/soc/1de0000.qcom,venus/firmware/venus.mdt'
[   33.915262] ueventd: loading /devices/platform/soc/1de0000.qcom,venus/firmware/venus.mdt took 21ms
[   33.923871] subsys-pil-tz 1de0000.qcom,venus: venus: loading from 0x000000008f800000 to 0x000000008fc00000
[   33.954126] subsys-pil-tz 1de0000.qcom,venus: loading /vendor/firmware_mnt/image/venus.b02 failed with error -13
[   33.967562] ueventd: firmware: loading 'venus.b02' for '/devices/platform/soc/1de0000.qcom,venus/firmware/venus.b02'
[   33.979309] ueventd: loading /devices/platform/soc/1de0000.qcom,venus/firmware/venus.b02 took 18ms
[   33.986546] subsys-pil-tz 1de0000.qcom,venus: loading /vendor/firmware_mnt/image/venus.b03 failed with error -13
[   33.991538] ueventd: firmware: loading 'venus.b03' for '/devices/platform/soc/1de0000.qcom,venus/firmware/venus.b03'
[   34.007626] subsys-pil-tz 1de0000.qcom,venus: loading /vendor/firmware_mnt/image/venus.b04 failed with error -13
[   34.008772] ueventd: loading /devices/platform/soc/1de0000.qcom,venus/firmware/venus.b03 took 17ms
[   34.020323] ueventd: firmware: loading 'venus.b04' for '/devices/platform/soc/1de0000.qcom,venus/firmware/venus.b04'
[   34.029914] ueventd: loading /devices/platform/soc/1de0000.qcom,venus/firmware/venus.b04 took 9ms
[   34.059337] subsys-pil-tz 1de0000.qcom,venus: venus: Brought out of reset
[   34.114349] msm_vidc: info: Closed video instance: 0000000000000000
[   34.254827] msm_vidc: info: Opening video instance: 0000000000000000, 1
[   34.276894] msm_vidc: info: Closed video instance: 0000000000000000
[   34.371675] msm_vidc: info: Opening video instance: 0000000000000000, 1
[   34.383150] msm_vidc: info: Closed video instance: 0000000000000000
[   34.434899] msm_vidc: info: Opening video instance: 0000000000000000, 0
[   34.453839] msm_vidc: info: Closed video instance: 0000000000000000
[   34.540995] init: starting service 'vendor.vm_bms'...
[   34.594439] init: Service 'vendor.vm_bms' (pid 1994) exited with status 255
[   34.594518] init: Sending signal 9 to service 'vendor.vm_bms' (pid 1994) process group...
[   34.601454] libprocessgroup: Successfully killed process cgroup uid 0 pid 1994 in 0ms
[   34.928470] ===fts_ts_interrupt===
[   34.932169] [FTS][B]P0(437, 887)[p:81,tm:3] DOWN!
[   34.932373] ===fts_ts_interrupt===
[   34.939414] [FTS][B]P0(437, 887)[p:81,tm:3] DOWN!
[   34.940300] ===fts_ts_interrupt===
[   34.947593] [FTS][B]P0(437, 887)[p:82,tm:3] DOWN!
[   34.947778] ===fts_ts_interrupt===
[   34.955823] [FTS][B]P0(437, 887)[p:83,tm:3] DOWN!
[   34.955982] ===fts_ts_interrupt===
[   34.963656] [FTS][B]P0(437, 887)[p:83,tm:3] DOWN!
[   34.963776] ===fts_ts_interrupt===
[   34.971779] [FTS][B]P0(437, 883)[p:84,tm:3] DOWN!
[   34.971935] ===fts_ts_interrupt===
[   34.979837] [FTS][B]P0(438, 874)[p:85,tm:3] DOWN!
[   34.980058] ===fts_ts_interrupt===
[   34.987963] [FTS][B]P0(438, 874)[p:85,tm:3] DOWN!
[   34.988054] ===fts_ts_interrupt===
[   34.996042] [FTS][B]P0(440, 860)[p:86,tm:3] DOWN!
[   34.996270] ===fts_ts_interrupt===
[   35.004034] [FTS][B]P0(443, 844)[p:87,tm:3] DOWN!
[   35.004171] ===fts_ts_interrupt===
[   35.012107] [FTS][B]P0(443, 844)[p:87,tm:3] DOWN!
[   35.012271] ===fts_ts_interrupt===
[   35.020132] [FTS][B]P0(447, 825)[p:87,tm:3] DOWN!
[   35.021419] ===fts_ts_interrupt===
[   35.028294] [FTS][B]P0(453, 804)[p:86,tm:3] DOWN!
[   35.028543] ===fts_ts_interrupt===
[   35.036508] [FTS][B]P0(461, 781)[p:86,tm:3] DOWN!
[   35.036735] ===fts_ts_interrupt===
[   35.044424] [FTS][B]P0(461, 781)[p:86,tm:3] DOWN!
[   35.044507] ===fts_ts_interrupt===
[   35.052442] [FTS][B]P0 UP!
[   35.052477] [FTS][B]Points All Up!
[   36.184108] init: Service 'bootanim' (pid 949) exited with status 0
[   36.308642] init: processing action (sys.usb.config=none && sys.usb.configfs=1) from (/vendor/etc/init/hw/init.msm.usb.configfs.rc:30)
[   36.309570] android_disconnect: gadget is not connected
[   36.342266] init: processing action (sys.usb.config=none && sys.usb.configfs=1) from (/init.usb.configfs.rc:1)
[   36.343662] init: Command 'write /config/usb_gadget/g1/UDC none' action=sys.usb.config=none && sys.usb.configfs=1 (/init.usb.configfs.rc:2) took 1ms and failed: Unabe
[   36.352350] init: Sending signal 9 to service 'adbd' (pid 666) process group...
[   36.399725] ===fts_ts_interrupt===
[   36.403407] [FTS][B]P0(387, 827)[p:127,tm:8] DOWN!
[   36.403562] ===fts_ts_interrupt===
[   36.410637] [FTS][B]P0(387, 827)[p:127,tm:8] DOWN!
[   36.410731] ===fts_ts_interrupt===
[   36.418898] [FTS][B]P0(387, 827)[p:127,tm:8] DOWN!
[   36.419010] ===fts_ts_interrupt===
[   36.427173] [FTS][B]P0(387, 827)[p:127,tm:8] DOWN!
[   36.427352] ===fts_ts_interrupt===
[   36.435216] [FTS][B]P0(387, 827)[p:127,tm:8] DOWN!
[   36.435551] ===fts_ts_interrupt===
[   36.443294] [FTS][B]P0(387, 827)[p:127,tm:8] DOWN!
[   36.443454] ===fts_ts_interrupt===
[   36.451476] [FTS][B]P0(387, 827)[p:127,tm:9] DOWN!
[   36.451645] ===fts_ts_interrupt===
[   36.459618] [FTS][B]P0(387, 827)[p:127,tm:9] DOWN!
[   36.459705] ===fts_ts_interrupt===
[   36.467873] [FTS][B]P0(387, 827)[p:127,tm:10] DOWN!
[   36.468048] ===fts_ts_interrupt===
[   36.476001] [FTS][B]P0(387, 827)[p:127,tm:10] DOWN!
[   36.476115] ===fts_ts_interrupt===
[   36.484162] [FTS][B]P0(387, 827)[p:127,tm:10] DOWN!
[   36.484256] ===fts_ts_interrupt===
[   36.492447] [FTS][B]P0(387, 822)[p:127,tm:10] DOWN!
[   36.493531] ===fts_ts_interrupt===
[   36.500682] [FTS][B]P0(387, 818)[p:127,tm:10] DOWN!
[   36.500840] ===fts_ts_interrupt===
[   36.508918] [FTS][B]P0(387, 811)[p:127,tm:10] DOWN!
[   36.509075] ===fts_ts_interrupt===
[   36.517262] [FTS][B]P0(387, 811)[p:127,tm:10] DOWN!
[   36.517373] ===fts_ts_interrupt===
[   36.525477] [FTS][B]P0(386, 805)[p:127,tm:10] DOWN!
[   36.525676] ===fts_ts_interrupt===
[   36.533709] [FTS][B]P0(385, 798)[p:127,tm:10] DOWN!
[   36.533895] ===fts_ts_interrupt===
[   36.536503] libprocessgroup: Successfully killed process cgroup uid 0 pid 666 in 162ms
[   36.545509] [FTS][B]P0(385, 790)[p:127,tm:10] DOWN!
[   36.551429] Boot completed 
[   36.551429] ===fts_ts_interrupt===
[   36.560932] [FTS][B]P0(384, 783)[p:127,tm:10] DOWN!
[   36.561120] ===fts_ts_interrupt===
[   36.569273] [FTS][B]P0(383, 778)[p:127,tm:10] DOWN!
[   36.569461] ===fts_ts_interrupt===
[   36.577497] [FTS][B]P0(383, 778)[p:127,tm:10] DOWN!
[   36.577654] ===fts_ts_interrupt===
[   36.585779] [FTS][B]P0(382, 773)[p:127,tm:10] DOWN!
[   36.586250] ===fts_ts_interrupt===
[   36.593855] [FTS][B]P0(381, 769)[p:127,tm:10] DOWN!
[   36.594009] ===fts_ts_interrupt===
[   36.602276] [FTS][B]P0(381, 764)[p:127,tm:10] DOWN!
[   36.602526] ===fts_ts_interrupt===
[   36.610314] [FTS][B]P0(381, 764)[p:127,tm:10] DOWN!
[   36.610424] ===fts_ts_interrupt===
[   36.618710] [FTS][B]P0(381, 761)[p:127,tm:10] DOWN!
[   36.618899] ===fts_ts_interrupt===
[   36.627082] [FTS][B]P0(381, 759)[p:127,tm:10] DOWN!
[   36.627240] ===fts_ts_interrupt===
[   36.635116] [FTS][B]P0(381, 759)[p:127,tm:10] DOWN!
[   36.635218] ===fts_ts_interrupt===
[   36.643315] [FTS][B]P0(383, 755)[p:127,tm:10] DOWN!
[   36.644141] ===fts_ts_interrupt===
[   36.651562] [FTS][B]P0(385, 753)[p:127,tm:10] DOWN!
[   36.651706] ===fts_ts_interrupt===
[   36.659772] [FTS][B]P0(389, 752)[p:127,tm:9] DOWN!
[   36.659946] ===fts_ts_interrupt===
[   36.668093] [FTS][B]P0(389, 752)[p:127,tm:9] DOWN!
[   36.668189] ===fts_ts_interrupt===
[   36.676261] [FTS][B]P0(394, 754)[p:127,tm:9] DOWN!
[   36.676448] ===fts_ts_interrupt===
[   36.684465] [FTS][B]P0 UP!
[   36.684496] [FTS][B]Points All Up!
[   36.687018] ===fts_ts_interrupt===
[   36.693802] [FTS][B]P0 UP!
[   36.693832] [FTS][B]Points All Up!
[   36.949053] read descriptors
[   36.949351] read strings
[   36.965587] msm_hsusb msm_hsusb: [ci13xxx_start] hw_ep_max = 32
[   36.965631] msm_hsusb msm_hsusb: CI13XXX_CONTROLLER_RESET_EVENT received
[   36.971154] msm_hsusb msm_hsusb: CI13XXX_CONTROLLER_UDC_STARTED_EVENT received
[   36.977421] msm_hsusb msm_hsusb: CI13XXX_CONTROLLER_CONNECT_EVENT received
[   36.982343] ===fts_ts_interrupt===
[   36.986033] [FTS][B]P0(416, 915)[p:127,tm:7] DOWN!
[   36.986180] ===fts_ts_interrupt===
[   36.989724] [FTS][B]P0(416, 915)[p:127,tm:7] DOWN!
[   36.989789] ===fts_ts_interrupt===
[   36.993327] [FTS][B]P0(416, 915)[p:127,tm:7] DOWN!
[   36.994795] ===fts_ts_interrupt===
[   36.998328] [FTS][B]P0(416, 915)[p:127,tm:7] DOWN!
[   36.998412] ===fts_ts_interrupt===
[   37.001946] [FTS][B]P0(416, 915)[p:127,tm:7] DOWN!
[   37.002015] ===fts_ts_interrupt===
[   37.005563] [FTS][B]P0(416, 915)[p:127,tm:7] DOWN!
[   37.006420] ===fts_ts_interrupt===
[   37.009957] [FTS][B]P0(416, 915)[p:127,tm:7] DOWN!
[   37.010020] ===fts_ts_interrupt===
[   37.013591] [FTS][B]P0(416, 915)[p:127,tm:7] DOWN!
[   37.013663] ===fts_ts_interrupt===
[   37.017212] [FTS][B]P0(416, 915)[p:127,tm:7] DOWN!
[   37.018041] ===fts_ts_interrupt===
[   37.021563] [FTS][B]P0(416, 915)[p:127,tm:7] DOWN!
[   37.021633] ===fts_ts_interrupt===
[   37.025169] [FTS][B]P0(416, 915)[p:127,tm:7] DOWN!
[   37.025244] ===fts_ts_interrupt===
[   37.028774] [FTS][B]P0(416, 915)[p:127,tm:7] DOWN!
[   37.029667] ===fts_ts_interrupt===
[   37.033368] [FTS][B]P0(416, 915)[p:127,tm:7] DOWN!
[   37.033500] ===fts_ts_interrupt===
[   37.037067] [FTS][B]P0(416, 915)[p:127,tm:7] DOWN!
[   37.037146] ===fts_ts_interrupt===
[   37.040669] [FTS][B]P0(416, 915)[p:127,tm:7] DOWN!
[   37.041327] ===fts_ts_interrupt===
[   37.044859] [FTS][B]P0(416, 915)[p:127,tm:8] DOWN!
[   37.044995] ===fts_ts_interrupt===
[   37.048540] [FTS][B]P0(416, 915)[p:127,tm:8] DOWN!
[   37.048615] ===fts_ts_interrupt===
[   37.052137] [FTS][B]P0(416, 915)[p:127,tm:8] DOWN!
[   37.052932] ===fts_ts_interrupt===
[   37.056444] [FTS][B]P0(416, 915)[p:127,tm:8] DOWN!
[   37.056516] ===fts_ts_interrupt===
[   37.060013] [FTS][B]P0(416, 915)[p:127,tm:8] DOWN!
[   37.060081] ===fts_ts_interrupt===
[   37.063591] [FTS][B]P0(416, 915)[p:127,tm:8] DOWN!
[   37.064536] ===fts_ts_interrupt===
[   37.068066] [FTS][B]P0(416, 911)[p:127,tm:8] DOWN!
[   37.068221] ===fts_ts_interrupt===
[   37.071862] [FTS][B]P0(416, 911)[p:127,tm:8] DOWN!
[   37.071979] ===fts_ts_interrupt===
[   37.075555] [FTS][B]P0(416, 911)[p:127,tm:8] DOWN!
[   37.076159] ===fts_ts_interrupt===
[   37.079674] [FTS][B]P0(416, 906)[p:127,tm:8] DOWN!
[   37.079787] ===fts_ts_interrupt===
[   37.083300] [FTS][B]P0(416, 906)[p:127,tm:8] DOWN!
[   37.083372] ===fts_ts_interrupt===
[   37.086888] [FTS][B]P0(416, 906)[p:127,tm:8] DOWN!
[   37.087779] ===fts_ts_interrupt===
[   37.091309] [FTS][B]P0(416, 901)[p:127,tm:8] DOWN!
[   37.091438] ===fts_ts_interrupt===
[   37.095001] [FTS][B]P0(416, 901)[p:127,tm:8] DOWN!
[   37.095072] ===fts_ts_interrupt===
[   37.098591] [FTS][B]P0(416, 901)[p:127,tm:8] DOWN!
[   37.099371] ===fts_ts_interrupt===
[   37.102884] [FTS][B]P0(416, 896)[p:127,tm:8] DOWN!
[   37.102986] ===fts_ts_interrupt===
[   37.106507] [FTS][B]P0(416, 896)[p:127,tm:8] DOWN!
[   37.106577] ===fts_ts_interrupt===
[   37.110100] [FTS][B]P0(416, 896)[p:127,tm:8] DOWN!
[   37.110990] ===fts_ts_interrupt===
[   37.114516] [FTS][B]P0(416, 890)[p:127,tm:8] DOWN!
[   37.114656] ===fts_ts_interrupt===
[   37.118185] [FTS][B]P0(416, 890)[p:127,tm:8] DOWN!
[   37.118257] ===fts_ts_interrupt===
[   37.121775] [FTS][B]P0(416, 890)[p:127,tm:8] DOWN!
[   37.122633] ===fts_ts_interrupt===
[   37.126157] [FTS][B]P0(415, 885)[p:127,tm:9] DOWN!
[   37.126264] ===fts_ts_interrupt===
[   37.129789] [FTS][B]P0(415, 885)[p:127,tm:9] DOWN!
[   37.129859] ===fts_ts_interrupt===
[   37.133369] [FTS][B]P0(415, 885)[p:127,tm:9] DOWN!
[   37.134244] ===fts_ts_interrupt===
[   37.137767] [FTS][B]P0(414, 879)[p:127,tm:9] DOWN!
[   37.137921] ===fts_ts_interrupt===
[   37.141442] [FTS][B]P0(414, 879)[p:127,tm:9] DOWN!
[   37.141533] ===fts_ts_interrupt===
[   37.145212] [FTS][B]P0(414, 879)[p:127,tm:9] DOWN!
[   37.145867] ===fts_ts_interrupt===
[   37.149407] [FTS][B]P0(413, 875)[p:127,tm:9] DOWN!
[   37.149534] ===fts_ts_interrupt===
[   37.153064] [FTS][B]P0(413, 875)[p:127,tm:9] DOWN!
[   37.153139] ===fts_ts_interrupt===
[   37.156673] [FTS][B]P0(413, 875)[p:127,tm:9] DOWN!
[   37.157480] ===fts_ts_interrupt===
[   37.161021] [FTS][B]P0(412, 871)[p:127,tm:9] DOWN!
[   37.161148] ===fts_ts_interrupt===
[   37.164670] [FTS][B]P0(412, 871)[p:127,tm:9] DOWN!
[   37.164742] ===fts_ts_interrupt===
[   37.168248] [FTS][B]P0(412, 871)[p:127,tm:9] DOWN!
[   37.169093] ===fts_ts_interrupt===
[   37.172617] [FTS][B]P0(411, 867)[p:127,tm:9] DOWN!
[   37.172726] ===fts_ts_interrupt===
[   37.176263] [FTS][B]P0(411, 867)[p:127,tm:9] DOWN!
[   37.176333] ===fts_ts_interrupt===
[   37.179855] [FTS][B]P0(411, 867)[p:127,tm:9] DOWN!
[   37.180736] ===fts_ts_interrupt===
[   37.184334] [FTS][B]P0(410, 864)[p:127,tm:9] DOWN!
[   37.184467] ===fts_ts_interrupt===
[   37.188007] [FTS][B]P0(410, 864)[p:127,tm:9] DOWN!
[   37.188080] ===fts_ts_interrupt===
[   37.191604] [FTS][B]P0(410, 864)[p:127,tm:9] DOWN!
[   37.192350] ===fts_ts_interrupt===
[   37.195866] [FTS][B]P0(410, 861)[p:127,tm:9] DOWN!
[   37.195969] ===fts_ts_interrupt===
[   37.199489] [FTS][B]P0(410, 861)[p:127,tm:9] DOWN!
[   37.199562] ===fts_ts_interrupt===
[   37.203086] [FTS][B]P0(410, 861)[p:127,tm:9] DOWN!
[   37.203937] ===fts_ts_interrupt===
[   37.207469] [FTS][B]P0(409, 858)[p:127,tm:9] DOWN!
[   37.207613] ===fts_ts_interrupt===
[   37.211260] [FTS][B]P0(409, 858)[p:127,tm:9] DOWN!
[   37.211374] ===fts_ts_interrupt===
[   37.214988] [FTS][B]P0(409, 858)[p:127,tm:9] DOWN!
[   37.215575] ===fts_ts_interrupt===
[   37.219187] [FTS][B]P0(409, 857)[p:127,tm:9] DOWN!
[   37.219419] ===fts_ts_interrupt===
[   37.223088] [FTS][B]P0(409, 857)[p:127,tm:9] DOWN!
[   37.223165] ===fts_ts_interrupt===
[   37.226768] [FTS][B]P0(409, 857)[p:127,tm:9] DOWN!
[   37.227213] ===fts_ts_interrupt===
[   37.230757] [FTS][B]P0(409, 856)[p:127,tm:9] DOWN!
[   37.231040] ===fts_ts_interrupt===
[   37.234579] [FTS][B]P0(409, 856)[p:127,tm:9] DOWN!
[   37.234654] ===fts_ts_interrupt===
[   37.238165] [FTS][B]P0(409, 856)[p:127,tm:9] DOWN!
[   37.238787] ===fts_ts_interrupt===
[   37.242318] [FTS][B]P0(409, 855)[p:127,tm:9] DOWN!
[   37.242431] ===fts_ts_interrupt===
[   37.245958] [FTS][B]P0(409, 855)[p:127,tm:9] DOWN!
[   37.246029] ===fts_ts_interrupt===
[   37.249569] [FTS][B]P0(409, 855)[p:127,tm:9] DOWN!
[   37.250381] ===fts_ts_interrupt===
[   37.253919] [FTS][B]P0(409, 855)[p:127,tm:9] DOWN!
[   37.253991] ===fts_ts_interrupt===
[   37.257536] [FTS][B]P0(409, 855)[p:127,tm:9] DOWN!
[   37.257608] ===fts_ts_interrupt===
[   37.261144] [FTS][B]P0(409, 855)[p:127,tm:9] DOWN!
[   37.261931] ===fts_ts_interrupt===
[   37.265459] [FTS][B]P0(409, 855)[p:127,tm:9] DOWN!
[   37.265530] ===fts_ts_interrupt===
[   37.266415] zram0: detected capacity change from 0 to 1073741824
[   37.269065] [FTS][B]P0(409, 855)[p:127,tm:9] DOWN!
[   37.269137] ===fts_ts_interrupt===
[   37.272680] [FTS][B]P0(409, 855)[p:127,tm:9] DOWN!
[   37.273499] ===fts_ts_interrupt===
[   37.277029] [FTS][B]P0(409, 854)[p:126,tm:8] DOWN!
[   37.277180] ===fts_ts_interrupt===
[   37.280724] [FTS][B]P0(409, 854)[p:126,tm:8] DOWN!
[   37.280838] ===fts_ts_interrupt===
[   37.284376] [FTS][B]P0(409, 854)[p:126,tm:8] DOWN!
[   37.284784] ===fts_ts_interrupt===
[   37.288339] [FTS][B]P0(410, 852)[p:126,tm:8] DOWN!
[   37.288461] ===fts_ts_interrupt===
[   37.291986] [FTS][B]P0(410, 852)[p:126,tm:8] DOWN!
[   37.292068] ===fts_ts_interrupt===
[   37.295603] [FTS][B]P0(410, 852)[p:126,tm:8] DOWN!
[   37.296239] ===fts_ts_interrupt===
[   37.329601] ETR is in use, disable it to change the mem_size
[   37.350907] input: hbtp_input as /devices/virtual/input/input5
[   37.361315] type=1400 audit(1547698152.929:65): avc: denied { read } for pid=580 comm="[email protected]" name="name" dev="sysfs" ino=41291 scontext=u:r:hal_gnss_qti:s0
[   37.361348] type=1400 audit(1547698156.589:66): avc: denied { read } for pid=2128 comm="hbtp_daemon" name="runtime_status" dev="sysfs" ino=28446 scontext=u:r:hbtp:s00
[   37.692776] [FTS][B]P0 UP!
[   37.711866] [FTS][B]Points All Up!
[   37.734637] Adding 1048572k swap on /dev/block/zram0.  Priority:32758 extents:1 across:1048572k SS
[   37.821525] msm_otg 78db000.usb: Avail curr from USB = 100
[   37.822842] android_work: sent uevent USB_STATE=DISCONNECTED
[   37.873520] big_min_freq_adjust: big min freq ajustment enabled
[   37.932857] android_work: sent uevent USB_STATE=CONNECTED
[   37.936374] android_work: sent uevent USB_STATE=DISCONNECTED
[   38.065974] configfs-gadget gadget: high-speed config #1: b
[   38.066034] diag: USB channel diag connected
[   38.071007] gbam_connect_work: Bam channel is not ready
[   38.071521] android_work: sent uevent USB_STATE=CONNECTED
[   38.071530] msm_otg 78db000.usb: Avail curr from USB = 500
[   38.075012] android_work: sent uevent USB_STATE=CONFIGURED
[   38.090942] gbam_connect_work: Bam channel is not ready
[   38.167623] SOH-D: Couldnt read /sys/class/power_supply/bms/charge_full rc = -19
[   38.167955] SOH-D: Couldnt read /sys/class/power_supply/bms/charge_full_design rc = -19
[   38.176187] healthd: battery l=50 v=4122 t=84.4 h=3 st=4 c=291 fc=0 cc=0 chg=u
[   38.230894] healthd: battery l=50 v=4122 t=84.4 h=3 st=4 c=291 fc=0 cc=0 chg=u
[   38.931428] IRQ6 no longer affine to CPU1
[   39.601749] init: Service 'vendor.vm_bms' (pid 2306) exited with status 255
[   39.601829] init: Sending signal 9 to service 'vendor.vm_bms' (pid 2306) process group...
[   39.607866] libprocessgroup: Successfully killed process cgroup uid 0 pid 2306 in 0ms
[   39.651374] IRQ6 no longer affine to CPU3
[   39.652011] IRQ6 no longer affine to CPU0
[   44.552636] init: starting service 'vendor.vm_bms'...
[   44.590143] init: Service 'vendor.vm_bms' (pid 2870) exited with status 255
[   44.590237] init: Sending signal 9 to service 'vendor.vm_bms' (pid 2870) process group...
[   44.596494] libprocessgroup: Successfully killed process cgroup uid 0 pid 2870 in 0ms
[   44.691807] IRQ6 no longer affine to CPU0
[   47.369408] init: processing action (vendor.bluetooth.dun.status=running) from (/vendor/etc/init/hw/init.qcom.rc:515)
[   47.371886] init: starting service 'vendor.bt-dun'...
[   49.559904] init: starting service 'vendor.vm_bms'...
[   49.609768] init: Service 'vendor.vm_bms' (pid 3141) exited with status 255
[   49.609857] init: Sending signal 9 to service 'vendor.vm_bms' (pid 3141) process group...
[   49.616456] libprocessgroup: Successfully killed process cgroup uid 0 pid 3141 in 0ms
[   54.570634] init: starting service 'vendor.vm_bms'...
[   54.629964] init: Service 'vendor.vm_bms' (pid 3149) exited with status 255
[   54.630065] init: Sending signal 9 to service 'vendor.vm_bms' (pid 3149) process group...
[   54.636860] libprocessgroup: Successfully killed process cgroup uid 0 pid 3149 in 0ms
[   59.582995] init: starting service 'vendor.vm_bms'...
[   59.632432] init: Service 'vendor.vm_bms' (pid 3150) exited with status 255
[   59.632515] init: Sending signal 9 to service 'vendor.vm_bms' (pid 3150) process group...
[   59.638506] libprocessgroup: Successfully killed process cgroup uid 0 pid 3150 in 0ms
[   64.149251] type=1400 audit(1547698156.959:67): avc: denied { read } for pid=2128 comm="hbtp_daemon" name="runtime_status" dev="sysfs" ino=28446 scontext=u:r:hbtp:s00
[   64.149348] type=1400 audit(1547698183.379:68): avc: denied { read } for pid=3157 comm="eaurora.snapcam" name="u:object_r:vendor_default_prop:s0" dev="tmpfs" ino=1740
[   64.385611] binder_alloc: 3157: binder_alloc_buf, no vma
[   64.385662] binder: 1218:3187 transaction failed 29189/-3, size 108-0 line 3140
[   64.592645] init: starting service 'vendor.vm_bms'...
[   64.627280] init: Service 'vendor.vm_bms' (pid 3198) exited with status 255
[   64.627349] init: Sending signal 9 to service 'vendor.vm_bms' (pid 3198) process group...
[   64.633395] libprocessgroup: Successfully killed process cgroup uid 0 pid 3198 in 0ms
[   69.601446] init: starting service 'vendor.vm_bms'...
[   69.632995] init: Service 'vendor.vm_bms' (pid 3258) exited with status 255
[   69.633063] init: Sending signal 9 to service 'vendor.vm_bms' (pid 3258) process group...
[   69.639031] libprocessgroup: Successfully killed process cgroup uid 0 pid 3258 in 0ms
[   72.152578] [FTS]fts_ts_suspend: Enter
[   72.152588] [FTS]fts_irq_disable: Enter
[   72.152603] [FTS]fts_irq_disable: Exit(279)
[   72.661239] i2c-msm-v2 78b7000.i2c: TIMEOUT_ERROR(val:510msec) misconfigured GPIO or slave pulling bus line(s) low
[   72.661239] : msgs(n:1 cur:0 tx) bc(rx:0 tx:2) mode:FIFO slv_addr:0x38 MSTR_STS:0x0c110000 OPER:0x000004c0
[   72.661343] [FTS][Error]fts_i2c_write: i2c_transfer(write) error, ret=-110
[   72.661709] i2c-msm-v2 78b7000.i2c: NACK: slave not responding, ensure its powered: msgs(n:1 cur:0 tx) bc(rx:0 tx:2) mode:FIFO slv_addr:0x38 MSTR_STS:0x0d1300c8 OPER0
[   72.661781] [FTS][Error]fts_i2c_write: i2c_transfer(write) error, ret=-107
[   72.662367] i2c-msm-v2 78b7000.i2c: NACK: slave not responding, ensure its powered: msgs(n:1 cur:0 tx) bc(rx:0 tx:2) mode:FIFO slv_addr:0x38 MSTR_STS:0x0d1300c8 OPER0
[   72.662446] [FTS][Error]fts_i2c_write: i2c_transfer(write) error, ret=-107
[   72.662455] [FTS][Error]set TP to sleep mode fail, ret=-107
[   72.662464] [FTS]fts_ts_suspend: Exit(1617)
[   72.940946] binder: undelivered TRANSACTION_COMPLETE
[   72.941010] binder: undelivered transaction 93072, process died.
[   72.949326] binder: undelivered transaction 93225, process died.
[   72.952598] binder: undelivered transaction 93224, process died.
[   73.634182] healthd: battery l=50 v=4154 t=85.0 h=3 st=4 c=0 fc=0 cc=0 chg=u
[   74.611938] init: starting service 'vendor.vm_bms'...
[   74.668355] init: Service 'vendor.vm_bms' (pid 3262) exited with status 255
[   74.668440] init: Sending signal 9 to service 'vendor.vm_bms' (pid 3262) process group...
[   74.674918] libprocessgroup: Successfully killed process cgroup uid 0 pid 3262 in 0ms
[   78.502759] [FTS]fts_ts_resume: Enter
[   78.502791] [FTS]fts_release_all_finger: Enter
[   78.506230] [FTS]fts_release_all_finger: Exit(572)
[   78.523103] [FTS]fts_power_source_ctrl: Enter
[   78.523135] [FTS]fts_power_source_ctrl: Exit(411)
[   78.526445] ===fts_ts_resume reset===
[   78.531217] [FTS]fts_reset_proc: Enter
[   78.770896] [FTS]fts_reset_proc: Exit(255)
[   78.773304] [FTS]fts_tp_state_recovery: Enter
[   79.280882] i2c-msm-v2 78b7000.i2c: TIMEOUT_ERROR(val:510msec) misconfigured GPIO or slave pulling bus line(s) low
[   79.280882] : msgs(n:2 cur:0 tx) bc(rx:1 tx:1) mode:FIFO slv_addr:0x38 MSTR_STS:0x0c000000 OPER:0x000000c0
[   79.281014] [FTS][Error][IIC]: i2c_transfer(write) error, ret=-110!!
[   79.620467] init: starting service 'vendor.vm_bms'...
[   79.654307] init: Service 'vendor.vm_bms' (pid 3294) exited with status 255
[   79.654379] init: Sending signal 9 to service 'vendor.vm_bms' (pid 3294) process group...
[   79.660391] libprocessgroup: Successfully killed process cgroup uid 0 pid 3294 in 0ms
[   79.800878] i2c-msm-v2 78b7000.i2c: TIMEOUT_ERROR(val:510msec) misconfigured GPIO or slave pulling bus line(s) low
[   79.800878] : msgs(n:2 cur:0 tx) bc(rx:1 tx:1) mode:FIFO slv_addr:0x38 MSTR_STS:0x0c000000 OPER:0x000000c0
[   79.801011] [FTS][Error][IIC]: i2c_transfer(write) error, ret=-110!!
[   80.320878] i2c-msm-v2 78b7000.i2c: TIMEOUT_ERROR(val:510msec) misconfigured GPIO or slave pulling bus line(s) low
[   80.320878] : msgs(n:2 cur:0 tx) bc(rx:1 tx:1) mode:FIFO slv_addr:0x38 MSTR_STS:0x0c000000 OPER:0x000000c0
[   80.321002] [FTS][Error][IIC]: i2c_transfer(write) error, ret=-110!!
[   80.340030] ===ID:reg_value=0===
[   80.346327] [FTS]TP Not Ready, ReadData = 0x0
[   80.961684] i2c-msm-v2 78b7000.i2c: TIMEOUT_ERROR(val:510msec) misconfigured GPIO or slave pulling bus line(s) low
[   80.961684] : msgs(n:2 cur:0 tx) bc(rx:1 tx:1) mode:FIFO slv_addr:0x38 MSTR_STS:0x0c000000 OPER:0x000000c0
[   80.961913] [FTS][Error][IIC]: i2c_transfer(write) error, ret=-110!!
[   80.981674] ===ID:reg_value=0===
[   80.987313] [FTS]TP Not Ready, ReadData = 0x0
[   81.601222] i2c-msm-v2 78b7000.i2c: TIMEOUT_ERROR(val:510msec) misconfigured GPIO or slave pulling bus line(s) low
[   81.601222] : msgs(n:2 cur:0 tx) bc(rx:1 tx:1) mode:FIFO slv_addr:0x38 MSTR_STS:0x0c000000 OPER:0x000000c0
[   81.601411] [FTS][Error][IIC]: i2c_transfer(write) error, ret=-110!!
[   81.621757] ===ID:reg_value=0===
[   81.626887] [FTS]TP Not Ready, ReadData = 0x0
[   81.732995] ===ID:reg_value=0===
[   81.734360] [FTS]TP Not Ready, ReadData = 0x0
[   82.351229] i2c-msm-v2 78b7000.i2c: TIMEOUT_ERROR(val:510msec) misconfigured GPIO or slave pulling bus line(s) low
[   82.351229] : msgs(n:2 cur:0 tx) bc(rx:1 tx:1) mode:FIFO slv_addr:0x38 MSTR_STS:0x0c000000 OPER:0x000000c0
[   82.351417] [FTS][Error][IIC]: i2c_transfer(write) error, ret=-110!!
[   82.882427] i2c-msm-v2 78b7000.i2c: TIMEOUT_ERROR(val:510msec) misconfigured GPIO or slave pulling bus line(s) low
[   82.882427] : msgs(n:2 cur:0 tx) bc(rx:1 tx:1) mode:FIFO slv_addr:0x38 MSTR_STS:0x0c000000 OPER:0x000000c0
[   82.882616] [FTS][Error][IIC]: i2c_transfer(write) error, ret=-110!!
[   83.411522] i2c-msm-v2 78b7000.i2c: TIMEOUT_ERROR(val:510msec) misconfigured GPIO or slave pulling bus line(s) low
[   83.411522] : msgs(n:2 cur:0 tx) bc(rx:1 tx:1) mode:FIFO slv_addr:0x38 MSTR_STS:0x0c000000 OPER:0x000000c0
[   83.411711] [FTS][Error][IIC]: i2c_transfer(write) error, ret=-110!!
[   83.430703] ===ID:reg_value=0===
[   83.437236] [FTS]TP Not Ready, ReadData = 0x0
[   83.575522] mdss_dsi_fifo_status: status=55551000


[ 1789.872701] i2c-msm-v2 78b7000.i2c: TIMEOUT_ERROR(val:510msec) misconfigured GPIO or slave pulling bus line(s) low
[ 1789.872701] : msgs(n:2 cur:0 tx) bc(rx:1 tx:1) mode:FIFO slv_addr:0x38 MSTR_STS:0x0c000000 OPER:0x000000c0
[ 1789.872890] [FTS][Error][IIC]: i2c_transfer(write) error, ret=-110!!

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-1.8.0-openjdk-amd64/bin/java 300

修改TZ端的QUPAC_stubs_Access_Drone.xml
QUP3由SPI改为I2C,默认TP可能是通过AP侧的SPI接口,通过QEE接口来和ADSP的touch库文件通信,强改成I2C可能造成ADSP库崩溃。
[   28.950147] init: Service 'cs-post-boot' (pid 2067) exited with status 0
[   29.065392] Fatal error on adsp!

[   28.679704] Fatal error on adsp!                                                                                                                                      
[   28.679744] adsp subsystem failure reason: SFR Init: wdog or kernel error suspected..                                                                                 
[   28.682036] subsys-restart: subsystem_restart_dev(): Restart sequence requested for adsp, restart_level = SYSTEM. 

用示波器量了probe和resume的读取ID的波形,两者波形一致,都是对的,读取0xA3寄存器地址都能读到值0x54,但是高通的I2C驱动的log就硬生生的报了错:
[   82.882616] [FTS][Error][IIC]: i2c_transfer(write) error, ret=-110!!
[   83.411522] i2c-msm-v2 78b7000.i2c: TIMEOUT_ERROR(val:510msec) misconfigured GPIO or slave pulling bus line(s) low

所以怀疑是TZ或BSP部分限制了kernel对I2C的使用,后经过组长调查,ADSP的目录下有一个touch相关的库:
adsp_proc/touch/touch_libs/439/libadsp_touch_static_partial.lib
受宏开关USES_TOUCH_INTEGRATION_ENABLED控制
去掉这个宏开关,TP就正常了。
========================================

你可能感兴趣的:(linux,嵌入式硬件,android)