Hi Mark,

[auto build test ERROR on regulator/for-next]
[also build test ERROR on v4.6-rc1 next-20160329]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improving the system]

url:    
https://github.com/0day-ci/linux/commits/Mark-Brown/Applied-regulator-axp20x-support-AXP809-variant-to-the-regulator-tree/20160330-005751
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git 
for-next
config: sparc64-allmodconfig (attached as .config)
reproduce:
        wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=sparc64 

All error/warnings (new ones prefixed by >>):

>> drivers/regulator/axp20x-regulator.c:238:11: error: 'AXP809_DCDC1' 
>> undeclared here (not in a function)
     AXP_DESC(AXP809, DCDC1, "dcdc1", "vin1", 1600, 3400, 100,
              ^
   drivers/regulator/axp20x-regulator.c:63:3: note: in definition of macro 
'AXP_DESC'
     [_family##_##_id] = {       \
      ^
>> drivers/regulator/axp20x-regulator.c:238:2: error: array index in 
>> initializer not of integer type
     AXP_DESC(AXP809, DCDC1, "dcdc1", "vin1", 1600, 3400, 100,
     ^
   drivers/regulator/axp20x-regulator.c:238:2: error: (near initialization for 
'axp809_regulators')
>> drivers/regulator/axp20x-regulator.c:240:11: error: 'AXP809_DCDC2' 
>> undeclared here (not in a function)
     AXP_DESC(AXP809, DCDC2, "dcdc2", "vin2", 600, 1540, 20,
              ^
   drivers/regulator/axp20x-regulator.c:63:3: note: in definition of macro 
'AXP_DESC'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:240:2: error: array index in 
initializer not of integer type
     AXP_DESC(AXP809, DCDC2, "dcdc2", "vin2", 600, 1540, 20,
     ^
   drivers/regulator/axp20x-regulator.c:240:2: error: (near initialization for 
'axp809_regulators')
>> drivers/regulator/axp20x-regulator.c:242:11: error: 'AXP809_DCDC3' 
>> undeclared here (not in a function)
     AXP_DESC(AXP809, DCDC3, "dcdc3", "vin3", 600, 1860, 20,
              ^
   drivers/regulator/axp20x-regulator.c:63:3: note: in definition of macro 
'AXP_DESC'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:242:2: error: array index in 
initializer not of integer type
     AXP_DESC(AXP809, DCDC3, "dcdc3", "vin3", 600, 1860, 20,
     ^
   drivers/regulator/axp20x-regulator.c:242:2: error: (near initialization for 
'axp809_regulators')
>> drivers/regulator/axp20x-regulator.c:244:18: error: 'AXP809_DCDC4' 
>> undeclared here (not in a function)
     AXP_DESC_RANGES(AXP809, DCDC4, "dcdc4", "vin4", axp809_dcdc4_ranges,
                     ^
   drivers/regulator/axp20x-regulator.c:111:3: note: in definition of macro 
'AXP_DESC_RANGES'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:244:2: error: array index in 
initializer not of integer type
     AXP_DESC_RANGES(AXP809, DCDC4, "dcdc4", "vin4", axp809_dcdc4_ranges,
     ^
   drivers/regulator/axp20x-regulator.c:244:2: error: (near initialization for 
'axp809_regulators')
>> drivers/regulator/axp20x-regulator.c:247:11: error: 'AXP809_DCDC5' 
>> undeclared here (not in a function)
     AXP_DESC(AXP809, DCDC5, "dcdc5", "vin5", 1000, 2550, 50,
              ^
   drivers/regulator/axp20x-regulator.c:63:3: note: in definition of macro 
'AXP_DESC'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:247:2: error: array index in 
initializer not of integer type
     AXP_DESC(AXP809, DCDC5, "dcdc5", "vin5", 1000, 2550, 50,
     ^
   drivers/regulator/axp20x-regulator.c:247:2: error: (near initialization for 
'axp809_regulators')
>> drivers/regulator/axp20x-regulator.c:250:14: error: 'AXP809_DC1SW' 
>> undeclared here (not in a function)
     AXP_DESC_SW(AXP809, DC1SW, "dc1sw", NULL, AXP22X_PWR_OUT_CTRL2,
                 ^
   drivers/regulator/axp20x-regulator.c:82:3: note: in definition of macro 
'AXP_DESC_SW'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:250:2: error: array index in 
initializer not of integer type
     AXP_DESC_SW(AXP809, DC1SW, "dc1sw", NULL, AXP22X_PWR_OUT_CTRL2,
     ^
   drivers/regulator/axp20x-regulator.c:250:2: error: (near initialization for 
'axp809_regulators')
>> drivers/regulator/axp20x-regulator.c:253:11: error: 'AXP809_DC5LDO' 
>> undeclared here (not in a function)
     AXP_DESC(AXP809, DC5LDO, "dc5ldo", NULL, 700, 1400, 100,
              ^
   drivers/regulator/axp20x-regulator.c:63:3: note: in definition of macro 
'AXP_DESC'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:253:2: error: array index in 
initializer not of integer type
     AXP_DESC(AXP809, DC5LDO, "dc5ldo", NULL, 700, 1400, 100,
     ^
   drivers/regulator/axp20x-regulator.c:253:2: error: (near initialization for 
'axp809_regulators')
>> drivers/regulator/axp20x-regulator.c:255:11: error: 'AXP809_ALDO1' 
>> undeclared here (not in a function)
     AXP_DESC(AXP809, ALDO1, "aldo1", "aldoin", 700, 3300, 100,
              ^
   drivers/regulator/axp20x-regulator.c:63:3: note: in definition of macro 
'AXP_DESC'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:255:2: error: array index in 
initializer not of integer type
     AXP_DESC(AXP809, ALDO1, "aldo1", "aldoin", 700, 3300, 100,
     ^
   drivers/regulator/axp20x-regulator.c:255:2: error: (near initialization for 
'axp809_regulators')
>> drivers/regulator/axp20x-regulator.c:257:11: error: 'AXP809_ALDO2' 
>> undeclared here (not in a function)
     AXP_DESC(AXP809, ALDO2, "aldo2", "aldoin", 700, 3300, 100,
              ^
   drivers/regulator/axp20x-regulator.c:63:3: note: in definition of macro 
'AXP_DESC'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:257:2: error: array index in 
initializer not of integer type
     AXP_DESC(AXP809, ALDO2, "aldo2", "aldoin", 700, 3300, 100,
     ^
   drivers/regulator/axp20x-regulator.c:257:2: error: (near initialization for 
'axp809_regulators')
>> drivers/regulator/axp20x-regulator.c:259:11: error: 'AXP809_ALDO3' 
>> undeclared here (not in a function)
     AXP_DESC(AXP809, ALDO3, "aldo3", "aldoin", 700, 3300, 100,
              ^
   drivers/regulator/axp20x-regulator.c:63:3: note: in definition of macro 
'AXP_DESC'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:259:2: error: array index in 
initializer not of integer type
     AXP_DESC(AXP809, ALDO3, "aldo3", "aldoin", 700, 3300, 100,
     ^
   drivers/regulator/axp20x-regulator.c:259:2: error: (near initialization for 
'axp809_regulators')
>> drivers/regulator/axp20x-regulator.c:261:18: error: 'AXP809_DLDO1' 
>> undeclared here (not in a function)
     AXP_DESC_RANGES(AXP809, DLDO1, "dldo1", "dldoin", axp809_dldo1_ranges,
                     ^
   drivers/regulator/axp20x-regulator.c:111:3: note: in definition of macro 
'AXP_DESC_RANGES'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:261:2: error: array index in 
initializer not of integer type
     AXP_DESC_RANGES(AXP809, DLDO1, "dldo1", "dldoin", axp809_dldo1_ranges,
     ^
   drivers/regulator/axp20x-regulator.c:261:2: error: (near initialization for 
'axp809_regulators')
>> drivers/regulator/axp20x-regulator.c:264:11: error: 'AXP809_DLDO2' 
>> undeclared here (not in a function)
     AXP_DESC(AXP809, DLDO2, "dldo2", "dldoin", 700, 3300, 100,
              ^
   drivers/regulator/axp20x-regulator.c:63:3: note: in definition of macro 
'AXP_DESC'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:264:2: error: array index in 
initializer not of integer type
     AXP_DESC(AXP809, DLDO2, "dldo2", "dldoin", 700, 3300, 100,
     ^
   drivers/regulator/axp20x-regulator.c:264:2: error: (near initialization for 
'axp809_regulators')
>> drivers/regulator/axp20x-regulator.c:266:11: error: 'AXP809_ELDO1' 
>> undeclared here (not in a function)
     AXP_DESC(AXP809, ELDO1, "eldo1", "eldoin", 700, 3300, 100,
              ^
   drivers/regulator/axp20x-regulator.c:63:3: note: in definition of macro 
'AXP_DESC'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:266:2: error: array index in 
initializer not of integer type
     AXP_DESC(AXP809, ELDO1, "eldo1", "eldoin", 700, 3300, 100,
     ^
   drivers/regulator/axp20x-regulator.c:266:2: error: (near initialization for 
'axp809_regulators')
>> drivers/regulator/axp20x-regulator.c:268:11: error: 'AXP809_ELDO2' 
>> undeclared here (not in a function)
     AXP_DESC(AXP809, ELDO2, "eldo2", "eldoin", 700, 3300, 100,
              ^
   drivers/regulator/axp20x-regulator.c:63:3: note: in definition of macro 
'AXP_DESC'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:268:2: error: array index in 
initializer not of integer type
     AXP_DESC(AXP809, ELDO2, "eldo2", "eldoin", 700, 3300, 100,
     ^
   drivers/regulator/axp20x-regulator.c:268:2: error: (near initialization for 
'axp809_regulators')
>> drivers/regulator/axp20x-regulator.c:270:11: error: 'AXP809_ELDO3' 
>> undeclared here (not in a function)
     AXP_DESC(AXP809, ELDO3, "eldo3", "eldoin", 700, 3300, 100,
              ^
   drivers/regulator/axp20x-regulator.c:63:3: note: in definition of macro 
'AXP_DESC'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:270:2: error: array index in 
initializer not of integer type
     AXP_DESC(AXP809, ELDO3, "eldo3", "eldoin", 700, 3300, 100,
     ^
   drivers/regulator/axp20x-regulator.c:270:2: error: (near initialization for 
'axp809_regulators')
>> drivers/regulator/axp20x-regulator.c:272:14: error: 'AXP809_LDO_IO0' 
>> undeclared here (not in a function)
     AXP_DESC_IO(AXP809, LDO_IO0, "ldo_io0", "ips", 700, 3300, 100,
                 ^
   drivers/regulator/axp20x-regulator.c:41:3: note: in definition of macro 
'AXP_DESC_IO'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:272:2: error: array index in 
initializer not of integer type
     AXP_DESC_IO(AXP809, LDO_IO0, "ldo_io0", "ips", 700, 3300, 100,
     ^
   drivers/regulator/axp20x-regulator.c:272:2: error: (near initialization for 
'axp809_regulators')
>> drivers/regulator/axp20x-regulator.c:275:14: error: 'AXP809_LDO_IO1' 
>> undeclared here (not in a function)
     AXP_DESC_IO(AXP809, LDO_IO1, "ldo_io1", "ips", 700, 3300, 100,
                 ^
   drivers/regulator/axp20x-regulator.c:41:3: note: in definition of macro 
'AXP_DESC_IO'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:275:2: error: array index in 
initializer not of integer type
     AXP_DESC_IO(AXP809, LDO_IO1, "ldo_io1", "ips", 700, 3300, 100,
     ^
   drivers/regulator/axp20x-regulator.c:275:2: error: (near initialization for 
'axp809_regulators')
>> drivers/regulator/axp20x-regulator.c:278:17: error: 'AXP809_RTC_LDO' 
>> undeclared here (not in a function)
     AXP_DESC_FIXED(AXP809, RTC_LDO, "rtc_ldo", "ips", 1800),
                    ^
   drivers/regulator/axp20x-regulator.c:96:3: note: in definition of macro 
'AXP_DESC_FIXED'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:278:2: error: array index in 
initializer not of integer type
     AXP_DESC_FIXED(AXP809, RTC_LDO, "rtc_ldo", "ips", 1800),
     ^
   drivers/regulator/axp20x-regulator.c:278:2: error: (near initialization for 
'axp809_regulators')
>> drivers/regulator/axp20x-regulator.c:279:14: error: 'AXP809_SW' undeclared 
>> here (not in a function)
     AXP_DESC_SW(AXP809, SW, "sw", "swin", AXP22X_PWR_OUT_CTRL2, BIT(6)),
                 ^
   drivers/regulator/axp20x-regulator.c:82:3: note: in definition of macro 
'AXP_DESC_SW'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:279:2: error: array index in 
initializer not of integer type
     AXP_DESC_SW(AXP809, SW, "sw", "swin", AXP22X_PWR_OUT_CTRL2, BIT(6)),
     ^
   drivers/regulator/axp20x-regulator.c:279:2: error: (near initialization for 
'axp809_regulators')
   drivers/regulator/axp20x-regulator.c: In function 'axp20x_set_dcdc_freq':

vim +/AXP809_DCDC1 +238 drivers/regulator/axp20x-regulator.c

    35  #define AXP22X_WORKMODE_DCDCX_MASK(x)   BIT(x)
    36  
    37  #define AXP20X_FREQ_DCDC_MASK           0x0f
    38  
    39  #define AXP_DESC_IO(_family, _id, _match, _supply, _min, _max, _step, 
_vreg,    \
    40                      _vmask, _ereg, _emask, _enable_val, _disable_val)   
        \
  > 41          [_family##_##_id] = {                                           
        \
    42                  .name           = (_match),                             
        \
    43                  .supply_name    = (_supply),                            
        \
    44                  .of_match       = of_match_ptr(_match),                 
        \
    45                  .regulators_node = of_match_ptr("regulators"),          
        \
    46                  .type           = REGULATOR_VOLTAGE,                    
        \
    47                  .id             = _family##_##_id,                      
        \
    48                  .n_voltages     = (((_max) - (_min)) / (_step) + 1),    
        \
    49                  .owner          = THIS_MODULE,                          
        \
    50                  .min_uV         = (_min) * 1000,                        
        \
    51                  .uV_step        = (_step) * 1000,                       
        \
    52                  .vsel_reg       = (_vreg),                              
        \
    53                  .vsel_mask      = (_vmask),                             
        \
    54                  .enable_reg     = (_ereg),                              
        \
    55                  .enable_mask    = (_emask),                             
        \
    56                  .enable_val     = (_enable_val),                        
        \
    57                  .disable_val    = (_disable_val),                       
        \
    58                  .ops            = &axp20x_ops,                          
        \
    59          }
    60  
    61  #define AXP_DESC(_family, _id, _match, _supply, _min, _max, _step, 
_vreg,       \
    62                   _vmask, _ereg, _emask)                                 
        \
  > 63          [_family##_##_id] = {                                           
        \
    64                  .name           = (_match),                             
        \
    65                  .supply_name    = (_supply),                            
        \
    66                  .of_match       = of_match_ptr(_match),                 
        \
    67                  .regulators_node = of_match_ptr("regulators"),          
        \
    68                  .type           = REGULATOR_VOLTAGE,                    
        \
    69                  .id             = _family##_##_id,                      
        \
    70                  .n_voltages     = (((_max) - (_min)) / (_step) + 1),    
        \
    71                  .owner          = THIS_MODULE,                          
        \
    72                  .min_uV         = (_min) * 1000,                        
        \
    73                  .uV_step        = (_step) * 1000,                       
        \
    74                  .vsel_reg       = (_vreg),                              
        \
    75                  .vsel_mask      = (_vmask),                             
        \
    76                  .enable_reg     = (_ereg),                              
        \
    77                  .enable_mask    = (_emask),                             
        \
    78                  .ops            = &axp20x_ops,                          
        \
    79          }
    80  
    81  #define AXP_DESC_SW(_family, _id, _match, _supply, _ereg, _emask)       
        \
  > 82          [_family##_##_id] = {                                           
        \
    83                  .name           = (_match),                             
        \
    84                  .supply_name    = (_supply),                            
        \
    85                  .of_match       = of_match_ptr(_match),                 
        \
    86                  .regulators_node = of_match_ptr("regulators"),          
        \
    87                  .type           = REGULATOR_VOLTAGE,                    
        \
    88                  .id             = _family##_##_id,                      
        \
    89                  .owner          = THIS_MODULE,                          
        \
    90                  .enable_reg     = (_ereg),                              
        \
    91                  .enable_mask    = (_emask),                             
        \
    92                  .ops            = &axp20x_ops_sw,                       
        \
    93          }
    94  
    95  #define AXP_DESC_FIXED(_family, _id, _match, _supply, _volt)            
        \
  > 96          [_family##_##_id] = {                                           
        \
    97                  .name           = (_match),                             
        \
    98                  .supply_name    = (_supply),                            
        \
    99                  .of_match       = of_match_ptr(_match),                 
        \
   100                  .regulators_node = of_match_ptr("regulators"),          
        \
   101                  .type           = REGULATOR_VOLTAGE,                    
        \
   102                  .id             = _family##_##_id,                      
        \
   103                  .n_voltages     = 1,                                    
        \
   104                  .owner          = THIS_MODULE,                          
        \
   105                  .min_uV         = (_volt) * 1000,                       
        \
   106                  .ops            = &axp20x_ops_fixed                     
        \
   107          }
   108  
   109  #define AXP_DESC_RANGES(_family, _id, _match, _supply, _ranges, 
_n_voltages,    \
   110                          _vreg, _vmask, _ereg, _emask)                   
        \
 > 111          [_family##_##_id] = {                                           
 >         \
   112                  .name           = (_match),                             
        \
   113                  .supply_name    = (_supply),                            
        \
   114                  .of_match       = of_match_ptr(_match),                 
        \
   115                  .regulators_node = of_match_ptr("regulators"),          
        \
   116                  .type           = REGULATOR_VOLTAGE,                    
        \
   117                  .id             = _family##_##_id,                      
        \
   118                  .n_voltages     = (_n_voltages),                        
        \
   119                  .owner          = THIS_MODULE,                          
        \
   120                  .vsel_reg       = (_vreg),                              
        \
   121                  .vsel_mask      = (_vmask),                             
        \
   122                  .enable_reg     = (_ereg),                              
        \
   123                  .enable_mask    = (_emask),                             
        \
   124                  .linear_ranges  = (_ranges),                            
        \
   125                  .n_linear_ranges = ARRAY_SIZE(_ranges),                 
        \
   126                  .ops            = &axp20x_ops_range,                    
        \
   127          }
   128  
   129  static struct regulator_ops axp20x_ops_fixed = {
   130          .list_voltage           = regulator_list_voltage_linear,
   131  };
   132  
   133  static struct regulator_ops axp20x_ops_range = {
   134          .set_voltage_sel        = regulator_set_voltage_sel_regmap,
   135          .get_voltage_sel        = regulator_get_voltage_sel_regmap,
   136          .list_voltage           = regulator_list_voltage_linear_range,
   137          .enable                 = regulator_enable_regmap,
   138          .disable                = regulator_disable_regmap,
   139          .is_enabled             = regulator_is_enabled_regmap,
   140  };
   141  
   142  static struct regulator_ops axp20x_ops = {
   143          .set_voltage_sel        = regulator_set_voltage_sel_regmap,
   144          .get_voltage_sel        = regulator_get_voltage_sel_regmap,
   145          .list_voltage           = regulator_list_voltage_linear,
   146          .enable                 = regulator_enable_regmap,
   147          .disable                = regulator_disable_regmap,
   148          .is_enabled             = regulator_is_enabled_regmap,
   149  };
   150  
   151  static struct regulator_ops axp20x_ops_sw = {
   152          .enable                 = regulator_enable_regmap,
   153          .disable                = regulator_disable_regmap,
   154          .is_enabled             = regulator_is_enabled_regmap,
   155  };
   156  
   157  static const struct regulator_linear_range axp20x_ldo4_ranges[] = {
   158          REGULATOR_LINEAR_RANGE(1250000, 0x0, 0x0, 0),
   159          REGULATOR_LINEAR_RANGE(1300000, 0x1, 0x8, 100000),
   160          REGULATOR_LINEAR_RANGE(2500000, 0x9, 0xf, 100000),
   161  };
   162  
   163  static const struct regulator_desc axp20x_regulators[] = {
   164          AXP_DESC(AXP20X, DCDC2, "dcdc2", "vin2", 700, 2275, 25,
   165                   AXP20X_DCDC2_V_OUT, 0x3f, AXP20X_PWR_OUT_CTRL, 0x10),
   166          AXP_DESC(AXP20X, DCDC3, "dcdc3", "vin3", 700, 3500, 25,
   167                   AXP20X_DCDC3_V_OUT, 0x7f, AXP20X_PWR_OUT_CTRL, 0x02),
   168          AXP_DESC_FIXED(AXP20X, LDO1, "ldo1", "acin", 1300),
   169          AXP_DESC(AXP20X, LDO2, "ldo2", "ldo24in", 1800, 3300, 100,
   170                   AXP20X_LDO24_V_OUT, 0xf0, AXP20X_PWR_OUT_CTRL, 0x04),
   171          AXP_DESC(AXP20X, LDO3, "ldo3", "ldo3in", 700, 3500, 25,
   172                   AXP20X_LDO3_V_OUT, 0x7f, AXP20X_PWR_OUT_CTRL, 0x40),
   173          AXP_DESC_RANGES(AXP20X, LDO4, "ldo4", "ldo24in", 
axp20x_ldo4_ranges,
   174                          16, AXP20X_LDO24_V_OUT, 0x0f, 
AXP20X_PWR_OUT_CTRL,
   175                          0x08),
   176          AXP_DESC_IO(AXP20X, LDO5, "ldo5", "ldo5in", 1800, 3300, 100,
   177                      AXP20X_LDO5_V_OUT, 0xf0, AXP20X_GPIO0_CTRL, 0x07,
   178                      AXP20X_IO_ENABLED, AXP20X_IO_DISABLED),
   179  };
   180  
   181  static const struct regulator_desc axp22x_regulators[] = {
   182          AXP_DESC(AXP22X, DCDC1, "dcdc1", "vin1", 1600, 3400, 100,
   183                   AXP22X_DCDC1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, 
BIT(1)),
   184          AXP_DESC(AXP22X, DCDC2, "dcdc2", "vin2", 600, 1540, 20,
   185                   AXP22X_DCDC2_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, 
BIT(2)),
   186          AXP_DESC(AXP22X, DCDC3, "dcdc3", "vin3", 600, 1860, 20,
   187                   AXP22X_DCDC3_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, 
BIT(3)),
   188          AXP_DESC(AXP22X, DCDC4, "dcdc4", "vin4", 600, 1540, 20,
   189                   AXP22X_DCDC4_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, 
BIT(4)),
   190          AXP_DESC(AXP22X, DCDC5, "dcdc5", "vin5", 1000, 2550, 50,
   191                   AXP22X_DCDC5_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, 
BIT(5)),
   192          /* secondary switchable output of DCDC1 */
   193          AXP_DESC_SW(AXP22X, DC1SW, "dc1sw", NULL, AXP22X_PWR_OUT_CTRL2,
   194                      BIT(7)),
   195          /* LDO regulator internally chained to DCDC5 */
   196          AXP_DESC(AXP22X, DC5LDO, "dc5ldo", NULL, 700, 1400, 100,
   197                   AXP22X_DC5LDO_V_OUT, 0x7, AXP22X_PWR_OUT_CTRL1, 
BIT(0)),
   198          AXP_DESC(AXP22X, ALDO1, "aldo1", "aldoin", 700, 3300, 100,
   199                   AXP22X_ALDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, 
BIT(6)),
   200          AXP_DESC(AXP22X, ALDO2, "aldo2", "aldoin", 700, 3300, 100,
   201                   AXP22X_ALDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, 
BIT(7)),
   202          AXP_DESC(AXP22X, ALDO3, "aldo3", "aldoin", 700, 3300, 100,
   203                   AXP22X_ALDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL3, 
BIT(7)),
   204          AXP_DESC(AXP22X, DLDO1, "dldo1", "dldoin", 700, 3300, 100,
   205                   AXP22X_DLDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, 
BIT(3)),
   206          AXP_DESC(AXP22X, DLDO2, "dldo2", "dldoin", 700, 3300, 100,
   207                   AXP22X_DLDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, 
BIT(4)),
   208          AXP_DESC(AXP22X, DLDO3, "dldo3", "dldoin", 700, 3300, 100,
   209                   AXP22X_DLDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, 
BIT(5)),
   210          AXP_DESC(AXP22X, DLDO4, "dldo4", "dldoin", 700, 3300, 100,
   211                   AXP22X_DLDO4_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, 
BIT(6)),
   212          AXP_DESC(AXP22X, ELDO1, "eldo1", "eldoin", 700, 3300, 100,
   213                   AXP22X_ELDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, 
BIT(0)),
   214          AXP_DESC(AXP22X, ELDO2, "eldo2", "eldoin", 700, 3300, 100,
   215                   AXP22X_ELDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, 
BIT(1)),
   216          AXP_DESC(AXP22X, ELDO3, "eldo3", "eldoin", 700, 3300, 100,
   217                   AXP22X_ELDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, 
BIT(2)),
   218          AXP_DESC_IO(AXP22X, LDO_IO0, "ldo_io0", "ips", 1800, 3300, 100,
   219                      AXP22X_LDO_IO0_V_OUT, 0x1f, AXP20X_GPIO0_CTRL, 0x07,
   220                      AXP22X_IO_ENABLED, AXP22X_IO_DISABLED),
   221          AXP_DESC_IO(AXP22X, LDO_IO1, "ldo_io1", "ips", 1800, 3300, 100,
   222                      AXP22X_LDO_IO1_V_OUT, 0x1f, AXP20X_GPIO1_CTRL, 0x07,
   223                      AXP22X_IO_ENABLED, AXP22X_IO_DISABLED),
   224          AXP_DESC_FIXED(AXP22X, RTC_LDO, "rtc_ldo", "ips", 3000),
   225  };
   226  
   227  static const struct regulator_linear_range axp809_dcdc4_ranges[] = {
   228          REGULATOR_LINEAR_RANGE(600000, 0x0, 0x2f, 20000),
   229          REGULATOR_LINEAR_RANGE(1800000, 0x30, 0x38, 100000),
   230  };
   231  
   232  static const struct regulator_linear_range axp809_dldo1_ranges[] = {
   233          REGULATOR_LINEAR_RANGE(700000, 0x0, 0x1a, 100000),
   234          REGULATOR_LINEAR_RANGE(3400000, 0x1b, 0x1f, 200000),
   235  };
   236  
   237  static const struct regulator_desc axp809_regulators[] = {
 > 238          AXP_DESC(AXP809, DCDC1, "dcdc1", "vin1", 1600, 3400, 100,
   239                   AXP22X_DCDC1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, 
BIT(1)),
 > 240          AXP_DESC(AXP809, DCDC2, "dcdc2", "vin2", 600, 1540, 20,
   241                   AXP22X_DCDC2_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, 
BIT(2)),
 > 242          AXP_DESC(AXP809, DCDC3, "dcdc3", "vin3", 600, 1860, 20,
   243                   AXP22X_DCDC3_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, 
BIT(3)),
 > 244          AXP_DESC_RANGES(AXP809, DCDC4, "dcdc4", "vin4", 
 > axp809_dcdc4_ranges,
   245                          57, AXP22X_DCDC4_V_OUT, 0x3f, 
AXP22X_PWR_OUT_CTRL1,
   246                          BIT(4)),
 > 247          AXP_DESC(AXP809, DCDC5, "dcdc5", "vin5", 1000, 2550, 50,
   248                   AXP22X_DCDC5_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, 
BIT(5)),
   249          /* secondary switchable output of DCDC1 */
 > 250          AXP_DESC_SW(AXP809, DC1SW, "dc1sw", NULL, AXP22X_PWR_OUT_CTRL2,
   251                      BIT(7)),
   252          /* LDO regulator internally chained to DCDC5 */
 > 253          AXP_DESC(AXP809, DC5LDO, "dc5ldo", NULL, 700, 1400, 100,
   254                   AXP22X_DC5LDO_V_OUT, 0x7, AXP22X_PWR_OUT_CTRL1, 
BIT(0)),
 > 255          AXP_DESC(AXP809, ALDO1, "aldo1", "aldoin", 700, 3300, 100,
   256                   AXP22X_ALDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, 
BIT(6)),
 > 257          AXP_DESC(AXP809, ALDO2, "aldo2", "aldoin", 700, 3300, 100,
   258                   AXP22X_ALDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, 
BIT(7)),
 > 259          AXP_DESC(AXP809, ALDO3, "aldo3", "aldoin", 700, 3300, 100,
   260                   AXP22X_ALDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, 
BIT(5)),
 > 261          AXP_DESC_RANGES(AXP809, DLDO1, "dldo1", "dldoin", 
 > axp809_dldo1_ranges,
   262                          32, AXP22X_DLDO1_V_OUT, 0x1f, 
AXP22X_PWR_OUT_CTRL2,
   263                          BIT(3)),
 > 264          AXP_DESC(AXP809, DLDO2, "dldo2", "dldoin", 700, 3300, 100,
   265                   AXP22X_DLDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, 
BIT(4)),
 > 266          AXP_DESC(AXP809, ELDO1, "eldo1", "eldoin", 700, 3300, 100,
   267                   AXP22X_ELDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, 
BIT(0)),
 > 268          AXP_DESC(AXP809, ELDO2, "eldo2", "eldoin", 700, 3300, 100,
   269                   AXP22X_ELDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, 
BIT(1)),
 > 270          AXP_DESC(AXP809, ELDO3, "eldo3", "eldoin", 700, 3300, 100,
   271                   AXP22X_ELDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, 
BIT(2)),
 > 272          AXP_DESC_IO(AXP809, LDO_IO0, "ldo_io0", "ips", 700, 3300, 100,
   273                      AXP22X_LDO_IO0_V_OUT, 0x1f, AXP20X_GPIO0_CTRL, 0x07,
   274                      AXP22X_IO_ENABLED, AXP22X_IO_DISABLED),
 > 275          AXP_DESC_IO(AXP809, LDO_IO1, "ldo_io1", "ips", 700, 3300, 100,
   276                      AXP22X_LDO_IO1_V_OUT, 0x1f, AXP20X_GPIO1_CTRL, 0x07,
   277                      AXP22X_IO_ENABLED, AXP22X_IO_DISABLED),
 > 278          AXP_DESC_FIXED(AXP809, RTC_LDO, "rtc_ldo", "ips", 1800),
 > 279          AXP_DESC_SW(AXP809, SW, "sw", "swin", AXP22X_PWR_OUT_CTRL2, 
 > BIT(6)),
   280  };
   281  
   282  static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 
dcdcfreq)
   283  {
   284          struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
   285          u32 min, max, def, step;
   286  
   287          switch (axp20x->variant) {
   288          case AXP202_ID:
   289          case AXP209_ID:
   290                  min = 750;
   291                  max = 1875;
   292                  def = 1500;
   293                  step = 75;
   294                  break;
   295          case AXP221_ID:
   296          case AXP223_ID:
 > 297          case AXP809_ID:
   298                  min = 1800;
   299                  max = 4050;
   300                  def = 3000;
   301                  step = 150;
   302                  break;
   303          default:
   304                  dev_err(&pdev->dev,
   305                          "Setting DCDC frequency for unsupported AXP 
variant\n");
   306                  return -EINVAL;
   307          }
   308  
   309          if (dcdcfreq == 0)
   310                  dcdcfreq = def;
   311  
   312          if (dcdcfreq < min) {
   313                  dcdcfreq = min;
   314                  dev_warn(&pdev->dev, "DCDC frequency too low. Set to 
%ukHz\n",
   315                           min);
   316          }
   317  
   318          if (dcdcfreq > max) {
   319                  dcdcfreq = max;
   320                  dev_warn(&pdev->dev, "DCDC frequency too high. Set to 
%ukHz\n",
   321                           max);
   322          }
   323  
   324          dcdcfreq = (dcdcfreq - min) / step;
   325  
   326          return regmap_update_bits(axp20x->regmap, AXP20X_DCDC_FREQ,
   327                                    AXP20X_FREQ_DCDC_MASK, dcdcfreq);
   328  }
   329  
   330  static int axp20x_regulator_parse_dt(struct platform_device *pdev)
   331  {
   332          struct device_node *np, *regulators;
   333          int ret;
   334          u32 dcdcfreq = 0;
   335  
   336          np = of_node_get(pdev->dev.parent->of_node);
   337          if (!np)
   338                  return 0;
   339  
   340          regulators = of_get_child_by_name(np, "regulators");
   341          if (!regulators) {
   342                  dev_warn(&pdev->dev, "regulators node not found\n");
   343          } else {
   344                  of_property_read_u32(regulators, "x-powers,dcdc-freq", 
&dcdcfreq);
   345                  ret = axp20x_set_dcdc_freq(pdev, dcdcfreq);
   346                  if (ret < 0) {
   347                          dev_err(&pdev->dev, "Error setting dcdc 
frequency: %d\n", ret);
   348                          return ret;
   349                  }
   350  
   351                  of_node_put(regulators);
   352          }
   353  
   354          return 0;
   355  }
   356  
   357  static int axp20x_set_dcdc_workmode(struct regulator_dev *rdev, int id, 
u32 workmode)
   358  {
   359          struct axp20x_dev *axp20x = rdev_get_drvdata(rdev);
   360          unsigned int mask;
   361  
   362          switch (axp20x->variant) {
   363          case AXP202_ID:
   364          case AXP209_ID:
   365                  if ((id != AXP20X_DCDC2) && (id != AXP20X_DCDC3))
   366                          return -EINVAL;
   367  
   368                  mask = AXP20X_WORKMODE_DCDC2_MASK;
   369                  if (id == AXP20X_DCDC3)
   370                          mask = AXP20X_WORKMODE_DCDC3_MASK;
   371  
   372                  workmode <<= ffs(mask) - 1;
   373                  break;
   374  
   375          case AXP221_ID:
   376          case AXP223_ID:
   377          case AXP809_ID:
   378                  if (id < AXP22X_DCDC1 || id > AXP22X_DCDC5)
   379                          return -EINVAL;
   380  
   381                  mask = AXP22X_WORKMODE_DCDCX_MASK(id - AXP22X_DCDC1);
   382                  workmode <<= id - AXP22X_DCDC1;
   383                  break;
   384  
   385          default:
   386                  /* should not happen */
   387                  WARN_ON(1);
   388                  return -EINVAL;
   389          }
   390  
   391          return regmap_update_bits(rdev->regmap, AXP20X_DCDC_MODE, mask, 
workmode);
   392  }
   393  
   394  static int axp20x_regulator_probe(struct platform_device *pdev)
   395  {
   396          struct regulator_dev *rdev;
   397          struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
   398          const struct regulator_desc *regulators;
   399          struct regulator_config config = {
   400                  .dev = pdev->dev.parent,
   401                  .regmap = axp20x->regmap,
   402                  .driver_data = axp20x,
   403          };
   404          int ret, i, nregulators;
   405          u32 workmode;
   406          const char *dcdc1_name = axp22x_regulators[AXP22X_DCDC1].name;
   407          const char *dcdc5_name = axp22x_regulators[AXP22X_DCDC5].name;
   408  
   409          switch (axp20x->variant) {
   410          case AXP202_ID:
   411          case AXP209_ID:
   412                  regulators = axp20x_regulators;
   413                  nregulators = AXP20X_REG_ID_MAX;
   414                  break;
   415          case AXP221_ID:
   416          case AXP223_ID:
   417                  regulators = axp22x_regulators;
   418                  nregulators = AXP22X_REG_ID_MAX;
   419                  break;
 > 420          case AXP809_ID:
   421                  regulators = axp809_regulators;
 > 422                  nregulators = AXP809_REG_ID_MAX;
   423                  break;
   424          default:
   425                  dev_err(&pdev->dev, "Unsupported AXP variant: %ld\n",

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: Binary data

Reply via email to