Guenter Roeck | c3ff9a6 | 2011-09-02 09:58:37 -0700 | [diff] [blame] | 1 | /* |
Guenter Roeck | ddfb41c | 2011-09-11 20:31:09 -0700 | [diff] [blame] | 2 | * Hardware monitoring driver for LTC2978 and LTC3880 |
Guenter Roeck | c3ff9a6 | 2011-09-02 09:58:37 -0700 | [diff] [blame] | 3 | * |
| 4 | * Copyright (c) 2011 Ericsson AB. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 19 | */ |
| 20 | |
| 21 | #include <linux/kernel.h> |
| 22 | #include <linux/module.h> |
| 23 | #include <linux/init.h> |
| 24 | #include <linux/err.h> |
| 25 | #include <linux/slab.h> |
| 26 | #include <linux/i2c.h> |
| 27 | #include "pmbus.h" |
| 28 | |
Guenter Roeck | ddfb41c | 2011-09-11 20:31:09 -0700 | [diff] [blame] | 29 | enum chips { ltc2978, ltc3880 }; |
Guenter Roeck | c3ff9a6 | 2011-09-02 09:58:37 -0700 | [diff] [blame] | 30 | |
Guenter Roeck | ddfb41c | 2011-09-11 20:31:09 -0700 | [diff] [blame] | 31 | /* LTC2978 and LTC3880 */ |
Guenter Roeck | c3ff9a6 | 2011-09-02 09:58:37 -0700 | [diff] [blame] | 32 | #define LTC2978_MFR_VOUT_PEAK 0xdd |
| 33 | #define LTC2978_MFR_VIN_PEAK 0xde |
| 34 | #define LTC2978_MFR_TEMPERATURE_PEAK 0xdf |
| 35 | #define LTC2978_MFR_SPECIAL_ID 0xe7 |
| 36 | |
Guenter Roeck | ddfb41c | 2011-09-11 20:31:09 -0700 | [diff] [blame] | 37 | /* LTC2978 only */ |
Guenter Roeck | c3ff9a6 | 2011-09-02 09:58:37 -0700 | [diff] [blame] | 38 | #define LTC2978_MFR_VOUT_MIN 0xfb |
| 39 | #define LTC2978_MFR_VIN_MIN 0xfc |
| 40 | #define LTC2978_MFR_TEMPERATURE_MIN 0xfd |
| 41 | |
Guenter Roeck | ddfb41c | 2011-09-11 20:31:09 -0700 | [diff] [blame] | 42 | /* LTC3880 only */ |
| 43 | #define LTC3880_MFR_IOUT_PEAK 0xd7 |
| 44 | #define LTC3880_MFR_CLEAR_PEAKS 0xe3 |
| 45 | #define LTC3880_MFR_TEMPERATURE2_PEAK 0xf4 |
| 46 | |
Guenter Roeck | c3ff9a6 | 2011-09-02 09:58:37 -0700 | [diff] [blame] | 47 | #define LTC2978_ID_REV1 0x0121 |
| 48 | #define LTC2978_ID_REV2 0x0122 |
Guenter Roeck | ddfb41c | 2011-09-11 20:31:09 -0700 | [diff] [blame] | 49 | #define LTC3880_ID 0x4000 |
| 50 | #define LTC3880_ID_MASK 0xff00 |
Guenter Roeck | c3ff9a6 | 2011-09-02 09:58:37 -0700 | [diff] [blame] | 51 | |
| 52 | /* |
| 53 | * LTC2978 clears peak data whenever the CLEAR_FAULTS command is executed, which |
| 54 | * happens pretty much each time chip data is updated. Raw peak data therefore |
| 55 | * does not provide much value. To be able to provide useful peak data, keep an |
| 56 | * internal cache of measured peak data, which is only cleared if an explicit |
| 57 | * "clear peak" command is executed for the sensor in question. |
| 58 | */ |
| 59 | struct ltc2978_data { |
| 60 | enum chips id; |
| 61 | int vin_min, vin_max; |
| 62 | int temp_min, temp_max; |
| 63 | int vout_min[8], vout_max[8]; |
Guenter Roeck | ddfb41c | 2011-09-11 20:31:09 -0700 | [diff] [blame] | 64 | int iout_max[2]; |
Guenter Roeck | dbd712c | 2013-02-21 09:33:25 -0800 | [diff] [blame^] | 65 | int temp2_max; |
Guenter Roeck | c3ff9a6 | 2011-09-02 09:58:37 -0700 | [diff] [blame] | 66 | struct pmbus_driver_info info; |
| 67 | }; |
| 68 | |
| 69 | #define to_ltc2978_data(x) container_of(x, struct ltc2978_data, info) |
| 70 | |
| 71 | static inline int lin11_to_val(int data) |
| 72 | { |
| 73 | s16 e = ((s16)data) >> 11; |
| 74 | s32 m = (((s16)(data << 5)) >> 5); |
| 75 | |
| 76 | /* |
| 77 | * mantissa is 10 bit + sign, exponent adds up to 15 bit. |
| 78 | * Add 6 bit to exponent for maximum accuracy (10 + 15 + 6 = 31). |
| 79 | */ |
| 80 | e += 6; |
| 81 | return (e < 0 ? m >> -e : m << e); |
| 82 | } |
| 83 | |
Guenter Roeck | ddfb41c | 2011-09-11 20:31:09 -0700 | [diff] [blame] | 84 | static int ltc2978_read_word_data_common(struct i2c_client *client, int page, |
| 85 | int reg) |
Guenter Roeck | c3ff9a6 | 2011-09-02 09:58:37 -0700 | [diff] [blame] | 86 | { |
| 87 | const struct pmbus_driver_info *info = pmbus_get_driver_info(client); |
| 88 | struct ltc2978_data *data = to_ltc2978_data(info); |
| 89 | int ret; |
| 90 | |
| 91 | switch (reg) { |
| 92 | case PMBUS_VIRT_READ_VIN_MAX: |
| 93 | ret = pmbus_read_word_data(client, page, LTC2978_MFR_VIN_PEAK); |
| 94 | if (ret >= 0) { |
| 95 | if (lin11_to_val(ret) > lin11_to_val(data->vin_max)) |
| 96 | data->vin_max = ret; |
| 97 | ret = data->vin_max; |
| 98 | } |
| 99 | break; |
| 100 | case PMBUS_VIRT_READ_VOUT_MAX: |
| 101 | ret = pmbus_read_word_data(client, page, LTC2978_MFR_VOUT_PEAK); |
| 102 | if (ret >= 0) { |
| 103 | /* |
| 104 | * VOUT is 16 bit unsigned with fixed exponent, |
| 105 | * so we can compare it directly |
| 106 | */ |
| 107 | if (ret > data->vout_max[page]) |
| 108 | data->vout_max[page] = ret; |
| 109 | ret = data->vout_max[page]; |
| 110 | } |
| 111 | break; |
| 112 | case PMBUS_VIRT_READ_TEMP_MAX: |
| 113 | ret = pmbus_read_word_data(client, page, |
| 114 | LTC2978_MFR_TEMPERATURE_PEAK); |
| 115 | if (ret >= 0) { |
| 116 | if (lin11_to_val(ret) > lin11_to_val(data->temp_max)) |
| 117 | data->temp_max = ret; |
| 118 | ret = data->temp_max; |
| 119 | } |
| 120 | break; |
Guenter Roeck | ddfb41c | 2011-09-11 20:31:09 -0700 | [diff] [blame] | 121 | case PMBUS_VIRT_RESET_VOUT_HISTORY: |
| 122 | case PMBUS_VIRT_RESET_VIN_HISTORY: |
| 123 | case PMBUS_VIRT_RESET_TEMP_HISTORY: |
| 124 | ret = 0; |
| 125 | break; |
| 126 | default: |
| 127 | ret = -ENODATA; |
| 128 | break; |
| 129 | } |
| 130 | return ret; |
| 131 | } |
| 132 | |
| 133 | static int ltc2978_read_word_data(struct i2c_client *client, int page, int reg) |
| 134 | { |
| 135 | const struct pmbus_driver_info *info = pmbus_get_driver_info(client); |
| 136 | struct ltc2978_data *data = to_ltc2978_data(info); |
| 137 | int ret; |
| 138 | |
| 139 | switch (reg) { |
Guenter Roeck | c3ff9a6 | 2011-09-02 09:58:37 -0700 | [diff] [blame] | 140 | case PMBUS_VIRT_READ_VIN_MIN: |
| 141 | ret = pmbus_read_word_data(client, page, LTC2978_MFR_VIN_MIN); |
| 142 | if (ret >= 0) { |
| 143 | if (lin11_to_val(ret) < lin11_to_val(data->vin_min)) |
| 144 | data->vin_min = ret; |
| 145 | ret = data->vin_min; |
| 146 | } |
| 147 | break; |
| 148 | case PMBUS_VIRT_READ_VOUT_MIN: |
| 149 | ret = pmbus_read_word_data(client, page, LTC2978_MFR_VOUT_MIN); |
| 150 | if (ret >= 0) { |
| 151 | /* |
| 152 | * VOUT_MIN is known to not be supported on some lots |
| 153 | * of LTC2978 revision 1, and will return the maximum |
| 154 | * possible voltage if read. If VOUT_MAX is valid and |
| 155 | * lower than the reading of VOUT_MIN, use it instead. |
| 156 | */ |
| 157 | if (data->vout_max[page] && ret > data->vout_max[page]) |
| 158 | ret = data->vout_max[page]; |
| 159 | if (ret < data->vout_min[page]) |
| 160 | data->vout_min[page] = ret; |
| 161 | ret = data->vout_min[page]; |
| 162 | } |
| 163 | break; |
| 164 | case PMBUS_VIRT_READ_TEMP_MIN: |
| 165 | ret = pmbus_read_word_data(client, page, |
| 166 | LTC2978_MFR_TEMPERATURE_MIN); |
| 167 | if (ret >= 0) { |
| 168 | if (lin11_to_val(ret) |
| 169 | < lin11_to_val(data->temp_min)) |
| 170 | data->temp_min = ret; |
| 171 | ret = data->temp_min; |
| 172 | } |
| 173 | break; |
Guenter Roeck | ddfb41c | 2011-09-11 20:31:09 -0700 | [diff] [blame] | 174 | case PMBUS_VIRT_READ_IOUT_MAX: |
| 175 | case PMBUS_VIRT_RESET_IOUT_HISTORY: |
| 176 | case PMBUS_VIRT_READ_TEMP2_MAX: |
| 177 | case PMBUS_VIRT_RESET_TEMP2_HISTORY: |
| 178 | ret = -ENXIO; |
| 179 | break; |
| 180 | default: |
| 181 | ret = ltc2978_read_word_data_common(client, page, reg); |
| 182 | break; |
| 183 | } |
| 184 | return ret; |
| 185 | } |
| 186 | |
| 187 | static int ltc3880_read_word_data(struct i2c_client *client, int page, int reg) |
| 188 | { |
| 189 | const struct pmbus_driver_info *info = pmbus_get_driver_info(client); |
| 190 | struct ltc2978_data *data = to_ltc2978_data(info); |
| 191 | int ret; |
| 192 | |
| 193 | switch (reg) { |
| 194 | case PMBUS_VIRT_READ_IOUT_MAX: |
| 195 | ret = pmbus_read_word_data(client, page, LTC3880_MFR_IOUT_PEAK); |
| 196 | if (ret >= 0) { |
| 197 | if (lin11_to_val(ret) |
| 198 | > lin11_to_val(data->iout_max[page])) |
| 199 | data->iout_max[page] = ret; |
| 200 | ret = data->iout_max[page]; |
| 201 | } |
| 202 | break; |
| 203 | case PMBUS_VIRT_READ_TEMP2_MAX: |
| 204 | ret = pmbus_read_word_data(client, page, |
| 205 | LTC3880_MFR_TEMPERATURE2_PEAK); |
| 206 | if (ret >= 0) { |
Guenter Roeck | dbd712c | 2013-02-21 09:33:25 -0800 | [diff] [blame^] | 207 | if (lin11_to_val(ret) > lin11_to_val(data->temp2_max)) |
| 208 | data->temp2_max = ret; |
| 209 | ret = data->temp2_max; |
Guenter Roeck | ddfb41c | 2011-09-11 20:31:09 -0700 | [diff] [blame] | 210 | } |
| 211 | break; |
| 212 | case PMBUS_VIRT_READ_VIN_MIN: |
| 213 | case PMBUS_VIRT_READ_VOUT_MIN: |
| 214 | case PMBUS_VIRT_READ_TEMP_MIN: |
| 215 | ret = -ENXIO; |
| 216 | break; |
| 217 | case PMBUS_VIRT_RESET_IOUT_HISTORY: |
| 218 | case PMBUS_VIRT_RESET_TEMP2_HISTORY: |
Guenter Roeck | c3ff9a6 | 2011-09-02 09:58:37 -0700 | [diff] [blame] | 219 | ret = 0; |
| 220 | break; |
| 221 | default: |
Guenter Roeck | ddfb41c | 2011-09-11 20:31:09 -0700 | [diff] [blame] | 222 | ret = ltc2978_read_word_data_common(client, page, reg); |
Guenter Roeck | c3ff9a6 | 2011-09-02 09:58:37 -0700 | [diff] [blame] | 223 | break; |
| 224 | } |
| 225 | return ret; |
| 226 | } |
| 227 | |
Guenter Roeck | ddfb41c | 2011-09-11 20:31:09 -0700 | [diff] [blame] | 228 | static int ltc2978_clear_peaks(struct i2c_client *client, int page, |
| 229 | enum chips id) |
| 230 | { |
| 231 | int ret; |
| 232 | |
| 233 | if (id == ltc2978) |
| 234 | ret = pmbus_write_byte(client, page, PMBUS_CLEAR_FAULTS); |
| 235 | else |
| 236 | ret = pmbus_write_byte(client, 0, LTC3880_MFR_CLEAR_PEAKS); |
| 237 | |
| 238 | return ret; |
| 239 | } |
| 240 | |
Guenter Roeck | c3ff9a6 | 2011-09-02 09:58:37 -0700 | [diff] [blame] | 241 | static int ltc2978_write_word_data(struct i2c_client *client, int page, |
| 242 | int reg, u16 word) |
| 243 | { |
| 244 | const struct pmbus_driver_info *info = pmbus_get_driver_info(client); |
| 245 | struct ltc2978_data *data = to_ltc2978_data(info); |
| 246 | int ret; |
| 247 | |
| 248 | switch (reg) { |
Guenter Roeck | ddfb41c | 2011-09-11 20:31:09 -0700 | [diff] [blame] | 249 | case PMBUS_VIRT_RESET_IOUT_HISTORY: |
Guenter Roeck | dbd712c | 2013-02-21 09:33:25 -0800 | [diff] [blame^] | 250 | data->iout_max[page] = 0x7c00; |
Guenter Roeck | ddfb41c | 2011-09-11 20:31:09 -0700 | [diff] [blame] | 251 | ret = ltc2978_clear_peaks(client, page, data->id); |
| 252 | break; |
| 253 | case PMBUS_VIRT_RESET_TEMP2_HISTORY: |
Guenter Roeck | dbd712c | 2013-02-21 09:33:25 -0800 | [diff] [blame^] | 254 | data->temp2_max = 0x7c00; |
Guenter Roeck | ddfb41c | 2011-09-11 20:31:09 -0700 | [diff] [blame] | 255 | ret = ltc2978_clear_peaks(client, page, data->id); |
| 256 | break; |
Guenter Roeck | c3ff9a6 | 2011-09-02 09:58:37 -0700 | [diff] [blame] | 257 | case PMBUS_VIRT_RESET_VOUT_HISTORY: |
| 258 | data->vout_min[page] = 0xffff; |
| 259 | data->vout_max[page] = 0; |
Guenter Roeck | ddfb41c | 2011-09-11 20:31:09 -0700 | [diff] [blame] | 260 | ret = ltc2978_clear_peaks(client, page, data->id); |
Guenter Roeck | c3ff9a6 | 2011-09-02 09:58:37 -0700 | [diff] [blame] | 261 | break; |
| 262 | case PMBUS_VIRT_RESET_VIN_HISTORY: |
| 263 | data->vin_min = 0x7bff; |
Guenter Roeck | dbd712c | 2013-02-21 09:33:25 -0800 | [diff] [blame^] | 264 | data->vin_max = 0x7c00; |
Guenter Roeck | ddfb41c | 2011-09-11 20:31:09 -0700 | [diff] [blame] | 265 | ret = ltc2978_clear_peaks(client, page, data->id); |
Guenter Roeck | c3ff9a6 | 2011-09-02 09:58:37 -0700 | [diff] [blame] | 266 | break; |
| 267 | case PMBUS_VIRT_RESET_TEMP_HISTORY: |
| 268 | data->temp_min = 0x7bff; |
Guenter Roeck | dbd712c | 2013-02-21 09:33:25 -0800 | [diff] [blame^] | 269 | data->temp_max = 0x7c00; |
Guenter Roeck | ddfb41c | 2011-09-11 20:31:09 -0700 | [diff] [blame] | 270 | ret = ltc2978_clear_peaks(client, page, data->id); |
Guenter Roeck | c3ff9a6 | 2011-09-02 09:58:37 -0700 | [diff] [blame] | 271 | break; |
| 272 | default: |
| 273 | ret = -ENODATA; |
| 274 | break; |
| 275 | } |
| 276 | return ret; |
| 277 | } |
| 278 | |
| 279 | static const struct i2c_device_id ltc2978_id[] = { |
| 280 | {"ltc2978", ltc2978}, |
Guenter Roeck | ddfb41c | 2011-09-11 20:31:09 -0700 | [diff] [blame] | 281 | {"ltc3880", ltc3880}, |
Guenter Roeck | c3ff9a6 | 2011-09-02 09:58:37 -0700 | [diff] [blame] | 282 | {} |
| 283 | }; |
| 284 | MODULE_DEVICE_TABLE(i2c, ltc2978_id); |
| 285 | |
| 286 | static int ltc2978_probe(struct i2c_client *client, |
| 287 | const struct i2c_device_id *id) |
| 288 | { |
Guenter Roeck | 8b313ca | 2012-02-22 08:56:43 -0800 | [diff] [blame] | 289 | int chip_id, i; |
Guenter Roeck | c3ff9a6 | 2011-09-02 09:58:37 -0700 | [diff] [blame] | 290 | struct ltc2978_data *data; |
| 291 | struct pmbus_driver_info *info; |
| 292 | |
| 293 | if (!i2c_check_functionality(client->adapter, |
| 294 | I2C_FUNC_SMBUS_READ_WORD_DATA)) |
| 295 | return -ENODEV; |
| 296 | |
Guenter Roeck | 8b313ca | 2012-02-22 08:56:43 -0800 | [diff] [blame] | 297 | data = devm_kzalloc(&client->dev, sizeof(struct ltc2978_data), |
| 298 | GFP_KERNEL); |
Guenter Roeck | c3ff9a6 | 2011-09-02 09:58:37 -0700 | [diff] [blame] | 299 | if (!data) |
| 300 | return -ENOMEM; |
| 301 | |
| 302 | chip_id = i2c_smbus_read_word_data(client, LTC2978_MFR_SPECIAL_ID); |
Guenter Roeck | 8b313ca | 2012-02-22 08:56:43 -0800 | [diff] [blame] | 303 | if (chip_id < 0) |
| 304 | return chip_id; |
Guenter Roeck | c3ff9a6 | 2011-09-02 09:58:37 -0700 | [diff] [blame] | 305 | |
| 306 | if (chip_id == LTC2978_ID_REV1 || chip_id == LTC2978_ID_REV2) { |
| 307 | data->id = ltc2978; |
Guenter Roeck | ddfb41c | 2011-09-11 20:31:09 -0700 | [diff] [blame] | 308 | } else if ((chip_id & LTC3880_ID_MASK) == LTC3880_ID) { |
| 309 | data->id = ltc3880; |
Guenter Roeck | c3ff9a6 | 2011-09-02 09:58:37 -0700 | [diff] [blame] | 310 | } else { |
| 311 | dev_err(&client->dev, "Unsupported chip ID 0x%x\n", chip_id); |
Guenter Roeck | 8b313ca | 2012-02-22 08:56:43 -0800 | [diff] [blame] | 312 | return -ENODEV; |
Guenter Roeck | c3ff9a6 | 2011-09-02 09:58:37 -0700 | [diff] [blame] | 313 | } |
| 314 | if (data->id != id->driver_data) |
| 315 | dev_warn(&client->dev, |
| 316 | "Device mismatch: Configured %s, detected %s\n", |
| 317 | id->name, |
| 318 | ltc2978_id[data->id].name); |
| 319 | |
| 320 | info = &data->info; |
Guenter Roeck | c3ff9a6 | 2011-09-02 09:58:37 -0700 | [diff] [blame] | 321 | info->write_word_data = ltc2978_write_word_data; |
| 322 | |
Guenter Roeck | c3ff9a6 | 2011-09-02 09:58:37 -0700 | [diff] [blame] | 323 | data->vin_min = 0x7bff; |
Guenter Roeck | dbd712c | 2013-02-21 09:33:25 -0800 | [diff] [blame^] | 324 | data->vin_max = 0x7c00; |
Guenter Roeck | c3ff9a6 | 2011-09-02 09:58:37 -0700 | [diff] [blame] | 325 | data->temp_min = 0x7bff; |
Guenter Roeck | dbd712c | 2013-02-21 09:33:25 -0800 | [diff] [blame^] | 326 | data->temp_max = 0x7c00; |
| 327 | data->temp2_max = 0x7c00; |
Guenter Roeck | c3ff9a6 | 2011-09-02 09:58:37 -0700 | [diff] [blame] | 328 | |
| 329 | switch (id->driver_data) { |
| 330 | case ltc2978: |
Guenter Roeck | ddfb41c | 2011-09-11 20:31:09 -0700 | [diff] [blame] | 331 | info->read_word_data = ltc2978_read_word_data; |
Guenter Roeck | c3ff9a6 | 2011-09-02 09:58:37 -0700 | [diff] [blame] | 332 | info->pages = 8; |
| 333 | info->func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_STATUS_INPUT |
| 334 | | PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT |
| 335 | | PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP; |
| 336 | for (i = 1; i < 8; i++) { |
| 337 | info->func[i] = PMBUS_HAVE_VOUT |
| 338 | | PMBUS_HAVE_STATUS_VOUT; |
Guenter Roeck | c3ff9a6 | 2011-09-02 09:58:37 -0700 | [diff] [blame] | 339 | } |
| 340 | break; |
Guenter Roeck | ddfb41c | 2011-09-11 20:31:09 -0700 | [diff] [blame] | 341 | case ltc3880: |
| 342 | info->read_word_data = ltc3880_read_word_data; |
| 343 | info->pages = 2; |
| 344 | info->func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_IIN |
| 345 | | PMBUS_HAVE_STATUS_INPUT |
| 346 | | PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT |
| 347 | | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT |
| 348 | | PMBUS_HAVE_POUT | PMBUS_HAVE_TEMP |
| 349 | | PMBUS_HAVE_TEMP2 | PMBUS_HAVE_STATUS_TEMP; |
| 350 | info->func[1] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT |
| 351 | | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT |
| 352 | | PMBUS_HAVE_POUT |
| 353 | | PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP; |
Guenter Roeck | dbd712c | 2013-02-21 09:33:25 -0800 | [diff] [blame^] | 354 | data->iout_max[0] = 0x7c00; |
| 355 | data->iout_max[1] = 0x7c00; |
Guenter Roeck | ddfb41c | 2011-09-11 20:31:09 -0700 | [diff] [blame] | 356 | break; |
Guenter Roeck | c3ff9a6 | 2011-09-02 09:58:37 -0700 | [diff] [blame] | 357 | default: |
Guenter Roeck | 8b313ca | 2012-02-22 08:56:43 -0800 | [diff] [blame] | 358 | return -ENODEV; |
Guenter Roeck | c3ff9a6 | 2011-09-02 09:58:37 -0700 | [diff] [blame] | 359 | } |
Guenter Roeck | dbd712c | 2013-02-21 09:33:25 -0800 | [diff] [blame^] | 360 | for (i = 0; i < info->pages; i++) |
| 361 | data->vout_min[i] = 0xffff; |
Guenter Roeck | c3ff9a6 | 2011-09-02 09:58:37 -0700 | [diff] [blame] | 362 | |
Guenter Roeck | 8b313ca | 2012-02-22 08:56:43 -0800 | [diff] [blame] | 363 | return pmbus_do_probe(client, id, info); |
Guenter Roeck | c3ff9a6 | 2011-09-02 09:58:37 -0700 | [diff] [blame] | 364 | } |
| 365 | |
Guenter Roeck | c3ff9a6 | 2011-09-02 09:58:37 -0700 | [diff] [blame] | 366 | /* This is the driver that will be inserted */ |
| 367 | static struct i2c_driver ltc2978_driver = { |
| 368 | .driver = { |
| 369 | .name = "ltc2978", |
| 370 | }, |
| 371 | .probe = ltc2978_probe, |
Guenter Roeck | dd285ad | 2012-02-22 08:56:44 -0800 | [diff] [blame] | 372 | .remove = pmbus_do_remove, |
Guenter Roeck | c3ff9a6 | 2011-09-02 09:58:37 -0700 | [diff] [blame] | 373 | .id_table = ltc2978_id, |
| 374 | }; |
| 375 | |
Axel Lin | f0967ee | 2012-01-20 15:38:18 +0800 | [diff] [blame] | 376 | module_i2c_driver(ltc2978_driver); |
Guenter Roeck | c3ff9a6 | 2011-09-02 09:58:37 -0700 | [diff] [blame] | 377 | |
| 378 | MODULE_AUTHOR("Guenter Roeck"); |
Guenter Roeck | ddfb41c | 2011-09-11 20:31:09 -0700 | [diff] [blame] | 379 | MODULE_DESCRIPTION("PMBus driver for LTC2978 and LTC3880"); |
Guenter Roeck | c3ff9a6 | 2011-09-02 09:58:37 -0700 | [diff] [blame] | 380 | MODULE_LICENSE("GPL"); |