diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2016-02-14 02:33:06 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2016-02-15 14:55:17 -0800 |
commit | 66c3607076e7e801ab20077dc2d0ed45693eea10 (patch) | |
tree | 5515b9f70717886c05ffc928357ff024712e52f5 /drivers/staging/greybus/camera.c | |
parent | b573b0e65616c1ae5c5dd2c14fd62d3ded3d5466 (diff) |
greybus: camera: Set power mode after configuring streams
There's no need to set the power mode before configuring streams, doing
it after simplifies code.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Gjorgji Rosikopulos <grosikopulos@mm-sol.com>
Tested-by: Jacopo Mondi <jacopo.mondi@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.c | 43 |
1 files changed, 16 insertions, 27 deletions
diff --git a/drivers/staging/greybus/camera.c b/drivers/staging/greybus/camera.c index 25dbf690e1fc..7eef6eceec6c 100644 --- a/drivers/staging/greybus/camera.c +++ b/drivers/staging/greybus/camera.c @@ -192,21 +192,6 @@ static int gb_camera_configure_streams(struct gb_camera *gcam, goto done; } - /* - * Setup unipro link speed before actually issuing configuration - * to the camera module, to assure unipro network speed is set - * before CSI interfaces gets configured - */ - if (nstreams && !(*flags & GB_CAMERA_CONFIGURE_STREAMS_TEST_ONLY)) { - ret = gb_camera_set_power_mode(gcam, true); - if (ret < 0) - goto done; - } else if (nstreams == 0) { - ret = gb_camera_set_power_mode(gcam, false); - if (ret < 0) - goto done; - } - req->num_streams = nstreams; req->flags = *flags; req->padding = 0; @@ -224,19 +209,19 @@ static int gb_camera_configure_streams(struct gb_camera *gcam, GB_CAMERA_TYPE_CONFIGURE_STREAMS, req, req_size, resp, resp_size); if (ret < 0) - goto set_unipro_slow_mode; + goto done; if (resp->num_streams > nstreams) { gcam_dbg(gcam, "got #streams %u > request %u\n", resp->num_streams, nstreams); ret = -EIO; - goto set_unipro_slow_mode; + goto done; } if (resp->padding != 0) { gcam_dbg(gcam, "response padding != 0"); ret = -EIO; - goto set_unipro_slow_mode; + goto done; } for (i = 0; i < nstreams; ++i) { @@ -253,14 +238,25 @@ static int gb_camera_configure_streams(struct gb_camera *gcam, if (cfg->padding[0] || cfg->padding[1] || cfg->padding[2]) { gcam_dbg(gcam, "stream #%u padding != 0", i); ret = -EIO; - goto set_unipro_slow_mode; + goto done; } } if (nstreams && resp->flags & GB_CAMERA_CONFIGURE_STREAMS_ADJUSTED) { *flags = resp->flags; *num_streams = resp->num_streams; - goto set_unipro_slow_mode; + goto done; + } + + /* Setup unipro link speed. */ + if (nstreams && !(*flags & GB_CAMERA_CONFIGURE_STREAMS_TEST_ONLY)) { + ret = gb_camera_set_power_mode(gcam, true); + if (ret < 0) + goto done; + } else if (nstreams == 0) { + ret = gb_camera_set_power_mode(gcam, false); + if (ret < 0) + goto done; } memset(&csi_cfg, 0, sizeof(csi_cfg)); @@ -289,13 +285,6 @@ static int gb_camera_configure_streams(struct gb_camera *gcam, *num_streams = resp->num_streams; ret = 0; - kfree(req); - kfree(resp); - return ret; - -set_unipro_slow_mode: - ret = gb_camera_set_power_mode(gcam, false); - done: kfree(req); kfree(resp); |