]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
video: tegra: host: reset correct sensor on powergate
authorShridhar Rasal <srasal@nvidia.com>
Fri, 2 May 2014 09:55:42 +0000 (15:25 +0530)
committerSachin Nikam <snikam@nvidia.com>
Mon, 19 May 2014 10:27:29 +0000 (03:27 -0700)
- add reset callback for vi single device separately
- don't set device id explicitly for vi single device

Bug 1436477

Change-Id: I2b5956a49da46b7a0a681a6ad84c116016cab05e
Signed-off-by: Shridhar Rasal <srasal@nvidia.com>
Reviewed-on: http://git-master/r/404329
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Tested-by: Sachin Nikam <snikam@nvidia.com>
drivers/video/tegra/host/t124/t124.c
drivers/video/tegra/host/vi/tegra_vi.c
drivers/video/tegra/host/vi/vi.c
drivers/video/tegra/host/vi/vi.h

index 09f2ac90379ae8f31e318b7ee2d03ebf197de172..a507f7a2f3c22857299cdf6365bafa258e66a9db 100644 (file)
@@ -214,7 +214,7 @@ struct nvhost_device_data t124_vi_info = {
        .prepare_poweroff = nvhost_vi_prepare_poweroff,
        .finalize_poweron = nvhost_vi_finalize_poweron,
        .ctrl_ops         = &tegra_vi_ctrl_ops,
-       .reset            = nvhost_vi_reset,
+       .reset            = nvhost_vi_reset_all,
        .alloc_hwctx_handler = nvhost_alloc_hwctx_handler,
 };
 EXPORT_SYMBOL(t124_vi_info);
index 4499e569e33e365f317963106934449ad9559014..4f1c4a9a7e75c761bf11116c075df448e42fd834 100644 (file)
@@ -29,6 +29,7 @@
 #include <mach/latency_allowance.h>
 
 #include "bus_client.h"
+#include "nvhost_acm.h"
 #include "chip_support.h"
 #include "host1x/host1x.h"
 #include "vi.h"
@@ -417,6 +418,67 @@ const struct file_operations tegra_vi_ctrl_ops = {
 };
 #endif
 
+/* Reset sensor data if respective clk is ON */
+void nvhost_vi_reset_all(struct platform_device *pdev)
+{
+       void __iomem *reset_reg[4];
+       int err;
+       bool enabled = false;
+       struct nvhost_device_data *pdata = pdev->dev.platform_data;
+       struct clk *clk;
+
+       err = nvhost_clk_get(pdev, "cilab", &clk);
+       if (!err && tegra_is_clk_enabled(clk)) {
+               reset_reg[0] = pdata->aperture[0] +
+                       T12_VI_CSI_0_SW_RESET;
+               reset_reg[1] = pdata->aperture[0] +
+                       T12_CSI_CSI_SW_SENSOR_A_RESET;
+               reset_reg[2] = pdata->aperture[0] +
+                       T12_CSI_CSICIL_SW_SENSOR_A_RESET;
+               reset_reg[3] = pdata->aperture[0] +
+                       T12_VI_CSI_0_CSI_IMAGE_DT;
+
+               writel(0, reset_reg[3]);
+               writel(0x1, reset_reg[2]);
+               writel(0x1, reset_reg[1]);
+               writel(0x1f, reset_reg[0]);
+
+               udelay(10);
+
+               writel(0, reset_reg[2]);
+               writel(0, reset_reg[1]);
+       }
+
+       err = nvhost_clk_get(pdev, "cilcd", &clk);
+       if (!err && tegra_is_clk_enabled(clk))
+               enabled = true;
+
+       err = nvhost_clk_get(pdev, "cile", &clk);
+       if (!err && tegra_is_clk_enabled(clk))
+               enabled = true;
+
+       if (enabled) {
+               reset_reg[0] = pdata->aperture[0] +
+                       T12_VI_CSI_1_SW_RESET;
+               reset_reg[1] = pdata->aperture[0] +
+                       T12_CSI_CSI_SW_SENSOR_B_RESET;
+               reset_reg[2] = pdata->aperture[0] +
+                       T12_CSI_CSICIL_SW_SENSOR_B_RESET;
+               reset_reg[3] = pdata->aperture[0] +
+                       T12_VI_CSI_1_CSI_IMAGE_DT;
+
+               writel(0, reset_reg[3]);
+               writel(0x1, reset_reg[2]);
+               writel(0x1, reset_reg[1]);
+               writel(0x1f, reset_reg[0]);
+
+               udelay(10);
+
+               writel(0, reset_reg[2]);
+               writel(0, reset_reg[1]);
+       }
+}
+
 void nvhost_vi_reset(struct platform_device *pdev)
 {
        void __iomem *reset_reg[4];
@@ -454,4 +516,3 @@ void nvhost_vi_reset(struct platform_device *pdev)
        for (i = 2; i > 0; i--)
                writel(0, reset_reg[i]);
 }
-
index 7aba404dc24513979e34fe864631b879c2ee7202..049df994be179e46394905d44bd1e6b593fa39be 100644 (file)
@@ -147,7 +147,9 @@ static int vi_probe(struct platform_device *dev)
                /* DT initializes it to -1, use below WAR to set correct value.
                 * TODO: Once proper fix for dev-id goes in, remove it.
                 */
+#ifndef CONFIG_VI_ONE_DEVICE
                dev->id = dev->dev.id;
+#endif
        } else
                pdata = (struct nvhost_device_data *)dev->dev.platform_data;
 
index 3c1228f3c9bb0c36e1b04c6e580faf8141d47ea6..b92cc143c57d4d33c06c4e9564eeb5c0c930f3d9 100644 (file)
@@ -56,6 +56,8 @@ int nvhost_vi_prepare_poweroff(struct platform_device *);
 int nvhost_vi_finalize_poweron(struct platform_device *);
 int nvhost_vi_init(struct platform_device *);
 void nvhost_vi_deinit(struct platform_device *);
+
+void nvhost_vi_reset_all(struct platform_device *);
 void nvhost_vi_reset(struct platform_device *);
 
 #endif