Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
omap1_camera.c File Reference
#include <linux/clk.h>
#include <linux/dma-mapping.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <media/omap1_camera.h>
#include <media/soc_camera.h>
#include <media/soc_mediabus.h>
#include <media/videobuf-dma-contig.h>
#include <media/videobuf-dma-sg.h>
#include <plat/dma.h>

Go to the source code of this file.

Data Structures

struct  omap1_cam_buf
 
struct  omap1_cam_dev
 

Macros

#define DRIVER_NAME   "omap1-camera"
 
#define DRIVER_VERSION   "0.0.2"
 
#define REG_CTRLCLOCK   0x00
 
#define REG_IT_STATUS   0x04
 
#define REG_MODE   0x08
 
#define REG_STATUS   0x0C
 
#define REG_CAMDATA   0x10
 
#define REG_GPIO   0x14
 
#define REG_PEAK_COUNTER   0x18
 
#define LCLK_EN   BIT(7)
 
#define DPLL_EN   BIT(6)
 
#define MCLK_EN   BIT(5)
 
#define CAMEXCLK_EN   BIT(4)
 
#define POLCLK   BIT(3)
 
#define FOSCMOD_SHIFT   0
 
#define FOSCMOD_MASK   (0x7 << FOSCMOD_SHIFT)
 
#define FOSCMOD_12MHz   0x0
 
#define FOSCMOD_6MHz   0x2
 
#define FOSCMOD_9_6MHz   0x4
 
#define FOSCMOD_24MHz   0x5
 
#define FOSCMOD_8MHz   0x6
 
#define DATA_TRANSFER   BIT(5)
 
#define FIFO_FULL   BIT(4)
 
#define H_DOWN   BIT(3)
 
#define H_UP   BIT(2)
 
#define V_DOWN   BIT(1)
 
#define V_UP   BIT(0)
 
#define RAZ_FIFO   BIT(18)
 
#define EN_FIFO_FULL   BIT(17)
 
#define EN_NIRQ   BIT(16)
 
#define THRESHOLD_SHIFT   9
 
#define THRESHOLD_MASK   (0x7f << THRESHOLD_SHIFT)
 
#define DMA   BIT(8)
 
#define EN_H_DOWN   BIT(7)
 
#define EN_H_UP   BIT(6)
 
#define EN_V_DOWN   BIT(5)
 
#define EN_V_UP   BIT(4)
 
#define ORDERCAMD   BIT(3)
 
#define IRQ_MASK
 
#define HSTATUS   BIT(1)
 
#define VSTATUS   BIT(0)
 
#define CAM_RST   BIT(0)
 
#define SOCAM_BUS_FLAGS
 
#define FIFO_SIZE   ((THRESHOLD_MASK >> THRESHOLD_SHIFT) + 1)
 
#define FIFO_SHIFT   __fls(FIFO_SIZE)
 
#define DMA_BURST_SHIFT   (1 + OMAP_DMA_DATA_BURST_4)
 
#define DMA_BURST_SIZE   (1 << DMA_BURST_SHIFT)
 
#define DMA_ELEMENT_SHIFT   OMAP_DMA_DATA_TYPE_S32
 
#define DMA_ELEMENT_SIZE   (1 << DMA_ELEMENT_SHIFT)
 
#define DMA_FRAME_SHIFT_CONTIG   (FIFO_SHIFT - 1)
 
#define DMA_FRAME_SHIFT_SG   DMA_BURST_SHIFT
 
#define DMA_FRAME_SHIFT(x)
 
#define DMA_FRAME_SIZE(x)   (1 << DMA_FRAME_SHIFT(x))
 
#define DMA_SYNC   OMAP_DMA_SYNC_FRAME
 
#define THRESHOLD_LEVEL   DMA_FRAME_SIZE
 
#define MAX_VIDEO_MEM   4 /* arbitrary video memory limit in MB */
 
#define CAM_READ(pcdev, reg)   cam_read(pcdev, REG_##reg, false)
 
#define CAM_WRITE(pcdev, reg, val)   cam_write(pcdev, REG_##reg, val)
 
#define CAM_READ_CACHE(pcdev, reg)   cam_read(pcdev, REG_##reg, true)
 
#define subdev_call_with_sense(pcdev, dev, icd, sd, function, args...)
 

