Change the scpsys to builtin_platform_driver_probe.

Add regulator support for scpsys driver.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABAgAGBQJWdxkqAAoJELQ5Ylss8dND1bMP/0KvyxO3PELRZ5VFVURapOGP
 UjwhHw5MGxTwNIDN395DwCtjGq4dX7j5cGDGgXhmg+Me6Hhu4aWjD90hFffl5yov
 Y0TQJeV2tQ7zJZ1vKReiFxFT/uUdC8vAya+fGKrIAAPDFWLHLXX6HRUInlHNMNmf
 iZ0PPIHxwKmyNmClC8Qea7lwlBPD3qTawJfw0atFUdQbbdR/1Wi0Zu1SfKwDL969
 evI6WmrvnCmYNY+kUQresaTXpWD7OmiyC8iIgqrVrd4FrVmYfGRwxP5DIMs4RUsH
 28EhuxcSGPMz1H8rY5OEsMhwjWi6c/okzxK7JUjVUGydvaYBRnoWrTSCGKJqKZ3S
 ySf2zTn7gQFRelvvdyi9iMZEm9aXpYkQRasY5ktMKlrBVTLfjpolPfhSewhBhY9h
 2FN7WuWenLkyfx2/oZFJlrYpbvj0ecLMU7yYccG4/adiIec8VknbOTt2QCHIS8p3
 qDLbzfekFOCU+C/jy2GX1CRclQE4L4icog1P5hHZ9j5FBY7LaclFLYF/jEUX6FFJ
 7BFDLbzphwRrJGW5orxfOkiRJKth7uer7d1drMjaItDrAKJRkXSI4Cus8RPTx1lf
 qxyVL+av9ceLWxMIVVneu+uzjssH8cGzWS7YeJa5fbJm/46v0IlmnptSwd82SHmN
 fzwtYg2UYN5VKSC67eRa
 =pz5g
 -----END PGP SIGNATURE-----

Merge tag 'v4.4-next-soc' of https://github.com/mbgg/linux-mediatek into next/drivers

Change the scpsys to builtin_platform_driver_probe.

Add regulator support for scpsys driver.

* tag 'v4.4-next-soc' of https://github.com/mbgg/linux-mediatek:
  drivers/soc: make mediatek/mtk-scpsys.c explicitly non-modular
  soc: mediatek: SCPSYS: Add regulator support

Signed-off-by: Olof Johansson <olof@lixom.net>
This commit is contained in:
Olof Johansson 2015-12-22 13:02:28 -08:00
Родитель f5ff6cc41d e50be5cd0c
Коммит 9518f8a469
1 изменённых файлов: 29 добавлений и 3 удалений

Просмотреть файл

@ -15,12 +15,13 @@
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/mfd/syscon.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/pm_domain.h>
#include <linux/regmap.h>
#include <linux/soc/mediatek/infracfg.h>
#include <linux/regulator/consumer.h>
#include <dt-bindings/power/mt8173-power.h>
#define SPM_VDE_PWR_CON 0x0210
@ -179,6 +180,7 @@ struct scp_domain {
u32 sram_pdn_ack_bits;
u32 bus_prot_mask;
bool active_wakeup;
struct regulator *supply;
};
struct scp {
@ -221,6 +223,12 @@ static int scpsys_power_on(struct generic_pm_domain *genpd)
int ret;
int i;
if (scpd->supply) {
ret = regulator_enable(scpd->supply);
if (ret)
return ret;
}
for (i = 0; i < MAX_CLKS && scpd->clk[i]; i++) {
ret = clk_prepare_enable(scpd->clk[i]);
if (ret) {
@ -299,6 +307,9 @@ err_pwr_ack:
clk_disable_unprepare(scpd->clk[i]);
}
err_clk:
if (scpd->supply)
regulator_disable(scpd->supply);
dev_err(scp->dev, "Failed to power on domain %s\n", genpd->name);
return ret;
@ -379,6 +390,9 @@ static int scpsys_power_off(struct generic_pm_domain *genpd)
for (i = 0; i < MAX_CLKS && scpd->clk[i]; i++)
clk_disable_unprepare(scpd->clk[i]);
if (scpd->supply)
regulator_disable(scpd->supply);
return 0;
out:
@ -448,6 +462,19 @@ static int __init scpsys_probe(struct platform_device *pdev)
return PTR_ERR(scp->infracfg);
}
for (i = 0; i < NUM_DOMAINS; i++) {
struct scp_domain *scpd = &scp->domains[i];
const struct scp_domain_data *data = &scp_domain_data[i];
scpd->supply = devm_regulator_get_optional(&pdev->dev, data->name);
if (IS_ERR(scpd->supply)) {
if (PTR_ERR(scpd->supply) == -ENODEV)
scpd->supply = NULL;
else
return PTR_ERR(scpd->supply);
}
}
pd_data->num_domains = NUM_DOMAINS;
for (i = 0; i < NUM_DOMAINS; i++) {
@ -521,5 +548,4 @@ static struct platform_driver scpsys_drv = {
.of_match_table = of_match_ptr(of_scpsys_match_tbl),
},
};
module_platform_driver_probe(scpsys_drv, scpsys_probe);
builtin_platform_driver_probe(scpsys_drv, scpsys_probe);