media: video: Add stub isp driver for tegra
authorRebecca Schultz Zavin <rebecca@android.com>
Wed, 28 Jul 2010 22:16:25 +0000 (15:16 -0700)
committerColin Cross <ccross@android.com>
Wed, 6 Oct 2010 23:33:26 +0000 (16:33 -0700)
Change-Id: I6ff1bf0e72ef69b59d5875bd60c7cd825fa2ca4f
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
drivers/media/video/Kconfig
drivers/media/video/Makefile
drivers/media/video/tegra/Kconfig [new file with mode: 0644]
drivers/media/video/tegra/Makefile [new file with mode: 0644]
drivers/media/video/tegra/tegra_isp.c [new file with mode: 0644]
include/media/tegra_isp.h [new file with mode: 0644]

index f6e4d04753510baee5b16bc294f9894bc111390e..e3b374110897cb9bebae361c9fb5fce4496a91e0 100644 (file)
@@ -553,6 +553,7 @@ config VIDEO_VIVI
 source "drivers/media/video/davinci/Kconfig"
 
 source "drivers/media/video/omap/Kconfig"
+source "drivers/media/video/tegra/Kconfig"
 
 source "drivers/media/video/bt8xx/Kconfig"
 
index 40f98fba5f88f5c503ad66447c114df75af00901..399ff510d79c25caaa22dc2f51b64487cf3ade5e 100644 (file)
@@ -179,6 +179,7 @@ obj-$(CONFIG_VIDEO_IR_I2C)  += ir-kbd-i2c.o
 obj-y  += davinci/
 
 obj-$(CONFIG_ARCH_OMAP)        += omap/
+obj-$(CONFIG_ARCH_TEGRA) += tegra/
 
 EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core
 EXTRA_CFLAGS += -Idrivers/media/dvb/frontends
diff --git a/drivers/media/video/tegra/Kconfig b/drivers/media/video/tegra/Kconfig
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/drivers/media/video/tegra/Makefile b/drivers/media/video/tegra/Makefile
new file mode 100644 (file)
index 0000000..1437578
--- /dev/null
@@ -0,0 +1,4 @@
+#
+# Makefile for the video capture/playback device drivers.
+#
+obj-y                          += tegra_isp.o
diff --git a/drivers/media/video/tegra/tegra_isp.c b/drivers/media/video/tegra/tegra_isp.c
new file mode 100644 (file)
index 0000000..f82f5d9
--- /dev/null
@@ -0,0 +1,107 @@
+/*
+ * drivers/media/video/tegra/isp.c
+ *
+ * Copyright (C) 2010 Google, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/miscdevice.h>
+#include <linux/platform_device.h>
+#include <linux/ioctl.h>
+#include <linux/fs.h>
+#include <linux/regulator/consumer.h>
+#include <media/tegra_isp.h>
+
+/* Eventually this should handle all clock and reset calls for the isp, vi,
+ * vi_sensor, and csi modules, replacing nvrm and nvos completely for camera
+ */
+#define TEGRA_ISP_NAME "tegra_isp"
+
+static struct regulator *tegra_isp_regulator_csi;
+
+static int tegra_isp_ioctl(struct inode *inode, struct file *file,
+                          unsigned int cmd, unsigned long arg)
+{
+       switch (cmd) {
+       case TEGRA_ISP_IOCTL_CSI_POWER_ON:
+               regulator_enable(tegra_isp_regulator_csi);
+               break;
+       case TEGRA_ISP_IOCTL_CSI_POWER_OFF:
+               regulator_disable(tegra_isp_regulator_csi);
+               break;
+       default:
+               pr_err("%s: Unknoown tegra_isp ioctl.\n", TEGRA_ISP_NAME);
+       }
+       return 0;
+}
+
+static const struct file_operations tegra_isp_fops = {
+       .owner = THIS_MODULE,
+       .ioctl = tegra_isp_ioctl,
+};
+
+static struct miscdevice tegra_isp_device = {
+       .minor = MISC_DYNAMIC_MINOR,
+       .name = TEGRA_ISP_NAME,
+       .fops = &tegra_isp_fops,
+};
+
+static int tegra_isp_probe(struct platform_device *pdev)
+{
+       int err;
+
+       pr_info("%s: probe\n", TEGRA_ISP_NAME);
+       tegra_isp_regulator_csi = regulator_get(NULL, "vcsi");
+       if (IS_ERR(tegra_isp_regulator_csi)) {
+               pr_err("%s: Couldn't get regulator vcsi\n", TEGRA_ISP_NAME);
+               return PTR_ERR(tegra_isp_regulator_csi);
+       }
+
+       err = misc_register(&tegra_isp_device);
+       if (err) {
+               pr_err("%s: Unable to register misc device!\n", TEGRA_ISP_NAME);
+               regulator_put(tegra_isp_regulator_csi);
+               return err;
+       }
+
+       /* XXX FIX ME -- SHOULDN'T BE ALWAYS ON! */
+       regulator_enable(tegra_isp_regulator_csi);
+       return 0;
+}
+
+static int tegra_isp_remove(struct platform_device *pdev)
+{
+       /* XXX FIX ME -- SHOULDN'T BE ALWAYS ON! */
+       regulator_disable(tegra_isp_regulator_csi);
+       misc_deregister(&tegra_isp_device);
+       return 0;
+}
+
+static struct platform_driver tegra_isp_driver = {
+       .probe = tegra_isp_probe,
+       .remove = tegra_isp_remove,
+       .driver = { .name = TEGRA_ISP_NAME }
+};
+
+static int __init tegra_isp_init(void)
+{
+       return platform_driver_register(&tegra_isp_driver);
+}
+
+static void __exit tegra_isp_exit(void)
+{
+       platform_driver_unregister(&tegra_isp_driver);
+}
+
+module_init(tegra_isp_init);
+module_exit(tegra_isp_exit);
+
diff --git a/include/media/tegra_isp.h b/include/media/tegra_isp.h
new file mode 100644 (file)
index 0000000..d1ae232
--- /dev/null
@@ -0,0 +1,18 @@
+/*
+ * include/linux/tegra_isp.h
+ *
+ * Copyright (C) 2010 Google, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#define TEGRA_ISP_IOCTL_CSI_POWER_ON   _IO('i', 1)
+#define TEGRA_ISP_IOCTL_CSI_POWER_OFF  _IO('i', 2)