mirror of
https://github.com/torvalds/linux.git
synced 2026-06-09 07:03:37 +02:00
parent
64df168943
commit
446f291f45
203
arch/arm/mach-rk29/include/mach/rk29_camera.h
Executable file
203
arch/arm/mach-rk29/include/mach/rk29_camera.h
Executable file
|
|
@ -0,0 +1,203 @@
|
|||
/*
|
||||
camera.h - PXA camera driver header file
|
||||
|
||||
Copyright (C) 2003, Intel Corporation
|
||||
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 as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
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.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __ASM_ARCH_CAMERA_H_
|
||||
#define __ASM_ARCH_CAMERA_H_
|
||||
|
||||
#include <linux/videodev2.h>
|
||||
|
||||
#define RK29_CAM_DRV_NAME "rk29xx-camera"
|
||||
#define RK29_CAM_PLATFORM_DEV_ID 33
|
||||
|
||||
#define INVALID_GPIO -1
|
||||
|
||||
#define RK29_CAM_IO_SUCCESS 0
|
||||
#define RK29_CAM_EIO_INVALID -1
|
||||
#define RK29_CAM_EIO_REQUESTFAIL -2
|
||||
|
||||
/*---------------- Camera Sensor Must Define Macro Begin ------------------------*/
|
||||
#define RK29_CAM_SENSOR_OV7675 ov7675
|
||||
#define RK29_CAM_SENSOR_OV9650 ov9650
|
||||
#define RK29_CAM_SENSOR_OV2640 ov2640
|
||||
#define RK29_CAM_SENSOR_OV2655 ov2655
|
||||
#define RK29_CAM_SENSOR_OV2659 ov2659
|
||||
#define RK29_CAM_SENSOR_OV7690 ov7690
|
||||
#define RK29_CAM_SENSOR_OV3640 ov3640
|
||||
#define RK29_CAM_SENSOR_OV5640 ov5640
|
||||
#define RK29_CAM_SENSOR_OV5642 ov5642
|
||||
#define RK29_CAM_SENSOR_S5K6AA s5k6aa
|
||||
#define RK29_CAM_SENSOR_MT9D112 mt9d112
|
||||
#define RK29_CAM_SENSOR_MT9D113 mt9d113
|
||||
#define RK29_CAM_SENSOR_MT9P111 mt9p111
|
||||
#define RK29_CAM_SENSOR_MT9T111 mt9t111
|
||||
#define RK29_CAM_SENSOR_GT2005 gt2005
|
||||
#define RK29_CAM_SENSOR_GC0307 gc0307
|
||||
#define RK29_CAM_SENSOR_GC0308 gc0308
|
||||
#define RK29_CAM_SENSOR_GC0309 gc0309
|
||||
#define RK29_CAM_SENSOR_GC2015 gc2015
|
||||
#define RK29_CAM_SENSOR_SIV120B siv120b
|
||||
#define RK29_CAM_SENSOR_SID130B sid130B
|
||||
#define RK29_CAM_SENSOR_HI253 hi253
|
||||
#define RK29_CAM_SENSOR_HI704 hi704
|
||||
#define RK29_CAM_SENSOR_NT99250 nt99250
|
||||
|
||||
#define RK29_CAM_SENSOR_NAME_OV7675 "ov7675"
|
||||
#define RK29_CAM_SENSOR_NAME_OV9650 "ov9650"
|
||||
#define RK29_CAM_SENSOR_NAME_OV2640 "ov2640"
|
||||
#define RK29_CAM_SENSOR_NAME_OV2655 "ov2655"
|
||||
#define RK29_CAM_SENSOR_NAME_OV2659 "ov2659"
|
||||
#define RK29_CAM_SENSOR_NAME_OV7690 "ov7690"
|
||||
#define RK29_CAM_SENSOR_NAME_OV3640 "ov3640"
|
||||
#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_MT9D113 "mt9d113"
|
||||
#define RK29_CAM_SENSOR_NAME_MT9P111 "mt9p111"
|
||||
#define RK29_CAM_SENSOR_NAME_MT9T111 "mt9t111"
|
||||
#define RK29_CAM_SENSOR_NAME_GT2005 "gt2005"
|
||||
#define RK29_CAM_SENSOR_NAME_GC0307 "gc0307"
|
||||
#define RK29_CAM_SENSOR_NAME_GC0308 "gc0308"
|
||||
#define RK29_CAM_SENSOR_NAME_GC0309 "gc0309"
|
||||
#define RK29_CAM_SENSOR_NAME_GC2015 "gc2015"
|
||||
#define RK29_CAM_SENSOR_NAME_SIV120B "siv120b"
|
||||
#define RK29_CAM_SENSOR_NAME_SID130B "sid130B"
|
||||
#define RK29_CAM_SENSOR_NAME_HI253 "hi253"
|
||||
#define RK29_CAM_SENSOR_NAME_HI704 "hi704"
|
||||
#define RK29_CAM_SENSOR_NAME_NT99250 "nt99250"
|
||||
|
||||
#define ov7675_FULL_RESOLUTION 0x30000 // 0.3 megapixel
|
||||
#define ov9650_FULL_RESOLUTION 0x130000 // 1.3 megapixel
|
||||
#define ov2640_FULL_RESOLUTION 0x200000 // 2 megapixel
|
||||
#define ov2655_FULL_RESOLUTION 0x200000 // 2 megapixel
|
||||
#define ov2659_FULL_RESOLUTION 0x200000 // 2 megapixel
|
||||
#define ov7690_FULL_RESOLUTION 0x300000 // 2 megapixel
|
||||
#define ov3640_FULL_RESOLUTION 0x300000 // 3 megapixel
|
||||
#define ov5640_FULL_RESOLUTION 0x500000 // 5 megapixel
|
||||
#define ov5642_FULL_RESOLUTION 0x500000 // 5 megapixel
|
||||
#define s5k6aa_FULL_RESOLUTION 0x130000 // 1.3 megapixel
|
||||
#define mt9d112_FULL_RESOLUTION 0x200000 // 2 megapixel
|
||||
#define mt9d113_FULL_RESOLUTION 0x200000 // 2 megapixel
|
||||
#define mt9t111_FULL_RESOLUTION 0x300000 // 3 megapixel
|
||||
#define mt9p111_FULL_RESOLUTION 0x500000 // 5 megapixel
|
||||
#define gt2005_FULL_RESOLUTION 0x200000 // 2 megapixel
|
||||
#define gc0308_FULL_RESOLUTION 0x30000 // 0.3 megapixel
|
||||
#define gc0309_FULL_RESOLUTION 0x30000 // 0.3 megapixel
|
||||
#define gc2015_FULL_RESOLUTION 0x200000 // 2 megapixel
|
||||
#define siv120b_FULL_RESOLUTION 0x30000 // 0.3 megapixel
|
||||
#define sid130B_FULL_RESOLUTION 0x200000 // 2 megapixel
|
||||
#define hi253_FULL_RESOLUTION 0x200000 // 2 megapixel
|
||||
#define hi704_FULL_RESOLUTION 0x30000 // 0.3 megapixel
|
||||
#define nt99250_FULL_RESOLUTION 0x200000 // 2 megapixel
|
||||
/*---------------- Camera Sensor Must Define Macro End ------------------------*/
|
||||
|
||||
|
||||
#define RK29_CAM_POWERACTIVE_BITPOS 0x00
|
||||
#define RK29_CAM_POWERACTIVE_MASK (1<<RK29_CAM_POWERACTIVE_BITPOS)
|
||||
#define RK29_CAM_POWERACTIVE_H (0x01<<RK29_CAM_POWERACTIVE_BITPOS)
|
||||
#define RK29_CAM_POWERACTIVE_L (0x00<<RK29_CAM_POWERACTIVE_BITPOS)
|
||||
|
||||
#define RK29_CAM_RESETACTIVE_BITPOS 0x01
|
||||
#define RK29_CAM_RESETACTIVE_MASK (1<<RK29_CAM_RESETACTIVE_BITPOS)
|
||||
#define RK29_CAM_RESETACTIVE_H (0x01<<RK29_CAM_RESETACTIVE_BITPOS)
|
||||
#define RK29_CAM_RESETACTIVE_L (0x00<<RK29_CAM_RESETACTIVE_BITPOS)
|
||||
|
||||
#define RK29_CAM_POWERDNACTIVE_BITPOS 0x02
|
||||
#define RK29_CAM_POWERDNACTIVE_MASK (1<<RK29_CAM_POWERDNACTIVE_BITPOS)
|
||||
#define RK29_CAM_POWERDNACTIVE_H (0x01<<RK29_CAM_POWERDNACTIVE_BITPOS)
|
||||
#define RK29_CAM_POWERDNACTIVE_L (0x00<<RK29_CAM_POWERDNACTIVE_BITPOS)
|
||||
|
||||
#define RK29_CAM_FLASHACTIVE_BITPOS 0x03
|
||||
#define RK29_CAM_FLASHACTIVE_MASK (1<<RK29_CAM_FLASHACTIVE_BITPOS)
|
||||
#define RK29_CAM_FLASHACTIVE_H (0x01<<RK29_CAM_FLASHACTIVE_BITPOS)
|
||||
#define RK29_CAM_FLASHACTIVE_L (0x00<<RK29_CAM_FLASHACTIVE_BITPOS)
|
||||
|
||||
/* v4l2_subdev_core_ops.ioctl ioctl_cmd macro */
|
||||
#define RK29_CAM_SUBDEV_ACTIVATE 0x00
|
||||
#define RK29_CAM_SUBDEV_DEACTIVATE 0x01
|
||||
#define RK29_CAM_SUBDEV_IOREQUEST 0x02
|
||||
#define RK29_CAM_SUBDEV_CB_REGISTER 0x03
|
||||
|
||||
enum rk29camera_ioctrl_cmd
|
||||
{
|
||||
Cam_Power,
|
||||
Cam_Reset,
|
||||
Cam_PowerDown,
|
||||
Cam_Flash
|
||||
};
|
||||
|
||||
enum rk29sensor_power_cmd
|
||||
{
|
||||
Sensor_Reset,
|
||||
Sensor_PowerDown,
|
||||
Sensor_Flash
|
||||
};
|
||||
|
||||
enum rk29camera_flash_cmd
|
||||
{
|
||||
Flash_Off,
|
||||
Flash_On,
|
||||
Flash_Torch
|
||||
};
|
||||
|
||||
struct rk29camera_gpio_res {
|
||||
unsigned int gpio_reset;
|
||||
unsigned int gpio_power;
|
||||
unsigned int gpio_powerdown;
|
||||
unsigned int gpio_flash;
|
||||
unsigned int gpio_flag;
|
||||
unsigned int gpio_init;
|
||||
|
||||
const char *dev_name;
|
||||
};
|
||||
|
||||
struct rk29camera_mem_res {
|
||||
const char *name;
|
||||
unsigned int start;
|
||||
unsigned int size;
|
||||
};
|
||||
struct rk29camera_info {
|
||||
const char *dev_name;
|
||||
unsigned int orientation;
|
||||
struct v4l2_frmivalenum fival[10];
|
||||
};
|
||||
struct rk29camera_platform_data {
|
||||
int (*io_init)(void);
|
||||
int (*io_deinit)(int sensor);
|
||||
int (*sensor_ioctrl)(struct device *dev,enum rk29camera_ioctrl_cmd cmd,int on);
|
||||
struct rk29camera_gpio_res gpio_res[2];
|
||||
struct rk29camera_mem_res meminfo;
|
||||
struct rk29camera_info info[2];
|
||||
};
|
||||
|
||||
struct rk29camera_platform_ioctl_cb {
|
||||
int (*sensor_power_cb)(struct rk29camera_gpio_res *res, int on);
|
||||
int (*sensor_reset_cb)(struct rk29camera_gpio_res *res, int on);
|
||||
int (*sensor_powerdown_cb)(struct rk29camera_gpio_res *res, int on);
|
||||
int (*sensor_flash_cb)(struct rk29camera_gpio_res *res, int on);
|
||||
};
|
||||
|
||||
typedef struct rk29_camera_sensor_cb {
|
||||
int (*sensor_cb)(void *arg);
|
||||
}rk29_camera_sensor_cb_s;
|
||||
|
||||
#endif /* __ASM_ARCH_CAMERA_H_ */
|
||||
|
||||
|
|
@ -54,317 +54,6 @@
|
|||
|
||||
#define RK30_FB0_MEM_SIZE 8*SZ_1M
|
||||
|
||||
#ifdef CONFIG_VIDEO_RK
|
||||
/*---------------- Camera Sensor Macro Define Begin ------------------------*/
|
||||
/*---------------- Camera Sensor Configuration Macro Begin ------------------------*/
|
||||
#define CONFIG_SENSOR_0 RK_CAM_SENSOR_OV2659//RK_CAM_SENSOR_OV5642 /* back camera sensor */
|
||||
#define CONFIG_SENSOR_IIC_ADDR_0 0x60//0x78
|
||||
#define CONFIG_SENSOR_IIC_ADAPTER_ID_0 1
|
||||
#define CONFIG_SENSOR_CIF_INDEX_0 0
|
||||
#define CONFIG_SENSOR_ORIENTATION_0 90
|
||||
#define CONFIG_SENSOR_POWER_PIN_0 INVALID_GPIO
|
||||
#define CONFIG_SENSOR_RESET_PIN_0 INVALID_GPIO
|
||||
#define CONFIG_SENSOR_POWERDN_PIN_0 INVALID_GPIO
|
||||
#define CONFIG_SENSOR_FALSH_PIN_0 INVALID_GPIO
|
||||
#define CONFIG_SENSOR_POWERACTIVE_LEVEL_0 RK_CAM_POWERACTIVE_L
|
||||
#define CONFIG_SENSOR_RESETACTIVE_LEVEL_0 RK_CAM_RESETACTIVE_L
|
||||
#define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_0 RK_CAM_POWERDNACTIVE_H
|
||||
#define CONFIG_SENSOR_FLASHACTIVE_LEVEL_0 RK_CAM_FLASHACTIVE_L
|
||||
|
||||
#define CONFIG_SENSOR_QCIF_FPS_FIXED_0 15000
|
||||
#define CONFIG_SENSOR_QVGA_FPS_FIXED_0 15000
|
||||
#define CONFIG_SENSOR_CIF_FPS_FIXED_0 15000
|
||||
#define CONFIG_SENSOR_VGA_FPS_FIXED_0 15000
|
||||
#define CONFIG_SENSOR_480P_FPS_FIXED_0 15000
|
||||
#define CONFIG_SENSOR_SVGA_FPS_FIXED_0 15000
|
||||
#define CONFIG_SENSOR_720P_FPS_FIXED_0 30000
|
||||
|
||||
#define CONFIG_SENSOR_1 RK_CAM_SENSOR_OV2659 /* front camera sensor */
|
||||
#define CONFIG_SENSOR_IIC_ADDR_1 0x60
|
||||
#define CONFIG_SENSOR_IIC_ADAPTER_ID_1 1
|
||||
#define CONFIG_SENSOR_CIF_INDEX_1 1
|
||||
#define CONFIG_SENSOR_ORIENTATION_1 270
|
||||
#define CONFIG_SENSOR_POWER_PIN_1 INVALID_GPIO
|
||||
#define CONFIG_SENSOR_RESET_PIN_1 INVALID_GPIO
|
||||
#define CONFIG_SENSOR_POWERDN_PIN_1 INVALID_GPIO
|
||||
#define CONFIG_SENSOR_FALSH_PIN_1 INVALID_GPIO
|
||||
#define CONFIG_SENSOR_POWERACTIVE_LEVEL_1 RK_CAM_POWERACTIVE_L
|
||||
#define CONFIG_SENSOR_RESETACTIVE_LEVEL_1 RK_CAM_RESETACTIVE_L
|
||||
#define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_1 RK_CAM_POWERDNACTIVE_H
|
||||
#define CONFIG_SENSOR_FLASHACTIVE_LEVEL_1 RK_CAM_FLASHACTIVE_L
|
||||
|
||||
#define CONFIG_SENSOR_QCIF_FPS_FIXED_1 15000
|
||||
#define CONFIG_SENSOR_QVGA_FPS_FIXED_1 15000
|
||||
#define CONFIG_SENSOR_CIF_FPS_FIXED_1 15000
|
||||
#define CONFIG_SENSOR_VGA_FPS_FIXED_1 15000
|
||||
#define CONFIG_SENSOR_480P_FPS_FIXED_1 15000
|
||||
#define CONFIG_SENSOR_SVGA_FPS_FIXED_1 15000
|
||||
#define CONFIG_SENSOR_720P_FPS_FIXED_1 30000
|
||||
|
||||
#define CONFIG_USE_CIF_0 1
|
||||
#define CONFIG_USE_CIF_1 0
|
||||
#endif //#ifdef CONFIG_VIDEO_RK29
|
||||
/*---------------- Camera Sensor Configuration Macro End------------------------*/
|
||||
#include "../../../drivers/media/video/rk_camera.c"
|
||||
/*---------------- Camera Sensor Macro Define End ---------*/
|
||||
|
||||
#define PMEM_CAM_SIZE PMEM_CAM_NECESSARY
|
||||
#ifdef CONFIG_VIDEO_RK_WORK_IPP
|
||||
#define MEM_CAMIPP_SIZE PMEM_CAMIPP_NECESSARY
|
||||
#else
|
||||
#define MEM_CAMIPP_SIZE 0
|
||||
#endif
|
||||
/*****************************************************************************************
|
||||
* camera devices
|
||||
* author: ddl@rock-chips.com
|
||||
*****************************************************************************************/
|
||||
#ifdef CONFIG_VIDEO_RK
|
||||
#define CONFIG_SENSOR_POWER_IOCTL_USR 0
|
||||
#define CONFIG_SENSOR_RESET_IOCTL_USR 0
|
||||
#define CONFIG_SENSOR_POWERDOWN_IOCTL_USR 0
|
||||
#define CONFIG_SENSOR_FLASH_IOCTL_USR 0
|
||||
|
||||
#if CONFIG_SENSOR_POWER_IOCTL_USR
|
||||
static int sensor_power_usr_cb (struct rkcamera_gpio_res *res,int on)
|
||||
{
|
||||
#error "CONFIG_SENSOR_POWER_IOCTL_USR is 1, sensor_power_usr_cb function must be writed!!";
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CONFIG_SENSOR_RESET_IOCTL_USR
|
||||
static int sensor_reset_usr_cb (struct rkcamera_gpio_res *res,int on)
|
||||
{
|
||||
#error "CONFIG_SENSOR_RESET_IOCTL_USR is 1, sensor_reset_usr_cb function must be writed!!";
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CONFIG_SENSOR_POWERDOWN_IOCTL_USR
|
||||
static int sensor_powerdown_usr_cb (struct rkcamera_gpio_res *res,int on)
|
||||
{
|
||||
#error "CONFIG_SENSOR_POWERDOWN_IOCTL_USR is 1, sensor_powerdown_usr_cb function must be writed!!";
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CONFIG_SENSOR_FLASH_IOCTL_USR
|
||||
static int sensor_flash_usr_cb (struct rkcamera_gpio_res *res,int on)
|
||||
{
|
||||
#error "CONFIG_SENSOR_FLASH_IOCTL_USR is 1, sensor_flash_usr_cb function must be writed!!";
|
||||
}
|
||||
#endif
|
||||
|
||||
static struct rkcamera_platform_ioctl_cb sensor_ioctl_cb = {
|
||||
#if CONFIG_SENSOR_POWER_IOCTL_USR
|
||||
.sensor_power_cb = sensor_power_usr_cb,
|
||||
#else
|
||||
.sensor_power_cb = NULL,
|
||||
#endif
|
||||
|
||||
#if CONFIG_SENSOR_RESET_IOCTL_USR
|
||||
.sensor_reset_cb = sensor_reset_usr_cb,
|
||||
#else
|
||||
.sensor_reset_cb = NULL,
|
||||
#endif
|
||||
|
||||
#if CONFIG_SENSOR_POWERDOWN_IOCTL_USR
|
||||
.sensor_powerdown_cb = sensor_powerdown_usr_cb,
|
||||
#else
|
||||
.sensor_powerdown_cb = NULL,
|
||||
#endif
|
||||
|
||||
#if CONFIG_SENSOR_FLASH_IOCTL_USR
|
||||
.sensor_flash_cb = sensor_flash_usr_cb,
|
||||
#else
|
||||
.sensor_flash_cb = NULL,
|
||||
#endif
|
||||
};
|
||||
static struct reginfo_t rk_init_data_sensor_reg_0[] =
|
||||
{
|
||||
{0x3000, 0x0f,0,0},
|
||||
{0x3001, 0xff,0,0},
|
||||
{0x3002, 0xff,0,0},
|
||||
//{0x0100, 0x01}, //software sleep : Sensor vsync singal may not output if haven't sleep the sensor when transfer the array
|
||||
{0x3633, 0x3d,0,0},
|
||||
{0x3620, 0x02,0,0},
|
||||
{0x3631, 0x11,0,0},
|
||||
{0x3612, 0x04,0,0},
|
||||
{0x3630, 0x20,0,0},
|
||||
{0x4702, 0x02,0,0},
|
||||
{0x370c, 0x34,0,0},
|
||||
{0x3004, 0x10,0,0},
|
||||
{0x3005, 0x18,0,0},
|
||||
{0x3800, 0x00,0,0},
|
||||
{0x3801, 0x00,0,0},
|
||||
{0x3802, 0x00,0,0},
|
||||
{0x3803, 0x00,0,0},
|
||||
{0x3804, 0x06,0,0},
|
||||
{0x3805, 0x5f,0,0},
|
||||
{0x3806, 0x04,0,0},
|
||||
{0x3807, 0xb7,0,0},
|
||||
{0x3808, 0x03,0,0},
|
||||
{0x3809, 0x20,0,0},
|
||||
{0x380a, 0x02,0,0},
|
||||
{0x380b, 0x58,0,0},
|
||||
{0x380c, 0x05,0,0},
|
||||
{0x380d, 0x14,0,0},
|
||||
{0x380e, 0x02,0,0},
|
||||
{0x380f, 0x68,0,0},
|
||||
{0x3811, 0x08,0,0},
|
||||
{0x3813, 0x02,0,0},
|
||||
{0x3814, 0x31,0,0},
|
||||
{0x3815, 0x31,0,0},
|
||||
{0x3a02, 0x02,0,0},
|
||||
{0x3a03, 0x68,0,0},
|
||||
{0x3a08, 0x00,0,0},
|
||||
{0x3a09, 0x5c,0,0},
|
||||
{0x3a0a, 0x00,0,0},
|
||||
{0x3a0b, 0x4d,0,0},
|
||||
{0x3a0d, 0x08,0,0},
|
||||
{0x3a0e, 0x06,0,0},
|
||||
{0x3a14, 0x02,0,0},
|
||||
{0x3a15, 0x28,0,0},
|
||||
{0x4708, 0x01,0,0},
|
||||
{0x3623, 0x00,0,0},
|
||||
{0x3634, 0x76,0,0},
|
||||
{0x3701, 0x44,0,0},
|
||||
{0x3702, 0x18,0,0},
|
||||
{0x3703, 0x24,0,0},
|
||||
{0x3704, 0x24,0,0},
|
||||
{0x3705, 0x0c,0,0},
|
||||
{0x3820, 0x81,0,0},
|
||||
{0x3821, 0x01,0,0},
|
||||
{0x370a, 0x52,0,0},
|
||||
{0x4608, 0x00,0,0},
|
||||
{0x4609, 0x80,0,0},
|
||||
{0x4300, 0x32,0,0},
|
||||
{0x5086, 0x02,0,0},
|
||||
{0x5000, 0xfb,0,0},
|
||||
{0x5001, 0x1f,0,0},
|
||||
{0x5002, 0x00,0,0},
|
||||
{0x5025, 0x0e,0,0},
|
||||
{0x5026, 0x18,0,0},
|
||||
{0x5027, 0x34,0,0},
|
||||
{0x5028, 0x4c,0,0},
|
||||
{0x5029, 0x62,0,0},
|
||||
{0x502a, 0x74,0,0},
|
||||
{0x502b, 0x85,0,0},
|
||||
{0x502c, 0x92,0,0},
|
||||
{0x502d, 0x9e,0,0},
|
||||
{0x502e, 0xb2,0,0},
|
||||
{0x502f, 0xc0,0,0},
|
||||
{0x5030, 0xcc,0,0},
|
||||
{0x5031, 0xe0,0,0},
|
||||
{0x5032, 0xee,0,0},
|
||||
{0x5033, 0xf6,0,0},
|
||||
{0x5034, 0x11,0,0},
|
||||
{0x5070, 0x1c,0,0},
|
||||
{0x5071, 0x5b,0,0},
|
||||
{0x5072, 0x05,0,0},
|
||||
{0x5073, 0x20,0,0},
|
||||
{0x5074, 0x94,0,0},
|
||||
{0x5075, 0xb4,0,0},
|
||||
{0x5076, 0xb4,0,0},
|
||||
{0x5077, 0xaf,0,0},
|
||||
{0x5078, 0x05,0,0},
|
||||
{0x5079, 0x98,0,0},
|
||||
{0x507a, 0x21,0,0},
|
||||
{0x5035, 0x6a,0,0},
|
||||
{0x5036, 0x11,0,0},
|
||||
{0x5037, 0x92,0,0},
|
||||
{0x5038, 0x21,0,0},
|
||||
|
||||
{0x5039, 0xe1,0,0},
|
||||
{0x503a, 0x01,0,0},
|
||||
{0x503c, 0x05,0,0},
|
||||
{0x503d, 0x08,0,0},
|
||||
{0x503e, 0x08,0,0},
|
||||
{0x503f, 0x64,0,0},
|
||||
{0x5040, 0x58,0,0},
|
||||
{0x5041, 0x2a,0,0},
|
||||
{0x5042, 0xc5,0,0},
|
||||
{0x5043, 0x2e,0,0},
|
||||
{0x5044, 0x3a,0,0},
|
||||
{0x5045, 0x3c,0,0},
|
||||
{0x5046, 0x44,0,0},
|
||||
{0x5047, 0xf8,0,0},
|
||||
{0x5048, 0x08,0,0},
|
||||
{0x5049, 0x70,0,0},
|
||||
{0x504a, 0xf0,0,0},
|
||||
{0x504b, 0xf0,0,0},
|
||||
{0x500c, 0x03,0,0},
|
||||
{0x500d, 0x20,0,0},
|
||||
{0x500e, 0x02,0,0},
|
||||
{0x500f, 0x5c,0,0},
|
||||
{0x5010, 0x48,0,0},
|
||||
{0x5011, 0x00,0,0},
|
||||
{0x5012, 0x66,0,0},
|
||||
{0x5013, 0x03,0,0},
|
||||
{0x5014, 0x30,0,0},
|
||||
{0x5015, 0x02,0,0},
|
||||
{0x5016, 0x7c,0,0},
|
||||
{0x5017, 0x40,0,0},
|
||||
{0x5018, 0x00,0,0},
|
||||
{0x5019, 0x66,0,0},
|
||||
{0x501a, 0x03,0,0},
|
||||
{0x501b, 0x10,0,0},
|
||||
{0x501c, 0x02,0,0},
|
||||
{0x501d, 0x7c,0,0},
|
||||
{0x501e, 0x3a,0,0},
|
||||
{0x501f, 0x00,0,0},
|
||||
{0x5020, 0x66,0,0},
|
||||
{0x506e, 0x44,0,0},
|
||||
{0x5064, 0x08,0,0},
|
||||
{0x5065, 0x10,0,0},
|
||||
{0x5066, 0x12,0,0},
|
||||
{0x5067, 0x02,0,0},
|
||||
{0x506c, 0x08,0,0},
|
||||
{0x506d, 0x10,0,0},
|
||||
{0x506f, 0xa6,0,0},
|
||||
{0x5068, 0x08,0,0},
|
||||
|
||||
|
||||
{0x5069, 0x10,0,0},
|
||||
{0x506a, 0x04,0,0},
|
||||
{0x506b, 0x12,0,0},
|
||||
{0x507e, 0x40,0,0},
|
||||
{0x507f, 0x20,0,0},
|
||||
{0x507b, 0x02,0,0},
|
||||
{0x507a, 0x01,0,0},
|
||||
{0x5084, 0x0c,0,0},
|
||||
{0x5085, 0x3e,0,0},
|
||||
{0x5005, 0x80,0,0},
|
||||
{0x3a0f, 0x30,0,0},
|
||||
{0x3a10, 0x28,0,0},
|
||||
{0x3a1b, 0x32,0,0},
|
||||
{0x3a1e, 0x26,0,0},
|
||||
{0x3a11, 0x60,0,0},
|
||||
{0x3a1f, 0x14,0,0},
|
||||
{0x5060, 0x69,0,0},
|
||||
{0x5061, 0x7d,0,0},
|
||||
{0x5062, 0x7d,0,0},
|
||||
{0x5063, 0x69,0,0},
|
||||
{0x3004, 0x20,0,0},
|
||||
{0x0100, 0x01,0,0},
|
||||
{0x0000, 0x00,0,0}
|
||||
};
|
||||
static struct reginfo_t rk_init_data_sensor_winseqreg_0[] ={
|
||||
{0x0000, 0x00,0,0}
|
||||
};
|
||||
static rk_sensor_user_init_data_s rk_init_data_sensor_0 =
|
||||
{
|
||||
.rk_sensor_init_width = INVALID_VALUE,
|
||||
.rk_sensor_init_height = INVALID_VALUE,
|
||||
.rk_sensor_init_bus_param = INVALID_VALUE,
|
||||
.rk_sensor_init_pixelcode = INVALID_VALUE,
|
||||
.rk_sensor_init_data = rk_init_data_sensor_reg_0,
|
||||
.rk_sensor_init_winseq = NULL,//rk_init_data_sensor_winseqreg_0,
|
||||
.rk_sensor_winseq_size = sizeof(rk_init_data_sensor_winseqreg_0) / sizeof(struct reginfo_t),
|
||||
|
||||
};
|
||||
static rk_sensor_user_init_data_s* rk_init_data_sensor_0_p = &rk_init_data_sensor_0;
|
||||
static rk_sensor_user_init_data_s* rk_init_data_sensor_1_p = NULL;
|
||||
#include "../../../drivers/media/video/rk_camera.c"
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_TOUCHSCREEN_GT8XX)
|
||||
#define TOUCH_RESET_PIN RK30_PIN4_PD0
|
||||
|
|
@ -1033,25 +722,6 @@ static void __init rk30_reserve(void)
|
|||
resource_fb[2].start = board_mem_reserve_add("fb2",RK30_FB0_MEM_SIZE);
|
||||
resource_fb[2].end = resource_fb[2].start + RK30_FB0_MEM_SIZE - 1;
|
||||
#endif
|
||||
|
||||
#if (MEM_CAMIPP_SIZE != 0)
|
||||
#if CONFIG_USE_CIF_0
|
||||
rk_camera_platform_data_host_0.meminfo.name = "camera_ipp_mem_0";
|
||||
rk_camera_platform_data_host_0.meminfo.start = board_mem_reserve_add("camera_ipp_mem_0",MEM_CAMIPP_SIZE);
|
||||
rk_camera_platform_data_host_0.meminfo.size= MEM_CAMIPP_SIZE;
|
||||
#endif
|
||||
#if CONFIG_USE_CIF_1
|
||||
rk_camera_platform_data_host_1.meminfo.name = "camera_ipp_mem_1";
|
||||
rk_camera_platform_data_host_1.meminfo.start =board_mem_reserve_add("camera_ipp_mem_1",MEM_CAMIPP_SIZE);
|
||||
rk_camera_platform_data_host_1.meminfo.size= MEM_CAMIPP_SIZE;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (PMEM_CAM_SIZE != 0)
|
||||
android_pmem_cam_pdata.start = board_mem_reserve_add("camera_pmem",PMEM_CAM_SIZE);
|
||||
android_pmem_cam_pdata.size = PMEM_CAM_SIZE;
|
||||
#endif
|
||||
|
||||
board_mem_reserved();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -502,18 +502,6 @@ static struct platform_device device_i2c4 = {
|
|||
|
||||
static void __init rk30_init_i2c(void)
|
||||
{
|
||||
//config i2c gpio
|
||||
int err = 0;
|
||||
err = gpio_request(RK30_PIN3_PC1, "i2c");
|
||||
if (err) {
|
||||
gpio_free(RK30_PIN3_PC1);
|
||||
printk("-------request RK30_PIN3_PC1 fail--------\n");
|
||||
//return ;
|
||||
}
|
||||
//
|
||||
gpio_direction_output(RK30_PIN3_PC1, GPIO_HIGH);
|
||||
gpio_set_value(RK30_PIN3_PC1, GPIO_HIGH);
|
||||
|
||||
#ifdef CONFIG_I2C0_RK30
|
||||
platform_device_register(&device_i2c0);
|
||||
#endif
|
||||
|
|
@ -985,9 +973,7 @@ static void __init rk30_init_sdmmc(void)
|
|||
platform_device_register(&device_sdmmc1);
|
||||
#endif
|
||||
}
|
||||
#if CONFIG_VIDEO_RK
|
||||
extern void rk_register_camera_devices();
|
||||
#endif
|
||||
|
||||
static int __init rk30_init_devices(void)
|
||||
{
|
||||
rk30_init_dma();
|
||||
|
|
@ -1017,9 +1003,7 @@ static int __init rk30_init_devices(void)
|
|||
rk_serial_debug_init(RK30_UART1_PHYS, IRQ_UART1, IRQ_UART_SIGNAL, -1);
|
||||
#endif
|
||||
rk30_init_i2s();
|
||||
#if CONFIG_VIDEO_RK
|
||||
rk_register_camera_devices();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
arch_initcall(rk30_init_devices);
|
||||
|
|
|
|||
|
|
@ -1,222 +0,0 @@
|
|||
/*
|
||||
camera.h - PXA camera driver header file
|
||||
|
||||
Copyright (C) 2003, Intel Corporation
|
||||
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 as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
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.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __ASM_ARCH_CAMERA_H_
|
||||
#define __ASM_ARCH_CAMERA_H_
|
||||
|
||||
#include <linux/videodev2.h>
|
||||
#include <media/soc_camera.h>
|
||||
#define RK_CAM_DRV_NAME "rkxx-camera"
|
||||
#define RK_CAM_PLATFORM_DEV_ID_0 33
|
||||
#define RK_CAM_PLATFORM_DEV_ID_1 (RK_CAM_PLATFORM_DEV_ID_0+1)
|
||||
#define INVALID_GPIO -1
|
||||
#define INVALID_VALUE -1
|
||||
#define RK_CAM_IO_SUCCESS 0
|
||||
#define RK_CAM_EIO_INVALID -1
|
||||
#define RK_CAM_EIO_REQUESTFAIL -2
|
||||
|
||||
#define RK_CAM_NUM_PER_HOST 2
|
||||
/*---------------- Camera Sensor Must Define Macro Begin ------------------------*/
|
||||
#define RK_CAM_SENSOR_OV7675 ov7675
|
||||
#define RK_CAM_SENSOR_OV9650 ov9650
|
||||
#define RK_CAM_SENSOR_OV2640 ov2640
|
||||
#define RK_CAM_SENSOR_OV2655 ov2655
|
||||
#define RK_CAM_SENSOR_OV2659 ov2659
|
||||
#define RK_CAM_SENSOR_OV7690 ov7690
|
||||
#define RK_CAM_SENSOR_OV3640 ov3640
|
||||
#define RK_CAM_SENSOR_OV5640 ov5640
|
||||
#define RK_CAM_SENSOR_OV5642 ov5642
|
||||
#define RK_CAM_SENSOR_S5K6AA s5k6aa
|
||||
#define RK_CAM_SENSOR_MT9D112 mt9d112
|
||||
#define RK_CAM_SENSOR_MT9D113 mt9d113
|
||||
#define RK_CAM_SENSOR_MT9P111 mt9p111
|
||||
#define RK_CAM_SENSOR_MT9T111 mt9t111
|
||||
#define RK_CAM_SENSOR_GT2005 gt2005
|
||||
#define RK_CAM_SENSOR_GC0307 gc0307
|
||||
#define RK_CAM_SENSOR_GC0308 gc0308
|
||||
#define RK_CAM_SENSOR_GC0309 gc0309
|
||||
#define RK_CAM_SENSOR_GC2015 gc2015
|
||||
#define RK_CAM_SENSOR_SIV120B siv120b
|
||||
#define RK_CAM_SENSOR_SID130B sid130B
|
||||
#define RK_CAM_SENSOR_HI253 hi253
|
||||
#define RK_CAM_SENSOR_HI704 hi704
|
||||
#define RK_CAM_SENSOR_NT99250 nt99250
|
||||
|
||||
#define RK_CAM_SENSOR_NAME_OV7675 "ov7675"
|
||||
#define RK_CAM_SENSOR_NAME_OV9650 "ov9650"
|
||||
#define RK_CAM_SENSOR_NAME_OV2640 "ov2640"
|
||||
#define RK_CAM_SENSOR_NAME_OV2655 "ov2655"
|
||||
#define RK_CAM_SENSOR_NAME_OV2659 "ov2659"
|
||||
#define RK_CAM_SENSOR_NAME_OV7690 "ov7690"
|
||||
#define RK_CAM_SENSOR_NAME_OV3640 "ov3640"
|
||||
#define RK_CAM_SENSOR_NAME_OV5640 "ov5640"
|
||||
#define RK_CAM_SENSOR_NAME_OV5642 "ov5642"
|
||||
#define RK_CAM_SENSOR_NAME_S5K6AA "s5k6aa"
|
||||
#define RK_CAM_SENSOR_NAME_MT9D112 "mt9d112"
|
||||
#define RK_CAM_SENSOR_NAME_MT9D113 "mt9d113"
|
||||
#define RK_CAM_SENSOR_NAME_MT9P111 "mt9p111"
|
||||
#define RK_CAM_SENSOR_NAME_MT9T111 "mt9t111"
|
||||
#define RK_CAM_SENSOR_NAME_GT2005 "gt2005"
|
||||
#define RK_CAM_SENSOR_NAME_GC0307 "gc0307"
|
||||
#define RK_CAM_SENSOR_NAME_GC0308 "gc0308"
|
||||
#define RK_CAM_SENSOR_NAME_GC0309 "gc0309"
|
||||
#define RK_CAM_SENSOR_NAME_GC2015 "gc2015"
|
||||
#define RK_CAM_SENSOR_NAME_SIV120B "siv120b"
|
||||
#define RK_CAM_SENSOR_NAME_SID130B "sid130B"
|
||||
#define RK_CAM_SENSOR_NAME_HI253 "hi253"
|
||||
#define RK_CAM_SENSOR_NAME_HI704 "hi704"
|
||||
#define RK_CAM_SENSOR_NAME_NT99250 "nt99250"
|
||||
|
||||
#define ov7675_FULL_RESOLUTION 0x30000 // 0.3 megapixel
|
||||
#define ov9650_FULL_RESOLUTION 0x130000 // 1.3 megapixel
|
||||
#define ov2640_FULL_RESOLUTION 0x200000 // 2 megapixel
|
||||
#define ov2655_FULL_RESOLUTION 0x200000 // 2 megapixel
|
||||
#define ov2659_FULL_RESOLUTION 0x200000 // 2 megapixel
|
||||
#define ov7690_FULL_RESOLUTION 0x300000 // 2 megapixel
|
||||
#define ov3640_FULL_RESOLUTION 0x300000 // 3 megapixel
|
||||
#define ov5640_FULL_RESOLUTION 0x500000 // 5 megapixel
|
||||
#define ov5642_FULL_RESOLUTION 0x500000 // 5 megapixel
|
||||
#define s5k6aa_FULL_RESOLUTION 0x130000 // 1.3 megapixel
|
||||
#define mt9d112_FULL_RESOLUTION 0x200000 // 2 megapixel
|
||||
#define mt9d113_FULL_RESOLUTION 0x200000 // 2 megapixel
|
||||
#define mt9t111_FULL_RESOLUTION 0x300000 // 3 megapixel
|
||||
#define mt9p111_FULL_RESOLUTION 0x500000 // 5 megapixel
|
||||
#define gt2005_FULL_RESOLUTION 0x200000 // 2 megapixel
|
||||
#define gc0308_FULL_RESOLUTION 0x30000 // 0.3 megapixel
|
||||
#define gc0309_FULL_RESOLUTION 0x30000 // 0.3 megapixel
|
||||
#define gc2015_FULL_RESOLUTION 0x200000 // 2 megapixel
|
||||
#define siv120b_FULL_RESOLUTION 0x30000 // 0.3 megapixel
|
||||
#define sid130B_FULL_RESOLUTION 0x200000 // 2 megapixel
|
||||
#define hi253_FULL_RESOLUTION 0x200000 // 2 megapixel
|
||||
#define hi704_FULL_RESOLUTION 0x30000 // 0.3 megapixel
|
||||
#define nt99250_FULL_RESOLUTION 0x200000 // 2 megapixel
|
||||
/*---------------- Camera Sensor Must Define Macro End ------------------------*/
|
||||
|
||||
|
||||
#define RK_CAM_POWERACTIVE_BITPOS 0x00
|
||||
#define RK_CAM_POWERACTIVE_MASK (1<<RK_CAM_POWERACTIVE_BITPOS)
|
||||
#define RK_CAM_POWERACTIVE_H (0x01<<RK_CAM_POWERACTIVE_BITPOS)
|
||||
#define RK_CAM_POWERACTIVE_L (0x00<<RK_CAM_POWERACTIVE_BITPOS)
|
||||
|
||||
#define RK_CAM_RESETACTIVE_BITPOS 0x01
|
||||
#define RK_CAM_RESETACTIVE_MASK (1<<RK_CAM_RESETACTIVE_BITPOS)
|
||||
#define RK_CAM_RESETACTIVE_H (0x01<<RK_CAM_RESETACTIVE_BITPOS)
|
||||
#define RK_CAM_RESETACTIVE_L (0x00<<RK_CAM_RESETACTIVE_BITPOS)
|
||||
|
||||
#define RK_CAM_POWERDNACTIVE_BITPOS 0x02
|
||||
#define RK_CAM_POWERDNACTIVE_MASK (1<<RK_CAM_POWERDNACTIVE_BITPOS)
|
||||
#define RK_CAM_POWERDNACTIVE_H (0x01<<RK_CAM_POWERDNACTIVE_BITPOS)
|
||||
#define RK_CAM_POWERDNACTIVE_L (0x00<<RK_CAM_POWERDNACTIVE_BITPOS)
|
||||
|
||||
#define RK_CAM_FLASHACTIVE_BITPOS 0x03
|
||||
#define RK_CAM_FLASHACTIVE_MASK (1<<RK_CAM_FLASHACTIVE_BITPOS)
|
||||
#define RK_CAM_FLASHACTIVE_H (0x01<<RK_CAM_FLASHACTIVE_BITPOS)
|
||||
#define RK_CAM_FLASHACTIVE_L (0x00<<RK_CAM_FLASHACTIVE_BITPOS)
|
||||
|
||||
/* v4l2_subdev_core_ops.ioctl ioctl_cmd macro */
|
||||
#define RK_CAM_SUBDEV_ACTIVATE 0x00
|
||||
#define RK_CAM_SUBDEV_DEACTIVATE 0x01
|
||||
#define RK_CAM_SUBDEV_IOREQUEST 0x02
|
||||
#define RK_CAM_SUBDEV_CB_REGISTER 0x03
|
||||
|
||||
enum rkcamera_ioctrl_cmd
|
||||
{
|
||||
Cam_Power,
|
||||
Cam_Reset,
|
||||
Cam_PowerDown,
|
||||
Cam_Flash
|
||||
};
|
||||
|
||||
enum rksensor_power_cmd
|
||||
{
|
||||
Sensor_Reset,
|
||||
Sensor_PowerDown,
|
||||
Sensor_Flash
|
||||
};
|
||||
|
||||
enum rkcamera_flash_cmd
|
||||
{
|
||||
Flash_Off,
|
||||
Flash_On,
|
||||
Flash_Torch
|
||||
};
|
||||
|
||||
struct rkcamera_gpio_res {
|
||||
unsigned int gpio_reset;
|
||||
unsigned int gpio_power;
|
||||
unsigned int gpio_powerdown;
|
||||
unsigned int gpio_flash;
|
||||
unsigned int gpio_flag;
|
||||
unsigned int gpio_init;
|
||||
const char *dev_name;
|
||||
};
|
||||
|
||||
struct rkcamera_mem_res {
|
||||
const char *name;
|
||||
unsigned int start;
|
||||
unsigned int size;
|
||||
};
|
||||
struct rkcamera_info {
|
||||
const char *dev_name;
|
||||
unsigned int orientation;
|
||||
struct v4l2_frmivalenum fival[10];
|
||||
};
|
||||
|
||||
struct reginfo_t
|
||||
{
|
||||
u16 reg;
|
||||
u16 val;
|
||||
u16 reg_len;
|
||||
u16 rev;
|
||||
};
|
||||
typedef struct rk_sensor_user_init_data{
|
||||
int rk_sensor_init_width;
|
||||
int rk_sensor_init_height;
|
||||
unsigned long rk_sensor_init_bus_param;
|
||||
enum v4l2_mbus_pixelcode rk_sensor_init_pixelcode;
|
||||
struct reginfo_t * rk_sensor_init_data;
|
||||
int rk_sensor_winseq_size;
|
||||
struct reginfo_t * rk_sensor_init_winseq;
|
||||
}rk_sensor_user_init_data_s;
|
||||
struct rkcamera_platform_data {
|
||||
int (*io_init)(int);
|
||||
int (*io_deinit)(int);
|
||||
int (*sensor_ioctrl)(struct device *dev,enum rkcamera_ioctrl_cmd cmd,int on);
|
||||
rk_sensor_user_init_data_s* sensor_init_data[RK_CAM_NUM_PER_HOST];
|
||||
struct rkcamera_gpio_res gpio_res[RK_CAM_NUM_PER_HOST];
|
||||
struct rkcamera_mem_res meminfo;
|
||||
struct rkcamera_info info[RK_CAM_NUM_PER_HOST];
|
||||
};
|
||||
|
||||
struct rkcamera_platform_ioctl_cb {
|
||||
int (*sensor_power_cb)(struct rkcamera_gpio_res *res, int on);
|
||||
int (*sensor_reset_cb)(struct rkcamera_gpio_res *res, int on);
|
||||
int (*sensor_powerdown_cb)(struct rkcamera_gpio_res *res, int on);
|
||||
int (*sensor_flash_cb)(struct rkcamera_gpio_res *res, int on);
|
||||
};
|
||||
|
||||
typedef struct rk_camera_sensor_cb {
|
||||
int (*sensor_cb)(void *arg);
|
||||
}rk_camera_sensor_cb_s;
|
||||
|
||||
|
||||
#endif /* __ASM_ARCH_CAMERA_H_ */
|
||||
|
||||
|
|
@ -1136,52 +1136,52 @@ config VIDEO_OMAP2
|
|||
---help---
|
||||
This is a v4l2 driver for the TI OMAP2 camera capture interface
|
||||
|
||||
config VIDEO_RK
|
||||
tristate "RKXX Camera Sensor Interface driver"
|
||||
depends on VIDEO_DEV && ARCH_RK30 && SOC_CAMERA && HAS_DMA
|
||||
config VIDEO_RK29
|
||||
tristate "RK29XX Camera Sensor Interface driver"
|
||||
depends on VIDEO_DEV && ARCH_RK29 && SOC_CAMERA && HAS_DMA
|
||||
select VIDEOBUF_DMA_CONTIG
|
||||
---help---
|
||||
This is a v4l2 driver for the RKXX Camera Sensor Interface
|
||||
This is a v4l2 driver for the RK29XX Camera Sensor Interface
|
||||
|
||||
choice
|
||||
prompt "RKXX Camera Sensor Interface Work Mode"
|
||||
depends on VIDEO_RK
|
||||
default VIDEO_RK_WORK_ONEFRAME
|
||||
prompt "RK29XX Camera Sensor Interface Work Mode"
|
||||
depends on VIDEO_RK29
|
||||
default VIDEO_RK29_WORK_ONEFRAME
|
||||
---help---
|
||||
RK Camera Sensor Interface(CIF) can work in 2 modes, ie:OneFrame,PingPong.
|
||||
RK29 Camera Sensor Interface(VIP) can work in 2 modes, ie:OneFrame,PingPong.
|
||||
|
||||
config VIDEO_RK_WORK_ONEFRAME
|
||||
bool "CIF OneFrame Mode"
|
||||
config VIDEO_RK29_WORK_ONEFRAME
|
||||
bool "VIP OneFrame Mode"
|
||||
|
||||
config VIDEO_RK_WORK_PINGPONG
|
||||
bool "CIF PingPong Mode"
|
||||
config VIDEO_RK29_WORK_PINGPONG
|
||||
bool "VIP PingPong Mode"
|
||||
|
||||
endchoice
|
||||
|
||||
choice
|
||||
prompt "RKXX camera sensor interface work with IPP "
|
||||
depends on VIDEO_RK && RK29_IPP
|
||||
default VIDEO_RK_WORK_IPP
|
||||
prompt "RK29XX camera sensor interface work with IPP "
|
||||
depends on VIDEO_RK29 && RK29_IPP
|
||||
default VIDEO_RK29_WORK_IPP
|
||||
---help---
|
||||
RK Camera Sensor Interface(CIF) can work with IPP or not IPP
|
||||
RK29 Camera Sensor Interface(VIP) can work with IPP or not IPP
|
||||
|
||||
config VIDEO_RK_WORK_IPP
|
||||
bool "CIF work with IPP"
|
||||
config VIDEO_RK29_WORK_IPP
|
||||
bool "VIP work with IPP"
|
||||
|
||||
config VIDEO_RK_WORK_NOT_IPP
|
||||
bool "CIF don't work with IPP"
|
||||
config VIDEO_RK29_WORK_NOT_IPP
|
||||
bool "VIP don't work with IPP"
|
||||
|
||||
endchoice
|
||||
choice
|
||||
prompt "RKXX camera digital zoom with IPP "
|
||||
depends on VIDEO_RK && RK29_IPP && VIDEO_RK_WORK_IPP
|
||||
prompt "RK29XX camera digital zoom with IPP "
|
||||
depends on VIDEO_RK29 && RK29_IPP && VIDEO_RK29_WORK_IPP
|
||||
default VIDEO_RK29_DIGITALZOOM_IPP_ON
|
||||
---help---
|
||||
RK Camera digital zoom with IPP
|
||||
config VIDEO_RK_DIGITALZOOM_IPP_ON
|
||||
RK29 Camera digital zoom with IPP
|
||||
config VIDEO_RK29_DIGITALZOOM_IPP_ON
|
||||
bool "Digital zoom with IPP on"
|
||||
|
||||
config VIDEO_RK_DIGITALZOOM_IPP_OFF
|
||||
config VIDEO_RK29_DIGITALZOOM_IPP_OFF
|
||||
bool "Digital zoom with IPP off"
|
||||
endchoice
|
||||
|
||||
|
|
|
|||
|
|
@ -189,8 +189,8 @@ obj-$(CONFIG_VIDEO_MX1) += mx1_camera.o
|
|||
obj-$(CONFIG_VIDEO_MX2) += mx2_camera.o
|
||||
obj-$(CONFIG_VIDEO_MX3) += mx3_camera.o
|
||||
obj-$(CONFIG_VIDEO_PXA27x) += pxa_camera.o
|
||||
obj-$(CONFIG_VIDEO_RK_WORK_ONEFRAME) += rk_camera_oneframe.o
|
||||
obj-$(CONFIG_VIDEO_RK_WORK_PINGPONG) += rk_camera_pingpong.o
|
||||
obj-$(CONFIG_VIDEO_RK29_WORK_ONEFRAME) += rk29_camera_oneframe.o
|
||||
obj-$(CONFIG_VIDEO_RK29_WORK_PINGPONG) += rk29_camera_pingpong.o
|
||||
obj-$(CONFIG_VIDEO_RK29XX_VOUT) += rk29xx/
|
||||
obj-$(CONFIG_VIDEO_SH_MOBILE_CSI2) += sh_mobile_csi2.o
|
||||
obj-$(CONFIG_VIDEO_SH_MOBILE_CEU) += sh_mobile_ceu_camera.o
|
||||
|
|
|
|||
122
drivers/media/video/gc0307.c
Normal file → Executable file
122
drivers/media/video/gc0307.c
Normal file → Executable file
|
|
@ -20,8 +20,8 @@ o* Driver for MT9M001 CMOS Image Sensor from Micron
|
|||
#include <media/v4l2-common.h>
|
||||
#include <media/v4l2-chip-ident.h>
|
||||
#include <media/soc_camera.h>
|
||||
#include <mach/rk_camera.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <mach/rk29_camera.h>
|
||||
|
||||
static int debug;
|
||||
module_param(debug, int, S_IRUGO|S_IWUSR);
|
||||
|
||||
|
|
@ -44,18 +44,17 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define MAX(x,y) ((x>y) ? x: y)
|
||||
|
||||
/* Sensor Driver Configuration */
|
||||
#define SENSOR_NAME RK_CAM_SENSOR_GC0307
|
||||
#define SENSOR_NAME RK29_CAM_SENSOR_GC0307
|
||||
#define SENSOR_V4L2_IDENT V4L2_IDENT_GC0307
|
||||
#define SENSOR_ID 0x99
|
||||
#define SENSOR_MIN_WIDTH 640//176
|
||||
#define SENSOR_MIN_HEIGHT 480//144
|
||||
#define SENSOR_MAX_WIDTH 800//1600
|
||||
#define SENSOR_MAX_HEIGHT 600//1200
|
||||
#define SENSOR_INIT_WIDTH sensor_init_width /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT sensor_init_height
|
||||
#define SENSOR_INIT_WINSEQADR sensor_init_winseq_p
|
||||
#define SENSOR_INIT_PIXFMT sensor_init_pixelcode
|
||||
#define SENSOR_BUS_PARAM sensor_init_busparam
|
||||
#define SENSOR_INIT_WIDTH 640 /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT 480
|
||||
#define SENSOR_INIT_WINSEQADR sensor_vga
|
||||
#define SENSOR_INIT_PIXFMT V4L2_MBUS_FMT_YUYV8_2X8
|
||||
|
||||
#define CONFIG_SENSOR_WhiteBalance 1
|
||||
#define CONFIG_SENSOR_Brightness 0
|
||||
|
|
@ -75,6 +74,10 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define CONFIG_SENSOR_I2C_NOSCHED 0
|
||||
#define CONFIG_SENSOR_I2C_RDWRCHK 0
|
||||
|
||||
#define SENSOR_BUS_PARAM (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING |\
|
||||
SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW |\
|
||||
SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ)
|
||||
|
||||
#define COLOR_TEMPERATURE_CLOUDY_DN 6500
|
||||
#define COLOR_TEMPERATURE_CLOUDY_UP 8000
|
||||
#define COLOR_TEMPERATURE_CLEARDAY_DN 5000
|
||||
|
|
@ -97,14 +100,7 @@ struct reginfo
|
|||
u8 val;
|
||||
};
|
||||
|
||||
static s32 sensor_init_width = 0;
|
||||
static s32 sensor_init_height = 0;
|
||||
static unsigned long sensor_init_busparam = (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING|SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW |SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ);
|
||||
static enum v4l2_mbus_pixelcode sensor_init_pixelcode = V4L2_MBUS_FMT_YUYV8_2X8;
|
||||
static struct reginfo* sensor_init_data_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_board = NULL;
|
||||
/* init 800*600 SVGA */
|
||||
/* init 640X480 VGA */
|
||||
static struct reginfo sensor_init_data[] =
|
||||
{
|
||||
//========= close output
|
||||
|
|
@ -1349,8 +1345,8 @@ struct sensor
|
|||
#if CONFIG_SENSOR_I2C_NOSCHED
|
||||
atomic_t tasklock_cnt;
|
||||
#endif
|
||||
struct rkcamera_platform_data *sensor_io_request;
|
||||
struct rkcamera_gpio_res *sensor_gpio_res;
|
||||
struct rk29camera_platform_data *sensor_io_request;
|
||||
struct rk29camera_gpio_res *sensor_gpio_res;
|
||||
};
|
||||
|
||||
static struct sensor* to_sensor(const struct i2c_client *client)
|
||||
|
|
@ -1573,7 +1569,7 @@ static int sensor_check_array(struct i2c_client *client, struct reginfo *regarra
|
|||
|
||||
return 0;
|
||||
}
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd cmd, int on)
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd cmd, int on)
|
||||
{
|
||||
struct soc_camera_link *icl = to_soc_camera_link(icd);
|
||||
int ret = 0;
|
||||
|
|
@ -1585,13 +1581,13 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd c
|
|||
{
|
||||
if (icl->powerdown) {
|
||||
ret = icl->powerdown(icd->pdev, on);
|
||||
if (ret == RK_CAM_IO_SUCCESS) {
|
||||
if (ret == RK29_CAM_IO_SUCCESS) {
|
||||
if (on == 0) {
|
||||
mdelay(2);
|
||||
if (icl->reset)
|
||||
icl->reset(icd->pdev);
|
||||
}
|
||||
} else if (ret == RK_CAM_EIO_REQUESTFAIL) {
|
||||
} else if (ret == RK29_CAM_EIO_REQUESTFAIL) {
|
||||
ret = -ENODEV;
|
||||
goto sensor_power_end;
|
||||
}
|
||||
|
|
@ -1625,63 +1621,9 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
struct sensor *sensor = to_sensor(client);
|
||||
const struct v4l2_queryctrl *qctrl;
|
||||
const struct sensor_datafmt *fmt;
|
||||
char value;
|
||||
int ret,pid = 0,i = 0,j=0;
|
||||
struct rkcamera_platform_data* tmp_plat_data =(struct rkcamera_platform_data*)val;
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
sensor_init_winseq_p = sensor_vga;
|
||||
sensor_init_width = 640;
|
||||
sensor_init_height = 480;
|
||||
if (tmp_plat_data != NULL) {
|
||||
for(i = 0;i < RK_CAM_NUM_PER_HOST;i++){
|
||||
if ((tmp_plat_data->sensor_init_data[i])&& tmp_plat_data->info[i].dev_name &&
|
||||
(strcmp(tmp_plat_data->info[i].dev_name, dev_name(icd->pdev)) == 0))
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(tmp_plat_data && (i < RK_CAM_NUM_PER_HOST) && tmp_plat_data->sensor_init_data[i]){
|
||||
//user has defined the init data
|
||||
//init reg
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
for(j = 0;j< sizeof(sensor_init_data)/sizeof(struct reginfo);j++){
|
||||
sensor_init_data[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].reg;
|
||||
sensor_init_data[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].val;
|
||||
}
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data){
|
||||
sensor_init_data_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data);
|
||||
}
|
||||
//init winseq
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
int tmp_winseq_size = tmp_plat_data->sensor_init_data[i]->rk_sensor_winseq_size;
|
||||
if(sensor_init_winseq_board)
|
||||
{
|
||||
vfree(sensor_init_winseq_board);
|
||||
sensor_init_winseq_board = NULL;
|
||||
}
|
||||
sensor_init_winseq_board = (struct reginfo*)vmalloc(tmp_winseq_size);
|
||||
if(!sensor_init_winseq_board)
|
||||
SENSOR_TR("%s :vmalloc erro !",__FUNCTION__);
|
||||
for(j = 0;j< tmp_winseq_size;j++){
|
||||
sensor_init_winseq_board[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].reg;
|
||||
sensor_init_winseq_board[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].val;
|
||||
}
|
||||
sensor_init_winseq_p = sensor_init_winseq_board;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq){
|
||||
sensor_init_winseq_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq);
|
||||
}
|
||||
//init width,height,bus,pixelcode
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width != INVALID_VALUE)
|
||||
sensor_init_width = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height != INVALID_VALUE)
|
||||
sensor_init_height = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param != INVALID_VALUE)
|
||||
sensor_init_busparam = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode != INVALID_VALUE)
|
||||
sensor_init_pixelcode = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode;
|
||||
}
|
||||
int ret;
|
||||
|
||||
|
||||
SENSOR_DG("\n%s..%s.. \n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
|
||||
if (sensor_ioctrl(icd, Sensor_PowerDown, 0) < 0) {
|
||||
|
|
@ -1702,7 +1644,7 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
|
||||
mdelay(5); */ //delay 5 microseconds
|
||||
|
||||
ret = sensor_write_array(client, sensor_init_data_p);
|
||||
ret = sensor_write_array(client, sensor_init_data);
|
||||
if (ret != 0)
|
||||
{
|
||||
SENSOR_TR("error: %s initial failed\n",SENSOR_NAME_STRING());
|
||||
|
|
@ -1713,14 +1655,14 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
int i;
|
||||
u8 val;
|
||||
printk("****************** check init data\n");
|
||||
for(i=0; sensor_init_data_p[i].reg!=0xff; i++)
|
||||
for(i=0; sensor_init_data[i].reg!=0xff; i++)
|
||||
{
|
||||
sensor_read(client, sensor_init_data_p[i].reg, &val);
|
||||
sensor_read(client, sensor_init_data[i].reg, &val);
|
||||
printk("reg 0x%02x: org=0x%02x, val=0x%02x, %s\n",
|
||||
sensor_init_data_p[i].reg,
|
||||
sensor_init_data_p[i].val,
|
||||
sensor_init_data[i].reg,
|
||||
sensor_init_data[i].val,
|
||||
val,
|
||||
sensor_init_data_p[i].val==val?"O":"X");
|
||||
sensor_init_data[i].val==val?"O":"X");
|
||||
}
|
||||
printk("**********************************\n");
|
||||
|
||||
|
|
@ -2872,25 +2814,25 @@ static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
|
|||
SENSOR_DG("\n%s..%s..cmd:%x \n",SENSOR_NAME_STRING(),__FUNCTION__,cmd);
|
||||
switch (cmd)
|
||||
{
|
||||
case RK_CAM_SUBDEV_DEACTIVATE:
|
||||
case RK29_CAM_SUBDEV_DEACTIVATE:
|
||||
{
|
||||
sensor_deactivate(client);
|
||||
break;
|
||||
}
|
||||
|
||||
case RK_CAM_SUBDEV_IOREQUEST:
|
||||
case RK29_CAM_SUBDEV_IOREQUEST:
|
||||
{
|
||||
sensor->sensor_io_request = (struct rkcamera_platform_data*)arg;
|
||||
sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
|
||||
if (sensor->sensor_io_request != NULL) {
|
||||
if (sensor->sensor_io_request->gpio_res[0].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
} else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
}
|
||||
} else {
|
||||
SENSOR_TR("%s %s RK_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
ret = -EINVAL;
|
||||
goto sensor_ioctl_end;
|
||||
}
|
||||
|
|
|
|||
111
drivers/media/video/gc0308.c
Normal file → Executable file
111
drivers/media/video/gc0308.c
Normal file → Executable file
|
|
@ -20,8 +20,8 @@ o* Driver for MT9M001 CMOS Image Sensor from Micron
|
|||
#include <media/v4l2-common.h>
|
||||
#include <media/v4l2-chip-ident.h>
|
||||
#include <media/soc_camera.h>
|
||||
#include <mach/rk_camera.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <mach/rk29_camera.h>
|
||||
|
||||
static int debug;
|
||||
module_param(debug, int, S_IRUGO|S_IWUSR);
|
||||
|
||||
|
|
@ -44,18 +44,17 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define MAX(x,y) ((x>y) ? x: y)
|
||||
|
||||
/* Sensor Driver Configuration */
|
||||
#define SENSOR_NAME RK_CAM_SENSOR_GC0308
|
||||
#define SENSOR_NAME RK29_CAM_SENSOR_GC0308
|
||||
#define SENSOR_V4L2_IDENT V4L2_IDENT_GC0308
|
||||
#define SENSOR_ID 0x9b
|
||||
#define SENSOR_MIN_WIDTH 640//176
|
||||
#define SENSOR_MIN_HEIGHT 480//144
|
||||
#define SENSOR_MAX_WIDTH 640
|
||||
#define SENSOR_MAX_HEIGHT 480
|
||||
#define SENSOR_INIT_WIDTH sensor_init_width /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT sensor_init_height
|
||||
#define SENSOR_INIT_WINSEQADR sensor_init_winseq_p
|
||||
#define SENSOR_INIT_PIXFMT sensor_init_pixelcode
|
||||
#define SENSOR_BUS_PARAM sensor_init_busparam
|
||||
#define SENSOR_INIT_WIDTH 640 /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT 480
|
||||
#define SENSOR_INIT_WINSEQADR sensor_vga
|
||||
#define SENSOR_INIT_PIXFMT V4L2_MBUS_FMT_YUYV8_2X8
|
||||
|
||||
#define CONFIG_SENSOR_WhiteBalance 1
|
||||
#define CONFIG_SENSOR_Brightness 0
|
||||
|
|
@ -75,6 +74,10 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define CONFIG_SENSOR_I2C_NOSCHED 0
|
||||
#define CONFIG_SENSOR_I2C_RDWRCHK 0
|
||||
|
||||
#define SENSOR_BUS_PARAM (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING |\
|
||||
SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW |\
|
||||
SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ)
|
||||
|
||||
#define COLOR_TEMPERATURE_CLOUDY_DN 6500
|
||||
#define COLOR_TEMPERATURE_CLOUDY_UP 8000
|
||||
#define COLOR_TEMPERATURE_CLEARDAY_DN 5000
|
||||
|
|
@ -98,14 +101,7 @@ struct reginfo
|
|||
u8 val;
|
||||
};
|
||||
|
||||
static s32 sensor_init_width = 0;
|
||||
static s32 sensor_init_height = 0;
|
||||
static unsigned long sensor_init_busparam = (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING|SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW |SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ);
|
||||
static enum v4l2_mbus_pixelcode sensor_init_pixelcode = V4L2_MBUS_FMT_YUYV8_2X8;
|
||||
static struct reginfo* sensor_init_data_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_board = NULL;
|
||||
/* init 800*600 SVGA */
|
||||
/* init 640X480 VGA */
|
||||
static struct reginfo sensor_init_data[] =
|
||||
{
|
||||
|
||||
|
|
@ -1253,8 +1249,8 @@ struct sensor
|
|||
#if CONFIG_SENSOR_I2C_NOSCHED
|
||||
atomic_t tasklock_cnt;
|
||||
#endif
|
||||
struct rkcamera_platform_data *sensor_io_request;
|
||||
struct rkcamera_gpio_res *sensor_gpio_res;
|
||||
struct rk29camera_platform_data *sensor_io_request;
|
||||
struct rk29camera_gpio_res *sensor_gpio_res;
|
||||
};
|
||||
|
||||
static struct sensor* to_sensor(const struct i2c_client *client)
|
||||
|
|
@ -1448,7 +1444,7 @@ static int sensor_check_array(struct i2c_client *client, struct reginfo *regarra
|
|||
return 0;
|
||||
}
|
||||
#endif
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd cmd, int on)
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd cmd, int on)
|
||||
{
|
||||
struct soc_camera_link *icl = to_soc_camera_link(icd);
|
||||
int ret = 0;
|
||||
|
|
@ -1460,13 +1456,13 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd c
|
|||
{
|
||||
if (icl->powerdown) {
|
||||
ret = icl->powerdown(icd->pdev, on);
|
||||
if (ret == RK_CAM_IO_SUCCESS) {
|
||||
if (ret == RK29_CAM_IO_SUCCESS) {
|
||||
if (on == 0) {
|
||||
mdelay(2);
|
||||
if (icl->reset)
|
||||
icl->reset(icd->pdev);
|
||||
}
|
||||
} else if (ret == RK_CAM_EIO_REQUESTFAIL) {
|
||||
} else if (ret == RK29_CAM_EIO_REQUESTFAIL) {
|
||||
ret = -ENODEV;
|
||||
goto sensor_power_end;
|
||||
}
|
||||
|
|
@ -1500,63 +1496,8 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
struct sensor *sensor = to_sensor(client);
|
||||
const struct v4l2_queryctrl *qctrl;
|
||||
const struct sensor_datafmt *fmt;
|
||||
char value;
|
||||
int ret,pid = 0,i = 0,j=0;
|
||||
struct rkcamera_platform_data* tmp_plat_data =(struct rkcamera_platform_data*)val;
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
sensor_init_winseq_p = sensor_vga;
|
||||
sensor_init_width = 640;
|
||||
sensor_init_height = 480;
|
||||
if (tmp_plat_data != NULL) {
|
||||
for(i = 0;i < RK_CAM_NUM_PER_HOST;i++){
|
||||
if ((tmp_plat_data->sensor_init_data[i])&& tmp_plat_data->info[i].dev_name &&
|
||||
(strcmp(tmp_plat_data->info[i].dev_name, dev_name(icd->pdev)) == 0))
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(tmp_plat_data && (i < RK_CAM_NUM_PER_HOST) && tmp_plat_data->sensor_init_data[i]){
|
||||
//user has defined the init data
|
||||
//init reg
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
for(j = 0;j< sizeof(sensor_init_data)/sizeof(struct reginfo);j++){
|
||||
sensor_init_data[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].reg;
|
||||
sensor_init_data[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].val;
|
||||
}
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data){
|
||||
sensor_init_data_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data);
|
||||
}
|
||||
//init winseq
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
int tmp_winseq_size = tmp_plat_data->sensor_init_data[i]->rk_sensor_winseq_size;
|
||||
if(sensor_init_winseq_board)
|
||||
{
|
||||
vfree(sensor_init_winseq_board);
|
||||
sensor_init_winseq_board = NULL;
|
||||
}
|
||||
sensor_init_winseq_board = (struct reginfo*)vmalloc(tmp_winseq_size);
|
||||
if(!sensor_init_winseq_board)
|
||||
SENSOR_TR("%s :vmalloc erro !",__FUNCTION__);
|
||||
for(j = 0;j< tmp_winseq_size;j++){
|
||||
sensor_init_winseq_board[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].reg;
|
||||
sensor_init_winseq_board[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].val;
|
||||
}
|
||||
sensor_init_winseq_p = sensor_init_winseq_board;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq){
|
||||
sensor_init_winseq_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq);
|
||||
}
|
||||
//init width,height,bus,pixelcode
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width != INVALID_VALUE)
|
||||
sensor_init_width = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height != INVALID_VALUE)
|
||||
sensor_init_height = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param != INVALID_VALUE)
|
||||
sensor_init_busparam = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode != INVALID_VALUE)
|
||||
sensor_init_pixelcode = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode;
|
||||
}
|
||||
int ret;
|
||||
|
||||
SENSOR_DG("\n%s..%s.. \n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
|
||||
if (sensor_ioctrl(icd, Sensor_PowerDown, 0) < 0) {
|
||||
|
|
@ -1577,7 +1518,7 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
|
||||
mdelay(5); */ //delay 5 microseconds
|
||||
|
||||
ret = sensor_write_array(client, sensor_init_data_p);
|
||||
ret = sensor_write_array(client, sensor_init_data);
|
||||
if (ret != 0)
|
||||
{
|
||||
SENSOR_TR("error: %s initial failed\n",SENSOR_NAME_STRING());
|
||||
|
|
@ -2715,25 +2656,25 @@ static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
|
|||
SENSOR_DG("\n%s..%s..cmd:%x \n",SENSOR_NAME_STRING(),__FUNCTION__,cmd);
|
||||
switch (cmd)
|
||||
{
|
||||
case RK_CAM_SUBDEV_DEACTIVATE:
|
||||
case RK29_CAM_SUBDEV_DEACTIVATE:
|
||||
{
|
||||
sensor_deactivate(client);
|
||||
break;
|
||||
}
|
||||
|
||||
case RK_CAM_SUBDEV_IOREQUEST:
|
||||
case RK29_CAM_SUBDEV_IOREQUEST:
|
||||
{
|
||||
sensor->sensor_io_request = (struct rkcamera_platform_data*)arg;
|
||||
sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
|
||||
if (sensor->sensor_io_request != NULL) {
|
||||
if (sensor->sensor_io_request->gpio_res[0].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
} else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
}
|
||||
} else {
|
||||
SENSOR_TR("%s %s RK_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
ret = -EINVAL;
|
||||
goto sensor_ioctl_end;
|
||||
}
|
||||
|
|
|
|||
110
drivers/media/video/gc0309.c
Normal file → Executable file
110
drivers/media/video/gc0309.c
Normal file → Executable file
|
|
@ -19,8 +19,8 @@ o* Driver for MT9M001 CMOS Image Sensor from Micron
|
|||
#include <media/v4l2-common.h>
|
||||
#include <media/v4l2-chip-ident.h>
|
||||
#include <media/soc_camera.h>
|
||||
#include <mach/rk_camera.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <mach/rk29_camera.h>
|
||||
|
||||
static int debug;
|
||||
module_param(debug, int, S_IRUGO|S_IWUSR);
|
||||
|
||||
|
|
@ -43,18 +43,17 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define MAX(x,y) ((x>y) ? x: y)
|
||||
|
||||
/* Sensor Driver Configuration */
|
||||
#define SENSOR_NAME RK_CAM_SENSOR_GC0309
|
||||
#define SENSOR_NAME RK29_CAM_SENSOR_GC0309
|
||||
#define SENSOR_V4L2_IDENT V4L2_IDENT_GC0309
|
||||
#define SENSOR_ID 0xa0
|
||||
#define SENSOR_MIN_WIDTH 176
|
||||
#define SENSOR_MIN_HEIGHT 144
|
||||
#define SENSOR_MAX_WIDTH 640
|
||||
#define SENSOR_MAX_HEIGHT 480
|
||||
#define SENSOR_INIT_WIDTH sensor_init_width /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT sensor_init_height
|
||||
#define SENSOR_INIT_WINSEQADR sensor_init_winseq_p
|
||||
#define SENSOR_INIT_PIXFMT sensor_init_pixelcode
|
||||
#define SENSOR_BUS_PARAM sensor_init_busparam
|
||||
#define SENSOR_INIT_WIDTH 640 /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT 480
|
||||
#define SENSOR_INIT_WINSEQADR sensor_vga
|
||||
#define SENSOR_INIT_PIXFMT V4L2_MBUS_FMT_YUYV8_2X8
|
||||
|
||||
#define CONFIG_SENSOR_WhiteBalance 1
|
||||
#define CONFIG_SENSOR_Brightness 0
|
||||
|
|
@ -74,6 +73,10 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define CONFIG_SENSOR_I2C_NOSCHED 0
|
||||
#define CONFIG_SENSOR_I2C_RDWRCHK 0
|
||||
|
||||
#define SENSOR_BUS_PARAM (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING|\
|
||||
SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_HIGH |\
|
||||
SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ)
|
||||
|
||||
#define COLOR_TEMPERATURE_CLOUDY_DN 6500
|
||||
#define COLOR_TEMPERATURE_CLOUDY_UP 8000
|
||||
#define COLOR_TEMPERATURE_CLEARDAY_DN 5000
|
||||
|
|
@ -97,14 +100,7 @@ struct reginfo
|
|||
u8 val;
|
||||
};
|
||||
|
||||
static s32 sensor_init_width = 0;
|
||||
static s32 sensor_init_height = 0;
|
||||
static unsigned long sensor_init_busparam = (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING|SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW |SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ);
|
||||
static enum v4l2_mbus_pixelcode sensor_init_pixelcode = V4L2_MBUS_FMT_YUYV8_2X8;
|
||||
static struct reginfo* sensor_init_data_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_board = NULL;
|
||||
/* init 800*600 SVGA */
|
||||
/* init SVGA preview */
|
||||
static struct reginfo sensor_init_data[] =
|
||||
{
|
||||
/*init registers code.*/
|
||||
|
|
@ -1198,8 +1194,8 @@ struct sensor
|
|||
#if CONFIG_SENSOR_I2C_NOSCHED
|
||||
atomic_t tasklock_cnt;
|
||||
#endif
|
||||
struct rkcamera_platform_data *sensor_io_request;
|
||||
struct rkcamera_gpio_res *sensor_gpio_res;
|
||||
struct rk29camera_platform_data *sensor_io_request;
|
||||
struct rk29camera_gpio_res *sensor_gpio_res;
|
||||
};
|
||||
|
||||
static struct sensor* to_sensor(const struct i2c_client *client)
|
||||
|
|
@ -1405,7 +1401,7 @@ static int sensor_readchk_array(struct i2c_client *client, struct reginfo *regar
|
|||
return 0;
|
||||
}
|
||||
#endif
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd cmd, int on)
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd cmd, int on)
|
||||
{
|
||||
struct soc_camera_link *icl = to_soc_camera_link(icd);
|
||||
int ret = 0;
|
||||
|
|
@ -1417,13 +1413,13 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd c
|
|||
{
|
||||
if (icl->powerdown) {
|
||||
ret = icl->powerdown(icd->pdev, on);
|
||||
if (ret == RK_CAM_IO_SUCCESS) {
|
||||
if (ret == RK29_CAM_IO_SUCCESS) {
|
||||
if (on == 0) {
|
||||
mdelay(2);
|
||||
if (icl->reset)
|
||||
icl->reset(icd->pdev);
|
||||
}
|
||||
} else if (ret == RK_CAM_EIO_REQUESTFAIL) {
|
||||
} else if (ret == RK29_CAM_EIO_REQUESTFAIL) {
|
||||
ret = -ENODEV;
|
||||
goto sensor_power_end;
|
||||
}
|
||||
|
|
@ -1457,63 +1453,7 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
const struct v4l2_queryctrl *qctrl;
|
||||
const struct sensor_datafmt *fmt;
|
||||
char value;
|
||||
int ret,pid = 0,i = 0,j=0;
|
||||
struct rkcamera_platform_data* tmp_plat_data =(struct rkcamera_platform_data*)val;
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
sensor_init_winseq_p = sensor_vga;
|
||||
sensor_init_width = 640;
|
||||
sensor_init_height = 480;
|
||||
if (tmp_plat_data != NULL) {
|
||||
for(i = 0;i < RK_CAM_NUM_PER_HOST;i++){
|
||||
if ((tmp_plat_data->sensor_init_data[i])&& tmp_plat_data->info[i].dev_name &&
|
||||
(strcmp(tmp_plat_data->info[i].dev_name, dev_name(icd->pdev)) == 0))
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(tmp_plat_data && (i < RK_CAM_NUM_PER_HOST) && tmp_plat_data->sensor_init_data[i]){
|
||||
//user has defined the init data
|
||||
//init reg
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
for(j = 0;j< sizeof(sensor_init_data)/sizeof(struct reginfo);j++){
|
||||
sensor_init_data[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].reg;
|
||||
sensor_init_data[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].val;
|
||||
}
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data){
|
||||
sensor_init_data_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data);
|
||||
}
|
||||
//init winseq
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
int tmp_winseq_size = tmp_plat_data->sensor_init_data[i]->rk_sensor_winseq_size;
|
||||
if(sensor_init_winseq_board)
|
||||
{
|
||||
vfree(sensor_init_winseq_board);
|
||||
sensor_init_winseq_board = NULL;
|
||||
}
|
||||
sensor_init_winseq_board = (struct reginfo*)vmalloc(tmp_winseq_size);
|
||||
if(!sensor_init_winseq_board)
|
||||
SENSOR_TR("%s :vmalloc erro !",__FUNCTION__);
|
||||
for(j = 0;j< tmp_winseq_size;j++){
|
||||
sensor_init_winseq_board[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].reg;
|
||||
sensor_init_winseq_board[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].val;
|
||||
}
|
||||
sensor_init_winseq_p = sensor_init_winseq_board;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq){
|
||||
sensor_init_winseq_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq);
|
||||
}
|
||||
//init width,height,bus,pixelcode
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width != INVALID_VALUE)
|
||||
sensor_init_width = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height != INVALID_VALUE)
|
||||
sensor_init_height = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param != INVALID_VALUE)
|
||||
sensor_init_busparam = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode != INVALID_VALUE)
|
||||
sensor_init_pixelcode = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode;
|
||||
}
|
||||
SENSOR_DG("\n%s..%s.. \n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
int ret;
|
||||
|
||||
if (sensor_ioctrl(icd, Sensor_PowerDown, 0) < 0) {
|
||||
ret = -ENODEV;
|
||||
|
|
@ -1548,7 +1488,7 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
goto sensor_INIT_ERR;
|
||||
}
|
||||
|
||||
ret = sensor_write_array(client, sensor_init_data_p);
|
||||
ret = sensor_write_array(client, sensor_init_data);
|
||||
if (ret != 0)
|
||||
{
|
||||
SENSOR_TR("error: %s initial failed\n",SENSOR_NAME_STRING());
|
||||
|
|
@ -2669,25 +2609,25 @@ static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
|
|||
SENSOR_DG("\n%s..%s..cmd:%x \n",SENSOR_NAME_STRING(),__FUNCTION__,cmd);
|
||||
switch (cmd)
|
||||
{
|
||||
case RK_CAM_SUBDEV_DEACTIVATE:
|
||||
case RK29_CAM_SUBDEV_DEACTIVATE:
|
||||
{
|
||||
sensor_deactivate(client);
|
||||
break;
|
||||
}
|
||||
|
||||
case RK_CAM_SUBDEV_IOREQUEST:
|
||||
case RK29_CAM_SUBDEV_IOREQUEST:
|
||||
{
|
||||
sensor->sensor_io_request = (struct rkcamera_platform_data*)arg;
|
||||
sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
|
||||
if (sensor->sensor_io_request != NULL) {
|
||||
if (sensor->sensor_io_request->gpio_res[0].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
} else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
}
|
||||
} else {
|
||||
SENSOR_TR("%s %s RK_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
ret = -EINVAL;
|
||||
goto sensor_ioctl_end;
|
||||
}
|
||||
|
|
|
|||
26
drivers/media/video/gc0309_for_td8801.c
Executable file → Normal file
26
drivers/media/video/gc0309_for_td8801.c
Executable file → Normal file
|
|
@ -19,7 +19,7 @@ o* Driver for MT9M001 CMOS Image Sensor from Micron
|
|||
#include <media/v4l2-common.h>
|
||||
#include <media/v4l2-chip-ident.h>
|
||||
#include <media/soc_camera.h>
|
||||
#include <mach/rk_camera.h>
|
||||
#include <mach/rk29_camera.h>
|
||||
|
||||
static int debug;
|
||||
module_param(debug, int, S_IRUGO|S_IWUSR);
|
||||
|
|
@ -43,7 +43,7 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define MAX(x,y) ((x>y) ? x: y)
|
||||
|
||||
/* Sensor Driver Configuration */
|
||||
#define SENSOR_NAME RK_CAM_SENSOR_GC0309
|
||||
#define SENSOR_NAME RK29_CAM_SENSOR_GC0309
|
||||
#define SENSOR_V4L2_IDENT V4L2_IDENT_GC0309
|
||||
#define SENSOR_ID 0xa0
|
||||
#define SENSOR_MIN_WIDTH 176
|
||||
|
|
@ -1194,8 +1194,8 @@ struct sensor
|
|||
#if CONFIG_SENSOR_I2C_NOSCHED
|
||||
atomic_t tasklock_cnt;
|
||||
#endif
|
||||
struct rkcamera_platform_data *sensor_io_request;
|
||||
struct rkcamera_gpio_res *sensor_gpio_res;
|
||||
struct rk29camera_platform_data *sensor_io_request;
|
||||
struct rk29camera_gpio_res *sensor_gpio_res;
|
||||
};
|
||||
|
||||
static struct sensor* to_sensor(const struct i2c_client *client)
|
||||
|
|
@ -1401,7 +1401,7 @@ static int sensor_readchk_array(struct i2c_client *client, struct reginfo *regar
|
|||
return 0;
|
||||
}
|
||||
#endif
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd cmd, int on)
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd cmd, int on)
|
||||
{
|
||||
struct soc_camera_link *icl = to_soc_camera_link(icd);
|
||||
int ret = 0;
|
||||
|
|
@ -1413,13 +1413,13 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd c
|
|||
{
|
||||
if (icl->powerdown) {
|
||||
ret = icl->powerdown(icd->pdev, on);
|
||||
if (ret == RK_CAM_IO_SUCCESS) {
|
||||
if (ret == RK29_CAM_IO_SUCCESS) {
|
||||
if (on == 0) {
|
||||
mdelay(2);
|
||||
if (icl->reset)
|
||||
icl->reset(icd->pdev);
|
||||
}
|
||||
} else if (ret == RK_CAM_EIO_REQUESTFAIL) {
|
||||
} else if (ret == RK29_CAM_EIO_REQUESTFAIL) {
|
||||
ret = -ENODEV;
|
||||
goto sensor_power_end;
|
||||
}
|
||||
|
|
@ -2610,25 +2610,25 @@ static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
|
|||
SENSOR_DG("\n%s..%s..cmd:%x \n",SENSOR_NAME_STRING(),__FUNCTION__,cmd);
|
||||
switch (cmd)
|
||||
{
|
||||
case RK_CAM_SUBDEV_DEACTIVATE:
|
||||
case RK29_CAM_SUBDEV_DEACTIVATE:
|
||||
{
|
||||
sensor_deactivate(client);
|
||||
break;
|
||||
}
|
||||
|
||||
case RK_CAM_SUBDEV_IOREQUEST:
|
||||
case RK29_CAM_SUBDEV_IOREQUEST:
|
||||
{
|
||||
sensor->sensor_io_request = (struct rkcamera_platform_data*)arg;
|
||||
sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
|
||||
if (sensor->sensor_io_request != NULL) {
|
||||
if (sensor->sensor_io_request->gpio_res[0].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
} else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
}
|
||||
} else {
|
||||
SENSOR_TR("%s %s RK_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
ret = -EINVAL;
|
||||
goto sensor_ioctl_end;
|
||||
}
|
||||
|
|
|
|||
110
drivers/media/video/gc2015.c
Normal file → Executable file
110
drivers/media/video/gc2015.c
Normal file → Executable file
|
|
@ -19,8 +19,8 @@ o* Driver for MT9M001 CMOS Image Sensor from Micron
|
|||
#include <media/v4l2-common.h>
|
||||
#include <media/v4l2-chip-ident.h>
|
||||
#include <media/soc_camera.h>
|
||||
#include <mach/rk_camera.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <mach/rk29_camera.h>
|
||||
|
||||
static int debug;
|
||||
module_param(debug, int, S_IRUGO|S_IWUSR);
|
||||
|
||||
|
|
@ -43,18 +43,17 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define MAX(x,y) ((x>y) ? x: y)
|
||||
|
||||
/* Sensor Driver Configuration */
|
||||
#define SENSOR_NAME RK_CAM_SENSOR_GC2015
|
||||
#define SENSOR_NAME RK29_CAM_SENSOR_GC2015
|
||||
#define SENSOR_V4L2_IDENT V4L2_IDENT_GC2015
|
||||
#define SENSOR_ID 0x2005
|
||||
#define SENSOR_MIN_WIDTH 640
|
||||
#define SENSOR_MIN_HEIGHT 480
|
||||
#define SENSOR_MAX_WIDTH 1600
|
||||
#define SENSOR_MAX_HEIGHT 1200
|
||||
#define SENSOR_INIT_WIDTH sensor_init_width /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT sensor_init_height
|
||||
#define SENSOR_INIT_WINSEQADR sensor_init_winseq_p
|
||||
#define SENSOR_INIT_PIXFMT sensor_init_pixelcode
|
||||
#define SENSOR_BUS_PARAM sensor_init_busparam
|
||||
#define SENSOR_INIT_WIDTH 800//1024 /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT 600//768
|
||||
#define SENSOR_INIT_WINSEQADR sensor_svga
|
||||
#define SENSOR_INIT_PIXFMT V4L2_MBUS_FMT_UYVY8_2X8
|
||||
|
||||
#define CONFIG_SENSOR_WhiteBalance 1
|
||||
#define CONFIG_SENSOR_Brightness 0
|
||||
|
|
@ -74,6 +73,10 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define CONFIG_SENSOR_I2C_NOSCHED 0
|
||||
#define CONFIG_SENSOR_I2C_RDWRCHK 0
|
||||
|
||||
#define SENSOR_BUS_PARAM (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING|\
|
||||
SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW |\
|
||||
SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ)
|
||||
|
||||
#define COLOR_TEMPERATURE_CLOUDY_DN 6500
|
||||
#define COLOR_TEMPERATURE_CLOUDY_UP 8000
|
||||
#define COLOR_TEMPERATURE_CLEARDAY_DN 5000
|
||||
|
|
@ -97,14 +100,7 @@ struct reginfo
|
|||
u8 val;
|
||||
};
|
||||
|
||||
static s32 sensor_init_width = 0;
|
||||
static s32 sensor_init_height = 0;
|
||||
static unsigned long sensor_init_busparam = (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING|SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW |SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ);
|
||||
static enum v4l2_mbus_pixelcode sensor_init_pixelcode = V4L2_MBUS_FMT_YUYV8_2X8;
|
||||
static struct reginfo* sensor_init_data_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_board = NULL;
|
||||
/* init 800*600 SVGA */
|
||||
/* init SVGA preview */
|
||||
static struct reginfo sensor_init_data[] =
|
||||
|
||||
{
|
||||
|
|
@ -1351,8 +1347,8 @@ struct sensor
|
|||
#if CONFIG_SENSOR_I2C_NOSCHED
|
||||
atomic_t tasklock_cnt;
|
||||
#endif
|
||||
struct rkcamera_platform_data *sensor_io_request;
|
||||
struct rkcamera_gpio_res *sensor_gpio_res;
|
||||
struct rk29camera_platform_data *sensor_io_request;
|
||||
struct rk29camera_gpio_res *sensor_gpio_res;
|
||||
};
|
||||
|
||||
static struct sensor* to_sensor(const struct i2c_client *client)
|
||||
|
|
@ -1557,7 +1553,7 @@ static int sensor_readchk_array(struct i2c_client *client, struct reginfo *regar
|
|||
return 0;
|
||||
}
|
||||
#endif
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd cmd, int on)
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd cmd, int on)
|
||||
{
|
||||
struct soc_camera_link *icl = to_soc_camera_link(icd);
|
||||
int ret = 0;
|
||||
|
|
@ -1569,13 +1565,13 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd c
|
|||
{
|
||||
if (icl->powerdown) {
|
||||
ret = icl->powerdown(icd->pdev, on);
|
||||
if (ret == RK_CAM_IO_SUCCESS) {
|
||||
if (ret == RK29_CAM_IO_SUCCESS) {
|
||||
if (on == 0) {
|
||||
mdelay(2);
|
||||
if (icl->reset)
|
||||
icl->reset(icd->pdev);
|
||||
}
|
||||
} else if (ret == RK_CAM_EIO_REQUESTFAIL) {
|
||||
} else if (ret == RK29_CAM_EIO_REQUESTFAIL) {
|
||||
ret = -ENODEV;
|
||||
goto sensor_power_end;
|
||||
}
|
||||
|
|
@ -1609,62 +1605,8 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
const struct v4l2_queryctrl *qctrl;
|
||||
const struct sensor_datafmt *fmt;
|
||||
char value;
|
||||
int ret,pid = 0,i = 0,j=0;
|
||||
struct rkcamera_platform_data* tmp_plat_data =(struct rkcamera_platform_data*)val;
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
sensor_init_winseq_p = sensor_svga;
|
||||
sensor_init_width = 800;
|
||||
sensor_init_height = 600;
|
||||
if (tmp_plat_data != NULL) {
|
||||
for(i = 0;i < RK_CAM_NUM_PER_HOST;i++){
|
||||
if ((tmp_plat_data->sensor_init_data[i])&& tmp_plat_data->info[i].dev_name &&
|
||||
(strcmp(tmp_plat_data->info[i].dev_name, dev_name(icd->pdev)) == 0))
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(tmp_plat_data && (i < RK_CAM_NUM_PER_HOST) && tmp_plat_data->sensor_init_data[i]){
|
||||
//user has defined the init data
|
||||
//init reg
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
for(j = 0;j< sizeof(sensor_init_data)/sizeof(struct reginfo);j++){
|
||||
sensor_init_data[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].reg;
|
||||
sensor_init_data[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].val;
|
||||
}
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data){
|
||||
sensor_init_data_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data);
|
||||
}
|
||||
//init winseq
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
int tmp_winseq_size = tmp_plat_data->sensor_init_data[i]->rk_sensor_winseq_size;
|
||||
if(sensor_init_winseq_board)
|
||||
{
|
||||
vfree(sensor_init_winseq_board);
|
||||
sensor_init_winseq_board = NULL;
|
||||
}
|
||||
sensor_init_winseq_board = (struct reginfo*)vmalloc(tmp_winseq_size);
|
||||
if(!sensor_init_winseq_board)
|
||||
SENSOR_TR("%s :vmalloc erro !",__FUNCTION__);
|
||||
for(j = 0;j< tmp_winseq_size;j++){
|
||||
sensor_init_winseq_board[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].reg;
|
||||
sensor_init_winseq_board[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].val;
|
||||
}
|
||||
sensor_init_winseq_p = sensor_init_winseq_board;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq){
|
||||
sensor_init_winseq_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq);
|
||||
}
|
||||
//init width,height,bus,pixelcode
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width != INVALID_VALUE)
|
||||
sensor_init_width = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height != INVALID_VALUE)
|
||||
sensor_init_height = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param != INVALID_VALUE)
|
||||
sensor_init_busparam = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode != INVALID_VALUE)
|
||||
sensor_init_pixelcode = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode;
|
||||
}
|
||||
int ret,pid = 0;
|
||||
|
||||
SENSOR_DG("\n%s..%s.. \n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
|
||||
if (sensor_ioctrl(icd, Sensor_PowerDown, 0) < 0) {
|
||||
|
|
@ -1711,7 +1653,7 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
goto sensor_INIT_ERR;
|
||||
}
|
||||
|
||||
ret = sensor_write_array(client, sensor_init_data_p);
|
||||
ret = sensor_write_array(client, sensor_init_data);
|
||||
if (ret != 0)
|
||||
{
|
||||
SENSOR_TR("error: %s initial failed\n",SENSOR_NAME_STRING());
|
||||
|
|
@ -2880,25 +2822,25 @@ static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
|
|||
SENSOR_DG("\n%s..%s..cmd:%x \n",SENSOR_NAME_STRING(),__FUNCTION__,cmd);
|
||||
switch (cmd)
|
||||
{
|
||||
case RK_CAM_SUBDEV_DEACTIVATE:
|
||||
case RK29_CAM_SUBDEV_DEACTIVATE:
|
||||
{
|
||||
sensor_deactivate(client);
|
||||
break;
|
||||
}
|
||||
|
||||
case RK_CAM_SUBDEV_IOREQUEST:
|
||||
case RK29_CAM_SUBDEV_IOREQUEST:
|
||||
{
|
||||
sensor->sensor_io_request = (struct rkcamera_platform_data*)arg;
|
||||
sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
|
||||
if (sensor->sensor_io_request != NULL) {
|
||||
if (sensor->sensor_io_request->gpio_res[0].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
} else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
}
|
||||
} else {
|
||||
SENSOR_TR("%s %s RK_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
ret = -EINVAL;
|
||||
goto sensor_ioctl_end;
|
||||
}
|
||||
|
|
|
|||
110
drivers/media/video/gt2005.c
Normal file → Executable file
110
drivers/media/video/gt2005.c
Normal file → Executable file
|
|
@ -19,8 +19,8 @@ o* Driver for MT9M001 CMOS Image Sensor from Micron
|
|||
#include <media/v4l2-common.h>
|
||||
#include <media/v4l2-chip-ident.h>
|
||||
#include <media/soc_camera.h>
|
||||
#include <mach/rk_camera.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <mach/rk29_camera.h>
|
||||
|
||||
static int debug;
|
||||
module_param(debug, int, S_IRUGO|S_IWUSR);
|
||||
|
||||
|
|
@ -43,18 +43,17 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define MAX(x,y) ((x>y) ? x: y)
|
||||
|
||||
/* Sensor Driver Configuration */
|
||||
#define SENSOR_NAME RK_CAM_SENSOR_GT2005
|
||||
#define SENSOR_NAME RK29_CAM_SENSOR_GT2005
|
||||
#define SENSOR_V4L2_IDENT V4L2_IDENT_GT2005
|
||||
#define SENSOR_ID 0x5138
|
||||
#define SENSOR_MIN_WIDTH 640
|
||||
#define SENSOR_MIN_HEIGHT 480
|
||||
#define SENSOR_MAX_WIDTH 1600
|
||||
#define SENSOR_MAX_HEIGHT 1200
|
||||
#define SENSOR_INIT_WIDTH sensor_init_width /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT sensor_init_height
|
||||
#define SENSOR_INIT_WINSEQADR sensor_init_winseq_p
|
||||
#define SENSOR_INIT_PIXFMT sensor_init_pixelcode
|
||||
#define SENSOR_BUS_PARAM sensor_init_busparam
|
||||
#define SENSOR_INIT_WIDTH 640 /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT 480
|
||||
#define SENSOR_INIT_WINSEQADR sensor_vga
|
||||
#define SENSOR_INIT_PIXFMT V4L2_MBUS_FMT_YUYV8_2X8
|
||||
|
||||
#define CONFIG_SENSOR_WhiteBalance 1
|
||||
#define CONFIG_SENSOR_Brightness 0
|
||||
|
|
@ -74,6 +73,10 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define CONFIG_SENSOR_I2C_NOSCHED 0
|
||||
#define CONFIG_SENSOR_I2C_RDWRCHK 0
|
||||
|
||||
#define SENSOR_BUS_PARAM (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING |\
|
||||
SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_HIGH |\
|
||||
SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ)
|
||||
|
||||
#define COLOR_TEMPERATURE_CLOUDY_DN 6500
|
||||
#define COLOR_TEMPERATURE_CLOUDY_UP 8000
|
||||
#define COLOR_TEMPERATURE_CLEARDAY_DN 5000
|
||||
|
|
@ -97,14 +100,7 @@ struct reginfo
|
|||
u8 val;
|
||||
};
|
||||
|
||||
static s32 sensor_init_width = 0;
|
||||
static s32 sensor_init_height = 0;
|
||||
static unsigned long sensor_init_busparam = (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING|SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW |SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ);
|
||||
static enum v4l2_mbus_pixelcode sensor_init_pixelcode = V4L2_MBUS_FMT_YUYV8_2X8;
|
||||
static struct reginfo* sensor_init_data_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_board = NULL;
|
||||
/* init 800*600 SVGA */
|
||||
/* init 352X288 SVGA */
|
||||
static struct reginfo sensor_init_data[] =
|
||||
{
|
||||
{0x0101 , 0x00},
|
||||
|
|
@ -2007,8 +2003,8 @@ struct sensor
|
|||
#if CONFIG_SENSOR_I2C_NOSCHED
|
||||
atomic_t tasklock_cnt;
|
||||
#endif
|
||||
struct rkcamera_platform_data *sensor_io_request;
|
||||
struct rkcamera_gpio_res *sensor_gpio_res;
|
||||
struct rk29camera_platform_data *sensor_io_request;
|
||||
struct rk29camera_gpio_res *sensor_gpio_res;
|
||||
};
|
||||
|
||||
static struct sensor* to_sensor(const struct i2c_client *client)
|
||||
|
|
@ -2203,7 +2199,7 @@ static int sensor_check_array(struct i2c_client *client, struct reginfo *regarra
|
|||
return 0;
|
||||
}
|
||||
#endif
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd cmd, int on)
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd cmd, int on)
|
||||
{
|
||||
struct soc_camera_link *icl = to_soc_camera_link(icd);
|
||||
int ret = 0;
|
||||
|
|
@ -2215,13 +2211,13 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd c
|
|||
{
|
||||
if (icl->powerdown) {
|
||||
ret = icl->powerdown(icd->pdev, on);
|
||||
if (ret == RK_CAM_IO_SUCCESS) {
|
||||
if (ret == RK29_CAM_IO_SUCCESS) {
|
||||
if (on == 0) {
|
||||
mdelay(2);
|
||||
if (icl->reset)
|
||||
icl->reset(icd->pdev);
|
||||
}
|
||||
} else if (ret == RK_CAM_EIO_REQUESTFAIL) {
|
||||
} else if (ret == RK29_CAM_EIO_REQUESTFAIL) {
|
||||
ret = -ENODEV;
|
||||
goto sensor_power_end;
|
||||
}
|
||||
|
|
@ -2256,62 +2252,8 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
const struct v4l2_queryctrl *qctrl;
|
||||
const struct sensor_datafmt *fmt;
|
||||
char value;
|
||||
int ret,pid = 0,i = 0,j=0;
|
||||
struct rkcamera_platform_data* tmp_plat_data =(struct rkcamera_platform_data*)val;
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
sensor_init_winseq_p = sensor_svga;
|
||||
sensor_init_width = 640;
|
||||
sensor_init_height = 480;
|
||||
if (tmp_plat_data != NULL) {
|
||||
for(i = 0;i < RK_CAM_NUM_PER_HOST;i++){
|
||||
if ((tmp_plat_data->sensor_init_data[i])&& tmp_plat_data->info[i].dev_name &&
|
||||
(strcmp(tmp_plat_data->info[i].dev_name, dev_name(icd->pdev)) == 0))
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(tmp_plat_data && (i < RK_CAM_NUM_PER_HOST) && tmp_plat_data->sensor_init_data[i]){
|
||||
//user has defined the init data
|
||||
//init reg
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
for(j = 0;j< sizeof(sensor_init_data)/sizeof(struct reginfo);j++){
|
||||
sensor_init_data[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].reg;
|
||||
sensor_init_data[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].val;
|
||||
}
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data){
|
||||
sensor_init_data_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data);
|
||||
}
|
||||
//init winseq
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
int tmp_winseq_size = tmp_plat_data->sensor_init_data[i]->rk_sensor_winseq_size;
|
||||
if(sensor_init_winseq_board)
|
||||
{
|
||||
vfree(sensor_init_winseq_board);
|
||||
sensor_init_winseq_board = NULL;
|
||||
}
|
||||
sensor_init_winseq_board = (struct reginfo*)vmalloc(tmp_winseq_size);
|
||||
if(!sensor_init_winseq_board)
|
||||
SENSOR_TR("%s :vmalloc erro !",__FUNCTION__);
|
||||
for(j = 0;j< tmp_winseq_size;j++){
|
||||
sensor_init_winseq_board[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].reg;
|
||||
sensor_init_winseq_board[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].val;
|
||||
}
|
||||
sensor_init_winseq_p = sensor_init_winseq_board;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq){
|
||||
sensor_init_winseq_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq);
|
||||
}
|
||||
//init width,height,bus,pixelcode
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width != INVALID_VALUE)
|
||||
sensor_init_width = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height != INVALID_VALUE)
|
||||
sensor_init_height = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param != INVALID_VALUE)
|
||||
sensor_init_busparam = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode != INVALID_VALUE)
|
||||
sensor_init_pixelcode = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode;
|
||||
}
|
||||
int ret,pid = 0;
|
||||
|
||||
SENSOR_DG("\n%s..%s.. \n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
|
||||
if (sensor_ioctrl(icd, Sensor_PowerDown, 0) < 0) {
|
||||
|
|
@ -2358,7 +2300,7 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
goto sensor_INIT_ERR;
|
||||
}
|
||||
|
||||
ret = sensor_write_array(client, sensor_init_data_p);
|
||||
ret = sensor_write_array(client, sensor_init_data);
|
||||
if (ret != 0)
|
||||
{
|
||||
SENSOR_TR("error: %s initial failed\n",SENSOR_NAME_STRING());
|
||||
|
|
@ -3519,25 +3461,25 @@ static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
|
|||
SENSOR_DG("\n%s..%s..cmd:%x \n",SENSOR_NAME_STRING(),__FUNCTION__,cmd);
|
||||
switch (cmd)
|
||||
{
|
||||
case RK_CAM_SUBDEV_DEACTIVATE:
|
||||
case RK29_CAM_SUBDEV_DEACTIVATE:
|
||||
{
|
||||
sensor_deactivate(client);
|
||||
break;
|
||||
}
|
||||
|
||||
case RK_CAM_SUBDEV_IOREQUEST:
|
||||
case RK29_CAM_SUBDEV_IOREQUEST:
|
||||
{
|
||||
sensor->sensor_io_request = (struct rkcamera_platform_data*)arg;
|
||||
sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
|
||||
if (sensor->sensor_io_request != NULL) {
|
||||
if (sensor->sensor_io_request->gpio_res[0].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
} else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
}
|
||||
} else {
|
||||
SENSOR_TR("%s %s RK_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
ret = -EINVAL;
|
||||
goto sensor_ioctl_end;
|
||||
}
|
||||
|
|
|
|||
110
drivers/media/video/hi253.c
Normal file → Executable file
110
drivers/media/video/hi253.c
Normal file → Executable file
|
|
@ -19,8 +19,8 @@ o* Driver for MT9M001 CMOS Image Sensor from Micron
|
|||
#include <media/v4l2-common.h>
|
||||
#include <media/v4l2-chip-ident.h>
|
||||
#include <media/soc_camera.h>
|
||||
#include <mach/rk_camera.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <mach/rk29_camera.h>
|
||||
|
||||
static int debug;
|
||||
module_param(debug, int, S_IRUGO|S_IWUSR);
|
||||
|
||||
|
|
@ -43,18 +43,17 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define MAX(x,y) ((x>y) ? x: y)
|
||||
|
||||
/* Sensor Driver Configuration */
|
||||
#define SENSOR_NAME RK_CAM_SENSOR_HI253
|
||||
#define SENSOR_NAME RK29_CAM_SENSOR_HI253
|
||||
#define SENSOR_V4L2_IDENT V4L2_IDENT_HI253
|
||||
#define SENSOR_ID 0x92
|
||||
#define SENSOR_MIN_WIDTH 176
|
||||
#define SENSOR_MIN_HEIGHT 144
|
||||
#define SENSOR_MAX_WIDTH 1600
|
||||
#define SENSOR_MAX_HEIGHT 1200
|
||||
#define SENSOR_INIT_WIDTH sensor_init_width /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT sensor_init_height
|
||||
#define SENSOR_INIT_WINSEQADR sensor_init_winseq_p
|
||||
#define SENSOR_INIT_PIXFMT sensor_init_pixelcode
|
||||
#define SENSOR_BUS_PARAM sensor_init_busparam
|
||||
#define SENSOR_INIT_WIDTH 1600 /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT 1200
|
||||
#define SENSOR_INIT_WINSEQADR sensor_uxga
|
||||
#define SENSOR_INIT_PIXFMT V4L2_MBUS_FMT_UYVY8_2X8
|
||||
|
||||
#define CONFIG_SENSOR_WhiteBalance 1
|
||||
#define CONFIG_SENSOR_Brightness 0
|
||||
|
|
@ -74,6 +73,10 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define CONFIG_SENSOR_I2C_NOSCHED 0
|
||||
#define CONFIG_SENSOR_I2C_RDWRCHK 0
|
||||
|
||||
#define SENSOR_BUS_PARAM (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING|\
|
||||
SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW |\
|
||||
SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ)
|
||||
|
||||
#define COLOR_TEMPERATURE_CLOUDY_DN 6500
|
||||
#define COLOR_TEMPERATURE_CLOUDY_UP 8000
|
||||
#define COLOR_TEMPERATURE_CLEARDAY_DN 5000
|
||||
|
|
@ -98,14 +101,7 @@ struct reginfo
|
|||
u8 val;
|
||||
};
|
||||
|
||||
static s32 sensor_init_width = 0;
|
||||
static s32 sensor_init_height = 0;
|
||||
static unsigned long sensor_init_busparam = (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING|SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW |SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ);
|
||||
static enum v4l2_mbus_pixelcode sensor_init_pixelcode = V4L2_MBUS_FMT_YUYV8_2X8;
|
||||
static struct reginfo* sensor_init_data_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_board = NULL;
|
||||
/* init 800*600 SVGA */
|
||||
/* init SVGA preview */
|
||||
static struct reginfo sensor_init_data[] =
|
||||
{
|
||||
// {0x01, 0xf9},
|
||||
|
|
@ -1934,8 +1930,8 @@ struct sensor
|
|||
#if CONFIG_SENSOR_I2C_NOSCHED
|
||||
atomic_t tasklock_cnt;
|
||||
#endif
|
||||
struct rkcamera_platform_data *sensor_io_request;
|
||||
struct rkcamera_gpio_res *sensor_gpio_res;
|
||||
struct rk29camera_platform_data *sensor_io_request;
|
||||
struct rk29camera_gpio_res *sensor_gpio_res;
|
||||
};
|
||||
|
||||
static struct sensor* to_sensor(const struct i2c_client *client)
|
||||
|
|
@ -2115,7 +2111,7 @@ static int sensor_readchk_array(struct i2c_client *client, struct reginfo *regar
|
|||
return 0;
|
||||
}
|
||||
#endif
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd cmd, int on)
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd cmd, int on)
|
||||
{
|
||||
struct soc_camera_link *icl = to_soc_camera_link(icd);
|
||||
int ret = 0;
|
||||
|
|
@ -2127,13 +2123,13 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd c
|
|||
{
|
||||
if (icl->powerdown) {
|
||||
ret = icl->powerdown(icd->pdev, on);
|
||||
if (ret == RK_CAM_IO_SUCCESS) {
|
||||
if (ret == RK29_CAM_IO_SUCCESS) {
|
||||
if (on == 0) {
|
||||
mdelay(2);
|
||||
if (icl->reset)
|
||||
icl->reset(icd->pdev);
|
||||
}
|
||||
} else if (ret == RK_CAM_EIO_REQUESTFAIL) {
|
||||
} else if (ret == RK29_CAM_EIO_REQUESTFAIL) {
|
||||
ret = -ENODEV;
|
||||
goto sensor_power_end;
|
||||
}
|
||||
|
|
@ -2167,62 +2163,8 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
const struct v4l2_queryctrl *qctrl;
|
||||
const struct sensor_datafmt *fmt;
|
||||
char value;
|
||||
int ret,pid = 0,i = 0,j=0;
|
||||
struct rkcamera_platform_data* tmp_plat_data =(struct rkcamera_platform_data*)val;
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
sensor_init_winseq_p = sensor_uxga;
|
||||
sensor_init_width = 1600;
|
||||
sensor_init_height = 1200;
|
||||
if (tmp_plat_data != NULL) {
|
||||
for(i = 0;i < RK_CAM_NUM_PER_HOST;i++){
|
||||
if ((tmp_plat_data->sensor_init_data[i])&& tmp_plat_data->info[i].dev_name &&
|
||||
(strcmp(tmp_plat_data->info[i].dev_name, dev_name(icd->pdev)) == 0))
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(tmp_plat_data && (i < RK_CAM_NUM_PER_HOST) && tmp_plat_data->sensor_init_data[i]){
|
||||
//user has defined the init data
|
||||
//init reg
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
for(j = 0;j< sizeof(sensor_init_data)/sizeof(struct reginfo);j++){
|
||||
sensor_init_data[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].reg;
|
||||
sensor_init_data[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].val;
|
||||
}
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data){
|
||||
sensor_init_data_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data);
|
||||
}
|
||||
//init winseq
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
int tmp_winseq_size = tmp_plat_data->sensor_init_data[i]->rk_sensor_winseq_size;
|
||||
if(sensor_init_winseq_board)
|
||||
{
|
||||
vfree(sensor_init_winseq_board);
|
||||
sensor_init_winseq_board = NULL;
|
||||
}
|
||||
sensor_init_winseq_board = (struct reginfo*)vmalloc(tmp_winseq_size);
|
||||
if(!sensor_init_winseq_board)
|
||||
SENSOR_TR("%s :vmalloc erro !",__FUNCTION__);
|
||||
for(j = 0;j< tmp_winseq_size;j++){
|
||||
sensor_init_winseq_board[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].reg;
|
||||
sensor_init_winseq_board[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].val;
|
||||
}
|
||||
sensor_init_winseq_p = sensor_init_winseq_board;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq){
|
||||
sensor_init_winseq_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq);
|
||||
}
|
||||
//init width,height,bus,pixelcode
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width != INVALID_VALUE)
|
||||
sensor_init_width = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height != INVALID_VALUE)
|
||||
sensor_init_height = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param != INVALID_VALUE)
|
||||
sensor_init_busparam = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode != INVALID_VALUE)
|
||||
sensor_init_pixelcode = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode;
|
||||
}
|
||||
int ret;
|
||||
|
||||
SENSOR_DG("\n%s..%s.. \n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
|
||||
if (sensor_ioctrl(icd, Sensor_PowerDown, 0) < 0) {
|
||||
|
|
@ -2261,7 +2203,7 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
goto sensor_INIT_ERR;
|
||||
}
|
||||
#endif
|
||||
ret = sensor_write_array(client, sensor_init_data_p);
|
||||
ret = sensor_write_array(client, sensor_init_data);
|
||||
if (ret != 0)
|
||||
{
|
||||
SENSOR_TR("error: %s initial failed\n",SENSOR_NAME_STRING());
|
||||
|
|
@ -3420,25 +3362,25 @@ static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
|
|||
SENSOR_DG("\n%s..%s..cmd:%x \n",SENSOR_NAME_STRING(),__FUNCTION__,cmd);
|
||||
switch (cmd)
|
||||
{
|
||||
case RK_CAM_SUBDEV_DEACTIVATE:
|
||||
case RK29_CAM_SUBDEV_DEACTIVATE:
|
||||
{
|
||||
sensor_deactivate(client);
|
||||
break;
|
||||
}
|
||||
|
||||
case RK_CAM_SUBDEV_IOREQUEST:
|
||||
case RK29_CAM_SUBDEV_IOREQUEST:
|
||||
{
|
||||
sensor->sensor_io_request = (struct rkcamera_platform_data*)arg;
|
||||
sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
|
||||
if (sensor->sensor_io_request != NULL) {
|
||||
if (sensor->sensor_io_request->gpio_res[0].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
} else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
}
|
||||
} else {
|
||||
SENSOR_TR("%s %s RK_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
ret = -EINVAL;
|
||||
goto sensor_ioctl_end;
|
||||
}
|
||||
|
|
|
|||
110
drivers/media/video/hi704.c
Normal file → Executable file
110
drivers/media/video/hi704.c
Normal file → Executable file
|
|
@ -19,8 +19,8 @@ o* Driver for MT9M001 CMOS Image Sensor from Micron
|
|||
#include <media/v4l2-common.h>
|
||||
#include <media/v4l2-chip-ident.h>
|
||||
#include <media/soc_camera.h>
|
||||
#include <mach/rk_camera.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <mach/rk29_camera.h>
|
||||
|
||||
static int debug;
|
||||
module_param(debug, int, S_IRUGO|S_IWUSR);
|
||||
|
||||
|
|
@ -43,18 +43,17 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define MAX(x,y) ((x>y) ? x: y)
|
||||
|
||||
/* Sensor Driver Configuration */
|
||||
#define SENSOR_NAME RK_CAM_SENSOR_HI704
|
||||
#define SENSOR_NAME RK29_CAM_SENSOR_HI704
|
||||
#define SENSOR_V4L2_IDENT V4L2_IDENT_HI704
|
||||
#define SENSOR_ID 0x96
|
||||
#define SENSOR_MIN_WIDTH 176
|
||||
#define SENSOR_MIN_HEIGHT 144
|
||||
#define SENSOR_MAX_WIDTH 640
|
||||
#define SENSOR_MAX_HEIGHT 480
|
||||
#define SENSOR_INIT_WIDTH sensor_init_width /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT sensor_init_height
|
||||
#define SENSOR_INIT_WINSEQADR sensor_init_winseq_p
|
||||
#define SENSOR_INIT_PIXFMT sensor_init_pixelcode
|
||||
#define SENSOR_BUS_PARAM sensor_init_busparam
|
||||
#define SENSOR_INIT_WIDTH 640 /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT 480
|
||||
#define SENSOR_INIT_WINSEQADR sensor_vga
|
||||
#define SENSOR_INIT_PIXFMT V4L2_MBUS_FMT_UYVY8_2X8
|
||||
|
||||
#define CONFIG_SENSOR_WhiteBalance 1
|
||||
#define CONFIG_SENSOR_Brightness 0
|
||||
|
|
@ -74,6 +73,10 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define CONFIG_SENSOR_I2C_NOSCHED 0
|
||||
#define CONFIG_SENSOR_I2C_RDWRCHK 0
|
||||
|
||||
#define SENSOR_BUS_PARAM (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING|\
|
||||
SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW |\
|
||||
SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ)
|
||||
|
||||
#define COLOR_TEMPERATURE_CLOUDY_DN 6500
|
||||
#define COLOR_TEMPERATURE_CLOUDY_UP 8000
|
||||
#define COLOR_TEMPERATURE_CLEARDAY_DN 5000
|
||||
|
|
@ -98,14 +101,7 @@ struct reginfo
|
|||
u8 val;
|
||||
};
|
||||
|
||||
static s32 sensor_init_width = 0;
|
||||
static s32 sensor_init_height = 0;
|
||||
static unsigned long sensor_init_busparam = (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING|SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW |SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ);
|
||||
static enum v4l2_mbus_pixelcode sensor_init_pixelcode = V4L2_MBUS_FMT_YUYV8_2X8;
|
||||
static struct reginfo* sensor_init_data_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_board = NULL;
|
||||
/* init 800*600 SVGA */
|
||||
/* init SVGA preview */
|
||||
static struct reginfo sensor_init_data[] =
|
||||
{
|
||||
//PAGE 0
|
||||
|
|
@ -1391,8 +1387,8 @@ struct sensor
|
|||
#if CONFIG_SENSOR_I2C_NOSCHED
|
||||
atomic_t tasklock_cnt;
|
||||
#endif
|
||||
struct rkcamera_platform_data *sensor_io_request;
|
||||
struct rkcamera_gpio_res *sensor_gpio_res;
|
||||
struct rk29camera_platform_data *sensor_io_request;
|
||||
struct rk29camera_gpio_res *sensor_gpio_res;
|
||||
};
|
||||
|
||||
static struct sensor* to_sensor(const struct i2c_client *client)
|
||||
|
|
@ -1593,7 +1589,7 @@ static int sensor_readchk_array(struct i2c_client *client, struct reginfo *regar
|
|||
return 0;
|
||||
}
|
||||
#endif
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd cmd, int on)
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd cmd, int on)
|
||||
{
|
||||
struct soc_camera_link *icl = to_soc_camera_link(icd);
|
||||
int ret = 0;
|
||||
|
|
@ -1605,13 +1601,13 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd c
|
|||
{
|
||||
if (icl->powerdown) {
|
||||
ret = icl->powerdown(icd->pdev, on);
|
||||
if (ret == RK_CAM_IO_SUCCESS) {
|
||||
if (ret == RK29_CAM_IO_SUCCESS) {
|
||||
if (on == 0) {
|
||||
mdelay(2);
|
||||
if (icl->reset)
|
||||
icl->reset(icd->pdev);
|
||||
}
|
||||
} else if (ret == RK_CAM_EIO_REQUESTFAIL) {
|
||||
} else if (ret == RK29_CAM_EIO_REQUESTFAIL) {
|
||||
ret = -ENODEV;
|
||||
goto sensor_power_end;
|
||||
}
|
||||
|
|
@ -1645,62 +1641,8 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
const struct v4l2_queryctrl *qctrl;
|
||||
const struct sensor_datafmt *fmt;
|
||||
char value;
|
||||
int ret,pid = 0,i = 0,j=0;
|
||||
struct rkcamera_platform_data* tmp_plat_data =(struct rkcamera_platform_data*)val;
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
sensor_init_winseq_p = sensor_vga;
|
||||
sensor_init_width = 640;
|
||||
sensor_init_height = 480;
|
||||
if (tmp_plat_data != NULL) {
|
||||
for(i = 0;i < RK_CAM_NUM_PER_HOST;i++){
|
||||
if ((tmp_plat_data->sensor_init_data[i])&& tmp_plat_data->info[i].dev_name &&
|
||||
(strcmp(tmp_plat_data->info[i].dev_name, dev_name(icd->pdev)) == 0))
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(tmp_plat_data && (i < RK_CAM_NUM_PER_HOST) && tmp_plat_data->sensor_init_data[i]){
|
||||
//user has defined the init data
|
||||
//init reg
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
for(j = 0;j< sizeof(sensor_init_data)/sizeof(struct reginfo);j++){
|
||||
sensor_init_data[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].reg;
|
||||
sensor_init_data[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].val;
|
||||
}
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data){
|
||||
sensor_init_data_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data);
|
||||
}
|
||||
//init winseq
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
int tmp_winseq_size = tmp_plat_data->sensor_init_data[i]->rk_sensor_winseq_size;
|
||||
if(sensor_init_winseq_board)
|
||||
{
|
||||
vfree(sensor_init_winseq_board);
|
||||
sensor_init_winseq_board = NULL;
|
||||
}
|
||||
sensor_init_winseq_board = (struct reginfo*)vmalloc(tmp_winseq_size);
|
||||
if(!sensor_init_winseq_board)
|
||||
SENSOR_TR("%s :vmalloc erro !",__FUNCTION__);
|
||||
for(j = 0;j< tmp_winseq_size;j++){
|
||||
sensor_init_winseq_board[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].reg;
|
||||
sensor_init_winseq_board[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].val;
|
||||
}
|
||||
sensor_init_winseq_p = sensor_init_winseq_board;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq){
|
||||
sensor_init_winseq_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq);
|
||||
}
|
||||
//init width,height,bus,pixelcode
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width != INVALID_VALUE)
|
||||
sensor_init_width = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height != INVALID_VALUE)
|
||||
sensor_init_height = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param != INVALID_VALUE)
|
||||
sensor_init_busparam = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode != INVALID_VALUE)
|
||||
sensor_init_pixelcode = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode;
|
||||
}
|
||||
int ret;
|
||||
|
||||
SENSOR_DG("\n%s..%s.. \n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
|
||||
if (sensor_ioctrl(icd, Sensor_PowerDown, 0) < 0) {
|
||||
|
|
@ -1739,7 +1681,7 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
goto sensor_INIT_ERR;
|
||||
}
|
||||
#endif
|
||||
ret = sensor_write_array(client, sensor_init_data_p);
|
||||
ret = sensor_write_array(client, sensor_init_data);
|
||||
if (ret != 0)
|
||||
{
|
||||
SENSOR_TR("error: %s initial failed\n",SENSOR_NAME_STRING());
|
||||
|
|
@ -2874,25 +2816,25 @@ static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
|
|||
SENSOR_DG("\n%s..%s..cmd:%x \n",SENSOR_NAME_STRING(),__FUNCTION__,cmd);
|
||||
switch (cmd)
|
||||
{
|
||||
case RK_CAM_SUBDEV_DEACTIVATE:
|
||||
case RK29_CAM_SUBDEV_DEACTIVATE:
|
||||
{
|
||||
sensor_deactivate(client);
|
||||
break;
|
||||
}
|
||||
|
||||
case RK_CAM_SUBDEV_IOREQUEST:
|
||||
case RK29_CAM_SUBDEV_IOREQUEST:
|
||||
{
|
||||
sensor->sensor_io_request = (struct rkcamera_platform_data*)arg;
|
||||
sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
|
||||
if (sensor->sensor_io_request != NULL) {
|
||||
if (sensor->sensor_io_request->gpio_res[0].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
} else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
}
|
||||
} else {
|
||||
SENSOR_TR("%s %s RK_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
ret = -EINVAL;
|
||||
goto sensor_ioctl_end;
|
||||
}
|
||||
|
|
|
|||
108
drivers/media/video/mt9d112.c
Normal file → Executable file
108
drivers/media/video/mt9d112.c
Normal file → Executable file
|
|
@ -19,8 +19,7 @@
|
|||
#include <media/v4l2-common.h>
|
||||
#include <media/v4l2-chip-ident.h>
|
||||
#include <media/soc_camera.h>
|
||||
#include <mach/rk_camera.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <mach/rk29_camera.h>
|
||||
#include "mt9d112.h"
|
||||
|
||||
static int debug;
|
||||
|
|
@ -44,7 +43,7 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define MAX(x,y) ((x>y) ? x: y)
|
||||
|
||||
/* Sensor Driver Configuration */
|
||||
#define SENSOR_NAME RK_CAM_SENSOR_MT9D112
|
||||
#define SENSOR_NAME RK29_CAM_SENSOR_MT9D112
|
||||
#define SENSOR_V4L2_IDENT V4L2_IDENT_MT9D112
|
||||
#define SENSOR_ID 0x1580
|
||||
#define SENSOR_ID_REG 0x3000
|
||||
|
|
@ -54,11 +53,10 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define SENSOR_MIN_HEIGHT 240
|
||||
#define SENSOR_MAX_WIDTH 1600
|
||||
#define SENSOR_MAX_HEIGHT 1200
|
||||
#define SENSOR_INIT_WIDTH sensor_init_width /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT sensor_init_height
|
||||
#define SENSOR_INIT_WINSEQADR sensor_init_winseq_p
|
||||
#define SENSOR_INIT_PIXFMT sensor_init_pixelcode
|
||||
#define SENSOR_BUS_PARAM sensor_init_busparam
|
||||
#define SENSOR_INIT_WIDTH 640 /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT 480
|
||||
#define SENSOR_INIT_WINSEQADR sensor_vga
|
||||
#define SENSOR_INIT_PIXFMT V4L2_MBUS_FMT_UYVY8_2X8
|
||||
|
||||
#define CONFIG_SENSOR_WhiteBalance 1
|
||||
#define CONFIG_SENSOR_Brightness 0
|
||||
|
|
@ -79,6 +77,11 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define CONFIG_SENSOR_I2C_NOSCHED 0
|
||||
#define CONFIG_SENSOR_I2C_RDWRCHK 0
|
||||
|
||||
|
||||
#define SENSOR_BUS_PARAM (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING |\
|
||||
SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_HIGH |\
|
||||
SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ)
|
||||
|
||||
#define COLOR_TEMPERATURE_CLOUDY_DN 6500
|
||||
#define COLOR_TEMPERATURE_CLOUDY_UP 8000
|
||||
#define COLOR_TEMPERATURE_CLEARDAY_DN 5000
|
||||
|
|
@ -105,13 +108,6 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define SENSOR_AF_MODE_CLOSE 5
|
||||
#endif
|
||||
#define SENSOR_CCM_ONLY
|
||||
static s32 sensor_init_width = 0;
|
||||
static s32 sensor_init_height = 0;
|
||||
static unsigned long sensor_init_busparam = (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING|SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW |SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ);
|
||||
static enum v4l2_mbus_pixelcode sensor_init_pixelcode = V4L2_MBUS_FMT_YUYV8_2X8;
|
||||
static struct reginfo* sensor_init_data_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_board = NULL;
|
||||
/* init 640X480 VGA */
|
||||
static struct reginfo sensor_init_data[] =
|
||||
{
|
||||
|
|
@ -1485,8 +1481,8 @@ struct sensor
|
|||
#if CONFIG_SENSOR_I2C_NOSCHED
|
||||
atomic_t tasklock_cnt;
|
||||
#endif
|
||||
struct rkcamera_platform_data *sensor_io_request;
|
||||
struct rkcamera_gpio_res *sensor_gpio_res;
|
||||
struct rk29camera_platform_data *sensor_io_request;
|
||||
struct rk29camera_gpio_res *sensor_gpio_res;
|
||||
};
|
||||
|
||||
static struct sensor* to_sensor(const struct i2c_client *client)
|
||||
|
|
@ -1727,7 +1723,7 @@ static int sensor_af_init(struct i2c_client *client)
|
|||
}
|
||||
#endif
|
||||
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd cmd, int on)
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd cmd, int on)
|
||||
{
|
||||
struct soc_camera_link *icl = to_soc_camera_link(icd);
|
||||
int ret = 0;
|
||||
|
|
@ -1739,13 +1735,13 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd c
|
|||
{
|
||||
if (icl->powerdown) {
|
||||
ret = icl->powerdown(icd->pdev, on);
|
||||
if (ret == RK_CAM_IO_SUCCESS) {
|
||||
if (ret == RK29_CAM_IO_SUCCESS) {
|
||||
if (on == 0) {
|
||||
mdelay(2);
|
||||
if (icl->reset)
|
||||
icl->reset(icd->pdev);
|
||||
}
|
||||
} else if (ret == RK_CAM_EIO_REQUESTFAIL) {
|
||||
} else if (ret == RK29_CAM_EIO_REQUESTFAIL) {
|
||||
ret = -ENODEV;
|
||||
goto sensor_power_end;
|
||||
}
|
||||
|
|
@ -1779,66 +1775,10 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
struct sensor *sensor = to_sensor(client);
|
||||
const struct v4l2_queryctrl *qctrl;
|
||||
const struct sensor_datafmt *fmt;
|
||||
int ret,i = 0,j=0;
|
||||
int ret;
|
||||
#if (SENSOR_ID_REG != SEQUENCE_END)
|
||||
u16 pid = 0;
|
||||
#endif
|
||||
struct rkcamera_platform_data* tmp_plat_data =(struct rkcamera_platform_data*)val;
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
sensor_init_winseq_p = sensor_svga;
|
||||
sensor_init_width = 800;
|
||||
sensor_init_height = 600;
|
||||
if (tmp_plat_data != NULL) {
|
||||
for(i = 0;i < RK_CAM_NUM_PER_HOST;i++){
|
||||
if ((tmp_plat_data->sensor_init_data[i])&& tmp_plat_data->info[i].dev_name &&
|
||||
(strcmp(tmp_plat_data->info[i].dev_name, dev_name(icd->pdev)) == 0))
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(tmp_plat_data && (i < RK_CAM_NUM_PER_HOST) && tmp_plat_data->sensor_init_data[i]){
|
||||
//user has defined the init data
|
||||
//init reg
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
for(j = 0;j< sizeof(sensor_init_data)/sizeof(struct reginfo);j++){
|
||||
sensor_init_data[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].reg;
|
||||
sensor_init_data[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].val;
|
||||
}
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data){
|
||||
sensor_init_data_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data);
|
||||
}
|
||||
//init winseq
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
int tmp_winseq_size = tmp_plat_data->sensor_init_data[i]->rk_sensor_winseq_size;
|
||||
if(sensor_init_winseq_board)
|
||||
{
|
||||
vfree(sensor_init_winseq_board);
|
||||
sensor_init_winseq_board = NULL;
|
||||
}
|
||||
sensor_init_winseq_board = (struct reginfo*)vmalloc(tmp_winseq_size);
|
||||
if(!sensor_init_winseq_board)
|
||||
SENSOR_TR("%s :vmalloc erro !",__FUNCTION__);
|
||||
for(j = 0;j< tmp_winseq_size;j++){
|
||||
sensor_init_winseq_board[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].reg;
|
||||
sensor_init_winseq_board[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].val;
|
||||
}
|
||||
sensor_init_winseq_p = sensor_init_winseq_board;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq){
|
||||
sensor_init_winseq_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq);
|
||||
}
|
||||
//init width,height,bus,pixelcode
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width != INVALID_VALUE)
|
||||
sensor_init_width = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height != INVALID_VALUE)
|
||||
sensor_init_height = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param != INVALID_VALUE)
|
||||
sensor_init_busparam = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode != INVALID_VALUE)
|
||||
sensor_init_pixelcode = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode;
|
||||
}
|
||||
|
||||
|
||||
SENSOR_DG("\n%s..%s.. \n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
|
||||
|
|
@ -1883,7 +1823,7 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
goto sensor_INIT_ERR;
|
||||
}
|
||||
|
||||
ret = sensor_write_array(client, sensor_init_data_p);
|
||||
ret = sensor_write_array(client, sensor_init_data);
|
||||
if (ret != 0)
|
||||
{
|
||||
SENSOR_TR("error: %s initial failed\n",SENSOR_NAME_STRING());
|
||||
|
|
@ -3172,24 +3112,24 @@ static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
|
|||
SENSOR_DG("\n%s..%s..cmd:%x \n",SENSOR_NAME_STRING(),__FUNCTION__,cmd);
|
||||
switch (cmd)
|
||||
{
|
||||
case RK_CAM_SUBDEV_DEACTIVATE:
|
||||
case RK29_CAM_SUBDEV_DEACTIVATE:
|
||||
{
|
||||
sensor_deactivate(client);
|
||||
break;
|
||||
}
|
||||
case RK_CAM_SUBDEV_IOREQUEST:
|
||||
case RK29_CAM_SUBDEV_IOREQUEST:
|
||||
{
|
||||
sensor->sensor_io_request = (struct rkcamera_platform_data*)arg;
|
||||
sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
|
||||
if (sensor->sensor_io_request != NULL) {
|
||||
if (sensor->sensor_io_request->gpio_res[0].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
} else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
}
|
||||
} else {
|
||||
SENSOR_TR("%s %s RK_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
ret = -EINVAL;
|
||||
goto sensor_ioctl_end;
|
||||
}
|
||||
|
|
|
|||
108
drivers/media/video/mt9d113.c
Normal file → Executable file
108
drivers/media/video/mt9d113.c
Normal file → Executable file
|
|
@ -20,8 +20,7 @@
|
|||
#include <media/v4l2-common.h>
|
||||
#include <media/v4l2-chip-ident.h>
|
||||
#include <media/soc_camera.h>
|
||||
#include <mach/rk_camera.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <mach/rk29_camera.h>
|
||||
#include "mt9d113.h"
|
||||
|
||||
static int debug;
|
||||
|
|
@ -45,7 +44,7 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define MAX(x,y) ((x>y) ? x: y)
|
||||
|
||||
/* Sensor Driver Configuration */
|
||||
#define SENSOR_NAME RK_CAM_SENSOR_MT9D113
|
||||
#define SENSOR_NAME RK29_CAM_SENSOR_MT9D113
|
||||
#define SENSOR_V4L2_IDENT V4L2_IDENT_MT9D113
|
||||
#define SENSOR_ID 0x2580
|
||||
#define SENSOR_ID_REG 0x00
|
||||
|
|
@ -57,11 +56,10 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define SENSOR_MIN_HEIGHT 600
|
||||
#define SENSOR_MAX_WIDTH 1600
|
||||
#define SENSOR_MAX_HEIGHT 1200
|
||||
#define SENSOR_INIT_WIDTH sensor_init_width /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT sensor_init_height
|
||||
#define SENSOR_INIT_WINSEQADR sensor_init_winseq_p
|
||||
#define SENSOR_INIT_PIXFMT sensor_init_pixelcode
|
||||
#define SENSOR_BUS_PARAM sensor_init_busparam
|
||||
#define SENSOR_INIT_WIDTH 800 /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT 600
|
||||
#define SENSOR_INIT_WINSEQADR sensor_init_data
|
||||
#define SENSOR_INIT_PIXFMT V4L2_MBUS_FMT_UYVY8_2X8
|
||||
|
||||
#define CONFIG_SENSOR_WhiteBalance 0
|
||||
#define CONFIG_SENSOR_Brightness 0
|
||||
|
|
@ -81,6 +79,9 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define CONFIG_SENSOR_I2C_NOSCHED 0
|
||||
#define CONFIG_SENSOR_I2C_RDWRCHK 1
|
||||
|
||||
#define SENSOR_BUS_PARAM (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_FALLING |\
|
||||
SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_HIGH |\
|
||||
SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ)
|
||||
|
||||
#define COLOR_TEMPERATURE_CLOUDY_DN 6500
|
||||
#define COLOR_TEMPERATURE_CLOUDY_UP 8000
|
||||
|
|
@ -106,13 +107,6 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define SENSOR_AF_MODE_CLOSE 5
|
||||
#endif
|
||||
|
||||
static s32 sensor_init_width = 0;
|
||||
static s32 sensor_init_height = 0;
|
||||
static unsigned long sensor_init_busparam = (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING|SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW |SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ);
|
||||
static enum v4l2_mbus_pixelcode sensor_init_pixelcode = V4L2_MBUS_FMT_YUYV8_2X8;
|
||||
static struct reginfo* sensor_init_data_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_board = NULL;
|
||||
/* init 800x600 SVGA */
|
||||
static struct reginfo sensor_init_data[] =
|
||||
{
|
||||
|
|
@ -1214,8 +1208,8 @@ struct sensor
|
|||
#if CONFIG_SENSOR_I2C_NOSCHED
|
||||
atomic_t tasklock_cnt;
|
||||
#endif
|
||||
struct rkcamera_platform_data *sensor_io_request;
|
||||
struct rkcamera_gpio_res *sensor_gpio_res;
|
||||
struct rk29camera_platform_data *sensor_io_request;
|
||||
struct rk29camera_gpio_res *sensor_gpio_res;
|
||||
};
|
||||
|
||||
static struct sensor* to_sensor(const struct i2c_client *client)
|
||||
|
|
@ -1523,7 +1517,7 @@ static int sensor_af_init(struct i2c_client *client)
|
|||
}
|
||||
#endif
|
||||
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd cmd, int on)
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd cmd, int on)
|
||||
{
|
||||
struct soc_camera_link *icl = to_soc_camera_link(icd);
|
||||
int ret = 0;
|
||||
|
|
@ -1535,13 +1529,13 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd c
|
|||
{
|
||||
if (icl->powerdown) {
|
||||
ret = icl->powerdown(icd->pdev, on);
|
||||
if (ret == RK_CAM_IO_SUCCESS) {
|
||||
if (ret == RK29_CAM_IO_SUCCESS) {
|
||||
if (on == 0) {
|
||||
mdelay(2);
|
||||
if (icl->reset)
|
||||
icl->reset(icd->pdev);
|
||||
}
|
||||
} else if (ret == RK_CAM_EIO_REQUESTFAIL) {
|
||||
} else if (ret == RK29_CAM_EIO_REQUESTFAIL) {
|
||||
ret = -ENODEV;
|
||||
goto sensor_power_end;
|
||||
}
|
||||
|
|
@ -1575,63 +1569,9 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
struct sensor *sensor = to_sensor(client);
|
||||
const struct v4l2_queryctrl *qctrl;
|
||||
const struct sensor_datafmt *fmt;
|
||||
char value;
|
||||
int ret,pid = 0,i = 0,j=0;
|
||||
struct rkcamera_platform_data* tmp_plat_data =(struct rkcamera_platform_data*)val;
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
sensor_init_winseq_p = sensor_svga;
|
||||
sensor_init_width = 800;
|
||||
sensor_init_height = 600;
|
||||
if (tmp_plat_data != NULL) {
|
||||
for(i = 0;i < RK_CAM_NUM_PER_HOST;i++){
|
||||
if ((tmp_plat_data->sensor_init_data[i])&& tmp_plat_data->info[i].dev_name &&
|
||||
(strcmp(tmp_plat_data->info[i].dev_name, dev_name(icd->pdev)) == 0))
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(tmp_plat_data && (i < RK_CAM_NUM_PER_HOST) && tmp_plat_data->sensor_init_data[i]){
|
||||
//user has defined the init data
|
||||
//init reg
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
for(j = 0;j< sizeof(sensor_init_data)/sizeof(struct reginfo);j++){
|
||||
sensor_init_data[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].reg;
|
||||
sensor_init_data[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].val;
|
||||
}
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data){
|
||||
sensor_init_data_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data);
|
||||
}
|
||||
//init winseq
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
int tmp_winseq_size = tmp_plat_data->sensor_init_data[i]->rk_sensor_winseq_size;
|
||||
if(sensor_init_winseq_board)
|
||||
{
|
||||
vfree(sensor_init_winseq_board);
|
||||
sensor_init_winseq_board = NULL;
|
||||
}
|
||||
sensor_init_winseq_board = (struct reginfo*)vmalloc(tmp_winseq_size);
|
||||
if(!sensor_init_winseq_board)
|
||||
SENSOR_TR("%s :vmalloc erro !",__FUNCTION__);
|
||||
for(j = 0;j< tmp_winseq_size;j++){
|
||||
sensor_init_winseq_board[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].reg;
|
||||
sensor_init_winseq_board[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].val;
|
||||
}
|
||||
sensor_init_winseq_p = sensor_init_winseq_board;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq){
|
||||
sensor_init_winseq_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq);
|
||||
}
|
||||
//init width,height,bus,pixelcode
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width != INVALID_VALUE)
|
||||
sensor_init_width = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height != INVALID_VALUE)
|
||||
sensor_init_height = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param != INVALID_VALUE)
|
||||
sensor_init_busparam = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode != INVALID_VALUE)
|
||||
sensor_init_pixelcode = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode;
|
||||
}
|
||||
int ret;
|
||||
u16 pid = 0;
|
||||
|
||||
SENSOR_DG("\n%s..%s.. \n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
|
||||
if (sensor_ioctrl(icd, Sensor_PowerDown, 0) < 0) {
|
||||
|
|
@ -1685,7 +1625,7 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
goto sensor_INIT_ERR;
|
||||
}
|
||||
|
||||
ret = sensor_write_array(client, sensor_init_data_p);
|
||||
ret = sensor_write_array(client, sensor_init_data);
|
||||
if (ret != 0)
|
||||
{
|
||||
SENSOR_TR("error: %s initial failed\n",SENSOR_NAME_STRING());
|
||||
|
|
@ -2986,24 +2926,24 @@ static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
|
|||
SENSOR_DG("\n%s..%s..cmd:%x \n",SENSOR_NAME_STRING(),__FUNCTION__,cmd);
|
||||
switch (cmd)
|
||||
{
|
||||
case RK_CAM_SUBDEV_DEACTIVATE:
|
||||
case RK29_CAM_SUBDEV_DEACTIVATE:
|
||||
{
|
||||
sensor_deactivate(client);
|
||||
break;
|
||||
}
|
||||
case RK_CAM_SUBDEV_IOREQUEST:
|
||||
case RK29_CAM_SUBDEV_IOREQUEST:
|
||||
{
|
||||
sensor->sensor_io_request = (struct rkcamera_platform_data*)arg;
|
||||
sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
|
||||
if (sensor->sensor_io_request != NULL) {
|
||||
if (sensor->sensor_io_request->gpio_res[0].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
} else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
}
|
||||
} else {
|
||||
SENSOR_TR("%s %s RK_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
ret = -EINVAL;
|
||||
goto sensor_ioctl_end;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
#include <media/v4l2-common.h>
|
||||
#include <media/v4l2-chip-ident.h>
|
||||
#include <media/soc_camera.h>
|
||||
#include <mach/rk_camera.h>
|
||||
#include <mach/rk29_camera.h>
|
||||
#include "mt9m112.h"
|
||||
|
||||
static int debug;
|
||||
|
|
@ -1049,7 +1049,7 @@ struct sensor
|
|||
#if CONFIG_SENSOR_I2C_NOSCHED
|
||||
atomic_t tasklock_cnt;
|
||||
#endif
|
||||
struct rkcamera_platform_data *sensor_io_request;
|
||||
struct rk29camera_platform_data *sensor_io_request;
|
||||
};
|
||||
|
||||
static struct sensor* to_sensor(const struct i2c_client *client)
|
||||
|
|
@ -1314,7 +1314,7 @@ static int sensor_af_init(struct i2c_client *client)
|
|||
}
|
||||
#endif
|
||||
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd cmd, int on)
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd cmd, int on)
|
||||
{
|
||||
struct soc_camera_link *icl = to_soc_camera_link(icd);
|
||||
int ret = 0;
|
||||
|
|
@ -1326,13 +1326,13 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd c
|
|||
{
|
||||
if (icl->powerdown) {
|
||||
ret = icl->powerdown(icd->pdev, on);
|
||||
if (ret == RK_CAM_IO_SUCCESS) {
|
||||
if (ret == RK29_CAM_IO_SUCCESS) {
|
||||
if (on == 0) {
|
||||
mdelay(2);
|
||||
if (icl->reset)
|
||||
icl->reset(icd->pdev);
|
||||
}
|
||||
} else if (ret == RK_CAM_EIO_REQUESTFAIL) {
|
||||
} else if (ret == RK29_CAM_EIO_REQUESTFAIL) {
|
||||
ret = -ENODEV;
|
||||
goto sensor_power_end;
|
||||
}
|
||||
|
|
@ -2670,14 +2670,14 @@ static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
|
|||
SENSOR_DG("\n%s..%s..cmd:%x \n",SENSOR_NAME_STRING(),__FUNCTION__,cmd);
|
||||
switch (cmd)
|
||||
{
|
||||
case RK_CAM_SUBDEV_DEACTIVATE:
|
||||
case RK29_CAM_SUBDEV_DEACTIVATE:
|
||||
{
|
||||
sensor_deactivate(client);
|
||||
break;
|
||||
}
|
||||
case RK_CAM_SUBDEV_IOREQUEST:
|
||||
case RK29_CAM_SUBDEV_IOREQUEST:
|
||||
{
|
||||
sensor->sensor_io_request = (struct rkcamera_platform_data*)arg;
|
||||
sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -22,8 +22,7 @@
|
|||
#include <media/v4l2-common.h>
|
||||
#include <media/v4l2-chip-ident.h>
|
||||
#include <media/soc_camera.h>
|
||||
#include <mach/rk_camera.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <mach/rk29_camera.h>
|
||||
#include "mt9p111.h"
|
||||
|
||||
static int debug;
|
||||
|
|
@ -47,7 +46,7 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define MAX(x,y) ((x>y) ? x: y)
|
||||
|
||||
/* Sensor Driver Configuration */
|
||||
#define SENSOR_NAME RK_CAM_SENSOR_MT9P111
|
||||
#define SENSOR_NAME RK29_CAM_SENSOR_MT9P111
|
||||
#define SENSOR_V4L2_IDENT V4L2_IDENT_MT9P111
|
||||
#define SENSOR_ID SEQUENCE_END
|
||||
#define SENSOR_ID_REG SEQUENCE_END
|
||||
|
|
@ -58,11 +57,10 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define SENSOR_MIN_HEIGHT 144
|
||||
#define SENSOR_MAX_WIDTH 2592
|
||||
#define SENSOR_MAX_HEIGHT 1944
|
||||
#define SENSOR_INIT_WIDTH sensor_init_width /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT sensor_init_height
|
||||
#define SENSOR_INIT_WINSEQADR sensor_init_winseq_p
|
||||
#define SENSOR_INIT_PIXFMT sensor_init_pixelcode
|
||||
#define SENSOR_BUS_PARAM sensor_init_busparam
|
||||
#define SENSOR_INIT_WIDTH 640 /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT 480
|
||||
#define SENSOR_INIT_WINSEQADR sensor_vga
|
||||
#define SENSOR_INIT_PIXFMT V4L2_MBUS_FMT_UYVY8_2X8
|
||||
#define YUV420_BUFFER_MAX_SIZE 7558272 /* 2592*1944*1.5*/
|
||||
|
||||
#define CONFIG_SENSOR_WhiteBalance 1
|
||||
|
|
@ -86,6 +84,11 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define CONFIG_SENSOR_I2C_NOSCHED 0
|
||||
#define CONFIG_SENSOR_I2C_RDWRCHK 0
|
||||
|
||||
|
||||
#define SENSOR_BUS_PARAM (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING|\
|
||||
SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_HIGH|\
|
||||
SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ)
|
||||
|
||||
#define COLOR_TEMPERATURE_CLOUDY_DN 6500
|
||||
#define COLOR_TEMPERATURE_CLOUDY_UP 8000
|
||||
#define COLOR_TEMPERATURE_CLEARDAY_DN 5000
|
||||
|
|
@ -114,14 +117,7 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define SENSOR_AF_MODE_CLOSE 5
|
||||
#endif
|
||||
|
||||
static s32 sensor_init_width = 0;
|
||||
static s32 sensor_init_height = 0;
|
||||
static unsigned long sensor_init_busparam = (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING|SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW |SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ);
|
||||
static enum v4l2_mbus_pixelcode sensor_init_pixelcode = V4L2_MBUS_FMT_YUYV8_2X8;
|
||||
static struct reginfo* sensor_init_data_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_board = NULL;
|
||||
/* init 800*600 SVGA */
|
||||
/* init 640X480 VGA */
|
||||
static struct reginfo sensor_init_data[] =
|
||||
{
|
||||
//[Step2-PLL_Timing]
|
||||
|
|
@ -2250,8 +2246,8 @@ struct sensor
|
|||
#if CONFIG_SENSOR_I2C_NOSCHED
|
||||
atomic_t tasklock_cnt;
|
||||
#endif
|
||||
struct rkcamera_platform_data *sensor_io_request;
|
||||
struct rkcamera_gpio_res *sensor_gpio_res;
|
||||
struct rk29camera_platform_data *sensor_io_request;
|
||||
struct rk29camera_gpio_res *sensor_gpio_res;
|
||||
};
|
||||
|
||||
static struct sensor* to_sensor(const struct i2c_client *client)
|
||||
|
|
@ -2818,7 +2814,7 @@ static int sensor_af_init(struct i2c_client *client)
|
|||
}
|
||||
#endif
|
||||
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd cmd, int on)
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd cmd, int on)
|
||||
{
|
||||
struct soc_camera_link *icl = to_soc_camera_link(icd);
|
||||
int ret = 0;
|
||||
|
|
@ -2830,13 +2826,13 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd c
|
|||
{
|
||||
if (icl->powerdown) {
|
||||
ret = icl->powerdown(icd->pdev, on);
|
||||
if (ret == RK_CAM_IO_SUCCESS) {
|
||||
if (ret == RK29_CAM_IO_SUCCESS) {
|
||||
if (on == 0) {
|
||||
mdelay(2);
|
||||
if (icl->reset)
|
||||
icl->reset(icd->pdev);
|
||||
}
|
||||
} else if (ret == RK_CAM_EIO_REQUESTFAIL) {
|
||||
} else if (ret == RK29_CAM_EIO_REQUESTFAIL) {
|
||||
ret = -ENODEV;
|
||||
goto sensor_power_end;
|
||||
}
|
||||
|
|
@ -2872,66 +2868,11 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
const struct v4l2_queryctrl *qctrl;
|
||||
#endif
|
||||
const struct sensor_datafmt *fmt;
|
||||
int ret,pid = 0,i = 0,j=0;
|
||||
int ret,pid = 0;
|
||||
int index =0 ;
|
||||
#if (SENSOR_RESET_REG != SEQUENCE_END)
|
||||
struct reginfo reg_info;
|
||||
#endif
|
||||
struct rkcamera_platform_data* tmp_plat_data =(struct rkcamera_platform_data*)val;
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
sensor_init_winseq_p = sensor_vga;
|
||||
sensor_init_width = 640;
|
||||
sensor_init_height = 480;
|
||||
if (tmp_plat_data != NULL) {
|
||||
for(i = 0;i < RK_CAM_NUM_PER_HOST;i++){
|
||||
if ((tmp_plat_data->sensor_init_data[i])&& tmp_plat_data->info[i].dev_name &&
|
||||
(strcmp(tmp_plat_data->info[i].dev_name, dev_name(icd->pdev)) == 0))
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(tmp_plat_data && (i < RK_CAM_NUM_PER_HOST) && tmp_plat_data->sensor_init_data[i]){
|
||||
//user has defined the init data
|
||||
//init reg
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
for(j = 0;j< sizeof(sensor_init_data)/sizeof(struct reginfo);j++){
|
||||
sensor_init_data[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].reg;
|
||||
sensor_init_data[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].val;
|
||||
}
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data){
|
||||
sensor_init_data_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data);
|
||||
}
|
||||
//init winseq
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
int tmp_winseq_size = tmp_plat_data->sensor_init_data[i]->rk_sensor_winseq_size;
|
||||
if(sensor_init_winseq_board)
|
||||
{
|
||||
vfree(sensor_init_winseq_board);
|
||||
sensor_init_winseq_board = NULL;
|
||||
}
|
||||
sensor_init_winseq_board = (struct reginfo*)vmalloc(tmp_winseq_size);
|
||||
if(!sensor_init_winseq_board)
|
||||
SENSOR_TR("%s :vmalloc erro !",__FUNCTION__);
|
||||
for(j = 0;j< tmp_winseq_size;j++){
|
||||
sensor_init_winseq_board[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].reg;
|
||||
sensor_init_winseq_board[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].val;
|
||||
}
|
||||
sensor_init_winseq_p = sensor_init_winseq_board;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq){
|
||||
sensor_init_winseq_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq);
|
||||
}
|
||||
//init width,height,bus,pixelcode
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width != INVALID_VALUE)
|
||||
sensor_init_width = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height != INVALID_VALUE)
|
||||
sensor_init_height = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param != INVALID_VALUE)
|
||||
sensor_init_busparam = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode != INVALID_VALUE)
|
||||
sensor_init_pixelcode = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode;
|
||||
}
|
||||
|
||||
SENSOR_DG("\n%s..%s.. \n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
|
||||
|
|
@ -2982,7 +2923,7 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
|
||||
SENSOR_DG("\n sensor_init_data..%s.\n",SENSOR_NAME_STRING());
|
||||
|
||||
ret =sensor_write_init_data(client, sensor_init_data_p);
|
||||
ret =sensor_write_init_data(client, sensor_init_data);
|
||||
if (ret != 0) {
|
||||
SENSOR_TR("error: %s initial failed\n",SENSOR_NAME_STRING());
|
||||
goto sensor_INIT_ERR;
|
||||
|
|
@ -4685,29 +4626,29 @@ static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
|
|||
#endif
|
||||
int ret = 0;
|
||||
|
||||
rk_camera_sensor_cb_s *icd_cb =NULL;
|
||||
rk29_camera_sensor_cb_s *icd_cb =NULL;
|
||||
|
||||
SENSOR_DG("\n%s..%s..cmd:%x \n",SENSOR_NAME_STRING(),__FUNCTION__,cmd);
|
||||
switch (cmd)
|
||||
{
|
||||
case RK_CAM_SUBDEV_DEACTIVATE:
|
||||
case RK29_CAM_SUBDEV_DEACTIVATE:
|
||||
{
|
||||
sensor_deactivate(client);
|
||||
break;
|
||||
}
|
||||
case RK_CAM_SUBDEV_IOREQUEST:
|
||||
case RK29_CAM_SUBDEV_IOREQUEST:
|
||||
{
|
||||
sensor->sensor_io_request = (struct rkcamera_platform_data*)arg;
|
||||
sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
|
||||
if (sensor->sensor_io_request != NULL) {
|
||||
if (sensor->sensor_io_request->gpio_res[0].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
} else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
}
|
||||
} else {
|
||||
SENSOR_TR("%s %s RK_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
ret = -EINVAL;
|
||||
goto sensor_ioctl_end;
|
||||
}
|
||||
|
|
@ -4728,9 +4669,9 @@ static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
|
|||
#endif
|
||||
break;
|
||||
}
|
||||
case RK_CAM_SUBDEV_CB_REGISTER:
|
||||
case RK29_CAM_SUBDEV_CB_REGISTER:
|
||||
{
|
||||
icd_cb = (rk_camera_sensor_cb_s*)(arg);
|
||||
icd_cb = (rk29_camera_sensor_cb_s*)(arg);
|
||||
icd_cb->sensor_cb = sensor_cb;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
111
drivers/media/video/mt9t111.c
Normal file → Executable file
111
drivers/media/video/mt9t111.c
Normal file → Executable file
|
|
@ -20,8 +20,7 @@
|
|||
#include <media/v4l2-common.h>
|
||||
#include <media/v4l2-chip-ident.h>
|
||||
#include <media/soc_camera.h>
|
||||
#include <mach/rk_camera.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <mach/rk29_camera.h>
|
||||
#include "mt9t111.h"
|
||||
|
||||
static int debug;
|
||||
|
|
@ -45,7 +44,7 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define MAX(x,y) ((x>y) ? x: y)
|
||||
|
||||
/* Sensor Driver Configuration */
|
||||
#define SENSOR_NAME RK_CAM_SENSOR_MT9T111
|
||||
#define SENSOR_NAME RK29_CAM_SENSOR_MT9T111
|
||||
#define SENSOR_V4L2_IDENT V4L2_IDENT_MT9T111
|
||||
#define SENSOR_ID SEQUENCE_END
|
||||
#define SENSOR_ID_REG SEQUENCE_END
|
||||
|
|
@ -56,11 +55,10 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define SENSOR_MIN_HEIGHT 144
|
||||
#define SENSOR_MAX_WIDTH 2048
|
||||
#define SENSOR_MAX_HEIGHT 1536
|
||||
#define SENSOR_INIT_WIDTH sensor_init_width /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT sensor_init_height
|
||||
#define SENSOR_INIT_WINSEQADR sensor_init_winseq_p
|
||||
#define SENSOR_INIT_PIXFMT sensor_init_pixelcode
|
||||
#define SENSOR_BUS_PARAM sensor_init_busparam
|
||||
#define SENSOR_INIT_WIDTH 640 /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT 480
|
||||
#define SENSOR_INIT_WINSEQADR sensor_vga
|
||||
#define SENSOR_INIT_PIXFMT V4L2_MBUS_FMT_UYVY8_2X8
|
||||
|
||||
#define CONFIG_SENSOR_WhiteBalance 1
|
||||
#define CONFIG_SENSOR_Brightness 0
|
||||
|
|
@ -84,6 +82,11 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define CONFIG_SENSOR_I2C_NOSCHED 0
|
||||
#define CONFIG_SENSOR_I2C_RDWRCHK 0
|
||||
|
||||
|
||||
#define SENSOR_BUS_PARAM (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING|\
|
||||
SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_HIGH|\
|
||||
SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ)
|
||||
|
||||
#define COLOR_TEMPERATURE_CLOUDY_DN 6500
|
||||
#define COLOR_TEMPERATURE_CLOUDY_UP 8000
|
||||
#define COLOR_TEMPERATURE_CLEARDAY_DN 5000
|
||||
|
|
@ -110,14 +113,7 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define SENSOR_AF_MODE_CLOSE 5
|
||||
#endif
|
||||
|
||||
static s32 sensor_init_width = 0;
|
||||
static s32 sensor_init_height = 0;
|
||||
static unsigned long sensor_init_busparam = (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING|SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW |SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ);
|
||||
static enum v4l2_mbus_pixelcode sensor_init_pixelcode = V4L2_MBUS_FMT_YUYV8_2X8;
|
||||
static struct reginfo* sensor_init_data_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_board = NULL;
|
||||
/* init 800*600 SVGA */
|
||||
/* init 640X480 VGA */
|
||||
static struct reginfo sensor_init_data[] =
|
||||
{
|
||||
//[Step2-PLL_Timing]
|
||||
|
|
@ -6260,8 +6256,8 @@ struct sensor
|
|||
#if CONFIG_SENSOR_I2C_NOSCHED
|
||||
atomic_t tasklock_cnt;
|
||||
#endif
|
||||
struct rkcamera_platform_data *sensor_io_request;
|
||||
struct rkcamera_gpio_res *sensor_gpio_res;
|
||||
struct rk29camera_platform_data *sensor_io_request;
|
||||
struct rk29camera_gpio_res *sensor_gpio_res;
|
||||
};
|
||||
|
||||
static struct sensor* to_sensor(const struct i2c_client *client)
|
||||
|
|
@ -6651,7 +6647,7 @@ static int sensor_af_init(struct i2c_client *client)
|
|||
}
|
||||
#endif
|
||||
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd cmd, int on)
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd cmd, int on)
|
||||
{
|
||||
struct soc_camera_link *icl = to_soc_camera_link(icd);
|
||||
int ret = 0;
|
||||
|
|
@ -6663,13 +6659,13 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd c
|
|||
{
|
||||
if (icl->powerdown) {
|
||||
ret = icl->powerdown(icd->pdev, on);
|
||||
if (ret == RK_CAM_IO_SUCCESS) {
|
||||
if (ret == RK29_CAM_IO_SUCCESS) {
|
||||
if (on == 0) {
|
||||
mdelay(2);
|
||||
if (icl->reset)
|
||||
icl->reset(icd->pdev);
|
||||
}
|
||||
} else if (ret == RK_CAM_EIO_REQUESTFAIL) {
|
||||
} else if (ret == RK29_CAM_EIO_REQUESTFAIL) {
|
||||
ret = -ENODEV;
|
||||
goto sensor_power_end;
|
||||
}
|
||||
|
|
@ -6703,65 +6699,10 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
struct sensor *sensor = to_sensor(client);
|
||||
const struct v4l2_queryctrl *qctrl;
|
||||
const struct sensor_datafmt *fmt;
|
||||
int ret,pid = 0,i = 0,j=0;
|
||||
int ret,pid = 0;
|
||||
#if (SENSOR_RESET_REG != SEQUENCE_END)
|
||||
struct reginfo reg_info;
|
||||
#endif
|
||||
struct rkcamera_platform_data* tmp_plat_data =(struct rkcamera_platform_data*)val;
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
sensor_init_winseq_p = sensor_vga;
|
||||
sensor_init_width = 640;
|
||||
sensor_init_height = 480;
|
||||
if (tmp_plat_data != NULL) {
|
||||
for(i = 0;i < RK_CAM_NUM_PER_HOST;i++){
|
||||
if ((tmp_plat_data->sensor_init_data[i])&& tmp_plat_data->info[i].dev_name &&
|
||||
(strcmp(tmp_plat_data->info[i].dev_name, dev_name(icd->pdev)) == 0))
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(tmp_plat_data && (i < RK_CAM_NUM_PER_HOST) && tmp_plat_data->sensor_init_data[i]){
|
||||
//user has defined the init data
|
||||
//init reg
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
for(j = 0;j< sizeof(sensor_init_data)/sizeof(struct reginfo);j++){
|
||||
sensor_init_data[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].reg;
|
||||
sensor_init_data[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].val;
|
||||
}
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data){
|
||||
sensor_init_data_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data);
|
||||
}
|
||||
//init winseq
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
int tmp_winseq_size = tmp_plat_data->sensor_init_data[i]->rk_sensor_winseq_size;
|
||||
if(sensor_init_winseq_board)
|
||||
{
|
||||
vfree(sensor_init_winseq_board);
|
||||
sensor_init_winseq_board = NULL;
|
||||
}
|
||||
sensor_init_winseq_board = (struct reginfo*)vmalloc(tmp_winseq_size);
|
||||
if(!sensor_init_winseq_board)
|
||||
SENSOR_TR("%s :vmalloc erro !",__FUNCTION__);
|
||||
for(j = 0;j< tmp_winseq_size;j++){
|
||||
sensor_init_winseq_board[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].reg;
|
||||
sensor_init_winseq_board[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].val;
|
||||
}
|
||||
sensor_init_winseq_p = sensor_init_winseq_board;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq){
|
||||
sensor_init_winseq_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq);
|
||||
}
|
||||
//init width,height,bus,pixelcode
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width != INVALID_VALUE)
|
||||
sensor_init_width = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height != INVALID_VALUE)
|
||||
sensor_init_height = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param != INVALID_VALUE)
|
||||
sensor_init_busparam = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode != INVALID_VALUE)
|
||||
sensor_init_pixelcode = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode;
|
||||
}
|
||||
|
||||
if (sensor_ioctrl(icd, Sensor_PowerDown, 0) < 0) {
|
||||
ret = -ENODEV;
|
||||
|
|
@ -6805,8 +6746,8 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
ret = -ENODEV;
|
||||
goto sensor_INIT_ERR;
|
||||
}
|
||||
|
||||
ret = sensor_write_array(client, sensor_init_data_p);
|
||||
|
||||
ret = sensor_write_array(client, sensor_init_data);
|
||||
if (ret != 0)
|
||||
{
|
||||
SENSOR_TR("error: %s initial failed\n",SENSOR_NAME_STRING());
|
||||
|
|
@ -8318,24 +8259,24 @@ static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
|
|||
SENSOR_DG("\n%s..%s..cmd:%x \n",SENSOR_NAME_STRING(),__FUNCTION__,cmd);
|
||||
switch (cmd)
|
||||
{
|
||||
case RK_CAM_SUBDEV_DEACTIVATE:
|
||||
case RK29_CAM_SUBDEV_DEACTIVATE:
|
||||
{
|
||||
sensor_deactivate(client);
|
||||
break;
|
||||
}
|
||||
case RK_CAM_SUBDEV_IOREQUEST:
|
||||
case RK29_CAM_SUBDEV_IOREQUEST:
|
||||
{
|
||||
sensor->sensor_io_request = (struct rkcamera_platform_data*)arg;
|
||||
sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
|
||||
if (sensor->sensor_io_request != NULL) {
|
||||
if (sensor->sensor_io_request->gpio_res[0].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
} else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
}
|
||||
} else {
|
||||
SENSOR_TR("%s %s RK_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
ret = -EINVAL;
|
||||
goto sensor_ioctl_end;
|
||||
}
|
||||
|
|
|
|||
110
drivers/media/video/nt99250.c
Normal file → Executable file
110
drivers/media/video/nt99250.c
Normal file → Executable file
|
|
@ -19,8 +19,8 @@ o* Driver for MT9M001 CMOS Image Sensor from Micron
|
|||
#include <media/v4l2-common.h>
|
||||
#include <media/v4l2-chip-ident.h>
|
||||
#include <media/soc_camera.h>
|
||||
#include <mach/rk_camera.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <mach/rk29_camera.h>
|
||||
|
||||
static int debug;
|
||||
module_param(debug, int, S_IRUGO|S_IWUSR);
|
||||
|
||||
|
|
@ -43,18 +43,17 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define MAX(x,y) ((x>y) ? x: y)
|
||||
|
||||
/* Sensor Driver Configuration */
|
||||
#define SENSOR_NAME RK_CAM_SENSOR_NT99250
|
||||
#define SENSOR_NAME RK29_CAM_SENSOR_NT99250
|
||||
#define SENSOR_V4L2_IDENT V4L2_IDENT_NT99250
|
||||
#define SENSOR_ID 0x0105
|
||||
#define SENSOR_MIN_WIDTH 176
|
||||
#define SENSOR_MIN_HEIGHT 144
|
||||
#define SENSOR_MAX_WIDTH 1600
|
||||
#define SENSOR_MAX_HEIGHT 1200
|
||||
#define SENSOR_INIT_WIDTH sensor_init_width /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT sensor_init_height
|
||||
#define SENSOR_INIT_WINSEQADR sensor_init_winseq_p
|
||||
#define SENSOR_INIT_PIXFMT sensor_init_pixelcode
|
||||
#define SENSOR_BUS_PARAM sensor_init_busparam
|
||||
#define SENSOR_INIT_WIDTH 800 /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT 600
|
||||
#define SENSOR_INIT_WINSEQADR sensor_svga
|
||||
#define SENSOR_INIT_PIXFMT V4L2_MBUS_FMT_UYVY8_2X8
|
||||
|
||||
#define CONFIG_SENSOR_WhiteBalance 0
|
||||
#define CONFIG_SENSOR_Brightness 0
|
||||
|
|
@ -74,6 +73,10 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define CONFIG_SENSOR_I2C_NOSCHED 0
|
||||
#define CONFIG_SENSOR_I2C_RDWRCHK 0
|
||||
|
||||
#define SENSOR_BUS_PARAM (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING |\
|
||||
SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW |\
|
||||
SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ)
|
||||
|
||||
#define COLOR_TEMPERATURE_CLOUDY_DN 6500
|
||||
#define COLOR_TEMPERATURE_CLOUDY_UP 8000
|
||||
#define COLOR_TEMPERATURE_CLEARDAY_DN 5000
|
||||
|
|
@ -97,14 +100,7 @@ struct reginfo
|
|||
u8 val;
|
||||
};
|
||||
|
||||
static s32 sensor_init_width = 0;
|
||||
static s32 sensor_init_height = 0;
|
||||
static unsigned long sensor_init_busparam = (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING|SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW |SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ);
|
||||
static enum v4l2_mbus_pixelcode sensor_init_pixelcode = V4L2_MBUS_FMT_YUYV8_2X8;
|
||||
static struct reginfo* sensor_init_data_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_board = NULL;
|
||||
/* init 800*600 SVGA */
|
||||
/* init 352X288 SVGA */
|
||||
static struct reginfo sensor_init_data[] =
|
||||
{
|
||||
{0x3024,0x02}, //TG //0x02
|
||||
|
|
@ -1219,8 +1215,8 @@ struct sensor
|
|||
#if CONFIG_SENSOR_I2C_NOSCHED
|
||||
atomic_t tasklock_cnt;
|
||||
#endif
|
||||
struct rkcamera_platform_data *sensor_io_request;
|
||||
struct rkcamera_gpio_res *sensor_gpio_res;
|
||||
struct rk29camera_platform_data *sensor_io_request;
|
||||
struct rk29camera_gpio_res *sensor_gpio_res;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -1404,7 +1400,7 @@ static int sensor_readchk_array(struct i2c_client *client, struct reginfo *regar
|
|||
return 0;
|
||||
}
|
||||
#endif
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd cmd, int on)
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd cmd, int on)
|
||||
{
|
||||
struct soc_camera_link *icl = to_soc_camera_link(icd);
|
||||
int ret = 0;
|
||||
|
|
@ -1416,13 +1412,13 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd c
|
|||
{
|
||||
if (icl->powerdown) {
|
||||
ret = icl->powerdown(icd->pdev, on);
|
||||
if (ret == RK_CAM_IO_SUCCESS) {
|
||||
if (ret == RK29_CAM_IO_SUCCESS) {
|
||||
if (on == 0) {
|
||||
mdelay(2);
|
||||
if (icl->reset)
|
||||
icl->reset(icd->pdev);
|
||||
}
|
||||
} else if (ret == RK_CAM_EIO_REQUESTFAIL) {
|
||||
} else if (ret == RK29_CAM_EIO_REQUESTFAIL) {
|
||||
ret = -ENODEV;
|
||||
goto sensor_power_end;
|
||||
}
|
||||
|
|
@ -1456,62 +1452,8 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
const struct v4l2_queryctrl *qctrl;
|
||||
const struct sensor_datafmt *fmt;
|
||||
char value;
|
||||
int ret,pid = 0,i = 0,j=0;
|
||||
struct rkcamera_platform_data* tmp_plat_data =(struct rkcamera_platform_data*)val;
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
sensor_init_winseq_p = sensor_svga;
|
||||
sensor_init_width = 800;
|
||||
sensor_init_height = 600;
|
||||
if (tmp_plat_data != NULL) {
|
||||
for(i = 0;i < RK_CAM_NUM_PER_HOST;i++){
|
||||
if ((tmp_plat_data->sensor_init_data[i])&& tmp_plat_data->info[i].dev_name &&
|
||||
(strcmp(tmp_plat_data->info[i].dev_name, dev_name(icd->pdev)) == 0))
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(tmp_plat_data && (i < RK_CAM_NUM_PER_HOST) && tmp_plat_data->sensor_init_data[i]){
|
||||
//user has defined the init data
|
||||
//init reg
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
for(j = 0;j< sizeof(sensor_init_data)/sizeof(struct reginfo);j++){
|
||||
sensor_init_data[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].reg;
|
||||
sensor_init_data[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].val;
|
||||
}
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data){
|
||||
sensor_init_data_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data);
|
||||
}
|
||||
//init winseq
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
int tmp_winseq_size = tmp_plat_data->sensor_init_data[i]->rk_sensor_winseq_size;
|
||||
if(sensor_init_winseq_board)
|
||||
{
|
||||
vfree(sensor_init_winseq_board);
|
||||
sensor_init_winseq_board = NULL;
|
||||
}
|
||||
sensor_init_winseq_board = (struct reginfo*)vmalloc(tmp_winseq_size);
|
||||
if(!sensor_init_winseq_board)
|
||||
SENSOR_TR("%s :vmalloc erro !",__FUNCTION__);
|
||||
for(j = 0;j< tmp_winseq_size;j++){
|
||||
sensor_init_winseq_board[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].reg;
|
||||
sensor_init_winseq_board[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].val;
|
||||
}
|
||||
sensor_init_winseq_p = sensor_init_winseq_board;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq){
|
||||
sensor_init_winseq_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq);
|
||||
}
|
||||
//init width,height,bus,pixelcode
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width != INVALID_VALUE)
|
||||
sensor_init_width = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height != INVALID_VALUE)
|
||||
sensor_init_height = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param != INVALID_VALUE)
|
||||
sensor_init_busparam = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode != INVALID_VALUE)
|
||||
sensor_init_pixelcode = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode;
|
||||
}
|
||||
int ret,pid = 0;
|
||||
|
||||
SENSOR_DG("\n%s..%s.. \n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
|
||||
if (sensor_ioctrl(icd, Sensor_PowerDown, 0) < 0) {
|
||||
|
|
@ -1561,7 +1503,7 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
}
|
||||
#endif
|
||||
|
||||
ret = sensor_write_array(client, sensor_init_data_p);
|
||||
ret = sensor_write_array(client, sensor_init_data);
|
||||
if (ret != 0)
|
||||
{
|
||||
SENSOR_TR("error: %s initial failed\n",SENSOR_NAME_STRING());
|
||||
|
|
@ -2762,25 +2704,25 @@ static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
|
|||
SENSOR_DG("\n%s..%s..cmd:%x \n",SENSOR_NAME_STRING(),__FUNCTION__,cmd);
|
||||
switch (cmd)
|
||||
{
|
||||
case RK_CAM_SUBDEV_DEACTIVATE:
|
||||
case RK29_CAM_SUBDEV_DEACTIVATE:
|
||||
{
|
||||
sensor_deactivate(client);
|
||||
break;
|
||||
}
|
||||
|
||||
case RK_CAM_SUBDEV_IOREQUEST:
|
||||
case RK29_CAM_SUBDEV_IOREQUEST:
|
||||
{
|
||||
sensor->sensor_io_request = (struct rkcamera_platform_data*)arg;
|
||||
sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
|
||||
if (sensor->sensor_io_request != NULL) {
|
||||
if (sensor->sensor_io_request->gpio_res[0].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
} else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
}
|
||||
} else {
|
||||
SENSOR_TR("%s %s RK_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
ret = -EINVAL;
|
||||
goto sensor_ioctl_end;
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
110
drivers/media/video/ov2655.c
Normal file → Executable file
110
drivers/media/video/ov2655.c
Normal file → Executable file
|
|
@ -19,8 +19,8 @@ o* Driver for MT9M001 CMOS Image Sensor from Micron
|
|||
#include <media/v4l2-common.h>
|
||||
#include <media/v4l2-chip-ident.h>
|
||||
#include <media/soc_camera.h>
|
||||
#include <mach/rk_camera.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <mach/rk29_camera.h>
|
||||
|
||||
static int debug;
|
||||
module_param(debug, int, S_IRUGO|S_IWUSR);
|
||||
|
||||
|
|
@ -43,18 +43,17 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define MAX(x,y) ((x>y) ? x: y)
|
||||
|
||||
/* Sensor Driver Configuration */
|
||||
#define SENSOR_NAME RK_CAM_SENSOR_OV2655
|
||||
#define SENSOR_NAME RK29_CAM_SENSOR_OV2655
|
||||
#define SENSOR_V4L2_IDENT V4L2_IDENT_OV2655
|
||||
#define SENSOR_ID 0x2656
|
||||
#define SENSOR_MIN_WIDTH 176
|
||||
#define SENSOR_MIN_HEIGHT 144
|
||||
#define SENSOR_MAX_WIDTH 1600
|
||||
#define SENSOR_MAX_HEIGHT 1200
|
||||
#define SENSOR_INIT_WIDTH sensor_init_width /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT sensor_init_height
|
||||
#define SENSOR_INIT_WINSEQADR sensor_init_winseq_p
|
||||
#define SENSOR_INIT_PIXFMT sensor_init_pixelcode
|
||||
#define SENSOR_BUS_PARAM sensor_init_busparam
|
||||
#define SENSOR_INIT_WIDTH 640 /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT 480
|
||||
#define SENSOR_INIT_WINSEQADR sensor_vga
|
||||
#define SENSOR_INIT_PIXFMT V4L2_MBUS_FMT_UYVY8_2X8
|
||||
|
||||
#define CONFIG_SENSOR_WhiteBalance 1
|
||||
#define CONFIG_SENSOR_Brightness 0
|
||||
|
|
@ -74,6 +73,10 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define CONFIG_SENSOR_I2C_NOSCHED 0
|
||||
#define CONFIG_SENSOR_I2C_RDWRCHK 1
|
||||
|
||||
#define SENSOR_BUS_PARAM (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING |\
|
||||
SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW |\
|
||||
SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ)
|
||||
|
||||
#define COLOR_TEMPERATURE_CLOUDY_DN 6500
|
||||
#define COLOR_TEMPERATURE_CLOUDY_UP 8000
|
||||
#define COLOR_TEMPERATURE_CLEARDAY_DN 5000
|
||||
|
|
@ -94,14 +97,7 @@ struct reginfo
|
|||
u8 val;
|
||||
};
|
||||
|
||||
static s32 sensor_init_width = 0;
|
||||
static s32 sensor_init_height = 0;
|
||||
static unsigned long sensor_init_busparam = (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING|SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW |SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ);
|
||||
static enum v4l2_mbus_pixelcode sensor_init_pixelcode = V4L2_MBUS_FMT_YUYV8_2X8;
|
||||
static struct reginfo* sensor_init_data_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_board = NULL;
|
||||
/* init 800*600 SVGA */
|
||||
/* init 352X288 SVGA */
|
||||
static struct reginfo sensor_init_data[] =
|
||||
{
|
||||
{0x308c, 0x80},
|
||||
|
|
@ -1460,8 +1456,8 @@ struct sensor
|
|||
#if CONFIG_SENSOR_I2C_NOSCHED
|
||||
atomic_t tasklock_cnt;
|
||||
#endif
|
||||
struct rkcamera_platform_data *sensor_io_request;
|
||||
struct rkcamera_gpio_res *sensor_gpio_res;
|
||||
struct rk29camera_platform_data *sensor_io_request;
|
||||
struct rk29camera_gpio_res *sensor_gpio_res;
|
||||
};
|
||||
|
||||
static struct sensor* to_sensor(const struct i2c_client *client)
|
||||
|
|
@ -1643,7 +1639,7 @@ static int sensor_readchk_array(struct i2c_client *client, struct reginfo *regar
|
|||
return 0;
|
||||
}
|
||||
#endif
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd cmd, int on)
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd cmd, int on)
|
||||
{
|
||||
struct soc_camera_link *icl = to_soc_camera_link(icd);
|
||||
int ret = 0;
|
||||
|
|
@ -1656,13 +1652,13 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd c
|
|||
{
|
||||
if (icl->powerdown) {
|
||||
ret = icl->powerdown(icd->pdev, on);
|
||||
if (ret == RK_CAM_IO_SUCCESS) {
|
||||
if (ret == RK29_CAM_IO_SUCCESS) {
|
||||
if (on == 0) {
|
||||
mdelay(2);
|
||||
if (icl->reset)
|
||||
icl->reset(icd->pdev);
|
||||
}
|
||||
} else if (ret == RK_CAM_EIO_REQUESTFAIL) {
|
||||
} else if (ret == RK29_CAM_EIO_REQUESTFAIL) {
|
||||
ret = -ENODEV;
|
||||
goto sensor_power_end;
|
||||
}
|
||||
|
|
@ -1696,62 +1692,8 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
const struct v4l2_queryctrl *qctrl;
|
||||
const struct sensor_datafmt *fmt;
|
||||
char value;
|
||||
int ret,pid = 0,i = 0,j=0;
|
||||
struct rkcamera_platform_data* tmp_plat_data =(struct rkcamera_platform_data*)val;
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
sensor_init_winseq_p = sensor_vga;
|
||||
sensor_init_width = 640;
|
||||
sensor_init_height = 480;
|
||||
if (tmp_plat_data != NULL) {
|
||||
for(i = 0;i < RK_CAM_NUM_PER_HOST;i++){
|
||||
if ((tmp_plat_data->sensor_init_data[i])&& tmp_plat_data->info[i].dev_name &&
|
||||
(strcmp(tmp_plat_data->info[i].dev_name, dev_name(icd->pdev)) == 0))
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(tmp_plat_data && (i < RK_CAM_NUM_PER_HOST) && tmp_plat_data->sensor_init_data[i]){
|
||||
//user has defined the init data
|
||||
//init reg
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
for(j = 0;j< sizeof(sensor_init_data)/sizeof(struct reginfo);j++){
|
||||
sensor_init_data[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].reg;
|
||||
sensor_init_data[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].val;
|
||||
}
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data){
|
||||
sensor_init_data_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data);
|
||||
}
|
||||
//init winseq
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
int tmp_winseq_size = tmp_plat_data->sensor_init_data[i]->rk_sensor_winseq_size;
|
||||
if(sensor_init_winseq_board)
|
||||
{
|
||||
vfree(sensor_init_winseq_board);
|
||||
sensor_init_winseq_board = NULL;
|
||||
}
|
||||
sensor_init_winseq_board = (struct reginfo*)vmalloc(tmp_winseq_size);
|
||||
if(!sensor_init_winseq_board)
|
||||
SENSOR_TR("%s :vmalloc erro !",__FUNCTION__);
|
||||
for(j = 0;j< tmp_winseq_size;j++){
|
||||
sensor_init_winseq_board[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].reg;
|
||||
sensor_init_winseq_board[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].val;
|
||||
}
|
||||
sensor_init_winseq_p = sensor_init_winseq_board;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq){
|
||||
sensor_init_winseq_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq);
|
||||
}
|
||||
//init width,height,bus,pixelcode
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width != INVALID_VALUE)
|
||||
sensor_init_width = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height != INVALID_VALUE)
|
||||
sensor_init_height = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param != INVALID_VALUE)
|
||||
sensor_init_busparam = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode != INVALID_VALUE)
|
||||
sensor_init_pixelcode = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode;
|
||||
}
|
||||
int ret,pid = 0;
|
||||
|
||||
SENSOR_DG("\n%s..%s.. \n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
|
||||
if (sensor_ioctrl(icd, Sensor_PowerDown, 0) < 0) {
|
||||
|
|
@ -1802,7 +1744,7 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
goto sensor_INIT_ERR;
|
||||
}
|
||||
|
||||
ret = sensor_write_array(client, sensor_init_data_p);
|
||||
ret = sensor_write_array(client, sensor_init_data);
|
||||
if (ret != 0)
|
||||
{
|
||||
SENSOR_TR("error: %s initial failed\n",SENSOR_NAME_STRING());
|
||||
|
|
@ -2965,25 +2907,25 @@ static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
|
|||
SENSOR_DG("\n%s..%s..cmd:%x \n",SENSOR_NAME_STRING(),__FUNCTION__,cmd);
|
||||
switch (cmd)
|
||||
{
|
||||
case RK_CAM_SUBDEV_DEACTIVATE:
|
||||
case RK29_CAM_SUBDEV_DEACTIVATE:
|
||||
{
|
||||
sensor_deactivate(client);
|
||||
break;
|
||||
}
|
||||
|
||||
case RK_CAM_SUBDEV_IOREQUEST:
|
||||
case RK29_CAM_SUBDEV_IOREQUEST:
|
||||
{
|
||||
sensor->sensor_io_request = (struct rkcamera_platform_data*)arg;
|
||||
sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
|
||||
if (sensor->sensor_io_request != NULL) {
|
||||
if (sensor->sensor_io_request->gpio_res[0].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
} else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
}
|
||||
} else {
|
||||
SENSOR_TR("%s %s RK_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
ret = -EINVAL;
|
||||
goto sensor_ioctl_end;
|
||||
}
|
||||
|
|
|
|||
131
drivers/media/video/ov2659.c
Normal file → Executable file
131
drivers/media/video/ov2659.c
Normal file → Executable file
|
|
@ -19,8 +19,8 @@ o* Driver for MT9M001 CMOS Image Sensor from Micron
|
|||
#include <media/v4l2-common.h>
|
||||
#include <media/v4l2-chip-ident.h>
|
||||
#include <media/soc_camera.h>
|
||||
#include <mach/rk_camera.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <mach/rk29_camera.h>
|
||||
|
||||
static int debug;
|
||||
module_param(debug, int, S_IRUGO|S_IWUSR);
|
||||
|
||||
|
|
@ -43,18 +43,17 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define MAX(x,y) ((x>y) ? x: y)
|
||||
|
||||
/* Sensor Driver Configuration */
|
||||
#define SENSOR_NAME RK_CAM_SENSOR_OV2659
|
||||
#define SENSOR_NAME RK29_CAM_SENSOR_OV2659
|
||||
#define SENSOR_V4L2_IDENT V4L2_IDENT_OV2659
|
||||
#define SENSOR_ID 0x2656
|
||||
#define SENSOR_MIN_WIDTH 800
|
||||
#define SENSOR_MIN_HEIGHT 600
|
||||
#define SENSOR_MAX_WIDTH 1600
|
||||
#define SENSOR_MAX_HEIGHT 1200
|
||||
#define SENSOR_INIT_WIDTH sensor_init_width /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT sensor_init_height
|
||||
#define SENSOR_INIT_WINSEQADR sensor_init_winseq_p
|
||||
#define SENSOR_INIT_PIXFMT sensor_init_pixelcode
|
||||
#define SENSOR_BUS_PARAM sensor_init_busparam
|
||||
#define SENSOR_INIT_WIDTH 800 /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT 600
|
||||
#define SENSOR_INIT_WINSEQADR sensor_svga
|
||||
#define SENSOR_INIT_PIXFMT V4L2_MBUS_FMT_YUYV8_2X8
|
||||
|
||||
#define CONFIG_SENSOR_WhiteBalance 1
|
||||
#define CONFIG_SENSOR_Brightness 0
|
||||
|
|
@ -69,11 +68,15 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define CONFIG_SENSOR_Mirror 0
|
||||
#define CONFIG_SENSOR_Flip 0
|
||||
|
||||
#define CONFIG_SENSOR_I2C_SPEED 100000 /* Hz */
|
||||
#define CONFIG_SENSOR_I2C_SPEED 350000 /* Hz */
|
||||
/* Sensor write register continues by preempt_disable/preempt_enable for current process not be scheduled */
|
||||
#define CONFIG_SENSOR_I2C_NOSCHED 0
|
||||
#define CONFIG_SENSOR_I2C_RDWRCHK 0
|
||||
|
||||
#define SENSOR_BUS_PARAM (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING|\
|
||||
SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW |\
|
||||
SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ)
|
||||
|
||||
#define COLOR_TEMPERATURE_CLOUDY_DN 6500
|
||||
#define COLOR_TEMPERATURE_CLOUDY_UP 8000
|
||||
#define COLOR_TEMPERATURE_CLEARDAY_DN 5000
|
||||
|
|
@ -90,19 +93,12 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define SENSOR_AF_IS_OK (0x01<<0)
|
||||
#define SENSOR_INIT_IS_ERR (0x00<<28)
|
||||
#define SENSOR_INIT_IS_OK (0x01<<28)
|
||||
|
||||
struct reginfo
|
||||
{
|
||||
u16 reg;
|
||||
u8 val;
|
||||
u16 reg;
|
||||
u8 val;
|
||||
};
|
||||
|
||||
static s32 sensor_init_width = 0;
|
||||
static s32 sensor_init_height = 0;
|
||||
static unsigned long sensor_init_busparam = (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING|SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW |SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ);
|
||||
static enum v4l2_mbus_pixelcode sensor_init_pixelcode = V4L2_MBUS_FMT_YUYV8_2X8;
|
||||
static struct reginfo* sensor_init_data_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_board = NULL;
|
||||
/* init 800*600 SVGA */
|
||||
static struct reginfo sensor_init_data[] =
|
||||
{
|
||||
|
|
@ -1276,8 +1272,8 @@ struct sensor
|
|||
#if CONFIG_SENSOR_I2C_NOSCHED
|
||||
atomic_t tasklock_cnt;
|
||||
#endif
|
||||
struct rkcamera_platform_data *sensor_io_request;
|
||||
struct rkcamera_gpio_res *sensor_gpio_res;
|
||||
struct rk29camera_platform_data *sensor_io_request;
|
||||
struct rk29camera_gpio_res *sensor_gpio_res;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -1461,11 +1457,11 @@ static int sensor_readchk_array(struct i2c_client *client, struct reginfo *regar
|
|||
return 0;
|
||||
}
|
||||
#endif
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd cmd, int on)
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd cmd, int on)
|
||||
{
|
||||
struct soc_camera_link *icl = to_soc_camera_link(icd);
|
||||
int ret = 0;
|
||||
return 0;
|
||||
|
||||
SENSOR_DG("%s %s cmd(%d) on(%d)\n",SENSOR_NAME_STRING(),__FUNCTION__,cmd,on);
|
||||
switch (cmd)
|
||||
{
|
||||
|
|
@ -1473,13 +1469,13 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd c
|
|||
{
|
||||
if (icl->powerdown) {
|
||||
ret = icl->powerdown(icd->pdev, on);
|
||||
if (ret == RK_CAM_IO_SUCCESS) {
|
||||
if (ret == RK29_CAM_IO_SUCCESS) {
|
||||
if (on == 0) {
|
||||
mdelay(2);
|
||||
if (icl->reset)
|
||||
icl->reset(icd->pdev);
|
||||
}
|
||||
} else if (ret == RK_CAM_EIO_REQUESTFAIL) {
|
||||
} else if (ret == RK29_CAM_EIO_REQUESTFAIL) {
|
||||
ret = -ENODEV;
|
||||
goto sensor_power_end;
|
||||
}
|
||||
|
|
@ -1513,62 +1509,8 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
const struct v4l2_queryctrl *qctrl;
|
||||
const struct sensor_datafmt *fmt;
|
||||
char value;
|
||||
int ret,pid = 0,i = 0,j=0;
|
||||
struct rkcamera_platform_data* tmp_plat_data =(struct rkcamera_platform_data*)val;
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
sensor_init_winseq_p = sensor_svga;
|
||||
sensor_init_width = 800;
|
||||
sensor_init_height = 600;
|
||||
if (tmp_plat_data != NULL) {
|
||||
for(i = 0;i < RK_CAM_NUM_PER_HOST;i++){
|
||||
if ((tmp_plat_data->sensor_init_data[i])&& tmp_plat_data->info[i].dev_name &&
|
||||
(strcmp(tmp_plat_data->info[i].dev_name, dev_name(icd->pdev)) == 0))
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(tmp_plat_data && (i < RK_CAM_NUM_PER_HOST) && tmp_plat_data->sensor_init_data[i]){
|
||||
//user has defined the init data
|
||||
//init reg
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
for(j = 0;j< sizeof(sensor_init_data)/sizeof(struct reginfo);j++){
|
||||
sensor_init_data[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].reg;
|
||||
sensor_init_data[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].val;
|
||||
}
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data){
|
||||
sensor_init_data_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data);
|
||||
}
|
||||
//init winseq
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
int tmp_winseq_size = tmp_plat_data->sensor_init_data[i]->rk_sensor_winseq_size;
|
||||
if(sensor_init_winseq_board)
|
||||
{
|
||||
vfree(sensor_init_winseq_board);
|
||||
sensor_init_winseq_board = NULL;
|
||||
}
|
||||
sensor_init_winseq_board = (struct reginfo*)vmalloc(tmp_winseq_size);
|
||||
if(!sensor_init_winseq_board)
|
||||
SENSOR_TR("%s :vmalloc erro !",__FUNCTION__);
|
||||
for(j = 0;j< tmp_winseq_size;j++){
|
||||
sensor_init_winseq_board[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].reg;
|
||||
sensor_init_winseq_board[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].val;
|
||||
}
|
||||
sensor_init_winseq_p = sensor_init_winseq_board;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq){
|
||||
sensor_init_winseq_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq);
|
||||
}
|
||||
//init width,height,bus,pixelcode
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width != INVALID_VALUE)
|
||||
sensor_init_width = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height != INVALID_VALUE)
|
||||
sensor_init_height = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param != INVALID_VALUE)
|
||||
sensor_init_busparam = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode != INVALID_VALUE)
|
||||
sensor_init_pixelcode = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode;
|
||||
}
|
||||
int ret,pid = 0;
|
||||
|
||||
SENSOR_DG("\n%s..%s.. \n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
|
||||
if (sensor_ioctrl(icd, Sensor_PowerDown, 0) < 0) {
|
||||
|
|
@ -1616,7 +1558,7 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
goto sensor_INIT_ERR;
|
||||
}
|
||||
|
||||
ret = sensor_write_array(client, sensor_init_data_p);
|
||||
ret = sensor_write_array(client, sensor_init_data);
|
||||
if (ret != 0)
|
||||
{
|
||||
SENSOR_TR("error: %s initial failed\n",SENSOR_NAME_STRING());
|
||||
|
|
@ -2753,7 +2695,7 @@ static int sensor_video_probe(struct soc_camera_device *icd,
|
|||
struct i2c_client *client)
|
||||
{
|
||||
char value;
|
||||
int ret,pid = 0,i=0;
|
||||
int ret,pid = 0;
|
||||
struct sensor *sensor = to_sensor(client);
|
||||
|
||||
/* We must have a parent by now. And it cannot be a wrong one.
|
||||
|
|
@ -2764,9 +2706,9 @@ static int sensor_video_probe(struct soc_camera_device *icd,
|
|||
|
||||
if (sensor_ioctrl(icd, Sensor_PowerDown, 0) < 0) {
|
||||
ret = -ENODEV;
|
||||
printk("sensor ioctrl powdown erro!!!");
|
||||
goto sensor_video_probe_err;
|
||||
}
|
||||
|
||||
/* soft reset */
|
||||
ret = sensor_write(client, 0x0103, 0x01);
|
||||
if (ret != 0) {
|
||||
|
|
@ -2792,6 +2734,7 @@ static int sensor_video_probe(struct soc_camera_device *icd,
|
|||
ret = -ENODEV;
|
||||
goto sensor_video_probe_err;
|
||||
}
|
||||
|
||||
pid |= (value & 0xff);
|
||||
SENSOR_DG("\n %s pid = 0x%x\n", SENSOR_NAME_STRING(), pid);
|
||||
if (pid == SENSOR_ID) {
|
||||
|
|
@ -2801,11 +2744,10 @@ static int sensor_video_probe(struct soc_camera_device *icd,
|
|||
ret = -ENODEV;
|
||||
goto sensor_video_probe_err;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
sensor_video_probe_err:
|
||||
printk("the erro value = %d\n",i);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -2823,25 +2765,25 @@ static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
|
|||
SENSOR_DG("\n%s..%s..cmd:%x \n",SENSOR_NAME_STRING(),__FUNCTION__,cmd);
|
||||
switch (cmd)
|
||||
{
|
||||
case RK_CAM_SUBDEV_DEACTIVATE:
|
||||
case RK29_CAM_SUBDEV_DEACTIVATE:
|
||||
{
|
||||
sensor_deactivate(client);
|
||||
break;
|
||||
}
|
||||
|
||||
case RK_CAM_SUBDEV_IOREQUEST:
|
||||
case RK29_CAM_SUBDEV_IOREQUEST:
|
||||
{
|
||||
sensor->sensor_io_request = (struct rkcamera_platform_data*)arg;
|
||||
sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
|
||||
if (sensor->sensor_io_request != NULL) {
|
||||
if (sensor->sensor_io_request->gpio_res[0].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
} else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
}
|
||||
} else {
|
||||
SENSOR_TR("%s %s RK_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
ret = -EINVAL;
|
||||
goto sensor_ioctl_end;
|
||||
}
|
||||
|
|
@ -2965,11 +2907,6 @@ static int sensor_remove(struct i2c_client *client)
|
|||
client->driver = NULL;
|
||||
kfree(sensor);
|
||||
sensor = NULL;
|
||||
if(sensor_init_winseq_board)
|
||||
{
|
||||
vfree(sensor_init_winseq_board);
|
||||
sensor_init_winseq_board = NULL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,9 +19,7 @@
|
|||
#include <media/v4l2-common.h>
|
||||
#include <media/v4l2-chip-ident.h>
|
||||
#include <media/soc_camera.h>
|
||||
#include <mach/rk_camera.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <mach/rk29_camera.h>
|
||||
#include "ov3640.h"
|
||||
|
||||
static int debug;
|
||||
|
|
@ -45,18 +43,17 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define MAX(x,y) ((x>y) ? x: y)
|
||||
|
||||
/* Sensor Driver Configuration */
|
||||
#define SENSOR_NAME RK_CAM_SENSOR_OV3640
|
||||
#define SENSOR_NAME RK29_CAM_SENSOR_OV3640
|
||||
#define SENSOR_V4L2_IDENT V4L2_IDENT_OV3640
|
||||
#define SENSOR_ID 0x364c
|
||||
#define SENSOR_MIN_WIDTH 176
|
||||
#define SENSOR_MIN_HEIGHT 144
|
||||
#define SENSOR_MAX_WIDTH 2048
|
||||
#define SENSOR_MAX_HEIGHT 1536
|
||||
#define SENSOR_INIT_WIDTH sensor_init_width /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT sensor_init_height
|
||||
#define SENSOR_INIT_WINSEQADR sensor_init_winseq_p
|
||||
#define SENSOR_INIT_PIXFMT sensor_init_pixelcode
|
||||
#define SENSOR_BUS_PARAM sensor_init_busparam
|
||||
#define SENSOR_INIT_WIDTH 640 /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT 480
|
||||
#define SENSOR_INIT_WINSEQADR sensor_init_data
|
||||
#define SENSOR_INIT_PIXFMT V4L2_MBUS_FMT_YUYV8_2X8
|
||||
|
||||
#define CONFIG_SENSOR_WhiteBalance 1
|
||||
#define CONFIG_SENSOR_Brightness 0
|
||||
|
|
@ -81,6 +78,11 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define CONFIG_SENSOR_I2C_NOSCHED 0
|
||||
#define CONFIG_SENSOR_I2C_RDWRCHK 0
|
||||
|
||||
|
||||
#define SENSOR_BUS_PARAM (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING |\
|
||||
SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW |\
|
||||
SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ)
|
||||
|
||||
#define COLOR_TEMPERATURE_CLOUDY_DN 6500
|
||||
#define COLOR_TEMPERATURE_CLOUDY_UP 8000
|
||||
#define COLOR_TEMPERATURE_CLEARDAY_DN 5000
|
||||
|
|
@ -185,12 +187,6 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define StepFocus_Spec_Tag 0x10
|
||||
#endif
|
||||
|
||||
static s32 sensor_init_height = 0;
|
||||
static unsigned long sensor_init_busparam = (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING|SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW |SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ);
|
||||
static enum v4l2_mbus_pixelcode sensor_init_pixelcode = V4L2_MBUS_FMT_YUYV8_2X8;
|
||||
static struct reginfo* sensor_init_data_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_board = NULL;
|
||||
/* init VGA 640*480 */
|
||||
static struct reginfo sensor_init_data[] =
|
||||
{
|
||||
|
|
@ -1995,8 +1991,8 @@ struct sensor
|
|||
#if CONFIG_SENSOR_I2C_NOSCHED
|
||||
atomic_t tasklock_cnt;
|
||||
#endif
|
||||
struct rkcamera_platform_data *sensor_io_request;
|
||||
struct rkcamera_gpio_res *sensor_gpio_res;
|
||||
struct rk29camera_platform_data *sensor_io_request;
|
||||
struct rk29camera_gpio_res *sensor_gpio_res;
|
||||
};
|
||||
|
||||
static struct sensor* to_sensor(const struct i2c_client *client)
|
||||
|
|
@ -2500,7 +2496,7 @@ static void sensor_af_workqueue(struct work_struct *work)
|
|||
}
|
||||
#endif
|
||||
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd cmd, int on)
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd cmd, int on)
|
||||
{
|
||||
struct soc_camera_link *icl = to_soc_camera_link(icd);
|
||||
int ret = 0;
|
||||
|
|
@ -2513,13 +2509,13 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd c
|
|||
{
|
||||
if (icl->powerdown) {
|
||||
ret = icl->powerdown(icd->pdev, on);
|
||||
if (ret == RK_CAM_IO_SUCCESS) {
|
||||
if (ret == RK29_CAM_IO_SUCCESS) {
|
||||
if (on == 0) {
|
||||
mdelay(2);
|
||||
if (icl->reset)
|
||||
icl->reset(icd->pdev);
|
||||
}
|
||||
} else if (ret == RK_CAM_EIO_REQUESTFAIL) {
|
||||
} else if (ret == RK29_CAM_EIO_REQUESTFAIL) {
|
||||
ret = -ENODEV;
|
||||
goto sensor_power_end;
|
||||
}
|
||||
|
|
@ -2554,62 +2550,8 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
const struct v4l2_queryctrl *qctrl;
|
||||
const struct sensor_datafmt *fmt;
|
||||
char value;
|
||||
int ret,pid = 0,i = 0,j=0;
|
||||
struct rkcamera_platform_data* tmp_plat_data =(struct rkcamera_platform_data*)val;
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
sensor_init_winseq_p = sensor_vga;
|
||||
sensor_init_width = 640;
|
||||
sensor_init_height = 480;
|
||||
if (tmp_plat_data != NULL) {
|
||||
for(i = 0;i < RK_CAM_NUM_PER_HOST;i++){
|
||||
if ((tmp_plat_data->sensor_init_data[i])&& tmp_plat_data->info[i].dev_name &&
|
||||
(strcmp(tmp_plat_data->info[i].dev_name, dev_name(icd->pdev)) == 0))
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(tmp_plat_data && (i < RK_CAM_NUM_PER_HOST) && tmp_plat_data->sensor_init_data[i]){
|
||||
//user has defined the init data
|
||||
//init reg
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
for(j = 0;j< sizeof(sensor_init_data)/sizeof(struct reginfo);j++){
|
||||
sensor_init_data[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].reg;
|
||||
sensor_init_data[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].val;
|
||||
}
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data){
|
||||
sensor_init_data_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data);
|
||||
}
|
||||
//init winseq
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
int tmp_winseq_size = tmp_plat_data->sensor_init_data[i]->rk_sensor_winseq_size;
|
||||
if(sensor_init_winseq_board)
|
||||
{
|
||||
vfree(sensor_init_winseq_board);
|
||||
sensor_init_winseq_board = NULL;
|
||||
}
|
||||
sensor_init_winseq_board = (struct reginfo*)vmalloc(tmp_winseq_size);
|
||||
if(!sensor_init_winseq_board)
|
||||
SENSOR_TR("%s :vmalloc erro !",__FUNCTION__);
|
||||
for(j = 0;j< tmp_winseq_size;j++){
|
||||
sensor_init_winseq_board[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].reg;
|
||||
sensor_init_winseq_board[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].val;
|
||||
}
|
||||
sensor_init_winseq_p = sensor_init_winseq_board;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq){
|
||||
sensor_init_winseq_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq);
|
||||
}
|
||||
//init width,height,bus,pixelcode
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width != INVALID_VALUE)
|
||||
sensor_init_width = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height != INVALID_VALUE)
|
||||
sensor_init_height = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param != INVALID_VALUE)
|
||||
sensor_init_busparam = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode != INVALID_VALUE)
|
||||
sensor_init_pixelcode = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode;
|
||||
}
|
||||
int ret,pid = 0;
|
||||
|
||||
SENSOR_DG("\n%s..%s.. \n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
|
||||
if (sensor_ioctrl(icd, Sensor_PowerDown, 0) < 0) {
|
||||
|
|
@ -2658,7 +2600,7 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
goto sensor_INIT_ERR;
|
||||
}
|
||||
|
||||
ret = sensor_write_array(client, sensor_init_data_p);
|
||||
ret = sensor_write_array(client, sensor_init_data);
|
||||
if (ret != 0)
|
||||
{
|
||||
SENSOR_TR("error: %s initial failed\n",SENSOR_NAME_STRING());
|
||||
|
|
@ -4036,24 +3978,24 @@ static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
|
|||
SENSOR_DG("\n%s..%s..cmd:%x \n",SENSOR_NAME_STRING(),__FUNCTION__,cmd);
|
||||
switch (cmd)
|
||||
{
|
||||
case RK_CAM_SUBDEV_DEACTIVATE:
|
||||
case RK29_CAM_SUBDEV_DEACTIVATE:
|
||||
{
|
||||
sensor_deactivate(client);
|
||||
break;
|
||||
}
|
||||
case RK_CAM_SUBDEV_IOREQUEST:
|
||||
case RK29_CAM_SUBDEV_IOREQUEST:
|
||||
{
|
||||
sensor->sensor_io_request = (struct rkcamera_platform_data*)arg;
|
||||
sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
|
||||
if (sensor->sensor_io_request != NULL) {
|
||||
if (sensor->sensor_io_request->gpio_res[0].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
} else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
}
|
||||
} else {
|
||||
SENSOR_TR("%s %s RK_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
ret = -EINVAL;
|
||||
goto sensor_ioctl_end;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
#include <media/v4l2-common.h>
|
||||
#include <media/v4l2-chip-ident.h>
|
||||
#include <media/soc_camera.h>
|
||||
#include <mach/rk_camera.h>
|
||||
#include <mach/rk29_camera.h>
|
||||
#include "ov5640.h"
|
||||
|
||||
static int debug;
|
||||
|
|
@ -43,7 +43,7 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define MAX(x,y) ((x>y) ? x: y)
|
||||
|
||||
/* Sensor Driver Configuration */
|
||||
#define SENSOR_NAME RK_CAM_SENSOR_OV5640
|
||||
#define SENSOR_NAME RK29_CAM_SENSOR_OV5640
|
||||
#define SENSOR_V4L2_IDENT V4L2_IDENT_OV5640
|
||||
#define SENSOR_ID 0x5640
|
||||
#define SENSOR_MIN_WIDTH 176
|
||||
|
|
@ -1457,8 +1457,8 @@ struct sensor
|
|||
#if CONFIG_SENSOR_I2C_NOSCHED
|
||||
atomic_t tasklock_cnt;
|
||||
#endif
|
||||
struct rkcamera_platform_data *sensor_io_request;
|
||||
struct rkcamera_gpio_res *sensor_gpio_res;
|
||||
struct rk29camera_platform_data *sensor_io_request;
|
||||
struct rk29camera_gpio_res *sensor_gpio_res;
|
||||
};
|
||||
|
||||
static struct sensor* to_sensor(const struct i2c_client *client)
|
||||
|
|
@ -2317,7 +2317,7 @@ static int sensor_ae_transfer(struct i2c_client *client)
|
|||
mdelay(100);
|
||||
return 0;
|
||||
}
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd cmd, int on)
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd cmd, int on)
|
||||
{
|
||||
struct soc_camera_link *icl = to_soc_camera_link(icd);
|
||||
int ret = 0;
|
||||
|
|
@ -2330,13 +2330,13 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd c
|
|||
{
|
||||
if (icl->powerdown) {
|
||||
ret = icl->powerdown(icd->pdev, on);
|
||||
if (ret == RK_CAM_IO_SUCCESS) {
|
||||
if (ret == RK29_CAM_IO_SUCCESS) {
|
||||
if (on == 0) {
|
||||
mdelay(2);
|
||||
if (icl->reset)
|
||||
icl->reset(icd->pdev);
|
||||
}
|
||||
} else if (ret == RK_CAM_EIO_REQUESTFAIL) {
|
||||
} else if (ret == RK29_CAM_EIO_REQUESTFAIL) {
|
||||
ret = -ENODEV;
|
||||
goto sensor_power_end;
|
||||
}
|
||||
|
|
@ -3779,24 +3779,24 @@ static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
|
|||
SENSOR_DG("\n%s..%s..cmd:%x \n",SENSOR_NAME_STRING(),__FUNCTION__,cmd);
|
||||
switch (cmd)
|
||||
{
|
||||
case RK_CAM_SUBDEV_DEACTIVATE:
|
||||
case RK29_CAM_SUBDEV_DEACTIVATE:
|
||||
{
|
||||
sensor_deactivate(client);
|
||||
break;
|
||||
}
|
||||
case RK_CAM_SUBDEV_IOREQUEST:
|
||||
case RK29_CAM_SUBDEV_IOREQUEST:
|
||||
{
|
||||
sensor->sensor_io_request = (struct rkcamera_platform_data*)arg;
|
||||
sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
|
||||
if (sensor->sensor_io_request != NULL) {
|
||||
if (sensor->sensor_io_request->gpio_res[0].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
} else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
}
|
||||
} else {
|
||||
SENSOR_TR("%s %s RK_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
ret = -EINVAL;
|
||||
goto sensor_ioctl_end;
|
||||
}
|
||||
|
|
|
|||
26
drivers/media/video/ov5640_for_td8801.c
Executable file → Normal file
26
drivers/media/video/ov5640_for_td8801.c
Executable file → Normal file
|
|
@ -19,7 +19,7 @@
|
|||
#include <media/v4l2-common.h>
|
||||
#include <media/v4l2-chip-ident.h>
|
||||
#include <media/soc_camera.h>
|
||||
#include <mach/rk_camera.h>
|
||||
#include <mach/rk29_camera.h>
|
||||
#include "ov5640.h"
|
||||
|
||||
static int debug = 1;
|
||||
|
|
@ -43,7 +43,7 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define MAX(x,y) ((x>y) ? x: y)
|
||||
|
||||
/* Sensor Driver Configuration */
|
||||
#define SENSOR_NAME RK_CAM_SENSOR_OV5640
|
||||
#define SENSOR_NAME RK29_CAM_SENSOR_OV5640
|
||||
#define SENSOR_V4L2_IDENT V4L2_IDENT_OV5640
|
||||
#define SENSOR_ID 0x5640
|
||||
#define SENSOR_MIN_WIDTH 176
|
||||
|
|
@ -1457,8 +1457,8 @@ struct sensor
|
|||
#if CONFIG_SENSOR_I2C_NOSCHED
|
||||
atomic_t tasklock_cnt;
|
||||
#endif
|
||||
struct rkcamera_platform_data *sensor_io_request;
|
||||
struct rkcamera_gpio_res *sensor_gpio_res;
|
||||
struct rk29camera_platform_data *sensor_io_request;
|
||||
struct rk29camera_gpio_res *sensor_gpio_res;
|
||||
};
|
||||
|
||||
static struct sensor* to_sensor(const struct i2c_client *client)
|
||||
|
|
@ -2317,7 +2317,7 @@ static int sensor_ae_transfer(struct i2c_client *client)
|
|||
mdelay(100);
|
||||
return 0;
|
||||
}
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd cmd, int on)
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd cmd, int on)
|
||||
{
|
||||
struct soc_camera_link *icl = to_soc_camera_link(icd);
|
||||
int ret = 0;
|
||||
|
|
@ -2330,13 +2330,13 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd c
|
|||
{
|
||||
if (icl->powerdown) {
|
||||
ret = icl->powerdown(icd->pdev, on);
|
||||
if (ret == RK_CAM_IO_SUCCESS) {
|
||||
if (ret == RK29_CAM_IO_SUCCESS) {
|
||||
if (on == 0) {
|
||||
mdelay(2);
|
||||
if (icl->reset)
|
||||
icl->reset(icd->pdev);
|
||||
}
|
||||
} else if (ret == RK_CAM_EIO_REQUESTFAIL) {
|
||||
} else if (ret == RK29_CAM_EIO_REQUESTFAIL) {
|
||||
ret = -ENODEV;
|
||||
goto sensor_power_end;
|
||||
}
|
||||
|
|
@ -3779,24 +3779,24 @@ static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
|
|||
SENSOR_DG("\n%s..%s..cmd:%x \n",SENSOR_NAME_STRING(),__FUNCTION__,cmd);
|
||||
switch (cmd)
|
||||
{
|
||||
case RK_CAM_SUBDEV_DEACTIVATE:
|
||||
case RK29_CAM_SUBDEV_DEACTIVATE:
|
||||
{
|
||||
sensor_deactivate(client);
|
||||
break;
|
||||
}
|
||||
case RK_CAM_SUBDEV_IOREQUEST:
|
||||
case RK29_CAM_SUBDEV_IOREQUEST:
|
||||
{
|
||||
sensor->sensor_io_request = (struct rkcamera_platform_data*)arg;
|
||||
sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
|
||||
if (sensor->sensor_io_request != NULL) {
|
||||
if (sensor->sensor_io_request->gpio_res[0].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
} else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
}
|
||||
} else {
|
||||
SENSOR_TR("%s %s RK_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
ret = -EINVAL;
|
||||
goto sensor_ioctl_end;
|
||||
}
|
||||
|
|
|
|||
110
drivers/media/video/ov5642.c
Normal file → Executable file
110
drivers/media/video/ov5642.c
Normal file → Executable file
|
|
@ -19,8 +19,7 @@
|
|||
#include <media/v4l2-common.h>
|
||||
#include <media/v4l2-chip-ident.h>
|
||||
#include <media/soc_camera.h>
|
||||
#include <mach/rk_camera.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <mach/rk29_camera.h>
|
||||
#include "ov5642.h"
|
||||
|
||||
static int debug;
|
||||
|
|
@ -44,18 +43,17 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define MAX(x,y) ((x>y) ? x: y)
|
||||
|
||||
/* Sensor Driver Configuration */
|
||||
#define SENSOR_NAME RK_CAM_SENSOR_OV5642
|
||||
#define SENSOR_NAME RK29_CAM_SENSOR_OV5642
|
||||
#define SENSOR_V4L2_IDENT V4L2_IDENT_OV5642
|
||||
#define SENSOR_ID 0x5642
|
||||
#define SENSOR_MIN_WIDTH 176
|
||||
#define SENSOR_MIN_HEIGHT 144
|
||||
#define SENSOR_MAX_WIDTH 2592
|
||||
#define SENSOR_MAX_HEIGHT 1944
|
||||
#define SENSOR_INIT_WIDTH sensor_init_width /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT sensor_init_height
|
||||
#define SENSOR_INIT_WINSEQADR sensor_init_winseq_p
|
||||
#define SENSOR_INIT_PIXFMT sensor_init_pixelcode
|
||||
#define SENSOR_BUS_PARAM sensor_init_busparam
|
||||
#define SENSOR_INIT_WIDTH 800 /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT 600
|
||||
#define SENSOR_INIT_WINSEQADR sensor_svga
|
||||
#define SENSOR_INIT_PIXFMT V4L2_MBUS_FMT_UYVY8_2X8
|
||||
|
||||
#define CONFIG_SENSOR_WhiteBalance 1
|
||||
#define CONFIG_SENSOR_Brightness 0
|
||||
|
|
@ -80,6 +78,11 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define CONFIG_SENSOR_I2C_NOSCHED 0
|
||||
#define CONFIG_SENSOR_I2C_RDWRCHK 0
|
||||
|
||||
|
||||
#define SENSOR_BUS_PARAM (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING |\
|
||||
SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW |\
|
||||
SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ)
|
||||
|
||||
#define COLOR_TEMPERATURE_CLOUDY_DN 6500
|
||||
#define COLOR_TEMPERATURE_CLOUDY_UP 8000
|
||||
#define COLOR_TEMPERATURE_CLEARDAY_DN 5000
|
||||
|
|
@ -162,12 +165,6 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define StepFocus_Spec_Tag 0x10
|
||||
#endif
|
||||
|
||||
static s32 sensor_init_height = 0;
|
||||
static unsigned long sensor_init_busparam = (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING|SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW |SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ);
|
||||
static enum v4l2_mbus_pixelcode sensor_init_pixelcode = V4L2_MBUS_FMT_YUYV8_2X8;
|
||||
static struct reginfo* sensor_init_data_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_board = NULL;
|
||||
/* init 800X600 SVGA */
|
||||
static struct reginfo sensor_init_data[] =
|
||||
{
|
||||
|
|
@ -3377,8 +3374,8 @@ struct sensor
|
|||
#if CONFIG_SENSOR_I2C_NOSCHED
|
||||
atomic_t tasklock_cnt;
|
||||
#endif
|
||||
struct rkcamera_platform_data *sensor_io_request;
|
||||
struct rkcamera_gpio_res *sensor_gpio_res;
|
||||
struct rk29camera_platform_data *sensor_io_request;
|
||||
struct rk29camera_gpio_res *sensor_gpio_res;
|
||||
};
|
||||
|
||||
static struct sensor* to_sensor(const struct i2c_client *client)
|
||||
|
|
@ -4200,7 +4197,7 @@ static int sensor_ae_transfer(struct i2c_client *client)
|
|||
mdelay(100);
|
||||
return 0;
|
||||
}
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd cmd, int on)
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd cmd, int on)
|
||||
{
|
||||
struct soc_camera_link *icl = to_soc_camera_link(icd);
|
||||
int ret = 0;
|
||||
|
|
@ -4213,13 +4210,13 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd c
|
|||
{
|
||||
if (icl->powerdown) {
|
||||
ret = icl->powerdown(icd->pdev, on);
|
||||
if (ret == RK_CAM_IO_SUCCESS) {
|
||||
if (ret == RK29_CAM_IO_SUCCESS) {
|
||||
if (on == 0) {
|
||||
mdelay(2);
|
||||
if (icl->reset)
|
||||
icl->reset(icd->pdev);
|
||||
}
|
||||
} else if (ret == RK_CAM_EIO_REQUESTFAIL) {
|
||||
} else if (ret == RK29_CAM_EIO_REQUESTFAIL) {
|
||||
ret = -ENODEV;
|
||||
goto sensor_power_end;
|
||||
}
|
||||
|
|
@ -4254,62 +4251,8 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
const struct v4l2_queryctrl *qctrl;
|
||||
const struct sensor_datafmt *fmt;
|
||||
char value;
|
||||
int ret,pid = 0,i = 0,j=0;
|
||||
struct rkcamera_platform_data* tmp_plat_data =(struct rkcamera_platform_data*)val;
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
sensor_init_winseq_p = sensor_svga;
|
||||
sensor_init_width = 800;
|
||||
sensor_init_height = 600;
|
||||
if (tmp_plat_data != NULL) {
|
||||
for(i = 0;i < RK_CAM_NUM_PER_HOST;i++){
|
||||
if ((tmp_plat_data->sensor_init_data[i])&& tmp_plat_data->info[i].dev_name &&
|
||||
(strcmp(tmp_plat_data->info[i].dev_name, dev_name(icd->pdev)) == 0))
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(tmp_plat_data && (i < RK_CAM_NUM_PER_HOST) && tmp_plat_data->sensor_init_data[i]){
|
||||
//user has defined the init data
|
||||
//init reg
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
for(j = 0;j< sizeof(sensor_init_data)/sizeof(struct reginfo);j++){
|
||||
sensor_init_data[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].reg;
|
||||
sensor_init_data[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].val;
|
||||
}
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data){
|
||||
sensor_init_data_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data);
|
||||
}
|
||||
//init winseq
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
int tmp_winseq_size = tmp_plat_data->sensor_init_data[i]->rk_sensor_winseq_size;
|
||||
if(sensor_init_winseq_board)
|
||||
{
|
||||
vfree(sensor_init_winseq_board);
|
||||
sensor_init_winseq_board = NULL;
|
||||
}
|
||||
sensor_init_winseq_board = (struct reginfo*)vmalloc(tmp_winseq_size);
|
||||
if(!sensor_init_winseq_board)
|
||||
SENSOR_TR("%s :vmalloc erro !",__FUNCTION__);
|
||||
for(j = 0;j< tmp_winseq_size;j++){
|
||||
sensor_init_winseq_board[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].reg;
|
||||
sensor_init_winseq_board[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].val;
|
||||
}
|
||||
sensor_init_winseq_p = sensor_init_winseq_board;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq){
|
||||
sensor_init_winseq_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq);
|
||||
}
|
||||
//init width,height,bus,pixelcode
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width != INVALID_VALUE)
|
||||
sensor_init_width = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height != INVALID_VALUE)
|
||||
sensor_init_height = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param != INVALID_VALUE)
|
||||
sensor_init_busparam = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode != INVALID_VALUE)
|
||||
sensor_init_pixelcode = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode;
|
||||
}
|
||||
int ret,pid = 0;
|
||||
|
||||
SENSOR_DG("\n%s..%s.. \n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
|
||||
if (sensor_ioctrl(icd, Sensor_PowerDown, 0) < 0) {
|
||||
|
|
@ -4356,9 +4299,8 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
goto sensor_INIT_ERR;
|
||||
}
|
||||
|
||||
ret = sensor_write_array(client, sensor_init_data_p);
|
||||
if (ret != 0)
|
||||
{
|
||||
ret = sensor_write_array(client, sensor_init_data);
|
||||
if (ret != 0) {
|
||||
SENSOR_TR("error: %s initial failed\n",SENSOR_NAME_STRING());
|
||||
goto sensor_INIT_ERR;
|
||||
}
|
||||
|
|
@ -5754,25 +5696,25 @@ static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
|
|||
SENSOR_DG("\n%s..%s..cmd:%x \n",SENSOR_NAME_STRING(),__FUNCTION__,cmd);
|
||||
switch (cmd)
|
||||
{
|
||||
case RK_CAM_SUBDEV_DEACTIVATE:
|
||||
case RK29_CAM_SUBDEV_DEACTIVATE:
|
||||
{
|
||||
sensor_deactivate(client);
|
||||
break;
|
||||
}
|
||||
case RK_CAM_SUBDEV_IOREQUEST:
|
||||
case RK29_CAM_SUBDEV_IOREQUEST:
|
||||
{
|
||||
sensor->sensor_io_request = (struct rkcamera_platform_data*)arg;
|
||||
sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
|
||||
|
||||
if (sensor->sensor_io_request != NULL) {
|
||||
if (sensor->sensor_io_request->gpio_res[0].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
} else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
}
|
||||
} else {
|
||||
SENSOR_TR("%s %s RK_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
ret = -EINVAL;
|
||||
goto sensor_ioctl_end;
|
||||
}
|
||||
|
|
|
|||
110
drivers/media/video/ov7675.c
Normal file → Executable file
110
drivers/media/video/ov7675.c
Normal file → Executable file
|
|
@ -20,8 +20,8 @@ o* Driver for MT9M001 CMOS Image Sensor from Micron
|
|||
#include <media/v4l2-common.h>
|
||||
#include <media/v4l2-chip-ident.h>
|
||||
#include <media/soc_camera.h>
|
||||
#include <mach/rk_camera.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <mach/rk29_camera.h>
|
||||
|
||||
static int debug;
|
||||
module_param(debug, int, S_IRUGO|S_IWUSR);
|
||||
|
||||
|
|
@ -44,18 +44,17 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define MAX(x,y) ((x>y) ? x: y)
|
||||
|
||||
/* Sensor Driver Configuration */
|
||||
#define SENSOR_NAME RK_CAM_SENSOR_OV7675
|
||||
#define SENSOR_NAME RK29_CAM_SENSOR_OV7675
|
||||
#define SENSOR_V4L2_IDENT V4L2_IDENT_OV7675
|
||||
#define SENSOR_ID 0x76
|
||||
#define SENSOR_MIN_WIDTH 640//176
|
||||
#define SENSOR_MIN_HEIGHT 480//144
|
||||
#define SENSOR_MAX_WIDTH 640
|
||||
#define SENSOR_MAX_HEIGHT 480
|
||||
#define SENSOR_INIT_WIDTH sensor_init_width /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT sensor_init_height
|
||||
#define SENSOR_INIT_WINSEQADR sensor_init_winseq_p
|
||||
#define SENSOR_INIT_PIXFMT sensor_init_pixelcode
|
||||
#define SENSOR_BUS_PARAM sensor_init_busparam
|
||||
#define SENSOR_INIT_WIDTH 640 /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT 480
|
||||
#define SENSOR_INIT_WINSEQADR sensor_vga
|
||||
#define SENSOR_INIT_PIXFMT V4L2_MBUS_FMT_YUYV8_2X8
|
||||
|
||||
#define CONFIG_SENSOR_WhiteBalance 0
|
||||
#define CONFIG_SENSOR_Brightness 0
|
||||
|
|
@ -75,6 +74,10 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define CONFIG_SENSOR_I2C_NOSCHED 0
|
||||
#define CONFIG_SENSOR_I2C_RDWRCHK 0
|
||||
|
||||
#define SENSOR_BUS_PARAM (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING |\
|
||||
SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW |\
|
||||
SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ)
|
||||
|
||||
#define COLOR_TEMPERATURE_CLOUDY_DN 6500
|
||||
#define COLOR_TEMPERATURE_CLOUDY_UP 8000
|
||||
#define COLOR_TEMPERATURE_CLEARDAY_DN 5000
|
||||
|
|
@ -92,14 +95,8 @@ struct reginfo
|
|||
u8 reg;
|
||||
u8 val;
|
||||
};
|
||||
static s32 sensor_init_width = 0;
|
||||
static s32 sensor_init_height = 0;
|
||||
static unsigned long sensor_init_busparam = (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING|SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW |SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ);
|
||||
static enum v4l2_mbus_pixelcode sensor_init_pixelcode = V4L2_MBUS_FMT_YUYV8_2X8;
|
||||
static struct reginfo* sensor_init_data_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_board = NULL;
|
||||
/* init 800*600 SVGA */
|
||||
|
||||
/* init 640X480 VGA */
|
||||
static struct reginfo sensor_init_data[] =
|
||||
{
|
||||
{0x12, 0x80},
|
||||
|
|
@ -1160,8 +1157,8 @@ struct sensor
|
|||
#if CONFIG_SENSOR_I2C_NOSCHED
|
||||
atomic_t tasklock_cnt;
|
||||
#endif
|
||||
struct rkcamera_platform_data *sensor_io_request;
|
||||
struct rkcamera_gpio_res *sensor_gpio_res;
|
||||
struct rk29camera_platform_data *sensor_io_request;
|
||||
struct rk29camera_gpio_res *sensor_gpio_res;
|
||||
};
|
||||
|
||||
static struct sensor* to_sensor(const struct i2c_client *client)
|
||||
|
|
@ -1340,7 +1337,7 @@ static int sensor_readchk_array(struct i2c_client *client, struct reginfo *regar
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd cmd, int on)
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd cmd, int on)
|
||||
{
|
||||
struct soc_camera_link *icl = to_soc_camera_link(icd);
|
||||
int ret = 0;
|
||||
|
|
@ -1354,13 +1351,13 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd c
|
|||
if (on == 0)
|
||||
mdelay(1);
|
||||
ret = icl->powerdown(icd->pdev, on);
|
||||
if (ret == RK_CAM_IO_SUCCESS) {
|
||||
if (ret == RK29_CAM_IO_SUCCESS) {
|
||||
if (on == 0) {
|
||||
mdelay(20);
|
||||
if (icl->reset)
|
||||
icl->reset(icd->pdev);
|
||||
}
|
||||
} else if (ret == RK_CAM_EIO_REQUESTFAIL) {
|
||||
} else if (ret == RK29_CAM_EIO_REQUESTFAIL) {
|
||||
ret = -ENODEV;
|
||||
goto sensor_power_end;
|
||||
}
|
||||
|
|
@ -1393,62 +1390,7 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
struct sensor *sensor = to_sensor(client);
|
||||
const struct v4l2_queryctrl *qctrl;
|
||||
const struct sensor_datafmt *fmt;
|
||||
int ret,pid = 0,i = 0,j=0;
|
||||
struct rkcamera_platform_data* tmp_plat_data =(struct rkcamera_platform_data*)val;
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
sensor_init_winseq_p = sensor_svga;
|
||||
sensor_init_width = 800;
|
||||
sensor_init_height = 600;
|
||||
if (tmp_plat_data != NULL) {
|
||||
for(i = 0;i < RK_CAM_NUM_PER_HOST;i++){
|
||||
if ((tmp_plat_data->sensor_init_data[i])&& tmp_plat_data->info[i].dev_name &&
|
||||
(strcmp(tmp_plat_data->info[i].dev_name, dev_name(icd->pdev)) == 0))
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(tmp_plat_data && (i < RK_CAM_NUM_PER_HOST) && tmp_plat_data->sensor_init_data[i]){
|
||||
//user has defined the init data
|
||||
//init reg
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
for(j = 0;j< sizeof(sensor_init_data)/sizeof(struct reginfo);j++){
|
||||
sensor_init_data[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].reg;
|
||||
sensor_init_data[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].val;
|
||||
}
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data){
|
||||
sensor_init_data_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data);
|
||||
}
|
||||
//init winseq
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
int tmp_winseq_size = tmp_plat_data->sensor_init_data[i]->rk_sensor_winseq_size;
|
||||
if(sensor_init_winseq_board)
|
||||
{
|
||||
vfree(sensor_init_winseq_board);
|
||||
sensor_init_winseq_board = NULL;
|
||||
}
|
||||
sensor_init_winseq_board = (struct reginfo*)vmalloc(tmp_winseq_size);
|
||||
if(!sensor_init_winseq_board)
|
||||
SENSOR_TR("%s :vmalloc erro !",__FUNCTION__);
|
||||
for(j = 0;j< tmp_winseq_size;j++){
|
||||
sensor_init_winseq_board[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].reg;
|
||||
sensor_init_winseq_board[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].val;
|
||||
}
|
||||
sensor_init_winseq_p = sensor_init_winseq_board;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq){
|
||||
sensor_init_winseq_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq);
|
||||
}
|
||||
//init width,height,bus,pixelcode
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width != INVALID_VALUE)
|
||||
sensor_init_width = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height != INVALID_VALUE)
|
||||
sensor_init_height = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param != INVALID_VALUE)
|
||||
sensor_init_busparam = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode != INVALID_VALUE)
|
||||
sensor_init_pixelcode = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode;
|
||||
}
|
||||
int ret;
|
||||
|
||||
SENSOR_DG("\n%s..%s.. \n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
|
||||
|
|
@ -1470,7 +1412,7 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
|
||||
mdelay(5); //delay 5 microseconds
|
||||
|
||||
ret = sensor_write_array(client, sensor_init_data_p);
|
||||
ret = sensor_write_array(client, sensor_init_data);
|
||||
if (ret != 0)
|
||||
{
|
||||
SENSOR_TR("error: %s initial failed\n",SENSOR_NAME_STRING());
|
||||
|
|
@ -2619,25 +2561,25 @@ static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
|
|||
SENSOR_DG("\n%s..%s..cmd:%x \n",SENSOR_NAME_STRING(),__FUNCTION__,cmd);
|
||||
switch (cmd)
|
||||
{
|
||||
case RK_CAM_SUBDEV_DEACTIVATE:
|
||||
case RK29_CAM_SUBDEV_DEACTIVATE:
|
||||
{
|
||||
sensor_deactivate(client);
|
||||
break;
|
||||
}
|
||||
|
||||
case RK_CAM_SUBDEV_IOREQUEST:
|
||||
case RK29_CAM_SUBDEV_IOREQUEST:
|
||||
{
|
||||
sensor->sensor_io_request = (struct rkcamera_platform_data*)arg;
|
||||
sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
|
||||
if (sensor->sensor_io_request != NULL) {
|
||||
if (sensor->sensor_io_request->gpio_res[0].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
} else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
}
|
||||
} else {
|
||||
SENSOR_TR("%s %s RK_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
ret = -EINVAL;
|
||||
goto sensor_ioctl_end;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ o* Driver for MT9M001 CMOS Image Sensor from Micron
|
|||
#include <media/v4l2-common.h>
|
||||
#include <media/v4l2-chip-ident.h>
|
||||
#include <media/soc_camera.h>
|
||||
#include <mach/rk_camera.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <mach/rk29_camera.h>
|
||||
|
||||
static int debug;
|
||||
module_param(debug, int, S_IRUGO|S_IWUSR);
|
||||
|
||||
|
|
@ -43,18 +43,17 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define MAX(x,y) ((x>y) ? x: y)
|
||||
|
||||
/* Sensor Driver Configuration */
|
||||
#define SENSOR_NAME RK_CAM_SENSOR_OV7690
|
||||
#define SENSOR_NAME RK29_CAM_SENSOR_OV7690
|
||||
#define SENSOR_V4L2_IDENT V4L2_IDENT_OV7690
|
||||
#define SENSOR_ID 0x76
|
||||
#define SENSOR_MIN_WIDTH 176
|
||||
#define SENSOR_MIN_HEIGHT 144
|
||||
#define SENSOR_MAX_WIDTH 640
|
||||
#define SENSOR_MAX_HEIGHT 480
|
||||
#define SENSOR_INIT_WIDTH sensor_init_width /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT sensor_init_height
|
||||
#define SENSOR_INIT_WINSEQADR sensor_init_winseq_p
|
||||
#define SENSOR_INIT_PIXFMT sensor_init_pixelcode
|
||||
#define SENSOR_BUS_PARAM sensor_init_busparam
|
||||
#define SENSOR_INIT_WIDTH 640 /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT 480
|
||||
#define SENSOR_INIT_WINSEQADR sensor_vga
|
||||
#define SENSOR_INIT_PIXFMT V4L2_MBUS_FMT_YUYV8_2X8
|
||||
|
||||
#define CONFIG_SENSOR_WhiteBalance 1
|
||||
#define CONFIG_SENSOR_Brightness 0
|
||||
|
|
@ -74,6 +73,10 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define CONFIG_SENSOR_I2C_NOSCHED 0
|
||||
#define CONFIG_SENSOR_I2C_RDWRCHK 0
|
||||
|
||||
#define SENSOR_BUS_PARAM (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING|\
|
||||
SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW |\
|
||||
SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ)
|
||||
|
||||
#define COLOR_TEMPERATURE_CLOUDY_DN 6500
|
||||
#define COLOR_TEMPERATURE_CLOUDY_UP 8000
|
||||
#define COLOR_TEMPERATURE_CLEARDAY_DN 5000
|
||||
|
|
@ -91,15 +94,7 @@ struct reginfo
|
|||
u8 reg;
|
||||
u8 val;
|
||||
};
|
||||
|
||||
static s32 sensor_init_width = 0;
|
||||
static s32 sensor_init_height = 0;
|
||||
static unsigned long sensor_init_busparam = (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING|SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW |SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ);
|
||||
static enum v4l2_mbus_pixelcode sensor_init_pixelcode = V4L2_MBUS_FMT_YUYV8_2X8;
|
||||
static struct reginfo* sensor_init_data_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_board = NULL;
|
||||
/* init 800*600 SVGA */
|
||||
/* init 640X480 VGA */
|
||||
static struct reginfo sensor_init_data[] =
|
||||
{
|
||||
{0x12, 0x80},
|
||||
|
|
@ -955,8 +950,8 @@ struct sensor
|
|||
#if CONFIG_SENSOR_I2C_NOSCHED
|
||||
atomic_t tasklock_cnt;
|
||||
#endif
|
||||
struct rkcamera_platform_data *sensor_io_request;
|
||||
struct rkcamera_gpio_res *sensor_gpio_res;
|
||||
struct rk29camera_platform_data *sensor_io_request;
|
||||
struct rk29camera_gpio_res *sensor_gpio_res;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -1138,7 +1133,7 @@ static int sensor_readchk_array(struct i2c_client *client, struct reginfo *regar
|
|||
return 0;
|
||||
}
|
||||
#endif
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd cmd, int on)
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd cmd, int on)
|
||||
{
|
||||
struct soc_camera_link *icl = to_soc_camera_link(icd);
|
||||
int ret = 0;
|
||||
|
|
@ -1152,13 +1147,13 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd c
|
|||
if (on == 0)
|
||||
mdelay(1);
|
||||
ret = icl->powerdown(icd->pdev, on);
|
||||
if (ret == RK_CAM_IO_SUCCESS) {
|
||||
if (ret == RK29_CAM_IO_SUCCESS) {
|
||||
if (on == 0) {
|
||||
mdelay(20);
|
||||
if (icl->reset)
|
||||
icl->reset(icd->pdev);
|
||||
}
|
||||
} else if (ret == RK_CAM_EIO_REQUESTFAIL) {
|
||||
} else if (ret == RK29_CAM_EIO_REQUESTFAIL) {
|
||||
ret = -ENODEV;
|
||||
goto sensor_power_end;
|
||||
}
|
||||
|
|
@ -1191,62 +1186,8 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
struct sensor *sensor = to_sensor(client);
|
||||
const struct v4l2_queryctrl *qctrl;
|
||||
const struct sensor_datafmt *fmt;
|
||||
int ret,pid = 0,i = 0,j=0;
|
||||
struct rkcamera_platform_data* tmp_plat_data =(struct rkcamera_platform_data*)val;
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
sensor_init_winseq_p = sensor_vga;
|
||||
sensor_init_width = 640;
|
||||
sensor_init_height = 480;
|
||||
if (tmp_plat_data != NULL) {
|
||||
for(i = 0;i < RK_CAM_NUM_PER_HOST;i++){
|
||||
if ((tmp_plat_data->sensor_init_data[i])&& tmp_plat_data->info[i].dev_name &&
|
||||
(strcmp(tmp_plat_data->info[i].dev_name, dev_name(icd->pdev)) == 0))
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(tmp_plat_data && (i < RK_CAM_NUM_PER_HOST) && tmp_plat_data->sensor_init_data[i]){
|
||||
//user has defined the init data
|
||||
//init reg
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
for(j = 0;j< sizeof(sensor_init_data)/sizeof(struct reginfo);j++){
|
||||
sensor_init_data[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].reg;
|
||||
sensor_init_data[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].val;
|
||||
}
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data){
|
||||
sensor_init_data_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data);
|
||||
}
|
||||
//init winseq
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
int tmp_winseq_size = tmp_plat_data->sensor_init_data[i]->rk_sensor_winseq_size;
|
||||
if(sensor_init_winseq_board)
|
||||
{
|
||||
vfree(sensor_init_winseq_board);
|
||||
sensor_init_winseq_board = NULL;
|
||||
}
|
||||
sensor_init_winseq_board = (struct reginfo*)vmalloc(tmp_winseq_size);
|
||||
if(!sensor_init_winseq_board)
|
||||
SENSOR_TR("%s :vmalloc erro !",__FUNCTION__);
|
||||
for(j = 0;j< tmp_winseq_size;j++){
|
||||
sensor_init_winseq_board[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].reg;
|
||||
sensor_init_winseq_board[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].val;
|
||||
}
|
||||
sensor_init_winseq_p = sensor_init_winseq_board;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq){
|
||||
sensor_init_winseq_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq);
|
||||
}
|
||||
//init width,height,bus,pixelcode
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width != INVALID_VALUE)
|
||||
sensor_init_width = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height != INVALID_VALUE)
|
||||
sensor_init_height = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param != INVALID_VALUE)
|
||||
sensor_init_busparam = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode != INVALID_VALUE)
|
||||
sensor_init_pixelcode = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode;
|
||||
}
|
||||
int ret;
|
||||
|
||||
SENSOR_DG("\n%s..%s.. \n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
|
||||
if (sensor_ioctrl(icd, Sensor_PowerDown, 0) < 0) {
|
||||
|
|
@ -1266,7 +1207,7 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
}
|
||||
mdelay(5); //delay 5 microseconds
|
||||
|
||||
ret = sensor_write_array(client, sensor_init_data_p);
|
||||
ret = sensor_write_array(client, sensor_init_data);
|
||||
if (ret != 0)
|
||||
{
|
||||
SENSOR_TR("error: %s initial failed\n",SENSOR_NAME_STRING());
|
||||
|
|
@ -2437,25 +2378,25 @@ static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
|
|||
SENSOR_DG("\n%s..%s..cmd:%x \n",SENSOR_NAME_STRING(),__FUNCTION__,cmd);
|
||||
switch (cmd)
|
||||
{
|
||||
case RK_CAM_SUBDEV_DEACTIVATE:
|
||||
case RK29_CAM_SUBDEV_DEACTIVATE:
|
||||
{
|
||||
sensor_deactivate(client);
|
||||
break;
|
||||
}
|
||||
|
||||
case RK_CAM_SUBDEV_IOREQUEST:
|
||||
case RK29_CAM_SUBDEV_IOREQUEST:
|
||||
{
|
||||
sensor->sensor_io_request = (struct rkcamera_platform_data*)arg;
|
||||
sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
|
||||
if (sensor->sensor_io_request != NULL) {
|
||||
if (sensor->sensor_io_request->gpio_res[0].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
} else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
}
|
||||
} else {
|
||||
SENSOR_TR("%s %s RK_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
ret = -EINVAL;
|
||||
goto sensor_ioctl_end;
|
||||
}
|
||||
|
|
|
|||
1740
drivers/media/video/rk29_camera.c
Executable file
1740
drivers/media/video/rk29_camera.c
Executable file
File diff suppressed because it is too large
Load Diff
1444
drivers/media/video/rk_camera_oneframe.c → drivers/media/video/rk29_camera_oneframe.c
Normal file → Executable file
1444
drivers/media/video/rk_camera_oneframe.c → drivers/media/video/rk29_camera_oneframe.c
Normal file → Executable file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -19,8 +19,7 @@
|
|||
#include <media/v4l2-common.h>
|
||||
#include <media/v4l2-chip-ident.h>
|
||||
#include <media/soc_camera.h>
|
||||
#include <mach/rk_camera.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <mach/rk29_camera.h>
|
||||
#include <linux/delay.h>
|
||||
#include "s5k6aa.h"
|
||||
static int debug;
|
||||
|
|
@ -45,7 +44,7 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define MAX(x,y) ((x>y) ? x: y)
|
||||
|
||||
/* Sensor Driver Configuration */
|
||||
#define SENSOR_NAME RK_CAM_SENSOR_S5K6AA
|
||||
#define SENSOR_NAME RK29_CAM_SENSOR_S5K6AA
|
||||
#define SENSOR_V4L2_IDENT V4L2_IDENT_S5K66A
|
||||
#define SENSOR_ID 0x06aa
|
||||
#define SENSOR_ID_REG SEQUENCE_END//0x015a
|
||||
|
|
@ -55,11 +54,10 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define SENSOR_MIN_HEIGHT 480
|
||||
#define SENSOR_MAX_WIDTH 1280
|
||||
#define SENSOR_MAX_HEIGHT 1024
|
||||
#define SENSOR_INIT_WIDTH sensor_init_width /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT sensor_init_height
|
||||
#define SENSOR_INIT_WINSEQADR sensor_init_winseq_p
|
||||
#define SENSOR_INIT_PIXFMT sensor_init_pixelcode
|
||||
#define SENSOR_BUS_PARAM sensor_init_busparam
|
||||
#define SENSOR_INIT_WIDTH 640 /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT 480
|
||||
#define SENSOR_INIT_WINSEQADR sensor_vga
|
||||
#define SENSOR_INIT_PIXFMT V4L2_MBUS_FMT_YUYV8_2X8
|
||||
|
||||
#define CONFIG_SENSOR_WhiteBalance 0
|
||||
#define CONFIG_SENSOR_Brightness 0
|
||||
|
|
@ -81,6 +79,11 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define CONFIG_SENSOR_I2C_NOSCHED 0
|
||||
#define CONFIG_SENSOR_I2C_RDWRCHK 0
|
||||
|
||||
|
||||
#define SENSOR_BUS_PARAM (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING |\
|
||||
SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_HIGH |\
|
||||
SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ)
|
||||
|
||||
#define COLOR_TEMPERATURE_CLOUDY_DN 6500
|
||||
#define COLOR_TEMPERATURE_CLOUDY_UP 8000
|
||||
#define COLOR_TEMPERATURE_CLEARDAY_DN 5000
|
||||
|
|
@ -107,14 +110,7 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define SENSOR_AF_MODE_CLOSE 5
|
||||
#endif
|
||||
|
||||
static s32 sensor_init_width = 0;
|
||||
static s32 sensor_init_height = 0;
|
||||
static unsigned long sensor_init_busparam = (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING|SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW |SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ);
|
||||
static enum v4l2_mbus_pixelcode sensor_init_pixelcode = V4L2_MBUS_FMT_YUYV8_2X8;
|
||||
static struct reginfo* sensor_init_data_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_board = NULL;
|
||||
/* init 800*600 SVGA */
|
||||
/* init 640X480 SVGA */
|
||||
static struct reginfo sensor_init_data[] =
|
||||
{
|
||||
{0x0010,0x0001}, // Reset
|
||||
|
|
@ -3025,8 +3021,8 @@ struct sensor
|
|||
#if CONFIG_SENSOR_I2C_NOSCHED
|
||||
atomic_t tasklock_cnt;
|
||||
#endif
|
||||
struct rkcamera_platform_data *sensor_io_request;
|
||||
struct rkcamera_gpio_res *sensor_gpio_res;
|
||||
struct rk29camera_platform_data *sensor_io_request;
|
||||
struct rk29camera_gpio_res *sensor_gpio_res;
|
||||
};
|
||||
|
||||
static struct sensor* to_sensor(const struct i2c_client *client)
|
||||
|
|
@ -3264,7 +3260,7 @@ static int sensor_af_init(struct i2c_client *client)
|
|||
}
|
||||
#endif
|
||||
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd cmd, int on)
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd cmd, int on)
|
||||
{
|
||||
struct soc_camera_link *icl = to_soc_camera_link(icd);
|
||||
struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
|
||||
|
|
@ -3284,13 +3280,13 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd c
|
|||
{
|
||||
if (icl->powerdown) {
|
||||
ret = icl->powerdown(icd->pdev, on);
|
||||
if (ret == RK_CAM_IO_SUCCESS) {
|
||||
if (ret == RK29_CAM_IO_SUCCESS) {
|
||||
if (on == 0) {
|
||||
mdelay(2);
|
||||
if (icl->reset)
|
||||
icl->reset(icd->pdev);
|
||||
}
|
||||
} else if (ret == RK_CAM_EIO_REQUESTFAIL) {
|
||||
} else if (ret == RK29_CAM_EIO_REQUESTFAIL) {
|
||||
ret = -ENODEV;
|
||||
goto sensor_power_end;
|
||||
}
|
||||
|
|
@ -3322,63 +3318,9 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
struct sensor *sensor = to_sensor(client);
|
||||
const struct v4l2_queryctrl *qctrl;
|
||||
const struct sensor_datafmt *fmt;
|
||||
char value;
|
||||
int ret,pid = 0,i = 0,j=0;
|
||||
struct rkcamera_platform_data* tmp_plat_data =(struct rkcamera_platform_data*)val;
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
sensor_init_winseq_p = sensor_vga;
|
||||
sensor_init_width = 640;
|
||||
sensor_init_height = 480;
|
||||
if (tmp_plat_data != NULL) {
|
||||
for(i = 0;i < RK_CAM_NUM_PER_HOST;i++){
|
||||
if ((tmp_plat_data->sensor_init_data[i])&& tmp_plat_data->info[i].dev_name &&
|
||||
(strcmp(tmp_plat_data->info[i].dev_name, dev_name(icd->pdev)) == 0))
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(tmp_plat_data && (i < RK_CAM_NUM_PER_HOST) && tmp_plat_data->sensor_init_data[i]){
|
||||
//user has defined the init data
|
||||
//init reg
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
for(j = 0;j< sizeof(sensor_init_data)/sizeof(struct reginfo);j++){
|
||||
sensor_init_data[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].reg;
|
||||
sensor_init_data[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].val;
|
||||
}
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data){
|
||||
sensor_init_data_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data);
|
||||
}
|
||||
//init winseq
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
int tmp_winseq_size = tmp_plat_data->sensor_init_data[i]->rk_sensor_winseq_size;
|
||||
if(sensor_init_winseq_board)
|
||||
{
|
||||
vfree(sensor_init_winseq_board);
|
||||
sensor_init_winseq_board = NULL;
|
||||
}
|
||||
sensor_init_winseq_board = (struct reginfo*)vmalloc(tmp_winseq_size);
|
||||
if(!sensor_init_winseq_board)
|
||||
SENSOR_TR("%s :vmalloc erro !",__FUNCTION__);
|
||||
for(j = 0;j< tmp_winseq_size;j++){
|
||||
sensor_init_winseq_board[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].reg;
|
||||
sensor_init_winseq_board[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].val;
|
||||
}
|
||||
sensor_init_winseq_p = sensor_init_winseq_board;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq){
|
||||
sensor_init_winseq_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq);
|
||||
}
|
||||
//init width,height,bus,pixelcode
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width != INVALID_VALUE)
|
||||
sensor_init_width = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height != INVALID_VALUE)
|
||||
sensor_init_height = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param != INVALID_VALUE)
|
||||
sensor_init_busparam = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode != INVALID_VALUE)
|
||||
sensor_init_pixelcode = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode;
|
||||
}
|
||||
int ret;
|
||||
u16 pid = 0;
|
||||
|
||||
SENSOR_DG("\n%s..%s.. \n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
|
||||
sensor_ioctrl(icd,Sensor_Reset, 1);
|
||||
|
|
@ -3426,7 +3368,7 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
goto sensor_INIT_ERR;
|
||||
}
|
||||
|
||||
ret = sensor_write_array(client, sensor_init_data_p);
|
||||
ret = sensor_write_array(client, sensor_init_data);
|
||||
if (ret != 0)
|
||||
{
|
||||
SENSOR_TR("error: %s initial failed\n",SENSOR_NAME_STRING());
|
||||
|
|
@ -4656,24 +4598,24 @@ static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
|
|||
SENSOR_DG("\n%s..%s..cmd:%x \n",SENSOR_NAME_STRING(),__FUNCTION__,cmd);
|
||||
switch (cmd)
|
||||
{
|
||||
case RK_CAM_SUBDEV_DEACTIVATE:
|
||||
case RK29_CAM_SUBDEV_DEACTIVATE:
|
||||
{
|
||||
sensor_deactivate(client);
|
||||
break;
|
||||
}
|
||||
case RK_CAM_SUBDEV_IOREQUEST:
|
||||
case RK29_CAM_SUBDEV_IOREQUEST:
|
||||
{
|
||||
sensor->sensor_io_request = (struct rkcamera_platform_data*)arg;
|
||||
sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
|
||||
if (sensor->sensor_io_request != NULL) {
|
||||
if (sensor->sensor_io_request->gpio_res[0].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
} else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
}
|
||||
} else {
|
||||
SENSOR_TR("%s %s RK_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
ret = -EINVAL;
|
||||
goto sensor_ioctl_end;
|
||||
}
|
||||
|
|
|
|||
411
drivers/media/video/sid130B.c
Normal file → Executable file
411
drivers/media/video/sid130B.c
Normal file → Executable file
|
|
@ -19,8 +19,8 @@ o* Driver for MT9M001 CMOS Image Sensor from Micron
|
|||
#include <media/v4l2-common.h>
|
||||
#include <media/v4l2-chip-ident.h>
|
||||
#include <media/soc_camera.h>
|
||||
#include <mach/rk_camera.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <mach/rk29_camera.h>
|
||||
|
||||
static int debug;
|
||||
module_param(debug, int, S_IRUGO|S_IWUSR);
|
||||
|
||||
|
|
@ -50,11 +50,10 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define SENSOR_MIN_HEIGHT 144
|
||||
#define SENSOR_MAX_WIDTH 1600
|
||||
#define SENSOR_MAX_HEIGHT 1200
|
||||
#define SENSOR_INIT_WIDTH sensor_init_width /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT sensor_init_height
|
||||
#define SENSOR_INIT_WINSEQADR sensor_init_winseq_p
|
||||
#define SENSOR_INIT_PIXFMT sensor_init_pixelcode
|
||||
#define SENSOR_BUS_PARAM sensor_init_busparam
|
||||
#define SENSOR_INIT_WIDTH 640 /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT 480
|
||||
#define SENSOR_INIT_WINSEQADR sensor_vga
|
||||
#define SENSOR_INIT_PIXFMT V4L2_MBUS_FMT_UYVY8_2X8
|
||||
|
||||
#define CONFIG_SENSOR_WhiteBalance 1
|
||||
#define CONFIG_SENSOR_Brightness 0
|
||||
|
|
@ -74,6 +73,10 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define CONFIG_SENSOR_I2C_NOSCHED 0
|
||||
#define CONFIG_SENSOR_I2C_RDWRCHK 0
|
||||
|
||||
#define SENSOR_BUS_PARAM (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING |\
|
||||
SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW|\
|
||||
SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ)
|
||||
|
||||
#define COLOR_TEMPERATURE_CLOUDY_DN 6500
|
||||
#define COLOR_TEMPERATURE_CLOUDY_UP 8000
|
||||
#define COLOR_TEMPERATURE_CLEARDAY_DN 5000
|
||||
|
|
@ -86,9 +89,9 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define SENSOR_NAME_STRING(a) STR(CONS(SENSOR_NAME, a))
|
||||
#define SENSOR_NAME_VARFUN(a) CONS(SENSOR_NAME, a)
|
||||
|
||||
#define SENSOR_AF_IS_ERR (0x00<<0)
|
||||
#define SENSOR_AF_IS_OK (0x01<<0)
|
||||
#define SENSOR_INIT_IS_ERR (0x00<<28)
|
||||
#define SENSOR_AF_IS_ERR (0x00<<0)
|
||||
#define SENSOR_AF_IS_OK (0x01<<0)
|
||||
#define SENSOR_INIT_IS_ERR (0x00<<28)
|
||||
#define SENSOR_INIT_IS_OK (0x01<<28)
|
||||
|
||||
struct reginfo
|
||||
|
|
@ -97,14 +100,7 @@ struct reginfo
|
|||
u8 val;
|
||||
};
|
||||
|
||||
static s32 sensor_init_width = 0;
|
||||
static s32 sensor_init_height = 0;
|
||||
static unsigned long sensor_init_busparam = (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING|SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW |SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ);
|
||||
static enum v4l2_mbus_pixelcode sensor_init_pixelcode = V4L2_MBUS_FMT_YUYV8_2X8;
|
||||
static struct reginfo* sensor_init_data_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_board = NULL;
|
||||
/* init 800*600 SVGA */
|
||||
/* init 352X288 SVGA */
|
||||
static struct reginfo sensor_init_data[] =
|
||||
{
|
||||
{0x00, 0x00},
|
||||
|
|
@ -1397,28 +1393,28 @@ static struct soc_camera_ops sensor_ops =
|
|||
.num_menus = ARRAY_SIZE(sensor_menus),
|
||||
};
|
||||
|
||||
/* only one fixed colorspace per pixelcode */
|
||||
struct sensor_datafmt {
|
||||
enum v4l2_mbus_pixelcode code;
|
||||
enum v4l2_colorspace colorspace;
|
||||
};
|
||||
|
||||
/* Find a data format by a pixel code in an array */
|
||||
static const struct sensor_datafmt *sensor_find_datafmt(
|
||||
enum v4l2_mbus_pixelcode code, const struct sensor_datafmt *fmt,
|
||||
int n)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < n; i++)
|
||||
if (fmt[i].code == code)
|
||||
return fmt + i;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const struct sensor_datafmt sensor_colour_fmts[] = {
|
||||
{V4L2_MBUS_FMT_UYVY8_2X8, V4L2_COLORSPACE_JPEG},
|
||||
{V4L2_MBUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_JPEG}
|
||||
/* only one fixed colorspace per pixelcode */
|
||||
struct sensor_datafmt {
|
||||
enum v4l2_mbus_pixelcode code;
|
||||
enum v4l2_colorspace colorspace;
|
||||
};
|
||||
|
||||
/* Find a data format by a pixel code in an array */
|
||||
static const struct sensor_datafmt *sensor_find_datafmt(
|
||||
enum v4l2_mbus_pixelcode code, const struct sensor_datafmt *fmt,
|
||||
int n)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < n; i++)
|
||||
if (fmt[i].code == code)
|
||||
return fmt + i;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const struct sensor_datafmt sensor_colour_fmts[] = {
|
||||
{V4L2_MBUS_FMT_UYVY8_2X8, V4L2_COLORSPACE_JPEG},
|
||||
{V4L2_MBUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_JPEG}
|
||||
};
|
||||
|
||||
typedef struct sensor_info_priv_s
|
||||
|
|
@ -1451,8 +1447,8 @@ struct sensor
|
|||
#if CONFIG_SENSOR_I2C_NOSCHED
|
||||
atomic_t tasklock_cnt;
|
||||
#endif
|
||||
struct rkcamera_platform_data *sensor_io_request;
|
||||
struct rkcamera_gpio_res *sensor_gpio_res;
|
||||
struct rk29camera_platform_data *sensor_io_request;
|
||||
struct rk29camera_gpio_res *sensor_gpio_res;
|
||||
};
|
||||
|
||||
static struct sensor* to_sensor(const struct i2c_client *client)
|
||||
|
|
@ -1634,7 +1630,7 @@ static int sensor_readchk_array(struct i2c_client *client, struct reginfo *regar
|
|||
return 0;
|
||||
}
|
||||
#endif
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd cmd, int on)
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd cmd, int on)
|
||||
{
|
||||
struct soc_camera_link *icl = to_soc_camera_link(icd);
|
||||
int ret = 0;
|
||||
|
|
@ -1646,13 +1642,13 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd c
|
|||
{
|
||||
if (icl->powerdown) {
|
||||
ret = icl->powerdown(icd->pdev, on);
|
||||
if (ret == RK_CAM_IO_SUCCESS) {
|
||||
if (ret == RK29_CAM_IO_SUCCESS) {
|
||||
if (on == 0) {
|
||||
mdelay(2);
|
||||
if (icl->reset)
|
||||
icl->reset(icd->pdev);
|
||||
}
|
||||
} else if (ret == RK_CAM_EIO_REQUESTFAIL) {
|
||||
} else if (ret == RK29_CAM_EIO_REQUESTFAIL) {
|
||||
ret = -ENODEV;
|
||||
goto sensor_power_end;
|
||||
}
|
||||
|
|
@ -1685,63 +1681,8 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
struct sensor *sensor = to_sensor(client);
|
||||
const struct v4l2_queryctrl *qctrl;
|
||||
const struct sensor_datafmt *fmt;
|
||||
char value;
|
||||
int ret,pid = 0,i = 0,j=0;
|
||||
struct rkcamera_platform_data* tmp_plat_data =(struct rkcamera_platform_data*)val;
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
sensor_init_winseq_p = sensor_vga;
|
||||
sensor_init_width = 640;
|
||||
sensor_init_height = 480;
|
||||
if (tmp_plat_data != NULL) {
|
||||
for(i = 0;i < RK_CAM_NUM_PER_HOST;i++){
|
||||
if ((tmp_plat_data->sensor_init_data[i])&& tmp_plat_data->info[i].dev_name &&
|
||||
(strcmp(tmp_plat_data->info[i].dev_name, dev_name(icd->pdev)) == 0))
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(tmp_plat_data && (i < RK_CAM_NUM_PER_HOST) && tmp_plat_data->sensor_init_data[i]){
|
||||
//user has defined the init data
|
||||
//init reg
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
for(j = 0;j< sizeof(sensor_init_data)/sizeof(struct reginfo);j++){
|
||||
sensor_init_data[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].reg;
|
||||
sensor_init_data[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].val;
|
||||
}
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data){
|
||||
sensor_init_data_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data);
|
||||
}
|
||||
//init winseq
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
int tmp_winseq_size = tmp_plat_data->sensor_init_data[i]->rk_sensor_winseq_size;
|
||||
if(sensor_init_winseq_board)
|
||||
{
|
||||
vfree(sensor_init_winseq_board);
|
||||
sensor_init_winseq_board = NULL;
|
||||
}
|
||||
sensor_init_winseq_board = (struct reginfo*)vmalloc(tmp_winseq_size);
|
||||
if(!sensor_init_winseq_board)
|
||||
SENSOR_TR("%s :vmalloc erro !",__FUNCTION__);
|
||||
for(j = 0;j< tmp_winseq_size;j++){
|
||||
sensor_init_winseq_board[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].reg;
|
||||
sensor_init_winseq_board[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].val;
|
||||
}
|
||||
sensor_init_winseq_p = sensor_init_winseq_board;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq){
|
||||
sensor_init_winseq_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq);
|
||||
}
|
||||
//init width,height,bus,pixelcode
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width != INVALID_VALUE)
|
||||
sensor_init_width = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height != INVALID_VALUE)
|
||||
sensor_init_height = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param != INVALID_VALUE)
|
||||
sensor_init_busparam = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode != INVALID_VALUE)
|
||||
sensor_init_pixelcode = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode;
|
||||
}
|
||||
int ret;
|
||||
|
||||
SENSOR_DG("\n%s..%s.. \n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
|
||||
if (sensor_ioctrl(icd, Sensor_PowerDown, 0) < 0) {
|
||||
|
|
@ -1801,7 +1742,7 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
goto sensor_INIT_ERR;
|
||||
}
|
||||
#endif
|
||||
ret = sensor_write_array(client, sensor_init_data_p);
|
||||
ret = sensor_write_array(client, sensor_init_data);
|
||||
if (ret != 0)
|
||||
{
|
||||
SENSOR_TR("error: %s initial failed\n",SENSOR_NAME_STRING());
|
||||
|
|
@ -1810,11 +1751,11 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
sensor_task_lock(client,0);
|
||||
sensor->info_priv.winseqe_cur_addr = (int)SENSOR_INIT_WINSEQADR;
|
||||
fmt = sensor_find_datafmt(SENSOR_INIT_PIXFMT,sensor_colour_fmts, ARRAY_SIZE(sensor_colour_fmts));
|
||||
if (!fmt) {
|
||||
SENSOR_TR("error: %s initial array colour fmts is not support!!",SENSOR_NAME_STRING());
|
||||
ret = -EINVAL;
|
||||
goto sensor_INIT_ERR;
|
||||
}
|
||||
if (!fmt) {
|
||||
SENSOR_TR("error: %s initial array colour fmts is not support!!",SENSOR_NAME_STRING());
|
||||
ret = -EINVAL;
|
||||
goto sensor_INIT_ERR;
|
||||
}
|
||||
sensor->info_priv.fmt = *fmt;
|
||||
|
||||
/* sensor sensor information for initialization */
|
||||
|
|
@ -1955,55 +1896,55 @@ static unsigned long sensor_query_bus_param(struct soc_camera_device *icd)
|
|||
return soc_camera_apply_sensor_flags(icl, flags);
|
||||
}
|
||||
|
||||
static int sensor_g_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
|
||||
{
|
||||
static int sensor_g_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
|
||||
{
|
||||
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
||||
struct soc_camera_device *icd = client->dev.platform_data;
|
||||
struct sensor *sensor = to_sensor(client);
|
||||
|
||||
mf->width = icd->user_width;
|
||||
mf->height = icd->user_height;
|
||||
mf->code = sensor->info_priv.fmt.code;
|
||||
mf->colorspace = sensor->info_priv.fmt.colorspace;
|
||||
mf->field = V4L2_FIELD_NONE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
static bool sensor_fmt_capturechk(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
if ((mf->width == 1024) && (mf->height == 768)) {
|
||||
ret = true;
|
||||
} else if ((mf->width == 1280) && (mf->height == 1024)) {
|
||||
ret = true;
|
||||
} else if ((mf->width == 1600) && (mf->height == 1200)) {
|
||||
ret = true;
|
||||
} else if ((mf->width == 2048) && (mf->height == 1536)) {
|
||||
ret = true;
|
||||
} else if ((mf->width == 2592) && (mf->height == 1944)) {
|
||||
ret = true;
|
||||
}
|
||||
|
||||
if (ret == true)
|
||||
SENSOR_DG("%s %dx%d is capture format\n", __FUNCTION__, mf->width, mf->height);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bool sensor_fmt_videochk(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
if ((mf->width == 1280) && (mf->height == 720)) {
|
||||
ret = true;
|
||||
} else if ((mf->width == 1920) && (mf->height == 1080)) {
|
||||
ret = true;
|
||||
}
|
||||
|
||||
if (ret == true)
|
||||
SENSOR_DG("%s %dx%d is video format\n", __FUNCTION__, mf->width, mf->height);
|
||||
return ret;
|
||||
}
|
||||
struct soc_camera_device *icd = client->dev.platform_data;
|
||||
struct sensor *sensor = to_sensor(client);
|
||||
|
||||
mf->width = icd->user_width;
|
||||
mf->height = icd->user_height;
|
||||
mf->code = sensor->info_priv.fmt.code;
|
||||
mf->colorspace = sensor->info_priv.fmt.colorspace;
|
||||
mf->field = V4L2_FIELD_NONE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
static bool sensor_fmt_capturechk(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
if ((mf->width == 1024) && (mf->height == 768)) {
|
||||
ret = true;
|
||||
} else if ((mf->width == 1280) && (mf->height == 1024)) {
|
||||
ret = true;
|
||||
} else if ((mf->width == 1600) && (mf->height == 1200)) {
|
||||
ret = true;
|
||||
} else if ((mf->width == 2048) && (mf->height == 1536)) {
|
||||
ret = true;
|
||||
} else if ((mf->width == 2592) && (mf->height == 1944)) {
|
||||
ret = true;
|
||||
}
|
||||
|
||||
if (ret == true)
|
||||
SENSOR_DG("%s %dx%d is capture format\n", __FUNCTION__, mf->width, mf->height);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bool sensor_fmt_videochk(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
if ((mf->width == 1280) && (mf->height == 720)) {
|
||||
ret = true;
|
||||
} else if ((mf->width == 1920) && (mf->height == 1080)) {
|
||||
ret = true;
|
||||
}
|
||||
|
||||
if (ret == true)
|
||||
SENSOR_DG("%s %dx%d is video format\n", __FUNCTION__, mf->width, mf->height);
|
||||
return ret;
|
||||
}
|
||||
static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
|
||||
{
|
||||
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
||||
|
|
@ -2014,40 +1955,40 @@ static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
|
|||
struct reginfo *winseqe_set_addr=NULL;
|
||||
int ret=0, set_w,set_h;
|
||||
|
||||
fmt = sensor_find_datafmt(mf->code, sensor_colour_fmts,
|
||||
ARRAY_SIZE(sensor_colour_fmts));
|
||||
if (!fmt) {
|
||||
ret = -EINVAL;
|
||||
goto sensor_s_fmt_end;
|
||||
}
|
||||
|
||||
if (sensor->info_priv.fmt.code != mf->code) {
|
||||
switch (mf->code)
|
||||
{
|
||||
case V4L2_MBUS_FMT_YUYV8_2X8:
|
||||
{
|
||||
winseqe_set_addr = sensor_ClrFmt_YUYV;
|
||||
break;
|
||||
}
|
||||
case V4L2_MBUS_FMT_UYVY8_2X8:
|
||||
{
|
||||
winseqe_set_addr = sensor_ClrFmt_UYVY;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (winseqe_set_addr != NULL) {
|
||||
sensor_write_array(client, winseqe_set_addr);
|
||||
sensor->info_priv.fmt.code = mf->code;
|
||||
sensor->info_priv.fmt.colorspace= mf->colorspace;
|
||||
SENSOR_DG("%s v4l2_mbus_code:%d set success!\n", SENSOR_NAME_STRING(),mf->code);
|
||||
} else {
|
||||
SENSOR_TR("%s v4l2_mbus_code:%d is invalidate!\n", SENSOR_NAME_STRING(),mf->code);
|
||||
}
|
||||
}
|
||||
|
||||
set_w = mf->width;
|
||||
fmt = sensor_find_datafmt(mf->code, sensor_colour_fmts,
|
||||
ARRAY_SIZE(sensor_colour_fmts));
|
||||
if (!fmt) {
|
||||
ret = -EINVAL;
|
||||
goto sensor_s_fmt_end;
|
||||
}
|
||||
|
||||
if (sensor->info_priv.fmt.code != mf->code) {
|
||||
switch (mf->code)
|
||||
{
|
||||
case V4L2_MBUS_FMT_YUYV8_2X8:
|
||||
{
|
||||
winseqe_set_addr = sensor_ClrFmt_YUYV;
|
||||
break;
|
||||
}
|
||||
case V4L2_MBUS_FMT_UYVY8_2X8:
|
||||
{
|
||||
winseqe_set_addr = sensor_ClrFmt_UYVY;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (winseqe_set_addr != NULL) {
|
||||
sensor_write_array(client, winseqe_set_addr);
|
||||
sensor->info_priv.fmt.code = mf->code;
|
||||
sensor->info_priv.fmt.colorspace= mf->colorspace;
|
||||
SENSOR_DG("%s v4l2_mbus_code:%d set success!\n", SENSOR_NAME_STRING(),mf->code);
|
||||
} else {
|
||||
SENSOR_TR("%s v4l2_mbus_code:%d is invalidate!\n", SENSOR_NAME_STRING(),mf->code);
|
||||
}
|
||||
}
|
||||
|
||||
set_w = mf->width;
|
||||
set_h = mf->height;
|
||||
|
||||
if (((set_w <= 176) && (set_h <= 144)) &&( sensor_qcif[0].reg!=0xff))
|
||||
|
|
@ -2184,33 +2125,33 @@ static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int sensor_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
|
||||
{
|
||||
static int sensor_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
|
||||
{
|
||||
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
||||
struct sensor *sensor = to_sensor(client);
|
||||
const struct sensor_datafmt *fmt;
|
||||
int ret = 0;
|
||||
|
||||
fmt = sensor_find_datafmt(mf->code, sensor_colour_fmts,
|
||||
ARRAY_SIZE(sensor_colour_fmts));
|
||||
if (fmt == NULL) {
|
||||
fmt = &sensor->info_priv.fmt;
|
||||
mf->code = fmt->code;
|
||||
}
|
||||
|
||||
if (mf->height > SENSOR_MAX_HEIGHT)
|
||||
mf->height = SENSOR_MAX_HEIGHT;
|
||||
else if (mf->height < SENSOR_MIN_HEIGHT)
|
||||
mf->height = SENSOR_MIN_HEIGHT;
|
||||
|
||||
if (mf->width > SENSOR_MAX_WIDTH)
|
||||
mf->width = SENSOR_MAX_WIDTH;
|
||||
else if (mf->width < SENSOR_MIN_WIDTH)
|
||||
mf->width = SENSOR_MIN_WIDTH;
|
||||
|
||||
mf->colorspace = fmt->colorspace;
|
||||
|
||||
return ret;
|
||||
struct sensor *sensor = to_sensor(client);
|
||||
const struct sensor_datafmt *fmt;
|
||||
int ret = 0;
|
||||
|
||||
fmt = sensor_find_datafmt(mf->code, sensor_colour_fmts,
|
||||
ARRAY_SIZE(sensor_colour_fmts));
|
||||
if (fmt == NULL) {
|
||||
fmt = &sensor->info_priv.fmt;
|
||||
mf->code = fmt->code;
|
||||
}
|
||||
|
||||
if (mf->height > SENSOR_MAX_HEIGHT)
|
||||
mf->height = SENSOR_MAX_HEIGHT;
|
||||
else if (mf->height < SENSOR_MIN_HEIGHT)
|
||||
mf->height = SENSOR_MIN_HEIGHT;
|
||||
|
||||
if (mf->width > SENSOR_MAX_WIDTH)
|
||||
mf->width = SENSOR_MAX_WIDTH;
|
||||
else if (mf->width < SENSOR_MIN_WIDTH)
|
||||
mf->width = SENSOR_MIN_WIDTH;
|
||||
|
||||
mf->colorspace = fmt->colorspace;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int sensor_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *id)
|
||||
|
|
@ -2970,25 +2911,25 @@ static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
|
|||
SENSOR_DG("\n%s..%s..cmd:%x \n",SENSOR_NAME_STRING(),__FUNCTION__,cmd);
|
||||
switch (cmd)
|
||||
{
|
||||
case RK_CAM_SUBDEV_DEACTIVATE:
|
||||
case RK29_CAM_SUBDEV_DEACTIVATE:
|
||||
{
|
||||
sensor_deactivate(client);
|
||||
break;
|
||||
}
|
||||
|
||||
case RK_CAM_SUBDEV_IOREQUEST:
|
||||
case RK29_CAM_SUBDEV_IOREQUEST:
|
||||
{
|
||||
sensor->sensor_io_request = (struct rkcamera_platform_data*)arg;
|
||||
sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
|
||||
if (sensor->sensor_io_request != NULL) {
|
||||
if (sensor->sensor_io_request->gpio_res[0].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
} else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
}
|
||||
} else {
|
||||
SENSOR_TR("%s %s RK_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
ret = -EINVAL;
|
||||
goto sensor_ioctl_end;
|
||||
}
|
||||
|
|
@ -3019,14 +2960,14 @@ static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
|
|||
return ret;
|
||||
|
||||
}
|
||||
static int sensor_enum_fmt(struct v4l2_subdev *sd, unsigned int index,
|
||||
enum v4l2_mbus_pixelcode *code)
|
||||
{
|
||||
if (index >= ARRAY_SIZE(sensor_colour_fmts))
|
||||
return -EINVAL;
|
||||
|
||||
*code = sensor_colour_fmts[index].code;
|
||||
return 0;
|
||||
static int sensor_enum_fmt(struct v4l2_subdev *sd, unsigned int index,
|
||||
enum v4l2_mbus_pixelcode *code)
|
||||
{
|
||||
if (index >= ARRAY_SIZE(sensor_colour_fmts))
|
||||
return -EINVAL;
|
||||
|
||||
*code = sensor_colour_fmts[index].code;
|
||||
return 0;
|
||||
}
|
||||
static struct v4l2_subdev_core_ops sensor_subdev_core_ops = {
|
||||
.init = sensor_init,
|
||||
|
|
@ -3038,11 +2979,11 @@ static struct v4l2_subdev_core_ops sensor_subdev_core_ops = {
|
|||
.ioctl = sensor_ioctl,
|
||||
};
|
||||
|
||||
static struct v4l2_subdev_video_ops sensor_subdev_video_ops = {
|
||||
.s_mbus_fmt = sensor_s_fmt,
|
||||
.g_mbus_fmt = sensor_g_fmt,
|
||||
.try_mbus_fmt = sensor_try_fmt,
|
||||
.enum_mbus_fmt = sensor_enum_fmt,
|
||||
static struct v4l2_subdev_video_ops sensor_subdev_video_ops = {
|
||||
.s_mbus_fmt = sensor_s_fmt,
|
||||
.g_mbus_fmt = sensor_g_fmt,
|
||||
.try_mbus_fmt = sensor_try_fmt,
|
||||
.enum_mbus_fmt = sensor_enum_fmt,
|
||||
};
|
||||
|
||||
static struct v4l2_subdev_ops sensor_subdev_ops = {
|
||||
|
|
|
|||
109
drivers/media/video/siv120b.c
Normal file → Executable file
109
drivers/media/video/siv120b.c
Normal file → Executable file
|
|
@ -20,8 +20,8 @@ o* Driver for MT9M001 CMOS Image Sensor from Micron
|
|||
#include <media/v4l2-common.h>
|
||||
#include <media/v4l2-chip-ident.h>
|
||||
#include <media/soc_camera.h>
|
||||
#include <mach/rk_camera.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <mach/rk29_camera.h>
|
||||
|
||||
static int debug;
|
||||
module_param(debug, int, S_IRUGO|S_IWUSR);
|
||||
|
||||
|
|
@ -44,18 +44,17 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define MAX(x,y) ((x>y) ? x: y)
|
||||
|
||||
/* Sensor Driver Configuration */
|
||||
#define SENSOR_NAME RK_CAM_SENSOR_SIV120B
|
||||
#define SENSOR_NAME RK29_CAM_SENSOR_SIV120B
|
||||
#define SENSOR_V4L2_IDENT V4L2_IDENT_SIV120B
|
||||
#define SENSOR_ID 0x12
|
||||
#define SENSOR_MIN_WIDTH 640//176
|
||||
#define SENSOR_MIN_HEIGHT 480//144
|
||||
#define SENSOR_MAX_WIDTH 640
|
||||
#define SENSOR_MAX_HEIGHT 480
|
||||
#define SENSOR_INIT_WIDTH sensor_init_width /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT sensor_init_height
|
||||
#define SENSOR_INIT_WINSEQADR sensor_init_winseq_p
|
||||
#define SENSOR_INIT_PIXFMT sensor_init_pixelcode
|
||||
#define SENSOR_BUS_PARAM sensor_init_busparam
|
||||
#define SENSOR_INIT_WIDTH 640 /* Sensor pixel size for sensor_init_data array */
|
||||
#define SENSOR_INIT_HEIGHT 480
|
||||
#define SENSOR_INIT_WINSEQADR sensor_vga
|
||||
#define SENSOR_INIT_PIXFMT V4L2_MBUS_FMT_YUYV8_2X8
|
||||
|
||||
#define CONFIG_SENSOR_WhiteBalance 0
|
||||
#define CONFIG_SENSOR_Brightness 0
|
||||
|
|
@ -75,6 +74,10 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
|
|||
#define CONFIG_SENSOR_I2C_NOSCHED 0
|
||||
#define CONFIG_SENSOR_I2C_RDWRCHK 0
|
||||
|
||||
#define SENSOR_BUS_PARAM (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING |\
|
||||
SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW |\
|
||||
SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ)
|
||||
|
||||
#define COLOR_TEMPERATURE_CLOUDY_DN 6500
|
||||
#define COLOR_TEMPERATURE_CLOUDY_UP 8000
|
||||
#define COLOR_TEMPERATURE_CLEARDAY_DN 5000
|
||||
|
|
@ -97,13 +100,6 @@ struct reginfo
|
|||
u8 val;
|
||||
};
|
||||
|
||||
static s32 sensor_init_width = 0;
|
||||
static s32 sensor_init_height = 0;
|
||||
static unsigned long sensor_init_busparam = (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING|SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW |SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ);
|
||||
static enum v4l2_mbus_pixelcode sensor_init_pixelcode = V4L2_MBUS_FMT_YUYV8_2X8;
|
||||
static struct reginfo* sensor_init_data_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_p = NULL;
|
||||
static struct reginfo* sensor_init_winseq_board = NULL;
|
||||
/* init 640X480 VGA */
|
||||
static struct reginfo sensor_init_data[] =
|
||||
{
|
||||
|
|
@ -1253,8 +1249,8 @@ struct sensor
|
|||
#if CONFIG_SENSOR_I2C_NOSCHED
|
||||
atomic_t tasklock_cnt;
|
||||
#endif
|
||||
struct rkcamera_platform_data *sensor_io_request;
|
||||
struct rkcamera_gpio_res *sensor_gpio_res;
|
||||
struct rk29camera_platform_data *sensor_io_request;
|
||||
struct rk29camera_gpio_res *sensor_gpio_res;
|
||||
};
|
||||
|
||||
static struct sensor* to_sensor(const struct i2c_client *client)
|
||||
|
|
@ -1417,7 +1413,7 @@ static int sensor_write_array(struct i2c_client *client, struct reginfo *regarra
|
|||
return 0;
|
||||
}
|
||||
#endif
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd cmd, int on)
|
||||
static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd cmd, int on)
|
||||
{
|
||||
struct soc_camera_link *icl = to_soc_camera_link(icd);
|
||||
int ret = 0;
|
||||
|
|
@ -1429,13 +1425,13 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rksensor_power_cmd c
|
|||
{
|
||||
if (icl->powerdown) {
|
||||
ret = icl->powerdown(icd->pdev, on);
|
||||
if (ret == RK_CAM_IO_SUCCESS) {
|
||||
if (ret == RK29_CAM_IO_SUCCESS) {
|
||||
if (on == 0) {
|
||||
mdelay(2);
|
||||
if (icl->reset)
|
||||
icl->reset(icd->pdev);
|
||||
}
|
||||
} else if (ret == RK_CAM_EIO_REQUESTFAIL) {
|
||||
} else if (ret == RK29_CAM_EIO_REQUESTFAIL) {
|
||||
ret = -ENODEV;
|
||||
goto sensor_power_end;
|
||||
}
|
||||
|
|
@ -1469,63 +1465,8 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
struct sensor *sensor = to_sensor(client);
|
||||
const struct v4l2_queryctrl *qctrl;
|
||||
const struct sensor_datafmt *fmt;
|
||||
char value;
|
||||
int ret,pid = 0,i = 0,j=0;
|
||||
struct rkcamera_platform_data* tmp_plat_data =(struct rkcamera_platform_data*)val;
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
sensor_init_winseq_p = sensor_vga;
|
||||
sensor_init_width = 640;
|
||||
sensor_init_height = 480;
|
||||
if (tmp_plat_data != NULL) {
|
||||
for(i = 0;i < RK_CAM_NUM_PER_HOST;i++){
|
||||
if ((tmp_plat_data->sensor_init_data[i])&& tmp_plat_data->info[i].dev_name &&
|
||||
(strcmp(tmp_plat_data->info[i].dev_name, dev_name(icd->pdev)) == 0))
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(tmp_plat_data && (i < RK_CAM_NUM_PER_HOST) && tmp_plat_data->sensor_init_data[i]){
|
||||
//user has defined the init data
|
||||
//init reg
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
for(j = 0;j< sizeof(sensor_init_data)/sizeof(struct reginfo);j++){
|
||||
sensor_init_data[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].reg;
|
||||
sensor_init_data[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data[j].val;
|
||||
}
|
||||
sensor_init_data_p = sensor_init_data;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data){
|
||||
sensor_init_data_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_data);
|
||||
}
|
||||
//init winseq
|
||||
if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq && (sizeof(struct reginfo) != sizeof(struct reginfo_t))){
|
||||
int tmp_winseq_size = tmp_plat_data->sensor_init_data[i]->rk_sensor_winseq_size;
|
||||
if(sensor_init_winseq_board)
|
||||
{
|
||||
vfree(sensor_init_winseq_board);
|
||||
sensor_init_winseq_board = NULL;
|
||||
}
|
||||
sensor_init_winseq_board = (struct reginfo*)vmalloc(tmp_winseq_size);
|
||||
if(!sensor_init_winseq_board)
|
||||
SENSOR_TR("%s :vmalloc erro !",__FUNCTION__);
|
||||
for(j = 0;j< tmp_winseq_size;j++){
|
||||
sensor_init_winseq_board[j].reg = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].reg;
|
||||
sensor_init_winseq_board[j].val = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq[j].val;
|
||||
}
|
||||
sensor_init_winseq_p = sensor_init_winseq_board;
|
||||
}
|
||||
else if(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq){
|
||||
sensor_init_winseq_p = (struct reginfo*)(tmp_plat_data->sensor_init_data[i]->rk_sensor_init_winseq);
|
||||
}
|
||||
//init width,height,bus,pixelcode
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width != INVALID_VALUE)
|
||||
sensor_init_width = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_width;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height != INVALID_VALUE)
|
||||
sensor_init_height = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_height;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param != INVALID_VALUE)
|
||||
sensor_init_busparam = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_bus_param;
|
||||
if(tmp_plat_data->sensor_init_data[i] && tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode != INVALID_VALUE)
|
||||
sensor_init_pixelcode = tmp_plat_data->sensor_init_data[i]->rk_sensor_init_pixelcode;
|
||||
}
|
||||
int ret, i;
|
||||
|
||||
SENSOR_DG("\n%s..%s.. \n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
|
||||
if (sensor_ioctrl(icd, Sensor_PowerDown, 0) < 0) {
|
||||
|
|
@ -1550,7 +1491,7 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
|||
|
||||
// ret = sensor_write(client, sensor_init_data + i*2, sensor_init_data + i*2 + 1);
|
||||
// printk("write to reg[0x%x] 0x%x\n",sensor_init_data[i].reg,sensor_init_data[i].val);
|
||||
ret = sensor_write(client, sensor_init_data_p[i].reg, sensor_init_data_p[i].val);
|
||||
ret = sensor_write(client, sensor_init_data[i].reg, sensor_init_data[i].val);
|
||||
//ret = sensor_write_array(client, sensor_init_data);
|
||||
if (ret != 0)
|
||||
{
|
||||
|
|
@ -2658,25 +2599,25 @@ static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
|
|||
SENSOR_DG("\n%s..%s..cmd:%x \n",SENSOR_NAME_STRING(),__FUNCTION__,cmd);
|
||||
switch (cmd)
|
||||
{
|
||||
case RK_CAM_SUBDEV_DEACTIVATE:
|
||||
case RK29_CAM_SUBDEV_DEACTIVATE:
|
||||
{
|
||||
sensor_deactivate(client);
|
||||
break;
|
||||
}
|
||||
|
||||
case RK_CAM_SUBDEV_IOREQUEST:
|
||||
case RK29_CAM_SUBDEV_IOREQUEST:
|
||||
{
|
||||
sensor->sensor_io_request = (struct rkcamera_platform_data*)arg;
|
||||
sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
|
||||
if (sensor->sensor_io_request != NULL) {
|
||||
if (sensor->sensor_io_request->gpio_res[0].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
|
||||
} else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
|
||||
(strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
|
||||
sensor->sensor_gpio_res = (struct rkcamera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
|
||||
}
|
||||
} else {
|
||||
SENSOR_TR("%s %s RK_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
|
||||
ret = -EINVAL;
|
||||
goto sensor_ioctl_end;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user