[media] atmel-isi: parse the DT parameters for vsync/hsync/pixclock polarity
authorJosh Wu <josh.wu@atmel.com>
Tue, 4 Aug 2015 09:37:49 +0000 (06:37 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Fri, 25 Sep 2015 20:42:12 +0000 (17:42 -0300)
This patch will get the DT parameters of vsync/hsync/pixclock polarity, and
pass to driver.

Also add a debug information for test purpose.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/platform/soc_camera/atmel-isi.c

index 19131d3f9af6e4f09415aa5bd42869b5c647c42f..45e304a3dd85b581710915dae81a2a7ed09c1de2 100644 (file)
@@ -833,6 +833,11 @@ static int isi_camera_set_bus_param(struct soc_camera_device *icd)
        if (common_flags & V4L2_MBUS_PCLK_SAMPLE_FALLING)
                cfg1 |= ISI_CFG1_PIXCLK_POL_ACTIVE_FALLING;
 
+       dev_dbg(icd->parent, "vsync active %s, hsync active %s, sampling on pix clock %s edge\n",
+               common_flags & V4L2_MBUS_VSYNC_ACTIVE_LOW ? "low" : "high",
+               common_flags & V4L2_MBUS_HSYNC_ACTIVE_LOW ? "low" : "high",
+               common_flags & V4L2_MBUS_PCLK_SAMPLE_FALLING ? "falling" : "rising");
+
        if (isi->pdata.has_emb_sync)
                cfg1 |= ISI_CFG1_EMB_SYNC;
        if (isi->pdata.full_mode)
@@ -920,6 +925,16 @@ static int atmel_isi_parse_dt(struct atmel_isi *isi,
                return -EINVAL;
        }
 
+       if (ep.bus.parallel.flags & V4L2_MBUS_HSYNC_ACTIVE_LOW)
+               isi->pdata.hsync_act_low = true;
+       if (ep.bus.parallel.flags & V4L2_MBUS_VSYNC_ACTIVE_LOW)
+               isi->pdata.vsync_act_low = true;
+       if (ep.bus.parallel.flags & V4L2_MBUS_PCLK_SAMPLE_FALLING)
+               isi->pdata.pclk_act_falling = true;
+
+       if (ep.bus_type == V4L2_MBUS_BT656)
+               isi->pdata.has_emb_sync = true;
+
        return 0;
 }