#include <linux/rfkill-rk.h>
#include <linux/sensor-dev.h>
+#ifdef CONFIG_VIDEO_RK29
+/*---------------- Camera Sensor Macro Define Begin ------------------------*/
+/*---------------- Camera Sensor Configuration Macro Begin ------------------------*/
+#define CONFIG_SENSOR_0 RK29_CAM_SENSOR_OV5642 /* back camera sensor */
+#define CONFIG_SENSOR_IIC_ADDR_0 0x78
+#define CONFIG_SENSOR_IIC_ADAPTER_ID_0 4
+#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 RK30_PIN1_PD6
+#define CONFIG_SENSOR_FALSH_PIN_0 INVALID_GPIO
+#define CONFIG_SENSOR_POWERACTIVE_LEVEL_0 RK29_CAM_POWERACTIVE_L
+#define CONFIG_SENSOR_RESETACTIVE_LEVEL_0 RK29_CAM_RESETACTIVE_L
+#define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_0 RK29_CAM_POWERDNACTIVE_H
+#define CONFIG_SENSOR_FLASHACTIVE_LEVEL_0 RK29_CAM_FLASHACTIVE_L
+
+#define CONFIG_SENSOR_QCIF_FPS_FIXED_0 15000
+#define CONFIG_SENSOR_240X160_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_01 RK29_CAM_SENSOR_OV5642 /* back camera sensor 1 */
+#define CONFIG_SENSOR_IIC_ADDR_01 0x00
+#define CONFIG_SENSOR_CIF_INDEX_01 0
+#define CONFIG_SENSOR_IIC_ADAPTER_ID_01 4
+#define CONFIG_SENSOR_ORIENTATION_01 90
+#define CONFIG_SENSOR_POWER_PIN_01 INVALID_GPIO
+#define CONFIG_SENSOR_RESET_PIN_01 INVALID_GPIO
+#define CONFIG_SENSOR_POWERDN_PIN_01 RK30_PIN1_PD6
+#define CONFIG_SENSOR_FALSH_PIN_01 INVALID_GPIO
+#define CONFIG_SENSOR_POWERACTIVE_LEVEL_01 RK29_CAM_POWERACTIVE_L
+#define CONFIG_SENSOR_RESETACTIVE_LEVEL_01 RK29_CAM_RESETACTIVE_L
+#define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_01 RK29_CAM_POWERDNACTIVE_H
+#define CONFIG_SENSOR_FLASHACTIVE_LEVEL_01 RK29_CAM_FLASHACTIVE_L
+
+#define CONFIG_SENSOR_QCIF_FPS_FIXED_01 15000
+#define CONFIG_SENSOR_240X160_FPS_FIXED_01 15000
+#define CONFIG_SENSOR_QVGA_FPS_FIXED_01 15000
+#define CONFIG_SENSOR_CIF_FPS_FIXED_01 15000
+#define CONFIG_SENSOR_VGA_FPS_FIXED_01 15000
+#define CONFIG_SENSOR_480P_FPS_FIXED_01 15000
+#define CONFIG_SENSOR_SVGA_FPS_FIXED_01 15000
+#define CONFIG_SENSOR_720P_FPS_FIXED_01 30000
+
+#define CONFIG_SENSOR_02 RK29_CAM_SENSOR_OV5640 /* back camera sensor 2 */
+#define CONFIG_SENSOR_IIC_ADDR_02 0x00
+#define CONFIG_SENSOR_CIF_INDEX_02 0
+#define CONFIG_SENSOR_IIC_ADAPTER_ID_02 4
+#define CONFIG_SENSOR_ORIENTATION_02 90
+#define CONFIG_SENSOR_POWER_PIN_02 INVALID_GPIO
+#define CONFIG_SENSOR_RESET_PIN_02 INVALID_GPIO
+#define CONFIG_SENSOR_POWERDN_PIN_02 RK30_PIN1_PD6
+#define CONFIG_SENSOR_FALSH_PIN_02 INVALID_GPIO
+#define CONFIG_SENSOR_POWERACTIVE_LEVEL_02 RK29_CAM_POWERACTIVE_L
+#define CONFIG_SENSOR_RESETACTIVE_LEVEL_02 RK29_CAM_RESETACTIVE_L
+#define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_02 RK29_CAM_POWERDNACTIVE_H
+#define CONFIG_SENSOR_FLASHACTIVE_LEVEL_02 RK29_CAM_FLASHACTIVE_L
+
+#define CONFIG_SENSOR_QCIF_FPS_FIXED_02 15000
+#define CONFIG_SENSOR_240X160_FPS_FIXED_02 15000
+#define CONFIG_SENSOR_QVGA_FPS_FIXED_02 15000
+#define CONFIG_SENSOR_CIF_FPS_FIXED_02 15000
+#define CONFIG_SENSOR_VGA_FPS_FIXED_02 15000
+#define CONFIG_SENSOR_480P_FPS_FIXED_02 15000
+#define CONFIG_SENSOR_SVGA_FPS_FIXED_02 15000
+#define CONFIG_SENSOR_720P_FPS_FIXED_02 30000
+
+#define CONFIG_SENSOR_1 RK29_CAM_SENSOR_OV2659 /* front camera sensor 0 */
+#define CONFIG_SENSOR_IIC_ADDR_1 0x60
+#define CONFIG_SENSOR_IIC_ADAPTER_ID_1 3
+#define CONFIG_SENSOR_CIF_INDEX_1 0
+#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 RK30_PIN1_PB7
+#define CONFIG_SENSOR_FALSH_PIN_1 INVALID_GPIO
+#define CONFIG_SENSOR_POWERACTIVE_LEVEL_1 RK29_CAM_POWERACTIVE_L
+#define CONFIG_SENSOR_RESETACTIVE_LEVEL_1 RK29_CAM_RESETACTIVE_L
+#define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_1 RK29_CAM_POWERDNACTIVE_H
+#define CONFIG_SENSOR_FLASHACTIVE_LEVEL_1 RK29_CAM_FLASHACTIVE_L
+
+#define CONFIG_SENSOR_QCIF_FPS_FIXED_1 15000
+#define CONFIG_SENSOR_240X160_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_SENSOR_11 RK29_CAM_SENSOR_OV2659 /* front camera sensor 1 */
+#define CONFIG_SENSOR_IIC_ADDR_11 0x00
+#define CONFIG_SENSOR_IIC_ADAPTER_ID_11 3
+#define CONFIG_SENSOR_CIF_INDEX_11 0
+#define CONFIG_SENSOR_ORIENTATION_11 270
+#define CONFIG_SENSOR_POWER_PIN_11 INVALID_GPIO
+#define CONFIG_SENSOR_RESET_PIN_11 INVALID_GPIO
+#define CONFIG_SENSOR_POWERDN_PIN_11 INVALID_GPIO//RK30_PIN1_PB7
+#define CONFIG_SENSOR_FALSH_PIN_11 INVALID_GPIO
+#define CONFIG_SENSOR_POWERACTIVE_LEVEL_11 RK29_CAM_POWERACTIVE_L
+#define CONFIG_SENSOR_RESETACTIVE_LEVEL_11 RK29_CAM_RESETACTIVE_L
+#define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_11 RK29_CAM_POWERDNACTIVE_H
+#define CONFIG_SENSOR_FLASHACTIVE_LEVEL_11 RK29_CAM_FLASHACTIVE_L
+
+#define CONFIG_SENSOR_QCIF_FPS_FIXED_11 15000
+#define CONFIG_SENSOR_240X160_FPS_FIXED_11 15000
+#define CONFIG_SENSOR_QVGA_FPS_FIXED_11 15000
+#define CONFIG_SENSOR_CIF_FPS_FIXED_11 15000
+#define CONFIG_SENSOR_VGA_FPS_FIXED_11 15000
+#define CONFIG_SENSOR_480P_FPS_FIXED_11 15000
+#define CONFIG_SENSOR_SVGA_FPS_FIXED_11 15000
+#define CONFIG_SENSOR_720P_FPS_FIXED_11 30000
+
+#define CONFIG_SENSOR_12 RK29_CAM_SENSOR_OV2659//RK29_CAM_SENSOR_OV2655 /* front camera sensor 2 */
+#define CONFIG_SENSOR_IIC_ADDR_12 0x00
+#define CONFIG_SENSOR_IIC_ADAPTER_ID_12 3
+#define CONFIG_SENSOR_CIF_INDEX_12 0
+#define CONFIG_SENSOR_ORIENTATION_12 270
+#define CONFIG_SENSOR_POWER_PIN_12 INVALID_GPIO
+#define CONFIG_SENSOR_RESET_PIN_12 INVALID_GPIO
+#define CONFIG_SENSOR_POWERDN_PIN_12 INVALID_GPIO//RK30_PIN1_PB7
+#define CONFIG_SENSOR_FALSH_PIN_12 INVALID_GPIO
+#define CONFIG_SENSOR_POWERACTIVE_LEVEL_12 RK29_CAM_POWERACTIVE_L
+#define CONFIG_SENSOR_RESETACTIVE_LEVEL_12 RK29_CAM_RESETACTIVE_L
+#define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_12 RK29_CAM_POWERDNACTIVE_H
+#define CONFIG_SENSOR_FLASHACTIVE_LEVEL_12 RK29_CAM_FLASHACTIVE_L
+
+#define CONFIG_SENSOR_QCIF_FPS_FIXED_12 15000
+#define CONFIG_SENSOR_240X160_FPS_FIXED_12 15000
+#define CONFIG_SENSOR_QVGA_FPS_FIXED_12 15000
+#define CONFIG_SENSOR_CIF_FPS_FIXED_12 15000
+#define CONFIG_SENSOR_VGA_FPS_FIXED_12 15000
+#define CONFIG_SENSOR_480P_FPS_FIXED_12 15000
+#define CONFIG_SENSOR_SVGA_FPS_FIXED_12 15000
+#define CONFIG_SENSOR_720P_FPS_FIXED_12 30000
+
+
+#endif //#ifdef CONFIG_VIDEO_RK29
+/*---------------- Camera Sensor Configuration Macro End------------------------*/
+#include "../../../drivers/media/video/rk2928_camera.c"
+/*---------------- Camera Sensor Macro Define End ---------*/
#define RK2928_FB_MEM_SIZE 3*SZ_1M
--- /dev/null
+/* 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_RK2928_H_
+
+#define __ASM_ARCH_CAMERA_RK2928_H_
+#define RK29_CAM_DRV_NAME "rk-camera-rk2928"
+
+#include <plat/rk_camera.h>
+
+#endif
+
obj-$(CONFIG_VIDEO_RK29_WORK_ONEFRAME) += rk30_camera_oneframe.o
obj-$(CONFIG_VIDEO_RK29_WORK_PINGPONG) += rk30_camera_pingpong.o
endif
+ifeq ($(CONFIG_ARCH_RK2928),y)
+obj-$(CONFIG_VIDEO_RK29_WORK_ONEFRAME) += rk30_camera_oneframe.o
+obj-$(CONFIG_VIDEO_RK29_WORK_PINGPONG) += rk30_camera_pingpong.o
+endif
ifeq ($(CONFIG_ARCH_RK29),y)
obj-$(CONFIG_VIDEO_RK29_WORK_ONEFRAME) += rk29_camera_oneframe.o
obj-$(CONFIG_VIDEO_RK29_WORK_PINGPONG) += rk29_camera_pingpong.o
--- /dev/null
+\r
+#include <mach/iomux.h>\r
+#include <media/soc_camera.h>\r
+#include <linux/android_pmem.h>\r
+#include <mach/rk2928_camera.h>\r
+#ifndef PMEM_CAM_SIZE\r
+#include "../../../arch/arm/plat-rk/rk_camera.c"\r
+#else\r
+/*****************************************************************************************\r
+ * camera devices\r
+ * author: ddl@rock-chips.com\r
+ *****************************************************************************************/\r
+#ifdef CONFIG_VIDEO_RK29 \r
+\r
+static int rk_sensor_iomux(int pin)\r
+{ \r
+ return 0;\r
+}\r
+#define PMEM_CAM_BASE 0 //just for compile ,no meaning\r
+#include "../../../arch/arm/plat-rk/rk_camera.c"\r
+\r
+\r
+static u64 rockchip_device_camera_dmamask = 0xffffffffUL;\r
+static struct resource rk_camera_resource_host_0[] = {\r
+ [0] = {\r
+ .start = RK2928_CIF_PHYS,\r
+ .end = RK2928_CIF_PHYS + RK2928_CIF_SIZE - 1,\r
+ .flags = IORESOURCE_MEM,\r
+ },\r
+ [1] = {\r
+ .start = IRQ_CIF,\r
+ .end = IRQ_CIF,\r
+ .flags = IORESOURCE_IRQ,\r
+ }\r
+};\r
+static struct resource rk_camera_resource_host_1[] = {\r
+ [0] = {\r
+ .start = RK2928_CIF_PHYS,\r
+ .end = RK2928_CIF_PHYS+ RK2928_CIF_SIZE - 1,\r
+ .flags = IORESOURCE_MEM,\r
+ },\r
+ [1] = {\r
+ .start = IRQ_CIF,\r
+ .end = IRQ_CIF,\r
+ .flags = IORESOURCE_IRQ,\r
+ }\r
+};\r
+/*platform_device : */\r
+ struct platform_device rk_device_camera_host_0 = {\r
+ .name = RK29_CAM_DRV_NAME,\r
+ .id = RK_CAM_PLATFORM_DEV_ID_0, /* This is used to put cameras on this interface */\r
+ .num_resources = ARRAY_SIZE(rk_camera_resource_host_0),\r
+ .resource = rk_camera_resource_host_0,\r
+ .dev = {\r
+ .dma_mask = &rockchip_device_camera_dmamask,\r
+ .coherent_dma_mask = 0xffffffffUL,\r
+ .platform_data = &rk_camera_platform_data,\r
+ }\r
+};\r
+/*platform_device : */\r
+ struct platform_device rk_device_camera_host_1 = {\r
+ .name = RK29_CAM_DRV_NAME,\r
+ .id = RK_CAM_PLATFORM_DEV_ID_1, /* This is used to put cameras on this interface */\r
+ .num_resources = ARRAY_SIZE(rk_camera_resource_host_1),\r
+ .resource = rk_camera_resource_host_1,\r
+ .dev = {\r
+ .dma_mask = &rockchip_device_camera_dmamask,\r
+ .coherent_dma_mask = 0xffffffffUL,\r
+ .platform_data = &rk_camera_platform_data,\r
+ }\r
+};\r
+\r
+static void rk_init_camera_plateform_data(void)\r
+{\r
+ int i,dev_idx;\r
+ \r
+ dev_idx = 0;\r
+ for (i=0; i<RK_CAM_NUM; i++) {\r
+ rk_camera_platform_data.sensor_init_data[i] = &rk_init_data_sensor[i];\r
+ if (rk_camera_platform_data.register_dev[i].device_info.name) { \r
+ rk_camera_platform_data.register_dev[i].link_info.board_info = \r
+ &rk_camera_platform_data.register_dev[i].i2c_cam_info;\r
+ rk_camera_platform_data.register_dev[i].device_info.id = dev_idx;\r
+ rk_camera_platform_data.register_dev[i].device_info.dev.platform_data = \r
+ &rk_camera_platform_data.register_dev[i].link_info;\r
+ dev_idx++;\r
+ }\r
+ }\r
+}\r
+\r
+static void rk30_camera_request_reserve_mem(void)\r
+{\r
+#ifdef CONFIG_VIDEO_RK29_WORK_IPP\r
+ #ifdef VIDEO_RKCIF_WORK_SIMUL_OFF\r
+ rk_camera_platform_data.meminfo.name = "camera_ipp_mem";\r
+ rk_camera_platform_data.meminfo.start = board_mem_reserve_add("camera_ipp_mem",PMEM_CAMIPP_NECESSARY);\r
+ rk_camera_platform_data.meminfo.size= PMEM_CAMIPP_NECESSARY;\r
+\r
+ memcpy(&rk_camera_platform_data.meminfo_cif1,&rk_camera_platform_data.meminfo,sizeof(struct rk29camera_mem_res));\r
+ #else\r
+ rk_camera_platform_data.meminfo.name = "camera_ipp_mem_0";\r
+ rk_camera_platform_data.meminfo.start = board_mem_reserve_add("camera_ipp_mem_0",PMEM_CAMIPP_NECESSARY_CIF_0);\r
+ rk_camera_platform_data.meminfo.size= PMEM_CAMIPP_NECESSARY_CIF_0;\r
+ \r
+ rk_camera_platform_data.meminfo_cif1.name = "camera_ipp_mem_1";\r
+ rk_camera_platform_data.meminfo_cif1.start =board_mem_reserve_add("camera_ipp_mem_1",PMEM_CAMIPP_NECESSARY_CIF_1);\r
+ rk_camera_platform_data.meminfo_cif1.size= PMEM_CAMIPP_NECESSARY_CIF_1;\r
+ #endif\r
+ #endif\r
+ #if PMEM_CAM_NECESSARY\r
+ android_pmem_cam_pdata.start = board_mem_reserve_add((char*)(android_pmem_cam_pdata.name),PMEM_CAM_NECESSARY);\r
+ android_pmem_cam_pdata.size= PMEM_CAM_NECESSARY;\r
+ #endif\r
+\r
+}\r
+static int rk_register_camera_devices(void)\r
+{\r
+ int i;\r
+ int host_registered_0,host_registered_1;\r
+ \r
+ rk_init_camera_plateform_data();\r
+\r
+ host_registered_0 = 0;\r
+ host_registered_1 = 0;\r
+ for (i=0; i<RK_CAM_NUM; i++) {\r
+ if (rk_camera_platform_data.register_dev[i].device_info.name) {\r
+ if (rk_camera_platform_data.register_dev[i].link_info.bus_id == RK_CAM_PLATFORM_DEV_ID_0) {\r
+ if (!host_registered_0) {\r
+ platform_device_register(&rk_device_camera_host_0);\r
+ host_registered_0 = 1;\r
+ }\r
+ } else if (rk_camera_platform_data.register_dev[i].link_info.bus_id == RK_CAM_PLATFORM_DEV_ID_1) {\r
+ if (!host_registered_1) {\r
+ platform_device_register(&rk_device_camera_host_1);\r
+ host_registered_1 = 1;\r
+ }\r
+ } \r
+ }\r
+ }\r
+\r
+ for (i=0; i<RK_CAM_NUM; i++) {\r
+ if (rk_camera_platform_data.register_dev[i].device_info.name) {\r
+ platform_device_register(&rk_camera_platform_data.register_dev[i].device_info);\r
+ }\r
+ }\r
+ #if PMEM_CAM_NECESSARY\r
+ platform_device_register(&android_pmem_cam_device);\r
+ #endif\r
+ \r
+ return 0;\r
+}\r
+\r
+module_init(rk_register_camera_devices);\r
+#endif\r
+\r
+#endif //#ifdef CONFIG_VIDEO_RK\r
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
-#ifdef CONFIG_ARCH_RK30
+#if defined(CONFIG_ARCH_RK2928) || defined(CONFIG_ARCH_RK30)
#include <linux/init.h>
#include <linux/module.h>
#include <linux/io.h>
#include <media/soc_mediabus.h>
#include <mach/io.h>
#include <plat/ipp.h>
+#ifdef CONFIG_ARCH_RK30
#include <mach/rk30_camera.h>
-#include <mach/cru.h>
-#include <mach/pmu.h>
+#else
+#include <mach/rk2928_camera.h>
+#define RK30_CRU_BASE 0
+#endif
+//#include <mach/cru.h>
+//#include <mach/pmu.h>
+
static int debug ;
module_param(debug, int, S_IRUGO|S_IWUSR);
}
#if 1
{
+#ifdef CONFIG_ARCH_RK30
mdelay(100);
if(IS_CIF0()){
// pmu_set_idle_request(IDLE_REQ_VIO, true);
cru_set_soft_reset(SOFT_RST_CIF1, false);
// pmu_set_idle_request(IDLE_REQ_VIO, false);
}
+#endif
}
write_cif_reg(pcdev->base,CIF_CIF_CTRL,AXI_BURST_16|MODE_ONEFRAME|DISABLE_CAPTURE); /* ddl@rock-chips.com : vip ahb burst 16 */
write_cif_reg(pcdev->base,CIF_CIF_INTEN, 0x01|0x200); //capture complete interrupt enable
};
static void rk_camera_cif_iomux(int cif_index)
{
+#ifdef CONFIG_ARCH_RK30
switch(cif_index){
case 0:
rk30_mux_api_set(GPIO1B3_CIF0CLKOUT_NAME, GPIO1B_CIF0_CLKOUT);
default:
printk("cif index is erro!!!\n");
}
+#else
+#endif
}
}
}
-#ifdef CONFIG_VIDEO_RK29_WORK_IPP
+//#ifdef CONFIG_VIDEO_RK29_WORK_IPP
if(IS_CIF0()){
pcdev->camera_wq = create_workqueue("rk_cam_wkque_cif0");
}
}
if (pcdev->camera_wq == NULL)
goto exit_free_irq;
-#endif
+//#endif
pcdev->camera_reinit_work.pcdev = pcdev;
INIT_WORK(&(pcdev->camera_reinit_work.work), rk_camera_reinit_work);