210-mfd-add-axp20x-pmic-driver.patch 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502
  1. From 509326e0138b762067904c0c60f818e9bdba4cd4 Mon Sep 17 00:00:00 2001
  2. From: Carlo Caione <carlo@caione.org>
  3. Date: Sat, 1 Mar 2014 17:45:46 +0100
  4. Subject: [PATCH] mfd: AXP20x: Add mfd driver for AXP20x PMIC
  5. This patch introduces the preliminary support for PMICs X-Powers AXP202
  6. and AXP209. The AXP209 and AXP202 are the PMUs (Power Management Unit)
  7. used by A10, A13 and A20 SoCs and developed by X-Powers, a sister company
  8. of Allwinner.
  9. The core enables support for two subsystems:
  10. - PEK (Power Enable Key)
  11. - Regulators
  12. Signed-off-by: Carlo Caione <carlo@caione.org>
  13. ---
  14. arch/arm/configs/sunxi_defconfig | 1 +
  15. drivers/mfd/Kconfig | 12 ++
  16. drivers/mfd/Makefile | 1 +
  17. drivers/mfd/axp20x.c | 250 +++++++++++++++++++++++++++++++++++++++
  18. include/linux/mfd/axp20x.h | 180 ++++++++++++++++++++++++++++
  19. 5 files changed, 444 insertions(+)
  20. create mode 100644 drivers/mfd/axp20x.c
  21. create mode 100644 include/linux/mfd/axp20x.h
  22. --- a/arch/arm/configs/sunxi_defconfig
  23. +++ b/arch/arm/configs/sunxi_defconfig
  24. @@ -55,6 +55,7 @@ CONFIG_GPIO_SYSFS=y
  25. # CONFIG_HWMON is not set
  26. CONFIG_WATCHDOG=y
  27. CONFIG_SUNXI_WATCHDOG=y
  28. +CONFIG_MFD_AXP20X=y
  29. # CONFIG_USB_SUPPORT is not set
  30. CONFIG_NEW_LEDS=y
  31. CONFIG_LEDS_CLASS=y
  32. --- a/drivers/mfd/Kconfig
  33. +++ b/drivers/mfd/Kconfig
  34. @@ -59,6 +59,18 @@ config MFD_AAT2870_CORE
  35. additional drivers must be enabled in order to use the
  36. functionality of the device.
  37. +config MFD_AXP20X
  38. + bool "X-Powers AXP20X"
  39. + select MFD_CORE
  40. + select REGMAP_I2C
  41. + select REGMAP_IRQ
  42. + depends on I2C=y
  43. + help
  44. + If you say Y here you get support for the AXP20X.
  45. + This driver provides common support for accessing the device,
  46. + additional drivers must be enabled in order to use the
  47. + functionality of the device.
  48. +
  49. config MFD_CROS_EC
  50. tristate "ChromeOS Embedded Controller"
  51. select MFD_CORE
  52. --- a/drivers/mfd/Makefile
  53. +++ b/drivers/mfd/Makefile
  54. @@ -101,6 +101,7 @@ obj-$(CONFIG_PMIC_DA9052) += da9052-irq.
  55. obj-$(CONFIG_PMIC_DA9052) += da9052-core.o
  56. obj-$(CONFIG_MFD_DA9052_SPI) += da9052-spi.o
  57. obj-$(CONFIG_MFD_DA9052_I2C) += da9052-i2c.o
  58. +obj-$(CONFIG_MFD_AXP20X) += axp20x.o
  59. obj-$(CONFIG_MFD_LP3943) += lp3943.o
  60. obj-$(CONFIG_MFD_LP8788) += lp8788.o lp8788-irq.o
  61. --- /dev/null
  62. +++ b/drivers/mfd/axp20x.c
  63. @@ -0,0 +1,250 @@
  64. +/*
  65. + * axp20x.c - mfd core driver for the X-Powers AXP202 and AXP209
  66. + *
  67. + * Author: Carlo Caione <carlo@caione.org>
  68. + *
  69. + * This program is free software; you can redistribute it and/or modify
  70. + * it under the terms of the GNU General Public License version 2 as
  71. + * published by the Free Software Foundation.
  72. + */
  73. +
  74. +#include <linux/err.h>
  75. +#include <linux/i2c.h>
  76. +#include <linux/interrupt.h>
  77. +#include <linux/kernel.h>
  78. +#include <linux/module.h>
  79. +#include <linux/pm_runtime.h>
  80. +#include <linux/regmap.h>
  81. +#include <linux/slab.h>
  82. +#include <linux/regulator/consumer.h>
  83. +#include <linux/mfd/axp20x.h>
  84. +#include <linux/mfd/core.h>
  85. +#include <linux/of_device.h>
  86. +#include <linux/of_irq.h>
  87. +
  88. +#define AXP20X_OFF 0x80
  89. +
  90. +static const struct regmap_range axp20x_writeable_ranges[] = {
  91. + regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_IRQ5_STATE),
  92. + regmap_reg_range(AXP20X_DCDC_MODE, AXP20X_FG_RES),
  93. +};
  94. +
  95. +static const struct regmap_range axp20x_volatile_ranges[] = {
  96. + regmap_reg_range(AXP20X_IRQ1_EN, AXP20X_IRQ5_STATE),
  97. +};
  98. +
  99. +static const struct regmap_access_table axp20x_writeable_table = {
  100. + .yes_ranges = axp20x_writeable_ranges,
  101. + .n_yes_ranges = ARRAY_SIZE(axp20x_writeable_ranges),
  102. +};
  103. +
  104. +static const struct regmap_access_table axp20x_volatile_table = {
  105. + .yes_ranges = axp20x_volatile_ranges,
  106. + .n_yes_ranges = ARRAY_SIZE(axp20x_volatile_ranges),
  107. +};
  108. +
  109. +static struct resource axp20x_pek_resources[] = {
  110. + {
  111. + .name = "PEK_DBR",
  112. + .start = AXP20X_IRQ_PEK_RIS_EDGE,
  113. + .end = AXP20X_IRQ_PEK_RIS_EDGE,
  114. + .flags = IORESOURCE_IRQ,
  115. + },
  116. + {
  117. + .name = "PEK_DBF",
  118. + .start = AXP20X_IRQ_PEK_FAL_EDGE,
  119. + .end = AXP20X_IRQ_PEK_FAL_EDGE,
  120. + .flags = IORESOURCE_IRQ,
  121. + },
  122. +};
  123. +
  124. +static const struct regmap_config axp20x_regmap_config = {
  125. + .reg_bits = 8,
  126. + .val_bits = 8,
  127. + .wr_table = &axp20x_writeable_table,
  128. + .volatile_table = &axp20x_volatile_table,
  129. + .max_register = AXP20X_FG_RES,
  130. + .cache_type = REGCACHE_RBTREE,
  131. +};
  132. +
  133. +#define AXP20X_IRQ(_irq, _off, _mask) \
  134. + [AXP20X_IRQ_##_irq] = { .reg_offset = (_off), .mask = BIT(_mask) }
  135. +
  136. +static const struct regmap_irq axp20x_regmap_irqs[] = {
  137. + AXP20X_IRQ(ACIN_OVER_V, 0, 7),
  138. + AXP20X_IRQ(ACIN_PLUGIN, 0, 6),
  139. + AXP20X_IRQ(ACIN_REMOVAL, 0, 5),
  140. + AXP20X_IRQ(VBUS_OVER_V, 0, 4),
  141. + AXP20X_IRQ(VBUS_PLUGIN, 0, 3),
  142. + AXP20X_IRQ(VBUS_REMOVAL, 0, 2),
  143. + AXP20X_IRQ(VBUS_V_LOW, 0, 1),
  144. + AXP20X_IRQ(BATT_PLUGIN, 1, 7),
  145. + AXP20X_IRQ(BATT_REMOVAL, 1, 6),
  146. + AXP20X_IRQ(BATT_ENT_ACT_MODE, 1, 5),
  147. + AXP20X_IRQ(BATT_EXIT_ACT_MODE, 1, 4),
  148. + AXP20X_IRQ(CHARG, 1, 3),
  149. + AXP20X_IRQ(CHARG_DONE, 1, 2),
  150. + AXP20X_IRQ(BATT_TEMP_HIGH, 1, 1),
  151. + AXP20X_IRQ(BATT_TEMP_LOW, 1, 0),
  152. + AXP20X_IRQ(DIE_TEMP_HIGH, 2, 7),
  153. + AXP20X_IRQ(CHARG_I_LOW, 2, 6),
  154. + AXP20X_IRQ(DCDC1_V_LONG, 2, 5),
  155. + AXP20X_IRQ(DCDC2_V_LONG, 2, 4),
  156. + AXP20X_IRQ(DCDC3_V_LONG, 2, 3),
  157. + AXP20X_IRQ(PEK_SHORT, 2, 1),
  158. + AXP20X_IRQ(PEK_LONG, 2, 0),
  159. + AXP20X_IRQ(N_OE_PWR_ON, 3, 7),
  160. + AXP20X_IRQ(N_OE_PWR_OFF, 3, 6),
  161. + AXP20X_IRQ(VBUS_VALID, 3, 5),
  162. + AXP20X_IRQ(VBUS_NOT_VALID, 3, 4),
  163. + AXP20X_IRQ(VBUS_SESS_VALID, 3, 3),
  164. + AXP20X_IRQ(VBUS_SESS_END, 3, 2),
  165. + AXP20X_IRQ(LOW_PWR_LVL1, 3, 1),
  166. + AXP20X_IRQ(LOW_PWR_LVL2, 3, 0),
  167. + AXP20X_IRQ(TIMER, 4, 7),
  168. + AXP20X_IRQ(PEK_RIS_EDGE, 4, 6),
  169. + AXP20X_IRQ(PEK_FAL_EDGE, 4, 5),
  170. + AXP20X_IRQ(GPIO3_INPUT, 4, 3),
  171. + AXP20X_IRQ(GPIO2_INPUT, 4, 2),
  172. + AXP20X_IRQ(GPIO1_INPUT, 4, 1),
  173. + AXP20X_IRQ(GPIO0_INPUT, 4, 0),
  174. +};
  175. +
  176. +static const struct regmap_irq_chip axp20x_regmap_irq_chip = {
  177. + .name = "axp20x_irq_chip",
  178. + .status_base = AXP20X_IRQ1_STATE,
  179. + .ack_base = AXP20X_IRQ1_STATE,
  180. + .mask_base = AXP20X_IRQ1_EN,
  181. + .num_regs = 5,
  182. + .irqs = axp20x_regmap_irqs,
  183. + .num_irqs = ARRAY_SIZE(axp20x_regmap_irqs),
  184. + .mask_invert = true,
  185. + .init_ack_masked = true,
  186. +};
  187. +
  188. +static struct mfd_cell axp20x_cells[] = {
  189. + {
  190. + .name = "axp20x-pek",
  191. + .of_compatible = "x-powers,axp20x-pek",
  192. + .num_resources = ARRAY_SIZE(axp20x_pek_resources),
  193. + .resources = axp20x_pek_resources,
  194. + }, {
  195. + .name = "axp20x-regulator",
  196. + },
  197. +};
  198. +
  199. +const struct of_device_id axp20x_of_match[] = {
  200. + { .compatible = "x-powers,axp202", .data = (void *) AXP202_ID },
  201. + { .compatible = "x-powers,axp209", .data = (void *) AXP209_ID },
  202. + { },
  203. +};
  204. +
  205. +static struct axp20x_dev *axp20x_pm_power_off;
  206. +static void axp20x_power_off(void)
  207. +{
  208. + regmap_write(axp20x_pm_power_off->regmap, AXP20X_OFF_CTRL,
  209. + AXP20X_OFF);
  210. +}
  211. +
  212. +static int axp20x_i2c_probe(struct i2c_client *i2c,
  213. + const struct i2c_device_id *id)
  214. +{
  215. + struct axp20x_dev *axp20x;
  216. + const struct of_device_id *of_id;
  217. + struct device_node *node = i2c->dev.of_node;
  218. + int ret;
  219. +
  220. + axp20x = devm_kzalloc(&i2c->dev, sizeof(*axp20x), GFP_KERNEL);
  221. + if (!axp20x)
  222. + return -ENOMEM;
  223. +
  224. + of_id = of_match_device(axp20x_of_match, &i2c->dev);
  225. + if (!of_id) {
  226. + dev_err(&i2c->dev, "Unable to setup AXP20X data\n");
  227. + return -ENODEV;
  228. + }
  229. + axp20x->variant = (int) of_id->data;
  230. +
  231. + axp20x->i2c_client = i2c;
  232. + axp20x->dev = &i2c->dev;
  233. + dev_set_drvdata(axp20x->dev, axp20x);
  234. +
  235. + axp20x->regmap = devm_regmap_init_i2c(i2c, &axp20x_regmap_config);
  236. + if (IS_ERR(axp20x->regmap)) {
  237. + ret = PTR_ERR(axp20x->regmap);
  238. + dev_err(&i2c->dev, "regmap init failed: %d\n", ret);
  239. + return ret;
  240. + }
  241. +
  242. + axp20x->irq = i2c->irq;
  243. + ret = regmap_add_irq_chip(axp20x->regmap, axp20x->irq,
  244. + IRQF_ONESHOT | IRQF_SHARED, -1,
  245. + &axp20x_regmap_irq_chip,
  246. + &axp20x->regmap_irqc);
  247. + if (ret) {
  248. + dev_err(&i2c->dev, "failed to add irq chip: %d\n", ret);
  249. + return ret;
  250. + }
  251. +
  252. + ret = mfd_add_devices(axp20x->dev, -1, axp20x_cells,
  253. + ARRAY_SIZE(axp20x_cells), NULL, 0, NULL);
  254. + if (ret) {
  255. + dev_err(&i2c->dev, "failed to add MFD devices: %d\n", ret);
  256. + goto mfd_err;
  257. + }
  258. +
  259. + axp20x->pm_off = of_property_read_bool(node, "axp,system-power-controller");
  260. +
  261. + if (axp20x->pm_off && !pm_power_off) {
  262. + axp20x_pm_power_off = axp20x;
  263. + pm_power_off = axp20x_power_off;
  264. + }
  265. +
  266. + dev_info(&i2c->dev, "AXP20X driver loaded\n");
  267. +
  268. + return 0;
  269. +
  270. +mfd_err:
  271. + regmap_del_irq_chip(axp20x->irq, axp20x->regmap_irqc);
  272. +
  273. + return ret;
  274. +}
  275. +
  276. +static int axp20x_i2c_remove(struct i2c_client *i2c)
  277. +{
  278. + struct axp20x_dev *axp20x = i2c_get_clientdata(i2c);
  279. +
  280. + if (axp20x == axp20x_pm_power_off) {
  281. + axp20x_pm_power_off = NULL;
  282. + pm_power_off = NULL;
  283. + }
  284. +
  285. + mfd_remove_devices(axp20x->dev);
  286. + regmap_del_irq_chip(axp20x->i2c_client->irq, axp20x->regmap_irqc);
  287. +
  288. + return 0;
  289. +}
  290. +
  291. +static const struct i2c_device_id axp20x_i2c_id[] = {
  292. + { "axp202", AXP202_ID },
  293. + { "axp209", AXP209_ID },
  294. + { }
  295. +};
  296. +MODULE_DEVICE_TABLE(i2c, axp20x_i2c_id);
  297. +
  298. +static struct i2c_driver axp20x_i2c_driver = {
  299. + .driver = {
  300. + .name = "axp20x",
  301. + .owner = THIS_MODULE,
  302. + .of_match_table = of_match_ptr(axp20x_of_match),
  303. + },
  304. + .probe = axp20x_i2c_probe,
  305. + .remove = axp20x_i2c_remove,
  306. + .id_table = axp20x_i2c_id,
  307. +};
  308. +
  309. +module_i2c_driver(axp20x_i2c_driver);
  310. +
  311. +MODULE_DESCRIPTION("PMIC MFD core driver for AXP20X");
  312. +MODULE_AUTHOR("Carlo Caione <carlo@caione.org>");
  313. +MODULE_LICENSE("GPL");
  314. --- /dev/null
  315. +++ b/include/linux/mfd/axp20x.h
  316. @@ -0,0 +1,180 @@
  317. +/*
  318. + * Functions to access AXP20X power management chip.
  319. + *
  320. + * Copyright (C) 2013, Carlo Caione <carlo@caione.org>
  321. + *
  322. + * This program is free software; you can redistribute it and/or modify
  323. + * it under the terms of the GNU General Public License version 2 as
  324. + * published by the Free Software Foundation.
  325. + */
  326. +
  327. +#ifndef __LINUX_MFD_AXP20X_H
  328. +#define __LINUX_MFD_AXP20X_H
  329. +
  330. +#define AXP202_ID 0
  331. +#define AXP209_ID 1
  332. +
  333. +#define AXP20X_DATACACHE(m) (0x04 + (m))
  334. +
  335. +/* Power supply */
  336. +#define AXP20X_PWR_INPUT_STATUS 0x00
  337. +#define AXP20X_PWR_OP_MODE 0x01
  338. +#define AXP20X_USB_OTG_STATUS 0x02
  339. +#define AXP20X_PWR_OUT_CTRL 0x12
  340. +#define AXP20X_DCDC2_V_OUT 0x23
  341. +#define AXP20X_DCDC2_LDO3_V_SCAL 0x25
  342. +#define AXP20X_DCDC3_V_OUT 0x27
  343. +#define AXP20X_LDO24_V_OUT 0x28
  344. +#define AXP20X_LDO3_V_OUT 0x29
  345. +#define AXP20X_VBUS_IPSOUT_MGMT 0x30
  346. +#define AXP20X_V_OFF 0x31
  347. +#define AXP20X_OFF_CTRL 0x32
  348. +#define AXP20X_CHRG_CTRL1 0x33
  349. +#define AXP20X_CHRG_CTRL2 0x34
  350. +#define AXP20X_CHRG_BAK_CTRL 0x35
  351. +#define AXP20X_PEK_KEY 0x36
  352. +#define AXP20X_DCDC_FREQ 0x37
  353. +#define AXP20X_V_LTF_CHRG 0x38
  354. +#define AXP20X_V_HTF_CHRG 0x39
  355. +#define AXP20X_APS_WARN_L1 0x3a
  356. +#define AXP20X_APS_WARN_L2 0x3b
  357. +#define AXP20X_V_LTF_DISCHRG 0x3c
  358. +#define AXP20X_V_HTF_DISCHRG 0x3d
  359. +
  360. +/* Interrupt */
  361. +#define AXP20X_IRQ1_EN 0x40
  362. +#define AXP20X_IRQ2_EN 0x41
  363. +#define AXP20X_IRQ3_EN 0x42
  364. +#define AXP20X_IRQ4_EN 0x43
  365. +#define AXP20X_IRQ5_EN 0x44
  366. +#define AXP20X_IRQ1_STATE 0x48
  367. +#define AXP20X_IRQ2_STATE 0x49
  368. +#define AXP20X_IRQ3_STATE 0x4a
  369. +#define AXP20X_IRQ4_STATE 0x4b
  370. +#define AXP20X_IRQ5_STATE 0x4c
  371. +
  372. +/* ADC */
  373. +#define AXP20X_ACIN_V_ADC_H 0x56
  374. +#define AXP20X_ACIN_V_ADC_L 0x57
  375. +#define AXP20X_ACIN_I_ADC_H 0x58
  376. +#define AXP20X_ACIN_I_ADC_L 0x59
  377. +#define AXP20X_VBUS_V_ADC_H 0x5a
  378. +#define AXP20X_VBUS_V_ADC_L 0x5b
  379. +#define AXP20X_VBUS_I_ADC_H 0x5c
  380. +#define AXP20X_VBUS_I_ADC_L 0x5d
  381. +#define AXP20X_TEMP_ADC_H 0x5e
  382. +#define AXP20X_TEMP_ADC_L 0x5f
  383. +#define AXP20X_TS_IN_H 0x62
  384. +#define AXP20X_TS_IN_L 0x63
  385. +#define AXP20X_GPIO0_V_ADC_H 0x64
  386. +#define AXP20X_GPIO0_V_ADC_L 0x65
  387. +#define AXP20X_GPIO1_V_ADC_H 0x66
  388. +#define AXP20X_GPIO1_V_ADC_L 0x67
  389. +#define AXP20X_PWR_BATT_H 0x70
  390. +#define AXP20X_PWR_BATT_M 0x71
  391. +#define AXP20X_PWR_BATT_L 0x72
  392. +#define AXP20X_BATT_V_H 0x78
  393. +#define AXP20X_BATT_V_L 0x79
  394. +#define AXP20X_BATT_CHRG_I_H 0x7a
  395. +#define AXP20X_BATT_CHRG_I_L 0x7b
  396. +#define AXP20X_BATT_DISCHRG_I_H 0x7c
  397. +#define AXP20X_BATT_DISCHRG_I_L 0x7d
  398. +#define AXP20X_IPSOUT_V_HIGH_H 0x7e
  399. +#define AXP20X_IPSOUT_V_HIGH_L 0x7f
  400. +
  401. +/* Power supply */
  402. +#define AXP20X_DCDC_MODE 0x80
  403. +#define AXP20X_ADC_EN1 0x82
  404. +#define AXP20X_ADC_EN2 0x83
  405. +#define AXP20X_ADC_RATE 0x84
  406. +#define AXP20X_GPIO10_IN_RANGE 0x85
  407. +#define AXP20X_GPIO1_ADC_IRQ_RIS 0x86
  408. +#define AXP20X_GPIO1_ADC_IRQ_FAL 0x87
  409. +#define AXP20X_TIMER_CTRL 0x8a
  410. +#define AXP20X_VBUS_MON 0x8b
  411. +#define AXP20X_OVER_TMP 0x8f
  412. +
  413. +/* GPIO */
  414. +#define AXP20X_GPIO0_CTRL 0x90
  415. +#define AXP20X_LDO5_V_OUT 0x91
  416. +#define AXP20X_GPIO1_CTRL 0x92
  417. +#define AXP20X_GPIO2_CTRL 0x93
  418. +#define AXP20X_GPIO20_SS 0x94
  419. +#define AXP20X_GPIO3_CTRL 0x95
  420. +
  421. +/* Battery */
  422. +#define AXP20X_CHRG_CC_31_24 0xb0
  423. +#define AXP20X_CHRG_CC_23_16 0xb1
  424. +#define AXP20X_CHRG_CC_15_8 0xb2
  425. +#define AXP20X_CHRG_CC_7_0 0xb3
  426. +#define AXP20X_DISCHRG_CC_31_24 0xb4
  427. +#define AXP20X_DISCHRG_CC_23_16 0xb5
  428. +#define AXP20X_DISCHRG_CC_15_8 0xb6
  429. +#define AXP20X_DISCHRG_CC_7_0 0xb7
  430. +#define AXP20X_CC_CTRL 0xb8
  431. +#define AXP20X_FG_RES 0xb9
  432. +
  433. +/* Regulators IDs */
  434. +enum {
  435. + AXP20X_LDO1 = 0,
  436. + AXP20X_LDO2,
  437. + AXP20X_LDO3,
  438. + AXP20X_LDO4,
  439. + AXP20X_LDO5,
  440. + AXP20X_DCDC2,
  441. + AXP20X_DCDC3,
  442. + AXP20X_REG_ID_MAX,
  443. +};
  444. +
  445. +/* IRQs */
  446. +enum {
  447. + AXP20X_IRQ_ACIN_OVER_V = 1,
  448. + AXP20X_IRQ_ACIN_PLUGIN,
  449. + AXP20X_IRQ_ACIN_REMOVAL,
  450. + AXP20X_IRQ_VBUS_OVER_V,
  451. + AXP20X_IRQ_VBUS_PLUGIN,
  452. + AXP20X_IRQ_VBUS_REMOVAL,
  453. + AXP20X_IRQ_VBUS_V_LOW,
  454. + AXP20X_IRQ_BATT_PLUGIN,
  455. + AXP20X_IRQ_BATT_REMOVAL,
  456. + AXP20X_IRQ_BATT_ENT_ACT_MODE,
  457. + AXP20X_IRQ_BATT_EXIT_ACT_MODE,
  458. + AXP20X_IRQ_CHARG,
  459. + AXP20X_IRQ_CHARG_DONE,
  460. + AXP20X_IRQ_BATT_TEMP_HIGH,
  461. + AXP20X_IRQ_BATT_TEMP_LOW,
  462. + AXP20X_IRQ_DIE_TEMP_HIGH,
  463. + AXP20X_IRQ_CHARG_I_LOW,
  464. + AXP20X_IRQ_DCDC1_V_LONG,
  465. + AXP20X_IRQ_DCDC2_V_LONG,
  466. + AXP20X_IRQ_DCDC3_V_LONG,
  467. + AXP20X_IRQ_PEK_SHORT = 22,
  468. + AXP20X_IRQ_PEK_LONG,
  469. + AXP20X_IRQ_N_OE_PWR_ON,
  470. + AXP20X_IRQ_N_OE_PWR_OFF,
  471. + AXP20X_IRQ_VBUS_VALID,
  472. + AXP20X_IRQ_VBUS_NOT_VALID,
  473. + AXP20X_IRQ_VBUS_SESS_VALID,
  474. + AXP20X_IRQ_VBUS_SESS_END,
  475. + AXP20X_IRQ_LOW_PWR_LVL1,
  476. + AXP20X_IRQ_LOW_PWR_LVL2,
  477. + AXP20X_IRQ_TIMER,
  478. + AXP20X_IRQ_PEK_RIS_EDGE,
  479. + AXP20X_IRQ_PEK_FAL_EDGE,
  480. + AXP20X_IRQ_GPIO3_INPUT,
  481. + AXP20X_IRQ_GPIO2_INPUT,
  482. + AXP20X_IRQ_GPIO1_INPUT,
  483. + AXP20X_IRQ_GPIO0_INPUT,
  484. +};
  485. +
  486. +struct axp20x_dev {
  487. + struct device *dev;
  488. + struct i2c_client *i2c_client;
  489. + struct regmap *regmap;
  490. + struct regmap_irq_chip_data *regmap_irqc;
  491. + int variant;
  492. + int irq;
  493. + bool pm_off;
  494. +};
  495. +
  496. +#endif /* __LINUX_MFD_AXP20X_H */