summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/camera.c
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo.mondi@linaro.org>2016-02-23 11:22:48 +0100
committerGreg Kroah-Hartman <gregkh@google.com>2016-02-23 22:39:20 -0800
commit446091c999388f9365e8d206f70b0c1a860212a0 (patch)
tree1fb7658bd79f9b70c52ba456514937cee2545c97 /drivers/staging/greybus/camera.c
parent7f29aded453e0392391b831c196583c274ec2cfd (diff)
downloadlinux-446091c999388f9365e8d206f70b0c1a860212a0.tar.bz2
greybus: camera: Add CSI configuration parameters
Add CSI configuration parameters to the configure_stream operation response. Currently, only the total number of lines in a second is used to configure the the AP-Bridge CSI transmitter, all other parameters (number of CSI data lanes, and CSI bus clock frequency) are kept hard-coded for two reasons: 1) We need to configure the CSI receiver on AP side accordingly to these settings, before sending them to APB1 CSI transmitter. 2) We cannot use the camera module provided parameters as-is, but use those information to compute the required bandwidth on the CSI bus, and configure the # of CSI data lanes, and the CSI bus clock speed in a way that satisfies that bandwidth requirement. Signed-off-by: Jacopo Mondi <jacopo.mondi@linaro.org> Acked-by: Laurent Pinchart <laurent.pinchart@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/camera.c')
-rw-r--r--drivers/staging/greybus/camera.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/staging/greybus/camera.c b/drivers/staging/greybus/camera.c
index bb8bc175dc0a..3f205cbcb21b 100644
--- a/drivers/staging/greybus/camera.c
+++ b/drivers/staging/greybus/camera.c
@@ -162,6 +162,7 @@ struct ap_csi_config_request {
__u8 num_lanes;
__u8 padding;
__le32 bus_freq;
+ __le32 lines_per_second;
} __packed;
static int gb_camera_configure_streams(struct gb_camera *gcam,
@@ -254,7 +255,14 @@ static int gb_camera_configure_streams(struct gb_camera *gcam,
if (ret < 0)
goto done;
- /* Configure the CSI transmitter. Hardcode the parameters for now. */
+ /*
+ * Configure the APB1 CSI transmitter using the lines count reported by
+ * the camera module, but with hard-coded bus frequency and lanes number.
+ *
+ * TODO: use the clocking and size informations reported by camera module
+ * to compute the required CSI bandwidth, and configure the CSI receiver
+ * on AP side, and the CSI transmitter on APB1 side accordingly.
+ */
memset(&csi_cfg, 0, sizeof(csi_cfg));
if (nstreams) {
@@ -262,6 +270,7 @@ static int gb_camera_configure_streams(struct gb_camera *gcam,
csi_cfg.clock_mode = 0;
csi_cfg.num_lanes = 4;
csi_cfg.bus_freq = cpu_to_le32(960000000);
+ csi_cfg.lines_per_second = resp->lines_per_second;
ret = gb_hd_output(gcam->connection->hd, &csi_cfg,
sizeof(csi_cfg),
GB_APB_REQUEST_CSI_TX_CONTROL, false);