diff options
author | David Brownell <david-b@pacbell.net> | 2007-10-13 17:56:30 -0400 |
---|---|---|
committer | Jean Delvare <khali@hyperion.delvare> | 2007-10-13 17:56:30 -0400 |
commit | b5067f8ff37ed6cfa024170a9819bb09d55e9c1f (patch) | |
tree | c76f4958178cb069b95243942b3dc050997cc902 | |
parent | 83eaaed0d00c4c8e3081dc29286910899fed3182 (diff) |
i2c/tps65010: New-style driver updates, part 1
Prepare to convert tps65010 driver to "new style" driver by changing
how it references the i2c_client. This lets the eventual patch with
driver and platform updates be smaller.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
-rw-r--r-- | drivers/i2c/chips/tps65010.c | 135 |
1 files changed, 69 insertions, 66 deletions
diff --git a/drivers/i2c/chips/tps65010.c b/drivers/i2c/chips/tps65010.c index 503ffec2ce07..402d911a9e7b 100644 --- a/drivers/i2c/chips/tps65010.c +++ b/drivers/i2c/chips/tps65010.c | |||
@@ -79,7 +79,8 @@ enum tps_model { | |||
79 | }; | 79 | }; |
80 | 80 | ||
81 | struct tps65010 { | 81 | struct tps65010 { |
82 | struct i2c_client client; | 82 | struct i2c_client c; |
83 | struct i2c_client *client; | ||
83 | struct mutex lock; | 84 | struct mutex lock; |
84 | int irq; | 85 | int irq; |
85 | struct delayed_work work; | 86 | struct delayed_work work; |
@@ -229,22 +230,22 @@ static int dbg_show(struct seq_file *s, void *_) | |||
229 | /* registers for monitoring battery charging and status; note | 230 | /* registers for monitoring battery charging and status; note |
230 | * that reading chgstat and regstat may ack IRQs... | 231 | * that reading chgstat and regstat may ack IRQs... |
231 | */ | 232 | */ |
232 | value = i2c_smbus_read_byte_data(&tps->client, TPS_CHGCONFIG); | 233 | value = i2c_smbus_read_byte_data(tps->client, TPS_CHGCONFIG); |
233 | dbg_chgconf(tps->por, buf, sizeof buf, value); | 234 | dbg_chgconf(tps->por, buf, sizeof buf, value); |
234 | seq_printf(s, "chgconfig %s", buf); | 235 | seq_printf(s, "chgconfig %s", buf); |
235 | 236 | ||
236 | value = i2c_smbus_read_byte_data(&tps->client, TPS_CHGSTATUS); | 237 | value = i2c_smbus_read_byte_data(tps->client, TPS_CHGSTATUS); |
237 | dbg_chgstat(buf, sizeof buf, value); | 238 | dbg_chgstat(buf, sizeof buf, value); |
238 | seq_printf(s, "chgstat %s", buf); | 239 | seq_printf(s, "chgstat %s", buf); |
239 | value = i2c_smbus_read_byte_data(&tps->client, TPS_MASK1); | 240 | value = i2c_smbus_read_byte_data(tps->client, TPS_MASK1); |
240 | dbg_chgstat(buf, sizeof buf, value); | 241 | dbg_chgstat(buf, sizeof buf, value); |
241 | seq_printf(s, "mask1 %s", buf); | 242 | seq_printf(s, "mask1 %s", buf); |
242 | /* ignore ackint1 */ | 243 | /* ignore ackint1 */ |
243 | 244 | ||
244 | value = i2c_smbus_read_byte_data(&tps->client, TPS_REGSTATUS); | 245 | value = i2c_smbus_read_byte_data(tps->client, TPS_REGSTATUS); |
245 | dbg_regstat(buf, sizeof buf, value); | 246 | dbg_regstat(buf, sizeof buf, value); |
246 | seq_printf(s, "regstat %s", buf); | 247 | seq_printf(s, "regstat %s", buf); |
247 | value = i2c_smbus_read_byte_data(&tps->client, TPS_MASK2); | 248 | value = i2c_smbus_read_byte_data(tps->client, TPS_MASK2); |
248 | dbg_regstat(buf, sizeof buf, value); | 249 | dbg_regstat(buf, sizeof buf, value); |
249 | seq_printf(s, "mask2 %s\n", buf); | 250 | seq_printf(s, "mask2 %s\n", buf); |
250 | /* ignore ackint2 */ | 251 | /* ignore ackint2 */ |
@@ -253,21 +254,21 @@ static int dbg_show(struct seq_file *s, void *_) | |||
253 | 254 | ||
254 | 255 | ||
255 | /* VMAIN voltage, enable lowpower, etc */ | 256 | /* VMAIN voltage, enable lowpower, etc */ |
256 | value = i2c_smbus_read_byte_data(&tps->client, TPS_VDCDC1); | 257 | value = i2c_smbus_read_byte_data(tps->client, TPS_VDCDC1); |
257 | seq_printf(s, "vdcdc1 %02x\n", value); | 258 | seq_printf(s, "vdcdc1 %02x\n", value); |
258 | 259 | ||
259 | /* VCORE voltage, vibrator on/off */ | 260 | /* VCORE voltage, vibrator on/off */ |
260 | value = i2c_smbus_read_byte_data(&tps->client, TPS_VDCDC2); | 261 | value = i2c_smbus_read_byte_data(tps->client, TPS_VDCDC2); |
261 | seq_printf(s, "vdcdc2 %02x\n", value); | 262 | seq_printf(s, "vdcdc2 %02x\n", value); |
262 | 263 | ||
263 | /* both LD0s, and their lowpower behavior */ | 264 | /* both LD0s, and their lowpower behavior */ |
264 | value = i2c_smbus_read_byte_data(&tps->client, TPS_VREGS1); | 265 | value = i2c_smbus_read_byte_data(tps->client, TPS_VREGS1); |
265 | seq_printf(s, "vregs1 %02x\n\n", value); | 266 | seq_printf(s, "vregs1 %02x\n\n", value); |
266 | 267 | ||
267 | 268 | ||
268 | /* LEDs and GPIOs */ | 269 | /* LEDs and GPIOs */ |
269 | value = i2c_smbus_read_byte_data(&tps->client, TPS_LED1_ON); | 270 | value = i2c_smbus_read_byte_data(tps->client, TPS_LED1_ON); |
270 | v2 = i2c_smbus_read_byte_data(&tps->client, TPS_LED1_PER); | 271 | v2 = i2c_smbus_read_byte_data(tps->client, TPS_LED1_PER); |
271 | seq_printf(s, "led1 %s, on=%02x, per=%02x, %d/%d msec\n", | 272 | seq_printf(s, "led1 %s, on=%02x, per=%02x, %d/%d msec\n", |
272 | (value & 0x80) | 273 | (value & 0x80) |
273 | ? ((v2 & 0x80) ? "on" : "off") | 274 | ? ((v2 & 0x80) ? "on" : "off") |
@@ -275,8 +276,8 @@ static int dbg_show(struct seq_file *s, void *_) | |||
275 | value, v2, | 276 | value, v2, |
276 | (value & 0x7f) * 10, (v2 & 0x7f) * 100); | 277 | (value & 0x7f) * 10, (v2 & 0x7f) * 100); |
277 | 278 | ||
278 | value = i2c_smbus_read_byte_data(&tps->client, TPS_LED2_ON); | 279 | value = i2c_smbus_read_byte_data(tps->client, TPS_LED2_ON); |
279 | v2 = i2c_smbus_read_byte_data(&tps->client, TPS_LED2_PER); | 280 | v2 = i2c_smbus_read_byte_data(tps->client, TPS_LED2_PER); |
280 | seq_printf(s, "led2 %s, on=%02x, per=%02x, %d/%d msec\n", | 281 | seq_printf(s, "led2 %s, on=%02x, per=%02x, %d/%d msec\n", |
281 | (value & 0x80) | 282 | (value & 0x80) |
282 | ? ((v2 & 0x80) ? "on" : "off") | 283 | ? ((v2 & 0x80) ? "on" : "off") |
@@ -284,8 +285,8 @@ static int dbg_show(struct seq_file *s, void *_) | |||
284 | value, v2, | 285 | value, v2, |
285 | (value & 0x7f) * 10, (v2 & 0x7f) * 100); | 286 | (value & 0x7f) * 10, (v2 & 0x7f) * 100); |
286 | 287 | ||
287 | value = i2c_smbus_read_byte_data(&tps->client, TPS_DEFGPIO); | 288 | value = i2c_smbus_read_byte_data(tps->client, TPS_DEFGPIO); |
288 | v2 = i2c_smbus_read_byte_data(&tps->client, TPS_MASK3); | 289 | v2 = i2c_smbus_read_byte_data(tps->client, TPS_MASK3); |
289 | seq_printf(s, "defgpio %02x mask3 %02x\n", value, v2); | 290 | seq_printf(s, "defgpio %02x mask3 %02x\n", value, v2); |
290 | 291 | ||
291 | for (i = 0; i < 4; i++) { | 292 | for (i = 0; i < 4; i++) { |
@@ -335,7 +336,7 @@ static void tps65010_interrupt(struct tps65010 *tps) | |||
335 | 336 | ||
336 | /* regstatus irqs */ | 337 | /* regstatus irqs */ |
337 | if (tps->nmask2) { | 338 | if (tps->nmask2) { |
338 | tmp = i2c_smbus_read_byte_data(&tps->client, TPS_REGSTATUS); | 339 | tmp = i2c_smbus_read_byte_data(tps->client, TPS_REGSTATUS); |
339 | mask = tmp ^ tps->regstatus; | 340 | mask = tmp ^ tps->regstatus; |
340 | tps->regstatus = tmp; | 341 | tps->regstatus = tmp; |
341 | mask &= tps->nmask2; | 342 | mask &= tps->nmask2; |
@@ -362,7 +363,7 @@ static void tps65010_interrupt(struct tps65010 *tps) | |||
362 | 363 | ||
363 | /* chgstatus irqs */ | 364 | /* chgstatus irqs */ |
364 | if (tps->nmask1) { | 365 | if (tps->nmask1) { |
365 | tmp = i2c_smbus_read_byte_data(&tps->client, TPS_CHGSTATUS); | 366 | tmp = i2c_smbus_read_byte_data(tps->client, TPS_CHGSTATUS); |
366 | mask = tmp ^ tps->chgstatus; | 367 | mask = tmp ^ tps->chgstatus; |
367 | tps->chgstatus = tmp; | 368 | tps->chgstatus = tmp; |
368 | mask &= tps->nmask1; | 369 | mask &= tps->nmask1; |
@@ -426,7 +427,7 @@ static void tps65010_work(struct work_struct *work) | |||
426 | int status; | 427 | int status; |
427 | u8 chgconfig, tmp; | 428 | u8 chgconfig, tmp; |
428 | 429 | ||
429 | chgconfig = i2c_smbus_read_byte_data(&tps->client, | 430 | chgconfig = i2c_smbus_read_byte_data(tps->client, |
430 | TPS_CHGCONFIG); | 431 | TPS_CHGCONFIG); |
431 | chgconfig &= ~(TPS_VBUS_500MA | TPS_VBUS_CHARGING); | 432 | chgconfig &= ~(TPS_VBUS_500MA | TPS_VBUS_CHARGING); |
432 | if (tps->vbus == 500) | 433 | if (tps->vbus == 500) |
@@ -434,11 +435,11 @@ static void tps65010_work(struct work_struct *work) | |||
434 | else if (tps->vbus >= 100) | 435 | else if (tps->vbus >= 100) |
435 | chgconfig |= TPS_VBUS_CHARGING; | 436 | chgconfig |= TPS_VBUS_CHARGING; |
436 | 437 | ||
437 | status = i2c_smbus_write_byte_data(&tps->client, | 438 | status = i2c_smbus_write_byte_data(tps->client, |
438 | TPS_CHGCONFIG, chgconfig); | 439 | TPS_CHGCONFIG, chgconfig); |
439 | 440 | ||
440 | /* vbus update fails unless VBUS is connected! */ | 441 | /* vbus update fails unless VBUS is connected! */ |
441 | tmp = i2c_smbus_read_byte_data(&tps->client, TPS_CHGCONFIG); | 442 | tmp = i2c_smbus_read_byte_data(tps->client, TPS_CHGCONFIG); |
442 | tps->chgconf = tmp; | 443 | tps->chgconf = tmp; |
443 | show_chgconfig(tps->por, "update vbus", tmp); | 444 | show_chgconfig(tps->por, "update vbus", tmp); |
444 | } | 445 | } |
@@ -467,7 +468,7 @@ static int __exit tps65010_detach_client(struct i2c_client *client) | |||
467 | { | 468 | { |
468 | struct tps65010 *tps; | 469 | struct tps65010 *tps; |
469 | 470 | ||
470 | tps = container_of(client, struct tps65010, client); | 471 | tps = container_of(client, struct tps65010, c); |
471 | free_irq(tps->irq, tps); | 472 | free_irq(tps->irq, tps); |
472 | #ifdef CONFIG_ARM | 473 | #ifdef CONFIG_ARM |
473 | if (machine_is_omap_h2()) | 474 | if (machine_is_omap_h2()) |
@@ -499,6 +500,7 @@ tps65010_probe(struct i2c_adapter *bus, int address, int kind) | |||
499 | struct tps65010 *tps; | 500 | struct tps65010 *tps; |
500 | int status; | 501 | int status; |
501 | unsigned long irqflags; | 502 | unsigned long irqflags; |
503 | struct i2c_client *client; | ||
502 | 504 | ||
503 | if (the_tps) { | 505 | if (the_tps) { |
504 | dev_dbg(&bus->dev, "only one %s for now\n", DRIVER_NAME); | 506 | dev_dbg(&bus->dev, "only one %s for now\n", DRIVER_NAME); |
@@ -512,12 +514,13 @@ tps65010_probe(struct i2c_adapter *bus, int address, int kind) | |||
512 | mutex_init(&tps->lock); | 514 | mutex_init(&tps->lock); |
513 | INIT_DELAYED_WORK(&tps->work, tps65010_work); | 515 | INIT_DELAYED_WORK(&tps->work, tps65010_work); |
514 | tps->irq = -1; | 516 | tps->irq = -1; |
515 | tps->client.addr = address; | 517 | tps->c.addr = address; |
516 | tps->client.adapter = bus; | 518 | tps->c.adapter = bus; |
517 | tps->client.driver = &tps65010_driver; | 519 | tps->c.driver = &tps65010_driver; |
518 | strlcpy(tps->client.name, DRIVER_NAME, I2C_NAME_SIZE); | 520 | strlcpy(tps->c.name, DRIVER_NAME, I2C_NAME_SIZE); |
521 | tps->client = client = &tps->c; | ||
519 | 522 | ||
520 | status = i2c_attach_client(&tps->client); | 523 | status = i2c_attach_client(client); |
521 | if (status < 0) { | 524 | if (status < 0) { |
522 | dev_dbg(&bus->dev, "can't attach %s to device %d, err %d\n", | 525 | dev_dbg(&bus->dev, "can't attach %s to device %d, err %d\n", |
523 | DRIVER_NAME, address, status); | 526 | DRIVER_NAME, address, status); |
@@ -556,9 +559,9 @@ tps65010_probe(struct i2c_adapter *bus, int address, int kind) | |||
556 | status = request_irq(tps->irq, tps65010_irq, | 559 | status = request_irq(tps->irq, tps65010_irq, |
557 | irqflags, DRIVER_NAME, tps); | 560 | irqflags, DRIVER_NAME, tps); |
558 | if (status < 0) { | 561 | if (status < 0) { |
559 | dev_dbg(&tps->client.dev, "can't get IRQ %d, err %d\n", | 562 | dev_dbg(&client->dev, "can't get IRQ %d, err %d\n", |
560 | tps->irq, status); | 563 | tps->irq, status); |
561 | i2c_detach_client(&tps->client); | 564 | i2c_detach_client(client); |
562 | goto fail1; | 565 | goto fail1; |
563 | } | 566 | } |
564 | #ifdef CONFIG_ARM | 567 | #ifdef CONFIG_ARM |
@@ -583,21 +586,21 @@ tps65010_probe(struct i2c_adapter *bus, int address, int kind) | |||
583 | break; | 586 | break; |
584 | /* else CHGCONFIG.POR is replaced by AUA, enabling a WAIT mode */ | 587 | /* else CHGCONFIG.POR is replaced by AUA, enabling a WAIT mode */ |
585 | } | 588 | } |
586 | tps->chgconf = i2c_smbus_read_byte_data(&tps->client, TPS_CHGCONFIG); | 589 | tps->chgconf = i2c_smbus_read_byte_data(client, TPS_CHGCONFIG); |
587 | show_chgconfig(tps->por, "conf/init", tps->chgconf); | 590 | show_chgconfig(tps->por, "conf/init", tps->chgconf); |
588 | 591 | ||
589 | show_chgstatus("chg/init", | 592 | show_chgstatus("chg/init", |
590 | i2c_smbus_read_byte_data(&tps->client, TPS_CHGSTATUS)); | 593 | i2c_smbus_read_byte_data(client, TPS_CHGSTATUS)); |
591 | show_regstatus("reg/init", | 594 | show_regstatus("reg/init", |
592 | i2c_smbus_read_byte_data(&tps->client, TPS_REGSTATUS)); | 595 | i2c_smbus_read_byte_data(client, TPS_REGSTATUS)); |
593 | 596 | ||
594 | pr_debug("%s: vdcdc1 0x%02x, vdcdc2 %02x, vregs1 %02x\n", DRIVER_NAME, | 597 | pr_debug("%s: vdcdc1 0x%02x, vdcdc2 %02x, vregs1 %02x\n", DRIVER_NAME, |
595 | i2c_smbus_read_byte_data(&tps->client, TPS_VDCDC1), | 598 | i2c_smbus_read_byte_data(client, TPS_VDCDC1), |
596 | i2c_smbus_read_byte_data(&tps->client, TPS_VDCDC2), | 599 | i2c_smbus_read_byte_data(client, TPS_VDCDC2), |
597 | i2c_smbus_read_byte_data(&tps->client, TPS_VREGS1)); | 600 | i2c_smbus_read_byte_data(client, TPS_VREGS1)); |
598 | pr_debug("%s: defgpio 0x%02x, mask3 0x%02x\n", DRIVER_NAME, | 601 | pr_debug("%s: defgpio 0x%02x, mask3 0x%02x\n", DRIVER_NAME, |
599 | i2c_smbus_read_byte_data(&tps->client, TPS_DEFGPIO), | 602 | i2c_smbus_read_byte_data(client, TPS_DEFGPIO), |
600 | i2c_smbus_read_byte_data(&tps->client, TPS_MASK3)); | 603 | i2c_smbus_read_byte_data(client, TPS_MASK3)); |
601 | 604 | ||
602 | tps65010_driver.attach_adapter = tps65010_noscan; | 605 | tps65010_driver.attach_adapter = tps65010_noscan; |
603 | the_tps = tps; | 606 | the_tps = tps; |
@@ -615,15 +618,15 @@ tps65010_probe(struct i2c_adapter *bus, int address, int kind) | |||
615 | * registers, and maybe disable VBUS draw. | 618 | * registers, and maybe disable VBUS draw. |
616 | */ | 619 | */ |
617 | tps->nmask1 = ~0; | 620 | tps->nmask1 = ~0; |
618 | (void) i2c_smbus_write_byte_data(&tps->client, TPS_MASK1, ~tps->nmask1); | 621 | (void) i2c_smbus_write_byte_data(client, TPS_MASK1, ~tps->nmask1); |
619 | 622 | ||
620 | tps->nmask2 = TPS_REG_ONOFF; | 623 | tps->nmask2 = TPS_REG_ONOFF; |
621 | if (tps->model == TPS65013) | 624 | if (tps->model == TPS65013) |
622 | tps->nmask2 |= TPS_REG_NO_CHG; | 625 | tps->nmask2 |= TPS_REG_NO_CHG; |
623 | (void) i2c_smbus_write_byte_data(&tps->client, TPS_MASK2, ~tps->nmask2); | 626 | (void) i2c_smbus_write_byte_data(client, TPS_MASK2, ~tps->nmask2); |
624 | 627 | ||
625 | (void) i2c_smbus_write_byte_data(&tps->client, TPS_MASK3, 0x0f | 628 | (void) i2c_smbus_write_byte_data(client, TPS_MASK3, 0x0f |
626 | | i2c_smbus_read_byte_data(&tps->client, TPS_MASK3)); | 629 | | i2c_smbus_read_byte_data(client, TPS_MASK3)); |
627 | 630 | ||
628 | tps65010_work(&tps->work.work); | 631 | tps65010_work(&tps->work.work); |
629 | 632 | ||
@@ -702,7 +705,7 @@ int tps65010_set_gpio_out_value(unsigned gpio, unsigned value) | |||
702 | 705 | ||
703 | mutex_lock(&the_tps->lock); | 706 | mutex_lock(&the_tps->lock); |
704 | 707 | ||
705 | defgpio = i2c_smbus_read_byte_data(&the_tps->client, TPS_DEFGPIO); | 708 | defgpio = i2c_smbus_read_byte_data(the_tps->client, TPS_DEFGPIO); |
706 | 709 | ||
707 | /* Configure GPIO for output */ | 710 | /* Configure GPIO for output */ |
708 | defgpio |= 1 << (gpio + 3); | 711 | defgpio |= 1 << (gpio + 3); |
@@ -718,12 +721,12 @@ int tps65010_set_gpio_out_value(unsigned gpio, unsigned value) | |||
718 | break; | 721 | break; |
719 | } | 722 | } |
720 | 723 | ||
721 | status = i2c_smbus_write_byte_data(&the_tps->client, | 724 | status = i2c_smbus_write_byte_data(the_tps->client, |
722 | TPS_DEFGPIO, defgpio); | 725 | TPS_DEFGPIO, defgpio); |
723 | 726 | ||
724 | pr_debug("%s: gpio%dout = %s, defgpio 0x%02x\n", DRIVER_NAME, | 727 | pr_debug("%s: gpio%dout = %s, defgpio 0x%02x\n", DRIVER_NAME, |
725 | gpio, value ? "high" : "low", | 728 | gpio, value ? "high" : "low", |
726 | i2c_smbus_read_byte_data(&the_tps->client, TPS_DEFGPIO)); | 729 | i2c_smbus_read_byte_data(the_tps->client, TPS_DEFGPIO)); |
727 | 730 | ||
728 | mutex_unlock(&the_tps->lock); | 731 | mutex_unlock(&the_tps->lock); |
729 | return status; | 732 | return status; |
@@ -753,11 +756,11 @@ int tps65010_set_led(unsigned led, unsigned mode) | |||
753 | mutex_lock(&the_tps->lock); | 756 | mutex_lock(&the_tps->lock); |
754 | 757 | ||
755 | pr_debug("%s: led%i_on 0x%02x\n", DRIVER_NAME, led, | 758 | pr_debug("%s: led%i_on 0x%02x\n", DRIVER_NAME, led, |
756 | i2c_smbus_read_byte_data(&the_tps->client, | 759 | i2c_smbus_read_byte_data(the_tps->client, |
757 | TPS_LED1_ON + offs)); | 760 | TPS_LED1_ON + offs)); |
758 | 761 | ||
759 | pr_debug("%s: led%i_per 0x%02x\n", DRIVER_NAME, led, | 762 | pr_debug("%s: led%i_per 0x%02x\n", DRIVER_NAME, led, |
760 | i2c_smbus_read_byte_data(&the_tps->client, | 763 | i2c_smbus_read_byte_data(the_tps->client, |
761 | TPS_LED1_PER + offs)); | 764 | TPS_LED1_PER + offs)); |
762 | 765 | ||
763 | switch (mode) { | 766 | switch (mode) { |
@@ -780,7 +783,7 @@ int tps65010_set_led(unsigned led, unsigned mode) | |||
780 | return -EINVAL; | 783 | return -EINVAL; |
781 | } | 784 | } |
782 | 785 | ||
783 | status = i2c_smbus_write_byte_data(&the_tps->client, | 786 | status = i2c_smbus_write_byte_data(the_tps->client, |
784 | TPS_LED1_ON + offs, led_on); | 787 | TPS_LED1_ON + offs, led_on); |
785 | 788 | ||
786 | if (status != 0) { | 789 | if (status != 0) { |
@@ -791,9 +794,9 @@ int tps65010_set_led(unsigned led, unsigned mode) | |||
791 | } | 794 | } |
792 | 795 | ||
793 | pr_debug("%s: led%i_on 0x%02x\n", DRIVER_NAME, led, | 796 | pr_debug("%s: led%i_on 0x%02x\n", DRIVER_NAME, led, |
794 | i2c_smbus_read_byte_data(&the_tps->client, TPS_LED1_ON + offs)); | 797 | i2c_smbus_read_byte_data(the_tps->client, TPS_LED1_ON + offs)); |
795 | 798 | ||
796 | status = i2c_smbus_write_byte_data(&the_tps->client, | 799 | status = i2c_smbus_write_byte_data(the_tps->client, |
797 | TPS_LED1_PER + offs, led_per); | 800 | TPS_LED1_PER + offs, led_per); |
798 | 801 | ||
799 | if (status != 0) { | 802 | if (status != 0) { |
@@ -804,7 +807,7 @@ int tps65010_set_led(unsigned led, unsigned mode) | |||
804 | } | 807 | } |
805 | 808 | ||
806 | pr_debug("%s: led%i_per 0x%02x\n", DRIVER_NAME, led, | 809 | pr_debug("%s: led%i_per 0x%02x\n", DRIVER_NAME, led, |
807 | i2c_smbus_read_byte_data(&the_tps->client, | 810 | i2c_smbus_read_byte_data(the_tps->client, |
808 | TPS_LED1_PER + offs)); | 811 | TPS_LED1_PER + offs)); |
809 | 812 | ||
810 | mutex_unlock(&the_tps->lock); | 813 | mutex_unlock(&the_tps->lock); |
@@ -827,11 +830,11 @@ int tps65010_set_vib(unsigned value) | |||
827 | 830 | ||
828 | mutex_lock(&the_tps->lock); | 831 | mutex_lock(&the_tps->lock); |
829 | 832 | ||
830 | vdcdc2 = i2c_smbus_read_byte_data(&the_tps->client, TPS_VDCDC2); | 833 | vdcdc2 = i2c_smbus_read_byte_data(the_tps->client, TPS_VDCDC2); |
831 | vdcdc2 &= ~(1 << 1); | 834 | vdcdc2 &= ~(1 << 1); |
832 | if (value) | 835 | if (value) |
833 | vdcdc2 |= (1 << 1); | 836 | vdcdc2 |= (1 << 1); |
834 | status = i2c_smbus_write_byte_data(&the_tps->client, | 837 | status = i2c_smbus_write_byte_data(the_tps->client, |
835 | TPS_VDCDC2, vdcdc2); | 838 | TPS_VDCDC2, vdcdc2); |
836 | 839 | ||
837 | pr_debug("%s: vibrator %s\n", DRIVER_NAME, value ? "on" : "off"); | 840 | pr_debug("%s: vibrator %s\n", DRIVER_NAME, value ? "on" : "off"); |
@@ -857,9 +860,9 @@ int tps65010_set_low_pwr(unsigned mode) | |||
857 | 860 | ||
858 | pr_debug("%s: %s low_pwr, vdcdc1 0x%02x\n", DRIVER_NAME, | 861 | pr_debug("%s: %s low_pwr, vdcdc1 0x%02x\n", DRIVER_NAME, |
859 | mode ? "enable" : "disable", | 862 | mode ? "enable" : "disable", |
860 | i2c_smbus_read_byte_data(&the_tps->client, TPS_VDCDC1)); | 863 | i2c_smbus_read_byte_data(the_tps->client, TPS_VDCDC1)); |
861 | 864 | ||
862 | vdcdc1 = i2c_smbus_read_byte_data(&the_tps->client, TPS_VDCDC1); | 865 | vdcdc1 = i2c_smbus_read_byte_data(the_tps->client, TPS_VDCDC1); |
863 | 866 | ||
864 | switch (mode) { | 867 | switch (mode) { |
865 | case OFF: | 868 | case OFF: |
@@ -871,7 +874,7 @@ int tps65010_set_low_pwr(unsigned mode) | |||
871 | break; | 874 | break; |
872 | } | 875 | } |
873 | 876 | ||
874 | status = i2c_smbus_write_byte_data(&the_tps->client, | 877 | status = i2c_smbus_write_byte_data(the_tps->client, |
875 | TPS_VDCDC1, vdcdc1); | 878 | TPS_VDCDC1, vdcdc1); |
876 | 879 | ||
877 | if (status != 0) | 880 | if (status != 0) |
@@ -879,7 +882,7 @@ int tps65010_set_low_pwr(unsigned mode) | |||
879 | DRIVER_NAME); | 882 | DRIVER_NAME); |
880 | else | 883 | else |
881 | pr_debug("%s: vdcdc1 0x%02x\n", DRIVER_NAME, | 884 | pr_debug("%s: vdcdc1 0x%02x\n", DRIVER_NAME, |
882 | i2c_smbus_read_byte_data(&the_tps->client, TPS_VDCDC1)); | 885 | i2c_smbus_read_byte_data(the_tps->client, TPS_VDCDC1)); |
883 | 886 | ||
884 | mutex_unlock(&the_tps->lock); | 887 | mutex_unlock(&the_tps->lock); |
885 | 888 | ||
@@ -902,9 +905,9 @@ int tps65010_config_vregs1(unsigned value) | |||
902 | mutex_lock(&the_tps->lock); | 905 | mutex_lock(&the_tps->lock); |
903 | 906 | ||
904 | pr_debug("%s: vregs1 0x%02x\n", DRIVER_NAME, | 907 | pr_debug("%s: vregs1 0x%02x\n", DRIVER_NAME, |
905 | i2c_smbus_read_byte_data(&the_tps->client, TPS_VREGS1)); | 908 | i2c_smbus_read_byte_data(the_tps->client, TPS_VREGS1)); |
906 | 909 | ||
907 | status = i2c_smbus_write_byte_data(&the_tps->client, | 910 | status = i2c_smbus_write_byte_data(the_tps->client, |
908 | TPS_VREGS1, value); | 911 | TPS_VREGS1, value); |
909 | 912 | ||
910 | if (status != 0) | 913 | if (status != 0) |
@@ -912,7 +915,7 @@ int tps65010_config_vregs1(unsigned value) | |||
912 | DRIVER_NAME); | 915 | DRIVER_NAME); |
913 | else | 916 | else |
914 | pr_debug("%s: vregs1 0x%02x\n", DRIVER_NAME, | 917 | pr_debug("%s: vregs1 0x%02x\n", DRIVER_NAME, |
915 | i2c_smbus_read_byte_data(&the_tps->client, TPS_VREGS1)); | 918 | i2c_smbus_read_byte_data(the_tps->client, TPS_VREGS1)); |
916 | 919 | ||
917 | mutex_unlock(&the_tps->lock); | 920 | mutex_unlock(&the_tps->lock); |
918 | 921 | ||
@@ -941,11 +944,11 @@ int tps65013_set_low_pwr(unsigned mode) | |||
941 | pr_debug("%s: %s low_pwr, chgconfig 0x%02x vdcdc1 0x%02x\n", | 944 | pr_debug("%s: %s low_pwr, chgconfig 0x%02x vdcdc1 0x%02x\n", |
942 | DRIVER_NAME, | 945 | DRIVER_NAME, |
943 | mode ? "enable" : "disable", | 946 | mode ? "enable" : "disable", |
944 | i2c_smbus_read_byte_data(&the_tps->client, TPS_CHGCONFIG), | 947 | i2c_smbus_read_byte_data(the_tps->client, TPS_CHGCONFIG), |
945 | i2c_smbus_read_byte_data(&the_tps->client, TPS_VDCDC1)); | 948 | i2c_smbus_read_byte_data(the_tps->client, TPS_VDCDC1)); |
946 | 949 | ||
947 | chgconfig = i2c_smbus_read_byte_data(&the_tps->client, TPS_CHGCONFIG); | 950 | chgconfig = i2c_smbus_read_byte_data(the_tps->client, TPS_CHGCONFIG); |
948 | vdcdc1 = i2c_smbus_read_byte_data(&the_tps->client, TPS_VDCDC1); | 951 | vdcdc1 = i2c_smbus_read_byte_data(the_tps->client, TPS_VDCDC1); |
949 | 952 | ||
950 | switch (mode) { | 953 | switch (mode) { |
951 | case OFF: | 954 | case OFF: |
@@ -959,7 +962,7 @@ int tps65013_set_low_pwr(unsigned mode) | |||
959 | break; | 962 | break; |
960 | } | 963 | } |
961 | 964 | ||
962 | status = i2c_smbus_write_byte_data(&the_tps->client, | 965 | status = i2c_smbus_write_byte_data(the_tps->client, |
963 | TPS_CHGCONFIG, chgconfig); | 966 | TPS_CHGCONFIG, chgconfig); |
964 | if (status != 0) { | 967 | if (status != 0) { |
965 | printk(KERN_ERR "%s: Failed to write chconfig register\n", | 968 | printk(KERN_ERR "%s: Failed to write chconfig register\n", |
@@ -968,11 +971,11 @@ int tps65013_set_low_pwr(unsigned mode) | |||
968 | return status; | 971 | return status; |
969 | } | 972 | } |
970 | 973 | ||
971 | chgconfig = i2c_smbus_read_byte_data(&the_tps->client, TPS_CHGCONFIG); | 974 | chgconfig = i2c_smbus_read_byte_data(the_tps->client, TPS_CHGCONFIG); |
972 | the_tps->chgconf = chgconfig; | 975 | the_tps->chgconf = chgconfig; |
973 | show_chgconfig(0, "chgconf", chgconfig); | 976 | show_chgconfig(0, "chgconf", chgconfig); |
974 | 977 | ||
975 | status = i2c_smbus_write_byte_data(&the_tps->client, | 978 | status = i2c_smbus_write_byte_data(the_tps->client, |
976 | TPS_VDCDC1, vdcdc1); | 979 | TPS_VDCDC1, vdcdc1); |
977 | 980 | ||
978 | if (status != 0) | 981 | if (status != 0) |
@@ -980,7 +983,7 @@ int tps65013_set_low_pwr(unsigned mode) | |||
980 | DRIVER_NAME); | 983 | DRIVER_NAME); |
981 | else | 984 | else |
982 | pr_debug("%s: vdcdc1 0x%02x\n", DRIVER_NAME, | 985 | pr_debug("%s: vdcdc1 0x%02x\n", DRIVER_NAME, |
983 | i2c_smbus_read_byte_data(&the_tps->client, TPS_VDCDC1)); | 986 | i2c_smbus_read_byte_data(the_tps->client, TPS_VDCDC1)); |
984 | 987 | ||
985 | mutex_unlock(&the_tps->lock); | 988 | mutex_unlock(&the_tps->lock); |
986 | 989 | ||