Skip to content

Commit 36234f4

Browse files
kestrel/leds/trigger: implement led trigger driver for group pwm
pca9633 i2c leds driver supports group pwm which currently not utilized by leds-pca963x driver. This patch exposes various registers values via sysfs to user and can be used to achieve group blinking and dimming. Signed-off-by: Amitesh Singh <amitesh.singh@chargepoint.com>
1 parent 05292f1 commit 36234f4

File tree

5 files changed

+533
-0
lines changed

5 files changed

+533
-0
lines changed

drivers/leds/leds-pca963x.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include <linux/property.h>
3333
#include <linux/slab.h>
3434
#include <linux/of.h>
35+
#include <linux/i2c-pca963x.h>
3536

3637
/* LED select registers determine the source that drives LED outputs */
3738
#define PCA963X_LED_OFF 0x0 /* LED driver off */
@@ -371,6 +372,14 @@ static const struct of_device_id of_pca963x_match[] = {
371372
};
372373
MODULE_DEVICE_TABLE(of, of_pca963x_match);
373374

375+
static struct i2c_client *g_client;
376+
377+
struct i2c_client *i2c_get_pca963x_device(void)
378+
{
379+
return g_client;
380+
}
381+
EXPORT_SYMBOL_GPL(i2c_get_pca963x_device);
382+
374383
static int pca963x_probe(struct i2c_client *client,
375384
const struct i2c_device_id *id)
376385
{
@@ -398,6 +407,8 @@ static int pca963x_probe(struct i2c_client *client,
398407
chip->chipdef = chipdef;
399408
chip->client = client;
400409

410+
g_client = client;
411+
401412
/* Turn off LEDs by default*/
402413
for (i = 0; i < chipdef->n_leds / 4; i++)
403414
i2c_smbus_write_byte_data(client, chipdef->ledout_base + i, 0x00);

drivers/leds/trigger/Kconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ config LEDS_TRIGGER_TIMER
1919

2020
If unsure, say Y.
2121

22+
config LEDS_TRIGGER_GRPPWM
23+
tristate "LED Group PWM trigger"
24+
help
25+
This allows LEDs to be controlled by group pwm feature,
26+
supported by pca9633 i2c driver
27+
28+
if unsure, say Y.
29+
2230
config LEDS_TRIGGER_ONESHOT
2331
tristate "LED One-shot Trigger"
2432
help

drivers/leds/trigger/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ obj-$(CONFIG_LEDS_TRIGGER_NETDEV) += ledtrig-netdev.o
1616
obj-$(CONFIG_LEDS_TRIGGER_PATTERN) += ledtrig-pattern.o
1717
obj-$(CONFIG_LEDS_TRIGGER_AUDIO) += ledtrig-audio.o
1818
obj-$(CONFIG_LEDS_TRIGGER_TTY) += ledtrig-tty.o
19+
obj-$(CONFIG_LEDS_TRIGGER_GRPPWM) += ledtrig-grppwm.o

0 commit comments

Comments
 (0)