Introduce support for mlxreg LED driver
Subsystems (3)
v5 cover Introduce support for mlxreg LED driver
This patch introduces LED driver, based on regmap interface. This patch depends on previously sent:
[patch v4 1/2] mfd: Add Mellanox regmap core driver
because it includes include/linux/platform_data/mlxreg.h from this patch.
Vadim Pasternak (1):
leds: add driver for support Mellanox regmap LEDs for BMC
MAINTAINERS | 1 + drivers/leds/Kconfig | 10 ++ drivers/leds/Makefile | 1 + drivers/leds/leds-mlxreg.c | 317 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 329 insertions(+) create mode 100644 drivers/leds/leds-mlxreg.c
Signature · 1 line
2.1.4
PATCH v5 1/1 leds: add driver for support Mellanox regmap LEDs for BMC
Driver obtains LED devices according to system configuration and creates devices in form: "devicename:color:function", like
The full path is to be:
/sys/class/leds/mlxreg\:status\:amber/brightness
After timer trigger activation:
echo timer > /sys/class/leds/mlxreg\:status\:amber/trigger Attributes for LED blinking will appaer in sysfs infrastructure:
/sys/class/leds/mlxreg\:status\:amber/delay_off /sys/class/leds/mlxreg\:status\:amber/delay_on
LED setting is controlled through the on-board programmable devices, which exports its register map. This device could be attached to any bus type, for which register mapping is supported.
---v4->v5
Comments pointed out by Jacek:
- Make consistent naming in mlxreg_led_brightness_set, mlxreg_led_brightness_get, mlxreg_led_config;
- Remove unnecessary data assignment in mlxreg_led_config; Changes added by Vadim:
- Add internal structure mlxreg_led_data to leds-mlxreg.c;v3->v4
Comments pointed out by Jacek:
- add led in declaration mlxreg_led_store_hw and mlxreg_led_get_hw;
- rearrange local variables names in mlxreg_led_config; Comments pointed out by Pavel:
- replace _HALF/_FULL with BLINK_3HZ/BLINK_6HZ;
- in mlxreg_led_get_hw just return after access error;
- explicit check for green led is not added, since control device can be programmed for blue LED and this case it reuses masks of green LED.v2->v3:
Comments pointed out by Jacek:
- fix order in includes;
- add declaration pdata in mlxreg_led_store_hw and mlxreg_led_get_hw;
- add declaration of led_data in mlxreg_led_config;
- use LED_ON in assignment instead of 1;
- fix mutex call in mlxreg_led_remove;v1->v2:
Comments pointed out by Jacek:
- remove macros MLXREG_MAP and MLXREG_CDEV;
- brightness_set_blocking insteaf of brightness_set, this fix allows removing of context validation and workqueue and also three fields from struct mlxreg_core_led_data in mlxreg.h;
- remove MLXREG_LED_NAME;
- extend Kconfig description;
Changes added by Vadim:
- remove unnecessary includes after dropping workqueue;
--- MAINTAINERS | 1 + drivers/leds/Kconfig | 10 ++ drivers/leds/Makefile | 1 + drivers/leds/leds-mlxreg.c | 317 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 329 insertions(+) create mode 100644 drivers/leds/leds-mlxreg.c
MAINTAINERS +1 -0
@@ -8566,6 +8566,7 @@ M: Vadim Pasternak <[email protected]> L: [email protected] S: Supported F: drivers/leds/leds-mlxcpld.c +F: drivers/leds/leds-mlxreg.c F: Documentation/leds/leds-mlxcpld.txt MELLANOX PLATFORM DRIVER
drivers/leds/Kconfig +10 -0
@@ -657,6 +657,16 @@ config LEDS_MLXCPLD This option enabled support for the LEDs on the Mellanox boards. Say Y to enabled these. +config LEDS_MLXREG + tristate "LED support for the Mellanox BMC cards" + depends on LEDS_CLASS + help + This option enabled support for the LEDs on the Mellanox BMC cards. + The driver can be activated from the device tree or by the direct + platform device add call. Say Y to enabled these. To compile this + driver as a module, choose 'M' here: the module will be called + leds-mlxreg. + config LEDS_USER tristate "Userspace LED support" depends on LEDS_CLASS
drivers/leds/Makefile +1 -0
@@ -69,6 +69,7 @@ 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 +obj-$(CONFIG_LEDS_MLXREG) += leds-mlxreg.o obj-$(CONFIG_LEDS_NIC78BX) += leds-nic78bx.o obj-$(CONFIG_LEDS_MT6323) += leds-mt6323.o
drivers/leds/leds-mlxreg.c new file +317 -0
317 lines not on this page · raw message
Signature · 1 line
2.1.4