2
0

0117-driver-mfd-axp20x-Add-support-for-AXP15060.patch 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014
  1. From e62161318f2fe3e396fc31c50d210e99bec83021 Mon Sep 17 00:00:00 2001
  2. From: "ziv.xu" <[email protected]>
  3. Date: Fri, 4 Aug 2023 13:53:10 +0800
  4. Subject: [PATCH 117/122] driver: mfd: axp20x: Add support for AXP15060
  5. axp20x add support for AXP15060
  6. Signed-off-by: ziv.xu <[email protected]>
  7. ---
  8. drivers/mfd/axp20x-i2c.c | 2 +
  9. drivers/mfd/axp20x.c | 373 ++++++++++++++++++++++++++++++++++---
  10. include/linux/mfd/axp20x.h | 218 +++++++++++++++++++++-
  11. 3 files changed, 557 insertions(+), 36 deletions(-)
  12. --- a/drivers/mfd/axp20x-i2c.c
  13. +++ b/drivers/mfd/axp20x-i2c.c
  14. @@ -66,6 +66,7 @@ static const struct of_device_id axp20x_
  15. { .compatible = "x-powers,axp223", .data = (void *)AXP223_ID },
  16. { .compatible = "x-powers,axp803", .data = (void *)AXP803_ID },
  17. { .compatible = "x-powers,axp806", .data = (void *)AXP806_ID },
  18. + { .compatible = "x-powers,axp15060", .data = (void *)AXP15060_ID },
  19. { },
  20. };
  21. MODULE_DEVICE_TABLE(of, axp20x_i2c_of_match);
  22. @@ -79,6 +80,7 @@ static const struct i2c_device_id axp20x
  23. { "axp223", 0 },
  24. { "axp803", 0 },
  25. { "axp806", 0 },
  26. + { "axp15060", 0 },
  27. { },
  28. };
  29. MODULE_DEVICE_TABLE(i2c, axp20x_i2c_id);
  30. --- a/drivers/mfd/axp20x.c
  31. +++ b/drivers/mfd/axp20x.c
  32. @@ -23,7 +23,7 @@
  33. #include <linux/mfd/core.h>
  34. #include <linux/module.h>
  35. #include <linux/of_device.h>
  36. -#include <linux/pm_runtime.h>
  37. +#include <linux/reboot.h>
  38. #include <linux/regmap.h>
  39. #include <linux/regulator/consumer.h>
  40. @@ -34,15 +34,18 @@
  41. static const char * const axp20x_model_names[] = {
  42. "AXP152",
  43. + "AXP192",
  44. "AXP202",
  45. "AXP209",
  46. "AXP221",
  47. "AXP223",
  48. "AXP288",
  49. + "AXP313a",
  50. "AXP803",
  51. "AXP806",
  52. "AXP809",
  53. "AXP813",
  54. + "AXP15060",
  55. };
  56. static const struct regmap_range axp152_writeable_ranges[] = {
  57. @@ -92,6 +95,35 @@ static const struct regmap_access_table
  58. .n_yes_ranges = ARRAY_SIZE(axp20x_volatile_ranges),
  59. };
  60. +static const struct regmap_range axp192_writeable_ranges[] = {
  61. + regmap_reg_range(AXP192_DATACACHE(0), AXP192_DATACACHE(5)),
  62. + regmap_reg_range(AXP192_PWR_OUT_CTRL, AXP192_IRQ5_STATE),
  63. + regmap_reg_range(AXP20X_DCDC_MODE, AXP192_N_RSTO_CTRL),
  64. + regmap_reg_range(AXP20X_CC_CTRL, AXP20X_CC_CTRL),
  65. +};
  66. +
  67. +static const struct regmap_range axp192_volatile_ranges[] = {
  68. + regmap_reg_range(AXP20X_PWR_INPUT_STATUS, AXP192_USB_OTG_STATUS),
  69. + regmap_reg_range(AXP192_IRQ1_STATE, AXP192_IRQ4_STATE),
  70. + regmap_reg_range(AXP192_IRQ5_STATE, AXP192_IRQ5_STATE),
  71. + regmap_reg_range(AXP20X_ACIN_V_ADC_H, AXP20X_IPSOUT_V_HIGH_L),
  72. + regmap_reg_range(AXP20X_TIMER_CTRL, AXP20X_TIMER_CTRL),
  73. + regmap_reg_range(AXP192_GPIO2_0_STATE, AXP192_GPIO2_0_STATE),
  74. + regmap_reg_range(AXP192_GPIO4_3_STATE, AXP192_GPIO4_3_STATE),
  75. + regmap_reg_range(AXP192_N_RSTO_CTRL, AXP192_N_RSTO_CTRL),
  76. + regmap_reg_range(AXP20X_CHRG_CC_31_24, AXP20X_CC_CTRL),
  77. +};
  78. +
  79. +static const struct regmap_access_table axp192_writeable_table = {
  80. + .yes_ranges = axp192_writeable_ranges,
  81. + .n_yes_ranges = ARRAY_SIZE(axp192_writeable_ranges),
  82. +};
  83. +
  84. +static const struct regmap_access_table axp192_volatile_table = {
  85. + .yes_ranges = axp192_volatile_ranges,
  86. + .n_yes_ranges = ARRAY_SIZE(axp192_volatile_ranges),
  87. +};
  88. +
  89. /* AXP22x ranges are shared with the AXP809, as they cover the same range */
  90. static const struct regmap_range axp22x_writeable_ranges[] = {
  91. regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_IRQ5_STATE),
  92. @@ -119,6 +151,7 @@ static const struct regmap_access_table
  93. /* AXP288 ranges are shared with the AXP803, as they cover the same range */
  94. static const struct regmap_range axp288_writeable_ranges[] = {
  95. + regmap_reg_range(AXP288_POWER_REASON, AXP288_POWER_REASON),
  96. regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_IRQ6_STATE),
  97. regmap_reg_range(AXP20X_DCDC_MODE, AXP288_FG_TUNE5),
  98. };
  99. @@ -154,6 +187,25 @@ static const struct regmap_range axp806_
  100. regmap_reg_range(AXP806_REG_ADDR_EXT, AXP806_REG_ADDR_EXT),
  101. };
  102. +static const struct regmap_range axp313a_writeable_ranges[] = {
  103. + regmap_reg_range(AXP313A_ON_INDICATE, AXP313A_IRQ_STATE),
  104. +};
  105. +
  106. +static const struct regmap_range axp313a_volatile_ranges[] = {
  107. + regmap_reg_range(AXP313A_SHUTDOWN_CTRL, AXP313A_SHUTDOWN_CTRL),
  108. + regmap_reg_range(AXP313A_IRQ_STATE, AXP313A_IRQ_STATE),
  109. +};
  110. +
  111. +static const struct regmap_access_table axp313a_writeable_table = {
  112. + .yes_ranges = axp313a_writeable_ranges,
  113. + .n_yes_ranges = ARRAY_SIZE(axp313a_writeable_ranges),
  114. +};
  115. +
  116. +static const struct regmap_access_table axp313a_volatile_table = {
  117. + .yes_ranges = axp313a_volatile_ranges,
  118. + .n_yes_ranges = ARRAY_SIZE(axp313a_volatile_ranges),
  119. +};
  120. +
  121. static const struct regmap_range axp806_volatile_ranges[] = {
  122. regmap_reg_range(AXP20X_IRQ1_STATE, AXP20X_IRQ2_STATE),
  123. };
  124. @@ -168,11 +220,49 @@ static const struct regmap_access_table
  125. .n_yes_ranges = ARRAY_SIZE(axp806_volatile_ranges),
  126. };
  127. +static const struct regmap_range axp15060_writeable_ranges[] = {
  128. + regmap_reg_range(AXP15060_PWR_OUT_CTRL1, AXP15060_DCDC_MODE_CTRL2),
  129. + regmap_reg_range(AXP15060_OUTPUT_MONITOR_DISCHARGE, AXP15060_CPUSLDO_V_CTRL),
  130. + regmap_reg_range(AXP15060_PWR_WAKEUP_CTRL, AXP15060_PWR_DISABLE_DOWN_SEQ),
  131. + regmap_reg_range(AXP15060_PEK_KEY, AXP15060_PEK_KEY),
  132. + regmap_reg_range(AXP15060_IRQ1_EN, AXP15060_IRQ2_EN),
  133. + regmap_reg_range(AXP15060_IRQ1_STATE, AXP15060_IRQ2_STATE),
  134. +};
  135. +
  136. +static const struct regmap_range axp15060_volatile_ranges[] = {
  137. + regmap_reg_range(AXP15060_STARTUP_SRC, AXP15060_STARTUP_SRC),
  138. + regmap_reg_range(AXP15060_PWR_WAKEUP_CTRL, AXP15060_PWR_DISABLE_DOWN_SEQ),
  139. + regmap_reg_range(AXP15060_IRQ1_STATE, AXP15060_IRQ2_STATE),
  140. +};
  141. +
  142. +static const struct regmap_access_table axp15060_writeable_table = {
  143. + .yes_ranges = axp15060_writeable_ranges,
  144. + .n_yes_ranges = ARRAY_SIZE(axp15060_writeable_ranges),
  145. +};
  146. +
  147. +static const struct regmap_access_table axp15060_volatile_table = {
  148. + .yes_ranges = axp15060_volatile_ranges,
  149. + .n_yes_ranges = ARRAY_SIZE(axp15060_volatile_ranges),
  150. +};
  151. +
  152. static const struct resource axp152_pek_resources[] = {
  153. DEFINE_RES_IRQ_NAMED(AXP152_IRQ_PEK_RIS_EDGE, "PEK_DBR"),
  154. DEFINE_RES_IRQ_NAMED(AXP152_IRQ_PEK_FAL_EDGE, "PEK_DBF"),
  155. };
  156. +static const struct resource axp192_ac_power_supply_resources[] = {
  157. + DEFINE_RES_IRQ_NAMED(AXP192_IRQ_ACIN_PLUGIN, "ACIN_PLUGIN"),
  158. + DEFINE_RES_IRQ_NAMED(AXP192_IRQ_ACIN_REMOVAL, "ACIN_REMOVAL"),
  159. + DEFINE_RES_IRQ_NAMED(AXP192_IRQ_ACIN_OVER_V, "ACIN_OVER_V"),
  160. +};
  161. +
  162. +static const struct resource axp192_usb_power_supply_resources[] = {
  163. + DEFINE_RES_IRQ_NAMED(AXP192_IRQ_VBUS_PLUGIN, "VBUS_PLUGIN"),
  164. + DEFINE_RES_IRQ_NAMED(AXP192_IRQ_VBUS_REMOVAL, "VBUS_REMOVAL"),
  165. + DEFINE_RES_IRQ_NAMED(AXP192_IRQ_VBUS_VALID, "VBUS_VALID"),
  166. + DEFINE_RES_IRQ_NAMED(AXP192_IRQ_VBUS_NOT_VALID, "VBUS_NOT_VALID"),
  167. +};
  168. +
  169. static const struct resource axp20x_ac_power_supply_resources[] = {
  170. DEFINE_RES_IRQ_NAMED(AXP20X_IRQ_ACIN_PLUGIN, "ACIN_PLUGIN"),
  171. DEFINE_RES_IRQ_NAMED(AXP20X_IRQ_ACIN_REMOVAL, "ACIN_REMOVAL"),
  172. @@ -221,6 +311,11 @@ static const struct resource axp288_fuel
  173. DEFINE_RES_IRQ(AXP288_IRQ_WL1),
  174. };
  175. +static const struct resource axp313a_pek_resources[] = {
  176. + DEFINE_RES_IRQ_NAMED(AXP313A_IRQ_PEK_RIS_EDGE, "PEK_DBR"),
  177. + DEFINE_RES_IRQ_NAMED(AXP313A_IRQ_PEK_FAL_EDGE, "PEK_DBF"),
  178. +};
  179. +
  180. static const struct resource axp803_pek_resources[] = {
  181. DEFINE_RES_IRQ_NAMED(AXP803_IRQ_PEK_RIS_EDGE, "PEK_DBR"),
  182. DEFINE_RES_IRQ_NAMED(AXP803_IRQ_PEK_FAL_EDGE, "PEK_DBF"),
  183. @@ -236,6 +331,11 @@ static const struct resource axp809_pek_
  184. DEFINE_RES_IRQ_NAMED(AXP809_IRQ_PEK_FAL_EDGE, "PEK_DBF"),
  185. };
  186. +static const struct resource axp15060_pek_resources[] = {
  187. + DEFINE_RES_IRQ_NAMED(AXP15060_IRQ_PEK_RIS_EDGE, "PEK_DBR"),
  188. + DEFINE_RES_IRQ_NAMED(AXP15060_IRQ_PEK_FAL_EDGE, "PEK_DBF"),
  189. +};
  190. +
  191. static const struct regmap_config axp152_regmap_config = {
  192. .reg_bits = 8,
  193. .val_bits = 8,
  194. @@ -245,6 +345,15 @@ static const struct regmap_config axp152
  195. .cache_type = REGCACHE_RBTREE,
  196. };
  197. +static const struct regmap_config axp192_regmap_config = {
  198. + .reg_bits = 8,
  199. + .val_bits = 8,
  200. + .wr_table = &axp192_writeable_table,
  201. + .volatile_table = &axp192_volatile_table,
  202. + .max_register = AXP20X_CC_CTRL,
  203. + .cache_type = REGCACHE_RBTREE,
  204. +};
  205. +
  206. static const struct regmap_config axp20x_regmap_config = {
  207. .reg_bits = 8,
  208. .val_bits = 8,
  209. @@ -272,6 +381,15 @@ static const struct regmap_config axp288
  210. .cache_type = REGCACHE_RBTREE,
  211. };
  212. +static const struct regmap_config axp313a_regmap_config = {
  213. + .reg_bits = 8,
  214. + .val_bits = 8,
  215. + .wr_table = &axp313a_writeable_table,
  216. + .volatile_table = &axp313a_volatile_table,
  217. + .max_register = AXP313A_IRQ_STATE,
  218. + .cache_type = REGCACHE_RBTREE,
  219. +};
  220. +
  221. static const struct regmap_config axp806_regmap_config = {
  222. .reg_bits = 8,
  223. .val_bits = 8,
  224. @@ -281,6 +399,15 @@ static const struct regmap_config axp806
  225. .cache_type = REGCACHE_RBTREE,
  226. };
  227. +static const struct regmap_config axp15060_regmap_config = {
  228. + .reg_bits = 8,
  229. + .val_bits = 8,
  230. + .wr_table = &axp15060_writeable_table,
  231. + .volatile_table = &axp15060_volatile_table,
  232. + .max_register = AXP15060_IRQ2_STATE,
  233. + .cache_type = REGCACHE_RBTREE,
  234. +};
  235. +
  236. #define INIT_REGMAP_IRQ(_variant, _irq, _off, _mask) \
  237. [_variant##_IRQ_##_irq] = { .reg_offset = (_off), .mask = BIT(_mask) }
  238. @@ -304,6 +431,42 @@ static const struct regmap_irq axp152_re
  239. INIT_REGMAP_IRQ(AXP152, GPIO0_INPUT, 2, 0),
  240. };
  241. +static const struct regmap_irq axp192_regmap_irqs[] = {
  242. + INIT_REGMAP_IRQ(AXP192, ACIN_OVER_V, 0, 7),
  243. + INIT_REGMAP_IRQ(AXP192, ACIN_PLUGIN, 0, 6),
  244. + INIT_REGMAP_IRQ(AXP192, ACIN_REMOVAL, 0, 5),
  245. + INIT_REGMAP_IRQ(AXP192, VBUS_OVER_V, 0, 4),
  246. + INIT_REGMAP_IRQ(AXP192, VBUS_PLUGIN, 0, 3),
  247. + INIT_REGMAP_IRQ(AXP192, VBUS_REMOVAL, 0, 2),
  248. + INIT_REGMAP_IRQ(AXP192, VBUS_V_LOW, 0, 1),
  249. + INIT_REGMAP_IRQ(AXP192, BATT_PLUGIN, 1, 7),
  250. + INIT_REGMAP_IRQ(AXP192, BATT_REMOVAL, 1, 6),
  251. + INIT_REGMAP_IRQ(AXP192, BATT_ENT_ACT_MODE, 1, 5),
  252. + INIT_REGMAP_IRQ(AXP192, BATT_EXIT_ACT_MODE, 1, 4),
  253. + INIT_REGMAP_IRQ(AXP192, CHARG, 1, 3),
  254. + INIT_REGMAP_IRQ(AXP192, CHARG_DONE, 1, 2),
  255. + INIT_REGMAP_IRQ(AXP192, BATT_TEMP_HIGH, 1, 1),
  256. + INIT_REGMAP_IRQ(AXP192, BATT_TEMP_LOW, 1, 0),
  257. + INIT_REGMAP_IRQ(AXP192, DIE_TEMP_HIGH, 2, 7),
  258. + INIT_REGMAP_IRQ(AXP192, CHARG_I_LOW, 2, 6),
  259. + INIT_REGMAP_IRQ(AXP192, DCDC1_V_LONG, 2, 5),
  260. + INIT_REGMAP_IRQ(AXP192, DCDC2_V_LONG, 2, 4),
  261. + INIT_REGMAP_IRQ(AXP192, DCDC3_V_LONG, 2, 3),
  262. + INIT_REGMAP_IRQ(AXP192, PEK_SHORT, 2, 1),
  263. + INIT_REGMAP_IRQ(AXP192, PEK_LONG, 2, 0),
  264. + INIT_REGMAP_IRQ(AXP192, N_OE_PWR_ON, 3, 7),
  265. + INIT_REGMAP_IRQ(AXP192, N_OE_PWR_OFF, 3, 6),
  266. + INIT_REGMAP_IRQ(AXP192, VBUS_VALID, 3, 5),
  267. + INIT_REGMAP_IRQ(AXP192, VBUS_NOT_VALID, 3, 4),
  268. + INIT_REGMAP_IRQ(AXP192, VBUS_SESS_VALID, 3, 3),
  269. + INIT_REGMAP_IRQ(AXP192, VBUS_SESS_END, 3, 2),
  270. + INIT_REGMAP_IRQ(AXP192, LOW_PWR_LVL, 3, 0),
  271. + INIT_REGMAP_IRQ(AXP192, TIMER, 4, 7),
  272. + INIT_REGMAP_IRQ(AXP192, GPIO2_INPUT, 4, 2),
  273. + INIT_REGMAP_IRQ(AXP192, GPIO1_INPUT, 4, 1),
  274. + INIT_REGMAP_IRQ(AXP192, GPIO0_INPUT, 4, 0),
  275. +};
  276. +
  277. static const struct regmap_irq axp20x_regmap_irqs[] = {
  278. INIT_REGMAP_IRQ(AXP20X, ACIN_OVER_V, 0, 7),
  279. INIT_REGMAP_IRQ(AXP20X, ACIN_PLUGIN, 0, 6),
  280. @@ -415,6 +578,16 @@ static const struct regmap_irq axp288_re
  281. INIT_REGMAP_IRQ(AXP288, BC_USB_CHNG, 5, 1),
  282. };
  283. +static const struct regmap_irq axp313a_regmap_irqs[] = {
  284. + INIT_REGMAP_IRQ(AXP313A, PEK_RIS_EDGE, 0, 7),
  285. + INIT_REGMAP_IRQ(AXP313A, PEK_FAL_EDGE, 0, 6),
  286. + INIT_REGMAP_IRQ(AXP313A, PEK_SHORT, 0, 5),
  287. + INIT_REGMAP_IRQ(AXP313A, PEK_LONG, 0, 4),
  288. + INIT_REGMAP_IRQ(AXP313A, DCDC3_V_LOW, 0, 3),
  289. + INIT_REGMAP_IRQ(AXP313A, DCDC2_V_LOW, 0, 2),
  290. + INIT_REGMAP_IRQ(AXP313A, DIE_TEMP_HIGH, 0, 0),
  291. +};
  292. +
  293. static const struct regmap_irq axp803_regmap_irqs[] = {
  294. INIT_REGMAP_IRQ(AXP803, ACIN_OVER_V, 0, 7),
  295. INIT_REGMAP_IRQ(AXP803, ACIN_PLUGIN, 0, 6),
  296. @@ -502,24 +675,65 @@ static const struct regmap_irq axp809_re
  297. INIT_REGMAP_IRQ(AXP809, GPIO0_INPUT, 4, 0),
  298. };
  299. +static const struct regmap_irq axp15060_regmap_irqs[] = {
  300. + INIT_REGMAP_IRQ(AXP15060, DIE_TEMP_HIGH_LV1, 0, 0),
  301. + INIT_REGMAP_IRQ(AXP15060, DIE_TEMP_HIGH_LV2, 0, 1),
  302. + INIT_REGMAP_IRQ(AXP15060, DCDC1_V_LOW, 0, 2),
  303. + INIT_REGMAP_IRQ(AXP15060, DCDC2_V_LOW, 0, 3),
  304. + INIT_REGMAP_IRQ(AXP15060, DCDC3_V_LOW, 0, 4),
  305. + INIT_REGMAP_IRQ(AXP15060, DCDC4_V_LOW, 0, 5),
  306. + INIT_REGMAP_IRQ(AXP15060, DCDC5_V_LOW, 0, 6),
  307. + INIT_REGMAP_IRQ(AXP15060, DCDC6_V_LOW, 0, 7),
  308. + INIT_REGMAP_IRQ(AXP15060, PEK_LONG, 1, 0),
  309. + INIT_REGMAP_IRQ(AXP15060, PEK_SHORT, 1, 1),
  310. + INIT_REGMAP_IRQ(AXP15060, GPIO1_INPUT, 1, 2),
  311. + INIT_REGMAP_IRQ(AXP15060, PEK_FAL_EDGE, 1, 3),
  312. + INIT_REGMAP_IRQ(AXP15060, PEK_RIS_EDGE, 1, 4),
  313. + INIT_REGMAP_IRQ(AXP15060, GPIO2_INPUT, 1, 5),
  314. +};
  315. +
  316. static const struct regmap_irq_chip axp152_regmap_irq_chip = {
  317. .name = "axp152_irq_chip",
  318. .status_base = AXP152_IRQ1_STATE,
  319. .ack_base = AXP152_IRQ1_STATE,
  320. - .mask_base = AXP152_IRQ1_EN,
  321. - .mask_invert = true,
  322. + .unmask_base = AXP152_IRQ1_EN,
  323. .init_ack_masked = true,
  324. .irqs = axp152_regmap_irqs,
  325. .num_irqs = ARRAY_SIZE(axp152_regmap_irqs),
  326. .num_regs = 3,
  327. };
  328. +static unsigned int axp192_get_irq_reg(struct regmap_irq_chip_data *data,
  329. + unsigned int base, int index)
  330. +{
  331. + /* linear mapping for IRQ1 to IRQ4 */
  332. + if (index < 4)
  333. + return base + index;
  334. +
  335. + /* handle IRQ5 separately */
  336. + if (base == AXP192_IRQ1_EN)
  337. + return AXP192_IRQ5_EN;
  338. +
  339. + return AXP192_IRQ5_STATE;
  340. +}
  341. +
  342. +static const struct regmap_irq_chip axp192_regmap_irq_chip = {
  343. + .name = "axp192_irq_chip",
  344. + .status_base = AXP192_IRQ1_STATE,
  345. + .ack_base = AXP192_IRQ1_STATE,
  346. + .unmask_base = AXP192_IRQ1_EN,
  347. + .init_ack_masked = true,
  348. + .irqs = axp192_regmap_irqs,
  349. + .num_irqs = ARRAY_SIZE(axp192_regmap_irqs),
  350. + .num_regs = 5,
  351. + .get_irq_reg = axp192_get_irq_reg,
  352. +};
  353. +
  354. static const struct regmap_irq_chip axp20x_regmap_irq_chip = {
  355. .name = "axp20x_irq_chip",
  356. .status_base = AXP20X_IRQ1_STATE,
  357. .ack_base = AXP20X_IRQ1_STATE,
  358. - .mask_base = AXP20X_IRQ1_EN,
  359. - .mask_invert = true,
  360. + .unmask_base = AXP20X_IRQ1_EN,
  361. .init_ack_masked = true,
  362. .irqs = axp20x_regmap_irqs,
  363. .num_irqs = ARRAY_SIZE(axp20x_regmap_irqs),
  364. @@ -531,8 +745,7 @@ static const struct regmap_irq_chip axp2
  365. .name = "axp22x_irq_chip",
  366. .status_base = AXP20X_IRQ1_STATE,
  367. .ack_base = AXP20X_IRQ1_STATE,
  368. - .mask_base = AXP20X_IRQ1_EN,
  369. - .mask_invert = true,
  370. + .unmask_base = AXP20X_IRQ1_EN,
  371. .init_ack_masked = true,
  372. .irqs = axp22x_regmap_irqs,
  373. .num_irqs = ARRAY_SIZE(axp22x_regmap_irqs),
  374. @@ -543,8 +756,7 @@ static const struct regmap_irq_chip axp2
  375. .name = "axp288_irq_chip",
  376. .status_base = AXP20X_IRQ1_STATE,
  377. .ack_base = AXP20X_IRQ1_STATE,
  378. - .mask_base = AXP20X_IRQ1_EN,
  379. - .mask_invert = true,
  380. + .unmask_base = AXP20X_IRQ1_EN,
  381. .init_ack_masked = true,
  382. .irqs = axp288_regmap_irqs,
  383. .num_irqs = ARRAY_SIZE(axp288_regmap_irqs),
  384. @@ -552,12 +764,22 @@ static const struct regmap_irq_chip axp2
  385. };
  386. +static const struct regmap_irq_chip axp313a_regmap_irq_chip = {
  387. + .name = "axp313a_irq_chip",
  388. + .status_base = AXP313A_IRQ_STATE,
  389. + .ack_base = AXP313A_IRQ_STATE,
  390. + .unmask_base = AXP313A_IRQ_EN,
  391. + .init_ack_masked = true,
  392. + .irqs = axp313a_regmap_irqs,
  393. + .num_irqs = ARRAY_SIZE(axp313a_regmap_irqs),
  394. + .num_regs = 1,
  395. +};
  396. +
  397. static const struct regmap_irq_chip axp803_regmap_irq_chip = {
  398. .name = "axp803",
  399. .status_base = AXP20X_IRQ1_STATE,
  400. .ack_base = AXP20X_IRQ1_STATE,
  401. - .mask_base = AXP20X_IRQ1_EN,
  402. - .mask_invert = true,
  403. + .unmask_base = AXP20X_IRQ1_EN,
  404. .init_ack_masked = true,
  405. .irqs = axp803_regmap_irqs,
  406. .num_irqs = ARRAY_SIZE(axp803_regmap_irqs),
  407. @@ -568,8 +790,7 @@ static const struct regmap_irq_chip axp8
  408. .name = "axp806",
  409. .status_base = AXP20X_IRQ1_STATE,
  410. .ack_base = AXP20X_IRQ1_STATE,
  411. - .mask_base = AXP20X_IRQ1_EN,
  412. - .mask_invert = true,
  413. + .unmask_base = AXP20X_IRQ1_EN,
  414. .init_ack_masked = true,
  415. .irqs = axp806_regmap_irqs,
  416. .num_irqs = ARRAY_SIZE(axp806_regmap_irqs),
  417. @@ -580,14 +801,45 @@ static const struct regmap_irq_chip axp8
  418. .name = "axp809",
  419. .status_base = AXP20X_IRQ1_STATE,
  420. .ack_base = AXP20X_IRQ1_STATE,
  421. - .mask_base = AXP20X_IRQ1_EN,
  422. - .mask_invert = true,
  423. + .unmask_base = AXP20X_IRQ1_EN,
  424. .init_ack_masked = true,
  425. .irqs = axp809_regmap_irqs,
  426. .num_irqs = ARRAY_SIZE(axp809_regmap_irqs),
  427. .num_regs = 5,
  428. };
  429. +static const struct regmap_irq_chip axp15060_regmap_irq_chip = {
  430. + .name = "axp15060",
  431. + .status_base = AXP15060_IRQ1_STATE,
  432. + .ack_base = AXP15060_IRQ1_STATE,
  433. + .unmask_base = AXP15060_IRQ1_EN,
  434. + .init_ack_masked = true,
  435. + .irqs = axp15060_regmap_irqs,
  436. + .num_irqs = ARRAY_SIZE(axp15060_regmap_irqs),
  437. + .num_regs = 2,
  438. +};
  439. +
  440. +static const struct mfd_cell axp192_cells[] = {
  441. + {
  442. + .name = "axp192-adc",
  443. + .of_compatible = "x-powers,axp192-adc",
  444. + }, {
  445. + .name = "axp20x-battery-power-supply",
  446. + .of_compatible = "x-powers,axp192-battery-power-supply",
  447. + }, {
  448. + .name = "axp20x-ac-power-supply",
  449. + .of_compatible = "x-powers,axp202-ac-power-supply",
  450. + .num_resources = ARRAY_SIZE(axp192_ac_power_supply_resources),
  451. + .resources = axp192_ac_power_supply_resources,
  452. + }, {
  453. + .name = "axp20x-usb-power-supply",
  454. + .of_compatible = "x-powers,axp192-usb-power-supply",
  455. + .num_resources = ARRAY_SIZE(axp192_usb_power_supply_resources),
  456. + .resources = axp192_usb_power_supply_resources,
  457. + },
  458. + { .name = "axp20x-regulator" },
  459. +};
  460. +
  461. static const struct mfd_cell axp20x_cells[] = {
  462. {
  463. .name = "axp20x-gpio",
  464. @@ -683,6 +935,11 @@ static const struct mfd_cell axp152_cell
  465. },
  466. };
  467. +static struct mfd_cell axp313a_cells[] = {
  468. + MFD_CELL_NAME("axp20x-regulator"),
  469. + MFD_CELL_RES("axp313a-pek", axp313a_pek_resources),
  470. +};
  471. +
  472. static const struct resource axp288_adc_resources[] = {
  473. DEFINE_RES_IRQ_NAMED(AXP288_IRQ_GPADC, "GPADC"),
  474. };
  475. @@ -832,17 +1089,43 @@ static const struct mfd_cell axp813_cell
  476. },
  477. };
  478. -static struct axp20x_dev *axp20x_pm_power_off;
  479. -static void axp20x_power_off(void)
  480. +static const struct mfd_cell axp15060_cells[] = {
  481. + {
  482. + .name = "axp221-pek",
  483. + .num_resources = ARRAY_SIZE(axp15060_pek_resources),
  484. + .resources = axp15060_pek_resources,
  485. + }, {
  486. + .name = "axp20x-regulator",
  487. + },
  488. +};
  489. +
  490. +/* For boards that don't have IRQ line connected to SOC. */
  491. +static const struct mfd_cell axp_regulator_only_cells[] = {
  492. + {
  493. + .name = "axp20x-regulator",
  494. + },
  495. +};
  496. +
  497. +static int axp20x_power_off(struct sys_off_data *data)
  498. {
  499. - if (axp20x_pm_power_off->variant == AXP288_ID)
  500. - return;
  501. + struct axp20x_dev *axp20x = data->cb_data;
  502. + unsigned int shutdown_reg;
  503. - regmap_write(axp20x_pm_power_off->regmap, AXP20X_OFF_CTRL,
  504. - AXP20X_OFF);
  505. + switch (axp20x->variant) {
  506. + case AXP313A_ID:
  507. + shutdown_reg = AXP313A_SHUTDOWN_CTRL;
  508. + break;
  509. + default:
  510. + shutdown_reg = AXP20X_OFF_CTRL;
  511. + break;
  512. + }
  513. +
  514. + regmap_write(axp20x->regmap, shutdown_reg, AXP20X_OFF);
  515. /* Give capacitors etc. time to drain to avoid kernel panic msg. */
  516. mdelay(500);
  517. +
  518. + return NOTIFY_DONE;
  519. }
  520. int axp20x_match_device(struct axp20x_dev *axp20x)
  521. @@ -874,6 +1157,12 @@ int axp20x_match_device(struct axp20x_de
  522. axp20x->regmap_cfg = &axp152_regmap_config;
  523. axp20x->regmap_irq_chip = &axp152_regmap_irq_chip;
  524. break;
  525. + case AXP192_ID:
  526. + axp20x->nr_cells = ARRAY_SIZE(axp192_cells);
  527. + axp20x->cells = axp192_cells;
  528. + axp20x->regmap_cfg = &axp192_regmap_config;
  529. + axp20x->regmap_irq_chip = &axp192_regmap_irq_chip;
  530. + break;
  531. case AXP202_ID:
  532. case AXP209_ID:
  533. axp20x->nr_cells = ARRAY_SIZE(axp20x_cells);
  534. @@ -900,6 +1189,12 @@ int axp20x_match_device(struct axp20x_de
  535. axp20x->regmap_irq_chip = &axp288_regmap_irq_chip;
  536. axp20x->irq_flags = IRQF_TRIGGER_LOW;
  537. break;
  538. + case AXP313A_ID:
  539. + axp20x->nr_cells = ARRAY_SIZE(axp313a_cells);
  540. + axp20x->cells = axp313a_cells;
  541. + axp20x->regmap_cfg = &axp313a_regmap_config;
  542. + axp20x->regmap_irq_chip = &axp313a_regmap_irq_chip;
  543. + break;
  544. case AXP803_ID:
  545. axp20x->nr_cells = ARRAY_SIZE(axp803_cells);
  546. axp20x->cells = axp803_cells;
  547. @@ -942,6 +1237,28 @@ int axp20x_match_device(struct axp20x_de
  548. */
  549. axp20x->regmap_irq_chip = &axp803_regmap_irq_chip;
  550. break;
  551. + case AXP15060_ID:
  552. + /*
  553. + * Don't register the power key part if there is no interrupt
  554. + * line.
  555. + *
  556. + * Since most use cases of AXP PMICs are Allwinner SOCs, board
  557. + * designers follow Allwinner's reference design and connects
  558. + * IRQ line to SOC, there's no need for those variants to deal
  559. + * with cases that IRQ isn't connected. However, AXP15660 is
  560. + * used by some other vendors' SOCs that didn't connect IRQ
  561. + * line, we need to deal with this case.
  562. + */
  563. + if (axp20x->irq > 0) {
  564. + axp20x->nr_cells = ARRAY_SIZE(axp15060_cells);
  565. + axp20x->cells = axp15060_cells;
  566. + } else {
  567. + axp20x->nr_cells = ARRAY_SIZE(axp_regulator_only_cells);
  568. + axp20x->cells = axp_regulator_only_cells;
  569. + }
  570. + axp20x->regmap_cfg = &axp15060_regmap_config;
  571. + axp20x->regmap_irq_chip = &axp15060_regmap_irq_chip;
  572. + break;
  573. default:
  574. dev_err(dev, "unsupported AXP20X ID %lu\n", axp20x->variant);
  575. return -EINVAL;
  576. @@ -1009,10 +1326,11 @@ int axp20x_device_probe(struct axp20x_de
  577. return ret;
  578. }
  579. - if (!pm_power_off) {
  580. - axp20x_pm_power_off = axp20x;
  581. - pm_power_off = axp20x_power_off;
  582. - }
  583. + if (axp20x->variant != AXP288_ID)
  584. + devm_register_sys_off_handler(axp20x->dev,
  585. + SYS_OFF_MODE_POWER_OFF,
  586. + SYS_OFF_PRIO_DEFAULT,
  587. + axp20x_power_off, axp20x);
  588. dev_info(axp20x->dev, "AXP20X driver loaded\n");
  589. @@ -1022,11 +1340,6 @@ EXPORT_SYMBOL(axp20x_device_probe);
  590. void axp20x_device_remove(struct axp20x_dev *axp20x)
  591. {
  592. - if (axp20x == axp20x_pm_power_off) {
  593. - axp20x_pm_power_off = NULL;
  594. - pm_power_off = NULL;
  595. - }
  596. -
  597. mfd_remove_devices(axp20x->dev);
  598. regmap_del_irq_chip(axp20x->irq, axp20x->regmap_irqc);
  599. }
  600. --- a/include/linux/mfd/axp20x.h
  601. +++ b/include/linux/mfd/axp20x.h
  602. @@ -12,18 +12,22 @@
  603. enum axp20x_variants {
  604. AXP152_ID = 0,
  605. + AXP192_ID,
  606. AXP202_ID,
  607. AXP209_ID,
  608. AXP221_ID,
  609. AXP223_ID,
  610. AXP288_ID,
  611. + AXP313A_ID,
  612. AXP803_ID,
  613. AXP806_ID,
  614. AXP809_ID,
  615. AXP813_ID,
  616. + AXP15060_ID,
  617. NR_AXP20X_VARIANTS,
  618. };
  619. +#define AXP192_DATACACHE(m) (0x06 + (m))
  620. #define AXP20X_DATACACHE(m) (0x04 + (m))
  621. /* Power supply */
  622. @@ -45,6 +49,13 @@ enum axp20x_variants {
  623. #define AXP152_DCDC_FREQ 0x37
  624. #define AXP152_DCDC_MODE 0x80
  625. +#define AXP192_USB_OTG_STATUS 0x04
  626. +#define AXP192_PWR_OUT_CTRL 0x12
  627. +#define AXP192_DCDC2_V_OUT 0x23
  628. +#define AXP192_DCDC1_V_OUT 0x26
  629. +#define AXP192_DCDC3_V_OUT 0x27
  630. +#define AXP192_LDO2_3_V_OUT 0x28
  631. +
  632. #define AXP20X_PWR_INPUT_STATUS 0x00
  633. #define AXP20X_PWR_OP_MODE 0x01
  634. #define AXP20X_USB_OTG_STATUS 0x02
  635. @@ -91,6 +102,17 @@ enum axp20x_variants {
  636. #define AXP22X_ALDO3_V_OUT 0x2a
  637. #define AXP22X_CHRG_CTRL3 0x35
  638. +#define AXP313A_ON_INDICATE 0x00
  639. +#define AXP313A_OUTPUT_CONTROL 0x10
  640. +#define AXP313A_DCDC1_CONRTOL 0x13
  641. +#define AXP313A_DCDC2_CONRTOL 0x14
  642. +#define AXP313A_DCDC3_CONRTOL 0x15
  643. +#define AXP313A_ALDO1_CONRTOL 0x16
  644. +#define AXP313A_DLDO1_CONRTOL 0x17
  645. +#define AXP313A_SHUTDOWN_CTRL 0x1a
  646. +#define AXP313A_IRQ_EN 0x20
  647. +#define AXP313A_IRQ_STATE 0x21
  648. +
  649. #define AXP806_STARTUP_SRC 0x00
  650. #define AXP806_CHIP_ID 0x03
  651. #define AXP806_PWR_OUT_CTRL1 0x10
  652. @@ -131,6 +153,39 @@ enum axp20x_variants {
  653. /* Other DCDC regulator control registers are the same as AXP803 */
  654. #define AXP813_DCDC7_V_OUT 0x26
  655. +#define AXP15060_STARTUP_SRC 0x00
  656. +#define AXP15060_PWR_OUT_CTRL1 0x10
  657. +#define AXP15060_PWR_OUT_CTRL2 0x11
  658. +#define AXP15060_PWR_OUT_CTRL3 0x12
  659. +#define AXP15060_DCDC1_V_CTRL 0x13
  660. +#define AXP15060_DCDC2_V_CTRL 0x14
  661. +#define AXP15060_DCDC3_V_CTRL 0x15
  662. +#define AXP15060_DCDC4_V_CTRL 0x16
  663. +#define AXP15060_DCDC5_V_CTRL 0x17
  664. +#define AXP15060_DCDC6_V_CTRL 0x18
  665. +#define AXP15060_ALDO1_V_CTRL 0x19
  666. +#define AXP15060_DCDC_MODE_CTRL1 0x1a
  667. +#define AXP15060_DCDC_MODE_CTRL2 0x1b
  668. +#define AXP15060_OUTPUT_MONITOR_DISCHARGE 0x1e
  669. +#define AXP15060_IRQ_PWROK_VOFF 0x1f
  670. +#define AXP15060_ALDO2_V_CTRL 0x20
  671. +#define AXP15060_ALDO3_V_CTRL 0x21
  672. +#define AXP15060_ALDO4_V_CTRL 0x22
  673. +#define AXP15060_ALDO5_V_CTRL 0x23
  674. +#define AXP15060_BLDO1_V_CTRL 0x24
  675. +#define AXP15060_BLDO2_V_CTRL 0x25
  676. +#define AXP15060_BLDO3_V_CTRL 0x26
  677. +#define AXP15060_BLDO4_V_CTRL 0x27
  678. +#define AXP15060_BLDO5_V_CTRL 0x28
  679. +#define AXP15060_CLDO1_V_CTRL 0x29
  680. +#define AXP15060_CLDO2_V_CTRL 0x2a
  681. +#define AXP15060_CLDO3_V_CTRL 0x2b
  682. +#define AXP15060_CLDO4_V_CTRL 0x2d
  683. +#define AXP15060_CPUSLDO_V_CTRL 0x2e
  684. +#define AXP15060_PWR_WAKEUP_CTRL 0x31
  685. +#define AXP15060_PWR_DISABLE_DOWN_SEQ 0x32
  686. +#define AXP15060_PEK_KEY 0x36
  687. +
  688. /* Interrupt */
  689. #define AXP152_IRQ1_EN 0x40
  690. #define AXP152_IRQ2_EN 0x41
  691. @@ -139,6 +194,17 @@ enum axp20x_variants {
  692. #define AXP152_IRQ2_STATE 0x49
  693. #define AXP152_IRQ3_STATE 0x4a
  694. +#define AXP192_IRQ1_EN 0x40
  695. +#define AXP192_IRQ2_EN 0x41
  696. +#define AXP192_IRQ3_EN 0x42
  697. +#define AXP192_IRQ4_EN 0x43
  698. +#define AXP192_IRQ1_STATE 0x44
  699. +#define AXP192_IRQ2_STATE 0x45
  700. +#define AXP192_IRQ3_STATE 0x46
  701. +#define AXP192_IRQ4_STATE 0x47
  702. +#define AXP192_IRQ5_EN 0x4a
  703. +#define AXP192_IRQ5_STATE 0x4d
  704. +
  705. #define AXP20X_IRQ1_EN 0x40
  706. #define AXP20X_IRQ2_EN 0x41
  707. #define AXP20X_IRQ3_EN 0x42
  708. @@ -152,7 +218,17 @@ enum axp20x_variants {
  709. #define AXP20X_IRQ5_STATE 0x4c
  710. #define AXP20X_IRQ6_STATE 0x4d
  711. +#define AXP15060_IRQ1_EN 0x40
  712. +#define AXP15060_IRQ2_EN 0x41
  713. +#define AXP15060_IRQ1_STATE 0x48
  714. +#define AXP15060_IRQ2_STATE 0x49
  715. +
  716. /* ADC */
  717. +#define AXP192_GPIO2_V_ADC_H 0x68
  718. +#define AXP192_GPIO2_V_ADC_L 0x69
  719. +#define AXP192_GPIO3_V_ADC_H 0x6a
  720. +#define AXP192_GPIO3_V_ADC_L 0x6b
  721. +
  722. #define AXP20X_ACIN_V_ADC_H 0x56
  723. #define AXP20X_ACIN_V_ADC_L 0x57
  724. #define AXP20X_ACIN_I_ADC_H 0x58
  725. @@ -182,6 +258,8 @@ enum axp20x_variants {
  726. #define AXP20X_IPSOUT_V_HIGH_L 0x7f
  727. /* Power supply */
  728. +#define AXP192_GPIO30_IN_RANGE 0x85
  729. +
  730. #define AXP20X_DCDC_MODE 0x80
  731. #define AXP20X_ADC_EN1 0x82
  732. #define AXP20X_ADC_EN2 0x83
  733. @@ -210,6 +288,16 @@ enum axp20x_variants {
  734. #define AXP152_PWM1_FREQ_Y 0x9c
  735. #define AXP152_PWM1_DUTY_CYCLE 0x9d
  736. +#define AXP192_GPIO0_CTRL 0x90
  737. +#define AXP192_LDO_IO0_V_OUT 0x91
  738. +#define AXP192_GPIO1_CTRL 0x92
  739. +#define AXP192_GPIO2_CTRL 0x93
  740. +#define AXP192_GPIO2_0_STATE 0x94
  741. +#define AXP192_GPIO4_3_CTRL 0x95
  742. +#define AXP192_GPIO4_3_STATE 0x96
  743. +#define AXP192_GPIO2_0_PULL 0x97
  744. +#define AXP192_N_RSTO_CTRL 0x9e
  745. +
  746. #define AXP20X_GPIO0_CTRL 0x90
  747. #define AXP20X_LDO5_V_OUT 0x91
  748. #define AXP20X_GPIO1_CTRL 0x92
  749. @@ -222,6 +310,8 @@ enum axp20x_variants {
  750. #define AXP22X_GPIO_STATE 0x94
  751. #define AXP22X_GPIO_PULL_DOWN 0x95
  752. +#define AXP15060_CLDO4_GPIO2_MODESET 0x2c
  753. +
  754. /* Battery */
  755. #define AXP20X_CHRG_CC_31_24 0xb0
  756. #define AXP20X_CHRG_CC_23_16 0xb1
  757. @@ -288,6 +378,17 @@ enum axp20x_variants {
  758. /* Regulators IDs */
  759. enum {
  760. + AXP192_DCDC1 = 0,
  761. + AXP192_DCDC2,
  762. + AXP192_DCDC3,
  763. + AXP192_LDO1,
  764. + AXP192_LDO2,
  765. + AXP192_LDO3,
  766. + AXP192_LDO_IO0,
  767. + AXP192_REG_ID_MAX
  768. +};
  769. +
  770. +enum {
  771. AXP20X_LDO1 = 0,
  772. AXP20X_LDO2,
  773. AXP20X_LDO3,
  774. @@ -323,6 +424,16 @@ enum {
  775. };
  776. enum {
  777. + AXP313A_DCDC1 = 0,
  778. + AXP313A_DCDC2,
  779. + AXP313A_DCDC3,
  780. + AXP313A_ALDO1,
  781. + AXP313A_DLDO1,
  782. + AXP313A_RTC_LDO,
  783. + AXP313A_REG_ID_MAX,
  784. +};
  785. +
  786. +enum {
  787. AXP806_DCDCA = 0,
  788. AXP806_DCDCB,
  789. AXP806_DCDCC,
  790. @@ -419,6 +530,33 @@ enum {
  791. AXP813_REG_ID_MAX,
  792. };
  793. +enum {
  794. + AXP15060_DCDC1 = 0,
  795. + AXP15060_DCDC2,
  796. + AXP15060_DCDC3,
  797. + AXP15060_DCDC4,
  798. + AXP15060_DCDC5,
  799. + AXP15060_DCDC6,
  800. + AXP15060_ALDO1,
  801. + AXP15060_ALDO2,
  802. + AXP15060_ALDO3,
  803. + AXP15060_ALDO4,
  804. + AXP15060_ALDO5,
  805. + AXP15060_BLDO1,
  806. + AXP15060_BLDO2,
  807. + AXP15060_BLDO3,
  808. + AXP15060_BLDO4,
  809. + AXP15060_BLDO5,
  810. + AXP15060_CLDO1,
  811. + AXP15060_CLDO2,
  812. + AXP15060_CLDO3,
  813. + AXP15060_CLDO4,
  814. + AXP15060_CPUSLDO,
  815. + AXP15060_SW,
  816. + AXP15060_RTC_LDO,
  817. + AXP15060_REG_ID_MAX,
  818. +};
  819. +
  820. /* IRQs */
  821. enum {
  822. AXP152_IRQ_LDO0IN_CONNECT = 1,
  823. @@ -432,14 +570,51 @@ enum {
  824. AXP152_IRQ_PEK_SHORT,
  825. AXP152_IRQ_PEK_LONG,
  826. AXP152_IRQ_TIMER,
  827. - AXP152_IRQ_PEK_RIS_EDGE,
  828. + /* out of bit order to make sure the press event is handled first */
  829. AXP152_IRQ_PEK_FAL_EDGE,
  830. + AXP152_IRQ_PEK_RIS_EDGE,
  831. AXP152_IRQ_GPIO3_INPUT,
  832. AXP152_IRQ_GPIO2_INPUT,
  833. AXP152_IRQ_GPIO1_INPUT,
  834. AXP152_IRQ_GPIO0_INPUT,
  835. };
  836. +enum axp192_irqs {
  837. + AXP192_IRQ_ACIN_OVER_V = 1,
  838. + AXP192_IRQ_ACIN_PLUGIN,
  839. + AXP192_IRQ_ACIN_REMOVAL,
  840. + AXP192_IRQ_VBUS_OVER_V,
  841. + AXP192_IRQ_VBUS_PLUGIN,
  842. + AXP192_IRQ_VBUS_REMOVAL,
  843. + AXP192_IRQ_VBUS_V_LOW,
  844. + AXP192_IRQ_BATT_PLUGIN,
  845. + AXP192_IRQ_BATT_REMOVAL,
  846. + AXP192_IRQ_BATT_ENT_ACT_MODE,
  847. + AXP192_IRQ_BATT_EXIT_ACT_MODE,
  848. + AXP192_IRQ_CHARG,
  849. + AXP192_IRQ_CHARG_DONE,
  850. + AXP192_IRQ_BATT_TEMP_HIGH,
  851. + AXP192_IRQ_BATT_TEMP_LOW,
  852. + AXP192_IRQ_DIE_TEMP_HIGH,
  853. + AXP192_IRQ_CHARG_I_LOW,
  854. + AXP192_IRQ_DCDC1_V_LONG,
  855. + AXP192_IRQ_DCDC2_V_LONG,
  856. + AXP192_IRQ_DCDC3_V_LONG,
  857. + AXP192_IRQ_PEK_SHORT = 22,
  858. + AXP192_IRQ_PEK_LONG,
  859. + AXP192_IRQ_N_OE_PWR_ON,
  860. + AXP192_IRQ_N_OE_PWR_OFF,
  861. + AXP192_IRQ_VBUS_VALID,
  862. + AXP192_IRQ_VBUS_NOT_VALID,
  863. + AXP192_IRQ_VBUS_SESS_VALID,
  864. + AXP192_IRQ_VBUS_SESS_END,
  865. + AXP192_IRQ_LOW_PWR_LVL = 31,
  866. + AXP192_IRQ_TIMER,
  867. + AXP192_IRQ_GPIO2_INPUT = 37,
  868. + AXP192_IRQ_GPIO1_INPUT,
  869. + AXP192_IRQ_GPIO0_INPUT,
  870. +};
  871. +
  872. enum {
  873. AXP20X_IRQ_ACIN_OVER_V = 1,
  874. AXP20X_IRQ_ACIN_PLUGIN,
  875. @@ -472,8 +647,9 @@ enum {
  876. AXP20X_IRQ_LOW_PWR_LVL1,
  877. AXP20X_IRQ_LOW_PWR_LVL2,
  878. AXP20X_IRQ_TIMER,
  879. - AXP20X_IRQ_PEK_RIS_EDGE,
  880. + /* out of bit order to make sure the press event is handled first */
  881. AXP20X_IRQ_PEK_FAL_EDGE,
  882. + AXP20X_IRQ_PEK_RIS_EDGE,
  883. AXP20X_IRQ_GPIO3_INPUT,
  884. AXP20X_IRQ_GPIO2_INPUT,
  885. AXP20X_IRQ_GPIO1_INPUT,
  886. @@ -502,8 +678,9 @@ enum axp22x_irqs {
  887. AXP22X_IRQ_LOW_PWR_LVL1,
  888. AXP22X_IRQ_LOW_PWR_LVL2,
  889. AXP22X_IRQ_TIMER,
  890. - AXP22X_IRQ_PEK_RIS_EDGE,
  891. + /* out of bit order to make sure the press event is handled first */
  892. AXP22X_IRQ_PEK_FAL_EDGE,
  893. + AXP22X_IRQ_PEK_RIS_EDGE,
  894. AXP22X_IRQ_GPIO1_INPUT,
  895. AXP22X_IRQ_GPIO0_INPUT,
  896. };
  897. @@ -545,6 +722,16 @@ enum axp288_irqs {
  898. AXP288_IRQ_BC_USB_CHNG,
  899. };
  900. +enum axp313a_irqs {
  901. + AXP313A_IRQ_DIE_TEMP_HIGH,
  902. + AXP313A_IRQ_DCDC2_V_LOW = 2,
  903. + AXP313A_IRQ_DCDC3_V_LOW,
  904. + AXP313A_IRQ_PEK_LONG,
  905. + AXP313A_IRQ_PEK_SHORT,
  906. + AXP313A_IRQ_PEK_FAL_EDGE,
  907. + AXP313A_IRQ_PEK_RIS_EDGE,
  908. +};
  909. +
  910. enum axp803_irqs {
  911. AXP803_IRQ_ACIN_OVER_V = 1,
  912. AXP803_IRQ_ACIN_PLUGIN,
  913. @@ -571,8 +758,9 @@ enum axp803_irqs {
  914. AXP803_IRQ_LOW_PWR_LVL1,
  915. AXP803_IRQ_LOW_PWR_LVL2,
  916. AXP803_IRQ_TIMER,
  917. - AXP803_IRQ_PEK_RIS_EDGE,
  918. + /* out of bit order to make sure the press event is handled first */
  919. AXP803_IRQ_PEK_FAL_EDGE,
  920. + AXP803_IRQ_PEK_RIS_EDGE,
  921. AXP803_IRQ_PEK_SHORT,
  922. AXP803_IRQ_PEK_LONG,
  923. AXP803_IRQ_PEK_OVER_OFF,
  924. @@ -623,8 +811,9 @@ enum axp809_irqs {
  925. AXP809_IRQ_LOW_PWR_LVL1,
  926. AXP809_IRQ_LOW_PWR_LVL2,
  927. AXP809_IRQ_TIMER,
  928. - AXP809_IRQ_PEK_RIS_EDGE,
  929. + /* out of bit order to make sure the press event is handled first */
  930. AXP809_IRQ_PEK_FAL_EDGE,
  931. + AXP809_IRQ_PEK_RIS_EDGE,
  932. AXP809_IRQ_PEK_SHORT,
  933. AXP809_IRQ_PEK_LONG,
  934. AXP809_IRQ_PEK_OVER_OFF,
  935. @@ -632,6 +821,23 @@ enum axp809_irqs {
  936. AXP809_IRQ_GPIO0_INPUT,
  937. };
  938. +enum axp15060_irqs {
  939. + AXP15060_IRQ_DIE_TEMP_HIGH_LV1 = 1,
  940. + AXP15060_IRQ_DIE_TEMP_HIGH_LV2,
  941. + AXP15060_IRQ_DCDC1_V_LOW,
  942. + AXP15060_IRQ_DCDC2_V_LOW,
  943. + AXP15060_IRQ_DCDC3_V_LOW,
  944. + AXP15060_IRQ_DCDC4_V_LOW,
  945. + AXP15060_IRQ_DCDC5_V_LOW,
  946. + AXP15060_IRQ_DCDC6_V_LOW,
  947. + AXP15060_IRQ_PEK_LONG,
  948. + AXP15060_IRQ_PEK_SHORT,
  949. + AXP15060_IRQ_GPIO1_INPUT,
  950. + AXP15060_IRQ_PEK_FAL_EDGE,
  951. + AXP15060_IRQ_PEK_RIS_EDGE,
  952. + AXP15060_IRQ_GPIO2_INPUT,
  953. +};
  954. +
  955. struct axp20x_dev {
  956. struct device *dev;
  957. int irq;
  958. @@ -698,4 +904,4 @@ int axp20x_device_probe(struct axp20x_de
  959. */
  960. void axp20x_device_remove(struct axp20x_dev *axp20x);
  961. -#endif /* __LINUX_MFD_AXP20X_H */
  962. +#endif /* __LINUX_MFD_AXP20X_H */
  963. \ No newline at end of file