aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiguel Vadillo <vadillo@ti.com>2011-07-05 20:58:02 -0500
committerIliyan Malchev <malchev@google.com>2011-07-20 17:34:32 -0700
commitfce1d8835485265fc4fefaa83d94d224aecbb89b (patch)
treeb6e2f167c18487b2620195753714406b5be02c7f
parent9208332f7b34f4761d47c8c5e0178becdf3783c7 (diff)
downloadkernel_samsung_tuna-fce1d8835485265fc4fefaa83d94d224aecbb89b.zip
kernel_samsung_tuna-fce1d8835485265fc4fefaa83d94d224aecbb89b.tar.gz
kernel_samsung_tuna-fce1d8835485265fc4fefaa83d94d224aecbb89b.tar.bz2
omap: rpres: skip the creation of already created devices
Some devices like: - iva - dsp - fdif are being created for pm purposes and create them again is not recommended. For these devices the pm framework is exporting api's to get them. If a resource is already created use the api to get the device and add the platform data and information needed for rpres to control such device. Change-Id: I6640883f911f4c21d204c20ded1ced104af5ed7c Signed-off-by: Miguel Vadillo <vadillo@ti.com>
-rw-r--r--arch/arm/plat-omap/include/plat/rpres.h1
-rw-r--r--drivers/remoteproc/rpres.c23
-rw-r--r--drivers/remoteproc/rpres_dev.c40
3 files changed, 52 insertions, 12 deletions
diff --git a/arch/arm/plat-omap/include/plat/rpres.h b/arch/arm/plat-omap/include/plat/rpres.h
index a1e8c7b..0dfb781 100644
--- a/arch/arm/plat-omap/include/plat/rpres.h
+++ b/arch/arm/plat-omap/include/plat/rpres.h
@@ -40,6 +40,7 @@ struct rpres_platform_data {
struct rpres_ops *ops;
struct clk *opt_clk;
const char *opt_clk_name;
+ struct device *(*get_dev)(void);
};
struct rpres {
diff --git a/drivers/remoteproc/rpres.c b/drivers/remoteproc/rpres.c
index c52e6a1..e839f70 100644
--- a/drivers/remoteproc/rpres.c
+++ b/drivers/remoteproc/rpres.c
@@ -165,10 +165,25 @@ static int __devexit rpres_remove(struct platform_device *pdev)
return 0;
}
+static struct platform_device_id rpres_id_table[] = {
+ {
+ .name = "iva",
+ },
+ {
+ .name = "fdif",
+ },
+ {
+ .name = "rpres",
+ },
+ { },
+};
+MODULE_DEVICE_TABLE(platform, rpres_id_table);
+
static struct platform_driver omap_rpres_driver = {
- .probe = rpres_probe,
- .remove = __devexit_p(rpres_remove),
- .driver = {
+ .id_table = rpres_id_table,
+ .probe = rpres_probe,
+ .remove = __devexit_p(rpres_remove),
+ .driver = {
.name = "rpres",
.owner = THIS_MODULE,
},
@@ -178,7 +193,7 @@ static int __init rpres_init(void)
{
return platform_driver_register(&omap_rpres_driver);
}
-module_init(rpres_init);
+late_initcall(rpres_init);
static void __exit rpres_exit(void)
{
diff --git a/drivers/remoteproc/rpres_dev.c b/drivers/remoteproc/rpres_dev.c
index 782e1b7..cd28453 100644
--- a/drivers/remoteproc/rpres_dev.c
+++ b/drivers/remoteproc/rpres_dev.c
@@ -127,6 +127,7 @@ static struct rpres_platform_data rpres_data[] = {
.name = "rpres_iva",
.oh_name = "iva",
.ops = &ivahd_ops,
+ .get_dev = omap2_get_iva_device,
},
{
.name = "rpres_iva_seq0",
@@ -148,6 +149,7 @@ static struct rpres_platform_data rpres_data[] = {
.name = "rpres_fdif",
.oh_name = "fdif",
.ops = &fdif_ops,
+ .get_dev = omap4_get_fdif_device,
},
{
.name = "rpres_sl2if",
@@ -158,11 +160,13 @@ static struct rpres_platform_data rpres_data[] = {
static int __init init(void)
{
- int i;
+ int i, ret;
struct omap_hwmod *oh;
struct omap_device_pm_latency *ohl = rpres_latency;
int ohl_cnt = ARRAY_SIZE(rpres_latency);
struct omap_device *od;
+ struct device *dev;
+ struct platform_device *pdev;
for (i = 0; i < ARRAY_SIZE(rpres_data); i++) {
oh = omap_hwmod_lookup(rpres_data[i].oh_name);
@@ -171,13 +175,33 @@ static int __init init(void)
continue;
}
rpres_data[i].oh = oh;
- od = omap_device_build("rpres", i, oh,
- &rpres_data[i],
- sizeof(struct rpres_platform_data),
- ohl, ohl_cnt, false);
- if (IS_ERR(od))
- pr_err("Error building device for %s\n",
- rpres_data[i].name);
+
+ if (rpres_data[i].get_dev) {
+ dev = rpres_data[i].get_dev();
+ if (!dev) {
+ pr_err("No dev for %s\n", rpres_data[i].name);
+ continue;
+ }
+ pdev = to_platform_device(dev);
+ ret = platform_device_add_data(pdev, &rpres_data[i],
+ sizeof(struct rpres_platform_data));
+ if (ret) {
+ pr_err("Error pdev add for %s\n",
+ rpres_data[i].name);
+ continue;
+ }
+ od = to_omap_device(pdev);
+ od->pm_lats = ohl;
+ od->pm_lats_cnt = ohl_cnt;
+ } else {
+ od = omap_device_build("rpres", i, oh,
+ &rpres_data[i],
+ sizeof(struct rpres_platform_data),
+ ohl, ohl_cnt, false);
+ if (IS_ERR(od))
+ pr_err("Error building device for %s\n",
+ rpres_data[i].name);
+ }
}
return 0;
}