Skip to contentSkip to conversation

leds: add SGI IP30 led support

PATCH Superseded Thomas Bogendoerfer 2 participants 4 messages Feb 21, 2020 – Feb 22, 2020 LED

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 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 v4:
- simplified ip30led_set by using gated value from led framework

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 | 77 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 89 insertions(+)
 create mode 100644 drivers/leds/leds-ip30.c
drivers/leds/Kconfig +11 -0
index d82f1dea3711..c664d84e1667 100644
@@ -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
index d7e1107753fb..46bd611a03a9 100644
@@ -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 +77 -0

77 lines not on this page · raw message

Signature · 1 line
2.25.0
#1 lore raw

Hi Thomas,

I have one nit below.

Quoted 24 lines · Thomas Bogendoerfer

This patch implemenets a driver to support the front panel LEDs of SGI Octane (IP30) workstations.

---
Changes in v4:
- simplified ip30led_set by using gated value from led framework

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 | 77 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 89 insertions(+)
 create mode 100644 drivers/leds/leds-ip30.c
drivers/leds/Kconfig +0 -0

[...]

drivers/leds/Kconfig

Quoted 9 lines
drivers/leds/Kconfig +9 -0
+	data->reg = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(data->reg))
+		return PTR_ERR(data->reg);
+
+
+	if (num == 0)
+		data->cdev.name = "white:indicator";
+	else
+		data->cdev.name = "red:indicator";

Why indicator? Whereas it sounds quite generic it is used in the LED subsystem specifically for naming indicator LEDs, that are often found on flash LED controllers and are designed to indicate camera sensor activity.

If it is on the front panel of SGI Octane workstations then its function is perhaps well known?

Signature · 2 lines
Best regards,
Jacek Anaszewski
#2 lore raw
Quoted 9 lines · On Fri, 21 Feb 2020 21:31:04 +0100 Jacek Anaszewski…

drivers/leds/leds-ip30.c line 45

Quoted 4 lines
drivers/leds/leds-ip30.c new file +4 -0
+	if (num == 0)
+		data->cdev.name = "white:indicator";
+	else
+		data->cdev.name = "red:indicator";

Why indicator? Whereas it sounds quite generic it is used in the LED subsystem specifically for naming indicator LEDs, that are often found on flash LED controllers and are designed to indicate camera sensor activity.

ok, ic.

Quoted 2 lines

If it is on the front panel of SGI Octane workstations then its function is perhaps well known?

the red LED is clearly a fault led. The white LED will be switch on after system diagnostic was successfull. Nothing from common.h really fits that, maybe status ?

Thomas.

Signature · 3 lines
SUSE Software Solutions Germany GmbH
HRB 36809 (AG Nürnberg)
Geschäftsführer: Felix Imendörffer
#3 lore raw
Quoted 14 lines · Thomas Bogendoerfer
Quoted 9 lines · On Fri, 21 Feb 2020 21:31:04 +0100 Jacek Anaszewski…

drivers/leds/leds-ip30.c line 45

Quoted 4 lines
drivers/leds/leds-ip30.c new file +4 -0
+	if (num == 0)
+		data->cdev.name = "white:indicator";
+	else
+		data->cdev.name = "red:indicator";

Why indicator? Whereas it sounds quite generic it is used in the LED subsystem specifically for naming indicator LEDs, that are often found on flash LED controllers and are designed to indicate camera sensor activity.

Quoted 6 lines

ok, ic.

Quoted 2 lines

If it is on the front panel of SGI Octane workstations then its function is perhaps well known?

the red LED is clearly a fault led.

We have fault in common LED names, so you can go for it.

Quoted 3 lines

The white LED will be switch on
after system diagnostic was successfull. Nothing from common.h really fits that, maybe status ?

I think that "system" would be OK. There are some LED drivers and DT bindings that use "system" in the LED names. I even proposed that also in the initial versions of my patch set standardizing LED naming but dropped it afterwards, since it its use was not clear.

But now we have good use case for it.

And one more thing: please add definitions for LEDs in your driver like:

#define IP30_LED_SYSTEM 0
#define IP30_LED_FAULT 1

and use them instead of bare 0 and 1 numbers.

Signature · 2 lines
Best regards,
Jacek Anaszewski