LED accessed via I2C
Milton Miller II
miltonm at us.ibm.com
Mon Oct 5 05:34:59 AEDT 2020
On October 4, 2020 around 4:05am in some timezone, S.Nishikawa wrote:
>Hi,
>
>In our hardware, the Alert LED is attached to the end of the CPLD and
>is
>accessed via I2C. I think phosphor-led-sysfs controls LEDs with GPIO,
>
>but how can I control the LED beyond I2C?
Actually phosphor-led-manager will control any device that has a
kernel driver exposing the LED interface. For PCA i2c devices
we tend to expose all the pins as gpio then individual gpios as
gpio led devices because the led subsystem will change the led
instance number based on which pins of the package are LED.
It sounds like your cpld has a custom interface. If the leds
can be controlled via a separate i2c addressed endpoint I would
suggest a multi-function device binding using the mfd subsystem.
If it is directly controled by a register consider registering
a regmap like many voltage monitor and control devices. One
advantage of regmap is it provides both locking and caching of
the values written, controllable on a per-register basis.
You will need a kernel driver for the remaining function that
is accessible over the i2c interface.
See https://www.kernel.org/doc/html/latest/leds/leds-class.html#
for information on the kernel LED subsystem.
I hope this gets you headed in a productive direction.
milton
More information about the openbmc
mailing list