Re: [PATCH 1/3] mfd: add LP3943 MFD driver

2013-07-22 Thread Lee Jones
> > > +int lp3943_read_byte(struct lp3943 *l, u8 reg, u8 *read)
> > 
> > Not sure I like 'l' as a variable name. The function is small enough
> > to get away with it in this context, but it would probably be better
> > if it were renamed to something more meaningful.
> 
> LP3943 consists of two devices - GPIO and PWM drivers.
> So each private data was defined as 
> 
> struct lp3943 *l; /* MFD device */
> struct lp3943_gpio *lg;   /* GPIO driver */
> struct lp3943_pwm *lp;/* PWM driver */
> 
> As you pointed, the 'l' may look like a list of something.
> I'll rename them as below.
> 
> struct lp3943 *lp3943;
> struct lp3943_gpio *lp3943_gpio;
> struct lp3943_pwm *lp3943_pwm;

Much better thanks.

> > > +static const struct i2c_device_id lp3943_ids[] = {
> > > + {"lp3943", 0},
> > 
> > Lack of consistency ...
> 
> I don't know exactly what it means. Do you mean the name of I2C device?

No, I was referencing the spaces (or lack of) on the inside of the
curly brackets.

-- 
Lee Jones
Linaro ST-Ericsson Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] mfd: add LP3943 MFD driver

2013-07-22 Thread Lee Jones
   +int lp3943_read_byte(struct lp3943 *l, u8 reg, u8 *read)
  
  Not sure I like 'l' as a variable name. The function is small enough
  to get away with it in this context, but it would probably be better
  if it were renamed to something more meaningful.
 
 LP3943 consists of two devices - GPIO and PWM drivers.
 So each private data was defined as 
 
 struct lp3943 *l; /* MFD device */
 struct lp3943_gpio *lg;   /* GPIO driver */
 struct lp3943_pwm *lp;/* PWM driver */
 
 As you pointed, the 'l' may look like a list of something.
 I'll rename them as below.
 
 struct lp3943 *lp3943;
 struct lp3943_gpio *lp3943_gpio;
 struct lp3943_pwm *lp3943_pwm;

Much better thanks.

   +static const struct i2c_device_id lp3943_ids[] = {
   + {lp3943, 0},
  
  Lack of consistency ...
 
 I don't know exactly what it means. Do you mean the name of I2C device?

No, I was referencing the spaces (or lack of) on the inside of the
curly brackets.

-- 
Lee Jones
Linaro ST-Ericsson Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH 1/3] mfd: add LP3943 MFD driver

2013-07-21 Thread Kim, Milo
> This needs to be reviewed by the devicetree people.
> Please break out the bindings separately and include
> devicet...@vger.kernel.org on that review.

OK, thanks.
 
> > +++ b/Documentation/devicetree/bindings/mfd/lp3943.txt
> > @@ -0,0 +1,23 @@
> > +Bindings for TI/National Semiconductor LP3943 Driver
> > +
> > +Required properties:
> > +  - compatible: "ti,lp3943"
> > +  - reg: 7bit I2C slave address. 0x60 ~ 0x67
> > +
> > +Optional properties:
> > +  - ti,pwm0, ti,pwm1: Output channel definition for PWM port 0 and 1
> > +  0 = invalid, 1 = LED0, 2 = LED 1, ... 16 =
> > +LED15
> > +
> > +Datasheet
> > +  http://www.ti.com/lit/ds/snvs256b/snvs256b.pdf
> > +
> > +Application note: How to use LP3943 as a GPIO expander and PWM
> > +generator
> > +  http://www.ti.com/lit/an/snva287a/snva287a.pdf
> 
> Do we usually put these things into bindings?

Actually I want to put this information in the driver document, but
I've not found which part is the best place for the MFD documentation.

> > +Example:
> > +
> > +   lp3943@60 {
> > +   compatible = "ti,lp3943";
> > +   reg = <0x60>;
> > +   pwm1 = /bits/ 8 <2>;/* use LED1 output as PWM #1 */
> > +   };
> 
> OK so there is a way to state which lines are used for PWM.
> 
> I think you should also specify which lines are used for GPIO, and which
> lines are used for LEDs.
>
> And I'd like the masks to be passed to each subdriver, so we can avoid the
> scenario where one and the same line gets used for GPIO, LED and PWM at the
> same time.

Good idea. This is my missing point - I was writing the LP3943 DT is only used 
for the definition of the platform data.
Thanks.