Functions

 module_platform_driver (omap1_cam_driver)
 
 module_param (sg_mode, bool, 0644)
 
 MODULE_PARM_DESC (sg_mode,"videobuf mode, 0: dma-contig (default), 1: dma-sg")
 
 MODULE_DESCRIPTION ("OMAP1 Camera Interface driver")
 
 MODULE_AUTHOR ("Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>")
 
 MODULE_LICENSE ("GPL v2")
 
 MODULE_VERSION (DRIVER_VERSION)
 
 MODULE_ALIAS ("platform:"DRIVER_NAME)
 

Macro Definition Documentation

#define CAM_READ (   pcdev,
  reg 
)    cam_read(pcdev, REG_##reg, false)

Definition at line 195 of file omap1_camera.c.

#define CAM_READ_CACHE (   pcdev,
  reg 
)    cam_read(pcdev, REG_##reg, true)

Definition at line 199 of file omap1_camera.c.

#define CAM_RST   BIT(0)

Definition at line 101 of file omap1_camera.c.

#define CAM_WRITE (   pcdev,
  reg,
  val 
)    cam_write(pcdev, REG_##reg, val)

Definition at line 197 of file omap1_camera.c.

#define CAMEXCLK_EN   BIT(4)

Definition at line 62 of file omap1_camera.c.

#define DATA_TRANSFER   BIT(5)

Definition at line 73 of file omap1_camera.c.

#define DMA   BIT(8)

Definition at line 86 of file omap1_camera.c.

#define DMA_BURST_SHIFT   (1 + OMAP_DMA_DATA_BURST_4)

Definition at line 115 of file omap1_camera.c.

#define DMA_BURST_SIZE   (1 << DMA_BURST_SHIFT)

Definition at line 116 of file omap1_camera.c.

#define DMA_ELEMENT_SHIFT   OMAP_DMA_DATA_TYPE_S32

Definition at line 118 of file omap1_camera.c.

#define DMA_ELEMENT_SIZE   (1 << DMA_ELEMENT_SHIFT)

Definition at line 119 of file omap1_camera.c.

#define DMA_FRAME_SHIFT (   x)
Value:

Definition at line 124 of file omap1_camera.c.

#define DMA_FRAME_SHIFT_CONTIG   (FIFO_SHIFT - 1)

Definition at line 121 of file omap1_camera.c.

#define DMA_FRAME_SHIFT_SG   DMA_BURST_SHIFT

Definition at line 122 of file omap1_camera.c.

#define DMA_FRAME_SIZE (   x)    (1 << DMA_FRAME_SHIFT(x))

Definition at line 127 of file omap1_camera.c.

#define DMA_SYNC   OMAP_DMA_SYNC_FRAME

Definition at line 128 of file omap1_camera.c.

#define DPLL_EN   BIT(6)

Definition at line 60 of file omap1_camera.c.

#define DRIVER_NAME   "omap1-camera"

Definition at line 40 of file omap1_camera.c.

#define DRIVER_VERSION   "0.0.2"

Definition at line 41 of file omap1_camera.c.

#define EN_FIFO_FULL   BIT(17)

Definition at line 82 of file omap1_camera.c.

#define EN_H_DOWN   BIT(7)

Definition at line 87 of file omap1_camera.c.

#define EN_H_UP   BIT(6)

Definition at line 88 of file omap1_camera.c.

#define EN_NIRQ   BIT(16)

Definition at line 83 of file omap1_camera.c.

#define EN_V_DOWN   BIT(5)

Definition at line 89 of file omap1_camera.c.

#define EN_V_UP   BIT(4)

Definition at line 90 of file omap1_camera.c.

#define FIFO_FULL   BIT(4)

Definition at line 74 of file omap1_camera.c.

#define FIFO_SHIFT   __fls(FIFO_SIZE)

Definition at line 113 of file omap1_camera.c.

#define FIFO_SIZE   ((THRESHOLD_MASK >> THRESHOLD_SHIFT) + 1)

Definition at line 112 of file omap1_camera.c.

#define FOSCMOD_12MHz   0x0

Definition at line 66 of file omap1_camera.c.

#define FOSCMOD_24MHz   0x5

Definition at line 69 of file omap1_camera.c.

#define FOSCMOD_6MHz   0x2

Definition at line 67 of file omap1_camera.c.

#define FOSCMOD_8MHz   0x6

Definition at line 70 of file omap1_camera.c.

#define FOSCMOD_9_6MHz   0x4

Definition at line 68 of file omap1_camera.c.

#define FOSCMOD_MASK   (0x7 << FOSCMOD_SHIFT)

Definition at line 65 of file omap1_camera.c.

#define FOSCMOD_SHIFT   0

Definition at line 64 of file omap1_camera.c.

#define H_DOWN   BIT(3)

Definition at line 75 of file omap1_camera.c.

#define H_UP   BIT(2)

Definition at line 76 of file omap1_camera.c.

#define HSTATUS   BIT(1)

Definition at line 97 of file omap1_camera.c.

#define IRQ_MASK
Value:

Definition at line 93 of file omap1_camera.c.

#define LCLK_EN   BIT(7)

Definition at line 59 of file omap1_camera.c.

#define MAX_VIDEO_MEM   4 /* arbitrary video memory limit in MB */

Definition at line 132 of file omap1_camera.c.

#define MCLK_EN   BIT(5)

Definition at line 61 of file omap1_camera.c.

#define ORDERCAMD   BIT(3)

Definition at line 91 of file omap1_camera.c.

#define POLCLK   BIT(3)

Definition at line 63 of file omap1_camera.c.

#define RAZ_FIFO   BIT(18)

Definition at line 81 of file omap1_camera.c.

#define REG_CAMDATA   0x10

Definition at line 54 of file omap1_camera.c.

#define REG_CTRLCLOCK   0x00

Definition at line 50 of file omap1_camera.c.

#define REG_GPIO   0x14

Definition at line 55 of file omap1_camera.c.

#define REG_IT_STATUS   0x04

Definition at line 51 of file omap1_camera.c.

#define REG_MODE   0x08

Definition at line 52 of file omap1_camera.c.

#define REG_PEAK_COUNTER   0x18

Definition at line 56 of file omap1_camera.c.

#define REG_STATUS   0x0C

Definition at line 53 of file omap1_camera.c.

#define SOCAM_BUS_FLAGS
Value:
V4L2_MBUS_HSYNC_ACTIVE_HIGH | V4L2_MBUS_VSYNC_ACTIVE_HIGH | \
V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_PCLK_SAMPLE_FALLING | \
V4L2_MBUS_DATA_ACTIVE_HIGH)

