Skip to content

Commit 145437c

Browse files
tombahverkuil
authored andcommitted
media: rcar-csi2: Use the pad version of v4l2_get_link_freq()
The pad-aware version of v4l2_get_link_freq() tries to retrieve the link frequency from the media bus configuration using the get_mbus_config operation, and only if the subdevice does not implement this operation falls back to the old method of getting it using the V4L2_CID_LINK_FREQ or V4L2_CID_PIXEL_RATE control. Update the VIN driver to use the pad-aware version to be able to support subdevices that only provides the link frequency in the media bus configuration. As the implementation falls back to the old method if the subdevice doesn't support get_mbus_config, or doesn't provide a link frequency in the v4l2_mbus_config struct, this is fully backward compatible. Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Link: https://lore.kernel.org/r/20250530-rcar-streams-v3-1-026655df7138@ideasonboard.com Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
1 parent 95703a0 commit 145437c

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/media/platform/renesas/rcar-csi2.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,7 @@ static int rcsi2_set_phypll(struct rcar_csi2 *priv, unsigned int mbps)
962962
static int rcsi2_calc_mbps(struct rcar_csi2 *priv, unsigned int bpp,
963963
unsigned int lanes)
964964
{
965+
struct media_pad *remote_pad;
965966
struct v4l2_subdev *source;
966967
s64 freq;
967968
u64 mbps;
@@ -970,8 +971,9 @@ static int rcsi2_calc_mbps(struct rcar_csi2 *priv, unsigned int bpp,
970971
return -ENODEV;
971972

972973
source = priv->remote;
974+
remote_pad = &source->entity.pads[priv->remote_pad];
973975

974-
freq = v4l2_get_link_freq(source->ctrl_handler, bpp, 2 * lanes);
976+
freq = v4l2_get_link_freq(remote_pad, bpp, 2 * lanes);
975977
if (freq < 0) {
976978
int ret = (int)freq;
977979

0 commit comments

Comments
 (0)