]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
video: tegra: host: Add T186 bindings for VI/ISP
authorArto Merilainen <amerilainen@nvidia.com>
Fri, 21 Nov 2014 12:19:59 +0000 (14:19 +0200)
committerArto Merilainen <amerilainen@nvidia.com>
Tue, 25 Nov 2014 15:36:10 +0000 (07:36 -0800)
This patch adds T186 bindings for VI/ISP. It modifies the preprocessor
to compile relevant code paths on all SoCs, removes dependency on
TEGRA_MC and adds dts bindings to T186 platform file.

Bug 1525992

Change-Id: Ib0893c54dc4f60221939397b3df78a39f137ab63
Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-on: http://git-master/r/654133
GVS: Gerrit_Virtual_Submit

drivers/video/tegra/host/isp/Makefile
drivers/video/tegra/host/isp/isp.c
drivers/video/tegra/host/vi/Makefile
drivers/video/tegra/host/vi/tegra_vi.c
drivers/video/tegra/host/vi/vi.c

index 7c8e3e7637b64d877c48e5d455581900f95fe5e7..436a307cf20bf1c556ec58c67ec4b8bb9246070e 100644 (file)
@@ -3,6 +3,10 @@ ccflags-y += -Idrivers/video/tegra/host
 ccflags-y += -Idrivers/video/tegra/camera
 ccflags-y += -Werror
 
+ifeq ($(CONFIG_ARCH_TEGRA_18x_SOC),y)
+ccflags-y += -I../kernel-t18x/drivers/video/tegra/host/
+endif
+
 nvhost-isp-objs  = \
                isp.o
 
index c01b5730b4eb980f6b6d5bb753abd77421daa838..4c6ea26c88025d6ee21bf10524e477f481850a35 100644 (file)
 #include "t124/t124.h"
 #include "t210/t210.h"
 
+#ifdef CONFIG_ARCH_TEGRA_18x_SOC
+#include "t186/t186.h"
+#endif
+
 #include <linux/uaccess.h>
 #include <linux/fs.h>
 #include <linux/nvhost_isp_ioctl.h>
@@ -57,11 +61,14 @@ static struct of_device_id tegra_isp_of_match[] = {
 #ifdef TEGRA_21X_OR_HIGHER_CONFIG
        { .compatible = "nvidia,tegra210-isp",
                .data = (struct nvhost_device_data *)&t21_isp_info },
+#endif
+#ifdef CONFIG_ARCH_TEGRA_18x_SOC
+       { .compatible = "nvidia,tegra186-isp",
+               .data = (struct nvhost_device_data *)&t18_isp_info },
 #endif
        { },
 };
 
-#ifdef TEGRA_12X_OR_HIGHER_CONFIG
 static void (*mfi_callback)(void *);
 static void *mfi_callback_arg;
 static DEFINE_MUTEX(isp_isr_lock);
@@ -73,7 +80,6 @@ static int __init init_tegra_isp_isr_callback(void)
 }
 
 pure_initcall(init_tegra_isp_isr_callback);
-#endif
 
 int nvhost_isp_t124_prepare_poweroff(struct platform_device *pdev)
 {
@@ -202,7 +208,6 @@ static int isp_isomgr_release(struct isp *tegra_isp)
 }
 #endif
 
-#ifdef TEGRA_12X_OR_HIGHER_CONFIG
 static inline u32 tegra_isp_read(struct isp *tegra_isp, u32 offset)
 {
        return readl(tegra_isp->base + offset);
@@ -284,7 +289,6 @@ static irqreturn_t isp_isr(int irq, void *dev_id)
        spin_unlock_irqrestore(&dev->lock, flags);
        return IRQ_HANDLED;
 }
-#endif
 
 static int isp_probe(struct platform_device *dev)
 {
@@ -300,27 +304,28 @@ static int isp_probe(struct platform_device *dev)
                match = of_match_device(tegra_isp_of_match, &dev->dev);
                if (match)
                        pdata = (struct nvhost_device_data *)match->data;
-#ifdef TEGRA_12X_OR_HIGHER_CONFIG
-               if (sscanf(dev->name, "isp.%1d", &dev_id) != 1)
-                       return -EINVAL;
-               switch (tegra_get_chipid()) {
-               case TEGRA_CHIPID_TEGRA12:
-               case TEGRA_CHIPID_TEGRA13:
-                       if (dev_id == ISPB_DEV_ID)
-                               pdata = &t124_ispb_info;
-                       if (dev_id == ISPA_DEV_ID)
-                               pdata = &t124_isp_info;
-                       break;
-               case TEGRA_CHIPID_TEGRA21:
-                       if (dev_id == ISPB_DEV_ID)
-                               pdata = &t21_ispb_info;
-                       if (dev_id == ISPA_DEV_ID)
-                               pdata = &t21_isp_info;
-                       break;
-               default:
-                       return -EINVAL;
+
+               if (!IS_ENABLED(CONFIG_ARCH_TEGRA_18x_SOC)) {
+                       if (sscanf(dev->name, "isp.%1d", &dev_id) != 1)
+                               return -EINVAL;
+                       switch (tegra_get_chipid()) {
+                       case TEGRA_CHIPID_TEGRA12:
+                       case TEGRA_CHIPID_TEGRA13:
+                               if (dev_id == ISPB_DEV_ID)
+                                       pdata = &t124_ispb_info;
+                               if (dev_id == ISPA_DEV_ID)
+                                       pdata = &t124_isp_info;
+                               break;
+                       case TEGRA_CHIPID_TEGRA21:
+                               if (dev_id == ISPB_DEV_ID)
+                                       pdata = &t21_ispb_info;
+                               if (dev_id == ISPA_DEV_ID)
+                                       pdata = &t21_isp_info;
+                               break;
+                       default:
+                               return -EINVAL;
+                       }
                }
-#endif
 
        } else
                pdata = (struct nvhost_device_data *)dev->dev.platform_data;
@@ -356,7 +361,6 @@ static int isp_probe(struct platform_device *dev)
 
        pdata->private_data = tegra_isp;
 
-#ifdef TEGRA_12X_OR_HIGHER_CONFIG
        /* init ispa isr */
        tegra_isp->base = pdata->aperture[0];
        if (!tegra_isp->base) {
@@ -406,8 +410,6 @@ static int isp_probe(struct platform_device *dev)
 
        disable_irq(tegra_isp->irq);
 
-#endif
-
        nvhost_module_init(dev);
 
 #ifdef CONFIG_PM_GENERIC_DOMAINS
@@ -455,13 +457,11 @@ static int __exit isp_remove(struct platform_device *dev)
        nvhost_module_disable_clk(&dev->dev);
 #endif
        nvhost_client_device_release(dev);
-#ifdef TEGRA_12X_OR_HIGHER_CONFIG
        disable_irq(tegra_isp->irq);
        kfree(tegra_isp->my_isr_work);
        flush_workqueue(tegra_isp->isp_workqueue);
        destroy_workqueue(tegra_isp->isp_workqueue);
        tegra_isp = NULL;
-#endif
        return 0;
 }
 
@@ -480,6 +480,8 @@ static struct platform_driver isp_driver = {
        }
 };
 
