ab3100.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681
  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/ab3100.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. * @ab3100: handle to the AB3100 parent chip
  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 ab3100 *ab3100;
  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 = ab3100_get_register_interruptible(abreg->ab3100, 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 = ab3100_set_register_interruptible(abreg->ab3100, 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 ab3100_set_register_interruptible(abreg->ab3100,
  228. AB3100_LDO_D, 0x00U);
  229. }
  230. /*
  231. * All other regulators are handled here
  232. */
  233. err = ab3100_get_register_interruptible(abreg->ab3100, 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 ab3100_set_register_interruptible(abreg->ab3100, 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 = ab3100_get_register_interruptible(abreg->ab3100, 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 = ab3100_get_register_interruptible(abreg->ab3100,
  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 = ab3100_get_register_interruptible(abreg->ab3100,
  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 = ab3100_set_register_interruptible(abreg->ab3100,
  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 = ab3100_get_register_interruptible(abreg->ab3100,
  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 = ab3100_set_register_interruptible(abreg->ab3100,
  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. },
  440. {
  441. .name = "LDO_C",
  442. .id = AB3100_LDO_C,
  443. .ops = &regulator_ops_fixed,
  444. .type = REGULATOR_VOLTAGE,
  445. },
  446. {
  447. .name = "LDO_D",
  448. .id = AB3100_LDO_D,
  449. .ops = &regulator_ops_fixed,
  450. .type = REGULATOR_VOLTAGE,
  451. },
  452. {
  453. .name = "LDO_E",
  454. .id = AB3100_LDO_E,
  455. .ops = &regulator_ops_variable_sleepable,
  456. .n_voltages = ARRAY_SIZE(ldo_e_buck_typ_voltages),
  457. .type = REGULATOR_VOLTAGE,
  458. },
  459. {
  460. .name = "LDO_F",
  461. .id = AB3100_LDO_F,
  462. .ops = &regulator_ops_variable,
  463. .n_voltages = ARRAY_SIZE(ldo_f_typ_voltages),
  464. .type = REGULATOR_VOLTAGE,
  465. },
  466. {
  467. .name = "LDO_G",
  468. .id = AB3100_LDO_G,
  469. .ops = &regulator_ops_variable,
  470. .n_voltages = ARRAY_SIZE(ldo_g_typ_voltages),
  471. .type = REGULATOR_VOLTAGE,
  472. },
  473. {
  474. .name = "LDO_H",
  475. .id = AB3100_LDO_H,
  476. .ops = &regulator_ops_variable,
  477. .n_voltages = ARRAY_SIZE(ldo_h_typ_voltages),
  478. .type = REGULATOR_VOLTAGE,
  479. },
  480. {
  481. .name = "LDO_K",
  482. .id = AB3100_LDO_K,
  483. .ops = &regulator_ops_variable,
  484. .n_voltages = ARRAY_SIZE(ldo_k_typ_voltages),
  485. .type = REGULATOR_VOLTAGE,
  486. },
  487. {
  488. .name = "LDO_EXT",
  489. .id = AB3100_LDO_EXT,
  490. .ops = &regulator_ops_external,
  491. .type = REGULATOR_VOLTAGE,
  492. },
  493. {
  494. .name = "BUCK",
  495. .id = AB3100_BUCK,
  496. .ops = &regulator_ops_variable_sleepable,
  497. .n_voltages = ARRAY_SIZE(ldo_e_buck_typ_voltages),
  498. .type = REGULATOR_VOLTAGE,
  499. },
  500. };
  501. /*
  502. * NOTE: the following functions are regulators pluralis - it is the
  503. * binding to the AB3100 core driver and the parent platform device
  504. * for all the different regulators.
  505. */
  506. static int __init ab3100_regulators_probe(struct platform_device *pdev)
  507. {
  508. struct ab3100_platform_data *plfdata = pdev->dev.platform_data;
  509. struct ab3100 *ab3100 = platform_get_drvdata(pdev);
  510. int err = 0;
  511. u8 data;
  512. int i;
  513. /* Check chip state */
  514. err = ab3100_get_register_interruptible(ab3100,
  515. AB3100_LDO_D, &data);
  516. if (err) {
  517. dev_err(&pdev->dev, "could not read initial status of LDO_D\n");
  518. return err;
  519. }
  520. if (data & 0x10)
  521. dev_notice(&pdev->dev,
  522. "chip is already in active mode (Warm start)\n");
  523. else
  524. dev_notice(&pdev->dev,
  525. "chip is in inactive mode (Cold start)\n");
  526. /* Set up regulators */
  527. for (i = 0; i < ARRAY_SIZE(ab3100_reg_init_order); i++) {
  528. err = ab3100_set_register_interruptible(ab3100,
  529. ab3100_reg_init_order[i],
  530. plfdata->reg_initvals[i]);
  531. if (err) {
  532. dev_err(&pdev->dev, "regulator initialization failed with error %d\n",
  533. err);
  534. return err;
  535. }
  536. }
  537. /* Register the regulators */
  538. for (i = 0; i < AB3100_NUM_REGULATORS; i++) {
  539. struct ab3100_regulator *reg = &ab3100_regulators[i];
  540. struct regulator_dev *rdev;
  541. /*
  542. * Initialize per-regulator struct.
  543. * Inherit platform data, this comes down from the
  544. * i2c boarddata, from the machine. So if you want to
  545. * see what it looks like for a certain machine, go
  546. * into the machine I2C setup.
  547. */
  548. reg->ab3100 = ab3100;
  549. reg->plfdata = plfdata;
  550. /*
  551. * Register the regulator, pass around
  552. * the ab3100_regulator struct
  553. */
  554. rdev = regulator_register(&ab3100_regulator_desc[i],
  555. &pdev->dev,
  556. &plfdata->reg_constraints[i],
  557. reg);
  558. if (IS_ERR(rdev)) {
  559. err = PTR_ERR(rdev);
  560. dev_err(&pdev->dev,
  561. "%s: failed to register regulator %s err %d\n",
  562. __func__, ab3100_regulator_desc[i].name,
  563. err);
  564. i--;
  565. /* remove the already registered regulators */
  566. while (i > 0) {
  567. regulator_unregister(ab3100_regulators[i].rdev);
  568. i--;
  569. }
  570. return err;
  571. }
  572. /* Then set a pointer back to the registered regulator */
  573. reg->rdev = rdev;
  574. }
  575. return 0;
  576. }
  577. static int __exit ab3100_regulators_remove(struct platform_device *pdev)
  578. {
  579. int i;
  580. for (i = 0; i < AB3100_NUM_REGULATORS; i++) {
  581. struct ab3100_regulator *reg = &ab3100_regulators[i];
  582. regulator_unregister(reg->rdev);
  583. }
  584. return 0;
  585. }
  586. static struct platform_driver ab3100_regulators_driver = {
  587. .driver = {
  588. .name = "ab3100-regulators",
  589. .owner = THIS_MODULE,
  590. },
  591. .probe = ab3100_regulators_probe,
  592. .remove = __exit_p(ab3100_regulators_remove),
  593. };
  594. static __init int ab3100_regulators_init(void)
  595. {
  596. return platform_driver_register(&ab3100_regulators_driver);
  597. }
  598. static __exit void ab3100_regulators_exit(void)
  599. {
  600. platform_driver_unregister(&ab3100_regulators_driver);
  601. }
  602. subsys_initcall(ab3100_regulators_init);
  603. module_exit(ab3100_regulators_exit);
  604. MODULE_AUTHOR("Mattias Wallin <mattias.wallin@stericsson.com>");
  605. MODULE_DESCRIPTION("AB3100 Regulator driver");
  606. MODULE_LICENSE("GPL");
  607. MODULE_ALIAS("platform:ab3100-regulators");