aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c/adv748x/adv748x-csi2.c
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo+renesas@jmondi.org>2019-01-10 09:02:10 -0500
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2019-02-18 11:02:47 -0500
commit21325e19cadec506bd48591d3944bd526f647d93 (patch)
tree9b95469bee3bcba69d5529bc4c7ce464c6b3996d /drivers/media/i2c/adv748x/adv748x-csi2.c
parent29166e0f8f426a9a3067efd9317d84e4db82f009 (diff)
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: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/i2c/adv748x/adv748x-csi2.c')
-rw-r--r--drivers/media/i2c/adv748x/adv748x-csi2.c44
1 files changed, 23 insertions, 21 deletions
diff --git a/drivers/media/i2c/adv748x/adv748x-csi2.c b/drivers/media/i2c/adv748x/adv748x-csi2.c
index b6b5d8c7ea7c..8c3714495e11 100644
--- a/drivers/media/i2c/adv748x/adv748x-csi2.c
+++ b/drivers/media/i2c/adv748x/adv748x-csi2.c
@@ -27,6 +27,7 @@ static int adv748x_csi2_set_virtual_channel(struct adv748x_csi2 *tx,
27 * @v4l2_dev: Video registration device 27 * @v4l2_dev: Video registration device
28 * @src: Source subdevice to establish link 28 * @src: Source subdevice to establish link
29 * @src_pad: Pad number of source to link to this @tx 29 * @src_pad: Pad number of source to link to this @tx
30 * @enable: Link enabled flag
30 * 31 *
31 * Ensure that the subdevice is registered against the v4l2_device, and link the 32 * Ensure that the subdevice is registered against the v4l2_device, and link the
32 * source pad to the sink pad of the CSI2 bus entity. 33 * 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,
34static int adv748x_csi2_register_link(struct adv748x_csi2 *tx, 35static int adv748x_csi2_register_link(struct adv748x_csi2 *tx,
35 struct v4l2_device *v4l2_dev, 36 struct v4l2_device *v4l2_dev,
36 struct v4l2_subdev *src, 37 struct v4l2_subdev *src,
37 unsigned int src_pad) 38 unsigned int src_pad,
39 bool enable)
38{ 40{
39 int enabled = MEDIA_LNK_FL_ENABLED;
40 int ret; 41 int ret;
41 42
42 /*
43 * Dynamic linking of the AFE is not supported.
44 * Register the links as immutable.
45 */
46 enabled |= MEDIA_LNK_FL_IMMUTABLE;
47
48 if (!src->v4l2_dev) { 43 if (!src->v4l2_dev) {
49 ret = v4l2_device_register_subdev(v4l2_dev, src); 44 ret = v4l2_device_register_subdev(v4l2_dev, src);
50 if (ret) 45 if (ret)
@@ -53,7 +48,7 @@ static int adv748x_csi2_register_link(struct adv748x_csi2 *tx,
53 48
54 return media_create_pad_link(&src->entity, src_pad, 49 return media_create_pad_link(&src->entity, src_pad,
55 &tx->sd.entity, ADV748X_CSI2_SINK, 50 &tx->sd.entity, ADV748X_CSI2_SINK,
56 enabled); 51 enable ? MEDIA_LNK_FL_ENABLED : 0);
57} 52}
58 53
59/* ----------------------------------------------------------------------------- 54/* -----------------------------------------------------------------------------
@@ -68,25 +63,32 @@ static int adv748x_csi2_registered(struct v4l2_subdev *sd)
68{ 63{
69 struct adv748x_csi2 *tx = adv748x_sd_to_csi2(sd); 64 struct adv748x_csi2 *tx = adv748x_sd_to_csi2(sd);
70 struct adv748x_state *state = tx->state; 65 struct adv748x_state *state = tx->state;
66 int ret;
71 67
72 adv_dbg(state, "Registered %s (%s)", is_txa(tx) ? "TXA":"TXB", 68 adv_dbg(state, "Registered %s (%s)", is_txa(tx) ? "TXA":"TXB",
73 sd->name); 69 sd->name);
74 70
75 /* 71 /*
76 * The adv748x hardware allows the AFE to route through the TXA, however 72 * Link TXA to AFE and HDMI, and TXB to AFE only as TXB cannot output
77 * this is not currently supported in this driver. 73 * HDMI.
78 * 74 *
79 * Link HDMI->TXA, and AFE->TXB directly. 75 * The HDMI->TXA link is enabled by default, as is the AFE->TXB one.
80 */ 76 */
81 if (is_txa(tx) && is_hdmi_enabled(state)) 77 if (is_afe_enabled(state)) {
82 return adv748x_csi2_register_link(tx, sd->v4l2_dev, 78 ret = adv748x_csi2_register_link(tx, sd->v4l2_dev,
83 &state->hdmi.sd, 79 &state->afe.sd,
84 ADV748X_HDMI_SOURCE); 80 ADV748X_AFE_SOURCE,
85 if (is_txb(tx) && is_afe_enabled(state)) 81 is_txb(tx));
86 return adv748x_csi2_register_link(tx, sd->v4l2_dev, 82 if (ret)
87 &state->afe.sd, 83 return ret;
88 ADV748X_AFE_SOURCE); 84 }
89 return 0; 85
86 /* Register link to HDMI for TXA only. */
87 if (is_txb(tx) || !is_hdmi_enabled(state))
88 return 0;
89
90 return adv748x_csi2_register_link(tx, sd->v4l2_dev, &state->hdmi.sd,
91 ADV748X_HDMI_SOURCE, true);
90} 92}
91 93
92static const struct v4l2_subdev_internal_ops adv748x_csi2_internal_ops = { 94static const struct v4l2_subdev_internal_ops adv748x_csi2_internal_ops = {