@@ -8,15 +8,17 @@
* published by the Free Software Foundation.
*/
-#include <linux/videodev2.h>
-#include <linux/slab.h>
-#include <linux/i2c.h>
#include <linux/delay.h>
+#include <linux/device.h>
+#include <linux/i2c.h>
#include <linux/log2.h>
+#include <linux/pm.h>
+#include <linux/slab.h>
+#include <linux/videodev2.h>
-#include <media/v4l2-subdev.h>
-#include <media/v4l2-chip-ident.h>
#include <media/soc_camera.h>
+#include <media/v4l2-chip-ident.h>
+#include <media/v4l2-subdev.h>
/*
* mt9v022 i2c address 0x48, 0x4c, 0x58, 0x5c
@@ -718,6 +720,28 @@ static int mt9v022_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
return 0;
}
+static int mt9v022_runtime_suspend(struct device *dev)
+{
+ dev_info(dev, "%s\n", __func__);
+ return 0;
+}
+
+static int mt9v022_runtime_resume(struct device *dev)
+{
+ dev_info(dev, "%s\n", __func__);
+ return 0;
+}
+
+static struct dev_pm_ops mt9v022_dev_pm_ops = {
+ .runtime_suspend = mt9v022_runtime_suspend,
+ .runtime_resume = mt9v022_runtime_resume,
+};
+
+static struct device_type mt9v022_dev_type = {
+ .name = "MT9V022",
+ .pm = &mt9v022_dev_pm_ops,
+};
+
/*
* Interface active, can use i2c. If it fails, it can indeed mean, that
* this wasn't our capture interface, so, we wait for the right one
@@ -727,6 +751,7 @@ static int mt9v022_video_probe(struct soc_camera_device *icd,
{
struct mt9v022 *mt9v022 = to_mt9v022(client);
struct soc_camera_link *icl = to_soc_camera_link(icd);
+ struct video_device *vdev = soc_camera_i2c_to_vdev(client);
s32 data;
int ret;
unsigned long flags;
@@ -803,6 +828,8 @@ static int mt9v022_video_probe(struct soc_camera_device *icd,
ret = mt9v022_init(client);
if (ret < 0)
dev_err(&client->dev, "Failed to initialise the camera\n");
+ else
+ vdev->dev.type = &mt9v022_dev_type;
ei2c:
return ret;