diff options
author | Lee Jones <lee.jones@linaro.org> | 2013-02-26 09:04:37 -0500 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2013-03-06 23:28:55 -0500 |
commit | 127629d74efff202372fbd6097e607fcb2c8a7af (patch) | |
tree | 493778be7451322b81acdbe0d3d221450a1d7ed9 | |
parent | c7ebaee292fb0f935752d50ef9bad1db74efde6e (diff) |
mfd: ab8500-debug: Add ADC input channel usb_id in debugfs
Signed-off-by: Yang QU <yang.qu@stericsson.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Alexandre BOURDIOL <alexandre.bourdiol@stericsson.com>
Reviewed-by: Philippe LANGLAIS <philippe.langlais@stericsson.com>
Reviewed-by: Mattias WALLIN <mattias.wallin@stericsson.com>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r-- | drivers/mfd/ab8500-debugfs.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/drivers/mfd/ab8500-debugfs.c b/drivers/mfd/ab8500-debugfs.c index a653a0747b31..44c9bc1f2544 100644 --- a/drivers/mfd/ab8500-debugfs.c +++ b/drivers/mfd/ab8500-debugfs.c | |||
@@ -1706,6 +1706,35 @@ static const struct file_operations ab8500_gpadc_die_temp_fops = { | |||
1706 | .owner = THIS_MODULE, | 1706 | .owner = THIS_MODULE, |
1707 | }; | 1707 | }; |
1708 | 1708 | ||
1709 | static int ab8500_gpadc_usb_id_print(struct seq_file *s, void *p) | ||
1710 | { | ||
1711 | int usb_id_raw; | ||
1712 | int usb_id_convert; | ||
1713 | struct ab8500_gpadc *gpadc; | ||
1714 | |||
1715 | gpadc = ab8500_gpadc_get("ab8500-gpadc.0"); | ||
1716 | usb_id_raw = ab8500_gpadc_read_raw(gpadc, USB_ID, | ||
1717 | avg_sample, trig_edge, trig_timer, conv_type); | ||
1718 | usb_id_convert = ab8500_gpadc_ad_to_voltage(gpadc, USB_ID, | ||
1719 | usb_id_raw); | ||
1720 | |||
1721 | return seq_printf(s, "%d,0x%X\n", | ||
1722 | usb_id_convert, usb_id_raw); | ||
1723 | } | ||
1724 | |||
1725 | static int ab8500_gpadc_usb_id_open(struct inode *inode, struct file *file) | ||
1726 | { | ||
1727 | return single_open(file, ab8500_gpadc_usb_id_print, inode->i_private); | ||
1728 | } | ||
1729 | |||
1730 | static const struct file_operations ab8500_gpadc_usb_id_fops = { | ||
1731 | .open = ab8500_gpadc_usb_id_open, | ||
1732 | .read = seq_read, | ||
1733 | .llseek = seq_lseek, | ||
1734 | .release = single_release, | ||
1735 | .owner = THIS_MODULE, | ||
1736 | }; | ||
1737 | |||
1709 | static int ab8540_gpadc_xtal_temp_print(struct seq_file *s, void *p) | 1738 | static int ab8540_gpadc_xtal_temp_print(struct seq_file *s, void *p) |
1710 | { | 1739 | { |
1711 | int xtal_temp_raw; | 1740 | int xtal_temp_raw; |
@@ -2712,6 +2741,12 @@ static int ab8500_debug_probe(struct platform_device *plf) | |||
2712 | ab8500_gpadc_dir, &plf->dev, &ab8500_gpadc_die_temp_fops); | 2741 | ab8500_gpadc_dir, &plf->dev, &ab8500_gpadc_die_temp_fops); |
2713 | if (!file) | 2742 | if (!file) |
2714 | goto err; | 2743 | goto err; |
2744 | |||
2745 | file = debugfs_create_file("usb_id", (S_IRUGO | S_IWUGO), | ||
2746 | ab8500_gpadc_dir, &plf->dev, &ab8500_gpadc_usb_id_fops); | ||
2747 | if (!file) | ||
2748 | goto err; | ||
2749 | |||
2715 | if (is_ab8540(ab8500)) { | 2750 | if (is_ab8540(ab8500)) { |
2716 | file = debugfs_create_file("xtal_temp", (S_IRUGO | S_IWUGO), | 2751 | file = debugfs_create_file("xtal_temp", (S_IRUGO | S_IWUGO), |
2717 | ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_xtal_temp_fops); | 2752 | ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_xtal_temp_fops); |