[PATCH v10 2/6] backlight: Add support Skyworks SKY81452 backlight driver

2015-01-22 Thread gyungoh
From: Gyungoh Yoo 

Signed-off-by: Gyungoh Yoo 
Acked-by: Jingoo Han 
Acked-by: Bryan Wu 
---
Changes v10:
Removed trivial get_brightness implementations

Changes v9:
Nothing

Changes v8:
Renamed property names for backlight with vendor prefix
Modified gpio-enable property to generic property for GPIO

Changes v7:
Modified licensing text to GPLv2

Changes v6:
Added new line character at the end of line of dev_err()

Changes v5:
Move sky81452-backlight.h to include/linux/platform_data

Changes v4:
Reordering header files for readability
Removed calling to backlight_device_unregister()
Removed MODULE_VERSION()
Modified license to GPLv2

Changes v3:
Modified DBG messages

Changes v2:
Added 'compatible' attribute in the driver
Added message for exception or errors

 drivers/video/backlight/Kconfig  |  10 +
 drivers/video/backlight/Makefile |   1 +
 drivers/video/backlight/sky81452-backlight.c | 334 +++
 include/linux/platform_data/sky81452-backlight.h |  46 
 4 files changed, 391 insertions(+)
 create mode 100644 drivers/video/backlight/sky81452-backlight.c
 create mode 100644 include/linux/platform_data/sky81452-backlight.h

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 8d03924..2586fdd 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -409,6 +409,16 @@ config BACKLIGHT_PANDORA
  If you have a Pandora console, say Y to enable the
  backlight driver.
 
+config BACKLIGHT_SKY81452
+   tristate "Backlight driver for SKY81452"
+   depends on BACKLIGHT_CLASS_DEVICE && MFD_SKY81452
+   help
+ If you have a Skyworks SKY81452, say Y to enable the
+ backlight driver.
+
+ To compile this driver as a module, choose M here: the module will
+ be called sky81452-backlight
+
 config BACKLIGHT_TPS65217
tristate "TPS65217 Backlight"
depends on BACKLIGHT_CLASS_DEVICE && MFD_TPS65217
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index fcd50b73..d67073f 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -50,6 +50,7 @@ obj-$(CONFIG_BACKLIGHT_PANDORA)   += pandora_bl.o
 obj-$(CONFIG_BACKLIGHT_PCF50633)   += pcf50633-backlight.o
 obj-$(CONFIG_BACKLIGHT_PWM)+= pwm_bl.o
 obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o
+obj-$(CONFIG_BACKLIGHT_SKY81452)   += sky81452-backlight.o
 obj-$(CONFIG_BACKLIGHT_TOSA)   += tosa_bl.o
 obj-$(CONFIG_BACKLIGHT_TPS65217)   += tps65217_bl.o
 obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o
diff --git a/drivers/video/backlight/sky81452-backlight.c 
b/drivers/video/backlight/sky81452-backlight.c
new file mode 100644
index 000..8105597
--- /dev/null
+++ b/drivers/video/backlight/sky81452-backlight.c
@@ -0,0 +1,334 @@
+/*
+ * sky81452-backlight.cSKY81452 backlight driver
+ *
+ * Copyright 2014 Skyworks Solutions Inc.
+ * Author : Gyungoh Yoo 
+ *
+ * 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, see .
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* registers */
+#define SKY81452_REG0  0x00
+#define SKY81452_REG1  0x01
+#define SKY81452_REG2  0x02
+#define SKY81452_REG4  0x04
+#define SKY81452_REG5  0x05
+
+/* bit mask */
+#define SKY81452_CS0xFF
+#define SKY81452_EN0x3F
+#define SKY81452_IGPW  0x20
+#define SKY81452_PWMMD 0x10
+#define SKY81452_PHASE 0x08
+#define SKY81452_ILIM  0x04
+#define SKY81452_VSHRT 0x03
+#define SKY81452_OCP   0x80
+#define SKY81452_OTMP  0x40
+#define SKY81452_SHRT  0x3F
+#define SKY81452_OPN   0x3F
+
+#define SKY81452_DEFAULT_NAME "lcd-backlight"
+#define SKY81452_MAX_BRIGHTNESS(SKY81452_CS + 1)
+
+#define CTZ(b) __builtin_ctz(b)
+
+static int sky81452_bl_update_status(struct backlight_device *bd)
+{
+   const struct sky81452_bl_platform_data *pdata =
+   dev_get_platdata(bd->dev.parent);
+   const unsigned int brightness = (unsigned int)bd->props.brightness;
+   struct regmap *regmap = bl_get_data(bd);
+   int ret;
+
+   if (brightness > 0) {
+   ret = regmap_write(regmap, SKY81452_REG0, brightness - 1);
+   if (IS_ERR_VALUE(ret))
+   return ret;
+
+   return regmap_update_bits(regmap, SKY81452_REG1, 

[PATCH v10 2/6] backlight: Add support Skyworks SKY81452 backlight driver

2015-01-22 Thread gyungoh
From: Gyungoh Yoo jack@skyworksinc.com

Signed-off-by: Gyungoh Yoo jack@skyworksinc.com
Acked-by: Jingoo Han jg1@samsung.com
Acked-by: Bryan Wu coolo...@gmail.com
---
Changes v10:
Removed trivial get_brightness implementations

Changes v9:
Nothing

Changes v8:
Renamed property names for backlight with vendor prefix
Modified gpio-enable property to generic property for GPIO

Changes v7:
Modified licensing text to GPLv2

Changes v6:
Added new line character at the end of line of dev_err()

Changes v5:
Move sky81452-backlight.h to include/linux/platform_data

Changes v4:
Reordering header files for readability
Removed calling to backlight_device_unregister()
Removed MODULE_VERSION()
Modified license to GPLv2

Changes v3:
Modified DBG messages

Changes v2:
Added 'compatible' attribute in the driver
Added message for exception or errors

 drivers/video/backlight/Kconfig  |  10 +
 drivers/video/backlight/Makefile |   1 +
 drivers/video/backlight/sky81452-backlight.c | 334 +++
 include/linux/platform_data/sky81452-backlight.h |  46 
 4 files changed, 391 insertions(+)
 create mode 100644 drivers/video/backlight/sky81452-backlight.c
 create mode 100644 include/linux/platform_data/sky81452-backlight.h

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 8d03924..2586fdd 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -409,6 +409,16 @@ config BACKLIGHT_PANDORA
  If you have a Pandora console, say Y to enable the
  backlight driver.
 
+config BACKLIGHT_SKY81452
+   tristate Backlight driver for SKY81452
+   depends on BACKLIGHT_CLASS_DEVICE  MFD_SKY81452
+   help
+ If you have a Skyworks SKY81452, say Y to enable the
+ backlight driver.
+
+ To compile this driver as a module, choose M here: the module will
+ be called sky81452-backlight
+
 config BACKLIGHT_TPS65217
tristate TPS65217 Backlight
depends on BACKLIGHT_CLASS_DEVICE  MFD_TPS65217
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index fcd50b73..d67073f 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -50,6 +50,7 @@ obj-$(CONFIG_BACKLIGHT_PANDORA)   += pandora_bl.o
 obj-$(CONFIG_BACKLIGHT_PCF50633)   += pcf50633-backlight.o
 obj-$(CONFIG_BACKLIGHT_PWM)+= pwm_bl.o
 obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o
+obj-$(CONFIG_BACKLIGHT_SKY81452)   += sky81452-backlight.o
 obj-$(CONFIG_BACKLIGHT_TOSA)   += tosa_bl.o
 obj-$(CONFIG_BACKLIGHT_TPS65217)   += tps65217_bl.o
 obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o
diff --git a/drivers/video/backlight/sky81452-backlight.c 
b/drivers/video/backlight/sky81452-backlight.c
new file mode 100644
index 000..8105597
--- /dev/null
+++ b/drivers/video/backlight/sky81452-backlight.c
@@ -0,0 +1,334 @@
+/*
+ * sky81452-backlight.cSKY81452 backlight driver
+ *
+ * Copyright 2014 Skyworks Solutions Inc.
+ * Author : Gyungoh Yoo jack@skyworksinc.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, see http://www.gnu.org/licenses/.
+ */
+
+#include linux/backlight.h
+#include linux/err.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/platform_device.h
+#include linux/regmap.h
+#include linux/platform_data/sky81452-backlight.h
+#include linux/slab.h
+
+/* registers */
+#define SKY81452_REG0  0x00
+#define SKY81452_REG1  0x01
+#define SKY81452_REG2  0x02
+#define SKY81452_REG4  0x04
+#define SKY81452_REG5  0x05
+
+/* bit mask */
+#define SKY81452_CS0xFF
+#define SKY81452_EN0x3F
+#define SKY81452_IGPW  0x20
+#define SKY81452_PWMMD 0x10
+#define SKY81452_PHASE 0x08
+#define SKY81452_ILIM  0x04
+#define SKY81452_VSHRT 0x03
+#define SKY81452_OCP   0x80
+#define SKY81452_OTMP  0x40
+#define SKY81452_SHRT  0x3F
+#define SKY81452_OPN   0x3F
+
+#define SKY81452_DEFAULT_NAME lcd-backlight
+#define SKY81452_MAX_BRIGHTNESS(SKY81452_CS + 1)
+
+#define CTZ(b) __builtin_ctz(b)
+
+static int sky81452_bl_update_status(struct backlight_device *bd)
+{
+   const struct sky81452_bl_platform_data *pdata =
+   dev_get_platdata(bd-dev.parent);
+   const unsigned int brightness = (unsigned int)bd-props.brightness;
+   struct regmap *regmap 

[PATCH v10 2/6] backlight: Add support Skyworks SKY81452 backlight driver

2015-01-06 Thread gyungoh
From: Gyungoh Yoo 

Signed-off-by: Gyungoh Yoo 
Acked-by: Jingoo Han 
Acked-by: Bryan Wu 
---
Changes v10:
Removed trivial get_brightness implementations

Changes v9:
Nothing

Changes v8:
Renamed property names for backlight with vendor prefix
Modified gpio-enable property to generic property for GPIO

Changes v7:
Modified licensing text to GPLv2

Changes v6:
Added new line character at the end of line of dev_err()

Changes v5:
Move sky81452-backlight.h to include/linux/platform_data

Changes v4:
Reordering header files for readability
Removed calling to backlight_device_unregister()
Removed MODULE_VERSION()
Modified license to GPLv2

Changes v3:
Modified DBG messages

Changes v2:
Added 'compatible' attribute in the driver
Added message for exception or errors

 drivers/video/backlight/Kconfig  |  10 +
 drivers/video/backlight/Makefile |   1 +
 drivers/video/backlight/sky81452-backlight.c | 334 +++
 include/linux/platform_data/sky81452-backlight.h |  46 
 4 files changed, 391 insertions(+)
 create mode 100644 drivers/video/backlight/sky81452-backlight.c
 create mode 100644 include/linux/platform_data/sky81452-backlight.h

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 8d03924..2586fdd 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -409,6 +409,16 @@ config BACKLIGHT_PANDORA
  If you have a Pandora console, say Y to enable the
  backlight driver.
 
+config BACKLIGHT_SKY81452
+   tristate "Backlight driver for SKY81452"
+   depends on BACKLIGHT_CLASS_DEVICE && MFD_SKY81452
+   help
+ If you have a Skyworks SKY81452, say Y to enable the
+ backlight driver.
+
+ To compile this driver as a module, choose M here: the module will
+ be called sky81452-backlight
+
 config BACKLIGHT_TPS65217
tristate "TPS65217 Backlight"
depends on BACKLIGHT_CLASS_DEVICE && MFD_TPS65217
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index fcd50b73..d67073f 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -50,6 +50,7 @@ obj-$(CONFIG_BACKLIGHT_PANDORA)   += pandora_bl.o
 obj-$(CONFIG_BACKLIGHT_PCF50633)   += pcf50633-backlight.o
 obj-$(CONFIG_BACKLIGHT_PWM)+= pwm_bl.o
 obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o
+obj-$(CONFIG_BACKLIGHT_SKY81452)   += sky81452-backlight.o
 obj-$(CONFIG_BACKLIGHT_TOSA)   += tosa_bl.o
 obj-$(CONFIG_BACKLIGHT_TPS65217)   += tps65217_bl.o
 obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o
diff --git a/drivers/video/backlight/sky81452-backlight.c 
b/drivers/video/backlight/sky81452-backlight.c
new file mode 100644
index 000..8105597
--- /dev/null
+++ b/drivers/video/backlight/sky81452-backlight.c
@@ -0,0 +1,334 @@
+/*
+ * sky81452-backlight.cSKY81452 backlight driver
+ *
+ * Copyright 2014 Skyworks Solutions Inc.
+ * Author : Gyungoh Yoo 
+ *
+ * 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, see .
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* registers */
+#define SKY81452_REG0  0x00
+#define SKY81452_REG1  0x01
+#define SKY81452_REG2  0x02
+#define SKY81452_REG4  0x04
+#define SKY81452_REG5  0x05
+
+/* bit mask */
+#define SKY81452_CS0xFF
+#define SKY81452_EN0x3F
+#define SKY81452_IGPW  0x20
+#define SKY81452_PWMMD 0x10
+#define SKY81452_PHASE 0x08
+#define SKY81452_ILIM  0x04
+#define SKY81452_VSHRT 0x03
+#define SKY81452_OCP   0x80
+#define SKY81452_OTMP  0x40
+#define SKY81452_SHRT  0x3F
+#define SKY81452_OPN   0x3F
+
+#define SKY81452_DEFAULT_NAME "lcd-backlight"
+#define SKY81452_MAX_BRIGHTNESS(SKY81452_CS + 1)
+
+#define CTZ(b) __builtin_ctz(b)
+
+static int sky81452_bl_update_status(struct backlight_device *bd)
+{
+   const struct sky81452_bl_platform_data *pdata =
+   dev_get_platdata(bd->dev.parent);
+   const unsigned int brightness = (unsigned int)bd->props.brightness;
+   struct regmap *regmap = bl_get_data(bd);
+   int ret;
+
+   if (brightness > 0) {
+   ret = regmap_write(regmap, SKY81452_REG0, brightness - 1);
+   if (IS_ERR_VALUE(ret))
+   return ret;
+
+   return regmap_update_bits(regmap, SKY81452_REG1, 

[PATCH v10 2/6] backlight: Add support Skyworks SKY81452 backlight driver

2015-01-06 Thread gyungoh
From: Gyungoh Yoo jack@skyworksinc.com

Signed-off-by: Gyungoh Yoo jack@skyworksinc.com
Acked-by: Jingoo Han jg1@samsung.com
Acked-by: Bryan Wu coolo...@gmail.com
---
Changes v10:
Removed trivial get_brightness implementations

Changes v9:
Nothing

Changes v8:
Renamed property names for backlight with vendor prefix
Modified gpio-enable property to generic property for GPIO

Changes v7:
Modified licensing text to GPLv2

Changes v6:
Added new line character at the end of line of dev_err()

Changes v5:
Move sky81452-backlight.h to include/linux/platform_data

Changes v4:
Reordering header files for readability
Removed calling to backlight_device_unregister()
Removed MODULE_VERSION()
Modified license to GPLv2

Changes v3:
Modified DBG messages

Changes v2:
Added 'compatible' attribute in the driver
Added message for exception or errors

 drivers/video/backlight/Kconfig  |  10 +
 drivers/video/backlight/Makefile |   1 +
 drivers/video/backlight/sky81452-backlight.c | 334 +++
 include/linux/platform_data/sky81452-backlight.h |  46 
 4 files changed, 391 insertions(+)
 create mode 100644 drivers/video/backlight/sky81452-backlight.c
 create mode 100644 include/linux/platform_data/sky81452-backlight.h

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 8d03924..2586fdd 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -409,6 +409,16 @@ config BACKLIGHT_PANDORA
  If you have a Pandora console, say Y to enable the
  backlight driver.
 
+config BACKLIGHT_SKY81452
+   tristate Backlight driver for SKY81452
+   depends on BACKLIGHT_CLASS_DEVICE  MFD_SKY81452
+   help
+ If you have a Skyworks SKY81452, say Y to enable the
+ backlight driver.
+
+ To compile this driver as a module, choose M here: the module will
+ be called sky81452-backlight
+
 config BACKLIGHT_TPS65217
tristate TPS65217 Backlight
depends on BACKLIGHT_CLASS_DEVICE  MFD_TPS65217
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index fcd50b73..d67073f 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -50,6 +50,7 @@ obj-$(CONFIG_BACKLIGHT_PANDORA)   += pandora_bl.o
 obj-$(CONFIG_BACKLIGHT_PCF50633)   += pcf50633-backlight.o
 obj-$(CONFIG_BACKLIGHT_PWM)+= pwm_bl.o
 obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o
+obj-$(CONFIG_BACKLIGHT_SKY81452)   += sky81452-backlight.o
 obj-$(CONFIG_BACKLIGHT_TOSA)   += tosa_bl.o
 obj-$(CONFIG_BACKLIGHT_TPS65217)   += tps65217_bl.o
 obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o
diff --git a/drivers/video/backlight/sky81452-backlight.c 
b/drivers/video/backlight/sky81452-backlight.c
new file mode 100644
index 000..8105597
--- /dev/null
+++ b/drivers/video/backlight/sky81452-backlight.c
@@ -0,0 +1,334 @@
+/*
+ * sky81452-backlight.cSKY81452 backlight driver
+ *
+ * Copyright 2014 Skyworks Solutions Inc.
+ * Author : Gyungoh Yoo jack@skyworksinc.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, see http://www.gnu.org/licenses/.
+ */
+
+#include linux/backlight.h
+#include linux/err.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/platform_device.h
+#include linux/regmap.h
+#include linux/platform_data/sky81452-backlight.h
+#include linux/slab.h
+
+/* registers */
+#define SKY81452_REG0  0x00
+#define SKY81452_REG1  0x01
+#define SKY81452_REG2  0x02
+#define SKY81452_REG4  0x04
+#define SKY81452_REG5  0x05
+
+/* bit mask */
+#define SKY81452_CS0xFF
+#define SKY81452_EN0x3F
+#define SKY81452_IGPW  0x20
+#define SKY81452_PWMMD 0x10
+#define SKY81452_PHASE 0x08
+#define SKY81452_ILIM  0x04
+#define SKY81452_VSHRT 0x03
+#define SKY81452_OCP   0x80
+#define SKY81452_OTMP  0x40
+#define SKY81452_SHRT  0x3F
+#define SKY81452_OPN   0x3F
+
+#define SKY81452_DEFAULT_NAME lcd-backlight
+#define SKY81452_MAX_BRIGHTNESS(SKY81452_CS + 1)
+
+#define CTZ(b) __builtin_ctz(b)
+
+static int sky81452_bl_update_status(struct backlight_device *bd)
+{
+   const struct sky81452_bl_platform_data *pdata =
+   dev_get_platdata(bd-dev.parent);
+   const unsigned int brightness = (unsigned int)bd-props.brightness;
+   struct regmap *regmap 

Re: [PATCH v10 2/6] backlight: Add support Skyworks SKY81452 backlight driver

2014-12-17 Thread Gyungoh Yoo
On Thu, Dec 18, 2014 at 03:09:21PM +0900, Jingoo Han wrote:
> On Thursday, December 18, 2014 2:48 PM, Gyungoh Yoo wrote:
> > 
> > From: Gyungoh Yoo 
> > 
> > Signed-off-by: Gyungoh Yoo 
> 
> Please add the following 'Acked-by's when you send this patch
> next time.
> 
> Acked-by: Jingoo Han 
> Acked-by: Bryan Wu 

I see.
Thank you.

> 
> Best regards,
> Jingoo Han
> 
> > ---
> > Changes v10:
> > Removed trivial get_brightness implementations
> > 
> > Changes v9:
> > Nothing
> > 
> > Changes v8:
> > Renamed property names for backlight with vendor prefix
> > Modified gpio-enable property to generic property for GPIO
> > 
> > Changes v7:
> > Modified licensing text to GPLv2
> > 
> > Changes v6:
> > Added new line character at the end of line of dev_err()
> > 
> > Changes v5:
> > Move sky81452-backlight.h to include/linux/platform_data
> > 
> > Changes v4:
> > Reordering header files for readability
> > Removed calling to backlight_device_unregister()
> > Removed MODULE_VERSION()
> > Modified license to GPLv2
> > 
> > Changes v3:
> > Modified DBG messages
> > 
> > Changes v2:
> > Added 'compatible' attribute in the driver
> > Added message for exception or errors
> > 
> >  drivers/video/backlight/Kconfig  |  10 +
> >  drivers/video/backlight/Makefile |   1 +
> >  drivers/video/backlight/sky81452-backlight.c | 334 
> > +++
> >  include/linux/platform_data/sky81452-backlight.h |  46 
> >  4 files changed, 391 insertions(+)
> >  create mode 100644 drivers/video/backlight/sky81452-backlight.c
> >  create mode 100644 include/linux/platform_data/sky81452-backlight.h
> > 
> > diff --git a/drivers/video/backlight/Kconfig 
> > b/drivers/video/backlight/Kconfig
> > index 8d03924..2586fdd 100644
> > --- a/drivers/video/backlight/Kconfig
> > +++ b/drivers/video/backlight/Kconfig
> > @@ -409,6 +409,16 @@ config BACKLIGHT_PANDORA
> >   If you have a Pandora console, say Y to enable the
> >   backlight driver.
> > 
> > +config BACKLIGHT_SKY81452
> > +   tristate "Backlight driver for SKY81452"
> > +   depends on BACKLIGHT_CLASS_DEVICE && MFD_SKY81452
> > +   help
> > + If you have a Skyworks SKY81452, say Y to enable the
> > + backlight driver.
> > +
> > + To compile this driver as a module, choose M here: the module will
> > + be called sky81452-backlight
> > +
> >  config BACKLIGHT_TPS65217
> > tristate "TPS65217 Backlight"
> > depends on BACKLIGHT_CLASS_DEVICE && MFD_TPS65217
> > diff --git a/drivers/video/backlight/Makefile 
> > b/drivers/video/backlight/Makefile
> > index fcd50b73..d67073f 100644
> > --- a/drivers/video/backlight/Makefile
> > +++ b/drivers/video/backlight/Makefile
> > @@ -50,6 +50,7 @@ obj-$(CONFIG_BACKLIGHT_PANDORA)   += pandora_bl.o
> >  obj-$(CONFIG_BACKLIGHT_PCF50633)   += pcf50633-backlight.o
> >  obj-$(CONFIG_BACKLIGHT_PWM)+= pwm_bl.o
> >  obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o
> > +obj-$(CONFIG_BACKLIGHT_SKY81452)   += sky81452-backlight.o
> >  obj-$(CONFIG_BACKLIGHT_TOSA)   += tosa_bl.o
> >  obj-$(CONFIG_BACKLIGHT_TPS65217)   += tps65217_bl.o
> >  obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o
> > diff --git a/drivers/video/backlight/sky81452-backlight.c 
> > b/drivers/video/backlight/sky81452-
> > backlight.c
> > new file mode 100644
> > index 000..8105597
> > --- /dev/null
> > +++ b/drivers/video/backlight/sky81452-backlight.c
> > @@ -0,0 +1,334 @@
> > +/*
> > + * sky81452-backlight.cSKY81452 backlight driver
> > + *
> > + * Copyright 2014 Skyworks Solutions Inc.
> > + * Author : Gyungoh Yoo 
> > + *
> > + * 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, see .
> > + */
> > +
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +/* registers */
> > +#define SKY81452_REG0  0x00
> > +#define SKY81452_REG1  0x01
> > +#define SKY81452_REG2  0x02
> > +#define SKY81452_REG4  0x04
> > +#define SKY81452_REG5  0x05
> > +
> > +/* bit mask */
> > +#define SKY81452_CS0xFF
> > +#define SKY81452_EN0x3F
> > +#define SKY81452_IGPW  0x20
> > +#define SKY81452_PWMMD 0x10
> > +#define SKY81452_PHASE 0x08
> > +#define SKY81452_ILIM  0x04
> > +#define SKY81452_VSHRT 0x03
> > +#define SKY81452_OCP   

Re: [PATCH v10 2/6] backlight: Add support Skyworks SKY81452 backlight driver

2014-12-17 Thread Jingoo Han
On Thursday, December 18, 2014 2:48 PM, Gyungoh Yoo wrote:
> 
> From: Gyungoh Yoo 
> 
> Signed-off-by: Gyungoh Yoo 

Please add the following 'Acked-by's when you send this patch
next time.

Acked-by: Jingoo Han 
Acked-by: Bryan Wu 

Best regards,
Jingoo Han

> ---
> Changes v10:
> Removed trivial get_brightness implementations
> 
> Changes v9:
> Nothing
> 
> Changes v8:
> Renamed property names for backlight with vendor prefix
> Modified gpio-enable property to generic property for GPIO
> 
> Changes v7:
> Modified licensing text to GPLv2
> 
> Changes v6:
> Added new line character at the end of line of dev_err()
> 
> Changes v5:
> Move sky81452-backlight.h to include/linux/platform_data
> 
> Changes v4:
> Reordering header files for readability
> Removed calling to backlight_device_unregister()
> Removed MODULE_VERSION()
> Modified license to GPLv2
> 
> Changes v3:
> Modified DBG messages
> 
> Changes v2:
> Added 'compatible' attribute in the driver
> Added message for exception or errors
> 
>  drivers/video/backlight/Kconfig  |  10 +
>  drivers/video/backlight/Makefile |   1 +
>  drivers/video/backlight/sky81452-backlight.c | 334 
> +++
>  include/linux/platform_data/sky81452-backlight.h |  46 
>  4 files changed, 391 insertions(+)
>  create mode 100644 drivers/video/backlight/sky81452-backlight.c
>  create mode 100644 include/linux/platform_data/sky81452-backlight.h
> 
> diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
> index 8d03924..2586fdd 100644
> --- a/drivers/video/backlight/Kconfig
> +++ b/drivers/video/backlight/Kconfig
> @@ -409,6 +409,16 @@ config BACKLIGHT_PANDORA
> If you have a Pandora console, say Y to enable the
> backlight driver.
> 
> +config BACKLIGHT_SKY81452
> + tristate "Backlight driver for SKY81452"
> + depends on BACKLIGHT_CLASS_DEVICE && MFD_SKY81452
> + help
> +   If you have a Skyworks SKY81452, say Y to enable the
> +   backlight driver.
> +
> +   To compile this driver as a module, choose M here: the module will
> +   be called sky81452-backlight
> +
>  config BACKLIGHT_TPS65217
>   tristate "TPS65217 Backlight"
>   depends on BACKLIGHT_CLASS_DEVICE && MFD_TPS65217
> diff --git a/drivers/video/backlight/Makefile 
> b/drivers/video/backlight/Makefile
> index fcd50b73..d67073f 100644
> --- a/drivers/video/backlight/Makefile
> +++ b/drivers/video/backlight/Makefile
> @@ -50,6 +50,7 @@ obj-$(CONFIG_BACKLIGHT_PANDORA) += pandora_bl.o
>  obj-$(CONFIG_BACKLIGHT_PCF50633) += pcf50633-backlight.o
>  obj-$(CONFIG_BACKLIGHT_PWM)  += pwm_bl.o
>  obj-$(CONFIG_BACKLIGHT_SAHARA)   += kb3886_bl.o
> +obj-$(CONFIG_BACKLIGHT_SKY81452) += sky81452-backlight.o
>  obj-$(CONFIG_BACKLIGHT_TOSA) += tosa_bl.o
>  obj-$(CONFIG_BACKLIGHT_TPS65217) += tps65217_bl.o
>  obj-$(CONFIG_BACKLIGHT_WM831X)   += wm831x_bl.o
> diff --git a/drivers/video/backlight/sky81452-backlight.c 
> b/drivers/video/backlight/sky81452-
> backlight.c
> new file mode 100644
> index 000..8105597
> --- /dev/null
> +++ b/drivers/video/backlight/sky81452-backlight.c
> @@ -0,0 +1,334 @@
> +/*
> + * sky81452-backlight.c  SKY81452 backlight driver
> + *
> + * Copyright 2014 Skyworks Solutions Inc.
> + * Author : Gyungoh Yoo 
> + *
> + * 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, see .
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +/* registers */
> +#define SKY81452_REG00x00
> +#define SKY81452_REG10x01
> +#define SKY81452_REG20x02
> +#define SKY81452_REG40x04
> +#define SKY81452_REG50x05
> +
> +/* bit mask */
> +#define SKY81452_CS  0xFF
> +#define SKY81452_EN  0x3F
> +#define SKY81452_IGPW0x20
> +#define SKY81452_PWMMD   0x10
> +#define SKY81452_PHASE   0x08
> +#define SKY81452_ILIM0x04
> +#define SKY81452_VSHRT   0x03
> +#define SKY81452_OCP 0x80
> +#define SKY81452_OTMP0x40
> +#define SKY81452_SHRT0x3F
> +#define SKY81452_OPN 0x3F
> +
> +#define SKY81452_DEFAULT_NAME "lcd-backlight"
> +#define SKY81452_MAX_BRIGHTNESS  (SKY81452_CS + 1)
> +
> +#define CTZ(b) __builtin_ctz(b)
> +
> +static int sky81452_bl_update_status(struct backlight_device *bd)
> +{
> + 

[PATCH v10 2/6] backlight: Add support Skyworks SKY81452 backlight driver

2014-12-17 Thread gyungoh
From: Gyungoh Yoo 

Signed-off-by: Gyungoh Yoo 
---
Changes v10:
Removed trivial get_brightness implementations

Changes v9:
Nothing

Changes v8:
Renamed property names for backlight with vendor prefix
Modified gpio-enable property to generic property for GPIO

Changes v7:
Modified licensing text to GPLv2

Changes v6:
Added new line character at the end of line of dev_err()

Changes v5:
Move sky81452-backlight.h to include/linux/platform_data

Changes v4:
Reordering header files for readability
Removed calling to backlight_device_unregister()
Removed MODULE_VERSION()
Modified license to GPLv2

Changes v3:
Modified DBG messages

Changes v2:
Added 'compatible' attribute in the driver
Added message for exception or errors

 drivers/video/backlight/Kconfig  |  10 +
 drivers/video/backlight/Makefile |   1 +
 drivers/video/backlight/sky81452-backlight.c | 334 +++
 include/linux/platform_data/sky81452-backlight.h |  46 
 4 files changed, 391 insertions(+)
 create mode 100644 drivers/video/backlight/sky81452-backlight.c
 create mode 100644 include/linux/platform_data/sky81452-backlight.h

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 8d03924..2586fdd 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -409,6 +409,16 @@ config BACKLIGHT_PANDORA
  If you have a Pandora console, say Y to enable the
  backlight driver.
 
+config BACKLIGHT_SKY81452
+   tristate "Backlight driver for SKY81452"
+   depends on BACKLIGHT_CLASS_DEVICE && MFD_SKY81452
+   help
+ If you have a Skyworks SKY81452, say Y to enable the
+ backlight driver.
+
+ To compile this driver as a module, choose M here: the module will
+ be called sky81452-backlight
+
 config BACKLIGHT_TPS65217
tristate "TPS65217 Backlight"
depends on BACKLIGHT_CLASS_DEVICE && MFD_TPS65217
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index fcd50b73..d67073f 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -50,6 +50,7 @@ obj-$(CONFIG_BACKLIGHT_PANDORA)   += pandora_bl.o
 obj-$(CONFIG_BACKLIGHT_PCF50633)   += pcf50633-backlight.o
 obj-$(CONFIG_BACKLIGHT_PWM)+= pwm_bl.o
 obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o
+obj-$(CONFIG_BACKLIGHT_SKY81452)   += sky81452-backlight.o
 obj-$(CONFIG_BACKLIGHT_TOSA)   += tosa_bl.o
 obj-$(CONFIG_BACKLIGHT_TPS65217)   += tps65217_bl.o
 obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o
diff --git a/drivers/video/backlight/sky81452-backlight.c 
b/drivers/video/backlight/sky81452-backlight.c
new file mode 100644
index 000..8105597
--- /dev/null
+++ b/drivers/video/backlight/sky81452-backlight.c
@@ -0,0 +1,334 @@
+/*
+ * sky81452-backlight.cSKY81452 backlight driver
+ *
+ * Copyright 2014 Skyworks Solutions Inc.
+ * Author : Gyungoh Yoo 
+ *
+ * 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, see .
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* registers */
+#define SKY81452_REG0  0x00
+#define SKY81452_REG1  0x01
+#define SKY81452_REG2  0x02
+#define SKY81452_REG4  0x04
+#define SKY81452_REG5  0x05
+
+/* bit mask */
+#define SKY81452_CS0xFF
+#define SKY81452_EN0x3F
+#define SKY81452_IGPW  0x20
+#define SKY81452_PWMMD 0x10
+#define SKY81452_PHASE 0x08
+#define SKY81452_ILIM  0x04
+#define SKY81452_VSHRT 0x03
+#define SKY81452_OCP   0x80
+#define SKY81452_OTMP  0x40
+#define SKY81452_SHRT  0x3F
+#define SKY81452_OPN   0x3F
+
+#define SKY81452_DEFAULT_NAME "lcd-backlight"
+#define SKY81452_MAX_BRIGHTNESS(SKY81452_CS + 1)
+
+#define CTZ(b) __builtin_ctz(b)
+
+static int sky81452_bl_update_status(struct backlight_device *bd)
+{
+   const struct sky81452_bl_platform_data *pdata =
+   dev_get_platdata(bd->dev.parent);
+   const unsigned int brightness = (unsigned int)bd->props.brightness;
+   struct regmap *regmap = bl_get_data(bd);
+   int ret;
+
+   if (brightness > 0) {
+   ret = regmap_write(regmap, SKY81452_REG0, brightness - 1);
+   if (IS_ERR_VALUE(ret))
+   return ret;
+
+   return regmap_update_bits(regmap, SKY81452_REG1, SKY81452_EN,
+

[PATCH v10 2/6] backlight: Add support Skyworks SKY81452 backlight driver

2014-12-17 Thread gyungoh
From: Gyungoh Yoo jack@skyworksinc.com

Signed-off-by: Gyungoh Yoo jack@skyworksinc.com
---
Changes v10:
Removed trivial get_brightness implementations

Changes v9:
Nothing

Changes v8:
Renamed property names for backlight with vendor prefix
Modified gpio-enable property to generic property for GPIO

Changes v7:
Modified licensing text to GPLv2

Changes v6:
Added new line character at the end of line of dev_err()

Changes v5:
Move sky81452-backlight.h to include/linux/platform_data

Changes v4:
Reordering header files for readability
Removed calling to backlight_device_unregister()
Removed MODULE_VERSION()
Modified license to GPLv2

Changes v3:
Modified DBG messages

Changes v2:
Added 'compatible' attribute in the driver
Added message for exception or errors

 drivers/video/backlight/Kconfig  |  10 +
 drivers/video/backlight/Makefile |   1 +
 drivers/video/backlight/sky81452-backlight.c | 334 +++
 include/linux/platform_data/sky81452-backlight.h |  46 
 4 files changed, 391 insertions(+)
 create mode 100644 drivers/video/backlight/sky81452-backlight.c
 create mode 100644 include/linux/platform_data/sky81452-backlight.h

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 8d03924..2586fdd 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -409,6 +409,16 @@ config BACKLIGHT_PANDORA
  If you have a Pandora console, say Y to enable the
  backlight driver.
 
+config BACKLIGHT_SKY81452
+   tristate Backlight driver for SKY81452
+   depends on BACKLIGHT_CLASS_DEVICE  MFD_SKY81452
+   help
+ If you have a Skyworks SKY81452, say Y to enable the
+ backlight driver.
+
+ To compile this driver as a module, choose M here: the module will
+ be called sky81452-backlight
+
 config BACKLIGHT_TPS65217
tristate TPS65217 Backlight
depends on BACKLIGHT_CLASS_DEVICE  MFD_TPS65217
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index fcd50b73..d67073f 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -50,6 +50,7 @@ obj-$(CONFIG_BACKLIGHT_PANDORA)   += pandora_bl.o
 obj-$(CONFIG_BACKLIGHT_PCF50633)   += pcf50633-backlight.o
 obj-$(CONFIG_BACKLIGHT_PWM)+= pwm_bl.o
 obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o
+obj-$(CONFIG_BACKLIGHT_SKY81452)   += sky81452-backlight.o
 obj-$(CONFIG_BACKLIGHT_TOSA)   += tosa_bl.o
 obj-$(CONFIG_BACKLIGHT_TPS65217)   += tps65217_bl.o
 obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o
diff --git a/drivers/video/backlight/sky81452-backlight.c 
b/drivers/video/backlight/sky81452-backlight.c
new file mode 100644
index 000..8105597
--- /dev/null
+++ b/drivers/video/backlight/sky81452-backlight.c
@@ -0,0 +1,334 @@
+/*
+ * sky81452-backlight.cSKY81452 backlight driver
+ *
+ * Copyright 2014 Skyworks Solutions Inc.
+ * Author : Gyungoh Yoo jack@skyworksinc.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, see http://www.gnu.org/licenses/.
+ */
+
+#include linux/backlight.h
+#include linux/err.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/platform_device.h
+#include linux/regmap.h
+#include linux/platform_data/sky81452-backlight.h
+#include linux/slab.h
+
+/* registers */
+#define SKY81452_REG0  0x00
+#define SKY81452_REG1  0x01
+#define SKY81452_REG2  0x02
+#define SKY81452_REG4  0x04
+#define SKY81452_REG5  0x05
+
+/* bit mask */
+#define SKY81452_CS0xFF
+#define SKY81452_EN0x3F
+#define SKY81452_IGPW  0x20
+#define SKY81452_PWMMD 0x10
+#define SKY81452_PHASE 0x08
+#define SKY81452_ILIM  0x04
+#define SKY81452_VSHRT 0x03
+#define SKY81452_OCP   0x80
+#define SKY81452_OTMP  0x40
+#define SKY81452_SHRT  0x3F
+#define SKY81452_OPN   0x3F
+
+#define SKY81452_DEFAULT_NAME lcd-backlight
+#define SKY81452_MAX_BRIGHTNESS(SKY81452_CS + 1)
+
+#define CTZ(b) __builtin_ctz(b)
+
+static int sky81452_bl_update_status(struct backlight_device *bd)
+{
+   const struct sky81452_bl_platform_data *pdata =
+   dev_get_platdata(bd-dev.parent);
+   const unsigned int brightness = (unsigned int)bd-props.brightness;
+   struct regmap *regmap = bl_get_data(bd);
+   int ret;
+
+   if (brightness  0) {
+   

Re: [PATCH v10 2/6] backlight: Add support Skyworks SKY81452 backlight driver

2014-12-17 Thread Jingoo Han
On Thursday, December 18, 2014 2:48 PM, Gyungoh Yoo wrote:
 
 From: Gyungoh Yoo jack@skyworksinc.com
 
 Signed-off-by: Gyungoh Yoo jack@skyworksinc.com

Please add the following 'Acked-by's when you send this patch
next time.

Acked-by: Jingoo Han jg1@samsung.com
Acked-by: Bryan Wu coolo...@gmail.com

Best regards,
Jingoo Han

 ---
 Changes v10:
 Removed trivial get_brightness implementations
 
 Changes v9:
 Nothing
 
 Changes v8:
 Renamed property names for backlight with vendor prefix
 Modified gpio-enable property to generic property for GPIO
 
 Changes v7:
 Modified licensing text to GPLv2
 
 Changes v6:
 Added new line character at the end of line of dev_err()
 
 Changes v5:
 Move sky81452-backlight.h to include/linux/platform_data
 
 Changes v4:
 Reordering header files for readability
 Removed calling to backlight_device_unregister()
 Removed MODULE_VERSION()
 Modified license to GPLv2
 
 Changes v3:
 Modified DBG messages
 
 Changes v2:
 Added 'compatible' attribute in the driver
 Added message for exception or errors
 
  drivers/video/backlight/Kconfig  |  10 +
  drivers/video/backlight/Makefile |   1 +
  drivers/video/backlight/sky81452-backlight.c | 334 
 +++
  include/linux/platform_data/sky81452-backlight.h |  46 
  4 files changed, 391 insertions(+)
  create mode 100644 drivers/video/backlight/sky81452-backlight.c
  create mode 100644 include/linux/platform_data/sky81452-backlight.h
 
 diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
 index 8d03924..2586fdd 100644
 --- a/drivers/video/backlight/Kconfig
 +++ b/drivers/video/backlight/Kconfig
 @@ -409,6 +409,16 @@ config BACKLIGHT_PANDORA
 If you have a Pandora console, say Y to enable the
 backlight driver.
 
 +config BACKLIGHT_SKY81452
 + tristate Backlight driver for SKY81452
 + depends on BACKLIGHT_CLASS_DEVICE  MFD_SKY81452
 + help
 +   If you have a Skyworks SKY81452, say Y to enable the
 +   backlight driver.
 +
 +   To compile this driver as a module, choose M here: the module will
 +   be called sky81452-backlight
 +
  config BACKLIGHT_TPS65217
   tristate TPS65217 Backlight
   depends on BACKLIGHT_CLASS_DEVICE  MFD_TPS65217
 diff --git a/drivers/video/backlight/Makefile 
 b/drivers/video/backlight/Makefile
 index fcd50b73..d67073f 100644
 --- a/drivers/video/backlight/Makefile
 +++ b/drivers/video/backlight/Makefile
 @@ -50,6 +50,7 @@ obj-$(CONFIG_BACKLIGHT_PANDORA) += pandora_bl.o
  obj-$(CONFIG_BACKLIGHT_PCF50633) += pcf50633-backlight.o
  obj-$(CONFIG_BACKLIGHT_PWM)  += pwm_bl.o
  obj-$(CONFIG_BACKLIGHT_SAHARA)   += kb3886_bl.o
 +obj-$(CONFIG_BACKLIGHT_SKY81452) += sky81452-backlight.o
  obj-$(CONFIG_BACKLIGHT_TOSA) += tosa_bl.o
  obj-$(CONFIG_BACKLIGHT_TPS65217) += tps65217_bl.o
  obj-$(CONFIG_BACKLIGHT_WM831X)   += wm831x_bl.o
 diff --git a/drivers/video/backlight/sky81452-backlight.c 
 b/drivers/video/backlight/sky81452-
 backlight.c
 new file mode 100644
 index 000..8105597
 --- /dev/null
 +++ b/drivers/video/backlight/sky81452-backlight.c
 @@ -0,0 +1,334 @@
 +/*
 + * sky81452-backlight.c  SKY81452 backlight driver
 + *
 + * Copyright 2014 Skyworks Solutions Inc.
 + * Author : Gyungoh Yoo jack@skyworksinc.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, see http://www.gnu.org/licenses/.
 + */
 +
 +#include linux/backlight.h
 +#include linux/err.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/platform_device.h
 +#include linux/regmap.h
 +#include linux/platform_data/sky81452-backlight.h
 +#include linux/slab.h
 +
 +/* registers */
 +#define SKY81452_REG00x00
 +#define SKY81452_REG10x01
 +#define SKY81452_REG20x02
 +#define SKY81452_REG40x04
 +#define SKY81452_REG50x05
 +
 +/* bit mask */
 +#define SKY81452_CS  0xFF
 +#define SKY81452_EN  0x3F
 +#define SKY81452_IGPW0x20
 +#define SKY81452_PWMMD   0x10
 +#define SKY81452_PHASE   0x08
 +#define SKY81452_ILIM0x04
 +#define SKY81452_VSHRT   0x03
 +#define SKY81452_OCP 0x80
 +#define SKY81452_OTMP0x40
 +#define SKY81452_SHRT0x3F
 +#define SKY81452_OPN 0x3F
 +
 +#define SKY81452_DEFAULT_NAME lcd-backlight
 +#define SKY81452_MAX_BRIGHTNESS 

Re: [PATCH v10 2/6] backlight: Add support Skyworks SKY81452 backlight driver

2014-12-17 Thread Gyungoh Yoo
On Thu, Dec 18, 2014 at 03:09:21PM +0900, Jingoo Han wrote:
 On Thursday, December 18, 2014 2:48 PM, Gyungoh Yoo wrote:
  
  From: Gyungoh Yoo jack@skyworksinc.com
  
  Signed-off-by: Gyungoh Yoo jack@skyworksinc.com
 
 Please add the following 'Acked-by's when you send this patch
 next time.
 
 Acked-by: Jingoo Han jg1@samsung.com
 Acked-by: Bryan Wu coolo...@gmail.com

I see.
Thank you.

 
 Best regards,
 Jingoo Han
 
  ---
  Changes v10:
  Removed trivial get_brightness implementations
  
  Changes v9:
  Nothing
  
  Changes v8:
  Renamed property names for backlight with vendor prefix
  Modified gpio-enable property to generic property for GPIO
  
  Changes v7:
  Modified licensing text to GPLv2
  
  Changes v6:
  Added new line character at the end of line of dev_err()
  
  Changes v5:
  Move sky81452-backlight.h to include/linux/platform_data
  
  Changes v4:
  Reordering header files for readability
  Removed calling to backlight_device_unregister()
  Removed MODULE_VERSION()
  Modified license to GPLv2
  
  Changes v3:
  Modified DBG messages
  
  Changes v2:
  Added 'compatible' attribute in the driver
  Added message for exception or errors
  
   drivers/video/backlight/Kconfig  |  10 +
   drivers/video/backlight/Makefile |   1 +
   drivers/video/backlight/sky81452-backlight.c | 334 
  +++
   include/linux/platform_data/sky81452-backlight.h |  46 
   4 files changed, 391 insertions(+)
   create mode 100644 drivers/video/backlight/sky81452-backlight.c
   create mode 100644 include/linux/platform_data/sky81452-backlight.h
  
  diff --git a/drivers/video/backlight/Kconfig 
  b/drivers/video/backlight/Kconfig
  index 8d03924..2586fdd 100644
  --- a/drivers/video/backlight/Kconfig
  +++ b/drivers/video/backlight/Kconfig
  @@ -409,6 +409,16 @@ config BACKLIGHT_PANDORA
If you have a Pandora console, say Y to enable the
backlight driver.
  
  +config BACKLIGHT_SKY81452
  +   tristate Backlight driver for SKY81452
  +   depends on BACKLIGHT_CLASS_DEVICE  MFD_SKY81452
  +   help
  + If you have a Skyworks SKY81452, say Y to enable the
  + backlight driver.
  +
  + To compile this driver as a module, choose M here: the module will
  + be called sky81452-backlight
  +
   config BACKLIGHT_TPS65217
  tristate TPS65217 Backlight
  depends on BACKLIGHT_CLASS_DEVICE  MFD_TPS65217
  diff --git a/drivers/video/backlight/Makefile 
  b/drivers/video/backlight/Makefile
  index fcd50b73..d67073f 100644
  --- a/drivers/video/backlight/Makefile
  +++ b/drivers/video/backlight/Makefile
  @@ -50,6 +50,7 @@ obj-$(CONFIG_BACKLIGHT_PANDORA)   += pandora_bl.o
   obj-$(CONFIG_BACKLIGHT_PCF50633)   += pcf50633-backlight.o
   obj-$(CONFIG_BACKLIGHT_PWM)+= pwm_bl.o
   obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o
  +obj-$(CONFIG_BACKLIGHT_SKY81452)   += sky81452-backlight.o
   obj-$(CONFIG_BACKLIGHT_TOSA)   += tosa_bl.o
   obj-$(CONFIG_BACKLIGHT_TPS65217)   += tps65217_bl.o
   obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o
  diff --git a/drivers/video/backlight/sky81452-backlight.c 
  b/drivers/video/backlight/sky81452-
  backlight.c
  new file mode 100644
  index 000..8105597
  --- /dev/null
  +++ b/drivers/video/backlight/sky81452-backlight.c
  @@ -0,0 +1,334 @@
  +/*
  + * sky81452-backlight.cSKY81452 backlight driver
  + *
  + * Copyright 2014 Skyworks Solutions Inc.
  + * Author : Gyungoh Yoo jack@skyworksinc.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, see http://www.gnu.org/licenses/.
  + */
  +
  +#include linux/backlight.h
  +#include linux/err.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/platform_device.h
  +#include linux/regmap.h
  +#include linux/platform_data/sky81452-backlight.h
  +#include linux/slab.h
  +
  +/* registers */
  +#define SKY81452_REG0  0x00
  +#define SKY81452_REG1  0x01
  +#define SKY81452_REG2  0x02
  +#define SKY81452_REG4  0x04
  +#define SKY81452_REG5  0x05
  +
  +/* bit mask */
  +#define SKY81452_CS0xFF
  +#define SKY81452_EN0x3F
  +#define SKY81452_IGPW  0x20
  +#define SKY81452_PWMMD 0x10
  +#define SKY81452_PHASE 0x08
  +#define SKY81452_ILIM  0x04
  +#define SKY81452_VSHRT 0x03
  +#define 

Re: [PATCH v10 2/6] backlight: Add support Skyworks SKY81452 backlight driver

2014-12-03 Thread Gyungoh Yoo
On Wed, Dec 03, 2014 at 11:02:29AM +0100, Oliver Neukum wrote:
> On Wed, 2014-12-03 at 16:05 +0900, gyun...@gmail.com wrote:
> > +static ssize_t sky81452_bl_store_enable(struct device *dev,
> > +   struct device_attribute *attr, const char *buf, size_t
> > count)
> > +{
> > +   struct regmap *regmap = bl_get_data(to_backlight_device(dev));
> > +   unsigned long value;
> > +   int ret;
> > +
> > +   ret = kstrtoul(buf, 16, );
> > +   if (IS_ERR_VALUE(ret))
> > +   return ret;
> > +
> > +   ret = regmap_update_bits(regmap, SKY81452_REG1, SKY81452_EN,
> > +   value << CTZ(SKY81452_EN));
> 
> No range checking for value?

Avaiable range is from 0 to SKY81452_EN.
regmap_update_bits() is masking the value.

> 
> > +   if (IS_ERR_VALUE(ret))
> > +   return ret;
> > +
> > +   return count;
> > +}
> 
>   Regards
>   Oliver
> 
> -- 
> Oliver Neukum 
> 
--
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 v10 2/6] backlight: Add support Skyworks SKY81452 backlight driver

2014-12-03 Thread Oliver Neukum
On Wed, 2014-12-03 at 16:05 +0900, gyun...@gmail.com wrote:
> +static ssize_t sky81452_bl_store_enable(struct device *dev,
> +   struct device_attribute *attr, const char *buf, size_t
> count)
> +{
> +   struct regmap *regmap = bl_get_data(to_backlight_device(dev));
> +   unsigned long value;
> +   int ret;
> +
> +   ret = kstrtoul(buf, 16, );
> +   if (IS_ERR_VALUE(ret))
> +   return ret;
> +
> +   ret = regmap_update_bits(regmap, SKY81452_REG1, SKY81452_EN,
> +   value << CTZ(SKY81452_EN));

No range checking for value?

> +   if (IS_ERR_VALUE(ret))
> +   return ret;
> +
> +   return count;
> +}

Regards
Oliver

-- 
Oliver Neukum 

--
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 v10 2/6] backlight: Add support Skyworks SKY81452 backlight driver

2014-12-03 Thread Oliver Neukum
On Wed, 2014-12-03 at 16:05 +0900, gyun...@gmail.com wrote:
 +static ssize_t sky81452_bl_store_enable(struct device *dev,
 +   struct device_attribute *attr, const char *buf, size_t
 count)
 +{
 +   struct regmap *regmap = bl_get_data(to_backlight_device(dev));
 +   unsigned long value;
 +   int ret;
 +
 +   ret = kstrtoul(buf, 16, value);
 +   if (IS_ERR_VALUE(ret))
 +   return ret;
 +
 +   ret = regmap_update_bits(regmap, SKY81452_REG1, SKY81452_EN,
 +   value  CTZ(SKY81452_EN));

No range checking for value?

 +   if (IS_ERR_VALUE(ret))
 +   return ret;
 +
 +   return count;
 +}

Regards
Oliver

-- 
Oliver Neukum oneu...@suse.de

--
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 v10 2/6] backlight: Add support Skyworks SKY81452 backlight driver

2014-12-03 Thread Gyungoh Yoo
On Wed, Dec 03, 2014 at 11:02:29AM +0100, Oliver Neukum wrote:
 On Wed, 2014-12-03 at 16:05 +0900, gyun...@gmail.com wrote:
  +static ssize_t sky81452_bl_store_enable(struct device *dev,
  +   struct device_attribute *attr, const char *buf, size_t
  count)
  +{
  +   struct regmap *regmap = bl_get_data(to_backlight_device(dev));
  +   unsigned long value;
  +   int ret;
  +
  +   ret = kstrtoul(buf, 16, value);
  +   if (IS_ERR_VALUE(ret))
  +   return ret;
  +
  +   ret = regmap_update_bits(regmap, SKY81452_REG1, SKY81452_EN,
  +   value  CTZ(SKY81452_EN));
 
 No range checking for value?

Avaiable range is from 0 to SKY81452_EN.
regmap_update_bits() is masking the value.

 
  +   if (IS_ERR_VALUE(ret))
  +   return ret;
  +
  +   return count;
  +}
 
   Regards
   Oliver
 
 -- 
 Oliver Neukum oneu...@suse.de
 
--
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 v10 2/6] backlight: Add support Skyworks SKY81452 backlight driver

2014-12-02 Thread Jingoo Han
On Wednesday, December 03, 2014 4:05 PM, Gyungoh Yoo wrote:
> 
> From: Gyungoh Yoo 
> 
> Signed-off-by: Gyungoh Yoo 

Acked-by: Jingoo Han 

Best regards,
Jingoo Han

> ---
> Changes v10:
> Removed trivial get_brightness implementations
> 
> Changes v9:
> Nothing
> 
> Changes v8:
> Renamed property names for backlight with vendor prefix
> Modified gpio-enable property to generic property for GPIO
> 
> Changes v7:
> Modified licensing text to GPLv2
> 
> Changes v6:
> Added new line character at the end of line of dev_err()
> 
> Changes v5:
> Move sky81452-backlight.h to include/linux/platform_data
> 
> Changes v4:
> Reordering header files for readability
> Removed calling to backlight_device_unregister()
> Removed MODULE_VERSION()
> Modified license to GPLv2
> 
> Changes v3:
> Modified DBG messages
> 
> Changes v2:
> Added 'compatible' attribute in the driver
> Added message for exception or errors
> 
>  drivers/video/backlight/Kconfig  |  10 +
>  drivers/video/backlight/Makefile |   1 +
>  drivers/video/backlight/sky81452-backlight.c | 334 
> +++
>  include/linux/platform_data/sky81452-backlight.h |  46 
>  4 files changed, 391 insertions(+)
>  create mode 100644 drivers/video/backlight/sky81452-backlight.c
>  create mode 100644 include/linux/platform_data/sky81452-backlight.h
> 
> diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
> index 8d03924..2586fdd 100644
> --- a/drivers/video/backlight/Kconfig
> +++ b/drivers/video/backlight/Kconfig
> @@ -409,6 +409,16 @@ config BACKLIGHT_PANDORA
> If you have a Pandora console, say Y to enable the
> backlight driver.
> 
> +config BACKLIGHT_SKY81452
> + tristate "Backlight driver for SKY81452"
> + depends on BACKLIGHT_CLASS_DEVICE && MFD_SKY81452
> + help
> +   If you have a Skyworks SKY81452, say Y to enable the
> +   backlight driver.
> +
> +   To compile this driver as a module, choose M here: the module will
> +   be called sky81452-backlight
> +
>  config BACKLIGHT_TPS65217
>   tristate "TPS65217 Backlight"
>   depends on BACKLIGHT_CLASS_DEVICE && MFD_TPS65217
> diff --git a/drivers/video/backlight/Makefile 
> b/drivers/video/backlight/Makefile
> index fcd50b73..d67073f 100644
> --- a/drivers/video/backlight/Makefile
> +++ b/drivers/video/backlight/Makefile
> @@ -50,6 +50,7 @@ obj-$(CONFIG_BACKLIGHT_PANDORA) += pandora_bl.o
>  obj-$(CONFIG_BACKLIGHT_PCF50633) += pcf50633-backlight.o
>  obj-$(CONFIG_BACKLIGHT_PWM)  += pwm_bl.o
>  obj-$(CONFIG_BACKLIGHT_SAHARA)   += kb3886_bl.o
> +obj-$(CONFIG_BACKLIGHT_SKY81452) += sky81452-backlight.o
>  obj-$(CONFIG_BACKLIGHT_TOSA) += tosa_bl.o
>  obj-$(CONFIG_BACKLIGHT_TPS65217) += tps65217_bl.o
>  obj-$(CONFIG_BACKLIGHT_WM831X)   += wm831x_bl.o
> diff --git a/drivers/video/backlight/sky81452-backlight.c 
> b/drivers/video/backlight/sky81452-
> backlight.c
> new file mode 100644
> index 000..8105597
> --- /dev/null
> +++ b/drivers/video/backlight/sky81452-backlight.c
> @@ -0,0 +1,334 @@
> +/*
> + * sky81452-backlight.c  SKY81452 backlight driver
> + *
> + * Copyright 2014 Skyworks Solutions Inc.
> + * Author : Gyungoh Yoo 
> + *
> + * 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, see .
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +/* registers */
> +#define SKY81452_REG00x00
> +#define SKY81452_REG10x01
> +#define SKY81452_REG20x02
> +#define SKY81452_REG40x04
> +#define SKY81452_REG50x05
> +
> +/* bit mask */
> +#define SKY81452_CS  0xFF
> +#define SKY81452_EN  0x3F
> +#define SKY81452_IGPW0x20
> +#define SKY81452_PWMMD   0x10
> +#define SKY81452_PHASE   0x08
> +#define SKY81452_ILIM0x04
> +#define SKY81452_VSHRT   0x03
> +#define SKY81452_OCP 0x80
> +#define SKY81452_OTMP0x40
> +#define SKY81452_SHRT0x3F
> +#define SKY81452_OPN 0x3F
> +
> +#define SKY81452_DEFAULT_NAME "lcd-backlight"
> +#define SKY81452_MAX_BRIGHTNESS  (SKY81452_CS + 1)
> +
> +#define CTZ(b) __builtin_ctz(b)
> +
> +static int sky81452_bl_update_status(struct backlight_device *bd)
> +{
> + const struct sky81452_bl_platform_data *pdata =
> + 

[PATCH v10 2/6] backlight: Add support Skyworks SKY81452 backlight driver

2014-12-02 Thread gyungoh
From: Gyungoh Yoo 

Signed-off-by: Gyungoh Yoo 
---
Changes v10:
Removed trivial get_brightness implementations

Changes v9:
Nothing

Changes v8:
Renamed property names for backlight with vendor prefix
Modified gpio-enable property to generic property for GPIO

Changes v7:
Modified licensing text to GPLv2

Changes v6:
Added new line character at the end of line of dev_err()

Changes v5:
Move sky81452-backlight.h to include/linux/platform_data

Changes v4:
Reordering header files for readability
Removed calling to backlight_device_unregister()
Removed MODULE_VERSION()
Modified license to GPLv2

Changes v3:
Modified DBG messages

Changes v2:
Added 'compatible' attribute in the driver
Added message for exception or errors

 drivers/video/backlight/Kconfig  |  10 +
 drivers/video/backlight/Makefile |   1 +
 drivers/video/backlight/sky81452-backlight.c | 334 +++
 include/linux/platform_data/sky81452-backlight.h |  46 
 4 files changed, 391 insertions(+)
 create mode 100644 drivers/video/backlight/sky81452-backlight.c
 create mode 100644 include/linux/platform_data/sky81452-backlight.h

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 8d03924..2586fdd 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -409,6 +409,16 @@ config BACKLIGHT_PANDORA
  If you have a Pandora console, say Y to enable the
  backlight driver.
 
+config BACKLIGHT_SKY81452
+   tristate "Backlight driver for SKY81452"
+   depends on BACKLIGHT_CLASS_DEVICE && MFD_SKY81452
+   help
+ If you have a Skyworks SKY81452, say Y to enable the
+ backlight driver.
+
+ To compile this driver as a module, choose M here: the module will
+ be called sky81452-backlight
+
 config BACKLIGHT_TPS65217
tristate "TPS65217 Backlight"
depends on BACKLIGHT_CLASS_DEVICE && MFD_TPS65217
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index fcd50b73..d67073f 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -50,6 +50,7 @@ obj-$(CONFIG_BACKLIGHT_PANDORA)   += pandora_bl.o
 obj-$(CONFIG_BACKLIGHT_PCF50633)   += pcf50633-backlight.o
 obj-$(CONFIG_BACKLIGHT_PWM)+= pwm_bl.o
 obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o
+obj-$(CONFIG_BACKLIGHT_SKY81452)   += sky81452-backlight.o
 obj-$(CONFIG_BACKLIGHT_TOSA)   += tosa_bl.o
 obj-$(CONFIG_BACKLIGHT_TPS65217)   += tps65217_bl.o
 obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o
diff --git a/drivers/video/backlight/sky81452-backlight.c 
b/drivers/video/backlight/sky81452-backlight.c
new file mode 100644
index 000..8105597
--- /dev/null
+++ b/drivers/video/backlight/sky81452-backlight.c
@@ -0,0 +1,334 @@
+/*
+ * sky81452-backlight.cSKY81452 backlight driver
+ *
+ * Copyright 2014 Skyworks Solutions Inc.
+ * Author : Gyungoh Yoo 
+ *
+ * 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, see .
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* registers */
+#define SKY81452_REG0  0x00
+#define SKY81452_REG1  0x01
+#define SKY81452_REG2  0x02
+#define SKY81452_REG4  0x04
+#define SKY81452_REG5  0x05
+
+/* bit mask */
+#define SKY81452_CS0xFF
+#define SKY81452_EN0x3F
+#define SKY81452_IGPW  0x20
+#define SKY81452_PWMMD 0x10
+#define SKY81452_PHASE 0x08
+#define SKY81452_ILIM  0x04
+#define SKY81452_VSHRT 0x03
+#define SKY81452_OCP   0x80
+#define SKY81452_OTMP  0x40
+#define SKY81452_SHRT  0x3F
+#define SKY81452_OPN   0x3F
+
+#define SKY81452_DEFAULT_NAME "lcd-backlight"
+#define SKY81452_MAX_BRIGHTNESS(SKY81452_CS + 1)
+
+#define CTZ(b) __builtin_ctz(b)
+
+static int sky81452_bl_update_status(struct backlight_device *bd)
+{
+   const struct sky81452_bl_platform_data *pdata =
+   dev_get_platdata(bd->dev.parent);
+   const unsigned int brightness = (unsigned int)bd->props.brightness;
+   struct regmap *regmap = bl_get_data(bd);
+   int ret;
+
+   if (brightness > 0) {
+   ret = regmap_write(regmap, SKY81452_REG0, brightness - 1);
+   if (IS_ERR_VALUE(ret))
+   return ret;
+
+   return regmap_update_bits(regmap, SKY81452_REG1, SKY81452_EN,
+

[PATCH v10 2/6] backlight: Add support Skyworks SKY81452 backlight driver

2014-12-02 Thread gyungoh
From: Gyungoh Yoo jack@skyworksinc.com

Signed-off-by: Gyungoh Yoo jack@skyworksinc.com
---
Changes v10:
Removed trivial get_brightness implementations

Changes v9:
Nothing

Changes v8:
Renamed property names for backlight with vendor prefix
Modified gpio-enable property to generic property for GPIO

Changes v7:
Modified licensing text to GPLv2

Changes v6:
Added new line character at the end of line of dev_err()

Changes v5:
Move sky81452-backlight.h to include/linux/platform_data

Changes v4:
Reordering header files for readability
Removed calling to backlight_device_unregister()
Removed MODULE_VERSION()
Modified license to GPLv2

Changes v3:
Modified DBG messages

Changes v2:
Added 'compatible' attribute in the driver
Added message for exception or errors

 drivers/video/backlight/Kconfig  |  10 +
 drivers/video/backlight/Makefile |   1 +
 drivers/video/backlight/sky81452-backlight.c | 334 +++
 include/linux/platform_data/sky81452-backlight.h |  46 
 4 files changed, 391 insertions(+)
 create mode 100644 drivers/video/backlight/sky81452-backlight.c
 create mode 100644 include/linux/platform_data/sky81452-backlight.h

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 8d03924..2586fdd 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -409,6 +409,16 @@ config BACKLIGHT_PANDORA
  If you have a Pandora console, say Y to enable the
  backlight driver.
 
+config BACKLIGHT_SKY81452
+   tristate Backlight driver for SKY81452
+   depends on BACKLIGHT_CLASS_DEVICE  MFD_SKY81452
+   help
+ If you have a Skyworks SKY81452, say Y to enable the
+ backlight driver.
+
+ To compile this driver as a module, choose M here: the module will
+ be called sky81452-backlight
+
 config BACKLIGHT_TPS65217
tristate TPS65217 Backlight
depends on BACKLIGHT_CLASS_DEVICE  MFD_TPS65217
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index fcd50b73..d67073f 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -50,6 +50,7 @@ obj-$(CONFIG_BACKLIGHT_PANDORA)   += pandora_bl.o
 obj-$(CONFIG_BACKLIGHT_PCF50633)   += pcf50633-backlight.o
 obj-$(CONFIG_BACKLIGHT_PWM)+= pwm_bl.o
 obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o
+obj-$(CONFIG_BACKLIGHT_SKY81452)   += sky81452-backlight.o
 obj-$(CONFIG_BACKLIGHT_TOSA)   += tosa_bl.o
 obj-$(CONFIG_BACKLIGHT_TPS65217)   += tps65217_bl.o
 obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o
diff --git a/drivers/video/backlight/sky81452-backlight.c 
b/drivers/video/backlight/sky81452-backlight.c
new file mode 100644
index 000..8105597
--- /dev/null
+++ b/drivers/video/backlight/sky81452-backlight.c
@@ -0,0 +1,334 @@
+/*
+ * sky81452-backlight.cSKY81452 backlight driver
+ *
+ * Copyright 2014 Skyworks Solutions Inc.
+ * Author : Gyungoh Yoo jack@skyworksinc.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, see http://www.gnu.org/licenses/.
+ */
+
+#include linux/backlight.h
+#include linux/err.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/platform_device.h
+#include linux/regmap.h
+#include linux/platform_data/sky81452-backlight.h
+#include linux/slab.h
+
+/* registers */
+#define SKY81452_REG0  0x00
+#define SKY81452_REG1  0x01
+#define SKY81452_REG2  0x02
+#define SKY81452_REG4  0x04
+#define SKY81452_REG5  0x05
+
+/* bit mask */
+#define SKY81452_CS0xFF
+#define SKY81452_EN0x3F
+#define SKY81452_IGPW  0x20
+#define SKY81452_PWMMD 0x10
+#define SKY81452_PHASE 0x08
+#define SKY81452_ILIM  0x04
+#define SKY81452_VSHRT 0x03
+#define SKY81452_OCP   0x80
+#define SKY81452_OTMP  0x40
+#define SKY81452_SHRT  0x3F
+#define SKY81452_OPN   0x3F
+
+#define SKY81452_DEFAULT_NAME lcd-backlight
+#define SKY81452_MAX_BRIGHTNESS(SKY81452_CS + 1)
+
+#define CTZ(b) __builtin_ctz(b)
+
+static int sky81452_bl_update_status(struct backlight_device *bd)
+{
+   const struct sky81452_bl_platform_data *pdata =
+   dev_get_platdata(bd-dev.parent);
+   const unsigned int brightness = (unsigned int)bd-props.brightness;
+   struct regmap *regmap = bl_get_data(bd);
+   int ret;
+
+   if (brightness  0) {
+   

Re: [PATCH v10 2/6] backlight: Add support Skyworks SKY81452 backlight driver

2014-12-02 Thread Jingoo Han
On Wednesday, December 03, 2014 4:05 PM, Gyungoh Yoo wrote:
 
 From: Gyungoh Yoo jack@skyworksinc.com
 
 Signed-off-by: Gyungoh Yoo jack@skyworksinc.com

Acked-by: Jingoo Han jg1@samsung.com

Best regards,
Jingoo Han

 ---
 Changes v10:
 Removed trivial get_brightness implementations
 
 Changes v9:
 Nothing
 
 Changes v8:
 Renamed property names for backlight with vendor prefix
 Modified gpio-enable property to generic property for GPIO
 
 Changes v7:
 Modified licensing text to GPLv2
 
 Changes v6:
 Added new line character at the end of line of dev_err()
 
 Changes v5:
 Move sky81452-backlight.h to include/linux/platform_data
 
 Changes v4:
 Reordering header files for readability
 Removed calling to backlight_device_unregister()
 Removed MODULE_VERSION()
 Modified license to GPLv2
 
 Changes v3:
 Modified DBG messages
 
 Changes v2:
 Added 'compatible' attribute in the driver
 Added message for exception or errors
 
  drivers/video/backlight/Kconfig  |  10 +
  drivers/video/backlight/Makefile |   1 +
  drivers/video/backlight/sky81452-backlight.c | 334 
 +++
  include/linux/platform_data/sky81452-backlight.h |  46 
  4 files changed, 391 insertions(+)
  create mode 100644 drivers/video/backlight/sky81452-backlight.c
  create mode 100644 include/linux/platform_data/sky81452-backlight.h
 
 diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
 index 8d03924..2586fdd 100644
 --- a/drivers/video/backlight/Kconfig
 +++ b/drivers/video/backlight/Kconfig
 @@ -409,6 +409,16 @@ config BACKLIGHT_PANDORA
 If you have a Pandora console, say Y to enable the
 backlight driver.
 
 +config BACKLIGHT_SKY81452
 + tristate Backlight driver for SKY81452
 + depends on BACKLIGHT_CLASS_DEVICE  MFD_SKY81452
 + help
 +   If you have a Skyworks SKY81452, say Y to enable the
 +   backlight driver.
 +
 +   To compile this driver as a module, choose M here: the module will
 +   be called sky81452-backlight
 +
  config BACKLIGHT_TPS65217
   tristate TPS65217 Backlight
   depends on BACKLIGHT_CLASS_DEVICE  MFD_TPS65217
 diff --git a/drivers/video/backlight/Makefile 
 b/drivers/video/backlight/Makefile
 index fcd50b73..d67073f 100644
 --- a/drivers/video/backlight/Makefile
 +++ b/drivers/video/backlight/Makefile
 @@ -50,6 +50,7 @@ obj-$(CONFIG_BACKLIGHT_PANDORA) += pandora_bl.o
  obj-$(CONFIG_BACKLIGHT_PCF50633) += pcf50633-backlight.o
  obj-$(CONFIG_BACKLIGHT_PWM)  += pwm_bl.o
  obj-$(CONFIG_BACKLIGHT_SAHARA)   += kb3886_bl.o
 +obj-$(CONFIG_BACKLIGHT_SKY81452) += sky81452-backlight.o
  obj-$(CONFIG_BACKLIGHT_TOSA) += tosa_bl.o
  obj-$(CONFIG_BACKLIGHT_TPS65217) += tps65217_bl.o
  obj-$(CONFIG_BACKLIGHT_WM831X)   += wm831x_bl.o
 diff --git a/drivers/video/backlight/sky81452-backlight.c 
 b/drivers/video/backlight/sky81452-
 backlight.c
 new file mode 100644
 index 000..8105597
 --- /dev/null
 +++ b/drivers/video/backlight/sky81452-backlight.c
 @@ -0,0 +1,334 @@
 +/*
 + * sky81452-backlight.c  SKY81452 backlight driver
 + *
 + * Copyright 2014 Skyworks Solutions Inc.
 + * Author : Gyungoh Yoo jack@skyworksinc.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, see http://www.gnu.org/licenses/.
 + */
 +
 +#include linux/backlight.h
 +#include linux/err.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/platform_device.h
 +#include linux/regmap.h
 +#include linux/platform_data/sky81452-backlight.h
 +#include linux/slab.h
 +
 +/* registers */
 +#define SKY81452_REG00x00
 +#define SKY81452_REG10x01
 +#define SKY81452_REG20x02
 +#define SKY81452_REG40x04
 +#define SKY81452_REG50x05
 +
 +/* bit mask */
 +#define SKY81452_CS  0xFF
 +#define SKY81452_EN  0x3F
 +#define SKY81452_IGPW0x20
 +#define SKY81452_PWMMD   0x10
 +#define SKY81452_PHASE   0x08
 +#define SKY81452_ILIM0x04
 +#define SKY81452_VSHRT   0x03
 +#define SKY81452_OCP 0x80
 +#define SKY81452_OTMP0x40
 +#define SKY81452_SHRT0x3F
 +#define SKY81452_OPN 0x3F
 +
 +#define SKY81452_DEFAULT_NAME lcd-backlight
 +#define SKY81452_MAX_BRIGHTNESS  (SKY81452_CS + 1)
 +
 +#define CTZ(b) __builtin_ctz(b)
 +
 +static int sky81452_bl_update_status(struct