示例#1
0
int32_t ov8858_config(struct msm_sensor_ctrl_t *s_ctrl,
	void __user *argp)
{
	int32_t rc = 0;

	rc = msm_sensor_config(s_ctrl, argp);

	return rc;
}
int32_t imx081_sensor_config(struct msm_sensor_ctrl_t *s_ctrl,
	void __user *argp)
{
	struct sensorb_cfg_data *cdata = (struct sensorb_cfg_data *)argp;
	long rc = 0;
	mutex_lock(s_ctrl->msm_sensor_mutex);
	CDBG("%s:%d %s cfgtype = %d\n", __func__, __LINE__,
		s_ctrl->sensordata->sensor_name, cdata->cfgtype);
	switch (cdata->cfgtype) {
		case SHCFG_GET_I2C_DATA:
			rc = imx081_i2c_read(s_ctrl, argp);
			if(rc < 0){
				pr_err("%s imx081_i2c_read failed", __func__);
			}
			break;
		case CFG_WRITE_I2C_ARRAY:
			rc = imx081_i2c_write(s_ctrl, argp);
			if(rc < 0){
				pr_err("%s imx081_i2c_write failed", __func__);
			}
			break;
		case SHCFG_GET_SMEM_DATA:
			rc = imx081_smem_read(s_ctrl, argp);
			if(rc < 0){
				pr_err("%s imx081_smem_read failed", __func__);
			}
			break;
		case SHCFG_SET_SMEM_DATA:
			rc = imx081_smem_write(s_ctrl, argp);
			if(rc < 0){
				pr_err("%s imx081_smem_read failed", __func__);
			}
			break;
		default:
			mutex_unlock(s_ctrl->msm_sensor_mutex);
			rc = msm_sensor_config(s_ctrl, argp);
			return rc;
			break;
	}

	mutex_unlock(s_ctrl->msm_sensor_mutex);

	return rc;
}
int32_t ov2722_sub_sensor_config(struct msm_sensor_ctrl_t *s_ctrl,
	void __user *argp)
{
	struct sensorb_cfg_data *cdata = (struct sensorb_cfg_data *)argp;
	long rc = 0;

	switch (cdata->cfgtype) {
	case CFG_WRITE_I2C_ARRAY:
        {
            struct msm_camera_i2c_reg_setting conf_array;
            struct msm_camera_i2c_reg_array *reg_setting = NULL;
            struct msm_camera_i2c_reg_array *reg_setting_temp = NULL;
            int start_stream = 0;
            mutex_lock(s_ctrl->msm_sensor_mutex);

            if (s_ctrl->sensor_state != MSM_SENSOR_POWER_UP) {
                pr_err("[CAM]-sub, %s:%d failed: invalid state %d\n", __func__,
				__LINE__, s_ctrl->sensor_state);
                rc = -EFAULT;
                break;
            }

            if (copy_from_user(&conf_array,
			(void *)cdata->cfg.setting,
			sizeof(struct msm_camera_i2c_reg_setting))) {
			pr_err("[CAM]-sub, %s:%d failed\n", __func__, __LINE__);
			rc = -EFAULT;
			break;
            }

            if (!conf_array.size) {
			pr_err("[CAM]-sub, %s:%d failed\n", __func__, __LINE__);
			rc = -EFAULT;
			break;
            }

            reg_setting = kzalloc(conf_array.size *
			(sizeof(struct msm_camera_i2c_reg_array)), GFP_KERNEL);

            if (!reg_setting) {
			pr_err("[CAM]-sub, %s:%d failed\n", __func__, __LINE__);
			rc = -ENOMEM;
			break;
            }

            if (copy_from_user(reg_setting, (void *)conf_array.reg_setting,
			conf_array.size *
			sizeof(struct msm_camera_i2c_reg_array))) {
			pr_err("[CAM]-sub, %s:%d failed\n", __func__, __LINE__);
			kfree(reg_setting);
			rc = -EFAULT;
			break;
            }

            conf_array.reg_setting = reg_setting;
            reg_setting_temp = reg_setting;

            if (reg_setting_temp->reg_addr == 0x0100 && reg_setting_temp->reg_data == 0x01)
            {
                g_subcam_SOF = 0;
                start_stream = 1;
                pr_info("[CAM]-sub, %s:start_stream = 1\n", __func__);
            }
            if (reg_setting_temp->reg_addr == 0x0100 && reg_setting_temp->reg_data == 0x00)
            {
                g_subcam_no_ack = 0;
            }

			rc = s_ctrl->sensor_i2c_client->i2c_func_tbl->i2c_write_table(
				s_ctrl->sensor_i2c_client, &conf_array);

            kfree(reg_setting);

            if (start_stream == 1)
            {
                if (!strcmp(htc_get_bootmode(), "factory2"))
                    pr_info("[CAM]-sub, %s: MFG skip ov2722_check_SOF\n", __func__);
                else
                    rc = ov2722_check_SOF(s_ctrl);
            }
            mutex_unlock(s_ctrl->msm_sensor_mutex);
	    }
		break;
	default:
		rc = msm_sensor_config(s_ctrl, argp);
		break;
	}
	return rc;
}
示例#4
0
static int ov2720_sensor_config(void __user *argp)
{
	return (int) msm_sensor_config(&ov2720_s_ctrl, argp);
}