On 11/02/2016 04:23 PM, Niklas Söderlund wrote:

Refactor the probe code path to look for the digital subdevice, if one
is found use it just like the driver did before (Gen2 mode) but if it's
not found prepare for a Gen3 mode by registering a pad for the media
controller API to use.

Signed-off-by: Niklas Söderlund <niklas.soderlund+rene...@ragnatech.se>
---
 drivers/media/platform/rcar-vin/rcar-core.c | 21 ++++++++++++++++++++-
 drivers/media/platform/rcar-vin/rcar-vin.h  |  9 +++++++++
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/rcar-vin/rcar-core.c 
b/drivers/media/platform/rcar-vin/rcar-core.c
index f961957..ce8b59a 100644
--- a/drivers/media/platform/rcar-vin/rcar-core.c
+++ b/drivers/media/platform/rcar-vin/rcar-core.c
@@ -308,6 +308,25 @@ static const struct of_device_id rvin_of_id_table[] = {
 };
 MODULE_DEVICE_TABLE(of, rvin_of_id_table);

+static int rvin_graph_init(struct rvin_dev *vin)
+{
+       int ret;
+
+       /* Try to get digital video pipe */
+       ret = rvin_digital_graph_init(vin);
+
+       /* No digital pipe and we are on Gen3 try to joint CSI2 group */
+       if (ret == -ENODEV && vin->info->chip == RCAR_GEN3) {
+
+               vin->pads[RVIN_SINK].flags = MEDIA_PAD_FL_SINK;
+               ret = media_entity_pads_init(&vin->vdev.entity, 1, vin->pads);
+               if (ret)
+                       return ret;

   This *if* is not necessary, you'll return below anyway.

+       }
+
+       return ret;
+}
+
 static int rcar_vin_probe(struct platform_device *pdev)
 {
        const struct of_device_id *match;
[...]

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to