MLK-21687 media: camera: ov5640: add device tree support
authorRobby Cai <robby.cai@nxp.com>
Thu, 9 May 2019 13:50:58 +0000 (21:50 +0800)
committerRobby Cai <robby.cai@nxp.com>
Fri, 10 May 2019 07:56:50 +0000 (15:56 +0800)
add ov5640 (parallel and mipi interface) device tree support to help load module
at booting time when it's compiled as module.

Signed-off-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
drivers/media/platform/mxc/capture/ov5640.c
drivers/media/platform/mxc/capture/ov5640_mipi.c

index ec8b809..4ce9db7 100644 (file)
@@ -565,6 +565,16 @@ static int ov5640_remove(struct i2c_client *client);
 static s32 ov5640_read_reg(u16 reg, u8 *val);
 static s32 ov5640_write_reg(u16 reg, u8 val);
 
+#ifdef CONFIG_OF
+static const struct of_device_id ov5640_of_match[] = {
+       { .compatible = "ovti,ov564x",
+       },
+       { /* sentinel */ }
+};
+
+MODULE_DEVICE_TABLE(of, ov5640_of_match);
+#endif
+
 static const struct i2c_device_id ov5640_id[] = {
        {"ov564x", 0},
        {},
@@ -576,6 +586,9 @@ static struct i2c_driver ov5640_i2c_driver = {
        .driver = {
                  .owner = THIS_MODULE,
                  .name  = "ov564x",
+#ifdef CONFIG_OF
+                 .of_match_table = of_match_ptr(ov5640_of_match),
+#endif
                  },
        .probe  = ov5640_probe,
        .remove = ov5640_remove,
index 0d146b5..a184389 100644 (file)
@@ -662,6 +662,16 @@ static int ov5640_remove(struct i2c_client *client);
 static s32 ov5640_read_reg(u16 reg, u8 *val);
 static s32 ov5640_write_reg(u16 reg, u8 val);
 
+#ifdef CONFIG_OF
+static const struct of_device_id ov5640_of_match[] = {
+       { .compatible = "ovti,ov564x_mipi",
+       },
+       { /* sentinel */ }
+};
+
+MODULE_DEVICE_TABLE(of, ov5640_of_match);
+#endif
+
 static const struct i2c_device_id ov5640_id[] = {
        {"ov564x_mipi", 0},
        {},
@@ -673,6 +683,9 @@ static struct i2c_driver ov5640_i2c_driver = {
        .driver = {
                  .owner = THIS_MODULE,
                  .name  = "ov564x_mipi",
+#ifdef CONFIG_OF
+                 .of_match_table = of_match_ptr(ov5640_of_match),
+#endif
                  },
        .probe  = ov5640_probe,
        .remove = ov5640_remove,