Commit b4905038 authored by Evgeniy Borisov's avatar Evgeniy Borisov Committed by Greg Kroah-Hartman

greybus: camera-gb: Extend the configure streams interface

Extending the configure streams interface with CSI params.
Getting CSI frequency data form configure streams response.
 * num_lanes - Number of CSI data lanes
 * clk_freq - CSI clock frequency in Hz
 * lines_per_second - Total number of lines in a second of
transmission (blanking included)

From the AP side we need to know for the CSI speed
configuration. This information is needed for dynamically
bandwidth calculations.

NOTE: Change should be along merged with corresponding
      interface change in kernel:
      "camera: Extend the configure streams
      interface with CSI params"
Signed-off-by: default avatarEvgeniy Borisov <eborisov@mm-sol.com>
Reviewed-by: default avatarGjorgji Rosikopulos <grosikopulos@mm-sol.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent ddb10c8a
......@@ -203,7 +203,8 @@ struct ap_csi_config_request {
static int gb_camera_configure_streams(struct gb_camera *gcam,
unsigned int *num_streams,
unsigned int *flags,
struct gb_camera_stream_config *streams)
struct gb_camera_stream_config *streams,
struct gb_camera_csi_params *csi_params)
{
struct gb_camera_configure_streams_request *req;
struct gb_camera_configure_streams_response *resp;
......@@ -309,6 +310,12 @@ static int gb_camera_configure_streams(struct gb_camera *gcam,
ret = gb_hd_output(gcam->connection->hd, &csi_cfg,
sizeof(csi_cfg),
GB_APB_REQUEST_CSI_TX_CONTROL, false);
if (csi_params) {
csi_params->num_lanes = csi_cfg.num_lanes;
/* Transmitting two bits per cycle. (DDR clock) */
csi_params->clk_freq = csi_cfg.bus_freq / 2;
csi_params->lines_per_second = csi_cfg.lines_per_second;
}
} else {
csi_cfg.csi_id = 1;
ret = gb_hd_output(gcam->connection->hd, &csi_cfg,
......@@ -442,7 +449,8 @@ static ssize_t gb_camera_op_capabilities(void *priv, char *data, size_t len)
}
static int gb_camera_op_configure_streams(void *priv, unsigned int *nstreams,
unsigned int *flags, struct gb_camera_stream *streams)
unsigned int *flags, struct gb_camera_stream *streams,
struct gb_camera_csi_params *csi_params)
{
struct gb_camera *gcam = priv;
struct gb_camera_stream_config *gb_streams;
......@@ -469,7 +477,7 @@ static int gb_camera_op_configure_streams(void *priv, unsigned int *nstreams,
gb_flags |= GB_CAMERA_CONFIGURE_STREAMS_TEST_ONLY;
ret = gb_camera_configure_streams(gcam, &gb_nstreams,
&gb_flags, gb_streams);
&gb_flags, gb_streams, csi_params);
if (ret < 0)
goto done;
if (gb_nstreams > *nstreams) {
......@@ -643,7 +651,8 @@ static ssize_t gb_camera_debugfs_configure_streams(struct gb_camera *gcam,
goto done;
}
ret = gb_camera_configure_streams(gcam, &nstreams, &flags, streams);
ret = gb_camera_configure_streams(gcam, &nstreams, &flags, streams,
NULL);
if (ret < 0)
goto done;
......
......@@ -24,10 +24,24 @@ struct gb_camera_stream {
unsigned int max_size;
};
/**
* struct gb_camera_csi_params - CSI configuration parameters
* @num_lanes: number of CSI data lanes
* @clk_freq: CSI clock frequency in Hz
* @lines_per_second: total number of lines in a second of transmission
* (blanking included)
*/
struct gb_camera_csi_params {
unsigned int num_lanes;
unsigned int clk_freq;
unsigned int lines_per_second;
};
struct gb_camera_ops {
ssize_t (*capabilities)(void *priv, char *buf, size_t len);
int (*configure_streams)(void *priv, unsigned int *nstreams,
unsigned int *flags, struct gb_camera_stream *streams);
unsigned int *flags, struct gb_camera_stream *streams,
struct gb_camera_csi_params *csi_params);
int (*capture)(void *priv, u32 request_id,
unsigned int streams, unsigned int num_frames,
size_t settings_size, const void *settings);
......
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