mirror of
				https://xff.cz/git/u-boot/
				synced 2025-10-31 18:35:42 +01:00 
			
		
		
		
	Currently PCA9450 might have address 0x25 or 0x35, so let user choose the address. Signed-off-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
		
			
				
	
	
		
			32 lines
		
	
	
		
			570 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			570 B
		
	
	
	
		
			C
		
	
	
	
	
	
| // SPDX-License-Identifier: GPL-2.0+
 | |
| /*
 | |
|  * Copyright 2019 NXP
 | |
|  */
 | |
| 
 | |
| #include <common.h>
 | |
| #include <errno.h>
 | |
| #include <i2c.h>
 | |
| #include <power/pmic.h>
 | |
| #include <power/pca9450.h>
 | |
| 
 | |
| static const char pca9450_name[] = "PCA9450";
 | |
| 
 | |
| int power_pca9450_init(unsigned char bus, unsigned char addr)
 | |
| {
 | |
| 	struct pmic *p = pmic_alloc();
 | |
| 
 | |
| 	if (!p) {
 | |
| 		printf("%s: POWER allocation error!\n", __func__);
 | |
| 		return -ENOMEM;
 | |
| 	}
 | |
| 
 | |
| 	p->name = pca9450_name;
 | |
| 	p->interface = PMIC_I2C;
 | |
| 	p->number_of_regs = PCA9450_REG_NUM;
 | |
| 	p->hw.i2c.addr = addr;
 | |
| 	p->hw.i2c.tx_num = 1;
 | |
| 	p->bus = bus;
 | |
| 
 | |
| 	return 0;
 | |
| }
 |