aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2014-03-06 00:23:01 -0500
committerGuenter Roeck <linux@roeck-us.net>2014-03-19 21:59:40 -0400
commitf76992b00a4111fc4679b0b2d49fe75f05c2b04d (patch)
treedd188d5108dfee2f8f525833bb359b8d9b8b1c8c /drivers/hwmon
parenta2e151074366487dcde943fdc08d88acfe476f9d (diff)
hwmon: (pmbus/ltc2978) Add support for LTM4676
The chip's programming interface is quite similar to LTC3880 and supports the same set of sensors. Reviewed-by: Robert Coulson <rob.coulson@gmail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/pmbus/ltc2978.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/hwmon/pmbus/ltc2978.c b/drivers/hwmon/pmbus/ltc2978.c
index 629bfe0fe90a..e24ed521051a 100644
--- a/drivers/hwmon/pmbus/ltc2978.c
+++ b/drivers/hwmon/pmbus/ltc2978.c
@@ -1,9 +1,9 @@
1/* 1/*
2 * Hardware monitoring driver for LTC2974, LTC2977, LTC2978, LTC3880, 2 * Hardware monitoring driver for LTC2974, LTC2977, LTC2978, LTC3880,
3 * and LTC3883 3 * LTC3883, and LTM4676
4 * 4 *
5 * Copyright (c) 2011 Ericsson AB. 5 * Copyright (c) 2011 Ericsson AB.
6 * Copyright (c) 2013 Guenter Roeck 6 * Copyright (c) 2013, 2014 Guenter Roeck
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
@@ -14,10 +14,6 @@
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */ 17 */
22 18
23#include <linux/kernel.h> 19#include <linux/kernel.h>
@@ -28,7 +24,7 @@
28#include <linux/i2c.h> 24#include <linux/i2c.h>
29#include "pmbus.h" 25#include "pmbus.h"
30 26
31enum chips { ltc2974, ltc2977, ltc2978, ltc3880, ltc3883 }; 27enum chips { ltc2974, ltc2977, ltc2978, ltc3880, ltc3883, ltm4676 };
32 28
33/* Common for all chips */ 29/* Common for all chips */
34#define LTC2978_MFR_VOUT_PEAK 0xdd 30#define LTC2978_MFR_VOUT_PEAK 0xdd
@@ -45,7 +41,7 @@ enum chips { ltc2974, ltc2977, ltc2978, ltc3880, ltc3883 };
45#define LTC2974_MFR_IOUT_PEAK 0xd7 41#define LTC2974_MFR_IOUT_PEAK 0xd7
46#define LTC2974_MFR_IOUT_MIN 0xd8 42#define LTC2974_MFR_IOUT_MIN 0xd8
47 43
48/* LTC3880 and LTC3883 */ 44/* LTC3880, LTC3883, and LTM4676 */
49#define LTC3880_MFR_IOUT_PEAK 0xd7 45#define LTC3880_MFR_IOUT_PEAK 0xd7
50#define LTC3880_MFR_CLEAR_PEAKS 0xe3 46#define LTC3880_MFR_CLEAR_PEAKS 0xe3
51#define LTC3880_MFR_TEMPERATURE2_PEAK 0xf4 47#define LTC3880_MFR_TEMPERATURE2_PEAK 0xf4
@@ -63,6 +59,8 @@ enum chips { ltc2974, ltc2977, ltc2978, ltc3880, ltc3883 };
63#define LTC3880_ID_MASK 0xff00 59#define LTC3880_ID_MASK 0xff00
64#define LTC3883_ID 0x4300 60#define LTC3883_ID 0x4300
65#define LTC3883_ID_MASK 0xff00 61#define LTC3883_ID_MASK 0xff00
62#define LTM4676_ID 0x4480 /* datasheet claims 0x440X */
63#define LTM4676_ID_MASK 0xfff0
66 64
67#define LTC2974_NUM_PAGES 4 65#define LTC2974_NUM_PAGES 4
68#define LTC2978_NUM_PAGES 8 66#define LTC2978_NUM_PAGES 8
@@ -371,6 +369,7 @@ static const struct i2c_device_id ltc2978_id[] = {
371 {"ltc2978", ltc2978}, 369 {"ltc2978", ltc2978},
372 {"ltc3880", ltc3880}, 370 {"ltc3880", ltc3880},
373 {"ltc3883", ltc3883}, 371 {"ltc3883", ltc3883},
372 {"ltm4676", ltm4676},
374 {} 373 {}
375}; 374};
376MODULE_DEVICE_TABLE(i2c, ltc2978_id); 375MODULE_DEVICE_TABLE(i2c, ltc2978_id);
@@ -406,6 +405,8 @@ static int ltc2978_probe(struct i2c_client *client,
406 data->id = ltc3880; 405 data->id = ltc3880;
407 } else if ((chip_id & LTC3883_ID_MASK) == LTC3883_ID) { 406 } else if ((chip_id & LTC3883_ID_MASK) == LTC3883_ID) {
408 data->id = ltc3883; 407 data->id = ltc3883;
408 } else if ((chip_id & LTM4676_ID_MASK) == LTM4676_ID) {
409 data->id = ltm4676;
409 } else { 410 } else {
410 dev_err(&client->dev, "Unsupported chip ID 0x%x\n", chip_id); 411 dev_err(&client->dev, "Unsupported chip ID 0x%x\n", chip_id);
411 return -ENODEV; 412 return -ENODEV;
@@ -459,6 +460,7 @@ static int ltc2978_probe(struct i2c_client *client,
459 } 460 }
460 break; 461 break;
461 case ltc3880: 462 case ltc3880:
463 case ltm4676:
462 info->read_word_data = ltc3880_read_word_data; 464 info->read_word_data = ltc3880_read_word_data;
463 info->pages = LTC3880_NUM_PAGES; 465 info->pages = LTC3880_NUM_PAGES;
464 info->func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_IIN 466 info->func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_IIN
@@ -501,5 +503,5 @@ static struct i2c_driver ltc2978_driver = {
501module_i2c_driver(ltc2978_driver); 503module_i2c_driver(ltc2978_driver);
502 504
503MODULE_AUTHOR("Guenter Roeck"); 505MODULE_AUTHOR("Guenter Roeck");
504MODULE_DESCRIPTION("PMBus driver for LTC2974, LTC2978, LTC3880, and LTC3883"); 506MODULE_DESCRIPTION("PMBus driver for LTC2974, LTC2978, LTC3880, LTC3883, and LTM4676");
505MODULE_LICENSE("GPL"); 507MODULE_LICENSE("GPL");