Skip to content

Commit

Permalink
mfd: ab8500-debug: Add ADC input channel usb_id in debugfs
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Lee Jones committed Mar 7, 2013
1 parent c7ebaee commit 127629d
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions drivers/mfd/ab8500-debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 127629d

Please sign in to comment.