mirror of
				git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
				synced 2025-10-31 16:54:21 +00:00 
			
		
		
		
	regulator: da9211: Implement of_map_mode
Implementing of_map_mode is necessary to be able to specify operating modes in the devicetree using 'regulator-allowed-modes', and to change regulator modes. Signed-off-by: Anand K Mistry <amistry@google.com> Link: https://lore.kernel.org/r/20200702131350.3.I6a0bc18fcdb2fe13e838a31e6d034d0e095368bc@changeid Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
		
							parent
							
								
									6c8b65950b
								
							
						
					
					
						commit
						6f1f1a8039
					
				
					 1 changed files with 23 additions and 2 deletions
				
			
		|  | @ -86,6 +86,20 @@ static const int da9215_current_limits[] = { | |||
| 	5600000, 5800000, 6000000, 6200000, 6400000, 6600000, 6800000, 7000000 | ||||
| }; | ||||
| 
 | ||||
| static unsigned int da9211_map_buck_mode(unsigned int mode) | ||||
| { | ||||
| 	switch (mode) { | ||||
| 	case DA9211_BUCK_MODE_SLEEP: | ||||
| 		return REGULATOR_MODE_STANDBY; | ||||
| 	case DA9211_BUCK_MODE_SYNC: | ||||
| 		return REGULATOR_MODE_FAST; | ||||
| 	case DA9211_BUCK_MODE_AUTO: | ||||
| 		return REGULATOR_MODE_NORMAL; | ||||
| 	default: | ||||
| 		return REGULATOR_MODE_INVALID; | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| static unsigned int da9211_buck_get_mode(struct regulator_dev *rdev) | ||||
| { | ||||
| 	int id = rdev_get_id(rdev); | ||||
|  | @ -233,6 +247,7 @@ static const struct regulator_ops da9211_buck_ops = { | |||
| 	.vsel_reg = DA9211_REG_VBUCKA_A + DA9211_ID_##_id * 2,\ | ||||
| 	.vsel_mask = DA9211_VBUCK_MASK,\ | ||||
| 	.owner = THIS_MODULE,\ | ||||
| 	.of_map_mode = da9211_map_buck_mode,\ | ||||
| } | ||||
| 
 | ||||
| static struct regulator_desc da9211_regulators[] = { | ||||
|  | @ -242,8 +257,14 @@ static struct regulator_desc da9211_regulators[] = { | |||
| 
 | ||||
| #ifdef CONFIG_OF | ||||
| static struct of_regulator_match da9211_matches[] = { | ||||
| 	[DA9211_ID_BUCKA] = { .name = "BUCKA" }, | ||||
| 	[DA9211_ID_BUCKB] = { .name = "BUCKB" }, | ||||
| 	[DA9211_ID_BUCKA] = { | ||||
| 		.name = "BUCKA", | ||||
| 		.desc = &da9211_regulators[DA9211_ID_BUCKA], | ||||
| 	}, | ||||
| 	[DA9211_ID_BUCKB] = { | ||||
| 		.name = "BUCKB", | ||||
| 		.desc = &da9211_regulators[DA9211_ID_BUCKB], | ||||
| 	}, | ||||
| 	}; | ||||
| 
 | ||||
| static struct da9211_pdata *da9211_parse_regulators_dt( | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Anand K Mistry
						Anand K Mistry