atomisp: display an error message if ISP power cycling fails
authorTuukka Toivonen <tuukka.toivonen@intel.com>
Wed, 29 Feb 2012 11:53:21 +0000 (13:53 +0200)
committerbuildbot <buildbot@intel.com>
Wed, 14 Mar 2012 15:49:46 +0000 (08:49 -0700)
BZ: 25735

AtomISP driver resets ISP by power cycling it. This patch encapsulates
the resetting into a new function which checks if the power management
functions failed, and if so, displays an error message.

Change-Id: I248fe7eeeaf8c363e09e17287a812e9aab82463c
Signed-off-by: Tuukka Toivonen <tuukka.toivonen@intel.com>
Reviewed-on: http://android.intel.com:8080/37223
Reviewed-by: Shevchenko, Andriy <andriy.shevchenko@intel.com>
Reviewed-by: Koskinen, Ilkka <ilkka.koskinen@intel.com>
Reviewed-by: Kruger, Jozef <jozef.kruger@intel.com>
Reviewed-by: Monroy, German <german.monroy@intel.com>
Reviewed-by: Cohen, David A <david.a.cohen@intel.com>
Tested-by: Koski, Anttu <anttu.koski@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
drivers/media/video/atomisp/atomisp_cmd.c
drivers/media/video/atomisp/atomisp_cmd.h
drivers/media/video/atomisp/atomisp_ioctl.c

index 78fdfb3..f7735f9 100644 (file)
@@ -113,6 +113,27 @@ struct atomisp_video_pipe *atomisp_to_video_pipe(struct video_device *dev)
 }
 
 /*
+ * reset and restore ISP
+ */
+int atomisp_reset(struct atomisp_device *isp)
+{
+       /* Reset ISP by power-cycling it */
+       int ret = 0;
+
+       sh_css_suspend();
+       ret = pm_runtime_put_sync(isp->dev);
+       if (ret) {
+               v4l2_err(&atomisp_dev, "can not disable ISP power\n");
+       } else {
+               ret = pm_runtime_get_sync(isp->dev);
+               if (ret)
+                       v4l2_err(&atomisp_dev, "can not enable ISP power\n");
+       }
+       sh_css_resume();
+       return ret;
+}
+
+/*
  * interrupt enable/disable functions
  */
 static void enable_isp_irq(enum hrt_isp_css_irq irq, bool enable)
@@ -593,11 +614,9 @@ static void atomisp_pipe_reset(struct atomisp_device *isp)
                                 video, s_stream, 0);
                isp->sw_contex.sensor_streaming = false;
        }
-       /* power cycle ISP */
-       sh_css_suspend();
-       pm_runtime_put_sync(isp->dev);
-       pm_runtime_get_sync(isp->dev);
-       sh_css_resume();
+
+       /* reset ISP and restore its state */
+       atomisp_reset(isp);
 }
 
 static void atomisp_timeout_handler(struct atomisp_device *isp)
index 6c03b6a..8b6d91b 100644 (file)
@@ -41,6 +41,7 @@
 
 struct camera_mipi_info *atomisp_to_sensor_mipi_info(struct v4l2_subdev *sd);
 struct atomisp_video_pipe *atomisp_to_video_pipe(struct video_device *dev);
+int atomisp_reset(struct atomisp_device *isp);
 
 
 extern void __iomem *atomisp_io_base;
index d49a8f7..3e59b11 100644 (file)
@@ -1180,13 +1180,9 @@ int atomisp_streamoff(struct file *file, void *fh,
        atomisp_msg_write32(isp, PUNIT_PORT, OR1, msg_ret);
 #endif
 
-       /* ISP work around, need to power cycle isp*/
-       if (pipe->is_main && isp->sw_contex.power_state == ATOM_ISP_POWER_UP) {
-               sh_css_suspend();
-               pm_runtime_put_sync(vdev->v4l2_dev->dev);
-               pm_runtime_get_sync(vdev->v4l2_dev->dev);
-               sh_css_resume();
-       }
+       /* ISP work around, need to reset isp */
+       if (pipe->is_main && isp->sw_contex.power_state == ATOM_ISP_POWER_UP)
+               atomisp_reset(isp);
 
        return ret;
 }