#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
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)
{
#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>
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;
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);
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;
}
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;
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");