From 1fb6e0accb602acb355716e3ab05354c95a35a75 Mon Sep 17 00:00:00 2001 From: Jozef Kruger Date: Wed, 30 Nov 2011 12:23:47 -0800 Subject: [PATCH] [PORT FROM R2] atomisp: remove unused types from atomisp.h BZ: 17272 This patch removes types from atomisp.h that are not used in atomisp.h itself. The use of the atomisp_frame structure is replaced by v4l2_framebuffer which was introduced in v4l2 for exactly this use case. Also, since this is a v4l2 driver, we should use v4l2 constructs for frames, not introduce our own. This makes the atomisp interface smaller and easier to document. Change-Id: I819ba895ec9042145252eb0e869bd7109b3b5ae8 Orig-Change-Id: I2ffd39c3566bf86148dbdaaafe372ae15df1f345 Signed-off-by: Jozef Kruger Reviewed-on: http://android.intel.com:8080/25736 Reviewed-by: Wang, Wen W Reviewed-by: Cohen, David A Tested-by: Ilvonen, Ville Reviewed-by: buildbot Tested-by: buildbot Reviewed-on: http://android.intel.com:8080/28047 Reviewed-by: Tuominen, TeemuX Reviewed-by: Koski, Anttu Tested-by: Koski, Anttu --- drivers/media/video/atomisp/atomisp_cmd.c | 259 +++++++++++++--------------- drivers/media/video/atomisp/atomisp_cmd.h | 22 +-- drivers/media/video/atomisp/atomisp_ioctl.c | 19 +- include/linux/atomisp.h | 227 ++---------------------- include/linux/atomisp_platform.h | 28 +++ 5 files changed, 182 insertions(+), 373 deletions(-) diff --git a/drivers/media/video/atomisp/atomisp_cmd.c b/drivers/media/video/atomisp/atomisp_cmd.c index 80947d0..24fa29a 100644 --- a/drivers/media/video/atomisp/atomisp_cmd.c +++ b/drivers/media/video/atomisp/atomisp_cmd.c @@ -954,7 +954,8 @@ int atomisp_get_frame_pgnr(const struct sh_css_frame *frame, u32 * p_pgnr) /* * Get internal fmt according to V4L2 fmt */ -enum sh_css_frame_format v4l2_fmt_to_sh_fmt(u32 fmt) +static enum sh_css_frame_format +v4l2_fmt_to_sh_fmt(u32 fmt) { switch (fmt) { case V4L2_PIX_FMT_YUV420: @@ -1252,7 +1253,7 @@ int atomisp_low_light(struct atomisp_device *isp, int flag, __s32 * value) } /* - * Function to enable/disable extra nosie reduction (XNR) in low light + * Function to enable/disable extra noise reduction (XNR) in low light * condition */ int atomisp_xnr(struct atomisp_device *isp, int flag, int *arg) @@ -1270,13 +1271,11 @@ int atomisp_xnr(struct atomisp_device *isp, int flag, int *arg) } /* - * Function to configure bayer nosie reduction + * Function to configure bayer noise reduction */ -int atomisp_bayer_nr(struct atomisp_device *isp, int flag, - void *config) +int atomisp_nr(struct atomisp_device *isp, int flag, + struct atomisp_nr_config *arg) { - struct atomisp_nr_config *arg = (struct atomisp_nr_config *)config; - if (arg == NULL) return -EINVAL; @@ -1286,9 +1285,11 @@ int atomisp_bayer_nr(struct atomisp_device *isp, int flag, return -EINVAL; } - /* Get nr config from current setup */ if (flag == 0) { - memcpy(arg, &isp->params.nr_config, sizeof(*arg)); + /* Get nr config from current setup */ + const struct sh_css_nr_config *nr_config; + sh_css_get_nr_config(&nr_config); + memcpy(arg, nr_config, sizeof(*arg)); } else { /* Set nr config to isp parameters */ memcpy(&isp->params.nr_config, arg, @@ -1299,7 +1300,7 @@ int atomisp_bayer_nr(struct atomisp_device *isp, int flag, } /* - * Function to configure temporal nosie reduction (TNR) + * Function to configure temporal noise reduction (TNR) */ int atomisp_tnr(struct atomisp_device *isp, int flag, void *config) @@ -1443,38 +1444,6 @@ int atomisp_black_level(struct atomisp_device *isp, int flag, } /* - * Function to configure Ycc nosie reduction - */ -int atomisp_ycc_nr(struct atomisp_device *isp, int flag, - void *config) -{ - struct atomisp_nr_config *arg = (struct atomisp_nr_config *)config; - - if (arg == NULL) - return -EINVAL; - - if (sizeof(*arg) != sizeof(isp->params.nr_config)) { - v4l2_err(&atomisp_dev, - "%s: incompatible param.\n", __func__); - return -EINVAL; - } - - if (flag == 0) { - /* Get nr config from current setup */ - const struct sh_css_nr_config *nr_config; - sh_css_get_nr_config(&nr_config); - memcpy(arg, nr_config, sizeof(*arg)); - } else { - /* Set nr config to isp parameters */ - memcpy(&isp->params.nr_config, arg, - sizeof(isp->params.nr_config)); - sh_css_set_nr_config(&isp->params.nr_config); - } - - return 0; -} - -/* * Function to configure edge enhancement */ int atomisp_ee(struct atomisp_device *isp, int flag, @@ -1738,7 +1707,7 @@ err_dis: } static void atomisp_curr_user_grid_info(struct atomisp_device *isp, - struct atomisp_grid_info_user *info) + struct atomisp_grid_info *info) { info->s3a_width = isp->params.curr_grid_info.s3a_width; info->s3a_height = isp->params.curr_grid_info.s3a_height; @@ -2250,59 +2219,108 @@ int atomisp_fixed_pattern(struct atomisp_device *isp, int flag, __s32 * value) return 0; } -/* - * Function to configure fixed pattern noise table - */ -int atomisp_fixed_pattern_table(struct atomisp_device *isp, int flag, - void *config) +static unsigned int +atomisp_bytesperline_to_padded_width(unsigned int bytesperline, + enum sh_css_frame_format format) { - struct atomisp_frame *arg = (struct atomisp_frame *)config; - struct sh_css_frame *raw_black_frame = NULL; - struct sh_css_frame_info info; - char *tmp_buf; + switch (format) { + case SH_CSS_FRAME_FORMAT_UYVY: + case SH_CSS_FRAME_FORMAT_YUYV: + case SH_CSS_FRAME_FORMAT_RAW: + case SH_CSS_FRAME_FORMAT_RGB565: + return bytesperline/2; + case SH_CSS_FRAME_FORMAT_RGBA888: + return bytesperline/4; + /* The following cases could be removed, but we leave them + in to document the formats that are included. */ + case SH_CSS_FRAME_FORMAT_NV11: + case SH_CSS_FRAME_FORMAT_NV12: + case SH_CSS_FRAME_FORMAT_NV16: + case SH_CSS_FRAME_FORMAT_NV21: + case SH_CSS_FRAME_FORMAT_NV61: + case SH_CSS_FRAME_FORMAT_YV12: + case SH_CSS_FRAME_FORMAT_YV16: + case SH_CSS_FRAME_FORMAT_YUV420: + case SH_CSS_FRAME_FORMAT_YUV420_16: + case SH_CSS_FRAME_FORMAT_YUV422: + case SH_CSS_FRAME_FORMAT_YUV422_16: + case SH_CSS_FRAME_FORMAT_YUV444: + case SH_CSS_FRAME_FORMAT_YUV_LINE: + case SH_CSS_FRAME_FORMAT_PLANAR_RGB888: + case SH_CSS_FRAME_FORMAT_QPLANE6: + case SH_CSS_FRAME_FORMAT_BINARY_8: + default: + return bytesperline; + } +} + +static int +atomisp_v4l2_framebuffer_to_sh_css_frame(const struct v4l2_framebuffer *arg, + struct sh_css_frame **result) +{ + struct sh_css_frame *res = NULL; + unsigned int padded_width; + enum sh_css_frame_format sh_format; + char *tmp_buf = NULL; int ret = 0; - if (arg == NULL) - return -EINVAL; + sh_format = v4l2_fmt_to_sh_fmt(arg->fmt.pixelformat); + padded_width = atomisp_bytesperline_to_padded_width( + arg->fmt.bytesperline, sh_format); - if (sizeof(*arg) != sizeof(*raw_black_frame)) { - v4l2_err(&atomisp_dev, - "%s: incompatible param.\n", __func__); - return -EINVAL; + /* Note: the padded width on an sh_css_frame is in elements, not in + bytes. The RAW frame we use here should always be a 16bit RAW + frame. This is why we bytesperline/2 is equal to the padded with */ + if (sh_css_frame_allocate(&res, arg->fmt.width, arg->fmt.height, + sh_format, padded_width, 0)) { + ret = -ENOMEM; + goto err; } - if (flag == 0) - return -EINVAL; - else { - memcpy(&info, &arg->info, sizeof(struct sh_css_frame_info)); + tmp_buf = vmalloc(arg->fmt.sizeimage); + if (!tmp_buf) { + ret = -ENOMEM; + goto err; + } + if (copy_from_user(tmp_buf, arg->base, arg->fmt.sizeimage)) { + ret = -EFAULT; + goto err; + } - tmp_buf = vmalloc(arg->data_bytes); - if (!tmp_buf) - return -ENOMEM; + if (hmm_store(res->data, tmp_buf, arg->fmt.sizeimage)) { + ret = -EINVAL; + goto err; + } - if (sh_css_frame_allocate_from_info(&raw_black_frame, &info)) { - ret = -ENOMEM; - goto failed1; - } +err: + if (ret && res) + sh_css_frame_free(res); + if (tmp_buf) + vfree(tmp_buf); + if (ret == 0) + *result = res; + return ret; +} - if (copy_from_user(tmp_buf, arg->data, arg->data_bytes)) { - ret = -EFAULT; - goto failed2; - } +/* + * Function to configure fixed pattern noise table + */ +int atomisp_fixed_pattern_table(struct atomisp_device *isp, + struct v4l2_framebuffer *arg) +{ + struct sh_css_frame *raw_black_frame = NULL; + int ret = 0; - if (hmm_store(raw_black_frame->data, tmp_buf, - arg->data_bytes)){ - ret = -EINVAL; - goto failed2; - } + if (arg == NULL) + return -EINVAL; - sh_css_set_black_frame(raw_black_frame); -failed2: - sh_css_frame_free(raw_black_frame); -failed1: - vfree(tmp_buf); - } + ret = atomisp_v4l2_framebuffer_to_sh_css_frame(arg, &raw_black_frame); + if (ret) + return ret; + if (sh_css_set_black_frame(raw_black_frame) != sh_css_success) + ret = -ENOMEM; + sh_css_frame_free(raw_black_frame); return ret; } @@ -2310,33 +2328,18 @@ failed1: * Function to configure vf overlay image */ int atomisp_vf_overlay(struct atomisp_device *isp, int flag, - void *config) + struct atomisp_overlay *arg) { - struct atomisp_overlay *arg = (struct atomisp_overlay *)config; int ret = 0; - struct sh_css_frame vf_frame; - char *tmp_buf; if (arg == NULL) return -EINVAL; - if (sizeof(*arg) != sizeof(*isp->params.vf_overlay)) { - v4l2_err(&atomisp_dev, - "%s: incompatible param.\n", __func__); - return -EINVAL; - } - - if (!arg->frame) - /* from siliconhive, passing NULL means disable the feature */ + /* NULL means disable the feature */ + if (!arg->frame) { sh_css_overlay_set_for_viewfinder(NULL); - - if (copy_from_user(&vf_frame, arg->frame, - sizeof(struct sh_css_frame))) - return -EFAULT; - - tmp_buf = vmalloc(vf_frame.data_bytes); - if (!tmp_buf) - return -ENOMEM; + return 0; + } if (isp->params.vf_overlay) { if (isp->params.vf_overlay->frame) @@ -2344,22 +2347,21 @@ int atomisp_vf_overlay(struct atomisp_device *isp, int flag, kfree(isp->params.vf_overlay); } - isp->params.vf_overlay = kmalloc(sizeof(struct sh_css_overlay), + isp->params.vf_overlay = kzalloc(sizeof(struct sh_css_overlay), GFP_KERNEL); if (!isp->params.vf_overlay) { ret = -ENOMEM; - goto fail1; + goto err; } - if (sh_css_frame_allocate_from_info(&isp->params.vf_overlay->frame, - &vf_frame.info)) { - ret = -ENOMEM; - goto fail2; - } + ret = atomisp_v4l2_framebuffer_to_sh_css_frame(arg->frame, + &isp->params.vf_overlay->frame); + if (ret) + goto err; - isp->params.vf_overlay->bg_y = arg->bg_y; - isp->params.vf_overlay->bg_u = arg->bg_u; - isp->params.vf_overlay->bg_v = arg->bg_v; + isp->params.vf_overlay->bg_y = arg->bg_y; + isp->params.vf_overlay->bg_u = arg->bg_u; + isp->params.vf_overlay->bg_v = arg->bg_v; isp->params.vf_overlay->blend_input_perc_y = arg->blend_input_perc_y; isp->params.vf_overlay->blend_input_perc_u = arg->blend_input_perc_u; isp->params.vf_overlay->blend_input_perc_v = arg->blend_input_perc_v; @@ -2369,31 +2371,14 @@ int atomisp_vf_overlay(struct atomisp_device *isp, int flag, arg->blend_overlay_perc_u; isp->params.vf_overlay->blend_overlay_perc_v = arg->blend_overlay_perc_v; - isp->params.vf_overlay->overlay_start_x = arg->overlay_start_x; - isp->params.vf_overlay->overlay_start_y = arg->overlay_start_y; - - /* copy for YUV 420 */ - if (copy_from_user(tmp_buf, vf_frame.data, vf_frame.data_bytes)) { - ret = -EFAULT; - goto fail2; - } - - if (hmm_store(isp->params.vf_overlay->frame->data, tmp_buf, - vf_frame.data_bytes)){ - ret = -EINVAL; - goto fail2; - } + isp->params.vf_overlay->overlay_start_x = arg->overlay_start_x; + isp->params.vf_overlay->overlay_start_y = arg->overlay_start_y; sh_css_overlay_set_for_viewfinder(isp->params.vf_overlay); - vfree(tmp_buf); - - return ret; - -fail2: - kfree(isp->params.vf_overlay); -fail1: - vfree(tmp_buf); +err: + if (ret && isp->params.vf_overlay) + kfree(isp->params.vf_overlay); return ret; } @@ -3262,7 +3247,7 @@ done: pipe->format->out.bytesperline = DIV_RND_UP(format_bridge->depth * output_info.padded_width, 8); pipe->format->out.sizeimage = - PAGE_ALIGN(height * pipe->format->out. bytesperline); + PAGE_ALIGN(height * pipe->format->out.bytesperline); if (f->fmt.pix.field == V4L2_FIELD_ANY) f->fmt.pix.field = V4L2_FIELD_NONE; pipe->format->out.field = f->fmt.pix.field; diff --git a/drivers/media/video/atomisp/atomisp_cmd.h b/drivers/media/video/atomisp/atomisp_cmd.h index 2bdb59d..39d4d8f 100644 --- a/drivers/media/video/atomisp/atomisp_cmd.h +++ b/drivers/media/video/atomisp/atomisp_cmd.h @@ -84,19 +84,19 @@ int atomisp_gdc_cac(struct atomisp_device *isp, int flag, __s32 * value); int atomisp_low_light(struct atomisp_device *isp, int flag, __s32 * value); /* - * Function to enable/disable extra nosie reduction (XNR) in low light + * Function to enable/disable extra noise reduction (XNR) in low light * condition */ int atomisp_xnr(struct atomisp_device *isp, int flag, int *arg); /* - * Function to configure bayer nosie reduction + * Function to configure noise reduction */ -int atomisp_bayer_nr(struct atomisp_device *isp, int flag, - void *config); +int atomisp_nr(struct atomisp_device *isp, int flag, + struct atomisp_nr_config *config); /* - * Function to configure temporal nosie reduction (TNR) + * Function to configure temporal noise reduction (TNR) */ int atomisp_tnr(struct atomisp_device *isp, int flag, void *config); @@ -113,12 +113,6 @@ int atomisp_histogram(struct atomisp_device *isp, int atomisp_black_level(struct atomisp_device *isp, int flag, void *config); /* - * Function to configure Ycc nosie reduction - */ -int atomisp_ycc_nr(struct atomisp_device *isp, int flag, - void *config); - -/* * Function to configure edge enhancement */ int atomisp_ee(struct atomisp_device *isp, int flag, @@ -202,14 +196,14 @@ int atomisp_fixed_pattern(struct atomisp_device *isp, int flag, __s32 * value); /* * Function to configure fixed pattern noise table */ -int atomisp_fixed_pattern_table(struct atomisp_device *isp, int flag, - void *config); +int atomisp_fixed_pattern_table(struct atomisp_device *isp, + struct v4l2_framebuffer *config); /* * Function to configure vf overlay image */ int atomisp_vf_overlay(struct atomisp_device *isp, int flag, - void *config); + struct atomisp_overlay *overlay); /* * Function to configure false color correction diff --git a/drivers/media/video/atomisp/atomisp_ioctl.c b/drivers/media/video/atomisp/atomisp_ioctl.c index cfecfa8..54debd6 100644 --- a/drivers/media/video/atomisp/atomisp_ioctl.c +++ b/drivers/media/video/atomisp/atomisp_ioctl.c @@ -1614,11 +1614,11 @@ static long atomisp_vidioc_default(struct file *file, void *fh, case ATOMISP_IOC_S_XNR: return atomisp_xnr(isp, 1, arg); - case ATOMISP_IOC_G_BAYER_NR: - return atomisp_bayer_nr(isp, 0, arg); + case ATOMISP_IOC_G_NR: + return atomisp_nr(isp, 0, arg); - case ATOMISP_IOC_S_BAYER_NR: - return atomisp_bayer_nr(isp, 1, arg); + case ATOMISP_IOC_S_NR: + return atomisp_nr(isp, 1, arg); case ATOMISP_IOC_G_TNR: return atomisp_tnr(isp, 0, arg); @@ -1638,12 +1638,6 @@ static long atomisp_vidioc_default(struct file *file, void *fh, case ATOMISP_IOC_S_BLACK_LEVEL_COMP: return atomisp_black_level(isp, 1, arg); - case ATOMISP_IOC_G_YCC_NR: - return atomisp_ycc_nr(isp, 0, arg); - - case ATOMISP_IOC_S_YCC_NR: - return atomisp_ycc_nr(isp, 1, arg); - case ATOMISP_IOC_G_EE: return atomisp_ee(isp, 0, arg); @@ -1718,11 +1712,8 @@ static long atomisp_vidioc_default(struct file *file, void *fh, case ATOMISP_IOC_S_3A_CONFIG: return atomisp_3a_config_param(isp, 1, arg); - case ATOMISP_IOC_G_ISP_FPN_TABLE: - return atomisp_fixed_pattern_table(isp, 0, arg); - case ATOMISP_IOC_S_ISP_FPN_TABLE: - return atomisp_fixed_pattern_table(isp, 1, arg); + return atomisp_fixed_pattern_table(isp, arg); case ATOMISP_IOC_G_ISP_OVERLAY: return atomisp_vf_overlay(isp, 0, arg); diff --git a/include/linux/atomisp.h b/include/linux/atomisp.h index 2c06867..cd992f4 100644 --- a/include/linux/atomisp.h +++ b/include/linux/atomisp.h @@ -143,7 +143,7 @@ struct atomisp_3a_config { }; /* structure that describes the 3A and DIS grids shared with 3A lib*/ -struct atomisp_grid_info_user { +struct atomisp_grid_info { /* 3A statistics grid: */ unsigned int s3a_width; unsigned int s3a_height; @@ -157,8 +157,8 @@ struct atomisp_grid_info_user { }; struct atomisp_3a_statistics { - struct atomisp_grid_info_user grid_info; - struct atomisp_3a_output *data; + struct atomisp_grid_info grid_info; + struct atomisp_3a_output *data; }; /* White Balance (Gain Adjust) */ @@ -205,7 +205,7 @@ struct atomisp_dp_config { }; struct atomisp_parm { - struct atomisp_grid_info_user info; + struct atomisp_grid_info info; struct atomisp_wb_config wb_config; struct atomisp_cc_config cc_config; struct atomisp_ob_config ob_config; @@ -217,27 +217,24 @@ struct atomisp_parm { struct atomisp_tnr_config tnr_config; }; -#define atomisp_gamma_table_size 1024 - +#define ATOMISP_GAMMA_TABLE_SIZE 1024 struct atomisp_gamma_table { - unsigned short data[atomisp_gamma_table_size]; + unsigned short data[ATOMISP_GAMMA_TABLE_SIZE]; }; -#define atomisp_morph_table_num_planes 6 - /* Morphing table for advanced ISP. * Each line of width elements takes up COORD_TABLE_EXT_WIDTH elements * in memory. */ +#define ATOMISP_MORPH_TABLE_NUM_PLANES 6 struct atomisp_morph_table { unsigned int height; unsigned int width; /* number of valid elements per line */ - unsigned short *coordinates_x[atomisp_morph_table_num_planes]; - unsigned short *coordinates_y[atomisp_morph_table_num_planes]; + unsigned short *coordinates_x[ATOMISP_MORPH_TABLE_NUM_PLANES]; + unsigned short *coordinates_y[ATOMISP_MORPH_TABLE_NUM_PLANES]; }; #define ATOMISP_NUM_SC_COLORS 4 - #define ATOMISP_SC_FLAG_QUERY (1 << 0) struct atomisp_shading_table { @@ -281,9 +278,9 @@ struct atomisp_makernote_info { }; /* parameter for MACC */ -#define atomisp_num_macc_axes 16 +#define ATOMISP_NUM_MACC_AXES 16 struct atomisp_macc_table { - short data[4 * atomisp_num_macc_axes]; + short data[4 * ATOMISP_NUM_MACC_AXES]; }; struct atomisp_macc_config { @@ -292,186 +289,9 @@ struct atomisp_macc_config { }; /* Parameter for ctc parameter control */ -#define atomisp_ctc_table_size 1024 +#define ATOMISP_CTC_TABLE_SIZE 1024 struct atomisp_ctc_table { - unsigned short data[atomisp_ctc_table_size]; -}; - -/* Parameter for fpn table loading */ -enum atomisp_frame_format { - ATOMISP_FRAME_FORMAT_NV11, /* 12 bit YUV 411, Y, UV plane */ - ATOMISP_FRAME_FORMAT_NV12, /* 12 bit YUV 420, Y, UV plane */ - ATOMISP_FRAME_FORMAT_NV16, /* 16 bit YUV 422, Y, UV plane */ - ATOMISP_FRAME_FORMAT_YUV420, /* 12 bit YUV 420, Y, U, V plane */ - ATOMISP_FRAME_FORMAT_YUV422, /* 16 bit YUV 422, Y, U, V plane */ - ATOMISP_FRAME_FORMAT_YUYV, /* 16 bit YUV 422, YUYV interleaved */ - ATOMISP_FRAME_FORMAT_UYVY, /* 16 bit YUV 422, UYVY interleaved */ - ATOMISP_FRAME_FORMAT_YUV444, /* 24 bit YUV 444, Y, U, V plane */ - ATOMISP_FRAME_FORMAT_YUV420_16, /* Same as yuv420, 16 bits per subpixel - */ - ATOMISP_FRAME_FORMAT_YUV422_16, /* Same as yuv422, 16 bits per subpixel - */ - ATOMISP_FRAME_FORMAT_RAW, /* RAW, 1 plane */ - ATOMISP_FRAME_FORMAT_RGBA888, /* 32 bit RGBA, 1 plane, A=Alpha unused - */ - ATOMISP_FRAME_FORMAT_RGB565, /* 16 bit RGB, 1 plane. Each 3 sub - pixels are packed into one 16 bit - value, 5 bits for R, 6 bits for G - and 5 bits for B. */ - ATOMISP_FRAME_FORMAT_PLANAR_RGB888, /* 24 bit RGB, 3 planes */ - ATOMISP_FRAME_FORMAT_QPLANE6, /* Internal, for advanced ISP */ - ATOMISP_FRAME_FORMAT_NV21, /* 12 bit YUV 420, Y, VU plane */ - ATOMISP_FRAME_FORMAT_NV61, /* 16 bit YUV 422, Y, VU plane */ - ATOMISP_FRAME_FORMAT_YV12, /* 12 bit YUV 420, Y, V, U plane */ - ATOMISP_FRAME_FORMAT_YV16, /* 16 bit YUV 422, Y, V, U plane */ - ATOMISP_FRAME_FORMAT_BINARY_8, /* byte stream, used for jpeg. For - frames of this type, we set the - height to 1 and the width to the - number of allocated bytes. */ - ATOMISP_FRAME_FORMAT_YUV_LINE, /* Internal format, e.g. for VBF frame. - 2 y lines followed by a uv - interleaved line */ -}; - -enum atomisp_input_format { - ATOMISP_INPUT_FORMAT_YUV420_8_LEGACY,/* 8 bits per subpixel (legacy) */ - ATOMISP_INPUT_FORMAT_YUV420_8, /* 8 bits per subpixel */ - ATOMISP_INPUT_FORMAT_YUV420_10,/* 10 bits per subpixel */ - ATOMISP_INPUT_FORMAT_YUV422_8, /* UYVY..UVYV, 8 bits per subpixel */ - ATOMISP_INPUT_FORMAT_YUV422_10,/* UYVY..UVYV, 10 bits per subpixel */ - ATOMISP_INPUT_FORMAT_RGB_444, /* BGR..BGR, 4 bits per subpixel */ - ATOMISP_INPUT_FORMAT_RGB_555, /* BGR..BGR, 5 bits per subpixel */ - ATOMISP_INPUT_FORMAT_RGB_565, /* BGR..BGR, 5 bits B and $, 6 bits G */ - ATOMISP_INPUT_FORMAT_RGB_666, /* BGR..BGR, 6 bits per subpixel */ - ATOMISP_INPUT_FORMAT_RGB_888, /* BGR..BGR, 8 bits per subpixel */ - ATOMISP_INPUT_FORMAT_RAW_6, /* RAW data, 6 bits per pixel */ - ATOMISP_INPUT_FORMAT_RAW_7, /* RAW data, 7 bits per pixel */ - ATOMISP_INPUT_FORMAT_RAW_8, /* RAW data, 8 bits per pixel */ - ATOMISP_INPUT_FORMAT_RAW_10, /* RAW data, 10 bits per pixel */ - ATOMISP_INPUT_FORMAT_RAW_12, /* RAW data, 12 bits per pixel */ - ATOMISP_INPUT_FORMAT_RAW_14, /* RAW data, 14 bits per pixel */ - ATOMISP_INPUT_FORMAT_RAW_16, /* RAW data, 16 bits per pixel */ - ATOMISP_INPUT_FORMAT_BINARY_8, /* Binary byte stream. */ -}; - -enum atomisp_bayer_order { - atomisp_bayer_order_grbg, - atomisp_bayer_order_rggb, - atomisp_bayer_order_bggr, - atomisp_bayer_order_gbrg -}; - -struct atomisp_frame_info { - /* width in valid data in pixels (not subpixels) */ - unsigned int width; - /* height in lines of valid image data */ - unsigned int height; - /* width of a line in memory, in pixels */ - unsigned int padded_width; - /* format of the data in this frame */ - enum atomisp_frame_format format; - /* number of valid bits per pixel, only valid for raw frames. */ - unsigned int raw_bit_depth; - /* bayer order of raw data, only valid for raw frames. */ - enum atomisp_bayer_order raw_bayer_order; -}; - -struct atomisp_frame_plane { - unsigned int height; /* height of a plane in lines */ - unsigned int width; /* width of a line, in DMA elements, note that - for RGB565 the three subpixels are stored in - one element. For all other formats this is - the number of subpixels per line. */ - unsigned int stride; /* stride of a line in bytes */ - void *data; /* pointer that points into frame data */ -}; - -struct atomisp_frame_binary_plane { - unsigned int size; - struct atomisp_frame_plane data; -}; - -struct atomisp_frame_yuv_planes { - struct atomisp_frame_plane y; - struct atomisp_frame_plane u; - struct atomisp_frame_plane v; -}; - -struct atomisp_frame_nv_planes { - struct atomisp_frame_plane y; - struct atomisp_frame_plane uv; -}; - -struct atomisp_frame_rgb_planes { - struct atomisp_frame_plane r; - struct atomisp_frame_plane g; - struct atomisp_frame_plane b; -}; - -enum atomisp_err { - atomisp_success, - atomisp_err_internal_error, - atomisp_err_conflicting_mipi_settings, - atomisp_err_unsupported_configuration, - atomisp_err_mode_does_not_have_viewfinder, - atomisp_err_input_resolution_not_set, - atomisp_err_unsupported_input_mode, - atomisp_err_cannot_allocate_memory, - atomisp_err_invalid_arguments, - atomisp_err_too_may_colors, - atomisp_err_overlay_frame_missing, - atomisp_err_overlay_frames_too_big, - atomisp_err_unsupported_frame_format, - atomisp_err_frames_mismatch, - atomisp_err_overlay_not_set, - atomisp_err_not_implemented, - atomisp_err_invalid_frame_format, - atomisp_err_unsupported_resolution, - atomisp_err_scaling_factor_out_of_range, - atomisp_err_cannot_obtain_shading_table, - atomisp_err_interrupt_error, - atomisp_err_unexpected_interrupt, - atomisp_err_interrupts_not_enabled, - atomisp_err_system_not_idle, - atomisp_err_unsupported_input_format, - atomisp_err_not_enough_input_lines, - atomisp_err_not_enough_input_columns, - atomisp_err_not_initialized, - atomisp_err_illegal_resolution, - atomisp_err_effective_input_resolution_not_set, - atomisp_err_viewfinder_resolution_too_wide, - atomisp_err_viewfinder_resolution_exceeds_output, - atomisp_err_mode_does_not_have_grid, - atomisp_err_mode_does_not_have_raw_output -}; - -struct atomisp_frame_plane6_planes { - struct atomisp_frame_plane r; - struct atomisp_frame_plane r_at_b; - struct atomisp_frame_plane gr; - struct atomisp_frame_plane gb; - struct atomisp_frame_plane b; - struct atomisp_frame_plane b_at_r; -}; - -struct atomisp_frame { - struct atomisp_frame_info info; - /* pointer to start of image data in memory */ - void *data; - /* size of data pointer in bytes */ - unsigned int data_bytes; - /* indicate whether memory is allocated physically contiguously */ - int contiguous; - union { - struct atomisp_frame_plane raw; - struct atomisp_frame_plane rgb; - struct atomisp_frame_rgb_planes planar_rgb; - struct atomisp_frame_plane yuyv; - struct atomisp_frame_yuv_planes yuv; - struct atomisp_frame_nv_planes nv; - struct atomisp_frame_plane6_planes plane6; - struct atomisp_frame_binary_plane binary; - } planes; + unsigned short data[ATOMISP_CTC_TABLE_SIZE]; }; /* Parameter for overlay image loading */ @@ -480,7 +300,7 @@ struct atomisp_overlay { * be the multiples of 2*ISP_VEC_NELEMS. The overlay frame height * should be the multiples of 2. */ - struct atomisp_frame *frame; + struct v4l2_framebuffer *frame; /* Y value of overlay background */ unsigned char bg_y; /* U value of overlay background */ @@ -579,6 +399,7 @@ enum atomisp_frame_status { ATOMISP_FRAME_STATUS_FLASH_PARTIAL, ATOMISP_FRAME_STATUS_FLASH_FAILED, }; + enum atomisp_acc_type { ATOMISP_ACC_STANDALONE, /* Stand-alone acceleration */ ATOMISP_ACC_OUTPUT, /* Accelerator stage on output frame */ @@ -643,9 +464,9 @@ struct v4l2_private_int_data { _IOR('v', BASE_VIDIOC_PRIVATE + 0, int) #define ATOMISP_IOC_S_XNR \ _IOW('v', BASE_VIDIOC_PRIVATE + 1, int) -#define ATOMISP_IOC_G_BAYER_NR \ +#define ATOMISP_IOC_G_NR \ _IOR('v', BASE_VIDIOC_PRIVATE + 2, struct atomisp_nr_config) -#define ATOMISP_IOC_S_BAYER_NR \ +#define ATOMISP_IOC_S_NR \ _IOW('v', BASE_VIDIOC_PRIVATE + 3, struct atomisp_nr_config) #define ATOMISP_IOC_G_TNR \ _IOR('v', BASE_VIDIOC_PRIVATE + 4, struct atomisp_tnr_config) @@ -659,10 +480,6 @@ struct v4l2_private_int_data { _IOR('v', BASE_VIDIOC_PRIVATE + 8, struct atomisp_ob_config) #define ATOMISP_IOC_S_BLACK_LEVEL_COMP \ _IOW('v', BASE_VIDIOC_PRIVATE + 9, struct atomisp_ob_config) -#define ATOMISP_IOC_G_YCC_NR \ - _IOR('v', BASE_VIDIOC_PRIVATE + 10, struct atomisp_nr_config) -#define ATOMISP_IOC_S_YCC_NR \ - _IOW('v', BASE_VIDIOC_PRIVATE + 11, struct atomisp_nr_config) #define ATOMISP_IOC_G_EE \ _IOR('v', BASE_VIDIOC_PRIVATE + 12, struct atomisp_ee_config) #define ATOMISP_IOC_S_EE \ @@ -719,10 +536,8 @@ struct v4l2_private_int_data { _IOW('v', BASE_VIDIOC_PRIVATE + 33, struct atomisp_wb_config) /* fpn table loading */ -#define ATOMISP_IOC_G_ISP_FPN_TABLE \ - _IOWR('v', BASE_VIDIOC_PRIVATE + 34, struct atomisp_frame) #define ATOMISP_IOC_S_ISP_FPN_TABLE \ - _IOW('v', BASE_VIDIOC_PRIVATE + 35, struct atomisp_frame) + _IOW('v', BASE_VIDIOC_PRIVATE + 35, struct v4l2_framebuffer) /* overlay image loading */ #define ATOMISP_IOC_G_ISP_OVERLAY \ @@ -799,12 +614,8 @@ struct v4l2_private_int_data { (V4L2_CID_PRIVATE_BASE + 3) #define V4L2_CID_ATOMISP_FALSE_COLOR_CORRECTION \ (V4L2_CID_PRIVATE_BASE + 4) - -/* Deprecated. Use ATOMISP_IOC_S_ISP_SHD_TAB instead. */ -#define V4L2_CID_ATOMISP_SHADING_CORRECTION \ - (V4L2_CID_PRIVATE_BASE + 5) #define V4L2_CID_ATOMISP_LOW_LIGHT \ - (V4L2_CID_PRIVATE_BASE + 6) + (V4L2_CID_PRIVATE_BASE + 5) /* Camera class: * Exposure, Flash and privacy (indicator) light controls, to be upstreamed */ diff --git a/include/linux/atomisp_platform.h b/include/linux/atomisp_platform.h index 9af1093..7550c4e 100644 --- a/include/linux/atomisp_platform.h +++ b/include/linux/atomisp_platform.h @@ -25,6 +25,34 @@ #include #include "atomisp.h" +enum atomisp_bayer_order { + atomisp_bayer_order_grbg, + atomisp_bayer_order_rggb, + atomisp_bayer_order_bggr, + atomisp_bayer_order_gbrg +}; + +enum atomisp_input_format { + ATOMISP_INPUT_FORMAT_YUV420_8_LEGACY,/* 8 bits per subpixel (legacy) */ + ATOMISP_INPUT_FORMAT_YUV420_8, /* 8 bits per subpixel */ + ATOMISP_INPUT_FORMAT_YUV420_10,/* 10 bits per subpixel */ + ATOMISP_INPUT_FORMAT_YUV422_8, /* UYVY..UVYV, 8 bits per subpixel */ + ATOMISP_INPUT_FORMAT_YUV422_10,/* UYVY..UVYV, 10 bits per subpixel */ + ATOMISP_INPUT_FORMAT_RGB_444, /* BGR..BGR, 4 bits per subpixel */ + ATOMISP_INPUT_FORMAT_RGB_555, /* BGR..BGR, 5 bits per subpixel */ + ATOMISP_INPUT_FORMAT_RGB_565, /* BGR..BGR, 5 bits B and $, 6 bits G */ + ATOMISP_INPUT_FORMAT_RGB_666, /* BGR..BGR, 6 bits per subpixel */ + ATOMISP_INPUT_FORMAT_RGB_888, /* BGR..BGR, 8 bits per subpixel */ + ATOMISP_INPUT_FORMAT_RAW_6, /* RAW data, 6 bits per pixel */ + ATOMISP_INPUT_FORMAT_RAW_7, /* RAW data, 7 bits per pixel */ + ATOMISP_INPUT_FORMAT_RAW_8, /* RAW data, 8 bits per pixel */ + ATOMISP_INPUT_FORMAT_RAW_10, /* RAW data, 10 bits per pixel */ + ATOMISP_INPUT_FORMAT_RAW_12, /* RAW data, 12 bits per pixel */ + ATOMISP_INPUT_FORMAT_RAW_14, /* RAW data, 14 bits per pixel */ + ATOMISP_INPUT_FORMAT_RAW_16, /* RAW data, 16 bits per pixel */ + ATOMISP_INPUT_FORMAT_BINARY_8, /* Binary byte stream. */ +}; + enum intel_v4l2_subdev_type { RAW_CAMERA = 1, SOC_CAMERA = 2, -- 2.7.4