struct v4l2_dv_timings timings;
        u32 mbus_fmt_code;
+       u8 csi_lanes_in_use;
 
        struct gpio_desc *reset_gpio;
 };
        return code_to_rate[i2c_rd8(sd, FS_SET) & MASK_FS];
 }
 
-static unsigned tc358743_num_csi_lanes_in_use(struct v4l2_subdev *sd)
-{
-       return ((i2c_rd32(sd, CSI_CONTROL) & MASK_NOL) >> 1) + 1;
-}
-
 /* --------------- TIMINGS --------------- */
 
 static inline unsigned fps(const struct v4l2_bt_timings *t)
 
        v4l2_dbg(3, debug, sd, "%s:\n", __func__);
 
+       state->csi_lanes_in_use = lanes;
+
        tc358743_reset(sd, MASK_CTXRST);
 
        if (lanes < 1)
        v4l2_info(sd, "Lanes needed: %d\n",
                        tc358743_num_csi_lanes_needed(sd));
        v4l2_info(sd, "Lanes in use: %d\n",
-                       tc358743_num_csi_lanes_in_use(sd));
+                       state->csi_lanes_in_use);
        v4l2_info(sd, "Waiting for particular sync signal: %s\n",
                        (i2c_rd16(sd, CSI_STATUS) & MASK_S_WSYNC) ?
                        "yes" : "no");
 static int tc358743_g_mbus_config(struct v4l2_subdev *sd,
                             struct v4l2_mbus_config *cfg)
 {
+       struct tc358743_state *state = to_state(sd);
+
        cfg->type = V4L2_MBUS_CSI2;
 
        /* Support for non-continuous CSI-2 clock is missing in the driver */
        cfg->flags = V4L2_MBUS_CSI2_CONTINUOUS_CLOCK;
 
-       switch (tc358743_num_csi_lanes_in_use(sd)) {
+       switch (state->csi_lanes_in_use) {
        case 1:
                cfg->flags |= V4L2_MBUS_CSI2_1_LANE;
                break;