2 * Copyright (C) 2012 Spreadtrum Communications Inc.
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
14 #include <linux/uaccess.h>
15 #include <linux/sprd_mm.h>
16 #include <video/sprd_isp.h>
19 static int32_t isp_k_pre_cdn_rgb_block(struct isp_io_param *param)
23 struct isp_dev_pre_cdn_rgb_info pcr_info;
25 memset(&pcr_info, 0x00, sizeof(pcr_info));
27 ret = copy_from_user((void *)&pcr_info, param->property_param, sizeof(pcr_info));
29 printk("isp_k_pre_cdn_rgb_block: copy error, ret=0x%x\n", (uint32_t)ret);
33 REG_MWR(ISP_PRECNRNEW_CFG, BIT_0, pcr_info.bypass);
35 REG_MWR(ISP_PRECNRNEW_CFG, 0x3 << 1, pcr_info.median_mode << 1);
37 val = pcr_info.median_thr & 0xFFFF;
38 REG_WR(ISP_PRECNRNEW_MEDIAN_THR, val);
39 val = (pcr_info.thru0 & 0xFFFF) | ((pcr_info.thru1 & 0xFFFF) << 16);
40 REG_WR(ISP_PRECNRNEW_THRU, val);
41 val = (pcr_info.thrv0 & 0xFFFF) | ((pcr_info.thrv1 & 0xFFFF) << 16);
42 REG_WR(ISP_PRECNRNEW_THRV, val);
48 int32_t isp_k_cfg_pre_cdn_rgb(struct isp_io_param *param)
53 printk("isp_k_cfg_pre_cdn_rgb: param is null error.\n");
57 if (NULL == param->property_param) {
58 printk("isp_k_cfg_pre_cdn_rgb: property_param is null error.\n");
62 switch(param->property) {
63 case ISP_PRO_PRE_CDN_RGB_BLOCK:
64 ret = isp_k_pre_cdn_rgb_block(param);
67 printk("isp_k_cfg_pre_cdn_rgb: fail cmd id:%d, not supported.\n", param->property);