drm/i915: Add debugfs to read any DPCD register
Subsystems (2)
PATCH v2 1/1 drm/i915: Add debugfs to read any DPCD register
This patch creates a connector specific debugfs interface to read any particular DPCD register. The DPCD register address (hex format) is written to 'i915_dpcd_addr' interface and the corresponding value can be read from 'i915_dpcd_val' interface.
Example usage:
echo 0x70 > i915_dpcd_addr
cat i915_dpcd_val0x1
v2: Address Jani's comments.
--- drivers/gpu/drm/i915/i915_debugfs.c | 88 ++++++++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_drv.h | 1 + 2 files changed, 88 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_debugfs.c +87 -1
@@ -4865,6 +4865,87 @@ static const struct file_operations i915_dpcd_fops = { .release = single_release, }; +static ssize_t i915_dpcd_addr_write (struct file *file,const char __user *ubuf, +size_t len,loff_t *offp) +{ +struct seq_file *m = file->private_data; +struct drm_connector *connector = m->private; +struct intel_dp *intel_dp = +enc_to_intel_dp (&intel_attached_encoder (connector)->base); +unsigned int reg_addr; +char tmp[16 ]; + +if (len >=sizeof (tmp)) +return -EINVAL ; + +if (copy_from_user (tmp, ubuf, len)) +return -EFAULT ; + + tmp[len] ='\0' ; + +if (kstrtouint (tmp,16 , ®_addr)) +return -EINVAL ; + + intel_dp->debugfs_dpcd_addr = reg_addr; + +return len; +} + +static int i915_dpcd_addr_show (struct seq_file *m,void *data) +{ +struct drm_connector *connector = m->private; +struct intel_dp *intel_dp = +enc_to_intel_dp (&intel_attached_encoder (connector)->base); + +seq_printf (m,"0x%x\n" , intel_dp->debugfs_dpcd_addr); + +return 0 ; +} + +static int i915_dpcd_addr_open (struct inode *inode,struct file *file) +{ +return single_open (file, i915_dpcd_addr_show, inode->i_private); +} + +static const struct file_operations i915_dpcd_addr_fops = { + .owner =THIS_MODULE , + .open = i915_dpcd_addr_open, + .read = seq_read, + .write = i915_dpcd_addr_write, + .llseek = seq_lseek, + .release = single_release, +}; + +static int i915_dpcd_val_show (struct seq_file *m,void *data) +{ +struct drm_connector *connector = m->private; +struct intel_dp *intel_dp = +enc_to_intel_dp (&intel_attached_encoder (connector)->base); +u8 val; +int ret; + + ret =drm_dp_dpcd_readb (&intel_dp->aux, + intel_dp->debugfs_dpcd_addr, &val); +if (ret <0 ) +return ret; + +seq_printf (m,"0x%x\n" , val); +return 0 ; +} + +static int i915_dpcd_val_open (struct inode *inode,struct file *file) +{ +return single_open (file, i915_dpcd_val_show, inode->i_private); +} + +static const struct file_operations i915_dpcd_val_fops = { + .owner =THIS_MODULE , + .open = i915_dpcd_val_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; +/** * i915_debugfs_connector_add - add i915 specific connector debugfs files * @connector: pointer to a registered drm_connector
@@ -4883,9 +4964,14 @@ int i915_debugfs_connector_add(struct drm_connector *connector)return -ENODEV ;if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort || - connector->connector_type == DRM_MODE_CONNECTOR_eDP) + connector->connector_type == DRM_MODE_CONNECTOR_eDP) {debugfs_create_file ("i915_dpcd" ,S_IRUGO , root, connector, &i915_dpcd_fops); +debugfs_create_file ("i915_dpcd_addr" ,S_IRUGO |S_IWUSR , + root, connector, &i915_dpcd_addr_fops); +debugfs_create_file ("i915_dpcd_val" ,S_IRUGO , root, + connector, &i915_dpcd_val_fops); + }return 0 ; }
drivers/gpu/drm/i915/intel_drv.h +1 -0
@@ -642,6 +642,7 @@ struct intel_dp {unsigned long last_power_cycle;unsigned long last_power_on;unsigned long last_backlight_off; +unsigned int debugfs_dpcd_addr;struct notifier_block edp_notifier;
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Jani Nikula
maintainerQuoted 6 lines · Durgadoss R
This patch creates a connector specific debugfs interface to read any particular DPCD register. The DPCD register address (hex format) is written to '
i915_dpcd_addr' interface and the corresponding value can be read from 'i915_dpcd_val' interface.
Quoted 6 lines
Example usage:
echo0x70>i915_dpcd_addr
cati915_dpcd_val0x1v2: Address Jani's comments.
So, code-wise this looks good to me.
But like I said in my review of v1, I am undecided on whether we want to have this interface or not. I could really be persuaded either way.
Perhaps Ville or Paulo have an opinion?
BR,
Jani.
Quoted 130 lines
Signed-off-by Durgadoss R <[email protected]>--- drivers/gpu/drm/i915/i915_debugfs.c | 88 ++++++++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_drv.h | 1 + 2 files changed, 88 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/i915_debugfs.c +87
-1@@ -4865,6 +4865,87 @@ static const struct file_operations i915_dpcd_fops = { .release = single_release, }; +static ssize_t i915_dpcd_addr_write (struct file *file,const char __user *ubuf, +size_t len,loff_t *offp) +{ +struct seq_file *m = file->private_data; +struct drm_connector *connector = m->private; +struct intel_dp *intel_dp = +enc_to_intel_dp (&intel_attached_encoder (connector)->base); +unsigned int reg_addr; +char tmp[16 ]; + +if (len >=sizeof (tmp)) +return -EINVAL ; + +if (copy_from_user (tmp, ubuf, len)) +return -EFAULT ; + + tmp[len] ='\0' ; + +if (kstrtouint (tmp,16 , ®_addr)) +return -EINVAL ; + + intel_dp->debugfs_dpcd_addr = reg_addr; + +return len; +} + +static int i915_dpcd_addr_show (struct seq_file *m,void *data) +{ +struct drm_connector *connector = m->private; +struct intel_dp *intel_dp = +enc_to_intel_dp (&intel_attached_encoder (connector)->base); + +seq_printf (m,"0x%x\n" , intel_dp->debugfs_dpcd_addr); + +return 0 ; +} + +static int i915_dpcd_addr_open (struct inode *inode,struct file *file) +{ +return single_open (file, i915_dpcd_addr_show, inode->i_private); +} + +static const struct file_operations i915_dpcd_addr_fops = { + .owner =THIS_MODULE , + .open = i915_dpcd_addr_open, + .read = seq_read, + .write = i915_dpcd_addr_write, + .llseek = seq_lseek, + .release = single_release, +}; + +static int i915_dpcd_val_show (struct seq_file *m,void *data) +{ +struct drm_connector *connector = m->private; +struct intel_dp *intel_dp = +enc_to_intel_dp (&intel_attached_encoder (connector)->base); +u8 val; +int ret; + + ret =drm_dp_dpcd_readb (&intel_dp->aux, + intel_dp->debugfs_dpcd_addr, &val); +if (ret <0 ) +return ret; + +seq_printf (m,"0x%x\n" , val); +return 0 ; +} + +static int i915_dpcd_val_open (struct inode *inode,struct file *file) +{ +return single_open (file, i915_dpcd_val_show, inode->i_private); +} + +static const struct file_operations i915_dpcd_val_fops = { + .owner =THIS_MODULE , + .open = i915_dpcd_val_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; +/** * i915_debugfs_connector_add - add i915 specific connector debugfs files * @connector: pointer to a registered drm_connector @@ -4883,9 +4964,14 @@ int i915_debugfs_connector_add(struct drm_connector *connector)return -ENODEV ;if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort || - connector->connector_type == DRM_MODE_CONNECTOR_eDP) + connector->connector_type == DRM_MODE_CONNECTOR_eDP) {debugfs_create_file ("i915_dpcd" ,S_IRUGO , root, connector, &i915_dpcd_fops); +debugfs_create_file ("i915_dpcd_addr" ,S_IRUGO |S_IWUSR , + root, connector, &i915_dpcd_addr_fops); +debugfs_create_file ("i915_dpcd_val" ,S_IRUGO , root, + connector, &i915_dpcd_val_fops); + }return 0 ; }drivers/gpu/drm/i915/intel_drv.h +1
-0@@ -642,6 +642,7 @@ struct intel_dp {unsigned long last_power_cycle;unsigned long last_power_on;unsigned long last_backlight_off; +unsigned int debugfs_dpcd_addr;struct notifier_block edp_notifier;Signature · 1 line
1.9.1
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 12 lines · Jani Nikula
Quoted 11 lines · Durgadoss R
This patch creates a connector specific debugfs interface to read any particular DPCD register. The DPCD register address (hex format) is written to '
i915_dpcd_addr' interface and the corresponding value can be read from 'i915_dpcd_val' interface.Example usage:
echo0x70>i915_dpcd_addr
cati915_dpcd_val0x1
Quoted 8 lines
Quoted 1 line
v2: Address Jani's comments.
So, code-wise this looks good to me.
But like I said in my review of v1, I am undecided on whether we want to have this interface or not. I could really be persuaded either way.
Perhaps Ville or Paulo have an opinion?
I think having the ability to read (and also write actually) DPCD would be nice.
So I like the idea, but it does seem a bit limited since it doesn't allow writes. So perhaps we should just expose the entire DPCD as a binary file and include a tool in i-g-t to read/write individual pieces?
We could also have a tool to parse the entire thing like we have for the vbt stuff.
Quoted 142 lines
BR,
Jani.Quoted 130 lines
Signed-off-by Durgadoss R <[email protected]>--- drivers/gpu/drm/i915/i915_debugfs.c | 88 ++++++++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_drv.h | 1 + 2 files changed, 88 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/i915_debugfs.c +87
-1@@ -4865,6 +4865,87 @@ static const struct file_operations i915_dpcd_fops = { .release = single_release, }; +static ssize_t i915_dpcd_addr_write (struct file *file,const char __user *ubuf, +size_t len,loff_t *offp) +{ +struct seq_file *m = file->private_data; +struct drm_connector *connector = m->private; +struct intel_dp *intel_dp = +enc_to_intel_dp (&intel_attached_encoder (connector)->base); +unsigned int reg_addr; +char tmp[16 ]; + +if (len >=sizeof (tmp)) +return -EINVAL ; + +if (copy_from_user (tmp, ubuf, len)) +return -EFAULT ; + + tmp[len] ='\0' ; + +if (kstrtouint (tmp,16 , ®_addr)) +return -EINVAL ; + + intel_dp->debugfs_dpcd_addr = reg_addr; + +return len; +} + +static int i915_dpcd_addr_show (struct seq_file *m,void *data) +{ +struct drm_connector *connector = m->private; +struct intel_dp *intel_dp = +enc_to_intel_dp (&intel_attached_encoder (connector)->base); + +seq_printf (m,"0x%x\n" , intel_dp->debugfs_dpcd_addr); + +return 0 ; +} + +static int i915_dpcd_addr_open (struct inode *inode,struct file *file) +{ +return single_open (file, i915_dpcd_addr_show, inode->i_private); +} + +static const struct file_operations i915_dpcd_addr_fops = { + .owner =THIS_MODULE , + .open = i915_dpcd_addr_open, + .read = seq_read, + .write = i915_dpcd_addr_write, + .llseek = seq_lseek, + .release = single_release, +}; + +static int i915_dpcd_val_show (struct seq_file *m,void *data) +{ +struct drm_connector *connector = m->private; +struct intel_dp *intel_dp = +enc_to_intel_dp (&intel_attached_encoder (connector)->base); +u8 val; +int ret; + + ret =drm_dp_dpcd_readb (&intel_dp->aux, + intel_dp->debugfs_dpcd_addr, &val); +if (ret <0 ) +return ret; + +seq_printf (m,"0x%x\n" , val); +return 0 ; +} + +static int i915_dpcd_val_open (struct inode *inode,struct file *file) +{ +return single_open (file, i915_dpcd_val_show, inode->i_private); +} + +static const struct file_operations i915_dpcd_val_fops = { + .owner =THIS_MODULE , + .open = i915_dpcd_val_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; +/** * i915_debugfs_connector_add - add i915 specific connector debugfs files * @connector: pointer to a registered drm_connector @@ -4883,9 +4964,14 @@ int i915_debugfs_connector_add(struct drm_connector *connector)return -ENODEV ;if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort || - connector->connector_type == DRM_MODE_CONNECTOR_eDP) + connector->connector_type == DRM_MODE_CONNECTOR_eDP) {debugfs_create_file ("i915_dpcd" ,S_IRUGO , root, connector, &i915_dpcd_fops); +debugfs_create_file ("i915_dpcd_addr" ,S_IRUGO |S_IWUSR , + root, connector, &i915_dpcd_addr_fops); +debugfs_create_file ("i915_dpcd_val" ,S_IRUGO , root, + connector, &i915_dpcd_val_fops); + }return 0 ; }drivers/gpu/drm/i915/intel_drv.h +1
-0@@ -642,6 +642,7 @@ struct intel_dp {unsigned long last_power_cycle;unsigned long last_power_on;unsigned long last_backlight_off; +unsigned int debugfs_dpcd_addr;struct notifier_block edp_notifier;Signature · 1 line
1.9.1Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 32 lines
-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Thursday, April 16, 2015 8:03 PM
To: Jani Nikula
Cc: R, Durgadoss; [email protected]; Syrjala, Ville; Zanoni, Paulo R
Subject: Re: [Intel-gfx] [PATCH v2] drm/i915: Add debugfs to read any DPCD registerQuoted 12 lines · Jani Nikula
Quoted 11 lines · Durgadoss R
This patch creates a connector specific debugfs interface to read any particular DPCD register. The DPCD register address (hex format) is written to '
i915_dpcd_addr' interface and the corresponding value can be read from 'i915_dpcd_val' interface.Example usage:
echo0x70>i915_dpcd_addr
cati915_dpcd_val0x1Quoted 8 lines
Quoted 1 line
v2: Address Jani's comments.
So, code-wise this looks good to me.
But like I said in my review of v1, I am undecided on whether we want to have this interface or not. I could really be persuaded either way.
Perhaps Ville or Paulo have an opinion?
I think having the ability to read (and also write actually) DPCD would be nice.
Quoted 7 lines
So I like the idea, but it does seem a bit limited since it doesn't allow writes. So perhaps we should just expose the entire DPCD as a binary file and include a tool in i-g-t to read/write individual pieces?
We could also have a tool to parse the entire thing like we have for the vbt stuff.
Yes, This seems to be a good idea. I will start working on this. Although I am not sure on the 'write' part.. I guess we can discuss as we go along..
But I still think, a pointed read/write would also be useful at times for debug. So, If you agree, I can extend this interface to take values for write as well and submit a v3.
Thanks,
Durga
Quoted 144 lines
Quoted 133 lines
BR,
Jani.Quoted 127 lines
Signed-off-by Durgadoss R <[email protected]>--- drivers/gpu/drm/i915/i915_debugfs.c | 88 ++++++++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_drv.h | 1 + 2 files changed, 88 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/i915_debugfs.c +87
-1@@ -4865,6 +4865,87 @@ static const struct file_operations i915_dpcd_fops = { .release = single_release, }; +static ssize_t i915_dpcd_addr_write (struct file *file,const char __user *ubuf, +size_t len,loff_t *offp) +{ +struct seq_file *m = file->private_data; +struct drm_connector *connector = m->private; +struct intel_dp *intel_dp = +enc_to_intel_dp (&intel_attached_encoder (connector)->base); +unsigned int reg_addr; +char tmp[16 ]; + +if (len >=sizeof (tmp)) +return -EINVAL ; + +if (copy_from_user (tmp, ubuf, len)) +return -EFAULT ; + + tmp[len] ='\0' ; + +if (kstrtouint (tmp,16 , ®_addr)) +return -EINVAL ; + + intel_dp->debugfs_dpcd_addr = reg_addr; + +return len; +} + +static int i915_dpcd_addr_show (struct seq_file *m,void *data) +{ +struct drm_connector *connector = m->private; +struct intel_dp *intel_dp = +enc_to_intel_dp (&intel_attached_encoder (connector)->base); + +seq_printf (m,"0x%x\n" , intel_dp->debugfs_dpcd_addr); + +return 0 ; +} + +static int i915_dpcd_addr_open (struct inode *inode,struct file *file) +{ +return single_open (file, i915_dpcd_addr_show, inode->i_private); +} + +static const struct file_operations i915_dpcd_addr_fops = { + .owner =THIS_MODULE , + .open = i915_dpcd_addr_open, + .read = seq_read, + .write = i915_dpcd_addr_write, + .llseek = seq_lseek, + .release = single_release, +}; + +static int i915_dpcd_val_show (struct seq_file *m,void *data) +{ +struct drm_connector *connector = m->private; +struct intel_dp *intel_dp = +enc_to_intel_dp (&intel_attached_encoder (connector)->base); +u8 val; +int ret; + + ret =drm_dp_dpcd_readb (&intel_dp->aux, + intel_dp->debugfs_dpcd_addr, &val); +if (ret <0 ) +return ret; + +seq_printf (m,"0x%x\n" , val); +return 0 ; +} + +static int i915_dpcd_val_open (struct inode *inode,struct file *file) +{ +return single_open (file, i915_dpcd_val_show, inode->i_private); +} + +static const struct file_operations i915_dpcd_val_fops = { + .owner =THIS_MODULE , + .open = i915_dpcd_val_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; +/** * i915_debugfs_connector_add - add i915 specific connector debugfs files * @connector: pointer to a registered drm_connector @@ -4883,9 +4964,14 @@ int i915_debugfs_connector_add(struct drm_connector *connector)return -ENODEV ;if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort || - connector->connector_type == DRM_MODE_CONNECTOR_eDP) + connector->connector_type == DRM_MODE_CONNECTOR_eDP) {debugfs_create_file ("i915_dpcd" ,S_IRUGO , root, connector, &i915_dpcd_fops); +debugfs_create_file ("i915_dpcd_addr" ,S_IRUGO |S_IWUSR , + root, connector, &i915_dpcd_addr_fops); +debugfs_create_file ("i915_dpcd_val" ,S_IRUGO , root, + connector, &i915_dpcd_val_fops); + }return 0 ; }drivers/gpu/drm/i915/intel_drv.h +1
-0@@ -642,6 +642,7 @@ struct intel_dp {unsigned long last_power_cycle;unsigned long last_power_on;unsigned long last_backlight_off; +unsigned int debugfs_dpcd_addr;struct notifier_block edp_notifier;Quoted 10 lines
Quoted 3 lines
--
1.9.1--
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 3 lines
--
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 40 lines · Durgadoss
Quoted 32 lines
-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Thursday, April 16, 2015 8:03 PM
To: Jani Nikula
Cc: R, Durgadoss; [email protected]; Syrjala, Ville; Zanoni, Paulo R
Subject: Re: [Intel-gfx] [PATCH v2] drm/i915: Add debugfs to read any DPCD registerQuoted 12 lines · Jani Nikula
Quoted 11 lines · Durgadoss R
This patch creates a connector specific debugfs interface to read any particular DPCD register. The DPCD register address (hex format) is written to '
i915_dpcd_addr' interface and the corresponding value can be read from 'i915_dpcd_val' interface.Example usage:
echo0x70>i915_dpcd_addr
cati915_dpcd_val0x1Quoted 8 lines
Quoted 1 line
v2: Address Jani's comments.
So, code-wise this looks good to me.
But like I said in my review of v1, I am undecided on whether we want to have this interface or not. I could really be persuaded either way.
Perhaps Ville or Paulo have an opinion?
I think having the ability to read (and also write actually) DPCD would be nice.
Quoted 7 lines
So I like the idea, but it does seem a bit limited since it doesn't allow writes. So perhaps we should just expose the entire DPCD as a binary file and include a tool in i-g-t to read/write individual pieces?
We could also have a tool to parse the entire thing like we have for the vbt stuff.
Quoted 7 lines
Yes, This seems to be a good idea. I will start working on this. Although I am not sure on the 'write' part.. I guess we can discuss as we go along..
But I still think, a pointed read/write would also be useful at times for debug. So, If you agree, I can extend this interface to take values for write as well and submit a v3.
For me at least i-g-t is always around so if a small tool is needed to make the read/write a single register case easy, I'm fine with that. We anyway need tools to read/write everything else, so I don't see a big difference here. But if other people would prefer something that doesn't need a specific tool I won't object to it either.
Quoted 151 lines
Thanks,
DurgaQuoted 147 lines
Quoted 133 lines
BR,
Jani.Quoted 127 lines
Signed-off-by Durgadoss R <[email protected]>--- drivers/gpu/drm/i915/i915_debugfs.c | 88 ++++++++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_drv.h | 1 + 2 files changed, 88 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/i915_debugfs.c +87
-1@@ -4865,6 +4865,87 @@ static const struct file_operations i915_dpcd_fops = { .release = single_release, }; +static ssize_t i915_dpcd_addr_write (struct file *file,const char __user *ubuf, +size_t len,loff_t *offp) +{ +struct seq_file *m = file->private_data; +struct drm_connector *connector = m->private; +struct intel_dp *intel_dp = +enc_to_intel_dp (&intel_attached_encoder (connector)->base); +unsigned int reg_addr; +char tmp[16 ]; + +if (len >=sizeof (tmp)) +return -EINVAL ; + +if (copy_from_user (tmp, ubuf, len)) +return -EFAULT ; + + tmp[len] ='\0' ; + +if (kstrtouint (tmp,16 , ®_addr)) +return -EINVAL ; + + intel_dp->debugfs_dpcd_addr = reg_addr; + +return len; +} + +static int i915_dpcd_addr_show (struct seq_file *m,void *data) +{ +struct drm_connector *connector = m->private; +struct intel_dp *intel_dp = +enc_to_intel_dp (&intel_attached_encoder (connector)->base); + +seq_printf (m,"0x%x\n" , intel_dp->debugfs_dpcd_addr); + +return 0 ; +} + +static int i915_dpcd_addr_open (struct inode *inode,struct file *file) +{ +return single_open (file, i915_dpcd_addr_show, inode->i_private); +} + +static const struct file_operations i915_dpcd_addr_fops = { + .owner =THIS_MODULE , + .open = i915_dpcd_addr_open, + .read = seq_read, + .write = i915_dpcd_addr_write, + .llseek = seq_lseek, + .release = single_release, +}; + +static int i915_dpcd_val_show (struct seq_file *m,void *data) +{ +struct drm_connector *connector = m->private; +struct intel_dp *intel_dp = +enc_to_intel_dp (&intel_attached_encoder (connector)->base); +u8 val; +int ret; + + ret =drm_dp_dpcd_readb (&intel_dp->aux, + intel_dp->debugfs_dpcd_addr, &val); +if (ret <0 ) +return ret; + +seq_printf (m,"0x%x\n" , val); +return 0 ; +} + +static int i915_dpcd_val_open (struct inode *inode,struct file *file) +{ +return single_open (file, i915_dpcd_val_show, inode->i_private); +} + +static const struct file_operations i915_dpcd_val_fops = { + .owner =THIS_MODULE , + .open = i915_dpcd_val_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; +/** * i915_debugfs_connector_add - add i915 specific connector debugfs files * @connector: pointer to a registered drm_connector @@ -4883,9 +4964,14 @@ int i915_debugfs_connector_add(struct drm_connector *connector)return -ENODEV ;if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort || - connector->connector_type == DRM_MODE_CONNECTOR_eDP) + connector->connector_type == DRM_MODE_CONNECTOR_eDP) {debugfs_create_file ("i915_dpcd" ,S_IRUGO , root, connector, &i915_dpcd_fops); +debugfs_create_file ("i915_dpcd_addr" ,S_IRUGO |S_IWUSR , + root, connector, &i915_dpcd_addr_fops); +debugfs_create_file ("i915_dpcd_val" ,S_IRUGO , root, + connector, &i915_dpcd_val_fops); + }return 0 ; }drivers/gpu/drm/i915/intel_drv.h +1
-0@@ -642,6 +642,7 @@ struct intel_dp {unsigned long last_power_cycle;unsigned long last_power_on;unsigned long last_backlight_off; +unsigned int debugfs_dpcd_addr;struct notifier_block edp_notifier;Quoted 10 lines
Quoted 3 lines
--
1.9.1--
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx--
Ville Syrjälä
Intel OTC
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 7 lines
-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Friday, April 17, 2015 3:30 PM
To: R, Durgadoss
Cc: Jani Nikula; [email protected]; Syrjala, Ville; Zanoni, Paulo R
Subject: Re: [Intel-gfx] [PATCH v2] drm/i915: Add debugfs to read any DPCD register
Quoted 37 lines
Quoted 36 lines · Durgadoss
Quoted 36 lines
-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Thursday, April 16, 2015 8:03 PM
To: Jani Nikula
Cc: R, Durgadoss; [email protected]; Syrjala, Ville; Zanoni, Paulo R
Subject: Re: [Intel-gfx] [PATCH v2] drm/i915: Add debugfs to read any DPCD registerQuoted 12 lines · Jani Nikula
Quoted 11 lines · Durgadoss R
This patch creates a connector specific debugfs interface to read any particular DPCD register. The DPCD register address (hex format) is written to '
i915_dpcd_addr' interface and the corresponding value can be read from 'i915_dpcd_val' interface.Example usage:
echo0x70>i915_dpcd_addr
cati915_dpcd_val0x1Quoted 8 lines
Quoted 1 line
v2: Address Jani's comments.
So, code-wise this looks good to me.
But like I said in my review of v1, I am undecided on whether we want to have this interface or not. I could really be persuaded either way.
Perhaps Ville or Paulo have an opinion?
I think having the ability to read (and also write actually) DPCD would be nice.
So I like the idea, but it does seem a bit limited since it doesn't allow writes. So perhaps we should just expose the entire DPCD as a binary file and include a tool in i-g-t to read/write individual pieces?
Ok, I started with this, but realized that it becomes almost equivalent of the 'i915_dpcd' interface introduced by Jani. So, it looks like, extending that interface by adding more relevant offsets seems to be a better option,
than creating one more interface for dumping.
Thanks,
Durga
Quoted 166 lines
Quoted 11 lines
Quoted 3 lines
We could also have a tool to parse the entire thing like we have for the vbt stuff.
Yes, This seems to be a good idea. I will start working on this. Although I am not sure on the 'write' part.. I guess we can discuss as we go along..
But I still think, a pointed read/write would also be useful at times for debug. So, If you agree, I can extend this interface to take values for write as well and submit a v3.
For me at least i-g-t is always around so if a small tool is needed to make the read/write a single register case easy, I'm fine with that. We anyway need tools to read/write everything else, so I don't see a big difference here. But if other people would prefer something that doesn't need a specific tool I won't object to it either.
Quoted 148 lines
Thanks,
DurgaQuoted 144 lines
Quoted 143 lines
BR,
Jani.Quoted 128 lines
Signed-off-by Durgadoss R <[email protected]>--- drivers/gpu/drm/i915/i915_debugfs.c | 88 ++++++++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_drv.h | 1 + 2 files changed, 88 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/i915_debugfs.c +87
-1@@ -4865,6 +4865,87 @@ static const struct file_operations i915_dpcd_fops = { .release = single_release, }; +static ssize_t i915_dpcd_addr_write (struct file *file,const char __user *ubuf, +size_t len,loff_t *offp) +{ +struct seq_file *m = file->private_data; +struct drm_connector *connector = m->private; +struct intel_dp *intel_dp = +enc_to_intel_dp (&intel_attached_encoder (connector)->base); +unsigned int reg_addr; +char tmp[16 ]; + +if (len >=sizeof (tmp)) +return -EINVAL ; + +if (copy_from_user (tmp, ubuf, len)) +return -EFAULT ; + + tmp[len] ='\0' ; + +if (kstrtouint (tmp,16 , ®_addr)) +return -EINVAL ; + + intel_dp->debugfs_dpcd_addr = reg_addr; + +return len; +} + +static int i915_dpcd_addr_show (struct seq_file *m,void *data) +{ +struct drm_connector *connector = m->private; +struct intel_dp *intel_dp = +enc_to_intel_dp (&intel_attached_encoder (connector)->base); + +seq_printf (m,"0x%x\n" , intel_dp->debugfs_dpcd_addr); + +return 0 ; +} + +static int i915_dpcd_addr_open (struct inode *inode,struct file *file) +{ +return single_open (file, i915_dpcd_addr_show, inode->i_private); +} + +static const struct file_operations i915_dpcd_addr_fops = { + .owner =THIS_MODULE , + .open = i915_dpcd_addr_open, + .read = seq_read, + .write = i915_dpcd_addr_write, + .llseek = seq_lseek, + .release = single_release, +}; + +static int i915_dpcd_val_show (struct seq_file *m,void *data) +{ +struct drm_connector *connector = m->private; +struct intel_dp *intel_dp = +enc_to_intel_dp (&intel_attached_encoder (connector)->base); +u8 val; +int ret; + + ret =drm_dp_dpcd_readb (&intel_dp->aux, + intel_dp->debugfs_dpcd_addr, &val); +if (ret <0 ) +return ret; + +seq_printf (m,"0x%x\n" , val); +return 0 ; +} + +static int i915_dpcd_val_open (struct inode *inode,struct file *file) +{ +return single_open (file, i915_dpcd_val_show, inode->i_private); +} + +static const struct file_operations i915_dpcd_val_fops = { + .owner =THIS_MODULE , + .open = i915_dpcd_val_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; +/** * i915_debugfs_connector_add - add i915 specific connector debugfs files * @connector: pointer to a registered drm_connector @@ -4883,9 +4964,14 @@ int i915_debugfs_connector_add(struct drm_connector *connector)return -ENODEV ;if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort || - connector->connector_type == DRM_MODE_CONNECTOR_eDP) + connector->connector_type == DRM_MODE_CONNECTOR_eDP) {debugfs_create_file ("i915_dpcd" ,S_IRUGO , root, connector, &i915_dpcd_fops); +debugfs_create_file ("i915_dpcd_addr" ,S_IRUGO |S_IWUSR , + root, connector, &i915_dpcd_addr_fops); +debugfs_create_file ("i915_dpcd_val" ,S_IRUGO , root, + connector, &i915_dpcd_val_fops); + }return 0 ; }drivers/gpu/drm/i915/intel_drv.h +1
-1@@ -642,6 +642,7 @@ struct intel_dp {unsigned long last_power_cycle;unsigned long last_power_on;unsigned long last_backlight_off; +unsigned int debugfs_dpcd_addr;struct notifier_block edp_notifier; --Quoted 2 lines
1.9.1
--
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
--
Ville Syrjälä
Intel OTC--
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 49 lines · Ville Syrjälä
Quoted 40 lines · Durgadoss
Quoted 32 lines
-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Thursday, April 16, 2015 8:03 PM
To: Jani Nikula
Cc: R, Durgadoss; [email protected]; Syrjala, Ville; Zanoni, Paulo R
Subject: Re: [Intel-gfx] [PATCH v2] drm/i915: Add debugfs to read any DPCD registerQuoted 12 lines · Jani Nikula
Quoted 11 lines · Durgadoss R
This patch creates a connector specific debugfs interface to read any particular DPCD register. The DPCD register address (hex format) is written to '
i915_dpcd_addr' interface and the corresponding value can be read from 'i915_dpcd_val' interface.Example usage:
echo0x70>i915_dpcd_addr
cati915_dpcd_val0x1Quoted 8 lines
Quoted 1 line
v2: Address Jani's comments.
So, code-wise this looks good to me.
But like I said in my review of v1, I am undecided on whether we want to have this interface or not. I could really be persuaded either way.
Perhaps Ville or Paulo have an opinion?
I think having the ability to read (and also write actually) DPCD would be nice.
Quoted 7 lines
So I like the idea, but it does seem a bit limited since it doesn't allow writes. So perhaps we should just expose the entire DPCD as a binary file and include a tool in i-g-t to read/write individual pieces?
We could also have a tool to parse the entire thing like we have for the vbt stuff.
Quoted 7 lines
Yes, This seems to be a good idea. I will start working on this. Although I am not sure on the 'write' part.. I guess we can discuss as we go along..
But I still think, a pointed read/write would also be useful at times for debug. So, If you agree, I can extend this interface to take values for write as well and submit a v3.
Quoted 5 lines
For me at least i-g-t is always around so if a small tool is needed to make the read/write a single register case easy, I'm fine with that. We anyway need tools to read/write everything else, so I don't see a big difference here. But if other people would prefer something that doesn't need a specific tool I won't object to it either.
Imo adding a /dev node or debugfs files with ioctl to do generic dp aux transactions and then add userspace tooling on top (similar to i2c) would be the right approach. Adding all the possible dp aux registers (especially once we look at mst) seems to be an unending task. -Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx