@@ -340,6 +340,10 @@ enum ar0144_pad_ids {
AR0144_NUM_PADS,
};
+enum ar0144_stream_ids {
+ AR0144_STREAM_IMAGE,
+};
+
struct ar0144_model {
bool mono;
};
@@ -526,7 +530,8 @@ static int ar0144_start_streaming(struct ar0144 *sensor,
int ret = 0;
u16 val;
- format = v4l2_subdev_state_get_format(state, AR0144_PAD_SOURCE);
+ format = v4l2_subdev_state_get_format(state, AR0144_PAD_SOURCE,
+ AR0144_STREAM_IMAGE);
crop = v4l2_subdev_state_get_crop(state, AR0144_PAD_IMAGE);
compose = v4l2_subdev_state_get_compose(state, AR0144_PAD_IMAGE);
info = ar0144_format_info(sensor, format->code, true);
@@ -873,7 +878,8 @@ static int ar0144_s_ctrl(struct v4l2_ctrl *ctrl)
* configuration.
*/
state = v4l2_subdev_get_locked_active_state(&sensor->sd);
- format = v4l2_subdev_state_get_format(state, AR0144_PAD_SOURCE);
+ format = v4l2_subdev_state_get_format(state, AR0144_PAD_SOURCE,
+ AR0144_STREAM_IMAGE);
info = ar0144_format_info(sensor, format->code, true);
crop = v4l2_subdev_state_get_crop(state, AR0144_PAD_IMAGE);
@@ -1166,7 +1172,8 @@ static int ar0144_enum_frame_size(struct v4l2_subdev *sd,
if (!info)
return -EINVAL;
- fmt = v4l2_subdev_state_get_format(state, AR0144_PAD_SOURCE);
+ fmt = v4l2_subdev_state_get_format(state, AR0144_PAD_SOURCE,
+ AR0144_STREAM_IMAGE);
break;
default:
@@ -1193,15 +1200,17 @@ static int ar0144_set_fmt(struct v4l2_subdev *sd,
format->which == V4L2_SUBDEV_FORMAT_ACTIVE)
return -EBUSY;
- /* The format can only be set on the source pad. */
- if (format->pad != AR0144_PAD_SOURCE)
+ /* The format can only be set for the image stream on the source pad. */
+ if (format->pad != AR0144_PAD_SOURCE ||
+ format->stream != AR0144_STREAM_IMAGE)
return v4l2_subdev_get_fmt(sd, state, format);
/*
* Only the media bus code can be updated on the source pad, dimensions
* are set by the compose on the image pad rectangle.
*/
- fmt = v4l2_subdev_state_get_format(state, AR0144_PAD_SOURCE);
+ fmt = v4l2_subdev_state_get_format(state, AR0144_PAD_SOURCE,
+ AR0144_STREAM_IMAGE);
info = ar0144_format_info(sensor, format->format.code, true);
fmt->code = ar0144_format_code(sensor, info);
@@ -1325,7 +1334,8 @@ static int ar0144_set_selection(struct v4l2_subdev *sd,
}
/* Propagate the compose rectangle to the output format. */
- fmt = v4l2_subdev_state_get_format(state, AR0144_PAD_SOURCE);
+ fmt = v4l2_subdev_state_get_format(state, AR0144_PAD_SOURCE,
+ AR0144_STREAM_IMAGE);
fmt->width = compose->width;
fmt->height = compose->height;
@@ -1345,7 +1355,8 @@ static int ar0144_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
return -EINVAL;
state = v4l2_subdev_lock_and_get_active_state(sd);
- fmt = v4l2_subdev_state_get_format(state, AR0144_PAD_SOURCE);
+ fmt = v4l2_subdev_state_get_format(state, AR0144_PAD_SOURCE,
+ AR0144_STREAM_IMAGE);
code = fmt->code;
v4l2_subdev_unlock_state(state);
@@ -1355,7 +1366,7 @@ static int ar0144_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
fd->num_entries = 1;
fd->entry[0].pixelcode = code;
- fd->entry[0].stream = 0;
+ fd->entry[0].stream = AR0144_STREAM_IMAGE;
fd->entry[0].bus.csi2.vc = 0;
fd->entry[0].bus.csi2.dt = info->dt;
@@ -1453,7 +1464,8 @@ static int ar0144_entity_init_state(struct v4l2_subdev *sd,
info = ar0144_format_info(sensor, 0, true);
- fmt = v4l2_subdev_state_get_format(state, AR0144_PAD_SOURCE);
+ fmt = v4l2_subdev_state_get_format(state, AR0144_PAD_SOURCE,
+ AR0144_STREAM_IMAGE);
fmt->width = AR0144_DEF_WIDTH;
fmt->height = AR0144_DEF_HEIGHT;
fmt->code = ar0144_format_code(sensor, info);
@@ -1530,7 +1542,8 @@ static int ar0144_init_subdev(struct ar0144 *sensor)
* rate) and blanking controls.
*/
state = v4l2_subdev_lock_and_get_active_state(sd);
- format = v4l2_subdev_state_get_format(state, AR0144_PAD_SOURCE);
+ format = v4l2_subdev_state_get_format(state, AR0144_PAD_SOURCE,
+ AR0144_STREAM_IMAGE);
info = ar0144_format_info(sensor, format->code, true);
ar0144_update_link_freqs(sensor, info);