video: tegra: host: Remove version from dev name
Terje Bergstrom [Wed, 13 Jun 2012 08:57:59 +0000 (11:57 +0300)]
Remove version from nvhost_device name, and use a new field,
version, to distinguish between IP versions. This restores the
sysfs API for 3D clock scaling back to its original path.

Change-Id: I444ef728b7cab9e5ea3a08f3c7be0f1661209686
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/108501
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>

drivers/video/tegra/host/bus.c
drivers/video/tegra/host/gr3d/gr3d.c
drivers/video/tegra/host/mpe/mpe.c
drivers/video/tegra/host/t20/t20.c
drivers/video/tegra/host/t30/t30.c
include/linux/nvhost.h

index 3b769f4..758a5ca 100644 (file)
@@ -79,7 +79,8 @@ static struct nvhost_device_id *nvhost_bus_match_id(struct nvhost_device *dev,
        struct nvhost_device_id *id_table)
 {
        while (id_table->name[0]) {
-               if (strcmp(dev->name, id_table->name) == 0)
+               if (strcmp(dev->name, id_table->name) == 0
+                               && dev->version == id_table->version)
                        return id_table;
                id_table++;
        }
index 1ea4414..5338ce9 100644 (file)
@@ -157,7 +157,7 @@ int nvhost_gr3d_prepare_power_off(struct nvhost_device *dev)
 }
 
 enum gr3d_ip_ver {
-       gr3d_01,
+       gr3d_01 = 1,
        gr3d_02,
 };
 
@@ -197,8 +197,8 @@ static const struct gr3d_desc gr3d[] = {
 };
 
 static struct nvhost_device_id gr3d_id[] = {
-       { "gr3d01", gr3d_01 },
-       { "gr3d02", gr3d_02 },
+       { "gr3d", gr3d_01 },
+       { "gr3d", gr3d_02 },
        { },
 };
 
@@ -210,7 +210,7 @@ static int __devinit gr3d_probe(struct nvhost_device *dev,
        int index = 0;
        struct nvhost_driver *drv = to_nvhost_driver(dev->dev.driver);
 
-       index = id_table->driver_data;
+       index = id_table->version;
 
        drv->finalize_poweron           = gr3d[index].finalize_poweron;
        drv->busy                       = gr3d[index].busy;
@@ -221,10 +221,6 @@ static int __devinit gr3d_probe(struct nvhost_device *dev,
        drv->prepare_poweroff           = gr3d[index].prepare_poweroff;
        drv->alloc_hwctx_handler        = gr3d[index].alloc_hwctx_handler;
 
-       /* reset device name so that consistent device name can be
-        * found in clock tree */
-       dev->name = "gr3d";
-
        nvhost_set_register_sets(tegra_gpu_register_sets());
        return nvhost_client_device_init(dev);
 }
index 57770ce..9f90553 100644 (file)
@@ -593,7 +593,7 @@ int nvhost_mpe_prepare_power_off(struct nvhost_device *dev)
 }
 
 enum mpe_ip_ver {
-       mpe_01,
+       mpe_01 = 1,
        mpe_02,
 };
 
@@ -615,8 +615,8 @@ static const struct mpe_desc mpe[] = {
 };
 
 static struct nvhost_device_id mpe_id[] = {
-       { "mpe01", mpe_01 },
-       { "mpe02", mpe_02 },
+       { "mpe", mpe_01 },
+       { "mpe", mpe_02 },
        { },
 };
 
@@ -629,15 +629,11 @@ static int __devinit mpe_probe(struct nvhost_device *dev,
        int index = 0;
        struct nvhost_driver *drv = to_nvhost_driver(dev->dev.driver);
 
-       index = id_table->driver_data;
+       index = id_table->version;
 
        drv->prepare_poweroff           = mpe[index].prepare_poweroff;
        drv->alloc_hwctx_handler        = mpe[index].alloc_hwctx_handler;
 
-       /* reset device name so that consistent device name can be
-        * found in clock tree */
-       dev->name = "mpe";
-
        err = nvhost_client_device_get_resources(dev);
        if (err)
                return err;
index 9b27c74..93e73e5 100644 (file)
@@ -118,7 +118,8 @@ static struct nvhost_device tegra_display01_device = {
 };
 
 static struct nvhost_device tegra_gr3d01_device = {
-       .name           = "gr3d01",
+       .name           = "gr3d",
+       .version        = 1,
        .id             = -1,
        .index          = 1,
        .syncpts        = BIT(NVSYNCPT_3D),
@@ -204,7 +205,8 @@ static struct resource tegra_mpe01_resources[] = {
 };
 
 static struct nvhost_device tegra_mpe01_device = {
-       .name           = "mpe01",
+       .name           = "mpe",
+       .version        = 1,
        .id             = -1,
        .resource       = tegra_mpe01_resources,
        .num_resources  = ARRAY_SIZE(tegra_mpe01_resources),
index 9f43036..b74c561 100644 (file)
@@ -118,7 +118,8 @@ static struct nvhost_device tegra_display01_device = {
 };
 
 static struct nvhost_device tegra_gr3d02_device = {
-       .name           = "gr3d02",
+       .name           = "gr3d",
+       .version        = 2,
        .id             = -1,
        .index          = 1,
        .syncpts        = BIT(NVSYNCPT_3D),
@@ -210,7 +211,8 @@ static struct resource tegra_mpe01_resources[] = {
 };
 
 static struct nvhost_device tegra_mpe02_device = {
-       .name           = "mpe02",
+       .name           = "mpe",
+       .version        = 2,
        .id             = -1,
        .resource       = tegra_mpe01_resources,
        .num_resources  = ARRAY_SIZE(tegra_mpe01_resources),
index 1293cec..382a54f 100644 (file)
@@ -36,7 +36,7 @@ struct nvhost_master;
 
 struct nvhost_device_id {
        char name[NVHOST_NAME_SIZE];
-       unsigned long driver_data;
+       unsigned long version;
 };
 
 struct nvhost_clock {
@@ -52,11 +52,8 @@ enum nvhost_device_powerstate_t {
 };
 
 struct nvhost_device {
-       /* device name: its format is of type -
-        * <name><ip-version>.<instance>
-        * e.g.: gr3d01 = gr3d ip version 01 used in tegra2
-        * no instance number means hardware supports single instance */
-       const char      *name;
+       const char      *name;          /* device name */
+       int             version;        /* ip version number of device */
        struct device   dev;            /* Linux device struct */
        int             id;             /* Separates clients of same hw */
        int             index;          /* Hardware channel number */