From patchwork Fri Feb 15 12:56:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 14912 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 5029B23E01 for ; Fri, 15 Feb 2013 12:58:19 +0000 (UTC) Received: from mail-ve0-f173.google.com (mail-ve0-f173.google.com [209.85.128.173]) by fiordland.canonical.com (Postfix) with ESMTP id 1E36BA1844A for ; Fri, 15 Feb 2013 12:58:19 +0000 (UTC) Received: by mail-ve0-f173.google.com with SMTP id oz10so2977801veb.4 for ; Fri, 15 Feb 2013 04:58:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=kFUU4Iu3oMVdPgldhd9fjydOBgCxbvblg7Xzp/6K1vw=; b=E5+4QQWhWw405vxEchMPtUEMXzFTBqm0VBO5G7mygyFfVw+xIpT0ugh9b5bwgtE5wk 87XZb+GZ+8wgsVitua1wQCmJCRSIH4kgfuhNi+ubn7NMW9jiWWUGL9z8rDZjGNX0Wqkw hsWCj56oNLwWcbrncYFsrpKkQkaPRPjOP5P4/b1ZtkiZdIX9yyfhPljiCCLSyf18W1Iy AtzViqASzCC4beWJQEPEdTwHuB9psJmKMdTqiJoPvhE6Oh3y7I8HmfcYSFi4iE7v2w5G eMF7LXK1gE4hsFyEB+rc5CSY76z+8QUbJTAwUrWDsoxfbOWplYVvX62Ubriqe6JkBg6Q cQTA== X-Received: by 10.52.175.66 with SMTP id by2mr2669208vdc.53.1360933098546; Fri, 15 Feb 2013 04:58:18 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.221.4.5 with SMTP id oa5csp11427vcb; Fri, 15 Feb 2013 04:58:18 -0800 (PST) X-Received: by 10.194.156.196 with SMTP id wg4mr4065040wjb.22.1360933096890; Fri, 15 Feb 2013 04:58:16 -0800 (PST) Received: from mail-wg0-f53.google.com (mail-wg0-f53.google.com [74.125.82.53]) by mx.google.com with ESMTPS id dr6si1042783wib.101.2013.02.15.04.58.16 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 15 Feb 2013 04:58:16 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.53 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=74.125.82.53; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.53 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) smtp.mail=lee.jones@linaro.org Received: by mail-wg0-f53.google.com with SMTP id fn15so2793509wgb.20 for ; Fri, 15 Feb 2013 04:58:16 -0800 (PST) X-Received: by 10.180.97.233 with SMTP id ed9mr5658285wib.32.1360933096489; Fri, 15 Feb 2013 04:58:16 -0800 (PST) Received: from localhost.localdomain (cpc34-aztw25-2-0-cust250.18-1.cable.virginmedia.com. [86.16.136.251]) by mx.google.com with ESMTPS id j4sm2852410wiz.10.2013.02.15.04.58.14 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 15 Feb 2013 04:58:15 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, sameo@linux.intel.com Cc: arnd@arndb.de, linus.walleij@stericsson.com, Yang QU , Lee Jones Subject: [PATCH 28/35] mfd: ab8500-debug: Add ADC input channel usb_id in debugfs Date: Fri, 15 Feb 2013 12:56:59 +0000 Message-Id: <1360933026-30325-29-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1360933026-30325-1-git-send-email-lee.jones@linaro.org> References: <1360933026-30325-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQn83WDHNw9i4b2wTe0/q/cSqoiSLw+5rcGlX2TeUK6mX5FJ4/N6yknIRHf8GhoWsnF4USWv From: Yang QU Signed-off-by: Yang QU Signed-off-by: Lee Jones Reviewed-by: Alexandre BOURDIOL Reviewed-by: Philippe LANGLAIS Reviewed-by: Mattias WALLIN --- drivers/mfd/ab8500-debugfs.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/drivers/mfd/ab8500-debugfs.c b/drivers/mfd/ab8500-debugfs.c index a301f10..ae8660a 100644 --- a/drivers/mfd/ab8500-debugfs.c +++ b/drivers/mfd/ab8500-debugfs.c @@ -1705,6 +1705,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; @@ -2711,6 +2740,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);