media: rcar-csi2: Move rcsi2_calc_mbps()

Move the function so that it can call rcsi2_get_active_lanes() in the
following patch.

No functional change intended.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Tested-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
Tomi Valkeinen 2026-01-15 12:06:59 +02:00 committed by Mauro Carvalho Chehab
parent 6de424728b
commit 0ffd7f4c4c

View File

@ -956,35 +956,6 @@ static int rcsi2_set_phypll(struct rcar_csi2 *priv, unsigned int mbps)
return 0;
}
static int rcsi2_calc_mbps(struct rcar_csi2 *priv, unsigned int bpp,
unsigned int lanes)
{
struct media_pad *remote_pad;
struct v4l2_subdev *source;
s64 freq;
u64 mbps;
if (!priv->remote)
return -ENODEV;
source = priv->remote;
remote_pad = &source->entity.pads[priv->remote_pad];
freq = v4l2_get_link_freq(remote_pad, bpp, 2 * lanes);
if (freq < 0) {
int ret = (int)freq;
dev_err(priv->dev, "failed to get link freq for %s: %d\n",
source->name, ret);
return ret;
}
mbps = div_u64(freq * 2, MEGA);
return mbps;
}
static int rcsi2_get_active_lanes(struct rcar_csi2 *priv,
unsigned int *lanes)
{
@ -1032,6 +1003,35 @@ static int rcsi2_get_active_lanes(struct rcar_csi2 *priv,
return 0;
}
static int rcsi2_calc_mbps(struct rcar_csi2 *priv, unsigned int bpp,
unsigned int lanes)
{
struct media_pad *remote_pad;
struct v4l2_subdev *source;
s64 freq;
u64 mbps;
if (!priv->remote)
return -ENODEV;
source = priv->remote;
remote_pad = &source->entity.pads[priv->remote_pad];
freq = v4l2_get_link_freq(remote_pad, bpp, 2 * lanes);
if (freq < 0) {
int ret = (int)freq;
dev_err(priv->dev, "failed to get link freq for %s: %d\n",
source->name, ret);
return ret;
}
mbps = div_u64(freq * 2, MEGA);
return mbps;
}
static int rcsi2_start_receiver_gen3(struct rcar_csi2 *priv,
struct v4l2_subdev_state *state)
{