int imx214_sunny_csi_disable(hwsensor_intf_t* si)
{
    int ret = 0;
    sensor_t* sensor = NULL;

    sensor = I2S(si);

    ret = hw_csi_pad.hw_csi_disable(0);//by hefei
    if(ret)
    {
        cam_err("failed to csi disable index 0 ");
        return ret;
    }

    return 0;
}
static int ov8865_resume(struct platform_device *pdev)
{
    int ret = 0;
    struct v4l2_event event =
    {
        .type = HWCAM_V4L2_EVENT_TYPE,
        .id = HWCAM_HARDWARE_RESUME,
    };
    cam_info("%s +", __func__);
    ret = hwsensor_notify(&pdev->dev,&event);
    if(ret!=0){
        cam_err("%s fail to notify resume event to video device user",__func__);
    }
    cam_info("%s -", __func__);
    return ret;
}
static int ncp6925_off(struct hisi_pmic_ctrl_t *pmic_ctrl)
{
	struct ncp6925_private_data_t *pdata;

	cam_info("%s enter.", __func__);

	if (NULL == pmic_ctrl) {
		cam_err("%s pmic_ctrl is NULL.", __func__);
		return -1;
	}

	pdata = (struct ncp6925_private_data_t *)pmic_ctrl->pdata;
	gpio_direction_input(pdata->pin[PMIC_POWER_CTRL]);

	return 0;
}
int imx278_csi_enable(hwsensor_intf_t* si)
{
    int ret = 0;
    sensor_t* sensor = NULL;

    sensor = I2S(si);

    ret = hw_csi_pad.hw_csi_enable(0, sensor->board_info->csi_lane, sensor->board_info->csi_mipi_clk);//by hefei
    if(ret)
    {
        cam_err("failed to csi enable index 0 ");
        return ret;
    }

    return 0;
}
static int tps61310_torch_mode(struct hisi_flash_ctrl_t *flash_ctrl,
	int data)
{
	struct hisi_flash_i2c_client *i2c_client;
	struct hisi_flash_i2c_fn_t *i2c_func;
	struct tps61310_private_data_t *pdata;
	unsigned char val;

	cam_info("%s data=%d.\n", __func__, data);

	if (NULL == flash_ctrl) {
		cam_err("%s flash_ctrl is NULL.", __func__);
		return -1;
	}

	i2c_client = flash_ctrl->flash_i2c_client;
	i2c_func = flash_ctrl->flash_i2c_client->i2c_func_tbl;
	pdata = (struct tps61310_private_data_t *)flash_ctrl->pdata;

	/*******************************************************
	 * TPS61310 REGISTER0[5:3] control LED1/3 tourch current,
	 * TPS61310 REGISTER0[2:0] control LED2 tourch current,
	 *******************************************************/
	if ((data < pdata->torch_led13_num) && (data < pdata->torch_led2_num)) {
		val = (((pdata->torch_led13[data] & 0x7) << 3)
			| (pdata->torch_led2[data] & 0x7));
		cam_debug("%s torch_led13=0x%x, torch_led2=0x%x.", __func__,
			pdata->torch_led13[data], pdata->torch_led2[data]);
	} else {
		cam_warn("%s data(%d) > torch_led13_num(%d) or torch_led2_num(%d)",
			__func__, data, pdata->torch_led13_num, pdata->torch_led2_num);
		val = (((pdata->torch_led13[pdata->torch_led13_num-1] & 0x7) << 3)
			| (pdata->torch_led2[pdata->torch_led2_num-1] & 0x7));
	}

	i2c_func->i2c_write(i2c_client, REGISTER0, val);

	i2c_func->i2c_read(i2c_client, REGISTER1, &val);
	i2c_func->i2c_write(i2c_client, REGISTER1, (val & MODE_CTRL_SHUTDONW) | TORCH_MODE_CTRL);
	i2c_func->i2c_read(i2c_client, REGISTER2, &val);
	i2c_func->i2c_write(i2c_client, REGISTER2, (val & MODE_CTRL_SHUTDONW) | TORCH_MODE_CTRL);

	/* start tourch mode */
	tps61310_set_strobe1(flash_ctrl, HIGH);
	tps61310_set_strobe0(flash_ctrl, HIGH);
	return 0;
}
static int tps61310_off(struct hisi_flash_ctrl_t *flash_ctrl)
{
	struct hisi_flash_i2c_client *i2c_client;
	struct hisi_flash_i2c_fn_t *i2c_func;
	struct tps61310_private_data_t *pdata;
	unsigned int state;
	unsigned char val;

	cam_debug("%s ernter.\n", __func__);

	if (NULL == flash_ctrl) {
		cam_err("%s flash_ctrl is NULL.", __func__);
		return -1;
	}

	if (STANDBY_MODE == flash_ctrl->state.mode) {
		cam_notice("%s flash led has been powered off.", __func__);
		return 0;
	}

	mutex_lock(flash_ctrl->hisi_flash_mutex);
	flash_ctrl->state.mode = STANDBY_MODE;
	flash_ctrl->state.data = 0;
	i2c_client = flash_ctrl->flash_i2c_client;
	i2c_func = flash_ctrl->flash_i2c_client->i2c_func_tbl;
	pdata = (struct tps61310_private_data_t *)flash_ctrl->pdata;

	state = gpio_get_value(pdata->pin[RESET]);
	if (state != LOW) {
		/*************************************************
		 * set flash mode ctrl reg
		 * REGISTER1[7:6] & REGISTER2[7:6]:
		 * 00:shutdown mode
		 *************************************************/
		i2c_func->i2c_read(i2c_client, REGISTER1, &val);
		i2c_func->i2c_write(i2c_client, REGISTER1, val & SHUTDOWN_MODE);
		i2c_func->i2c_read(i2c_client, REGISTER2, &val);
		i2c_func->i2c_write(i2c_client, REGISTER2, val & SHUTDOWN_MODE);
	}

	tps61310_set_strobe0(flash_ctrl, LOW);
	tps61310_set_strobe1(flash_ctrl, HIGH);
	tps61310_set_reset(flash_ctrl, LOW);
	mutex_unlock(flash_ctrl->hisi_flash_mutex);

	return 0;
}
Пример #7
0
static int db8131m_init(struct v4l2_subdev *sd, u32 val)
{
	/* struct i2c_client *client = v4l2_get_subdevdata(sd); */
	struct db8131m_state *state = to_state(sd);
	int err = -EINVAL;

	cam_dbg("E\n");

	/* set initial regster value */
	if (state->sensor_mode == SENSOR_CAMERA) {
		cam_info("load camera common setting\n");
		err = db8131m_write_regs(sd, db8131m_common_1,
			sizeof(db8131m_common_1) / \
			sizeof(db8131m_common_1[0]));

		msleep(150);

		err |= db8131m_write_regs(sd, db8131m_common_2,
			sizeof(db8131m_common_2) / \
			sizeof(db8131m_common_2[0]));
	} else {
		cam_info("load recording setting\n");
		err = db8131m_write_regs(sd, db8131m_common_1,
			sizeof(db8131m_common_1) / \
			sizeof(db8131m_common_1[0]));

		msleep(150);

		err = db8131m_write_regs(sd, db8131m_common_2,
			sizeof(db8131m_common_2) / \
			sizeof(db8131m_common_2[0]));
	}
	if (unlikely(err)) {
		cam_err("failed to init\n");
		return err;
	}

	/* We stop stream-output from sensor when starting camera. */
	err = db8131m_control_stream(sd, 0);
	if (unlikely(err < 0))
		return err;
	msleep(150);

	state->initialized = 1;

	return 0;
}
static int tps61310_set_strobe1(struct hisi_flash_ctrl_t *flash_ctrl,
	unsigned int state)
{
	struct tps61310_private_data_t *pdata;

	if (NULL == flash_ctrl) {
		cam_err("%s flash_ctrl is NULL.", __func__);
		return -1;
	}

	pdata = (struct tps61310_private_data_t *)flash_ctrl->pdata;

	cam_debug("%s strobe1=%d, state=%d.", __func__,
		pdata->pin[STROBE1], state);
	gpio_direction_output(pdata->pin[STROBE1], state);
	return 0;
}
Пример #9
0
static int hw_lm3642_flash_mode(struct hw_flash_ctrl_t *flash_ctrl,
	int data)
{
	struct hw_flash_i2c_client *i2c_client;
	struct hw_flash_i2c_fn_t *i2c_func;
	struct hw_lm3642_private_data_t *pdata;
	unsigned char val;

	cam_debug("%s data=%d.\n", __func__, data);
	cam_info("%s 220250 data=%d.\n", __func__, data);
	if (NULL == flash_ctrl) {
		cam_err("%s flash_ctrl is NULL.", __func__);
		return -1;
	}

	i2c_client = flash_ctrl->flash_i2c_client;
	i2c_func = flash_ctrl->flash_i2c_client->i2c_func_tbl;
	pdata = flash_ctrl->pdata;

	/* clear error flag,resume chip */
	i2c_func->i2c_read(i2c_client, REG_FLAGS, &val);
	i2c_func->i2c_read(i2c_client, REG_CURRENT_CONTROL, &val);

	/* set LED Flash current value */
	if (data < pdata->flash_led_num) {
		cam_info("%s flash_led=0x%x.", __func__,
			pdata->flash_led[data]);
		/* REG_CURRENT_CONTROL[3:0] control flash current */
		val = ((val & 0xf0) | (pdata->flash_led[data] & 0x0f));

	} else {
		cam_warn("%s data(%d) > flash_led_num(%d).", __func__,
			data, pdata->flash_led_num);
		/* REG_CURRENT_CONTROL[3:0] control flash current */
		val = ((val & 0xf0) | (pdata->flash_led[pdata->flash_led_num-1] & 0x0f));
	}

	i2c_func->i2c_write(i2c_client, REG_CURRENT_CONTROL, val);
	if (flash_ctrl->flash_mask_enable) {
		i2c_func->i2c_write(i2c_client, REG_ENABLE, MODE_FLASH|TX_PIN);
	} else {
		i2c_func->i2c_write(i2c_client, REG_ENABLE, MODE_FLASH);
	}

	return 0;
}
static int imx214_get_otp_af(struct hisi_sensor_ctrl_t *s_ctrl, void *data)
{
	struct sensor_cfg_data *cdata = (struct sensor_cfg_data *)data;
	int rc = 0;

	if (s_ctrl->sensor->sensor_otp.af_otp.af_otp_succeed) {
		memcpy(&cdata->cfg.af_otp, &s_ctrl->sensor->sensor_otp.af_otp,
			sizeof(struct hisi_sensor_af_otp));
		rc = 0;
	} else {
		cam_err("%s failed to get otp af.", __func__);
		memset(&cdata->cfg.af_otp, 0, sizeof(struct hisi_sensor_af_otp));
		rc = -1;
	}

	return rc;
}
static int hw_tps61310_set_reset(struct hw_flash_ctrl_t *flash_ctrl,
	unsigned int state)
{
	struct hw_tps61310_private_data_t *pdata;

	if (NULL == flash_ctrl) {
		cam_err("%s flash_ctrl is NULL.", __func__);
		return -1;
	}

	pdata = (struct hw_tps61310_private_data_t *)flash_ctrl->pdata;

	cam_debug("%s reset=%d, state=%d.", __func__,
		pdata->pin[RESET], state);
	gpio_direction_output(pdata->pin[RESET], state);
	return 0;
}
static int hw_lm3646_front_flash_mode(struct hw_flash_ctrl_t *flash_ctrl,
    int data)
{
    struct hw_flash_i2c_client *i2c_client;
    struct hw_flash_i2c_fn_t *i2c_func;
    struct hw_lm3646_front_private_data_t *pdata;
    unsigned char val;

    cam_info("%s data=%d.\n", __func__, data);
    if (NULL == flash_ctrl) {
        cam_err("%s flash_ctrl is NULL.", __func__);
        return -1;
    }

    i2c_client = flash_ctrl->flash_i2c_client;
    i2c_func = flash_ctrl->flash_i2c_client->i2c_func_tbl;
    pdata = flash_ctrl->pdata;

    /* clear error flag,resume chip */
    i2c_func->i2c_read(i2c_client, REG_FLAGS1, &val);
    i2c_func->i2c_read(i2c_client, REG_FLAGS2, &val);
    i2c_func->i2c_read(i2c_client, REG_LED1_FLASH_CURRENT_CONTROL, &val);

    /* set LED Flash current value */
    if (data < FLASH_LED_MAX) {
        cam_info("%s flash_led=0x%x.", __func__,
        pdata->flash_led[data]);
        /* REG_CURRENT_CONTROL[3:0] control flash current */
        val = ((val & 0x80) | (data & 0x7f));
    } else {
        cam_warn("%s data(%d) > flash_led_num(%d).", __func__,
        data, pdata->flash_led_num);
        /* REG_CURRENT_CONTROL[3:0] control flash current */
        val = ((val & 0x80) | (0x7f));
    }
    i2c_func->i2c_write(i2c_client, REG_MAX_CURRENT, 0x7c);
    i2c_func->i2c_write(i2c_client, REG_LED1_FLASH_CURRENT_CONTROL, 0x22);
    if (flash_ctrl->flash_mask_enable) {
        i2c_func->i2c_write(i2c_client, REG_ENABLE, 0xd3);
    } else {
        i2c_func->i2c_write(i2c_client, REG_ENABLE, 0xd3);
    }

    return 0;
}
static int pmu_led_flash_mode(struct hisi_flash_ctrl_t *flash_ctrl,
	int data)
{
	struct pmu_led_private_data_t *pdata;

	cam_debug("%s data=%d.\n", __func__, data);

	if (NULL == flash_ctrl) {
		cam_err("%s flash_ctrl is NULL.", __func__);
		return -1;
	}

	pum_led_flash_on = true;
	//hi6401_set_gain_for_flashlight(true);

	pdata = (struct pmu_led_private_data_t *)flash_ctrl->pdata;

	pmu_led_write(LED_CTRL1, pdata->led_ctrl_flash[LED_CTRL_1]);
	pmu_led_write(LED_CTRL2, pdata->led_ctrl_flash[LED_CTRL_2]);
	pmu_led_write(LED_CTRL3, pdata->led_ctrl_flash[LED_CTRL_3]);

	/* set LED Flash current value */
	if (data < pdata->flash_led_num) {
		cam_debug("%s flash_led=0x%x.", __func__,
			pdata->flash_led[data]);
		pmu_led_write(LED_CTRL4, (pdata->flash_led[data] & 0x0f));
	} else {
		cam_warn("%s data(%d) > flash_led_num(%d).", __func__,
			data, pdata->flash_led_num);
		pmu_led_write(LED_CTRL4, (pdata->flash_led[pdata->flash_led_num-1] & 0x0f));
	}

	pmu_led_write(LED_CTRL5, pdata->led_ctrl_flash[LED_CTRL_5]);
	if (flash_ctrl->flash_mask_enable) {
		pmu_led_write(LED_CTRL6, (pdata->led_ctrl_flash[LED_CTRL_6] & 0xf7));
	} else {
		pmu_led_write(LED_CTRL6, (pdata->led_ctrl_flash[LED_CTRL_6] | 0x8));
	}

	pmu_led_write(LED_CTRL7, pdata->led_ctrl_flash[LED_CTRL_7]);

	pmu_led_write(LED_CTRL2, LED_FLASH_ENABLE);

	return 0;
}
static int32_t hisi_sensor_platform_probe(struct platform_device *pdev,
	void *data)
{
	int32_t rc = 0;
	uint32_t group_id;
	struct hisi_sensor_ctrl_t *s_ctrl =
		(struct hisi_sensor_ctrl_t *)data;
	const char *sd_name = NULL;

	s_ctrl->pdev = pdev;
	s_ctrl->dev = &pdev->dev;
	group_id = s_ctrl->index ? HISI_CAMERA_SUBDEV_SENSOR1
				: HISI_CAMERA_SUBDEV_SENSOR0;

	if (!s_ctrl->sensor_v4l2_subdev_ops)
		s_ctrl->sensor_v4l2_subdev_ops = &hisi_sensor_subdev_ops;

	s_ctrl->hisi_sd.sd.internal_ops = &hisi_sensor_subdev_internal_ops;

	v4l2_subdev_init(&s_ctrl->hisi_sd.sd,
			s_ctrl->sensor_v4l2_subdev_ops);

	rc = of_property_read_string(pdev->dev.of_node, "hisi,sensor-name",
		&sd_name);
	cam_notice("%s name %s, rc %d\n", __func__, sd_name, rc);
	if (rc < 0) {
		cam_err("%s failed %d\n", __func__, __LINE__);
	}

	snprintf(s_ctrl->hisi_sd.sd.name,
		sizeof(s_ctrl->hisi_sd.sd.name), "%s",
		sd_name);

	cam_debug("%s sd.name is %s.\n", __func__, s_ctrl->hisi_sd.sd.name);

	v4l2_set_subdevdata(&s_ctrl->hisi_sd.sd, pdev);
	s_ctrl->hisi_sd.sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
	media_entity_init(&s_ctrl->hisi_sd.sd.entity, 0, NULL, 0);
	s_ctrl->hisi_sd.sd.entity.type = MEDIA_ENT_T_V4L2_SUBDEV;
	s_ctrl->hisi_sd.sd.entity.group_id = group_id;
	s_ctrl->hisi_sd.sd.entity.name = s_ctrl->hisi_sd.sd.name;
	hisi_sd_register(&s_ctrl->hisi_sd);

	return rc;
}
static int aat1290a_setGpio(void)
{
	int ret;
	int temp = 0;

	printk(KERN_DEBUG "[%s : %d]!!\n", __func__, __LINE__);

#if defined(CONFIG_S5C73M3) && defined(CONFIG_S5K6A3YX) /* D2 */
	/* FLASH_LED_UNLOCK*/
	gpio_set_value_cansleep(PM8921_MPP_PM_TO_SYS
		(PMIC_MPP_FLASH_LED_UNLOCK), 1);
#endif

	/* GPIO_CAM_FLASH_SW : tourch */
	gpio_set_value_cansleep(gpio_cam_flash_sw, 0);
	temp = gpio_get_value(gpio_cam_flash_sw);
	printk(KERN_DEBUG "[s5c73m3] check GPIO_CAM_FLASH_SW : %d\n", temp);
	usleep(1*1000);

	/* flash power 1.8V */
	l28 = regulator_get(NULL, "8921_lvs4");
	ret = regulator_enable(l28);
	if (ret)
		cam_err("error enabling regulator\n");
	usleep(1*1000);

	if (pmic_gpio_msm_flash_cntl_en) {
		gpio_set_value_cansleep(pmic_gpio_msm_flash_cntl_en, 1);
	} else {
		gpio_set_value_cansleep(GPIO_MSM_FLASH_CNTL_EN, 1);
		temp = gpio_get_value(GPIO_MSM_FLASH_CNTL_EN);
		printk(KERN_DEBUG "[s5c73m3] check Flash set GPIO : %d\n",
			temp);
	}
	isFlashCntlEn = true;
	usleep(1*1000);

	gpio_set_value_cansleep(GPIO_MSM_FLASH_NOW, 1);
	temp = gpio_get_value(GPIO_MSM_FLASH_NOW);
	printk(KERN_DEBUG "[s5c73m3] check Flash enable GPIO : %d\n", temp);
	usleep(1*1000);

	return 0;
}
static int ncp6925_seq_config(struct hisi_pmic_ctrl_t *pmic_ctrl, pmic_seq_index_t seq_index, u32 voltage, int state)
{
	u8 chx_enable_tmp = 0;
	u8 chx_enable = 0;
	u8 voltage_reg = 0;
	u8 voltage_val = 0;
	struct hisi_pmic_i2c_client *i2c_client;
	struct hisi_pmic_i2c_fn_t *i2c_func;
	int ret = 0;

	cam_info("%s enter.", __func__);

	if (NULL == pmic_ctrl) {
		cam_err("%s pmic_ctrl is NULL.", __func__);
		return -1;
	}

	i2c_client = pmic_ctrl->pmic_i2c_client;
	i2c_func = pmic_ctrl->pmic_i2c_client->i2c_func_tbl;

	chx_enable = voltage_map[seq_index].chx_enable;
	voltage_reg = voltage_map[seq_index].vout_reg;

	i2c_func->i2c_read(i2c_client, CHX_EN, &chx_enable_tmp);

	if (state == 1) {
		if (seq_index >= VOUT_BUCK_1)
			calc_buck_vlotage(voltage, &voltage_val);
		else
			calc_ldo_vlotage(voltage, &voltage_val);

		i2c_func->i2c_write(i2c_client, voltage_reg, voltage_val);
		msleep(1);
		i2c_func->i2c_write(i2c_client, CHX_EN, chx_enable_tmp | chx_enable);
		cam_info("%s chx_enable 0x%x, voltage_reg 0x%x, voltage_val 0x%x", __func__, chx_enable, voltage_reg, voltage_val);
	} else {
		i2c_func->i2c_write(i2c_client, CHX_EN, chx_enable_tmp & (~chx_enable));
		//i2c_func->i2c_write(i2c_client, voltage_reg, state);
	}

	i2c_func->i2c_read(i2c_client, CHX_ERR, &chx_enable_tmp);

	return ret;
}
static int pmu_led_exit(struct hisi_flash_ctrl_t *flash_ctrl)
{
	struct pmu_led_private_data_t *pdata;

	if (NULL == flash_ctrl) {
		cam_err("%s flash_ctrl is NULL.", __func__);
		return -1;
	}

	pum_led_flash_on = false;
	pdata = (struct pmu_led_private_data_t *)flash_ctrl->pdata;

#if 0
	regulator_put(pdata->led_vcc.consumer);
#endif
	iounmap(pdata->pmu_base);

	return 0;
}
int hisi_sensor_add(struct hisi_sensor_t *sensor)
{
	int i;

	for (i = 0; i < CAMERA_SENSOR_ARRAY_SIZE; i++) {
		if (NULL == sensor_array[sensor->sensor_info->sensor_index][i]) {
			sensor_array[sensor->sensor_info->sensor_index][i]
				= sensor;
			cam_debug("%s index=%d, i=%d, name=%s.\n", __func__,
			sensor->sensor_info->sensor_index, i,
			sensor->sensor_info->name);
			return 0;
		}
	}

	cam_err("%s: sensor_array[%d] is overflow!!!", __func__,
	sensor->sensor_info->sensor_index);
	return -EFAULT;
}
Пример #19
0
static int sr200pc20_set_capture_start(struct v4l2_subdev *sd)
{
	struct i2c_client *client = v4l2_get_subdevdata(sd);
	int err = -EINVAL;

	/* set initial regster value */
	cam_dbg("load sr200pc20_capture\n");
	err = sr200pc20_i2c_set_config_register(client,
									front_snapshot_normal_regs,
									SNAPSHOT_NORMAL_NUM_OF_REGS,
									"front_snapshot_normal_regs");
	if (unlikely(err)) {
		cam_err("failed to make capture\n");
		return err;
	}
	sr200pc20_get_exif(sd);
	cam_info("Capture ConfigSync\n");
	return err;
}
/* get format by flite video device command */
static int sr200_get_fmt(struct v4l2_subdev *subdev, struct v4l2_subdev_fh *fh,
			  struct v4l2_subdev_format *fmt)
{
	struct sr200_state *state = to_state(subdev);
	struct v4l2_mbus_framefmt *format;

