Hi, On Thu, Mar 07, 2013 at 04:40:18PM +0200, Aaro Koskinen wrote: > Tahvo is a multi-function device on Nokia 770, implementing USB > transceiver and charge/battery control. > > It's so close to Retu that a single driver can support both. > > Signed-off-by: Aaro Koskinen <aaro.koski...@iki.fi> > Cc: Samuel Ortiz <sa...@linux.intel.com> > --- > drivers/mfd/Kconfig | 6 +-- > drivers/mfd/retu-mfd.c | 95 > +++++++++++++++++++++++++++++++++++++++------- > include/linux/mfd/retu.h | 8 +++- > 3 files changed, 92 insertions(+), 17 deletions(-) > > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig > index 671f5b1..0c3bdae 100644 > --- a/drivers/mfd/Kconfig > +++ b/drivers/mfd/Kconfig > @@ -1101,13 +1101,13 @@ config MFD_VIPERBOARD > The drivers do not support all features the board exposes. > > config MFD_RETU > - tristate "Support for Retu multi-function device" > + tristate "Support for Retu and Tahvo multi-function devices" > select MFD_CORE > depends on I2C && GENERIC_HARDIRQS > select REGMAP_IRQ > help > - Retu is a multi-function device found on Nokia Internet Tablets > - (770, N800 and N810). > + Retu and Tahvo are multi-function devices found on Nokia > + Internet Tablets (770, N800 and N810). > > config MFD_AS3711 > bool "Support for AS3711" > diff --git a/drivers/mfd/retu-mfd.c b/drivers/mfd/retu-mfd.c > index 3ba0486..fa0204b 100644 > --- a/drivers/mfd/retu-mfd.c > +++ b/drivers/mfd/retu-mfd.c > @@ -1,5 +1,5 @@ > /* > - * Retu MFD driver > + * Retu/Tahvo MFD driver > * > * Copyright (C) 2004, 2005 Nokia Corporation > * > @@ -29,11 +29,15 @@ > #include <linux/interrupt.h> > #include <linux/moduleparam.h> > > +#define RETU_ID 0 > +#define TAHVO_ID 1
do you really need this ? Why didn't you use the i2c address as the device ID ? > @@ -173,9 +233,13 @@ static struct regmap_config retu_config = { > > static int retu_probe(struct i2c_client *i2c, const struct i2c_device_id *id) > { > + int chip = id->driver_data; > struct retu_dev *rdev; > int ret; > > + if (chip >= ARRAY_SIZE(retu_data)) > + return -EINVAL; you can figure this out without using 'chip'. Just use the i2c address. -- balbi
signature.asc
Description: Digital signature