leds: add SGI IP30 led support
PATCH v3 1/1 leds: add SGI IP30 led support
This patch implemenets a driver to support the front panel LEDs of SGI Octane (IP30) workstations.
---
Changes in v3:
- rebased to 5.6-rc2
Changes in v2:
- use led names conforming to include/dt-bindings/leds/common.h
- read LED state from firmware
- leave setting up to user
drivers/leds/Kconfig | 11 ++++++ drivers/leds/Makefile | 1 + drivers/leds/leds-ip30.c | 80 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+) create mode 100644 drivers/leds/leds-ip30.c
drivers/leds/Kconfig +11 -0
@@ -846,6 +846,17 @@ config LEDS_TPS6105X It is a single boost converter primarily for white LEDs and audio amplifiers. +config LEDS_IP30 + tristate "LED support for SGI Octane machines" + depends on LEDS_CLASS + depends on SGI_MFD_IOC3 + help + This option enables support for the Red and White LEDs of + SGI Octane machines. + + To compile this driver as a module, choose M here: the module + will be called leds-ip30. + comment "LED Triggers" source "drivers/leds/trigger/Kconfig"
drivers/leds/Makefile +1 -0
@@ -86,6 +86,7 @@ obj-$(CONFIG_LEDS_TI_LMU_COMMON) += leds-ti-lmu-common.o obj-$(CONFIG_LEDS_LM3697) += leds-lm3697.o obj-$(CONFIG_LEDS_LM36274) += leds-lm36274.o obj-$(CONFIG_LEDS_TPS6105X) += leds-tps6105x.o +obj-$(CONFIG_LEDS_IP30) += leds-ip30.o # LED SPI Drivers obj-$(CONFIG_LEDS_CR0014114) += leds-cr0014114.o
drivers/leds/leds-ip30.c new file +80 -0
80 lines not on this page · raw message
Signature · 1 line
2.25.0
Thomas
Quoted 5 lines · Thomas Bogendoerfer
This patch implemenets a driver to support the front panel LEDs of SGI Octane (IP30) workstations.
Signed-off-by Thomas Bogendoerfer <[email protected]>---
Sorry for the delay in review I had to go back and review v1 and v2 comments
Quoted 64 lines
Changes in v3:
- rebased to 5.6-rc2Changes in v2:
- use led names conforming toinclude/dt-bindings/leds/common.h
- read LED state from firmware
- leave setting up to userdrivers/leds/Kconfig | 11 ++++++ drivers/leds/Makefile | 1 + drivers/leds/leds-ip30.c | 80 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+)create mode 100644
drivers/leds/leds-ip30.cdrivers/leds/Kconfig +11
-0@@ -846,6 +846,17 @@ config LEDS_TPS6105X It is a single boost converter primarily for white LEDs and audio amplifiers. +config LEDS_IP30 + tristate "LED support for SGI Octane machines" + depends on LEDS_CLASS + depends on SGI_MFD_IOC3 + help + This option enables support for the Red and White LEDs of + SGI Octane machines. + + To compile this driver as a module, choose M here: the module + will be called leds-ip30. + comment "LED Triggers" source "drivers/leds/trigger/Kconfig"drivers/leds/Makefile +1
-0@@ -86,6 +86,7 @@ obj-$(CONFIG_LEDS_TI_LMU_COMMON) += leds-ti-lmu-common.o obj-$(CONFIG_LEDS_LM3697) += leds-lm3697.o obj-$(CONFIG_LEDS_LM36274) += leds-lm36274.o obj-$(CONFIG_LEDS_TPS6105X) += leds-tps6105x.o +obj-$(CONFIG_LEDS_IP30) += leds-ip30.o # LED SPI Drivers obj-$(CONFIG_LEDS_CR0014114) += leds-cr0014114.odrivers/leds/leds-ip30.c new file +10
-0@@ -0,0 +1,80 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* LED Driver for SGI Octane machines +*/ + +#include <linux/module.h> +#include <linux/kernel.h> +#include <linux/platform_device.h> +#include <linux/leds.h> +
drivers/leds/leds-ip30.c line 20
Quoted 10 lines
drivers/leds/leds-ip30.c new file +10
-0+struct ip30_led { +struct led_classdev cdev; +u32 __iomem *reg; +}; + +static void ip30led_set (struct led_classdev *led_cdev, +enum led_brightness value) +{ + struct ip30_led *led = container_of(led_cdev, struct ip30_led, cdev); +
With max_brightness set to 1 then value will only be either 1 or 0. The LED framework takes care of gating the values.
So this can be writel(value, led->reg);
Otherwise