From 6abb75642abb041543e8f8391fbc217442dd33ea Mon Sep 17 00:00:00 2001 From: Jianwei Fan Date: Tue, 2 Aug 2022 12:00:26 +0000 Subject: [PATCH] media: i2c: modify sensors probe time if CONFIG_VIDEO_REVERSE_IMAGE=y Signed-off-by: Jianwei Fan Change-Id: I28a86e4f88425c90270b5d85ac68104bed93433a --- drivers/media/i2c/jaguar1_drv/jaguar1_v4l2.c | 10 ++++++++-- drivers/media/i2c/jaguar1_drv/jaguar1_v4l2.h | 11 +++++++++++ drivers/media/i2c/max96714.c | 8 ++++++-- drivers/media/i2c/max96714.h | 11 +++++++++++ drivers/media/i2c/nvp6188.c | 8 ++++++-- drivers/media/i2c/nvp6188.h | 11 +++++++++++ 6 files changed, 53 insertions(+), 6 deletions(-) create mode 100644 drivers/media/i2c/jaguar1_drv/jaguar1_v4l2.h create mode 100644 drivers/media/i2c/max96714.h create mode 100644 drivers/media/i2c/nvp6188.h diff --git a/drivers/media/i2c/jaguar1_drv/jaguar1_v4l2.c b/drivers/media/i2c/jaguar1_drv/jaguar1_v4l2.c index 2e8ce477b569..10545e7e03a5 100644 --- a/drivers/media/i2c/jaguar1_drv/jaguar1_v4l2.c +++ b/drivers/media/i2c/jaguar1_drv/jaguar1_v4l2.c @@ -39,6 +39,7 @@ #include "jaguar1_video_eq.h" #include "jaguar1_mipi.h" #include "jaguar1_drv.h" +#include "jaguar1_v4l2.h" #define DRIVER_VERSION KERNEL_VERSION(0, 0x01, 0x1) @@ -987,6 +988,8 @@ static int jaguar1_probe(struct i2c_client *client, pm_runtime_enable(dev); pm_runtime_idle(dev); + v4l2_info(sd, "%s found @ 0x%x (%s)\n", client->name, + client->addr << 1, client->adapter->name); return 0; err_power_off: @@ -1041,17 +1044,20 @@ static struct i2c_driver jaguar1_i2c_driver = { .id_table = jaguar1_match_id, }; -static int __init sensor_mod_init(void) +int nvp6324_sensor_mod_init(void) { return i2c_add_driver(&jaguar1_i2c_driver); } +#ifndef CONFIG_VIDEO_REVERSE_IMAGE +device_initcall_sync(nvp6324_sensor_mod_init); +#endif + static void __exit sensor_mod_exit(void) { i2c_del_driver(&jaguar1_i2c_driver); } -device_initcall_sync(sensor_mod_init); module_exit(sensor_mod_exit); MODULE_DESCRIPTION("jaguar1 sensor driver"); diff --git a/drivers/media/i2c/jaguar1_drv/jaguar1_v4l2.h b/drivers/media/i2c/jaguar1_drv/jaguar1_v4l2.h new file mode 100644 index 000000000000..20528a633226 --- /dev/null +++ b/drivers/media/i2c/jaguar1_drv/jaguar1_v4l2.h @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * jaguar1 driver + * + */ +#ifndef _JAGUAR1_V4L2_H_ +#define _JAGUAR1_V4L2_H_ + +int nvp6324_sensor_mod_init(void); + +#endif diff --git a/drivers/media/i2c/max96714.c b/drivers/media/i2c/max96714.c index 700cfd7727b6..8c156d8d093f 100644 --- a/drivers/media/i2c/max96714.c +++ b/drivers/media/i2c/max96714.c @@ -26,6 +26,7 @@ #include #include #include +#include "max96714.h" #define DRIVER_VERSION KERNEL_VERSION(0, 0x01, 0x00) @@ -1089,17 +1090,20 @@ static struct i2c_driver max96714_i2c_driver = { .id_table = max96714_match_id, }; -static int __init sensor_mod_init(void) +int max96714_sensor_mod_init(void) { return i2c_add_driver(&max96714_i2c_driver); } +#ifndef CONFIG_VIDEO_REVERSE_IMAGE +device_initcall_sync(max96714_sensor_mod_init); +#endif + static void __exit sensor_mod_exit(void) { i2c_del_driver(&max96714_i2c_driver); } -device_initcall_sync(sensor_mod_init); module_exit(sensor_mod_exit); MODULE_DESCRIPTION("Maxim max96714 sensor driver"); diff --git a/drivers/media/i2c/max96714.h b/drivers/media/i2c/max96714.h new file mode 100644 index 000000000000..4ce77b466ea5 --- /dev/null +++ b/drivers/media/i2c/max96714.h @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * max96714 driver + * + */ +#ifndef _MAX96714_H_ +#define _MAX96714_H_ + +int max96714_sensor_mod_init(void); + +#endif diff --git a/drivers/media/i2c/nvp6188.c b/drivers/media/i2c/nvp6188.c index 664c7a90fb6c..bb58c9aab72b 100644 --- a/drivers/media/i2c/nvp6188.c +++ b/drivers/media/i2c/nvp6188.c @@ -42,6 +42,7 @@ #include #include +#include "nvp6188.h" #define DRIVER_VERSION KERNEL_VERSION(0, 0x01, 0x2) @@ -2743,17 +2744,20 @@ static struct i2c_driver nvp6188_i2c_driver = { .id_table = nvp6188_match_id, }; -static int __init sensor_mod_init(void) +int nvp6188_sensor_mod_init(void) { return i2c_add_driver(&nvp6188_i2c_driver); } +#ifndef CONFIG_VIDEO_REVERSE_IMAGE +device_initcall_sync(nvp6188_sensor_mod_init); +#endif + static void __exit sensor_mod_exit(void) { i2c_del_driver(&nvp6188_i2c_driver); } -device_initcall_sync(sensor_mod_init); module_exit(sensor_mod_exit); MODULE_AUTHOR("Vicent Chi "); diff --git a/drivers/media/i2c/nvp6188.h b/drivers/media/i2c/nvp6188.h new file mode 100644 index 000000000000..12510a96e11b --- /dev/null +++ b/drivers/media/i2c/nvp6188.h @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * nvp6188 driver + * + */ +#ifndef _NVP6188_H_ +#define _NVP6188_H_ + +int nvp6188_sensor_mod_init(void); + +#endif