drm/doc: Improve docs around connector (un)registration
[sfrench/cifs-2.6.git] / drivers / gpu / drm / drm_dp_helper.c
index 54a6414c5d961fa7d7e483e651dfe5376f10211f..f373798d82f62118a38bc1401935bfdb9a843b56 100644 (file)
  * OF THIS SOFTWARE.
  */
 
-#include <linux/kernel.h>
-#include <linux/module.h>
 #include <linux/delay.h>
-#include <linux/init.h>
 #include <linux/errno.h>
-#include <linux/sched.h>
 #include <linux/i2c.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/sched.h>
 #include <linux/seq_file.h>
+
 #include <drm/drm_dp_helper.h>
-#include <drm/drmP.h>
+#include <drm/drm_print.h>
+#include <drm/drm_vblank.h>
 
 #include "drm_crtc_helper_internal.h"
 
@@ -150,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);
 
@@ -1130,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.
  */
@@ -1278,7 +1265,9 @@ static const struct dpcd_quirk dpcd_quirk_list[] = {
        /* LG LP140WF6-SPM1 eDP panel */
        { OUI(0x00, 0x22, 0xb9), DEVICE_ID('s', 'i', 'v', 'a', 'r', 'T'), false, BIT(DP_DPCD_QUIRK_CONSTANT_N) },
        /* Apple panels need some additional handling to support PSR */
-       { OUI(0x00, 0x10, 0xfa), DEVICE_ID_ANY, false, BIT(DP_DPCD_QUIRK_NO_PSR) }
+       { OUI(0x00, 0x10, 0xfa), DEVICE_ID_ANY, false, BIT(DP_DPCD_QUIRK_NO_PSR) },
+       /* CH7511 seems to leave SINK_COUNT zeroed */
+       { OUI(0x00, 0x00, 0x00), DEVICE_ID('C', 'H', '7', '5', '1', '1'), false, BIT(DP_DPCD_QUIRK_NO_SINK_COUNT) },
 };
 
 #undef OUI