Definition at line 106 of file omap1_camera.c.

#define subdev_call_with_sense (   pcdev,
  dev,
  icd,
  sd,
  function,
  args... 
)
Value:
({ \
struct soc_camera_sense sense = { \
.master_clock = pcdev->camexclk, \
.pixel_clock_max = 0, \
}; \
int __ret; \
if (pcdev->pdata) \
sense.pixel_clock_max = pcdev->pdata->lclk_khz_max * 1000; \
icd->sense = &sense; \
__ret = v4l2_subdev_call(sd, video, function, ##args); \
icd->sense = NULL; \
if (sense.flags & SOCAM_SENSE_PCLK_CHANGED) { \
if (sense.pixel_clock > sense.pixel_clock_max) { \
dev_err(dev, \
"%s: pixel clock %lu set by the camera too high!\n", \
__func__, sense.pixel_clock); \
__ret = -EINVAL; \
} \
} \
__ret; \
})

Definition at line 1159 of file omap1_camera.c.

#define THRESHOLD_LEVEL   DMA_FRAME_SIZE

Definition at line 129 of file omap1_camera.c.

#define THRESHOLD_MASK   (0x7f << THRESHOLD_SHIFT)

Definition at line 85 of file omap1_camera.c.

#define THRESHOLD_SHIFT   9

Definition at line 84 of file omap1_camera.c.

#define V_DOWN   BIT(1)

Definition at line 77 of file omap1_camera.c.

#define V_UP   BIT(0)

Definition at line 78 of file omap1_camera.c.

#define VSTATUS   BIT(0)

Definition at line 98 of file omap1_camera.c.

Function Documentation

MODULE_ALIAS ( "platform:"  DRIVER_NAME)
MODULE_AUTHOR ( "Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>"  )
MODULE_DESCRIPTION ( "OMAP1 Camera Interface driver )
MODULE_LICENSE ( "GPL v2 )
module_param ( sg_mode  ,
bool  ,
0644   
)
MODULE_PARM_DESC ( sg_mode  ,
"videobuf  mode,
0:dma contigdefault,
1:dma-sg  
)
module_platform_driver ( omap1_cam_driver  )
MODULE_VERSION ( DRIVER_VERSION  )