Re: [PATCH 2/2] mfd: add TI LMU driver

2017-03-14 Thread Lee Jones
On Tue, 28 Feb 2017, Milo Kim wrote:

> TI LMU (Lighting Management Unit) driver supports lighting devices below.
> 
>   LM3532, LM3631, LM3632, LM3633, LM3695 and LM3697.
> 
> LMU devices have common features.
>   - I2C interface for accessing device registers
>   - Hardware enable pin control
>   - Backlight brightness control
>   - Notifier for hardware fault monitoring
>   - Regulators for LCD display bias
> 
> It contains fault monitor, backlight, LED and regulator driver.
> 
> LMU fault monitor
> -
>   LM3633 and LM3697 provide hardware monitoring feature.
>   It enables open or short circuit detection.
>   After monitoring is done, each device should be re-initialized.
>   Notifier is used for this case.
>   Separate patch for 'ti-lmu-fault-monitor' will be sent later.
> 
> Backlight
> -
>   It's handled by TI LMU backlight consolidated driver and
>   chip dependent data. Separate patchset will be sent later.
> 
> LED indicator
> -
>   LM3633 has 6 indicator LEDs. Programmable dimming pattern is also
>   supported. Separate patch for 'leds-lm3633' will be sent later.
> 
> Regulator
> -
>   LM3631 has 5 regulators for the display bias.
>   LM3632 supports 3 regulators. One consolidated driver enables it.
>   The lm363x regulator driver is already upstreamed.
> 
> Acked-by: Lee Jones 
> Signed-off-by: Milo Kim 
> ---
>  drivers/mfd/Kconfig |  12 ++
>  drivers/mfd/Makefile|   2 +
>  drivers/mfd/ti-lmu.c| 259 +
>  include/linux/mfd/ti-lmu-register.h | 280 
> 
>  include/linux/mfd/ti-lmu.h  |  87 +++
>  5 files changed, 640 insertions(+)
>  create mode 100644 drivers/mfd/ti-lmu.c
>  create mode 100644 include/linux/mfd/ti-lmu-register.h
>  create mode 100644 include/linux/mfd/ti-lmu.h

Applied, thanks.

> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index 55ecdfb74d31..75e749c1ff1a 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -1164,6 +1164,18 @@ config MFD_LP8788
> TI LP8788 PMU supports regulators, battery charger, RTC,
> ADC, backlight driver and current sinks.
>  
> +config MFD_TI_LMU
> + tristate "TI Lighting Management Unit driver"
> + depends on I2C
> + select MFD_CORE
> + select REGMAP_I2C
> + help
> +   Say yes here to enable support for TI LMU chips.
> +
> +   TI LMU MFD supports LM3532, LM3631, LM3632, LM3633, LM3695 and LM3697.
> +   It consists of backlight, LED and regulator driver.
> +   It provides consistent device controls for lighting functions.
> +
>  config MFD_OMAP_USB_HOST
>   bool "TI OMAP USBHS core and TLL driver"
>   depends on USB_EHCI_HCD_OMAP || USB_OHCI_HCD_OMAP3
> diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
> index 31ce07611a6f..dac78a0f23a7 100644
> --- a/drivers/mfd/Makefile
> +++ b/drivers/mfd/Makefile
> @@ -125,6 +125,8 @@ obj-$(CONFIG_MFD_AXP20X_RSB)  += axp20x-rsb.o
>  obj-$(CONFIG_MFD_LP3943) += lp3943.o
>  obj-$(CONFIG_MFD_LP8788) += lp8788.o lp8788-irq.o
>  
> +obj-$(CONFIG_MFD_TI_LMU) += ti-lmu.o
> +
>  da9055-objs  := da9055-core.o da9055-i2c.o
>  obj-$(CONFIG_MFD_DA9055) += da9055.o
>  obj-$(CONFIG_MFD_DA9062) += da9062-core.o
> diff --git a/drivers/mfd/ti-lmu.c b/drivers/mfd/ti-lmu.c
> new file mode 100644
> index ..cfb411cde51c
> --- /dev/null
> +++ b/drivers/mfd/ti-lmu.c
> @@ -0,0 +1,259 @@
> +/*
> + * TI LMU (Lighting Management Unit) Core Driver
> + *
> + * Copyright 2017 Texas Instruments
> + *
> + * Author: Milo 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 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +struct ti_lmu_data {
> + struct mfd_cell *cells;
> + int num_cells;
> + unsigned int max_register;
> +};
> +
> +static int ti_lmu_enable_hw(struct ti_lmu *lmu, enum ti_lmu_id id)
> +{
> + int ret;
> +
> + if (gpio_is_valid(lmu->en_gpio)) {
> + ret = devm_gpio_request_one(lmu->dev, lmu->en_gpio,
> + GPIOF_OUT_INIT_HIGH, "lmu_hwen");
> + if (ret) {
> + dev_err(lmu->dev, "Can not request enable GPIO: %d\n",
> + ret);
> + return ret;
> + }
> + }
> +
> + /* Delay about 1ms after HW enable pin control */
> + usleep_range(1000, 1500);
> +
> + /* LM3631 has additional power up sequence - enable LCD_EN bit. */
> + if (id == LM3631) {
> + return regmap_update_bits(lmu->regmap, 

Re: [PATCH 2/2] mfd: add TI LMU driver

2017-03-14 Thread Lee Jones
On Tue, 28 Feb 2017, Milo Kim wrote:

> TI LMU (Lighting Management Unit) driver supports lighting devices below.
> 
>   LM3532, LM3631, LM3632, LM3633, LM3695 and LM3697.
> 
> LMU devices have common features.
>   - I2C interface for accessing device registers
>   - Hardware enable pin control
>   - Backlight brightness control
>   - Notifier for hardware fault monitoring
>   - Regulators for LCD display bias
> 
> It contains fault monitor, backlight, LED and regulator driver.
> 
> LMU fault monitor
> -
>   LM3633 and LM3697 provide hardware monitoring feature.
>   It enables open or short circuit detection.
>   After monitoring is done, each device should be re-initialized.
>   Notifier is used for this case.
>   Separate patch for 'ti-lmu-fault-monitor' will be sent later.
> 
> Backlight
> -
>   It's handled by TI LMU backlight consolidated driver and
>   chip dependent data. Separate patchset will be sent later.
> 
> LED indicator
> -
>   LM3633 has 6 indicator LEDs. Programmable dimming pattern is also
>   supported. Separate patch for 'leds-lm3633' will be sent later.
> 
> Regulator
> -
>   LM3631 has 5 regulators for the display bias.
>   LM3632 supports 3 regulators. One consolidated driver enables it.
>   The lm363x regulator driver is already upstreamed.
> 
> Acked-by: Lee Jones 
> Signed-off-by: Milo Kim 
> ---
>  drivers/mfd/Kconfig |  12 ++
>  drivers/mfd/Makefile|   2 +
>  drivers/mfd/ti-lmu.c| 259 +
>  include/linux/mfd/ti-lmu-register.h | 280 
> 
>  include/linux/mfd/ti-lmu.h  |  87 +++
>  5 files changed, 640 insertions(+)
>  create mode 100644 drivers/mfd/ti-lmu.c
>  create mode 100644 include/linux/mfd/ti-lmu-register.h
>  create mode 100644 include/linux/mfd/ti-lmu.h

Applied, thanks.

> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index 55ecdfb74d31..75e749c1ff1a 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -1164,6 +1164,18 @@ config MFD_LP8788
> TI LP8788 PMU supports regulators, battery charger, RTC,
> ADC, backlight driver and current sinks.
>  
> +config MFD_TI_LMU
> + tristate "TI Lighting Management Unit driver"
> + depends on I2C
> + select MFD_CORE
> + select REGMAP_I2C
> + help
> +   Say yes here to enable support for TI LMU chips.
> +
> +   TI LMU MFD supports LM3532, LM3631, LM3632, LM3633, LM3695 and LM3697.
> +   It consists of backlight, LED and regulator driver.
> +   It provides consistent device controls for lighting functions.
> +
>  config MFD_OMAP_USB_HOST
>   bool "TI OMAP USBHS core and TLL driver"
>   depends on USB_EHCI_HCD_OMAP || USB_OHCI_HCD_OMAP3
> diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
> index 31ce07611a6f..dac78a0f23a7 100644
> --- a/drivers/mfd/Makefile
> +++ b/drivers/mfd/Makefile
> @@ -125,6 +125,8 @@ obj-$(CONFIG_MFD_AXP20X_RSB)  += axp20x-rsb.o
>  obj-$(CONFIG_MFD_LP3943) += lp3943.o
>  obj-$(CONFIG_MFD_LP8788) += lp8788.o lp8788-irq.o
>  
> +obj-$(CONFIG_MFD_TI_LMU) += ti-lmu.o
> +
>  da9055-objs  := da9055-core.o da9055-i2c.o
>  obj-$(CONFIG_MFD_DA9055) += da9055.o
>  obj-$(CONFIG_MFD_DA9062) += da9062-core.o
> diff --git a/drivers/mfd/ti-lmu.c b/drivers/mfd/ti-lmu.c
> new file mode 100644
> index ..cfb411cde51c
> --- /dev/null
> +++ b/drivers/mfd/ti-lmu.c
> @@ -0,0 +1,259 @@
> +/*
> + * TI LMU (Lighting Management Unit) Core Driver
> + *
> + * Copyright 2017 Texas Instruments
> + *
> + * Author: Milo 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 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +struct ti_lmu_data {
> + struct mfd_cell *cells;
> + int num_cells;
> + unsigned int max_register;
> +};
> +
> +static int ti_lmu_enable_hw(struct ti_lmu *lmu, enum ti_lmu_id id)
> +{
> + int ret;
> +
> + if (gpio_is_valid(lmu->en_gpio)) {
> + ret = devm_gpio_request_one(lmu->dev, lmu->en_gpio,
> + GPIOF_OUT_INIT_HIGH, "lmu_hwen");
> + if (ret) {
> + dev_err(lmu->dev, "Can not request enable GPIO: %d\n",
> + ret);
> + return ret;
> + }
> + }
> +
> + /* Delay about 1ms after HW enable pin control */
> + usleep_range(1000, 1500);
> +
> + /* LM3631 has additional power up sequence - enable LCD_EN bit. */
> + if (id == LM3631) {
> + return regmap_update_bits(lmu->regmap, LM3631_REG_DEVCTRL,
> +   

Re: [PATCH 2/2] mfd: add TI LMU driver

2017-02-28 Thread Tony Lindgren
* Milo Kim  [170227 22:47]:
> TI LMU (Lighting Management Unit) driver supports lighting devices below.
> 
>   LM3532, LM3631, LM3632, LM3633, LM3695 and LM3697.
> 
> LMU devices have common features.
>   - I2C interface for accessing device registers
>   - Hardware enable pin control
>   - Backlight brightness control
>   - Notifier for hardware fault monitoring
>   - Regulators for LCD display bias
> 
> It contains fault monitor, backlight, LED and regulator driver.
> 
> LMU fault monitor
> -
>   LM3633 and LM3697 provide hardware monitoring feature.
>   It enables open or short circuit detection.
>   After monitoring is done, each device should be re-initialized.
>   Notifier is used for this case.
>   Separate patch for 'ti-lmu-fault-monitor' will be sent later.
> 
> Backlight
> -
>   It's handled by TI LMU backlight consolidated driver and
>   chip dependent data. Separate patchset will be sent later.
> 
> LED indicator
> -
>   LM3633 has 6 indicator LEDs. Programmable dimming pattern is also
>   supported. Separate patch for 'leds-lm3633' will be sent later.
> 
> Regulator
> -
>   LM3631 has 5 regulators for the display bias.
>   LM3632 supports 3 regulators. One consolidated driver enables it.
>   The lm363x regulator driver is already upstreamed.
> 
> Acked-by: Lee Jones 
> Signed-off-by: Milo Kim 

This works for me on droid 4 with LM3632 using your earlier
"[v2,7/9] backlight: add TI LMU backlight driver" patch at
https://patchwork.kernel.org/patch/7704601/

I had to update the dts file according to the binding and then
enable backlight after booting with:

# echo 180 > /sys/class/backlight/lcd/brightness

So please feel free to add:

Tested-by: Tony Lindgren 


Re: [PATCH 2/2] mfd: add TI LMU driver

2017-02-28 Thread Tony Lindgren
* Milo Kim  [170227 22:47]:
> TI LMU (Lighting Management Unit) driver supports lighting devices below.
> 
>   LM3532, LM3631, LM3632, LM3633, LM3695 and LM3697.
> 
> LMU devices have common features.
>   - I2C interface for accessing device registers
>   - Hardware enable pin control
>   - Backlight brightness control
>   - Notifier for hardware fault monitoring
>   - Regulators for LCD display bias
> 
> It contains fault monitor, backlight, LED and regulator driver.
> 
> LMU fault monitor
> -
>   LM3633 and LM3697 provide hardware monitoring feature.
>   It enables open or short circuit detection.
>   After monitoring is done, each device should be re-initialized.
>   Notifier is used for this case.
>   Separate patch for 'ti-lmu-fault-monitor' will be sent later.
> 
> Backlight
> -
>   It's handled by TI LMU backlight consolidated driver and
>   chip dependent data. Separate patchset will be sent later.
> 
> LED indicator
> -
>   LM3633 has 6 indicator LEDs. Programmable dimming pattern is also
>   supported. Separate patch for 'leds-lm3633' will be sent later.
> 
> Regulator
> -
>   LM3631 has 5 regulators for the display bias.
>   LM3632 supports 3 regulators. One consolidated driver enables it.
>   The lm363x regulator driver is already upstreamed.
> 
> Acked-by: Lee Jones 
> Signed-off-by: Milo Kim 

This works for me on droid 4 with LM3632 using your earlier
"[v2,7/9] backlight: add TI LMU backlight driver" patch at
https://patchwork.kernel.org/patch/7704601/

I had to update the dts file according to the binding and then
enable backlight after booting with:

# echo 180 > /sys/class/backlight/lcd/brightness

So please feel free to add:

Tested-by: Tony Lindgren 


[PATCH 2/2] mfd: add TI LMU driver

2017-02-27 Thread Milo Kim
TI LMU (Lighting Management Unit) driver supports lighting devices below.

  LM3532, LM3631, LM3632, LM3633, LM3695 and LM3697.

LMU devices have common features.
  - I2C interface for accessing device registers
  - Hardware enable pin control
  - Backlight brightness control
  - Notifier for hardware fault monitoring
  - Regulators for LCD display bias

It contains fault monitor, backlight, LED and regulator driver.

LMU fault monitor
-
  LM3633 and LM3697 provide hardware monitoring feature.
  It enables open or short circuit detection.
  After monitoring is done, each device should be re-initialized.
  Notifier is used for this case.
  Separate patch for 'ti-lmu-fault-monitor' will be sent later.

Backlight
-
  It's handled by TI LMU backlight consolidated driver and
  chip dependent data. Separate patchset will be sent later.

LED indicator
-
  LM3633 has 6 indicator LEDs. Programmable dimming pattern is also
  supported. Separate patch for 'leds-lm3633' will be sent later.

Regulator
-
  LM3631 has 5 regulators for the display bias.
  LM3632 supports 3 regulators. One consolidated driver enables it.
  The lm363x regulator driver is already upstreamed.

Acked-by: Lee Jones 
Signed-off-by: Milo Kim 
---
 drivers/mfd/Kconfig |  12 ++
 drivers/mfd/Makefile|   2 +
 drivers/mfd/ti-lmu.c| 259 +
 include/linux/mfd/ti-lmu-register.h | 280 
 include/linux/mfd/ti-lmu.h  |  87 +++
 5 files changed, 640 insertions(+)
 create mode 100644 drivers/mfd/ti-lmu.c
 create mode 100644 include/linux/mfd/ti-lmu-register.h
 create mode 100644 include/linux/mfd/ti-lmu.h

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 55ecdfb74d31..75e749c1ff1a 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -1164,6 +1164,18 @@ config MFD_LP8788
  TI LP8788 PMU supports regulators, battery charger, RTC,
  ADC, backlight driver and current sinks.
 
+config MFD_TI_LMU
+   tristate "TI Lighting Management Unit driver"
+   depends on I2C
+   select MFD_CORE
+   select REGMAP_I2C
+   help
+ Say yes here to enable support for TI LMU chips.
+
+ TI LMU MFD supports LM3532, LM3631, LM3632, LM3633, LM3695 and LM3697.
+ It consists of backlight, LED and regulator driver.
+ It provides consistent device controls for lighting functions.
+
 config MFD_OMAP_USB_HOST
bool "TI OMAP USBHS core and TLL driver"
depends on USB_EHCI_HCD_OMAP || USB_OHCI_HCD_OMAP3
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 31ce07611a6f..dac78a0f23a7 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -125,6 +125,8 @@ obj-$(CONFIG_MFD_AXP20X_RSB)+= axp20x-rsb.o
 obj-$(CONFIG_MFD_LP3943)   += lp3943.o
 obj-$(CONFIG_MFD_LP8788)   += lp8788.o lp8788-irq.o
 
+obj-$(CONFIG_MFD_TI_LMU)   += ti-lmu.o
+
 da9055-objs:= da9055-core.o da9055-i2c.o
 obj-$(CONFIG_MFD_DA9055)   += da9055.o
 obj-$(CONFIG_MFD_DA9062)   += da9062-core.o
diff --git a/drivers/mfd/ti-lmu.c b/drivers/mfd/ti-lmu.c
new file mode 100644
index ..cfb411cde51c
--- /dev/null
+++ b/drivers/mfd/ti-lmu.c
@@ -0,0 +1,259 @@
+/*
+ * TI LMU (Lighting Management Unit) Core Driver
+ *
+ * Copyright 2017 Texas Instruments
+ *
+ * Author: Milo 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 
+#include 
+#include 
+#include 
+#include 
+
+struct ti_lmu_data {
+   struct mfd_cell *cells;
+   int num_cells;
+   unsigned int max_register;
+};
+
+static int ti_lmu_enable_hw(struct ti_lmu *lmu, enum ti_lmu_id id)
+{
+   int ret;
+
+   if (gpio_is_valid(lmu->en_gpio)) {
+   ret = devm_gpio_request_one(lmu->dev, lmu->en_gpio,
+   GPIOF_OUT_INIT_HIGH, "lmu_hwen");
+   if (ret) {
+   dev_err(lmu->dev, "Can not request enable GPIO: %d\n",
+   ret);
+   return ret;
+   }
+   }
+
+   /* Delay about 1ms after HW enable pin control */
+   usleep_range(1000, 1500);
+
+   /* LM3631 has additional power up sequence - enable LCD_EN bit. */
+   if (id == LM3631) {
+   return regmap_update_bits(lmu->regmap, LM3631_REG_DEVCTRL,
+ LM3631_LCD_EN_MASK,
+ LM3631_LCD_EN_MASK);
+   }
+
+   return 0;
+}
+
+static void ti_lmu_disable_hw(struct ti_lmu *lmu)
+{
+   if (gpio_is_valid(lmu->en_gpio))
+  

[PATCH 2/2] mfd: add TI LMU driver

2017-02-27 Thread Milo Kim
TI LMU (Lighting Management Unit) driver supports lighting devices below.

  LM3532, LM3631, LM3632, LM3633, LM3695 and LM3697.

LMU devices have common features.
  - I2C interface for accessing device registers
  - Hardware enable pin control
  - Backlight brightness control
  - Notifier for hardware fault monitoring
  - Regulators for LCD display bias

It contains fault monitor, backlight, LED and regulator driver.

LMU fault monitor
-
  LM3633 and LM3697 provide hardware monitoring feature.
  It enables open or short circuit detection.
  After monitoring is done, each device should be re-initialized.
  Notifier is used for this case.
  Separate patch for 'ti-lmu-fault-monitor' will be sent later.

Backlight
-
  It's handled by TI LMU backlight consolidated driver and
  chip dependent data. Separate patchset will be sent later.

LED indicator
-
  LM3633 has 6 indicator LEDs. Programmable dimming pattern is also
  supported. Separate patch for 'leds-lm3633' will be sent later.

Regulator
-
  LM3631 has 5 regulators for the display bias.
  LM3632 supports 3 regulators. One consolidated driver enables it.
  The lm363x regulator driver is already upstreamed.

Acked-by: Lee Jones 
Signed-off-by: Milo Kim 
---
 drivers/mfd/Kconfig |  12 ++
 drivers/mfd/Makefile|   2 +
 drivers/mfd/ti-lmu.c| 259 +
 include/linux/mfd/ti-lmu-register.h | 280 
 include/linux/mfd/ti-lmu.h  |  87 +++
 5 files changed, 640 insertions(+)
 create mode 100644 drivers/mfd/ti-lmu.c
 create mode 100644 include/linux/mfd/ti-lmu-register.h
 create mode 100644 include/linux/mfd/ti-lmu.h

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 55ecdfb74d31..75e749c1ff1a 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -1164,6 +1164,18 @@ config MFD_LP8788
  TI LP8788 PMU supports regulators, battery charger, RTC,
  ADC, backlight driver and current sinks.
 
+config MFD_TI_LMU
+   tristate "TI Lighting Management Unit driver"
+   depends on I2C
+   select MFD_CORE
+   select REGMAP_I2C
+   help
+ Say yes here to enable support for TI LMU chips.
+
+ TI LMU MFD supports LM3532, LM3631, LM3632, LM3633, LM3695 and LM3697.
+ It consists of backlight, LED and regulator driver.
+ It provides consistent device controls for lighting functions.
+
 config MFD_OMAP_USB_HOST
bool "TI OMAP USBHS core and TLL driver"
depends on USB_EHCI_HCD_OMAP || USB_OHCI_HCD_OMAP3
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 31ce07611a6f..dac78a0f23a7 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -125,6 +125,8 @@ obj-$(CONFIG_MFD_AXP20X_RSB)+= axp20x-rsb.o
 obj-$(CONFIG_MFD_LP3943)   += lp3943.o
 obj-$(CONFIG_MFD_LP8788)   += lp8788.o lp8788-irq.o
 
+obj-$(CONFIG_MFD_TI_LMU)   += ti-lmu.o
+
 da9055-objs:= da9055-core.o da9055-i2c.o
 obj-$(CONFIG_MFD_DA9055)   += da9055.o
 obj-$(CONFIG_MFD_DA9062)   += da9062-core.o
diff --git a/drivers/mfd/ti-lmu.c b/drivers/mfd/ti-lmu.c
new file mode 100644
index ..cfb411cde51c
--- /dev/null
+++ b/drivers/mfd/ti-lmu.c
@@ -0,0 +1,259 @@
+/*
+ * TI LMU (Lighting Management Unit) Core Driver
+ *
+ * Copyright 2017 Texas Instruments
+ *
+ * Author: Milo 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 
+#include 
+#include 
+#include 
+#include 
+
+struct ti_lmu_data {
+   struct mfd_cell *cells;
+   int num_cells;
+   unsigned int max_register;
+};
+
+static int ti_lmu_enable_hw(struct ti_lmu *lmu, enum ti_lmu_id id)
+{
+   int ret;
+
+   if (gpio_is_valid(lmu->en_gpio)) {
+   ret = devm_gpio_request_one(lmu->dev, lmu->en_gpio,
+   GPIOF_OUT_INIT_HIGH, "lmu_hwen");
+   if (ret) {
+   dev_err(lmu->dev, "Can not request enable GPIO: %d\n",
+   ret);
+   return ret;
+   }
+   }
+
+   /* Delay about 1ms after HW enable pin control */
+   usleep_range(1000, 1500);
+
+   /* LM3631 has additional power up sequence - enable LCD_EN bit. */
+   if (id == LM3631) {
+   return regmap_update_bits(lmu->regmap, LM3631_REG_DEVCTRL,
+ LM3631_LCD_EN_MASK,
+ LM3631_LCD_EN_MASK);
+   }
+
+   return 0;
+}
+
+static void ti_lmu_disable_hw(struct ti_lmu *lmu)
+{
+   if (gpio_is_valid(lmu->en_gpio))
+   gpio_set_value(lmu->en_gpio, 0);
+}
+
+static