From 2f7c68cb55ecb7331f2381deb497c27155f32faf Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Wed, 03 Jan 2024 09:43:39 +0000
Subject: [PATCH] update kernel to 5.10.198
---
kernel/drivers/media/i2c/tc35874x.c | 43 +++++++++++++++++++++++++------------------
1 files changed, 25 insertions(+), 18 deletions(-)
diff --git a/kernel/drivers/media/i2c/tc35874x.c b/kernel/drivers/media/i2c/tc35874x.c
index d77d47c..692c839 100644
--- a/kernel/drivers/media/i2c/tc35874x.c
+++ b/kernel/drivers/media/i2c/tc35874x.c
@@ -41,6 +41,7 @@
#include <linux/v4l2-dv-timings.h>
#include <linux/hdmi.h>
#include <linux/version.h>
+#include <linux/compat.h>
#include <linux/rk-camera-module.h>
#include <media/v4l2-dv-timings.h>
#include <media/v4l2-device.h>
@@ -1517,7 +1518,7 @@
static irqreturn_t tc35874x_irq_handler(int irq, void *dev_id)
{
struct tc35874x_state *state = dev_id;
- bool handled;
+ bool handled = false;
tc35874x_isr(&state->sd, 0, &handled);
@@ -1660,11 +1661,11 @@
}
static int tc35874x_g_mbus_config(struct v4l2_subdev *sd,
- struct v4l2_mbus_config *cfg)
+ unsigned int pad, struct v4l2_mbus_config *cfg)
{
struct tc35874x_state *state = to_state(sd);
- cfg->type = V4L2_MBUS_CSI2;
+ cfg->type = V4L2_MBUS_CSI2_DPHY;
/* Support for non-continuous CSI-2 clock is missing in the driver */
cfg->flags = V4L2_MBUS_CSI2_CONTINUOUS_CLOCK;
@@ -1747,8 +1748,7 @@
if (fie->index >= ARRAY_SIZE(supported_modes))
return -EINVAL;
- if (fie->code != MEDIA_BUS_FMT_UYVY8_2X8)
- return -EINVAL;
+ fie->code = MEDIA_BUS_FMT_UYVY8_2X8;
fie->width = supported_modes[fie->index].width;
fie->height = supported_modes[fie->index].height;
@@ -1997,8 +1997,11 @@
}
ret = tc35874x_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:
@@ -2011,6 +2014,8 @@
ret = copy_from_user(cfg, up, sizeof(*cfg));
if (!ret)
ret = tc35874x_ioctl(sd, cmd, cfg);
+ else
+ ret = -EFAULT;
kfree(cfg);
break;
default:
@@ -2048,7 +2053,6 @@
.s_dv_timings = tc35874x_s_dv_timings,
.g_dv_timings = tc35874x_g_dv_timings,
.query_dv_timings = tc35874x_query_dv_timings,
- .g_mbus_config = tc35874x_g_mbus_config,
.s_stream = tc35874x_s_stream,
.g_frame_interval = tc35874x_g_frame_interval,
};
@@ -2063,6 +2067,7 @@
.set_edid = tc35874x_s_edid,
.enum_dv_timings = tc35874x_enum_dv_timings,
.dv_timings_cap = tc35874x_dv_timings_cap,
+ .get_mbus_config = tc35874x_g_mbus_config,
};
static const struct v4l2_subdev_ops tc35874x_ops = {
@@ -2129,7 +2134,7 @@
static int tc35874x_probe_of(struct tc35874x_state *state)
{
struct device *dev = &state->i2c_client->dev;
- struct v4l2_fwnode_endpoint *endpoint;
+ struct v4l2_fwnode_endpoint endpoint = { .bus_type = 0 };
struct device_node *ep;
struct clk *refclk;
u32 bps_pr_lane;
@@ -2149,21 +2154,21 @@
return -EINVAL;
}
- endpoint = v4l2_fwnode_endpoint_alloc_parse(of_fwnode_handle(ep));
- if (IS_ERR(endpoint)) {
+ ret = v4l2_fwnode_endpoint_alloc_parse(of_fwnode_handle(ep), &endpoint);
+ if (ret) {
dev_err(dev, "failed to parse endpoint\n");
- return PTR_ERR(endpoint);
+ goto put_node;
}
- if (endpoint->bus_type != V4L2_MBUS_CSI2 ||
- endpoint->bus.mipi_csi2.num_data_lanes == 0 ||
- endpoint->nr_of_link_frequencies == 0) {
+ if (endpoint.bus_type != V4L2_MBUS_CSI2_DPHY ||
+ endpoint.bus.mipi_csi2.num_data_lanes == 0 ||
+ endpoint.nr_of_link_frequencies == 0) {
dev_err(dev, "missing CSI-2 properties in endpoint\n");
goto free_endpoint;
}
- state->csi_lanes_in_use = endpoint->bus.mipi_csi2.num_data_lanes;
- state->bus = endpoint->bus.mipi_csi2;
+ state->csi_lanes_in_use = endpoint.bus.mipi_csi2.num_data_lanes;
+ state->bus = endpoint.bus.mipi_csi2;
ret = clk_prepare_enable(refclk);
if (ret) {
@@ -2196,7 +2201,7 @@
* The CSI bps per lane must be between 62.5 Mbps and 1 Gbps.
* The default is 594 Mbps for 4-lane 1080p60 or 2-lane 720p60.
*/
- bps_pr_lane = 2 * endpoint->link_frequencies[0];
+ bps_pr_lane = 2 * endpoint.link_frequencies[0];
if (bps_pr_lane < 62500000U || bps_pr_lane > 1000000000U) {
dev_err(dev, "unsupported bps per lane: %u bps\n", bps_pr_lane);
goto disable_clk;
@@ -2242,7 +2247,9 @@
disable_clk:
clk_disable_unprepare(refclk);
free_endpoint:
- v4l2_fwnode_endpoint_free(endpoint);
+ v4l2_fwnode_endpoint_free(&endpoint);
+put_node:
+ of_node_put(ep);
return ret;
}
#else
--
Gitblit v1.6.2