From f4b996231d52437f67e81f2a0032edca214bb563 Mon Sep 17 00:00:00 2001 From: Jacob Chen Date: Tue, 22 Aug 2017 17:27:05 +0800 Subject: [PATCH] media: i2c: tc35874x: use lane num form dts Change-Id: Ia65e1e25249113e18e4df6a688bbf5cea949b36d Signed-off-by: Jacob Chen --- drivers/media/i2c/tc35874x.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/drivers/media/i2c/tc35874x.c b/drivers/media/i2c/tc35874x.c index 4ab56dee0e40..6cc03d15654b 100644 --- a/drivers/media/i2c/tc35874x.c +++ b/drivers/media/i2c/tc35874x.c @@ -663,29 +663,14 @@ static void tc35874x_set_csi_color_space(struct v4l2_subdev *sd) } } -static unsigned tc35874x_num_csi_lanes_needed(struct v4l2_subdev *sd) -{ - struct tc35874x_state *state = to_state(sd); - struct v4l2_bt_timings *bt = &state->timings.bt; - struct tc35874x_platform_data *pdata = &state->pdata; - u32 bits_pr_pixel = - (state->mbus_fmt_code == MEDIA_BUS_FMT_UYVY8_1X16) ? 16 : 24; - u32 bps = bt->width * bt->height * fps(bt) * bits_pr_pixel; - u32 bps_pr_lane = (pdata->refclk_hz / pdata->pll_prd) * pdata->pll_fbd; - - return DIV_ROUND_UP(bps, bps_pr_lane); -} - static void tc35874x_set_csi(struct v4l2_subdev *sd) { struct tc35874x_state *state = to_state(sd); struct tc35874x_platform_data *pdata = &state->pdata; - unsigned lanes = tc35874x_num_csi_lanes_needed(sd); + unsigned lanes = state->csi_lanes_in_use; v4l2_dbg(3, debug, sd, "%s:\n", __func__); - state->csi_lanes_in_use = lanes; - tc35874x_reset(sd, MASK_CTXRST); if (lanes < 1) @@ -1155,8 +1140,6 @@ static int tc35874x_log_status(struct v4l2_subdev *sd) true); v4l2_info(sd, "-----CSI-TX status-----\n"); - v4l2_info(sd, "Lanes needed: %d\n", - tc35874x_num_csi_lanes_needed(sd)); v4l2_info(sd, "Lanes in use: %d\n", state->csi_lanes_in_use); v4l2_info(sd, "Waiting for particular sync signal: %s\n", @@ -1771,6 +1754,7 @@ static int tc35874x_probe_of(struct tc35874x_state *state) goto free_endpoint; } + state->csi_lanes_in_use = endpoint->bus.mipi_csi2.num_data_lanes; state->bus = endpoint->bus.mipi_csi2; ret = clk_prepare_enable(refclk);