Commit 2573f6d36e73e080fc1d9d9ac7dfaf2253a61434
Committed by
Samuel Ortiz
1 parent
bcc1dd4cd7
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
mfd: Add pre-regulator device for 88pm860x
Pre-regulator of 88pm8606 is mainly for support charging based on vbus, it needs to be enabled for charging battery, and will be disabled in some exception condition like over-temp. Add the pre-regulator device init data and resource for mfd subdev. Signed-off-by: Jett.Zhou <jtzhou@marvell.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Showing 2 changed files with 24 additions and 0 deletions Side-by-side Diff
drivers/mfd/88pm860x-core.c
... | ... | @@ -90,6 +90,10 @@ |
90 | 90 | {PM8607_IRQ_VCHG, PM8607_IRQ_VCHG, "vchg voltage", IORESOURCE_IRQ,}, |
91 | 91 | }; |
92 | 92 | |
93 | +static struct resource preg_resources[] __devinitdata = { | |
94 | + {PM8606_ID_PREG, PM8606_ID_PREG, "preg", IORESOURCE_IO,}, | |
95 | +}; | |
96 | + | |
93 | 97 | static struct resource rtc_resources[] __devinitdata = { |
94 | 98 | {PM8607_IRQ_RTC, PM8607_IRQ_RTC, "rtc", IORESOURCE_IRQ,}, |
95 | 99 | }; |
96 | 100 | |
... | ... | @@ -142,9 +146,19 @@ |
142 | 146 | {"88pm860x-codec", -1,}, |
143 | 147 | }; |
144 | 148 | |
149 | +static struct regulator_consumer_supply preg_supply[] = { | |
150 | + REGULATOR_SUPPLY("preg", "charger-manager"), | |
151 | +}; | |
152 | + | |
153 | +static struct regulator_init_data preg_init_data = { | |
154 | + .num_consumer_supplies = ARRAY_SIZE(preg_supply), | |
155 | + .consumer_supplies = &preg_supply[0], | |
156 | +}; | |
157 | + | |
145 | 158 | static struct mfd_cell power_devs[] = { |
146 | 159 | {"88pm860x-battery", -1,}, |
147 | 160 | {"88pm860x-charger", -1,}, |
161 | + {"88pm860x-preg", -1,}, | |
148 | 162 | }; |
149 | 163 | |
150 | 164 | static struct mfd_cell rtc_devs[] = { |
... | ... | @@ -768,6 +782,15 @@ |
768 | 782 | &charger_resources[0], chip->irq_base); |
769 | 783 | if (ret < 0) |
770 | 784 | dev_err(chip->dev, "Failed to add charger subdev\n"); |
785 | + | |
786 | + power_devs[2].platform_data = &preg_init_data; | |
787 | + power_devs[2].pdata_size = sizeof(struct regulator_init_data); | |
788 | + power_devs[2].num_resources = ARRAY_SIZE(preg_resources); | |
789 | + power_devs[2].resources = &preg_resources[0], | |
790 | + ret = mfd_add_devices(chip->dev, 0, &power_devs[2], 1, | |
791 | + &preg_resources[0], chip->irq_base); | |
792 | + if (ret < 0) | |
793 | + dev_err(chip->dev, "Failed to add preg subdev\n"); | |
771 | 794 | } |
772 | 795 | |
773 | 796 | static void __devinit device_onkey_init(struct pm860x_chip *chip, |