Ejemplo n.º 1
0
int s4OV8850AF_read_byte(u8 addr, u8 *data)
{
#if 1
	u8 buf;
	int ret = 0;

	buf = addr;
	
	ret = i2c_master_send(g_pstOV8850AF_I2Cclient, (const char*)&buf, 1);
	if (ret < 0) {
		OV8850AFDB("s4OV8850AF_read_byte send command error!!  ret=%d\n",ret);
		return -EFAULT;
	}
	ret = i2c_master_recv(g_pstOV8850AF_I2Cclient, (char*)&buf, 1);
	if (ret < 0) {
		OV8850AFDB("s4OV8850AF_read_byte reads data error!!  ret=%d\n",ret);
		return -EFAULT;
	}

	*data = buf;
	return 0;
	#else
	int  i4RetValue = 0;
	i4RetValue = iReadReg(addr,data,OV8850AF_VCM_WRITE_ID);
	if (i4RetValue < 0) 	{
		OV8850AFDB("s4OV8850AF_read_byte failed--Mbyte!! \n");
		return -1;
	}

	return 0;
	#endif
}
Ejemplo n.º 2
0
static kal_uint8 MT9P015_read_cmos_sensor(kal_uint16 addr)
{
  kal_int32 rt;
  kal_uint8 data;
  
  rt = iReadReg(addr, &data, MT9P015_sensor.read_id);
#ifdef __MT9P015_DEBUG_TRACE__
  if (rt < 0) printk("[MT9P015] I2C read %x error\n", addr);
#endif
  
  return data;
}
Ejemplo n.º 3
0
//Address: 2Byte, Data: 1Byte
static int iReadCAM_CAL(u16 a_u2Addr, u32 ui4_length, u8 * a_puBuff)
{
    #if 0
    int  i4RetValue = 0;
    char puReadCmd[2] = {(char)(a_u2Addr >> 8) , (char)(a_u2Addr & 0xFF)};
	g_pstI2Cclient->addr = (IMX214OTP_DEVICE_ID>> 1);

    //CAM_CALDB("[CAM_CAL] iReadCAM_CAL!! \n");   
    //CAM_CALDB("[CAM_CAL] i2c_master_send \n");
    i4RetValue = i2c_master_send(g_pstI2Cclient, puReadCmd, 2);
	
    if (i4RetValue != 2)
    {
        CAM_CALDB("[CAM_CAL] I2C send read address failed!! \n");
        return -1;
    }

    //CAM_CALDB("[CAM_CAL] i2c_master_recv \n");
    i4RetValue = i2c_master_recv(g_pstI2Cclient, (char *)a_puBuff, ui4_length);
	CAM_CALDB("[CAM_CAL][iReadCAM_CAL] Read 0x%x=0x%x \n", a_u2Addr, a_puBuff[0]);
    if (i4RetValue != ui4_length)
    {
        CAM_CALDB("[CAM_CAL] I2C read data failed!! \n");
        return -1;
    } 

    //CAM_CALDB("[CAM_CAL] iReadCAM_CAL done!! \n");
	#else
	int  i4RetValue = 0;

	i4RetValue=iReadReg(a_u2Addr,a_puBuff,IMX214OTP_DEVICE_ID);
	
	if (i4RetValue !=0)
		{
			CAM_CALDB("[CAM_CAL] I2C read data failed!! \n");
			return -1;
		} 	
	CAM_CALDB("[CAM_CAL][iReadCAM_CAL] Read 0x%x=0x%x \n", a_u2Addr, a_puBuff[0]);
	#endif
    return 0;
}
Ejemplo n.º 4
0
kal_uint16 OV8825AF_read_cmos_sensor(kal_uint32 addr)
{
	kal_uint16 get_byte=0;
    iReadReg((u16) addr ,(u8*)&get_byte,OV8825AF_VCM_WRITE_ID);
    return get_byte;
}
Ejemplo n.º 5
0
kal_uint16 HI704_read_cmos_sensor(kal_uint32 addr)
{
kal_uint16 get_byte=0;
    iReadReg((u16) addr ,(u8*)&get_byte,HI704_WRITE_ID);
    return get_byte;
}