diff options
-rw-r--r-- | Documentation/hwmon/mcp3021 | 23 | ||||
-rw-r--r-- | drivers/hwmon/Kconfig | 7 | ||||
-rw-r--r-- | drivers/hwmon/mcp3021.c | 21 |
3 files changed, 37 insertions, 14 deletions
diff --git a/Documentation/hwmon/mcp3021 b/Documentation/hwmon/mcp3021 index 325fd87e81b2..74a6b72adf5f 100644 --- a/Documentation/hwmon/mcp3021 +++ b/Documentation/hwmon/mcp3021 | |||
@@ -5,18 +5,25 @@ Supported chips: | |||
5 | * Microchip Technology MCP3021 | 5 | * Microchip Technology MCP3021 |
6 | Prefix: 'mcp3021' | 6 | Prefix: 'mcp3021' |
7 | Datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/21805a.pdf | 7 | Datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/21805a.pdf |
8 | * Microchip Technology MCP3221 | ||
9 | Prefix: 'mcp3221' | ||
10 | Datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/21732c.pdf | ||
8 | 11 | ||
9 | Author: Mingkai Hu | 12 | Authors: |
13 | Mingkai Hu | ||
14 | Sven Schuchmann <schuchmann@schleissheimer.de> | ||
10 | 15 | ||
11 | Description | 16 | Description |
12 | ----------- | 17 | ----------- |
13 | 18 | ||
14 | This driver implements support for the Microchip Technology MCP3021 chip. | 19 | This driver implements support for the Microchip Technology MCP3021 and |
20 | MCP3221 chip. | ||
15 | 21 | ||
16 | The Microchip Technology Inc. MCP3021 is a successive approximation A/D | 22 | The Microchip Technology Inc. MCP3021 is a successive approximation A/D |
17 | converter (ADC) with 10-bit resolution. | 23 | converter (ADC) with 10-bit resolution. The MCP3221 has 12-bit resolution. |
18 | This device provides one single-ended input with very low power consumption. | 24 | |
19 | Communication to the MCP3021 is performed using a 2-wire I2C compatible | 25 | These devices provide one single-ended input with very low power consumption. |
20 | interface. Standard (100 kHz) and Fast (400 kHz) I2C modes are available. | 26 | Communication to the MCP3021/MCP3221 is performed using a 2-wire I2C |
21 | The default I2C device address is 0x4d (contact the Microchip factory for | 27 | compatible interface. Standard (100 kHz) and Fast (400 kHz) I2C modes are |
22 | additional address options). | 28 | available. The default I2C device address is 0x4d (contact the Microchip |
29 | factory for additional address options). | ||
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 6bc49cfb9f7b..c74e73b2069a 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
@@ -855,11 +855,12 @@ config SENSORS_MAX6650 | |||
855 | will be called max6650. | 855 | will be called max6650. |
856 | 856 | ||
857 | config SENSORS_MCP3021 | 857 | config SENSORS_MCP3021 |
858 | tristate "Microchip MCP3021" | 858 | tristate "Microchip MCP3021 and compatibles" |
859 | depends on I2C | 859 | depends on I2C |
860 | help | 860 | help |
861 | If you say yes here you get support for the MCP3021 chip | 861 | If you say yes here you get support for MCP3021 and MCP3221. |
862 | that is a A/D converter (ADC) with 10-bit resolution. | 862 | The MCP3021 is a A/D converter (ADC) with 10-bit and the MCP3221 |
863 | with 12-bit resolution. | ||
863 | 864 | ||
864 | This driver can also be built as a module. If so, the module | 865 | This driver can also be built as a module. If so, the module |
865 | will be called mcp3021. | 866 | will be called mcp3021. |
diff --git a/drivers/hwmon/mcp3021.c b/drivers/hwmon/mcp3021.c index d700b9271174..eedb32292d6d 100644 --- a/drivers/hwmon/mcp3021.c +++ b/drivers/hwmon/mcp3021.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * mcp3021.c - driver for the Microchip MCP3021 chip | 2 | * mcp3021.c - driver for Microchip MCP3021 and MCP3221 |
3 | * | 3 | * |
4 | * Copyright (C) 2008-2009, 2012 Freescale Semiconductor, Inc. | 4 | * Copyright (C) 2008-2009, 2012 Freescale Semiconductor, Inc. |
5 | * Author: Mingkai Hu <Mingkai.hu@freescale.com> | 5 | * Author: Mingkai Hu <Mingkai.hu@freescale.com> |
@@ -35,9 +35,16 @@ | |||
35 | #define MCP3021_OUTPUT_RES 10 /* 10-bit resolution */ | 35 | #define MCP3021_OUTPUT_RES 10 /* 10-bit resolution */ |
36 | #define MCP3021_OUTPUT_SCALE 4 | 36 | #define MCP3021_OUTPUT_SCALE 4 |
37 | 37 | ||
38 | #define MCP3221_SAR_SHIFT 0 | ||
39 | #define MCP3221_SAR_MASK 0xfff | ||
40 | #define MCP3221_OUTPUT_RES 12 /* 12-bit resolution */ | ||
41 | #define MCP3221_OUTPUT_SCALE 1 | ||
42 | |||
38 | enum chips { | 43 | enum chips { |
39 | mcp3021 | 44 | mcp3021, |
45 | mcp3221 | ||
40 | }; | 46 | }; |
47 | |||
41 | /* | 48 | /* |
42 | * Client data (each client gets its own) | 49 | * Client data (each client gets its own) |
43 | */ | 50 | */ |
@@ -127,6 +134,13 @@ static int mcp3021_probe(struct i2c_client *client, | |||
127 | data->output_res = MCP3021_OUTPUT_RES; | 134 | data->output_res = MCP3021_OUTPUT_RES; |
128 | data->output_scale = MCP3021_OUTPUT_SCALE; | 135 | data->output_scale = MCP3021_OUTPUT_SCALE; |
129 | break; | 136 | break; |
137 | |||
138 | case mcp3221: | ||
139 | data->sar_shift = MCP3221_SAR_SHIFT; | ||
140 | data->sar_mask = MCP3221_SAR_MASK; | ||
141 | data->output_res = MCP3221_OUTPUT_RES; | ||
142 | data->output_scale = MCP3221_OUTPUT_SCALE; | ||
143 | break; | ||
130 | } | 144 | } |
131 | 145 | ||
132 | if (client->dev.platform_data) { | 146 | if (client->dev.platform_data) { |
@@ -165,6 +179,7 @@ static int mcp3021_remove(struct i2c_client *client) | |||
165 | 179 | ||
166 | static const struct i2c_device_id mcp3021_id[] = { | 180 | static const struct i2c_device_id mcp3021_id[] = { |
167 | { "mcp3021", mcp3021 }, | 181 | { "mcp3021", mcp3021 }, |
182 | { "mcp3221", mcp3221 }, | ||
168 | { } | 183 | { } |
169 | }; | 184 | }; |
170 | MODULE_DEVICE_TABLE(i2c, mcp3021_id); | 185 | MODULE_DEVICE_TABLE(i2c, mcp3021_id); |
@@ -181,5 +196,5 @@ static struct i2c_driver mcp3021_driver = { | |||
181 | module_i2c_driver(mcp3021_driver); | 196 | module_i2c_driver(mcp3021_driver); |
182 | 197 | ||
183 | MODULE_AUTHOR("Mingkai Hu <Mingkai.hu@freescale.com>"); | 198 | MODULE_AUTHOR("Mingkai Hu <Mingkai.hu@freescale.com>"); |
184 | MODULE_DESCRIPTION("Microchip MCP3021 driver"); | 199 | MODULE_DESCRIPTION("Microchip MCP3021/MCP3221 driver"); |
185 | MODULE_LICENSE("GPL"); | 200 | MODULE_LICENSE("GPL"); |