diff mbox

[v5,10/10] drm/i915: Add DP branch device info on debugfs

Message ID 1465561685-3939-11-git-send-email-mika.kahola@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mika Kahola June 10, 2016, 12:28 p.m. UTC
Read DisplayPort branch device info from through debugfs
interface.

v2: use drm_dp_helper routines to collect data
v3: cleanup to match the drm_dp_helper.c patches introduced
    earlier in this series

Signed-off-by: Mika Kahola <mika.kahola@intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 72 +++++++++++++++++++++++++++++++++++++
 1 file changed, 72 insertions(+)

Comments

kernel test robot June 10, 2016, 12:46 p.m. UTC | #1
Hi,

[auto build test WARNING on drm/drm-next]
[also build test WARNING on v4.7-rc2 next-20160609]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Mika-Kahola/drm-i915-DP-branch-devices/20160610-203119
base:   git://people.freedesktop.org/~airlied/linux.git drm-next
config: i386-defconfig (attached as .config)
compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/i915/i915_debugfs.c: In function 'intel_dp_info':
>> drivers/gpu/drm/i915/i915_debugfs.c:2954:10: warning: unused variable 'cap' [-Wunused-variable]
     uint8_t cap[4];
             ^~~
>> drivers/gpu/drm/i915/i915_debugfs.c:2953:6: warning: unused variable 'cap_size' [-Wunused-variable]
     int cap_size;
         ^~~~~~~~

vim +/cap +2954 drivers/gpu/drm/i915/i915_debugfs.c

  2947		bool is_branch_device;
  2948		bool detailed_cap_info = intel_dp->dpcd[DP_DOWNSTREAMPORT_PRESENT] &
  2949			DP_DETAILED_CAP_INFO_AVAILABLE;
  2950		int type;
  2951		int clk;
  2952		int bpc;
> 2953		int cap_size;
> 2954		uint8_t cap[4];
  2955		char id[6];
  2956	
  2957		seq_printf(m, "\tDPCD rev: %x\n", intel_dp->dpcd[DP_DPCD_REV]);

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot June 10, 2016, 3:22 p.m. UTC | #2
Hi,

[auto build test ERROR on drm/drm-next]
[also build test ERROR on v4.7-rc2 next-20160609]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Mika-Kahola/drm-i915-DP-branch-devices/20160610-203119
base:   git://people.freedesktop.org/~airlied/linux.git drm-next
config: x86_64-randconfig-s1-06102203 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/gpu/drm/i915/i915_debugfs.c: In function 'intel_dp_info':
>> drivers/gpu/drm/i915/i915_debugfs.c:2954:10: error: unused variable 'cap' [-Werror=unused-variable]
     uint8_t cap[4];
             ^~~
>> drivers/gpu/drm/i915/i915_debugfs.c:2953:6: error: unused variable 'cap_size' [-Werror=unused-variable]
     int cap_size;
         ^~~~~~~~
   cc1: all warnings being treated as errors

vim +/cap +2954 drivers/gpu/drm/i915/i915_debugfs.c

  2947		bool is_branch_device;
  2948		bool detailed_cap_info = intel_dp->dpcd[DP_DOWNSTREAMPORT_PRESENT] &
  2949			DP_DETAILED_CAP_INFO_AVAILABLE;
  2950		int type;
  2951		int clk;
  2952		int bpc;
> 2953		int cap_size;
> 2954		uint8_t cap[4];
  2955		char id[6];
  2956	
  2957		seq_printf(m, "\tDPCD rev: %x\n", intel_dp->dpcd[DP_DPCD_REV]);

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index e4f2c55..442df3a 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -2943,9 +2943,81 @@  static void intel_dp_info(struct seq_file *m,
 {
 	struct intel_encoder *intel_encoder = intel_connector->encoder;
 	struct intel_dp *intel_dp = enc_to_intel_dp(&intel_encoder->base);
+	struct drm_dp_revision rev;
+	bool is_branch_device;
+	bool detailed_cap_info = intel_dp->dpcd[DP_DOWNSTREAMPORT_PRESENT] &
+		DP_DETAILED_CAP_INFO_AVAILABLE;
+	int type;
+	int clk;
+	int bpc;
+	int cap_size;
+	uint8_t cap[4];
+	char id[6];
 
 	seq_printf(m, "\tDPCD rev: %x\n", intel_dp->dpcd[DP_DPCD_REV]);
 	seq_printf(m, "\taudio support: %s\n", yesno(intel_dp->has_audio));
+
+	is_branch_device = intel_dp->dpcd[DP_DOWNSTREAMPORT_PRESENT] &
+		DP_DWN_STRM_PORT_PRESENT;
+	seq_printf(m, "\tbranch device: %s\n", yesno(is_branch_device));
+
+	if (is_branch_device) {
+		type = intel_dp->downstream_ports[0] & DP_DS_PORT_TYPE_MASK;
+
+		switch (type) {
+		case DP_DS_PORT_TYPE_DP:
+			seq_printf(m, "\ttype: DisplayPort\n");
+			break;
+		case DP_DS_PORT_TYPE_VGA:
+			seq_printf(m, "\ttype: VGA\n");
+			break;
+		case DP_DS_PORT_TYPE_DVI:
+			seq_printf(m, "\ttype: DVI\n");
+			break;
+		case DP_DS_PORT_TYPE_HDMI:
+			seq_printf(m, "\ttype: HDMI\n");
+			break;
+		case DP_DS_PORT_TYPE_NON_EDID:
+			seq_printf(m, "\ttype: others without EDID support\n");
+			break;
+		case DP_DS_PORT_TYPE_DP_DUALMODE:
+			seq_printf(m, "\ttype: DP++\n");
+			break;
+		case DP_DS_PORT_TYPE_WIRELESS:
+			seq_printf(m, "\ttype: Wireless\n");
+			break;
+		default:
+			seq_printf(m, "\ttype: N/A\n");
+		}
+
+		drm_dp_downstream_id(&intel_dp->aux, id);
+		seq_printf(m, "\tDevice id: %s\n", id);
+
+		rev = drm_dp_downstream_hw_rev(&intel_dp->aux);
+		seq_printf(m, "\tHW revision: %.2d.%.2d\n", rev.major, rev.minor);
+
+		rev = drm_dp_downstream_sw_rev(&intel_dp->aux);
+		seq_printf(m, "\tSW revision: %.2d.%.2d\n", rev.major, rev.minor);
+
+		if (detailed_cap_info) {
+			clk = drm_dp_downstream_max_clock(intel_dp->dpcd,
+							  intel_dp->downstream_ports);
+
+			if (clk > 0) {
+				if (type == DP_DS_PORT_TYPE_VGA)
+					seq_printf(m, "\tMax dot clock: %d kHz\n", clk);
+				else
+					seq_printf(m, "\tMax TMDS clock: %d kHz\n", clk);
+			}
+
+			bpc = drm_dp_downstream_max_bpc(intel_dp->dpcd,
+							intel_dp->downstream_ports);
+
+			if (bpc > 0)
+				seq_printf(m, "\tMax bpc: %d\n", bpc);
+		}
+	}
+
 	if (intel_encoder->type == INTEL_OUTPUT_EDP)
 		intel_panel_info(m, &intel_connector->panel);
 }