forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-02-19 1c055e55a242a33e574e48be530e06770a210dcd
kernel/drivers/gpu/drm/rockchip/rk628/rk628_dsi.c
....@@ -15,9 +15,8 @@
1515 #include <linux/reset.h>
1616 #include <linux/phy/phy.h>
1717
18
-#include <drm/drmP.h>
1918 #include <drm/drm_atomic_helper.h>
20
-#include <drm/drm_crtc_helper.h>
19
+#include <drm/drm_probe_helper.h>
2120 #include <drm/drm_mipi_dsi.h>
2221 #include <drm/drm_of.h>
2322 #include <drm/drm_panel.h>
....@@ -638,6 +637,9 @@
638637 u32 val;
639638 int ret;
640639
640
+ if (!vrefresh)
641
+ return -EINVAL;
642
+
641643 ret = regmap_read_poll_timeout(dsi->regmap,
642644 dsi->reg_base + DSI_CMD_PKT_STATUS,
643645 val, !(val & GEN_RD_CMD_BUSY),
....@@ -863,7 +865,7 @@
863865 {
864866 struct rk628_dsi *dsi = connector_to_dsi(connector);
865867
866
- return drm_panel_get_modes(dsi->panel);
868
+ return drm_panel_get_modes(dsi->panel, connector);
867869 }
868870
869871 static struct drm_connector_helper_funcs rk628_dsi_connector_helper_funcs = {
....@@ -1121,7 +1123,7 @@
11211123 bus_width |= COMBTXPHY_MODULEA_EN;
11221124 phy_set_bus_width(dsi->phy, bus_width);
11231125
1124
- ret = phy_set_mode(dsi->phy, PHY_MODE_VIDEO_MIPI);
1126
+ ret = phy_set_mode(dsi->phy, PHY_MODE_MIPI_DPHY);
11251127 if (ret) {
11261128 dev_err(dsi->dev, "failed to set phy mode: %d\n", ret);
11271129 return;
....@@ -1150,8 +1152,8 @@
11501152 }
11511153
11521154 static void rk628_dsi_bridge_mode_set(struct drm_bridge *bridge,
1153
- struct drm_display_mode *mode,
1154
- struct drm_display_mode *adj)
1155
+ const struct drm_display_mode *mode,
1156
+ const struct drm_display_mode *adj)
11551157 {
11561158 struct rk628_dsi *dsi = bridge_to_dsi(bridge);
11571159
....@@ -1162,7 +1164,8 @@
11621164 }
11631165 }
11641166
1165
-static int rk628_dsi_bridge_attach(struct drm_bridge *bridge)
1167
+static int rk628_dsi_bridge_attach(struct drm_bridge *bridge,
1168
+ enum drm_bridge_attach_flags flags)
11661169 {
11671170 struct rk628_dsi *dsi = bridge_to_dsi(bridge);
11681171 struct drm_connector *connector = &dsi->connector;
....@@ -1171,6 +1174,9 @@
11711174
11721175 if (!dsi->panel)
11731176 return -EPROBE_DEFER;
1177
+
1178
+ if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)
1179
+ return 0;
11741180
11751181 ret = drm_connector_init(drm, connector, &rk628_dsi_connector_funcs,
11761182 DRM_MODE_CONNECTOR_DSI);
....@@ -1181,12 +1187,6 @@
11811187
11821188 drm_connector_helper_add(connector, &rk628_dsi_connector_helper_funcs);
11831189 drm_connector_attach_encoder(connector, bridge->encoder);
1184
-
1185
- ret = drm_panel_attach(dsi->panel, connector);
1186
- if (ret) {
1187
- dev_err(dsi->dev, "Failed to attach panel\n");
1188
- return ret;
1189
- }
11901190
11911191 return 0;
11921192 }