Skip to content

Commit

Permalink
leds: add driver for Mellanox systems LEDs
Browse files Browse the repository at this point in the history
This makes it possible to create a set of LEDs for Mellanox systems:
"msx6710", "msx6720", "msb7700", "msn2700", "msx1410", "msn2410",
"msb7800", "msn2740", "msn2100".

Driver obtains LED devices according to system configuration, provided
through system DMI data, like mlxcpld:fan1:green, mlxcpld:fan1:red and
creates devices in form: "devicename:colour:function".

LED setting is controlled through on board CPLD Lattice device.
For setting particular LED off, solid, blink:
echo 0 > /sys/class/leds/mlxcpld\:status\:green/brightness
echo 1 > /sys/class/leds/mlxcpld\:status\:green/brightness
echo timer > /sys/class/leds/mlxcpld\:status\:green/trigger

On module probing all LEDs are set green, on removing - off.

Last setting overwrites previous, f.e. sequence for
changing LED from green - red - green:
echo 1 > /sys/class/leds/mlxcpld\:psu\:green/brightness
echo 1 > /sys/class/leds/mlxcpld\:psu\:red/brightness
echo 1 > /sys/class/leds/mlxcpld\:psu\:green/brightness
Note: LEDs cannot be turned on/off simultaneously.

The Kconfig currently controlling compilation of this code is:
drivers/leds/Kconfig:config LEDS_MLXCPLD

Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
  • Loading branch information
mellanoxbmc authored and janaszewski committed Sep 15, 2016
1 parent 1f70cb4 commit be4fdf9
Show file tree
Hide file tree
Showing 5 changed files with 556 additions and 0 deletions.
110 changes: 110 additions & 0 deletions Documentation/leds/leds-mlxcpld.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
Kernel driver for Mellanox systems LEDs
=======================================

Provide system LED support for the nex Mellanox systems:
"msx6710", "msx6720", "msb7700", "msn2700", "msx1410",
"msn2410", "msb7800", "msn2740", "msn2100".

Description
-----------
Driver provides the following LEDs for the systems "msx6710", "msx6720",
"msb7700", "msn2700", "msx1410", "msn2410", "msb7800", "msn2740":
mlxcpld:fan1:green
mlxcpld:fan1:red
mlxcpld:fan2:green
mlxcpld:fan2:red
mlxcpld:fan3:green
mlxcpld:fan3:red
mlxcpld:fan4:green
mlxcpld:fan4:red
mlxcpld:psu:green
mlxcpld:psu:red
mlxcpld:status:green
mlxcpld:status:red

"status"
CPLD reg offset: 0x20
Bits [3:0]

"psu"
CPLD reg offset: 0x20
Bits [7:4]

"fan1"
CPLD reg offset: 0x21
Bits [3:0]

"fan2"
CPLD reg offset: 0x21
Bits [7:4]

"fan3"
CPLD reg offset: 0x22
Bits [3:0]

"fan4"
CPLD reg offset: 0x22
Bits [7:4]

Color mask for all the above LEDs:
[bit3,bit2,bit1,bit0] or
[bit7,bit6,bit5,bit4]:
[0,0,0,0] = LED OFF
[0,1,0,1] = Red static ON
[1,1,0,1] = Green static ON
[0,1,1,0] = Red blink 3Hz
[1,1,1,0] = Green blink 3Hz
[0,1,1,1] = Red blink 6Hz
[1,1,1,1] = Green blink 6Hz

Driver provides the following LEDs for the system "msn2100":
mlxcpld:fan:green
mlxcpld:fan:red
mlxcpld:psu1:green
mlxcpld:psu1:red
mlxcpld:psu2:green
mlxcpld:psu2:red
mlxcpld:status:green
mlxcpld:status:red
mlxcpld:uid:blue

"status"
CPLD reg offset: 0x20
Bits [3:0]

"fan"
CPLD reg offset: 0x21
Bits [3:0]

"psu1"
CPLD reg offset: 0x23
Bits [3:0]

"psu2"
CPLD reg offset: 0x23
Bits [7:4]

"uid"
CPLD reg offset: 0x24
Bits [3:0]

Color mask for all the above LEDs, excepted uid:
[bit3,bit2,bit1,bit0] or
[bit7,bit6,bit5,bit4]:
[0,0,0,0] = LED OFF
[0,1,0,1] = Red static ON
[1,1,0,1] = Green static ON
[0,1,1,0] = Red blink 3Hz
[1,1,1,0] = Green blink 3Hz
[0,1,1,1] = Red blink 6Hz
[1,1,1,1] = Green blink 6Hz

Color mask for uid LED:
[bit3,bit2,bit1,bit0]:
[0,0,0,0] = LED OFF
[1,1,0,1] = Blue static ON
[1,1,1,0] = Blue blink 3Hz
[1,1,1,1] = Blue blink 6Hz

Driver supports HW blinking at 3Hz and 6Hz frequency (50% duty cycle).
For 3Hz duty cylce is about 167 msec, for 6Hz is about 83 msec.
7 changes: 7 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -7649,6 +7649,13 @@ W: http://www.mellanox.com
Q: http://patchwork.ozlabs.org/project/netdev/list/
F: drivers/net/ethernet/mellanox/mlxsw/

MELLANOX MLXCPLD LED DRIVER
M: Vadim Pasternak <vadimp@mellanox.com>
L: linux-leds@vger.kernel.org
S: Supported
F: drivers/leds/leds-mlxcpld.c
F: Documentation/leds/leds-mlxcpld.txt

SOFT-ROCE DRIVER (rxe)
M: Moni Shoua <monis@mellanox.com>
L: linux-rdma@vger.kernel.org
Expand Down
8 changes: 8 additions & 0 deletions drivers/leds/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,14 @@ config LEDS_PM8058
Choose this option if you want to use the LED drivers in
the Qualcomm PM8058 PMIC.

config LEDS_MLXCPLD
tristate "LED support for the Mellanox boards"
depends on X86_64 && DMI
depends on LEDS_CLASS
help
This option enabled support for the LEDs on the Mellanox
boards. Say Y to enabled these.

comment "LED Triggers"
source "drivers/leds/trigger/Kconfig"

Expand Down
1 change: 1 addition & 0 deletions drivers/leds/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ obj-$(CONFIG_LEDS_SEAD3) += leds-sead3.o
obj-$(CONFIG_LEDS_IS31FL319X) += leds-is31fl319x.o
obj-$(CONFIG_LEDS_IS31FL32XX) += leds-is31fl32xx.o
obj-$(CONFIG_LEDS_PM8058) += leds-pm8058.o
obj-$(CONFIG_LEDS_MLXCPLD) += leds-mlxcpld.o

# LED SPI Drivers
obj-$(CONFIG_LEDS_DAC124S085) += leds-dac124s085.o
Expand Down
Loading

0 comments on commit be4fdf9

Please sign in to comment.