aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/tegra/sor.c45
1 files changed, 8 insertions, 37 deletions
diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
index d69575d2cdc7..9bc2cb701c04 100644
--- a/drivers/gpu/drm/tegra/sor.c
+++ b/drivers/gpu/drm/tegra/sor.c
@@ -595,18 +595,6 @@ static int tegra_sor_power_down(struct tegra_sor *sor)
595 return 0; 595 return 0;
596} 596}
597 597
598static int tegra_sor_crc_open(struct inode *inode, struct file *file)
599{
600 file->private_data = inode->i_private;
601
602 return 0;
603}
604
605static int tegra_sor_crc_release(struct inode *inode, struct file *file)
606{
607 return 0;
608}
609
610static int tegra_sor_crc_wait(struct tegra_sor *sor, unsigned long timeout) 598static int tegra_sor_crc_wait(struct tegra_sor *sor, unsigned long timeout)
611{ 599{
612 u32 value; 600 u32 value;
@@ -624,12 +612,11 @@ static int tegra_sor_crc_wait(struct tegra_sor *sor, unsigned long timeout)
624 return -ETIMEDOUT; 612 return -ETIMEDOUT;
625} 613}
626 614
627static ssize_t tegra_sor_crc_read(struct file *file, char __user *buffer, 615static int tegra_sor_show_crc(struct seq_file *s, void *data)
628 size_t size, loff_t *ppos)
629{ 616{
630 struct tegra_sor *sor = file->private_data; 617 struct drm_info_node *node = s->private;
631 ssize_t num, err; 618 struct tegra_sor *sor = node->info_ent->data;
632 char buf[10]; 619 int err = 0;
633 u32 value; 620 u32 value;
634 621
635 mutex_lock(&sor->lock); 622 mutex_lock(&sor->lock);
@@ -658,22 +645,13 @@ static ssize_t tegra_sor_crc_read(struct file *file, char __user *buffer,
658 tegra_sor_writel(sor, SOR_CRCA_RESET, SOR_CRCA); 645 tegra_sor_writel(sor, SOR_CRCA_RESET, SOR_CRCA);
659 value = tegra_sor_readl(sor, SOR_CRCB); 646 value = tegra_sor_readl(sor, SOR_CRCB);
660 647
661 num = scnprintf(buf, sizeof(buf), "%08x\n", value); 648 seq_printf(s, "%08x\n", value);
662
663 err = simple_read_from_buffer(buffer, size, ppos, buf, num);
664 649
665unlock: 650unlock:
666 mutex_unlock(&sor->lock); 651 mutex_unlock(&sor->lock);
667 return err; 652 return err;
668} 653}
669 654
670static const struct file_operations tegra_sor_crc_fops = {
671 .owner = THIS_MODULE,
672 .open = tegra_sor_crc_open,
673 .read = tegra_sor_crc_read,
674 .release = tegra_sor_crc_release,
675};
676
677static int tegra_sor_show_regs(struct seq_file *s, void *data) 655static int tegra_sor_show_regs(struct seq_file *s, void *data)
678{ 656{
679 struct drm_info_node *node = s->private; 657 struct drm_info_node *node = s->private;
@@ -804,15 +782,15 @@ static int tegra_sor_show_regs(struct seq_file *s, void *data)
804} 782}
805 783
806static const struct drm_info_list debugfs_files[] = { 784static const struct drm_info_list debugfs_files[] = {
785 { "crc", tegra_sor_show_crc, 0, NULL },
807 { "regs", tegra_sor_show_regs, 0, NULL }, 786 { "regs", tegra_sor_show_regs, 0, NULL },
808}; 787};
809 788
810static int tegra_sor_debugfs_init(struct tegra_sor *sor, 789static int tegra_sor_debugfs_init(struct tegra_sor *sor,
811 struct drm_minor *minor) 790 struct drm_minor *minor)
812{ 791{
813 struct dentry *entry;
814 unsigned int i; 792 unsigned int i;
815 int err = 0; 793 int err;
816 794
817 sor->debugfs = debugfs_create_dir("sor", minor->debugfs_root); 795 sor->debugfs = debugfs_create_dir("sor", minor->debugfs_root);
818 if (!sor->debugfs) 796 if (!sor->debugfs)
@@ -834,16 +812,9 @@ static int tegra_sor_debugfs_init(struct tegra_sor *sor,
834 if (err < 0) 812 if (err < 0)
835 goto free; 813 goto free;
836 814
837 entry = debugfs_create_file("crc", 0644, sor->debugfs, sor,
838 &tegra_sor_crc_fops);
839 if (!entry) {
840 err = -ENOMEM;
841 goto free;
842 }
843
844 sor->minor = minor; 815 sor->minor = minor;
845 816
846 return err; 817 return 0;
847 818
848free: 819free:
849 kfree(sor->debugfs_files); 820 kfree(sor->debugfs_files);