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;
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,
}
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;
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) {
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;
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);