1. 程式人生 > >26. 常見i2c地址_修改i2c速率

26. 常見i2c地址_修改i2c速率

一、 如何修改i2c 速率
    1. 在裝置驅動程式碼中i2c_probe(),新增:
        spin_lock(&kdsensor_drv_lock);
        g_pstI2Cclient->timing = i2cSpeed;    // 遇到過攝像頭讀不到id: 300 -> 100
        spin_unlock(&kdsensor_drv_lock);

    2. 直接修改預設值:
        dtsi:
        i2c2:[email protected] {
            compatible = "mediatek,mt6735m-i2c";
            cell-index = <2>;
            reg = <0x11009000 0x1000>;
            interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_LOW>,
                        <GIC_SPI 101 IRQ_TYPE_LEVEL_LOW>;
            def_speed = <100>;        // 修改為300khz -> 沒有生效
        };
    
        如果大於400,需要修改出錯判斷條件:
        kernel/driver/i2c/busses/i2c-qup.c
        qup_i2c_probe()
            of_property_read_u32(node, "clock-frequency", &clk_freq);
            if (!clk_freq || clk_freq > 400000) {    /* We support frequencies up to FAST Mode (400KHz) */
                dev_err(qup->dev, "clock frequency not supported %d\n",
                    clk_freq);
            }

1. tp
    GT5668        0x5d    (0xba>>1)
    GT9XX        0x5d    (0xba>>1)
    ft6xx6_ges    0x38    (0x70>>1)
    gsl915        0x40
    hxchipset    0x48
    icn85xx        0x48    (0x90>>1)
    mstar_22xx    0x26    (0x4c>>1)
    mstar_2256    0x26    (0x4c>>1)
    
2. gsensor
    mxc4005        0x15
    mxc6255        0x15
    mc3433        0x4c
    qma6981        0x12
    bmc156        0x10
	ICM20608D(使用驅動mpu6050)	0x69
    
3. alsps
    ap3426        0x1e
    epl259x        0x49
    stk3x1x        0x48
    
4. magnetometer
    bmc156        0x12
    mmc3524x    0x0d
    mmc5603x    0x30
	AK09918C	???
    
5. gyroscope
    bmg160        0x69
	ICM20608D(使用驅動mpu6050)	0x69