* [PATCH 0/4] leds-bcm6328: several fixes and improvements @ 2015-10-08 10:35 Álvaro Fernández Rojas 2015-10-08 10:35 ` [PATCH 1/4] leds-bcm6328: print invalid LED Álvaro Fernández Rojas ` (3 more replies) 0 siblings, 4 replies; 6+ messages in thread From: Álvaro Fernández Rojas @ 2015-10-08 10:35 UTC (permalink / raw) To: linux-leds, devicetree, j.anaszewski, jogo, cernekee, f.fainelli Cc: Álvaro Fernández Rojas These patches improve leds-bcm6328 by adding invalid LED printing (like it's done in leds-bcm6358), simplifying default-state handling (once again like it's done in leds-bcm6358), and adding more init configuration options. Álvaro Fernández Rojas (4): leds-bcm6328: print invalid LED leds-bcm6328: simplify and improve default-state handling leds-bcm6328: add more init configuration options Documentation: leds: update DT bindings for leds-bcm6328 .../devicetree/bindings/leds/leds-bcm6328.txt | 10 ++++++ drivers/leds/leds-bcm6328.c | 41 ++++++++++++++++------ 2 files changed, 40 insertions(+), 11 deletions(-) -- 1.9.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/4] leds-bcm6328: print invalid LED 2015-10-08 10:35 [PATCH 0/4] leds-bcm6328: several fixes and improvements Álvaro Fernández Rojas @ 2015-10-08 10:35 ` Álvaro Fernández Rojas 2015-10-08 10:35 ` [PATCH 2/4] leds-bcm6328: simplify and improve default-state handling Álvaro Fernández Rojas ` (2 subsequent siblings) 3 siblings, 0 replies; 6+ messages in thread From: Álvaro Fernández Rojas @ 2015-10-08 10:35 UTC (permalink / raw) To: linux-leds, devicetree, j.anaszewski, jogo, cernekee, f.fainelli Cc: Álvaro Fernández Rojas Print invalid LED instead of warning only about maximum LED value. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> --- drivers/leds/leds-bcm6328.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/leds/leds-bcm6328.c b/drivers/leds/leds-bcm6328.c index 986fe1e..5daf7be 100644 --- a/drivers/leds/leds-bcm6328.c +++ b/drivers/leds/leds-bcm6328.c @@ -373,7 +373,7 @@ static int bcm6328_leds_probe(struct platform_device *pdev) continue; if (reg >= BCM6328_LED_MAX_COUNT) { - dev_err(dev, "invalid LED (>= %d)\n", + dev_err(dev, "invalid LED (%u >= %d)\n", reg, BCM6328_LED_MAX_COUNT); continue; } -- 1.9.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/4] leds-bcm6328: simplify and improve default-state handling 2015-10-08 10:35 [PATCH 0/4] leds-bcm6328: several fixes and improvements Álvaro Fernández Rojas 2015-10-08 10:35 ` [PATCH 1/4] leds-bcm6328: print invalid LED Álvaro Fernández Rojas @ 2015-10-08 10:35 ` Álvaro Fernández Rojas [not found] ` <1444300555-13988-1-git-send-email-noltari-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2015-10-09 10:20 ` [PATCH 0/4] leds-bcm6328: several fixes and improvements Jacek Anaszewski 3 siblings, 0 replies; 6+ messages in thread From: Álvaro Fernández Rojas @ 2015-10-08 10:35 UTC (permalink / raw) To: linux-leds, devicetree, j.anaszewski, jogo, cernekee, f.fainelli Cc: Álvaro Fernández Rojas This patch simplifies and improves the code related to default-state handling. It also changes the code to power off the LEDs by default. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> --- drivers/leds/leds-bcm6328.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/drivers/leds/leds-bcm6328.c b/drivers/leds/leds-bcm6328.c index 5daf7be..4de8a85 100644 --- a/drivers/leds/leds-bcm6328.c +++ b/drivers/leds/leds-bcm6328.c @@ -281,11 +281,10 @@ static int bcm6328_led(struct device *dev, struct device_node *nc, u32 reg, "linux,default-trigger", NULL); + spin_lock_irqsave(lock, flags); if (!of_property_read_string(nc, "default-state", &state)) { - spin_lock_irqsave(lock, flags); if (!strcmp(state, "on")) { led->cdev.brightness = LED_FULL; - bcm6328_led_mode(led, BCM6328_LED_MODE_ON); } else if (!strcmp(state, "keep")) { void __iomem *mode; unsigned long val, shift; @@ -296,21 +295,28 @@ static int bcm6328_led(struct device *dev, struct device_node *nc, u32 reg, else mode = mem + BCM6328_REG_MODE_LO; - val = bcm6328_led_read(mode) >> (shift % 16); + val = bcm6328_led_read(mode) >> + BCM6328_LED_SHIFT(shift % 16); val &= BCM6328_LED_MODE_MASK; - if (val == BCM6328_LED_MODE_ON) + if ((led->active_low && val == BCM6328_LED_MODE_ON) || + (!led->active_low && val == BCM6328_LED_MODE_OFF)) led->cdev.brightness = LED_FULL; - else { + else led->cdev.brightness = LED_OFF; - bcm6328_led_mode(led, BCM6328_LED_MODE_OFF); - } } else { led->cdev.brightness = LED_OFF; - bcm6328_led_mode(led, BCM6328_LED_MODE_OFF); } - spin_unlock_irqrestore(lock, flags); + } else { + led->cdev.brightness = LED_OFF; } + if ((led->active_low && led->cdev.brightness == LED_FULL) || + (!led->active_low && led->cdev.brightness == LED_OFF)) + bcm6328_led_mode(led, BCM6328_LED_MODE_ON); + else + bcm6328_led_mode(led, BCM6328_LED_MODE_OFF); + spin_unlock_irqrestore(lock, flags); + led->cdev.brightness_set = bcm6328_led_set; led->cdev.blink_set = bcm6328_blink_set; -- 1.9.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
[parent not found: <1444300555-13988-1-git-send-email-noltari-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* [PATCH 3/4] leds-bcm6328: add more init configuration options [not found] ` <1444300555-13988-1-git-send-email-noltari-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2015-10-08 10:35 ` Álvaro Fernández Rojas 2015-10-08 10:35 ` [PATCH 4/4] Documentation: leds: update DT bindings for leds-bcm6328 Álvaro Fernández Rojas 1 sibling, 0 replies; 6+ messages in thread From: Álvaro Fernández Rojas @ 2015-10-08 10:35 UTC (permalink / raw) To: linux-leds-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, j.anaszewski-Sze3O3UU22JBDgjK7y7TUQ, jogo-p3rKhJxN3npAfugRpC6u6w, cernekee-Re5JQEeQqe8AvxtiuMwx3w, f.fainelli-Re5JQEeQqe8AvxtiuMwx3w Cc: Álvaro Fernández Rojas This patch adds more init register configuration options: - Serial LEDs multiplexing. - Serial LEDs clock signal low/high polarity. - Serial LEDs data signal low/high polarity. - Serial LEDs shift direction inverted/normal. Signed-off-by: Álvaro Fernández Rojas <noltari-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> --- drivers/leds/leds-bcm6328.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/leds/leds-bcm6328.c b/drivers/leds/leds-bcm6328.c index 4de8a85..898a804 100644 --- a/drivers/leds/leds-bcm6328.c +++ b/drivers/leds/leds-bcm6328.c @@ -41,6 +41,11 @@ #define BCM6328_SERIAL_LED_SHIFT_DIR BIT(16) #define BCM6328_LED_SHIFT_TEST BIT(30) #define BCM6328_LED_TEST BIT(31) +#define BCM6328_INIT_MASK (BCM6328_SERIAL_LED_EN | \ + BCM6328_SERIAL_LED_MUX | \ + BCM6328_SERIAL_LED_CLK_NPOL | \ + BCM6328_SERIAL_LED_DATA_PPOL | \ + BCM6328_SERIAL_LED_SHIFT_DIR) #define BCM6328_LED_MODE_MASK 3 #define BCM6328_LED_MODE_OFF 0 @@ -366,9 +371,17 @@ static int bcm6328_leds_probe(struct platform_device *pdev) bcm6328_led_write(mem + BCM6328_REG_LNKACTSEL_LO, 0); val = bcm6328_led_read(mem + BCM6328_REG_INIT); - val &= ~BCM6328_SERIAL_LED_EN; + val &= ~(BCM6328_INIT_MASK); if (of_property_read_bool(np, "brcm,serial-leds")) val |= BCM6328_SERIAL_LED_EN; + if (of_property_read_bool(np, "brcm,serial-mux")) + val |= BCM6328_SERIAL_LED_MUX; + if (of_property_read_bool(np, "brcm,serial-clk-low")) + val |= BCM6328_SERIAL_LED_CLK_NPOL; + if (!of_property_read_bool(np, "brcm,serial-dat-low")) + val |= BCM6328_SERIAL_LED_DATA_PPOL; + if (!of_property_read_bool(np, "brcm,serial-shift-inv")) + val |= BCM6328_SERIAL_LED_SHIFT_DIR; bcm6328_led_write(mem + BCM6328_REG_INIT, val); for_each_available_child_of_node(np, child) { -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/4] Documentation: leds: update DT bindings for leds-bcm6328 [not found] ` <1444300555-13988-1-git-send-email-noltari-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2015-10-08 10:35 ` [PATCH 3/4] leds-bcm6328: add more init configuration options Álvaro Fernández Rojas @ 2015-10-08 10:35 ` Álvaro Fernández Rojas 1 sibling, 0 replies; 6+ messages in thread From: Álvaro Fernández Rojas @ 2015-10-08 10:35 UTC (permalink / raw) To: linux-leds-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, j.anaszewski-Sze3O3UU22JBDgjK7y7TUQ, jogo-p3rKhJxN3npAfugRpC6u6w, cernekee-Re5JQEeQqe8AvxtiuMwx3w, f.fainelli-Re5JQEeQqe8AvxtiuMwx3w Cc: Álvaro Fernández Rojas This patch adds latest DT bindings for leds-bcm6328 init register configuration. Signed-off-by: Álvaro Fernández Rojas <noltari-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> --- Documentation/devicetree/bindings/leds/leds-bcm6328.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Documentation/devicetree/bindings/leds/leds-bcm6328.txt b/Documentation/devicetree/bindings/leds/leds-bcm6328.txt index f9e36ad..3f48c1e 100644 --- a/Documentation/devicetree/bindings/leds/leds-bcm6328.txt +++ b/Documentation/devicetree/bindings/leds/leds-bcm6328.txt @@ -29,6 +29,14 @@ Required properties: Optional properties: - brcm,serial-leds : Boolean, enables Serial LEDs. Default : false + - brcm,serial-mux : Boolean, enables Serial LEDs multiplexing. + Default : false + - brcm,serial-clk-low : Boolean, makes clock signal active low. + Default : false + - brcm,serial-dat-low : Boolean, makes data signal active low. + Default : false + - brcm,serial-shift-inv : Boolean, inverts Serial LEDs shift direction. + Default : false Each LED is represented as a sub-node of the brcm,bcm6328-leds device. @@ -110,6 +118,8 @@ Scenario 2 : BCM63268 with Serial/GPHY0 LEDs #size-cells = <0>; reg = <0x10001900 0x24>; brcm,serial-leds; + brcm,serial-dat-low; + brcm,serial-shift-inv; gphy0_spd0@0 { reg = <0>; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/4] leds-bcm6328: several fixes and improvements 2015-10-08 10:35 [PATCH 0/4] leds-bcm6328: several fixes and improvements Álvaro Fernández Rojas ` (2 preceding siblings ...) [not found] ` <1444300555-13988-1-git-send-email-noltari-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2015-10-09 10:20 ` Jacek Anaszewski 3 siblings, 0 replies; 6+ messages in thread From: Jacek Anaszewski @ 2015-10-09 10:20 UTC (permalink / raw) To: Álvaro Fernández Rojas Cc: linux-leds, devicetree, jogo, cernekee, f.fainelli Hi Alvaro, Thanks for the patches, merged. Best Regards, Jacek Anaszewski On 10/08/2015 12:35 PM, Álvaro Fernández Rojas wrote: > These patches improve leds-bcm6328 by adding invalid LED printing (like it's done in leds-bcm6358), simplifying default-state handling (once again like it's done in leds-bcm6358), and adding more init configuration options. > > Álvaro Fernández Rojas (4): > leds-bcm6328: print invalid LED > leds-bcm6328: simplify and improve default-state handling > leds-bcm6328: add more init configuration options > Documentation: leds: update DT bindings for leds-bcm6328 > > .../devicetree/bindings/leds/leds-bcm6328.txt | 10 ++++++ > drivers/leds/leds-bcm6328.c | 41 ++++++++++++++++------ > 2 files changed, 40 insertions(+), 11 deletions(-) > ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-10-09 10:20 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-10-08 10:35 [PATCH 0/4] leds-bcm6328: several fixes and improvements Álvaro Fernández Rojas 2015-10-08 10:35 ` [PATCH 1/4] leds-bcm6328: print invalid LED Álvaro Fernández Rojas 2015-10-08 10:35 ` [PATCH 2/4] leds-bcm6328: simplify and improve default-state handling Álvaro Fernández Rojas [not found] ` <1444300555-13988-1-git-send-email-noltari-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2015-10-08 10:35 ` [PATCH 3/4] leds-bcm6328: add more init configuration options Álvaro Fernández Rojas 2015-10-08 10:35 ` [PATCH 4/4] Documentation: leds: update DT bindings for leds-bcm6328 Álvaro Fernández Rojas 2015-10-09 10:20 ` [PATCH 0/4] leds-bcm6328: several fixes and improvements Jacek Anaszewski
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).