aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@ti.com>2012-11-13 03:28:46 -0500
committerSamuel Ortiz <sameo@linux.intel.com>2012-11-21 10:08:01 -0500
commit2d86ad37ece5fd064aa7c4fba5dd4378679c2cbf (patch)
tree6c2ba447e4abc77bc2f607aba491466e998511a7
parent14591d888e35c12b15eccf54e490c7769eb6d6d2 (diff)
mfd: twl-core: Clean up and correct child registration
Make the twl child registration calls a bit more uniform by always using the SUB_CHIP_ID* define instead of the mixed use of the define and magic number. At the same time correct the following devices so they are registered for the correct parent device (i2c slave): twl4030_wdt is accessible on 0x4b address and not 0x48 twl4030_pwrbutton is accessible on 0x4b address and not 0x49 twl4030-audio is on 0x49 all the time Acked-by: Tero Kristo <t-kristo@ti.com> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r--drivers/mfd/twl-core.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index a55ab15ecf1a..d666c9d454cb 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -645,7 +645,7 @@ add_children(struct twl4030_platform_data *pdata, unsigned irq_base,
645 645
646 if (IS_ENABLED(CONFIG_TWL4030_MADC) && pdata->madc && 646 if (IS_ENABLED(CONFIG_TWL4030_MADC) && pdata->madc &&
647 twl_class_is_4030()) { 647 twl_class_is_4030()) {
648 child = add_child(2, "twl4030_madc", 648 child = add_child(SUB_CHIP_ID2, "twl4030_madc",
649 pdata->madc, sizeof(*pdata->madc), 649 pdata->madc, sizeof(*pdata->madc),
650 true, irq_base + MADC_INTR_OFFSET, 0); 650 true, irq_base + MADC_INTR_OFFSET, 0);
651 if (IS_ERR(child)) 651 if (IS_ERR(child))
@@ -661,8 +661,7 @@ add_children(struct twl4030_platform_data *pdata, unsigned irq_base,
661 * HW security concerns, and "least privilege". 661 * HW security concerns, and "least privilege".
662 */ 662 */
663 sub_chip_id = twl_map[TWL_MODULE_RTC].sid; 663 sub_chip_id = twl_map[TWL_MODULE_RTC].sid;
664 child = add_child(sub_chip_id, "twl_rtc", 664 child = add_child(sub_chip_id, "twl_rtc", NULL, 0,
665 NULL, 0,
666 true, irq_base + RTC_INTR_OFFSET, 0); 665 true, irq_base + RTC_INTR_OFFSET, 0);
667 if (IS_ERR(child)) 666 if (IS_ERR(child))
668 return PTR_ERR(child); 667 return PTR_ERR(child);
@@ -728,9 +727,8 @@ add_children(struct twl4030_platform_data *pdata, unsigned irq_base,
728 727
729 } 728 }
730 729
731 child = add_child(0, "twl4030_usb", 730 child = add_child(SUB_CHIP_ID0, "twl4030_usb",
732 pdata->usb, sizeof(*pdata->usb), 731 pdata->usb, sizeof(*pdata->usb), true,
733 true,
734 /* irq0 = USB_PRES, irq1 = USB */ 732 /* irq0 = USB_PRES, irq1 = USB */
735 irq_base + USB_PRES_INTR_OFFSET, 733 irq_base + USB_PRES_INTR_OFFSET,
736 irq_base + USB_INTR_OFFSET); 734 irq_base + USB_INTR_OFFSET);
@@ -778,9 +776,8 @@ add_children(struct twl4030_platform_data *pdata, unsigned irq_base,
778 776
779 pdata->usb->features = features; 777 pdata->usb->features = features;
780 778
781 child = add_child(0, "twl6030_usb", 779 child = add_child(SUB_CHIP_ID0, "twl6030_usb",
782 pdata->usb, sizeof(*pdata->usb), 780 pdata->usb, sizeof(*pdata->usb), true,
783 true,
784 /* irq1 = VBUS_PRES, irq0 = USB ID */ 781 /* irq1 = VBUS_PRES, irq0 = USB ID */
785 irq_base + USBOTG_INTR_OFFSET, 782 irq_base + USBOTG_INTR_OFFSET,
786 irq_base + USB_PRES_INTR_OFFSET); 783 irq_base + USB_PRES_INTR_OFFSET);
@@ -804,22 +801,22 @@ add_children(struct twl4030_platform_data *pdata, unsigned irq_base,
804 } 801 }
805 802
806 if (IS_ENABLED(CONFIG_TWL4030_WATCHDOG) && twl_class_is_4030()) { 803 if (IS_ENABLED(CONFIG_TWL4030_WATCHDOG) && twl_class_is_4030()) {
807 child = add_child(0, "twl4030_wdt", NULL, 0, false, 0, 0); 804 child = add_child(SUB_CHIP_ID3, "twl4030_wdt", NULL, 0,
805 false, 0, 0);
808 if (IS_ERR(child)) 806 if (IS_ERR(child))
809 return PTR_ERR(child); 807 return PTR_ERR(child);
810 } 808 }
811 809
812 if (IS_ENABLED(CONFIG_INPUT_TWL4030_PWRBUTTON) && twl_class_is_4030()) { 810 if (IS_ENABLED(CONFIG_INPUT_TWL4030_PWRBUTTON) && twl_class_is_4030()) {
813 child = add_child(1, "twl4030_pwrbutton", 811 child = add_child(SUB_CHIP_ID3, "twl4030_pwrbutton", NULL, 0,
814 NULL, 0, true, irq_base + 8 + 0, 0); 812 true, irq_base + 8 + 0, 0);
815 if (IS_ERR(child)) 813 if (IS_ERR(child))
816 return PTR_ERR(child); 814 return PTR_ERR(child);
817 } 815 }
818 816
819 if (IS_ENABLED(CONFIG_MFD_TWL4030_AUDIO) && pdata->audio && 817 if (IS_ENABLED(CONFIG_MFD_TWL4030_AUDIO) && pdata->audio &&
820 twl_class_is_4030()) { 818 twl_class_is_4030()) {
821 sub_chip_id = twl_map[TWL_MODULE_AUDIO_VOICE].sid; 819 child = add_child(SUB_CHIP_ID1, "twl4030-audio",
822 child = add_child(sub_chip_id, "twl4030-audio",
823 pdata->audio, sizeof(*pdata->audio), 820 pdata->audio, sizeof(*pdata->audio),
824 false, 0, 0); 821 false, 0, 0);
825 if (IS_ERR(child)) 822 if (IS_ERR(child))
@@ -1059,7 +1056,7 @@ add_children(struct twl4030_platform_data *pdata, unsigned irq_base,
1059 1056
1060 if (IS_ENABLED(CONFIG_CHARGER_TWL4030) && pdata->bci && 1057 if (IS_ENABLED(CONFIG_CHARGER_TWL4030) && pdata->bci &&
1061 !(features & (TPS_SUBSET | TWL5031))) { 1058 !(features & (TPS_SUBSET | TWL5031))) {
1062 child = add_child(3, "twl4030_bci", 1059 child = add_child(SUB_CHIP_ID3, "twl4030_bci",
1063 pdata->bci, sizeof(*pdata->bci), false, 1060 pdata->bci, sizeof(*pdata->bci), false,
1064 /* irq0 = CHG_PRES, irq1 = BCI */ 1061 /* irq0 = CHG_PRES, irq1 = BCI */
1065 irq_base + BCI_PRES_INTR_OFFSET, 1062 irq_base + BCI_PRES_INTR_OFFSET,