Skip to contentSkip to conversation

tps65010: vibrator hookup to gpiolib

PATCH Applied David Brownell 3 participants 3 messages Aug 18, 2008 2 messages not in the archive I2C subsystem host drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tps65010: vibrator hookup to gpiolib

From: Marek Vasut <[email protected]>

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.

[ [email protected]: comments; list tps65014 too ]

---
 drivers/i2c/chips/tps65010.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/i2c/chips/tps65010.c +9 -3
@@ -456,14 +456,17 @@ static irqreturn_t tps65010_irq(int irq,
 
 /* offsets 0..3 == GPIO1..GPIO4
  * offsets 4..5 == LED1/nPG, LED2 (we set one of the non-BLINK modes)
+ * offset 6 == vibrator motor driver
  */
 static void
 tps65010_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 {
 	if (offset < 4)
 		tps65010_set_gpio_out_value(offset + 1, value);
-	else
+	else if (offset < 6)
 		tps65010_set_led(offset - 3, value ? ON : OFF);
+	else
+		tps65010_set_vib(value);
 }
 
 static int
@@ -477,8 +480,10 @@ tps65010_output(struct gpio_chip *chip, 
 		if (!(tps->outmask & (1 << offset)))
 			return -EINVAL;
 		tps65010_set_gpio_out_value(offset + 1, value);
-	} else
+	} else if (offset < 6)
 		tps65010_set_led(offset - 3, value ? ON : OFF);
+	else
+		tps65010_set_vib(value);
 
 	return 0;
 }
@@ -646,7 +651,7 @@ static int tps65010_probe(struct i2c_cli
 		tps->chip.get = tps65010_gpio_get;
 
 		tps->chip.base = board->base;
-		tps->chip.ngpio = 6;
+		tps->chip.ngpio = 7;
 		tps->chip.can_sleep = 1;
 
 		status = gpiochip_add(&tps->chip);
@@ -675,6 +680,7 @@ static const struct i2c_device_id tps650
 	{ "tps65011", TPS65011 },
 	{ "tps65012", TPS65012 },
 	{ "tps65013", TPS65013 },
+	{ "tps65014", TPS65011 },	/* tps65011 charging at 6.5V max */
 	{ }
 };
 MODULE_DEVICE_TABLE(i2c, tps65010_id);

_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c

Applied
#2 lore raw
In reply to a message not in the archive

Hi David,

Quoted 56 lines · David Brownell

From: Marek Vasut <[email protected]>

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.

[ [email protected]: comments; list tps65014 too ]

---
 drivers/i2c/chips/tps65010.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/i2c/chips/tps65010.c +8 -3
@@ -456,14 +456,17 @@ static irqreturn_t tps65010_irq(int irq,
 
 /* offsets 0..3 == GPIO1..GPIO4
  * offsets 4..5 == LED1/nPG, LED2 (we set one of the non-BLINK modes)
+ * offset 6 == vibrator motor driver
  */
 static void
 tps65010_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 {
 	if (offset < 4)
 		tps65010_set_gpio_out_value(offset + 1, value);
-	else
+	else if (offset < 6)
 		tps65010_set_led(offset - 3, value ? ON : OFF);
+	else
+		tps65010_set_vib(value);
 }
 
 static int
@@ -477,8 +480,10 @@ tps65010_output(struct gpio_chip *chip, 
 		if (!(tps->outmask & (1 << offset)))
 			return -EINVAL;
 		tps65010_set_gpio_out_value(offset + 1, value);
-	} else
+	} else if (offset < 6)
 		tps65010_set_led(offset - 3, value ? ON : OFF);
+	else
+		tps65010_set_vib(value);
 
 	return 0;
 }
@@ -646,7 +651,7 @@ static int tps65010_probe(struct i2c_cli
 		tps->chip.get = tps65010_gpio_get;
 
 		tps->chip.base = board->base;
-		tps->chip.ngpio = 6;
+		tps->chip.ngpio = 7;
 		tps->chip.can_sleep = 1;
 
 		status = gpiochip_add(&tps->chip);

drivers/i2c/chips/tps65010.c static const struct i2c_device_id tps650 · line 686

Quoted 7 lines
drivers/i2c/chips/tps65010.c +1 -0
@@ -675,6 +680,7 @@ static const struct i2c_device_id tps650
 	{ "tps65011", TPS65011 },
 	{ "tps65012", TPS65012 },
 	{ "tps65013", TPS65013 },
+	{ "tps65014", TPS65011 },	/* tps65011 charging at 6.5V max */
 	{ }
 };
 MODULE_DEVICE_TABLE(i2c, tps65010_id);

Applied, thanks. I'm a bit worried that Marek's Signed-off-by is missing though.

Signature · 6 lines
Jean Delvare

_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c
#4 lore raw
In reply to a message not in the archive

Dne Monday 18 of August 2008 11:19:42 Jean Delvare napsal(a):

Quoted 57 lines

Hi David,

Quoted 54 lines · David Brownell

From: Marek Vasut <[email protected]>

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.

[ [email protected]: comments; list tps65014 too ]

---
 drivers/i2c/chips/tps65010.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/i2c/chips/tps65010.c +8 -3
@@ -456,14 +456,17 @@ static irqreturn_t tps65010_irq(int irq,
 
 /* offsets 0..3 == GPIO1..GPIO4
  * offsets 4..5 == LED1/nPG, LED2 (we set one of the non-BLINK modes)
+ * offset 6 == vibrator motor driver
  */
 static void
 tps65010_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 {
 	if (offset < 4)
 		tps65010_set_gpio_out_value(offset + 1, value);
-	else
+	else if (offset < 6)
 		tps65010_set_led(offset - 3, value ? ON : OFF);
+	else
+		tps65010_set_vib(value);
 }
 
 static int
@@ -477,8 +480,10 @@ tps65010_output(struct gpio_chip *chip,
 		if (!(tps->outmask & (1 << offset)))
 			return -EINVAL;
 		tps65010_set_gpio_out_value(offset + 1, value);
-	} else
+	} else if (offset < 6)
 		tps65010_set_led(offset - 3, value ? ON : OFF);
+	else
+		tps65010_set_vib(value);
 
 	return 0;
 }
@@ -646,7 +651,7 @@ static int tps65010_probe(struct i2c_cli
 		tps->chip.get = tps65010_gpio_get;
 
 		tps->chip.base = board->base;
-		tps->chip.ngpio = 6;
+		tps->chip.ngpio = 7;
 		tps->chip.can_sleep = 1;
 
Quoted 12 lines

drivers/i2c/chips/tps65010.c static const struct i2c_device_id tps650 · line 686

Quoted 9 lines
drivers/i2c/chips/tps65010.c +1 -0
 		status = gpiochip_add(&tps->chip);
@@ -675,6 +680,7 @@ static const struct i2c_device_id tps650
 	{ "tps65011", TPS65011 },
 	{ "tps65012", TPS65012 },
 	{ "tps65013", TPS65013 },
+	{ "tps65014", TPS65011 },	/* tps65011 charging at 6.5V max */
 	{ }
 };
 MODULE_DEVICE_TABLE(i2c, tps65010_id);

Applied, thanks. I'm a bit worried that Marek's Signed-off-by is missing though.

here you have it if you still need it :-)

_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c