hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/media/i2c/tc358743.c
....@@ -1604,12 +1604,13 @@
16041604 return 0;
16051605 }
16061606
1607
-static int tc358743_g_mbus_config(struct v4l2_subdev *sd,
1608
- struct v4l2_mbus_config *cfg)
1607
+static int tc358743_get_mbus_config(struct v4l2_subdev *sd,
1608
+ unsigned int pad,
1609
+ struct v4l2_mbus_config *cfg)
16091610 {
16101611 struct tc358743_state *state = to_state(sd);
16111612
1612
- cfg->type = V4L2_MBUS_CSI2;
1613
+ cfg->type = V4L2_MBUS_CSI2_DPHY;
16131614
16141615 /* Support for non-continuous CSI-2 clock is missing in the driver */
16151616 cfg->flags = V4L2_MBUS_CSI2_CONTINUOUS_CLOCK;
....@@ -1838,7 +1839,6 @@
18381839 .s_dv_timings = tc358743_s_dv_timings,
18391840 .g_dv_timings = tc358743_g_dv_timings,
18401841 .query_dv_timings = tc358743_query_dv_timings,
1841
- .g_mbus_config = tc358743_g_mbus_config,
18421842 .s_stream = tc358743_s_stream,
18431843 };
18441844
....@@ -1850,6 +1850,7 @@
18501850 .set_edid = tc358743_s_edid,
18511851 .enum_dv_timings = tc358743_enum_dv_timings,
18521852 .dv_timings_cap = tc358743_dv_timings_cap,
1853
+ .get_mbus_config = tc358743_get_mbus_config,
18531854 };
18541855
18551856 static const struct v4l2_subdev_ops tc358743_ops = {
....@@ -1897,11 +1898,11 @@
18971898 static int tc358743_probe_of(struct tc358743_state *state)
18981899 {
18991900 struct device *dev = &state->i2c_client->dev;
1900
- struct v4l2_fwnode_endpoint *endpoint;
1901
+ struct v4l2_fwnode_endpoint endpoint = { .bus_type = 0 };
19011902 struct device_node *ep;
19021903 struct clk *refclk;
19031904 u32 bps_pr_lane;
1904
- int ret = -EINVAL;
1905
+ int ret;
19051906
19061907 refclk = devm_clk_get(dev, "refclk");
19071908 if (IS_ERR(refclk)) {
....@@ -1917,26 +1918,27 @@
19171918 return -EINVAL;
19181919 }
19191920
1920
- endpoint = v4l2_fwnode_endpoint_alloc_parse(of_fwnode_handle(ep));
1921
- if (IS_ERR(endpoint)) {
1921
+ ret = v4l2_fwnode_endpoint_alloc_parse(of_fwnode_handle(ep), &endpoint);
1922
+ if (ret) {
19221923 dev_err(dev, "failed to parse endpoint\n");
1923
- ret = PTR_ERR(endpoint);
19241924 goto put_node;
19251925 }
19261926
1927
- if (endpoint->bus_type != V4L2_MBUS_CSI2 ||
1928
- endpoint->bus.mipi_csi2.num_data_lanes == 0 ||
1929
- endpoint->nr_of_link_frequencies == 0) {
1927
+ if (endpoint.bus_type != V4L2_MBUS_CSI2_DPHY ||
1928
+ endpoint.bus.mipi_csi2.num_data_lanes == 0 ||
1929
+ endpoint.nr_of_link_frequencies == 0) {
19301930 dev_err(dev, "missing CSI-2 properties in endpoint\n");
1931
+ ret = -EINVAL;
19311932 goto free_endpoint;
19321933 }
19331934
1934
- if (endpoint->bus.mipi_csi2.num_data_lanes > 4) {
1935
+ if (endpoint.bus.mipi_csi2.num_data_lanes > 4) {
19351936 dev_err(dev, "invalid number of lanes\n");
1937
+ ret = -EINVAL;
19361938 goto free_endpoint;
19371939 }
19381940
1939
- state->bus = endpoint->bus.mipi_csi2;
1941
+ state->bus = endpoint.bus.mipi_csi2;
19401942
19411943 ret = clk_prepare_enable(refclk);
19421944 if (ret) {
....@@ -1969,7 +1971,7 @@
19691971 * The CSI bps per lane must be between 62.5 Mbps and 1 Gbps.
19701972 * The default is 594 Mbps for 4-lane 1080p60 or 2-lane 720p60.
19711973 */
1972
- bps_pr_lane = 2 * endpoint->link_frequencies[0];
1974
+ bps_pr_lane = 2 * endpoint.link_frequencies[0];
19731975 if (bps_pr_lane < 62500000U || bps_pr_lane > 1000000000U) {
19741976 dev_err(dev, "unsupported bps per lane: %u bps\n", bps_pr_lane);
19751977 ret = -EINVAL;
....@@ -2016,7 +2018,7 @@
20162018 disable_clk:
20172019 clk_disable_unprepare(refclk);
20182020 free_endpoint:
2019
- v4l2_fwnode_endpoint_free(endpoint);
2021
+ v4l2_fwnode_endpoint_free(&endpoint);
20202022 put_node:
20212023 of_node_put(ep);
20222024 return ret;
....@@ -2028,8 +2030,7 @@
20282030 }
20292031 #endif
20302032
2031
-static int tc358743_probe(struct i2c_client *client,
2032
- const struct i2c_device_id *id)
2033
+static int tc358743_probe(struct i2c_client *client)
20332034 {
20342035 static struct v4l2_dv_timings default_timing =
20352036 V4L2_DV_BT_CEA_640X480P59_94;
....@@ -2224,7 +2225,7 @@
22242225 .name = "tc358743",
22252226 .of_match_table = of_match_ptr(tc358743_of_match),
22262227 },
2227
- .probe = tc358743_probe,
2228
+ .probe_new = tc358743_probe,
22282229 .remove = tc358743_remove,
22292230 .id_table = tc358743_id,
22302231 };