Commit 5b032710 authored by Gjorgji Rosikopulos's avatar Gjorgji Rosikopulos Committed by Greg Kroah-Hartman

greybus: camera: Update configure stream based on new interface

Interface has been changed.
return code will not return number of configured streams but
just error code.
Number of streams is passed as pointer and if operation result
is changed number of streams will be updated.

Flags are also used for information regarding configure stream
operation result.
Signed-off-by: default avatarGjorgji Rosikopulos <grosikopulos@mm-sol.com>
Acked-by: default avatarLaurent Pinchart <laurent.pinchart@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 24ac4fa4
...@@ -315,34 +315,47 @@ static enum v4l2_mbus_pixelcode gb_camera_gb_to_mbus(u16 gb_fmt) ...@@ -315,34 +315,47 @@ static enum v4l2_mbus_pixelcode gb_camera_gb_to_mbus(u16 gb_fmt)
return mbus_to_gbus_format[0].mbus_code; return mbus_to_gbus_format[0].mbus_code;
} }
static int gb_camera_op_configure_streams(void *priv, unsigned int nstreams, static int gb_camera_op_configure_streams(void *priv, unsigned int *nstreams,
struct gb_camera_stream *streams) unsigned int *flags, struct gb_camera_stream *streams)
{ {
struct gb_camera *gcam = priv; struct gb_camera *gcam = priv;
struct gb_camera_stream_config *gb_streams; struct gb_camera_stream_config *gb_streams;
unsigned int flags = 0; unsigned int gb_flags = 0;
unsigned int gb_nstreams = *nstreams;
unsigned int i; unsigned int i;
int ret; int ret;
if (nstreams > GB_CAMERA_MAX_STREAMS) if (gb_nstreams > GB_CAMERA_MAX_STREAMS)
return -EINVAL; return -EINVAL;
gb_streams = kzalloc(nstreams * sizeof(*gb_streams), GFP_KERNEL); gb_streams = kzalloc(gb_nstreams * sizeof(*gb_streams), GFP_KERNEL);
if (!gb_streams) if (!gb_streams)
return -ENOMEM; return -ENOMEM;
for (i = 0; i < nstreams; i++) { for (i = 0; i < gb_nstreams; i++) {
gb_streams[i].width = streams[i].width; gb_streams[i].width = streams[i].width;
gb_streams[i].height = streams[i].height; gb_streams[i].height = streams[i].height;
gb_streams[i].format = gb_streams[i].format =
gb_camera_mbus_to_gb(streams[i].pixel_code); gb_camera_mbus_to_gb(streams[i].pixel_code);
} }
ret = gb_camera_configure_streams(gcam, &nstreams, &flags, gb_streams); if (*flags & GB_CAMERA_IN_FLAG_TEST)
gb_flags |= GB_CAMERA_CONFIGURE_STREAMS_TEST_ONLY;
ret = gb_camera_configure_streams(gcam, &gb_nstreams,
&gb_flags, gb_streams);
if (ret < 0) if (ret < 0)
goto done; goto done;
if (gb_nstreams > *nstreams) {
ret = -EINVAL;
goto done;
}
*flags = 0;
if (gb_flags & GB_CAMERA_CONFIGURE_STREAMS_ADJUSTED)
*flags |= GB_CAMERA_OUT_FLAG_ADJUSTED;
for (i = 0; i < nstreams; i++) { for (i = 0; i < gb_nstreams; i++) {
streams[i].width = gb_streams[i].width; streams[i].width = gb_streams[i].width;
streams[i].height = gb_streams[i].height; streams[i].height = gb_streams[i].height;
streams[i].vc = gb_streams[i].vc; streams[i].vc = gb_streams[i].vc;
...@@ -352,6 +365,7 @@ static int gb_camera_op_configure_streams(void *priv, unsigned int nstreams, ...@@ -352,6 +365,7 @@ static int gb_camera_op_configure_streams(void *priv, unsigned int nstreams,
streams[i].pixel_code = streams[i].pixel_code =
gb_camera_gb_to_mbus(gb_streams[i].format); gb_camera_gb_to_mbus(gb_streams[i].format);
} }
*nstreams = gb_nstreams;
done: done:
kfree(gb_streams); kfree(gb_streams);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment