Blame view

include/axp152.h 3.08 KB
242892083   Hans de Goede   sunxi: Add axp152...
1
2
3
4
5
  /*
   * (C) Copyright 2012 Henrik Nordstrom <henrik@henriknordstrom.net>
   *
   * SPDX-License-Identifier:	GPL-2.0+
   */
558ccc7f5   Paul Kocialkowski   power: axp152: Re...
6
7
8
  
  enum axp152_reg {
  	AXP152_CHIP_VERSION = 0x3,
56b3054ae   fang hui   MA-10052 [iot] Ex...
9
10
  	AXP152_POWER_CONTROL = 0x12,
  	AXP152_LDO0_VOLTAGE = 0x15,
558ccc7f5   Paul Kocialkowski   power: axp152: Re...
11
  	AXP152_DCDC2_VOLTAGE = 0x23,
56b3054ae   fang hui   MA-10052 [iot] Ex...
12
  	AXP152_DCDC1_VOLTAGE = 0x26,
558ccc7f5   Paul Kocialkowski   power: axp152: Re...
13
14
  	AXP152_DCDC3_VOLTAGE = 0x27,
  	AXP152_DCDC4_VOLTAGE = 0x2B,
56b3054ae   fang hui   MA-10052 [iot] Ex...
15
  	AXP152_LDO1_VOLTAGE = 0x29,
558ccc7f5   Paul Kocialkowski   power: axp152: Re...
16
  	AXP152_LDO2_VOLTAGE = 0x2A,
56b3054ae   fang hui   MA-10052 [iot] Ex...
17
18
  	AXP152_ALDO1_ALDO2_VOLTAGE = 0x28,
  	AXP152_POWER_RECOVERY = 0x31,
558ccc7f5   Paul Kocialkowski   power: axp152: Re...
19
  	AXP152_SHUTDOWN = 0x32,
56b3054ae   fang hui   MA-10052 [iot] Ex...
20
  	AXP152_GPIO0 = 0x90,
558ccc7f5   Paul Kocialkowski   power: axp152: Re...
21
  };
56b3054ae   fang hui   MA-10052 [iot] Ex...
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
  enum axp152_ldo0_volts {
         AXP152_LDO0_5V = 0,
         AXP152_LDO0_3V3 = 1,
         AXP152_LDO0_2V8 = 2,
         AXP152_LDO0_2V5 = 3,
  };
  
  enum axp152_ldo0_curr_limit {
         AXP152_LDO0_CURR_NOLMIT = 0,
         AXP152_LDO0_CURR_1500MA = 1,
         AXP152_LDO0_CURR_900MA = 2,
         AXP152_LDO0_CURR_500MA = 3,
  };
  
  enum axp152_dcdc1_voltages {
         AXP152_DCDC1_1V7 = 0,
         AXP152_DCDC1_1V8 = 1,
         AXP152_DCDC1_1V9 = 2,
         AXP152_DCDC1_2V0 = 3,
         AXP152_DCDC1_2V1 = 4,
         AXP152_DCDC1_2V4 = 5,
         AXP152_DCDC1_2V5 = 6,
         AXP152_DCDC1_2V6 = 7,
         AXP152_DCDC1_2V7 = 8,
         AXP152_DCDC1_2V8 = 9,
         AXP152_DCDC1_3V0 = 10,
         AXP152_DCDC1_3V1 = 11,
         AXP152_DCDC1_3V2 = 12,
         AXP152_DCDC1_3V3 = 13,
         AXP152_DCDC1_3V4 = 14,
         AXP152_DCDC1_3V5 = 15,
  };
  
  enum axp152_aldo_voltages {
         AXP152_ALDO_1V2 = 0,
         AXP152_ALDO_1V3 = 1,
         AXP152_ALDO_1V4 = 2,
         AXP152_ALDO_1V5 = 3,
         AXP152_ALDO_1V6 = 4,
         AXP152_ALDO_1V7 = 5,
         AXP152_ALDO_1V8 = 6,
         AXP152_ALDO_1V9 = 7,
         AXP152_ALDO_2V0 = 8,
         AXP152_ALDO_2V5 = 9,
         AXP152_ALDO_2V7 = 10,
         AXP152_ALDO_2V8 = 11,
         AXP152_ALDO_3V0 = 12,
         AXP152_ALDO_3V1 = 13,
         AXP152_ALDO_3V2 = 14,
         AXP152_ALDO_3V3 = 15,
  };
  
  #define AXP152_POWEROUT_DC_DC1 BIT(7)
  #define AXP152_POWEROUT_DC_DC2 BIT(6)
  #define AXP152_POWEROUT_DC_DC3 BIT(5)
  #define AXP152_POWEROUT_DC_DC4 BIT(4)
  #define AXP152_POWEROUT_ALDO1  BIT(3)
  #define AXP152_POWEROUT_ALDO2  BIT(2)
  #define AXP152_POWEROUT_DLDO1  BIT(1)
  #define AXP152_POWEROUT_DLDO2  BIT(0)
558ccc7f5   Paul Kocialkowski   power: axp152: Re...
82
  #define AXP152_POWEROFF			(1 << 7)
56b3054ae   fang hui   MA-10052 [iot] Ex...
83
84
  #define AXP152_POWEROFF_SEQ            (1 << 2)
  #define AXP152_POWER_RECOVERY_EN       (1 << 3)
558ccc7f5   Paul Kocialkowski   power: axp152: Re...
85

2fcf033d3   Hans de Goede   sunxi: axp: Move ...
86
87
88
89
90
91
92
93
94
95
  /* For axp_gpio.c */
  #define AXP_GPIO0_CTRL			0x90
  #define AXP_GPIO1_CTRL			0x91
  #define AXP_GPIO2_CTRL			0x92
  #define AXP_GPIO3_CTRL			0x93
  #define AXP_GPIO_CTRL_OUTPUT_LOW		0x00 /* Drive pin low */
  #define AXP_GPIO_CTRL_OUTPUT_HIGH		0x01 /* Drive pin high */
  #define AXP_GPIO_CTRL_INPUT			0x02 /* Input */
  #define AXP_GPIO_STATE			0x97
  #define AXP_GPIO_STATE_OFFSET			0
56b3054ae   fang hui   MA-10052 [iot] Ex...
96
97
98
99
100
101
102
103
104
105
106
107
108
  
  int axp_set_dcdc1(enum axp152_dcdc1_voltages volt);
  int axp_set_dcdc2(unsigned int mvolt);
  int axp_set_dcdc3(unsigned int mvolt);
  int axp_set_dcdc4(unsigned int mvolt);
  int axp_set_ldo0(enum axp152_ldo0_volts volt, enum axp152_ldo0_curr_limit curr_limit);
  int axp_disable_ldo0(void);
  int axp_set_ldo1(unsigned int mvolt);
  int axp_set_ldo2(unsigned int mvolt);
  int axp_set_aldo1(enum axp152_aldo_voltages volt);
  int axp_set_aldo2(enum axp152_aldo_voltages volt);
  int axp_set_power_output(int val);
  int axp_init(void);