video: tegra: host: Init 3d scaling on probe
Arto Merilainen [Sat, 2 Feb 2013 08:48:40 +0000 (10:48 +0200)]
sysfs control nodes are created during 3d scaling initialization.
This change reorders 3d scaling initialization to occur during device
probe so that sysfs nodes are always available.

Bug 1223355
Bug 1229151

Change-Id: I626f18c5cd409050e51f51dacfd6b36bfbcf788c
Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-on: http://git-master/r/196736
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Mitch Luban <mluban@nvidia.com>
Tested-by: Mitch Luban <mluban@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
GVS: Gerrit_Virtual_Submit

drivers/video/tegra/host/bus_client.c
drivers/video/tegra/host/gr3d/gr3d.c
drivers/video/tegra/host/gr3d/gr3d_t114.c
include/linux/nvhost.h

index 93a9aed..4798b59 100644 (file)
@@ -850,6 +850,9 @@ int nvhost_client_device_init(struct platform_device *dev)
        if (err)
                goto fail;
 
+       if (pdata->scaling_init)
+               pdata->scaling_init(dev);
+
        nvhost_device_debug_init(dev);
 
        /* reset syncpoint values for this unit */
index c0e72e2..8ec276f 100644 (file)
@@ -167,6 +167,8 @@ struct gr3d_desc {
        void (*suspend_ndev)(struct platform_device *);
        void (*init)(struct platform_device *dev);
        void (*deinit)(struct platform_device *dev);
+       void (*scaling_init)(struct platform_device *dev);
+       void (*scaling_deinit)(struct platform_device *dev);
        int (*prepare_poweroff)(struct platform_device *dev);
        struct nvhost_hwctx_handler *(*alloc_hwctx_handler)(u32 syncpt,
                        u32 waitbase, struct nvhost_channel *ch);
@@ -182,6 +184,8 @@ static const struct gr3d_desc gr3d[] = {
                .suspend_ndev = NULL,
                .init = NULL,
                .deinit = NULL,
+               .scaling_init = NULL,
+               .scaling_deinit = NULL,
                .prepare_poweroff = nvhost_gr3d_prepare_power_off,
                .alloc_hwctx_handler = nvhost_gr3d_t20_ctxhandler_init,
                .read_reg = nvhost_gr3d_t20_read_reg,
@@ -191,8 +195,10 @@ static const struct gr3d_desc gr3d[] = {
                .busy = nvhost_scale3d_notify_busy,
                .idle = nvhost_scale3d_notify_idle,
                .suspend_ndev = nvhost_scale3d_suspend,
-               .init = nvhost_scale3d_init,
-               .deinit = nvhost_scale3d_deinit,
+               .init = NULL,
+               .deinit = NULL,
+               .scaling_init = nvhost_scale3d_init,
+               .scaling_deinit = nvhost_scale3d_deinit,
                .prepare_poweroff = nvhost_gr3d_prepare_power_off,
                .alloc_hwctx_handler = nvhost_gr3d_t30_ctxhandler_init,
                .read_reg = nvhost_gr3d_t30_read_reg,
@@ -203,6 +209,8 @@ static const struct gr3d_desc gr3d[] = {
                .suspend_ndev = nvhost_scale3d_suspend,
                .init = nvhost_gr3d_t114_init,
                .deinit = nvhost_gr3d_t114_deinit,
+               .scaling_init = nvhost_scale3d_actmon_init,
+               .scaling_deinit = nvhost_scale3d_actmon_deinit,
                .prepare_poweroff = nvhost_gr3d_t114_prepare_power_off,
                .finalize_poweron = nvhost_gr3d_t114_finalize_power_on,
                .alloc_hwctx_handler = nvhost_gr3d_t114_ctxhandler_init,
@@ -238,6 +246,8 @@ static int __devinit gr3d_probe(struct platform_device *dev)
        pdata->suspend_ndev             = gr3d[index].suspend_ndev;
        pdata->init                     = gr3d[index].init;
        pdata->deinit                   = gr3d[index].deinit;
+       pdata->scaling_init             = gr3d[index].scaling_init;
+       pdata->scaling_deinit           = gr3d[index].scaling_deinit;
        pdata->prepare_poweroff         = gr3d[index].prepare_poweroff;
        pdata->alloc_hwctx_handler      = gr3d[index].alloc_hwctx_handler;
        pdata->read_reg                 = gr3d[index].read_reg;
index acb869b..2bdea73 100644 (file)
@@ -472,12 +472,10 @@ void nvhost_gr3d_t114_init(struct platform_device *dev)
 {
        if (actmon_op().init)
                actmon_op().init(nvhost_get_host(dev));
-       nvhost_scale3d_actmon_init(dev);
 }
 
 void nvhost_gr3d_t114_deinit(struct platform_device *dev)
 {
-       nvhost_scale3d_actmon_deinit(dev);
        if (actmon_op().deinit)
                actmon_op().deinit(nvhost_get_host(dev));
 }
index 800fbb0..c1b60ac 100644 (file)
@@ -137,6 +137,12 @@ struct nvhost_device_data {
        /* Device is going to be suspended */
        void (*suspend_ndev)(struct platform_device *);
 
+       /* Scaling init is run on device registration */
+       void (*scaling_init)(struct platform_device *dev);
+
+       /* Scaling deinit is called on device unregistration */
+       void (*scaling_deinit)(struct platform_device *dev);
+
        /* Device is initialized */
        void (*init)(struct platform_device *dev);