diff options
author | Marek Vasut <marek.vasut@gmail.com> | 2008-10-14 11:30:04 -0400 |
---|---|---|
committer | Jean Delvare <khali@mahadeva.delvare> | 2008-10-14 11:30:04 -0400 |
commit | b84ee0b0c7dc91b729672e6a971fe3b0629ef0ad (patch) | |
tree | 486494cdb58cdef1a73d908acb548a7e7fcccc40 /drivers/i2c/chips | |
parent | b806a71a0e9dacb6763371561caa693c78b93d40 (diff) |
i2c/tps65010: Vibrator hookup to gpiolib
All the tps6501{0,1,2,3,4} chips have a signal for hooking up with
a vibrator (for non-auditory cell phone "ring") ... expose that as
one more (output-only) GPIO.
[ dbrownell@users.sourceforge.net: comments; list tps65014 too ]
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/i2c/chips')
-rw-r--r-- | drivers/i2c/chips/tps65010.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/i2c/chips/tps65010.c b/drivers/i2c/chips/tps65010.c index cf02e8fceb42..acf8b9d5f575 100644 --- a/drivers/i2c/chips/tps65010.c +++ b/drivers/i2c/chips/tps65010.c | |||
@@ -456,14 +456,17 @@ static irqreturn_t tps65010_irq(int irq, void *_tps) | |||
456 | 456 | ||
457 | /* offsets 0..3 == GPIO1..GPIO4 | 457 | /* offsets 0..3 == GPIO1..GPIO4 |
458 | * offsets 4..5 == LED1/nPG, LED2 (we set one of the non-BLINK modes) | 458 | * offsets 4..5 == LED1/nPG, LED2 (we set one of the non-BLINK modes) |
459 | * offset 6 == vibrator motor driver | ||
459 | */ | 460 | */ |
460 | static void | 461 | static void |
461 | tps65010_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | 462 | tps65010_gpio_set(struct gpio_chip *chip, unsigned offset, int value) |
462 | { | 463 | { |
463 | if (offset < 4) | 464 | if (offset < 4) |
464 | tps65010_set_gpio_out_value(offset + 1, value); | 465 | tps65010_set_gpio_out_value(offset + 1, value); |
465 | else | 466 | else if (offset < 6) |
466 | tps65010_set_led(offset - 3, value ? ON : OFF); | 467 | tps65010_set_led(offset - 3, value ? ON : OFF); |
468 | else | ||
469 | tps65010_set_vib(value); | ||
467 | } | 470 | } |
468 | 471 | ||
469 | static int | 472 | static int |
@@ -477,8 +480,10 @@ tps65010_output(struct gpio_chip *chip, unsigned offset, int value) | |||
477 | if (!(tps->outmask & (1 << offset))) | 480 | if (!(tps->outmask & (1 << offset))) |
478 | return -EINVAL; | 481 | return -EINVAL; |
479 | tps65010_set_gpio_out_value(offset + 1, value); | 482 | tps65010_set_gpio_out_value(offset + 1, value); |
480 | } else | 483 | } else if (offset < 6) |
481 | tps65010_set_led(offset - 3, value ? ON : OFF); | 484 | tps65010_set_led(offset - 3, value ? ON : OFF); |
485 | else | ||
486 | tps65010_set_vib(value); | ||
482 | 487 | ||
483 | return 0; | 488 | return 0; |
484 | } | 489 | } |
@@ -646,7 +651,7 @@ static int tps65010_probe(struct i2c_client *client, | |||
646 | tps->chip.get = tps65010_gpio_get; | 651 | tps->chip.get = tps65010_gpio_get; |
647 | 652 | ||
648 | tps->chip.base = board->base; | 653 | tps->chip.base = board->base; |
649 | tps->chip.ngpio = 6; | 654 | tps->chip.ngpio = 7; |
650 | tps->chip.can_sleep = 1; | 655 | tps->chip.can_sleep = 1; |
651 | 656 | ||
652 | status = gpiochip_add(&tps->chip); | 657 | status = gpiochip_add(&tps->chip); |
@@ -675,6 +680,7 @@ static const struct i2c_device_id tps65010_id[] = { | |||
675 | { "tps65011", TPS65011 }, | 680 | { "tps65011", TPS65011 }, |
676 | { "tps65012", TPS65012 }, | 681 | { "tps65012", TPS65012 }, |
677 | { "tps65013", TPS65013 }, | 682 | { "tps65013", TPS65013 }, |
683 | { "tps65014", TPS65011 }, /* tps65011 charging at 6.5V max */ | ||
678 | { } | 684 | { } |
679 | }; | 685 | }; |
680 | MODULE_DEVICE_TABLE(i2c, tps65010_id); | 686 | MODULE_DEVICE_TABLE(i2c, tps65010_id); |