drm/doc: Improve docs around connector (un)registration
[sfrench/cifs-2.6.git] / drivers / gpu / drm / drm_dp_helper.c
index 0b994d083a8903580999f381ebf740e516db4162..f373798d82f62118a38bc1401935bfdb9a843b56 100644 (file)
@@ -152,38 +152,15 @@ EXPORT_SYMBOL(drm_dp_link_train_channel_eq_delay);
 
 u8 drm_dp_link_rate_to_bw_code(int link_rate)
 {
-       switch (link_rate) {
-       default:
-               WARN(1, "unknown DP link rate %d, using %x\n", link_rate,
-                    DP_LINK_BW_1_62);
-               /* fall through */
-       case 162000:
-               return DP_LINK_BW_1_62;
-       case 270000:
-               return DP_LINK_BW_2_7;
-       case 540000:
-               return DP_LINK_BW_5_4;
-       case 810000:
-               return DP_LINK_BW_8_1;
-       }
+       /* Spec says link_bw = link_rate / 0.27Gbps */
+       return link_rate / 27000;
 }
 EXPORT_SYMBOL(drm_dp_link_rate_to_bw_code);
 
 int drm_dp_bw_code_to_link_rate(u8 link_bw)
 {
-       switch (link_bw) {
-       default:
-               WARN(1, "unknown DP link BW code %x, using 162000\n", link_bw);
-               /* fall through */
-       case DP_LINK_BW_1_62:
-               return 162000;
-       case DP_LINK_BW_2_7:
-               return 270000;
-       case DP_LINK_BW_5_4:
-               return 540000;
-       case DP_LINK_BW_8_1:
-               return 810000;
-       }
+       /* Spec says link_rate = link_bw * 0.27Gbps */
+       return link_bw * 27000;
 }
 EXPORT_SYMBOL(drm_dp_bw_code_to_link_rate);
 
@@ -1132,6 +1109,14 @@ EXPORT_SYMBOL(drm_dp_aux_init);
  * @aux: DisplayPort AUX channel
  *
  * Automatically calls drm_dp_aux_init() if this hasn't been done yet.
+ * This should only be called when the underlying &struct drm_connector is
+ * initialiazed already. Therefore the best place to call this is from
+ * &drm_connector_funcs.late_register. Not that drivers which don't follow this
+ * will Oops when CONFIG_DRM_DP_AUX_CHARDEV is enabled.
+ *
+ * Drivers which need to use the aux channel before that point (e.g. at driver
+ * load time, before drm_dev_register() has been called) need to call
+ * drm_dp_aux_init().
  *
  * Returns 0 on success or a negative error code on failure.
  */