]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
media: adv748x: Store the source subdevice in TX
authorJacopo Mondi <jacopo+renesas@jmondi.org>
Thu, 10 Jan 2019 14:02:11 +0000 (09:02 -0500)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Mon, 18 Feb 2019 16:03:21 +0000 (11:03 -0500)
The power_up_tx() procedure needs to set a few registers conditionally to
the selected video source, but it currently checks for the provided tx to
be either TXA or TXB.

With the introduction of dynamic routing between HDMI and AFE entities to
TXA, checking which TX the function is operating on is not meaningful anymore.

To fix this, store the subdevice of the source providing video data to the
CSI-2 TX in the 'struct adv748x_csi2' representing the TX and check on it.

Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@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>
drivers/media/i2c/adv748x/adv748x-core.c
drivers/media/i2c/adv748x/adv748x-csi2.c
drivers/media/i2c/adv748x/adv748x.h

index ba91db45547ab8e6aade0ae0bb5177441508e701..824bca3219b76098c2a5ffa4ad21ffdb544ff207 100644 (file)
@@ -254,7 +254,7 @@ static int adv748x_power_up_tx(struct adv748x_csi2 *tx)
        adv748x_write_check(state, page, 0x00, 0xa0 | tx->num_lanes, &ret);
 
        /* ADI Required Write */
-       if (is_txa(tx)) {
+       if (tx->src == &state->hdmi.sd) {
                adv748x_write_check(state, page, 0xdb, 0x10, &ret);
                adv748x_write_check(state, page, 0xd6, 0x07, &ret);
        } else {
index 8c3714495e11c4d06f807c23d7520ae562b76cfe..353b6b9bf6a795804499a2e6c3465fba9e191e28 100644 (file)
@@ -46,9 +46,16 @@ static int adv748x_csi2_register_link(struct adv748x_csi2 *tx,
                        return ret;
        }
 
-       return media_create_pad_link(&src->entity, src_pad,
-                                    &tx->sd.entity, ADV748X_CSI2_SINK,
-                                    enable ? MEDIA_LNK_FL_ENABLED : 0);
+       ret = media_create_pad_link(&src->entity, src_pad,
+                                   &tx->sd.entity, ADV748X_CSI2_SINK,
+                                   enable ? MEDIA_LNK_FL_ENABLED : 0);
+       if (ret)
+               return ret;
+
+       if (enable)
+               tx->src = src;
+
+       return 0;
 }
 
 /* -----------------------------------------------------------------------------
index ab0c84adbea9f11e242d522806795c1b14bcc117..d22270f5e2c170c3fb7091ffe6e0136cddc788af 100644 (file)
@@ -84,6 +84,7 @@ struct adv748x_csi2 {
        struct media_pad pads[ADV748X_CSI2_NR_PADS];
        struct v4l2_ctrl_handler ctrl_hdl;
        struct v4l2_ctrl *pixel_rate;
+       struct v4l2_subdev *src;
        struct v4l2_subdev sd;
 };