mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-15 15:15:47 +00:00
greybus: camera: Add support for flags to stream_configure
Add support for the flags field of the stream configure request that was recently added to the camera protocol and update the debugfs arguments parsing accordingly. The stream configure response layout is also updated to the latest protocol specification. Signed-off-by: Jacopo Mondi <jacopo.mondi@linaro.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
parent
aab4a1a368
commit
b787d413e0
2 changed files with 23 additions and 11 deletions
|
@ -76,6 +76,7 @@ struct gb_camera_stream_config {
|
||||||
|
|
||||||
static int gb_camera_configure_streams(struct gb_camera *gcam,
|
static int gb_camera_configure_streams(struct gb_camera *gcam,
|
||||||
unsigned int nstreams,
|
unsigned int nstreams,
|
||||||
|
unsigned int flags,
|
||||||
struct gb_camera_stream_config *streams)
|
struct gb_camera_stream_config *streams)
|
||||||
{
|
{
|
||||||
struct gb_camera_configure_streams_request *req;
|
struct gb_camera_configure_streams_request *req;
|
||||||
|
@ -99,7 +100,8 @@ static int gb_camera_configure_streams(struct gb_camera *gcam,
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
req->num_streams = cpu_to_le16(nstreams);
|
req->num_streams = nstreams;
|
||||||
|
req->flags = flags;
|
||||||
req->padding = 0;
|
req->padding = 0;
|
||||||
|
|
||||||
for (i = 0; i < nstreams; ++i) {
|
for (i = 0; i < nstreams; ++i) {
|
||||||
|
@ -117,9 +119,9 @@ static int gb_camera_configure_streams(struct gb_camera *gcam,
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
if (le16_to_cpu(resp->num_streams) > nstreams) {
|
if (resp->num_streams > nstreams) {
|
||||||
gcam_dbg(gcam, "got #streams %u > request %u\n",
|
gcam_dbg(gcam, "got #streams %u > request %u\n",
|
||||||
le16_to_cpu(resp->num_streams), nstreams);
|
resp->num_streams, nstreams);
|
||||||
ret = -EIO;
|
ret = -EIO;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
@ -169,7 +171,7 @@ static int gb_camera_configure_streams(struct gb_camera *gcam,
|
||||||
gcam_err(gcam, "failed to %s the CSI transmitter\n",
|
gcam_err(gcam, "failed to %s the CSI transmitter\n",
|
||||||
nstreams ? "start" : "stop");
|
nstreams ? "start" : "stop");
|
||||||
|
|
||||||
ret = le16_to_cpu(resp->num_streams);
|
ret = resp->num_streams;
|
||||||
|
|
||||||
done:
|
done:
|
||||||
kfree(req);
|
kfree(req);
|
||||||
|
@ -266,13 +268,13 @@ static ssize_t gb_camera_debugfs_configure_streams(struct gb_camera *gcam,
|
||||||
&gcam->debugfs.buffers[GB_CAMERA_DEBUGFS_BUFFER_STREAMS];
|
&gcam->debugfs.buffers[GB_CAMERA_DEBUGFS_BUFFER_STREAMS];
|
||||||
struct gb_camera_stream_config *streams;
|
struct gb_camera_stream_config *streams;
|
||||||
unsigned int nstreams;
|
unsigned int nstreams;
|
||||||
const char *sep = ";";
|
unsigned int flags;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
char *token;
|
char *token;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Retrieve number of streams to configure */
|
/* Retrieve number of streams to configure */
|
||||||
token = strsep(&buf, sep);
|
token = strsep(&buf, ";");
|
||||||
if (token == NULL)
|
if (token == NULL)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
@ -283,6 +285,14 @@ static ssize_t gb_camera_debugfs_configure_streams(struct gb_camera *gcam,
|
||||||
if (nstreams > GB_CAMERA_MAX_STREAMS)
|
if (nstreams > GB_CAMERA_MAX_STREAMS)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
token = strsep(&buf, ";");
|
||||||
|
if (token == NULL)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
ret = kstrtouint(token, 10, &flags);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
/* For each stream to configure parse width, height and format */
|
/* For each stream to configure parse width, height and format */
|
||||||
streams = kzalloc(nstreams * sizeof(*streams), GFP_KERNEL);
|
streams = kzalloc(nstreams * sizeof(*streams), GFP_KERNEL);
|
||||||
if (!streams)
|
if (!streams)
|
||||||
|
@ -320,7 +330,7 @@ static ssize_t gb_camera_debugfs_configure_streams(struct gb_camera *gcam,
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = gb_camera_configure_streams(gcam, nstreams, streams);
|
ret = gb_camera_configure_streams(gcam, nstreams, flags, streams);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
|
|
|
@ -1173,7 +1173,9 @@ struct gb_camera_stream_config_request {
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
struct gb_camera_configure_streams_request {
|
struct gb_camera_configure_streams_request {
|
||||||
__le16 num_streams;
|
__u8 num_streams;
|
||||||
|
__u8 flags;
|
||||||
|
#define GB_CAMERA_CONFIGURE_STREAMS_TEST_ONLY 0x01
|
||||||
__le16 padding;
|
__le16 padding;
|
||||||
struct gb_camera_stream_config_request config[0];
|
struct gb_camera_stream_config_request config[0];
|
||||||
} __packed;
|
} __packed;
|
||||||
|
@ -1190,10 +1192,10 @@ struct gb_camera_stream_config_response {
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
struct gb_camera_configure_streams_response {
|
struct gb_camera_configure_streams_response {
|
||||||
__le16 num_streams;
|
__u8 num_streams;
|
||||||
#define GB_CAMERA_CONFIGURE_STREAMS_ADJUSTED 0x01
|
|
||||||
__u8 flags;
|
__u8 flags;
|
||||||
__u8 padding;
|
#define GB_CAMERA_CONFIGURE_STREAMS_ADJUSTED 0x01
|
||||||
|
__le16 padding;
|
||||||
struct gb_camera_stream_config_response config[0];
|
struct gb_camera_stream_config_response config[0];
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue