forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/gpu/drm/rockchip/cdn-dp-core.c
....@@ -1,35 +1,25 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd
34 * Author: Chris Zhong <zyw@rock-chips.com>
4
- *
5
- * This software is licensed under the terms of the GNU General Public
6
- * License version 2, as published by the Free Software Foundation, and
7
- * may be copied, distributed, and modified under those terms.
8
- *
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
135 */
14
-
15
-#include <drm/drmP.h>
16
-#include <drm/drm_atomic_helper.h>
17
-#include <drm/drm_crtc_helper.h>
18
-#include <drm/drm_dp_helper.h>
19
-#include <drm/drm_edid.h>
20
-#include <drm/drm_of.h>
216
227 #include <linux/clk.h>
238 #include <linux/component.h>
24
-#include <linux/extcon.h>
259 #include <linux/firmware.h>
26
-#include <linux/regmap.h>
27
-#include <linux/reset.h>
2810 #include <linux/mfd/syscon.h>
2911 #include <linux/phy/phy.h>
30
-#include <uapi/linux/videodev2.h>
12
+#include <linux/regmap.h>
13
+#include <linux/reset.h>
3114
3215 #include <sound/hdmi-codec.h>
16
+
17
+#include <drm/drm_atomic_helper.h>
18
+#include <drm/drm_dp_helper.h>
19
+#include <drm/drm_edid.h>
20
+#include <drm/drm_of.h>
21
+#include <drm/drm_probe_helper.h>
22
+#include <drm/drm_simple_kms_helper.h>
3323
3424 #include "cdn-dp-core.h"
3525 #include "cdn-dp-reg.h"
....@@ -152,24 +142,7 @@
152142
153143 static int cdn_dp_get_port_lanes(struct cdn_dp_port *port)
154144 {
155
- struct extcon_dev *edev = port->extcon;
156
- union extcon_property_value property;
157
- int dptx;
158
- u8 lanes;
159
-
160
- dptx = extcon_get_state(edev, EXTCON_DISP_DP);
161
- if (dptx > 0) {
162
- extcon_get_property(edev, EXTCON_DISP_DP,
163
- EXTCON_PROP_USB_SS, &property);
164
- if (property.intval)
165
- lanes = 2;
166
- else
167
- lanes = 4;
168
- } else {
169
- lanes = 0;
170
- }
171
-
172
- return lanes;
145
+ return phy_get_bus_width(port->phy);
173146 }
174147
175148 static int cdn_dp_get_sink_count(struct cdn_dp_device *dp, u8 *sink_count)
....@@ -203,15 +176,12 @@
203176 static bool cdn_dp_check_sink_connection(struct cdn_dp_device *dp)
204177 {
205178 unsigned long timeout = jiffies + msecs_to_jiffies(CDN_DPCD_TIMEOUT_MS);
206
- struct cdn_dp_port *port;
207179 u8 sink_count = 0;
208180
209181 if (dp->active_port < 0 || dp->active_port >= dp->ports) {
210182 DRM_DEV_ERROR(dp->dev, "active_port is wrong!\n");
211183 return false;
212184 }
213
-
214
- port = dp->port[dp->active_port];
215185
216186 /*
217187 * Attempt to read sink count, retry in case the sink may not be ready.
....@@ -220,9 +190,6 @@
220190 * some docks need more time to power up.
221191 */
222192 while (time_before(jiffies, timeout)) {
223
- if (!extcon_get_state(port->extcon, EXTCON_DISP_DP))
224
- return false;
225
-
226193 if (!cdn_dp_get_sink_count(dp, &sink_count))
227194 return sink_count ? true : false;
228195
....@@ -253,22 +220,11 @@
253220 drm_connector_cleanup(connector);
254221 }
255222
256
-static int
257
-cdn_dp_atomic_connector_get_property(struct drm_connector *connector,
258
- const struct drm_connector_state *state,
259
- struct drm_property *property,
260
- uint64_t *val)
223
+static void cdn_dp_oob_hotplug_event(struct drm_connector *connector)
261224 {
262225 struct cdn_dp_device *dp = connector_to_dp(connector);
263
- struct rockchip_drm_private *private = connector->dev->dev_private;
264226
265
- if (property == private->connector_id_prop) {
266
- *val = dp->id;
267
- return 0;
268
- }
269
-
270
- DRM_ERROR("failed to get rockchip CDN DP property\n");
271
- return -EINVAL;
227
+ schedule_delayed_work(&dp->event_work, msecs_to_jiffies(100));
272228 }
273229
274230 static const struct drm_connector_funcs cdn_dp_atomic_connector_funcs = {
....@@ -278,7 +234,6 @@
278234 .reset = drm_atomic_helper_connector_reset,
279235 .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
280236 .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
281
- .atomic_get_property = cdn_dp_atomic_connector_get_property,
282237 };
283238
284239 static int cdn_dp_connector_get_modes(struct drm_connector *connector)
....@@ -298,27 +253,19 @@
298253 if (ret)
299254 drm_connector_update_edid_property(connector,
300255 edid);
301
- } else {
302
- ret = rockchip_drm_add_modes_noedid(connector);
303
-
304
- dev_info(dp->dev, "failed to get edid\n");
305256 }
306257 mutex_unlock(&dp->lock);
307258
308259 return ret;
309260 }
310261
311
-static int cdn_dp_connector_mode_valid(struct drm_connector *connector,
312
- struct drm_display_mode *mode)
262
+static enum drm_mode_status
263
+cdn_dp_connector_mode_valid(struct drm_connector *connector,
264
+ struct drm_display_mode *mode)
313265 {
314266 struct cdn_dp_device *dp = connector_to_dp(connector);
315267 struct drm_display_info *display_info = &dp->connector.display_info;
316268 u32 requested, actual, rate, sink_max, source_max = 0;
317
- struct drm_encoder *encoder = connector->encoder;
318
- enum drm_mode_status status = MODE_OK;
319
- struct drm_device *dev = connector->dev;
320
- struct rockchip_drm_private *priv = dev->dev_private;
321
- struct drm_crtc *crtc;
322269 u8 lanes, bpc;
323270
324271 /* If DP is disconnected, every mode is invalid */
....@@ -336,9 +283,6 @@
336283 bpc = 8;
337284 break;
338285 }
339
-
340
- if (!IS_ALIGNED(mode->hdisplay * bpc, 8))
341
- return MODE_H_ILLEGAL;
342286
343287 requested = mode->clock * bpc * 3 / 1000;
344288
....@@ -360,42 +304,6 @@
360304 "requested=%d, actual=%d, clock=%d\n",
361305 requested, actual, mode->clock);
362306 return MODE_CLOCK_HIGH;
363
- }
364
-
365
- if (!encoder) {
366
- const struct drm_connector_helper_funcs *funcs;
367
-
368
- funcs = connector->helper_private;
369
- if (funcs->atomic_best_encoder)
370
- encoder = funcs->atomic_best_encoder(connector,
371
- connector->state);
372
- else if (funcs->best_encoder)
373
- encoder = funcs->best_encoder(connector);
374
- else
375
- encoder = drm_atomic_helper_best_encoder(connector);
376
- }
377
-
378
- if (!encoder || !encoder->possible_crtcs)
379
- return MODE_BAD;
380
- /*
381
- * ensure all drm display mode can work, if someone want support more
382
- * resolutions, please limit the possible_crtc, only connect to
383
- * needed crtc.
384
- */
385
- drm_for_each_crtc(crtc, connector->dev) {
386
- int pipe = drm_crtc_index(crtc);
387
- const struct rockchip_crtc_funcs *funcs =
388
- priv->crtc_funcs[pipe];
389
-
390
- if (!(encoder->possible_crtcs & drm_crtc_mask(crtc)))
391
- continue;
392
- if (!funcs || !funcs->mode_valid)
393
- continue;
394
-
395
- status = funcs->mode_valid(crtc, mode,
396
- DRM_MODE_CONNECTOR_HDMIA);
397
- if (status != MODE_OK)
398
- return status;
399307 }
400308
401309 return MODE_OK;
....@@ -458,7 +366,6 @@
458366
459367 static int cdn_dp_enable_phy(struct cdn_dp_device *dp, struct cdn_dp_port *port)
460368 {
461
- union extcon_property_value property;
462369 int ret;
463370
464371 if (!port->phy_enabled) {
....@@ -485,15 +392,8 @@
485392 goto err_power_on;
486393 }
487394
488
- ret = extcon_get_property(port->extcon, EXTCON_DISP_DP,
489
- EXTCON_PROP_USB_TYPEC_POLARITY, &property);
490
- if (ret) {
491
- DRM_DEV_ERROR(dp->dev, "get property failed\n");
492
- goto err_power_on;
493
- }
494
-
495395 port->lanes = cdn_dp_get_port_lanes(port);
496
- ret = cdn_dp_set_host_cap(dp, port->lanes, property.intval);
396
+ ret = cdn_dp_set_host_cap(dp, port->lanes, 0);
497397 if (ret) {
498398 DRM_DEV_ERROR(dp->dev, "set host capabilities failed: %d\n",
499399 ret);
....@@ -555,8 +455,8 @@
555455 cdn_dp_set_firmware_active(dp, false);
556456 cdn_dp_clk_disable(dp);
557457 dp->active = false;
558
- dp->link.rate = 0;
559
- dp->link.num_lanes = 0;
458
+ dp->max_lanes = 0;
459
+ dp->max_rate = 0;
560460 if (!dp->connected) {
561461 kfree(dp->edid);
562462 dp->edid = NULL;
....@@ -639,7 +539,7 @@
639539 video->v_sync_polarity = !!(mode->flags & DRM_MODE_FLAG_NVSYNC);
640540 video->h_sync_polarity = !!(mode->flags & DRM_MODE_FLAG_NHSYNC);
641541
642
- memcpy(&dp->mode, adjusted, sizeof(*mode));
542
+ drm_mode_copy(&dp->mode, adjusted);
643543 }
644544
645545 static bool cdn_dp_check_link_status(struct cdn_dp_device *dp)
....@@ -648,7 +548,7 @@
648548 struct cdn_dp_port *port = cdn_dp_connected_port(dp);
649549 u8 sink_lanes = drm_dp_max_lane_count(dp->dpcd);
650550
651
- if (!port || !dp->link.rate || !dp->link.num_lanes)
551
+ if (!port || !dp->max_rate || !dp->max_lanes)
652552 return false;
653553
654554 if (drm_dp_dpcd_read_link_status(&dp->aux, link_status) !=
....@@ -729,8 +629,6 @@
729629 static void cdn_dp_encoder_disable(struct drm_encoder *encoder)
730630 {
731631 struct cdn_dp_device *dp = encoder_to_dp(encoder);
732
- struct drm_crtc *crtc = encoder->crtc;
733
- struct rockchip_crtc_state *s = to_rockchip_crtc_state(crtc->state);
734632 int ret;
735633
736634 mutex_lock(&dp->lock);
....@@ -753,35 +651,18 @@
753651 * run the event_work to re-connect it.
754652 */
755653 if (!dp->connected && cdn_dp_connected_port(dp))
756
- schedule_work(&dp->event_work);
757
-
758
- s->output_if &= ~VOP_OUTPUT_IF_DP0;
654
+ schedule_delayed_work(&dp->event_work, 0);
759655 }
760656
761657 static int cdn_dp_encoder_atomic_check(struct drm_encoder *encoder,
762658 struct drm_crtc_state *crtc_state,
763659 struct drm_connector_state *conn_state)
764660 {
765
- struct cdn_dp_device *dp = encoder_to_dp(encoder);
766
- struct drm_display_info *di = &dp->connector.display_info;
767661 struct rockchip_crtc_state *s = to_rockchip_crtc_state(crtc_state);
768662
769
- switch (di->bpc) {
770
- case 6:
771
- s->bus_format = MEDIA_BUS_FMT_RGB666_1X24_CPADHI;
772
- break;
773
- case 8:
774
- default:
775
- s->bus_format = MEDIA_BUS_FMT_RGB888_1X24;
776
- break;
777
- }
778
-
779663 s->output_mode = ROCKCHIP_OUT_MODE_AAAA;
780
- s->output_if |= VOP_OUTPUT_IF_DP0;
781664 s->output_type = DRM_MODE_CONNECTOR_DisplayPort;
782665 s->tv_state = &conn_state->tv;
783
- s->eotf = TRADITIONAL_GAMMA_SDR;
784
- s->color_space = V4L2_COLORSPACE_DEFAULT;
785666
786667 return 0;
787668 }
....@@ -791,10 +672,6 @@
791672 .enable = cdn_dp_encoder_enable,
792673 .disable = cdn_dp_encoder_disable,
793674 .atomic_check = cdn_dp_encoder_atomic_check,
794
-};
795
-
796
-static const struct drm_encoder_funcs cdn_dp_encoder_funcs = {
797
- .destroy = drm_encoder_cleanup,
798675 };
799676
800677 static int cdn_dp_parse_dt(struct cdn_dp_device *dp)
....@@ -868,53 +745,6 @@
868745 return 0;
869746 }
870747
871
-struct dp_sdp {
872
- struct dp_sdp_header sdp_header;
873
- u8 db[28];
874
-} __packed;
875
-
876
-static int cdn_dp_setup_audio_infoframe(struct cdn_dp_device *dp)
877
-{
878
- struct dp_sdp infoframe_sdp;
879
- struct hdmi_audio_infoframe frame;
880
- u8 buffer[14];
881
- ssize_t err;
882
-
883
- /* Prepare VSC packet as per EDP 1.4 spec, Table 6.9 */
884
- memset(&infoframe_sdp, 0, sizeof(infoframe_sdp));
885
- infoframe_sdp.sdp_header.HB0 = 0;
886
- infoframe_sdp.sdp_header.HB1 = HDMI_INFOFRAME_TYPE_AUDIO;
887
- infoframe_sdp.sdp_header.HB2 = 0x1b;
888
- infoframe_sdp.sdp_header.HB3 = 0x48;
889
-
890
- err = hdmi_audio_infoframe_init(&frame);
891
- if (err < 0) {
892
- DRM_DEV_ERROR(dp->dev, "Failed to setup audio infoframe: %zd\n",
893
- err);
894
- return err;
895
- }
896
-
897
- frame.coding_type = HDMI_AUDIO_CODING_TYPE_STREAM;
898
- frame.sample_frequency = HDMI_AUDIO_SAMPLE_FREQUENCY_STREAM;
899
- frame.sample_size = HDMI_AUDIO_SAMPLE_SIZE_STREAM;
900
- frame.channels = 0;
901
-
902
- err = hdmi_audio_infoframe_pack(&frame, buffer, sizeof(buffer));
903
- if (err < 0) {
904
- DRM_DEV_ERROR(dp->dev, "Failed to pack audio infoframe: %zd\n",
905
- err);
906
- return err;
907
- }
908
-
909
- memcpy(&infoframe_sdp.db[0], &buffer[HDMI_INFOFRAME_HEADER_SIZE],
910
- sizeof(buffer) - HDMI_INFOFRAME_HEADER_SIZE);
911
-
912
- cdn_dp_infoframe_set(dp, 0, (u8 *)&infoframe_sdp,
913
- sizeof(infoframe_sdp), 0x84);
914
-
915
- return 0;
916
-}
917
-
918748 static int cdn_dp_audio_hw_params(struct device *dev, void *data,
919749 struct hdmi_codec_daifmt *daifmt,
920750 struct hdmi_codec_params *params)
....@@ -929,7 +759,7 @@
929759
930760 mutex_lock(&dp->lock);
931761 if (!dp->active) {
932
- ret = 0;
762
+ ret = -ENODEV;
933763 goto out;
934764 }
935765
....@@ -945,10 +775,6 @@
945775 ret = -EINVAL;
946776 goto out;
947777 }
948
-
949
- ret = cdn_dp_setup_audio_infoframe(dp);
950
- if (ret)
951
- goto out;
952778
953779 ret = cdn_dp_audio_config(dp, &audio);
954780 if (!ret)
....@@ -975,15 +801,15 @@
975801 mutex_unlock(&dp->lock);
976802 }
977803
978
-static int cdn_dp_audio_digital_mute(struct device *dev, void *data,
979
- bool enable)
804
+static int cdn_dp_audio_mute_stream(struct device *dev, void *data,
805
+ bool enable, int direction)
980806 {
981807 struct cdn_dp_device *dp = dev_get_drvdata(dev);
982808 int ret;
983809
984810 mutex_lock(&dp->lock);
985811 if (!dp->active) {
986
- ret = 0;
812
+ ret = -ENODEV;
987813 goto out;
988814 }
989815
....@@ -1007,8 +833,9 @@
1007833 static const struct hdmi_codec_ops audio_codec_ops = {
1008834 .hw_params = cdn_dp_audio_hw_params,
1009835 .audio_shutdown = cdn_dp_audio_shutdown,
1010
- .digital_mute = cdn_dp_audio_digital_mute,
836
+ .mute_stream = cdn_dp_audio_mute_stream,
1011837 .get_eld = cdn_dp_audio_get_eld,
838
+ .no_capture_mute = 1,
1012839 };
1013840
1014841 static int cdn_dp_audio_codec_init(struct cdn_dp_device *dp,
....@@ -1043,8 +870,7 @@
1043870 mutex_unlock(&dp->lock);
1044871
1045872 while (time_before(jiffies, timeout)) {
1046
- ret = request_firmware_direct(&dp->fw, CDN_DP_FIRMWARE,
1047
- dp->dev);
873
+ ret = request_firmware(&dp->fw, CDN_DP_FIRMWARE, dp->dev);
1048874 if (ret == -ENOENT) {
1049875 msleep(sleep);
1050876 sleep *= 2;
....@@ -1067,27 +893,9 @@
1067893 return ret;
1068894 }
1069895
1070
-static bool cdn_dp_needs_link_retrain(struct cdn_dp_device *dp)
1071
-{
1072
- u8 link_status[DP_LINK_STATUS_SIZE];
1073
-
1074
- /*
1075
- * Validate the cached values of link parameters before attempting to
1076
- * retrain.
1077
- */
1078
- if (!dp->link.rate || !dp->link.num_lanes)
1079
- return false;
1080
-
1081
- if (drm_dp_dpcd_read_link_status(&dp->aux, link_status) < 0)
1082
- return false;
1083
-
1084
- /* Retrain if Channel EQ or CR not ok */
1085
- return !drm_dp_channel_eq_ok(link_status, dp->link.num_lanes);
1086
-}
1087
-
1088896 static void cdn_dp_pd_event_work(struct work_struct *work)
1089897 {
1090
- struct cdn_dp_device *dp = container_of(work, struct cdn_dp_device,
898
+ struct cdn_dp_device *dp = container_of(to_delayed_work(work), struct cdn_dp_device,
1091899 event_work);
1092900 struct drm_connector *connector = &dp->connector;
1093901 enum drm_connector_status old_status;
....@@ -1125,9 +933,9 @@
1125933 dp->connected = false;
1126934
1127935 /* Enabled and connected with a sink, re-train if requested */
1128
- } else if (cdn_dp_needs_link_retrain(dp)) {
1129
- unsigned int rate = dp->link.rate;
1130
- unsigned int lanes = dp->link.num_lanes;
936
+ } else if (!cdn_dp_check_link_status(dp)) {
937
+ unsigned int rate = dp->max_rate;
938
+ unsigned int lanes = dp->max_lanes;
1131939 struct drm_display_mode *mode = &dp->mode;
1132940
1133941 DRM_DEV_INFO(dp->dev, "Connected with sink. Re-train link\n");
....@@ -1140,7 +948,7 @@
1140948
1141949 /* If training result is changed, update the video config */
1142950 if (mode->clock &&
1143
- (rate != dp->link.rate || lanes != dp->link.num_lanes)) {
951
+ (rate != dp->max_rate || lanes != dp->max_lanes)) {
1144952 ret = cdn_dp_config_video(dp);
1145953 if (ret) {
1146954 dp->connected = false;
....@@ -1158,23 +966,6 @@
1158966 connector->status = connector->funcs->detect(connector, false);
1159967 if (old_status != connector->status)
1160968 drm_kms_helper_hotplug_event(dp->drm_dev);
1161
-}
1162
-
1163
-static int cdn_dp_pd_event(struct notifier_block *nb,
1164
- unsigned long event, void *priv)
1165
-{
1166
- struct cdn_dp_port *port = container_of(nb, struct cdn_dp_port,
1167
- event_nb);
1168
- struct cdn_dp_device *dp = port->dp;
1169
-
1170
- /*
1171
- * It would be nice to be able to just do the work inline right here.
1172
- * However, we need to make a bunch of calls that might sleep in order
1173
- * to turn on the block/phy, so use a worker instead.
1174
- */
1175
- schedule_work(&dp->event_work);
1176
-
1177
- return NOTIFY_DONE;
1178969 }
1179970
1180971 static ssize_t cdn_dp_aux_transfer(struct drm_dp_aux *aux,
....@@ -1216,10 +1007,8 @@
12161007 struct cdn_dp_device *dp = dev_get_drvdata(dev);
12171008 struct drm_encoder *encoder;
12181009 struct drm_connector *connector;
1219
- struct cdn_dp_port *port;
12201010 struct drm_device *drm_dev = data;
1221
- struct rockchip_drm_private *private = drm_dev->dev_private;
1222
- int ret, i;
1011
+ int ret;
12231012
12241013 ret = cdn_dp_parse_dt(dp);
12251014 if (ret < 0)
....@@ -1238,16 +1027,16 @@
12381027 if (ret)
12391028 return ret;
12401029
1241
- INIT_WORK(&dp->event_work, cdn_dp_pd_event_work);
1030
+ INIT_DELAYED_WORK(&dp->event_work, cdn_dp_pd_event_work);
12421031
12431032 encoder = &dp->encoder;
12441033
1245
- encoder->possible_crtcs = drm_of_find_possible_crtcs(drm_dev,
1246
- dev->of_node);
1034
+ encoder->possible_crtcs = rockchip_drm_of_find_possible_crtcs(drm_dev,
1035
+ dev->of_node);
12471036 DRM_DEBUG_KMS("possible_crtcs = 0x%x\n", encoder->possible_crtcs);
12481037
1249
- ret = drm_encoder_init(drm_dev, encoder, &cdn_dp_encoder_funcs,
1250
- DRM_MODE_ENCODER_TMDS, NULL);
1038
+ ret = drm_simple_encoder_init(drm_dev, encoder,
1039
+ DRM_MODE_ENCODER_TMDS);
12511040 if (ret) {
12521041 DRM_ERROR("failed to initialize encoder with drm\n");
12531042 return ret;
....@@ -1274,25 +1063,15 @@
12741063 DRM_ERROR("failed to attach connector and encoder\n");
12751064 goto err_free_connector;
12761065 }
1277
- drm_object_attach_property(&connector->base, private->connector_id_prop, 0);
12781066
1279
- for (i = 0; i < dp->ports; i++) {
1280
- port = dp->port[i];
1281
-
1282
- port->event_nb.notifier_call = cdn_dp_pd_event;
1283
- ret = devm_extcon_register_notifier(dp->dev, port->extcon,
1284
- EXTCON_DISP_DP,
1285
- &port->event_nb);
1286
- if (ret) {
1287
- DRM_DEV_ERROR(dev,
1288
- "register EXTCON_DISP_DP notifier err\n");
1289
- goto err_free_connector;
1290
- }
1291
- }
1067
+ dp->sub_dev.connector = &dp->connector;
1068
+ dp->sub_dev.of_node = dev->of_node;
1069
+ dp->sub_dev.oob_hotplug_event = cdn_dp_oob_hotplug_event;
1070
+ rockchip_drm_register_sub_dev(&dp->sub_dev);
12921071
12931072 pm_runtime_enable(dev);
12941073
1295
- schedule_work(&dp->event_work);
1074
+ schedule_delayed_work(&dp->event_work, 0);
12961075
12971076 return 0;
12981077
....@@ -1309,7 +1088,7 @@
13091088 struct drm_encoder *encoder = &dp->encoder;
13101089 struct drm_connector *connector = &dp->connector;
13111090
1312
- cancel_work_sync(&dp->event_work);
1091
+ cancel_delayed_work_sync(&dp->event_work);
13131092 cdn_dp_encoder_disable(encoder);
13141093 encoder->funcs->destroy(encoder);
13151094 connector->funcs->destroy(connector);
....@@ -1340,14 +1119,14 @@
13401119 return ret;
13411120 }
13421121
1343
-static int cdn_dp_resume(struct device *dev)
1122
+static __maybe_unused int cdn_dp_resume(struct device *dev)
13441123 {
13451124 struct cdn_dp_device *dp = dev_get_drvdata(dev);
13461125
13471126 mutex_lock(&dp->lock);
13481127 dp->suspended = false;
13491128 if (dp->fw_loaded)
1350
- schedule_work(&dp->event_work);
1129
+ schedule_delayed_work(&dp->event_work, 0);
13511130 mutex_unlock(&dp->lock);
13521131
13531132 return 0;
....@@ -1360,39 +1139,30 @@
13601139 struct cdn_dp_data *dp_data;
13611140 struct cdn_dp_port *port;
13621141 struct cdn_dp_device *dp;
1363
- struct extcon_dev *extcon;
13641142 struct phy *phy;
1365
- int i, id;
1143
+ int i;
13661144
13671145 dp = devm_kzalloc(dev, sizeof(*dp), GFP_KERNEL);
13681146 if (!dp)
13691147 return -ENOMEM;
1370
- id = of_alias_get_id(dev->of_node, "dp");
1371
- if (id < 0)
1372
- id = 0;
1373
-
1374
- dp->id = id;
13751148 dp->dev = dev;
13761149
13771150 match = of_match_node(cdn_dp_dt_ids, pdev->dev.of_node);
13781151 dp_data = (struct cdn_dp_data *)match->data;
13791152
13801153 for (i = 0; i < dp_data->max_phy; i++) {
1381
- extcon = extcon_get_edev_by_phandle(dev, i);
13821154 phy = devm_of_phy_get_by_index(dev, dev->of_node, i);
13831155
1384
- if (PTR_ERR(extcon) == -EPROBE_DEFER ||
1385
- PTR_ERR(phy) == -EPROBE_DEFER)
1156
+ if (PTR_ERR(phy) == -EPROBE_DEFER)
13861157 return -EPROBE_DEFER;
13871158
1388
- if (IS_ERR(extcon) || IS_ERR(phy))
1159
+ if (IS_ERR(phy))
13891160 continue;
13901161
13911162 port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL);
13921163 if (!port)
13931164 return -ENOMEM;
13941165
1395
- port->extcon = extcon;
13961166 port->phy = phy;
13971167 port->dp = dp;
13981168 port->id = i;
....@@ -1400,7 +1170,7 @@
14001170 }
14011171
14021172 if (!dp->ports) {
1403
- DRM_DEV_ERROR(dev, "missing extcon or phy\n");
1173
+ DRM_DEV_ERROR(dev, "missing phy\n");
14041174 return -EINVAL;
14051175 }
14061176