return &mt9m114_res[index];
}
-static int mt9m114_res2size(unsigned int res, int *h_size, int *v_size)
+static int mt9m114_res2size(struct v4l2_subdev *sd, int *h_size, int *v_size)
{
+ struct mt9m114_device *dev = to_mt9m114_sensor(sd);
unsigned short hsize;
unsigned short vsize;
- switch (res) {
+ switch (dev->res) {
case MT9M114_RES_736P:
hsize = MT9M114_RES_736P_SIZE_H;
vsize = MT9M114_RES_736P_SIZE_V;
vsize = MT9M114_RES_960P_SIZE_V;
break;
default:
- WARN(1, "%s: Resolution 0x%08x unknown\n", __func__, res);
+ v4l2_err(sd, "%s: Resolution 0x%08x unknown\n", __func__,
+ dev->res);
return -EINVAL;
}
struct v4l2_subdev_pad_config *cfg,
struct v4l2_subdev_format *format)
{
- struct v4l2_mbus_framefmt *fmt = &format->format;
- struct mt9m114_device *dev = to_mt9m114_sensor(sd);
+ struct v4l2_mbus_framefmt *fmt = &format->format;
int width, height;
int ret;
if (format->pad)
return -EINVAL;
fmt->code = MEDIA_BUS_FMT_SGRBG10_1X10;
- ret = mt9m114_res2size(dev->res, &width, &height);
+ ret = mt9m114_res2size(sd, &width, &height);
if (ret)
return ret;
fmt->width = width;
struct v4l2_subdev_selection *sel)
{
struct i2c_client *client = v4l2_get_subdevdata(sd);
- struct mt9m114_device *dev = to_mt9m114_sensor(sd);
struct misensor_reg exp_reg;
int width, height;
int grid_width, grid_height;
grid_right = sel->r.left + sel->r.width - 1;
grid_bottom = sel->r.top + sel->r.height - 1;
- ret = mt9m114_res2size(dev->res, &width, &height);
+ ret = mt9m114_res2size(sd, &width, &height);
if (ret)
return ret;