[U-Boot] [RFC 0/2] Generic PMIC driver

Lukasz Majewski l.majewski at samsung.com
Mon Sep 19 17:06:04 CEST 2011


Dear all,

I'd like to propose a new approach for PMIC generic driver.

In my opinion following issues needs discussion:
1. In proposed 
int pmic_reg_read(struct pmic *p, u32 *val) the val is returned by pointer.
Now at fsl_pmic.c read value is returned by return clause.
 
I think, that passing pointer is a better approach,since errors from i2c_read/spi_read can be
caught in upper layers.

2. Since I haven't got a chance to test SPI part of the fsl_pmic.c driver, I've focused
mainly on I2C and place stubs for SPI.

3. Suggestions for struct pmic's additional fields for SPI are more than welcome :-) 

4. Now the pmic_core.c file consist of
   #ifdef PMIC_I2C
   {Code for handling I2C}
   #else
   {Code for handling SPI}
   #endif

The same approach is used at fsl_pmic.c   

I'm wondering if this approach shouldn't be replaced with on-time checking if
SPI or I2C interface is available.
This check can be performed by:

struct pmic *p;
if (p->interface == PMIC_I2C) {

} else {

}

It would allow to remove obscure #ifdefs, but on the other hand it will reduce 
execution speed of the driver.

Thanks in advance,
Lukasz

 
Lukasz Majewski (2):
  misc:pmic New generic pmic driver
  misc:pmic:max8998: Support for max8998 pmic

 arch/arm/lib/board.c       |    5 +
 board/samsung/goni/goni.c  |   18 ++++
 drivers/misc/Makefile      |    1 +
 drivers/misc/pmic_core.c   |  236 ++++++++++++++++++++++++++++++++++++++++++++
 include/configs/s5p_goni.h |    3 +
 include/max8998_pmic.h     |   84 ++++++++++++++++
 include/pmic.h             |   60 +++++++++++
 7 files changed, 407 insertions(+), 0 deletions(-)
 create mode 100644 drivers/misc/pmic_core.c
 create mode 100644 include/max8998_pmic.h
 create mode 100644 include/pmic.h

-- 
1.7.2.3



More information about the U-Boot mailing list