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.
15 #include <linux/uaccess.h>
16 #include <linux/sprd_mm.h>
17 #include <video/sprd_isp.h>
20 static int32_t isp_k_grgb_block(struct isp_io_param *param)
24 struct isp_dev_grgb_info_v1 grgb_info;
26 memset(&grgb_info, 0x00, sizeof(grgb_info));
28 ret = copy_from_user((void *)&grgb_info, param->property_param, sizeof(grgb_info));
30 printk("isp_k_grgb_block: copy error, ret=0x%x\n", (uint32_t)ret);
34 REG_MWR(ISP_GRGB_PARAM, BIT_0, grgb_info.bypass);
36 val = ((grgb_info.diff & 0x3FF) << 7) | ((grgb_info.edge & 0x3F) << 1);
37 REG_MWR(ISP_GRGB_PARAM, 0x1FFFE, val);
38 val = grgb_info.grid & 0xFFF;
39 REG_MWR(ISP_GRGB_GRID, 0xFFF, val);
45 int32_t isp_k_cfg_grgb(struct isp_io_param *param)
50 printk("isp_k_cfg_grgb: param is null error.\n");
54 if (NULL == param->property_param) {
55 printk("isp_k_cfg_grgb: property_param is null error.\n");
59 switch(param->property) {
60 case ISP_PRO_GRGB_BLOCK:
61 ret = isp_k_grgb_block(param);
64 printk("isp_k_cfg_grgb: fail cmd id:%d, not supported.\n", param->property);