diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-04-03 17:16:59 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-04-03 17:16:59 -0700 |
commit | ef1c4a6fa91bbbe9b09f770d28eba31a9edf770c (patch) | |
tree | 52f5d175031c553160d14890e876ffc5432d2467 /drivers/staging | |
parent | 147a89bc71e7db40f011454a40add7ff2d10f8d8 (diff) | |
parent | f8a695c4b43d02c89b8bba9ba6058fd5db1bc71d (diff) |
Merge tag 'media/v4.17-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media updates from Mauro Carvalho Chehab:
- new CEC pin injection code for testing purposes
- DVB frontend cxd2099 promoted from staging
- new platform driver for Sony cxd2880 DVB devices
- new sensor drivers: mt9t112, ov2685, ov5695, ov772x, tda1997x,
tw9910.c
- removal of unused cx18 and ivtv alsa mixers
- the reneseas-ceu driver doesn't depend on soc_camera anymore and
moved from staging
- removed the mantis_vp3028 driver, unused since 2009
- s5p-mfc: add support for version 10 of the MSP
- added a decoder for imon protocol
- atomisp: lots of cleanups
- imx074 and mt9t031: don't depend on soc_camera anymore, being
promoted from staging
- added helper functions to better support DVB I2C binding
- lots of driver improvements and cleanups
* tag 'media/v4.17-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (438 commits)
media: v4l2-ioctl: rename a temp var that stores _IOC_SIZE(cmd)
media: fimc-capture: get rid of two warnings
media: dvb-usb-v2: fix a missing dependency of I2C_MUX
media: uvc: to the right check at uvc_ioctl_enum_framesizes()
media: cec-core: fix a bug at cec_error_inj_write()
media: tda9840: cleanup a warning
media: tm6000: avoid casting just to print pointer address
media: em28xx-input: improve error handling code
media: zr364xx: avoid casting just to print pointer address
media: vivid-radio-rx: add a cast to avoid a warning
media: saa7134-alsa: don't use casts to print a buffer address
media: solo6x10: get rid of an address space warning
media: zoran: don't cast pointers to print them
media: ir-kbd-i2c: change the if logic to avoid a warning
media: ir-kbd-i2c: improve error handling code
media: saa7134-input: improve error handling
media: s2255drv: fix a casting warning
media: ivtvfb: Cleanup some warnings
media: videobuf-dma-sg: Fix a weird cast
soc_camera: fix a weird cast on printk
...
Diffstat (limited to 'drivers/staging')
137 files changed, 1664 insertions, 13546 deletions
diff --git a/drivers/staging/media/Kconfig b/drivers/staging/media/Kconfig index e68e1d343d53..4c495a10025c 100644 --- a/drivers/staging/media/Kconfig +++ b/drivers/staging/media/Kconfig @@ -23,12 +23,14 @@ source "drivers/staging/media/atomisp/Kconfig" source "drivers/staging/media/bcm2048/Kconfig" -source "drivers/staging/media/cxd2099/Kconfig" - source "drivers/staging/media/davinci_vpfe/Kconfig" source "drivers/staging/media/imx/Kconfig" +source "drivers/staging/media/imx074/Kconfig" + +source "drivers/staging/media/mt9t031/Kconfig" + source "drivers/staging/media/omap4iss/Kconfig" source "drivers/staging/media/tegra-vde/Kconfig" diff --git a/drivers/staging/media/Makefile b/drivers/staging/media/Makefile index 59a47f69884f..61a5765cb98f 100644 --- a/drivers/staging/media/Makefile +++ b/drivers/staging/media/Makefile @@ -1,7 +1,8 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_I2C_BCM2048) += bcm2048/ -obj-$(CONFIG_DVB_CXD2099) += cxd2099/ obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx/ +obj-$(CONFIG_SOC_CAMERA_IMX074) += imx074/ +obj-$(CONFIG_SOC_CAMERA_MT9T031) += mt9t031/ obj-$(CONFIG_VIDEO_DM365_VPFE) += davinci_vpfe/ obj-$(CONFIG_VIDEO_OMAP4) += omap4iss/ obj-$(CONFIG_INTEL_ATOMISP) += atomisp/ diff --git a/drivers/staging/media/atomisp/i2c/Kconfig b/drivers/staging/media/atomisp/i2c/Kconfig index db054d3c7ed6..f7f7177b9b37 100644 --- a/drivers/staging/media/atomisp/i2c/Kconfig +++ b/drivers/staging/media/atomisp/i2c/Kconfig @@ -28,18 +28,6 @@ config VIDEO_ATOMISP_GC2235 It currently only works with the atomisp driver. -config VIDEO_ATOMISP_OV8858 - tristate "Omnivision ov8858 sensor support" - depends on ACPI - depends on I2C && VIDEO_V4L2 && VIDEO_ATOMISP - ---help--- - This is a Video4Linux2 sensor-level driver for the Omnivision - ov8858 RAW sensor. - - OV8858 is a 8M raw sensor. - - It currently only works with the atomisp driver. - config VIDEO_ATOMISP_MSRLIST_HELPER tristate "Helper library to load, parse and apply large register lists." depends on I2C diff --git a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c index 61b7598469eb..93753cb96180 100644 --- a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c +++ b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c @@ -1204,57 +1204,6 @@ fail_power_off: return ret; } -static int gc0310_g_parm(struct v4l2_subdev *sd, - struct v4l2_streamparm *param) -{ - struct gc0310_device *dev = to_gc0310_sensor(sd); - struct i2c_client *client = v4l2_get_subdevdata(sd); - - if (!param) - return -EINVAL; - - if (param->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { - dev_err(&client->dev, "unsupported buffer type.\n"); - return -EINVAL; - } - - memset(param, 0, sizeof(*param)); - param->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - - if (dev->fmt_idx >= 0 && dev->fmt_idx < N_RES) { - param->parm.capture.capability = V4L2_CAP_TIMEPERFRAME; - param->parm.capture.timeperframe.numerator = 1; - param->parm.capture.capturemode = dev->run_mode; - param->parm.capture.timeperframe.denominator = - gc0310_res[dev->fmt_idx].fps; - } - return 0; -} - -static int gc0310_s_parm(struct v4l2_subdev *sd, - struct v4l2_streamparm *param) -{ - struct gc0310_device *dev = to_gc0310_sensor(sd); - dev->run_mode = param->parm.capture.capturemode; - - mutex_lock(&dev->input_lock); - switch (dev->run_mode) { - case CI_MODE_VIDEO: - gc0310_res = gc0310_res_video; - N_RES = N_RES_VIDEO; - break; - case CI_MODE_STILL_CAPTURE: - gc0310_res = gc0310_res_still; - N_RES = N_RES_STILL; - break; - default: - gc0310_res = gc0310_res_preview; - N_RES = N_RES_PREVIEW; - } - mutex_unlock(&dev->input_lock); - return 0; -} - static int gc0310_g_frame_interval(struct v4l2_subdev *sd, struct v4l2_subdev_frame_interval *interval) { @@ -1313,8 +1262,6 @@ static const struct v4l2_subdev_sensor_ops gc0310_sensor_ops = { static const struct v4l2_subdev_video_ops gc0310_video_ops = { .s_stream = gc0310_s_stream, - .g_parm = gc0310_g_parm, - .s_parm = gc0310_s_parm, .g_frame_interval = gc0310_g_frame_interval, }; diff --git a/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c b/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c index d8de46da64ae..93f9c618f3d8 100644 --- a/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c +++ b/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c @@ -944,57 +944,6 @@ fail_power_off: return ret; } -static int gc2235_g_parm(struct v4l2_subdev *sd, - struct v4l2_streamparm *param) -{ - struct gc2235_device *dev = to_gc2235_sensor(sd); - struct i2c_client *client = v4l2_get_subdevdata(sd); - - if (!param) - return -EINVAL; - - if (param->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { - dev_err(&client->dev, "unsupported buffer type.\n"); - return -EINVAL; - } - - memset(param, 0, sizeof(*param)); - param->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - - if (dev->fmt_idx >= 0 && dev->fmt_idx < N_RES) { - param->parm.capture.capability = V4L2_CAP_TIMEPERFRAME; - param->parm.capture.timeperframe.numerator = 1; - param->parm.capture.capturemode = dev->run_mode; - param->parm.capture.timeperframe.denominator = - gc2235_res[dev->fmt_idx].fps; - } - return 0; -} - -static int gc2235_s_parm(struct v4l2_subdev *sd, - struct v4l2_streamparm *param) -{ - struct gc2235_device *dev = to_gc2235_sensor(sd); - dev->run_mode = param->parm.capture.capturemode; - - mutex_lock(&dev->input_lock); - switch (dev->run_mode) { - case CI_MODE_VIDEO: - gc2235_res = gc2235_res_video; - N_RES = N_RES_VIDEO; - break; - case CI_MODE_STILL_CAPTURE: - gc2235_res = gc2235_res_still; - N_RES = N_RES_STILL; - break; - default: - gc2235_res = gc2235_res_preview; - N_RES = N_RES_PREVIEW; - } - mutex_unlock(&dev->input_lock); - return 0; -} - static int gc2235_g_frame_interval(struct v4l2_subdev *sd, struct v4l2_subdev_frame_interval *interval) { @@ -1052,8 +1001,6 @@ static const struct v4l2_subdev_sensor_ops gc2235_sensor_ops = { static const struct v4l2_subdev_video_ops gc2235_video_ops = { .s_stream = gc2235_s_stream, - .g_parm = gc2235_g_parm, - .s_parm = gc2235_s_parm, .g_frame_interval = gc2235_g_frame_interval, }; diff --git a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c index df253a557c76..834fba8c4fa0 100644 --- a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c +++ b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c @@ -1684,11 +1684,6 @@ static int mt9m114_t_vflip(struct v4l2_subdev *sd, int value) return !!err; } -static int mt9m114_s_parm(struct v4l2_subdev *sd, - struct v4l2_streamparm *param) -{ - return 0; -} static int mt9m114_g_frame_interval(struct v4l2_subdev *sd, struct v4l2_subdev_frame_interval *interval) @@ -1781,7 +1776,6 @@ static int mt9m114_g_skip_frames(struct v4l2_subdev *sd, u32 *frames) } static const struct v4l2_subdev_video_ops mt9m114_video_ops = { - .s_parm = mt9m114_s_parm, .s_stream = mt9m114_s_stream, .g_frame_interval = mt9m114_g_frame_interval, }; diff --git a/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c b/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c index 84f8d33ce2d1..11412061c40e 100644 --- a/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c +++ b/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c @@ -1280,60 +1280,6 @@ fail_power_off: return ret; } -static int ov2680_g_parm(struct v4l2_subdev *sd, - struct v4l2_streamparm *param) -{ - struct ov2680_device *dev = to_ov2680_sensor(sd); - struct i2c_client *client = v4l2_get_subdevdata(sd); - - if (!param) - return -EINVAL; - - if (param->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { - dev_err(&client->dev, "unsupported buffer type.\n"); - return -EINVAL; - } - - memset(param, 0, sizeof(*param)); - param->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - - if (dev->fmt_idx >= 0 && dev->fmt_idx < N_RES) { - param->parm.capture.capability = V4L2_CAP_TIMEPERFRAME; - param->parm.capture.timeperframe.numerator = 1; - param->parm.capture.capturemode = dev->run_mode; - param->parm.capture.timeperframe.denominator = - ov2680_res[dev->fmt_idx].fps; - } - return 0; -} - -static int ov2680_s_parm(struct v4l2_subdev *sd, - struct v4l2_streamparm *param) -{ - struct ov2680_device *dev = to_ov2680_sensor(sd); - struct i2c_client *client = v4l2_get_subdevdata(sd); - dev->run_mode = param->parm.capture.capturemode; - - v4l2_info(client, "\n%s:run_mode :%x\n", __func__, dev->run_mode); - - mutex_lock(&dev->input_lock); - switch (dev->run_mode) { - case CI_MODE_VIDEO: - ov2680_res = ov2680_res_video; - N_RES = N_RES_VIDEO; - break; - case CI_MODE_STILL_CAPTURE: - ov2680_res = ov2680_res_still; - N_RES = N_RES_STILL; - break; - default: - ov2680_res = ov2680_res_preview; - N_RES = N_RES_PREVIEW; - } - mutex_unlock(&dev->input_lock); - return 0; -} - static int ov2680_g_frame_interval(struct v4l2_subdev *sd, struct v4l2_subdev_frame_interval *interval) { @@ -1387,8 +1333,6 @@ static int ov2680_g_skip_frames(struct v4l2_subdev *sd, u32 *frames) static const struct v4l2_subdev_video_ops ov2680_video_ops = { .s_stream = ov2680_s_stream, - .g_parm = ov2680_g_parm, - .s_parm = ov2680_s_parm, .g_frame_interval = ov2680_g_frame_interval, }; diff --git a/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c b/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c index 2b6ae0faf972..e59358ac89ce 100644 --- a/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c +++ b/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c @@ -1083,57 +1083,6 @@ fail_power_off: return ret; } -static int ov2722_g_parm(struct v4l2_subdev *sd, - struct v4l2_streamparm *param) -{ - struct ov2722_device *dev = to_ov2722_sensor(sd); - struct i2c_client *client = v4l2_get_subdevdata(sd); - - if (!param) - return -EINVAL; - - if (param->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { - dev_err(&client->dev, "unsupported buffer type.\n"); - return -EINVAL; - } - - memset(param, 0, sizeof(*param)); - param->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - - if (dev->fmt_idx >= 0 && dev->fmt_idx < N_RES) { - param->parm.capture.capability = V4L2_CAP_TIMEPERFRAME; - param->parm.capture.timeperframe.numerator = 1; - param->parm.capture.capturemode = dev->run_mode; - param->parm.capture.timeperframe.denominator = - ov2722_res[dev->fmt_idx].fps; - } - return 0; -} - -static int ov2722_s_parm(struct v4l2_subdev *sd, - struct v4l2_streamparm *param) -{ - struct ov2722_device *dev = to_ov2722_sensor(sd); - dev->run_mode = param->parm.capture.capturemode; - - mutex_lock(&dev->input_lock); - switch (dev->run_mode) { - case CI_MODE_VIDEO: - ov2722_res = ov2722_res_video; - N_RES = N_RES_VIDEO; - break; - case CI_MODE_STILL_CAPTURE: - ov2722_res = ov2722_res_still; - N_RES = N_RES_STILL; - break; - default: - ov2722_res = ov2722_res_preview; - N_RES = N_RES_PREVIEW; - } - mutex_unlock(&dev->input_lock); - return 0; -} - static int ov2722_g_frame_interval(struct v4l2_subdev *sd, struct v4l2_subdev_frame_interval *interval) { @@ -1192,8 +1141,6 @@ static const struct v4l2_subdev_sensor_ops ov2722_sensor_ops = { static const struct v4l2_subdev_video_ops ov2722_video_ops = { .s_stream = ov2722_s_stream, - .g_parm = ov2722_g_parm, - .s_parm = ov2722_s_parm, .g_frame_interval = ov2722_g_frame_interval, }; diff --git a/drivers/staging/media/atomisp/i2c/gc0310.h b/drivers/staging/media/atomisp/i2c/gc0310.h index c422d0398fc7..af6b11f6e5e7 100644 --- a/drivers/staging/media/atomisp/i2c/gc0310.h +++ b/drivers/staging/media/atomisp/i2c/gc0310.h @@ -150,7 +150,6 @@ struct gc0310_device { struct camera_sensor_platform_data *platform_data; int vt_pix_clk_freq_mhz; int fmt_idx; - int run_mode; u8 res; u8 type; }; @@ -400,48 +399,6 @@ struct gc0310_resolution gc0310_res_preview[] = { }; #define N_RES_PREVIEW (ARRAY_SIZE(gc0310_res_preview)) -struct gc0310_resolution gc0310_res_still[] = { - { - .desc = "gc0310_VGA_30fps", - .width = 656, // 648, - .height = 496, // 488, - .fps = 30, - //.pix_clk_freq = 73, - .used = 0, -#if 0 - .pixels_per_line = 0x0314, - .lines_per_frame = 0x0213, -#endif - .bin_factor_x = 1, - .bin_factor_y = 1, - .bin_mode = 0, - .skip_frames = 2, - .regs = gc0310_VGA_30fps, - }, -}; -#define N_RES_STILL (ARRAY_SIZE(gc0310_res_still)) - -struct gc0310_resolution gc0310_res_video[] = { - { - .desc = "gc0310_VGA_30fps", - .width = 656, // 648, - .height = 496, // 488, - .fps = 30, - //.pix_clk_freq = 73, - .used = 0, -#if 0 - .pixels_per_line = 0x0314, - .lines_per_frame = 0x0213, -#endif - .bin_factor_x = 1, - .bin_factor_y = 1, - .bin_mode = 0, - .skip_frames = 2, - .regs = gc0310_VGA_30fps, - }, -}; -#define N_RES_VIDEO (ARRAY_SIZE(gc0310_res_video)) - static struct gc0310_resolution *gc0310_res = gc0310_res_preview; static unsigned long N_RES = N_RES_PREVIEW; #endif diff --git a/drivers/staging/media/atomisp/i2c/gc2235.h b/drivers/staging/media/atomisp/i2c/gc2235.h index 3c30a05c3991..0e805bcfa4d8 100644 --- a/drivers/staging/media/atomisp/i2c/gc2235.h +++ b/drivers/staging/media/atomisp/i2c/gc2235.h @@ -156,7 +156,6 @@ struct gc2235_device { struct camera_sensor_platform_data *platform_data; int vt_pix_clk_freq_mhz; int fmt_idx; - int run_mode; u8 res; u8 type; }; @@ -575,6 +574,11 @@ static struct gc2235_resolution gc2235_res_preview[] = { }; #define N_RES_PREVIEW (ARRAY_SIZE(gc2235_res_preview)) +/* + * Disable non-preview configurations until the configuration selection is + * improved. + */ +#if 0 static struct gc2235_resolution gc2235_res_still[] = { { .desc = "gc2235_1600_900_30fps", @@ -659,6 +663,7 @@ static struct gc2235_resolution gc2235_res_video[] = { }; #define N_RES_VIDEO (ARRAY_SIZE(gc2235_res_video)) +#endif static struct gc2235_resolution *gc2235_res = gc2235_res_preview; static unsigned long N_RES = N_RES_PREVIEW; diff --git a/drivers/staging/media/atomisp/i2c/ov2680.h b/drivers/staging/media/atomisp/i2c/ov2680.h index 03f75dd80f87..cb38e6e79409 100644 --- a/drivers/staging/media/atomisp/i2c/ov2680.h +++ b/drivers/staging/media/atomisp/i2c/ov2680.h @@ -850,74 +850,6 @@ struct ov2680_format { }; #define N_RES_PREVIEW (ARRAY_SIZE(ov2680_res_preview)) -static struct ov2680_resolution ov2680_res_still[] = { - { - .desc = "ov2680_1616x1216_30fps", - .width = 1616, - .height = 1216, - .pix_clk_freq = 66, - .fps = 30, - .used = 0, - .pixels_per_line = 1698,//1704, - .lines_per_frame = 1294, - .bin_factor_x = 0, - .bin_factor_y = 0, - .bin_mode = 0, - .skip_frames = 3, - .regs = ov2680_1616x1216_30fps, - }, - { - .desc = "ov2680_1616x916_30fps", - .width = 1616, - .height = 916, - .fps = 30, - .pix_clk_freq = 66, - .used = 0, - .pixels_per_line = 1698,//1704, - .lines_per_frame = 1294, - .bin_factor_x = 0, - .bin_factor_y = 0, - .bin_mode = 0, - .skip_frames = 3, - .regs = ov2680_1616x916_30fps, - }, -}; -#define N_RES_STILL (ARRAY_SIZE(ov2680_res_still)) - -static struct ov2680_resolution ov2680_res_video[] = { - { - .desc = "ov2680_1616x1216_30fps", - .width = 1616, - .height = 1216, - .pix_clk_freq = 66, - .fps = 30, - .used = 0, - .pixels_per_line = 1698,//1704, - .lines_per_frame = 1294, - .bin_factor_x = 0, - .bin_factor_y = 0, - .bin_mode = 0, - .skip_frames = 3, - .regs = ov2680_1616x1216_30fps, - }, - { - .desc = "ov2680_720p_30fps", - .width = 1616, - .height = 916, - .fps = 30, - .pix_clk_freq = 66, - .used = 0, - .pixels_per_line = 1698,//1704, - .lines_per_frame = 1294, - .bin_factor_x = 0, - .bin_factor_y = 0, - .bin_mode = 0, - .skip_frames = 3, - .regs = ov2680_1616x916_30fps, - }, -}; -#define N_RES_VIDEO (ARRAY_SIZE(ov2680_res_video)) - static struct ov2680_resolution *ov2680_res = ov2680_res_preview; static unsigned long N_RES = N_RES_PREVIEW; diff --git a/drivers/staging/media/atomisp/i2c/ov2722.h b/drivers/staging/media/atomisp/i2c/ov2722.h index d8a973d71699..028b04aaaa8f 100644 --- a/drivers/staging/media/atomisp/i2c/ov2722.h +++ b/drivers/staging/media/atomisp/i2c/ov2722.h @@ -1148,6 +1148,11 @@ struct ov2722_resolution ov2722_res_preview[] = { }; #define N_RES_PREVIEW (ARRAY_SIZE(ov2722_res_preview)) +/* + * Disable non-preview configurations until the configuration selection is + * improved. + */ +#if 0 struct ov2722_resolution ov2722_res_still[] = { { .desc = "ov2722_480P_30fps", @@ -1250,6 +1255,7 @@ struct ov2722_resolution ov2722_res_video[] = { }, }; #define N_RES_VIDEO (ARRAY_SIZE(ov2722_res_video)) +#endif static struct ov2722_resolution *ov2722_res = ov2722_res_preview; static unsigned long N_RES = N_RES_PREVIEW; diff --git a/drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c b/drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c index 40d01bf4bf28..30a735e59e54 100644 --- a/drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c +++ b/drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c @@ -1805,58 +1805,6 @@ fail_power_off: return ret; } -static int ov5693_g_parm(struct v4l2_subdev *sd, - struct v4l2_streamparm *param) -{ - struct ov5693_device *dev = to_ov5693_sensor(sd); - struct i2c_client *client = v4l2_get_subdevdata(sd); - - if (!param) - return -EINVAL; - - if (param->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { - dev_err(&client->dev, "unsupported buffer type.\n"); - return -EINVAL; - } - - memset(param, 0, sizeof(*param)); - param->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - - if (dev->fmt_idx >= 0 && dev->fmt_idx < N_RES) { - param->parm.capture.capability = V4L2_CAP_TIMEPERFRAME; - param->parm.capture.timeperframe.numerator = 1; - param->parm.capture.capturemode = dev->run_mode; - param->parm.capture.timeperframe.denominator = - ov5693_res[dev->fmt_idx].fps; - } - return 0; -} - -static int ov5693_s_parm(struct v4l2_subdev *sd, - struct v4l2_streamparm *param) -{ - struct ov5693_device *dev = to_ov5693_sensor(sd); - - dev->run_mode = param->parm.capture.capturemode; - - mutex_lock(&dev->input_lock); - switch (dev->run_mode) { - case CI_MODE_VIDEO: - ov5693_res = ov5693_res_video; - N_RES = N_RES_VIDEO; - break; - case CI_MODE_STILL_CAPTURE: - ov5693_res = ov5693_res_still; - N_RES = N_RES_STILL; - break; - default: - ov5693_res = ov5693_res_preview; - N_RES = N_RES_PREVIEW; - } - mutex_unlock(&dev->input_lock); - return 0; -} - static int ov5693_g_frame_interval(struct v4l2_subdev *sd, struct v4l2_subdev_frame_interval *interval) { @@ -1899,8 +1847,6 @@ static int ov5693_enum_frame_size(struct v4l2_subdev *sd, static const struct v4l2_subdev_video_ops ov5693_video_ops = { .s_stream = ov5693_s_stream, - .g_parm = ov5693_g_parm, - .s_parm = ov5693_s_parm, .g_frame_interval = ov5693_g_frame_interval, }; @@ -1947,7 +1893,7 @@ static int ov5693_probe(struct i2c_client *client) struct ov5693_device *dev; int i2c; int ret = 0; - void *pdata = client->dev.platform_data; + void *pdata; unsigned int i; /* diff --git a/drivers/staging/media/atomisp/i2c/ov5693/ov5693.h b/drivers/staging/media/atomisp/i2c/ov5693/ov5693.h index 68cfcb4a6c3c..6d27dd849a62 100644 --- a/drivers/staging/media/atomisp/i2c/ov5693/ov5693.h +++ b/drivers/staging/media/atomisp/i2c/ov5693/ov5693.h @@ -1147,6 +1147,11 @@ struct ov5693_resolution ov5693_res_preview[] = { }; #define N_RES_PREVIEW (ARRAY_SIZE(ov5693_res_preview)) +/* + * Disable non-preview configurations until the configuration selection is + * improved. + */ +#if 0 struct ov5693_resolution ov5693_res_still[] = { { .desc = "ov5693_736x496_30fps", @@ -1364,6 +1369,7 @@ struct ov5693_resolution ov5693_res_video[] = { }, }; #define N_RES_VIDEO (ARRAY_SIZE(ov5693_res_video)) +#endif static struct ov5693_resolution *ov5693_res = ov5693_res_preview; static unsigned long N_RES = N_RES_PREVIEW; diff --git a/drivers/staging/media/atomisp/i2c/ov8858.c b/drivers/staging/media/atomisp/i2c/ov8858.c deleted file mode 100644 index 3cf8c710ac65..000000000000 --- a/drivers/staging/media/atomisp/i2c/ov8858.c +++ /dev/null @@ -1,2169 +0,0 @@ -/* - * Support for OmniVision ov8858 camera sensor. - * - * Copyright (c) 2014 Intel Corporation. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * 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/delay.h> -#include <linux/module.h> -#include <media/v4l2-device.h> -#include <linux/acpi.h> -#include "../include/linux/atomisp_gmin_platform.h" -#ifdef CONFIG_PLATFORM_BTNS -#include "ov8858_btns.h" -#else -#include "ov8858.h" -#endif -static int ov8858_i2c_read(struct i2c_client *client, u16 len, u16 addr, - u8 *buf) -{ - struct i2c_msg msg[2]; - u8 address[2]; - int err; - - if (!client->adapter) { - dev_err(&client->dev, "%s error, no adapter\n", __func__); - return -ENODEV; - } - - dev_dbg(&client->dev, "%s: len = %d, addr = 0x%04x\n", - __func__, len, addr); - - memset(msg, 0, sizeof(msg)); - - address[0] = (addr >> 8) & 0xff; - address[1] = addr & 0xff; - - msg[0].addr = client->addr; - msg[0].flags = 0; - msg[0].len = I2C_MSG_LENGTH; - msg[0].buf = address; - - msg[1].addr = client->addr; - msg[1].len = len; - msg[1].flags = I2C_M_RD; - msg[1].buf = buf; - - err = i2c_transfer(client->adapter, msg, ARRAY_SIZE(msg)); - if (err != 2) { - if (err >= 0) - err = -EIO; - goto error; - } - - return 0; -error: - dev_err(&client->dev, "reading from address 0x%x error %d", addr, err); - return err; -} - -static int ov8858_read_reg(struct i2c_client *client, u16 type, u16 reg, - u16 *val) -{ - u8 data[OV8858_SHORT_MAX]; - int err; - - dev_dbg(&client->dev, "%s: type = %d, reg = 0x%04x\n", - __func__, type, reg); - - /* read only 8 and 16 bit values */ - if (type != OV8858_8BIT && type != OV8858_16BIT) { - dev_err(&client->dev, "%s error, invalid data length\n", - __func__); - return -EINVAL; - } - - memset(data, 0, sizeof(data)); - - err = ov8858_i2c_read(client, type, reg, data); - if (err) - goto error; - - /* high byte comes first */ - if (type == OV8858_8BIT) - *val = (u8)data[0]; - else - *val = data[0] << 8 | data[1]; - - dev_dbg(&client->dev, "%s: val = 0x%04x\n", __func__, *val); - - return 0; - -error: - dev_err(&client->dev, "read from offset 0x%x error %d", reg, err); - return err; -} - -static int ov8858_i2c_write(struct i2c_client *client, u16 len, u8 *data) -{ - struct i2c_msg msg; - const int num_msg = 1; - int ret; - - msg.addr = client->addr; - msg.flags = 0; - msg.len = len; - msg.buf = data; - - ret = i2c_transfer(client->adapter, &msg, 1); - - return ret == num_msg ? 0 : -EIO; -} - -static int -ov8858_write_reg(struct i2c_client *client, u16 data_length, u16 reg, u16 val) -{ - int ret; - unsigned char data[4] = {0}; - u16 *wreg; - const u16 len = data_length + sizeof(u16); /* 16-bit address + data */ - - dev_dbg(&client->dev, - "%s: data_length = %d, reg = 0x%04x, val = 0x%04x\n", - __func__, data_length, reg, val); - - if (!client->adapter) { - dev_err(&client->dev, "%s error, no adapter\n", __func__); - return -ENODEV; - } - - if (data_length != OV8858_8BIT && data_length != OV8858_16BIT) { - dev_err(&client->dev, "%s error, invalid length\n", __func__); - return -EINVAL; - } - - /* high byte goes out first */ - wreg = (u16 *)data; - *wreg = cpu_to_be16(reg); - - if (data_length == OV8858_8BIT) { - data[2] = (u8)(val); - } else { - /* OV8858_16BIT */ - u16 *wdata = (u16 *)&data[2]; - *wdata = be16_to_cpu(val); - } - - ret = ov8858_i2c_write(client, len, data); - if (ret) - dev_err(&client->dev, - "write error: wrote 0x%x to offset 0x%x error %d", - val, reg, ret); - - return ret; -} - -/* - * ov8858_write_reg_array - Initializes a list of registers - * @client: i2c driver client structure - * @reglist: list of registers to be written - * - * This function initializes a list of registers. When consecutive addresses - * are found in a row on the list, this function creates a buffer and sends - * consecutive data in a single i2c_transfer(). - * - * __ov8858_flush_reg_array(), __ov8858_buf_reg_array() and - * __ov8858_write_reg_is_consecutive() are internal functions to - * ov8858_write_reg_array() and should be not used anywhere else. - * - */ -static int __ov8858_flush_reg_array(struct i2c_client *client, - struct ov8858_write_ctrl *ctrl) -{ - u16 size; - if (ctrl->index == 0) - return 0; - - size = sizeof(u16) + ctrl->index; /* 16-bit address + data */ - ctrl->buffer.addr = cpu_to_be16(ctrl->buffer.addr); - ctrl->index = 0; - - return ov8858_i2c_write(client, size, (u8 *)&ctrl->buffer); -} - -static int __ov8858_buf_reg_array(struct i2c_client *client, - struct ov8858_write_ctrl *ctrl, - const struct ov8858_reg *next) -{ - int size; - u16 *data16; - - switch (next->type) { - case OV8858_8BIT: - size = 1; - ctrl->buffer.data[ctrl->index] = (u8)next->val; - break; - case OV8858_16BIT: - size = 2; - data16 = (u16 *)&ctrl->buffer.data[ctrl->index]; - *data16 = cpu_to_be16((u16)next->val); - break; - default: - return -EINVAL; - } - - /* When first item is added, we need to store its starting address */ - if (ctrl->index == 0) - ctrl->buffer.addr = next->sreg; - - ctrl->index += size; - - /* - * Buffer cannot guarantee free space for u32? Better flush it to avoid - * possible lack of memory for next item. - */ - if (ctrl->index + sizeof(u16) >= OV8858_MAX_WRITE_BUF_SIZE) - __ov8858_flush_reg_array(client, ctrl); - - return 0; -} - -static int -__ov8858_write_reg_is_consecutive(struct i2c_client *client, - struct ov8858_write_ctrl *ctrl, - const struct ov8858_reg *next) -{ - if (ctrl->index == 0) - return 1; - - return ctrl->buffer.addr + ctrl->index == next->sreg; -} - -static int ov8858_write_reg_array(struct i2c_client *client, - const struct ov8858_reg *reglist) -{ - const struct ov8858_reg *next = reglist; - struct ov8858_write_ctrl ctrl; - int err; - - ctrl.index = 0; - for (; next->type != OV8858_TOK_TERM; next++) { - switch (next->type & OV8858_TOK_MASK) { - case OV8858_TOK_DELAY: - err = __ov8858_flush_reg_array(client, &ctrl); - if (err) - return err; - msleep(next->val); - break; - - default: - /* - * If next address is not consecutive, data needs to be - * flushed before proceeding - */ - if (!__ov8858_write_reg_is_consecutive(client, - &ctrl, next)) { - err = __ov8858_flush_reg_array(client, &ctrl); - if (err) - return err; - } - err = __ov8858_buf_reg_array(client, &ctrl, next); - if (err) { - dev_err(&client->dev, "%s: write error\n", - __func__); - return err; - } - break; - } - } - - return __ov8858_flush_reg_array(client, &ctrl); -} - -static int __ov8858_min_fps_diff(int fps, - const struct ov8858_fps_setting *fps_list) -{ - int diff = INT_MAX; - int i; - - if (fps == 0) - return 0; - - for (i = 0; i < MAX_FPS_OPTIONS_SUPPORTED; i++) { - if (!fps_list[i].fps) - break; - if (abs(fps_list[i].fps - fps) < diff) - diff = abs(fps_list[i].fps - fps); - } - - return diff; -} - -static int __ov8858_nearest_fps_index(int fps, - const struct ov8858_fps_setting *fps_list) -{ - int fps_index = 0; - int i; - - for (i = 0; i < MAX_FPS_OPTIONS_SUPPORTED; i++) { - if (!fps_list[i].fps) - break; - if (abs(fps_list[i].fps - fps) - < abs(fps_list[fps_index].fps - fps)) - fps_index = i; - } - return fps_index; -} - -static int __ov8858_update_frame_timing(struct v4l2_subdev *sd, - u16 *hts, u16 *vts) -{ - struct i2c_client *client = v4l2_get_subdevdata(sd); - int ret; - - - dev_dbg(&client->dev, "%s OV8858_TIMING_HTS=0x%04x\n", - __func__, *hts); - - /* HTS = pixel_per_line / 2 */ - ret = ov8858_write_reg(client, OV8858_16BIT, - OV8858_TIMING_HTS, *hts >> 1); - if (ret) - return ret; - dev_dbg(&client->dev, "%s OV8858_TIMING_VTS=0x%04x\n", - __func__, *vts); - - return ov8858_write_reg(client, OV8858_16BIT, OV8858_TIMING_VTS, *vts); -} - -static int __ov8858_set_exposure(struct v4l2_subdev *sd, int exposure, int gain, - int dig_gain, u16 *hts, u16 *vts) -{ - struct ov8858_device *dev = to_ov8858_sensor(sd); - struct i2c_client *client = v4l2_get_subdevdata(sd); - int exp_val, ret; - dev_dbg(&client->dev, "%s, exposure = %d, gain=%d, dig_gain=%d\n", - __func__, exposure, gain, dig_gain); - - if (dev->limit_exposure_flag) { - if (exposure > *vts - OV8858_INTEGRATION_TIME_MARGIN) - exposure = *vts - OV8858_INTEGRATION_TIME_MARGIN; - } else { - if (*vts < exposure + OV8858_INTEGRATION_TIME_MARGIN) - *vts = (u16) exposure + OV8858_INTEGRATION_TIME_MARGIN; - } - - ret = __ov8858_update_frame_timing(sd, hts, vts); - if (ret) - return ret; - - /* For ov8858, the low 4 bits are fraction bits and must be kept 0 */ - exp_val = exposure << 4; - ret = ov8858_write_reg(client, OV8858_8BIT, - OV8858_LONG_EXPO+2, exp_val & 0xFF); - if (ret) - return ret; - - ret = ov8858_write_reg(client, OV8858_8BIT, - OV8858_LONG_EXPO+1, (exp_val >> 8) & 0xFF); - if (ret) - return ret; - - ret = ov8858_write_reg(client, OV8858_8BIT, - OV8858_LONG_EXPO, (exp_val >> 16) & 0x0F); - if (ret) - return ret; - - /* Digital gain : to all MWB channel gains */ - if (dig_gain) { - ret = ov8858_write_reg(client, OV8858_16BIT, - OV8858_MWB_RED_GAIN_H, dig_gain); - if (ret) - return ret; - - ret = ov8858_write_reg(client, OV8858_16BIT, - OV8858_MWB_GREEN_GAIN_H, dig_gain); - if (ret) - return ret; - - ret = ov8858_write_reg(client, OV8858_16BIT, - OV8858_MWB_BLUE_GAIN_H, dig_gain); - if (ret) - return ret; - } - - ret = ov8858_write_reg(client, OV8858_16BIT, OV8858_LONG_GAIN, - gain & 0x07ff); - if (ret) - return ret; - - dev->gain = gain; - dev->exposure = exposure; - dev->digital_gain = dig_gain; - - return 0; -} - -static int ov8858_set_exposure(struct v4l2_subdev *sd, int exposure, int gain, - int dig_gain) -{ - struct ov8858_device *dev = to_ov8858_sensor(sd); - const struct ov8858_resolution *res; - u16 hts, vts; - int ret; - - mutex_lock(&dev->input_lock); - - /* Validate exposure: cannot exceed 16bit value */ - exposure = clamp_t(int, exposure, 0, OV8858_MAX_EXPOSURE_VALUE); - - /* Validate gain: must not exceed maximum 8bit value */ - gain = clamp_t(int, gain, 0, OV8858_MAX_GAIN_VALUE); - - /* Validate digital gain: must not exceed 12 bit value*/ - dig_gain = clamp_t(int, dig_gain, 0, OV8858_MWB_GAIN_MAX); - - res = &dev->curr_res_table[dev->fmt_idx]; - /* - * Vendor: HTS reg value is half the total pixel line - */ - hts = res->fps_options[dev->fps_index].pixels_per_line; - vts = res->fps_options[dev->fps_index].lines_per_frame; - - ret = __ov8858_set_exposure(sd, exposure, gain, dig_gain, &hts, &vts); - - mutex_unlock(&dev->input_lock); - - return ret; -} - -/* - When exposure gain value set to sensor, the sensor changed value. - So we need the function to get real value - */ -static int ov8858_g_update_exposure(struct v4l2_subdev *sd, - struct atomisp_update_exposure *exposure) -{ - struct ov8858_device *dev = to_ov8858_sensor(sd); - struct i2c_client *client = v4l2_get_subdevdata(sd); - int gain = exposure->gain; - - dev_dbg(&client->dev, "%s: gain: %d, digi_gain: %d\n", __func__, - exposure->gain, exposure->digi_gain); - exposure->update_digi_gain = dev->digital_gain; - /* This real gain value fetching function is provided by vendor */ - exposure->update_gain = (((gain & 0x700) >> 8) + 1) * (gain & 0xFF); - - return 0; -} - -static int ov8858_s_exposure(struct v4l2_subdev *sd, - struct atomisp_exposure *exposure) -{ - return ov8858_set_exposure(sd, exposure->integration_time[0], - exposure->gain[0], exposure->gain[1]); -} - -static int ov8858_priv_int_data_init(struct v4l2_subdev *sd) -{ - struct ov8858_device *dev = to_ov8858_sensor(sd); - struct i2c_client *client = v4l2_get_subdevdata(sd); - u32 size = OV8858_OTP_END_ADDR - OV8858_OTP_START_ADDR + 1; - int r; - u16 isp_ctrl2 = 0; - - if (!dev->otp_data) { - dev->otp_data = devm_kzalloc(&client->dev, size, GFP_KERNEL); - if (!dev->otp_data) { - r = -ENOMEM; - goto error3; - } - - /* Streaming has to be on */ - r = ov8858_write_reg(client, OV8858_8BIT, OV8858_STREAM_MODE, - 0x01); - if (r) - goto error2; - - /* Turn off Dead Pixel Correction */ - r = ov8858_read_reg(client, OV8858_8BIT, - OV8858_OTP_ISP_CTRL2, &isp_ctrl2); - if (r) - goto error1; - - r = ov8858_write_reg(client, OV8858_8BIT, OV8858_OTP_ISP_CTRL2, - isp_ctrl2 & ~OV8858_OTP_DPC_ENABLE); - if (r) - goto error1; - - /* Enable partial OTP read mode */ - r = ov8858_write_reg(client, OV8858_8BIT, OV8858_OTP_MODE_CTRL, - OV8858_OTP_MODE_PROGRAM_DISABLE | - OV8858_OTP_MODE_MANUAL); - if (r) - goto error1; - - /* Set address range of OTP memory to read */ - r = ov8858_write_reg(client, OV8858_16BIT, - OV8858_OTP_START_ADDR_REG, - OV8858_OTP_START_ADDR); - if (r) - goto error1; - - r = ov8858_write_reg(client, OV8858_16BIT, - OV8858_OTP_END_ADDR_REG, - OV8858_OTP_END_ADDR); - if (r) - goto error1; - - /* Load the OTP data into the OTP buffer */ - r = ov8858_write_reg(client, OV8858_8BIT, OV8858_OTP_LOAD_CTRL, - OV8858_OTP_LOAD_ENABLE); - if (r) - goto error1; - - /* Wait for the data to load into the buffer */ - usleep_range(5000, 5500); - - /* Read the OTP data from the buffer */ - r = ov8858_i2c_read(client, size, OV8858_OTP_START_ADDR, - dev->otp_data); - if (r) - goto error1; - - /* Turn on Dead Pixel Correction */ - r = ov8858_write_reg(client, OV8858_8BIT, OV8858_OTP_ISP_CTRL2, - isp_ctrl2 | OV8858_OTP_DPC_ENABLE); - if (r) - goto error1; - - /* Stop streaming */ - r = ov8858_write_reg(client, 1, OV8858_STREAM_MODE, 0x00); - if (r) { - dev_err(&client->dev, "%s: cannot turn off streaming\n", - __func__); - goto error1; - } - } - - - return 0; - -error1: - /* Turn on Dead Pixel Correction and set streaming off */ - ov8858_write_reg(client, OV8858_8BIT, OV8858_OTP_ISP_CTRL2, - isp_ctrl2 | OV8858_OTP_DPC_ENABLE); - ov8858_write_reg(client, 1, OV8858_STREAM_MODE, 0x00); -error2: - devm_kfree(&client->dev, dev->otp_data); - dev->otp_data = NULL; -error3: - dev_err(&client->dev, "%s: OTP reading failed\n", __func__); - return r; -} - -static int ov8858_g_priv_int_data(struct v4l2_subdev *sd, - struct v4l2_private_int_data *priv) -{ - struct ov8858_device *dev = to_ov8858_sensor(sd); - struct i2c_client *client = v4l2_get_subdevdata(sd); - u32 size = OV8858_OTP_END_ADDR - OV8858_OTP_START_ADDR + 1; - int r; - - mutex_lock(&dev->input_lock); - - if (!dev->otp_data) { - dev_err(&client->dev, "%s: otp data is NULL\n", __func__); - mutex_unlock(&dev->input_lock); - return -EFAULT; - } - - if (copy_to_user(priv->data, dev->otp_data, - min_t(__u32, priv->size, size))) { - r = -EFAULT; - dev_err(&client->dev, "%s: OTP reading failed\n", __func__); - mutex_unlock(&dev->input_lock); - return r; - } - - priv->size = size; - mutex_unlock(&dev->input_lock); - - return 0; -} - -static int __ov8858_init(struct v4l2_subdev *sd) -{ - struct i2c_client *client = v4l2_get_subdevdata(sd); - struct ov8858_device *dev = to_ov8858_sensor(sd); - int ret; - dev_dbg(&client->dev, "%s\n", __func__); - - /* Sets the default FPS */ - dev->fps_index = 0; - - /* Set default exposure values (initially start values) */ - dev->exposure = 256; - dev->gain = 16; - dev->digital_gain = 1024; - dev->limit_exposure_flag = false; - - dev_dbg(&client->dev, "%s: Writing basic settings to ov8858\n", - __func__); - ret = ov8858_write_reg_array(client, ov8858_BasicSettings); - if (ret) - return ret; - - return ov8858_priv_int_data_init(sd); -} - -static int ov8858_init(struct v4l2_subdev *sd, u32 val) -{ - struct ov8858_device *dev = to_ov8858_sensor(sd); - int ret; - - mutex_lock(&dev->input_lock); - ret = __ov8858_init(sd); - mutex_unlock(&dev->input_lock); - - return ret; -} - -static void ov8858_uninit(struct v4l2_subdev *sd) -{ - struct i2c_client *client = v4l2_get_subdevdata(sd); - struct ov8858_device *dev = to_ov8858_sensor(sd); - struct v4l2_ctrl *ctrl; - dev_dbg(&client->dev, "%s:\n", __func__); - - dev->exposure = 0; - dev->gain = 0; - dev->digital_gain = 0; - dev->limit_exposure_flag = false; - mutex_unlock(&dev->input_lock); - ctrl = v4l2_ctrl_find(sd->ctrl_handler, - V4L2_CID_EXPOSURE_AUTO_PRIORITY); - if (ctrl) - v4l2_ctrl_s_ctrl(ctrl, V4L2_EXPOSURE_AUTO); - mutex_lock(&dev->input_lock); -} - -static int ov8858_g_comp_delay(struct v4l2_subdev *sd, unsigned int *usec) -{ - struct i2c_client *client = v4l2_get_subdevdata(sd); - struct ov8858_device *dev = to_ov8858_sensor(sd); - int ret = 0, exposure; - u16 vts, data; - - if (dev->exposure == 0) { - ret = ov8858_read_reg(client, OV8858_16BIT, - OV8858_LONG_EXPO + 1, &data); - if (ret) - return ret; - exposure = data; - exposure >>= 4; - } else { - exposure = dev->exposure; - } - - ret = ov8858_read_reg(client, OV8858_16BIT, OV8858_TIMING_VTS, &vts); - if (ret || vts == 0) - vts = OV8858_DEPTH_VTS_CONST; - - *usec = (exposure * 33333 / vts); - if (*usec > OV8858_DEPTH_COMP_CONST) - *usec = *usec - OV8858_DEPTH_COMP_CONST; - else - *usec = OV8858_DEPTH_COMP_CONST; - - return 0; -} - -static long ov8858_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg) -{ - struct i2c_client *client = v4l2_get_subdevdata(sd); - switch (cmd) { - case ATOMISP_IOC_S_EXPOSURE: - return ov8858_s_exposure(sd, (struct atomisp_exposure *)arg); - case ATOMISP_IOC_G_SENSOR_PRIV_INT_DATA: - return ov8858_g_priv_int_data(sd, arg); - case ATOMISP_IOC_G_DEPTH_SYNC_COMP: - return ov8858_g_comp_delay(sd, (unsigned int *)arg); - case ATOMISP_IOC_G_UPDATE_EXPOSURE: - return ov8858_g_update_exposure(sd, - (struct atomisp_update_exposure *)arg); - default: - dev_dbg(&client->dev, "Unhandled command 0x%X\n", cmd); - return -EINVAL; - } -} - -static int __power_ctrl(struct v4l2_subdev *sd, bool flag) -{ - int ret = 0; - struct ov8858_device *dev = to_ov8858_sensor(sd); - struct i2c_client *client = v4l2_get_subdevdata(sd); - - if (!dev || !dev->platform_data) - return -ENODEV; - - if (dev->platform_data->v1p2_ctrl) { - ret = dev->platform_data->v1p2_ctrl(sd, flag); - if (ret) { - dev_err(&client->dev, - "failed to power %s 1.2v power rail\n", - flag ? "up" : "down"); - return ret; - } - } - - if (dev->platform_data->v2p8_ctrl) { - ret = dev->platform_data->v2p8_ctrl(sd, flag); - if (ret) { - dev_err(&client->dev, - "failed to power %s 2.8v power rail\n", - flag ? "up" : "down"); - return ret; - } - } - - if (dev->platform_data->v1p8_ctrl) { - ret = dev->platform_data->v1p8_ctrl(sd, flag); - if (ret) { - dev_err(&client->dev, - "failed to power %s 1.8v power rail\n", - flag ? "up" : "down"); - if (dev->platform_data->v2p8_ctrl) - dev->platform_data->v2p8_ctrl(sd, 0); - return ret; - } - } - - if (flag) - msleep(20); /* Wait for power lines to stabilize */ - return ret; -} - -static int __gpio_ctrl(struct v4l2_subdev *sd, bool flag) -{ - struct i2c_client *client; - struct ov8858_device *dev; - - if (!sd) - return -EINVAL; - - client = v4l2_get_subdevdata(sd); - dev = to_ov8858_sensor(sd); - - if (!client || !dev || !dev->platform_data) - return -ENODEV; - - if (dev->platform_data->gpio0_ctrl) - return dev->platform_data->gpio0_ctrl(sd, flag); - - dev_err(&client->dev, "failed to find platform gpio callback\n"); - - return -EINVAL; -} - -static int power_up(struct v4l2_subdev *sd) -{ - struct i2c_client *client = v4l2_get_subdevdata(sd); - struct ov8858_device *dev = to_ov8858_sensor(sd); - int ret; - dev_dbg(&client->dev, "%s\n", __func__); - - /* Enable power */ - ret = __power_ctrl(sd, 1); - if (ret) { - dev_err(&client->dev, "power rail on failed %d.\n", ret); - goto fail_power; - } - - /* Enable clock */ - ret = dev->platform_data->flisclk_ctrl(sd, 1); - if (ret) { - dev_err(&client->dev, "flisclk on failed %d\n", ret); - goto fail_clk; - } - - /* Release reset */ - ret = __gpio_ctrl(sd, 1); - if (ret) { - dev_err(&client->dev, "gpio on failed %d\n", ret); - goto fail_gpio; - } - - /* Minumum delay is 8192 clock cycles before first i2c transaction, - * which is 1.37 ms at the lowest allowed clock rate 6 MHz */ - usleep_range(2000, 2500); - return 0; - -fail_gpio: - dev->platform_data->flisclk_ctrl(sd, 0); -fail_clk: - __power_ctrl(sd, 0); -fail_power: - dev_err(&client->dev, "Sensor power-up failed\n"); - - return ret; -} - -static int power_down(struct v4l2_subdev *sd) -{ - struct ov8858_device *dev = to_ov8858_sensor(sd); - struct i2c_client *client = v4l2_get_subdevdata(sd); - int ret; - dev_dbg(&client->dev, "%s\n", __func__); - - ret = dev->platform_data->flisclk_ctrl(sd, 0); - if (ret) - dev_err(&client->dev, "flisclk off failed\n"); - - ret = __gpio_ctrl(sd, 0); - if (ret) - dev_err(&client->dev, "gpio off failed\n"); - - ret = __power_ctrl(sd, 0); - if (ret) - dev_err(&client->dev, "power rail off failed.\n"); - - return ret; -} - -static int __ov8858_s_power(struct v4l2_subdev *sd, int on) -{ - struct ov8858_device *dev = to_ov8858_sensor(sd); - int ret, r = 0; - - if (on == 0) { - ov8858_uninit(sd); - if (dev->vcm_driver && dev->vcm_driver->power_down) - r = dev->vcm_driver->power_down(sd); - ret = power_down(sd); - if (r != 0 && ret == 0) - ret = r; - } else { - ret = power_up(sd); - if (ret) - power_down(sd); - if (dev->vcm_driver && dev->vcm_driver->power_up) { - ret = dev->vcm_driver->power_up(sd); - if (ret) { - power_down(sd); - return ret; - } - } - return __ov8858_init(sd); - } - - return ret; -} - -static int ov8858_s_power(struct v4l2_subdev *sd, int on) -{ - int ret; - struct ov8858_device *dev = to_ov8858_sensor(sd); - - mutex_lock(&dev->input_lock); - ret = __ov8858_s_power(sd, on); - mutex_unlock(&dev->input_lock); - - /* - * FIXME: Compatibility with old behaviour: return to preview - * when the device is power cycled. - */ - if (!ret && on) - v4l2_ctrl_s_ctrl(dev->run_mode, ATOMISP_RUN_MODE_PREVIEW); - - return ret; -} - -/* - * Return value of the specified register, first try getting it from - * the register list and if not found, get from the sensor via i2c. - */ -static int ov8858_get_register(struct v4l2_subdev *sd, int reg, int type, - const struct ov8858_reg *reglist) -{ - struct i2c_client *client = v4l2_get_subdevdata(sd); - const struct ov8858_reg *next; - u16 val; - - /* Try if the values are in the register list */ - for (next = reglist; next->type != OV8858_TOK_TERM; next++) { - if (next->sreg == reg) { - if (type == OV8858_8BIT) - return next->val; - - if (type == OV8858_16BIT && - next[1].type != OV8858_TOK_TERM) - return next[0].val << 8 | next[1].val; - } - } - - /* If not, read from sensor */ - if (ov8858_read_reg(client, type, reg, &val)) { - dev_err(&client->dev, "failed to read register 0x%08x\n", reg); - return -EIO; - } - - return val; -} - -static inline int ov8858_get_register_16bit(struct v4l2_subdev *sd, int reg, - const struct ov8858_reg *reglist) -{ - return ov8858_get_register(sd, reg, OV8858_16BIT, reglist); -} - -static inline int ov8858_get_register_8bit(struct v4l2_subdev *sd, int reg, - const struct ov8858_reg *reglist) -{ - return ov8858_get_register(sd, reg, OV8858_8BIT, reglist); -} - -static int __ov8858_get_pll1_values(struct v4l2_subdev *sd, - int *value, - const struct ov8858_reg *reglist) -{ - struct i2c_client *client = v4l2_get_subdevdata(sd); - unsigned int prediv_idx; - unsigned int multiplier; - unsigned int sys_prediv; - unsigned int prediv_coef[] = {2, 3, 4, 5, 6, 8, 12, 16}; - int ret; - - ret = ov8858_get_register_8bit(sd, OV8858_PLL1_PREDIV0, reglist); - if (ret < 0) - return ret; - - if (ret & OV8858_PLL1_PREDIV0_MASK) - *value /= 2; - - ret = ov8858_get_register_8bit(sd, OV8858_PLL1_PREDIV, reglist); - - if (ret < 0) - return ret; - - prediv_idx = ret & OV8858_PLL1_PREDIV_MASK; - *value = *value * 2 / prediv_coef[prediv_idx]; - - ret = ov8858_get_register_16bit(sd, OV8858_PLL1_MULTIPLIER, reglist); - if (ret < 0) - return ret; - - multiplier = ret; - *value *= multiplier & OV8858_PLL1_MULTIPLIER_MASK; - ret = ov8858_get_register_8bit(sd, OV8858_PLL1_SYS_PRE_DIV, reglist); - - if (ret < 0) - return ret; - - sys_prediv = ret & OV8858_PLL1_SYS_PRE_DIV_MASK; - *value /= (sys_prediv + 3); - ret = ov8858_get_register_8bit(sd, OV8858_PLL1_SYS_DIVIDER, reglist); - - if (ret < 0) - return ret; - - if (ret & OV8858_PLL1_SYS_DIVIDER_MASK) - *value /= 2; - - dev_dbg(&client->dev, "%s: *value: %d\n", __func__, *value); - - return 0; -} - -static int __ov8858_get_pll2a_values(struct v4l2_subdev *sd, int *value, - const struct ov8858_reg *reglist) -{ - struct i2c_client *client = v4l2_get_subdevdata(sd); - unsigned int prediv_idx; - unsigned int multiplier; - unsigned int prediv_coef[] = {2, 3, 4, 5, 6, 8, 12, 16}; - int ret; - - ret = ov8858_get_register_8bit(sd, OV8858_PLL2_PREDIV0, reglist); - if (ret < 0) - return ret; - - if (ret & OV8858_PLL2_PREDIV0_MASK) - *value /= 2; - - ret = ov8858_get_register_8bit(sd, OV8858_PLL2_PREDIV, reglist); - if (ret < 0) - return ret; - - prediv_idx = (ret & OV8858_PLL2_PREDIV_MASK); - *value = *value * 2 / prediv_coef[prediv_idx]; - - ret = ov8858_get_register_16bit(sd, OV8858_PLL2_MULTIPLIER, reglist); - if (ret < 0) - return ret; - - multiplier = ret; - *value *= multiplier & OV8858_PLL2_MULTIPLIER_MASK; - dev_dbg(&client->dev, "%s: *value: %d\n", __func__, *value); - - return 0; -} -static int __ov8858_get_pll2b_values(struct v4l2_subdev *sd, int *value, - const struct ov8858_reg *reglist) -{ - struct i2c_client *client = v4l2_get_subdevdata(sd); - unsigned int dac_divider; - int ret; - - ret = ov8858_get_register_8bit(sd, OV8858_PLL2_DAC_DIVIDER, reglist); - if (ret < 0) - return ret; - - dac_divider = (ret & OV8858_PLL2_DAC_DIVIDER_MASK) + 1; - *value /= dac_divider; - - dev_dbg(&client->dev, "%s: *value: %d\n", __func__, *value); - - return 0; -} -static int __ov8858_get_pll2c_values(struct v4l2_subdev *sd, int *value, - const struct ov8858_reg *reglist) -{ - struct i2c_client *client = v4l2_get_subdevdata(sd); - unsigned int sys_pre_div; - unsigned int sys_divider_idx; - unsigned int sys_divider_coef[] = {2, 3, 4, 5, 6, 7, 8, 10}; - int ret; - - ret = ov8858_get_register_8bit(sd, OV8858_PLL2_SYS_PRE_DIV, reglist); - if (ret < 0) - return ret; - - sys_pre_div = (ret & OV8858_PLL2_SYS_PRE_DIV_MASK) + 1; - *value /= sys_pre_div; - - ret = ov8858_get_register_8bit(sd, OV8858_PLL2_SYS_DIVIDER, reglist); - if (ret < 0) - return ret; - - sys_divider_idx = ret & OV8858_PLL2_SYS_DIVIDER_MASK; - *value *= 2 / sys_divider_coef[sys_divider_idx]; - - dev_dbg(&client->dev, "%s: *value: %d\n", __func__, *value); - - return 0; -} - -static int ov8858_get_intg_factor(struct v4l2_subdev *sd, - struct camera_mipi_info *info, - const struct ov8858_reg *reglist) -{ - const unsigned int ext_clk = 19200000; /* Hz */ - struct atomisp_sensor_mode_data *m = &info->data; - struct ov8858_device *dev = to_ov8858_sensor(sd); - struct i2c_client *client = v4l2_get_subdevdata(sd); - struct device *d = &client->dev; - const struct ov8858_resolution *res = - &dev->curr_res_table[dev->fmt_idx]; - unsigned int pll_sclksel1; - unsigned int pll_sclksel2; - unsigned int sys_pre_div; - unsigned int sclk_pdiv; - unsigned int sclk = ext_clk; - u16 hts; - int ret; - - memset(&info->data, 0, sizeof(info->data)); - - ret = ov8858_get_register_8bit(sd, OV8858_PLL_SCLKSEL1, reglist); - if (ret < 0) - return ret; - - dev_dbg(d, "%s: OV8858_PLL_SCLKSEL1: 0x%02x\n", __func__, ret); - pll_sclksel1 = ret & OV8858_PLL_SCLKSEL1_MASK; - - ret = ov8858_get_register_8bit(sd, OV8858_PLL_SCLKSEL2, reglist); - if (ret < 0) - return ret; - - dev_dbg(d, "%s: OV8858_PLL_SCLKSEL2: 0x%02x\n", __func__, ret); - pll_sclksel2 = ret & OV8858_PLL_SCLKSEL2_MASK; - - if (pll_sclksel2) { - ret = __ov8858_get_pll2a_values(sd, &sclk, reglist); - if (ret < 0) - return ret; - ret = __ov8858_get_pll2b_values(sd, &sclk, reglist); - if (ret < 0) - return ret; - } else if (pll_sclksel1) { - ret = __ov8858_get_pll2a_values(sd, &sclk, reglist); - if (ret < 0) - return ret; - ret = __ov8858_get_pll2c_values(sd, &sclk, reglist); - if (ret < 0) - return ret; - } else { - ret = __ov8858_get_pll1_values(sd, &sclk, reglist); - if (ret < 0) - return ret; - } - - ret = ov8858_get_register_8bit(sd, OV8858_SRB_HOST_INPUT_DIS, reglist); - if (ret < 0) - return ret; - - dev_dbg(d, "%s: OV8858_SRB_HOST_INPUT_DIS: 0x%02x\n", __func__, ret); - - sys_pre_div = ret & OV8858_SYS_PRE_DIV_MASK; - sys_pre_div >>= OV8858_SYS_PRE_DIV_OFFSET; - - if (sys_pre_div == 1) - sclk /= 2; - else if (sys_pre_div == 2) - sclk /= 4; - - sclk_pdiv = ret & OV8858_SCLK_PDIV_MASK; - sclk_pdiv >>= OV8858_SCLK_PDIV_OFFSET; - - if (sclk_pdiv > 1) - sclk /= sclk_pdiv; - - dev_dbg(d, "%s: sclk: %d\n", __func__, sclk); - - dev->vt_pix_clk_freq_mhz = sclk; - m->vt_pix_clk_freq_mhz = sclk; - - /* HTS and VTS */ - m->frame_length_lines = - res->fps_options[dev->fps_index].lines_per_frame; - m->line_length_pck = res->fps_options[dev->fps_index].pixels_per_line; - - m->coarse_integration_time_min = 0; - m->coarse_integration_time_max_margin = OV8858_INTEGRATION_TIME_MARGIN; - ret = ov8858_read_reg(client, OV8858_16BIT, OV8858_TIMING_HTS, &hts); - if (ret < 0) - return ret; - m->hts = hts; - dev_dbg(&client->dev, "%s: get HTS %d\n", __func__, hts); - - /* OV Sensor do not use fine integration time. */ - m->fine_integration_time_min = 0; - m->fine_integration_time_max_margin = 0; - - /* - * read_mode indicate whether binning is used for calculating - * the correct exposure value from the user side. So adapt the - * read mode values accordingly. - */ - m->read_mode = res->bin_factor_x ? - OV8858_READ_MODE_BINNING_ON : OV8858_READ_MODE_BINNING_OFF; - - ret = ov8858_get_register_8bit(sd, OV8858_H_INC_ODD, res->regs); - if (ret < 0) - return ret; - m->binning_factor_x = (ret + 1) / 2; - - ret = ov8858_get_register_8bit(sd, OV8858_V_INC_ODD, res->regs); - if (ret < 0) - return ret; - m->binning_factor_y = (ret + 1) / 2; - - /* Get the cropping and output resolution to ISP for this mode. */ - ret = ov8858_get_register_16bit(sd, OV8858_HORIZONTAL_START_H, - res->regs); - if (ret < 0) - return ret; - - m->crop_horizontal_start = ret; - - ret = ov8858_get_register_16bit(sd, OV8858_VERTICAL_START_H, res->regs); - if (ret < 0) - return ret; - - m->crop_vertical_start = ret; - - ret = ov8858_get_register_16bit(sd, OV8858_HORIZONTAL_END_H, res->regs); - if (ret < 0) - return ret; - - m->crop_horizontal_end = ret; - - ret = ov8858_get_register_16bit(sd, OV8858_VERTICAL_END_H, res->regs); - if (ret < 0) - return ret; - - m->crop_vertical_end = ret; - - ret = ov8858_get_register_16bit(sd, OV8858_HORIZONTAL_OUTPUT_SIZE_H, - res->regs); - if (ret < 0) - return ret; - - m->output_width = ret; - - ret = ov8858_get_register_16bit(sd, OV8858_VERTICAL_OUTPUT_SIZE_H, - res->regs); - if (ret < 0) - return ret; - - m->output_height = ret; - - return 0; -} - -/* - * distance - calculate the distance - * @res: resolution - * @w: width - * @h: height - * - * Get the gap between res_w/res_h and w/h. - * distance = (res_w/res_h - w/h) / (w/h) * 8192 - * res->width/height smaller than w/h wouldn't be considered. - * The gap of ratio larger than 1/8 wouldn't be considered. - * Returns the value of gap or -1 if fail. - */ -#define LARGEST_ALLOWED_RATIO_MISMATCH 1024 -static int distance(struct ov8858_resolution const *res, const u32 w, - const u32 h) -{ - int ratio; - int distance; - - if (w == 0 || h == 0 || - res->width < w || res->height < h) - return -1; - - ratio = res->width << 13; - ratio /= w; - ratio *= h; - ratio /= res->height; - - distance = abs(ratio - 8192); - - if (distance > LARGEST_ALLOWED_RATIO_MISMATCH) - return -1; - return distance; -} - -/* - * Returns the nearest higher resolution index. - * @w: width - * @h: height - * matching is done based on enveloping resolution and - * aspect ratio. If the aspect ratio cannot be matched - * to any index, -1 is returned. - */ -static int nearest_resolution_index(struct v4l2_subdev *sd, int w, int h) -{ - int i; - int idx = -1; - int dist; - int fps_diff; - int min_fps_diff = INT_MAX; - int min_dist = INT_MAX; - int min_res_w = INT_MAX; - const struct ov8858_resolution *tmp_res = NULL; - struct i2c_client *client = v4l2_get_subdevdata(sd); - struct ov8858_device *dev = to_ov8858_sensor(sd); - dev_dbg(&client->dev, "%s: w=%d, h=%d\n", __func__, w, h); - - for (i = 0; i < dev->entries_curr_table; i++) { - tmp_res = &dev->curr_res_table[i]; - dist = distance(tmp_res, w, h); - dev_dbg(&client->dev, - "%s[%d]: %dx%d distance=%d\n", tmp_res->desc, - i, tmp_res->width, tmp_res->height, dist); - if (dist == -1) - continue; - if (dist < min_dist) { - min_dist = dist; - min_res_w = tmp_res->width; - min_fps_diff = __ov8858_min_fps_diff(dev->fps, - tmp_res->fps_options); - idx = i; - } - if (dist == min_dist) { - fps_diff = __ov8858_min_fps_diff(dev->fps, - tmp_res->fps_options); - if (fps_diff < min_fps_diff) { - min_fps_diff = fps_diff; - idx = i; - } - if (tmp_res->width < min_res_w) { - min_res_w = tmp_res->width; - idx = i; - } - } - } - - return idx; -} - -static int ov8858_set_fmt(struct v4l2_subdev *sd, - struct v4l2_subdev_pad_config *cfg, - struct v4l2_subdev_format *format) -{ - struct v4l2_mbus_framefmt *fmt = &format->format; - struct ov8858_device *dev = to_ov8858_sensor(sd); - struct camera_mipi_info *ov8858_info = NULL; - struct i2c_client *client = v4l2_get_subdevdata(sd); - const struct ov8858_resolution *res; - int ret; - int idx; - if (format->pad) - return -EINVAL; - if (!fmt) - return -EINVAL; - - ov8858_info = v4l2_get_subdev_hostdata(sd); - if (ov8858_info == NULL) - return -EINVAL; - - mutex_lock(&dev->input_lock); - - if ((fmt->width > OV8858_RES_WIDTH_MAX) || - (fmt->height > OV8858_RES_HEIGHT_MAX)) { - fmt->width = OV8858_RES_WIDTH_MAX; - fmt->height = OV8858_RES_HEIGHT_MAX; - } else { - idx = nearest_resolution_index(sd, fmt->width, fmt->height); - - /* - * nearest_resolution_index() doesn't return smaller - * resolutions. If it fails, it means the requested resolution - * is higher than we can support. Fallback to highest possible - * resolution in this case. - */ - if (idx == -1) - idx = dev->entries_curr_table - 1; - - fmt->width = dev->curr_res_table[idx].width; - fmt->height = dev->curr_res_table[idx].height; - } - - fmt->code = MEDIA_BUS_FMT_SBGGR10_1X10; - if (format->which == V4L2_SUBDEV_FORMAT_TRY) { - cfg->try_fmt = *fmt; - mutex_unlock(&dev->input_lock); - return 0; - } - - dev->fmt_idx = nearest_resolution_index(sd, fmt->width, fmt->height); - if (dev->fmt_idx == -1) { - ret = -EINVAL; - goto out; - } - res = &dev->curr_res_table[dev->fmt_idx]; - dev_dbg(&client->dev, "%s: selected width = %d, height = %d\n", - __func__, res->width, res->height); - - /* Adjust the FPS selection based on the resolution selected */ - dev->fps_index = __ov8858_nearest_fps_index(dev->fps, res->fps_options); - dev->fps = res->fps_options[dev->fps_index].fps; - dev->regs = res->fps_options[dev->fps_index].regs; - if (!dev->regs) - dev->regs = res->regs; - - ret = ov8858_write_reg_array(client, dev->regs); - if (ret) - goto out; - - dev->pixels_per_line = res->fps_options[dev->fps_index].pixels_per_line; - dev->lines_per_frame = res->fps_options[dev->fps_index].lines_per_frame; - - /* ov8858 only support RGB RAW10 output */ - ov8858_info->metadata_width = res->width * 10 / 8; - ov8858_info->metadata_height = 2; - ov8858_info->metadata_format = ATOMISP_INPUT_FORMAT_EMBEDDED; - - /* Set the initial exposure */ - ret = __ov8858_set_exposure(sd, dev->exposure, dev->gain, - dev->digital_gain, &dev->pixels_per_line, - &dev->lines_per_frame); - if (ret) - goto out; - - ret = ov8858_get_intg_factor(sd, ov8858_info, dev->regs); - -out: - mutex_unlock(&dev->input_lock); - - return ret; -} - -static int ov8858_get_fmt(struct v4l2_subdev *sd, - struct v4l2_subdev_pad_config *cfg, - struct v4l2_subdev_format *format) -{ - struct v4l2_mbus_framefmt *fmt = &format->format; - struct ov8858_device *dev = to_ov8858_sensor(sd); - - if (format->pad) - return -EINVAL; - if (!fmt) - return -EINVAL; - - mutex_lock(&dev->input_lock); - fmt->width = dev->curr_res_table[dev->fmt_idx].width; - fmt->height = dev->curr_res_table[dev->fmt_idx].height; - fmt->code = MEDIA_BUS_FMT_SBGGR10_1X10; - mutex_unlock(&dev->input_lock); - - return 0; -} - -static int ov8858_detect(struct i2c_client *client, u16 *id) -{ - struct i2c_adapter *adapter = client->adapter; - u16 id_hi = 0; - u16 id_low = 0; - int ret; - - /* i2c check */ - if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) - return -ENODEV; - - dev_dbg(&client->dev, "%s: I2C functionality ok\n", __func__); - ret = ov8858_read_reg(client, OV8858_8BIT, OV8858_CHIP_ID_HIGH, &id_hi); - if (ret) - return ret; - dev_dbg(&client->dev, "%s: id_high = 0x%04x\n", __func__, id_hi); - ret = ov8858_read_reg(client, OV8858_8BIT, OV8858_CHIP_ID_LOW, &id_low); - if (ret) - return ret; - dev_dbg(&client->dev, "%s: id_low = 0x%04x\n", __func__, id_low); - *id = (id_hi << 8) | id_low; - - dev_dbg(&client->dev, "%s: chip_id = 0x%04x\n", __func__, *id); - - dev_info(&client->dev, "%s: chip_id = 0x%04x\n", __func__, *id); - if (*id != OV8858_CHIP_ID) - return -ENODEV; - - /* Stream off now. */ - return ov8858_write_reg(client, OV8858_8BIT, OV8858_STREAM_MODE, 0); -} - -static void __ov8858_print_timing(struct v4l2_subdev *sd) -{ - struct ov8858_device *dev = to_ov8858_sensor(sd); - struct i2c_client *client = v4l2_get_subdevdata(sd); - u16 width = dev->curr_res_table[dev->fmt_idx].width; - u16 height = dev->curr_res_table[dev->fmt_idx].height; - - dev_dbg(&client->dev, "Dump ov8858 timing in stream on:\n"); - dev_dbg(&client->dev, "width: %d:\n", width); - dev_dbg(&client->dev, "height: %d:\n", height); - dev_dbg(&client->dev, "pixels_per_line: %d:\n", dev->pixels_per_line); - dev_dbg(&client->dev, "line per frame: %d:\n", dev->lines_per_frame); - dev_dbg(&client->dev, "pix freq: %d:\n", dev->vt_pix_clk_freq_mhz); - /* updated formula: pixels_per_line = 2 * HTS */ - /* updated formula: fps = SCLK / (VTS * HTS) */ - dev_dbg(&client->dev, "init fps: %d:\n", dev->vt_pix_clk_freq_mhz / - (dev->pixels_per_line / 2) / dev->lines_per_frame); - dev_dbg(&client->dev, "HBlank: %d nS:\n", - 1000 * (dev->pixels_per_line - width) / - (dev->vt_pix_clk_freq_mhz / 1000000)); - dev_dbg(&client->dev, "VBlank: %d uS:\n", - (dev->lines_per_frame - height) * dev->pixels_per_line / - (dev->vt_pix_clk_freq_mhz / 1000000)); -} - -/* - * ov8858 stream on/off - */ -static int ov8858_s_stream(struct v4l2_subdev *sd, int enable) -{ - struct ov8858_device *dev = to_ov8858_sensor(sd); - struct i2c_client *client = v4l2_get_subdevdata(sd); - int ret; - u16 val; - dev_dbg(&client->dev, "%s: enable = %d\n", __func__, enable); - - /* Set orientation */ - ret = ov8858_read_reg(client, OV8858_8BIT, OV8858_FORMAT2, &val); - if (ret) - return ret; - - ret = ov8858_write_reg(client, OV8858_8BIT, OV8858_FORMAT2, - dev->hflip ? val | OV8858_FLIP_ENABLE : - val & ~OV8858_FLIP_ENABLE); - if (ret) - return ret; - - ret = ov8858_read_reg(client, OV8858_8BIT, OV8858_FORMAT1, &val); - if (ret) - return ret; - - ret = ov8858_write_reg(client, OV8858_8BIT, OV8858_FORMAT1, - dev->vflip ? val | OV8858_FLIP_ENABLE : - val & ~OV8858_FLIP_ENABLE); - if (ret) - return ret; - - mutex_lock(&dev->input_lock); - if (enable) { - __ov8858_print_timing(sd); - ret = ov8858_write_reg_array(client, ov8858_streaming); - if (ret != 0) { - dev_err(&client->dev, "write_reg_array err\n"); - goto out; - } - dev->streaming = 1; - } else { - ret = ov8858_write_reg_array(client, ov8858_soft_standby); - if (ret != 0) { - dev_err(&client->dev, "write_reg_array err\n"); - goto out; - } - dev->streaming = 0; - dev->fps_index = 0; - dev->fps = 0; - } -out: - mutex_unlock(&dev->input_lock); - return ret; -} - -static int __update_ov8858_device_settings(struct ov8858_device *dev, - u16 sensor_id) -{ - if (sensor_id == OV8858_CHIP_ID) -#ifdef CONFIG_PLATFORM_BTNS - dev->vcm_driver = &ov8858_vcms[OV8858_ID_DEFAULT]; -#else - dev->vcm_driver = &ov8858_vcms[OV8858_SUNNY]; -#endif - else - return -ENODEV; - - if (dev->vcm_driver && dev->vcm_driver->init) - return dev->vcm_driver->init(&dev->sd); - - return 0; -} - -static int ov8858_s_config(struct v4l2_subdev *sd, - int irq, void *pdata) -{ - struct ov8858_device *dev = to_ov8858_sensor(sd); - struct i2c_client *client = v4l2_get_subdevdata(sd); - u16 sensor_id; - int ret; - - if (pdata == NULL) - return -ENODEV; - - dev->platform_data = pdata; - - mutex_lock(&dev->input_lock); - - ret = __ov8858_s_power(sd, 1); - if (ret) { - dev_err(&client->dev, "power-up error %d!\n", ret); - mutex_unlock(&dev->input_lock); - return ret; - } - - ret = dev->platform_data->csi_cfg(sd, 1); - if (ret) - goto fail_csi_cfg; - - /* config & detect sensor */ - ret = ov8858_detect(client, &sensor_id); - if (ret) { - dev_err(&client->dev, "detect error %d!\n", ret); - goto fail_detect; - } - - dev->sensor_id = sensor_id; - - /* power off sensor */ - ret = __ov8858_s_power(sd, 0); - if (ret) { - dev->platform_data->csi_cfg(sd, 0); - dev_err(&client->dev, "__ov8858_s_power-down error %d!\n", ret); - goto fail_update; - } - - /* Resolution settings depend on sensor type and platform */ - ret = __update_ov8858_device_settings(dev, dev->sensor_id); - if (ret) { - dev->platform_data->csi_cfg(sd, 0); - dev_err(&client->dev, "__update_ov8858_device_settings error %d!\n", ret); - goto fail_update; - } - - mutex_unlock(&dev->input_lock); - return ret; - -fail_detect: - dev->platform_data->csi_cfg(sd, 0); -fail_csi_cfg: - __ov8858_s_power(sd, 0); -fail_update: - mutex_unlock(&dev->input_lock); - dev_err(&client->dev, "sensor power-gating failed\n"); - return ret; -} - -static int -ov8858_enum_mbus_code(struct v4l2_subdev *sd, - struct v4l2_subdev_pad_config *cfg, - struct v4l2_subdev_mbus_code_enum *code) -{ - if (code->index) - return -EINVAL; - code->code = MEDIA_BUS_FMT_SBGGR10_1X10; - - return 0; -} - -static int -ov8858_enum_frame_size(struct v4l2_subdev *sd, - struct v4l2_subdev_pad_config *cfg, - struct v4l2_subdev_frame_size_enum *fse) -{ - int index = fse->index; - struct ov8858_device *dev = to_ov8858_sensor(sd); - - mutex_lock(&dev->input_lock); - if (index >= dev->entries_curr_table) { - mutex_unlock(&dev->input_lock); - return -EINVAL; - } - - fse->min_width = dev->curr_res_table[index].width; - fse->min_height = dev->curr_res_table[index].height; - fse->max_width = dev->curr_res_table[index].width; - fse->max_height = dev->curr_res_table[index].height; - mutex_unlock(&dev->input_lock); - - return 0; -} - -static int ov8858_s_ctrl(struct v4l2_ctrl *ctrl) -{ - struct ov8858_device *dev = container_of( - ctrl->handler, struct ov8858_device, ctrl_handler); - struct i2c_client *client = v4l2_get_subdevdata(&dev->sd); - - /* input_lock is taken by the control framework, so it - * doesn't need to be taken here. - */ - - switch (ctrl->id) { - case V4L2_CID_RUN_MODE: - switch (ctrl->val) { - case ATOMISP_RUN_MODE_VIDEO: - dev->curr_res_table = ov8858_res_video; - dev->entries_curr_table = ARRAY_SIZE(ov8858_res_video); - break; - case ATOMISP_RUN_MODE_STILL_CAPTURE: - dev->curr_res_table = ov8858_res_still; - dev->entries_curr_table = ARRAY_SIZE(ov8858_res_still); - break; - default: - dev->curr_res_table = ov8858_res_preview; - dev->entries_curr_table = - ARRAY_SIZE(ov8858_res_preview); - } - - dev->fmt_idx = 0; - dev->fps_index = 0; - - return 0; - case V4L2_CID_FOCUS_ABSOLUTE: - if (dev->vcm_driver && dev->vcm_driver->t_focus_abs) - return dev->vcm_driver->t_focus_abs(&dev->sd, - ctrl->val); - return 0; - case V4L2_CID_EXPOSURE_AUTO_PRIORITY: - if (ctrl->val == V4L2_EXPOSURE_AUTO) - dev->limit_exposure_flag = false; - else if (ctrl->val == V4L2_EXPOSURE_APERTURE_PRIORITY) - dev->limit_exposure_flag = true; - return 0; - case V4L2_CID_HFLIP: - dev->hflip = ctrl->val; - return 0; - case V4L2_CID_VFLIP: - dev->vflip = ctrl->val; - return 0; - default: - dev_err(&client->dev, "%s: Error: Invalid ctrl: 0x%X\n", - __func__, ctrl->id); - return -EINVAL; - } -} - -static int ov8858_g_ctrl(struct v4l2_ctrl *ctrl) -{ - struct ov8858_device *dev = container_of( - ctrl->handler, struct ov8858_device, ctrl_handler); - struct i2c_client *client = v4l2_get_subdevdata(&dev->sd); - int r_odd, r_even; - int i = dev->fmt_idx; - - switch (ctrl->id) { - case V4L2_CID_FOCUS_STATUS: - if (dev->vcm_driver && dev->vcm_driver->q_focus_status) - return dev->vcm_driver->q_focus_status(&dev->sd, - &(ctrl->val)); - return 0; - case V4L2_CID_BIN_FACTOR_HORZ: - r_odd = ov8858_get_register_8bit(&dev->sd, OV8858_H_INC_ODD, - dev->curr_res_table[i].regs); - if (r_odd < 0) - return r_odd; - r_even = ov8858_get_register_8bit(&dev->sd, OV8858_H_INC_EVEN, - dev->curr_res_table[i].regs); - if (r_even < 0) - return r_even; - ctrl->val = fls(r_odd + (r_even)) - 2; - return 0; - - case V4L2_CID_BIN_FACTOR_VERT: - r_odd = ov8858_get_register_8bit(&dev->sd, OV8858_V_INC_ODD, - dev->curr_res_table[i].regs); - if (r_odd < 0) - return r_odd; - r_even = ov8858_get_register_8bit(&dev->sd, OV8858_V_INC_EVEN, - dev->curr_res_table[i].regs); - if (r_even < 0) - return r_even; - ctrl->val = fls(r_odd + (r_even)) - 2; - return 0; - case V4L2_CID_HFLIP: - ctrl->val = dev->hflip; - break; - case V4L2_CID_VFLIP: - ctrl->val = dev->vflip; - break; - case V4L2_CID_EXPOSURE_ABSOLUTE: - ctrl->val = dev->exposure; - break; - default: - dev_warn(&client->dev, - "%s: Error: Invalid ctrl: 0x%X\n", __func__, ctrl->id); - return -EINVAL; - } - - return 0; -} - -static int -ov8858_g_frame_interval(struct v4l2_subdev *sd, - struct v4l2_subdev_frame_interval *interval) -{ - struct ov8858_device *dev = to_ov8858_sensor(sd); - const struct ov8858_resolution *res = - &dev->curr_res_table[dev->fmt_idx]; - - mutex_lock(&dev->input_lock); - interval->interval.denominator = res->fps_options[dev->fps_index].fps; - interval->interval.numerator = 1; - mutex_unlock(&dev->input_lock); - return 0; -} - -static int __ov8858_s_frame_interval(struct v4l2_subdev *sd, - struct v4l2_subdev_frame_interval *interval) -{ - struct ov8858_device *dev = to_ov8858_sensor(sd); - struct i2c_client *client = v4l2_get_subdevdata(sd); - const struct ov8858_resolution *res = - &dev->curr_res_table[dev->fmt_idx]; - struct camera_mipi_info *info = NULL; - unsigned int fps_index; - int ret = 0; - int fps; - - info = v4l2_get_subdev_hostdata(sd); - if (info == NULL) - return -EINVAL; - - if (!interval->interval.numerator) - interval->interval.numerator = 1; - - fps = interval->interval.denominator / interval->interval.numerator; - - /* No need to proceed further if we are not streaming */ - if (!dev->streaming) { - /* Save the new FPS and use it while selecting setting */ - dev->fps = fps; - return 0; - } - - /* Ignore if we are already using the required FPS. */ - if (fps == res->fps_options[dev->fps_index].fps) - return 0; - - fps_index = __ov8858_nearest_fps_index(fps, res->fps_options); - - if (res->fps_options[fps_index].regs && - res->fps_options[fps_index].regs != dev->regs) { - dev_err(&client->dev, - "Sensor is streaming, can't apply new configuration\n"); - return -EBUSY; - } - - dev->fps_index = fps_index; - dev->fps = res->fps_options[dev->fps_index].fps; - - /* Update the new frametimings based on FPS */ - dev->pixels_per_line = - res->fps_options[dev->fps_index].pixels_per_line; - dev->lines_per_frame = - res->fps_options[dev->fps_index].lines_per_frame; - - /* update frametiming. Conside the curren exposure/gain as well */ - ret = __ov8858_update_frame_timing(sd, - &dev->pixels_per_line, &dev->lines_per_frame); - if (ret) - return ret; - - /* Update the new values so that user side knows the current settings */ - ret = ov8858_get_intg_factor(sd, info, dev->regs); - if (ret) - return ret; - - interval->interval.denominator = res->fps_options[dev->fps_index].fps; - interval->interval.numerator = 1; - __ov8858_print_timing(sd); - - return ret; -} - -static int ov8858_s_frame_interval(struct v4l2_subdev *sd, - struct v4l2_subdev_frame_interval *interval) -{ - struct ov8858_device *dev = to_ov8858_sensor(sd); - int ret; - - mutex_lock(&dev->input_lock); - ret = __ov8858_s_frame_interval(sd, interval); - mutex_unlock(&dev->input_lock); - - return ret; -} - -static int ov8858_g_skip_frames(struct v4l2_subdev *sd, u32 *frames) -{ - struct ov8858_device *dev = to_ov8858_sensor(sd); - - mutex_lock(&dev->input_lock); - *frames = dev->curr_res_table[dev->fmt_idx].skip_frames; - mutex_unlock(&dev->input_lock); - - return 0; -} - -static const struct v4l2_subdev_sensor_ops ov8858_sensor_ops = { - .g_skip_frames = ov8858_g_skip_frames, -}; - -static const struct v4l2_ctrl_ops ctrl_ops = { - .s_ctrl = ov8858_s_ctrl, - .g_volatile_ctrl = ov8858_g_ctrl, -}; - -static const struct v4l2_subdev_video_ops ov8858_video_ops = { - .s_stream = ov8858_s_stream, - .g_frame_interval = ov8858_g_frame_interval, - .s_frame_interval = ov8858_s_frame_interval, -}; - -static const struct v4l2_subdev_core_ops ov8858_core_ops = { - .s_power = ov8858_s_power, - .ioctl = ov8858_ioctl, - .init = ov8858_init, -}; - -static const struct v4l2_subdev_pad_ops ov8858_pad_ops = { - .enum_mbus_code = ov8858_enum_mbus_code, - .enum_frame_size = ov8858_enum_frame_size, - .get_fmt = ov8858_get_fmt, - .set_fmt = ov8858_set_fmt, -}; - -static const struct v4l2_subdev_ops ov8858_ops = { - .core = &ov8858_core_ops, - .video = &ov8858_video_ops, - .pad = &ov8858_pad_ops, - .sensor = &ov8858_sensor_ops, -}; - -static const struct media_entity_operations ov_entity_ops = { - .link_setup = NULL, -}; - -static int ov8858_remove(struct i2c_client *client) -{ - struct v4l2_subdev *sd = i2c_get_clientdata(client); - struct ov8858_device *dev = to_ov8858_sensor(sd); - - media_entity_cleanup(&dev->sd.entity); - v4l2_ctrl_handler_free(&dev->ctrl_handler); - dev->platform_data->csi_cfg(sd, 0); - v4l2_device_unregister_subdev(sd); - kfree(dev); - - return 0; -} - -static const char * const ctrl_run_mode_menu[] = { - NULL, - "Video", - "Still capture", - "Continuous capture", - "Preview", -}; - -static const struct v4l2_ctrl_config ctrl_run_mode = { - .ops = &ctrl_ops, - .id = V4L2_CID_RUN_MODE, - .name = "run mode", - .type = V4L2_CTRL_TYPE_MENU, - .min = 1, - .def = 4, - .max = 4, - .qmenu = ctrl_run_mode_menu, -}; - -static const struct v4l2_ctrl_config ctrls[] = { - { - .ops = &ctrl_ops, - .id = V4L2_CID_VFLIP, - .name = "Vertical flip", - .type = V4L2_CTRL_TYPE_BOOLEAN, - .min = false, - .max = true, - .step = 1, - }, { - .ops = &ctrl_ops, - .id = V4L2_CID_HFLIP, - .name = "Horizontal flip", - .type = V4L2_CTRL_TYPE_BOOLEAN, - .min = false, - .max = true, - .step = 1, - }, { - .ops = &ctrl_ops, - .id = V4L2_CID_EXPOSURE_ABSOLUTE, - .name = "Absolute exposure", - .type = V4L2_CTRL_TYPE_INTEGER, - .max = 0xffff, - .min = 0x0, - .step = 1, - .def = 0x00, - .flags = V4L2_CTRL_FLAG_READ_ONLY | V4L2_CTRL_FLAG_VOLATILE, - }, { - .ops = &ctrl_ops, - .id = V4L2_CID_FOCUS_ABSOLUTE, - .name = "Focus absolute", - .type = V4L2_CTRL_TYPE_INTEGER, - .step = 1, - .max = OV8858_MAX_FOCUS_POS, - }, { - /* This one is junk: see the spec for proper use of this CID. */ - .ops = &ctrl_ops, - .id = V4L2_CID_FOCUS_STATUS, - .name = "Focus status", - .type = V4L2_CTRL_TYPE_INTEGER, - .step = 1, - .max = 100, - .flags = V4L2_CTRL_FLAG_READ_ONLY | V4L2_CTRL_FLAG_VOLATILE, - }, { - /* This is crap. For compatibility use only. */ - .ops = &ctrl_ops, - .id = V4L2_CID_FOCAL_ABSOLUTE, - .name = "Focal lenght", - .type = V4L2_CTRL_TYPE_INTEGER, - .min = (OV8858_FOCAL_LENGTH_NUM << 16) | - OV8858_FOCAL_LENGTH_DEM, - .max = (OV8858_FOCAL_LENGTH_NUM << 16) | - OV8858_FOCAL_LENGTH_DEM, - .step = 1, - .def = (OV8858_FOCAL_LENGTH_NUM << 16) | - OV8858_FOCAL_LENGTH_DEM, - .flags = V4L2_CTRL_FLAG_READ_ONLY, - }, { - /* This one is crap, too. For compatibility use only. */ - .ops = &ctrl_ops, - .id = V4L2_CID_FNUMBER_ABSOLUTE, - .name = "F-number", - .type = V4L2_CTRL_TYPE_INTEGER, - .min = (OV8858_F_NUMBER_DEFAULT_NUM << 16) | - OV8858_F_NUMBER_DEM, - .max = (OV8858_F_NUMBER_DEFAULT_NUM << 16) | - OV8858_F_NUMBER_DEM, - .step = 1, - .def = (OV8858_F_NUMBER_DEFAULT_NUM << 16) | - OV8858_F_NUMBER_DEM, - .flags = V4L2_CTRL_FLAG_READ_ONLY, - }, { - /* - * The most utter crap. _Never_ use this, even for - * compatibility reasons! - */ - .ops = &ctrl_ops, - .id = V4L2_CID_FNUMBER_RANGE, - .name = "F-number range", - .type = V4L2_CTRL_TYPE_INTEGER, - .min = (OV8858_F_NUMBER_DEFAULT_NUM << 24) | - (OV8858_F_NUMBER_DEM << 16) | - (OV8858_F_NUMBER_DEFAULT_NUM << 8) | - OV8858_F_NUMBER_DEM, - .max = (OV8858_F_NUMBER_DEFAULT_NUM << 24) | - (OV8858_F_NUMBER_DEM << 16) | - (OV8858_F_NUMBER_DEFAULT_NUM << 8) | - OV8858_F_NUMBER_DEM, - .step = 1, - .def = (OV8858_F_NUMBER_DEFAULT_NUM << 24) | - (OV8858_F_NUMBER_DEM << 16) | - (OV8858_F_NUMBER_DEFAULT_NUM << 8) | - OV8858_F_NUMBER_DEM, - .flags = V4L2_CTRL_FLAG_READ_ONLY, - }, { - .ops = &ctrl_ops, - .id = V4L2_CID_BIN_FACTOR_HORZ, - .name = "Horizontal binning factor", - .type = V4L2_CTRL_TYPE_INTEGER, - .max = OV8858_BIN_FACTOR_MAX, - .step = 1, - .flags = V4L2_CTRL_FLAG_READ_ONLY | V4L2_CTRL_FLAG_VOLATILE, - }, { - .ops = &ctrl_ops, - .id = V4L2_CID_BIN_FACTOR_VERT, - .name = "Vertical binning factor", - .type = V4L2_CTRL_TYPE_INTEGER, - .max = OV8858_BIN_FACTOR_MAX, - .step = 1, - .flags = V4L2_CTRL_FLAG_READ_ONLY | V4L2_CTRL_FLAG_VOLATILE, - }, { - .ops = &ctrl_ops, - .id = V4L2_CID_EXPOSURE_AUTO_PRIORITY, - .name = "Exposure auto priority", - .type = V4L2_CTRL_TYPE_INTEGER, - .min = V4L2_EXPOSURE_AUTO, - .max = V4L2_EXPOSURE_APERTURE_PRIORITY, - .step = 1, - } -}; - -static int ov8858_probe(struct i2c_client *client) -{ - struct ov8858_device *dev; - unsigned int i; - int ret = 0; - struct camera_sensor_platform_data *pdata; - - dev_dbg(&client->dev, "%s:\n", __func__); - - /* allocate sensor device & init sub device */ - dev = kzalloc(sizeof(*dev), GFP_KERNEL); - if (!dev) - return -ENOMEM; - - mutex_init(&dev->input_lock); - - dev->fmt_idx = 0; - dev->sensor_id = OV_ID_DEFAULT; - dev->vcm_driver = &ov8858_vcms[OV8858_ID_DEFAULT]; - - v4l2_i2c_subdev_init(&(dev->sd), client, &ov8858_ops); - - pdata = gmin_camera_platform_data(&dev->sd, - ATOMISP_INPUT_FORMAT_RAW_10, - atomisp_bayer_order_bggr); - if (!pdata) { - dev_err(&client->dev, - "%s: failed to get acpi platform data\n", - __func__); - goto out_free; - } - ret = ov8858_s_config(&dev->sd, client->irq, pdata); - if (ret) { - dev_err(&client->dev, - "%s: failed to set config\n", __func__); - goto out_free; - } - ret = atomisp_register_i2c_module(&dev->sd, pdata, RAW_CAMERA); - if (ret) { - dev_err(&client->dev, - "%s: failed to register subdev\n", __func__); - goto out_free; - } - - /* - * sd->name is updated with sensor driver name by the v4l2. - * change it to sensor name in this case. - */ - snprintf(dev->sd.name, sizeof(dev->sd.name), "%s%x %d-%04x", - OV_SUBDEV_PREFIX, dev->sensor_id, - i2c_adapter_id(client->adapter), client->addr); - - dev->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; - dev->pad.flags = MEDIA_PAD_FL_SOURCE; - dev->format.code = MEDIA_BUS_FMT_SBGGR10_1X10; - dev->sd.entity.ops = &ov_entity_ops; - dev->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR; - - ret = v4l2_ctrl_handler_init(&dev->ctrl_handler, ARRAY_SIZE(ctrls) + 1); - if (ret) { - ov8858_remove(client); - return ret; - } - - dev->run_mode = v4l2_ctrl_new_custom(&dev->ctrl_handler, - &ctrl_run_mode, NULL); - - for (i = 0; i < ARRAY_SIZE(ctrls); i++) - v4l2_ctrl_new_custom(&dev->ctrl_handler, &ctrls[i], NULL); - - if (dev->ctrl_handler.error) { - ov8858_remove(client); - return dev->ctrl_handler.error; - } - - /* Use same lock for controls as for everything else. */ - dev->ctrl_handler.lock = &dev->input_lock; - dev->sd.ctrl_handler = &dev->ctrl_handler; - v4l2_ctrl_handler_setup(&dev->ctrl_handler); - - ret = media_entity_pads_init(&dev->sd.entity, 1, &dev->pad); - if (ret) { - ov8858_remove(client); - return ret; - } - - return 0; - -out_free: - v4l2_device_unregister_subdev(&dev->sd); - kfree(dev); - return ret; -} - -static const struct acpi_device_id ov8858_acpi_match[] = { - {"INT3477"}, - {}, -}; -MODULE_DEVICE_TABLE(acpi, ov8858_acpi_match); - -static struct i2c_driver ov8858_driver = { - .driver = { - .name = "ov8858", - .acpi_match_table = ov8858_acpi_match, - }, - .probe_new = ov8858_probe, - .remove = ov8858_remove, -}; -module_i2c_driver(ov8858_driver); - -MODULE_DESCRIPTION("A low-level driver for Omnivision OV8858 sensors"); -MODULE_LICENSE("GPL"); diff --git a/drivers/staging/media/atomisp/i2c/ov8858.h b/drivers/staging/media/atomisp/i2c/ov8858.h deleted file mode 100644 index 6c89568bb44e..000000000000 --- a/drivers/staging/media/atomisp/i2c/ov8858.h +++ /dev/null @@ -1,1474 +0,0 @@ -/* - * Support for the Omnivision OV8858 camera sensor. - * - * Copyright (c) 2014 Intel Corporation. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * 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 __OV8858_H__ -#define __OV8858_H__ -#include "../include/linux/atomisp_platform.h" -#include <media/v4l2-ctrls.h> - -#define I2C_MSG_LENGTH 0x2 - -/* - * This should be added into include/linux/videodev2.h - * NOTE: This is most likely not used anywhere. - */ -#define V4L2_IDENT_OV8858 V4L2_IDENT_UNKNOWN - -/* - * Indexes for VCM driver lists - */ -#define OV8858_ID_DEFAULT 0 -#define OV8858_SUNNY 1 - -#define OV8858_OTP_START_ADDR 0x7010 -#define OV8858_OTP_END_ADDR 0x7186 - -/* - * ov8858 System control registers - */ - -#define OV8858_OTP_LOAD_CTRL 0x3D81 -#define OV8858_OTP_MODE_CTRL 0x3D84 -#define OV8858_OTP_START_ADDR_REG 0x3D88 -#define OV8858_OTP_END_ADDR_REG 0x3D8A -#define OV8858_OTP_ISP_CTRL2 0x5002 - -#define OV8858_OTP_MODE_MANUAL BIT(6) -#define OV8858_OTP_MODE_PROGRAM_DISABLE BIT(7) -#define OV8858_OTP_LOAD_ENABLE BIT(0) -#define OV8858_OTP_DPC_ENABLE BIT(3) - -#define OV8858_PLL1_PREDIV0 0x030A -#define OV8858_PLL1_PREDIV 0x0300 -#define OV8858_PLL1_MULTIPLIER 0x0301 -#define OV8858_PLL1_SYS_PRE_DIV 0x0305 -#define OV8858_PLL1_SYS_DIVIDER 0x0306 - -#define OV8858_PLL1_PREDIV0_MASK BIT(0) -#define OV8858_PLL1_PREDIV_MASK (BIT(0) | BIT(1) | BIT(2)) -#define OV8858_PLL1_MULTIPLIER_MASK 0x01FF -#define OV8858_PLL1_SYS_PRE_DIV_MASK (BIT(0) | BIT(1)) -#define OV8858_PLL1_SYS_DIVIDER_MASK BIT(0) - -#define OV8858_PLL2_PREDIV0 0x0312 -#define OV8858_PLL2_PREDIV 0x030B -#define OV8858_PLL2_MULTIPLIER 0x030C -#define OV8858_PLL2_DAC_DIVIDER 0x0312 -#define OV8858_PLL2_SYS_PRE_DIV 0x030F -#define OV8858_PLL2_SYS_DIVIDER 0x030E - -#define OV8858_PLL2_PREDIV0_MASK BIT(4) -#define OV8858_PLL2_PREDIV_MASK (BIT(0) | BIT(1) | BIT(2)) -#define OV8858_PLL2_MULTIPLIER_MASK 0x01FF -#define OV8858_PLL2_DAC_DIVIDER_MASK (BIT(0) | BIT(1) | BIT(2) | BIT(3)) -#define OV8858_PLL2_SYS_PRE_DIV_MASK (BIT(0) | BIT(1) | BIT(2) | BIT(3)) -#define OV8858_PLL2_SYS_DIVIDER_MASK (BIT(0) | BIT(1) | BIT(2)) - -#define OV8858_PLL_SCLKSEL1 0x3032 -#define OV8858_PLL_SCLKSEL2 0x3033 -#define OV8858_SRB_HOST_INPUT_DIS 0x3106 - -#define OV8858_PLL_SCLKSEL1_MASK BIT(7) -#define OV8858_PLL_SCLKSEL2_MASK BIT(1) - -#define OV8858_SYS_PRE_DIV_OFFSET 2 -#define OV8858_SYS_PRE_DIV_MASK (BIT(2) | BIT(3)) -#define OV8858_SCLK_PDIV_OFFSET 4 -#define OV8858_SCLK_PDIV_MASK (BIT(4) | BIT(5) | BIT(6) | BIT(7)) - -#define OV8858_TIMING_HTS 0x380C -#define OV8858_TIMING_VTS 0x380E - -#define OV8858_HORIZONTAL_START_H 0x3800 -#define OV8858_VERTICAL_START_H 0x3802 -#define OV8858_HORIZONTAL_END_H 0x3804 -#define OV8858_VERTICAL_END_H 0x3806 -#define OV8858_HORIZONTAL_OUTPUT_SIZE_H 0x3808 -#define OV8858_VERTICAL_OUTPUT_SIZE_H 0x380A - -#define OV8858_GROUP_ACCESS 0x3208 -#define OV8858_GROUP_ZERO 0x00 -#define OV8858_GROUP_ACCESS_HOLD_START 0x00 -#define OV8858_GROUP_ACCESS_HOLD_END 0x10 -#define OV8858_GROUP_ACCESS_DELAY_LAUNCH 0xA0 -#define OV8858_GROUP_ACCESS_QUICK_LAUNCH 0xE0 - -#define OV_SUBDEV_PREFIX "ov" -#define OV_ID_DEFAULT 0x0000 -#define OV8858_CHIP_ID 0x8858 - -#define OV8858_LONG_EXPO 0x3500 -#define OV8858_LONG_GAIN 0x3508 -#define OV8858_LONG_DIGI_GAIN 0x350A -#define OV8858_SHORT_GAIN 0x350C -#define OV8858_SHORT_DIGI_GAIN 0x350E - -#define OV8858_FORMAT1 0x3820 -#define OV8858_FORMAT2 0x3821 - -#define OV8858_FLIP_ENABLE 0x06 - -#define OV8858_MWB_RED_GAIN_H 0x5032 -#define OV8858_MWB_GREEN_GAIN_H 0x5034 -#define OV8858_MWB_BLUE_GAIN_H 0x5036 -#define OV8858_MWB_GAIN_MAX 0x0FFF - -#define OV8858_CHIP_ID_HIGH 0x300B -#define OV8858_CHIP_ID_LOW 0x300C -#define OV8858_STREAM_MODE 0x0100 - -#define OV8858_FOCAL_LENGTH_NUM 294 /* 2.94mm */ -#define OV8858_FOCAL_LENGTH_DEM 100 -#define OV8858_F_NUMBER_DEFAULT_NUM 24 /* 2.4 */ -#define OV8858_F_NUMBER_DEM 10 - -#define OV8858_H_INC_ODD 0x3814 -#define OV8858_H_INC_EVEN 0x3815 -#define OV8858_V_INC_ODD 0x382A -#define OV8858_V_INC_EVEN 0x382B - -#define OV8858_READ_MODE_BINNING_ON 0x0400 /* ToDo: Check this */ -#define OV8858_READ_MODE_BINNING_OFF 0x00 /* ToDo: Check this */ -#define OV8858_BIN_FACTOR_MAX 2 -#define OV8858_INTEGRATION_TIME_MARGIN 14 - -#define OV8858_MAX_VTS_VALUE 0xFFFF -#define OV8858_MAX_EXPOSURE_VALUE \ - (OV8858_MAX_VTS_VALUE - OV8858_INTEGRATION_TIME_MARGIN) -#define OV8858_MAX_GAIN_VALUE 0x07FF - -#define OV8858_MAX_FOCUS_POS 1023 - -#define OV8858_TEST_PATTERN_REG 0x5E00 - -struct ov8858_vcm { - int (*power_up)(struct v4l2_subdev *sd); - int (*power_down)(struct v4l2_subdev *sd); - int (*init)(struct v4l2_subdev *sd); - int (*t_focus_abs)(struct v4l2_subdev *sd, s32 value); - int (*t_focus_rel)(struct v4l2_subdev *sd, s32 value); - int (*q_focus_status)(struct v4l2_subdev *sd, s32 *value); - int (*q_focus_abs)(struct v4l2_subdev *sd, s32 *value); - int (*t_vcm_slew)(struct v4l2_subdev *sd, s32 value); - int (*t_vcm_timing)(struct v4l2_subdev *sd, s32 value); -}; - -/* - * Defines for register writes and register array processing - * */ -#define OV8858_BYTE_MAX 32 -#define OV8858_SHORT_MAX 16 -#define OV8858_TOK_MASK 0xFFF0 - -#define MAX_FPS_OPTIONS_SUPPORTED 3 - -#define OV8858_DEPTH_COMP_CONST 2200 -#define OV8858_DEPTH_VTS_CONST 2573 - -enum ov8858_tok_type { - OV8858_8BIT = 0x0001, - OV8858_16BIT = 0x0002, - OV8858_TOK_TERM = 0xF000, /* terminating token for reg list */ - OV8858_TOK_DELAY = 0xFE00 /* delay token for reg list */ -}; - -/* - * If register address or register width is not 32 bit width, - * user needs to convert it manually - */ -struct s_register_setting { - u32 reg; - u32 val; -}; - -/** - * struct ov8858_reg - MI sensor register format - * @type: type of the register - * @reg: 16-bit offset to register - * @val: 8/16/32-bit register value - * - * Define a structure for sensor register initialization values - */ -struct ov8858_reg { - enum ov8858_tok_type type; - u16 sreg; - u32 val; /* @set value for read/mod/write, @mask */ -}; - -struct ov8858_fps_setting { - int fps; - unsigned short pixels_per_line; - unsigned short lines_per_frame; - const struct ov8858_reg *regs; /* regs that the fps setting needs */ -}; - -struct ov8858_resolution { - u8 *desc; - const struct ov8858_reg *regs; - int res; - int width; - int height; - bool used; - u8 bin_factor_x; - u8 bin_factor_y; - unsigned short skip_frames; - const struct ov8858_fps_setting fps_options[MAX_FPS_OPTIONS_SUPPORTED]; -}; - -/* - * ov8858 device structure - * */ -struct ov8858_device { - struct v4l2_subdev sd; - struct media_pad pad; - struct v4l2_mbus_framefmt format; - - struct camera_sensor_platform_data *platform_data; - struct mutex input_lock; /* serialize sensor's ioctl */ - int fmt_idx; - int streaming; - int vt_pix_clk_freq_mhz; - int fps_index; - u16 sensor_id; /* Sensor id from registers */ - u16 i2c_id; /* Sensor id from i2c_device_id */ - int exposure; - int gain; - u16 digital_gain; - u16 pixels_per_line; - u16 lines_per_frame; - u8 fps; - u8 *otp_data; - /* Prevent the framerate from being lowered in low light scenes. */ - int limit_exposure_flag; - bool hflip; - bool vflip; - - const struct ov8858_reg *regs; - struct ov8858_vcm *vcm_driver; - const struct ov8858_resolution *curr_res_table; - unsigned long entries_curr_table; - - struct v4l2_ctrl_handler ctrl_handler; - struct v4l2_ctrl *run_mode; -}; - -#define to_ov8858_sensor(x) container_of(x, struct ov8858_device, sd) - -#define OV8858_MAX_WRITE_BUF_SIZE 32 -struct ov8858_write_buffer { - u16 addr; - u8 data[OV8858_MAX_WRITE_BUF_SIZE]; -}; - -struct ov8858_write_ctrl { - int index; - struct ov8858_write_buffer buffer; -}; - -static const struct ov8858_reg ov8858_soft_standby[] = { - {OV8858_8BIT, 0x0100, 0x00}, - {OV8858_TOK_TERM, 0, 0} -}; - -static const struct ov8858_reg ov8858_streaming[] = { - {OV8858_8BIT, 0x0100, 0x01}, - {OV8858_TOK_TERM, 0, 0} -}; - -static const struct ov8858_reg ov8858_param_hold[] = { - {OV8858_8BIT, OV8858_GROUP_ACCESS, - OV8858_GROUP_ZERO | OV8858_GROUP_ACCESS_HOLD_START}, - {OV8858_TOK_TERM, 0, 0} -}; - -static const struct ov8858_reg ov8858_param_update[] = { - {OV8858_8BIT, OV8858_GROUP_ACCESS, - OV8858_GROUP_ZERO | OV8858_GROUP_ACCESS_HOLD_END}, - {OV8858_8BIT, OV8858_GROUP_ACCESS, - OV8858_GROUP_ZERO | OV8858_GROUP_ACCESS_DELAY_LAUNCH}, - {OV8858_TOK_TERM, 0, 0} -}; - -extern int dw9718_vcm_power_up(struct v4l2_subdev *sd); -extern int dw9718_vcm_power_down(struct v4l2_subdev *sd); -extern int dw9718_vcm_init(struct v4l2_subdev *sd); -extern int dw9718_t_focus_abs(struct v4l2_subdev *sd, s32 value); -extern int dw9718_t_focus_rel(struct v4l2_subdev *sd, s32 value); -extern int dw9718_q_focus_status(struct v4l2_subdev *sd, s32 *value); -extern int dw9718_q_focus_abs(struct v4l2_subdev *sd, s32 *value); -extern int dw9718_t_vcm_slew(struct v4l2_subdev *sd, s32 value); -extern int dw9718_t_vcm_timing(struct v4l2_subdev *sd, s32 value); - -extern int vcm_power_up(struct v4l2_subdev *sd); -extern int vcm_power_down(struct v4l2_subdev *sd); - -static struct ov8858_vcm ov8858_vcms[] = { - [OV8858_SUNNY] = { - .power_up = dw9718_vcm_power_up, - .power_down = dw9718_vcm_power_down, - .init = dw9718_vcm_init, - .t_focus_abs = dw9718_t_focus_abs, - .t_focus_rel = dw9718_t_focus_rel, - .q_focus_status = dw9718_q_focus_status, - .q_focus_abs = dw9718_q_focus_abs, - .t_vcm_slew = dw9718_t_vcm_slew, - .t_vcm_timing = dw9718_t_vcm_timing, - }, - [OV8858_ID_DEFAULT] = { - .power_up = NULL, - .power_down = NULL, - }, -}; - - -#define OV8858_RES_WIDTH_MAX 3280 -#define OV8858_RES_HEIGHT_MAX 2464 - -static struct ov8858_reg ov8858_BasicSettings[] = { - {OV8858_8BIT, 0x0103, 0x01}, /* software_reset */ - {OV8858_8BIT, 0x0100, 0x00}, /* software_standby */ - /* PLL settings */ - {OV8858_8BIT, 0x0300, 0x05}, /* pll1_pre_div = /4 */ - {OV8858_8BIT, 0x0302, 0xAF}, /* pll1_multiplier = 175 */ - {OV8858_8BIT, 0x0303, 0x00}, /* pll1_divm = /(1 + 0) */ - {OV8858_8BIT, 0x0304, 0x03}, /* pll1_div_mipi = /8 */ - {OV8858_8BIT, 0x030B, 0x02}, /* pll2_pre_div = /2 */ - {OV8858_8BIT, 0x030D, 0x4E}, /* pll2_r_divp = 78 */ - {OV8858_8BIT, 0x030E, 0x00}, /* pll2_r_divs = /1 */ - {OV8858_8BIT, 0x030F, 0x04}, /* pll2_r_divsp = /(1 + 4) */ - /* pll2_pre_div0 = /1, pll2_r_divdac = /(1 + 1) */ - {OV8858_8BIT, 0x0312, 0x01}, - {OV8858_8BIT, 0x031E, 0x0C}, /* pll1_no_lat = 1, mipi_bitsel_man = 0 */ - - /* PAD OEN2, VSYNC out enable=0x80, disable=0x00 */ - {OV8858_8BIT, 0x3002, 0x80}, - /* PAD OUT2, VSYNC pulse direction low-to-high = 1 */ - {OV8858_8BIT, 0x3007, 0x01}, - /* PAD SEL2, VSYNC out value = 0 */ - {OV8858_8BIT, 0x300D, 0x00}, - /* PAD OUT2, VSYNC out select = 0 */ - {OV8858_8BIT, 0x3010, 0x00}, - - /* Npump clock div = /2, Ppump clock div = /4 */ - {OV8858_8BIT, 0x3015, 0x01}, - /* - * mipi_lane_mode = 1+3, mipi_lvds_sel = 1 = MIPI enable, - * r_phy_pd_mipi_man = 0, lane_dis_option = 0 - */ - {OV8858_8BIT, 0x3018, 0x72}, - /* Clock switch output = normal, pclk_div = /1 */ - {OV8858_8BIT, 0x3020, 0x93}, - /* - * lvds_mode_o = 0, clock lane disable when pd_mipi = 0, - * pd_mipi enable when rst_sync = 1 - */ - {OV8858_8BIT, 0x3022, 0x01}, - {OV8858_8BIT, 0x3031, 0x0A}, /* mipi_bit_sel = 10 */ - {OV8858_8BIT, 0x3034, 0x00}, /* Unknown */ - /* sclk_div = /1, sclk_pre_div = /1, chip debug = 1 */ - {OV8858_8BIT, 0x3106, 0x01}, - - {OV8858_8BIT, 0x3305, 0xF1}, /* Unknown */ - {OV8858_8BIT, 0x3307, 0x04}, /* Unknown */ - {OV8858_8BIT, 0x3308, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x3309, 0x28}, /* Unknown */ - {OV8858_8BIT, 0x330A, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x330B, 0x20}, /* Unknown */ - {OV8858_8BIT, 0x330C, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x330D, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x330E, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x330F, 0x40}, /* Unknown */ - - {OV8858_8BIT, 0x3500, 0x00}, /* long exposure = 0x9A20 */ - {OV8858_8BIT, 0x3501, 0x9A}, /* long exposure = 0x9A20 */ - {OV8858_8BIT, 0x3502, 0x20}, /* long exposure = 0x9A20 */ - /* - * Digital fraction gain delay option = Delay 1 frame, - * Gain change delay option = Delay 1 frame, - * Gain delay option = Delay 1 frame, - * Gain manual as sensor gain = Input gain as real gain format, - * Exposure delay option (must be 0 = Delay 1 frame, - * Exposure change delay option (must be 0) = Delay 1 frame - */ - {OV8858_8BIT, 0x3503, 0x00}, - {OV8858_8BIT, 0x3505, 0x80}, /* gain conversation option */ - /* - * [10:7] are integer gain, [6:0] are fraction gain. For example: - * 0x80 is 1x gain, 0x100 is 2x gain, 0x1C0 is 3.5x gain - */ - {OV8858_8BIT, 0x3508, 0x02}, /* long gain = 0x0200 */ - {OV8858_8BIT, 0x3509, 0x00}, /* long gain = 0x0200 */ - {OV8858_8BIT, 0x350C, 0x00}, /* short gain = 0x0080 */ - {OV8858_8BIT, 0x350D, 0x80}, /* short gain = 0x0080 */ - {OV8858_8BIT, 0x3510, 0x00}, /* short exposure = 0x000200 */ - {OV8858_8BIT, 0x3511, 0x02}, /* short exposure = 0x000200 */ - {OV8858_8BIT, 0x3512, 0x00}, /* short exposure = 0x000200 */ - - {OV8858_8BIT, 0x3600, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x3601, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x3602, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x3603, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x3604, 0x22}, /* Unknown */ - {OV8858_8BIT, 0x3605, 0x30}, /* Unknown */ - {OV8858_8BIT, 0x3606, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x3607, 0x20}, /* Unknown */ - {OV8858_8BIT, 0x3608, 0x11}, /* Unknown */ - {OV8858_8BIT, 0x3609, 0x28}, /* Unknown */ - {OV8858_8BIT, 0x360A, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x360B, 0x06}, /* Unknown */ - {OV8858_8BIT, 0x360C, 0xDC}, /* Unknown */ - {OV8858_8BIT, 0x360D, 0x40}, /* Unknown */ - {OV8858_8BIT, 0x360E, 0x0C}, /* Unknown */ - {OV8858_8BIT, 0x360F, 0x20}, /* Unknown */ - {OV8858_8BIT, 0x3610, 0x07}, /* Unknown */ - {OV8858_8BIT, 0x3611, 0x20}, /* Unknown */ - {OV8858_8BIT, 0x3612, 0x88}, /* Unknown */ - {OV8858_8BIT, 0x3613, 0x80}, /* Unknown */ - {OV8858_8BIT, 0x3614, 0x58}, /* Unknown */ - {OV8858_8BIT, 0x3615, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x3616, 0x4A}, /* Unknown */ - {OV8858_8BIT, 0x3617, 0x90}, /* Unknown */ - {OV8858_8BIT, 0x3618, 0x56}, /* Unknown */ - {OV8858_8BIT, 0x3619, 0x70}, /* Unknown */ - {OV8858_8BIT, 0x361A, 0x99}, /* Unknown */ - {OV8858_8BIT, 0x361B, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x361C, 0x07}, /* Unknown */ - {OV8858_8BIT, 0x361D, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x361E, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x361F, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x3633, 0x0C}, /* Unknown */ - {OV8858_8BIT, 0x3634, 0x0C}, /* Unknown */ - {OV8858_8BIT, 0x3635, 0x0C}, /* Unknown */ - {OV8858_8BIT, 0x3636, 0x0C}, /* Unknown */ - {OV8858_8BIT, 0x3638, 0xFF}, /* Unknown */ - {OV8858_8BIT, 0x3645, 0x13}, /* Unknown */ - {OV8858_8BIT, 0x3646, 0x83}, /* Unknown */ - {OV8858_8BIT, 0x364A, 0x07}, /* Unknown */ - - {OV8858_8BIT, 0x3700, 0x30}, /* Unknown */ - {OV8858_8BIT, 0x3701, 0x18}, /* Unknown */ - {OV8858_8BIT, 0x3702, 0x50}, /* Unknown */ - {OV8858_8BIT, 0x3703, 0x32}, /* Unknown */ - {OV8858_8BIT, 0x3704, 0x28}, /* Unknown */ - {OV8858_8BIT, 0x3705, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x3706, 0x6A}, /* Unknown */ - {OV8858_8BIT, 0x3707, 0x08}, /* Unknown */ - {OV8858_8BIT, 0x3708, 0x48}, /* Unknown */ - {OV8858_8BIT, 0x3709, 0x66}, /* Unknown */ - {OV8858_8BIT, 0x370A, 0x01}, /* Unknown */ - {OV8858_8BIT, 0x370B, 0x6A}, /* Unknown */ - {OV8858_8BIT, 0x370C, 0x07}, /* Unknown */ - {OV8858_8BIT, 0x3712, 0x44}, /* Unknown */ - {OV8858_8BIT, 0x3714, 0x24}, /* Unknown */ - {OV8858_8BIT, 0x3718, 0x14}, /* Unknown */ - {OV8858_8BIT, 0x3719, 0x31}, /* Unknown */ - {OV8858_8BIT, 0x371E, 0x31}, /* Unknown */ - {OV8858_8BIT, 0x371F, 0x7F}, /* Unknown */ - {OV8858_8BIT, 0x3720, 0x0A}, /* Unknown */ - {OV8858_8BIT, 0x3721, 0x0A}, /* Unknown */ - {OV8858_8BIT, 0x3724, 0x0C}, /* Unknown */ - {OV8858_8BIT, 0x3725, 0x02}, /* Unknown */ - {OV8858_8BIT, 0x3726, 0x0C}, /* Unknown */ - {OV8858_8BIT, 0x3728, 0x0A}, /* Unknown */ - {OV8858_8BIT, 0x3729, 0x03}, /* Unknown */ - {OV8858_8BIT, 0x372A, 0x06}, /* Unknown */ - {OV8858_8BIT, 0x372B, 0xA6}, /* Unknown */ - {OV8858_8BIT, 0x372C, 0xA6}, /* Unknown */ - {OV8858_8BIT, 0x372D, 0xA6}, /* Unknown */ - {OV8858_8BIT, 0x372E, 0x0C}, /* Unknown */ - {OV8858_8BIT, 0x372F, 0x20}, /* Unknown */ - {OV8858_8BIT, 0x3730, 0x02}, /* Unknown */ - {OV8858_8BIT, 0x3731, 0x0C}, /* Unknown */ - {OV8858_8BIT, 0x3732, 0x28}, /* Unknown */ - {OV8858_8BIT, 0x3733, 0x10}, /* Unknown */ - {OV8858_8BIT, 0x3734, 0x40}, /* Unknown */ - {OV8858_8BIT, 0x3736, 0x30}, /* Unknown */ - {OV8858_8BIT, 0x373A, 0x0A}, /* Unknown */ - {OV8858_8BIT, 0x373B, 0x0B}, /* Unknown */ - {OV8858_8BIT, 0x373C, 0x14}, /* Unknown */ - {OV8858_8BIT, 0x373E, 0x06}, /* Unknown */ - {OV8858_8BIT, 0x3755, 0x10}, /* Unknown */ - {OV8858_8BIT, 0x3758, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x3759, 0x4C}, /* Unknown */ - {OV8858_8BIT, 0x375A, 0x0C}, /* Unknown */ - {OV8858_8BIT, 0x375B, 0x26}, /* Unknown */ - {OV8858_8BIT, 0x375C, 0x20}, /* Unknown */ - {OV8858_8BIT, 0x375D, 0x04}, /* Unknown */ - {OV8858_8BIT, 0x375E, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x375F, 0x28}, /* Unknown */ - {OV8858_8BIT, 0x3760, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x3761, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x3762, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x3763, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x3766, 0xFF}, /* Unknown */ - {OV8858_8BIT, 0x3768, 0x22}, /* Unknown */ - {OV8858_8BIT, 0x3769, 0x44}, /* Unknown */ - {OV8858_8BIT, 0x376A, 0x44}, /* Unknown */ - {OV8858_8BIT, 0x376B, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x376F, 0x01}, /* Unknown */ - {OV8858_8BIT, 0x3772, 0x46}, /* Unknown */ - {OV8858_8BIT, 0x3773, 0x04}, /* Unknown */ - {OV8858_8BIT, 0x3774, 0x2C}, /* Unknown */ - {OV8858_8BIT, 0x3775, 0x13}, /* Unknown */ - {OV8858_8BIT, 0x3776, 0x08}, /* Unknown */ - {OV8858_8BIT, 0x3777, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x3778, 0x16}, /* Unknown */ - {OV8858_8BIT, 0x37A0, 0x88}, /* Unknown */ - {OV8858_8BIT, 0x37A1, 0x7A}, /* Unknown */ - {OV8858_8BIT, 0x37A2, 0x7A}, /* Unknown */ - {OV8858_8BIT, 0x37A3, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x37A4, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x37A5, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x37A6, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x37A7, 0x88}, /* Unknown */ - {OV8858_8BIT, 0x37A8, 0x98}, /* Unknown */ - {OV8858_8BIT, 0x37A9, 0x98}, /* Unknown */ - {OV8858_8BIT, 0x37AA, 0x88}, /* Unknown */ - {OV8858_8BIT, 0x37AB, 0x5C}, /* Unknown */ - {OV8858_8BIT, 0x37AC, 0x5C}, /* Unknown */ - {OV8858_8BIT, 0x37AD, 0x55}, /* Unknown */ - {OV8858_8BIT, 0x37AE, 0x19}, /* Unknown */ - {OV8858_8BIT, 0x37AF, 0x19}, /* Unknown */ - {OV8858_8BIT, 0x37B0, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x37B1, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x37B2, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x37B3, 0x84}, /* Unknown */ - {OV8858_8BIT, 0x37B4, 0x84}, /* Unknown */ - {OV8858_8BIT, 0x37B5, 0x66}, /* Unknown */ - {OV8858_8BIT, 0x37B6, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x37B7, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x37B8, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x37B9, 0xFF}, /* Unknown */ - - {OV8858_8BIT, 0x3800, 0x00}, /* h_crop_start high */ - {OV8858_8BIT, 0x3801, 0x0C}, /* h_crop_start low */ - {OV8858_8BIT, 0x3802, 0x00}, /* v_crop_start high */ - {OV8858_8BIT, 0x3803, 0x0C}, /* v_crop_start low */ - {OV8858_8BIT, 0x3804, 0x0C}, /* h_crop_end high */ - {OV8858_8BIT, 0x3805, 0xD3}, /* h_crop_end low */ - {OV8858_8BIT, 0x3806, 0x09}, /* v_crop_end high */ - {OV8858_8BIT, 0x3807, 0xA3}, /* v_crop_end low */ - {OV8858_8BIT, 0x3808, 0x0C}, /* h_output_size high */ - {OV8858_8BIT, 0x3809, 0xC0}, /* h_output_size low */ - {OV8858_8BIT, 0x380A, 0x09}, /* v_output_size high */ - {OV8858_8BIT, 0x380B, 0x90}, /* v_output_size low */ - {OV8858_8BIT, 0x380C, 0x07}, /* horizontal timing size high */ - {OV8858_8BIT, 0x380D, 0x94}, /* horizontal timing size low */ - {OV8858_8BIT, 0x380E, 0x0A}, /* vertical timing size high */ - {OV8858_8BIT, 0x380F, 0x0D}, /* vertical timing size low */ - {OV8858_8BIT, 0x3810, 0x00}, /* h_win offset high */ - {OV8858_8BIT, 0x3811, 0x04}, /* h_win offset low */ - {OV8858_8BIT, 0x3812, 0x00}, /* v_win offset high */ - {OV8858_8BIT, 0x3813, 0x02}, /* v_win offset low */ - {OV8858_8BIT, 0x3814, 0x01}, /* h_odd_inc */ - {OV8858_8BIT, 0x3815, 0x01}, /* h_even_inc */ - {OV8858_8BIT, 0x3820, 0x00}, /* format1 */ - {OV8858_8BIT, 0x3821, 0x40}, /* format2 */ - {OV8858_8BIT, 0x382A, 0x01}, /* v_odd_inc */ - {OV8858_8BIT, 0x382B, 0x01}, /* v_even_inc */ - - {OV8858_8BIT, 0x3830, 0x06}, /* Unknown */ - {OV8858_8BIT, 0x3836, 0x01}, /* Unknown */ - {OV8858_8BIT, 0x3837, 0x18}, /* Unknown */ - {OV8858_8BIT, 0x3841, 0xFF}, /* AUTO_SIZE_CTRL */ - {OV8858_8BIT, 0x3846, 0x48}, /* Unknown */ - - {OV8858_8BIT, 0x3D85, 0x14}, /* OTP_REG85 */ - {OV8858_8BIT, 0x3D8C, 0x73}, /* OTP_SETTING_STT_ADDRESS */ - {OV8858_8BIT, 0x3D8D, 0xDE}, /* OTP_SETTING_STT_ADDRESS */ - {OV8858_8BIT, 0x3F08, 0x10}, /* PSRAM control register */ - {OV8858_8BIT, 0x3F0A, 0x80}, /* PSRAM control register */ - - {OV8858_8BIT, 0x4000, 0xF1}, /* BLC CTRL00 = default */ - {OV8858_8BIT, 0x4001, 0x00}, /* BLC CTRL01 */ - {OV8858_8BIT, 0x4002, 0x27}, /* BLC offset = 0x27 */ - {OV8858_8BIT, 0x4005, 0x10}, /* BLC target = 0x0010 */ - {OV8858_8BIT, 0x4009, 0x81}, /* BLC CTRL09 */ - {OV8858_8BIT, 0x400B, 0x0C}, /* BLC CTRL0B = default */ - {OV8858_8BIT, 0x401B, 0x00}, /* Zero line R coeff. = 0x0000 */ - {OV8858_8BIT, 0x401D, 0x00}, /* Zero line T coeff. = 0x0000 */ - {OV8858_8BIT, 0x401F, 0x00}, /* BLC CTRL1F */ - {OV8858_8BIT, 0x4020, 0x00}, /* Anchor left start = 0x0004 */ - {OV8858_8BIT, 0x4021, 0x04}, /* Anchor left start = 0x0004 */ - {OV8858_8BIT, 0x4022, 0x0B}, /* Anchor left end = 0x0BC3 */ - {OV8858_8BIT, 0x4023, 0xC3}, /* Anchor left end = 0x0BC3 */ - {OV8858_8BIT, 0x4024, 0x0C}, /* Anchor right start = 0x0C36 */ - {OV8858_8BIT, 0x4025, 0x36}, /* Anchor right start = 0x0C36 */ - {OV8858_8BIT, 0x4026, 0x0C}, /* Anchor right end = 0x0C37 */ - {OV8858_8BIT, 0x4027, 0x37}, /* Anchor right end = 0x0C37 */ - {OV8858_8BIT, 0x4028, 0x00}, /* Top zero line start = 0 */ - {OV8858_8BIT, 0x4029, 0x02}, /* Top zero line number = 2 */ - {OV8858_8BIT, 0x402A, 0x04}, /* Top black line start = 4 */ - {OV8858_8BIT, 0x402B, 0x08}, /* Top black line number = 8 */ - {OV8858_8BIT, 0x402C, 0x02}, /* Bottom zero start line = 2 */ - {OV8858_8BIT, 0x402D, 0x02}, /* Bottom zero line number = 2 */ - {OV8858_8BIT, 0x402E, 0x0C}, /* Bottom black line start = 12 */ - {OV8858_8BIT, 0x402F, 0x02}, /* Bottom black line number = 2 */ - - {OV8858_8BIT, 0x4034, 0x3F}, /* Unknown */ - {OV8858_8BIT, 0x403D, 0x04}, /* BLC CTRL3D */ - {OV8858_8BIT, 0x4300, 0xFF}, /* clip_max[11:4] = 0xFFF */ - {OV8858_8BIT, 0x4301, 0x00}, /* clip_min[11:4] = 0 */ - {OV8858_8BIT, 0x4302, 0x0F}, /* clip_min/max[3:0] */ - {OV8858_8BIT, 0x4307, 0x01}, /* Unknown */ - {OV8858_8BIT, 0x4316, 0x00}, /* CTRL16 = default */ - {OV8858_8BIT, 0x4503, 0x18}, /* Unknown */ - {OV8858_8BIT, 0x4500, 0x38}, /* Unknown */ - {OV8858_8BIT, 0x4600, 0x01}, /* Unknown */ - {OV8858_8BIT, 0x4601, 0x97}, /* Unknown */ - /* wkup_dly = Mark1 wakeup delay/2^10 = 0x25 */ - {OV8858_8BIT, 0x4808, 0x25}, - {OV8858_8BIT, 0x4816, 0x52}, /* Embedded data type*/ - {OV8858_8BIT, 0x481F, 0x32}, /* clk_prepare_min = 0x32 */ - {OV8858_8BIT, 0x4825, 0x3A}, /* lpx_p_min = 0x3A */ - {OV8858_8BIT, 0x4826, 0x40}, /* hs_prepare_min = 0x40 */ - {OV8858_8BIT, 0x4837, 0x14}, /* pclk_period = 0x14 */ - {OV8858_8BIT, 0x4850, 0x10}, /* LANE SEL01 */ - {OV8858_8BIT, 0x4851, 0x32}, /* LANE SEL02 */ - - {OV8858_8BIT, 0x4B00, 0x2A}, /* Unknown */ - {OV8858_8BIT, 0x4B0D, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x4D00, 0x04}, /* TPM_CTRL_REG */ - {OV8858_8BIT, 0x4D01, 0x18}, /* TPM_CTRL_REG */ - {OV8858_8BIT, 0x4D02, 0xC3}, /* TPM_CTRL_REG */ - {OV8858_8BIT, 0x4D03, 0xFF}, /* TPM_CTRL_REG */ - {OV8858_8BIT, 0x4D04, 0xFF}, /* TPM_CTRL_REG */ - {OV8858_8BIT, 0x4D05, 0xFF}, /* TPM_CTRL_REG */ - - /* - * Lens correction (LENC) function enable = 0 - * Slave sensor AWB Gain function enable = 1 - * Slave sensor AWB Statistics function enable = 1 - * Master sensor AWB Gain function enable = 1 - * Master sensor AWB Statistics function enable = 1 - * Black DPC function enable = 1 - * White DPC function enable =1 - */ - {OV8858_8BIT, 0x5000, 0x7E}, - {OV8858_8BIT, 0x5001, 0x01}, /* BLC function enable = 1 */ - /* - * Horizontal scale function enable = 0 - * WBMATCH bypass mode = Select slave sensor's gain - * WBMATCH function enable = 0 - * Master MWB gain support RGBC = 0 - * OTP_DPC function enable = 1 - * Manual mode of VarioPixel function enable = 0 - * Manual enable of VarioPixel function enable = 0 - * Use VSYNC to latch ISP modules's function enable signals = 0 - */ - {OV8858_8BIT, 0x5002, 0x08}, - /* - * Bypass all ISP modules after BLC module = 0 - * DPC_DBC buffer control enable = 1 - * WBMATCH VSYNC selection = Select master sensor's VSYNC fall - * Select master AWB gain to embed line = AWB gain before manual mode - * Enable BLC's input flip_i signal = 0 - */ - {OV8858_8BIT, 0x5003, 0x20}, - {OV8858_8BIT, 0x5041, 0x1D}, /* ISP CTRL41 - embedded data=on */ - {OV8858_8BIT, 0x5046, 0x12}, /* ISP CTRL46 = default */ - /* - * Tail enable = 1 - * Saturate cross cluster enable = 1 - * Remove cross cluster enable = 1 - * Enable to remove connected defect pixels in same channel = 1 - * Enable to remove connected defect pixels in different channel = 1 - * Smooth enable, use average G for recovery = 1 - * Black/white sensor mode enable = 0 - * Manual mode enable = 0 - */ - {OV8858_8BIT, 0x5780, 0xFC}, - {OV8858_8BIT, 0x5784, 0x0C}, /* DPC CTRL04 */ - {OV8858_8BIT, 0x5787, 0x40}, /* DPC CTRL07 */ - {OV8858_8BIT, 0x5788, 0x08}, /* DPC CTRL08 */ - {OV8858_8BIT, 0x578A, 0x02}, /* DPC CTRL0A */ - {OV8858_8BIT, 0x578B, 0x01}, /* DPC CTRL0B */ - {OV8858_8BIT, 0x578C, 0x01}, /* DPC CTRL0C */ - {OV8858_8BIT, 0x578E, 0x02}, /* DPC CTRL0E */ - {OV8858_8BIT, 0x578F, 0x01}, /* DPC CTRL0F */ - {OV8858_8BIT, 0x5790, 0x01}, /* DPC CTRL10 */ - {OV8858_8BIT, 0x5901, 0x00}, /* VAP CTRL01 = default */ - /* WINC CTRL08 = embedded data in 1st line*/ - {OV8858_8BIT, 0x5A08, 0x00}, - {OV8858_8BIT, 0x5B00, 0x02}, /* OTP CTRL00 */ - {OV8858_8BIT, 0x5B01, 0x10}, /* OTP CTRL01 */ - {OV8858_8BIT, 0x5B02, 0x03}, /* OTP CTRL02 */ - {OV8858_8BIT, 0x5B03, 0xCF}, /* OTP CTRL03 */ - {OV8858_8BIT, 0x5B05, 0x6C}, /* OTP CTRL05 = default */ - {OV8858_8BIT, 0x5E00, 0x00}, /* PRE CTRL00 = default */ - {OV8858_8BIT, 0x5E01, 0x41}, /* PRE_CTRL01 = default */ - - {OV8858_TOK_TERM, 0, 0} -}; - -/*****************************STILL********************************/ - -static const struct ov8858_reg ov8858_8M[] = { - {OV8858_8BIT, 0x0100, 0x00}, /* software_standby */ - {OV8858_8BIT, 0x3778, 0x16}, /* Unknown */ - {OV8858_8BIT, 0x3800, 0x00}, /* h_crop_start high */ - {OV8858_8BIT, 0x3801, 0x0C}, /* h_crop_start low 12 */ - {OV8858_8BIT, 0x3802, 0x00}, /* v_crop_start high */ - {OV8858_8BIT, 0x3803, 0x0C}, /* v_crop_start low */ - {OV8858_8BIT, 0x3804, 0x0C}, /* h_crop_end high */ - {OV8858_8BIT, 0x3805, 0xD3}, /* h_crop_end low 3283 */ - {OV8858_8BIT, 0x3806, 0x09}, /* v_crop_end high */ - {OV8858_8BIT, 0x3807, 0xA3}, /* v_crop_end low */ - {OV8858_8BIT, 0x3808, 0x0C}, /* h_output_size high 3280 x 2464 */ - {OV8858_8BIT, 0x3809, 0xD0}, /* h_output_size low */ - {OV8858_8BIT, 0x380A, 0x09}, /* v_output_size high */ - {OV8858_8BIT, 0x380B, 0xa0}, /* v_output_size low */ - {OV8858_8BIT, 0x380C, 0x07}, /* horizontal timing size high */ - {OV8858_8BIT, 0x380D, 0x94}, /* horizontal timing size low */ - {OV8858_8BIT, 0x380E, 0x0A}, /* vertical timing size high */ - {OV8858_8BIT, 0x380F, 0x0D}, /* vertical timing size low */ - {OV8858_8BIT, 0x3814, 0x01}, /* h_odd_inc */ - {OV8858_8BIT, 0x3815, 0x01}, /* h_even_inc */ - {OV8858_8BIT, 0x3820, 0x00}, /* format1 */ - {OV8858_8BIT, 0x3821, 0x40}, /* format2 */ - {OV8858_8BIT, 0x382A, 0x01}, /* v_odd_inc */ - {OV8858_8BIT, 0x382B, 0x01}, /* v_even_inc */ - {OV8858_8BIT, 0x3830, 0x06}, /* Unknown */ - {OV8858_8BIT, 0x3836, 0x01}, /* Unknown */ - {OV8858_8BIT, 0x3D85, 0x14}, /* OTP_REG85 */ - {OV8858_8BIT, 0x3F08, 0x10}, /* PSRAM control register */ - {OV8858_8BIT, 0x4000, 0xF1}, /* BLC CTRL00 = default */ - {OV8858_8BIT, 0x4001, 0x00}, /* BLC CTRL01 */ - {OV8858_8BIT, 0x4002, 0x27}, /* BLC offset = 0x27 */ - {OV8858_8BIT, 0x4005, 0x10}, /* BLC target = 0x0010 */ - {OV8858_8BIT, 0x4009, 0x81}, /* BLC CTRL09 */ - {OV8858_8BIT, 0x400B, 0x0C}, /* BLC CTRL0B = default */ - {OV8858_8BIT, 0x401B, 0x00}, /* Zero line R coeff. = 0x0000 */ - {OV8858_8BIT, 0x401D, 0x00}, /* Zero line T coeff. = 0x0000 */ - {OV8858_8BIT, 0x401F, 0x00}, /* BLC CTRL1F */ - {OV8858_8BIT, 0x4020, 0x00}, /* Anchor left start = 0x0004 */ - {OV8858_8BIT, 0x4021, 0x04}, /* Anchor left start = 0x0004 */ - {OV8858_8BIT, 0x4022, 0x0B}, /* Anchor left end = 0x0BC3 */ - {OV8858_8BIT, 0x4023, 0xC3}, /* Anchor left end = 0x0BC3 */ - {OV8858_8BIT, 0x4024, 0x0C}, /* Anchor right start = 0x0C36 */ - {OV8858_8BIT, 0x4025, 0x36}, /* Anchor right start = 0x0C36 */ - {OV8858_8BIT, 0x4026, 0x0C}, /* Anchor right end = 0x0C37 */ - {OV8858_8BIT, 0x4027, 0x37}, /* Anchor right end = 0x0C37 */ - {OV8858_8BIT, 0x4028, 0x00}, /* Top zero line start = 0 */ - {OV8858_8BIT, 0x4029, 0x02}, /* Top zero line number = 2 */ - {OV8858_8BIT, 0x402A, 0x04}, /* Top black line start = 4 */ - {OV8858_8BIT, 0x402B, 0x08}, /* Top black line number = 8 */ - {OV8858_8BIT, 0x402C, 0x02}, /* Bottom zero start line = 2 */ - {OV8858_8BIT, 0x402D, 0x02}, /* Bottom zero line number = 2 */ - {OV8858_8BIT, 0x402E, 0x0C}, /* Bottom black line start = 12 */ - {OV8858_8BIT, 0x402F, 0x02}, /* Bottom black line number = 2 */ - {OV8858_8BIT, 0x4034, 0x3F}, /* Unknown */ - {OV8858_8BIT, 0x403D, 0x04}, /* BLC CTRL3D */ - {OV8858_8BIT, 0x4600, 0x01}, /* Unknown */ - {OV8858_8BIT, 0x4601, 0x97}, /* Unknown */ - {OV8858_8BIT, 0x4837, 0x14}, /* pclk_period = 0x14 */ - {OV8858_TOK_TERM, 0, 0} -}; - -static const struct ov8858_reg ov8858_3276x1848[] = { - {OV8858_8BIT, 0x0100, 0x00}, /* software_standby */ - {OV8858_8BIT, 0x3778, 0x16}, /* Unknown */ - {OV8858_8BIT, 0x3800, 0x00}, /* h_crop_start high */ - {OV8858_8BIT, 0x3801, 0x10}, /* h_crop_start low 0c->10*/ - {OV8858_8BIT, 0x3802, 0x01}, /* v_crop_start high */ - {OV8858_8BIT, 0x3803, 0x42}, /* v_crop_start low 3e->42*/ - {OV8858_8BIT, 0x3804, 0x0C}, /* h_crop_end high */ - {OV8858_8BIT, 0x3805, 0xD3}, /* h_crop_end low */ - {OV8858_8BIT, 0x3806, 0x08}, /* v_crop_end high */ - {OV8858_8BIT, 0x3807, 0x71}, /* v_crop_end low */ - {OV8858_8BIT, 0x3808, 0x0C}, /* h_output_size high 3276 x 1848 */ - {OV8858_8BIT, 0x3809, 0xCC}, /* h_output_size low d0->cc*/ - {OV8858_8BIT, 0x380A, 0x07}, /* v_output_size high */ - {OV8858_8BIT, 0x380B, 0x38}, /* v_output_size low 3c->38*/ - {OV8858_8BIT, 0x380C, 0x07}, /* horizontal timing size high */ - {OV8858_8BIT, 0x380D, 0x94}, /* horizontal timing size low */ - {OV8858_8BIT, 0x380E, 0x0A}, /* vertical timing size high */ - {OV8858_8BIT, 0x380F, 0x0D}, /* vertical timing size low */ - {OV8858_8BIT, 0x3814, 0x01}, /* h_odd_inc */ - {OV8858_8BIT, 0x3815, 0x01}, /* h_even_inc */ - {OV8858_8BIT, 0x3820, 0x00}, /* format1 */ - {OV8858_8BIT, 0x3821, 0x40}, /* format2 */ - {OV8858_8BIT, 0x382A, 0x01}, /* v_odd_inc */ - {OV8858_8BIT, 0x382B, 0x01}, /* v_even_inc */ - {OV8858_8BIT, 0x3830, 0x06}, /* Unknown */ - {OV8858_8BIT, 0x3836, 0x01}, /* Unknown */ - {OV8858_8BIT, 0x3D85, 0x14}, /* OTP_REG85 */ - {OV8858_8BIT, 0x3F08, 0x10}, /* PSRAM control register */ - {OV8858_8BIT, 0x4000, 0xF1}, /* BLC CTRL00 = default */ - {OV8858_8BIT, 0x4001, 0x00}, /* BLC CTRL01 */ - {OV8858_8BIT, 0x4002, 0x27}, /* BLC offset = 0x27 */ - {OV8858_8BIT, 0x4005, 0x10}, /* BLC target = 0x0010 */ - {OV8858_8BIT, 0x4009, 0x81}, /* BLC CTRL09 */ - {OV8858_8BIT, 0x400B, 0x0C}, /* BLC CTRL0B = default */ - {OV8858_8BIT, 0x401B, 0x00}, /* Zero line R coeff. = 0x0000 */ - {OV8858_8BIT, 0x401D, 0x00}, /* Zero line T coeff. = 0x0000 */ - {OV8858_8BIT, 0x401F, 0x00}, /* BLC CTRL1F */ - {OV8858_8BIT, 0x4020, 0x00}, /* Anchor left start = 0x0004 */ - {OV8858_8BIT, 0x4021, 0x04}, /* Anchor left start = 0x0004 */ - {OV8858_8BIT, 0x4022, 0x0B}, /* Anchor left end = 0x0BC3 */ - {OV8858_8BIT, 0x4023, 0xC3}, /* Anchor left end = 0x0BC3 */ - {OV8858_8BIT, 0x4024, 0x0C}, /* Anchor right start = 0x0C36 */ - {OV8858_8BIT, 0x4025, 0x36}, /* Anchor right start = 0x0C36 */ - {OV8858_8BIT, 0x4026, 0x0C}, /* Anchor right end = 0x0C37 */ - {OV8858_8BIT, 0x4027, 0x37}, /* Anchor right end = 0x0C37 */ - {OV8858_8BIT, 0x4028, 0x00}, /* Top zero line start = 0 */ - {OV8858_8BIT, 0x4029, 0x02}, /* Top zero line number = 2 */ - {OV8858_8BIT, 0x402A, 0x04}, /* Top black line start = 4 */ - {OV8858_8BIT, 0x402B, 0x08}, /* Top black line number = 8 */ - {OV8858_8BIT, 0x402C, 0x02}, /* Bottom zero start line = 2 */ - {OV8858_8BIT, 0x402D, 0x02}, /* Bottom zero line number = 2 */ - {OV8858_8BIT, 0x402E, 0x0C}, /* Bottom black line start = 12 */ - {OV8858_8BIT, 0x402F, 0x02}, /* Bottom black line number = 2 */ - {OV8858_8BIT, 0x4034, 0x3F}, /* Unknown */ - {OV8858_8BIT, 0x403D, 0x04}, /* BLC CTRL3D */ - {OV8858_8BIT, 0x4600, 0x01}, /* Unknown */ - {OV8858_8BIT, 0x4601, 0x97}, /* Unknown */ - {OV8858_8BIT, 0x4837, 0x14}, /* pclk_period = 0x14 */ - {OV8858_TOK_TERM, 0, 0} -}; - -static const struct ov8858_reg ov8858_6M[] = { - {OV8858_8BIT, 0x0100, 0x00}, /* software_standby */ - {OV8858_8BIT, 0x3778, 0x16}, /* Unknown */ - {OV8858_8BIT, 0x3800, 0x00}, /* h_crop_start high */ - {OV8858_8BIT, 0x3801, 0x0C}, /* h_crop_start low */ - {OV8858_8BIT, 0x3802, 0x01}, /* v_crop_start high */ - {OV8858_8BIT, 0x3803, 0x3E}, /* v_crop_start low */ - {OV8858_8BIT, 0x3804, 0x0C}, /* h_crop_end high */ - {OV8858_8BIT, 0x3805, 0xD3}, /* h_crop_end low */ - {OV8858_8BIT, 0x3806, 0x08}, /* v_crop_end high */ - {OV8858_8BIT, 0x3807, 0x71}, /* v_crop_end low */ - {OV8858_8BIT, 0x3808, 0x0C}, /* h_output_size high 3280 x 1852 */ - {OV8858_8BIT, 0x3809, 0xD0}, /* h_output_size low */ - {OV8858_8BIT, 0x380A, 0x07}, /* v_output_size high */ - {OV8858_8BIT, 0x380B, 0x3C}, /* v_output_size low */ - {OV8858_8BIT, 0x380C, 0x07}, /* horizontal timing size high */ - {OV8858_8BIT, 0x380D, 0x94}, /* horizontal timing size low */ - {OV8858_8BIT, 0x380E, 0x0A}, /* vertical timing size high */ - {OV8858_8BIT, 0x380F, 0x0D}, /* vertical timing size low */ - {OV8858_8BIT, 0x3814, 0x01}, /* h_odd_inc */ - {OV8858_8BIT, 0x3815, 0x01}, /* h_even_inc */ - {OV8858_8BIT, 0x3820, 0x00}, /* format1 */ - {OV8858_8BIT, 0x3821, 0x40}, /* format2 */ - {OV8858_8BIT, 0x382A, 0x01}, /* v_odd_inc */ - {OV8858_8BIT, 0x382B, 0x01}, /* v_even_inc */ - {OV8858_8BIT, 0x3830, 0x06}, /* Unknown */ - {OV8858_8BIT, 0x3836, 0x01}, /* Unknown */ - {OV8858_8BIT, 0x3D85, 0x14}, /* OTP_REG85 */ - {OV8858_8BIT, 0x3F08, 0x10}, /* PSRAM control register */ - {OV8858_8BIT, 0x4000, 0xF1}, /* BLC CTRL00 = default */ - {OV8858_8BIT, 0x4001, 0x00}, /* BLC CTRL01 */ - {OV8858_8BIT, 0x4002, 0x27}, /* BLC offset = 0x27 */ - {OV8858_8BIT, 0x4005, 0x10}, /* BLC target = 0x0010 */ - {OV8858_8BIT, 0x4009, 0x81}, /* BLC CTRL09 */ - {OV8858_8BIT, 0x400B, 0x0C}, /* BLC CTRL0B = default */ - {OV8858_8BIT, 0x401B, 0x00}, /* Zero line R coeff. = 0x0000 */ - {OV8858_8BIT, 0x401D, 0x00}, /* Zero line T coeff. = 0x0000 */ - {OV8858_8BIT, 0x401F, 0x00}, /* BLC CTRL1F */ - {OV8858_8BIT, 0x4020, 0x00}, /* Anchor left start = 0x0004 */ - {OV8858_8BIT, 0x4021, 0x04}, /* Anchor left start = 0x0004 */ - {OV8858_8BIT, 0x4022, 0x0B}, /* Anchor left end = 0x0BC3 */ - {OV8858_8BIT, 0x4023, 0xC3}, /* Anchor left end = 0x0BC3 */ - {OV8858_8BIT, 0x4024, 0x0C}, /* Anchor right start = 0x0C36 */ - {OV8858_8BIT, 0x4025, 0x36}, /* Anchor right start = 0x0C36 */ - {OV8858_8BIT, 0x4026, 0x0C}, /* Anchor right end = 0x0C37 */ - {OV8858_8BIT, 0x4027, 0x37}, /* Anchor right end = 0x0C37 */ - {OV8858_8BIT, 0x4028, 0x00}, /* Top zero line start = 0 */ - {OV8858_8BIT, 0x4029, 0x02}, /* Top zero line number = 2 */ - {OV8858_8BIT, 0x402A, 0x04}, /* Top black line start = 4 */ - {OV8858_8BIT, 0x402B, 0x08}, /* Top black line number = 8 */ - {OV8858_8BIT, 0x402C, 0x02}, /* Bottom zero start line = 2 */ - {OV8858_8BIT, 0x402D, 0x02}, /* Bottom zero line number = 2 */ - {OV8858_8BIT, 0x402E, 0x0C}, /* Bottom black line start = 12 */ - {OV8858_8BIT, 0x402F, 0x02}, /* Bottom black line number = 2 */ - {OV8858_8BIT, 0x4034, 0x3F}, /* Unknown */ - {OV8858_8BIT, 0x403D, 0x04}, /* BLC CTRL3D */ - {OV8858_8BIT, 0x4600, 0x01}, /* Unknown */ - {OV8858_8BIT, 0x4601, 0x97}, /* Unknown */ - {OV8858_8BIT, 0x4837, 0x14}, /* pclk_period = 0x14 */ - {OV8858_TOK_TERM, 0, 0} -}; - -static const struct ov8858_reg ov8858_1080P_60[] = { - {OV8858_8BIT, 0x0100, 0x00}, /* software_standby */ - {OV8858_8BIT, 0x3778, 0x17}, /* Unknown */ - {OV8858_8BIT, 0x3800, 0x02}, /* h_crop_start high */ - {OV8858_8BIT, 0x3801, 0x26}, /* h_crop_start low */ - {OV8858_8BIT, 0x3802, 0x02}, /* v_crop_start high */ - {OV8858_8BIT, 0x3803, 0x8C}, /* v_crop_start low */ - {OV8858_8BIT, 0x3804, 0x0A}, /* h_crop_end high */ - {OV8858_8BIT, 0x3805, 0x9D}, /* h_crop_end low */ - {OV8858_8BIT, 0x3806, 0x07}, /* v_crop_end high */ - {OV8858_8BIT, 0x3807, 0x0A}, /* v_crop_end low */ - {OV8858_8BIT, 0x3808, 0x07}, /* h_output_size high*/ - {OV8858_8BIT, 0x3809, 0x90}, /* h_output_size low */ - {OV8858_8BIT, 0x380A, 0x04}, /* v_output_size high */ - {OV8858_8BIT, 0x380B, 0x48}, /* v_output_size low */ - {OV8858_8BIT, 0x380C, 0x07}, /* horizontal timing size high */ - {OV8858_8BIT, 0x380D, 0x94}, /* horizontal timing size low */ - {OV8858_8BIT, 0x380E, 0x04}, /* vertical timing size high */ - {OV8858_8BIT, 0x380F, 0xEC}, /* vertical timing size low */ - {OV8858_8BIT, 0x3814, 0x01}, /* h_odd_inc */ - {OV8858_8BIT, 0x3815, 0x01}, /* h_even_inc */ - {OV8858_8BIT, 0x3820, 0x00}, /* format1 */ - {OV8858_8BIT, 0x3821, 0x40}, /* format2 */ - {OV8858_8BIT, 0x382A, 0x01}, /* v_odd_inc */ - {OV8858_8BIT, 0x382B, 0x01}, /* v_even_inc */ - {OV8858_8BIT, 0x3830, 0x06}, /* Unknown */ - {OV8858_8BIT, 0x3836, 0x01}, /* Unknown */ - {OV8858_8BIT, 0x3D85, 0x14}, /* OTP_REG85 */ - {OV8858_8BIT, 0x3F08, 0x10}, /* PSRAM control register */ - {OV8858_8BIT, 0x4000, 0xF1}, /* BLC CTRL00 = default */ - {OV8858_8BIT, 0x4001, 0x00}, /* BLC CTRL01 */ - {OV8858_8BIT, 0x4002, 0x27}, /* BLC offset = 0x27 */ - {OV8858_8BIT, 0x4005, 0x10}, /* BLC target = 0x0010 */ - {OV8858_8BIT, 0x4009, 0x81}, /* BLC CTRL09 */ - {OV8858_8BIT, 0x400B, 0x0C}, /* BLC CTRL0B = default */ - {OV8858_8BIT, 0x401B, 0x00}, /* Zero line R coeff. = 0x0000 */ - {OV8858_8BIT, 0x401D, 0x00}, /* Zero line T coeff. = 0x0000 */ - {OV8858_8BIT, 0x401F, 0x00}, /* BLC CTRL1F */ - {OV8858_8BIT, 0x4020, 0x00}, /* Anchor left start = 0x0004 */ - {OV8858_8BIT, 0x4021, 0x04}, /* Anchor left start = 0x0004 */ - {OV8858_8BIT, 0x4022, 0x07}, /* Anchor left end = 0x072D */ - {OV8858_8BIT, 0x4023, 0x2D}, /* Anchor left end = 0x072D */ - {OV8858_8BIT, 0x4024, 0x07}, /* Anchor right start = 0x079E */ - {OV8858_8BIT, 0x4025, 0x9E}, /* Anchor right start = 0x079E */ - {OV8858_8BIT, 0x4026, 0x07}, /* Anchor right end = 0x079F */ - {OV8858_8BIT, 0x4027, 0x9F}, /* Anchor right end = 0x079F */ - {OV8858_8BIT, 0x4028, 0x00}, /* Top zero line start = 0 */ - {OV8858_8BIT, 0x4029, 0x02}, /* Top zero line number = 2 */ - {OV8858_8BIT, 0x402A, 0x04}, /* Top black line start = 4 */ - {OV8858_8BIT, 0x402B, 0x08}, /* Top black line number = 8 */ - {OV8858_8BIT, 0x402C, 0x02}, /* Bottom zero start line = 2 */ - {OV8858_8BIT, 0x402D, 0x02}, /* Bottom zero line number = 2 */ - {OV8858_8BIT, 0x402E, 0x0C}, /* Bottom black line start = 12 */ - {OV8858_8BIT, 0x402F, 0x02}, /* Bottom black line number = 2 */ - {OV8858_8BIT, 0x4034, 0x3F}, /* Unknown */ - {OV8858_8BIT, 0x403D, 0x04}, /* BLC CTRL3D */ - {OV8858_8BIT, 0x4600, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x4601, 0xef}, /* Unknown */ - {OV8858_8BIT, 0x4837, 0x16}, /* pclk_period = 0x16 */ - {OV8858_TOK_TERM, 0, 0} -}; - -static const struct ov8858_reg ov8858_1080P_30[] = { - {OV8858_8BIT, 0x0100, 0x00}, /* software_standby */ - {OV8858_8BIT, 0x3778, 0x17}, /* Unknown */ - {OV8858_8BIT, 0x3800, 0x02}, /* h_crop_start high */ - {OV8858_8BIT, 0x3801, 0x26}, /* h_crop_start low */ - {OV8858_8BIT, 0x3802, 0x02}, /* v_crop_start high */ - {OV8858_8BIT, 0x3803, 0x8C}, /* v_crop_start low */ - {OV8858_8BIT, 0x3804, 0x0A}, /* h_crop_end high */ - {OV8858_8BIT, 0x3805, 0x9D}, /* h_crop_end low */ - {OV8858_8BIT, 0x3806, 0x07}, /* v_crop_end high */ - {OV8858_8BIT, 0x3807, 0x0A}, /* v_crop_end low */ - {OV8858_8BIT, 0x3808, 0x07}, /* h_output_size high*/ - {OV8858_8BIT, 0x3809, 0x90}, /* h_output_size low */ - {OV8858_8BIT, 0x380A, 0x04}, /* v_output_size high */ - {OV8858_8BIT, 0x380B, 0x48}, /* v_output_size low */ - {OV8858_8BIT, 0x380C, 0x07}, /* horizontal timing size high */ - {OV8858_8BIT, 0x380D, 0x94}, /* horizontal timing size low */ - {OV8858_8BIT, 0x380E, 0x0A}, /* vertical timing size high */ - {OV8858_8BIT, 0x380F, 0x0D}, /* vertical timing size low */ - {OV8858_8BIT, 0x3814, 0x01}, /* h_odd_inc */ - {OV8858_8BIT, 0x3815, 0x01}, /* h_even_inc */ - {OV8858_8BIT, 0x3820, 0x00}, /* format1 */ - {OV8858_8BIT, 0x3821, 0x40}, /* format2 */ - {OV8858_8BIT, 0x382A, 0x01}, /* v_odd_inc */ - {OV8858_8BIT, 0x382B, 0x01}, /* v_even_inc */ - {OV8858_8BIT, 0x3830, 0x06}, /* Unknown */ - {OV8858_8BIT, 0x3836, 0x01}, /* Unknown */ - {OV8858_8BIT, 0x3D85, 0x14}, /* OTP_REG85 */ - {OV8858_8BIT, 0x3F08, 0x10}, /* PSRAM control register */ - {OV8858_8BIT, 0x4000, 0xF1}, /* BLC CTRL00 = default */ - {OV8858_8BIT, 0x4001, 0x00}, /* BLC CTRL01 */ - {OV8858_8BIT, 0x4002, 0x27}, /* BLC offset = 0x27 */ - {OV8858_8BIT, 0x4005, 0x10}, /* BLC target = 0x0010 */ - {OV8858_8BIT, 0x4009, 0x81}, /* BLC CTRL09 */ - {OV8858_8BIT, 0x400B, 0x0C}, /* BLC CTRL0B = default */ - {OV8858_8BIT, 0x401B, 0x00}, /* Zero line R coeff. = 0x0000 */ - {OV8858_8BIT, 0x401D, 0x00}, /* Zero line T coeff. = 0x0000 */ - {OV8858_8BIT, 0x401F, 0x00}, /* BLC CTRL1F */ - {OV8858_8BIT, 0x4020, 0x00}, /* Anchor left start = 0x0004 */ - {OV8858_8BIT, 0x4021, 0x04}, /* Anchor left start = 0x0004 */ - {OV8858_8BIT, 0x4022, 0x07}, /* Anchor left end = 0x072D */ - {OV8858_8BIT, 0x4023, 0x2D}, /* Anchor left end = 0x072D */ - {OV8858_8BIT, 0x4024, 0x07}, /* Anchor right start = 0x079E */ - {OV8858_8BIT, 0x4025, 0x9E}, /* Anchor right start = 0x079E */ - {OV8858_8BIT, 0x4026, 0x07}, /* Anchor right end = 0x079F */ - {OV8858_8BIT, 0x4027, 0x9F}, /* Anchor right end = 0x079F */ - {OV8858_8BIT, 0x4028, 0x00}, /* Top zero line start = 0 */ - {OV8858_8BIT, 0x4029, 0x02}, /* Top zero line number = 2 */ - {OV8858_8BIT, 0x402A, 0x04}, /* Top black line start = 4 */ - {OV8858_8BIT, 0x402B, 0x08}, /* Top black line number = 8 */ - {OV8858_8BIT, 0x402C, 0x02}, /* Bottom zero start line = 2 */ - {OV8858_8BIT, 0x402D, 0x02}, /* Bottom zero line number = 2 */ - {OV8858_8BIT, 0x402E, 0x0C}, /* Bottom black line start = 12 */ - {OV8858_8BIT, 0x402F, 0x02}, /* Bottom black line number = 2 */ - {OV8858_8BIT, 0x4034, 0x3F}, /* Unknown */ - {OV8858_8BIT, 0x403D, 0x04}, /* BLC CTRL3D */ - {OV8858_8BIT, 0x4600, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x4601, 0xef}, /* Unknown */ - {OV8858_8BIT, 0x4837, 0x16}, /* pclk_period = 0x16 */ - {OV8858_TOK_TERM, 0, 0} -}; - -static const struct ov8858_reg ov8858_1640x1232[] = { - {OV8858_8BIT, 0x0100, 0x00}, /* software_standby */ - {OV8858_8BIT, 0x3778, 0x16}, /* Unknown */ - {OV8858_8BIT, 0x3800, 0x00}, /* h_crop_start high */ - {OV8858_8BIT, 0x3801, 0x0C}, /* h_crop_start low 12 */ - {OV8858_8BIT, 0x3802, 0x00}, /* v_crop_start high */ - {OV8858_8BIT, 0x3803, 0x0C}, /* v_crop_start low */ - {OV8858_8BIT, 0x3804, 0x0C}, /* h_crop_end high 3283 */ - {OV8858_8BIT, 0x3805, 0xD3}, /* h_crop_end low */ - {OV8858_8BIT, 0x3806, 0x09}, /* v_crop_end high */ - {OV8858_8BIT, 0x3807, 0xA3}, /* v_crop_end low */ - {OV8858_8BIT, 0x3808, 0x06}, /* h_output_size high 1640 x 1232 */ - {OV8858_8BIT, 0x3809, 0x68}, /* h_output_size low */ - {OV8858_8BIT, 0x380A, 0x04}, /* v_output_size high */ - {OV8858_8BIT, 0x380B, 0xD0}, /* v_output_size low */ - {OV8858_8BIT, 0x380C, 0x07}, /* horizontal timing size high */ - {OV8858_8BIT, 0x380D, 0x94}, /* horizontal timing size low */ - {OV8858_8BIT, 0x380E, 0x09}, /* vertical timing size high */ - {OV8858_8BIT, 0x380F, 0xAA}, /* vertical timing size low */ - {OV8858_8BIT, 0x3814, 0x03}, /* h_odd_inc */ - {OV8858_8BIT, 0x3815, 0x01}, /* h_even_inc */ - {OV8858_8BIT, 0x3820, 0x00}, /* format1 */ - {OV8858_8BIT, 0x3821, 0x67}, /* format2 */ - {OV8858_8BIT, 0x382A, 0x03}, /* v_odd_inc */ - {OV8858_8BIT, 0x382B, 0x01}, /* v_even_inc */ - {OV8858_8BIT, 0x3830, 0x08}, /* Unknown */ - {OV8858_8BIT, 0x3836, 0x02}, /* Unknown */ - {OV8858_8BIT, 0x3D85, 0x16}, /* OTP_REG85 */ - {OV8858_8BIT, 0x3F08, 0x08}, /* PSRAM control register */ - {OV8858_8BIT, 0x4000, 0xF1}, /* BLC CTRL00 = default */ - {OV8858_8BIT, 0x4001, 0x10}, /* BLC CTRL01 */ - {OV8858_8BIT, 0x4002, 0x27}, /* BLC offset = 0x27 */ - {OV8858_8BIT, 0x4005, 0x10}, /* BLC target = 0x0010 */ - {OV8858_8BIT, 0x4009, 0x81}, /* BLC CTRL09 */ - {OV8858_8BIT, 0x400B, 0x0C}, /* BLC CTRL0B = default */ - {OV8858_8BIT, 0x401B, 0x00}, /* Zero line R coeff. = 0x0000 */ - {OV8858_8BIT, 0x401D, 0x00}, /* Zero line T coeff. = 0x0000 */ - {OV8858_8BIT, 0x401F, 0x00}, /* BLC CTRL1F */ - {OV8858_8BIT, 0x4020, 0x00}, /* Anchor left start = 0x0004 */ - {OV8858_8BIT, 0x4021, 0x04}, /* Anchor left start = 0x0004 */ - {OV8858_8BIT, 0x4022, 0x04}, /* Anchor left end = 0x04B9 */ - {OV8858_8BIT, 0x4023, 0xB9}, /* Anchor left end = 0x04B9 */ - {OV8858_8BIT, 0x4024, 0x05}, /* Anchor right start = 0x052A */ - {OV8858_8BIT, 0x4025, 0x2A}, /* Anchor right start = 0x052A */ - {OV8858_8BIT, 0x4026, 0x05}, /* Anchor right end = 0x052B */ - {OV8858_8BIT, 0x4027, 0x2B}, /* Anchor right end = 0x052B */ - {OV8858_8BIT, 0x4028, 0x00}, /* Top zero line start = 0 */ - {OV8858_8BIT, 0x4029, 0x02}, /* Top zero line number = 2 */ - {OV8858_8BIT, 0x402A, 0x04}, /* Top black line start = 4 */ - {OV8858_8BIT, 0x402B, 0x04}, /* Top black line number = 8 */ - {OV8858_8BIT, 0x402C, 0x02}, /* Bottom zero start line = 2 */ - {OV8858_8BIT, 0x402D, 0x02}, /* Bottom zero line number = 2 */ - {OV8858_8BIT, 0x402E, 0x08}, /* Bottom black line start = 8 */ - {OV8858_8BIT, 0x402F, 0x02}, /* Bottom black line number = 2 */ - {OV8858_8BIT, 0x4034, 0x3F}, /* Unknown */ - {OV8858_8BIT, 0x403D, 0x04}, /* BLC CTRL3D */ - {OV8858_8BIT, 0x4600, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x4601, 0xCB}, /* Unknown */ - {OV8858_8BIT, 0x4837, 0x14}, /* pclk_period = 0x14 */ - {OV8858_TOK_TERM, 0, 0} -}; - -static const struct ov8858_reg ov8858_1640x1096[] = { - {OV8858_8BIT, 0x0100, 0x00}, /* software_standby */ - {OV8858_8BIT, 0x3778, 0x16}, /* Unknown */ - {OV8858_8BIT, 0x3800, 0x00}, /* h_crop_start high */ - {OV8858_8BIT, 0x3801, 0x0C}, /* h_crop_start low 12 */ - {OV8858_8BIT, 0x3802, 0x00}, /* v_crop_start high */ - {OV8858_8BIT, 0x3803, 0x0C}, /* v_crop_start low */ - {OV8858_8BIT, 0x3804, 0x0C}, /* h_crop_end high 3283 */ - {OV8858_8BIT, 0x3805, 0xD3}, /* h_crop_end low */ - {OV8858_8BIT, 0x3806, 0x09}, /* v_crop_end high */ - {OV8858_8BIT, 0x3807, 0xA3}, /* v_crop_end low */ - {OV8858_8BIT, 0x3808, 0x06}, /* h_output_size high 1640 x 1096 */ - {OV8858_8BIT, 0x3809, 0x68}, /* h_output_size low */ - {OV8858_8BIT, 0x380A, 0x04}, /* v_output_size high */ - {OV8858_8BIT, 0x380B, 0x48}, /* v_output_size low */ - {OV8858_8BIT, 0x380C, 0x07}, /* horizontal timing size high */ - {OV8858_8BIT, 0x380D, 0x94}, /* horizontal timing size low */ - {OV8858_8BIT, 0x380E, 0x09}, /* vertical timing size high */ - {OV8858_8BIT, 0x380F, 0xAA}, /* vertical timing size low */ - {OV8858_8BIT, 0x3814, 0x03}, /* h_odd_inc */ - {OV8858_8BIT, 0x3815, 0x01}, /* h_even_inc */ - {OV8858_8BIT, 0x3820, 0x00}, /* format1 */ - {OV8858_8BIT, 0x3821, 0x67}, /* format2 */ - {OV8858_8BIT, 0x382A, 0x03}, /* v_odd_inc */ - {OV8858_8BIT, 0x382B, 0x01}, /* v_even_inc */ - {OV8858_8BIT, 0x3830, 0x08}, /* Unknown */ - {OV8858_8BIT, 0x3836, 0x02}, /* Unknown */ - {OV8858_8BIT, 0x3D85, 0x16}, /* OTP_REG85 */ - {OV8858_8BIT, 0x3F08, 0x08}, /* PSRAM control register */ - {OV8858_8BIT, 0x4000, 0xF1}, /* BLC CTRL00 = default */ - {OV8858_8BIT, 0x4001, 0x10}, /* BLC CTRL01 */ - {OV8858_8BIT, 0x4002, 0x27}, /* BLC offset = 0x27 */ - {OV8858_8BIT, 0x4005, 0x10}, /* BLC target = 0x0010 */ - {OV8858_8BIT, 0x4009, 0x81}, /* BLC CTRL09 */ - {OV8858_8BIT, 0x400B, 0x0C}, /* BLC CTRL0B = default */ - {OV8858_8BIT, 0x401B, 0x00}, /* Zero line R coeff. = 0x0000 */ - {OV8858_8BIT, 0x401D, 0x00}, /* Zero line T coeff. = 0x0000 */ - {OV8858_8BIT, 0x401F, 0x00}, /* BLC CTRL1F */ - {OV8858_8BIT, 0x4020, 0x00}, /* Anchor left start = 0x0004 */ - {OV8858_8BIT, 0x4021, 0x04}, /* Anchor left start = 0x0004 */ - {OV8858_8BIT, 0x4022, 0x04}, /* Anchor left end = 0x04B9 */ - {OV8858_8BIT, 0x4023, 0xB9}, /* Anchor left end = 0x04B9 */ - {OV8858_8BIT, 0x4024, 0x05}, /* Anchor right start = 0x052A */ - {OV8858_8BIT, 0x4025, 0x2A}, /* Anchor right start = 0x052A */ - {OV8858_8BIT, 0x4026, 0x05}, /* Anchor right end = 0x052B */ - {OV8858_8BIT, 0x4027, 0x2B}, /* Anchor right end = 0x052B */ - {OV8858_8BIT, 0x4028, 0x00}, /* Top zero line start = 0 */ - {OV8858_8BIT, 0x4029, 0x02}, /* Top zero line number = 2 */ - {OV8858_8BIT, 0x402A, 0x04}, /* Top black line start = 4 */ - {OV8858_8BIT, 0x402B, 0x04}, /* Top black line number = 8 */ - {OV8858_8BIT, 0x402C, 0x02}, /* Bottom zero start line = 2 */ - {OV8858_8BIT, 0x402D, 0x02}, /* Bottom zero line number = 2 */ - {OV8858_8BIT, 0x402E, 0x08}, /* Bottom black line start = 8 */ - {OV8858_8BIT, 0x402F, 0x02}, /* Bottom black line number = 2 */ - {OV8858_8BIT, 0x4034, 0x3F}, /* Unknown */ - {OV8858_8BIT, 0x403D, 0x04}, /* BLC CTRL3D */ - {OV8858_8BIT, 0x4600, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x4601, 0xCB}, /* Unknown */ - {OV8858_8BIT, 0x4837, 0x14}, /* pclk_period = 0x14 */ - {OV8858_TOK_TERM, 0, 0} -}; - - -static const struct ov8858_reg ov8858_1640x926[] = { - {OV8858_8BIT, 0x0100, 0x00}, /* software_standby */ - {OV8858_8BIT, 0x3778, 0x16}, /* Unknown */ - {OV8858_8BIT, 0x3800, 0x00}, /* h_crop_start high */ - {OV8858_8BIT, 0x3801, 0x0C}, /* h_crop_start low */ - {OV8858_8BIT, 0x3802, 0x00}, /* v_crop_start high */ - {OV8858_8BIT, 0x3803, 0x0C}, /* v_crop_start low */ - {OV8858_8BIT, 0x3804, 0x0C}, /* h_crop_end high */ - {OV8858_8BIT, 0x3805, 0xD3}, /* h_crop_end low */ - {OV8858_8BIT, 0x3806, 0x09}, /* v_crop_end high */ - {OV8858_8BIT, 0x3807, 0xA3}, /* v_crop_end low */ - {OV8858_8BIT, 0x3808, 0x06}, /* h_output_size high 1640 x 926 */ - {OV8858_8BIT, 0x3809, 0x68}, /* h_output_size low */ - {OV8858_8BIT, 0x380A, 0x03}, /* v_output_size high */ - {OV8858_8BIT, 0x380B, 0x9E}, /* v_output_size low */ - {OV8858_8BIT, 0x380C, 0x07}, /* horizontal timing size high */ - {OV8858_8BIT, 0x380D, 0x94}, /* horizontal timing size low */ - {OV8858_8BIT, 0x380E, 0x09}, /* vertical timing size high */ - {OV8858_8BIT, 0x380F, 0xAA}, /* vertical timing size low */ - {OV8858_8BIT, 0x3814, 0x03}, /* h_odd_inc */ - {OV8858_8BIT, 0x3815, 0x01}, /* h_even_inc */ - {OV8858_8BIT, 0x3820, 0x00}, /* format1 */ - {OV8858_8BIT, 0x3821, 0x67}, /* format2 */ - {OV8858_8BIT, 0x382A, 0x03}, /* v_odd_inc */ - {OV8858_8BIT, 0x382B, 0x01}, /* v_even_inc */ - {OV8858_8BIT, 0x3830, 0x08}, /* Unknown */ - {OV8858_8BIT, 0x3836, 0x02}, /* Unknown */ - {OV8858_8BIT, 0x3D85, 0x16}, /* OTP_REG85 */ - {OV8858_8BIT, 0x3F08, 0x08}, /* PSRAM control register */ - {OV8858_8BIT, 0x4000, 0xF1}, /* BLC CTRL00 = default */ - {OV8858_8BIT, 0x4001, 0x10}, /* BLC CTRL01 */ - {OV8858_8BIT, 0x4002, 0x27}, /* BLC offset = 0x27 */ - {OV8858_8BIT, 0x4005, 0x10}, /* BLC target = 0x0010 */ - {OV8858_8BIT, 0x4009, 0x81}, /* BLC CTRL09 */ - {OV8858_8BIT, 0x400B, 0x0C}, /* BLC CTRL0B = default */ - {OV8858_8BIT, 0x401B, 0x00}, /* Zero line R coeff. = 0x0000 */ - {OV8858_8BIT, 0x401D, 0x00}, /* Zero line T coeff. = 0x0000 */ - {OV8858_8BIT, 0x401F, 0x00}, /* BLC CTRL1F */ - {OV8858_8BIT, 0x4020, 0x00}, /* Anchor left start = 0x0004 */ - {OV8858_8BIT, 0x4021, 0x04}, /* Anchor left start = 0x0004 */ - {OV8858_8BIT, 0x4022, 0x04}, /* Anchor left end = 0x04B9 */ - {OV8858_8BIT, 0x4023, 0xB9}, /* Anchor left end = 0x04B9 */ - {OV8858_8BIT, 0x4024, 0x05}, /* Anchor right start = 0x052A */ - {OV8858_8BIT, 0x4025, 0x2A}, /* Anchor right start = 0x052A */ - {OV8858_8BIT, 0x4026, 0x05}, /* Anchor right end = 0x052B */ - {OV8858_8BIT, 0x4027, 0x2B}, /* Anchor right end = 0x052B */ - {OV8858_8BIT, 0x4028, 0x00}, /* Top zero line start = 0 */ - {OV8858_8BIT, 0x4029, 0x02}, /* Top zero line number = 2 */ - {OV8858_8BIT, 0x402A, 0x04}, /* Top black line start = 4 */ - {OV8858_8BIT, 0x402B, 0x04}, /* Top black line number = 8 */ - {OV8858_8BIT, 0x402C, 0x02}, /* Bottom zero start line = 2 */ - {OV8858_8BIT, 0x402D, 0x02}, /* Bottom zero line number = 2 */ - {OV8858_8BIT, 0x402E, 0x08}, /* Bottom black line start = 8 */ - {OV8858_8BIT, 0x402F, 0x02}, /* Bottom black line number = 2 */ - {OV8858_8BIT, 0x4034, 0x3F}, /* Unknown */ - {OV8858_8BIT, 0x403D, 0x04}, /* BLC CTRL3D */ - {OV8858_8BIT, 0x4600, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x4601, 0xCB}, /* Unknown */ - {OV8858_8BIT, 0x4837, 0x14}, /* pclk_period = 0x14 */ - {OV8858_TOK_TERM, 0, 0} -}; - -static struct ov8858_resolution ov8858_res_preview[] = { - { - .desc = "ov8858_1640x926_PREVIEW", - .width = 1640, - .height = 926, - .used = 0, - .regs = ov8858_1640x926, - .bin_factor_x = 0, - .bin_factor_y = 0, - .skip_frames = 0, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 3880, - .lines_per_frame = 2573, - }, - { - } - }, - }, - { - .desc = "ov8858_1640x1232_PREVIEW", - .width = 1640, - .height = 1232, - .used = 0, - .regs = ov8858_1640x1232, - .bin_factor_x = 0, - .bin_factor_y = 0, - .skip_frames = 0, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 3880, - .lines_per_frame = 2573, - }, - { - } - }, - }, - { - .desc = "ov8858_3276x1848_PREVIEW", - .width = 3276, - .height = 1848, - .used = 0, - .regs = ov8858_3276x1848, - .bin_factor_x = 0, - .bin_factor_y = 0, - .skip_frames = 0, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 3880, - .lines_per_frame = 2573, - }, - { - } - }, - }, - { - .desc = "ov8858_8M_PREVIEW", - .width = 3280, - .height = 2464, - .used = 0, - .regs = ov8858_8M, - .bin_factor_x = 0, - .bin_factor_y = 0, - .skip_frames = 0, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 3880, - .lines_per_frame = 2573, - }, - { - } - }, - }, -}; - -static struct ov8858_resolution ov8858_res_still[] = { - { - .desc = "ov8858_1640x1232_STILL", - .width = 1640, - .height = 1232, - .used = 0, - .regs = ov8858_1640x1232, - .bin_factor_x = 0, - .bin_factor_y = 0, - .skip_frames = 0, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 3880, - .lines_per_frame = 2573, - }, - { - } - }, - }, - { - .desc = "ov8858_1640x926_STILL", - .width = 1640, - .height = 926, - .used = 0, - .regs = ov8858_1640x926, - .bin_factor_x = 0, - .bin_factor_y = 0, - .skip_frames = 1, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 3880, - .lines_per_frame = 2573, - }, - { - } - }, - }, - { - .desc = "ov8858_3276X1848_STILL", - .width = 3276, - .height = 1848, - .used = 0, - .regs = ov8858_3276x1848, - .bin_factor_x = 0, - .bin_factor_y = 0, - .skip_frames = 1, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 3880, - .lines_per_frame = 2573, - }, - { - } - }, - }, - { - .desc = "ov8858_8M_STILL", - .width = 3280, - .height = 2464, - .used = 0, - .regs = ov8858_8M, - .bin_factor_x = 0, - .bin_factor_y = 0, - .skip_frames = 1, - .fps_options = { - { - /* Pixel clock: 149.76MHZ */ - .fps = 10, - .pixels_per_line = 3880, - .lines_per_frame = 3859, - }, - { - } - }, - }, -}; - -static struct ov8858_resolution ov8858_res_video[] = { - { - .desc = "ov8858_1640x926_VIDEO", - .width = 1640, - .height = 926, - .used = 0, - .regs = ov8858_1640x926, - .bin_factor_x = 0, - .bin_factor_y = 0, - .skip_frames = 1, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 3880, - .lines_per_frame = 2573, - }, - { - } - }, - }, - { - .desc = "ov8858_1640x1232_VIDEO", - .width = 1640, - .height = 1232, - .used = 0, - .regs = ov8858_1640x1232, - .bin_factor_x = 0, - .bin_factor_y = 0, - .skip_frames = 1, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 3880, - .lines_per_frame = 2573, - }, - { - } - }, - }, - { - .desc = "ov8858_1640x1096_VIDEO", - .width = 1640, - .height = 1096, - .used = 0, - .regs = ov8858_1640x1096, - .bin_factor_x = 0, - .bin_factor_y = 0, - .skip_frames = 1, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 3880, - .lines_per_frame = 2573, - }, - { - } - }, - }, - { - .desc = "ov8858_6M_VIDEO", - .width = 3280, - .height = 1852, - .used = 0, - .regs = ov8858_6M, - .bin_factor_x = 0, - .bin_factor_y = 0, - .skip_frames = 1, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 3880, - .lines_per_frame = 2573, - }, - { - } - }, - }, - { - .desc = "ov8858_8M_VIDEO", - .width = 3280, - .height = 2464, - .used = 0, - .regs = ov8858_8M, - .bin_factor_x = 0, - .bin_factor_y = 0, - .skip_frames = 1, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 3880, - .lines_per_frame = 2573, - }, - { - } - }, - }, -}; - -#endif /* __OV8858_H__ */ diff --git a/drivers/staging/media/atomisp/i2c/ov8858_btns.h b/drivers/staging/media/atomisp/i2c/ov8858_btns.h deleted file mode 100644 index f81851306832..000000000000 --- a/drivers/staging/media/atomisp/i2c/ov8858_btns.h +++ /dev/null @@ -1,1276 +0,0 @@ -/* - * Support for the Omnivision OV8858 camera sensor. - * - * Copyright (c) 2014 Intel Corporation. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * 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 __OV8858_H__ -#define __OV8858_H__ -#include "../include/linux/atomisp_platform.h" -#include <media/v4l2-ctrls.h> - -#define I2C_MSG_LENGTH 0x2 - -/* - * This should be added into include/linux/videodev2.h - * NOTE: This is most likely not used anywhere. - */ -#define V4L2_IDENT_OV8858 V4L2_IDENT_UNKNOWN - -/* - * Indexes for VCM driver lists - */ -#define OV8858_ID_DEFAULT 0 -#define OV8858_SUNNY 1 - -#define OV8858_OTP_START_ADDR 0x7010 -#define OV8858_OTP_END_ADDR 0x7186 - -/* - * ov8858 System control registers - */ - -#define OV8858_OTP_LOAD_CTRL 0x3D81 -#define OV8858_OTP_MODE_CTRL 0x3D84 -#define OV8858_OTP_START_ADDR_REG 0x3D88 -#define OV8858_OTP_END_ADDR_REG 0x3D8A -#define OV8858_OTP_ISP_CTRL2 0x5002 - -#define OV8858_OTP_MODE_MANUAL BIT(6) -#define OV8858_OTP_MODE_PROGRAM_DISABLE BIT(7) -#define OV8858_OTP_LOAD_ENABLE BIT(0) -#define OV8858_OTP_DPC_ENABLE BIT(3) - -#define OV8858_PLL1_PREDIV0 0x030A -#define OV8858_PLL1_PREDIV 0x0300 -#define OV8858_PLL1_MULTIPLIER 0x0301 -#define OV8858_PLL1_SYS_PRE_DIV 0x0305 -#define OV8858_PLL1_SYS_DIVIDER 0x0306 - -#define OV8858_PLL1_PREDIV0_MASK BIT(0) -#define OV8858_PLL1_PREDIV_MASK (BIT(0) | BIT(1) | BIT(2)) -#define OV8858_PLL1_MULTIPLIER_MASK 0x01FF -#define OV8858_PLL1_SYS_PRE_DIV_MASK (BIT(0) | BIT(1)) -#define OV8858_PLL1_SYS_DIVIDER_MASK BIT(0) - -#define OV8858_PLL2_PREDIV0 0x0312 -#define OV8858_PLL2_PREDIV 0x030B -#define OV8858_PLL2_MULTIPLIER 0x030C -#define OV8858_PLL2_DAC_DIVIDER 0x0312 -#define OV8858_PLL2_SYS_PRE_DIV 0x030F -#define OV8858_PLL2_SYS_DIVIDER 0x030E - -#define OV8858_PLL2_PREDIV0_MASK BIT(4) -#define OV8858_PLL2_PREDIV_MASK (BIT(0) | BIT(1) | BIT(2)) -#define OV8858_PLL2_MULTIPLIER_MASK 0x01FF -#define OV8858_PLL2_DAC_DIVIDER_MASK (BIT(0) | BIT(1) | BIT(2) | BIT(3)) -#define OV8858_PLL2_SYS_PRE_DIV_MASK (BIT(0) | BIT(1) | BIT(2) | BIT(3)) -#define OV8858_PLL2_SYS_DIVIDER_MASK (BIT(0) | BIT(1) | BIT(2)) - -#define OV8858_PLL_SCLKSEL1 0x3032 -#define OV8858_PLL_SCLKSEL2 0x3033 -#define OV8858_SRB_HOST_INPUT_DIS 0x3106 - -#define OV8858_PLL_SCLKSEL1_MASK BIT(7) -#define OV8858_PLL_SCLKSEL2_MASK BIT(1) - -#define OV8858_SYS_PRE_DIV_OFFSET 2 -#define OV8858_SYS_PRE_DIV_MASK (BIT(2) | BIT(3)) -#define OV8858_SCLK_PDIV_OFFSET 4 -#define OV8858_SCLK_PDIV_MASK (BIT(4) | BIT(5) | BIT(6) | BIT(7)) - -#define OV8858_TIMING_HTS 0x380C -#define OV8858_TIMING_VTS 0x380E - -#define OV8858_HORIZONTAL_START_H 0x3800 -#define OV8858_VERTICAL_START_H 0x3802 -#define OV8858_HORIZONTAL_END_H 0x3804 -#define OV8858_VERTICAL_END_H 0x3806 -#define OV8858_HORIZONTAL_OUTPUT_SIZE_H 0x3808 -#define OV8858_VERTICAL_OUTPUT_SIZE_H 0x380A - -#define OV8858_GROUP_ACCESS 0x3208 -#define OV8858_GROUP_ZERO 0x00 -#define OV8858_GROUP_ACCESS_HOLD_START 0x00 -#define OV8858_GROUP_ACCESS_HOLD_END 0x10 -#define OV8858_GROUP_ACCESS_DELAY_LAUNCH 0xA0 -#define OV8858_GROUP_ACCESS_QUICK_LAUNCH 0xE0 - -#define OV_SUBDEV_PREFIX "ov" -#define OV_ID_DEFAULT 0x0000 -#define OV8858_CHIP_ID 0x8858 - -#define OV8858_LONG_EXPO 0x3500 -#define OV8858_LONG_GAIN 0x3508 -#define OV8858_LONG_DIGI_GAIN 0x350A -#define OV8858_SHORT_GAIN 0x350C -#define OV8858_SHORT_DIGI_GAIN 0x350E - -#define OV8858_FORMAT1 0x3820 -#define OV8858_FORMAT2 0x3821 - -#define OV8858_FLIP_ENABLE 0x06 - -#define OV8858_MWB_RED_GAIN_H 0x5032 -#define OV8858_MWB_GREEN_GAIN_H 0x5034 -#define OV8858_MWB_BLUE_GAIN_H 0x5036 -#define OV8858_MWB_GAIN_MAX 0x0FFF - -#define OV8858_CHIP_ID_HIGH 0x300B -#define OV8858_CHIP_ID_LOW 0x300C -#define OV8858_STREAM_MODE 0x0100 - -#define OV8858_FOCAL_LENGTH_NUM 294 /* 2.94mm */ -#define OV8858_FOCAL_LENGTH_DEM 100 -#define OV8858_F_NUMBER_DEFAULT_NUM 24 /* 2.4 */ -#define OV8858_F_NUMBER_DEM 10 - -#define OV8858_H_INC_ODD 0x3814 -#define OV8858_H_INC_EVEN 0x3815 -#define OV8858_V_INC_ODD 0x382A -#define OV8858_V_INC_EVEN 0x382B - -#define OV8858_READ_MODE_BINNING_ON 0x0400 /* ToDo: Check this */ -#define OV8858_READ_MODE_BINNING_OFF 0x00 /* ToDo: Check this */ -#define OV8858_BIN_FACTOR_MAX 2 -#define OV8858_INTEGRATION_TIME_MARGIN 14 - -#define OV8858_MAX_VTS_VALUE 0xFFFF -#define OV8858_MAX_EXPOSURE_VALUE \ - (OV8858_MAX_VTS_VALUE - OV8858_INTEGRATION_TIME_MARGIN) -#define OV8858_MAX_GAIN_VALUE 0x07FF - -#define OV8858_MAX_FOCUS_POS 1023 - -#define OV8858_TEST_PATTERN_REG 0x5E00 - -struct ov8858_vcm { - int (*power_up)(struct v4l2_subdev *sd); - int (*power_down)(struct v4l2_subdev *sd); - int (*init)(struct v4l2_subdev *sd); - int (*t_focus_abs)(struct v4l2_subdev *sd, s32 value); - int (*t_focus_rel)(struct v4l2_subdev *sd, s32 value); - int (*q_focus_status)(struct v4l2_subdev *sd, s32 *value); - int (*q_focus_abs)(struct v4l2_subdev *sd, s32 *value); - int (*t_vcm_slew)(struct v4l2_subdev *sd, s32 value); - int (*t_vcm_timing)(struct v4l2_subdev *sd, s32 value); -}; - -/* - * Defines for register writes and register array processing - * */ -#define OV8858_BYTE_MAX 32 -#define OV8858_SHORT_MAX 16 -#define OV8858_TOK_MASK 0xFFF0 - -#define MAX_FPS_OPTIONS_SUPPORTED 3 - -#define OV8858_DEPTH_COMP_CONST 2200 -#define OV8858_DEPTH_VTS_CONST 2573 - -enum ov8858_tok_type { - OV8858_8BIT = 0x0001, - OV8858_16BIT = 0x0002, - OV8858_TOK_TERM = 0xF000, /* terminating token for reg list */ - OV8858_TOK_DELAY = 0xFE00 /* delay token for reg list */ -}; - -/* - * If register address or register width is not 32 bit width, - * user needs to convert it manually - */ -struct s_register_setting { - u32 reg; - u32 val; -}; - -/** - * struct ov8858_reg - MI sensor register format - * @type: type of the register - * @reg: 16-bit offset to register - * @val: 8/16/32-bit register value - * - * Define a structure for sensor register initialization values - */ -struct ov8858_reg { - enum ov8858_tok_type type; - u16 sreg; - u32 val; /* @set value for read/mod/write, @mask */ -}; - -struct ov8858_fps_setting { - int fps; - unsigned short pixels_per_line; - unsigned short lines_per_frame; - const struct ov8858_reg *regs; /* regs that the fps setting needs */ -}; - -struct ov8858_resolution { - u8 *desc; - const struct ov8858_reg *regs; - int res; - int width; - int height; - bool used; - u8 bin_factor_x; - u8 bin_factor_y; - unsigned short skip_frames; - const struct ov8858_fps_setting fps_options[MAX_FPS_OPTIONS_SUPPORTED]; -}; - -/* - * ov8858 device structure - * */ -struct ov8858_device { - struct v4l2_subdev sd; - struct media_pad pad; - struct v4l2_mbus_framefmt format; - - struct camera_sensor_platform_data *platform_data; - struct mutex input_lock; /* serialize sensor's ioctl */ - int fmt_idx; - int streaming; - int vt_pix_clk_freq_mhz; - int fps_index; - u16 sensor_id; /* Sensor id from registers */ - u16 i2c_id; /* Sensor id from i2c_device_id */ - int exposure; - int gain; - u16 digital_gain; - u16 pixels_per_line; - u16 lines_per_frame; - u8 fps; - u8 *otp_data; - /* Prevent the framerate from being lowered in low light scenes. */ - int limit_exposure_flag; - bool hflip; - bool vflip; - - const struct ov8858_reg *regs; - struct ov8858_vcm *vcm_driver; - const struct ov8858_resolution *curr_res_table; - unsigned long entries_curr_table; - - struct v4l2_ctrl_handler ctrl_handler; - struct v4l2_ctrl *run_mode; -}; - -#define to_ov8858_sensor(x) container_of(x, struct ov8858_device, sd) - -#define OV8858_MAX_WRITE_BUF_SIZE 32 -struct ov8858_write_buffer { - u16 addr; - u8 data[OV8858_MAX_WRITE_BUF_SIZE]; -}; - -struct ov8858_write_ctrl { - int index; - struct ov8858_write_buffer buffer; -}; - -static const struct ov8858_reg ov8858_soft_standby[] = { - {OV8858_8BIT, 0x0100, 0x00}, - {OV8858_TOK_TERM, 0, 0} -}; - -static const struct ov8858_reg ov8858_streaming[] = { - {OV8858_8BIT, 0x0100, 0x01}, - {OV8858_TOK_TERM, 0, 0} -}; - -static const struct ov8858_reg ov8858_param_hold[] = { - {OV8858_8BIT, OV8858_GROUP_ACCESS, - OV8858_GROUP_ZERO | OV8858_GROUP_ACCESS_HOLD_START}, - {OV8858_TOK_TERM, 0, 0} -}; - -static const struct ov8858_reg ov8858_param_update[] = { - {OV8858_8BIT, OV8858_GROUP_ACCESS, - OV8858_GROUP_ZERO | OV8858_GROUP_ACCESS_HOLD_END}, - {OV8858_8BIT, OV8858_GROUP_ACCESS, - OV8858_GROUP_ZERO | OV8858_GROUP_ACCESS_DELAY_LAUNCH}, - {OV8858_TOK_TERM, 0, 0} -}; - -extern int dw9718_vcm_power_up(struct v4l2_subdev *sd); -extern int dw9718_vcm_power_down(struct v4l2_subdev *sd); -extern int dw9718_vcm_init(struct v4l2_subdev *sd); -extern int dw9718_t_focus_abs(struct v4l2_subdev *sd, s32 value); -extern int dw9718_t_focus_rel(struct v4l2_subdev *sd, s32 value); -extern int dw9718_q_focus_status(struct v4l2_subdev *sd, s32 *value); -extern int dw9718_q_focus_abs(struct v4l2_subdev *sd, s32 *value); -extern int dw9718_t_vcm_slew(struct v4l2_subdev *sd, s32 value); -extern int dw9718_t_vcm_timing(struct v4l2_subdev *sd, s32 value); - -extern int vcm_power_up(struct v4l2_subdev *sd); -extern int vcm_power_down(struct v4l2_subdev *sd); - -static struct ov8858_vcm ov8858_vcms[] = { - [OV8858_SUNNY] = { - .power_up = dw9718_vcm_power_up, - .power_down = dw9718_vcm_power_down, - .init = dw9718_vcm_init, - .t_focus_abs = dw9718_t_focus_abs, - .t_focus_rel = dw9718_t_focus_rel, - .q_focus_status = dw9718_q_focus_status, - .q_focus_abs = dw9718_q_focus_abs, - .t_vcm_slew = dw9718_t_vcm_slew, - .t_vcm_timing = dw9718_t_vcm_timing, - }, - [OV8858_ID_DEFAULT] = { - .power_up = NULL, - .power_down = NULL, - }, -}; - - -#define OV8858_RES_WIDTH_MAX 3280 -#define OV8858_RES_HEIGHT_MAX 2464 - -static struct ov8858_reg ov8858_BasicSettings[] = { - {OV8858_8BIT, 0x0103, 0x01}, /* software_reset */ - {OV8858_8BIT, 0x0100, 0x00}, /* software_standby */ - /* PLL settings */ - {OV8858_8BIT, 0x0300, 0x05}, /* pll1_pre_div = /4 */ - {OV8858_8BIT, 0x0302, 0xAF}, /* pll1_multiplier = 175 */ - {OV8858_8BIT, 0x0303, 0x00}, /* pll1_divm = /(1 + 0) */ - {OV8858_8BIT, 0x0304, 0x03}, /* pll1_div_mipi = /8 */ - {OV8858_8BIT, 0x030B, 0x02}, /* pll2_pre_div = /2 */ - {OV8858_8BIT, 0x030D, 0x4E}, /* pll2_r_divp = 78 */ - {OV8858_8BIT, 0x030E, 0x00}, /* pll2_r_divs = /1 */ - {OV8858_8BIT, 0x030F, 0x04}, /* pll2_r_divsp = /(1 + 4) */ - /* pll2_pre_div0 = /1, pll2_r_divdac = /(1 + 1) */ - {OV8858_8BIT, 0x0312, 0x01}, - {OV8858_8BIT, 0x031E, 0x0C}, /* pll1_no_lat = 1, mipi_bitsel_man = 0 */ - - /* PAD OEN2, VSYNC out enable=0x80, disable=0x00 */ - {OV8858_8BIT, 0x3002, 0x80}, - /* PAD OUT2, VSYNC pulse direction low-to-high = 1 */ - {OV8858_8BIT, 0x3007, 0x01}, - /* PAD SEL2, VSYNC out value = 0 */ - {OV8858_8BIT, 0x300D, 0x00}, - /* PAD OUT2, VSYNC out select = 0 */ - {OV8858_8BIT, 0x3010, 0x00}, - - /* Npump clock div = /2, Ppump clock div = /4 */ - {OV8858_8BIT, 0x3015, 0x01}, - /* - * mipi_lane_mode = 1+3, mipi_lvds_sel = 1 = MIPI enable, - * r_phy_pd_mipi_man = 0, lane_dis_option = 0 - */ - {OV8858_8BIT, 0x3018, 0x72}, - /* Clock switch output = normal, pclk_div = /1 */ - {OV8858_8BIT, 0x3020, 0x93}, - /* - * lvds_mode_o = 0, clock lane disable when pd_mipi = 0, - * pd_mipi enable when rst_sync = 1 - */ - {OV8858_8BIT, 0x3022, 0x01}, - {OV8858_8BIT, 0x3031, 0x0A}, /* mipi_bit_sel = 10 */ - {OV8858_8BIT, 0x3034, 0x00}, /* Unknown */ - /* sclk_div = /1, sclk_pre_div = /1, chip debug = 1 */ - {OV8858_8BIT, 0x3106, 0x01}, - - {OV8858_8BIT, 0x3305, 0xF1}, /* Unknown */ - {OV8858_8BIT, 0x3307, 0x04}, /* Unknown */ - {OV8858_8BIT, 0x3308, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x3309, 0x28}, /* Unknown */ - {OV8858_8BIT, 0x330A, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x330B, 0x20}, /* Unknown */ - {OV8858_8BIT, 0x330C, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x330D, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x330E, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x330F, 0x40}, /* Unknown */ - - {OV8858_8BIT, 0x3500, 0x00}, /* long exposure = 0x9A20 */ - {OV8858_8BIT, 0x3501, 0x9A}, /* long exposure = 0x9A20 */ - {OV8858_8BIT, 0x3502, 0x20}, /* long exposure = 0x9A20 */ - /* - * Digital fraction gain delay option = Delay 1 frame, - * Gain change delay option = Delay 1 frame, - * Gain delay option = Delay 1 frame, - * Gain manual as sensor gain = Input gain as real gain format, - * Exposure delay option (must be 0 = Delay 1 frame, - * Exposure change delay option (must be 0) = Delay 1 frame - */ - {OV8858_8BIT, 0x3503, 0x00}, - {OV8858_8BIT, 0x3505, 0x80}, /* gain conversation option */ - /* - * [10:7] are integer gain, [6:0] are fraction gain. For example: - * 0x80 is 1x gain, 0x100 is 2x gain, 0x1C0 is 3.5x gain - */ - {OV8858_8BIT, 0x3508, 0x02}, /* long gain = 0x0200 */ - {OV8858_8BIT, 0x3509, 0x00}, /* long gain = 0x0200 */ - {OV8858_8BIT, 0x350C, 0x00}, /* short gain = 0x0080 */ - {OV8858_8BIT, 0x350D, 0x80}, /* short gain = 0x0080 */ - {OV8858_8BIT, 0x3510, 0x00}, /* short exposure = 0x000200 */ - {OV8858_8BIT, 0x3511, 0x02}, /* short exposure = 0x000200 */ - {OV8858_8BIT, 0x3512, 0x00}, /* short exposure = 0x000200 */ - - {OV8858_8BIT, 0x3600, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x3601, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x3602, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x3603, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x3604, 0x22}, /* Unknown */ - {OV8858_8BIT, 0x3605, 0x30}, /* Unknown */ - {OV8858_8BIT, 0x3606, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x3607, 0x20}, /* Unknown */ - {OV8858_8BIT, 0x3608, 0x11}, /* Unknown */ - {OV8858_8BIT, 0x3609, 0x28}, /* Unknown */ - {OV8858_8BIT, 0x360A, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x360B, 0x06}, /* Unknown */ - {OV8858_8BIT, 0x360C, 0xDC}, /* Unknown */ - {OV8858_8BIT, 0x360D, 0x40}, /* Unknown */ - {OV8858_8BIT, 0x360E, 0x0C}, /* Unknown */ - {OV8858_8BIT, 0x360F, 0x20}, /* Unknown */ - {OV8858_8BIT, 0x3610, 0x07}, /* Unknown */ - {OV8858_8BIT, 0x3611, 0x20}, /* Unknown */ - {OV8858_8BIT, 0x3612, 0x88}, /* Unknown */ - {OV8858_8BIT, 0x3613, 0x80}, /* Unknown */ - {OV8858_8BIT, 0x3614, 0x58}, /* Unknown */ - {OV8858_8BIT, 0x3615, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x3616, 0x4A}, /* Unknown */ - {OV8858_8BIT, 0x3617, 0x90}, /* Unknown */ - {OV8858_8BIT, 0x3618, 0x56}, /* Unknown */ - {OV8858_8BIT, 0x3619, 0x70}, /* Unknown */ - {OV8858_8BIT, 0x361A, 0x99}, /* Unknown */ - {OV8858_8BIT, 0x361B, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x361C, 0x07}, /* Unknown */ - {OV8858_8BIT, 0x361D, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x361E, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x361F, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x3633, 0x0C}, /* Unknown */ - {OV8858_8BIT, 0x3634, 0x0C}, /* Unknown */ - {OV8858_8BIT, 0x3635, 0x0C}, /* Unknown */ - {OV8858_8BIT, 0x3636, 0x0C}, /* Unknown */ - {OV8858_8BIT, 0x3638, 0xFF}, /* Unknown */ - {OV8858_8BIT, 0x3645, 0x13}, /* Unknown */ - {OV8858_8BIT, 0x3646, 0x83}, /* Unknown */ - {OV8858_8BIT, 0x364A, 0x07}, /* Unknown */ - - {OV8858_8BIT, 0x3700, 0x30}, /* Unknown */ - {OV8858_8BIT, 0x3701, 0x18}, /* Unknown */ - {OV8858_8BIT, 0x3702, 0x50}, /* Unknown */ - {OV8858_8BIT, 0x3703, 0x32}, /* Unknown */ - {OV8858_8BIT, 0x3704, 0x28}, /* Unknown */ - {OV8858_8BIT, 0x3705, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x3706, 0x6A}, /* Unknown */ - {OV8858_8BIT, 0x3707, 0x08}, /* Unknown */ - {OV8858_8BIT, 0x3708, 0x48}, /* Unknown */ - {OV8858_8BIT, 0x3709, 0x66}, /* Unknown */ - {OV8858_8BIT, 0x370A, 0x01}, /* Unknown */ - {OV8858_8BIT, 0x370B, 0x6A}, /* Unknown */ - {OV8858_8BIT, 0x370C, 0x07}, /* Unknown */ - {OV8858_8BIT, 0x3712, 0x44}, /* Unknown */ - {OV8858_8BIT, 0x3714, 0x24}, /* Unknown */ - {OV8858_8BIT, 0x3718, 0x14}, /* Unknown */ - {OV8858_8BIT, 0x3719, 0x31}, /* Unknown */ - {OV8858_8BIT, 0x371E, 0x31}, /* Unknown */ - {OV8858_8BIT, 0x371F, 0x7F}, /* Unknown */ - {OV8858_8BIT, 0x3720, 0x0A}, /* Unknown */ - {OV8858_8BIT, 0x3721, 0x0A}, /* Unknown */ - {OV8858_8BIT, 0x3724, 0x0C}, /* Unknown */ - {OV8858_8BIT, 0x3725, 0x02}, /* Unknown */ - {OV8858_8BIT, 0x3726, 0x0C}, /* Unknown */ - {OV8858_8BIT, 0x3728, 0x0A}, /* Unknown */ - {OV8858_8BIT, 0x3729, 0x03}, /* Unknown */ - {OV8858_8BIT, 0x372A, 0x06}, /* Unknown */ - {OV8858_8BIT, 0x372B, 0xA6}, /* Unknown */ - {OV8858_8BIT, 0x372C, 0xA6}, /* Unknown */ - {OV8858_8BIT, 0x372D, 0xA6}, /* Unknown */ - {OV8858_8BIT, 0x372E, 0x0C}, /* Unknown */ - {OV8858_8BIT, 0x372F, 0x20}, /* Unknown */ - {OV8858_8BIT, 0x3730, 0x02}, /* Unknown */ - {OV8858_8BIT, 0x3731, 0x0C}, /* Unknown */ - {OV8858_8BIT, 0x3732, 0x28}, /* Unknown */ - {OV8858_8BIT, 0x3733, 0x10}, /* Unknown */ - {OV8858_8BIT, 0x3734, 0x40}, /* Unknown */ - {OV8858_8BIT, 0x3736, 0x30}, /* Unknown */ - {OV8858_8BIT, 0x373A, 0x0A}, /* Unknown */ - {OV8858_8BIT, 0x373B, 0x0B}, /* Unknown */ - {OV8858_8BIT, 0x373C, 0x14}, /* Unknown */ - {OV8858_8BIT, 0x373E, 0x06}, /* Unknown */ - {OV8858_8BIT, 0x3755, 0x10}, /* Unknown */ - {OV8858_8BIT, 0x3758, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x3759, 0x4C}, /* Unknown */ - {OV8858_8BIT, 0x375A, 0x0C}, /* Unknown */ - {OV8858_8BIT, 0x375B, 0x26}, /* Unknown */ - {OV8858_8BIT, 0x375C, 0x20}, /* Unknown */ - {OV8858_8BIT, 0x375D, 0x04}, /* Unknown */ - {OV8858_8BIT, 0x375E, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x375F, 0x28}, /* Unknown */ - {OV8858_8BIT, 0x3760, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x3761, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x3762, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x3763, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x3766, 0xFF}, /* Unknown */ - {OV8858_8BIT, 0x3768, 0x22}, /* Unknown */ - {OV8858_8BIT, 0x3769, 0x44}, /* Unknown */ - {OV8858_8BIT, 0x376A, 0x44}, /* Unknown */ - {OV8858_8BIT, 0x376B, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x376F, 0x01}, /* Unknown */ - {OV8858_8BIT, 0x3772, 0x46}, /* Unknown */ - {OV8858_8BIT, 0x3773, 0x04}, /* Unknown */ - {OV8858_8BIT, 0x3774, 0x2C}, /* Unknown */ - {OV8858_8BIT, 0x3775, 0x13}, /* Unknown */ - {OV8858_8BIT, 0x3776, 0x08}, /* Unknown */ - {OV8858_8BIT, 0x3777, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x3778, 0x16}, /* Unknown */ - {OV8858_8BIT, 0x37A0, 0x88}, /* Unknown */ - {OV8858_8BIT, 0x37A1, 0x7A}, /* Unknown */ - {OV8858_8BIT, 0x37A2, 0x7A}, /* Unknown */ - {OV8858_8BIT, 0x37A3, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x37A4, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x37A5, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x37A6, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x37A7, 0x88}, /* Unknown */ - {OV8858_8BIT, 0x37A8, 0x98}, /* Unknown */ - {OV8858_8BIT, 0x37A9, 0x98}, /* Unknown */ - {OV8858_8BIT, 0x37AA, 0x88}, /* Unknown */ - {OV8858_8BIT, 0x37AB, 0x5C}, /* Unknown */ - {OV8858_8BIT, 0x37AC, 0x5C}, /* Unknown */ - {OV8858_8BIT, 0x37AD, 0x55}, /* Unknown */ - {OV8858_8BIT, 0x37AE, 0x19}, /* Unknown */ - {OV8858_8BIT, 0x37AF, 0x19}, /* Unknown */ - {OV8858_8BIT, 0x37B0, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x37B1, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x37B2, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x37B3, 0x84}, /* Unknown */ - {OV8858_8BIT, 0x37B4, 0x84}, /* Unknown */ - {OV8858_8BIT, 0x37B5, 0x66}, /* Unknown */ - {OV8858_8BIT, 0x37B6, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x37B7, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x37B8, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x37B9, 0xFF}, /* Unknown */ - - {OV8858_8BIT, 0x3800, 0x00}, /* h_crop_start high */ - {OV8858_8BIT, 0x3801, 0x0C}, /* h_crop_start low */ - {OV8858_8BIT, 0x3802, 0x00}, /* v_crop_start high */ - {OV8858_8BIT, 0x3803, 0x0C}, /* v_crop_start low */ - {OV8858_8BIT, 0x3804, 0x0C}, /* h_crop_end high */ - {OV8858_8BIT, 0x3805, 0xD3}, /* h_crop_end low */ - {OV8858_8BIT, 0x3806, 0x09}, /* v_crop_end high */ - {OV8858_8BIT, 0x3807, 0xA3}, /* v_crop_end low */ - {OV8858_8BIT, 0x3808, 0x0C}, /* h_output_size high */ - {OV8858_8BIT, 0x3809, 0xC0}, /* h_output_size low */ - {OV8858_8BIT, 0x380A, 0x09}, /* v_output_size high */ - {OV8858_8BIT, 0x380B, 0x90}, /* v_output_size low */ - {OV8858_8BIT, 0x380C, 0x07}, /* horizontal timing size high */ - {OV8858_8BIT, 0x380D, 0x94}, /* horizontal timing size low */ - {OV8858_8BIT, 0x380E, 0x0A}, /* vertical timing size high */ - {OV8858_8BIT, 0x380F, 0x0D}, /* vertical timing size low */ - {OV8858_8BIT, 0x3810, 0x00}, /* h_win offset high */ - {OV8858_8BIT, 0x3811, 0x04}, /* h_win offset low */ - {OV8858_8BIT, 0x3812, 0x00}, /* v_win offset high */ - {OV8858_8BIT, 0x3813, 0x02}, /* v_win offset low */ - {OV8858_8BIT, 0x3814, 0x01}, /* h_odd_inc */ - {OV8858_8BIT, 0x3815, 0x01}, /* h_even_inc */ - {OV8858_8BIT, 0x3820, 0x00}, /* format1 */ - {OV8858_8BIT, 0x3821, 0x40}, /* format2 */ - {OV8858_8BIT, 0x382A, 0x01}, /* v_odd_inc */ - {OV8858_8BIT, 0x382B, 0x01}, /* v_even_inc */ - - {OV8858_8BIT, 0x3830, 0x06}, /* Unknown */ - {OV8858_8BIT, 0x3836, 0x01}, /* Unknown */ - {OV8858_8BIT, 0x3837, 0x18}, /* Unknown */ - {OV8858_8BIT, 0x3841, 0xFF}, /* AUTO_SIZE_CTRL */ - {OV8858_8BIT, 0x3846, 0x48}, /* Unknown */ - - {OV8858_8BIT, 0x3D85, 0x14}, /* OTP_REG85 */ - {OV8858_8BIT, 0x3D8C, 0x73}, /* OTP_SETTING_STT_ADDRESS */ - {OV8858_8BIT, 0x3D8D, 0xDE}, /* OTP_SETTING_STT_ADDRESS */ - {OV8858_8BIT, 0x3F08, 0x10}, /* PSRAM control register */ - {OV8858_8BIT, 0x3F0A, 0x80}, /* PSRAM control register */ - - {OV8858_8BIT, 0x4000, 0xF1}, /* BLC CTRL00 = default */ - {OV8858_8BIT, 0x4001, 0x00}, /* BLC CTRL01 */ - {OV8858_8BIT, 0x4002, 0x27}, /* BLC offset = 0x27 */ - {OV8858_8BIT, 0x4005, 0x10}, /* BLC target = 0x0010 */ - {OV8858_8BIT, 0x4009, 0x81}, /* BLC CTRL09 */ - {OV8858_8BIT, 0x400B, 0x0C}, /* BLC CTRL0B = default */ - {OV8858_8BIT, 0x400A, 0x01}, - {OV8858_8BIT, 0x4011, 0x20}, /* BLC CTRL11 = 0x20 */ - {OV8858_8BIT, 0x401B, 0x00}, /* Zero line R coeff. = 0x0000 */ - {OV8858_8BIT, 0x401D, 0x00}, /* Zero line T coeff. = 0x0000 */ - {OV8858_8BIT, 0x401F, 0x00}, /* BLC CTRL1F */ - {OV8858_8BIT, 0x4020, 0x00}, /* Anchor left start = 0x0004 */ - {OV8858_8BIT, 0x4021, 0x04}, /* Anchor left start = 0x0004 */ - {OV8858_8BIT, 0x4022, 0x0C}, /* Anchor left end = 0x0C60 */ - {OV8858_8BIT, 0x4023, 0x60}, /* Anchor left end = 0x0C60 */ - {OV8858_8BIT, 0x4024, 0x0F}, /* Anchor right start = 0x0F36 */ - {OV8858_8BIT, 0x4025, 0x36}, /* Anchor right start = 0x0F36 */ - {OV8858_8BIT, 0x4026, 0x0F}, /* Anchor right end = 0x0F37 */ - {OV8858_8BIT, 0x4027, 0x37}, /* Anchor right end = 0x0F37 */ - {OV8858_8BIT, 0x4028, 0x00}, /* Top zero line start = 0 */ - {OV8858_8BIT, 0x4029, 0x04}, /* Top zero line number = 4 */ - {OV8858_8BIT, 0x402A, 0x04}, /* Top black line start = 4 */ - {OV8858_8BIT, 0x402B, 0x08}, /* Top black line number = 8 */ - {OV8858_8BIT, 0x402C, 0x00}, /* Bottom zero start line = 0 */ - {OV8858_8BIT, 0x402D, 0x02}, /* Bottom zero line number = 2 */ - {OV8858_8BIT, 0x402E, 0x04}, /* Bottom black line start = 4 */ - {OV8858_8BIT, 0x402F, 0x08}, /* Bottom black line number = 8 */ - - {OV8858_8BIT, 0x4034, 0x3F}, /* Unknown */ - {OV8858_8BIT, 0x403D, 0x04}, /* BLC CTRL3D */ - {OV8858_8BIT, 0x4300, 0xFF}, /* clip_max[11:4] = 0xFFF */ - {OV8858_8BIT, 0x4301, 0x00}, /* clip_min[11:4] = 0 */ - {OV8858_8BIT, 0x4302, 0x0F}, /* clip_min/max[3:0] */ - {OV8858_8BIT, 0x4307, 0x01}, /* Unknown */ - {OV8858_8BIT, 0x4316, 0x00}, /* CTRL16 = default */ - {OV8858_8BIT, 0x4503, 0x18}, /* Unknown */ - {OV8858_8BIT, 0x4500, 0x38}, /* Unknown */ - {OV8858_8BIT, 0x4600, 0x01}, /* Unknown */ - {OV8858_8BIT, 0x4601, 0x97}, /* Unknown */ - /* wkup_dly = Mark1 wakeup delay/2^10 = 0x25 */ - {OV8858_8BIT, 0x4808, 0x25}, - {OV8858_8BIT, 0x4816, 0x52}, /* Embedded data type*/ - {OV8858_8BIT, 0x481F, 0x32}, /* clk_prepare_min = 0x32 */ - {OV8858_8BIT, 0x4825, 0x3A}, /* lpx_p_min = 0x3A */ - {OV8858_8BIT, 0x4826, 0x40}, /* hs_prepare_min = 0x40 */ - {OV8858_8BIT, 0x4837, 0x14}, /* pclk_period = 0x14 */ - {OV8858_8BIT, 0x4850, 0x10}, /* LANE SEL01 */ - {OV8858_8BIT, 0x4851, 0x32}, /* LANE SEL02 */ - - {OV8858_8BIT, 0x4B00, 0x2A}, /* Unknown */ - {OV8858_8BIT, 0x4B0D, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x4D00, 0x04}, /* TPM_CTRL_REG */ - {OV8858_8BIT, 0x4D01, 0x18}, /* TPM_CTRL_REG */ - {OV8858_8BIT, 0x4D02, 0xC3}, /* TPM_CTRL_REG */ - {OV8858_8BIT, 0x4D03, 0xFF}, /* TPM_CTRL_REG */ - {OV8858_8BIT, 0x4D04, 0xFF}, /* TPM_CTRL_REG */ - {OV8858_8BIT, 0x4D05, 0xFF}, /* TPM_CTRL_REG */ - - /* - * Lens correction (LENC) function enable = 0 - * Slave sensor AWB Gain function enable = 1 - * Slave sensor AWB Statistics function enable = 1 - * Master sensor AWB Gain function enable = 1 - * Master sensor AWB Statistics function enable = 1 - * Black DPC function enable = 1 - * White DPC function enable =1 - */ - {OV8858_8BIT, 0x5000, 0x7E}, - {OV8858_8BIT, 0x5001, 0x01}, /* BLC function enable = 1 */ - /* - * Horizontal scale function enable = 0 - * WBMATCH bypass mode = Select slave sensor's gain - * WBMATCH function enable = 0 - * Master MWB gain support RGBC = 0 - * OTP_DPC function enable = 1 - * Manual mode of VarioPixel function enable = 0 - * Manual enable of VarioPixel function enable = 0 - * Use VSYNC to latch ISP modules's function enable signals = 0 - */ - {OV8858_8BIT, 0x5002, 0x08}, - /* - * Bypass all ISP modules after BLC module = 0 - * DPC_DBC buffer control enable = 1 - * WBMATCH VSYNC selection = Select master sensor's VSYNC fall - * Select master AWB gain to embed line = AWB gain before manual mode - * Enable BLC's input flip_i signal = 0 - */ - {OV8858_8BIT, 0x5003, 0x20}, - {OV8858_8BIT, 0x5041, 0x1D}, /* ISP CTRL41 - embedded data=on */ - {OV8858_8BIT, 0x5046, 0x12}, /* ISP CTRL46 = default */ - /* - * Tail enable = 1 - * Saturate cross cluster enable = 1 - * Remove cross cluster enable = 1 - * Enable to remove connected defect pixels in same channel = 1 - * Enable to remove connected defect pixels in different channel = 1 - * Smooth enable, use average G for recovery = 1 - * Black/white sensor mode enable = 0 - * Manual mode enable = 0 - */ - {OV8858_8BIT, 0x5780, 0xFC}, - {OV8858_8BIT, 0x5784, 0x0C}, /* DPC CTRL04 */ - {OV8858_8BIT, 0x5787, 0x40}, /* DPC CTRL07 */ - {OV8858_8BIT, 0x5788, 0x08}, /* DPC CTRL08 */ - {OV8858_8BIT, 0x578A, 0x02}, /* DPC CTRL0A */ - {OV8858_8BIT, 0x578B, 0x01}, /* DPC CTRL0B */ - {OV8858_8BIT, 0x578C, 0x01}, /* DPC CTRL0C */ - {OV8858_8BIT, 0x578E, 0x02}, /* DPC CTRL0E */ - {OV8858_8BIT, 0x578F, 0x01}, /* DPC CTRL0F */ - {OV8858_8BIT, 0x5790, 0x01}, /* DPC CTRL10 */ - {OV8858_8BIT, 0x5901, 0x00}, /* VAP CTRL01 = default */ - /* WINC CTRL08 = embedded data in 1st line*/ - {OV8858_8BIT, 0x5A08, 0x00}, - {OV8858_8BIT, 0x5B00, 0x02}, /* OTP CTRL00 */ - {OV8858_8BIT, 0x5B01, 0x10}, /* OTP CTRL01 */ - {OV8858_8BIT, 0x5B02, 0x03}, /* OTP CTRL02 */ - {OV8858_8BIT, 0x5B03, 0xCF}, /* OTP CTRL03 */ - {OV8858_8BIT, 0x5B05, 0x6C}, /* OTP CTRL05 = default */ - {OV8858_8BIT, 0x5E00, 0x00}, /* PRE CTRL00 = default */ - {OV8858_8BIT, 0x5E01, 0x41}, /* PRE_CTRL01 = default */ - - {OV8858_TOK_TERM, 0, 0} -}; - -/*****************************STILL********************************/ - -static const struct ov8858_reg ov8858_8M[] = { - {OV8858_8BIT, 0x0100, 0x00}, /* software_standby */ - {OV8858_8BIT, 0x3778, 0x16}, /* Unknown */ - {OV8858_8BIT, 0x3800, 0x00}, /* h_crop_start high */ - {OV8858_8BIT, 0x3801, 0x0C}, /* h_crop_start low 12 */ - {OV8858_8BIT, 0x3802, 0x00}, /* v_crop_start high */ - {OV8858_8BIT, 0x3803, 0x0C}, /* v_crop_start low */ - {OV8858_8BIT, 0x3804, 0x0C}, /* h_crop_end high */ - {OV8858_8BIT, 0x3805, 0xD3}, /* h_crop_end low 3283 */ - {OV8858_8BIT, 0x3806, 0x09}, /* v_crop_end high */ - {OV8858_8BIT, 0x3807, 0xA3}, /* v_crop_end low */ - {OV8858_8BIT, 0x3808, 0x0C}, /* h_output_size high 3280 x 2464 */ - {OV8858_8BIT, 0x3809, 0xD0}, /* h_output_size low */ - {OV8858_8BIT, 0x380A, 0x09}, /* v_output_size high */ - {OV8858_8BIT, 0x380B, 0xa0}, /* v_output_size low */ - {OV8858_8BIT, 0x380C, 0x07}, /* horizontal timing size high */ - {OV8858_8BIT, 0x380D, 0x94}, /* horizontal timing size low */ - {OV8858_8BIT, 0x380E, 0x0A}, /* vertical timing size high */ - {OV8858_8BIT, 0x380F, 0x0D}, /* vertical timing size low */ - {OV8858_8BIT, 0x3814, 0x01}, /* h_odd_inc */ - {OV8858_8BIT, 0x3815, 0x01}, /* h_even_inc */ - {OV8858_8BIT, 0x3820, 0x00}, /* format1 */ - {OV8858_8BIT, 0x3821, 0x40}, /* format2 */ - {OV8858_8BIT, 0x382A, 0x01}, /* v_odd_inc */ - {OV8858_8BIT, 0x382B, 0x01}, /* v_even_inc */ - {OV8858_8BIT, 0x3830, 0x06}, /* Unknown */ - {OV8858_8BIT, 0x3836, 0x01}, /* Unknown */ - {OV8858_8BIT, 0x3D85, 0x14}, /* OTP_REG85 */ - {OV8858_8BIT, 0x3F08, 0x10}, /* PSRAM control register */ - {OV8858_8BIT, 0x4034, 0x3F}, /* Unknown */ - {OV8858_8BIT, 0x403D, 0x04}, /* BLC CTRL3D */ - {OV8858_8BIT, 0x4600, 0x01}, /* Unknown */ - {OV8858_8BIT, 0x4601, 0x97}, /* Unknown */ - {OV8858_8BIT, 0x4837, 0x14}, /* pclk_period = 0x14 */ - {OV8858_TOK_TERM, 0, 0} -}; - -static const struct ov8858_reg ov8858_3276x1848[] = { - {OV8858_8BIT, 0x0100, 0x00}, /* software_standby */ - {OV8858_8BIT, 0x3778, 0x16}, /* Unknown */ - {OV8858_8BIT, 0x3800, 0x00}, /* h_crop_start high */ - {OV8858_8BIT, 0x3801, 0x10}, /* h_crop_start low 0c->10*/ - {OV8858_8BIT, 0x3802, 0x01}, /* v_crop_start high */ - {OV8858_8BIT, 0x3803, 0x42}, /* v_crop_start low 3e->42*/ - {OV8858_8BIT, 0x3804, 0x0C}, /* h_crop_end high */ - {OV8858_8BIT, 0x3805, 0xD3}, /* h_crop_end low */ - {OV8858_8BIT, 0x3806, 0x08}, /* v_crop_end high */ - {OV8858_8BIT, 0x3807, 0x71}, /* v_crop_end low */ - {OV8858_8BIT, 0x3808, 0x0C}, /* h_output_size high 3276 x 1848 */ - {OV8858_8BIT, 0x3809, 0xCC}, /* h_output_size low d0->cc*/ - {OV8858_8BIT, 0x380A, 0x07}, /* v_output_size high */ - {OV8858_8BIT, 0x380B, 0x38}, /* v_output_size low 3c->38*/ - {OV8858_8BIT, 0x380C, 0x07}, /* horizontal timing size high */ - {OV8858_8BIT, 0x380D, 0x94}, /* horizontal timing size low */ - {OV8858_8BIT, 0x380E, 0x0A}, /* vertical timing size high */ - {OV8858_8BIT, 0x380F, 0x0D}, /* vertical timing size low */ - {OV8858_8BIT, 0x3814, 0x01}, /* h_odd_inc */ - {OV8858_8BIT, 0x3815, 0x01}, /* h_even_inc */ - {OV8858_8BIT, 0x3820, 0x00}, /* format1 */ - {OV8858_8BIT, 0x3821, 0x40}, /* format2 */ - {OV8858_8BIT, 0x382A, 0x01}, /* v_odd_inc */ - {OV8858_8BIT, 0x382B, 0x01}, /* v_even_inc */ - {OV8858_8BIT, 0x3830, 0x06}, /* Unknown */ - {OV8858_8BIT, 0x3836, 0x01}, /* Unknown */ - {OV8858_8BIT, 0x3D85, 0x14}, /* OTP_REG85 */ - {OV8858_8BIT, 0x3F08, 0x10}, /* PSRAM control register */ - {OV8858_8BIT, 0x4034, 0x3F}, /* Unknown */ - {OV8858_8BIT, 0x403D, 0x04}, /* BLC CTRL3D */ - {OV8858_8BIT, 0x4600, 0x01}, /* Unknown */ - {OV8858_8BIT, 0x4601, 0x97}, /* Unknown */ - {OV8858_8BIT, 0x4837, 0x14}, /* pclk_period = 0x14 */ - {OV8858_TOK_TERM, 0, 0} -}; - -static const struct ov8858_reg ov8858_6M[] = { - {OV8858_8BIT, 0x0100, 0x00}, /* software_standby */ - {OV8858_8BIT, 0x3778, 0x16}, /* Unknown */ - {OV8858_8BIT, 0x3800, 0x00}, /* h_crop_start high */ - {OV8858_8BIT, 0x3801, 0x0C}, /* h_crop_start low */ - {OV8858_8BIT, 0x3802, 0x01}, /* v_crop_start high */ - {OV8858_8BIT, 0x3803, 0x3E}, /* v_crop_start low */ - {OV8858_8BIT, 0x3804, 0x0C}, /* h_crop_end high */ - {OV8858_8BIT, 0x3805, 0xD3}, /* h_crop_end low */ - {OV8858_8BIT, 0x3806, 0x08}, /* v_crop_end high */ - {OV8858_8BIT, 0x3807, 0x71}, /* v_crop_end low */ - {OV8858_8BIT, 0x3808, 0x0C}, /* h_output_size high 3280 x 1852 */ - {OV8858_8BIT, 0x3809, 0xD0}, /* h_output_size low */ - {OV8858_8BIT, 0x380A, 0x07}, /* v_output_size high */ - {OV8858_8BIT, 0x380B, 0x3C}, /* v_output_size low */ - {OV8858_8BIT, 0x380C, 0x07}, /* horizontal timing size high */ - {OV8858_8BIT, 0x380D, 0x94}, /* horizontal timing size low */ - {OV8858_8BIT, 0x380E, 0x0A}, /* vertical timing size high */ - {OV8858_8BIT, 0x380F, 0x0D}, /* vertical timing size low */ - {OV8858_8BIT, 0x3814, 0x01}, /* h_odd_inc */ - {OV8858_8BIT, 0x3815, 0x01}, /* h_even_inc */ - {OV8858_8BIT, 0x3820, 0x00}, /* format1 */ - {OV8858_8BIT, 0x3821, 0x40}, /* format2 */ - {OV8858_8BIT, 0x382A, 0x01}, /* v_odd_inc */ - {OV8858_8BIT, 0x382B, 0x01}, /* v_even_inc */ - {OV8858_8BIT, 0x3830, 0x06}, /* Unknown */ - {OV8858_8BIT, 0x3836, 0x01}, /* Unknown */ - {OV8858_8BIT, 0x3D85, 0x14}, /* OTP_REG85 */ - {OV8858_8BIT, 0x3F08, 0x10}, /* PSRAM control register */ - {OV8858_8BIT, 0x4034, 0x3F}, /* Unknown */ - {OV8858_8BIT, 0x403D, 0x04}, /* BLC CTRL3D */ - {OV8858_8BIT, 0x4600, 0x01}, /* Unknown */ - {OV8858_8BIT, 0x4601, 0x97}, /* Unknown */ - {OV8858_8BIT, 0x4837, 0x14}, /* pclk_period = 0x14 */ - {OV8858_TOK_TERM, 0, 0} -}; - -static const struct ov8858_reg ov8858_1080P_60[] = { - {OV8858_8BIT, 0x0100, 0x00}, /* software_standby */ - {OV8858_8BIT, 0x3778, 0x17}, /* Unknown */ - {OV8858_8BIT, 0x3800, 0x02}, /* h_crop_start high */ - {OV8858_8BIT, 0x3801, 0x26}, /* h_crop_start low */ - {OV8858_8BIT, 0x3802, 0x02}, /* v_crop_start high */ - {OV8858_8BIT, 0x3803, 0x8C}, /* v_crop_start low */ - {OV8858_8BIT, 0x3804, 0x0A}, /* h_crop_end high */ - {OV8858_8BIT, 0x3805, 0x9D}, /* h_crop_end low */ - {OV8858_8BIT, 0x3806, 0x07}, /* v_crop_end high */ - {OV8858_8BIT, 0x3807, 0x0A}, /* v_crop_end low */ - {OV8858_8BIT, 0x3808, 0x07}, /* h_output_size high*/ - {OV8858_8BIT, 0x3809, 0x90}, /* h_output_size low */ - {OV8858_8BIT, 0x380A, 0x04}, /* v_output_size high */ - {OV8858_8BIT, 0x380B, 0x48}, /* v_output_size low */ - {OV8858_8BIT, 0x380C, 0x07}, /* horizontal timing size high */ - {OV8858_8BIT, 0x380D, 0x94}, /* horizontal timing size low */ - {OV8858_8BIT, 0x380E, 0x04}, /* vertical timing size high */ - {OV8858_8BIT, 0x380F, 0xEC}, /* vertical timing size low */ - {OV8858_8BIT, 0x3814, 0x01}, /* h_odd_inc */ - {OV8858_8BIT, 0x3815, 0x01}, /* h_even_inc */ - {OV8858_8BIT, 0x3820, 0x00}, /* format1 */ - {OV8858_8BIT, 0x3821, 0x40}, /* format2 */ - {OV8858_8BIT, 0x382A, 0x01}, /* v_odd_inc */ - {OV8858_8BIT, 0x382B, 0x01}, /* v_even_inc */ - {OV8858_8BIT, 0x3830, 0x06}, /* Unknown */ - {OV8858_8BIT, 0x3836, 0x01}, /* Unknown */ - {OV8858_8BIT, 0x3D85, 0x14}, /* OTP_REG85 */ - {OV8858_8BIT, 0x3F08, 0x10}, /* PSRAM control register */ - {OV8858_8BIT, 0x4034, 0x3F}, /* Unknown */ - {OV8858_8BIT, 0x403D, 0x04}, /* BLC CTRL3D */ - {OV8858_8BIT, 0x4600, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x4601, 0xef}, /* Unknown */ - {OV8858_8BIT, 0x4837, 0x16}, /* pclk_period = 0x16 */ - {OV8858_TOK_TERM, 0, 0} -}; - -static const struct ov8858_reg ov8858_1080P_30[] = { - {OV8858_8BIT, 0x0100, 0x00}, /* software_standby */ - {OV8858_8BIT, 0x3778, 0x17}, /* Unknown */ - {OV8858_8BIT, 0x3800, 0x02}, /* h_crop_start high */ - {OV8858_8BIT, 0x3801, 0x26}, /* h_crop_start low */ - {OV8858_8BIT, 0x3802, 0x02}, /* v_crop_start high */ - {OV8858_8BIT, 0x3803, 0x8C}, /* v_crop_start low */ - {OV8858_8BIT, 0x3804, 0x0A}, /* h_crop_end high */ - {OV8858_8BIT, 0x3805, 0x9D}, /* h_crop_end low */ - {OV8858_8BIT, 0x3806, 0x07}, /* v_crop_end high */ - {OV8858_8BIT, 0x3807, 0x0A}, /* v_crop_end low */ - {OV8858_8BIT, 0x3808, 0x07}, /* h_output_size high*/ - {OV8858_8BIT, 0x3809, 0x90}, /* h_output_size low */ - {OV8858_8BIT, 0x380A, 0x04}, /* v_output_size high */ - {OV8858_8BIT, 0x380B, 0x48}, /* v_output_size low */ - {OV8858_8BIT, 0x380C, 0x07}, /* horizontal timing size high */ - {OV8858_8BIT, 0x380D, 0x94}, /* horizontal timing size low */ - {OV8858_8BIT, 0x380E, 0x0A}, /* vertical timing size high */ - {OV8858_8BIT, 0x380F, 0x0D}, /* vertical timing size low */ - {OV8858_8BIT, 0x3814, 0x01}, /* h_odd_inc */ - {OV8858_8BIT, 0x3815, 0x01}, /* h_even_inc */ - {OV8858_8BIT, 0x3820, 0x00}, /* format1 */ - {OV8858_8BIT, 0x3821, 0x40}, /* format2 */ - {OV8858_8BIT, 0x382A, 0x01}, /* v_odd_inc */ - {OV8858_8BIT, 0x382B, 0x01}, /* v_even_inc */ - {OV8858_8BIT, 0x3830, 0x06}, /* Unknown */ - {OV8858_8BIT, 0x3836, 0x01}, /* Unknown */ - {OV8858_8BIT, 0x3D85, 0x14}, /* OTP_REG85 */ - {OV8858_8BIT, 0x3F08, 0x10}, /* PSRAM control register */ - {OV8858_8BIT, 0x4034, 0x3F}, /* Unknown */ - {OV8858_8BIT, 0x403D, 0x04}, /* BLC CTRL3D */ - {OV8858_8BIT, 0x4600, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x4601, 0xef}, /* Unknown */ - {OV8858_8BIT, 0x4837, 0x16}, /* pclk_period = 0x16 */ - {OV8858_TOK_TERM, 0, 0} -}; - -static const struct ov8858_reg ov8858_1640x1232[] = { - {OV8858_8BIT, 0x0100, 0x00}, /* software_standby */ - {OV8858_8BIT, 0x3778, 0x16}, /* Unknown */ - {OV8858_8BIT, 0x3800, 0x00}, /* h_crop_start high */ - {OV8858_8BIT, 0x3801, 0x0C}, /* h_crop_start low 12 */ - {OV8858_8BIT, 0x3802, 0x00}, /* v_crop_start high */ - {OV8858_8BIT, 0x3803, 0x0C}, /* v_crop_start low */ - {OV8858_8BIT, 0x3804, 0x0C}, /* h_crop_end high 3283 */ - {OV8858_8BIT, 0x3805, 0xD3}, /* h_crop_end low */ - {OV8858_8BIT, 0x3806, 0x09}, /* v_crop_end high */ - {OV8858_8BIT, 0x3807, 0xA3}, /* v_crop_end low */ - {OV8858_8BIT, 0x3808, 0x06}, /* h_output_size high 1640 x 1232 */ - {OV8858_8BIT, 0x3809, 0x68}, /* h_output_size low */ - {OV8858_8BIT, 0x380A, 0x04}, /* v_output_size high */ - {OV8858_8BIT, 0x380B, 0xD0}, /* v_output_size low */ - {OV8858_8BIT, 0x380C, 0x07}, /* horizontal timing size high */ - {OV8858_8BIT, 0x380D, 0x94}, /* horizontal timing size low */ - {OV8858_8BIT, 0x380E, 0x09}, /* vertical timing size high */ - {OV8858_8BIT, 0x380F, 0xAA}, /* vertical timing size low */ - {OV8858_8BIT, 0x3814, 0x03}, /* h_odd_inc */ - {OV8858_8BIT, 0x3815, 0x01}, /* h_even_inc */ - {OV8858_8BIT, 0x3820, 0x00}, /* format1 */ - {OV8858_8BIT, 0x3821, 0x67}, /* format2 */ - {OV8858_8BIT, 0x382A, 0x03}, /* v_odd_inc */ - {OV8858_8BIT, 0x382B, 0x01}, /* v_even_inc */ - {OV8858_8BIT, 0x3830, 0x08}, /* Unknown */ - {OV8858_8BIT, 0x3836, 0x02}, /* Unknown */ - {OV8858_8BIT, 0x3D85, 0x16}, /* OTP_REG85 */ - {OV8858_8BIT, 0x3F08, 0x08}, /* PSRAM control register */ - {OV8858_8BIT, 0x4034, 0x3F}, /* Unknown */ - {OV8858_8BIT, 0x403D, 0x04}, /* BLC CTRL3D */ - {OV8858_8BIT, 0x4600, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x4601, 0xCB}, /* Unknown */ - {OV8858_8BIT, 0x4837, 0x14}, /* pclk_period = 0x14 */ - {OV8858_TOK_TERM, 0, 0} -}; - -static const struct ov8858_reg ov8858_1640x1096[] = { - {OV8858_8BIT, 0x0100, 0x00}, /* software_standby */ - {OV8858_8BIT, 0x3778, 0x16}, /* Unknown */ - {OV8858_8BIT, 0x3800, 0x00}, /* h_crop_start high */ - {OV8858_8BIT, 0x3801, 0x0C}, /* h_crop_start low 12 */ - {OV8858_8BIT, 0x3802, 0x00}, /* v_crop_start high */ - {OV8858_8BIT, 0x3803, 0x0C}, /* v_crop_start low */ - {OV8858_8BIT, 0x3804, 0x0C}, /* h_crop_end high 3283 */ - {OV8858_8BIT, 0x3805, 0xD3}, /* h_crop_end low */ - {OV8858_8BIT, 0x3806, 0x09}, /* v_crop_end high */ - {OV8858_8BIT, 0x3807, 0xA3}, /* v_crop_end low */ - {OV8858_8BIT, 0x3808, 0x06}, /* h_output_size high 1640 x 1096 */ - {OV8858_8BIT, 0x3809, 0x68}, /* h_output_size low */ - {OV8858_8BIT, 0x380A, 0x04}, /* v_output_size high */ - {OV8858_8BIT, 0x380B, 0x48}, /* v_output_size low */ - {OV8858_8BIT, 0x380C, 0x07}, /* horizontal timing size high */ - {OV8858_8BIT, 0x380D, 0x94}, /* horizontal timing size low */ - {OV8858_8BIT, 0x380E, 0x09}, /* vertical timing size high */ - {OV8858_8BIT, 0x380F, 0xAA}, /* vertical timing size low */ - {OV8858_8BIT, 0x3814, 0x03}, /* h_odd_inc */ - {OV8858_8BIT, 0x3815, 0x01}, /* h_even_inc */ - {OV8858_8BIT, 0x3820, 0x00}, /* format1 */ - {OV8858_8BIT, 0x3821, 0x67}, /* format2 */ - {OV8858_8BIT, 0x382A, 0x03}, /* v_odd_inc */ - {OV8858_8BIT, 0x382B, 0x01}, /* v_even_inc */ - {OV8858_8BIT, 0x3830, 0x08}, /* Unknown */ - {OV8858_8BIT, 0x3836, 0x02}, /* Unknown */ - {OV8858_8BIT, 0x3D85, 0x16}, /* OTP_REG85 */ - {OV8858_8BIT, 0x3F08, 0x08}, /* PSRAM control register */ - {OV8858_8BIT, 0x4034, 0x3F}, /* Unknown */ - {OV8858_8BIT, 0x403D, 0x04}, /* BLC CTRL3D */ - {OV8858_8BIT, 0x4600, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x4601, 0xCB}, /* Unknown */ - {OV8858_8BIT, 0x4837, 0x14}, /* pclk_period = 0x14 */ - {OV8858_TOK_TERM, 0, 0} -}; - - -static const struct ov8858_reg ov8858_1640x926[] = { - {OV8858_8BIT, 0x0100, 0x00}, /* software_standby */ - {OV8858_8BIT, 0x3778, 0x16}, /* Unknown */ - {OV8858_8BIT, 0x3800, 0x00}, /* h_crop_start high */ - {OV8858_8BIT, 0x3801, 0x0C}, /* h_crop_start low */ - {OV8858_8BIT, 0x3802, 0x00}, /* v_crop_start high */ - {OV8858_8BIT, 0x3803, 0x0C}, /* v_crop_start low */ - {OV8858_8BIT, 0x3804, 0x0C}, /* h_crop_end high */ - {OV8858_8BIT, 0x3805, 0xD3}, /* h_crop_end low */ - {OV8858_8BIT, 0x3806, 0x09}, /* v_crop_end high */ - {OV8858_8BIT, 0x3807, 0xA3}, /* v_crop_end low */ - {OV8858_8BIT, 0x3808, 0x06}, /* h_output_size high 1640 x 926 */ - {OV8858_8BIT, 0x3809, 0x68}, /* h_output_size low */ - {OV8858_8BIT, 0x380A, 0x03}, /* v_output_size high */ - {OV8858_8BIT, 0x380B, 0x9E}, /* v_output_size low */ - {OV8858_8BIT, 0x380C, 0x07}, /* horizontal timing size high */ - {OV8858_8BIT, 0x380D, 0x94}, /* horizontal timing size low */ - {OV8858_8BIT, 0x380E, 0x09}, /* vertical timing size high */ - {OV8858_8BIT, 0x380F, 0xAA}, /* vertical timing size low */ - {OV8858_8BIT, 0x3814, 0x03}, /* h_odd_inc */ - {OV8858_8BIT, 0x3815, 0x01}, /* h_even_inc */ - {OV8858_8BIT, 0x3820, 0x00}, /* format1 */ - {OV8858_8BIT, 0x3821, 0x67}, /* format2 */ - {OV8858_8BIT, 0x382A, 0x03}, /* v_odd_inc */ - {OV8858_8BIT, 0x382B, 0x01}, /* v_even_inc */ - {OV8858_8BIT, 0x3830, 0x08}, /* Unknown */ - {OV8858_8BIT, 0x3836, 0x02}, /* Unknown */ - {OV8858_8BIT, 0x3D85, 0x16}, /* OTP_REG85 */ - {OV8858_8BIT, 0x3F08, 0x08}, /* PSRAM control register */ - {OV8858_8BIT, 0x4034, 0x3F}, /* Unknown */ - {OV8858_8BIT, 0x403D, 0x04}, /* BLC CTRL3D */ - {OV8858_8BIT, 0x4600, 0x00}, /* Unknown */ - {OV8858_8BIT, 0x4601, 0xCB}, /* Unknown */ - {OV8858_8BIT, 0x4837, 0x14}, /* pclk_period = 0x14 */ - {OV8858_TOK_TERM, 0, 0} -}; - -static struct ov8858_resolution ov8858_res_preview[] = { - { - .desc = "ov8858_1640x926_PREVIEW", - .width = 1640, - .height = 926, - .used = 0, - .regs = ov8858_1640x926, - .bin_factor_x = 0, - .bin_factor_y = 0, - .skip_frames = 0, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 3880, - .lines_per_frame = 2573, - }, - { - } - }, - }, - { - .desc = "ov8858_1640x1232_PREVIEW", - .width = 1640, - .height = 1232, - .used = 0, - .regs = ov8858_1640x1232, - .bin_factor_x = 0, - .bin_factor_y = 0, - .skip_frames = 0, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 3880, - .lines_per_frame = 2573, - }, - { - } - }, - }, - { - .desc = "ov8858_1936x1096_PREVIEW", - .width = 1936, - .height = 1096, - .used = 0, - .regs = ov8858_1080P_30, - .bin_factor_x = 0, - .bin_factor_y = 0, - .skip_frames = 0, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 3880, - .lines_per_frame = 2573, - }, - { - } - }, - }, - { - .desc = "ov8858_3276x1848_PREVIEW", - .width = 3276, - .height = 1848, - .used = 0, - .regs = ov8858_3276x1848, - .bin_factor_x = 0, - .bin_factor_y = 0, - .skip_frames = 0, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 3880, - .lines_per_frame = 2573, - }, - { - } - }, - }, - { - .desc = "ov8858_8M_PREVIEW", - .width = 3280, - .height = 2464, - .used = 0, - .regs = ov8858_8M, - .bin_factor_x = 0, - .bin_factor_y = 0, - .skip_frames = 0, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 3880, - .lines_per_frame = 2573, - }, - { - } - }, - }, -}; - -static struct ov8858_resolution ov8858_res_still[] = { - { - .desc = "ov8858_1640x1232_STILL", - .width = 1640, - .height = 1232, - .used = 0, - .regs = ov8858_1640x1232, - .bin_factor_x = 0, - .bin_factor_y = 0, - .skip_frames = 0, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 3880, - .lines_per_frame = 2573, - }, - { - } - }, - }, - { - .desc = "ov8858_1640x926_STILL", - .width = 1640, - .height = 926, - .used = 0, - .regs = ov8858_1640x926, - .bin_factor_x = 0, - .bin_factor_y = 0, - .skip_frames = 1, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 3880, - .lines_per_frame = 2573, - }, - { - } - }, - }, - { - .desc = "ov8858_3276X1848_STILL", - .width = 3276, - .height = 1848, - .used = 0, - .regs = ov8858_3276x1848, - .bin_factor_x = 0, - .bin_factor_y = 0, - .skip_frames = 1, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 3880, - .lines_per_frame = 2573, - }, - { - } - }, - }, - { - .desc = "ov8858_8M_STILL", - .width = 3280, - .height = 2464, - .used = 0, - .regs = ov8858_8M, - .bin_factor_x = 0, - .bin_factor_y = 0, - .skip_frames = 1, - .fps_options = { - { - /* Pixel clock: 149.76MHZ */ - .fps = 10, - .pixels_per_line = 3880, - .lines_per_frame = 3859, - }, - { - } - }, - }, -}; - -static struct ov8858_resolution ov8858_res_video[] = { - { - .desc = "ov8858_1640x926_VIDEO", - .width = 1640, - .height = 926, - .used = 0, - .regs = ov8858_1640x926, - .bin_factor_x = 0, - .bin_factor_y = 0, - .skip_frames = 1, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 3880, - .lines_per_frame = 2573, - }, - { - } - }, - }, - { - .desc = "ov8858_1640x1232_VIDEO", - .width = 1640, - .height = 1232, - .used = 0, - .regs = ov8858_1640x1232, - .bin_factor_x = 0, - .bin_factor_y = 0, - .skip_frames = 1, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 3880, - .lines_per_frame = 2573, - }, - { - } - }, - }, - { - .desc = "ov8858_1640x1096_VIDEO", - .width = 1640, - .height = 1096, - .used = 0, - .regs = ov8858_1640x1096, - .bin_factor_x = 0, - .bin_factor_y = 0, - .skip_frames = 1, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 3880, - .lines_per_frame = 2573, - }, - { - } - }, - }, - { - .desc = "ov8858_1080P_30_VIDEO", - .width = 1936, - .height = 1096, - .used = 0, - .regs = ov8858_1080P_30, - .bin_factor_x = 0, - .bin_factor_y = 0, - .skip_frames = 1, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 3880, - .lines_per_frame = 2573, - }, - { - } - }, - }, -}; - -#endif /* __OV8858_H__ */ diff --git a/drivers/staging/media/atomisp/include/linux/vlv2_plat_clock.h b/drivers/staging/media/atomisp/include/linux/vlv2_plat_clock.h deleted file mode 100644 index ed709bdd6498..000000000000 --- a/drivers/staging/media/atomisp/include/linux/vlv2_plat_clock.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * vlv2_plat_clock.h - * - * Copyright (C) 2013 Intel Corp - * Author: Asutosh Pathak <asutosh.pathak@intel.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * 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. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -#ifndef __VLV2_PLAT_CLOCK_H -#define __VLV2_PLAT_CLOCK_H - -int vlv2_plat_set_clock_freq(int clock_num, int freq_type); -int vlv2_plat_get_clock_freq(int clock_num); - -int vlv2_plat_configure_clock(int clock_num, u32 conf); -int vlv2_plat_get_clock_status(int clock_num); - -#endif /* __VLV2_PLAT_CLOCK_H */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/Makefile b/drivers/staging/media/atomisp/pci/atomisp2/Makefile index ac3805345f20..83f816faba1b 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/Makefile +++ b/drivers/staging/media/atomisp/pci/atomisp2/Makefile @@ -215,7 +215,6 @@ INCLUDES += \ -I$(atomisp)/css2400/isp/kernels/aa/aa_2/ \ -I$(atomisp)/css2400/isp/kernels/anr/anr_1.0/ \ -I$(atomisp)/css2400/isp/kernels/anr/anr_2/ \ - -I$(atomisp)/css2400/isp/kernels/bayer_ls/bayer_ls_1.0/ \ -I$(atomisp)/css2400/isp/kernels/bh/bh_2/ \ -I$(atomisp)/css2400/isp/kernels/bnlm/ \ -I$(atomisp)/css2400/isp/kernels/bnr/ \ @@ -258,14 +257,10 @@ INCLUDES += \ -I$(atomisp)/css2400/isp/kernels/io_ls/ \ -I$(atomisp)/css2400/isp/kernels/io_ls/bayer_io_ls/ \ -I$(atomisp)/css2400/isp/kernels/io_ls/common/ \ - -I$(atomisp)/css2400/isp/kernels/io_ls/plane_io_ls/ \ - -I$(atomisp)/css2400/isp/kernels/io_ls/yuv420_io_ls/ \ -I$(atomisp)/css2400/isp/kernels/io_ls/yuv444_io_ls/ \ -I$(atomisp)/css2400/isp/kernels/ipu2_io_ls/ \ -I$(atomisp)/css2400/isp/kernels/ipu2_io_ls/bayer_io_ls/ \ -I$(atomisp)/css2400/isp/kernels/ipu2_io_ls/common/ \ - -I$(atomisp)/css2400/isp/kernels/ipu2_io_ls/plane_io_ls/ \ - -I$(atomisp)/css2400/isp/kernels/ipu2_io_ls/yuv420_io_ls/ \ -I$(atomisp)/css2400/isp/kernels/ipu2_io_ls/yuv444_io_ls/ \ -I$(atomisp)/css2400/isp/kernels/iterator/ \ -I$(atomisp)/css2400/isp/kernels/iterator/iterator_1.0/ \ @@ -289,9 +284,6 @@ INCLUDES += \ -I$(atomisp)/css2400/isp/kernels/ref/ref_1.0/ \ -I$(atomisp)/css2400/isp/kernels/s3a/ \ -I$(atomisp)/css2400/isp/kernels/s3a/s3a_1.0/ \ - -I$(atomisp)/css2400/isp/kernels/s3a_stat_ls/ \ - -I$(atomisp)/css2400/isp/kernels/scale/ \ - -I$(atomisp)/css2400/isp/kernels/scale/scale_1.0/ \ -I$(atomisp)/css2400/isp/kernels/sc/ \ -I$(atomisp)/css2400/isp/kernels/sc/sc_1.0/ \ -I$(atomisp)/css2400/isp/kernels/sdis/ \ @@ -315,8 +307,6 @@ INCLUDES += \ -I$(atomisp)/css2400/isp/kernels/ynr/ \ -I$(atomisp)/css2400/isp/kernels/ynr/ynr_1.0/ \ -I$(atomisp)/css2400/isp/kernels/ynr/ynr_2/ \ - -I$(atomisp)/css2400/isp/kernels/yuv_ls \ - -I$(atomisp)/css2400/isp/kernels/yuv_ls/yuv_ls_1.0/ \ -I$(atomisp)/css2400/isp/modes/interface/ \ -I$(atomisp)/css2400/runtime/binary/interface/ \ -I$(atomisp)/css2400/runtime/bufq/interface/ \ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c index debf0e3853ff..22f2dbcecc15 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c @@ -1850,7 +1850,7 @@ irqreturn_t atomisp_isr_thread(int irq, void *isp_ptr) bool frame_done_found[MAX_STREAM_NUM] = {0}; bool css_pipe_done[MAX_STREAM_NUM] = {0}; unsigned int i; - struct atomisp_sub_device *asd = &isp->asd[0]; + struct atomisp_sub_device *asd; dev_dbg(isp->dev, ">%s\n", __func__); @@ -2091,7 +2091,7 @@ int atomisp_set_sensor_runmode(struct atomisp_sub_device *asd, struct atomisp_device *isp = asd->isp; struct v4l2_ctrl *c; struct v4l2_streamparm p = {0}; - int ret; + int ret = 0; int modes[] = { CI_MODE_NONE, CI_MODE_VIDEO, CI_MODE_STILL_CAPTURE, @@ -2105,13 +2105,8 @@ int atomisp_set_sensor_runmode(struct atomisp_sub_device *asd, c = v4l2_ctrl_find(isp->inputs[asd->input_curr].camera->ctrl_handler, V4L2_CID_RUN_MODE); - if (c) { + if (c) ret = v4l2_ctrl_s_ctrl(c, runmode->mode); - } else { - p.parm.capture.capturemode = modes[runmode->mode]; - ret = v4l2_subdev_call(isp->inputs[asd->input_curr].camera, - video, s_parm, &p); - } mutex_unlock(asd->ctrl_handler.lock); return ret; diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c index b7f9da014641..7621b4537147 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c @@ -4502,7 +4502,7 @@ int atomisp_css_isr_thread(struct atomisp_device *isp, { enum atomisp_input_stream_id stream_id = 0; struct atomisp_css_event current_event; - struct atomisp_sub_device *asd = &isp->asd[0]; + struct atomisp_sub_device *asd; #ifndef ISP2401 bool reset_wdt_timer[MAX_STREAM_NUM] = {false}; #endif diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_file.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_file.c index 377ec2a9fa6d..c6d96987561d 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_file.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_file.c @@ -77,20 +77,6 @@ static int file_input_s_stream(struct v4l2_subdev *sd, int enable) return 0; } -static int file_input_g_parm(struct v4l2_subdev *sd, - struct v4l2_streamparm *param) -{ - /*to fake*/ - return 0; -} - -static int file_input_s_parm(struct v4l2_subdev *sd, - struct v4l2_streamparm *param) -{ - /*to fake*/ - return 0; -} - static int file_input_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_format *format) @@ -166,8 +152,6 @@ static int file_input_enum_frame_ival(struct v4l2_subdev *sd, static const struct v4l2_subdev_video_ops file_input_video_ops = { .s_stream = file_input_s_stream, - .g_parm = file_input_g_parm, - .s_parm = file_input_s_parm, }; static const struct v4l2_subdev_core_ops file_input_core_ops = { diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c index 4f9f9dca5e6a..545ef024841d 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c @@ -1279,7 +1279,10 @@ const struct v4l2_file_operations atomisp_fops = { .mmap = atomisp_mmap, .unlocked_ioctl = video_ioctl2, #ifdef CONFIG_COMPAT + /* + * There are problems with this code. Disable this for now. .compat_ioctl32 = atomisp_compat_ioctl32, + */ #endif .poll = atomisp_poll, }; @@ -1291,7 +1294,10 @@ const struct v4l2_file_operations atomisp_file_fops = { .mmap = atomisp_file_mmap, .unlocked_ioctl = video_ioctl2, #ifdef CONFIG_COMPAT + /* + * There are problems with this code. Disable this for now. .compat_ioctl32 = atomisp_compat_ioctl32, + */ #endif .poll = atomisp_poll, }; diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_subdev.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_subdev.c index f3e18d627b0a..b78276ac22da 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_subdev.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_subdev.c @@ -819,12 +819,6 @@ static int __atomisp_update_run_mode(struct atomisp_sub_device *asd) struct atomisp_device *isp = asd->isp; struct v4l2_ctrl *ctrl = asd->run_mode; struct v4l2_ctrl *c; - struct v4l2_streamparm p = {0}; - int modes[] = { CI_MODE_NONE, - CI_MODE_VIDEO, - CI_MODE_STILL_CAPTURE, - CI_MODE_CONTINUOUS, - CI_MODE_PREVIEW }; s32 mode; if (ctrl->val != ATOMISP_RUN_MODE_VIDEO && @@ -840,11 +834,7 @@ static int __atomisp_update_run_mode(struct atomisp_sub_device *asd) if (c) return v4l2_ctrl_s_ctrl(c, mode); - /* Fall back to obsolete s_parm */ - p.parm.capture.capturemode = modes[mode]; - - return v4l2_subdev_call( - isp->inputs[asd->input_curr].camera, video, s_parm, &p); + return 0; } int atomisp_update_run_mode(struct atomisp_sub_device *asd) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_tpg.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_tpg.c index b71cc7bcdbab..adc900272f6f 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_tpg.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_tpg.c @@ -27,18 +27,6 @@ static int tpg_s_stream(struct v4l2_subdev *sd, int enable) return 0; } -static int tpg_g_parm(struct v4l2_subdev *sd, struct v4l2_streamparm *param) -{ - /*to fake*/ - return 0; -} - -static int tpg_s_parm(struct v4l2_subdev *sd, struct v4l2_streamparm *param) -{ - /*to fake*/ - return 0; -} - static int tpg_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_format *format) @@ -101,8 +89,6 @@ static int tpg_enum_frame_ival(struct v4l2_subdev *sd, static const struct v4l2_subdev_video_ops tpg_video_ops = { .s_stream = tpg_s_stream, - .g_parm = tpg_g_parm, - .s_parm = tpg_s_parm, }; static const struct v4l2_subdev_core_ops tpg_core_ops = { diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c index 548e00e7d67b..ba20344ec560 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c @@ -1137,7 +1137,6 @@ static int init_atomisp_wdts(struct atomisp_device *isp) for (i = 0; i < isp->num_of_streams; i++) { struct atomisp_sub_device *asd = &isp->asd[i]; - asd = &isp->asd[i]; #ifndef ISP2401 timer_setup(&asd->wdt, atomisp_wdt, 0); #else diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/gp_regs_defs.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/gp_regs_defs.h deleted file mode 100644 index 34e734f6648e..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/gp_regs_defs.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 _gp_regs_defs_h -#define _gp_regs_defs_h - -#define _HRT_GP_REGS_IS_FWD_REG_IDX 0 - -#define _HRT_GP_REGS_REG_ALIGN 4 - -#endif /* _gp_regs_defs_h */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/sp_hrt.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/sp_hrt.h deleted file mode 100644 index 7ee4deba519a..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/sp_hrt.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef ISP2401 -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 _sp_hrt_h_ -#define _sp_hrt_h_ - -#define hrt_sp_dmem(cell) HRT_PROC_TYPE_PROP(cell, _dmem) - -#define hrt_sp_dmem_master_port_address(cell) hrt_mem_master_port_address(cell, hrt_sp_dmem(cell)) - -#endif /* _sp_hrt_h_ */ -#endif diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/gp_regs_defs.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/gp_regs_defs.h deleted file mode 100644 index 34e734f6648e..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/gp_regs_defs.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 _gp_regs_defs_h -#define _gp_regs_defs_h - -#define _HRT_GP_REGS_IS_FWD_REG_IDX 0 - -#define _HRT_GP_REGS_REG_ALIGN 4 - -#endif /* _gp_regs_defs_h */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/sp_hrt.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/sp_hrt.h deleted file mode 100644 index 7ee4deba519a..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/sp_hrt.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef ISP2401 -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 _sp_hrt_h_ -#define _sp_hrt_h_ - -#define hrt_sp_dmem(cell) HRT_PROC_TYPE_PROP(cell, _dmem) - -#define hrt_sp_dmem_master_port_address(cell) hrt_mem_master_port_address(cell, hrt_sp_dmem(cell)) - -#endif /* _sp_hrt_h_ */ -#endif diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/gp_regs_defs.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/gp_regs_defs.h deleted file mode 100644 index 34e734f6648e..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/gp_regs_defs.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 _gp_regs_defs_h -#define _gp_regs_defs_h - -#define _HRT_GP_REGS_IS_FWD_REG_IDX 0 - -#define _HRT_GP_REGS_REG_ALIGN 4 - -#endif /* _gp_regs_defs_h */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/sp_hrt.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/sp_hrt.h deleted file mode 100644 index 7ee4deba519a..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/sp_hrt.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef ISP2401 -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 _sp_hrt_h_ -#define _sp_hrt_h_ - -#define hrt_sp_dmem(cell) HRT_PROC_TYPE_PROP(cell, _dmem) - -#define hrt_sp_dmem_master_port_address(cell) hrt_mem_master_port_address(cell, hrt_sp_dmem(cell)) - -#endif /* _sp_hrt_h_ */ -#endif diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_api_version.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_api_version.h deleted file mode 100644 index efcd6e1679e8..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_api_version.h +++ /dev/null @@ -1,673 +0,0 @@ -/* -#ifndef ISP2401 - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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. - */ -#else -Support for Intel Camera Imaging ISP subsystem. -Copyright (c) 2010 - 2015, Intel Corporation. -#endif - -#ifdef ISP2401 -This program is free software; you can redistribute it and/or modify it -under the terms and conditions of the GNU General Public License, -version 2, as published by the Free Software Foundation. - -This program is distributed in the hope 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. -*/ -#endif -#ifndef __CSS_API_VERSION_H -#define __CSS_API_VERSION_H - -/* @file - * CSS API version file. This file contains the version number of the CSS-API. - * - * This file is generated from a set of input files describing the CSS-API - * changes. Don't edit this file directly. - */ - - -/** - -The version string has four dot-separated numbers, read left to right: - The first two are the API version, and should not be changed. - The third number is incremented by a CSS firmware developer when the - API change is not backwards compatible. - The fourth number is incremented by the a CSS firmware developer for - every API change. - It should be zeroed when the third number changes. - -*/ - -#ifndef ISP2401 -#define CSS_API_VERSION_STRING "2.1.15.3" -#else -#define CSS_API_VERSION_STRING "2.1.20.9" -#endif - -/* -Change log - -v2.0.1.0, initial version: -- added API versioning - -v2.0.1.1, activate CSS-API versioning: -- added description of major and minor version numbers - -v2.0.1.2, modified struct ia_css_frame_info: -- added new member ia_css_crop_info - -v2.0.1.3, added IA_CSS_ERR_NOT_SUPPORTED - -v2.1.0.0 -- moved version number to 2.1.0.0 -- created new files for refactoring the code - -v2.1.1.0, modified struct ia_css_pipe_config and struct ia_css_pipe_info and struct ia_css_pipe: -- use array to handle multiple output ports - -v2.1.1.1 -- added api to lock/unlock of RAW Buffers to Support HALv3 Feature - -v2.1.1.2, modified struct ia_css_stream_config: -- to support multiple isys streams in one virtual channel, keep the old one for backward compatibility - -v2.1.2.0, modify ia_css_stream_config: -- add isys_config and input_config to support multiple isys stream within one virtual channel - -v2.1.2.1, add IA_CSS_STREAM_FORMAT_NUM -- add IA_CSS_STREAM_FORMAT_NUM definition to reflect the number of ia_css_stream_format enums - -v2.1.2.2, modified enum ia_css_stream_format -- Add 16bit YUV formats to ia_css_stream_format enum: -- IA_CSS_STREAM_FORMAT_YUV420_16 (directly after IA_CSS_STREAM_FORMAT_YUV420_10) -- IA_CSS_STREAM_FORMAT_YUV422_16 (directly after IA_CSS_STREAM_FORMAT_YUV422_10) - -v2.1.2.3 -- added api to enable/disable digital zoom for capture pipe. - -v2.1.2.4, change CSS API to generate the shading table which should be directly sent to ISP: -- keep the old CSS API (which uses the conversion of the shading table in CSS) for backward compatibility - -v2.1.2.5 -- Added SP frame time measurement (in ticks) and result is sent on a new member -- in ia_css_buffer.h. - -v2.1.2.6, add function ia_css_check_firmware_version() -- the function ia_css_check_firmware_version() returns true when the firmware version matches and returns false otherwise. - -v2.1.2.7 -- rename dynamic_data_index to dynamic_queue_id in struct ia_css_frame. -- update IA_CSS_PIPE_MODE_NUM - -v2.1.2.8 -- added flag for video full range - -v2.1.2.9 -- add public parameters for xnr3 kernel - -v2.1.2.10 -- add new interface to enable output mirroring - -v2.1.2.11, MIPI buffers optimization -- modified struct ia_css_mipi_buffer_config, added number of MIPI buffers needed for the stream -- backwards compatible, need another patch to remove legacy function and code - -v2.1.2.12 -- create consolidated firmware package for 2400, 2401, csi2p, bxtpoc - -v2.1.3.0 -- rename ia_css_output_config.enable_mirror -- add new interface to enable vertical output flipping - -v2.1.3.1 -- deprecated ia_css_rx_get_irq_info and ia_css_rx_clear_irq_info because both are hardcoded to work on CSI port 1. -- added new functions ia_css_rx_port_get_irq_info and ia_css_rx_port_clear_irq_info, both have a port ID as extra argument. - -v2.1.3.2 -- reverted v2.1.3.0 change - -v2.1.3.3 -- Added isys event queue. -- Renamed ia_css_dequeue_event to ia_css_dequeue_psys_event -- Made ia_css_dequeue_event deprecated - -v2.1.3.4 -- added new interface to support ACC extension QoS feature. -- added IA_CSS_EVENT_TYPE_ACC_STAGE_COMPLETE. - -v2.1.3.5 -- added tiled frame format IA_CSS_FRAME_FORMAT_NV12_TILEY - -v2.1.3.6 -- added functions ia_css_host_data_allocate and ia_css_host_data_free - -v2.1.4.0, default pipe config change -- disable enable_dz param by default - -v2.1.5.0 -- removed mix_range field from yuvp1_y_ee_nr_frng_public_config - -v2.1.5.1, exposure IDs per stream -- added MIN/MAX exposure ID macros -- made exposure ID sequence per-stream instead of global (across all streams) - -#ifdef ISP2401 -v2.1.5.1, Add parameters to mmgr routines via a macro. -- Replaced mmgr funtions with macros to add caller func name + line #. -- This is done to help debug memory access issues, allocation issues, etc. - -#endif -v2.1.6.0, Interface for vertical output flip -- add new interface to enable vertical output flipping -- rename ia_css_output_config.enable_mirror - -#ifndef ISP2401 -v2.1.6.1, Effective res on pipe -#else -v2.1.6.2 (2 changes parallel), Effective res on pipe -#endif -- Added input_effective_res to struct ia_css_pipe_config in ia_css_pipe_public.h. - -#ifndef ISP2401 -v2.1.6.2, CSS-API version file generated from individual changes -#else -v2.1.6.3 (2 changes parallel), CSS-API version file generated from individual changes -#endif -- Avoid merge-conflicts by generating version file from individual CSS-API changes. -- Parallel CSS-API changes can map to the same version number after this change. -- Version numbers for a change could increase due to parallel changes being merged. -- The version number would not decrease for a change. - -#ifndef ISP2401 -v2.1.6.5 (2 changes parallel), Add SP FW error event -#else -v2.1.6.6 (4 changes parallel), Add SP FW error event -#endif -- Added FW error event. This gets raised when the SP FW runs into an -- error situation from which it cannot recover. - -#ifndef ISP2401 -v2.1.6.5 (2 changes parallel), expose bnr FF enable bits in bnr public API -#else -v2.1.6.6 (4 changes parallel), expose bnr FF enable bits in bnr public API -#endif -- Added ff enable bits to bnr_public_config_dn_detect_ctrl_config_t struct - -#ifndef ISP2401 -v2.1.6.5 (2 changes parallel), ISP configuration per pipe -#else -v2.1.6.6 (4 changes parallel), ISP configuration per pipe -#endif -- Added ISP configuration per pipe support: p_isp_config field in -- struct ia_css_pipe_config and ia_css_pipe_set_isp_config_on_pipe -- and ia_css_pipe_set_isp_config functions - -#ifndef ISP2401 -v2.1.7.0, removed css_version.h -#else -v2.1.7.0 (2 changes parallel), removed css_version.h -#endif -- Removed css_version.h that was used for versioning in manual (non-CI) releases. - -#ifndef ISP2401 -v2.1.7.1, Add helpers (get and set) for ISP cfg per pipe -#else -v2.1.7.2 (2 changes parallel), Add helpers (get and set) for ISP cfg per pipe -#endif -- Add helpers (get and set) for ISP configuration per pipe - -#ifndef ISP2401 -v2.1.7.2, Add feature to lock all RAW buffers -#else -v2.1.7.3 (2 changes parallel), Add feature to lock all RAW buffers -#endif -- This API change adds a boolean flag (lock_all) in the stream_config struct. -- If this flag is set to true, then all frames will be locked if locking is -- enabled. By default this flag is set to false. -- When this flag is false, then only buffers that are sent to the preview pipe -- will be locked. If continuous viewfinder is disabled, the flag should be set -- to true. - -#ifndef ISP2401 -v2.1.8.0 (2 changes parallel), Various changes to support ACC configuration per pipe -#else -v2.1.8.0 (4 changes parallel), Various changes to support ACC configuration per pipe -#endif -- Add ia_css_pipe_get_isp_config() -- Remove ia_css_pipe_set_isp_config_on_pipe (duplicated -- by ia_css_pipe_set_isp_config) -- Add isp configuration as parameter for -- ia_css_pipe_set_isp_config -- Remove ia_css_pipe_isp_config_set() -- Remove ia_css_pipe_isp_config_get() - -#ifndef ISP2401 -v2.1.8.2 (2 changes parallel), Added member num_invalid_frames to ia_css_pipe_info structure. -#else -v2.1.8.3 (4 changes parallel), Added member num_invalid_frames to ia_css_pipe_info structure. -#endif -- Added member num_invalid_frames to ia_css_pipe_info structure. -- This helps the driver make sure that the first valid output -- frame goes into the first user-supplied output buffer. - -#ifndef ISP2401 -v2.1.8.4 (2 changes parallel), ISYS EOF timestamp for output buffers -#else -v2.1.8.5 (4 changes parallel), ISYS EOF timestamp for output buffers -#endif -- driver gets EOF timer to every out frame . ia_css_buffer modified to accomodate same. - -#ifndef ISP2401 -v2.1.8.4 (4 changes parallel), display_config -#else -v2.1.8.5 (6 changes parallel), display_config -#endif -- Added formats- and output config parameters for configuration of the (optional) display output. - -#ifndef ISP2401 -v2.1.8.4 (2 changes parallel), Adding zoom region parameters to CSS API -#else -v2.1.8.5 (4 changes parallel), Adding zoom region parameters to CSS API -#endif -- Adding ia_css_point and ia_css_region structures to css-api. -- Adding zoom_region(type ia_css_region) parameter to ia_css_dz_config structure. -- By using this user can do the zoom based on zoom region and -- the center of the zoom region is not restricted at the center of the input frame. - -#ifndef ISP2401 -v2.1.8.6 (1 changes parallel), Add new ia_css_fw_warning type -#else -v2.1.8.7 (3 changes parallel), Add new ia_css_fw_warning type -#endif -- Add IA_CSS_FW_WARNING_TAG_EXP_ID_FAILED enum to ia_css_fw_warning type -- Extend sp_warning() with exp_id parameter - -#ifndef ISP2401 -v2.1.8.6 (1 changes parallel), Add includes in GC, GC2 kernel interface files -#else -v2.1.8.7 (3 changes parallel), Add includes in GC, GC2 kernel interface files -#endif -- add ia_css_ctc_types.h includes in ia_css_gc_types.h and ia_css_gc2_types.h. Needed to get ia_css_vamem_type. - -#ifndef ISP2401 -v2.1.9.0 (1 changes parallel), Introduce sp assert event. -#else -v2.1.9.0 (3 changes parallel), Introduce sp assert event. -#endif -- Add IA_CSS_EVENT_TYPE_FW_ASSERT. The FW sends the event in case an assert goes off. - -#ifndef ISP2401 -v2.1.9.1 (1 changes parallel), Exclude driver part from ia_css_buffer.h as it is also used by SP -#else -v2.1.9.2 (3 changes parallel), Exclude driver part from ia_css_buffer.h as it is also used by SP -#endif -- Excluded driver part of the interface from SP/ISP code -- Driver I/F is not affected - -#ifndef ISP2401 -v2.1.9.2, added IA_CSS_EVENT_TYPE_TIMER -#else -v2.1.9.3 (2 changes parallel), added IA_CSS_EVENT_TYPE_TIMER -#endif -- Added a new event called IA_CSS_EVENT_TYPE_TIMER - -#ifndef ISP2401 -v2.1.10.0 (4 changes parallel), Add a flag "enable_dpc" to "struct ia_css_pipe_config" -#else -v2.1.10.0 (6 changes parallel), Add a flag "enable_dpc" to "struct ia_css_pipe_config" -#endif -- Add a flag "enable_dpc" to "struct ia_css_pipe_config" - -#ifndef ISP2401 -v2.1.10.6 (6 changes parallel), change the pipe version type from integer to enum -#else -v2.1.10.8 (9 changes parallel), change the pipe version type from integer to enum -#endif -- add new enum to enumerate ISP pipe version -- change the pipe version type in pipe_config from integer to enum - -#ifndef ISP2401 -v2.1.13.0 (8 changes parallel), Stop Support for Skycam B0 -#else -v2.1.14.0 (12 changes parallel), Stop Support for Skycam B0 -#endif -- Remove a few pre-processor defines for Skycam B0/C0 as support - -#ifndef ISP2401 -v2.1.14.0 (24 changes parallel), change the pipe version type from integer to enum -#else -v2.1.15.0 (28 changes parallel), change the pipe version type from integer to enum -#endif -- remove the temporary workaround for backward compatability - -#ifndef ISP2401 -v2.1.14.0 (13 changes parallel), expose_gamma_enable_option -#else -v2.1.15.0 (17 changes parallel), expose_gamma_enable_option -#endif -- added enable param to gamma_corr_public_config -- added documentation to rgbpp_public.h - -#ifndef ISP2401 -v2.1.14.0 (12 changes parallel), Remove deprecated FW_ERROR event. -#else -v2.1.15.0 (16 changes parallel), Remove deprecated FW_ERROR event. -#endif -- Remove code for deprecated FW_ERROR event. - -#ifndef ISP2401 -v2.1.14.3 (5 changes parallel), fix IEFD's puclic API types -#else -v2.1.15.5 (8 changes parallel), fix IEFD's puclic API types -#endif -- fix IEFD public API members types: rad_cu6_x1,rad_cu_unsharp_x1 & unsharp_amount - -#ifndef ISP2401 -v2.1.14.3 (5 changes parallel), Add IA_CSS_FW_WARNING_FRAME_PARAM_MISMATCH -#else -v2.1.15.5 (8 changes parallel), Add IA_CSS_FW_WARNING_FRAME_PARAM_MISMATCH -#endif -- Add IA_CSS_FW_WARNING_FRAME_PARAM_MISMATCH enum to ia_css_fw_warning type - -#ifndef ISP2401 -v2.1.14.4 (5 changes parallel), new API getter functions for gdc in buffer information -#else -v2.1.15.8 (11 changes parallel), add_flag_to_disable_continous_viewfinder -- add a new flag in stream_config to disable continuous viewfinder -- in ZSL use case. - -v2.1.16.0 (8 changes parallel), revert ia_css_skc_dvs_statistics field size change -- Reverted field size change, change was not ready for driver yet. - -v2.1.17.0 (7 changes parallel), change CSS API to fix the shading correction off-center issue -- update the ia_css_shading_info structure in ia_css_types.h - -v2.1.17.0 (32 changes parallel), add_flag_to_disable_continous_viewfinder_part2 -- remove the old interfaces - -v2.1.17.4 (8 changes parallel), Added public interface for setting the scaler LUT. -- Added the public struct to output system and modified the global config struct. - -v2.1.17.5 (7 changes parallel), Add parameters for new TNR3 component -- Add new parameters for new TNR3 component - -v2.1.17.6 (9 changes parallel), Update skycam DPC_MAX_NUMBER_OF_DP -- Automated tooling requires an API change request -- This change changes the implementation of #define DPC_MAX_NUMBER_OF_DP -- it now returns a different number - -v2.1.17.6 (8 changes parallel), Return an error when both DPC and BDS are enabled in a pipe config -- Return an error when both DPC and BDS are enabled in a pipe config - -v2.1.17.6 (9 changes parallel), new API getter functions for gdc in buffer information -#endif -- ia_css_pipe_get_dvs_filter() added -- ia_css_pipe_get_gdc_in_buffer_info() added - -#ifndef ISP2401 -v2.1.14.5 (8 changes parallel), Update CNR2 ineffective values -#else -v2.1.17.7 (12 changes parallel), Update CNR2 ineffective values -#endif -- Fixed Incorrect ineffective values listed in ia_css_cnr_config -- Correct Ineffective value is 8191 - -#ifndef ISP2401 -v2.1.14.5 (8 changes parallel), af_roi_api -#else -v2.1.17.7 (12 changes parallel), af_roi_api -#endif -- added a new function to set AF ROI ia_css_set_af_roi -- added a new struct ia_css_s3a_roi_offset - -#ifndef ISP2401 -v2.1.14.5 (8 changes parallel), remove x_y_end_from_ae_and_awb -#else -v2.1.17.7 (12 changes parallel), Enlarge AF AWB_FR stats buffers -- Enlarge AF and AWB_FR stats buffers to support max grid width per stripe as oppose to per frame - -v2.1.17.7 (12 changes parallel), remove x_y_end_from_ae_and_awb -#endif -- added a flag to prepare removal of x_end and y_end from ae grid public config -- added a flag to prepare removal of x_end and y_end from awb grid public config - -#ifndef ISP2401 -v2.1.14.5 (4 changes parallel), Added public interface for setting the scaler LUT. -- Added the public struct to output system and modified the global config struct. -#else -v2.1.17.8 (5 changes parallel) -- added input_yuv , input_raw to ia_css_binary_info.enable -- struct, these attributes were always there but not saved -- in the binary_info struct -#endif - -#ifndef ISP2401 -v2.1.14.6 (8 changes parallel), add_flag_to_disable_continous_viewfinder -- add a new flag in stream_config to disable continuous viewfinder -- in ZSL use case. -#else -v2.1.17.9 (6 changes parallel), cleanup_awb_ae_rgb_integration_flags -- this change only cleans up an approved api CR see wikis below -#endif - -#ifndef ISP2401 -v2.1.14.6 (8 changes parallel), Enlarge AF AWB_FR stats buffers -- Enlarge AF and AWB_FR stats buffers to support max grid width per stripe as oppose to per frame -#else -v2.1.17.10 (6 changes parallel), output_system_input_resolution -- adedd gdc_output_system_in_resolution to pipe config struct -#endif - -#ifndef ISP2401 -v2.1.14.8 (6 changes parallel), pipe config option for vf output bci mode downscaling -#else -v2.1.17.10 (5 changes parallel), Per pipe DPC configuration is added to ia_css_isp_parameters -- Per pipe DPC configuration is added to ia_css_isp_parameters - -v2.1.17.10 (10 changes parallel), pipe config option for vf output bci mode downscaling -#endif -- vf downscaling using yuv_scale binary. - -#ifndef ISP2401 -v2.1.14.10 (7 changes parallel), Add scale mode GDC V2 LUT to CSS API -#else -v2.1.17.12 (11 changes parallel), Add scale mode GDC V2 LUT to CSS API -#endif -- Allow client to set global LUT for gdc v2 (First step in this change. See wiki page for more details) - -#ifndef ISP2401 -v2.1.14.10 (8 changes parallel), Include added to type-support.h. -#else -v2.1.17.12 (12 changes parallel), Include added to type-support.h. -#endif -- Include of hive/cell_support.h was added to type-support.h, in order to -- have access to define HAVE_STDINT. - -#ifndef ISP2401 -v2.1.14.11 (7 changes parallel), Pipe configuration to enable BLI mode downscaling for -#else -v2.1.17.13 (11 changes parallel), Pipe configuration to enable BLI mode downscaling for -#endif -- BLI mode downscaling for capture post-processing - -#ifndef ISP2401 -v2.1.14.14 (9 changes parallel), Fix copyright headers (no functional change) -#else -v2.1.17.15 (8 changes parallel), Add copyright headers to css files -- Add copyright headers to css API files - -v2.1.17.15 (8 changes parallel), add copyright header to include files -- add copyright header to include files - -v2.1.17.15 (8 changes parallel), add copyright header to isp files -- add copyright header to isp files - -v2.1.17.15 (8 changes parallel), add copyright header to refactored code -- add copyright header to refactored code -- (base, camera, runtime directories) - -v2.1.17.16 (13 changes parallel), Fix copyright headers (no functional change) -#endif -- No functional change; only fixes copyright headers - -#ifndef ISP2401 -v2.1.14.14 (6 changes parallel), Remove continuous mode special case handling in ia_css_pipe_set_isp_config -#else -v2.1.17.16 (10 changes parallel), Remove continuous mode special case handling in ia_css_pipe_set_isp_config -#endif -- For continuous mode isp_config was being send to all pipes, -- even though API ia_css_pipe_set_isp_config is for single pipe -- Removed incorrect case - -#ifndef ISP2401 -v2.1.14.14 (6 changes parallel), DVS statistics grid produced by accelerator -#else -v2.1.17.16 (5 changes parallel), Added documentation to formats_config header file -- Added description of ranges for full-range flag - -v2.1.17.16 (10 changes parallel), DVS statistics grid produced by accelerator -#endif -- Add DVS statistics produced by accelerator grid to pipe info -- Add ia_css_pipe_has_dvs_stats function - -#ifndef ISP2401 -v2.1.14.15 (7 changes parallel), cont_remove_x_y_end_from_ae_and_awb -#else -v2.1.17.17 (5 changes parallel), Provide the CSS interface to select the luma only binaries -- Add a flag "enable_luma_only" to "struct ia_css_pipe_config" - -v2.1.17.17 (11 changes parallel), cont_remove_x_y_end_from_ae_and_awb -#endif -- this patch doesn't introduce any new api change, it only fixes a recent -- api merged change (#31938) , in order to have success CI i had to upload an api change request - -#ifndef ISP2401 -v2.1.14.17 (6 changes parallel), Add XNR3 blending strength to kernel interface -- Added a blending strength field to the XNR3 kernel interface to add -- support for blending. -#else -v2.1.17.17 (10 changes parallel), GAC state dump for debug -- added ia_css_dump_gac_state function - -v2.1.17.18 (23 changes parallel), output_format_nv12_16 -- added new output fromat nv12_16 -#endif - -#ifndef ISP2401 -v2.1.14.18 (22 changes parallel), eliminate two_pixels_per_clock field -#else -v2.1.17.18 (4 changes parallel), Remove author details from SKC src code -- remove author details from skc src code - -v2.1.17.19 (26 changes parallel), eliminate two_pixels_per_clock field -#endif -- remove obsolete field two_pixels_per_clock - -#ifndef ISP2401 -v2.1.14.19 (3 changes parallel), Fix copyright headers (no functional change) -#else -v2.1.17.20 (7 changes parallel), Fix copyright headers (no functional change) -#endif -- No functional change; only fixes copyright headers - -#ifndef ISP2401 -v2.1.14.21 (3 changes parallel), ia_css_skc_dvs_statistics field size change -- ia_css_skc_dvs_statistics field size change -#else -v2.1.17.20 (11 changes parallel), Add XNR3 blending strength to kernel interface -- Added a blending strength field to the XNR3 kernel interface to add -- support for blending. -#endif - -#ifndef ISP2401 -v2.1.15.0 (3 changes parallel), revert ia_css_skc_dvs_statistics field size change -- Reverted field size change, change was not ready for driver yet. -#else -v2.1.17.21 (24 changes parallel), Add N_CSS_PRBS_IDS and N_CSS_TPG_IDS -- Add N_CSS_PRBS_IDS to reflect the number of ia_css_prbs_id enum -- Add N_CSS_TPG_IDS to reflect the number of ia_css_tpg_id enum -#endif - -#ifndef ISP2401 -v2.1.15.2 (3 changes parallel), Return an error when both DPC and BDS are enabled in a pipe config -- Return an error when both DPC and BDS are enabled in a pipe config -#else -v2.1.17.23 (8 changes parallel), ia_css_skc_dvs_statistics field size change -- ia_css_skc_dvs_statistics field size change -#endif - -#ifndef ISP2401 -v2.1.15.3 (2 changes parallel), Update skycam DPC_MAX_NUMBER_OF_DP -- Automated tooling requires an API change request -- This change changes the implementation of #define DPC_MAX_NUMBER_OF_DP -- it now returns a different number -#else -v2.1.19.0 (6 changes parallel) -- Added code to calculate input_res using the Windows specification of binning -#endif - -#ifndef ISP2401 -v2.1.15.3 (18 changes parallel), output_format_nv12_16 -- added new output fromat nv12_16 -#else -v2.1.20.0 (7 changes parallel), Add interface to select TNR enabled binaries -- Add a bool "enable_tnr" to "struct ia_css_pipe_config" - -v2.1.20.0 (6 changes parallel), OSYS & GDC Debug dump function addition -- add GDC state dump function -- add OSYS state dump function - -v2.1.20.4 (7 changes parallel), Add ref_buf_select parameter for TNR3 to kernel interface -- Added a ref_buf_select parameter to the TNR3 kernel interface to add -- support for multiple reference buffers. - -v2.1.20.4 (6 changes parallel), DVS MAX grid dimensions to cover maximal resolution -- rename DVS_TABLE_HEIGHT/WIDTH to MAX_DVS_COORDS_TABLE_HEIGHT/WIDTH -- modify value of the above macros to cover max resolution - -v2.1.20.5 (54 changes parallel), add input feeder calculations getter -- add input_feeder_config public struct -- add get_input_feeder_config getter - -v2.1.20.5 (4 changes parallel), Enable runtime updating mapped args for QoS extension pipe -- added ia_css_pipe_update_qos_ext_mapped_arg() - -v2.1.20.7 (77 changes parallel), Add parameters to CPU routines via a macro. -- Replaced CPU memory allocation functions with macros to add caller func name + line number. -- This is done to help debug memory access issues, allocation issues, etc. -- Changed API: only ia_css_env.h - -v2.1.20.7 (2 changes parallel), Frame format override -- Added a function call to the pipe interface for overriding -- the frame format as set in the pipe. -- This is an optional interface that can be used under -- some strict conditions. - -v2.1.20.7 (2 changes parallel), Output_system_in_res Information -- Output_system_in_res_info field added to pipe_info struct - -v2.1.20.8, Temprarily disable memory debug features for SVOS. -- Temporary commented out the additions to allow SKC testing till root cause found -- Changed files ia_css_env.h and sh_css.c. - -v2.1.20.9, Enable ISP 2.7 naming -- Add IA_CSS_PIPE_VERSION_2_7 to enum ia_css_pipe_version -- Add #define SH_CSS_ISP_PIPE_VERSION_2_7 4 -#endif - -*/ - -#endif /*__CSS_API_VERSION_H*/ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/hive_isp_css_ddr_hrt_modified.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/hive_isp_css_ddr_hrt_modified.h deleted file mode 100644 index 39785aa21459..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/hive_isp_css_ddr_hrt_modified.h +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2010-2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 _hive_isp_css_ddr_hrt_modified_h_ -#define _hive_isp_css_ddr_hrt_modified_h_ - -#include <hmm_64/hmm.h> - -/* This function reads an image from DDR and stores it in the img_buf array - that has been allocated by the caller. - The specifics of how the pixels are stored into DDR by the DMA are taken - into account (bits padded to a width of 256, depending on the number of - elements per ddr word). - The DMA specific parameters give to this function (elems_per_xword and sign_extend) - should correspond to those given to the DMA engine. - The address is a virtual address which will be translated to a physical address before - data is loaded from or stored to that address. - - The return value is 0 in case of success and 1 in case of failure. - */ -unsigned int -hrt_isp_css_read_image_from_ddr( - unsigned short *img_buf, - unsigned int width, - unsigned int height, - unsigned int elems_per_xword, - unsigned int sign_extend, - hmm_ptr virt_addr); - -/* This function writes an image to DDR, keeping the same aspects into account as the read_image function - above. */ -unsigned int -hrt_isp_css_write_image_to_ddr( - const unsigned short *img_buf, - unsigned int width, - unsigned int height, - unsigned int elems_per_xword, - unsigned int sign_extend, - hmm_ptr virt_addr); - -/* return the size in bytes of an image (frame or plane). */ -unsigned int -hrt_isp_css_sizeof_image_in_ddr( - unsigned int width, - unsigned int height, - unsigned int bits_per_element); - -unsigned int -hrt_isp_css_stride_of_image_in_ddr( - unsigned int width, - unsigned int bits_per_element); - -hmm_ptr -hrt_isp_css_alloc_image_in_ddr( - unsigned int width, - unsigned int height, - unsigned int elems_per_xword); - -hmm_ptr -hrt_isp_css_calloc_image_in_ddr( - unsigned int width, - unsigned int height, - unsigned int elems_per_xword); - -#ifndef HIVE_ISP_NO_GDC -#include "gdc_v2_defs.h" - -hmm_ptr -hrt_isp_css_alloc_gdc_lut_in_ddr(void); - -void -hrt_isp_css_write_gdc_lut_to_ddr( - short values[4][HRT_GDC_N], - hmm_ptr virt_addr); -#endif - -#ifdef _HIVE_ISP_CSS_FPGA_SYSTEM -hmm_ptr -hrt_isp_css_alloc_image_for_display( - unsigned int width, - unsigned int height, - unsigned int elems_per_xword); - -hmm_ptr -hrt_isp_css_calloc_image_for_display( - unsigned int width, - unsigned int height, - unsigned int elems_per_xword); -#endif - -/* New set of functions, these do not require the elems_per_xword, but use bits_per_element instead, - this way the user does not need to know about the width of a DDR word. */ -unsigned int -hrt_isp_css_read_unsigned( - unsigned short *target, - unsigned int width, - unsigned int height, - unsigned int source_bits_per_element, - hmm_ptr source); - -unsigned int -hrt_isp_css_read_signed( - short *target, - unsigned int width, - unsigned int height, - unsigned int source_bits_per_element, - hmm_ptr source); - -unsigned int -hrt_isp_css_write_unsigned( - const unsigned short *source, - unsigned int width, - unsigned int height, - unsigned int target_bits_per_element, - hmm_ptr target); - -unsigned int -hrt_isp_css_write_signed( - const short *source, - unsigned int width, - unsigned int height, - unsigned int target_bits_per_element, - hmm_ptr target); - -hmm_ptr -hrt_isp_css_alloc( - unsigned int width, - unsigned int height, - unsigned int bits_per_element); - -hmm_ptr -hrt_isp_css_calloc( - unsigned int width, - unsigned int height, - unsigned int bits_per_element); - -#endif /* _hive_isp_css_ddr_hrt_modified_h_ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/hive_isp_css_hrt_modified.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/hive_isp_css_hrt_modified.h deleted file mode 100644 index 342553d10e08..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/hive_isp_css_hrt_modified.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2010-2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 _hive_isp_css_hrt_h -#define _hive_isp_css_hrt_h - -#include "system_types.h" - -#include "hive_isp_css_host_ids_hrt.h" -#include "hive_isp_css_defs.h" - -#ifdef HRT_ISP_CSS_CUSTOM_HOST -#ifndef HRT_USE_VIR_ADDRS -#define HRT_USE_VIR_ADDRS -#endif -/*#include "hive_isp_css_custom_host_hrt.h"*/ -#endif - -#include <gpio_block.h> -#include <gp_regs.h> -#include <gp_timer_hrt.h> - #include <css_receiver_2400_hrt.h> -// #include <isp2400_mamoiada_params.h> -// #include <isp2400_support.h> - /* insert idle signal clearing and setting around hrt_main */ - #if !defined(HRT_HW) || defined(HRT_ISP_CSS_INSERT_IDLE_SIGNAL) - #define hrt_main _hrt_isp_css_main - #endif - #ifdef _HIVE_ISP_CSS_SPECMAN_SYSTEM - #include "hive_isp_css_2400_specman_system.h" - #else -#if defined(IS_ISP_2400_MAMOIADA_SYSTEM) - #include "hive_isp_css_2400_system.h" -#elif defined(IS_ISP_2401_MAMOIADA_SYSTEM) - #include "hive_isp_css_2401_system.h" -#else -#error "hive_isp_css_hrt_modified.h: SYSTEM must be one of {2400_MAMOIADA_SYSTEM, 2401_MAMOIADA_SYSTEM}" -#endif - #endif -#include <sp_hrt.h> -#include <input_system_hrt.h> -#include <input_selector_hrt.h> -#include <sig_monitor_hrt.h> - -#include "hive_isp_css_sdram_wakeup_hrt.h" -#include "hive_isp_css_idle_signal_hrt.h" -#include "hive_isp_css_sp_hrt.h" -#include "hive_isp_css_isp_hrt.h" -#include "hive_isp_css_streaming_to_mipi_hrt.h" -#include "hive_isp_css_testbench_hrt.h" -#include "hive_isp_css_streaming_monitors_hrt.h" -#include "hive_isp_css_gp_regs_hrt.h" -#if defined(IS_ISP_2400_MAMOIADA_SYSTEM) -#include "hive_isp_css_irq_hrt.h" -#elif defined(IS_ISP_2401_MAMOIADA_SYSTEM) -#include "hive_isp_css_2401_irq_hrt.h" -#else -#error "hive_isp_css_hrt_modified.h: SYSTEM must be one of {2400_MAMOIADA_SYSTEM, 2401_MAMOIADA_SYSTEM}" -#endif - -#include "hive_isp_css_stream_switch_hrt.h" - -#include "hive_isp_css_ddr_hrt_modified.h" -#include "hive_isp_css_dma_set_hrt.h" - -#define HIVE_ISP_CSS_NO_STREAM_SWITCH 1 - -#endif /* _hive_isp_css_hrt_h */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/input_formatter_global.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/input_formatter_global.h index 5654d911db65..7558f4964313 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/input_formatter_global.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/input_formatter_global.h @@ -107,22 +107,6 @@ struct input_formatter_cfg_s { uint32_t block_no_reqs; }; -#define DEFAULT_IF_CONFIG \ -{ \ - 0, /* start_line */\ - 0, /* start_column */\ - 0, /* left_padding */\ - 0, /* cropped_height */\ - 0, /* cropped_width */\ - 0, /* deinterleaving */\ - 0, /*.buf_vecs */\ - 0, /* buf_start_index */\ - 0, /* buf_increment */\ - 0, /* buf_eol_offset */\ - false, /* is_yuv420_format */\ - false /* block_no_reqs */\ -} - extern const hrt_address HIVE_IF_SRST_ADDRESS[N_INPUT_FORMATTER_ID]; extern const hrt_data HIVE_IF_SRST_MASK[N_INPUT_FORMATTER_ID]; extern const uint8_t HIVE_IF_SWITCH_CODE[N_INPUT_FORMATTER_ID]; diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/resource_global.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/resource_global.h deleted file mode 100644 index 01c915c033a9..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/resource_global.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __RESOURCE_GLOBAL_H_INCLUDED__ -#define __RESOURCE_GLOBAL_H_INCLUDED__ - -#define IS_RESOURCE_VERSION_1 - -typedef enum { - DMA_CHANNEL_RESOURCE_TYPE, - IRQ_CHANNEL_RESOURCE_TYPE, - MEM_SECTION_RESOURCE_TYPE, - N_RESOURCE_TYPE -} resource_type_ID_t; - -typedef enum { - PERMANENT_RESOURCE_RESERVATION, - PERSISTENT_RESOURCE_RESERVATION, - DEDICTATED_RESOURCE_RESERVATION, - SHARED_RESOURCE_RESERVATION, - N_RESOURCE_RESERVATION -} resource_reservation_t; - -#endif /* __RESOURCE_GLOBAL_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/xmem_global.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/xmem_global.h deleted file mode 100644 index 1d3a43abe55d..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/xmem_global.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __XMEM_GLOBAL_H_INCLUDED__ -#define __XMEM_GLOBAL_H_INCLUDED__ - -#include "isp.h" - -#endif /* __XMEM_GLOBAL_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/bamem.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/bamem.h deleted file mode 100644 index 6928965cf513..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/bamem.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __BAMEM_H_INCLUDED__ -#define __BAMEM_H_INCLUDED__ - -/* - * This file is included on every cell {SP,ISP,host} and on every system - * that uses the BAMEM device. It defines the API to DLI bridge - * - * System and cell specific interfaces and inline code are included - * conditionally through Makefile path settings. - * - * - . system and cell agnostic interfaces, constants and identifiers - * - public: system agnostic, cell specific interfaces - * - private: system dependent, cell specific interfaces & inline implementations - * - global: system specific constants and identifiers - * - local: system and cell specific constants and identifiers - */ - - -#include "system_local.h" -#include "bamem_local.h" - -#ifndef __INLINE_BAMEM__ -#define STORAGE_CLASS_BAMEM_H extern -#define STORAGE_CLASS_BAMEM_C -#include "bamem_public.h" -#else /* __INLINE_BAMEM__ */ -#define STORAGE_CLASS_BAMEM_H static inline -#define STORAGE_CLASS_BAMEM_C static inline -#include "bamem_private.h" -#endif /* __INLINE_BAMEM__ */ - -#endif /* __BAMEM_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/bbb_config.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/bbb_config.h deleted file mode 100644 index 18bc5ef3d0bf..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/bbb_config.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __BBB_CONFIG_H_INCLUDED__ -#define __BBB_CONFIG_H_INCLUDED__ -/* This header contains BBB defines common to ISP and host */ - -#define BFA_MAX_KWAY (49) -#define BFA_RW_LUT_SIZE (7) - -#define SAD3x3_IN_SHIFT (2) /* input right shift value for SAD3x3 */ -#define SAD3x3_OUT_SHIFT (2) /* output right shift value for SAD3x3 */ - -/* XCU and BMA related defines shared between host and ISP - * also need to be moved here */ -#endif /* __BBB_CONFIG_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/cpu_mem_support.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/cpu_mem_support.h deleted file mode 100644 index 6d014fafb713..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/cpu_mem_support.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __CPU_MEM_SUPPORT_H_INCLUDED__ -#define __CPU_MEM_SUPPORT_H_INCLUDED__ - -#if defined (__KERNEL__) -#include <linux/string.h> /* memset */ -#else -#include <string.h> /* memset */ -#endif - -#include "sh_css_internal.h" /* sh_css_malloc and sh_css_free */ - -static inline void* -ia_css_cpu_mem_alloc(unsigned int size) -{ - return sh_css_malloc(size); -} - -static inline void* -ia_css_cpu_mem_copy(void* dst, const void* src, unsigned int size) -{ - if(!src || !dst) - return NULL; - - return memcpy(dst, src, size); -} - -static inline void* -ia_css_cpu_mem_set_zero(void* dst, unsigned int size) -{ - if(!dst) - return NULL; - - return memset(dst, 0, size); -} - -static inline void -ia_css_cpu_mem_free(void* ptr) -{ - if(!ptr) - return; - - sh_css_free(ptr); -} - -#endif /* __CPU_MEM_SUPPORT_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isp2400_config.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isp2400_config.h deleted file mode 100644 index ab3391716c82..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isp2400_config.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __ISP2400_CONFIG_H_INCLUDED__ -#define __ISP2400_CONFIG_H_INCLUDED__ - -#define NUM_BITS 14 -#define NUM_SLICE_ELEMS 4 -#define ROUNDMODE ROUND_NEAREST_EVEN -#define MAX_SHIFT_1W (NUM_BITS-1) /* Max number of bits a 1w input can be shifted */ -#define MAX_SHIFT_2W (2*NUM_BITS-1) /* Max number of bits a 2w input can be shifted */ - -#endif /* __ISP2400_CONFIG_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isp2500_config.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isp2500_config.h deleted file mode 100644 index 4fae856f5a23..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isp2500_config.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __ISP2500_CONFIG_H_INCLUDED__ -#define __ISP2500_CONFIG_H_INCLUDED__ - -#define NUM_BITS 12 -#define NUM_SLICE_ELEMS 4 -#define ROUNDMODE ROUND_NEAREST_EVEN -#define MAX_SHIFT_1W (NUM_BITS-1) /* Max number of bits a 1w input can be shifted */ -#define MAX_SHIFT_2W (2*NUM_BITS-1) /* Max number of bits a 2w input can be shifted */ - - -#define HAS_div_unit - -#define HAS_vec_sub - -#endif /* __ISP2500_CONFIG_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isp2600_config.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isp2600_config.h deleted file mode 100644 index 6086be8cb0d3..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isp2600_config.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __ISP2600_CONFIG_H_INCLUDED__ -#define __ISP2600_CONFIG_H_INCLUDED__ - - -#define NUM_BITS 16 - - -#define NUM_SLICE_ELEMS 8 -#define ROUNDMODE ROUND_NEAREST_EVEN -#define MAX_SHIFT_1W (NUM_BITS-1) /* Max number of bits a 1w input can be shifted */ -#define MAX_SHIFT_2W (2*NUM_BITS-1) /* Max number of bits a 2w input can be shifted */ -#define ISP_NWAY 32 /* Number of elements in a vector in ISP 2600 */ - -#define HAS_div_unit -#define HAS_1w_sqrt_u_unit -#define HAS_2w_sqrt_u_unit - -#define HAS_vec_sub - -#endif /* __ISP2600_CONFIG_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isp2601_config.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isp2601_config.h deleted file mode 100644 index beceefa24ca0..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isp2601_config.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef ISP2401 -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __ISP2601_CONFIG_H_INCLUDED__ -#define __ISP2601_CONFIG_H_INCLUDED__ - -#define NUM_BITS 16 -#define ISP_VEC_ELEMBITS NUM_BITS -#define ISP_NWAY 32 -#define NUM_SLICE_ELEMS 4 -#define ROUNDMODE ROUND_NEAREST_EVEN -#define MAX_SHIFT_1W (NUM_BITS-1) /* Max number of bits a 1w input can be shifted */ -#define MAX_SHIFT_2W (2*NUM_BITS-1) /* Max number of bits a 2w input can be shifted */ - -#define HAS_div_unit -#define HAS_bfa_unit -#define HAS_1w_sqrt_u_unit -#define HAS_2w_sqrt_u_unit - -#define HAS_vec_sub - -/* Bit widths and element widths defined in HW implementation of BFA */ -#define BFA_THRESHOLD_BIT_CNT (8) -#define BFA_THRESHOLD_MASK ((1<<BFA_THRESHOLD_BIT_CNT)-1) -#define BFA_SW_BIT_CNT (7) -#define BFA_SW_MASK ((1<<BFA_SW_BIT_CNT)-1) - -#define BFA_RW_BIT_CNT (7) -#define BFA_RW_MASK ((1<<BFA_RW_BIT_CNT)-1) -#define BFA_RW_SLOPE_BIT_POS (8) -#define BFA_RW_SLOPE_BIT_SHIFT (5) - -#define BFA_RW_IDX_BIT_CNT (3) -#define BFA_RW_FRAC_BIT_CNT (5) -#define BFA_RW_LUT0_FRAC_START_BIT (0) -#define BFA_RW_LUT0_FRAC_END_BIT (BFA_RW_LUT0_FRAC_START_BIT+BFA_RW_FRAC_BIT_CNT-1) /* 4 */ -#define BFA_RW_LUT1_FRAC_START_BIT (2) -#define BFA_RW_LUT1_FRAC_END_BIT (BFA_RW_LUT1_FRAC_START_BIT+BFA_RW_FRAC_BIT_CNT-1) /* 6 */ -/* LUT IDX end bit computation, start+idx_bit_cnt-2, one -1 comes as we count - * bits from 0, another -1 comes as we use 2 lut table, so idx_bit_cnt is one - * bit more */ -#define BFA_RW_LUT0_IDX_START_BIT (BFA_RW_LUT0_FRAC_END_BIT+1) /* 5 */ -#define BFA_RW_LUT0_IDX_END_BIT (BFA_RW_LUT0_IDX_START_BIT+BFA_RW_IDX_BIT_CNT-2) /* 6 */ -#define BFA_RW_LUT1_IDX_START_BIT (BFA_RW_LUT1_FRAC_END_BIT + 1) /* 7 */ -#define BFA_RW_LUT1_IDX_END_BIT (BFA_RW_LUT1_IDX_START_BIT+BFA_RW_IDX_BIT_CNT-2) /* 8 */ -#define BFA_RW_LUT_THRESHOLD (1<<(BFA_RW_LUT1_IDX_END_BIT-1)) /* 0x80 : next bit after lut1 end is set */ -#define BFA_RW_LUT1_IDX_OFFSET ((1<<(BFA_RW_IDX_BIT_CNT-1))-1) /* 3 */ - -#define BFA_CP_MASK (0xFFFFFF80) -#define BFA_SUBABS_SHIFT (6) -#define BFA_SUBABS_BIT_CNT (8) -#define BFA_SUBABS_MAX ((1<<BFA_SUBABS_BIT_CNT)-1) -#define BFA_SUBABSSAT_BIT_CNT (9) -#define BFA_SUBABSSAT_MAX ((1<<BFA_SUBABSSAT_BIT_CNT)-1) -#define BFA_WEIGHT_SHIFT (6) - -#endif /* __ISP2601_CONFIG_H_INCLUDED__ */ -#endif diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isp_config.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isp_config.h deleted file mode 100644 index 80506f2419a8..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isp_config.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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_CONFIG_H_INCLUDED__ -#define __ISP_CONFIG_H_INCLUDED__ - -#if defined(ISP2400) || defined(ISP2401) -#include "isp2400_config.h" -#else -#error "Please define a core {ISP2400, ISP2401}" -#endif - -#endif /* __ISP_CONFIG_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isp_op1w.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isp_op1w.h deleted file mode 100644 index 0d978e5911c0..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isp_op1w.h +++ /dev/null @@ -1,844 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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_OP1W_H_INCLUDED__ -#define __ISP_OP1W_H_INCLUDED__ - -/* - * This file is part of the Multi-precision vector operations exstension package. - */ - -/* - * Single-precision vector operations - */ - -/* - * Prerequisites: - * - */ - -#ifdef INLINE_ISP_OP1W -#define STORAGE_CLASS_ISP_OP1W_FUNC_H static inline -#define STORAGE_CLASS_ISP_OP1W_DATA_H static inline_DATA -#else /* INLINE_ISP_OP1W */ -#define STORAGE_CLASS_ISP_OP1W_FUNC_H extern -#define STORAGE_CLASS_ISP_OP1W_DATA_H extern_DATA -#endif /* INLINE_ISP_OP1W */ - -/* - * Single-precision data type specification - */ - -#include "isp_op1w_types.h" -#include "isp_op2w_types.h" // for doubling operations. - -/* - * Single-precision prototype specification - */ - -/* Arithmetic */ - -/* @brief bitwise AND - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return bitwise and of both input arguments - * - * This function will calculate the bitwise and. - * result = _a & _b - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_and( - const tvector1w _a, - const tvector1w _b); - -/* @brief bitwise OR - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return bitwise or of both input arguments - * - * This function will calculate the bitwise or. - * result = _a | _b - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_or( - const tvector1w _a, - const tvector1w _b); - -/* @brief bitwise XOR - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return bitwise xor of both input arguments - * - * This function will calculate the bitwise xor. - * result = _a ^ _b - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_xor( - const tvector1w _a, - const tvector1w _b); - -/* @brief bitwise inverse - * - * @param[in] _a first argument - * - * @return bitwise inverse of both input arguments - * - * This function will calculate the bitwise inverse. - * result = ~_a - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_inv( - const tvector1w _a); - -/* Additive */ - -/* @brief addition - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return sum of both input arguments - * - * This function will calculate the sum of the input arguments. - * in case of overflow it will wrap around. - * result = _a + _b - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_add( - const tvector1w _a, - const tvector1w _b); - -/* @brief subtraction - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return _b subtracted from _a. - * - * This function will subtract _b from _a. - * in case of overflow it will wrap around. - * result = _a - _b - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_sub( - const tvector1w _a, - const tvector1w _b); - -/* @brief saturated addition - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return saturated sum of both input arguments - * - * This function will calculate the sum of the input arguments. - * in case of overflow it will saturate. - * result = CLIP(_a + _b, MIN_RANGE, MAX_RANGE); - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_addsat( - const tvector1w _a, - const tvector1w _b); - -/* @brief saturated subtraction - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return saturated subtraction of both input arguments - * - * This function will subtract _b from _a. - * in case of overflow it will saturate. - * result = CLIP(_a - _b, MIN_RANGE, MAX_RANGE); - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_subsat( - const tvector1w _a, - const tvector1w _b); - -#ifdef ISP2401 -/* @brief Unsigned saturated subtraction - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return saturated subtraction of both input arguments - * - * This function will subtract _b from _a. - * in case of overflow it will saturate. - * result = CLIP(_a - _b, 0, MAX_RANGE); - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w_unsigned OP_1w_subsat_u( - const tvector1w_unsigned _a, - const tvector1w_unsigned _b); - -#endif -/* @brief subtraction with shift right and rounding - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return (a - b) >> 1 - * - * This function subtracts _b from _a and right shifts - * the result by 1 bit with rounding. - * No overflow can occur. - * result = (_a - _b) >> 1 - * - * Note: This function will be deprecated due to - * the naming confusion and it will be replaced - * by "OP_1w_subhalfrnd". - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_subasr1( - const tvector1w _a, - const tvector1w _b); - -/* @brief Subtraction with shift right and rounding - * - * @param[in] _a first operand - * @param[in] _b second operand - * - * @return (_a - _b) >> 1 - * - * This function subtracts _b from _a and right shifts - * the result by 1 bit with rounding. - * No overflow can occur. - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_subhalfrnd( - const tvector1w _a, - const tvector1w _b); - -/* @brief Subtraction with shift right and no rounding - * - * @param[in] _a first operand - * @param[in] _b second operand - * - * @return (_a - _b) >> 1 - * - * This function subtracts _b from _a and right shifts - * the result by 1 bit without rounding (i.e. truncation). - * No overflow can occur. - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_subhalf( - const tvector1w _a, - const tvector1w _b); - - -/* @brief saturated absolute value - * - * @param[in] _a input - * - * @return saturated absolute value of the input - * - * This function will calculate the saturated absolute value of the input. - * in case of overflow it will saturate. - * if (_a > 0) return _a;<br> - * else return CLIP(-_a, MIN_RANGE, MAX_RANGE);<br> - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_abs( - const tvector1w _a); - -/* @brief saturated absolute difference - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return sat(abs(a-b)); - * - * This function will calculate the saturated absolute value - * of the saturated difference of both inputs. - * result = sat(abs(sat(_a - _b))); - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_subabssat( - const tvector1w _a, - const tvector1w _b); - -/* Multiplicative */ - -/* @brief doubling multiply - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return product of _a and _b - * - * This function will calculate the product - * of the input arguments and returns a double - * precision result. - * No overflow can occur. - * result = _a * _b; - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector2w OP_1w_muld( - const tvector1w _a, - const tvector1w _b); - -/* @brief integer multiply - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return product of _a and _b - * - * This function will calculate the product - * of the input arguments and returns the LSB - * aligned single precision result. - * In case of overflow it will wrap around. - * result = _a * _b; - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_mul( - const tvector1w _a, - const tvector1w _b); - -/* @brief fractional saturating multiply - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return saturated product of _a and _b - * - * This function will calculate the fixed point - * product of the input arguments - * and returns a single precision result. - * In case of overflow it will saturate. - * FP_UNITY * FP_UNITY => FP_UNITY. - * result = CLIP(_a * _b >> (NUM_BITS-1), MIN_RANGE, MAX_RANGE); - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_qmul( - const tvector1w _a, - const tvector1w _b); - -/* @brief fractional saturating multiply with rounding - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return product of _a and _b - * - * This function will calculate the fixed point - * product of the input arguments - * and returns a single precision result. - * FP_UNITY * FP_UNITY => FP_UNITY. - * Depending on the rounding mode of the core - * it will round to nearest or to nearest even. - * result = CLIP(_a * _b >> (NUM_BITS-1), MIN_RANGE, MAX_RANGE); - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_qrmul( - const tvector1w _a, - const tvector1w _b); - -/* Comparative */ - -/* @brief equal - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return _a == _b - * - * This function will return true if both inputs - * are equal, and false if not equal. - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tflags OP_1w_eq( - const tvector1w _a, - const tvector1w _b); - -/* @brief not equal - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return _a != _b - * - * This function will return false if both inputs - * are equal, and true if not equal. - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tflags OP_1w_ne( - const tvector1w _a, - const tvector1w _b); - -/* @brief less or equal - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return _a <= _b - * - * This function will return true if _a is smaller - * or equal than _b. - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tflags OP_1w_le( - const tvector1w _a, - const tvector1w _b); - -/* @brief less then - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return _a < _b - * - * This function will return true if _a is smaller - * than _b. - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tflags OP_1w_lt( - const tvector1w _a, - const tvector1w _b); - -/* @brief greater or equal - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return _a >= _b - * - * This function will return true if _a is greater - * or equal than _b. - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tflags OP_1w_ge( - const tvector1w _a, - const tvector1w _b); - -/* @brief greater than - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return _a > _b - * - * This function will return true if _a is greater - * than _b. - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tflags OP_1w_gt( - const tvector1w _a, - const tvector1w _b); - -/* Shift */ - -/* @brief aritmetic shift right - * - * @param[in] _a input - * @param[in] _b shift amount - * - * @return _a >> _b - * - * This function will shift _a with _b bits to the right, - * preserving the sign bit. - * It asserts 0 <= _b <= MAX_SHIFT_1W. - * - * The operation count for this function assumes that - * the shift amount is a cloned scalar input. - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_asr( - const tvector1w _a, - const tvector1w _b); - -/* @brief aritmetic shift right with rounding - * - * @param[in] _a input - * @param[in] _b shift amount - * - * @return _a >> _b - * - * If _b < NUM_BITS, this function will shift _a with _b bits to the right, - * preserving the sign bit, and depending on the rounding mode of the core - * it will round to nearest or to nearest even. - * If _b >= NUM_BITS, this function will return 0. - * It asserts 0 <= _b <= MAX_SHIFT_1W. - * The operation count for this function assumes that - * the shift amount is a cloned scalar input. - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_asrrnd( - const tvector1w _a, - const tvector1w _b); - -/* @brief saturating arithmetic shift left - * - * @param[in] _a input - * @param[in] _b shift amount - * - * @return _a << _b - * - * If _b < MAX_BITDEPTH, this function will shift _a with _b bits to the left, - * saturating at MIN_RANGE/MAX_RANGE in case of overflow. - * If _b >= MAX_BITDEPTH, this function will return MIN_RANGE if _a < 0, - * MAX_RANGE if _a > 0, 0 if _a == 0. - * (with MAX_BITDEPTH=64) - * It asserts 0 <= _b <= MAX_SHIFT_1W. - * The operation count for this function assumes that - * the shift amount is a cloned scalar input. - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_asl( - const tvector1w _a, - const tvector1w _b); - -/* @brief saturating aritmetic shift left - * - * @param[in] _a input - * @param[in] _b shift amount - * - * @return _a << _b - * - * This function is identical to OP_1w_asl( ) - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_aslsat( - const tvector1w _a, - const tvector1w _b); - -/* @brief logical shift left - * - * @param[in] _a input - * @param[in] _b shift amount - * - * @return _a << _b - * - * This function will shift _a with _b bits to the left. - * It will insert zeroes on the right. - * It asserts 0 <= _b <= MAX_SHIFT_1W. - * The operation count for this function assumes that - * the shift amount is a cloned scalar input. - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_lsl( - const tvector1w _a, - const tvector1w _b); - -/* @brief logical shift right - * - * @param[in] _a input - * @param[in] _b shift amount - * - * @return _a >> _b - * - * This function will shift _a with _b bits to the right. - * It will insert zeroes on the left. - * It asserts 0 <= _b <= MAX_SHIFT_1W. - * The operation count for this function assumes that - * the shift amount is a cloned scalar input. - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_lsr( - const tvector1w _a, - const tvector1w _b); - -#ifdef ISP2401 -/* @brief bidirectional saturating arithmetic shift - * - * @param[in] _a input - * @param[in] _b shift amount - * - * @return _a << |_b| if _b is positive - * _a >> |_b| if _b is negative - * - * If _b > 0, this function will shift _a with _b bits to the left, - * saturating at MIN_RANGE/MAX_RANGE in case of overflow. - * if _b < 0, this function will shift _a with _b bits to the right. - * It asserts -MAX_SHIFT_1W <= _b <= MAX_SHIFT_1W. - * If _b = 0, it returns _a. - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_ashift_sat( - const tvector1w _a, - const tvector1w _b); - -/* @brief bidirectional non-saturating arithmetic shift - * - * @param[in] _a input - * @param[in] _b shift amount - * - * @return _a << |_b| if _b is positive - * _a >> |_b| if _b is negative - * - * If _b > 0, this function will shift _a with _b bits to the left, - * no saturation is performed in case of overflow. - * if _b < 0, this function will shift _a with _b bits to the right. - * It asserts -MAX_SHIFT_1W <= _b <= MAX_SHIFT_1W. - * If _b = 0, it returns _a. - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_ashift( - const tvector1w _a, - const tvector1w _b); - - -/* @brief bidirectional logical shift - * - * @param[in] _a input - * @param[in] _b shift amount - * - * @return _a << |_b| if _b is positive - * _a >> |_b| if _b is negative - * - * This function will shift _a with _b bits to the left if _b is positive. - * This function will shift _a with _b bits to the right if _b is negative. - * It asserts -MAX_SHIFT_1W <= _b <= MAX_SHIFT_1W. - * It inserts zeros on the left or right depending on the shift direction: - * right or left. - * The operation count for this function assumes that - * the shift amount is a cloned scalar input. - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_lshift( - const tvector1w _a, - const tvector1w _b); - -#endif -/* Cast */ - -/* @brief Cast from int to 1w - * - * @param[in] _a input - * - * @return _a - * - * This function casts the input from integer type to - * single precision. It asserts there is no overflow. - * - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_int_cast_to_1w( - const int _a); - -/* @brief Cast from 1w to int - * - * @param[in] _a input - * - * @return _a - * - * This function casts the input from single precision type to - * integer, preserving value and sign. - * - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H int OP_1w_cast_to_int( - const tvector1w _a); - -/* @brief Cast from 1w to 2w - * - * @param[in] _a input - * - * @return _a - * - * This function casts the input from single precision type to - * double precision, preserving value and sign. - * - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector2w OP_1w_cast_to_2w( - const tvector1w _a); - -/* @brief Cast from 2w to 1w - * - * @param[in] _a input - * - * @return _a - * - * This function casts the input from double precision type to - * single precision. In case of overflow it will wrap around. - * - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_2w_cast_to_1w( - const tvector2w _a); - - -/* @brief Cast from 2w to 1w with saturation - * - * @param[in] _a input - * - * @return _a - * - * This function casts the input from double precision type to - * single precision after saturating it to the range of single - * precision. - * - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_2w_sat_cast_to_1w( - const tvector2w _a); - -/* clipping */ - -/* @brief Clip asymmetrical - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return _a clipped between ~_b and b - * - * This function will clip the first argument between - * (-_b - 1) and _b. - * It asserts _b >= 0. - * - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_clip_asym( - const tvector1w _a, - const tvector1w _b); - -/* @brief Clip zero - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return _a clipped beteween 0 and _b - * - * This function will clip the first argument between - * zero and _b. - * It asserts _b >= 0. - * - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_clipz( - const tvector1w _a, - const tvector1w _b); - -/* division */ - -/* @brief Truncated division - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return trunc( _a / _b ) - * - * This function will divide the first argument by - * the second argument, with rounding toward 0. - * If _b == 0 and _a < 0, the function will return MIN_RANGE. - * If _b == 0 and _a == 0, the function will return 0. - * If _b == 0 and _a > 0, the function will return MAX_RANGE. - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_div( - const tvector1w _a, - const tvector1w _b); - -/* @brief Fractional saturating divide - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return _a / _b - * - * This function will perform fixed point division of - * the first argument by the second argument, with rounding toward 0. - * In case of overflow it will saturate. - * If _b == 0 and _a < 0, the function will return MIN_RANGE. - * If _b == 0 and _a == 0, the function will return 0. - * If _b == 0 and _a > 0, the function will return MAX_RANGE. - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_qdiv( - const tvector1w _a, - const tvector1w _b); - -/* @brief Modulo - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return _a % _b - * - * This function will return the remainder r = _a - _b * trunc( _a / _b ), - * Note that the sign of the remainder is always equal to the sign of _a. - * If _b == 0 the function will return _a. - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_mod( - const tvector1w _a, - const tvector1w _b); - -/* @brief Unsigned integer Square root - * - * @param[in] _a input - * - * @return Integer square root of _a - * - * This function will calculate the Integer square root of _a - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w_unsigned OP_1w_sqrt_u( - const tvector1w_unsigned _a); - -/* Miscellaneous */ - -/* @brief Multiplexer - * - * @param[in] _a first argument - * @param[in] _b second argument - * @param[in] _c condition - * - * @return _c ? _a : _b - * - * This function will return _a if the condition _c - * is true and _b otherwise. - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_mux( - const tvector1w _a, - const tvector1w _b, - const tflags _c); - -/* @brief Average without rounding - * - * @param[in] _a first operand - * @param[in] _b second operand - * - * @return (_a + _b) >> 1 - * - * This function will add _a and _b, and right shift - * the result by one without rounding. No overflow - * will occur because addition is performed in the - * proper precision. - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_avg( - const tvector1w _a, - const tvector1w _b); - -/* @brief Average with rounding - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return (_a + _b) >> 1 - * - * This function will add _a and _b at full precision, - * and right shift with rounding the result with 1 bit. - * Depending on the rounding mode of the core - * it will round to nearest or to nearest even. - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_avgrnd( - const tvector1w _a, - const tvector1w _b); - -/* @brief Minimum - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return (_a < _b) ? _a : _b; - * - * This function will return the smallest of both - * input arguments. - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_min( - const tvector1w _a, - const tvector1w _b); - -/* @brief Maximum - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return (_a > _b) ? _a : _b; - * - * This function will return the largest of both - * input arguments. - */ -STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_max( - const tvector1w _a, - const tvector1w _b); - -#ifndef INLINE_ISP_OP1W -#define STORAGE_CLASS_ISP_OP1W_FUNC_C -#define STORAGE_CLASS_ISP_OP1W_DATA_C const -#else /* INLINE_ISP_OP1W */ -#define STORAGE_CLASS_ISP_OP1W_FUNC_C STORAGE_CLASS_ISP_OP1W_FUNC_H -#define STORAGE_CLASS_ISP_OP1W_DATA_C STORAGE_CLASS_ISP_OP1W_DATA_H -#include "isp_op1w.c" -#define ISP_OP1W_INLINED -#endif /* INLINE_ISP_OP1W */ - -#endif /* __ISP_OP1W_H_INCLUDED__ */ - diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isp_op1w_types.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isp_op1w_types.h deleted file mode 100644 index c81e587509a1..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isp_op1w_types.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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_OP1W_TYPES_H_INCLUDED__ -#define __ISP_OP1W_TYPES_H_INCLUDED__ - -/* - * This file is part of the Multi-precision vector operations exstension package. - */ - -/* - * Single-precision vector operations - */ - -/* - * Prerequisites: - * - */ - -#include "mpmath.h" - -/* - * Single-precision data type specification - */ - - -typedef mpsdata_t tvector1w; -typedef mpsdata_t tscalar1w; -typedef spsdata_t tflags; -typedef mpudata_t tvector1w_unsigned; -typedef mpsdata_t tscalar1w_weight; -typedef mpsdata_t tvector1w_signed_positive; -typedef mpsdata_t tvector1w_weight; -#ifdef ISP2401 -typedef bool tscalar_bool; -#endif - -typedef struct { - tvector1w d; - tflags f; -} tvector1w_tflags1w; - -#endif /* __ISP_OP1W_TYPES_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isp_op2w.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isp_op2w.h deleted file mode 100644 index 7575d260b837..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isp_op2w.h +++ /dev/null @@ -1,674 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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_OP2W_H_INCLUDED__ -#define __ISP_OP2W_H_INCLUDED__ - -/* - * This file is part of the Multi-precision vector operations exstension package. - */ - -/* - * Double-precision vector operations - */ - -/* - * Prerequisites: - * - */ - -#ifdef INLINE_ISP_OP2W -#define STORAGE_CLASS_ISP_OP2W_FUNC_H static inline -#define STORAGE_CLASS_ISP_OP2W_DATA_H static inline_DATA -#else /* INLINE_ISP_OP2W */ -#define STORAGE_CLASS_ISP_OP2W_FUNC_H extern -#define STORAGE_CLASS_ISP_OP2W_DATA_H extern_DATA -#endif /* INLINE_ISP_OP2W */ - -/* - * Double-precision data type specification - */ - -#include "isp_op2w_types.h" - -/* - * Double-precision prototype specification - */ - -/* Arithmetic */ - -/* @brief bitwise AND - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return bitwise and of both input arguments - * - * This function will calculate the bitwise and. - * result = _a & _b - */ -STORAGE_CLASS_ISP_OP2W_FUNC_H tvector2w OP_2w_and( - const tvector2w _a, - const tvector2w _b); - -/* @brief bitwise OR - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return bitwise or of both input arguments - * - * This function will calculate the bitwise or. - * result = _a | _b - */ -STORAGE_CLASS_ISP_OP2W_FUNC_H tvector2w OP_2w_or( - const tvector2w _a, - const tvector2w _b); - -/* @brief bitwise XOR - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return bitwise xor of both input arguments - * - * This function will calculate the bitwise xor. - * result = _a ^ _b - */ -STORAGE_CLASS_ISP_OP2W_FUNC_H tvector2w OP_2w_xor( - const tvector2w _a, - const tvector2w _b); - -/* @brief bitwise inverse - * - * @param[in] _a first argument - * - * @return bitwise inverse of both input arguments - * - * This function will calculate the bitwise inverse. - * result = ~_a - */ -STORAGE_CLASS_ISP_OP2W_FUNC_H tvector2w OP_2w_inv( - const tvector2w _a); - -/* Additive */ - -/* @brief addition - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return sum of both input arguments - * - * This function will calculate the sum of the input arguments. - * in case of overflow it will wrap around. - * result = _a + _b - */ -STORAGE_CLASS_ISP_OP2W_FUNC_H tvector2w OP_2w_add( - const tvector2w _a, - const tvector2w _b); - -/* @brief subtraction - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return _b subtracted from _a. - * - * This function will subtract _b from _a. - * in case of overflow it will wrap around. - * result = _a - _b - */ -STORAGE_CLASS_ISP_OP2W_FUNC_H tvector2w OP_2w_sub( - const tvector2w _a, - const tvector2w _b); - -/* @brief saturated addition - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return saturated sum of both input arguments - * - * This function will calculate the sum of the input arguments. - * in case of overflow it will saturate - * result = CLIP(_a + _b, MIN_RANGE, MAX_RANGE); - */ -STORAGE_CLASS_ISP_OP2W_FUNC_H tvector2w OP_2w_addsat( - const tvector2w _a, - const tvector2w _b); - -/* @brief saturated subtraction - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return saturated subtraction of both input arguments - * - * This function will subtract _b from _a. - * in case of overflow it will saturate - * result = CLIP(_a - _b, MIN_RANGE, MAX_RANGE); - */ -STORAGE_CLASS_ISP_OP2W_FUNC_H tvector2w OP_2w_subsat( - const tvector2w _a, - const tvector2w _b); - -/* @brief subtraction with shift right and rounding - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return (a - b) >> 1 - * - * This function subtracts _b from _a and right shifts - * the result by 1 bit with rounding. - * No overflow can occur. - * result = (_a - _b) >> 1 - * - * Note: This function will be deprecated due to - * the naming confusion and it will be replaced - * by "OP_2w_subhalfrnd". - */ -STORAGE_CLASS_ISP_OP2W_FUNC_H tvector2w OP_2w_subasr1( - const tvector2w _a, - const tvector2w _b); - -/* @brief Subtraction with shift right and rounding - * - * @param[in] _a first operand - * @param[in] _b second operand - * - * @return (_a - _b) >> 1 - * - * This function subtracts _b from _a and right shifts - * the result by 1 bit with rounding. - * No overflow can occur. - */ -STORAGE_CLASS_ISP_OP2W_FUNC_H tvector2w OP_2w_subhalfrnd( - const tvector2w _a, - const tvector2w _b); - -/* @brief Subtraction with shift right and no rounding - * - * @param[in] _a first operand - * @param[in] _b second operand - * - * @return (_a - _b) >> 1 - * - * This function subtracts _b from _a and right shifts - * the result by 1 bit without rounding (i.e. truncation). - * No overflow can occur. - */ -STORAGE_CLASS_ISP_OP2W_FUNC_H tvector2w OP_2w_subhalf( - const tvector2w _a, - const tvector2w _b); - -/* @brief saturated absolute value - * - * @param[in] _a input - * - * @return saturated absolute value of the input - * - * This function will calculate the saturated absolute value of the input. - * In case of overflow it will saturate. - * if (_a > 0) return _a;<br> - * else return CLIP(-_a, MIN_RANGE, MAX_RANGE);<br> - */ -STORAGE_CLASS_ISP_OP2W_FUNC_H tvector2w OP_2w_abs( - const tvector2w _a); - -/* @brief saturated absolute difference - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return sat(abs(sat(a-b))); - * - * This function will calculate the saturated absolute value - * of the saturated difference of both inputs. - * result = sat(abs(sat(_a - _b))); - */ -STORAGE_CLASS_ISP_OP2W_FUNC_H tvector2w OP_2w_subabssat( - const tvector2w _a, - const tvector2w _b); - -/* Multiplicative */ - -/* @brief integer multiply - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return product of _a and _b - * - * This function will calculate the product - * of the input arguments and returns the LSB - * aligned double precision result. - * In case of overflow it will wrap around. - * result = _a * _b; - */ -STORAGE_CLASS_ISP_OP2W_FUNC_H tvector2w OP_2w_mul( - const tvector2w _a, - const tvector2w _b); - -/* @brief fractional saturating multiply - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return saturated product of _a and _b - * - * This function will calculate the fixed point - * product of the input arguments - * and returns a double precision result. - * In case of overflow it will saturate. - * result =((_a * _b) << 1) >> (2*NUM_BITS); - */ -STORAGE_CLASS_ISP_OP2W_FUNC_H tvector2w OP_2w_qmul( - const tvector2w _a, - const tvector2w _b); - -/* @brief fractional saturating multiply with rounding - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return product of _a and _b - * - * This function will calculate the fixed point - * product of the input arguments - * and returns a double precision result. - * Depending on the rounding mode of the core - * it will round to nearest or to nearest even. - * In case of overflow it will saturate. - * result = ((_a * _b) << 1) >> (2*NUM_BITS); - */ - -STORAGE_CLASS_ISP_OP2W_FUNC_H tvector2w OP_2w_qrmul( - const tvector2w _a, - const tvector2w _b); - -/* Comparative */ - -/* @brief equal - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return _a == _b - * - * This function will return true if both inputs - * are equal, and false if not equal. - */ -STORAGE_CLASS_ISP_OP2W_FUNC_H tflags OP_2w_eq( - const tvector2w _a, - const tvector2w _b); - -/* @brief not equal - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return _a != _b - * - * This function will return false if both inputs - * are equal, and true if not equal. - */ -STORAGE_CLASS_ISP_OP2W_FUNC_H tflags OP_2w_ne( - const tvector2w _a, - const tvector2w _b); - -/* @brief less or equal - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return _a <= _b - * - * This function will return true if _a is smaller - * or equal than _b. - */ -STORAGE_CLASS_ISP_OP2W_FUNC_H tflags OP_2w_le( - const tvector2w _a, - const tvector2w _b); - -/* @brief less then - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return _a < _b - * - * This function will return true if _a is smaller - * than _b. - */ -STORAGE_CLASS_ISP_OP2W_FUNC_H tflags OP_2w_lt( - const tvector2w _a, - const tvector2w _b); - -/* @brief greater or equal - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return _a >= _b - * - * This function will return true if _a is greater - * or equal than _b. - */ -STORAGE_CLASS_ISP_OP2W_FUNC_H tflags OP_2w_ge( - const tvector2w _a, - const tvector2w _b); - -/* @brief greater than - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return _a > _b - * - * This function will return true if _a is greater - * than _b. - */ -STORAGE_CLASS_ISP_OP2W_FUNC_H tflags OP_2w_gt( - const tvector2w _a, - const tvector2w _b); - -/* Shift */ - -/* @brief aritmetic shift right - * - * @param[in] _a input - * @param[in] _b shift amount - * - * @return _a >> _b - * - * This function will shift _a with _b bits to the right, - * preserving the sign bit. - * It asserts 0 <= _b <= MAX_SHIFT_2W. - * The operation count for this function assumes that - * the shift amount is a cloned scalar input. - */ -STORAGE_CLASS_ISP_OP2W_FUNC_H tvector2w OP_2w_asr( - const tvector2w _a, - const tvector2w _b); - -/* @brief aritmetic shift right with rounding - * - * @param[in] _a input - * @param[in] _b shift amount - * - * @return _a >> _b - * - * If _b < 2*NUM_BITS, this function will shift _a with _b bits to the right, - * preserving the sign bit, and depending on the rounding mode of the core - * it will round to nearest or to nearest even. - * If _b >= 2*NUM_BITS, this function will return 0. - * It asserts 0 <= _b <= MAX_SHIFT_2W. - * The operation count for this function assumes that - * the shift amount is a cloned scalar input. - */ -STORAGE_CLASS_ISP_OP2W_FUNC_H tvector2w OP_2w_asrrnd( - const tvector2w _a, - const tvector2w _b); - -/* @brief saturating aritmetic shift left - * - * @param[in] _a input - * @param[in] _b shift amount - * - * @return _a << _b - * - * If _b < MAX_BITDEPTH, this function will shift _a with _b bits to the left, - * saturating at MIN_RANGE/MAX_RANGE in case of overflow. - * If _b >= MAX_BITDEPTH, this function will return MIN_RANGE if _a < 0, - * MAX_RANGE if _a > 0, 0 if _a == 0. - * (with MAX_BITDEPTH=64) - * It asserts 0 <= _b <= MAX_SHIFT_2W. - * The operation count for this function assumes that - * the shift amount is a cloned scalar input. - */ -STORAGE_CLASS_ISP_OP2W_FUNC_H tvector2w OP_2w_asl( - const tvector2w _a, - const tvector2w _b); - -/* @brief saturating aritmetic shift left - * - * @param[in] _a input - * @param[in] _b shift amount - * - * @return _a << _b - * - * This function is identical to OP_2w_asl( ) - */ -STORAGE_CLASS_ISP_OP2W_FUNC_H tvector2w OP_2w_aslsat( - const tvector2w _a, - const tvector2w _b); - -/* @brief logical shift left - * - * @param[in] _a input - * @param[in] _b shift amount - * - * @return _a << _b - * - * This function will shift _a with _b bits to the left. - * It will insert zeroes on the right. - * It asserts 0 <= _b <= MAX_SHIFT_2W. - * The operation count for this function assumes that - * the shift amount is a cloned scalar input. - */ -STORAGE_CLASS_ISP_OP2W_FUNC_H tvector2w OP_2w_lsl( - const tvector2w _a, - const tvector2w _b); - -/* @brief logical shift right - * - * @param[in] _a input - * @param[in] _b shift amount - * - * @return _a >> _b - * - * This function will shift _a with _b bits to the right. - * It will insert zeroes on the left. - * It asserts 0 <= _b <= MAX_SHIFT_2W. - * The operation count for this function assumes that - * the shift amount is a cloned scalar input. - */ -STORAGE_CLASS_ISP_OP2W_FUNC_H tvector2w OP_2w_lsr( - const tvector2w _a, - const tvector2w _b); - -/* clipping */ - -/* @brief Clip asymmetrical - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return _a clipped between ~_b and b - * - * This function will clip the first argument between - * (-_b - 1) and _b. - * It asserts _b >= 0. - */ -STORAGE_CLASS_ISP_OP2W_FUNC_H tvector2w OP_2w_clip_asym( - const tvector2w _a, - const tvector2w _b); - -/* @brief Clip zero - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return _a clipped beteween 0 and _b - * - * This function will clip the first argument between - * zero and _b. - * It asserts _b >= 0. - */ -STORAGE_CLASS_ISP_OP2W_FUNC_H tvector2w OP_2w_clipz( - const tvector2w _a, - const tvector2w _b); - -/* division */ - -/* @brief Truncated division - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return trunc( _a / _b ) - * - * This function will divide the first argument by - * the second argument, with rounding toward 0. - * If _b == 0 and _a < 0, the function will return MIN_RANGE. - * If _b == 0 and _a == 0, the function will return 0. - * If _b == 0 and _a > 0, the function will return MAX_RANGE. - */ -STORAGE_CLASS_ISP_OP2W_FUNC_H tvector2w OP_2w_div( - const tvector2w _a, - const tvector2w _b); - -/* @brief Saturating truncated division - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return CLIP( trunc( _a / _b ), MIN_RANGE1w, MAX_RANGE1w ) - * - * This function will divide the first argument by - * the second argument, with rounding toward 0, and - * saturate the result to the range of single precision. - * If _b == 0 and _a < 0, the function will return MIN_RANGE. - * If _b == 0 and _a == 0, the function will return 0. - * If _b == 0 and _a > 0, the function will return MAX_RANGE. - */ -STORAGE_CLASS_ISP_OP2W_FUNC_H tvector1w OP_2w_divh( - const tvector2w _a, - const tvector1w _b); - -/* @brief Modulo - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return n/a - * - * This function has not yet been implemented. - */ -STORAGE_CLASS_ISP_OP2W_FUNC_H tvector2w OP_2w_mod( - const tvector2w _a, - const tvector2w _b); - -/* @brief Unsigned Integer Square root - * - * @param[in] _a input - * - * @return square root of _a - * - * This function will calculate the unsigned integer square root of _a - */ -STORAGE_CLASS_ISP_OP2W_FUNC_H tvector1w_unsigned OP_2w_sqrt_u( - const tvector2w_unsigned _a); - -/* Miscellaneous */ - -/* @brief Multiplexer - * - * @param[in] _a first argument - * @param[in] _b second argument - * @param[in] _c condition - * - * @return _c ? _a : _b - * - * This function will return _a if the condition _c - * is true and _b otherwise. - */ -STORAGE_CLASS_ISP_OP2W_FUNC_H tvector2w OP_2w_mux( - const tvector2w _a, - const tvector2w _b, - const tflags _c); - -/* @brief Average without rounding - * - * @param[in] _a first operand - * @param[in] _b second operand - * - * @return (_a + _b) >> 1 - * - * This function will add _a and _b, and right shift - * the result by one without rounding. No overflow - * will occur because addition is performed in the - * proper precision. - */ -STORAGE_CLASS_ISP_OP2W_FUNC_H tvector2w OP_2w_avg( - const tvector2w _a, - const tvector2w _b); - -/* @brief Average with rounding - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return (_a + _b) >> 1 - * - * This function will add _a and _b at full precision, - * and right shift with rounding the result with 1 bit. - * Depending on the rounding mode of the core - * it will round to nearest or to nearest even. - */ -STORAGE_CLASS_ISP_OP2W_FUNC_H tvector2w OP_2w_avgrnd( - const tvector2w _a, - const tvector2w _b); - -/* @brief Minimum - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return (_a < _b) ? _a : _b; - * - * This function will return the smallest of both - * input arguments. - */ -STORAGE_CLASS_ISP_OP2W_FUNC_H tvector2w OP_2w_min( - const tvector2w _a, - const tvector2w _b); - -/* @brief Maximum - * - * @param[in] _a first argument - * @param[in] _b second argument - * - * @return (_a > _b) ? _a : _b; - * - * This function will return the largest of both - * input arguments. - */ -STORAGE_CLASS_ISP_OP2W_FUNC_H tvector2w OP_2w_max( - const tvector2w _a, - const tvector2w _b); - -#ifndef INLINE_ISP_OP2W -#define STORAGE_CLASS_ISP_OP2W_FUNC_C -#define STORAGE_CLASS_ISP_OP2W_DATA_C const -#else /* INLINE_ISP_OP2W */ -#define STORAGE_CLASS_ISP_OP2W_FUNC_C STORAGE_CLASS_ISP_OP2W_FUNC_H -#define STORAGE_CLASS_ISP_OP2W_DATA_C STORAGE_CLASS_ISP_OP2W_DATA_H -#include "isp_op2w.c" -#define ISP_OP2W_INLINED -#endif /* INLINE_ISP_OP2W */ - -#endif /* __ISP_OP2W_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isp_op2w_types.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isp_op2w_types.h deleted file mode 100644 index 7e86083a8a33..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isp_op2w_types.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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_OP2W_TYPES_H_INCLUDED__ -#define __ISP_OP2W_TYPES_H_INCLUDED__ - -/* - * This file is part of the Multi-precision vector operations exstension package. - */ - -/* - * Double-precision vector operations - */ - -/* - * Prerequisites: - * - */ -#include "mpmath.h" -#include "isp_op1w_types.h" - -/* - * Single-precision data type specification - */ - - -typedef mpsdata_t tvector2w; -typedef mpsdata_t tscalar2w; -typedef mpsdata_t tvector2w_signed_positive; -typedef mpudata_t tvector2w_unsigned; - - -typedef struct { - tvector2w d; - tflags f; -} tvector2w_tflags; - -#endif /* __ISP_OP2W_TYPES_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isp_op_count.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isp_op_count.h deleted file mode 100644 index 8e7b48d026b0..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isp_op_count.h +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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_OP_COUNT_H_INCLUDED__ -#define __ISP_OP_COUNT_H_INCLUDED__ - -#include <stdio.h> - -typedef struct { - long long bbb_cnt; /* number of bbb */ - int bbb_op; /* operations per bbb */ - long long total_cnt; /* bbb_cnt * bbb_op */ -} bbb_stat_t; - -typedef enum { - bbb_func_OP_1w_and, - bbb_func_OP_1w_or, - bbb_func_OP_1w_xor, - bbb_func_OP_1w_inv, - bbb_func_OP_1w_add, - bbb_func_OP_1w_sub, - bbb_func_OP_1w_addsat, - bbb_func_OP_1w_subsat, - bbb_func_OP_1w_subasr1, - bbb_func_OP_1w_subhalf, - bbb_func_OP_1w_subhalfrnd, - bbb_func_OP_1w_abs, - bbb_func_OP_1w_subabssat, -#ifdef ISP2401 - bbb_func_OP_1w_subsat_u, -#endif - bbb_func_OP_1w_muld, - bbb_func_OP_1w_mul, - bbb_func_OP_1w_qmul, - bbb_func_OP_1w_qrmul, - bbb_func_OP_1w_eq, - bbb_func_OP_1w_ne, - bbb_func_OP_1w_le, - bbb_func_OP_1w_lt, - bbb_func_OP_1w_ge, - bbb_func_OP_1w_gt, - bbb_func_OP_1w_asr, - bbb_func_OP_1w_asrrnd, - bbb_func_OP_1w_asl, - bbb_func_OP_1w_aslsat, - bbb_func_OP_1w_lsl, - bbb_func_OP_1w_lsr, -#ifdef ISP2401 - bbb_func_OP_1w_ashift, - bbb_func_OP_1w_lshift, -#endif - bbb_func_OP_int_cast_to_1w , - bbb_func_OP_1w_cast_to_int , - bbb_func_OP_1w_cast_to_2w , - bbb_func_OP_2w_cast_to_1w , - bbb_func_OP_2w_sat_cast_to_1w , - bbb_func_OP_1w_clip_asym, - bbb_func_OP_1w_clipz, - bbb_func_OP_1w_div, - bbb_func_OP_1w_qdiv, - bbb_func_OP_1w_mod, - bbb_func_OP_1w_sqrt_u, - bbb_func_OP_1w_mux, - bbb_func_OP_1w_avg, - bbb_func_OP_1w_avgrnd, - bbb_func_OP_1w_min, - bbb_func_OP_1w_max, - bbb_func_OP_2w_and, - bbb_func_OP_2w_or, - bbb_func_OP_2w_xor, - bbb_func_OP_2w_inv, - bbb_func_OP_2w_add, - bbb_func_OP_2w_sub, - bbb_func_OP_2w_addsat, - bbb_func_OP_2w_subsat, - bbb_func_OP_2w_subasr1, - bbb_func_OP_2w_subhalf, - bbb_func_OP_2w_subhalfrnd, - bbb_func_OP_2w_abs, - bbb_func_OP_2w_subabssat, - bbb_func_OP_2w_mul, - bbb_func_OP_2w_qmul, - bbb_func_OP_2w_qrmul, - bbb_func_OP_2w_eq, - bbb_func_OP_2w_ne, - bbb_func_OP_2w_le, - bbb_func_OP_2w_lt, - bbb_func_OP_2w_ge, - bbb_func_OP_2w_gt, - bbb_func_OP_2w_asr, - bbb_func_OP_2w_asrrnd, - bbb_func_OP_2w_asl, - bbb_func_OP_2w_aslsat, - bbb_func_OP_2w_lsl, - bbb_func_OP_2w_lsr, - bbb_func_OP_2w_clip_asym, - bbb_func_OP_2w_clipz, - bbb_func_OP_2w_div, - bbb_func_OP_2w_divh, - bbb_func_OP_2w_mod, - bbb_func_OP_2w_sqrt_u, - bbb_func_OP_2w_mux, - bbb_func_OP_2w_avg, - bbb_func_OP_2w_avgrnd, - bbb_func_OP_2w_min, - bbb_func_OP_2w_max, - bbb_func_OP_1w_mul_realigning, -#ifdef ISP2401 - bbb_func_OP_1w_imax32, - bbb_func_OP_1w_imaxidx32, - bbb_func_OP_1w_cond_add, -#endif - - bbb_func_num_functions -} bbb_functions_t; - -typedef enum { - core_func_OP_and, - core_func_OP_or, - core_func_OP_xor, - core_func_OP_inv, - core_func_OP_add, - core_func_OP_sub, - core_func_OP_addsat, - core_func_OP_subsat, - core_func_OP_subasr1, - core_func_OP_abs, - core_func_OP_subabssat, -#ifdef ISP2401 - core_func_OP_subsat_u, -#endif - core_func_OP_muld, - core_func_OP_mul, - core_func_OP_qrmul, - core_func_OP_eq, - core_func_OP_ne, - core_func_OP_le, - core_func_OP_lt, - core_func_OP_ge, - core_func_OP_gt, - core_func_OP_asr, - core_func_OP_asl, - core_func_OP_asrrnd, - core_func_OP_lsl, - core_func_OP_lslsat, - core_func_OP_lsr, - core_func_OP_lsrrnd, - core_func_OP_clip_asym, - core_func_OP_clipz, - core_func_OP_div, - core_func_OP_mod, - core_func_OP_sqrt, - core_func_OP_mux, - core_func_OP_avgrnd, - core_func_OP_min, - core_func_OP_max, - - core_func_num_functions - -} core_functions_t; - -/* inc_bbb_count() can be used for building blocks that are implemented with one operation - inc_bbb_count_ext() will be used in case the operation count is not known or greater than one. - - For some operations there is a difference in operation count for the cloned version and the - not cloned version. this difference is not vissible on the reference code side. - We could add a min and max operation count for those operations, and keep track of those counts - separately. That way in the report the impact can be seen. */ - -#ifdef DISABLE_OPCNT -#define inc_bbb_count(func) -#define inc_bbb_count_ext(func, cnt) -#define enable_bbb_count() -#define disable_bbb_count() -#else -#define inc_bbb_count(func) _inc_bbb_count(func) -#define inc_bbb_count_ext(func, cnt) _inc_bbb_count_ext(func, cnt) -#define enable_bbb_count() _enable_bbb_count() -#define disable_bbb_count() _disable_bbb_count() -#endif - -void -inc_core_count_n( - core_functions_t func, - unsigned n); - -void -_enable_bbb_count(void); - -void -_disable_bbb_count(void); - -void -_inc_bbb_count( - bbb_functions_t func); - -void -_inc_bbb_count_ext( - bbb_functions_t func, - int op_count); - -void -bbb_func_reset_count(void); - -void -bbb_func_print_totals( - FILE * fp, - unsigned non_zero_only); - -void -core_func_print_totals( - FILE* fp, - unsigned non_zero_only); - -#endif diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/osys_public.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/osys_public.h deleted file mode 100644 index 8695e3c01fa6..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/osys_public.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __OSYS_PUBLIC_H_INCLUDED__ -#define __OSYS_PUBLIC_H_INCLUDED__ - -#include "system_types.h" - -#endif /* __OSYS_PUBLIC_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/pipeline_public.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/pipeline_public.h deleted file mode 100644 index 32cea582b4c4..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/pipeline_public.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __PIPELINE_PUBLIC_H_INCLUDED__ -#define __PIPELINE_PUBLIC_H_INCLUDED__ - -#endif /* __PIPELINE_PUBLIC_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/ref_vector_func.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/ref_vector_func.h deleted file mode 100644 index c1638c06407d..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/ref_vector_func.h +++ /dev/null @@ -1,1221 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 _REF_VECTOR_FUNC_H_INCLUDED_ -#define _REF_VECTOR_FUNC_H_INCLUDED_ - - -#ifdef INLINE_VECTOR_FUNC -#define STORAGE_CLASS_REF_VECTOR_FUNC_H static inline -#define STORAGE_CLASS_REF_VECTOR_DATA_H static inline_DATA -#else /* INLINE_VECTOR_FUNC */ -#define STORAGE_CLASS_REF_VECTOR_FUNC_H extern -#define STORAGE_CLASS_REF_VECTOR_DATA_H extern_DATA -#endif /* INLINE_VECTOR_FUNC */ - - -#include "ref_vector_func_types.h" - -/* @brief Doubling multiply accumulate with saturation - * - * @param[in] acc accumulator - * @param[in] a multiply input - * @param[in] b multiply input - * - * @return acc + (a*b) - * - * This function will do a doubling multiply ont - * inputs a and b, and will add the result to acc. - * in case of an overflow of acc, it will saturate. - */ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector2w OP_1w_maccd_sat( - tvector2w acc, - tvector1w a, - tvector1w b ); - -/* @brief Doubling multiply accumulate - * - * @param[in] acc accumulator - * @param[in] a multiply input - * @param[in] b multiply input - * - * @return acc + (a*b) - * - * This function will do a doubling multiply ont - * inputs a and b, and will add the result to acc. - * in case of overflow it will not saturate but wrap around. - */ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector2w OP_1w_maccd( - tvector2w acc, - tvector1w a, - tvector1w b ); - -/* @brief Re-aligning multiply - * - * @param[in] a multiply input - * @param[in] b multiply input - * @param[in] shift shift amount - * - * @return (a*b)>>shift - * - * This function will multiply a with b, followed by a right - * shift with rounding. the result is saturated and casted - * to single precision. - */ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w OP_1w_mul_realigning( - tvector1w a, - tvector1w b, - tscalar1w shift ); - -/* @brief Leading bit index - * - * @param[in] a input - * - * @return index of the leading bit of each element - * - * This function finds the index of leading one (set) bit of the - * input. The index starts with 0 for the LSB and can go upto - * ISP_VEC_ELEMBITS-1 for the MSB. For an input equal to zero, - * the returned index is -1. - */ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w OP_1w_lod( - tvector1w a); - -/* @brief Config Unit Input Processing - * - * @param[in] a input - * @param[in] input_scale input scaling factor - * @param[in] input_offset input offset factor - * - * @return scaled & offset added input clamped to MAXVALUE - * - * As part of input processing for piecewise linear estimation config unit, - * this function will perform scaling followed by adding offset and - * then clamping to the MAX InputValue - * It asserts -MAX_SHIFT_1W <= input_scale <= MAX_SHIFT_1W, and - * -MAX_SHIFT_1W <= input_offset <= MAX_SHIFT_1W - */ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w OP_1w_input_scaling_offset_clamping( - tvector1w a, - tscalar1w_5bit_signed input_scale, - tscalar1w_5bit_signed input_offset); - -/* @brief Config Unit Output Processing - * - * @param[in] a output - * @param[in] output_scale output scaling factor - * - * @return scaled & clamped output value - * - * As part of output processing for piecewise linear estimation config unit, - * This function will perform scaling and then clamping to output - * MAX value. - * It asserts -MAX_SHIFT_1W <= output_scale <= MAX_SHIFT_1W - */ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w OP_1w_output_scaling_clamping( - tvector1w a, - tscalar1w_5bit_signed output_scale); - -/* @brief Config Unit Piecewiselinear estimation - * - * @param[in] a input - * @param[in] config_points config parameter structure - * - * @return piecewise linear estimated output - * - * Given a set of N points {(x1,y1),()x2,y2), ....,(xn,yn)}, to find - * the functional value at an arbitrary point around the input set, - * this function will perform input processing followed by piecewise - * linear estimation and then output processing to yield the final value. - */ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w OP_1w_piecewise_estimation( - tvector1w a, - ref_config_points config_points); - -/* @brief Fast Config Unit - * - * @param[in] x input - * @param[in] init_vectors LUT data structure - * - * @return piecewise linear estimated output - * This block gets an input x and a set of input configuration points stored in a look-up - * table of 32 elements. First, the x input is clipped to be within the range [x1, xn+1]. - * Then, it computes the interval in which the input lies. Finally, the output is computed - * by performing linear interpolation based on the interval properties (i.e. x_prev, slope, - * and offset). This block assumes that the points are equally spaced and that the interval - * size is a power of 2. - **/ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w OP_1w_XCU( - tvector1w x, - xcu_ref_init_vectors init_vectors); - - -/* @brief LXCU - * - * @param[in] x input - * @param[in] init_vectors LUT data structure - * - * @return logarithmic piecewise linear estimated output. - * This block gets an input x and a set of input configuration points stored in a look-up - * table of 32 elements. It computes the interval in which the input lies. - * Then output is computed by performing linear interpolation based on the interval - * properties (i.e. x_prev, slope, * and offset). - * This BBB assumes spacing x-coordinates of "init vectors" increase exponentially as - * shown below. - * interval size : 2^0 2^1 2^2 2^3 - * x-coordinates: x0<--->x1<---->x2<---->x3<----> - **/ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w OP_1w_LXCU( - tvector1w x, - xcu_ref_init_vectors init_vectors); - -/* @brief Coring - * - * @param[in] coring_vec Amount of coring based on brightness level - * @param[in] filt_input Vector of input pixels on which Coring is applied - * @param[in] m_CnrCoring0 Coring Level0 - * - * @return vector of filtered pixels after coring is applied - * - * This function will perform adaptive coring based on brightness level to - * remove noise - */ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w coring( - tvector1w coring_vec, - tvector1w filt_input, - tscalar1w m_CnrCoring0 ); - -/* @brief Normalised FIR with coefficients [3,4,1] - * - * @param[in] m 1x3 matrix with pixels - * - * @return filtered output - * - * This function will calculate the - * Normalised FIR with coefficients [3,4,1], - *-5dB at Fs/2, -90 degree phase shift (quarter pixel) - */ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w fir1x3m_5dB_m90_nrm ( - const s_1w_1x3_matrix m); - -/* @brief Normalised FIR with coefficients [1,4,3] - * - * @param[in] m 1x3 matrix with pixels - * - * @return filtered output - * - * This function will calculate the - * Normalised FIR with coefficients [1,4,3], - *-5dB at Fs/2, +90 degree phase shift (quarter pixel) - */ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w fir1x3m_5dB_p90_nrm ( - const s_1w_1x3_matrix m); - -/* @brief Normalised FIR with coefficients [1,2,1] - * - * @param[in] m 1x3 matrix with pixels - * - * @return filtered output - * - * This function will calculate the - * Normalised FIR with coefficients [1,2,1], -6dB at Fs/2 - */ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w fir1x3m_6dB_nrm ( - const s_1w_1x3_matrix m); - -/* @brief Normalised FIR with coefficients [13,16,3] - * - * @param[in] m 1x3 matrix with pixels - * - * @return filtered output - * - * This function will calculate the - * Normalised FIR with coefficients [13,16,3], - */ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w fir1x3m_6dB_nrm_ph0 ( - const s_1w_1x3_matrix m); - -/* @brief Normalised FIR with coefficients [9,16,7] - * - * @param[in] m 1x3 matrix with pixels - * - * @return filtered output - * - * This function will calculate the - * Normalised FIR with coefficients [9,16,7], - */ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w fir1x3m_6dB_nrm_ph1 ( - const s_1w_1x3_matrix m); - -/* @brief Normalised FIR with coefficients [5,16,11] - * - * @param[in] m 1x3 matrix with pixels - * - * @return filtered output - * - * This function will calculate the - * Normalised FIR with coefficients [5,16,11], - */ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w fir1x3m_6dB_nrm_ph2 ( - const s_1w_1x3_matrix m); - -/* @brief Normalised FIR with coefficients [1,16,15] - * - * @param[in] m 1x3 matrix with pixels - * - * @return filtered output - * - * This function will calculate the - * Normalised FIR with coefficients [1,16,15], - */ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w fir1x3m_6dB_nrm_ph3 ( - const s_1w_1x3_matrix m); - -/* @brief Normalised FIR with programable phase shift - * - * @param[in] m 1x3 matrix with pixels - * @param[in] coeff phase shift - * - * @return filtered output - * - * This function will calculate the - * Normalised FIR with coefficients [8-coeff,16,8+coeff], - */ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w fir1x3m_6dB_nrm_calc_coeff ( - const s_1w_1x3_matrix m, tscalar1w_3bit coeff); - -/* @brief 3 tap FIR with coefficients [1,1,1] - * - * @param[in] m 1x3 matrix with pixels - * - * @return filtered output - * - * This function will calculate the - * FIR with coefficients [1,1,1], -9dB at Fs/2 normalized with factor 1/2 - */ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w fir1x3m_9dB_nrm ( - const s_1w_1x3_matrix m); - -#ifdef ISP2401 -/* @brief symmetric 3 tap FIR acts as LPF or BSF - * - * @param[in] m 1x3 matrix with pixels - * @param[in] k filter coefficient shift - * @param[in] bsf_flag 1 for BSF and 0 for LPF - * - * @return filtered output - * - * This function performs variable coefficient symmetric 3 tap filter which can - * be either used as Low Pass Filter or Band Stop Filter. - * Symmetric 3tap tap filter with DC gain 1 has filter coefficients [a, 1-2a, a] - * For LPF 'a' can be approximated as (1 - 2^(-k))/4, k = 0, 1, 2, ... - * and filter output can be approximated as: - * out_LPF = ((v00 + v02) - ((v00 + v02) >> k) + (2 * (v01 + (v01 >> k)))) >> 2 - * For BSF 'a' can be approximated as (1 + 2^(-k))/4, k = 0, 1, 2, ... - * and filter output can be approximated as: - * out_BSF = ((v00 + v02) + ((v00 + v02) >> k) + (2 * (v01 - (v01 >> k)))) >> 2 - * For a given filter coefficient shift 'k' and bsf_flag this function - * behaves either as LPF or BSF. - * All computation is done using 1w arithmetic and implementation does not use - * any multiplication. - */ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w -sym_fir1x3m_lpf_bsf(s_1w_1x3_matrix m, - tscalar1w k, - tscalar_bool bsf_flag); -#endif - -/* @brief Normalised 2D FIR with coefficients [1;2;1] * [1,2,1] - * - * @param[in] m 3x3 matrix with pixels - * - * @return filtered output - * - * This function will calculate the - * Normalised FIR with coefficients [1;2;1] * [1,2,1] - * Unity gain filter through repeated scaling and rounding - * - 6 rotate operations per output - * - 8 vector operations per output - * _______ - * 14 total operations - */ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w fir3x3m_6dB_nrm ( - const s_1w_3x3_matrix m); - -/* @brief Normalised 2D FIR with coefficients [1;1;1] * [1,1,1] - * - * @param[in] m 3x3 matrix with pixels - * - * @return filtered output - * - * This function will calculate the - * Normalised FIR with coefficients [1;1;1] * [1,1,1] - * - * (near) Unity gain filter through repeated scaling and rounding - * - 6 rotate operations per output - * - 8 vector operations per output - * _______ - * 14 operations - */ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w fir3x3m_9dB_nrm ( - const s_1w_3x3_matrix m); - -/* @brief Normalised dual output 2D FIR with coefficients [1;2;1] * [1,2,1] - * - * @param[in] m 4x3 matrix with pixels - * - * @return two filtered outputs (2x1 matrix) - * - * This function will calculate the - * Normalised FIR with coefficients [1;2;1] * [1,2,1] - * and produce two outputs (vertical) - * Unity gain filter through repeated scaling and rounding - * compute two outputs per call to re-use common intermediates - * - 4 rotate operations per output - * - 6 vector operations per output (alternative possible, but in this - * form it's not obvious to re-use variables) - * _______ - * 10 total operations - */ - STORAGE_CLASS_REF_VECTOR_FUNC_H s_1w_2x1_matrix fir3x3m_6dB_out2x1_nrm ( - const s_1w_4x3_matrix m); - -/* @brief Normalised dual output 2D FIR with coefficients [1;1;1] * [1,1,1] - * - * @param[in] m 4x3 matrix with pixels - * - * @return two filtered outputs (2x1 matrix) - * - * This function will calculate the - * Normalised FIR with coefficients [1;1;1] * [1,1,1] - * and produce two outputs (vertical) - * (near) Unity gain filter through repeated scaling and rounding - * compute two outputs per call to re-use common intermediates - * - 4 rotate operations per output - * - 7 vector operations per output (alternative possible, but in this - * form it's not obvious to re-use variables) - * _______ - * 11 total operations - */ -STORAGE_CLASS_REF_VECTOR_FUNC_H s_1w_2x1_matrix fir3x3m_9dB_out2x1_nrm ( - const s_1w_4x3_matrix m); - -/* @brief Normalised 2D FIR 5x5 - * - * @param[in] m 5x5 matrix with pixels - * - * @return filtered output - * - * This function will calculate the - * Normalised FIR with coefficients [1;1;1] * [1;2;1] * [1,2,1] * [1,1,1] - * and produce a filtered output - * (near) Unity gain filter through repeated scaling and rounding - * - 20 rotate operations per output - * - 28 vector operations per output - * _______ - * 48 total operations -*/ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w fir5x5m_15dB_nrm ( - const s_1w_5x5_matrix m); - -/* @brief Normalised FIR 1x5 - * - * @param[in] m 1x5 matrix with pixels - * - * @return filtered output - * - * This function will calculate the - * Normalised FIR with coefficients [1,2,1] * [1,1,1] = [1,4,6,4,1] - * and produce a filtered output - * (near) Unity gain filter through repeated scaling and rounding - * - 4 rotate operations per output - * - 5 vector operations per output - * _______ - * 9 total operations -*/ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w fir1x5m_12dB_nrm ( - const s_1w_1x5_matrix m); - -/* @brief Normalised 2D FIR 5x5 - * - * @param[in] m 5x5 matrix with pixels - * - * @return filtered output - * - * This function will calculate the - * Normalised FIR with coefficients [1;2;1] * [1;2;1] * [1,2,1] * [1,2,1] - * and produce a filtered output - * (near) Unity gain filter through repeated scaling and rounding - * - 20 rotate operations per output - * - 30 vector operations per output - * _______ - * 50 total operations -*/ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w fir5x5m_12dB_nrm ( - const s_1w_5x5_matrix m); - -/* @brief Approximate averaging FIR 1x5 - * - * @param[in] m 1x5 matrix with pixels - * - * @return filtered output - * - * This function will produce filtered output by - * applying the filter coefficients (1/8) * [1,1,1,1,1] - * _______ - * 5 vector operations -*/ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w fir1x5m_box ( - s_1w_1x5_matrix m); - -/* @brief Approximate averaging FIR 1x9 - * - * @param[in] m 1x9 matrix with pixels - * - * @return filtered output - * - * This function will produce filtered output by - * applying the filter coefficients (1/16) * [1,1,1,1,1,1,1,1,1] - * _______ - * 9 vector operations -*/ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w fir1x9m_box ( - s_1w_1x9_matrix m); - -/* @brief Approximate averaging FIR 1x11 - * - * @param[in] m 1x11 matrix with pixels - * - * @return filtered output - * - * This function will produce filtered output by - * applying the filter coefficients (1/16) * [1,1,1,1,1,1,1,1,1,1,1] - * _______ - * 12 vector operations -*/ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w fir1x11m_box ( - s_1w_1x11_matrix m); - -/* @brief Symmetric 7 tap filter with normalization - * - * @param[in] in 1x7 matrix with pixels - * @param[in] coeff 1x4 matrix with coefficients - * @param[in] out_shift output pixel shift value for normalization - * - * @return symmetric 7 tap filter output - * - * This function performs symmetric 7 tap filter over input pixels. - * Filter sum is normalized by shifting out_shift bits. - * Filter sum: p0*c3 + p1*c2 + p2*c1 + p3*c0 + p4*c1 + p5*c2 + p6*c3 - * is implemented as: (p0 + p6)*c3 + (p1 + p5)*c2 + (p2 + p4)*c1 + p3*c0 to - * reduce multiplication. - * Input pixels should to be scaled, otherwise overflow is possible during - * addition -*/ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w -fir1x7m_sym_nrm(s_1w_1x7_matrix in, - s_1w_1x4_matrix coeff, - tvector1w out_shift); - -/* @brief Symmetric 7 tap filter with normalization at input side - * - * @param[in] in 1x7 matrix with pixels - * @param[in] coeff 1x4 matrix with coefficients - * - * @return symmetric 7 tap filter output - * - * This function performs symmetric 7 tap filter over input pixels. - * Filter sum: p0*c3 + p1*c2 + p2*c1 + p3*c0 + p4*c1 + p5*c2 + p6*c3 - * = (p0 + p6)*c3 + (p1 + p5)*c2 + (p2 + p4)*c1 + p3*c0 - * Input pixels and coefficients are in Qn format, where n = - * ISP_VEC_ELEMBITS - 1 (ie Q15 for Broxton) - * To avoid double precision arithmetic input pixel sum and final sum is - * implemented using avgrnd and coefficient multiplication using qrmul. - * Final result is in Qm format where m = ISP_VEC_ELEMBITS - 2 (ie Q14 for - * Broxton) -*/ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w -fir1x7m_sym_innrm_approx(s_1w_1x7_matrix in, - s_1w_1x4_matrix coeff); - -/* @brief Symmetric 7 tap filter with normalization at output side - * - * @param[in] in 1x7 matrix with pixels - * @param[in] coeff 1x4 matrix with coefficients - * - * @return symmetric 7 tap filter output - * - * This function performs symmetric 7 tap filter over input pixels. - * Filter sum: p0*c3 + p1*c2 + p2*c1 + p3*c0 + p4*c1 + p5*c2 + p6*c3 - * = (p0 + p6)*c3 + (p1 + p5)*c2 + (p2 + p4)*c1 + p3*c0 - * Input pixels are in Qn and coefficients are in Qm format, where n = - * ISP_VEC_ELEMBITS - 2 and m = ISP_VEC_ELEMBITS - 1 (ie Q14 and Q15 - * respectively for Broxton) - * To avoid double precision arithmetic input pixel sum and final sum is - * implemented using addsat and coefficient multiplication using qrmul. - * Final sum is left shifted by 2 and saturated to produce result is Qm format - * (ie Q15 for Broxton) -*/ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w -fir1x7m_sym_outnrm_approx(s_1w_1x7_matrix in, - s_1w_1x4_matrix coeff); - -/* @brief 4 tap filter with normalization - * - * @param[in] in 1x4 matrix with pixels - * @param[in] coeff 1x4 matrix with coefficients - * @param[in] out_shift output pixel shift value for normalization - * - * @return 4 tap filter output - * - * This function performs 4 tap filter over input pixels. - * Filter sum is normalized by shifting out_shift bits. - * Filter sum: p0*c0 + p1*c1 + p2*c2 + p3*c3 -*/ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w -fir1x4m_nrm(s_1w_1x4_matrix in, - s_1w_1x4_matrix coeff, - tvector1w out_shift); - -/* @brief 4 tap filter with normalization for half pixel interpolation - * - * @param[in] in 1x4 matrix with pixels - * - * @return 4 tap filter output with filter tap [-1 9 9 -1]/16 - * - * This function performs 4 tap filter over input pixels. - * Filter sum: -p0 + 9*p1 + 9*p2 - p3 - * This filter implementation is completely free from multiplication and double - * precision arithmetic. - * Typical usage of this filter is to half pixel interpolation of Bezier - * surface - * */ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w -fir1x4m_bicubic_bezier_half(s_1w_1x4_matrix in); - -/* @brief 4 tap filter with normalization for quarter pixel interpolation - * - * @param[in] in 1x4 matrix with pixels - * @param[in] coeff 1x4 matrix with coefficients - * - * @return 4 tap filter output - * - * This function performs 4 tap filter over input pixels. - * Filter sum: p0*c0 + p1*c1 + p2*c2 + p3*c3 - * To avoid double precision arithmetic we implemented multiplication using - * qrmul and addition using avgrnd. Coefficients( c0 to c3) formats are assumed - * to be: Qm, Qn, Qo, Qm, where m = n + 2 and o = n + 1. - * Typical usage of this filter is to quarter pixel interpolation of Bezier - * surface with filter coefficients:[-9 111 29 -3]/128. For which coefficient - * values should be: [-9216/2^17 28416/2^15 1484/2^16 -3072/2^17] for - * ISP_VEC_ELEMBITS = 16. -*/ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w -fir1x4m_bicubic_bezier_quarter(s_1w_1x4_matrix in, - s_1w_1x4_matrix coeff); - - -/* @brief Symmetric 3 tap filter with normalization - * - * @param[in] in 1x3 matrix with pixels - * @param[in] coeff 1x2 matrix with coefficients - * @param[in] out_shift output pixel shift value for normalization - * - * @return symmetric 3 tap filter output - * - * This function performs symmetric 3 tap filter input pixels. - * Filter sum is normalized by shifting out_shift bits. - * Filter sum: p0*c1 + p1*c0 + p2*c1 - * is implemented as: (p0 + p2)*c1 + p1*c0 to reduce multiplication. - * Input pixels should to be scaled, otherwise overflow is possible during - * addition -*/ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w -fir1x3m_sym_nrm(s_1w_1x3_matrix in, - s_1w_1x2_matrix coeff, - tvector1w out_shift); - -/* @brief Symmetric 3 tap filter with normalization - * - * @param[in] in 1x3 matrix with pixels - * @param[in] coeff 1x2 matrix with coefficients - * - * @return symmetric 3 tap filter output - * - * This function performs symmetric 3 tap filter over input pixels. - * Filter sum: p0*c1 + p1*c0 + p2*c1 = (p0 + p2)*c1 + p1*c0 - * Input pixels are in Qn and coefficient c0 is in Qm and c1 is in Qn format, - * where n = ISP_VEC_ELEMBITS - 1 and m = ISP_VEC_ELEMBITS - 2 ( ie Q15 and Q14 - * respectively for Broxton) - * To avoid double precision arithmetic input pixel sum is implemented using - * avgrnd, coefficient multiplication using qrmul and final sum using addsat - * Final sum is Qm format (ie Q14 for Broxton) -*/ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w -fir1x3m_sym_nrm_approx(s_1w_1x3_matrix in, - s_1w_1x2_matrix coeff); - -/* @brief Mean of 1x3 matrix - * - * @param[in] m 1x3 matrix with pixels - * - * @return mean of 1x3 matrix - * - * This function calculates the mean of 1x3 pixels, - * with a factor of 4/3. -*/ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w mean1x3m( - s_1w_1x3_matrix m); - -/* @brief Mean of 3x3 matrix - * - * @param[in] m 3x3 matrix with pixels - * - * @return mean of 3x3 matrix - * - * This function calculates the mean of 3x3 pixels, - * with a factor of 16/9. -*/ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w mean3x3m( - s_1w_3x3_matrix m); - -/* @brief Mean of 1x4 matrix - * - * @param[in] m 1x4 matrix with pixels - * - * @return mean of 1x4 matrix - * - * This function calculates the mean of 1x4 pixels -*/ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w mean1x4m( - s_1w_1x4_matrix m); - -/* @brief Mean of 4x4 matrix - * - * @param[in] m 4x4 matrix with pixels - * - * @return mean of 4x4 matrix - * - * This function calculates the mean of 4x4 matrix with pixels -*/ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w mean4x4m( - s_1w_4x4_matrix m); - -/* @brief Mean of 2x3 matrix - * - * @param[in] m 2x3 matrix with pixels - * - * @return mean of 2x3 matrix - * - * This function calculates the mean of 2x3 matrix with pixels - * with a factor of 8/6. -*/ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w mean2x3m( - s_1w_2x3_matrix m); - -/* @brief Mean of 1x5 matrix - * - * @param[in] m 1x5 matrix with pixels - * - * @return mean of 1x5 matrix - * - * This function calculates the mean of 1x5 matrix with pixels - * with a factor of 8/5. -*/ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w mean1x5m(s_1w_1x5_matrix m); - -/* @brief Mean of 1x6 matrix - * - * @param[in] m 1x6 matrix with pixels - * - * @return mean of 1x6 matrix - * - * This function calculates the mean of 1x6 matrix with pixels - * with a factor of 8/6. -*/ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w mean1x6m( - s_1w_1x6_matrix m); - -/* @brief Mean of 5x5 matrix - * - * @param[in] m 5x5 matrix with pixels - * - * @return mean of 5x5 matrix - * - * This function calculates the mean of 5x5 matrix with pixels - * with a factor of 32/25. -*/ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w mean5x5m( - s_1w_5x5_matrix m); - -/* @brief Mean of 6x6 matrix - * - * @param[in] m 6x6 matrix with pixels - * - * @return mean of 6x6 matrix - * - * This function calculates the mean of 6x6 matrix with pixels - * with a factor of 64/36. -*/ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w mean6x6m( - s_1w_6x6_matrix m); - -/* @brief Minimum of 4x4 matrix - * - * @param[in] m 4x4 matrix with pixels - * - * @return minimum of 4x4 matrix - * - * This function calculates the minimum of - * 4x4 matrix with pixels. -*/ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w min4x4m( - s_1w_4x4_matrix m); - -/* @brief Maximum of 4x4 matrix - * - * @param[in] m 4x4 matrix with pixels - * - * @return maximum of 4x4 matrix - * - * This function calculates the maximum of - * 4x4 matrix with pixels. -*/ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w max4x4m( - s_1w_4x4_matrix m); - -/* @brief SAD between two 3x3 matrices - * - * @param[in] a 3x3 matrix with pixels - * - * @param[in] b 3x3 matrix with pixels - * - * @return 3x3 matrix SAD - * - * This function calculates the sum of absolute difference between two matrices. - * Both input pixels and SAD are normalized by a factor of SAD3x3_IN_SHIFT and - * SAD3x3_OUT_SHIFT respectively. - * Computed SAD is 1/(2 ^ (SAD3x3_IN_SHIFT + SAD3x3_OUT_SHIFT)) ie 1/16 factor - * of original SAD and it's more precise than sad3x3m() -*/ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w sad3x3m_precise( - s_1w_3x3_matrix a, - s_1w_3x3_matrix b); - -/* @brief SAD between two 3x3 matrices - * - * @param[in] a 3x3 matrix with pixels - * - * @param[in] b 3x3 matrix with pixels - * - * @return 3x3 matrix SAD - * - * This function calculates the sum of absolute difference between two matrices. - * This version saves cycles by avoiding input normalization and wide vector - * operation during sum computation - * Input pixel differences are computed by absolute of rounded, halved - * subtraction. Normalized sum is computed by rounded averages. - * Computed SAD is (1/2)*(1/16) = 1/32 factor of original SAD. Factor 1/2 comes - * from input halving operation and factor 1/16 comes from mean operation -*/ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w sad3x3m( - s_1w_3x3_matrix a, - s_1w_3x3_matrix b); - -/* @brief SAD between two 5x5 matrices - * - * @param[in] a 5x5 matrix with pixels - * - * @param[in] b 5x5 matrix with pixels - * - * @return 5x5 matrix SAD - * - * Computed SAD is = 1/32 factor of original SAD. -*/ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w sad5x5m( - s_1w_5x5_matrix a, - s_1w_5x5_matrix b); - -/* @brief Absolute gradient between two sets of 1x5 matrices - * - * @param[in] m0 first set of 1x5 matrix with pixels - * @param[in] m1 second set of 1x5 matrix with pixels - * - * @return absolute gradient between two 1x5 matrices - * - * This function computes mean of two input 1x5 matrices and returns - * absolute difference between two mean values. - */ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w -absgrad1x5m(s_1w_1x5_matrix m0, s_1w_1x5_matrix m1); - -/* @brief Bi-linear Interpolation optimized(approximate) - * - * @param[in] a input0 - * @param[in] b input1 - * @param[in] c cloned weight factor - * - * @return (a-b)*c + b - * - * This function will do bi-linear Interpolation on - * inputs a and b using constant weight factor c - * - * Inputs a,b are assumed in S1.15 format - * Weight factor has to be in range [0,1] and is assumed to be in S2.14 format - * - * The bilinear interpolation equation is (a*c) + b*(1-c), - * But this is implemented as (a-b)*c + b for optimization - */ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w OP_1w_bilinear_interpol_approx_c( - tvector1w a, - tvector1w b, - tscalar1w_weight c); - -/* @brief Bi-linear Interpolation optimized(approximate) - * - * @param[in] a input0 - * @param[in] b input1 - * @param[in] c weight factor - * - * @return (a-b)*c + b - * - * This function will do bi-linear Interpolation on - * inputs a and b using weight factor c - * - * Inputs a,b are assumed in S1.15 format - * Weight factor has to be in range [0,1] and is assumed to be in S2.14 format - * - * The bilinear interpolation equation is (a*c) + b*(1-c), - * But this is implemented as (a-b)*c + b for optimization - */ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w OP_1w_bilinear_interpol_approx( - tvector1w a, - tvector1w b, - tvector1w_weight c); - -/* @brief Bi-linear Interpolation - * - * @param[in] a input0 - * @param[in] b input1 - * @param[in] c weight factor - * - * @return (a*c) + b*(1-c) - * - * This function will do bi-linear Interpolation on - * inputs a and b using weight factor c - * - * Inputs a,b are assumed in S1.15 format - * Weight factor has to be in range [0,1] and is assumed to be in S2.14 format - * - * The bilinear interpolation equation is (a*c) + b*(1-c), - */ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w OP_1w_bilinear_interpol( - tvector1w a, - tvector1w b, - tscalar1w_weight c); - -/* @brief Generic Block Matching Algorithm - * @param[in] search_window pointer to input search window of 16x16 pixels - * @param[in] ref_block pointer to input reference block of 8x8 pixels, where N<=M - * @param[in] output pointer to output sads - * @param[in] search_sz search size for SAD computation - * @param[in] ref_sz block size - * @param[in] pixel_shift pixel shift to search the data - * @param[in] search_block_sz search window block size - * @param[in] shift shift value, with which the output is shifted right - * - * @return 0 when the computation is successful. - - * * This function compares the reference block with a block of size NxN in the search - * window. Sum of absolute differences for each pixel in the reference block and the - * corresponding pixel in the search block. Whole search window os traversed with the - * reference block with the given pixel shift. - * - */ -STORAGE_CLASS_REF_VECTOR_FUNC_H int generic_block_matching_algorithm( - tscalar1w **search_window, - tscalar1w **ref_block, - tscalar1w *output, - int search_sz, - int ref_sz, - int pixel_shift, - int search_block_sz, - tscalar1w_4bit_bma_shift shift); - -#ifndef ISP2401 -/* @brief OP_1w_asp_bma_16_1_32way -#else -/* @brief OP_1w_asp_bma_16_1_32way_nomask -#endif - * - * @param[in] search_area input search window of 16x16 pixels - * @param[in] input_block input reference block of 8x8 pixels, where N<=M - * @param[in] shift shift value, with which the output is shifted right - * - * @return 81 SADs for all the search blocks. - - * This function compares the reference block with a block of size 8x8 pixels in the - * search window of 16x16 pixels. Sum of absolute differences for each pixel in the - * reference block and the corresponding pixel in the search block is calculated. - * Whole search window is traversed with the reference block with the pixel shift of 1 - * pixels. The output is right shifted with the given shift value. The shift value is - * a 4 bit value. - * - */ - -#ifndef ISP2401 -STORAGE_CLASS_REF_VECTOR_FUNC_H bma_output_16_1 OP_1w_asp_bma_16_1_32way( -#else -STORAGE_CLASS_REF_VECTOR_FUNC_H bma_output_16_1 OP_1w_asp_bma_16_1_32way_nomask( -#endif - bma_16x16_search_window search_area, - ref_block_8x8 input_block, - tscalar1w_4bit_bma_shift shift); - -#ifndef ISP2401 -/* @brief OP_1w_asp_bma_16_2_32way -#else -/* @brief OP_1w_asp_bma_16_2_32way_nomask -#endif - * - * @param[in] search_area input search window of 16x16 pixels - * @param[in] input_block input reference block of 8x8 pixels, where N<=M - * @param[in] shift shift value, with which the output is shifted right - * - * @return 25 SADs for all the search blocks. - * This function compares the reference block with a block of size 8x8 in the search - * window of 16x61. Sum of absolute differences for each pixel in the reference block - * and the corresponding pixel in the search block is computed. Whole search window is - * traversed with the reference block with the given pixel shift of 2 pixels. The output - * is right shifted with the given shift value. The shift value is a 4 bit value. - * - */ - -#ifndef ISP2401 -STORAGE_CLASS_REF_VECTOR_FUNC_H bma_output_16_2 OP_1w_asp_bma_16_2_32way( -#else -STORAGE_CLASS_REF_VECTOR_FUNC_H bma_output_16_2 OP_1w_asp_bma_16_2_32way_nomask( -#endif - bma_16x16_search_window search_area, - ref_block_8x8 input_block, - tscalar1w_4bit_bma_shift shift); -#ifndef ISP2401 -/* @brief OP_1w_asp_bma_14_1_32way -#else -/* @brief OP_1w_asp_bma_14_1_32way_nomask -#endif - * - * @param[in] search_area input search block of 16x16 pixels with search window of 14x14 pixels - * @param[in] input_block input reference block of 8x8 pixels, where N<=M - * @param[in] shift shift value, with which the output is shifted right - * - * @return 49 SADs for all the search blocks. - * This function compares the reference block with a block of size 8x8 in the search - * window of 14x14. Sum of absolute differences for each pixel in the reference block - * and the corresponding pixel in the search block. Whole search window is traversed - * with the reference block with 2 pixel shift. The output is right shifted with the - * given shift value. The shift value is a 4 bit value. Input is always a 16x16 block - * but the search window is 14x14, with last 2 pixels of row and column are not used - * for computation. - * - */ - -#ifndef ISP2401 -STORAGE_CLASS_REF_VECTOR_FUNC_H bma_output_14_1 OP_1w_asp_bma_14_1_32way( -#else -STORAGE_CLASS_REF_VECTOR_FUNC_H bma_output_14_1 OP_1w_asp_bma_14_1_32way_nomask( -#endif - bma_16x16_search_window search_area, - ref_block_8x8 input_block, - tscalar1w_4bit_bma_shift shift); - -#ifndef ISP2401 -/* @brief OP_1w_asp_bma_14_2_32way -#else -/* @brief OP_1w_asp_bma_14_2_32way_nomask -#endif - * - * @param[in] search_area input search block of 16x16 pixels with search window of 14x14 pixels - * @param[in] input_block input reference block of 8x8 pixels, where N<=M - * @param[in] shift shift value, with which the output is shifted right - * - * @return 16 SADs for all the search blocks. - * This function compares the reference block with a block of size 8x8 in the search - * window of 14x14. Sum of absolute differences for each pixel in the reference block - * and the corresponding pixel in the search block. Whole search window is traversed - * with the reference block with 2 pixels shift. The output is right shifted with the - * given shift value. The shift value is a 4 bit value. - * - */ - -#ifndef ISP2401 -STORAGE_CLASS_REF_VECTOR_FUNC_H bma_output_14_2 OP_1w_asp_bma_14_2_32way( -#else -STORAGE_CLASS_REF_VECTOR_FUNC_H bma_output_14_2 OP_1w_asp_bma_14_2_32way_nomask( -#endif - bma_16x16_search_window search_area, - ref_block_8x8 input_block, - tscalar1w_4bit_bma_shift shift); - -#ifdef ISP2401 -/* @brief multiplex addition and passing - * - * @param[in] _a first pixel - * @param[in] _b second pixel - * @param[in] _c condition flag - * - * @return (_a + _b) if condition flag is true - * _a if condition flag is false - * - * This function does multiplex addition depending on the input condition flag - */ -STORAGE_CLASS_REF_VECTOR_FUNC_H tvector1w OP_1w_cond_add( - tvector1w _a, - tvector1w _b, - tflags _c); - -#endif -#ifdef HAS_bfa_unit -/* @brief OP_1w_single_bfa_7x7 - * - * @param[in] weights - spatial and range weight lut - * @param[in] threshold - threshold plane, for range weight scaling - * @param[in] central_pix - central pixel plane - * @param[in] src_plane - src pixel plane - * - * @return Bilateral filter output - * - * This function implements, 7x7 single bilateral filter. - * Output = {sum(pixel * weight), sum(weight)} - * Where sum is summation over 7x7 block set. - * weight = spatial weight * range weight - * spatial weights are loaded from spatial_weight_lut depending on src pixel - * position in the 7x7 block - * range weights are computed by table look up from range_weight_lut depending - * on scaled absolute difference between src and central pixels. - * threshold is used as scaling factor. range_weight_lut consists of - * BFA_RW_LUT_SIZE numbers of LUT entries to model any distribution function. - * Piecewise linear approximation technique is used to compute range weight - * It computes absolute difference between central pixel and 61 src pixels. - */ -STORAGE_CLASS_REF_VECTOR_FUNC_H bfa_7x7_output OP_1w_single_bfa_7x7( - bfa_weights weights, - tvector1w threshold, - tvector1w central_pix, - s_1w_7x7_matrix src_plane); - -/* @brief OP_1w_joint_bfa_7x7 - * - * @param[in] weights - spatial and range weight lut - * @param[in] threshold0 - 1st threshold plane, for range weight scaling - * @param[in] central_pix0 - 1st central pixel plane - * @param[in] src0_plane - 1st pixel plane - * @param[in] threshold1 - 2nd threshold plane, for range weight scaling - * @param[in] central_pix1 - 2nd central pixel plane - * @param[in] src1_plane - 2nd pixel plane - * - * @return Joint bilateral filter output - * - * This function implements, 7x7 joint bilateral filter. - * Output = {sum(pixel * weight), sum(weight)} - * Where sum is summation over 7x7 block set. - * weight = spatial weight * range weight - * spatial weights are loaded from spatial_weight_lut depending on src pixel - * position in the 7x7 block - * range weights are computed by table look up from range_weight_lut depending - * on sum of scaled absolute difference between central pixel and two src pixel - * planes. threshold is used as scaling factor. range_weight_lut consists of - * BFA_RW_LUT_SIZE numbers of LUT entries to model any distribution function. - * Piecewise linear approximation technique is used to compute range weight - * It computes absolute difference between central pixel and 61 src pixels. - */ -STORAGE_CLASS_REF_VECTOR_FUNC_H bfa_7x7_output OP_1w_joint_bfa_7x7( - bfa_weights weights, - tvector1w threshold0, - tvector1w central_pix0, - s_1w_7x7_matrix src0_plane, - tvector1w threshold1, - tvector1w central_pix1, - s_1w_7x7_matrix src1_plane); - -/* @brief bbb_bfa_gen_spatial_weight_lut - * - * @param[in] in - 7x7 matrix of spatial weights - * @param[in] out - generated LUT - * - * @return None - * - * This function implements, creates spatial weight look up table used - * for bilaterl filter instruction. - */ -STORAGE_CLASS_REF_VECTOR_FUNC_H void bbb_bfa_gen_spatial_weight_lut( - s_1w_7x7_matrix in, - tvector1w out[BFA_MAX_KWAY]); - -/* @brief bbb_bfa_gen_range_weight_lut - * - * @param[in] in - input range weight, - * @param[in] out - generated LUT - * - * @return None - * - * This function implements, creates range weight look up table used - * for bilaterl filter instruction. - * 8 unsigned 7b weights are represented in 7 16bits LUT - * LUT formation is done as follows: - * higher 8 bit: Point(N) = Point(N+1) - Point(N) - * lower 8 bit: Point(N) = Point(N) - * Weight function can be any monotonic decreasing function for x >= 0 - */ -STORAGE_CLASS_REF_VECTOR_FUNC_H void bbb_bfa_gen_range_weight_lut( - tvector1w in[BFA_RW_LUT_SIZE+1], - tvector1w out[BFA_RW_LUT_SIZE]); -#endif - -#ifdef ISP2401 -/* @brief OP_1w_imax32 - * - * @param[in] src - structure that holds an array of 32 elements. - * - * @return maximum element among input array. - * - *This function gets maximum element from an array of 32 elements. - */ -STORAGE_CLASS_REF_VECTOR_FUNC_H int OP_1w_imax32( - imax32_ref_in_vector src); - -/* @brief OP_1w_imaxidx32 - * - * @param[in] src - structure that holds a vector of elements. - * - * @return index of first element with maximum value among array. - * - * This function gets index of first element with maximum value - * from 32 elements. - */ -STORAGE_CLASS_REF_VECTOR_FUNC_H int OP_1w_imaxidx32( - imax32_ref_in_vector src); - -#endif -#ifndef INLINE_VECTOR_FUNC -#define STORAGE_CLASS_REF_VECTOR_FUNC_C -#define STORAGE_CLASS_REF_VECTOR_DATA_C const -#else /* INLINE_VECTOR_FUNC */ -#define STORAGE_CLASS_REF_VECTOR_FUNC_C STORAGE_CLASS_REF_VECTOR_FUNC_H -#define STORAGE_CLASS_REF_VECTOR_DATA_C STORAGE_CLASS_REF_VECTOR_DATA_H -#include "ref_vector_func.c" -#define VECTOR_FUNC_INLINED -#endif /* INLINE_VECTOR_FUNC */ - -#endif /*_REF_VECTOR_FUNC_H_INCLUDED_*/ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/ref_vector_func_types.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/ref_vector_func_types.h deleted file mode 100644 index 4dd05eba852e..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/ref_vector_func_types.h +++ /dev/null @@ -1,385 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __REF_VECTOR_FUNC_TYPES_H_INCLUDED__ -#define __REF_VECTOR_FUNC_TYPES_H_INCLUDED__ - - -/* - * Prerequisites: - * - */ -#include "mpmath.h" -#include "bbb_config.h" -#include "isp_op1w_types.h" -#include "isp_op2w_types.h" - -/* Defines for the Config Unit */ -#define MAX_CONFIG_POINTS 5 -#define INPUT_OFFSET_FACTOR 10 -#define INPUT_SCALE_FACTOR 10 -#define OUTPUT_SCALE_FACTOR 10 -#define SLOPE_A_RESOLUTION 10 -#define CONFIG_UNIT_LUT_SIZE_32 32 /*XCU works for ISP_NWAY = 32 */ -#define LXCU_LUT_SIZE 16 -#ifdef ISP2401 -#define IMAX32_ELEM_SIZE 32 -#endif - -#define ONE_IN_Q14 (1<<(NUM_BITS-2)) -#define Q29_TO_Q15_SHIFT_VAL (NUM_BITS-2) -#define Q28_TO_Q15_SHIFT_VAL (NUM_BITS-3) -#define MAX_ELEM(width_in_bits) ((1<<(width_in_bits))-1) - -/* Block matching algorithm related data */ -/* NUM_OF_SADS = ((SEARCH_AREA_HEIGHT - REF_BLOCK_HEIGHT)/PIXEL_SHIFT + 1)* \ - ((SEARCH_AREA_WIDTH - REF_BLOCK_WIDTH)/PIXEL_SHIFT + 1) */ - -#define SADS(sw_h,sw_w, ref_h, ref_w, p_sh) (((sw_h - ref_h)/p_sh + 1)*((sw_w - ref_w)/p_sh + 1)) -#define SADS_16x16_1 SADS(16, 16, 8, 8, 1) -#define SADS_16x16_2 SADS(16, 16, 8, 8, 2) -#define SADS_14x14_1 SADS(14, 14, 8, 8, 1) -#define SADS_14x14_2 SADS(14, 14, 8, 8, 2) - -#define BMA_OUTPUT_MATRIX_DIM(sw_h, ref_h, p_sh) ((sw_h - ref_h)/p_sh + 1) -#define BMA_OUT_16x16_2_32 BMA_OUTPUT_MATRIX_DIM(16, 8, 2) -#define BMA_OUT_14x14_2_32 BMA_OUTPUT_MATRIX_DIM(14, 8, 2) -#define BMA_OUT_16x16_1_32 BMA_OUTPUT_MATRIX_DIM(16, 8, 1) -#define BMA_OUT_14x14_1_32 BMA_OUTPUT_MATRIX_DIM(14, 8, 1) -#define BMA_SEARCH_BLOCK_SZ_16 16 -#define BMA_REF_BLOCK_SZ_8 8 -#define PIXEL_SHIFT_2 2 -#define PIXEL_SHIFT_1 1 -#define BMA_SEARCH_WIN_SZ_16 16 -#define BMA_SEARCH_WIN_SZ_14 14 - - -/* - * Struct type specification - */ - -typedef unsigned short tscalar1w_3bit; /* tscalar1w in interval [0, 2^3) */ -typedef short tscalar1w_5bit_signed; /* tscalar1w in interval [-2^(5-1), 2^(5-1)) */ -typedef unsigned short tscalar1w_5bit; /* tscalar1w in interval [0, 2^5) */ -typedef short tscalar1w_range1wbit; /* tscalar1w in interval [-NUM_BITS, NUM_BITS] */ -typedef short tscalar1w_unsigned_range1wbit; /* tscalar1w in interval [0, NUM_BITS] */ -typedef unsigned short tvector_8bit; /* 8 bit positive number */ -typedef unsigned short tvector_5bit; -typedef unsigned short tvector_4bit; -typedef unsigned short tscalar1w_16bit; -typedef unsigned short tscalar1w_4bit_bma_shift; - -typedef struct { - tvector1w v0 ; - tvector1w v1 ; -} s_1w_2x1_matrix; - -#define S_1W_2X1_MATRIX_DEFAULT ((s_1w_2x1_matrix)\ - { 0, 0 }) - -typedef struct { - tvector1w v00; - tvector1w v01; -} s_1w_1x2_matrix; - -#define S_1W_1X2_MATRIX_DEFAULT ((s_1w_1x2_matrix)\ - { 0, 0 }) - -typedef struct { - tvector1w v00 ; - tvector1w v01 ; - tvector1w v02 ; -} s_1w_1x3_matrix; - -#define S_1W_1X3_MATRIX_DEFAULT ((s_1w_1x3_matrix)\ - { 0, 0, 0, }) - -typedef struct { - tvector1w v00; tvector1w v01; tvector1w v02; - tvector1w v10; tvector1w v11; tvector1w v12; -} s_1w_2x3_matrix; - -#define S_1W_2X3_MATRIX_DEFAULT ((s_1w_2x3_matrix)\ - { 0, 0, 0, \ - 0, 0, 0 }) - -typedef struct { - tvector1w v00 ; tvector1w v01 ; tvector1w v02 ; - tvector1w v10 ; tvector1w v11 ; tvector1w v12 ; - tvector1w v20 ; tvector1w v21 ; tvector1w v22 ; -} s_1w_3x3_matrix; - -#define S_1W_3X3_MATRIX_DEFAULT ((s_1w_3x3_matrix)\ - { 0, 0, 0, \ - 0, 0, 0, \ - 0, 0, 0 }) - -typedef struct { - tvector1w v00 ; tvector1w v01 ; tvector1w v02 ; - tvector1w v10 ; tvector1w v11 ; tvector1w v12 ; - tvector1w v20 ; tvector1w v21 ; tvector1w v22 ; - tvector1w v30 ; tvector1w v31 ; tvector1w v32 ; -} s_1w_4x3_matrix; - -#define S_1W_4X3_MATRIX_DEFAULT ((s_1w_4x3_matrix)\ - { 0, 0, 0, \ - 0, 0, 0, \ - 0, 0, 0, \ - 0, 0, 0 }) - -typedef struct { - tvector1w v00 ; - tvector1w v01 ; - tvector1w v02 ; - tvector1w v03 ; - tvector1w v04 ; -} s_1w_1x5_matrix; - -#define S_1W_1X5_MATRIX_DEFAULT ((s_1w_1x5_matrix)\ - { 0, 0, 0, 0, 0 }) - -typedef struct { - tvector1w v00 ; tvector1w v01 ; tvector1w v02 ; tvector1w v03 ; tvector1w v04 ; - tvector1w v10 ; tvector1w v11 ; tvector1w v12 ; tvector1w v13 ; tvector1w v14 ; - tvector1w v20 ; tvector1w v21 ; tvector1w v22 ; tvector1w v23 ; tvector1w v24 ; - tvector1w v30 ; tvector1w v31 ; tvector1w v32 ; tvector1w v33 ; tvector1w v34 ; - tvector1w v40 ; tvector1w v41 ; tvector1w v42 ; tvector1w v43 ; tvector1w v44 ; -} s_1w_5x5_matrix; - -#define S_1W_5X5_MATRIX_DEFAULT ((s_1w_5x5_matrix)\ - { 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0 }) -#ifndef ISP2401 - -#else - -#endif -typedef struct { - tvector1w v00; - tvector1w v01; - tvector1w v02; - tvector1w v03; - tvector1w v04; - tvector1w v05; - tvector1w v06; -} s_1w_1x7_matrix; - -#define S_1W_1X7_MATRIX_DEFAULT ((s_1w_1x7_matrix)\ - { 0, 0, 0, 0, 0, 0, 0 }) - -typedef struct { - tvector1w v00; - tvector1w v01; - tvector1w v02; - tvector1w v03; - tvector1w v04; - tvector1w v05; - tvector1w v06; - tvector1w v07; - tvector1w v08; -} s_1w_1x9_matrix; - -#define S_1W_1X9_MATRIX_DEFAULT ((s_1w_1x9_matrix)\ - { 0, 0, 0, 0, 0, 0, 0, 0, 0 }) - -typedef struct { - tvector1w v00; - tvector1w v01; - tvector1w v02; - tvector1w v03; -} s_1w_1x4_matrix; - -#define S_1W_1X4_MATRIX ((s_1w_1x4_matrix)\ - { 0, 0, 0, 0 }) - -typedef struct { - tvector1w v00; tvector1w v01; tvector1w v02; tvector1w v03; - tvector1w v10; tvector1w v11; tvector1w v12; tvector1w v13; - tvector1w v20; tvector1w v21; tvector1w v22; tvector1w v23; - tvector1w v30; tvector1w v31; tvector1w v32; tvector1w v33; -} s_1w_4x4_matrix; - -#define S_1W_4X4_MATRIX_DEFAULT ((s_1w_4x4_matrix)\ - { 0, 0, 0, 0, \ - 0, 0, 0, 0, \ - 0, 0, 0, 0, \ - 0, 0, 0, 0 }) - -typedef struct { - tvector1w v00; - tvector1w v01; - tvector1w v02; - tvector1w v03; - tvector1w v04; - tvector1w v05; -} s_1w_1x6_matrix; - -#define S_1W_1X6_MATRIX_DEFAULT ((s_1w_1x6_matrix)\ - { 0, 0, 0, 0, 0, 0 }) - -typedef struct { - tvector1w v00; tvector1w v01; tvector1w v02; tvector1w v03; tvector1w v04; tvector1w v05; - tvector1w v10; tvector1w v11; tvector1w v12; tvector1w v13; tvector1w v14; tvector1w v15; - tvector1w v20; tvector1w v21; tvector1w v22; tvector1w v23; tvector1w v24; tvector1w v25; - tvector1w v30; tvector1w v31; tvector1w v32; tvector1w v33; tvector1w v34; tvector1w v35; - tvector1w v40; tvector1w v41; tvector1w v42; tvector1w v43; tvector1w v44; tvector1w v45; - tvector1w v50; tvector1w v51; tvector1w v52; tvector1w v53; tvector1w v54; tvector1w v55; -} s_1w_6x6_matrix; - -#define S_1W_6X6_MATRIX_DEFAULT ((s_1w_6x6_matrix)\ - { 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0 }) - -typedef struct { - tvector1w v00; tvector1w v01; tvector1w v02; tvector1w v03; tvector1w v04; - tvector1w v05; tvector1w v06; tvector1w v07; tvector1w v08; - tvector1w v10; tvector1w v11; tvector1w v12; tvector1w v13; tvector1w v14; - tvector1w v15; tvector1w v16; tvector1w v17; tvector1w v18; - tvector1w v20; tvector1w v21; tvector1w v22; tvector1w v23; tvector1w v24; - tvector1w v25; tvector1w v26; tvector1w v27; tvector1w v28; - tvector1w v30; tvector1w v31; tvector1w v32; tvector1w v33; tvector1w v34; - tvector1w v35; tvector1w v36; tvector1w v37; tvector1w v38; - tvector1w v40; tvector1w v41; tvector1w v42; tvector1w v43; tvector1w v44; - tvector1w v45; tvector1w v46; tvector1w v47; tvector1w v48; - tvector1w v50; tvector1w v51; tvector1w v52; tvector1w v53; tvector1w v54; - tvector1w v55; tvector1w v56; tvector1w v57; tvector1w v58; - tvector1w v60; tvector1w v61; tvector1w v62; tvector1w v63; tvector1w v64; - tvector1w v65; tvector1w v66; tvector1w v67; tvector1w v68; - tvector1w v70; tvector1w v71; tvector1w v72; tvector1w v73; tvector1w v74; - tvector1w v75; tvector1w v76; tvector1w v77; tvector1w v78; - tvector1w v80; tvector1w v81; tvector1w v82; tvector1w v83; tvector1w v84; - tvector1w v85; tvector1w v86; tvector1w v87; tvector1w v88; -} s_1w_9x9_matrix; - -#define S_1W_9X9_MATRIX_DEFAULT ((s_1w_9x9_matrix)\ - { 0, 0, 0, 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, 0, 0, 0 }) - -typedef struct { - tvector1w v00; tvector1w v01; tvector1w v02; tvector1w v03; tvector1w v04; - tvector1w v05; tvector1w v06; - tvector1w v10; tvector1w v11; tvector1w v12; tvector1w v13; tvector1w v14; - tvector1w v15; tvector1w v16; - tvector1w v20; tvector1w v21; tvector1w v22; tvector1w v23; tvector1w v24; - tvector1w v25; tvector1w v26; - tvector1w v30; tvector1w v31; tvector1w v32; tvector1w v33; tvector1w v34; - tvector1w v35; tvector1w v36; - tvector1w v40; tvector1w v41; tvector1w v42; tvector1w v43; tvector1w v44; - tvector1w v45; tvector1w v46; - tvector1w v50; tvector1w v51; tvector1w v52; tvector1w v53; tvector1w v54; - tvector1w v55; tvector1w v56; - tvector1w v60; tvector1w v61; tvector1w v62; tvector1w v63; tvector1w v64; - tvector1w v65; tvector1w v66; -} s_1w_7x7_matrix; - -#define S_1W_7X7_MATRIX_DEFAULT ((s_1w_7x7_matrix)\ - { 0, 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, 0 }) - -typedef struct { - tvector1w v0_0; - tvector1w v0_1; - tvector1w v0_2; - tvector1w v0_3; - tvector1w v0_4; - tvector1w v0_5; - tvector1w v0_6; - tvector1w v0_7; - tvector1w v0_8; - tvector1w v0_9; - tvector1w v0_10; -} s_1w_1x11_matrix; - -#define S_1W_1X11_MATRIX_DEFAULT ((s_1w_1x11_matrix)\ - { 0, 0, 0, 0, 0, 0, 0, 0, 0 }) - -typedef struct { - tvector1w x_cord[MAX_CONFIG_POINTS]; - tvector1w slope[MAX_CONFIG_POINTS-1]; - tvector1w y_offset[MAX_CONFIG_POINTS-1]; -} ref_config_points; - -typedef struct { - tscalar1w_range1wbit slope_vec[CONFIG_UNIT_LUT_SIZE_32]; - tscalar1w_range1wbit offset_vec[CONFIG_UNIT_LUT_SIZE_32]; - tscalar1w_16bit x_cord_vec[CONFIG_UNIT_LUT_SIZE_32]; - tscalar1w_16bit x_cord_max; - tscalar1w_5bit exponent; - tscalar1w_5bit slope_resolution; -} xcu_ref_init_vectors; - -typedef struct { -#ifdef ISP2401 - tvector1w elem[IMAX32_ELEM_SIZE]; -} imax32_ref_in_vector; - -typedef struct { -#endif - tscalar1w search[BMA_SEARCH_BLOCK_SZ_16][BMA_SEARCH_BLOCK_SZ_16]; -} bma_16x16_search_window; - -typedef struct { - tscalar1w ref[BMA_REF_BLOCK_SZ_8][BMA_REF_BLOCK_SZ_8]; -} ref_block_8x8; - -typedef struct { - tscalar1w sads[SADS_16x16_1]; -} bma_output_16_1; - -typedef struct { - tscalar1w sads[SADS_16x16_2]; -} bma_output_16_2; - -typedef struct { - tscalar1w sads[SADS_14x14_2]; -} bma_output_14_2; - -typedef struct { - tscalar1w sads[SADS_14x14_1]; -} bma_output_14_1; - -typedef struct { - tvector1w spatial_weight_lut[BFA_MAX_KWAY]; /* spatial weight LUT */ - /* range weight LUT, (BFA_RW_LUT_SIZE + 1) numbers of LUT values are compressed in BFA_RW_LUT_SIZE buffer. - * range_weight_lut[k] = packed(drop[k], range_weight[k]) - * where, drop[k] = range_weight[k+1] - range_weight[k] - * pack(msb, lsb): two 8bits numbers packed in one 16bits number */ - tvector1w range_weight_lut[BFA_RW_LUT_SIZE]; -} bfa_weights; - -/* Return type for BFA BBBs */ -typedef struct { - tvector2w sop; /* weighted sum of pixels */ - tvector1w sow; /* sum of weights */ -} bfa_7x7_output; -#endif /* __REF_VECTOR_FUNC_TYPES_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/mpmath.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/mpmath.h deleted file mode 100644 index cd938375e02e..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/mpmath.h +++ /dev/null @@ -1,329 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __MPMATH_H_INCLUDED__ -#define __MPMATH_H_INCLUDED__ - - -#ifdef INLINE_MPMATH -#define STORAGE_CLASS_MPMATH_FUNC_H static inline -#define STORAGE_CLASS_MPMATH_DATA_H static inline_DATA -#else /* INLINE_MPMATH */ -#define STORAGE_CLASS_MPMATH_FUNC_H extern -#define STORAGE_CLASS_MPMATH_DATA_H extern_DATA -#endif /* INLINE_MPMATH */ - -#include <type_support.h> - -/* - * Implementation limits - */ -#define MIN_BITDEPTH 1 -#define MAX_BITDEPTH 64 - -#define ROUND_NEAREST_EVEN 0 -#define ROUND_NEAREST 1 - -/* - * The MP types - * - * "vector lane data" is scalar. With "scalar data" for limited range shift and address values - */ -typedef unsigned long long mpudata_t; /* Type of reference MP scalar / vector lane data; unsigned */ -typedef long long mpsdata_t; /* Type of reference MP scalar / vector lane data; signed */ -typedef unsigned short spudata_t; /* Type of reference SP scalar / vector lane data; unsigned */ -typedef short spsdata_t; /* Type of reference SP scalar / vector lane data; signed */ -typedef unsigned short bitdepth_t; - -typedef enum { - mp_zero_ID, - mp_one_ID, - mp_mone_ID, - mp_smin_ID, - mp_smax_ID, - mp_umin_ID, - mp_umax_ID, - N_mp_const_ID -} mp_const_ID_t; - -#ifdef ISP2401 -/* _isValidMpudata is for internal use by mpmath and bbb's. - * isValidMpudata is for external use by functions on top. - */ -#ifndef ENABLE_VALID_MP_DATA_CHECK -#define _isValidMpsdata(data,bitdepth) (1) -#define _isValidMpudata(data,bitdepth) (1) -#else -#define _isValidMpsdata(data,bitdepth) isValidMpsdata(data,bitdepth) -#define _isValidMpudata(data,bitdepth) isValidMpsdata(data,bitdepth) - -#endif -#endif -STORAGE_CLASS_MPMATH_FUNC_H bool isValidMpsdata( - const mpsdata_t data, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H bool isValidMpudata( - const mpudata_t data, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H mpsdata_t mp_castd ( - const mpsdata_t in0, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H mpsdata_t mp_casth ( - const mpsdata_t in0, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H mpsdata_t mp_scasth ( - const mpsdata_t in0, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H mpsdata_t mp_qcastd ( - const mpsdata_t in0, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H mpsdata_t mp_qcasth ( - const mpsdata_t in0, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H mpsdata_t mp_qrcasth ( - const mpsdata_t in0, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H mpsdata_t mp_abs ( - const mpsdata_t in0, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H mpsdata_t mp_limit ( - const mpsdata_t bnd_low, - const mpsdata_t in0, - const mpsdata_t bnd_high, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H mpsdata_t mp_max ( - const mpsdata_t in0, - const mpsdata_t in1, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H mpsdata_t mp_min ( - const mpsdata_t in0, - const mpsdata_t in1, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H mpsdata_t mp_mux ( - const spudata_t sel, - const mpsdata_t in0, - const mpsdata_t in1, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H mpsdata_t mp_rmux ( - const spudata_t sel, - const mpsdata_t in0, - const mpsdata_t in1, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H mpsdata_t mp_add ( - const mpsdata_t in0, - const mpsdata_t in1, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H mpsdata_t mp_sadd ( - const mpsdata_t in0, - const mpsdata_t in1, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H mpsdata_t mp_sub ( - const mpsdata_t in0, - const mpsdata_t in1, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H mpsdata_t mp_ssub ( - const mpsdata_t in0, - const mpsdata_t in1, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H mpsdata_t mp_addasr1 ( - const mpsdata_t in0, - const mpsdata_t in1, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H mpsdata_t mp_subasr1 ( - const mpsdata_t in0, - const mpsdata_t in1, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H mpsdata_t mp_lsr ( - const mpsdata_t in0, - const spsdata_t shft, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H mpsdata_t mp_asr ( - const mpsdata_t in0, - const spsdata_t shft, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H mpsdata_t mp_rasr ( - const mpsdata_t in0, - const spsdata_t shft, - const bitdepth_t bitdepth); - -/* "mp_rasr_u()" is implemented by "mp_rasr()" */ -STORAGE_CLASS_MPMATH_FUNC_H mpudata_t mp_rasr_u ( - const mpudata_t in0, - const spsdata_t shft, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H mpsdata_t mp_lsl ( - const mpsdata_t in0, - const spsdata_t shft, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H mpsdata_t mp_asl ( - const mpsdata_t in0, - const spsdata_t shft, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H mpsdata_t mp_muld ( - const mpsdata_t in0, - const mpsdata_t in1, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H mpsdata_t mp_mul ( - const mpsdata_t in0, - const mpsdata_t in1, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H mpsdata_t mp_qmul ( - const mpsdata_t in0, - const mpsdata_t in1, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H mpsdata_t mp_qrmul ( - const mpsdata_t in0, - const mpsdata_t in1, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H mpsdata_t mp_qdiv ( - const mpsdata_t in0, - const mpsdata_t in1, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H mpsdata_t mp_qdivh ( - const mpsdata_t in0, - const mpsdata_t in1, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H mpsdata_t mp_div ( - const mpsdata_t in0, - const mpsdata_t in1, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H mpsdata_t mp_divh ( - const mpsdata_t in0, - const mpsdata_t in1, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H mpsdata_t mp_and ( - const mpsdata_t in0, - const mpsdata_t in1, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H mpsdata_t mp_compl ( - const mpsdata_t in0, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H mpsdata_t mp_or ( - const mpsdata_t in0, - const mpsdata_t in1, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H mpsdata_t mp_xor ( - const mpsdata_t in0, - const mpsdata_t in1, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H spudata_t mp_isEQ ( - const mpsdata_t in0, - const mpsdata_t in1, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H spudata_t mp_isNE ( - const mpsdata_t in0, - const mpsdata_t in1, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H spudata_t mp_isGT ( - const mpsdata_t in0, - const mpsdata_t in1, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H spudata_t mp_isGE ( - const mpsdata_t in0, - const mpsdata_t in1, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H spudata_t mp_isLT ( - const mpsdata_t in0, - const mpsdata_t in1, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H spudata_t mp_isLE ( - const mpsdata_t in0, - const mpsdata_t in1, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H spudata_t mp_isEQZ ( - const mpsdata_t in0, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H spudata_t mp_isNEZ ( - const mpsdata_t in0, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H spudata_t mp_isGTZ ( - const mpsdata_t in0, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H spudata_t mp_isGEZ ( - const mpsdata_t in0, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H spudata_t mp_isLTZ ( - const mpsdata_t in0, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H spudata_t mp_isLEZ ( - const mpsdata_t in0, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H mpsdata_t mp_const ( - const mp_const_ID_t ID, - const bitdepth_t bitdepth); - -STORAGE_CLASS_MPMATH_FUNC_H mpudata_t mp_sqrt_u( - const mpudata_t in0, - const bitdepth_t bitdepth); - -#ifndef INLINE_MPMATH -#define STORAGE_CLASS_MPMATH_FUNC_C -#define STORAGE_CLASS_MPMATH_DATA_C const -#else /* INLINE_MPMATH */ -#define STORAGE_CLASS_MPMATH_FUNC_C STORAGE_CLASS_MPMATH_FUNC_H -#define STORAGE_CLASS_MPMATH_DATA_C STORAGE_CLASS_MPMATH_DATA_H -#include "mpmath.c" -#define MPMATH_INLINED -#endif /* INLINE_MPMATH */ - -#endif /* __MPMATH_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/osys.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/osys.h deleted file mode 100644 index a607242c5f1a..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/osys.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __OSYS_H_INCLUDED__ -#define __OSYS_H_INCLUDED__ - -/* - * This file is included on every cell {SP,ISP,host} and on every system - * that uses the OSYS device. It defines the API to DLI bridge - * - * System and cell specific interfaces and inline code are included - * conditionally through Makefile path settings. - * - * - . system and cell agnostic interfaces, constants and identifiers - * - public: system agnostic, cell specific interfaces - * - private: system dependent, cell specific interfaces & inline implementations - * - global: system specific constants and identifiers - * - local: system and cell specific constants and identifiers - * - */ - - -#include "system_local.h" -#include "osys_local.h" - -#ifndef __INLINE_OSYS__ -#define STORAGE_CLASS_OSYS_H extern -#define STORAGE_CLASS_OSYS_C -#include "osys_public.h" -#else /* __INLINE_OSYS__ */ -#define STORAGE_CLASS_OSYS_H static inline -#define STORAGE_CLASS_OSYS_C static inline -#include "osys_private.h" -#endif /* __INLINE_OSYS__ */ - -#endif /* __OSYS_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/stream_buffer.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/stream_buffer.h deleted file mode 100644 index 53d535e4f2ae..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/stream_buffer.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __STREAM_BUFFER_H_INCLUDED__ -#define __STREAM_BUFFER_H_INCLUDED__ - -/* - * This file is included on every cell {SP,ISP,host} and on every system - * that uses the DMA device. It defines the API to DLI bridge - * - * System and cell specific interfaces and inline code are included - * conditionally through Makefile path settings. - * - * - . system and cell agnostic interfaces, constants and identifiers - * - public: system agnostic, cell specific interfaces - * - private: system dependent, cell specific interfaces & inline implementations - * - global: system specific constants and identifiers - * - local: system and cell specific constants and identifiers - * - */ - - -#include "system_local.h" -#include "stream_buffer_local.h" - -#ifndef __INLINE_STREAM_BUFFER__ -#define STORAGE_CLASS_STREAM_BUFFER_H extern -#define STORAGE_CLASS_STREAM_BUFFER_C -#include "stream_buffer_public.h" -#else /* __INLINE_STREAM_BUFFER__ */ -#define STORAGE_CLASS_STREAM_BUFFER_H static inline -#define STORAGE_CLASS_STREAM_BUFFER_C static inline -#include "stream_buffer_private.h" -#endif /* __INLINE_STREAM_BUFFER__ */ - -#endif /* __STREAM_BUFFER_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/vector_func.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/vector_func.h deleted file mode 100644 index 5368b9062897..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/vector_func.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __VECTOR_FUNC_H_INCLUDED__ -#define __VECTOR_FUNC_H_INCLUDED__ - - -/* TODO: Later filters will be moved to types directory, - * and we should only include matrix_MxN types */ -#include "filters/filters_1.0/filter_2x2.h" -#include "filters/filters_1.0/filter_3x3.h" -#include "filters/filters_1.0/filter_4x4.h" -#include "filters/filters_1.0/filter_5x5.h" - -#include "vector_func_local.h" - -#ifndef __INLINE_VECTOR_FUNC__ -#define STORAGE_CLASS_VECTOR_FUNC_H extern -#define STORAGE_CLASS_VECTOR_FUNC_C -#include "vector_func_public.h" -#else /* __INLINE_VECTOR_FUNC__ */ -#define STORAGE_CLASS_VECTOR_FUNC_H static inline -#define STORAGE_CLASS_VECTOR_FUNC_C static inline -#include "vector_func_private.h" -#endif /* __INLINE_VECTOR_FUNC__ */ - -#endif /* __VECTOR_FUNC_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/vector_ops.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/vector_ops.h deleted file mode 100644 index 4923f2d5518b..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/vector_ops.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __VECTOR_OPS_H_INCLUDED__ -#define __VECTOR_OPS_H_INCLUDED__ - - -#include "vector_ops_local.h" - -#ifndef __INLINE_VECTOR_OPS__ -#define STORAGE_CLASS_VECTOR_OPS_H extern -#define STORAGE_CLASS_VECTOR_OPS_C -#include "vector_ops_public.h" -#else /* __INLINE_VECTOR_OPS__ */ -#define STORAGE_CLASS_VECTOR_OPS_H static inline -#define STORAGE_CLASS_VECTOR_OPS_C static inline -#include "vector_ops_private.h" -#endif /* __INLINE_VECTOR_OPS__ */ - -#endif /* __VECTOR_OPS_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/xmem.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/xmem.h deleted file mode 100644 index 13083fe55141..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/xmem.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __XMEM_H_INCLUDED__ -#define __XMEM_H_INCLUDED__ - -/* - * This file is included on every cell {SP,ISP,host} and on every system - * that uses the XMEM device. It defines the API to DLI bridge - * - * System and cell specific interfaces and inline code are included - * conditionally through Makefile path settings. - * - * - . system and cell agnostic interfaces, constants and identifiers - * - public: system agnostic, cell specific interfaces - * - private: system dependent, cell specific interfaces & inline implementations - * - global: system specific constants and identifiers - * - local: system and cell specific constants and identifiers - */ - - -#include "system_local.h" -#include "xmem_local.h" - -#ifndef __INLINE_XMEM__ -#define STORAGE_CLASS_XMEM_H extern -#define STORAGE_CLASS_XMEM_C -#include "xmem_public.h" -#else /* __INLINE_XMEM__ */ -#define STORAGE_CLASS_XMEM_H static inline -#define STORAGE_CLASS_XMEM_C static inline -#include "xmem_private.h" -#endif /* __INLINE_XMEM__ */ - -#endif /* __XMEM_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_shared/socket_global.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_shared/socket_global.h deleted file mode 100644 index 2b7025e90250..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_shared/socket_global.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __SOCKET_GLOBAL_H_INCLUDED__ -#define __SOCKET_GLOBAL_H_INCLUDED__ - -#include "stream_buffer.h" - -/* define the socket port direction */ -typedef enum { - SOCKET_PORT_DIRECTION_NULL, - SOCKET_PORT_DIRECTION_IN, - SOCKET_PORT_DIRECTION_OUT -} socket_port_direction_t; - -/* pointer to the port's callout function */ -typedef void (*socket_port_callout_fp)(void); -typedef struct socket_port_s socket_port_t; -typedef struct socket_s socket_t; - -/* data structure of the socket port */ -struct socket_port_s { - unsigned channel; /* the port entity */ - socket_port_direction_t direction; /* the port direction */ - socket_port_callout_fp callout; /* the port callout function */ - - socket_t *socket; /* point to the socket */ - - struct { - unsigned data; - } buf; /* the buffer at the port */ -}; - -/* data structure of the socket */ -struct socket_s { - socket_port_t *in; /* the in-direction port */ - socket_port_t *out; /* the out-direction port */ - stream_buffer_t buf; /* the buffer between in-ports and out-ports */ -}; - -#endif /* __SOCKET_GLOBAL_H_INCLUDED__ */ - diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_shared/stream_buffer_global.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_shared/stream_buffer_global.h deleted file mode 100644 index b9664b9608dc..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_shared/stream_buffer_global.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __STREAM_BUFFER_GLOBAL_H_INCLUDED__ -#define __STREAM_BUFFER_GLOBAL_H_INCLUDED__ - -typedef struct stream_buffer_s stream_buffer_t; -struct stream_buffer_s { - unsigned base; - unsigned limit; - unsigned top; -}; - -#endif /* __STREAM_BUFFER_GLOBAL_H_INCLUDED__ */ - diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_frame_public.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_frame_public.h index ba7a076c3afa..0beb7347a4f3 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_frame_public.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_frame_public.h @@ -121,15 +121,9 @@ struct ia_css_frame_info { }; #define IA_CSS_BINARY_DEFAULT_FRAME_INFO \ -{ \ - {0, /* width */ \ - 0}, /* height */ \ - 0, /* padded_width */ \ - IA_CSS_FRAME_FORMAT_NUM, /* format */ \ - 0, /* raw_bit_depth */ \ - IA_CSS_BAYER_ORDER_NUM, /* raw_bayer_order */ \ - {0, /*start col */ \ - 0}, /*start line */ \ +(struct ia_css_frame_info) { \ + .format = IA_CSS_FRAME_FORMAT_NUM, \ + .raw_bayer_order = IA_CSS_BAYER_ORDER_NUM, \ } /** @@ -190,18 +184,11 @@ struct ia_css_frame { }; #define DEFAULT_FRAME \ -{ \ - IA_CSS_BINARY_DEFAULT_FRAME_INFO, /* info */ \ - 0, /* data */ \ - 0, /* data_bytes */ \ - SH_CSS_INVALID_QUEUE_ID, /* dynamic_data_index */ \ - IA_CSS_BUFFER_TYPE_INVALID, /* buf_type */ \ - IA_CSS_FRAME_FLASH_STATE_NONE, /* flash_state */ \ - 0, /* exp_id */ \ - 0, /* isp_config_id */ \ - false, /* valid */ \ - false, /* contiguous */ \ - { 0 } /* planes */ \ +(struct ia_css_frame) { \ + .info = IA_CSS_BINARY_DEFAULT_FRAME_INFO, \ + .dynamic_queue_id = SH_CSS_INVALID_QUEUE_ID, \ + .buf_type = IA_CSS_BUFFER_TYPE_INVALID, \ + .flash_state = IA_CSS_FRAME_FLASH_STATE_NONE, \ } /* @brief Fill a frame with zeros diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_pipe.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_pipe.h index d0c0e6b92025..f6870fa7a18c 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_pipe.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_pipe.h @@ -33,22 +33,17 @@ struct ia_css_preview_settings { /* 2401 only for these two - do we in fact use them for anything real */ struct ia_css_frame *delay_frames[MAX_NUM_DELAY_FRAMES]; struct ia_css_frame *tnr_frames[NUM_TNR_FRAMES]; - + struct ia_css_pipe *copy_pipe; struct ia_css_pipe *capture_pipe; struct ia_css_pipe *acc_pipe; }; #define IA_CSS_DEFAULT_PREVIEW_SETTINGS \ -{ \ - IA_CSS_BINARY_DEFAULT_SETTINGS, /* copy_binary */\ - IA_CSS_BINARY_DEFAULT_SETTINGS, /* preview_binary */\ - IA_CSS_BINARY_DEFAULT_SETTINGS, /* vf_pp_binary */\ - { NULL }, /* dvs_frames */ \ - { NULL }, /* tnr_frames */ \ - NULL, /* copy_pipe */\ - NULL, /* capture_pipe */\ - NULL, /* acc_pipe */\ +(struct ia_css_preview_settings) { \ + .copy_binary = IA_CSS_BINARY_DEFAULT_SETTINGS, \ + .preview_binary = IA_CSS_BINARY_DEFAULT_SETTINGS, \ + .vf_pp_binary = IA_CSS_BINARY_DEFAULT_SETTINGS, \ } struct ia_css_capture_settings { @@ -70,20 +65,15 @@ struct ia_css_capture_settings { }; #define IA_CSS_DEFAULT_CAPTURE_SETTINGS \ -{ \ - IA_CSS_BINARY_DEFAULT_SETTINGS, /* copy_binary */\ - {IA_CSS_BINARY_DEFAULT_SETTINGS}, /* primary_binary */\ - 0, /* num_primary_stage */\ - IA_CSS_BINARY_DEFAULT_SETTINGS, /* pre_isp_binary */\ - IA_CSS_BINARY_DEFAULT_SETTINGS, /* anr_gdc_binary */\ - IA_CSS_BINARY_DEFAULT_SETTINGS, /* post_isp_binary */\ - IA_CSS_BINARY_DEFAULT_SETTINGS, /* capture_pp_binary */\ - IA_CSS_BINARY_DEFAULT_SETTINGS, /* vf_pp_binary */\ - IA_CSS_BINARY_DEFAULT_SETTINGS, /* capture_ldc_binary */\ - NULL, /* yuv_scaler_binary */ \ - { NULL }, /* delay_frames[ref_frames] */ \ - NULL, /* is_output_stage */ \ - 0, /* num_yuv_scaler */ \ +(struct ia_css_capture_settings) { \ + .copy_binary = IA_CSS_BINARY_DEFAULT_SETTINGS, \ + .primary_binary = {IA_CSS_BINARY_DEFAULT_SETTINGS}, \ + .pre_isp_binary = IA_CSS_BINARY_DEFAULT_SETTINGS, \ + .anr_gdc_binary = IA_CSS_BINARY_DEFAULT_SETTINGS, \ + .post_isp_binary = IA_CSS_BINARY_DEFAULT_SETTINGS, \ + .capture_pp_binary = IA_CSS_BINARY_DEFAULT_SETTINGS, \ + .vf_pp_binary = IA_CSS_BINARY_DEFAULT_SETTINGS, \ + .capture_ldc_binary = IA_CSS_BINARY_DEFAULT_SETTINGS, \ } struct ia_css_video_settings { @@ -105,18 +95,10 @@ struct ia_css_video_settings { }; #define IA_CSS_DEFAULT_VIDEO_SETTINGS \ -{ \ - IA_CSS_BINARY_DEFAULT_SETTINGS, /* copy_binary */ \ - IA_CSS_BINARY_DEFAULT_SETTINGS, /* video_binary */ \ - IA_CSS_BINARY_DEFAULT_SETTINGS, /* vf_pp_binary */ \ - NULL, /* yuv_scaler_binary */ \ - { NULL }, /* delay_frames */ \ - { NULL }, /* tnr_frames */ \ - NULL, /* vf_pp_in_frame */ \ - NULL, /* copy_pipe */ \ - NULL, /* capture_pipe */ \ - NULL, /* is_output_stage */ \ - 0, /* num_yuv_scaler */ \ +(struct ia_css_video_settings) { \ + .copy_binary = IA_CSS_BINARY_DEFAULT_SETTINGS, \ + .video_binary = IA_CSS_BINARY_DEFAULT_SETTINGS, \ + .vf_pp_binary = IA_CSS_BINARY_DEFAULT_SETTINGS, \ } struct ia_css_yuvpp_settings { @@ -130,14 +112,8 @@ struct ia_css_yuvpp_settings { }; #define IA_CSS_DEFAULT_YUVPP_SETTINGS \ -{ \ - IA_CSS_BINARY_DEFAULT_SETTINGS, /* copy_binary */ \ - NULL, /* yuv_scaler_binary */ \ - NULL, /* vf_pp_binary */ \ - NULL, /* is_output_stage */ \ - 0, /* num_yuv_scaler */ \ - 0, /* num_vf_pp */ \ - 0, /* num_output */ \ +(struct ia_css_yuvpp_settings) { \ + .copy_binary = IA_CSS_BINARY_DEFAULT_SETTINGS, \ } struct osys_object; @@ -185,35 +161,26 @@ struct ia_css_pipe { }; #define IA_CSS_DEFAULT_PIPE \ -{ \ - false, /* stop_requested */ \ - DEFAULT_PIPE_CONFIG, /* config */ \ - DEFAULT_PIPE_EXTRA_CONFIG, /* extra_config */ \ - DEFAULT_PIPE_INFO, /* info */ \ - IA_CSS_PIPE_ID_ACC, /* mode (pipe_id) */ \ - NULL, /* shading_table */ \ - DEFAULT_PIPELINE, /* pipeline */ \ - {IA_CSS_BINARY_DEFAULT_FRAME_INFO}, /* output_info */ \ - IA_CSS_BINARY_DEFAULT_FRAME_INFO, /* bds_output_info */ \ - {IA_CSS_BINARY_DEFAULT_FRAME_INFO}, /* vf_output_info */ \ - IA_CSS_BINARY_DEFAULT_FRAME_INFO, /* out_yuv_ds_input_info */ \ - IA_CSS_BINARY_DEFAULT_FRAME_INFO, /* vf_yuv_ds_input_info */ \ - NULL, /* output_stage */ \ - NULL, /* vf_stage */ \ - SH_CSS_BDS_FACTOR_1_00, /* required_bds_factor */ \ - 1, /* dvs_frame_delay */ \ - 0, /* num_invalid_frames */ \ - {true}, /* enable_viewfinder */ \ - NULL, /* stream */ \ - DEFAULT_FRAME, /* in_frame_struct */ \ - DEFAULT_FRAME, /* out_frame_struct */ \ - DEFAULT_FRAME, /* vf_frame_struct */ \ - { NULL }, /* continuous_frames */ \ - { NULL }, /* cont_md_buffers */ \ - { IA_CSS_DEFAULT_PREVIEW_SETTINGS }, /* pipe_settings */ \ - 0, /* scaler_pp_lut */ \ - NULL, /* osys object */ \ - PIPE_ENTRY_EMPTY_TOKEN, /* pipe_num */\ +(struct ia_css_pipe) { \ + .config = DEFAULT_PIPE_CONFIG, \ + .info = DEFAULT_PIPE_INFO, \ + .mode = IA_CSS_PIPE_ID_ACC, /* (pipe_id) */ \ + .pipeline = DEFAULT_PIPELINE, \ + .output_info = {IA_CSS_BINARY_DEFAULT_FRAME_INFO}, \ + .bds_output_info = IA_CSS_BINARY_DEFAULT_FRAME_INFO, \ + .vf_output_info = {IA_CSS_BINARY_DEFAULT_FRAME_INFO}, \ + .out_yuv_ds_input_info = IA_CSS_BINARY_DEFAULT_FRAME_INFO, \ + .vf_yuv_ds_input_info = IA_CSS_BINARY_DEFAULT_FRAME_INFO, \ + .required_bds_factor = SH_CSS_BDS_FACTOR_1_00, \ + .dvs_frame_delay = 1, \ + .enable_viewfinder = {true}, \ + .in_frame_struct = DEFAULT_FRAME, \ + .out_frame_struct = DEFAULT_FRAME, \ + .vf_frame_struct = DEFAULT_FRAME, \ + .pipe_settings = { \ + .preview = IA_CSS_DEFAULT_PREVIEW_SETTINGS \ + }, \ + .pipe_num = PIPE_ENTRY_EMPTY_TOKEN, \ } void ia_css_pipe_map_queue(struct ia_css_pipe *pipe, bool map); diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_pipe_public.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_pipe_public.h index df0aad9a6ab9..11225d5ac442 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_pipe_public.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_pipe_public.h @@ -152,82 +152,20 @@ struct ia_css_pipe_config { }; -#ifdef ISP2401 -/** - * Default origin of internal frame positioned on shading table. - */ -#define IA_CSS_PIPE_DEFAULT_INTERNAL_FRAME_ORIGIN_BQS_ON_SCTBL \ -{ \ - 0, /* x [bqs] */ \ - 0 /* y [bqs] */ \ -} - -/** - * Default settings for newly created pipe configurations. - */ -#define DEFAULT_PIPE_CONFIG \ -{ \ - IA_CSS_PIPE_MODE_PREVIEW, /* mode */ \ - 1, /* isp_pipe_version */ \ - { 0, 0 }, /* pipe_effective_input_res */ \ - { 0, 0 }, /* bayer_ds_out_res */ \ - { 0, 0 }, /* vf_pp_in_res */ \ - { 0, 0 }, /* capt_pp_in_res */ \ - { 0, 0 }, /* output_system_in_res */ \ - { 0, 0 }, /* dvs_crop_out_res */ \ - {IA_CSS_BINARY_DEFAULT_FRAME_INFO}, /* output_info */ \ - {IA_CSS_BINARY_DEFAULT_FRAME_INFO}, /* vf_output_info */ \ - NULL, /* acc_extension */ \ - NULL, /* acc_stages */ \ - 0, /* num_acc_stages */ \ - DEFAULT_CAPTURE_CONFIG, /* default_capture_config */ \ - { 0, 0 }, /* dvs_envelope */ \ - IA_CSS_FRAME_DELAY_1, /* dvs_frame_delay */ \ - -1, /* acc_num_execs */ \ - false, /* enable_dz */ \ - false, /* enable_dpc */ \ - false, /* enable_vfpp_bci */ \ - false, /* enable_luma_only */ \ - false, /* enable_tnr */ \ - NULL, /* p_isp_config */\ - { 0, 0 }, /* gdc_in_buffer_res */ \ - { 0, 0 }, /* gdc_in_buffer_offset */ \ - IA_CSS_PIPE_DEFAULT_INTERNAL_FRAME_ORIGIN_BQS_ON_SCTBL /* internal_frame_origin_bqs_on_sctbl */ \ -} - -#else - /** * Default settings for newly created pipe configurations. */ #define DEFAULT_PIPE_CONFIG \ -{ \ - IA_CSS_PIPE_MODE_PREVIEW, /* mode */ \ - 1, /* isp_pipe_version */ \ - { 0, 0 }, /* pipe_effective_input_res */ \ - { 0, 0 }, /* bayer_ds_out_res */ \ - { 0, 0 }, /* vf_pp_in_res */ \ - { 0, 0 }, /* capt_pp_in_res */ \ - { 0, 0 }, /* dvs_crop_out_res */ \ - {IA_CSS_BINARY_DEFAULT_FRAME_INFO}, /* output_info */ \ - {IA_CSS_BINARY_DEFAULT_FRAME_INFO}, /* vf_output_info */ \ - NULL, /* acc_extension */ \ - NULL, /* acc_stages */ \ - 0, /* num_acc_stages */ \ - DEFAULT_CAPTURE_CONFIG, /* default_capture_config */ \ - { 0, 0 }, /* dvs_envelope */ \ - IA_CSS_FRAME_DELAY_1, /* dvs_frame_delay */ \ - -1, /* acc_num_execs */ \ - false, /* enable_dz */ \ - false, /* enable_dpc */ \ - false, /* enable_vfpp_bci */ \ - NULL, /* p_isp_config */\ - { 0, 0 }, /* gdc_in_buffer_res */ \ - { 0, 0 } /* gdc_in_buffer_offset */ \ +(struct ia_css_pipe_config) { \ + .mode = IA_CSS_PIPE_MODE_PREVIEW, \ + .isp_pipe_version = 1, \ + .output_info = {IA_CSS_BINARY_DEFAULT_FRAME_INFO}, \ + .vf_output_info = {IA_CSS_BINARY_DEFAULT_FRAME_INFO}, \ + .default_capture_config = DEFAULT_CAPTURE_CONFIG, \ + .dvs_frame_delay = IA_CSS_FRAME_DELAY_1, \ + .acc_num_execs = -1, \ } -#endif - /* Pipe info, this struct describes properties of a pipe after it's stream has * been created. * ~~~** DO NOT ADD NEW FIELD **~~~ This structure will be deprecated. @@ -272,33 +210,15 @@ struct ia_css_pipe_info { /** * Defaults for ia_css_pipe_info structs. */ -#ifdef ISP2401 - -#define DEFAULT_PIPE_INFO \ -{ \ - {IA_CSS_BINARY_DEFAULT_FRAME_INFO}, /* output_info */ \ - {IA_CSS_BINARY_DEFAULT_FRAME_INFO}, /* vf_output_info */ \ - IA_CSS_BINARY_DEFAULT_FRAME_INFO, /* raw_output_info */ \ - { 0, 0}, /* output system in res */ \ - DEFAULT_SHADING_INFO, /* shading_info */ \ - DEFAULT_GRID_INFO, /* grid_info */ \ - 0 /* num_invalid_frames */ \ -} - -#else - #define DEFAULT_PIPE_INFO \ -{ \ - {IA_CSS_BINARY_DEFAULT_FRAME_INFO}, /* output_info */ \ - {IA_CSS_BINARY_DEFAULT_FRAME_INFO}, /* vf_output_info */ \ - IA_CSS_BINARY_DEFAULT_FRAME_INFO, /* raw_output_info */ \ - DEFAULT_SHADING_INFO, /* shading_info */ \ - DEFAULT_GRID_INFO, /* grid_info */ \ - 0 /* num_invalid_frames */ \ +(struct ia_css_pipe_info) { \ + .output_info = {IA_CSS_BINARY_DEFAULT_FRAME_INFO}, \ + .vf_output_info = {IA_CSS_BINARY_DEFAULT_FRAME_INFO}, \ + .raw_output_info = IA_CSS_BINARY_DEFAULT_FRAME_INFO, \ + .shading_info = DEFAULT_SHADING_INFO, \ + .grid_info = DEFAULT_GRID_INFO, \ } -#endif - /* @brief Load default pipe configuration * @param[out] pipe_config The pipe configuration. * @return None @@ -402,7 +322,7 @@ ia_css_pipe_set_isp_config(struct ia_css_pipe *pipe, exception holds for IA_CSS_EVENT_TYPE_PORT_EOF, for this event an IRQ is always raised. Note that events are still queued and the Host can poll for them. The - or_mask and and_mask may be be active at the same time\n + or_mask and and_mask may be active at the same time\n \n Default values, for all pipe id's, after ia_css_init:\n or_mask = IA_CSS_EVENT_TYPE_ALL\n diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_types.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_types.h index 725b90072cfe..259ab3f074ba 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_types.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_types.h @@ -370,52 +370,20 @@ struct ia_css_shading_info { } info; }; -#ifndef ISP2401 - -/* Default Shading Correction information of Shading Correction Type 1. */ -#define DEFAULT_SHADING_INFO_TYPE_1 \ -{ \ - IA_CSS_SHADING_CORRECTION_TYPE_1, /* type */ \ - { /* info */ \ - { \ - 0, /* enable */ \ - 0, /* num_hor_grids */ \ - 0, /* num_ver_grids */ \ - 0, /* bqs_per_grid_cell */ \ - 1, /* bayer_scale_hor_ratio_in */ \ - 1, /* bayer_scale_hor_ratio_out */ \ - 1, /* bayer_scale_ver_ratio_in */ \ - 1, /* bayer_scale_ver_ratio_out */ \ - 0, /* sc_bayer_origin_x_bqs_on_shading_table */ \ - 0 /* sc_bayer_origin_y_bqs_on_shading_table */ \ - } \ - } \ -} - -#else - /* Default Shading Correction information of Shading Correction Type 1. */ #define DEFAULT_SHADING_INFO_TYPE_1 \ -{ \ - IA_CSS_SHADING_CORRECTION_TYPE_1, /* type */ \ - { /* info */ \ - { \ - 0, /* num_hor_grids */ \ - 0, /* num_ver_grids */ \ - 0, /* bqs_per_grid_cell */ \ - 1, /* bayer_scale_hor_ratio_in */ \ - 1, /* bayer_scale_hor_ratio_out */ \ - 1, /* bayer_scale_ver_ratio_in */ \ - 1, /* bayer_scale_ver_ratio_out */ \ - {0, 0}, /* isp_input_sensor_data_res_bqs */ \ - {0, 0}, /* sensor_data_res_bqs */ \ - {0, 0} /* sensor_data_origin_bqs_on_sctbl */ \ +(struct ia_css_shading_info) { \ + .type = IA_CSS_SHADING_CORRECTION_TYPE_1, \ + .info = { \ + .type_1 = { \ + .bayer_scale_hor_ratio_in = 1, \ + .bayer_scale_hor_ratio_out = 1, \ + .bayer_scale_ver_ratio_in = 1, \ + .bayer_scale_ver_ratio_out = 1, \ } \ } \ } -#endif - /* Default Shading Correction information. */ #define DEFAULT_SHADING_INFO DEFAULT_SHADING_INFO_TYPE_1 @@ -438,12 +406,9 @@ struct ia_css_grid_info { /* defaults for ia_css_grid_info structs */ #define DEFAULT_GRID_INFO \ -{ \ - 0, /* isp_in_width */ \ - 0, /* isp_in_height */ \ - DEFAULT_3A_GRID_INFO, /* s3a_grid */ \ - DEFAULT_DVS_GRID_INFO, /* dvs_grid */ \ - IA_CSS_VAMEM_TYPE_1 /* vamem_type */ \ +(struct ia_css_grid_info) { \ + .dvs_grid = DEFAULT_DVS_GRID_INFO, \ + .vamem_type = IA_CSS_VAMEM_TYPE_1 \ } /* Morphing table, used for geometric distortion and chromatic abberration @@ -534,11 +499,8 @@ struct ia_css_capture_config { /* default settings for ia_css_capture_config structs */ #define DEFAULT_CAPTURE_CONFIG \ -{ \ - IA_CSS_CAPTURE_MODE_PRIMARY, /* mode (capture) */ \ - false, /* enable_xnr */ \ - false, /* enable_raw_output */ \ - false /* enable_capture_pp_bli */ \ +(struct ia_css_capture_config) { \ + .mode = IA_CSS_CAPTURE_MODE_PRIMARY, \ } diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/aa/aa_2/ia_css_aa2_state.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/aa/aa_2/ia_css_aa2_state.h deleted file mode 100644 index cc404018b112..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/aa/aa_2/ia_css_aa2_state.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __IA_CSS_AA2_STATE_H -#define __IA_CSS_AA2_STATE_H - -#include "type_support.h" -#include "vmem.h" /* for VMEM_ARRAY*/ - -/* Denotes the maximum number of pixels per line that can be processed: -* MAX_AA_VECTORS_PER_LINE = maximum_line_width / ISP_NWAY */ -#ifndef MAX_AA_VECTORS_PER_LINE -#error Please define MAX_AA_VECTORS_PER_LINE. -#endif - -/* This uses 2 history lines for both y, u and v*/ -#define AA_STATE_Y_BUFFER_HEIGHT 2 -#define AA_STATE_UV_BUFFER_HEIGHT 2 -#define AA_STATE_Y_BUFFER_WIDTH MAX_AA_VECTORS_PER_LINE -/* The number of u and v elements is half y due to yuv420 downsampling. */ -#define AA_STATE_UV_BUFFER_WIDTH (AA_STATE_Y_BUFFER_WIDTH/2) - - -struct ia_css_isp_aa_vmem_state { - VMEM_ARRAY(y[AA_STATE_Y_BUFFER_HEIGHT], AA_STATE_Y_BUFFER_WIDTH*ISP_NWAY); - VMEM_ARRAY(u[AA_STATE_UV_BUFFER_HEIGHT], AA_STATE_UV_BUFFER_WIDTH*ISP_NWAY); - VMEM_ARRAY(v[AA_STATE_UV_BUFFER_HEIGHT], AA_STATE_UV_BUFFER_WIDTH*ISP_NWAY); -}; - -#endif /* __IA_CSS_AA2_STATE_H */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bayer_ls/bayer_ls_1.0/ia_css_bayer_load_param.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bayer_ls/bayer_ls_1.0/ia_css_bayer_load_param.h deleted file mode 100644 index 8e1f300bcd39..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bayer_ls/bayer_ls_1.0/ia_css_bayer_load_param.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __IA_CSS_BAYER_LOAD_PARAM_H -#define __IA_CSS_BAYER_LOAD_PARAM_H - -#include "ia_css_bayer_ls_param.h" - -#endif /* __IA_CSS_BAYER_LOAD_PARAM_H */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bayer_ls/bayer_ls_1.0/ia_css_bayer_ls_param.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bayer_ls/bayer_ls_1.0/ia_css_bayer_ls_param.h deleted file mode 100644 index a0d355454aa3..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bayer_ls/bayer_ls_1.0/ia_css_bayer_ls_param.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __IA_CSS_BAYER_LS_PARAM_H -#define __IA_CSS_BAYER_LS_PARAM_H - -#include "type_support.h" -#ifndef ISP2401 - -#define NUM_BAYER_LS 2 -#define BAYER_IDX_GR 0 -#define BAYER_IDX_R 1 -#define BAYER_IDX_B 2 -#define BAYER_IDX_GB 3 -#define BAYER_QUAD_WIDTH 2 -#define BAYER_QUAD_HEIGHT 2 -#define NOF_BAYER_VECTORS 4 - -/* bayer load/store */ -struct sh_css_isp_bayer_ls_isp_config { - uint32_t base_address[NUM_BAYER_LS]; - uint32_t width[NUM_BAYER_LS]; - uint32_t height[NUM_BAYER_LS]; - uint32_t stride[NUM_BAYER_LS]; -}; - -#else -#include "../../io_ls/common/ia_css_common_io_types.h" -#endif - -#endif /* __IA_CSS_BAYER_LS_PARAM_H */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bayer_ls/bayer_ls_1.0/ia_css_bayer_store_param.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bayer_ls/bayer_ls_1.0/ia_css_bayer_store_param.h deleted file mode 100644 index f330be80efa6..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bayer_ls/bayer_ls_1.0/ia_css_bayer_store_param.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __IA_CSS_BAYER_STORE_PARAM_H -#define __IA_CSS_BAYER_STORE_PARAM_H - -#include "ia_css_bayer_ls_param.h" - - -#endif /* __IA_CSS_BAYER_STORE_PARAM_H */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bnlm/ia_css_bnlm_state.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bnlm/ia_css_bnlm_state.h deleted file mode 100644 index 79cce0e40e82..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bnlm/ia_css_bnlm_state.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __IA_CSS_BNLM_STATE_H -#define __IA_CSS_BNLM_STATE_H - - -#include "type_support.h" -#include "vmem.h" /* for VMEM_ARRAY*/ -#include "bnlm.isp.h" - -struct bnlm_vmem_state { - /* State buffers required for BNLM */ - VMEM_ARRAY(buf[BNLM_STATE_BUF_HEIGHT], BNLM_STATE_BUF_WIDTH*ISP_NWAY); -}; - - - -#endif /* __IA_CSS_BNLM_STATE_H */ - diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/cnr/cnr_1.0/ia_css_cnr_state.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/cnr/cnr_1.0/ia_css_cnr_state.h deleted file mode 100644 index 795fba76bb20..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/cnr/cnr_1.0/ia_css_cnr_state.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __IA_CSS_CNR_STATE_H -#define __IA_CSS_CNR_STATE_H - -#include "type_support.h" - -#include "vmem.h" - -typedef struct -{ - VMEM_ARRAY(u, ISP_NWAY); - VMEM_ARRAY(v, ISP_NWAY); -} s_cnr_buf; - -/* CNR (color noise reduction) */ -struct sh_css_isp_cnr_vmem_state { - s_cnr_buf cnr_buf[2][MAX_VECTORS_PER_BUF_LINE/2]; -}; - -#endif /* __IA_CSS_CNR_STATE_H */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/cnr/cnr_2/ia_css_cnr_state.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/cnr/cnr_2/ia_css_cnr_state.h deleted file mode 100644 index e533e2fa8cd5..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/cnr/cnr_2/ia_css_cnr_state.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __IA_CSS_CNR2_STATE_H -#define __IA_CSS_CNR2_STATE_H - -#include "type_support.h" -#include "vmem.h" - -typedef struct -{ - VMEM_ARRAY(y, (MAX_VECTORS_PER_BUF_LINE/2)*ISP_NWAY); - VMEM_ARRAY(u, (MAX_VECTORS_PER_BUF_LINE/2)*ISP_NWAY); - VMEM_ARRAY(v, (MAX_VECTORS_PER_BUF_LINE/2)*ISP_NWAY); -} s_cnr_buf; - -/* CNR (color noise reduction) */ -struct sh_css_isp_cnr_vmem_state { - s_cnr_buf cnr_buf; -}; - -#endif /* __IA_CSS_CNR2_STATE_H */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dp/dp_1.0/ia_css_dp_state.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dp/dp_1.0/ia_css_dp_state.h deleted file mode 100644 index f832b3697908..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dp/dp_1.0/ia_css_dp_state.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __IA_CSS_DP_STATE_H -#define __IA_CSS_DP_STATE_H - -#include "type_support.h" - -#include "vmem.h" -#ifndef ISP2401 -#if NEED_BDS_OTHER_THAN_1_00 -#else -#if ENABLE_FIXED_BAYER_DS -#endif -#define MAX_VECTORS_PER_DP_LINE MAX_VECTORS_PER_BUF_INPUT_LINE -#else -#define MAX_VECTORS_PER_DP_LINE MAX_VECTORS_PER_BUF_LINE -#endif - -/* DP (Defect Pixel Correction) */ -struct sh_css_isp_dp_vmem_state { - VMEM_ARRAY(dp_buf[4], MAX_VECTORS_PER_DP_LINE*ISP_NWAY); -}; - -#endif /* __IA_CSS_DP_STATE_H */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dpc2/ia_css_dpc2_state.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dpc2/ia_css_dpc2_state.h deleted file mode 100644 index cbf1e81e83a6..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dpc2/ia_css_dpc2_state.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __IA_CSS_DPC2_STATE_H -#define __IA_CSS_DPC2_STATE_H - -#include "type_support.h" -#include "vmem.h" /* for VMEM_ARRAY*/ - -#include "ia_css_dpc2_param.h" - -struct sh_css_isp_dpc2_vmem_state { - VMEM_ARRAY(dpc2_input_lines[DPC2_STATE_INPUT_BUFFER_HEIGHT], DPC2_STATE_INPUT_BUFFER_WIDTH*ISP_NWAY); - VMEM_ARRAY(dpc2_local_deviations[DPC2_STATE_LOCAL_DEVIATION_BUFFER_HEIGHT], DPC2_STATE_LOCAL_DEVIATION_BUFFER_WIDTH*ISP_NWAY); - VMEM_ARRAY(dpc2_second_min[DPC2_STATE_SECOND_MINMAX_BUFFER_HEIGHT], DPC2_STATE_SECOND_MINMAX_BUFFER_WIDTH*ISP_NWAY); - VMEM_ARRAY(dpc2_second_max[DPC2_STATE_SECOND_MINMAX_BUFFER_HEIGHT], DPC2_STATE_SECOND_MINMAX_BUFFER_WIDTH*ISP_NWAY); -}; - -#endif /* __IA_CSS_DPC2_STATE_H */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/eed1_8/ia_css_eed1_8_state.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/eed1_8/ia_css_eed1_8_state.h deleted file mode 100644 index 47e451b15044..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/eed1_8/ia_css_eed1_8_state.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __IA_CSS_EED1_8_STATE_H -#define __IA_CSS_EED1_8_STATE_H - -#include "type_support.h" -#include "vmem.h" /* for VMEM_ARRAY*/ - -#include "ia_css_eed1_8_param.h" - -struct eed1_8_vmem_state { - VMEM_ARRAY(eed1_8_input_lines[EED1_8_STATE_INPUT_BUFFER_HEIGHT], EED1_8_STATE_INPUT_BUFFER_WIDTH*ISP_NWAY); - VMEM_ARRAY(eed1_8_LD_H[EED1_8_STATE_LD_H_HEIGHT], EED1_8_STATE_LD_H_WIDTH*ISP_NWAY); - VMEM_ARRAY(eed1_8_LD_V[EED1_8_STATE_LD_V_HEIGHT], EED1_8_STATE_LD_V_WIDTH*ISP_NWAY); - VMEM_ARRAY(eed1_8_D_Hr[EED1_8_STATE_D_HR_HEIGHT], EED1_8_STATE_D_HR_WIDTH*ISP_NWAY); - VMEM_ARRAY(eed1_8_D_Hb[EED1_8_STATE_D_HB_HEIGHT], EED1_8_STATE_D_HB_WIDTH*ISP_NWAY); - VMEM_ARRAY(eed1_8_D_Vr[EED1_8_STATE_D_VR_HEIGHT], EED1_8_STATE_D_VR_WIDTH*ISP_NWAY); - VMEM_ARRAY(eed1_8_D_Vb[EED1_8_STATE_D_VB_HEIGHT], EED1_8_STATE_D_VB_WIDTH*ISP_NWAY); - VMEM_ARRAY(eed1_8_rb_zipped[EED1_8_STATE_RB_ZIPPED_HEIGHT], EED1_8_STATE_RB_ZIPPED_WIDTH*ISP_NWAY); -#if EED1_8_FC_ENABLE_MEDIAN - VMEM_ARRAY(eed1_8_Yc[EED1_8_STATE_YC_HEIGHT], EED1_8_STATE_YC_WIDTH*ISP_NWAY); - VMEM_ARRAY(eed1_8_Cg[EED1_8_STATE_CG_HEIGHT], EED1_8_STATE_CG_WIDTH*ISP_NWAY); - VMEM_ARRAY(eed1_8_Co[EED1_8_STATE_CO_HEIGHT], EED1_8_STATE_CO_WIDTH*ISP_NWAY); - VMEM_ARRAY(eed1_8_AbsK[EED1_8_STATE_ABSK_HEIGHT], EED1_8_STATE_ABSK_WIDTH*ISP_NWAY); -#endif -}; - -#endif /* __IA_CSS_EED1_8_STATE_H */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/io_ls/plane_io_ls/ia_css_plane_io_param.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/io_ls/plane_io_ls/ia_css_plane_io_param.h deleted file mode 100644 index 213ef3b385aa..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/io_ls/plane_io_ls/ia_css_plane_io_param.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef ISP2401 -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __IA_CSS_PLANE_IO_PARAM_H -#define __IA_CSS_PLANE_IO_PARAM_H - -#include "../common/ia_css_common_io_param.h" - -#endif /* __IA_CSS_PLANE_IO_PARAM_H */ -#endif diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/io_ls/plane_io_ls/ia_css_plane_io_types.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/io_ls/plane_io_ls/ia_css_plane_io_types.h deleted file mode 100644 index d635741505e2..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/io_ls/plane_io_ls/ia_css_plane_io_types.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef ISP2401 -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __IA_CSS_PLANE_IO_TYPES_H -#define __IA_CSS_PLANE_IO_TYPES_H - -#include "../common/ia_css_common_io_types.h" - -#define PLANE_IO_LS_NUM_PLANES 3 - -struct ia_css_plane_io_config { - struct ia_css_common_io_config get_plane_io_config[PLANE_IO_LS_NUM_PLANES]; - struct ia_css_common_io_config put_plane_io_config[PLANE_IO_LS_NUM_PLANES]; -}; - -#endif /* __IA_CSS_PLANE_IO_TYPES_H */ - -#endif diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/io_ls/yuv420_io_ls/ia_css_yuv420_io_param.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/io_ls/yuv420_io_ls/ia_css_yuv420_io_param.h deleted file mode 100644 index 52450a9a55a1..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/io_ls/yuv420_io_ls/ia_css_yuv420_io_param.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef ISP2401 -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __IA_CSS_YUV420_IO_PARAM -#define __IA_CSS_YUV420_IO_PARAM - -#include "../common/ia_css_common_io_param.h" - -#endif -#endif diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/io_ls/yuv420_io_ls/ia_css_yuv420_io_types.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/io_ls/yuv420_io_ls/ia_css_yuv420_io_types.h deleted file mode 100644 index 99ec1143b214..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/io_ls/yuv420_io_ls/ia_css_yuv420_io_types.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef ISP2401 -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __IA_CSS_YUV420_IO_TYPES -#define __IA_CSS_YUV420_IO_TYPES - -#include "../common/ia_css_common_io_types.h" - -#endif -#endif diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ipu2_io_ls/plane_io_ls/ia_css_plane_io_param.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ipu2_io_ls/plane_io_ls/ia_css_plane_io_param.h deleted file mode 100644 index 881b7e5236dc..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ipu2_io_ls/plane_io_ls/ia_css_plane_io_param.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifdef ISP2401 -/** -Support for Intel Camera Imaging ISP subsystem. -Copyright (c) 2010 - 2015, Intel Corporation. - -This program is free software; you can redistribute it and/or modify it -under the terms and conditions of the GNU General Public License, -version 2, as published by the Free Software Foundation. - -This program is distributed in the hope 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 __IA_CSS_PLANE_IO_PARAM_H -#define __IA_CSS_PLANE_IO_PARAM_H - -#include "../common/ia_css_common_io_param.h" - -#endif /* __IA_CSS_PLANE_IO_PARAM_H */ -#endif diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ipu2_io_ls/plane_io_ls/ia_css_plane_io_types.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ipu2_io_ls/plane_io_ls/ia_css_plane_io_types.h deleted file mode 100644 index f4b9e8de3d8e..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ipu2_io_ls/plane_io_ls/ia_css_plane_io_types.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifdef ISP2401 -/** -Support for Intel Camera Imaging ISP subsystem. -Copyright (c) 2010 - 2015, Intel Corporation. - -This program is free software; you can redistribute it and/or modify it -under the terms and conditions of the GNU General Public License, -version 2, as published by the Free Software Foundation. - -This program is distributed in the hope 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 __IA_CSS_PLANE_IO_TYPES_H -#define __IA_CSS_PLANE_IO_TYPES_H - -#include "../common/ia_css_common_io_types.h" - -#define PLANE_IO_LS_NUM_PLANES 3 - -struct ia_css_plane_io_config { - struct ia_css_common_io_config get_plane_io_config[PLANE_IO_LS_NUM_PLANES]; - struct ia_css_common_io_config put_plane_io_config[PLANE_IO_LS_NUM_PLANES]; -}; - -#endif /* __IA_CSS_PLANE_IO_TYPES_H */ - -#endif diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ipu2_io_ls/yuv420_io_ls/ia_css_yuv420_io_param.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ipu2_io_ls/yuv420_io_ls/ia_css_yuv420_io_param.h deleted file mode 100644 index 86184b545fed..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ipu2_io_ls/yuv420_io_ls/ia_css_yuv420_io_param.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifdef ISP2401 -/** -Support for Intel Camera Imaging ISP subsystem. -Copyright (c) 2010 - 2015, Intel Corporation. - -This program is free software; you can redistribute it and/or modify it -under the terms and conditions of the GNU General Public License, -version 2, as published by the Free Software Foundation. - -This program is distributed in the hope 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 __IA_CSS_YUV420_IO_PARAM -#define __IA_CSS_YUV420_IO_PARAM - -#include "../common/ia_css_common_io_param.h" - -#endif -#endif diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ipu2_io_ls/yuv420_io_ls/ia_css_yuv420_io_types.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ipu2_io_ls/yuv420_io_ls/ia_css_yuv420_io_types.h deleted file mode 100644 index ad750f530013..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ipu2_io_ls/yuv420_io_ls/ia_css_yuv420_io_types.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifdef ISP2401 -/** -Support for Intel Camera Imaging ISP subsystem. -Copyright (c) 2010 - 2015, Intel Corporation. - -This program is free software; you can redistribute it and/or modify it -under the terms and conditions of the GNU General Public License, -version 2, as published by the Free Software Foundation. - -This program is distributed in the hope 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 __IA_CSS_YUV420_IO_TYPES -#define __IA_CSS_YUV420_IO_TYPES - -#include "../common/ia_css_common_io_types.h" - -#endif -#endif diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/norm/norm_1.0/ia_css_norm_types.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/norm/norm_1.0/ia_css_norm_types.h deleted file mode 100644 index 5581bddf9f9b..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/norm/norm_1.0/ia_css_norm_types.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __IA_CSS_NORM_TYPES_H -#define __IA_CSS_NORM_TYPES_H - - -#endif /* __IA_CSS_NORM_TYPES_H */ - - diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/s3a/s3a_1.0/ia_css_s3a_types.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/s3a/s3a_1.0/ia_css_s3a_types.h index 8d674d2c6427..63e70669f085 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/s3a/s3a_1.0/ia_css_s3a_types.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/s3a/s3a_1.0/ia_css_s3a_types.h @@ -28,7 +28,7 @@ /* 3A configuration. This configures the 3A statistics collection * module. */ - + /* 3A statistics grid * * ISP block: S3A1 (3A Support for 3A ver.1 (Histogram is not used for AE)) @@ -54,7 +54,7 @@ struct ia_css_3a_grid_info { uint32_t awb_fr_enable; /** awb_fr enabled in binary, 0:disabled, 1:enabled */ struct awb_fr_public_grid_config awb_fr_grd_info;/** see description in awb_fr_public.h*/ - + uint32_t elem_bit_depth; /** TODO:Taken from BYT - need input from AIQ if needed for SKC Bit depth of element used @@ -98,52 +98,6 @@ struct ia_css_3a_grid_info { }; -#if defined(SYSTEM_css_skycam_c0_system) -#if defined USE_NEW_AE_STRUCT || defined USE_NEW_AWB_STRUCT -#define DEFAULT_3A_GRID_INFO \ -{ \ - 0, /* ae_enable */ \ - {0,0,0,0,0,0,0}, /* AE: width,height,b_width,b_height,x_start,y_start*/ \ - 0, /* awb_enable */ \ - {0,0,0,0,0,0}, /* AWB: width,height,b_width,b_height,x_start,y_start*/ \ - 0, /* af_enable */ \ - {0,0,0,0,0,0,0}, /* AF: width,height,b_width,b_height,x_start,y_start,ff_en*/ \ - 0, /* awb_fr_enable */ \ - {0,0,0,0,0,0,0}, /* AWB_FR: width,height,b_width,b_height,x_start,y_start,ff_en*/ \ - 0, /* elem_bit_depth */ \ -} -#else -#define DEFAULT_3A_GRID_INFO \ -{ \ - 0, /* ae_enable */ \ - {0,0,0,0,0,0,0,0,0}, /* AE: width,height,b_width,b_height,x_start,y_start,x_end,y_end*/ \ - 0, /* awb_enable */ \ - {0,0,0,0,0,0,0,0}, /* AWB: width,height,b_width,b_height,x_start,y_start,x_end,y_end*/ \ - 0, /* af_enable */ \ - {0,0,0,0,0,0,0}, /* AF: width,height,b_width,b_height,x_start,y_start,ff_en*/ \ - 0, /* awb_fr_enable */ \ - {0,0,0,0,0,0,0}, /* AWB_FR: width,height,b_width,b_height,x_start,y_start,ff_en*/ \ - 0, /* elem_bit_depth */ \ -} -#endif /* USE_NEW_AE_STRUCT || defined USE_NEW_AWB_STRUCT */ - -#else -#define DEFAULT_3A_GRID_INFO \ -{ \ - 0, /* enable */ \ - 0, /* use_dmem */ \ - 0, /* has_histogram */ \ - 0, /* width */ \ - 0, /* height */ \ - 0, /* aligned_width */ \ - 0, /* aligned_height */ \ - 0, /* bqs_per_grid_cell */ \ - 0, /* deci_factor_log2 */ \ - 0, /* elem_bit_depth */ \ -} - -#endif - /* This struct should be split into 3, for AE, AWB and AF. * However, that will require driver/ 3A lib modifications. */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/s3a_stat_ls/ia_css_s3a_stat_ls_param.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/s3a_stat_ls/ia_css_s3a_stat_ls_param.h deleted file mode 100644 index 9aa019539f47..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/s3a_stat_ls/ia_css_s3a_stat_ls_param.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __IA_CSS_S3A_STAT_LS_PARAM_H -#define __IA_CSS_S3A_STAT_LS_PARAM_H - -#include "type_support.h" -#ifdef ISP2401 -#include "../../io_ls/common/ia_css_common_io_types.h" -#endif - -#define NUM_S3A_LS 1 - -/* s3a statistics store */ -#ifdef ISP2401 -struct ia_css_s3a_stat_ls_configuration { - uint32_t s3a_grid_size_log2; -}; - -#endif -struct sh_css_isp_s3a_stat_ls_isp_config { -#ifndef ISP2401 - uint32_t base_address[NUM_S3A_LS]; - uint32_t width[NUM_S3A_LS]; - uint32_t height[NUM_S3A_LS]; - uint32_t stride[NUM_S3A_LS]; -#endif - uint32_t s3a_grid_size_log2[NUM_S3A_LS]; -}; - -#ifndef ISP2401 - -#endif -#endif /* __IA_CSS_S3A_STAT_LS_PARAM_H */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/s3a_stat_ls/ia_css_s3a_stat_store_param.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/s3a_stat_ls/ia_css_s3a_stat_store_param.h deleted file mode 100644 index 676b42d364e8..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/s3a_stat_ls/ia_css_s3a_stat_store_param.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __IA_CSS_S3A_STAT_STORE_PARAM_H -#define __IA_CSS_S3A_STAT_STORE_PARAM_H - -#include "ia_css_s3a_stat_ls_param.h" - - -#endif /* __IA_CSS_S3A_STAT_STORE_PARAM_H */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/scale/scale_1.0/ia_css_scale_param.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/scale/scale_1.0/ia_css_scale_param.h deleted file mode 100644 index fd19f008ff91..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/scale/scale_1.0/ia_css_scale_param.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 _IA_CSS_SCALE_PARAM_H -#define _IA_CSS_SCALE_PARAM_H - -#include "uds/uds_1.0/ia_css_uds_param.h" - -#endif /* _IA_CSS_SCALE_PARAM_H */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/common/ia_css_sdis_common_types.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/common/ia_css_sdis_common_types.h index 031983c357e4..381e5730d405 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/common/ia_css_sdis_common_types.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/common/ia_css_sdis_common_types.h @@ -41,20 +41,6 @@ struct ia_css_sdis_info { uint32_t deci_factor_log2; }; -#define IA_CSS_DEFAULT_SDIS_INFO \ - { \ - { { 0, 0 }, /* dim */ \ - { 0, 0 }, /* pad */ \ - }, /* grid */ \ - { { 0, 0 }, /* dim */ \ - { 0, 0 }, /* pad */ \ - }, /* coef */ \ - { { 0, 0 }, /* dim */ \ - { 0, 0 }, /* pad */ \ - }, /* proj */ \ - 0, /* dis_deci_factor_log2 */ \ - } - /* DVS statistics grid * * ISP block: SDVS1 (DIS/DVS Support for DIS/DVS ver.1 (2-axes)) @@ -209,16 +195,17 @@ struct ia_css_dvs_stat_grid_info { /* DVS statistics generated by accelerator default grid info */ -#define DEFAULT_DVS_GRID_INFO { \ -{ \ - { 0, 0, 0}, /* GBL CFG reg: kappa, match_shifrt, binning mode*/ \ - {{{0, 0, 0, 0}, {0, 0, 0}, {0, 0} }, \ - {{0, 0, 0, 0}, {0, 0, 0}, {0, 0} }, \ - {{0, 0, 0, 0}, {0, 0, 0}, {0, 0} } }, \ - {{0, 0, 0, 0}, {4, 0, 0, 0}, {0, 0, 0, 0} } } \ +#define DEFAULT_DVS_GRID_INFO \ +(union ia_css_dvs_grid_u) { \ + .dvs_stat_grid_info = (struct ia_css_dvs_stat_grid_info) { \ + .fe_roi_cfg = { \ + [1] = (struct dvs_stat_public_dvs_level_fe_roi_cfg) { \ + .x_start = 4 \ + } \ + } \ + } \ } - /* Union that holds all types of DVS statistics grid info in * CSS format * */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/common/ia_css_sdis_param.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/common/ia_css_sdis_param.h deleted file mode 100644 index 586cc4315c1f..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/common/ia_css_sdis_param.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __IA_CSS_SDIS_PARAM_COMMON_H -#define __IA_CSS_SDIS_PARAM_COMMON_H - - -#include "sdis/common/ia_css_sdis_common.host.h" - -#endif /* __IA_CSS_SDIS_PARAM_COMMON_H */ - diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_1.0/ia_css_sdis.host.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_1.0/ia_css_sdis.host.c index 9478c12abe89..0fdd696bf654 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_1.0/ia_css_sdis.host.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_1.0/ia_css_sdis.host.c @@ -169,8 +169,7 @@ ia_css_sdis_init_info( unsigned enabled) { if (!enabled) { - struct ia_css_sdis_info default_dis = IA_CSS_DEFAULT_SDIS_INFO; - *dis = default_dis; + *dis = (struct ia_css_sdis_info) { }; return; } diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_1.0/ia_css_sdis_param.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_1.0/ia_css_sdis_param.h deleted file mode 100644 index 2dd8696802d0..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_1.0/ia_css_sdis_param.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __IA_CSS_SDIS_PARAM_H -#define __IA_CSS_SDIS_PARAM_H - -#include "sdis.isp.h" - -#endif /* __IA_CSS_SDIS_PARAM_H */ - diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_2/ia_css_sdis_param.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_2/ia_css_sdis_param.h deleted file mode 100644 index cea352e45713..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_2/ia_css_sdis_param.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __IA_CSS_SDIS2_PARAM_H -#define __IA_CSS_SDIS2_PARAM_H - -#include "sdis.isp.h" - -#endif /* __IA_CSS_SDIS2_PARAM_H */ - diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/xnr/xnr_3.0/ia_css_xnr3_wrapper_param.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/xnr/xnr_3.0/ia_css_xnr3_wrapper_param.h deleted file mode 100644 index 1a98555fd5d9..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/xnr/xnr_3.0/ia_css_xnr3_wrapper_param.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __IA_CSS_XNR3_WRAPPER_PARAM_H -#define __IA_CSS_XNR3_WRAPPER_PARAM_H - -#include "ia_css_xnr3_param.h" - -#endif diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/yuv_ls/yuv_ls_1.0/ia_css_yuv_load_param.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/yuv_ls/yuv_ls_1.0/ia_css_yuv_load_param.h deleted file mode 100644 index 400c6790cbf5..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/yuv_ls/yuv_ls_1.0/ia_css_yuv_load_param.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __IA_CSS_YUV_LOAD_PARAM_H -#define __IA_CSS_YUV_LOAD_PARAM_H - -#include "ia_css_yuv_ls_param.h" - -#endif /* __IA_CSS_YUV_LOAD_PARAM_H */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/yuv_ls/yuv_ls_1.0/ia_css_yuv_ls_param.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/yuv_ls/yuv_ls_1.0/ia_css_yuv_ls_param.h deleted file mode 100644 index c9ff0cb2493a..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/yuv_ls/yuv_ls_1.0/ia_css_yuv_ls_param.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __IA_CSS_YUV_LS_PARAM_H -#define __IA_CSS_YUV_LS_PARAM_H - -#include "type_support.h" -#ifndef ISP2401 - -/* The number of load/store kernels in a pipeline can be greater than one. - * A kernel can consume more than one input or can produce more - * than one output. - */ -#define NUM_YUV_LS 2 - -/* YUV load/store */ -struct sh_css_isp_yuv_ls_isp_config { - unsigned base_address[NUM_YUV_LS]; - unsigned width[NUM_YUV_LS]; - unsigned height[NUM_YUV_LS]; - unsigned stride[NUM_YUV_LS]; -}; - -#else -#include "../../io_ls/common/ia_css_common_io_types.h" -#endif - -#endif /* __IA_CSS_YUV_LS_PARAM_H */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/yuv_ls/yuv_ls_1.0/ia_css_yuv_store_param.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/yuv_ls/yuv_ls_1.0/ia_css_yuv_store_param.h deleted file mode 100644 index 69c474ea1ffd..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/yuv_ls/yuv_ls_1.0/ia_css_yuv_store_param.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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 __IA_CSS_YUV_STORE_PARAM_H -#define __IA_CSS_YUV_STORE_PARAM_H - -#include "ia_css_yuv_ls_param.h" - - -#endif /* __IA_CSS_YUV_STORE_PARAM_H */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/modes/interface/isp_exprs.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/modes/interface/isp_exprs.h deleted file mode 100644 index e625ba62cc15..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/modes/interface/isp_exprs.h +++ /dev/null @@ -1,286 +0,0 @@ -#ifndef ISP2401 -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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. - */ -#else -/** -Support for Intel Camera Imaging ISP subsystem. -Copyright (c) 2010 - 2015, Intel Corporation. - -This program is free software; you can redistribute it and/or modify it -under the terms and conditions of the GNU General Public License, -version 2, as published by the Free Software Foundation. - -This program is distributed in the hope 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. -*/ -#endif - -#ifndef _COMMON_ISP_EXPRS_H_ -#define _COMMON_ISP_EXPRS_H_ - -/* Binary independent pre-processor expressions */ - -#include "sh_css_defs.h" -#include "isp_const.h" - -#ifdef __HOST -#error "isp_exprs.h: Do not include on HOST, contains ISP specific defines" -#endif - -#ifndef __ISP -#if defined(MODE) -#define MODE aap -#error "isp_exprs.h: is mode independent, but MODE is set" -#endif -#if defined(VARIABLE_RESOLUTION) -#define VARIABLE_RESOLUTION noot -#error "isp_exprs.h: is mode independent, but VARIABLE_RESOLUTION is set" -#endif -#if defined(DECI_FACTOR_LOG2) -#define DECI_FACTOR_LOG2 mies -#error "isp_exprs.h: is mode independent, but DECI_FACTOR_LOG2 is set" -#endif -#endif - -#define LOG_VECTOR_STEP _ISP_LOG_VECTOR_STEP(MODE) -/* should be even and multiple of vf downscaling */ -#define ISP_OUTPUT_CHUNK_LOG_FACTOR (MAX_VF_LOG_DOWNSCALE<=1 ? LOG_VECTOR_STEP : \ - umax(VF_LOG_DOWNSCALE, LOG_VECTOR_STEP)) - -#define CEIL_DIV_CHUNKS(n,c) ((c) == 1 ? (n) \ - : CEIL_SHIFT(CEIL_DIV((n), (c)), ISP_OUTPUT_CHUNK_LOG_FACTOR)<<ISP_OUTPUT_CHUNK_LOG_FACTOR) - - -#define ISP_VARIABLE_INPUT (ISP_INPUT == IA_CSS_BINARY_INPUT_VARIABLE) - -/* Binary independent versions, see isp_defs.h for binary dependent ones */ -#ifndef __ISP -#define IMAGEFORMAT_IS_RAW(fmt) ((fmt) == IA_CSS_FRAME_FORMAT_RAW) - -#define IMAGEFORMAT_IS_RAW_INTERLEAVED(fmt) ((fmt) == IA_CSS_FRAME_FORMAT_RAW) - -#define IMAGEFORMAT_IS_RGB(fmt) ((fmt) == IA_CSS_FRAME_FORMAT_RGBA888 || (fmt) == IA_CSS_FRAME_FORMAT_PLANAR_RGB888 || \ - (fmt) == IA_CSS_FRAME_FORMAT_RGB565) - -#define IMAGEFORMAT_IS_RGB_INTERLEAVED(fmt) ((fmt) == IA_CSS_FRAME_FORMAT_RGBA888 || (fmt) == IA_CSS_FRAME_FORMAT_RGB565) - -#define IMAGEFORMAT_UV_INTERLEAVED(fmt) ((fmt) == IA_CSS_FRAME_FORMAT_NV11 || \ - (fmt) == IA_CSS_FRAME_FORMAT_NV12 || (fmt) == IA_CSS_FRAME_FORMAT_NV21 || \ - (fmt) == IA_CSS_FRAME_FORMAT_NV16 || (fmt) == IA_CSS_FRAME_FORMAT_NV61 || \ - (fmt) == IA_CSS_FRAME_FORMAT_UYVY || (fmt) == IA_CSS_FRAME_FORMAT_YUYV || \ - (fmt) == IA_CSS_FRAME_FORMAT_NV12_16 || (fmt) == IA_CSS_FRAME_FORMAT_NV12_TILEY) - -#define IMAGEFORMAT_YUV_INTERLEAVED(fmt) ((fmt) == IA_CSS_FRAME_FORMAT_UYVY || (fmt) == IA_CSS_FRAME_FORMAT_YUYV) - -#define IMAGEFORMAT_INTERLEAVED(fmt) (IMAGEFORMAT_UV_INTERLEAVED(fmt) || IMAGEFORMAT_IS_RGB_INTERLEAVED(fmt)) - -#define IMAGEFORMAT_SUB_SAMPL_420(fmt) ((fmt) == IA_CSS_FRAME_FORMAT_YUV420 || (fmt) == IA_CSS_FRAME_FORMAT_YV12 || \ - (fmt) == IA_CSS_FRAME_FORMAT_NV12 || (fmt) == IA_CSS_FRAME_FORMAT_NV21 || \ - (fmt) == IA_CSS_FRAME_FORMAT_NV12_16 || (fmt) == IA_CSS_FRAME_FORMAT_NV12TILEY) - -#define IMAGEFORMAT_SUB_SAMPL_422(fmt) ((fmt) == IA_CSS_FRAME_FORMAT_YUV422 || (fmt) == IA_CSS_FRAME_FORMAT_YV16 || \ - (fmt) == IA_CSS_FRAME_FORMAT_NV16 || (fmt) == IA_CSS_FRAME_FORMAT_NV61) - -#define IMAGEFORMAT_SUB_SAMPL_444(fmt) ((fmt) == IA_CSS_FRAME_FORMAT_YUV444) - -#define IMAGEFORMAT_UV_SWAPPED(fmt) ((fmt) == IA_CSS_FRAME_FORMAT_NV21 || (fmt) == IA_CSS_FRAME_FORMAT_NV61) - -#define IMAGEFORMAT_IS_RGBA(fmt) ((fmt) == IA_CSS_FRAME_FORMAT_RGBA888) - -#define IMAGEFORMAT_IS_NV11(fmt) ((fmt) == IA_CSS_FRAME_FORMAT_NV11) - -#define IMAGEFORMAT_IS_16BIT(fmt) ((fmt) == IA_CSS_FRAME_FORMAT_YUV420_16 || (fmt) == IA_CSS_FRAME_FORMAT_NV12_16 || (fmt) == IA_CSS_FRAME_FORMAT_YUV422_16) - -#endif - - -/******** GDCAC settings *******/ -#define GDCAC_BPP ISP_VEC_ELEMBITS /* We use 14 bits per pixel component for the GDCAC mode */ -#define GDC_INPUT_BLOCK_WIDTH 2 /* Two vectors are needed */ -#define GDC_OUTPUT_BLOCK_WIDTH 1 /* One vector is produced */ - -#if ISP_VEC_NELEMS == 16 -/* For 16*16 output block, the distortion fits in 13.312 lines __ALWAYS__ */ -#define GDC_INPUT_BLOCK_HEIGHT 14 -#elif ISP_VEC_NELEMS == 64 -/* For 64*64 output block, the distortion fits in 47. lines __ALWAYS__ */ -#define GDC_INPUT_BLOCK_HEIGHT 48 -#endif -/*******************************/ - - -#define ENABLE_HUP ((isp_input_width - isp_envelope_width) < isp_output_width) -#define ENABLE_VUP ((isp_input_height - isp_envelope_height) < isp_output_height) - -#define ISP_INPUT_WIDTH (ENABLE_DS | ENABLE_HUP ? isp_input_width : ISP_INTERNAL_WIDTH) -#define ISP_INPUT_HEIGHT (ENABLE_DS | ENABLE_VUP ? isp_input_height : isp_internal_height) - -#define DECI_FACTOR_LOG2 (ISP_FIXED_S3A_DECI_LOG ? ISP_FIXED_S3A_DECI_LOG : isp_deci_log_factor) - -#define ISP_S3ATBL_WIDTH \ - _ISP_S3ATBL_ISP_WIDTH(_ISP_S3A_ELEMS_ISP_WIDTH((ENABLE_HUP ? ISP_INTERNAL_WIDTH : ISP_INPUT_WIDTH), ISP_LEFT_CROPPING), \ - DECI_FACTOR_LOG2) -#define S3ATBL_WIDTH_BYTES (sizeof(struct ia_css_3a_output) * ISP_S3ATBL_WIDTH) -#define S3ATBL_WIDTH_SHORTS (S3ATBL_WIDTH_BYTES / sizeof(short)) - -/* should be even?? */ -#define ISP_UV_OUTPUT_CHUNK_VECS CEIL_DIV(ISP_OUTPUT_CHUNK_VECS, 2) - - -#if defined(__ISP) || defined(INIT_VARS) - -#define ISP_USE_IF (ISP_INPUT == IA_CSS_BINARY_INPUT_MEMORY ? 0 : \ - ISP_INPUT == IA_CSS_BINARY_INPUT_SENSOR ? 1 : \ - isp_online) - -#define ISP_DVS_ENVELOPE_WIDTH 0 -#define ISP_DVS_ENVELOPE_HEIGHT 0 - -#define _ISP_INPUT_WIDTH_VECS _ISP_VECS(ISP_INPUT_WIDTH) - -#if !defined(__ISP) || (VARIABLE_RESOLUTION && !__HOST) -#define ISP_INPUT_WIDTH_VECS isp_vectors_per_input_line -#else -#define ISP_INPUT_WIDTH_VECS _ISP_INPUT_WIDTH_VECS -#endif - -#if !defined(__ISP) || VARIABLE_RESOLUTION -#define ISP_INTERNAL_WIDTH_VECS isp_vectors_per_line -#else -#define ISP_INTERNAL_WIDTH_VECS _ISP_INTERNAL_WIDTH_VECS -#endif - -#define _ISP_INTERNAL_HEIGHT __ISP_INTERNAL_HEIGHT(isp_output_height, ISP_TOP_CROPPING, ISP_DVS_ENVELOPE_HEIGHT) - -#define ISP_INTERNAL_HEIGHT isp_internal_height - -#define _ISP_INTERNAL_WIDTH __ISP_INTERNAL_WIDTH(ISP_OUTPUT_WIDTH, ISP_DVS_ENVELOPE_WIDTH, \ - ISP_LEFT_CROPPING, MODE, ISP_C_SUBSAMPLING, \ - OUTPUT_NUM_CHUNKS, ISP_PIPELINING) - -#define ISP_UV_INTERNAL_WIDTH (ISP_INTERNAL_WIDTH / 2) -#define ISP_UV_INTERNAL_HEIGHT (ISP_INTERNAL_HEIGHT / 2) - -#define _ISP_INTERNAL_WIDTH_VECS (_ISP_INTERNAL_WIDTH / ISP_VEC_NELEMS) -#define _ISP_UV_INTERNAL_WIDTH_VECS CEIL_DIV(ISP_UV_INTERNAL_WIDTH, ISP_VEC_NELEMS) - -#define ISP_VF_OUTPUT_WIDTH _ISP_VF_OUTPUT_WIDTH(ISP_VF_OUTPUT_WIDTH_VECS) -#define ISP_VF_OUTPUT_HEIGHT _ISP_VF_OUTPUT_HEIGHT(isp_output_height, VF_LOG_DOWNSCALE) - -#if defined (__ISP) && !VARIABLE_RESOLUTION -#define ISP_INTERNAL_WIDTH _ISP_INTERNAL_WIDTH -#define ISP_VF_OUTPUT_WIDTH_VECS _ISP_VF_OUTPUT_WIDTH_VECS -#else -#define ISP_INTERNAL_WIDTH (VARIABLE_RESOLUTION ? isp_internal_width : _ISP_INTERNAL_WIDTH) -#define ISP_VF_OUTPUT_WIDTH_VECS (VARIABLE_RESOLUTION ? isp_vf_output_width_vecs : _ISP_VF_OUTPUT_WIDTH_VECS) -#endif - -#if defined(__ISP) && !VARIABLE_RESOLUTION -#define ISP_OUTPUT_WIDTH ISP_MAX_OUTPUT_WIDTH -#define VF_LOG_DOWNSCALE MAX_VF_LOG_DOWNSCALE -#else -#define ISP_OUTPUT_WIDTH isp_output_width -#define VF_LOG_DOWNSCALE isp_vf_downscale_bits -#endif - -#if !defined(__ISP) || VARIABLE_RESOLUTION -#define _ISP_MAX_VF_OUTPUT_WIDTH __ISP_MAX_VF_OUTPUT_WIDTH(2*SH_CSS_MAX_VF_WIDTH, ISP_LEFT_CROPPING) -#elif defined(MODE) && MODE == IA_CSS_BINARY_MODE_PRIMARY && ISP_OUTPUT_WIDTH > 3328 -/* Because of vmem issues, should be fixed later */ -#define _ISP_MAX_VF_OUTPUT_WIDTH (SH_CSS_MAX_VF_WIDTH - 2*ISP_VEC_NELEMS + (ISP_LEFT_CROPPING ? 2 * ISP_VEC_NELEMS : 0)) -#else -#define _ISP_MAX_VF_OUTPUT_WIDTH (ISP_VF_OUTPUT_WIDTH + (ISP_LEFT_CROPPING ? (2 >> VF_LOG_DOWNSCALE) * ISP_VEC_NELEMS : 0)) -#endif - -#define ISP_MAX_VF_OUTPUT_VECS CEIL_DIV(_ISP_MAX_VF_OUTPUT_WIDTH, ISP_VEC_NELEMS) - - - -#define ISP_MIN_STRIPE_WIDTH (ISP_PIPELINING * (1<<_ISP_LOG_VECTOR_STEP(MODE))) - -/******* STRIPING-RELATED MACROS *******/ -#define NO_STRIPING (ISP_NUM_STRIPES == 1) - -#define ISP_OUTPUT_CHUNK_VECS \ - (NO_STRIPING ? CEIL_DIV_CHUNKS(ISP_OUTPUT_VECS_EXTRA_CROP, OUTPUT_NUM_CHUNKS) \ - : ISP_IO_STRIPE_WIDTH_VECS(ISP_OUTPUT_VECS_EXTRA_CROP, ISP_LEFT_PADDING_VECS, ISP_NUM_STRIPES, ISP_MIN_STRIPE_WIDTH) ) - -#define VECTORS_PER_LINE \ - (NO_STRIPING ? ISP_INTERNAL_WIDTH_VECS \ - : ISP_IO_STRIPE_WIDTH_VECS(ISP_INTERNAL_WIDTH_VECS, ISP_LEFT_PADDING_VECS, ISP_NUM_STRIPES, ISP_MIN_STRIPE_WIDTH) ) - -#define VECTORS_PER_INPUT_LINE \ - (NO_STRIPING ? ISP_INPUT_WIDTH_VECS \ - : ISP_IO_STRIPE_WIDTH_VECS(ISP_INPUT_WIDTH_VECS, ISP_LEFT_PADDING_VECS, ISP_NUM_STRIPES, ISP_MIN_STRIPE_WIDTH)+_ISP_EXTRA_PADDING_VECS) - - -#define ISP_MAX_VF_OUTPUT_STRIPE_VECS \ - (NO_STRIPING ? ISP_MAX_VF_OUTPUT_VECS \ - : CEIL_MUL(CEIL_DIV(ISP_MAX_VF_OUTPUT_VECS, ISP_NUM_STRIPES), 2)) -#define _ISP_VF_OUTPUT_WIDTH_VECS \ - (NO_STRIPING ? __ISP_VF_OUTPUT_WIDTH_VECS(ISP_OUTPUT_WIDTH, VF_LOG_DOWNSCALE) \ - : __ISP_VF_OUTPUT_WIDTH_VECS(CEIL_DIV(ISP_OUTPUT_WIDTH, ISP_NUM_STRIPES), VF_LOG_DOWNSCALE)) - -#define ISP_IO_STRIPE_WIDTH_VECS(width, padding, num_stripes, min_stripe) \ - MAX(CEIL_MUL(padding + CEIL_DIV(width-padding, num_stripes) \ - , 2) \ - , min_stripe) -////////// INPUT & INTERNAL -/* should be even */ -#define INPUT_NUM_CHUNKS OUTPUT_NUM_CHUNKS - -#define INPUT_VECTORS_PER_CHUNK CEIL_DIV_CHUNKS(VECTORS_PER_INPUT_LINE, INPUT_NUM_CHUNKS) - -/* only for ISP code, will be removed: */ -#define VECTORS_PER_FULL_LINE ISP_INTERNAL_WIDTH_VECS -#define VECTORS_PER_INPUT_FULL_LINE ISP_INPUT_WIDTH_VECS - -////////// OUTPUT -/* should at least even and also multiple of vf scaling */ -#define ISP_OUTPUT_VECS_EXTRA_CROP CEIL_DIV(ISP_OUTPUT_WIDTH_EXTRA_CROP, ISP_VEC_NELEMS) - -/* Output is decoupled from input */ -#define ISP_OUTPUT_WIDTH_EXTRA_CROP CEIL_MUL(CEIL_MUL((ENABLE_DVS_ENVELOPE ? ISP_OUTPUT_WIDTH : ISP_INTERNAL_WIDTH), 2*ISP_VEC_NELEMS), \ - ISP_C_SUBSAMPLING * OUTPUT_NUM_CHUNKS * HIVE_ISP_DDR_WORD_BYTES) - -#define ISP_MAX_VF_OUTPUT_CHUNK_VECS \ - (NO_CHUNKING ? ISP_MAX_VF_OUTPUT_STRIPE_VECS \ - : 2*CEIL_DIV(ISP_MAX_VF_OUTPUT_STRIPE_VECS, 2*OUTPUT_NUM_CHUNKS)) - -#define OUTPUT_VECTORS_PER_CHUNK CEIL_DIV_CHUNKS(VECTORS_PER_LINE,OUTPUT_NUM_CHUNKS) - -/* should be even?? */ -#define OUTPUT_C_VECTORS_PER_CHUNK CEIL_DIV(OUTPUT_VECTORS_PER_CHUNK, 2) - -#ifndef ISP2401 -/**** SCTBL defs *******/ -#define ISP_SCTBL_HEIGHT \ - _ISP_SCTBL_HEIGHT(ISP_INPUT_HEIGHT, DECI_FACTOR_LOG2) - -#endif -/**** UDS defs *********/ -#define UDS_DMACH_STRIDE_B_IN_Y (( ISP_INTERNAL_WIDTH /BITS8_ELEMENTS_PER_XMEM_ADDR)*HIVE_ISP_DDR_WORD_BYTES) -#define UDS_DMACH_STRIDE_B_IN_C (((ISP_INTERNAL_WIDTH/2)/BITS8_ELEMENTS_PER_XMEM_ADDR)*HIVE_ISP_DDR_WORD_BYTES) - -#else /* defined(__ISP) || defined(INIT_VARS) */ - -#define ISP_INTERNAL_WIDTH isp_internal_width -#define ISP_INTERNAL_HEIGHT isp_internal_height - -#endif /* defined(__ISP) || defined(INIT_VARS) */ - -#endif /* _COMMON_ISP_EXPRS_H_ */ - diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/binary/interface/ia_css_binary.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/binary/interface/ia_css_binary.h index 5a58abe2b233..732e49a241eb 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/binary/interface/ia_css_binary.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/binary/interface/ia_css_binary.h @@ -93,17 +93,6 @@ struct ia_css_cas_binary_descr { bool *is_output_stage; }; -#define IA_CSS_DEFAULT_CAS_BINARY_DESCR \ -{ \ - 0, \ - 0, \ - NULL, \ - NULL, \ - NULL, \ - NULL, \ - NULL, \ -} - struct ia_css_binary_descr { int mode; bool online; @@ -171,80 +160,15 @@ struct ia_css_binary { struct ia_css_isp_param_css_segments css_params; }; -#ifdef ISP2401 - #define IA_CSS_BINARY_DEFAULT_SETTINGS \ -{ \ - NULL, \ - IA_CSS_STREAM_FORMAT_YUV420_8_LEGACY, \ - IA_CSS_BINARY_DEFAULT_FRAME_INFO, \ - IA_CSS_BINARY_DEFAULT_FRAME_INFO, \ - {IA_CSS_BINARY_DEFAULT_FRAME_INFO}, \ - { 0, 0},/* effective_in_frame_res */ \ - IA_CSS_BINARY_DEFAULT_FRAME_INFO, \ - 0, /* input_buf_vectors */ \ - 0, /* deci_factor_log2 */ \ - 0, /* vf_downscale_log2 */ \ - 0, /* s3atbl_width */ \ - 0, /* s3atbl_height */ \ - 0, /* s3atbl_isp_width */ \ - 0, /* s3atbl_isp_height */ \ - 0, /* morph_tbl_width */ \ - 0, /* morph_tbl_aligned_width */ \ - 0, /* morph_tbl_height */ \ - 0, /* sctbl_width_per_color */ \ - 0, /* sctbl_aligned_width_per_color */ \ - 0, /* sctbl_height */ \ - 0, /* sctbl_legacy_width_per_color */ \ - 0, /* sctbl_legacy_height */ \ - IA_CSS_DEFAULT_SDIS_INFO, /* dis */ \ - { 0, 0},/* dvs_envelope_info */ \ - false, /* online */ \ - 0, /* uds_xc */ \ - 0, /* uds_yc */ \ - 0, /* left_padding */ \ - DEFAULT_BINARY_METRICS, /* metrics */ \ - IA_CSS_DEFAULT_ISP_MEM_PARAMS, /* mem_params */ \ - IA_CSS_DEFAULT_ISP_CSS_PARAMS, /* css_params */ \ +(struct ia_css_binary) { \ + .input_format = IA_CSS_STREAM_FORMAT_YUV420_8_LEGACY, \ + .in_frame_info = IA_CSS_BINARY_DEFAULT_FRAME_INFO, \ + .internal_frame_info = IA_CSS_BINARY_DEFAULT_FRAME_INFO, \ + .out_frame_info = {IA_CSS_BINARY_DEFAULT_FRAME_INFO}, \ + .vf_frame_info = IA_CSS_BINARY_DEFAULT_FRAME_INFO, \ } -#else - -#define IA_CSS_BINARY_DEFAULT_SETTINGS \ -{ \ - NULL, \ - IA_CSS_STREAM_FORMAT_YUV420_8_LEGACY, \ - IA_CSS_BINARY_DEFAULT_FRAME_INFO, \ - IA_CSS_BINARY_DEFAULT_FRAME_INFO, \ - {IA_CSS_BINARY_DEFAULT_FRAME_INFO}, \ - { 0, 0},/* effective_in_frame_res */ \ - IA_CSS_BINARY_DEFAULT_FRAME_INFO, \ - 0, /* input_buf_vectors */ \ - 0, /* deci_factor_log2 */ \ - 0, /* vf_downscale_log2 */ \ - 0, /* s3atbl_width */ \ - 0, /* s3atbl_height */ \ - 0, /* s3atbl_isp_width */ \ - 0, /* s3atbl_isp_height */ \ - 0, /* morph_tbl_width */ \ - 0, /* morph_tbl_aligned_width */ \ - 0, /* morph_tbl_height */ \ - 0, /* sctbl_width_per_color */ \ - 0, /* sctbl_aligned_width_per_color */ \ - 0, /* sctbl_height */ \ - IA_CSS_DEFAULT_SDIS_INFO, /* dis */ \ - { 0, 0},/* dvs_envelope_info */ \ - false, /* online */ \ - 0, /* uds_xc */ \ - 0, /* uds_yc */ \ - 0, /* left_padding */ \ - DEFAULT_BINARY_METRICS, /* metrics */ \ - IA_CSS_DEFAULT_ISP_MEM_PARAMS, /* mem_params */ \ - IA_CSS_DEFAULT_ISP_CSS_PARAMS, /* css_params */ \ -} - -#endif - enum ia_css_err ia_css_binary_init_infos(void); diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/binary/src/binary.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/binary/src/binary.c index 295e07049393..a0f0e9062c4c 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/binary/src/binary.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/binary/src/binary.c @@ -490,7 +490,6 @@ ia_css_binary_get_shading_info_type_1(const struct ia_css_binary *binary, /* [in struct sh_css_shading_table_bayer_origin_compute_results res; #else struct sh_css_binary_sc_requirements scr; - struct ia_css_shading_info default_shading_info_type_1 = DEFAULT_SHADING_INFO_TYPE_1; #endif #ifndef ISP2401 @@ -542,7 +541,7 @@ ia_css_binary_get_shading_info_type_1(const struct ia_css_binary *binary, /* [in &res); if (err != IA_CSS_SUCCESS) #else - *shading_info = default_shading_info_type_1; + *shading_info = DEFAULT_SHADING_INFO_TYPE_1; err = sh_css_binary_get_sc_requirements(binary, required_bds_factor, stream_config, &scr); if (err != IA_CSS_SUCCESS) { diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/src/ia_css_debug.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/src/ia_css_debug.c index f22d73b56bc6..60395904f89a 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/src/ia_css_debug.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/src/ia_css_debug.c @@ -2858,13 +2858,7 @@ ia_css_debug_pipe_graph_dump_stage( if (l && enable_info[l-1] == ',') enable_info[--l] = '\0'; - if (l <= ENABLE_LINE_MAX_LENGTH) { - /* It fits on one line, copy string and init */ - /* other helper strings with empty string */ - strcpy_s(enable_info, - sizeof(enable_info), - ei); - } else { + if (l > ENABLE_LINE_MAX_LENGTH) { /* Too big for one line, find last comma */ p = ENABLE_LINE_MAX_LENGTH; while (ei[p] != ',') diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/frame/src/frame.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/frame/src/frame.c index 5faa89ad8a23..7562beadabef 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/frame/src/frame.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/frame/src/frame.c @@ -196,7 +196,7 @@ enum ia_css_err ia_css_frame_map(struct ia_css_frame **frame, attribute, context); if (me->data == mmgr_NULL) err = IA_CSS_ERR_INVALID_ARGUMENTS; - }; + } if (err != IA_CSS_SUCCESS) { sh_css_free(me); diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isp_param/interface/ia_css_isp_param_types.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isp_param/interface/ia_css_isp_param_types.h index fa3f09347b22..9d111793bb65 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isp_param/interface/ia_css_isp_param_types.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isp_param/interface/ia_css_isp_param_types.h @@ -94,14 +94,5 @@ union ia_css_all_memory_offsets { } array[IA_CSS_NUM_PARAM_CLASSES]; }; -#define IA_CSS_DEFAULT_ISP_MEM_PARAMS \ - { { { { NULL, 0 } } } } - -#define IA_CSS_DEFAULT_ISP_CSS_PARAMS \ - { { { { 0, 0 } } } } - -#define IA_CSS_DEFAULT_ISP_ISP_PARAMS \ - { { { { 0, 0 } } } } - #endif /* _IA_CSS_ISP_PARAM_TYPES_H_ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/pipeline/interface/ia_css_pipeline.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/pipeline/interface/ia_css_pipeline.h index e64936e2d46e..85ed7db0af55 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/pipeline/interface/ia_css_pipeline.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/pipeline/interface/ia_css_pipeline.h @@ -74,21 +74,15 @@ struct ia_css_pipeline { }; #define DEFAULT_PIPELINE \ -{ \ - IA_CSS_PIPE_ID_PREVIEW, /* pipe_id */ \ - 0, /* pipe_num */ \ - false, /* stop_requested */ \ - NULL, /* stages */ \ - NULL, /* current_stage */ \ - 0, /* num_stages */ \ - DEFAULT_FRAME, /* in_frame */ \ - {DEFAULT_FRAME}, /* out_frame */ \ - {DEFAULT_FRAME}, /* vf_frame */ \ - IA_CSS_FRAME_DELAY_1, /* frame_delay */ \ - 0, /* inout_port_config */ \ - -1, /* num_execs */ \ - true, /* acquire_isp_each_stage */\ - QOS_INVALID /* pipe_qos_config */\ +(struct ia_css_pipeline) { \ + .pipe_id = IA_CSS_PIPE_ID_PREVIEW, \ + .in_frame = DEFAULT_FRAME, \ + .out_frame = {DEFAULT_FRAME}, \ + .vf_frame = {DEFAULT_FRAME}, \ + .dvs_frame_delay = IA_CSS_FRAME_DELAY_1, \ + .num_execs = -1, \ + .acquire_isp_each_stage = true, \ + .pipe_qos_config = QOS_INVALID \ } /* Stage descriptor used to create a new stage in the pipeline */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/pipeline/src/pipeline.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/pipeline/src/pipeline.c index 8f93d29d1c51..81a50c73ad0b 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/pipeline/src/pipeline.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/pipeline/src/pipeline.c @@ -692,17 +692,16 @@ static void pipeline_init_defaults( unsigned int pipe_num, unsigned int dvs_frame_delay) { - struct ia_css_frame init_frame = DEFAULT_FRAME; unsigned int i; pipeline->pipe_id = pipe_id; pipeline->stages = NULL; pipeline->stop_requested = false; pipeline->current_stage = NULL; - pipeline->in_frame = init_frame; + pipeline->in_frame = DEFAULT_FRAME; for (i = 0; i < IA_CSS_PIPE_MAX_OUTPUT_STAGE; i++) { - pipeline->out_frame[i] = init_frame; - pipeline->vf_frame[i] = init_frame; + pipeline->out_frame[i] = DEFAULT_FRAME; + pipeline->vf_frame[i] = DEFAULT_FRAME; } pipeline->num_execs = -1; pipeline->acquire_isp_each_stage = true; diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c index 322bb3de6098..37116faab631 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c @@ -112,8 +112,6 @@ static int thread_alive; #define STATS_ENABLED(stage) (stage && stage->binary && stage->binary->info && \ (stage->binary->info->sp.enable.s3a || stage->binary->info->sp.enable.dis)) -#define DEFAULT_PLANES { {0, 0, 0, 0} } - struct sh_css my_css; int (*sh_css_printf) (const char *fmt, va_list args) = NULL; @@ -194,7 +192,7 @@ sh_css_pipe_start(struct ia_css_stream *stream); * @param[in] stream Point to the target "ia_css_stream" instance. * * @return - * - IA_CSS_SUCCESS, if the "stop" requests have been sucessfully sent out. + * - IA_CSS_SUCCESS, if the "stop" requests have been successfully sent out. * - CSS error code, otherwise. * * @@ -1054,7 +1052,7 @@ sh_css_config_input_network(struct ia_css_stream *stream) if (stream->last_pipe->config.mode == IA_CSS_PIPE_MODE_CAPTURE) { /* * We need to poll the ISYS HW in capture_indication itself - * for "non-continous" capture usecase for getting accurate + * for "non-continuous" capture usecase for getting accurate * isys frame capture timestamps. * This is because the capturepipe propcessing takes longer * to execute than the input system frame capture. @@ -2291,25 +2289,19 @@ init_pipe_defaults(enum ia_css_pipe_mode mode, struct ia_css_pipe *pipe, bool copy_pipe) { - static struct ia_css_pipe default_pipe = IA_CSS_DEFAULT_PIPE; - static struct ia_css_preview_settings prev = IA_CSS_DEFAULT_PREVIEW_SETTINGS; - static struct ia_css_capture_settings capt = IA_CSS_DEFAULT_CAPTURE_SETTINGS; - static struct ia_css_video_settings video = IA_CSS_DEFAULT_VIDEO_SETTINGS; - static struct ia_css_yuvpp_settings yuvpp = IA_CSS_DEFAULT_YUVPP_SETTINGS; - if (pipe == NULL) { IA_CSS_ERROR("NULL pipe parameter"); return IA_CSS_ERR_INVALID_ARGUMENTS; } /* Initialize pipe to pre-defined defaults */ - *pipe = default_pipe; + *pipe = IA_CSS_DEFAULT_PIPE; /* TODO: JB should not be needed, but temporary backward reference */ switch (mode) { case IA_CSS_PIPE_MODE_PREVIEW: pipe->mode = IA_CSS_PIPE_ID_PREVIEW; - pipe->pipe_settings.preview = prev; + pipe->pipe_settings.preview = IA_CSS_DEFAULT_PREVIEW_SETTINGS; break; case IA_CSS_PIPE_MODE_CAPTURE: if (copy_pipe) { @@ -2317,11 +2309,11 @@ init_pipe_defaults(enum ia_css_pipe_mode mode, } else { pipe->mode = IA_CSS_PIPE_ID_CAPTURE; } - pipe->pipe_settings.capture = capt; + pipe->pipe_settings.capture = IA_CSS_DEFAULT_CAPTURE_SETTINGS; break; case IA_CSS_PIPE_MODE_VIDEO: pipe->mode = IA_CSS_PIPE_ID_VIDEO; - pipe->pipe_settings.video = video; + pipe->pipe_settings.video = IA_CSS_DEFAULT_VIDEO_SETTINGS; break; case IA_CSS_PIPE_MODE_ACC: pipe->mode = IA_CSS_PIPE_ID_ACC; @@ -2331,7 +2323,7 @@ init_pipe_defaults(enum ia_css_pipe_mode mode, break; case IA_CSS_PIPE_MODE_YUVPP: pipe->mode = IA_CSS_PIPE_ID_YUVPP; - pipe->pipe_settings.yuvpp = yuvpp; + pipe->pipe_settings.yuvpp = IA_CSS_DEFAULT_YUVPP_SETTINGS; break; default: return IA_CSS_ERR_INVALID_ARGUMENTS; @@ -3657,7 +3649,7 @@ static enum ia_css_err create_host_video_pipeline(struct ia_css_pipe *pipe) in_frame = me->stages->args.out_frame[0]; } else if (pipe->stream->config.continuous) { #ifdef USE_INPUT_SYSTEM_VERSION_2401 - /* When continous is enabled, configure in_frame with the + /* When continuous is enabled, configure in_frame with the * last pipe, which is the copy pipe. */ in_frame = pipe->stream->last_pipe->continuous_frames[0]; @@ -3854,7 +3846,7 @@ create_host_preview_pipeline(struct ia_css_pipe *pipe) * - Direct Sensor Mode Online Preview * - Buffered Sensor Mode Online Preview * - Direct Sensor Mode Continuous Preview - * - Buffered Sensor Mode Continous Preview + * - Buffered Sensor Mode Continuous Preview */ sensor = (pipe->stream->config.mode == IA_CSS_INPUT_MODE_SENSOR); buffered_sensor = (pipe->stream->config.mode == IA_CSS_INPUT_MODE_BUFFERED_SENSOR); @@ -4715,7 +4707,7 @@ ia_css_dequeue_psys_event(struct ia_css_event *event) event->timer_subcode = payload[2]; } /* It's a non timer event. So clear first half of the timer event data. - * If the second part of the TIMER event is not recieved, we discard + * If the second part of the TIMER event is not received, we discard * the first half of the timer data and process the non timer event without * affecting the flow. So the non timer event falls through * the code. */ @@ -5588,8 +5580,7 @@ static enum ia_css_err load_video_binaries(struct ia_css_pipe *pipe) /* we build up the pipeline starting at the end */ /* YUV post-processing if needed */ if (need_scaler) { - struct ia_css_cas_binary_descr cas_scaler_descr - = IA_CSS_DEFAULT_CAS_BINARY_DESCR; + struct ia_css_cas_binary_descr cas_scaler_descr = { }; /* NV12 is the common format that is supported by both */ /* yuv_scaler and the video_xx_isp2_min binaries. */ @@ -6244,8 +6235,8 @@ static enum ia_css_err load_primary_binaries( pipe_out_info->res); if (need_extra_yuv_scaler) { - struct ia_css_cas_binary_descr cas_scaler_descr - = IA_CSS_DEFAULT_CAS_BINARY_DESCR; + struct ia_css_cas_binary_descr cas_scaler_descr = { }; + err = ia_css_pipe_create_cas_scaler_desc_single_output( &capt_pp_out_info, pipe_out_info, @@ -6958,7 +6949,7 @@ static enum ia_css_err ia_css_pipe_create_cas_scaler_desc_single_output( unsigned int i; unsigned int hor_ds_factor = 0, ver_ds_factor = 0; enum ia_css_err err = IA_CSS_SUCCESS; - struct ia_css_frame_info tmp_in_info = IA_CSS_BINARY_DEFAULT_FRAME_INFO; + struct ia_css_frame_info tmp_in_info; unsigned max_scale_factor_per_stage = MAX_PREFERRED_YUV_DS_PER_STEP; @@ -7232,7 +7223,7 @@ load_yuvpp_binaries(struct ia_css_pipe *pipe) struct ia_css_frame_info *vf_pp_in_info[IA_CSS_PIPE_MAX_OUTPUT_STAGE]; struct ia_css_yuvpp_settings *mycs; struct ia_css_binary *next_binary; - struct ia_css_cas_binary_descr cas_scaler_descr = IA_CSS_DEFAULT_CAS_BINARY_DESCR; + struct ia_css_cas_binary_descr cas_scaler_descr = { }; unsigned int i, j; bool need_isp_copy_binary = false; @@ -7610,7 +7601,7 @@ create_host_yuvpp_pipeline(struct ia_css_pipe *pipe) * except for the following: * - Direct Sensor Mode Online Capture * - Direct Sensor Mode Continuous Capture - * - Buffered Sensor Mode Continous Capture + * - Buffered Sensor Mode Continuous Capture */ sensor = pipe->stream->config.mode == IA_CSS_INPUT_MODE_SENSOR; buffered_sensor = pipe->stream->config.mode == IA_CSS_INPUT_MODE_BUFFERED_SENSOR; @@ -7950,7 +7941,7 @@ create_host_regular_capture_pipeline(struct ia_css_pipe *pipe) * - Direct Sensor Mode Online Capture * - Direct Sensor Mode Online Capture * - Direct Sensor Mode Continuous Capture - * - Buffered Sensor Mode Continous Capture + * - Buffered Sensor Mode Continuous Capture */ sensor = (pipe->stream->config.mode == IA_CSS_INPUT_MODE_SENSOR); buffered_sensor = (pipe->stream->config.mode == IA_CSS_INPUT_MODE_BUFFERED_SENSOR); @@ -8827,10 +8818,8 @@ sh_css_init_host_sp_control_vars(void) */ void ia_css_pipe_config_defaults(struct ia_css_pipe_config *pipe_config) { - struct ia_css_pipe_config def_config = DEFAULT_PIPE_CONFIG; - ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "ia_css_pipe_config_defaults()\n"); - *pipe_config = def_config; + *pipe_config = DEFAULT_PIPE_CONFIG; } void @@ -8915,7 +8904,7 @@ ia_css_pipe_create(const struct ia_css_pipe_config *config, err = ia_css_pipe_create_extra(config, NULL, pipe); if(err == IA_CSS_SUCCESS) { - IA_CSS_LOG("pipe created successfuly = %p", *pipe); + IA_CSS_LOG("pipe created successfully = %p", *pipe); } IA_CSS_LEAVE_ERR_PRIVATE(err); diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_legacy.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_legacy.h index 4bcc35d219f8..4fd25ba2cd0d 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_legacy.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_legacy.h @@ -52,17 +52,6 @@ struct ia_css_pipe_extra_config { bool disable_vf_pp; }; -#define DEFAULT_PIPE_EXTRA_CONFIG \ -{ \ - false, /* enable_raw_binning */ \ - false, /* enable_yuv_ds */ \ - false, /* enable_high_speed */ \ - false, /* enable_dvs_6axis */ \ - false, /* enable_reduced_pipe */ \ - false, /* enable_fractional_ds */ \ - false, /* disable_vf_pp */ \ -} - enum ia_css_err ia_css_pipe_create_extra(const struct ia_css_pipe_config *config, const struct ia_css_pipe_extra_config *extra_config, diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_metrics.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_metrics.h index 40840ea318ab..2ef9238d95ad 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_metrics.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_metrics.h @@ -24,16 +24,6 @@ struct sh_css_pc_histogram { unsigned *msink; }; -#if !defined(__USE_DESIGNATED_INITIALISERS__) -#define DEFAULT_PC_HISTOGRAM \ -{ \ - 0, \ - NULL, \ - NULL, \ - NULL \ -} -#endif - struct sh_css_binary_metrics { unsigned mode; unsigned id; @@ -42,17 +32,6 @@ struct sh_css_binary_metrics { struct sh_css_binary_metrics *next; }; -#if !defined(__USE_DESIGNATED_INITIALISERS__) -#define DEFAULT_BINARY_METRICS \ -{ \ - 0, \ - 0, \ - DEFAULT_PC_HISTOGRAM, \ - DEFAULT_PC_HISTOGRAM, \ - NULL \ -} -#endif - struct ia_css_frame_metrics { unsigned num_frames; }; diff --git a/drivers/staging/media/atomisp/pci/atomisp2/include/hmm/hmm_bo_dev.h b/drivers/staging/media/atomisp/pci/atomisp2/include/hmm/hmm_bo_dev.h deleted file mode 100644 index 9e51a657ece4..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/include/hmm/hmm_bo_dev.h +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Support for Medifield PNW Camera Imaging ISP subsystem. - * - * Copyright (c) 2010 Intel Corporation. All Rights Reserved. - * - * Copyright (c) 2010 Silicon Hive www.siliconhive.com. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * 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 __HMM_BO_DEV_H__ -#define __HMM_BO_DEV_H__ - -#include <linux/kernel.h> -#include <linux/slab.h> -#include <linux/list.h> -#include <linux/spinlock.h> -#include <linux/mutex.h> -#include "mmu/isp_mmu.h" -#include "hmm/hmm_common.h" -#include "hmm/hmm_vm.h" -#include "ia_css_types.h" - -#define check_bodev_null_return(bdev, exp) \ - check_null_return(bdev, exp, \ - "NULL hmm_bo_device.\n") - -#define check_bodev_null_return_void(bdev) \ - check_null_return_void(bdev, \ - "NULL hmm_bo_device.\n") - -#define HMM_BO_DEVICE_INITED 0x1 - -#define HMM_BO_CACHE_SIZE 2 - - -struct hmm_buffer_object; - -struct hmm_bo_device { - /* isp_mmu provides lock itself */ - struct isp_mmu mmu; - - /* hmm_vm provides lock itself */ - struct hmm_vm vaddr_space; - - struct list_head free_bo_list; - struct list_head active_bo_list; - - /* list lock is used to protect both of the buffer object lists */ - spinlock_t list_lock; -#ifdef CONFIG_ION - struct ion_client *iclient; -#endif - int flag; -}; - -int hmm_bo_device_init(struct hmm_bo_device *bdev, - struct isp_mmu_client *mmu_driver, - unsigned int vaddr_start, unsigned int size); - -/* - * clean up all hmm_bo_device related things. - */ -void hmm_bo_device_exit(struct hmm_bo_device *bdev); - -/* - * whether the bo device is inited or not. - */ -int hmm_bo_device_inited(struct hmm_bo_device *bdev); - -/* - * find the buffer object with virtual address vaddr. - * return NULL if no such buffer object found. - */ -struct hmm_buffer_object *hmm_bo_device_search_start( - struct hmm_bo_device *bdev, ia_css_ptr vaddr); - -/* - * find the buffer object with virtual address vaddr. - * return NULL if no such buffer object found. - */ -struct hmm_buffer_object *hmm_bo_device_search_in_range( - struct hmm_bo_device *bdev, ia_css_ptr vaddr); - -/* - * find the buffer object with kernel virtual address vaddr. - * return NULL if no such buffer object found. - */ -struct hmm_buffer_object *hmm_bo_device_search_vmap_start( - struct hmm_bo_device *bdev, const void *vaddr); - -/* - * find a buffer object with pgnr pages from free_bo_list and - * activate it (remove from free_bo_list and add to - * active_bo_list) - * - * return NULL if no such buffer object found. - */ -struct hmm_buffer_object *hmm_bo_device_get_bo( - struct hmm_bo_device *bdev, unsigned int pgnr); - -/* - * destroy all buffer objects in the free_bo_list. - */ -void hmm_bo_device_destroy_free_bo_list(struct hmm_bo_device *bdev); -/* - * destroy buffer object with start virtual address vaddr. - */ -void hmm_bo_device_destroy_free_bo_addr(struct hmm_bo_device *bdev, - ia_css_ptr vaddr); -/* - * destroy all buffer objects with pgnr pages. - */ -void hmm_bo_device_destroy_free_bo_size(struct hmm_bo_device *bdev, - unsigned int pgnr); - -#endif diff --git a/drivers/staging/media/atomisp/pci/atomisp2/include/mmu/sh_mmu.h b/drivers/staging/media/atomisp/pci/atomisp2/include/mmu/sh_mmu.h deleted file mode 100644 index 031c0398bf65..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/include/mmu/sh_mmu.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Support for Medifield PNW Camera Imaging ISP subsystem. - * - * Copyright (c) 2010 Intel Corporation. All Rights Reserved. - * - * Copyright (c) 2010 Silicon Hive www.siliconhive.com. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * 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 SH_MMU_H_ -#define SH_MMU_H_ - - -#include <sh_css.h> - -#include "mmu/isp_mmu.h" - - -/* - * include SH header file here - */ - -/* - * set page directory base address (physical address). - * - * must be provided. - */ -static int sh_set_pd_base(struct isp_mmu *mmu, - unsigned int phys) -{ - sh_css_mmu_set_page_table_base_address((void *)phys); - return 0; -} - -/* - * callback to flush tlb. - * - * tlb_flush_range will at least flush TLBs containing - * address mapping from addr to addr + size. - * - * tlb_flush_all will flush all TLBs. - * - * tlb_flush_all is must be provided. if tlb_flush_range is - * not valid, it will set to tlb_flush_all by default. - */ -static void sh_tlb_flush(struct isp_mmu *mmu) -{ - sh_css_mmu_invalidate_cache(); -} - -static struct isp_mmu_driver sh_mmu_driver = { - .name = "Silicon Hive ISP3000 MMU", - .pte_valid_mask = 0x1, - .set_pd_base = sh_set_pd_base, - .tlb_flush_all = sh_tlb_flush, -}; - -#define ISP_VM_START 0x0 -#define ISP_VM_SIZE (1 << 30) /* 1G address space */ -#define ISP_PTR_NULL NULL - -#endif /* SH_MMU_H_ */ - diff --git a/drivers/staging/media/atomisp/pci/atomisp2/mmu/isp_mmu.c b/drivers/staging/media/atomisp/pci/atomisp2/mmu/isp_mmu.c index e36c2a33b41a..f21075c1e503 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/mmu/isp_mmu.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/mmu/isp_mmu.c @@ -450,7 +450,7 @@ static void mmu_l1_unmap(struct isp_mmu *mmu, phys_addr_t l1_pt, ptr = end; } /* - * use the same L2 page next time, so we dont + * use the same L2 page next time, so we don't * need to invalidate and free this PT. */ /* atomisp_set_pte(l1_pt, idx, NULL_PTE); */ diff --git a/drivers/staging/media/cxd2099/Kconfig b/drivers/staging/media/cxd2099/Kconfig deleted file mode 100644 index b48aefddc84c..000000000000 --- a/drivers/staging/media/cxd2099/Kconfig +++ /dev/null @@ -1,12 +0,0 @@ -config DVB_CXD2099 - tristate "CXD2099AR Common Interface driver" - depends on DVB_CORE && PCI && I2C - ---help--- - Support for the CI module found on cards based on - - Micronas ngene PCIe bridge: cineS2 etc. - - Digital Devices PCIe bridge: Octopus series - - For now, data is passed through '/dev/dvb/adapterX/sec0': - - Encrypted data must be written to 'sec0'. - - Decrypted data can be read from 'sec0'. - - Setup the CAM using device 'ca0'. diff --git a/drivers/staging/media/cxd2099/Makefile b/drivers/staging/media/cxd2099/Makefile deleted file mode 100644 index 30432c9aabc4..000000000000 --- a/drivers/staging/media/cxd2099/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -obj-$(CONFIG_DVB_CXD2099) += cxd2099.o - -ccflags-y += -Idrivers/media/dvb-frontends/ -ccflags-y += -Idrivers/media/tuners/ diff --git a/drivers/staging/media/cxd2099/TODO b/drivers/staging/media/cxd2099/TODO deleted file mode 100644 index 375bb6f8ee2c..000000000000 --- a/drivers/staging/media/cxd2099/TODO +++ /dev/null @@ -1,12 +0,0 @@ -For now, data is passed through '/dev/dvb/adapterX/sec0': - - Encrypted data must be written to 'sec0'. - - Decrypted data can be read from 'sec0'. - - Setup the CAM using device 'ca0'. - -But this is wrong. There are some discussions about the proper way for -doing it, as seen at: - http://www.mail-archive.com/linux-media@vger.kernel.org/msg22196.html - -While there's no proper fix for it, the driver should be kept in staging. - -Patches should be submitted to: linux-media@vger.kernel.org. diff --git a/drivers/staging/media/cxd2099/cxd2099.c b/drivers/staging/media/cxd2099/cxd2099.c deleted file mode 100644 index dc9cbd8f2104..000000000000 --- a/drivers/staging/media/cxd2099/cxd2099.c +++ /dev/null @@ -1,705 +0,0 @@ -/* - * cxd2099.c: Driver for the CXD2099AR Common Interface Controller - * - * Copyright (C) 2010-2013 Digital Devices GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 only, as published by the Free Software Foundation. - * - * 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/slab.h> -#include <linux/kernel.h> -#include <linux/module.h> -#include <linux/i2c.h> -#include <linux/wait.h> -#include <linux/delay.h> -#include <linux/mutex.h> -#include <linux/io.h> - -#include "cxd2099.h" - -static int buffermode; -module_param(buffermode, int, 0444); -MODULE_PARM_DESC(buffermode, "Enable CXD2099AR buffer mode (default: disabled)"); - -static int read_data(struct dvb_ca_en50221 *ca, int slot, u8 *ebuf, int ecount); - -struct cxd { - struct dvb_ca_en50221 en; - - struct i2c_adapter *i2c; - struct cxd2099_cfg cfg; - - u8 regs[0x23]; - u8 lastaddress; - u8 clk_reg_f; - u8 clk_reg_b; - int mode; - int ready; - int dr; - int write_busy; - int slot_stat; - - u8 amem[1024]; - int amem_read; - - int cammode; - struct mutex lock; /* device access lock */ - - u8 rbuf[1028]; - u8 wbuf[1028]; -}; - -static int i2c_write_reg(struct i2c_adapter *adapter, u8 adr, - u8 reg, u8 data) -{ - u8 m[2] = {reg, data}; - struct i2c_msg msg = {.addr = adr, .flags = 0, .buf = m, .len = 2}; - - if (i2c_transfer(adapter, &msg, 1) != 1) { - dev_err(&adapter->dev, - "Failed to write to I2C register %02x@%02x!\n", - reg, adr); - return -1; - } - return 0; -} - -static int i2c_write(struct i2c_adapter *adapter, u8 adr, - u8 *data, u16 len) -{ - struct i2c_msg msg = {.addr = adr, .flags = 0, .buf = data, .len = len}; - - if (i2c_transfer(adapter, &msg, 1) != 1) { - dev_err(&adapter->dev, "Failed to write to I2C!\n"); - return -1; - } - return 0; -} - -static int i2c_read_reg(struct i2c_adapter *adapter, u8 adr, - u8 reg, u8 *val) -{ - struct i2c_msg msgs[2] = {{.addr = adr, .flags = 0, - .buf = ®, .len = 1}, - {.addr = adr, .flags = I2C_M_RD, - .buf = val, .len = 1} }; - - if (i2c_transfer(adapter, msgs, 2) != 2) { - dev_err(&adapter->dev, "error in %s()\n", __func__); - return -1; - } - return 0; -} - -static int i2c_read(struct i2c_adapter *adapter, u8 adr, - u8 reg, u8 *data, u16 n) -{ - struct i2c_msg msgs[2] = {{.addr = adr, .flags = 0, - .buf = ®, .len = 1}, - {.addr = adr, .flags = I2C_M_RD, - .buf = data, .len = n} }; - - if (i2c_transfer(adapter, msgs, 2) != 2) { - dev_err(&adapter->dev, "error in %s()\n", __func__); - return -1; - } - return 0; -} - -static int read_block(struct cxd *ci, u8 adr, u8 *data, u16 n) -{ - int status = 0; - - if (ci->lastaddress != adr) - status = i2c_write_reg(ci->i2c, ci->cfg.adr, 0, adr); - if (!status) { - ci->lastaddress = adr; - - while (n) { - int len = n; - - if (ci->cfg.max_i2c && len > ci->cfg.max_i2c) - len = ci->cfg.max_i2c; - status = i2c_read(ci->i2c, ci->cfg.adr, 1, data, len); - if (status) - return status; - data += len; - n -= len; - } - } - return status; -} - -static int read_reg(struct cxd *ci, u8 reg, u8 *val) -{ - return read_block(ci, reg, val, 1); -} - -static int read_pccard(struct cxd *ci, u16 address, u8 *data, u8 n) -{ - int status; - u8 addr[3] = {2, address & 0xff, address >> 8}; - - status = i2c_write(ci->i2c, ci->cfg.adr, addr, 3); - if (!status) - status = i2c_read(ci->i2c, ci->cfg.adr, 3, data, n); - return status; -} - -static int write_pccard(struct cxd *ci, u16 address, u8 *data, u8 n) -{ - int status; - u8 addr[3] = {2, address & 0xff, address >> 8}; - - status = i2c_write(ci->i2c, ci->cfg.adr, addr, 3); - if (!status) { - u8 buf[256] = {3}; - - memcpy(buf + 1, data, n); - status = i2c_write(ci->i2c, ci->cfg.adr, buf, n + 1); - } - return status; -} - -static int read_io(struct cxd *ci, u16 address, u8 *val) -{ - int status; - u8 addr[3] = {2, address & 0xff, address >> 8}; - - status = i2c_write(ci->i2c, ci->cfg.adr, addr, 3); - if (!status) - status = i2c_read(ci->i2c, ci->cfg.adr, 3, val, 1); - return status; -} - -static int write_io(struct cxd *ci, u16 address, u8 val) -{ - int status; - u8 addr[3] = {2, address & 0xff, address >> 8}; - u8 buf[2] = {3, val}; - - status = i2c_write(ci->i2c, ci->cfg.adr, addr, 3); - if (!status) - status = i2c_write(ci->i2c, ci->cfg.adr, buf, 2); - return status; -} - -static int write_regm(struct cxd *ci, u8 reg, u8 val, u8 mask) -{ - int status = 0; - - if (ci->lastaddress != reg) - status = i2c_write_reg(ci->i2c, ci->cfg.adr, 0, reg); - if (!status && reg >= 6 && reg <= 8 && mask != 0xff) - status = i2c_read_reg(ci->i2c, ci->cfg.adr, 1, &ci->regs[reg]); - ci->lastaddress = reg; - ci->regs[reg] = (ci->regs[reg] & (~mask)) | val; - if (!status) - status = i2c_write_reg(ci->i2c, ci->cfg.adr, 1, ci->regs[reg]); - if (reg == 0x20) - ci->regs[reg] &= 0x7f; - return status; -} - -static int write_reg(struct cxd *ci, u8 reg, u8 val) -{ - return write_regm(ci, reg, val, 0xff); -} - -static int write_block(struct cxd *ci, u8 adr, u8 *data, u16 n) -{ - int status = 0; - u8 *buf = ci->wbuf; - - if (ci->lastaddress != adr) - status = i2c_write_reg(ci->i2c, ci->cfg.adr, 0, adr); - if (status) - return status; - - ci->lastaddress = adr; - buf[0] = 1; - while (n) { - int len = n; - - if (ci->cfg.max_i2c && (len + 1 > ci->cfg.max_i2c)) - len = ci->cfg.max_i2c - 1; - memcpy(buf + 1, data, len); - status = i2c_write(ci->i2c, ci->cfg.adr, buf, len + 1); - if (status) - return status; - n -= len; - data += len; - } - return status; -} - -static void set_mode(struct cxd *ci, int mode) -{ - if (mode == ci->mode) - return; - - switch (mode) { - case 0x00: /* IO mem */ - write_regm(ci, 0x06, 0x00, 0x07); - break; - case 0x01: /* ATT mem */ - write_regm(ci, 0x06, 0x02, 0x07); - break; - default: - break; - } - ci->mode = mode; -} - -static void cam_mode(struct cxd *ci, int mode) -{ - u8 dummy; - - if (mode == ci->cammode) - return; - - switch (mode) { - case 0x00: - write_regm(ci, 0x20, 0x80, 0x80); - break; - case 0x01: - if (!ci->en.read_data) - return; - ci->write_busy = 0; - dev_info(&ci->i2c->dev, "enable cam buffer mode\n"); - write_reg(ci, 0x0d, 0x00); - write_reg(ci, 0x0e, 0x01); - write_regm(ci, 0x08, 0x40, 0x40); - read_reg(ci, 0x12, &dummy); - write_regm(ci, 0x08, 0x80, 0x80); - break; - default: - break; - } - ci->cammode = mode; -} - -static int init(struct cxd *ci) -{ - int status; - - mutex_lock(&ci->lock); - ci->mode = -1; - do { - status = write_reg(ci, 0x00, 0x00); - if (status < 0) - break; - status = write_reg(ci, 0x01, 0x00); - if (status < 0) - break; - status = write_reg(ci, 0x02, 0x10); - if (status < 0) - break; - status = write_reg(ci, 0x03, 0x00); - if (status < 0) - break; - status = write_reg(ci, 0x05, 0xFF); - if (status < 0) - break; - status = write_reg(ci, 0x06, 0x1F); - if (status < 0) - break; - status = write_reg(ci, 0x07, 0x1F); - if (status < 0) - break; - status = write_reg(ci, 0x08, 0x28); - if (status < 0) - break; - status = write_reg(ci, 0x14, 0x20); - if (status < 0) - break; - - /* TOSTRT = 8, Mode B (gated clock), falling Edge, - * Serial, POL=HIGH, MSB - */ - status = write_reg(ci, 0x0A, 0xA7); - if (status < 0) - break; - - status = write_reg(ci, 0x0B, 0x33); - if (status < 0) - break; - status = write_reg(ci, 0x0C, 0x33); - if (status < 0) - break; - - status = write_regm(ci, 0x14, 0x00, 0x0F); - if (status < 0) - break; - status = write_reg(ci, 0x15, ci->clk_reg_b); - if (status < 0) - break; - status = write_regm(ci, 0x16, 0x00, 0x0F); - if (status < 0) - break; - status = write_reg(ci, 0x17, ci->clk_reg_f); - if (status < 0) - break; - - if (ci->cfg.clock_mode == 2) { - /* bitrate*2^13/ 72000 */ - u32 reg = ((ci->cfg.bitrate << 13) + 71999) / 72000; - - if (ci->cfg.polarity) { - status = write_reg(ci, 0x09, 0x6f); - if (status < 0) - break; - } else { - status = write_reg(ci, 0x09, 0x6d); - if (status < 0) - break; - } - status = write_reg(ci, 0x20, 0x08); - if (status < 0) - break; - status = write_reg(ci, 0x21, (reg >> 8) & 0xff); - if (status < 0) - break; - status = write_reg(ci, 0x22, reg & 0xff); - if (status < 0) - break; - } else if (ci->cfg.clock_mode == 1) { - if (ci->cfg.polarity) { - status = write_reg(ci, 0x09, 0x6f); /* D */ - if (status < 0) - break; - } else { - status = write_reg(ci, 0x09, 0x6d); - if (status < 0) - break; - } - status = write_reg(ci, 0x20, 0x68); - if (status < 0) - break; - status = write_reg(ci, 0x21, 0x00); - if (status < 0) - break; - status = write_reg(ci, 0x22, 0x02); - if (status < 0) - break; - } else { - if (ci->cfg.polarity) { - status = write_reg(ci, 0x09, 0x4f); /* C */ - if (status < 0) - break; - } else { - status = write_reg(ci, 0x09, 0x4d); - if (status < 0) - break; - } - status = write_reg(ci, 0x20, 0x28); - if (status < 0) - break; - status = write_reg(ci, 0x21, 0x00); - if (status < 0) - break; - status = write_reg(ci, 0x22, 0x07); - if (status < 0) - break; - } - - status = write_regm(ci, 0x20, 0x80, 0x80); - if (status < 0) - break; - status = write_regm(ci, 0x03, 0x02, 0x02); - if (status < 0) - break; - status = write_reg(ci, 0x01, 0x04); - if (status < 0) - break; - status = write_reg(ci, 0x00, 0x31); - if (status < 0) - break; - - /* Put TS in bypass */ - status = write_regm(ci, 0x09, 0x08, 0x08); - if (status < 0) - break; - ci->cammode = -1; - cam_mode(ci, 0); - } while (0); - mutex_unlock(&ci->lock); - - return 0; -} - -static int read_attribute_mem(struct dvb_ca_en50221 *ca, - int slot, int address) -{ - struct cxd *ci = ca->data; - u8 val; - - mutex_lock(&ci->lock); - set_mode(ci, 1); - read_pccard(ci, address, &val, 1); - mutex_unlock(&ci->lock); - return val; -} - -static int write_attribute_mem(struct dvb_ca_en50221 *ca, int slot, - int address, u8 value) -{ - struct cxd *ci = ca->data; - - mutex_lock(&ci->lock); - set_mode(ci, 1); - write_pccard(ci, address, &value, 1); - mutex_unlock(&ci->lock); - return 0; -} - -static int read_cam_control(struct dvb_ca_en50221 *ca, - int slot, u8 address) -{ - struct cxd *ci = ca->data; - u8 val; - - mutex_lock(&ci->lock); - set_mode(ci, 0); - read_io(ci, address, &val); - mutex_unlock(&ci->lock); - return val; -} - -static int write_cam_control(struct dvb_ca_en50221 *ca, int slot, - u8 address, u8 value) -{ - struct cxd *ci = ca->data; - - mutex_lock(&ci->lock); - set_mode(ci, 0); - write_io(ci, address, value); - mutex_unlock(&ci->lock); - return 0; -} - -static int slot_reset(struct dvb_ca_en50221 *ca, int slot) -{ - struct cxd *ci = ca->data; - - if (ci->cammode) - read_data(ca, slot, ci->rbuf, 0); - - mutex_lock(&ci->lock); - cam_mode(ci, 0); - write_reg(ci, 0x00, 0x21); - write_reg(ci, 0x06, 0x1F); - write_reg(ci, 0x00, 0x31); - write_regm(ci, 0x20, 0x80, 0x80); - write_reg(ci, 0x03, 0x02); - ci->ready = 0; - ci->mode = -1; - { - int i; - - for (i = 0; i < 100; i++) { - usleep_range(10000, 11000); - if (ci->ready) - break; - } - } - mutex_unlock(&ci->lock); - return 0; -} - -static int slot_shutdown(struct dvb_ca_en50221 *ca, int slot) -{ - struct cxd *ci = ca->data; - - dev_dbg(&ci->i2c->dev, "%s\n", __func__); - if (ci->cammode) - read_data(ca, slot, ci->rbuf, 0); - mutex_lock(&ci->lock); - write_reg(ci, 0x00, 0x21); - write_reg(ci, 0x06, 0x1F); - msleep(300); - - write_regm(ci, 0x09, 0x08, 0x08); - write_regm(ci, 0x20, 0x80, 0x80); /* Reset CAM Mode */ - write_regm(ci, 0x06, 0x07, 0x07); /* Clear IO Mode */ - - ci->mode = -1; - ci->write_busy = 0; - mutex_unlock(&ci->lock); - return 0; -} - -static int slot_ts_enable(struct dvb_ca_en50221 *ca, int slot) -{ - struct cxd *ci = ca->data; - - mutex_lock(&ci->lock); - write_regm(ci, 0x09, 0x00, 0x08); - set_mode(ci, 0); - cam_mode(ci, 1); - mutex_unlock(&ci->lock); - return 0; -} - -static int campoll(struct cxd *ci) -{ - u8 istat; - - read_reg(ci, 0x04, &istat); - if (!istat) - return 0; - write_reg(ci, 0x05, istat); - - if (istat & 0x40) - ci->dr = 1; - if (istat & 0x20) - ci->write_busy = 0; - - if (istat & 2) { - u8 slotstat; - - read_reg(ci, 0x01, &slotstat); - if (!(2 & slotstat)) { - if (!ci->slot_stat) { - ci->slot_stat |= - DVB_CA_EN50221_POLL_CAM_PRESENT; - write_regm(ci, 0x03, 0x08, 0x08); - } - - } else { - if (ci->slot_stat) { - ci->slot_stat = 0; - write_regm(ci, 0x03, 0x00, 0x08); - dev_info(&ci->i2c->dev, "NO CAM\n"); - ci->ready = 0; - } - } - if ((istat & 8) && - ci->slot_stat == DVB_CA_EN50221_POLL_CAM_PRESENT) { - ci->ready = 1; - ci->slot_stat |= DVB_CA_EN50221_POLL_CAM_READY; - } - } - return 0; -} - -static int poll_slot_status(struct dvb_ca_en50221 *ca, int slot, int open) -{ - struct cxd *ci = ca->data; - u8 slotstat; - - mutex_lock(&ci->lock); - campoll(ci); - read_reg(ci, 0x01, &slotstat); - mutex_unlock(&ci->lock); - - return ci->slot_stat; -} - -static int read_data(struct dvb_ca_en50221 *ca, int slot, u8 *ebuf, int ecount) -{ - struct cxd *ci = ca->data; - u8 msb, lsb; - u16 len; - - mutex_lock(&ci->lock); - campoll(ci); - mutex_unlock(&ci->lock); - - if (!ci->dr) - return 0; - - mutex_lock(&ci->lock); - read_reg(ci, 0x0f, &msb); - read_reg(ci, 0x10, &lsb); - len = ((u16)msb << 8) | lsb; - if (len > ecount || len < 2) { - /* read it anyway or cxd may hang */ - read_block(ci, 0x12, ci->rbuf, len); - mutex_unlock(&ci->lock); - return -EIO; - } - read_block(ci, 0x12, ebuf, len); - ci->dr = 0; - mutex_unlock(&ci->lock); - return len; -} - -static int write_data(struct dvb_ca_en50221 *ca, int slot, u8 *ebuf, int ecount) -{ - struct cxd *ci = ca->data; - - if (ci->write_busy) - return -EAGAIN; - mutex_lock(&ci->lock); - write_reg(ci, 0x0d, ecount >> 8); - write_reg(ci, 0x0e, ecount & 0xff); - write_block(ci, 0x11, ebuf, ecount); - ci->write_busy = 1; - mutex_unlock(&ci->lock); - return ecount; -} - -static struct dvb_ca_en50221 en_templ = { - .read_attribute_mem = read_attribute_mem, - .write_attribute_mem = write_attribute_mem, - .read_cam_control = read_cam_control, - .write_cam_control = write_cam_control, - .slot_reset = slot_reset, - .slot_shutdown = slot_shutdown, - .slot_ts_enable = slot_ts_enable, - .poll_slot_status = poll_slot_status, - .read_data = read_data, - .write_data = write_data, -}; - -struct dvb_ca_en50221 *cxd2099_attach(struct cxd2099_cfg *cfg, - void *priv, - struct i2c_adapter *i2c) -{ - struct cxd *ci; - u8 val; - - if (i2c_read_reg(i2c, cfg->adr, 0, &val) < 0) { - dev_info(&i2c->dev, "No CXD2099AR detected at 0x%02x\n", - cfg->adr); - return NULL; - } - - ci = kzalloc(sizeof(*ci), GFP_KERNEL); - if (!ci) - return NULL; - - mutex_init(&ci->lock); - ci->cfg = *cfg; - ci->i2c = i2c; - ci->lastaddress = 0xff; - ci->clk_reg_b = 0x4a; - ci->clk_reg_f = 0x1b; - - ci->en = en_templ; - ci->en.data = ci; - init(ci); - dev_info(&i2c->dev, "Attached CXD2099AR at 0x%02x\n", ci->cfg.adr); - - if (!buffermode) { - ci->en.read_data = NULL; - ci->en.write_data = NULL; - } else { - dev_info(&i2c->dev, "Using CXD2099AR buffer mode"); - } - - return &ci->en; -} -EXPORT_SYMBOL(cxd2099_attach); - -MODULE_DESCRIPTION("CXD2099AR Common Interface controller driver"); -MODULE_AUTHOR("Ralph Metzler"); -MODULE_LICENSE("GPL"); diff --git a/drivers/staging/media/cxd2099/cxd2099.h b/drivers/staging/media/cxd2099/cxd2099.h deleted file mode 100644 index 253e3155a6df..000000000000 --- a/drivers/staging/media/cxd2099/cxd2099.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * cxd2099.h: Driver for the CXD2099AR Common Interface Controller - * - * Copyright (C) 2010-2011 Digital Devices GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 only, as published by the Free Software Foundation. - * - * 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 _CXD2099_H_ -#define _CXD2099_H_ - -#include <media/dvb_ca_en50221.h> - -struct cxd2099_cfg { - u32 bitrate; - u8 adr; - u8 polarity; - u8 clock_mode; - - u32 max_i2c; -}; - -#if defined(CONFIG_DVB_CXD2099) || \ - (defined(CONFIG_DVB_CXD2099_MODULE) && defined(MODULE)) -struct dvb_ca_en50221 *cxd2099_attach(struct cxd2099_cfg *cfg, - void *priv, struct i2c_adapter *i2c); -#else - -static inline struct -dvb_ca_en50221 *cxd2099_attach(struct cxd2099_cfg *cfg, void *priv, - struct i2c_adapter *i2c) -{ - dev_warn(&i2c->dev, "%s: driver disabled by Kconfig\n", __func__); - return NULL; -} -#endif - -#endif diff --git a/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c b/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c index bffe2153b910..634d38c4bea1 100644 --- a/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c +++ b/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c @@ -444,7 +444,7 @@ static int vpfe_register_entities(struct vpfe_device *vpfe_dev) for (i = 0; i < vpfe_dev->num_ext_subdevs; i++) /* * if entity has no pads (ex: amplifier), - * cant establish link + * can't establish link */ if (vpfe_dev->sd[i]->entity.num_pads) { ret = media_create_pad_link(&vpfe_dev->sd[i]->entity, diff --git a/drivers/staging/media/imx/Kconfig b/drivers/staging/media/imx/Kconfig index 2be921cd0d55..bfc17de56b17 100644 --- a/drivers/staging/media/imx/Kconfig +++ b/drivers/staging/media/imx/Kconfig @@ -1,7 +1,9 @@ config VIDEO_IMX_MEDIA tristate "i.MX5/6 V4L2 media core driver" - depends on MEDIA_CONTROLLER && VIDEO_V4L2 && ARCH_MXC && IMX_IPUV3_CORE + depends on ARCH_MXC || COMPILE_TEST + depends on MEDIA_CONTROLLER && VIDEO_V4L2 && IMX_IPUV3_CORE depends on VIDEO_V4L2_SUBDEV_API + depends on HAS_DMA select VIDEOBUF2_DMA_CONTIG select V4L2_FWNODE ---help--- diff --git a/drivers/staging/media/imx/imx-ic-prp.c b/drivers/staging/media/imx/imx-ic-prp.c index c6d7e80932ad..98923fc844ce 100644 --- a/drivers/staging/media/imx/imx-ic-prp.c +++ b/drivers/staging/media/imx/imx-ic-prp.c @@ -462,6 +462,7 @@ static int prp_registered(struct v4l2_subdev *sd) } static const struct v4l2_subdev_pad_ops prp_pad_ops = { + .init_cfg = imx_media_init_cfg, .enum_mbus_code = prp_enum_mbus_code, .get_fmt = prp_get_fmt, .set_fmt = prp_set_fmt, diff --git a/drivers/staging/media/imx/imx-ic-prpencvf.c b/drivers/staging/media/imx/imx-ic-prpencvf.c index 143038c6c403..ae453fd422f0 100644 --- a/drivers/staging/media/imx/imx-ic-prpencvf.c +++ b/drivers/staging/media/imx/imx-ic-prpencvf.c @@ -923,7 +923,7 @@ static int prp_enum_frame_size(struct v4l2_subdev *sd, struct v4l2_subdev_frame_size_enum *fse) { struct prp_priv *priv = sd_to_priv(sd); - struct v4l2_subdev_format format = {0}; + struct v4l2_subdev_format format = {}; const struct imx_media_pixfmt *cc; int ret = 0; @@ -1253,6 +1253,7 @@ static void prp_unregistered(struct v4l2_subdev *sd) } static const struct v4l2_subdev_pad_ops prp_pad_ops = { + .init_cfg = imx_media_init_cfg, .enum_mbus_code = prp_enum_mbus_code, .enum_frame_size = prp_enum_frame_size, .get_fmt = prp_get_fmt, diff --git a/drivers/staging/media/imx/imx-media-capture.c b/drivers/staging/media/imx/imx-media-capture.c index 576bdc7e9c42..0ccabe04b0e1 100644 --- a/drivers/staging/media/imx/imx-media-capture.c +++ b/drivers/staging/media/imx/imx-media-capture.c @@ -141,7 +141,8 @@ static int capture_enum_frameintervals(struct file *file, void *fh, fie.code = cc->codes[0]; - ret = v4l2_subdev_call(priv->src_sd, pad, enum_frame_interval, NULL, &fie); + ret = v4l2_subdev_call(priv->src_sd, pad, enum_frame_interval, + NULL, &fie); if (ret) return ret; diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c index eb7be5093a9d..1aa2be891704 100644 --- a/drivers/staging/media/imx/imx-media-csi.c +++ b/drivers/staging/media/imx/imx-media-csi.c @@ -400,6 +400,7 @@ static int csi_idmac_setup_channel(struct csi_priv *priv) case V4L2_PIX_FMT_SGBRG8: case V4L2_PIX_FMT_SGRBG8: case V4L2_PIX_FMT_SRGGB8: + case V4L2_PIX_FMT_GREY: burst_size = 16; passthrough = true; passthrough_bits = 8; @@ -668,11 +669,10 @@ static int csi_setup(struct csi_priv *priv) static int csi_start(struct csi_priv *priv) { - struct v4l2_fract *output_fi, *input_fi; + struct v4l2_fract *output_fi; int ret; output_fi = &priv->frame_interval[priv->active_output_pad]; - input_fi = &priv->frame_interval[CSI_SINK_PAD]; if (priv->dest == IPU_CSI_DEST_IDMAC) { ret = csi_idmac_start(priv); @@ -1715,6 +1715,7 @@ static const struct v4l2_subdev_video_ops csi_video_ops = { }; static const struct v4l2_subdev_pad_ops csi_pad_ops = { + .init_cfg = imx_media_init_cfg, .enum_mbus_code = csi_enum_mbus_code, .enum_frame_size = csi_enum_frame_size, .enum_frame_interval = csi_enum_frame_interval, @@ -1797,6 +1798,10 @@ static int imx_csi_probe(struct platform_device *pdev) */ priv->dev->of_node = pdata->of_node; pinctrl = devm_pinctrl_get_select_default(priv->dev); + if (IS_ERR(pinctrl)) { + ret = PTR_ERR(priv->vdev); + goto free; + } ret = v4l2_async_register_subdev(&priv->sd); if (ret) diff --git a/drivers/staging/media/imx/imx-media-internal-sd.c b/drivers/staging/media/imx/imx-media-internal-sd.c index 70833fe503b5..daf66c2d69ab 100644 --- a/drivers/staging/media/imx/imx-media-internal-sd.c +++ b/drivers/staging/media/imx/imx-media-internal-sd.c @@ -271,7 +271,7 @@ static int add_internal_subdev(struct imx_media_dev *imxmd, int ipu_id) { struct imx_media_internal_sd_platformdata pdata; - struct platform_device_info pdevinfo = {0}; + struct platform_device_info pdevinfo = {}; struct platform_device *pdev; pdata.grp_id = isd->id->grp_id; diff --git a/drivers/staging/media/imx/imx-media-utils.c b/drivers/staging/media/imx/imx-media-utils.c index 13dafa77a2eb..fab98fc0d6a0 100644 --- a/drivers/staging/media/imx/imx-media-utils.c +++ b/drivers/staging/media/imx/imx-media-utils.c @@ -93,7 +93,7 @@ static const struct imx_media_pixfmt rgb_formats[] = { .bpp = 32, .ipufmt = true, }, - /*** raw bayer formats start here ***/ + /*** raw bayer and grayscale formats start here ***/ { .fourcc = V4L2_PIX_FMT_SBGGR8, .codes = {MEDIA_BUS_FMT_SBGGR8_1X8}, @@ -162,6 +162,12 @@ static const struct imx_media_pixfmt rgb_formats[] = { .cs = IPUV3_COLORSPACE_RGB, .bpp = 16, .bayer = true, + }, { + .fourcc = V4L2_PIX_FMT_GREY, + .codes = {MEDIA_BUS_FMT_Y8_1X8}, + .cs = IPUV3_COLORSPACE_RGB, + .bpp = 8, + .bayer = true, }, /*** * non-mbus RGB formats start here. NOTE! when adding non-mbus @@ -219,58 +225,63 @@ static void init_mbus_colorimetry(struct v4l2_mbus_framefmt *mbus, mbus->ycbcr_enc); } +static const +struct imx_media_pixfmt *__find_format(u32 fourcc, + u32 code, + bool allow_non_mbus, + bool allow_bayer, + const struct imx_media_pixfmt *array, + u32 array_size) +{ + const struct imx_media_pixfmt *fmt; + int i, j; + + for (i = 0; i < array_size; i++) { + fmt = &array[i]; + + if ((!allow_non_mbus && !fmt->codes[0]) || + (!allow_bayer && fmt->bayer)) + continue; + + if (fourcc && fmt->fourcc == fourcc) + return fmt; + + if (!code) + continue; + + for (j = 0; fmt->codes[j]; j++) { + if (code == fmt->codes[j]) + return fmt; + } + } + return NULL; +} + static const struct imx_media_pixfmt *find_format(u32 fourcc, u32 code, enum codespace_sel cs_sel, bool allow_non_mbus, bool allow_bayer) { - const struct imx_media_pixfmt *array, *fmt, *ret = NULL; - u32 array_size; - int i, j; + const struct imx_media_pixfmt *ret; switch (cs_sel) { case CS_SEL_YUV: - array_size = NUM_YUV_FORMATS; - array = yuv_formats; - break; + return __find_format(fourcc, code, allow_non_mbus, allow_bayer, + yuv_formats, NUM_YUV_FORMATS); case CS_SEL_RGB: - array_size = NUM_RGB_FORMATS; - array = rgb_formats; - break; + return __find_format(fourcc, code, allow_non_mbus, allow_bayer, + rgb_formats, NUM_RGB_FORMATS); case CS_SEL_ANY: - array_size = NUM_YUV_FORMATS + NUM_RGB_FORMATS; - array = yuv_formats; - break; + ret = __find_format(fourcc, code, allow_non_mbus, allow_bayer, + yuv_formats, NUM_YUV_FORMATS); + if (ret) + return ret; + return __find_format(fourcc, code, allow_non_mbus, allow_bayer, + rgb_formats, NUM_RGB_FORMATS); default: return NULL; } - - for (i = 0; i < array_size; i++) { - if (cs_sel == CS_SEL_ANY && i >= NUM_YUV_FORMATS) - fmt = &rgb_formats[i - NUM_YUV_FORMATS]; - else - fmt = &array[i]; - - if ((!allow_non_mbus && fmt->codes[0] == 0) || - (!allow_bayer && fmt->bayer)) - continue; - - if (fourcc && fmt->fourcc == fourcc) { - ret = fmt; - goto out; - } - - for (j = 0; code && fmt->codes[j]; j++) { - if (code == fmt->codes[j]) { - ret = fmt; - goto out; - } - } - } - -out: - return ret; } static int enum_format(u32 *fourcc, u32 *code, u32 index, @@ -465,6 +476,35 @@ int imx_media_init_mbus_fmt(struct v4l2_mbus_framefmt *mbus, EXPORT_SYMBOL_GPL(imx_media_init_mbus_fmt); /* + * Initializes the TRY format to the ACTIVE format on all pads + * of a subdev. Can be used as the .init_cfg pad operation. + */ +int imx_media_init_cfg(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg) +{ + struct v4l2_mbus_framefmt *mf_try; + struct v4l2_subdev_format format; + unsigned int pad; + int ret; + + for (pad = 0; pad < sd->entity.num_pads; pad++) { + memset(&format, 0, sizeof(format)); + + format.pad = pad; + format.which = V4L2_SUBDEV_FORMAT_ACTIVE; + ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, &format); + if (ret) + continue; + + mf_try = v4l2_subdev_get_try_format(sd, cfg, pad); + *mf_try = format.format; + } + + return 0; +} +EXPORT_SYMBOL_GPL(imx_media_init_cfg); + +/* * Check whether the field and colorimetry parameters in tryfmt are * uninitialized, and if so fill them with the values from fmt, * or if tryfmt->colorspace has been initialized, all the default diff --git a/drivers/staging/media/imx/imx-media-vdic.c b/drivers/staging/media/imx/imx-media-vdic.c index 433474d58e3e..482250d47e7c 100644 --- a/drivers/staging/media/imx/imx-media-vdic.c +++ b/drivers/staging/media/imx/imx-media-vdic.c @@ -177,7 +177,7 @@ static int vdic_get_ipu_resources(struct vdic_priv *priv) priv->vdi_in_ch = ch; ch = ipu_idmac_get(priv->ipu, IPUV3_CHANNEL_MEM_VDI_NEXT); - if (IS_ERR(priv->vdi_in_ch_n)) { + if (IS_ERR(ch)) { err_chan = IPUV3_CHANNEL_MEM_VDI_NEXT; ret = PTR_ERR(ch); goto out_err_chan; @@ -909,6 +909,7 @@ static void vdic_unregistered(struct v4l2_subdev *sd) } static const struct v4l2_subdev_pad_ops vdic_pad_ops = { + .init_cfg = imx_media_init_cfg, .enum_mbus_code = vdic_enum_mbus_code, .get_fmt = vdic_get_fmt, .set_fmt = vdic_set_fmt, diff --git a/drivers/staging/media/imx/imx-media.h b/drivers/staging/media/imx/imx-media.h index 2fd6dfdf37d6..e945e0ed6dd6 100644 --- a/drivers/staging/media/imx/imx-media.h +++ b/drivers/staging/media/imx/imx-media.h @@ -172,6 +172,8 @@ int imx_media_enum_ipu_format(u32 *code, u32 index, enum codespace_sel cs_sel); int imx_media_init_mbus_fmt(struct v4l2_mbus_framefmt *mbus, u32 width, u32 height, u32 code, u32 field, const struct imx_media_pixfmt **cc); +int imx_media_init_cfg(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg); void imx_media_fill_default_mbus_fields(struct v4l2_mbus_framefmt *tryfmt, struct v4l2_mbus_framefmt *fmt, bool ic_route); diff --git a/drivers/staging/media/imx/imx6-mipi-csi2.c b/drivers/staging/media/imx/imx6-mipi-csi2.c index 477d191c568b..ceeeb3069a02 100644 --- a/drivers/staging/media/imx/imx6-mipi-csi2.c +++ b/drivers/staging/media/imx/imx6-mipi-csi2.c @@ -447,6 +447,16 @@ out: return ret; } +static struct v4l2_mbus_framefmt * +__csi2_get_fmt(struct csi2_dev *csi2, struct v4l2_subdev_pad_config *cfg, + unsigned int pad, enum v4l2_subdev_format_whence which) +{ + if (which == V4L2_SUBDEV_FORMAT_TRY) + return v4l2_subdev_get_try_format(&csi2->sd, cfg, pad); + else + return &csi2->format_mbus; +} + static int csi2_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_format *sdformat) @@ -456,11 +466,7 @@ static int csi2_get_fmt(struct v4l2_subdev *sd, mutex_lock(&csi2->lock); - if (sdformat->which == V4L2_SUBDEV_FORMAT_TRY) - fmt = v4l2_subdev_get_try_format(&csi2->sd, cfg, - sdformat->pad); - else - fmt = &csi2->format_mbus; + fmt = __csi2_get_fmt(csi2, cfg, sdformat->pad, sdformat->which); sdformat->format = *fmt; @@ -474,6 +480,7 @@ static int csi2_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_format *sdformat) { struct csi2_dev *csi2 = sd_to_dev(sd); + struct v4l2_mbus_framefmt *fmt; int ret = 0; if (sdformat->pad >= CSI2_NUM_PADS) @@ -490,10 +497,9 @@ static int csi2_set_fmt(struct v4l2_subdev *sd, if (sdformat->pad != CSI2_SINK_PAD) sdformat->format = csi2->format_mbus; - if (sdformat->which == V4L2_SUBDEV_FORMAT_TRY) - cfg->try_fmt = sdformat->format; - else - csi2->format_mbus = sdformat->format; + fmt = __csi2_get_fmt(csi2, cfg, sdformat->pad, sdformat->which); + + *fmt = sdformat->format; out: mutex_unlock(&csi2->lock); return ret; @@ -531,6 +537,7 @@ static const struct v4l2_subdev_video_ops csi2_video_ops = { }; static const struct v4l2_subdev_pad_ops csi2_pad_ops = { + .init_cfg = imx_media_init_cfg, .get_fmt = csi2_get_fmt, .set_fmt = csi2_set_fmt, }; diff --git a/drivers/staging/media/imx074/Kconfig b/drivers/staging/media/imx074/Kconfig new file mode 100644 index 000000000000..229cbeea580b --- /dev/null +++ b/drivers/staging/media/imx074/Kconfig @@ -0,0 +1,5 @@ +config SOC_CAMERA_IMX074 + tristate "imx074 support (DEPRECATED)" + depends on SOC_CAMERA && I2C + help + This driver supports IMX074 cameras from Sony diff --git a/drivers/staging/media/imx074/Makefile b/drivers/staging/media/imx074/Makefile new file mode 100644 index 000000000000..7d183574aa84 --- /dev/null +++ b/drivers/staging/media/imx074/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_SOC_CAMERA_IMX074) += imx074.o diff --git a/drivers/staging/media/imx074/TODO b/drivers/staging/media/imx074/TODO new file mode 100644 index 000000000000..15580a4f950c --- /dev/null +++ b/drivers/staging/media/imx074/TODO @@ -0,0 +1,5 @@ +This sensor driver needs to be converted to a regular +v4l2 subdev driver. The soc_camera framework is deprecated and +will be removed in the future. Unless someone does this work this +sensor driver will be deleted when the soc_camera framework is +deleted. diff --git a/drivers/staging/media/imx074/imx074.c b/drivers/staging/media/imx074/imx074.c new file mode 100644 index 000000000000..77f1e0243d6e --- /dev/null +++ b/drivers/staging/media/imx074/imx074.c @@ -0,0 +1,497 @@ +/* + * Driver for IMX074 CMOS Image Sensor from Sony + * + * Copyright (C) 2010, Guennadi Liakhovetski <g.liakhovetski@gmx.de> + * + * Partially inspired by the IMX074 driver from the Android / MSM tree + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include <linux/delay.h> +#include <linux/i2c.h> +#include <linux/v4l2-mediabus.h> +#include <linux/slab.h> +#include <linux/videodev2.h> +#include <linux/module.h> + +#include <media/soc_camera.h> +#include <media/v4l2-async.h> +#include <media/v4l2-clk.h> +#include <media/v4l2-subdev.h> + +/* IMX074 registers */ + +#define MODE_SELECT 0x0100 +#define IMAGE_ORIENTATION 0x0101 +#define GROUPED_PARAMETER_HOLD 0x0104 + +/* Integration Time */ +#define COARSE_INTEGRATION_TIME_HI 0x0202 +#define COARSE_INTEGRATION_TIME_LO 0x0203 +/* Gain */ +#define ANALOGUE_GAIN_CODE_GLOBAL_HI 0x0204 +#define ANALOGUE_GAIN_CODE_GLOBAL_LO 0x0205 + +/* PLL registers */ +#define PRE_PLL_CLK_DIV 0x0305 +#define PLL_MULTIPLIER 0x0307 +#define PLSTATIM 0x302b +#define VNDMY_ABLMGSHLMT 0x300a +#define Y_OPBADDR_START_DI 0x3014 +/* mode setting */ +#define FRAME_LENGTH_LINES_HI 0x0340 +#define FRAME_LENGTH_LINES_LO 0x0341 +#define LINE_LENGTH_PCK_HI 0x0342 +#define LINE_LENGTH_PCK_LO 0x0343 +#define YADDR_START 0x0347 +#define YADDR_END 0x034b +#define X_OUTPUT_SIZE_MSB 0x034c +#define X_OUTPUT_SIZE_LSB 0x034d +#define Y_OUTPUT_SIZE_MSB 0x034e +#define Y_OUTPUT_SIZE_LSB 0x034f +#define X_EVEN_INC 0x0381 +#define X_ODD_INC 0x0383 +#define Y_EVEN_INC 0x0385 +#define Y_ODD_INC 0x0387 + +#define HMODEADD 0x3001 +#define VMODEADD 0x3016 +#define VAPPLINE_START 0x3069 +#define VAPPLINE_END 0x306b +#define SHUTTER 0x3086 +#define HADDAVE 0x30e8 +#define LANESEL 0x3301 + +/* IMX074 supported geometry */ +#define IMX074_WIDTH 1052 +#define IMX074_HEIGHT 780 + +/* IMX074 has only one fixed colorspace per pixelcode */ +struct imx074_datafmt { + u32 code; + enum v4l2_colorspace colorspace; +}; + +struct imx074 { + struct v4l2_subdev subdev; + const struct imx074_datafmt *fmt; + struct v4l2_clk *clk; +}; + +static const struct imx074_datafmt imx074_colour_fmts[] = { + {MEDIA_BUS_FMT_SBGGR8_1X8, V4L2_COLORSPACE_SRGB}, +}; + +static struct imx074 *to_imx074(const struct i2c_client *client) +{ + return container_of(i2c_get_clientdata(client), struct imx074, subdev); +} + +/* Find a data format by a pixel code in an array */ +static const struct imx074_datafmt *imx074_find_datafmt(u32 code) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(imx074_colour_fmts); i++) + if (imx074_colour_fmts[i].code == code) + return imx074_colour_fmts + i; + + return NULL; +} + +static int reg_write(struct i2c_client *client, const u16 addr, const u8 data) +{ + struct i2c_adapter *adap = client->adapter; + struct i2c_msg msg; + unsigned char tx[3]; + int ret; + + msg.addr = client->addr; + msg.buf = tx; + msg.len = 3; + msg.flags = 0; + + tx[0] = addr >> 8; + tx[1] = addr & 0xff; + tx[2] = data; + + ret = i2c_transfer(adap, &msg, 1); + + mdelay(2); + + return ret == 1 ? 0 : -EIO; +} + +static int reg_read(struct i2c_client *client, const u16 addr) +{ + u8 buf[2] = {addr >> 8, addr & 0xff}; + int ret; + struct i2c_msg msgs[] = { + { + .addr = client->addr, + .flags = 0, + .len = 2, + .buf = buf, + }, { + .addr = client->addr, + .flags = I2C_M_RD, + .len = 2, + .buf = buf, + }, + }; + + ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); + if (ret < 0) { + dev_warn(&client->dev, "Reading register %x from %x failed\n", + addr, client->addr); + return ret; + } + + return buf[0] & 0xff; /* no sign-extension */ +} + +static int imx074_set_fmt(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_format *format) +{ + struct v4l2_mbus_framefmt *mf = &format->format; + const struct imx074_datafmt *fmt = imx074_find_datafmt(mf->code); + struct i2c_client *client = v4l2_get_subdevdata(sd); + struct imx074 *priv = to_imx074(client); + + if (format->pad) + return -EINVAL; + + dev_dbg(sd->v4l2_dev->dev, "%s(%u)\n", __func__, mf->code); + + if (!fmt) { + /* MIPI CSI could have changed the format, double-check */ + if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE) + return -EINVAL; + mf->code = imx074_colour_fmts[0].code; + mf->colorspace = imx074_colour_fmts[0].colorspace; + } + + mf->width = IMX074_WIDTH; + mf->height = IMX074_HEIGHT; + mf->field = V4L2_FIELD_NONE; + + if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE) + priv->fmt = fmt; + else + cfg->try_fmt = *mf; + + return 0; +} + +static int imx074_get_fmt(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_format *format) +{ + struct v4l2_mbus_framefmt *mf = &format->format; + struct i2c_client *client = v4l2_get_subdevdata(sd); + struct imx074 *priv = to_imx074(client); + + const struct imx074_datafmt *fmt = priv->fmt; + + if (format->pad) + return -EINVAL; + + mf->code = fmt->code; + mf->colorspace = fmt->colorspace; + mf->width = IMX074_WIDTH; + mf->height = IMX074_HEIGHT; + mf->field = V4L2_FIELD_NONE; + + return 0; +} + +static int imx074_get_selection(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_selection *sel) +{ + if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE) + return -EINVAL; + + sel->r.left = 0; + sel->r.top = 0; + sel->r.width = IMX074_WIDTH; + sel->r.height = IMX074_HEIGHT; + + switch (sel->target) { + case V4L2_SEL_TGT_CROP_BOUNDS: + case V4L2_SEL_TGT_CROP_DEFAULT: + case V4L2_SEL_TGT_CROP: + return 0; + default: + return -EINVAL; + } +} + +static int imx074_enum_mbus_code(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_mbus_code_enum *code) +{ + if (code->pad || + (unsigned int)code->index >= ARRAY_SIZE(imx074_colour_fmts)) + return -EINVAL; + + code->code = imx074_colour_fmts[code->index].code; + return 0; +} + +static int imx074_s_stream(struct v4l2_subdev *sd, int enable) +{ + struct i2c_client *client = v4l2_get_subdevdata(sd); + + /* MODE_SELECT: stream or standby */ + return reg_write(client, MODE_SELECT, !!enable); +} + +static int imx074_s_power(struct v4l2_subdev *sd, int on) +{ + struct i2c_client *client = v4l2_get_subdevdata(sd); + struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client); + struct imx074 *priv = to_imx074(client); + + return soc_camera_set_power(&client->dev, ssdd, priv->clk, on); +} + +static int imx074_g_mbus_config(struct v4l2_subdev *sd, + struct v4l2_mbus_config *cfg) +{ + cfg->type = V4L2_MBUS_CSI2; + cfg->flags = V4L2_MBUS_CSI2_2_LANE | + V4L2_MBUS_CSI2_CHANNEL_0 | + V4L2_MBUS_CSI2_CONTINUOUS_CLOCK; + + return 0; +} + +static const struct v4l2_subdev_video_ops imx074_subdev_video_ops = { + .s_stream = imx074_s_stream, + .g_mbus_config = imx074_g_mbus_config, +}; + +static const struct v4l2_subdev_core_ops imx074_subdev_core_ops = { + .s_power = imx074_s_power, +}; + +static const struct v4l2_subdev_pad_ops imx074_subdev_pad_ops = { + .enum_mbus_code = imx074_enum_mbus_code, + .get_selection = imx074_get_selection, + .get_fmt = imx074_get_fmt, + .set_fmt = imx074_set_fmt, +}; + +static const struct v4l2_subdev_ops imx074_subdev_ops = { + .core = &imx074_subdev_core_ops, + .video = &imx074_subdev_video_ops, + .pad = &imx074_subdev_pad_ops, +}; + +static int imx074_video_probe(struct i2c_client *client) +{ + struct v4l2_subdev *subdev = i2c_get_clientdata(client); + int ret; + u16 id; + + ret = imx074_s_power(subdev, 1); + if (ret < 0) + return ret; + + /* Read sensor Model ID */ + ret = reg_read(client, 0); + if (ret < 0) + goto done; + + id = ret << 8; + + ret = reg_read(client, 1); + if (ret < 0) + goto done; + + id |= ret; + + dev_info(&client->dev, "Chip ID 0x%04x detected\n", id); + + if (id != 0x74) { + ret = -ENODEV; + goto done; + } + + /* PLL Setting EXTCLK=24MHz, 22.5times */ + reg_write(client, PLL_MULTIPLIER, 0x2D); + reg_write(client, PRE_PLL_CLK_DIV, 0x02); + reg_write(client, PLSTATIM, 0x4B); + + /* 2-lane mode */ + reg_write(client, 0x3024, 0x00); + + reg_write(client, IMAGE_ORIENTATION, 0x00); + + /* select RAW mode: + * 0x08+0x08 = top 8 bits + * 0x0a+0x08 = compressed 8-bits + * 0x0a+0x0a = 10 bits + */ + reg_write(client, 0x0112, 0x08); + reg_write(client, 0x0113, 0x08); + + /* Base setting for High frame mode */ + reg_write(client, VNDMY_ABLMGSHLMT, 0x80); + reg_write(client, Y_OPBADDR_START_DI, 0x08); + reg_write(client, 0x3015, 0x37); + reg_write(client, 0x301C, 0x01); + reg_write(client, 0x302C, 0x05); + reg_write(client, 0x3031, 0x26); + reg_write(client, 0x3041, 0x60); + reg_write(client, 0x3051, 0x24); + reg_write(client, 0x3053, 0x34); + reg_write(client, 0x3057, 0xC0); + reg_write(client, 0x305C, 0x09); + reg_write(client, 0x305D, 0x07); + reg_write(client, 0x3060, 0x30); + reg_write(client, 0x3065, 0x00); + reg_write(client, 0x30AA, 0x08); + reg_write(client, 0x30AB, 0x1C); + reg_write(client, 0x30B0, 0x32); + reg_write(client, 0x30B2, 0x83); + reg_write(client, 0x30D3, 0x04); + reg_write(client, 0x3106, 0x78); + reg_write(client, 0x310C, 0x82); + reg_write(client, 0x3304, 0x05); + reg_write(client, 0x3305, 0x04); + reg_write(client, 0x3306, 0x11); + reg_write(client, 0x3307, 0x02); + reg_write(client, 0x3308, 0x0C); + reg_write(client, 0x3309, 0x06); + reg_write(client, 0x330A, 0x08); + reg_write(client, 0x330B, 0x04); + reg_write(client, 0x330C, 0x08); + reg_write(client, 0x330D, 0x06); + reg_write(client, 0x330E, 0x01); + reg_write(client, 0x3381, 0x00); + + /* V : 1/2V-addition (1,3), H : 1/2H-averaging (1,3) -> Full HD */ + /* 1608 = 1560 + 48 (black lines) */ + reg_write(client, FRAME_LENGTH_LINES_HI, 0x06); + reg_write(client, FRAME_LENGTH_LINES_LO, 0x48); + reg_write(client, YADDR_START, 0x00); + reg_write(client, YADDR_END, 0x2F); + /* 0x838 == 2104 */ + reg_write(client, X_OUTPUT_SIZE_MSB, 0x08); + reg_write(client, X_OUTPUT_SIZE_LSB, 0x38); + /* 0x618 == 1560 */ + reg_write(client, Y_OUTPUT_SIZE_MSB, 0x06); + reg_write(client, Y_OUTPUT_SIZE_LSB, 0x18); + reg_write(client, X_EVEN_INC, 0x01); + reg_write(client, X_ODD_INC, 0x03); + reg_write(client, Y_EVEN_INC, 0x01); + reg_write(client, Y_ODD_INC, 0x03); + reg_write(client, HMODEADD, 0x00); + reg_write(client, VMODEADD, 0x16); + reg_write(client, VAPPLINE_START, 0x24); + reg_write(client, VAPPLINE_END, 0x53); + reg_write(client, SHUTTER, 0x00); + reg_write(client, HADDAVE, 0x80); + + reg_write(client, LANESEL, 0x00); + + reg_write(client, GROUPED_PARAMETER_HOLD, 0x00); /* off */ + + ret = 0; + +done: + imx074_s_power(subdev, 0); + return ret; +} + +static int imx074_probe(struct i2c_client *client, + const struct i2c_device_id *did) +{ + struct imx074 *priv; + struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); + struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client); + int ret; + + if (!ssdd) { + dev_err(&client->dev, "IMX074: missing platform data!\n"); + return -EINVAL; + } + + if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { + dev_warn(&adapter->dev, + "I2C-Adapter doesn't support I2C_FUNC_SMBUS_BYTE\n"); + return -EIO; + } + + priv = devm_kzalloc(&client->dev, sizeof(struct imx074), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + v4l2_i2c_subdev_init(&priv->subdev, client, &imx074_subdev_ops); + + priv->fmt = &imx074_colour_fmts[0]; + + priv->clk = v4l2_clk_get(&client->dev, "mclk"); + if (IS_ERR(priv->clk)) { + dev_info(&client->dev, "Error %ld getting clock\n", PTR_ERR(priv->clk)); + return -EPROBE_DEFER; + } + + ret = soc_camera_power_init(&client->dev, ssdd); + if (ret < 0) + goto epwrinit; + + ret = imx074_video_probe(client); + if (ret < 0) + goto eprobe; + + ret = v4l2_async_register_subdev(&priv->subdev); + if (!ret) + return 0; + +epwrinit: +eprobe: + v4l2_clk_put(priv->clk); + return ret; +} + +static int imx074_remove(struct i2c_client *client) +{ + struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client); + struct imx074 *priv = to_imx074(client); + + v4l2_async_unregister_subdev(&priv->subdev); + v4l2_clk_put(priv->clk); + + if (ssdd->free_bus) + ssdd->free_bus(ssdd); + + return 0; +} + +static const struct i2c_device_id imx074_id[] = { + { "imx074", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, imx074_id); + +static struct i2c_driver imx074_i2c_driver = { + .driver = { + .name = "imx074", + }, + .probe = imx074_probe, + .remove = imx074_remove, + .id_table = imx074_id, +}; + +module_i2c_driver(imx074_i2c_driver); + +MODULE_DESCRIPTION("Sony IMX074 Camera driver"); +MODULE_AUTHOR("Guennadi Liakhovetski <g.liakhovetski@gmx.de>"); +MODULE_LICENSE("GPL v2"); diff --git a/drivers/staging/media/mt9t031/Kconfig b/drivers/staging/media/mt9t031/Kconfig new file mode 100644 index 000000000000..f48e06a03cdb --- /dev/null +++ b/drivers/staging/media/mt9t031/Kconfig @@ -0,0 +1,11 @@ +config SOC_CAMERA_IMX074 + tristate "imx074 support (DEPRECATED)" + depends on SOC_CAMERA && I2C + help + This driver supports IMX074 cameras from Sony + +config SOC_CAMERA_MT9T031 + tristate "mt9t031 support (DEPRECATED)" + depends on SOC_CAMERA && I2C + help + This driver supports MT9T031 cameras from Micron. diff --git a/drivers/staging/media/mt9t031/Makefile b/drivers/staging/media/mt9t031/Makefile new file mode 100644 index 000000000000..bfd24c442b33 --- /dev/null +++ b/drivers/staging/media/mt9t031/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_SOC_CAMERA_MT9T031) += mt9t031.o diff --git a/drivers/staging/media/mt9t031/TODO b/drivers/staging/media/mt9t031/TODO new file mode 100644 index 000000000000..15580a4f950c --- /dev/null +++ b/drivers/staging/media/mt9t031/TODO @@ -0,0 +1,5 @@ +This sensor driver needs to be converted to a regular +v4l2 subdev driver. The soc_camera framework is deprecated and +will be removed in the future. Unless someone does this work this +sensor driver will be deleted when the soc_camera framework is +deleted. diff --git a/drivers/staging/media/mt9t031/mt9t031.c b/drivers/staging/media/mt9t031/mt9t031.c new file mode 100644 index 000000000000..4802d30e47de --- /dev/null +++ b/drivers/staging/media/mt9t031/mt9t031.c @@ -0,0 +1,858 @@ +/* + * Driver for MT9T031 CMOS Image Sensor from Micron + * + * Copyright (C) 2008, Guennadi Liakhovetski, DENX Software Engineering <lg@denx.de> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include <linux/device.h> +#include <linux/i2c.h> +#include <linux/log2.h> +#include <linux/pm.h> +#include <linux/slab.h> +#include <linux/v4l2-mediabus.h> +#include <linux/videodev2.h> +#include <linux/module.h> + +#include <media/soc_camera.h> +#include <media/v4l2-clk.h> +#include <media/v4l2-subdev.h> +#include <media/v4l2-ctrls.h> + +/* + * ATTENTION: this driver still cannot be used outside of the soc-camera + * framework because of its PM implementation, using the video_device node. + * If hardware becomes available for testing, alternative PM approaches shall + * be considered and tested. + */ + +/* + * mt9t031 i2c address 0x5d + * The platform has to define struct i2c_board_info objects and link to them + * from struct soc_camera_host_desc + */ + +/* mt9t031 selected register addresses */ +#define MT9T031_CHIP_VERSION 0x00 +#define MT9T031_ROW_START 0x01 +#define MT9T031_COLUMN_START 0x02 +#define MT9T031_WINDOW_HEIGHT 0x03 +#define MT9T031_WINDOW_WIDTH 0x04 +#define MT9T031_HORIZONTAL_BLANKING 0x05 +#define MT9T031_VERTICAL_BLANKING 0x06 +#define MT9T031_OUTPUT_CONTROL 0x07 +#define MT9T031_SHUTTER_WIDTH_UPPER 0x08 +#define MT9T031_SHUTTER_WIDTH 0x09 +#define MT9T031_PIXEL_CLOCK_CONTROL 0x0a +#define MT9T031_FRAME_RESTART 0x0b +#define MT9T031_SHUTTER_DELAY 0x0c +#define MT9T031_RESET 0x0d +#define MT9T031_READ_MODE_1 0x1e +#define MT9T031_READ_MODE_2 0x20 +#define MT9T031_READ_MODE_3 0x21 +#define MT9T031_ROW_ADDRESS_MODE 0x22 +#define MT9T031_COLUMN_ADDRESS_MODE 0x23 +#define MT9T031_GLOBAL_GAIN 0x35 +#define MT9T031_CHIP_ENABLE 0xF8 + +#define MT9T031_MAX_HEIGHT 1536 +#define MT9T031_MAX_WIDTH 2048 +#define MT9T031_MIN_HEIGHT 2 +#define MT9T031_MIN_WIDTH 18 +#define MT9T031_HORIZONTAL_BLANK 142 +#define MT9T031_VERTICAL_BLANK 25 +#define MT9T031_COLUMN_SKIP 32 +#define MT9T031_ROW_SKIP 20 + +struct mt9t031 { + struct v4l2_subdev subdev; + struct v4l2_ctrl_handler hdl; + struct { + /* exposure/auto-exposure cluster */ + struct v4l2_ctrl *autoexposure; + struct v4l2_ctrl *exposure; + }; + struct v4l2_rect rect; /* Sensor window */ + struct v4l2_clk *clk; + u16 xskip; + u16 yskip; + unsigned int total_h; + unsigned short y_skip_top; /* Lines to skip at the top */ +}; + +static struct mt9t031 *to_mt9t031(const struct i2c_client *client) +{ + return container_of(i2c_get_clientdata(client), struct mt9t031, subdev); +} + +static int reg_read(struct i2c_client *client, const u8 reg) +{ + return i2c_smbus_read_word_swapped(client, reg); +} + +static int reg_write(struct i2c_client *client, const u8 reg, + const u16 data) +{ + return i2c_smbus_write_word_swapped(client, reg, data); +} + +static int reg_set(struct i2c_client *client, const u8 reg, + const u16 data) +{ + int ret; + + ret = reg_read(client, reg); + if (ret < 0) + return ret; + return reg_write(client, reg, ret | data); +} + +static int reg_clear(struct i2c_client *client, const u8 reg, + const u16 data) +{ + int ret; + + ret = reg_read(client, reg); + if (ret < 0) + return ret; + return reg_write(client, reg, ret & ~data); +} + +static int set_shutter(struct i2c_client *client, const u32 data) +{ + int ret; + + ret = reg_write(client, MT9T031_SHUTTER_WIDTH_UPPER, data >> 16); + + if (ret >= 0) + ret = reg_write(client, MT9T031_SHUTTER_WIDTH, data & 0xffff); + + return ret; +} + +static int get_shutter(struct i2c_client *client, u32 *data) +{ + int ret; + + ret = reg_read(client, MT9T031_SHUTTER_WIDTH_UPPER); + *data = ret << 16; + + if (ret >= 0) + ret = reg_read(client, MT9T031_SHUTTER_WIDTH); + *data |= ret & 0xffff; + + return ret < 0 ? ret : 0; +} + +static int mt9t031_idle(struct i2c_client *client) +{ + int ret; + + /* Disable chip output, synchronous option update */ + ret = reg_write(client, MT9T031_RESET, 1); + if (ret >= 0) + ret = reg_write(client, MT9T031_RESET, 0); + if (ret >= 0) + ret = reg_clear(client, MT9T031_OUTPUT_CONTROL, 2); + + return ret >= 0 ? 0 : -EIO; +} + +static int mt9t031_s_stream(struct v4l2_subdev *sd, int enable) +{ + struct i2c_client *client = v4l2_get_subdevdata(sd); + int ret; + + if (enable) + /* Switch to master "normal" mode */ + ret = reg_set(client, MT9T031_OUTPUT_CONTROL, 2); + else + /* Stop sensor readout */ + ret = reg_clear(client, MT9T031_OUTPUT_CONTROL, 2); + + if (ret < 0) + return -EIO; + + return 0; +} + +/* target must be _even_ */ +static u16 mt9t031_skip(s32 *source, s32 target, s32 max) +{ + unsigned int skip; + + if (*source < target + target / 2) { + *source = target; + return 1; + } + + skip = min(max, *source + target / 2) / target; + if (skip > 8) + skip = 8; + *source = target * skip; + + return skip; +} + +/* rect is the sensor rectangle, the caller guarantees parameter validity */ +static int mt9t031_set_params(struct i2c_client *client, + struct v4l2_rect *rect, u16 xskip, u16 yskip) +{ + struct mt9t031 *mt9t031 = to_mt9t031(client); + int ret; + u16 xbin, ybin; + const u16 hblank = MT9T031_HORIZONTAL_BLANK, + vblank = MT9T031_VERTICAL_BLANK; + + xbin = min(xskip, (u16)3); + ybin = min(yskip, (u16)3); + + /* + * Could just do roundup(rect->left, [xy]bin * 2); but this is cheaper. + * There is always a valid suitably aligned value. The worst case is + * xbin = 3, width = 2048. Then we will start at 36, the last read out + * pixel will be 2083, which is < 2085 - first black pixel. + * + * MT9T031 datasheet imposes window left border alignment, depending on + * the selected xskip. Failing to conform to this requirement produces + * dark horizontal stripes in the image. However, even obeying to this + * requirement doesn't eliminate the stripes in all configurations. They + * appear "locally reproducibly," but can differ between tests under + * different lighting conditions. + */ + switch (xbin) { + case 1: + rect->left &= ~1; + break; + case 2: + rect->left &= ~3; + break; + case 3: + rect->left = rect->left > roundup(MT9T031_COLUMN_SKIP, 6) ? + (rect->left / 6) * 6 : roundup(MT9T031_COLUMN_SKIP, 6); + } + + rect->top &= ~1; + + dev_dbg(&client->dev, "skip %u:%u, rect %ux%u@%u:%u\n", + xskip, yskip, rect->width, rect->height, rect->left, rect->top); + + /* Disable register update, reconfigure atomically */ + ret = reg_set(client, MT9T031_OUTPUT_CONTROL, 1); + if (ret < 0) + return ret; + + /* Blanking and start values - default... */ + ret = reg_write(client, MT9T031_HORIZONTAL_BLANKING, hblank); + if (ret >= 0) + ret = reg_write(client, MT9T031_VERTICAL_BLANKING, vblank); + + if (yskip != mt9t031->yskip || xskip != mt9t031->xskip) { + /* Binning, skipping */ + if (ret >= 0) + ret = reg_write(client, MT9T031_COLUMN_ADDRESS_MODE, + ((xbin - 1) << 4) | (xskip - 1)); + if (ret >= 0) + ret = reg_write(client, MT9T031_ROW_ADDRESS_MODE, + ((ybin - 1) << 4) | (yskip - 1)); + } + dev_dbg(&client->dev, "new physical left %u, top %u\n", + rect->left, rect->top); + + /* + * The caller provides a supported format, as guaranteed by + * .set_fmt(FORMAT_TRY), soc_camera_s_selection() and soc_camera_cropcap() + */ + if (ret >= 0) + ret = reg_write(client, MT9T031_COLUMN_START, rect->left); + if (ret >= 0) + ret = reg_write(client, MT9T031_ROW_START, rect->top); + if (ret >= 0) + ret = reg_write(client, MT9T031_WINDOW_WIDTH, rect->width - 1); + if (ret >= 0) + ret = reg_write(client, MT9T031_WINDOW_HEIGHT, + rect->height + mt9t031->y_skip_top - 1); + if (ret >= 0 && v4l2_ctrl_g_ctrl(mt9t031->autoexposure) == V4L2_EXPOSURE_AUTO) { + mt9t031->total_h = rect->height + mt9t031->y_skip_top + vblank; + + ret = set_shutter(client, mt9t031->total_h); + } + + /* Re-enable register update, commit all changes */ + if (ret >= 0) + ret = reg_clear(client, MT9T031_OUTPUT_CONTROL, 1); + + if (ret >= 0) { + mt9t031->rect = *rect; + mt9t031->xskip = xskip; + mt9t031->yskip = yskip; + } + + return ret < 0 ? ret : 0; +} + +static int mt9t031_set_selection(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_selection *sel) +{ + struct i2c_client *client = v4l2_get_subdevdata(sd); + struct mt9t031 *mt9t031 = to_mt9t031(client); + struct v4l2_rect rect = sel->r; + + if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE || + sel->target != V4L2_SEL_TGT_CROP) + return -EINVAL; + + rect.width = ALIGN(rect.width, 2); + rect.height = ALIGN(rect.height, 2); + + soc_camera_limit_side(&rect.left, &rect.width, + MT9T031_COLUMN_SKIP, MT9T031_MIN_WIDTH, MT9T031_MAX_WIDTH); + + soc_camera_limit_side(&rect.top, &rect.height, + MT9T031_ROW_SKIP, MT9T031_MIN_HEIGHT, MT9T031_MAX_HEIGHT); + + return mt9t031_set_params(client, &rect, mt9t031->xskip, mt9t031->yskip); +} + +static int mt9t031_get_selection(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_selection *sel) +{ + struct i2c_client *client = v4l2_get_subdevdata(sd); + struct mt9t031 *mt9t031 = to_mt9t031(client); + + if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE) + return -EINVAL; + + switch (sel->target) { + case V4L2_SEL_TGT_CROP_BOUNDS: + case V4L2_SEL_TGT_CROP_DEFAULT: + sel->r.left = MT9T031_COLUMN_SKIP; + sel->r.top = MT9T031_ROW_SKIP; + sel->r.width = MT9T031_MAX_WIDTH; + sel->r.height = MT9T031_MAX_HEIGHT; + return 0; + case V4L2_SEL_TGT_CROP: + sel->r = mt9t031->rect; + return 0; + default: + return -EINVAL; + } +} + +static int mt9t031_get_fmt(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_format *format) +{ + struct v4l2_mbus_framefmt *mf = &format->format; + struct i2c_client *client = v4l2_get_subdevdata(sd); + struct mt9t031 *mt9t031 = to_mt9t031(client); + + if (format->pad) + return -EINVAL; + + mf->width = mt9t031->rect.width / mt9t031->xskip; + mf->height = mt9t031->rect.height / mt9t031->yskip; + mf->code = MEDIA_BUS_FMT_SBGGR10_1X10; + mf->colorspace = V4L2_COLORSPACE_SRGB; + mf->field = V4L2_FIELD_NONE; + + return 0; +} + +/* + * If a user window larger than sensor window is requested, we'll increase the + * sensor window. + */ +static int mt9t031_set_fmt(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_format *format) +{ + struct v4l2_mbus_framefmt *mf = &format->format; + struct i2c_client *client = v4l2_get_subdevdata(sd); + struct mt9t031 *mt9t031 = to_mt9t031(client); + u16 xskip, yskip; + struct v4l2_rect rect = mt9t031->rect; + + if (format->pad) + return -EINVAL; + + mf->code = MEDIA_BUS_FMT_SBGGR10_1X10; + mf->colorspace = V4L2_COLORSPACE_SRGB; + v4l_bound_align_image( + &mf->width, MT9T031_MIN_WIDTH, MT9T031_MAX_WIDTH, 1, + &mf->height, MT9T031_MIN_HEIGHT, MT9T031_MAX_HEIGHT, 1, 0); + + if (format->which == V4L2_SUBDEV_FORMAT_TRY) { + cfg->try_fmt = *mf; + return 0; + } + + /* + * Width and height are within limits. + * S_FMT: use binning and skipping for scaling + */ + xskip = mt9t031_skip(&rect.width, mf->width, MT9T031_MAX_WIDTH); + yskip = mt9t031_skip(&rect.height, mf->height, MT9T031_MAX_HEIGHT); + + mf->code = MEDIA_BUS_FMT_SBGGR10_1X10; + mf->colorspace = V4L2_COLORSPACE_SRGB; + + /* mt9t031_set_params() doesn't change width and height */ + return mt9t031_set_params(client, &rect, xskip, yskip); +} + +#ifdef CONFIG_VIDEO_ADV_DEBUG +static int mt9t031_g_register(struct v4l2_subdev *sd, + struct v4l2_dbg_register *reg) +{ + struct i2c_client *client = v4l2_get_subdevdata(sd); + + if (reg->reg > 0xff) + return -EINVAL; + + reg->size = 1; + reg->val = reg_read(client, reg->reg); + + if (reg->val > 0xffff) + return -EIO; + + return 0; +} + +static int mt9t031_s_register(struct v4l2_subdev *sd, + const struct v4l2_dbg_register *reg) +{ + struct i2c_client *client = v4l2_get_subdevdata(sd); + + if (reg->reg > 0xff) + return -EINVAL; + + if (reg_write(client, reg->reg, reg->val) < 0) + return -EIO; + + return 0; +} +#endif + +static int mt9t031_g_volatile_ctrl(struct v4l2_ctrl *ctrl) +{ + struct mt9t031 *mt9t031 = container_of(ctrl->handler, + struct mt9t031, hdl); + const u32 shutter_max = MT9T031_MAX_HEIGHT + MT9T031_VERTICAL_BLANK; + s32 min, max; + + switch (ctrl->id) { + case V4L2_CID_EXPOSURE_AUTO: + min = mt9t031->exposure->minimum; + max = mt9t031->exposure->maximum; + mt9t031->exposure->val = + (shutter_max / 2 + (mt9t031->total_h - 1) * (max - min)) + / shutter_max + min; + break; + } + return 0; +} + +static int mt9t031_s_ctrl(struct v4l2_ctrl *ctrl) +{ + struct mt9t031 *mt9t031 = container_of(ctrl->handler, + struct mt9t031, hdl); + struct v4l2_subdev *sd = &mt9t031->subdev; + struct i2c_client *client = v4l2_get_subdevdata(sd); + struct v4l2_ctrl *exp = mt9t031->exposure; + int data; + + switch (ctrl->id) { + case V4L2_CID_VFLIP: + if (ctrl->val) + data = reg_set(client, MT9T031_READ_MODE_2, 0x8000); + else + data = reg_clear(client, MT9T031_READ_MODE_2, 0x8000); + if (data < 0) + return -EIO; + return 0; + case V4L2_CID_HFLIP: + if (ctrl->val) + data = reg_set(client, MT9T031_READ_MODE_2, 0x4000); + else + data = reg_clear(client, MT9T031_READ_MODE_2, 0x4000); + if (data < 0) + return -EIO; + return 0; + case V4L2_CID_GAIN: + /* See Datasheet Table 7, Gain settings. */ + if (ctrl->val <= ctrl->default_value) { + /* Pack it into 0..1 step 0.125, register values 0..8 */ + unsigned long range = ctrl->default_value - ctrl->minimum; + data = ((ctrl->val - (s32)ctrl->minimum) * 8 + range / 2) / range; + + dev_dbg(&client->dev, "Setting gain %d\n", data); + data = reg_write(client, MT9T031_GLOBAL_GAIN, data); + if (data < 0) + return -EIO; + } else { + /* Pack it into 1.125..128 variable step, register values 9..0x7860 */ + /* We assume qctrl->maximum - qctrl->default_value - 1 > 0 */ + unsigned long range = ctrl->maximum - ctrl->default_value - 1; + /* calculated gain: map 65..127 to 9..1024 step 0.125 */ + unsigned long gain = ((ctrl->val - (s32)ctrl->default_value - 1) * + 1015 + range / 2) / range + 9; + + if (gain <= 32) /* calculated gain 9..32 -> 9..32 */ + data = gain; + else if (gain <= 64) /* calculated gain 33..64 -> 0x51..0x60 */ + data = ((gain - 32) * 16 + 16) / 32 + 80; + else + /* calculated gain 65..1024 -> (1..120) << 8 + 0x60 */ + data = (((gain - 64 + 7) * 32) & 0xff00) | 0x60; + + dev_dbg(&client->dev, "Set gain from 0x%x to 0x%x\n", + reg_read(client, MT9T031_GLOBAL_GAIN), data); + data = reg_write(client, MT9T031_GLOBAL_GAIN, data); + if (data < 0) + return -EIO; + } + return 0; + + case V4L2_CID_EXPOSURE_AUTO: + if (ctrl->val == V4L2_EXPOSURE_MANUAL) { + unsigned int range = exp->maximum - exp->minimum; + unsigned int shutter = ((exp->val - (s32)exp->minimum) * 1048 + + range / 2) / range + 1; + u32 old; + + get_shutter(client, &old); + dev_dbg(&client->dev, "Set shutter from %u to %u\n", + old, shutter); + if (set_shutter(client, shutter) < 0) + return -EIO; + } else { + const u16 vblank = MT9T031_VERTICAL_BLANK; + mt9t031->total_h = mt9t031->rect.height + + mt9t031->y_skip_top + vblank; + + if (set_shutter(client, mt9t031->total_h) < 0) + return -EIO; + } + return 0; + default: + return -EINVAL; + } + return 0; +} + +/* + * Power Management: + * This function does nothing for now but must be present for pm to work + */ +static int mt9t031_runtime_suspend(struct device *dev) +{ + return 0; +} + +/* + * Power Management: + * COLUMN_ADDRESS_MODE and ROW_ADDRESS_MODE are not rewritten if unchanged + * they are however changed at reset if the platform hook is present + * thus we rewrite them with the values stored by the driver + */ +static int mt9t031_runtime_resume(struct device *dev) +{ + struct video_device *vdev = to_video_device(dev); + struct v4l2_subdev *sd = soc_camera_vdev_to_subdev(vdev); + struct i2c_client *client = v4l2_get_subdevdata(sd); + struct mt9t031 *mt9t031 = to_mt9t031(client); + + int ret; + u16 xbin, ybin; + + xbin = min(mt9t031->xskip, (u16)3); + ybin = min(mt9t031->yskip, (u16)3); + + ret = reg_write(client, MT9T031_COLUMN_ADDRESS_MODE, + ((xbin - 1) << 4) | (mt9t031->xskip - 1)); + if (ret < 0) + return ret; + + ret = reg_write(client, MT9T031_ROW_ADDRESS_MODE, + ((ybin - 1) << 4) | (mt9t031->yskip - 1)); + if (ret < 0) + return ret; + + return 0; +} + +static const struct dev_pm_ops mt9t031_dev_pm_ops = { + .runtime_suspend = mt9t031_runtime_suspend, + .runtime_resume = mt9t031_runtime_resume, +}; + +static const struct device_type mt9t031_dev_type = { + .name = "MT9T031", + .pm = &mt9t031_dev_pm_ops, +}; + +static int mt9t031_s_power(struct v4l2_subdev *sd, int on) +{ + struct i2c_client *client = v4l2_get_subdevdata(sd); + struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client); + struct video_device *vdev = soc_camera_i2c_to_vdev(client); + struct mt9t031 *mt9t031 = to_mt9t031(client); + int ret; + + if (on) { + ret = soc_camera_power_on(&client->dev, ssdd, mt9t031->clk); + if (ret < 0) + return ret; + if (vdev) + /* Not needed during probing, when vdev isn't available yet */ + vdev->dev.type = &mt9t031_dev_type; + } else { + if (vdev) + vdev->dev.type = NULL; + soc_camera_power_off(&client->dev, ssdd, mt9t031->clk); + } + + return 0; +} + +/* + * Interface active, can use i2c. If it fails, it can indeed mean, that + * this wasn't our capture interface, so, we wait for the right one + */ +static int mt9t031_video_probe(struct i2c_client *client) +{ + struct mt9t031 *mt9t031 = to_mt9t031(client); + s32 data; + int ret; + + ret = mt9t031_s_power(&mt9t031->subdev, 1); + if (ret < 0) + return ret; + + ret = mt9t031_idle(client); + if (ret < 0) { + dev_err(&client->dev, "Failed to initialise the camera\n"); + goto done; + } + + /* Read out the chip version register */ + data = reg_read(client, MT9T031_CHIP_VERSION); + + switch (data) { + case 0x1621: + break; + default: + dev_err(&client->dev, + "No MT9T031 chip detected, register read %x\n", data); + ret = -ENODEV; + goto done; + } + + dev_info(&client->dev, "Detected a MT9T031 chip ID %x\n", data); + + ret = v4l2_ctrl_handler_setup(&mt9t031->hdl); + +done: + mt9t031_s_power(&mt9t031->subdev, 0); + + return ret; +} + +static int mt9t031_g_skip_top_lines(struct v4l2_subdev *sd, u32 *lines) +{ + struct i2c_client *client = v4l2_get_subdevdata(sd); + struct mt9t031 *mt9t031 = to_mt9t031(client); + + *lines = mt9t031->y_skip_top; + + return 0; +} + +static const struct v4l2_ctrl_ops mt9t031_ctrl_ops = { + .g_volatile_ctrl = mt9t031_g_volatile_ctrl, + .s_ctrl = mt9t031_s_ctrl, +}; + +static const struct v4l2_subdev_core_ops mt9t031_subdev_core_ops = { + .s_power = mt9t031_s_power, +#ifdef CONFIG_VIDEO_ADV_DEBUG + .g_register = mt9t031_g_register, + .s_register = mt9t031_s_register, +#endif +}; + +static int mt9t031_enum_mbus_code(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_mbus_code_enum *code) +{ + if (code->pad || code->index) + return -EINVAL; + + code->code = MEDIA_BUS_FMT_SBGGR10_1X10; + return 0; +} + +static int mt9t031_g_mbus_config(struct v4l2_subdev *sd, + struct v4l2_mbus_config *cfg) +{ + struct i2c_client *client = v4l2_get_subdevdata(sd); + struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client); + + cfg->flags = V4L2_MBUS_MASTER | V4L2_MBUS_PCLK_SAMPLE_RISING | + V4L2_MBUS_PCLK_SAMPLE_FALLING | V4L2_MBUS_HSYNC_ACTIVE_HIGH | + V4L2_MBUS_VSYNC_ACTIVE_HIGH | V4L2_MBUS_DATA_ACTIVE_HIGH; + cfg->type = V4L2_MBUS_PARALLEL; + cfg->flags = soc_camera_apply_board_flags(ssdd, cfg); + + return 0; +} + +static int mt9t031_s_mbus_config(struct v4l2_subdev *sd, + const struct v4l2_mbus_config *cfg) +{ + struct i2c_client *client = v4l2_get_subdevdata(sd); + struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client); + + if (soc_camera_apply_board_flags(ssdd, cfg) & + V4L2_MBUS_PCLK_SAMPLE_FALLING) + return reg_clear(client, MT9T031_PIXEL_CLOCK_CONTROL, 0x8000); + else + return reg_set(client, MT9T031_PIXEL_CLOCK_CONTROL, 0x8000); +} + +static const struct v4l2_subdev_video_ops mt9t031_subdev_video_ops = { + .s_stream = mt9t031_s_stream, + .g_mbus_config = mt9t031_g_mbus_config, + .s_mbus_config = mt9t031_s_mbus_config, +}; + +static const struct v4l2_subdev_sensor_ops mt9t031_subdev_sensor_ops = { + .g_skip_top_lines = mt9t031_g_skip_top_lines, +}; + +static const struct v4l2_subdev_pad_ops mt9t031_subdev_pad_ops = { + .enum_mbus_code = mt9t031_enum_mbus_code, + .get_selection = mt9t031_get_selection, + .set_selection = mt9t031_set_selection, + .get_fmt = mt9t031_get_fmt, + .set_fmt = mt9t031_set_fmt, +}; + +static const struct v4l2_subdev_ops mt9t031_subdev_ops = { + .core = &mt9t031_subdev_core_ops, + .video = &mt9t031_subdev_video_ops, + .sensor = &mt9t031_subdev_sensor_ops, + .pad = &mt9t031_subdev_pad_ops, +}; + +static int mt9t031_probe(struct i2c_client *client, + const struct i2c_device_id *did) +{ + struct mt9t031 *mt9t031; + struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client); + struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); + int ret; + + if (!ssdd) { + dev_err(&client->dev, "MT9T031 driver needs platform data\n"); + return -EINVAL; + } + + if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WORD_DATA)) { + dev_warn(&adapter->dev, + "I2C-Adapter doesn't support I2C_FUNC_SMBUS_WORD\n"); + return -EIO; + } + + mt9t031 = devm_kzalloc(&client->dev, sizeof(struct mt9t031), GFP_KERNEL); + if (!mt9t031) + return -ENOMEM; + + v4l2_i2c_subdev_init(&mt9t031->subdev, client, &mt9t031_subdev_ops); + v4l2_ctrl_handler_init(&mt9t031->hdl, 5); + v4l2_ctrl_new_std(&mt9t031->hdl, &mt9t031_ctrl_ops, + V4L2_CID_VFLIP, 0, 1, 1, 0); + v4l2_ctrl_new_std(&mt9t031->hdl, &mt9t031_ctrl_ops, + V4L2_CID_HFLIP, 0, 1, 1, 0); + v4l2_ctrl_new_std(&mt9t031->hdl, &mt9t031_ctrl_ops, + V4L2_CID_GAIN, 0, 127, 1, 64); + + /* + * Simulated autoexposure. If enabled, we calculate shutter width + * ourselves in the driver based on vertical blanking and frame width + */ + mt9t031->autoexposure = v4l2_ctrl_new_std_menu(&mt9t031->hdl, + &mt9t031_ctrl_ops, V4L2_CID_EXPOSURE_AUTO, 1, 0, + V4L2_EXPOSURE_AUTO); + mt9t031->exposure = v4l2_ctrl_new_std(&mt9t031->hdl, &mt9t031_ctrl_ops, + V4L2_CID_EXPOSURE, 1, 255, 1, 255); + + mt9t031->subdev.ctrl_handler = &mt9t031->hdl; + if (mt9t031->hdl.error) + return mt9t031->hdl.error; + + v4l2_ctrl_auto_cluster(2, &mt9t031->autoexposure, + V4L2_EXPOSURE_MANUAL, true); + + mt9t031->y_skip_top = 0; + mt9t031->rect.left = MT9T031_COLUMN_SKIP; + mt9t031->rect.top = MT9T031_ROW_SKIP; + mt9t031->rect.width = MT9T031_MAX_WIDTH; + mt9t031->rect.height = MT9T031_MAX_HEIGHT; + + mt9t031->xskip = 1; + mt9t031->yskip = 1; + + mt9t031->clk = v4l2_clk_get(&client->dev, "mclk"); + if (IS_ERR(mt9t031->clk)) { + ret = PTR_ERR(mt9t031->clk); + goto eclkget; + } + + ret = mt9t031_video_probe(client); + if (ret) { + v4l2_clk_put(mt9t031->clk); +eclkget: + v4l2_ctrl_handler_free(&mt9t031->hdl); + } + + return ret; +} + +static int mt9t031_remove(struct i2c_client *client) +{ + struct mt9t031 *mt9t031 = to_mt9t031(client); + + v4l2_clk_put(mt9t031->clk); + v4l2_device_unregister_subdev(&mt9t031->subdev); + v4l2_ctrl_handler_free(&mt9t031->hdl); + + return 0; +} + +static const struct i2c_device_id mt9t031_id[] = { + { "mt9t031", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, mt9t031_id); + +static struct i2c_driver mt9t031_i2c_driver = { + .driver = { + .name = "mt9t031", + }, + .probe = mt9t031_probe, + .remove = mt9t031_remove, + .id_table = mt9t031_id, +}; + +module_i2c_driver(mt9t031_i2c_driver); + +MODULE_DESCRIPTION("Micron MT9T031 Camera driver"); +MODULE_AUTHOR("Guennadi Liakhovetski <lg@denx.de>"); +MODULE_LICENSE("GPL v2"); |