ARM: tegra11: clock: Add emc and host1x sysfs floors
Alex Frid [Wed, 17 Jul 2013 21:23:25 +0000 (14:23 -0700)]
Change-Id: Ib00775ecbded79cb865cdeaed8e05ba2e06e486a
Signed-off-by: Alex Frid <afrid@nvidia.com>
Reviewed-on: http://git-master/r/250417
Reviewed-by: Riham Haidar <rhaidar@nvidia.com>
Tested-by: Riham Haidar <rhaidar@nvidia.com>

arch/arm/mach-tegra/tegra11_clocks.c
arch/arm/mach-tegra/tegra11_dvfs.c

index 188b0c1..259e306 100644 (file)
@@ -6980,6 +6980,7 @@ struct clk tegra_list_clks[] = {
        SHARED_EMC_CLK("edp.emc",       "edp.emc",      NULL,   &tegra_clk_emc, NULL, 0, SHARED_CEILING, 0),
        SHARED_EMC_CLK("battery.emc", "battery_edp",    "emc",  &tegra_clk_emc, NULL, 0, SHARED_CEILING, 0),
        SHARED_EMC_CLK("vde.emc",       "tegra-avp",            "emc_vde",      &tegra_clk_emc, NULL, 0, 0, BIT(EMC_USER_VDE)),
+       SHARED_EMC_CLK("floor.profile.emc", "profile.emc", NULL, &tegra_clk_emc, NULL,  0, 0, 0),
 
 #ifdef CONFIG_TEGRA_DUAL_CBUS
        DUAL_CBUS_CLK("3d.cbus",        "tegra_gr3d",           "gr3d", &tegra_clk_c2bus, "3d",  0, 0),
@@ -7022,6 +7023,7 @@ struct clk tegra_list_clks[] = {
        SHARED_CLK("cap.host1x", "cap.host1x",          NULL,     &tegra_clk_host1x, NULL,  0, SHARED_CEILING),
        SHARED_CLK("floor.host1x", "floor.host1x",      NULL,     &tegra_clk_host1x, NULL,  0, 0),
        SHARED_CLK("override.host1x", "override.host1x", NULL,    &tegra_clk_host1x, NULL,  0, SHARED_OVERRIDE),
+       SHARED_CLK("floor.profile.host1x", "profile.host1x", NULL, &tegra_clk_host1x, NULL,  0, 0),
 };
 
 
index e0ba179..a60fb00 100644 (file)
@@ -908,6 +908,7 @@ int tegra_dvfs_rail_post_enable(struct dvfs_rail *rail)
 
 /* Core voltage and bus cap object and tables */
 static struct kobject *cap_kobj;
+static struct kobject *floor_kobj;
 
 static struct core_dvfs_cap_table tegra11_core_cap_table[] = {
 #ifdef CONFIG_TEGRA_DUAL_CBUS
@@ -939,7 +940,18 @@ static struct core_bus_cap_table tegra11_bus_cap_table[] = {
 #endif
 };
 
-static int __init tegra11_dvfs_init_core_cap(void)
+static struct core_bus_floor_table tegra11_bus_floor_table[] = {
+       { .floor_name = "floor.profile.host1x",
+         .refcnt_attr = {.attr = {.name = "h1x_floor_state", .mode = 0644} },
+         .level_attr  = {.attr = {.name = "h1x_floor_level", .mode = 0644} },
+       },
+       { .floor_name = "floor.profile.emc",
+         .refcnt_attr = {.attr = {.name = "emc_floor_state", .mode = 0644} },
+         .level_attr  = {.attr = {.name = "emc_floor_level", .mode = 0644} },
+       },
+};
+
+static int __init tegra11_dvfs_init_core_limits(void)
 {
        int ret;
 
@@ -971,6 +983,23 @@ static int __init tegra11_dvfs_init_core_cap(void)
        }
        pr_info("tegra dvfs: tegra sysfs cap interface is initialized\n");
 
+       floor_kobj = kobject_create_and_add("tegra_floor", kernel_kobj);
+       if (!floor_kobj) {
+               pr_err("tegra11_dvfs: failed to create sysfs floor object\n");
+               return 0;
+       }
+
+       ret = tegra_init_shared_bus_floor(
+               tegra11_bus_floor_table, ARRAY_SIZE(tegra11_bus_floor_table),
+               floor_kobj);
+       if (ret) {
+               pr_err("tegra11_dvfs: failed to init bus floor interface (%d)\n",
+                      ret);
+               kobject_del(floor_kobj);
+               return 0;
+       }
+       pr_info("tegra dvfs: tegra sysfs floor interface is initialized\n");
+
        return 0;
 }
-late_initcall(tegra11_dvfs_init_core_cap);
+late_initcall(tegra11_dvfs_init_core_limits);