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) !=
....@@ -751,32 +651,18 @@
751651 * run the event_work to re-connect it.
752652 */
753653 if (!dp->connected && cdn_dp_connected_port(dp))
754
- schedule_work(&dp->event_work);
654
+ schedule_delayed_work(&dp->event_work, 0);
755655 }
756656
757657 static int cdn_dp_encoder_atomic_check(struct drm_encoder *encoder,
758658 struct drm_crtc_state *crtc_state,
759659 struct drm_connector_state *conn_state)
760660 {
761
- struct cdn_dp_device *dp = encoder_to_dp(encoder);
762
- struct drm_display_info *di = &dp->connector.display_info;
763661 struct rockchip_crtc_state *s = to_rockchip_crtc_state(crtc_state);
764
-
765
- switch (di->bpc) {
766
- case 6:
767
- s->bus_format = MEDIA_BUS_FMT_RGB666_1X24_CPADHI;
768
- break;
769
- case 8:
770
- default:
771
- s->bus_format = MEDIA_BUS_FMT_RGB888_1X24;
772
- break;
773
- }
774662
775663 s->output_mode = ROCKCHIP_OUT_MODE_AAAA;
776664 s->output_type = DRM_MODE_CONNECTOR_DisplayPort;
777665 s->tv_state = &conn_state->tv;
778
- s->eotf = TRADITIONAL_GAMMA_SDR;
779
- s->color_space = V4L2_COLORSPACE_DEFAULT;
780666
781667 return 0;
782668 }
....@@ -786,10 +672,6 @@
786672 .enable = cdn_dp_encoder_enable,
787673 .disable = cdn_dp_encoder_disable,
788674 .atomic_check = cdn_dp_encoder_atomic_check,
789
-};
790
-
791
-static const struct drm_encoder_funcs cdn_dp_encoder_funcs = {
792
- .destroy = drm_encoder_cleanup,
793675 };
794676
795677 static int cdn_dp_parse_dt(struct cdn_dp_device *dp)
....@@ -863,53 +745,6 @@
863745 return 0;
864746 }
865747
866
-struct dp_sdp {
867
- struct dp_sdp_header sdp_header;
868
- u8 db[28];
869
-} __packed;
870
-
871
-static int cdn_dp_setup_audio_infoframe(struct cdn_dp_device *dp)
872
-{
873
- struct dp_sdp infoframe_sdp;
874
- struct hdmi_audio_infoframe frame;
875
- u8 buffer[14];
876
- ssize_t err;
877
-
878
- /* Prepare VSC packet as per EDP 1.4 spec, Table 6.9 */
879
- memset(&infoframe_sdp, 0, sizeof(infoframe_sdp));
880
- infoframe_sdp.sdp_header.HB0 = 0;
881
- infoframe_sdp.sdp_header.HB1 = HDMI_INFOFRAME_TYPE_AUDIO;
882
- infoframe_sdp.sdp_header.HB2 = 0x1b;
883
- infoframe_sdp.sdp_header.HB3 = 0x48;
884
-
885
- err = hdmi_audio_infoframe_init(&frame);
886
- if (err < 0) {
887
- DRM_DEV_ERROR(dp->dev, "Failed to setup audio infoframe: %zd\n",
888
- err);
889
- return err;
890
- }
891
-
892
- frame.coding_type = HDMI_AUDIO_CODING_TYPE_STREAM;
893
- frame.sample_frequency = HDMI_AUDIO_SAMPLE_FREQUENCY_STREAM;
894
- frame.sample_size = HDMI_AUDIO_SAMPLE_SIZE_STREAM;
895
- frame.channels = 0;
896
-
897
- err = hdmi_audio_infoframe_pack(&frame, buffer, sizeof(buffer));
898
- if (err < 0) {
899
- DRM_DEV_ERROR(dp->dev, "Failed to pack audio infoframe: %zd\n",
900
- err);
901
- return err;
902
- }
903
-
904
- memcpy(&infoframe_sdp.db[0], &buffer[HDMI_INFOFRAME_HEADER_SIZE],
905
- sizeof(buffer) - HDMI_INFOFRAME_HEADER_SIZE);
906
-
907
- cdn_dp_infoframe_set(dp, 0, (u8 *)&infoframe_sdp,
908
- sizeof(infoframe_sdp), 0x84);
909
-
910
- return 0;
911
-}
912
-
913748 static int cdn_dp_audio_hw_params(struct device *dev, void *data,
914749 struct hdmi_codec_daifmt *daifmt,
915750 struct hdmi_codec_params *params)
....@@ -924,7 +759,7 @@
924759
925760 mutex_lock(&dp->lock);
926761 if (!dp->active) {
927
- ret = 0;
762
+ ret = -ENODEV;
928763 goto out;
929764 }
930765
....@@ -940,10 +775,6 @@
940775 ret = -EINVAL;
941776 goto out;
942777 }
943
-
944
- ret = cdn_dp_setup_audio_infoframe(dp);
945
- if (ret)
946
- goto out;
947778
948779 ret = cdn_dp_audio_config(dp, &audio);
949780 if (!ret)
....@@ -970,15 +801,15 @@
970801 mutex_unlock(&dp->lock);
971802 }
972803
973
-static int cdn_dp_audio_digital_mute(struct device *dev, void *data,
974
- bool enable)
804
+static int cdn_dp_audio_mute_stream(struct device *dev, void *data,
805
+ bool enable, int direction)
975806 {
976807 struct cdn_dp_device *dp = dev_get_drvdata(dev);
977808 int ret;
978809
979810 mutex_lock(&dp->lock);
980811 if (!dp->active) {
981
- ret = 0;
812
+ ret = -ENODEV;
982813 goto out;
983814 }
984815
....@@ -1002,8 +833,9 @@
1002833 static const struct hdmi_codec_ops audio_codec_ops = {
1003834 .hw_params = cdn_dp_audio_hw_params,
1004835 .audio_shutdown = cdn_dp_audio_shutdown,
1005
- .digital_mute = cdn_dp_audio_digital_mute,
836
+ .mute_stream = cdn_dp_audio_mute_stream,
1006837 .get_eld = cdn_dp_audio_get_eld,
838
+ .no_capture_mute = 1,
1007839 };
1008840
1009841 static int cdn_dp_audio_codec_init(struct cdn_dp_device *dp,
....@@ -1038,8 +870,7 @@
1038870 mutex_unlock(&dp->lock);
1039871
1040872 while (time_before(jiffies, timeout)) {
1041
- ret = request_firmware_direct(&dp->fw, CDN_DP_FIRMWARE,
1042
- dp->dev);
873
+ ret = request_firmware(&dp->fw, CDN_DP_FIRMWARE, dp->dev);
1043874 if (ret == -ENOENT) {
1044875 msleep(sleep);
1045876 sleep *= 2;
....@@ -1062,27 +893,9 @@
1062893 return ret;
1063894 }
1064895
1065
-static bool cdn_dp_needs_link_retrain(struct cdn_dp_device *dp)
1066
-{
1067
- u8 link_status[DP_LINK_STATUS_SIZE];
1068
-
1069
- /*
1070
- * Validate the cached values of link parameters before attempting to
1071
- * retrain.
1072
- */
1073
- if (!dp->link.rate || !dp->link.num_lanes)
1074
- return false;
1075
-
1076
- if (drm_dp_dpcd_read_link_status(&dp->aux, link_status) < 0)
1077
- return false;
1078
-
1079
- /* Retrain if Channel EQ or CR not ok */
1080
- return !drm_dp_channel_eq_ok(link_status, dp->link.num_lanes);
1081
-}
1082
-
1083896 static void cdn_dp_pd_event_work(struct work_struct *work)
1084897 {
1085
- 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,
1086899 event_work);
1087900 struct drm_connector *connector = &dp->connector;
1088901 enum drm_connector_status old_status;
....@@ -1120,9 +933,9 @@
1120933 dp->connected = false;
1121934
1122935 /* Enabled and connected with a sink, re-train if requested */
1123
- } else if (cdn_dp_needs_link_retrain(dp)) {
1124
- unsigned int rate = dp->link.rate;
1125
- 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;
1126939 struct drm_display_mode *mode = &dp->mode;
1127940
1128941 DRM_DEV_INFO(dp->dev, "Connected with sink. Re-train link\n");
....@@ -1135,7 +948,7 @@
1135948
1136949 /* If training result is changed, update the video config */
1137950 if (mode->clock &&
1138
- (rate != dp->link.rate || lanes != dp->link.num_lanes)) {
951
+ (rate != dp->max_rate || lanes != dp->max_lanes)) {
1139952 ret = cdn_dp_config_video(dp);
1140953 if (ret) {
1141954 dp->connected = false;
....@@ -1153,23 +966,6 @@
1153966 connector->status = connector->funcs->detect(connector, false);
1154967 if (old_status != connector->status)
1155968 drm_kms_helper_hotplug_event(dp->drm_dev);
1156
-}
1157
-
1158
-static int cdn_dp_pd_event(struct notifier_block *nb,
1159
- unsigned long event, void *priv)
1160
-{
1161
- struct cdn_dp_port *port = container_of(nb, struct cdn_dp_port,
1162
- event_nb);
1163
- struct cdn_dp_device *dp = port->dp;
1164
-
1165
- /*
1166
- * It would be nice to be able to just do the work inline right here.
1167
- * However, we need to make a bunch of calls that might sleep in order
1168
- * to turn on the block/phy, so use a worker instead.
1169
- */
1170
- schedule_work(&dp->event_work);
1171
-
1172
- return NOTIFY_DONE;
1173969 }
1174970
1175971 static ssize_t cdn_dp_aux_transfer(struct drm_dp_aux *aux,
....@@ -1211,10 +1007,8 @@
12111007 struct cdn_dp_device *dp = dev_get_drvdata(dev);
12121008 struct drm_encoder *encoder;
12131009 struct drm_connector *connector;
1214
- struct cdn_dp_port *port;
12151010 struct drm_device *drm_dev = data;
1216
- struct rockchip_drm_private *private = drm_dev->dev_private;
1217
- int ret, i;
1011
+ int ret;
12181012
12191013 ret = cdn_dp_parse_dt(dp);
12201014 if (ret < 0)
....@@ -1233,16 +1027,16 @@
12331027 if (ret)
12341028 return ret;
12351029
1236
- INIT_WORK(&dp->event_work, cdn_dp_pd_event_work);
1030
+ INIT_DELAYED_WORK(&dp->event_work, cdn_dp_pd_event_work);
12371031
12381032 encoder = &dp->encoder;
12391033
1240
- encoder->possible_crtcs = drm_of_find_possible_crtcs(drm_dev,
1241
- dev->of_node);
1034
+ encoder->possible_crtcs = rockchip_drm_of_find_possible_crtcs(drm_dev,
1035
+ dev->of_node);
12421036 DRM_DEBUG_KMS("possible_crtcs = 0x%x\n", encoder->possible_crtcs);
12431037
1244
- ret = drm_encoder_init(drm_dev, encoder, &cdn_dp_encoder_funcs,
1245
- DRM_MODE_ENCODER_TMDS, NULL);
1038
+ ret = drm_simple_encoder_init(drm_dev, encoder,
1039
+ DRM_MODE_ENCODER_TMDS);
12461040 if (ret) {
12471041 DRM_ERROR("failed to initialize encoder with drm\n");
12481042 return ret;
....@@ -1269,25 +1063,15 @@
12691063 DRM_ERROR("failed to attach connector and encoder\n");
12701064 goto err_free_connector;
12711065 }
1272
- drm_object_attach_property(&connector->base, private->connector_id_prop, 0);
12731066
1274
- for (i = 0; i < dp->ports; i++) {
1275
- port = dp->port[i];
1276
-
1277
- port->event_nb.notifier_call = cdn_dp_pd_event;
1278
- ret = devm_extcon_register_notifier(dp->dev, port->extcon,
1279
- EXTCON_DISP_DP,
1280
- &port->event_nb);
1281
- if (ret) {
1282
- DRM_DEV_ERROR(dev,
1283
- "register EXTCON_DISP_DP notifier err\n");
1284
- goto err_free_connector;
1285
- }
1286
- }
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);
12871071
12881072 pm_runtime_enable(dev);
12891073
1290
- schedule_work(&dp->event_work);
1074
+ schedule_delayed_work(&dp->event_work, 0);
12911075
12921076 return 0;
12931077
....@@ -1304,7 +1088,7 @@
13041088 struct drm_encoder *encoder = &dp->encoder;
13051089 struct drm_connector *connector = &dp->connector;
13061090
1307
- cancel_work_sync(&dp->event_work);
1091
+ cancel_delayed_work_sync(&dp->event_work);
13081092 cdn_dp_encoder_disable(encoder);
13091093 encoder->funcs->destroy(encoder);
13101094 connector->funcs->destroy(connector);
....@@ -1335,14 +1119,14 @@
13351119 return ret;
13361120 }
13371121
1338
-static int cdn_dp_resume(struct device *dev)
1122
+static __maybe_unused int cdn_dp_resume(struct device *dev)
13391123 {
13401124 struct cdn_dp_device *dp = dev_get_drvdata(dev);
13411125
13421126 mutex_lock(&dp->lock);
13431127 dp->suspended = false;
13441128 if (dp->fw_loaded)
1345
- schedule_work(&dp->event_work);
1129
+ schedule_delayed_work(&dp->event_work, 0);
13461130 mutex_unlock(&dp->lock);
13471131
13481132 return 0;
....@@ -1355,39 +1139,30 @@
13551139 struct cdn_dp_data *dp_data;
13561140 struct cdn_dp_port *port;
13571141 struct cdn_dp_device *dp;
1358
- struct extcon_dev *extcon;
13591142 struct phy *phy;
1360
- int i, id;
1143
+ int i;
13611144
13621145 dp = devm_kzalloc(dev, sizeof(*dp), GFP_KERNEL);
13631146 if (!dp)
13641147 return -ENOMEM;
1365
- id = of_alias_get_id(dev->of_node, "dp");
1366
- if (id < 0)
1367
- id = 0;
1368
-
1369
- dp->id = id;
13701148 dp->dev = dev;
13711149
13721150 match = of_match_node(cdn_dp_dt_ids, pdev->dev.of_node);
13731151 dp_data = (struct cdn_dp_data *)match->data;
13741152
13751153 for (i = 0; i < dp_data->max_phy; i++) {
1376
- extcon = extcon_get_edev_by_phandle(dev, i);
13771154 phy = devm_of_phy_get_by_index(dev, dev->of_node, i);
13781155
1379
- if (PTR_ERR(extcon) == -EPROBE_DEFER ||
1380
- PTR_ERR(phy) == -EPROBE_DEFER)
1156
+ if (PTR_ERR(phy) == -EPROBE_DEFER)
13811157 return -EPROBE_DEFER;
13821158
1383
- if (IS_ERR(extcon) || IS_ERR(phy))
1159
+ if (IS_ERR(phy))
13841160 continue;
13851161
13861162 port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL);
13871163 if (!port)
13881164 return -ENOMEM;
13891165
1390
- port->extcon = extcon;
13911166 port->phy = phy;
13921167 port->dp = dp;
13931168 port->id = i;
....@@ -1395,7 +1170,7 @@
13951170 }
13961171
13971172 if (!dp->ports) {
1398
- DRM_DEV_ERROR(dev, "missing extcon or phy\n");
1173
+ DRM_DEV_ERROR(dev, "missing phy\n");
13991174 return -EINVAL;
14001175 }
14011176