From 9370bb92b2d16684ee45cf24e879c93c509162da Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Thu, 19 Dec 2024 01:47:39 +0000
Subject: [PATCH] add wifi6 8852be driver

---
 kernel/drivers/media/i2c/gc5035.c |   27 ++++++++++++++++-----------
 1 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/kernel/drivers/media/i2c/gc5035.c b/kernel/drivers/media/i2c/gc5035.c
index 3e74371..9798b3c 100644
--- a/kernel/drivers/media/i2c/gc5035.c
+++ b/kernel/drivers/media/i2c/gc5035.c
@@ -609,9 +609,7 @@
 	struct gc5035 *gc5035 = to_gc5035(sd);
 	const struct gc5035_mode *mode = gc5035->cur_mode;
 
-	mutex_lock(&gc5035->mutex);
 	fi->interval = mode->max_fps;
-	mutex_unlock(&gc5035->mutex);
 
 	return 0;
 }
@@ -698,8 +696,11 @@
 		}
 
 		ret = gc5035_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:
@@ -712,12 +713,17 @@
 		ret = copy_from_user(cfg, up, sizeof(*cfg));
 		if (!ret)
 			ret = gc5035_ioctl(sd, cmd, cfg);
+		else
+			ret = -EFAULT;
 		kfree(cfg);
 		break;
 	case RKMODULE_SET_QUICK_STREAM:
 		ret = copy_from_user(&stream, up, sizeof(u32));
 		if (!ret)
 			ret = gc5035_ioctl(sd, cmd, &stream);
+		else
+			ret = -EFAULT;
+
 		break;
 	default:
 		ret = -ENOTTY;
@@ -956,8 +962,8 @@
 }
 #endif
 
-static int sensor_g_mbus_config(struct v4l2_subdev *sd,
-				struct v4l2_mbus_config *config)
+static int sensor_g_mbus_config(struct v4l2_subdev *sd, unsigned int pad_id,
+				 struct v4l2_mbus_config *config)
 {
 	struct gc5035 *sensor = to_gc5035(sd);
 	struct device *dev = &sensor->client->dev;
@@ -965,7 +971,7 @@
 	dev_info(dev, "%s(%d) enter!\n", __func__, __LINE__);
 
 	if (2 == sensor->lane_num) {
-		config->type = V4L2_MBUS_CSI2;
+		config->type = V4L2_MBUS_CSI2_DPHY;
 		config->flags = V4L2_MBUS_CSI2_2_LANE |
 						V4L2_MBUS_CSI2_CHANNEL_0 |
 						V4L2_MBUS_CSI2_CONTINUOUS_CLOCK;
@@ -985,8 +991,7 @@
 	if (fie->index >= gc5035->cfg_num)
 		return -EINVAL;
 
-	if (fie->code != MEDIA_BUS_FMT_SRGGB10_1X10)
-		return -EINVAL;
+	fie->code = MEDIA_BUS_FMT_SRGGB10_1X10;
 
 	fie->width = supported_modes[fie->index].width;
 	fie->height = supported_modes[fie->index].height;
@@ -1014,7 +1019,6 @@
 };
 
 static const struct v4l2_subdev_video_ops gc5035_video_ops = {
-	.g_mbus_config = sensor_g_mbus_config,
 	.s_stream = gc5035_s_stream,
 	.g_frame_interval = gc5035_g_frame_interval,
 };
@@ -1025,6 +1029,7 @@
 	.enum_frame_interval = gc5035_enum_frame_interval,
 	.get_fmt = gc5035_get_fmt,
 	.set_fmt = gc5035_set_fmt,
+	.get_mbus_config = sensor_g_mbus_config,
 };
 
 static const struct v4l2_subdev_ops gc5035_subdev_ops = {
@@ -1039,8 +1044,8 @@
 
 	dev_info(&gc5035->client->dev, "Test Pattern!!\n");
 	ret = gc5035_write_reg(gc5035->client, 0xfe, 0x01);
-	ret = gc5035_write_reg(gc5035->client, 0x8c, value);
-	ret = gc5035_write_reg(gc5035->client, 0xfe, 0x00);
+	ret |= gc5035_write_reg(gc5035->client, 0x8c, value);
+	ret |= gc5035_write_reg(gc5035->client, 0xfe, 0x00);
 	return ret;
 }
 

--
Gitblit v1.6.2