From 4c5e6922e5f68b4bc459f6b51a448162cc8d8c91 Mon Sep 17 00:00:00 2001 From: PhilDevProg <91820316+PhilDevProg@users.noreply.github.com> Date: Sat, 27 Jan 2024 00:32:31 +0100 Subject: [PATCH] Fix build for OV1385_INTEL --- Makefile | 1 + README.md | 16 +++++++++ dkms.conf | 4 +++ drivers/media/i2c/Makefile | 1 + drivers/media/i2c/ov13858_intel.c | 48 +++++++++++++++++++++++++-- drivers/media/pci/intel/cio2-bridge.c | 2 ++ 6 files changed, 70 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 4b8b3b551aab..474b6e788dfe 100644 --- a/Makefile +++ b/Makefile @@ -47,6 +47,7 @@ export CONFIG_VIDEO_OV01A10 = m export CONFIG_VIDEO_OV02C10 = m export CONFIG_VIDEO_OV02E10 = m export CONFIG_VIDEO_OV2740 = m +export CONFIG_VIDEO_OV13858_INTEL = n export CONFIG_VIDEO_HM2170 = m export CONFIG_VIDEO_HM2172 = m export CONFIG_VIDEO_HI556 = m diff --git a/README.md b/README.md index b9740f5c784a..a2407a7579e6 100644 --- a/README.md +++ b/README.md @@ -130,6 +130,20 @@ Three ways are available: To compile this driver as a module, choose M here: the module will be called ov02e10. + config VIDEO_OV13858_INTEL + tristate "OmniVision OV13858 sensor support" + depends on VIDEO_DEV && I2C + depends on ACPI || COMPILE_TEST + select MEDIA_CONTROLLER + select VIDEO_V4L2_SUBDEV_API + select V4L2_FWNODE + help + This is a Video4Linux2 sensor driver for the OmniVision + OV13858 camera. + + To compile this driver as a module, choose M here: the + module will be called ov13858_intel. + config VIDEO_HM2170 tristate "Himax HM2170 sensor support" depends on VIDEO_DEV && I2C @@ -166,6 +180,7 @@ Three ways are available: obj-$(CONFIG_VIDEO_OV01A10) += ov01a10.o obj-$(CONFIG_VIDEO_OV02C10) += ov02c10.o obj-$(CONFIG_VIDEO_OV02E10) += ov02e10.o + obj-$(CONFIG_VIDEO_OV13858_INTEL) += ov13858_intel.o obj-$(CONFIG_VIDEO_HM2170) += hm2170.o obj-$(CONFIG_VIDEO_HM2170) += hm2172.o ``` @@ -187,6 +202,7 @@ Three ways are available: CONFIG_VIDEO_HM11B1=m CONFIG_VIDEO_OV02C10=m CONFIG_VIDEO_OV02E10=m + CONFIG_VIDEO_OV13858_INTEL = m CONFIG_VIDEO_HM2170=m CONFIG_VIDEO_HM2172=m # Set this only if you use only 1 camera and don't want too many device nodes in media-ctl diff --git a/dkms.conf b/dkms.conf index fe55696644fd..bb61354d849d 100644 --- a/dkms.conf +++ b/dkms.conf @@ -74,6 +74,10 @@ BUILT_MODULE_NAME[19]="hm2172" BUILT_MODULE_LOCATION[19]="drivers/media/i2c" DEST_MODULE_LOCATION[19]="/updates" +BUILT_MODULE_NAME[19]="ov13858_intel" +BUILT_MODULE_LOCATION[19]="drivers/media/i2c" +DEST_MODULE_LOCATION[19]="/updates" + BUILT_MODULE_NAME[20]="hi556" BUILT_MODULE_LOCATION[20]="drivers/media/i2c" DEST_MODULE_LOCATION[20]="/updates" diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile index 1f395448bc7a..c48273079393 100644 --- a/drivers/media/i2c/Makefile +++ b/drivers/media/i2c/Makefile @@ -8,6 +8,7 @@ obj-$(CONFIG_VIDEO_OV01A10) += ov01a10.o obj-$(CONFIG_VIDEO_OV02C10) += ov02c10.o obj-$(CONFIG_VIDEO_OV02E10) += ov02e10.o obj-$(CONFIG_VIDEO_OV2740) += ov2740.o +obj-$(CONFIG_VIDEO_OV13858_INTEL) += ov13858_intel.o obj-$(CONFIG_VIDEO_HM2170) += hm2170.o obj-$(CONFIG_VIDEO_HM2170) += hm2172.o obj-$(CONFIG_VIDEO_HI556) += hi556.o diff --git a/drivers/media/i2c/ov13858_intel.c b/drivers/media/i2c/ov13858_intel.c index 43885cf3156a..d8d8d2ee977f 100644 --- a/drivers/media/i2c/ov13858_intel.c +++ b/drivers/media/i2c/ov13858_intel.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -1380,9 +1381,15 @@ static int ov13858_write_reg_list(struct ov13858 *ov13858, static int ov13858_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) { struct ov13858 *ov13858 = to_ov13858(sd); +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0) struct v4l2_mbus_framefmt *try_fmt = v4l2_subdev_get_try_format(sd, fh->pad, 0); +#else + struct v4l2_mbus_framefmt *try_fmt = v4l2_subdev_get_try_format(sd, + fh->state, + 0); +#endif mutex_lock(&ov13858->mutex); @@ -1516,7 +1523,11 @@ static const struct v4l2_ctrl_ops ov13858_ctrl_ops = { }; static int ov13858_enum_mbus_code(struct v4l2_subdev *sd, +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0) struct v4l2_subdev_pad_config *cfg, +#else + struct v4l2_subdev_state *sd_state, +#endif struct v4l2_subdev_mbus_code_enum *code) { /* Only one bayer order(GRBG) is supported */ @@ -1529,7 +1540,11 @@ static int ov13858_enum_mbus_code(struct v4l2_subdev *sd, } static int ov13858_enum_frame_size(struct v4l2_subdev *sd, - struct v4l2_subdev_pad_config *cfg, +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0) + struct v4l2_subdev_pad_config *cfg, +#else + struct v4l2_subdev_state *sd_state, +#endif struct v4l2_subdev_frame_size_enum *fse) { if (fse->index >= ARRAY_SIZE(supported_modes)) @@ -1556,14 +1571,23 @@ static void ov13858_update_pad_format(const struct ov13858_mode *mode, } static int ov13858_do_get_pad_format(struct ov13858 *ov13858, +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0) struct v4l2_subdev_pad_config *cfg, +#else + struct v4l2_subdev_state *sd_state, +#endif struct v4l2_subdev_format *fmt) { struct v4l2_mbus_framefmt *framefmt; struct v4l2_subdev *sd = &ov13858->sd; if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0) framefmt = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); +#else + framefmt = v4l2_subdev_get_try_format(sd, sd_state, fmt->pad); +#endif + fmt->format = *framefmt; } else { ov13858_update_pad_format(ov13858->cur_mode, fmt); @@ -1573,14 +1597,22 @@ static int ov13858_do_get_pad_format(struct ov13858 *ov13858, } static int ov13858_get_pad_format(struct v4l2_subdev *sd, +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0) struct v4l2_subdev_pad_config *cfg, +#else + struct v4l2_subdev_state *sd_state, +#endif struct v4l2_subdev_format *fmt) { struct ov13858 *ov13858 = to_ov13858(sd); int ret; mutex_lock(&ov13858->mutex); +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0) ret = ov13858_do_get_pad_format(ov13858, cfg, fmt); +#else + ret = ov13858_do_get_pad_format(ov13858, sd_state, fmt); +#endif mutex_unlock(&ov13858->mutex); return ret; @@ -1588,7 +1620,11 @@ static int ov13858_get_pad_format(struct v4l2_subdev *sd, static int ov13858_set_pad_format(struct v4l2_subdev *sd, +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0) struct v4l2_subdev_pad_config *cfg, +#else + struct v4l2_subdev_state *sd_state, +#endif struct v4l2_subdev_format *fmt) { struct ov13858 *ov13858 = to_ov13858(sd); @@ -1612,7 +1648,11 @@ ov13858_set_pad_format(struct v4l2_subdev *sd, fmt->format.width, fmt->format.height); ov13858_update_pad_format(mode, fmt); if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0) framefmt = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); +#else + framefmt = v4l2_subdev_get_try_format(sd, sd_state, fmt->pad); +#endif *framefmt = fmt->format; } else { ov13858->cur_mode = mode; @@ -1990,7 +2030,11 @@ static int ov13858_probe(struct i2c_client *client, goto error_handler_free; } +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 13, 0) ret = v4l2_async_register_subdev_sensor_common(&ov13858->sd); +#else + ret = v4l2_async_register_subdev_sensor(&ov13858->sd); +#endif if (ret < 0) goto error_media_entity; @@ -2071,4 +2115,4 @@ MODULE_AUTHOR("Kan, Chris "); MODULE_AUTHOR("Rapolu, Chiranjeevi "); MODULE_AUTHOR("Yang, Hyungwoo "); MODULE_DESCRIPTION("Omnivision ov13858 sensor driver"); -MODULE_LICENSE("GPL v2"); +MODULE_LICENSE("GPL v2"); \ No newline at end of file diff --git a/drivers/media/pci/intel/cio2-bridge.c b/drivers/media/pci/intel/cio2-bridge.c index 4d4cf0a2e6e3..0c34def561be 100644 --- a/drivers/media/pci/intel/cio2-bridge.c +++ b/drivers/media/pci/intel/cio2-bridge.c @@ -55,6 +55,8 @@ static const struct cio2_sensor_config cio2_supported_sensors[] = { CIO2_SENSOR_CONFIG("OVTI13B1", 1, 560000000), /* Omnivision ov08a10 */ CIO2_SENSOR_CONFIG("OVTI08A1", 0, 0), + /* Omnivision ov13858 */ + CIO2_SENSOR_CONFIG("OVTID858", 0, 0), }; static const struct cio2_property_names prop_names = {