ltc2945.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519
  1. /*
  2. * Driver for Linear Technology LTC2945 I2C Power Monitor
  3. *
  4. * Copyright (c) 2014 Guenter Roeck
  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. #include <linux/kernel.h>
  17. #include <linux/module.h>
  18. #include <linux/err.h>
  19. #include <linux/slab.h>
  20. #include <linux/i2c.h>
  21. #include <linux/hwmon.h>
  22. #include <linux/hwmon-sysfs.h>
  23. #include <linux/jiffies.h>
  24. #include <linux/regmap.h>
  25. /* chip registers */
  26. #define LTC2945_CONTROL 0x00
  27. #define LTC2945_ALERT 0x01
  28. #define LTC2945_STATUS 0x02
  29. #define LTC2945_FAULT 0x03
  30. #define LTC2945_POWER_H 0x05
  31. #define LTC2945_MAX_POWER_H 0x08
  32. #define LTC2945_MIN_POWER_H 0x0b
  33. #define LTC2945_MAX_POWER_THRES_H 0x0e
  34. #define LTC2945_MIN_POWER_THRES_H 0x11
  35. #define LTC2945_SENSE_H 0x14
  36. #define LTC2945_MAX_SENSE_H 0x16
  37. #define LTC2945_MIN_SENSE_H 0x18
  38. #define LTC2945_MAX_SENSE_THRES_H 0x1a
  39. #define LTC2945_MIN_SENSE_THRES_H 0x1c
  40. #define LTC2945_VIN_H 0x1e
  41. #define LTC2945_MAX_VIN_H 0x20
  42. #define LTC2945_MIN_VIN_H 0x22
  43. #define LTC2945_MAX_VIN_THRES_H 0x24
  44. #define LTC2945_MIN_VIN_THRES_H 0x26
  45. #define LTC2945_ADIN_H 0x28
  46. #define LTC2945_MAX_ADIN_H 0x2a
  47. #define LTC2945_MIN_ADIN_H 0x2c
  48. #define LTC2945_MAX_ADIN_THRES_H 0x2e
  49. #define LTC2945_MIN_ADIN_THRES_H 0x30
  50. #define LTC2945_MIN_ADIN_THRES_L 0x31
  51. /* Fault register bits */
  52. #define FAULT_ADIN_UV (1 << 0)
  53. #define FAULT_ADIN_OV (1 << 1)
  54. #define FAULT_VIN_UV (1 << 2)
  55. #define FAULT_VIN_OV (1 << 3)
  56. #define FAULT_SENSE_UV (1 << 4)
  57. #define FAULT_SENSE_OV (1 << 5)
  58. #define FAULT_POWER_UV (1 << 6)
  59. #define FAULT_POWER_OV (1 << 7)
  60. /* Control register bits */
  61. #define CONTROL_MULT_SELECT (1 << 0)
  62. #define CONTROL_TEST_MODE (1 << 4)
  63. static inline bool is_power_reg(u8 reg)
  64. {
  65. return reg < LTC2945_SENSE_H;
  66. }
  67. /* Return the value from the given register in uW, mV, or mA */
  68. static long long ltc2945_reg_to_val(struct device *dev, u8 reg)
  69. {
  70. struct regmap *regmap = dev_get_drvdata(dev);
  71. unsigned int control;
  72. u8 buf[3];
  73. long long val;
  74. int ret;
  75. ret = regmap_bulk_read(regmap, reg, buf,
  76. is_power_reg(reg) ? 3 : 2);
  77. if (ret < 0)
  78. return ret;
  79. if (is_power_reg(reg)) {
  80. /* power */
  81. val = (buf[0] << 16) + (buf[1] << 8) + buf[2];
  82. } else {
  83. /* current, voltage */
  84. val = (buf[0] << 4) + (buf[1] >> 4);
  85. }
  86. switch (reg) {
  87. case LTC2945_POWER_H:
  88. case LTC2945_MAX_POWER_H:
  89. case LTC2945_MIN_POWER_H:
  90. case LTC2945_MAX_POWER_THRES_H:
  91. case LTC2945_MIN_POWER_THRES_H:
  92. /*
  93. * Convert to uW by assuming current is measured with
  94. * an 1mOhm sense resistor, similar to current
  95. * measurements.
  96. * Control register bit 0 selects if voltage at SENSE+/VDD
  97. * or voltage at ADIN is used to measure power.
  98. */
  99. ret = regmap_read(regmap, LTC2945_CONTROL, &control);
  100. if (ret < 0)
  101. return ret;
  102. if (control & CONTROL_MULT_SELECT) {
  103. /* 25 mV * 25 uV = 0.625 uV resolution. */
  104. val *= 625LL;
  105. } else {
  106. /* 0.5 mV * 25 uV = 0.0125 uV resolution. */
  107. val = (val * 25LL) >> 1;
  108. }
  109. break;
  110. case LTC2945_VIN_H:
  111. case LTC2945_MAX_VIN_H:
  112. case LTC2945_MIN_VIN_H:
  113. case LTC2945_MAX_VIN_THRES_H:
  114. case LTC2945_MIN_VIN_THRES_H:
  115. /* 25 mV resolution. Convert to mV. */
  116. val *= 25;
  117. break;
  118. case LTC2945_ADIN_H:
  119. case LTC2945_MAX_ADIN_H:
  120. case LTC2945_MIN_ADIN_THRES_H:
  121. case LTC2945_MAX_ADIN_THRES_H:
  122. case LTC2945_MIN_ADIN_H:
  123. /* 0.5mV resolution. Convert to mV. */
  124. val = val >> 1;
  125. break;
  126. case LTC2945_SENSE_H:
  127. case LTC2945_MAX_SENSE_H:
  128. case LTC2945_MIN_SENSE_H:
  129. case LTC2945_MAX_SENSE_THRES_H:
  130. case LTC2945_MIN_SENSE_THRES_H:
  131. /*
  132. * 25 uV resolution. Convert to current as measured with
  133. * an 1 mOhm sense resistor, in mA. If a different sense
  134. * resistor is installed, calculate the actual current by
  135. * dividing the reported current by the sense resistor value
  136. * in mOhm.
  137. */
  138. val *= 25;
  139. break;
  140. default:
  141. return -EINVAL;
  142. }
  143. return val;
  144. }
  145. static int ltc2945_val_to_reg(struct device *dev, u8 reg,
  146. unsigned long val)
  147. {
  148. struct regmap *regmap = dev_get_drvdata(dev);
  149. unsigned int control;
  150. int ret;
  151. switch (reg) {
  152. case LTC2945_POWER_H:
  153. case LTC2945_MAX_POWER_H:
  154. case LTC2945_MIN_POWER_H:
  155. case LTC2945_MAX_POWER_THRES_H:
  156. case LTC2945_MIN_POWER_THRES_H:
  157. /*
  158. * Convert to register value by assuming current is measured
  159. * with an 1mOhm sense resistor, similar to current
  160. * measurements.
  161. * Control register bit 0 selects if voltage at SENSE+/VDD
  162. * or voltage at ADIN is used to measure power, which in turn
  163. * determines register calculations.
  164. */
  165. ret = regmap_read(regmap, LTC2945_CONTROL, &control);
  166. if (ret < 0)
  167. return ret;
  168. if (control & CONTROL_MULT_SELECT) {
  169. /* 25 mV * 25 uV = 0.625 uV resolution. */
  170. val = DIV_ROUND_CLOSEST(val, 625);
  171. } else {
  172. /*
  173. * 0.5 mV * 25 uV = 0.0125 uV resolution.
  174. * Divide first to avoid overflow;
  175. * accept loss of accuracy.
  176. */
  177. val = DIV_ROUND_CLOSEST(val, 25) * 2;
  178. }
  179. break;
  180. case LTC2945_VIN_H:
  181. case LTC2945_MAX_VIN_H:
  182. case LTC2945_MIN_VIN_H:
  183. case LTC2945_MAX_VIN_THRES_H:
  184. case LTC2945_MIN_VIN_THRES_H:
  185. /* 25 mV resolution. */
  186. val /= 25;
  187. break;
  188. case LTC2945_ADIN_H:
  189. case LTC2945_MAX_ADIN_H:
  190. case LTC2945_MIN_ADIN_THRES_H:
  191. case LTC2945_MAX_ADIN_THRES_H:
  192. case LTC2945_MIN_ADIN_H:
  193. /* 0.5mV resolution. */
  194. val *= 2;
  195. break;
  196. case LTC2945_SENSE_H:
  197. case LTC2945_MAX_SENSE_H:
  198. case LTC2945_MIN_SENSE_H:
  199. case LTC2945_MAX_SENSE_THRES_H:
  200. case LTC2945_MIN_SENSE_THRES_H:
  201. /*
  202. * 25 uV resolution. Convert to current as measured with
  203. * an 1 mOhm sense resistor, in mA. If a different sense
  204. * resistor is installed, calculate the actual current by
  205. * dividing the reported current by the sense resistor value
  206. * in mOhm.
  207. */
  208. val = DIV_ROUND_CLOSEST(val, 25);
  209. break;
  210. default:
  211. return -EINVAL;
  212. }
  213. return val;
  214. }
  215. static ssize_t ltc2945_show_value(struct device *dev,
  216. struct device_attribute *da, char *buf)
  217. {
  218. struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
  219. long long value;
  220. value = ltc2945_reg_to_val(dev, attr->index);
  221. if (value < 0)
  222. return value;
  223. return snprintf(buf, PAGE_SIZE, "%lld\n", value);
  224. }
  225. static ssize_t ltc2945_set_value(struct device *dev,
  226. struct device_attribute *da,
  227. const char *buf, size_t count)
  228. {
  229. struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
  230. struct regmap *regmap = dev_get_drvdata(dev);
  231. u8 reg = attr->index;
  232. unsigned long val;
  233. u8 regbuf[3];
  234. int num_regs;
  235. int regval;
  236. int ret;
  237. ret = kstrtoul(buf, 10, &val);
  238. if (ret)
  239. return ret;
  240. /* convert to register value, then clamp and write result */
  241. regval = ltc2945_val_to_reg(dev, reg, val);
  242. if (is_power_reg(reg)) {
  243. regval = clamp_val(regval, 0, 0xffffff);
  244. regbuf[0] = regval >> 16;
  245. regbuf[1] = (regval >> 8) & 0xff;
  246. regbuf[2] = regval;
  247. num_regs = 3;
  248. } else {
  249. regval = clamp_val(regval, 0, 0xfff) << 4;
  250. regbuf[0] = regval >> 8;
  251. regbuf[1] = regval & 0xff;
  252. num_regs = 2;
  253. }
  254. ret = regmap_bulk_write(regmap, reg, regbuf, num_regs);
  255. return ret < 0 ? ret : count;
  256. }
  257. static ssize_t ltc2945_reset_history(struct device *dev,
  258. struct device_attribute *da,
  259. const char *buf, size_t count)
  260. {
  261. struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
  262. struct regmap *regmap = dev_get_drvdata(dev);
  263. u8 reg = attr->index;
  264. int num_regs = is_power_reg(reg) ? 3 : 2;
  265. u8 buf_min[3] = { 0xff, 0xff, 0xff };
  266. u8 buf_max[3] = { 0, 0, 0 };
  267. unsigned long val;
  268. int ret;
  269. ret = kstrtoul(buf, 10, &val);
  270. if (ret)
  271. return ret;
  272. if (val != 1)
  273. return -EINVAL;
  274. ret = regmap_update_bits(regmap, LTC2945_CONTROL, CONTROL_TEST_MODE,
  275. CONTROL_TEST_MODE);
  276. /* Reset minimum */
  277. ret = regmap_bulk_write(regmap, reg, buf_min, num_regs);
  278. if (ret)
  279. return ret;
  280. switch (reg) {
  281. case LTC2945_MIN_POWER_H:
  282. reg = LTC2945_MAX_POWER_H;
  283. break;
  284. case LTC2945_MIN_SENSE_H:
  285. reg = LTC2945_MAX_SENSE_H;
  286. break;
  287. case LTC2945_MIN_VIN_H:
  288. reg = LTC2945_MAX_VIN_H;
  289. break;
  290. case LTC2945_MIN_ADIN_H:
  291. reg = LTC2945_MAX_ADIN_H;
  292. break;
  293. default:
  294. WARN_ONCE(1, "Bad register: 0x%x\n", reg);
  295. return -EINVAL;
  296. }
  297. /* Reset maximum */
  298. ret = regmap_bulk_write(regmap, reg, buf_max, num_regs);
  299. /* Try resetting test mode even if there was an error */
  300. regmap_update_bits(regmap, LTC2945_CONTROL, CONTROL_TEST_MODE, 0);
  301. return ret ? : count;
  302. }
  303. static ssize_t ltc2945_show_bool(struct device *dev,
  304. struct device_attribute *da, char *buf)
  305. {
  306. struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
  307. struct regmap *regmap = dev_get_drvdata(dev);
  308. unsigned int fault;
  309. int ret;
  310. ret = regmap_read(regmap, LTC2945_FAULT, &fault);
  311. if (ret < 0)
  312. return ret;
  313. fault &= attr->index;
  314. if (fault) /* Clear reported faults in chip register */
  315. regmap_update_bits(regmap, LTC2945_FAULT, attr->index, 0);
  316. return snprintf(buf, PAGE_SIZE, "%d\n", !!fault);
  317. }
  318. /* Input voltages */
  319. static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, ltc2945_show_value, NULL,
  320. LTC2945_VIN_H);
  321. static SENSOR_DEVICE_ATTR(in1_min, S_IRUGO | S_IWUSR, ltc2945_show_value,
  322. ltc2945_set_value, LTC2945_MIN_VIN_THRES_H);
  323. static SENSOR_DEVICE_ATTR(in1_max, S_IRUGO | S_IWUSR, ltc2945_show_value,
  324. ltc2945_set_value, LTC2945_MAX_VIN_THRES_H);
  325. static SENSOR_DEVICE_ATTR(in1_lowest, S_IRUGO, ltc2945_show_value, NULL,
  326. LTC2945_MIN_VIN_H);
  327. static SENSOR_DEVICE_ATTR(in1_highest, S_IRUGO, ltc2945_show_value, NULL,
  328. LTC2945_MAX_VIN_H);
  329. static SENSOR_DEVICE_ATTR(in1_reset_history, S_IWUSR, NULL,
  330. ltc2945_reset_history, LTC2945_MIN_VIN_H);
  331. static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, ltc2945_show_value, NULL,
  332. LTC2945_ADIN_H);
  333. static SENSOR_DEVICE_ATTR(in2_min, S_IRUGO | S_IWUSR, ltc2945_show_value,
  334. ltc2945_set_value, LTC2945_MIN_ADIN_THRES_H);
  335. static SENSOR_DEVICE_ATTR(in2_max, S_IRUGO | S_IWUSR, ltc2945_show_value,
  336. ltc2945_set_value, LTC2945_MAX_ADIN_THRES_H);
  337. static SENSOR_DEVICE_ATTR(in2_lowest, S_IRUGO, ltc2945_show_value, NULL,
  338. LTC2945_MIN_ADIN_H);
  339. static SENSOR_DEVICE_ATTR(in2_highest, S_IRUGO, ltc2945_show_value, NULL,
  340. LTC2945_MAX_ADIN_H);
  341. static SENSOR_DEVICE_ATTR(in2_reset_history, S_IWUSR, NULL,
  342. ltc2945_reset_history, LTC2945_MIN_ADIN_H);
  343. /* Voltage alarms */
  344. static SENSOR_DEVICE_ATTR(in1_min_alarm, S_IRUGO, ltc2945_show_bool, NULL,
  345. FAULT_VIN_UV);
  346. static SENSOR_DEVICE_ATTR(in1_max_alarm, S_IRUGO, ltc2945_show_bool, NULL,
  347. FAULT_VIN_OV);
  348. static SENSOR_DEVICE_ATTR(in2_min_alarm, S_IRUGO, ltc2945_show_bool, NULL,
  349. FAULT_ADIN_UV);
  350. static SENSOR_DEVICE_ATTR(in2_max_alarm, S_IRUGO, ltc2945_show_bool, NULL,
  351. FAULT_ADIN_OV);
  352. /* Currents (via sense resistor) */
  353. static SENSOR_DEVICE_ATTR(curr1_input, S_IRUGO, ltc2945_show_value, NULL,
  354. LTC2945_SENSE_H);
  355. static SENSOR_DEVICE_ATTR(curr1_min, S_IRUGO | S_IWUSR, ltc2945_show_value,
  356. ltc2945_set_value, LTC2945_MIN_SENSE_THRES_H);
  357. static SENSOR_DEVICE_ATTR(curr1_max, S_IRUGO | S_IWUSR, ltc2945_show_value,
  358. ltc2945_set_value, LTC2945_MAX_SENSE_THRES_H);
  359. static SENSOR_DEVICE_ATTR(curr1_lowest, S_IRUGO, ltc2945_show_value, NULL,
  360. LTC2945_MIN_SENSE_H);
  361. static SENSOR_DEVICE_ATTR(curr1_highest, S_IRUGO, ltc2945_show_value, NULL,
  362. LTC2945_MAX_SENSE_H);
  363. static SENSOR_DEVICE_ATTR(curr1_reset_history, S_IWUSR, NULL,
  364. ltc2945_reset_history, LTC2945_MIN_SENSE_H);
  365. /* Current alarms */
  366. static SENSOR_DEVICE_ATTR(curr1_min_alarm, S_IRUGO, ltc2945_show_bool, NULL,
  367. FAULT_SENSE_UV);
  368. static SENSOR_DEVICE_ATTR(curr1_max_alarm, S_IRUGO, ltc2945_show_bool, NULL,
  369. FAULT_SENSE_OV);
  370. /* Power */
  371. static SENSOR_DEVICE_ATTR(power1_input, S_IRUGO, ltc2945_show_value, NULL,
  372. LTC2945_POWER_H);
  373. static SENSOR_DEVICE_ATTR(power1_min, S_IRUGO | S_IWUSR, ltc2945_show_value,
  374. ltc2945_set_value, LTC2945_MIN_POWER_THRES_H);
  375. static SENSOR_DEVICE_ATTR(power1_max, S_IRUGO | S_IWUSR, ltc2945_show_value,
  376. ltc2945_set_value, LTC2945_MAX_POWER_THRES_H);
  377. static SENSOR_DEVICE_ATTR(power1_input_lowest, S_IRUGO, ltc2945_show_value,
  378. NULL, LTC2945_MIN_POWER_H);
  379. static SENSOR_DEVICE_ATTR(power1_input_highest, S_IRUGO, ltc2945_show_value,
  380. NULL, LTC2945_MAX_POWER_H);
  381. static SENSOR_DEVICE_ATTR(power1_reset_history, S_IWUSR, NULL,
  382. ltc2945_reset_history, LTC2945_MIN_POWER_H);
  383. /* Power alarms */
  384. static SENSOR_DEVICE_ATTR(power1_min_alarm, S_IRUGO, ltc2945_show_bool, NULL,
  385. FAULT_POWER_UV);
  386. static SENSOR_DEVICE_ATTR(power1_max_alarm, S_IRUGO, ltc2945_show_bool, NULL,
  387. FAULT_POWER_OV);
  388. static struct attribute *ltc2945_attrs[] = {
  389. &sensor_dev_attr_in1_input.dev_attr.attr,
  390. &sensor_dev_attr_in1_min.dev_attr.attr,
  391. &sensor_dev_attr_in1_max.dev_attr.attr,
  392. &sensor_dev_attr_in1_lowest.dev_attr.attr,
  393. &sensor_dev_attr_in1_highest.dev_attr.attr,
  394. &sensor_dev_attr_in1_reset_history.dev_attr.attr,
  395. &sensor_dev_attr_in1_min_alarm.dev_attr.attr,
  396. &sensor_dev_attr_in1_max_alarm.dev_attr.attr,
  397. &sensor_dev_attr_in2_input.dev_attr.attr,
  398. &sensor_dev_attr_in2_min.dev_attr.attr,
  399. &sensor_dev_attr_in2_max.dev_attr.attr,
  400. &sensor_dev_attr_in2_lowest.dev_attr.attr,
  401. &sensor_dev_attr_in2_highest.dev_attr.attr,
  402. &sensor_dev_attr_in2_reset_history.dev_attr.attr,
  403. &sensor_dev_attr_in2_min_alarm.dev_attr.attr,
  404. &sensor_dev_attr_in2_max_alarm.dev_attr.attr,
  405. &sensor_dev_attr_curr1_input.dev_attr.attr,
  406. &sensor_dev_attr_curr1_min.dev_attr.attr,
  407. &sensor_dev_attr_curr1_max.dev_attr.attr,
  408. &sensor_dev_attr_curr1_lowest.dev_attr.attr,
  409. &sensor_dev_attr_curr1_highest.dev_attr.attr,
  410. &sensor_dev_attr_curr1_reset_history.dev_attr.attr,
  411. &sensor_dev_attr_curr1_min_alarm.dev_attr.attr,
  412. &sensor_dev_attr_curr1_max_alarm.dev_attr.attr,
  413. &sensor_dev_attr_power1_input.dev_attr.attr,
  414. &sensor_dev_attr_power1_min.dev_attr.attr,
  415. &sensor_dev_attr_power1_max.dev_attr.attr,
  416. &sensor_dev_attr_power1_input_lowest.dev_attr.attr,
  417. &sensor_dev_attr_power1_input_highest.dev_attr.attr,
  418. &sensor_dev_attr_power1_reset_history.dev_attr.attr,
  419. &sensor_dev_attr_power1_min_alarm.dev_attr.attr,
  420. &sensor_dev_attr_power1_max_alarm.dev_attr.attr,
  421. NULL,
  422. };
  423. ATTRIBUTE_GROUPS(ltc2945);
  424. static const struct regmap_config ltc2945_regmap_config = {
  425. .reg_bits = 8,
  426. .val_bits = 8,
  427. .max_register = LTC2945_MIN_ADIN_THRES_L,
  428. };
  429. static int ltc2945_probe(struct i2c_client *client,
  430. const struct i2c_device_id *id)
  431. {
  432. struct device *dev = &client->dev;
  433. struct device *hwmon_dev;
  434. struct regmap *regmap;
  435. regmap = devm_regmap_init_i2c(client, &ltc2945_regmap_config);
  436. if (IS_ERR(regmap)) {
  437. dev_err(dev, "failed to allocate register map\n");
  438. return PTR_ERR(regmap);
  439. }
  440. /* Clear faults */
  441. regmap_write(regmap, LTC2945_FAULT, 0x00);
  442. hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name,
  443. regmap,
  444. ltc2945_groups);
  445. return PTR_ERR_OR_ZERO(hwmon_dev);
  446. }
  447. static const struct i2c_device_id ltc2945_id[] = {
  448. {"ltc2945", 0},
  449. { }
  450. };
  451. MODULE_DEVICE_TABLE(i2c, ltc2945_id);
  452. static struct i2c_driver ltc2945_driver = {
  453. .driver = {
  454. .name = "ltc2945",
  455. },
  456. .probe = ltc2945_probe,
  457. .id_table = ltc2945_id,
  458. };
  459. module_i2c_driver(ltc2945_driver);
  460. MODULE_AUTHOR("Guenter Roeck <linux@roeck-us.net>");
  461. MODULE_DESCRIPTION("LTC2945 driver");
  462. MODULE_LICENSE("GPL");