tps6524x-regulator.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641
  1. /*
  2. * Regulator driver for TPS6524x PMIC
  3. *
  4. * Copyright (C) 2010 Texas Instruments
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License as
  8. * published by the Free Software Foundation version 2.
  9. *
  10. * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
  11. * whether express or implied; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * General Public License for more details.
  14. */
  15. #include <linux/kernel.h>
  16. #include <linux/module.h>
  17. #include <linux/err.h>
  18. #include <linux/errno.h>
  19. #include <linux/slab.h>
  20. #include <linux/spi/spi.h>
  21. #include <linux/regulator/driver.h>
  22. #include <linux/regulator/machine.h>
  23. #define REG_LDO_SET 0x0
  24. #define LDO_ILIM_MASK 1 /* 0 = 400-800, 1 = 900-1500 */
  25. #define LDO_VSEL_MASK 0x0f
  26. #define LDO2_ILIM_SHIFT 12
  27. #define LDO2_VSEL_SHIFT 4
  28. #define LDO1_ILIM_SHIFT 8
  29. #define LDO1_VSEL_SHIFT 0
  30. #define REG_BLOCK_EN 0x1
  31. #define BLOCK_MASK 1
  32. #define BLOCK_LDO1_SHIFT 0
  33. #define BLOCK_LDO2_SHIFT 1
  34. #define BLOCK_LCD_SHIFT 2
  35. #define BLOCK_USB_SHIFT 3
  36. #define REG_DCDC_SET 0x2
  37. #define DCDC_VDCDC_MASK 0x1f
  38. #define DCDC_VDCDC1_SHIFT 0
  39. #define DCDC_VDCDC2_SHIFT 5
  40. #define DCDC_VDCDC3_SHIFT 10
  41. #define REG_DCDC_EN 0x3
  42. #define DCDCDCDC_EN_MASK 0x1
  43. #define DCDCDCDC1_EN_SHIFT 0
  44. #define DCDCDCDC1_PG_MSK BIT(1)
  45. #define DCDCDCDC2_EN_SHIFT 2
  46. #define DCDCDCDC2_PG_MSK BIT(3)
  47. #define DCDCDCDC3_EN_SHIFT 4
  48. #define DCDCDCDC3_PG_MSK BIT(5)
  49. #define REG_USB 0x4
  50. #define USB_ILIM_SHIFT 0
  51. #define USB_ILIM_MASK 0x3
  52. #define USB_TSD_SHIFT 2
  53. #define USB_TSD_MASK 0x3
  54. #define USB_TWARN_SHIFT 4
  55. #define USB_TWARN_MASK 0x3
  56. #define USB_IWARN_SD BIT(6)
  57. #define USB_FAST_LOOP BIT(7)
  58. #define REG_ALARM 0x5
  59. #define ALARM_LDO1 BIT(0)
  60. #define ALARM_DCDC1 BIT(1)
  61. #define ALARM_DCDC2 BIT(2)
  62. #define ALARM_DCDC3 BIT(3)
  63. #define ALARM_LDO2 BIT(4)
  64. #define ALARM_USB_WARN BIT(5)
  65. #define ALARM_USB_ALARM BIT(6)
  66. #define ALARM_LCD BIT(9)
  67. #define ALARM_TEMP_WARM BIT(10)
  68. #define ALARM_TEMP_HOT BIT(11)
  69. #define ALARM_NRST BIT(14)
  70. #define ALARM_POWERUP BIT(15)
  71. #define REG_INT_ENABLE 0x6
  72. #define INT_LDO1 BIT(0)
  73. #define INT_DCDC1 BIT(1)
  74. #define INT_DCDC2 BIT(2)
  75. #define INT_DCDC3 BIT(3)
  76. #define INT_LDO2 BIT(4)
  77. #define INT_USB_WARN BIT(5)
  78. #define INT_USB_ALARM BIT(6)
  79. #define INT_LCD BIT(9)
  80. #define INT_TEMP_WARM BIT(10)
  81. #define INT_TEMP_HOT BIT(11)
  82. #define INT_GLOBAL_EN BIT(15)
  83. #define REG_INT_STATUS 0x7
  84. #define STATUS_LDO1 BIT(0)
  85. #define STATUS_DCDC1 BIT(1)
  86. #define STATUS_DCDC2 BIT(2)
  87. #define STATUS_DCDC3 BIT(3)
  88. #define STATUS_LDO2 BIT(4)
  89. #define STATUS_USB_WARN BIT(5)
  90. #define STATUS_USB_ALARM BIT(6)
  91. #define STATUS_LCD BIT(9)
  92. #define STATUS_TEMP_WARM BIT(10)
  93. #define STATUS_TEMP_HOT BIT(11)
  94. #define REG_SOFTWARE_RESET 0xb
  95. #define REG_WRITE_ENABLE 0xd
  96. #define REG_REV_ID 0xf
  97. #define N_DCDC 3
  98. #define N_LDO 2
  99. #define N_SWITCH 2
  100. #define N_REGULATORS (N_DCDC + N_LDO + N_SWITCH)
  101. #define CMD_READ(reg) ((reg) << 6)
  102. #define CMD_WRITE(reg) (BIT(5) | (reg) << 6)
  103. #define STAT_CLK BIT(3)
  104. #define STAT_WRITE BIT(2)
  105. #define STAT_INVALID BIT(1)
  106. #define STAT_WP BIT(0)
  107. struct field {
  108. int reg;
  109. int shift;
  110. int mask;
  111. };
  112. struct supply_info {
  113. const char *name;
  114. int n_voltages;
  115. const unsigned int *voltages;
  116. int n_ilimsels;
  117. const unsigned int *ilimsels;
  118. struct field enable, voltage, ilimsel;
  119. };
  120. struct tps6524x {
  121. struct device *dev;
  122. struct spi_device *spi;
  123. struct mutex lock;
  124. struct regulator_desc desc[N_REGULATORS];
  125. struct regulator_dev *rdev[N_REGULATORS];
  126. };
  127. static int __read_reg(struct tps6524x *hw, int reg)
  128. {
  129. int error = 0;
  130. u16 cmd = CMD_READ(reg), in;
  131. u8 status;
  132. struct spi_message m;
  133. struct spi_transfer t[3];
  134. spi_message_init(&m);
  135. memset(t, 0, sizeof(t));
  136. t[0].tx_buf = &cmd;
  137. t[0].len = 2;
  138. t[0].bits_per_word = 12;
  139. spi_message_add_tail(&t[0], &m);
  140. t[1].rx_buf = &in;
  141. t[1].len = 2;
  142. t[1].bits_per_word = 16;
  143. spi_message_add_tail(&t[1], &m);
  144. t[2].rx_buf = &status;
  145. t[2].len = 1;
  146. t[2].bits_per_word = 4;
  147. spi_message_add_tail(&t[2], &m);
  148. error = spi_sync(hw->spi, &m);
  149. if (error < 0)
  150. return error;
  151. dev_dbg(hw->dev, "read reg %d, data %x, status %x\n",
  152. reg, in, status);
  153. if (!(status & STAT_CLK) || (status & STAT_WRITE))
  154. return -EIO;
  155. if (status & STAT_INVALID)
  156. return -EINVAL;
  157. return in;
  158. }
  159. static int read_reg(struct tps6524x *hw, int reg)
  160. {
  161. int ret;
  162. mutex_lock(&hw->lock);
  163. ret = __read_reg(hw, reg);
  164. mutex_unlock(&hw->lock);
  165. return ret;
  166. }
  167. static int __write_reg(struct tps6524x *hw, int reg, int val)
  168. {
  169. int error = 0;
  170. u16 cmd = CMD_WRITE(reg), out = val;
  171. u8 status;
  172. struct spi_message m;
  173. struct spi_transfer t[3];
  174. spi_message_init(&m);
  175. memset(t, 0, sizeof(t));
  176. t[0].tx_buf = &cmd;
  177. t[0].len = 2;
  178. t[0].bits_per_word = 12;
  179. spi_message_add_tail(&t[0], &m);
  180. t[1].tx_buf = &out;
  181. t[1].len = 2;
  182. t[1].bits_per_word = 16;
  183. spi_message_add_tail(&t[1], &m);
  184. t[2].rx_buf = &status;
  185. t[2].len = 1;
  186. t[2].bits_per_word = 4;
  187. spi_message_add_tail(&t[2], &m);
  188. error = spi_sync(hw->spi, &m);
  189. if (error < 0)
  190. return error;
  191. dev_dbg(hw->dev, "wrote reg %d, data %x, status %x\n",
  192. reg, out, status);
  193. if (!(status & STAT_CLK) || !(status & STAT_WRITE))
  194. return -EIO;
  195. if (status & (STAT_INVALID | STAT_WP))
  196. return -EINVAL;
  197. return error;
  198. }
  199. static int __rmw_reg(struct tps6524x *hw, int reg, int mask, int val)
  200. {
  201. int ret;
  202. ret = __read_reg(hw, reg);
  203. if (ret < 0)
  204. return ret;
  205. ret &= ~mask;
  206. ret |= val;
  207. ret = __write_reg(hw, reg, ret);
  208. return (ret < 0) ? ret : 0;
  209. }
  210. static int rmw_protect(struct tps6524x *hw, int reg, int mask, int val)
  211. {
  212. int ret;
  213. mutex_lock(&hw->lock);
  214. ret = __write_reg(hw, REG_WRITE_ENABLE, 1);
  215. if (ret) {
  216. dev_err(hw->dev, "failed to set write enable\n");
  217. goto error;
  218. }
  219. ret = __rmw_reg(hw, reg, mask, val);
  220. if (ret)
  221. dev_err(hw->dev, "failed to rmw register %d\n", reg);
  222. ret = __write_reg(hw, REG_WRITE_ENABLE, 0);
  223. if (ret) {
  224. dev_err(hw->dev, "failed to clear write enable\n");
  225. goto error;
  226. }
  227. error:
  228. mutex_unlock(&hw->lock);
  229. return ret;
  230. }
  231. static int read_field(struct tps6524x *hw, const struct field *field)
  232. {
  233. int tmp;
  234. tmp = read_reg(hw, field->reg);
  235. if (tmp < 0)
  236. return tmp;
  237. return (tmp >> field->shift) & field->mask;
  238. }
  239. static int write_field(struct tps6524x *hw, const struct field *field,
  240. int val)
  241. {
  242. if (val & ~field->mask)
  243. return -EOVERFLOW;
  244. return rmw_protect(hw, field->reg,
  245. field->mask << field->shift,
  246. val << field->shift);
  247. }
  248. static const unsigned int dcdc1_voltages[] = {
  249. 800000, 825000, 850000, 875000,
  250. 900000, 925000, 950000, 975000,
  251. 1000000, 1025000, 1050000, 1075000,
  252. 1100000, 1125000, 1150000, 1175000,
  253. 1200000, 1225000, 1250000, 1275000,
  254. 1300000, 1325000, 1350000, 1375000,
  255. 1400000, 1425000, 1450000, 1475000,
  256. 1500000, 1525000, 1550000, 1575000,
  257. };
  258. static const unsigned int dcdc2_voltages[] = {
  259. 1400000, 1450000, 1500000, 1550000,
  260. 1600000, 1650000, 1700000, 1750000,
  261. 1800000, 1850000, 1900000, 1950000,
  262. 2000000, 2050000, 2100000, 2150000,
  263. 2200000, 2250000, 2300000, 2350000,
  264. 2400000, 2450000, 2500000, 2550000,
  265. 2600000, 2650000, 2700000, 2750000,
  266. 2800000, 2850000, 2900000, 2950000,
  267. };
  268. static const unsigned int dcdc3_voltages[] = {
  269. 2400000, 2450000, 2500000, 2550000, 2600000,
  270. 2650000, 2700000, 2750000, 2800000, 2850000,
  271. 2900000, 2950000, 3000000, 3050000, 3100000,
  272. 3150000, 3200000, 3250000, 3300000, 3350000,
  273. 3400000, 3450000, 3500000, 3550000, 3600000,
  274. };
  275. static const unsigned int ldo1_voltages[] = {
  276. 4300000, 4350000, 4400000, 4450000,
  277. 4500000, 4550000, 4600000, 4650000,
  278. 4700000, 4750000, 4800000, 4850000,
  279. 4900000, 4950000, 5000000, 5050000,
  280. };
  281. static const unsigned int ldo2_voltages[] = {
  282. 1100000, 1150000, 1200000, 1250000,
  283. 1300000, 1700000, 1750000, 1800000,
  284. 1850000, 1900000, 3150000, 3200000,
  285. 3250000, 3300000, 3350000, 3400000,
  286. };
  287. static const unsigned int fixed_5000000_voltage[] = {
  288. 5000000
  289. };
  290. static const unsigned int ldo_ilimsel[] = {
  291. 400000, 1500000
  292. };
  293. static const unsigned int usb_ilimsel[] = {
  294. 200000, 400000, 800000, 1000000
  295. };
  296. static const unsigned int fixed_2400000_ilimsel[] = {
  297. 2400000
  298. };
  299. static const unsigned int fixed_1200000_ilimsel[] = {
  300. 1200000
  301. };
  302. static const unsigned int fixed_400000_ilimsel[] = {
  303. 400000
  304. };
  305. #define __MK_FIELD(_reg, _mask, _shift) \
  306. { .reg = (_reg), .mask = (_mask), .shift = (_shift), }
  307. static const struct supply_info supply_info[N_REGULATORS] = {
  308. {
  309. .name = "DCDC1",
  310. .n_voltages = ARRAY_SIZE(dcdc1_voltages),
  311. .voltages = dcdc1_voltages,
  312. .n_ilimsels = ARRAY_SIZE(fixed_2400000_ilimsel),
  313. .ilimsels = fixed_2400000_ilimsel,
  314. .enable = __MK_FIELD(REG_DCDC_EN, DCDCDCDC_EN_MASK,
  315. DCDCDCDC1_EN_SHIFT),
  316. .voltage = __MK_FIELD(REG_DCDC_SET, DCDC_VDCDC_MASK,
  317. DCDC_VDCDC1_SHIFT),
  318. },
  319. {
  320. .name = "DCDC2",
  321. .n_voltages = ARRAY_SIZE(dcdc2_voltages),
  322. .voltages = dcdc2_voltages,
  323. .n_ilimsels = ARRAY_SIZE(fixed_1200000_ilimsel),
  324. .ilimsels = fixed_1200000_ilimsel,
  325. .enable = __MK_FIELD(REG_DCDC_EN, DCDCDCDC_EN_MASK,
  326. DCDCDCDC2_EN_SHIFT),
  327. .voltage = __MK_FIELD(REG_DCDC_SET, DCDC_VDCDC_MASK,
  328. DCDC_VDCDC2_SHIFT),
  329. },
  330. {
  331. .name = "DCDC3",
  332. .n_voltages = ARRAY_SIZE(dcdc3_voltages),
  333. .voltages = dcdc3_voltages,
  334. .n_ilimsels = ARRAY_SIZE(fixed_1200000_ilimsel),
  335. .ilimsels = fixed_1200000_ilimsel,
  336. .enable = __MK_FIELD(REG_DCDC_EN, DCDCDCDC_EN_MASK,
  337. DCDCDCDC3_EN_SHIFT),
  338. .voltage = __MK_FIELD(REG_DCDC_SET, DCDC_VDCDC_MASK,
  339. DCDC_VDCDC3_SHIFT),
  340. },
  341. {
  342. .name = "LDO1",
  343. .n_voltages = ARRAY_SIZE(ldo1_voltages),
  344. .voltages = ldo1_voltages,
  345. .n_ilimsels = ARRAY_SIZE(ldo_ilimsel),
  346. .ilimsels = ldo_ilimsel,
  347. .enable = __MK_FIELD(REG_BLOCK_EN, BLOCK_MASK,
  348. BLOCK_LDO1_SHIFT),
  349. .voltage = __MK_FIELD(REG_LDO_SET, LDO_VSEL_MASK,
  350. LDO1_VSEL_SHIFT),
  351. .ilimsel = __MK_FIELD(REG_LDO_SET, LDO_ILIM_MASK,
  352. LDO1_ILIM_SHIFT),
  353. },
  354. {
  355. .name = "LDO2",
  356. .n_voltages = ARRAY_SIZE(ldo2_voltages),
  357. .voltages = ldo2_voltages,
  358. .n_ilimsels = ARRAY_SIZE(ldo_ilimsel),
  359. .ilimsels = ldo_ilimsel,
  360. .enable = __MK_FIELD(REG_BLOCK_EN, BLOCK_MASK,
  361. BLOCK_LDO2_SHIFT),
  362. .voltage = __MK_FIELD(REG_LDO_SET, LDO_VSEL_MASK,
  363. LDO2_VSEL_SHIFT),
  364. .ilimsel = __MK_FIELD(REG_LDO_SET, LDO_ILIM_MASK,
  365. LDO2_ILIM_SHIFT),
  366. },
  367. {
  368. .name = "USB",
  369. .n_voltages = ARRAY_SIZE(fixed_5000000_voltage),
  370. .voltages = fixed_5000000_voltage,
  371. .n_ilimsels = ARRAY_SIZE(usb_ilimsel),
  372. .ilimsels = usb_ilimsel,
  373. .enable = __MK_FIELD(REG_BLOCK_EN, BLOCK_MASK,
  374. BLOCK_USB_SHIFT),
  375. .ilimsel = __MK_FIELD(REG_USB, USB_ILIM_MASK,
  376. USB_ILIM_SHIFT),
  377. },
  378. {
  379. .name = "LCD",
  380. .n_voltages = ARRAY_SIZE(fixed_5000000_voltage),
  381. .voltages = fixed_5000000_voltage,
  382. .n_ilimsels = ARRAY_SIZE(fixed_400000_ilimsel),
  383. .ilimsels = fixed_400000_ilimsel,
  384. .enable = __MK_FIELD(REG_BLOCK_EN, BLOCK_MASK,
  385. BLOCK_LCD_SHIFT),
  386. },
  387. };
  388. static int set_voltage_sel(struct regulator_dev *rdev, unsigned selector)
  389. {
  390. const struct supply_info *info;
  391. struct tps6524x *hw;
  392. hw = rdev_get_drvdata(rdev);
  393. info = &supply_info[rdev_get_id(rdev)];
  394. if (rdev->desc->n_voltages == 1)
  395. return -EINVAL;
  396. return write_field(hw, &info->voltage, selector);
  397. }
  398. static int get_voltage_sel(struct regulator_dev *rdev)
  399. {
  400. const struct supply_info *info;
  401. struct tps6524x *hw;
  402. int ret;
  403. hw = rdev_get_drvdata(rdev);
  404. info = &supply_info[rdev_get_id(rdev)];
  405. if (rdev->desc->n_voltages == 1)
  406. return 0;
  407. ret = read_field(hw, &info->voltage);
  408. if (ret < 0)
  409. return ret;
  410. if (WARN_ON(ret >= info->n_voltages))
  411. return -EIO;
  412. return ret;
  413. }
  414. static int set_current_limit(struct regulator_dev *rdev, int min_uA,
  415. int max_uA)
  416. {
  417. const struct supply_info *info;
  418. struct tps6524x *hw;
  419. int i;
  420. hw = rdev_get_drvdata(rdev);
  421. info = &supply_info[rdev_get_id(rdev)];
  422. if (info->n_ilimsels == 1)
  423. return -EINVAL;
  424. for (i = info->n_ilimsels - 1; i >= 0; i--) {
  425. if (min_uA <= info->ilimsels[i] &&
  426. max_uA >= info->ilimsels[i])
  427. return write_field(hw, &info->ilimsel, i);
  428. }
  429. return -EINVAL;
  430. }
  431. static int get_current_limit(struct regulator_dev *rdev)
  432. {
  433. const struct supply_info *info;
  434. struct tps6524x *hw;
  435. int ret;
  436. hw = rdev_get_drvdata(rdev);
  437. info = &supply_info[rdev_get_id(rdev)];
  438. if (info->n_ilimsels == 1)
  439. return info->ilimsels[0];
  440. ret = read_field(hw, &info->ilimsel);
  441. if (ret < 0)
  442. return ret;
  443. if (WARN_ON(ret >= info->n_ilimsels))
  444. return -EIO;
  445. return info->ilimsels[ret];
  446. }
  447. static int enable_supply(struct regulator_dev *rdev)
  448. {
  449. const struct supply_info *info;
  450. struct tps6524x *hw;
  451. hw = rdev_get_drvdata(rdev);
  452. info = &supply_info[rdev_get_id(rdev)];
  453. return write_field(hw, &info->enable, 1);
  454. }
  455. static int disable_supply(struct regulator_dev *rdev)
  456. {
  457. const struct supply_info *info;
  458. struct tps6524x *hw;
  459. hw = rdev_get_drvdata(rdev);
  460. info = &supply_info[rdev_get_id(rdev)];
  461. return write_field(hw, &info->enable, 0);
  462. }
  463. static int is_supply_enabled(struct regulator_dev *rdev)
  464. {
  465. const struct supply_info *info;
  466. struct tps6524x *hw;
  467. hw = rdev_get_drvdata(rdev);
  468. info = &supply_info[rdev_get_id(rdev)];
  469. return read_field(hw, &info->enable);
  470. }
  471. static struct regulator_ops regulator_ops = {
  472. .is_enabled = is_supply_enabled,
  473. .enable = enable_supply,
  474. .disable = disable_supply,
  475. .get_voltage_sel = get_voltage_sel,
  476. .set_voltage_sel = set_voltage_sel,
  477. .list_voltage = regulator_list_voltage_table,
  478. .map_voltage = regulator_map_voltage_ascend,
  479. .set_current_limit = set_current_limit,
  480. .get_current_limit = get_current_limit,
  481. };
  482. static int pmic_probe(struct spi_device *spi)
  483. {
  484. struct tps6524x *hw;
  485. struct device *dev = &spi->dev;
  486. const struct supply_info *info = supply_info;
  487. struct regulator_init_data *init_data;
  488. struct regulator_config config = { };
  489. int i;
  490. init_data = dev_get_platdata(dev);
  491. if (!init_data) {
  492. dev_err(dev, "could not find regulator platform data\n");
  493. return -EINVAL;
  494. }
  495. hw = devm_kzalloc(&spi->dev, sizeof(struct tps6524x), GFP_KERNEL);
  496. if (!hw)
  497. return -ENOMEM;
  498. spi_set_drvdata(spi, hw);
  499. memset(hw, 0, sizeof(struct tps6524x));
  500. hw->dev = dev;
  501. hw->spi = spi;
  502. mutex_init(&hw->lock);
  503. for (i = 0; i < N_REGULATORS; i++, info++, init_data++) {
  504. hw->desc[i].name = info->name;
  505. hw->desc[i].id = i;
  506. hw->desc[i].n_voltages = info->n_voltages;
  507. hw->desc[i].volt_table = info->voltages;
  508. hw->desc[i].ops = &regulator_ops;
  509. hw->desc[i].type = REGULATOR_VOLTAGE;
  510. hw->desc[i].owner = THIS_MODULE;
  511. config.dev = dev;
  512. config.init_data = init_data;
  513. config.driver_data = hw;
  514. hw->rdev[i] = devm_regulator_register(dev, &hw->desc[i],
  515. &config);
  516. if (IS_ERR(hw->rdev[i]))
  517. return PTR_ERR(hw->rdev[i]);
  518. }
  519. return 0;
  520. }
  521. static struct spi_driver pmic_driver = {
  522. .probe = pmic_probe,
  523. .driver = {
  524. .name = "tps6524x",
  525. },
  526. };
  527. module_spi_driver(pmic_driver);
  528. MODULE_DESCRIPTION("TPS6524X PMIC Driver");
  529. MODULE_AUTHOR("Cyril Chemparathy");
  530. MODULE_LICENSE("GPL");
  531. MODULE_ALIAS("spi:tps6524x");