aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/twl4030-core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mfd/twl4030-core.c')
-rw-r--r--drivers/mfd/twl4030-core.c91
1 files changed, 47 insertions, 44 deletions
diff --git a/drivers/mfd/twl4030-core.c b/drivers/mfd/twl4030-core.c
index 0ee81e46bfbd..cc3f77bd7608 100644
--- a/drivers/mfd/twl4030-core.c
+++ b/drivers/mfd/twl4030-core.c
@@ -486,7 +486,6 @@ static int
486add_children(struct twl4030_platform_data *pdata, unsigned long features) 486add_children(struct twl4030_platform_data *pdata, unsigned long features)
487{ 487{
488 struct device *child; 488 struct device *child;
489 struct device *usb_transceiver = NULL;
490 489
491 if (twl_has_bci() && pdata->bci && !(features & TPS_SUBSET)) { 490 if (twl_has_bci() && pdata->bci && !(features & TPS_SUBSET)) {
492 child = add_child(3, "twl4030_bci", 491 child = add_child(3, "twl4030_bci",
@@ -538,16 +537,61 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features)
538 } 537 }
539 538
540 if (twl_has_usb() && pdata->usb) { 539 if (twl_has_usb() && pdata->usb) {
540
541 static struct regulator_consumer_supply usb1v5 = {
542 .supply = "usb1v5",
543 };
544 static struct regulator_consumer_supply usb1v8 = {
545 .supply = "usb1v8",
546 };
547 static struct regulator_consumer_supply usb3v1 = {
548 .supply = "usb3v1",
549 };
550
551 /* First add the regulators so that they can be used by transceiver */
552 if (twl_has_regulator()) {
553 /* this is a template that gets copied */
554 struct regulator_init_data usb_fixed = {
555 .constraints.valid_modes_mask =
556 REGULATOR_MODE_NORMAL
557 | REGULATOR_MODE_STANDBY,
558 .constraints.valid_ops_mask =
559 REGULATOR_CHANGE_MODE
560 | REGULATOR_CHANGE_STATUS,
561 };
562
563 child = add_regulator_linked(TWL4030_REG_VUSB1V5,
564 &usb_fixed, &usb1v5, 1);
565 if (IS_ERR(child))
566 return PTR_ERR(child);
567
568 child = add_regulator_linked(TWL4030_REG_VUSB1V8,
569 &usb_fixed, &usb1v8, 1);
570 if (IS_ERR(child))
571 return PTR_ERR(child);
572
573 child = add_regulator_linked(TWL4030_REG_VUSB3V1,
574 &usb_fixed, &usb3v1, 1);
575 if (IS_ERR(child))
576 return PTR_ERR(child);
577
578 }
579
541 child = add_child(0, "twl4030_usb", 580 child = add_child(0, "twl4030_usb",
542 pdata->usb, sizeof(*pdata->usb), 581 pdata->usb, sizeof(*pdata->usb),
543 true, 582 true,
544 /* irq0 = USB_PRES, irq1 = USB */ 583 /* irq0 = USB_PRES, irq1 = USB */
545 pdata->irq_base + 8 + 2, pdata->irq_base + 4); 584 pdata->irq_base + 8 + 2, pdata->irq_base + 4);
585
546 if (IS_ERR(child)) 586 if (IS_ERR(child))
547 return PTR_ERR(child); 587 return PTR_ERR(child);
548 588
549 /* we need to connect regulators to this transceiver */ 589 /* we need to connect regulators to this transceiver */
550 usb_transceiver = child; 590 if (twl_has_regulator() && child) {
591 usb1v5.dev = child;
592 usb1v8.dev = child;
593 usb3v1.dev = child;
594 }
551 } 595 }
552 596
553 if (twl_has_watchdog()) { 597 if (twl_has_watchdog()) {
@@ -594,47 +638,6 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features)
594 return PTR_ERR(child); 638 return PTR_ERR(child);
595 } 639 }
596 640
597 if (twl_has_regulator() && usb_transceiver) {
598 static struct regulator_consumer_supply usb1v5 = {
599 .supply = "usb1v5",
600 };
601 static struct regulator_consumer_supply usb1v8 = {
602 .supply = "usb1v8",
603 };
604 static struct regulator_consumer_supply usb3v1 = {
605 .supply = "usb3v1",
606 };
607
608 /* this is a template that gets copied */
609 struct regulator_init_data usb_fixed = {
610 .constraints.valid_modes_mask =
611 REGULATOR_MODE_NORMAL
612 | REGULATOR_MODE_STANDBY,
613 .constraints.valid_ops_mask =
614 REGULATOR_CHANGE_MODE
615 | REGULATOR_CHANGE_STATUS,
616 };
617
618 usb1v5.dev = usb_transceiver;
619 usb1v8.dev = usb_transceiver;
620 usb3v1.dev = usb_transceiver;
621
622 child = add_regulator_linked(TWL4030_REG_VUSB1V5, &usb_fixed,
623 &usb1v5, 1);
624 if (IS_ERR(child))
625 return PTR_ERR(child);
626
627 child = add_regulator_linked(TWL4030_REG_VUSB1V8, &usb_fixed,
628 &usb1v8, 1);
629 if (IS_ERR(child))
630 return PTR_ERR(child);
631
632 child = add_regulator_linked(TWL4030_REG_VUSB3V1, &usb_fixed,
633 &usb3v1, 1);
634 if (IS_ERR(child))
635 return PTR_ERR(child);
636 }
637
638 /* maybe add LDOs that are omitted on cost-reduced parts */ 641 /* maybe add LDOs that are omitted on cost-reduced parts */
639 if (twl_has_regulator() && !(features & TPS_SUBSET)) { 642 if (twl_has_regulator() && !(features & TPS_SUBSET)) {
640 child = add_regulator(TWL4030_REG_VPLL2, pdata->vpll2); 643 child = add_regulator(TWL4030_REG_VPLL2, pdata->vpll2);
@@ -806,7 +809,7 @@ twl4030_probe(struct i2c_client *client, const struct i2c_device_id *id)
806 twl->client = i2c_new_dummy(client->adapter, 809 twl->client = i2c_new_dummy(client->adapter,
807 twl->address); 810 twl->address);
808 if (!twl->client) { 811 if (!twl->client) {
809 dev_err(&twl->client->dev, 812 dev_err(&client->dev,
810 "can't attach client %d\n", i); 813 "can't attach client %d\n", i);
811 status = -ENOMEM; 814 status = -ENOMEM;
812 goto fail; 815 goto fail;