From 35318c5708e23d3c3f6a4588d90d27fb562fee95 Mon Sep 17 00:00:00 2001 From: Wang Panzhenzhuan Date: Tue, 7 Sep 2021 19:43:13 +0800 Subject: [PATCH] media: i2c: nvp6324: fix compile error Signed-off-by: Wang Panzhenzhuan Change-Id: If7d53e4c6667c09a8db90dca571599f12a2088ce --- drivers/media/i2c/Kconfig | 9 ++++++ drivers/media/i2c/Makefile | 1 + drivers/media/i2c/jaguar1_drv/jaguar1_drv.c | 2 +- drivers/media/i2c/jaguar1_drv/jaguar1_v4l2.c | 31 +++++++++++--------- 4 files changed, 28 insertions(+), 15 deletions(-) diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index 1851167be5f3..4262d3993ccb 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -356,6 +356,15 @@ config VIDEO_ML86V7667 To compile this driver as a module, choose M here: the module will be called ml86v7667. +config VIDEO_NVP6324 + tristate "NEXTCHIP nvp6324 driver support" + depends on VIDEO_V4L2 && I2C + help + Support for the NEXTCHIP NVP6324 video decoder. + + To compile this driver as a module, choose M here: the + module will be called jaguar1_drv. + config VIDEO_SAA7110 tristate "Philips SAA7110 video decoder" depends on VIDEO_V4L2 && I2C diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile index 02c26bf2b5b6..72eac92aec10 100644 --- a/drivers/media/i2c/Makefile +++ b/drivers/media/i2c/Makefile @@ -6,6 +6,7 @@ obj-$(CONFIG_VIDEO_SMIAPP) += smiapp/ obj-$(CONFIG_VIDEO_ET8EK8) += et8ek8/ obj-$(CONFIG_VIDEO_CX25840) += cx25840/ obj-$(CONFIG_VIDEO_M5MOLS) += m5mols/ +obj-$(CONFIG_VIDEO_NVP6324) += jaguar1_drv/ obj-$(CONFIG_VIDEO_APTINA_PLL) += aptina-pll.o obj-$(CONFIG_VIDEO_TVAUDIO) += tvaudio.o diff --git a/drivers/media/i2c/jaguar1_drv/jaguar1_drv.c b/drivers/media/i2c/jaguar1_drv/jaguar1_drv.c index ce48186fbf85..05e9b81ba9e6 100644 --- a/drivers/media/i2c/jaguar1_drv/jaguar1_drv.c +++ b/drivers/media/i2c/jaguar1_drv/jaguar1_drv.c @@ -743,7 +743,7 @@ static int i2c_client_init(int i2c_bus) if (!i2c_adap) return -EINVAL; - jaguar1_client = i2c_new_device(i2c_adap, &hi_info); + jaguar1_client = i2c_new_client_device(i2c_adap, &hi_info); i2c_put_adapter(i2c_adap); return 0; diff --git a/drivers/media/i2c/jaguar1_drv/jaguar1_v4l2.c b/drivers/media/i2c/jaguar1_drv/jaguar1_v4l2.c index 0547f029c482..dee0c24305f9 100644 --- a/drivers/media/i2c/jaguar1_drv/jaguar1_v4l2.c +++ b/drivers/media/i2c/jaguar1_drv/jaguar1_v4l2.c @@ -1,6 +1,8 @@ // SPDX-License-Identifier: GPL-2.0 /* * jaguar1 driver + * V0.0X01.0X00 first version. + * V0.0X01.0X01 fix kernel5.10 compile error. * */ @@ -38,7 +40,7 @@ #include "jaguar1_mipi.h" #include "jaguar1_drv.h" -#define DRIVER_VERSION KERNEL_VERSION(0, 0x01, 0x0) +#define DRIVER_VERSION KERNEL_VERSION(0, 0x01, 0x1) #ifndef V4L2_CID_DIGITAL_GAIN #define V4L2_CID_DIGITAL_GAIN V4L2_CID_GAIN @@ -67,14 +69,6 @@ /* #define FORCE_720P */ -enum jaguar1_max_pad { - PAD0, - PAD1, - PAD2, - PAD3, - PAD_MAX, -}; - struct jaguar1_gpio { int pltfrm_gpio; const char *label; @@ -469,10 +463,11 @@ static int jaguar1_enum_frame_sizes(struct v4l2_subdev *sd, return 0; } -static int jaguar1_g_mbus_config(struct v4l2_subdev *sd, + +static int jaguar1_g_mbus_config(struct v4l2_subdev *sd, unsigned int pad, struct v4l2_mbus_config *cfg) { - cfg->type = V4L2_MBUS_CSI2; + cfg->type = V4L2_MBUS_CSI2_DPHY; cfg->flags = V4L2_MBUS_CSI2_4_LANE | V4L2_MBUS_CSI2_CHANNELS; @@ -634,8 +629,11 @@ static long jaguar1_compat_ioctl32(struct v4l2_subdev *sd, } ret = jaguar1_ioctl(sd, cmd, inf); - if (!ret) + if (!ret) { ret = copy_to_user(up, inf, sizeof(*inf)); + if (ret) + ret = -EFAULT; + } kfree(inf); break; case RKMODULE_AWB_CFG: @@ -648,6 +646,8 @@ static long jaguar1_compat_ioctl32(struct v4l2_subdev *sd, ret = copy_from_user(cfg, up, sizeof(*cfg)); if (!ret) ret = jaguar1_ioctl(sd, cmd, cfg); + else + ret = -EFAULT; kfree(cfg); break; case RKMODULE_GET_START_STREAM_SEQ: @@ -658,8 +658,11 @@ static long jaguar1_compat_ioctl32(struct v4l2_subdev *sd, } ret = jaguar1_ioctl(sd, cmd, seq); - if (!ret) + if (!ret) { ret = copy_to_user(up, seq, sizeof(*seq)); + if (ret) + ret = -EFAULT; + } kfree(seq); break; default: @@ -698,7 +701,6 @@ static const struct dev_pm_ops jaguar1_pm_ops = { static const struct v4l2_subdev_video_ops jaguar1_video_ops = { .s_stream = jaguar1_stream, - .g_mbus_config = jaguar1_g_mbus_config, }; static const struct v4l2_subdev_pad_ops jaguar1_subdev_pad_ops = { @@ -706,6 +708,7 @@ static const struct v4l2_subdev_pad_ops jaguar1_subdev_pad_ops = { .enum_frame_size = jaguar1_enum_frame_sizes, .get_fmt = jaguar1_get_fmt, .set_fmt = jaguar1_set_fmt, + .get_mbus_config = jaguar1_g_mbus_config, }; static const struct v4l2_subdev_core_ops jaguar1_core_ops = {