]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
video: tegra: host: move vi_set_la() to tegra_vi.c
authorBryan Wu <pengw@nvidia.com>
Thu, 31 Oct 2013 19:18:40 +0000 (12:18 -0700)
committerTerje Bergstrom <tbergstrom@nvidia.com>
Mon, 4 Nov 2013 08:52:17 +0000 (00:52 -0800)
vi_set_la() in vi.c makes vi.c can't be built as a module. So move it
to tegra_vi.c which will always built in. And add a static mutex lock
for bandwidth operation in tegra_vi.c after removing struct vi_lock.

Bug 1349044

Change-Id: I7bfdfba1acbe4c1c7b3015561f948b98bc14e466
Signed-off-by: Bryan Wu <pengw@nvidia.com>
Reviewed-on: http://git-master/r/323622
Reviewed-by: Kushal Shah <kshah@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
drivers/video/tegra/host/vi/tegra_vi.c
drivers/video/tegra/host/vi/vi.c
drivers/video/tegra/host/vi/vi.h

index 955cc84625c752bd5683d813564cf2080349e9b2..23cbdee9d7e20f57438f661577cabfd1452c741a 100644 (file)
 #include <linux/nvhost_vi_ioctl.h>
 #include <linux/platform_device.h>
 
+#include <mach/latency_allowance.h>
+
 #include "bus_client.h"
 #include "chip_support.h"
 #include "host1x/host1x.h"
 #include "vi.h"
 
+static DEFINE_MUTEX(la_lock);
+
 #define T12_VI_CFG_CG_CTRL     0x2e
 #define T12_CG_2ND_LEVEL_EN    1
 #define T12_VI_CSI_0_SW_RESET  0x40
@@ -104,6 +108,41 @@ int nvhost_vi_prepare_poweroff(struct platform_device *dev)
        return ret;
 }
 
+static int vi_set_la(struct vi *tegra_vi1, uint vi_bw)
+{
+       struct nvhost_device_data *pdata_vi1, *pdata_vi2;
+       struct vi *tegra_vi2;
+       struct clk *clk_vi;
+       int ret;
+       uint total_vi_bw;
+
+       pdata_vi1 =
+               (struct nvhost_device_data *)tegra_vi1->ndev->dev.platform_data;
+
+       /* Copy device data for other vi device */
+       mutex_lock(&la_lock);
+
+       tegra_vi1->vi_bw = vi_bw / 1000;
+       total_vi_bw = tegra_vi1->vi_bw;
+       if (pdata_vi1->master)
+               pdata_vi2 = (struct nvhost_device_data *)pdata_vi1->master;
+       else
+               pdata_vi2 = (struct nvhost_device_data *)pdata_vi1->slave;
+
+       tegra_vi2 = (struct vi *)pdata_vi2->private_data;
+
+       clk_vi = clk_get(&tegra_vi2->ndev->dev, "emc");
+       if (tegra_is_clk_enabled(clk_vi))
+               total_vi_bw += tegra_vi2->vi_bw;
+
+       mutex_unlock(&la_lock);
+
+       ret = tegra_set_camera_ptsa(TEGRA_LA_VI_W, total_vi_bw, 1);
+
+       return ret;
+}
+
+
 long vi_ioctl(struct file *file,
                unsigned int cmd, unsigned long arg)
 {
index 8d6459b43987725dd3eb9b6e6216c468c6f8f531..7acdb14f4b0fcd840e3b5d33c35140a24989699d 100644 (file)
@@ -26,7 +26,6 @@
 #include <linux/of_device.h>
 #include <linux/of_platform.h>
 #include <linux/clk/tegra.h>
-#include <mach/latency_allowance.h>
 
 #include <mach/pm_domains.h>
 #include <media/tegra_v4l2_camera.h>
@@ -59,10 +58,6 @@ static struct of_device_id tegra_vi_of_match[] = {
 
 static struct i2c_camera_ctrl *i2c_ctrl;
 
-static struct vi_mutex vi_lock = {
-       .mutex_init_flag = 0,
-};
-
 static int vi_probe(struct platform_device *dev)
 {
        int err = 0;
@@ -104,11 +99,6 @@ static int vi_probe(struct platform_device *dev)
        tegra_vi->ndev = dev;
        pdata->private_data = tegra_vi;
 
-       if (!vi_lock.mutex_init_flag) {
-               mutex_init(&vi_lock.lock);
-               vi_lock.mutex_init_flag = 1;
-       }
-
        /* Create I2C Devices according to settings from board file */
        if (i2c_ctrl && i2c_ctrl->new_devices)
                i2c_ctrl->new_devices(dev);
@@ -146,8 +136,6 @@ camera_i2c_unregister:
        if (i2c_ctrl && i2c_ctrl->remove_devices)
                i2c_ctrl->remove_devices(dev);
        pdata->private_data = i2c_ctrl;
-       vi_lock.mutex_init_flag = 0;
-       mutex_destroy(&vi_lock.lock);
        kfree(tegra_vi);
        return err;
 }
@@ -182,8 +170,6 @@ static int __exit vi_remove(struct platform_device *dev)
                i2c_ctrl->remove_devices(dev);
 
        pdata->private_data = i2c_ctrl;
-       vi_lock.mutex_init_flag = 0;
-       mutex_destroy(&vi_lock.lock);
        kfree(tegra_vi);
 
        return 0;
@@ -267,40 +253,6 @@ static void __exit vi_exit(void)
        platform_driver_unregister(&vi_driver);
 }
 
-int vi_set_la(struct vi *tegra_vi1, uint vi_bw)
-{
-       struct nvhost_device_data *pdata_vi1, *pdata_vi2;
-       struct vi *tegra_vi2;
-       struct clk *clk_vi;
-       int ret;
-       uint total_vi_bw;
-
-       pdata_vi1 =
-               (struct nvhost_device_data *)tegra_vi1->ndev->dev.platform_data;
-
-       /* Copy device data for other vi device */
-       mutex_lock(&vi_lock.lock);
-
-       tegra_vi1->vi_bw = vi_bw / 1000;
-       total_vi_bw = tegra_vi1->vi_bw;
-       if (pdata_vi1->master)
-               pdata_vi2 = (struct nvhost_device_data *)pdata_vi1->master;
-       else
-               pdata_vi2 = (struct nvhost_device_data *)pdata_vi1->slave;
-
-       tegra_vi2 = (struct vi *)pdata_vi2->private_data;
-
-       clk_vi = clk_get(&tegra_vi2->ndev->dev, "emc");
-       if (tegra_is_clk_enabled(clk_vi))
-               total_vi_bw += tegra_vi2->vi_bw;
-
-       mutex_unlock(&vi_lock.lock);
-
-       ret = tegra_set_camera_ptsa(TEGRA_LA_VI_W, total_vi_bw, 1);
-
-       return ret;
-}
-
 late_initcall(vi_init);
 module_exit(vi_exit);
 MODULE_LICENSE("GPL v2");
index 34c4f9f8536a3929b8d946e167e695ccf9899689..9a3c8d5b12271ff63d75a5f9e0fe3d76a1ed0487 100644 (file)
@@ -30,17 +30,11 @@ struct vi {
        uint vi_bw;
 };
 
-struct vi_mutex {
-       struct mutex lock;
-       uint mutex_init_flag;
-};
-
 extern const struct file_operations tegra_vi_ctrl_ops;
 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(struct platform_device *);
-int vi_set_la(struct vi *, uint);
 
 #endif