media: marvell-ccic: only calculate the DPHY registers when needed
authorLubomir Rintel <lkundrak@v3.sk>
Thu, 20 Jun 2019 14:49:03 +0000 (10:49 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Mon, 24 Jun 2019 17:05:30 +0000 (13:05 -0400)
Avoid pointlessly calling calc_dphy() when the bus is not
V4L2_MBUS_CSI2_DPHY. This will make it easier to replace the platform data
with devicetree.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/platform/marvell-ccic/mcam-core.c

index f9ac1547d0937713c9c88576ce72925253f49549..dc30c48d4671dcee1d21a96b51a0e729576f96f2 100644 (file)
@@ -285,6 +285,8 @@ static void mcam_ctlr_stop(struct mcam_camera *cam)
 static void mcam_enable_mipi(struct mcam_camera *mcam)
 {
        /* Using MIPI mode and enable MIPI */
+       if (mcam->calc_dphy)
+               mcam->calc_dphy(mcam);
        cam_dbg(mcam, "camera: DPHY3=0x%x, DPHY5=0x%x, DPHY6=0x%x\n",
                        mcam->dphy[0], mcam->dphy[1], mcam->dphy[2]);
        mcam_reg_write(mcam, REG_CSI2_DPHY3, mcam->dphy[0]);
@@ -1078,13 +1080,6 @@ static int mcam_read_setup(struct mcam_camera *cam)
        spin_lock_irqsave(&cam->dev_lock, flags);
        clear_bit(CF_DMA_ACTIVE, &cam->flags);
        mcam_reset_buffers(cam);
-       /*
-        * Update CSI2_DPHY value
-        */
-       if (cam->calc_dphy)
-               cam->calc_dphy(cam);
-       cam_dbg(cam, "camera: DPHY sets: dphy3=0x%x, dphy5=0x%x, dphy6=0x%x\n",
-                       cam->dphy[0], cam->dphy[1], cam->dphy[2]);
        if (cam->bus_type == V4L2_MBUS_CSI2_DPHY)
                mcam_enable_mipi(cam);
        else