diff options
| author | Peter Meerwald <pmeerw@pmeerw.net> | 2014-07-03 01:50:34 -0400 |
|---|---|---|
| committer | Bryan Wu <cooloney@gmail.com> | 2014-07-03 14:52:30 -0400 |
| commit | 3dfedb9d545346958311b8d73f90b8522d1fc759 (patch) | |
| tree | e054dccbd91ab311b1ec11e83774494d9cdf0e22 /drivers/leds/leds-pca963x.c | |
| parent | 6522fe1c39a79d4753e37d912876315720119f82 (diff) | |
leds:pca963x: Add support for PCA9635 LED driver chip
supports 16 PWM-controlled LEDs
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
Diffstat (limited to 'drivers/leds/leds-pca963x.c')
| -rw-r--r-- | drivers/leds/leds-pca963x.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/leds/leds-pca963x.c b/drivers/leds/leds-pca963x.c index 82589c0a5689..4438be9980a6 100644 --- a/drivers/leds/leds-pca963x.c +++ b/drivers/leds/leds-pca963x.c | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | * directory of this archive for more details. | 12 | * directory of this archive for more details. |
| 13 | * | 13 | * |
| 14 | * LED driver for the PCA9633 I2C LED driver (7-bit slave address 0x62) | 14 | * LED driver for the PCA9633 I2C LED driver (7-bit slave address 0x62) |
| 15 | * LED driver for the PCA9634 I2C LED driver (7-bit slave address set by hw.) | 15 | * LED driver for the PCA9634/5 I2C LED driver (7-bit slave address set by hw.) |
| 16 | * | 16 | * |
| 17 | * Note that hardware blinking violates the leds infrastructure driver | 17 | * Note that hardware blinking violates the leds infrastructure driver |
| 18 | * interface since the hardware only supports blinking all LEDs with the | 18 | * interface since the hardware only supports blinking all LEDs with the |
| @@ -52,6 +52,7 @@ | |||
| 52 | enum pca963x_type { | 52 | enum pca963x_type { |
| 53 | pca9633, | 53 | pca9633, |
| 54 | pca9634, | 54 | pca9634, |
| 55 | pca9635, | ||
| 55 | }; | 56 | }; |
| 56 | 57 | ||
| 57 | struct pca963x_chipdef { | 58 | struct pca963x_chipdef { |
| @@ -74,6 +75,12 @@ static struct pca963x_chipdef pca963x_chipdefs[] = { | |||
| 74 | .ledout_base = 0xc, | 75 | .ledout_base = 0xc, |
| 75 | .n_leds = 8, | 76 | .n_leds = 8, |
| 76 | }, | 77 | }, |
| 78 | [pca9635] = { | ||
| 79 | .grppwm = 0x12, | ||
| 80 | .grpfreq = 0x13, | ||
| 81 | .ledout_base = 0x14, | ||
| 82 | .n_leds = 16, | ||
| 83 | }, | ||
| 77 | }; | 84 | }; |
| 78 | 85 | ||
| 79 | /* Total blink period in milliseconds */ | 86 | /* Total blink period in milliseconds */ |
| @@ -84,6 +91,7 @@ static const struct i2c_device_id pca963x_id[] = { | |||
| 84 | { "pca9632", pca9633 }, | 91 | { "pca9632", pca9633 }, |
| 85 | { "pca9633", pca9633 }, | 92 | { "pca9633", pca9633 }, |
| 86 | { "pca9634", pca9634 }, | 93 | { "pca9634", pca9634 }, |
| 94 | { "pca9635", pca9635 }, | ||
| 87 | { } | 95 | { } |
| 88 | }; | 96 | }; |
| 89 | MODULE_DEVICE_TABLE(i2c, pca963x_id); | 97 | MODULE_DEVICE_TABLE(i2c, pca963x_id); |
| @@ -107,7 +115,7 @@ struct pca963x_led { | |||
| 107 | struct work_struct work; | 115 | struct work_struct work; |
| 108 | enum led_brightness brightness; | 116 | enum led_brightness brightness; |
| 109 | struct led_classdev led_cdev; | 117 | struct led_classdev led_cdev; |
| 110 | int led_num; /* 0 .. 7 potentially */ | 118 | int led_num; /* 0 .. 15 potentially */ |
| 111 | enum pca963x_cmd cmd; | 119 | enum pca963x_cmd cmd; |
| 112 | char name[32]; | 120 | char name[32]; |
| 113 | u8 gdc; | 121 | u8 gdc; |
| @@ -321,6 +329,7 @@ static const struct of_device_id of_pca963x_match[] = { | |||
| 321 | { .compatible = "nxp,pca9632", }, | 329 | { .compatible = "nxp,pca9632", }, |
| 322 | { .compatible = "nxp,pca9633", }, | 330 | { .compatible = "nxp,pca9633", }, |
| 323 | { .compatible = "nxp,pca9634", }, | 331 | { .compatible = "nxp,pca9634", }, |
| 332 | { .compatible = "nxp,pca9635", }, | ||
| 324 | {}, | 333 | {}, |
| 325 | }; | 334 | }; |
| 326 | #else | 335 | #else |
| @@ -375,9 +384,8 @@ static int pca963x_probe(struct i2c_client *client, | |||
| 375 | pca963x_chip->leds = pca963x; | 384 | pca963x_chip->leds = pca963x; |
| 376 | 385 | ||
| 377 | /* Turn off LEDs by default*/ | 386 | /* Turn off LEDs by default*/ |
| 378 | i2c_smbus_write_byte_data(client, chip->ledout_base, 0x00); | 387 | for (i = 0; i < chip->n_leds / 4; i++) |
| 379 | if (chip->n_leds > 4) | 388 | i2c_smbus_write_byte_data(client, chip->ledout_base + i, 0x00); |
| 380 | i2c_smbus_write_byte_data(client, chip->ledout_base + 1, 0x00); | ||
| 381 | 389 | ||
| 382 | for (i = 0; i < chip->n_leds; i++) { | 390 | for (i = 0; i < chip->n_leds; i++) { |
| 383 | pca963x[i].led_num = i; | 391 | pca963x[i].led_num = i; |
