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_hsv_block(struct isp_io_param *param)
24 unsigned long dst_addr = 0;
25 struct isp_dev_hsv_info_v1 hsv_info;
26 void *data_ptr = NULL;
28 memset(&hsv_info, 0x00, sizeof(hsv_info));
30 ret = copy_from_user((void *)&hsv_info, param->property_param, sizeof(hsv_info));
32 printk("isp_k_hsv_block: copy error, ret=0x%x\n", (uint32_t)ret);
37 data_ptr = (void*)(((unsigned long)hsv_info.data_ptr[1] << 32) | hsv_info.data_ptr[0]);
39 data_ptr = (void*)(hsv_info.data_ptr[0]);
42 buf_size = ISP_HSV_ITEM * 4;
43 if (NULL == data_ptr || hsv_info.size > buf_size) {
44 printk("isp_k_hsv_block : memory error %p %x \n",
45 data_ptr, hsv_info.size);
49 if (hsv_info.buf_sel << 1 & BIT_1) {
50 dst_addr = ISP_HSV_BUF1_OUTPUT;
52 dst_addr = ISP_HSV_BUF0_OUTPUT;
55 ret = copy_from_user((void *)dst_addr, data_ptr, hsv_info.size);
57 printk("isp_k_hsv_block: copy error 0x%x \n",(uint32_t)ret);
61 REG_MWR(ISP_HSV_PARAM, BIT_1, hsv_info.buf_sel << 1);
63 REG_MWR(ISP_HSV_PARAM, BIT_0, hsv_info.bypass);
70 int32_t isp_k_cfg_hsv(struct isp_io_param *param)
75 printk("isp_k_cfg_hsv: param is null error.\n");
79 if (NULL == param->property_param) {
80 printk("isp_k_cfg_hsv: property_param is null error.\n");
84 switch(param->property) {
85 case ISP_PRO_HSV_BLOCK:
86 ret = isp_k_hsv_block(param);
89 printk("isp_k_cfg_hsv: fail cmd id:%d, not supported.\n", param->property);