Regards,
Milo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH 1/3] mfd: add LP3943 MFD driver

2013-07-21 Thread Kim, Milo
Hi Lee,
Thanks for your detailed review.

> > diff --git a/Documentation/devicetree/bindings/mfd/lp3943.txt
> b/Documentation/devicetree/bindings/mfd/lp3943.txt
> > new file mode 100644
> > index 000..4eb251d
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/mfd/lp3943.txt
> > @@ -0,0 +1,23 @@
> > +Bindings for TI/National Semiconductor LP3943 Driver
> > +
> > +Required properties:
> > +  - compatible: "ti,lp3943"
> > +  - reg: 7bit I2C slave address. 0x60 ~ 0x67
> > +
> > +Optional properties:
> > +  - ti,pwm0, ti,pwm1: Output channel definition for PWM port 0 and 1
> > +  0 = invalid, 1 = LED0, 2 = LED 1, ... 16 = LED15
>  No space here ^  ^ comma here
> 
> This is actually pretty confusing.

Thanks for catching this. my ugly formatting :(

> Any way you can put the invalid entry at the end so, 0 == LED0?
> 
> > +Datasheet
> > +  http://www.ti.com/lit/ds/snvs256b/snvs256b.pdf
> 
> Ah, I see So the above are pins, rather than arbitrary channel Nos.
> 
> Would it make sense to use pinctrl instead then?

I'm not familiar with the PINCTRL subsystem. I'll check it.

> > +int lp3943_read_byte(struct lp3943 *l, u8 reg, u8 *read)
> 
> Not sure I like 'l' as a variable name. The function is small enough
> to get away with it in this context, but it would probably be better
> if it were renamed to something more meaningful.

LP3943 consists of two devices - GPIO and PWM drivers.
So each private data was defined as 

struct lp3943 *l;   /* MFD device */
struct lp3943_gpio *lg; /* GPIO driver */
struct lp3943_pwm *lp;  /* PWM driver */

As you pointed, the 'l' may look like a list of something.
I'll rename them as below.

struct lp3943 *lp3943;
struct lp3943_gpio *lp3943_gpio;
struct lp3943_pwm *lp3943_pwm;

> > +static const struct i2c_device_id lp3943_ids[] = {
> > +   {"lp3943", 0},
> 
> Lack of consistency ...

I don't know exactly what it means. Do you mean the name of I2C device?

Regards,
Milo


RE: [PATCH 1/3] mfd: add LP3943 MFD driver

2013-07-21 Thread Kim, Milo
Hi Lee,
Thanks for your detailed review.

  diff --git a/Documentation/devicetree/bindings/mfd/lp3943.txt
 b/Documentation/devicetree/bindings/mfd/lp3943.txt
  new file mode 100644
  index 000..4eb251d
  --- /dev/null
  +++ b/Documentation/devicetree/bindings/mfd/lp3943.txt
  @@ -0,0 +1,23 @@
  +Bindings for TI/National Semiconductor LP3943 Driver
  +
  +Required properties:
  +  - compatible: ti,lp3943
  +  - reg: 7bit I2C slave address. 0x60 ~ 0x67
  +
  +Optional properties:
  +  - ti,pwm0, ti,pwm1: Output channel definition for PWM port 0 and 1
  +  0 = invalid, 1 = LED0, 2 = LED 1, ... 16 = LED15
  No space here ^  ^ comma here
 
 This is actually pretty confusing.

Thanks for catching this. my ugly formatting :(

 Any way you can put the invalid entry at the end so, 0 == LED0?
 
  +Datasheet
  +  http://www.ti.com/lit/ds/snvs256b/snvs256b.pdf
 
 Ah, I see So the above are pins, rather than arbitrary channel Nos.
 
 Would it make sense to use pinctrl instead then?

I'm not familiar with the PINCTRL subsystem. I'll check it.

  +int lp3943_read_byte(struct lp3943 *l, u8 reg, u8 *read)
 
 Not sure I like 'l' as a variable name. The function is small enough
 to get away with it in this context, but it would probably be better
 if it were renamed to something more meaningful.

LP3943 consists of two devices - GPIO and PWM drivers.
So each private data was defined as 

struct lp3943 *l;   /* MFD device */
struct lp3943_gpio *lg; /* GPIO driver */
struct lp3943_pwm *lp;  /* PWM driver */

As you pointed, the 'l' may look like a list of something.
I'll rename them as below.

struct lp3943 *lp3943;
struct lp3943_gpio *lp3943_gpio;
struct lp3943_pwm *lp3943_pwm;

  +static const struct i2c_device_id lp3943_ids[] = {
  +   {lp3943, 0},
 
 Lack of consistency ...

I don't know exactly what it means. Do you mean the name of I2C device?

Regards,
Milo


RE: [PATCH 1/3] mfd: add LP3943 MFD driver

2013-07-21 Thread Kim, Milo
 This needs to be reviewed by the devicetree people.
 Please break out the bindings separately and include
 devicet...@vger.kernel.org on that review.

OK, thanks.
 
  +++ b/Documentation/devicetree/bindings/mfd/lp3943.txt
  @@ -0,0 +1,23 @@
  +Bindings for TI/National Semiconductor LP3943 Driver
  +
  +Required properties:
  +  - compatible: ti,lp3943
  +  - reg: 7bit I2C slave address. 0x60 ~ 0x67
  +
  +Optional properties:
  +  - ti,pwm0, ti,pwm1: Output channel definition for PWM port 0 and 1
  +  0 = invalid, 1 = LED0, 2 = LED 1, ... 16 =
  +LED15
  +
  +Datasheet
  +  http://www.ti.com/lit/ds/snvs256b/snvs256b.pdf
  +
  +Application note: How to use LP3943 as a GPIO expander and PWM
  +generator
  +  http://www.ti.com/lit/an/snva287a/snva287a.pdf
 
 Do we usually put these things into bindings?

Actually I want to put this information in the driver document, but
I've not found which part is the best place for the MFD documentation.

  +Example:
  +
  +   lp3943@60 {
  +   compatible = ti,lp3943;
  +   reg = 0x60;
  +   pwm1 = /bits/ 8 2;/* use LED1 output as PWM #1 */
  +   };
 
 OK so there is a way to state which lines are used for PWM.
 
 I think you should also specify which lines are used for GPIO, and which
 lines are used for LEDs.

 And I'd like the masks to be passed to each subdriver, so we can avoid the
 scenario where one and the same line gets used for GPIO, LED and PWM at the
 same time.

Good idea. This is my missing point - I was writing the LP3943 DT is only used 
for the definition of the platform data.
Thanks.

Regards,
Milo
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] mfd: add LP3943 MFD driver

2013-07-20 Thread Linus Walleij
On Tue, Jul 16, 2013 at 4:38 AM, Kim, Milo  wrote:

This needs to be reviewed by the devicetree people.
Please break out the bindings separately and include
devicet...@vger.kernel.org on that review.

> +++ b/Documentation/devicetree/bindings/mfd/lp3943.txt
> @@ -0,0 +1,23 @@
> +Bindings for TI/National Semiconductor LP3943 Driver
> +
> +Required properties:
> +  - compatible: "ti,lp3943"
> +  - reg: 7bit I2C slave address. 0x60 ~ 0x67
> +
> +Optional properties:
> +  - ti,pwm0, ti,pwm1: Output channel definition for PWM port 0 and 1
> +  0 = invalid, 1 = LED0, 2 = LED 1, ... 16 = LED15
> +
> +Datasheet
> +  http://www.ti.com/lit/ds/snvs256b/snvs256b.pdf
> +
> +Application note: How to use LP3943 as a GPIO expander and PWM generator
> +  http://www.ti.com/lit/an/snva287a/snva287a.pdf

Do we usually put these things into bindings?

> +Example:
> +
> +   lp3943@60 {
> +   compatible = "ti,lp3943";
> +   reg = <0x60>;
> +   pwm1 = /bits/ 8 <2>;/* use LED1 output as PWM #1 */
> +   };

OK so there is a way to state which lines are used for PWM.

I think you should also specify which lines are used for GPIO,
and which lines are used for LEDs.

And I'd like the masks to be passed to each subdriver, so we
can avoid the scenario where one and the same line gets
used for GPIO, LED and PWM at the same time.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] mfd: add LP3943 MFD driver

2013-07-20 Thread Linus Walleij
On Tue, Jul 16, 2013 at 4:38 AM, Kim, Milo milo@ti.com wrote:

This needs to be reviewed by the devicetree people.
Please break out the bindings separately and include
devicet...@vger.kernel.org on that review.

 +++ b/Documentation/devicetree/bindings/mfd/lp3943.txt
 @@ -0,0 +1,23 @@
 +Bindings for TI/National Semiconductor LP3943 Driver
 +
 +Required properties:
 +  - compatible: ti,lp3943
 +  - reg: 7bit I2C slave address. 0x60 ~ 0x67
 +
 +Optional properties:
 +  - ti,pwm0, ti,pwm1: Output channel definition for PWM port 0 and 1
 +  0 = invalid, 1 = LED0, 2 = LED 1, ... 16 = LED15
 +
 +Datasheet
 +  http://www.ti.com/lit/ds/snvs256b/snvs256b.pdf
 +
 +Application note: How to use LP3943 as a GPIO expander and PWM generator
 +  http://www.ti.com/lit/an/snva287a/snva287a.pdf

Do we usually put these things into bindings?

 +Example:
 +
 +   lp3943@60 {
 +   compatible = ti,lp3943;
 +   reg = 0x60;
 +   pwm1 = /bits/ 8 2;/* use LED1 output as PWM #1 */
 +   };

OK so there is a way to state which lines are used for PWM.

I think you should also specify which lines are used for GPIO,
and which lines are used for LEDs.

And I'd like the masks to be passed to each subdriver, so we
can avoid the scenario where one and the same line gets
used for GPIO, LED and PWM at the same time.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] mfd: add LP3943 MFD driver

2013-07-17 Thread Lee Jones
This driver is heavily regmap based, so I think it would make sense
for Mark Brown to glance over it briefly.

> LP3943 has 16 output LED channels which can be used as GPIO expander and
> PWM generators.
> This patch supports the MFD structure of those features.
> 
> * Regmap I2C interface for R/W LP3943 registers
> 
> * Device tree bindings updated
>   PWM generator output ports can be defined in the platform data.
>   Those are configurable with the DT structure as well.
> 
> Signed-off-by: Milo Kim 
> ---
>  Documentation/devicetree/bindings/mfd/lp3943.txt |   23 +++
>  drivers/mfd/Kconfig  |8 +
>  drivers/mfd/Makefile |1 +
>  drivers/mfd/lp3943.c |  206 
> ++
>  include/linux/mfd/lp3943.h   |   98 ++
>  5 files changed, 336 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/mfd/lp3943.txt
>  create mode 100644 drivers/mfd/lp3943.c
>  create mode 100644 include/linux/mfd/lp3943.h
> 
> diff --git a/Documentation/devicetree/bindings/mfd/lp3943.txt 
> b/Documentation/devicetree/bindings/mfd/lp3943.txt
> new file mode 100644
> index 000..4eb251d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mfd/lp3943.txt
> @@ -0,0 +1,23 @@
> +Bindings for TI/National Semiconductor LP3943 Driver
> +
> +Required properties:
> +  - compatible: "ti,lp3943"
> +  - reg: 7bit I2C slave address. 0x60 ~ 0x67
> +
> +Optional properties:
> +  - ti,pwm0, ti,pwm1: Output channel definition for PWM port 0 and 1
> +  0 = invalid, 1 = LED0, 2 = LED 1, ... 16 = LED15
 No space here ^  ^ comma here

This is actually pretty confusing. 

Any way you can put the invalid entry at the end so, 0 == LED0?

> +Datasheet
> +  http://www.ti.com/lit/ds/snvs256b/snvs256b.pdf

Ah, I see So the above are pins, rather than arbitrary channel Nos.

Would it make sense to use pinctrl instead then?

> +Application note: How to use LP3943 as a GPIO expander and PWM generator
> +  http://www.ti.com/lit/an/snva287a/snva287a.pdf
> +
> +Example:
> +
> + lp3943@60 {
> + compatible = "ti,lp3943";
> + reg = <0x60>;
> + pwm1 = /bits/ 8 <2>;/* use LED1 output as PWM #1 */
> + };
> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index ff553ba..cf9b943 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -506,6 +506,14 @@ config PMIC_ADP5520
> individual components like LCD backlight, LEDs, GPIOs and Kepad
> under the corresponding menus.
>  
> +config MFD_LP3943
> + tristate "TI/National Semiconductor LP3943 MFD Driver"
> + depends on I2C
> + select MFD_CORE
> + select REGMAP_I2C
> + help
> +   TI LP3943 supports a GPIO expander and two PWM generators.
> +
>  config MFD_LP8788
>   bool "Texas Instruments LP8788 Power Management Unit Driver"
>   depends on I2C=y
> diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
> index 8b977f8..8f129a4 100644
> --- a/drivers/mfd/Makefile
> +++ b/drivers/mfd/Makefile
> @@ -96,6 +96,7 @@ obj-$(CONFIG_PMIC_DA9052)   += da9052-core.o
>  obj-$(CONFIG_MFD_DA9052_SPI) += da9052-spi.o
>  obj-$(CONFIG_MFD_DA9052_I2C) += da9052-i2c.o
>  
> +obj-$(CONFIG_MFD_LP3943) += lp3943.o
>  obj-$(CONFIG_MFD_LP8788) += lp8788.o lp8788-irq.o
>  
>  da9055-objs  := da9055-core.o da9055-i2c.o
> diff --git a/drivers/mfd/lp3943.c b/drivers/mfd/lp3943.c
> new file mode 100644
> index 000..6d31066
> --- /dev/null
> +++ b/drivers/mfd/lp3943.c
> @@ -0,0 +1,206 @@
> +/*
> + * TI/National Semiconductor LP3943 MFD Core Driver
> + *
> + * Copyright 2013 Texas Instruments
> + *
> + * Author: Milo(Woogyom) Kim 
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#define LP3943_MAX_REGISTERS 0x09
> +
> +/* Register configuration for pin MUX */
> +static const struct lp3943_reg_cfg lp3943_mux_cfg[16] = {
> + /* address, mask, shift */
> + { LP3943_REG_MUX0, 0x03, 0 },
> + { LP3943_REG_MUX0, 0x0C, 2 },
> + { LP3943_REG_MUX0, 0x30, 4 },
> + { LP3943_REG_MUX0, 0xC0, 6 },
> + { LP3943_REG_MUX1, 0x03, 0 },
> + { LP3943_REG_MUX1, 0x0C, 2 },
> + { LP3943_REG_MUX1, 0x30, 4 },
> + { LP3943_REG_MUX1, 0xC0, 6 },
> + { LP3943_REG_MUX2, 0x03, 0 },
> + { LP3943_REG_MUX2, 0x0C, 2 },
> + { LP3943_REG_MUX2, 0x30, 4 },
> + { LP3943_REG_MUX2, 0xC0, 6 },
> + { LP3943_REG_MUX3, 0x03, 0 },
> + { LP3943_REG_MUX3, 0x0C, 2 },
> + { LP3943_REG_MUX3, 0x30, 4 },
> + { LP3943_REG_MUX3, 0xC0, 6 },
> +};
> +
> +static struct mfd_cell lp3943_devs[] = {
> 

Re: [PATCH 1/3] mfd: add LP3943 MFD driver

2013-07-17 Thread Lee Jones
This driver is heavily regmap based, so I think it would make sense
for Mark Brown to glance over it briefly.

 LP3943 has 16 output LED channels which can be used as GPIO expander and
 PWM generators.
 This patch supports the MFD structure of those features.
 
 * Regmap I2C interface for R/W LP3943 registers
 
 * Device tree bindings updated
   PWM generator output ports can be defined in the platform data.
   Those are configurable with the DT structure as well.
 
 Signed-off-by: Milo Kim milo@ti.com
 ---
  Documentation/devicetree/bindings/mfd/lp3943.txt |   23 +++
  drivers/mfd/Kconfig  |8 +
  drivers/mfd/Makefile |1 +
  drivers/mfd/lp3943.c |  206 
 ++
  include/linux/mfd/lp3943.h   |   98 ++
  5 files changed, 336 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/mfd/lp3943.txt
  create mode 100644 drivers/mfd/lp3943.c
  create mode 100644 include/linux/mfd/lp3943.h
 
 diff --git a/Documentation/devicetree/bindings/mfd/lp3943.txt 
 b/Documentation/devicetree/bindings/mfd/lp3943.txt
 new file mode 100644
 index 000..4eb251d
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/mfd/lp3943.txt
 @@ -0,0 +1,23 @@
 +Bindings for TI/National Semiconductor LP3943 Driver
 +
 +Required properties:
 +  - compatible: ti,lp3943
 +  - reg: 7bit I2C slave address. 0x60 ~ 0x67
 +
 +Optional properties:
 +  - ti,pwm0, ti,pwm1: Output channel definition for PWM port 0 and 1
 +  0 = invalid, 1 = LED0, 2 = LED 1, ... 16 = LED15
 No space here ^  ^ comma here

This is actually pretty confusing. 

Any way you can put the invalid entry at the end so, 0 == LED0?

 +Datasheet
 +  http://www.ti.com/lit/ds/snvs256b/snvs256b.pdf

Ah, I see So the above are pins, rather than arbitrary channel Nos.

Would it make sense to use pinctrl instead then?

 +Application note: How to use LP3943 as a GPIO expander and PWM generator
 +  http://www.ti.com/lit/an/snva287a/snva287a.pdf
 +
 +Example:
 +
 + lp3943@60 {
 + compatible = ti,lp3943;
 + reg = 0x60;
 + pwm1 = /bits/ 8 2;/* use LED1 output as PWM #1 */
 + };
 diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
 index ff553ba..cf9b943 100644
 --- a/drivers/mfd/Kconfig
 +++ b/drivers/mfd/Kconfig
 @@ -506,6 +506,14 @@ config PMIC_ADP5520
 individual components like LCD backlight, LEDs, GPIOs and Kepad
 under the corresponding menus.
  
 +config MFD_LP3943
 + tristate TI/National Semiconductor LP3943 MFD Driver
 + depends on I2C
 + select MFD_CORE
 + select REGMAP_I2C
 + help
 +   TI LP3943 supports a GPIO expander and two PWM generators.
 +
  config MFD_LP8788
   bool Texas Instruments LP8788 Power Management Unit Driver
   depends on I2C=y
 diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
 index 8b977f8..8f129a4 100644
 --- a/drivers/mfd/Makefile
 +++ b/drivers/mfd/Makefile
 @@ -96,6 +96,7 @@ obj-$(CONFIG_PMIC_DA9052)   += da9052-core.o
  obj-$(CONFIG_MFD_DA9052_SPI) += da9052-spi.o
  obj-$(CONFIG_MFD_DA9052_I2C) += da9052-i2c.o
  
 +obj-$(CONFIG_MFD_LP3943) += lp3943.o
  obj-$(CONFIG_MFD_LP8788) += lp8788.o lp8788-irq.o
  
  da9055-objs  := da9055-core.o da9055-i2c.o
 diff --git a/drivers/mfd/lp3943.c b/drivers/mfd/lp3943.c
 new file mode 100644
 index 000..6d31066
 --- /dev/null
 +++ b/drivers/mfd/lp3943.c
 @@ -0,0 +1,206 @@
 +/*
 + * TI/National Semiconductor LP3943 MFD Core Driver
 + *
 + * Copyright 2013 Texas Instruments
 + *
 + * Author: Milo(Woogyom) Kim milo@ti.com
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License version 2 as
 + * published by the Free Software Foundation.
 + *
 + */
 +
 +#include linux/err.h
 +#include linux/gpio.h
 +#include linux/i2c.h
 +#include linux/mfd/core.h
 +#include linux/mfd/lp3943.h
 +#include linux/module.h
 +#include linux/of.h
 +#include linux/of_gpio.h
 +#include linux/slab.h
 +
 +#define LP3943_MAX_REGISTERS 0x09
 +
 +/* Register configuration for pin MUX */
 +static const struct lp3943_reg_cfg lp3943_mux_cfg[16] = {
 + /* address, mask, shift */
 + { LP3943_REG_MUX0, 0x03, 0 },
 + { LP3943_REG_MUX0, 0x0C, 2 },
 + { LP3943_REG_MUX0, 0x30, 4 },
 + { LP3943_REG_MUX0, 0xC0, 6 },
 + { LP3943_REG_MUX1, 0x03, 0 },
 + { LP3943_REG_MUX1, 0x0C, 2 },
 + { LP3943_REG_MUX1, 0x30, 4 },
 + { LP3943_REG_MUX1, 0xC0, 6 },
 + { LP3943_REG_MUX2, 0x03, 0 },
 + { LP3943_REG_MUX2, 0x0C, 2 },
 + { LP3943_REG_MUX2, 0x30, 4 },
 + { LP3943_REG_MUX2, 0xC0, 6 },
 + { LP3943_REG_MUX3, 0x03, 0 },
 + { LP3943_REG_MUX3, 0x0C, 2 },
 + { LP3943_REG_MUX3, 0x30, 4 },
 + { LP3943_REG_MUX3, 0xC0, 6 },
 +};
 +
 +static struct mfd_cell lp3943_devs[] = {