示例#1
0
/**
 * fimc_subdev_attach - attach v4l2_subdev to camera host interface
 *
 * @fimc: FIMC device information
 * @index: index to the array of available subdevices,
 *	   -1 for full array search or non negative value
 *	   to select specific subdevice
 */
static int fimc_subdev_attach(struct fimc_dev *fimc, int index)
{
    struct fimc_vid_cap *vid_cap = &fimc->vid_cap;
    struct s5p_platform_fimc *pdata = fimc->pdata;
    struct s5p_fimc_isp_info *isp_info;
    struct v4l2_subdev *sd;
    int i;

    for (i = 0; i < pdata->num_clients; ++i) {
        isp_info = &pdata->isp_info[i];

        if (index >= 0 && i != index)
            continue;

        sd = fimc_subdev_register(fimc, isp_info);
        if (!IS_ERR_OR_NULL(sd)) {
            vid_cap->sd = sd;
            vid_cap->input_index = i;

            return 0;
        }
    }

    vid_cap->input_index = -1;
    vid_cap->sd = NULL;
    v4l2_err(&vid_cap->v4l2_dev, "fimc%d: sensor attach failed\n",
             fimc->id);
    return -ENODEV;
}
示例#2
0
/**
 * fimc_subdev_attach - attach v4l2_subdev to camera host interface
 *
 * @fimc: FIMC device information
 * @index: index to the array of available subdevices,
 *	   -1 for full array search or non negative value
 *	   to select specific subdevice
 */
static int fimc_subdev_attach(struct fimc_dev *fimc, int index)
{
	struct fimc_vid_cap *vid_cap = &fimc->vid_cap;
	struct s3c_platform_fimc *pdata = fimc->pdata;
	struct s3c_fimc_isp_info *isp_info;
	struct v4l2_subdev *sd;
	int i;

	for (i = 0; i < FIMC_MAX_CAMIF_CLIENTS; ++i) {
		isp_info = pdata->isp_info[i];

		if (!isp_info || (index >= 0 && i != index))
			continue;

		sd = fimc_subdev_register(fimc, isp_info);
		if (sd) {
			vid_cap->sd = sd;
			vid_cap->input_index = i;

			return 0;
		}
	}

	vid_cap->input_index = -1;
	vid_cap->sd = NULL;
	v4l2_err(&vid_cap->v4l2_dev, "fimc%d: sensor attach failed\n",
		 fimc->id);
	return -ENODEV;
}