Re: [PATCH] media: i2c: add new driver for single string flash.

2015-01-20 Thread Daniel Jeong

Hi.

On Mon, 2015-01-19 at 17:25 +0900, Daniel Jeong wrote:

This patch adds the driver for the single string flash products of TI.
Several single string flash controllers of TI have similar register map
and bit data. This driver supports four products,lm3556, lm3561, lm3642
and lm3648.

Why not to name it as lm3648 to be in align with other drivers?

I tried to match it with the above line. I will fix it.


Or even better solution (I suppose) to create a "library" and on top of
that one driver per each device?

Sakari, what do you think?

Sakrai, I'd like to keep it but please let me know your opinion.

Signed-off-by: Daniel Jeong 
---
  drivers/media/i2c/Kconfig   |9 +
  drivers/media/i2c/Makefile  |1 +
  drivers/media/i2c/ti-ss-flash.c |  744 +++
  include/media/ti-ss-flash.h |   33 ++
  4 files changed, 787 insertions(+)
  create mode 100644 drivers/media/i2c/ti-ss-flash.c
  create mode 100644 include/media/ti-ss-flash.h

diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index 205d713..886c1fb 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -638,6 +638,15 @@ config VIDEO_LM3646
  This is a driver for the lm3646 dual flash controllers. It controls
  flash, torch LEDs.
  
+config VIDEO_TI_SS_FLASH

+   tristate "TI Single String Flash driver support"
+   depends on I2C && VIDEO_V4L2 && MEDIA_CONTROLLER
+   depends on MEDIA_CAMERA_SUPPORT
+   select REGMAP_I2C
+   ---help---
+ This is a driver for the signle string flash controllers of TI.
+ It supports LM3556, LM3561, LM3642 and LM3648.
+
  comment "Video improvement chips"
  
  config VIDEO_UPD64031A

diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
index 98589001..0e523ec 100644
--- a/drivers/media/i2c/Makefile
+++ b/drivers/media/i2c/Makefile
@@ -73,6 +73,7 @@ obj-$(CONFIG_VIDEO_ADP1653)   += adp1653.o
  obj-$(CONFIG_VIDEO_AS3645A)   += as3645a.o
  obj-$(CONFIG_VIDEO_LM3560)+= lm3560.o
  obj-$(CONFIG_VIDEO_LM3646)+= lm3646.o
+obj-$(CONFIG_VIDEO_TI_SS_FLASH)+= ti-ss-flash.o
  obj-$(CONFIG_VIDEO_SMIAPP_PLL)+= smiapp-pll.o
  obj-$(CONFIG_VIDEO_AK881X)+= ak881x.o
  obj-$(CONFIG_VIDEO_IR_I2C)  += ir-kbd-i2c.o
diff --git a/drivers/media/i2c/ti-ss-flash.c b/drivers/media/i2c/ti-ss-flash.c
new file mode 100644
index 000..035aeba
--- /dev/null
+++ b/drivers/media/i2c/ti-ss-flash.c
@@ -0,0 +1,744 @@
+/*
+ * drivers/media/i2c/ti-ss-flash.c
+ * General device driver for Single String FLASH LED Drivers of TI
+ * It covers lm3556, lm3561, lm3642 and lm3648.
+ *
+ * Copyright (C) 2015 Texas Instruments
+ *
+ * Contact: Daniel Jeong 
+ * Ldd-Mlp 
+ *
+ * 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 
+
+/* operation mode */
+enum led_opmode {
+   OPMODE_SHDN = 0x0,
+   OPMODE_INDI_IR,
+   OPMODE_TORCH,
+   OPMODE_FLASH,
+};
+
+/*
+ * register data
+ * @reg : register
+ * @mask : mask bits
+ * @shift : bit shift of data
+ */
+struct ctrl_reg {
+   unsigned int reg;
+   unsigned int mask;
+   unsigned int shift;
+};
+
+/*
+ * unit data
+ * @min : min value of brightness or timeout
+ *brightness : uA
+ *   timeout: ms
+ * @step : step value of brightness or timeout
+ *brightness : uA
+ *   timeout: ms
+ * @knee: knee point of step of brightness/timeout
+ *brightness : uA
+ *   timeout: ms
+ * @knee_step : step value of brightness or timeout after knee point
+ *brightness : uA
+ *   timeout: ms
+ * @max : max value of brightness or timeout
+ *brightness : uA
+ *   timeout: ms
+ * @ctrl : register info to control brightness or timeout
+ */
+struct ssflash_config {
+   unsigned int min;
+   unsigned int step;
+   unsigned int knee;
+   unsigned int knee_step;
+   unsigned int max;
+   struct ctrl_reg ctrl;
+};
+
+/*
+ * @reg : fault register
+ * @mask : fault mask bit
+ * @v4l2_fault : bit mapping to V4L2_FLASH_FAULT_
+ *   refer to include//uapi/linux/v4l2-controls.h
+ */
+struct ssflash_fault {
+   unsigned int reg;
+   unsigned int mask;
+   unsigned int v4l2_fault;
+};
+
+#define NUM_V4L2_FAULT 9
+
+/*
+ * ssflash data
+ * @name: device name
+ * @mode: operation mode control data
+ * @flash_br: flash brightness register and bit data
+ * @timeout: timeout control data
+ * @strobe: strobe control data
+ * @torch_br: torch brightness register and bit data
+ * @fault: fault data
+ * @func: initialize function
+ */
+struct ssflash_data {
+ 

Re: [PATCH] media: i2c: add new driver for single string flash.

2015-01-20 Thread Daniel Jeong

Hi.

On Mon, 2015-01-19 at 17:25 +0900, Daniel Jeong wrote:

This patch adds the driver for the single string flash products of TI.
Several single string flash controllers of TI have similar register map
and bit data. This driver supports four products,lm3556, lm3561, lm3642
and lm3648.

Why not to name it as lm3648 to be in align with other drivers?

I tried to match it with the above line. I will fix it.


Or even better solution (I suppose) to create a library and on top of
that one driver per each device?

Sakari, what do you think?

Sakrai, I'd like to keep it but please let me know your opinion.

Signed-off-by: Daniel Jeong gshark.je...@gmail.com
---
  drivers/media/i2c/Kconfig   |9 +
  drivers/media/i2c/Makefile  |1 +
  drivers/media/i2c/ti-ss-flash.c |  744 +++
  include/media/ti-ss-flash.h |   33 ++
  4 files changed, 787 insertions(+)
  create mode 100644 drivers/media/i2c/ti-ss-flash.c
  create mode 100644 include/media/ti-ss-flash.h

diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index 205d713..886c1fb 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -638,6 +638,15 @@ config VIDEO_LM3646
  This is a driver for the lm3646 dual flash controllers. It controls
  flash, torch LEDs.
  
+config VIDEO_TI_SS_FLASH

+   tristate TI Single String Flash driver support
+   depends on I2C  VIDEO_V4L2  MEDIA_CONTROLLER
+   depends on MEDIA_CAMERA_SUPPORT
+   select REGMAP_I2C
+   ---help---
+ This is a driver for the signle string flash controllers of TI.
+ It supports LM3556, LM3561, LM3642 and LM3648.
+
  comment Video improvement chips
  
  config VIDEO_UPD64031A

diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
index 98589001..0e523ec 100644
--- a/drivers/media/i2c/Makefile
+++ b/drivers/media/i2c/Makefile
@@ -73,6 +73,7 @@ obj-$(CONFIG_VIDEO_ADP1653)   += adp1653.o
  obj-$(CONFIG_VIDEO_AS3645A)   += as3645a.o
  obj-$(CONFIG_VIDEO_LM3560)+= lm3560.o
  obj-$(CONFIG_VIDEO_LM3646)+= lm3646.o
+obj-$(CONFIG_VIDEO_TI_SS_FLASH)+= ti-ss-flash.o
  obj-$(CONFIG_VIDEO_SMIAPP_PLL)+= smiapp-pll.o
  obj-$(CONFIG_VIDEO_AK881X)+= ak881x.o
  obj-$(CONFIG_VIDEO_IR_I2C)  += ir-kbd-i2c.o
diff --git a/drivers/media/i2c/ti-ss-flash.c b/drivers/media/i2c/ti-ss-flash.c
new file mode 100644
index 000..035aeba
--- /dev/null
+++ b/drivers/media/i2c/ti-ss-flash.c
@@ -0,0 +1,744 @@
+/*
+ * drivers/media/i2c/ti-ss-flash.c
+ * General device driver for Single String FLASH LED Drivers of TI
+ * It covers lm3556, lm3561, lm3642 and lm3648.
+ *
+ * Copyright (C) 2015 Texas Instruments
+ *
+ * Contact: Daniel Jeong gshark.je...@gmail.com
+ * Ldd-Mlp ldd-...@list.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/delay.h
+#include linux/i2c.h
+#include linux/module.h
+#include linux/of_device.h
+#include linux/regmap.h
+#include linux/slab.h
+#include linux/videodev2.h
+#include media/ti-ss-flash.h
+#include media/v4l2-ctrls.h
+#include media/v4l2-device.h
+
+/* operation mode */
+enum led_opmode {
+   OPMODE_SHDN = 0x0,
+   OPMODE_INDI_IR,
+   OPMODE_TORCH,
+   OPMODE_FLASH,
+};
+
+/*
+ * register data
+ * @reg : register
+ * @mask : mask bits
+ * @shift : bit shift of data
+ */
+struct ctrl_reg {
+   unsigned int reg;
+   unsigned int mask;
+   unsigned int shift;
+};
+
+/*
+ * unit data
+ * @min : min value of brightness or timeout
+ *brightness : uA
+ *   timeout: ms
+ * @step : step value of brightness or timeout
+ *brightness : uA
+ *   timeout: ms
+ * @knee: knee point of step of brightness/timeout
+ *brightness : uA
+ *   timeout: ms
+ * @knee_step : step value of brightness or timeout after knee point
+ *brightness : uA
+ *   timeout: ms
+ * @max : max value of brightness or timeout
+ *brightness : uA
+ *   timeout: ms
+ * @ctrl : register info to control brightness or timeout
+ */
+struct ssflash_config {
+   unsigned int min;
+   unsigned int step;
+   unsigned int knee;
+   unsigned int knee_step;
+   unsigned int max;
+   struct ctrl_reg ctrl;
+};
+
+/*
+ * @reg : fault register
+ * @mask : fault mask bit
+ * @v4l2_fault : bit mapping to V4L2_FLASH_FAULT_
+ *   refer to include//uapi/linux/v4l2-controls.h
+ */
+struct ssflash_fault {
+   unsigned int reg;
+   unsigned int mask;
+   unsigned int v4l2_fault;
+};
+
+#define NUM_V4L2_FAULT 9
+
+/*
+ * ssflash data
+ * @name: device name
+ * @mode: operation mode control data
+ * @flash_br: flash brightness register and bit data
+ * @timeout: timeout control data
+ * @strobe: strobe

[PATCH] media: i2c: add new driver for single string flash.

2015-01-19 Thread Daniel Jeong
This patch adds the driver for the single string flash products of TI.
Several single string flash controllers of TI have similar register map
and bit data. This driver supports four products,lm3556, lm3561, lm3642
and lm3648.

Signed-off-by: Daniel Jeong 
---
 drivers/media/i2c/Kconfig   |9 +
 drivers/media/i2c/Makefile  |1 +
 drivers/media/i2c/ti-ss-flash.c |  744 +++
 include/media/ti-ss-flash.h |   33 ++
 4 files changed, 787 insertions(+)
 create mode 100644 drivers/media/i2c/ti-ss-flash.c
 create mode 100644 include/media/ti-ss-flash.h

diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index 205d713..886c1fb 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -638,6 +638,15 @@ config VIDEO_LM3646
  This is a driver for the lm3646 dual flash controllers. It controls
  flash, torch LEDs.
 
+config VIDEO_TI_SS_FLASH
+   tristate "TI Single String Flash driver support"
+   depends on I2C && VIDEO_V4L2 && MEDIA_CONTROLLER
+   depends on MEDIA_CAMERA_SUPPORT
+   select REGMAP_I2C
+   ---help---
+ This is a driver for the signle string flash controllers of TI.
+ It supports LM3556, LM3561, LM3642 and LM3648.
+
 comment "Video improvement chips"
 
 config VIDEO_UPD64031A
diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
index 98589001..0e523ec 100644
--- a/drivers/media/i2c/Makefile
+++ b/drivers/media/i2c/Makefile
@@ -73,6 +73,7 @@ obj-$(CONFIG_VIDEO_ADP1653)   += adp1653.o
 obj-$(CONFIG_VIDEO_AS3645A)+= as3645a.o
 obj-$(CONFIG_VIDEO_LM3560) += lm3560.o
 obj-$(CONFIG_VIDEO_LM3646) += lm3646.o
+obj-$(CONFIG_VIDEO_TI_SS_FLASH)+= ti-ss-flash.o
 obj-$(CONFIG_VIDEO_SMIAPP_PLL) += smiapp-pll.o
 obj-$(CONFIG_VIDEO_AK881X) += ak881x.o
 obj-$(CONFIG_VIDEO_IR_I2C)  += ir-kbd-i2c.o
diff --git a/drivers/media/i2c/ti-ss-flash.c b/drivers/media/i2c/ti-ss-flash.c
new file mode 100644
index 000..035aeba
--- /dev/null
+++ b/drivers/media/i2c/ti-ss-flash.c
@@ -0,0 +1,744 @@
+/*
+ * drivers/media/i2c/ti-ss-flash.c
+ * General device driver for Single String FLASH LED Drivers of TI
+ * It covers lm3556, lm3561, lm3642 and lm3648.
+ *
+ * Copyright (C) 2015 Texas Instruments
+ *
+ * Contact: Daniel Jeong 
+ * Ldd-Mlp 
+ *
+ * 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 
+
+/* operation mode */
+enum led_opmode {
+   OPMODE_SHDN = 0x0,
+   OPMODE_INDI_IR,
+   OPMODE_TORCH,
+   OPMODE_FLASH,
+};
+
+/*
+ * register data
+ * @reg : register
+ * @mask : mask bits
+ * @shift : bit shift of data
+ */
+struct ctrl_reg {
+   unsigned int reg;
+   unsigned int mask;
+   unsigned int shift;
+};
+
+/*
+ * unit data
+ * @min : min value of brightness or timeout
+ *brightness : uA
+ *   timeout: ms
+ * @step : step value of brightness or timeout
+ *brightness : uA
+ *   timeout: ms
+ * @knee: knee point of step of brightness/timeout
+ *brightness : uA
+ *   timeout: ms
+ * @knee_step : step value of brightness or timeout after knee point
+ *brightness : uA
+ *   timeout: ms
+ * @max : max value of brightness or timeout
+ *brightness : uA
+ *   timeout: ms
+ * @ctrl : register info to control brightness or timeout
+ */
+struct ssflash_config {
+   unsigned int min;
+   unsigned int step;
+   unsigned int knee;
+   unsigned int knee_step;
+   unsigned int max;
+   struct ctrl_reg ctrl;
+};
+
+/*
+ * @reg : fault register
+ * @mask : fault mask bit
+ * @v4l2_fault : bit mapping to V4L2_FLASH_FAULT_
+ *   refer to include//uapi/linux/v4l2-controls.h
+ */
+struct ssflash_fault {
+   unsigned int reg;
+   unsigned int mask;
+   unsigned int v4l2_fault;
+};
+
+#define NUM_V4L2_FAULT 9
+
+/*
+ * ssflash data
+ * @name: device name
+ * @mode: operation mode control data
+ * @flash_br: flash brightness register and bit data
+ * @timeout: timeout control data
+ * @strobe: strobe control data
+ * @torch_br: torch brightness register and bit data
+ * @fault: fault data
+ * @func: initialize function
+ */
+struct ssflash_data {
+   char *name;
+   struct ctrl_reg mode;
+   struct ssflash_config flash_br;
+   struct ssflash_config timeout;
+   struct ctrl_reg strobe;
+
+   struct ssflash_config torch_br;
+   struct ssflash_fault fault[NUM_V4L2_FAULT];
+
+   int (*func)(struct regmap *regmap);
+};
+
+/*
+ * struct ssflash_flash
+ * @dev: device
+ * @regmap: reg map for interface
+ * @ctrls_led: V4L2 contols
+ * @subd

[PATCH] media: i2c: add new driver for single string flash.

2015-01-19 Thread Daniel Jeong
This patch adds the driver for the single string flash products of TI.
Several single string flash controllers of TI have similar register map
and bit data. This driver supports four products,lm3556, lm3561, lm3642
and lm3648.

Signed-off-by: Daniel Jeong gshark.je...@gmail.com
---
 drivers/media/i2c/Kconfig   |9 +
 drivers/media/i2c/Makefile  |1 +
 drivers/media/i2c/ti-ss-flash.c |  744 +++
 include/media/ti-ss-flash.h |   33 ++
 4 files changed, 787 insertions(+)
 create mode 100644 drivers/media/i2c/ti-ss-flash.c
 create mode 100644 include/media/ti-ss-flash.h

diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index 205d713..886c1fb 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -638,6 +638,15 @@ config VIDEO_LM3646
  This is a driver for the lm3646 dual flash controllers. It controls
  flash, torch LEDs.
 
+config VIDEO_TI_SS_FLASH
+   tristate TI Single String Flash driver support
+   depends on I2C  VIDEO_V4L2  MEDIA_CONTROLLER
+   depends on MEDIA_CAMERA_SUPPORT
+   select REGMAP_I2C
+   ---help---
+ This is a driver for the signle string flash controllers of TI.
+ It supports LM3556, LM3561, LM3642 and LM3648.
+
 comment Video improvement chips
 
 config VIDEO_UPD64031A
diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
index 98589001..0e523ec 100644
--- a/drivers/media/i2c/Makefile
+++ b/drivers/media/i2c/Makefile
@@ -73,6 +73,7 @@ obj-$(CONFIG_VIDEO_ADP1653)   += adp1653.o
 obj-$(CONFIG_VIDEO_AS3645A)+= as3645a.o
 obj-$(CONFIG_VIDEO_LM3560) += lm3560.o
 obj-$(CONFIG_VIDEO_LM3646) += lm3646.o
+obj-$(CONFIG_VIDEO_TI_SS_FLASH)+= ti-ss-flash.o
 obj-$(CONFIG_VIDEO_SMIAPP_PLL) += smiapp-pll.o
 obj-$(CONFIG_VIDEO_AK881X) += ak881x.o
 obj-$(CONFIG_VIDEO_IR_I2C)  += ir-kbd-i2c.o
diff --git a/drivers/media/i2c/ti-ss-flash.c b/drivers/media/i2c/ti-ss-flash.c
new file mode 100644
index 000..035aeba
--- /dev/null
+++ b/drivers/media/i2c/ti-ss-flash.c
@@ -0,0 +1,744 @@
+/*
+ * drivers/media/i2c/ti-ss-flash.c
+ * General device driver for Single String FLASH LED Drivers of TI
+ * It covers lm3556, lm3561, lm3642 and lm3648.
+ *
+ * Copyright (C) 2015 Texas Instruments
+ *
+ * Contact: Daniel Jeong gshark.je...@gmail.com
+ * Ldd-Mlp ldd-...@list.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/delay.h
+#include linux/i2c.h
+#include linux/module.h
+#include linux/of_device.h
+#include linux/regmap.h
+#include linux/slab.h
+#include linux/videodev2.h
+#include media/ti-ss-flash.h
+#include media/v4l2-ctrls.h
+#include media/v4l2-device.h
+
+/* operation mode */
+enum led_opmode {
+   OPMODE_SHDN = 0x0,
+   OPMODE_INDI_IR,
+   OPMODE_TORCH,
+   OPMODE_FLASH,
+};
+
+/*
+ * register data
+ * @reg : register
+ * @mask : mask bits
+ * @shift : bit shift of data
+ */
+struct ctrl_reg {
+   unsigned int reg;
+   unsigned int mask;
+   unsigned int shift;
+};
+
+/*
+ * unit data
+ * @min : min value of brightness or timeout
+ *brightness : uA
+ *   timeout: ms
+ * @step : step value of brightness or timeout
+ *brightness : uA
+ *   timeout: ms
+ * @knee: knee point of step of brightness/timeout
+ *brightness : uA
+ *   timeout: ms
+ * @knee_step : step value of brightness or timeout after knee point
+ *brightness : uA
+ *   timeout: ms
+ * @max : max value of brightness or timeout
+ *brightness : uA
+ *   timeout: ms
+ * @ctrl : register info to control brightness or timeout
+ */
+struct ssflash_config {
+   unsigned int min;
+   unsigned int step;
+   unsigned int knee;
+   unsigned int knee_step;
+   unsigned int max;
+   struct ctrl_reg ctrl;
+};
+
+/*
+ * @reg : fault register
+ * @mask : fault mask bit
+ * @v4l2_fault : bit mapping to V4L2_FLASH_FAULT_
+ *   refer to include//uapi/linux/v4l2-controls.h
+ */
+struct ssflash_fault {
+   unsigned int reg;
+   unsigned int mask;
+   unsigned int v4l2_fault;
+};
+
+#define NUM_V4L2_FAULT 9
+
+/*
+ * ssflash data
+ * @name: device name
+ * @mode: operation mode control data
+ * @flash_br: flash brightness register and bit data
+ * @timeout: timeout control data
+ * @strobe: strobe control data
+ * @torch_br: torch brightness register and bit data
+ * @fault: fault data
+ * @func: initialize function
+ */
+struct ssflash_data {
+   char *name;
+   struct ctrl_reg mode;
+   struct ssflash_config flash_br;
+   struct ssflash_config timeout;
+   struct ctrl_reg strobe;
+
+   struct ssflash_config torch_br;
+   struct ssflash_fault fault[NUM_V4L2_FAULT

[PATCH] backlight: add new lm3509 backlight driver

2014-08-29 Thread Daniel Jeong
This is a general driver for LM3509 backlgiht chip of TI.
LM3509 is High Efficiency Boost for White LED's and/or OLED Displays with Dual
Current Sinks. This driver supports OLED/White LED select, brightness control
sub/main conrtorl. 
You can refer to the datasheet at http://www.ti.com/product/lm3509 for review.

Signed-off-by: Daniel Jeong 
---
 drivers/video/backlight/Kconfig |7 +
 drivers/video/backlight/Makefile|1 +
 drivers/video/backlight/lm3509_bl.c |  399 +++
 3 files changed, 407 insertions(+)
 create mode 100644 drivers/video/backlight/lm3509_bl.c

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 8d03924..9dc119e 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -366,6 +366,13 @@ config BACKLIGHT_AAT2870
  If you have a AnalogicTech AAT2870 say Y to enable the
  backlight driver.
 
+config BACKLIGHT_LM3509
+   tristate "Backlight Driver for LM3509"
+   depends on BACKLIGHT_CLASS_DEVICE && I2C
+   select REGMAP_I2C
+   help
+ This supports TI LM3509 Backlight Driver
+
 config BACKLIGHT_LM3630A
tristate "Backlight Driver for LM3630A"
depends on BACKLIGHT_CLASS_DEVICE && I2C && PWM
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index fcd50b73..c34ed98 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -36,6 +36,7 @@ obj-$(CONFIG_BACKLIGHT_GPIO)  += gpio_backlight.o
 obj-$(CONFIG_BACKLIGHT_HP680)  += hp680_bl.o
 obj-$(CONFIG_BACKLIGHT_HP700)  += jornada720_bl.o
 obj-$(CONFIG_BACKLIGHT_IPAQ_MICRO) += ipaq_micro_bl.o
+obj-$(CONFIG_BACKLIGHT_LM3509) += lm3509_bl.o
 obj-$(CONFIG_BACKLIGHT_LM3533) += lm3533_bl.o
 obj-$(CONFIG_BACKLIGHT_LM3630A)+= lm3630a_bl.o
 obj-$(CONFIG_BACKLIGHT_LM3639) += lm3639_bl.o
diff --git a/drivers/video/backlight/lm3509_bl.c 
b/drivers/video/backlight/lm3509_bl.c
new file mode 100644
index 000..4f4fb85
--- /dev/null
+++ b/drivers/video/backlight/lm3509_bl.c
@@ -0,0 +1,399 @@
+/*
+ * Simple driver for Texas Instruments LM3509 Backlight driver chip
+ * Copyright (C) 2014 Texas Instruments
+ *
+ * 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 
+
+#define LM3509_NAME "lm3509"
+
+#define REG_GP 0x10
+#define REG_BMAIN  0xa0
+#define REG_BSUB   0xb0
+#define REG_MAX0xff
+
+#define LM3509_POR_BR_MAIN 0xe0
+#define LM3509_POR_BR_SUB  0xe0
+#define LM3509_MAX_BR  0xff
+
+enum lm3509_leds {
+   BLED_BMAIN = 0,
+   BLED_BSUB
+};
+
+struct lm3509_chip {
+   struct device *dev;
+   struct backlight_device *bmain;
+   struct backlight_device *bsub;
+   struct regmap *regmap;
+};
+
+/*
+ * enable main
+ * 0 : disables the main current sink and forces MAIN high impedence.
+ * 1 : enables the main current sink.
+ */
+static ssize_t lm3509_bmain_enable_store(struct device *dev,
+ struct device_attribute *devAttr,
+ const char *buf, size_t size)
+{
+   struct lm3509_chip *pchip = dev_get_drvdata(dev);
+   unsigned int state;
+   ssize_t ret;
+
+   ret = kstrtouint(buf, 10, );
+   if (ret) {
+   dev_err(pchip->dev, "input conversion fail\n");
+   return ret;
+   }
+
+   if (!state)
+   ret = regmap_update_bits(pchip->regmap, REG_GP, 0x1, 0x0);
+   else
+   ret = regmap_update_bits(pchip->regmap, REG_GP, 0x1, 0x1);
+   if (ret < 0) {
+   dev_err(pchip->dev, "i2c access fail to register\n");
+   return ret;
+   }
+
+   return size;
+}
+
+static DEVICE_ATTR(main_enable, S_IWUSR, NULL, lm3509_bmain_enable_store);
+
+/*
+ * OLED mode control
+ * 0 : white led mode - main and sub current sinks are active
+ * 1 : OLED mode - sub current sink is idabled
+ */
+static ssize_t lm3509_oled_mode_store(struct device *dev,
+ struct device_attribute *devAttr,
+ const char *buf, size_t size)
+{
+   struct lm3509_chip *pchip = dev_get_drvdata(dev);
+   unsigned int state;
+   ssize_t ret;
+
+   ret = kstrtouint(buf, 10, );
+   if (ret) {
+   dev_err(pchip->dev, "input conversion fail\n");
+   return ret;
+   }
+
+   if (!state)
+   ret = regmap_update_bits(pchip->regmap, REG_GP, 0x20, 0x00);
+   else
+   ret = regmap_update_bits(pchip->regmap, RE

[PATCH] backlight: add new lm3509 backlight driver

2014-08-29 Thread Daniel Jeong
This is a general driver for LM3509 backlgiht chip of TI.
LM3509 is High Efficiency Boost for White LED's and/or OLED Displays with Dual
Current Sinks. This driver supports OLED/White LED select, brightness control
sub/main conrtorl. 
You can refer to the datasheet at http://www.ti.com/product/lm3509 for review.

Signed-off-by: Daniel Jeong gshark.je...@gmail.com
---
 drivers/video/backlight/Kconfig |7 +
 drivers/video/backlight/Makefile|1 +
 drivers/video/backlight/lm3509_bl.c |  399 +++
 3 files changed, 407 insertions(+)
 create mode 100644 drivers/video/backlight/lm3509_bl.c

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 8d03924..9dc119e 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -366,6 +366,13 @@ config BACKLIGHT_AAT2870
  If you have a AnalogicTech AAT2870 say Y to enable the
  backlight driver.
 
+config BACKLIGHT_LM3509
+   tristate Backlight Driver for LM3509
+   depends on BACKLIGHT_CLASS_DEVICE  I2C
+   select REGMAP_I2C
+   help
+ This supports TI LM3509 Backlight Driver
+
 config BACKLIGHT_LM3630A
tristate Backlight Driver for LM3630A
depends on BACKLIGHT_CLASS_DEVICE  I2C  PWM
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index fcd50b73..c34ed98 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -36,6 +36,7 @@ obj-$(CONFIG_BACKLIGHT_GPIO)  += gpio_backlight.o
 obj-$(CONFIG_BACKLIGHT_HP680)  += hp680_bl.o
 obj-$(CONFIG_BACKLIGHT_HP700)  += jornada720_bl.o
 obj-$(CONFIG_BACKLIGHT_IPAQ_MICRO) += ipaq_micro_bl.o
+obj-$(CONFIG_BACKLIGHT_LM3509) += lm3509_bl.o
 obj-$(CONFIG_BACKLIGHT_LM3533) += lm3533_bl.o
 obj-$(CONFIG_BACKLIGHT_LM3630A)+= lm3630a_bl.o
 obj-$(CONFIG_BACKLIGHT_LM3639) += lm3639_bl.o
diff --git a/drivers/video/backlight/lm3509_bl.c 
b/drivers/video/backlight/lm3509_bl.c
new file mode 100644
index 000..4f4fb85
--- /dev/null
+++ b/drivers/video/backlight/lm3509_bl.c
@@ -0,0 +1,399 @@
+/*
+ * Simple driver for Texas Instruments LM3509 Backlight driver chip
+ * Copyright (C) 2014 Texas Instruments
+ *
+ * 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/backlight.h
+#include linux/delay.h
+#include linux/err.h
+#include linux/i2c.h
+#include linux/module.h
+#include linux/regmap.h
+#include linux/slab.h
+#include linux/uaccess.h
+
+#define LM3509_NAME lm3509
+
+#define REG_GP 0x10
+#define REG_BMAIN  0xa0
+#define REG_BSUB   0xb0
+#define REG_MAX0xff
+
+#define LM3509_POR_BR_MAIN 0xe0
+#define LM3509_POR_BR_SUB  0xe0
+#define LM3509_MAX_BR  0xff
+
+enum lm3509_leds {
+   BLED_BMAIN = 0,
+   BLED_BSUB
+};
+
+struct lm3509_chip {
+   struct device *dev;
+   struct backlight_device *bmain;
+   struct backlight_device *bsub;
+   struct regmap *regmap;
+};
+
+/*
+ * enable main
+ * 0 : disables the main current sink and forces MAIN high impedence.
+ * 1 : enables the main current sink.
+ */
+static ssize_t lm3509_bmain_enable_store(struct device *dev,
+ struct device_attribute *devAttr,
+ const char *buf, size_t size)
+{
+   struct lm3509_chip *pchip = dev_get_drvdata(dev);
+   unsigned int state;
+   ssize_t ret;
+
+   ret = kstrtouint(buf, 10, state);
+   if (ret) {
+   dev_err(pchip-dev, input conversion fail\n);
+   return ret;
+   }
+
+   if (!state)
+   ret = regmap_update_bits(pchip-regmap, REG_GP, 0x1, 0x0);
+   else
+   ret = regmap_update_bits(pchip-regmap, REG_GP, 0x1, 0x1);
+   if (ret  0) {
+   dev_err(pchip-dev, i2c access fail to register\n);
+   return ret;
+   }
+
+   return size;
+}
+
+static DEVICE_ATTR(main_enable, S_IWUSR, NULL, lm3509_bmain_enable_store);
+
+/*
+ * OLED mode control
+ * 0 : white led mode - main and sub current sinks are active
+ * 1 : OLED mode - sub current sink is idabled
+ */
+static ssize_t lm3509_oled_mode_store(struct device *dev,
+ struct device_attribute *devAttr,
+ const char *buf, size_t size)
+{
+   struct lm3509_chip *pchip = dev_get_drvdata(dev);
+   unsigned int state;
+   ssize_t ret;
+
+   ret = kstrtouint(buf, 10, state);
+   if (ret) {
+   dev_err(pchip-dev, input conversion fail\n);
+   return ret;
+   }
+
+   if (!state)
+   ret = regmap_update_bits(pchip-regmap, REG_GP, 0x20, 0x00);
+   else
+   ret = regmap_update_bits(pchip-regmap, REG_GP, 0x20, 0x20

[RFC v6 0/2] backlight: add new tps611xx backlight driver

2014-07-23 Thread Daniel Jeong
This driver a general version for tps611xx backlgiht chips of TI.
It supports tps61158, tps61161, tps61163 and tps61165 backlight driver
based on EasyScale protocol.

Daniel Jeong (2):
  [RFC v6 1/2] backlight: add new tps611xx backlight driver
  [RFC v6 2/2] backlight: device tree: add new tps611xx backlight binding

 .../video/backlight/tps611xx-backlight.txt |   26 ++
 drivers/video/backlight/Kconfig|7 +
 drivers/video/backlight/Makefile   |1 +
 drivers/video/backlight/tps611xx_bl.c  |  479 
 include/linux/platform_data/tps611xx_bl.h  |   31 ++
 5 files changed, 544 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
 create mode 100644 drivers/video/backlight/tps611xx_bl.c
 create mode 100644 include/linux/platform_data/tps611xx_bl.h

-- 
1.7.9.5

--
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/


[RFC v6 2/2] backlight: device tree: add new tps611xx backlight binding

2014-07-23 Thread Daniel Jeong
This commit is about tps611xx device tree documentation.

Signed-off-by: Daniel Jeong 
---
[v6]
Nothing changed from v5. Driver files were changed
---
 .../video/backlight/tps611xx-backlight.txt |   26 
 1 file changed, 26 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt

diff --git 
a/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt 
b/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
new file mode 100644
index 000..905c61b
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
@@ -0,0 +1,26 @@
+TPS611xx family of backlight driver based on EasyScale.
+
+EasyScale is a simple but flexible one pin interface to configure the current.
+
+Required properties:
+- compatible: should contain at least one of
+  "ti,tps61158"
+  "ti,tps61161"
+  "ti,tps61163"
+  "ti,tps61165"
+- es-gpio : GPIO for easy-scale communication.(see GPIO binding[0])
+
+Optional properties:
+- rfa-enable: enable request for acknowledge.
+  If RFA is enabled, the data byte includes the RFA bit and device will wait
+  and check acknowledge from device.
+
+[0]: Documentation/devicetree/bindings/gpio/gpio.txt
+
+Example:
+
+   backlight {
+   compatible = "ti,tps61163";
+   es-gpio = < 45 0>;
+   rfa-enable;
+   };
-- 
1.7.9.5

--
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/


[RFC v6 1/2] backlight: add new tps611xx backlight driver

2014-07-23 Thread Daniel Jeong
This driver is a general version for tps611xx backlgiht chips of TI.
It supports tps61158, tps61161, tps61163 and tps61165 backlight driver
based on EasyScale protocol(1-Wire Control Interface).

EasyScale
EasyScale is a simple but flexible one pin interface to configure the current.
The interface is based on a master-slave structure, where the master is
typically a microcontroller or application processor and the IC is the slave.
The advantage of EasyScale compared with other one pin interfaces is that
its bit detection is in a large extent independent from the bit transmission
rate. It can automatically detect bit rates between 1.7kBit/sec and up
to 160kBit/sec.

EasyScale on TPS61163
A command consists of 24 bits, including an 8-bit device address byte and
a 16-bit data byte. All of the 24 bits should be transmitted together each
time, and the LSB bit should be transmitted first. The device address byte
A7(MSB)~A0(LSB) is fixed to 0x8F.
The data byte includes 9 bits D8(MSB)~D0(LSB) for brightness information
and an RFA bit. The RFA bit set to "1" indicates the Request for Acknowledge
condition. The Acknowledge condition is only applied when the protocol is
received correctly.
Bit sream : D0-D8 | 0 | RFA | 0 | A0-A7
Please refer to the links below  for more details.
http://www.ti.com/lit/ds/symlink/tps61163.pdf

EasyScale on TPS61158/61/65
A command consists of 16 bits, including an 8-bit device address byte
and a 8-bit data byte. All of the 16 bits should be transmitted together
each time, and the MSB bit should be transmitted first. The device address
byte A7(MSB)~A0(LSB) is fixed (tps61158 0x58 tps61161 and tps61165 0x72).
The data byte includes an RFA bit.
The RFA bit set to "1" indicates the Request for Acknowledge condition.
The Acknowledge condition is only applied when the protocol is received
correctly.
Bit sream : A7-A0 | RFA | 00 | D4-D0
Please refer to the links below  for more details.
http://www.ti.com/lit/ds/symlink/tps61158.pdf
http://www.ti.com.cn/cn/lit/ds/symlink/tps61161-q1.pdf
http://www.ti.com/lit/ds/symlink/tps61165.pdf

Signed-off-by: Daniel Jeong 
---
[v6]
applied Varka's comments.
change the position of of_device_id []
delete owner
[v5]
dt document was changed
---
 drivers/video/backlight/Kconfig   |7 +
 drivers/video/backlight/Makefile  |1 +
 drivers/video/backlight/tps611xx_bl.c |  479 +
 include/linux/platform_data/tps611xx_bl.h |   31 ++
 4 files changed, 518 insertions(+)
 create mode 100644 drivers/video/backlight/tps611xx_bl.c
 create mode 100644 include/linux/platform_data/tps611xx_bl.h

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 5a3eb2e..c779a85 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -418,6 +418,13 @@ config BACKLIGHT_TPS65217
  If you have a Texas Instruments TPS65217 say Y to enable the
  backlight driver.
 
+config BACKLIGHT_TPS611xx
+   tristate "TPS611xx Backlight"
+   depends on BACKLIGHT_CLASS_DEVICE && GPIOLIB
+   help
+ This supports TI TPS61158,TPS61161, TPS61163 and TPS61165
+ backlight driver based on EasyScale Protocol.
+
 config BACKLIGHT_AS3711
tristate "AS3711 Backlight"
depends on BACKLIGHT_CLASS_DEVICE && MFD_AS3711
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index bb82002..5c39945 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -51,5 +51,6 @@ obj-$(CONFIG_BACKLIGHT_PCF50633)  += pcf50633-backlight.o
 obj-$(CONFIG_BACKLIGHT_PWM)+= pwm_bl.o
 obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o
 obj-$(CONFIG_BACKLIGHT_TOSA)   += tosa_bl.o
+obj-$(CONFIG_BACKLIGHT_TPS611xx)   += tps611xx_bl.o
 obj-$(CONFIG_BACKLIGHT_TPS65217)   += tps65217_bl.o
 obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o
diff --git a/drivers/video/backlight/tps611xx_bl.c 
b/drivers/video/backlight/tps611xx_bl.c
new file mode 100644
index 000..1e06637
--- /dev/null
+++ b/drivers/video/backlight/tps611xx_bl.c
@@ -0,0 +1,479 @@
+/*
+ * Simple driver for Texas Instruments TPS611XX Backlight driver chip
+ *using EasyScale Interface. It supports TPS61158, TPS61161,
+ *TPS61163 and TPS61165.
+ *
+ * Copyright (C) 2014 Texas Instruments
+ * Author: Daniel Jeong  
+ *Ldd Mlp 
+ *
+ * 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 
+#include 
+
+#define CMD_FORWARD 0
+#define CMD_BACKWARD 1
+
+enum tps611xx_id {
+   TPS61158_ID = 0,
+   TPS61161_ID,
+   TPS61163_ID,
+   TPS61165_ID,
+}

[RFC v6 1/2] backlight: add new tps611xx backlight driver

2014-07-23 Thread Daniel Jeong
This driver is a general version for tps611xx backlgiht chips of TI.
It supports tps61158, tps61161, tps61163 and tps61165 backlight driver
based on EasyScale protocol(1-Wire Control Interface).

EasyScale
EasyScale is a simple but flexible one pin interface to configure the current.
The interface is based on a master-slave structure, where the master is
typically a microcontroller or application processor and the IC is the slave.
The advantage of EasyScale compared with other one pin interfaces is that
its bit detection is in a large extent independent from the bit transmission
rate. It can automatically detect bit rates between 1.7kBit/sec and up
to 160kBit/sec.

EasyScale on TPS61163
A command consists of 24 bits, including an 8-bit device address byte and
a 16-bit data byte. All of the 24 bits should be transmitted together each
time, and the LSB bit should be transmitted first. The device address byte
A7(MSB)~A0(LSB) is fixed to 0x8F.
The data byte includes 9 bits D8(MSB)~D0(LSB) for brightness information
and an RFA bit. The RFA bit set to 1 indicates the Request for Acknowledge
condition. The Acknowledge condition is only applied when the protocol is
received correctly.
Bit sream : D0-D8 | 0 | RFA | 0 | A0-A7
Please refer to the links below  for more details.
http://www.ti.com/lit/ds/symlink/tps61163.pdf

EasyScale on TPS61158/61/65
A command consists of 16 bits, including an 8-bit device address byte
and a 8-bit data byte. All of the 16 bits should be transmitted together
each time, and the MSB bit should be transmitted first. The device address
byte A7(MSB)~A0(LSB) is fixed (tps61158 0x58 tps61161 and tps61165 0x72).
The data byte includes an RFA bit.
The RFA bit set to 1 indicates the Request for Acknowledge condition.
The Acknowledge condition is only applied when the protocol is received
correctly.
Bit sream : A7-A0 | RFA | 00 | D4-D0
Please refer to the links below  for more details.
http://www.ti.com/lit/ds/symlink/tps61158.pdf
http://www.ti.com.cn/cn/lit/ds/symlink/tps61161-q1.pdf
http://www.ti.com/lit/ds/symlink/tps61165.pdf

Signed-off-by: Daniel Jeong gshark.je...@gmail.com
---
[v6]
applied Varka's comments.
change the position of of_device_id []
delete owner
[v5]
dt document was changed
---
 drivers/video/backlight/Kconfig   |7 +
 drivers/video/backlight/Makefile  |1 +
 drivers/video/backlight/tps611xx_bl.c |  479 +
 include/linux/platform_data/tps611xx_bl.h |   31 ++
 4 files changed, 518 insertions(+)
 create mode 100644 drivers/video/backlight/tps611xx_bl.c
 create mode 100644 include/linux/platform_data/tps611xx_bl.h

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 5a3eb2e..c779a85 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -418,6 +418,13 @@ config BACKLIGHT_TPS65217
  If you have a Texas Instruments TPS65217 say Y to enable the
  backlight driver.
 
+config BACKLIGHT_TPS611xx
+   tristate TPS611xx Backlight
+   depends on BACKLIGHT_CLASS_DEVICE  GPIOLIB
+   help
+ This supports TI TPS61158,TPS61161, TPS61163 and TPS61165
+ backlight driver based on EasyScale Protocol.
+
 config BACKLIGHT_AS3711
tristate AS3711 Backlight
depends on BACKLIGHT_CLASS_DEVICE  MFD_AS3711
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index bb82002..5c39945 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -51,5 +51,6 @@ obj-$(CONFIG_BACKLIGHT_PCF50633)  += pcf50633-backlight.o
 obj-$(CONFIG_BACKLIGHT_PWM)+= pwm_bl.o
 obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o
 obj-$(CONFIG_BACKLIGHT_TOSA)   += tosa_bl.o
+obj-$(CONFIG_BACKLIGHT_TPS611xx)   += tps611xx_bl.o
 obj-$(CONFIG_BACKLIGHT_TPS65217)   += tps65217_bl.o
 obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o
diff --git a/drivers/video/backlight/tps611xx_bl.c 
b/drivers/video/backlight/tps611xx_bl.c
new file mode 100644
index 000..1e06637
--- /dev/null
+++ b/drivers/video/backlight/tps611xx_bl.c
@@ -0,0 +1,479 @@
+/*
+ * Simple driver for Texas Instruments TPS611XX Backlight driver chip
+ *using EasyScale Interface. It supports TPS61158, TPS61161,
+ *TPS61163 and TPS61165.
+ *
+ * Copyright (C) 2014 Texas Instruments
+ * Author: Daniel Jeong  gshark.je...@gmail.com
+ *Ldd Mlp ldd-...@list.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/backlight.h
+#include linux/delay.h
+#include linux/err.h
+#include linux/fb.h
+#include linux/gpio.h
+#include linux/init.h
+#include linux/kernel.h
+#include linux/module.h
+#include linux/of.h
+#include linux/of_gpio.h
+#include linux/of_device.h
+#include linux/platform_data/tps611xx_bl.h
+#include

[RFC v6 2/2] backlight: device tree: add new tps611xx backlight binding

2014-07-23 Thread Daniel Jeong
This commit is about tps611xx device tree documentation.

Signed-off-by: Daniel Jeong gshark.je...@gmail.com
---
[v6]
Nothing changed from v5. Driver files were changed
---
 .../video/backlight/tps611xx-backlight.txt |   26 
 1 file changed, 26 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt

diff --git 
a/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt 
b/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
new file mode 100644
index 000..905c61b
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
@@ -0,0 +1,26 @@
+TPS611xx family of backlight driver based on EasyScale.
+
+EasyScale is a simple but flexible one pin interface to configure the current.
+
+Required properties:
+- compatible: should contain at least one of
+  ti,tps61158
+  ti,tps61161
+  ti,tps61163
+  ti,tps61165
+- es-gpio : GPIO for easy-scale communication.(see GPIO binding[0])
+
+Optional properties:
+- rfa-enable: enable request for acknowledge.
+  If RFA is enabled, the data byte includes the RFA bit and device will wait
+  and check acknowledge from device.
+
+[0]: Documentation/devicetree/bindings/gpio/gpio.txt
+
+Example:
+
+   backlight {
+   compatible = ti,tps61163;
+   es-gpio = gpio 45 0;
+   rfa-enable;
+   };
-- 
1.7.9.5

--
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/


[RFC v6 0/2] backlight: add new tps611xx backlight driver

2014-07-23 Thread Daniel Jeong
This driver a general version for tps611xx backlgiht chips of TI.
It supports tps61158, tps61161, tps61163 and tps61165 backlight driver
based on EasyScale protocol.

Daniel Jeong (2):
  [RFC v6 1/2] backlight: add new tps611xx backlight driver
  [RFC v6 2/2] backlight: device tree: add new tps611xx backlight binding

 .../video/backlight/tps611xx-backlight.txt |   26 ++
 drivers/video/backlight/Kconfig|7 +
 drivers/video/backlight/Makefile   |1 +
 drivers/video/backlight/tps611xx_bl.c  |  479 
 include/linux/platform_data/tps611xx_bl.h  |   31 ++
 5 files changed, 544 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
 create mode 100644 drivers/video/backlight/tps611xx_bl.c
 create mode 100644 include/linux/platform_data/tps611xx_bl.h

-- 
1.7.9.5

--
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/


[RFC v5 2/2] backlight: device tree: add new tps611xx backlight binding

2014-07-15 Thread Daniel Jeong
This commit is about tps611xx device tree documentation.

Signed-off-by: Daniel Jeong 
---
 .../video/backlight/tps611xx-backlight.txt |   26 
 1 file changed, 26 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt

diff --git 
a/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt 
b/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
new file mode 100644
index 000..905c61b
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
@@ -0,0 +1,26 @@
+TPS611xx family of backlight driver based on EasyScale.
+
+EasyScale is a simple but flexible one pin interface to configure the current.
+
+Required properties:
+- compatible: should contain at least one of
+  "ti,tps61158"
+  "ti,tps61161"
+  "ti,tps61163"
+  "ti,tps61165"
+- es-gpio : GPIO for easy-scale communication.(see GPIO binding[0])
+
+Optional properties:
+- rfa-enable: enable request for acknowledge.
+  If RFA is enabled, the data byte includes the RFA bit and device will wait
+  and check acknowledge from device.
+
+[0]: Documentation/devicetree/bindings/gpio/gpio.txt
+
+Example:
+
+   backlight {
+   compatible = "ti,tps61163";
+   es-gpio = < 45 0>;
+   rfa-enable;
+   };
-- 
1.7.9.5

--
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/


[RFC v5 1/2] backlight: add new tps611xx backlight driver

2014-07-15 Thread Daniel Jeong
This driver is a general version for tps611xx backlgiht chips of TI.
It supports tps61158, tps61161, tps61163 and tps61165 backlight driver
based on EasyScale protocol(1-Wire Control Interface).

EasyScale
EasyScale is a simple but flexible one pin interface to configure the current.
The interface is based on a master-slave structure, where the master is
typically a microcontroller or application processor and the IC is the slave.
The advantage of EasyScale compared with other one pin interfaces is that
its bit detection is in a large extent independent from the bit transmission
rate. It can automatically detect bit rates between 1.7kBit/sec and up
to 160kBit/sec.

EasyScale on TPS61163
A command consists of 24 bits, including an 8-bit device address byte and
a 16-bit data byte. All of the 24 bits should be transmitted together each
time, and the LSB bit should be transmitted first. The device address byte
A7(MSB)~A0(LSB) is fixed to 0x8F.
The data byte includes 9 bits D8(MSB)~D0(LSB) for brightness information
and an RFA bit. The RFA bit set to "1" indicates the Request for Acknowledge
condition. The Acknowledge condition is only applied when the protocol is
received correctly.
Bit sream : D0-D8 | 0 | RFA | 0 | A0-A7
Please refer to the links below  for more details.
http://www.ti.com/lit/ds/symlink/tps61163.pdf

EasyScale on TPS61158/61/65
A command consists of 16 bits, including an 8-bit device address byte
and a 8-bit data byte. All of the 16 bits should be transmitted together
each time, and the MSB bit should be transmitted first. The device address
byte A7(MSB)~A0(LSB) is fixed (tps61158 0x58 tps61161 and tps61165 0x72).
The data byte includes an RFA bit.
The RFA bit set to "1" indicates the Request for Acknowledge condition.
The Acknowledge condition is only applied when the protocol is received
correctly.
Bit sream : A7-A0 | RFA | 00 | D4-D0
Please refer to the links below  for more details.
http://www.ti.com/lit/ds/symlink/tps61158.pdf
http://www.ti.com.cn/cn/lit/ds/symlink/tps61161-q1.pdf
http://www.ti.com/lit/ds/symlink/tps61165.pdf

Signed-off-by: Daniel Jeong 
---
dt document was changed.
---
 drivers/video/backlight/Kconfig   |7 +
 drivers/video/backlight/Makefile  |1 +
 drivers/video/backlight/tps611xx_bl.c |  479 +
 include/linux/platform_data/tps611xx_bl.h |   31 ++
 4 files changed, 518 insertions(+)
 create mode 100644 drivers/video/backlight/tps611xx_bl.c
 create mode 100644 include/linux/platform_data/tps611xx_bl.h

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 5a3eb2e..c779a85 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -418,6 +418,13 @@ config BACKLIGHT_TPS65217
  If you have a Texas Instruments TPS65217 say Y to enable the
  backlight driver.
 
+config BACKLIGHT_TPS611xx
+   tristate "TPS611xx Backlight"
+   depends on BACKLIGHT_CLASS_DEVICE && GPIOLIB
+   help
+ This supports TI TPS61158,TPS61161, TPS61163 and TPS61165
+ backlight driver based on EasyScale Protocol.
+
 config BACKLIGHT_AS3711
tristate "AS3711 Backlight"
depends on BACKLIGHT_CLASS_DEVICE && MFD_AS3711
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index bb82002..5c39945 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -51,5 +51,6 @@ obj-$(CONFIG_BACKLIGHT_PCF50633)  += pcf50633-backlight.o
 obj-$(CONFIG_BACKLIGHT_PWM)+= pwm_bl.o
 obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o
 obj-$(CONFIG_BACKLIGHT_TOSA)   += tosa_bl.o
+obj-$(CONFIG_BACKLIGHT_TPS611xx)   += tps611xx_bl.o
 obj-$(CONFIG_BACKLIGHT_TPS65217)   += tps65217_bl.o
 obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o
diff --git a/drivers/video/backlight/tps611xx_bl.c 
b/drivers/video/backlight/tps611xx_bl.c
new file mode 100644
index 000..6c485ff
--- /dev/null
+++ b/drivers/video/backlight/tps611xx_bl.c
@@ -0,0 +1,479 @@
+/*
+ * Simple driver for Texas Instruments TPS611XX Backlight driver chip
+ *using EasyScale Interface. It supports TPS61158, TPS61161,
+ *TPS61163 and TPS61165.
+ *
+ * Copyright (C) 2014 Texas Instruments
+ * Author: Daniel Jeong  
+ *Ldd Mlp 
+ *
+ * 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 
+
+#define CMD_FORWARD 0
+#define CMD_BACKWARD 1
+
+enum tps611xx_id {
+   TPS61158_ID = 0,
+   TPS61161_ID,
+   TPS61163_ID,
+   TPS61165_ID,
+};
+
+/*
+ * easyscale time spec
+ * @es_delay : es delay time(ns)
+ * @es_det   : es detecti

[RFC v5 0/2] backlight: add new tps611xx backlight driver

2014-07-15 Thread Daniel Jeong
This driver a general version for tps611xx backlgiht chips of TI.
It supports tps61158, tps61161, tps61163 and tps61165 backlight driver
based on EasyScale protocol.

Daniel Jeong (2):
  [RFC v5 1/2] backlight: add new tps611xx backlight driver
  [RFC v5 2/2] backlight: device tree: add new tps611xx backlight binding

 .../video/backlight/tps611xx-backlight.txt |   26 ++
 drivers/video/backlight/Kconfig|7 +
 drivers/video/backlight/Makefile   |1 +
 drivers/video/backlight/tps611xx_bl.c  |  479 
 include/linux/platform_data/tps611xx_bl.h  |   31 ++
 5 files changed, 544 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
 create mode 100644 drivers/video/backlight/tps611xx_bl.c
 create mode 100644 include/linux/platform_data/tps611xx_bl.h

-- 
1.7.9.5

--
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/


[RFC v5 1/2] backlight: add new tps611xx backlight driver

2014-07-15 Thread Daniel Jeong
This driver is a general version for tps611xx backlgiht chips of TI.
It supports tps61158, tps61161, tps61163 and tps61165 backlight driver
based on EasyScale protocol(1-Wire Control Interface).

EasyScale
EasyScale is a simple but flexible one pin interface to configure the current.
The interface is based on a master-slave structure, where the master is
typically a microcontroller or application processor and the IC is the slave.
The advantage of EasyScale compared with other one pin interfaces is that
its bit detection is in a large extent independent from the bit transmission
rate. It can automatically detect bit rates between 1.7kBit/sec and up
to 160kBit/sec.

EasyScale on TPS61163
A command consists of 24 bits, including an 8-bit device address byte and
a 16-bit data byte. All of the 24 bits should be transmitted together each
time, and the LSB bit should be transmitted first. The device address byte
A7(MSB)~A0(LSB) is fixed to 0x8F.
The data byte includes 9 bits D8(MSB)~D0(LSB) for brightness information
and an RFA bit. The RFA bit set to 1 indicates the Request for Acknowledge
condition. The Acknowledge condition is only applied when the protocol is
received correctly.
Bit sream : D0-D8 | 0 | RFA | 0 | A0-A7
Please refer to the links below  for more details.
http://www.ti.com/lit/ds/symlink/tps61163.pdf

EasyScale on TPS61158/61/65
A command consists of 16 bits, including an 8-bit device address byte
and a 8-bit data byte. All of the 16 bits should be transmitted together
each time, and the MSB bit should be transmitted first. The device address
byte A7(MSB)~A0(LSB) is fixed (tps61158 0x58 tps61161 and tps61165 0x72).
The data byte includes an RFA bit.
The RFA bit set to 1 indicates the Request for Acknowledge condition.
The Acknowledge condition is only applied when the protocol is received
correctly.
Bit sream : A7-A0 | RFA | 00 | D4-D0
Please refer to the links below  for more details.
http://www.ti.com/lit/ds/symlink/tps61158.pdf
http://www.ti.com.cn/cn/lit/ds/symlink/tps61161-q1.pdf
http://www.ti.com/lit/ds/symlink/tps61165.pdf

Signed-off-by: Daniel Jeong gshark.je...@gmail.com
---
dt document was changed.
---
 drivers/video/backlight/Kconfig   |7 +
 drivers/video/backlight/Makefile  |1 +
 drivers/video/backlight/tps611xx_bl.c |  479 +
 include/linux/platform_data/tps611xx_bl.h |   31 ++
 4 files changed, 518 insertions(+)
 create mode 100644 drivers/video/backlight/tps611xx_bl.c
 create mode 100644 include/linux/platform_data/tps611xx_bl.h

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 5a3eb2e..c779a85 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -418,6 +418,13 @@ config BACKLIGHT_TPS65217
  If you have a Texas Instruments TPS65217 say Y to enable the
  backlight driver.
 
+config BACKLIGHT_TPS611xx
+   tristate TPS611xx Backlight
+   depends on BACKLIGHT_CLASS_DEVICE  GPIOLIB
+   help
+ This supports TI TPS61158,TPS61161, TPS61163 and TPS61165
+ backlight driver based on EasyScale Protocol.
+
 config BACKLIGHT_AS3711
tristate AS3711 Backlight
depends on BACKLIGHT_CLASS_DEVICE  MFD_AS3711
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index bb82002..5c39945 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -51,5 +51,6 @@ obj-$(CONFIG_BACKLIGHT_PCF50633)  += pcf50633-backlight.o
 obj-$(CONFIG_BACKLIGHT_PWM)+= pwm_bl.o
 obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o
 obj-$(CONFIG_BACKLIGHT_TOSA)   += tosa_bl.o
+obj-$(CONFIG_BACKLIGHT_TPS611xx)   += tps611xx_bl.o
 obj-$(CONFIG_BACKLIGHT_TPS65217)   += tps65217_bl.o
 obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o
diff --git a/drivers/video/backlight/tps611xx_bl.c 
b/drivers/video/backlight/tps611xx_bl.c
new file mode 100644
index 000..6c485ff
--- /dev/null
+++ b/drivers/video/backlight/tps611xx_bl.c
@@ -0,0 +1,479 @@
+/*
+ * Simple driver for Texas Instruments TPS611XX Backlight driver chip
+ *using EasyScale Interface. It supports TPS61158, TPS61161,
+ *TPS61163 and TPS61165.
+ *
+ * Copyright (C) 2014 Texas Instruments
+ * Author: Daniel Jeong  gshark.je...@gmail.com
+ *Ldd Mlp ldd-...@list.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/backlight.h
+#include linux/delay.h
+#include linux/err.h
+#include linux/fb.h
+#include linux/gpio.h
+#include linux/init.h
+#include linux/kernel.h
+#include linux/module.h
+#include linux/of.h
+#include linux/of_device.h
+#include linux/platform_data/tps611xx_bl.h
+#include linux/platform_device.h
+#include linux/slab.h
+
+#define CMD_FORWARD 0
+#define CMD_BACKWARD 1
+
+enum

[RFC v5 0/2] backlight: add new tps611xx backlight driver

2014-07-15 Thread Daniel Jeong
This driver a general version for tps611xx backlgiht chips of TI.
It supports tps61158, tps61161, tps61163 and tps61165 backlight driver
based on EasyScale protocol.

Daniel Jeong (2):
  [RFC v5 1/2] backlight: add new tps611xx backlight driver
  [RFC v5 2/2] backlight: device tree: add new tps611xx backlight binding

 .../video/backlight/tps611xx-backlight.txt |   26 ++
 drivers/video/backlight/Kconfig|7 +
 drivers/video/backlight/Makefile   |1 +
 drivers/video/backlight/tps611xx_bl.c  |  479 
 include/linux/platform_data/tps611xx_bl.h  |   31 ++
 5 files changed, 544 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
 create mode 100644 drivers/video/backlight/tps611xx_bl.c
 create mode 100644 include/linux/platform_data/tps611xx_bl.h

-- 
1.7.9.5

--
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/


[RFC v5 2/2] backlight: device tree: add new tps611xx backlight binding

2014-07-15 Thread Daniel Jeong
This commit is about tps611xx device tree documentation.

Signed-off-by: Daniel Jeong gshark.je...@gmail.com
---
 .../video/backlight/tps611xx-backlight.txt |   26 
 1 file changed, 26 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt

diff --git 
a/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt 
b/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
new file mode 100644
index 000..905c61b
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
@@ -0,0 +1,26 @@
+TPS611xx family of backlight driver based on EasyScale.
+
+EasyScale is a simple but flexible one pin interface to configure the current.
+
+Required properties:
+- compatible: should contain at least one of
+  ti,tps61158
+  ti,tps61161
+  ti,tps61163
+  ti,tps61165
+- es-gpio : GPIO for easy-scale communication.(see GPIO binding[0])
+
+Optional properties:
+- rfa-enable: enable request for acknowledge.
+  If RFA is enabled, the data byte includes the RFA bit and device will wait
+  and check acknowledge from device.
+
+[0]: Documentation/devicetree/bindings/gpio/gpio.txt
+
+Example:
+
+   backlight {
+   compatible = ti,tps61163;
+   es-gpio = gpio 45 0;
+   rfa-enable;
+   };
-- 
1.7.9.5

--
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/


[RFC v4 1/2] backlight: add new tps611xx backlight driver

2014-07-03 Thread Daniel Jeong
This driver is a general version for tps611xx backlgiht chips of TI.
It supports tps61158, tps61161, tps61163 and tps61165 backlight driver
based on EasyScale protocol(1-Wire Control Interface).

EasyScale
EasyScale is a simple but flexible one pin interface to configure the current.
The interface is based on a master-slave structure, where the master is
typically a microcontroller or application processor and the IC is the slave.
The advantage of EasyScale compared with other one pin interfaces is that
its bit detection is in a large extent independent from the bit transmission
rate. It can automatically detect bit rates between 1.7kBit/sec and up
to 160kBit/sec.

EasyScale on TPS61163
A command consists of 24 bits, including an 8-bit device address byte and
a 16-bit data byte. All of the 24 bits should be transmitted together each
time, and the LSB bit should be transmitted first. The device address byte
A7(MSB)~A0(LSB) is fixed to 0x8F.
The data byte includes 9 bits D8(MSB)~D0(LSB) for brightness information
and an RFA bit. The RFA bit set to "1" indicates the Request for Acknowledge
condition. The Acknowledge condition is only applied when the protocol is
received correctly.
Bit sream : D0-D8 | 0 | RFA | 0 | A0-A7
Please refer to the links below  for more details.
http://www.ti.com/lit/ds/symlink/tps61163.pdf

EasyScale on TPS61158/61/65
A command consists of 16 bits, including an 8-bit device address byte
and a 8-bit data byte. All of the 16 bits should be transmitted together
each time, and the MSB bit should be transmitted first. The device address
byte A7(MSB)~A0(LSB) is fixed (tps61158 0x58 tps61161 and tps61165 0x72).
The data byte includes an RFA bit.
The RFA bit set to "1" indicates the Request for Acknowledge condition.
The Acknowledge condition is only applied when the protocol is received
correctly.
Bit sream : A7-A0 | RFA | 00 | D4-D0
Please refer to the links below  for more details.
http://www.ti.com/lit/ds/symlink/tps61158.pdf
http://www.ti.com.cn/cn/lit/ds/symlink/tps61161-q1.pdf
http://www.ti.com/lit/ds/symlink/tps61165.pdf

Signed-off-by: Daniel Jeong 
---
 drivers/video/backlight/Kconfig   |7 +
 drivers/video/backlight/Makefile  |1 +
 drivers/video/backlight/tps611xx_bl.c |  479 +
 include/linux/platform_data/tps611xx_bl.h |   31 ++
 4 files changed, 518 insertions(+)
 create mode 100644 drivers/video/backlight/tps611xx_bl.c
 create mode 100644 include/linux/platform_data/tps611xx_bl.h

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 5a3eb2e..c779a85 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -418,6 +418,13 @@ config BACKLIGHT_TPS65217
  If you have a Texas Instruments TPS65217 say Y to enable the
  backlight driver.
 
+config BACKLIGHT_TPS611xx
+   tristate "TPS611xx Backlight"
+   depends on BACKLIGHT_CLASS_DEVICE && GPIOLIB
+   help
+ This supports TI TPS61158,TPS61161, TPS61163 and TPS61165
+ backlight driver based on EasyScale Protocol.
+
 config BACKLIGHT_AS3711
tristate "AS3711 Backlight"
depends on BACKLIGHT_CLASS_DEVICE && MFD_AS3711
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index bb82002..5c39945 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -51,5 +51,6 @@ obj-$(CONFIG_BACKLIGHT_PCF50633)  += pcf50633-backlight.o
 obj-$(CONFIG_BACKLIGHT_PWM)+= pwm_bl.o
 obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o
 obj-$(CONFIG_BACKLIGHT_TOSA)   += tosa_bl.o
+obj-$(CONFIG_BACKLIGHT_TPS611xx)   += tps611xx_bl.o
 obj-$(CONFIG_BACKLIGHT_TPS65217)   += tps65217_bl.o
 obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o
diff --git a/drivers/video/backlight/tps611xx_bl.c 
b/drivers/video/backlight/tps611xx_bl.c
new file mode 100644
index 000..6c485ff
--- /dev/null
+++ b/drivers/video/backlight/tps611xx_bl.c
@@ -0,0 +1,479 @@
+/*
+ * Simple driver for Texas Instruments TPS611XX Backlight driver chip
+ *using EasyScale Interface. It supports TPS61158, TPS61161,
+ *TPS61163 and TPS61165.
+ *
+ * Copyright (C) 2014 Texas Instruments
+ * Author: Daniel Jeong  
+ *Ldd Mlp 
+ *
+ * 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 
+
+#define CMD_FORWARD 0
+#define CMD_BACKWARD 1
+
+enum tps611xx_id {
+   TPS61158_ID = 0,
+   TPS61161_ID,
+   TPS61163_ID,
+   TPS61165_ID,
+};
+
+/*
+ * easyscale time spec
+ * @es_delay : es delay time(ns)
+ * @es_det   : es detection time(ns)
+ * @start: start 

[RFC v4 2/2] backlight: device tree: add new tps611xx backlight binding

2014-07-03 Thread Daniel Jeong
This commit is about tps611xx device tree documentation.

Signed-off-by: Daniel Jeong 
---
 .../video/backlight/tps611xx-backlight.txt |   24 
 1 file changed, 24 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt

diff --git 
a/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt 
b/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
new file mode 100644
index 000..7af8182
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
@@ -0,0 +1,24 @@
+TPS611xx family of backlight driver based on EasyScale.
+
+EasyScale is a simple but flexible one pin interface to configure the current.
+
+Required properties:
+- compatible: should contain at least one of
+  "ti,tps61158_bl"
+  "ti,tps61161_bl"
+  "ti,tps61163_bl"
+  "ti,tps61165_bl"
+- rfa-enable: enable request for acknowledge.
+  If RFA is enabled, the data byte includes the RFA bit and device will wait
+  and check acknowledge from device.
+- es-gpio : GPIO for easy-scale communication.(see GPIO binding[0])
+
+[0]: Documentation/devicetree/bindings/gpio/gpio.txt
+
+Example:
+
+   backlight {
+   compatible = "ti,tps61163";
+   rfa-enable;
+   es-gpio = < 45 0>;
+   };
-- 
1.7.9.5

--
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/


[RFC v4 0/2] backlight: add new tps611xx backlight driver

2014-07-03 Thread Daniel Jeong
This driver is a general version for tps611xx backlgiht chips of TI.
It supports tps61158, tps61161, tps61163 and tps61165 backlight driver
based on EasyScale protocol.

Daniel Jeong (2):
  backlight
  backlight: add new tps611xx backlight device tree support

 .../video/backlight/tps611xx-backlight.txt |   24 +
 drivers/video/backlight/Kconfig|7 +
 drivers/video/backlight/Makefile   |1 +
 drivers/video/backlight/tps611xx_bl.c  |  479 
 include/linux/platform_data/tps611xx_bl.h  |   31 ++
 5 files changed, 542 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
 create mode 100644 drivers/video/backlight/tps611xx_bl.c
 create mode 100644 include/linux/platform_data/tps611xx_bl.h

-- 
1.7.9.5

--
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/


[RFC v4 0/2] backlight: add new tps611xx backlight driver

2014-07-03 Thread Daniel Jeong
This driver is a general version for tps611xx backlgiht chips of TI.
It supports tps61158, tps61161, tps61163 and tps61165 backlight driver
based on EasyScale protocol.

Daniel Jeong (2):
  backlight
  backlight: add new tps611xx backlight device tree support

 .../video/backlight/tps611xx-backlight.txt |   24 +
 drivers/video/backlight/Kconfig|7 +
 drivers/video/backlight/Makefile   |1 +
 drivers/video/backlight/tps611xx_bl.c  |  479 
 include/linux/platform_data/tps611xx_bl.h  |   31 ++
 5 files changed, 542 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
 create mode 100644 drivers/video/backlight/tps611xx_bl.c
 create mode 100644 include/linux/platform_data/tps611xx_bl.h

-- 
1.7.9.5

--
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/


[RFC v4 2/2] backlight: device tree: add new tps611xx backlight binding

2014-07-03 Thread Daniel Jeong
This commit is about tps611xx device tree documentation.

Signed-off-by: Daniel Jeong gshark.je...@gmail.com
---
 .../video/backlight/tps611xx-backlight.txt |   24 
 1 file changed, 24 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt

diff --git 
a/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt 
b/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
new file mode 100644
index 000..7af8182
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
@@ -0,0 +1,24 @@
+TPS611xx family of backlight driver based on EasyScale.
+
+EasyScale is a simple but flexible one pin interface to configure the current.
+
+Required properties:
+- compatible: should contain at least one of
+  ti,tps61158_bl
+  ti,tps61161_bl
+  ti,tps61163_bl
+  ti,tps61165_bl
+- rfa-enable: enable request for acknowledge.
+  If RFA is enabled, the data byte includes the RFA bit and device will wait
+  and check acknowledge from device.
+- es-gpio : GPIO for easy-scale communication.(see GPIO binding[0])
+
+[0]: Documentation/devicetree/bindings/gpio/gpio.txt
+
+Example:
+
+   backlight {
+   compatible = ti,tps61163;
+   rfa-enable;
+   es-gpio = gpio 45 0;
+   };
-- 
1.7.9.5

--
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/


[RFC v4 1/2] backlight: add new tps611xx backlight driver

2014-07-03 Thread Daniel Jeong
This driver is a general version for tps611xx backlgiht chips of TI.
It supports tps61158, tps61161, tps61163 and tps61165 backlight driver
based on EasyScale protocol(1-Wire Control Interface).

EasyScale
EasyScale is a simple but flexible one pin interface to configure the current.
The interface is based on a master-slave structure, where the master is
typically a microcontroller or application processor and the IC is the slave.
The advantage of EasyScale compared with other one pin interfaces is that
its bit detection is in a large extent independent from the bit transmission
rate. It can automatically detect bit rates between 1.7kBit/sec and up
to 160kBit/sec.

EasyScale on TPS61163
A command consists of 24 bits, including an 8-bit device address byte and
a 16-bit data byte. All of the 24 bits should be transmitted together each
time, and the LSB bit should be transmitted first. The device address byte
A7(MSB)~A0(LSB) is fixed to 0x8F.
The data byte includes 9 bits D8(MSB)~D0(LSB) for brightness information
and an RFA bit. The RFA bit set to 1 indicates the Request for Acknowledge
condition. The Acknowledge condition is only applied when the protocol is
received correctly.
Bit sream : D0-D8 | 0 | RFA | 0 | A0-A7
Please refer to the links below  for more details.
http://www.ti.com/lit/ds/symlink/tps61163.pdf

EasyScale on TPS61158/61/65
A command consists of 16 bits, including an 8-bit device address byte
and a 8-bit data byte. All of the 16 bits should be transmitted together
each time, and the MSB bit should be transmitted first. The device address
byte A7(MSB)~A0(LSB) is fixed (tps61158 0x58 tps61161 and tps61165 0x72).
The data byte includes an RFA bit.
The RFA bit set to 1 indicates the Request for Acknowledge condition.
The Acknowledge condition is only applied when the protocol is received
correctly.
Bit sream : A7-A0 | RFA | 00 | D4-D0
Please refer to the links below  for more details.
http://www.ti.com/lit/ds/symlink/tps61158.pdf
http://www.ti.com.cn/cn/lit/ds/symlink/tps61161-q1.pdf
http://www.ti.com/lit/ds/symlink/tps61165.pdf

Signed-off-by: Daniel Jeong gshark.je...@gmail.com
---
 drivers/video/backlight/Kconfig   |7 +
 drivers/video/backlight/Makefile  |1 +
 drivers/video/backlight/tps611xx_bl.c |  479 +
 include/linux/platform_data/tps611xx_bl.h |   31 ++
 4 files changed, 518 insertions(+)
 create mode 100644 drivers/video/backlight/tps611xx_bl.c
 create mode 100644 include/linux/platform_data/tps611xx_bl.h

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 5a3eb2e..c779a85 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -418,6 +418,13 @@ config BACKLIGHT_TPS65217
  If you have a Texas Instruments TPS65217 say Y to enable the
  backlight driver.
 
+config BACKLIGHT_TPS611xx
+   tristate TPS611xx Backlight
+   depends on BACKLIGHT_CLASS_DEVICE  GPIOLIB
+   help
+ This supports TI TPS61158,TPS61161, TPS61163 and TPS61165
+ backlight driver based on EasyScale Protocol.
+
 config BACKLIGHT_AS3711
tristate AS3711 Backlight
depends on BACKLIGHT_CLASS_DEVICE  MFD_AS3711
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index bb82002..5c39945 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -51,5 +51,6 @@ obj-$(CONFIG_BACKLIGHT_PCF50633)  += pcf50633-backlight.o
 obj-$(CONFIG_BACKLIGHT_PWM)+= pwm_bl.o
 obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o
 obj-$(CONFIG_BACKLIGHT_TOSA)   += tosa_bl.o
+obj-$(CONFIG_BACKLIGHT_TPS611xx)   += tps611xx_bl.o
 obj-$(CONFIG_BACKLIGHT_TPS65217)   += tps65217_bl.o
 obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o
diff --git a/drivers/video/backlight/tps611xx_bl.c 
b/drivers/video/backlight/tps611xx_bl.c
new file mode 100644
index 000..6c485ff
--- /dev/null
+++ b/drivers/video/backlight/tps611xx_bl.c
@@ -0,0 +1,479 @@
+/*
+ * Simple driver for Texas Instruments TPS611XX Backlight driver chip
+ *using EasyScale Interface. It supports TPS61158, TPS61161,
+ *TPS61163 and TPS61165.
+ *
+ * Copyright (C) 2014 Texas Instruments
+ * Author: Daniel Jeong  gshark.je...@gmail.com
+ *Ldd Mlp ldd-...@list.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/backlight.h
+#include linux/delay.h
+#include linux/err.h
+#include linux/fb.h
+#include linux/gpio.h
+#include linux/init.h
+#include linux/kernel.h
+#include linux/module.h
+#include linux/of.h
+#include linux/of_device.h
+#include linux/platform_data/tps611xx_bl.h
+#include linux/platform_device.h
+#include linux/slab.h
+
+#define CMD_FORWARD 0
+#define CMD_BACKWARD 1
+
+enum tps611xx_id {
+   TPS61158_ID = 0

[RFC v3 1/2] backlight: add new tps611xx backlight driver

2014-06-24 Thread Daniel Jeong
This driver a general version for tps611xx backlgiht chips of TI.
It supports tps61158, tps61161, tps61163 and tps61165 backlight driver
based on EasyScale protocol(1-Wire Control Interface).

EasyScale
EasyScale is a simple but flexible one pin interface to configure the current.
The interface is based on a master-slave structure, where the master is 
typically a microcontroller or application processor and the IC is the slave.
The advantage of EasyScale compared with other one pin interfaces is that 
its bit detection is in a large extent independent from the bit transmission 
rate. 
It can automatically detect bit rates between 1.7kBit/sec and up to 160kBit/sec.

EasyScale on TPS61163
A command consists of 24 bits, including an 8-bit device address byte and a 
16-bit data byte.
All of the 24 bits should be transmitted together each time, and the LSB bit 
should be 
transmitted first. The device address byte A7(MSB)~A0(LSB) is fixed to 0x8F. 
The data byte includes 9 bits D8(MSB)~D0(LSB) for brightness information and an 
RFA bit.
The RFA bit set to "1" indicates the Request for Acknowledge condition. The 
Acknowledge
condition is only applied when the protocol is received correctly.
Bit sream : D0-D8 | 0 | RFA | 0 | A0-A7
Please refer http://www.ti.com/lit/ds/symlink/tps61163.pdf for more details.

EasyScale on TPS61158/61/65
A command consists of 16 bits, including an 8-bit device address byte and a 
8-bit data byte.
All of the 16 bits should be transmitted together each time, and the MSB bit 
should be 
transmitted first. The device address byte A7(MSB)~A0(LSB) is fixed (tps61158 
0x58
tps61161 and tps61165 0x72). The data byte includes an RFA bit.
The RFA bit set to "1" indicates the Request for Acknowledge condition. The 
Acknowledge
condition is only applied when the protocol is received correctly.
Bit sream : A7-A0 | RFA | 00 | D4-D0
Please refer the links below  for more details.
tps61158 : http://www.ti.com/lit/ds/symlink/tps61158.pdf
tps61161 : http://www.ti.com.cn/cn/lit/ds/symlink/tps61161-q1.pdf
tps61165 : http://www.ti.com/lit/ds/symlink/tps61165.pdf

Signed-off-by: Daniel Jeong 
---
 drivers/video/backlight/Kconfig   |7 +
 drivers/video/backlight/Makefile  |1 +
 drivers/video/backlight/tps611xx_bl.c |  494 +
 include/linux/platform_data/tps611xx_bl.h |   31 ++
 4 files changed, 533 insertions(+)
 create mode 100644 drivers/video/backlight/tps611xx_bl.c
 create mode 100644 include/linux/platform_data/tps611xx_bl.h

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 5a3eb2e..c779a85 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -418,6 +418,13 @@ config BACKLIGHT_TPS65217
  If you have a Texas Instruments TPS65217 say Y to enable the
  backlight driver.
 
+config BACKLIGHT_TPS611xx
+   tristate "TPS611xx Backlight"
+   depends on BACKLIGHT_CLASS_DEVICE && GPIOLIB
+   help
+ This supports TI TPS61158,TPS61161, TPS61163 and TPS61165
+ backlight driver based on EasyScale Protocol.
+
 config BACKLIGHT_AS3711
tristate "AS3711 Backlight"
depends on BACKLIGHT_CLASS_DEVICE && MFD_AS3711
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index bb82002..44f1641 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -52,4 +52,5 @@ obj-$(CONFIG_BACKLIGHT_PWM)   += pwm_bl.o
 obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o
 obj-$(CONFIG_BACKLIGHT_TOSA)   += tosa_bl.o
 obj-$(CONFIG_BACKLIGHT_TPS65217)   += tps65217_bl.o
+obj-$(CONFIG_BACKLIGHT_TPS611xx)   += tps611xx_bl.o
 obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o
diff --git a/drivers/video/backlight/tps611xx_bl.c 
b/drivers/video/backlight/tps611xx_bl.c
new file mode 100644
index 000..8dcc88a
--- /dev/null
+++ b/drivers/video/backlight/tps611xx_bl.c
@@ -0,0 +1,494 @@
+/*
+ * Simple driver for Texas Instruments TPS611XX Backlight driver chip
+ *using EasyScale Interface. It supports TPS61158, TPS61161,
+ *TPS61163 and TPS61165.
+ *
+ * Copyright (C) 2014 Texas Instruments
+ * Author: Daniel Jeong  
+ *Ldd Mlp 
+ *
+ * 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 
+
+#define CMD_FORWARD 0
+#define CMD_BACKWARD 1
+
+enum tps611xx_id {
+   TPS61158_ID = 0,
+   TPS61161_ID,
+   TPS61163_ID,
+   TPS61165_ID,
+};
+
+/*
+ * easyscale time spec
+ * @es_delay : es delay time(ns)
+ * @es_det   : es detection time(ns)
+ * @start: start time of data stream(ns)
+ * @eos  : end 

[RFC v3 2/2] backlight: device tree: add new tps611xx backlight driver

2014-06-24 Thread Daniel Jeong
This commit is about tps611xx device tree documentation.

Signed-off-by: Daniel Jeong 
---
 .../video/backlight/tps611xx-backlight.txt |   16 
 1 file changed, 16 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt

diff --git 
a/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt 
b/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
new file mode 100644
index 000..01f110d
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
@@ -0,0 +1,16 @@
+TPS611xx family of backlight driver based on EasyScale.
+
+It supports tps61158, tps61161, tps61163 and tps61165.
+
+Required properties:
+- compatible: "ti,tps61158_bl", "ti,tps61161_bl", "ti,tps61163_bl", 
"ti,tps61165_bl"
+- rfa_en: enable request for acknowledge. ( 0 : disable , 1 : enable )
+- en_gpio_num: gpio number for en pin.
+
+Example:
+
+   backlight {
+   compatible = "ti,tps61163_bl";
+   rfa_en = <1>;
+   en_gpio_num = <45>;
+   };
-- 
1.7.9.5

--
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/


[RFC v3 0/2] backlight: add new tps611xx backlight driver

2014-06-24 Thread Daniel Jeong
This driver a general version for tps611xx backlgiht chips of TI.
It supports tps61158, tps61161, tps61163 and tps61165 backlight driver
based on EasyScale protocol.

Daniel Jeong (2):
  backlight
  backlight: add new tps611xx backlight device tree support  This
commit is tps611xx device tree documentation.

 .../video/backlight/tps611xx-backlight.txt |   16 +
 drivers/video/backlight/Kconfig|7 +
 drivers/video/backlight/Makefile   |1 +
 drivers/video/backlight/tps611xx_bl.c  |  494 
 include/linux/platform_data/tps611xx_bl.h  |   31 ++
 5 files changed, 549 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
 create mode 100644 drivers/video/backlight/tps611xx_bl.c
 create mode 100644 include/linux/platform_data/tps611xx_bl.h

-- 
1.7.9.5

--
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/


[RFC v2 2/2] backlight: device tree: add new tps611xx backlight driver

2014-06-24 Thread Daniel Jeong
This commit is about tps611xx device tree documentation.

Signed-off-by: Daniel Jeong 
---
 .../video/backlight/tps611xx-backlight.txt |   16 
 1 file changed, 16 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt

diff --git 
a/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt 
b/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
new file mode 100644
index 000..01f110d
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
@@ -0,0 +1,16 @@
+TPS611xx family of backlight driver based on EasyScale.
+
+It supports tps61158, tps61161, tps61163 and tps61165.
+
+Required properties:
+- compatible: "ti,tps61158_bl", "ti,tps61161_bl", "ti,tps61163_bl", 
"ti,tps61165_bl"
+- rfa_en: enable request for acknowledge. ( 0 : disable , 1 : enable )
+- en_gpio_num: gpio number for en pin.
+
+Example:
+
+   backlight {
+   compatible = "ti,tps61163_bl";
+   rfa_en = <1>;
+   en_gpio_num = <45>;
+   };
-- 
1.7.9.5

--
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/


[RFC v2 1/2] backlight: add new tps611xx backlight driver

2014-06-24 Thread Daniel Jeong
This driver a general version for tps611xx backlgiht chips of TI.
It supports tps61158, tps61161, tps61163 and tps61165 backlight driver
based on EasyScale protocol(1-Wire Control Interface).

EasyScale
EasyScale is a simple but flexible one pin interface to configure the current.
The interface is based on a master-slave structure, where the master is 
typically a microcontroller or application processor and the IC is the slave.
The advantage of EasyScale compared with other one pin interfaces is that 
its bit detection is in a large extent independent from the bit transmission 
rate. 
It can automatically detect bit rates between 1.7kBit/sec and up to 160kBit/sec.

EasyScale on TPS61163
A command consists of 24 bits, including an 8-bit device address byte and a 
16-bit data byte.
All of the 24 bits should be transmitted together each time, and the LSB bit 
should be 
transmitted first. The device address byte A7(MSB)~A0(LSB) is fixed to 0x8F. 
The data byte includes 9 bits D8(MSB)~D0(LSB) for brightness information and an 
RFA bit.
The RFA bit set to "1" indicates the Request for Acknowledge condition. The 
Acknowledge
condition is only applied when the protocol is received correctly.
Bit sream : D0-D8 | 0 | RFA | 0 | A0-A7
Please refer http://www.ti.com/lit/ds/symlink/tps61163.pdf for more details.

EasyScale on TPS61158/61/65
A command consists of 16 bits, including an 8-bit device address byte and a 
8-bit data byte.
All of the 16 bits should be transmitted together each time, and the MSB bit 
should be 
transmitted first. The device address byte A7(MSB)~A0(LSB) is fixed (tps61158 
0x58
tps61161 and tps61165 0x72). The data byte includes an RFA bit.
The RFA bit set to "1" indicates the Request for Acknowledge condition. The 
Acknowledge
condition is only applied when the protocol is received correctly.
Bit sream : A7-A0 | RFA | 00 | D4-D0
Please refer the links below  for more details.
tps61158 : http://www.ti.com/lit/ds/symlink/tps61158.pdf
tps61161 : http://www.ti.com.cn/cn/lit/ds/symlink/tps61161-q1.pdf
tps61165 : http://www.ti.com/lit/ds/symlink/tps61165.pdf

Signed-off-by: Daniel Jeong 
---
 drivers/video/backlight/Kconfig   |7 +
 drivers/video/backlight/Makefile  |1 +
 drivers/video/backlight/tps611xx_bl.c |  494 +
 include/linux/platform_data/tps611xx_bl.h |   31 ++
 4 files changed, 533 insertions(+)
 create mode 100644 drivers/video/backlight/tps611xx_bl.c
 create mode 100644 include/linux/platform_data/tps611xx_bl.h

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 5a3eb2e..c779a85 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -418,6 +418,13 @@ config BACKLIGHT_TPS65217
  If you have a Texas Instruments TPS65217 say Y to enable the
  backlight driver.
 
+config BACKLIGHT_TPS611xx
+   tristate "TPS611xx Backlight"
+   depends on BACKLIGHT_CLASS_DEVICE && GPIOLIB
+   help
+ This supports TI TPS61158,TPS61161, TPS61163 and TPS61165
+ backlight driver based on EasyScale Protocol.
+
 config BACKLIGHT_AS3711
tristate "AS3711 Backlight"
depends on BACKLIGHT_CLASS_DEVICE && MFD_AS3711
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index bb82002..44f1641 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -52,4 +52,5 @@ obj-$(CONFIG_BACKLIGHT_PWM)   += pwm_bl.o
 obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o
 obj-$(CONFIG_BACKLIGHT_TOSA)   += tosa_bl.o
 obj-$(CONFIG_BACKLIGHT_TPS65217)   += tps65217_bl.o
+obj-$(CONFIG_BACKLIGHT_TPS611xx)   += tps611xx_bl.o
 obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o
diff --git a/drivers/video/backlight/tps611xx_bl.c 
b/drivers/video/backlight/tps611xx_bl.c
new file mode 100644
index 000..f7e08a3
--- /dev/null
+++ b/drivers/video/backlight/tps611xx_bl.c
@@ -0,0 +1,494 @@
+/*
+ * Simple driver for Texas Instruments TPS611XX Backlight driver chip
+ *using EasyScale Interface. It supports TPS61158, TPS61161,
+ *TPS61163 and TPS61165.
+ *
+ * Copyright (C) 2014 Texas Instruments
+ * Author: Daniel Jeong  
+ *Ldd Mlp 
+ *
+ * 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 
+
+#define CMD_FORWARD 0
+#define CMD_BACKWARD 1
+
+enum tps611xx_id {
+   TPS61158_ID = 0,
+   TPS61161_ID,
+   TPS61163_ID,
+   TPS61165_ID,
+};
+
+/*
+ * easyscale time spec
+ * @es_delay : es delay time(ns)
+ * @es_det   : es detection time(ns)
+ * @start: start time of data stream(ns)
+ * @eos  : end 

[RFC v2 0/2] backlight: add new tps611xx backlight driver

2014-06-24 Thread Daniel Jeong
This driver a general version for tps611xx backlgiht chips of TI.
It supports tps61158, tps61161, tps61163 and tps61165 backlight driver
based on EasyScale protocol.

Daniel Jeong (2):
  backlight
  backlight: add new tps611xx backlight device tree support  This
commit is tps611xx device tree documentation.

 .../video/backlight/tps611xx-backlight.txt |   16 +
 drivers/video/backlight/Kconfig|7 +
 drivers/video/backlight/Makefile   |1 +
 drivers/video/backlight/tps611xx_bl.c  |  494 
 include/linux/platform_data/tps611xx_bl.h  |   31 ++
 5 files changed, 549 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
 create mode 100644 drivers/video/backlight/tps611xx_bl.c
 create mode 100644 include/linux/platform_data/tps611xx_bl.h

-- 
1.7.9.5

--
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/


[RFC v2 0/2] backlight: add new tps611xx backlight driver

2014-06-24 Thread Daniel Jeong
This driver a general version for tps611xx backlgiht chips of TI.
It supports tps61158, tps61161, tps61163 and tps61165 backlight driver
based on EasyScale protocol.

Daniel Jeong (2):
  backlight
  backlight: add new tps611xx backlight device tree support  This
commit is tps611xx device tree documentation.

 .../video/backlight/tps611xx-backlight.txt |   16 +
 drivers/video/backlight/Kconfig|7 +
 drivers/video/backlight/Makefile   |1 +
 drivers/video/backlight/tps611xx_bl.c  |  494 
 include/linux/platform_data/tps611xx_bl.h  |   31 ++
 5 files changed, 549 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
 create mode 100644 drivers/video/backlight/tps611xx_bl.c
 create mode 100644 include/linux/platform_data/tps611xx_bl.h

-- 
1.7.9.5

--
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/


[RFC v2 2/2] backlight: device tree: add new tps611xx backlight driver

2014-06-24 Thread Daniel Jeong
This commit is about tps611xx device tree documentation.

Signed-off-by: Daniel Jeong gshark.je...@gmail.com
---
 .../video/backlight/tps611xx-backlight.txt |   16 
 1 file changed, 16 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt

diff --git 
a/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt 
b/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
new file mode 100644
index 000..01f110d
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
@@ -0,0 +1,16 @@
+TPS611xx family of backlight driver based on EasyScale.
+
+It supports tps61158, tps61161, tps61163 and tps61165.
+
+Required properties:
+- compatible: ti,tps61158_bl, ti,tps61161_bl, ti,tps61163_bl, 
ti,tps61165_bl
+- rfa_en: enable request for acknowledge. ( 0 : disable , 1 : enable )
+- en_gpio_num: gpio number for en pin.
+
+Example:
+
+   backlight {
+   compatible = ti,tps61163_bl;
+   rfa_en = 1;
+   en_gpio_num = 45;
+   };
-- 
1.7.9.5

--
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/


[RFC v2 1/2] backlight: add new tps611xx backlight driver

2014-06-24 Thread Daniel Jeong
This driver a general version for tps611xx backlgiht chips of TI.
It supports tps61158, tps61161, tps61163 and tps61165 backlight driver
based on EasyScale protocol(1-Wire Control Interface).

EasyScale
EasyScale is a simple but flexible one pin interface to configure the current.
The interface is based on a master-slave structure, where the master is 
typically a microcontroller or application processor and the IC is the slave.
The advantage of EasyScale compared with other one pin interfaces is that 
its bit detection is in a large extent independent from the bit transmission 
rate. 
It can automatically detect bit rates between 1.7kBit/sec and up to 160kBit/sec.

EasyScale on TPS61163
A command consists of 24 bits, including an 8-bit device address byte and a 
16-bit data byte.
All of the 24 bits should be transmitted together each time, and the LSB bit 
should be 
transmitted first. The device address byte A7(MSB)~A0(LSB) is fixed to 0x8F. 
The data byte includes 9 bits D8(MSB)~D0(LSB) for brightness information and an 
RFA bit.
The RFA bit set to 1 indicates the Request for Acknowledge condition. The 
Acknowledge
condition is only applied when the protocol is received correctly.
Bit sream : D0-D8 | 0 | RFA | 0 | A0-A7
Please refer http://www.ti.com/lit/ds/symlink/tps61163.pdf for more details.

EasyScale on TPS61158/61/65
A command consists of 16 bits, including an 8-bit device address byte and a 
8-bit data byte.
All of the 16 bits should be transmitted together each time, and the MSB bit 
should be 
transmitted first. The device address byte A7(MSB)~A0(LSB) is fixed (tps61158 
0x58
tps61161 and tps61165 0x72). The data byte includes an RFA bit.
The RFA bit set to 1 indicates the Request for Acknowledge condition. The 
Acknowledge
condition is only applied when the protocol is received correctly.
Bit sream : A7-A0 | RFA | 00 | D4-D0
Please refer the links below  for more details.
tps61158 : http://www.ti.com/lit/ds/symlink/tps61158.pdf
tps61161 : http://www.ti.com.cn/cn/lit/ds/symlink/tps61161-q1.pdf
tps61165 : http://www.ti.com/lit/ds/symlink/tps61165.pdf

Signed-off-by: Daniel Jeong gshark.je...@gmail.com
---
 drivers/video/backlight/Kconfig   |7 +
 drivers/video/backlight/Makefile  |1 +
 drivers/video/backlight/tps611xx_bl.c |  494 +
 include/linux/platform_data/tps611xx_bl.h |   31 ++
 4 files changed, 533 insertions(+)
 create mode 100644 drivers/video/backlight/tps611xx_bl.c
 create mode 100644 include/linux/platform_data/tps611xx_bl.h

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 5a3eb2e..c779a85 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -418,6 +418,13 @@ config BACKLIGHT_TPS65217
  If you have a Texas Instruments TPS65217 say Y to enable the
  backlight driver.
 
+config BACKLIGHT_TPS611xx
+   tristate TPS611xx Backlight
+   depends on BACKLIGHT_CLASS_DEVICE  GPIOLIB
+   help
+ This supports TI TPS61158,TPS61161, TPS61163 and TPS61165
+ backlight driver based on EasyScale Protocol.
+
 config BACKLIGHT_AS3711
tristate AS3711 Backlight
depends on BACKLIGHT_CLASS_DEVICE  MFD_AS3711
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index bb82002..44f1641 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -52,4 +52,5 @@ obj-$(CONFIG_BACKLIGHT_PWM)   += pwm_bl.o
 obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o
 obj-$(CONFIG_BACKLIGHT_TOSA)   += tosa_bl.o
 obj-$(CONFIG_BACKLIGHT_TPS65217)   += tps65217_bl.o
+obj-$(CONFIG_BACKLIGHT_TPS611xx)   += tps611xx_bl.o
 obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o
diff --git a/drivers/video/backlight/tps611xx_bl.c 
b/drivers/video/backlight/tps611xx_bl.c
new file mode 100644
index 000..f7e08a3
--- /dev/null
+++ b/drivers/video/backlight/tps611xx_bl.c
@@ -0,0 +1,494 @@
+/*
+ * Simple driver for Texas Instruments TPS611XX Backlight driver chip
+ *using EasyScale Interface. It supports TPS61158, TPS61161,
+ *TPS61163 and TPS61165.
+ *
+ * Copyright (C) 2014 Texas Instruments
+ * Author: Daniel Jeong  gshark.je...@gmail.com
+ *Ldd Mlp ldd-...@list.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/backlight.h
+#include linux/delay.h
+#include linux/err.h
+#include linux/fb.h
+#include linux/gpio.h
+#include linux/init.h
+#include linux/kernel.h
+#include linux/module.h
+#include linux/of.h
+#include linux/of_device.h
+#include linux/platform_data/tps611xx_bl.h
+#include linux/platform_device.h
+#include linux/slab.h
+
+#define CMD_FORWARD 0
+#define CMD_BACKWARD 1
+
+enum tps611xx_id {
+   TPS61158_ID = 0,
+   TPS61161_ID,
+   TPS61163_ID

[RFC v3 0/2] backlight: add new tps611xx backlight driver

2014-06-24 Thread Daniel Jeong
This driver a general version for tps611xx backlgiht chips of TI.
It supports tps61158, tps61161, tps61163 and tps61165 backlight driver
based on EasyScale protocol.

Daniel Jeong (2):
  backlight
  backlight: add new tps611xx backlight device tree support  This
commit is tps611xx device tree documentation.

 .../video/backlight/tps611xx-backlight.txt |   16 +
 drivers/video/backlight/Kconfig|7 +
 drivers/video/backlight/Makefile   |1 +
 drivers/video/backlight/tps611xx_bl.c  |  494 
 include/linux/platform_data/tps611xx_bl.h  |   31 ++
 5 files changed, 549 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
 create mode 100644 drivers/video/backlight/tps611xx_bl.c
 create mode 100644 include/linux/platform_data/tps611xx_bl.h

-- 
1.7.9.5

--
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/


[RFC v3 2/2] backlight: device tree: add new tps611xx backlight driver

2014-06-24 Thread Daniel Jeong
This commit is about tps611xx device tree documentation.

Signed-off-by: Daniel Jeong gshark.je...@gmail.com
---
 .../video/backlight/tps611xx-backlight.txt |   16 
 1 file changed, 16 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt

diff --git 
a/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt 
b/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
new file mode 100644
index 000..01f110d
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
@@ -0,0 +1,16 @@
+TPS611xx family of backlight driver based on EasyScale.
+
+It supports tps61158, tps61161, tps61163 and tps61165.
+
+Required properties:
+- compatible: ti,tps61158_bl, ti,tps61161_bl, ti,tps61163_bl, 
ti,tps61165_bl
+- rfa_en: enable request for acknowledge. ( 0 : disable , 1 : enable )
+- en_gpio_num: gpio number for en pin.
+
+Example:
+
+   backlight {
+   compatible = ti,tps61163_bl;
+   rfa_en = 1;
+   en_gpio_num = 45;
+   };
-- 
1.7.9.5

--
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/


[RFC v3 1/2] backlight: add new tps611xx backlight driver

2014-06-24 Thread Daniel Jeong
This driver a general version for tps611xx backlgiht chips of TI.
It supports tps61158, tps61161, tps61163 and tps61165 backlight driver
based on EasyScale protocol(1-Wire Control Interface).

EasyScale
EasyScale is a simple but flexible one pin interface to configure the current.
The interface is based on a master-slave structure, where the master is 
typically a microcontroller or application processor and the IC is the slave.
The advantage of EasyScale compared with other one pin interfaces is that 
its bit detection is in a large extent independent from the bit transmission 
rate. 
It can automatically detect bit rates between 1.7kBit/sec and up to 160kBit/sec.

EasyScale on TPS61163
A command consists of 24 bits, including an 8-bit device address byte and a 
16-bit data byte.
All of the 24 bits should be transmitted together each time, and the LSB bit 
should be 
transmitted first. The device address byte A7(MSB)~A0(LSB) is fixed to 0x8F. 
The data byte includes 9 bits D8(MSB)~D0(LSB) for brightness information and an 
RFA bit.
The RFA bit set to 1 indicates the Request for Acknowledge condition. The 
Acknowledge
condition is only applied when the protocol is received correctly.
Bit sream : D0-D8 | 0 | RFA | 0 | A0-A7
Please refer http://www.ti.com/lit/ds/symlink/tps61163.pdf for more details.

EasyScale on TPS61158/61/65
A command consists of 16 bits, including an 8-bit device address byte and a 
8-bit data byte.
All of the 16 bits should be transmitted together each time, and the MSB bit 
should be 
transmitted first. The device address byte A7(MSB)~A0(LSB) is fixed (tps61158 
0x58
tps61161 and tps61165 0x72). The data byte includes an RFA bit.
The RFA bit set to 1 indicates the Request for Acknowledge condition. The 
Acknowledge
condition is only applied when the protocol is received correctly.
Bit sream : A7-A0 | RFA | 00 | D4-D0
Please refer the links below  for more details.
tps61158 : http://www.ti.com/lit/ds/symlink/tps61158.pdf
tps61161 : http://www.ti.com.cn/cn/lit/ds/symlink/tps61161-q1.pdf
tps61165 : http://www.ti.com/lit/ds/symlink/tps61165.pdf

Signed-off-by: Daniel Jeong gshark.je...@gmail.com
---
 drivers/video/backlight/Kconfig   |7 +
 drivers/video/backlight/Makefile  |1 +
 drivers/video/backlight/tps611xx_bl.c |  494 +
 include/linux/platform_data/tps611xx_bl.h |   31 ++
 4 files changed, 533 insertions(+)
 create mode 100644 drivers/video/backlight/tps611xx_bl.c
 create mode 100644 include/linux/platform_data/tps611xx_bl.h

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 5a3eb2e..c779a85 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -418,6 +418,13 @@ config BACKLIGHT_TPS65217
  If you have a Texas Instruments TPS65217 say Y to enable the
  backlight driver.
 
+config BACKLIGHT_TPS611xx
+   tristate TPS611xx Backlight
+   depends on BACKLIGHT_CLASS_DEVICE  GPIOLIB
+   help
+ This supports TI TPS61158,TPS61161, TPS61163 and TPS61165
+ backlight driver based on EasyScale Protocol.
+
 config BACKLIGHT_AS3711
tristate AS3711 Backlight
depends on BACKLIGHT_CLASS_DEVICE  MFD_AS3711
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index bb82002..44f1641 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -52,4 +52,5 @@ obj-$(CONFIG_BACKLIGHT_PWM)   += pwm_bl.o
 obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o
 obj-$(CONFIG_BACKLIGHT_TOSA)   += tosa_bl.o
 obj-$(CONFIG_BACKLIGHT_TPS65217)   += tps65217_bl.o
+obj-$(CONFIG_BACKLIGHT_TPS611xx)   += tps611xx_bl.o
 obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o
diff --git a/drivers/video/backlight/tps611xx_bl.c 
b/drivers/video/backlight/tps611xx_bl.c
new file mode 100644
index 000..8dcc88a
--- /dev/null
+++ b/drivers/video/backlight/tps611xx_bl.c
@@ -0,0 +1,494 @@
+/*
+ * Simple driver for Texas Instruments TPS611XX Backlight driver chip
+ *using EasyScale Interface. It supports TPS61158, TPS61161,
+ *TPS61163 and TPS61165.
+ *
+ * Copyright (C) 2014 Texas Instruments
+ * Author: Daniel Jeong  gshark.je...@gmail.com
+ *Ldd Mlp ldd-...@list.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/backlight.h
+#include linux/delay.h
+#include linux/err.h
+#include linux/fb.h
+#include linux/gpio.h
+#include linux/init.h
+#include linux/kernel.h
+#include linux/module.h
+#include linux/of.h
+#include linux/of_device.h
+#include linux/platform_data/tps611xx_bl.h
+#include linux/platform_device.h
+#include linux/slab.h
+
+#define CMD_FORWARD 0
+#define CMD_BACKWARD 1
+
+enum tps611xx_id {
+   TPS61158_ID = 0,
+   TPS61161_ID,
+   TPS61163_ID

[RFC 0/2] backlight: add new tps611xx backlight driver

2014-06-15 Thread Daniel Jeong
This driver a general version for tps611xx backlgiht chips of TI.
It supports tps61158, tps61161, tps61163 and tps61165 backlight driver
based on EasyScale protocol.

Daniel Jeong (2):
  backlight: add new tps611xx backlight driver
  backlight: add new tps611xx backlight device tree support

 .../video/backlight/tps611xx-backlight.txt |   16 +
 drivers/video/backlight/Kconfig|7 +
 drivers/video/backlight/Makefile   |1 +
 drivers/video/backlight/tps611xx_bl.c  |  486 
 include/linux/platform_data/tps611xx_bl.h  |   30 ++
 5 files changed, 540 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
 create mode 100644 drivers/video/backlight/tps611xx_bl.c
 create mode 100644 include/linux/platform_data/tps611xx_bl.h

-- 
1.7.9.5

--
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/


[RFC 2/2] backlight: device tree: add new tps611xx backlight driver

2014-06-15 Thread Daniel Jeong
This commit is about tps611xx device tree documentation.

Signed-off-by: Daniel Jeong 
---
 .../video/backlight/tps611xx-backlight.txt |   16 
 1 file changed, 16 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt

diff --git 
a/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt 
b/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
new file mode 100644
index 000..8a0935d
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
@@ -0,0 +1,16 @@
+TPS611xx family of backlight driver based on EasyScale.
+
+It supports tps61158, tps61161, tps61163 and tps61165.
+
+Required properties:
+- compatible: "ti,tps61158_bl", "ti,tps61161_bl", "ti,tps61163_bl", 
"ti,tps61165_bl"
+- rfa_en: enable request for acknowledge.
+- en_gpio_num: gpio number for en pin.
+
+Example:
+
+   backlight {
+   compatible = "ti,tps61163_bl";
+   rfa_en = <1>;
+   en_gpio_num = <45>;
+   };
-- 
1.7.9.5

--
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/


[RFC 1/2] backlight: add new tps611xx backlight driver

2014-06-15 Thread Daniel Jeong
This driver a general version for tps611xx backlgiht chips of TI.
It supports tps61158, tps61161, tps61163 and tps61165 backlight driver
based on EasyScale protocol.

Signed-off-by: Daniel Jeong 
---
 drivers/video/backlight/Kconfig   |7 +
 drivers/video/backlight/Makefile  |1 +
 drivers/video/backlight/tps611xx_bl.c |  486 +
 include/linux/platform_data/tps611xx_bl.h |   30 ++
 4 files changed, 524 insertions(+)
 create mode 100644 drivers/video/backlight/tps611xx_bl.c
 create mode 100644 include/linux/platform_data/tps611xx_bl.h

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 5a3eb2e..c779a85 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -418,6 +418,13 @@ config BACKLIGHT_TPS65217
  If you have a Texas Instruments TPS65217 say Y to enable the
  backlight driver.
 
+config BACKLIGHT_TPS611xx
+   tristate "TPS611xx Backlight"
+   depends on BACKLIGHT_CLASS_DEVICE && GPIOLIB
+   help
+ This supports TI TPS61158, TPS61161, TPS61163 and TPS61165
+ backlight driver based on EasyScale Protocol.
+
 config BACKLIGHT_AS3711
tristate "AS3711 Backlight"
depends on BACKLIGHT_CLASS_DEVICE && MFD_AS3711
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index bb82002..44f1641 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -52,4 +52,5 @@ obj-$(CONFIG_BACKLIGHT_PWM)   += pwm_bl.o
 obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o
 obj-$(CONFIG_BACKLIGHT_TOSA)   += tosa_bl.o
 obj-$(CONFIG_BACKLIGHT_TPS65217)   += tps65217_bl.o
+obj-$(CONFIG_BACKLIGHT_TPS611xx)   += tps611xx_bl.o
 obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o
diff --git a/drivers/video/backlight/tps611xx_bl.c 
b/drivers/video/backlight/tps611xx_bl.c
new file mode 100644
index 000..4b76cdd
--- /dev/null
+++ b/drivers/video/backlight/tps611xx_bl.c
@@ -0,0 +1,486 @@
+/*
+ * Simple driver for Texas Instruments TPS611XX Backlight driver chip
+ *using EasyScale Interface. It supports TPS61158, TPS61161,
+ *TPS61163 and TPS61165.
+ *
+ * Copyright (C) 2014 Texas Instruments
+ * Author: Daniel Jeong  
+ *Ldd Mlp 
+ *
+ * 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 
+
+#define CMD_FORWARD 0
+#define CMD_BACKWARD 1
+
+enum tps611xx_id {
+   TPS61158_ID = 0,
+   TPS61161_ID,
+   TPS61163_ID,
+   TPS61165_ID,
+};
+
+/*
+ * easyscale time spec
+ * @es_delay : es delay time(ns)
+ * @es_det   : es detection time(ns)
+ * @start: start time of data stream(ns)
+ * @eos  : end time of data stream(ns)
+ * @reset: ic shutdown time(ms)
+ * @logic_1_low : low time high bit(ns)
+ * @logic_0_low : low time low bit(ns)
+ * @ackn: duation of ack condistion(ns)
+ * @ack_poll: ack polling duration(ns)
+ */
+struct tps611xx_time {
+   unsigned int es_delay;
+   unsigned int es_det;
+   unsigned int start;
+   unsigned int eos;
+   unsigned int reset;
+   unsigned int logic_1_low;
+   unsigned int logic_0_low;
+   unsigned int ackn;
+   unsigned int ack_poll;
+};
+
+/*
+ * @seq : sequence of data transfer
+ * @size: size of data
+ * @brt_max : max brightness
+ * @brt_bmask : bit mask of dimming bits
+ * @rfa_bmask : bit mask of request of ack
+ */
+struct tps611xx_command {
+   int seq;
+   int size;
+   int brt_max;
+   int brt_bmask;
+   int rfa_bmask;
+};
+
+/*
+ * @id : product id
+ * @name : product name
+ * @addr : device address
+ * @cmd  : es command info
+ * @time : es time info
+ */
+struct tps611xx_esdata {
+   enum tps611xx_id id;
+   char *name;
+   int addr;
+   struct tps611xx_command cmd;
+   struct tps611xx_time time;
+};
+
+struct tps611xx_bl_data {
+   struct device *dev;
+   struct backlight_device *bled;
+   struct tps611xx_platform_data *pdata;
+
+   /*
+* @rfa_en : acknowlege request enable
+* @en_gpio: enable pin gpio no.
+* @esdata : easyscale data
+*/
+   int rfa_en;
+   unsigned int en_gpio;
+   const struct tps611xx_esdata *esdata;
+};
+
+static struct tps611xx_esdata tps611xx_info[] = {
+   [TPS61158_ID] = {
+.id = TPS61158_ID,
+.name = "tps61158",
+.addr = 0x5800,
+.cmd = {
+.seq = CMD_FORWARD,
+.size = 16,
+.brt_max = 31,
+   

[RFC 1/2] backlight: add new tps611xx backlight driver

2014-06-15 Thread Daniel Jeong
This driver a general version for tps611xx backlgiht chips of TI.
It supports tps61158, tps61161, tps61163 and tps61165 backlight driver
based on EasyScale protocol.

Signed-off-by: Daniel Jeong gshark.je...@gmail.com
---
 drivers/video/backlight/Kconfig   |7 +
 drivers/video/backlight/Makefile  |1 +
 drivers/video/backlight/tps611xx_bl.c |  486 +
 include/linux/platform_data/tps611xx_bl.h |   30 ++
 4 files changed, 524 insertions(+)
 create mode 100644 drivers/video/backlight/tps611xx_bl.c
 create mode 100644 include/linux/platform_data/tps611xx_bl.h

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 5a3eb2e..c779a85 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -418,6 +418,13 @@ config BACKLIGHT_TPS65217
  If you have a Texas Instruments TPS65217 say Y to enable the
  backlight driver.
 
+config BACKLIGHT_TPS611xx
+   tristate TPS611xx Backlight
+   depends on BACKLIGHT_CLASS_DEVICE  GPIOLIB
+   help
+ This supports TI TPS61158, TPS61161, TPS61163 and TPS61165
+ backlight driver based on EasyScale Protocol.
+
 config BACKLIGHT_AS3711
tristate AS3711 Backlight
depends on BACKLIGHT_CLASS_DEVICE  MFD_AS3711
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index bb82002..44f1641 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -52,4 +52,5 @@ obj-$(CONFIG_BACKLIGHT_PWM)   += pwm_bl.o
 obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o
 obj-$(CONFIG_BACKLIGHT_TOSA)   += tosa_bl.o
 obj-$(CONFIG_BACKLIGHT_TPS65217)   += tps65217_bl.o
+obj-$(CONFIG_BACKLIGHT_TPS611xx)   += tps611xx_bl.o
 obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o
diff --git a/drivers/video/backlight/tps611xx_bl.c 
b/drivers/video/backlight/tps611xx_bl.c
new file mode 100644
index 000..4b76cdd
--- /dev/null
+++ b/drivers/video/backlight/tps611xx_bl.c
@@ -0,0 +1,486 @@
+/*
+ * Simple driver for Texas Instruments TPS611XX Backlight driver chip
+ *using EasyScale Interface. It supports TPS61158, TPS61161,
+ *TPS61163 and TPS61165.
+ *
+ * Copyright (C) 2014 Texas Instruments
+ * Author: Daniel Jeong  gshark.je...@gmail.com
+ *Ldd Mlp ldd-...@list.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/backlight.h
+#include linux/delay.h
+#include linux/err.h
+#include linux/fb.h
+#include linux/gpio.h
+#include linux/init.h
+#include linux/kernel.h
+#include linux/module.h
+#include linux/of.h
+#include linux/of_device.h
+#include linux/platform_data/tps611xx_bl.h
+#include linux/platform_device.h
+#include linux/slab.h
+
+#define CMD_FORWARD 0
+#define CMD_BACKWARD 1
+
+enum tps611xx_id {
+   TPS61158_ID = 0,
+   TPS61161_ID,
+   TPS61163_ID,
+   TPS61165_ID,
+};
+
+/*
+ * easyscale time spec
+ * @es_delay : es delay time(ns)
+ * @es_det   : es detection time(ns)
+ * @start: start time of data stream(ns)
+ * @eos  : end time of data stream(ns)
+ * @reset: ic shutdown time(ms)
+ * @logic_1_low : low time high bit(ns)
+ * @logic_0_low : low time low bit(ns)
+ * @ackn: duation of ack condistion(ns)
+ * @ack_poll: ack polling duration(ns)
+ */
+struct tps611xx_time {
+   unsigned int es_delay;
+   unsigned int es_det;
+   unsigned int start;
+   unsigned int eos;
+   unsigned int reset;
+   unsigned int logic_1_low;
+   unsigned int logic_0_low;
+   unsigned int ackn;
+   unsigned int ack_poll;
+};
+
+/*
+ * @seq : sequence of data transfer
+ * @size: size of data
+ * @brt_max : max brightness
+ * @brt_bmask : bit mask of dimming bits
+ * @rfa_bmask : bit mask of request of ack
+ */
+struct tps611xx_command {
+   int seq;
+   int size;
+   int brt_max;
+   int brt_bmask;
+   int rfa_bmask;
+};
+
+/*
+ * @id : product id
+ * @name : product name
+ * @addr : device address
+ * @cmd  : es command info
+ * @time : es time info
+ */
+struct tps611xx_esdata {
+   enum tps611xx_id id;
+   char *name;
+   int addr;
+   struct tps611xx_command cmd;
+   struct tps611xx_time time;
+};
+
+struct tps611xx_bl_data {
+   struct device *dev;
+   struct backlight_device *bled;
+   struct tps611xx_platform_data *pdata;
+
+   /*
+* @rfa_en : acknowlege request enable
+* @en_gpio: enable pin gpio no.
+* @esdata : easyscale data
+*/
+   int rfa_en;
+   unsigned int en_gpio;
+   const struct tps611xx_esdata *esdata;
+};
+
+static struct tps611xx_esdata tps611xx_info[] = {
+   [TPS61158_ID] = {
+.id = TPS61158_ID,
+.name = tps61158

[RFC 2/2] backlight: device tree: add new tps611xx backlight driver

2014-06-15 Thread Daniel Jeong
This commit is about tps611xx device tree documentation.

Signed-off-by: Daniel Jeong gshark.je...@gmail.com
---
 .../video/backlight/tps611xx-backlight.txt |   16 
 1 file changed, 16 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt

diff --git 
a/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt 
b/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
new file mode 100644
index 000..8a0935d
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
@@ -0,0 +1,16 @@
+TPS611xx family of backlight driver based on EasyScale.
+
+It supports tps61158, tps61161, tps61163 and tps61165.
+
+Required properties:
+- compatible: ti,tps61158_bl, ti,tps61161_bl, ti,tps61163_bl, 
ti,tps61165_bl
+- rfa_en: enable request for acknowledge.
+- en_gpio_num: gpio number for en pin.
+
+Example:
+
+   backlight {
+   compatible = ti,tps61163_bl;
+   rfa_en = 1;
+   en_gpio_num = 45;
+   };
-- 
1.7.9.5

--
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/


[RFC 0/2] backlight: add new tps611xx backlight driver

2014-06-15 Thread Daniel Jeong
This driver a general version for tps611xx backlgiht chips of TI.
It supports tps61158, tps61161, tps61163 and tps61165 backlight driver
based on EasyScale protocol.

Daniel Jeong (2):
  backlight: add new tps611xx backlight driver
  backlight: add new tps611xx backlight device tree support

 .../video/backlight/tps611xx-backlight.txt |   16 +
 drivers/video/backlight/Kconfig|7 +
 drivers/video/backlight/Makefile   |1 +
 drivers/video/backlight/tps611xx_bl.c  |  486 
 include/linux/platform_data/tps611xx_bl.h  |   30 ++
 5 files changed, 540 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
 create mode 100644 drivers/video/backlight/tps611xx_bl.c
 create mode 100644 include/linux/platform_data/tps611xx_bl.h

-- 
1.7.9.5

--
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/


[PATCH] backlight: lm3639: use devm_backlight_device_register()

2014-03-13 Thread Daniel Jeong
 change to use devm_backlight_device_register() for simple cleanup.

Signed-off-by: Daniel Jeong 
---
 drivers/video/backlight/lm3639_bl.c |   17 +++--
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/video/backlight/lm3639_bl.c 
b/drivers/video/backlight/lm3639_bl.c
index 6fd60ad..5f36808 100644
--- a/drivers/video/backlight/lm3639_bl.c
+++ b/drivers/video/backlight/lm3639_bl.c
@@ -349,8 +349,9 @@ static int lm3639_probe(struct i2c_client *client,
props.brightness = pdata->init_brt_led;
props.max_brightness = pdata->max_brt_led;
pchip->bled =
-   backlight_device_register("lm3639_bled", pchip->dev, pchip,
- _bled_ops, );
+   devm_backlight_device_register(pchip->dev, "lm3639_bled",
+  pchip->dev, pchip, _bled_ops,
+  );
if (IS_ERR(pchip->bled)) {
dev_err(>dev, "fail : backlight register\n");
ret = PTR_ERR(pchip->bled);
@@ -360,7 +361,7 @@ static int lm3639_probe(struct i2c_client *client,
ret = device_create_file(&(pchip->bled->dev), _attr_bled_mode);
if (ret < 0) {
dev_err(>dev, "failed : add sysfs entries\n");
-   goto err_bled_mode;
+   goto err_out;
}
 
/* flash */
@@ -391,8 +392,6 @@ err_torch:
led_classdev_unregister(>cdev_flash);
 err_flash:
device_remove_file(&(pchip->bled->dev), _attr_bled_mode);
-err_bled_mode:
-   backlight_device_unregister(pchip->bled);
 err_out:
return ret;
 }
@@ -407,10 +406,8 @@ static int lm3639_remove(struct i2c_client *client)
led_classdev_unregister(>cdev_torch);
if (>cdev_flash)
led_classdev_unregister(>cdev_flash);
-   if (pchip->bled) {
+   if (pchip->bled)
device_remove_file(&(pchip->bled->dev), _attr_bled_mode);
-   backlight_device_unregister(pchip->bled);
-   }
return 0;
 }
 
@@ -432,6 +429,6 @@ static struct i2c_driver lm3639_i2c_driver = {
 module_i2c_driver(lm3639_i2c_driver);
 
 MODULE_DESCRIPTION("Texas Instruments Backlight+Flash LED driver for LM3639");
-MODULE_AUTHOR("Daniel Jeong ");
-MODULE_AUTHOR("G.Shark Jeong ");
+MODULE_AUTHOR("Daniel Jeong ");
+MODULE_AUTHOR("Ldd Mlp ");
 MODULE_LICENSE("GPL v2");
-- 
1.7.9.5

--
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/


[PATCH v3] backlight: add new LP8860 backlight driver

2014-03-13 Thread Daniel Jeong
 This patch adds LP8860 backlight device driver.
LP8860 is a low EMI and High performance 4 channel LED Driver of TI.
This device driver provides the way to control brightness and current
of each channel and provides the way to change values in the eeprom.

Signed-off-by: Daniel Jeong 
---
To support dt structure, another patch file will be sent.
changes since v2
 - removed some magic number. 
 - fixed the possibility to refer null when backlight is removed.

---
 drivers/video/backlight/Kconfig |7 +
 drivers/video/backlight/Makefile|1 +
 drivers/video/backlight/lp8860_bl.c |  526 +++
 include/linux/platform_data/lp8860_bl.h |   54 
 4 files changed, 588 insertions(+)
 create mode 100644 drivers/video/backlight/lp8860_bl.c
 create mode 100644 include/linux/platform_data/lp8860_bl.h

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 5a3eb2e..908048f 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -397,6 +397,13 @@ config BACKLIGHT_LP8788
help
  This supports TI LP8788 backlight driver.
 
+config BACKLIGHT_LP8860
+   tristate "Backlight Driver for LP8860"
+   depends on BACKLIGHT_CLASS_DEVICE && I2C
+   select REGMAP_I2C
+   help
+ This supports TI LP8860 Backlight Driver
+
 config BACKLIGHT_OT200
tristate "Backlight driver for ot200 visualisation device"
depends on BACKLIGHT_CLASS_DEVICE && CS5535_MFGPT && GPIO_CS5535
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index bb82002..cbc5ac3 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -42,6 +42,7 @@ obj-$(CONFIG_BACKLIGHT_LM3639)+= lm3639_bl.o
 obj-$(CONFIG_BACKLIGHT_LOCOMO) += locomolcd.o
 obj-$(CONFIG_BACKLIGHT_LP855X) += lp855x_bl.o
 obj-$(CONFIG_BACKLIGHT_LP8788) += lp8788_bl.o
+obj-$(CONFIG_BACKLIGHT_LP8860) += lp8860_bl.o
 obj-$(CONFIG_BACKLIGHT_LV5207LP)   += lv5207lp.o
 obj-$(CONFIG_BACKLIGHT_MAX8925)+= max8925_bl.o
 obj-$(CONFIG_BACKLIGHT_OMAP1)  += omap1_bl.o
diff --git a/drivers/video/backlight/lp8860_bl.c 
b/drivers/video/backlight/lp8860_bl.c
new file mode 100644
index 000..e17e94f
--- /dev/null
+++ b/drivers/video/backlight/lp8860_bl.c
@@ -0,0 +1,526 @@
+/*
+* Simple driver for Texas Instruments lp8860 Backlight driver chip
+*
+* Copyright (C) 2014 Texas Instruments
+* Author: Daniel Jeong  
+*Ldd Mlp 
+*
+* 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 REG_CL0_BRT_H  0x00
+#define REG_CL0_BRT_L  0x01
+#define REG_CL0_I_H0x02
+#define REG_CL0_I_L0x03
+
+#define REG_CL1_BRT_H  0x04
+#define REG_CL1_BRT_L  0x05
+#define REG_CL1_I  0x06
+
+#define REG_CL2_BRT_H  0x07
+#define REG_CL2_BRT_L  0x08
+#define REG_CL2_I  0x09
+
+#define REG_CL3_BRT_H  0x0a
+#define REG_CL3_BRT_L  0x0b
+#define REG_CL3_I  0x0c
+
+#define REG_CONF   0x0d
+#define REG_STATUS 0x0e
+#define REG_ID 0x12
+
+#define REG_ROM_CTRL   0x19
+#define REG_ROM_UNLOCK 0x1a
+#define REG_ROM_START  0x60
+#define REG_ROM_END0x78
+
+#define REG_EEPROM_START   0x60
+#define REG_EEPROM_END 0x78
+#define REG_MAX0xFF
+
+struct lp8860_chip {
+   struct device *dev;
+   struct lp8860_platform_data *pdata;
+   struct backlight_device *bled[LP8860_LED_MAX];
+   struct regmap *regmap;
+};
+
+/* brightness control */
+static int lp8860_bled_update_status(struct backlight_device *bl,
+enum lp8860_leds nsr)
+{
+   int ret = -EINVAL;
+   struct lp8860_chip *pchip = bl_get_data(bl);
+
+   if (pchip->pdata->mode)
+   return 0;
+
+   if (bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK))
+   bl->props.brightness = 0;
+
+   switch (nsr) {
+   case LP8860_LED0:
+   ret = regmap_write(pchip->regmap,
+  REG_CL0_BRT_H, bl->props.brightness >> 8);
+   ret |= regmap_write(pchip->regmap,
+   REG_CL0_BRT_L, bl->props.brightness & 0xff);
+   break;
+   case LP8860_LED1:
+   ret = regmap_write(pchip->regmap,
+  REG_CL1_BRT_H,
+  (bl->props.brightness >> 8) & 0x1f);
+   ret |= regmap_write(pchip->regmap,
+   REG_CL1_BRT_L, bl->props.brightness &a

[PATCH v3] backlight: add new LP8860 backlight driver

2014-03-13 Thread Daniel Jeong
 This patch adds LP8860 backlight device driver.
LP8860 is a low EMI and High performance 4 channel LED Driver of TI.
This device driver provides the way to control brightness and current
of each channel and provides the way to change values in the eeprom.

Signed-off-by: Daniel Jeong gshark.je...@gmail.com
---
To support dt structure, another patch file will be sent.
changes since v2
 - removed some magic number. 
 - fixed the possibility to refer null when backlight is removed.

---
 drivers/video/backlight/Kconfig |7 +
 drivers/video/backlight/Makefile|1 +
 drivers/video/backlight/lp8860_bl.c |  526 +++
 include/linux/platform_data/lp8860_bl.h |   54 
 4 files changed, 588 insertions(+)
 create mode 100644 drivers/video/backlight/lp8860_bl.c
 create mode 100644 include/linux/platform_data/lp8860_bl.h

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 5a3eb2e..908048f 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -397,6 +397,13 @@ config BACKLIGHT_LP8788
help
  This supports TI LP8788 backlight driver.
 
+config BACKLIGHT_LP8860
+   tristate Backlight Driver for LP8860
+   depends on BACKLIGHT_CLASS_DEVICE  I2C
+   select REGMAP_I2C
+   help
+ This supports TI LP8860 Backlight Driver
+
 config BACKLIGHT_OT200
tristate Backlight driver for ot200 visualisation device
depends on BACKLIGHT_CLASS_DEVICE  CS5535_MFGPT  GPIO_CS5535
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index bb82002..cbc5ac3 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -42,6 +42,7 @@ obj-$(CONFIG_BACKLIGHT_LM3639)+= lm3639_bl.o
 obj-$(CONFIG_BACKLIGHT_LOCOMO) += locomolcd.o
 obj-$(CONFIG_BACKLIGHT_LP855X) += lp855x_bl.o
 obj-$(CONFIG_BACKLIGHT_LP8788) += lp8788_bl.o
+obj-$(CONFIG_BACKLIGHT_LP8860) += lp8860_bl.o
 obj-$(CONFIG_BACKLIGHT_LV5207LP)   += lv5207lp.o
 obj-$(CONFIG_BACKLIGHT_MAX8925)+= max8925_bl.o
 obj-$(CONFIG_BACKLIGHT_OMAP1)  += omap1_bl.o
diff --git a/drivers/video/backlight/lp8860_bl.c 
b/drivers/video/backlight/lp8860_bl.c
new file mode 100644
index 000..e17e94f
--- /dev/null
+++ b/drivers/video/backlight/lp8860_bl.c
@@ -0,0 +1,526 @@
+/*
+* Simple driver for Texas Instruments lp8860 Backlight driver chip
+*
+* Copyright (C) 2014 Texas Instruments
+* Author: Daniel Jeong  gshark.je...@gmail.com
+*Ldd Mlp ldd-...@list.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/backlight.h
+#include linux/delay.h
+#include linux/err.h
+#include linux/i2c.h
+#include linux/module.h
+#include linux/platform_data/lp8860_bl.h
+#include linux/regmap.h
+#include linux/slab.h
+#include linux/uaccess.h
+
+#define REG_CL0_BRT_H  0x00
+#define REG_CL0_BRT_L  0x01
+#define REG_CL0_I_H0x02
+#define REG_CL0_I_L0x03
+
+#define REG_CL1_BRT_H  0x04
+#define REG_CL1_BRT_L  0x05
+#define REG_CL1_I  0x06
+
+#define REG_CL2_BRT_H  0x07
+#define REG_CL2_BRT_L  0x08
+#define REG_CL2_I  0x09
+
+#define REG_CL3_BRT_H  0x0a
+#define REG_CL3_BRT_L  0x0b
+#define REG_CL3_I  0x0c
+
+#define REG_CONF   0x0d
+#define REG_STATUS 0x0e
+#define REG_ID 0x12
+
+#define REG_ROM_CTRL   0x19
+#define REG_ROM_UNLOCK 0x1a
+#define REG_ROM_START  0x60
+#define REG_ROM_END0x78
+
+#define REG_EEPROM_START   0x60
+#define REG_EEPROM_END 0x78
+#define REG_MAX0xFF
+
+struct lp8860_chip {
+   struct device *dev;
+   struct lp8860_platform_data *pdata;
+   struct backlight_device *bled[LP8860_LED_MAX];
+   struct regmap *regmap;
+};
+
+/* brightness control */
+static int lp8860_bled_update_status(struct backlight_device *bl,
+enum lp8860_leds nsr)
+{
+   int ret = -EINVAL;
+   struct lp8860_chip *pchip = bl_get_data(bl);
+
+   if (pchip-pdata-mode)
+   return 0;
+
+   if (bl-props.state  (BL_CORE_SUSPENDED | BL_CORE_FBBLANK))
+   bl-props.brightness = 0;
+
+   switch (nsr) {
+   case LP8860_LED0:
+   ret = regmap_write(pchip-regmap,
+  REG_CL0_BRT_H, bl-props.brightness  8);
+   ret |= regmap_write(pchip-regmap,
+   REG_CL0_BRT_L, bl-props.brightness  0xff);
+   break;
+   case LP8860_LED1:
+   ret = regmap_write(pchip-regmap,
+  REG_CL1_BRT_H,
+  (bl-props.brightness  8)  0x1f);
+   ret |= regmap_write(pchip-regmap

[PATCH] backlight: lm3639: use devm_backlight_device_register()

2014-03-13 Thread Daniel Jeong
 change to use devm_backlight_device_register() for simple cleanup.

Signed-off-by: Daniel Jeong gshark.je...@gmail.com
---
 drivers/video/backlight/lm3639_bl.c |   17 +++--
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/video/backlight/lm3639_bl.c 
b/drivers/video/backlight/lm3639_bl.c
index 6fd60ad..5f36808 100644
--- a/drivers/video/backlight/lm3639_bl.c
+++ b/drivers/video/backlight/lm3639_bl.c
@@ -349,8 +349,9 @@ static int lm3639_probe(struct i2c_client *client,
props.brightness = pdata-init_brt_led;
props.max_brightness = pdata-max_brt_led;
pchip-bled =
-   backlight_device_register(lm3639_bled, pchip-dev, pchip,
- lm3639_bled_ops, props);
+   devm_backlight_device_register(pchip-dev, lm3639_bled,
+  pchip-dev, pchip, lm3639_bled_ops,
+  props);
if (IS_ERR(pchip-bled)) {
dev_err(client-dev, fail : backlight register\n);
ret = PTR_ERR(pchip-bled);
@@ -360,7 +361,7 @@ static int lm3639_probe(struct i2c_client *client,
ret = device_create_file((pchip-bled-dev), dev_attr_bled_mode);
if (ret  0) {
dev_err(client-dev, failed : add sysfs entries\n);
-   goto err_bled_mode;
+   goto err_out;
}
 
/* flash */
@@ -391,8 +392,6 @@ err_torch:
led_classdev_unregister(pchip-cdev_flash);
 err_flash:
device_remove_file((pchip-bled-dev), dev_attr_bled_mode);
-err_bled_mode:
-   backlight_device_unregister(pchip-bled);
 err_out:
return ret;
 }
@@ -407,10 +406,8 @@ static int lm3639_remove(struct i2c_client *client)
led_classdev_unregister(pchip-cdev_torch);
if (pchip-cdev_flash)
led_classdev_unregister(pchip-cdev_flash);
-   if (pchip-bled) {
+   if (pchip-bled)
device_remove_file((pchip-bled-dev), dev_attr_bled_mode);
-   backlight_device_unregister(pchip-bled);
-   }
return 0;
 }
 
@@ -432,6 +429,6 @@ static struct i2c_driver lm3639_i2c_driver = {
 module_i2c_driver(lm3639_i2c_driver);
 
 MODULE_DESCRIPTION(Texas Instruments Backlight+Flash LED driver for LM3639);
-MODULE_AUTHOR(Daniel Jeong daniel.je...@ti.com);
-MODULE_AUTHOR(G.Shark Jeong gshark.je...@gmail.com);
+MODULE_AUTHOR(Daniel Jeong gshark.je...@gmail.com);
+MODULE_AUTHOR(Ldd Mlp ldd-...@list.ti.com);
 MODULE_LICENSE(GPL v2);
-- 
1.7.9.5

--
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/


[PATCH v2] backlight: add new LP8860 backlight driver

2014-03-12 Thread Daniel Jeong
 This patch adds LP8860 backlight device driver.
LP8860 is a low EMI and High performance 4 channel LED Driver of TI.
This device driver provides the way to control brightness and current
of each channel and provides the way to change values in the eeprom.

Signed-off-by: Daniel Jeong 
---
 drivers/video/backlight/Kconfig |7 +
 drivers/video/backlight/Makefile|1 +
 drivers/video/backlight/lp8860_bl.c |  525 +++
 include/linux/platform_data/lp8860_bl.h |   54 
 4 files changed, 587 insertions(+)
 create mode 100644 drivers/video/backlight/lp8860_bl.c
 create mode 100644 include/linux/platform_data/lp8860_bl.h

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 5a3eb2e..908048f 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -397,6 +397,13 @@ config BACKLIGHT_LP8788
help
  This supports TI LP8788 backlight driver.
 
+config BACKLIGHT_LP8860
+   tristate "Backlight Driver for LP8860"
+   depends on BACKLIGHT_CLASS_DEVICE && I2C
+   select REGMAP_I2C
+   help
+ This supports TI LP8860 Backlight Driver
+
 config BACKLIGHT_OT200
tristate "Backlight driver for ot200 visualisation device"
depends on BACKLIGHT_CLASS_DEVICE && CS5535_MFGPT && GPIO_CS5535
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index bb82002..cbc5ac3 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -42,6 +42,7 @@ obj-$(CONFIG_BACKLIGHT_LM3639)+= lm3639_bl.o
 obj-$(CONFIG_BACKLIGHT_LOCOMO) += locomolcd.o
 obj-$(CONFIG_BACKLIGHT_LP855X) += lp855x_bl.o
 obj-$(CONFIG_BACKLIGHT_LP8788) += lp8788_bl.o
+obj-$(CONFIG_BACKLIGHT_LP8860) += lp8860_bl.o
 obj-$(CONFIG_BACKLIGHT_LV5207LP)   += lv5207lp.o
 obj-$(CONFIG_BACKLIGHT_MAX8925)+= max8925_bl.o
 obj-$(CONFIG_BACKLIGHT_OMAP1)  += omap1_bl.o
diff --git a/drivers/video/backlight/lp8860_bl.c 
b/drivers/video/backlight/lp8860_bl.c
new file mode 100644
index 000..d2be950
--- /dev/null
+++ b/drivers/video/backlight/lp8860_bl.c
@@ -0,0 +1,525 @@
+/*
+* Simple driver for Texas Instruments lp8860 Backlight driver chip
+*
+* Copyright (C) 2014 Texas Instruments
+* Author: Daniel Jeong  
+*Ldd Mlp 
+*
+* 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 REG_CL0_BRT_H  0x00
+#define REG_CL0_BRT_L  0x01
+#define REG_CL0_I_H0x02
+#define REG_CL0_I_L0x03
+
+#define REG_CL1_BRT_H  0x04
+#define REG_CL1_BRT_L  0x05
+#define REG_CL1_I  0x06
+
+#define REG_CL2_BRT_H  0x07
+#define REG_CL2_BRT_L  0x08
+#define REG_CL2_I  0x09
+
+#define REG_CL3_BRT_H  0x0a
+#define REG_CL3_BRT_L  0x0b
+#define REG_CL3_I  0x0c
+
+#define REG_CONF   0x0d
+#define REG_STATUS 0x0e
+#define REG_ID 0x12
+
+#define REG_ROM_CTRL   0x19
+#define REG_ROM_UNLOCK 0x1a
+#define REG_ROM_START  0x60
+#define REG_ROM_END0x78
+
+#define REG_EEPROM_START   0x60
+#define REG_EEPROM_END 0x78
+#define REG_MAX0xFF
+
+struct lp8860_chip {
+   struct device *dev;
+   struct lp8860_platform_data *pdata;
+   struct backlight_device *bled[LP8860_LED_MAX];
+   struct regmap *regmap;
+};
+
+/* brightness control */
+static int lp8860_bled_update_status(struct backlight_device *bl,
+enum lp8860_leds nsr)
+{
+   int ret = -EINVAL;
+   struct lp8860_chip *pchip = bl_get_data(bl);
+
+   if (pchip->pdata->mode)
+   return 0;
+
+   if (bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK))
+   bl->props.brightness = 0;
+
+   switch (nsr) {
+   case LP8860_LED0:
+   ret = regmap_write(pchip->regmap,
+  REG_CL0_BRT_H, bl->props.brightness >> 8);
+   ret |= regmap_write(pchip->regmap,
+   REG_CL0_BRT_L, bl->props.brightness & 0xff);
+   break;
+   case LP8860_LED1:
+   ret = regmap_write(pchip->regmap,
+  REG_CL1_BRT_H,
+  (bl->props.brightness >> 8) & 0x1f);
+   ret |= regmap_write(pchip->regmap,
+   REG_CL1_BRT_L, bl->props.brightness & 0xff);
+   break;
+   case LP8860_LED2:
+   ret = regmap_write(pchip->regmap,
+  REG_CL2_BRT_H,
+ 

Re: [PATCH] backlight: add new LP8860 backlight driver

2014-03-12 Thread Daniel Jeong

Thank you for your comments


On Monday, March 03, 2014 6:15 PM, Daniel Jeong wrote:
(+CC Bryan Wu, Lee Jones)

Please add Bryan Wu, Lee Jones to CC list, when you send
patches for backlight.


  This patch adds LP8860 backlight device driver.
LP8860 is a low EMI and High performance 4 channel LED Driver of TI.
This device driver provide the way to control brightness and currnet

(+CC Bryan Wu, Lee Jones)

s/provide/provides
s/currnet/current


of each channel and provide the way to write eeprom.

s/provide/provides


To support dt structure, another patch file will be sent.

Signed-off-by: Daniel Jeong 
---

'To support dt structure, another patch file will be sent.' is
NOT appropriate for the commit message. So, please move it as below.
Then, this message will not be included to the commit message, when
this patch will be merged to maintainer's tree.

Signed-off-by: Daniel Jeong 
---
To support dt structure, another patch file will be sent.



  drivers/video/backlight/Kconfig |7 +
  drivers/video/backlight/Makefile|1 +
  drivers/video/backlight/lp8860_bl.c |  528 +++
  include/linux/platform_data/lp8860_bl.h |   54 
  4 files changed, 590 insertions(+)
  create mode 100644 drivers/video/backlight/lp8860_bl.c
  create mode 100644 include/linux/platform_data/lp8860_bl.h

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 5a3eb2e..908048f 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -397,6 +397,13 @@ config BACKLIGHT_LP8788
help
  This supports TI LP8788 backlight driver.

+config BACKLIGHT_LP8860
+   tristate "Backlight Driver for LP8860"
+   depends on BACKLIGHT_CLASS_DEVICE && I2C
+   select REGMAP_I2C
+   help
+ This supports TI LP8860 Backlight Driver
+
  config BACKLIGHT_OT200
tristate "Backlight driver for ot200 visualisation device"
depends on BACKLIGHT_CLASS_DEVICE && CS5535_MFGPT && GPIO_CS5535
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index bb82002..cbc5ac3 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -42,6 +42,7 @@ obj-$(CONFIG_BACKLIGHT_LM3639)+= lm3639_bl.o
  obj-$(CONFIG_BACKLIGHT_LOCOMO)+= locomolcd.o
  obj-$(CONFIG_BACKLIGHT_LP855X)+= lp855x_bl.o
  obj-$(CONFIG_BACKLIGHT_LP8788)+= lp8788_bl.o
+obj-$(CONFIG_BACKLIGHT_LP8860) += lp8860_bl.o
  obj-$(CONFIG_BACKLIGHT_LV5207LP)  += lv5207lp.o
  obj-$(CONFIG_BACKLIGHT_MAX8925)   += max8925_bl.o
  obj-$(CONFIG_BACKLIGHT_OMAP1) += omap1_bl.o
diff --git a/drivers/video/backlight/lp8860_bl.c 
b/drivers/video/backlight/lp8860_bl.c
new file mode 100644
index 000..4712e84
--- /dev/null
+++ b/drivers/video/backlight/lp8860_bl.c
@@ -0,0 +1,528 @@
+/*
+* Simple driver for Texas Instruments lp8860 Backlight driver chip
+*
+* Copyright (C) 2014 Texas Instruments
+* Author: Daniel Jeong  
+*Ldd Mlp 
+*
+* 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 

Please move this header in alphabetical order.


+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define REG_CL0_BRT_H  0x00
+#define REG_CL0_BRT_L  0x01
+#define REG_CL0_I_H0x02
+#define REG_CL0_I_L0x03
+
+#define REG_CL1_BRT_H  0x04
+#define REG_CL1_BRT_L  0x05
+#define REG_CL1_I  0x06
+
+#define REG_CL2_BRT_H  0x07
+#define REG_CL2_BRT_L  0x08
+#define REG_CL2_I  0x09
+
+#define REG_CL3_BRT_H  0x0a
+#define REG_CL3_BRT_L  0x0b
+#define REG_CL3_I  0x0c
+
+#define REG_CONF   0x0d
+#define REG_STATUS 0x0e
+#define REG_ID 0x12
+
+#define REG_ROM_CTRL   0x19
+#define REG_ROM_UNLOCK 0x1a
+#define REG_ROM_START  0x60
+#define REG_ROM_END0x78
+
+#define REG_EEPROM_START   0x60
+#define REG_EEPROM_END 0x78
+#define REG_MAX0xFF
+
+struct lp8860_chip {
+   struct device *dev;
+   struct lp8860_platform_data *pdata;
+   struct backlight_device *bled[LP8860_LED_MAX];
+   struct regmap *regmap;
+};
+
+/* brightness control */
+static int lp8860_bled_update_status(struct backlight_device *bl,
+enum lp8860_leds nsr)
+{
+   int ret = -EINVAL;
+   struct lp8860_chip *pchip = bl_get_data(bl);
+
+   if (pchip->pdata->mode)
+   return 0;
+
+   if (bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK))
+   bl->props.brightness = 0;
+
+   switch (nsr) {
+   case LP8860_LED0:
+   ret = regmap_write(pchip->regmap,
+  REG_CL0_BRT_H, bl->

Re: [PATCH] backlight: add new LP8860 backlight driver

2014-03-12 Thread Daniel Jeong

Thank you for your comments


On Monday, March 03, 2014 6:15 PM, Daniel Jeong wrote:
(+CC Bryan Wu, Lee Jones)

Please add Bryan Wu, Lee Jones to CC list, when you send
patches for backlight.


  This patch adds LP8860 backlight device driver.
LP8860 is a low EMI and High performance 4 channel LED Driver of TI.
This device driver provide the way to control brightness and currnet

(+CC Bryan Wu, Lee Jones)

s/provide/provides
s/currnet/current


of each channel and provide the way to write eeprom.

s/provide/provides


To support dt structure, another patch file will be sent.

Signed-off-by: Daniel Jeong gshark.je...@gmail.com
---

'To support dt structure, another patch file will be sent.' is
NOT appropriate for the commit message. So, please move it as below.
Then, this message will not be included to the commit message, when
this patch will be merged to maintainer's tree.

Signed-off-by: Daniel Jeong gshark.je...@gmail.com
---
To support dt structure, another patch file will be sent.



  drivers/video/backlight/Kconfig |7 +
  drivers/video/backlight/Makefile|1 +
  drivers/video/backlight/lp8860_bl.c |  528 +++
  include/linux/platform_data/lp8860_bl.h |   54 
  4 files changed, 590 insertions(+)
  create mode 100644 drivers/video/backlight/lp8860_bl.c
  create mode 100644 include/linux/platform_data/lp8860_bl.h

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 5a3eb2e..908048f 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -397,6 +397,13 @@ config BACKLIGHT_LP8788
help
  This supports TI LP8788 backlight driver.

+config BACKLIGHT_LP8860
+   tristate Backlight Driver for LP8860
+   depends on BACKLIGHT_CLASS_DEVICE  I2C
+   select REGMAP_I2C
+   help
+ This supports TI LP8860 Backlight Driver
+
  config BACKLIGHT_OT200
tristate Backlight driver for ot200 visualisation device
depends on BACKLIGHT_CLASS_DEVICE  CS5535_MFGPT  GPIO_CS5535
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index bb82002..cbc5ac3 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -42,6 +42,7 @@ obj-$(CONFIG_BACKLIGHT_LM3639)+= lm3639_bl.o
  obj-$(CONFIG_BACKLIGHT_LOCOMO)+= locomolcd.o
  obj-$(CONFIG_BACKLIGHT_LP855X)+= lp855x_bl.o
  obj-$(CONFIG_BACKLIGHT_LP8788)+= lp8788_bl.o
+obj-$(CONFIG_BACKLIGHT_LP8860) += lp8860_bl.o
  obj-$(CONFIG_BACKLIGHT_LV5207LP)  += lv5207lp.o
  obj-$(CONFIG_BACKLIGHT_MAX8925)   += max8925_bl.o
  obj-$(CONFIG_BACKLIGHT_OMAP1) += omap1_bl.o
diff --git a/drivers/video/backlight/lp8860_bl.c 
b/drivers/video/backlight/lp8860_bl.c
new file mode 100644
index 000..4712e84
--- /dev/null
+++ b/drivers/video/backlight/lp8860_bl.c
@@ -0,0 +1,528 @@
+/*
+* Simple driver for Texas Instruments lp8860 Backlight driver chip
+*
+* Copyright (C) 2014 Texas Instruments
+* Author: Daniel Jeong  gshark.je...@gmail.com
+*Ldd Mlp ldd-...@list.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/module.h

Please move this header in alphabetical order.


+#include linux/backlight.h
+#include linux/delay.h
+#include linux/err.h
+#include linux/i2c.h
+#include linux/platform_data/lp8860_bl.h
+#include linux/regmap.h
+#include linux/slab.h
+#include linux/uaccess.h
+
+#define REG_CL0_BRT_H  0x00
+#define REG_CL0_BRT_L  0x01
+#define REG_CL0_I_H0x02
+#define REG_CL0_I_L0x03
+
+#define REG_CL1_BRT_H  0x04
+#define REG_CL1_BRT_L  0x05
+#define REG_CL1_I  0x06
+
+#define REG_CL2_BRT_H  0x07
+#define REG_CL2_BRT_L  0x08
+#define REG_CL2_I  0x09
+
+#define REG_CL3_BRT_H  0x0a
+#define REG_CL3_BRT_L  0x0b
+#define REG_CL3_I  0x0c
+
+#define REG_CONF   0x0d
+#define REG_STATUS 0x0e
+#define REG_ID 0x12
+
+#define REG_ROM_CTRL   0x19
+#define REG_ROM_UNLOCK 0x1a
+#define REG_ROM_START  0x60
+#define REG_ROM_END0x78
+
+#define REG_EEPROM_START   0x60
+#define REG_EEPROM_END 0x78
+#define REG_MAX0xFF
+
+struct lp8860_chip {
+   struct device *dev;
+   struct lp8860_platform_data *pdata;
+   struct backlight_device *bled[LP8860_LED_MAX];
+   struct regmap *regmap;
+};
+
+/* brightness control */
+static int lp8860_bled_update_status(struct backlight_device *bl,
+enum lp8860_leds nsr)
+{
+   int ret = -EINVAL;
+   struct lp8860_chip *pchip = bl_get_data(bl);
+
+   if (pchip-pdata-mode)
+   return 0;
+
+   if (bl-props.state  (BL_CORE_SUSPENDED | BL_CORE_FBBLANK))
+   bl-props.brightness = 0;
+
+   switch

[PATCH v2] backlight: add new LP8860 backlight driver

2014-03-12 Thread Daniel Jeong
 This patch adds LP8860 backlight device driver.
LP8860 is a low EMI and High performance 4 channel LED Driver of TI.
This device driver provides the way to control brightness and current
of each channel and provides the way to change values in the eeprom.

Signed-off-by: Daniel Jeong gshark.je...@gmail.com
---
 drivers/video/backlight/Kconfig |7 +
 drivers/video/backlight/Makefile|1 +
 drivers/video/backlight/lp8860_bl.c |  525 +++
 include/linux/platform_data/lp8860_bl.h |   54 
 4 files changed, 587 insertions(+)
 create mode 100644 drivers/video/backlight/lp8860_bl.c
 create mode 100644 include/linux/platform_data/lp8860_bl.h

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 5a3eb2e..908048f 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -397,6 +397,13 @@ config BACKLIGHT_LP8788
help
  This supports TI LP8788 backlight driver.
 
+config BACKLIGHT_LP8860
+   tristate Backlight Driver for LP8860
+   depends on BACKLIGHT_CLASS_DEVICE  I2C
+   select REGMAP_I2C
+   help
+ This supports TI LP8860 Backlight Driver
+
 config BACKLIGHT_OT200
tristate Backlight driver for ot200 visualisation device
depends on BACKLIGHT_CLASS_DEVICE  CS5535_MFGPT  GPIO_CS5535
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index bb82002..cbc5ac3 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -42,6 +42,7 @@ obj-$(CONFIG_BACKLIGHT_LM3639)+= lm3639_bl.o
 obj-$(CONFIG_BACKLIGHT_LOCOMO) += locomolcd.o
 obj-$(CONFIG_BACKLIGHT_LP855X) += lp855x_bl.o
 obj-$(CONFIG_BACKLIGHT_LP8788) += lp8788_bl.o
+obj-$(CONFIG_BACKLIGHT_LP8860) += lp8860_bl.o
 obj-$(CONFIG_BACKLIGHT_LV5207LP)   += lv5207lp.o
 obj-$(CONFIG_BACKLIGHT_MAX8925)+= max8925_bl.o
 obj-$(CONFIG_BACKLIGHT_OMAP1)  += omap1_bl.o
diff --git a/drivers/video/backlight/lp8860_bl.c 
b/drivers/video/backlight/lp8860_bl.c
new file mode 100644
index 000..d2be950
--- /dev/null
+++ b/drivers/video/backlight/lp8860_bl.c
@@ -0,0 +1,525 @@
+/*
+* Simple driver for Texas Instruments lp8860 Backlight driver chip
+*
+* Copyright (C) 2014 Texas Instruments
+* Author: Daniel Jeong  gshark.je...@gmail.com
+*Ldd Mlp ldd-...@list.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/backlight.h
+#include linux/delay.h
+#include linux/err.h
+#include linux/i2c.h
+#include linux/module.h
+#include linux/platform_data/lp8860_bl.h
+#include linux/regmap.h
+#include linux/slab.h
+#include linux/uaccess.h
+
+#define REG_CL0_BRT_H  0x00
+#define REG_CL0_BRT_L  0x01
+#define REG_CL0_I_H0x02
+#define REG_CL0_I_L0x03
+
+#define REG_CL1_BRT_H  0x04
+#define REG_CL1_BRT_L  0x05
+#define REG_CL1_I  0x06
+
+#define REG_CL2_BRT_H  0x07
+#define REG_CL2_BRT_L  0x08
+#define REG_CL2_I  0x09
+
+#define REG_CL3_BRT_H  0x0a
+#define REG_CL3_BRT_L  0x0b
+#define REG_CL3_I  0x0c
+
+#define REG_CONF   0x0d
+#define REG_STATUS 0x0e
+#define REG_ID 0x12
+
+#define REG_ROM_CTRL   0x19
+#define REG_ROM_UNLOCK 0x1a
+#define REG_ROM_START  0x60
+#define REG_ROM_END0x78
+
+#define REG_EEPROM_START   0x60
+#define REG_EEPROM_END 0x78
+#define REG_MAX0xFF
+
+struct lp8860_chip {
+   struct device *dev;
+   struct lp8860_platform_data *pdata;
+   struct backlight_device *bled[LP8860_LED_MAX];
+   struct regmap *regmap;
+};
+
+/* brightness control */
+static int lp8860_bled_update_status(struct backlight_device *bl,
+enum lp8860_leds nsr)
+{
+   int ret = -EINVAL;
+   struct lp8860_chip *pchip = bl_get_data(bl);
+
+   if (pchip-pdata-mode)
+   return 0;
+
+   if (bl-props.state  (BL_CORE_SUSPENDED | BL_CORE_FBBLANK))
+   bl-props.brightness = 0;
+
+   switch (nsr) {
+   case LP8860_LED0:
+   ret = regmap_write(pchip-regmap,
+  REG_CL0_BRT_H, bl-props.brightness  8);
+   ret |= regmap_write(pchip-regmap,
+   REG_CL0_BRT_L, bl-props.brightness  0xff);
+   break;
+   case LP8860_LED1:
+   ret = regmap_write(pchip-regmap,
+  REG_CL1_BRT_H,
+  (bl-props.brightness  8)  0x1f);
+   ret |= regmap_write(pchip-regmap,
+   REG_CL1_BRT_L, bl-props.brightness  0xff);
+   break;
+   case LP8860_LED2:
+   ret = regmap_write(pchip-regmap

[PATCH] backlight: add new LP8860 backlight driver

2014-03-03 Thread Daniel Jeong
 This patch adds LP8860 backlight device driver.
LP8860 is a low EMI and High performance 4 channel LED Driver of TI.
This device driver provide the way to control brightness and currnet
of each channel and provide the way to write eeprom.
To support dt structure, another patch file will be sent.

Signed-off-by: Daniel Jeong 
---
 drivers/video/backlight/Kconfig |7 +
 drivers/video/backlight/Makefile|1 +
 drivers/video/backlight/lp8860_bl.c |  528 +++
 include/linux/platform_data/lp8860_bl.h |   54 
 4 files changed, 590 insertions(+)
 create mode 100644 drivers/video/backlight/lp8860_bl.c
 create mode 100644 include/linux/platform_data/lp8860_bl.h

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 5a3eb2e..908048f 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -397,6 +397,13 @@ config BACKLIGHT_LP8788
help
  This supports TI LP8788 backlight driver.
 
+config BACKLIGHT_LP8860
+   tristate "Backlight Driver for LP8860"
+   depends on BACKLIGHT_CLASS_DEVICE && I2C
+   select REGMAP_I2C
+   help
+ This supports TI LP8860 Backlight Driver
+
 config BACKLIGHT_OT200
tristate "Backlight driver for ot200 visualisation device"
depends on BACKLIGHT_CLASS_DEVICE && CS5535_MFGPT && GPIO_CS5535
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index bb82002..cbc5ac3 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -42,6 +42,7 @@ obj-$(CONFIG_BACKLIGHT_LM3639)+= lm3639_bl.o
 obj-$(CONFIG_BACKLIGHT_LOCOMO) += locomolcd.o
 obj-$(CONFIG_BACKLIGHT_LP855X) += lp855x_bl.o
 obj-$(CONFIG_BACKLIGHT_LP8788) += lp8788_bl.o
+obj-$(CONFIG_BACKLIGHT_LP8860) += lp8860_bl.o
 obj-$(CONFIG_BACKLIGHT_LV5207LP)   += lv5207lp.o
 obj-$(CONFIG_BACKLIGHT_MAX8925)+= max8925_bl.o
 obj-$(CONFIG_BACKLIGHT_OMAP1)  += omap1_bl.o
diff --git a/drivers/video/backlight/lp8860_bl.c 
b/drivers/video/backlight/lp8860_bl.c
new file mode 100644
index 000..4712e84
--- /dev/null
+++ b/drivers/video/backlight/lp8860_bl.c
@@ -0,0 +1,528 @@
+/*
+* Simple driver for Texas Instruments lp8860 Backlight driver chip
+*
+* Copyright (C) 2014 Texas Instruments
+* Author: Daniel Jeong  
+*Ldd Mlp 
+*
+* 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 REG_CL0_BRT_H  0x00
+#define REG_CL0_BRT_L  0x01
+#define REG_CL0_I_H0x02
+#define REG_CL0_I_L0x03
+
+#define REG_CL1_BRT_H  0x04
+#define REG_CL1_BRT_L  0x05
+#define REG_CL1_I  0x06
+
+#define REG_CL2_BRT_H  0x07
+#define REG_CL2_BRT_L  0x08
+#define REG_CL2_I  0x09
+
+#define REG_CL3_BRT_H  0x0a
+#define REG_CL3_BRT_L  0x0b
+#define REG_CL3_I  0x0c
+
+#define REG_CONF   0x0d
+#define REG_STATUS 0x0e
+#define REG_ID 0x12
+
+#define REG_ROM_CTRL   0x19
+#define REG_ROM_UNLOCK 0x1a
+#define REG_ROM_START  0x60
+#define REG_ROM_END0x78
+
+#define REG_EEPROM_START   0x60
+#define REG_EEPROM_END 0x78
+#define REG_MAX0xFF
+
+struct lp8860_chip {
+   struct device *dev;
+   struct lp8860_platform_data *pdata;
+   struct backlight_device *bled[LP8860_LED_MAX];
+   struct regmap *regmap;
+};
+
+/* brightness control */
+static int lp8860_bled_update_status(struct backlight_device *bl,
+enum lp8860_leds nsr)
+{
+   int ret = -EINVAL;
+   struct lp8860_chip *pchip = bl_get_data(bl);
+
+   if (pchip->pdata->mode)
+   return 0;
+
+   if (bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK))
+   bl->props.brightness = 0;
+
+   switch (nsr) {
+   case LP8860_LED0:
+   ret = regmap_write(pchip->regmap,
+  REG_CL0_BRT_H, bl->props.brightness >> 8);
+   ret |= regmap_write(pchip->regmap,
+   REG_CL0_BRT_L, bl->props.brightness & 0xff);
+   break;
+   case LP8860_LED1:
+   ret = regmap_write(pchip->regmap,
+  REG_CL1_BRT_H,
+  (bl->props.brightness >> 8) & 0x1f);
+   ret |=
+   regmap_write(pchip->regmap, REG_CL1_BRT_L,
+bl->props.brightness & 0xff);
+   break;
+   case LP8860_LED2:
+   ret = regmap_write(pchip->regmap,
+ 

[PATCH] backlight: add new LP8860 backlight driver

2014-03-03 Thread Daniel Jeong
 This patch adds LP8860 backlight device driver.
LP8860 is a low EMI and High performance 4 channel LED Driver of TI.
This device driver provide the way to control brightness and currnet
of each channel and provide the way to write eeprom.
To support dt structure, another patch file will be sent.

Signed-off-by: Daniel Jeong gshark.je...@gmail.com
---
 drivers/video/backlight/Kconfig |7 +
 drivers/video/backlight/Makefile|1 +
 drivers/video/backlight/lp8860_bl.c |  528 +++
 include/linux/platform_data/lp8860_bl.h |   54 
 4 files changed, 590 insertions(+)
 create mode 100644 drivers/video/backlight/lp8860_bl.c
 create mode 100644 include/linux/platform_data/lp8860_bl.h

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 5a3eb2e..908048f 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -397,6 +397,13 @@ config BACKLIGHT_LP8788
help
  This supports TI LP8788 backlight driver.
 
+config BACKLIGHT_LP8860
+   tristate Backlight Driver for LP8860
+   depends on BACKLIGHT_CLASS_DEVICE  I2C
+   select REGMAP_I2C
+   help
+ This supports TI LP8860 Backlight Driver
+
 config BACKLIGHT_OT200
tristate Backlight driver for ot200 visualisation device
depends on BACKLIGHT_CLASS_DEVICE  CS5535_MFGPT  GPIO_CS5535
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index bb82002..cbc5ac3 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -42,6 +42,7 @@ obj-$(CONFIG_BACKLIGHT_LM3639)+= lm3639_bl.o
 obj-$(CONFIG_BACKLIGHT_LOCOMO) += locomolcd.o
 obj-$(CONFIG_BACKLIGHT_LP855X) += lp855x_bl.o
 obj-$(CONFIG_BACKLIGHT_LP8788) += lp8788_bl.o
+obj-$(CONFIG_BACKLIGHT_LP8860) += lp8860_bl.o
 obj-$(CONFIG_BACKLIGHT_LV5207LP)   += lv5207lp.o
 obj-$(CONFIG_BACKLIGHT_MAX8925)+= max8925_bl.o
 obj-$(CONFIG_BACKLIGHT_OMAP1)  += omap1_bl.o
diff --git a/drivers/video/backlight/lp8860_bl.c 
b/drivers/video/backlight/lp8860_bl.c
new file mode 100644
index 000..4712e84
--- /dev/null
+++ b/drivers/video/backlight/lp8860_bl.c
@@ -0,0 +1,528 @@
+/*
+* Simple driver for Texas Instruments lp8860 Backlight driver chip
+*
+* Copyright (C) 2014 Texas Instruments
+* Author: Daniel Jeong  gshark.je...@gmail.com
+*Ldd Mlp ldd-...@list.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/module.h
+#include linux/backlight.h
+#include linux/delay.h
+#include linux/err.h
+#include linux/i2c.h
+#include linux/platform_data/lp8860_bl.h
+#include linux/regmap.h
+#include linux/slab.h
+#include linux/uaccess.h
+
+#define REG_CL0_BRT_H  0x00
+#define REG_CL0_BRT_L  0x01
+#define REG_CL0_I_H0x02
+#define REG_CL0_I_L0x03
+
+#define REG_CL1_BRT_H  0x04
+#define REG_CL1_BRT_L  0x05
+#define REG_CL1_I  0x06
+
+#define REG_CL2_BRT_H  0x07
+#define REG_CL2_BRT_L  0x08
+#define REG_CL2_I  0x09
+
+#define REG_CL3_BRT_H  0x0a
+#define REG_CL3_BRT_L  0x0b
+#define REG_CL3_I  0x0c
+
+#define REG_CONF   0x0d
+#define REG_STATUS 0x0e
+#define REG_ID 0x12
+
+#define REG_ROM_CTRL   0x19
+#define REG_ROM_UNLOCK 0x1a
+#define REG_ROM_START  0x60
+#define REG_ROM_END0x78
+
+#define REG_EEPROM_START   0x60
+#define REG_EEPROM_END 0x78
+#define REG_MAX0xFF
+
+struct lp8860_chip {
+   struct device *dev;
+   struct lp8860_platform_data *pdata;
+   struct backlight_device *bled[LP8860_LED_MAX];
+   struct regmap *regmap;
+};
+
+/* brightness control */
+static int lp8860_bled_update_status(struct backlight_device *bl,
+enum lp8860_leds nsr)
+{
+   int ret = -EINVAL;
+   struct lp8860_chip *pchip = bl_get_data(bl);
+
+   if (pchip-pdata-mode)
+   return 0;
+
+   if (bl-props.state  (BL_CORE_SUSPENDED | BL_CORE_FBBLANK))
+   bl-props.brightness = 0;
+
+   switch (nsr) {
+   case LP8860_LED0:
+   ret = regmap_write(pchip-regmap,
+  REG_CL0_BRT_H, bl-props.brightness  8);
+   ret |= regmap_write(pchip-regmap,
+   REG_CL0_BRT_L, bl-props.brightness  0xff);
+   break;
+   case LP8860_LED1:
+   ret = regmap_write(pchip-regmap,
+  REG_CL1_BRT_H,
+  (bl-props.brightness  8)  0x1f);
+   ret |=
+   regmap_write(pchip-regmap, REG_CL1_BRT_L,
+bl-props.brightness  0xff);
+   break;
+   case LP8860_LED2:
+   ret = regmap_write

Re: [RFCv2,1/2] v4l2-controls.h: add addtional Flash fault bits

2014-01-28 Thread Daniel Jeong

2014년 01월 28일 18:08, Sakari Ailus 쓴 글:

Hi Daniel,

On Tue, Jan 28, 2014 at 03:55:57PM +0900, Daniel Jeong wrote:

Add additional FLASH Fault bits to dectect faults from chip.
Some Flash drivers support UVLO, IVFM, NTC Trip faults.
UVLO :  Under Voltage Lock Out Threshold crossed
IVFM :  IVFM block reported and/or adjusted LED current Input Voltage Flash 
Monitor trip threshold
NTC  :  NTC Threshold crossed. Many Flash drivers have a pin and the fault bit 
to
serves as a threshold detector for negative temperature coefficient (NTC) 
thermistors.

Signed-off-by: Daniel Jeong 
---
  include/uapi/linux/v4l2-controls.h |3 +++
  1 file changed, 3 insertions(+)

diff --git a/include/uapi/linux/v4l2-controls.h 
b/include/uapi/linux/v4l2-controls.h
index 1666aab..01d730c 100644
--- a/include/uapi/linux/v4l2-controls.h
+++ b/include/uapi/linux/v4l2-controls.h
@@ -803,6 +803,9 @@ enum v4l2_flash_strobe_source {
  #define V4L2_FLASH_FAULT_SHORT_CIRCUIT(1 << 3)
  #define V4L2_FLASH_FAULT_OVER_CURRENT (1 << 4)
  #define V4L2_FLASH_FAULT_INDICATOR(1 << 5)
+#define V4L2_FLASH_FAULT_UVLO  (1 << 6)
+#define V4L2_FLASH_FAULT_IVFM  (1 << 7)
+#define V4L2_FLASH_FAULT_NTC_TRIP  (1 << 8)

I object adding a new fault which is essentially the same as an existing
fault, V4L2_FLASH_FAULT_OVER_TEMPERATURE.


I hope you consider it again.
Usually, when the die temperature exceeds the specific temperature, ie 120 or 
135 and fixed value,
turn off PFET,NFET, current sources and set TEMP Fault bit.
But in the NTC mode, the comparator is working and detect selected temperature 
through Vtrip value.
It protects shutdown the chip due to high voltage and keep the device operation.
Many flash chip support NTC and TEMP Fault both. For example, LM3554, LM3556, 
LM3559
LM3642, LM3646, LM3560, LM3561, LM3565 etc
Two things should be tell apart.



As the practice has been to use human-readable names for the faults, I'd
also suggest using V4L2_FLASH_FAULT_UNDER_VOLTAGE instead of
V4L2_FLASH_FAULT_UVLO.


I agree with you.



What's the IVFM block and what does it do?


IVFM is Input Voltage Flash Monitor.
If the flash chip has IVFM function the flash current can be adjusted based 
upon the voltage level of input.
As ramping flash current, the input voltage goes down and IVFM block adjust 
current to prevent to shudown due to low voltage
and keep the flash operation. So if the input voltage crossed the IVFM 
Threshold level chip set the fault bit.
Many flash chip, for example LM3556, LM3646, LM3642 , support this fucntion.
I think, V4L2_FLASH_FAULT_INPUT_VOLTAGE_MONITOR is better than 
V4L2_FLASH_FAULT_IVFM.




  #define V4L2_CID_FLASH_CHARGE (V4L2_CID_FLASH_CLASS_BASE + 11)
  #define V4L2_CID_FLASH_READY  (V4L2_CID_FLASH_CLASS_BASE + 12)


--
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: [RFCv2,1/2] v4l2-controls.h: add addtional Flash fault bits

2014-01-28 Thread Daniel Jeong

2014년 01월 28일 18:08, Sakari Ailus 쓴 글:

Hi Daniel,

On Tue, Jan 28, 2014 at 03:55:57PM +0900, Daniel Jeong wrote:

Add additional FLASH Fault bits to dectect faults from chip.
Some Flash drivers support UVLO, IVFM, NTC Trip faults.
UVLO :  Under Voltage Lock Out Threshold crossed
IVFM :  IVFM block reported and/or adjusted LED current Input Voltage Flash 
Monitor trip threshold
NTC  :  NTC Threshold crossed. Many Flash drivers have a pin and the fault bit 
to
serves as a threshold detector for negative temperature coefficient (NTC) 
thermistors.

Signed-off-by: Daniel Jeong gshark.je...@gmail.com
---
  include/uapi/linux/v4l2-controls.h |3 +++
  1 file changed, 3 insertions(+)

diff --git a/include/uapi/linux/v4l2-controls.h 
b/include/uapi/linux/v4l2-controls.h
index 1666aab..01d730c 100644
--- a/include/uapi/linux/v4l2-controls.h
+++ b/include/uapi/linux/v4l2-controls.h
@@ -803,6 +803,9 @@ enum v4l2_flash_strobe_source {
  #define V4L2_FLASH_FAULT_SHORT_CIRCUIT(1  3)
  #define V4L2_FLASH_FAULT_OVER_CURRENT (1  4)
  #define V4L2_FLASH_FAULT_INDICATOR(1  5)
+#define V4L2_FLASH_FAULT_UVLO  (1  6)
+#define V4L2_FLASH_FAULT_IVFM  (1  7)
+#define V4L2_FLASH_FAULT_NTC_TRIP  (1  8)

I object adding a new fault which is essentially the same as an existing
fault, V4L2_FLASH_FAULT_OVER_TEMPERATURE.


I hope you consider it again.
Usually, when the die temperature exceeds the specific temperature, ie 120 or 
135 and fixed value,
turn off PFET,NFET, current sources and set TEMP Fault bit.
But in the NTC mode, the comparator is working and detect selected temperature 
through Vtrip value.
It protects shutdown the chip due to high voltage and keep the device operation.
Many flash chip support NTC and TEMP Fault both. For example, LM3554, LM3556, 
LM3559
LM3642, LM3646, LM3560, LM3561, LM3565 etc
Two things should be tell apart.



As the practice has been to use human-readable names for the faults, I'd
also suggest using V4L2_FLASH_FAULT_UNDER_VOLTAGE instead of
V4L2_FLASH_FAULT_UVLO.


I agree with you.



What's the IVFM block and what does it do?


IVFM is Input Voltage Flash Monitor.
If the flash chip has IVFM function the flash current can be adjusted based 
upon the voltage level of input.
As ramping flash current, the input voltage goes down and IVFM block adjust 
current to prevent to shudown due to low voltage
and keep the flash operation. So if the input voltage crossed the IVFM 
Threshold level chip set the fault bit.
Many flash chip, for example LM3556, LM3646, LM3642 , support this fucntion.
I think, V4L2_FLASH_FAULT_INPUT_VOLTAGE_MONITOR is better than 
V4L2_FLASH_FAULT_IVFM.




  #define V4L2_CID_FLASH_CHARGE (V4L2_CID_FLASH_CLASS_BASE + 11)
  #define V4L2_CID_FLASH_READY  (V4L2_CID_FLASH_CLASS_BASE + 12)


--
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/


[RFCv2,2/2] i2c: add new dual Flash driver,LM3646

2014-01-27 Thread Daniel Jeong
Add new dual flash driver. 
LM3646 is a dual Flash LED Driver, LED1 and LED2, following the datasheet.
But there is no registers to contorl LED2 brightness.
LED2 brightness can be controlled by limiting max brightness.
LED2 brightness  = Total brightness - LED1 brightness
LED2 will be off if LED2 brightness is set equal to or bigger than Total 
brightness.
And the brightness step is very small, 1.46mA for Torch, 11.71mA for Flash.
If the step is changed to mA, maximum brightness cannot be reachable.

Signed-off-by: Daniel Jeong 
---
 drivers/media/i2c/Kconfig  |9 +
 drivers/media/i2c/Makefile |1 +
 drivers/media/i2c/lm3646.c |  400 
 include/media/lm3646.h |   87 ++
 4 files changed, 497 insertions(+)
 create mode 100644 drivers/media/i2c/lm3646.c
 create mode 100644 include/media/lm3646.h

diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index 842654d..654df46 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -630,6 +630,15 @@ config VIDEO_LM3560
  This is a driver for the lm3560 dual flash controllers. It controls
  flash, torch LEDs.
 
+config VIDEO_LM3646
+   tristate "LM3646 dual flash driver support"
+   depends on I2C && VIDEO_V4L2 && MEDIA_CONTROLLER
+   depends on MEDIA_CAMERA_SUPPORT
+   select REGMAP_I2C
+   ---help---
+ This is a driver for the lm3646 dual flash controllers. It controls
+ flash, torch LEDs.
+
 comment "Video improvement chips"
 
 config VIDEO_UPD64031A
diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
index e03f177..a52cda6 100644
--- a/drivers/media/i2c/Makefile
+++ b/drivers/media/i2c/Makefile
@@ -71,6 +71,7 @@ obj-$(CONFIG_VIDEO_S5C73M3)   += s5c73m3/
 obj-$(CONFIG_VIDEO_ADP1653)+= adp1653.o
 obj-$(CONFIG_VIDEO_AS3645A)+= as3645a.o
 obj-$(CONFIG_VIDEO_LM3560) += lm3560.o
+obj-$(CONFIG_VIDEO_LM3646) += lm3646.o
 obj-$(CONFIG_VIDEO_SMIAPP_PLL) += smiapp-pll.o
 obj-$(CONFIG_VIDEO_AK881X) += ak881x.o
 obj-$(CONFIG_VIDEO_IR_I2C)  += ir-kbd-i2c.o
diff --git a/drivers/media/i2c/lm3646.c b/drivers/media/i2c/lm3646.c
new file mode 100644
index 000..4b025f2
--- /dev/null
+++ b/drivers/media/i2c/lm3646.c
@@ -0,0 +1,400 @@
+/*
+ * drivers/media/i2c/lm3646.c
+ * General device driver for TI lm3646, Dual FLASH LED Driver
+ *
+ * Copyright (C) 2014 Texas Instruments
+ *
+ * Contact: Daniel Jeong 
+ * Ldd-Mlp 
+ *
+ * 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 
+
+/* registers definitions */
+#define REG_ENABLE 0x01
+#define REG_TORCH_BR   0x05
+#define REG_FLASH_BR   0x05
+#define REG_FLASH_TOUT 0x04
+#define REG_FLAG   0x08
+#define REG_STROBE_SRC 0x06
+#define REG_LED1_FLASH_BR 0x06
+#define REG_LED1_TORCH_BR 0x07
+
+#define MASK_ENABLE0x03
+#define MASK_TORCH_BR  0x70
+#define MASK_FLASH_BR  0x0F
+#define MASK_FLASH_TOUT0x07
+#define MASK_FLAG  0xFF
+#define MASK_STROBE_SRC0x80
+
+/* Fault Mask */
+#define FAULT_TIMEOUT  (1<<0)
+#define FAULT_SHORT_CIRCUIT(1<<1)
+#define FAULT_UVLO (1<<2)
+#define FAULT_IVFM (1<<3)
+#define FAULT_OCP  (1<<4)
+#define FAULT_OVERTEMP (1<<5)
+#define FAULT_NTC_TRIP (1<<6)
+#define FAULT_OVP  (1<<7)
+
+enum led_mode {
+   MODE_SHDN = 0x0,
+   MODE_TORCH = 0x2,
+   MODE_FLASH = 0x3,
+};
+
+/*
+ * struct lm3646_flash
+ *
+ * @pdata: platform data
+ * @regmap: reg. map for i2c
+ * @lock: muxtex for serial access.
+ * @led_mode: V4L2 LED mode
+ * @ctrls_led: V4L2 contols
+ * @subdev_led: V4L2 subdev
+ */
+struct lm3646_flash {
+   struct device *dev;
+   struct lm3646_platform_data *pdata;
+   struct regmap *regmap;
+
+   enum v4l2_flash_led_mode led_mode;
+   struct v4l2_ctrl_handler ctrls_led;
+   struct v4l2_subdev subdev_led;
+};
+
+#define to_lm3646_flash(_ctrl) \
+   container_of(_ctrl->handler, struct lm3646_flash, ctrls_led)
+
+/* enable mode control */
+static int lm3646_mode_ctrl(struct lm3646_flash *flash)
+{
+   int rval = -EINVAL;
+
+   switch (flash->led_mode) {
+   case V4L2_FLASH_LED_MODE_NONE:
+   rval = regmap_update_bits(flash->regmap,
+ REG_ENABLE, MASK_ENABLE, MODE_SHDN);
+   break;
+   case V4L2_FLASH_LED_MODE_TORCH:
+   rval = regmap_update_bits(flash->regmap,
+ REG_ENABLE, MASK_ENABLE, MODE_TORCH);
+   break;
+   case V4L2_FLASH_LED_MODE_FLASH:
+   rval = reg

[RFCv2,1/2] v4l2-controls.h: add addtional Flash fault bits

2014-01-27 Thread Daniel Jeong
Add additional FLASH Fault bits to dectect faults from chip.
Some Flash drivers support UVLO, IVFM, NTC Trip faults.
UVLO :  Under Voltage Lock Out Threshold crossed
IVFM :  IVFM block reported and/or adjusted LED current Input Voltage Flash 
Monitor trip threshold
NTC  :  NTC Threshold crossed. Many Flash drivers have a pin and the fault bit 
to 
serves as a threshold detector for negative temperature coefficient (NTC) 
thermistors.

Signed-off-by: Daniel Jeong 
---
 include/uapi/linux/v4l2-controls.h |3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/uapi/linux/v4l2-controls.h 
b/include/uapi/linux/v4l2-controls.h
index 1666aab..01d730c 100644
--- a/include/uapi/linux/v4l2-controls.h
+++ b/include/uapi/linux/v4l2-controls.h
@@ -803,6 +803,9 @@ enum v4l2_flash_strobe_source {
 #define V4L2_FLASH_FAULT_SHORT_CIRCUIT (1 << 3)
 #define V4L2_FLASH_FAULT_OVER_CURRENT  (1 << 4)
 #define V4L2_FLASH_FAULT_INDICATOR (1 << 5)
+#define V4L2_FLASH_FAULT_UVLO  (1 << 6)
+#define V4L2_FLASH_FAULT_IVFM  (1 << 7)
+#define V4L2_FLASH_FAULT_NTC_TRIP  (1 << 8)
 
 #define V4L2_CID_FLASH_CHARGE  (V4L2_CID_FLASH_CLASS_BASE + 11)
 #define V4L2_CID_FLASH_READY   (V4L2_CID_FLASH_CLASS_BASE + 12)
-- 
1.7.9.5

--
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/


[RFCv2,2/2] i2c: add new dual Flash driver,LM3646

2014-01-27 Thread Daniel Jeong
Add new dual flash driver. 
LM3646 is a dual Flash LED Driver, LED1 and LED2, following the datasheet.
But there is no registers to contorl LED2 brightness.
LED2 brightness can be controlled by limiting max brightness.
LED2 brightness  = Total brightness - LED1 brightness
LED2 will be off if LED2 brightness is set equal to or bigger than Total 
brightness.
And the brightness step is very small, 1.46mA for Torch, 11.71mA for Flash.
If the step is changed to mA, maximum brightness cannot be reachable.

Signed-off-by: Daniel Jeong gshark.je...@gmail.com
---
 drivers/media/i2c/Kconfig  |9 +
 drivers/media/i2c/Makefile |1 +
 drivers/media/i2c/lm3646.c |  400 
 include/media/lm3646.h |   87 ++
 4 files changed, 497 insertions(+)
 create mode 100644 drivers/media/i2c/lm3646.c
 create mode 100644 include/media/lm3646.h

diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index 842654d..654df46 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -630,6 +630,15 @@ config VIDEO_LM3560
  This is a driver for the lm3560 dual flash controllers. It controls
  flash, torch LEDs.
 
+config VIDEO_LM3646
+   tristate LM3646 dual flash driver support
+   depends on I2C  VIDEO_V4L2  MEDIA_CONTROLLER
+   depends on MEDIA_CAMERA_SUPPORT
+   select REGMAP_I2C
+   ---help---
+ This is a driver for the lm3646 dual flash controllers. It controls
+ flash, torch LEDs.
+
 comment Video improvement chips
 
 config VIDEO_UPD64031A
diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
index e03f177..a52cda6 100644
--- a/drivers/media/i2c/Makefile
+++ b/drivers/media/i2c/Makefile
@@ -71,6 +71,7 @@ obj-$(CONFIG_VIDEO_S5C73M3)   += s5c73m3/
 obj-$(CONFIG_VIDEO_ADP1653)+= adp1653.o
 obj-$(CONFIG_VIDEO_AS3645A)+= as3645a.o
 obj-$(CONFIG_VIDEO_LM3560) += lm3560.o
+obj-$(CONFIG_VIDEO_LM3646) += lm3646.o
 obj-$(CONFIG_VIDEO_SMIAPP_PLL) += smiapp-pll.o
 obj-$(CONFIG_VIDEO_AK881X) += ak881x.o
 obj-$(CONFIG_VIDEO_IR_I2C)  += ir-kbd-i2c.o
diff --git a/drivers/media/i2c/lm3646.c b/drivers/media/i2c/lm3646.c
new file mode 100644
index 000..4b025f2
--- /dev/null
+++ b/drivers/media/i2c/lm3646.c
@@ -0,0 +1,400 @@
+/*
+ * drivers/media/i2c/lm3646.c
+ * General device driver for TI lm3646, Dual FLASH LED Driver
+ *
+ * Copyright (C) 2014 Texas Instruments
+ *
+ * Contact: Daniel Jeong gshark.je...@gmail.com
+ * Ldd-Mlp ldd-...@list.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/delay.h
+#include linux/module.h
+#include linux/i2c.h
+#include linux/slab.h
+#include linux/regmap.h
+#include linux/videodev2.h
+#include media/lm3646.h
+#include media/v4l2-ctrls.h
+#include media/v4l2-device.h
+
+/* registers definitions */
+#define REG_ENABLE 0x01
+#define REG_TORCH_BR   0x05
+#define REG_FLASH_BR   0x05
+#define REG_FLASH_TOUT 0x04
+#define REG_FLAG   0x08
+#define REG_STROBE_SRC 0x06
+#define REG_LED1_FLASH_BR 0x06
+#define REG_LED1_TORCH_BR 0x07
+
+#define MASK_ENABLE0x03
+#define MASK_TORCH_BR  0x70
+#define MASK_FLASH_BR  0x0F
+#define MASK_FLASH_TOUT0x07
+#define MASK_FLAG  0xFF
+#define MASK_STROBE_SRC0x80
+
+/* Fault Mask */
+#define FAULT_TIMEOUT  (10)
+#define FAULT_SHORT_CIRCUIT(11)
+#define FAULT_UVLO (12)
+#define FAULT_IVFM (13)
+#define FAULT_OCP  (14)
+#define FAULT_OVERTEMP (15)
+#define FAULT_NTC_TRIP (16)
+#define FAULT_OVP  (17)
+
+enum led_mode {
+   MODE_SHDN = 0x0,
+   MODE_TORCH = 0x2,
+   MODE_FLASH = 0x3,
+};
+
+/*
+ * struct lm3646_flash
+ *
+ * @pdata: platform data
+ * @regmap: reg. map for i2c
+ * @lock: muxtex for serial access.
+ * @led_mode: V4L2 LED mode
+ * @ctrls_led: V4L2 contols
+ * @subdev_led: V4L2 subdev
+ */
+struct lm3646_flash {
+   struct device *dev;
+   struct lm3646_platform_data *pdata;
+   struct regmap *regmap;
+
+   enum v4l2_flash_led_mode led_mode;
+   struct v4l2_ctrl_handler ctrls_led;
+   struct v4l2_subdev subdev_led;
+};
+
+#define to_lm3646_flash(_ctrl) \
+   container_of(_ctrl-handler, struct lm3646_flash, ctrls_led)
+
+/* enable mode control */
+static int lm3646_mode_ctrl(struct lm3646_flash *flash)
+{
+   int rval = -EINVAL;
+
+   switch (flash-led_mode) {
+   case V4L2_FLASH_LED_MODE_NONE:
+   rval = regmap_update_bits(flash-regmap,
+ REG_ENABLE, MASK_ENABLE, MODE_SHDN);
+   break;
+   case V4L2_FLASH_LED_MODE_TORCH:
+   rval = regmap_update_bits(flash-regmap,
+ REG_ENABLE, MASK_ENABLE, MODE_TORCH);
+   break

[RFCv2,1/2] v4l2-controls.h: add addtional Flash fault bits

2014-01-27 Thread Daniel Jeong
Add additional FLASH Fault bits to dectect faults from chip.
Some Flash drivers support UVLO, IVFM, NTC Trip faults.
UVLO :  Under Voltage Lock Out Threshold crossed
IVFM :  IVFM block reported and/or adjusted LED current Input Voltage Flash 
Monitor trip threshold
NTC  :  NTC Threshold crossed. Many Flash drivers have a pin and the fault bit 
to 
serves as a threshold detector for negative temperature coefficient (NTC) 
thermistors.

Signed-off-by: Daniel Jeong gshark.je...@gmail.com
---
 include/uapi/linux/v4l2-controls.h |3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/uapi/linux/v4l2-controls.h 
b/include/uapi/linux/v4l2-controls.h
index 1666aab..01d730c 100644
--- a/include/uapi/linux/v4l2-controls.h
+++ b/include/uapi/linux/v4l2-controls.h
@@ -803,6 +803,9 @@ enum v4l2_flash_strobe_source {
 #define V4L2_FLASH_FAULT_SHORT_CIRCUIT (1  3)
 #define V4L2_FLASH_FAULT_OVER_CURRENT  (1  4)
 #define V4L2_FLASH_FAULT_INDICATOR (1  5)
+#define V4L2_FLASH_FAULT_UVLO  (1  6)
+#define V4L2_FLASH_FAULT_IVFM  (1  7)
+#define V4L2_FLASH_FAULT_NTC_TRIP  (1  8)
 
 #define V4L2_CID_FLASH_CHARGE  (V4L2_CID_FLASH_CLASS_BASE + 11)
 #define V4L2_CID_FLASH_READY   (V4L2_CID_FLASH_CLASS_BASE + 12)
-- 
1.7.9.5

--
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/


[PATCH -next] [media] media: i2c: lm3560: fix missing unlock error in lm3560_get_ctrl().

2013-11-13 Thread Daniel Jeong
Add the missing unlock before return from function lm3560_get_ctrl()
to avoid deadlock. Thanks to Dan Carpenter.

Signed-off-by: Daniel Jeong 
---
 drivers/media/i2c/lm3560.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/media/i2c/lm3560.c b/drivers/media/i2c/lm3560.c
index 3317a9a..5d6eef0 100644
--- a/drivers/media/i2c/lm3560.c
+++ b/drivers/media/i2c/lm3560.c
@@ -172,16 +172,16 @@ static int lm3560_flash_brt_ctrl(struct lm3560_flash 
*flash,
 static int lm3560_get_ctrl(struct v4l2_ctrl *ctrl, enum lm3560_led_id led_no)
 {
struct lm3560_flash *flash = to_lm3560_flash(ctrl, led_no);
+   int rval = -EINVAL;
 
mutex_lock(>lock);
 
if (ctrl->id == V4L2_CID_FLASH_FAULT) {
-   int rval;
s32 fault = 0;
unsigned int reg_val;
rval = regmap_read(flash->regmap, REG_FLAG, _val);
if (rval < 0)
-   return rval;
+   goto out;
if (rval & FAULT_SHORT_CIRCUIT)
fault |= V4L2_FLASH_FAULT_SHORT_CIRCUIT;
if (rval & FAULT_OVERTEMP)
@@ -189,11 +189,11 @@ static int lm3560_get_ctrl(struct v4l2_ctrl *ctrl, enum 
lm3560_led_id led_no)
if (rval & FAULT_TIMEOUT)
fault |= V4L2_FLASH_FAULT_TIMEOUT;
ctrl->cur.val = fault;
-   return 0;
}
 
+out:
mutex_unlock(>lock);
-   return -EINVAL;
+   return rval;
 }
 
 static int lm3560_set_ctrl(struct v4l2_ctrl *ctrl, enum lm3560_led_id led_no)
-- 
1.7.9.5

--
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/


[PATCH -next] [media] media: i2c: lm3560: fix missing unlock error in lm3560_get_ctrl().

2013-11-13 Thread Daniel Jeong
Add the missing unlock before return from function lm3560_get_ctrl()
to avoid deadlock. Thanks to Dan Carpenter.

Signed-off-by: Daniel Jeong gshark.je...@gmail.com
---
 drivers/media/i2c/lm3560.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/media/i2c/lm3560.c b/drivers/media/i2c/lm3560.c
index 3317a9a..5d6eef0 100644
--- a/drivers/media/i2c/lm3560.c
+++ b/drivers/media/i2c/lm3560.c
@@ -172,16 +172,16 @@ static int lm3560_flash_brt_ctrl(struct lm3560_flash 
*flash,
 static int lm3560_get_ctrl(struct v4l2_ctrl *ctrl, enum lm3560_led_id led_no)
 {
struct lm3560_flash *flash = to_lm3560_flash(ctrl, led_no);
+   int rval = -EINVAL;
 
mutex_lock(flash-lock);
 
if (ctrl-id == V4L2_CID_FLASH_FAULT) {
-   int rval;
s32 fault = 0;
unsigned int reg_val;
rval = regmap_read(flash-regmap, REG_FLAG, reg_val);
if (rval  0)
-   return rval;
+   goto out;
if (rval  FAULT_SHORT_CIRCUIT)
fault |= V4L2_FLASH_FAULT_SHORT_CIRCUIT;
if (rval  FAULT_OVERTEMP)
@@ -189,11 +189,11 @@ static int lm3560_get_ctrl(struct v4l2_ctrl *ctrl, enum 
lm3560_led_id led_no)
if (rval  FAULT_TIMEOUT)
fault |= V4L2_FLASH_FAULT_TIMEOUT;
ctrl-cur.val = fault;
-   return 0;
}
 
+out:
mutex_unlock(flash-lock);
-   return -EINVAL;
+   return rval;
 }
 
 static int lm3560_set_ctrl(struct v4l2_ctrl *ctrl, enum lm3560_led_id led_no)
-- 
1.7.9.5

--
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/


[PATCH V2] media: i2c: add driver for dual LED Flash, lm3560.

2013-10-16 Thread Daniel Jeong
 Patch v2 deletes unnecessary codes.
 This patch adds the driver for the LM3560, dual LED Flash The
 LM3560 has two 1A constant current driver for high current
 white LEDs. It is controlled via an I2C compatible
 interface(up to 400kHz). Each flash brightness, torch
 brightness and enable/disable can be controlled
 independantly. But flash timeout and operation mode are shared.

Signed-off-by: Daniel Jeong 
---
 drivers/media/i2c/Kconfig  |9 +
 drivers/media/i2c/Makefile |1 +
 drivers/media/i2c/lm3560.c |  488 
 include/media/lm3560.h |   97 +
 4 files changed, 595 insertions(+)
 create mode 100644 drivers/media/i2c/lm3560.c
 create mode 100644 include/media/lm3560.h

diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index d18be19..75c8a03 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -621,6 +621,15 @@ config VIDEO_AS3645A
  This is a driver for the AS3645A and LM3555 flash controllers. It has
  build in control for flash, torch and indicator LEDs.
 
+config VIDEO_LM3560
+   tristate "LM3560 dual flash driver support"
+   depends on I2C && VIDEO_V4L2 && MEDIA_CONTROLLER
+   depends on MEDIA_CAMERA_SUPPORT
+   select REGMAP_I2C
+   ---help---
+ This is a driver for the lm3560 dual flash controllers. It controls
+ flash, torch LEDs.
+
 comment "Video improvement chips"
 
 config VIDEO_UPD64031A
diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
index 9f462df..e03f177 100644
--- a/drivers/media/i2c/Makefile
+++ b/drivers/media/i2c/Makefile
@@ -70,6 +70,7 @@ obj-$(CONFIG_VIDEO_S5K4ECGX)  += s5k4ecgx.o
 obj-$(CONFIG_VIDEO_S5C73M3)+= s5c73m3/
 obj-$(CONFIG_VIDEO_ADP1653)+= adp1653.o
 obj-$(CONFIG_VIDEO_AS3645A)+= as3645a.o
+obj-$(CONFIG_VIDEO_LM3560) += lm3560.o
 obj-$(CONFIG_VIDEO_SMIAPP_PLL) += smiapp-pll.o
 obj-$(CONFIG_VIDEO_AK881X) += ak881x.o
 obj-$(CONFIG_VIDEO_IR_I2C)  += ir-kbd-i2c.o
diff --git a/drivers/media/i2c/lm3560.c b/drivers/media/i2c/lm3560.c
new file mode 100644
index 000..3317a9a
--- /dev/null
+++ b/drivers/media/i2c/lm3560.c
@@ -0,0 +1,488 @@
+/*
+ * drivers/media/i2c/lm3560.c
+ * General device driver for TI lm3560, FLASH LED Driver
+ *
+ * Copyright (C) 2013 Texas Instruments
+ *
+ * Contact: Daniel Jeong 
+ * Ldd-Mlp 
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* registers definitions */
+#define REG_ENABLE 0x10
+#define REG_TORCH_BR   0xa0
+#define REG_FLASH_BR   0xb0
+#define REG_FLASH_TOUT 0xc0
+#define REG_FLAG   0xd0
+#define REG_CONFIG10xe0
+
+/* Fault Mask */
+#define FAULT_TIMEOUT  (1<<0)
+#define FAULT_OVERTEMP (1<<1)
+#define FAULT_SHORT_CIRCUIT(1<<2)
+
+enum led_enable {
+   MODE_SHDN = 0x0,
+   MODE_TORCH = 0x2,
+   MODE_FLASH = 0x3,
+};
+
+/* struct lm3560_flash
+ *
+ * @pdata: platform data
+ * @regmap: reg. map for i2c
+ * @lock: muxtex for serial access.
+ * @led_mode: V4L2 LED mode
+ * @ctrls_led: V4L2 contols
+ * @subdev_led: V4L2 subdev
+ */
+struct lm3560_flash {
+   struct device *dev;
+   struct lm3560_platform_data *pdata;
+   struct regmap *regmap;
+   struct mutex lock;
+
+   enum v4l2_flash_led_mode led_mode;
+   struct v4l2_ctrl_handler ctrls_led[LM3560_LED_MAX];
+   struct v4l2_subdev subdev_led[LM3560_LED_MAX];
+};
+
+#define to_lm3560_flash(_ctrl, _no)\
+   container_of(_ctrl->handler, struct lm3560_flash, ctrls_led[_no])
+
+/* enable mode control */
+static int lm3560_mode_ctrl(struct lm3560_flash *flash)
+{
+   int rval = -EINVAL;
+
+   switch (flash->led_mode) {
+   case V4L2_FLASH_LED_MODE_NONE:
+   rval = regmap_update_bits(flash->regmap,
+ REG_ENABLE, 0x03, MODE_SHDN);
+   break;
+   case V4L2_FLASH_LED_MODE_TORCH:
+   rval = regmap_update_bits(flash->regmap,
+ REG_ENABLE, 0x03, MODE_TORCH);
+   break;
+   case V4L2_FLASH_LED_MODE_FLASH:
+   rval = regmap_update_bits(flash-&

[PATCH V2] media: i2c: add driver for dual LED Flash, lm3560.

2013-10-16 Thread Daniel Jeong
 Patch v2 deletes unnecessary codes.
 This patch adds the driver for the LM3560, dual LED Flash The
 LM3560 has two 1A constant current driver for high current
 white LEDs. It is controlled via an I2C compatible
 interface(up to 400kHz). Each flash brightness, torch
 brightness and enable/disable can be controlled
 independantly. But flash timeout and operation mode are shared.

Signed-off-by: Daniel Jeong gshark.je...@gmail.com
---
 drivers/media/i2c/Kconfig  |9 +
 drivers/media/i2c/Makefile |1 +
 drivers/media/i2c/lm3560.c |  488 
 include/media/lm3560.h |   97 +
 4 files changed, 595 insertions(+)
 create mode 100644 drivers/media/i2c/lm3560.c
 create mode 100644 include/media/lm3560.h

diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index d18be19..75c8a03 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -621,6 +621,15 @@ config VIDEO_AS3645A
  This is a driver for the AS3645A and LM3555 flash controllers. It has
  build in control for flash, torch and indicator LEDs.
 
+config VIDEO_LM3560
+   tristate LM3560 dual flash driver support
+   depends on I2C  VIDEO_V4L2  MEDIA_CONTROLLER
+   depends on MEDIA_CAMERA_SUPPORT
+   select REGMAP_I2C
+   ---help---
+ This is a driver for the lm3560 dual flash controllers. It controls
+ flash, torch LEDs.
+
 comment Video improvement chips
 
 config VIDEO_UPD64031A
diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
index 9f462df..e03f177 100644
--- a/drivers/media/i2c/Makefile
+++ b/drivers/media/i2c/Makefile
@@ -70,6 +70,7 @@ obj-$(CONFIG_VIDEO_S5K4ECGX)  += s5k4ecgx.o
 obj-$(CONFIG_VIDEO_S5C73M3)+= s5c73m3/
 obj-$(CONFIG_VIDEO_ADP1653)+= adp1653.o
 obj-$(CONFIG_VIDEO_AS3645A)+= as3645a.o
+obj-$(CONFIG_VIDEO_LM3560) += lm3560.o
 obj-$(CONFIG_VIDEO_SMIAPP_PLL) += smiapp-pll.o
 obj-$(CONFIG_VIDEO_AK881X) += ak881x.o
 obj-$(CONFIG_VIDEO_IR_I2C)  += ir-kbd-i2c.o
diff --git a/drivers/media/i2c/lm3560.c b/drivers/media/i2c/lm3560.c
new file mode 100644
index 000..3317a9a
--- /dev/null
+++ b/drivers/media/i2c/lm3560.c
@@ -0,0 +1,488 @@
+/*
+ * drivers/media/i2c/lm3560.c
+ * General device driver for TI lm3560, FLASH LED Driver
+ *
+ * Copyright (C) 2013 Texas Instruments
+ *
+ * Contact: Daniel Jeong gshark.je...@gmail.com
+ * Ldd-Mlp ldd-...@list.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.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include linux/delay.h
+#include linux/module.h
+#include linux/i2c.h
+#include linux/slab.h
+#include linux/mutex.h
+#include linux/regmap.h
+#include linux/videodev2.h
+#include media/lm3560.h
+#include media/v4l2-ctrls.h
+#include media/v4l2-device.h
+
+/* registers definitions */
+#define REG_ENABLE 0x10
+#define REG_TORCH_BR   0xa0
+#define REG_FLASH_BR   0xb0
+#define REG_FLASH_TOUT 0xc0
+#define REG_FLAG   0xd0
+#define REG_CONFIG10xe0
+
+/* Fault Mask */
+#define FAULT_TIMEOUT  (10)
+#define FAULT_OVERTEMP (11)
+#define FAULT_SHORT_CIRCUIT(12)
+
+enum led_enable {
+   MODE_SHDN = 0x0,
+   MODE_TORCH = 0x2,
+   MODE_FLASH = 0x3,
+};
+
+/* struct lm3560_flash
+ *
+ * @pdata: platform data
+ * @regmap: reg. map for i2c
+ * @lock: muxtex for serial access.
+ * @led_mode: V4L2 LED mode
+ * @ctrls_led: V4L2 contols
+ * @subdev_led: V4L2 subdev
+ */
+struct lm3560_flash {
+   struct device *dev;
+   struct lm3560_platform_data *pdata;
+   struct regmap *regmap;
+   struct mutex lock;
+
+   enum v4l2_flash_led_mode led_mode;
+   struct v4l2_ctrl_handler ctrls_led[LM3560_LED_MAX];
+   struct v4l2_subdev subdev_led[LM3560_LED_MAX];
+};
+
+#define to_lm3560_flash(_ctrl, _no)\
+   container_of(_ctrl-handler, struct lm3560_flash, ctrls_led[_no])
+
+/* enable mode control */
+static int lm3560_mode_ctrl(struct lm3560_flash *flash)
+{
+   int rval = -EINVAL;
+
+   switch (flash-led_mode) {
+   case V4L2_FLASH_LED_MODE_NONE:
+   rval = regmap_update_bits(flash-regmap,
+ REG_ENABLE, 0x03, MODE_SHDN);
+   break;
+   case V4L2_FLASH_LED_MODE_TORCH:
+   rval = regmap_update_bits(flash-regmap,
+ REG_ENABLE, 0x03, MODE_TORCH

[PATCH] backlight: lm3630: fix sparse warning.

2013-10-02 Thread Daniel Jeong
This patch is to fix sparse warning due to mixing different enum type.

Signed-off-by: Daniel Jeong 
---
 drivers/video/backlight/lm3630a_bl.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/video/backlight/lm3630a_bl.c 
b/drivers/video/backlight/lm3630a_bl.c
index cf40cc8..1a76235 100644
--- a/drivers/video/backlight/lm3630a_bl.c
+++ b/drivers/video/backlight/lm3630a_bl.c
@@ -90,8 +90,8 @@ static int lm3630a_chip_init(struct lm3630a_chip *pchip)
/* set current B */
rval |= lm3630a_write(pchip, REG_I_B, 0x1F);
/* set control */
-   rval |=
-   lm3630a_write(pchip, REG_CTRL, pdata->leda_ctrl | pdata->ledb_ctrl);
+   rval |= lm3630a_update(pchip, REG_CTRL, 0x14, pdata->leda_ctrl);
+   rval |= lm3630a_update(pchip, REG_CTRL, 0x0B, pdata->ledb_ctrl);
usleep_range(1000, 2000);
/* set brightness A and B */
rval |= lm3630a_write(pchip, REG_BRT_A, pdata->leda_init_brt);
-- 
1.7.9.5

--
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/


[PATCH] backlight: lm3630: fix sparse warning.

2013-10-02 Thread Daniel Jeong
This patch is to fix sparse warning due to mixing different enum type.

Signed-off-by: Daniel Jeong gshark.je...@gmail.com
---
 drivers/video/backlight/lm3630a_bl.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/video/backlight/lm3630a_bl.c 
b/drivers/video/backlight/lm3630a_bl.c
index cf40cc8..1a76235 100644
--- a/drivers/video/backlight/lm3630a_bl.c
+++ b/drivers/video/backlight/lm3630a_bl.c
@@ -90,8 +90,8 @@ static int lm3630a_chip_init(struct lm3630a_chip *pchip)
/* set current B */
rval |= lm3630a_write(pchip, REG_I_B, 0x1F);
/* set control */
-   rval |=
-   lm3630a_write(pchip, REG_CTRL, pdata-leda_ctrl | pdata-ledb_ctrl);
+   rval |= lm3630a_update(pchip, REG_CTRL, 0x14, pdata-leda_ctrl);
+   rval |= lm3630a_update(pchip, REG_CTRL, 0x0B, pdata-ledb_ctrl);
usleep_range(1000, 2000);
/* set brightness A and B */
rval |= lm3630a_write(pchip, REG_BRT_A, pdata-leda_init_brt);
-- 
1.7.9.5

--
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/


[PATCH] media: i2c: add driver for dual LED Flash, lm3560.

2013-09-11 Thread Daniel Jeong
 This patch includes the driver for the LM3560, dual LED Flash.
 The LM3560 has two 1A constant current drivers for high current
 white LEDs. It is controlled via an I2C compatible interface(up to 400kHz).
 And each flash, torch brightness and enable/disable LED can be controlled
 independantly. But flash timeout and operation mode are shared.

Signed-off-by: Daniel Jeong 
---
 drivers/media/i2c/Kconfig  |9 +
 drivers/media/i2c/Makefile |1 +
 drivers/media/i2c/lm3560.c |  716 
 include/media/lm3560.h |  103 +++
 4 files changed, 829 insertions(+)
 create mode 100644 drivers/media/i2c/lm3560.c
 create mode 100644 include/media/lm3560.h

diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index d18be19..75c8a03 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -621,6 +621,15 @@ config VIDEO_AS3645A
  This is a driver for the AS3645A and LM3555 flash controllers. It has
  build in control for flash, torch and indicator LEDs.
 
+config VIDEO_LM3560
+   tristate "LM3560 dual flash driver support"
+   depends on I2C && VIDEO_V4L2 && MEDIA_CONTROLLER
+   depends on MEDIA_CAMERA_SUPPORT
+   select REGMAP_I2C
+   ---help---
+ This is a driver for the lm3560 dual flash controllers. It controls
+ flash, torch LEDs.
+
 comment "Video improvement chips"
 
 config VIDEO_UPD64031A
diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
index 9f462df..e03f177 100644
--- a/drivers/media/i2c/Makefile
+++ b/drivers/media/i2c/Makefile
@@ -70,6 +70,7 @@ obj-$(CONFIG_VIDEO_S5K4ECGX)  += s5k4ecgx.o
 obj-$(CONFIG_VIDEO_S5C73M3)+= s5c73m3/
 obj-$(CONFIG_VIDEO_ADP1653)+= adp1653.o
 obj-$(CONFIG_VIDEO_AS3645A)+= as3645a.o
+obj-$(CONFIG_VIDEO_LM3560) += lm3560.o
 obj-$(CONFIG_VIDEO_SMIAPP_PLL) += smiapp-pll.o
 obj-$(CONFIG_VIDEO_AK881X) += ak881x.o
 obj-$(CONFIG_VIDEO_IR_I2C)  += ir-kbd-i2c.o
diff --git a/drivers/media/i2c/lm3560.c b/drivers/media/i2c/lm3560.c
new file mode 100644
index 000..7721e2e
--- /dev/null
+++ b/drivers/media/i2c/lm3560.c
@@ -0,0 +1,716 @@
+/*
+ * drivers/media/i2c/lm3560.c
+ * General device driver for TI LM3560, Dual FLASH LED Driver
+ *
+ * Copyright (C) 2013 Texas Instruments
+ *
+ * Contact: Daniel Jeong 
+ *  LDD-MLP 
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* registers definitions */
+#define REG_ENABLE 0x10
+#define REG_TORCH_BR   0xA0
+#define REG_FLASH_BR   0xB0
+#define REG_FLASH_TOUT 0xC0
+#define REG_FLAG   0xD0
+#define REG_CONFIG10xE0
+
+/* LED1 */
+#define LED1_ENABLE 0x08
+#define LED1_ENABLE_MASK 0x08
+#define FLASH1_BR_DATA(_br) (_br<<0)
+#define FLASH1_BR_MASK 0x0F
+#define TORCH1_BR_DATA(_br) (_br<<0)
+#define TORCH1_BR_MASK 0x07
+
+/* LED2 */
+#define LED2_ENABLE 0x10
+#define LED2_ENABLE_MASK 0x10
+#define FLASH2_BR_DATA(_br) (_br<<4)
+#define FLASH2_BR_MASK 0xF0
+#define TORCH2_BR_DATA(_br) (_br<<3)
+#define TORCH2_BR_MASK 0x38
+
+/* Configuration */
+#define ENABLE_MODE_MASK 0x03
+#define FLASH_TOUT_MASK 0x1F
+#define STROBE_EN_MASK 0x04
+#define STROBE_EN_DATA(_config) (_config<<2)
+#define PEAK_I_MASK 0x60
+
+/* Fault Mask */
+#define FAULT_TIMEOUT (1<<0)
+#define FAULT_OVERTEMP (1<<1)
+#define FAULT_SHORT_CIRCUIT (1<<2)
+
+#define to_lm3560_led_flash(sd, _id)\
+   container_of(sd, struct lm3560_flash, subdev_led##_id)
+
+enum led_enable {
+   MODE_SHDN = 0x0,
+   MODE_TORCH = 0x2,
+   MODE_FLASH = 0x3,
+};
+
+/* struct lm3560_flash
+ *
+ * @pdata: platform data
+ * @regmap: reg. map for i2c
+ * @power_lock: Protects power_count
+ * @power_count: Power reference count
+ * @led_mode: V4L2 LED mode
+ * @fault: falut data
+ * @ctrls_led#: V4L2 contols
+ * @subdev_led#: V4L2 subdev
+ */
+struct lm3560_flash {
+   struct lm3560_platform_data *pdata;
+   struct regmap *regmap;
+   struct mutex power_lock;
+   int power_count;
+
+   enum v4l2_flash_led_mode led_mode;
+   u8 fault;
+   /* LED1 */
+   struct v4l2_ctrl_handler ctrls_led1;
+   struct v4l2_subdev subdev_led1;
+   /* LED2 */

[PATCH] media: i2c: add driver for dual LED Flash, lm3560.

2013-09-11 Thread Daniel Jeong
 This patch includes the driver for the LM3560, dual LED Flash.
 The LM3560 has two 1A constant current drivers for high current
 white LEDs. It is controlled via an I2C compatible interface(up to 400kHz).
 And each flash, torch brightness and enable/disable LED can be controlled
 independantly. But flash timeout and operation mode are shared.

Signed-off-by: Daniel Jeong gshark.je...@gmail.com
---
 drivers/media/i2c/Kconfig  |9 +
 drivers/media/i2c/Makefile |1 +
 drivers/media/i2c/lm3560.c |  716 
 include/media/lm3560.h |  103 +++
 4 files changed, 829 insertions(+)
 create mode 100644 drivers/media/i2c/lm3560.c
 create mode 100644 include/media/lm3560.h

diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index d18be19..75c8a03 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -621,6 +621,15 @@ config VIDEO_AS3645A
  This is a driver for the AS3645A and LM3555 flash controllers. It has
  build in control for flash, torch and indicator LEDs.
 
+config VIDEO_LM3560
+   tristate LM3560 dual flash driver support
+   depends on I2C  VIDEO_V4L2  MEDIA_CONTROLLER
+   depends on MEDIA_CAMERA_SUPPORT
+   select REGMAP_I2C
+   ---help---
+ This is a driver for the lm3560 dual flash controllers. It controls
+ flash, torch LEDs.
+
 comment Video improvement chips
 
 config VIDEO_UPD64031A
diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
index 9f462df..e03f177 100644
--- a/drivers/media/i2c/Makefile
+++ b/drivers/media/i2c/Makefile
@@ -70,6 +70,7 @@ obj-$(CONFIG_VIDEO_S5K4ECGX)  += s5k4ecgx.o
 obj-$(CONFIG_VIDEO_S5C73M3)+= s5c73m3/
 obj-$(CONFIG_VIDEO_ADP1653)+= adp1653.o
 obj-$(CONFIG_VIDEO_AS3645A)+= as3645a.o
+obj-$(CONFIG_VIDEO_LM3560) += lm3560.o
 obj-$(CONFIG_VIDEO_SMIAPP_PLL) += smiapp-pll.o
 obj-$(CONFIG_VIDEO_AK881X) += ak881x.o
 obj-$(CONFIG_VIDEO_IR_I2C)  += ir-kbd-i2c.o
diff --git a/drivers/media/i2c/lm3560.c b/drivers/media/i2c/lm3560.c
new file mode 100644
index 000..7721e2e
--- /dev/null
+++ b/drivers/media/i2c/lm3560.c
@@ -0,0 +1,716 @@
+/*
+ * drivers/media/i2c/lm3560.c
+ * General device driver for TI LM3560, Dual FLASH LED Driver
+ *
+ * Copyright (C) 2013 Texas Instruments
+ *
+ * Contact: Daniel Jeong gshark.je...@gmail.com
+ *  LDD-MLP ldd-...@list.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.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include linux/delay.h
+#include linux/module.h
+#include linux/i2c.h
+#include linux/slab.h
+#include linux/mutex.h
+#include linux/regmap.h
+#include media/lm3560.h
+#include linux/videodev2.h
+#include media/v4l2-ctrls.h
+#include media/v4l2-device.h
+
+/* registers definitions */
+#define REG_ENABLE 0x10
+#define REG_TORCH_BR   0xA0
+#define REG_FLASH_BR   0xB0
+#define REG_FLASH_TOUT 0xC0
+#define REG_FLAG   0xD0
+#define REG_CONFIG10xE0
+
+/* LED1 */
+#define LED1_ENABLE 0x08
+#define LED1_ENABLE_MASK 0x08
+#define FLASH1_BR_DATA(_br) (_br0)
+#define FLASH1_BR_MASK 0x0F
+#define TORCH1_BR_DATA(_br) (_br0)
+#define TORCH1_BR_MASK 0x07
+
+/* LED2 */
+#define LED2_ENABLE 0x10
+#define LED2_ENABLE_MASK 0x10
+#define FLASH2_BR_DATA(_br) (_br4)
+#define FLASH2_BR_MASK 0xF0
+#define TORCH2_BR_DATA(_br) (_br3)
+#define TORCH2_BR_MASK 0x38
+
+/* Configuration */
+#define ENABLE_MODE_MASK 0x03
+#define FLASH_TOUT_MASK 0x1F
+#define STROBE_EN_MASK 0x04
+#define STROBE_EN_DATA(_config) (_config2)
+#define PEAK_I_MASK 0x60
+
+/* Fault Mask */
+#define FAULT_TIMEOUT (10)
+#define FAULT_OVERTEMP (11)
+#define FAULT_SHORT_CIRCUIT (12)
+
+#define to_lm3560_led_flash(sd, _id)\
+   container_of(sd, struct lm3560_flash, subdev_led##_id)
+
+enum led_enable {
+   MODE_SHDN = 0x0,
+   MODE_TORCH = 0x2,
+   MODE_FLASH = 0x3,
+};
+
+/* struct lm3560_flash
+ *
+ * @pdata: platform data
+ * @regmap: reg. map for i2c
+ * @power_lock: Protects power_count
+ * @power_count: Power reference count
+ * @led_mode: V4L2 LED mode
+ * @fault: falut data
+ * @ctrls_led#: V4L2 contols
+ * @subdev_led#: V4L2 subdev
+ */
+struct lm3560_flash {
+   struct lm3560_platform_data *pdata;
+   struct regmap *regmap;
+   struct mutex power_lock;
+   int power_count;
+
+   enum v4l2_flash_led_mode led_mode;
+   u8 fault;
+   /* LED1

[PATCH 2/2] Add new FLASH driver for lm3565 chip

2013-08-19 Thread Daniel Jeong
This driver is a general version for LM3565 Flash Driver chip of TI.

LM3565 :
The LM3565 is a 4MHz fixed-frequency, current mode synchronous boost
converter designed to drive two series flash LEDs at 930mA
The LM3565 is controlled via an I2C-compatible interface.
You can find more info at
http://www.ti.com/sitesearch/docs/universalsearch.tsp?searchTerm=lm3565=1

Signed-off-by: Daniel Jeong 
---
 drivers/media/i2c/Kconfig  |9 +
 drivers/media/i2c/Makefile |1 +
 drivers/media/i2c/lm3565.c |  602 
 include/media/lm3565.h |   81 ++
 4 files changed, 693 insertions(+)
 create mode 100644 drivers/media/i2c/lm3565.c
 create mode 100644 include/media/lm3565.h

diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index b2cd8ca..0284d77 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -598,6 +598,15 @@ config VIDEO_AS3645A
  This is a driver for the AS3645A and LM3555 flash controllers. It has
  build in control for flash, torch and indicator LEDs.
 
+config VIDEO_LM3565
+   tristate "LM3565 flash driver support"
+   depends on I2C && VIDEO_V4L2 && MEDIA_CONTROLLER
+   depends on MEDIA_CAMERA_SUPPORT
+   select REGMAP_I2C
+   ---help---
+ This is a driver for the LM3565 flash controller.
+ It is 4MHz, High Current Flash LED Driver.
+
 comment "Video improvement chips"
 
 config VIDEO_UPD64031A
diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
index dc20653..d6141f7 100644
--- a/drivers/media/i2c/Makefile
+++ b/drivers/media/i2c/Makefile
@@ -68,6 +68,7 @@ obj-$(CONFIG_VIDEO_S5K4ECGX)  += s5k4ecgx.o
 obj-$(CONFIG_VIDEO_S5C73M3)+= s5c73m3/
 obj-$(CONFIG_VIDEO_ADP1653)+= adp1653.o
 obj-$(CONFIG_VIDEO_AS3645A)+= as3645a.o
+obj-$(CONFIG_VIDEO_LM3565) += lm3565.o
 obj-$(CONFIG_VIDEO_SMIAPP_PLL) += smiapp-pll.o
 obj-$(CONFIG_VIDEO_AK881X) += ak881x.o
 obj-$(CONFIG_VIDEO_IR_I2C)  += ir-kbd-i2c.o
diff --git a/drivers/media/i2c/lm3565.c b/drivers/media/i2c/lm3565.c
new file mode 100644
index 000..78ac76d
--- /dev/null
+++ b/drivers/media/i2c/lm3565.c
@@ -0,0 +1,602 @@
+/*
+ * drivers/media/i2c/lm3565.c
+ * General device driver for TI lm3565, FLASH LED Driver
+ *
+ * Copyright (C) 2013 Texas Instruments
+ *
+ * Contact: Daniel Jeong 
+ *  LDD-MLP 
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* definitions for registers */
+#define REG_I_SET  0x02
+#define MASK_FLASH_I   0x0F
+#define BITS_FLASH_I(x) ((x)<<0)
+#define MASK_ASSIST_I  0x10
+#define BITS_ASSIST_I(x) ((x)<<4)
+
+#define REG_TX_MASK 0x03
+#define REG_LVC 0x04
+#define REG_TCTRL 0x05
+#define BITS_FLASH_TOUT(x) ((x)<<0)
+
+#define REG_STROBE 0x6
+#define MASK_STROBE_ENABLE 0x80
+#define BITS_STROBE_ENABLE(x)  ((x)<<7)
+
+#define REG_OUTMODE0x07
+#define MASK_OUTENABLE 0x08
+#define BITS_OUTENABLE(x)  ((x)<<3)
+#define MASK_OUTMODE   0x03
+#define BITS_OUTMODE(x)((x)<<0)
+enum lm3565_outmode {
+   OUTMODE_EXT_TORCH = 0,
+   OUTMODE_NONE,
+   OUTMODE_ASSIST,
+   OUTMODE_FLASH,
+};
+
+#define REG_FAULT 0x08
+#define FAULT_UVLO (1<<0)
+#define FAULT_INPUT_LOW (1<<1)
+#define FAULT_TX_EVENT (1<<3)
+#define FAULT_TIMEOUT (1<<4)
+#define FAULT_OVERTEMP (1<<5)
+#define FAULT_SHORT_CIRCUIT (1<<6)
+#define FAULT_OVP (1<<7)
+
+#define REG_ADC0x09
+#define REG_IVADC  0x0A
+#define REG_LVADC  0x0B
+#define REG_MAX0xFF
+
+#define to_lm3565_flash(sd)container_of(sd, struct lm3565_flash, subdev)
+
+/* struct lm3565_flash
+ *
+ * @subdev: V4L2 subdev
+ * @pdata: platform data
+ * @ctrls: contols
+ * @flash_timeout: flash timeout
+ * @flash_intensity: flash current
+ * @asist_intensity: assist current
+ * @led_mode: V4L2 LED mode
+ * @strobe: strobe source
+ * @regmap: reg. map for i2c
+ * @power_lock: Protects power_count
+ * @fault: falut data
+ * @power_count: Power reference count
+ */
+struct lm3565_flash {
+   struct v4l2_subdev subdev;
+   struct v4l2_ctrl_handler ctrls;
+   struct lm3565_

[PATCH 2/2] Add new FLASH driver for lm3565 chip

2013-08-19 Thread Daniel Jeong
This driver is a general version for LM3565 Flash Driver chip of TI.

LM3565 :
The LM3565 is a 4MHz fixed-frequency, current mode synchronous boost
converter designed to drive two series flash LEDs at 930mA
The LM3565 is controlled via an I2C-compatible interface.
You can find more info at
http://www.ti.com/sitesearch/docs/universalsearch.tsp?searchTerm=lm3565linkId=1

Signed-off-by: Daniel Jeong gshark.je...@gmail.com
---
 drivers/media/i2c/Kconfig  |9 +
 drivers/media/i2c/Makefile |1 +
 drivers/media/i2c/lm3565.c |  602 
 include/media/lm3565.h |   81 ++
 4 files changed, 693 insertions(+)
 create mode 100644 drivers/media/i2c/lm3565.c
 create mode 100644 include/media/lm3565.h

diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index b2cd8ca..0284d77 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -598,6 +598,15 @@ config VIDEO_AS3645A
  This is a driver for the AS3645A and LM3555 flash controllers. It has
  build in control for flash, torch and indicator LEDs.
 
+config VIDEO_LM3565
+   tristate LM3565 flash driver support
+   depends on I2C  VIDEO_V4L2  MEDIA_CONTROLLER
+   depends on MEDIA_CAMERA_SUPPORT
+   select REGMAP_I2C
+   ---help---
+ This is a driver for the LM3565 flash controller.
+ It is 4MHz, High Current Flash LED Driver.
+
 comment Video improvement chips
 
 config VIDEO_UPD64031A
diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
index dc20653..d6141f7 100644
--- a/drivers/media/i2c/Makefile
+++ b/drivers/media/i2c/Makefile
@@ -68,6 +68,7 @@ obj-$(CONFIG_VIDEO_S5K4ECGX)  += s5k4ecgx.o
 obj-$(CONFIG_VIDEO_S5C73M3)+= s5c73m3/
 obj-$(CONFIG_VIDEO_ADP1653)+= adp1653.o
 obj-$(CONFIG_VIDEO_AS3645A)+= as3645a.o
+obj-$(CONFIG_VIDEO_LM3565) += lm3565.o
 obj-$(CONFIG_VIDEO_SMIAPP_PLL) += smiapp-pll.o
 obj-$(CONFIG_VIDEO_AK881X) += ak881x.o
 obj-$(CONFIG_VIDEO_IR_I2C)  += ir-kbd-i2c.o
diff --git a/drivers/media/i2c/lm3565.c b/drivers/media/i2c/lm3565.c
new file mode 100644
index 000..78ac76d
--- /dev/null
+++ b/drivers/media/i2c/lm3565.c
@@ -0,0 +1,602 @@
+/*
+ * drivers/media/i2c/lm3565.c
+ * General device driver for TI lm3565, FLASH LED Driver
+ *
+ * Copyright (C) 2013 Texas Instruments
+ *
+ * Contact: Daniel Jeong gshark.je...@gmail.com
+ *  LDD-MLP ldd-...@list.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.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include linux/delay.h
+#include linux/module.h
+#include linux/i2c.h
+#include linux/slab.h
+#include linux/regmap.h
+#include media/lm3565.h
+#include media/v4l2-device.h
+
+/* definitions for registers */
+#define REG_I_SET  0x02
+#define MASK_FLASH_I   0x0F
+#define BITS_FLASH_I(x) ((x)0)
+#define MASK_ASSIST_I  0x10
+#define BITS_ASSIST_I(x) ((x)4)
+
+#define REG_TX_MASK 0x03
+#define REG_LVC 0x04
+#define REG_TCTRL 0x05
+#define BITS_FLASH_TOUT(x) ((x)0)
+
+#define REG_STROBE 0x6
+#define MASK_STROBE_ENABLE 0x80
+#define BITS_STROBE_ENABLE(x)  ((x)7)
+
+#define REG_OUTMODE0x07
+#define MASK_OUTENABLE 0x08
+#define BITS_OUTENABLE(x)  ((x)3)
+#define MASK_OUTMODE   0x03
+#define BITS_OUTMODE(x)((x)0)
+enum lm3565_outmode {
+   OUTMODE_EXT_TORCH = 0,
+   OUTMODE_NONE,
+   OUTMODE_ASSIST,
+   OUTMODE_FLASH,
+};
+
+#define REG_FAULT 0x08
+#define FAULT_UVLO (10)
+#define FAULT_INPUT_LOW (11)
+#define FAULT_TX_EVENT (13)
+#define FAULT_TIMEOUT (14)
+#define FAULT_OVERTEMP (15)
+#define FAULT_SHORT_CIRCUIT (16)
+#define FAULT_OVP (17)
+
+#define REG_ADC0x09
+#define REG_IVADC  0x0A
+#define REG_LVADC  0x0B
+#define REG_MAX0xFF
+
+#define to_lm3565_flash(sd)container_of(sd, struct lm3565_flash, subdev)
+
+/* struct lm3565_flash
+ *
+ * @subdev: V4L2 subdev
+ * @pdata: platform data
+ * @ctrls: contols
+ * @flash_timeout: flash timeout
+ * @flash_intensity: flash current
+ * @asist_intensity: assist current
+ * @led_mode: V4L2 LED mode
+ * @strobe: strobe source
+ * @regmap: reg. map for i2c
+ * @power_lock: Protects power_count
+ * @fault: falut data
+ * @power_count: Power reference count
+ */
+struct lm3565_flash {
+   struct v4l2_subdev subdev;
+   struct v4l2_ctrl_handler ctrls

[PATCH v3] backlight: lm3630: apply chip revision

2013-08-06 Thread Daniel Jeong
The LM3630 chip was revised by TI and chip name was also changed to LM3630A.
And register map, default values and initial sequences are changed.
The files, lm3630_bl.{c,h} are replaced by lm3630a_bl.{c,h}
You can find more information about LM3630A(datasheet, evm etc) 
at http://www.ti.com/product/lm3630a

Signed-off-by: Daniel Jeong 
---
 drivers/video/backlight/Kconfig  |6 +-
 drivers/video/backlight/Makefile |2 +-
 drivers/video/backlight/lm3630_bl.c  |  475 -
 drivers/video/backlight/lm3630a_bl.c |  483 ++
 include/linux/platform_data/lm3630_bl.h  |   57 
 include/linux/platform_data/lm3630a_bl.h |   65 
 6 files changed, 552 insertions(+), 536 deletions(-)
 delete mode 100644 drivers/video/backlight/lm3630_bl.c
 create mode 100644 drivers/video/backlight/lm3630a_bl.c
 delete mode 100644 include/linux/platform_data/lm3630_bl.h
 create mode 100644 include/linux/platform_data/lm3630a_bl.h

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index d5ab658..37f5cc5 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -368,12 +368,12 @@ config BACKLIGHT_AAT2870
  If you have a AnalogicTech AAT2870 say Y to enable the
  backlight driver.
 
-config BACKLIGHT_LM3630
-   tristate "Backlight Driver for LM3630"
+config BACKLIGHT_LM3630A
+   tristate "Backlight Driver for LM3630A"
depends on BACKLIGHT_CLASS_DEVICE && I2C
select REGMAP_I2C
help
- This supports TI LM3630 Backlight Driver
+ This supports TI LM3630A Backlight Driver
 
 config BACKLIGHT_LM3639
tristate "Backlight Driver for LM3639"
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index 92711fe..04aa103 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -35,7 +35,7 @@ obj-$(CONFIG_BACKLIGHT_GENERIC)   += generic_bl.o
 obj-$(CONFIG_BACKLIGHT_HP680)  += hp680_bl.o
 obj-$(CONFIG_BACKLIGHT_HP700)  += jornada720_bl.o
 obj-$(CONFIG_BACKLIGHT_LM3533) += lm3533_bl.o
-obj-$(CONFIG_BACKLIGHT_LM3630) += lm3630_bl.o
+obj-$(CONFIG_BACKLIGHT_LM3630A)+= lm3630a_bl.o
 obj-$(CONFIG_BACKLIGHT_LM3639) += lm3639_bl.o
 obj-$(CONFIG_BACKLIGHT_LOCOMO) += locomolcd.o
 obj-$(CONFIG_BACKLIGHT_LP855X) += lp855x_bl.o
diff --git a/drivers/video/backlight/lm3630_bl.c 
b/drivers/video/backlight/lm3630_bl.c
deleted file mode 100644
index 76a62e9..000
--- a/drivers/video/backlight/lm3630_bl.c
+++ /dev/null
@@ -1,475 +0,0 @@
-/*
-* Simple driver for Texas Instruments LM3630 Backlight driver chip
-* Copyright (C) 2012 Texas Instruments
-*
-* 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 
-
-#define REG_CTRL   0x00
-#define REG_CONFIG 0x01
-#define REG_BRT_A  0x03
-#define REG_BRT_B  0x04
-#define REG_INT_STATUS 0x09
-#define REG_INT_EN 0x0A
-#define REG_FAULT  0x0B
-#define REG_PWM_OUTLOW 0x12
-#define REG_PWM_OUTHIGH0x13
-#define REG_MAX0x1F
-
-#define INT_DEBOUNCE_MSEC  10
-
-enum lm3630_leds {
-   BLED_ALL = 0,
-   BLED_1,
-   BLED_2
-};
-
-static const char * const bled_name[] = {
-   [BLED_ALL] = "lm3630_bled", /*Bank1 controls all string */
-   [BLED_1] = "lm3630_bled1",  /*Bank1 controls bled1 */
-   [BLED_2] = "lm3630_bled2",  /*Bank1 or 2 controls bled2 */
-};
-
-struct lm3630_chip_data {
-   struct device *dev;
-   struct delayed_work work;
-   int irq;
-   struct workqueue_struct *irqthread;
-   struct lm3630_platform_data *pdata;
-   struct backlight_device *bled1;
-   struct backlight_device *bled2;
-   struct regmap *regmap;
-};
-
-/* initialize chip */
-static int lm3630_chip_init(struct lm3630_chip_data *pchip)
-{
-   int ret;
-   unsigned int reg_val;
-   struct lm3630_platform_data *pdata = pchip->pdata;
-
-   /*pwm control */
-   reg_val = ((pdata->pwm_active & 0x01) << 2) | (pdata->pwm_ctrl & 0x03);
-   ret = regmap_update_bits(pchip->regmap, REG_CONFIG, 0x07, reg_val);
-   if (ret < 0)
-   goto out;
-
-   /* bank control */
-   reg_val = ((pdata->bank_b_ctrl & 0x01) << 1) |
-   (pdata->bank_a_ctrl & 0x07);
-   ret = regmap_update_bits(pchip->regmap, REG_CTRL, 0x07, reg_val);
-   if (ret < 0)
-   goto out;
-
-   ret = regmap_update_bits(pchip->regmap, REG_CTRL, 0x80, 0x00);
-   if (r

[PATCH v3] backlight: lm3630: apply chip revision

2013-08-06 Thread Daniel Jeong
The LM3630 chip was revised by TI and chip name was also changed to LM3630A.
And register map, default values and initial sequences are changed.
The files, lm3630_bl.{c,h} are replaced by lm3630a_bl.{c,h}
You can find more information about LM3630A(datasheet, evm etc) 
at http://www.ti.com/product/lm3630a

Signed-off-by: Daniel Jeong gshark.je...@gmail.com
---
 drivers/video/backlight/Kconfig  |6 +-
 drivers/video/backlight/Makefile |2 +-
 drivers/video/backlight/lm3630_bl.c  |  475 -
 drivers/video/backlight/lm3630a_bl.c |  483 ++
 include/linux/platform_data/lm3630_bl.h  |   57 
 include/linux/platform_data/lm3630a_bl.h |   65 
 6 files changed, 552 insertions(+), 536 deletions(-)
 delete mode 100644 drivers/video/backlight/lm3630_bl.c
 create mode 100644 drivers/video/backlight/lm3630a_bl.c
 delete mode 100644 include/linux/platform_data/lm3630_bl.h
 create mode 100644 include/linux/platform_data/lm3630a_bl.h

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index d5ab658..37f5cc5 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -368,12 +368,12 @@ config BACKLIGHT_AAT2870
  If you have a AnalogicTech AAT2870 say Y to enable the
  backlight driver.
 
-config BACKLIGHT_LM3630
-   tristate Backlight Driver for LM3630
+config BACKLIGHT_LM3630A
+   tristate Backlight Driver for LM3630A
depends on BACKLIGHT_CLASS_DEVICE  I2C
select REGMAP_I2C
help
- This supports TI LM3630 Backlight Driver
+ This supports TI LM3630A Backlight Driver
 
 config BACKLIGHT_LM3639
tristate Backlight Driver for LM3639
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index 92711fe..04aa103 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -35,7 +35,7 @@ obj-$(CONFIG_BACKLIGHT_GENERIC)   += generic_bl.o
 obj-$(CONFIG_BACKLIGHT_HP680)  += hp680_bl.o
 obj-$(CONFIG_BACKLIGHT_HP700)  += jornada720_bl.o
 obj-$(CONFIG_BACKLIGHT_LM3533) += lm3533_bl.o
-obj-$(CONFIG_BACKLIGHT_LM3630) += lm3630_bl.o
+obj-$(CONFIG_BACKLIGHT_LM3630A)+= lm3630a_bl.o
 obj-$(CONFIG_BACKLIGHT_LM3639) += lm3639_bl.o
 obj-$(CONFIG_BACKLIGHT_LOCOMO) += locomolcd.o
 obj-$(CONFIG_BACKLIGHT_LP855X) += lp855x_bl.o
diff --git a/drivers/video/backlight/lm3630_bl.c 
b/drivers/video/backlight/lm3630_bl.c
deleted file mode 100644
index 76a62e9..000
--- a/drivers/video/backlight/lm3630_bl.c
+++ /dev/null
@@ -1,475 +0,0 @@
-/*
-* Simple driver for Texas Instruments LM3630 Backlight driver chip
-* Copyright (C) 2012 Texas Instruments
-*
-* 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/module.h
-#include linux/slab.h
-#include linux/i2c.h
-#include linux/backlight.h
-#include linux/err.h
-#include linux/delay.h
-#include linux/uaccess.h
-#include linux/interrupt.h
-#include linux/regmap.h
-#include linux/platform_data/lm3630_bl.h
-
-#define REG_CTRL   0x00
-#define REG_CONFIG 0x01
-#define REG_BRT_A  0x03
-#define REG_BRT_B  0x04
-#define REG_INT_STATUS 0x09
-#define REG_INT_EN 0x0A
-#define REG_FAULT  0x0B
-#define REG_PWM_OUTLOW 0x12
-#define REG_PWM_OUTHIGH0x13
-#define REG_MAX0x1F
-
-#define INT_DEBOUNCE_MSEC  10
-
-enum lm3630_leds {
-   BLED_ALL = 0,
-   BLED_1,
-   BLED_2
-};
-
-static const char * const bled_name[] = {
-   [BLED_ALL] = lm3630_bled, /*Bank1 controls all string */
-   [BLED_1] = lm3630_bled1,  /*Bank1 controls bled1 */
-   [BLED_2] = lm3630_bled2,  /*Bank1 or 2 controls bled2 */
-};
-
-struct lm3630_chip_data {
-   struct device *dev;
-   struct delayed_work work;
-   int irq;
-   struct workqueue_struct *irqthread;
-   struct lm3630_platform_data *pdata;
-   struct backlight_device *bled1;
-   struct backlight_device *bled2;
-   struct regmap *regmap;
-};
-
-/* initialize chip */
-static int lm3630_chip_init(struct lm3630_chip_data *pchip)
-{
-   int ret;
-   unsigned int reg_val;
-   struct lm3630_platform_data *pdata = pchip-pdata;
-
-   /*pwm control */
-   reg_val = ((pdata-pwm_active  0x01)  2) | (pdata-pwm_ctrl  0x03);
-   ret = regmap_update_bits(pchip-regmap, REG_CONFIG, 0x07, reg_val);
-   if (ret  0)
-   goto out;
-
-   /* bank control */
-   reg_val = ((pdata-bank_b_ctrl  0x01)  1) |
-   (pdata-bank_a_ctrl  0x07);
-   ret = regmap_update_bits(pchip-regmap, REG_CTRL, 0x07, reg_val);
-   if (ret  0)
-   goto out;
-
-   ret = regmap_update_bits(pchip-regmap, REG_CTRL, 0x80, 0x00);
-   if (ret

[PATCH v1] backlight-lm3630-apply chip revision

2013-07-26 Thread daniel jeong
The LM3630 chip was revised by TI and chip name was also changed to LM3630A.
And register map, default values and intiial sequences are changed.
lm3630_bl.c and .h files are deleted
lm3630_bla.c and .h files are added
www.ti.com

Signed-off-by: daniel jeong 
---
 drivers/video/backlight/Kconfig  |6 +-
 drivers/video/backlight/Makefile |2 +-
 drivers/video/backlight/lm3630_bl.c  |  475 -
 drivers/video/backlight/lm3630a_bl.c |  482 ++
 include/linux/platform_data/lm3630_bl.h  |   57 
 include/linux/platform_data/lm3630a_bl.h |   65 
 6 files changed, 551 insertions(+), 536 deletions(-)
 delete mode 100644 drivers/video/backlight/lm3630_bl.c
 create mode 100644 drivers/video/backlight/lm3630a_bl.c
 delete mode 100644 include/linux/platform_data/lm3630_bl.h
 create mode 100644 include/linux/platform_data/lm3630a_bl.h

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index d5ab658..37f5cc5 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -368,12 +368,12 @@ config BACKLIGHT_AAT2870
  If you have a AnalogicTech AAT2870 say Y to enable the
  backlight driver.
 
-config BACKLIGHT_LM3630
-   tristate "Backlight Driver for LM3630"
+config BACKLIGHT_LM3630A
+   tristate "Backlight Driver for LM3630A"
depends on BACKLIGHT_CLASS_DEVICE && I2C
select REGMAP_I2C
help
- This supports TI LM3630 Backlight Driver
+ This supports TI LM3630A Backlight Driver
 
 config BACKLIGHT_LM3639
tristate "Backlight Driver for LM3639"
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index 92711fe..04aa103 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -35,7 +35,7 @@ obj-$(CONFIG_BACKLIGHT_GENERIC)   += generic_bl.o
 obj-$(CONFIG_BACKLIGHT_HP680)  += hp680_bl.o
 obj-$(CONFIG_BACKLIGHT_HP700)  += jornada720_bl.o
 obj-$(CONFIG_BACKLIGHT_LM3533) += lm3533_bl.o
-obj-$(CONFIG_BACKLIGHT_LM3630) += lm3630_bl.o
+obj-$(CONFIG_BACKLIGHT_LM3630A)+= lm3630a_bl.o
 obj-$(CONFIG_BACKLIGHT_LM3639) += lm3639_bl.o
 obj-$(CONFIG_BACKLIGHT_LOCOMO) += locomolcd.o
 obj-$(CONFIG_BACKLIGHT_LP855X) += lp855x_bl.o
diff --git a/drivers/video/backlight/lm3630_bl.c 
b/drivers/video/backlight/lm3630_bl.c
deleted file mode 100644
index 76a62e9..000
--- a/drivers/video/backlight/lm3630_bl.c
+++ /dev/null
@@ -1,475 +0,0 @@
-/*
-* Simple driver for Texas Instruments LM3630 Backlight driver chip
-* Copyright (C) 2012 Texas Instruments
-*
-* 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 
-
-#define REG_CTRL   0x00
-#define REG_CONFIG 0x01
-#define REG_BRT_A  0x03
-#define REG_BRT_B  0x04
-#define REG_INT_STATUS 0x09
-#define REG_INT_EN 0x0A
-#define REG_FAULT  0x0B
-#define REG_PWM_OUTLOW 0x12
-#define REG_PWM_OUTHIGH0x13
-#define REG_MAX0x1F
-
-#define INT_DEBOUNCE_MSEC  10
-
-enum lm3630_leds {
-   BLED_ALL = 0,
-   BLED_1,
-   BLED_2
-};
-
-static const char * const bled_name[] = {
-   [BLED_ALL] = "lm3630_bled", /*Bank1 controls all string */
-   [BLED_1] = "lm3630_bled1",  /*Bank1 controls bled1 */
-   [BLED_2] = "lm3630_bled2",  /*Bank1 or 2 controls bled2 */
-};
-
-struct lm3630_chip_data {
-   struct device *dev;
-   struct delayed_work work;
-   int irq;
-   struct workqueue_struct *irqthread;
-   struct lm3630_platform_data *pdata;
-   struct backlight_device *bled1;
-   struct backlight_device *bled2;
-   struct regmap *regmap;
-};
-
-/* initialize chip */
-static int lm3630_chip_init(struct lm3630_chip_data *pchip)
-{
-   int ret;
-   unsigned int reg_val;
-   struct lm3630_platform_data *pdata = pchip->pdata;
-
-   /*pwm control */
-   reg_val = ((pdata->pwm_active & 0x01) << 2) | (pdata->pwm_ctrl & 0x03);
-   ret = regmap_update_bits(pchip->regmap, REG_CONFIG, 0x07, reg_val);
-   if (ret < 0)
-   goto out;
-
-   /* bank control */
-   reg_val = ((pdata->bank_b_ctrl & 0x01) << 1) |
-   (pdata->bank_a_ctrl & 0x07);
-   ret = regmap_update_bits(pchip->regmap, REG_CTRL, 0x07, reg_val);
-   if (ret < 0)
-   goto out;
-
-   ret = regmap_update_bits(pchip->regmap, REG_CTRL, 0x80, 0x00);
-   if (ret < 0)
-   goto out;
-
-   /* set initial brightness */
-   if (pdata->

[PATCH v1] backlight-lm3630-apply chip revision

2013-07-26 Thread daniel jeong
The LM3630 chip was revised by TI and chip name was also changed to LM3630A.
And register map, default values and intiial sequences are changed.
lm3630_bl.c and .h files are deleted
lm3630_bla.c and .h files are added
www.ti.com

Signed-off-by: daniel jeong daniel.je...@ti.com
---
 drivers/video/backlight/Kconfig  |6 +-
 drivers/video/backlight/Makefile |2 +-
 drivers/video/backlight/lm3630_bl.c  |  475 -
 drivers/video/backlight/lm3630a_bl.c |  482 ++
 include/linux/platform_data/lm3630_bl.h  |   57 
 include/linux/platform_data/lm3630a_bl.h |   65 
 6 files changed, 551 insertions(+), 536 deletions(-)
 delete mode 100644 drivers/video/backlight/lm3630_bl.c
 create mode 100644 drivers/video/backlight/lm3630a_bl.c
 delete mode 100644 include/linux/platform_data/lm3630_bl.h
 create mode 100644 include/linux/platform_data/lm3630a_bl.h

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index d5ab658..37f5cc5 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -368,12 +368,12 @@ config BACKLIGHT_AAT2870
  If you have a AnalogicTech AAT2870 say Y to enable the
  backlight driver.
 
-config BACKLIGHT_LM3630
-   tristate Backlight Driver for LM3630
+config BACKLIGHT_LM3630A
+   tristate Backlight Driver for LM3630A
depends on BACKLIGHT_CLASS_DEVICE  I2C
select REGMAP_I2C
help
- This supports TI LM3630 Backlight Driver
+ This supports TI LM3630A Backlight Driver
 
 config BACKLIGHT_LM3639
tristate Backlight Driver for LM3639
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index 92711fe..04aa103 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -35,7 +35,7 @@ obj-$(CONFIG_BACKLIGHT_GENERIC)   += generic_bl.o
 obj-$(CONFIG_BACKLIGHT_HP680)  += hp680_bl.o
 obj-$(CONFIG_BACKLIGHT_HP700)  += jornada720_bl.o
 obj-$(CONFIG_BACKLIGHT_LM3533) += lm3533_bl.o
-obj-$(CONFIG_BACKLIGHT_LM3630) += lm3630_bl.o
+obj-$(CONFIG_BACKLIGHT_LM3630A)+= lm3630a_bl.o
 obj-$(CONFIG_BACKLIGHT_LM3639) += lm3639_bl.o
 obj-$(CONFIG_BACKLIGHT_LOCOMO) += locomolcd.o
 obj-$(CONFIG_BACKLIGHT_LP855X) += lp855x_bl.o
diff --git a/drivers/video/backlight/lm3630_bl.c 
b/drivers/video/backlight/lm3630_bl.c
deleted file mode 100644
index 76a62e9..000
--- a/drivers/video/backlight/lm3630_bl.c
+++ /dev/null
@@ -1,475 +0,0 @@
-/*
-* Simple driver for Texas Instruments LM3630 Backlight driver chip
-* Copyright (C) 2012 Texas Instruments
-*
-* 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/module.h
-#include linux/slab.h
-#include linux/i2c.h
-#include linux/backlight.h
-#include linux/err.h
-#include linux/delay.h
-#include linux/uaccess.h
-#include linux/interrupt.h
-#include linux/regmap.h
-#include linux/platform_data/lm3630_bl.h
-
-#define REG_CTRL   0x00
-#define REG_CONFIG 0x01
-#define REG_BRT_A  0x03
-#define REG_BRT_B  0x04
-#define REG_INT_STATUS 0x09
-#define REG_INT_EN 0x0A
-#define REG_FAULT  0x0B
-#define REG_PWM_OUTLOW 0x12
-#define REG_PWM_OUTHIGH0x13
-#define REG_MAX0x1F
-
-#define INT_DEBOUNCE_MSEC  10
-
-enum lm3630_leds {
-   BLED_ALL = 0,
-   BLED_1,
-   BLED_2
-};
-
-static const char * const bled_name[] = {
-   [BLED_ALL] = lm3630_bled, /*Bank1 controls all string */
-   [BLED_1] = lm3630_bled1,  /*Bank1 controls bled1 */
-   [BLED_2] = lm3630_bled2,  /*Bank1 or 2 controls bled2 */
-};
-
-struct lm3630_chip_data {
-   struct device *dev;
-   struct delayed_work work;
-   int irq;
-   struct workqueue_struct *irqthread;
-   struct lm3630_platform_data *pdata;
-   struct backlight_device *bled1;
-   struct backlight_device *bled2;
-   struct regmap *regmap;
-};
-
-/* initialize chip */
-static int lm3630_chip_init(struct lm3630_chip_data *pchip)
-{
-   int ret;
-   unsigned int reg_val;
-   struct lm3630_platform_data *pdata = pchip-pdata;
-
-   /*pwm control */
-   reg_val = ((pdata-pwm_active  0x01)  2) | (pdata-pwm_ctrl  0x03);
-   ret = regmap_update_bits(pchip-regmap, REG_CONFIG, 0x07, reg_val);
-   if (ret  0)
-   goto out;
-
-   /* bank control */
-   reg_val = ((pdata-bank_b_ctrl  0x01)  1) |
-   (pdata-bank_a_ctrl  0x07);
-   ret = regmap_update_bits(pchip-regmap, REG_CTRL, 0x07, reg_val);
-   if (ret  0)
-   goto out;
-
-   ret = regmap_update_bits(pchip-regmap, REG_CTRL, 0x80, 0x00);
-   if (ret  0)
-   goto out;
-
-   /* set initial brightness

[PATCH] backlight-lm3630-apply chip revision

2013-07-19 Thread daniel jeong
The TI LM3630 chip was revised and chip name was also changed to LM3630A.
And register map, default values and initial sequences are changed.
www.ti.com

Signed-off-by: daniel jeong 
---
 drivers/video/backlight/Kconfig |4 +-
 drivers/video/backlight/lm3630_bl.c |  491 ---
 include/linux/platform_data/lm3630_bl.h |   68 +++--
 3 files changed, 293 insertions(+), 270 deletions(-)

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index d5ab658..048e7bd 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -369,11 +369,11 @@ config BACKLIGHT_AAT2870
  backlight driver.
 
 config BACKLIGHT_LM3630
-   tristate "Backlight Driver for LM3630"
+   tristate "Backlight Driver for LM3630A"
depends on BACKLIGHT_CLASS_DEVICE && I2C
select REGMAP_I2C
help
- This supports TI LM3630 Backlight Driver
+ This supports TI LM3630A Backlight Driver
 
 config BACKLIGHT_LM3639
tristate "Backlight Driver for LM3639"
diff --git a/drivers/video/backlight/lm3630_bl.c 
b/drivers/video/backlight/lm3630_bl.c
index 76a62e9..0e9d4e7 100644
--- a/drivers/video/backlight/lm3630_bl.c
+++ b/drivers/video/backlight/lm3630_bl.c
@@ -1,5 +1,5 @@
 /*
-* Simple driver for Texas Instruments LM3630 Backlight driver chip
+* Simple driver for Texas Instruments LM3630A Backlight driver chip
 * Copyright (C) 2012 Texas Instruments
 *
 * This program is free software; you can redistribute it and/or modify
@@ -16,12 +16,16 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #define REG_CTRL   0x00
+#define REG_BOOST  0x02
 #define REG_CONFIG 0x01
 #define REG_BRT_A  0x03
 #define REG_BRT_B  0x04
+#define REG_I_A0x05
+#define REG_I_B0x06
 #define REG_INT_STATUS 0x09
 #define REG_INT_EN 0x0A
 #define REG_FAULT  0x0B
@@ -30,205 +34,211 @@
 #define REG_MAX0x1F
 
 #define INT_DEBOUNCE_MSEC  10
-
-enum lm3630_leds {
-   BLED_ALL = 0,
-   BLED_1,
-   BLED_2
-};
-
-static const char * const bled_name[] = {
-   [BLED_ALL] = "lm3630_bled", /*Bank1 controls all string */
-   [BLED_1] = "lm3630_bled1",  /*Bank1 controls bled1 */
-   [BLED_2] = "lm3630_bled2",  /*Bank1 or 2 controls bled2 */
-};
-
-struct lm3630_chip_data {
+struct lm3630_chip {
struct device *dev;
struct delayed_work work;
+
int irq;
struct workqueue_struct *irqthread;
struct lm3630_platform_data *pdata;
-   struct backlight_device *bled1;
-   struct backlight_device *bled2;
+   struct backlight_device *bleda;
+   struct backlight_device *bledb;
struct regmap *regmap;
+   struct pwm_device *pwmd;
 };
 
-/* initialize chip */
-static int lm3630_chip_init(struct lm3630_chip_data *pchip)
+/* i2c access */
+static int lm3630_read(struct lm3630_chip *pchip, unsigned int reg)
 {
-   int ret;
+   int rval;
unsigned int reg_val;
-   struct lm3630_platform_data *pdata = pchip->pdata;
-
-   /*pwm control */
-   reg_val = ((pdata->pwm_active & 0x01) << 2) | (pdata->pwm_ctrl & 0x03);
-   ret = regmap_update_bits(pchip->regmap, REG_CONFIG, 0x07, reg_val);
-   if (ret < 0)
-   goto out;
 
-   /* bank control */
-   reg_val = ((pdata->bank_b_ctrl & 0x01) << 1) |
-   (pdata->bank_a_ctrl & 0x07);
-   ret = regmap_update_bits(pchip->regmap, REG_CTRL, 0x07, reg_val);
-   if (ret < 0)
-   goto out;
+   rval = regmap_read(pchip->regmap, reg, _val);
+   if (rval < 0)
+   return rval;
+   return reg_val & 0xFF;
+}
 
-   ret = regmap_update_bits(pchip->regmap, REG_CTRL, 0x80, 0x00);
-   if (ret < 0)
-   goto out;
+static int lm3630_write(struct lm3630_chip *pchip,
+   unsigned int reg, unsigned int data)
+{
+   return regmap_write(pchip->regmap, reg, data);
+}
 
-   /* set initial brightness */
-   if (pdata->bank_a_ctrl != BANK_A_CTRL_DISABLE) {
-   ret = regmap_write(pchip->regmap,
-  REG_BRT_A, pdata->init_brt_led1);
-   if (ret < 0)
-   goto out;
-   }
+static int lm3630_update(struct lm3630_chip *pchip,
+unsigned int reg, unsigned int mask, unsigned int data)
+{
+   return regmap_update_bits(pchip->regmap, reg, mask, data);
+}
 
-   if (pdata->bank_b_ctrl != BANK_B_CTRL_DISABLE) {
-   ret = regmap_write(pchip->regmap,
-  REG_BRT_B, pdata->init_brt_led2);
-   if (ret < 0)
-   goto out;
-   }
-   return ret;
+/* initialize chip */
+static

[PATCH] backlight-lm3630-apply chip revision

2013-07-19 Thread daniel jeong
@chip revision
The TI LM3630 chip was revised and chip name was also changed to LM3630A.
And register map, default values and initial sequences are changed.
www.ti.com

Signed-off-by: daniel jeong 
---
 drivers/video/backlight/Kconfig |4 +-
 drivers/video/backlight/lm3630_bl.c |  491 ---
 include/linux/platform_data/lm3630_bl.h |   68 +++--
 3 files changed, 293 insertions(+), 270 deletions(-)

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index d5ab658..048e7bd 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -369,11 +369,11 @@ config BACKLIGHT_AAT2870
  backlight driver.
 
 config BACKLIGHT_LM3630
-   tristate "Backlight Driver for LM3630"
+   tristate "Backlight Driver for LM3630A"
depends on BACKLIGHT_CLASS_DEVICE && I2C
select REGMAP_I2C
help
- This supports TI LM3630 Backlight Driver
+ This supports TI LM3630A Backlight Driver
 
 config BACKLIGHT_LM3639
tristate "Backlight Driver for LM3639"
diff --git a/drivers/video/backlight/lm3630_bl.c 
b/drivers/video/backlight/lm3630_bl.c
index 76a62e9..0e9d4e7 100644
--- a/drivers/video/backlight/lm3630_bl.c
+++ b/drivers/video/backlight/lm3630_bl.c
@@ -1,5 +1,5 @@
 /*
-* Simple driver for Texas Instruments LM3630 Backlight driver chip
+* Simple driver for Texas Instruments LM3630A Backlight driver chip
 * Copyright (C) 2012 Texas Instruments
 *
 * This program is free software; you can redistribute it and/or modify
@@ -16,12 +16,16 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #define REG_CTRL   0x00
+#define REG_BOOST  0x02
 #define REG_CONFIG 0x01
 #define REG_BRT_A  0x03
 #define REG_BRT_B  0x04
+#define REG_I_A0x05
+#define REG_I_B0x06
 #define REG_INT_STATUS 0x09
 #define REG_INT_EN 0x0A
 #define REG_FAULT  0x0B
@@ -30,205 +34,211 @@
 #define REG_MAX0x1F
 
 #define INT_DEBOUNCE_MSEC  10
-
-enum lm3630_leds {
-   BLED_ALL = 0,
-   BLED_1,
-   BLED_2
-};
-
-static const char * const bled_name[] = {
-   [BLED_ALL] = "lm3630_bled", /*Bank1 controls all string */
-   [BLED_1] = "lm3630_bled1",  /*Bank1 controls bled1 */
-   [BLED_2] = "lm3630_bled2",  /*Bank1 or 2 controls bled2 */
-};
-
-struct lm3630_chip_data {
+struct lm3630_chip {
struct device *dev;
struct delayed_work work;
+
int irq;
struct workqueue_struct *irqthread;
struct lm3630_platform_data *pdata;
-   struct backlight_device *bled1;
-   struct backlight_device *bled2;
+   struct backlight_device *bleda;
+   struct backlight_device *bledb;
struct regmap *regmap;
+   struct pwm_device *pwmd;
 };
 
-/* initialize chip */
-static int lm3630_chip_init(struct lm3630_chip_data *pchip)
+/* i2c access */
+static int lm3630_read(struct lm3630_chip *pchip, unsigned int reg)
 {
-   int ret;
+   int rval;
unsigned int reg_val;
-   struct lm3630_platform_data *pdata = pchip->pdata;
-
-   /*pwm control */
-   reg_val = ((pdata->pwm_active & 0x01) << 2) | (pdata->pwm_ctrl & 0x03);
-   ret = regmap_update_bits(pchip->regmap, REG_CONFIG, 0x07, reg_val);
-   if (ret < 0)
-   goto out;
 
-   /* bank control */
-   reg_val = ((pdata->bank_b_ctrl & 0x01) << 1) |
-   (pdata->bank_a_ctrl & 0x07);
-   ret = regmap_update_bits(pchip->regmap, REG_CTRL, 0x07, reg_val);
-   if (ret < 0)
-   goto out;
+   rval = regmap_read(pchip->regmap, reg, _val);
+   if (rval < 0)
+   return rval;
+   return reg_val & 0xFF;
+}
 
-   ret = regmap_update_bits(pchip->regmap, REG_CTRL, 0x80, 0x00);
-   if (ret < 0)
-   goto out;
+static int lm3630_write(struct lm3630_chip *pchip,
+   unsigned int reg, unsigned int data)
+{
+   return regmap_write(pchip->regmap, reg, data);
+}
 
-   /* set initial brightness */
-   if (pdata->bank_a_ctrl != BANK_A_CTRL_DISABLE) {
-   ret = regmap_write(pchip->regmap,
-  REG_BRT_A, pdata->init_brt_led1);
-   if (ret < 0)
-   goto out;
-   }
+static int lm3630_update(struct lm3630_chip *pchip,
+unsigned int reg, unsigned int mask, unsigned int data)
+{
+   return regmap_update_bits(pchip->regmap, reg, mask, data);
+}
 
-   if (pdata->bank_b_ctrl != BANK_B_CTRL_DISABLE) {
-   ret = regmap_write(pchip->regmap,
-  REG_BRT_B, pdata->init_brt_led2);
-   if (ret < 0)
-   goto out;
-   }
-   return ret;
+/* initializ

[PATCH] backlight-lm3630-apply chip revision

2013-07-19 Thread daniel jeong
@chip revision
The TI LM3630 chip was revised and chip name was also changed to LM3630A.
And register map, default values and initial sequences are changed.
www.ti.com

Signed-off-by: daniel jeong daniel.je...@ti.com
---
 drivers/video/backlight/Kconfig |4 +-
 drivers/video/backlight/lm3630_bl.c |  491 ---
 include/linux/platform_data/lm3630_bl.h |   68 +++--
 3 files changed, 293 insertions(+), 270 deletions(-)

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index d5ab658..048e7bd 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -369,11 +369,11 @@ config BACKLIGHT_AAT2870
  backlight driver.
 
 config BACKLIGHT_LM3630
-   tristate Backlight Driver for LM3630
+   tristate Backlight Driver for LM3630A
depends on BACKLIGHT_CLASS_DEVICE  I2C
select REGMAP_I2C
help
- This supports TI LM3630 Backlight Driver
+ This supports TI LM3630A Backlight Driver
 
 config BACKLIGHT_LM3639
tristate Backlight Driver for LM3639
diff --git a/drivers/video/backlight/lm3630_bl.c 
b/drivers/video/backlight/lm3630_bl.c
index 76a62e9..0e9d4e7 100644
--- a/drivers/video/backlight/lm3630_bl.c
+++ b/drivers/video/backlight/lm3630_bl.c
@@ -1,5 +1,5 @@
 /*
-* Simple driver for Texas Instruments LM3630 Backlight driver chip
+* Simple driver for Texas Instruments LM3630A Backlight driver chip
 * Copyright (C) 2012 Texas Instruments
 *
 * This program is free software; you can redistribute it and/or modify
@@ -16,12 +16,16 @@
 #include linux/uaccess.h
 #include linux/interrupt.h
 #include linux/regmap.h
+#include linux/pwm.h
 #include linux/platform_data/lm3630_bl.h
 
 #define REG_CTRL   0x00
+#define REG_BOOST  0x02
 #define REG_CONFIG 0x01
 #define REG_BRT_A  0x03
 #define REG_BRT_B  0x04
+#define REG_I_A0x05
+#define REG_I_B0x06
 #define REG_INT_STATUS 0x09
 #define REG_INT_EN 0x0A
 #define REG_FAULT  0x0B
@@ -30,205 +34,211 @@
 #define REG_MAX0x1F
 
 #define INT_DEBOUNCE_MSEC  10
-
-enum lm3630_leds {
-   BLED_ALL = 0,
-   BLED_1,
-   BLED_2
-};
-
-static const char * const bled_name[] = {
-   [BLED_ALL] = lm3630_bled, /*Bank1 controls all string */
-   [BLED_1] = lm3630_bled1,  /*Bank1 controls bled1 */
-   [BLED_2] = lm3630_bled2,  /*Bank1 or 2 controls bled2 */
-};
-
-struct lm3630_chip_data {
+struct lm3630_chip {
struct device *dev;
struct delayed_work work;
+
int irq;
struct workqueue_struct *irqthread;
struct lm3630_platform_data *pdata;
-   struct backlight_device *bled1;
-   struct backlight_device *bled2;
+   struct backlight_device *bleda;
+   struct backlight_device *bledb;
struct regmap *regmap;
+   struct pwm_device *pwmd;
 };
 
-/* initialize chip */
-static int lm3630_chip_init(struct lm3630_chip_data *pchip)
+/* i2c access */
+static int lm3630_read(struct lm3630_chip *pchip, unsigned int reg)
 {
-   int ret;
+   int rval;
unsigned int reg_val;
-   struct lm3630_platform_data *pdata = pchip-pdata;
-
-   /*pwm control */
-   reg_val = ((pdata-pwm_active  0x01)  2) | (pdata-pwm_ctrl  0x03);
-   ret = regmap_update_bits(pchip-regmap, REG_CONFIG, 0x07, reg_val);
-   if (ret  0)
-   goto out;
 
-   /* bank control */
-   reg_val = ((pdata-bank_b_ctrl  0x01)  1) |
-   (pdata-bank_a_ctrl  0x07);
-   ret = regmap_update_bits(pchip-regmap, REG_CTRL, 0x07, reg_val);
-   if (ret  0)
-   goto out;
+   rval = regmap_read(pchip-regmap, reg, reg_val);
+   if (rval  0)
+   return rval;
+   return reg_val  0xFF;
+}
 
-   ret = regmap_update_bits(pchip-regmap, REG_CTRL, 0x80, 0x00);
-   if (ret  0)
-   goto out;
+static int lm3630_write(struct lm3630_chip *pchip,
+   unsigned int reg, unsigned int data)
+{
+   return regmap_write(pchip-regmap, reg, data);
+}
 
-   /* set initial brightness */
-   if (pdata-bank_a_ctrl != BANK_A_CTRL_DISABLE) {
-   ret = regmap_write(pchip-regmap,
-  REG_BRT_A, pdata-init_brt_led1);
-   if (ret  0)
-   goto out;
-   }
+static int lm3630_update(struct lm3630_chip *pchip,
+unsigned int reg, unsigned int mask, unsigned int data)
+{
+   return regmap_update_bits(pchip-regmap, reg, mask, data);
+}
 
-   if (pdata-bank_b_ctrl != BANK_B_CTRL_DISABLE) {
-   ret = regmap_write(pchip-regmap,
-  REG_BRT_B, pdata-init_brt_led2);
-   if (ret  0)
-   goto out;
-   }
-   return ret;
+/* initialize chip */
+static int lm3630_chip_init(struct lm3630_chip *pchip)
+{
+   int rval;
+   struct

[PATCH] backlight-lm3630-apply chip revision

2013-07-19 Thread daniel jeong
The TI LM3630 chip was revised and chip name was also changed to LM3630A.
And register map, default values and initial sequences are changed.
www.ti.com

Signed-off-by: daniel jeong daniel.je...@ti.com
---
 drivers/video/backlight/Kconfig |4 +-
 drivers/video/backlight/lm3630_bl.c |  491 ---
 include/linux/platform_data/lm3630_bl.h |   68 +++--
 3 files changed, 293 insertions(+), 270 deletions(-)

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index d5ab658..048e7bd 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -369,11 +369,11 @@ config BACKLIGHT_AAT2870
  backlight driver.
 
 config BACKLIGHT_LM3630
-   tristate Backlight Driver for LM3630
+   tristate Backlight Driver for LM3630A
depends on BACKLIGHT_CLASS_DEVICE  I2C
select REGMAP_I2C
help
- This supports TI LM3630 Backlight Driver
+ This supports TI LM3630A Backlight Driver
 
 config BACKLIGHT_LM3639
tristate Backlight Driver for LM3639
diff --git a/drivers/video/backlight/lm3630_bl.c 
b/drivers/video/backlight/lm3630_bl.c
index 76a62e9..0e9d4e7 100644
--- a/drivers/video/backlight/lm3630_bl.c
+++ b/drivers/video/backlight/lm3630_bl.c
@@ -1,5 +1,5 @@
 /*
-* Simple driver for Texas Instruments LM3630 Backlight driver chip
+* Simple driver for Texas Instruments LM3630A Backlight driver chip
 * Copyright (C) 2012 Texas Instruments
 *
 * This program is free software; you can redistribute it and/or modify
@@ -16,12 +16,16 @@
 #include linux/uaccess.h
 #include linux/interrupt.h
 #include linux/regmap.h
+#include linux/pwm.h
 #include linux/platform_data/lm3630_bl.h
 
 #define REG_CTRL   0x00
+#define REG_BOOST  0x02
 #define REG_CONFIG 0x01
 #define REG_BRT_A  0x03
 #define REG_BRT_B  0x04
+#define REG_I_A0x05
+#define REG_I_B0x06
 #define REG_INT_STATUS 0x09
 #define REG_INT_EN 0x0A
 #define REG_FAULT  0x0B
@@ -30,205 +34,211 @@
 #define REG_MAX0x1F
 
 #define INT_DEBOUNCE_MSEC  10
-
-enum lm3630_leds {
-   BLED_ALL = 0,
-   BLED_1,
-   BLED_2
-};
-
-static const char * const bled_name[] = {
-   [BLED_ALL] = lm3630_bled, /*Bank1 controls all string */
-   [BLED_1] = lm3630_bled1,  /*Bank1 controls bled1 */
-   [BLED_2] = lm3630_bled2,  /*Bank1 or 2 controls bled2 */
-};
-
-struct lm3630_chip_data {
+struct lm3630_chip {
struct device *dev;
struct delayed_work work;
+
int irq;
struct workqueue_struct *irqthread;
struct lm3630_platform_data *pdata;
-   struct backlight_device *bled1;
-   struct backlight_device *bled2;
+   struct backlight_device *bleda;
+   struct backlight_device *bledb;
struct regmap *regmap;
+   struct pwm_device *pwmd;
 };
 
-/* initialize chip */
-static int lm3630_chip_init(struct lm3630_chip_data *pchip)
+/* i2c access */
+static int lm3630_read(struct lm3630_chip *pchip, unsigned int reg)
 {
-   int ret;
+   int rval;
unsigned int reg_val;
-   struct lm3630_platform_data *pdata = pchip-pdata;
-
-   /*pwm control */
-   reg_val = ((pdata-pwm_active  0x01)  2) | (pdata-pwm_ctrl  0x03);
-   ret = regmap_update_bits(pchip-regmap, REG_CONFIG, 0x07, reg_val);
-   if (ret  0)
-   goto out;
 
-   /* bank control */
-   reg_val = ((pdata-bank_b_ctrl  0x01)  1) |
-   (pdata-bank_a_ctrl  0x07);
-   ret = regmap_update_bits(pchip-regmap, REG_CTRL, 0x07, reg_val);
-   if (ret  0)
-   goto out;
+   rval = regmap_read(pchip-regmap, reg, reg_val);
+   if (rval  0)
+   return rval;
+   return reg_val  0xFF;
+}
 
-   ret = regmap_update_bits(pchip-regmap, REG_CTRL, 0x80, 0x00);
-   if (ret  0)
-   goto out;
+static int lm3630_write(struct lm3630_chip *pchip,
+   unsigned int reg, unsigned int data)
+{
+   return regmap_write(pchip-regmap, reg, data);
+}
 
-   /* set initial brightness */
-   if (pdata-bank_a_ctrl != BANK_A_CTRL_DISABLE) {
-   ret = regmap_write(pchip-regmap,
-  REG_BRT_A, pdata-init_brt_led1);
-   if (ret  0)
-   goto out;
-   }
+static int lm3630_update(struct lm3630_chip *pchip,
+unsigned int reg, unsigned int mask, unsigned int data)
+{
+   return regmap_update_bits(pchip-regmap, reg, mask, data);
+}
 
-   if (pdata-bank_b_ctrl != BANK_B_CTRL_DISABLE) {
-   ret = regmap_write(pchip-regmap,
-  REG_BRT_B, pdata-init_brt_led2);
-   if (ret  0)
-   goto out;
-   }
-   return ret;
+/* initialize chip */
+static int lm3630_chip_init(struct lm3630_chip *pchip)
+{
+   int rval;
+   struct lm3630_platform_data

Re: [PATCH] regulator: lp8755: Use LP8755_BUCK_MAX instead of magic number

2013-01-26 Thread daniel jeong

On Jan 26, 2013, at 2:19 PM, Axel Lin  wrote:

> Signed-off-by: Axel Lin 
> ---
> drivers/regulator/lp8755.c |6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/regulator/lp8755.c b/drivers/regulator/lp8755.c
> index 8b1ce0f..f0f6ea0 100644
> --- a/drivers/regulator/lp8755.c
> +++ b/drivers/regulator/lp8755.c
> @@ -373,7 +373,7 @@ static irqreturn_t lp8755_irq_handler(int irq, void *data)
>   goto err_i2c;
> 
>   /* sent power fault detection event to specific regulator */
> - for (icnt = 0; icnt < 6; icnt++)
> + for (icnt = 0; icnt < LP8755_BUCK_MAX; icnt++)
>   if ((flag0 & (0x4 << icnt))
>   && (pchip->irqmask & (0x04 << icnt))
>   && (pchip->rdev[icnt] != NULL))
> @@ -508,7 +508,7 @@ err_irq:
> 
> err_regulator:
>   /* output disable */
> - for (icnt = 0; icnt < 0x06; icnt++)
> + for (icnt = 0; icnt < LP8755_BUCK_MAX; icnt++)
>   lp8755_write(pchip, icnt, 0x00);
> 
>   return ret;
> @@ -522,7 +522,7 @@ static int lp8755_remove(struct i2c_client *client)
>   for (icnt = 0; icnt < mphase_buck[pchip->mphase].nreg; icnt++)
>   regulator_unregister(pchip->rdev[icnt]);
> 
> - for (icnt = 0; icnt < 0x06; icnt++)
> + for (icnt = 0; icnt < LP8755_BUCK_MAX; icnt++)
>   lp8755_write(pchip, icnt, 0x00);
> 
>   if (pchip->irq != 0)
> -- 
> 1.7.9.5
> 
> 
> 
Yes you're right!
Thank you Axel. 
Daniel.--
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] regulator: lp8755: Use LP8755_BUCK_MAX instead of magic number

2013-01-26 Thread daniel jeong

On Jan 26, 2013, at 2:19 PM, Axel Lin axel@ingics.com wrote:

 Signed-off-by: Axel Lin axel@ingics.com
 ---
 drivers/regulator/lp8755.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
 
 diff --git a/drivers/regulator/lp8755.c b/drivers/regulator/lp8755.c
 index 8b1ce0f..f0f6ea0 100644
 --- a/drivers/regulator/lp8755.c
 +++ b/drivers/regulator/lp8755.c
 @@ -373,7 +373,7 @@ static irqreturn_t lp8755_irq_handler(int irq, void *data)
   goto err_i2c;
 
   /* sent power fault detection event to specific regulator */
 - for (icnt = 0; icnt  6; icnt++)
 + for (icnt = 0; icnt  LP8755_BUCK_MAX; icnt++)
   if ((flag0  (0x4  icnt))
(pchip-irqmask  (0x04  icnt))
(pchip-rdev[icnt] != NULL))
 @@ -508,7 +508,7 @@ err_irq:
 
 err_regulator:
   /* output disable */
 - for (icnt = 0; icnt  0x06; icnt++)
 + for (icnt = 0; icnt  LP8755_BUCK_MAX; icnt++)
   lp8755_write(pchip, icnt, 0x00);
 
   return ret;
 @@ -522,7 +522,7 @@ static int lp8755_remove(struct i2c_client *client)
   for (icnt = 0; icnt  mphase_buck[pchip-mphase].nreg; icnt++)
   regulator_unregister(pchip-rdev[icnt]);
 
 - for (icnt = 0; icnt  0x06; icnt++)
 + for (icnt = 0; icnt  LP8755_BUCK_MAX; icnt++)
   lp8755_write(pchip, icnt, 0x00);
 
   if (pchip-irq != 0)
 -- 
 1.7.9.5
 
 
 
Yes you're right!
Thank you Axel. 
Daniel.--
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/


[PATCH v2] regulator: new driver for LP8755

2012-12-16 Thread Daniel Jeong
This patch is for new lp8755 regulator dirver and 
several unsed variables were deleted and then test was done.

LP8755 :
The LP8755 is a high performance power management unit.It contains
six step-down DC-DC converters which can can be filexibly bundled
together in multiphase converters as required by application.
www.ti.com

Signed-off-by: Daniel Jeong 
---
 drivers/regulator/Kconfig|9 +
 drivers/regulator/Makefile   |1 +
 drivers/regulator/lp8755.c   |  580 ++
 include/linux/platform_data/lp8755.h |   71 
 4 files changed, 661 insertions(+), 0 deletions(-)
 create mode 100644 drivers/regulator/lp8755.c
 create mode 100644 include/linux/platform_data/lp8755.h

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 67d47b59..dc83401 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -257,6 +257,15 @@ config REGULATOR_LP872X
help
  This driver supports LP8720/LP8725 PMIC
 
+config REGULATOR_LP8755
+   tristate "TI LP8755 High Performance PMU driver"
+   depends on I2C
+   select REGMAP_I2C
+   help
+ This driver supports LP8755 High Performance PMU driver. This
+ chip contains six step-down DC/DC converters which can support
+ 9 mode multiphase configuration.
+
 config REGULATOR_LP8788
bool "TI LP8788 Power Regulators"
depends on MFD_LP8788
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index e431eed..bf346b7 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -28,6 +28,7 @@ obj-$(CONFIG_REGULATOR_LP3972) += lp3972.o
 obj-$(CONFIG_REGULATOR_LP872X) += lp872x.o
 obj-$(CONFIG_REGULATOR_LP8788) += lp8788-buck.o
 obj-$(CONFIG_REGULATOR_LP8788) += lp8788-ldo.o
+obj-$(CONFIG_REGULATOR_LP8755) += lp8755.o
 obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o
 obj-$(CONFIG_REGULATOR_MAX8649)+= max8649.o
 obj-$(CONFIG_REGULATOR_MAX8660) += max8660.o
diff --git a/drivers/regulator/lp8755.c b/drivers/regulator/lp8755.c
new file mode 100644
index 000..dbc4d12
--- /dev/null
+++ b/drivers/regulator/lp8755.c
@@ -0,0 +1,580 @@
+/*
+ * LP8755 High Performance Power Management Unit : System Interface Driver
+ * (based on rev. 0.26)
+ * Copyright 2012 Texas Instruments
+ *
+ * Author: Daniel(Geon Si) Jeong 
+ *
+ * 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 
+
+#define LP8755_REG_BUCK0   0x00
+#define LP8755_REG_BUCK1   0x03
+#define LP8755_REG_BUCK2   0x04
+#define LP8755_REG_BUCK3   0x01
+#define LP8755_REG_BUCK4   0x05
+#define LP8755_REG_BUCK5   0x02
+#define LP8755_REG_MAX 0xFF
+
+#define LP8755_BUCK_EN_M   BIT(7)
+#define LP8755_BUCK_LINEAR_OUT_MAX 0x76
+#define LP8755_BUCK_VOUT_M 0x7F
+
+enum bucks {
+   BUCK0 = 0,
+   BUCK1,
+   BUCK2,
+   BUCK3,
+   BUCK4,
+   BUCK5,
+};
+
+struct lp8755_mphase {
+   int nreg;
+   int buck_num[LP8755_BUCK_MAX];
+};
+
+struct lp8755_chip {
+   struct device *dev;
+   struct regmap *regmap;
+   struct lp8755_platform_data *pdata;
+
+   int irq;
+   unsigned int irqmask;
+
+   int mphase;
+   struct regulator_dev *rdev[LP8755_BUCK_MAX];
+};
+
+/**
+ *lp8755_read : read a single register value from lp8755.
+ *@pchip : device to read from
+ *@reg   : register to read from
+ *@val   : pointer to store read value
+ */
+static int lp8755_read(struct lp8755_chip *pchip, unsigned int reg,
+  unsigned int *val)
+{
+   return regmap_read(pchip->regmap, reg, val);
+}
+
+/**
+ *lp8755_write : write a single register value to lp8755.
+ *@pchip : device to write to
+ *@reg   : register to write to
+ *@val   : value to be written
+ */
+static int lp8755_write(struct lp8755_chip *pchip, unsigned int reg,
+   unsigned int val)
+{
+   return regmap_write(pchip->regmap, reg, val);
+}
+
+/**
+ *lp8755_update_bits : set the values of bit fields in lp8755 register.
+ *@pchip : device to read from
+ *@reg   : register to update
+ *@mask  : bitmask to be changed
+ *@val   : value for bitmask
+ */
+static int lp8755_update_bits(struct lp8755_chip *pchip, unsigned int reg,
+ unsigned int mask, unsigned int val)
+{
+   return regmap_update_bits(pchip->regmap, reg, mask, val);
+}
+
+static int lp8755_buck_enable_time(struct regulator_dev *rdev)
+{
+   int ret;
+   unsigned int regval;
+   enum lp8755_bucks id = rdev_get_id(rdev);
+   struct lp8755_chip *pchip = rdev_get_drvdata(rdev);
+
+   ret = lp8755_read(pchip, 0x12 + id, );
+   if (ret < 0) {
+ 

[PATCH v2] regulator: new driver for LP8755

2012-12-16 Thread Daniel Jeong
This patch is for new lp8755 regulator dirver and 
several unsed variables were deleted and then test was done.

LP8755 :
The LP8755 is a high performance power management unit.It contains
six step-down DC-DC converters which can can be filexibly bundled
together in multiphase converters as required by application.
www.ti.com

Signed-off-by: Daniel Jeong gshark.je...@gmail.com
---
 drivers/regulator/Kconfig|9 +
 drivers/regulator/Makefile   |1 +
 drivers/regulator/lp8755.c   |  580 ++
 include/linux/platform_data/lp8755.h |   71 
 4 files changed, 661 insertions(+), 0 deletions(-)
 create mode 100644 drivers/regulator/lp8755.c
 create mode 100644 include/linux/platform_data/lp8755.h

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 67d47b59..dc83401 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -257,6 +257,15 @@ config REGULATOR_LP872X
help
  This driver supports LP8720/LP8725 PMIC
 
+config REGULATOR_LP8755
+   tristate TI LP8755 High Performance PMU driver
+   depends on I2C
+   select REGMAP_I2C
+   help
+ This driver supports LP8755 High Performance PMU driver. This
+ chip contains six step-down DC/DC converters which can support
+ 9 mode multiphase configuration.
+
 config REGULATOR_LP8788
bool TI LP8788 Power Regulators
depends on MFD_LP8788
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index e431eed..bf346b7 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -28,6 +28,7 @@ obj-$(CONFIG_REGULATOR_LP3972) += lp3972.o
 obj-$(CONFIG_REGULATOR_LP872X) += lp872x.o
 obj-$(CONFIG_REGULATOR_LP8788) += lp8788-buck.o
 obj-$(CONFIG_REGULATOR_LP8788) += lp8788-ldo.o
+obj-$(CONFIG_REGULATOR_LP8755) += lp8755.o
 obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o
 obj-$(CONFIG_REGULATOR_MAX8649)+= max8649.o
 obj-$(CONFIG_REGULATOR_MAX8660) += max8660.o
diff --git a/drivers/regulator/lp8755.c b/drivers/regulator/lp8755.c
new file mode 100644
index 000..dbc4d12
--- /dev/null
+++ b/drivers/regulator/lp8755.c
@@ -0,0 +1,580 @@
+/*
+ * LP8755 High Performance Power Management Unit : System Interface Driver
+ * (based on rev. 0.26)
+ * Copyright 2012 Texas Instruments
+ *
+ * Author: Daniel(Geon Si) Jeong daniel.je...@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/module.h
+#include linux/slab.h
+#include linux/i2c.h
+#include linux/err.h
+#include linux/irq.h
+#include linux/interrupt.h
+#include linux/gpio.h
+#include linux/regmap.h
+#include linux/delay.h
+#include linux/uaccess.h
+#include linux/regulator/driver.h
+#include linux/regulator/machine.h
+#include linux/platform_data/lp8755.h
+
+#define LP8755_REG_BUCK0   0x00
+#define LP8755_REG_BUCK1   0x03
+#define LP8755_REG_BUCK2   0x04
+#define LP8755_REG_BUCK3   0x01
+#define LP8755_REG_BUCK4   0x05
+#define LP8755_REG_BUCK5   0x02
+#define LP8755_REG_MAX 0xFF
+
+#define LP8755_BUCK_EN_M   BIT(7)
+#define LP8755_BUCK_LINEAR_OUT_MAX 0x76
+#define LP8755_BUCK_VOUT_M 0x7F
+
+enum bucks {
+   BUCK0 = 0,
+   BUCK1,
+   BUCK2,
+   BUCK3,
+   BUCK4,
+   BUCK5,
+};
+
+struct lp8755_mphase {
+   int nreg;
+   int buck_num[LP8755_BUCK_MAX];
+};
+
+struct lp8755_chip {
+   struct device *dev;
+   struct regmap *regmap;
+   struct lp8755_platform_data *pdata;
+
+   int irq;
+   unsigned int irqmask;
+
+   int mphase;
+   struct regulator_dev *rdev[LP8755_BUCK_MAX];
+};
+
+/**
+ *lp8755_read : read a single register value from lp8755.
+ *@pchip : device to read from
+ *@reg   : register to read from
+ *@val   : pointer to store read value
+ */
+static int lp8755_read(struct lp8755_chip *pchip, unsigned int reg,
+  unsigned int *val)
+{
+   return regmap_read(pchip-regmap, reg, val);
+}
+
+/**
+ *lp8755_write : write a single register value to lp8755.
+ *@pchip : device to write to
+ *@reg   : register to write to
+ *@val   : value to be written
+ */
+static int lp8755_write(struct lp8755_chip *pchip, unsigned int reg,
+   unsigned int val)
+{
+   return regmap_write(pchip-regmap, reg, val);
+}
+
+/**
+ *lp8755_update_bits : set the values of bit fields in lp8755 register.
+ *@pchip : device to read from
+ *@reg   : register to update
+ *@mask  : bitmask to be changed
+ *@val   : value for bitmask
+ */
+static int lp8755_update_bits(struct lp8755_chip *pchip, unsigned int reg,
+ unsigned int mask, unsigned int val)
+{
+   return regmap_update_bits(pchip-regmap, reg, mask, val);
+}
+
+static int lp8755_buck_enable_time(struct regulator_dev *rdev)
+{
+   int ret

[PATCH v1 resend] regulator: new driver for LP8755

2012-12-05 Thread Daniel Jeong
This driver is a general version for lp8755 regulator driver of TI.

LP8755 :
The LP8755 is a high performance power management unit.It contains
six step-down DC-DC converters which can can be filexibly bundled
together in multiphase converters as required by application.
www.ti.com

Signed-off-by: Daniel Jeong 
---
 drivers/regulator/Kconfig|9 +
 drivers/regulator/Makefile   |1 +
 drivers/regulator/lp8755.c   |  586 ++
 include/linux/platform_data/lp8755.h |   71 
 4 files changed, 667 insertions(+), 0 deletions(-)
 create mode 100644 drivers/regulator/lp8755.c
 create mode 100644 include/linux/platform_data/lp8755.h

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 67d47b59..63e37ff 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -257,6 +257,15 @@ config REGULATOR_LP872X
help
  This driver supports LP8720/LP8725 PMIC
 
+config REGULATOR_LP8755
+   tristate "TI LP8755 Hihg Performance PMU driver"
+   depends on I2C
+   select REGMAP_I2C
+   help
+ This driver supports LP8755 High Performance PMU driver. This
+ chip contains six step-down DC/DC converters which can support
+ 9 mode multiphase configuration.
+
 config REGULATOR_LP8788
bool "TI LP8788 Power Regulators"
depends on MFD_LP8788
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index e431eed..bf346b7 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -28,6 +28,7 @@ obj-$(CONFIG_REGULATOR_LP3972) += lp3972.o
 obj-$(CONFIG_REGULATOR_LP872X) += lp872x.o
 obj-$(CONFIG_REGULATOR_LP8788) += lp8788-buck.o
 obj-$(CONFIG_REGULATOR_LP8788) += lp8788-ldo.o
+obj-$(CONFIG_REGULATOR_LP8755) += lp8755.o
 obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o
 obj-$(CONFIG_REGULATOR_MAX8649)+= max8649.o
 obj-$(CONFIG_REGULATOR_MAX8660) += max8660.o
diff --git a/drivers/regulator/lp8755.c b/drivers/regulator/lp8755.c
new file mode 100644
index 000..0dfb2a8
--- /dev/null
+++ b/drivers/regulator/lp8755.c
@@ -0,0 +1,586 @@
+/*
+ * LP8755 High Performance Power Management Unit : System Interface Driver
+ * (based on rev. 0.26)
+ * Copyright 2012 Texas Instruments
+ *
+ * Author: Daniel(Geon Si) Jeong 
+ *
+ * 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 
+
+#define LP8755_REG_BUCK0   0x00
+#define LP8755_REG_BUCK1   0x03
+#define LP8755_REG_BUCK2   0x04
+#define LP8755_REG_BUCK3   0x01
+#define LP8755_REG_BUCK4   0x05
+#define LP8755_REG_BUCK5   0x02
+#define LP8755_REG_MAX 0xFF
+
+#define LP8755_BUCK_EN_M   BIT(7)
+#define LP8755_BUCK_LINEAR_OUT_MAX 0x76
+#define LP8755_BUCK_VOUT_M 0x7F
+
+enum bucks {
+   BUCK0 = 0,
+   BUCK1,
+   BUCK2,
+   BUCK3,
+   BUCK4,
+   BUCK5,
+};
+
+struct lp8755_mphase {
+   int nreg;
+   int buck_num[LP8755_BUCK_MAX];
+};
+
+struct lp8755_chip {
+   struct device *dev;
+   struct regmap *regmap;
+   struct lp8755_platform_data *pdata;
+
+   int irq;
+   unsigned int irqmask;
+
+   int num_reg;
+   int mphase;
+   struct regulator_dev *rdev[LP8755_BUCK_MAX];
+};
+
+/**
+ *lp8755_read : read a single register value from lp8755.
+ */
+static int lp8755_read(struct lp8755_chip *pchip, unsigned int reg,
+  unsigned int *val)
+{
+   return regmap_read(pchip->regmap, reg, val);
+}
+
+/**
+ *lp8755_write : write a single register value to lp8755.
+ */
+static int lp8755_write(struct lp8755_chip *pchip, unsigned int reg,
+   unsigned int val)
+{
+   return regmap_write(pchip->regmap, reg, val);
+}
+
+/**
+ *lp8755_update_bits : set the values of bit fields in lp8755 register.
+ */
+static int lp8755_update_bits(struct lp8755_chip *pchip, unsigned int reg,
+ unsigned int mask, unsigned int val)
+{
+   return regmap_update_bits(pchip->regmap, reg, mask, val);
+}
+
+static int lp8755_buck_enable_time(struct regulator_dev *rdev)
+{
+   int ret;
+   unsigned int regval;
+   enum lp8755_bucks id = rdev_get_id(rdev);
+   struct lp8755_chip *pchip = rdev_get_drvdata(rdev);
+
+   ret = lp8755_read(pchip, 0x12 + id, );
+   if (ret < 0) {
+   dev_err(pchip->dev, "i2c acceess error %s\n", __func__);
+   return ret;
+   }
+   return (regval & 0xff) * 100;
+}
+
+static int lp8755_buck_set_mode(struct regulator_dev *rdev, unsigned int mode)
+{
+   int ret;
+   unsigned int regbval = 0x0;
+   enum lp8755_bucks id = rde

[PATCH v1 resend] regulator: new driver for LP8755

2012-12-05 Thread Daniel Jeong
This driver is a general version for lp8755 regulator driver of TI.

LP8755 :
The LP8755 is a high performance power management unit.It contains
six step-down DC-DC converters which can can be filexibly bundled
together in multiphase converters as required by application.
www.ti.com

Signed-off-by: Daniel Jeong gshark.je...@gmail.com
---
 drivers/regulator/Kconfig|9 +
 drivers/regulator/Makefile   |1 +
 drivers/regulator/lp8755.c   |  586 ++
 include/linux/platform_data/lp8755.h |   71 
 4 files changed, 667 insertions(+), 0 deletions(-)
 create mode 100644 drivers/regulator/lp8755.c
 create mode 100644 include/linux/platform_data/lp8755.h

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 67d47b59..63e37ff 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -257,6 +257,15 @@ config REGULATOR_LP872X
help
  This driver supports LP8720/LP8725 PMIC
 
+config REGULATOR_LP8755
+   tristate TI LP8755 Hihg Performance PMU driver
+   depends on I2C
+   select REGMAP_I2C
+   help
+ This driver supports LP8755 High Performance PMU driver. This
+ chip contains six step-down DC/DC converters which can support
+ 9 mode multiphase configuration.
+
 config REGULATOR_LP8788
bool TI LP8788 Power Regulators
depends on MFD_LP8788
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index e431eed..bf346b7 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -28,6 +28,7 @@ obj-$(CONFIG_REGULATOR_LP3972) += lp3972.o
 obj-$(CONFIG_REGULATOR_LP872X) += lp872x.o
 obj-$(CONFIG_REGULATOR_LP8788) += lp8788-buck.o
 obj-$(CONFIG_REGULATOR_LP8788) += lp8788-ldo.o
+obj-$(CONFIG_REGULATOR_LP8755) += lp8755.o
 obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o
 obj-$(CONFIG_REGULATOR_MAX8649)+= max8649.o
 obj-$(CONFIG_REGULATOR_MAX8660) += max8660.o
diff --git a/drivers/regulator/lp8755.c b/drivers/regulator/lp8755.c
new file mode 100644
index 000..0dfb2a8
--- /dev/null
+++ b/drivers/regulator/lp8755.c
@@ -0,0 +1,586 @@
+/*
+ * LP8755 High Performance Power Management Unit : System Interface Driver
+ * (based on rev. 0.26)
+ * Copyright 2012 Texas Instruments
+ *
+ * Author: Daniel(Geon Si) Jeong daniel.je...@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/module.h
+#include linux/slab.h
+#include linux/i2c.h
+#include linux/err.h
+#include linux/irq.h
+#include linux/interrupt.h
+#include linux/gpio.h
+#include linux/regmap.h
+#include linux/delay.h
+#include linux/uaccess.h
+#include linux/regulator/driver.h
+#include linux/regulator/machine.h
+#include linux/platform_data/lp8755.h
+
+#define LP8755_REG_BUCK0   0x00
+#define LP8755_REG_BUCK1   0x03
+#define LP8755_REG_BUCK2   0x04
+#define LP8755_REG_BUCK3   0x01
+#define LP8755_REG_BUCK4   0x05
+#define LP8755_REG_BUCK5   0x02
+#define LP8755_REG_MAX 0xFF
+
+#define LP8755_BUCK_EN_M   BIT(7)
+#define LP8755_BUCK_LINEAR_OUT_MAX 0x76
+#define LP8755_BUCK_VOUT_M 0x7F
+
+enum bucks {
+   BUCK0 = 0,
+   BUCK1,
+   BUCK2,
+   BUCK3,
+   BUCK4,
+   BUCK5,
+};
+
+struct lp8755_mphase {
+   int nreg;
+   int buck_num[LP8755_BUCK_MAX];
+};
+
+struct lp8755_chip {
+   struct device *dev;
+   struct regmap *regmap;
+   struct lp8755_platform_data *pdata;
+
+   int irq;
+   unsigned int irqmask;
+
+   int num_reg;
+   int mphase;
+   struct regulator_dev *rdev[LP8755_BUCK_MAX];
+};
+
+/**
+ *lp8755_read : read a single register value from lp8755.
+ */
+static int lp8755_read(struct lp8755_chip *pchip, unsigned int reg,
+  unsigned int *val)
+{
+   return regmap_read(pchip-regmap, reg, val);
+}
+
+/**
+ *lp8755_write : write a single register value to lp8755.
+ */
+static int lp8755_write(struct lp8755_chip *pchip, unsigned int reg,
+   unsigned int val)
+{
+   return regmap_write(pchip-regmap, reg, val);
+}
+
+/**
+ *lp8755_update_bits : set the values of bit fields in lp8755 register.
+ */
+static int lp8755_update_bits(struct lp8755_chip *pchip, unsigned int reg,
+ unsigned int mask, unsigned int val)
+{
+   return regmap_update_bits(pchip-regmap, reg, mask, val);
+}
+
+static int lp8755_buck_enable_time(struct regulator_dev *rdev)
+{
+   int ret;
+   unsigned int regval;
+   enum lp8755_bucks id = rdev_get_id(rdev);
+   struct lp8755_chip *pchip = rdev_get_drvdata(rdev);
+
+   ret = lp8755_read(pchip, 0x12 + id, regval);
+   if (ret  0) {
+   dev_err(pchip-dev, i2c acceess error %s\n, __func__);
+   return ret;
+   }
+   return (regval  0xff) * 100

[PATCH 1/1] regulator: new driver for LP8755

2012-12-02 Thread Daniel Jeong
From: Daniel Jeong 

This driver is a general version for lp8755 regulator driver of TI.

LP8755 :
The LP8755 is a high performance power management unit.It contains
six step-down DC-DC converters which can be filexibly bundled
together in multiphase converters as required by application.
www.ti.com

Signed-off-by: Daniel Jeong 
---
 drivers/regulator/Kconfig|9 +
 drivers/regulator/Makefile   |1 +
 drivers/regulator/lp8755.c   |  553 ++
 include/linux/platform_data/lp8755.h |   72 +
 4 files changed, 635 insertions(+), 0 deletions(-)
 create mode 100644 drivers/regulator/lp8755.c
 create mode 100644 include/linux/platform_data/lp8755.h

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 67d47b59..63e37ff 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -257,6 +257,15 @@ config REGULATOR_LP872X
help
  This driver supports LP8720/LP8725 PMIC
 
+config REGULATOR_LP8755
+   tristate "TI LP8755 Hihg Performance PMU driver"
+   depends on I2C
+   select REGMAP_I2C
+   help
+ This driver supports LP8755 High Performance PMU driver. This
+ chip contains six step-down DC/DC converters which can support
+ 9 mode multiphase configuration.
+
 config REGULATOR_LP8788
bool "TI LP8788 Power Regulators"
depends on MFD_LP8788
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index e431eed..bf346b7 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -28,6 +28,7 @@ obj-$(CONFIG_REGULATOR_LP3972) += lp3972.o
 obj-$(CONFIG_REGULATOR_LP872X) += lp872x.o
 obj-$(CONFIG_REGULATOR_LP8788) += lp8788-buck.o
 obj-$(CONFIG_REGULATOR_LP8788) += lp8788-ldo.o
+obj-$(CONFIG_REGULATOR_LP8755) += lp8755.o
 obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o
 obj-$(CONFIG_REGULATOR_MAX8649)+= max8649.o
 obj-$(CONFIG_REGULATOR_MAX8660) += max8660.o
diff --git a/drivers/regulator/lp8755.c b/drivers/regulator/lp8755.c
new file mode 100644
index 000..00d0763
--- /dev/null
+++ b/drivers/regulator/lp8755.c
@@ -0,0 +1,553 @@
+/*
+ * LP8755 High Performance Power Management Unit : System Interface Driver
+ * (based on rev. 0)
+ * Copyright 2012 Texas Instruments
+ *
+ * Author: Daniel(Geon Si) Jeong 
+ *
+ * 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 
+
+#define LP8755_REG_BUCK0   0x00
+#define LP8755_REG_BUCK1   0x03
+#define LP8755_REG_BUCK2   0x04
+#define LP8755_REG_BUCK3   0x01
+#define LP8755_REG_BUCK4   0x05
+#define LP8755_REG_BUCK5   0x02
+#define LP8755_REG_MAX 0xFF
+
+#define LP8755_BUCK_EN_M   BIT(7)
+#define LP8755_BUCK_VOUT_M 0x7F
+
+enum bucks {
+   BUCK0 = 0,
+   BUCK1,
+   BUCK2,
+   BUCK3,
+   BUCK4,
+   BUCK5,
+};
+
+struct lp8755_mphase {
+   int nreg;
+   int buck_num[LP8755_BUCK_MAX];
+};
+
+struct lp8755_chip {
+   struct device *dev;
+   struct regmap *regmap;
+   struct lp8755_platform_data *pdata;
+
+   int irq;
+   unsigned int irqmask;
+
+   int num_reg;
+   int mphase;
+   struct regulator_dev *rdev[LP8755_BUCK_MAX];
+};
+
+static int lp8755_read(struct lp8755_chip *pchip, unsigned int reg,
+  unsigned int *val)
+{
+   return regmap_read(pchip->regmap, reg, val);
+}
+
+static int lp8755_write(struct lp8755_chip *pchip, unsigned int reg,
+   unsigned int val)
+{
+   return regmap_write(pchip->regmap, reg, val);
+}
+
+static int lp8755_buck_enable_time(struct regulator_dev *rdev)
+{
+   unsigned int regval;
+   enum lp8755_bucks id = rdev_get_id(rdev);
+   struct lp8755_chip *pchip = rdev_get_drvdata(rdev);
+
+   if (lp8755_read(pchip, 0x12 + id, ) < 0) {
+   dev_err(pchip->dev, "i2c acceess error %s\n", __func__);
+   return -EINVAL;
+   }
+   return (regval & 0xff) * 100;
+}
+
+static int lp8755_buck_set_mode(struct regulator_dev *rdev, unsigned int mode)
+{
+   unsigned int regbval, regcval;
+   enum lp8755_bucks id = rdev_get_id(rdev);
+   struct lp8755_chip *pchip = rdev_get_drvdata(rdev);
+
+   if (lp8755_read(pchip, 0x06, ) < 0)
+   goto err_i2c;
+
+   switch (mode) {
+   case REGULATOR_MODE_FAST:
+   /* forced pwm mode */
+   regbval |= (0x01 << id);
+   break;
+   case REGULATOR_MODE_NORMAL:
+   /* enable automatic pwm/pfm mode */
+   regbval &= ~(0x01 << id);
+   if (lp8755_read(pchip, 0x08 + id, ) < 0)
+ 

[PATCH 0/1] regulator: new driver for LP8755

2012-12-02 Thread Daniel Jeong
From: Daniel Jeong 

This driver is a general version for lp8755 regulator driver of TI.

LP8755 :
The LP8755 is a high performance power management unit.It contains
six step-down DC-DC converters which can be filexibly bundled
together in multiphase converters as required by application.

www.ti.com

Daniel Jeong (1):
  regulator: new driver for LP8755

 drivers/regulator/Kconfig|9 +
 drivers/regulator/Makefile   |1 +
 drivers/regulator/lp8755.c   |  553 ++
 include/linux/platform_data/lp8755.h |   72 +
 4 files changed, 635 insertions(+), 0 deletions(-)
 create mode 100644 drivers/regulator/lp8755.c
 create mode 100644 include/linux/platform_data/lp8755.h

-- 
1.7.5.4

--
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/


[PATCH 0/1] regulator: new driver for LP8755

2012-12-02 Thread Daniel Jeong
From: Daniel Jeong daniel.je...@ti.com

This driver is a general version for lp8755 regulator driver of TI.

LP8755 :
The LP8755 is a high performance power management unit.It contains
six step-down DC-DC converters which can be filexibly bundled
together in multiphase converters as required by application.

www.ti.com

Daniel Jeong (1):
  regulator: new driver for LP8755

 drivers/regulator/Kconfig|9 +
 drivers/regulator/Makefile   |1 +
 drivers/regulator/lp8755.c   |  553 ++
 include/linux/platform_data/lp8755.h |   72 +
 4 files changed, 635 insertions(+), 0 deletions(-)
 create mode 100644 drivers/regulator/lp8755.c
 create mode 100644 include/linux/platform_data/lp8755.h

-- 
1.7.5.4

--
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/


[PATCH 1/1] regulator: new driver for LP8755

2012-12-02 Thread Daniel Jeong
From: Daniel Jeong daniel.je...@ti.com

This driver is a general version for lp8755 regulator driver of TI.

LP8755 :
The LP8755 is a high performance power management unit.It contains
six step-down DC-DC converters which can be filexibly bundled
together in multiphase converters as required by application.
www.ti.com

Signed-off-by: Daniel Jeong daniel.je...@ti.com
---
 drivers/regulator/Kconfig|9 +
 drivers/regulator/Makefile   |1 +
 drivers/regulator/lp8755.c   |  553 ++
 include/linux/platform_data/lp8755.h |   72 +
 4 files changed, 635 insertions(+), 0 deletions(-)
 create mode 100644 drivers/regulator/lp8755.c
 create mode 100644 include/linux/platform_data/lp8755.h

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 67d47b59..63e37ff 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -257,6 +257,15 @@ config REGULATOR_LP872X
help
  This driver supports LP8720/LP8725 PMIC
 
+config REGULATOR_LP8755
+   tristate TI LP8755 Hihg Performance PMU driver
+   depends on I2C
+   select REGMAP_I2C
+   help
+ This driver supports LP8755 High Performance PMU driver. This
+ chip contains six step-down DC/DC converters which can support
+ 9 mode multiphase configuration.
+
 config REGULATOR_LP8788
bool TI LP8788 Power Regulators
depends on MFD_LP8788
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index e431eed..bf346b7 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -28,6 +28,7 @@ obj-$(CONFIG_REGULATOR_LP3972) += lp3972.o
 obj-$(CONFIG_REGULATOR_LP872X) += lp872x.o
 obj-$(CONFIG_REGULATOR_LP8788) += lp8788-buck.o
 obj-$(CONFIG_REGULATOR_LP8788) += lp8788-ldo.o
+obj-$(CONFIG_REGULATOR_LP8755) += lp8755.o
 obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o
 obj-$(CONFIG_REGULATOR_MAX8649)+= max8649.o
 obj-$(CONFIG_REGULATOR_MAX8660) += max8660.o
diff --git a/drivers/regulator/lp8755.c b/drivers/regulator/lp8755.c
new file mode 100644
index 000..00d0763
--- /dev/null
+++ b/drivers/regulator/lp8755.c
@@ -0,0 +1,553 @@
+/*
+ * LP8755 High Performance Power Management Unit : System Interface Driver
+ * (based on rev. 0)
+ * Copyright 2012 Texas Instruments
+ *
+ * Author: Daniel(Geon Si) Jeong daniel.je...@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/module.h
+#include linux/slab.h
+#include linux/i2c.h
+#include linux/err.h
+#include linux/irq.h
+#include linux/interrupt.h
+#include linux/gpio.h
+#include linux/regmap.h
+#include linux/delay.h
+#include linux/uaccess.h
+#include linux/regulator/driver.h
+#include linux/platform_data/lp8755.h
+
+#define LP8755_REG_BUCK0   0x00
+#define LP8755_REG_BUCK1   0x03
+#define LP8755_REG_BUCK2   0x04
+#define LP8755_REG_BUCK3   0x01
+#define LP8755_REG_BUCK4   0x05
+#define LP8755_REG_BUCK5   0x02
+#define LP8755_REG_MAX 0xFF
+
+#define LP8755_BUCK_EN_M   BIT(7)
+#define LP8755_BUCK_VOUT_M 0x7F
+
+enum bucks {
+   BUCK0 = 0,
+   BUCK1,
+   BUCK2,
+   BUCK3,
+   BUCK4,
+   BUCK5,
+};
+
+struct lp8755_mphase {
+   int nreg;
+   int buck_num[LP8755_BUCK_MAX];
+};
+
+struct lp8755_chip {
+   struct device *dev;
+   struct regmap *regmap;
+   struct lp8755_platform_data *pdata;
+
+   int irq;
+   unsigned int irqmask;
+
+   int num_reg;
+   int mphase;
+   struct regulator_dev *rdev[LP8755_BUCK_MAX];
+};
+
+static int lp8755_read(struct lp8755_chip *pchip, unsigned int reg,
+  unsigned int *val)
+{
+   return regmap_read(pchip-regmap, reg, val);
+}
+
+static int lp8755_write(struct lp8755_chip *pchip, unsigned int reg,
+   unsigned int val)
+{
+   return regmap_write(pchip-regmap, reg, val);
+}
+
+static int lp8755_buck_enable_time(struct regulator_dev *rdev)
+{
+   unsigned int regval;
+   enum lp8755_bucks id = rdev_get_id(rdev);
+   struct lp8755_chip *pchip = rdev_get_drvdata(rdev);
+
+   if (lp8755_read(pchip, 0x12 + id, regval)  0) {
+   dev_err(pchip-dev, i2c acceess error %s\n, __func__);
+   return -EINVAL;
+   }
+   return (regval  0xff) * 100;
+}
+
+static int lp8755_buck_set_mode(struct regulator_dev *rdev, unsigned int mode)
+{
+   unsigned int regbval, regcval;
+   enum lp8755_bucks id = rdev_get_id(rdev);
+   struct lp8755_chip *pchip = rdev_get_drvdata(rdev);
+
+   if (lp8755_read(pchip, 0x06, regbval)  0)
+   goto err_i2c;
+
+   switch (mode) {
+   case REGULATOR_MODE_FAST:
+   /* forced pwm mode */
+   regbval |= (0x01  id);
+   break;
+   case REGULATOR_MODE_NORMAL