From f89e6afbd247b895c55bf165a5235ad166983c07 Mon Sep 17 00:00:00 2001 From: Lee Jones Date: Tue, 26 Feb 2013 14:04:37 +0000 Subject: [PATCH] --- yaml --- r: 367444 b: refs/heads/master c: 127629d74efff202372fbd6097e607fcb2c8a7af h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/mfd/ab8500-debugfs.c | 35 ++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index ac882a58ed37..2bc33305d5ad 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: c7ebaee292fb0f935752d50ef9bad1db74efde6e +refs/heads/master: 127629d74efff202372fbd6097e607fcb2c8a7af diff --git a/trunk/drivers/mfd/ab8500-debugfs.c b/trunk/drivers/mfd/ab8500-debugfs.c index a653a0747b31..44c9bc1f2544 100644 --- a/trunk/drivers/mfd/ab8500-debugfs.c +++ b/trunk/drivers/mfd/ab8500-debugfs.c @@ -1706,6 +1706,35 @@ static const struct file_operations ab8500_gpadc_die_temp_fops = { .owner = THIS_MODULE, }; +static int ab8500_gpadc_usb_id_print(struct seq_file *s, void *p) +{ + int usb_id_raw; + int usb_id_convert; + struct ab8500_gpadc *gpadc; + + gpadc = ab8500_gpadc_get("ab8500-gpadc.0"); + usb_id_raw = ab8500_gpadc_read_raw(gpadc, USB_ID, + avg_sample, trig_edge, trig_timer, conv_type); + usb_id_convert = ab8500_gpadc_ad_to_voltage(gpadc, USB_ID, + usb_id_raw); + + return seq_printf(s, "%d,0x%X\n", + usb_id_convert, usb_id_raw); +} + +static int ab8500_gpadc_usb_id_open(struct inode *inode, struct file *file) +{ + return single_open(file, ab8500_gpadc_usb_id_print, inode->i_private); +} + +static const struct file_operations ab8500_gpadc_usb_id_fops = { + .open = ab8500_gpadc_usb_id_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, + .owner = THIS_MODULE, +}; + static int ab8540_gpadc_xtal_temp_print(struct seq_file *s, void *p) { int xtal_temp_raw; @@ -2712,6 +2741,12 @@ static int ab8500_debug_probe(struct platform_device *plf) ab8500_gpadc_dir, &plf->dev, &ab8500_gpadc_die_temp_fops); if (!file) goto err; + + file = debugfs_create_file("usb_id", (S_IRUGO | S_IWUGO), + ab8500_gpadc_dir, &plf->dev, &ab8500_gpadc_usb_id_fops); + if (!file) + goto err; + if (is_ab8540(ab8500)) { file = debugfs_create_file("xtal_temp", (S_IRUGO | S_IWUGO), ab8500_gpadc_dir, &plf->dev, &ab8540_gpadc_xtal_temp_fops);