.. | .. |
---|
872 | 872 | struct imx214 *imx214 = to_imx214(sd); |
---|
873 | 873 | const struct imx214_mode *mode = imx214->cur_mode; |
---|
874 | 874 | |
---|
875 | | - mutex_lock(&imx214->mutex); |
---|
876 | 875 | fi->interval = mode->max_fps; |
---|
877 | | - mutex_unlock(&imx214->mutex); |
---|
878 | 876 | |
---|
879 | 877 | return 0; |
---|
880 | 878 | } |
---|
.. | .. |
---|
1445 | 1443 | if (fie->index >= imx214->cfg_num) |
---|
1446 | 1444 | return -EINVAL; |
---|
1447 | 1445 | |
---|
1448 | | - if (fie->code != IMX214_MEDIA_BUS_FMT) |
---|
1449 | | - return -EINVAL; |
---|
1450 | | - |
---|
| 1446 | + fie->code = IMX214_MEDIA_BUS_FMT; |
---|
1451 | 1447 | fie->width = imx214->support_modes[fie->index].width; |
---|
1452 | 1448 | fie->height = imx214->support_modes[fie->index].height; |
---|
1453 | 1449 | fie->interval = imx214->support_modes[fie->index].max_fps; |
---|
.. | .. |
---|
1455 | 1451 | return 0; |
---|
1456 | 1452 | } |
---|
1457 | 1453 | |
---|
1458 | | -static int imx214_g_mbus_config(struct v4l2_subdev *sd, |
---|
| 1454 | +static int imx214_g_mbus_config(struct v4l2_subdev *sd, unsigned int pad, |
---|
1459 | 1455 | struct v4l2_mbus_config *config) |
---|
1460 | 1456 | { |
---|
1461 | 1457 | struct imx214 *imx214 = to_imx214(sd); |
---|
.. | .. |
---|
1466 | 1462 | V4L2_MBUS_CSI2_CHANNEL_0 | |
---|
1467 | 1463 | V4L2_MBUS_CSI2_CONTINUOUS_CLOCK; |
---|
1468 | 1464 | |
---|
1469 | | - config->type = V4L2_MBUS_CSI2; |
---|
| 1465 | + config->type = V4L2_MBUS_CSI2_DPHY; |
---|
1470 | 1466 | config->flags = val; |
---|
1471 | 1467 | |
---|
1472 | 1468 | return 0; |
---|
| 1469 | +} |
---|
| 1470 | + |
---|
| 1471 | +#define CROP_START(SRC, DST) (((SRC) - (DST)) / 2 / 4 * 4) |
---|
| 1472 | +#define DST_WIDTH_2096 2096 |
---|
| 1473 | +#define DST_HEIGHT_1560 1560 |
---|
| 1474 | + |
---|
| 1475 | +static int imx214_get_selection(struct v4l2_subdev *sd, |
---|
| 1476 | + struct v4l2_subdev_pad_config *cfg, |
---|
| 1477 | + struct v4l2_subdev_selection *sel) |
---|
| 1478 | +{ |
---|
| 1479 | + struct imx214 *imx214 = to_imx214(sd); |
---|
| 1480 | + |
---|
| 1481 | + if (sel->target == V4L2_SEL_TGT_CROP_BOUNDS) { |
---|
| 1482 | + if (imx214->cur_mode->width == 2104) { |
---|
| 1483 | + sel->r.left = CROP_START(imx214->cur_mode->width, DST_WIDTH_2096); |
---|
| 1484 | + sel->r.width = DST_WIDTH_2096; |
---|
| 1485 | + sel->r.top = CROP_START(imx214->cur_mode->height, DST_HEIGHT_1560); |
---|
| 1486 | + sel->r.height = DST_HEIGHT_1560; |
---|
| 1487 | + } else { |
---|
| 1488 | + sel->r.left = CROP_START(imx214->cur_mode->width, |
---|
| 1489 | + imx214->cur_mode->width); |
---|
| 1490 | + sel->r.width = imx214->cur_mode->width; |
---|
| 1491 | + sel->r.top = CROP_START(imx214->cur_mode->height, |
---|
| 1492 | + imx214->cur_mode->height); |
---|
| 1493 | + sel->r.height = imx214->cur_mode->height; |
---|
| 1494 | + } |
---|
| 1495 | + return 0; |
---|
| 1496 | + } |
---|
| 1497 | + |
---|
| 1498 | + return -EINVAL; |
---|
1473 | 1499 | } |
---|
1474 | 1500 | |
---|
1475 | 1501 | static const struct dev_pm_ops imx214_pm_ops = { |
---|
.. | .. |
---|
1494 | 1520 | static const struct v4l2_subdev_video_ops imx214_video_ops = { |
---|
1495 | 1521 | .s_stream = imx214_s_stream, |
---|
1496 | 1522 | .g_frame_interval = imx214_g_frame_interval, |
---|
1497 | | - .g_mbus_config = imx214_g_mbus_config, |
---|
1498 | 1523 | }; |
---|
1499 | 1524 | |
---|
1500 | 1525 | static const struct v4l2_subdev_pad_ops imx214_pad_ops = { |
---|
.. | .. |
---|
1503 | 1528 | .enum_frame_interval = imx214_enum_frame_interval, |
---|
1504 | 1529 | .get_fmt = imx214_get_fmt, |
---|
1505 | 1530 | .set_fmt = imx214_set_fmt, |
---|
| 1531 | + .get_selection = imx214_get_selection, |
---|
| 1532 | + .get_mbus_config = imx214_g_mbus_config, |
---|
1506 | 1533 | }; |
---|
1507 | 1534 | |
---|
1508 | 1535 | static const struct v4l2_subdev_ops imx214_subdev_ops = { |
---|
.. | .. |
---|
1944 | 1971 | module_exit(sensor_mod_exit); |
---|
1945 | 1972 | |
---|
1946 | 1973 | MODULE_DESCRIPTION("Sony imx214 sensor driver"); |
---|
1947 | | -MODULE_LICENSE("GPL"); |
---|
| 1974 | +MODULE_LICENSE("GPL v2"); |
---|