}
};
-static int mt9m001_get_control(struct soc_camera_device *icd, struct v4l2_control *ctrl);
-static int mt9m001_set_control(struct soc_camera_device *icd, struct v4l2_control *ctrl);
+static int mt9m001_video_probe(struct soc_camera_device *);
+static void mt9m001_video_remove(struct soc_camera_device *);
+static int mt9m001_get_control(struct soc_camera_device *, struct v4l2_control *);
+static int mt9m001_set_control(struct soc_camera_device *, struct v4l2_control *);
static struct soc_camera_ops mt9m001_ops = {
.owner = THIS_MODULE,
+ .probe = mt9m001_video_probe,
+ .remove = mt9m001_video_remove,
.init = mt9m001_init,
.release = mt9m001_release,
.start_capture = mt9m001_start_capture,
.try_fmt_cap = mt9m001_try_fmt_cap,
.set_bus_param = mt9m001_set_bus_param,
.query_bus_param = mt9m001_query_bus_param,
- .formats = NULL, /* Filled in later depending on the */
- .num_formats = 0, /* camera type and data widths */
.controls = mt9m001_controls,
.num_controls = ARRAY_SIZE(mt9m001_controls),
.get_control = mt9m001_get_control,
case 0x8411:
case 0x8421:
mt9m001->model = V4L2_IDENT_MT9M001C12ST;
- mt9m001_ops.formats = mt9m001_colour_formats;
+ icd->formats = mt9m001_colour_formats;
if (mt9m001->client->dev.platform_data)
- mt9m001_ops.num_formats = ARRAY_SIZE(mt9m001_colour_formats);
+ icd->num_formats = ARRAY_SIZE(mt9m001_colour_formats);
else
- mt9m001_ops.num_formats = 1;
+ icd->num_formats = 1;
break;
case 0x8431:
mt9m001->model = V4L2_IDENT_MT9M001C12STM;
- mt9m001_ops.formats = mt9m001_monochrome_formats;
+ icd->formats = mt9m001_monochrome_formats;
if (mt9m001->client->dev.platform_data)
- mt9m001_ops.num_formats = ARRAY_SIZE(mt9m001_monochrome_formats);
+ icd->num_formats = ARRAY_SIZE(mt9m001_monochrome_formats);
else
- mt9m001_ops.num_formats = 1;
+ icd->num_formats = 1;
break;
default:
ret = -ENODEV;
/* Second stage probe - when a capture adapter is there */
icd = &mt9m001->icd;
- icd->probe = mt9m001_video_probe;
- icd->remove = mt9m001_video_remove;
icd->ops = &mt9m001_ops;
icd->control = &client->dev;
icd->x_min = 20;
}
};
-static int mt9v022_get_control(struct soc_camera_device *icd,
- struct v4l2_control *ctrl);
-static int mt9v022_set_control(struct soc_camera_device *icd,
- struct v4l2_control *ctrl);
+static int mt9v022_video_probe(struct soc_camera_device *);
+static void mt9v022_video_remove(struct soc_camera_device *);
+static int mt9v022_get_control(struct soc_camera_device *, struct v4l2_control *);
+static int mt9v022_set_control(struct soc_camera_device *, struct v4l2_control *);
static struct soc_camera_ops mt9v022_ops = {
.owner = THIS_MODULE,
+ .probe = mt9v022_video_probe,
+ .remove = mt9v022_video_remove,
.init = mt9v022_init,
.release = mt9v022_release,
.start_capture = mt9v022_start_capture,
.try_fmt_cap = mt9v022_try_fmt_cap,
.set_bus_param = mt9v022_set_bus_param,
.query_bus_param = mt9v022_query_bus_param,
- .formats = NULL, /* Filled in later depending on the */
- .num_formats = 0, /* sensor type and data widths */
.controls = mt9v022_controls,
.num_controls = ARRAY_SIZE(mt9v022_controls),
.get_control = mt9v022_get_control,
!strcmp("color", sensor_type))) {
ret = reg_write(icd, MT9V022_PIXEL_OPERATION_MODE, 4 | 0x11);
mt9v022->model = V4L2_IDENT_MT9V022IX7ATC;
- mt9v022_ops.formats = mt9v022_colour_formats;
+ icd->formats = mt9v022_colour_formats;
if (mt9v022->client->dev.platform_data)
- mt9v022_ops.num_formats = ARRAY_SIZE(mt9v022_colour_formats);
+ icd->num_formats = ARRAY_SIZE(mt9v022_colour_formats);
else
- mt9v022_ops.num_formats = 1;
+ icd->num_formats = 1;
} else {
ret = reg_write(icd, MT9V022_PIXEL_OPERATION_MODE, 0x11);
mt9v022->model = V4L2_IDENT_MT9V022IX7ATM;
- mt9v022_ops.formats = mt9v022_monochrome_formats;
+ icd->formats = mt9v022_monochrome_formats;
if (mt9v022->client->dev.platform_data)
- mt9v022_ops.num_formats = ARRAY_SIZE(mt9v022_monochrome_formats);
+ icd->num_formats = ARRAY_SIZE(mt9v022_monochrome_formats);
else
- mt9v022_ops.num_formats = 1;
+ icd->num_formats = 1;
}
if (ret >= 0)
i2c_set_clientdata(client, mt9v022);
icd = &mt9v022->icd;
- icd->probe = mt9v022_video_probe;
- icd->remove = mt9v022_video_remove;
icd->ops = &mt9v022_ops;
icd->control = &client->dev;
icd->x_min = 1;
{
unsigned int i;
- for (i = 0; i < icd->ops->num_formats; i++)
- if (icd->ops->formats[i].fourcc == fourcc)
- return icd->ops->formats + i;
+ for (i = 0; i < icd->num_formats; i++)
+ if (icd->formats[i].fourcc == fourcc)
+ return icd->formats + i;
return NULL;
}
WARN_ON(priv != file->private_data);
- if (f->index >= icd->ops->num_formats)
+ if (f->index >= icd->num_formats)
return -EINVAL;
- format = &icd->ops->formats[f->index];
+ format = &icd->formats[f->index];
strlcpy(f->description, format->name, sizeof(f->description));
f->pixelformat = format->fourcc;
to_soc_camera_host(icd->dev.parent);
int ret;
- if (!icd->probe)
+ if (!icd->ops->probe)
return -ENODEV;
/* We only call ->add() here to activate and probe the camera.
if (ret < 0)
return ret;
- ret = icd->probe(icd);
+ ret = icd->ops->probe(icd);
if (ret >= 0) {
const struct v4l2_queryctrl *qctrl;
{
struct soc_camera_device *icd = to_soc_camera_dev(dev);
- if (icd->remove)
- icd->remove(icd);
+ if (icd->ops->remove)
+ icd->ops->remove(icd);
return 0;
}
vdev->vidioc_s_register = soc_camera_s_register;
#endif
- icd->current_fmt = &icd->ops->formats[0];
+ icd->current_fmt = &icd->formats[0];
err = video_register_device(vdev, VFL_TYPE_GRABBER, vdev->minor);
if (err < 0) {
struct soc_camera_ops *ops;
struct video_device *vdev;
const struct soc_camera_data_format *current_fmt;
- int (*probe)(struct soc_camera_device *icd);
- void (*remove)(struct soc_camera_device *icd);
+ const struct soc_camera_data_format *formats;
+ int num_formats;
struct module *owner;
/* soc_camera.c private count. Only accessed with video_lock held */
int use_count;
struct soc_camera_ops {
struct module *owner;
+ int (*probe)(struct soc_camera_device *);
+ void (*remove)(struct soc_camera_device *);
int (*init)(struct soc_camera_device *);
int (*release)(struct soc_camera_device *);
int (*start_capture)(struct soc_camera_device *);
int (*get_register)(struct soc_camera_device *, struct v4l2_register *);
int (*set_register)(struct soc_camera_device *, struct v4l2_register *);
#endif
- const struct soc_camera_data_format *formats;
- int num_formats;
int (*get_control)(struct soc_camera_device *, struct v4l2_control *);
int (*set_control)(struct soc_camera_device *, struct v4l2_control *);
const struct v4l2_queryctrl *controls;