* History:
* 27/03/05 Vladimir Barinov - Added support for power management
*/
-
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
-#include <linux/fs.h>
-#include <linux/vmalloc.h>
-#include <linux/slab.h>
-#include <linux/proc_fs.h>
-#include <linux/ctype.h>
-#include <linux/pagemap.h>
-#include <linux/mm.h>
#include <linux/platform_device.h>
-#include <linux/delay.h>
-#include <linux/interrupt.h>
-#include <linux/videodev.h>
-#include <linux/pci.h>
#include <linux/version.h>
-#include <asm/semaphore.h>
-#include <asm/processor.h>
#include <linux/dma-mapping.h>
#include <linux/fb.h>
+#include <media/v4l2-common.h>
+
#include <asm/io.h>
-#include <asm/byteorder.h>
-#include <asm/irq.h>
#include "sensor_if.h"
#include "camera_hw_if.h"
#include "camera_core.h"
-
-struct camera_device *camera_dev;
-extern struct omap_camera_sensor camera_sensor_if;
-extern struct camera_hardware camera_hardware_if;
-
+
+
+static struct camera_device *camera_dev;
static void camera_core_sgdma_process(struct camera_device *cam);
/* module parameters */
#endif
};
-static struct platform_device camera_core_device = {
- .name = CAM_NAME,
- .dev = {
- .release = NULL,
- },
- .id = 0,
-};
+/* FIXME register omap16xx or omap24xx camera device in arch/arm/...
+ * system init code, with its resources and mux setup, NOT here.
+ * Then MODULE_ALIAS(CAM_NAME) so it hotplugs and coldplugs; this
+ * "legacy" driver style is trouble.
+ */
+static struct platform_device *cam;
-void __exit
+static void __exit
camera_core_cleanup(void)
{
platform_driver_unregister(&camera_core_driver);
- platform_device_unregister(&camera_core_device);
-
- return;
+ platform_device_unregister(cam);
}
static char banner[] __initdata = KERN_INFO "OMAP Camera driver initialzing\n";
-int __init
+static int __init
camera_core_init(void)
{
printk(banner);
- platform_device_register(&camera_core_device);
platform_driver_register(&camera_core_driver);
+ cam = platform_device_register_simple(CAM_NAME, -1, NULL, 0);
+
return 0;
}
MODULE_AUTHOR("Texas Instruments.");
MODULE_DESCRIPTION("OMAP Video for Linux camera driver");
MODULE_LICENSE("GPL");
+
module_param(video_nr, int, 0);
MODULE_PARM_DESC(video_nr,
"Minor number for video device (-1 ==> auto assign)");
struct videobuf_queue vbq;
};
-#define CAM_NAME "omap-camera"
+#define CAM_NAME "omap_camera"
#endif /* CAMERA_CORE__H */
void *, void *, void *);
int (*finish_dma)(void *);
};
-
+
+extern struct camera_hardware camera_hardware_if;
+
#endif /* OMAP_CAMERA_HW_IF_H */
#include "omap16xxcam.h"
#include "camera_hw_if.h"
#include "camera_core.h"
-
+
+
#define CONF_CAMERAIF_RESET_R 5
#define EN_PER 0
unsigned long iobase_phys;
/* frequncy (in Hz) of camera interface functional clock (ocp_clk) */
- unsigned long ocp_clk;
+ unsigned long ocp_clk;
+
+ struct clk *func_clk;
/* dma related stuff */
spinlock_t dma_lock;
int dma_channel_number2;
wait_queue_head_t vsync_wait;
-
+
int new;
};
static struct omap16xxcam hardware_data;
OMAP1610_RESET_CONTROL);
/* Enable peripheral reset */
- omap_writew(omap_readw(ARM_RSTCT2) | (1 << EN_PER), ARM_RSTCT2);
+ omap_writew(omap_readw(ARM_RSTCT2) | (1 << EN_PER), ARM_RSTCT2);
/* enable peripheral clock */
- if (machine_is_omap_h3())
- clk_enable(clk_get(0, "tc2_ck"));
- else {
- clk_enable(clk_get(0, "armper_ck"));
- clk_enable(clk_get(0, "armxor_ck"));
- }
+ clk_enable(hardware_data.func_clk);
}
static void
data->camdma[count].callback = callback;
data->camdma[count].arg1 = arg1;
data->camdma[count].arg2 = arg2;
-
- if (machine_is_omap_h3())
+
+ if (cpu_is_omap1710())
omap_set_dma_src_params(dmach, OMAP_DMA_PORT_OCP_T1,
OMAP_DMA_AMODE_CONSTANT, CAM_CAMDATA_REG,
0, 0);
{
struct omap16xxcam *data = (struct omap16xxcam *) priv;
+ if (!data->camera_regs)
+ return -EINVAL;
+
omap16xxcam_disable(data);
- if (machine_is_omap_h3()) {
- if (data->camera_regs) {
- iounmap((void *)data->camera_regs);
- data->camera_regs= NULL;
- }
- }
+ if (cpu_is_omap1710())
+ iounmap((void *)data->camera_regs);
+ data->camera_regs= NULL;
if (data->iobase_phys) {
release_mem_region(data->iobase_phys, CAMERA_IOSIZE);
data->iobase_phys = 0;
}
+ if (hardware_data.func_clk) {
+ clk_disable(hardware_data.func_clk);
+ clk_put(hardware_data.func_clk);
+ hardware_data.func_clk = NULL;
+ }
+
return 0;
}
{
unsigned long cam_iobase;
- if (!request_region(CAMERA_BASE, CAMERA_IOSIZE, "OAMP16xx Camera")) {
- printk ("OMAP16XX Parallel Camera Interface is already in use\n");
+ if (!request_mem_region(CAMERA_BASE, CAMERA_IOSIZE,
+ camera_hardware_if.name)) {
+ pr_debug("%s is already in use\n", camera_hardware_if.name);
return NULL;
}
- if (machine_is_omap_h3()) {
- cam_iobase = (unsigned long) ioremap (CAMERA_BASE, CAMERA_IOSIZE);
+ if (cpu_is_omap1710()) {
+ cam_iobase = (unsigned long) ioremap (CAMERA_BASE,
+ CAMERA_IOSIZE);
if (!cam_iobase) {
printk("CANNOT MAP CAMERA REGISTER\n");
return NULL;
/* Set the base address of the camera registers */
hardware_data.camera_regs = (camera_regs_t *)cam_iobase;
hardware_data.iobase_phys = (unsigned long) CAMERA_BASE;
- /* get the input clock value to camera interface and store it */
- if (machine_is_omap_h3())
- hardware_data.ocp_clk = clk_get_rate(clk_get(0, "tc_ck"));
+
+ /* get the input clock value to camera interface and store it */
+ if (cpu_is_omap1710())
+ hardware_data.func_clk = clk_get(0, "tc2_ck");
else
- hardware_data.ocp_clk = clk_get_rate(clk_get(0, "mpuper_ck"));
+ hardware_data.func_clk = clk_get(0, "armper_ck");
+ hardware_data.ocp_clk = clk_get_rate(hardware_data.func_clk);
/* Init the camera IF */
omap16xx_cam_init();
struct camera_hardware camera_hardware_if = {
.version = 0x01,
- .name = "OMAP16xx Camera Parallel",
+ .name = "OMAP16xx Parallel Camera",
.init = omap16xxcam_init,
.cleanup = omap16xxcam_cleanup,
.open = omap16xxcam_open,
int (*set_control)(struct v4l2_control *, void *);
};
-
+
+extern struct omap_camera_sensor camera_sensor_if;
+
#endif
#include <media/video-buf.h>
#include <linux/delay.h>
#include <asm/mach-types.h>
+#include <asm/arch/gpio.h>
#include "sensor_if.h"
#include "ov9640.h"
#include "h3sensorpower.h"
#include "h4sensorpower.h"
-#define CAMERA_OV9640
-#ifdef CAMERA_OV9640
struct ov9640_sensor {
/* I2C parameters */
if (machine_is_omap_h2())
return 0;
+#ifdef CONFIG_OMAP_OSK_MISTRAL
+ if (machine_is_omap_osk())
+ omap_set_gpio_dataout(11, 1);
+#endif
+
if (machine_is_omap_h3()) {
err = h3_sensor_powerup();
if (err)
if (machine_is_omap_h2())
return 0;
+#ifdef CONFIG_OMAP_OSK_MISTRAL
+ if (machine_is_omap_osk())
+ omap_set_gpio_dataout(11, 0);
+#endif
+
if (machine_is_omap_h3()) {
err = h3_sensor_powerdown();
if (err)
client->addr = addr;
client->driver = &ov9640sensor_i2c_driver;
client->adapter = adap;
+ strcpy(client->name, ov9640sensor_i2c_driver.driver.name);
err = i2c_attach_client(client);
if (err) {
static struct i2c_driver ov9640sensor_i2c_driver = {
- .driver {
+ .driver = {
.name = "ov9640",
},
.id = I2C_DRIVERID_MISC, /*FIXME:accroding to i2c-ids.h */
struct omap_camera_sensor camera_sensor_if = {
.version = 0x01,
.name = "OV9640",
- .parallel_mode = PAR_MODE_NOBT8,
- .hs_polarity = SYNC_ACTIVE_HIGH,
- .vs_polarity = SYNC_ACTIVE_LOW,
- .image_swap = 0,
.init = ov9640sensor_init,
.cleanup = ov9640sensor_cleanup,
.enum_pixformat = ov9640sensor_enum_pixformat,
.power_on = ov9640sensor_power_on,
.power_off = ov9640sensor_power_off,
};
+EXPORT_SYMBOL_GPL(camera_sensor_if);
+MODULE_LICENSE("GPL");
+
+#if 0
void print_ov9640_regs(void *priv)
{
struct ov9640_sensor *sensor = (struct ov9640_sensor *) priv;
else
printk("reg %x = %x\n", reg, val);
}
-
-#endif /* ifdef CAMERA_OV9640 */
+#endif