Commit 21325e19 authored by Jacopo Mondi's avatar Jacopo Mondi Committed by Mauro Carvalho Chehab

media: adv748x: csi2: Link AFE with TXA and TXB

The ADV748x chip supports routing AFE output to either TXA or TXB.
In order to support run-time configuration of video stream path, create an
additional (not enabled) "AFE:8->TXA:0" link, and remove the IMMUTABLE flag
from existing ones.
Reviewed-by: default avatarKieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: default avatarJacopo Mondi <jacopo+renesas@jmondi.org>
Reviewed-by: default avatarNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 29166e0f
...@@ -27,6 +27,7 @@ static int adv748x_csi2_set_virtual_channel(struct adv748x_csi2 *tx, ...@@ -27,6 +27,7 @@ static int adv748x_csi2_set_virtual_channel(struct adv748x_csi2 *tx,
* @v4l2_dev: Video registration device * @v4l2_dev: Video registration device
* @src: Source subdevice to establish link * @src: Source subdevice to establish link
* @src_pad: Pad number of source to link to this @tx * @src_pad: Pad number of source to link to this @tx
* @enable: Link enabled flag
* *
* Ensure that the subdevice is registered against the v4l2_device, and link the * Ensure that the subdevice is registered against the v4l2_device, and link the
* source pad to the sink pad of the CSI2 bus entity. * source pad to the sink pad of the CSI2 bus entity.
...@@ -34,17 +35,11 @@ static int adv748x_csi2_set_virtual_channel(struct adv748x_csi2 *tx, ...@@ -34,17 +35,11 @@ static int adv748x_csi2_set_virtual_channel(struct adv748x_csi2 *tx,
static int adv748x_csi2_register_link(struct adv748x_csi2 *tx, static int adv748x_csi2_register_link(struct adv748x_csi2 *tx,
struct v4l2_device *v4l2_dev, struct v4l2_device *v4l2_dev,
struct v4l2_subdev *src, struct v4l2_subdev *src,
unsigned int src_pad) unsigned int src_pad,
bool enable)
{ {
int enabled = MEDIA_LNK_FL_ENABLED;
int ret; int ret;
/*
* Dynamic linking of the AFE is not supported.
* Register the links as immutable.
*/
enabled |= MEDIA_LNK_FL_IMMUTABLE;
if (!src->v4l2_dev) { if (!src->v4l2_dev) {
ret = v4l2_device_register_subdev(v4l2_dev, src); ret = v4l2_device_register_subdev(v4l2_dev, src);
if (ret) if (ret)
...@@ -53,7 +48,7 @@ static int adv748x_csi2_register_link(struct adv748x_csi2 *tx, ...@@ -53,7 +48,7 @@ static int adv748x_csi2_register_link(struct adv748x_csi2 *tx,
return media_create_pad_link(&src->entity, src_pad, return media_create_pad_link(&src->entity, src_pad,
&tx->sd.entity, ADV748X_CSI2_SINK, &tx->sd.entity, ADV748X_CSI2_SINK,
enabled); enable ? MEDIA_LNK_FL_ENABLED : 0);
} }
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
...@@ -68,25 +63,32 @@ static int adv748x_csi2_registered(struct v4l2_subdev *sd) ...@@ -68,25 +63,32 @@ static int adv748x_csi2_registered(struct v4l2_subdev *sd)
{ {
struct adv748x_csi2 *tx = adv748x_sd_to_csi2(sd); struct adv748x_csi2 *tx = adv748x_sd_to_csi2(sd);
struct adv748x_state *state = tx->state; struct adv748x_state *state = tx->state;
int ret;
adv_dbg(state, "Registered %s (%s)", is_txa(tx) ? "TXA":"TXB", adv_dbg(state, "Registered %s (%s)", is_txa(tx) ? "TXA":"TXB",
sd->name); sd->name);
/* /*
* The adv748x hardware allows the AFE to route through the TXA, however * Link TXA to AFE and HDMI, and TXB to AFE only as TXB cannot output
* this is not currently supported in this driver. * HDMI.
* *
* Link HDMI->TXA, and AFE->TXB directly. * The HDMI->TXA link is enabled by default, as is the AFE->TXB one.
*/ */
if (is_txa(tx) && is_hdmi_enabled(state)) if (is_afe_enabled(state)) {
return adv748x_csi2_register_link(tx, sd->v4l2_dev, ret = adv748x_csi2_register_link(tx, sd->v4l2_dev,
&state->hdmi.sd, &state->afe.sd,
ADV748X_HDMI_SOURCE); ADV748X_AFE_SOURCE,
if (is_txb(tx) && is_afe_enabled(state)) is_txb(tx));
return adv748x_csi2_register_link(tx, sd->v4l2_dev, if (ret)
&state->afe.sd, return ret;
ADV748X_AFE_SOURCE); }
return 0;
/* Register link to HDMI for TXA only. */
if (is_txb(tx) || !is_hdmi_enabled(state))
return 0;
return adv748x_csi2_register_link(tx, sd->v4l2_dev, &state->hdmi.sd,
ADV748X_HDMI_SOURCE, true);
} }
static const struct v4l2_subdev_internal_ops adv748x_csi2_internal_ops = { static const struct v4l2_subdev_internal_ops adv748x_csi2_internal_ops = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment