Re: [PATCH] Added Support for STMicroelectronics 16 channels LED7708 LED Driver

2016-10-07 Thread Jacek Anaszewski

Hi Saurabh,

Thanks for the patch.

General remarks:
- use scripts/checkpatch.pl
- read Documentation/CodingStyle
- read Documentation/SubmitChecklist
- read Documentation/SubmittingDrivers
- read Documentation/SubmittingPatches

On 10/06/2016 07:46 AM, Saurabh Rawat wrote:

---
 .../devicetree/bindings/leds/leds-st.txt   |  105 ++
 KERNEL/Documentation/leds/leds-st7708.txt  |  167 +++
 KERNEL/drivers/leds/leds-st.c  | 1210 
 KERNEL/include/linux/platform_data/leds-st.h   |  170 +++


The paths should be related to the kernel root directory.
I believe "KERNEL" is your local directory.

Before submitting a patch please confirm that it applies correctly
to the for-4.10 branch of

git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds.git



 patches/defconfig  |3 +-
 5 files changed, 1654 insertions(+), 1 deletion(-)
 create mode 100644 KERNEL/Documentation/devicetree/bindings/leds/leds-st.txt
 create mode 100644 KERNEL/Documentation/leds/leds-st7708.txt
 create mode 100644 KERNEL/drivers/leds/leds-st.c


Why leds-st.c and not leds-st7708.c ?


 create mode 100644 KERNEL/include/linux/platform_data/leds-st.h


Ditto.



diff --git a/KERNEL/Documentation/devicetree/bindings/leds/leds-st.txt 
b/KERNEL/Documentation/devicetree/bindings/leds/leds-st.txt
new file mode 100644
index 000..dde53f9
--- /dev/null
+++ b/KERNEL/Documentation/devicetree/bindings/leds/leds-st.txt
@@ -0,0 +1,105 @@
+STMicroelectronics LED7708 Driver connected to BeagleboneBlack.This can be 
customized for any other


Don't exceed line length limit (80 characters). It applies also to
the other lines in the patch.


+hardware platform running linux depending on available free GPIOS
+
+Required properties:
+- compatible : should be : "st,st-leds".
+- sdo-gpio :contains a single GPIO specifier for the GPIO which is used for 
master to slave data OUT data.
+- sdi-gpio: contains a single GPIO specifier for the GPIO which is used for 
master to slave data IN data.
+- le-gpios: contains a single GPIO specifier for the GPIO which is used for 
Latch Enable data.
+- lren-gpios: contains a single GPIO specifier for the GPIO which is used for 
Lren data.This has to be High for Device to Operate.


Why here *-gpios and above *-gpio?


+- sck-gpio: contains a single GPIO specifier for the GPIO which is used for 
the clock pin.
+- chanx :For controlling each LED channel Independently
+- chan-common: For controlling all the 16 channels in a single shot.


It seems that using led-sources property could simplify your driver.
Please refer to:
- Documentation/devicetree/bindings/leds/common.txt,
- leds-max77693 driver, that uses that property.
- Documentation/devicetree/bindings/mfd/max77693.txt.


+
+Optional properties:
+ - None


If none, then just don't mention this category.


+Example:
+
+st-leds {
+compatible = "st,st-leds";
+sdo-gpio = < 16 1>;
+sdi-gpio = < 28 1>;
+le-gpio = < 21 1>;
+lren-gpio = < 19 1>;
+sck-gpio = < 17 1>;
+
+chan1 {
+
+chan-name = "led7708-chan1";
+};
+
+chan2 {
+
+chan-name = "led7708-chan2";
+};
+chan3 {
+
+chan-name = "led7708-chan3";
+};
+
+chan4 {
+
+chan-name = "led7708-chan4";
+};
+chan5 {
+
+chan-name = "led7708-chan5";
+};
+
+chan6 {
+
+chan-name = "led7708-chan6";
+};
+chan7 {
+
+chan-name = "led7708-chan7";
+};
+
+chan8 {
+
+chan-name = "led7708-chan8";
+};
+
+chan9 {
+
+chan-name = "led7708-chan9";
+   };
+   
+   chan10 {
+   
+   chan-name = "led7708-chan10";
+   };
+   chan11 {
+   
+   chan-name = "led7708-chan11";
+   };
+   
+   chan12 {
+   
+   chan-name = "led7708-chan12";
+   };
+   chan13 {
+   
+   chan-name = "led7708-chan13";
+   };
+   
+   chan14 {
+   
+   chan-name = "led7708-chan14";
+   };
+   chan15 {
+   
+   chan-name = "led7708-chan15";
+   };
+   
+   chan16 {
+   
+   chan-name = "led7708-chan16";
+   };
+   
+   chan-common {
+   
+   chan-name = "led7708-chan-comm";
+   };
+};
diff --git a/KERNEL/Documentation/leds/leds-st7708.txt 
b/KERNEL/Documentation/leds/leds-st7708.txt
new file mode 100644
index 000..c1725ab
--- /dev/null
+++ b/KERNEL/Documentation/leds/leds-st7708.txt
@@ -0,0 +1,167 @@
+Kernel driver for led7708


s/Kernel driver for led7708/LED class driver for STMicroelectronics LED7708/

Please also use following comment style 

Re: [PATCH] Added Support for STMicroelectronics 16 channels LED7708 LED Driver

2016-10-07 Thread Jacek Anaszewski

Hi Saurabh,

Thanks for the patch.

General remarks:
- use scripts/checkpatch.pl
- read Documentation/CodingStyle
- read Documentation/SubmitChecklist
- read Documentation/SubmittingDrivers
- read Documentation/SubmittingPatches

On 10/06/2016 07:46 AM, Saurabh Rawat wrote:

---
 .../devicetree/bindings/leds/leds-st.txt   |  105 ++
 KERNEL/Documentation/leds/leds-st7708.txt  |  167 +++
 KERNEL/drivers/leds/leds-st.c  | 1210 
 KERNEL/include/linux/platform_data/leds-st.h   |  170 +++


The paths should be related to the kernel root directory.
I believe "KERNEL" is your local directory.

Before submitting a patch please confirm that it applies correctly
to the for-4.10 branch of

git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds.git



 patches/defconfig  |3 +-
 5 files changed, 1654 insertions(+), 1 deletion(-)
 create mode 100644 KERNEL/Documentation/devicetree/bindings/leds/leds-st.txt
 create mode 100644 KERNEL/Documentation/leds/leds-st7708.txt
 create mode 100644 KERNEL/drivers/leds/leds-st.c


Why leds-st.c and not leds-st7708.c ?


 create mode 100644 KERNEL/include/linux/platform_data/leds-st.h


Ditto.



diff --git a/KERNEL/Documentation/devicetree/bindings/leds/leds-st.txt 
b/KERNEL/Documentation/devicetree/bindings/leds/leds-st.txt
new file mode 100644
index 000..dde53f9
--- /dev/null
+++ b/KERNEL/Documentation/devicetree/bindings/leds/leds-st.txt
@@ -0,0 +1,105 @@
+STMicroelectronics LED7708 Driver connected to BeagleboneBlack.This can be 
customized for any other


Don't exceed line length limit (80 characters). It applies also to
the other lines in the patch.


+hardware platform running linux depending on available free GPIOS
+
+Required properties:
+- compatible : should be : "st,st-leds".
+- sdo-gpio :contains a single GPIO specifier for the GPIO which is used for 
master to slave data OUT data.
+- sdi-gpio: contains a single GPIO specifier for the GPIO which is used for 
master to slave data IN data.
+- le-gpios: contains a single GPIO specifier for the GPIO which is used for 
Latch Enable data.
+- lren-gpios: contains a single GPIO specifier for the GPIO which is used for 
Lren data.This has to be High for Device to Operate.


Why here *-gpios and above *-gpio?


+- sck-gpio: contains a single GPIO specifier for the GPIO which is used for 
the clock pin.
+- chanx :For controlling each LED channel Independently
+- chan-common: For controlling all the 16 channels in a single shot.


It seems that using led-sources property could simplify your driver.
Please refer to:
- Documentation/devicetree/bindings/leds/common.txt,
- leds-max77693 driver, that uses that property.
- Documentation/devicetree/bindings/mfd/max77693.txt.


+
+Optional properties:
+ - None


If none, then just don't mention this category.


+Example:
+
+st-leds {
+compatible = "st,st-leds";
+sdo-gpio = < 16 1>;
+sdi-gpio = < 28 1>;
+le-gpio = < 21 1>;
+lren-gpio = < 19 1>;
+sck-gpio = < 17 1>;
+
+chan1 {
+
+chan-name = "led7708-chan1";
+};
+
+chan2 {
+
+chan-name = "led7708-chan2";
+};
+chan3 {
+
+chan-name = "led7708-chan3";
+};
+
+chan4 {
+
+chan-name = "led7708-chan4";
+};
+chan5 {
+
+chan-name = "led7708-chan5";
+};
+
+chan6 {
+
+chan-name = "led7708-chan6";
+};
+chan7 {
+
+chan-name = "led7708-chan7";
+};
+
+chan8 {
+
+chan-name = "led7708-chan8";
+};
+
+chan9 {
+
+chan-name = "led7708-chan9";
+   };
+   
+   chan10 {
+   
+   chan-name = "led7708-chan10";
+   };
+   chan11 {
+   
+   chan-name = "led7708-chan11";
+   };
+   
+   chan12 {
+   
+   chan-name = "led7708-chan12";
+   };
+   chan13 {
+   
+   chan-name = "led7708-chan13";
+   };
+   
+   chan14 {
+   
+   chan-name = "led7708-chan14";
+   };
+   chan15 {
+   
+   chan-name = "led7708-chan15";
+   };
+   
+   chan16 {
+   
+   chan-name = "led7708-chan16";
+   };
+   
+   chan-common {
+   
+   chan-name = "led7708-chan-comm";
+   };
+};
diff --git a/KERNEL/Documentation/leds/leds-st7708.txt 
b/KERNEL/Documentation/leds/leds-st7708.txt
new file mode 100644
index 000..c1725ab
--- /dev/null
+++ b/KERNEL/Documentation/leds/leds-st7708.txt
@@ -0,0 +1,167 @@
+Kernel driver for led7708


s/Kernel driver for led7708/LED class driver for STMicroelectronics LED7708/

Please also use following comment style 

[PATCH] Added Support for STMicroelectronics 16 channels LED7708 LED Driver

2016-10-05 Thread Saurabh Rawat
---
 .../devicetree/bindings/leds/leds-st.txt   |  105 ++
 KERNEL/Documentation/leds/leds-st7708.txt  |  167 +++
 KERNEL/drivers/leds/leds-st.c  | 1210 
 KERNEL/include/linux/platform_data/leds-st.h   |  170 +++
 patches/defconfig  |3 +-
 5 files changed, 1654 insertions(+), 1 deletion(-)
 create mode 100644 KERNEL/Documentation/devicetree/bindings/leds/leds-st.txt
 create mode 100644 KERNEL/Documentation/leds/leds-st7708.txt
 create mode 100644 KERNEL/drivers/leds/leds-st.c
 create mode 100644 KERNEL/include/linux/platform_data/leds-st.h

diff --git a/KERNEL/Documentation/devicetree/bindings/leds/leds-st.txt 
b/KERNEL/Documentation/devicetree/bindings/leds/leds-st.txt
new file mode 100644
index 000..dde53f9
--- /dev/null
+++ b/KERNEL/Documentation/devicetree/bindings/leds/leds-st.txt
@@ -0,0 +1,105 @@
+STMicroelectronics LED7708 Driver connected to BeagleboneBlack.This can be 
customized for any other
+hardware platform running linux depending on available free GPIOS
+
+Required properties:
+- compatible : should be : "st,st-leds".
+- sdo-gpio :contains a single GPIO specifier for the GPIO which is used for 
master to slave data OUT data.
+- sdi-gpio: contains a single GPIO specifier for the GPIO which is used for 
master to slave data IN data.
+- le-gpios: contains a single GPIO specifier for the GPIO which is used for 
Latch Enable data.
+- lren-gpios: contains a single GPIO specifier for the GPIO which is used for 
Lren data.This has to be High for Device to Operate.
+- sck-gpio: contains a single GPIO specifier for the GPIO which is used for 
the clock pin.
+- chanx :For controlling each LED channel Independently 
+- chan-common: For controlling all the 16 channels in a single shot.
+
+Optional properties:
+ - None
+
+Example:
+
+st-leds {
+compatible = "st,st-leds";
+sdo-gpio = < 16 1>;
+sdi-gpio = < 28 1>;
+le-gpio = < 21 1>;
+lren-gpio = < 19 1>;
+sck-gpio = < 17 1>;
+
+chan1 {
+
+chan-name = "led7708-chan1";
+};
+
+chan2 {
+
+chan-name = "led7708-chan2";
+};
+chan3 {
+
+chan-name = "led7708-chan3";
+};
+
+chan4 {
+
+chan-name = "led7708-chan4";
+};
+chan5 {
+
+chan-name = "led7708-chan5";
+};
+
+chan6 {
+
+chan-name = "led7708-chan6";
+};
+chan7 {
+
+chan-name = "led7708-chan7";
+};
+
+chan8 {
+
+chan-name = "led7708-chan8";
+};
+
+chan9 {
+
+chan-name = "led7708-chan9";
+   };
+   
+   chan10 {
+   
+   chan-name = "led7708-chan10";
+   };
+   chan11 {
+   
+   chan-name = "led7708-chan11";
+   };
+   
+   chan12 {
+   
+   chan-name = "led7708-chan12";
+   };
+   chan13 {
+   
+   chan-name = "led7708-chan13";
+   };
+   
+   chan14 {
+   
+   chan-name = "led7708-chan14";
+   };
+   chan15 {
+   
+   chan-name = "led7708-chan15";
+   };
+   
+   chan16 {
+   
+   chan-name = "led7708-chan16";
+   };
+   
+   chan-common {
+   
+   chan-name = "led7708-chan-comm";
+   };
+};
diff --git a/KERNEL/Documentation/leds/leds-st7708.txt 
b/KERNEL/Documentation/leds/leds-st7708.txt
new file mode 100644
index 000..c1725ab
--- /dev/null
+++ b/KERNEL/Documentation/leds/leds-st7708.txt
@@ -0,0 +1,167 @@
+Kernel driver for led7708
+===
+
+* STMicroelectronics LED7708 Driver
+* Datasheet: www.st.com/resource/en/datasheet/led7708.pdf
+
+Authors: Saurabh Rawat
+Contact: Saurabh Rawat (saurabh.rawat-at-st.com)
+
+Description
+
+LED7708 is a simple 16 channels LED driver hardware from STMicroelectronics. 
Leds can be controlled directly via
+the led class control interface.
+Each channel can be controlled independently in two modes - group-dimming mode 
or gray-scale dimming mode.
+In group dimming mode writing brightness to any one channel will configure the 
brightness of all the channels 
+with the same brightness.This mode is enabled by default in the driver.
+In gray scale dimming mode each channel can be configured to have different 
brightness values and all the channels
+can be controlled in one shot.
+
+Follow these steps to configure the LED7708 channels in goup-dimming mode
+- Either select the channels from the sysfs by channel mask  e.g ff00 -> echo 
ff00 > led_7708_select_channel for 9-16 channels 
+  

[PATCH] Added Support for STMicroelectronics 16 channels LED7708 LED Driver

2016-10-05 Thread Saurabh Rawat
---
 .../devicetree/bindings/leds/leds-st.txt   |  105 ++
 KERNEL/Documentation/leds/leds-st7708.txt  |  167 +++
 KERNEL/drivers/leds/leds-st.c  | 1210 
 KERNEL/include/linux/platform_data/leds-st.h   |  170 +++
 patches/defconfig  |3 +-
 5 files changed, 1654 insertions(+), 1 deletion(-)
 create mode 100644 KERNEL/Documentation/devicetree/bindings/leds/leds-st.txt
 create mode 100644 KERNEL/Documentation/leds/leds-st7708.txt
 create mode 100644 KERNEL/drivers/leds/leds-st.c
 create mode 100644 KERNEL/include/linux/platform_data/leds-st.h

