blob: 698d0d59db761b3cae1d75d5b88a67603dc2c187 [file] [log] [blame]
Donggeun Kimf22aaaa2011-06-20 16:48:19 +09001/*
2 * ntc_thermistor.h - NTC Thermistors
3 *
4 * Copyright (C) 2010 Samsung Electronics
5 * MyungJoo Ham <myungjoo.ham@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21#ifndef _LINUX_NTC_H
22#define _LINUX_NTC_H
23
Naveen Krishna Chatradhi9e8269d2013-03-13 09:38:20 +053024struct iio_channel;
25
Donggeun Kimf22aaaa2011-06-20 16:48:19 +090026enum ntc_thermistor_type {
27 TYPE_NCPXXWB473,
28 TYPE_NCPXXWL333,
Johannes Pointnered67f082014-07-01 08:05:52 +020029 TYPE_B57330V2103,
Beomho Seo887ee432015-04-30 13:07:43 +090030 TYPE_NCPXXWF104,
Joseph McNally54ce3a02016-02-28 22:31:23 +000031 TYPE_NCPXXXH103,
Donggeun Kimf22aaaa2011-06-20 16:48:19 +090032};
33
34struct ntc_thermistor_platform_data {
35 /*
36 * One (not both) of read_uV and read_ohm should be provided and only
37 * one of the two should be provided.
38 * Both functions should return negative value for an error case.
39 *
40 * pullup_uV, pullup_ohm, pulldown_ohm, and connect are required to use
41 * read_uV()
42 *
43 * How to setup pullup_ohm, pulldown_ohm, and connect is
Paul Bolle395cf962011-08-15 02:02:26 +020044 * described at Documentation/hwmon/ntc_thermistor
Donggeun Kimf22aaaa2011-06-20 16:48:19 +090045 *
46 * pullup/down_ohm: 0 for infinite / not-connected
Naveen Krishna Chatradhi9e8269d2013-03-13 09:38:20 +053047 *
48 * chan: iio_channel pointer to communicate with the ADC which the
49 * thermistor is using for conversion of the analog values.
Donggeun Kimf22aaaa2011-06-20 16:48:19 +090050 */
Guenter Roeck088ce2a2013-03-13 16:40:39 -070051 int (*read_uv)(struct ntc_thermistor_platform_data *);
52 unsigned int pullup_uv;
Donggeun Kimf22aaaa2011-06-20 16:48:19 +090053
54 unsigned int pullup_ohm;
55 unsigned int pulldown_ohm;
56 enum { NTC_CONNECTED_POSITIVE, NTC_CONNECTED_GROUND } connect;
Naveen Krishna Chatradhi9e8269d2013-03-13 09:38:20 +053057 struct iio_channel *chan;
Donggeun Kimf22aaaa2011-06-20 16:48:19 +090058
59 int (*read_ohm)(void);
60};
61
62#endif /* _LINUX_NTC_H */