2007-12-03 10:34:19

by Rodolfo Giometti

[permalink] [raw]
Subject: heartbeat for leds on i2c bus

Hello,

on my custom board I have some leds mapped on a dedicated chip
connected via i2c bus.

If I try to use the heartbeat trigger I hang the system... I suppose
it is due the fact the led_set_brightness() function is called inside
a kernel timer.

How I can solve this problem? I thought to modify the trigger adding a
kernel thread who manage the led which in turn is controlled by the
kernel timer. It could be the right solution?

Thanks in advance,

Rodolfo

--

GNU/Linux Solutions e-mail: [email protected]
Linux Device Driver [email protected]
Embedded Systems [email protected]
UNIX programming phone: +39 349 2432127


2007-12-03 13:43:40

by Atsushi Nemoto

[permalink] [raw]
Subject: Re: heartbeat for leds on i2c bus

On Mon, 3 Dec 2007 11:35:57 +0100, Rodolfo Giometti <[email protected]> wrote:
> If I try to use the heartbeat trigger I hang the system... I suppose
> it is due the fact the led_set_brightness() function is called inside
> a kernel timer.
>
> How I can solve this problem? I thought to modify the trigger adding a
> kernel thread who manage the led which in turn is controlled by the
> kernel timer. It could be the right solution?

Yes, the heartbeat trigger driver assumes brightness_set() routine can
be called from timer. Other led-triggers also have this assumption.

So I'd suggest using workqueue for your led driver, as like as the
leds-gpio driver. Or you can just use the leds-gpio driver and
implement the gpio interface (gpio_set_value_cansleep) instead of the
led interface.

---
Atsushi Nemoto