diff --git a/KERNEL/Documentation/devicetree/bindings/leds/leds-st.txt 
b/KERNEL/Documentation/devicetree/bindings/leds/leds-st.txt
new file mode 100644
index 000..dde53f9
--- /dev/null
+++ b/KERNEL/Documentation/devicetree/bindings/leds/leds-st.txt
@@ -0,0 +1,105 @@
+STMicroelectronics LED7708 Driver connected to BeagleboneBlack.This can be 
customized for any other
+hardware platform running linux depending on available free GPIOS
+
+Required properties:
+- compatible : should be : "st,st-leds".
+- sdo-gpio :contains a single GPIO specifier for the GPIO which is used for 
master to slave data OUT data.
+- sdi-gpio: contains a single GPIO specifier for the GPIO which is used for 
master to slave data IN data.
+- le-gpios: contains a single GPIO specifier for the GPIO which is used for 
Latch Enable data.
+- lren-gpios: contains a single GPIO specifier for the GPIO which is used for 
Lren data.This has to be High for Device to Operate.
+- sck-gpio: contains a single GPIO specifier for the GPIO which is used for 
the clock pin.
+- chanx :For controlling each LED channel Independently 
+- chan-common: For controlling all the 16 channels in a single shot.
+
+Optional properties:
+ - None
+
+Example:
+
+st-leds {
+compatible = "st,st-leds";
+sdo-gpio = < 16 1>;
+sdi-gpio = < 28 1>;
+le-gpio = < 21 1>;
+lren-gpio = < 19 1>;
+sck-gpio = < 17 1>;
+
+chan1 {
+
+chan-name = "led7708-chan1";
+};
+
+chan2 {
+
+chan-name = "led7708-chan2";
+};
+chan3 {
+
+chan-name = "led7708-chan3";
+};
+
+chan4 {
+
+chan-name = "led7708-chan4";
+};
+chan5 {
+
+chan-name = "led7708-chan5";
+};
+
+chan6 {
+
+chan-name = "led7708-chan6";
+};
+chan7 {
+
+chan-name = "led7708-chan7";
+};
+
+chan8 {
+
+chan-name = "led7708-chan8";
+};
+
+chan9 {
+
+chan-name = "led7708-chan9";
+   };
+   
+   chan10 {
+   
+   chan-name = "led7708-chan10";
+   };
+   chan11 {
+   
+   chan-name = "led7708-chan11";
+   };
+   
+   chan12 {
+   
+   chan-name = "led7708-chan12";
+   };
+   chan13 {
+   
+   chan-name = "led7708-chan13";
+   };
+   
+   chan14 {
+   
+   chan-name = "led7708-chan14";
+   };
+   chan15 {
+   
+   chan-name = "led7708-chan15";
+   };
+   
+   chan16 {
+   
+   chan-name = "led7708-chan16";
+   };
+   
+   chan-common {
+   
+   chan-name = "led7708-chan-comm";
+   };
+};
diff --git a/KERNEL/Documentation/leds/leds-st7708.txt 
b/KERNEL/Documentation/leds/leds-st7708.txt
new file mode 100644
index 000..c1725ab
--- /dev/null
+++ b/KERNEL/Documentation/leds/leds-st7708.txt
@@ -0,0 +1,167 @@
+Kernel driver for led7708
+===
+
+* STMicroelectronics LED7708 Driver
+* Datasheet: www.st.com/resource/en/datasheet/led7708.pdf
+
+Authors: Saurabh Rawat
+Contact: Saurabh Rawat (saurabh.rawat-at-st.com)
+
+Description
+
+LED7708 is a simple 16 channels LED driver hardware from STMicroelectronics. 
Leds can be controlled directly via
+the led class control interface.
+Each channel can be controlled independently in two modes - group-dimming mode 
or gray-scale dimming mode.
+In group dimming mode writing brightness to any one channel will configure the 
brightness of all the channels 
+with the same brightness.This mode is enabled by default in the driver.
+In gray scale dimming mode each channel can be configured to have different 
brightness values and all the channels
+can be controlled in one shot.
+
+Follow these steps to configure the LED7708 channels in goup-dimming mode
+- Either select the channels from the sysfs by channel mask  e.g ff00 -> echo 
ff00 > led_7708_select_channel for 9-16 channels 
+