From patchwork Tue Jun 21 02:07:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: MyungJoo Ham X-Patchwork-Id: 899592 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p5L27ZFh031450 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 21 Jun 2011 02:07:56 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QYqNC-0004Rg-Lp; Tue, 21 Jun 2011 02:07:26 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QYqNC-0005RF-9X; Tue, 21 Jun 2011 02:07:26 +0000 Received: from mailout3.samsung.com ([203.254.224.33]) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QYqN3-0005QT-Sr for linux-arm-kernel@lists.infradead.org; Tue, 21 Jun 2011 02:07:23 +0000 Received: from epcpsbgm2.samsung.com (mailout3.samsung.com [203.254.224.33]) by mailout3.samsung.com (Oracle Communications Messaging Exchange Server 7u4-19.01 64bit (built Sep 7 2010)) with ESMTP id <0LN4001CPB83QOB0@mailout3.samsung.com> for linux-arm-kernel@lists.infradead.org; Tue, 21 Jun 2011 11:07:15 +0900 (KST) X-AuditID: cbfee61b-b7b2dae000007af9-80-4dfffcd3c36d Received: from epmmp1 ( [203.254.227.16]) by epcpsbgm2.samsung.com (MMPCPMTA) with SMTP id 54.7B.31481.3DCFFFD4; Tue, 21 Jun 2011 11:07:15 +0900 (KST) Received: from TNRNDGASPAPP1.tn.corp.samsungelectronics.net ([165.213.149.150]) by mmp1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0LN400KJDB838Q@mmp1.samsung.com> for linux-arm-kernel@lists.infradead.org; Tue, 21 Jun 2011 11:07:15 +0900 (KST) Received: from localhost.localdomain ([165.213.219.116]) by TNRNDGASPAPP1.tn.corp.samsungelectronics.net with Microsoft SMTPSVC(6.0.3790.4675); Tue, 21 Jun 2011 11:06:38 +0900 Date: Tue, 21 Jun 2011 11:07:13 +0900 From: MyungJoo Ham Subject: [PATCH v2 4/4] Exynos4 NURI: support for NTC thermistor In-reply-to: <1308622033-2521-1-git-send-email-myungjoo.ham@samsung.com> To: linux-kernel@vger.kernel.org Message-id: <1308622033-2521-5-git-send-email-myungjoo.ham@samsung.com> X-Mailer: git-send-email 1.7.4.1 References: <20110620103124.GD31864@opensource.wolfsonmicro.com> <1308622033-2521-1-git-send-email-myungjoo.ham@samsung.com> X-OriginalArrivalTime: 21 Jun 2011 02:06:38.0443 (UTC) FILETIME=[DADE63B0:01CC2FB7] X-Brightmail-Tracker: AAAAAA== X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110620_220718_247768_593A008E X-CRM114-Status: GOOD ( 17.52 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [203.254.224.33 listed in list.dnswl.org] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain 0.0 RFC_ABUSE_POST Both abuse and postmaster missing on sender domain Cc: Kukjin Kim , Russell King , Mark Brown , dg77.kim@samsung.com, myungjoo.ham@gmail.com, Kyungmin Park , linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Tue, 21 Jun 2011 02:07:56 +0000 (UTC) Signed-off-by: MyungJoo Ham --- arch/arm/mach-exynos4/mach-nuri.c | 46 +++++++++++++++++++++++++++++++++++++ 1 files changed, 46 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-exynos4/mach-nuri.c b/arch/arm/mach-exynos4/mach-nuri.c index 51f55b4..dc6fc36 100644 --- a/arch/arm/mach-exynos4/mach-nuri.c +++ b/arch/arm/mach-exynos4/mach-nuri.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -1006,6 +1007,50 @@ static void __init nuri_ehci_init(void) s5p_ehci_set_platdata(pdata); } +/* NTC Thermistor */ +static struct platform_device nuri_ncp15wb473_thermistor; +static int read_thermistor_uV(void) +{ + static struct s3c_adc_client *adc; + int val; + s64 converted; + + if (!adc) { + adc = s3c_adc_register(&nuri_ncp15wb473_thermistor, + NULL, NULL, 0); + if (IS_ERR_OR_NULL(adc)) { + pr_err("%s: Cannot get adc.\n", __func__); + return adc ? PTR_ERR(adc) : -ENODEV; + } + } + + if (IS_ERR_OR_NULL(adc)) + return adc ? PTR_ERR(adc) : -ENODEV; + + val = s3c_adc_read(adc, 6); + + converted = 3300000LL * (s64) val; + converted >>= 12; + + pr_emerg("%s: %d -> %llduV\n", __func__, val, converted); + return converted; +} + +static struct ntc_thermistor_platform_data ncp15wb473_pdata = { + .read_uV = read_thermistor_uV, + .pullup_uV = 3300000, /* VADC_3.3V_C210 */ + .pullup_ohm = 100000, /* R613 in SLP 7 0105 */ + .pulldown_ohm = 100000, /* R615 in SLP 7 0105 */ + .connect = NTC_CONNECTED_GROUND, +}; + +static struct platform_device nuri_ncp15wb473_thermistor = { + .name = "ncp15wb473", + .dev = { + .platform_data = &ncp15wb473_pdata, + }, +}; + static struct platform_device *nuri_devices[] __initdata = { /* Samsung Platform Devices */ &emmc_fixed_voltage, @@ -1024,6 +1069,7 @@ static struct platform_device *nuri_devices[] __initdata = { &nuri_gpio_keys, &nuri_lcd_device, &nuri_backlight_device, + &nuri_ncp15wb473_thermistor, }; static void __init nuri_map_io(void)