コード例 #1
0
ファイル: hi351_v4l2.c プロジェクト: F4uzan/skernel_u0
static int32_t hi351_i2c_write_b_sensor(struct msm_camera_i2c_client *client, u8 baddr, u8 bdata)
{
	int32_t rc = -EIO;
	u8 buf[2];
	memset(buf, 0, sizeof(buf));

	if (DELAY_START == 1) {
		if (baddr == 0xFE) {
			msleep(bdata);
		}
		DELAY_START = 0;
		return 0;
	}
	else {
		if (baddr == 0x03 && bdata == 0xFE) {
			DELAY_START = 1;
			return 0;
		}
		else {

			buf[0] = baddr;
			buf[1] = bdata;

//			pr_err("hi351_i2c_write_b_sensor: 0x%x\n", baddr);
			rc = msm_camera_i2c_txdata(client, buf, 2);


			if (rc < 0)
				pr_err("i2c_write_w failed, addr = 0x%x, val = 0x%x!\n", baddr, bdata);
		}
	}
	return rc;
}
コード例 #2
0
ファイル: hi351_v4l2.c プロジェクト: F4uzan/skernel_u0
static int32_t hi351_sensor_write_init_settings(struct msm_camera_i2c_client *client,
								struct msm_camera_i2c_reg_conf *conf, uint16_t size)
{
	//BURST MODE

	int32_t rc = 0;
	int i;
	u8 buf[301];
	int bufIndex = 0;

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

	//for burst mode

	for (i = 0; i < size; i++) {

		if ( conf->dt == MSM_CAMERA_I2C_BURST_DATA && bufIndex < 301 ) {
			if(bufIndex == 0) {
				buf[bufIndex] = conf->reg_addr;
				bufIndex++;
				buf[bufIndex] = conf->reg_data;
				bufIndex++;
			}
			else {
				buf[bufIndex] = conf->reg_data;
				bufIndex++;
			}
		}
		else {
			if (bufIndex > 0) {
//				pr_err("hi351_sensor_write_init_settings: Burst Mode: bufIndex: %d\n", bufIndex);
				rc = msm_camera_i2c_txdata(client, buf, bufIndex);
				//pr_err("%s: BurstMODE write bufIndex = %d \n",__func__, bufIndex);
				bufIndex = 0;
				memset(buf, 0, sizeof(buf));
				if (rc < 0) {
					pr_err("%s: %d  failed Exit \n",__func__, __LINE__);
 					return rc;
				}
			}
			rc = hi351_i2c_write_b_sensor(client,
									conf->reg_addr,
									conf->reg_data);

			if (rc < 0) {
				pr_err("%s: %d  failed Exit \n",__func__, __LINE__);
 				return rc;
			}
		}
		conf++;

	}
	return rc;

}
コード例 #3
0
static int32_t s5k3h1gx_wrapper_i2c_write(struct msm_actuator_ctrl_t *a_ctrl,
	int16_t next_lens_position, void *params)
{
	int32_t rc = 0;
	unsigned char buf[2];
	uint8_t mode_mask = 0;
	if(params) {
		mode_mask = *((uint8_t*)params);
	}

	buf[0] = next_lens_position >> 4;
	buf[1] = ((next_lens_position & 0x000F) << 4) | mode_mask;
	rc = msm_camera_i2c_txdata(&a_ctrl->i2c_client, buf, 2);
	if (rc < 0) {
		pr_err("%s: write failed (%d)\n", __func__, rc);
	}

	return rc;
}