The driver is now pad and stream aware, only allow to get/set format on
sink pads. Also record a different format for each sink pad since it's
no longer true that they are all the same

Signed-off-by: Niklas Söderlund <niklas.soderlund+rene...@ragnatech.se>
---
 drivers/media/i2c/adv748x/adv748x-csi2.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/media/i2c/adv748x/adv748x-csi2.c 
b/drivers/media/i2c/adv748x/adv748x-csi2.c
index 39d7877ff615fed1..9af33edfa7bed0a0 100644
--- a/drivers/media/i2c/adv748x/adv748x-csi2.c
+++ b/drivers/media/i2c/adv748x/adv748x-csi2.c
@@ -176,6 +176,9 @@ static int adv748x_csi2_get_format(struct v4l2_subdev *sd,
        struct adv748x_state *state = tx->state;
        struct v4l2_mbus_framefmt *mbusformat;
 
+       if (sdformat->pad != ADV748X_CSI2_SINK)
+               return -EINVAL;
+
        mbusformat = adv748x_csi2_get_pad_format(sd, cfg, sdformat->pad,
                                                 sdformat->which);
        if (!mbusformat)
@@ -199,6 +202,9 @@ static int adv748x_csi2_set_format(struct v4l2_subdev *sd,
        struct v4l2_mbus_framefmt *mbusformat;
        int ret = 0;
 
+       if (sdformat->pad != ADV748X_CSI2_SINK)
+               return -EINVAL;
+
        mbusformat = adv748x_csi2_get_pad_format(sd, cfg, sdformat->pad,
                                                 sdformat->which);
        if (!mbusformat)
-- 
2.13.3

Reply via email to