summaryrefslogtreecommitdiff
path: root/drivers/media/sprd_isp/isp2.0/pike
diff options
context:
space:
mode:
authorYuval Adam <_@yuv.al>2017-08-30 08:25:59 +0000
committerYuval Adam <_@yuv.al>2017-08-30 08:25:59 +0000
commit8e4bff4cab0ddac6060645b0715210484d02ff40 (patch)
tree3a5c3024371a04692a3a6d9974d001cdff8ebf84 /drivers/media/sprd_isp/isp2.0/pike
Initial file dump from open source releaseHEADmaster
Diffstat (limited to 'drivers/media/sprd_isp/isp2.0/pike')
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/inc/isp_block.h72
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/inc/isp_drv.h94
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/inc/isp_reg.h801
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_cfg_param.c133
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_1d_lsc.c146
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_2d_lsc.c537
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_aca.c78
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_anti_flicker.c155
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_arbiter.c177
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_awb.c191
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_bdn.c121
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_binning4awb.c231
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_blc.c66
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_bpc.c101
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_brightness.c67
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_capability.c195
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_cce.c147
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_cdn.c109
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_cfa.c90
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_cmc10.c93
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_cmc8.c92
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_common.c411
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_contrast.c67
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_csa.c68
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_csc.c114
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_css.c112
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_ct.c92
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_dispatch.c143
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_edge.c128
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_emboss.c74
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_fetch.c127
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_gamma.c143
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_grgb.c70
-rwxr-xr-xdrivers/media/sprd_isp/isp2.0/pike/src/isp_k_hdr.c142
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_hist.c131
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_hist2.c95
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_hsv.c95
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_hua.c68
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_isr.c101
-rwxr-xr-xdrivers/media/sprd_isp/isp2.0/pike/src/isp_k_nlc.c83
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_nlm.c202
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_pgg.c67
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_post_cdn.c129
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_pre_cdn.c135
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_pre_cdn_rgb.c73
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_prefilter.c73
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_pstrz.c71
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_pwd.c123
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_raw_aem.c255
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_raw_afm.c497
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_rgb2y.c62
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_rgb_afm.c415
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_rgb_gain.c69
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_rgb_gain2.c67
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_store.c101
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_uv_prefilter.c68
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_y_delay.c63
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_y_gamma.c133
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_yiq_aem.c121
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_yiq_afm.c120
-rw-r--r--drivers/media/sprd_isp/isp2.0/pike/src/isp_k_yuv_nlm.c135
61 files changed, 8939 insertions, 0 deletions
diff --git a/drivers/media/sprd_isp/isp2.0/pike/inc/isp_block.h b/drivers/media/sprd_isp/isp2.0/pike/inc/isp_block.h
new file mode 100644
index 00000000..63103ea0
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/inc/isp_block.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include "isp_drv.h"
+
+int32_t isp_k_cfg_pgg(struct isp_io_param *param);
+int32_t isp_k_cfg_blc(struct isp_io_param *param);
+int32_t isp_k_cfg_rgb_gain(struct isp_io_param *param);
+int32_t isp_k_cfg_pwd(struct isp_io_param *param);
+int32_t isp_k_cfg_nlc(struct isp_io_param *param);
+int32_t isp_k_cfg_2d_lsc(struct isp_io_param *param, struct isp_k_private *isp_private);
+int32_t isp_k_cfg_1d_lsc(struct isp_io_param *param);
+int32_t isp_k_cfg_binning(struct isp_io_param *param, struct isp_k_private *isp_private);
+int32_t isp_k_cfg_awb(struct isp_io_param *param, struct isp_k_private *isp_private);
+int32_t isp_k_cfg_raw_aem(struct isp_io_param *param, struct isp_k_private *isp_private);
+int32_t isp_k_cfg_bpc(struct isp_io_param *param);
+int32_t isp_k_cfg_bdn(struct isp_io_param *param);
+int32_t isp_k_cfg_grgb(struct isp_io_param *param);
+int32_t isp_k_cfg_rgb_gain2(struct isp_io_param *param);
+int32_t isp_k_cfg_nlm(struct isp_io_param *param);
+int32_t isp_k_cfg_cfa(struct isp_io_param *param);
+int32_t isp_k_cfg_cmc10(struct isp_io_param *param);
+int32_t isp_k_cfg_hdr(struct isp_io_param *param);
+int32_t isp_k_cfg_gamma(struct isp_io_param *param, struct isp_k_private *isp_private);
+int32_t isp_k_cfg_cmc8(struct isp_io_param *param);
+int32_t isp_k_cfg_ct(struct isp_io_param *param, struct isp_k_private *isp_private);
+int32_t isp_k_cfg_hsv(struct isp_io_param *param);
+int32_t isp_k_cfg_rgb_afm(struct isp_io_param *param);
+int32_t isp_k_cfg_cce(struct isp_io_param *param);
+int32_t isp_k_cfg_pre_cdn_rgb(struct isp_io_param *param);
+int32_t isp_k_cfg_yuv_precdn(struct isp_io_param *param);
+int32_t isp_k_cfg_posterize(struct isp_io_param *param);
+int32_t isp_k_cfg_csc(struct isp_io_param *param);
+int32_t isp_k_cfg_yiq_aem(struct isp_io_param *param);
+int32_t isp_k_cfg_anti_flicker(struct isp_io_param *param, struct isp_k_private *isp_private);
+int32_t isp_k_cfg_yiq_afm(struct isp_io_param *param);
+int32_t isp_k_cfg_prefilter(struct isp_io_param *param);
+int32_t isp_k_cfg_brightness(struct isp_io_param *param);
+int32_t isp_k_cfg_contrast(struct isp_io_param *param);
+int32_t isp_k_cfg_hist(struct isp_io_param *param);
+int32_t isp_k_cfg_hist2(struct isp_io_param *param);
+int32_t isp_k_cfg_aca(struct isp_io_param *param);
+int32_t isp_k_cfg_yuv_cdn(struct isp_io_param *param);
+int32_t isp_k_cfg_edge(struct isp_io_param *param);
+int32_t isp_k_cfg_css(struct isp_io_param *param);
+int32_t isp_k_cfg_csa(struct isp_io_param *param);
+int32_t isp_k_cfg_post_cdn(struct isp_io_param *param);
+int32_t isp_k_cfg_hue(struct isp_io_param *param);
+int32_t isp_k_cfg_emboss(struct isp_io_param *param);
+int32_t isp_k_cfg_ydelay(struct isp_io_param *param);
+int32_t isp_k_cfg_ygamma(struct isp_io_param *param, struct isp_k_private *isp_private);;
+int32_t isp_k_cfg_iircnr(struct isp_io_param *param);
+int32_t isp_k_cfg_fetch(struct isp_io_param *param);
+int32_t isp_k_cfg_store(struct isp_io_param *param);
+int32_t isp_k_cfg_dispatch(struct isp_io_param *param);
+int32_t isp_k_cfg_arbiter(struct isp_io_param *param);
+int32_t isp_k_cfg_common(struct isp_io_param *param);
+int32_t isp_k_cfg_raw_sizer(struct isp_io_param *param);
+//pike add
+int32_t isp_k_cfg_yuv_nlm(struct isp_io_param *param);
+int32_t isp_k_cfg_uv_prefilter(struct isp_io_param *param);
+int32_t isp_k_cfg_rgb2y(struct isp_io_param *param); \ No newline at end of file
diff --git a/drivers/media/sprd_isp/isp2.0/pike/inc/isp_drv.h b/drivers/media/sprd_isp/isp2.0/pike/inc/isp_drv.h
new file mode 100644
index 00000000..d27f4e40
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/inc/isp_drv.h
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#ifndef _ISP_DRV_HEADER_
+#define _ISP_DRV_HEADER_
+
+#include <linux/semaphore.h>
+#include <linux/spinlock_types.h>
+
+#define ISP_QUEUE_LENGTH 16
+#define ISP_BING4AWB_NUM 2
+
+struct isp_node {
+ uint32_t irq_val0;
+ uint32_t irq_val1;
+ uint32_t irq_val2;
+ uint32_t irq_val3;
+ uint32_t reserved;
+ struct isp_time time;
+};
+
+struct isp_queue {
+ struct isp_node node[ISP_QUEUE_LENGTH];
+ struct isp_node *write;
+ struct isp_node *read;
+};
+
+struct isp_b4awb_buf {
+ uint32_t buf_id;
+ uint32_t buf_flag;
+ unsigned long buf_phys_addr;
+};
+
+struct isp_k_private {
+ atomic_t users;
+ struct device_node *dn;
+ struct clk *clock;
+ struct semaphore device_lock;
+ struct semaphore ioctl_lock;
+ unsigned long block_buf_addr;
+ uint32_t block_buf_len;
+ unsigned long reg_buf_addr;
+ uint32_t reg_buf_len;
+ uint32_t lsc_load_buf_id;
+ uint32_t lsc_update_buf_id;
+ unsigned long raw_aem_buf_addr;
+ uint32_t raw_aem_buf_len;
+ uint32_t ct_load_buf_id;
+ unsigned long full_gamma_buf_addr;
+ uint32_t full_gamma_buf_len;
+ uint32_t full_gamma_buf_id;
+ unsigned long yuv_ygamma_buf_addr;
+ uint32_t yuv_ygamma_buf_len;
+ uint32_t yuv_ygamma_buf_id;
+ unsigned long raw_awbm_buf_addr;
+ uint32_t raw_awbm_buf_len;
+ struct isp_b4awb_buf b4awb_buf[ISP_BING4AWB_NUM];
+ uint32_t lsc_buf_phys_addr;
+ unsigned long yiq_antiflicker_buf_addr;
+ uint32_t yiq_antiflicker_len;
+ uint32_t yiq_antiflicker_order;
+ unsigned long yiq_aem_buf_addr;
+ uint32_t yiq_aem_buf_len;
+};
+
+struct isp_drv_private {
+ spinlock_t isr_lock;
+ struct semaphore isr_done_lock;
+ struct isp_queue queue;
+};
+
+struct isp_k_file {
+ struct isp_k_private *isp_private;
+ struct isp_drv_private drv_private;
+};
+
+int32_t isp_get_int_num(struct isp_node *node);
+void isp_clr_int(void);
+void isp_en_irq(uint32_t irq_mode);
+int32_t isp_axi_bus_waiting(void);
+int32_t isp_capability(void *param);
+int32_t isp_cfg_param(void *param, struct isp_k_private *isp_private);
+
+#endif
diff --git a/drivers/media/sprd_isp/isp2.0/pike/inc/isp_reg.h b/drivers/media/sprd_isp/isp2.0/pike/inc/isp_reg.h
new file mode 100644
index 00000000..48e9b4fe
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/inc/isp_reg.h
@@ -0,0 +1,801 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+//#include <mach/hardware.h>
+#ifndef CONFIG_64BIT
+#include <soc/sprd/hardware.h>
+#endif
+#include "parse_hwinfo_tshark2.h"
+
+#define ISP_BASE_ADDR ISP_BASE//SPRD_ISP_BASE
+
+/*isp sub block: Interrupt*/
+#define ISP_INT_STATUS (ISP_BASE_ADDR+0x0000UL)
+#define ISP_INT_EN0 (ISP_BASE_ADDR+0x0014UL)
+#define ISP_INT_CLR0 (ISP_BASE_ADDR+0x0018UL)
+#define ISP_INT_RAW0 (ISP_BASE_ADDR+0x001CUL)
+#define ISP_INT_INT0 (ISP_BASE_ADDR+0x0020UL)
+#define ISP_INT_EN1 (ISP_BASE_ADDR+0x0024UL)
+#define ISP_INT_CLR1 (ISP_BASE_ADDR+0x0028UL)
+#define ISP_INT_RAW1 (ISP_BASE_ADDR+0x002CUL)
+#define ISP_INT_INT1 (ISP_BASE_ADDR+0x0030UL)
+#define ISP_INT_EN2 (ISP_BASE_ADDR+0x0034UL)
+#define ISP_INT_CLR2 (ISP_BASE_ADDR+0x0038UL)
+#define ISP_INT_RAW2 (ISP_BASE_ADDR+0x003CUL)
+#define ISP_INT_INT2 (ISP_BASE_ADDR+0x0040UL)
+#define ISP_INT_EN3 (ISP_BASE_ADDR+0x0044UL)
+#define ISP_INT_CLR3 (ISP_BASE_ADDR+0x0048UL)
+#define ISP_INT_RAW3 (ISP_BASE_ADDR+0x004CUL)
+#define ISP_INT_INT3 (ISP_BASE_ADDR+0x0050UL)
+#define ISP_INT_ALL_DONE_CTRL (ISP_BASE_ADDR+0x0054UL)
+
+/*isp sub block: Fetch*/
+#define ISP_FETCH_MEM_STATUS0 (ISP_BASE_ADDR+0x0100UL)
+#define ISP_FETCH_MEM_STATUS1 (ISP_BASE_ADDR+0x0104UL)
+#define ISP_FETCH_DCAM_STATUS0 (ISP_BASE_ADDR+0x0108UL)
+#define ISP_FETCH_DCAM_STATUS1 (ISP_BASE_ADDR+0x010CUL)
+#define ISP_FETCH_PARAM (ISP_BASE_ADDR+0x0114UL)
+#define ISP_FETCH_START (ISP_BASE_ADDR+0x0118UL)
+#define ISP_FETCH_SLICE_SIZE (ISP_BASE_ADDR+0x0120UL)
+#define ISP_FETCH_SLICE_Y_ADDR (ISP_BASE_ADDR+0x0124UL)
+#define ISP_FETCH_SLICE_Y_PITCH (ISP_BASE_ADDR+0x0128UL)
+#define ISP_FETCH_SLICE_U_ADDR (ISP_BASE_ADDR+0x012CUL)
+#define ISP_FETCH_SLICE_U_PITCH (ISP_BASE_ADDR+0x0130UL)
+#define ISP_FETCH_SLICE_V_ADDR (ISP_BASE_ADDR+0x0134UL)
+#define ISP_FETCH_SLICE_V_PITCH (ISP_BASE_ADDR+0x0138UL)
+#define ISP_FETCH_MIPI_WORD_INFO (ISP_BASE_ADDR+0x013CUL)
+#define ISP_FETCH_MIPI_BYTE_INFO (ISP_BASE_ADDR+0x0140UL)
+#define ISP_FETCH_BAYER_MODE (ISP_BASE_ADDR+0x0144UL)
+
+/*isp sub block: Store*/
+#define ISP_STORE_STATUS_MEM0 (ISP_BASE_ADDR+0x0200UL)
+#define ISP_STORE_STATUS_MEM1 (ISP_BASE_ADDR+0x0204UL)
+#define ISP_STORE_STATUS_DCAM0 (ISP_BASE_ADDR+0x0208UL)
+#define ISP_STORE_STATUS_DCAM1 (ISP_BASE_ADDR+0x020CUL)
+#define ISP_STORE_PARAM (ISP_BASE_ADDR+0x0214UL)
+#define ISP_STORE_SLICE_SIZE (ISP_BASE_ADDR+0x0218UL)
+#define ISP_STORE_BORDER (ISP_BASE_ADDR+0x021CUL)
+#define ISP_STORE_Y_ADDR (ISP_BASE_ADDR+0x0220UL)
+#define ISP_STORE_Y_PITCH (ISP_BASE_ADDR+0x0224UL)
+#define ISP_STORE_U_ADDR (ISP_BASE_ADDR+0x0228UL)
+#define ISP_STORE_U_PITCH (ISP_BASE_ADDR+0x022CUL)
+#define ISP_STORE_V_ADDR (ISP_BASE_ADDR+0x0230UL)
+#define ISP_STORE_V_PITCH (ISP_BASE_ADDR+0x0234UL)
+#define ISP_STORE_SHADOW_CLR (ISP_BASE_ADDR+0x0238UL)
+
+/*isp sub block: dispatch(pike different from tshark2)*/
+#define ISP_DISPATCH_STATUS_CH0 (ISP_BASE_ADDR+0x0300UL)
+#define ISP_DISPATCH_STATUS_CH1 (ISP_BASE_ADDR+0x0304UL)
+//#define ISP_DISPATCH_STATUS_COMM (ISP_BASE_ADDR+0x0308UL)
+//#define ISP_DISPATCH_STATUS1_CH0 (ISP_BASE_ADDR+0x030CUL)
+//#define ISP_DISPATCH_STATUS1_CH1 (ISP_BASE_ADDR+0x0310UL)
+#define ISP_DISPATCH_CH0_BAYER (ISP_BASE_ADDR+0x0314UL)
+#define ISP_DISPATCH_CH0_SIZE (ISP_BASE_ADDR+0x0318UL)
+#define ISP_DISPATCH_CH1_SIZE (ISP_BASE_ADDR+0x031CUL)
+//#define ISP_DISPATCH_DLY (ISP_BASE_ADDR+0x0320UL)
+//#define ISP_DISPATCH_CH1_BAYER (ISP_BASE_ADDR+0x0324UL)
+//#define ISP_DISPATCH_HW_CTRL_CH0 (ISP_BASE_ADDR+0x0328UL)
+//#define ISP_DISPATCH_HW_CTRL_CH1 (ISP_BASE_ADDR+0x032CUL)
+
+/*isp sub block: arbiter*/
+#define ISP_ARBITER_WR_STATUS (ISP_BASE_ADDR+0x0400UL)
+#define ISP_ARBITER_RD_STATUS (ISP_BASE_ADDR+0x0404UL)
+#define ISP_ARBITER_PARAM (ISP_BASE_ADDR+0x0414UL)
+#define ISP_ARBITER_ENDIAN_CH0 (ISP_BASE_ADDR+0x0418UL)
+#define ISP_ARBITER_ENDIAN_CH1 (ISP_BASE_ADDR+0x041CUL)
+//#define ISP_ARBITER_CTRL (ISP_BASE_ADDR+0x0420UL)//pike has no this register
+
+/*isp sub block: axi*/
+#define ISP_AXI_WR_MASTER_STATUS (ISP_BASE_ADDR+0x0500UL)
+#define ISP_AXI_RD_MASTER_STATUS (ISP_BASE_ADDR+0x0504UL)
+#define ISP_AXI_ITI2AXIM_CTRL (ISP_BASE_ADDR+0x0514UL)
+//#define ISP_AXI_CONVERT_WR_CTRL (ISP_BASE_ADDR+0x0518UL)//pike has no this register
+
+/*isp sub block: raw sizer(pike has no this module)*/
+/*#define ISP_RAW_SIZER_STATUS0 (ISP_BASE_ADDR+0x0600UL)
+#define ISP_RAW_SIZER_PARAM (ISP_BASE_ADDR+0x0614UL)
+#define ISP_RAW_SIZER_CROP_SRC (ISP_BASE_ADDR+0x0618UL)
+#define ISP_RAW_SIZER_CROP_DST (ISP_BASE_ADDR+0x061CUL)
+#define ISP_RAW_SIZER_CROP_START (ISP_BASE_ADDR+0x0620UL)
+#define ISP_RAW_SIZER_DST (ISP_BASE_ADDR+0x0624UL)
+#define ISP_RAW_SIZER_BPC (ISP_BASE_ADDR+0x0628UL)
+#define ISP_RAW_SIZER_HCOEFF0 (ISP_BASE_ADDR+0x062CUL)
+#define ISP_RAW_SIZER_VCOEFF0 (ISP_BASE_ADDR+0x0684UL)
+#define ISP_RAW_SIZER_INIT_HOR0 (ISP_BASE_ADDR+0x06B0UL)
+#define ISP_RAW_SIZER_INIT_HOR1 (ISP_BASE_ADDR+0x06B4UL)
+#define ISP_RAW_SIZER_INIT_HOR2 (ISP_BASE_ADDR+0x06B8UL)
+#define ISP_RAW_SIZER_INIT_VER0 (ISP_BASE_ADDR+0x06BCUL)
+#define ISP_RAW_SIZER_INIT_VER1 (ISP_BASE_ADDR+0x06C0UL)
+#define ISP_RAW_SIZER_INIT_VER2 (ISP_BASE_ADDR+0x06C4UL)*/
+
+/*isp sub block: common*/
+#define ISP_COMMON_VERSION (ISP_BASE_ADDR+0x0700UL)
+#define ISP_COMMON_STATUS0 (ISP_BASE_ADDR+0x0704UL)
+#define ISP_COMMON_STATUS1 (ISP_BASE_ADDR+0x0708UL)
+#define ISP_COMMON_CTRL_CH0 (ISP_BASE_ADDR+0x0714UL)
+#define ISP_COMMON_SPACE_SEL (ISP_BASE_ADDR+0x0718UL)
+//#define ISP_COMMON_CTRL_CH1 (ISP_BASE_ADDR+0x071CUL)
+//#define ISP_COMMON_CTRL_AWBM (ISP_BASE_ADDR+0x0720UL)
+#define ISP_COMMON_PMU_RAW_MASK (ISP_BASE_ADDR+0x0724UL)
+#define ISP_COMMON_PMU_HW_MASK (ISP_BASE_ADDR+0x0728UL)
+#define ISP_COMMON_PMU_HW_ENABLE (ISP_BASE_ADDR+0x072CUL)
+#define ISP_COMMON_PMU_SW_SWITCH (ISP_BASE_ADDR+0x0730UL)
+#define ISP_COMMON_PMU_SW_TOGGLE (ISP_BASE_ADDR+0x0734UL)
+#define ISP_COMMON_LBUF_OFFSET (ISP_BASE_ADDR+0x0738UL)
+#define ISP_SHADOW_CTRL_CH0 (ISP_BASE_ADDR+0x073CUL)
+#define ISP_SHADOW_CTRL_CH1 (ISP_BASE_ADDR+0x0740UL)
+//#define ISP_COMMON_3A_CTRL0 (ISP_BASE_ADDR+0x0744UL)
+//#define ISP_COMMON_LBUF_OFFSET1 (ISP_BASE_ADDR+0x0748UL)
+//#define ISP_COMMON_3A_CTRL1 (ISP_BASE_ADDR+0x074CUL)
+#define ISP_COMMON_RESERVED0 (ISP_BASE_ADDR+0x0750UL)
+#define ISP_COMMON_RESERVED1 (ISP_BASE_ADDR+0x0754UL)
+
+/*isp sub block: Pre Global Gain*/
+#define ISP_PGG_STATUS (ISP_BASE_ADDR+0x1000UL)
+#define ISP_PGG_PARAM (ISP_BASE_ADDR+0x1014UL)
+
+/*isp sub block: BLC: back level calibration*/
+#define ISP_BLC_STATUS (ISP_BASE_ADDR+0x1100UL)
+#define ISP_BLC_PARAM (ISP_BASE_ADDR+0x1114UL)
+#define ISP_BLC_B_PARAM_R_B (ISP_BASE_ADDR+0x1118UL)
+#define ISP_BLC_B_PARAM_G (ISP_BASE_ADDR+0x111CUL)
+
+/*isp sub block: RGBG*/
+#define ISP_RGBG_STATUS (ISP_BASE_ADDR+0x1200UL)
+#define ISP_RGBG_PARAM (ISP_BASE_ADDR+0x1214UL)
+#define ISP_RGBG_RB (ISP_BASE_ADDR+0x1218UL)
+#define ISP_RGBG_G (ISP_BASE_ADDR+0x121CUL)
+
+/*isp sub block: PWD*/
+#define ISP_PWD_STATUS0 (ISP_BASE_ADDR+0x1300UL)
+#define ISP_PWD_STATUS1 (ISP_BASE_ADDR+0x1304UL)
+#define ISP_PWD_PARAM (ISP_BASE_ADDR+0x1314UL)
+#define ISP_PWD_PARAM1 (ISP_BASE_ADDR+0x1318UL)
+#define ISP_PWD_PARAM2 (ISP_BASE_ADDR+0x131CUL)
+#define ISP_PWD_PARAM3 (ISP_BASE_ADDR+0x1320UL)
+#define ISP_PWD_PARAM4 (ISP_BASE_ADDR+0x1324UL)
+#define ISP_PWD_PARAM5 (ISP_BASE_ADDR+0x1328UL)
+#define ISP_PWD_PARAM6 (ISP_BASE_ADDR+0x132CUL)
+#define ISP_PWD_PARAM7 (ISP_BASE_ADDR+0x1330UL)
+#define ISP_PWD_PARAM8 (ISP_BASE_ADDR+0x1334UL)
+#define ISP_PWD_PARAM9 (ISP_BASE_ADDR+0x1338UL)
+#define ISP_PWD_PARAM10 (ISP_BASE_ADDR+0x133CUL)
+
+/*isp sub block: NLC*/
+#define ISP_NLC_STATUS (ISP_BASE_ADDR+0x1400UL)
+#define ISP_NLC_PARA (ISP_BASE_ADDR+0x1414UL)
+#define ISP_NLC_PARA_R0 (ISP_BASE_ADDR+0x1418UL)
+#define ISP_NLC_PARA_R9 (ISP_BASE_ADDR+0x143CUL)
+#define ISP_NLC_PARA_G0 (ISP_BASE_ADDR+0x1440UL)
+#define ISP_NLC_PARA_G9 (ISP_BASE_ADDR+0x1464UL)
+#define ISP_NLC_PARA_B0 (ISP_BASE_ADDR+0x1468UL)
+#define ISP_NLC_PARA_B9 (ISP_BASE_ADDR+0x148CUL)
+#define ISP_NLC_PARA_L0 (ISP_BASE_ADDR+0x1490UL)
+
+/*isp sub block: lens shading calibration*/
+#define ISP_LENS_STATUS (ISP_BASE_ADDR+0x1500UL)
+#define ISP_LENS_PARAM (ISP_BASE_ADDR+0x1514UL)
+#define ISP_LENS_PARAM_ADDR (ISP_BASE_ADDR+0x1518UL)
+#define ISP_LENS_SLICE_POS (ISP_BASE_ADDR+0x151CUL)
+#define ISP_LENS_LOAD_EB (ISP_BASE_ADDR+0x1520UL)
+#define ISP_LENS_GRID_PITCH (ISP_BASE_ADDR+0x1524UL)
+#define ISP_LENS_GRID_SIZE (ISP_BASE_ADDR+0x1528UL)
+#define ISP_LENS_LOAD_BUF (ISP_BASE_ADDR+0x152CUL)
+#define ISP_LENS_MISC (ISP_BASE_ADDR+0x1530UL)
+#define ISP_LENS_SLICE_SIZE (ISP_BASE_ADDR+0x1534UL)
+#define ISP_LENS_INIT_COOR (ISP_BASE_ADDR+0x1538UL)
+#define ISP_LENS_Q0_VALUE (ISP_BASE_ADDR+0x153CUL)
+
+/*isp sub block: binning*/
+#define ISP_BINNING_STATUS (ISP_BASE_ADDR+0x1600UL)
+#define ISP_BINNING_PARAM (ISP_BASE_ADDR+0x1614UL)
+#define ISP_BINNING_MEM_ADDR (ISP_BASE_ADDR+0x1618UL)
+#define ISP_BINNING_PITCH (ISP_BASE_ADDR+0x161CUL)
+
+/*isp sub block: AWBM*/
+#define ISP_AWBM_STATUS (ISP_BASE_ADDR+0x1700UL)
+#define ISP_AWBM_PARAM (ISP_BASE_ADDR+0x1714UL)
+#define ISP_AWBM_BLOCK_OFFSET (ISP_BASE_ADDR+0x1718UL)
+#define ISP_AWBM_BLOCK_SIZE (ISP_BASE_ADDR+0x171CUL)
+#define ISP_AWBM_WR_0_S (ISP_BASE_ADDR+0x1720UL)
+#define ISP_AWBM_WR_0_E (ISP_BASE_ADDR+0x1724UL)
+#define ISP_AWBM_NW_0_XYR (ISP_BASE_ADDR+0x1748UL)
+#define ISP_AWBM_CLCTOR_0_S (ISP_BASE_ADDR+0x175CUL)
+#define ISP_AWBM_CLCTOR_0_E (ISP_BASE_ADDR+0x1760UL)
+#define ISP_AWBM_CLCTR_0_PIXEL_NUM (ISP_BASE_ADDR+0x1784UL)
+#define ISP_AWBM_MEM_ADDR (ISP_BASE_ADDR+0x1798UL)
+#define ISP_AWBM_POSITION_SEL (ISP_BASE_ADDR+0x179CUL)
+#define ISP_AWBM_THR_VALUE1 (ISP_BASE_ADDR+0x17A0UL)
+#define ISP_AWBM_THR_VALUE2 (ISP_BASE_ADDR+0x17A4UL)
+
+/*isp sub block: AWBC*/
+#define ISP_AWBC_STATUS (ISP_BASE_ADDR+0x1800UL)
+#define ISP_AWBC_PARAM (ISP_BASE_ADDR+0x1814UL)
+#define ISP_AWBC_GAIN0 (ISP_BASE_ADDR+0x1818UL)
+#define ISP_AWBC_GAIN1 (ISP_BASE_ADDR+0x181CUL)
+#define ISP_AWBC_THRD (ISP_BASE_ADDR+0x1820UL)
+#define ISP_AWBC_OFFSET0 (ISP_BASE_ADDR+0x1824UL)
+#define ISP_AWBC_OFFSET1 (ISP_BASE_ADDR+0x1828UL)
+#define ISP_AWBC_GAIN0_BUF (ISP_BASE_ADDR+0x182CUL)
+#define ISP_AWBC_GAIN1_BUF (ISP_BASE_ADDR+0x1830UL)
+#define ISP_AWBC_OFFSET0_BUF (ISP_BASE_ADDR+0x1834UL)
+#define ISP_AWBC_OFFSET1_BUF (ISP_BASE_ADDR+0x1838UL)
+#define ISP_AWBC_GAIN0_READ (ISP_BASE_ADDR+0x183CUL)
+#define ISP_AWBC_GAIN1_READ (ISP_BASE_ADDR+0x1840UL)
+#define ISP_AWBC_OFFSET0_READ (ISP_BASE_ADDR+0x1844UL)
+#define ISP_AWBC_OFFSET1_READ (ISP_BASE_ADDR+0x1848UL)
+
+/*isp sub block: AEM*/
+#define ISP_AEM_STATUS (ISP_BASE_ADDR+0x1900UL)
+#define ISP_AEM_PARAM (ISP_BASE_ADDR+0x1914UL)
+#define ISP_AEM_OFFSET (ISP_BASE_ADDR+0x1918UL)
+#define ISP_AEM_BLK_SIZE (ISP_BASE_ADDR+0x191CUL)
+#define ISP_AEM_SLICE_SIZE (ISP_BASE_ADDR+0x1920UL)
+
+/*isp sub block: BPC: bad pixel correction*/
+#define ISP_BPC_STATUS (ISP_BASE_ADDR+0x1A00UL)
+#define ISP_BPC_PARAM (ISP_BASE_ADDR+0x1A14UL)
+#define ISP_BPC_CFG (ISP_BASE_ADDR+0x1A18UL)
+#define ISP_BPC_FACTOR (ISP_BASE_ADDR+0x1A1CUL)
+#define ISP_BPC_COEFF (ISP_BASE_ADDR+0x1A20UL)
+#define ISP_BPC_LUTWORD0 (ISP_BASE_ADDR+0x1A24UL)
+#define ISP_BPC_NEW_OLD_SEL (ISP_BASE_ADDR+0x1A44UL)
+#define ISP_BPC_MAP_ADDR (ISP_BASE_ADDR+0x1A48UL)
+
+/*isp sub block: GRGB*/
+#define ISP_GRGB_STATUS (ISP_BASE_ADDR+0x1B00UL)
+#define ISP_GRGB_PARAM (ISP_BASE_ADDR+0x1B14UL)
+#define ISP_GRGB_GRID (ISP_BASE_ADDR+0x1B18UL)
+
+/*isp sub block: BDN*/
+#define ISP_BDN_STATUS (ISP_BASE_ADDR+0x1C00UL)
+#define ISP_BDN_PARAM (ISP_BASE_ADDR+0x1C14UL)
+#define ISP_BDN_DISWEI0_0 (ISP_BASE_ADDR+0x1C18UL)
+#define ISP_BDN_DISWEI0_1 (ISP_BASE_ADDR+0x1C1CUL)
+#define ISP_BDN_RANWEI0_0 (ISP_BASE_ADDR+0x1C20UL)
+#define ISP_BDN_RANWEI0_7 (ISP_BASE_ADDR+0x1C3CUL)
+#define ISP_BDN_1DLNC_CENTER (ISP_BASE_ADDR+0x1DA8UL)
+#define ISP_BDN_1DLNC_SQUARE_X (ISP_BASE_ADDR+0x1DACUL)
+#define ISP_BDN_1DLNC_SQUARE_Y (ISP_BASE_ADDR+0x1DB0UL)
+#define ISP_BDN_1DLNC_P (ISP_BASE_ADDR+0x1DB4UL)
+#define ISP_BDN_1DLNC_SIZE (ISP_BASE_ADDR+0x1DB8UL)
+#define ISP_BDN_1DLNC_POS (ISP_BASE_ADDR+0x1DBCUL)
+#define ISP_BDN_1DLNC_OFFSET (ISP_BASE_ADDR+0x1DC0UL)
+
+/*isp sub block: RGBG2*/
+#define ISP_RGBG2_STATUS (ISP_BASE_ADDR+0x1E00UL)
+#define ISP_RGBG2_PARAM (ISP_BASE_ADDR+0x1E14UL)
+#define ISP_RGBG2_OFFSET (ISP_BASE_ADDR+0x1E18UL)
+
+/*isp sub block: 1d lnc*/
+#define ISP_1D_LNC_STATUS (ISP_BASE_ADDR+0x1F00UL)
+#define ISP_1D_LNC_PARAM (ISP_BASE_ADDR+0x1F14UL)
+#define ISP_1D_LNC_PARAM1 (ISP_BASE_ADDR+0x1F18UL)
+#define ISP_1D_LNC_PARAM2 (ISP_BASE_ADDR+0x1F1CUL)
+#define ISP_1D_LNC_PARAM3 (ISP_BASE_ADDR+0x1F20UL)
+#define ISP_1D_LNC_PARAM4 (ISP_BASE_ADDR+0x1F24UL)
+#define ISP_1D_LNC_PARAM5 (ISP_BASE_ADDR+0x1F28UL)
+#define ISP_1D_LNC_PARAM6 (ISP_BASE_ADDR+0x1F2CUL)
+#define ISP_1D_LNC_PARAM7 (ISP_BASE_ADDR+0x1F30UL)
+#define ISP_1D_LNC_PARAM8 (ISP_BASE_ADDR+0x1F34UL)
+#define ISP_1D_LNC_PARAM9 (ISP_BASE_ADDR+0x1F38UL)
+#define ISP_1D_LNC_PARAM10 (ISP_BASE_ADDR+0x1F3CUL)
+#define ISP_1D_LNC_PARAM11 (ISP_BASE_ADDR+0x1F40UL)
+#define ISP_1D_LNC_PARAM12 (ISP_BASE_ADDR+0x1F44UL)
+#define ISP_1D_LNC_PARAM13 (ISP_BASE_ADDR+0x1F48UL)
+#define ISP_1D_LNC_PARAM14 (ISP_BASE_ADDR+0x1F4CUL)
+#define ISP_1D_LNC_PARAM15 (ISP_BASE_ADDR+0x1F50UL)
+#define ISP_1D_LNC_PARAM16 (ISP_BASE_ADDR+0x1F54UL)
+#define ISP_1D_LNC_PARAM17 (ISP_BASE_ADDR+0x1F58UL)
+#define ISP_1D_LNC_PARAM18 (ISP_BASE_ADDR+0x1F5CUL)
+
+/*isp sub block: NLM VST IVST*/
+#define ISP_VST_PARA (ISP_BASE_ADDR+0x2014UL)
+#define ISP_IVST_PARA (ISP_BASE_ADDR+0x2214UL)
+#define ISP_NLM_LB_STATUS0 (ISP_BASE_ADDR+0x2100UL)
+#define ISP_NLM_LB_STATUS1 (ISP_BASE_ADDR+0x2104UL)
+#define ISP_NLM_STATUS (ISP_BASE_ADDR+0x2108UL)
+#define ISP_NLM_PARA (ISP_BASE_ADDR+0x2114UL)
+#define ISP_NLM_FLAT_PARA_0 (ISP_BASE_ADDR+0x2118UL)
+#define ISP_NLM_STERNGTH (ISP_BASE_ADDR+0x212CUL)
+#define ISP_NLM_IS_FLAT (ISP_BASE_ADDR+0x2130UL)
+#define ISP_NLM_ADD_BACK (ISP_BASE_ADDR+0x2134UL)
+//#define ISP_NLM_DIRECTION_0 (ISP_BASE_ADDR+0x2138UL)
+//#define ISP_NLM_DIRECTION_1 (ISP_BASE_ADDR+0x213CUL)
+#define ISP_NLM_LUT_W_0 (ISP_BASE_ADDR+0x2140UL)
+
+/*isp sub block: CFA: clolor filter array*/
+#define ISP_CFAE_STATUS (ISP_BASE_ADDR+0x3000UL)
+#define ISP_CFAE_EE_CFG0 (ISP_BASE_ADDR+0x3014UL)
+#define ISP_CFAE_THRD_0 (ISP_BASE_ADDR+0x3018UL)
+#define ISP_CFAE_THRD_1 (ISP_BASE_ADDR+0x301CUL)
+#define ISP_CFAE_THRD_2 (ISP_BASE_ADDR+0x3020UL)
+#define ISP_CFAE_THRD_3 (ISP_BASE_ADDR+0x3024UL)
+#define ISP_CFAE_THRD_4 (ISP_BASE_ADDR+0x3028UL)
+#define ISP_CFAE_EE_CFG1 (ISP_BASE_ADDR+0x302CUL)
+
+/*isp sub block:CMC: Color matrix correction for 10 bit */
+#define ISP_CMC10_STATUS0 (ISP_BASE_ADDR+0x3100UL)
+#define ISP_CMC10_STATUS1 (ISP_BASE_ADDR+0x3104UL)
+#define ISP_CMC10_PARAM (ISP_BASE_ADDR+0x3114UL)
+#define ISP_CMC10_MATRIX0 (ISP_BASE_ADDR+0x3118UL)
+#define ISP_CMC10_MATRIX0_BUF (ISP_BASE_ADDR+0x312CUL)
+
+/*isp sub block: FRGB WDR */
+#define ISP_HDR_STATUS (ISP_BASE_ADDR+0x3200UL)
+#define ISP_HDR_PARAM (ISP_BASE_ADDR+0x3214UL)
+
+//#define ISP_HDR_STATUS (ISP_BASE_ADDR+0x1A00UL)
+//#define ISP_HDR_PARAM (ISP_BASE_ADDR+0x1A14UL)
+//#define ISP_HDR_INDEX (ISP_BASE_ADDR+0x1A18UL)
+
+/*isp sub block: GAMMA */
+#define ISP_GAMMA_STATUS (ISP_BASE_ADDR+0x3300UL)
+#define ISP_GAMMA_PARAM (ISP_BASE_ADDR+0x3314UL)
+
+/*isp sub block:CMC: Color matrix correction for 8 bit */
+#define ISP_CMC8_STATUS0 (ISP_BASE_ADDR+0x3500UL)
+#define ISP_CMC8_STATUS1 (ISP_BASE_ADDR+0x3504UL)
+#define ISP_CMC8_PARAM (ISP_BASE_ADDR+0x3514UL)
+#define ISP_CMC8_MATRIX0 (ISP_BASE_ADDR+0x3518UL)
+#define ISP_CMC8_MATRIX0_BUF (ISP_BASE_ADDR+0x352CUL)
+
+/*CT: Color transformation*/
+#define ISP_CT_STATUS0 (ISP_BASE_ADDR+0x3600UL)
+#define ISP_CT_STATUS1 (ISP_BASE_ADDR+0x3604UL)
+#define ISP_CT_PARAM (ISP_BASE_ADDR+0x3614UL)
+
+/*isp sub block: CCE: clolor conversion enhancement*/
+#define ISP_CCE_STATUS0 (ISP_BASE_ADDR+0x3700UL)
+#define ISP_CCE_STATUS1 (ISP_BASE_ADDR+0x3704UL)
+#define ISP_CCE_PARAM (ISP_BASE_ADDR+0x3714UL)
+#define ISP_CCE_MATRIX0 (ISP_BASE_ADDR+0x3718UL)
+#define ISP_CCE_MATRIX1 (ISP_BASE_ADDR+0x371CUL)
+#define ISP_CCE_MATRIX2 (ISP_BASE_ADDR+0x3720UL)
+#define ISP_CCE_MATRIX3 (ISP_BASE_ADDR+0x3724UL)
+#define ISP_CCE_MATRIX4 (ISP_BASE_ADDR+0x3728UL)
+#define ISP_CCE_SHIFT (ISP_BASE_ADDR+0x372CUL)
+#define ISP_CCE_UVD_PARAM0 (ISP_BASE_ADDR+0x3730UL)
+#define ISP_CCE_UVD_PARAM1 (ISP_BASE_ADDR+0x3734UL)
+#define ISP_CCE_UVD_PARAM2 (ISP_BASE_ADDR+0x3738UL)
+#define ISP_CCE_UVD_PARAM3 (ISP_BASE_ADDR+0x373CUL)
+#define ISP_CCE_UVD_PARAM4 (ISP_BASE_ADDR+0x3740UL)
+#define ISP_CCE_UVD_PARAM5 (ISP_BASE_ADDR+0x3744UL)
+
+/*isp sub block:HSV*/
+#define ISP_HSV_STATUS (ISP_BASE_ADDR+0x3800UL)
+#define ISP_HSV_PARAM (ISP_BASE_ADDR+0x3814UL)
+
+/*isp sub block:Radial CSC*/
+#define ISP_CSC_STATUS (ISP_BASE_ADDR + 0x3900UL)
+#define ISP_CSC_CTRL (ISP_BASE_ADDR + 0x3914UL)
+#define ISP_CSC_RCC (ISP_BASE_ADDR + 0x3918UL)
+#define ISP_CSC_BCC (ISP_BASE_ADDR + 0x391CUL)
+#define ISP_CSC_REDX2INIT (ISP_BASE_ADDR + 0x3920UL)
+#define ISP_CSC_REDY2INIT (ISP_BASE_ADDR + 0x3924UL)
+#define ISP_CSC_BLUEX2INIT (ISP_BASE_ADDR + 0x3928UL)
+#define ISP_CSC_BLUEY2INIT (ISP_BASE_ADDR + 0x392CUL)
+#define ISP_CSC_REDTHR (ISP_BASE_ADDR + 0x3930UL)
+#define ISP_CSC_BLUETHR (ISP_BASE_ADDR + 0x3934UL)
+#define ISP_CSC_REDPOLY (ISP_BASE_ADDR + 0x3938UL)
+#define ISP_CSC_BLUEPOLY (ISP_BASE_ADDR + 0x393CUL)
+#define ISP_CSC_MAXGAIN (ISP_BASE_ADDR + 0x3940UL)
+#define ISP_CSC_PICSIZE (ISP_BASE_ADDR + 0x3944UL)
+#define ISP_CSC_START_ROW_COL (ISP_BASE_ADDR + 0x3948UL)
+
+/*isp sub block:ISP_PRECNRNEW*/
+#define ISP_PRECNRNEW_STATUS0 (ISP_BASE_ADDR+0x3A00UL)
+#define ISP_PRECNRNEW_STATUS1 (ISP_BASE_ADDR+0x3A04UL)
+#define ISP_PRECNRNEW_CFG (ISP_BASE_ADDR+0x3A14UL)
+#define ISP_PRECNRNEW_MEDIAN_THR (ISP_BASE_ADDR+0x3A18UL)
+#define ISP_PRECNRNEW_THRU (ISP_BASE_ADDR+0x3A1CUL)
+#define ISP_PRECNRNEW_THRV (ISP_BASE_ADDR+0x3A20UL)
+
+/*isp sub block:ISP_PSTRZ*/
+#define ISP_PSTRZ_STATUS (ISP_BASE_ADDR+0x3B00UL)
+#define ISP_PSTRZ_PARAM (ISP_BASE_ADDR+0x3B14UL)
+#define ISP_PSTRZ_LEVEL0 (ISP_BASE_ADDR+0x3B18UL)
+#define ISP_PSTRZ_LEVEL1 (ISP_BASE_ADDR+0x3B1CUL)
+#define ISP_PSTRZ_LEVEL2 (ISP_BASE_ADDR+0x3B20UL)
+#define ISP_PSTRZ_LEVEL3 (ISP_BASE_ADDR+0x3B24UL)
+#define ISP_PSTRZ_LEVEL4 (ISP_BASE_ADDR+0x3B28UL)
+#define ISP_PSTRZ_LEVEL5 (ISP_BASE_ADDR+0x3B2CUL)
+#define ISP_PSTRZ_LEVEL6 (ISP_BASE_ADDR+0x3B30UL)
+#define ISP_PSTRZ_LEVEL7 (ISP_BASE_ADDR+0x3B34UL)
+
+/*isp sub block: AFM : auto focus monitor*/
+#define ISP_RGB_AFM_STATUS0 (ISP_BASE_ADDR+0x3C00UL)
+#define ISP_RGB_AFM_STATUS1 (ISP_BASE_ADDR+0x3C04UL)
+#define ISP_RGB_AFM_PARAM (ISP_BASE_ADDR+0x3C14UL)
+#define ISP_RGB_AFM_FRAME_RANGE (ISP_BASE_ADDR+0x3C18UL)
+#define ISP_RGB_AFM_SOBEL_THRESHOLD (ISP_BASE_ADDR+0x3C1CUL)
+#define ISP_RGB_AFM_SPSMD_THRESHOLD_MAX (ISP_BASE_ADDR+0x3C20UL)
+#define ISP_RGB_AFM_WIN_RANGE0 (ISP_BASE_ADDR+0x3C24UL)
+#define ISP_RGB_AFM_TYPE1_VAL00 (ISP_BASE_ADDR+0x3CECUL)
+#define ISP_RGB_AFM_TYPE2_VAL00 (ISP_BASE_ADDR+0x3D50UL)
+#define ISP_RGB_AFM_SPSMD_THRESHOLD_MIN (ISP_BASE_ADDR+0x3DB4UL)
+
+/*isp sub block:RGB2Y*/
+#define ISP_Y_RGB2Y_STATUS0 (ISP_BASE_ADDR+0x4000UL)
+#define ISP_Y_RGB2Y_STATUS1 (ISP_BASE_ADDR+0x4004UL)
+#define ISP_Y_RGB2Y_PARAM (ISP_BASE_ADDR+0x4014UL)
+
+/*isp sub block:YIQ AEM*/
+#define ISP_YIQ_AEM_STATUS (ISP_BASE_ADDR + 0x4100UL)
+#define ISP_YIQ_AEM_PARAM (ISP_BASE_ADDR + 0x4114UL)
+#define ISP_YIQ_YGAMMA_NODE_X0 (ISP_BASE_ADDR + 0x4118UL)
+#define ISP_YIQ_YGAMMA_NODE_X1 (ISP_BASE_ADDR + 0x411CUL)
+#define ISP_YIQ_YGAMMA_NODE_Y0 (ISP_BASE_ADDR + 0x4120UL)
+#define ISP_YIQ_YGAMMA_NODE_Y1 (ISP_BASE_ADDR + 0x4124UL)
+#define ISP_YIQ_YGAMMA_NODE_Y2 (ISP_BASE_ADDR + 0x4128UL)
+#define ISP_YIQ_YGAMMA_NODE_IDX (ISP_BASE_ADDR + 0x412CUL)
+#define ISP_YIQ_AEM_OFFSET (ISP_BASE_ADDR + 0x4130UL)
+#define ISP_YIQ_AEM_BLK_SIZE (ISP_BASE_ADDR + 0x4134UL)
+#define ISP_YIQ_AEM_SLICE_SIZE (ISP_BASE_ADDR + 0x4138UL)
+
+/*isp sub block:ANTI FLICKER*/
+#define ISP_ANTI_FLICKER_STATUS0 (ISP_BASE_ADDR + 0x4200UL)
+#define ISP_ANTI_FLICKER_STATUS1 (ISP_BASE_ADDR + 0x4204UL)
+#define ISP_ANTI_FLICKER_PARAM0 (ISP_BASE_ADDR + 0x4214UL)
+#define ISP_ANTI_FLICKER_PARAM1 (ISP_BASE_ADDR + 0x4218UL)
+#define ISP_ANTI_FLICKER_COL_POS (ISP_BASE_ADDR + 0x421CUL)
+#define ISP_ANTI_FLICKER_DDR_INIT_ADDR (ISP_BASE_ADDR + 0x4220UL)
+
+/*isp sub block:YIQ AFM*/
+#define ISP_YIQ_AFM_STATUS0 (ISP_BASE_ADDR + 0x4300UL)
+#define ISP_YIQ_AFM_STATUS1 (ISP_BASE_ADDR + 0x4304UL)
+#define ISP_YIQ_AFM_PARAM (ISP_BASE_ADDR + 0x4314UL)
+#define ISP_YIQ_AFM_WIN_RANGE0 (ISP_BASE_ADDR + 0x4318UL)
+#define ISP_YIQ_AFM_COEF0_1 (ISP_BASE_ADDR + 0x43E0UL)
+#define ISP_YIQ_AFM_COEF2_3 (ISP_BASE_ADDR + 0x43E4UL)
+#define ISP_YIQ_AFM_COEF4_5 (ISP_BASE_ADDR + 0x43E8UL)
+#define ISP_YIQ_AFM_COEF6_7 (ISP_BASE_ADDR + 0x43ECUL)
+#define ISP_YIQ_AFM_COEF8_9 (ISP_BASE_ADDR + 0x43F0UL)
+#define ISP_YIQ_AFM_COEF10 (ISP_BASE_ADDR + 0x43F4UL)
+#define ISP_YIQ_AFM_LAPLACE0 (ISP_BASE_ADDR + 0x43F8UL)
+#define ISP_YIQ_AFM_SLICE_SIZE (ISP_BASE_ADDR + 0x4588UL)
+
+/*isp sub block: Pre-CDN*/
+#define ISP_PRECDN_STATUS0 (ISP_BASE_ADDR+0x5000UL)
+#define ISP_PRECDN_STATUS1 (ISP_BASE_ADDR+0x5004UL)
+#define ISP_PRECDN_PARAM (ISP_BASE_ADDR+0x5014UL)
+#define ISP_PRECDN_MEDIAN_THRUV01 (ISP_BASE_ADDR+0x5018UL)
+#define ISP_PRECDN_THRYUV (ISP_BASE_ADDR+0x501CUL)
+#define ISP_PRECDN_SEGU_0 (ISP_BASE_ADDR+0x5020UL)
+#define ISP_PRECDN_SEGU_3 (ISP_BASE_ADDR+0x502CUL)
+#define ISP_PRECDN_SEGV_0 (ISP_BASE_ADDR+0x5030UL)
+#define ISP_PRECDN_SEGV_3 (ISP_BASE_ADDR+0x503CUL)
+#define ISP_PRECDN_SEGY_0 (ISP_BASE_ADDR+0x5040UL)
+#define ISP_PRECDN_SEGY_3 (ISP_BASE_ADDR+0x504CUL)
+#define ISP_PRECDN_DISTW0 (ISP_BASE_ADDR+0x5050UL)
+#define ISP_PRECDN_DISTW3 (ISP_BASE_ADDR+0x505CUL)
+
+/*isp sub block: Pre-Filter*/
+#define ISP_PREF_STATUS0 (ISP_BASE_ADDR+0x5100UL)
+#define ISP_PREF_STATUS1 (ISP_BASE_ADDR+0x5104UL)
+#define ISP_PREF_PARAM (ISP_BASE_ADDR+0x5114UL)
+#define ISP_PREF_THRD (ISP_BASE_ADDR+0x5118UL)
+
+/*isp sub block: UV Pre-Filter*/
+#define ISP_UV_PREF_STATUS0 (ISP_BASE_ADDR+0x5200UL)
+#define ISP_UV_PREF_STATUS1 (ISP_BASE_ADDR+0x5204UL)
+#define ISP_UV_PREF_PARAM (ISP_BASE_ADDR+0x5214UL)
+#define ISP_UV_PREF_THRD (ISP_BASE_ADDR+0x5218UL)
+
+/*isp sub block: Brightness*/
+#define ISP_BRIGHT_STATUS (ISP_BASE_ADDR+0x5300UL)
+#define ISP_BRIGHT_PARAM (ISP_BASE_ADDR+0x5314UL)
+
+/*isp sub block: Contrast*/
+#define ISP_CONTRAST_STATUS (ISP_BASE_ADDR+0x5400UL)
+#define ISP_CONTRAST_PARAM (ISP_BASE_ADDR+0x5414UL)
+
+/*isp sub block: HIST : histogram*/
+#define ISP_HIST_STATUS (ISP_BASE_ADDR+0x5500UL)
+#define ISP_HIST_PARAM (ISP_BASE_ADDR+0x5514UL)
+#define ISP_HIST_RATIO (ISP_BASE_ADDR+0x5518UL)
+#define ISP_HIST_MAX_MIN (ISP_BASE_ADDR+0x551CUL)
+#define ISP_HIST_SLICE_SIZE (ISP_BASE_ADDR+0x5520UL)
+#define ISP_HIST_ADJUST (ISP_BASE_ADDR+0x5524UL)
+
+/*isp sub block: HIST2*/
+#define ISP_HIST2_STATUS (ISP_BASE_ADDR+0x5600UL)
+#define ISP_HIST2_PARAM (ISP_BASE_ADDR+0x5614UL)
+#define ISP_HIST2_ROI_S0 (ISP_BASE_ADDR+0x5618UL)
+#define ISP_HIST2_ROI_E0 (ISP_BASE_ADDR+0x561CUL)
+
+/*isp sub block: AUTOCONT : auto contrast adjustment*/
+#define ISP_AUTOCONT_STATUS (ISP_BASE_ADDR+0x5700UL)
+#define ISP_AUTOCONT_PARAM (ISP_BASE_ADDR+0x5714UL)
+#define ISP_AUTOCONT_MAX_MIN (ISP_BASE_ADDR+0x5718UL)
+
+/*isp sub block: cdn*/
+#define ISP_CDN_STATUS0 (ISP_BASE_ADDR+0x5800UL)
+#define ISP_CDN_STATUS1 (ISP_BASE_ADDR+0x5804UL)
+#define ISP_CDN_PARAM (ISP_BASE_ADDR+0x5814UL)
+#define ISP_CDN_THRUV (ISP_BASE_ADDR+0x5818UL)
+#define ISP_CDN_U_RANWEI_0 (ISP_BASE_ADDR+0x581CUL)
+#define ISP_CDN_U_RANWEI_7 (ISP_BASE_ADDR+0x5838UL)
+#define ISP_CDN_V_RANWEI_0 (ISP_BASE_ADDR+0x583CUL)
+#define ISP_CDN_V_RANWEI_7 (ISP_BASE_ADDR+0x5858UL)
+
+/*isp sub block: edge*/
+#define ISP_EE_STATUS (ISP_BASE_ADDR+0x5900UL)
+#define ISP_EE_PARAM (ISP_BASE_ADDR+0x5914UL)
+#define ISP_EE_CFG0 (ISP_BASE_ADDR+0x5918UL)
+#define ISP_EE_CFG1 (ISP_BASE_ADDR+0x591CUL)
+#define ISP_EE_CFG2 (ISP_BASE_ADDR+0x5920UL)
+#define ISP_EE_CFG3 (ISP_BASE_ADDR+0x5924UL)
+#define ISP_EE_CFG4 (ISP_BASE_ADDR+0x5928UL)
+#define ISP_EE_CFG5 (ISP_BASE_ADDR+0x592CUL)
+#define ISP_EE_CFG6 (ISP_BASE_ADDR+0x5930UL)
+#define ISP_EE_CFG7 (ISP_BASE_ADDR+0x5934UL)
+//pike has no registers ISP_EE_ADP_CFG0 ~ ISP_EE_ADP_CFG2
+//#define ISP_EE_ADP_CFG0 (ISP_BASE_ADDR+0x5938UL)
+//#define ISP_EE_ADP_CFG1 (ISP_BASE_ADDR+0x593CUL)
+//#define ISP_EE_ADP_CFG2 (ISP_BASE_ADDR+0x5940UL)
+
+/*isp sub block: emboss(pike has no this module)*/
+#define ISP_EMBOSS_Y_STATUS (ISP_BASE_ADDR+0x5A00UL)
+#define ISP_EMBOSS_Y_PARAM (ISP_BASE_ADDR+0x5A14UL)
+#define ISP_EMBOSS_UV_STATUS (ISP_BASE_ADDR+0x5F00UL)
+#define ISP_EMBOSS_UV_PARAM (ISP_BASE_ADDR+0x5F14UL)
+
+/*isp sub block: CSS*/
+#define ISP_CSS_STATUS (ISP_BASE_ADDR+0x5B00UL)
+#define ISP_CSS_PARAM (ISP_BASE_ADDR+0x5B14UL)
+#define ISP_CSS_THRD0 (ISP_BASE_ADDR+0x5B18UL)
+#define ISP_CSS_LH_RATIO (ISP_BASE_ADDR+0x5B1CUL)
+#define ISP_CSS_EX_TH_0 (ISP_BASE_ADDR+0x5B20UL)
+#define ISP_CSS_EX_TH_1 (ISP_BASE_ADDR+0x5B24UL)
+#define ISP_CSS_CHROM_L_TH_0 (ISP_BASE_ADDR+0x5B28UL)
+#define ISP_CSS_CHROM_L_TH_1 (ISP_BASE_ADDR+0x5B2CUL)
+#define ISP_CSS_CHROM_H_TH_0 (ISP_BASE_ADDR+0x5B30UL)
+#define ISP_CSS_CHROM_H_TH_1 (ISP_BASE_ADDR+0x5B34UL)
+#define ISP_CSS_RATIO (ISP_BASE_ADDR+0x5B38UL)
+
+/*isp sub block: csa*/
+#define ISP_CSA_STATUS (ISP_BASE_ADDR+0x5C00UL)
+#define ISP_CSA_PARAM (ISP_BASE_ADDR+0x5C14UL)
+
+/*isp sub block: hua*/
+#define ISP_HUA_STATUS (ISP_BASE_ADDR+0x5D00UL)
+#define ISP_HUA_PARAM (ISP_BASE_ADDR+0x5D14UL)
+
+/*isp sub block: post-cdn*/
+#define ISP_POSTCDN_STATUS (ISP_BASE_ADDR+0x5E00UL)
+#define ISP_POSTCDN_COMMON_CTRL (ISP_BASE_ADDR+0x5E14UL)
+#define ISP_POSTCDN_ADPT_THR (ISP_BASE_ADDR+0x5E18UL)
+#define ISP_POSTCDN_UVTHR (ISP_BASE_ADDR+0x5E1CUL)
+#define ISP_POSTCDN_THRU (ISP_BASE_ADDR+0x5E20UL)
+#define ISP_POSTCDN_THRV (ISP_BASE_ADDR+0x5E24UL)
+#define ISP_POSTCDN_RSEGU01 (ISP_BASE_ADDR+0x5E28UL)
+#define ISP_POSTCDN_RSEGU23 (ISP_BASE_ADDR+0x5E2CUL)
+#define ISP_POSTCDN_RSEGU45 (ISP_BASE_ADDR+0x5E30UL)
+#define ISP_POSTCDN_RSEGU6 (ISP_BASE_ADDR+0x5E34UL)
+#define ISP_POSTCDN_RSEGV01 (ISP_BASE_ADDR+0x5E38UL)
+#define ISP_POSTCDN_RSEGV23 (ISP_BASE_ADDR+0x5E3CUL)
+#define ISP_POSTCDN_RSEGV45 (ISP_BASE_ADDR+0x5E40UL)
+#define ISP_POSTCDN_RSEGV6 (ISP_BASE_ADDR+0x5E44UL)
+#define ISP_POSTCDN_R_DISTW0 (ISP_BASE_ADDR+0x5E48UL)
+//pike has no this register ISP_POSTCDN_START_ROW_MOD4
+//#define ISP_POSTCDN_START_ROW_MOD4 (ISP_BASE_ADDR+0x5E84UL)
+
+/*isp sub block: ygamma*/
+#define ISP_YGAMMA_STATUS (ISP_BASE_ADDR+0x6000UL)
+#define ISP_YGAMMA_PARAM (ISP_BASE_ADDR+0x6014UL)
+
+/*isp sub block: ydelay*/
+#define ISP_YDELAY_STATUS (ISP_BASE_ADDR+0x6100UL)
+#define ISP_YDELAY_PARAM (ISP_BASE_ADDR+0x6114UL)
+
+/*isp sub block: yuv nlm*/
+#define ISP_YNLM_STATUS0 (ISP_BASE_ADDR+0x6200UL)
+#define ISP_YNLM_STATUS1 (ISP_BASE_ADDR+0x6204UL)
+#define ISP_YNLM_PARAM (ISP_BASE_ADDR+0x6214UL)
+#define ISP_YNLM_ADAPT_PARAM1 (ISP_BASE_ADDR+0x6218UL)
+#define ISP_YNLM_ADAPT_PARAM2 (ISP_BASE_ADDR+0x621CUL)
+#define ISP_YNLM_ADAPT_PARAM3 (ISP_BASE_ADDR+0x6220UL)
+#define ISP_YNLM_ADAPT_PARAM4 (ISP_BASE_ADDR+0x6224UL)
+#define ISP_YNLM_ADAPT_PARAM5 (ISP_BASE_ADDR+0x6228UL)
+#define ISP_YNLM_ADAPT_PARAM6 (ISP_BASE_ADDR+0x622CUL)
+#define ISP_YNLM_ADAPT_PARAM7 (ISP_BASE_ADDR+0x6230UL)
+#define ISP_YNLM_ADAPT_PARAM8 (ISP_BASE_ADDR+0x6234UL)
+#define ISP_YNLM_DEN_STERNGTH (ISP_BASE_ADDR+0x6238UL)
+#define ISP_YNLM_CENTER (ISP_BASE_ADDR+0x623CUL)
+#define ISP_YNLM_CENTER_X2 (ISP_BASE_ADDR+0x6240UL)
+#define ISP_YNLM_CENTER_Y2 (ISP_BASE_ADDR+0x6244UL)
+#define ISP_YNLM_RADIUS (ISP_BASE_ADDR+0x6248UL)
+#define ISP_YNLM_RADIUS_RANGE (ISP_BASE_ADDR+0x624CUL)
+#define ISP_YNLM_GAIN_MAX (ISP_BASE_ADDR+0x6250UL)
+#define ISP_YNLM_IMG_PARAM0 (ISP_BASE_ADDR+0x6254UL)
+#define ISP_YNLM_IMG_PARAM1 (ISP_BASE_ADDR+0x6258UL)
+#define ISP_YNLM_ADD_BACK (ISP_BASE_ADDR+0x625CUL)
+#define ISP_YNLM_LUT_W_0 (ISP_BASE_ADDR+0x6260UL)
+#define ISP_YNLM_LUT_W_1 (ISP_BASE_ADDR+0x6264UL)
+#define ISP_YNLM_LUT_W_2 (ISP_BASE_ADDR+0x6268UL)
+#define ISP_YNLM_LUT_W_3 (ISP_BASE_ADDR+0x626CUL)
+#define ISP_YNLM_LUT_W_4 (ISP_BASE_ADDR+0x6270UL)
+#define ISP_YNLM_LUT_W_5 (ISP_BASE_ADDR+0x6274UL)
+#define ISP_YNLM_LUT_W_6 (ISP_BASE_ADDR+0x6278UL)
+#define ISP_YNLM_LUT_W_7 (ISP_BASE_ADDR+0x627CUL)
+#define ISP_YNLM_LUT_W_8 (ISP_BASE_ADDR+0x6280UL)
+#define ISP_YNLM_LUT_W_9 (ISP_BASE_ADDR+0x6284UL)
+#define ISP_YNLM_LUT_W_10 (ISP_BASE_ADDR+0x6288UL)
+#define ISP_YNLM_LUT_W_11 (ISP_BASE_ADDR+0x628CUL)
+#define ISP_YNLM_LUT_W_12 (ISP_BASE_ADDR+0x6290UL)
+#define ISP_YNLM_LUT_W_13 (ISP_BASE_ADDR+0x6294UL)
+#define ISP_YNLM_LUT_W_14 (ISP_BASE_ADDR+0x6298UL)
+#define ISP_YNLM_LUT_W_15 (ISP_BASE_ADDR+0x629CUL)
+#define ISP_YNLM_LUT_W_16 (ISP_BASE_ADDR+0x62A0UL)
+#define ISP_YNLM_LUT_W_17 (ISP_BASE_ADDR+0x62A4UL)
+#define ISP_YNLM_LUT_W_18 (ISP_BASE_ADDR+0x62A8UL)
+#define ISP_YNLM_LUT_W_19 (ISP_BASE_ADDR+0x62ACUL)
+#define ISP_YNLM_LUT_W_20 (ISP_BASE_ADDR+0x62B0UL)
+#define ISP_YNLM_LUT_W_21 (ISP_BASE_ADDR+0x62B4UL)
+#define ISP_YNLM_LUT_W_22 (ISP_BASE_ADDR+0x62B8UL)
+#define ISP_YNLM_LUT_W_23 (ISP_BASE_ADDR+0x62BCUL)
+#define ISP_YNLM_LUT_VS_0 (ISP_BASE_ADDR+0x6300UL)
+#define ISP_YNLM_LUT_VS_1 (ISP_BASE_ADDR+0x6304UL)
+#define ISP_YNLM_LUT_VS_2 (ISP_BASE_ADDR+0x6308UL)
+#define ISP_YNLM_LUT_VS_3 (ISP_BASE_ADDR+0x630CUL)
+#define ISP_YNLM_LUT_VS_4 (ISP_BASE_ADDR+0x6310UL)
+#define ISP_YNLM_LUT_VS_5 (ISP_BASE_ADDR+0x6314UL)
+#define ISP_YNLM_LUT_VS_6 (ISP_BASE_ADDR+0x6318UL)
+#define ISP_YNLM_LUT_VS_7 (ISP_BASE_ADDR+0x631CUL)
+#define ISP_YNLM_LUT_VS_8 (ISP_BASE_ADDR+0x6320UL)
+#define ISP_YNLM_LUT_VS_9 (ISP_BASE_ADDR+0x6324UL)
+#define ISP_YNLM_LUT_VS_10 (ISP_BASE_ADDR+0x6328UL)
+#define ISP_YNLM_LUT_VS_11 (ISP_BASE_ADDR+0x632CUL)
+#define ISP_YNLM_LUT_VS_12 (ISP_BASE_ADDR+0x6330UL)
+#define ISP_YNLM_LUT_VS_13 (ISP_BASE_ADDR+0x6334UL)
+#define ISP_YNLM_LUT_VS_14 (ISP_BASE_ADDR+0x6338UL)
+#define ISP_YNLM_LUT_VS_15 (ISP_BASE_ADDR+0x633CUL)
+#define ISP_YNLM_LUT_VS_16 (ISP_BASE_ADDR+0x6340UL)
+#define ISP_YNLM_LUT_VS_17 (ISP_BASE_ADDR+0x6344UL)
+#define ISP_YNLM_LUT_VS_18 (ISP_BASE_ADDR+0x6348UL)
+#define ISP_YNLM_LUT_VS_19 (ISP_BASE_ADDR+0x634CUL)
+#define ISP_YNLM_LUT_VS_20 (ISP_BASE_ADDR+0x6350UL)
+#define ISP_YNLM_LUT_VS_21 (ISP_BASE_ADDR+0x6354UL)
+#define ISP_YNLM_LUT_VS_22 (ISP_BASE_ADDR+0x6358UL)
+#define ISP_YNLM_LUT_VS_23 (ISP_BASE_ADDR+0x635CUL)
+#define ISP_YNLM_LUT_VS_24 (ISP_BASE_ADDR+0x6360UL)
+#define ISP_YNLM_LUT_VS_25 (ISP_BASE_ADDR+0x6364UL)
+#define ISP_YNLM_LUT_VS_26 (ISP_BASE_ADDR+0x6368UL)
+#define ISP_YNLM_LUT_VS_27 (ISP_BASE_ADDR+0x636CUL)
+#define ISP_YNLM_LUT_VS_28 (ISP_BASE_ADDR+0x6370UL)
+#define ISP_YNLM_LUT_VS_29 (ISP_BASE_ADDR+0x6374UL)
+#define ISP_YNLM_LUT_VS_30 (ISP_BASE_ADDR+0x6378UL)
+#define ISP_YNLM_LUT_VS_31 (ISP_BASE_ADDR+0x637CUL)
+#define ISP_YNLM_LUT_VS_32 (ISP_BASE_ADDR+0x6380UL)
+#define ISP_YNLM_LUT_VS_33 (ISP_BASE_ADDR+0x6384UL)
+#define ISP_YNLM_LUT_VS_34 (ISP_BASE_ADDR+0x6388UL)
+#define ISP_YNLM_LUT_VS_35 (ISP_BASE_ADDR+0x638CUL)
+#define ISP_YNLM_LUT_VS_36 (ISP_BASE_ADDR+0x6390UL)
+#define ISP_YNLM_LUT_VS_37 (ISP_BASE_ADDR+0x6394UL)
+#define ISP_YNLM_LUT_VS_38 (ISP_BASE_ADDR+0x6398UL)
+#define ISP_YNLM_LUT_VS_39 (ISP_BASE_ADDR+0x639CUL)
+#define ISP_YNLM_LUT_VS_40 (ISP_BASE_ADDR+0x63A0UL)
+#define ISP_YNLM_LUT_VS_41 (ISP_BASE_ADDR+0x63A4UL)
+#define ISP_YNLM_LUT_VS_42 (ISP_BASE_ADDR+0x63A8UL)
+#define ISP_YNLM_LUT_VS_43 (ISP_BASE_ADDR+0x63ACUL)
+#define ISP_YNLM_LUT_VS_44 (ISP_BASE_ADDR+0x63B0UL)
+#define ISP_YNLM_LUT_VS_45 (ISP_BASE_ADDR+0x63B4UL)
+#define ISP_YNLM_LUT_VS_46 (ISP_BASE_ADDR+0x63B8UL)
+#define ISP_YNLM_LUT_VS_47 (ISP_BASE_ADDR+0x63BCUL)
+#define ISP_YNLM_LUT_VS_48 (ISP_BASE_ADDR+0x63C0UL)
+#define ISP_YNLM_LUT_VS_49 (ISP_BASE_ADDR+0x63C4UL)
+#define ISP_YNLM_LUT_VS_50 (ISP_BASE_ADDR+0x63C8UL)
+#define ISP_YNLM_LUT_VS_51 (ISP_BASE_ADDR+0x63CCUL)
+#define ISP_YNLM_LUT_VS_52 (ISP_BASE_ADDR+0x63D0UL)
+#define ISP_YNLM_LUT_VS_53 (ISP_BASE_ADDR+0x63D4UL)
+#define ISP_YNLM_LUT_VS_54 (ISP_BASE_ADDR+0x63D8UL)
+#define ISP_YNLM_LUT_VS_55 (ISP_BASE_ADDR+0x63DCUL)
+#define ISP_YNLM_LUT_VS_56 (ISP_BASE_ADDR+0x63E0UL)
+#define ISP_YNLM_LUT_VS_57 (ISP_BASE_ADDR+0x63E4UL)
+#define ISP_YNLM_LUT_VS_58 (ISP_BASE_ADDR+0x63E8UL)
+#define ISP_YNLM_LUT_VS_59 (ISP_BASE_ADDR+0x63ECUL)
+#define ISP_YNLM_LUT_VS_60 (ISP_BASE_ADDR+0x63F0UL)
+#define ISP_YNLM_LUT_VS_61 (ISP_BASE_ADDR+0x63F4UL)
+#define ISP_YNLM_LUT_VS_62 (ISP_BASE_ADDR+0x63F8UL)
+#define ISP_YNLM_LUT_VS_63 (ISP_BASE_ADDR+0x63FCUL)
+
+
+
+/*isp sub block: iircnr(pike has no this module)*/
+/*#define ISP_IIRCNR_STATUS0 (ISP_BASE_ADDR+0x6400UL)
+#define ISP_IIRCNR_STATUS1 (ISP_BASE_ADDR+0x6404UL)
+#define ISP_IIRCNR_PARAM (ISP_BASE_ADDR+0x6414UL)
+#define ISP_IIRCNR_PARAM1 (ISP_BASE_ADDR+0x6418UL)
+#define ISP_IIRCNR_PARAM2 (ISP_BASE_ADDR+0x641CUL)
+#define ISP_IIRCNR_PARAM3 (ISP_BASE_ADDR+0x6420UL)
+#define ISP_IIRCNR_PARAM4 (ISP_BASE_ADDR+0x6424UL)
+#define ISP_IIRCNR_PARAM5 (ISP_BASE_ADDR+0x6428UL)
+#define ISP_IIRCNR_PARAM6 (ISP_BASE_ADDR+0x642CUL)
+#define ISP_IIRCNR_PARAM7 (ISP_BASE_ADDR+0x6430UL)
+#define ISP_IIRCNR_PARAM8 (ISP_BASE_ADDR+0x6434UL)
+#define ISP_IIRCNR_PARAM9 (ISP_BASE_ADDR+0x6438UL)
+#define ISP_YRANDOM_PARAM0 (ISP_BASE_ADDR+0x643CUL)
+#define ISP_YRANDOM_PARAM1 (ISP_BASE_ADDR+0x6440UL)
+#define ISP_YRANDOM_PARAM2 (ISP_BASE_ADDR+0x6444UL)
+#define ISP_YRANDOM_STATUS0 (ISP_BASE_ADDR+0x6448UL)
+#define ISP_YRANDOM_STATUS1 (ISP_BASE_ADDR+0x644CUL)
+#define ISP_YRANDOM_STATUS2 (ISP_BASE_ADDR+0x6450UL)*/
+
+/*pingpang buffer*/
+#define ISP_3D_LUT_BUF0_CH0 (ISP_BASE_ADDR+0x17000UL)
+#define ISP_HSV_BUF0_CH0 (ISP_BASE_ADDR+0x18000UL)
+#define ISP_VST_BUF0_CH0 (ISP_BASE_ADDR+0x19000UL)
+#define ISP_IVST_BUF0_CH0 (ISP_BASE_ADDR+0x1A000UL)
+#define ISP_FGAMMA_R_BUF0_CH0 (ISP_BASE_ADDR+0x1B000UL)
+#define ISP_FGAMMA_G_BUF0_CH0 (ISP_BASE_ADDR+0x1C000UL)
+#define ISP_FGAMMA_B_BUF0_CH0 (ISP_BASE_ADDR+0x1D000UL)
+#define ISP_YGAMMA_BUF0_CH0 (ISP_BASE_ADDR+0x1E000UL)
+//#define ISP_NLM_BUF0_CH0 (ISP_BASE_ADDR+0x1F000UL)
+//#define ISP_3D_LUT_BUF1_CH0 (ISP_BASE_ADDR+0x20000UL)
+#define ISP_HSV_BUF1_CH0 (ISP_BASE_ADDR+0x1F000UL)
+//#define ISP_VST_BUF1_CH0 (ISP_BASE_ADDR+0x22000UL)
+//#define ISP_IVST_BUF1_CH0 (ISP_BASE_ADDR+0x23000UL)
+//#define ISP_FGAMMA_R_BUF1_CH0 (ISP_BASE_ADDR+0x24000UL)
+//#define ISP_FGAMMA_G_BUF1_CH0 (ISP_BASE_ADDR+0x25000UL)
+//#define ISP_FGAMMA_B_BUF1_CH0 (ISP_BASE_ADDR+0x26000UL)
+//#define ISP_YGAMMA_BUF1_CH0 (ISP_BASE_ADDR+0x27000UL)
+//#define ISP_NLM_BUF1_CH0 (ISP_BASE_ADDR+0x28000UL)
+#define ISP_LEN_BUF0_CH0 (ISP_BASE_ADDR+0x29000UL)
+#define ISP_LEN_BUF1_CH0 (ISP_BASE_ADDR+0x2b000UL)
+
+#define ISP_AHB_BASE SPRD_MMAHB_BASE
+#define ISP_MODULE_EB (ISP_AHB_BASE+0x0000UL)
+#define ISP_MODULE_RESET (ISP_AHB_BASE+0x0004UL)
+#define ISP_CORE_CLK_EB (ISP_AHB_BASE+0x0008UL)
+
+/*isp v memory1: awbm*/
+#define ISP_RAW_AWBM_OUTPUT (ISP_BASE_ADDR+0x10000)
+/*#define ISP_RAW_AWBM_ITEM 256*/
+
+/*isp v memory2: aem*/
+#define ISP_RAW_AEM_OUTPUT (ISP_BASE_ADDR+0x12000)
+/*#define ISP_RAW_AEM_ITEM 1024*/
+
+/*isp v memory11: 3D_LUT0*/
+#define ISP_3D_LUT0_OUTPUT (ISP_BASE_ADDR+0x17000)
+/*#define ISP_3D_LUT0_ITEM 729*/
+
+/*isp v memory12: HSV BUF0*/
+#define ISP_HSV_BUF0_OUTPUT (ISP_BASE_ADDR+0x18000)
+/*#define ISP_HSV_ITEM 361*/
+
+/*isp v memory20: 3D_LUT1*/
+//#define ISP_3D_LUT1_OUTPUT (ISP_BASE_ADDR+0x20000)
+/*#define ISP_3D_LUT1_ITEM 729*/
+
+/*isp v memory21: HSV BUF1*/
+#define ISP_HSV_BUF1_OUTPUT (ISP_BASE_ADDR+0x21000)
+/*#define ISP_HSV_ITEM 361*/
+
+/*irq line number in system*/
+#define ISP_IRQ IRQ_ISP_INT
+
+#define ISP_RST_LOG_BIT BIT_2
+#define ISP_RST_CFG_BIT BIT_3
+
+#define ISP_IRQ_HW_MASK (0xFFFFFFFF)
+#define ISP_IRQ_NUM (32)
+#define ISP_REG_BUF_SIZE (4 * 1024)
+#define ISP_RAW_AE_BUF_SIZE (1024 * 4 * 3)
+#define ISP_FRGB_GAMMA_BUF_SIZE (129 * 4)
+#define ISP_YUV_YGAMMA_BUF_SIZE (129 * 4 )
+#define ISP_RAW_AWB_BUF_SIZE (256 * 4 * 9)
+#define ISP_BING4AWB_SIZE (640 * 480 * 2)
+#define ISP_YIQ_ANTIFLICKER_SIZE (1944 * 4 * 16)
+#define ISP_YIQ_AEM_BUF_SIZE (1024 * 4)
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_cfg_param.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_cfg_param.c
new file mode 100644
index 00000000..e75aec4d
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_cfg_param.c
@@ -0,0 +1,133 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_block.h"
+
+typedef int32_t (*isp_cfg_fun_ptr)(struct isp_io_param *isp_param);
+
+struct isp_cfg_fun {
+ uint32_t sub_block;
+ isp_cfg_fun_ptr cfg_fun;
+};
+
+static struct isp_cfg_fun isp_cfg_fun_tab[] = {
+ {ISP_BLOCK_PRE_GLB_GAIN, isp_k_cfg_pgg},
+ {ISP_BLOCK_BLC, isp_k_cfg_blc},
+ {ISP_BLOCK_RGB_GAIN, isp_k_cfg_rgb_gain},
+ {ISP_BLOCK_PRE_WAVELET, isp_k_cfg_pwd},
+ {ISP_BLOCK_NLC, isp_k_cfg_nlc},
+ /*{ISP_BLOCK_2D_LSC, isp_k_cfg_2d_lsc},*/
+ {ISP_BLOCK_1D_LSC, isp_k_cfg_1d_lsc},
+ /*{ISP_BLOCK_BINNING4AWB, isp_k_cfg_binning},*/
+ /*{ISP_BLOCK_AWB, isp_k_cfg_awb},*/
+ /*{ISP_BLOCK_RAW_AEM, isp_k_cfg_raw_aem},*/
+ {ISP_BLOCK_BPC, isp_k_cfg_bpc},
+ {ISP_BLOCK_BDN, isp_k_cfg_bdn},
+ {ISP_BLOCK_GRGB, isp_k_cfg_grgb},
+ {ISP_BLOCK_RGB_GAIN2, isp_k_cfg_rgb_gain2},
+ {ISP_BLOCK_NLM, isp_k_cfg_nlm},
+ {ISP_BLOCK_CFA, isp_k_cfg_cfa},
+ {ISP_BLOCK_CMC, isp_k_cfg_cmc10},
+ {ISP_BLOCK_HDR, isp_k_cfg_hdr},//pike add module,this module is same to sharkl's hdr module
+ /*{ISP_BLOCK_GAMMA, isp_k_cfg_gamma},*/
+ {ISP_BLOCK_CMC8, isp_k_cfg_cmc8},
+ /*{ISP_BLOCK_CT, isp_k_cfg_ct},*/
+ {ISP_BLOCK_CCE, isp_k_cfg_cce},
+ {ISP_BLOCK_HSV, isp_k_cfg_hsv},
+ {ISP_BLOCK_CSC, isp_k_cfg_csc},
+ {ISP_BLOCK_PRE_CDN_RGB, isp_k_cfg_pre_cdn_rgb},
+ {ISP_BLOCK_POSTERIZE, isp_k_cfg_posterize},
+ {ISP_BLOCK_AFM_V1, isp_k_cfg_rgb_afm},
+ {ISP_BLOCK_RGB2Y, isp_k_cfg_rgb2y},//pike add module
+ {ISP_BLOCK_YIQ_AEM, isp_k_cfg_yiq_aem},
+ /*{ISP_BLOCK_ANTI_FLICKER, isp_k_cfg_anti_flicker},*/
+ {ISP_BLOCK_YIQ_AFM, isp_k_cfg_yiq_afm},
+ {ISP_BLOCK_YUV_PRECDN, isp_k_cfg_yuv_precdn},
+ {ISP_BLOCK_PRE_FILTER, isp_k_cfg_prefilter},
+ {ISP_BLOCK_UV_PREFILTER, isp_k_cfg_uv_prefilter},//pike add module
+ {ISP_BLOCK_BRIGHTNESS, isp_k_cfg_brightness},
+ {ISP_BLOCK_CONTRAST, isp_k_cfg_contrast},
+ {ISP_BLOCK_HIST, isp_k_cfg_hist},
+ {ISP_BLOCK_HIST2, isp_k_cfg_hist2},
+ {ISP_BLOCK_ACA, isp_k_cfg_aca},
+ {ISP_BLOCK_YUV_CDN, isp_k_cfg_yuv_cdn},
+ {ISP_BLOCK_EDGE, isp_k_cfg_edge},
+ {ISP_BLOCK_CSS, isp_k_cfg_css},
+ {ISP_BLOCK_CSA, isp_k_cfg_csa},
+ {ISP_BLOCK_HUE, isp_k_cfg_hue},
+ {ISP_BLOCK_POST_CDN, isp_k_cfg_post_cdn},
+ {ISP_BLOCK_EMBOSS, isp_k_cfg_emboss},
+ /*{ISP_BLOCK_YGAMMA, isp_k_cfg_ygamma},*/
+ {ISP_BLOCK_YDELAY, isp_k_cfg_ydelay},
+ {ISP_BLOCK_YUV_NLM, isp_k_cfg_yuv_nlm},//pike add module
+ //{ISP_BLOCK_IIRCNR, isp_k_cfg_iircnr},//pike has no this module
+ {ISP_BLOCK_FETCH, isp_k_cfg_fetch},
+ {ISP_BLOCK_STORE, isp_k_cfg_store},
+ {ISP_BLOCK_DISPATCH, isp_k_cfg_dispatch},
+ {ISP_BLOCK_ARBITER_V1, isp_k_cfg_arbiter},
+ //{ISP_BLOCK_RAW_SIZER, isp_k_cfg_raw_sizer},//pike has no this module
+ {ISP_BLOCK_COMMON_V1, isp_k_cfg_common},
+};
+
+int32_t isp_cfg_param(void *param, struct isp_k_private *isp_private)
+{
+ int32_t ret = 0;
+ uint32_t i = 0, cnt = 0;
+ isp_cfg_fun_ptr cfg_fun_ptr = NULL;
+ struct isp_io_param isp_param = {0, 0, 0, NULL};
+
+ if (!param) {
+ printk("isp_cfg_param: param is null error.\n");
+ return -1;
+ }
+
+ ret = copy_from_user((void *)&isp_param, (void *)param, sizeof(isp_param));
+ if ( 0 != ret) {
+ printk("isp_cfg_param: copy error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ if (ISP_BLOCK_ANTI_FLICKER == isp_param.sub_block) {
+ ret = isp_k_cfg_anti_flicker(&isp_param, isp_private);
+ } else if (ISP_BLOCK_2D_LSC == isp_param.sub_block) {
+ ret = isp_k_cfg_2d_lsc(&isp_param, isp_private);
+ } else if (ISP_BLOCK_RAW_AEM == isp_param.sub_block) {
+ ret = isp_k_cfg_raw_aem(&isp_param, isp_private);
+ } else if (ISP_BLOCK_GAMMA == isp_param.sub_block) {
+ ret = isp_k_cfg_gamma(&isp_param, isp_private);
+ } else if (ISP_BLOCK_CT == isp_param.sub_block) {
+ ret = isp_k_cfg_ct(&isp_param, isp_private);
+ } else if (ISP_BLOCK_YGAMMA == isp_param.sub_block) {
+ ret = isp_k_cfg_ygamma(&isp_param, isp_private);
+ } else if (ISP_BLOCK_AWB == isp_param.sub_block) {
+ ret = isp_k_cfg_awb(&isp_param, isp_private);
+ } else if(ISP_BLOCK_BINNING4AWB == isp_param.sub_block){
+ ret = isp_k_cfg_binning(&isp_param, isp_private);
+ } else {
+ cnt = sizeof(isp_cfg_fun_tab) / sizeof(isp_cfg_fun_tab[0]);
+ for (i = 0; i < cnt; i++) {
+ if (isp_param.sub_block == isp_cfg_fun_tab[i].sub_block) {
+ cfg_fun_ptr = isp_cfg_fun_tab[i].cfg_fun;
+ break;
+ }
+ }
+
+ if (NULL != cfg_fun_ptr)
+ ret = cfg_fun_ptr(&isp_param);
+ }
+
+ return ret;
+}
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_1d_lsc.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_1d_lsc.c
new file mode 100644
index 00000000..3daa3ef5
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_1d_lsc.c
@@ -0,0 +1,146 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_1d_lsc_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ struct isp_dev_1d_lsc_info lnc_info;
+
+ ret = copy_from_user((void *)&lnc_info, param->property_param, sizeof(lnc_info));
+ if (0 != ret) {
+ printk("isp_k_1d_lsc_block: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_1D_LNC_PARAM, BIT_0, lnc_info.bypass);
+
+ val = (lnc_info.gain_max_thr & 0x1FFF) << 1;
+ REG_MWR(ISP_1D_LNC_PARAM, 0x3FFE, val);
+
+ val = ((lnc_info.center_r0c0_col_x & 0x1FFF) << 12) | (lnc_info.center_r0c0_row_y & 0xFFF);
+ REG_WR(ISP_1D_LNC_PARAM1, val);
+ val = ((lnc_info.center_r0c1_col_x & 0x1FFF) << 12) | (lnc_info.center_r0c1_row_y & 0xFFF);
+ REG_WR(ISP_1D_LNC_PARAM2, val);
+ val = ((lnc_info.center_r1c0_col_x & 0x1FFF) << 12) | (lnc_info.center_r1c0_row_y & 0xFFF);
+ REG_WR(ISP_1D_LNC_PARAM3, val);
+ val = ((lnc_info.center_r1c1_col_x & 0x1FFF) << 12) | (lnc_info.center_r1c1_row_y & 0xFFF);
+ REG_WR(ISP_1D_LNC_PARAM4, val);
+
+ val = lnc_info.delta_square_r0c0_x & 0x3FFFFFF;
+ REG_WR(ISP_1D_LNC_PARAM5, val);
+ val = lnc_info.delta_square_r0c1_x & 0x3FFFFFF;
+ REG_WR(ISP_1D_LNC_PARAM7, val);
+ val = lnc_info.delta_square_r1c0_x & 0x3FFFFFF;
+ REG_WR(ISP_1D_LNC_PARAM9, val);
+ val = lnc_info.delta_square_r1c1_x & 0x3FFFFFF;
+ REG_WR(ISP_1D_LNC_PARAM11, val);
+ val = lnc_info.delta_square_r0c0_y & 0xFFFFFF;
+ REG_WR(ISP_1D_LNC_PARAM6, val);
+ val = lnc_info.delta_square_r0c1_y & 0xFFFFFF;
+ REG_WR(ISP_1D_LNC_PARAM8, val);
+ val = lnc_info.delta_square_r1c0_y & 0xFFFFFF;
+ REG_WR(ISP_1D_LNC_PARAM10, val);
+ val = lnc_info.delta_square_r1c1_y & 0xFFFFFF;
+ REG_WR(ISP_1D_LNC_PARAM12, val);
+
+ val = ((lnc_info.coef_r0c0_p1 & 0xFFFF) << 11) | (lnc_info.coef_r0c0_p2 & 0x7FF);
+ REG_WR(ISP_1D_LNC_PARAM13, val);
+ val = ((lnc_info.coef_r0c1_p1 & 0xFFFF) << 11) | (lnc_info.coef_r0c1_p2 & 0x7FF);
+ REG_WR(ISP_1D_LNC_PARAM14, val);
+ val = ((lnc_info.coef_r1c0_p1 & 0xFFFF) << 11) | (lnc_info.coef_r1c0_p2 & 0x7FF);
+ REG_WR(ISP_1D_LNC_PARAM15, val);
+ val = ((lnc_info.coef_r1c1_p1 & 0xFFFF) << 11) | (lnc_info.coef_r1c1_p2 & 0x7FF);
+ REG_WR(ISP_1D_LNC_PARAM16, val);
+
+ val = ((lnc_info.start_pos.x & 0x1FFF) << 12) | (lnc_info.start_pos.y & 0xFFF);
+ REG_WR(ISP_1D_LNC_PARAM18, val);
+
+ return ret;
+}
+
+static int32_t isp_k_1d_lsc_slice_size(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ struct isp_img_size size;
+
+ ret = copy_from_user((void *)&size, param->property_param, sizeof(struct isp_img_size));
+ if (0 != ret) {
+ printk("isp_k_1d_lsc_slice_size: read copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ val = ((size.width & 0x1FFF) << 12) | (size.height & 0xFFF);
+
+ REG_WR(ISP_1D_LNC_PARAM17, val);
+
+ return ret;
+}
+
+static int32_t isp_k_1d_lsc_pos(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ struct img_offset pos;
+
+ ret = copy_from_user((void *)&pos, param->property_param, sizeof(struct img_offset));
+ if (0 != ret) {
+ printk("isp_k_1d_lsc_pos: read copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ val = ((pos.x & 0x1FFF) << 12) | (pos.y & 0xFFF);
+
+ REG_WR(ISP_1D_LNC_PARAM18, val);
+
+ return ret;
+}
+
+int32_t isp_k_cfg_1d_lsc(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_1d_lsc: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_1d_lsc: property_param is null error.\n");
+ return -1;
+ }
+
+ switch(param->property) {
+ case ISP_PRO_1D_LSC_BLOCK:
+ ret = isp_k_1d_lsc_block(param);
+ break;
+ case ISP_PRO_1D_LSC_SLICE_SIZE:
+ ret = isp_k_1d_lsc_slice_size(param);
+ break;
+ case ISP_PRO_1D_LSC_POS:
+ ret = isp_k_1d_lsc_pos(param);
+ break;
+ default:
+ printk("isp_k_cfg_1d_lsc: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
+
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_2d_lsc.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_2d_lsc.c
new file mode 100644
index 00000000..94f1f2c4
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_2d_lsc.c
@@ -0,0 +1,537 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include <asm/cacheflush.h>
+#include <linux/delay.h>
+#include "isp_reg.h"
+#include "isp_drv.h"
+
+
+#define ISP_LSC_TIME_OUT_MAX 500
+#define ISP_LSC_BUF0 0
+#define ISP_LSC_BUF1 1
+
+#if 0
+#define CLIP(input,top, bottom) {if (input>top) input = top; if (input < bottom) input = bottom;}
+#define TABLE_LEN_128 128
+#define TABLE_LEN_96 96
+
+typedef struct lnc_bicubic_weight_t_64_tag
+{
+ int16_t w0;
+ int16_t w1;
+ int16_t w2;
+ int16_t w3;
+}LNC_BICUBIC_WEIGHT_TABLE_T;
+////////10bit precision//////////////////////////////////////
+static LNC_BICUBIC_WEIGHT_TABLE_T lnc_bicubic_weight_t_96_simple[] =
+{
+ {0, 1024, 0},
+ {-5,1024, 6},
+ {-10,1023, 12},
+ {-15,1022, 18},
+ {-20,1020, 25},
+ {-24,1017, 32},
+ {-28,1014, 40},
+ {-32,1011, 48},
+ {-36,1007, 56},
+ {-39,1003, 65},
+ {-43,998, 74},
+ {-46,993, 83},
+ {-49,987, 93},
+ {-52,981, 103},
+ {-54,974, 113},
+ {-57,967, 124},
+ {-59,960, 135},
+ {-61,952, 146},
+ {-63,944, 158},
+ {-65,936, 170},
+ {-67,927, 182},
+ {-68,918, 194},
+ {-70,908, 206},
+ {-71,898, 219},
+ {-72,888, 232},
+ {-73,878, 245},
+ {-74,867, 258},
+ {-74,856, 272},
+ {-75,844, 285},
+ {-75,833, 299},
+ {-76,821, 313},
+ {-76,809, 327},
+ {-76,796, 341},
+ {-76,784, 356},
+ {-76,771, 370},
+ {-75,758, 384},
+ {-75,745, 399},
+ {-75,732, 414},
+ {-74,718, 428},
+ {-73,704, 443},
+ {-73,691, 458},
+ {-72,677, 473},
+ {-71,663, 487},
+ {-70,648, 502},
+ {-69,634, 517},
+ {-68,620, 532},
+ {-67,605, 547},
+ {-65,591, 561},
+ {-64,576, 576},
+};
+
+static LNC_BICUBIC_WEIGHT_TABLE_T lnc_bicubic_weight_t_128_simple[] =
+{
+ {0, 1024, 0},
+ {-4, 1024, 4},
+ {-8, 1023, 8},
+ {-11, 1023, 13},
+ {-15, 1022, 18},
+ {-18, 1020, 23},
+ {-22, 1019, 28},
+ {-25, 1017, 34},
+ {-28, 1014, 40},
+ {-31, 1012, 46},
+ {-34, 1009, 52},
+ {-37, 1006, 58},
+ {-39, 1003, 65},
+ {-42, 999, 72},
+ {-44, 995, 78},
+ {-47, 991, 86},
+ {-49, 987, 93},
+ {-51, 982, 101},
+ {-53, 978, 108},
+ {-55, 973, 116},
+ {-57, 967, 124},
+ {-59, 962, 132},
+ {-60, 956, 141},
+ {-62, 950, 149},
+ {-63, 944, 158},
+ {-65, 938, 167},
+ {-66, 931, 176},
+ {-67, 925, 185},
+ {-68, 918, 194},
+ {-69, 910, 203},
+ {-70, 903, 213},
+ {-71, 896, 222},
+ {-72, 888, 232},
+ {-73, 880, 242},
+ {-73, 872, 252},
+ {-74, 864, 262},
+ {-74, 856, 272},
+ {-75, 847, 282},
+ {-75, 839, 292},
+ {-75, 830, 303},
+ {-76, 821, 313},
+ {-76, 812, 324},
+ {-76, 803, 334},
+ {-76, 793, 345},
+ {-76, 784, 356},
+ {-76, 774, 366},
+ {-76, 765, 377},
+ {-75, 755, 388},
+ {-75, 745, 399},
+ {-75, 735, 410},
+ {-74, 725, 421},
+ {-74, 715, 432},
+ {-73, 704, 443},
+ {-73, 694, 454},
+ {-72, 684, 465},
+ {-72, 673, 476},
+ {-71, 663, 487},
+ {-70, 652, 498},
+ {-69, 641, 510},
+ {-69, 631, 521},
+ {-68, 620, 532},
+ {-67, 609, 543},
+ {-66, 598, 554},
+ {-65, 587, 565},
+ {-64, 576, 576},
+};
+
+static uint16_t ISP_Cubic1D(uint16_t a, uint16_t b, uint16_t c, uint16_t d, uint16_t u, uint16_t box)
+{
+ int32_t out_value;
+ uint16_t out_value_uint16_t;
+ int16_t w0, w1, w2, w3;
+ uint32_t out_value_tmp;
+ int16_t sub_tmp0;
+ int16_t sub_tmp1;
+ int16_t sub_tmp2;
+
+ if(box ==96)
+ {
+ //use simple table
+ if ( u < (TABLE_LEN_96/2 + 1) )
+ {
+ w0 = lnc_bicubic_weight_t_96_simple[u].w0 ;
+ w1 = lnc_bicubic_weight_t_96_simple[u].w1 ;
+ w2 = lnc_bicubic_weight_t_96_simple[u].w2 ;
+
+ sub_tmp0 = a-d;
+ sub_tmp1 = b-d;
+ sub_tmp2 = c-d;
+ out_value_tmp = ((uint32_t)d)<<10;
+ out_value = out_value_tmp + sub_tmp0 * w0 + sub_tmp1 * w1 + sub_tmp2 * w2;
+ }
+ else
+ {
+ w1 = lnc_bicubic_weight_t_96_simple[TABLE_LEN_96 - u].w2 ;
+ w2 = lnc_bicubic_weight_t_96_simple[TABLE_LEN_96 - u].w1 ;
+ w3 = lnc_bicubic_weight_t_96_simple[TABLE_LEN_96 - u].w0 ;
+
+ sub_tmp0 = b-a;
+ sub_tmp1 = c-a;
+ sub_tmp2 = d-a;
+ out_value_tmp = ((uint32_t)a)<<10;
+ out_value = out_value_tmp + sub_tmp0 * w1 + sub_tmp1 * w2 + sub_tmp2 * w3;
+ }
+
+ }
+ else
+ {
+ u = u * (TABLE_LEN_128 / box);
+
+ //use simple table
+ if ( u < (TABLE_LEN_128/2 + 1) )
+ {
+ w0 = lnc_bicubic_weight_t_128_simple[u].w0 ;
+ w1 = lnc_bicubic_weight_t_128_simple[u].w1 ;
+ w2 = lnc_bicubic_weight_t_128_simple[u].w2 ;
+
+ sub_tmp0 = a-d;
+ sub_tmp1 = b-d;
+ sub_tmp2 = c-d;
+ out_value_tmp = ((uint32_t)d)<<10;
+ out_value = out_value_tmp + sub_tmp0 * w0 + sub_tmp1 * w1 + sub_tmp2 * w2;
+ }
+ else
+ {
+ w1 = lnc_bicubic_weight_t_128_simple[TABLE_LEN_128 - u].w2 ;
+ w2 = lnc_bicubic_weight_t_128_simple[TABLE_LEN_128 - u].w1 ;
+ w3 = lnc_bicubic_weight_t_128_simple[TABLE_LEN_128 - u].w0 ;
+
+ sub_tmp0 = b-a;
+ sub_tmp1 = c-a;
+ sub_tmp2 = d-a;
+ out_value_tmp = ((uint32_t)a)<<10;
+ out_value = out_value_tmp + sub_tmp0 * w1 + sub_tmp1 * w2 + sub_tmp2 * w3;
+ }
+ }
+
+ //CLIP(out_value, 4095*1024*2, 1024*1024); // for LSC gain, 1024 = 1.0, 4095 = 4.0 ; 4095*2 is for boundary extension.
+ CLIP(out_value, 16383*1024, 1024*1024); // for LSC gain, 1024 = 1.0, 16383 = 16.0 ; 16383 is for boundary extension, 14 bit parameter is used.
+
+ out_value_uint16_t = (uint16_t)((out_value + 512) >> 10);
+
+ return out_value_uint16_t;
+}
+
+
+static int32_t ISP_GenerateQValues(uint32_t word_endian, uint32_t q_val[][5], unsigned long param_address, uint16_t grid_w, uint16_t grid_num, uint16_t u)
+{
+ uint8_t i;
+ uint16_t A0, B0, C0, D0;
+ uint16_t A1, B1, C1, D1;
+ uint32_t *addr = (uint32_t *)param_address;
+
+ if (param_address == 0x0 || grid_num == 0x0) {
+ printk("ISP_GenerateQValues param_address error addr=0x%lx grid_num=%d \n",param_address, grid_num);
+ return -1;
+ }
+
+ //printk("ISP_GenerateQValues:addr=%x grid_w=%d grid_num=%d u=%d \n",param_address,grid_w,grid_num,u);
+ #if 0
+ for (i = 0; i < 5; i++) {
+ A0 = (uint16_t)*(addr + i * 2) & 0xFFFF;
+ B0 = (uint16_t)*(addr + i * 2 + grid_w * 2) & 0xFFFF;
+ C0 = (uint16_t)*(addr + i * 2 + grid_w * 2 * 2) & 0xFFFF;
+ D0 = (uint16_t)*(addr + i * 2 + grid_w * 2 * 3) & 0xFFFF;
+ A1 = (uint16_t)(*(addr + i * 2) >> 16);
+ B1 = (uint16_t)(*(addr + i * 2 + grid_w * 2) >> 16);
+ C1 = (uint16_t)(*(addr + i * 2 + grid_w * 2 * 2) >> 16);
+ D1 = (uint16_t)(*(addr + i * 2 + grid_w * 2 * 3) >> 16);
+ q_val[0][i] = ISP_Cubic1D(A0, B0, C0, D0, u, grid_num);
+ q_val[1][i] = ISP_Cubic1D(A1, B1, C1, D1, u, grid_num);
+ }
+ #endif
+ #if 1
+ for (i = 0; i < 5; i++) {
+ if (1 == word_endian) { // ABCD = 1 word
+ A0 = *(addr + i * 2) >> 16; // AB
+ B0 = *(addr + i * 2 + grid_w * 2) >> 16; // AB
+ C0 = *(addr + i * 2 + grid_w * 2 * 2) >> 16; // AB
+ D0 = *(addr + i * 2 + grid_w * 2 * 3) >> 16; // AB
+ A1 = *(addr + i * 2) & 0xFFFF; // CD
+ B1 = *(addr + i * 2 + grid_w * 2) & 0xFFFF; // CD
+ C1 = *(addr + i * 2 + grid_w * 2 * 2) & 0xFFFF;// CD
+ D1 = *(addr + i * 2 + grid_w * 2 * 3) & 0xFFFF;// CD
+ } else if (2 == word_endian) { // CDAB = 1 word
+ A0 = *(addr + i * 2) & 0xFFFF;
+ B0 = *(addr + i * 2 + grid_w * 2) & 0xFFFF;
+ C0 = *(addr + i * 2 + grid_w * 2 * 2) & 0xFFFF;
+ D0 = *(addr + i * 2 + grid_w * 2 * 3) & 0xFFFF;
+ A1 = *(addr + i * 2) >> 16;
+ B1 = *(addr + i * 2 + grid_w * 2) >> 16;
+ C1 = *(addr + i * 2 + grid_w * 2 * 2) >> 16;
+ D1 = *(addr + i * 2 + grid_w * 2 * 3) >> 16;
+ } else if (0 == word_endian) { // DCBA = 1 word
+ A0 = ((*(addr + i * 2) << 8) & 0x0000FF00) | ((*(addr + i * 2) >> 8) & 0x000000FF);
+ B0 = ((*(addr + i * 2 + grid_w * 2) << 8) & 0x0000FF00) | ((*(addr + i * 2 + grid_w * 2) >> 8) & 0x000000FF);
+ C0 = ((*(addr + i * 2 + grid_w * 2 * 2) << 8) & 0x0000FF00) | ((*(addr + i * 2 + grid_w * 2 * 2) >> 8) & 0x000000FF);
+ D0 = ((*(addr + i * 2 + grid_w * 2 * 3) << 8) & 0x0000FF00) | ((*(addr + i * 2 + grid_w * 2 * 3) >> 8) & 0x000000FF);
+ A1 = ((*(addr + i * 2) << 8) & 0xFF000000) | ((*(addr + i * 2) >> 8) & 0x00FF0000);
+ B1 = ((*(addr + i * 2 + grid_w * 2) << 8) & 0xFF000000) | ((*(addr + i * 2 + grid_w * 2) >> 8) & 0x00FF0000);
+ C1 = ((*(addr + i * 2 + grid_w * 2 * 2) << 8) & 0xFF000000) | ((*(addr + i * 2 + grid_w * 2 * 2) >> 8) & 0x00FF0000);
+ D1 = ((*(addr + i * 2 + grid_w * 2 * 3) << 8) & 0xFF000000) | ((*(addr + i * 2 + grid_w * 2 * 3) >> 8) & 0x00FF0000);
+ } else if (3 == word_endian) { // BADC = 1 word
+ A0 = ((*(addr + i * 2) << 8) & 0xFF000000) | ((*(addr + i * 2) >> 8) & 0x00FF0000);
+ B0 = ((*(addr + i * 2 + grid_w * 2) << 8) & 0xFF000000) | ((*(addr + i * 2 + grid_w * 2) >> 8) & 0x00FF0000);
+ C0 = ((*(addr + i * 2 + grid_w * 2 * 2) << 8) & 0xFF000000) | ((*(addr + i * 2 + grid_w * 2 * 2) >> 8) & 0x00FF0000);
+ D0 = ((*(addr + i * 2 + grid_w * 2 * 3) << 8) & 0xFF000000) | ((*(addr + i * 2 + grid_w * 2 * 3) >> 8) & 0x00FF0000);
+ A1 = ((*(addr + i * 2) << 8) & 0x0000FF00) | ((*(addr + i * 2) >> 8) & 0x000000FF);
+ B1 = ((*(addr + i * 2 + grid_w * 2) << 8) & 0x0000FF00) | ((*(addr + i * 2 + grid_w * 2) >> 8) & 0x000000FF);
+ C1 = ((*(addr + i * 2 + grid_w * 2 * 2) << 8) & 0x0000FF00) | ((*(addr + i * 2 + grid_w * 2 * 2) >> 8) & 0x000000FF);
+ D1 = ((*(addr + i * 2 + grid_w * 2 * 3) << 8) & 0x0000FF00) | ((*(addr + i * 2 + grid_w * 2 * 3) >> 8) & 0x000000FF);
+ }
+ //printk("ISP_GenerateQValues: A0=%x B0=%x C0=%x D0=%x A1=%x B1=%x C1=%x D1=%x \n",A0,B0,C0,D0,A1,B1,C1,D1);
+ q_val[0][i] = ISP_Cubic1D(A0, B0, C0, D0, u, grid_num);
+ q_val[1][i] = ISP_Cubic1D(A1, B1, C1, D1, u, grid_num);
+ //printk("ISP_GenerateQValues: q_val[0][%d] = %d q_val[1][%d] = %d \n",i,q_val[0][i],i ,q_val[1][i] );
+ }
+ #endif
+
+ return 0;
+}
+#endif
+
+static int32_t isp_k_2d_lsc_param_load(struct isp_k_private *isp_private)
+{
+ int32_t ret = 0;
+ uint32_t time_out_cnt = 0;
+ uint32_t addr = 0, reg_value = 0;
+
+ if (ISP_LSC_BUF0 == isp_private->lsc_load_buf_id) {
+ isp_private->lsc_load_buf_id = ISP_LSC_BUF1;
+ } else {
+ isp_private->lsc_load_buf_id = ISP_LSC_BUF0;
+ }
+ REG_MWR(ISP_LENS_LOAD_BUF, BIT_0, isp_private->lsc_load_buf_id);
+ REG_WR(ISP_LENS_PARAM_ADDR, isp_private->lsc_buf_phys_addr);
+ REG_OWR(ISP_LENS_LOAD_EB, BIT_0);
+ REG_MWR(ISP_LENS_PARAM, BIT_1, isp_private->lsc_load_buf_id << 1);
+ isp_private->lsc_update_buf_id = isp_private->lsc_load_buf_id;
+
+ reg_value = REG_RD(ISP_INT_RAW0);
+
+ while ((0x00 == (reg_value & ISP_INT_EVT_LSC_LOAD))
+ && (time_out_cnt < ISP_LSC_TIME_OUT_MAX)) {
+ udelay(1);
+ reg_value = REG_RD(ISP_INT_RAW0);
+ time_out_cnt++;
+ }
+ if (time_out_cnt >= ISP_LSC_TIME_OUT_MAX) {
+ ret = -1;
+ printk("isp_k_2d_lsc_param_load: lsc load time out error.\n");
+ }
+ REG_OWR(ISP_INT_CLR0, ISP_INT_EVT_LSC_LOAD);
+
+ return ret;
+}
+
+static int32_t isp_k_2d_lsc_block(struct isp_io_param *param,
+ struct isp_k_private *isp_private)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ uint32_t i = 0;
+ //uint32_t qvalue_addr = ISP_LEN_BUF0_CH0;
+ struct isp_dev_2d_lsc_info lens_info;
+
+ memset(&lens_info, 0x00, sizeof(lens_info));
+
+ ret = copy_from_user((void *)&lens_info, param->property_param, sizeof(lens_info));
+ if (0 != ret) {
+ printk("isp_k_2d_lsc_block: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ val = ((lens_info.offset_y & 0xFFFF) << 16) | (lens_info.offset_x & 0xFFFF);
+ REG_WR(ISP_LENS_SLICE_POS, val);
+
+ val = lens_info.grid_pitch & 0x1FF;
+ REG_MWR(ISP_LENS_GRID_PITCH, 0x1FF, val);
+
+ val = (lens_info.grid_width & 0xFF) << 16;
+ REG_MWR(ISP_LENS_GRID_PITCH, 0xFF0000, val);
+
+ val = ((lens_info.grid_num_t & 0xFFFF) << 16) | ((lens_info.grid_y_num & 0xFF) << 8) | (lens_info.grid_x_num & 0xFF);
+ REG_WR(ISP_LENS_GRID_SIZE, val);
+
+ REG_MWR(ISP_LENS_LOAD_BUF, BIT_1, lens_info.load_chn_sel << 1);
+
+ REG_MWR(ISP_LENS_MISC, (BIT_1 | BIT_0), (lens_info.endian & 0x03));
+
+ val = ((lens_info.slice_size.height & 0xFFFF) << 16) | (lens_info.slice_size.width & 0xFFFF);
+ REG_WR(ISP_LENS_SLICE_SIZE, val);
+
+ val = ((lens_info.relative_y & 0xFF) << 8) | (lens_info.relative_x & 0xFF);
+ REG_WR(ISP_LENS_INIT_COOR, val);
+
+ /*ret = isp_k_2d_lsc_param_load(&src_buf, isp_private, &qvalue_addr);
+ REG_WR(ISP_LENS_PARAM_ADDR, qvalue_addr);
+ printk("isp_k_2d_lsc_block:qvalue_addr=%x grid_x_num=%d grid_width=%d relative_y=%d \n",qvalue_addr,(lens_info.grid_x_num & 0xFF),(lens_info.grid_width & 0xFF), (lens_info.relative_y & 0xFF)>>1);
+
+ ISP_GenerateQValues(1, lens_info.q_value, qvalue_addr, ((uint16_t)lens_info.grid_x_num & 0xFF) + 2,(lens_info.grid_width & 0xFF), (lens_info.relative_y & 0xFF)>>1);
+ */
+
+ ret = isp_k_2d_lsc_param_load(isp_private);
+ if (0 != ret) {
+ printk("isp_k_2d_lsc_block: lsc load para error, ret=0x%x\n", (uint32_t)ret);
+ REG_MWR(ISP_LENS_PARAM, BIT_0, ISP_BYPASS_EB);
+ return -1;
+ }
+
+ for (i = 0; i < 5; i++) {
+ val = ((lens_info.q_value[0][i] & 0x3FFF) << 16) | (lens_info.q_value[1][i] & 0x3FFF);
+ REG_WR(ISP_LENS_Q0_VALUE + i * 4, val);
+ }
+
+ REG_MWR(ISP_LENS_PARAM, BIT_0, lens_info.bypass);
+
+ return ret;
+
+}
+
+static int32_t isp_k_2d_lsc_param_update(struct isp_io_param *param,
+ struct isp_k_private *isp_private)
+{
+ int32_t ret = 0;
+
+ REG_MWR(ISP_LENS_PARAM, BIT_1, isp_private->lsc_update_buf_id << 1);
+
+ return ret;
+}
+
+static int32_t isp_k_2d_lsc_pos(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ struct isp_img_offset offset = {0, 0};
+
+ ret = copy_from_user((void *)&offset, param->property_param, sizeof(offset));
+ if (0 != ret) {
+ printk("isp_k_lens_pos: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ val = ((offset.y & 0xFFFF) << 16) | (offset.x & 0xFFFF);
+
+ REG_WR(ISP_LENS_SLICE_POS, val);
+
+ return ret;
+}
+
+static int32_t isp_k_2d_lsc_grid_size(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ uint32_t grid_total = 0;
+ struct isp_img_size size = {0, 0};
+
+ ret = copy_from_user((void *)&size, param->property_param, sizeof(size));
+ if (0 != ret) {
+ printk("isp_k_2d_lsc_grid_size: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ grid_total = (size.height + 2) * (size.width + 2);
+ val = ((grid_total & 0xFFFF) << 16) | ((size.height & 0xFF) << 8) | (size.width & 0xFF);
+ REG_WR(ISP_LENS_GRID_SIZE, val);
+
+ return ret;
+}
+
+static int32_t isp_k_2d_lsc_slice_size(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ struct isp_img_size size = {0, 0};
+
+ ret = copy_from_user((void *)&size, param->property_param, sizeof(size));
+ if (0 != ret) {
+ printk("isp_k_2d_lsc_slice_size: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ val = ((size.height & 0xFFFF) << 16) | (size.width & 0xFFFF);
+
+ REG_WR(ISP_LENS_SLICE_SIZE, val);
+
+ return ret;
+}
+
+static int32_t isp_k_2d_lsc_transaddr(struct isp_io_param *param,
+ struct isp_k_private *isp_private)
+{
+ int32_t ret = 0;
+ struct isp_lsc_addr lsc_addr;
+
+ ret = copy_from_user((void *)&lsc_addr, param->property_param, sizeof(struct isp_lsc_addr));
+
+ isp_private->lsc_buf_phys_addr = lsc_addr.phys_addr;
+
+ printk("lsc phys addr 0x%x,\n",isp_private->lsc_buf_phys_addr);
+ return ret;
+}
+
+int32_t isp_k_cfg_2d_lsc(struct isp_io_param *param, struct isp_k_private *isp_private)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_2d_lsc: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_2d_lsc: property_param is null error.\n");
+ return -1;
+ }
+
+ switch(param->property) {
+ case ISP_PRO_2D_LSC_BLOCK:
+ ret = isp_k_2d_lsc_block(param, isp_private);
+ break;
+ case ISP_PRO_2D_LSC_PARAM_UPDATE:
+ ret = isp_k_2d_lsc_param_update(param, isp_private);
+ break;
+ case ISP_PRO_2D_LSC_POS:
+ ret = isp_k_2d_lsc_pos(param);
+ break;
+ case ISP_PRO_2D_LSC_GRID_SIZE:
+ ret = isp_k_2d_lsc_grid_size(param);
+ break;
+ case ISP_PRO_2D_LSC_SLICE_SIZE:
+ ret = isp_k_2d_lsc_slice_size(param);
+ break;
+ case ISP_PRO_2D_LSC_TRANSADDR:
+ ret = isp_k_2d_lsc_transaddr(param, isp_private);
+ break;
+ default:
+ printk("isp_k_cfg_2d_lsc: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_aca.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_aca.c
new file mode 100644
index 00000000..0d784c73
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_aca.c
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_aca_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ struct isp_dev_autocont_info_v1 autocont_info;
+ uint32_t val = 0;
+
+ memset(&autocont_info, 0x00, sizeof(autocont_info));
+
+ ret = copy_from_user((void *)&autocont_info, param->property_param, sizeof(autocont_info));
+ if (0 != ret) {
+ printk("isp_k_aca_block: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ val = ((autocont_info.out_max & 0xFF) << 24)
+ | ((autocont_info.out_min & 0xFF) << 16)
+ | ((autocont_info.in_max & 0xFF) << 8)
+ | (autocont_info.in_min & 0xFF);
+
+ REG_WR(ISP_AUTOCONT_MAX_MIN, val);
+
+ if (autocont_info.mode) {
+ REG_OWR(ISP_AUTOCONT_PARAM, BIT_1);
+ } else {
+ REG_MWR(ISP_AUTOCONT_PARAM, BIT_1, 0);
+ }
+
+ if (autocont_info.bypass) {
+ REG_OWR(ISP_AUTOCONT_PARAM, BIT_0);
+ } else {
+ REG_MWR(ISP_AUTOCONT_PARAM, BIT_0, 0);
+ }
+
+ return ret;
+}
+
+int32_t isp_k_cfg_aca(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_aca: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_aca: property_param is null error.\n");
+ return -1;
+ }
+
+ switch (param->property) {
+ case ISP_PRO_ACA_BLOCK:
+ ret = isp_k_aca_block(param);
+ break;
+ default:
+ printk("isp_k_cfg_aca: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_anti_flicker.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_anti_flicker.c
new file mode 100644
index 00000000..cadd5e36
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_anti_flicker.c
@@ -0,0 +1,155 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include <asm/cacheflush.h>
+#include "isp_reg.h"
+#include "isp_drv.h"
+
+static int32_t isp_k_afl_param_update(struct isp_k_private *isp_private)
+{
+ int32_t ret = 0;
+ uint32_t addr = 0;
+#ifndef CONFIG_64BIT
+ void *buf_ptr = (void *)isp_private->yiq_antiflicker_buf_addr;
+#endif
+ uint32_t buf_len = isp_private->yiq_antiflicker_len;
+
+ if((0x00 != isp_private->yiq_antiflicker_buf_addr) && (0x00 != isp_private->yiq_antiflicker_len)) {
+
+#ifndef CONFIG_64BIT
+ dmac_flush_range(buf_ptr, buf_ptr + buf_len);
+ outer_flush_range(__pa(buf_ptr), __pa(buf_ptr) + buf_len);
+#endif
+ addr = (uint32_t)__pa(isp_private->yiq_antiflicker_buf_addr);
+
+ printk("$$LHC:addr %lp yiq_antiflicker_buf_addr %lp\n", addr, (int *)isp_private->yiq_antiflicker_buf_addr);
+ REG_WR(ISP_ANTI_FLICKER_DDR_INIT_ADDR, addr);
+ }
+
+ return ret;
+}
+
+static int32_t isp_k_afl_statistic(struct isp_io_param *param, struct isp_k_private *isp_private)
+{
+ int32_t ret = 0;
+ int32_t i = 0;
+ int32_t *addr = NULL;
+ printk("$$LHC:isp_k_afl_statistic \n");
+ if((0x00 != isp_private->yiq_antiflicker_buf_addr) && (0x00 != param->property_param) \
+ && (0x00 != isp_private->yiq_antiflicker_len) ) {
+
+ ret = copy_to_user(param->property_param, isp_private->yiq_antiflicker_buf_addr, isp_private->yiq_antiflicker_len);
+ if (0 != ret) {
+ ret = -1;
+ printk("isp_k_afl_statistic: copy_to_user error, ret = 0x%x\n", (uint32_t)ret);
+ }
+ addr = isp_private->yiq_antiflicker_buf_addr;
+ for(i = 0;i < 20;i++) {
+ printk("$$LHC %p, 0x%x\n", addr, *addr++);
+ }
+ }
+}
+
+static int32_t isp_k_afl_bypass(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t bypass = 0;
+
+ ret = copy_from_user((void *)&bypass, param->property_param, sizeof(bypass));
+ if (0 != ret) {
+ printk("isp_k_afl_bypass: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+ printk("$$LHC:bypass %d \n", bypass);
+ if (bypass) {
+ REG_OWR(ISP_ANTI_FLICKER_PARAM0, BIT_0);
+ } else {
+ REG_MWR(ISP_ANTI_FLICKER_PARAM0, BIT_0, 0);
+ }
+
+ return ret;
+}
+
+
+static int32_t isp_k_anti_flicker_block(struct isp_io_param *param, struct isp_k_private *isp_private)
+{
+ int32_t ret = 0;
+ struct isp_dev_anti_flicker_info_v1 afl_info;
+
+ memset(&afl_info, 0x00, sizeof(afl_info));
+
+ ret = copy_from_user((void *)&afl_info, param->property_param, sizeof(afl_info));
+ if (0 != ret) {
+ printk("isp_k_anti_flicker_block: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_ANTI_FLICKER_PARAM0, BIT_0, afl_info.bypass);
+
+ REG_MWR(ISP_ANTI_FLICKER_PARAM0, BIT_1, afl_info.mode << 1);
+
+ REG_MWR(ISP_ANTI_FLICKER_PARAM0, 0xF << 2, afl_info.skip_frame_num << 2);
+
+ REG_MWR(ISP_ANTI_FLICKER_PARAM1, 0xF , afl_info.line_step);
+
+ REG_MWR(ISP_ANTI_FLICKER_PARAM1, 0xFF << 8, afl_info.frame_num << 8);
+
+ REG_MWR(ISP_ANTI_FLICKER_PARAM1, 0xFFFF << 16, afl_info.vheight << 16);
+
+ REG_MWR(ISP_ANTI_FLICKER_COL_POS, 0xFFFF , afl_info.start_col);
+
+ REG_MWR(ISP_ANTI_FLICKER_COL_POS, 0xFFFF << 16, afl_info.end_col << 16);
+
+ //config afl DDR initial address
+ isp_k_afl_param_update(isp_private);
+
+ //REG_WR(ISP_ANTI_FLICKER_DDR_INIT_ADDR, afl_info.addr);
+
+ return ret;
+}
+
+int32_t isp_k_cfg_anti_flicker(struct isp_io_param *param, struct isp_k_private *isp_private)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_anti_flicker: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_anti_flicker: property_param is null error.\n");
+ return -1;
+ }
+
+ switch (param->property) {
+ case ISP_PRO_ANTI_FLICKER_BLOCK:
+ ret = isp_k_anti_flicker_block(param, isp_private);
+ break;
+ case ISP_PRO_ANTI_FLICKER_STATISTIC:
+ ret = isp_k_afl_statistic(param, isp_private);
+ break;
+ case ISP_PRO_ANTI_FLICKER_BYPASS:
+ ret = isp_k_afl_bypass(param);
+ break;
+ default:
+ printk("isp_k_cfg_anti_flicker: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
+
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_arbiter.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_arbiter.c
new file mode 100644
index 00000000..4031b04e
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_arbiter.c
@@ -0,0 +1,177 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_arbiter_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ struct isp_dev_arbiter_info_v1 arbiter_info;
+ uint32_t val = 0;
+
+ memset(&arbiter_info, 0x00, sizeof(arbiter_info));
+
+ ret = copy_from_user((void *)&arbiter_info, param->property_param, sizeof(arbiter_info));
+ if (0 != ret) {
+ printk("isp_k_arbiter_block: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ val = ((arbiter_info.endian_ch0.bpc_endian & 0x3) << 8) | ((arbiter_info.endian_ch0.lens_endian & 0x3) << 6)
+ | ((arbiter_info.endian_ch0.store_endian & 0x3) << 4) | ((arbiter_info.endian_ch0.fetch_bit_reorder & 0x1) << 2)
+ | (arbiter_info.endian_ch0.fetch_endian & 0x3);
+ REG_WR(ISP_ARBITER_ENDIAN_CH0, val);
+
+ val = ((arbiter_info.endian_ch1.bpc_endian & 0x3) << 8) | ((arbiter_info.endian_ch1.lens_endian & 0x3) << 6)
+ | ((arbiter_info.endian_ch1.store_endian & 0x3) << 4) | ((arbiter_info.endian_ch1.fetch_bit_reorder & 0x1) << 2)
+ | (arbiter_info.endian_ch1.fetch_endian & 0x3);
+ REG_WR(ISP_ARBITER_ENDIAN_CH1, val);
+
+ val = (arbiter_info.para.pause_cycle & 0xFF) | ((arbiter_info.para.reset & 0x1) << 8);
+ REG_WR(ISP_ARBITER_PARAM, val);
+
+ return ret;
+}
+
+static int32_t isp_k_arbiter_wr_status(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t status = 0;
+
+ status = REG_RD(ISP_PRO_ARBITER_WR_STATUS);
+
+ ret = copy_to_user(param->property_param, (void*)&status, sizeof(status));
+ if (0 != ret) {
+ ret = -1;
+ printk("isp_k_arbiter_wr_status: copy_to_user error, ret = 0x%x\n", (uint32_t)ret);
+ }
+
+ return ret;
+}
+
+static int32_t isp_k_arbiter_rd_status(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t status = 0;
+
+ status = REG_RD(ISP_PRO_ARBITER_RD_STATUS);
+
+ ret = copy_to_user(param->property_param, (void*)&status, sizeof(status));
+ if (0 != ret) {
+ ret = -1;
+ printk("isp_k_arbiter_rd_status: copy_to_user error, ret = 0x%x\n", (uint32_t)ret);
+ }
+
+ return ret;
+}
+
+static int32_t isp_k_arbiter_endian_ch0(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ struct arbiter_endian_v1 endian = {0};
+
+ ret = copy_from_user((void *)&endian, param->property_param, sizeof(endian));
+ if (0 != ret) {
+ printk("isp_k_arbiter_endian_ch0: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ val = ((endian.bpc_endian & 0x3) << 8) | ((endian.lens_endian & 0x3) << 6) | ((endian.store_endian & 0x3) << 4)
+ | ((endian.fetch_bit_reorder & 0x1) << 2) | (endian.fetch_endian & 0x3);
+ REG_WR(ISP_ARBITER_ENDIAN_CH0, val);
+
+ return ret;
+}
+
+static int32_t isp_k_arbiter_endian_ch1(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ struct arbiter_endian_v1 endian = {0};
+
+ ret = copy_from_user((void *)&endian, param->property_param, sizeof(endian));
+ if (0 != ret) {
+ printk("isp_k_arbiter_endian_ch1: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ val = ((endian.bpc_endian & 0x3) << 8) | ((endian.lens_endian & 0x3) << 6) | ((endian.store_endian & 0x3) << 4)
+ | ((endian.fetch_bit_reorder & 0x1) << 2) | (endian.fetch_endian & 0x3);
+ REG_WR(ISP_ARBITER_ENDIAN_CH1, val);
+
+ return ret;
+}
+
+static int32_t isp_k_arbiter_param(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ struct arbiter_param_v1 para = {0};
+
+ ret = copy_from_user((void *)&para, param->property_param, sizeof(para));
+ if (0 != ret) {
+ printk("isp_k_arbiter_param: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ val = (para.pause_cycle & 0xFF) | ((para.reset & 0x1) << 8);
+ REG_WR(ISP_ARBITER_PARAM, val);
+
+ return ret;
+}
+
+int32_t isp_k_cfg_arbiter(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_arbiter: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_arbiter: property_param is null error.\n");
+ return -1;
+ }
+
+ switch (param->property) {
+ case ISP_PRO_ARBITER_BLOCK:
+ ret = isp_k_arbiter_block(param);
+ break;
+ case ISP_PRO_ARBITER_WR_STATUS:
+ ret = isp_k_arbiter_wr_status(param);
+ break;
+ case ISP_PRO_ARBITER_RD_STATUS:
+ ret = isp_k_arbiter_rd_status(param);
+ break;
+ case ISP_PRO_ARBITER_PARAM:
+ ret = isp_k_arbiter_param(param);
+ break;
+ case ISP_PRO_ARBITER_ENDIAN_CH0:
+ ret = isp_k_arbiter_endian_ch0(param);
+ break;
+ case ISP_PRO_ARBITER_ENDIAN_CH1:
+ ret = isp_k_arbiter_endian_ch1(param);
+ break;
+ default:
+ printk("isp_k_cfg_arbiter: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
+
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_awb.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_awb.c
new file mode 100644
index 00000000..3d9706b4
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_awb.c
@@ -0,0 +1,191 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+#include "isp_drv.h"
+
+static int32_t isp_k_awb_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ uint32_t i = 0;
+ struct isp_dev_awb_info_v2 awb_info;
+
+ ret = copy_from_user((void *)&awb_info, param->property_param, sizeof(awb_info));
+ if (0 != ret) {
+ printk("isp_k_awbm_bypass: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ //printk("isp_k_awb_block: %d %d %d %d \n",awb_info.slice_size.width,awb_info.slice_size.height,awb_info.block_size.width,awb_info.block_size.height);
+ //printk("isp_k_awb_block: gain r=%d gr=%d b=%d \n",awb_info.gain.r,awb_info.gain.gr,awb_info.gain.b);
+ //printk("isp_k_awb_block: offset r=%d gr=%d b=%d \n",awb_info.gain_offset.r,awb_info.gain_offset.gr,awb_info.gain_offset.b);
+ /*AWBM*/
+
+ REG_MWR(ISP_AWBM_PARAM, BIT_0, awb_info.awbm_bypass);
+
+ REG_MWR(ISP_AWBM_PARAM, BIT_1, awb_info.mode << 1);
+
+ val = (awb_info.skip_num & 0x0F) << 2;
+ REG_MWR(ISP_AWBM_PARAM, (BIT_5 | BIT_4 | BIT_3 | BIT_2), val);
+
+ val = ((awb_info.block_offset.y & 0xFFFF) << 16) | (awb_info.block_offset.x & 0xFFFF);
+ REG_WR(ISP_AWBM_BLOCK_OFFSET, val);
+
+ val = ((awb_info.block_size.height & 0x1FF) << 9) | (awb_info.block_size.width & 0x1FF);
+ REG_MWR(ISP_AWBM_BLOCK_SIZE, 0x1FFFF, val);
+
+ val = (awb_info.shift & 0x1F) << 18;
+ REG_MWR(ISP_AWBM_BLOCK_SIZE, (0x1F << 18), val);
+
+ REG_MWR(ISP_AWBM_PARAM, BIT_8, awb_info.thr_bypass << 8);
+
+ for (i = 0; i < 5; i++) {
+ val = ((awb_info.rect_pos.start_x[i] & 0x3FF) << 16) | (awb_info.rect_pos.start_y[i] & 0x3FF);
+ REG_WR(ISP_AWBM_WR_0_S + i * 8, val);
+ val = ((awb_info.rect_pos.end_x[i] & 0x3FF) << 16) | (awb_info.rect_pos.end_y[i] & 0x3FF);
+ REG_WR(ISP_AWBM_WR_0_E + i * 8, val);
+ }
+
+ for (i = 0; i < 5; i++) {
+ val = ((awb_info.circle_pos.x[i] & 0x3FF) << 18) | ((awb_info.circle_pos.y[i] & 0x3FF) << 8) | (awb_info.circle_pos.r[i] & 0xFF);
+ REG_WR(ISP_AWBM_NW_0_XYR + i * 4, val);
+ }
+
+ for (i = 0; i < 5; i++) {
+ val = ((awb_info.clctor_pos.start_x[i] & 0x3FF) << 16) | (awb_info.clctor_pos.start_y[i] & 0x3FF);
+ REG_WR(ISP_AWBM_CLCTOR_0_S + i * 8, val);
+ val = ((awb_info.clctor_pos.end_x[i] & 0x3FF) << 16) | (awb_info.clctor_pos.end_y[i] & 0x3FF);
+ REG_WR(ISP_AWBM_CLCTOR_0_E + i * 8, val);
+ }
+
+ val = ((awb_info.thr.g_low & 0x3FF) << 20) | ((awb_info.thr.r_high & 0x3FF) << 10) | (awb_info.thr.r_low & 0x3FF);
+ REG_WR(ISP_AWBM_THR_VALUE1, val);
+ val = ((awb_info.thr.b_high & 0x3FF) << 20) | ((awb_info.thr.b_low & 0x3FF) << 10) | (awb_info.thr.g_high & 0x3FF);
+ REG_WR(ISP_AWBM_THR_VALUE2, val);
+
+// val = ((awb_info.slice_size.height & 0xFFFF) << 16) | (awb_info.slice_size.width & 0xFFFF);
+// REG_WR(ISP_AEM_SLICE_SIZE, val);
+
+ REG_MWR(ISP_AWBM_PARAM, BIT_6, awb_info.skip_num_clear << 6);
+ REG_MWR(ISP_AWBM_POSITION_SEL, BIT_0, awb_info.position_sel);
+
+ REG_WR(ISP_AWBM_MEM_ADDR, awb_info.mem_addr);
+
+ /*AWBC*/
+
+ REG_MWR(ISP_AWBC_PARAM, BIT_0, awb_info.awbc_bypass);
+
+ REG_MWR(ISP_AWBC_PARAM, BIT_1, awb_info.alpha_bypass << 1);
+
+ val = (awb_info.alpha_value & 0x3FF) << 4;
+ REG_MWR(ISP_AWBC_PARAM, 0x3FF0, val);
+
+ REG_MWR(ISP_AWBC_PARAM, BIT_3, awb_info.buf_sel << 3);
+
+ val = ((awb_info.gain.b & 0x3FFF) << 16) | (awb_info.gain.r & 0x3FFF);
+ REG_WR(ISP_AWBC_GAIN0, val);
+ val = ((awb_info.gain.gb & 0x3FFF) << 16) | (awb_info.gain.gr & 0x3FFF);
+ REG_WR(ISP_AWBC_GAIN1, val);
+
+ val = ((awb_info.thrd.b & 0x3FF) << 20) | ((awb_info.thrd.g & 0x3FF) << 10) | (awb_info.thrd.r & 0x3FF);
+ REG_WR(ISP_AWBC_THRD, val);
+
+ val = ((awb_info.gain_offset.b & 0xFFFF) << 16) | (awb_info.gain_offset.r & 0xFFFF);
+ REG_WR(ISP_AWBC_OFFSET0, val);
+ val = ((awb_info.gain_offset.gb & 0xFFFF) << 16) | (awb_info.gain_offset.gr & 0xFFFF);
+ REG_WR(ISP_AWBC_OFFSET1, val);
+
+ val = ((awb_info.gain_buff.b & 0x3FFF) << 16) | (awb_info.gain_buff.r & 0x3FFF);
+ REG_WR(ISP_AWBC_GAIN0_BUF, val);
+ val = ((awb_info.gain_buff.gb & 0x3FFF) << 16) | (awb_info.gain_buff.gr & 0x3FFF);
+ REG_WR(ISP_AWBC_GAIN1_BUF, val);
+
+ val = ((awb_info.gain_offset_buff.b & 0xFFFF) << 16) | (awb_info.gain_offset_buff.r & 0xFFFF);
+ REG_WR(ISP_AWBC_OFFSET0_BUF, val);
+ val = ((awb_info.gain_offset_buff.gb & 0xFFFF) << 16) | (awb_info.gain_offset_buff.gr & 0xFFFF);
+ REG_WR(ISP_AWBC_OFFSET1_BUF, val);
+
+ return ret;
+}
+
+static int32_t isp_k_raw_awb_statistics(struct isp_io_param *param,
+ struct isp_k_private *isp_private)
+{
+ int32_t ret = 0, i = 0;
+ unsigned long addr = 0;
+ struct isp_raw_awbm_statistics *awbm_statistics = NULL;
+
+ awbm_statistics = (struct isp_raw_awbm_statistics *)isp_private->raw_awbm_buf_addr;
+ if (!awbm_statistics) {
+ ret = -1;
+ printk("isp_k_raw_awb_statistics: alloc memory error.\n");
+ return -1;
+ }
+
+ addr = ISP_RAW_AWBM_OUTPUT;
+
+ for (i = 0x00; i < ISP_RAW_AWBM_ITEM; i++) {
+ (awbm_statistics + i)->num4 = REG_RD(addr) >> 16;
+ (awbm_statistics + i)->num_t = REG_RD(addr) & 0xffff;
+ (awbm_statistics + i)->num2 = REG_RD(addr + 4) >> 16;
+ (awbm_statistics + i)->num3 = REG_RD(addr + 4) & 0xffff;
+ (awbm_statistics + i)->num0 = REG_RD(addr + 8) >> 16;
+ (awbm_statistics + i)->num1 = REG_RD(addr + 8) & 0xffff;
+ (awbm_statistics + i)->block_b = REG_RD(addr + 12);
+ (awbm_statistics + i)->block_g = REG_RD(addr + 16);
+ (awbm_statistics + i)->block_r = REG_RD(addr + 20);
+ addr += 32;
+ }
+
+ ret = copy_to_user(param->property_param, (void*)awbm_statistics, sizeof(struct isp_raw_awbm_statistics) * ISP_RAW_AWBM_ITEM);
+ if (0 != ret) {
+ ret = -1;
+ printk("isp_k_raw_awb_statistics: copy error, ret=0x%x\n", (uint32_t)ret);
+ }
+
+ return ret;
+}
+
+int32_t isp_k_cfg_awb(struct isp_io_param *param,
+ struct isp_k_private *isp_private)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_awb: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_awb: property_param is null error.\n");
+ return -1;
+ }
+
+ switch(param->property) {
+ case ISP_PRO_AWB_BLOCK:
+ ret = isp_k_awb_block(param);
+ break;
+ case ISP_PRO_AWBM_STATISTICS:
+ ret = isp_k_raw_awb_statistics(param, isp_private);
+ break;
+ default:
+ printk("isp_k_cfg_awb: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_bdn.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_bdn.c
new file mode 100644
index 00000000..9589b8c3
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_bdn.c
@@ -0,0 +1,121 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_bdn_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ uint32_t i = 0;
+ uint32_t j = 0;
+ struct isp_dev_bdn_info_v1 bdn_info;
+
+ memset(&bdn_info, 0x00, sizeof(bdn_info));
+
+ ret = copy_from_user((void *)&bdn_info, param->property_param, sizeof(bdn_info));
+ if (0 != ret) {
+ printk("isp_k_bdn_block: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_BDN_PARAM, BIT_1, bdn_info.radial_bypass << 1);
+
+ REG_MWR(ISP_BDN_PARAM, 0x7F0, bdn_info.addback << 4);
+
+ for (i = 0; i < 10; i++) {
+ REG_WR(ISP_BDN_DISWEI0_0 + 40 * i, bdn_info.dis[i][0]);
+
+ REG_WR(ISP_BDN_DISWEI0_1 + 40 * i, bdn_info.dis[i][1]);
+ }
+
+ for (i = 0; i < 10; i++) {
+ for (j = 0; j < 7; j++) {
+ REG_WR(ISP_BDN_RANWEI0_0 + i * 40 + j * 4, bdn_info.ran[i][j]);
+ }
+
+ REG_WR(ISP_BDN_RANWEI0_7 + i * 40, bdn_info.ran[i][7]);
+ }
+
+ val = ((bdn_info.offset_x & 0x1FFF) << 12) | (bdn_info.offset_y & 0xFFF);
+ REG_WR(ISP_BDN_1DLNC_CENTER, val);
+
+ val = bdn_info.squ_x2 & 0x3FFFFFF;
+ REG_WR(ISP_BDN_1DLNC_SQUARE_X, val);
+ val = bdn_info.squ_y2 & 0xFFFFFF;
+ REG_WR(ISP_BDN_1DLNC_SQUARE_Y, val);
+
+ val = ((bdn_info.coef2 & 0xFFFF) << 11) | (bdn_info.coef & 0x7FF);
+ REG_WR(ISP_BDN_1DLNC_P, val);
+
+ val = ((bdn_info.start_pos_x & 0x1FFF) << 12) | (bdn_info.start_pos_y & 0xFFF);
+ REG_WR(ISP_BDN_1DLNC_POS, val);
+
+ REG_WR(ISP_BDN_1DLNC_OFFSET, bdn_info.offset & 0x3FFFFFF);
+
+ REG_MWR(ISP_BDN_PARAM, BIT_0, bdn_info.bypass);
+
+ return ret;
+
+}
+
+static int32_t isp_k_bdn_1d_slice_size(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ struct isp_img_size size = {0, 0};
+ uint32_t val = 0;
+
+ ret = copy_from_user((void *)&size, param->property_param, sizeof(struct isp_img_size));
+ if (0 != ret) {
+ printk("isp_k_bdn_1d_slice_size: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ val = ((size.width & 0x1FFF) << 12) | (size.height & 0xFFF);
+ REG_WR(ISP_BDN_1DLNC_SIZE, val);
+
+ return ret;
+}
+
+int32_t isp_k_cfg_bdn(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_bdn: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_bdn: property_param is null error.\n");
+ return -1;
+ }
+
+ switch(param->property) {
+ case ISP_PRO_BDN_BLOCK:
+ ret = isp_k_bdn_block(param);
+ break;
+ case ISP_PRO_BDN_SLICE_SIZE:
+ ret = isp_k_bdn_1d_slice_size(param);
+ break;
+ default:
+ printk("isp_k_cfg_bdn: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
+
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_binning4awb.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_binning4awb.c
new file mode 100644
index 00000000..86778075
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_binning4awb.c
@@ -0,0 +1,231 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include <asm/cacheflush.h>
+#include "isp_reg.h"
+#include "isp_drv.h"
+
+static int32_t isp_k_binging_param_update(struct isp_k_private *isp_private)
+{
+ int32_t ret = 0;
+
+ /*config buf_id 0 as default*/
+ isp_private->b4awb_buf[0].buf_flag = 1;
+ REG_WR(ISP_BINNING_MEM_ADDR, isp_private->b4awb_buf[0].buf_phys_addr);
+
+ return ret;
+}
+
+static int32_t isp_k_binning_block(struct isp_io_param *param,
+ struct isp_k_private *isp_private)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ struct isp_dev_binning4awb_info_v1 binning_info;
+
+ ret = copy_from_user((void *)&binning_info, param->property_param, sizeof(binning_info));
+ if (0 != ret) {
+ printk("isp_k_binning_block: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ if (isp_private->b4awb_buf[0].buf_phys_addr == 0 || isp_private->b4awb_buf[1].buf_phys_addr == 0) {
+ REG_MWR(ISP_BINNING_PARAM, BIT_0, 0x1);
+ return ret;
+ }
+
+ isp_k_binging_param_update(isp_private);
+
+ val = (binning_info.burst_mode & 0x3) << 2;
+ REG_MWR(ISP_BINNING_PARAM, 0xC, val);
+
+ val = (binning_info.endian & 0x1) << 1;
+ REG_MWR(ISP_BINNING_PARAM, BIT_1, val);
+
+ val = (binning_info.mem_fifo_clr & 0x1) << 7;
+ REG_MWR(ISP_BINNING_PARAM, 0x80, val);
+
+ val = ((binning_info.hx & 0x7) << 4) | ((binning_info.vx & 0x7) << 8);
+ REG_MWR(ISP_BINNING_PARAM, 0x770, val);
+
+ REG_WR(ISP_BINNING_PITCH, binning_info.pitch);
+
+ REG_MWR(ISP_BINNING_PARAM, BIT_0, binning_info.bypass);
+
+ return ret;
+
+}
+
+static int32_t isp_k_binging_bypass(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t bypass = 0;
+ ret = copy_from_user((void *)&bypass, param->property_param, sizeof(uint32_t));
+ if (0 != ret) {
+ printk("isp_k_binning_scaling_ratio: copy_from_user error, ret = 0x%x\n",(uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_BINNING_PARAM, BIT_0, bypass);
+
+ return ret;
+}
+
+static int32_t isp_k_binning_scaling_ratio(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ struct isp_scaling_ratio scaling_ratio;
+ ret = copy_from_user((void *)&scaling_ratio, param->property_param, sizeof(struct isp_scaling_ratio));
+ if (0 != ret) {
+ printk("isp_k_binning_scaling_ratio: copy_from_user error, ret = 0x%x\n",(uint32_t)ret);
+ return -1;
+ }
+
+ val = ((scaling_ratio.vertical & 0x7)<< 8)| ((scaling_ratio.horizontal & 0x7) << 4);
+ REG_MWR(ISP_BINNING_PARAM, 0x770, val);
+
+ return ret;
+}
+
+static int32_t isp_k_binning_get_scaling_ratio(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ struct isp_scaling_ratio scaling_ratio;
+
+ val = REG_RD(ISP_BINNING_PARAM);
+
+ scaling_ratio.vertical= (val >> 8) & 0x7;
+ scaling_ratio.horizontal = (val >> 4) & 0x7;
+
+ ret = copy_to_user(param->property_param, (void *)&scaling_ratio, sizeof(struct isp_scaling_ratio));
+ if (0 != ret) {
+ ret = -1;
+ printk("isp_k_binning_get_scaling_ratio: copy error, ret=0x%x\n", (uint32_t)ret);
+ }
+
+ return ret;
+}
+
+static int32_t isp_k_binging_mem_addr(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t addr = 0;
+
+ ret = copy_from_user((void *)&addr, param->property_param, sizeof(uint32_t));
+ if (0 != ret) {
+ printk("isp_k_binning_scaling_ratio: copy_from_user error, ret = 0x%x\n",(uint32_t)ret);
+ return -1;
+ }
+
+ REG_WR(ISP_BINNING_MEM_ADDR, addr);
+
+ return ret;
+}
+
+static int32_t isp_k_binning_statistics_buf(struct isp_io_param *param,
+ struct isp_k_private *isp_private)
+{
+ int32_t ret = 0;
+ uint32_t buf_id = 0;
+
+ if (isp_private->b4awb_buf[0].buf_flag == 0) {
+ buf_id = isp_private->b4awb_buf[0].buf_id;
+ } else if (isp_private->b4awb_buf[1].buf_flag == 0) {
+ buf_id = isp_private->b4awb_buf[0].buf_id;
+ }
+
+ ret = copy_to_user(param->property_param, (void*)&buf_id, sizeof(uint32_t));
+ if (0 != ret) {
+ ret = -1;
+ printk("isp_k_binning_statistics_buf: copy error, ret=0x%x\n", (uint32_t)ret);
+ }
+
+ return ret;
+}
+
+static int32_t isp_k_binning_buffaddr(struct isp_io_param *param,
+ struct isp_k_private *isp_private)
+{
+ int32_t ret = 0;
+ int32_t i = 0;
+ unsigned long phys_addr[2];
+ struct isp_b4awb_phys phy_addr;
+
+ ret = copy_from_user((void *)&phy_addr, param->property_param, sizeof(struct isp_b4awb_phys));
+ if (0 != ret) {
+ ret = -1;
+ printk("isp_k_binning_buffaddr: copy error, ret=0x%x\n", (uint32_t)ret);
+ }
+
+ phys_addr[0] = phy_addr.phys0;
+ phys_addr[1] = phy_addr.phys1;
+
+ for (i = 0; i < ISP_BING4AWB_NUM; i++) {
+ isp_private->b4awb_buf[i].buf_id = i;
+ isp_private->b4awb_buf[i].buf_flag = 0;
+ isp_private->b4awb_buf[i].buf_phys_addr = phys_addr[i];
+ }
+
+ printk("phys_addr 0x%lx, 0x%lx\n",phys_addr[0], phys_addr[1]);
+
+ return ret;
+}
+
+int32_t isp_k_cfg_binning(struct isp_io_param *param, struct isp_k_private *isp_private)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_binning: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_binning: property_param is null error.\n");
+ return -1;
+ }
+
+ switch(param->property) {
+ case ISP_PRO_BINNING4AWB_BLOCK:
+ ret = isp_k_binning_block(param, isp_private);
+ break;
+ case ISP_PRO_BINNING4AWB_BYPASS:
+ ret = isp_k_binging_bypass(param);
+ break;
+ case ISP_PRO_BINNING4AWB_SCALING_RATIO:
+ ret = isp_k_binning_scaling_ratio(param);
+ break;
+ case ISP_PRO_BINNING4AWB_GET_SCALING_RATIO:
+ ret = isp_k_binning_get_scaling_ratio(param);
+ break;
+ case ISP_PRO_BINNING4AWB_MEM_ADDR:
+ ret = isp_k_binging_mem_addr(param);
+ break;
+ case ISP_PRO_BINNING4AWB_STATISTICS_BUF:
+ ret = isp_k_binning_statistics_buf(param, isp_private);
+ break;
+ case ISP_PRO_BINNING4AWB_TRANSADDR:
+ ret = isp_k_binning_buffaddr(param, isp_private);
+ break;
+ default:
+ printk("isp_k_cfg_binning: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_blc.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_blc.c
new file mode 100644
index 00000000..af18c2a7
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_blc.c
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_blc_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ struct isp_dev_blc_info blc_info;
+
+ ret = copy_from_user((void *)&blc_info, param->property_param, sizeof(blc_info));
+ if (0 != ret) {
+ printk("isp_k_blc_block: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ val = ((blc_info.b & 0x3FF) << 10) | (blc_info.r & 0x3FF);
+ REG_WR(ISP_BLC_B_PARAM_R_B, val);
+ val = ((blc_info.gb & 0x3FF) << 10) | (blc_info.gr & 0x3FF);
+ REG_WR(ISP_BLC_B_PARAM_G, val);
+
+ REG_MWR(ISP_BLC_PARAM, BIT_0, blc_info.bypass);
+
+ return ret;
+
+}
+
+int32_t isp_k_cfg_blc(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_blc: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_blc: property_param is null error.\n");
+ return -1;
+ }
+
+ switch(param->property) {
+ case ISP_PRO_BLC_BLOCK:
+ ret = isp_k_blc_block(param);
+ break;
+ default:
+ printk("isp_k_cfg_blc: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_bpc.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_bpc.c
new file mode 100644
index 00000000..29248946
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_bpc.c
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_bpc_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ uint32_t i = 0;
+ struct isp_dev_bpc_info_v1 bpc_info;
+
+ memset(&bpc_info, 0x00, sizeof(bpc_info));
+
+ ret = copy_from_user((void *)&bpc_info, param->property_param, sizeof(bpc_info));
+ if (0 != ret) {
+ printk("isp_k_bpc_block: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_BPC_PARAM, BIT_0, bpc_info.bypass);
+
+ REG_MWR(ISP_BPC_PARAM, BIT_1, bpc_info.pvd_bypass << 1);
+
+ REG_MWR(ISP_BPC_PARAM, BIT_4 | BIT_5, bpc_info.bpc_mode << 4);
+
+ REG_MWR(ISP_BPC_PARAM, BIT_10 | BIT_9 | BIT_8, bpc_info.mask_mode << 8);
+
+ val = ((bpc_info.kmax & 0x7) << 20) | ((bpc_info.kmin & 0x7) << 16);
+ REG_MWR(ISP_BPC_PARAM, 0x770000, val);
+
+ REG_MWR(ISP_BPC_NEW_OLD_SEL, BIT_0, bpc_info.new_old_sel);
+
+ REG_MWR(ISP_BPC_NEW_OLD_SEL, BIT_1, bpc_info.map_done_sel << 1);
+
+ val = ((bpc_info.safe_factor & 0x1F) << 4) | (bpc_info.flat_factor & 0x7);
+ REG_WR(ISP_BPC_FACTOR, val);
+
+ val = ((bpc_info.dead_coeff & 0x7) << 4) | (bpc_info.spike_coeff & 0x7);
+ REG_WR(ISP_BPC_COEFF, val);
+
+ for (i = 0; i < 8; i++) {
+ val = ((bpc_info.lut_level[i] & 0x3FF) << 20) | ((bpc_info.slope_k[i] & 0x3FF) << 10) | (bpc_info.intercept_b[i] & 0x3FF);
+ REG_WR(ISP_BPC_LUTWORD0 + i * 4, val);
+ }
+
+ REG_MWR(ISP_BPC_CFG, BIT_10 | BIT_9 | BIT_8, bpc_info.delta << 8);
+
+ REG_MWR(ISP_BPC_CFG, BIT_7, bpc_info.bpc_map_fifo_clr << 7);
+
+ REG_MWR(ISP_BPC_CFG, BIT_6 | BIT_5 | BIT_4, bpc_info.ktimes << 4);
+
+ REG_MWR(ISP_BPC_CFG, 0x7, bpc_info.cntr_threshold);
+
+ REG_MWR(ISP_BPC_CFG, BIT_3, bpc_info.bad_map_hw_fifo_clr_en << 3);
+
+ REG_WR(ISP_BPC_MAP_ADDR, bpc_info.bpc_map_addr_new);
+
+ REG_MWR(ISP_BPC_CFG, 0xFFFF0000, bpc_info.bad_pixel_num << 16);
+
+ return ret;
+}
+
+int32_t isp_k_cfg_bpc(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_bpc: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_bpc: property_param is null error.\n");
+ return -1;
+ }
+
+ switch(param->property) {
+ case ISP_PRO_BPC_BLOCK:
+ ret = isp_k_bpc_block(param);
+ break;
+ default:
+ printk("isp_k_cfg_bpc: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_brightness.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_brightness.c
new file mode 100644
index 00000000..4c649621
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_brightness.c
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_brightness_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ struct isp_dev_brightness_info brightness_info;
+
+ memset(&brightness_info, 0x00, sizeof(brightness_info));
+
+ ret = copy_from_user((void *)&brightness_info, param->property_param, sizeof(brightness_info));
+ if (0 != ret) {
+ printk("isp_k_brightness_block: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_BRIGHT_PARAM, 0x1FE, ((brightness_info.factor & 0xFF) << 1));
+
+ if (brightness_info.bypass) {
+ REG_OWR(ISP_BRIGHT_PARAM, BIT_0);
+ } else {
+ REG_MWR(ISP_BRIGHT_PARAM, BIT_0, 0);
+ }
+
+ return ret;
+}
+
+int32_t isp_k_cfg_brightness(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_brightness: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_brightness: property_param is null error.\n");
+ return -1;
+ }
+
+ switch(param->property) {
+ case ISP_PRO_BRIGHT_BLOCK:
+ ret = isp_k_brightness_block(param);
+ break;
+ default:
+ printk("isp_k_cfg_brightness: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_capability.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_capability.c
new file mode 100644
index 00000000..d5ce492d
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_capability.c
@@ -0,0 +1,195 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+#define ISP_MAX_WIDTH 3280
+#define ISP_MAX_HEIGHT 2464
+#define ISP_MAX_SLICE_WIDTH 3280
+#define ISP_MAX_SLICE_HEIGHT 2464
+#define ISP_AWB_WIN_UNIT 32
+#define ISP_AWB_DEFAULT_GAIN 0x400
+#define ISP_AF_MAX_WIN_NUM 9
+
+static int32_t isp_k_capability_chip_id(struct isp_capability *param)
+{
+ int32_t ret = 0;
+ uint32_t chip_id = 0;
+
+ chip_id = ISP_CHIP_ID_PIKE;
+
+ ret = copy_to_user(param->property_param, (void*)&chip_id, sizeof(chip_id));
+ if (0 != ret) {
+ ret = -1;
+ printk("isp_k_capability_chip_id: copy error, ret=0x%x\n", (uint32_t)ret);
+ }
+
+ return ret;
+}
+
+static int32_t isp_k_capability_single_size(struct isp_capability *param)
+{
+ int32_t ret = 0;
+ struct isp_img_size size = {0, 0};
+
+ size.width = ISP_MAX_WIDTH;
+ size.height = ISP_MAX_HEIGHT;
+
+ ret = copy_to_user(param->property_param, (void*)&size, sizeof(size));
+ if (0 != ret) {
+ ret = -1;
+ printk("isp_capability_single_size: copy error, ret=0x%x\n", (uint32_t)ret);
+ }
+
+ return ret;
+}
+
+static int32_t isp_k_capability_continue_size(struct isp_capability *param)
+{
+ int32_t ret = 0;
+ struct isp_img_size size = {0, 0};
+
+ size.width = ISP_MAX_SLICE_WIDTH;
+ size.height = ISP_MAX_SLICE_HEIGHT;
+
+ ret = copy_to_user(param->property_param, (void*)&size, sizeof(size));
+ if (0 != ret) {
+ ret = -1;
+ printk("isp_capability_continue_size: copy error, ret=0x%x\n", (uint32_t)ret);
+ }
+
+ return ret;
+}
+
+static int32_t isp_k_capability_awb_win(struct isp_capability *param)
+{
+ int32_t ret = 0;
+ struct isp_img_size size = {0, 0};
+
+ size.width = ISP_AWB_WIN_UNIT;
+ size.height = ISP_AWB_WIN_UNIT;
+
+ ret = copy_to_user(param->property_param, (void*)&size, sizeof(size));
+ if (0 != ret) {
+ ret = -1;
+ printk("isp_k_capability_awb_win: copy error, ret=0x%x\n", (uint32_t)ret);
+ }
+
+ return ret;
+}
+
+static int32_t isp_k_capability_awb_default_gain(struct isp_capability *param)
+{
+ int32_t ret = 0;
+ uint32_t gain = 0;
+
+ gain = ISP_AWB_DEFAULT_GAIN;
+
+ ret = copy_to_user(param->property_param, (void*)&gain, sizeof(gain));
+ if (0 != ret) {
+ ret = -1;
+ printk("isp_k_capability_awb_default_gain: copy error, ret=0x%x\n", (uint32_t)ret);
+ }
+
+ return ret;
+}
+
+static int32_t isp_k_capability_af_max_win_num(struct isp_capability *param)
+{
+ int32_t ret = 0;
+ uint32_t win_num = 0;
+
+ win_num = ISP_AF_MAX_WIN_NUM;
+
+ ret = copy_to_user(param->property_param, (void*)&win_num, sizeof(win_num));
+ if (0 != ret) {
+ ret = -1;
+ printk("isp_k_capability_af_max_win_num: copy error, ret=0x%x\n", (uint32_t)ret);
+ }
+
+ return ret;
+}
+
+static int32_t isp_k_capability_time(struct isp_capability *param)
+{
+ int32_t ret = 0;
+ struct isp_time time;
+ struct timespec ts;
+
+ ktime_get_ts(&ts);
+ time.sec = ts.tv_sec;
+ time.usec = ts.tv_nsec / NSEC_PER_USEC;
+
+ ret = copy_to_user(param->property_param, (void*)&time, sizeof(time));
+ if (0 != ret) {
+ ret = -1;
+ printk("isp_k_capability_time: copy error, ret=0x%x\n", (uint32_t)ret);
+ }
+
+ return ret;
+}
+
+int32_t isp_capability(void *param)
+{
+ int32_t ret = 0;
+ struct isp_capability cap_param = {0, 0, NULL};
+
+ if (!param) {
+ printk("isp_capability: param is null error.\n");
+ return -1;
+ }
+
+ ret = copy_from_user((void *)&cap_param, (void*)param, sizeof(cap_param));
+ if ( 0 != ret) {
+ printk("isp_capability: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ if (NULL == cap_param.property_param) {
+ printk("isp_capability: property_param is null error.\n");
+ return -1;
+ }
+
+ switch(cap_param.index) {
+ case ISP_CAPABILITY_CHIP_ID:
+ ret = isp_k_capability_chip_id(&cap_param);
+ break;
+ case ISP_CAPABILITY_SINGLE_SIZE:
+ ret = isp_k_capability_single_size(&cap_param);
+ break;
+ case ISP_CAPABILITY_CONTINE_SIZE:
+ ret = isp_k_capability_continue_size(&cap_param);
+ break;
+ case ISP_CAPABILITY_AWB_WIN:
+ ret = isp_k_capability_awb_win(&cap_param);
+ break;
+ case ISP_CAPABILITY_AWB_DEFAULT_GAIN:
+ ret = isp_k_capability_awb_default_gain(&cap_param);
+ break;
+ case ISP_CAPABILITY_AF_MAX_WIN_NUM:
+ ret = isp_k_capability_af_max_win_num(&cap_param);
+ break;
+ case ISP_CAPABILITY_TIME:
+ ret = isp_k_capability_time(&cap_param);
+ break;
+ default:
+ printk("isp_capability: fail cmd id:%d, not supported.\n", cap_param.index);
+ break;
+ }
+
+ return ret;
+}
+
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_cce.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_cce.c
new file mode 100644
index 00000000..06a84ab9
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_cce.c
@@ -0,0 +1,147 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_cce_block_uv(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ struct isp_dev_cce_uvd_info cce_uvd_info;
+
+ memset(&cce_uvd_info, 0x00, sizeof(cce_uvd_info));
+
+ ret = copy_from_user((void *)&cce_uvd_info, param->property_param, sizeof(cce_uvd_info));
+ if (0 != ret) {
+ printk("isp_k_cce_block_uv: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ val = (cce_uvd_info.lum_th_h_len & 0xF)
+ | ((cce_uvd_info.lum_th_h & 0xFF) << 8)
+ | ((cce_uvd_info.lum_th_l_len & 0xF) << 16)
+ | ((cce_uvd_info.lum_th_l & 0xFF) << 24);
+ REG_WR(ISP_CCE_UVD_PARAM0, val);
+
+ val = (cce_uvd_info.chroma_min_h & 0xFF)
+ | ((cce_uvd_info.chroma_min_l & 0xFF) << 8)
+ | ((cce_uvd_info.chroma_max_h & 0xFF) << 16)
+ | ((cce_uvd_info.chroma_max_l & 0xFF) << 24);
+ REG_WR(ISP_CCE_UVD_PARAM1, val);
+
+ val = (cce_uvd_info.u_th1_h & 0xFF)
+ | ((cce_uvd_info.u_th1_l & 0xFF) << 8)
+ | ((cce_uvd_info.u_th0_h & 0xFF) << 16)
+ | ((cce_uvd_info.u_th0_l & 0xFF) << 24);
+ REG_WR(ISP_CCE_UVD_PARAM2, val);
+
+ val = (cce_uvd_info.v_th1_h & 0xFF)
+ | ((cce_uvd_info.v_th1_l & 0xFF) << 8)
+ | ((cce_uvd_info.v_th0_h & 0xFF) << 16)
+ | ((cce_uvd_info.v_th0_l & 0xFF) << 24);
+ REG_WR(ISP_CCE_UVD_PARAM3, val);
+
+ val = (cce_uvd_info.ratio[7] & 0xF)
+ | ((cce_uvd_info.ratio[6] & 0xF) << 4)
+ | ((cce_uvd_info.ratio[5] & 0xF) << 8)
+ | ((cce_uvd_info.ratio[4] & 0xF) << 12)
+ | ((cce_uvd_info.ratio[3] & 0xF) << 16)
+ | ((cce_uvd_info.ratio[2] & 0xF) << 20)
+ | ((cce_uvd_info.ratio[1] & 0xF) << 24)
+ | ((cce_uvd_info.ratio[0] & 0xF) << 28);
+ REG_WR(ISP_CCE_UVD_PARAM4, val);
+
+ val = (cce_uvd_info.base & 0xF)
+ | ((cce_uvd_info.ratio[8] & 0xF) << 8);
+ REG_WR(ISP_CCE_UVD_PARAM5, val);
+
+ REG_MWR(ISP_CCE_PARAM, BIT_0, cce_uvd_info.uvdiv_bypass);
+
+ return ret;
+}
+
+static int32_t isp_k_cce_block_matrix(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ uint32_t val1 = 0;
+ struct isp_dev_cce_info_v1 cce_info;
+
+ memset(&cce_info, 0x00, sizeof(cce_info));
+
+ ret = copy_from_user((void *)&cce_info, param->property_param, sizeof(cce_info));
+ if (0 != ret) {
+ printk("isp_k_cce_block_matrix: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ val = ((cce_info.matrix[1] & 0x7FF) << 11) | (cce_info.matrix[0] & 0x7FF);
+ val1 = ((cce_info.matrix[3] & 0x7FF) << 11) | (cce_info.matrix[2] & 0x7FF);
+ if ((0 == val)
+ || (0 == val1)) {
+ printk("isp_k_cce_block_matrix: copy error, 0x%x, 0x%x, 0x%x, 0x%x\n", cce_info.matrix[0], cce_info.matrix[1], cce_info.matrix[2], cce_info.matrix[3]);
+ return ret;
+ }
+
+ REG_MWR(ISP_CCE_PARAM, BIT_1, cce_info.mode << 1);
+
+ val = ((cce_info.matrix[1] & 0x7FF) << 11) | (cce_info.matrix[0] & 0x7FF);
+ REG_WR(ISP_CCE_MATRIX0, val);
+ val = ((cce_info.matrix[3] & 0x7FF) << 11) | (cce_info.matrix[2] & 0x7FF);
+ REG_WR(ISP_CCE_MATRIX1, val);
+ val = ((cce_info.matrix[5] & 0x7FF) << 11) | (cce_info.matrix[4] & 0x7FF);
+ REG_WR(ISP_CCE_MATRIX2, val);
+ val = ((cce_info.matrix[7] & 0x7FF) << 11) | (cce_info.matrix[6] & 0x7FF);
+ REG_WR(ISP_CCE_MATRIX3, val);
+ val = cce_info.matrix[8] & 0x7FF;
+ REG_WR(ISP_CCE_MATRIX4, val);
+
+ val = (cce_info.y_offset & 0x1FF) | ((cce_info.u_offset & 0x1FF) << 9)
+ | ((cce_info.v_offset & 0x1FF) << 18);
+ REG_WR(ISP_CCE_SHIFT, (val & 0x7FFFFFF));
+
+ return ret;
+}
+
+int32_t isp_k_cfg_cce(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_cce: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_cce: property_param is null error.\n");
+ return -1;
+ }
+
+ switch(param->property) {
+ case ISP_PRO_CCE_BLOCK_MATRIX:
+ ret = isp_k_cce_block_matrix(param);
+ break;
+ case ISP_PRO_CCE_BLOCK_UV:
+ ret = isp_k_cce_block_uv(param);
+ break;
+ default:
+ printk("isp_k_cfg_cce: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_cdn.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_cdn.c
new file mode 100644
index 00000000..e8b8e716
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_cdn.c
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_yuv_cdn_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ struct isp_dev_yuv_cdn_info cdn_info;
+ uint32_t val = 0;
+ uint32_t i = 0;
+
+ memset(&cdn_info, 0x00, sizeof(cdn_info));
+
+ ret = copy_from_user((void *)&cdn_info, param->property_param, sizeof(cdn_info));
+ if (0 != ret) {
+ printk("isp_k_yuv_cdn_block: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ if (cdn_info.median_writeback_en) {
+ REG_OWR(ISP_CDN_PARAM, BIT_2);
+ } else {
+ REG_MWR(ISP_CDN_PARAM, BIT_2, 0);
+ }
+
+ REG_MWR(ISP_CDN_PARAM, 0x38, cdn_info.median_mode << 3);
+
+ REG_MWR(ISP_CDN_PARAM, BIT_7 | BIT_6, cdn_info.gaussian_mode << 6);
+
+ REG_MWR(ISP_CDN_PARAM, 0x3FFF00, cdn_info.median_thr << 8);
+
+ val = (cdn_info.median_thru0 & 0x7F) | ((cdn_info.median_thru1 & 0xFF) << 8)
+ | ((cdn_info.median_thrv0 & 0x7F) << 16) | ((cdn_info.median_thrv1 & 0xFF) << 24);
+ REG_WR(ISP_CDN_THRUV, val);
+
+ for (i = 0; i < 7; i++) {
+ val = (cdn_info.rangewu[i*4] & 0x3F) | ((cdn_info.rangewu[i*4+1] & 0x3F) << 8)
+ | ((cdn_info.rangewu[i*4+2] & 0x3F) << 16) | ((cdn_info.rangewu[i*4+3] & 0x3F) << 24);
+ REG_WR(ISP_CDN_U_RANWEI_0 + i * 4, val);
+ }
+
+ val = (cdn_info.rangewu[28] & 0x3F) | ((cdn_info.rangewu[29] & 0x3F) << 8)
+ | ((cdn_info.rangewu[30] & 0x3F) << 16);
+ REG_WR(ISP_CDN_U_RANWEI_7, val);
+
+ for (i = 0; i < 7; i++) {
+ val = (cdn_info.rangewv[i*4] & 0x3F) | ((cdn_info.rangewv[i*4+1] & 0x3F) << 8)
+ | ((cdn_info.rangewv[i*4+2] & 0x3F) << 16) | ((cdn_info.rangewv[i*4+3] & 0x3F) << 24);
+ REG_WR(ISP_CDN_V_RANWEI_0 + i * 4, val);
+ }
+
+ val = (cdn_info.rangewv[28] & 0x3F) | ((cdn_info.rangewv[29] & 0x3F) << 8)
+ | ((cdn_info.rangewv[30] & 0x3F) << 16);
+ REG_WR(ISP_CDN_V_RANWEI_7, val);
+
+ if (cdn_info.filter_bypass) {
+ REG_OWR(ISP_CDN_PARAM, BIT_1);
+ } else {
+ REG_MWR(ISP_CDN_PARAM, BIT_1, 0);
+ }
+
+ if (cdn_info.bypass) {
+ REG_OWR(ISP_CDN_PARAM, BIT_0);
+ } else {
+ REG_MWR(ISP_CDN_PARAM, BIT_0, 0);
+ }
+
+ return ret;
+}
+
+int32_t isp_k_cfg_yuv_cdn(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_yuv_cdn: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_yuv_cdn: property_param is null error.\n");
+ return -1;
+ }
+
+ switch(param->property) {
+ case ISP_PRO_YUV_CDN_BLOCK:
+ ret = isp_k_yuv_cdn_block(param);
+ break;
+ default:
+ printk("isp_k_cfg_yuv_cdn: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_cfa.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_cfa.c
new file mode 100644
index 00000000..ceeed46a
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_cfa.c
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_cfa_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ struct isp_dev_cfa_info_v1 cfa_info;
+
+ memset(&cfa_info, 0x00, sizeof(cfa_info));
+
+ ret = copy_from_user((void *)&cfa_info, param->property_param, sizeof(cfa_info));
+ if (0 != ret) {
+ printk("isp_k_cfa_block: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_CFAE_EE_CFG0, BIT_0, cfa_info.bypass);
+
+ REG_MWR(ISP_CFAE_EE_CFG0, 0xF<<28, cfa_info.grid_gain << 28);
+
+ REG_MWR(ISP_CFAE_EE_CFG0, 0x3<<24, cfa_info.avg_mode << 24);
+
+ REG_MWR(ISP_CFAE_EE_CFG0, 0xFFF<<12, cfa_info.gbuf_addr_max << 12);
+
+ REG_MWR(ISP_CFAE_EE_CFG0, BIT_1, cfa_info.ee_bypass << 1);
+
+ REG_MWR(ISP_CFAE_EE_CFG0, 0x3F<<4, cfa_info.doee_base << 4);
+
+ REG_MWR(ISP_CFAE_EE_CFG1, 0xF<<16, cfa_info.inter_chl_gain << 16);
+
+ val = (cfa_info.cfa_uni_dir_intplt_tr & 0xFFFF) | ((cfa_info.cfai_ee_uni_dir_tr & 0xFFFF) << 16);
+ REG_WR(ISP_CFAE_THRD_0,val);
+ val = (cfa_info.cfai_ee_edge_tr & 0xFFF) | ((cfa_info.cfai_ee_diagonal_tr & 0xFFF) << 16);
+ REG_WR(ISP_CFAE_THRD_1,val);
+ val =(cfa_info.cfai_ee_grid_tr & 0xFFF) | ((cfa_info.cfai_doee_clip_tr & 0x3F) << 12)
+ | ((cfa_info.cfai_ee_saturation_level & 0x3FF) << 22);
+ REG_WR(ISP_CFAE_THRD_2,val);
+ val = (cfa_info.plt_diff_tr & 0xFFFF) | ((cfa_info.grid_min_tr & 0xFFFF) << 16);
+ REG_WR(ISP_CFAE_THRD_3,val);
+ val = (cfa_info.strength_tr_neg & 0xFFFF) | ((cfa_info.strength_tr_pos & 0xFFFF) << 16);
+ REG_WR(ISP_CFAE_THRD_4,val);
+ REG_MWR(ISP_CFAE_EE_CFG1, 0x3F, cfa_info.ee_strength_neg);
+ REG_MWR(ISP_CFAE_EE_CFG1, 0x3F << 8, cfa_info.ee_strength_pos << 8);
+
+ return ret;
+}
+
+int32_t isp_k_cfg_cfa(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_cfa: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_cfa: property_param is null error.\n");
+ return -1;
+ }
+
+ switch(param->property) {
+ case ISP_PRO_CFA_BLOCK:
+ ret = isp_k_cfa_block(param);
+ break;
+ default:
+ printk("isp_k_cfg_cfa: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
+
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_cmc10.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_cmc10.c
new file mode 100644
index 00000000..8c127c9a
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_cmc10.c
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_cmc10_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ struct isp_dev_cmc10_info cmc10_info;
+
+ memset(&cmc10_info, 0x00, sizeof(cmc10_info));
+
+ ret = copy_from_user((void *)&cmc10_info, param->property_param, sizeof(cmc10_info));
+ if (0 != ret) {
+ printk("isp_k_cmc10_block: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_CMC10_PARAM, BIT_0, cmc10_info.bypass);
+
+ REG_MWR(ISP_CMC10_PARAM, BIT_3, cmc10_info.buf_sel << 3);
+
+ REG_MWR(ISP_CMC10_PARAM, 0x3FF << 4, cmc10_info.alpha << 4);
+
+ REG_MWR(ISP_CMC10_PARAM, BIT_1, cmc10_info.alpha_bypass << 1);
+
+ val = ((cmc10_info.matrix.val[1] & 0x3FFF) << 14) | (cmc10_info.matrix.val[0] & 0x3FFF);
+ REG_WR(ISP_CMC10_MATRIX0, val);
+ val = ((cmc10_info.matrix.val[3] & 0x3FFF) << 14) | (cmc10_info.matrix.val[2] & 0x3FFF);
+ REG_WR((ISP_CMC10_MATRIX0 + 4), val);
+ val = ((cmc10_info.matrix.val[5] & 0x3FFF) << 14) | (cmc10_info.matrix.val[4] & 0x3FFF);
+ REG_WR((ISP_CMC10_MATRIX0 + 8), val);
+ val = ((cmc10_info.matrix.val[7] & 0x3FFF) << 14) | (cmc10_info.matrix.val[6] & 0x3FFF);
+ REG_WR((ISP_CMC10_MATRIX0 + 12), val);
+ val = cmc10_info.matrix.val[8] & 0x3FFF;
+ REG_WR((ISP_CMC10_MATRIX0 + 16), val);
+
+ val = ((cmc10_info.matrix_buf.val[1] & 0x3FFF) << 14) | (cmc10_info.matrix_buf.val[0] & 0x3FFF);
+ REG_WR(ISP_CMC10_MATRIX0_BUF, val);
+ val = ((cmc10_info.matrix_buf.val[3] & 0x3FFF) << 14) | (cmc10_info.matrix_buf.val[2] & 0x3FFF);
+ REG_WR((ISP_CMC10_MATRIX0_BUF + 4), val);
+ val = ((cmc10_info.matrix_buf.val[5] & 0x3FFF) << 14) | (cmc10_info.matrix_buf.val[4] & 0x3FFF);
+ REG_WR((ISP_CMC10_MATRIX0_BUF + 8), val);
+ val = ((cmc10_info.matrix_buf.val[7] & 0x3FFF) << 14) | (cmc10_info.matrix_buf.val[6] & 0x3FFF);
+ REG_WR((ISP_CMC10_MATRIX0_BUF + 12), val);
+ val = cmc10_info.matrix_buf.val[8] & 0x3FFF;
+ REG_WR((ISP_CMC10_MATRIX0_BUF + 16), val);
+
+ return ret;
+
+}
+
+int32_t isp_k_cfg_cmc10(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_cmc: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_cmc: property_param is null error.\n");
+ return -1;
+ }
+
+ switch(param->property) {
+ case ISP_PRO_CMC_BLOCK:
+ ret = isp_k_cmc10_block(param);
+ break;
+ default:
+ printk("isp_k_cfg_cmc: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
+
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_cmc8.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_cmc8.c
new file mode 100644
index 00000000..35121772
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_cmc8.c
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_cmc8_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ struct isp_dev_cmc8_info_v1 cmc8_info;
+
+ memset(&cmc8_info, 0x00, sizeof(cmc8_info));
+
+ ret = copy_from_user((void *)&cmc8_info, param->property_param, sizeof(cmc8_info));
+ if (0 != ret) {
+ printk("isp_k_cmc8_block: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_CMC8_PARAM, BIT_0, cmc8_info.bypass);
+
+ REG_MWR(ISP_CMC8_PARAM, BIT_3, cmc8_info.buf_sel << 3);
+
+ REG_MWR(ISP_CMC8_PARAM, 0x3FF << 4, cmc8_info.alpha << 4);
+
+ REG_MWR(ISP_CMC8_PARAM, BIT_1, cmc8_info.alpha_bypass << 1);
+
+ val = ((cmc8_info.matrix.val[1] & 0x3FFF) << 14) | (cmc8_info.matrix.val[0] & 0x3FFF);
+ REG_WR(ISP_CMC8_MATRIX0, val);
+ val = ((cmc8_info.matrix.val[3] & 0x3FFF) << 14) | (cmc8_info.matrix.val[2] & 0x3FFF);
+ REG_WR((ISP_CMC8_MATRIX0 + 4), val);
+ val = ((cmc8_info.matrix.val[5] & 0x3FFF) << 14) | (cmc8_info.matrix.val[4] & 0x3FFF);
+ REG_WR((ISP_CMC8_MATRIX0 + 8), val);
+ val = ((cmc8_info.matrix.val[7] & 0x3FFF) << 14) | (cmc8_info.matrix.val[6] & 0x3FFF);
+ REG_WR((ISP_CMC8_MATRIX0 + 12), val);
+ val = cmc8_info.matrix.val[8] & 0x3FFF;
+ REG_WR((ISP_CMC8_MATRIX0 + 16), val);
+
+ val = ((cmc8_info.matrix_buf.val[1] & 0x3FFF) << 14) | (cmc8_info.matrix_buf.val[0] & 0x3FFF);
+ REG_WR(ISP_CMC8_MATRIX0_BUF, val);
+ val = ((cmc8_info.matrix_buf.val[3] & 0x3FFF) << 14) | (cmc8_info.matrix_buf.val[2] & 0x3FFF);
+ REG_WR((ISP_CMC8_MATRIX0_BUF + 4), val);
+ val = ((cmc8_info.matrix_buf.val[5] & 0x3FFF) << 14) | (cmc8_info.matrix_buf.val[4] & 0x3FFF);
+ REG_WR((ISP_CMC8_MATRIX0_BUF + 8), val);
+ val = ((cmc8_info.matrix_buf.val[7] & 0x3FFF) << 14) | (cmc8_info.matrix_buf.val[6] & 0x3FFF);
+ REG_WR((ISP_CMC8_MATRIX0_BUF + 12), val);
+ val = cmc8_info.matrix_buf.val[8] & 0x3FFF;
+ REG_WR((ISP_CMC8_MATRIX0_BUF + 16), val);
+
+ return ret;
+}
+
+int32_t isp_k_cfg_cmc8(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_cmc: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_cmc: property_param is null error.\n");
+ return -1;
+ }
+
+ switch(param->property) {
+ case ISP_PRO_CMC8_BLOCK:
+ ret = isp_k_cmc8_block(param);
+ break;
+ default:
+ printk("isp_k_cfg_cmc: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
+
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_common.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_common.c
new file mode 100644
index 00000000..336f173a
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_common.c
@@ -0,0 +1,411 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_common_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ struct isp_dev_common_info_v2 common_info;
+
+ memset(&common_info, 0x00, sizeof(common_info));
+
+ ret = copy_from_user((void *)&common_info, param->property_param, sizeof(common_info));
+ if (0 != ret) {
+ printk("isp_k_common_block: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_COMMON_CTRL_CH0, 3, common_info.fetch_sel_0);
+ REG_MWR(ISP_COMMON_CTRL_CH0, 3 << 4, common_info.sizer_sel_0 << 4);
+ REG_MWR(ISP_COMMON_CTRL_CH0, 3 << 16, common_info.store_sel_0 << 16);
+ REG_MWR(ISP_COMMON_CTRL_CH0, 3 << 2, common_info.fetch_sel_1);
+ REG_MWR(ISP_COMMON_CTRL_CH0, 3 << 6, common_info.sizer_sel_1);
+ REG_MWR(ISP_COMMON_CTRL_CH0, 3 << 18, common_info.store_sel_1);
+ //REG_MWR(ISP_COMMON_CTRL_CH1, 3, common_info.fetch_sel_1);
+ //REG_MWR(ISP_COMMON_CTRL_CH1, 3 << 4, common_info.sizer_sel_1 << 4);
+ //REG_MWR(ISP_COMMON_CTRL_CH1, 3 << 16, common_info.store_sel_1 << 16);
+ REG_MWR(ISP_COMMON_SPACE_SEL, 3 , common_info.fetch_color_format) ;
+ REG_MWR(ISP_COMMON_SPACE_SEL, 3 << 2, common_info.store_color_format << 2) ;
+ //REG_MWR(ISP_COMMON_CTRL_AWBM, BIT_0 , common_info.awbm_pos) ;
+ //REG_MWR(ISP_COMMON_3A_CTRL0, 3, common_info.y_afm_pos_0);
+ //REG_MWR(ISP_COMMON_3A_CTRL0, 3 << 4, common_info.y_aem_pos_0 << 4);
+ //REG_MWR(ISP_COMMON_3A_CTRL1, 3, common_info.y_afm_pos_1);
+ //REG_MWR(ISP_COMMON_3A_CTRL1, 3 << 4, common_info.y_aem_pos_1 << 4);
+
+ REG_MWR(ISP_COMMON_LBUF_OFFSET, 0xFFFF, 0x460);
+ //REG_WR(ISP_COMMON_LBUF_OFFSET0, ((common_info.lbuf_off.cfae_lbuf_offset & 0xFFFF) << 16 ) | (common_info.lbuf_off.comm_lbuf_offset & 0xFFFF));
+ //REG_WR(ISP_COMMON_LBUF_OFFSET1, ((common_info.lbuf_off.ydly_lbuf_offset& 0xFFFF) << 16 ) | (common_info.lbuf_off.awbm_lbuf_offset & 0xFFFF));
+
+ return ret;
+}
+
+static int32_t isp_k_common_version(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t version = 0;
+
+ version = REG_RD(ISP_COMMON_VERSION);
+
+ ret = copy_to_user(param->property_param, (void*)&version, sizeof(version));
+ if (0 != ret) {
+ ret = -1;
+ printk("isp_k_common_version: copy_to_user error, ret = 0x%x\n", (uint32_t)ret);
+ }
+
+ return ret;
+}
+
+static int32_t isp_k_common_status0(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t status = 0;
+
+ status = REG_RD(ISP_COMMON_STATUS0);
+
+ ret = copy_to_user(param->property_param, (void*)&status, sizeof(status));
+ if (0 != ret) {
+ ret = -1;
+ printk("isp_k_common_status0: copy_to_user error, ret = 0x%x\n", (uint32_t)ret);
+ }
+
+ return ret;
+}
+
+static int32_t isp_k_common_status1(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t status = 0;
+
+ status = REG_RD(ISP_COMMON_STATUS1);
+
+ ret = copy_to_user(param->property_param, (void*)&status, sizeof(status));
+ if (0 != ret) {
+ ret = -1;
+ printk("isp_k_common_status1: copy_to_user error, ret = 0x%x\n", (uint32_t)ret);
+ }
+
+ return ret;
+}
+
+static int32_t isp_k_common_channel0_fetch_sel(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t fetch_sel = 0;
+
+ ret = copy_from_user((void *)&fetch_sel, param->property_param, sizeof(fetch_sel));
+ if (0 != ret) {
+ printk("isp_k_channel0_fetch_sel: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_COMMON_CTRL_CH0, 3, fetch_sel);
+
+ return ret;
+}
+
+static int32_t isp_k_common_channel0_sizer_sel(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t sizer_sel = 0;
+
+ ret = copy_from_user((void *)&sizer_sel, param->property_param, sizeof(sizer_sel));
+ if (0 != ret) {
+ printk("isp_k_channel0_sizer_sel: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_COMMON_CTRL_CH0, 3 << 4, sizer_sel << 4);
+
+ return ret;
+}
+
+static int32_t isp_k_common_channel0_store_sel(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t store_sel = 0;
+
+ ret = copy_from_user((void *)&store_sel, param->property_param, sizeof(store_sel));
+ if (0 != ret) {
+ printk("isp_k_common_channel0_store_sel: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_COMMON_CTRL_CH0, 3 << 16, store_sel << 16);
+
+ return ret;
+}
+
+static int32_t isp_k_common_channel1_fetch_sel(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t fetch_sel = 0;
+
+ ret = copy_from_user((void *)&fetch_sel, param->property_param, sizeof(fetch_sel));
+ if (0 != ret) {
+ printk("isp_k_channel1_fetch_sel: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+ REG_MWR(ISP_COMMON_CTRL_CH0, 3 << 2, fetch_sel << 2);
+
+// REG_MWR(ISP_COMMON_CTRL_CH1, 3, fetch_sel);
+
+ return ret;
+}
+
+static int32_t isp_k_common_channel1_sizer_sel(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t sizer_sel = 0;
+
+ ret = copy_from_user((void *)&sizer_sel, param->property_param, sizeof(sizer_sel));
+ if (0 != ret) {
+ printk("isp_k_common_channel1_sizer_sel: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+ REG_MWR(ISP_COMMON_CTRL_CH0, 3 << 6, sizer_sel << 6);
+
+ //REG_MWR(ISP_COMMON_CTRL_CH1, 3 << 4, sizer_sel << 4);
+
+ return ret;
+}
+
+static int32_t isp_k_common_channel1_store_sel(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t store_sel = 0;
+
+ ret = copy_from_user((void *)&store_sel, param->property_param, sizeof(store_sel));
+ if (0 != ret) {
+ printk("isp_k_common_channel1_store_sel: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+ REG_MWR(ISP_COMMON_CTRL_CH0, 3 << 18, store_sel << 18);
+
+// REG_MWR(ISP_COMMON_CTRL_CH1, 3 << 16, store_sel << 16);
+
+ return ret;
+}
+
+static int32_t isp_k_common_fetch_color_space_sel(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t color_space = 0;
+
+ ret = copy_from_user((void *)&color_space, param->property_param, sizeof(color_space));
+ if (0 != ret) {
+ printk("isp_k_common_fetch_color_space_sel: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_COMMON_SPACE_SEL, 3 , color_space) ;
+
+ return ret;
+}
+
+static int32_t isp_k_common_store_color_space_sel(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t color_space = 0;
+
+ ret = copy_from_user((void *)&color_space, param->property_param, sizeof(color_space));
+ if (0 != ret) {
+ printk("isp_k_common_store_color_space_sel: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_COMMON_SPACE_SEL, 3 << 2, color_space << 2) ;
+
+ return ret;
+}
+
+static int32_t isp_k_common_awbm_pos_sel(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t awbm_pos = 0;
+
+ ret = copy_from_user((void *)&awbm_pos, param->property_param, sizeof(awbm_pos));
+ if (0 != ret) {
+ printk("isp_k_common_awbm_pos_sel: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ //REG_MWR(ISP_COMMON_CTRL_AWBM, BIT_0 , awbm_pos) ;
+
+ return ret;
+}
+
+static int32_t isp_k_common_channel0_y_afm_pos(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t position = 0;
+
+ ret = copy_from_user((void *)&position, param->property_param, sizeof(position));
+ if (0 != ret) {
+ printk("isp_k_common_channel0_y_afm_pos: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+// REG_MWR(ISP_COMMON_3A_CTRL0, 3, position);
+
+ return ret;
+}
+
+static int32_t isp_k_common_channel0_y_aem_pos(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t position = 0;
+
+ ret = copy_from_user((void *)&position, param->property_param, sizeof(position));
+ if (0 != ret) {
+ printk("isp_k_common_channel0_y_aem_pos: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+// REG_MWR(ISP_COMMON_3A_CTRL0, 3 << 4, position << 4);
+
+ return ret;
+}
+
+static int32_t isp_k_common_channel1_y_afm_pos(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t position = 0;
+
+ ret = copy_from_user((void *)&position, param->property_param, sizeof(position));
+ if (0 != ret) {
+ printk("isp_k_common_channel1_y_afm_pos: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+// REG_MWR(ISP_COMMON_3A_CTRL1, 3, position);
+
+ return ret;
+}
+
+static int32_t isp_k_common_channel1_y_aem_pos(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t position = 0;
+
+ ret = copy_from_user((void *)&position, param->property_param, sizeof(position));
+ if (0 != ret) {
+ printk("isp_k_common_channel1_y_aem_pos: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+// REG_MWR(ISP_COMMON_3A_CTRL1, 3 << 4, position << 4);
+
+ return ret;
+}
+
+static int32_t isp_k_common_lbuf_offset(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t lbuf_off;
+
+ memset(&lbuf_off, 0x00, sizeof(lbuf_off));
+ ret = copy_from_user((void *)&lbuf_off, param->property_param, sizeof(lbuf_off));
+ if (0 != ret) {
+ printk("isp_k_common_lbuf_offset: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+
+ REG_MWR(ISP_COMMON_LBUF_OFFSET, 0xFFFF, lbuf_off);
+
+// REG_WR(ISP_COMMON_LBUF_OFFSET0, ((lbuf_off.cfae_lbuf_offset & 0xFFFF) << 16 ) | (lbuf_off.comm_lbuf_offset & 0xFFFF));
+// REG_WR(ISP_COMMON_LBUF_OFFSET1, ((lbuf_off.ydly_lbuf_offset& 0xFFFF) << 16 ) | (lbuf_off.awbm_lbuf_offset & 0xFFFF));
+
+ return ret;
+}
+
+int32_t isp_k_cfg_common(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_common: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_common: property_param is null error.\n");
+ return -1;
+ }
+
+ switch (param->property) {
+ case ISP_PRO_COMMON_BLOCK:
+ ret = isp_k_common_block(param);
+ break;
+ case ISP_PRO_COMMON_VERSION:
+ ret = isp_k_common_version(param);
+ break;
+ case ISP_PRO_COMMON_STATUS0:
+ ret = isp_k_common_status0(param);
+ break;
+ case ISP_PRO_COMMON_STATUS1:
+ ret = isp_k_common_status1(param);
+ break;
+ case ISP_PRO_COMMON_CH0_FETCH_SEL:
+ ret = isp_k_common_channel0_fetch_sel(param);
+ break;
+ case ISP_PRO_COMMON_CH0_SIZER_SEL:
+ ret = isp_k_common_channel0_sizer_sel(param);
+ break;
+ case ISP_PRO_COMMON_CH0_STORE_SEL:
+ ret = isp_k_common_channel0_store_sel(param);
+ break;
+ case ISP_PRO_COMMON_CH1_FETCH_SEL:
+ ret = isp_k_common_channel1_fetch_sel(param);
+ break;
+ case ISP_PRO_COMMON_CH1_SIZER_SEL:
+ ret = isp_k_common_channel1_sizer_sel(param);
+ break;
+ case ISP_PRO_COMMON_CH1_STORE_SEL:
+ ret = isp_k_common_channel1_store_sel(param);
+ break;
+ case ISP_PRO_COMMON_FETCH_COLOR_SPACE_SEL:
+ ret = isp_k_common_fetch_color_space_sel(param);
+ break;
+ case ISP_PRO_COMMON_STORE_COLOR_SPACE_SEL:
+ ret = isp_k_common_store_color_space_sel(param);
+ break;
+ case ISP_PRO_COMMON_AWBM_POS_SEL:
+ ret = isp_k_common_awbm_pos_sel(param);
+ break;
+ case ISP_PRO_COMMON_CH0_AEM2_POS:
+ ret = isp_k_common_channel0_y_aem_pos(param);
+ break;
+ case ISP_PRO_COMMON_CH0_Y_AFM_POS:
+ ret = isp_k_common_channel0_y_afm_pos(param);
+ break;
+ case ISP_PRO_COMMON_CH1_AEM2_POS:
+ ret = isp_k_common_channel1_y_aem_pos(param);
+ break;
+ case ISP_PRO_COMMON_CH1_Y_AFM_POS:
+ ret = isp_k_common_channel1_y_afm_pos(param);
+ break;
+ case ISP_PRO_COMMON_LBUF_OFFSET:
+ ret = isp_k_common_lbuf_offset(param);
+ break;
+ default:
+ printk("isp_k_cfg_common: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_contrast.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_contrast.c
new file mode 100644
index 00000000..36f7750d
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_contrast.c
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_contrast_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ struct isp_dev_contrast_info contrast_info;
+
+ memset(&contrast_info, 0x00, sizeof(contrast_info));
+
+ ret = copy_from_user((void *)&contrast_info, param->property_param, sizeof(contrast_info));
+ if (0 != ret) {
+ printk("isp_k_contrast_block: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_CONTRAST_PARAM, 0x1FE, (contrast_info.factor << 1));
+
+ if (contrast_info.bypass) {
+ REG_OWR(ISP_CONTRAST_PARAM, BIT_0);
+ } else {
+ REG_MWR(ISP_CONTRAST_PARAM, BIT_0, 0);
+ }
+
+ return ret;
+}
+
+int32_t isp_k_cfg_contrast(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_contrast: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_contrast: property_param is null error.\n");
+ return -1;
+ }
+
+ switch(param->property) {
+ case ISP_PRO_CONTRAST_BLOCK:
+ ret = isp_k_contrast_block(param);
+ break;
+ default:
+ printk("isp_k_cfg_contrast: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_csa.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_csa.c
new file mode 100644
index 00000000..1aa7ef49
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_csa.c
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_csa_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ struct isp_dev_csa_info_v1 csa_info;
+ uint32_t val = 0;
+
+ memset(&csa_info, 0x00, sizeof(csa_info));
+
+ ret = copy_from_user((void *)&csa_info, param->property_param, sizeof(csa_info));
+ if (0 != ret) {
+ printk("isp_k_csa_block: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ val = ((csa_info.factor_v & 0xFF) << 8) | ((csa_info.factor_u & 0xFF) << 16);
+ REG_MWR(ISP_CSA_PARAM, 0xFFFF00, val);
+
+ if (csa_info.bypass) {
+ REG_OWR(ISP_CSA_PARAM, BIT_0);
+ } else {
+ REG_MWR(ISP_CSA_PARAM, BIT_0, 0);
+ }
+
+ return ret;
+}
+
+int32_t isp_k_cfg_csa(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_csa: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_csa: property_param is null error.\n");
+ return -1;
+ }
+
+ switch(param->property) {
+ case ISP_PRO_CSA_BLOCK:
+ ret = isp_k_csa_block(param);
+ break;
+ default:
+ printk("isp_k_cfg_csa: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_csc.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_csc.c
new file mode 100644
index 00000000..7612b698
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_csc.c
@@ -0,0 +1,114 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_csc_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ struct isp_dev_csc_info csc_info;
+
+ memset(&csc_info, 0x00, sizeof(csc_info));
+
+ ret = copy_from_user((void *)&csc_info, param->property_param, sizeof(csc_info));
+ if (0 != ret) {
+ printk("isp_k_csc_block: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_CSC_CTRL, BIT_0, csc_info.bypass);
+
+ val = (csc_info.red_centre_x & 0x1FFF) | ((csc_info.red_centre_y & 0xFFF) << 16);
+ REG_WR(ISP_CSC_RCC, val);
+
+ val = (csc_info.blue_centre_x & 0x1FFF) | ((csc_info.blue_centre_y & 0xFFF) << 16);
+ REG_WR(ISP_CSC_BCC, val);
+
+ REG_WR(ISP_CSC_REDTHR, csc_info.red_threshold & 0x3FFFFFF);
+
+ REG_WR(ISP_CSC_BLUETHR, (csc_info.blue_threshold & 0x3FFFFFF));
+
+ val = (csc_info.red_p1_param & 0x1FFF) | ((csc_info.red_p2_param & 0x7FF) << 16);
+ REG_WR(ISP_CSC_REDPOLY, val);
+
+ val = (csc_info.blue_p1_param & 0x1FFF) | ((csc_info.blue_p2_param & 0x7FF) << 16);
+ REG_WR(ISP_CSC_BLUEPOLY, val);
+
+ REG_WR(ISP_CSC_MAXGAIN, (csc_info.max_gain_thr & 0x1FFF));
+
+ val = (csc_info.start_pos.x & 0xFFF) | ((csc_info.start_pos.y & 0x1FFF) << 12);
+ REG_WR(ISP_CSC_START_ROW_COL, val );
+
+ val = csc_info.red_x2_init;
+ REG_WR( ISP_CSC_REDX2INIT, (val & 0x3FFFFFF));
+ val = csc_info.red_y2_init;
+ REG_WR( ISP_CSC_REDY2INIT, (val & 0x3FFFFFF));
+
+ val = csc_info.blue_x2_init;
+ REG_WR( ISP_CSC_BLUEX2INIT, (val & 0x3FFFFFF));
+ val = csc_info.blue_y2_init;
+ REG_WR( ISP_CSC_BLUEY2INIT, (val & 0x3FFFFFF));
+
+ return ret;
+
+}
+
+static int32_t isp_k_csc_pic_size(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ struct isp_img_size pic_size = {0, 0};
+
+ ret = copy_from_user((void *)&pic_size, param->property_param, sizeof(pic_size));
+ if (0 != ret) {
+ printk("isp_k_csc_pic_size: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+ val = (pic_size.width& 0x1FFF) | ((pic_size.height& 0xFFF) << 16);
+ REG_WR(ISP_CSC_PICSIZE, val );
+
+ return ret;
+}
+
+int32_t isp_k_cfg_csc(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_csc: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_csc: property_param is null error.\n");
+ return -1;
+ }
+
+ switch(param->property) {
+ case ISP_PRO_CSC_BLOCK:
+ ret = isp_k_csc_block(param);
+ break;
+ case ISP_PRO_CSC_PIC_SIZE:
+ ret = isp_k_csc_pic_size(param);
+ break;
+ default:
+ printk("isp_k_cfg_csc: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_css.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_css.c
new file mode 100644
index 00000000..2147bd53
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_css.c
@@ -0,0 +1,112 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_css_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ struct isp_dev_css_info_v1 css_info;
+ uint32_t val = 0;
+
+ ret = copy_from_user((void *)&css_info, param->property_param, sizeof(css_info));
+ if (0 != ret) {
+ printk("isp_k_css_block: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ val = (css_info.lh_chrom_th & 0x1F) << 24;
+ REG_MWR(ISP_CSS_PARAM, 0x1F000000, val);
+
+ val = ((css_info.chrom_lower_th[0] & 0x1F) << 16) | ((css_info.chrom_lower_th[1] & 0x1F) << 8)
+ | (css_info.chrom_lower_th[2] & 0x1F);
+ REG_MWR(ISP_CSS_CHROM_L_TH_0, 0x1F1F1F, val);
+
+ val = ((css_info.chrom_lower_th[3] & 0x1F) << 24) | ((css_info.chrom_lower_th[4] & 0x1F) << 16)
+ | ((css_info.chrom_lower_th[5] & 0x1F) << 8) | (css_info.chrom_lower_th[6] & 0x1F);
+ REG_WR(ISP_CSS_CHROM_L_TH_1, val);
+
+ val = ((css_info.chrom_high_th[0] & 0x1F) << 16) | ((css_info.chrom_high_th[1] & 0x1F) << 8)
+ | (css_info.chrom_high_th[2] & 0x1F);
+ REG_WR(ISP_CSS_CHROM_H_TH_0, val);
+
+ val = ((css_info.chrom_high_th[3] & 0x1F) << 24) | ((css_info.chrom_high_th[4] & 0x1F) << 16)
+ | ((css_info.chrom_high_th[5] & 0x1F) << 8) | (css_info.chrom_high_th[6] & 0x1F);
+ REG_WR(ISP_CSS_CHROM_H_TH_1, val);
+
+ val = ((css_info.lum_low_shift & 0x7) << 16) | ((css_info.lum_hig_shift & 0x7) << 8);
+ REG_MWR(ISP_CSS_PARAM, 0x70700, val);
+
+ val = (css_info.lh_ratio[7] & 0xF) | ((css_info.lh_ratio[6] & 0xF) << 4)
+ | ((css_info.lh_ratio[5] & 0xF) << 8) | ((css_info.lh_ratio[4] & 0xF) << 12)
+ | ((css_info.lh_ratio[3] & 0xF) << 16) | ((css_info.lh_ratio[2] & 0xF) << 20)
+ | ((css_info.lh_ratio[1] & 0xF) << 24) | ((css_info.lh_ratio[0] & 0xF) << 28);
+ REG_WR(ISP_CSS_LH_RATIO, val);
+
+ val = (css_info.ratio[7] & 0xF) | ((css_info.ratio[6] & 0xF) << 4)
+ | ((css_info.ratio[5] & 0xF) << 8) | ((css_info.ratio[4] & 0xF) << 12)
+ | ((css_info.ratio[3] & 0xF) << 16) | ((css_info.ratio[2] & 0xF) << 20)
+ | ((css_info.ratio[1] & 0xF) << 24) | ((css_info.ratio[0] & 0xF) << 28);
+ REG_WR(ISP_CSS_RATIO, val);
+
+ val = (css_info.lum_hh_th & 0xFF) | ((css_info.lum_hig_th & 0xFF) << 8)
+ | ((css_info.lum_ll_th & 0xFF) << 16) | ((css_info.lum_low_th & 0xFF) << 24);
+ REG_WR(ISP_CSS_THRD0, val);
+
+ val = (css_info.v_th_0_h & 0xFF) | ((css_info.v_th_0_l & 0xFF) << 8)
+ | ((css_info.u_th_0_h & 0xFF) << 16) | ((css_info.u_th_0_l & 0xFF) << 24);
+ REG_WR(ISP_CSS_EX_TH_0, val);
+
+ val = (css_info.v_th_1_h & 0xFF) | ((css_info.v_th_1_l & 0xFF) << 8)
+ | ((css_info.u_th_1_h & 0xFF) << 16) | ((css_info.u_th_1_l & 0xFF) << 24);
+ REG_WR(ISP_CSS_EX_TH_1, val);
+
+ REG_MWR(ISP_CSS_CHROM_L_TH_0, 0x1F000000, css_info.cutoff_th << 24);
+
+ if (css_info.bypass) {
+ REG_OWR(ISP_CSS_PARAM, BIT_0);
+ } else {
+ REG_MWR(ISP_CSS_PARAM, BIT_0, 0);
+ }
+
+ return ret;
+}
+
+int32_t isp_k_cfg_css(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_css: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_css: property_param is null error.\n");
+ return -1;
+ }
+
+ switch(param->property) {
+ case ISP_PRO_CSS_BLOCK:
+ ret = isp_k_css_block(param);
+ break;
+ default:
+ printk("isp_k_cfg_css: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_ct.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_ct.c
new file mode 100644
index 00000000..376b3ce4
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_ct.c
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+#include "isp_drv.h"
+
+#define ISP_3D_LUT_BUF0 0
+#define ISP_3D_LUT_BUF1 1
+
+static int32_t isp_k_ct_block(struct isp_io_param *param,
+ struct isp_k_private *isp_private)
+{
+ int32_t ret = 0;
+ uint32_t buf_size = 0;
+ unsigned long dst_buf = 0;
+ struct isp_dev_ct_info ct_info;
+ void *data_ptr = NULL;
+
+ buf_size = ISP_3D_LUT_ITEM * 4;
+ memset(&ct_info, 0x00, sizeof(ct_info));
+
+ ret = copy_from_user((void *)&ct_info, param->property_param, sizeof(ct_info));
+ if (0 != ret) {
+ printk("isp_k_ct_block: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+#ifdef CONFIG_64BIT
+ data_ptr = (void*)(((unsigned long)ct_info.data_ptr[1] << 32) | ct_info.data_ptr[0]);
+#else
+ data_ptr = (void*)(ct_info.data_ptr[0]);
+#endif
+ if (NULL == data_ptr || ct_info.size > buf_size) {
+ printk("isp_k_ct_block: memory error: %p %x.\n",
+ data_ptr, ct_info.size);
+ }
+
+ dst_buf = ISP_3D_LUT0_OUTPUT;
+ isp_private->ct_load_buf_id = ISP_3D_LUT_BUF0;
+
+ ret = copy_from_user((void *)dst_buf, data_ptr, ct_info.size);
+ if (0 != ret) {
+ printk("isp_k_ct_block: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ //REG_MWR(ISP_CT_PARAM, BIT_1, (isp_private->ct_load_buf_id << 1));
+
+ REG_MWR(ISP_CT_PARAM, BIT_0, ct_info.bypass);
+
+ return ret;
+}
+
+int32_t isp_k_cfg_ct(struct isp_io_param *param,
+ struct isp_k_private *isp_private)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_ct: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_ct: property_param is null error.\n");
+ return -1;
+ }
+
+ switch(param->property) {
+ case ISP_PRO_CT_BLOCK:
+ ret = isp_k_ct_block(param, isp_private);
+ break;
+ default:
+ printk("isp_k_cfg_ct: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_dispatch.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_dispatch.c
new file mode 100644
index 00000000..f998c27d
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_dispatch.c
@@ -0,0 +1,143 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_dispatch_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ struct isp_dev_dispatch_info_v1 dispatch_info;
+
+ memset(&dispatch_info, 0x00, sizeof(dispatch_info));
+
+ ret = copy_from_user((void *)&dispatch_info, param->property_param, sizeof(dispatch_info));
+ if (0 != ret) {
+ printk("isp_k_dispatch_block: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_DISPATCH_CH0_BAYER, 0x03, dispatch_info.bayer_ch0);
+ REG_MWR(ISP_DISPATCH_CH0_BAYER, 0x0C, dispatch_info.bayer_ch1);
+
+ return ret;
+}
+
+static int32_t isp_k_dispatch_ch0_bayer(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+
+ ret = copy_from_user((void *)&val, param->property_param, sizeof(uint32_t));
+ if (0 != ret) {
+ printk("isp_k_dispatch_ch0_bayer: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_DISPATCH_CH0_BAYER, 0x03, val);
+
+ return ret;
+}
+
+static int32_t isp_k_dispatch_ch1_bayer(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+
+ ret = copy_from_user((void *)&val, param->property_param, sizeof(uint32_t));
+ if (0 != ret) {
+ printk("isp_k_dispatch_ch1_bayer: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_DISPATCH_CH0_BAYER, 0x0C, val);
+
+ return ret;
+}
+
+static int32_t isp_k_dispatch_ch0_size(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ struct isp_img_size size = {0};
+
+ ret = copy_from_user((void *)&size, param->property_param, sizeof(size));
+ if (0 != ret) {
+ printk("isp_k_dispatch_ch0_size: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ val = ((size.height & 0xFFFF) << 16) | (size.width & 0xFFFF);
+ REG_WR(ISP_DISPATCH_CH0_SIZE, val);
+
+ return ret;
+}
+
+static int32_t isp_k_dispatch_ch1_size(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ struct isp_img_size size = {0};
+
+ ret = copy_from_user((void *)&size, param->property_param, sizeof(size));
+ if (0 != ret) {
+ printk("isp_k_dispatch_ch1_size: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ val = ((size.height & 0xFFFF) << 16) | (size.width & 0xFFFF);
+ REG_WR(ISP_DISPATCH_CH1_SIZE, val);
+
+ return ret;
+}
+
+int32_t isp_k_cfg_dispatch(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_dispatch: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_dispatch: property_param is null error.\n");
+ return -1;
+ }
+
+ switch (param->property) {
+ case ISP_PRO_DISPATCH_BLOCK:
+ ret = isp_k_dispatch_block(param);
+ break;
+ case ISP_PRO_DISPATCH_CH0_BAYER:
+ ret = isp_k_dispatch_ch0_bayer(param);
+ break;
+ case ISP_PRO_DISPATCH_CH1_BAYER:
+ ret = isp_k_dispatch_ch1_bayer(param);
+ break;
+ case ISP_PRO_DISPATCH_CH0_SIZE:
+ ret = isp_k_dispatch_ch0_size(param);
+ break;
+ case ISP_PRO_DISPATCH_CH1_SIZE:
+ ret = isp_k_dispatch_ch1_size(param);
+ break;
+ default:
+ printk("isp_k_cfg_dispatch: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
+
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_edge.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_edge.c
new file mode 100644
index 00000000..2c298147
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_edge.c
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_edge_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ struct isp_dev_edge_info_v1 edge_info;
+ uint32_t val = 0;
+
+ memset(&edge_info, 0x00, sizeof(edge_info));
+
+ ret = copy_from_user((void *)&edge_info, param->property_param, sizeof(edge_info));
+ if (0 != ret) {
+ printk("isp_k_edge_block: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_EE_CFG0, BIT_29 | BIT_28, edge_info.mode << 28);
+
+ val = (edge_info.ee_str_m_n & 0x7F) | ((edge_info.ee_str_m_p & 0x7F) << 7)
+ | ((edge_info.ee_str_d_n & 0x7F) << 14) | ((edge_info.ee_str_d_p & 0x7F) << 21);
+ REG_MWR(ISP_EE_CFG0, 0xFFFFFFF, val);
+
+ val = ((edge_info.ee_incr_d_p & 0xFF) << 8) | (edge_info.ee_incr_d_n & 0xFF);
+ REG_MWR(ISP_EE_CFG1, 0xFFFF, val);
+
+ val = ((edge_info.ee_thr_d_n & 0xFF) << 16) | ((edge_info.ee_thr_d_p & 0xFF) << 24);
+ REG_MWR(ISP_EE_CFG1, 0xFFFF0000, val);
+
+ val = (edge_info.ee_flat_thr_1 & 0xFF) | ((edge_info.ee_flat_thr_2 & 0xFF) << 8);
+ REG_MWR(ISP_EE_CFG2, 0xFFFF, val);
+
+ val = ((edge_info.ee_incr_m_n & 0xFF) << 16) | ((edge_info.ee_incr_m_p & 0xFF) << 24);
+ REG_MWR(ISP_EE_CFG2, 0xFFFF0000, val);
+
+ val = (edge_info.ee_txt_thr_1 & 0xFF) | ((edge_info.ee_txt_thr_2 & 0xFF) << 8)
+ | ((edge_info.ee_txt_thr_3 & 0xFF) << 16);
+ REG_WR(ISP_EE_CFG3, val);
+
+ val = ((edge_info.ee_corner_cor & 0x1) << 28) | ((edge_info.ee_corner_th_p & 0x1F) << 23)
+ | ((edge_info.ee_corner_th_n & 0x1F) << 18) | ((edge_info.ee_corner_gain_p & 0x7F) << 11)
+ | ((edge_info.ee_corner_gain_n & 0x7F) << 4) | ((edge_info.ee_corner_sm_p & 0x3) << 2)
+ | (edge_info.ee_corner_sm_n & 0x3);
+ REG_WR(ISP_EE_CFG4, val);
+
+ val = ((edge_info.ee_edge_smooth_mode & 0x3) << 26) | ((edge_info.ee_flat_smooth_mode & 0x3) << 24)
+ | ((edge_info.ee_smooth_thr & 0xFF) << 8) | (edge_info.ee_smooth_strength & 0xFF);
+ REG_MWR(ISP_EE_CFG5, 0xF00FFFF, val);
+
+ val = (edge_info.sigma & 0xFF) << 16;
+ REG_MWR(ISP_EE_CFG5, 0xFF0000, val);
+
+ val = ((edge_info.ee_str_b_p & 0xFF) << 24) | ((edge_info.ee_str_b_n & 0xFF) << 16)
+ | ((edge_info.ee_incr_b_p & 0xFF) << 8) | (edge_info.ee_incr_b_n & 0xFF);
+ REG_WR(ISP_EE_CFG6, val);
+
+ val = ((edge_info.ratio[1] & 0xFF) << 8) | (edge_info.ratio[0] & 0xFF);
+ REG_MWR(ISP_EE_CFG7, 0xFFFF, val);
+
+ val = (edge_info.ee_clip_after_smooth_en & 0x1) << 25;
+ REG_MWR(ISP_EE_CFG7, BIT_25, val);
+
+ val = ((edge_info.ipd_bypass & 0x1) << 24) | ((edge_info.ipd_flat_thr & 0xFF) << 16);
+ REG_MWR(ISP_EE_CFG7, 0x1FF0000, val);
+
+/*pike has no ADP_CFG0 ADP_CFG1 ADP_CFG2 registers*/
+
+/* val = (edge_info.ee_t1_cfg & 0x3FF) | ((edge_info.ee_t2_cfg & 0x3FF) << 10)
+ | ((edge_info.ee_t3_cfg & 0x3FF) << 20);
+ REG_WR(ISP_EE_ADP_CFG0, val);
+
+ val = (edge_info.ee_t4_cfg & 0x3FF) | ((edge_info.ee_cv_clip_n & 0xFF) << 16)
+ | ((edge_info.ee_cv_clip_p & 0xFF) << 24);
+ REG_WR(ISP_EE_ADP_CFG1, val);
+
+ val = (edge_info.ee_r1_cfg & 0xFF) | ((edge_info.ee_r2_cfg & 0xFF) << 8)
+ | ((edge_info.ee_r3_cfg & 0xFF) << 16);
+ REG_WR(ISP_EE_ADP_CFG2, val);*/
+
+
+ if (edge_info.bypass) {
+ REG_OWR(ISP_EE_PARAM, BIT_0);
+ } else {
+ REG_MWR(ISP_EE_PARAM, BIT_0, 0);
+ }
+
+ return ret;
+}
+
+int32_t isp_k_cfg_edge(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_edge: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_edge: property_param is null error.\n");
+ return -1;
+ }
+
+ switch (param->property) {
+ case ISP_PRO_EDGE_BLOCK:
+ ret = isp_k_edge_block(param);
+ break;
+ default:
+ printk("isp_k_cfg_edge: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_emboss.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_emboss.c
new file mode 100644
index 00000000..27319afc
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_emboss.c
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_emboss_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ struct isp_dev_emboss_info_v1 emboss_info;
+
+ memset(&emboss_info, 0x00, sizeof(emboss_info));
+
+ ret = copy_from_user((void *)&emboss_info, param->property_param, sizeof(emboss_info));
+ if (0 != ret) {
+ printk("isp_k_emboss_block: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_EMBOSS_Y_PARAM, 0x7E, (emboss_info.y_step & 0x3F) << 1);
+
+ if (emboss_info.y_bypass) {
+ REG_OWR(ISP_EMBOSS_Y_PARAM, BIT_0);
+ } else {
+ REG_MWR(ISP_EMBOSS_Y_PARAM, BIT_0, 0);
+ }
+
+ REG_MWR(ISP_EMBOSS_UV_PARAM, 0x7E, (emboss_info.uv_step & 0x3F) << 1);
+
+ if (emboss_info.uv_bypass) {
+ REG_OWR(ISP_EMBOSS_UV_PARAM, BIT_0);
+ } else {
+ REG_MWR(ISP_EMBOSS_UV_PARAM, BIT_0, 0);
+ }
+
+ return ret;
+}
+
+int32_t isp_k_cfg_emboss(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_emboss: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_emboss: property_param is null error.\n");
+ return -1;
+ }
+
+ switch(param->property) {
+ case ISP_PRO_EMBOSS_BLOCK:
+ ret = isp_k_emboss_block(param);
+ break;
+ default:
+ printk("isp_k_cfg_emboss: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_fetch.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_fetch.c
new file mode 100644
index 00000000..04df07df
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_fetch.c
@@ -0,0 +1,127 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_fetch_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ struct isp_dev_fetch_info_v1 fetch_info;
+
+ memset(&fetch_info, 0x00, sizeof(fetch_info));
+
+ ret = copy_from_user((void *)&fetch_info, param->property_param, sizeof(fetch_info));
+ if (0 != ret) {
+ printk("isp_k_fetch_block: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ if (fetch_info.substract) {
+ REG_OWR(ISP_FETCH_PARAM, BIT_1);
+ } else {
+ REG_MWR(ISP_FETCH_PARAM, BIT_1, 0);
+ }
+
+ REG_MWR(ISP_FETCH_PARAM, 0xF0, (fetch_info.color_format << 4));
+
+ REG_WR(ISP_FETCH_SLICE_Y_ADDR, fetch_info.addr.chn0);
+ REG_WR(ISP_FETCH_SLICE_Y_PITCH, fetch_info.pitch.chn0);
+ REG_WR(ISP_FETCH_SLICE_U_ADDR, fetch_info.addr.chn1);
+ REG_WR(ISP_FETCH_SLICE_U_PITCH, fetch_info.pitch.chn1);
+ REG_WR(ISP_FETCH_SLICE_V_ADDR, fetch_info.addr.chn2);
+ REG_WR(ISP_FETCH_SLICE_V_PITCH, fetch_info.pitch.chn2);
+ REG_WR(ISP_FETCH_MIPI_WORD_INFO, (fetch_info.mipi_word_num & 0xFFFF));
+ REG_WR(ISP_FETCH_MIPI_BYTE_INFO, (fetch_info.mipi_byte_rel_pos & 0x0F));
+ REG_WR(ISP_FETCH_BAYER_MODE, 0x2);
+
+ if (fetch_info.bypass) {
+ REG_OWR(ISP_FETCH_PARAM, BIT_0);
+ } else {
+ REG_MWR(ISP_FETCH_PARAM, BIT_0, 0);
+ }
+
+ return ret;
+}
+
+static int32_t isp_k_fetch_slice_size(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t size = 0;
+ struct isp_img_size slice_size = {0, 0};
+
+ ret = copy_from_user((void *)&slice_size, param->property_param, sizeof(struct isp_img_size));
+ if (0 != ret) {
+ printk("isp_k_fetch_slice_size: read copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ size = ((slice_size.height & 0xFFFF) << 16) | (slice_size.width & 0xFFFF);
+
+ REG_WR(ISP_FETCH_SLICE_SIZE, size);
+
+ return ret;
+}
+
+static int32_t isp_k_fetch_start_isp(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t fetch_start = 0;
+
+ ret = copy_from_user((void *)&fetch_start, param->property_param, sizeof(uint32_t));
+ if (0 != ret) {
+ printk("isp_k_fetch_start_isp: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ if (fetch_start) {
+ REG_OWR(ISP_FETCH_START, BIT_0);
+ } else {
+ REG_MWR(ISP_FETCH_START, BIT_0, 0);
+ }
+
+ return ret;
+}
+
+int32_t isp_k_cfg_fetch(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_fetch: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_fetch: property_param is null error.\n");
+ return -1;
+ }
+
+ switch(param->property) {
+ case ISP_PRO_FETCH_BLOCK:
+ ret = isp_k_fetch_block(param);
+ break;
+ case ISP_PRO_FETCH_SLICE_SIZE:
+ ret = isp_k_fetch_slice_size(param);
+ break;
+ case ISP_PRO_FETCH_START_ISP:
+ ret = isp_k_fetch_start_isp(param);
+ break;
+ default:
+ printk("isp_k_cfg_fetch: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_gamma.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_gamma.c
new file mode 100644
index 00000000..99b9d1b4
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_gamma.c
@@ -0,0 +1,143 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/vmalloc.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+#include "isp_drv.h"
+
+#define ISP_FRGB_GAMC_BUF0 0
+#define ISP_FRGB_GAMC_BUF1 1
+
+static int32_t isp_k_pingpang_frgb_gamc(struct coordinate_xy *nodes,
+ struct isp_k_private *isp_private)
+{
+ int32_t ret = 0;
+ uint32_t i, j;
+ uint32_t val = 0;
+ unsigned long r_buf_addr;
+ unsigned long g_buf_addr;
+ unsigned long b_buf_addr;
+ struct coordinate_xy *p_nodes = NULL;
+
+ if (!nodes) {
+ ret = -1;
+ printk("isp_k_pingpang_frgb_gamc: node is null error .\n");
+ return ret;
+ }
+
+ p_nodes = nodes;
+
+#if 0
+ if (ISP_FRGB_GAMC_BUF0 == isp_private->full_gamma_buf_id) {
+ r_buf_addr = ISP_FGAMMA_R_BUF0_CH0;
+ g_buf_addr = ISP_FGAMMA_G_BUF0_CH0;
+ b_buf_addr = ISP_FGAMMA_B_BUF0_CH0;
+ isp_private->full_gamma_buf_id = ISP_FRGB_GAMC_BUF1;
+ } else {
+ r_buf_addr = ISP_FGAMMA_R_BUF0_CH0;
+ g_buf_addr = ISP_FGAMMA_G_BUF0_CH0;
+ b_buf_addr = ISP_FGAMMA_B_BUF0_CH0;
+ isp_private->full_gamma_buf_id = ISP_FRGB_GAMC_BUF0;
+ }
+#endif
+
+ isp_private->full_gamma_buf_id = ISP_FRGB_GAMC_BUF0;
+ val = ((isp_private->full_gamma_buf_id & 0x1 ) << 1) | ((isp_private->full_gamma_buf_id & 0x1) << 2) | ((isp_private->full_gamma_buf_id & 0x1 ) << 3);
+ REG_MWR(ISP_GAMMA_PARAM, 0x0000000E, val);
+
+ r_buf_addr = ISP_FGAMMA_R_BUF0_CH0;
+ g_buf_addr = ISP_FGAMMA_G_BUF0_CH0;
+ b_buf_addr = ISP_FGAMMA_B_BUF0_CH0;
+
+ for(i = 0,j = 0;i < ISP_PINGPANG_FRGB_GAMC_NUM;i++,j+=4) {
+ REG_WR(r_buf_addr + j, p_nodes[i].node_y & 0xff);
+ REG_WR(g_buf_addr + j, p_nodes[i].node_y & 0xff);
+ REG_WR(b_buf_addr + j, p_nodes[i].node_y & 0xff);
+ }
+
+ isp_private->full_gamma_buf_id = ISP_FRGB_GAMC_BUF1;
+
+ val = ((isp_private->full_gamma_buf_id & 0x1 ) << 1) | ((isp_private->full_gamma_buf_id & 0x1) << 2) | ((isp_private->full_gamma_buf_id & 0x1 ) << 3);
+ REG_MWR(ISP_GAMMA_PARAM, 0x0000000E, val);
+
+ return ret;
+}
+
+static int32_t isp_k_gamma_block(struct isp_io_param *param,
+ struct isp_k_private *isp_private)
+{
+ int32_t ret = 0;
+
+ uint32_t bypass;
+ struct isp_dev_gamma_info_v1 *param_p= (struct isp_dev_gamma_info_v1 *)param->property_param;
+ struct coordinate_xy *nodes = NULL;
+
+ nodes = (struct coordinate_xy *)isp_private->full_gamma_buf_addr;
+ if (!nodes) {
+ ret = -1;
+ printk("isp_k_gamma_block: alloc memory error.\n");
+ return -1;
+ }
+ ret = copy_from_user((void *)nodes, (void *)param_p->nodes, ISP_FRGB_GAMMA_BUF_SIZE);
+ if (0 != ret) {
+ printk("isp_k_gamma_block: copy nodes error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ ret = isp_k_pingpang_frgb_gamc(nodes, isp_private);
+ if (0 != ret) {
+ printk("isp_k_gamma_block: pingpang error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ ret = copy_from_user((void *)&bypass, (void *)&param_p->bypass, sizeof(uint32_t));
+ if (0 != ret) {
+ printk("isp_k_gamma_block: copy bypass error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_GAMMA_PARAM, BIT_0, bypass);
+
+ return ret;
+
+}
+
+int32_t isp_k_cfg_gamma(struct isp_io_param *param,
+ struct isp_k_private *isp_private)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_gamma: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_gamma: property_param is null error.\n");
+ return -1;
+ }
+
+ switch(param->property) {
+ case ISP_PRO_GAMMA_BLOCK:
+ ret = isp_k_gamma_block(param, isp_private);
+ break;
+ default:
+ printk("isp_k_cfg_gamma: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_grgb.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_grgb.c
new file mode 100644
index 00000000..6bf40d2a
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_grgb.c
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_grgb_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ struct isp_dev_grgb_info_v1 grgb_info;
+
+ memset(&grgb_info, 0x00, sizeof(grgb_info));
+
+ ret = copy_from_user((void *)&grgb_info, param->property_param, sizeof(grgb_info));
+ if (0 != ret) {
+ printk("isp_k_grgb_block: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_GRGB_PARAM, BIT_0, grgb_info.bypass);
+
+ val = ((grgb_info.diff & 0x3FF) << 7) | ((grgb_info.edge & 0x3F) << 1);
+ REG_MWR(ISP_GRGB_PARAM, 0x1FFFE, val);
+ val = grgb_info.grid & 0xFFF;
+ REG_MWR(ISP_GRGB_GRID, 0xFFF, val);
+
+ return ret;
+
+}
+
+int32_t isp_k_cfg_grgb(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_grgb: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_grgb: property_param is null error.\n");
+ return -1;
+ }
+
+ switch(param->property) {
+ case ISP_PRO_GRGB_BLOCK:
+ ret = isp_k_grgb_block(param);
+ break;
+ default:
+ printk("isp_k_cfg_grgb: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
+
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_hdr.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_hdr.c
new file mode 100755
index 00000000..ba03b911
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_hdr.c
@@ -0,0 +1,142 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_hdr_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t i = 0, index = 0, addr = 0, val = 0;
+ struct isp_dev_hdr_info hdr_info;
+
+ ret = copy_from_user((void *)&hdr_info, param->property_param, sizeof(hdr_info));
+ if (0 != ret) {
+ printk("isp_k_hdr_block: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+ printk("$$LHC:isp_k_hdr_block");
+ REG_MWR(ISP_HDR_PARAM, BIT_1, (hdr_info.level << 1));
+
+ val = ((hdr_info.b_index & 0xFF) << 24)
+ | ((hdr_info.g_index & 0xFF) << 16)
+ | ((hdr_info.r_index & 0xFF) << 8);
+ REG_WR(ISP_HDR_PARAM, val);
+
+ if (hdr_info.bypass) {
+ REG_OWR(ISP_HDR_PARAM, BIT_0);
+ } else {
+ REG_MWR(ISP_HDR_PARAM, BIT_0, 0);
+ }
+
+ return ret;
+}
+
+static int32_t isp_k_hdr_bypass(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t bypass = 0;
+
+ ret = copy_from_user((void *)&bypass, param->property_param, sizeof(bypass));
+ if (0 != ret) {
+ printk("isp_k_hdr_bypass: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ if (bypass) {
+ REG_OWR(ISP_HDR_PARAM, BIT_0);
+ } else {
+ REG_MWR(ISP_HDR_PARAM, BIT_0, 0);
+ }
+
+ return ret;
+}
+
+static int32_t isp_k_hdr_level(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t level= 0;
+
+ ret = copy_from_user((void *)&level, param->property_param, sizeof(level));
+ if (0 != ret) {
+ printk("isp_k_hdr_level: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_HDR_PARAM, BIT_1, (level << 1));
+
+ return ret;
+}
+
+static int32_t isp_k_hdr_index(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ struct isp_hdr_rgb_index index;
+
+ memset(&index, 0x00, sizeof(index));
+
+ ret = copy_from_user((void *)&index, param->property_param, sizeof(index));
+ if (0 != ret) {
+ printk("isp_k_hdr_index: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ val = ((index.b & 0xFF) << 24)
+ | ((index.g & 0xFF) << 16)
+ | ((index.r & 0xFF) << 8);
+ REG_WR(ISP_HDR_PARAM, val);
+
+ return ret;
+}
+
+
+int32_t isp_k_cfg_hdr(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_hdr: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_hdr: property_param is null error.\n");
+ return -1;
+ }
+
+ switch (param->property) {
+ case ISP_PRO_HDR_BLOCK:
+ ret = isp_k_hdr_block(param);
+ break;
+ case ISP_PRO_HDR_BYPASS:
+ ret = isp_k_hdr_bypass(param);
+ break;
+ case ISP_PRO_HDR_LEVEL:
+ ret = isp_k_hdr_level(param);
+ break;
+ case ISP_PRO_HDR_INDEX:
+ ret = isp_k_hdr_index(param);
+ break;
+ case ISP_PRO_HDR_TAB:
+ //ret = isp_k_hdr_tab(param);
+ break;
+ default:
+ printk("isp_k_cfg_hdr: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_hist.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_hist.c
new file mode 100644
index 00000000..5ab1a8c3
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_hist.c
@@ -0,0 +1,131 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_hist_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ struct isp_dev_hist_info_v1 hist_info;
+ uint32_t val = 0;
+
+ memset(&hist_info, 0x00, sizeof(hist_info));
+
+ ret = copy_from_user((void *)&hist_info, param->property_param, sizeof(hist_info));
+ if (0 != ret) {
+ printk("isp_k_hist_block: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ if (hist_info.buf_rst_en) {
+ REG_OWR(ISP_HIST_PARAM, BIT_1);
+ } else {
+ REG_MWR(ISP_HIST_PARAM, BIT_1, 0);
+ }
+//pike has no bit9
+/* if (hist_info.pof_rst_en) {
+ REG_OWR(ISP_HIST_PARAM, BIT_9);
+ } else {
+ REG_MWR(ISP_HIST_PARAM, BIT_9, 0);
+ }*/
+
+ if (hist_info.skip_num_clr) {
+ REG_OWR(ISP_HIST_PARAM, BIT_8);
+ } else {
+ REG_MWR(ISP_HIST_PARAM, BIT_8, 0);
+ }
+
+ REG_MWR(ISP_HIST_PARAM, 0xF0, hist_info.skip_num << 4);
+
+ if (hist_info.mode) {
+ REG_OWR(ISP_HIST_PARAM, BIT_3);
+ } else {
+ REG_MWR(ISP_HIST_PARAM, BIT_3, 0);
+ }
+
+ val = ((hist_info.high_ratio & 0xFFFF) << 16)
+ | (hist_info.low_ratio & 0xFFFF);
+
+ REG_WR(ISP_HIST_RATIO, val);
+
+ val = (hist_info.dif_adj & 0xFF) | ((hist_info.small_adj & 0xFF) << 8)
+ | ((hist_info.big_adj & 0xFF) << 16);
+
+ REG_WR(ISP_HIST_ADJUST, val);
+
+ if (hist_info.off) {
+ REG_OWR(ISP_HIST_PARAM, BIT_2);
+ } else {
+ REG_MWR(ISP_HIST_PARAM, BIT_2, 0);
+ }
+
+ if (hist_info.bypass) {
+ REG_OWR(ISP_HIST_PARAM, BIT_0);
+ } else {
+ REG_MWR(ISP_HIST_PARAM, BIT_0, 0);
+ }
+
+ return ret;
+}
+
+static int32_t isp_k_hist_slice_size(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ struct isp_img_size size = {0};
+
+ ret = copy_from_user((void *)&size, param->property_param, sizeof(size));
+ if (0 != ret) {
+ printk("isp_k_hist_slice_size: read copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ val = ((size.height & 0xFFFF) << 16)
+ | (size.width & 0xFFFF);
+
+ REG_WR(ISP_HIST_SLICE_SIZE, val);
+
+ return ret;
+}
+
+int32_t isp_k_cfg_hist(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_hist: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_hist: property_param is null error.\n");
+ return -1;
+ }
+
+ switch (param->property) {
+ case ISP_PRO_HIST_BLOCK:
+ ret = isp_k_hist_block(param);
+ break;
+ case ISP_PRO_HIST_SLICE_SIZE:
+ ret = isp_k_hist_slice_size(param);
+ break;
+ default:
+ printk("isp_k_cfg_hist: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_hist2.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_hist2.c
new file mode 100644
index 00000000..7f8c5d05
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_hist2.c
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_hist2_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ struct isp_dev_hist2_info_v1 hist2_info;
+ uint32_t val = 0;
+ uint32_t i = 0;
+
+ memset(&hist2_info, 0x00, sizeof(hist2_info));
+
+ ret = copy_from_user((void *)&hist2_info, param->property_param, sizeof(hist2_info));
+ if (0 != ret) {
+ printk("isp_k_hist2_block: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ if (hist2_info.skip_num_clr) {
+ REG_OWR(ISP_HIST2_PARAM, BIT_8);
+ } else {
+ REG_MWR(ISP_HIST2_PARAM, BIT_8, 0);
+ }
+
+ REG_MWR(ISP_HIST2_PARAM, 0xF0, hist2_info.skip_num << 4);
+
+ if (hist2_info.mode) {
+ REG_OWR(ISP_HIST2_PARAM, BIT_3);
+ } else {
+ REG_MWR(ISP_HIST2_PARAM, BIT_3, 0);
+ }
+
+ for (i = 0; i < 4; i++) {
+ val = (hist2_info.hist_roi_y_s[i] & 0xFFFF) | ((hist2_info.hist_roi_x_s[i] & 0xFFFF) << 16);
+ REG_WR(ISP_HIST2_ROI_S0 + i * 8, val);
+
+ val = (hist2_info.hist_roi_y_e[i] & 0xFFFF) | ((hist2_info.hist_roi_x_e[i] & 0xFFFF) << 16);
+ REG_WR(ISP_HIST2_ROI_E0 + i * 8, val);
+ }
+
+//pike has no bit1 of ISP_HIST2_PARAM
+/* if (hist2_info.en) {
+ REG_OWR(ISP_HIST2_PARAM, BIT_1);
+ } else {
+ REG_MWR(ISP_HIST2_PARAM, BIT_1, 0);
+ }*/
+
+ if (hist2_info.bypass) {
+ REG_OWR(ISP_HIST2_PARAM, BIT_0);
+ } else {
+ REG_MWR(ISP_HIST2_PARAM, BIT_0, 0);
+ }
+
+ return ret;
+}
+
+int32_t isp_k_cfg_hist2(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_hist2: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_hist2: property_param is null error.\n");
+ return -1;
+ }
+
+ switch (param->property) {
+ case ISP_PRO_HIST2_BLOCK:
+ ret = isp_k_hist2_block(param);
+ break;
+ default:
+ printk("isp_k_cfg_hist2: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_hsv.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_hsv.c
new file mode 100644
index 00000000..5083242b
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_hsv.c
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_hsv_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ int32_t buf_size = 0;
+ unsigned long dst_addr = 0;
+ struct isp_dev_hsv_info_v1 hsv_info;
+ void *data_ptr = NULL;
+
+ memset(&hsv_info, 0x00, sizeof(hsv_info));
+
+ ret = copy_from_user((void *)&hsv_info, param->property_param, sizeof(hsv_info));
+ if (0 != ret) {
+ printk("isp_k_hsv_block: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+#ifdef CONFIG_64BIT
+ data_ptr = (void*)(((unsigned long)hsv_info.data_ptr[1] << 32) | hsv_info.data_ptr[0]);
+#else
+ data_ptr = (void*)(hsv_info.data_ptr[0]);
+#endif
+
+ buf_size = ISP_HSV_ITEM * 4;
+ if (NULL == data_ptr || hsv_info.size > buf_size) {
+ printk("isp_k_hsv_block : memory error %p %x \n",
+ data_ptr, hsv_info.size);
+ return -1;
+ }
+
+ if (hsv_info.buf_sel << 1 & BIT_1) {
+ dst_addr = ISP_HSV_BUF1_OUTPUT;
+ } else {
+ dst_addr = ISP_HSV_BUF0_OUTPUT;
+ }
+
+ ret = copy_from_user((void *)dst_addr, data_ptr, hsv_info.size);
+ if (0 != ret) {
+ printk("isp_k_hsv_block: copy error 0x%x \n",(uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_HSV_PARAM, BIT_1, hsv_info.buf_sel << 1);
+
+ REG_MWR(ISP_HSV_PARAM, BIT_0, hsv_info.bypass);
+
+ return ret;
+
+}
+
+
+int32_t isp_k_cfg_hsv(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_hsv: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_hsv: property_param is null error.\n");
+ return -1;
+ }
+
+ switch(param->property) {
+ case ISP_PRO_HSV_BLOCK:
+ ret = isp_k_hsv_block(param);
+ break;
+ default:
+ printk("isp_k_cfg_hsv: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
+
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_hua.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_hua.c
new file mode 100644
index 00000000..f4570330
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_hua.c
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_hue_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ struct isp_dev_hue_info_v1 hua_info;
+
+ memset(&hua_info, 0x00, sizeof(hua_info));
+
+ ret = copy_from_user((void *)&hua_info, param->property_param, sizeof(hua_info));
+ if (0 != ret) {
+ printk("isp_k_hue_block: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_HUA_PARAM, 0x1FF0, hua_info.theta << 4);
+
+ if (hua_info.bypass) {
+ REG_OWR(ISP_HUA_PARAM, BIT_0);
+ } else {
+ REG_MWR(ISP_HUA_PARAM, BIT_0, 0);
+ }
+
+ return ret;
+}
+
+
+int32_t isp_k_cfg_hue(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_hue: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_hue: property_param is null error.\n");
+ return -1;
+ }
+
+ switch(param->property) {
+ case ISP_PRO_HUE_BLOCK:
+ ret = isp_k_hue_block(param);
+ break;
+ default:
+ printk("isp_k_cfg_hue: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_isr.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_isr.c
new file mode 100644
index 00000000..bcec6583
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_isr.c
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include <linux/delay.h>
+#include "isp_reg.h"
+#include "isp_drv.h"
+
+#define ISP_TIME_OUT_MAX (500)
+
+int32_t isp_get_int_num(struct isp_node *node)
+{
+
+ node->irq_val1 = REG_RD(ISP_INT_INT0);
+ node->irq_val2 = REG_RD(ISP_INT_INT1);
+ node->irq_val3 = REG_RD(ISP_INT_INT2);
+
+ if ((0 == node->irq_val1)
+ && (0 == node->irq_val2)
+ && (0 == node->irq_val3)) {
+ printk("isp_get_int_num: int error.\n");
+ return -1;
+ }
+
+ REG_WR(ISP_INT_CLR0, ISP_IRQ_HW_MASK);
+ REG_WR(ISP_INT_CLR1, ISP_IRQ_HW_MASK);
+ REG_WR(ISP_INT_CLR2, ISP_IRQ_HW_MASK);
+
+ return 0;
+}
+
+void isp_clr_int(void)
+{
+ REG_WR(ISP_INT_CLR0, ISP_IRQ_HW_MASK);
+ REG_WR(ISP_INT_CLR1, ISP_IRQ_HW_MASK);
+ REG_WR(ISP_INT_CLR2, ISP_IRQ_HW_MASK);
+}
+
+void isp_en_irq(uint32_t irq_mode)
+{
+ REG_WR(ISP_INT_CLR0, ISP_IRQ_HW_MASK);
+ REG_WR(ISP_INT_CLR1, ISP_IRQ_HW_MASK);
+ REG_WR(ISP_INT_CLR2, ISP_IRQ_HW_MASK);
+
+ switch(irq_mode) {
+ case ISP_INT_VIDEO_MODE:
+ REG_WR(ISP_INT_EN0, ISP_INT_DCAMERA_SOF | ISP_INT_AEM_DONE | ISP_INT_AFM_RGB_DONE | ISP_INT_AFL_DONE);
+ REG_WR(ISP_INT_EN1, 0);
+ REG_WR(ISP_INT_EN2, 0);
+ break;
+ case ISP_INT_CAPTURE_MODE:
+ REG_WR(ISP_INT_EN0, ISP_INT_STORE_DONE);
+ REG_WR(ISP_INT_EN1, 0);
+ REG_WR(ISP_INT_EN2, 0);
+ break;
+ case ISP_INT_CLEAR_MODE:
+ REG_WR(ISP_INT_EN0, 0);
+ REG_WR(ISP_INT_EN1, 0);
+ REG_WR(ISP_INT_EN2, 0);
+ break;
+ default:
+ printk("isp_en_irq: irq_mode error.\n");
+ break;
+ }
+}
+
+int32_t isp_axi_bus_waiting(void)
+{
+ int32_t ret = 0;
+ uint32_t reg_value = 0;
+ uint32_t time_out_cnt = 0;
+
+ REG_OWR(ISP_AXI_ITI2AXIM_CTRL, BIT_18);
+
+ reg_value = REG_RD(ISP_INT_STATUS);
+ while ((0x00 == (reg_value & BIT_3))
+ && (time_out_cnt < ISP_TIME_OUT_MAX)) {
+ time_out_cnt++;
+ udelay(50);
+ reg_value = REG_RD(ISP_INT_STATUS);
+ }
+
+ if (time_out_cnt >= ISP_TIME_OUT_MAX) {
+ ret = -1;
+ printk("isp_axi_bus_waiting: time out.\n");
+ }
+
+ return ret;
+}
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_nlc.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_nlc.c
new file mode 100755
index 00000000..1be70137
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_nlc.c
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_nlc_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ uint32_t i = 0;
+ struct isp_dev_nlc_info_v1 nlc_info;
+
+ memset(&nlc_info, 0x00, sizeof(nlc_info));
+
+ ret = copy_from_user((void *)&nlc_info, param->property_param, sizeof(nlc_info));
+ if (0 != ret) {
+ printk("isp_k_nlc_block: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ for (i = 0; i < 9; i++) {
+ val = ((nlc_info.node.r_node[i*3] & 0x3FF) << 20) | ((nlc_info.node.r_node[i*3+1] & 0x3FF) << 10) | (nlc_info.node.r_node[i*3+2] & 0x3FF);
+ REG_WR(ISP_NLC_PARA_R0 + i * 4, val);
+ val = ((nlc_info.node.g_node[i*3] & 0x3FF) << 20) | ((nlc_info.node.g_node[i*3+1] & 0x3FF) << 10) | (nlc_info.node.g_node[i*3+2] & 0x3FF);
+ REG_WR(ISP_NLC_PARA_G0 + i * 4, val);
+ val = ((nlc_info.node.b_node[i*3] & 0x3FF) << 20) | ((nlc_info.node.b_node[i*3+1] & 0x3FF) << 10) | (nlc_info.node.b_node[i*3+2] & 0x3FF);
+ REG_WR(ISP_NLC_PARA_B0 + i * 4, val);
+ val = ((nlc_info.node.l_node[i*3] & 0x3FF) << 20) | ((nlc_info.node.l_node[i*3+1] & 0x3FF) << 10) | (nlc_info.node.l_node[i*3+2] & 0x3FF);
+ REG_WR(ISP_NLC_PARA_L0 + i * 4, val);
+ }
+
+ val = ((nlc_info.node.r_node[27] & 0x3FF) << 20) | ((nlc_info.node.r_node[28] & 0x3FF) << 10);
+ REG_WR(ISP_NLC_PARA_R9, val);
+ val = ((nlc_info.node.g_node[27] & 0x3FF) << 20) | ((nlc_info.node.g_node[28] & 0x3FF) << 10);
+ REG_WR(ISP_NLC_PARA_G9, val);
+ val = ((nlc_info.node.b_node[27] & 0x3FF) << 20) | ((nlc_info.node.b_node[28] & 0x3FF) << 10);
+ REG_WR(ISP_NLC_PARA_B9, val);
+
+ REG_MWR(ISP_NLC_PARA, BIT_0, nlc_info.bypass);
+
+ return ret;
+
+}
+
+int32_t isp_k_cfg_nlc(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_nlc: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_nlc: property_param is null error.\n");
+ return -1;
+ }
+
+ switch(param->property) {
+ case ISP_PRO_NLC_BLOCK:
+ ret = isp_k_nlc_block(param);
+ break;
+ default:
+ printk("isp_k_cfg_nlc: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
+
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_nlm.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_nlm.c
new file mode 100644
index 00000000..ee4d4076
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_nlm.c
@@ -0,0 +1,202 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include <linux/vmalloc.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_vst_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ struct isp_dev_vst_info_v1 vst_info;
+
+ ret = copy_from_user((void *)&vst_info, param->property_param, sizeof(vst_info));
+ if (0 != ret) {
+ printk("isp_k_vst_block: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_VST_PARA, BIT_0, vst_info.bypass);
+
+ REG_MWR(ISP_VST_PARA, BIT_1, vst_info.buf_sel << 1);
+
+ return ret;
+
+}
+
+static int32_t isp_k_nlm_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ uint32_t i = 0;
+ struct isp_dev_nlm_info_v2 nlm_info;
+ uint32_t *buff0 = NULL;
+ uint32_t *buff1 = NULL;
+ unsigned long buf_addr = 0;
+ void *vst_addr = NULL;
+ void *ivst_addr = NULL;
+ void *nlm_addr = NULL;
+
+ ret = copy_from_user((void *)&nlm_info, param->property_param, sizeof(nlm_info));
+ if (0 != ret) {
+ printk("isp_k_nlm_block: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ buff0 = vzalloc(nlm_info.vst_len);
+ if (NULL == buff0) {
+ printk("isp_k_nlm_block:vst kmalloc error\n");
+ return -1;
+ }
+
+ buff1 = vzalloc(nlm_info.ivst_len);
+ if (NULL == buff1) {
+ printk("isp_k_nlm_block:ivst kmalloc error\n");
+ vfree(buff0);
+ return -1;
+ }
+
+#ifdef CONFIG_64BIT
+ vst_addr = (void*)(((unsigned long)nlm_info.vst_addr[1] << 32) | nlm_info.vst_addr[0]);
+#else
+ vst_addr = (void*)(nlm_info.vst_addr[0]);
+#endif
+ ret = copy_from_user((void *)buff0, vst_addr, nlm_info.vst_len);
+ if (0 != ret) {
+ printk("isp_k_nlm_block: vst copy error, ret=0x%x\n", (uint32_t)ret);
+ vfree(buff0);
+ vfree(buff1);
+ return -1;
+ }
+
+#ifdef CONFIG_64BIT
+ ivst_addr = (void*)(((unsigned long)nlm_info.ivst_addr[1] << 32) | nlm_info.ivst_addr[0]);
+#else
+ ivst_addr = (void*)(nlm_info.ivst_addr[0]);
+#endif
+ ret = copy_from_user((void *)buff1, ivst_addr, nlm_info.ivst_len);
+ if (0 != ret) {
+ printk("isp_k_nlm_block: ivst copy error, ret=0x%x\n", (uint32_t)ret);
+ vfree(buff0);
+ vfree(buff1);
+ return -1;
+ }
+
+ REG_MWR(ISP_NLM_PARA, BIT_1, nlm_info.imp_opt_bypass << 1);
+ REG_MWR(ISP_NLM_PARA, BIT_2, nlm_info.flat_opt_bypass << 2);
+
+ for (i = 0; i < 5; i++) {
+ val = (nlm_info.thresh[i] & 0x3FFF) | ((nlm_info.cnt[i] & 0x1F) << 16)
+ | ((nlm_info.strength[i] & 0x7F) << 24);
+ REG_WR(ISP_NLM_FLAT_PARA_0 + i * 4, val);
+ }
+
+ REG_MWR(ISP_NLM_STERNGTH, 0x7F, nlm_info.streng_th);
+
+ REG_MWR(ISP_NLM_STERNGTH, 0x7F80, nlm_info.texture_dec << 7);
+
+ REG_WR(ISP_NLM_IS_FLAT, nlm_info.is_flat & 0xFF);
+
+ REG_MWR(ISP_NLM_ADD_BACK, 0x7F, nlm_info.addback);
+
+
+ for (i = 0; i < 24; i++) {
+ val = (nlm_info.lut_w[i*3+0] & 0x3FF) | ((nlm_info.lut_w[i*3+1] & 0x3FF) << 10)
+ | ((nlm_info.lut_w[i*3+2] & 0x3FF) << 20);
+ REG_WR(ISP_NLM_LUT_W_0 + i * 4, val);
+ }
+
+
+ if (nlm_info.buf_sel ) {
+ //buf_addr = ISP_VST_BUF1_CH0;
+ //memcpy((void *)buf_addr, buff0, ISP_VST_IVST_NUM * sizeof(uint32_t));
+ } else {
+ buf_addr = ISP_VST_BUF0_CH0;
+ memcpy((void *)buf_addr, buff0, ISP_VST_IVST_NUM * sizeof(uint32_t));
+ }
+
+ if (nlm_info.buf_sel ) {
+ //buf_addr = ISP_IVST_BUF1_CH0;
+ //memcpy((void *)buf_addr, buff1, ISP_VST_IVST_NUM * sizeof(uint32_t));
+ } else {
+ buf_addr = ISP_IVST_BUF0_CH0;
+ memcpy((void *)buf_addr, buff1, ISP_VST_IVST_NUM * sizeof(uint32_t));
+ }
+
+ /*vst ivst follow nlm*/
+ REG_MWR(ISP_VST_PARA, BIT_1, nlm_info.buf_sel << 1);
+ REG_MWR(ISP_IVST_PARA, BIT_1, nlm_info.buf_sel << 1);
+
+ REG_MWR(ISP_NLM_PARA, BIT_0, nlm_info.bypass);
+ REG_MWR(ISP_IVST_PARA, BIT_0, nlm_info.bypass);
+ REG_MWR(ISP_VST_PARA, BIT_0, nlm_info.bypass);
+
+ vfree(buff0);
+ vfree(buff1);
+ return ret;
+
+}
+
+static int32_t isp_k_ivst_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ struct isp_dev_ivst_info_v1 ivst_info;
+
+ ret = copy_from_user((void *)&ivst_info, param->property_param, sizeof(ivst_info));
+ if (0 != ret) {
+ printk("isp_k_ivst_block: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_IVST_PARA, BIT_0, ivst_info.bypass);
+
+ REG_MWR(ISP_IVST_PARA, BIT_1, ivst_info.buf_sel << 1);
+
+ return ret;
+
+}
+
+int32_t isp_k_cfg_nlm(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_nlm: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_nlm: property_param is null error.\n");
+ return -1;
+ }
+
+ switch(param->property) {
+ case ISP_PRO_VST_BLOCK:
+ ret = isp_k_vst_block(param);
+ break;
+ case ISP_PRO_NLM_BLOCK:
+ ret = isp_k_nlm_block(param);
+ break;
+ case ISP_PRO_IVST_BLOCK:
+ ret = isp_k_ivst_block(param);
+ break;
+ default:
+ printk("isp_k_cfg_nlm: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_pgg.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_pgg.c
new file mode 100644
index 00000000..8cdd023d
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_pgg.c
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_pgg_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ struct isp_dev_pre_glb_gain_info pgg_info;
+
+ memset(&pgg_info, 0x00, sizeof(pgg_info));
+
+ ret = copy_from_user((void *)&pgg_info, param->property_param, sizeof(pgg_info));
+ if (0 != ret) {
+ printk("isp_k_pgg_block: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_PGG_PARAM, 0xFFFF00, (pgg_info.gain << 8));
+
+ if (pgg_info.bypass) {
+ REG_OWR(ISP_PGG_PARAM, BIT_0);
+ } else {
+ REG_MWR(ISP_PGG_PARAM, BIT_0, 0);
+ }
+
+ return ret;
+}
+
+int32_t isp_k_cfg_pgg(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_pgg: param is null error.\n");
+ return -1;
+ }
+
+ if (!param->property_param) {
+ printk("isp_k_cfg_pgg: property_param is null error.\n");
+ return -1;
+ }
+
+ switch (param->property) {
+ case ISP_PRO_PRE_GLB_GAIN_BLOCK:
+ ret = isp_k_pgg_block(param);
+ break;
+ default:
+ printk("isp_k_cfg_pgg: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_post_cdn.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_post_cdn.c
new file mode 100644
index 00000000..e61ad33e
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_post_cdn.c
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_post_cdn_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ struct isp_dev_post_cdn_info post_cdn_info;
+ uint32_t val = 0;
+ uint32_t i = 0;
+
+ memset(&post_cdn_info, 0x00, sizeof(post_cdn_info));
+
+ ret = copy_from_user((void *)&post_cdn_info, param->property_param, sizeof(post_cdn_info));
+ if (0 != ret) {
+ printk("isp_k_post_cdn_block: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+
+ REG_WR(ISP_POSTCDN_ADPT_THR, post_cdn_info.adapt_med_thr & 0x3FFF);
+
+ REG_MWR(ISP_POSTCDN_COMMON_CTRL, 0xE0, post_cdn_info.median_mode << 5);
+
+ if (post_cdn_info.uvjoint) {
+ REG_OWR(ISP_POSTCDN_COMMON_CTRL, BIT_4);
+ } else {
+ REG_MWR(ISP_POSTCDN_COMMON_CTRL, BIT_4, 0);
+ }
+
+ if (post_cdn_info.writeback_en) {
+ REG_OWR(ISP_POSTCDN_COMMON_CTRL, BIT_3);
+ } else {
+ REG_MWR(ISP_POSTCDN_COMMON_CTRL, BIT_3, 0);
+ }
+
+ if (post_cdn_info.mode) {
+ REG_OWR(ISP_POSTCDN_COMMON_CTRL, BIT_2);
+ } else {
+ REG_MWR(ISP_POSTCDN_COMMON_CTRL, BIT_2, 0);
+ }
+
+ val = (post_cdn_info.uvthr0 & 0x1FF) | ((post_cdn_info.uvthr1 & 0x1FF) << 16);
+ REG_WR(ISP_POSTCDN_UVTHR, val);
+ val = (post_cdn_info.thru0 & 0xFF) | ((post_cdn_info.thru1 & 0xFF) << 16);
+ REG_WR(ISP_POSTCDN_THRU, val);
+ val = (post_cdn_info.thrv0 & 0xFF) | ((post_cdn_info.thrv1 & 0xFF) << 16);
+ REG_WR(ISP_POSTCDN_THRV, val);
+
+ for (i = 0; i < 3; i++) {
+ val = (post_cdn_info.r_segu[0][i*2] & 0xFF) | ((post_cdn_info.r_segu[1][i*2] & 0x7) << 8)
+ | ((post_cdn_info.r_segu[0][i*2+1] & 0xFF) << 16) | ((post_cdn_info.r_segu[1][i*2+1] & 0x7) << 24);
+ REG_WR(ISP_POSTCDN_RSEGU01 + i * 4, val);
+ }
+ val = (post_cdn_info.r_segu[0][6] & 0xFF) | ((post_cdn_info.r_segu[1][6] & 0x7) << 8);
+ REG_WR(ISP_POSTCDN_RSEGU6, val);
+ for (i = 0; i < 3; i++) {
+ val = (post_cdn_info.r_segv[0][i*2] & 0xFF) | ((post_cdn_info.r_segv[1][i*2] & 0x7) << 8)
+ | ((post_cdn_info.r_segv[0][i*2+1] & 0xFF) << 16) | ((post_cdn_info.r_segv[1][i*2+1] & 0x7) << 24);
+ REG_WR(ISP_POSTCDN_RSEGV01 + i * 4, val);
+ }
+ val = (post_cdn_info.r_segv[0][6] & 0xFF) | ((post_cdn_info.r_segv[1][6] & 0x7) << 8);
+ REG_WR(ISP_POSTCDN_RSEGV6, val);
+
+
+ for (i = 0; i < 15; i++) {
+ val = (post_cdn_info.r_distw[i][0] & 0x7) | ((post_cdn_info.r_distw[i][1] & 0x7) << 3)
+ | ((post_cdn_info.r_distw[i][2] & 0x7) << 6) | ((post_cdn_info.r_distw[i][3] & 0x7) << 9)
+ | ((post_cdn_info.r_distw[i][4] & 0x7) << 12);
+ REG_WR(ISP_POSTCDN_R_DISTW0 + i * 4, val);
+ }
+
+//pike has no this register
+ //REG_WR(ISP_POSTCDN_START_ROW_MOD4, post_cdn_info.start_row_mod4 & 0x3);
+
+ if (post_cdn_info.downsample_bypass) {
+ REG_OWR(ISP_POSTCDN_COMMON_CTRL, BIT_1);
+ } else {
+ REG_MWR(ISP_POSTCDN_COMMON_CTRL, BIT_1, 0);
+ }
+
+ if (post_cdn_info.bypass) {
+ REG_OWR(ISP_POSTCDN_COMMON_CTRL, BIT_0);
+ } else {
+ REG_MWR(ISP_POSTCDN_COMMON_CTRL, BIT_0, 0);
+ }
+
+
+ return ret;
+}
+
+int32_t isp_k_cfg_post_cdn(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_post_cdn: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_post_cdn: property_param is null error.\n");
+ return -1;
+ }
+
+ switch(param->property) {
+ case ISP_PRO_POST_CDN_BLOCK:
+ ret = isp_k_post_cdn_block(param);
+ break;
+ default:
+ printk("isp_k_cfg_post_cdn: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_pre_cdn.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_pre_cdn.c
new file mode 100644
index 00000000..f4be5578
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_pre_cdn.c
@@ -0,0 +1,135 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_yuv_precdn_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ struct isp_dev_yuv_precdn_info pre_cdn_info;
+ uint32_t val = 0;
+ uint32_t i = 0;
+
+ memset(&pre_cdn_info, 0x00, sizeof(pre_cdn_info));
+
+ ret = copy_from_user((void *)&pre_cdn_info, param->property_param, sizeof(pre_cdn_info));
+ if (0 != ret) {
+ printk("isp_k_yuv_precdn_block: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ if (pre_cdn_info.mode) {
+ REG_OWR(ISP_PRECDN_PARAM, BIT_4);
+ } else {
+ REG_MWR(ISP_PRECDN_PARAM, BIT_4, 0);
+ }
+
+ if (pre_cdn_info.median_writeback_en) {
+ REG_OWR(ISP_PRECDN_PARAM, BIT_8);
+ } else {
+ REG_MWR(ISP_PRECDN_PARAM, BIT_8, 0);
+ }
+
+ REG_MWR(ISP_PRECDN_PARAM, BIT_13 | BIT_12, pre_cdn_info.median_mode << 12);
+
+ if (pre_cdn_info.uv_joint) {
+ REG_OWR(ISP_PRECDN_PARAM, BIT_20);
+ } else {
+ REG_MWR(ISP_PRECDN_PARAM, BIT_20, 0);
+ }
+
+ REG_MWR(ISP_PRECDN_PARAM, BIT_17 | BIT_16, pre_cdn_info.den_stren << 16);
+
+ val = (pre_cdn_info.median_thr_u[0] & 0x7F) | ((pre_cdn_info.median_thr_u[1] & 0xFF) << 8)
+ | ((pre_cdn_info.median_thr_v[0] & 0x7F) << 16) | ((pre_cdn_info.median_thr_v[1] & 0xFF) << 24);
+ REG_WR(ISP_PRECDN_MEDIAN_THRUV01, val);
+
+ val = (pre_cdn_info.median_thr & 0x1FF) | ((pre_cdn_info.uv_thr & 0xFF) << 16)
+ | ((pre_cdn_info.y_thr & 0xFF) << 24);
+ REG_WR(ISP_PRECDN_THRYUV, val);
+
+ for (i = 0; i < 3; i++) {
+ val = (pre_cdn_info.r_segu[0][i*2] & 0xFF) | ((pre_cdn_info.r_segu[1][i*2] & 0x7) << 8)
+ | ((pre_cdn_info.r_segu[0][i*2+1] & 0xFF) << 16) | ((pre_cdn_info.r_segu[1][i*2+1] & 0x7) << 24);
+ REG_WR(ISP_PRECDN_SEGU_0 + i * 4, val);
+ }
+
+ val = (pre_cdn_info.r_segu[0][6] & 0xFF) | ((pre_cdn_info.r_segu[1][6] & 0x7) << 8);
+ REG_WR(ISP_PRECDN_SEGU_3, val);
+
+ for (i = 0; i < 3; i++) {
+ val = (pre_cdn_info.r_segv[0][i*2] & 0xFF) | ((pre_cdn_info.r_segv[1][i*2] & 0x7) << 8)
+ | ((pre_cdn_info.r_segv[0][i*2+1] & 0xFF) << 16) | ((pre_cdn_info.r_segv[1][i*2+1] & 0x7) << 24);
+ REG_WR(ISP_PRECDN_SEGV_0 + i * 4, val);
+ }
+
+ val = (pre_cdn_info.r_segv[0][6] & 0xFF) | ((pre_cdn_info.r_segv[1][6] & 0x7) << 8);
+ REG_WR(ISP_PRECDN_SEGV_3, val);
+
+ for (i = 0; i < 3; i++) {
+ val = (pre_cdn_info.r_segy[0][i*2] & 0xFF) | ((pre_cdn_info.r_segy[1][i*2] & 0x7) << 8)
+ | ((pre_cdn_info.r_segy[0][i*2+1] & 0xFF) << 16) | ((pre_cdn_info.r_segy[1][i*2+1] & 0x7) << 24);
+ REG_WR(ISP_PRECDN_SEGY_0 + i * 4, val);
+ }
+
+ val = (pre_cdn_info.r_segy[0][6] & 0xFF) | ((pre_cdn_info.r_segy[1][6] & 0x7) << 8);
+ REG_WR(ISP_PRECDN_SEGY_3, val);
+
+ for (i = 0; i < 3; i++) {
+ val = (pre_cdn_info.r_distw[i*8] & 0x7) | ((pre_cdn_info.r_distw[i*8+1] & 0x7) << 4)
+ | ((pre_cdn_info.r_distw[i*8+2] & 0x7) << 8) | ((pre_cdn_info.r_distw[i*8+3] & 0x7) << 12)
+ | ((pre_cdn_info.r_distw[i*8+4] & 0x7) << 16) | ((pre_cdn_info.r_distw[i*8+5] & 0x7) << 20)
+ | ((pre_cdn_info.r_distw[i*8+6] & 0x7) << 24) | ((pre_cdn_info.r_distw[i*8+7] & 0x7) << 28);
+ REG_WR(ISP_PRECDN_DISTW0 + i * 4, val);
+ }
+
+ val = pre_cdn_info.r_distw[24] & 0x7;
+ REG_WR(ISP_PRECDN_DISTW3, val);
+
+ if (pre_cdn_info.bypass) {
+ REG_OWR(ISP_PRECDN_PARAM, BIT_0);
+ } else {
+ REG_MWR(ISP_PRECDN_PARAM, BIT_0, 0);
+ }
+
+ return ret;
+}
+
+int32_t isp_k_cfg_yuv_precdn(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_yuv_precdn: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_yuv_precdn: property_param is null error.\n");
+ return -1;
+ }
+
+ switch(param->property) {
+ case ISP_PRO_YUV_PRECDN_BLOCK:
+ ret = isp_k_yuv_precdn_block(param);
+ break;
+ default:
+ printk("isp_k_cfg_yuv_precdn: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_pre_cdn_rgb.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_pre_cdn_rgb.c
new file mode 100644
index 00000000..d5bde126
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_pre_cdn_rgb.c
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_pre_cdn_rgb_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ struct isp_dev_pre_cdn_rgb_info pcr_info;
+
+ memset(&pcr_info, 0x00, sizeof(pcr_info));
+
+ ret = copy_from_user((void *)&pcr_info, param->property_param, sizeof(pcr_info));
+ if (0 != ret) {
+ printk("isp_k_pre_cdn_rgb_block: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_PRECNRNEW_CFG, BIT_0, pcr_info.bypass);
+
+ REG_MWR(ISP_PRECNRNEW_CFG, 0x3 << 1, pcr_info.median_mode << 1);
+
+ val = pcr_info.median_thr & 0xFFFF;
+ REG_WR(ISP_PRECNRNEW_MEDIAN_THR, val);
+ val = (pcr_info.thru0 & 0xFFFF) | ((pcr_info.thru1 & 0xFFFF) << 16);
+ REG_WR(ISP_PRECNRNEW_THRU, val);
+ val = (pcr_info.thrv0 & 0xFFFF) | ((pcr_info.thrv1 & 0xFFFF) << 16);
+ REG_WR(ISP_PRECNRNEW_THRV, val);
+
+ return ret;
+
+}
+
+int32_t isp_k_cfg_pre_cdn_rgb(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_pre_cdn_rgb: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_pre_cdn_rgb: property_param is null error.\n");
+ return -1;
+ }
+
+ switch(param->property) {
+ case ISP_PRO_PRE_CDN_RGB_BLOCK:
+ ret = isp_k_pre_cdn_rgb_block(param);
+ break;
+ default:
+ printk("isp_k_cfg_pre_cdn_rgb: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
+
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_prefilter.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_prefilter.c
new file mode 100644
index 00000000..ea25ccf1
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_prefilter.c
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_prefilter_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ struct isp_dev_prefilter_info_v1 prefilter_info;
+
+ memset(&prefilter_info, 0x00, sizeof(prefilter_info));
+
+ ret = copy_from_user((void *)&prefilter_info, param->property_param, sizeof(prefilter_info));
+ if (0 != ret) {
+ printk("isp_k_prefilter_block: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ if (prefilter_info.writeback) {
+ REG_OWR(ISP_PREF_PARAM, BIT_1);
+ } else {
+ REG_MWR(ISP_PREF_PARAM, BIT_1, 0);
+ }
+
+ REG_WR(ISP_PREF_THRD, prefilter_info.thrd & 0xFF);
+
+ if (prefilter_info.bypass) {
+ REG_OWR(ISP_PREF_PARAM, BIT_0);
+ } else {
+ REG_MWR(ISP_PREF_PARAM, BIT_0, 0);
+ }
+
+ return ret;
+}
+
+int32_t isp_k_cfg_prefilter(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_prefilter: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_prefilter: property_param is null error.\n");
+ return -1;
+ }
+
+ switch(param->property) {
+ case ISP_PRO_PREF_BLOCK:
+ ret = isp_k_prefilter_block(param);
+ break;
+ default:
+ printk("isp_k_cfg_prefilter: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_pstrz.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_pstrz.c
new file mode 100644
index 00000000..0db4e234
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_pstrz.c
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_posterize_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ uint32_t i = 0;
+ struct isp_dev_posterize_info pstrz_info;
+
+ memset(&pstrz_info, 0x00, sizeof(pstrz_info));
+
+ ret = copy_from_user((void *)&pstrz_info, param->property_param, sizeof(pstrz_info));
+ if (0 != ret) {
+ printk("isp_k_posterize_block: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_PSTRZ_PARAM, BIT_0, pstrz_info.bypass);
+
+ for (i = 0; i < 8; i++) {
+ val = (pstrz_info.posterize_level_out[i] & 0xFF) | ((pstrz_info.posterize_level_top[i] & 0xFF) << 8)
+ | ((pstrz_info.posterize_level_bottom[i] & 0xFF) << 16);
+ REG_WR(ISP_PSTRZ_LEVEL0 + i * 4, val);
+ }
+
+ return ret;
+
+}
+
+int32_t isp_k_cfg_posterize(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_posterize: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_posterize: property_param is null error.\n");
+ return -1;
+ }
+
+ switch(param->property) {
+ case ISP_PRO_POSTERIZE_BLOCK:
+ ret = isp_k_posterize_block(param);
+ break;
+ default:
+ printk("isp_k_cfg_posterize: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
+
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_pwd.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_pwd.c
new file mode 100644
index 00000000..88b6355f
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_pwd.c
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_pwd_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ struct isp_dev_pre_wavelet_info_v1 pwd_info;
+
+ memset(&pwd_info, 0x00, sizeof(pwd_info));
+
+ ret = copy_from_user((void *)&pwd_info, param->property_param, sizeof(pwd_info));
+ if (0 != ret) {
+ printk("isp_k_pwd_block: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ val = ((pwd_info.gain_thrs0 & 0x7FF) << 6) | ((pwd_info.gain_thrs1 & 0x7FF) << 17);
+ REG_MWR(ISP_PWD_PARAM, 0x0FFFFFC0, val);
+
+ val = (pwd_info.bitshift0 & 0x7) | ((pwd_info.bitshift1 & 0xFF) << 3);
+ REG_MWR(ISP_PWD_PARAM1, 0x7FF, val);
+
+ val = (pwd_info.offset & 0xFF) << 11;
+ REG_MWR(ISP_PWD_PARAM1, 0x7F800, val);
+
+ val = (pwd_info.nsr_slope & 0x3FF) << 4;
+ REG_MWR(ISP_PWD_PARAM2, 0x3FF0, val);
+
+ val = pwd_info.lum_ratio & 0xF;
+ REG_MWR(ISP_PWD_PARAM2, 0xF, val);
+
+ val = ((pwd_info.center_pos_x & 0x1FFF) << 12) | (pwd_info.center_pos_y & 0xFFF);
+ REG_WR(ISP_PWD_PARAM3, val);
+
+ val = pwd_info.delta_x2 & 0x3FFFFFF;
+ REG_WR(ISP_PWD_PARAM4, val);
+ val = pwd_info.delta_y2 & 0xFFFFFF;
+ REG_WR(ISP_PWD_PARAM5, val);
+
+ val = pwd_info.r2_thr & 0x3FFFFFF;
+ REG_WR(ISP_PWD_PARAM6, val);
+
+ val = ((pwd_info.p_param1 & 0x1FFF) << 11) | (pwd_info.p_param2 & 0x7FF);
+ REG_WR(ISP_PWD_PARAM7, val);
+
+ val = (pwd_info.addback & 0x7F) << 13;
+ REG_MWR(ISP_PWD_PARAM8, 0xFE000, val);
+
+ val = pwd_info.gain_max_thr & 0x1FFF;
+ REG_MWR(ISP_PWD_PARAM8, 0x1FFF, val);
+
+ val = ((pwd_info.pos_x & 0x1FFF) << 12) | (pwd_info.pos_y & 0xFFF);
+ REG_WR(ISP_PWD_PARAM10, val);
+
+ REG_MWR(ISP_PWD_PARAM, BIT_1, pwd_info.radial_bypass << 1);
+ REG_MWR(ISP_PWD_PARAM, BIT_0, pwd_info.bypass);
+
+ return ret;
+}
+
+static int32_t isp_k_pwd_slice_size(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ struct isp_img_size size = {0, 0};
+
+ ret = copy_from_user((void *)&size, param->property_param, sizeof(struct isp_img_size));
+ if (0 != ret) {
+ printk("isp_k_pwd_slice_size: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ val = ((size.width & 0x1FFF) << 12) | (size.height & 0xFFF);
+ REG_WR(ISP_PWD_PARAM9, val);
+
+ return ret;
+}
+
+int32_t isp_k_cfg_pwd(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_pwd: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_pwd: property_param is null error.\n");
+ return -1;
+ }
+
+ switch(param->property) {
+ case ISP_PRO_PWD_BLOCK:
+ ret = isp_k_pwd_block(param);
+ break;
+ case ISP_PRO_PWD_SLICE_SIZE:
+ ret = isp_k_pwd_slice_size(param);
+ break;
+ default:
+ printk("isp_k_cfg_pwd: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
+
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_raw_aem.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_raw_aem.c
new file mode 100644
index 00000000..5e4509d5
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_raw_aem.c
@@ -0,0 +1,255 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+#include "isp_drv.h"
+
+static int32_t isp_k_raw_aem_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ struct isp_dev_raw_aem_info aem_info;
+
+ memset(&aem_info, 0x00, sizeof(aem_info));
+
+ ret = copy_from_user((void *)&aem_info, param->property_param, sizeof(aem_info));
+ if (0 != ret) {
+ printk("isp_k_raw_aem_block: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_AEM_PARAM, BIT_0, aem_info.bypass);
+
+ val = (aem_info.shift & 0x1F) << 18;
+ if(0 != val) {
+ printk("isp_k_raw_aem_block: shift error, 0x%x\n", val);
+ }
+ REG_MWR(ISP_AEM_BLK_SIZE, 0x7C0000, 0);
+
+ REG_MWR(ISP_AEM_PARAM, BIT_1, aem_info.mode << 1);
+
+ return ret;
+}
+
+static int32_t isp_k_raw_aem_bypass(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t bypass = 0;
+
+ ret = copy_from_user((void *)&bypass, param->property_param, sizeof(bypass));
+ if (0 != ret) {
+ printk("isp_k_raw_aem_bypass: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_AEM_PARAM, BIT_0, bypass);
+
+ return ret;
+}
+
+static int32_t isp_k_raw_aem_mode(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t mode = 0;
+
+ ret = copy_from_user((void *)&mode, param->property_param, sizeof(mode));
+ if (0 != ret) {
+ printk("isp_k_raw_aem_mode: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_AEM_PARAM, BIT_1, mode << 1);
+
+ return ret;
+}
+
+static int32_t isp_k_raw_aem_statistics(struct isp_io_param *param,
+ struct isp_k_private *isp_private)
+{
+ int32_t ret = 0, i = 0;
+ uint32_t val0 = 0, val1 = 0;
+ unsigned long addr = 0;
+ struct isp_raw_aem_statistics *aem_statistics = NULL;
+
+ aem_statistics = (struct isp_raw_aem_statistics *)isp_private->raw_aem_buf_addr;
+ if (!aem_statistics) {
+ ret = -1;
+ printk("isp_k_raw_aem_statistics: alloc memory error.\n");
+ return -1;
+ }
+
+ addr = ISP_RAW_AEM_OUTPUT;
+ for (i = 0x00; i < ISP_RAW_AEM_ITEM; i++) {
+ val0 = REG_RD(addr);
+ val1 = REG_RD(addr + 4);
+ aem_statistics->r[i]= (val1 >> 11) & 0x1fffff;
+ aem_statistics->g[i]= val0 & 0x3fffff;
+ aem_statistics->b[i]= ((val1 & 0x7ff) << 10) | ((val0 >> 22) & 0x3ff);
+ addr += 8;
+ }
+
+ ret = copy_to_user(param->property_param, (void*)aem_statistics, sizeof(struct isp_raw_aem_statistics));
+ if (0 != ret) {
+ ret = -1;
+ printk("isp_k_raw_aem_statistics: copy error, ret=0x%x\n", (uint32_t)ret);
+ }
+
+ return ret;
+}
+
+static int32_t isp_k_raw_aem_skip_num(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ uint32_t skip_num;
+
+ ret = copy_from_user((void *)&skip_num, param->property_param, sizeof(skip_num));
+ if (0 != ret) {
+ printk("isp_k_raw_aem_skip_num: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ val = (skip_num & 0xF) << 4;
+ REG_MWR(ISP_AEM_PARAM, 0xF0, val);
+
+ return ret;
+}
+
+static int32_t isp_k_raw_aem_shift(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t shift = 0;
+ uint32_t val = 0;
+
+ ret = copy_from_user((void *)&shift, param->property_param, sizeof(shift));
+ if (0 != ret) {
+ printk("isp_k_raw_aem_shift: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ val = (shift & 0x1F) << 18;
+ if(0 != val) {
+ printk("isp_k_raw_aem_shift: shift error, 0x%x\n", val);
+ }
+ REG_MWR(ISP_AEM_BLK_SIZE, 0x7C0000, 0);
+
+ return ret;
+}
+
+static int32_t isp_k_raw_aem_offset(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ struct img_offset offset;
+
+ ret = copy_from_user((void *)&offset, param->property_param, sizeof(struct img_offset));
+ if (0 != ret) {
+ printk("isp_k_raw_aem_offset: read copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ val = ((offset.y & 0xFFFF) << 16) | (offset.x & 0xFFFF);
+ REG_WR(ISP_AEM_OFFSET, val);
+
+ return ret;
+}
+
+static int32_t isp_k_raw_aem_blk_size(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ struct isp_img_size size;
+ uint32_t val = 0;
+
+ ret = copy_from_user((void *)&size, param->property_param, sizeof(struct isp_img_size));
+ if (0 != ret) {
+ printk("isp_k_raw_aem_blk_size: read copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ val = ((size.height & 0x1FF) << 9) | (size.width & 0x1FF);
+ REG_MWR(ISP_AEM_BLK_SIZE, 0x3FFFF, val);
+
+ return ret;
+}
+
+static int32_t isp_k_raw_aem_slice_size(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ struct isp_img_size size;
+ uint32_t val = 0;
+
+ ret = copy_from_user((void *)&size, param->property_param, sizeof(struct isp_img_size));
+ if (0 != ret) {
+ printk("isp_k_raw_aem_slice_size: read copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ val = ((size.height & 0xFFFF) << 16) | (size.width & 0xFFFF);
+ REG_WR(ISP_AEM_SLICE_SIZE, val);
+
+ return ret;
+}
+
+int32_t isp_k_cfg_raw_aem(struct isp_io_param *param,
+ struct isp_k_private *isp_private)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_raw_aem: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_raw_aem: property_param is null error.\n");
+ return -1;
+ }
+
+ switch (param->property) {
+ case ISP_PRO_RAW_AEM_BLOCK:
+ ret = isp_k_raw_aem_block(param);
+ break;
+ case ISP_PRO_RAW_AEM_BYPASS:
+ ret = isp_k_raw_aem_bypass(param);
+ break;
+ case ISP_PRO_RAW_AEM_MODE:
+ ret = isp_k_raw_aem_mode(param);
+ break;
+ case ISP_PRO_RAW_AEM_STATISTICS:
+ ret = isp_k_raw_aem_statistics(param, isp_private);
+ break;
+ case ISP_PRO_RAW_AEM_SKIP_NUM:
+ ret = isp_k_raw_aem_skip_num(param);
+ break;
+ case ISP_PRO_RAW_AEM_SHIFT:
+ ret = isp_k_raw_aem_shift(param);
+ break;
+ case ISP_PRO_RAW_AEM_OFFSET:
+ ret = isp_k_raw_aem_offset(param);
+ break;
+ case ISP_PRO_RAW_AEM_BLK_SIZE:
+ ret = isp_k_raw_aem_blk_size(param);
+ break;
+ case ISP_PRO_RAW_AEM_SLICE_SIZE:
+ ret = isp_k_raw_aem_slice_size(param);
+ break;
+ default:
+ printk("isp_k_cfg_raw_aem: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_raw_afm.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_raw_afm.c
new file mode 100644
index 00000000..b3f97c3f
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_raw_afm.c
@@ -0,0 +1,497 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+#define ISP_AFM_WIN_NUM_V1 25
+static int32_t isp_k_raw_afm_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ uint32_t i = 0;
+ int max_num = ISP_AFM_WIN_NUM_V1;
+ struct isp_dev_rgb_afm_info_v1 rafm_info;
+
+ memset(&rafm_info, 0x00, sizeof(rafm_info));
+
+ ret = copy_from_user((void *)&rafm_info, param->property_param, sizeof(rafm_info));
+ if (0 != ret) {
+ printk("isp_k_raw_afm_block: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_RGB_AFM_PARAM, BIT_0, rafm_info.bypass);
+
+ REG_MWR(ISP_RGB_AFM_PARAM, BIT_1, rafm_info.mode << 1);
+
+ REG_MWR(ISP_RGB_AFM_PARAM, 0xF<<2, (rafm_info.skip_num << 2));
+
+ REG_MWR(ISP_RGB_AFM_PARAM, BIT_6, rafm_info.skip_num_clear << 6);
+
+ REG_MWR(ISP_RGB_AFM_PARAM, BIT_7, rafm_info.spsmd_rtgbot_enable << 7);
+
+ REG_MWR(ISP_RGB_AFM_PARAM, BIT_8, rafm_info.spsmd_diagonal_enable << 8);
+
+ REG_MWR(ISP_RGB_AFM_PARAM, BIT_9, rafm_info.spsmd_cal_mode << 9);
+
+ REG_MWR(ISP_RGB_AFM_PARAM, BIT_10, rafm_info.af_sel_filter1 << 10);
+
+ REG_MWR(ISP_RGB_AFM_PARAM, BIT_11, rafm_info.af_sel_filter2 << 11);
+
+ REG_MWR(ISP_RGB_AFM_PARAM, BIT_12, rafm_info.sobel_type << 12);
+
+ REG_MWR(ISP_RGB_AFM_PARAM, (BIT_13)|(BIT_14), rafm_info.spsmd_type << 13);
+
+ val = ((rafm_info.sobel_threshold_max << 16) & 0xffff0000)
+ | (rafm_info.sobel_threshold_min & 0xffff);
+ REG_WR(ISP_RGB_AFM_SOBEL_THRESHOLD, val);
+
+ REG_WR(ISP_RGB_AFM_SPSMD_THRESHOLD_MIN, rafm_info.spsmd_threshold_min);
+ REG_WR(ISP_RGB_AFM_SPSMD_THRESHOLD_MAX, rafm_info.spsmd_threshold_max);
+
+ for (i = 0; i < max_num; i++) {
+ val = ((rafm_info.coord[i].start_y <<16) & 0xffff0000)
+ | (rafm_info.coord[i].start_x & 0xffff);
+ REG_WR((ISP_RGB_AFM_WIN_RANGE0 + 4*2*i), val);
+
+ val = ((rafm_info.coord[i].end_y <<16) & 0xffff0000)
+ | (rafm_info.coord[i].end_x & 0xffff);
+ REG_WR((ISP_RGB_AFM_WIN_RANGE0 + 4*(2*i+1)), val);
+ }
+
+ return ret;
+
+}
+
+static int32_t isp_k_raw_afm_frame_range(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ struct isp_img_size frame_size = {0, 0};
+ uint32_t val = 0;
+
+ ret = copy_from_user((void *)&frame_size, param->property_param, sizeof(frame_size));
+ if (0 != ret) {
+ printk("isp_k_raw_afm_frame_range: read copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ val = (frame_size.height & 0xFFFF) | ((frame_size.width & 0xFFFF) << 16);
+ REG_WR(ISP_RGB_AFM_FRAME_RANGE, val);
+ return ret;
+}
+
+static int32_t isp_k_raw_afm_type1_statistic(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ int i = 0;
+ int max_item = ISP_AFM_WIN_NUM_V1;
+ struct isp_raw_afm_statistic item;
+
+ memset(&item, 0, sizeof(struct isp_raw_afm_statistic));
+ for (i = 0; i < max_item; i++) {
+ item.val[i] = REG_RD((ISP_RGB_AFM_TYPE1_VAL00 + 4*i));
+ }
+ ret = copy_to_user(param->property_param, (void*)&item, sizeof(item));
+ if (0 != ret) {
+ ret = -1;
+ printk("isp_k_raw_afm_statistic: copy_to_user error, ret = 0x%x\n", (uint32_t)ret);
+ }
+
+ return ret;
+}
+
+static int32_t isp_k_raw_afm_type2_statistic(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ int i = 0;
+ int max_item = ISP_AFM_WIN_NUM_V1;
+ struct isp_raw_afm_statistic item;
+
+ memset(&item, 0, sizeof(struct isp_raw_afm_statistic));
+ for (i = 0; i < max_item; i++) {
+ item.val[i] = REG_RD((ISP_RGB_AFM_TYPE2_VAL00 + 4*i));
+ }
+ ret = copy_to_user(param->property_param, (void*)&item, sizeof(item));
+ if (0 != ret) {
+ ret = -1;
+ printk("isp_k_raw_afm_statistic: copy_to_user error, ret = 0x%x\n", (uint32_t)ret);
+ }
+
+ return ret;
+}
+
+static int32_t isp_k_raw_afm_bypass(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t bypass = 0;
+
+ ret = copy_from_user((void *)&bypass, param->property_param, sizeof(bypass));
+ if (0 != ret) {
+ printk("isp_k_raw_afm_bypass: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ if (bypass) {
+ REG_OWR(ISP_RGB_AFM_PARAM, BIT_0);
+ } else {
+ REG_MWR(ISP_RGB_AFM_PARAM, BIT_0, 0);
+ }
+
+ return ret;
+}
+
+static int32_t isp_k_raw_afm_mode(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t mode = 0;
+
+ ret = copy_from_user((void *)&mode, param->property_param, sizeof(mode));
+ if (0 != ret) {
+ printk("isp_k_raw_afm_mode: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ if (mode) {
+ REG_OWR(ISP_RGB_AFM_PARAM, BIT_1);
+ } else {
+ REG_MWR(ISP_RGB_AFM_PARAM, BIT_1, 0);
+ }
+
+ return ret;
+}
+
+static int32_t isp_k_raw_afm_skip_num(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t skip_num = 0;
+
+ ret = copy_from_user((void *)&skip_num, param->property_param, sizeof(skip_num));
+ if (0 != ret) {
+ printk("isp_k_raw_afm_skip_num: read copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_RGB_AFM_PARAM, 0xF<<2, (skip_num <<2));
+
+ return ret;
+}
+
+static int32_t isp_k_raw_afm_skip_num_clr(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t is_clear = 0;
+
+ ret = copy_from_user((void *)&is_clear, param->property_param, sizeof(is_clear));
+ if (0 != ret) {
+ printk("isp_k_raw_afm_skip_num_clr: read copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ if (is_clear) {
+ REG_OWR(ISP_RGB_AFM_PARAM, BIT_6);
+ } else {
+ REG_MWR(ISP_RGB_AFM_PARAM, BIT_6, 0);
+ }
+
+ return ret;
+}
+
+static int32_t isp_k_raw_afm_spsmd_rtgbot_enable(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t is_enable = 0;
+
+ ret = copy_from_user((void *)&is_enable, param->property_param, sizeof(is_enable));
+ if (0 != ret) {
+ printk("isp_k_raw_afm_spsmd_rtgbot_enable: read copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ if (is_enable) {
+ REG_OWR(ISP_RGB_AFM_PARAM, BIT_7);
+ } else {
+ REG_MWR(ISP_RGB_AFM_PARAM, BIT_7, 0);
+ }
+
+ return ret;
+}
+
+static int32_t isp_k_raw_afm_spsmd_diagonal_enable(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t is_enable = 0;
+
+ ret = copy_from_user((void *)&is_enable, param->property_param, sizeof(is_enable));
+ if (0 != ret) {
+ printk("isp_k_raw_afm_spsmd_diagonal_enable: read copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ if (is_enable) {
+ REG_OWR(ISP_RGB_AFM_PARAM, BIT_8);
+ } else {
+ REG_MWR(ISP_RGB_AFM_PARAM, BIT_8, 0);
+ }
+
+ return ret;
+}
+
+static int32_t isp_k_raw_afm_spsmd_cal_mode(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t cal_mode = 0;
+
+ ret = copy_from_user((void *)&cal_mode, param->property_param, sizeof(cal_mode));
+ if (0 != ret) {
+ printk("isp_k_raw_afm_spsmd_cal_mode: read copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+ if (cal_mode) {
+ REG_OWR(ISP_RGB_AFM_PARAM, BIT_9);
+ } else {
+ REG_MWR(ISP_RGB_AFM_PARAM, BIT_9, 0);
+ }
+ return ret;
+}
+
+static int32_t isp_k_raw_afm_sel_filter1(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t af_sel_filter = 0;
+
+ ret = copy_from_user((void *)&af_sel_filter, param->property_param, sizeof(af_sel_filter));
+ if (0 != ret) {
+ printk("isp_k_raw_afm_sel_filter1: read copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+ if (af_sel_filter) {
+ REG_OWR(ISP_RGB_AFM_PARAM, BIT_10);
+ } else {
+ REG_MWR(ISP_RGB_AFM_PARAM, BIT_10, 0);
+ }
+
+ return ret;
+}
+
+static int32_t isp_k_raw_afm_sel_filter2(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t af_sel_filter = 0;
+
+ ret = copy_from_user((void *)&af_sel_filter, param->property_param, sizeof(af_sel_filter));
+ if (0 != ret) {
+ printk("isp_k_raw_afm_sel_filter2: read copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+ if (af_sel_filter) {
+ REG_OWR(ISP_RGB_AFM_PARAM, BIT_11);
+ } else {
+ REG_MWR(ISP_RGB_AFM_PARAM, BIT_11, 0);
+ }
+
+ return ret;
+}
+
+static int32_t isp_k_raw_afm_sobel_type(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t sobel_type = 0;
+
+ ret = copy_from_user((void *)&sobel_type, param->property_param, sizeof(sobel_type));
+ if (0 != ret) {
+ printk("isp_k_raw_afm_sel_filter2: read copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ if (sobel_type) {
+ REG_OWR(ISP_RGB_AFM_PARAM, BIT_12);
+ } else {
+ REG_MWR(ISP_RGB_AFM_PARAM, BIT_12, 0);
+ }
+
+ return ret;
+}
+
+static int32_t isp_k_raw_afm_spsmd_type(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t spsmd_type = 0;
+
+ ret = copy_from_user((void *)&spsmd_type, param->property_param, sizeof(spsmd_type));
+ if (0 != ret) {
+ printk("isp_k_raw_afm_sel_filter2: read copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_RGB_AFM_PARAM, (BIT_13)|(BIT_14), spsmd_type<<13);
+ return ret;
+}
+
+static int32_t isp_k_raw_afm_sobel_threshold(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ struct sobel_thrd sobel_threshold = {0, 0};
+
+ ret = copy_from_user((void *)&sobel_threshold, param->property_param, sizeof(sobel_threshold));
+ if (0 != ret) {
+ printk("isp_k_raw_afm_sel_filter2: read copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+ val = ((sobel_threshold.max<<16) & 0xffff0000)
+ | (sobel_threshold.min & 0xffff);
+ REG_WR(ISP_RGB_AFM_SOBEL_THRESHOLD, val);
+ return ret;
+}
+
+static int32_t isp_k_raw_afm_spsmd_threshold(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ struct spsmd_thrd spsmd_threshold = {0, 0};
+
+ ret = copy_from_user((void *)&spsmd_threshold, param->property_param, sizeof(spsmd_threshold));
+ if (0 != ret) {
+ printk("isp_k_raw_afm_spsmd_threshold: read copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+ REG_WR(ISP_RGB_AFM_SPSMD_THRESHOLD_MIN, spsmd_threshold.min);
+ REG_WR(ISP_RGB_AFM_SPSMD_THRESHOLD_MAX, spsmd_threshold.max);
+ return ret;
+}
+
+static int32_t isp_k_raw_afm_win(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ int i = 0;
+ int max_num = ISP_AFM_WIN_NUM_V1;
+ struct isp_coord coord[ISP_AFM_WIN_NUM_V1];
+ uint32_t val = 0;
+
+
+ memset(coord, 0, sizeof(coord));
+ ret = copy_from_user((void *)&coord, param->property_param, sizeof(coord));
+ if (0 != ret) {
+ printk("isp_k_raw_afm_win: read copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ for (i = 0; i < max_num; i++) {
+ val = ((coord[i].start_y <<16) & 0xffff0000)
+ | (coord[i].start_x & 0xffff);
+ REG_WR((ISP_RGB_AFM_WIN_RANGE0 + 4*2*i), val);
+
+ val = ((coord[i].end_y <<16) & 0xffff0000)
+ | (coord[i].end_x & 0xffff);
+ REG_WR((ISP_RGB_AFM_WIN_RANGE0 + 4*(2*i+1)), val);
+ }
+
+ return ret;
+}
+
+
+static int32_t isp_k_raw_afm_win_num(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t num = ISP_AFM_WIN_NUM_V1;
+
+ ret = copy_to_user(param->property_param, (void*)&num, sizeof(num));
+ if (0 != ret) {
+ ret = -1;
+ printk("isp_k_raw_afm_win_num: copy_to_user error, ret = 0x%x\n", (uint32_t)ret);
+ }
+
+ return ret;
+}
+
+int32_t isp_k_cfg_rgb_afm(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_afm: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_afm: property_param is null error.\n");
+ return -1;
+ }
+
+ switch (param->property) {
+ case ISP_PRO_RGB_AFM_BLOCK:
+ ret = isp_k_raw_afm_block(param);
+ break;
+ case ISP_PRO_RGB_AFM_FRAME_SIZE:
+ ret = isp_k_raw_afm_frame_range(param);
+ break;
+ case ISP_PRO_RGB_AFM_TYPE1_STATISTIC:
+ ret = isp_k_raw_afm_type1_statistic(param);
+ break;
+ case ISP_PRO_RGB_AFM_TYPE2_STATISTIC:
+ ret = isp_k_raw_afm_type2_statistic(param);
+ break;
+ case ISP_PRO_RGB_AFM_BYPASS:
+ ret = isp_k_raw_afm_bypass(param);
+ break;
+ case ISP_PRO_RGB_AFM_MODE:
+ ret = isp_k_raw_afm_mode(param);
+ break;
+ case ISP_PRO_RGB_AFM_SKIP_NUM:
+ ret = isp_k_raw_afm_skip_num(param);
+ break;
+ case ISP_PRO_RGB_AFM_SKIP_NUM_CLR:
+ ret = isp_k_raw_afm_skip_num_clr(param);
+ break;
+ case ISP_PRO_RGB_AFM_SPSMD_RTGBOT_ENABLE:
+ ret = isp_k_raw_afm_spsmd_rtgbot_enable(param);
+ break;
+ case ISP_PRO_RGB_AFM_SPSMD_DIAGONAL_ENABLE:
+ ret = isp_k_raw_afm_spsmd_diagonal_enable(param);
+ break;
+ case ISP_PRO_RGB_AFM_SPSMD_CAL_MOD:
+ ret = isp_k_raw_afm_spsmd_cal_mode(param);
+ break;
+ case ISP_PRO_RGB_AFM_SEL_FILTER1:
+ ret = isp_k_raw_afm_sel_filter1(param);
+ break;
+ case ISP_PRO_RGB_AFM_SEL_FILTER2:
+ ret = isp_k_raw_afm_sel_filter2(param);
+ break;
+ case ISP_PRO_RGB_AFM_SOBEL_TYPE:
+ ret = isp_k_raw_afm_sobel_type(param);
+ break;
+ case ISP_PRO_RGB_AFM_SPSMD_TYPE:
+ ret = isp_k_raw_afm_spsmd_type(param);
+ break;
+ case ISP_PRO_RGB_AFM_SOBEL_THRESHOLD:
+ ret = isp_k_raw_afm_sobel_threshold(param);
+ break;
+ case ISP_PRO_RGB_AFM_SPSMD_THRESHOLD:
+ ret = isp_k_raw_afm_spsmd_threshold(param);
+ break;
+ case ISP_PRO_RGB_AFM_WIN:
+ ret = isp_k_raw_afm_win(param);
+ break;
+ case ISP_PRO_RGB_AFM_WIN_NUM:
+ ret = isp_k_raw_afm_win_num(param);
+ break;
+ default:
+ printk("isp_k_cfg_afm: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_rgb2y.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_rgb2y.c
new file mode 100644
index 00000000..3cc48264
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_rgb2y.c
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_rgb2y_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ struct isp_dev_rgb2y_info rgb2y_info;
+
+ memset(&rgb2y_info, 0x00, sizeof(rgb2y_info));
+
+ ret = copy_from_user((void *)&rgb2y_info, param->property_param, sizeof(rgb2y_info));
+ if (0 != ret) {
+ printk("isp_k_rgb2y_block: copy error, ret = 0x%x \n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_Y_RGB2Y_PARAM, 0x3, rgb2y_info.signal_sel);
+
+ return -1;
+}
+
+int32_t isp_k_cfg_rgb2y(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_rgb2y: param is null error \n");
+ return -1;
+ }
+
+ if (!param->property_param) {
+ printk("isp_k_cfg_rgb2y: property_param is null error \n");
+ return -1;
+ }
+
+ switch (param->property) {
+ case ISP_PRO_RGB2Y_BLOCK:
+ ret = isp_k_rgb2y_block(param);
+ break;
+ default:
+ printk("isp_k_cfg_rgb2y: fail cmd id %d, not supported \n", param->property);
+ break;
+ }
+
+ return ret;
+} \ No newline at end of file
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_rgb_afm.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_rgb_afm.c
new file mode 100644
index 00000000..25f8326b
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_rgb_afm.c
@@ -0,0 +1,415 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+
+#define ISP_AFM_WIN_NUM_V1 25
+
+static int32_t isp_k_rgb_afm_bypass(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t bypass = 0;
+
+ ret = copy_from_user((void *)&bypass, param->property_param, sizeof(bypass));
+ if (0 != ret) {
+ printk("isp_k_rgb_afm_bypass: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ if (bypass) {
+ REG_OWR(ISP_RGB_AFM_PARAM, BIT_0);
+ } else {
+ REG_MWR(ISP_RGB_AFM_PARAM, BIT_0, 0);
+ }
+
+ return ret;
+}
+
+static int32_t isp_k_rgb_afm_mode(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t mode = 0;
+
+ ret = copy_from_user((void *)&mode, param->property_param, sizeof(mode));
+ if (0 != ret) {
+ printk("isp_k_rgb_afm_mode: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ if (mode) {
+ REG_OWR(ISP_RGB_AFM_PARAM, BIT_1);
+ } else {
+ REG_MWR(ISP_RGB_AFM_PARAM, BIT_1, 0);
+ }
+
+ return ret;
+}
+
+static int32_t isp_k_rgb_afm_skip_num(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t skip_num = 0;
+
+ ret = copy_from_user((void *)&skip_num, param->property_param, sizeof(skip_num));
+ if (0 != ret) {
+ printk("isp_k_rgb_afm_skip_num: read copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_RGB_AFM_PARAM, 0xF<<2, (skip_num <<2));
+
+ return ret;
+}
+
+static int32_t isp_k_rgb_afm_skip_num_clr(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t is_clear = 0;
+
+ ret = copy_from_user((void *)&is_clear, param->property_param, sizeof(is_clear));
+ if (0 != ret) {
+ printk("isp_k_rgb_afm_skip_num_clr: read copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ if (is_clear) {
+ REG_OWR(ISP_RGB_AFM_PARAM, BIT_6);
+ } else {
+ REG_MWR(ISP_RGB_AFM_PARAM, BIT_6, 0);
+ }
+
+ return ret;
+}
+
+static int32_t isp_k_rgb_afm_spsmd_rtgbot_enable(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t is_enable = 0;
+
+ ret = copy_from_user((void *)&is_enable, param->property_param, sizeof(is_enable));
+ if (0 != ret) {
+ printk("isp_k_rgb_afm_spsmd_rtgbot_enable: read copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ if (is_enable) {
+ REG_OWR(ISP_RGB_AFM_PARAM, BIT_7);
+ } else {
+ REG_MWR(ISP_RGB_AFM_PARAM, BIT_7, 0);
+ }
+
+ return ret;
+}
+
+static int32_t isp_k_rgb_afm_spsmd_diagonal_enable(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t is_enable = 0;
+
+ ret = copy_from_user((void *)&is_enable, param->property_param, sizeof(is_enable));
+ if (0 != ret) {
+ printk("isp_k_rgb_afm_spsmd_diagonal_enable: read copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ if (is_enable) {
+ REG_OWR(ISP_RGB_AFM_PARAM, BIT_8);
+ } else {
+ REG_MWR(ISP_RGB_AFM_PARAM, BIT_8, 0);
+ }
+
+ return ret;
+}
+
+static int32_t isp_k_rgb_afm_spsmd_cal_mode(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t cal_mode = 0;
+
+ ret = copy_from_user((void *)&cal_mode, param->property_param, sizeof(cal_mode));
+ if (0 != ret) {
+ printk("isp_k_rgb_afm_spsmd_cal_mode: read copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+ if (cal_mode) {
+ REG_OWR(ISP_RGB_AFM_PARAM, BIT_9);
+ } else {
+ REG_MWR(ISP_RGB_AFM_PARAM, BIT_9, 0);
+ }
+ return ret;
+}
+
+static int32_t isp_k_rgb_afm_sel_filter1(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t af_sel_filter = 0;
+
+ ret = copy_from_user((void *)&af_sel_filter, param->property_param, sizeof(af_sel_filter));
+ if (0 != ret) {
+ printk("isp_k_rgb_afm_sel_filter1: read copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+ if (af_sel_filter) {
+ REG_OWR(ISP_RGB_AFM_PARAM, BIT_10);
+ } else {
+ REG_MWR(ISP_RGB_AFM_PARAM, BIT_10, 0);
+ }
+
+ return ret;
+}
+
+static int32_t isp_k_rgb_afm_sel_filter2(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t af_sel_filter = 0;
+
+ ret = copy_from_user((void *)&af_sel_filter, param->property_param, sizeof(af_sel_filter));
+ if (0 != ret) {
+ printk("isp_k_rgb_afm_sel_filter2: read copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+ if (af_sel_filter) {
+ REG_OWR(ISP_RGB_AFM_PARAM, BIT_11);
+ } else {
+ REG_MWR(ISP_RGB_AFM_PARAM, BIT_11, 0);
+ }
+
+ return ret;
+}
+
+static int32_t isp_k_rgb_afm_sobel_type(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t sobel_type = 0;
+
+ ret = copy_from_user((void *)&sobel_type, param->property_param, sizeof(sobel_type));
+ if (0 != ret) {
+ printk("isp_k_rgb_afm_sel_filter2: read copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ if (sobel_type) {
+ REG_OWR(ISP_RGB_AFM_PARAM, BIT_12);
+ } else {
+ REG_MWR(ISP_RGB_AFM_PARAM, BIT_12, 0);
+ }
+
+ return ret;
+}
+
+static int32_t isp_k_rgb_afm_spsmd_type(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t spsmd_type = 0;
+
+ ret = copy_from_user((void *)&spsmd_type, param->property_param, sizeof(spsmd_type));
+ if (0 != ret) {
+ printk("isp_k_rgb_afm_sel_filter2: read copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_RGB_AFM_PARAM, (BIT_13)|(BIT_14), spsmd_type<<13);
+ return ret;
+}
+
+static int32_t isp_k_rgb_afm_sobel_threshold(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ struct sobel_thrd sobel_threshold = {0, 0};
+
+ ret = copy_from_user((void *)&sobel_threshold, param->property_param, sizeof(sobel_threshold));
+ if (0 != ret) {
+ printk("isp_k_rgb_afm_sel_filter2: read copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+ val = ((sobel_threshold.max<<16) & 0xffff0000)
+ | (sobel_threshold.min & 0xffff);
+ REG_WR(ISP_RGB_AFM_SOBEL_THRESHOLD, val);
+ return ret;
+}
+
+static int32_t isp_k_rgb_afm_spsmd_threshold(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ struct spsmd_thrd spsmd_threshold = {0, 0};
+
+ ret = copy_from_user((void *)&spsmd_threshold, param->property_param, sizeof(spsmd_threshold));
+ if (0 != ret) {
+ printk("isp_k_rgb_afm_spsmd_threshold: read copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+ REG_WR(ISP_RGB_AFM_SPSMD_THRESHOLD_MIN, spsmd_threshold.min);
+ REG_WR(ISP_RGB_AFM_SPSMD_THRESHOLD_MAX, spsmd_threshold.max);
+ return ret;
+}
+
+static int32_t isp_k_rgb_afm_frame_range(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ struct frm_size frame_size = {0, 0};
+ uint32_t val = 0;
+
+ ret = copy_from_user((void *)&frame_size, param->property_param, sizeof(frame_size));
+ if (0 != ret) {
+ printk("isp_k_rgb_afm_frame_range: read copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ val = (frame_size.height & 0xFFFF) | ((frame_size.width & 0xFFFF) << 16);
+ REG_WR(ISP_RGB_AFM_FRAME_RANGE, val);
+ return ret;
+}
+
+static int32_t isp_k_rgb_afm_win(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ int i = 0;
+ int max_num = ISP_AFM_WIN_NUM_V1;
+ struct isp_coord coord[ISP_AFM_WIN_NUM_V1];
+ uint32_t val = 0;
+
+
+ memset(coord, 0, sizeof(coord));
+ ret = copy_from_user((void *)&coord, param->property_param, sizeof(coord));
+ if (0 != ret) {
+ printk("isp_k_rgb_afm_win: read copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ for (i = 0; i < max_num; i++) {
+ val = ((coord[i].start_y <<16) & 0xffff0000)
+ | (coord[i].start_x & 0xffff);
+ REG_WR((ISP_RGB_AFM_WIN_RANGE0 + 4*2*i), val);
+
+ val = ((coord[i].end_y <<16) & 0xffff0000)
+ | (coord[i].end_x & 0xffff);
+ REG_WR((ISP_RGB_AFM_WIN_RANGE0 + 4*(2*i+1)), val);
+ }
+
+ return ret;
+}
+
+
+static int32_t isp_k_rgb_afm_statistic(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ int i = 0;
+ int max_item = ISP_AFM_WIN_NUM_V1;
+ struct afm_statistic item[ISP_AFM_WIN_NUM_V1];
+ uint32_t val = 0;
+ memset(item, 0, sizeof(item));
+ for (i = 0; i < max_item; i++) {
+ val = REG_RD((ISP_RGB_AFM_TYPE1_VAL00 + 4*i));
+ item[i].val = val;
+ }
+ ret = copy_to_user(param->property_param, (void*)&item, sizeof(item));
+ if (0 != ret) {
+ ret = -1;
+ printk("isp_k_rgb_afm_statistic: copy_to_user error, ret = 0x%x\n", (uint32_t)ret);
+ }
+
+ return ret;
+}
+
+static int32_t isp_k_rgb_afm_win_num(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t num = ISP_AFM_WIN_NUM_V1;
+
+ ret = copy_to_user(param->property_param, (void*)&num, sizeof(num));
+ if (0 != ret) {
+ ret = -1;
+ printk("isp_k_rgb_afm_win_num: copy_to_user error, ret = 0x%x\n", (uint32_t)ret);
+ }
+
+ return ret;
+}
+
+int32_t isp_k_cfg_rgb_afm(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_afm: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_afm: property_param is null error.\n");
+ return -1;
+ }
+
+ switch (param->property) {
+ case ISP_PRO_RGB_AFM_BYPASS:
+ ret = isp_k_rgb_afm_bypass(param);
+ break;
+ case ISP_PRO_RGB_AFM_MODE:
+ ret = isp_k_rgb_afm_mode(param);
+ break;
+ case ISP_PRO_RGB_AFM_SKIP_NUM:
+ ret = isp_k_rgb_afm_skip_num(param);
+ break;
+ case ISP_PRO_RGB_AFM_SKIP_NUM_CLR:
+ ret = isp_k_rgb_afm_skip_num_clr(param);
+ break;
+ case ISP_PRO_RGB_AFM_SPSMD_RTGBOT_ENABLE:
+ ret = isp_k_rgb_afm_spsmd_rtgbot_enable(param);
+ break;
+ case ISP_PRO_RGB_AFM_SPSMD_DIAGONAL_ENABLE:
+ ret = isp_k_rgb_afm_spsmd_diagonal_enable(param);
+ break;
+ case ISP_PRO_RGB_AFM_SPSMD_CAL_MOD:
+ ret = isp_k_rgb_afm_spsmd_cal_mode(param);
+ break;
+ case ISP_PRO_RGB_AFM_SPSMD_SEL_FILTER1:
+ ret = isp_k_rgb_afm_sel_filter1(param);
+ break;
+ case ISP_PRO_RGB_AFM_SPSMD_SEL_FILTER2:
+ ret = isp_k_rgb_afm_sel_filter2(param);
+ break;
+ case ISP_PRO_RGB_AFM_SOBEL_TYPE:
+ ret = isp_k_rgb_afm_sobel_type(param);
+ break;
+ case ISP_PRO_RGB_AFM_SPSMD_TYPE:
+ ret = isp_k_rgb_afm_spsmd_type(param);
+ break;
+ case ISP_PRO_RGB_AFM_SOBEL_THRESHOLD:
+ ret = isp_k_rgb_afm_sobel_threshold(param);
+ break;
+ case ISP_PRO_RGB_AFM_SPSMD_THRESHOLD:
+ ret = isp_k_rgb_afm_spsmd_threshold(param);
+ break;
+ case ISP_PRO_RGB_AFM_FRAME_RANGE:
+ ret = isp_k_rgb_afm_frame_range(param);
+ break;
+ case ISP_PRO_RGB_AFM_WIN:
+ ret = isp_k_rgb_afm_win(param);
+ break;
+ case ISP_PRO_RGB_AFM_STATISTIC:
+ ret = isp_k_rgb_afm_statistic(param);
+ break;
+ case ISP_PRO_RGB_AFM_WIN_NUM:
+ ret = isp_k_rgb_afm_win_num(param);
+ break;
+ default:
+ printk("isp_k_cfg_afm: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_rgb_gain.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_rgb_gain.c
new file mode 100644
index 00000000..5cc2c554
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_rgb_gain.c
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_rgb_gain_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ struct isp_dev_rgb_gain_info_v1 gain_info;
+
+ ret = copy_from_user((void *)&gain_info, param->property_param, sizeof(gain_info));
+ if (0 != ret) {
+ printk("isp_k_rgb_gain_block: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ val = (gain_info.global_gain & 0xFFFF) << 16;
+ REG_MWR(ISP_RGBG_PARAM, 0xFFFF0000, val);
+
+ val = ((gain_info.r_gain & 0xFFFF) << 16) | (gain_info.b_gain & 0xFFFF);
+ REG_WR(ISP_RGBG_RB, val);
+ val = gain_info.g_gain & 0xFFFF;
+ REG_WR(ISP_RGBG_G, val);
+
+ REG_MWR(ISP_RGBG_PARAM, BIT_0, gain_info.bypass);
+
+ return ret;
+
+}
+
+int32_t isp_k_cfg_rgb_gain(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_rgb_gain: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_rgb_gain: property_param is null error.\n");
+ return -1;
+ }
+
+ switch(param->property) {
+ case ISP_PRO_RGB_GAIN_BLOCK:
+ ret = isp_k_rgb_gain_block(param);
+ break;
+ default:
+ printk("isp_k_cfg_rgb_gain: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_rgb_gain2.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_rgb_gain2.c
new file mode 100644
index 00000000..a8b31537
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_rgb_gain2.c
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_rgb_gain2_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ struct isp_dev_rgb_gain2_info gain_info;
+
+ ret = copy_from_user((void *)&gain_info, param->property_param, sizeof(gain_info));
+ if (0 != ret) {
+ printk("isp_k_rgb_gain2_block: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ val = ((gain_info.r_gain & 0xFF) << 24) | ((gain_info.g_gain & 0xFF) << 16) | ((gain_info.b_gain & 0xFF) << 8);
+ REG_MWR(ISP_RGBG2_PARAM, 0xFFFFFF00, val);
+
+ val = ((gain_info.r_offset & 0x3FF) << 20) | ((gain_info.g_offset & 0x3FF) << 10) | (gain_info.b_offset & 0x3FF);
+ REG_WR(ISP_RGBG2_OFFSET, val);
+
+ REG_MWR(ISP_RGBG2_PARAM, BIT_0, gain_info.bypass);
+
+ return ret;
+
+}
+
+int32_t isp_k_cfg_rgb_gain2(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_rgb_gain2: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_rgb_gain2: property_param is null error.\n");
+ return -1;
+ }
+
+ switch(param->property) {
+ case ISP_PRO_RGB_GAIN2_BLOCK:
+ ret = isp_k_rgb_gain2_block(param);
+ break;
+ default:
+ printk("isp_k_cfg_rgb_gain2: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_store.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_store.c
new file mode 100644
index 00000000..2ae73bec
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_store.c
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_store_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ struct isp_dev_store_info_v1 store_info;
+
+ memset(&store_info, 0x00, sizeof(store_info));
+
+ ret = copy_from_user((void *)&store_info, param->property_param, sizeof(store_info));
+ if (0 != ret) {
+ printk("isp_k_store_block: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ if (store_info.substract) {
+ REG_OWR(ISP_STORE_PARAM, BIT_1);
+ } else {
+ REG_MWR(ISP_STORE_PARAM, BIT_1, 0);
+ }
+
+ REG_MWR(ISP_STORE_PARAM, 0xF0, (store_info.color_format << 4));
+
+ REG_WR(ISP_STORE_Y_ADDR, store_info.addr.chn0);
+ REG_WR(ISP_STORE_Y_PITCH, store_info.pitch.chn0);
+ REG_WR(ISP_STORE_U_ADDR, store_info.addr.chn1);
+ REG_WR(ISP_STORE_U_PITCH, store_info.pitch.chn1);
+ REG_WR(ISP_STORE_V_ADDR, store_info.addr.chn2);
+ REG_WR(ISP_STORE_V_PITCH, store_info.pitch.chn2);
+
+ if (store_info.bypass) {
+ REG_OWR(ISP_STORE_PARAM, BIT_0);
+ } else {
+ REG_MWR(ISP_STORE_PARAM, BIT_0, 0);
+ }
+
+ return ret;
+}
+
+static int32_t isp_k_store_slice_size(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ struct isp_img_size size = {0, 0};
+
+ ret = copy_from_user((void *)&size, param->property_param, sizeof(size));
+ if (0 != ret) {
+ printk("isp_k_store_slice_size: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ val = ((size.height& 0xFFFF) << 16) | (size.width & 0xFFFF);
+ REG_WR(ISP_STORE_SLICE_SIZE, val);
+
+ return ret;
+}
+
+int32_t isp_k_cfg_store(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_store: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_store: property_param is null error.\n");
+ return -1;
+ }
+
+ switch (param->property) {
+ case ISP_PRO_STORE_BLOCK:
+ ret = isp_k_store_block(param);
+ break;
+ case ISP_PRO_STORE_SLICE_SIZE:
+ ret = isp_k_store_slice_size(param);
+ break;
+ default:
+ printk("isp_k_cfg_store: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_uv_prefilter.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_uv_prefilter.c
new file mode 100644
index 00000000..7ee3dc90
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_uv_prefilter.c
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_uv_prefilter_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ struct isp_dev_uv_prefilter_info uv_info;
+
+ memset(&uv_info, 0x00, sizeof(uv_info));
+
+ ret = copy_from_user((void *)&uv_info, param->property_param, sizeof(uv_info));
+ if (0 != ret) {
+ printk("isp_k_uv_prefilter_block: copy error, ret = 0x%x \n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_UV_PREF_PARAM, BIT_1, uv_info.writeback << 1);
+
+ val = (uv_info.nr_thr_u & 0xFF) | ((uv_info.nr_thr_v & 0xFF) << 8);
+ REG_WR(ISP_UV_PREF_THRD, val);
+
+ REG_MWR(ISP_UV_PREF_PARAM, BIT_0, uv_info.bypass);
+
+ return ret;
+}
+
+int32_t isp_k_cfg_uv_prefilter(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_uv_prefilter: param is null error \n");
+ return -1;
+ }
+
+ if (!param->property_param) {
+ printk("isp_k_cfg_uv_prefilter: property_param is null error \n");
+ return -1;
+ }
+
+ switch (param->property) {
+ case ISP_PRO_UV_PREFILTER_BLOCK:
+ ret = isp_k_uv_prefilter_block(param);
+ break;
+ default:
+ printk("isp_k_cfg_uv_prefilter: fail cmd id %d, not supported \n", param->property);
+ break;
+ }
+
+ return ret;
+}
+
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_y_delay.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_y_delay.c
new file mode 100644
index 00000000..b735c790
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_y_delay.c
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_ydelay_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ struct isp_dev_ydelay_info ydelay_info;
+
+ ret = copy_from_user((void *)&ydelay_info, param->property_param, sizeof(ydelay_info));
+ if (0 != ret) {
+ printk("isp_k_ydelay_block: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ if (ydelay_info.bypass) {
+ REG_OWR(ISP_YDELAY_PARAM, BIT_0);
+ } else {
+ REG_MWR(ISP_YDELAY_PARAM, BIT_0, 0);
+ }
+
+ return ret;
+}
+
+int32_t isp_k_cfg_ydelay(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_ydelay: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_ydelay: property_param is null error.\n");
+ return -1;
+ }
+
+ switch(param->property) {
+ case ISP_PRO_YDELAY_BLOCK:
+ ret = isp_k_ydelay_block(param);
+ break;
+ default:
+ printk("isp_k_cfg_ydelay: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_y_gamma.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_y_gamma.c
new file mode 100644
index 00000000..ea66f99d
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_y_gamma.c
@@ -0,0 +1,133 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+#include "isp_drv.h"
+
+
+#define ISP_YUV_YGAMMA_BUF0 0
+#define ISP_YUV_YGAMMA_BUF1 1
+
+static int32_t isp_k_pingpang_yuv_ygamma(struct coordinate_xy *nodes,
+ struct isp_k_private *isp_private)
+{
+ int32_t ret = 0;
+ uint32_t i = 0, j = 0;
+ unsigned long ybuf_addr = 0;
+ struct coordinate_xy *p_nodes = NULL;
+
+ if (!nodes) {
+ ret = -1;
+ printk("isp_k_pingpang_yuv_ygamma: node is null error .\n");
+ return ret;
+ }
+ p_nodes = nodes;
+
+#if 0
+ if (ISP_YUV_YGAMMA_BUF0 == isp_private->yuv_ygamma_buf_id) {
+ ybuf_addr = ISP_YGAMMA_BUF0_CH0;
+ isp_private->yuv_ygamma_buf_id = ISP_YUV_YGAMMA_BUF1;
+ } else {
+ ybuf_addr = ISP_YGAMMA_BUF0_CH0;
+ isp_private->yuv_ygamma_buf_id = ISP_YUV_YGAMMA_BUF0;
+ }
+#endif
+
+ isp_private->yuv_ygamma_buf_id = ISP_YUV_YGAMMA_BUF0;
+ if (isp_private->yuv_ygamma_buf_id) {
+ REG_OWR(ISP_YGAMMA_PARAM, BIT_1);
+ } else {
+ REG_MWR(ISP_YGAMMA_PARAM, BIT_1, 0);
+ }
+
+ ybuf_addr = ISP_YGAMMA_BUF0_CH0;
+ isp_private->yuv_ygamma_buf_id = ISP_YUV_YGAMMA_BUF1;
+
+ for (i = 0, j = 0; i < ISP_PINGPANG_YUV_YGAMMA_NUM; i++, j += 4) {
+ REG_WR(ybuf_addr + j, p_nodes[i].node_y & 0xff);
+ }
+
+ if (isp_private->yuv_ygamma_buf_id) {
+ REG_OWR(ISP_YGAMMA_PARAM, BIT_1);
+ } else {
+ REG_MWR(ISP_YGAMMA_PARAM, BIT_1, 0);
+ }
+
+ return ret;
+}
+
+static int32_t isp_k_ygamma_block(struct isp_io_param *param,
+ struct isp_k_private *isp_private)
+{
+ int32_t ret = 0;
+ uint32_t bypass;
+ struct isp_dev_ygamma_info *ygamma_info = (struct isp_dev_ygamma_info *)param->property_param;
+ struct coordinate_xy *nodes = NULL;
+
+ nodes = (struct coordinate_xy *)isp_private->yuv_ygamma_buf_addr;
+ if (!nodes) {
+ ret = -1;
+ printk("isp_k_ygamma_block: alloc memory error.\n");
+ return -1;
+ }
+
+ ret = copy_from_user((void *)&bypass, (void *)&ygamma_info->bypass, sizeof(uint32_t));
+ if (0 != ret) {
+ printk("isp_k_ygamma_block: copy bypass error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+ ret = copy_from_user((void *)nodes, (void *)ygamma_info->nodes, ISP_YUV_YGAMMA_BUF_SIZE);
+ if (0 != ret) {
+ printk("isp_k_ygamma_block: copy nodes error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ ret = isp_k_pingpang_yuv_ygamma(nodes, isp_private);
+ if (0 != ret) {
+ printk("isp_k_ygamma_block: pingpang error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+ REG_MWR(ISP_YGAMMA_PARAM, BIT_0, bypass);
+
+ return ret;
+}
+
+int32_t isp_k_cfg_ygamma(struct isp_io_param *param,
+ struct isp_k_private *isp_private)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_ygamma: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_ygamma: property_param is null error.\n");
+ return -1;
+ }
+
+ switch(param->property) {
+ case ISP_PRO_YGAMMA_BLOCK:
+ ret = isp_k_ygamma_block(param, isp_private);
+ break;
+ default:
+ printk("isp_k_cfg_ygamma: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_yiq_aem.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_yiq_aem.c
new file mode 100644
index 00000000..fe8710a9
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_yiq_aem.c
@@ -0,0 +1,121 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_yiq_aem_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ struct isp_dev_yiq_aem_info_v2 yaem_info;
+
+ memset(&yaem_info, 0x00, sizeof(yaem_info));
+
+ ret = copy_from_user((void *)&yaem_info, param->property_param, sizeof(yaem_info));
+ if (0 != ret) {
+ printk("isp_k_yiq_aem_block: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_YIQ_AEM_PARAM, BIT_7, yaem_info.ygamma_bypass << 7);
+
+ val = ((yaem_info.gamma_xnode[0] & 0xFF)<<24) | ((yaem_info.gamma_xnode[1] & 0xFF)<<16)
+ | ((yaem_info.gamma_xnode[2] & 0xFF)<<8) | (yaem_info.gamma_xnode[3] & 0xFF);
+ REG_WR(ISP_YIQ_YGAMMA_NODE_X0 , val);
+ val = ((yaem_info.gamma_xnode[4] & 0xFF)<<24) | ((yaem_info.gamma_xnode[5] & 0xFF)<<16)
+ | ((yaem_info.gamma_xnode[6] & 0xFF)<<8) | (yaem_info.gamma_xnode[7] & 0xFF);
+ REG_WR(ISP_YIQ_YGAMMA_NODE_X1 , val);
+
+ val = ((yaem_info.gamma_ynode[0] & 0xFF)<<24) | ((yaem_info.gamma_ynode[1] & 0xFF)<<16)
+ | ((yaem_info.gamma_ynode[2] & 0xFF)<<8) | (yaem_info.gamma_ynode[3] & 0xFF);
+ REG_WR( ISP_YIQ_YGAMMA_NODE_Y0 , val);
+ val = ((yaem_info.gamma_ynode[4] & 0xFF)<<24) | ((yaem_info.gamma_ynode[5] & 0xFF)<<16)
+ | ((yaem_info.gamma_ynode[6] & 0xFF)<<8) | (yaem_info.gamma_ynode[7] & 0xFF);
+ REG_WR(ISP_YIQ_YGAMMA_NODE_Y1 , val);
+ val = ((yaem_info.gamma_ynode[8] & 0xFF)<<24) | ((yaem_info.gamma_ynode[9] & 0xFF)<<16);
+ REG_WR(ISP_YIQ_YGAMMA_NODE_Y2 , val);
+
+ val = ((yaem_info.gamma_node_idx[1]&0x7) << 24) | ((yaem_info.gamma_node_idx[2]&0x7) << 21) |
+ ((yaem_info.gamma_node_idx[3]&0x7) << 18) | ((yaem_info.gamma_node_idx[4]&0x7) << 15) |
+ ((yaem_info.gamma_node_idx[5]&0x7) << 12) | ((yaem_info.gamma_node_idx[6]&0x7) << 9) |
+ ((yaem_info.gamma_node_idx[7]&0x7) << 6) | ((yaem_info.gamma_node_idx[8]&0x7) << 3) |
+ (yaem_info.gamma_node_idx[9]&0x7);
+ REG_WR( ISP_YIQ_YGAMMA_NODE_IDX, val);
+
+ REG_MWR(ISP_YIQ_AEM_PARAM, BIT_0, yaem_info.aem_bypass);
+
+ REG_MWR(ISP_YIQ_AEM_PARAM, BIT_1, yaem_info.aem_mode << 1);
+
+ REG_MWR(ISP_YIQ_AEM_PARAM, 0xF << 2, yaem_info.aem_skip_num << 2);
+
+ val = (yaem_info.offset_x & 0xFFFF) | ((yaem_info.offset_y & 0xFFFF) << 16);
+ REG_WR( ISP_YIQ_AEM_OFFSET, val);
+
+ val = (yaem_info.width& 0x1FF) | ((yaem_info.height& 0x1FF) << 9) | ((yaem_info.avgshift & 0x1F) << 18);
+ REG_WR( ISP_YIQ_AEM_BLK_SIZE, val);
+
+ return ret;
+
+}
+
+static int32_t isp_k_yiq_slice_size(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ struct isp_img_size slice_size= {0, 0};
+
+ ret = copy_from_user((void *)&slice_size, param->property_param, sizeof(slice_size));
+ if (0 != ret) {
+ printk("isp_k_ae_skip_num: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ val = (slice_size.width& 0xFFFF) | ((slice_size.height& 0xFFFF) << 16);
+ REG_WR( ISP_YIQ_AEM_SLICE_SIZE, val);
+
+
+ return ret;
+}
+
+int32_t isp_k_cfg_yiq_aem(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_yiq: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_yiq: property_param is null error.\n");
+ return -1;
+ }
+
+ switch (param->property) {
+ case ISP_PRO_YIQ_AEM_BLOCK:
+ ret = isp_k_yiq_aem_block(param);
+ break;
+ case ISP_PRO_YIQ_AEM_SLICE_SIZE:
+ ret = isp_k_yiq_slice_size(param);
+ break;
+ default:
+ printk("isp_k_cfg_yiq: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
+
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_yiq_afm.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_yiq_afm.c
new file mode 100644
index 00000000..20df0101
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_yiq_afm.c
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+#define ISP_AFM_WIN_NUM_V1 25
+
+static int32_t isp_k_yiq_afm_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ uint32_t i = 0;
+ int max_num = ISP_AFM_WIN_NUM_V1;
+ struct isp_dev_yiq_afm_info_v2 afm_info;
+
+ memset(&afm_info, 0x00, sizeof(afm_info));
+
+ ret = copy_from_user((void *)&afm_info, param->property_param, sizeof(afm_info));
+ if (0 != ret) {
+ printk("isp_k_yiq_afm_block: copy error, ret=0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_YIQ_AFM_PARAM, BIT_6, afm_info.mode << 6);
+
+ REG_MWR(ISP_YIQ_AFM_PARAM, 0x1F<<1, (afm_info.shift << 1));
+
+ REG_MWR(ISP_YIQ_AFM_PARAM, 0xF<<7, (afm_info.skip_num << 7));
+
+ REG_MWR(ISP_YIQ_AFM_PARAM, BIT_11, afm_info.skip_num_clear << 11);
+
+ REG_MWR(ISP_YIQ_AFM_PARAM, BIT_12, afm_info.af_position << 12);
+
+ REG_MWR(ISP_YIQ_AFM_PARAM, 0x7<<13, (afm_info.format << 13));
+
+ REG_MWR(ISP_YIQ_AFM_PARAM, BIT_16, afm_info.iir_bypass << 16);
+
+ for (i = 0; i < max_num; i++) {
+ val = ((afm_info.coord[i].start_y <<16) & 0xffff0000)
+ | (afm_info.coord[i].start_x & 0xffff);
+ REG_WR((ISP_YIQ_AFM_WIN_RANGE0 + 4*2*i), val);
+
+ val = ((afm_info.coord[i].end_y <<16) & 0xffff0000)
+ | (afm_info.coord[i].end_x & 0xffff);
+ REG_WR((ISP_YIQ_AFM_WIN_RANGE0 + 4*(2*i+1)), val);
+ }
+
+ for (i = 0; i < 10; i+= 2) {
+ val = (afm_info.IIR_c[i] & 0xFFF) | ((afm_info.IIR_c[i + 1] & 0xFFF) << 16);
+ REG_WR(ISP_YIQ_AFM_COEF0_1 + (i / 2) * 4, val);
+ }
+ val = afm_info.IIR_c[10] & 0xFFF;
+ REG_WR(ISP_YIQ_AFM_COEF10, val);
+
+ REG_MWR(ISP_YIQ_AFM_PARAM, BIT_0, afm_info.bypass);
+
+ return ret;
+
+}
+
+static int32_t isp_k_yiq_afm_slice_size(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ struct isp_img_size slice_size= {0, 0};
+
+ ret = copy_from_user((void *)&slice_size, param->property_param, sizeof(slice_size));
+ if (0 != ret) {
+ printk("isp_k_ae_skip_num: copy_from_user error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ val = (slice_size.width& 0xFFFF) | ((slice_size.height& 0xFFFF) << 16);
+ REG_WR( ISP_YIQ_AFM_SLICE_SIZE, val);
+
+
+ return ret;
+}
+
+int32_t isp_k_cfg_yiq_afm(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_afm: param is null error.\n");
+ return -1;
+ }
+
+ if (NULL == param->property_param) {
+ printk("isp_k_cfg_afm: property_param is null error.\n");
+ return -1;
+ }
+
+ switch (param->property) {
+ case ISP_PRO_YIQ_AFM_BLOCK:
+ ret = isp_k_yiq_afm_block(param);
+ break;
+ case ISP_PRO_YIQ_AFM_SLICE_SIZE:
+ ret = isp_k_yiq_afm_slice_size(param);
+ break;
+ default:
+ printk("isp_k_cfg_yiq_afm: fail cmd id:%d, not supported.\n", param->property);
+ break;
+ }
+
+ return ret;
+}
diff --git a/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_yuv_nlm.c b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_yuv_nlm.c
new file mode 100644
index 00000000..d0b5d063
--- /dev/null
+++ b/drivers/media/sprd_isp/isp2.0/pike/src/isp_k_yuv_nlm.c
@@ -0,0 +1,135 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include <linux/uaccess.h>
+#include <linux/sprd_mm.h>
+#include <video/sprd_isp.h>
+#include "isp_reg.h"
+
+static int32_t isp_k_yuv_nlm_block(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t i =0;
+ uint32_t val = 0;
+ struct isp_dev_yuv_nlm_info ynlm_info;
+
+ memset(&ynlm_info, 0x00, sizeof(ynlm_info));
+
+ ret = copy_from_user((void *)&ynlm_info, param->property_param, sizeof(ynlm_info));
+ if (0 != ret) {
+ printk("isp_k_yuv_nlm_block: copy error, ret = 0x%x\n", (uint32_t)ret);
+ return -1;
+ }
+
+ REG_MWR(ISP_YNLM_PARAM, BIT_0, ynlm_info.nlm_bypass);
+ REG_MWR(ISP_YNLM_PARAM, BIT_1, ynlm_info.nlm_radial_bypass << 1);
+ REG_MWR(ISP_YNLM_PARAM, BIT_2, ynlm_info.nlm_adaptive_bypass << 2);
+ REG_MWR(ISP_YNLM_PARAM, BIT_3, ynlm_info.nlm_vst_bypass << 3);
+
+ for (i = 0;i < 7; i++) {
+ val = (ynlm_info.edge_str_cmp[i] & 0x3FF) | ((ynlm_info.edge_str_req[i] & 0x7F) << 10);
+ REG_WR(ISP_YNLM_ADAPT_PARAM1 + i * 4, val);
+ }
+
+ val = (ynlm_info.edge_range_l & 0xFF) | ((ynlm_info.edge_range_h & 0xFF) << 8) |
+ ((ynlm_info.edge_time_str & 0x3) << 16) | ((ynlm_info.avg_mode & 0x3) << 18);
+ REG_WR(ISP_YNLM_ADAPT_PARAM8, val);
+
+ REG_MWR(ISP_YNLM_DEN_STERNGTH, 0x7F, ynlm_info.den_strength);
+
+ val = (ynlm_info.center_x & 0x1FFF) | ((ynlm_info.center_y & 0xFFF) << 13);
+ REG_WR(ISP_YNLM_CENTER, val);
+
+ val = ynlm_info.center_x2 & 0x3FFFFFF;
+ REG_WR(ISP_YNLM_CENTER_X2, val);
+
+ val = ynlm_info.center_y2 & 0xFFFFFF;
+ REG_WR(ISP_YNLM_CENTER_Y2, val);
+
+ val = ynlm_info.radius & 0x3FFFFFF;
+ REG_WR(ISP_YNLM_RADIUS, val);
+
+ val = (ynlm_info.radius_p1 & 0x7FF) | ((ynlm_info.radius_p2 & 0x3FFF) << 11);
+ REG_WR(ISP_YNLM_RADIUS_RANGE, val);
+
+ val = ynlm_info.gain_max & 0xFFF;
+ REG_WR(ISP_YNLM_GAIN_MAX, val);
+
+ val = (ynlm_info.start_raw & 0xFFF) | ((ynlm_info.start_col & 0x1FFF) << 12);
+ REG_WR(ISP_YNLM_IMG_PARAM1, val);
+
+ val = ynlm_info.add_back & 0x7F;
+ REG_WR(ISP_YNLM_ADD_BACK, val);
+
+ for (i = 0; i < 24; i++) {
+ val = ynlm_info.lut_w[i] & 0x3FFFFFFF;
+ REG_WR(ISP_YNLM_LUT_W_0 + i * 4, val);
+ }
+
+ for (i = 0; i < 64; i++) {
+ val = ynlm_info.lut_vs[i];
+ REG_WR(ISP_YNLM_LUT_VS_0 + i * 4, val);
+ }
+
+ REG_WR(ISP_YNLM_IMG_PARAM0, (((2592 & 0xFFF) << 12) | (1944 & 0xFFF)));
+
+ return ret;
+
+}
+
+static int32_t isp_k_yuv_nlm_slice_size(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+ uint32_t val = 0;
+ struct isp_img_size slice_size;
+
+ ret = copy_from_user((void *)&slice_size, param->property_param, sizeof(slice_size));
+ if (0 != ret) {
+ printk("isp_k_yuv_nlm_slice_size: copy_from_user error, ret = 0x%x\n",(uint32_t)ret);
+ return -1;
+ }
+
+ val = (slice_size.height & 0xFFF) | ((slice_size.width & 0x1FFF) << 12);
+ REG_WR(ISP_YNLM_IMG_PARAM0, val);
+
+ return -1;
+}
+
+int32_t isp_k_cfg_yuv_nlm(struct isp_io_param *param)
+{
+ int32_t ret = 0;
+
+ if (!param) {
+ printk("isp_k_cfg_yuv_nlm: param is null error \n");
+ return -1;
+ }
+
+ if (!param->property_param) {
+ printk("isp_k_cfg_yuv_nlm: property_param is null error \n");
+ return -1;
+ }
+
+ switch (param->property) {
+ case ISP_PRO_YUV_NLM_BLOCK:
+ ret = isp_k_yuv_nlm_block(param);
+ break;
+ case ISP_PRO_YUV_NLM_SLICE_SIZE:
+ ret = isp_k_yuv_nlm_slice_size(param);
+ break;
+ default:
+ printk("isp_k_cfg_yuv_nlm: fail cmd id is %d, not supported \n", param->property);
+ break;
+ }
+
+ return ret;
+} \ No newline at end of file