All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t 6/6] tools/dpcd_reg: Add dump all functionality
Date: Wed, 5 Sep 2018 19:05:50 -0700	[thread overview]
Message-ID: <20180906020550.GJ2686@intel.com> (raw)
In-Reply-To: <1f12ce3b00332cad63c557ccf9d9f15f0e3594b4.camel@intel.com>

On Wed, Sep 05, 2018 at 05:26:26PM -0700, Dhinakaran Pandiyan wrote:
> On Fri, 2018-08-31 at 21:18 -0700, Rodrigo Vivi wrote:
> > And make it the default when no operation or device is given.
> > 
> > So, this will replace i915_dpcd for now but can be expanded
> > later.
> 
> I think we can include PSR sink status registers too and kill the
> debugfs file

good idea! I will do on the next version.

> 
> > 
> > Current debugfs:
> > 
> > $ sudo cat /sys/kernel/debug/dri/0/DP-1/i915_dpcd
> > 0000: 12 14 c4 01 01 00 01 00 02 02 06 00 00 00 02
> > 0070: 00 00
> > 0080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> > 0100: 14 84 00 06 06 06 06 00 01 04 00
> > 0200: 41 00 77 77 01 03 22 22
> > 0600: 01
> > 0700: 01
> > 0701: 00 00 00 00
> > 0720: 00 01 00 00 00 01 01 00 00 00 00 00 01 00 00 01
> > 0732: 00 00
> > 
> > $ sudo cat /sys/kernel/debug/dri/0/eDP-1/i915_dpcd
> > 0000: 12 14 84 40 00 00 01 01 02 00 00 00 00 0b 00
> > 0070: 01 00
> > 0080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> > 0100: 14 04 00 00 00 00 00 00 00 00 00
> > 0200: 41 00 00 00 80 00 66 66
> > 0600: 01
> > 0700: 02
> > 0701: 9f 40 00 00
> > 0720: 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00
> > 0732: 00 00
> > 
> > new tool:
> > 
> > $ sudo tools/dpcd_reg
> > 
> > Dumping DPDDC-B
> > 0000: 12 14 c4 01 01 00 01 00 02 02 06 00 00 00 02
> > 0070: 00 00
> > 0080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> > 0100: 14 84 00 06 06 06 06 00 01 04 00
> > 0200: 41 00 77 77 01 03 22 22
> > 0600: 01
> > 0700: 01
> > 0701: 00 00 00 00
> > 0720: 00 01 00 00 00 01 01 00 00 00 00 00 01 00 00 01
> > 0732: 00 00
> > 
> > Dumping DPDDC-A
> > 0000: 12 14 84 40 00 00 01 01 02 00 00 00 00 0b 00
> > 0070: 01 00
> > 0080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> > 0100: 14 04 00 00 00 00 00 00 00 00 00
> > 0200: 41 00 00 00 80 00 66 66
> > 0600: 01
> > 0700: 02
> > 0701: 9f 40 00 00
> > 0720: 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00
> > 0732: 00 00
> > 
> > Cc: Tarun Vyas <tarun.vyas@intel.com>
> > Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
> > Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > ---
> >  tools/dpcd_reg.c | 71
> > ++++++++++++++++++++++++++++++++++++++++++++++--
> >  1 file changed, 69 insertions(+), 2 deletions(-)
> > 
> > diff --git a/tools/dpcd_reg.c b/tools/dpcd_reg.c
> > index a141f1fc..0f17383e 100644
> > --- a/tools/dpcd_reg.c
> > +++ b/tools/dpcd_reg.c
> > @@ -28,6 +28,7 @@
> >  #include "igt_core.h"
> >  #include <errno.h>
> >  #include <fcntl.h>
> > +#include <dirent.h>
> >  
> >  #define INVALID	0xff
> >  
> > @@ -154,6 +155,67 @@ static int dpcd_dump(int fd)
> >  	return 0;
> >  }
> >  
> > +static int dpcd_dump_all()
> > +{
> > +	struct dirent *dirent;
> > +	DIR *dir;
> > +	char dev_path[PATH_MAX];
> > +	char sysfs_path[PATH_MAX];
> > +	int dev_fd, sysfs_fd, ret = 0;
> > +	char dpcd_name[8];
> > +	char discard;
> > +
> > +	dir = opendir("/sys/class/drm_dp_aux_dev/");
> > +	if (!dir) {
> > +		igt_warn("fail to read /dev\n");
> > +		return EXIT_FAILURE;
> > +	}
> > +
> > +	while ((dirent = readdir(dir))) {
> > +		if (strncmp(dirent->d_name, "drm_dp_aux", 10) == 0)
> > {
> > +			sprintf(dev_path, "/dev/%s", dirent-
> > >d_name);
> > +			sprintf(sysfs_path,
> > "/sys/class/drm_dp_aux_dev/%s/name",
> > +				dirent->d_name);
> > +
> > +			sysfs_fd = open(sysfs_path, O_RDONLY);
> > +			if (sysfs_fd < 0) {
> > +				igt_warn("fail to open %s\n",
> > sysfs_path);
> > +				continue;
> > +			}
> > +
> > +			dev_fd = open(dev_path, O_RDONLY);
> > +			if (dev_fd < 0) {
> > +				igt_warn("fail to open %s\n",
> > dev_path);
> > +				continue;
> > +			}
> > +
> > +			ret = read(sysfs_fd, &dpcd_name,
> > sizeof(dpcd_name));
> > +			if (ret < 0) {
> > +				igt_warn("fail to read dpcd name
> > from %s\n\n", sysfs_path);
> > +				continue;
> > +			}
> > +			dpcd_name[ret] = '\0';
> > +
> > +			/* Dummy read to check if dpcd is available
> > */
> > +			ret = read(dev_fd, &discard, 1);
> > +			if (ret != 1) {
> > +				igt_debug("DPCD %s seems not
> > available. skipping...\n", dpcd_name);
> > +				continue;
> > +			}
> > +
> > +			igt_info("\nDumping %s", dpcd_name);
> > +			dpcd_dump(dev_fd);
> > +
> > +			close(sysfs_fd);
> > +			close(dev_fd);
> > +		}
> > +	}
> > +
> > +	closedir(dir);
> > +
> > +	return 0;
> > +}
> > +
> >  int main(int argc, char **argv)
> >  {
> >  	char dev_name[20];
> > @@ -222,8 +284,13 @@ int main(int argc, char **argv)
> >  		print_usage(argv[0], 1);
> >  
> >  	if (devid == -1) {
> > -		igt_warn("Aux device missing\n");
> > -		print_usage(argv[0], 0);
> > +		if (cmd != DUMP) {
> > +			igt_warn("Aux device missing\n");
> > +			print_usage(argv[0], 0);
> > +		}
> > +		else {
> > +			return dpcd_dump_all();
> > +		}
> >  	}
> >  
> >  	if (cmd != DUMP && offset == INVALID) {
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2018-09-06  2:06 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-01  4:18 [igt-dev] [PATCH i-g-t 1/6] tools: Add a simple tool to read/write/decode dpcd registers Rodrigo Vivi
2018-09-01  4:18 ` [igt-dev] [PATCH i-g-t 2/6] tools/dpcd_reg: Improve outputs Rodrigo Vivi
2018-09-05  1:04   ` Dhinakaran Pandiyan
2018-09-01  4:18 ` [igt-dev] [PATCH i-g-t 3/6] tools/dpcd_reg: Unify file handling Rodrigo Vivi
2018-09-05  0:56   ` Dhinakaran Pandiyan
2018-09-05 18:17     ` Rodrigo Vivi
2018-09-15  0:06       ` Tarun Vyas
2018-09-01  4:18 ` [igt-dev] [PATCH i-g-t 4/6] tools/dpcd_reg: Introduce dump as the default operation Rodrigo Vivi
2018-09-01  4:18 ` [igt-dev] [PATCH i-g-t 5/6] tools/dpcd_reg: Make --count optional Rodrigo Vivi
2018-09-05  1:12   ` Dhinakaran Pandiyan
2018-09-05 23:19     ` Rodrigo Vivi
2018-09-01  4:18 ` [igt-dev] [PATCH i-g-t 6/6] tools/dpcd_reg: Add dump all functionality Rodrigo Vivi
2018-09-06  0:26   ` Dhinakaran Pandiyan
2018-09-06  2:05     ` Rodrigo Vivi [this message]
2018-09-01  4:47 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/6] tools: Add a simple tool to read/write/decode dpcd registers Patchwork
2018-09-01  5:40 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2018-09-05  0:48 ` [igt-dev] [PATCH i-g-t 1/6] " Dhinakaran Pandiyan
2018-09-15  0:04   ` Tarun Vyas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180906020550.GJ2686@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=dhinakaran.pandiyan@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.