summaryrefslogtreecommitdiff
path: root/drivers/media/i2c/tc358743.c
diff options
context:
space:
mode:
authorMats Randgaard <matrandg@cisco.com>2016-12-06 08:24:27 -0200
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-02-03 11:14:40 -0200
commit59e34ba82aebf75ea70508a114ada1ed3ca0df7c (patch)
treeb1d2ed0b779ad1ce6dc2c06c390136bdeded6a96 /drivers/media/i2c/tc358743.c
parent10106c13f444e3b5adf435d8c12e207f109f469c (diff)
[media] tc358743: Do not read number of CSI lanes in use from chip
The number of CSI lanes that should be used is set to the CSI_CONTROL register by indirectly writing to the CSI_CONFW register. When the number of lanes is read back from the CSI_CONTROL register the value is usually correct, but we have seen that it suddenly is 1 for a short moment before the correct value is restored again. Toshiba have not figured out why that happen, but we have found it safer to store the value in the driver. Signed-off-by: Mats Randgaard <matrandg@cisco.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/i2c/tc358743.c')
-rw-r--r--drivers/media/i2c/tc358743.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c
index 1e3a0dd2238c..a35aaf8e08e7 100644
--- a/drivers/media/i2c/tc358743.c
+++ b/drivers/media/i2c/tc358743.c
@@ -96,6 +96,7 @@ struct tc358743_state {
struct v4l2_dv_timings timings;
u32 mbus_fmt_code;
+ u8 csi_lanes_in_use;
struct gpio_desc *reset_gpio;
};
@@ -287,11 +288,6 @@ static int get_audio_sampling_rate(struct v4l2_subdev *sd)
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)
@@ -683,6 +679,8 @@ static void tc358743_set_csi(struct v4l2_subdev *sd)
v4l2_dbg(3, debug, sd, "%s:\n", __func__);
+ state->csi_lanes_in_use = lanes;
+
tc358743_reset(sd, MASK_CTXRST);
if (lanes < 1)
@@ -1155,7 +1153,7 @@ static int tc358743_log_status(struct v4l2_subdev *sd)
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");
@@ -1438,12 +1436,14 @@ static int tc358743_dv_timings_cap(struct v4l2_subdev *sd,
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;