	cam_err("Need to check\n");

	if (fmt->pad != 0)
		return -EINVAL;

	format = __find_format(state, fh, fmt->which, state->res_type);
	if (!format)
		return -EINVAL;

	fmt->format = *format;

	return 0;
}
static void sr200_set_framesize(struct v4l2_subdev *subdev,
				const struct sr200_framesize *frmsizes,
				u32 num_frmsize, bool preview)
{
	struct sr200_state *state = to_state(subdev);
	const struct sr200_framesize **found_frmsize = NULL;
	u32 width = state->req_fmt.width;
	u32 height = state->req_fmt.height;
	int i = 0;

	cam_info("%s: Requested Res %dx%d\n", __func__, width, height);

	found_frmsize = preview ?
		&state->preview.frmsize : &state->capture.frmsize;

	for (i = 0; i < num_frmsize; i++) {
		if ((frmsizes[i].width == width) &&
			(frmsizes[i].height == height)) {
			*found_frmsize = &frmsizes[i];
			break;
		}
	}

	if (*found_frmsize == NULL) {
		cam_err("%s: error, invalid frame size %dx%d\n",
			__func__, width, height);
		*found_frmsize = preview ?
			sr200_get_framesize(frmsizes, num_frmsize,
					PREVIEW_SZ_SVGA) :
			sr200_get_framesize(frmsizes, num_frmsize,
					CAPTURE_SZ_1MP);
		//BUG_ON(!(*found_frmsize));
	}

	if (preview)
		cam_info("Preview Res Set: %dx%d, index %d\n",
			(*found_frmsize)->width, (*found_frmsize)->height,
			(*found_frmsize)->index);
	else
		cam_info("Capture Res Set: %dx%d, index %d\n",
			(*found_frmsize)->width, (*found_frmsize)->height,
			(*found_frmsize)->index);
}
Пример #22
0
static int sr130pc10_set_frame_rate(struct v4l2_subdev *sd, u32 fps)
{
	struct i2c_client *client = v4l2_get_subdevdata(sd);
	int err = 0;

	cam_info("frame rate %d\n\n", fps);

	switch (fps) {
	case 7:
		cam_dbg("load sr130pc10_vt_7fps\n");
		err = sr130pc10_i2c_set_config_register(client,
										  front_fps_7_regs,
										  FPS_7_NUM_OF_REGS,
										  "front_fps_7_regs");
		break;
	case 10:
		cam_dbg("load sr130pc10_vt_10fps\n");
		err = sr130pc10_i2c_set_config_register(client,
										  front_fps_10_regs,
										  FPS_10_NUM_OF_REGS,
										  "front_fps_10_regs");
		break;
	case 15:
		cam_dbg("load sr130pc10_vt_15fps\n");
		err = sr130pc10_i2c_set_config_register(client,
										  front_fps_15_regs,
										  FPS_15_NUM_OF_REGS,
										  "front_fps_15_regs");
		break;
	default:
		err = sr130pc10_i2c_set_config_register(client,
										  front_fps_auto_regs,
										  FPS_AUTO_NUM_OF_REGS,
										  "front_fps_auto_regs");
		break;
	}
	if (unlikely(err < 0)) {
		cam_err("i2c_write for set framerate\n");
		return -EIO;
	}

	return err;
}
Пример #23
0
static int s5k8aay_sensor_power_down(struct msm_sensor_ctrl_t *s_ctrl)
{
	int rc = 0;
	int temp = 0;
	struct msm_camera_sensor_info *data = s_ctrl->sensordata;

	CAM_DEBUG(" E");

#ifdef CONFIG_LOAD_FILE
	s5k8aay_regs_table_exit();
#endif

	gpio_set_value_cansleep(data->sensor_platform_info->sensor_reset, 0);
	temp = gpio_get_value(data->sensor_platform_info->sensor_reset);

	gpio_set_value_cansleep(data->sensor_platform_info->sensor_stby, 0);
	temp = gpio_get_value(data->sensor_platform_info->sensor_stby);

	gpio_set_value_cansleep(data->sensor_platform_info->vt_sensor_reset, 0);
	temp = gpio_get_value(data->sensor_platform_info->vt_sensor_reset);
	usleep(10); /* 20clk = 0.833us */

	gpio_set_value_cansleep(data->sensor_platform_info->vt_sensor_stby, 0);
	temp = gpio_get_value(data->sensor_platform_info->vt_sensor_stby);

	/*CAM_MCLK0*/
	msm_cam_clk_enable(&s_ctrl->sensor_i2c_client->client->dev,
		cam_clk_info, &s_ctrl->cam_clk, ARRAY_SIZE(cam_clk_info), 0);

	gpio_tlmm_config(GPIO_CFG(data->sensor_platform_info->mclk, 0,
			GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
			GPIO_CFG_ENABLE);

	data->sensor_platform_info->sensor_power_off(1);

	rc = msm_camera_request_gpio_table(data, 0);
	if (rc < 0)
		cam_err(" request gpio failed");

	CAM_DEBUG(" X");

	return rc;
}
Пример #24
0
static int sr130pc10_set_sensor_mode(struct v4l2_subdev *sd,
					struct v4l2_control *ctrl)
{
	struct sr130pc10_state *state = to_state(sd);

	if ((ctrl->value != SENSOR_CAMERA) &&
	(ctrl->value != SENSOR_MOVIE)) {
		cam_err("ERR: Not support.(%d)\n", ctrl->value);
		return -EINVAL;
	}

	/* We does not support movie mode when in VT. */
	if ((ctrl->value == SENSOR_MOVIE) && state->vt_mode) {
		state->sensor_mode = SENSOR_CAMERA;
		cam_warn("ERR: Not support movie\n");
	} else
		state->sensor_mode = ctrl->value;

	return 0;
}
Пример #25
0
static int __used sr200pc20_i2c_write_byte(struct i2c_client *client,
					u16 subaddr, u16 data)
{
	u8 buf[2] = {0,};
	struct i2c_msg msg = {client->addr, 0, 2, buf};
	int err = 0;

	if (unlikely(!client->adapter)) {
		cam_err("%s: ERROR, can't search i2c client adapter\n",
			__func__);
		return -ENODEV;
	}

	buf[0] = subaddr & 0xFF;
	buf[1] = data & 0xFF;

	err = i2c_transfer(client->adapter, &msg, 1);

	return (err == 1)? 0 : -EIO;
}
static int hisi_sensor_subdev_internal_close(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
{
	struct hisi_sensor_ctrl_t *s_ctrl = get_sctrl(sd);
	int rc=0;
	struct sensor_cfg_data cdata = {0};
	cdata.cfgtype = CFG_SENSOR_POWER_DOWN;

	if (s_ctrl == NULL) {
		cam_err("%s get s_strl error", __func__);
		return -1;
	}
	if (s_ctrl->sensor == NULL || s_ctrl->sensor->func_tbl == NULL
		|| s_ctrl->csi_ctrl == NULL || s_ctrl->csi_ctrl->hisi_csi_disable == NULL)
		return rc;
	rc = s_ctrl->sensor->func_tbl->sensor_config(s_ctrl, (void *)(&cdata));
	rc |= s_ctrl->csi_ctrl->hisi_csi_disable(s_ctrl->sensor->sensor_info->csi_index);

	cam_notice(" enter %s,return value %d", __func__,rc);
	return rc;
}
Пример #27
0
static int sr130pc10_i2c_write_byte(struct i2c_client *client,
                                     unsigned short subaddr,
                                     unsigned short data)
{
	unsigned char buf[2] = {0,};
	struct i2c_msg msg = {client->addr, 0, 2, buf};
	int err = 0;

	if(!client->adapter) {
		cam_err(" ERROR! can't search i2c client adapter\n");
		return -EIO;
	}

	buf[0] = subaddr & 0xFF;
	buf[1] = data & 0xFF;

	err = i2c_transfer(client->adapter, &msg, 1);

	return (err == 1)? 0 : -EIO;
}
int
    ov8865_carrera_config(
        hwsensor_intf_t* si,
void  *argp)
{
    struct sensor_cfg_data *data;

    int ret =0;
    data = (struct sensor_cfg_data *)argp;
    cam_debug("ov8865_carrera cfgtype = %d",data->cfgtype);
    switch(data->cfgtype){
        case SEN_CONFIG_POWER_ON:
            ret = si->vtbl->power_up(si);
        break;
        case SEN_CONFIG_POWER_OFF:
            ret = si->vtbl->power_down(si);
        break;
        case SEN_CONFIG_WRITE_REG:
        break;
        case SEN_CONFIG_READ_REG:
        break;
        case SEN_CONFIG_WRITE_REG_SETTINGS:
        break;
        case SEN_CONFIG_READ_REG_SETTINGS:
        break;
        case SEN_CONFIG_ENABLE_CSI:
            ret = si->vtbl->csi_enable(si);
        break;
        case SEN_CONFIG_DISABLE_CSI:
            ret = si->vtbl->csi_disable(si);
        break;
        case SEN_CONFIG_MATCH_ID:
            ret = si->vtbl->match_id(si,argp);
        break;
        default:
            cam_err("%s cfgtype(%d) is error", __func__, data->cfgtype);
        break;
    }
    cam_debug("%s exit",__func__);
    return ret;
}
Пример #29
0
int ad5816_ioctl(hw_vcm_intf_t *vcm_intf, void *data)
{
	struct hw_vcm_cfg_data *cdata = (struct hw_vcm_cfg_data*)data;
	int rc = 0;

	cam_debug("%s enter.\n", __func__);

	switch (cdata->cfgtype) {
	case CFG_VCM_SET_CFG:
		break;
	case CFG_VCM_GET_OTP_AF:
		rc = ad5816_get_otp_af(vcm_intf, data);
		break;
	default:
		rc = -EFAULT;
		cam_err("%s, invalid vcm type(%d)! \n", __func__, cdata->cfgtype);
		break;
	}

	return rc;
}
Пример #30
0
static int hw_lm3642_exit(struct hw_flash_ctrl_t *flash_ctrl)
{
	struct hw_lm3642_private_data_t *pdata;

	cam_debug("%s ernter.\n", __func__);

	if (NULL == flash_ctrl) {
		cam_err("%s flash_ctrl is NULL.", __func__);
		return -1;
	}

	flash_ctrl->func_tbl->flash_off(flash_ctrl);

	pdata = (struct hw_lm3642_private_data_t *)flash_ctrl->pdata;

	gpio_free(pdata->strobe);
	flash_ctrl->pctrl = devm_pinctrl_get_select(flash_ctrl->dev,
						PINCTRL_STATE_IDLE);

	return 0;
}