#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
#if defined(CPTCFG_VIDEO_DEV_MODULE)
+#include <media/v4l2-clk.h>
+
struct soc_camera_subdev_desc;
#define soc_camera_power_on LINUX_BACKPORT(soc_camera_power_on)
int soc_camera_power_on(struct device *dev,
- struct soc_camera_subdev_desc *ssdd);
+ struct soc_camera_subdev_desc *ssdd,
+ struct v4l2_clk *clk);
#define soc_camera_power_off LINUX_BACKPORT(soc_camera_power_off)
int soc_camera_power_off(struct device *dev,
- struct soc_camera_subdev_desc *ssdd);
+ struct soc_camera_subdev_desc *ssdd,
+ struct v4l2_clk *clk);
#endif /* defined(CPTCFG_VIDEO_DEV_MODULE) */
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
#if defined(CPTCFG_VIDEO_V4L2_MODULE)
+#include <media/v4l2-clk.h>
int soc_camera_power_on(struct device *dev,
- struct soc_camera_subdev_desc *ssdd)
+ struct soc_camera_subdev_desc *ssdd,
+ struct v4l2_clk *clk)
{
- int ret = regulator_bulk_enable(ssdd->num_regulators,
+ int ret = clk ? v4l2_clk_enable(clk) : 0;
+ if (ret < 0) {
+ dev_err(dev, "Cannot enable clock: %d\n", ret);
+ return ret;
+ }
+ ret = regulator_bulk_enable(ssdd->num_regulators,
ssdd->regulators);
if (ret < 0) {
dev_err(dev, "Cannot enable regulators\n");
- return ret;
+ goto eregenable;
}
if (ssdd->power) {
if (ret < 0) {
dev_err(dev,
"Platform failed to power-on the camera.\n");
- regulator_bulk_disable(ssdd->num_regulators,
- ssdd->regulators);
+ goto epwron;
}
}
+ return 0;
+
+epwron:
+ regulator_bulk_disable(ssdd->num_regulators,
+ ssdd->regulators);
+eregenable:
+ if (clk)
+ v4l2_clk_disable(clk);
+
return ret;
}
EXPORT_SYMBOL_GPL(soc_camera_power_on);
int soc_camera_power_off(struct device *dev,
- struct soc_camera_subdev_desc *ssdd)
+ struct soc_camera_subdev_desc *ssdd,
+ struct v4l2_clk *clk)
{
int ret = 0;
int err;
ret = ret ? : err;
}
+ if (clk)
+ v4l2_clk_disable(clk);
+
return ret;
}
EXPORT_SYMBOL_GPL(soc_camera_power_off);