From: Evgeniy Borisov Date: Wed, 6 Apr 2016 12:22:45 +0000 (+0300) Subject: greybus: camera-gb: Extend the configure streams interface X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b4905038965fb986d8496e47cc52a08428408ae5;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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: Evgeniy Borisov Reviewed-by: Gjorgji Rosikopulos Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/camera.c b/drivers/staging/greybus/camera.c index 6db89efb8f0e..d3ee5b7240db 100644 --- a/drivers/staging/greybus/camera.c +++ b/drivers/staging/greybus/camera.c @@ -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; diff --git a/drivers/staging/greybus/gb-camera.h b/drivers/staging/greybus/gb-camera.h index 273b4fa6dd4f..cc9c012249e2 100644 --- a/drivers/staging/greybus/gb-camera.h +++ b/drivers/staging/greybus/gb-camera.h @@ -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);