+#ifdef CONFIG_TEGRA_MC
+
 static int isp_set_la(struct isp *tegra_isp, uint isp_bw, uint la_client)
 {
        int ret = 0;
@@ -519,6 +521,13 @@ static int isp_set_la(struct isp *tegra_isp, uint isp_bw, uint la_client)
        return ret;
 }
 
+#else
+static int isp_set_la(struct isp *tegra_isp, uint isp_bw, uint la_client)
+{
+       return 0;
+}
+#endif
+
 static long isp_ioctl(struct file *file,
                unsigned int cmd, unsigned long arg)
 {
index 9e0271e930b8a171f1be7e69ca229cc38b228369..44881acd80727e53fb06cd9ff85b313a03450a57 100644 (file)
@@ -3,6 +3,10 @@ ccflags-y += -Idrivers/video/tegra/host
 ccflags-y += -Idrivers/video/tegra/camera
 ccflags-y += -Werror
 
+ifeq ($(CONFIG_ARCH_TEGRA_18x_SOC),y)
+ccflags-y += -I../kernel-t18x/drivers/video/tegra/host/
+endif
+
 ifneq (,$(filter $(CONFIG_TEGRA_GRHOST_VI),y m))
 obj-y += vi_irq.o
 obj-y += tegra_vi.o
index 10cc4df1891591e309448fe3c19698fb7d5abc2b..ba5e1a8c475d2a7150df975e42b5bf216454947c 100644 (file)
@@ -55,8 +55,6 @@ static DEFINE_MUTEX(la_lock);
 
 #define VI_MAX_BPP 2
 
-#ifdef TEGRA_12X_OR_HIGHER_CONFIG
-
 int nvhost_vi_finalize_poweron(struct platform_device *dev)
 {
        int ret = 0;
@@ -211,7 +209,7 @@ 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;
+       int ret = 0;
        uint total_vi_bw;
 
        pdata_vi1 =
@@ -250,6 +248,7 @@ static int vi_set_la(struct vi *tegra_vi1, uint vi_bw)
 
        mutex_unlock(&la_lock);
 
+#ifdef CONFIG_TEGRA_MC
        ret = tegra_set_camera_ptsa(TEGRA_LA_VI_W, total_vi_bw, 1);
 
        if (!ret) {
@@ -262,6 +261,7 @@ static int vi_set_la(struct vi *tegra_vi1, uint vi_bw)
        } else {
                pr_err("%s: set ptsa failed: %d\n", __func__, ret);
        }
+#endif
 
        return ret;
 }
@@ -422,7 +422,6 @@ const struct file_operations tegra_vi_ctrl_ops = {
 #endif
        .release = vi_release,
 };
-#endif
 
 /* Reset sensor data if respective clk is ON */
 void nvhost_vi_reset_all(struct platform_device *pdev)
index cbf2edcc5dd73ad8056b9e7dd5e9a740cfa9f823..d81e747842e73a88bdba3807000b929f477df63e 100644 (file)
 #include "vi_irq.h"
 #include "camera_priv_defs.h"
 
+#ifdef CONFIG_ARCH_TEGRA_18x_SOC
+#include "t186/t186.h"
+#endif
+
 #define MAX_DEVID_LENGTH       16
 #define TEGRA_VI_NAME          "tegra_vi"
 
@@ -50,6 +54,10 @@ static struct of_device_id tegra_vi_of_match[] = {
 #ifdef TEGRA_21X_OR_HIGHER_CONFIG
        { .compatible = "nvidia,tegra210-vi",
                .data = (struct nvhost_device_data *)&t21_vi_info },
+#endif
+#ifdef CONFIG_ARCH_TEGRA_18x_SOC
+       { .compatible = "nvidia,tegra186-vi",
+               .data = (struct nvhost_device_data *)&t18_vi_info },
 #endif
        { },
 };