Skip to content

Commit a61b1b5

Browse files
Jacopo Mondimchehab
authored andcommitted
media: i2c: adv748x: Implement get_mbus_config
Implement the newly introduced get_mbus_config operation to report the number of currently used data lanes on the MIPI CSI-2 interface. Reviewed-by: Kieran Bingham <[email protected]> Reviewed-by: Niklas Söderlund <[email protected]> Signed-off-by: Jacopo Mondi <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent 147d5ea commit a61b1b5

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

drivers/media/i2c/adv748x/adv748x-csi2.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,40 @@ static int adv748x_csi2_set_format(struct v4l2_subdev *sd,
214214
return ret;
215215
}
216216

217+
static int adv748x_csi2_get_mbus_config(struct v4l2_subdev *sd, unsigned int pad,
218+
struct v4l2_mbus_config *config)
219+
{
220+
struct adv748x_csi2 *tx = adv748x_sd_to_csi2(sd);
221+
222+
if (pad != ADV748X_CSI2_SOURCE)
223+
return -EINVAL;
224+
225+
config->type = V4L2_MBUS_CSI2_DPHY;
226+
switch (tx->active_lanes) {
227+
case 1:
228+
config->flags = V4L2_MBUS_CSI2_1_LANE;
229+
break;
230+
231+
case 2:
232+
config->flags = V4L2_MBUS_CSI2_2_LANE;
233+
break;
234+
235+
case 3:
236+
config->flags = V4L2_MBUS_CSI2_3_LANE;
237+
break;
238+
239+
case 4:
240+
config->flags = V4L2_MBUS_CSI2_4_LANE;
241+
break;
242+
}
243+
244+
return 0;
245+
}
246+
217247
static const struct v4l2_subdev_pad_ops adv748x_csi2_pad_ops = {
218248
.get_fmt = adv748x_csi2_get_format,
219249
.set_fmt = adv748x_csi2_set_format,
250+
.get_mbus_config = adv748x_csi2_get_mbus_config,
220251
};
221252

222253
/* -----------------------------------------------------------------------------

0 commit comments

Comments
 (0)