|
@@ -965,17 +965,25 @@ static int rj54n1_reg_init(struct i2c_client *client)
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
-static int rj54n1_try_fmt(struct v4l2_subdev *sd,
|
|
|
|
- struct v4l2_mbus_framefmt *mf)
|
|
|
|
|
|
+static int rj54n1_set_fmt(struct v4l2_subdev *sd,
|
|
|
|
+ struct v4l2_subdev_pad_config *cfg,
|
|
|
|
+ struct v4l2_subdev_format *format)
|
|
{
|
|
{
|
|
|
|
+ struct v4l2_mbus_framefmt *mf = &format->format;
|
|
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
|
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
|
struct rj54n1 *rj54n1 = to_rj54n1(client);
|
|
struct rj54n1 *rj54n1 = to_rj54n1(client);
|
|
const struct rj54n1_datafmt *fmt;
|
|
const struct rj54n1_datafmt *fmt;
|
|
|
|
+ int output_w, output_h, max_w, max_h,
|
|
|
|
+ input_w = rj54n1->rect.width, input_h = rj54n1->rect.height;
|
|
int align = mf->code == MEDIA_BUS_FMT_SBGGR10_1X10 ||
|
|
int align = mf->code == MEDIA_BUS_FMT_SBGGR10_1X10 ||
|
|
mf->code == MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_BE ||
|
|
mf->code == MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_BE ||
|
|
mf->code == MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_BE ||
|
|
mf->code == MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_BE ||
|
|
mf->code == MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE ||
|
|
mf->code == MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE ||
|
|
mf->code == MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_LE;
|
|
mf->code == MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_LE;
|
|
|
|
+ int ret;
|
|
|
|
+
|
|
|
|
+ if (format->pad)
|
|
|
|
+ return -EINVAL;
|
|
|
|
|
|
dev_dbg(&client->dev, "%s: code = %d, width = %u, height = %u\n",
|
|
dev_dbg(&client->dev, "%s: code = %d, width = %u, height = %u\n",
|
|
__func__, mf->code, mf->width, mf->height);
|
|
__func__, mf->code, mf->width, mf->height);
|
|
@@ -993,24 +1001,10 @@ static int rj54n1_try_fmt(struct v4l2_subdev *sd,
|
|
v4l_bound_align_image(&mf->width, 112, RJ54N1_MAX_WIDTH, align,
|
|
v4l_bound_align_image(&mf->width, 112, RJ54N1_MAX_WIDTH, align,
|
|
&mf->height, 84, RJ54N1_MAX_HEIGHT, align, 0);
|
|
&mf->height, 84, RJ54N1_MAX_HEIGHT, align, 0);
|
|
|
|
|
|
- return 0;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-static int rj54n1_s_fmt(struct v4l2_subdev *sd,
|
|
|
|
- struct v4l2_mbus_framefmt *mf)
|
|
|
|
-{
|
|
|
|
- struct i2c_client *client = v4l2_get_subdevdata(sd);
|
|
|
|
- struct rj54n1 *rj54n1 = to_rj54n1(client);
|
|
|
|
- const struct rj54n1_datafmt *fmt;
|
|
|
|
- int output_w, output_h, max_w, max_h,
|
|
|
|
- input_w = rj54n1->rect.width, input_h = rj54n1->rect.height;
|
|
|
|
- int ret;
|
|
|
|
-
|
|
|
|
- /*
|
|
|
|
- * The host driver can call us without .try_fmt(), so, we have to take
|
|
|
|
- * care ourseleves
|
|
|
|
- */
|
|
|
|
- rj54n1_try_fmt(sd, mf);
|
|
|
|
|
|
+ if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
|
|
|
|
+ cfg->try_fmt = *mf;
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
|
|
/*
|
|
/*
|
|
* Verify if the sensor has just been powered on. TODO: replace this
|
|
* Verify if the sensor has just been powered on. TODO: replace this
|
|
@@ -1026,9 +1020,6 @@ static int rj54n1_s_fmt(struct v4l2_subdev *sd,
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
- dev_dbg(&client->dev, "%s: code = %d, width = %u, height = %u\n",
|
|
|
|
- __func__, mf->code, mf->width, mf->height);
|
|
|
|
-
|
|
|
|
/* RA_SEL_UL is only relevant for raw modes, ignored otherwise. */
|
|
/* RA_SEL_UL is only relevant for raw modes, ignored otherwise. */
|
|
switch (mf->code) {
|
|
switch (mf->code) {
|
|
case MEDIA_BUS_FMT_YUYV8_2X8:
|
|
case MEDIA_BUS_FMT_YUYV8_2X8:
|
|
@@ -1255,8 +1246,6 @@ static int rj54n1_s_mbus_config(struct v4l2_subdev *sd,
|
|
|
|
|
|
static struct v4l2_subdev_video_ops rj54n1_subdev_video_ops = {
|
|
static struct v4l2_subdev_video_ops rj54n1_subdev_video_ops = {
|
|
.s_stream = rj54n1_s_stream,
|
|
.s_stream = rj54n1_s_stream,
|
|
- .s_mbus_fmt = rj54n1_s_fmt,
|
|
|
|
- .try_mbus_fmt = rj54n1_try_fmt,
|
|
|
|
.g_crop = rj54n1_g_crop,
|
|
.g_crop = rj54n1_g_crop,
|
|
.s_crop = rj54n1_s_crop,
|
|
.s_crop = rj54n1_s_crop,
|
|
.cropcap = rj54n1_cropcap,
|
|
.cropcap = rj54n1_cropcap,
|
|
@@ -1267,6 +1256,7 @@ static struct v4l2_subdev_video_ops rj54n1_subdev_video_ops = {
|
|
static const struct v4l2_subdev_pad_ops rj54n1_subdev_pad_ops = {
|
|
static const struct v4l2_subdev_pad_ops rj54n1_subdev_pad_ops = {
|
|
.enum_mbus_code = rj54n1_enum_mbus_code,
|
|
.enum_mbus_code = rj54n1_enum_mbus_code,
|
|
.get_fmt = rj54n1_get_fmt,
|
|
.get_fmt = rj54n1_get_fmt,
|
|
|
|
+ .set_fmt = rj54n1_set_fmt,
|
|
};
|
|
};
|
|
|
|
|
|
static struct v4l2_subdev_ops rj54n1_subdev_ops = {
|
|
static struct v4l2_subdev_ops rj54n1_subdev_ops = {
|