mc13783-regulator.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  1. /*
  2. * Regulator Driver for Freescale MC13783 PMIC
  3. *
  4. * Copyright (C) 2008 Sascha Hauer, Pengutronix <s.hauer@pengutronix.de>
  5. * Copyright 2009 Alberto Panizzo <maramaopercheseimorto@gmail.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #include <linux/mfd/mc13783.h>
  12. #include <linux/regulator/machine.h>
  13. #include <linux/regulator/driver.h>
  14. #include <linux/platform_device.h>
  15. #include <linux/kernel.h>
  16. #include <linux/init.h>
  17. #include <linux/err.h>
  18. #define MC13783_REG_SWITCHERS5 29
  19. #define MC13783_REG_SWITCHERS5_SW3EN (1 << 20)
  20. #define MC13783_REG_SWITCHERS5_SW3VSEL 18
  21. #define MC13783_REG_SWITCHERS5_SW3VSEL_M (3 << 18)
  22. #define MC13783_REG_REGULATORSETTING0 30
  23. #define MC13783_REG_REGULATORSETTING0_VIOLOVSEL 2
  24. #define MC13783_REG_REGULATORSETTING0_VDIGVSEL 4
  25. #define MC13783_REG_REGULATORSETTING0_VGENVSEL 6
  26. #define MC13783_REG_REGULATORSETTING0_VRFDIGVSEL 9
  27. #define MC13783_REG_REGULATORSETTING0_VRFREFVSEL 11
  28. #define MC13783_REG_REGULATORSETTING0_VRFCPVSEL 13
  29. #define MC13783_REG_REGULATORSETTING0_VSIMVSEL 14
  30. #define MC13783_REG_REGULATORSETTING0_VESIMVSEL 15
  31. #define MC13783_REG_REGULATORSETTING0_VCAMVSEL 16
  32. #define MC13783_REG_REGULATORSETTING0_VIOLOVSEL_M (3 << 2)
  33. #define MC13783_REG_REGULATORSETTING0_VDIGVSEL_M (3 << 4)
  34. #define MC13783_REG_REGULATORSETTING0_VGENVSEL_M (7 << 6)
  35. #define MC13783_REG_REGULATORSETTING0_VRFDIGVSEL_M (3 << 9)
  36. #define MC13783_REG_REGULATORSETTING0_VRFREFVSEL_M (3 << 11)
  37. #define MC13783_REG_REGULATORSETTING0_VRFCPVSEL_M (1 << 13)
  38. #define MC13783_REG_REGULATORSETTING0_VSIMVSEL_M (1 << 14)
  39. #define MC13783_REG_REGULATORSETTING0_VESIMVSEL_M (1 << 15)
  40. #define MC13783_REG_REGULATORSETTING0_VCAMVSEL_M (7 << 16)
  41. #define MC13783_REG_REGULATORSETTING1 31
  42. #define MC13783_REG_REGULATORSETTING1_VVIBVSEL 0
  43. #define MC13783_REG_REGULATORSETTING1_VRF1VSEL 2
  44. #define MC13783_REG_REGULATORSETTING1_VRF2VSEL 4
  45. #define MC13783_REG_REGULATORSETTING1_VMMC1VSEL 6
  46. #define MC13783_REG_REGULATORSETTING1_VMMC2VSEL 9
  47. #define MC13783_REG_REGULATORSETTING1_VVIBVSEL_M (3 << 0)
  48. #define MC13783_REG_REGULATORSETTING1_VRF1VSEL_M (3 << 2)
  49. #define MC13783_REG_REGULATORSETTING1_VRF2VSEL_M (3 << 4)
  50. #define MC13783_REG_REGULATORSETTING1_VMMC1VSEL_M (7 << 6)
  51. #define MC13783_REG_REGULATORSETTING1_VMMC2VSEL_M (7 << 9)
  52. #define MC13783_REG_REGULATORMODE0 32
  53. #define MC13783_REG_REGULATORMODE0_VAUDIOEN (1 << 0)
  54. #define MC13783_REG_REGULATORMODE0_VIOHIEN (1 << 3)
  55. #define MC13783_REG_REGULATORMODE0_VIOLOEN (1 << 6)
  56. #define MC13783_REG_REGULATORMODE0_VDIGEN (1 << 9)
  57. #define MC13783_REG_REGULATORMODE0_VGENEN (1 << 12)
  58. #define MC13783_REG_REGULATORMODE0_VRFDIGEN (1 << 15)
  59. #define MC13783_REG_REGULATORMODE0_VRFREFEN (1 << 18)
  60. #define MC13783_REG_REGULATORMODE0_VRFCPEN (1 << 21)
  61. #define MC13783_REG_REGULATORMODE1 33
  62. #define MC13783_REG_REGULATORMODE1_VSIMEN (1 << 0)
  63. #define MC13783_REG_REGULATORMODE1_VESIMEN (1 << 3)
  64. #define MC13783_REG_REGULATORMODE1_VCAMEN (1 << 6)
  65. #define MC13783_REG_REGULATORMODE1_VRFBGEN (1 << 9)
  66. #define MC13783_REG_REGULATORMODE1_VVIBEN (1 << 11)
  67. #define MC13783_REG_REGULATORMODE1_VRF1EN (1 << 12)
  68. #define MC13783_REG_REGULATORMODE1_VRF2EN (1 << 15)
  69. #define MC13783_REG_REGULATORMODE1_VMMC1EN (1 << 18)
  70. #define MC13783_REG_REGULATORMODE1_VMMC2EN (1 << 21)
  71. #define MC13783_REG_POWERMISC 34
  72. #define MC13783_REG_POWERMISC_GPO1EN (1 << 6)
  73. #define MC13783_REG_POWERMISC_GPO2EN (1 << 8)
  74. #define MC13783_REG_POWERMISC_GPO3EN (1 << 10)
  75. #define MC13783_REG_POWERMISC_GPO4EN (1 << 12)
  76. struct mc13783_regulator {
  77. struct regulator_desc desc;
  78. int reg;
  79. int enable_bit;
  80. int vsel_reg;
  81. int vsel_shift;
  82. int vsel_mask;
  83. int const *voltages;
  84. };
  85. /* Voltage Values */
  86. static const int const mc13783_sw3_val[] = {
  87. 5000000, 5000000, 5000000, 5500000,
  88. };
  89. static const int const mc13783_vaudio_val[] = {
  90. 2775000,
  91. };
  92. static const int const mc13783_viohi_val[] = {
  93. 2775000,
  94. };
  95. static const int const mc13783_violo_val[] = {
  96. 1200000, 1300000, 1500000, 1800000,
  97. };
  98. static const int const mc13783_vdig_val[] = {
  99. 1200000, 1300000, 1500000, 1800000,
  100. };
  101. static const int const mc13783_vgen_val[] = {
  102. 1200000, 1300000, 1500000, 1800000,
  103. 1100000, 2000000, 2775000, 2400000,
  104. };
  105. static const int const mc13783_vrfdig_val[] = {
  106. 1200000, 1500000, 1800000, 1875000,
  107. };
  108. static const int const mc13783_vrfref_val[] = {
  109. 2475000, 2600000, 2700000, 2775000,
  110. };
  111. static const int const mc13783_vrfcp_val[] = {
  112. 2700000, 2775000,
  113. };
  114. static const int const mc13783_vsim_val[] = {
  115. 1800000, 2900000, 3000000,
  116. };
  117. static const int const mc13783_vesim_val[] = {
  118. 1800000, 2900000,
  119. };
  120. static const int const mc13783_vcam_val[] = {
  121. 1500000, 1800000, 2500000, 2550000,
  122. 2600000, 2750000, 2800000, 3000000,
  123. };
  124. static const int const mc13783_vrfbg_val[] = {
  125. 1250000,
  126. };
  127. static const int const mc13783_vvib_val[] = {
  128. 1300000, 1800000, 2000000, 3000000,
  129. };
  130. static const int const mc13783_vmmc_val[] = {
  131. 1600000, 1800000, 2000000, 2600000,
  132. 2700000, 2800000, 2900000, 3000000,
  133. };
  134. static const int const mc13783_vrf_val[] = {
  135. 1500000, 1875000, 2700000, 2775000,
  136. };
  137. static struct regulator_ops mc13783_regulator_ops;
  138. static struct regulator_ops mc13783_fixed_regulator_ops;
  139. #define MC13783_DEFINE(prefix, _name, _reg, _vsel_reg, _voltages) \
  140. [MC13783_ ## prefix ## _ ## _name] = { \
  141. .desc = { \
  142. .name = #prefix "_" #_name, \
  143. .n_voltages = ARRAY_SIZE(_voltages), \
  144. .ops = &mc13783_regulator_ops, \
  145. .type = REGULATOR_VOLTAGE, \
  146. .id = MC13783_ ## prefix ## _ ## _name, \
  147. .owner = THIS_MODULE, \
  148. }, \
  149. .reg = MC13783_REG_ ## _reg, \
  150. .enable_bit = MC13783_REG_ ## _reg ## _ ## _name ## EN, \
  151. .vsel_reg = MC13783_REG_ ## _vsel_reg, \
  152. .vsel_shift = MC13783_REG_ ## _vsel_reg ## _ ## _name ## VSEL,\
  153. .vsel_mask = MC13783_REG_ ## _vsel_reg ## _ ## _name ## VSEL_M,\
  154. .voltages = _voltages, \
  155. }
  156. #define MC13783_FIXED_DEFINE(prefix, _name, _reg, _voltages) \
  157. [MC13783_ ## prefix ## _ ## _name] = { \
  158. .desc = { \
  159. .name = #prefix "_" #_name, \
  160. .n_voltages = ARRAY_SIZE(_voltages), \
  161. .ops = &mc13783_fixed_regulator_ops, \
  162. .type = REGULATOR_VOLTAGE, \
  163. .id = MC13783_ ## prefix ## _ ## _name, \
  164. .owner = THIS_MODULE, \
  165. }, \
  166. .reg = MC13783_REG_ ## _reg, \
  167. .enable_bit = MC13783_REG_ ## _reg ## _ ## _name ## EN, \
  168. .voltages = _voltages, \
  169. }
  170. #define MC13783_GPO_DEFINE(prefix, _name, _reg) \
  171. [MC13783_ ## prefix ## _ ## _name] = { \
  172. .desc = { \
  173. .name = #prefix "_" #_name, \
  174. .ops = &mc13783_regulator_ops, \
  175. .type = REGULATOR_VOLTAGE, \
  176. .id = MC13783_ ## prefix ## _ ## _name, \
  177. .owner = THIS_MODULE, \
  178. }, \
  179. .reg = MC13783_REG_ ## _reg, \
  180. .enable_bit = MC13783_REG_ ## _reg ## _ ## _name ## EN, \
  181. }
  182. #define MC13783_DEFINE_SW(_name, _reg, _vsel_reg, _voltages) \
  183. MC13783_DEFINE(SW, _name, _reg, _vsel_reg, _voltages)
  184. #define MC13783_DEFINE_REGU(_name, _reg, _vsel_reg, _voltages) \
  185. MC13783_DEFINE(REGU, _name, _reg, _vsel_reg, _voltages)
  186. static struct mc13783_regulator mc13783_regulators[] = {
  187. MC13783_DEFINE_SW(SW3, SWITCHERS5, SWITCHERS5, mc13783_sw3_val),
  188. MC13783_FIXED_DEFINE(REGU, VAUDIO, REGULATORMODE0, mc13783_vaudio_val),
  189. MC13783_FIXED_DEFINE(REGU, VIOHI, REGULATORMODE0, mc13783_viohi_val),
  190. MC13783_DEFINE_REGU(VIOLO, REGULATORMODE0, REGULATORSETTING0, \
  191. mc13783_violo_val),
  192. MC13783_DEFINE_REGU(VDIG, REGULATORMODE0, REGULATORSETTING0, \
  193. mc13783_vdig_val),
  194. MC13783_DEFINE_REGU(VGEN, REGULATORMODE0, REGULATORSETTING0, \
  195. mc13783_vgen_val),
  196. MC13783_DEFINE_REGU(VRFDIG, REGULATORMODE0, REGULATORSETTING0, \
  197. mc13783_vrfdig_val),
  198. MC13783_DEFINE_REGU(VRFREF, REGULATORMODE0, REGULATORSETTING0, \
  199. mc13783_vrfref_val),
  200. MC13783_DEFINE_REGU(VRFCP, REGULATORMODE0, REGULATORSETTING0, \
  201. mc13783_vrfcp_val),
  202. MC13783_DEFINE_REGU(VSIM, REGULATORMODE1, REGULATORSETTING0, \
  203. mc13783_vsim_val),
  204. MC13783_DEFINE_REGU(VESIM, REGULATORMODE1, REGULATORSETTING0, \
  205. mc13783_vesim_val),
  206. MC13783_DEFINE_REGU(VCAM, REGULATORMODE1, REGULATORSETTING0, \
  207. mc13783_vcam_val),
  208. MC13783_FIXED_DEFINE(REGU, VRFBG, REGULATORMODE1, mc13783_vrfbg_val),
  209. MC13783_DEFINE_REGU(VVIB, REGULATORMODE1, REGULATORSETTING1, \
  210. mc13783_vvib_val),
  211. MC13783_DEFINE_REGU(VRF1, REGULATORMODE1, REGULATORSETTING1, \
  212. mc13783_vrf_val),
  213. MC13783_DEFINE_REGU(VRF2, REGULATORMODE1, REGULATORSETTING1, \
  214. mc13783_vrf_val),
  215. MC13783_DEFINE_REGU(VMMC1, REGULATORMODE1, REGULATORSETTING1, \
  216. mc13783_vmmc_val),
  217. MC13783_DEFINE_REGU(VMMC2, REGULATORMODE1, REGULATORSETTING1, \
  218. mc13783_vmmc_val),
  219. MC13783_GPO_DEFINE(REGU, GPO1, POWERMISC),
  220. MC13783_GPO_DEFINE(REGU, GPO2, POWERMISC),
  221. MC13783_GPO_DEFINE(REGU, GPO3, POWERMISC),
  222. MC13783_GPO_DEFINE(REGU, GPO4, POWERMISC),
  223. };
  224. struct mc13783_regulator_priv {
  225. struct mc13783 *mc13783;
  226. struct regulator_dev *regulators[];
  227. };
  228. static int mc13783_regulator_enable(struct regulator_dev *rdev)
  229. {
  230. struct mc13783_regulator_priv *priv = rdev_get_drvdata(rdev);
  231. int id = rdev_get_id(rdev);
  232. int ret;
  233. dev_dbg(rdev_get_dev(rdev), "%s id: %d\n", __func__, id);
  234. mc13783_lock(priv->mc13783);
  235. ret = mc13783_reg_rmw(priv->mc13783, mc13783_regulators[id].reg,
  236. mc13783_regulators[id].enable_bit,
  237. mc13783_regulators[id].enable_bit);
  238. mc13783_unlock(priv->mc13783);
  239. return ret;
  240. }
  241. static int mc13783_regulator_disable(struct regulator_dev *rdev)
  242. {
  243. struct mc13783_regulator_priv *priv = rdev_get_drvdata(rdev);
  244. int id = rdev_get_id(rdev);
  245. int ret;
  246. dev_dbg(rdev_get_dev(rdev), "%s id: %d\n", __func__, id);
  247. mc13783_lock(priv->mc13783);
  248. ret = mc13783_reg_rmw(priv->mc13783, mc13783_regulators[id].reg,
  249. mc13783_regulators[id].enable_bit, 0);
  250. mc13783_unlock(priv->mc13783);
  251. return ret;
  252. }
  253. static int mc13783_regulator_is_enabled(struct regulator_dev *rdev)
  254. {
  255. struct mc13783_regulator_priv *priv = rdev_get_drvdata(rdev);
  256. int ret, id = rdev_get_id(rdev);
  257. unsigned int val;
  258. mc13783_lock(priv->mc13783);
  259. ret = mc13783_reg_read(priv->mc13783, mc13783_regulators[id].reg, &val);
  260. mc13783_unlock(priv->mc13783);
  261. if (ret)
  262. return ret;
  263. return (val & mc13783_regulators[id].enable_bit) != 0;
  264. }
  265. static int mc13783_regulator_list_voltage(struct regulator_dev *rdev,
  266. unsigned selector)
  267. {
  268. int id = rdev_get_id(rdev);
  269. if (selector >= mc13783_regulators[id].desc.n_voltages)
  270. return -EINVAL;
  271. return mc13783_regulators[id].voltages[selector];
  272. }
  273. static int mc13783_get_best_voltage_index(struct regulator_dev *rdev,
  274. int min_uV, int max_uV)
  275. {
  276. int reg_id = rdev_get_id(rdev);
  277. int i;
  278. int bestmatch;
  279. int bestindex;
  280. /*
  281. * Locate the minimum voltage fitting the criteria on
  282. * this regulator. The switchable voltages are not
  283. * in strict falling order so we need to check them
  284. * all for the best match.
  285. */
  286. bestmatch = INT_MAX;
  287. bestindex = -1;
  288. for (i = 0; i < mc13783_regulators[reg_id].desc.n_voltages; i++) {
  289. if (mc13783_regulators[reg_id].voltages[i] >= min_uV &&
  290. mc13783_regulators[reg_id].voltages[i] < bestmatch) {
  291. bestmatch = mc13783_regulators[reg_id].voltages[i];
  292. bestindex = i;
  293. }
  294. }
  295. if (bestindex < 0 || bestmatch > max_uV) {
  296. dev_warn(&rdev->dev, "no possible value for %d<=x<=%d uV\n",
  297. min_uV, max_uV);
  298. return -EINVAL;
  299. }
  300. return bestindex;
  301. }
  302. static int mc13783_regulator_set_voltage(struct regulator_dev *rdev,
  303. int min_uV, int max_uV)
  304. {
  305. struct mc13783_regulator_priv *priv = rdev_get_drvdata(rdev);
  306. int value, id = rdev_get_id(rdev);
  307. int ret;
  308. dev_dbg(rdev_get_dev(rdev), "%s id: %d min_uV: %d max_uV: %d\n",
  309. __func__, id, min_uV, max_uV);
  310. /* Find the best index */
  311. value = mc13783_get_best_voltage_index(rdev, min_uV, max_uV);
  312. dev_dbg(rdev_get_dev(rdev), "%s best value: %d \n", __func__, value);
  313. if (value < 0)
  314. return value;
  315. mc13783_lock(priv->mc13783);
  316. ret = mc13783_reg_rmw(priv->mc13783, mc13783_regulators[id].vsel_reg,
  317. mc13783_regulators[id].vsel_mask,
  318. value << mc13783_regulators[id].vsel_shift);
  319. mc13783_unlock(priv->mc13783);
  320. return ret;
  321. }
  322. static int mc13783_regulator_get_voltage(struct regulator_dev *rdev)
  323. {
  324. struct mc13783_regulator_priv *priv = rdev_get_drvdata(rdev);
  325. int ret, id = rdev_get_id(rdev);
  326. unsigned int val;
  327. dev_dbg(rdev_get_dev(rdev), "%s id: %d\n", __func__, id);
  328. mc13783_lock(priv->mc13783);
  329. ret = mc13783_reg_read(priv->mc13783,
  330. mc13783_regulators[id].vsel_reg, &val);
  331. mc13783_unlock(priv->mc13783);
  332. if (ret)
  333. return ret;
  334. val = (val & mc13783_regulators[id].vsel_mask)
  335. >> mc13783_regulators[id].vsel_shift;
  336. dev_dbg(rdev_get_dev(rdev), "%s id: %d val: %d\n", __func__, id, val);
  337. BUG_ON(val < 0 || val > mc13783_regulators[id].desc.n_voltages);
  338. return mc13783_regulators[id].voltages[val];
  339. }
  340. static struct regulator_ops mc13783_regulator_ops = {
  341. .enable = mc13783_regulator_enable,
  342. .disable = mc13783_regulator_disable,
  343. .is_enabled = mc13783_regulator_is_enabled,
  344. .list_voltage = mc13783_regulator_list_voltage,
  345. .set_voltage = mc13783_regulator_set_voltage,
  346. .get_voltage = mc13783_regulator_get_voltage,
  347. };
  348. static int mc13783_fixed_regulator_set_voltage(struct regulator_dev *rdev,
  349. int min_uV, int max_uV)
  350. {
  351. int id = rdev_get_id(rdev);
  352. dev_dbg(rdev_get_dev(rdev), "%s id: %d min_uV: %d max_uV: %d\n",
  353. __func__, id, min_uV, max_uV);
  354. if (min_uV > mc13783_regulators[id].voltages[0] &&
  355. max_uV < mc13783_regulators[id].voltages[0])
  356. return 0;
  357. else
  358. return -EINVAL;
  359. }
  360. static int mc13783_fixed_regulator_get_voltage(struct regulator_dev *rdev)
  361. {
  362. int id = rdev_get_id(rdev);
  363. dev_dbg(rdev_get_dev(rdev), "%s id: %d\n", __func__, id);
  364. return mc13783_regulators[id].voltages[0];
  365. }
  366. static struct regulator_ops mc13783_fixed_regulator_ops = {
  367. .enable = mc13783_regulator_enable,
  368. .disable = mc13783_regulator_disable,
  369. .is_enabled = mc13783_regulator_is_enabled,
  370. .list_voltage = mc13783_regulator_list_voltage,
  371. .set_voltage = mc13783_fixed_regulator_set_voltage,
  372. .get_voltage = mc13783_fixed_regulator_get_voltage,
  373. };
  374. static int __devinit mc13783_regulator_probe(struct platform_device *pdev)
  375. {
  376. struct mc13783_regulator_priv *priv;
  377. struct mc13783 *mc13783 = dev_get_drvdata(pdev->dev.parent);
  378. struct mc13783_regulator_platform_data *pdata =
  379. dev_get_platdata(&pdev->dev);
  380. struct mc13783_regulator_init_data *init_data;
  381. int i, ret;
  382. dev_dbg(&pdev->dev, "mc13783_regulator_probe id %d\n", pdev->id);
  383. priv = kzalloc(sizeof(*priv) +
  384. pdata->num_regulators * sizeof(priv->regulators[0]),
  385. GFP_KERNEL);
  386. if (!priv)
  387. return -ENOMEM;
  388. priv->mc13783 = mc13783;
  389. for (i = 0; i < pdata->num_regulators; i++) {
  390. init_data = &pdata->regulators[i];
  391. priv->regulators[i] = regulator_register(
  392. &mc13783_regulators[init_data->id].desc,
  393. &pdev->dev, init_data->init_data, priv);
  394. if (IS_ERR(priv->regulators[i])) {
  395. dev_err(&pdev->dev, "failed to register regulator %s\n",
  396. mc13783_regulators[i].desc.name);
  397. ret = PTR_ERR(priv->regulators[i]);
  398. goto err;
  399. }
  400. }
  401. platform_set_drvdata(pdev, priv);
  402. return 0;
  403. err:
  404. while (--i >= 0)
  405. regulator_unregister(priv->regulators[i]);
  406. kfree(priv);
  407. return ret;
  408. }
  409. static int __devexit mc13783_regulator_remove(struct platform_device *pdev)
  410. {
  411. struct mc13783_regulator_priv *priv = platform_get_drvdata(pdev);
  412. struct mc13783_regulator_platform_data *pdata =
  413. dev_get_platdata(&pdev->dev);
  414. int i;
  415. for (i = 0; i < pdata->num_regulators; i++)
  416. regulator_unregister(priv->regulators[i]);
  417. return 0;
  418. }
  419. static struct platform_driver mc13783_regulator_driver = {
  420. .driver = {
  421. .name = "mc13783-regulator",
  422. .owner = THIS_MODULE,
  423. },
  424. .remove = __devexit_p(mc13783_regulator_remove),
  425. .probe = mc13783_regulator_probe,
  426. };
  427. static int __init mc13783_regulator_init(void)
  428. {
  429. return platform_driver_register(&mc13783_regulator_driver);
  430. }
  431. subsys_initcall(mc13783_regulator_init);
  432. static void __exit mc13783_regulator_exit(void)
  433. {
  434. platform_driver_unregister(&mc13783_regulator_driver);
  435. }
  436. module_exit(mc13783_regulator_exit);
  437. MODULE_LICENSE("GPL v2");
  438. MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de");
  439. MODULE_DESCRIPTION("Regulator Driver for Freescale MC13783 PMIC");
  440. MODULE_ALIAS("platform:mc13783-regulator");