mirror of
https://github.com/armbian/linux.git
synced 2026-01-06 10:13:00 -08:00
camera: add mt9d112 sensor driver for FIH project
This commit is contained in:
@@ -39,6 +39,7 @@
|
||||
#define RK29_CAM_SENSOR_NAME_OV5640 "ov5640"
|
||||
#define RK29_CAM_SENSOR_NAME_OV5642 "ov5642"
|
||||
#define RK29_CAM_SENSOR_NAME_S5K6AA "s5k6aa"
|
||||
#define RK29_CAM_SENSOR_NAME_MT9D112 "mt9d112"
|
||||
#define RK29_CAM_SENSOR_NAME_MT9P111 "mt9p111"
|
||||
|
||||
#define RK29_CAM_POWERACTIVE_BITPOS 0x00
|
||||
|
||||
@@ -842,11 +842,15 @@ config SOC_CAMERA_MT9T031
|
||||
This driver supports MT9T031 cameras from Micron.
|
||||
|
||||
config SOC_CAMERA_MT9P111
|
||||
tristate "mt9p111support"
|
||||
tristate "mt9p111 support"
|
||||
depends on SOC_CAMERA && I2C
|
||||
help
|
||||
This driver supports MT9P111 cameras from Micron
|
||||
|
||||
config SOC_CAMERA_MT9D112
|
||||
tristate "mt9d112 support"
|
||||
depends on SOC_CAMERA && I2C
|
||||
help
|
||||
This driver supports MT9D112 cameras from Micron
|
||||
config SOC_CAMERA_MT9V022
|
||||
tristate "mt9v022 support"
|
||||
depends on SOC_CAMERA && I2C
|
||||
|
||||
@@ -77,6 +77,7 @@ obj-$(CONFIG_SOC_CAMERA_MT9M111) += mt9m111.o
|
||||
obj-$(CONFIG_SOC_CAMERA_MT9T031) += mt9t031.o
|
||||
obj-$(CONFIG_SOC_CAMERA_MT9V022) += mt9v022.o
|
||||
obj-$(CONFIG_SOC_CAMERA_MT9P111) += mt9p111.o
|
||||
obj-$(CONFIG_SOC_CAMERA_MT9D112) += mt9d112.o
|
||||
obj-$(CONFIG_SOC_CAMERA_OV772X) += ov772x.o
|
||||
obj-$(CONFIG_SOC_CAMERA_TW9910) += tw9910.o
|
||||
obj-$(CONFIG_SOC_CAMERA_OV7675) += ov7675.o
|
||||
|
||||
3191
drivers/media/video/mt9d112.c
Executable file
3191
drivers/media/video/mt9d112.c
Executable file
File diff suppressed because it is too large
Load Diff
29
drivers/media/video/mt9d112.h
Executable file
29
drivers/media/video/mt9d112.h
Executable file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Driver for MT9P111 CMOS Image Sensor from Aptina
|
||||
*
|
||||
* Copyright (C) 2008, Guennadi Liakhovetski <kernel@pengutronix.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef __MT9D112_H__
|
||||
#define __MT9D112_H__
|
||||
struct reginfo
|
||||
{
|
||||
u16 reg;
|
||||
u16 val;
|
||||
};
|
||||
|
||||
#define SEQUENCE_INIT 0x00
|
||||
#define SEQUENCE_NORMAL 0x01
|
||||
#define SEQUENCE_CAPTURE 0x02
|
||||
#define SEQUENCE_PREVIEW 0x03
|
||||
|
||||
#define SEQUENCE_PROPERTY 0xFFFC
|
||||
#define SEQUENCE_WAIT_MS 0xFFFD
|
||||
#define SEQUENCE_WAIT_US 0xFFFE
|
||||
#define SEQUENCE_END 0xFFFF
|
||||
#endif
|
||||
|
||||
@@ -45,7 +45,10 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
||||
/* Sensor Driver Configuration */
|
||||
#define SENSOR_NAME mt9p111
|
||||
#define SENSOR_V4L2_IDENT V4L2_IDENT_MT9P111
|
||||
#define SENSOR_ID 0xFEFE
|
||||
#define SENSOR_ID SEQUENCE_END
|
||||
#define SENSOR_ID_REG SEQUENCE_END
|
||||
#define SENSOR_RESET_REG SEQUENCE_END
|
||||
#define SENSOR_RESET_VAL 0x00
|
||||
#define SENSOR_MIN_WIDTH 176
|
||||
#define SENSOR_MIN_HEIGHT 144
|
||||
#define SENSOR_MAX_WIDTH 2592
|
||||
@@ -1262,6 +1265,12 @@ static struct reginfo sensor_720p[]=
|
||||
{0xC8AC, 0x02D0}, // CAM_OUTPUT_0_IMAGE_HEIGHT
|
||||
{0xC8AE, 0x0001}, // CAM_OUTPUT_0_OUTPUT_FORMAT
|
||||
{0x8404, 0x06}, // SEQ_CMD
|
||||
|
||||
//snap2preview
|
||||
{0x098E, 0x843C}, // LOGICAL_ADDRESS_ACCESS [SEQ_STATE_CFG_5_MAX_FRAME_CNT]
|
||||
{0x843C, 0x01}, // SEQ_STATE_CFG_5_MAX_FRAME_CNT
|
||||
{0x8404, 0x01}, // SEQ_CMD
|
||||
{0x0016, 0x0047}, // CLOCKS_CONTRO
|
||||
{SEQUENCE_END, 0x00}
|
||||
};
|
||||
|
||||
@@ -1275,9 +1284,6 @@ static struct reginfo sensor_1080p[]=
|
||||
/* 2592X1944 QSXGA */
|
||||
static struct reginfo sensor_qsxga[] =
|
||||
{
|
||||
{0x098E, 0x843C}, // LOGICAL_ADDRESS_ACCESS [SEQ_STATE_CFG_5_MAX_FRAME_CNT]
|
||||
{0x843C, 0xFF}, // SEQ_STATE_CFG_5_MAX_FRAME_CNT
|
||||
{0x8404, 0x02}, // SEQ_CMD
|
||||
{SEQUENCE_END, 0x00}
|
||||
};
|
||||
/* 2048*1536 QXGA */
|
||||
@@ -1311,11 +1317,6 @@ static struct reginfo sensor_svga[] =
|
||||
/* 640X480 VGA */
|
||||
static struct reginfo sensor_vga[] =
|
||||
{
|
||||
//snap2preview
|
||||
{0x098E, 0x843C}, // LOGICAL_ADDRESS_ACCESS [SEQ_STATE_CFG_5_MAX_FRAME_CNT]
|
||||
{0x843C, 0x01}, // SEQ_STATE_CFG_5_MAX_FRAME_CNT
|
||||
{0x8404, 0x01}, // SEQ_CMD
|
||||
{0x0016, 0x0047}, // CLOCKS_CONTRO
|
||||
//720p2vga
|
||||
{0xC83A, 0x000C}, // CAM_CORE_A_Y_ADDR_START
|
||||
{0xC83C, 0x0018}, // CAM_CORE_A_X_ADDR_START
|
||||
@@ -1333,8 +1334,6 @@ static struct reginfo sensor_vga[] =
|
||||
{0xC8AC, 0x01E0 }, // CAM_OUTPUT_0_IMAGE_HEIGHT
|
||||
{0xC8AE, 0x0001 }, // CAM_OUTPUT_0_OUTPUT_FORMAT
|
||||
{0x8404, 0x06}, // SEQ_CMD
|
||||
|
||||
|
||||
{SEQUENCE_END, 0x00}
|
||||
};
|
||||
|
||||
@@ -1439,7 +1438,24 @@ static struct reginfo ov2655_Sharpness5[] =
|
||||
{0x332d, 0x04},
|
||||
};
|
||||
#endif
|
||||
static struct reginfo sensor_Preview2Capture[]=
|
||||
{
|
||||
//capture2preview
|
||||
{0x098E, 0x843C}, // LOGICAL_ADDRESS_ACCESS [SEQ_STATE_CFG_5_MAX_FRAME_CNT]
|
||||
{0x843C, 0xFF}, // SEQ_STATE_CFG_5_MAX_FRAME_CNT
|
||||
{0x8404, 0x02}, // SEQ_CMD
|
||||
{SEQUENCE_END, 0x00}
|
||||
};
|
||||
|
||||
static struct reginfo sensor_Capture2Preview[]=
|
||||
{
|
||||
//snap2preview
|
||||
{0x098E, 0x843C}, // LOGICAL_ADDRESS_ACCESS [SEQ_STATE_CFG_5_MAX_FRAME_CNT]
|
||||
{0x843C, 0x01}, // SEQ_STATE_CFG_5_MAX_FRAME_CNT
|
||||
{0x8404, 0x01}, // SEQ_CMD
|
||||
{0x0016, 0x0047}, // CLOCKS_CONTRO
|
||||
{SEQUENCE_END, 0x00}
|
||||
};
|
||||
static struct reginfo sensor_ClrFmt_YUYV[]=
|
||||
{
|
||||
{SEQUENCE_END, 0x00}
|
||||
@@ -2073,6 +2089,10 @@ typedef struct sensor_info_priv_s
|
||||
unsigned char flip; /* VFLIP */
|
||||
bool snap2preview;
|
||||
bool video2preview;
|
||||
int capture_w;
|
||||
int capture_h;
|
||||
int preview_w;
|
||||
int preview_h;
|
||||
struct reginfo *winseqe_cur_addr;
|
||||
unsigned int pixfmt;
|
||||
unsigned int enable;
|
||||
@@ -2499,8 +2519,9 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
||||
/* soft reset */
|
||||
if (sensor_task_lock(client,1)<0)
|
||||
goto sensor_INIT_ERR;
|
||||
#if 0
|
||||
ret = sensor_write(client, 0x3008, 0x80);
|
||||
|
||||
#if (SENSOR_RESET_REG != SEQUENCE_END)
|
||||
ret = sensor_write(client, SENSOR_RESET_REG, SENSOR_RESET_VAL);
|
||||
if (ret != 0) {
|
||||
SENSOR_TR("%s soft reset sensor failed\n",SENSOR_NAME_STRING());
|
||||
ret = -ENODEV;
|
||||
@@ -2511,24 +2532,14 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
||||
#endif
|
||||
|
||||
/* check if it is an sensor sensor */
|
||||
#if (SENSOR_ID != 0xFEFE)
|
||||
ret = sensor_read(client, 0x300a, &value);
|
||||
#if (SENSOR_ID_REG != SEQUENCE_END)
|
||||
ret = sensor_read(client, SENSOR_ID_REG, &pid);
|
||||
if (ret != 0) {
|
||||
SENSOR_TR("read chip id high byte failed\n");
|
||||
SENSOR_TR("read chip id failed\n");
|
||||
ret = -ENODEV;
|
||||
goto sensor_INIT_ERR;
|
||||
}
|
||||
|
||||
pid |= (value << 8);
|
||||
|
||||
ret = sensor_read(client, 0x300b, &value);
|
||||
if (ret != 0) {
|
||||
SENSOR_TR("read chip id low byte failed\n");
|
||||
ret = -ENODEV;
|
||||
goto sensor_INIT_ERR;
|
||||
}
|
||||
|
||||
pid |= (value & 0xff);
|
||||
SENSOR_DG("\n %s pid = 0x%x \n", SENSOR_NAME_STRING(), pid);
|
||||
#else
|
||||
pid = SENSOR_ID;
|
||||
@@ -2548,8 +2559,10 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
||||
goto sensor_INIT_ERR;
|
||||
}
|
||||
sensor_task_lock(client,0);
|
||||
//icd->user_width = SENSOR_INIT_WIDTH;
|
||||
//icd->user_height = SENSOR_INIT_HEIGHT;
|
||||
sensor->info_priv.preview_w = SENSOR_INIT_WIDTH;
|
||||
sensor->info_priv.preview_h = SENSOR_INIT_HEIGHT;
|
||||
sensor->info_priv.capture_w = SENSOR_MAX_WIDTH;
|
||||
sensor->info_priv.capture_h = SENSOR_MAX_HEIGHT;
|
||||
sensor->info_priv.winseqe_cur_addr = SENSOR_INIT_WINSEQADR;
|
||||
sensor->info_priv.pixfmt = SENSOR_INIT_PIXFMT;
|
||||
|
||||
@@ -2765,111 +2778,118 @@ static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *f)
|
||||
set_w = pix->width;
|
||||
set_h = pix->height;
|
||||
|
||||
if (((set_w <= 176) && (set_h <= 144)) && sensor_qcif[0].reg)
|
||||
if (((set_w <= 176) && (set_h <= 144)) && (sensor_qcif[0].reg!=SEQUENCE_END))
|
||||
{
|
||||
winseqe_set_addr = sensor_qcif;
|
||||
set_w = 176;
|
||||
set_h = 144;
|
||||
}
|
||||
else if (((set_w <= 320) && (set_h <= 240)) && sensor_qvga[0].reg)
|
||||
else if (((set_w <= 320) && (set_h <= 240)) && (sensor_qvga[0].reg!=SEQUENCE_END))
|
||||
{
|
||||
winseqe_set_addr = sensor_qvga;
|
||||
set_w = 320;
|
||||
set_h = 240;
|
||||
}
|
||||
else if (((set_w <= 352) && (set_h<= 288)) && sensor_cif[0].reg)
|
||||
else if (((set_w <= 352) && (set_h<= 288)) && (sensor_cif[0].reg!=SEQUENCE_END))
|
||||
{
|
||||
winseqe_set_addr = sensor_cif;
|
||||
set_w = 352;
|
||||
set_h = 288;
|
||||
}
|
||||
else if (((set_w <= 640) && (set_h <= 480)) && sensor_vga[0].reg)
|
||||
else if (((set_w <= 640) && (set_h <= 480)) && (sensor_vga[0].reg!=SEQUENCE_END))
|
||||
{
|
||||
winseqe_set_addr = sensor_vga;
|
||||
set_w = 640;
|
||||
set_h = 480;
|
||||
}
|
||||
else if (((set_w <= 800) && (set_h <= 600)) && sensor_svga[0].reg)
|
||||
else if (((set_w <= 800) && (set_h <= 600)) && (sensor_svga[0].reg!=SEQUENCE_END))
|
||||
{
|
||||
winseqe_set_addr = sensor_svga;
|
||||
set_w = 800;
|
||||
set_h = 600;
|
||||
}
|
||||
else if (((set_w <= 1024) && (set_h <= 768)) && sensor_xga[0].reg)
|
||||
else if (((set_w <= 1024) && (set_h <= 768)) && (sensor_xga[0].reg!=SEQUENCE_END))
|
||||
{
|
||||
winseqe_set_addr = sensor_xga;
|
||||
set_w = 1024;
|
||||
set_h = 768;
|
||||
}
|
||||
else if (((set_w <= 1280) && (set_h <= 720)) && sensor_720p[0].reg)
|
||||
else if (((set_w <= 1280) && (set_h <= 720)) && (sensor_720p[0].reg!=SEQUENCE_END))
|
||||
{
|
||||
winseqe_set_addr = sensor_720p;
|
||||
set_w = 1280;
|
||||
set_h = 720;
|
||||
}
|
||||
else if (((set_w <= 1280) && (set_h <= 1024)) && sensor_sxga[0].reg)
|
||||
else if (((set_w <= 1280) && (set_h <= 1024)) && (sensor_sxga[0].reg!=SEQUENCE_END))
|
||||
{
|
||||
winseqe_set_addr = sensor_sxga;
|
||||
set_w = 1280;
|
||||
set_h = 1024;
|
||||
}
|
||||
else if (((set_w <= 1600) && (set_h <= 1200)) && sensor_uxga[0].reg)
|
||||
else if (((set_w <= 1600) && (set_h <= 1200)) && (sensor_uxga[0].reg!=SEQUENCE_END))
|
||||
{
|
||||
winseqe_set_addr = sensor_uxga;
|
||||
set_w = 1600;
|
||||
set_h = 1200;
|
||||
}
|
||||
else if (((set_w <= 1920) && (set_h <= 1080)) && sensor_1080p[0].reg)
|
||||
else if (((set_w <= 1920) && (set_h <= 1080)) && (sensor_1080p[0].reg!=SEQUENCE_END))
|
||||
{
|
||||
winseqe_set_addr = sensor_1080p;
|
||||
set_w = 1920;
|
||||
set_h = 1080;
|
||||
}
|
||||
else if (((set_w <= 2048) && (set_h <= 1536)) && sensor_qxga[0].reg)
|
||||
else if (((set_w <= 2048) && (set_h <= 1536)) && (sensor_qxga[0].reg!=SEQUENCE_END))
|
||||
{
|
||||
winseqe_set_addr = sensor_qxga;
|
||||
set_w = 2048;
|
||||
set_h = 1536;
|
||||
}
|
||||
else if (((set_w <= 2592) && (set_h <= 1944)) && sensor_qsxga[0].reg)
|
||||
else if (((set_w <= 2592) && (set_h <= 1944)) && (sensor_qsxga[0].reg!=SEQUENCE_END))
|
||||
{
|
||||
winseqe_set_addr = sensor_qsxga;
|
||||
set_w = 2592;
|
||||
set_h = 1944;
|
||||
}
|
||||
else
|
||||
{
|
||||
winseqe_set_addr = SENSOR_INIT_WINSEQADR; /* ddl@rock-chips.com : Sensor output smallest size if isn't support app */
|
||||
set_w = SENSOR_INIT_WIDTH;
|
||||
set_h = SENSOR_INIT_HEIGHT;
|
||||
ret = -1;
|
||||
SENSOR_TR("\n %s..%s Format is Invalidate. pix->width = %d.. pix->height = %d\n",SENSOR_NAME_STRING(),__FUNCTION__,pix->width,pix->height);
|
||||
}
|
||||
|
||||
if (winseqe_set_addr != sensor->info_priv.winseqe_cur_addr)
|
||||
{
|
||||
if ((sensor->info_priv.winseqe_cur_addr->reg == SEQUENCE_PROPERTY) && (sensor->info_priv.winseqe_cur_addr->val == SEQUENCE_INIT)) {
|
||||
if (((winseqe_set_addr->reg == SEQUENCE_PROPERTY) && (winseqe_set_addr->val == SEQUENCE_NORMAL))
|
||||
|| (winseqe_set_addr->reg != SEQUENCE_PROPERTY)) {
|
||||
ret |= sensor_write_array(client,sensor_init_data);
|
||||
SENSOR_DG("\n%s reinit ret:0x%x \n",SENSOR_NAME_STRING(), ret);
|
||||
}
|
||||
}
|
||||
|
||||
if ((winseqe_set_addr != sensor->info_priv.winseqe_cur_addr) && winseqe_set_addr) {
|
||||
ret |= sensor_write_array(client, winseqe_set_addr);
|
||||
if (ret != 0) {
|
||||
SENSOR_TR("%s set format capability failed\n", SENSOR_NAME_STRING());
|
||||
goto sensor_s_fmt_end;
|
||||
}
|
||||
|
||||
sensor->info_priv.winseqe_cur_addr = winseqe_set_addr;
|
||||
if ((winseqe_set_addr[0].reg==SEQUENCE_PROPERTY) && (winseqe_set_addr[0].val==SEQUENCE_CAPTURE)) {
|
||||
SENSOR_DG("\n%s..%s..Capture icd->width = %d.. icd->height %d\n",SENSOR_NAME_STRING(),__FUNCTION__,set_w,set_h);
|
||||
} else {
|
||||
SENSOR_DG("\n%s..%s..Video icd->width = %d.. icd->height %d\n",SENSOR_NAME_STRING(),__FUNCTION__,set_w,set_h);
|
||||
sensor->info_priv.preview_w = pix->width;
|
||||
sensor->info_priv.preview_h = pix->height;
|
||||
}
|
||||
}
|
||||
|
||||
SENSOR_DG("\n%s..%s.. icd->width = %d.. icd->height %d\n",SENSOR_NAME_STRING(),__FUNCTION__,set_w,set_h);
|
||||
}
|
||||
else
|
||||
{
|
||||
SENSOR_DG("\n %s .. Current Format is validate. icd->width = %d.. icd->height %d\n",SENSOR_NAME_STRING(),set_w,set_h);
|
||||
}
|
||||
if (winseqe_set_addr && (winseqe_set_addr[0].reg==SEQUENCE_PROPERTY) && (winseqe_set_addr[0].val==SEQUENCE_CAPTURE)) {
|
||||
ret |= sensor_write_array(client, sensor_Preview2Capture);
|
||||
if (ret != 0) {
|
||||
SENSOR_TR("%s Preview 2 Capture failed\n", SENSOR_NAME_STRING());
|
||||
goto sensor_s_fmt_end;
|
||||
}
|
||||
sensor->info_priv.capture_w = set_w;
|
||||
sensor->info_priv.capture_h = set_h;
|
||||
sensor->info_priv.snap2preview = true;
|
||||
} else if (sensor->info_priv.snap2preview == true) {
|
||||
if (winseqe_set_addr || ((sensor->info_priv.preview_w == pix->width) && (sensor->info_priv.preview_h == pix->height))) {
|
||||
ret |= sensor_write_array(client, sensor_Capture2Preview);
|
||||
if (ret != 0) {
|
||||
SENSOR_TR("%s Capture 2 Preview failed\n", SENSOR_NAME_STRING());
|
||||
goto sensor_s_fmt_end;
|
||||
}
|
||||
sensor->info_priv.preview_w = pix->width;
|
||||
sensor->info_priv.preview_h = pix->height;
|
||||
sensor->info_priv.snap2preview = false;
|
||||
} else {
|
||||
SENSOR_TR("\n %s..%s Format is Invalidate. pix->width = %d.. pix->height = %d\n",SENSOR_NAME_STRING(),__FUNCTION__,pix->width,pix->height);
|
||||
}
|
||||
}
|
||||
|
||||
pix->width = set_w;
|
||||
pix->height = set_h;
|
||||
@@ -3733,38 +3753,29 @@ static int sensor_video_probe(struct soc_camera_device *icd,
|
||||
}
|
||||
|
||||
/* soft reset */
|
||||
#if 0
|
||||
ret = sensor_write(client, 0x3012, 0x80);
|
||||
#if (SENSOR_RESET_REG != SEQUENCE_END)
|
||||
ret = sensor_write(client, SENSOR_RESET_REG, SENSOR_RESET_VAL);
|
||||
if (ret != 0) {
|
||||
SENSOR_TR("soft reset %s failed\n",SENSOR_NAME_STRING());
|
||||
SENSOR_TR("%s soft reset sensor failed\n",SENSOR_NAME_STRING());
|
||||
ret = -ENODEV;
|
||||
goto sensor_video_probe_err;
|
||||
goto sensor_INIT_ERR;
|
||||
}
|
||||
mdelay(5); //delay 5 microseconds
|
||||
|
||||
mdelay(5); //delay 5 microseconds
|
||||
#endif
|
||||
|
||||
/* check if it is an sensor sensor */
|
||||
#if (SENSOR_ID != 0xFEFE)
|
||||
ret = sensor_read(client, 0x300a, &value);
|
||||
/* check if it is an sensor sensor */
|
||||
#if (SENSOR_ID_REG != SEQUENCE_END)
|
||||
ret = sensor_read(client, SENSOR_ID_REG, &pid);
|
||||
if (ret != 0) {
|
||||
SENSOR_TR("read chip id high byte failed\n");
|
||||
SENSOR_TR("read chip id failed\n");
|
||||
ret = -ENODEV;
|
||||
goto sensor_video_probe_err;
|
||||
goto sensor_INIT_ERR;
|
||||
}
|
||||
|
||||
pid |= (value << 8);
|
||||
|
||||
ret = sensor_read(client, 0x300b, &value);
|
||||
if (ret != 0) {
|
||||
SENSOR_TR("read chip id low byte failed\n");
|
||||
ret = -ENODEV;
|
||||
goto sensor_video_probe_err;
|
||||
}
|
||||
|
||||
pid |= (value & 0xff);
|
||||
SENSOR_DG("\n %s pid = 0x%x\n", SENSOR_NAME_STRING(), pid);
|
||||
SENSOR_DG("\n %s pid = 0x%x \n", SENSOR_NAME_STRING(), pid);
|
||||
#else
|
||||
pid = SENSOR_ID;
|
||||
pid = SENSOR_ID;
|
||||
#endif
|
||||
|
||||
if (pid == SENSOR_ID) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Driver for MT9P111 CMOS Image Sensor from Aptina
|
||||
* Driver for MT9P111 CMOS Image Sensor from Aptina
|
||||
*
|
||||
* Copyright (C) 2008, Guennadi Liakhovetski <kernel@pengutronix.de>
|
||||
*
|
||||
@@ -8,19 +8,21 @@
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef __MT9P111_H__
|
||||
#define __MT9P111_H__
|
||||
#ifndef __MT9P111_H__
|
||||
#define __MT9P111_H__
|
||||
struct reginfo
|
||||
{
|
||||
u16 reg;
|
||||
u16 val;
|
||||
u16 val;
|
||||
};
|
||||
|
||||
#define SEQUENCE_INIT 0x00
|
||||
#define SEQUENCE_NORMAL 0x01
|
||||
#define SEQUENCE_CAPTURE 0x02
|
||||
#define SEQUENCE_PREVIEW 0x03
|
||||
|
||||
#define SEQUENCE_PROPERTY 0xFFFC
|
||||
#define SEQUENCE_WAIT_MS 0xFFFD
|
||||
#define SEQUENCE_WAIT_US 0xFFFE
|
||||
#define SEQUENCE_PROPERTY 0xFFFC
|
||||
#define SEQUENCE_WAIT_MS 0xFFFD
|
||||
#define SEQUENCE_WAIT_US 0xFFFE
|
||||
#define SEQUENCE_END 0xFFFF
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -2362,73 +2362,73 @@ static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *f)
|
||||
set_w = pix->width;
|
||||
set_h = pix->height;
|
||||
|
||||
if (((set_w <= 176) && (set_h <= 144)) && sensor_qcif[0].reg)
|
||||
if (((set_w <= 176) && (set_h <= 144)) && (sensor_qcif[0].reg!=SEQUENCE_END))
|
||||
{
|
||||
winseqe_set_addr = sensor_qcif;
|
||||
set_w = 176;
|
||||
set_h = 144;
|
||||
}
|
||||
else if (((set_w <= 320) && (set_h <= 240)) && sensor_qvga[0].reg)
|
||||
else if (((set_w <= 320) && (set_h <= 240)) && (sensor_qvga[0].reg!=SEQUENCE_END))
|
||||
{
|
||||
winseqe_set_addr = sensor_qvga;
|
||||
set_w = 320;
|
||||
set_h = 240;
|
||||
}
|
||||
else if (((set_w <= 352) && (set_h<= 288)) && sensor_cif[0].reg)
|
||||
else if (((set_w <= 352) && (set_h<= 288)) && (sensor_cif[0].reg!=SEQUENCE_END))
|
||||
{
|
||||
winseqe_set_addr = sensor_cif;
|
||||
set_w = 352;
|
||||
set_h = 288;
|
||||
}
|
||||
else if (((set_w <= 640) && (set_h <= 480)) && sensor_vga[0].reg)
|
||||
else if (((set_w <= 640) && (set_h <= 480)) && (sensor_vga[0].reg!=SEQUENCE_END))
|
||||
{
|
||||
winseqe_set_addr = sensor_vga;
|
||||
set_w = 640;
|
||||
set_h = 480;
|
||||
}
|
||||
else if (((set_w <= 800) && (set_h <= 600)) && sensor_svga[0].reg)
|
||||
else if (((set_w <= 800) && (set_h <= 600)) && (sensor_svga[0].reg!=SEQUENCE_END))
|
||||
{
|
||||
winseqe_set_addr = sensor_svga;
|
||||
set_w = 800;
|
||||
set_h = 600;
|
||||
}
|
||||
else if (((set_w <= 1024) && (set_h <= 768)) && sensor_xga[0].reg)
|
||||
else if (((set_w <= 1024) && (set_h <= 768)) && (sensor_xga[0].reg!=SEQUENCE_END))
|
||||
{
|
||||
winseqe_set_addr = sensor_xga;
|
||||
set_w = 1024;
|
||||
set_h = 768;
|
||||
}
|
||||
else if (((set_w <= 1280) && (set_h <= 720)) && sensor_720p[0].reg)
|
||||
else if (((set_w <= 1280) && (set_h <= 720)) && (sensor_720p[0].reg!=SEQUENCE_END))
|
||||
{
|
||||
winseqe_set_addr = sensor_720p;
|
||||
set_w = 1280;
|
||||
set_h = 720;
|
||||
}
|
||||
else if (((set_w <= 1280) && (set_h <= 1024)) && sensor_sxga[0].reg)
|
||||
else if (((set_w <= 1280) && (set_h <= 1024)) && (sensor_sxga[0].reg!=SEQUENCE_END))
|
||||
{
|
||||
winseqe_set_addr = sensor_sxga;
|
||||
set_w = 1280;
|
||||
set_h = 1024;
|
||||
}
|
||||
else if (((set_w <= 1600) && (set_h <= 1200)) && sensor_uxga[0].reg)
|
||||
else if (((set_w <= 1600) && (set_h <= 1200)) && (sensor_uxga[0].reg!=SEQUENCE_END))
|
||||
{
|
||||
winseqe_set_addr = sensor_uxga;
|
||||
set_w = 1600;
|
||||
set_h = 1200;
|
||||
}
|
||||
else if (((set_w <= 1920) && (set_h <= 1080)) && sensor_1080p[0].reg)
|
||||
else if (((set_w <= 1920) && (set_h <= 1080)) && (sensor_1080p[0].reg!=SEQUENCE_END))
|
||||
{
|
||||
winseqe_set_addr = sensor_1080p;
|
||||
set_w = 1920;
|
||||
set_h = 1080;
|
||||
}
|
||||
else if (((set_w <= 2048) && (set_h <= 1536)) && sensor_qxga[0].reg)
|
||||
else if (((set_w <= 2048) && (set_h <= 1536)) && (sensor_qxga[0].reg!=SEQUENCE_END))
|
||||
{
|
||||
winseqe_set_addr = sensor_qxga;
|
||||
set_w = 2048;
|
||||
set_h = 1536;
|
||||
}
|
||||
else if (((set_w <= 2592) && (set_h <= 1944)) && sensor_qsxga[0].reg)
|
||||
else if (((set_w <= 2592) && (set_h <= 1944)) && (sensor_qsxga[0].reg!=SEQUENCE_END))
|
||||
{
|
||||
winseqe_set_addr = sensor_qsxga;
|
||||
set_w = 2592;
|
||||
|
||||
@@ -253,6 +253,7 @@ enum {
|
||||
V4L2_IDENT_MT9M001C12STM = 45005,
|
||||
V4L2_IDENT_MT9M111 = 45007,
|
||||
V4L2_IDENT_MT9M112 = 45008,
|
||||
V4L2_IDENT_MT9D112 = 45009, /* ddl@rock-chips.com : MT9D112 support */
|
||||
V4L2_IDENT_MT9V022IX7ATC = 45010, /* No way to detect "normal" I77ATx */
|
||||
V4L2_IDENT_MT9V022IX7ATM = 45015, /* and "lead free" IA7ATx chips */
|
||||
V4L2_IDENT_MT9T031 = 45020,
|
||||
|
||||
Reference in New Issue
Block a user