ab3100.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687
  1. /*
  2. * drivers/regulator/ab3100.c
  3. *
  4. * Copyright (C) 2008-2009 ST-Ericsson AB
  5. * License terms: GNU General Public License (GPL) version 2
  6. * Low-level control of the AB3100 IC Low Dropout (LDO)
  7. * regulators, external regulator and buck converter
  8. * Author: Mattias Wallin <mattias.wallin@stericsson.com>
  9. * Author: Linus Walleij <linus.walleij@stericsson.com>
  10. */
  11. #include <linux/module.h>
  12. #include <linux/kernel.h>
  13. #include <linux/init.h>
  14. #include <linux/err.h>
  15. #include <linux/delay.h>
  16. #include <linux/platform_device.h>
  17. #include <linux/regulator/driver.h>
  18. #include <linux/mfd/abx500.h>
  19. /* LDO registers and some handy masking definitions for AB3100 */
  20. #define AB3100_LDO_A 0x40
  21. #define AB3100_LDO_C 0x41
  22. #define AB3100_LDO_D 0x42
  23. #define AB3100_LDO_E 0x43
  24. #define AB3100_LDO_E_SLEEP 0x44
  25. #define AB3100_LDO_F 0x45
  26. #define AB3100_LDO_G 0x46
  27. #define AB3100_LDO_H 0x47
  28. #define AB3100_LDO_H_SLEEP_MODE 0
  29. #define AB3100_LDO_H_SLEEP_EN 2
  30. #define AB3100_LDO_ON 4
  31. #define AB3100_LDO_H_VSEL_AC 5
  32. #define AB3100_LDO_K 0x48
  33. #define AB3100_LDO_EXT 0x49
  34. #define AB3100_BUCK 0x4A
  35. #define AB3100_BUCK_SLEEP 0x4B
  36. #define AB3100_REG_ON_MASK 0x10
  37. /**
  38. * struct ab3100_regulator
  39. * A struct passed around the individual regulator functions
  40. * @platform_device: platform device holding this regulator
  41. * @dev: handle to the device
  42. * @plfdata: AB3100 platform data passed in at probe time
  43. * @regreg: regulator register number in the AB3100
  44. * @fixed_voltage: a fixed voltage for this regulator, if this
  45. * 0 the voltages array is used instead.
  46. * @typ_voltages: an array of available typical voltages for
  47. * this regulator
  48. * @voltages_len: length of the array of available voltages
  49. */
  50. struct ab3100_regulator {
  51. struct regulator_dev *rdev;
  52. struct device *dev;
  53. struct ab3100_platform_data *plfdata;
  54. u8 regreg;
  55. int fixed_voltage;
  56. int const *typ_voltages;
  57. u8 voltages_len;
  58. };
  59. /* The order in which registers are initialized */
  60. static const u8 ab3100_reg_init_order[AB3100_NUM_REGULATORS+2] = {
  61. AB3100_LDO_A,
  62. AB3100_LDO_C,
  63. AB3100_LDO_E,
  64. AB3100_LDO_E_SLEEP,
  65. AB3100_LDO_F,
  66. AB3100_LDO_G,
  67. AB3100_LDO_H,
  68. AB3100_LDO_K,
  69. AB3100_LDO_EXT,
  70. AB3100_BUCK,
  71. AB3100_BUCK_SLEEP,
  72. AB3100_LDO_D,
  73. };
  74. /* Preset (hardware defined) voltages for these regulators */
  75. #define LDO_A_VOLTAGE 2750000
  76. #define LDO_C_VOLTAGE 2650000
  77. #define LDO_D_VOLTAGE 2650000
  78. static const int ldo_e_buck_typ_voltages[] = {
  79. 1800000,
  80. 1400000,
  81. 1300000,
  82. 1200000,
  83. 1100000,
  84. 1050000,
  85. 900000,
  86. };
  87. static const int ldo_f_typ_voltages[] = {
  88. 1800000,
  89. 1400000,
  90. 1300000,
  91. 1200000,
  92. 1100000,
  93. 1050000,
  94. 2500000,
  95. 2650000,
  96. };
  97. static const int ldo_g_typ_voltages[] = {
  98. 2850000,
  99. 2750000,
  100. 1800000,
  101. 1500000,
  102. };
  103. static const int ldo_h_typ_voltages[] = {
  104. 2750000,
  105. 1800000,
  106. 1500000,
  107. 1200000,
  108. };
  109. static const int ldo_k_typ_voltages[] = {
  110. 2750000,
  111. 1800000,
  112. };
  113. /* The regulator devices */
  114. static struct ab3100_regulator
  115. ab3100_regulators[AB3100_NUM_REGULATORS] = {
  116. {
  117. .regreg = AB3100_LDO_A,
  118. .fixed_voltage = LDO_A_VOLTAGE,
  119. },
  120. {
  121. .regreg = AB3100_LDO_C,
  122. .fixed_voltage = LDO_C_VOLTAGE,
  123. },
  124. {
  125. .regreg = AB3100_LDO_D,
  126. .fixed_voltage = LDO_D_VOLTAGE,
  127. },
  128. {
  129. .regreg = AB3100_LDO_E,
  130. .typ_voltages = ldo_e_buck_typ_voltages,
  131. .voltages_len = ARRAY_SIZE(ldo_e_buck_typ_voltages),
  132. },
  133. {
  134. .regreg = AB3100_LDO_F,
  135. .typ_voltages = ldo_f_typ_voltages,
  136. .voltages_len = ARRAY_SIZE(ldo_f_typ_voltages),
  137. },
  138. {
  139. .regreg = AB3100_LDO_G,
  140. .typ_voltages = ldo_g_typ_voltages,
  141. .voltages_len = ARRAY_SIZE(ldo_g_typ_voltages),
  142. },
  143. {
  144. .regreg = AB3100_LDO_H,
  145. .typ_voltages = ldo_h_typ_voltages,
  146. .voltages_len = ARRAY_SIZE(ldo_h_typ_voltages),
  147. },
  148. {
  149. .regreg = AB3100_LDO_K,
  150. .typ_voltages = ldo_k_typ_voltages,
  151. .voltages_len = ARRAY_SIZE(ldo_k_typ_voltages),
  152. },
  153. {
  154. .regreg = AB3100_LDO_EXT,
  155. /* No voltages for the external regulator */
  156. },
  157. {
  158. .regreg = AB3100_BUCK,
  159. .typ_voltages = ldo_e_buck_typ_voltages,
  160. .voltages_len = ARRAY_SIZE(ldo_e_buck_typ_voltages),
  161. },
  162. };
  163. /*
  164. * General functions for enable, disable and is_enabled used for
  165. * LDO: A,C,E,F,G,H,K,EXT and BUCK
  166. */
  167. static int ab3100_enable_regulator(struct regulator_dev *reg)
  168. {
  169. struct ab3100_regulator *abreg = reg->reg_data;
  170. int err;
  171. u8 regval;
  172. err = abx500_get_register_interruptible(abreg->dev, 0, abreg->regreg,
  173. &regval);
  174. if (err) {
  175. dev_warn(&reg->dev, "failed to get regid %d value\n",
  176. abreg->regreg);
  177. return err;
  178. }
  179. /* The regulator is already on, no reason to go further */
  180. if (regval & AB3100_REG_ON_MASK)
  181. return 0;
  182. regval |= AB3100_REG_ON_MASK;
  183. err = abx500_set_register_interruptible(abreg->dev, 0, abreg->regreg,
  184. regval);
  185. if (err) {
  186. dev_warn(&reg->dev, "failed to set regid %d value\n",
  187. abreg->regreg);
  188. return err;
  189. }
  190. /* Per-regulator power on delay from spec */
  191. switch (abreg->regreg) {
  192. case AB3100_LDO_A: /* Fallthrough */
  193. case AB3100_LDO_C: /* Fallthrough */
  194. case AB3100_LDO_D: /* Fallthrough */
  195. case AB3100_LDO_E: /* Fallthrough */
  196. case AB3100_LDO_H: /* Fallthrough */
  197. case AB3100_LDO_K:
  198. udelay(200);
  199. break;
  200. case AB3100_LDO_F:
  201. udelay(600);
  202. break;
  203. case AB3100_LDO_G:
  204. udelay(400);
  205. break;
  206. case AB3100_BUCK:
  207. mdelay(1);
  208. break;
  209. default:
  210. break;
  211. }
  212. return 0;
  213. }
  214. static int ab3100_disable_regulator(struct regulator_dev *reg)
  215. {
  216. struct ab3100_regulator *abreg = reg->reg_data;
  217. int err;
  218. u8 regval;
  219. /*
  220. * LDO D is a special regulator. When it is disabled, the entire
  221. * system is shut down. So this is handled specially.
  222. */
  223. pr_info("Called ab3100_disable_regulator\n");
  224. if (abreg->regreg == AB3100_LDO_D) {
  225. dev_info(&reg->dev, "disabling LDO D - shut down system\n");
  226. /* Setting LDO D to 0x00 cuts the power to the SoC */
  227. return abx500_set_register_interruptible(abreg->dev, 0,
  228. AB3100_LDO_D, 0x00U);
  229. }
  230. /*
  231. * All other regulators are handled here
  232. */
  233. err = abx500_get_register_interruptible(abreg->dev, 0, abreg->regreg,
  234. &regval);
  235. if (err) {
  236. dev_err(&reg->dev, "unable to get register 0x%x\n",
  237. abreg->regreg);
  238. return err;
  239. }
  240. regval &= ~AB3100_REG_ON_MASK;
  241. return abx500_set_register_interruptible(abreg->dev, 0, abreg->regreg,
  242. regval);
  243. }
  244. static int ab3100_is_enabled_regulator(struct regulator_dev *reg)
  245. {
  246. struct ab3100_regulator *abreg = reg->reg_data;
  247. u8 regval;
  248. int err;
  249. err = abx500_get_register_interruptible(abreg->dev, 0, abreg->regreg,
  250. &regval);
  251. if (err) {
  252. dev_err(&reg->dev, "unable to get register 0x%x\n",
  253. abreg->regreg);
  254. return err;
  255. }
  256. return regval & AB3100_REG_ON_MASK;
  257. }
  258. static int ab3100_list_voltage_regulator(struct regulator_dev *reg,
  259. unsigned selector)
  260. {
  261. struct ab3100_regulator *abreg = reg->reg_data;
  262. if (selector >= abreg->voltages_len)
  263. return -EINVAL;
  264. return abreg->typ_voltages[selector];
  265. }
  266. static int ab3100_get_voltage_regulator(struct regulator_dev *reg)
  267. {
  268. struct ab3100_regulator *abreg = reg->reg_data;
  269. u8 regval;
  270. int err;
  271. /* Return the voltage for fixed regulators immediately */
  272. if (abreg->fixed_voltage)
  273. return abreg->fixed_voltage;
  274. /*
  275. * For variable types, read out setting and index into
  276. * supplied voltage list.
  277. */
  278. err = abx500_get_register_interruptible(abreg->dev, 0,
  279. abreg->regreg, &regval);
  280. if (err) {
  281. dev_warn(&reg->dev,
  282. "failed to get regulator value in register %02x\n",
  283. abreg->regreg);
  284. return err;
  285. }
  286. /* The 3 highest bits index voltages */
  287. regval &= 0xE0;
  288. regval >>= 5;
  289. if (regval >= abreg->voltages_len) {
  290. dev_err(&reg->dev,
  291. "regulator register %02x contains an illegal voltage setting\n",
  292. abreg->regreg);
  293. return -EINVAL;
  294. }
  295. return abreg->typ_voltages[regval];
  296. }
  297. static int ab3100_get_best_voltage_index(struct regulator_dev *reg,
  298. int min_uV, int max_uV)
  299. {
  300. struct ab3100_regulator *abreg = reg->reg_data;
  301. int i;
  302. int bestmatch;
  303. int bestindex;
  304. /*
  305. * Locate the minimum voltage fitting the criteria on
  306. * this regulator. The switchable voltages are not
  307. * in strict falling order so we need to check them
  308. * all for the best match.
  309. */
  310. bestmatch = INT_MAX;
  311. bestindex = -1;
  312. for (i = 0; i < abreg->voltages_len; i++) {
  313. if (abreg->typ_voltages[i] <= max_uV &&
  314. abreg->typ_voltages[i] >= min_uV &&
  315. abreg->typ_voltages[i] < bestmatch) {
  316. bestmatch = abreg->typ_voltages[i];
  317. bestindex = i;
  318. }
  319. }
  320. if (bestindex < 0) {
  321. dev_warn(&reg->dev, "requested %d<=x<=%d uV, out of range!\n",
  322. min_uV, max_uV);
  323. return -EINVAL;
  324. }
  325. return bestindex;
  326. }
  327. static int ab3100_set_voltage_regulator(struct regulator_dev *reg,
  328. int min_uV, int max_uV)
  329. {
  330. struct ab3100_regulator *abreg = reg->reg_data;
  331. u8 regval;
  332. int err;
  333. int bestindex;
  334. bestindex = ab3100_get_best_voltage_index(reg, min_uV, max_uV);
  335. if (bestindex < 0)
  336. return bestindex;
  337. err = abx500_get_register_interruptible(abreg->dev, 0,
  338. abreg->regreg, &regval);
  339. if (err) {
  340. dev_warn(&reg->dev,
  341. "failed to get regulator register %02x\n",
  342. abreg->regreg);
  343. return err;
  344. }
  345. /* The highest three bits control the variable regulators */
  346. regval &= ~0xE0;
  347. regval |= (bestindex << 5);
  348. err = abx500_set_register_interruptible(abreg->dev, 0,
  349. abreg->regreg, regval);
  350. if (err)
  351. dev_warn(&reg->dev, "failed to set regulator register %02x\n",
  352. abreg->regreg);
  353. return err;
  354. }
  355. static int ab3100_set_suspend_voltage_regulator(struct regulator_dev *reg,
  356. int uV)
  357. {
  358. struct ab3100_regulator *abreg = reg->reg_data;
  359. u8 regval;
  360. int err;
  361. int bestindex;
  362. u8 targetreg;
  363. if (abreg->regreg == AB3100_LDO_E)
  364. targetreg = AB3100_LDO_E_SLEEP;
  365. else if (abreg->regreg == AB3100_BUCK)
  366. targetreg = AB3100_BUCK_SLEEP;
  367. else
  368. return -EINVAL;
  369. /* LDO E and BUCK have special suspend voltages you can set */
  370. bestindex = ab3100_get_best_voltage_index(reg, uV, uV);
  371. err = abx500_get_register_interruptible(abreg->dev, 0,
  372. targetreg, &regval);
  373. if (err) {
  374. dev_warn(&reg->dev,
  375. "failed to get regulator register %02x\n",
  376. targetreg);
  377. return err;
  378. }
  379. /* The highest three bits control the variable regulators */
  380. regval &= ~0xE0;
  381. regval |= (bestindex << 5);
  382. err = abx500_set_register_interruptible(abreg->dev, 0,
  383. targetreg, regval);
  384. if (err)
  385. dev_warn(&reg->dev, "failed to set regulator register %02x\n",
  386. abreg->regreg);
  387. return err;
  388. }
  389. /*
  390. * The external regulator can just define a fixed voltage.
  391. */
  392. static int ab3100_get_voltage_regulator_external(struct regulator_dev *reg)
  393. {
  394. struct ab3100_regulator *abreg = reg->reg_data;
  395. return abreg->plfdata->external_voltage;
  396. }
  397. static struct regulator_ops regulator_ops_fixed = {
  398. .enable = ab3100_enable_regulator,
  399. .disable = ab3100_disable_regulator,
  400. .is_enabled = ab3100_is_enabled_regulator,
  401. .get_voltage = ab3100_get_voltage_regulator,
  402. };
  403. static struct regulator_ops regulator_ops_variable = {
  404. .enable = ab3100_enable_regulator,
  405. .disable = ab3100_disable_regulator,
  406. .is_enabled = ab3100_is_enabled_regulator,
  407. .get_voltage = ab3100_get_voltage_regulator,
  408. .set_voltage = ab3100_set_voltage_regulator,
  409. .list_voltage = ab3100_list_voltage_regulator,
  410. };
  411. static struct regulator_ops regulator_ops_variable_sleepable = {
  412. .enable = ab3100_enable_regulator,
  413. .disable = ab3100_disable_regulator,
  414. .is_enabled = ab3100_is_enabled_regulator,
  415. .get_voltage = ab3100_get_voltage_regulator,
  416. .set_voltage = ab3100_set_voltage_regulator,
  417. .set_suspend_voltage = ab3100_set_suspend_voltage_regulator,
  418. .list_voltage = ab3100_list_voltage_regulator,
  419. };
  420. /*
  421. * LDO EXT is an external regulator so it is really
  422. * not possible to set any voltage locally here, AB3100
  423. * is an on/off switch plain an simple. The external
  424. * voltage is defined in the board set-up if any.
  425. */
  426. static struct regulator_ops regulator_ops_external = {
  427. .enable = ab3100_enable_regulator,
  428. .disable = ab3100_disable_regulator,
  429. .is_enabled = ab3100_is_enabled_regulator,
  430. .get_voltage = ab3100_get_voltage_regulator_external,
  431. };
  432. static struct regulator_desc
  433. ab3100_regulator_desc[AB3100_NUM_REGULATORS] = {
  434. {
  435. .name = "LDO_A",
  436. .id = AB3100_LDO_A,
  437. .ops = &regulator_ops_fixed,
  438. .type = REGULATOR_VOLTAGE,
  439. .owner = THIS_MODULE,
  440. },
  441. {
  442. .name = "LDO_C",
  443. .id = AB3100_LDO_C,
  444. .ops = &regulator_ops_fixed,
  445. .type = REGULATOR_VOLTAGE,
  446. .owner = THIS_MODULE,
  447. },
  448. {
  449. .name = "LDO_D",
  450. .id = AB3100_LDO_D,
  451. .ops = &regulator_ops_fixed,
  452. .type = REGULATOR_VOLTAGE,
  453. .owner = THIS_MODULE,
  454. },
  455. {
  456. .name = "LDO_E",
  457. .id = AB3100_LDO_E,
  458. .ops = &regulator_ops_variable_sleepable,
  459. .n_voltages = ARRAY_SIZE(ldo_e_buck_typ_voltages),
  460. .type = REGULATOR_VOLTAGE,
  461. .owner = THIS_MODULE,
  462. },
  463. {
  464. .name = "LDO_F",
  465. .id = AB3100_LDO_F,
  466. .ops = &regulator_ops_variable,
  467. .n_voltages = ARRAY_SIZE(ldo_f_typ_voltages),
  468. .type = REGULATOR_VOLTAGE,
  469. .owner = THIS_MODULE,
  470. },
  471. {
  472. .name = "LDO_G",
  473. .id = AB3100_LDO_G,
  474. .ops = &regulator_ops_variable,
  475. .n_voltages = ARRAY_SIZE(ldo_g_typ_voltages),
  476. .type = REGULATOR_VOLTAGE,
  477. .owner = THIS_MODULE,
  478. },
  479. {
  480. .name = "LDO_H",
  481. .id = AB3100_LDO_H,
  482. .ops = &regulator_ops_variable,
  483. .n_voltages = ARRAY_SIZE(ldo_h_typ_voltages),
  484. .type = REGULATOR_VOLTAGE,
  485. .owner = THIS_MODULE,
  486. },
  487. {
  488. .name = "LDO_K",
  489. .id = AB3100_LDO_K,
  490. .ops = &regulator_ops_variable,
  491. .n_voltages = ARRAY_SIZE(ldo_k_typ_voltages),
  492. .type = REGULATOR_VOLTAGE,
  493. .owner = THIS_MODULE,
  494. },
  495. {
  496. .name = "LDO_EXT",
  497. .id = AB3100_LDO_EXT,
  498. .ops = &regulator_ops_external,
  499. .type = REGULATOR_VOLTAGE,
  500. .owner = THIS_MODULE,
  501. },
  502. {
  503. .name = "BUCK",
  504. .id = AB3100_BUCK,
  505. .ops = &regulator_ops_variable_sleepable,
  506. .n_voltages = ARRAY_SIZE(ldo_e_buck_typ_voltages),
  507. .type = REGULATOR_VOLTAGE,
  508. .owner = THIS_MODULE,
  509. },
  510. };
  511. /*
  512. * NOTE: the following functions are regulators pluralis - it is the
  513. * binding to the AB3100 core driver and the parent platform device
  514. * for all the different regulators.
  515. */
  516. static int __devinit ab3100_regulators_probe(struct platform_device *pdev)
  517. {
  518. struct ab3100_platform_data *plfdata = pdev->dev.platform_data;
  519. int err = 0;
  520. u8 data;
  521. int i;
  522. /* Check chip state */
  523. err = abx500_get_register_interruptible(&pdev->dev, 0,
  524. AB3100_LDO_D, &data);
  525. if (err) {
  526. dev_err(&pdev->dev, "could not read initial status of LDO_D\n");
  527. return err;
  528. }
  529. if (data & 0x10)
  530. dev_notice(&pdev->dev,
  531. "chip is already in active mode (Warm start)\n");
  532. else
  533. dev_notice(&pdev->dev,
  534. "chip is in inactive mode (Cold start)\n");
  535. /* Set up regulators */
  536. for (i = 0; i < ARRAY_SIZE(ab3100_reg_init_order); i++) {
  537. err = abx500_set_register_interruptible(&pdev->dev, 0,
  538. ab3100_reg_init_order[i],
  539. plfdata->reg_initvals[i]);
  540. if (err) {
  541. dev_err(&pdev->dev, "regulator initialization failed with error %d\n",
  542. err);
  543. return err;
  544. }
  545. }
  546. /* Register the regulators */
  547. for (i = 0; i < AB3100_NUM_REGULATORS; i++) {
  548. struct ab3100_regulator *reg = &ab3100_regulators[i];
  549. struct regulator_dev *rdev;
  550. /*
  551. * Initialize per-regulator struct.
  552. * Inherit platform data, this comes down from the
  553. * i2c boarddata, from the machine. So if you want to
  554. * see what it looks like for a certain machine, go
  555. * into the machine I2C setup.
  556. */
  557. reg->dev = &pdev->dev;
  558. reg->plfdata = plfdata;
  559. /*
  560. * Register the regulator, pass around
  561. * the ab3100_regulator struct
  562. */
  563. rdev = regulator_register(&ab3100_regulator_desc[i],
  564. &pdev->dev,
  565. &plfdata->reg_constraints[i],
  566. reg);
  567. if (IS_ERR(rdev)) {
  568. err = PTR_ERR(rdev);
  569. dev_err(&pdev->dev,
  570. "%s: failed to register regulator %s err %d\n",
  571. __func__, ab3100_regulator_desc[i].name,
  572. err);
  573. /* remove the already registered regulators */
  574. while (--i >= 0)
  575. regulator_unregister(ab3100_regulators[i].rdev);
  576. return err;
  577. }
  578. /* Then set a pointer back to the registered regulator */
  579. reg->rdev = rdev;
  580. }
  581. return 0;
  582. }
  583. static int __devexit ab3100_regulators_remove(struct platform_device *pdev)
  584. {
  585. int i;
  586. for (i = 0; i < AB3100_NUM_REGULATORS; i++) {
  587. struct ab3100_regulator *reg = &ab3100_regulators[i];
  588. regulator_unregister(reg->rdev);
  589. }
  590. return 0;
  591. }
  592. static struct platform_driver ab3100_regulators_driver = {
  593. .driver = {
  594. .name = "ab3100-regulators",
  595. .owner = THIS_MODULE,
  596. },
  597. .probe = ab3100_regulators_probe,
  598. .remove = __devexit_p(ab3100_regulators_remove),
  599. };
  600. static __init int ab3100_regulators_init(void)
  601. {
  602. return platform_driver_register(&ab3100_regulators_driver);
  603. }
  604. static __exit void ab3100_regulators_exit(void)
  605. {
  606. platform_driver_unregister(&ab3100_regulators_driver);
  607. }
  608. subsys_initcall(ab3100_regulators_init);
  609. module_exit(ab3100_regulators_exit);
  610. MODULE_AUTHOR("Mattias Wallin <mattias.wallin@stericsson.com>");
  611. MODULE_DESCRIPTION("AB3100 Regulator driver");
  612. MODULE_LICENSE("GPL");
  613. MODULE_ALIAS("platform:ab3100-regulators");