static int sensor_subdev_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
{
	struct sensor_info *info = to_sensor(sd);
	int ret = 0;
	struct platform_device *pdev;
	int irq = 0;

	v4l2_dbg(1, sensor_debug, sd, "%s", __func__);

	ret = sensor_set_clock(sd, FLITE_ID_C);
	if (ret < 0) {
		sensor_err("sensor set clock fail");
		return ret;
	}

	ret = sensor_init_controls(info);
	if (ret < 0) {
		sensor_err("sensor init contols fail");
		return ret;
	}

	fh->vfh.ctrl_handler = &info->handle;
	sensor_init_formats(sd, fh);

	pdev = get_mipi_csis_pdev(FLITE_ID_C);
	irq = platform_get_irq(pdev, 0);
	v4l2_dbg(1, sensor_debug, sd, "%s : mipi irq num : %d", __func__, irq);

	enable_irq(irq);

	return 0;
}
Пример #2
0
static int sensor_s_power(struct v4l2_subdev *sd, int on)
{
	struct sensor_info *info = to_sensor(sd);
	int ret;

	if (on) {

		/*
		 * HACK
		 * s_power of flite make mux to change to ipll and then
		 * mclk for vision should be cacaluate again after mux setting changes
		 * vision clock source is channel 2
		 */
		ret = sensor_set_clock(sd, FLITE_ID_C);
		if (ret < 0)
			sensor_err("sensor set clock fail");

		ret = sensor_power(info, true);
		if (!ret)
			ret = sensor_setup_default(sd);
	} else {
		ret = sensor_power(info, false);
	}

	return ret;
}