diff options
Diffstat (limited to 'drivers/staging/media/atomisp')
95 files changed, 1344 insertions, 3064 deletions
diff --git a/drivers/staging/media/atomisp/Makefile b/drivers/staging/media/atomisp/Makefile index 205d0f8cc2e1..1dfad0dd02d0 100644 --- a/drivers/staging/media/atomisp/Makefile +++ b/drivers/staging/media/atomisp/Makefile @@ -307,18 +307,12 @@ INCLUDES += \ -I$(atomisp)/pci/runtime/queue/src/ \ -I$(atomisp)/pci/runtime/rmgr/interface/ \ -I$(atomisp)/pci/runtime/spctrl/interface/ \ - -I$(atomisp)/pci/runtime/tagger/interface/ - -INCLUDES_byt += \ + -I$(atomisp)/pci/runtime/tagger/interface/ \ -I$(atomisp)/pci/css_2400_system/hive/ \ - -INCLUDES_cht += \ -I$(atomisp)/pci/css_2401_system/ \ -I$(atomisp)/pci/css_2401_system/host/ \ -I$(atomisp)/pci/css_2401_system/hive/ \ - -I$(atomisp)/pci/css_2401_system/hrt/ \ - -# -I$(atomisp)/pci/css_2401_system/hive_isp_css_2401_system_generated/ \ + -I$(atomisp)/pci/css_2401_system/hrt/ DEFINES := -DHRT_HW -DHRT_ISP_CSS_CUSTOM_HOST -DHRT_USE_VIR_ADDRS -D__HOST__ #DEFINES += -DUSE_DYNAMIC_BIN @@ -330,11 +324,9 @@ DEFINES := -DHRT_HW -DHRT_ISP_CSS_CUSTOM_HOST -DHRT_USE_VIR_ADDRS -D__HOST__ ifeq ($(CONFIG_VIDEO_ATOMISP_ISP2401),y) atomisp-objs += $(obj-cht) -INCLUDES += $(INCLUDES_cht) DEFINES += -DISP2401 -DISP2401_NEW_INPUT_SYSTEM -DSYSTEM_hive_isp_css_2401_system else atomisp-objs += $(obj-byt) -INCLUDES += $(INCLUDES_byt) DEFINES += -DISP2400 -DSYSTEM_hive_isp_css_2400_system endif diff --git a/drivers/staging/media/atomisp/i2c/Kconfig b/drivers/staging/media/atomisp/i2c/Kconfig index 7c7f0fc090b3..a772b833a85f 100644 --- a/drivers/staging/media/atomisp/i2c/Kconfig +++ b/drivers/staging/media/atomisp/i2c/Kconfig @@ -3,53 +3,51 @@ # Kconfig for sensor drivers # -source "drivers/staging/media/atomisp/i2c/ov5693/Kconfig" - config VIDEO_ATOMISP_OV2722 - tristate "OVT ov2722 sensor support" + tristate "OVT ov2722 sensor support" depends on ACPI - depends on I2C && VIDEO_V4L2 + depends on I2C && VIDEO_V4L2 help - This is a Video4Linux2 sensor-level driver for the OVT - OV2722 raw camera. + This is a Video4Linux2 sensor-level driver for the OVT + OV2722 raw camera. - OVT is a 2M raw sensor. + OVT is a 2M raw sensor. - It currently only works with the atomisp driver. + It currently only works with the atomisp driver. config VIDEO_ATOMISP_GC2235 - tristate "Galaxy gc2235 sensor support" + tristate "Galaxy gc2235 sensor support" depends on ACPI - depends on I2C && VIDEO_V4L2 + depends on I2C && VIDEO_V4L2 help - This is a Video4Linux2 sensor-level driver for the OVT - GC2235 raw camera. + This is a Video4Linux2 sensor-level driver for the OVT + GC2235 raw camera. - GC2235 is a 2M raw sensor. + GC2235 is a 2M raw sensor. - It currently only works with the atomisp driver. + 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 + tristate "Helper library to load, parse and apply large register lists." + depends on I2C help - This is a helper library to be used from a sensor driver to load, parse - and apply large register lists. + This is a helper library to be used from a sensor driver to load, parse + and apply large register lists. - To compile this driver as a module, choose M here: the - module will be called libmsrlisthelper. + To compile this driver as a module, choose M here: the + module will be called libmsrlisthelper. config VIDEO_ATOMISP_MT9M114 - tristate "Aptina mt9m114 sensor support" + tristate "Aptina mt9m114 sensor support" depends on ACPI - depends on I2C && VIDEO_V4L2 + depends on I2C && VIDEO_V4L2 help - This is a Video4Linux2 sensor-level driver for the Micron - mt9m114 1.3 Mpixel camera. + This is a Video4Linux2 sensor-level driver for the Micron + mt9m114 1.3 Mpixel camera. - mt9m114 is video camera sensor. + mt9m114 is video camera sensor. - It currently only works with the atomisp driver. + It currently only works with the atomisp driver. config VIDEO_ATOMISP_GC0310 tristate "GC0310 sensor support" @@ -60,16 +58,28 @@ config VIDEO_ATOMISP_GC0310 GC0310 0.3MP sensor. config VIDEO_ATOMISP_OV2680 - tristate "Omnivision OV2680 sensor support" + tristate "Omnivision OV2680 sensor support" + depends on ACPI + depends on I2C && VIDEO_V4L2 + help + This is a Video4Linux2 sensor-level driver for the Omnivision + OV2680 raw camera. + + ov2680 is a 2M raw sensor. + + It currently only works with the atomisp driver. + +config VIDEO_ATOMISP_OV5693 + tristate "Omnivision ov5693 sensor support" depends on ACPI - depends on I2C && VIDEO_V4L2 + depends on I2C && VIDEO_V4L2 help - This is a Video4Linux2 sensor-level driver for the Omnivision - OV2680 raw camera. + This is a Video4Linux2 sensor-level driver for the Micron + ov5693 5 Mpixel camera. - ov2680 is a 2M raw sensor. + ov5693 is video camera sensor. - It currently only works with the atomisp driver. + It currently only works with the atomisp driver. # # Kconfig for flash drivers diff --git a/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c b/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c index 809010af7855..7ca7378b1859 100644 --- a/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c +++ b/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c @@ -19,14 +19,13 @@ #include <linux/i2c.h> #include <linux/mutex.h> #include <linux/delay.h> -#include <linux/gpio.h> +#include <linux/gpio/consumer.h> #include <linux/slab.h> #include "../include/media/lm3554.h" #include <media/v4l2-ctrls.h> #include <media/v4l2-device.h> #include <linux/acpi.h> -#include <linux/gpio/consumer.h> #include "../include/linux/atomisp_gmin_platform.h" #include "../include/linux/atomisp.h" @@ -173,7 +172,7 @@ static void lm3554_flash_off_delay(struct timer_list *t) struct lm3554 *flash = from_timer(flash, t, flash_off_delay); struct lm3554_platform_data *pdata = flash->pdata; - gpio_set_value(pdata->gpio_strobe, 0); + gpiod_set_value(pdata->gpio_strobe, 0); } static int lm3554_hw_strobe(struct i2c_client *client, bool strobe) @@ -209,7 +208,7 @@ static int lm3554_hw_strobe(struct i2c_client *client, bool strobe) * so must strobe off here */ if (timer_pending) - gpio_set_value(pdata->gpio_strobe, 0); + gpiod_set_value(pdata->gpio_strobe, 0); /* Restore flash current settings */ ret = lm3554_set_flash(flash); @@ -217,7 +216,7 @@ static int lm3554_hw_strobe(struct i2c_client *client, bool strobe) goto err; /* Strobe on Flash */ - gpio_set_value(pdata->gpio_strobe, 1); + gpiod_set_value(pdata->gpio_strobe, 1); return 0; err: @@ -627,7 +626,7 @@ static int __lm3554_s_power(struct lm3554 *flash, int power) int ret; /*initialize flash driver*/ - gpio_set_value(pdata->gpio_reset, power); + gpiod_set_value(pdata->gpio_reset, power); usleep_range(100, 100 + 1); if (power) { @@ -766,33 +765,22 @@ static int lm3554_gpio_init(struct i2c_client *client) struct lm3554_platform_data *pdata = flash->pdata; int ret; - if (!gpio_is_valid(pdata->gpio_reset)) + if (!pdata->gpio_reset) return -EINVAL; - ret = gpio_direction_output(pdata->gpio_reset, 0); + ret = gpiod_direction_output(pdata->gpio_reset, 0); if (ret < 0) - goto err_gpio_reset; + return ret; dev_info(&client->dev, "flash led reset successfully\n"); - if (!gpio_is_valid(pdata->gpio_strobe)) { - ret = -EINVAL; - goto err_gpio_dir_reset; - } + if (!pdata->gpio_strobe) + return -EINVAL; - ret = gpio_direction_output(pdata->gpio_strobe, 0); + ret = gpiod_direction_output(pdata->gpio_strobe, 0); if (ret < 0) - goto err_gpio_strobe; + return ret; return 0; - -err_gpio_strobe: - gpio_free(pdata->gpio_strobe); -err_gpio_dir_reset: - gpio_direction_output(pdata->gpio_reset, 0); -err_gpio_reset: - gpio_free(pdata->gpio_reset); - - return ret; } static int lm3554_gpio_uninit(struct i2c_client *client) @@ -802,16 +790,14 @@ static int lm3554_gpio_uninit(struct i2c_client *client) struct lm3554_platform_data *pdata = flash->pdata; int ret; - ret = gpio_direction_output(pdata->gpio_strobe, 0); + ret = gpiod_direction_output(pdata->gpio_strobe, 0); if (ret < 0) return ret; - ret = gpio_direction_output(pdata->gpio_reset, 0); + ret = gpiod_direction_output(pdata->gpio_reset, 0); if (ret < 0) return ret; - gpio_free(pdata->gpio_strobe); - gpio_free(pdata->gpio_reset); return 0; } @@ -819,18 +805,18 @@ static void *lm3554_platform_data_func(struct i2c_client *client) { static struct lm3554_platform_data platform_data; - platform_data.gpio_reset = - desc_to_gpio(gpiod_get_index(&client->dev, - NULL, 2, GPIOD_OUT_LOW)); - platform_data.gpio_strobe = - desc_to_gpio(gpiod_get_index(&client->dev, - NULL, 0, GPIOD_OUT_LOW)); - platform_data.gpio_torch = - desc_to_gpio(gpiod_get_index(&client->dev, - NULL, 1, GPIOD_OUT_LOW)); - dev_info(&client->dev, "camera pdata: lm3554: reset: %d strobe %d torch %d\n", - platform_data.gpio_reset, platform_data.gpio_strobe, - platform_data.gpio_torch); + platform_data.gpio_reset = gpiod_get_index(&client->dev, + NULL, 2, GPIOD_OUT_LOW); + if (IS_ERR(platform_data.gpio_reset)) + return ERR_CAST(platform_data.gpio_reset); + platform_data.gpio_strobe = gpiod_get_index(&client->dev, + NULL, 0, GPIOD_OUT_LOW); + if (IS_ERR(platform_data.gpio_strobe)) + return ERR_CAST(platform_data.gpio_strobe); + platform_data.gpio_torch = gpiod_get_index(&client->dev, + NULL, 1, GPIOD_OUT_LOW); + if (IS_ERR(platform_data.gpio_torch)) + return ERR_CAST(platform_data.gpio_torch); /* Set to TX2 mode, then ENVM/TX2 pin is a power amplifier sync input: * ENVM/TX pin asserted, flash forced into torch; @@ -857,6 +843,8 @@ static int lm3554_probe(struct i2c_client *client) return -ENOMEM; flash->pdata = lm3554_platform_data_func(client); + if (IS_ERR(flash->pdata)) + return PTR_ERR(flash->pdata); v4l2_i2c_subdev_init(&flash->sd, client, &lm3554_ops); flash->sd.internal_ops = &lm3554_internal_ops; diff --git a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c index 0d60918a9b19..f5de81132177 100644 --- a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c +++ b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c @@ -212,7 +212,7 @@ misensor_rmw_reg(struct i2c_client *client, u16 data_length, u16 reg, err = mt9m114_read_reg(client, data_length, reg, &val); if (err) { - v4l2_err(client, "misensor_rmw_reg error exit, read failed\n"); + v4l2_err(client, "%s error exit, read failed\n", __func__); return -EINVAL; } @@ -233,7 +233,7 @@ misensor_rmw_reg(struct i2c_client *client, u16 data_length, u16 reg, err = mt9m114_write_reg(client, data_length, reg, val); if (err) { - v4l2_err(client, "misensor_rmw_reg error exit, write failed\n"); + v4l2_err(client, "%s error exit, write failed\n", __func__); return -EINVAL; } diff --git a/drivers/staging/media/atomisp/i2c/ov5693/Kconfig b/drivers/staging/media/atomisp/i2c/ov5693/Kconfig deleted file mode 100644 index c8d09f416c35..000000000000 --- a/drivers/staging/media/atomisp/i2c/ov5693/Kconfig +++ /dev/null @@ -1,12 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -config VIDEO_ATOMISP_OV5693 - tristate "Omnivision ov5693 sensor support" - depends on ACPI - depends on I2C && VIDEO_V4L2 - help - This is a Video4Linux2 sensor-level driver for the Micron - ov5693 5 Mpixel camera. - - ov5693 is video camera sensor. - - It currently only works with the atomisp driver. diff --git a/drivers/staging/media/atomisp/include/media/lm3554.h b/drivers/staging/media/atomisp/include/media/lm3554.h index 812ce74f0635..711b7d7c9950 100644 --- a/drivers/staging/media/atomisp/include/media/lm3554.h +++ b/drivers/staging/media/atomisp/include/media/lm3554.h @@ -18,6 +18,7 @@ #ifndef _LM3554_H_ #define _LM3554_H_ +#include <linux/gpio/consumer.h> #include <linux/videodev2.h> #include <media/v4l2-subdev.h> @@ -119,9 +120,9 @@ * lm3554_platform_data - Flash controller platform data */ struct lm3554_platform_data { - int gpio_torch; - int gpio_strobe; - int gpio_reset; + struct gpio_desc *gpio_torch; + struct gpio_desc *gpio_strobe; + struct gpio_desc *gpio_reset; unsigned int current_limit; unsigned int envm_tx2; diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c index a4e4eef55f35..592ea990d4ca 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c @@ -654,8 +654,7 @@ bool atomisp_buffers_queued(struct atomisp_sub_device *asd) return asd->video_out_capture.buffers_in_css || asd->video_out_vf.buffers_in_css || asd->video_out_preview.buffers_in_css || - asd->video_out_video_capture.buffers_in_css ? - true : false; + asd->video_out_video_capture.buffers_in_css; } /* ISP2401 */ @@ -877,7 +876,8 @@ static struct atomisp_video_pipe *__atomisp_get_pipe( enum atomisp_metadata_type atomisp_get_metadata_type(struct atomisp_sub_device *asd, - enum ia_css_pipe_id pipe_id) { + enum ia_css_pipe_id pipe_id) +{ if (!asd->continuous_mode->val) return ATOMISP_MAIN_METADATA; @@ -1211,8 +1211,7 @@ void atomisp_buf_done(struct atomisp_sub_device *asd, int error, default: break; } - if (vb) - { + if (vb) { vb->ts = ktime_get_ns(); vb->field_count = atomic_read(&asd->sequence) << 1; /*mark videobuffer done for dequeue*/ @@ -1234,8 +1233,7 @@ void atomisp_buf_done(struct atomisp_sub_device *asd, int error, * Requeue should only be done for 3a and dis buffers. * Queue/dequeue order will change if driver recycles image buffers. */ - if (requeue) - { + if (requeue) { err = atomisp_css_queue_buffer(asd, stream_id, css_pipe_id, buf_type, &buffer); @@ -1940,9 +1938,9 @@ int atomisp_get_frame_pgnr(struct atomisp_device *isp, * Get internal fmt according to V4L2 fmt */ static enum ia_css_frame_format -v4l2_fmt_to_sh_fmt(u32 fmt) { - switch (fmt) - { +v4l2_fmt_to_sh_fmt(u32 fmt) +{ + switch (fmt) { case V4L2_PIX_FMT_YUV420: return IA_CSS_FRAME_FORMAT_YUV420; case V4L2_PIX_FMT_YVU420: @@ -2812,7 +2810,6 @@ int atomisp_get_metadata(struct atomisp_sub_device *asd, int flag, struct atomisp_metadata *md) { struct atomisp_device *isp = asd->isp; - struct ia_css_stream_config *stream_config; struct ia_css_stream_info *stream_info; struct camera_mipi_info *mipi_info; struct atomisp_metadata_buf *md_buf; @@ -2822,8 +2819,6 @@ int atomisp_get_metadata(struct atomisp_sub_device *asd, int flag, if (flag != 0) return -EINVAL; - stream_config = &asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL]. - stream_config; stream_info = &asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL]. stream_info; @@ -2891,7 +2886,6 @@ int atomisp_get_metadata_by_type(struct atomisp_sub_device *asd, int flag, struct atomisp_metadata_with_type *md) { struct atomisp_device *isp = asd->isp; - struct ia_css_stream_config *stream_config; struct ia_css_stream_info *stream_info; struct camera_mipi_info *mipi_info; struct atomisp_metadata_buf *md_buf; @@ -2901,8 +2895,6 @@ int atomisp_get_metadata_by_type(struct atomisp_sub_device *asd, int flag, if (flag != 0) return -EINVAL; - stream_config = &asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL]. - stream_config; stream_info = &asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL]. stream_info; @@ -4981,9 +4973,8 @@ enum mipi_port_id __get_mipi_port(struct atomisp_device *isp, case ATOMISP_CAMERA_PORT_SECONDARY: return MIPI_PORT1_ID; case ATOMISP_CAMERA_PORT_TERTIARY: - if (MIPI_PORT1_ID + 1 != N_MIPI_PORT_ID) { + if (MIPI_PORT1_ID + 1 != N_MIPI_PORT_ID) return MIPI_PORT1_ID + 1; - } fallthrough; default: dev_err(isp->dev, "unsupported port: %d\n", port); @@ -6557,7 +6548,7 @@ int atomisp_enable_dz_capt_pipe(struct atomisp_sub_device *asd, if (!enable) return -EINVAL; - value = *enable > 0 ? true : false; + value = *enable > 0; atomisp_en_dz_capt_pipe(asd, value); diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c index 1b2b2c68025b..faa0935e536a 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c +++ b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c @@ -159,19 +159,14 @@ static void atomisp_css2_hw_load(hrt_address addr, void *to, uint32_t n) spin_unlock_irqrestore(&mmio_lock, flags); } -static int atomisp_css2_dbg_print(const char *fmt, va_list args) -{ - vprintk(fmt, args); - return 0; -} - -static int atomisp_css2_dbg_ftrace_print(const char *fmt, va_list args) +static int __printf(1, 0) atomisp_css2_dbg_ftrace_print(const char *fmt, + va_list args) { ftrace_vprintk(fmt, args); return 0; } -static int atomisp_css2_err_print(const char *fmt, va_list args) +static int __printf(1, 0) atomisp_vprintk(const char *fmt, va_list args) { vprintk(fmt, args); return 0; @@ -711,7 +706,6 @@ static bool is_pipe_valid_to_current_run_mode(struct atomisp_sub_device *asd, return true; return false; - fallthrough; case ATOMISP_RUN_MODE_VIDEO: if (!asd->continuous_mode->val) { if (pipe_id == IA_CSS_PIPE_ID_VIDEO || @@ -869,8 +863,7 @@ static inline int __set_css_print_env(struct atomisp_device *isp, int opt) isp->css_env.isp_css_env.print_env.debug_print = atomisp_css2_dbg_ftrace_print; else if (opt == 2) - isp->css_env.isp_css_env.print_env.debug_print = - atomisp_css2_dbg_print; + isp->css_env.isp_css_env.print_env.debug_print = atomisp_vprintk; else ret = -EINVAL; @@ -903,7 +896,7 @@ int atomisp_css_load_firmware(struct atomisp_device *isp) __set_css_print_env(isp, dbg_func); - isp->css_env.isp_css_env.print_env.error_print = atomisp_css2_err_print; + isp->css_env.isp_css_env.print_env.error_print = atomisp_vprintk; /* load isp fw into ISP memory */ err = ia_css_load_firmware(isp->dev, &isp->css_env.isp_css_env, diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c b/drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c index fa5918270614..e5553df5bad4 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c +++ b/drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c @@ -25,15 +25,25 @@ #include "atomisp_ioctl.h" #include "atomisp_compat_ioctl32.h" -/* Macro borrowed from v4l2-compat-ioctl32.c */ -/* Use the same argument order as copy_in_user */ -#define assign_in_user(to, from) \ -({ \ - typeof(*from) __assign_tmp; \ - \ - get_user(__assign_tmp, from) || put_user(__assign_tmp, to); \ +/* Macros borrowed from v4l2-compat-ioctl32.c */ + +#define get_user_cast(__x, __ptr) \ +({ \ + get_user(__x, (typeof(*__ptr) __user *)(__ptr)); \ }) +#define put_user_force(__x, __ptr) \ +({ \ + put_user((typeof(*__x) __force *)(__x), __ptr); \ +}) + +/* Use the same argument order as copy_in_user */ +#define assign_in_user(to, from) \ +({ \ + typeof(*from) __assign_tmp; \ + \ + get_user_cast(__assign_tmp, from) || put_user(__assign_tmp, to);\ +}) static int get_atomisp_histogram32(struct atomisp_histogram __user *kp, struct atomisp_histogram32 __user *up) @@ -64,13 +74,13 @@ static int put_atomisp_histogram32(struct atomisp_histogram __user *kp, } static int get_v4l2_framebuffer32(struct v4l2_framebuffer __user *kp, - struct v4l2_framebuffer32 __user *up) + struct v4l2_framebuffer32 __user *up) { compat_uptr_t tmp; if (!access_ok(up, sizeof(struct v4l2_framebuffer32)) || get_user(tmp, &up->base) || - put_user(compat_ptr(tmp), &kp->base) || + put_user_force(compat_ptr(tmp), &kp->base) || assign_in_user(&kp->capability, &up->capability) || assign_in_user(&kp->flags, &up->flags) || copy_in_user(&kp->fmt, &up->fmt, sizeof(kp->fmt))) @@ -244,10 +254,10 @@ static int get_atomisp_dvs_6axis_config32(struct atomisp_dvs_6axis_config __user get_user(ycoords_y, &up->ycoords_y) || get_user(xcoords_uv, &up->xcoords_uv) || get_user(ycoords_uv, &up->ycoords_uv) || - put_user(compat_ptr(xcoords_y), &kp->xcoords_y) || - put_user(compat_ptr(ycoords_y), &kp->ycoords_y) || - put_user(compat_ptr(xcoords_uv), &kp->xcoords_uv) || - put_user(compat_ptr(ycoords_uv), &kp->ycoords_uv)) + put_user_force(compat_ptr(xcoords_y), &kp->xcoords_y) || + put_user_force(compat_ptr(ycoords_y), &kp->ycoords_y) || + put_user_force(compat_ptr(xcoords_uv), &kp->xcoords_uv) || + put_user_force(compat_ptr(ycoords_uv), &kp->ycoords_uv)) return -EFAULT; return 0; @@ -279,7 +289,7 @@ static int put_atomisp_3a_statistics32(struct atomisp_3a_statistics __user *kp, void __user *rgby_data; if (!access_ok(up, sizeof(struct atomisp_3a_statistics32)) || - copy_to_user(up, kp, sizeof(struct atomisp_grid_info)) || + copy_in_user(up, kp, sizeof(struct atomisp_grid_info)) || get_user(rgby_data, &kp->rgby_data) || put_user(ptr_to_compat(rgby_data), &up->rgby_data) || get_user(data, &kp->data) || @@ -305,7 +315,7 @@ static int get_atomisp_metadata_stat32(struct atomisp_metadata __user *kp, assign_in_user(&kp->stride, &up->stride) || assign_in_user(&kp->exp_id, &up->exp_id) || get_user(effective_width, &up->effective_width) || - put_user(compat_ptr(effective_width), &kp->effective_width)) + put_user_force(compat_ptr(effective_width), &kp->effective_width)) return -EFAULT; return 0; @@ -315,7 +325,7 @@ static int put_atomisp_metadata_stat32(struct atomisp_metadata __user *kp, struct atomisp_metadata32 __user *up) { void __user *data; - void __user *effective_width; + void *effective_width; if (!access_ok(up, sizeof(struct atomisp_metadata32)) || get_user(data, &kp->data) || @@ -325,7 +335,8 @@ static int put_atomisp_metadata_stat32(struct atomisp_metadata __user *kp, assign_in_user(&up->stride, &kp->stride) || assign_in_user(&up->exp_id, &kp->exp_id) || get_user(effective_width, &kp->effective_width) || - put_user(ptr_to_compat(effective_width), &up->effective_width)) + put_user(ptr_to_compat((void __user *)effective_width), + &up->effective_width)) return -EFAULT; return 0; @@ -336,7 +347,7 @@ put_atomisp_metadata_by_type_stat32(struct atomisp_metadata_with_type __user *kp struct atomisp_metadata_with_type32 __user *up) { void __user *data; - void __user *effective_width; + u32 *effective_width; if (!access_ok(up, sizeof(struct atomisp_metadata_with_type32)) || get_user(data, &kp->data) || @@ -346,7 +357,7 @@ put_atomisp_metadata_by_type_stat32(struct atomisp_metadata_with_type __user *kp assign_in_user(&up->stride, &kp->stride) || assign_in_user(&up->exp_id, &kp->exp_id) || get_user(effective_width, &kp->effective_width) || - put_user(ptr_to_compat(effective_width), + put_user(ptr_to_compat((void __user *)effective_width), &up->effective_width) || assign_in_user(&up->type, &kp->type)) return -EFAULT; @@ -369,7 +380,7 @@ get_atomisp_metadata_by_type_stat32(struct atomisp_metadata_with_type __user *kp assign_in_user(&kp->stride, &up->stride) || assign_in_user(&kp->exp_id, &up->exp_id) || get_user(effective_width, &up->effective_width) || - put_user(compat_ptr(effective_width), &kp->effective_width) || + put_user_force(compat_ptr(effective_width), &kp->effective_width) || assign_in_user(&kp->type, &up->type)) return -EFAULT; @@ -430,7 +441,7 @@ static int get_atomisp_overlay32(struct atomisp_overlay __user *kp, if (!access_ok(up, sizeof(struct atomisp_overlay32)) || get_user(frame, &up->frame) || - put_user(compat_ptr(frame), &kp->frame) || + put_user_force(compat_ptr(frame), &kp->frame) || assign_in_user(&kp->bg_y, &up->bg_y) || assign_in_user(&kp->bg_u, &up->bg_u) || assign_in_user(&kp->bg_v, &up->bg_v) || @@ -456,11 +467,11 @@ static int get_atomisp_overlay32(struct atomisp_overlay __user *kp, static int put_atomisp_overlay32(struct atomisp_overlay __user *kp, struct atomisp_overlay32 __user *up) { - void __user *frame; + void *frame; if (!access_ok(up, sizeof(struct atomisp_overlay32)) || get_user(frame, &kp->frame) || - put_user(ptr_to_compat(frame), &up->frame) || + put_user(ptr_to_compat((void __user *)frame), &up->frame) || assign_in_user(&up->bg_y, &kp->bg_y) || assign_in_user(&up->bg_u, &kp->bg_u) || assign_in_user(&up->bg_v, &kp->bg_v) || @@ -493,7 +504,7 @@ get_atomisp_calibration_group32(struct atomisp_calibration_group __user *kp, assign_in_user(&kp->size, &up->size) || assign_in_user(&kp->type, &up->type) || get_user(calb_grp_values, &up->calb_grp_values) || - put_user(compat_ptr(calb_grp_values), &kp->calb_grp_values)) + put_user_force(compat_ptr(calb_grp_values), &kp->calb_grp_values)) return -EFAULT; return 0; @@ -503,13 +514,14 @@ static int put_atomisp_calibration_group32(struct atomisp_calibration_group __user *kp, struct atomisp_calibration_group32 __user *up) { - void __user *calb_grp_values; + void *calb_grp_values; if (!access_ok(up, sizeof(struct atomisp_calibration_group32)) || assign_in_user(&up->size, &kp->size) || assign_in_user(&up->type, &kp->type) || get_user(calb_grp_values, &kp->calb_grp_values) || - put_user(ptr_to_compat(calb_grp_values), &up->calb_grp_values)) + put_user(ptr_to_compat((void __user *)calb_grp_values), + &up->calb_grp_values)) return -EFAULT; return 0; @@ -523,7 +535,7 @@ static int get_atomisp_acc_fw_load32(struct atomisp_acc_fw_load __user *kp, if (!access_ok(up, sizeof(struct atomisp_acc_fw_load32)) || assign_in_user(&kp->size, &up->size) || assign_in_user(&kp->fw_handle, &up->fw_handle) || - get_user(data, &up->data) || + get_user_cast(data, &up->data) || put_user(compat_ptr(data), &kp->data)) return -EFAULT; @@ -627,7 +639,7 @@ static int get_atomisp_shading_table32(struct atomisp_shading_table __user *kp, compat_uptr_t tmp; if (get_user(tmp, &up->data[n]) || - put_user(compat_ptr(tmp), &kp->data[n])) + put_user_force(compat_ptr(tmp), &kp->data[n])) return -EFAULT; } return 0; @@ -712,17 +724,17 @@ static int get_atomisp_parameters32(struct atomisp_parameters __user *kp, struct atomisp_morph_table morph_table; struct atomisp_dis_coefficients dvs2_coefs; struct atomisp_dvs_6axis_config dvs_6axis_config; - } __user *karg = (void *)(kp + 1); + } __user *karg = (void __user *)(kp + 1); if (!access_ok(up, sizeof(struct atomisp_parameters32))) return -EFAULT; while (n >= 0) { - compat_uptr_t *src = (compat_uptr_t *)up + n; + compat_uptr_t __user *src = (compat_uptr_t __user *)up + n; void * __user *dst = (void * __user *)kp + n; compat_uptr_t tmp; - if (get_user(tmp, src) || put_user(compat_ptr(tmp), dst)) + if (get_user_cast(tmp, src) || put_user_force(compat_ptr(tmp), dst)) return -EFAULT; n--; } @@ -738,26 +750,26 @@ static int get_atomisp_parameters32(struct atomisp_parameters __user *kp, /* handle shading table */ if (stp && (get_atomisp_shading_table32(&karg->shading_table, compat_ptr(stp)) || - put_user(&karg->shading_table, &kp->shading_table))) + put_user_force(&karg->shading_table, &kp->shading_table))) return -EFAULT; /* handle morph table */ if (mtp && (get_atomisp_morph_table32(&karg->morph_table, compat_ptr(mtp)) || - put_user(&karg->morph_table, &kp->morph_table))) + put_user_force(&karg->morph_table, &kp->morph_table))) return -EFAULT; /* handle dvs2 coefficients */ if (dcp && (get_atomisp_dis_coefficients32(&karg->dvs2_coefs, compat_ptr(dcp)) || - put_user(&karg->dvs2_coefs, &kp->dvs2_coefs))) + put_user_force(&karg->dvs2_coefs, &kp->dvs2_coefs))) return -EFAULT; /* handle dvs 6axis configuration */ if (dscp && (get_atomisp_dvs_6axis_config32(&karg->dvs_6axis_config, compat_ptr(dscp)) || - put_user(&karg->dvs_6axis_config, &kp->dvs_6axis_config))) + put_user_force(&karg->dvs_6axis_config, &kp->dvs_6axis_config))) return -EFAULT; return 0; @@ -814,7 +826,7 @@ get_atomisp_sensor_ae_bracketing_lut(struct atomisp_sensor_ae_bracketing_lut __u if (!access_ok(up, sizeof(struct atomisp_sensor_ae_bracketing_lut32)) || assign_in_user(&kp->lut_size, &up->lut_size) || get_user(lut, &up->lut) || - put_user(compat_ptr(lut), &kp->lut)) + put_user_force(compat_ptr(lut), &kp->lut)) return -EFAULT; return 0; diff --git a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c index 0df46a1af5f0..135994d44802 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +++ b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c @@ -817,6 +817,9 @@ static int gmin_v1p8_ctrl(struct v4l2_subdev *subdev, int on) int ret; int value; + if (!gs || gs->v1p8_on == on) + return 0; + if (gs->v1p8_gpio >= 0) { pr_info("atomisp_gmin_platform: 1.8v power on GPIO %d\n", gs->v1p8_gpio); @@ -827,8 +830,6 @@ static int gmin_v1p8_ctrl(struct v4l2_subdev *subdev, int on) pr_err("V1P8 GPIO initialization failed\n"); } - if (!gs || gs->v1p8_on == on) - return 0; gs->v1p8_on = on; if (gs->v1p8_gpio >= 0) @@ -871,6 +872,9 @@ static int gmin_v2p8_ctrl(struct v4l2_subdev *subdev, int on) int ret; int value; + if (WARN_ON(!gs)) + return -ENODEV; + if (gs->v2p8_gpio >= 0) { pr_info("atomisp_gmin_platform: 2.8v power on GPIO %d\n", gs->v2p8_gpio); @@ -881,7 +885,7 @@ static int gmin_v2p8_ctrl(struct v4l2_subdev *subdev, int on) pr_err("V2P8 GPIO initialization failed\n"); } - if (!gs || gs->v2p8_on == on) + if (gs->v2p8_on == on) return 0; gs->v2p8_on = on; diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c index 65b0c8a662a0..2ae50decfc8b 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c +++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c @@ -511,8 +511,8 @@ const struct atomisp_format_bridge atomisp_output_fmts[] = { #endif }; -const struct atomisp_format_bridge *atomisp_get_format_bridge( - unsigned int pixelformat) +const struct atomisp_format_bridge * +atomisp_get_format_bridge(unsigned int pixelformat) { unsigned int i; @@ -524,8 +524,8 @@ const struct atomisp_format_bridge *atomisp_get_format_bridge( return NULL; } -const struct atomisp_format_bridge *atomisp_get_format_bridge_from_mbus( - u32 mbus_code) +const struct atomisp_format_bridge * +atomisp_get_format_bridge_from_mbus(u32 mbus_code) { unsigned int i; @@ -605,8 +605,8 @@ static int atomisp_enum_input(struct file *file, void *fh, return 0; } -static unsigned int atomisp_subdev_streaming_count( - struct atomisp_sub_device *asd) +static unsigned int +atomisp_subdev_streaming_count(struct atomisp_sub_device *asd) { return asd->video_out_preview.capq.streaming + asd->video_out_capture.capq.streaming @@ -797,7 +797,7 @@ static int atomisp_enum_fmt_cap(struct file *file, void *fh, continue; } - strlcpy(f->description, format->description, + strscpy(f->description, format->description, sizeof(f->description)); f->pixelformat = format->pixelformat; return 0; @@ -1274,13 +1274,15 @@ done: } } - /* Workaround: Due to the design of HALv3, + /* + * Workaround: Due to the design of HALv3, * sometimes in ZSL or SDV mode HAL needs to * capture multiple images within one streaming cycle. * But the capture number cannot be determined by HAL. * So HAL only sets the capture number to be 1 and queue multiple * buffers. Atomisp driver needs to check this case and re-trigger - * CSS to do capture when new buffer is queued. */ + * CSS to do capture when new buffer is queued. + */ if (asd->continuous_mode->val && atomisp_subdev_source_pad(vdev) == ATOMISP_SUBDEV_PAD_SOURCE_CAPTURE && @@ -1805,7 +1807,7 @@ start_sensor: /* * set freq to max when streaming count > 1 which indicate * dual camera would run - */ + */ if (atomisp_streaming_count(isp) > 1) { if (atomisp_freq_scaling(isp, ATOMISP_DFS_MODE_MAX, false) < 0) @@ -1827,11 +1829,10 @@ start_sensor: dev_err(isp->dev, "master slave sensor stream on failed!\n"); goto out; } - if (!IS_ISP2401) { + if (!IS_ISP2401) __wdt_on_master_slave_sensor(isp, wdt_duration); - } else { + else __wdt_on_master_slave_sensor_pipe(pipe, wdt_duration, true); - } goto start_delay_wq; } else if (asd->depth_mode->val && (atomisp_streaming_count(isp) < ATOMISP_DEPTH_SENSOR_STREAMON_COUNT)) { @@ -2435,8 +2436,10 @@ static int atomisp_g_ext_ctrls(struct file *file, void *fh, struct v4l2_control ctrl; int i, ret = 0; - /* input_lock is not need for the Camera related IOCTLs - * The input_lock downgrade the FPS of 3A*/ + /* + * input_lock is not need for the Camera related IOCTLs + * The input_lock downgrade the FPS of 3A + */ ret = atomisp_camera_g_ext_ctrls(file, fh, c); if (ret != -EINVAL) return ret; @@ -2518,8 +2521,10 @@ static int atomisp_camera_s_ext_ctrls(struct file *file, void *fh, ret = v4l2_s_ctrl(NULL, isp->flash->ctrl_handler, &ctrl); - /* When flash mode is changed we need to reset - * flash state */ + /* + * When flash mode is changed we need to reset + * flash state + */ if (ctrl.id == V4L2_CID_FLASH_MODE) { asd->params.flash_state = ATOMISP_FLASH_IDLE; @@ -2557,8 +2562,10 @@ static int atomisp_s_ext_ctrls(struct file *file, void *fh, struct v4l2_control ctrl; int i, ret = 0; - /* input_lock is not need for the Camera related IOCTLs - * The input_lock downgrade the FPS of 3A*/ + /* + * input_lock is not need for the Camera related IOCTLs + * The input_lock downgrade the FPS of 3A + */ ret = atomisp_camera_s_ext_ctrls(file, fh, c); if (ret != -EINVAL) return ret; @@ -2587,7 +2594,7 @@ static int atomisp_g_parm(struct file *file, void *fh, struct atomisp_device *isp = video_get_drvdata(vdev); if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { - dev_err(isp->dev, "unsupport v4l2 buf type\n"); + dev_err(isp->dev, "unsupported v4l2 buf type\n"); return -EINVAL; } @@ -2609,7 +2616,7 @@ static int atomisp_s_parm(struct file *file, void *fh, int fps; if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { - dev_err(isp->dev, "unsupport v4l2 buf type\n"); + dev_err(isp->dev, "unsupported v4l2 buf type\n"); return -EINVAL; } @@ -2667,7 +2674,7 @@ static int atomisp_s_parm_file(struct file *file, void *fh, struct atomisp_device *isp = video_get_drvdata(vdev); if (parm->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) { - dev_err(isp->dev, "unsupport v4l2 buf type for output\n"); + dev_err(isp->dev, "unsupported v4l2 buf type for output\n"); return -EINVAL; } diff --git a/drivers/staging/media/atomisp/pci/atomisp_subdev.c b/drivers/staging/media/atomisp/pci/atomisp_subdev.c index 6ba817f15655..52b9fb18c87f 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_subdev.c +++ b/drivers/staging/media/atomisp/pci/atomisp_subdev.c @@ -410,8 +410,10 @@ int atomisp_subdev_set_selection(struct v4l2_subdev *sd, if (atomisp_subdev_format_conversion(isp_sd, isp_sd->capture_pad) - && crop[pad]->width && crop[pad]->height) - crop[pad]->width -= padding_w, crop[pad]->height -= padding_h; + && crop[pad]->width && crop[pad]->height) { + crop[pad]->width -= padding_w; + crop[pad]->height -= padding_h; + } /* if subdev type is SOC camera,we do not need to set DVS */ if (isp->inputs[isp_sd->input_curr].type == SOC_CAMERA) diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c index 0114b040247b..0295e2e32d79 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c +++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c @@ -1429,7 +1429,6 @@ atomisp_load_firmware(struct atomisp_device *isp) */ static bool is_valid_device(struct pci_dev *pdev, const struct pci_device_id *id) { - unsigned int a0_max_id = 0; const char *name; const char *product; @@ -1437,11 +1436,9 @@ static bool is_valid_device(struct pci_dev *pdev, const struct pci_device_id *id switch (id->device & ATOMISP_PCI_DEVICE_SOC_MASK) { case ATOMISP_PCI_DEVICE_SOC_MRFLD: - a0_max_id = ATOMISP_PCI_REV_MRFLD_A0_MAX; name = "Merrifield"; break; case ATOMISP_PCI_DEVICE_SOC_BYT: - a0_max_id = ATOMISP_PCI_REV_BYT_A0_MAX; name = "Baytrail"; break; case ATOMISP_PCI_DEVICE_SOC_ANN: @@ -1573,7 +1570,7 @@ static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i spin_lock_init(&isp->lock); /* This is not a true PCI device on SoC, so the delay is not needed. */ - pdev->d3_delay = 0; + pdev->d3hot_delay = 0; pci_set_drvdata(pdev, isp); @@ -1708,8 +1705,8 @@ static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i pci_set_master(pdev); - err = pci_enable_msi(pdev); - if (err) { + err = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_MSI); + if (err < 0) { dev_err(&pdev->dev, "Failed to enable msi (%d)\n", err); goto enable_msi_fail; } @@ -1827,7 +1824,7 @@ register_entities_fail: initialize_modules_fail: cpu_latency_qos_remove_request(&isp->pm_qos); atomisp_msi_irq_uninit(isp); - pci_disable_msi(pdev); + pci_free_irq_vectors(pdev); enable_msi_fail: fw_validation_fail: release_firmware(isp->firmware); diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/host/csi_rx.c b/drivers/staging/media/atomisp/pci/css_2401_system/host/csi_rx.c index 8e661091f7d9..9a8d8f546da7 100644 --- a/drivers/staging/media/atomisp/pci/css_2401_system/host/csi_rx.c +++ b/drivers/staging/media/atomisp/pci/css_2401_system/host/csi_rx.c @@ -14,6 +14,7 @@ */ #include "system_global.h" +#include "csi_rx_global.h" const u32 N_SHORT_PACKET_LUT_ENTRIES[N_CSI_RX_BACKEND_ID] = { 4, /* 4 entries at CSI_RX_BACKEND0_ID*/ diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl.c b/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl.c index 58fec54a914d..8d19c9875a71 100644 --- a/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl.c +++ b/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl.c @@ -15,6 +15,7 @@ #include <type_support.h> #include "system_global.h" +#include "ibuf_ctrl_global.h" const u32 N_IBUF_CTRL_PROCS[N_IBUF_CTRL_ID] = { 8, /* IBUF_CTRL0_ID supports at most 8 processes */ diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl_local.h b/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl_local.h index 4952b42d8191..f71841195ac1 100644 --- a/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl_local.h +++ b/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl_local.h @@ -17,6 +17,7 @@ #define __IBUF_CTRL_LOCAL_H_INCLUDED__ #include "ibuf_ctrl_global.h" +#include "ibuf_ctrl_local.h" typedef struct ibuf_ctrl_proc_state_s ibuf_ctrl_proc_state_t; typedef struct ibuf_ctrl_state_s ibuf_ctrl_state_t; diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl_private.h b/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl_private.h deleted file mode 100644 index a58e8477da6e..000000000000 --- a/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl_private.h +++ /dev/null @@ -1,268 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.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 __IBUF_CTRL_PRIVATE_H_INCLUDED__ -#define __IBUF_CTRL_PRIVATE_H_INCLUDED__ - -#include "ibuf_ctrl_public.h" - -#include "device_access.h" /* ia_css_device_load_uint32 */ - -#include "assert_support.h" /* assert */ -#include "print_support.h" /* print */ - -/***************************************************** - * - * Native command interface (NCI). - * - *****************************************************/ -/** - * @brief Get the ibuf-controller state. - * Refer to "ibuf_ctrl_public.h" for details. - */ -STORAGE_CLASS_IBUF_CTRL_C void ibuf_ctrl_get_state( - const ibuf_ctrl_ID_t ID, - ibuf_ctrl_state_t *state) -{ - u32 i; - - state->recalc_words = - ibuf_ctrl_reg_load(ID, _IBUF_CNTRL_RECALC_WORDS_STATUS); - state->arbiters = - ibuf_ctrl_reg_load(ID, _IBUF_CNTRL_ARBITERS_STATUS); - - /* - * Get the values of the register-set per - * ibuf-controller process. - */ - for (i = 0; i < N_IBUF_CTRL_PROCS[ID]; i++) { - ibuf_ctrl_get_proc_state( - ID, - i, - &state->proc_state[i]); - } -} - -/** - * @brief Get the state of the ibuf-controller process. - * Refer to "ibuf_ctrl_public.h" for details. - */ -STORAGE_CLASS_IBUF_CTRL_C void ibuf_ctrl_get_proc_state( - const ibuf_ctrl_ID_t ID, - const u32 proc_id, - ibuf_ctrl_proc_state_t *state) -{ - hrt_address reg_bank_offset; - - reg_bank_offset = - _IBUF_CNTRL_PROC_REG_ALIGN * (1 + proc_id); - - state->num_items = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_NUM_ITEMS_PER_STORE); - - state->num_stores = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_NUM_STORES_PER_FRAME); - - state->dma_channel = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DMA_CHANNEL); - - state->dma_command = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DMA_CMD); - - state->ibuf_st_addr = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_BUFFER_START_ADDRESS); - - state->ibuf_stride = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_BUFFER_STRIDE); - - state->ibuf_end_addr = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_BUFFER_END_ADDRESS); - - state->dest_st_addr = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DEST_START_ADDRESS); - - state->dest_stride = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DEST_STRIDE); - - state->dest_end_addr = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DEST_END_ADDRESS); - - state->sync_frame = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_SYNC_FRAME); - - state->sync_command = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_STR2MMIO_SYNC_CMD); - - state->store_command = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_STR2MMIO_STORE_CMD); - - state->shift_returned_items = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_SHIFT_ITEMS); - - state->elems_ibuf = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_ELEMS_P_WORD_IBUF); - - state->elems_dest = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_ELEMS_P_WORD_DEST); - - state->cur_stores = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_STORES); - - state->cur_acks = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_ACKS); - - state->cur_s2m_ibuf_addr = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_S2M_IBUF_ADDR); - - state->cur_dma_ibuf_addr = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_DMA_IBUF_ADDR); - - state->cur_dma_dest_addr = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_DMA_DEST_ADDR); - - state->cur_isp_dest_addr = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_ISP_DEST_ADDR); - - state->dma_cmds_send = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_NR_DMA_CMDS_SEND); - - state->main_cntrl_state = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_MAIN_CNTRL_STATE); - - state->dma_sync_state = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DMA_SYNC_STATE); - - state->isp_sync_state = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_ISP_SYNC_STATE); -} - -/** - * @brief Dump the ibuf-controller state. - * Refer to "ibuf_ctrl_public.h" for details. - */ -STORAGE_CLASS_IBUF_CTRL_C void ibuf_ctrl_dump_state( - const ibuf_ctrl_ID_t ID, - ibuf_ctrl_state_t *state) -{ - u32 i; - - ia_css_print("IBUF controller ID %d recalculate words 0x%x\n", ID, - state->recalc_words); - ia_css_print("IBUF controller ID %d arbiters 0x%x\n", ID, state->arbiters); - - /* - * Dump the values of the register-set per - * ibuf-controller process. - */ - for (i = 0; i < N_IBUF_CTRL_PROCS[ID]; i++) { - ia_css_print("IBUF controller ID %d Process ID %d num_items 0x%x\n", ID, i, - state->proc_state[i].num_items); - ia_css_print("IBUF controller ID %d Process ID %d num_stores 0x%x\n", ID, i, - state->proc_state[i].num_stores); - ia_css_print("IBUF controller ID %d Process ID %d dma_channel 0x%x\n", ID, i, - state->proc_state[i].dma_channel); - ia_css_print("IBUF controller ID %d Process ID %d dma_command 0x%x\n", ID, i, - state->proc_state[i].dma_command); - ia_css_print("IBUF controller ID %d Process ID %d ibuf_st_addr 0x%x\n", ID, i, - state->proc_state[i].ibuf_st_addr); - ia_css_print("IBUF controller ID %d Process ID %d ibuf_stride 0x%x\n", ID, i, - state->proc_state[i].ibuf_stride); - ia_css_print("IBUF controller ID %d Process ID %d ibuf_end_addr 0x%x\n", ID, i, - state->proc_state[i].ibuf_end_addr); - ia_css_print("IBUF controller ID %d Process ID %d dest_st_addr 0x%x\n", ID, i, - state->proc_state[i].dest_st_addr); - ia_css_print("IBUF controller ID %d Process ID %d dest_stride 0x%x\n", ID, i, - state->proc_state[i].dest_stride); - ia_css_print("IBUF controller ID %d Process ID %d dest_end_addr 0x%x\n", ID, i, - state->proc_state[i].dest_end_addr); - ia_css_print("IBUF controller ID %d Process ID %d sync_frame 0x%x\n", ID, i, - state->proc_state[i].sync_frame); - ia_css_print("IBUF controller ID %d Process ID %d sync_command 0x%x\n", ID, i, - state->proc_state[i].sync_command); - ia_css_print("IBUF controller ID %d Process ID %d store_command 0x%x\n", ID, i, - state->proc_state[i].store_command); - ia_css_print("IBUF controller ID %d Process ID %d shift_returned_items 0x%x\n", - ID, i, - state->proc_state[i].shift_returned_items); - ia_css_print("IBUF controller ID %d Process ID %d elems_ibuf 0x%x\n", ID, i, - state->proc_state[i].elems_ibuf); - ia_css_print("IBUF controller ID %d Process ID %d elems_dest 0x%x\n", ID, i, - state->proc_state[i].elems_dest); - ia_css_print("IBUF controller ID %d Process ID %d cur_stores 0x%x\n", ID, i, - state->proc_state[i].cur_stores); - ia_css_print("IBUF controller ID %d Process ID %d cur_acks 0x%x\n", ID, i, - state->proc_state[i].cur_acks); - ia_css_print("IBUF controller ID %d Process ID %d cur_s2m_ibuf_addr 0x%x\n", ID, - i, - state->proc_state[i].cur_s2m_ibuf_addr); - ia_css_print("IBUF controller ID %d Process ID %d cur_dma_ibuf_addr 0x%x\n", ID, - i, - state->proc_state[i].cur_dma_ibuf_addr); - ia_css_print("IBUF controller ID %d Process ID %d cur_dma_dest_addr 0x%x\n", ID, - i, - state->proc_state[i].cur_dma_dest_addr); - ia_css_print("IBUF controller ID %d Process ID %d cur_isp_dest_addr 0x%x\n", ID, - i, - state->proc_state[i].cur_isp_dest_addr); - ia_css_print("IBUF controller ID %d Process ID %d dma_cmds_send 0x%x\n", ID, i, - state->proc_state[i].dma_cmds_send); - ia_css_print("IBUF controller ID %d Process ID %d main_cntrl_state 0x%x\n", ID, - i, - state->proc_state[i].main_cntrl_state); - ia_css_print("IBUF controller ID %d Process ID %d dma_sync_state 0x%x\n", ID, i, - state->proc_state[i].dma_sync_state); - ia_css_print("IBUF controller ID %d Process ID %d isp_sync_state 0x%x\n", ID, i, - state->proc_state[i].isp_sync_state); - } -} - -/* end of NCI */ - -/***************************************************** - * - * Device level interface (DLI). - * - *****************************************************/ -/** - * @brief Load the register value. - * Refer to "ibuf_ctrl_public.h" for details. - */ -STORAGE_CLASS_IBUF_CTRL_C hrt_data ibuf_ctrl_reg_load( - const ibuf_ctrl_ID_t ID, - const hrt_address reg) -{ - assert(ID < N_IBUF_CTRL_ID); - assert(IBUF_CTRL_BASE[ID] != (hrt_address)-1); - return ia_css_device_load_uint32(IBUF_CTRL_BASE[ID] + reg * sizeof(hrt_data)); -} - -/** - * @brief Store a value to the register. - * Refer to "ibuf_ctrl_public.h" for details. - */ -STORAGE_CLASS_IBUF_CTRL_C void ibuf_ctrl_reg_store( - const ibuf_ctrl_ID_t ID, - const hrt_address reg, - const hrt_data value) -{ - assert(ID < N_IBUF_CTRL_ID); - assert(IBUF_CTRL_BASE[ID] != (hrt_address)-1); - - ia_css_device_store_uint32(IBUF_CTRL_BASE[ID] + reg * sizeof(hrt_data), value); -} - -/* end of DLI */ - -#endif /* __IBUF_CTRL_PRIVATE_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_dma.c b/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_dma.c index 5809dbb6e5aa..2a5159945a44 100644 --- a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_dma.c +++ b/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_dma.c @@ -13,16 +13,10 @@ * more details. */ -#include "isys_dma.h" +#include "system_local.h" +#include "isys_dma_global.h" #include "assert_support.h" - -#ifndef __INLINE_ISYS2401_DMA__ -/* - * Include definitions for isys dma register access functions. isys_dma.h - * includes declarations of these functions by including isys_dma_public.h. - */ #include "isys_dma_private.h" -#endif const isys2401_dma_channel N_ISYS2401_DMA_CHANNEL_PROCS[N_ISYS2401_DMA_ID] = { N_ISYS2401_DMA_CHANNEL diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_dma_local.h b/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_dma_local.h deleted file mode 100644 index 878933261a43..000000000000 --- a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_dma_local.h +++ /dev/null @@ -1,21 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.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 __ISYS_DMA_LOCAL_H_INCLUDED__ -#define __ISYS_DMA_LOCAL_H_INCLUDED__ - -#include "isys_dma_global.h" - -#endif /* __ISYS_DMA_LOCAL_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_dma_private.h b/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_dma_private.h index eb35b7bcead4..a313e1dc7c71 100644 --- a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_dma_private.h +++ b/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_dma_private.h @@ -23,10 +23,9 @@ #include "dma_v2_defs.h" #include "print_support.h" -STORAGE_CLASS_ISYS2401_DMA_C void isys2401_dma_reg_store( - const isys2401_dma_ID_t dma_id, - const unsigned int reg, - const hrt_data value) +void isys2401_dma_reg_store(const isys2401_dma_ID_t dma_id, + const unsigned int reg, + const hrt_data value) { unsigned int reg_loc; @@ -40,9 +39,8 @@ STORAGE_CLASS_ISYS2401_DMA_C void isys2401_dma_reg_store( ia_css_device_store_uint32(reg_loc, value); } -STORAGE_CLASS_ISYS2401_DMA_C hrt_data isys2401_dma_reg_load( - const isys2401_dma_ID_t dma_id, - const unsigned int reg) +hrt_data isys2401_dma_reg_load(const isys2401_dma_ID_t dma_id, + const unsigned int reg) { unsigned int reg_loc; hrt_data value; diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq.c b/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq.c index 99576af4713c..b6135c4b6eea 100644 --- a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq.c +++ b/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq.c @@ -28,8 +28,7 @@ #endif /* Public interface */ -STORAGE_CLASS_ISYS2401_IRQ_C void isys_irqc_status_enable( - const isys_irq_ID_t isys_irqc_id) +void isys_irqc_status_enable(const isys_irq_ID_t isys_irqc_id) { assert(isys_irqc_id < N_ISYS_IRQ_ID); diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_local.h b/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_local.h index e3d6d5e1634e..a76987190292 100644 --- a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_local.h +++ b/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_local.h @@ -18,7 +18,7 @@ #include <type_support.h> -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) typedef struct isys_irqc_state_s isys_irqc_state_t; @@ -31,6 +31,6 @@ struct isys_irqc_state_s { /*hrt_data clear; */ /* write-only register */ }; -#endif /* defined(USE_INPUT_SYSTEM_VERSION_2401) */ +#endif /* defined(ISP2401) */ #endif /* __ISYS_IRQ_LOCAL_H__ */ diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_private.h b/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_private.h index 91ef000d76dc..fb168c25bdfc 100644 --- a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_private.h +++ b/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_private.h @@ -19,7 +19,7 @@ #include "isys_irq_global.h" #include "isys_irq_local.h" -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) /* -------------------------------------------------------+ | Native command interface (NCI) | @@ -29,7 +29,7 @@ * @brief Get the isys irq status. * Refer to "isys_irq.h" for details. */ -STORAGE_CLASS_ISYS2401_IRQ_C void isys_irqc_state_get( +void isys_irqc_state_get( const isys_irq_ID_t isys_irqc_id, isys_irqc_state_t *state) { @@ -48,7 +48,7 @@ STORAGE_CLASS_ISYS2401_IRQ_C void isys_irqc_state_get( * @brief Dump the isys irq status. * Refer to "isys_irq.h" for details. */ -STORAGE_CLASS_ISYS2401_IRQ_C void isys_irqc_state_dump( +void isys_irqc_state_dump( const isys_irq_ID_t isys_irqc_id, const isys_irqc_state_t *state) { @@ -65,7 +65,7 @@ STORAGE_CLASS_ISYS2401_IRQ_C void isys_irqc_state_dump( + -------------------------------------------------------*/ /* Support functions */ -STORAGE_CLASS_ISYS2401_IRQ_C void isys_irqc_reg_store( +void isys_irqc_reg_store( const isys_irq_ID_t isys_irqc_id, const unsigned int reg_idx, const hrt_data value) @@ -82,7 +82,7 @@ STORAGE_CLASS_ISYS2401_IRQ_C void isys_irqc_reg_store( ia_css_device_store_uint32(reg_addr, value); } -STORAGE_CLASS_ISYS2401_IRQ_C hrt_data isys_irqc_reg_load( +hrt_data isys_irqc_reg_load( const isys_irq_ID_t isys_irqc_id, const unsigned int reg_idx) { @@ -102,6 +102,6 @@ STORAGE_CLASS_ISYS2401_IRQ_C hrt_data isys_irqc_reg_load( /* end of DLI */ -#endif /* defined(USE_INPUT_SYSTEM_VERSION_2401) */ +#endif /* defined(ISP2401) */ #endif /* __ISYS_IRQ_PRIVATE_H__ */ diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/host/pixelgen_private.h b/drivers/staging/media/atomisp/pci/css_2401_system/host/pixelgen_private.h index 4faa519219ee..1c7938d8ccb5 100644 --- a/drivers/staging/media/atomisp/pci/css_2401_system/host/pixelgen_private.h +++ b/drivers/staging/media/atomisp/pci/css_2401_system/host/pixelgen_private.h @@ -22,6 +22,43 @@ /***************************************************** * + * Device level interface (DLI). + * + *****************************************************/ +/** + * @brief Load the register value. + * Refer to "pixelgen_public.h" for details. + */ +STORAGE_CLASS_PIXELGEN_C hrt_data pixelgen_ctrl_reg_load( + const pixelgen_ID_t ID, + const hrt_address reg) +{ + assert(ID < N_PIXELGEN_ID); + assert(PIXELGEN_CTRL_BASE[ID] != (hrt_address) - 1); + return ia_css_device_load_uint32(PIXELGEN_CTRL_BASE[ID] + reg * sizeof( + hrt_data)); +} + +/** + * @brief Store a value to the register. + * Refer to "pixelgen_ctrl_public.h" for details. + */ +STORAGE_CLASS_PIXELGEN_C void pixelgen_ctrl_reg_store( + const pixelgen_ID_t ID, + const hrt_address reg, + const hrt_data value) +{ + assert(ID < N_PIXELGEN_ID); + assert(PIXELGEN_CTRL_BASE[ID] != (hrt_address)-1); + + ia_css_device_store_uint32(PIXELGEN_CTRL_BASE[ID] + reg * sizeof(hrt_data), + value); +} + +/* end of DLI */ + +/***************************************************** + * * Native command interface (NCI). * *****************************************************/ @@ -144,40 +181,4 @@ STORAGE_CLASS_PIXELGEN_C void pixelgen_ctrl_dump_state( } /* end of NCI */ -/***************************************************** - * - * Device level interface (DLI). - * - *****************************************************/ -/** - * @brief Load the register value. - * Refer to "pixelgen_public.h" for details. - */ -STORAGE_CLASS_PIXELGEN_C hrt_data pixelgen_ctrl_reg_load( - const pixelgen_ID_t ID, - const hrt_address reg) -{ - assert(ID < N_PIXELGEN_ID); - assert(PIXELGEN_CTRL_BASE[ID] != (hrt_address) - 1); - return ia_css_device_load_uint32(PIXELGEN_CTRL_BASE[ID] + reg * sizeof( - hrt_data)); -} - -/** - * @brief Store a value to the register. - * Refer to "pixelgen_ctrl_public.h" for details. - */ -STORAGE_CLASS_PIXELGEN_C void pixelgen_ctrl_reg_store( - const pixelgen_ID_t ID, - const hrt_address reg, - const hrt_data value) -{ - assert(ID < N_PIXELGEN_ID); - assert(PIXELGEN_CTRL_BASE[ID] != (hrt_address)-1); - - ia_css_device_store_uint32(PIXELGEN_CTRL_BASE[ID] + reg * sizeof(hrt_data), - value); -} - -/* end of DLI */ #endif /* __PIXELGEN_PRIVATE_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/ibuf_ctrl_global.h b/drivers/staging/media/atomisp/pci/css_2401_system/ibuf_ctrl_global.h index 1b9f03d57659..56c5ed89b3cc 100644 --- a/drivers/staging/media/atomisp/pci/css_2401_system/ibuf_ctrl_global.h +++ b/drivers/staging/media/atomisp/pci/css_2401_system/ibuf_ctrl_global.h @@ -33,8 +33,7 @@ #define _IBUF_CNTRL_DMA_SYNC_WAIT_FOR_SYNC 1 #define _IBUF_CNTRL_DMA_SYNC_FSM_WAIT_FOR_ACK (0x3 << 1) -typedef struct ib_buffer_s ib_buffer_t; -struct ib_buffer_s { +struct isp2401_ib_buffer_s { u32 start_addr; /* start address of the buffer in the * "input-buffer hardware block" */ @@ -42,6 +41,7 @@ struct ib_buffer_s { u32 stride; /* stride per buffer line (in bytes) */ u32 lines; /* lines in the buffer */ }; +typedef struct isp2401_ib_buffer_s isp2401_ib_buffer_t; typedef struct ibuf_ctrl_cfg_s ibuf_ctrl_cfg_t; struct ibuf_ctrl_cfg_s { @@ -58,7 +58,7 @@ struct ibuf_ctrl_cfg_s { u32 elems_per_word_in_dest; } dma_cfg; - ib_buffer_t ib_buffer; + isp2401_ib_buffer_t ib_buffer; struct { u32 stride; diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/isys_irq_global.h b/drivers/staging/media/atomisp/pci/css_2401_system/isys_irq_global.h index 156b4c95277e..a81e4d13ac9f 100644 --- a/drivers/staging/media/atomisp/pci/css_2401_system/isys_irq_global.h +++ b/drivers/staging/media/atomisp/pci/css_2401_system/isys_irq_global.h @@ -16,7 +16,7 @@ #ifndef __ISYS_IRQ_GLOBAL_H__ #define __ISYS_IRQ_GLOBAL_H__ -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) /* Register offset/index from base location */ #define ISYS_IRQ_EDGE_REG_IDX (0) @@ -31,6 +31,6 @@ #define ISYS_IRQ_CLEAR_REG_VALUE (0xFFFF) #define ISYS_IRQ_ENABLE_REG_VALUE (0xFFFF) -#endif /* defined(USE_INPUT_SYSTEM_VERSION_2401) */ +#endif /* defined(ISP2401) */ #endif /* __ISYS_IRQ_GLOBAL_H__ */ diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/pixelgen_global.h b/drivers/staging/media/atomisp/pci/css_2401_system/pixelgen_global.h index 75722ef572d0..f131f03cb8fa 100644 --- a/drivers/staging/media/atomisp/pci/css_2401_system/pixelgen_global.h +++ b/drivers/staging/media/atomisp/pci/css_2401_system/pixelgen_global.h @@ -24,8 +24,8 @@ /* * Duplicates "sync_generator_cfg_t" in "input_system_global.h". */ -typedef struct sync_generator_cfg_s sync_generator_cfg_t; -struct sync_generator_cfg_s { +typedef struct isp2401_sync_generator_cfg_s isp2401_sync_generator_cfg_t; +struct isp2401_sync_generator_cfg_s { u32 hblank_cycles; u32 vblank_cycles; u32 pixels_per_clock; @@ -72,7 +72,7 @@ struct pixelgen_tpg_cfg_s { s32 v_delta; /* vertical delta? */ } delta_cfg; - sync_generator_cfg_t sync_gen_cfg; + isp2401_sync_generator_cfg_t sync_gen_cfg; }; /* @@ -84,7 +84,7 @@ struct pixelgen_prbs_cfg_s { s32 seed0; s32 seed1; - sync_generator_cfg_t sync_gen_cfg; + isp2401_sync_generator_cfg_t sync_gen_cfg; }; /* end of Pixel-generator: TPG. ("pixelgen_global.h") */ diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_formatter.c b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_formatter.c index bec9c7238a78..5cd6136f21a2 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_formatter.c +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_formatter.c @@ -15,7 +15,7 @@ #include "system_global.h" -#ifdef USE_INPUT_SYSTEM_VERSION_2 +#ifndef ISP2401 #include "input_formatter.h" #include <type_support.h> @@ -27,6 +27,10 @@ #include "input_formatter_private.h" #endif /* __INLINE_INPUT_FORMATTER__ */ +static const unsigned int input_formatter_alignment[N_INPUT_FORMATTER_ID] = { + ISP_VEC_ALIGN, ISP_VEC_ALIGN, HIVE_ISP_CTRL_DATA_BYTES +}; + const hrt_address HIVE_IF_SRST_ADDRESS[N_INPUT_FORMATTER_ID] = { INPUT_FORMATTER0_SRST_OFFSET, INPUT_FORMATTER1_SRST_OFFSET, diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_formatter_local.h b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_formatter_local.h index 94fff77584f7..dfb593c109af 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_formatter_local.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_formatter_local.h @@ -115,8 +115,4 @@ struct input_formatter_bin_state_s { u32 en_status_update; }; -static const unsigned int input_formatter_alignment[N_INPUT_FORMATTER_ID] = { - ISP_VEC_ALIGN, ISP_VEC_ALIGN, HIVE_ISP_CTRL_DATA_BYTES -}; - #endif /* __INPUT_FORMATTER_LOCAL_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c index fc000af042dc..0f5a231672a8 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c @@ -15,7 +15,7 @@ #include "system_global.h" -#ifdef USE_INPUT_SYSTEM_VERSION_2 +#ifndef ISP2401 #include "input_system.h" #include <type_support.h> @@ -30,17 +30,17 @@ #define ZERO (0x0) #define ONE (1U) -static const ib_buffer_t IB_BUFFER_NULL = {0, 0, 0 }; +static const isp2400_ib_buffer_t IB_BUFFER_NULL = {0, 0, 0 }; -static input_system_error_t input_system_configure_channel( +static input_system_err_t input_system_configure_channel( const channel_cfg_t channel); -static input_system_error_t input_system_configure_channel_sensor( +static input_system_err_t input_system_configure_channel_sensor( const channel_cfg_t channel); -static input_system_error_t input_buffer_configuration(void); +static input_system_err_t input_buffer_configuration(void); -static input_system_error_t configuration_to_registers(void); +static input_system_err_t configuration_to_registers(void); static void receiver_rst(const rx_ID_t ID); static void input_system_network_rst(const input_system_ID_t ID); @@ -48,12 +48,12 @@ static void input_system_network_rst(const input_system_ID_t ID); static void capture_unit_configure( const input_system_ID_t ID, const sub_system_ID_t sub_id, - const ib_buffer_t *const cfg); + const isp2400_ib_buffer_t *const cfg); static void acquisition_unit_configure( const input_system_ID_t ID, const sub_system_ID_t sub_id, - const ib_buffer_t *const cfg); + const isp2400_ib_buffer_t *const cfg); static void ctrl_unit_configure( const input_system_ID_t ID, @@ -65,17 +65,17 @@ static void input_system_network_configure( const input_system_network_cfg_t *const cfg); // MW: CSI is previously named as "rx" short for "receiver" -static input_system_error_t set_csi_cfg( +static input_system_err_t set_csi_cfg( csi_cfg_t *const lhs, const csi_cfg_t *const rhs, input_system_config_flags_t *const flags); -static input_system_error_t set_source_type( +static input_system_err_t set_source_type( input_system_source_t *const lhs, const input_system_source_t rhs, input_system_config_flags_t *const flags); -static input_system_error_t input_system_multiplexer_cfg( +static input_system_err_t input_system_multiplexer_cfg( input_system_multiplex_t *const lhs, const input_system_multiplex_t rhs, input_system_config_flags_t *const flags); @@ -848,7 +848,7 @@ static void input_system_network_rst(const input_system_ID_t ID) } // Function that resets current configuration. -input_system_error_t input_system_configuration_reset(void) +input_system_err_t input_system_configuration_reset(void) { unsigned int i; @@ -890,10 +890,10 @@ input_system_error_t input_system_configuration_reset(void) // MW: Comments are good, but doxygen is required, place it at the declaration // Function that appends the channel to current configuration. -static input_system_error_t input_system_configure_channel( +static input_system_err_t input_system_configure_channel( const channel_cfg_t channel) { - input_system_error_t error = INPUT_SYSTEM_ERR_NO_ERROR; + input_system_err_t error = INPUT_SYSTEM_ERR_NO_ERROR; // Check if channel is not already configured. if (config.ch_flags[channel.ch_id] & INPUT_SYSTEM_CFG_FLAG_SET) { return INPUT_SYSTEM_ERR_CHANNEL_ALREADY_SET; @@ -948,12 +948,12 @@ static input_system_error_t input_system_configure_channel( } // Function that partitions input buffer space with determining addresses. -static input_system_error_t input_buffer_configuration(void) +static input_system_err_t input_buffer_configuration(void) { u32 current_address = 0; u32 unallocated_memory = IB_CAPACITY_IN_WORDS; - ib_buffer_t candidate_buffer_acq = IB_BUFFER_NULL; + isp2400_ib_buffer_t candidate_buffer_acq = IB_BUFFER_NULL; u32 size_requested; input_system_config_flags_t acq_already_specified = INPUT_SYSTEM_CFG_FLAG_RESET; input_system_csi_port_t port; @@ -1062,7 +1062,7 @@ static input_system_error_t input_buffer_configuration(void) static void capture_unit_configure( const input_system_ID_t ID, const sub_system_ID_t sub_id, - const ib_buffer_t *const cfg) + const isp2400_ib_buffer_t *const cfg) { assert(ID < N_INPUT_SYSTEM_ID); assert(/*(sub_id >= CAPTURE_UNIT0_ID) &&*/ (sub_id <= @@ -1088,7 +1088,7 @@ static void capture_unit_configure( static void acquisition_unit_configure( const input_system_ID_t ID, const sub_system_ID_t sub_id, - const ib_buffer_t *const cfg) + const isp2400_ib_buffer_t *const cfg) { assert(ID < N_INPUT_SYSTEM_ID); assert(sub_id == ACQUISITION_UNIT0_ID); @@ -1236,7 +1236,7 @@ static void input_system_network_configure( return; } -static input_system_error_t configuration_to_registers(void) +static input_system_err_t configuration_to_registers(void) { input_system_network_cfg_t input_system_network_cfg; int i; @@ -1335,10 +1335,10 @@ static input_system_error_t configuration_to_registers(void) } // Function that applies the whole configuration. -input_system_error_t input_system_configuration_commit(void) +input_system_err_t input_system_configuration_commit(void) { // The last configuration step is to configure the input buffer. - input_system_error_t error = input_buffer_configuration(); + input_system_err_t error = input_buffer_configuration(); if (error != INPUT_SYSTEM_ERR_NO_ERROR) { return error; @@ -1357,7 +1357,7 @@ input_system_error_t input_system_configuration_commit(void) // FIFO -input_system_error_t input_system_csi_fifo_channel_cfg( +input_system_err_t input_system_csi_fifo_channel_cfg( u32 ch_id, input_system_csi_port_t port, backend_channel_cfg_t backend_ch, @@ -1380,7 +1380,7 @@ input_system_error_t input_system_csi_fifo_channel_cfg( return input_system_configure_channel(channel); } -input_system_error_t input_system_csi_fifo_channel_with_counting_cfg( +input_system_err_t input_system_csi_fifo_channel_with_counting_cfg( u32 ch_id, u32 nof_frames, input_system_csi_port_t port, @@ -1411,7 +1411,7 @@ input_system_error_t input_system_csi_fifo_channel_with_counting_cfg( // SRAM -input_system_error_t input_system_csi_sram_channel_cfg( +input_system_err_t input_system_csi_sram_channel_cfg( u32 ch_id, input_system_csi_port_t port, backend_channel_cfg_t backend_ch, @@ -1443,7 +1443,7 @@ input_system_error_t input_system_csi_sram_channel_cfg( //XMEM // Collects all parameters and puts them in channel_cfg_t. -input_system_error_t input_system_csi_xmem_channel_cfg( +input_system_err_t input_system_csi_xmem_channel_cfg( u32 ch_id, input_system_csi_port_t port, backend_channel_cfg_t backend_ch, @@ -1475,7 +1475,7 @@ input_system_error_t input_system_csi_xmem_channel_cfg( return input_system_configure_channel(channel); } -input_system_error_t input_system_csi_xmem_acquire_only_channel_cfg( +input_system_err_t input_system_csi_xmem_acquire_only_channel_cfg( u32 ch_id, u32 nof_frames, input_system_csi_port_t port, @@ -1502,7 +1502,7 @@ input_system_error_t input_system_csi_xmem_acquire_only_channel_cfg( return input_system_configure_channel(channel); } -input_system_error_t input_system_csi_xmem_capture_only_channel_cfg( +input_system_err_t input_system_csi_xmem_capture_only_channel_cfg( u32 ch_id, u32 nof_frames, input_system_csi_port_t port, @@ -1535,7 +1535,7 @@ input_system_error_t input_system_csi_xmem_capture_only_channel_cfg( // Non - CSI -input_system_error_t input_system_prbs_channel_cfg( +input_system_err_t input_system_prbs_channel_cfg( u32 ch_id, u32 nof_frames,//not used yet u32 seed, @@ -1564,7 +1564,7 @@ input_system_error_t input_system_prbs_channel_cfg( return input_system_configure_channel(channel); } -input_system_error_t input_system_tpg_channel_cfg( +input_system_err_t input_system_tpg_channel_cfg( u32 ch_id, u32 nof_frames,//not used yet u32 x_mask, @@ -1601,7 +1601,7 @@ input_system_error_t input_system_tpg_channel_cfg( } // MW: Don't use system specific names, (even in system specific files) "cfg2400" -> cfg -input_system_error_t input_system_gpfifo_channel_cfg( +input_system_err_t input_system_gpfifo_channel_cfg( u32 ch_id, u32 nof_frames, //not used yet @@ -1625,11 +1625,11 @@ input_system_error_t input_system_gpfifo_channel_cfg( /////////////////////////////////////////////////////////////////////////// // Fills the parameters to config.csi_value[port] -static input_system_error_t input_system_configure_channel_sensor( +static input_system_err_t input_system_configure_channel_sensor( const channel_cfg_t channel) { const u32 port = channel.source_cfg.csi_cfg.csi_port; - input_system_error_t status = INPUT_SYSTEM_ERR_NO_ERROR; + input_system_err_t status = INPUT_SYSTEM_ERR_NO_ERROR; input_system_multiplex_t mux; @@ -1711,7 +1711,7 @@ static input_system_error_t input_system_configure_channel_sensor( } // Test flags and set structure. -static input_system_error_t set_source_type( +static input_system_err_t set_source_type( input_system_source_t *const lhs, const input_system_source_t rhs, input_system_config_flags_t *const flags) @@ -1747,7 +1747,7 @@ static input_system_error_t set_source_type( } // Test flags and set structure. -static input_system_error_t set_csi_cfg( +static input_system_err_t set_csi_cfg( csi_cfg_t *const lhs, const csi_cfg_t *const rhs, input_system_config_flags_t *const flags) @@ -1814,7 +1814,7 @@ static input_system_error_t set_csi_cfg( } // Test flags and set structure. -static input_system_error_t input_system_multiplexer_cfg( +static input_system_err_t input_system_multiplexer_cfg( input_system_multiplex_t *const lhs, const input_system_multiplex_t rhs, input_system_config_flags_t *const flags) diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/csi_rx_public.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/csi_rx_public.h index e6f695691407..3d6621f2fa96 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/csi_rx_public.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/csi_rx_public.h @@ -16,7 +16,7 @@ #ifndef __CSI_RX_PUBLIC_H_INCLUDED__ #define __CSI_RX_PUBLIC_H_INCLUDED__ -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 /***************************************************** * * Native command interface (NCI). @@ -132,5 +132,5 @@ void csi_rx_be_ctrl_reg_store( const hrt_address reg, const hrt_data value); /* end of DLI */ -#endif /* USE_INPUT_SYSTEM_VERSION_2401 */ +#endif /* ISP2401 */ #endif /* __CSI_RX_PUBLIC_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/ibuf_ctrl_public.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/ibuf_ctrl_public.h deleted file mode 100644 index 053803d2cae3..000000000000 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/ibuf_ctrl_public.h +++ /dev/null @@ -1,94 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.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 __IBUF_CTRL_PUBLIC_H_INCLUDED__ -#define __IBUF_CTRL_PUBLIC_H_INCLUDED__ - -#ifdef USE_INPUT_SYSTEM_VERSION_2401 -/***************************************************** - * - * Native command interface (NCI). - * - *****************************************************/ -/** - * @brief Get the ibuf-controller state. - * Get the state of the ibuf-controller regiester-set. - * - * @param[in] id The global unique ID of the input-buffer controller. - * @param[out] state Point to the register-state. - */ -STORAGE_CLASS_IBUF_CTRL_H void ibuf_ctrl_get_state( - const ibuf_ctrl_ID_t ID, - ibuf_ctrl_state_t *state); - -/** - * @brief Get the state of the ibuf-controller process. - * Get the state of the register set per buf-controller process. - * - * @param[in] id The global unique ID of the input-buffer controller. - * @param[in] proc_id The process ID. - * @param[out] state Point to the process state. - */ -STORAGE_CLASS_IBUF_CTRL_H void ibuf_ctrl_get_proc_state( - const ibuf_ctrl_ID_t ID, - const u32 proc_id, - ibuf_ctrl_proc_state_t *state); -/** - * @brief Dump the ibuf-controller state. - * Dump the state of the ibuf-controller regiester-set. - * - * @param[in] id The global unique ID of the input-buffer controller. - * @param[in] state Pointer to the register-state. - */ -STORAGE_CLASS_IBUF_CTRL_H void ibuf_ctrl_dump_state( - const ibuf_ctrl_ID_t ID, - ibuf_ctrl_state_t *state); -/* end of NCI */ - -/***************************************************** - * - * Device level interface (DLI). - * - *****************************************************/ -/** - * @brief Load the register value. - * Load the value of the register of the ibuf-controller. - * - * @param[in] ID The global unique ID for the ibuf-controller instance. - * @param[in] reg The offset address of the register. - * - * @return the value of the register. - */ -STORAGE_CLASS_IBUF_CTRL_H hrt_data ibuf_ctrl_reg_load( - const ibuf_ctrl_ID_t ID, - const hrt_address reg); - -/** - * @brief Store a value to the register. - * Store a value to the registe of the ibuf-controller. - * - * @param[in] ID The global unique ID for the ibuf-controller instance. - * @param[in] reg The offset address of the register. - * @param[in] value The value to be stored. - * - */ -STORAGE_CLASS_IBUF_CTRL_H void ibuf_ctrl_reg_store( - const ibuf_ctrl_ID_t ID, - const hrt_address reg, - const hrt_data value); -/* end of DLI */ - -#endif /* USE_INPUT_SYSTEM_VERSION_2401 */ -#endif /* __IBUF_CTRL_PUBLIC_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_dma_public.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_dma_public.h index 23a158b81b13..d9b6af898c06 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_dma_public.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_dma_public.h @@ -16,17 +16,17 @@ #ifndef __ISYS_DMA_PUBLIC_H_INCLUDED__ #define __ISYS_DMA_PUBLIC_H_INCLUDED__ -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 #include "system_local.h" #include "type_support.h" -STORAGE_CLASS_ISYS2401_DMA_H void isys2401_dma_reg_store( +extern void isys2401_dma_reg_store( const isys2401_dma_ID_t dma_id, const unsigned int reg, const hrt_data value); -STORAGE_CLASS_ISYS2401_DMA_H hrt_data isys2401_dma_reg_load( +extern hrt_data isys2401_dma_reg_load( const isys2401_dma_ID_t dma_id, const unsigned int reg); @@ -34,6 +34,6 @@ void isys2401_dma_set_max_burst_size( const isys2401_dma_ID_t dma_id, uint32_t max_burst_size); -#endif /* USE_INPUT_SYSTEM_VERSION_2401 */ +#endif /* ISP2401 */ #endif /* __ISYS_DMA_PUBLIC_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_irq_public.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_irq_public.h index b9befdd2508e..736cbc4e3705 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_irq_public.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_irq_public.h @@ -19,28 +19,23 @@ #include "isys_irq_global.h" #include "isys_irq_local.h" -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) -STORAGE_CLASS_ISYS2401_IRQ_H void isys_irqc_state_get( - const isys_irq_ID_t isys_irqc_id, - isys_irqc_state_t *state); +void isys_irqc_state_get(const isys_irq_ID_t isys_irqc_id, + isys_irqc_state_t *state); -STORAGE_CLASS_ISYS2401_IRQ_H void isys_irqc_state_dump( - const isys_irq_ID_t isys_irqc_id, - const isys_irqc_state_t *state); +void isys_irqc_state_dump(const isys_irq_ID_t isys_irqc_id, + const isys_irqc_state_t *state); -STORAGE_CLASS_ISYS2401_IRQ_H void isys_irqc_reg_store( - const isys_irq_ID_t isys_irqc_id, - const unsigned int reg_idx, - const hrt_data value); +void isys_irqc_reg_store(const isys_irq_ID_t isys_irqc_id, + const unsigned int reg_idx, + const hrt_data value); -STORAGE_CLASS_ISYS2401_IRQ_H hrt_data isys_irqc_reg_load( - const isys_irq_ID_t isys_irqc_id, - const unsigned int reg_idx); +hrt_data isys_irqc_reg_load(const isys_irq_ID_t isys_irqc_id, + const unsigned int reg_idx); -STORAGE_CLASS_ISYS2401_IRQ_H void isys_irqc_status_enable( - const isys_irq_ID_t isys_irqc_id); +void isys_irqc_status_enable(const isys_irq_ID_t isys_irqc_id); -#endif /* defined(USE_INPUT_SYSTEM_VERSION_2401) */ +#endif /* defined(ISP2401) */ #endif /* __ISYS_IRQ_PUBLIC_H__ */ diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_public.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_public.h index 509f75fe025c..dac53e324118 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_public.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_public.h @@ -16,7 +16,7 @@ #ifndef __ISYS_PUBLIC_H_INCLUDED__ #define __ISYS_PUBLIC_H_INCLUDED__ -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 /*! Read the state of INPUT_SYSTEM[ID] \param ID[in] INPUT_SYSTEM identifier \param state[out] pointer to input system state structure @@ -34,5 +34,5 @@ STORAGE_CLASS_INPUT_SYSTEM_H input_system_err_t input_system_get_state( STORAGE_CLASS_INPUT_SYSTEM_H void input_system_dump_state( const input_system_ID_t ID, input_system_state_t *state); -#endif /* USE_INPUT_SYSTEM_VERSION_2401 */ +#endif /* ISP2401 */ #endif /* __ISYS_PUBLIC_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/pixelgen_public.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/pixelgen_public.h index ded4dce06d09..40a9fb6d7761 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/pixelgen_public.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/pixelgen_public.h @@ -16,7 +16,7 @@ #ifndef __PIXELGEN_PUBLIC_H_INCLUDED__ #define __PIXELGEN_PUBLIC_H_INCLUDED__ -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 /***************************************************** * * Native command interface (NCI). @@ -76,5 +76,5 @@ STORAGE_CLASS_PIXELGEN_H void pixelgen_ctrl_reg_store( const hrt_data value); /* end of DLI */ -#endif /* USE_INPUT_SYSTEM_VERSION_2401 */ +#endif /* ISP2401 */ #endif /* __PIXELGEN_PUBLIC_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/ibuf_ctrl.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/ibuf_ctrl.h deleted file mode 100644 index 218341041811..000000000000 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/ibuf_ctrl.h +++ /dev/null @@ -1,47 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.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 __IBUF_CTRL_H_INCLUDED__ -#define __IBUF_CTRL_H_INCLUDED__ - -/* - * This file is included on every cell {SP,ISP,host} and on every system - * that uses the input system device(s). 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 "ibuf_ctrl_local.h" - -#ifndef __INLINE_IBUF_CTRL__ -#define STORAGE_CLASS_IBUF_CTRL_H extern -#define STORAGE_CLASS_IBUF_CTRL_C -#include "ibuf_ctrl_public.h" -#else /* __INLINE_IBUF_CTRL__ */ -#define STORAGE_CLASS_IBUF_CTRL_H static inline -#define STORAGE_CLASS_IBUF_CTRL_C static inline -#include "ibuf_ctrl_private.h" -#endif /* __INLINE_IBUF_CTRL__ */ - -#endif /* __IBUF_CTRL_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/isys_dma.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/isys_dma.h deleted file mode 100644 index 6a759142eda8..000000000000 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/isys_dma.h +++ /dev/null @@ -1,47 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.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 __ISYS_DMA_H_INCLUDED__ -#define __ISYS_DMA_H_INCLUDED__ - -/* - * This file is included on every cell {SP,ISP,host} and on every system - * that uses the input system device(s). 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 "isys_dma_local.h" - -#ifndef __INLINE_ISYS2401_DMA__ -#define STORAGE_CLASS_ISYS2401_DMA_H extern -#define STORAGE_CLASS_ISYS2401_DMA_C -#include "isys_dma_public.h" -#else /* __INLINE_ISYS2401_DMA__ */ -#define STORAGE_CLASS_ISYS2401_DMA_H static inline -#define STORAGE_CLASS_ISYS2401_DMA_C static inline -#include "isys_dma_private.h" -#endif /* __INLINE_ISYS2401_DMA__ */ - -#endif /* __ISYS_DMA_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/isys_irq.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/isys_irq.h index d854124f4f97..001c55ea970b 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/isys_irq.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/isys_irq.h @@ -19,22 +19,10 @@ #include <type_support.h> #include <system_local.h> -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) -#ifndef __INLINE_ISYS2401_IRQ__ - -#define STORAGE_CLASS_ISYS2401_IRQ_H extern -#define STORAGE_CLASS_ISYS2401_IRQ_C extern #include "isys_irq_public.h" -#else /* __INLINE_ISYS2401_IRQ__ */ - -#define STORAGE_CLASS_ISYS2401_IRQ_H static inline -#define STORAGE_CLASS_ISYS2401_IRQ_C static inline -#include "isys_irq_private.h" - -#endif /* __INLINE_ISYS2401_IRQ__ */ - -#endif /* defined(USE_INPUT_SYSTEM_VERSION_2401) */ +#endif /* defined(ISP2401) */ #endif /* __IA_CSS_ISYS_IRQ_H__ */ diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/print_support.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/print_support.h index a1f7a5839560..540b405cc0f7 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/print_support.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/print_support.h @@ -20,7 +20,7 @@ extern int (*sh_css_printf)(const char *fmt, va_list args); /* depends on host supplied print function in ia_css_init() */ -static inline void ia_css_print(const char *fmt, ...) +static inline __printf(1, 2) void ia_css_print(const char *fmt, ...) { va_list ap; diff --git a/drivers/staging/media/atomisp/pci/hmm/hmm.c b/drivers/staging/media/atomisp/pci/hmm/hmm.c index 2bd39b4939f1..e0eaff0f8a22 100644 --- a/drivers/staging/media/atomisp/pci/hmm/hmm.c +++ b/drivers/staging/media/atomisp/pci/hmm/hmm.c @@ -268,9 +268,9 @@ ia_css_ptr hmm_alloc(size_t bytes, enum hmm_bo_type type, if (attrs & ATOMISP_MAP_FLAG_CLEARED) hmm_set(bo->start, 0, bytes); - dev_dbg(atomisp_dev, - "%s: pages: 0x%08x (%ld bytes), type: %d from highmem %d, user ptr %p, cached %d\n", - __func__, bo->start, bytes, type, from_highmem, userptr, cached); + dev_dbg(atomisp_dev, + "%s: pages: 0x%08x (%ld bytes), type: %d from highmem %d, user ptr %p, cached %d\n", + __func__, bo->start, bytes, type, from_highmem, userptr, cached); return bo->start; diff --git a/drivers/staging/media/atomisp/pci/ia_css_env.h b/drivers/staging/media/atomisp/pci/ia_css_env.h index 8debf334c15c..6b38723b27cd 100644 --- a/drivers/staging/media/atomisp/pci/ia_css_env.h +++ b/drivers/staging/media/atomisp/pci/ia_css_env.h @@ -75,9 +75,9 @@ struct ia_css_hw_access_env { /* Environment with function pointers to print error and debug messages. */ struct ia_css_print_env { - int (*debug_print)(const char *fmt, va_list args); + int __printf(1, 0) (*debug_print)(const char *fmt, va_list args); /** Print a debug message. */ - int (*error_print)(const char *fmt, va_list args); + int __printf(1, 0) (*error_print)(const char *fmt, va_list args); /** Print an error message.*/ }; diff --git a/drivers/staging/media/atomisp/pci/ia_css_mipi.h b/drivers/staging/media/atomisp/pci/ia_css_mipi.h index 56a2fca8117f..7b6d796d6ee0 100644 --- a/drivers/staging/media/atomisp/pci/ia_css_mipi.h +++ b/drivers/staging/media/atomisp/pci/ia_css_mipi.h @@ -42,7 +42,6 @@ int ia_css_mipi_frame_specify(const unsigned int size_mem_words, const bool contiguous); -#if !defined(HAS_NO_INPUT_SYSTEM) /* @brief Register size of a CSS MIPI frame for check during capturing. * * @param[in] port CSI-2 port this check is registered. @@ -58,7 +57,6 @@ ia_css_mipi_frame_specify(const unsigned int size_mem_words, int ia_css_mipi_frame_enable_check_on_size(const enum mipi_port_id port, const unsigned int size_mem_words); -#endif /* @brief Calculate the size of a mipi frame. * diff --git a/drivers/staging/media/atomisp/pci/ia_css_stream.h b/drivers/staging/media/atomisp/pci/ia_css_stream.h index e3e7a8a03b04..70b0378748f1 100644 --- a/drivers/staging/media/atomisp/pci/ia_css_stream.h +++ b/drivers/staging/media/atomisp/pci/ia_css_stream.h @@ -18,7 +18,7 @@ #include <type_support.h> #include <system_local.h> -#if !defined(HAS_NO_INPUT_SYSTEM) && !defined(USE_INPUT_SYSTEM_VERSION_2401) +#if !defined(ISP2401) #include <input_system.h> #endif #include "ia_css_types.h" @@ -30,7 +30,7 @@ struct ia_css_stream { struct ia_css_stream_config config; struct ia_css_stream_info info; -#if !defined(HAS_NO_INPUT_SYSTEM) && !defined(USE_INPUT_SYSTEM_VERSION_2401) +#if !defined(ISP2401) rx_cfg_t csi_rx_config; #endif bool reconfigure_css_rx; diff --git a/drivers/staging/media/atomisp/pci/input_system_global.h b/drivers/staging/media/atomisp/pci/input_system_global.h index 5ac580ce64ed..1450964445f6 100644 --- a/drivers/staging/media/atomisp/pci/input_system_global.h +++ b/drivers/staging/media/atomisp/pci/input_system_global.h @@ -4,8 +4,27 @@ * (c) 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> */ -#ifdef ISP2401 -# include "isp2401_input_system_global.h" -#else -# include "isp2400_input_system_global.h" -#endif + +#ifndef __INPUT_SYSTEM_GLOBAL_H_INCLUDED__ +#define __INPUT_SYSTEM_GLOBAL_H_INCLUDED__ +typedef enum { + INPUT_SYSTEM_ERR_NO_ERROR = 0, + /* ISP2401 */ + INPUT_SYSTEM_ERR_CREATE_CHANNEL_FAIL, + INPUT_SYSTEM_ERR_CONFIGURE_CHANNEL_FAIL, + INPUT_SYSTEM_ERR_OPEN_CHANNEL_FAIL, + INPUT_SYSTEM_ERR_TRANSFER_FAIL, + INPUT_SYSTEM_ERR_CREATE_INPUT_PORT_FAIL, + INPUT_SYSTEM_ERR_CONFIGURE_INPUT_PORT_FAIL, + INPUT_SYSTEM_ERR_OPEN_INPUT_PORT_FAIL, + /* ISP2400 */ + INPUT_SYSTEM_ERR_GENERIC, + INPUT_SYSTEM_ERR_CHANNEL_ALREADY_SET, + INPUT_SYSTEM_ERR_CONFLICT_ON_RESOURCE, + INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED, +} input_system_err_t; + +#include "isp2401_input_system_global.h" +#include "isp2400_input_system_global.h" + +#endif /* __INPUT_SYSTEM_GLOBAL_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/ctc/ctc_1.0/ia_css_ctc_param.h b/drivers/staging/media/atomisp/pci/isp/kernels/ctc/ctc_1.0/ia_css_ctc_param.h index 7e2fa192a0fe..eaad708c611c 100644 --- a/drivers/staging/media/atomisp/pci/isp/kernels/ctc/ctc_1.0/ia_css_ctc_param.h +++ b/drivers/staging/media/atomisp/pci/isp/kernels/ctc/ctc_1.0/ia_css_ctc_param.h @@ -22,15 +22,8 @@ #include "ia_css_ctc_types.h" #ifndef PIPE_GENERATION -#if defined(HAS_VAMEM_VERSION_2) #define SH_CSS_ISP_CTC_TABLE_SIZE_LOG2 IA_CSS_VAMEM_2_CTC_TABLE_SIZE_LOG2 #define SH_CSS_ISP_CTC_TABLE_SIZE IA_CSS_VAMEM_2_CTC_TABLE_SIZE -#elif defined(HAS_VAMEM_VERSION_1) -#define SH_CSS_ISP_CTC_TABLE_SIZE_LOG2 IA_CSS_VAMEM_1_CTC_TABLE_SIZE_LOG2 -#define SH_CSS_ISP_CTC_TABLE_SIZE IA_CSS_VAMEM_1_CTC_TABLE_SIZE -#else -#error "VAMEM should be {VERSION1, VERSION2}" -#endif #else /* For pipe generation, the size is not relevant */ diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/ctc/ctc_1.0/ia_css_ctc_table.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/ctc/ctc_1.0/ia_css_ctc_table.host.c index f13b79586963..6a7925c8493a 100644 --- a/drivers/staging/media/atomisp/pci/isp/kernels/ctc/ctc_1.0/ia_css_ctc_table.host.c +++ b/drivers/staging/media/atomisp/pci/isp/kernels/ctc/ctc_1.0/ia_css_ctc_table.host.c @@ -23,7 +23,6 @@ struct ia_css_ctc_table default_ctc_table; -#if defined(HAS_VAMEM_VERSION_2) static const uint16_t default_ctc_table_data[IA_CSS_VAMEM_2_CTC_TABLE_SIZE] = { @@ -62,155 +61,11 @@ default_ctc_table_data[IA_CSS_VAMEM_2_CTC_TABLE_SIZE] = { 0 }; -#elif defined(HAS_VAMEM_VERSION_1) - -/* Default Parameters */ -static const uint16_t -default_ctc_table_data[IA_CSS_VAMEM_1_CTC_TABLE_SIZE] = { - 0, 0, 256, 384, 384, 497, 765, 806, - 837, 851, 888, 901, 957, 981, 993, 1001, - 1011, 1029, 1028, 1039, 1062, 1059, 1073, 1080, - 1083, 1085, 1085, 1098, 1080, 1084, 1085, 1093, - 1078, 1073, 1070, 1069, 1077, 1066, 1072, 1063, - 1053, 1044, 1046, 1053, 1039, 1028, 1025, 1024, - 1012, 1013, 1016, 996, 992, 990, 990, 980, - 969, 968, 961, 955, 951, 949, 933, 930, - 929, 925, 921, 916, 906, 901, 895, 893, - 886, 877, 872, 869, 866, 861, 857, 849, - 845, 838, 836, 832, 823, 821, 815, 813, - 809, 805, 796, 793, 790, 785, 784, 778, - 772, 768, 766, 763, 758, 752, 749, 745, - 741, 740, 736, 730, 726, 724, 723, 718, - 711, 709, 706, 704, 701, 698, 691, 689, - 688, 683, 683, 678, 675, 673, 671, 669, - 666, 663, 661, 660, 656, 656, 653, 650, - 648, 647, 646, 643, 639, 638, 637, 635, - 633, 632, 629, 627, 626, 625, 622, 621, - 618, 618, 614, 614, 612, 609, 606, 606, - 603, 600, 600, 597, 594, 591, 590, 586, - 582, 581, 578, 575, 572, 569, 563, 560, - 557, 554, 551, 548, 545, 539, 536, 533, - 529, 527, 524, 519, 516, 513, 510, 507, - 504, 501, 498, 493, 491, 488, 485, 484, - 480, 476, 474, 471, 467, 466, 464, 460, - 459, 455, 453, 449, 447, 446, 443, 441, - 438, 435, 432, 432, 429, 427, 426, 422, - 419, 418, 416, 414, 412, 410, 408, 406, - 404, 402, 401, 398, 397, 395, 393, 390, - 389, 388, 387, 384, 382, 380, 378, 377, - 376, 375, 372, 370, 368, 368, 366, 364, - 363, 361, 360, 358, 357, 355, 354, 352, - 351, 350, 349, 346, 345, 344, 344, 342, - 340, 339, 337, 337, 336, 335, 333, 331, - 330, 329, 328, 326, 326, 324, 324, 322, - 321, 320, 318, 318, 318, 317, 315, 313, - 312, 311, 311, 310, 308, 307, 306, 306, - 304, 304, 302, 301, 300, 300, 299, 297, - 297, 296, 296, 294, 294, 292, 291, 291, - 291, 290, 288, 287, 286, 286, 287, 285, - 284, 283, 282, 282, 281, 281, 279, 278, - 278, 278, 276, 276, 275, 274, 274, 273, - 271, 270, 269, 268, 268, 267, 265, 262, - 261, 260, 260, 259, 257, 254, 252, 252, - 251, 251, 249, 246, 245, 244, 243, 242, - 240, 239, 239, 237, 235, 235, 233, 231, - 232, 230, 229, 226, 225, 224, 225, 224, - 223, 220, 219, 219, 218, 217, 217, 214, - 213, 213, 212, 211, 209, 209, 209, 208, - 206, 205, 204, 203, 204, 203, 201, 200, - 199, 197, 198, 198, 197, 195, 194, 194, - 193, 192, 192, 191, 189, 190, 189, 188, - 186, 187, 186, 185, 185, 184, 183, 181, - 183, 182, 181, 180, 179, 178, 178, 178, - 177, 176, 175, 176, 175, 174, 174, 173, - 172, 173, 172, 171, 170, 170, 169, 169, - 169, 168, 167, 166, 167, 167, 166, 165, - 164, 164, 164, 163, 164, 163, 162, 163, - 162, 161, 160, 161, 160, 160, 160, 159, - 158, 157, 158, 158, 157, 157, 156, 156, - 156, 156, 155, 155, 154, 154, 154, 154, - 154, 153, 152, 153, 152, 152, 151, 152, - 151, 152, 151, 150, 150, 149, 149, 150, - 149, 149, 148, 148, 148, 149, 148, 147, - 146, 146, 147, 146, 147, 146, 145, 146, - 146, 145, 144, 145, 144, 145, 144, 144, - 143, 143, 143, 144, 143, 142, 142, 142, - 142, 142, 142, 141, 141, 141, 141, 140, - 140, 141, 140, 140, 141, 140, 139, 139, - 139, 140, 139, 139, 138, 138, 137, 139, - 138, 138, 138, 137, 138, 137, 137, 137, - 137, 136, 137, 136, 136, 136, 136, 135, - 136, 135, 135, 135, 135, 136, 135, 135, - 134, 134, 133, 135, 134, 134, 134, 133, - 134, 133, 134, 133, 133, 132, 133, 133, - 132, 133, 132, 132, 132, 132, 131, 131, - 131, 132, 131, 131, 130, 131, 130, 132, - 131, 130, 130, 129, 130, 129, 130, 129, - 129, 129, 130, 129, 128, 128, 128, 128, - 129, 128, 128, 127, 127, 128, 128, 127, - 127, 126, 126, 127, 127, 126, 126, 126, - 127, 126, 126, 126, 125, 125, 126, 125, - 125, 124, 124, 124, 125, 125, 124, 124, - 123, 124, 124, 123, 123, 122, 122, 122, - 122, 122, 121, 120, 120, 119, 118, 118, - 118, 117, 117, 116, 115, 115, 115, 114, - 114, 113, 113, 112, 111, 111, 111, 110, - 110, 109, 109, 108, 108, 108, 107, 107, - 106, 106, 105, 105, 105, 104, 104, 103, - 103, 102, 102, 102, 102, 101, 101, 100, - 100, 99, 99, 99, 99, 99, 99, 98, - 97, 98, 97, 97, 97, 96, 96, 95, - 96, 95, 96, 95, 95, 94, 94, 95, - 94, 94, 94, 93, 93, 92, 93, 93, - 93, 93, 92, 92, 91, 92, 92, 92, - 91, 91, 90, 90, 91, 91, 91, 90, - 90, 90, 90, 91, 90, 90, 90, 89, - 89, 89, 90, 89, 89, 89, 89, 89, - 88, 89, 89, 88, 88, 88, 88, 87, - 89, 88, 88, 88, 88, 88, 87, 88, - 88, 88, 87, 87, 87, 87, 87, 88, - 87, 87, 87, 87, 87, 87, 88, 87, - 87, 87, 87, 86, 86, 87, 87, 87, - 87, 86, 86, 86, 87, 87, 86, 87, - 86, 86, 86, 87, 87, 86, 86, 86, - 86, 86, 87, 87, 86, 85, 85, 85, - 84, 85, 85, 84, 84, 83, 83, 82, - 82, 82, 81, 81, 80, 79, 79, 79, - 78, 77, 77, 76, 76, 76, 75, 74, - 74, 74, 73, 73, 72, 71, 71, 71, - 70, 70, 69, 69, 68, 68, 67, 67, - 67, 66, 66, 65, 65, 64, 64, 63, - 62, 62, 62, 61, 60, 60, 59, 59, - 58, 58, 57, 57, 56, 56, 56, 55, - 55, 54, 55, 55, 54, 53, 53, 52, - 53, 53, 52, 51, 51, 50, 51, 50, - 49, 49, 50, 49, 49, 48, 48, 47, - 47, 48, 46, 45, 45, 45, 46, 45, - 45, 44, 45, 45, 45, 43, 42, 42, - 41, 43, 41, 40, 40, 39, 40, 41, - 39, 39, 39, 39, 39, 38, 35, 35, - 34, 37, 36, 34, 33, 33, 33, 35, - 34, 32, 32, 31, 32, 30, 29, 26, - 25, 25, 27, 26, 23, 23, 23, 25, - 24, 24, 22, 21, 20, 19, 16, 14, - 13, 13, 13, 10, 9, 7, 7, 7, - 12, 12, 12, 7, 0, 0, 0, 0 -}; - -#else -#error "VAMEM version must be one of {VAMEM_VERSION_1, VAMEM_VERSION_2}" -#endif void ia_css_config_ctc_table(void) { -#if defined(HAS_VAMEM_VERSION_2) memcpy(default_ctc_table.data.vamem_2, default_ctc_table_data, sizeof(default_ctc_table_data)); default_ctc_table.vamem_type = IA_CSS_VAMEM_TYPE_2; -#else - memcpy(default_ctc_table.data.vamem_1, default_ctc_table_data, - sizeof(default_ctc_table_data)); - default_ctc_table.vamem_type = 1IA_CSS_VAMEM_TYPE_1; -#endif } diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/dvs/dvs_1.0/ia_css_dvs.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/dvs/dvs_1.0/ia_css_dvs.host.c index b8b71791466f..67f5540b48b5 100644 --- a/drivers/staging/media/atomisp/pci/isp/kernels/dvs/dvs_1.0/ia_css_dvs.host.c +++ b/drivers/staging/media/atomisp/pci/isp/kernels/dvs/dvs_1.0/ia_css_dvs.host.c @@ -234,7 +234,6 @@ convert_allocate_dvs_6axis_config( unsigned int o_width; unsigned int o_height; struct ia_css_host_data *me; - struct gdc_warp_param_mem_s *isp_data_ptr; assert(binary); assert(dvs_6axis_config); @@ -249,8 +248,6 @@ convert_allocate_dvs_6axis_config( assert((dvs_in_frame_info->format == IA_CSS_FRAME_FORMAT_NV12) || (dvs_in_frame_info->format == IA_CSS_FRAME_FORMAT_YUV420)); - isp_data_ptr = (struct gdc_warp_param_mem_s *)me->address; - i_stride = dvs_in_frame_info->padded_width; o_width = binary->out_frame_info[0].res.width; diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/gc/gc_1.0/ia_css_gc_table.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/gc/gc_1.0/ia_css_gc_table.host.c index f48f876777dc..7dbe2dc0591d 100644 --- a/drivers/staging/media/atomisp/pci/isp/kernels/gc/gc_1.0/ia_css_gc_table.host.c +++ b/drivers/staging/media/atomisp/pci/isp/kernels/gc/gc_1.0/ia_css_gc_table.host.c @@ -21,7 +21,6 @@ #include "ia_css_types.h" #include "ia_css_gc_table.host.h" -#if defined(HAS_VAMEM_VERSION_2) struct ia_css_gamma_table default_gamma_table; @@ -62,154 +61,11 @@ default_gamma_table_data[IA_CSS_VAMEM_2_GAMMA_TABLE_SIZE] = { 255 }; -#elif defined(HAS_VAMEM_VERSION_1) - -static const uint16_t -default_gamma_table_data[IA_CSS_VAMEM_1_GAMMA_TABLE_SIZE] = { - 0, 1, 2, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 16, - 17, 18, 19, 20, 21, 23, 24, 25, - 27, 28, 29, 31, 32, 33, 35, 36, - 38, 39, 41, 42, 44, 45, 47, 48, - 49, 51, 52, 54, 55, 57, 58, 60, - 61, 62, 64, 65, 66, 68, 69, 70, - 71, 72, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 93, 94, - 95, 96, 97, 98, 98, 99, 100, 101, - 102, 102, 103, 104, 105, 105, 106, 107, - 108, 108, 109, 110, 110, 111, 112, 112, - 113, 114, 114, 115, 116, 116, 117, 118, - 118, 119, 120, 120, 121, 121, 122, 123, - 123, 124, 125, 125, 126, 126, 127, 127, /* 128 */ - 128, 129, 129, 130, 130, 131, 131, 132, - 132, 133, 134, 134, 135, 135, 136, 136, - 137, 137, 138, 138, 139, 139, 140, 140, - 141, 141, 142, 142, 143, 143, 144, 144, - 145, 145, 145, 146, 146, 147, 147, 148, - 148, 149, 149, 150, 150, 150, 151, 151, - 152, 152, 152, 153, 153, 154, 154, 155, - 155, 155, 156, 156, 156, 157, 157, 158, - 158, 158, 159, 159, 160, 160, 160, 161, - 161, 161, 162, 162, 162, 163, 163, 163, - 164, 164, 164, 165, 165, 165, 166, 166, - 166, 167, 167, 167, 168, 168, 168, 169, - 169, 169, 170, 170, 170, 170, 171, 171, - 171, 172, 172, 172, 172, 173, 173, 173, - 174, 174, 174, 174, 175, 175, 175, 176, - 176, 176, 176, 177, 177, 177, 177, 178, /* 256 */ - 178, 178, 178, 179, 179, 179, 179, 180, - 180, 180, 180, 181, 181, 181, 181, 182, - 182, 182, 182, 182, 183, 183, 183, 183, - 184, 184, 184, 184, 184, 185, 185, 185, - 185, 186, 186, 186, 186, 186, 187, 187, - 187, 187, 187, 188, 188, 188, 188, 188, - 189, 189, 189, 189, 189, 190, 190, 190, - 190, 190, 191, 191, 191, 191, 191, 192, - 192, 192, 192, 192, 192, 193, 193, 193, - 193, 193, 194, 194, 194, 194, 194, 194, - 195, 195, 195, 195, 195, 195, 196, 196, - 196, 196, 196, 196, 197, 197, 197, 197, - 197, 197, 198, 198, 198, 198, 198, 198, - 198, 199, 199, 199, 199, 199, 199, 200, - 200, 200, 200, 200, 200, 200, 201, 201, - 201, 201, 201, 201, 201, 202, 202, 202, /* 384 */ - 202, 202, 202, 202, 203, 203, 203, 203, - 203, 203, 203, 204, 204, 204, 204, 204, - 204, 204, 204, 205, 205, 205, 205, 205, - 205, 205, 205, 206, 206, 206, 206, 206, - 206, 206, 206, 207, 207, 207, 207, 207, - 207, 207, 207, 208, 208, 208, 208, 208, - 208, 208, 208, 209, 209, 209, 209, 209, - 209, 209, 209, 209, 210, 210, 210, 210, - 210, 210, 210, 210, 210, 211, 211, 211, - 211, 211, 211, 211, 211, 211, 212, 212, - 212, 212, 212, 212, 212, 212, 212, 213, - 213, 213, 213, 213, 213, 213, 213, 213, - 214, 214, 214, 214, 214, 214, 214, 214, - 214, 214, 215, 215, 215, 215, 215, 215, - 215, 215, 215, 216, 216, 216, 216, 216, - 216, 216, 216, 216, 216, 217, 217, 217, /* 512 */ - 217, 217, 217, 217, 217, 217, 217, 218, - 218, 218, 218, 218, 218, 218, 218, 218, - 218, 219, 219, 219, 219, 219, 219, 219, - 219, 219, 219, 220, 220, 220, 220, 220, - 220, 220, 220, 220, 220, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, - 222, 222, 222, 222, 222, 222, 222, 222, - 222, 222, 223, 223, 223, 223, 223, 223, - 223, 223, 223, 223, 223, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 225, 225, 225, 225, 225, 225, 225, 225, - 225, 225, 225, 226, 226, 226, 226, 226, - 226, 226, 226, 226, 226, 226, 226, 227, - 227, 227, 227, 227, 227, 227, 227, 227, - 227, 227, 228, 228, 228, 228, 228, 228, - 228, 228, 228, 228, 228, 228, 229, 229, - 229, 229, 229, 229, 229, 229, 229, 229, - 229, 229, 230, 230, 230, 230, 230, 230, - 230, 230, 230, 230, 230, 230, 231, 231, - 231, 231, 231, 231, 231, 231, 231, 231, - 231, 231, 231, 232, 232, 232, 232, 232, - 232, 232, 232, 232, 232, 232, 232, 233, - 233, 233, 233, 233, 233, 233, 233, 233, - 233, 233, 233, 233, 234, 234, 234, 234, - 234, 234, 234, 234, 234, 234, 234, 234, - 234, 235, 235, 235, 235, 235, 235, 235, - 235, 235, 235, 235, 235, 235, 236, 236, - 236, 236, 236, 236, 236, 236, 236, 236, - 236, 236, 236, 236, 237, 237, 237, 237, - 237, 237, 237, 237, 237, 237, 237, 237, - 237, 237, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, - 239, 239, 239, 239, 239, 239, 239, 239, - 239, 239, 239, 239, 239, 239, 240, 240, - 240, 240, 240, 240, 240, 240, 240, 240, - 240, 240, 240, 240, 241, 241, 241, 241, - 241, 241, 241, 241, 241, 241, 241, 241, - 241, 241, 241, 242, 242, 242, 242, 242, - 242, 242, 242, 242, 242, 242, 242, 242, - 242, 242, 243, 243, 243, 243, 243, 243, - 243, 243, 243, 243, 243, 243, 243, 243, - 243, 244, 244, 244, 244, 244, 244, 244, - 244, 244, 244, 244, 244, 244, 244, 244, - 245, 245, 245, 245, 245, 245, 245, 245, - 245, 245, 245, 245, 245, 245, 245, 246, - 246, 246, 246, 246, 246, 246, 246, 246, - 246, 246, 246, 246, 246, 246, 246, 247, - 247, 247, 247, 247, 247, 247, 247, 247, - 247, 247, 247, 247, 247, 247, 247, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 249, - 249, 249, 249, 249, 249, 249, 249, 249, - 249, 249, 249, 249, 249, 249, 249, 250, - 250, 250, 250, 250, 250, 250, 250, 250, - 250, 250, 250, 250, 250, 250, 250, 251, - 251, 251, 251, 251, 251, 251, 251, 251, - 251, 251, 251, 251, 251, 251, 251, 252, - 252, 252, 252, 252, 252, 252, 252, 252, - 252, 252, 252, 252, 252, 252, 252, 253, - 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, - 254, 254, 254, 254, 254, 254, 254, 254, - 254, 254, 254, 254, 254, 254, 254, 254, - 255, 255, 255, 255, 255, 255, 255, 255 -}; - -#else -#error "VAMEM version must be one of {VAMEM_VERSION_1, VAMEM_VERSION_2}" -#endif void ia_css_config_gamma_table(void) { -#if defined(HAS_VAMEM_VERSION_2) memcpy(default_gamma_table.data.vamem_2, default_gamma_table_data, sizeof(default_gamma_table_data)); default_gamma_table.vamem_type = IA_CSS_VAMEM_TYPE_2; -#else - memcpy(default_gamma_table.data.vamem_1, default_gamma_table_data, - sizeof(default_gamma_table_data)); - default_gamma_table.vamem_type = IA_CSS_VAMEM_TYPE_1; -#endif } diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/gc/gc_2/ia_css_gc2_table.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/gc/gc_2/ia_css_gc2_table.host.c index 7eadb31268eb..34795011907a 100644 --- a/drivers/staging/media/atomisp/pci/isp/kernels/gc/gc_2/ia_css_gc2_table.host.c +++ b/drivers/staging/media/atomisp/pci/isp/kernels/gc/gc_2/ia_css_gc2_table.host.c @@ -27,7 +27,6 @@ struct ia_css_rgb_gamma_table default_b_gamma_table; /* Identical default gamma table for R, G, and B. */ -#if defined(HAS_VAMEM_VERSION_2) static const uint16_t default_gamma_table_data[IA_CSS_VAMEM_2_RGB_GAMMA_TABLE_SIZE] = { @@ -65,51 +64,10 @@ default_gamma_table_data[IA_CSS_VAMEM_2_RGB_GAMMA_TABLE_SIZE] = { 4032, 4040, 4048, 4056, 4064, 4072, 4080, 4088, 4095 }; -#elif defined(HAS_VAMEM_VERSION_1) - -static const uint16_t -default_gamma_table_data[IA_CSS_VAMEM_1_RGB_GAMMA_TABLE_SIZE] = { - 0, 72, 144, 216, 288, 360, 426, 486, - 541, 592, 641, 687, 730, 772, 812, 850, - 887, 923, 958, 991, 1024, 1055, 1086, 1117, - 1146, 1175, 1203, 1230, 1257, 1284, 1310, 1335, - 1360, 1385, 1409, 1433, 1457, 1480, 1502, 1525, - 1547, 1569, 1590, 1612, 1632, 1653, 1674, 1694, - 1714, 1734, 1753, 1772, 1792, 1811, 1829, 1848, - 1866, 1884, 1902, 1920, 1938, 1955, 1973, 1990, - 2007, 2024, 2040, 2057, 2074, 2090, 2106, 2122, - 2138, 2154, 2170, 2185, 2201, 2216, 2231, 2247, - 2262, 2277, 2291, 2306, 2321, 2335, 2350, 2364, - 2378, 2393, 2407, 2421, 2435, 2449, 2462, 2476, - 2490, 2503, 2517, 2530, 2543, 2557, 2570, 2583, - 2596, 2609, 2622, 2634, 2647, 2660, 2673, 2685, - 2698, 2710, 2722, 2735, 2747, 2759, 2771, 2783, - 2795, 2807, 2819, 2831, 2843, 2855, 2867, 2878, - 2890, 2901, 2913, 2924, 2936, 2947, 2958, 2970, - 2981, 2992, 3003, 3014, 3025, 3036, 3047, 3058, - 3069, 3080, 3091, 3102, 3112, 3123, 3134, 3144, - 3155, 3165, 3176, 3186, 3197, 3207, 3217, 3228, - 3238, 3248, 3258, 3268, 3279, 3289, 3299, 3309, - 3319, 3329, 3339, 3349, 3358, 3368, 3378, 3388, - 3398, 3407, 3417, 3427, 3436, 3446, 3455, 3465, - 3474, 3484, 3493, 3503, 3512, 3521, 3531, 3540, - 3549, 3559, 3568, 3577, 3586, 3595, 3605, 3614, - 3623, 3632, 3641, 3650, 3659, 3668, 3677, 3686, - 3694, 3703, 3712, 3721, 3730, 3739, 3747, 3756, - 3765, 3773, 3782, 3791, 3799, 3808, 3816, 3825, - 3833, 3842, 3850, 3859, 3867, 3876, 3884, 3893, - 3901, 3909, 3918, 3926, 3934, 3942, 3951, 3959, - 3967, 3975, 3984, 3992, 4000, 4008, 4016, 4024, - 4032, 4040, 4048, 4056, 4064, 4072, 4080, 4088 -}; -#else -#error "VAMEM version must be one of {VAMEM_VERSION_1, VAMEM_VERSION_2}" -#endif void ia_css_config_rgb_gamma_tables(void) { -#if defined(HAS_VAMEM_VERSION_2) default_r_gamma_table.vamem_type = IA_CSS_VAMEM_TYPE_2; default_g_gamma_table.vamem_type = IA_CSS_VAMEM_TYPE_2; default_b_gamma_table.vamem_type = IA_CSS_VAMEM_TYPE_2; @@ -119,15 +77,4 @@ ia_css_config_rgb_gamma_tables(void) sizeof(default_gamma_table_data)); memcpy(default_b_gamma_table.data.vamem_2, default_gamma_table_data, sizeof(default_gamma_table_data)); -#else - memcpy(default_r_gamma_table.data.vamem_1, default_gamma_table_data, - sizeof(default_gamma_table_data)); - memcpy(default_g_gamma_table.data.vamem_1, default_gamma_table_data, - sizeof(default_gamma_table_data)); - memcpy(default_b_gamma_table.data.vamem_1, default_gamma_table_data, - sizeof(default_gamma_table_data)); - default_r_gamma_table.vamem_type = IA_CSS_VAMEM_TYPE_1; - default_g_gamma_table.vamem_type = IA_CSS_VAMEM_TYPE_1; - default_b_gamma_table.vamem_type = IA_CSS_VAMEM_TYPE_1; -#endif } diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/raw/raw_1.0/ia_css_raw.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/raw/raw_1.0/ia_css_raw.host.c index 1c6f6792d57b..c505c94a7241 100644 --- a/drivers/staging/media/atomisp/pci/isp/kernels/raw/raw_1.0/ia_css_raw.host.c +++ b/drivers/staging/media/atomisp/pci/isp/kernels/raw/raw_1.0/ia_css_raw.host.c @@ -81,7 +81,7 @@ ia_css_raw_config( const struct ia_css_frame_info *internal_info = from->internal_info; (void)size; -#if !defined(USE_INPUT_SYSTEM_VERSION_2401) +#if !defined(ISP2401) /* 2401 input system uses input width width */ in_info = internal_info; #else @@ -105,7 +105,7 @@ ia_css_raw_config( to->two_ppc = from->two_ppc; to->stream_format = css2isp_stream_format(from->stream_format); to->deinterleaved = from->deinterleaved; -#if (defined(USE_INPUT_SYSTEM_VERSION_2401) || defined(CONFIG_CSI2_PLUS)) +#if defined(ISP2401) to->start_column = in_info->crop_info.start_column; to->start_line = in_info->crop_info.start_line; to->enable_left_padding = from->enable_left_padding; diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/sdis/sdis_2/ia_css_sdis2.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/sdis/sdis_2/ia_css_sdis2.host.c index 7922198f6784..f608740e8340 100644 --- a/drivers/staging/media/atomisp/pci/isp/kernels/sdis/sdis_2/ia_css_sdis2.host.c +++ b/drivers/staging/media/atomisp/pci/isp/kernels/sdis/sdis_2/ia_css_sdis2.host.c @@ -116,7 +116,6 @@ void ia_css_get_isp_dvs2_coefficients( { struct ia_css_isp_parameters *params; unsigned int hor_num_3a, ver_num_3a; - unsigned int hor_num_isp, ver_num_isp; struct ia_css_binary *dvs_binary; IA_CSS_ENTER("void"); @@ -140,8 +139,6 @@ void ia_css_get_isp_dvs2_coefficients( hor_num_3a = dvs_binary->dis.coef.dim.width; ver_num_3a = dvs_binary->dis.coef.dim.height; - hor_num_isp = dvs_binary->dis.coef.pad.width; - ver_num_isp = dvs_binary->dis.coef.pad.height; memcpy(hor_coefs_odd_real, params->dvs2_coefs.hor_coefs.odd_real, hor_num_3a * sizeof(short)); diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c index 358cb7d2cd4c..dd3670972936 100644 --- a/drivers/staging/media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c +++ b/drivers/staging/media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c @@ -13,6 +13,8 @@ * more details. */ +#include "atomisp_internal.h" + #include "ia_css_vf.host.h" #include <assert_support.h> #include <ia_css_err.h> @@ -58,7 +60,7 @@ sh_css_vf_downscale_log2( unsigned int ds_log2 = 0; unsigned int out_width; - if ((!out_info) | (!vf_info)) + if ((!out_info) || (!vf_info)) return -EINVAL; out_width = out_info->res.width; @@ -129,6 +131,9 @@ ia_css_vf_configure( const struct ia_css_binary_info *info = &binary->info->sp; err = configure_kernel(info, out_info, vf_info, downscale_log2, &config); + if (err) + dev_warn(atomisp_dev, "Couldn't setup downscale\n"); + configure_dma(&config, vf_info); if (vf_info) diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_1.0/ia_css_xnr_param.h b/drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_1.0/ia_css_xnr_param.h index 7ebf139f3618..93754f7c797d 100644 --- a/drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_1.0/ia_css_xnr_param.h +++ b/drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_1.0/ia_css_xnr_param.h @@ -20,15 +20,8 @@ #include <system_global.h> #ifndef PIPE_GENERATION -#if defined(HAS_VAMEM_VERSION_2) #define SH_CSS_ISP_XNR_TABLE_SIZE_LOG2 IA_CSS_VAMEM_2_XNR_TABLE_SIZE_LOG2 #define SH_CSS_ISP_XNR_TABLE_SIZE IA_CSS_VAMEM_2_XNR_TABLE_SIZE -#elif defined(HAS_VAMEM_VERSION_1) -#define SH_CSS_ISP_XNR_TABLE_SIZE_LOG2 IA_CSS_VAMEM_1_XNR_TABLE_SIZE_LOG2 -#define SH_CSS_ISP_XNR_TABLE_SIZE IA_CSS_VAMEM_1_XNR_TABLE_SIZE -#else -#error "Unknown vamem type" -#endif #else /* For pipe generation, the size is not relevant */ diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_1.0/ia_css_xnr_table.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_1.0/ia_css_xnr_table.host.c index 5566f3c16aac..e5c15308693d 100644 --- a/drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_1.0/ia_css_xnr_table.host.c +++ b/drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_1.0/ia_css_xnr_table.host.c @@ -23,7 +23,6 @@ struct ia_css_xnr_table default_xnr_table; -#if defined(HAS_VAMEM_VERSION_2) static const uint16_t default_xnr_table_data[IA_CSS_VAMEM_2_XNR_TABLE_SIZE] = { @@ -43,41 +42,11 @@ default_xnr_table_data[IA_CSS_VAMEM_2_XNR_TABLE_SIZE] = { 167 >> 1, 163 >> 1, 160 >> 1, 157 >> 1, 154 >> 1, 151 >> 1, 148 >> 1, 146 >> 1, 143 >> 1, 141 >> 1, 138 >> 1, 136 >> 1, 134 >> 1, 132 >> 1, 130 >> 1, 128 >> 1 }; -#elif defined(HAS_VAMEM_VERSION_1) - -static const uint16_t -default_xnr_table_data[IA_CSS_VAMEM_1_XNR_TABLE_SIZE] = { - /* 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */ - 8191 >> 1, 4096 >> 1, 2730 >> 1, 2048 >> 1, 1638 >> 1, 1365 >> 1, 1170 >> 1, 1024 >> 1, 910 >> 1, 819 >> 1, 744 >> 1, 682 >> 1, 630 >> 1, 585 >> 1, - 546 >> 1, 512 >> 1, - - /* 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 */ - 481 >> 1, 455 >> 1, 431 >> 1, 409 >> 1, 390 >> 1, 372 >> 1, 356 >> 1, 341 >> 1, 327 >> 1, 315 >> 1, 303 >> 1, 292 >> 1, 282 >> 1, 273 >> 1, 264 >> 1, - 256 >> 1, - - /* 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 */ - 248 >> 1, 240 >> 1, 234 >> 1, 227 >> 1, 221 >> 1, 215 >> 1, 210 >> 1, 204 >> 1, 199 >> 1, 195 >> 1, 190 >> 1, 186 >> 1, 182 >> 1, 178 >> 1, 174 >> 1, - 170 >> 1, - - /* 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 */ - 167 >> 1, 163 >> 1, 160 >> 1, 157 >> 1, 154 >> 1, 151 >> 1, 148 >> 1, 146 >> 1, 143 >> 1, 141 >> 1, 138 >> 1, 136 >> 1, 134 >> 1, 132 >> 1, 130 >> 1, 128 >> 1 -}; - -#else -#error "sh_css_params.c: VAMEM version must \ -be one of {VAMEM_VERSION_1, VAMEM_VERSION_2}" -#endif void ia_css_config_xnr_table(void) { -#if defined(HAS_VAMEM_VERSION_2) memcpy(default_xnr_table.data.vamem_2, default_xnr_table_data, sizeof(default_xnr_table_data)); default_xnr_table.vamem_type = IA_CSS_VAMEM_TYPE_2; -#else - memcpy(default_xnr_table.data.vamem_1, default_xnr_table_data, - sizeof(default_xnr_table_data)); - default_xnr_table.vamem_type = IA_CSS_VAMEM_TYPE_1; -#endif } diff --git a/drivers/staging/media/atomisp/pci/isp2400_input_system_global.h b/drivers/staging/media/atomisp/pci/isp2400_input_system_global.h index b4142bdde51b..61f23814e2fd 100644 --- a/drivers/staging/media/atomisp/pci/isp2400_input_system_global.h +++ b/drivers/staging/media/atomisp/pci/isp2400_input_system_global.h @@ -13,11 +13,6 @@ * more details. */ -#ifndef __INPUT_SYSTEM_GLOBAL_H_INCLUDED__ -#define __INPUT_SYSTEM_GLOBAL_H_INCLUDED__ - -#define IS_INPUT_SYSTEM_VERSION_2 - #include <type_support.h> //CSI reveiver has 3 ports. @@ -80,13 +75,13 @@ typedef enum { N_INPUT_SYSTEM_BUFFERING_MODE } buffering_mode_t; -typedef struct input_system_cfg_s input_system_cfg_t; +typedef struct isp2400_input_system_cfg_s input_system_cfg_t; typedef struct sync_generator_cfg_s sync_generator_cfg_t; typedef struct tpg_cfg_s tpg_cfg_t; typedef struct prbs_cfg_s prbs_cfg_t; /* MW: uint16_t should be sufficient */ -struct input_system_cfg_s { +struct isp2400_input_system_cfg_s { u32 no_side_band; u32 fmt_type; u32 ch_id; @@ -123,7 +118,7 @@ struct gpfifo_cfg_s { typedef struct gpfifo_cfg_s gpfifo_cfg_t; //ALX:Commented out to pass the compilation. -//typedef struct input_system_cfg_s input_system_cfg_t; +//typedef struct isp2400_input_system_cfg_s input_system_cfg_t; struct ib_buffer_s { u32 mem_reg_size; @@ -131,13 +126,13 @@ struct ib_buffer_s { u32 mem_reg_addr; }; -typedef struct ib_buffer_s ib_buffer_t; +typedef struct ib_buffer_s isp2400_ib_buffer_t; struct csi_cfg_s { u32 csi_port; buffering_mode_t buffering_mode; - ib_buffer_t csi_buffer; - ib_buffer_t acquisition_buffer; + isp2400_ib_buffer_t csi_buffer; + isp2400_ib_buffer_t acquisition_buffer; u32 nof_xmem_buffers; }; @@ -149,8 +144,6 @@ typedef enum { INPUT_SYSTEM_CFG_FLAG_BLOCKED = 1U << 1, INPUT_SYSTEM_CFG_FLAG_REQUIRED = 1U << 2, INPUT_SYSTEM_CFG_FLAG_CONFLICT = 1U << 3 // To mark a conflicting configuration. -} input_system_cfg_flag_t; +} isp2400_input_system_cfg_flag_t; typedef u32 input_system_config_flags_t; - -#endif /* __INPUT_SYSTEM_GLOBAL_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/isp2400_input_system_local.h b/drivers/staging/media/atomisp/pci/isp2400_input_system_local.h index 33ebf89ca053..072a92199e05 100644 --- a/drivers/staging/media/atomisp/pci/isp2400_input_system_local.h +++ b/drivers/staging/media/atomisp/pci/isp2400_input_system_local.h @@ -34,15 +34,6 @@ #include "input_system_ctrl_defs.h" typedef enum { - INPUT_SYSTEM_ERR_NO_ERROR = 0, - INPUT_SYSTEM_ERR_GENERIC, - INPUT_SYSTEM_ERR_CHANNEL_ALREADY_SET, - INPUT_SYSTEM_ERR_CONFLICT_ON_RESOURCE, - INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED, - N_INPUT_SYSTEM_ERR -} input_system_error_t; - -typedef enum { INPUT_SYSTEM_PORT_A = 0, INPUT_SYSTEM_PORT_B, INPUT_SYSTEM_PORT_C, @@ -61,8 +52,8 @@ typedef struct input_switch_cfg_channel_s input_switch_cfg_channel_t; typedef struct input_switch_cfg_s input_switch_cfg_t; struct ctrl_unit_cfg_s { - ib_buffer_t buffer_mipi[N_CAPTURE_UNIT_ID]; - ib_buffer_t buffer_acquire[N_ACQUISITION_UNIT_ID]; + isp2400_ib_buffer_t buffer_mipi[N_CAPTURE_UNIT_ID]; + isp2400_ib_buffer_t buffer_acquire[N_ACQUISITION_UNIT_ID]; }; struct input_system_network_cfg_s { @@ -137,9 +128,9 @@ struct input_system_cfg2400_s { // Possible another struct for ib. // This buffers set at the end, based on the all configurations. - ib_buffer_t csi_buffer[N_CSI_PORTS]; + isp2400_ib_buffer_t csi_buffer[N_CSI_PORTS]; input_system_config_flags_t csi_buffer_flags[N_CSI_PORTS]; - ib_buffer_t acquisition_buffer_unique; + isp2400_ib_buffer_t acquisition_buffer_unique; input_system_config_flags_t acquisition_buffer_unique_flags; u32 unallocated_ib_mem_words; // Used for check.DEFAULT = IB_CAPACITY_IN_WORDS. //uint32_t acq_allocated_ib_mem_words; diff --git a/drivers/staging/media/atomisp/pci/isp2400_input_system_public.h b/drivers/staging/media/atomisp/pci/isp2400_input_system_public.h index 689e451f1ce2..85cb61e34192 100644 --- a/drivers/staging/media/atomisp/pci/isp2400_input_system_public.h +++ b/drivers/staging/media/atomisp/pci/isp2400_input_system_public.h @@ -17,7 +17,7 @@ #define __INPUT_SYSTEM_PUBLIC_H_INCLUDED__ #include <type_support.h> -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 #include "isys_public.h" #else @@ -251,11 +251,11 @@ STORAGE_CLASS_INPUT_SYSTEM_H hrt_data input_system_sub_system_reg_load( // Function that resets current configuration. // remove the argument since it should be private. -input_system_error_t input_system_configuration_reset(void); +input_system_err_t input_system_configuration_reset(void); // Function that commits current configuration. // remove the argument since it should be private. -input_system_error_t input_system_configuration_commit(void); +input_system_err_t input_system_configuration_commit(void); /////////////////////////////////////////////////////////////////////////// // @@ -269,14 +269,14 @@ input_system_error_t input_system_configuration_commit(void); // FIFO channel config function user -input_system_error_t input_system_csi_fifo_channel_cfg( +input_system_err_t input_system_csi_fifo_channel_cfg( u32 ch_id, input_system_csi_port_t port, backend_channel_cfg_t backend_ch, target_cfg2400_t target ); -input_system_error_t input_system_csi_fifo_channel_with_counting_cfg( +input_system_err_t input_system_csi_fifo_channel_with_counting_cfg( u32 ch_id, u32 nof_frame, input_system_csi_port_t port, @@ -288,7 +288,7 @@ input_system_error_t input_system_csi_fifo_channel_with_counting_cfg( // SRAM channel config function user -input_system_error_t input_system_csi_sram_channel_cfg( +input_system_err_t input_system_csi_sram_channel_cfg( u32 ch_id, input_system_csi_port_t port, backend_channel_cfg_t backend_ch, @@ -299,7 +299,7 @@ input_system_error_t input_system_csi_sram_channel_cfg( //XMEM channel config function user -input_system_error_t input_system_csi_xmem_channel_cfg( +input_system_err_t input_system_csi_xmem_channel_cfg( u32 ch_id, input_system_csi_port_t port, backend_channel_cfg_t backend_ch, @@ -311,7 +311,7 @@ input_system_error_t input_system_csi_xmem_channel_cfg( uint32_t nof_xmem_buffers ); -input_system_error_t input_system_csi_xmem_capture_only_channel_cfg( +input_system_err_t input_system_csi_xmem_capture_only_channel_cfg( u32 ch_id, u32 nof_frames, input_system_csi_port_t port, @@ -322,7 +322,7 @@ input_system_error_t input_system_csi_xmem_capture_only_channel_cfg( target_cfg2400_t target ); -input_system_error_t input_system_csi_xmem_acquire_only_channel_cfg( +input_system_err_t input_system_csi_xmem_acquire_only_channel_cfg( u32 ch_id, u32 nof_frames, input_system_csi_port_t port, @@ -334,7 +334,7 @@ input_system_error_t input_system_csi_xmem_acquire_only_channel_cfg( // Non - CSI channel config function user -input_system_error_t input_system_prbs_channel_cfg( +input_system_err_t input_system_prbs_channel_cfg( u32 ch_id, u32 nof_frames, u32 seed, @@ -345,7 +345,7 @@ input_system_error_t input_system_prbs_channel_cfg( target_cfg2400_t target ); -input_system_error_t input_system_tpg_channel_cfg( +input_system_err_t input_system_tpg_channel_cfg( u32 ch_id, u32 nof_frames,//not used yet u32 x_mask, @@ -360,11 +360,11 @@ input_system_error_t input_system_tpg_channel_cfg( target_cfg2400_t target ); -input_system_error_t input_system_gpfifo_channel_cfg( +input_system_err_t input_system_gpfifo_channel_cfg( u32 ch_id, u32 nof_frames, target_cfg2400_t target ); -#endif /* #ifdef USE_INPUT_SYSTEM_VERSION_2401 */ +#endif /* #ifdef ISP2401 */ #endif /* __INPUT_SYSTEM_PUBLIC_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/isp2400_system_global.h b/drivers/staging/media/atomisp/pci/isp2400_system_global.h deleted file mode 100644 index 74fff465e8e8..000000000000 --- a/drivers/staging/media/atomisp/pci/isp2400_system_global.h +++ /dev/null @@ -1,16 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.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. - */ - -#define USE_INPUT_SYSTEM_VERSION_2 diff --git a/drivers/staging/media/atomisp/pci/isp2401_input_system_global.h b/drivers/staging/media/atomisp/pci/isp2401_input_system_global.h index 5070e651f7c4..f38773842646 100644 --- a/drivers/staging/media/atomisp/pci/isp2401_input_system_global.h +++ b/drivers/staging/media/atomisp/pci/isp2401_input_system_global.h @@ -13,19 +13,15 @@ * more details. */ -#ifndef __INPUT_SYSTEM_GLOBAL_H_INCLUDED__ -#define __INPUT_SYSTEM_GLOBAL_H_INCLUDED__ - -#define IS_INPUT_SYSTEM_VERSION_VERSION_2401 - /* CSI reveiver has 3 ports. */ #define N_CSI_PORTS (3) -#include "isys_dma.h" /* isys2401_dma_channel, +#include "system_local.h" +#include "isys_dma_global.h" /* isys2401_dma_channel, * isys2401_dma_cfg_t */ -#include "ibuf_ctrl.h" /* ibuf_cfg_t, +#include "ibuf_ctrl_local.h" /* ibuf_cfg_t, * ibuf_ctrl_cfg_t */ @@ -41,18 +37,6 @@ virtual channels supported*/ typedef enum { - INPUT_SYSTEM_ERR_NO_ERROR = 0, - INPUT_SYSTEM_ERR_CREATE_CHANNEL_FAIL, - INPUT_SYSTEM_ERR_CONFIGURE_CHANNEL_FAIL, - INPUT_SYSTEM_ERR_OPEN_CHANNEL_FAIL, - INPUT_SYSTEM_ERR_TRANSFER_FAIL, - INPUT_SYSTEM_ERR_CREATE_INPUT_PORT_FAIL, - INPUT_SYSTEM_ERR_CONFIGURE_INPUT_PORT_FAIL, - INPUT_SYSTEM_ERR_OPEN_INPUT_PORT_FAIL, - N_INPUT_SYSTEM_ERR -} input_system_err_t; - -typedef enum { INPUT_SYSTEM_SOURCE_TYPE_UNDEFINED = 0, INPUT_SYSTEM_SOURCE_TYPE_SENSOR, INPUT_SYSTEM_SOURCE_TYPE_TPG, @@ -71,7 +55,7 @@ struct input_system_channel_s { stream2mmio_sid_ID_t stream2mmio_sid_id; ibuf_ctrl_ID_t ibuf_ctrl_id; - ib_buffer_t ib_buffer; + isp2401_ib_buffer_t ib_buffer; isys2401_dma_ID_t dma_id; isys2401_dma_channel dma_channel; @@ -121,8 +105,8 @@ struct input_system_input_port_cfg_s { } pixelgen_cfg; }; -typedef struct input_system_cfg_s input_system_cfg_t; -struct input_system_cfg_s { +typedef struct isp2401_input_system_cfg_s isp2401_input_system_cfg_t; +struct isp2401_input_system_cfg_s { input_system_input_port_ID_t input_port_id; input_system_source_type_t mode; @@ -202,5 +186,3 @@ struct virtual_input_system_stream_cfg_s { #define NUM_OF_LINES_PER_BUF 2 #define LINES_OF_ISP_INPUT_BUF (NUM_OF_INPUT_BUF * NUM_OF_LINES_PER_BUF) #define ISP_INPUT_BUF_STRIDE SH_CSS_MAX_SENSOR_WIDTH - -#endif /* __INPUT_SYSTEM_GLOBAL_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/isp2401_input_system_local.h b/drivers/staging/media/atomisp/pci/isp2401_input_system_local.h index f52a8ca5f86b..24026090cd35 100644 --- a/drivers/staging/media/atomisp/pci/isp2401_input_system_local.h +++ b/drivers/staging/media/atomisp/pci/isp2401_input_system_local.h @@ -19,14 +19,11 @@ #include "type_support.h" #include "input_system_global.h" -#include "ibuf_ctrl.h" #include "csi_rx.h" #include "pixelgen.h" #include "isys_stream2mmio.h" #include "isys_irq.h" -typedef input_system_err_t input_system_error_t; - typedef enum { MIPI_FORMAT_SHORT1 = 0x08, MIPI_FORMAT_SHORT2, diff --git a/drivers/staging/media/atomisp/pci/isp2401_input_system_private.h b/drivers/staging/media/atomisp/pci/isp2401_input_system_private.h index f3ca5d1bcb01..e4c76428f6dd 100644 --- a/drivers/staging/media/atomisp/pci/isp2401_input_system_private.h +++ b/drivers/staging/media/atomisp/pci/isp2401_input_system_private.h @@ -18,9 +18,222 @@ #include "input_system_public.h" -STORAGE_CLASS_INPUT_SYSTEM_C input_system_err_t input_system_get_state( - const input_system_ID_t ID, - input_system_state_t *state) +#include "device_access.h" /* ia_css_device_load_uint32 */ + +#include "assert_support.h" /* assert */ +#include "print_support.h" /* print */ + +/* Load the register value */ +static inline hrt_data ibuf_ctrl_reg_load(const ibuf_ctrl_ID_t ID, + const hrt_address reg) +{ + assert(ID < N_IBUF_CTRL_ID); + assert(IBUF_CTRL_BASE[ID] != (hrt_address)-1); + return ia_css_device_load_uint32(IBUF_CTRL_BASE[ID] + reg * sizeof(hrt_data)); +} + +/* Store a value to the register */ +static inline void ibuf_ctrl_reg_store(const ibuf_ctrl_ID_t ID, + const hrt_address reg, + const hrt_data value) +{ + assert(ID < N_IBUF_CTRL_ID); + assert(IBUF_CTRL_BASE[ID] != (hrt_address)-1); + + ia_css_device_store_uint32(IBUF_CTRL_BASE[ID] + reg * sizeof(hrt_data), value); +} + +/* Get the state of the ibuf-controller process */ +static inline void ibuf_ctrl_get_proc_state(const ibuf_ctrl_ID_t ID, + const u32 proc_id, + ibuf_ctrl_proc_state_t *state) +{ + hrt_address reg_bank_offset; + + reg_bank_offset = + _IBUF_CNTRL_PROC_REG_ALIGN * (1 + proc_id); + + state->num_items = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_NUM_ITEMS_PER_STORE); + + state->num_stores = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_NUM_STORES_PER_FRAME); + + state->dma_channel = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DMA_CHANNEL); + + state->dma_command = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DMA_CMD); + + state->ibuf_st_addr = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_BUFFER_START_ADDRESS); + + state->ibuf_stride = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_BUFFER_STRIDE); + + state->ibuf_end_addr = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_BUFFER_END_ADDRESS); + + state->dest_st_addr = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DEST_START_ADDRESS); + + state->dest_stride = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DEST_STRIDE); + + state->dest_end_addr = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DEST_END_ADDRESS); + + state->sync_frame = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_SYNC_FRAME); + + state->sync_command = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_STR2MMIO_SYNC_CMD); + + state->store_command = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_STR2MMIO_STORE_CMD); + + state->shift_returned_items = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_SHIFT_ITEMS); + + state->elems_ibuf = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_ELEMS_P_WORD_IBUF); + + state->elems_dest = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_ELEMS_P_WORD_DEST); + + state->cur_stores = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_STORES); + + state->cur_acks = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_ACKS); + + state->cur_s2m_ibuf_addr = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_S2M_IBUF_ADDR); + + state->cur_dma_ibuf_addr = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_DMA_IBUF_ADDR); + + state->cur_dma_dest_addr = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_DMA_DEST_ADDR); + + state->cur_isp_dest_addr = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_ISP_DEST_ADDR); + + state->dma_cmds_send = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_NR_DMA_CMDS_SEND); + + state->main_cntrl_state = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_MAIN_CNTRL_STATE); + + state->dma_sync_state = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DMA_SYNC_STATE); + + state->isp_sync_state = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_ISP_SYNC_STATE); +} + +/* Get the ibuf-controller state. */ +static inline void ibuf_ctrl_get_state(const ibuf_ctrl_ID_t ID, + ibuf_ctrl_state_t *state) +{ + u32 i; + + state->recalc_words = + ibuf_ctrl_reg_load(ID, _IBUF_CNTRL_RECALC_WORDS_STATUS); + state->arbiters = + ibuf_ctrl_reg_load(ID, _IBUF_CNTRL_ARBITERS_STATUS); + + /* + * Get the values of the register-set per + * ibuf-controller process. + */ + for (i = 0; i < N_IBUF_CTRL_PROCS[ID]; i++) { + ibuf_ctrl_get_proc_state( + ID, + i, + &state->proc_state[i]); + } +} + +/* Dump the ibuf-controller state */ +static inline void ibuf_ctrl_dump_state(const ibuf_ctrl_ID_t ID, + ibuf_ctrl_state_t *state) +{ + u32 i; + + ia_css_print("IBUF controller ID %d recalculate words 0x%x\n", ID, + state->recalc_words); + ia_css_print("IBUF controller ID %d arbiters 0x%x\n", ID, state->arbiters); + + /* + * Dump the values of the register-set per + * ibuf-controller process. + */ + for (i = 0; i < N_IBUF_CTRL_PROCS[ID]; i++) { + ia_css_print("IBUF controller ID %d Process ID %d num_items 0x%x\n", ID, i, + state->proc_state[i].num_items); + ia_css_print("IBUF controller ID %d Process ID %d num_stores 0x%x\n", ID, i, + state->proc_state[i].num_stores); + ia_css_print("IBUF controller ID %d Process ID %d dma_channel 0x%x\n", ID, i, + state->proc_state[i].dma_channel); + ia_css_print("IBUF controller ID %d Process ID %d dma_command 0x%x\n", ID, i, + state->proc_state[i].dma_command); + ia_css_print("IBUF controller ID %d Process ID %d ibuf_st_addr 0x%x\n", ID, i, + state->proc_state[i].ibuf_st_addr); + ia_css_print("IBUF controller ID %d Process ID %d ibuf_stride 0x%x\n", ID, i, + state->proc_state[i].ibuf_stride); + ia_css_print("IBUF controller ID %d Process ID %d ibuf_end_addr 0x%x\n", ID, i, + state->proc_state[i].ibuf_end_addr); + ia_css_print("IBUF controller ID %d Process ID %d dest_st_addr 0x%x\n", ID, i, + state->proc_state[i].dest_st_addr); + ia_css_print("IBUF controller ID %d Process ID %d dest_stride 0x%x\n", ID, i, + state->proc_state[i].dest_stride); + ia_css_print("IBUF controller ID %d Process ID %d dest_end_addr 0x%x\n", ID, i, + state->proc_state[i].dest_end_addr); + ia_css_print("IBUF controller ID %d Process ID %d sync_frame 0x%x\n", ID, i, + state->proc_state[i].sync_frame); + ia_css_print("IBUF controller ID %d Process ID %d sync_command 0x%x\n", ID, i, + state->proc_state[i].sync_command); + ia_css_print("IBUF controller ID %d Process ID %d store_command 0x%x\n", ID, i, + state->proc_state[i].store_command); + ia_css_print("IBUF controller ID %d Process ID %d shift_returned_items 0x%x\n", + ID, i, + state->proc_state[i].shift_returned_items); + ia_css_print("IBUF controller ID %d Process ID %d elems_ibuf 0x%x\n", ID, i, + state->proc_state[i].elems_ibuf); + ia_css_print("IBUF controller ID %d Process ID %d elems_dest 0x%x\n", ID, i, + state->proc_state[i].elems_dest); + ia_css_print("IBUF controller ID %d Process ID %d cur_stores 0x%x\n", ID, i, + state->proc_state[i].cur_stores); + ia_css_print("IBUF controller ID %d Process ID %d cur_acks 0x%x\n", ID, i, + state->proc_state[i].cur_acks); + ia_css_print("IBUF controller ID %d Process ID %d cur_s2m_ibuf_addr 0x%x\n", ID, + i, + state->proc_state[i].cur_s2m_ibuf_addr); + ia_css_print("IBUF controller ID %d Process ID %d cur_dma_ibuf_addr 0x%x\n", ID, + i, + state->proc_state[i].cur_dma_ibuf_addr); + ia_css_print("IBUF controller ID %d Process ID %d cur_dma_dest_addr 0x%x\n", ID, + i, + state->proc_state[i].cur_dma_dest_addr); + ia_css_print("IBUF controller ID %d Process ID %d cur_isp_dest_addr 0x%x\n", ID, + i, + state->proc_state[i].cur_isp_dest_addr); + ia_css_print("IBUF controller ID %d Process ID %d dma_cmds_send 0x%x\n", ID, i, + state->proc_state[i].dma_cmds_send); + ia_css_print("IBUF controller ID %d Process ID %d main_cntrl_state 0x%x\n", ID, + i, + state->proc_state[i].main_cntrl_state); + ia_css_print("IBUF controller ID %d Process ID %d dma_sync_state 0x%x\n", ID, i, + state->proc_state[i].dma_sync_state); + ia_css_print("IBUF controller ID %d Process ID %d isp_sync_state 0x%x\n", ID, i, + state->proc_state[i].isp_sync_state); + } +} + +static inline input_system_err_t +input_system_get_state(const input_system_ID_t ID, + input_system_state_t *state) { u32 i; @@ -73,9 +286,8 @@ STORAGE_CLASS_INPUT_SYSTEM_C input_system_err_t input_system_get_state( return INPUT_SYSTEM_ERR_NO_ERROR; } -STORAGE_CLASS_INPUT_SYSTEM_C void input_system_dump_state( - const input_system_ID_t ID, - input_system_state_t *state) +static inline void input_system_dump_state(const input_system_ID_t ID, + input_system_state_t *state) { u32 i; diff --git a/drivers/staging/media/atomisp/pci/isp2401_system_global.h b/drivers/staging/media/atomisp/pci/isp2401_system_global.h deleted file mode 100644 index 27cd2535bab8..000000000000 --- a/drivers/staging/media/atomisp/pci/isp2401_system_global.h +++ /dev/null @@ -1,19 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.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. - */ - -#define HAS_NO_INPUT_FORMATTER -#define USE_INPUT_SYSTEM_VERSION_2401 -#define HAS_INPUT_SYSTEM_VERSION_2401 -#define CSI2P_DISABLE_ISYS2401_ONLINE_MODE diff --git a/drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c b/drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c index 9813014c3fd3..060d38749570 100644 --- a/drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c +++ b/drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c @@ -135,52 +135,30 @@ struct sh_css_binary_sc_requirements { at shading correction. */ }; -/* Get the requirements for the shading correction. */ +/* ISP2400: Get the requirements for the shading correction. */ static int -#ifndef ISP2401 ia_css_binary_compute_shading_table_bayer_origin( const struct ia_css_binary *binary, /* [in] */ unsigned int required_bds_factor, /* [in] */ const struct ia_css_stream_config *stream_config, /* [in] */ struct sh_css_shading_table_bayer_origin_compute_results *res) /* [out] */ -#else -sh_css_binary_get_sc_requirements( - const struct ia_css_binary *binary, /* [in] */ - unsigned int required_bds_factor, /* [in] */ - const struct ia_css_stream_config *stream_config, /* [in] */ - struct sh_css_binary_sc_requirements *scr) /* [out] */ -#endif { int err; -#ifndef ISP2401 /* Numerator and denominator of the fixed bayer downscaling factor. (numerator >= denominator) */ -#else - /* Numerator and denominator of the fixed bayer downscaling factor. (numerator >= denominator) */ -#endif unsigned int bds_num, bds_den; -#ifndef ISP2401 /* Horizontal/Vertical ratio of bayer scaling between input area and output area. */ unsigned int bs_hor_ratio_in; unsigned int bs_hor_ratio_out; unsigned int bs_ver_ratio_in; unsigned int bs_ver_ratio_out; -#else - /* Horizontal/Vertical ratio of bayer scaling between input area and output area. */ - unsigned int bs_hor_ratio_in, bs_hor_ratio_out, bs_ver_ratio_in, bs_ver_ratio_out; -#endif /* Left padding set by InputFormatter. */ -#ifndef ISP2401 unsigned int left_padding_bqs; /* in bqs */ -#else - unsigned int left_padding_bqs; -#endif -#ifndef ISP2401 /* Flag for the NEED_BDS_FACTOR_2_00 macro defined in isp kernels. */ unsigned int need_bds_factor_2_00; @@ -201,7 +179,106 @@ sh_css_binary_get_sc_requirements( err = sh_css_bds_factor_get_numerator_denominator (required_bds_factor, &bds_num, &bds_den); if (err) -#else + return err; + + /* Set the horizontal/vertical ratio of bayer scaling + between input area and output area. */ + bs_hor_ratio_in = bds_num; + bs_hor_ratio_out = bds_den; + bs_ver_ratio_in = bds_num; + bs_ver_ratio_out = bds_den; + + /* Set the left padding set by InputFormatter. (ifmtr.c) */ + if (stream_config->left_padding == -1) + left_padding_bqs = _ISP_BQS(binary->left_padding); + else + left_padding_bqs = (unsigned int)((int)ISP_VEC_NELEMS + - _ISP_BQS(stream_config->left_padding)); + + /* Set the left padding adjusted inside the isp. + When bds_factor 2.00 is needed, some padding is added to left_padding + inside the isp, before bayer downscaling. (raw.isp.c) + (Hopefully, left_crop/left_padding/top_crop should be defined in css + appropriately, depending on bds_factor.) + */ + need_bds_factor_2_00 = ((binary->info->sp.bds.supported_bds_factors & + (PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_2_00) | + PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_2_50) | + PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_3_00) | + PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_4_00) | + PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_4_50) | + PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_5_00) | + PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_6_00) | + PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_8_00))) != 0); + + if (need_bds_factor_2_00 && binary->info->sp.pipeline.left_cropping > 0) + left_padding_adjusted_bqs = left_padding_bqs + ISP_VEC_NELEMS; + else + left_padding_adjusted_bqs = left_padding_bqs; + + /* Currently, the bad pixel caused by filters before bayer scaling + is NOT considered, because the bad pixel is subtle. + When some large filter is used in the future, + we need to consider the bad pixel. + + Currently, when bds_factor isn't 1.00, 3x3 anti-alias filter is applied + to each color plane(Gr/R/B/Gb) before bayer downscaling. + This filter moves each color plane to right/bottom directions + by 1 pixel at the most, depending on downscaling factor. + */ + bad_bqs_on_left_before_bs = 0; + bad_bqs_on_top_before_bs = 0; + + /* Currently, the bad pixel caused by filters after bayer scaling + is NOT considered, because the bad pixel is subtle. + When some large filter is used in the future, + we need to consider the bad pixel. + + Currently, when DPC&BNR is processed between bayer scaling and + shading correction, DPC&BNR moves each color plane to + right/bottom directions by 1 pixel. + */ + bad_bqs_on_left_after_bs = 0; + bad_bqs_on_top_after_bs = 0; + + /* Calculate the origin of bayer (real sensor data area) + located on the shading table during the shading correction. */ + res->sc_bayer_origin_x_bqs_on_shading_table = + ((left_padding_adjusted_bqs + bad_bqs_on_left_before_bs) + * bs_hor_ratio_out + bs_hor_ratio_in / 2) / bs_hor_ratio_in + + bad_bqs_on_left_after_bs; + /* "+ bs_hor_ratio_in/2": rounding for division by bs_hor_ratio_in */ + res->sc_bayer_origin_y_bqs_on_shading_table = + (bad_bqs_on_top_before_bs * bs_ver_ratio_out + bs_ver_ratio_in / 2) / bs_ver_ratio_in + + bad_bqs_on_top_after_bs; + /* "+ bs_ver_ratio_in/2": rounding for division by bs_ver_ratio_in */ + + res->bayer_scale_hor_ratio_in = (uint32_t)bs_hor_ratio_in; + res->bayer_scale_hor_ratio_out = (uint32_t)bs_hor_ratio_out; + res->bayer_scale_ver_ratio_in = (uint32_t)bs_ver_ratio_in; + res->bayer_scale_ver_ratio_out = (uint32_t)bs_ver_ratio_out; + + return err; +} + +/* ISP2401: Get the requirements for the shading correction. */ +static int +sh_css_binary_get_sc_requirements(const struct ia_css_binary *binary, /* [in] */ + unsigned int required_bds_factor, /* [in] */ + const struct ia_css_stream_config *stream_config, /* [in] */ + struct sh_css_binary_sc_requirements *scr) /* [out] */ +{ + int err; + + /* Numerator and denominator of the fixed bayer downscaling factor. (numerator >= denominator) */ + unsigned int bds_num, bds_den; + + /* Horizontal/Vertical ratio of bayer scaling between input area and output area. */ + unsigned int bs_hor_ratio_in, bs_hor_ratio_out, bs_ver_ratio_in, bs_ver_ratio_out; + + /* Left padding set by InputFormatter. */ + unsigned int left_padding_bqs; + /* Flags corresponding to NEED_BDS_FACTOR_2_00/NEED_BDS_FACTOR_1_50/NEED_BDS_FACTOR_1_25 macros * defined in isp kernels. */ unsigned int need_bds_factor_2_00, need_bds_factor_1_50, need_bds_factor_1_25; @@ -225,318 +302,201 @@ sh_css_binary_get_sc_requirements( unsigned int sensor_data_origin_x_bqs_on_internal; unsigned int sensor_data_origin_y_bqs_on_internal; + unsigned int bs_frac = bds_frac_acc; /* scaling factor 1.0 in fixed point */ + unsigned int bs_out, bs_in; /* scaling ratio in fixed point */ + IA_CSS_ENTER_PRIVATE("binary=%p, required_bds_factor=%d, stream_config=%p", binary, required_bds_factor, stream_config); /* Get the numerator and denominator of the required bayer downscaling factor. */ - err = sh_css_bds_factor_get_numerator_denominator(required_bds_factor, &bds_num, &bds_den); - if (err) - { + err = sh_css_bds_factor_get_numerator_denominator(required_bds_factor, + &bds_num, &bds_den); + if (err) { IA_CSS_LEAVE_ERR_PRIVATE(err); -#endif return err; -#ifdef ISP2401 -} -#endif - -#ifndef ISP2401 -/* Set the horizontal/vertical ratio of bayer scaling -between input area and output area. */ -#else -IA_CSS_LOG("bds_num=%d, bds_den=%d", bds_num, bds_den); - -/* Set the horizontal/vertical ratio of bayer scaling between input area and output area. */ -#endif -bs_hor_ratio_in = bds_num; -bs_hor_ratio_out = bds_den; -bs_ver_ratio_in = bds_num; -bs_ver_ratio_out = bds_den; + } -#ifndef ISP2401 -/* Set the left padding set by InputFormatter. (ifmtr.c) */ -#else -/* Set the left padding set by InputFormatter. (ia_css_ifmtr_configure() in ifmtr.c) */ -#endif -if (stream_config->left_padding == -1) - left_padding_bqs = _ISP_BQS(binary->left_padding); -else -#ifndef ISP2401 - left_padding_bqs = (unsigned int)((int)ISP_VEC_NELEMS - - _ISP_BQS(stream_config->left_padding)); -#else - left_padding_bqs = (unsigned int)((int)ISP_VEC_NELEMS - _ISP_BQS(stream_config->left_padding)); -#endif + IA_CSS_LOG("bds_num=%d, bds_den=%d", bds_num, bds_den); -#ifndef ISP2401 -/* Set the left padding adjusted inside the isp. -When bds_factor 2.00 is needed, some padding is added to left_padding -inside the isp, before bayer downscaling. (raw.isp.c) -(Hopefully, left_crop/left_padding/top_crop should be defined in css -appropriately, depending on bds_factor.) -*/ -#else -IA_CSS_LOG("stream.left_padding=%d, binary.left_padding=%d, left_padding_bqs=%d", - stream_config->left_padding, binary->left_padding, left_padding_bqs); + /* Set the horizontal/vertical ratio of bayer scaling between input area and output area. */ + bs_hor_ratio_in = bds_num; + bs_hor_ratio_out = bds_den; + bs_ver_ratio_in = bds_num; + bs_ver_ratio_out = bds_den; -/* Set the left padding adjusted inside the isp kernels. - * When the bds_factor isn't 1.00, the left padding size is adjusted inside the isp, - * before bayer downscaling. (scaled_hor_plane_index(), raw_compute_hphase() in raw.isp.c) - */ -#endif -need_bds_factor_2_00 = ((binary->info->sp.bds.supported_bds_factors & - (PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_2_00) | - PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_2_50) | - PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_3_00) | - PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_4_00) | - PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_4_50) | - PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_5_00) | - PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_6_00) | - PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_8_00))) != 0); + /* Set the left padding set by InputFormatter. (ia_css_ifmtr_configure() in ifmtr.c) */ + if (stream_config->left_padding == -1) + left_padding_bqs = _ISP_BQS(binary->left_padding); + else + left_padding_bqs = (unsigned int)((int)ISP_VEC_NELEMS - _ISP_BQS(stream_config->left_padding)); -#ifndef ISP2401 -if (need_bds_factor_2_00 && binary->info->sp.pipeline.left_cropping > 0) - left_padding_adjusted_bqs = left_padding_bqs + ISP_VEC_NELEMS; -else -#else -need_bds_factor_1_50 = ((binary->info->sp.bds.supported_bds_factors & - (PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_1_50) | - PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_2_25) | - PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_3_00) | - PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_4_50) | - PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_6_00))) != 0); - -need_bds_factor_1_25 = ((binary->info->sp.bds.supported_bds_factors & - (PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_1_25) | - PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_2_50) | - PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_5_00))) != 0); - -if (binary->info->sp.pipeline.left_cropping > 0 && - (need_bds_factor_2_00 || need_bds_factor_1_50 || need_bds_factor_1_25)) -{ - /* - * downscale 2.0 -> first_vec_adjusted_bqs = 128 - * downscale 1.5 -> first_vec_adjusted_bqs = 96 - * downscale 1.25 -> first_vec_adjusted_bqs = 80 - */ - unsigned int first_vec_adjusted_bqs - = ISP_VEC_NELEMS * bs_hor_ratio_in / bs_hor_ratio_out; - left_padding_adjusted_bqs = first_vec_adjusted_bqs - - _ISP_BQS(binary->info->sp.pipeline.left_cropping); -} else -#endif - left_padding_adjusted_bqs = left_padding_bqs; + IA_CSS_LOG("stream.left_padding=%d, binary.left_padding=%d, left_padding_bqs=%d", + stream_config->left_padding, binary->left_padding, + left_padding_bqs); -#ifndef ISP2401 -/* Currently, the bad pixel caused by filters before bayer scaling -is NOT considered, because the bad pixel is subtle. -When some large filter is used in the future, -we need to consider the bad pixel. - -Currently, when bds_factor isn't 1.00, 3x3 anti-alias filter is applied -to each color plane(Gr/R/B/Gb) before bayer downscaling. -This filter moves each color plane to right/bottom directions -by 1 pixel at the most, depending on downscaling factor. -*/ -bad_bqs_on_left_before_bs = 0; -bad_bqs_on_top_before_bs = 0; -#else -IA_CSS_LOG("supported_bds_factors=%d, need_bds_factor:2_00=%d, 1_50=%d, 1_25=%d", - binary->info->sp.bds.supported_bds_factors, - need_bds_factor_2_00, need_bds_factor_1_50, need_bds_factor_1_25); -IA_CSS_LOG("left_cropping=%d, left_padding_adjusted_bqs=%d", - binary->info->sp.pipeline.left_cropping, left_padding_adjusted_bqs); - -/* Set the top padding padded inside the isp kernel for bayer downscaling binaries. - * When the bds_factor isn't 1.00, the top padding is padded inside the isp - * before bayer downscaling, because the top cropping size (input margin) is not enough. - * (calculate_input_line(), raw_compute_vphase(), dma_read_raw() in raw.isp.c) - * NOTE: In dma_read_raw(), the factor passed to raw_compute_vphase() is got by get_bds_factor_for_dma_read(). - * This factor is BDS_FPVAL_100/BDS_FPVAL_125/BDS_FPVAL_150/BDS_FPVAL_200. - */ -top_padding_bqs = 0; -if (binary->info->sp.pipeline.top_cropping > 0 && - (required_bds_factor == SH_CSS_BDS_FACTOR_1_25 || - required_bds_factor == SH_CSS_BDS_FACTOR_1_50 || - required_bds_factor == SH_CSS_BDS_FACTOR_2_00)) -{ - /* Calculation from calculate_input_line() and raw_compute_vphase() in raw.isp.c. */ - int top_cropping_bqs = _ISP_BQS(binary->info->sp.pipeline.top_cropping); - /* top cropping (in bqs) */ - int factor = bds_num * bds_frac_acc / - bds_den; /* downscaling factor by fixed-point */ - int top_padding_bqsxfrac_acc = (top_cropping_bqs * factor - top_cropping_bqs * - bds_frac_acc) - + (2 * bds_frac_acc - factor); /* top padding by fixed-point (in bqs) */ - - top_padding_bqs = (unsigned int)((top_padding_bqsxfrac_acc + bds_frac_acc / 2 - - 1) / bds_frac_acc); -} + /* Set the left padding adjusted inside the isp kernels. + * When the bds_factor isn't 1.00, the left padding size is adjusted inside the isp, + * before bayer downscaling. (scaled_hor_plane_index(), raw_compute_hphase() in raw.isp.c) + */ + need_bds_factor_2_00 = ((binary->info->sp.bds.supported_bds_factors & + (PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_2_00) | + PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_2_50) | + PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_3_00) | + PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_4_00) | + PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_4_50) | + PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_5_00) | + PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_6_00) | + PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_8_00))) != 0); + + need_bds_factor_1_50 = ((binary->info->sp.bds.supported_bds_factors & + (PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_1_50) | + PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_2_25) | + PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_3_00) | + PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_4_50) | + PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_6_00))) != 0); + + need_bds_factor_1_25 = ((binary->info->sp.bds.supported_bds_factors & + (PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_1_25) | + PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_2_50) | + PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_5_00))) != 0); + + if (binary->info->sp.pipeline.left_cropping > 0 && + (need_bds_factor_2_00 || need_bds_factor_1_50 || need_bds_factor_1_25)) { + /* + * downscale 2.0 -> first_vec_adjusted_bqs = 128 + * downscale 1.5 -> first_vec_adjusted_bqs = 96 + * downscale 1.25 -> first_vec_adjusted_bqs = 80 + */ + unsigned int first_vec_adjusted_bqs = ISP_VEC_NELEMS * bs_hor_ratio_in / bs_hor_ratio_out; + left_padding_adjusted_bqs = first_vec_adjusted_bqs + - _ISP_BQS(binary->info->sp.pipeline.left_cropping); + } else { + left_padding_adjusted_bqs = left_padding_bqs; + } -IA_CSS_LOG("top_cropping=%d, top_padding_bqs=%d", binary->info->sp.pipeline.top_cropping, top_padding_bqs); + IA_CSS_LOG("supported_bds_factors=%d, need_bds_factor:2_00=%d, 1_50=%d, 1_25=%d", + binary->info->sp.bds.supported_bds_factors, + need_bds_factor_2_00, need_bds_factor_1_50, + need_bds_factor_1_25); + IA_CSS_LOG("left_cropping=%d, left_padding_adjusted_bqs=%d", + binary->info->sp.pipeline.left_cropping, + left_padding_adjusted_bqs); + + /* Set the top padding padded inside the isp kernel for bayer downscaling binaries. + * When the bds_factor isn't 1.00, the top padding is padded inside the isp + * before bayer downscaling, because the top cropping size (input margin) is not enough. + * (calculate_input_line(), raw_compute_vphase(), dma_read_raw() in raw.isp.c) + * NOTE: In dma_read_raw(), the factor passed to raw_compute_vphase() is got by get_bds_factor_for_dma_read(). + * This factor is BDS_FPVAL_100/BDS_FPVAL_125/BDS_FPVAL_150/BDS_FPVAL_200. + */ + top_padding_bqs = 0; + if (binary->info->sp.pipeline.top_cropping > 0 && + (required_bds_factor == SH_CSS_BDS_FACTOR_1_25 || + required_bds_factor == SH_CSS_BDS_FACTOR_1_50 || + required_bds_factor == SH_CSS_BDS_FACTOR_2_00)) { + /* Calculation from calculate_input_line() and raw_compute_vphase() in raw.isp.c. */ + int top_cropping_bqs = _ISP_BQS(binary->info->sp.pipeline.top_cropping); + /* top cropping (in bqs) */ + int factor = bds_num * bds_frac_acc / + bds_den; /* downscaling factor by fixed-point */ + int top_padding_bqsxfrac_acc = (top_cropping_bqs * factor - top_cropping_bqs * + bds_frac_acc) + + (2 * bds_frac_acc - factor); /* top padding by fixed-point (in bqs) */ + + top_padding_bqs = (unsigned int)((top_padding_bqsxfrac_acc + bds_frac_acc / 2 - + 1) / bds_frac_acc); + } -/* Set the right/down shift amount caused by filters applied BEFORE bayer scaling, - * which scaling is applied BEFORE shading corrertion. - * - * When the bds_factor isn't 1.00, 3x3 anti-alias filter is applied to each color plane(Gr/R/B/Gb) - * before bayer downscaling. - * This filter shifts each color plane (Gr/R/B/Gb) to right/down directions by 1 pixel. - */ -right_shift_bqs_before_bs = 0; -down_shift_bqs_before_bs = 0; -#endif + IA_CSS_LOG("top_cropping=%d, top_padding_bqs=%d", + binary->info->sp.pipeline.top_cropping, top_padding_bqs); -#ifndef ISP2401 -/* Currently, the bad pixel caused by filters after bayer scaling -is NOT considered, because the bad pixel is subtle. -When some large filter is used in the future, -we need to consider the bad pixel. - -Currently, when DPC&BNR is processed between bayer scaling and -shading correction, DPC&BNR moves each color plane to -right/bottom directions by 1 pixel. -*/ -bad_bqs_on_left_after_bs = 0; -bad_bqs_on_top_after_bs = 0; -#else -if (need_bds_factor_2_00 || need_bds_factor_1_50 || need_bds_factor_1_25) -{ - right_shift_bqs_before_bs = 1; - down_shift_bqs_before_bs = 1; -} + /* Set the right/down shift amount caused by filters applied BEFORE bayer scaling, + * which scaling is applied BEFORE shading corrertion. + * + * When the bds_factor isn't 1.00, 3x3 anti-alias filter is applied to each color plane(Gr/R/B/Gb) + * before bayer downscaling. + * This filter shifts each color plane (Gr/R/B/Gb) to right/down directions by 1 pixel. + */ + right_shift_bqs_before_bs = 0; + down_shift_bqs_before_bs = 0; -IA_CSS_LOG("right_shift_bqs_before_bs=%d, down_shift_bqs_before_bs=%d", - right_shift_bqs_before_bs, down_shift_bqs_before_bs); + if (need_bds_factor_2_00 || need_bds_factor_1_50 || need_bds_factor_1_25) { + right_shift_bqs_before_bs = 1; + down_shift_bqs_before_bs = 1; + } -/* Set the right/down shift amount caused by filters applied AFTER bayer scaling, - * which scaling is applied BEFORE shading corrertion. - * - * When DPC&BNR is processed between bayer scaling and shading correction, - * DPC&BNR moves each color plane (Gr/R/B/Gb) to right/down directions by 1 pixel. - */ -right_shift_bqs_after_bs = 0; -down_shift_bqs_after_bs = 0; -#endif + IA_CSS_LOG("right_shift_bqs_before_bs=%d, down_shift_bqs_before_bs=%d", + right_shift_bqs_before_bs, down_shift_bqs_before_bs); -#ifndef ISP2401 -/* Calculate the origin of bayer (real sensor data area) -located on the shading table during the shading correction. */ -res->sc_bayer_origin_x_bqs_on_shading_table -= ((left_padding_adjusted_bqs + bad_bqs_on_left_before_bs) - * bs_hor_ratio_out + bs_hor_ratio_in / 2) / bs_hor_ratio_in -+ bad_bqs_on_left_after_bs; -/* "+ bs_hor_ratio_in/2": rounding for division by bs_hor_ratio_in */ -res->sc_bayer_origin_y_bqs_on_shading_table -= (bad_bqs_on_top_before_bs - * bs_ver_ratio_out + bs_ver_ratio_in / 2) / bs_ver_ratio_in -+ bad_bqs_on_top_after_bs; -/* "+ bs_ver_ratio_in/2": rounding for division by bs_ver_ratio_in */ - -res->bayer_scale_hor_ratio_in = (uint32_t)bs_hor_ratio_in; -res->bayer_scale_hor_ratio_out = (uint32_t)bs_hor_ratio_out; -res->bayer_scale_ver_ratio_in = (uint32_t)bs_ver_ratio_in; -res->bayer_scale_ver_ratio_out = (uint32_t)bs_ver_ratio_out; -#else -if (binary->info->mem_offsets.offsets.param->dmem.dp.size != 0) /* if DPC&BNR is enabled in the binary */ -{ - right_shift_bqs_after_bs = 1; - down_shift_bqs_after_bs = 1; -} + /* Set the right/down shift amount caused by filters applied AFTER bayer scaling, + * which scaling is applied BEFORE shading corrertion. + * + * When DPC&BNR is processed between bayer scaling and shading correction, + * DPC&BNR moves each color plane (Gr/R/B/Gb) to right/down directions by 1 pixel. + */ + right_shift_bqs_after_bs = 0; + down_shift_bqs_after_bs = 0; -IA_CSS_LOG("right_shift_bqs_after_bs=%d, down_shift_bqs_after_bs=%d", - right_shift_bqs_after_bs, down_shift_bqs_after_bs); + /* if DPC&BNR is enabled in the binary */ + if (binary->info->mem_offsets.offsets.param->dmem.dp.size != 0) { + right_shift_bqs_after_bs = 1; + down_shift_bqs_after_bs = 1; + } -/* Set the origin of the sensor data area on the internal frame at shading correction. */ -{ - unsigned int bs_frac = bds_frac_acc; /* scaling factor 1.0 in fixed point */ - unsigned int bs_out, bs_in; /* scaling ratio in fixed point */ + IA_CSS_LOG("right_shift_bqs_after_bs=%d, down_shift_bqs_after_bs=%d", + right_shift_bqs_after_bs, down_shift_bqs_after_bs); bs_out = bs_hor_ratio_out * bs_frac; bs_in = bs_hor_ratio_in * bs_frac; - sensor_data_origin_x_bqs_on_internal - = ((left_padding_adjusted_bqs + right_shift_bqs_before_bs) * bs_out + bs_in / 2) / bs_in - + right_shift_bqs_after_bs; /* "+ bs_in/2": rounding */ + sensor_data_origin_x_bqs_on_internal = + ((left_padding_adjusted_bqs + right_shift_bqs_before_bs) * bs_out + bs_in / 2) / bs_in + + right_shift_bqs_after_bs; /* "+ bs_in/2": rounding */ bs_out = bs_ver_ratio_out * bs_frac; bs_in = bs_ver_ratio_in * bs_frac; - sensor_data_origin_y_bqs_on_internal - = ((top_padding_bqs + down_shift_bqs_before_bs) * bs_out + bs_in / 2) / bs_in - + down_shift_bqs_after_bs; /* "+ bs_in/2": rounding */ -} - -scr->bayer_scale_hor_ratio_in = (uint32_t)bs_hor_ratio_in; -scr->bayer_scale_hor_ratio_out = (uint32_t)bs_hor_ratio_out; -scr->bayer_scale_ver_ratio_in = (uint32_t)bs_ver_ratio_in; -scr->bayer_scale_ver_ratio_out = (uint32_t)bs_ver_ratio_out; -scr->sensor_data_origin_x_bqs_on_internal = (uint32_t)sensor_data_origin_x_bqs_on_internal; -scr->sensor_data_origin_y_bqs_on_internal = (uint32_t)sensor_data_origin_y_bqs_on_internal; - -IA_CSS_LOG("sc_requirements: %d, %d, %d, %d, %d, %d", - scr->bayer_scale_hor_ratio_in, scr->bayer_scale_hor_ratio_out, - scr->bayer_scale_ver_ratio_in, scr->bayer_scale_ver_ratio_out, - scr->sensor_data_origin_x_bqs_on_internal, scr->sensor_data_origin_y_bqs_on_internal); -#endif + sensor_data_origin_y_bqs_on_internal = + ((top_padding_bqs + down_shift_bqs_before_bs) * bs_out + bs_in / 2) / bs_in + + down_shift_bqs_after_bs; /* "+ bs_in/2": rounding */ + + scr->bayer_scale_hor_ratio_in = (uint32_t)bs_hor_ratio_in; + scr->bayer_scale_hor_ratio_out = (uint32_t)bs_hor_ratio_out; + scr->bayer_scale_ver_ratio_in = (uint32_t)bs_ver_ratio_in; + scr->bayer_scale_ver_ratio_out = (uint32_t)bs_ver_ratio_out; + scr->sensor_data_origin_x_bqs_on_internal = (uint32_t)sensor_data_origin_x_bqs_on_internal; + scr->sensor_data_origin_y_bqs_on_internal = (uint32_t)sensor_data_origin_y_bqs_on_internal; + + IA_CSS_LOG("sc_requirements: %d, %d, %d, %d, %d, %d", + scr->bayer_scale_hor_ratio_in, + scr->bayer_scale_hor_ratio_out, + scr->bayer_scale_ver_ratio_in, scr->bayer_scale_ver_ratio_out, + scr->sensor_data_origin_x_bqs_on_internal, + scr->sensor_data_origin_y_bqs_on_internal); -#ifdef ISP2401 -IA_CSS_LEAVE_ERR_PRIVATE(err); -#endif -return err; + IA_CSS_LEAVE_ERR_PRIVATE(err); + return err; } /* Get the shading information of Shading Correction Type 1. */ static int -ia_css_binary_get_shading_info_type_1(const struct ia_css_binary - *binary, /* [in] */ - unsigned int required_bds_factor, /* [in] */ - const struct ia_css_stream_config *stream_config, /* [in] */ -#ifndef ISP2401 - struct ia_css_shading_info *info) /* [out] */ -#else - struct ia_css_shading_info *shading_info, /* [out] */ - struct ia_css_pipe_config *pipe_config) /* [out] */ -#endif +isp2400_binary_get_shading_info_type_1(const struct ia_css_binary *binary, /* [in] */ + unsigned int required_bds_factor, /* [in] */ + const struct ia_css_stream_config *stream_config, /* [in] */ + struct ia_css_shading_info *info) /* [out] */ { int err; -#ifndef ISP2401 struct sh_css_shading_table_bayer_origin_compute_results res; -#else - struct sh_css_binary_sc_requirements scr; -#endif -#ifndef ISP2401 assert(binary); assert(info); -#else - u32 in_width_bqs, in_height_bqs, internal_width_bqs, internal_height_bqs; - u32 num_hor_grids, num_ver_grids, bqs_per_grid_cell, tbl_width_bqs, tbl_height_bqs; - u32 sensor_org_x_bqs_on_internal, sensor_org_y_bqs_on_internal, sensor_width_bqs, sensor_height_bqs; - u32 sensor_center_x_bqs_on_internal, sensor_center_y_bqs_on_internal; - u32 left, right, upper, lower; - u32 adjust_left, adjust_right, adjust_upper, adjust_lower, adjust_width_bqs, adjust_height_bqs; - u32 internal_org_x_bqs_on_tbl, internal_org_y_bqs_on_tbl; - u32 sensor_org_x_bqs_on_tbl, sensor_org_y_bqs_on_tbl; -#endif -#ifndef ISP2401 info->type = IA_CSS_SHADING_CORRECTION_TYPE_1; -#else - assert(binary); - assert(stream_config); - assert(shading_info); - assert(pipe_config); -#endif -#ifndef ISP2401 info->info.type_1.enable = binary->info->sp.enable.sc; info->info.type_1.num_hor_grids = binary->sctbl_width_per_color; info->info.type_1.num_ver_grids = binary->sctbl_height; info->info.type_1.bqs_per_grid_cell = (1 << binary->deci_factor_log2); -#else - IA_CSS_ENTER_PRIVATE("binary=%p, required_bds_factor=%d, stream_config=%p", - binary, required_bds_factor, stream_config); -#endif /* Initialize by default values. */ -#ifndef ISP2401 info->info.type_1.bayer_scale_hor_ratio_in = 1; info->info.type_1.bayer_scale_hor_ratio_out = 1; info->info.type_1.bayer_scale_ver_ratio_in = 1; @@ -550,158 +510,186 @@ ia_css_binary_get_shading_info_type_1(const struct ia_css_binary stream_config, &res); if (err) -#else + return err; + + info->info.type_1.bayer_scale_hor_ratio_in = res.bayer_scale_hor_ratio_in; + info->info.type_1.bayer_scale_hor_ratio_out = res.bayer_scale_hor_ratio_out; + info->info.type_1.bayer_scale_ver_ratio_in = res.bayer_scale_ver_ratio_in; + info->info.type_1.bayer_scale_ver_ratio_out = res.bayer_scale_ver_ratio_out; + info->info.type_1.sc_bayer_origin_x_bqs_on_shading_table = res.sc_bayer_origin_x_bqs_on_shading_table; + info->info.type_1.sc_bayer_origin_y_bqs_on_shading_table = res.sc_bayer_origin_y_bqs_on_shading_table; + + return err; +} + +/* Get the shading information of Shading Correction Type 1. */ +static int +isp2401_binary_get_shading_info_type_1(const struct ia_css_binary *binary, /* [in] */ + unsigned int required_bds_factor, /* [in] */ + const struct ia_css_stream_config *stream_config, /* [in] */ + struct ia_css_shading_info *shading_info, /* [out] */ + struct ia_css_pipe_config *pipe_config) /* [out] */ +{ + int err; + struct sh_css_binary_sc_requirements scr; + + u32 in_width_bqs, in_height_bqs, internal_width_bqs, internal_height_bqs; + u32 num_hor_grids, num_ver_grids, bqs_per_grid_cell, tbl_width_bqs, tbl_height_bqs; + u32 sensor_org_x_bqs_on_internal, sensor_org_y_bqs_on_internal, sensor_width_bqs, sensor_height_bqs; + u32 sensor_center_x_bqs_on_internal, sensor_center_y_bqs_on_internal; + u32 left, right, upper, lower; + u32 adjust_left, adjust_right, adjust_upper, adjust_lower, adjust_width_bqs, adjust_height_bqs; + u32 internal_org_x_bqs_on_tbl, internal_org_y_bqs_on_tbl; + u32 sensor_org_x_bqs_on_tbl, sensor_org_y_bqs_on_tbl; + + assert(binary); + assert(stream_config); + assert(shading_info); + assert(pipe_config); + + IA_CSS_ENTER_PRIVATE("binary=%p, required_bds_factor=%d, stream_config=%p", + binary, required_bds_factor, stream_config); + + /* Initialize by default values. */ *shading_info = DEFAULT_SHADING_INFO_TYPE_1; err = sh_css_binary_get_sc_requirements(binary, required_bds_factor, stream_config, &scr); - if (err) - { + if (err) { IA_CSS_LEAVE_ERR_PRIVATE(err); -#endif return err; -#ifdef ISP2401 -} + } -IA_CSS_LOG("binary: id=%d, sctbl=%dx%d, deci=%d", - binary->info->sp.id, binary->sctbl_width_per_color, binary->sctbl_height, binary->deci_factor_log2); -IA_CSS_LOG("binary: in=%dx%d, in_padded_w=%d, int=%dx%d, int_padded_w=%d, out=%dx%d, out_padded_w=%d", - binary->in_frame_info.res.width, binary->in_frame_info.res.height, binary->in_frame_info.padded_width, - binary->internal_frame_info.res.width, binary->internal_frame_info.res.height, - binary->internal_frame_info.padded_width, - binary->out_frame_info[0].res.width, binary->out_frame_info[0].res.height, - binary->out_frame_info[0].padded_width); - -/* Set the input size from sensor, which includes left/top crop size. */ -in_width_bqs = _ISP_BQS(binary->in_frame_info.res.width); -in_height_bqs = _ISP_BQS(binary->in_frame_info.res.height); - -/* Frame size internally used in ISP, including sensor data and padding. - * This is the frame size, to which the shading correction is applied. - */ -internal_width_bqs = _ISP_BQS(binary->internal_frame_info.res.width); -internal_height_bqs = _ISP_BQS(binary->internal_frame_info.res.height); - -/* Shading table. */ -num_hor_grids = binary->sctbl_width_per_color; -num_ver_grids = binary->sctbl_height; -bqs_per_grid_cell = (1 << binary->deci_factor_log2); -tbl_width_bqs = (num_hor_grids - 1) * bqs_per_grid_cell; -tbl_height_bqs = (num_ver_grids - 1) * bqs_per_grid_cell; -#endif + IA_CSS_LOG("binary: id=%d, sctbl=%dx%d, deci=%d", + binary->info->sp.id, binary->sctbl_width_per_color, binary->sctbl_height, binary->deci_factor_log2); + IA_CSS_LOG("binary: in=%dx%d, in_padded_w=%d, int=%dx%d, int_padded_w=%d, out=%dx%d, out_padded_w=%d", + binary->in_frame_info.res.width, binary->in_frame_info.res.height, binary->in_frame_info.padded_width, + binary->internal_frame_info.res.width, binary->internal_frame_info.res.height, + binary->internal_frame_info.padded_width, + binary->out_frame_info[0].res.width, binary->out_frame_info[0].res.height, + binary->out_frame_info[0].padded_width); -#ifndef ISP2401 -info->info.type_1.bayer_scale_hor_ratio_in = res.bayer_scale_hor_ratio_in; -info->info.type_1.bayer_scale_hor_ratio_out = res.bayer_scale_hor_ratio_out; -info->info.type_1.bayer_scale_ver_ratio_in = res.bayer_scale_ver_ratio_in; -info->info.type_1.bayer_scale_ver_ratio_out = res.bayer_scale_ver_ratio_out; -info->info.type_1.sc_bayer_origin_x_bqs_on_shading_table = res.sc_bayer_origin_x_bqs_on_shading_table; -info->info.type_1.sc_bayer_origin_y_bqs_on_shading_table = res.sc_bayer_origin_y_bqs_on_shading_table; -#else -IA_CSS_LOG("tbl_width_bqs=%d, tbl_height_bqs=%d", tbl_width_bqs, tbl_height_bqs); -#endif + /* Set the input size from sensor, which includes left/top crop size. */ + in_width_bqs = _ISP_BQS(binary->in_frame_info.res.width); + in_height_bqs = _ISP_BQS(binary->in_frame_info.res.height); -#ifdef ISP2401 -/* Real sensor data area on the internal frame at shading correction. - * Filters and scaling are applied to the internal frame before shading correction, depending on the binary. - */ -sensor_org_x_bqs_on_internal = scr.sensor_data_origin_x_bqs_on_internal; -sensor_org_y_bqs_on_internal = scr.sensor_data_origin_y_bqs_on_internal; -{ - unsigned int bs_frac = 8; /* scaling factor 1.0 in fixed point (8 == FRAC_ACC macro in ISP) */ - unsigned int bs_out, bs_in; /* scaling ratio in fixed point */ + /* + * Frame size internally used in ISP, including sensor data and padding. + * This is the frame size, to which the shading correction is applied. + */ + internal_width_bqs = _ISP_BQS(binary->internal_frame_info.res.width); + internal_height_bqs = _ISP_BQS(binary->internal_frame_info.res.height); - bs_out = scr.bayer_scale_hor_ratio_out * bs_frac; - bs_in = scr.bayer_scale_hor_ratio_in * bs_frac; - sensor_width_bqs = (in_width_bqs * bs_out + bs_in / 2) / bs_in; /* "+ bs_in/2": rounding */ + /* Shading table. */ + num_hor_grids = binary->sctbl_width_per_color; + num_ver_grids = binary->sctbl_height; + bqs_per_grid_cell = (1 << binary->deci_factor_log2); + tbl_width_bqs = (num_hor_grids - 1) * bqs_per_grid_cell; + tbl_height_bqs = (num_ver_grids - 1) * bqs_per_grid_cell; - bs_out = scr.bayer_scale_ver_ratio_out * bs_frac; - bs_in = scr.bayer_scale_ver_ratio_in * bs_frac; - sensor_height_bqs = (in_height_bqs * bs_out + bs_in / 2) / bs_in; /* "+ bs_in/2": rounding */ -} + IA_CSS_LOG("tbl_width_bqs=%d, tbl_height_bqs=%d", tbl_width_bqs, tbl_height_bqs); + + /* + * Real sensor data area on the internal frame at shading correction. + * Filters and scaling are applied to the internal frame before + * shading correction, depending on the binary. + */ + sensor_org_x_bqs_on_internal = scr.sensor_data_origin_x_bqs_on_internal; + sensor_org_y_bqs_on_internal = scr.sensor_data_origin_y_bqs_on_internal; + { + unsigned int bs_frac = 8; /* scaling factor 1.0 in fixed point (8 == FRAC_ACC macro in ISP) */ + unsigned int bs_out, bs_in; /* scaling ratio in fixed point */ -/* Center of the sensor data on the internal frame at shading correction. */ -sensor_center_x_bqs_on_internal = sensor_org_x_bqs_on_internal + sensor_width_bqs / 2; -sensor_center_y_bqs_on_internal = sensor_org_y_bqs_on_internal + sensor_height_bqs / 2; + bs_out = scr.bayer_scale_hor_ratio_out * bs_frac; + bs_in = scr.bayer_scale_hor_ratio_in * bs_frac; + sensor_width_bqs = (in_width_bqs * bs_out + bs_in / 2) / bs_in; /* "+ bs_in/2": rounding */ -/* Size of left/right/upper/lower sides of the sensor center on the internal frame. */ -left = sensor_center_x_bqs_on_internal; -right = internal_width_bqs - sensor_center_x_bqs_on_internal; -upper = sensor_center_y_bqs_on_internal; -lower = internal_height_bqs - sensor_center_y_bqs_on_internal; + bs_out = scr.bayer_scale_ver_ratio_out * bs_frac; + bs_in = scr.bayer_scale_ver_ratio_in * bs_frac; + sensor_height_bqs = (in_height_bqs * bs_out + bs_in / 2) / bs_in; /* "+ bs_in/2": rounding */ + } -/* Align the size of left/right/upper/lower sides to a multiple of the grid cell size. */ -adjust_left = CEIL_MUL(left, bqs_per_grid_cell); -adjust_right = CEIL_MUL(right, bqs_per_grid_cell); -adjust_upper = CEIL_MUL(upper, bqs_per_grid_cell); -adjust_lower = CEIL_MUL(lower, bqs_per_grid_cell); + /* Center of the sensor data on the internal frame at shading correction. */ + sensor_center_x_bqs_on_internal = sensor_org_x_bqs_on_internal + sensor_width_bqs / 2; + sensor_center_y_bqs_on_internal = sensor_org_y_bqs_on_internal + sensor_height_bqs / 2; -/* Shading table should cover the adjusted frame size. */ -adjust_width_bqs = adjust_left + adjust_right; -adjust_height_bqs = adjust_upper + adjust_lower; + /* Size of left/right/upper/lower sides of the sensor center on the internal frame. */ + left = sensor_center_x_bqs_on_internal; + right = internal_width_bqs - sensor_center_x_bqs_on_internal; + upper = sensor_center_y_bqs_on_internal; + lower = internal_height_bqs - sensor_center_y_bqs_on_internal; -IA_CSS_LOG("adjust_width_bqs=%d, adjust_height_bqs=%d", adjust_width_bqs, adjust_height_bqs); + /* Align the size of left/right/upper/lower sides to a multiple of the grid cell size. */ + adjust_left = CEIL_MUL(left, bqs_per_grid_cell); + adjust_right = CEIL_MUL(right, bqs_per_grid_cell); + adjust_upper = CEIL_MUL(upper, bqs_per_grid_cell); + adjust_lower = CEIL_MUL(lower, bqs_per_grid_cell); -if (adjust_width_bqs > tbl_width_bqs || adjust_height_bqs > tbl_height_bqs) -{ - IA_CSS_LEAVE_ERR_PRIVATE(-EINVAL); - return -EINVAL; -} + /* Shading table should cover the adjusted frame size. */ + adjust_width_bqs = adjust_left + adjust_right; + adjust_height_bqs = adjust_upper + adjust_lower; -/* Origin of the internal frame on the shading table. */ -internal_org_x_bqs_on_tbl = adjust_left - left; -internal_org_y_bqs_on_tbl = adjust_upper - upper; - -/* Origin of the real sensor data area on the shading table. */ -sensor_org_x_bqs_on_tbl = internal_org_x_bqs_on_tbl + sensor_org_x_bqs_on_internal; -sensor_org_y_bqs_on_tbl = internal_org_y_bqs_on_tbl + sensor_org_y_bqs_on_internal; - -/* The shading information necessary as API is stored in the shading_info. */ -shading_info->info.type_1.num_hor_grids = num_hor_grids; -shading_info->info.type_1.num_ver_grids = num_ver_grids; -shading_info->info.type_1.bqs_per_grid_cell = bqs_per_grid_cell; - -shading_info->info.type_1.bayer_scale_hor_ratio_in = scr.bayer_scale_hor_ratio_in; -shading_info->info.type_1.bayer_scale_hor_ratio_out = scr.bayer_scale_hor_ratio_out; -shading_info->info.type_1.bayer_scale_ver_ratio_in = scr.bayer_scale_ver_ratio_in; -shading_info->info.type_1.bayer_scale_ver_ratio_out = scr.bayer_scale_ver_ratio_out; - -shading_info->info.type_1.isp_input_sensor_data_res_bqs.width = in_width_bqs; -shading_info->info.type_1.isp_input_sensor_data_res_bqs.height = in_height_bqs; - -shading_info->info.type_1.sensor_data_res_bqs.width = sensor_width_bqs; -shading_info->info.type_1.sensor_data_res_bqs.height = sensor_height_bqs; - -shading_info->info.type_1.sensor_data_origin_bqs_on_sctbl.x = (int32_t)sensor_org_x_bqs_on_tbl; -shading_info->info.type_1.sensor_data_origin_bqs_on_sctbl.y = (int32_t)sensor_org_y_bqs_on_tbl; - -/* The shading information related to ISP (but, not necessary as API) is stored in the pipe_config. */ -pipe_config->internal_frame_origin_bqs_on_sctbl.x = (int32_t)internal_org_x_bqs_on_tbl; -pipe_config->internal_frame_origin_bqs_on_sctbl.y = (int32_t)internal_org_y_bqs_on_tbl; - -IA_CSS_LOG("shading_info: grids=%dx%d, cell=%d, scale=%d,%d,%d,%d, input=%dx%d, data=%dx%d, origin=(%d,%d)", - shading_info->info.type_1.num_hor_grids, - shading_info->info.type_1.num_ver_grids, - shading_info->info.type_1.bqs_per_grid_cell, - shading_info->info.type_1.bayer_scale_hor_ratio_in, - shading_info->info.type_1.bayer_scale_hor_ratio_out, - shading_info->info.type_1.bayer_scale_ver_ratio_in, - shading_info->info.type_1.bayer_scale_ver_ratio_out, - shading_info->info.type_1.isp_input_sensor_data_res_bqs.width, - shading_info->info.type_1.isp_input_sensor_data_res_bqs.height, - shading_info->info.type_1.sensor_data_res_bqs.width, - shading_info->info.type_1.sensor_data_res_bqs.height, - shading_info->info.type_1.sensor_data_origin_bqs_on_sctbl.x, - shading_info->info.type_1.sensor_data_origin_bqs_on_sctbl.y); - -IA_CSS_LOG("pipe_config: origin=(%d,%d)", - pipe_config->internal_frame_origin_bqs_on_sctbl.x, - pipe_config->internal_frame_origin_bqs_on_sctbl.y); - -IA_CSS_LEAVE_ERR_PRIVATE(err); -#endif -return err; + IA_CSS_LOG("adjust_width_bqs=%d, adjust_height_bqs=%d", adjust_width_bqs, adjust_height_bqs); + + if (adjust_width_bqs > tbl_width_bqs || adjust_height_bqs > tbl_height_bqs) { + IA_CSS_LEAVE_ERR_PRIVATE(-EINVAL); + return -EINVAL; + } + + /* Origin of the internal frame on the shading table. */ + internal_org_x_bqs_on_tbl = adjust_left - left; + internal_org_y_bqs_on_tbl = adjust_upper - upper; + + /* Origin of the real sensor data area on the shading table. */ + sensor_org_x_bqs_on_tbl = internal_org_x_bqs_on_tbl + sensor_org_x_bqs_on_internal; + sensor_org_y_bqs_on_tbl = internal_org_y_bqs_on_tbl + sensor_org_y_bqs_on_internal; + + /* The shading information necessary as API is stored in the shading_info. */ + shading_info->info.type_1.num_hor_grids = num_hor_grids; + shading_info->info.type_1.num_ver_grids = num_ver_grids; + shading_info->info.type_1.bqs_per_grid_cell = bqs_per_grid_cell; + + shading_info->info.type_1.bayer_scale_hor_ratio_in = scr.bayer_scale_hor_ratio_in; + shading_info->info.type_1.bayer_scale_hor_ratio_out = scr.bayer_scale_hor_ratio_out; + shading_info->info.type_1.bayer_scale_ver_ratio_in = scr.bayer_scale_ver_ratio_in; + shading_info->info.type_1.bayer_scale_ver_ratio_out = scr.bayer_scale_ver_ratio_out; + + shading_info->info.type_1.isp_input_sensor_data_res_bqs.width = in_width_bqs; + shading_info->info.type_1.isp_input_sensor_data_res_bqs.height = in_height_bqs; + + shading_info->info.type_1.sensor_data_res_bqs.width = sensor_width_bqs; + shading_info->info.type_1.sensor_data_res_bqs.height = sensor_height_bqs; + + shading_info->info.type_1.sensor_data_origin_bqs_on_sctbl.x = (int32_t)sensor_org_x_bqs_on_tbl; + shading_info->info.type_1.sensor_data_origin_bqs_on_sctbl.y = (int32_t)sensor_org_y_bqs_on_tbl; + + /* The shading information related to ISP (but, not necessary as API) is stored in the pipe_config. */ + pipe_config->internal_frame_origin_bqs_on_sctbl.x = (int32_t)internal_org_x_bqs_on_tbl; + pipe_config->internal_frame_origin_bqs_on_sctbl.y = (int32_t)internal_org_y_bqs_on_tbl; + + IA_CSS_LOG("shading_info: grids=%dx%d, cell=%d, scale=%d,%d,%d,%d, input=%dx%d, data=%dx%d, origin=(%d,%d)", + shading_info->info.type_1.num_hor_grids, + shading_info->info.type_1.num_ver_grids, + shading_info->info.type_1.bqs_per_grid_cell, + shading_info->info.type_1.bayer_scale_hor_ratio_in, + shading_info->info.type_1.bayer_scale_hor_ratio_out, + shading_info->info.type_1.bayer_scale_ver_ratio_in, + shading_info->info.type_1.bayer_scale_ver_ratio_out, + shading_info->info.type_1.isp_input_sensor_data_res_bqs.width, + shading_info->info.type_1.isp_input_sensor_data_res_bqs.height, + shading_info->info.type_1.sensor_data_res_bqs.width, + shading_info->info.type_1.sensor_data_res_bqs.height, + shading_info->info.type_1.sensor_data_origin_bqs_on_sctbl.x, + shading_info->info.type_1.sensor_data_origin_bqs_on_sctbl.y); + + IA_CSS_LOG("pipe_config: origin=(%d,%d)", + pipe_config->internal_frame_origin_bqs_on_sctbl.x, + pipe_config->internal_frame_origin_bqs_on_sctbl.y); + + IA_CSS_LEAVE_ERR_PRIVATE(err); + return err; } + int ia_css_binary_get_shading_info(const struct ia_css_binary *binary, /* [in] */ enum ia_css_shading_correction_type type, /* [in] */ @@ -718,19 +706,24 @@ ia_css_binary_get_shading_info(const struct ia_css_binary *binary, /* [in] */ IA_CSS_ENTER_PRIVATE("binary=%p, type=%d, required_bds_factor=%d, stream_config=%p", binary, type, required_bds_factor, stream_config); - if (type == IA_CSS_SHADING_CORRECTION_TYPE_1) -#ifndef ISP2401 - err = ia_css_binary_get_shading_info_type_1(binary, required_bds_factor, stream_config, - shading_info); -#else - err = ia_css_binary_get_shading_info_type_1(binary, required_bds_factor, stream_config, - shading_info, pipe_config); -#endif + if (type != IA_CSS_SHADING_CORRECTION_TYPE_1) { + err = -ENOTSUPP; - /* Other function calls can be added here when other shading correction types will be added in the future. */ + IA_CSS_LEAVE_ERR_PRIVATE(err); + return err; + } + if (!IS_ISP2401) + err = isp2400_binary_get_shading_info_type_1(binary, + required_bds_factor, + stream_config, + shading_info); else - err = -ENOTSUPP; + err = isp2401_binary_get_shading_info_type_1(binary, + required_bds_factor, + stream_config, + shading_info, + pipe_config); IA_CSS_LEAVE_ERR_PRIVATE(err); return err; @@ -1045,7 +1038,7 @@ binary_in_frame_padded_width(int in_frame_width, int rval; int nr_of_left_paddings; /* number of paddings pixels on the left of an image line */ -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) /* the output image line of Input System 2401 does not have the left paddings */ nr_of_left_paddings = 0; #else diff --git a/drivers/staging/media/atomisp/pci/runtime/bufq/interface/ia_css_bufq_comm.h b/drivers/staging/media/atomisp/pci/runtime/bufq/interface/ia_css_bufq_comm.h index cddf5882b76a..567d94d91e3c 100644 --- a/drivers/staging/media/atomisp/pci/runtime/bufq/interface/ia_css_bufq_comm.h +++ b/drivers/staging/media/atomisp/pci/runtime/bufq/interface/ia_css_bufq_comm.h @@ -27,19 +27,9 @@ enum sh_css_queue_id { SH_CSS_QUEUE_E_ID, SH_CSS_QUEUE_F_ID, SH_CSS_QUEUE_G_ID, -#if defined(HAS_NO_INPUT_SYSTEM) - /* input frame queue for skycam */ - SH_CSS_QUEUE_H_ID, -#endif -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) SH_CSS_QUEUE_H_ID, /* for metadata */ -#endif -#if defined(HAS_NO_INPUT_SYSTEM) || defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) #define SH_CSS_MAX_NUM_QUEUES (SH_CSS_QUEUE_H_ID + 1) -#else -#define SH_CSS_MAX_NUM_QUEUES (SH_CSS_QUEUE_G_ID + 1) -#endif }; diff --git a/drivers/staging/media/atomisp/pci/runtime/bufq/src/bufq.c b/drivers/staging/media/atomisp/pci/runtime/bufq/src/bufq.c index 38e85735293b..6a75cba4886f 100644 --- a/drivers/staging/media/atomisp/pci/runtime/bufq/src/bufq.c +++ b/drivers/staging/media/atomisp/pci/runtime/bufq/src/bufq.c @@ -47,13 +47,11 @@ struct sh_css_queues { /* SP2Host event queue */ ia_css_queue_t sp2host_psys_event_queue_handle; -#if !defined(HAS_NO_INPUT_SYSTEM) /* Host2SP ISYS event queue */ ia_css_queue_t host2sp_isys_event_queue_handle; /* SP2Host ISYS event queue */ ia_css_queue_t sp2host_isys_event_queue_handle; -#endif /* Tagger command queue */ ia_css_queue_t host2sp_tag_cmd_queue_handle; }; @@ -231,14 +229,12 @@ static ia_css_queue_t *bufq_get_qhandle( case sh_css_sp2host_psys_event_queue: q = &css_queues.sp2host_psys_event_queue_handle; break; -#if !defined(HAS_NO_INPUT_SYSTEM) case sh_css_host2sp_isys_event_queue: q = &css_queues.host2sp_isys_event_queue_handle; break; case sh_css_sp2host_isys_event_queue: q = &css_queues.sp2host_isys_event_queue_handle; break; -#endif case sh_css_host2sp_tag_cmd_queue: q = &css_queues.host2sp_tag_cmd_queue_handle; break; @@ -307,7 +303,6 @@ void ia_css_bufq_init(void) (uint32_t)offsetof(struct host_sp_queues, sp2host_psys_event_queue_elems), &css_queues.sp2host_psys_event_queue_handle); -#if !defined(HAS_NO_INPUT_SYSTEM) /* Host2SP ISYS event queue */ init_bufq((uint32_t)offsetof(struct host_sp_queues, host2sp_isys_event_queue_desc), @@ -324,7 +319,6 @@ void ia_css_bufq_init(void) init_bufq((uint32_t)offsetof(struct host_sp_queues, host2sp_tag_cmd_queue_desc), (uint32_t)offsetof(struct host_sp_queues, host2sp_tag_cmd_queue_elems), &css_queues.host2sp_tag_cmd_queue_handle); -#endif IA_CSS_LEAVE_PRIVATE(""); } @@ -391,8 +385,7 @@ int ia_css_bufq_enqueue_psys_event( u8 evt_payload_1, uint8_t evt_payload_2) { - - int error = 0; + int error = 0; ia_css_queue_t *q; IA_CSS_ENTER_PRIVATE("evt_id=%d", evt_id); @@ -434,7 +427,6 @@ int ia_css_bufq_dequeue_psys_event( int ia_css_bufq_dequeue_isys_event( u8 item[BUFQ_EVENT_SIZE]) { -#if !defined(HAS_NO_INPUT_SYSTEM) int error = 0; ia_css_queue_t *q; @@ -451,15 +443,10 @@ int ia_css_bufq_dequeue_isys_event( } error = ia_css_eventq_recv(q, item); return error; -#else - (void)item; - return -EBUSY; -#endif } int ia_css_bufq_enqueue_isys_event(uint8_t evt_id) { -#if !defined(HAS_NO_INPUT_SYSTEM) int error = 0; ia_css_queue_t *q; @@ -474,16 +461,11 @@ int ia_css_bufq_enqueue_isys_event(uint8_t evt_id) IA_CSS_LEAVE_ERR_PRIVATE(error); return error; -#else - (void)evt_id; - return -EBUSY; -#endif } int ia_css_bufq_enqueue_tag_cmd( uint32_t item) { -#if !defined(HAS_NO_INPUT_SYSTEM) int error; ia_css_queue_t *q; @@ -497,10 +479,6 @@ int ia_css_bufq_enqueue_tag_cmd( IA_CSS_LEAVE_ERR_PRIVATE(error); return error; -#else - (void)item; - return -EBUSY; -#endif } int ia_css_bufq_deinit(void) @@ -545,12 +523,10 @@ void ia_css_bufq_dump_queue_info(void) bufq_dump_queue_info("sp2host_psys_event", &css_queues.sp2host_psys_event_queue_handle); -#if !defined(HAS_NO_INPUT_SYSTEM) bufq_dump_queue_info("host2sp_isys_event", &css_queues.host2sp_isys_event_queue_handle); bufq_dump_queue_info("sp2host_isys_event", &css_queues.sp2host_isys_event_queue_handle); bufq_dump_queue_info("host2sp_tag_cmd", &css_queues.host2sp_tag_cmd_queue_handle); -#endif } diff --git a/drivers/staging/media/atomisp/pci/runtime/debug/interface/ia_css_debug.h b/drivers/staging/media/atomisp/pci/runtime/debug/interface/ia_css_debug.h index e04d2485ea75..5e6e7447ae00 100644 --- a/drivers/staging/media/atomisp/pci/runtime/debug/interface/ia_css_debug.h +++ b/drivers/staging/media/atomisp/pci/runtime/debug/interface/ia_css_debug.h @@ -129,15 +129,16 @@ enum ia_css_debug_enable_param_dump { * @param[in] fmt printf like format string * @param[in] args arguments for the format string */ -static inline void -ia_css_debug_vdtrace(unsigned int level, const char *fmt, va_list args) +static inline void __printf(2, 0) ia_css_debug_vdtrace(unsigned int level, + const char *fmt, + va_list args) { if (dbg_level >= level) sh_css_vprint(fmt, args); } -__printf(2, 3) -void ia_css_debug_dtrace(unsigned int level, const char *fmt, ...); +__printf(2, 3) void ia_css_debug_dtrace(unsigned int level, + const char *fmt, ...); /*! @brief Dump sp thread's stack contents * SP thread's stack contents are set to 0xcafecafe. This function dumps the @@ -158,12 +159,6 @@ void ia_css_debug_set_dtrace_level( */ unsigned int ia_css_debug_get_dtrace_level(void); -/*! @brief Dump input formatter state. - * Dumps the input formatter state to tracing output. - * @return None - */ -void ia_css_debug_dump_if_state(void); - /*! @brief Dump isp hardware state. * Dumps the isp hardware state to tracing output. * @return None diff --git a/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c b/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c index 2bca27a04b02..05ce0f73f5ae 100644 --- a/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c +++ b/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c @@ -52,9 +52,7 @@ #include "fifo_monitor.h" -#if !defined(HAS_NO_INPUT_FORMATTER) #include "input_formatter.h" -#endif #include "dma.h" #include "irq.h" #include "gp_device.h" @@ -62,17 +60,11 @@ #include "isp.h" #include "type_support.h" #include "math_support.h" /* CEIL_DIV */ -#if defined(HAS_INPUT_FORMATTER_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) #include "input_system.h" /* input_formatter_reg_load */ -#endif -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) #include "ia_css_tagger_common.h" -#endif #include "sh_css_internal.h" -#if !defined(HAS_NO_INPUT_SYSTEM) #include "ia_css_isys.h" -#endif #include "sh_css_sp.h" /* sh_css_sp_get_debug_state() */ #include "css_trace.h" /* tracer */ @@ -109,17 +101,6 @@ #define ENABLE_LINE_MAX_LENGTH (25) -#ifdef ISP2401 -#define DBG_EXT_CMD_TRACE_PNTS_DUMP BIT(8) -#define DBG_EXT_CMD_PUB_CFG_DUMP BIT(9) -#define DBG_EXT_CMD_GAC_REG_DUMP BIT(10) -#define DBG_EXT_CMD_GAC_ACB_REG_DUMP BIT(11) -#define DBG_EXT_CMD_FIFO_DUMP BIT(12) -#define DBG_EXT_CMD_QUEUE_DUMP BIT(13) -#define DBG_EXT_CMD_DMA_DUMP BIT(14) -#define DBG_EXT_CMD_MASK 0xAB0000CD - -#endif /* * TODO:SH_CSS_MAX_SP_THREADS is not the max number of sp threads * future rework should fix this and remove the define MAX_THREAD_NUM @@ -453,23 +434,21 @@ void ia_css_debug_dump_isp_state(void) debug_print_isp_state(&state, "ISP"); if (state.is_stalling) { -#if !defined(HAS_NO_INPUT_FORMATTER) - ia_css_debug_dtrace(2, "\t%-32s: %d\n", - "[0] if_prim_a_FIFO stalled", stall.fifo0); - ia_css_debug_dtrace(2, "\t%-32s: %d\n", - "[1] if_prim_b_FIFO stalled", stall.fifo1); -#endif + if (!IS_ISP2401) { + ia_css_debug_dtrace(2, "\t%-32s: %d\n", + "[0] if_prim_a_FIFO stalled", stall.fifo0); + ia_css_debug_dtrace(2, "\t%-32s: %d\n", + "[1] if_prim_b_FIFO stalled", stall.fifo1); + } ia_css_debug_dtrace(2, "\t%-32s: %d\n", "[2] dma_FIFO stalled", stall.fifo2); ia_css_debug_dtrace(2, "\t%-32s: %d\n", "[3] gdc0_FIFO stalled", stall.fifo3); -#if !defined(IS_ISP_2500_SYSTEM) ia_css_debug_dtrace(2, "\t%-32s: %d\n", "[4] gdc1_FIFO stalled", stall.fifo4); ia_css_debug_dtrace(2, "\t%-32s: %d\n", "[5] gpio_FIFO stalled", stall.fifo5); -#endif ia_css_debug_dtrace(2, "\t%-32s: %d\n", "[6] sp_FIFO stalled", stall.fifo6); ia_css_debug_dtrace(2, "\t%-32s: %d\n", @@ -501,34 +480,29 @@ void ia_css_debug_dump_sp_state(void) sp_get_state(SP0_ID, &state, &stall); debug_print_sp_state(&state, "SP"); if (state.is_stalling) { -#if !defined(HAS_NO_INPUT_SYSTEM) ia_css_debug_dtrace(2, "\t%-32s: %d\n", "isys_FIFO stalled", stall.fifo0); ia_css_debug_dtrace(2, "\t%-32s: %d\n", "if_sec_FIFO stalled", stall.fifo1); -#endif ia_css_debug_dtrace(2, "\t%-32s: %d\n", "str_to_mem_FIFO stalled", stall.fifo2); ia_css_debug_dtrace(2, "\t%-32s: %d\n", "dma_FIFO stalled", stall.fifo3); -#if !defined(HAS_NO_INPUT_FORMATTER) - ia_css_debug_dtrace(2, "\t%-32s: %d\n", - "if_prim_a_FIFO stalled", stall.fifo4); -#endif + if (!IS_ISP2401) + ia_css_debug_dtrace(2, "\t%-32s: %d\n", + "if_prim_a_FIFO stalled", stall.fifo4); + ia_css_debug_dtrace(2, "\t%-32s: %d\n", "isp_FIFO stalled", stall.fifo5); ia_css_debug_dtrace(2, "\t%-32s: %d\n", "gp_FIFO stalled", stall.fifo6); -#if !defined(HAS_NO_INPUT_FORMATTER) - ia_css_debug_dtrace(2, "\t%-32s: %d\n", - "if_prim_b_FIFO stalled", stall.fifo7); -#endif + if (!IS_ISP2401) + ia_css_debug_dtrace(2, "\t%-32s: %d\n", + "if_prim_b_FIFO stalled", stall.fifo7); ia_css_debug_dtrace(2, "\t%-32s: %d\n", "gdc0_FIFO stalled", stall.fifo8); -#if !defined(IS_ISP_2500_SYSTEM) ia_css_debug_dtrace(2, "\t%-32s: %d\n", "gdc1_FIFO stalled", stall.fifo9); -#endif ia_css_debug_dtrace(2, "\t%-32s: %d\n", "irq FIFO stalled", stall.fifoa); ia_css_debug_dtrace(2, "\t%-32s: %d\n", "dmem stalled", @@ -562,7 +536,6 @@ static void debug_print_fifo_channel_state(const fifo_channel_state_t *state, return; } -#if !defined(HAS_NO_INPUT_FORMATTER) && defined(USE_INPUT_SYSTEM_VERSION_2) void ia_css_debug_dump_pif_a_isp_fifo_state(void) { fifo_channel_state_t pif_to_isp, isp_to_pif; @@ -599,13 +572,11 @@ void ia_css_debug_dump_str2mem_sp_fifo_state(void) debug_print_fifo_channel_state(&sp_to_s2m, "SP to stream-to-memory"); } +#ifndef ISP2401 static void debug_print_if_state(input_formatter_state_t *state, const char *id) { unsigned int val; -#if defined(HAS_INPUT_FORMATTER_VERSION_1) - const char *st_reset = (state->reset ? "Active" : "Not active"); -#endif const char *st_vsync_active_low = (state->vsync_active_low ? "low" : "high"); const char *st_hsync_active_low = @@ -637,9 +608,6 @@ static void debug_print_if_state(input_formatter_state_t *state, const char *id) ia_css_debug_dtrace(2, "\tConfiguration:\n"); -#if defined(HAS_INPUT_FORMATTER_VERSION_1) - ia_css_debug_dtrace(2, "\t\t%-32s: %s\n", "Software reset", st_reset); -#endif ia_css_debug_dtrace(2, "\t\t%-32s: %d\n", "Start line", st_stline); ia_css_debug_dtrace(2, "\t\t%-32s: %d\n", "Start column", st_stcol); ia_css_debug_dtrace(2, "\t\t%-32s: %d\n", "Cropped height", st_crpht); @@ -674,7 +642,6 @@ static void debug_print_if_state(input_formatter_state_t *state, const char *id) ia_css_debug_dtrace(2, "\t\t%-32s: %d\n", "Block when no request", st_block_fifo_when_no_req); -#if defined(HAS_INPUT_FORMATTER_VERSION_2) ia_css_debug_dtrace(2, "\t\t%-32s: %d\n", "IF_BLOCKED_FIFO_NO_REQ_ADDRESS", input_formatter_reg_load(INPUT_FORMATTER0_ID, @@ -737,7 +704,6 @@ static void debug_print_if_state(input_formatter_state_t *state, const char *id) "_REG_GP_IFMT_slv_reg_srst", gp_device_reg_load(GP_DEVICE0_ID, _REG_GP_IFMT_slv_reg_srst)); -#endif ia_css_debug_dtrace(2, "\tFSM Status:\n"); @@ -868,7 +834,6 @@ static void debug_print_if_state(input_formatter_state_t *state, const char *id) state->vector_support); ia_css_debug_dtrace(2, "\t\t%-32s: %d\n", "Fifo sensor data lost", state->sensor_data_lost); - return; } static void debug_print_if_bin_state(input_formatter_bin_state_t *state) @@ -891,7 +856,7 @@ static void debug_print_if_bin_state(input_formatter_bin_state_t *state) state->en_status_update); } -void ia_css_debug_dump_if_state(void) +static void ia_css_debug_dump_if_state(void) { input_formatter_state_t if_state; input_formatter_bin_state_t if_bin_state; @@ -1620,19 +1585,11 @@ void ia_css_debug_print_sp_debug_state(const struct sh_css_sp_debug_state "frame_buffer.sp.c" }; -#if 1 /* Example SH_CSS_SP_DBG_NR_OF_TRACES==1 */ /* Adjust this to your trace case */ static char const *trace_name[SH_CSS_SP_DBG_NR_OF_TRACES] = { "default" }; -#else - /* Example SH_CSS_SP_DBG_NR_OF_TRACES==4 */ - /* Adjust this to your trace case */ - static char const *trace_name[SH_CSS_SP_DBG_NR_OF_TRACES] = { - "copy", "preview/video", "capture", "acceleration" - }; -#endif /* Remember host_index_last because we only want to print new entries */ static int host_index_last[SH_CSS_SP_DBG_NR_OF_TRACES] = { 0 }; @@ -1704,7 +1661,7 @@ void ia_css_debug_print_sp_debug_state(const struct sh_css_sp_debug_state } #endif -#if defined(HAS_INPUT_FORMATTER_VERSION_2) && !defined(HAS_NO_INPUT_FORMATTER) +#if !defined(ISP2401) static void debug_print_rx_mipi_port_state(mipi_port_state_t *state) { int i; @@ -1901,17 +1858,15 @@ static void debug_print_rx_state(receiver_state_t *state) } #endif -#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2) void ia_css_debug_dump_rx_state(void) { -#if defined(HAS_INPUT_FORMATTER_VERSION_2) && !defined(HAS_NO_INPUT_FORMATTER) +#if !defined(ISP2401) receiver_state_t state; receiver_get_state(RX0_ID, &state); debug_print_rx_state(&state); #endif } -#endif void ia_css_debug_dump_sp_sw_debug_info(void) { @@ -1926,7 +1881,7 @@ void ia_css_debug_dump_sp_sw_debug_info(void) return; } -#if defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) static void debug_print_isys_capture_unit_state(capture_unit_state_t *state) { assert(state); @@ -2163,31 +2118,20 @@ static void debug_print_isys_state(input_system_state_t *state) } /* end of control unit state */ } - -void ia_css_debug_dump_isys_state(void) -{ - input_system_state_t state; - - input_system_get_state(INPUT_SYSTEM0_ID, &state); - debug_print_isys_state(&state); - - return; -} #endif -#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2401) + void ia_css_debug_dump_isys_state(void) { - /* Android compilation fails if made a local variable - stack size on android is limited to 2k and this structure - is around 3.5K, in place of static malloc can be done but - if this call is made too often it will lead to fragment memory - versus a fixed allocation */ static input_system_state_t state; input_system_get_state(INPUT_SYSTEM0_ID, &state); + +#ifndef ISP2401 + debug_print_isys_state(&state); +#else input_system_dump_state(INPUT_SYSTEM0_ID, &state); -} #endif +} void ia_css_debug_dump_debug_info(const char *context) { @@ -2195,10 +2139,10 @@ void ia_css_debug_dump_debug_info(const char *context) context = "No Context provided"; ia_css_debug_dtrace(2, "CSS Debug Info dump [Context = %s]\n", context); -#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2) - ia_css_debug_dump_rx_state(); -#endif -#if !defined(HAS_NO_INPUT_FORMATTER) && defined(USE_INPUT_SYSTEM_VERSION_2) + if (!IS_ISP2401) + ia_css_debug_dump_rx_state(); + +#ifndef ISP2401 ia_css_debug_dump_if_state(); #endif ia_css_debug_dump_isp_state(); @@ -2215,12 +2159,12 @@ void ia_css_debug_dump_debug_info(const char *context) ia_css_debug_dump_dma_isp_fifo_state(); ia_css_debug_dump_dma_sp_fifo_state(); ia_css_debug_dump_dma_state(); -#if defined(USE_INPUT_SYSTEM_VERSION_2) - ia_css_debug_dump_isys_state(); - { + if (!IS_ISP2401) { struct irq_controller_state state; + ia_css_debug_dump_isys_state(); + irq_controller_get_state(IRQ2_ID, &state); ia_css_debug_dtrace(2, "\t%-32s:\n", @@ -2241,14 +2185,12 @@ void ia_css_debug_dump_debug_info(const char *context) ia_css_debug_dtrace(2, "\t\t%-32s: %d\n", "irq_level_not_pulse", state.irq_level_not_pulse); + } else { + ia_css_debug_dump_isys_state(); } -#endif -#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2401) - ia_css_debug_dump_isys_state(); -#endif -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) + ia_css_debug_tagger_state(); -#endif + return; } @@ -2278,7 +2220,6 @@ void ia_css_debug_wake_up_sp(void) sp_ctrl_setbit(SP0_ID, SP_SC_REG, SP_START_BIT); } -#if !defined(IS_ISP_2500_SYSTEM) #define FIND_DMEM_PARAMS_TYPE(stream, kernel, type) \ (struct HRTCAT(HRTCAT(sh_css_isp_, type), _params) *) \ findf_dmem_params(stream, offsetof(struct ia_css_memory_offsets, dmem.kernel)) @@ -2310,16 +2251,11 @@ findf_dmem_params(struct ia_css_stream *stream, short idx) } return NULL; } -#endif void ia_css_debug_dump_isp_params(struct ia_css_stream *stream, unsigned int enable) { ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE, "ISP PARAMETERS:\n"); -#if defined(IS_ISP_2500_SYSTEM) - (void)enable; - (void)stream; -#else assert(stream); if ((enable & IA_CSS_DEBUG_DUMP_FPN) @@ -2383,7 +2319,6 @@ void ia_css_debug_dump_isp_params(struct ia_css_stream *stream, || (enable & IA_CSS_DEBUG_DUMP_ALL)) { ia_css_ce_dump(FIND_DMEM_PARAMS(stream, ce), IA_CSS_DEBUG_VERBOSE); } -#endif } void sh_css_dump_sp_raw_copy_linecount(bool reduced) @@ -2449,12 +2384,14 @@ void ia_css_debug_dump_isp_binary(void) void ia_css_debug_dump_perf_counters(void) { -#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2) const struct ia_css_fw_info *fw; int i; unsigned int HIVE_ADDR_ia_css_isys_sp_error_cnt; - s32 ia_css_sp_input_system_error_cnt[N_MIPI_PORT_ID + - 1]; /* 3 Capture Units and 1 Acquire Unit. */ + /* N_MIPI_PORT_ID + 1: 3 Capture Units and 1 Acquire Unit. */ + s32 ia_css_sp_input_system_error_cnt[N_MIPI_PORT_ID + 1]; + + if (IS_ISP2401) + return; ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE, "Input System Error Counters:\n"); @@ -2473,49 +2410,9 @@ void ia_css_debug_dump_perf_counters(void) ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE, "\tport[%d] = %d\n", i, ia_css_sp_input_system_error_cnt[i]); } -#endif } /* - -void sh_css_init_ddr_debug_queue(void) -{ - ia_css_ptr ddr_debug_queue_addr = - hmm_alloc(sizeof(debug_data_ddr_t), HMM_BO_PRIVATE, 0, NULL, 0); - const struct ia_css_fw_info *fw; - unsigned int HIVE_ADDR_debug_buffer_ddr_address; - - fw = &sh_css_sp_fw; - HIVE_ADDR_debug_buffer_ddr_address = - fw->info.sp.debug_buffer_ddr_address; - - (void)HIVE_ADDR_debug_buffer_ddr_address; - - debug_buffer_ddr_init(ddr_debug_queue_addr); - - sp_dmem_store_uint32(SP0_ID, - (unsigned int)sp_address_of(debug_buffer_ddr_address), - (uint32_t)(ddr_debug_queue_addr)); -} - -void sh_css_load_ddr_debug_queue(void) -{ - debug_synch_queue_ddr(); -} - -void ia_css_debug_dump_ddr_debug_queue(void) -{ - int i; - sh_css_load_ddr_debug_queue(); - for (i = 0; i < DEBUG_BUF_SIZE; i++) { - ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE, - "ddr_debug_queue[%d] = 0x%x\n", - i, debug_data_ptr->buf[i]); - } -} -*/ - -/* * @brief Initialize the debug mode. * Refer to "ia_css_debug.h" for more details. */ @@ -2557,8 +2454,7 @@ ia_css_debug_mode_enable_dma_channel(int dma_id, return rc; } -static -void dtrace_dot(const char *fmt, ...) +static void __printf(1, 2) dtrace_dot(const char *fmt, ...) { va_list ap; @@ -3260,22 +3156,16 @@ ia_css_debug_dump_stream_config( byte 2-3: data */ #if TRACE_ENABLE_SP0 || TRACE_ENABLE_SP1 || TRACE_ENABLE_ISP -#ifndef ISP2401 -static void debug_dump_one_trace(TRACE_CORE_ID proc_id) -#else static void debug_dump_one_trace(enum TRACE_CORE_ID proc_id) -#endif { #if defined(HAS_TRACER_V2) u32 start_addr; u32 start_addr_data; u32 item_size; -#ifndef ISP2401 u32 tmp; -#else u8 tid_val; enum TRACE_DUMP_FORMAT dump_format; -#endif + int i, j, max_trace_points, point_num, limit = -1; /* using a static buffer here as the driver has issues allocating memory */ static u32 trace_read_buf[TRACE_BUFF_SIZE] = {0}; @@ -3479,7 +3369,6 @@ void ia_css_debug_dump_trace(void) #endif } -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) /* Tagger state dump function. The tagger is only available when the CSS * contains an input system (2400 or 2401). */ void ia_css_debug_tagger_state(void) @@ -3505,7 +3394,6 @@ void ia_css_debug_tagger_state(void) i, tbuf_frames[i].exp_id, tbuf_frames[i].mark, tbuf_frames[i].lock); } } -#endif /* defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) */ /* ISP2401 */ void ia_css_debug_pc_dump(sp_ID_t id, unsigned int num_of_dumps) diff --git a/drivers/staging/media/atomisp/pci/runtime/ifmtr/src/ifmtr.c b/drivers/staging/media/atomisp/pci/runtime/ifmtr/src/ifmtr.c index 89cded6b6e2b..6d9f47629fbc 100644 --- a/drivers/staging/media/atomisp/pci/runtime/ifmtr/src/ifmtr.c +++ b/drivers/staging/media/atomisp/pci/runtime/ifmtr/src/ifmtr.c @@ -16,7 +16,7 @@ #include "system_global.h" #include <linux/kernel.h> -#ifdef USE_INPUT_SYSTEM_VERSION_2 +#ifndef ISP2401 #include "ia_css_ifmtr.h" #include <math_support.h> diff --git a/drivers/staging/media/atomisp/pci/runtime/inputfifo/src/inputfifo.c b/drivers/staging/media/atomisp/pci/runtime/inputfifo/src/inputfifo.c index 38712530f566..2d06e124007e 100644 --- a/drivers/staging/media/atomisp/pci/runtime/inputfifo/src/inputfifo.c +++ b/drivers/staging/media/atomisp/pci/runtime/inputfifo/src/inputfifo.c @@ -32,24 +32,18 @@ #include "event_fifo.h" #define __INLINE_SP__ -#if !defined(HAS_NO_INPUT_SYSTEM) #include "input_system.h" /* MIPI_PREDICTOR_NONE,... */ -#endif #include "assert_support.h" /* System independent */ #include "sh_css_internal.h" -#if !defined(HAS_NO_INPUT_SYSTEM) #include "ia_css_isys.h" -#endif #define HBLANK_CYCLES (187) #define MARKER_CYCLES (6) -#if !defined(HAS_NO_INPUT_SYSTEM) #include <hive_isp_css_streaming_to_mipi_types_hrt.h> -#endif /* The data type is used to send special cases: * yuv420: odd lines (1, 3 etc) are twice as wide as even @@ -67,9 +61,7 @@ enum inputfifo_mipi_data_type { inputfifo_mipi_data_type_rgb, }; -#if !defined(HAS_NO_INPUT_SYSTEM) static unsigned int inputfifo_curr_ch_id, inputfifo_curr_fmt_type; -#endif struct inputfifo_instance { unsigned int ch_id; enum atomisp_input_format input_format; @@ -81,7 +73,6 @@ struct inputfifo_instance { enum inputfifo_mipi_data_type type; }; -#if !defined(HAS_NO_INPUT_SYSTEM) /* * Maintain a basic streaming to Mipi administration with ch_id as index * ch_id maps on the "Mipi virtual channel ID" and can have value 0..3 @@ -536,4 +527,3 @@ void ia_css_inputfifo_end_frame( s2mi->streaming = false; return; } -#endif /* #if !defined(HAS_NO_INPUT_SYSTEM) */ diff --git a/drivers/staging/media/atomisp/pci/runtime/isys/interface/ia_css_isys.h b/drivers/staging/media/atomisp/pci/runtime/isys/interface/ia_css_isys.h index f975429b8705..711a321e9a3f 100644 --- a/drivers/staging/media/atomisp/pci/runtime/isys/interface/ia_css_isys.h +++ b/drivers/staging/media/atomisp/pci/runtime/isys/interface/ia_css_isys.h @@ -24,22 +24,20 @@ #include <system_global.h> #include "ia_css_isys_comm.h" -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 /** * Virtual Input System. (Input System 2401) */ -typedef input_system_cfg_t ia_css_isys_descr_t; +typedef isp2401_input_system_cfg_t ia_css_isys_descr_t; /* end of Virtual Input System */ #endif -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) -input_system_error_t ia_css_isys_init(void); +input_system_err_t ia_css_isys_init(void); void ia_css_isys_uninit(void); enum mipi_port_id ia_css_isys_port_to_mipi_port( enum mipi_port_id api_port); -#endif -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) /** * @brief Register one (virtual) stream. This is used to track when all @@ -73,12 +71,12 @@ int ia_css_isys_csi_rx_unregister_stream( int ia_css_isys_convert_compressed_format( struct ia_css_csi2_compression *comp, - struct input_system_cfg_s *cfg); + struct isp2401_input_system_cfg_s *cfg); unsigned int ia_css_csi2_calculate_input_system_alignment( enum atomisp_input_format fmt_type); #endif -#if !defined(USE_INPUT_SYSTEM_VERSION_2401) +#if !defined(ISP2401) /* CSS Receiver */ void ia_css_isys_rx_configure( const rx_cfg_t *config, @@ -95,7 +93,7 @@ void ia_css_isys_rx_clear_irq_info(enum mipi_port_id port, unsigned int irq_infos); unsigned int ia_css_isys_rx_translate_irq_infos(unsigned int bits); -#endif /* #if !defined(USE_INPUT_SYSTEM_VERSION_2401) */ +#endif /* #if !defined(ISP2401) */ /* @brief Translate format and compression to format type. * @@ -113,7 +111,7 @@ int ia_css_isys_convert_stream_format_to_mipi_format( mipi_predictor_t compression, unsigned int *fmt_type); -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 /** * Virtual Input System. (Input System 2401) */ diff --git a/drivers/staging/media/atomisp/pci/runtime/isys/interface/ia_css_isys_comm.h b/drivers/staging/media/atomisp/pci/runtime/isys/interface/ia_css_isys_comm.h index 6f1a86c81d7c..d80ef42c7a64 100644 --- a/drivers/staging/media/atomisp/pci/runtime/isys/interface/ia_css_isys_comm.h +++ b/drivers/staging/media/atomisp/pci/runtime/isys/interface/ia_css_isys_comm.h @@ -19,7 +19,7 @@ #include <type_support.h> #include <input_system.h> -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 #include <platform_support.h> /* inline */ #include <input_system_global.h> #include <ia_css_stream_public.h> /* IA_CSS_STREAM_MAX_ISYS_STREAM_PER_CH */ @@ -50,5 +50,5 @@ static inline uint32_t ia_css_isys_generate_stream_id( return sp_thread_id * IA_CSS_STREAM_MAX_ISYS_STREAM_PER_CH + stream_id; } -#endif /* USE_INPUT_SYSTEM_VERSION_2401*/ +#endif /* ISP2401*/ #endif /*_IA_CSS_ISYS_COMM_H */ diff --git a/drivers/staging/media/atomisp/pci/runtime/isys/src/csi_rx_rmgr.c b/drivers/staging/media/atomisp/pci/runtime/isys/src/csi_rx_rmgr.c index 5a44d8f6c196..3fc9fed1e516 100644 --- a/drivers/staging/media/atomisp/pci/runtime/isys/src/csi_rx_rmgr.c +++ b/drivers/staging/media/atomisp/pci/runtime/isys/src/csi_rx_rmgr.c @@ -15,7 +15,7 @@ #include "system_global.h" -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 #include "assert_support.h" #include "platform_support.h" diff --git a/drivers/staging/media/atomisp/pci/runtime/isys/src/isys_dma_rmgr.c b/drivers/staging/media/atomisp/pci/runtime/isys/src/isys_dma_rmgr.c index 68baec78b1c4..261c6460e970 100644 --- a/drivers/staging/media/atomisp/pci/runtime/isys/src/isys_dma_rmgr.c +++ b/drivers/staging/media/atomisp/pci/runtime/isys/src/isys_dma_rmgr.c @@ -15,7 +15,7 @@ #include "system_global.h" -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 #include "assert_support.h" #include "platform_support.h" diff --git a/drivers/staging/media/atomisp/pci/runtime/isys/src/isys_init.c b/drivers/staging/media/atomisp/pci/runtime/isys/src/isys_init.c index de442f1fa6ba..d0a43c44963c 100644 --- a/drivers/staging/media/atomisp/pci/runtime/isys/src/isys_init.c +++ b/drivers/staging/media/atomisp/pci/runtime/isys/src/isys_init.c @@ -15,17 +15,16 @@ #include "input_system.h" -#ifdef HAS_INPUT_SYSTEM_VERSION_2 #include "ia_css_isys.h" #include "platform_support.h" -#ifdef USE_INPUT_SYSTEM_VERSION_2401 -#include "isys_dma.h" /* isys2401_dma_set_max_burst_size() */ +#ifdef ISP2401 +#include "isys_dma_public.h" /* isys2401_dma_set_max_burst_size() */ #include "isys_irq.h" #endif -#if defined(USE_INPUT_SYSTEM_VERSION_2) -input_system_error_t ia_css_isys_init(void) +#if !defined(ISP2401) +input_system_err_t ia_css_isys_init(void) { backend_channel_cfg_t backend_ch0; backend_channel_cfg_t backend_ch1; @@ -33,7 +32,7 @@ input_system_error_t ia_css_isys_init(void) target_cfg2400_t targetC; u32 acq_mem_region_size = 24; u32 acq_nof_mem_regions = 2; - input_system_error_t error = INPUT_SYSTEM_ERR_NO_ERROR; + input_system_err_t error = INPUT_SYSTEM_ERR_NO_ERROR; memset(&backend_ch0, 0, sizeof(backend_channel_cfg_t)); memset(&backend_ch1, 0, sizeof(backend_channel_cfg_t)); @@ -87,8 +86,8 @@ input_system_error_t ia_css_isys_init(void) return error; } -#elif defined(USE_INPUT_SYSTEM_VERSION_2401) -input_system_error_t ia_css_isys_init(void) +#elif defined(ISP2401) +input_system_err_t ia_css_isys_init(void) { ia_css_isys_csi_rx_lut_rmgr_init(); ia_css_isys_ibuf_rmgr_init(); @@ -107,11 +106,11 @@ input_system_error_t ia_css_isys_init(void) } #endif -#if defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) void ia_css_isys_uninit(void) { } -#elif defined(USE_INPUT_SYSTEM_VERSION_2401) +#elif defined(ISP2401) void ia_css_isys_uninit(void) { ia_css_isys_csi_rx_lut_rmgr_uninit(); @@ -121,4 +120,3 @@ void ia_css_isys_uninit(void) } #endif -#endif diff --git a/drivers/staging/media/atomisp/pci/runtime/isys/src/isys_stream2mmio_rmgr.c b/drivers/staging/media/atomisp/pci/runtime/isys/src/isys_stream2mmio_rmgr.c index bc4a2ff3c0fc..fb0cb183f701 100644 --- a/drivers/staging/media/atomisp/pci/runtime/isys/src/isys_stream2mmio_rmgr.c +++ b/drivers/staging/media/atomisp/pci/runtime/isys/src/isys_stream2mmio_rmgr.c @@ -15,7 +15,7 @@ #include "system_global.h" -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 #include "assert_support.h" #include "platform_support.h" diff --git a/drivers/staging/media/atomisp/pci/runtime/isys/src/rx.c b/drivers/staging/media/atomisp/pci/runtime/isys/src/rx.c index 4f0dcdfa13be..b4813cd50daa 100644 --- a/drivers/staging/media/atomisp/pci/runtime/isys/src/rx.c +++ b/drivers/staging/media/atomisp/pci/runtime/isys/src/rx.c @@ -20,7 +20,7 @@ #include "ia_css_irq.h" #include "sh_css_internal.h" -#if !defined(USE_INPUT_SYSTEM_VERSION_2401) +#if !defined(ISP2401) void ia_css_isys_rx_enable_all_interrupts(enum mipi_port_id port) { hrt_data bits = receiver_port_reg_load(RX0_ID, @@ -28,9 +28,7 @@ void ia_css_isys_rx_enable_all_interrupts(enum mipi_port_id port) _HRT_CSS_RECEIVER_IRQ_ENABLE_REG_IDX); bits |= (1U << _HRT_CSS_RECEIVER_IRQ_OVERRUN_BIT) | -#if defined(HAS_RX_VERSION_2) (1U << _HRT_CSS_RECEIVER_IRQ_INIT_TIMEOUT_BIT) | -#endif (1U << _HRT_CSS_RECEIVER_IRQ_SLEEP_MODE_ENTRY_BIT) | (1U << _HRT_CSS_RECEIVER_IRQ_SLEEP_MODE_EXIT_BIT) | (1U << _HRT_CSS_RECEIVER_IRQ_ERR_SOT_HS_BIT) | @@ -117,10 +115,8 @@ unsigned int ia_css_isys_rx_translate_irq_infos(unsigned int bits) if (bits & (1U << _HRT_CSS_RECEIVER_IRQ_OVERRUN_BIT)) infos |= IA_CSS_RX_IRQ_INFO_BUFFER_OVERRUN; -#if defined(HAS_RX_VERSION_2) if (bits & (1U << _HRT_CSS_RECEIVER_IRQ_INIT_TIMEOUT_BIT)) infos |= IA_CSS_RX_IRQ_INFO_INIT_TIMEOUT; -#endif if (bits & (1U << _HRT_CSS_RECEIVER_IRQ_SLEEP_MODE_ENTRY_BIT)) infos |= IA_CSS_RX_IRQ_INFO_ENTER_SLEEP_MODE; if (bits & (1U << _HRT_CSS_RECEIVER_IRQ_SLEEP_MODE_EXIT_BIT)) @@ -176,10 +172,8 @@ void ia_css_isys_rx_clear_irq_info(enum mipi_port_id port, /* MW: Why do we remap the receiver bitmap */ if (irq_infos & IA_CSS_RX_IRQ_INFO_BUFFER_OVERRUN) bits |= 1U << _HRT_CSS_RECEIVER_IRQ_OVERRUN_BIT; -#if defined(HAS_RX_VERSION_2) if (irq_infos & IA_CSS_RX_IRQ_INFO_INIT_TIMEOUT) bits |= 1U << _HRT_CSS_RECEIVER_IRQ_INIT_TIMEOUT_BIT; -#endif if (irq_infos & IA_CSS_RX_IRQ_INFO_ENTER_SLEEP_MODE) bits |= 1U << _HRT_CSS_RECEIVER_IRQ_SLEEP_MODE_ENTRY_BIT; if (irq_infos & IA_CSS_RX_IRQ_INFO_EXIT_SLEEP_MODE) @@ -215,7 +209,7 @@ void ia_css_isys_rx_clear_irq_info(enum mipi_port_id port, return; } -#endif /* #if !defined(USE_INPUT_SYSTEM_VERSION_2401) */ +#endif /* #if !defined(ISP2401) */ int ia_css_isys_convert_stream_format_to_mipi_format( enum atomisp_input_format input_format, @@ -317,7 +311,7 @@ int ia_css_isys_convert_stream_format_to_mipi_format( case ATOMISP_INPUT_FORMAT_EMBEDDED: *fmt_type = MIPI_FORMAT_EMBEDDED; break; -#ifndef USE_INPUT_SYSTEM_VERSION_2401 +#ifndef ISP2401 case ATOMISP_INPUT_FORMAT_RAW_16: /* This is not specified by Arasan, so we use * 17 for now. @@ -362,7 +356,7 @@ int ia_css_isys_convert_stream_format_to_mipi_format( return 0; } -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) static mipi_predictor_t sh_css_csi2_compression_type_2_mipi_predictor( enum ia_css_csi2_compression_type type) { @@ -382,7 +376,7 @@ static mipi_predictor_t sh_css_csi2_compression_type_2_mipi_predictor( int ia_css_isys_convert_compressed_format( struct ia_css_csi2_compression *comp, - struct input_system_cfg_s *cfg) + struct isp2401_input_system_cfg_s *cfg) { int err = 0; @@ -480,11 +474,10 @@ unsigned int ia_css_csi2_calculate_input_system_alignment( #endif -#if !defined(USE_INPUT_SYSTEM_VERSION_2401) +#if !defined(ISP2401) void ia_css_isys_rx_configure(const rx_cfg_t *config, const enum ia_css_input_mode input_mode) { -#if defined(HAS_RX_VERSION_2) bool port_enabled[N_MIPI_PORT_ID]; bool any_port_enabled = false; enum mipi_port_id port; @@ -580,9 +573,6 @@ void ia_css_isys_rx_configure(const rx_cfg_t *config, * INPUT_SYSTEM_CSI_RECEIVER_SELECT_BACKENG, 1); */ input_system_reg_store(INPUT_SYSTEM0_ID, 0x207, 1); -#else -#error "rx.c: RX version must be one of {RX_VERSION_2}" -#endif return; } @@ -598,4 +588,4 @@ void ia_css_isys_rx_disable(void) } return; } -#endif /* if !defined(USE_INPUT_SYSTEM_VERSION_2401) */ +#endif /* if !defined(ISP2401) */ diff --git a/drivers/staging/media/atomisp/pci/runtime/isys/src/virtual_isys.c b/drivers/staging/media/atomisp/pci/runtime/isys/src/virtual_isys.c index b3c6831cb9e3..317ea30ede7a 100644 --- a/drivers/staging/media/atomisp/pci/runtime/isys/src/virtual_isys.c +++ b/drivers/staging/media/atomisp/pci/runtime/isys/src/virtual_isys.c @@ -17,7 +17,7 @@ #include "system_global.h" -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 #include "ia_css_isys.h" #include "ia_css_debug.h" @@ -33,7 +33,7 @@ *************************************************/ static bool create_input_system_channel( - input_system_cfg_t *cfg, + isp2401_input_system_cfg_t *cfg, bool metadata, input_system_channel_t *channel); @@ -41,7 +41,7 @@ static void destroy_input_system_channel( input_system_channel_t *channel); static bool create_input_system_input_port( - input_system_cfg_t *cfg, + isp2401_input_system_cfg_t *cfg, input_system_input_port_t *input_port); static void destroy_input_system_input_port( @@ -50,14 +50,14 @@ static void destroy_input_system_input_port( static bool calculate_input_system_channel_cfg( input_system_channel_t *channel, input_system_input_port_t *input_port, - input_system_cfg_t *isys_cfg, + isp2401_input_system_cfg_t *isys_cfg, input_system_channel_cfg_t *channel_cfg, bool metadata); static bool calculate_input_system_input_port_cfg( input_system_channel_t *channel, input_system_input_port_t *input_port, - input_system_cfg_t *isys_cfg, + isp2401_input_system_cfg_t *isys_cfg, input_system_input_port_cfg_t *input_port_cfg); static bool acquire_sid( @@ -74,10 +74,10 @@ static bool acquire_ib_buffer( s32 lines_per_frame, s32 align_in_bytes, bool online, - ib_buffer_t *buf); + isp2401_ib_buffer_t *buf); static void release_ib_buffer( - ib_buffer_t *buf); + isp2401_ib_buffer_t *buf); static bool acquire_dma_channel( isys2401_dma_ID_t dma_id, @@ -100,43 +100,43 @@ static void release_be_lut_entry( static bool calculate_tpg_cfg( input_system_channel_t *channel, input_system_input_port_t *input_port, - input_system_cfg_t *isys_cfg, + isp2401_input_system_cfg_t *isys_cfg, pixelgen_tpg_cfg_t *cfg); static bool calculate_prbs_cfg( input_system_channel_t *channel, input_system_input_port_t *input_port, - input_system_cfg_t *isys_cfg, + isp2401_input_system_cfg_t *isys_cfg, pixelgen_prbs_cfg_t *cfg); static bool calculate_fe_cfg( - const input_system_cfg_t *isys_cfg, + const isp2401_input_system_cfg_t *isys_cfg, csi_rx_frontend_cfg_t *cfg); static bool calculate_be_cfg( const input_system_input_port_t *input_port, - const input_system_cfg_t *isys_cfg, + const isp2401_input_system_cfg_t *isys_cfg, bool metadata, csi_rx_backend_cfg_t *cfg); static bool calculate_stream2mmio_cfg( - const input_system_cfg_t *isys_cfg, + const isp2401_input_system_cfg_t *isys_cfg, bool metadata, stream2mmio_cfg_t *cfg); static bool calculate_ibuf_ctrl_cfg( const input_system_channel_t *channel, const input_system_input_port_t *input_port, - const input_system_cfg_t *isys_cfg, + const isp2401_input_system_cfg_t *isys_cfg, ibuf_ctrl_cfg_t *cfg); static bool calculate_isys2401_dma_cfg( const input_system_channel_t *channel, - const input_system_cfg_t *isys_cfg, + const isp2401_input_system_cfg_t *isys_cfg, isys2401_dma_cfg_t *cfg); static bool calculate_isys2401_dma_port_cfg( - const input_system_cfg_t *isys_cfg, + const isp2401_input_system_cfg_t *isys_cfg, bool raw_packed, bool metadata, isys2401_dma_port_cfg_t *cfg); @@ -287,7 +287,7 @@ ia_css_isys_error_t ia_css_isys_stream_calculate_cfg( * **************************************************/ static bool create_input_system_channel( - input_system_cfg_t *cfg, + isp2401_input_system_cfg_t *cfg, bool metadata, input_system_channel_t *me) { @@ -361,7 +361,7 @@ static void destroy_input_system_channel( } static bool create_input_system_input_port( - input_system_cfg_t *cfg, + isp2401_input_system_cfg_t *cfg, input_system_input_port_t *me) { csi_mipi_packet_type_t packet_type; @@ -457,7 +457,7 @@ static void destroy_input_system_input_port( static bool calculate_input_system_channel_cfg( input_system_channel_t *channel, input_system_input_port_t *input_port, - input_system_cfg_t *isys_cfg, + isp2401_input_system_cfg_t *isys_cfg, input_system_channel_cfg_t *channel_cfg, bool metadata) { @@ -508,7 +508,7 @@ static bool calculate_input_system_channel_cfg( static bool calculate_input_system_input_port_cfg( input_system_channel_t *channel, input_system_input_port_t *input_port, - input_system_cfg_t *isys_cfg, + isp2401_input_system_cfg_t *isys_cfg, input_system_input_port_cfg_t *input_port_cfg) { bool rc; @@ -595,7 +595,7 @@ static bool acquire_ib_buffer( s32 lines_per_frame, s32 align_in_bytes, bool online, - ib_buffer_t *buf) + isp2401_ib_buffer_t *buf) { buf->stride = calculate_stride(bits_per_pixel, pixels_per_line, false, align_in_bytes); @@ -610,7 +610,7 @@ static bool acquire_ib_buffer( } static void release_ib_buffer( - ib_buffer_t *buf) + isp2401_ib_buffer_t *buf) { ia_css_isys_ibuf_rmgr_release(&buf->start_addr); } @@ -648,7 +648,7 @@ static void release_be_lut_entry( static bool calculate_tpg_cfg( input_system_channel_t *channel, input_system_input_port_t *input_port, - input_system_cfg_t *isys_cfg, + isp2401_input_system_cfg_t *isys_cfg, pixelgen_tpg_cfg_t *cfg) { memcpy(cfg, &isys_cfg->tpg_port_attr, sizeof(pixelgen_tpg_cfg_t)); @@ -659,7 +659,7 @@ static bool calculate_tpg_cfg( static bool calculate_prbs_cfg( input_system_channel_t *channel, input_system_input_port_t *input_port, - input_system_cfg_t *isys_cfg, + isp2401_input_system_cfg_t *isys_cfg, pixelgen_prbs_cfg_t *cfg) { memcpy(cfg, &isys_cfg->prbs_port_attr, sizeof(pixelgen_prbs_cfg_t)); @@ -668,7 +668,7 @@ static bool calculate_prbs_cfg( } static bool calculate_fe_cfg( - const input_system_cfg_t *isys_cfg, + const isp2401_input_system_cfg_t *isys_cfg, csi_rx_frontend_cfg_t *cfg) { cfg->active_lanes = isys_cfg->csi_port_attr.active_lanes; @@ -677,7 +677,7 @@ static bool calculate_fe_cfg( static bool calculate_be_cfg( const input_system_input_port_t *input_port, - const input_system_cfg_t *isys_cfg, + const isp2401_input_system_cfg_t *isys_cfg, bool metadata, csi_rx_backend_cfg_t *cfg) { @@ -707,7 +707,7 @@ static bool calculate_be_cfg( } static bool calculate_stream2mmio_cfg( - const input_system_cfg_t *isys_cfg, + const isp2401_input_system_cfg_t *isys_cfg, bool metadata, stream2mmio_cfg_t *cfg ) @@ -725,7 +725,7 @@ static bool calculate_stream2mmio_cfg( static bool calculate_ibuf_ctrl_cfg( const input_system_channel_t *channel, const input_system_input_port_t *input_port, - const input_system_cfg_t *isys_cfg, + const isp2401_input_system_cfg_t *isys_cfg, ibuf_ctrl_cfg_t *cfg) { const s32 bits_per_byte = 8; @@ -807,7 +807,7 @@ static bool calculate_ibuf_ctrl_cfg( static bool calculate_isys2401_dma_cfg( const input_system_channel_t *channel, - const input_system_cfg_t *isys_cfg, + const isp2401_input_system_cfg_t *isys_cfg, isys2401_dma_cfg_t *cfg) { cfg->channel = channel->dma_channel; @@ -827,7 +827,7 @@ static bool calculate_isys2401_dma_cfg( /* See also: ia_css_dma_configure_from_info() */ static bool calculate_isys2401_dma_port_cfg( - const input_system_cfg_t *isys_cfg, + const isp2401_input_system_cfg_t *isys_cfg, bool raw_packed, bool metadata, isys2401_dma_port_cfg_t *cfg) diff --git a/drivers/staging/media/atomisp/pci/runtime/pipeline/interface/ia_css_pipeline.h b/drivers/staging/media/atomisp/pci/runtime/pipeline/interface/ia_css_pipeline.h index 18a7d18e197e..de2c526a58ae 100644 --- a/drivers/staging/media/atomisp/pci/runtime/pipeline/interface/ia_css_pipeline.h +++ b/drivers/staging/media/atomisp/pci/runtime/pipeline/interface/ia_css_pipeline.h @@ -243,7 +243,7 @@ bool ia_css_pipeline_uses_params(struct ia_css_pipeline *pipeline); */ bool ia_css_pipeline_get_sp_thread_id(unsigned int key, unsigned int *val); -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) /** * @brief Get the pipeline io status * diff --git a/drivers/staging/media/atomisp/pci/runtime/pipeline/src/pipeline.c b/drivers/staging/media/atomisp/pci/runtime/pipeline/src/pipeline.c index 4b8e85bc2122..d03957d1ecf4 100644 --- a/drivers/staging/media/atomisp/pci/runtime/pipeline/src/pipeline.c +++ b/drivers/staging/media/atomisp/pci/runtime/pipeline/src/pipeline.c @@ -140,9 +140,7 @@ void ia_css_pipeline_start(enum ia_css_pipe_id pipe_id, false, false, false, true, SH_CSS_BDS_FACTOR_1_00, SH_CSS_PIPE_CONFIG_OVRD_NO_OVRD, IA_CSS_INPUT_MODE_MEMORY, NULL, NULL, -#if !defined(HAS_NO_INPUT_SYSTEM) (enum mipi_port_id)0, -#endif NULL, NULL); ia_css_pipeline_get_sp_thread_id(pipe_num, &thread_id); @@ -457,7 +455,7 @@ bool ia_css_pipeline_has_stopped(struct ia_css_pipeline *pipeline) return sp_group.pipe[thread_id].num_stages == 0; } -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) struct sh_css_sp_pipeline_io_status *ia_css_pipeline_get_pipe_io_status(void) { return(&sh_css_sp_group.pipe_io_status); diff --git a/drivers/staging/media/atomisp/pci/runtime/queue/src/queue_access.c b/drivers/staging/media/atomisp/pci/runtime/queue/src/queue_access.c index fdca743c4ab7..424e7a15a389 100644 --- a/drivers/staging/media/atomisp/pci/runtime/queue/src/queue_access.c +++ b/drivers/staging/media/atomisp/pci/runtime/queue/src/queue_access.c @@ -44,7 +44,7 @@ int ia_css_queue_load( the value as zero. This causes division by 0 exception as the size is used in a modular division operation. */ - return EDOM; + return -EDOM; } } diff --git a/drivers/staging/media/atomisp/pci/runtime/rmgr/src/rmgr_vbuf.c b/drivers/staging/media/atomisp/pci/runtime/rmgr/src/rmgr_vbuf.c index 1ea74296fc8d..b4f53be18e7f 100644 --- a/drivers/staging/media/atomisp/pci/runtime/rmgr/src/rmgr_vbuf.c +++ b/drivers/staging/media/atomisp/pci/runtime/rmgr/src/rmgr_vbuf.c @@ -241,7 +241,6 @@ void rmgr_pop_handle(struct ia_css_rmgr_vbuf_pool *pool, struct ia_css_rmgr_vbuf_handle **handle) { u32 i; - bool succes = false; assert(pool); assert(pool->recycle); @@ -255,8 +254,7 @@ void rmgr_pop_handle(struct ia_css_rmgr_vbuf_pool *pool, pool->handles[i] = NULL; /* dont release, we are returning it... ia_css_rmgr_refcount_release_vbuf(handle); */ - succes = true; - break; + return; } } } diff --git a/drivers/staging/media/atomisp/pci/sh_css.c b/drivers/staging/media/atomisp/pci/sh_css.c index a68cbb4995f0..ddee04c8248d 100644 --- a/drivers/staging/media/atomisp/pci/sh_css.c +++ b/drivers/staging/media/atomisp/pci/sh_css.c @@ -27,9 +27,7 @@ #include "sh_css_internal.h" #include "sh_css_mipi.h" #include "sh_css_sp.h" /* sh_css_sp_group */ -#if !defined(HAS_NO_INPUT_SYSTEM) #include "ia_css_isys.h" -#endif #include "ia_css_frame.h" #include "sh_css_defs.h" #include "sh_css_firmware.h" @@ -51,7 +49,7 @@ #include "ia_css_pipe_util.h" #include "ia_css_pipe_binarydesc.h" #include "ia_css_pipe_stagedesc.h" -#ifdef USE_INPUT_SYSTEM_VERSION_2 +#ifndef ISP2401 #include "ia_css_isys.h" #endif @@ -59,12 +57,10 @@ #include "assert_support.h" #include "math_support.h" #include "sw_event_global.h" /* Event IDs.*/ -#if !defined(HAS_NO_INPUT_FORMATTER) +#if !defined(ISP2401) #include "ia_css_ifmtr.h" #endif -#if !defined(HAS_NO_INPUT_SYSTEM) #include "input_system.h" -#endif #include "mmu_device.h" /* mmu_set_page_table_base_index(), ... */ #include "ia_css_mmu_private.h" /* sh_css_mmu_set_page_table_base_index() */ #include "gdc_device.h" /* HRT_GDC_N */ @@ -115,7 +111,7 @@ static int thread_alive; struct sh_css my_css; -int (*sh_css_printf)(const char *fmt, va_list args) = NULL; +int __printf(1, 0) (*sh_css_printf)(const char *fmt, va_list args) = NULL; /* modes of work: stream_create and stream_destroy will update the save/restore data only when in working mode, not suspend/resume @@ -397,7 +393,7 @@ static int set_config_on_frame_enqueue(struct ia_css_frame_info *info, struct frame_data_wrapper *frame); #endif -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 static unsigned int get_crop_lines_for_bayer_order(const struct ia_css_stream_config *config); static unsigned int get_crop_columns_for_bayer_order(const struct @@ -533,7 +529,7 @@ ia_css_stream_input_format_bits_per_pixel(struct ia_css_stream *stream) #define GP_ISEL_TPG_MODE 0x90058 -#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) static int sh_css_config_input_network(struct ia_css_stream *stream) { unsigned int fmt_type; @@ -594,7 +590,7 @@ sh_css_config_input_network(struct ia_css_stream *stream) { "sh_css_config_input_network() leave:\n"); return 0; } -#elif !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2401) +#elif defined(ISP2401) static unsigned int csi2_protocol_calculate_max_subpixels_per_line( enum atomisp_input_format format, unsigned int pixels_per_line) @@ -894,7 +890,7 @@ static bool sh_css_translate_stream_cfg_to_input_system_input_port_attr( stream_cfg->source.port.num_lanes; isys_stream_descr->csi_port_attr.fmt_type = fmt_type; isys_stream_descr->csi_port_attr.ch_id = stream_cfg->channel_id; -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 isys_stream_descr->online = stream_cfg->online; #endif err |= ia_css_isys_convert_compressed_format( @@ -919,7 +915,7 @@ static bool sh_css_translate_stream_cfg_to_input_system_input_port_attr( stream_cfg->metadata_config.resolution.width; isys_stream_descr->metadata.lines_per_frame = stream_cfg->metadata_config.resolution.height; -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 /* For new input system, number of str2mmio requests must be even. * So we round up number of metadata lines to be even. */ if (isys_stream_descr->metadata.lines_per_frame > 0) @@ -1367,20 +1363,8 @@ static void start_binary(struct ia_css_pipe *pipe, struct ia_css_binary *binary) { - struct ia_css_stream *stream; - assert(pipe); /* Acceleration uses firmware, the binary thus can be NULL */ - /* assert(binary != NULL); */ - - (void)binary; - -#if !defined(HAS_NO_INPUT_SYSTEM) - stream = pipe->stream; -#else - (void)pipe; - (void)stream; -#endif if (binary) sh_css_metrics_start_binary(&binary->metrics); @@ -1395,11 +1379,11 @@ start_binary(struct ia_css_pipe *pipe, sh_binary_running = true; #endif -#if !defined(HAS_NO_INPUT_SYSTEM) && !defined(USE_INPUT_SYSTEM_VERSION_2401) - if (stream->reconfigure_css_rx) { +#if !defined(ISP2401) + if (pipe->stream->reconfigure_css_rx) { ia_css_isys_rx_configure(&pipe->stream->csi_rx_config, pipe->stream->config.mode); - stream->reconfigure_css_rx = false; + pipe->stream->reconfigure_css_rx = false; } #endif } @@ -1415,7 +1399,7 @@ start_copy_on_sp(struct ia_css_pipe *pipe, if ((!pipe) || (!pipe->stream)) return -EINVAL; -#if !defined(HAS_NO_INPUT_SYSTEM) && !defined(USE_INPUT_SYSTEM_VERSION_2401) +#if !defined(ISP2401) if (pipe->stream->reconfigure_css_rx) ia_css_isys_rx_disable(); #endif @@ -1424,7 +1408,7 @@ start_copy_on_sp(struct ia_css_pipe *pipe, return -EINVAL; sh_css_sp_start_binary_copy(ia_css_pipe_get_pipe_num(pipe), out_frame, pipe->stream->config.pixels_per_clock == 2); -#if !defined(HAS_NO_INPUT_SYSTEM) && !defined(USE_INPUT_SYSTEM_VERSION_2401) +#if !defined(ISP2401) if (pipe->stream->reconfigure_css_rx) { ia_css_isys_rx_configure(&pipe->stream->csi_rx_config, @@ -1461,9 +1445,6 @@ static void start_pipe( const struct ia_css_coordinate *coord = NULL; const struct ia_css_isp_parameters *params = NULL; -#if defined(HAS_NO_INPUT_SYSTEM) - (void)input_mode; -#endif IA_CSS_ENTER_PRIVATE("me = %p, copy_ovrd = %d, input_mode = %d", me, copy_ovrd, input_mode); @@ -1487,11 +1468,9 @@ static void start_pipe( input_mode, &me->stream->config.metadata_config, &me->stream->info.metadata_info -#if !defined(HAS_NO_INPUT_SYSTEM) , (input_mode == IA_CSS_INPUT_MODE_MEMORY) ? (enum mipi_port_id)0 : me->stream->config.source.port.port, -#endif coord, params); @@ -1529,7 +1508,7 @@ sh_css_invalidate_shading_tables(struct ia_css_stream *stream) static void enable_interrupts(enum ia_css_irq_type irq_type) { -#ifdef USE_INPUT_SYSTEM_VERSION_2 +#ifndef ISP2401 enum mipi_port_id port; #endif bool enable_pulse = irq_type != IA_CSS_IRQ_TYPE_EDGE; @@ -1551,15 +1530,8 @@ enable_interrupts(enum ia_css_irq_type irq_type) cnd_virq_enable_channel( (enum virq_id)(IRQ_SW_CHANNEL1_ID + IRQ_SW_CHANNEL_OFFSET), true); -#if !defined(HAS_IRQ_MAP_VERSION_2) - /* IRQ_SW_CHANNEL2_ID does not exist on 240x systems */ - cnd_virq_enable_channel( - (enum virq_id)(IRQ_SW_CHANNEL2_ID + IRQ_SW_CHANNEL_OFFSET), - true); - virq_clear_all(); -#endif -#ifdef USE_INPUT_SYSTEM_VERSION_2 +#ifndef ISP2401 for (port = 0; port < N_MIPI_PORT_ID; port++) ia_css_isys_rx_enable_all_interrupts(port); #endif @@ -1832,15 +1804,10 @@ ia_css_init(struct device *dev, const struct ia_css_env *env, sh_css_init_buffer_queues(); */ -#if defined(HAS_INPUT_SYSTEM_VERSION_2) && defined(HAS_INPUT_SYSTEM_VERSION_2401) -#if defined(USE_INPUT_SYSTEM_VERSION_2) - gp_device_reg_store(GP_DEVICE0_ID, _REG_GP_SWITCH_ISYS2401_ADDR, 0); -#elif defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) gp_device_reg_store(GP_DEVICE0_ID, _REG_GP_SWITCH_ISYS2401_ADDR, 1); #endif -#endif -#if !defined(HAS_NO_INPUT_SYSTEM) if (!IS_ISP2401) dma_set_max_burst_size(DMA0_ID, HIVE_DMA_BUS_DDR_CONN, @@ -1851,7 +1818,6 @@ ia_css_init(struct device *dev, const struct ia_css_env *env, if (ia_css_isys_init() != INPUT_SYSTEM_ERR_NO_ERROR) err = -EINVAL; -#endif sh_css_params_map_and_store_default_gdc_lut(); @@ -2103,7 +2069,7 @@ create_host_pipeline(struct ia_css_stream *stream) { } } -#if defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) /* old isys: need to allocate_mipi_frames() even in IA_CSS_PIPE_MODE_COPY */ if (pipe_id != IA_CSS_PIPE_ID_ACC) { @@ -2111,7 +2077,7 @@ create_host_pipeline(struct ia_css_stream *stream) { if (err) goto ERR; } -#elif defined(USE_INPUT_SYSTEM_VERSION_2401) +#elif defined(ISP2401) if ((pipe_id != IA_CSS_PIPE_ID_ACC) && (main_pipe->config.mode != IA_CSS_PIPE_MODE_COPY)) { @@ -2525,7 +2491,7 @@ ia_css_uninit(void) ia_css_rmgr_uninit(); -#if !defined(HAS_NO_INPUT_FORMATTER) +#if !defined(ISP2401) /* needed for reprogramming the inputformatter after power cycle of css */ ifmtr_set_if_blocking_mode_reset = true; #endif @@ -2535,21 +2501,16 @@ ia_css_uninit(void) } ia_css_spctrl_unload_fw(SP0_ID); sh_css_sp_set_sp_running(false); -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) /* check and free any remaining mipi frames */ free_mipi_frames(NULL); -#endif sh_css_sp_reset_global_vars(); -#if !defined(HAS_NO_INPUT_SYSTEM) ia_css_isys_uninit(); -#endif ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "ia_css_uninit() leave: return_void\n"); } -#if defined(HAS_IRQ_MAP_VERSION_2) int ia_css_irq_translate( unsigned int *irq_infos) { @@ -2581,7 +2542,6 @@ int ia_css_irq_translate( break; case virq_isp: break; -#if !defined(HAS_NO_INPUT_SYSTEM) case virq_isys_sof: infos |= IA_CSS_IRQ_INFO_CSS_RECEIVER_SOF; break; @@ -2591,8 +2551,7 @@ int ia_css_irq_translate( case virq_isys_csi: infos |= IA_CSS_IRQ_INFO_INPUT_SYSTEM_ERROR; break; -#endif -#if !defined(HAS_NO_INPUT_FORMATTER) +#if !defined(ISP2401) case virq_ifmt0_id: infos |= IA_CSS_IRQ_INFO_IF_ERROR; break; @@ -2631,7 +2590,7 @@ int ia_css_irq_enable( IA_CSS_ENTER("info=%d, enable=%d", info, enable); switch (info) { -#if !defined(HAS_NO_INPUT_FORMATTER) +#if !defined(ISP2401) case IA_CSS_IRQ_INFO_CSS_RECEIVER_SOF: irq = virq_isys_sof; break; @@ -2672,9 +2631,6 @@ int ia_css_irq_enable( return 0; } -#else -#error "sh_css.c: IRQ MAP must be one of { IRQ_MAP_VERSION_2 }" -#endif static unsigned int sh_css_get_sw_interrupt_value(unsigned int irq) @@ -2736,7 +2692,6 @@ alloc_continuous_frames( bool continuous; unsigned int i, idx; unsigned int num_frames; - struct ia_css_pipe *capture_pipe = NULL; IA_CSS_ENTER_PRIVATE("pipe = %p, init_time = %d", pipe, init_time); @@ -2774,7 +2729,7 @@ alloc_continuous_frames( return -EINVAL; } -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) /* For CSI2+, the continuous frame will hold the full input frame */ ref_info.res.width = pipe->stream->config.input_config.input_res.width; ref_info.res.height = pipe->stream->config.input_config.input_res.height; @@ -2798,17 +2753,12 @@ alloc_continuous_frames( } /* Write format back to binary */ - if (pipe_id == IA_CSS_PIPE_ID_PREVIEW) - { + if (pipe_id == IA_CSS_PIPE_ID_PREVIEW) { pipe->pipe_settings.preview.preview_binary.in_frame_info.format = ref_info.format; - capture_pipe = pipe->pipe_settings.preview.capture_pipe; - } else if (pipe_id == IA_CSS_PIPE_ID_VIDEO) - { + } else if (pipe_id == IA_CSS_PIPE_ID_VIDEO) { pipe->pipe_settings.video.video_binary.in_frame_info.format = ref_info.format; - capture_pipe = pipe->pipe_settings.video.capture_pipe; - } else - { + } else { /* should not happen */ IA_CSS_LEAVE_ERR_PRIVATE(-EINVAL); return -EINVAL; @@ -2865,10 +2815,12 @@ load_preview_binaries(struct ia_css_pipe *pipe) { struct ia_css_binary_descr preview_descr; bool online; int err = 0; - bool continuous, need_vf_pp = false; + bool need_vf_pp = false; bool need_isp_copy_binary = false; -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 bool sensor = false; +#else + bool continuous; #endif /* preview only have 1 output pin now */ struct ia_css_frame_info *pipe_out_info = &pipe->output_info[0]; @@ -2880,9 +2832,10 @@ load_preview_binaries(struct ia_css_pipe *pipe) { assert(pipe->mode == IA_CSS_PIPE_ID_PREVIEW); online = pipe->stream->config.online; - continuous = pipe->stream->config.continuous; -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 sensor = pipe->stream->config.mode == IA_CSS_INPUT_MODE_SENSOR; +#else + continuous = pipe->stream->config.continuous; #endif if (mycs->preview_binary.info) @@ -3002,7 +2955,7 @@ load_preview_binaries(struct ia_css_pipe *pipe) { return err; } -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 /* When the input system is 2401, only the Direct Sensor Mode * Offline Preview uses the ISP copy binary. */ @@ -3343,7 +3296,7 @@ init_vf_frameinfo_defaults(struct ia_css_pipe *pipe, return err; } -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 static unsigned int get_crop_lines_for_bayer_order( const struct ia_css_stream_config *config) @@ -3500,7 +3453,7 @@ init_in_frameinfo_memory_defaults(struct ia_css_pipe *pipe, in_frame->info.format = format; -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 if (format == IA_CSS_FRAME_FORMAT_RAW) in_frame->info.format = (pipe->stream->config.pack_raw_pixels) ? IA_CSS_FRAME_FORMAT_RAW_PACKED : IA_CSS_FRAME_FORMAT_RAW; @@ -3517,7 +3470,7 @@ init_in_frameinfo_memory_defaults(struct ia_css_pipe *pipe, ia_css_query_internal_queue_id(IA_CSS_BUFFER_TYPE_INPUT_FRAME, thread_id, &queue_id); in_frame->dynamic_queue_id = queue_id; in_frame->buf_type = IA_CSS_BUFFER_TYPE_INPUT_FRAME; -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 ia_css_get_crop_offsets(pipe, &in_frame->info); #endif err = ia_css_frame_init_planes(in_frame); @@ -3568,7 +3521,6 @@ static int create_host_video_pipeline(struct ia_css_pipe *pipe) bool need_copy = false; bool need_vf_pp = false; bool need_yuv_pp = false; - unsigned int num_output_pins; bool need_in_frameinfo_memory = false; unsigned int i, num_yuv_scaler; @@ -3588,7 +3540,7 @@ static int create_host_video_pipeline(struct ia_css_pipe *pipe) me->dvs_frame_delay = pipe->dvs_frame_delay; -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 /* When the input system is 2401, always enable 'in_frameinfo_memory' * except for the following: online or continuous */ @@ -3625,7 +3577,6 @@ static int create_host_video_pipeline(struct ia_css_pipe *pipe) copy_binary = &pipe->pipe_settings.video.copy_binary; video_binary = &pipe->pipe_settings.video.video_binary; vf_pp_binary = &pipe->pipe_settings.video.vf_pp_binary; - num_output_pins = video_binary->info->num_output_pins; yuv_scaler_binary = pipe->pipe_settings.video.yuv_scaler_binary; num_yuv_scaler = pipe->pipe_settings.video.num_yuv_scaler; @@ -3646,7 +3597,7 @@ static int create_host_video_pipeline(struct ia_css_pipe *pipe) goto ERR; in_frame = me->stages->args.out_frame[0]; } else if (pipe->stream->config.continuous) { -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 /* When continuous is enabled, configure in_frame with the * last pipe, which is the copy pipe. */ @@ -3733,7 +3684,7 @@ static int create_host_video_pipeline(struct ia_css_pipe *pipe) struct ia_css_frame *tmp_out_frame = NULL; for (i = 0; i < num_yuv_scaler; i++) { - if (is_output_stage[i] == true) { + if (is_output_stage[i]) { tmp_out_frame = out_frame; } else { tmp_out_frame = NULL; @@ -3818,7 +3769,7 @@ create_host_preview_pipeline(struct ia_css_pipe *pipe) { struct ia_css_frame *out_frame; struct ia_css_frame *out_frames[IA_CSS_BINARY_MAX_OUTPUT_PORTS]; bool need_in_frameinfo_memory = false; -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 bool sensor = false; bool buffered_sensor = false; bool online = false; @@ -3837,7 +3788,7 @@ create_host_preview_pipeline(struct ia_css_pipe *pipe) { me = &pipe->pipeline; ia_css_pipeline_clean(me); -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 /* When the input system is 2401, always enable 'in_frameinfo_memory' * except for the following: * - Direct Sensor Mode Online Preview @@ -3889,14 +3840,8 @@ create_host_preview_pipeline(struct ia_css_pipe *pipe) { if (err) goto ERR; in_frame = me->stages->args.out_frame[0]; -#ifndef ISP2401 - } else - { -#else - } else if (pipe->stream->config.continuous) - { -#endif -#ifdef USE_INPUT_SYSTEM_VERSION_2401 + } else if (pipe->stream->config.continuous) { +#ifdef ISP2401 /* When continuous is enabled, configure in_frame with the * last pipe, which is the copy pipe. */ @@ -3976,8 +3921,6 @@ static void send_raw_frames(struct ia_css_pipe *pipe) static int preview_start(struct ia_css_pipe *pipe) { - struct ia_css_pipeline *me; - struct ia_css_binary *copy_binary, *preview_binary, *vf_pp_binary = NULL; int err = 0; struct ia_css_pipe *copy_pipe, *capture_pipe; struct ia_css_pipe *acc_pipe; @@ -3993,29 +3936,20 @@ preview_start(struct ia_css_pipe *pipe) { return -EINVAL; } - me = &pipe->pipeline; - preview_pipe_input_mode = pipe->stream->config.mode; copy_pipe = pipe->pipe_settings.preview.copy_pipe; capture_pipe = pipe->pipe_settings.preview.capture_pipe; acc_pipe = pipe->pipe_settings.preview.acc_pipe; - copy_binary = &pipe->pipe_settings.preview.copy_binary; - preview_binary = &pipe->pipe_settings.preview.preview_binary; - if (pipe->pipe_settings.preview.vf_pp_binary.info) - vf_pp_binary = &pipe->pipe_settings.preview.vf_pp_binary; - sh_css_metrics_start_frame(); -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) /* multi stream video needs mipi buffers */ err = send_mipi_frames(pipe); if (err) { IA_CSS_LEAVE_ERR_PRIVATE(err); return err; } -#endif send_raw_frames(pipe); { @@ -4050,9 +3984,7 @@ preview_start(struct ia_css_pipe *pipe) { pipe->stream->config.mode, &pipe->stream->config.metadata_config, &pipe->stream->info.metadata_info, -#if !defined(HAS_NO_INPUT_SYSTEM) pipe->stream->config.source.port.port, -#endif coord, params); @@ -4076,9 +4008,7 @@ preview_start(struct ia_css_pipe *pipe) { IA_CSS_INPUT_MODE_MEMORY, &pipe->stream->config.metadata_config, &pipe->stream->info.metadata_info, -#if !defined(HAS_NO_INPUT_SYSTEM) (enum mipi_port_id)0, -#endif coord, params); } @@ -4097,9 +4027,7 @@ preview_start(struct ia_css_pipe *pipe) { IA_CSS_INPUT_MODE_MEMORY, NULL, NULL, -#if !defined(HAS_NO_INPUT_SYSTEM) (enum mipi_port_id)0, -#endif coord, params); } @@ -4496,8 +4424,8 @@ ia_css_pipe_dequeue_buffer(struct ia_css_pipe *pipe, case IA_CSS_BUFFER_TYPE_INPUT_FRAME: case IA_CSS_BUFFER_TYPE_OUTPUT_FRAME: case IA_CSS_BUFFER_TYPE_SEC_OUTPUT_FRAME: - if ((pipe) && (pipe->stop_requested == true)) { -#if defined(USE_INPUT_SYSTEM_VERSION_2) + if (pipe && pipe->stop_requested) { +#if !defined(ISP2401) /* free mipi frames only for old input system * for 2401 it is done in ia_css_stream_destroy call */ @@ -4529,7 +4457,7 @@ ia_css_pipe_dequeue_buffer(struct ia_css_pipe *pipe, pipe->num_invalid_frames--; if (frame->info.format == IA_CSS_FRAME_FORMAT_BINARY_8) { -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 frame->planes.binary.size = frame->data_bytes; #else frame->planes.binary.size = @@ -4857,7 +4785,7 @@ sh_css_pipe_start(struct ia_css_stream *stream) { pipe_id = pipe->mode; - if (stream->started == true) + if (stream->started) { IA_CSS_WARNING("Cannot start stream that is already started"); IA_CSS_LEAVE_ERR(err); @@ -5142,24 +5070,23 @@ sh_css_pipes_stop(struct ia_css_stream *stream) stream->pipes[i]->pipeline.pipe_id); err = ia_css_pipeline_request_stop(&stream->pipes[i]->pipeline); - /* - * Exit this loop if "ia_css_pipeline_request_stop()" - * returns the error code. - * - * The error code would be generated in the following - * two cases: - * (1) The Scalar Processor has already been stopped. - * (2) The "Host->SP" event queue is full. - * - * As the convention of using CSS API 2.0/2.1, such CSS - * error code would be propogated from the CSS-internal - * API returned value to the CSS API returned value. Then - * the CSS driver should capture these error code and - * handle it in the driver exception handling mechanism. - */ - if (err) { - goto ERR; - } + /* + * Exit this loop if "ia_css_pipeline_request_stop()" + * returns the error code. + * + * The error code would be generated in the following + * two cases: + * (1) The Scalar Processor has already been stopped. + * (2) The "Host->SP" event queue is full. + * + * As the convention of using CSS API 2.0/2.1, such CSS + * error code would be propogated from the CSS-internal + * API returned value to the CSS API returned value. Then + * the CSS driver should capture these error code and + * handle it in the driver exception handling mechanism. + */ + if (err) + goto ERR; } /* @@ -5286,7 +5213,7 @@ RET: return rval; } -#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) unsigned int sh_css_get_mipi_sizes_for_check(const unsigned int port, const unsigned int idx) { @@ -5413,13 +5340,7 @@ sh_css_pipe_get_grid_info(struct ia_css_pipe *pipe, info->isp_in_height = binary->internal_frame_info.res.height; } -#if defined(HAS_VAMEM_VERSION_2) info->vamem_type = IA_CSS_VAMEM_TYPE_2; -#elif defined(HAS_VAMEM_VERSION_1) - info->vamem_type = IA_CSS_VAMEM_TYPE_1; -#else -#error "Unknown VAMEM version" -#endif ERR : IA_CSS_LEAVE_ERR_PRIVATE(err); @@ -5677,7 +5598,7 @@ static int load_video_binaries(struct ia_css_pipe *pipe) pipe->num_invalid_frames, pipe->dvs_frame_delay); /* pqiao TODO: temp hack for PO, should be removed after offline YUVPP is enabled */ -#if !defined(USE_INPUT_SYSTEM_VERSION_2401) +#if !defined(ISP2401) /* Copy */ if (!online && !continuous) { /* TODO: what exactly needs doing, prepend the copy binary to @@ -5804,7 +5725,6 @@ unload_video_binaries(struct ia_css_pipe *pipe) { static int video_start(struct ia_css_pipe *pipe) { - struct ia_css_binary *copy_binary; int err = 0; struct ia_css_pipe *copy_pipe, *capture_pipe; enum sh_css_pipe_config_override copy_ovrd; @@ -5824,17 +5744,13 @@ static int video_start(struct ia_css_pipe *pipe) copy_pipe = pipe->pipe_settings.video.copy_pipe; capture_pipe = pipe->pipe_settings.video.capture_pipe; - copy_binary = &pipe->pipe_settings.video.copy_binary; - sh_css_metrics_start_frame(); /* multi stream video needs mipi buffers */ -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) err = send_mipi_frames(pipe); if (err) return err; -#endif send_raw_frames(pipe); { @@ -5867,9 +5783,7 @@ static int video_start(struct ia_css_pipe *pipe) pipe->stream->config.mode, &pipe->stream->config.metadata_config, &pipe->stream->info.metadata_info, -#if !defined(HAS_NO_INPUT_SYSTEM) pipe->stream->config.source.port.port, -#endif coord, params); @@ -5892,9 +5806,7 @@ static int video_start(struct ia_css_pipe *pipe) IA_CSS_INPUT_MODE_MEMORY, &pipe->stream->config.metadata_config, &pipe->stream->info.metadata_info, -#if !defined(HAS_NO_INPUT_SYSTEM) (enum mipi_port_id)0, -#endif coord, params); } @@ -6010,7 +5922,7 @@ static bool need_capture_pp( if (IS_ISP2401) { /* ldc and capture_pp are not supported in the same pipeline */ - if (need_capt_ldc(pipe) == true) + if (need_capt_ldc(pipe)) return false; } @@ -6073,13 +5985,13 @@ static int load_primary_binaries( struct ia_css_pipe *pipe) { bool online = false; - bool memory = false; - bool continuous = false; bool need_pp = false; bool need_isp_copy_binary = false; bool need_ldc = false; -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 bool sensor = false; +#else + bool memory, continuous; #endif struct ia_css_frame_info prim_in_info, prim_out_info, @@ -6100,10 +6012,11 @@ static int load_primary_binaries( pipe->mode == IA_CSS_PIPE_ID_COPY); online = pipe->stream->config.online; +#ifdef ISP2401 + sensor = (pipe->stream->config.mode == IA_CSS_INPUT_MODE_SENSOR); +#else memory = pipe->stream->config.mode == IA_CSS_INPUT_MODE_MEMORY; continuous = pipe->stream->config.continuous; -#ifdef USE_INPUT_SYSTEM_VERSION_2401 - sensor = (pipe->stream->config.mode == IA_CSS_INPUT_MODE_SENSOR); #endif mycs = &pipe->pipe_settings.capture; @@ -6230,8 +6143,8 @@ static int load_primary_binaries( IA_CSS_LEAVE_ERR_PRIVATE(err); return err; } - need_pp = 0; - need_ldc = 0; + need_pp = false; + need_ldc = false; } /* we build up the pipeline starting at the end */ @@ -6320,7 +6233,7 @@ static int load_primary_binaries( if (err) return err; -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 /* When the input system is 2401, only the Direct Sensor Mode * Offline Capture uses the ISP copy binary. */ @@ -6534,7 +6447,7 @@ static int load_advanced_binaries( } /* Copy */ -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 /* For CSI2+, only the direct sensor mode/online requires ISP copy */ need_isp_copy = pipe->stream->config.mode == IA_CSS_INPUT_MODE_SENSOR; #endif @@ -6681,7 +6594,7 @@ static int load_low_light_binaries( } /* Copy */ -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 /* For CSI2+, only the direct sensor mode/online requires ISP copy */ need_isp_copy = pipe->stream->config.mode == IA_CSS_INPUT_MODE_SENSOR; #endif @@ -6754,7 +6667,7 @@ static int load_capture_binaries( switch (pipe->config.default_capture_config.mode) { case IA_CSS_CAPTURE_MODE_RAW: err = load_copy_binaries(pipe); -#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) if (!err) pipe->pipe_settings.capture.copy_binary.online = pipe->stream->config.online; #endif @@ -7246,7 +7159,7 @@ load_yuvpp_binaries(struct ia_css_pipe *pipe) { next_binary = NULL; } -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) /* * NOTES * - Why does the "yuvpp" pipe needs "isp_copy_binary" (i.e. ISP Copy) when @@ -7266,9 +7179,9 @@ load_yuvpp_binaries(struct ia_css_pipe *pipe) { */ need_isp_copy_binary = (pipe->stream->config.input_config.format == ATOMISP_INPUT_FORMAT_YUV422_8); -#else /* !USE_INPUT_SYSTEM_VERSION_2401 */ +#else /* !ISP2401 */ need_isp_copy_binary = true; -#endif /* USE_INPUT_SYSTEM_VERSION_2401 */ +#endif /* ISP2401 */ if (need_isp_copy_binary) { @@ -7390,7 +7303,6 @@ unload_yuvpp_binaries(struct ia_css_pipe *pipe) { static int yuvpp_start(struct ia_css_pipe *pipe) { - struct ia_css_binary *copy_binary; int err = 0; enum sh_css_pipe_config_override copy_ovrd; enum ia_css_input_mode yuvpp_pipe_input_mode; @@ -7403,19 +7315,15 @@ static int yuvpp_start(struct ia_css_pipe *pipe) yuvpp_pipe_input_mode = pipe->stream->config.mode; - copy_binary = &pipe->pipe_settings.yuvpp.copy_binary; - sh_css_metrics_start_frame(); /* multi stream video needs mipi buffers */ -#if !defined(HAS_NO_INPUT_SYSTEM) && (defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401)) err = send_mipi_frames(pipe); if (err) { IA_CSS_LEAVE_ERR_PRIVATE(err); return err; } -#endif { unsigned int thread_id; @@ -7522,7 +7430,7 @@ create_host_yuvpp_pipeline(struct ia_css_pipe *pipe) { *vf_pp_binary, *yuv_scaler_binary; bool need_scaler = false; - unsigned int num_stage, num_vf_pp_stage, num_output_stage; + unsigned int num_stage, num_output_stage; unsigned int i, j; struct ia_css_frame *in_frame = NULL; @@ -7531,7 +7439,7 @@ create_host_yuvpp_pipeline(struct ia_css_pipe *pipe) { struct ia_css_frame *vf_frame[IA_CSS_PIPE_MAX_OUTPUT_STAGE]; struct ia_css_pipeline_stage_desc stage_desc; bool need_in_frameinfo_memory = false; -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 bool sensor = false; bool buffered_sensor = false; bool online = false; @@ -7553,10 +7461,9 @@ create_host_yuvpp_pipeline(struct ia_css_pipe *pipe) { } ia_css_pipe_util_create_output_frames(bin_out_frame); num_stage = pipe->pipe_settings.yuvpp.num_yuv_scaler; - num_vf_pp_stage = pipe->pipe_settings.yuvpp.num_vf_pp; num_output_stage = pipe->pipe_settings.yuvpp.num_output; -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 /* When the input system is 2401, always enable 'in_frameinfo_memory' * except for the following: * - Direct Sensor Mode Online Capture @@ -7663,7 +7570,7 @@ create_host_yuvpp_pipeline(struct ia_css_pipe *pipe) { { struct ia_css_frame *in_frame_local = NULL; -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 /* After isp copy is enabled in_frame needs to be passed. */ if (!online) in_frame_local = in_frame; @@ -7880,7 +7787,7 @@ create_host_regular_capture_pipeline(struct ia_css_pipe *pipe) { struct ia_css_frame *vf_frame; struct ia_css_pipeline_stage_desc stage_desc; bool need_in_frameinfo_memory = false; -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 bool sensor = false; bool buffered_sensor = false; bool online = false; @@ -7902,7 +7809,7 @@ create_host_regular_capture_pipeline(struct ia_css_pipe *pipe) { ia_css_pipeline_clean(me); ia_css_pipe_util_create_output_frames(out_frames); -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 /* When the input system is 2401, always enable 'in_frameinfo_memory' * except for the following: * - Direct Sensor Mode Online Capture @@ -7989,7 +7896,7 @@ create_host_regular_capture_pipeline(struct ia_css_pipe *pipe) { { if (raw) { ia_css_pipe_util_set_output_frames(out_frames, 0, out_frame); -#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) if (!continuous) { ia_css_pipe_get_generic_stage_desc(&stage_desc, copy_binary, out_frames, in_frame, NULL); @@ -8256,14 +8163,14 @@ static int capture_start( } } -#if defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) /* old isys: need to send_mipi_frames() in all pipe modes */ err = send_mipi_frames(pipe); if (err) { IA_CSS_LEAVE_ERR_PRIVATE(err); return err; } -#elif defined(USE_INPUT_SYSTEM_VERSION_2401) +#elif defined(ISP2401) if (pipe->config.mode != IA_CSS_PIPE_MODE_COPY) { err = send_mipi_frames(pipe); if (err) { @@ -8282,7 +8189,7 @@ static int capture_start( } start_pipe(pipe, copy_ovrd, pipe->stream->config.mode); -#if !defined(HAS_NO_INPUT_SYSTEM) && !defined(USE_INPUT_SYSTEM_VERSION_2401) +#if !defined(ISP2401) /* * old isys: for IA_CSS_PIPE_MODE_COPY pipe, isys rx has to be configured, * which is currently done in start_binary(); but COPY pipe contains no binary, @@ -8332,7 +8239,6 @@ sh_css_pipe_get_output_frame_info(struct ia_css_pipe *pipe, return 0; } -#if !defined(HAS_NO_INPUT_SYSTEM) void ia_css_stream_send_input_frame(const struct ia_css_stream *stream, const unsigned short *data, @@ -8387,7 +8293,6 @@ ia_css_stream_end_input_frame(const struct ia_css_stream *stream) { ia_css_inputfifo_end_frame(stream->config.channel_id); } -#endif static void append_firmware(struct ia_css_fw_info **l, struct ia_css_fw_info *firmware) { @@ -8714,9 +8619,7 @@ sh_css_init_host_sp_control_vars(void) { unsigned int o = offsetof(struct host_sp_communication, host2sp_command) / sizeof(int); -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) unsigned int i; -#endif ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, "sh_css_init_host_sp_control_vars() enter: void\n"); @@ -8762,12 +8665,10 @@ sh_css_init_host_sp_control_vars(void) { #endif store_sp_array_uint(host_sp_com, o, host2sp_cmd_ready); -#if !defined(HAS_NO_INPUT_SYSTEM) for (i = 0; i < N_CSI_PORTS; i++) { sh_css_update_host2sp_num_mipi_frames (my_css.num_mipi_frames[i]); } -#endif ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, "sh_css_init_host_sp_control_vars() leave: return_void\n"); @@ -8839,47 +8740,27 @@ ia_css_acc_pipe_create(struct ia_css_pipe *pipe) { return err; } -int -ia_css_pipe_create(const struct ia_css_pipe_config *config, - struct ia_css_pipe **pipe) { -#ifndef ISP2401 - if (!config) -#else +int ia_css_pipe_create(const struct ia_css_pipe_config *config, + struct ia_css_pipe **pipe) +{ int err = 0; IA_CSS_ENTER_PRIVATE("config = %p, pipe = %p", config, pipe); - if (!config) - { + if (!config || !pipe) { IA_CSS_LEAVE_ERR_PRIVATE(-EINVAL); -#endif return -EINVAL; -#ifndef ISP2401 - if (!pipe) -#else -} - -if (!pipe) -{ - IA_CSS_LEAVE_ERR_PRIVATE(-EINVAL); -#endif - return -EINVAL; -#ifndef ISP2401 - return ia_css_pipe_create_extra(config, NULL, pipe); -#else -} + } -err = ia_css_pipe_create_extra(config, NULL, pipe); + err = ia_css_pipe_create_extra(config, NULL, pipe); -if (err == 0) -{ - IA_CSS_LOG("pipe created successfully = %p", *pipe); -} + if (err == 0) { + IA_CSS_LOG("pipe created successfully = %p", *pipe); + } -IA_CSS_LEAVE_ERR_PRIVATE(err); + IA_CSS_LEAVE_ERR_PRIVATE(err); -return err; -#endif + return err; } int @@ -9135,7 +9016,7 @@ ia_css_pipe_override_frame_format(struct ia_css_pipe *pipe, return err; } -#if defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) /* Configuration of INPUT_SYSTEM_VERSION_2401 is done on SP */ static int ia_css_stream_configure_rx(struct ia_css_stream *stream) { @@ -9325,7 +9206,7 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, int err = -EINVAL; struct ia_css_metadata_info md_info; struct ia_css_resolution effective_res; -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 bool aspect_ratio_crop_enabled = false; #endif @@ -9342,7 +9223,7 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, return err; } -#if defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) /* We don't support metadata for JPEG stream, since they both use str2mem */ if (stream_config->input_config.format == ATOMISP_INPUT_FORMAT_BINARY_8 && stream_config->metadata_config.resolution.height > 0) @@ -9353,7 +9234,7 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, } #endif -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 if (stream_config->online && stream_config->pack_raw_pixels) { IA_CSS_LOG("online and pack raw is invalid on input system 2401"); @@ -9363,12 +9244,11 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, } #endif -#if !defined(HAS_NO_INPUT_SYSTEM) ia_css_debug_pipe_graph_dump_stream_config(stream_config); /* check if mipi size specified */ if (stream_config->mode == IA_CSS_INPUT_MODE_BUFFERED_SENSOR) -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 if (!stream_config->online) #endif { @@ -9408,7 +9288,6 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, return err; } } -#endif /* Currently we only supported metadata up to a certain size. */ err = metadata_info_init(&stream_config->metadata_config, &md_info); @@ -9449,13 +9328,13 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, /* take over stream config */ curr_stream->config = *stream_config; -#if defined(USE_INPUT_SYSTEM_VERSION_2401) && defined(CSI2P_DISABLE_ISYS2401_ONLINE_MODE) +#if defined(ISP2401) if (stream_config->mode == IA_CSS_INPUT_MODE_BUFFERED_SENSOR && stream_config->online) curr_stream->config.online = false; #endif -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 if (curr_stream->config.online) { curr_stream->config.source.port.num_lanes = @@ -9479,12 +9358,12 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, { case IA_CSS_INPUT_MODE_SENSOR: case IA_CSS_INPUT_MODE_BUFFERED_SENSOR: -#if defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) ia_css_stream_configure_rx(curr_stream); #endif break; case IA_CSS_INPUT_MODE_TPG: -#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) IA_CSS_LOG("tpg_configuration: x_mask=%d, y_mask=%d, x_delta=%d, y_delta=%d, xy_mask=%d", curr_stream->config.source.tpg.x_mask, curr_stream->config.source.tpg.y_mask, @@ -9501,7 +9380,7 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, #endif break; case IA_CSS_INPUT_MODE_PRBS: -#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) IA_CSS_LOG("mode prbs"); sh_css_sp_configure_prbs(curr_stream->config.source.prbs.seed); #endif @@ -9514,14 +9393,14 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, IA_CSS_LOG("mode sensor/default"); } -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 err = aspect_ratio_crop_init(curr_stream, pipes, &aspect_ratio_crop_enabled); if (err) { IA_CSS_LEAVE_ERR(err); - return err; + goto ERR; } #endif for (i = 0; i < num_pipes; i++) @@ -9537,7 +9416,7 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, if (effective_res.height == 0 || effective_res.width == 0) { effective_res = curr_pipe->stream->config.input_config.effective_res; -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) /* The aspect ratio cropping is currently only * supported on the new input system. */ if (aspect_ratio_crop_check(aspect_ratio_crop_enabled, curr_pipe)) { @@ -9625,10 +9504,10 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, IA_CSS_PIPE_MODE_VIDEO, false); acc_pipe = find_pipe(pipes, num_pipes, IA_CSS_PIPE_MODE_ACC, false); - if (acc_pipe && num_pipes == 2 && curr_stream->cont_capt == true) + if (acc_pipe && num_pipes == 2 && curr_stream->cont_capt) curr_stream->cont_capt = false; /* preview + QoS case will not need cont_capt switch */ - if (curr_stream->cont_capt == true) { + if (curr_stream->cont_capt) { capture_pipe = find_pipe(pipes, num_pipes, IA_CSS_PIPE_MODE_CAPTURE, false); if (!capture_pipe) { @@ -9650,7 +9529,7 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, preview_pipe->pipe_settings.preview.copy_pipe = copy_pipe; copy_pipe->stream = curr_stream; } - if (preview_pipe && (curr_stream->cont_capt == true)) { + if (preview_pipe && curr_stream->cont_capt) { preview_pipe->pipe_settings.preview.capture_pipe = capture_pipe; } if (video_pipe && !video_pipe->pipe_settings.video.copy_pipe) { @@ -9661,7 +9540,7 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, video_pipe->pipe_settings.video.copy_pipe = copy_pipe; copy_pipe->stream = curr_stream; } - if (video_pipe && (curr_stream->cont_capt == true)) { + if (video_pipe && curr_stream->cont_capt) { video_pipe->pipe_settings.video.capture_pipe = capture_pipe; } if (preview_pipe && acc_pipe) { @@ -9811,7 +9690,7 @@ ia_css_stream_destroy(struct ia_css_stream *stream) { if ((stream->last_pipe) && ia_css_pipeline_is_mapped(stream->last_pipe->pipe_num)) { -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) bool free_mpi; for (i = 0; i < stream->num_pipes; i++) { @@ -10003,15 +9882,13 @@ ia_css_stream_start(struct ia_css_stream *stream) { return err; } -#if !defined(HAS_NO_INPUT_SYSTEM) -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) if ((stream->config.mode == IA_CSS_INPUT_MODE_SENSOR) || (stream->config.mode == IA_CSS_INPUT_MODE_BUFFERED_SENSOR)) stream_register_with_csi_rx(stream); #endif -#endif -#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) /* Initialize mipi size checks */ if (stream->config.mode == IA_CSS_INPUT_MODE_BUFFERED_SENSOR) { @@ -10025,14 +9902,12 @@ ia_css_stream_start(struct ia_css_stream *stream) { } #endif -#if !defined(HAS_NO_INPUT_SYSTEM) if (stream->config.mode != IA_CSS_INPUT_MODE_MEMORY) { err = sh_css_config_input_network(stream); if (err) return err; } -#endif /* !HAS_NO_INPUT_SYSTEM */ err = sh_css_pipe_start(stream); IA_CSS_LEAVE_ERR(err); @@ -10049,7 +9924,7 @@ ia_css_stream_stop(struct ia_css_stream *stream) { ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "ia_css_stream_stop: stopping %d\n", stream->last_pipe->mode); -#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) /* De-initialize mipi size checks */ if (stream->config.mode == IA_CSS_INPUT_MODE_BUFFERED_SENSOR) { @@ -10515,19 +10390,17 @@ ia_css_update_continuous_frames(struct ia_css_stream *stream) { void ia_css_pipe_map_queue(struct ia_css_pipe *pipe, bool map) { unsigned int thread_id; - enum ia_css_pipe_id pipe_id; unsigned int pipe_num; bool need_input_queue; IA_CSS_ENTER(""); assert(pipe); - pipe_id = pipe->mode; pipe_num = pipe->pipe_num; ia_css_pipeline_get_sp_thread_id(pipe_num, &thread_id); -#if defined(HAS_NO_INPUT_SYSTEM) || defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) need_input_queue = true; #else need_input_queue = pipe->stream->config.mode == IA_CSS_INPUT_MODE_MEMORY; @@ -10856,7 +10729,7 @@ ia_css_pipe_update_qos_ext_mapped_arg(struct ia_css_pipe *pipe, return err; } -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 static int aspect_ratio_crop_init(struct ia_css_stream *curr_stream, struct ia_css_pipe *pipes[], diff --git a/drivers/staging/media/atomisp/pci/sh_css_defs.h b/drivers/staging/media/atomisp/pci/sh_css_defs.h index 92d80213860f..30a84a587b2a 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_defs.h +++ b/drivers/staging/media/atomisp/pci/sh_css_defs.h @@ -397,10 +397,6 @@ RGB[0,8191],coef[-8192,8191] -> RGB[0,8191] #define SH_CSS_MAX_STAGES 8 /* primary_stage[1-6], capture_pp, vf_pp */ /* For CSI2+ input system, it requires extra paddinga from vmem */ -#ifdef CONFIG_CSI2_PLUS -#define _ISP_EXTRA_PADDING_VECS 2 -#else #define _ISP_EXTRA_PADDING_VECS 0 -#endif /* CONFIG_CSI2_PLUS */ #endif /* _SH_CSS_DEFS_H_ */ diff --git a/drivers/staging/media/atomisp/pci/sh_css_firmware.c b/drivers/staging/media/atomisp/pci/sh_css_firmware.c index d4ab15b6d1ac..db25e39bea88 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_firmware.c +++ b/drivers/staging/media/atomisp/pci/sh_css_firmware.c @@ -51,9 +51,11 @@ struct fw_param { static struct firmware_header *firmware_header; -/* The string STR is a place holder +/* + * The string STR is a place holder * which will be replaced with the actual RELEASE_VERSION - * during package generation. Please do not modify */ + * during package generation. Please do not modify + */ static const char *isp2400_release_version = STR(irci_stable_candrpv_0415_20150521_0458); static const char *isp2401_release_version = STR(irci_ecr - master_20150911_0724); @@ -78,7 +80,8 @@ char *sh_css_get_fw_version(void) /* Setup sp/sp1 binary */ static int setup_binary(struct ia_css_fw_info *fw, const char *fw_data, - struct ia_css_fw_info *sh_css_fw, unsigned int binary_id) { + struct ia_css_fw_info *sh_css_fw, unsigned int binary_id) +{ const char *blob_data; if ((!fw) || (!fw_data)) @@ -102,7 +105,8 @@ setup_binary(struct ia_css_fw_info *fw, const char *fw_data, int sh_css_load_blob_info(const char *fw, const struct ia_css_fw_info *bi, struct ia_css_blob_descr *bd, - unsigned int index) { + unsigned int index) +{ const char *name; const unsigned char *blob; @@ -110,14 +114,16 @@ sh_css_load_blob_info(const char *fw, const struct ia_css_fw_info *bi, return -EINVAL; /* Special case: only one binary in fw */ - if (!bi) bi = (const struct ia_css_fw_info *)fw; + if (!bi) + bi = (const struct ia_css_fw_info *)fw; name = fw + bi->blob.prog_name_offset; blob = (const unsigned char *)fw + bi->blob.offset; /* sanity check */ - if (bi->blob.size != bi->blob.text_size + bi->blob.icache_size + bi->blob.data_size + bi->blob.padding_size) - { + if (bi->blob.size != + bi->blob.text_size + bi->blob.icache_size + + bi->blob.data_size + bi->blob.padding_size) { /* sanity check, note the padding bytes added for section to DDR alignment */ return -EINVAL; } @@ -128,21 +134,18 @@ sh_css_load_blob_info(const char *fw, const struct ia_css_fw_info *bi, bd->blob = blob; bd->header = *bi; - if (bi->type == ia_css_isp_firmware || bi->type == ia_css_sp_firmware) - { + if (bi->type == ia_css_isp_firmware || bi->type == ia_css_sp_firmware) { char *namebuffer; namebuffer = kstrdup(name, GFP_KERNEL); if (!namebuffer) return -ENOMEM; bd->name = fw_minibuffer[index].name = namebuffer; - } else - { + } else { bd->name = name; } - if (bi->type == ia_css_isp_firmware) - { + if (bi->type == ia_css_isp_firmware) { size_t paramstruct_size = sizeof(struct ia_css_memory_offsets); size_t configstruct_size = sizeof(struct ia_css_config_memory_offsets); size_t statestruct_size = sizeof(struct ia_css_state_memory_offsets); @@ -204,7 +207,7 @@ sh_css_check_firmware_version(struct device *dev, const char *fw_data) } /* For now, let's just accept a wrong version, even if wrong */ - return 0; + return false; } static const char * const fw_type_name[] = { @@ -223,7 +226,8 @@ static const char * const fw_acc_type_name[] = { int sh_css_load_firmware(struct device *dev, const char *fw_data, - unsigned int fw_size) { + unsigned int fw_size) +{ unsigned int i; struct ia_css_fw_info *binaries; struct sh_css_fw_bi_file_h *file_header; @@ -238,7 +242,8 @@ sh_css_load_firmware(struct device *dev, const char *fw_data, firmware_header = (struct firmware_header *)fw_data; file_header = &firmware_header->file_header; binaries = &firmware_header->binary_header; - strscpy(FW_rel_ver_name, file_header->version, min(sizeof(FW_rel_ver_name), sizeof(file_header->version))); + strscpy(FW_rel_ver_name, file_header->version, + min(sizeof(FW_rel_ver_name), sizeof(file_header->version))); ret = sh_css_check_firmware_version(dev, fw_data); if (ret) { IA_CSS_ERROR("CSS code version (%s) and firmware version (%s) mismatch!", @@ -257,8 +262,7 @@ sh_css_load_firmware(struct device *dev, const char *fw_data, sh_css_num_binaries = file_header->binary_nr; /* Only allocate memory for ISP blob info */ - if (sh_css_num_binaries > NUM_OF_SPS) - { + if (sh_css_num_binaries > NUM_OF_SPS) { sh_css_blob_info = kmalloc( (sh_css_num_binaries - NUM_OF_SPS) * sizeof(*sh_css_blob_info), GFP_KERNEL); @@ -273,13 +277,13 @@ sh_css_load_firmware(struct device *dev, const char *fw_data, if (!fw_minibuffer) return -ENOMEM; - for (i = 0; i < sh_css_num_binaries; i++) - { + for (i = 0; i < sh_css_num_binaries; i++) { struct ia_css_fw_info *bi = &binaries[i]; - /* note: the var below is made static as it is quite large; - if it is not static it ends up on the stack which could - cause issues for drivers - */ + /* + * note: the var below is made static as it is quite large; + * if it is not static it ends up on the stack which could + * cause issues for drivers + */ static struct ia_css_blob_descr bd; int err; @@ -333,7 +337,11 @@ sh_css_load_firmware(struct device *dev, const char *fw_data, return err; } else { - /* All subsequent binaries (including bootloaders) (i>NUM_OF_SPS) are ISP firmware */ + /* + * All subsequent binaries + * (including bootloaders) (i>NUM_OF_SPS) + * are ISP firmware + */ if (i < NUM_OF_SPS) return -EINVAL; @@ -374,8 +382,10 @@ ia_css_ptr sh_css_load_blob(const unsigned char *blob, unsigned int size) { ia_css_ptr target_addr = hmm_alloc(size, HMM_BO_PRIVATE, 0, NULL, 0); - /* this will allocate memory aligned to a DDR word boundary which - is required for the CSS DMA to read the instructions. */ + /* + * this will allocate memory aligned to a DDR word boundary which + * is required for the CSS DMA to read the instructions. + */ assert(blob); if (target_addr) diff --git a/drivers/staging/media/atomisp/pci/sh_css_hrt.c b/drivers/staging/media/atomisp/pci/sh_css_hrt.c index 06b502151af9..879c85311038 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_hrt.c +++ b/drivers/staging/media/atomisp/pci/sh_css_hrt.c @@ -64,11 +64,7 @@ bool sh_css_hrt_system_is_idle(void) int sh_css_hrt_sp_wait(void) { -#if defined(HAS_IRQ_MAP_VERSION_2) irq_sw_channel_id_t irq_id = IRQ_SW_CHANNEL0_ID; -#else - irq_sw_channel_id_t irq_id = IRQ_SW_CHANNEL2_ID; -#endif /* * Wait till SP is idle or till there is a SW2 interrupt * The SW2 interrupt will be used when frameloop runs on SP diff --git a/drivers/staging/media/atomisp/pci/sh_css_internal.h b/drivers/staging/media/atomisp/pci/sh_css_internal.h index 5c25a25dce92..3c669ec79b68 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_internal.h +++ b/drivers/staging/media/atomisp/pci/sh_css_internal.h @@ -22,7 +22,7 @@ #include <platform_support.h> #include <stdarg.h> -#if !defined(HAS_NO_INPUT_FORMATTER) +#if !defined(ISP2401) #include "input_formatter.h" #endif #include "input_system.h" @@ -86,11 +86,9 @@ #define SH_CSS_MAX_IF_CONFIGS 3 /* Must match with IA_CSS_NR_OF_CONFIGS (not defined yet).*/ #define SH_CSS_IF_CONFIG_NOT_NEEDED 0xFF -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) #define SH_CSS_ENABLE_METADATA -#endif -#if defined(SH_CSS_ENABLE_METADATA) && !defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(SH_CSS_ENABLE_METADATA) && !defined(ISP2401) #define SH_CSS_ENABLE_METADATA_THREAD #endif @@ -320,15 +318,9 @@ struct sh_css_sp_debug_state { #elif SP_DEBUG == SP_DEBUG_TRACE -#if 1 /* Example of just one global trace */ #define SH_CSS_SP_DBG_NR_OF_TRACES (1) #define SH_CSS_SP_DBG_TRACE_DEPTH (40) -#else -/* E.g. if you like separate traces for 4 threads */ -#define SH_CSS_SP_DBG_NR_OF_TRACES (4) -#define SH_CSS_SP_DBG_TRACE_DEPTH (10) -#endif #define SH_CSS_SP_DBG_TRACE_FILE_ID_BIT_POS (13) @@ -371,7 +363,7 @@ struct sh_css_sp_debug_command { u32 dma_sw_reg; }; -#if !defined(HAS_NO_INPUT_FORMATTER) +#if !defined(ISP2401) /* SP input formatter configuration.*/ struct sh_css_sp_input_formatter_set { u32 stream_format; @@ -391,7 +383,7 @@ struct sh_css_sp_config { frames are locked when their EOF event is successfully sent to the host (true) or when they are passed to the preview/video pipe (false). */ -#if !defined(HAS_NO_INPUT_FORMATTER) +#if !defined(ISP2401) struct { u8 a_changed; u8 b_changed; @@ -400,7 +392,7 @@ struct sh_css_sp_config { set[SH_CSS_MAX_IF_CONFIGS]; /* CSI-2 port is used as index. */ } input_formatter; #endif -#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) sync_generator_cfg_t sync_gen; tpg_cfg_t tpg; prbs_cfg_t prbs; @@ -423,7 +415,7 @@ enum sh_css_stage_type { #define SH_CSS_PIPE_CONFIG_SAMPLE_PARAMS_MASK \ ((SH_CSS_PIPE_CONFIG_SAMPLE_PARAMS << SH_CSS_MAX_SP_THREADS) - 1) -#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) struct sh_css_sp_pipeline_terminal { union { /* Input System 2401 */ @@ -679,7 +671,7 @@ struct sh_css_sp_stage { struct sh_css_sp_group { struct sh_css_sp_config config; struct sh_css_sp_pipeline pipe[SH_CSS_MAX_SP_THREADS]; -#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) struct sh_css_sp_pipeline_io pipe_io[SH_CSS_MAX_SP_THREADS]; struct sh_css_sp_pipeline_io_status pipe_io_status; #endif @@ -828,11 +820,9 @@ struct host_sp_communication { ia_css_ptr host2sp_offline_frames[NUM_CONTINUOUS_FRAMES]; ia_css_ptr host2sp_offline_metadata[NUM_CONTINUOUS_FRAMES]; -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) ia_css_ptr host2sp_mipi_frames[N_CSI_PORTS][NUM_MIPI_FRAMES_PER_STREAM]; ia_css_ptr host2sp_mipi_metadata[N_CSI_PORTS][NUM_MIPI_FRAMES_PER_STREAM]; u32 host2sp_num_mipi_frames[N_CSI_PORTS]; -#endif u32 host2sp_cont_avail_num_raw_frames; u32 host2sp_cont_extra_num_raw_frames; u32 host2sp_cont_target_num_raw_frames; @@ -840,20 +830,12 @@ struct host_sp_communication { }; -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) #define SIZE_OF_HOST_SP_COMMUNICATION_STRUCT \ (sizeof(uint32_t) + \ (NUM_CONTINUOUS_FRAMES * SIZE_OF_HRT_VADDRESS * 2) + \ (N_CSI_PORTS * NUM_MIPI_FRAMES_PER_STREAM * SIZE_OF_HRT_VADDRESS * 2) + \ ((3 + N_CSI_PORTS) * sizeof(uint32_t)) + \ (NR_OF_PIPELINES * SIZE_OF_SH_CSS_EVENT_IRQ_MASK_STRUCT)) -#else -#define SIZE_OF_HOST_SP_COMMUNICATION_STRUCT \ - (sizeof(uint32_t) + \ - (NUM_CONTINUOUS_FRAMES * SIZE_OF_HRT_VADDRESS * 2) + \ - (3 * sizeof(uint32_t)) + \ - (NR_OF_PIPELINES * SIZE_OF_SH_CSS_EVENT_IRQ_MASK_STRUCT)) -#endif struct host_sp_queues { /* @@ -925,10 +907,9 @@ struct host_sp_queues { #define SIZE_OF_HOST_SP_QUEUES_STRUCT \ (SIZE_OF_QUEUES_ELEMS + SIZE_OF_QUEUES_DESC) -extern int (*sh_css_printf)(const char *fmt, va_list args); +extern int __printf(1, 0) (*sh_css_printf)(const char *fmt, va_list args); -static inline void -sh_css_print(const char *fmt, ...) +static inline void __printf(1, 2) sh_css_print(const char *fmt, ...) { va_list ap; @@ -939,8 +920,7 @@ sh_css_print(const char *fmt, ...) } } -static inline void -sh_css_vprint(const char *fmt, va_list args) +static inline void __printf(1, 0) sh_css_vprint(const char *fmt, va_list args) { if (sh_css_printf) sh_css_printf(fmt, args); @@ -987,7 +967,7 @@ sh_css_frame_info_set_width(struct ia_css_frame_info *info, unsigned int width, unsigned int aligned); -#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) unsigned int sh_css_get_mipi_sizes_for_check(const unsigned int port, @@ -1036,7 +1016,7 @@ sh_css_continuous_is_enabled(uint8_t pipe_num); struct ia_css_pipe * find_pipe_by_num(uint32_t pipe_num); -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 void ia_css_get_crop_offsets( struct ia_css_pipe *pipe, diff --git a/drivers/staging/media/atomisp/pci/sh_css_mipi.c b/drivers/staging/media/atomisp/pci/sh_css_mipi.c index 2ef5dbd62a6d..d5ae7f0b5864 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_mipi.c +++ b/drivers/staging/media/atomisp/pci/sh_css_mipi.c @@ -30,10 +30,8 @@ #include "sh_css_sp.h" /* sh_css_update_host2sp_mipi_frame sh_css_update_host2sp_num_mipi_frames ... */ #include "sw_event_global.h" /* IA_CSS_PSYS_SW_EVENT_MIPI_BUFFERS_READY */ -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) static u32 ref_count_mipi_allocation[N_CSI_PORTS]; /* Initialized in mipi_init */ -#endif int ia_css_mipi_frame_specify(const unsigned int size_mem_words, @@ -120,7 +118,7 @@ ia_css_mipi_frame_calculate_size(const unsigned int width, unsigned int mem_words = 0; unsigned int width_padded = width; -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) /* The changes will be reverted as soon as RAW * Buffers are deployed by the 2401 Input System * in the non-continuous use scenario. @@ -246,7 +244,7 @@ ia_css_mipi_frame_calculate_size(const unsigned int width, return err; } -#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) int ia_css_mipi_frame_enable_check_on_size(const enum mipi_port_id port, const unsigned int size_mem_words) { @@ -275,19 +273,17 @@ ia_css_mipi_frame_enable_check_on_size(const enum mipi_port_id port, void mipi_init(void) { -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) unsigned int i; for (i = 0; i < N_CSI_PORTS; i++) ref_count_mipi_allocation[i] = 0; -#endif } int calculate_mipi_buff_size( struct ia_css_stream_config *stream_cfg, unsigned int *size_mem_words) { -#if !defined(USE_INPUT_SYSTEM_VERSION_2401) +#if !defined(ISP2401) int err = -EINVAL; (void)stream_cfg; (void)size_mem_words; @@ -409,10 +405,8 @@ static bool buffers_needed(struct ia_css_pipe *pipe) int allocate_mipi_frames(struct ia_css_pipe *pipe, struct ia_css_stream_info *info) { -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) int err = -EINVAL; unsigned int port; - struct ia_css_frame_info mipi_intermediate_info; ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, "allocate_mipi_frames(%p) enter:\n", pipe); @@ -427,7 +421,7 @@ allocate_mipi_frames(struct ia_css_pipe *pipe, return -EINVAL; } -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 if (pipe->stream->config.online) { ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, @@ -459,13 +453,13 @@ allocate_mipi_frames(struct ia_css_pipe *pipe, return -EINVAL; } -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 err = calculate_mipi_buff_size( &pipe->stream->config, &my_css.mipi_frame_size[port]); #endif -#if defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) if (ref_count_mipi_allocation[port] != 0) { ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, @@ -491,17 +485,6 @@ allocate_mipi_frames(struct ia_css_pipe *pipe, ref_count_mipi_allocation[port]++; - /* TODO: Cleaning needed. */ - /* This code needs to modified to allocate the MIPI frames in the correct normal way - with an allocate from info, by justin */ - mipi_intermediate_info = pipe->pipe_settings.video.video_binary.internal_frame_info; - mipi_intermediate_info.res.width = 0; - mipi_intermediate_info.res.height = 0; - /* To indicate it is not (yet) valid format. */ - mipi_intermediate_info.format = IA_CSS_FRAME_FORMAT_NUM; - mipi_intermediate_info.padded_width = 0; - mipi_intermediate_info.raw_bit_depth = 0; - /* AM TODO: mipi frames number should come from stream struct. */ my_css.num_mipi_frames[port] = NUM_MIPI_FRAMES_PER_STREAM; @@ -560,16 +543,10 @@ allocate_mipi_frames(struct ia_css_pipe *pipe, "allocate_mipi_frames(%p) exit:\n", pipe); return err; -#else - (void)pipe; - (void)info; - return 0; -#endif } int free_mipi_frames(struct ia_css_pipe *pipe) { -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) int err = -EINVAL; unsigned int port; @@ -609,7 +586,7 @@ free_mipi_frames(struct ia_css_pipe *pipe) { } if (ref_count_mipi_allocation[port] > 0) { -#if defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) assert(ref_count_mipi_allocation[port] == 1); if (ref_count_mipi_allocation[port] != 1) { ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, @@ -641,7 +618,7 @@ free_mipi_frames(struct ia_css_pipe *pipe) { ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, "free_mipi_frames(%p) exit (deallocated).\n", pipe); } -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) else { /* 2401 system allows multiple streams to use same physical port. This is not * true for 2400 system. Currently 2401 uses MIPI buffers as a temporary solution. @@ -675,15 +652,11 @@ free_mipi_frames(struct ia_css_pipe *pipe) { ref_count_mipi_allocation[port] = 0; } } -#else - (void)pipe; -#endif return 0; } int send_mipi_frames(struct ia_css_pipe *pipe) { -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) int err = -EINVAL; unsigned int i; #ifndef ISP2401 @@ -751,8 +724,5 @@ send_mipi_frames(struct ia_css_pipe *pipe) { (uint8_t)my_css.num_mipi_frames[port], 0 /* not used */); IA_CSS_LEAVE_ERR_PRIVATE(0); -#else - (void)pipe; -#endif return 0; } diff --git a/drivers/staging/media/atomisp/pci/sh_css_param_shading.c b/drivers/staging/media/atomisp/pci/sh_css_param_shading.c index 046f34857891..69cc4e423d8b 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_param_shading.c +++ b/drivers/staging/media/atomisp/pci/sh_css_param_shading.c @@ -230,15 +230,8 @@ prepare_shading_table(const struct ia_css_shading_table *in_table, const struct ia_css_binary *binary, unsigned int bds_factor) { - unsigned int input_width, - input_height, - table_width, - table_height, - left_padding, - top_padding, - padded_width, - left_cropping, - i; + unsigned int input_width, input_height, table_width, table_height, i; + unsigned int left_padding, top_padding, left_cropping; unsigned int bds_numerator, bds_denominator; int right_padding; @@ -254,15 +247,11 @@ prepare_shading_table(const struct ia_css_shading_table *in_table, return; } - padded_width = binary->in_frame_info.padded_width; - /* We use the ISP input resolution for the shading table because - shading correction is performed in the bayer domain (before bayer - down scaling). */ -#if defined(USE_INPUT_SYSTEM_VERSION_2401) - padded_width = CEIL_MUL(binary->effective_in_frame_res.width + 2 * - ISP_VEC_NELEMS, - 2 * ISP_VEC_NELEMS); -#endif + /* + * We use the ISP input resolution for the shading table because + * shading correction is performed in the bayer domain (before bayer + * down scaling). + */ input_height = binary->in_frame_info.res.height; input_width = binary->in_frame_info.res.width; left_padding = binary->left_padding; diff --git a/drivers/staging/media/atomisp/pci/sh_css_params.c b/drivers/staging/media/atomisp/pci/sh_css_params.c index ba42be9b06eb..24fc497bd491 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_params.c +++ b/drivers/staging/media/atomisp/pci/sh_css_params.c @@ -55,9 +55,6 @@ #include "ia_css_host_data.h" #include "ia_css_pipe.h" #include "ia_css_pipe_binarydesc.h" -#if 0 -#include "ia_css_system_ctrl.h" -#endif /* Include all kernel host interfaces for ISP1 */ @@ -143,536 +140,6 @@ static int interleaved_lut_temp[4][HRT_GDC_N]; /* Digital Zoom lookup table. See documentation for more details about the * contents of this table. */ -#if defined(HAS_GDC_VERSION_2) -#if defined(CONFIG_CSI2_PLUS) -/* - * Coefficients from - * Css_Mizuchi/regressions/20140424_0930/all/applications/common/gdc_v2_common/lut.h - */ - -static const int zoom_table[4][HRT_GDC_N] = { - { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, -1, - -1, -1, -1, -1, -1, -1, -1, -1, - -1, -2, -2, -2, -2, -2, -2, -2, - -3, -3, -3, -3, -3, -3, -3, -4, - -4, -4, -4, -4, -5, -5, -5, -5, - -5, -5, -6, -6, -6, -6, -7, -7, - -7, -7, -7, -8, -8, -8, -8, -9, - -9, -9, -9, -10, -10, -10, -10, -11, - -11, -11, -12, -12, -12, -12, -13, -13, - -13, -14, -14, -14, -15, -15, -15, -15, - -16, -16, -16, -17, -17, -17, -18, -18, - -18, -19, -19, -20, -20, -20, -21, -21, - -21, -22, -22, -22, -23, -23, -24, -24, - -24, -25, -25, -25, -26, -26, -27, -27, - -28, -28, -28, -29, -29, -30, -30, -30, - -31, -31, -32, -32, -33, -33, -33, -34, - -34, -35, -35, -36, -36, -37, -37, -37, - -38, -38, -39, -39, -40, -40, -41, -41, - -42, -42, -43, -43, -44, -44, -45, -45, - -46, -46, -47, -47, -48, -48, -49, -49, - -50, -50, -51, -51, -52, -52, -53, -53, - -54, -54, -55, -55, -56, -56, -57, -57, - -58, -59, -59, -60, -60, -61, -61, -62, - -62, -63, -63, -64, -65, -65, -66, -66, - -67, -67, -68, -69, -69, -70, -70, -71, - -71, -72, -73, -73, -74, -74, -75, -75, - -76, -77, -77, -78, -78, -79, -80, -80, - -81, -81, -82, -83, -83, -84, -84, -85, - -86, -86, -87, -87, -88, -89, -89, -90, - -91, -91, -92, -92, -93, -94, -94, -95, - -96, -96, -97, -97, -98, -99, -99, -100, - -101, -101, -102, -102, -103, -104, -104, -105, - -106, -106, -107, -108, -108, -109, -109, -110, - -111, -111, -112, -113, -113, -114, -115, -115, - -116, -117, -117, -118, -119, -119, -120, -121, - -121, -122, -122, -123, -124, -124, -125, -126, - -126, -127, -128, -128, -129, -130, -130, -131, - -132, -132, -133, -134, -134, -135, -136, -136, - -137, -138, -138, -139, -140, -140, -141, -142, - -142, -143, -144, -144, -145, -146, -146, -147, - -148, -148, -149, -150, -150, -151, -152, -152, - -153, -154, -154, -155, -156, -156, -157, -158, - -158, -159, -160, -160, -161, -162, -162, -163, - -164, -164, -165, -166, -166, -167, -168, -168, - -169, -170, -170, -171, -172, -172, -173, -174, - -174, -175, -176, -176, -177, -178, -178, -179, - -180, -180, -181, -181, -182, -183, -183, -184, - -185, -185, -186, -187, -187, -188, -189, -189, - -190, -191, -191, -192, -193, -193, -194, -194, - -195, -196, -196, -197, -198, -198, -199, -200, - -200, -201, -201, -202, -203, -203, -204, -205, - -205, -206, -206, -207, -208, -208, -209, -210, - -210, -211, -211, -212, -213, -213, -214, -215, - -215, -216, -216, -217, -218, -218, -219, -219, - -220, -221, -221, -222, -222, -223, -224, -224, - -225, -225, -226, -227, -227, -228, -228, -229, - -229, -230, -231, -231, -232, -232, -233, -233, - -234, -235, -235, -236, -236, -237, -237, -238, - -239, -239, -240, -240, -241, -241, -242, -242, - -243, -244, -244, -245, -245, -246, -246, -247, - -247, -248, -248, -249, -249, -250, -250, -251, - -251, -252, -252, -253, -253, -254, -254, -255, - -256, -256, -256, -257, -257, -258, -258, -259, - -259, -260, -260, -261, -261, -262, -262, -263, - -263, -264, -264, -265, -265, -266, -266, -266, - -267, -267, -268, -268, -269, -269, -270, -270, - -270, -271, -271, -272, -272, -273, -273, -273, - -274, -274, -275, -275, -275, -276, -276, -277, - -277, -277, -278, -278, -279, -279, -279, -280, - -280, -280, -281, -281, -282, -282, -282, -283, - -283, -283, -284, -284, -284, -285, -285, -285, - -286, -286, -286, -287, -287, -287, -288, -288, - -288, -289, -289, -289, -289, -290, -290, -290, - -291, -291, -291, -291, -292, -292, -292, -293, - -293, -293, -293, -294, -294, -294, -294, -295, - -295, -295, -295, -295, -296, -296, -296, -296, - -297, -297, -297, -297, -297, -298, -298, -298, - -298, -298, -299, -299, -299, -299, -299, -299, - -300, -300, -300, -300, -300, -300, -300, -301, - -301, -301, -301, -301, -301, -301, -301, -301, - -302, -302, -302, -302, -302, -302, -302, -302, - -302, -302, -302, -302, -302, -303, -303, -303, - -303, -303, -303, -303, -303, -303, -303, -303, - -303, -303, -303, -303, -303, -303, -303, -303, - -303, -303, -303, -303, -303, -303, -303, -303, - -303, -303, -302, -302, -302, -302, -302, -302, - -302, -302, -302, -302, -302, -302, -301, -301, - -301, -301, -301, -301, -301, -301, -300, -300, - -300, -300, -300, -300, -299, -299, -299, -299, - -299, -299, -298, -298, -298, -298, -298, -297, - -297, -297, -297, -296, -296, -296, -296, -295, - -295, -295, -295, -294, -294, -294, -293, -293, - -293, -293, -292, -292, -292, -291, -291, -291, - -290, -290, -290, -289, -289, -289, -288, -288, - -288, -287, -287, -286, -286, -286, -285, -285, - -284, -284, -284, -283, -283, -282, -282, -281, - -281, -280, -280, -279, -279, -279, -278, -278, - -277, -277, -276, -276, -275, -275, -274, -273, - -273, -272, -272, -271, -271, -270, -270, -269, - -268, -268, -267, -267, -266, -266, -265, -264, - -264, -263, -262, -262, -261, -260, -260, -259, - -259, -258, -257, -256, -256, -255, -254, -254, - -253, -252, -252, -251, -250, -249, -249, -248, - -247, -246, -246, -245, -244, -243, -242, -242, - -241, -240, -239, -238, -238, -237, -236, -235, - -234, -233, -233, -232, -231, -230, -229, -228, - -227, -226, -226, -225, -224, -223, -222, -221, - -220, -219, -218, -217, -216, -215, -214, -213, - -212, -211, -210, -209, -208, -207, -206, -205, - -204, -203, -202, -201, -200, -199, -198, -197, - -196, -194, -193, -192, -191, -190, -189, -188, - -187, -185, -184, -183, -182, -181, -180, -178, - -177, -176, -175, -174, -172, -171, -170, -169, - -167, -166, -165, -164, -162, -161, -160, -158, - -157, -156, -155, -153, -152, -151, -149, -148, - -147, -145, -144, -142, -141, -140, -138, -137, - -135, -134, -133, -131, -130, -128, -127, -125, - -124, -122, -121, -120, -118, -117, -115, -114, - -112, -110, -109, -107, -106, -104, -103, -101, - -100, -98, -96, -95, -93, -92, -90, -88, - -87, -85, -83, -82, -80, -78, -77, -75, - -73, -72, -70, -68, -67, -65, -63, -61, - -60, -58, -56, -54, -52, -51, -49, -47, - -45, -43, -42, -40, -38, -36, -34, -32, - -31, -29, -27, -25, -23, -21, -19, -17, - -15, -13, -11, -9, -7, -5, -3, -1 - }, - { - 0, 2, 4, 6, 8, 10, 12, 14, - 16, 18, 20, 22, 25, 27, 29, 31, - 33, 36, 38, 40, 43, 45, 47, 50, - 52, 54, 57, 59, 61, 64, 66, 69, - 71, 74, 76, 79, 81, 84, 86, 89, - 92, 94, 97, 99, 102, 105, 107, 110, - 113, 116, 118, 121, 124, 127, 129, 132, - 135, 138, 141, 144, 146, 149, 152, 155, - 158, 161, 164, 167, 170, 173, 176, 179, - 182, 185, 188, 191, 194, 197, 200, 203, - 207, 210, 213, 216, 219, 222, 226, 229, - 232, 235, 239, 242, 245, 248, 252, 255, - 258, 262, 265, 269, 272, 275, 279, 282, - 286, 289, 292, 296, 299, 303, 306, 310, - 313, 317, 321, 324, 328, 331, 335, 338, - 342, 346, 349, 353, 357, 360, 364, 368, - 372, 375, 379, 383, 386, 390, 394, 398, - 402, 405, 409, 413, 417, 421, 425, 429, - 432, 436, 440, 444, 448, 452, 456, 460, - 464, 468, 472, 476, 480, 484, 488, 492, - 496, 500, 504, 508, 512, 516, 521, 525, - 529, 533, 537, 541, 546, 550, 554, 558, - 562, 567, 571, 575, 579, 584, 588, 592, - 596, 601, 605, 609, 614, 618, 622, 627, - 631, 635, 640, 644, 649, 653, 657, 662, - 666, 671, 675, 680, 684, 689, 693, 698, - 702, 707, 711, 716, 720, 725, 729, 734, - 738, 743, 747, 752, 757, 761, 766, 771, - 775, 780, 784, 789, 794, 798, 803, 808, - 813, 817, 822, 827, 831, 836, 841, 846, - 850, 855, 860, 865, 870, 874, 879, 884, - 889, 894, 898, 903, 908, 913, 918, 923, - 928, 932, 937, 942, 947, 952, 957, 962, - 967, 972, 977, 982, 986, 991, 996, 1001, - 1006, 1011, 1016, 1021, 1026, 1031, 1036, 1041, - 1046, 1051, 1056, 1062, 1067, 1072, 1077, 1082, - 1087, 1092, 1097, 1102, 1107, 1112, 1117, 1122, - 1128, 1133, 1138, 1143, 1148, 1153, 1158, 1164, - 1169, 1174, 1179, 1184, 1189, 1195, 1200, 1205, - 1210, 1215, 1221, 1226, 1231, 1236, 1242, 1247, - 1252, 1257, 1262, 1268, 1273, 1278, 1284, 1289, - 1294, 1299, 1305, 1310, 1315, 1321, 1326, 1331, - 1336, 1342, 1347, 1352, 1358, 1363, 1368, 1374, - 1379, 1384, 1390, 1395, 1400, 1406, 1411, 1417, - 1422, 1427, 1433, 1438, 1443, 1449, 1454, 1460, - 1465, 1470, 1476, 1481, 1487, 1492, 1497, 1503, - 1508, 1514, 1519, 1525, 1530, 1535, 1541, 1546, - 1552, 1557, 1563, 1568, 1574, 1579, 1585, 1590, - 1596, 1601, 1606, 1612, 1617, 1623, 1628, 1634, - 1639, 1645, 1650, 1656, 1661, 1667, 1672, 1678, - 1683, 1689, 1694, 1700, 1705, 1711, 1716, 1722, - 1727, 1733, 1738, 1744, 1749, 1755, 1761, 1766, - 1772, 1777, 1783, 1788, 1794, 1799, 1805, 1810, - 1816, 1821, 1827, 1832, 1838, 1844, 1849, 1855, - 1860, 1866, 1871, 1877, 1882, 1888, 1893, 1899, - 1905, 1910, 1916, 1921, 1927, 1932, 1938, 1943, - 1949, 1955, 1960, 1966, 1971, 1977, 1982, 1988, - 1993, 1999, 2005, 2010, 2016, 2021, 2027, 2032, - 2038, 2043, 2049, 2055, 2060, 2066, 2071, 2077, - 2082, 2088, 2093, 2099, 2105, 2110, 2116, 2121, - 2127, 2132, 2138, 2143, 2149, 2154, 2160, 2165, - 2171, 2177, 2182, 2188, 2193, 2199, 2204, 2210, - 2215, 2221, 2226, 2232, 2237, 2243, 2248, 2254, - 2259, 2265, 2270, 2276, 2281, 2287, 2292, 2298, - 2304, 2309, 2314, 2320, 2325, 2331, 2336, 2342, - 2347, 2353, 2358, 2364, 2369, 2375, 2380, 2386, - 2391, 2397, 2402, 2408, 2413, 2419, 2424, 2429, - 2435, 2440, 2446, 2451, 2457, 2462, 2467, 2473, - 2478, 2484, 2489, 2495, 2500, 2505, 2511, 2516, - 2522, 2527, 2532, 2538, 2543, 2549, 2554, 2559, - 2565, 2570, 2575, 2581, 2586, 2591, 2597, 2602, - 2607, 2613, 2618, 2623, 2629, 2634, 2639, 2645, - 2650, 2655, 2661, 2666, 2671, 2676, 2682, 2687, - 2692, 2698, 2703, 2708, 2713, 2719, 2724, 2729, - 2734, 2740, 2745, 2750, 2755, 2760, 2766, 2771, - 2776, 2781, 2786, 2792, 2797, 2802, 2807, 2812, - 2817, 2823, 2828, 2833, 2838, 2843, 2848, 2853, - 2859, 2864, 2869, 2874, 2879, 2884, 2889, 2894, - 2899, 2904, 2909, 2914, 2919, 2924, 2930, 2935, - 2940, 2945, 2950, 2955, 2960, 2965, 2970, 2975, - 2980, 2984, 2989, 2994, 2999, 3004, 3009, 3014, - 3019, 3024, 3029, 3034, 3039, 3044, 3048, 3053, - 3058, 3063, 3068, 3073, 3078, 3082, 3087, 3092, - 3097, 3102, 3106, 3111, 3116, 3121, 3126, 3130, - 3135, 3140, 3145, 3149, 3154, 3159, 3163, 3168, - 3173, 3177, 3182, 3187, 3191, 3196, 3201, 3205, - 3210, 3215, 3219, 3224, 3228, 3233, 3238, 3242, - 3247, 3251, 3256, 3260, 3265, 3269, 3274, 3279, - 3283, 3287, 3292, 3296, 3301, 3305, 3310, 3314, - 3319, 3323, 3327, 3332, 3336, 3341, 3345, 3349, - 3354, 3358, 3362, 3367, 3371, 3375, 3380, 3384, - 3388, 3393, 3397, 3401, 3405, 3410, 3414, 3418, - 3422, 3426, 3431, 3435, 3439, 3443, 3447, 3451, - 3455, 3460, 3464, 3468, 3472, 3476, 3480, 3484, - 3488, 3492, 3496, 3500, 3504, 3508, 3512, 3516, - 3520, 3524, 3528, 3532, 3536, 3540, 3544, 3548, - 3552, 3555, 3559, 3563, 3567, 3571, 3575, 3578, - 3582, 3586, 3590, 3593, 3597, 3601, 3605, 3608, - 3612, 3616, 3619, 3623, 3627, 3630, 3634, 3638, - 3641, 3645, 3649, 3652, 3656, 3659, 3663, 3666, - 3670, 3673, 3677, 3680, 3684, 3687, 3691, 3694, - 3698, 3701, 3704, 3708, 3711, 3714, 3718, 3721, - 3724, 3728, 3731, 3734, 3738, 3741, 3744, 3747, - 3751, 3754, 3757, 3760, 3763, 3767, 3770, 3773, - 3776, 3779, 3782, 3785, 3788, 3791, 3794, 3798, - 3801, 3804, 3807, 3809, 3812, 3815, 3818, 3821, - 3824, 3827, 3830, 3833, 3836, 3839, 3841, 3844, - 3847, 3850, 3853, 3855, 3858, 3861, 3864, 3866, - 3869, 3872, 3874, 3877, 3880, 3882, 3885, 3887, - 3890, 3893, 3895, 3898, 3900, 3903, 3905, 3908, - 3910, 3913, 3915, 3917, 3920, 3922, 3925, 3927, - 3929, 3932, 3934, 3936, 3939, 3941, 3943, 3945, - 3948, 3950, 3952, 3954, 3956, 3958, 3961, 3963, - 3965, 3967, 3969, 3971, 3973, 3975, 3977, 3979, - 3981, 3983, 3985, 3987, 3989, 3991, 3993, 3994, - 3996, 3998, 4000, 4002, 4004, 4005, 4007, 4009, - 4011, 4012, 4014, 4016, 4017, 4019, 4021, 4022, - 4024, 4025, 4027, 4028, 4030, 4031, 4033, 4034, - 4036, 4037, 4039, 4040, 4042, 4043, 4044, 4046, - 4047, 4048, 4050, 4051, 4052, 4053, 4055, 4056, - 4057, 4058, 4059, 4060, 4062, 4063, 4064, 4065, - 4066, 4067, 4068, 4069, 4070, 4071, 4072, 4073, - 4074, 4075, 4075, 4076, 4077, 4078, 4079, 4079, - 4080, 4081, 4082, 4082, 4083, 4084, 4084, 4085, - 4086, 4086, 4087, 4087, 4088, 4088, 4089, 4089, - 4090, 4090, 4091, 4091, 4092, 4092, 4092, 4093, - 4093, 4093, 4094, 4094, 4094, 4094, 4095, 4095, - 4095, 4095, 4095, 4095, 4095, 4095, 4095, 4095 - }, - { - 4096, 4095, 4095, 4095, 4095, 4095, 4095, 4095, - 4095, 4095, 4095, 4094, 4094, 4094, 4094, 4093, - 4093, 4093, 4092, 4092, 4092, 4091, 4091, 4090, - 4090, 4089, 4089, 4088, 4088, 4087, 4087, 4086, - 4086, 4085, 4084, 4084, 4083, 4082, 4082, 4081, - 4080, 4079, 4079, 4078, 4077, 4076, 4075, 4075, - 4074, 4073, 4072, 4071, 4070, 4069, 4068, 4067, - 4066, 4065, 4064, 4063, 4062, 4060, 4059, 4058, - 4057, 4056, 4055, 4053, 4052, 4051, 4050, 4048, - 4047, 4046, 4044, 4043, 4042, 4040, 4039, 4037, - 4036, 4034, 4033, 4031, 4030, 4028, 4027, 4025, - 4024, 4022, 4021, 4019, 4017, 4016, 4014, 4012, - 4011, 4009, 4007, 4005, 4004, 4002, 4000, 3998, - 3996, 3994, 3993, 3991, 3989, 3987, 3985, 3983, - 3981, 3979, 3977, 3975, 3973, 3971, 3969, 3967, - 3965, 3963, 3961, 3958, 3956, 3954, 3952, 3950, - 3948, 3945, 3943, 3941, 3939, 3936, 3934, 3932, - 3929, 3927, 3925, 3922, 3920, 3917, 3915, 3913, - 3910, 3908, 3905, 3903, 3900, 3898, 3895, 3893, - 3890, 3887, 3885, 3882, 3880, 3877, 3874, 3872, - 3869, 3866, 3864, 3861, 3858, 3855, 3853, 3850, - 3847, 3844, 3841, 3839, 3836, 3833, 3830, 3827, - 3824, 3821, 3818, 3815, 3812, 3809, 3807, 3804, - 3801, 3798, 3794, 3791, 3788, 3785, 3782, 3779, - 3776, 3773, 3770, 3767, 3763, 3760, 3757, 3754, - 3751, 3747, 3744, 3741, 3738, 3734, 3731, 3728, - 3724, 3721, 3718, 3714, 3711, 3708, 3704, 3701, - 3698, 3694, 3691, 3687, 3684, 3680, 3677, 3673, - 3670, 3666, 3663, 3659, 3656, 3652, 3649, 3645, - 3641, 3638, 3634, 3630, 3627, 3623, 3619, 3616, - 3612, 3608, 3605, 3601, 3597, 3593, 3590, 3586, - 3582, 3578, 3575, 3571, 3567, 3563, 3559, 3555, - 3552, 3548, 3544, 3540, 3536, 3532, 3528, 3524, - 3520, 3516, 3512, 3508, 3504, 3500, 3496, 3492, - 3488, 3484, 3480, 3476, 3472, 3468, 3464, 3460, - 3455, 3451, 3447, 3443, 3439, 3435, 3431, 3426, - 3422, 3418, 3414, 3410, 3405, 3401, 3397, 3393, - 3388, 3384, 3380, 3375, 3371, 3367, 3362, 3358, - 3354, 3349, 3345, 3341, 3336, 3332, 3327, 3323, - 3319, 3314, 3310, 3305, 3301, 3296, 3292, 3287, - 3283, 3279, 3274, 3269, 3265, 3260, 3256, 3251, - 3247, 3242, 3238, 3233, 3228, 3224, 3219, 3215, - 3210, 3205, 3201, 3196, 3191, 3187, 3182, 3177, - 3173, 3168, 3163, 3159, 3154, 3149, 3145, 3140, - 3135, 3130, 3126, 3121, 3116, 3111, 3106, 3102, - 3097, 3092, 3087, 3082, 3078, 3073, 3068, 3063, - 3058, 3053, 3048, 3044, 3039, 3034, 3029, 3024, - 3019, 3014, 3009, 3004, 2999, 2994, 2989, 2984, - 2980, 2975, 2970, 2965, 2960, 2955, 2950, 2945, - 2940, 2935, 2930, 2924, 2919, 2914, 2909, 2904, - 2899, 2894, 2889, 2884, 2879, 2874, 2869, 2864, - 2859, 2853, 2848, 2843, 2838, 2833, 2828, 2823, - 2817, 2812, 2807, 2802, 2797, 2792, 2786, 2781, - 2776, 2771, 2766, 2760, 2755, 2750, 2745, 2740, - 2734, 2729, 2724, 2719, 2713, 2708, 2703, 2698, - 2692, 2687, 2682, 2676, 2671, 2666, 2661, 2655, - 2650, 2645, 2639, 2634, 2629, 2623, 2618, 2613, - 2607, 2602, 2597, 2591, 2586, 2581, 2575, 2570, - 2565, 2559, 2554, 2549, 2543, 2538, 2532, 2527, - 2522, 2516, 2511, 2505, 2500, 2495, 2489, 2484, - 2478, 2473, 2467, 2462, 2457, 2451, 2446, 2440, - 2435, 2429, 2424, 2419, 2413, 2408, 2402, 2397, - 2391, 2386, 2380, 2375, 2369, 2364, 2358, 2353, - 2347, 2342, 2336, 2331, 2325, 2320, 2314, 2309, - 2304, 2298, 2292, 2287, 2281, 2276, 2270, 2265, - 2259, 2254, 2248, 2243, 2237, 2232, 2226, 2221, - 2215, 2210, 2204, 2199, 2193, 2188, 2182, 2177, - 2171, 2165, 2160, 2154, 2149, 2143, 2138, 2132, - 2127, 2121, 2116, 2110, 2105, 2099, 2093, 2088, - 2082, 2077, 2071, 2066, 2060, 2055, 2049, 2043, - 2038, 2032, 2027, 2021, 2016, 2010, 2005, 1999, - 1993, 1988, 1982, 1977, 1971, 1966, 1960, 1955, - 1949, 1943, 1938, 1932, 1927, 1921, 1916, 1910, - 1905, 1899, 1893, 1888, 1882, 1877, 1871, 1866, - 1860, 1855, 1849, 1844, 1838, 1832, 1827, 1821, - 1816, 1810, 1805, 1799, 1794, 1788, 1783, 1777, - 1772, 1766, 1761, 1755, 1749, 1744, 1738, 1733, - 1727, 1722, 1716, 1711, 1705, 1700, 1694, 1689, - 1683, 1678, 1672, 1667, 1661, 1656, 1650, 1645, - 1639, 1634, 1628, 1623, 1617, 1612, 1606, 1601, - 1596, 1590, 1585, 1579, 1574, 1568, 1563, 1557, - 1552, 1546, 1541, 1535, 1530, 1525, 1519, 1514, - 1508, 1503, 1497, 1492, 1487, 1481, 1476, 1470, - 1465, 1460, 1454, 1449, 1443, 1438, 1433, 1427, - 1422, 1417, 1411, 1406, 1400, 1395, 1390, 1384, - 1379, 1374, 1368, 1363, 1358, 1352, 1347, 1342, - 1336, 1331, 1326, 1321, 1315, 1310, 1305, 1299, - 1294, 1289, 1284, 1278, 1273, 1268, 1262, 1257, - 1252, 1247, 1242, 1236, 1231, 1226, 1221, 1215, - 1210, 1205, 1200, 1195, 1189, 1184, 1179, 1174, - 1169, 1164, 1158, 1153, 1148, 1143, 1138, 1133, - 1128, 1122, 1117, 1112, 1107, 1102, 1097, 1092, - 1087, 1082, 1077, 1072, 1067, 1062, 1056, 1051, - 1046, 1041, 1036, 1031, 1026, 1021, 1016, 1011, - 1006, 1001, 996, 991, 986, 982, 977, 972, - 967, 962, 957, 952, 947, 942, 937, 932, - 928, 923, 918, 913, 908, 903, 898, 894, - 889, 884, 879, 874, 870, 865, 860, 855, - 850, 846, 841, 836, 831, 827, 822, 817, - 813, 808, 803, 798, 794, 789, 784, 780, - 775, 771, 766, 761, 757, 752, 747, 743, - 738, 734, 729, 725, 720, 716, 711, 707, - 702, 698, 693, 689, 684, 680, 675, 671, - 666, 662, 657, 653, 649, 644, 640, 635, - 631, 627, 622, 618, 614, 609, 605, 601, - 596, 592, 588, 584, 579, 575, 571, 567, - 562, 558, 554, 550, 546, 541, 537, 533, - 529, 525, 521, 516, 512, 508, 504, 500, - 496, 492, 488, 484, 480, 476, 472, 468, - 464, 460, 456, 452, 448, 444, 440, 436, - 432, 429, 425, 421, 417, 413, 409, 405, - 402, 398, 394, 390, 386, 383, 379, 375, - 372, 368, 364, 360, 357, 353, 349, 346, - 342, 338, 335, 331, 328, 324, 321, 317, - 313, 310, 306, 303, 299, 296, 292, 289, - 286, 282, 279, 275, 272, 269, 265, 262, - 258, 255, 252, 248, 245, 242, 239, 235, - 232, 229, 226, 222, 219, 216, 213, 210, - 207, 203, 200, 197, 194, 191, 188, 185, - 182, 179, 176, 173, 170, 167, 164, 161, - 158, 155, 152, 149, 146, 144, 141, 138, - 135, 132, 129, 127, 124, 121, 118, 116, - 113, 110, 107, 105, 102, 99, 97, 94, - 92, 89, 86, 84, 81, 79, 76, 74, - 71, 69, 66, 64, 61, 59, 57, 54, - 52, 50, 47, 45, 43, 40, 38, 36, - 33, 31, 29, 27, 25, 22, 20, 18, - 16, 14, 12, 10, 8, 6, 4, 2 - }, - { - 0, -1, -3, -5, -7, -9, -11, -13, - -15, -17, -19, -20, -23, -25, -27, -28, - -30, -33, -34, -36, -39, -40, -42, -43, - -45, -46, -49, -50, -52, -54, -56, -58, - -60, -61, -62, -65, -66, -68, -70, -72, - -73, -74, -77, -78, -80, -82, -83, -85, - -87, -89, -90, -92, -93, -95, -96, -98, - -100, -102, -103, -105, -106, -107, -108, -110, - -112, -114, -116, -116, -118, -120, -122, -122, - -124, -126, -127, -128, -130, -131, -133, -133, - -136, -137, -138, -139, -141, -142, -144, -145, - -147, -147, -150, -151, -151, -153, -155, -156, - -157, -159, -160, -161, -163, -164, -165, -166, - -168, -168, -170, -171, -172, -174, -174, -176, - -177, -178, -180, -181, -182, -183, -184, -185, - -187, -188, -189, -190, -191, -192, -193, -195, - -196, -196, -198, -199, -200, -200, -202, -204, - -204, -205, -206, -207, -208, -209, -211, -212, - -212, -213, -214, -215, -216, -217, -218, -220, - -220, -221, -222, -223, -224, -225, -225, -227, - -227, -228, -229, -230, -230, -231, -233, -234, - -234, -235, -235, -237, -238, -239, -239, -240, - -240, -242, -242, -243, -243, -245, -246, -247, - -247, -249, -248, -249, -250, -251, -251, -253, - -253, -253, -255, -255, -256, -256, -257, -258, - -259, -259, -260, -261, -261, -262, -262, -264, - -263, -265, -265, -265, -266, -267, -267, -268, - -269, -269, -269, -270, -271, -271, -272, -273, - -273, -273, -274, -274, -276, -275, -276, -277, - -277, -278, -278, -278, -279, -279, -280, -281, - -280, -281, -282, -283, -283, -282, -284, -284, - -284, -285, -285, -286, -286, -286, -287, -287, - -288, -288, -288, -289, -289, -289, -290, -290, - -290, -291, -291, -292, -291, -291, -292, -292, - -292, -293, -293, -293, -294, -294, -295, -295, - -294, -295, -295, -296, -297, -297, -297, -297, - -297, -297, -298, -298, -297, -298, -298, -298, - -299, -299, -300, -299, -299, -300, -299, -300, - -301, -300, -300, -301, -300, -301, -301, -301, - -301, -301, -302, -301, -302, -301, -302, -302, - -302, -302, -302, -302, -302, -302, -303, -302, - -303, -302, -303, -303, -302, -303, -303, -303, - -302, -303, -303, -302, -303, -303, -302, -303, - -303, -302, -303, -303, -302, -303, -303, -303, - -303, -302, -303, -303, -302, -302, -302, -303, - -302, -302, -302, -301, -303, -302, -301, -302, - -301, -301, -301, -302, -301, -301, -301, -300, - -301, -300, -300, -300, -300, -299, -300, -299, - -300, -300, -299, -300, -299, -299, -299, -299, - -298, -299, -298, -297, -297, -297, -296, -297, - -296, -296, -296, -296, -295, -296, -295, -296, - -295, -294, -294, -294, -293, -294, -294, -293, - -293, -292, -293, -292, -292, -292, -291, -290, - -291, -290, -291, -289, -289, -290, -289, -289, - -288, -288, -288, -288, -286, -287, -286, -286, - -286, -285, -286, -284, -284, -284, -284, -283, - -283, -283, -282, -282, -282, -281, -280, -281, - -279, -280, -280, -278, -279, -278, -278, -277, - -278, -276, -276, -277, -275, -276, -274, -275, - -274, -273, -273, -272, -273, -272, -272, -271, - -270, -270, -269, -269, -269, -268, -268, -267, - -267, -266, -266, -266, -265, -265, -264, -264, - -263, -263, -262, -262, -261, -261, -260, -260, - -259, -259, -258, -258, -257, -257, -256, -256, - -256, -255, -254, -254, -253, -253, -252, -252, - -251, -251, -250, -250, -249, -249, -248, -248, - -247, -247, -246, -246, -245, -245, -244, -244, - -243, -242, -242, -241, -241, -240, -239, -239, - -239, -238, -238, -237, -237, -235, -235, -235, - -234, -234, -232, -233, -232, -232, -231, -229, - -230, -229, -228, -228, -227, -226, -227, -225, - -224, -225, -223, -223, -222, -222, -221, -221, - -220, -219, -219, -218, -218, -216, -217, -216, - -215, -215, -214, -213, -212, -213, -211, -211, - -210, -210, -209, -209, -208, -206, -207, -206, - -205, -204, -204, -204, -203, -202, -202, -200, - -200, -200, -200, -198, -197, -197, -196, -195, - -195, -195, -194, -194, -192, -192, -191, -191, - -189, -189, -188, -188, -187, -186, -186, -186, - -185, -185, -183, -183, -182, -182, -181, -181, - -180, -178, -178, -177, -177, -176, -176, -174, - -174, -173, -173, -172, -172, -172, -170, -170, - -168, -168, -167, -167, -167, -165, -165, -164, - -164, -164, -162, -162, -161, -160, -160, -158, - -158, -158, -157, -156, -155, -155, -154, -153, - -153, -152, -151, -151, -150, -149, -149, -148, - -147, -147, -146, -146, -144, -144, -144, -142, - -142, -141, -142, -140, -140, -139, -138, -138, - -137, -136, -136, -134, -134, -133, -134, -132, - -132, -131, -130, -130, -128, -128, -128, -127, - -127, -126, -124, -124, -124, -123, -123, -122, - -121, -120, -120, -119, -118, -118, -117, -117, - -116, -115, -115, -115, -114, -113, -111, -111, - -110, -110, -109, -109, -108, -107, -107, -106, - -105, -104, -104, -103, -102, -103, -102, -101, - -101, -100, -99, -99, -98, -97, -97, -96, - -96, -95, -94, -94, -93, -92, -92, -91, - -91, -90, -89, -88, -88, -88, -87, -86, - -85, -86, -84, -84, -83, -82, -82, -81, - -81, -80, -80, -78, -79, -77, -77, -77, - -76, -76, -75, -74, -74, -73, -72, -72, - -72, -71, -70, -70, -69, -68, -68, -68, - -66, -67, -66, -65, -65, -65, -63, -63, - -62, -62, -61, -61, -60, -60, -60, -58, - -58, -58, -56, -56, -56, -55, -54, -55, - -54, -54, -53, -52, -51, -51, -51, -50, - -49, -49, -49, -49, -48, -47, -46, -46, - -46, -46, -45, -43, -43, -43, -43, -42, - -42, -42, -40, -40, -40, -39, -39, -38, - -38, -38, -37, -37, -36, -36, -35, -35, - -34, -35, -34, -33, -33, -32, -32, -31, - -31, -31, -30, -29, -29, -29, -28, -27, - -28, -28, -27, -26, -26, -25, -25, -25, - -24, -24, -24, -23, -23, -22, -22, -22, - -21, -21, -20, -20, -20, -20, -19, -18, - -19, -18, -18, -17, -18, -17, -16, -17, - -16, -15, -15, -15, -14, -14, -15, -13, - -13, -13, -13, -12, -12, -11, -12, -11, - -12, -10, -10, -10, -10, -10, -9, -10, - -9, -9, -9, -8, -8, -7, -8, -7, - -7, -7, -6, -6, -6, -7, -6, -6, - -5, -5, -5, -5, -5, -4, -4, -5, - -4, -4, -3, -3, -3, -3, -3, -2, - -3, -2, -2, -2, -1, -2, -1, -2, - -1, -1, -1, -1, -1, 0, -1, 0, - -1, -1, 0, 0, -1, 0, 0, -1, - 1, 1, 0, 0, 0, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 - } -}; -#else /* defined(CONFIG_CSI2_PLUS) */ static const int zoom_table[4][HRT_GDC_N] = { { 0 << 4, 0 << 4, 0 << 4, 0 << 4, 0 << 4, 0 << 4, 0 << 4, 0 << 4, @@ -1195,11 +662,6 @@ static const int zoom_table[4][HRT_GDC_N] = { 0 << 4, 0 << 4, 0 << 4, 0 << 4, 0 << 4, 0 << 4, 0 << 4, 0 << 4 } }; -#endif -#else -#error "sh_css_params.c: GDC version must be \ -one of {GDC_VERSION_2}" -#endif static const struct ia_css_dz_config default_dz_config = { HRT_GDC_N, @@ -1634,7 +1096,7 @@ ia_css_params_alloc_convert_sctbl( { const struct ia_css_binary *binary = stage->binary; struct ia_css_host_data *sctbl; - unsigned int i, j, aligned_width, row_padding; + unsigned int i, j, aligned_width; unsigned int sctbl_size; short int *ptr; @@ -1649,7 +1111,6 @@ ia_css_params_alloc_convert_sctbl( } aligned_width = binary->sctbl_aligned_width_per_color; - row_padding = aligned_width - shading_table->width; sctbl_size = shading_table->height * IA_CSS_SC_NUM_COLORS * aligned_width * sizeof(short); @@ -4917,7 +4378,6 @@ ia_css_3a_statistics_free(struct ia_css_3a_statistics *me) if (me) { kvfree(me->rgby_data); kvfree(me->data); - memset(me, 0, sizeof(struct ia_css_3a_statistics)); kvfree(me); } } @@ -4956,7 +4416,6 @@ ia_css_dvs_statistics_free(struct ia_css_dvs_statistics *me) if (me) { kvfree(me->hor_proj); kvfree(me->ver_proj); - memset(me, 0, sizeof(struct ia_css_dvs_statistics)); kvfree(me); } } @@ -4998,7 +4457,6 @@ ia_css_dvs_coefficients_free(struct ia_css_dvs_coefficients *me) if (me) { kvfree(me->hor_coefs); kvfree(me->ver_coefs); - memset(me, 0, sizeof(struct ia_css_dvs_coefficients)); kvfree(me); } } @@ -5090,7 +4548,6 @@ ia_css_dvs2_statistics_free(struct ia_css_dvs2_statistics *me) kvfree(me->ver_prod.odd_imag); kvfree(me->ver_prod.even_real); kvfree(me->ver_prod.even_imag); - memset(me, 0, sizeof(struct ia_css_dvs2_statistics)); kvfree(me); } } @@ -5174,7 +4631,6 @@ ia_css_dvs2_coefficients_free(struct ia_css_dvs2_coefficients *me) kvfree(me->ver_coefs.odd_imag); kvfree(me->ver_coefs.even_real); kvfree(me->ver_coefs.even_imag); - memset(me, 0, sizeof(struct ia_css_dvs2_coefficients)); kvfree(me); } } @@ -5249,7 +4705,6 @@ ia_css_dvs2_6axis_config_free(struct ia_css_dvs_6axis_config *dvs_6axis_config) kvfree(dvs_6axis_config->ycoords_y); kvfree(dvs_6axis_config->xcoords_uv); kvfree(dvs_6axis_config->ycoords_uv); - memset(dvs_6axis_config, 0, sizeof(struct ia_css_dvs_6axis_config)); kvfree(dvs_6axis_config); } } diff --git a/drivers/staging/media/atomisp/pci/sh_css_properties.c b/drivers/staging/media/atomisp/pci/sh_css_properties.c index de588f9bd540..8ecd93d65a68 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_properties.c +++ b/drivers/staging/media/atomisp/pci/sh_css_properties.c @@ -22,23 +22,13 @@ void ia_css_get_properties(struct ia_css_properties *properties) { assert(properties); -#if defined(HAS_GDC_VERSION_2) || defined(HAS_GDC_VERSION_3) /* * MW: We don't want to store the coordinates * full range in memory: Truncate */ properties->gdc_coord_one = gdc_get_unity(GDC0_ID) / HRT_GDC_COORD_SCALE; -#else -#error "Unknown GDC version" -#endif properties->l1_base_is_index = true; -#if defined(HAS_VAMEM_VERSION_1) - properties->vamem_type = IA_CSS_VAMEM_TYPE_1; -#elif defined(HAS_VAMEM_VERSION_2) properties->vamem_type = IA_CSS_VAMEM_TYPE_2; -#else -#error "Unknown VAMEM version" -#endif } diff --git a/drivers/staging/media/atomisp/pci/sh_css_sp.c b/drivers/staging/media/atomisp/pci/sh_css_sp.c index a26680b1d0b0..02f5a73b4096 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_sp.c +++ b/drivers/staging/media/atomisp/pci/sh_css_sp.c @@ -17,7 +17,7 @@ #include "sh_css_sp.h" -#if !defined(HAS_NO_INPUT_FORMATTER) +#if !defined(ISP2401) #include "input_formatter.h" #endif @@ -38,9 +38,7 @@ #include "sh_css_params.h" #include "sh_css_legacy.h" #include "ia_css_frame_comm.h" -#if !defined(HAS_NO_INPUT_SYSTEM) #include "ia_css_isys.h" -#endif #include "gdc_device.h" /* HRT_GDC_N */ @@ -229,7 +227,7 @@ sh_css_sp_start_binary_copy(unsigned int pipe_num, IA_CSS_LOG("pipe_id %d port_config %08x", pipe->pipe_id, pipe->inout_port_config); -#if !defined(HAS_NO_INPUT_FORMATTER) +#if !defined(ISP2401) sh_css_sp_group.config.input_formatter.isp_2ppc = (uint8_t)two_ppc; #else (void)two_ppc; @@ -307,7 +305,7 @@ sh_css_sp_start_raw_copy(struct ia_css_frame *out_frame, IA_CSS_LOG("pipe_id %d port_config %08x", pipe->pipe_id, pipe->inout_port_config); -#if !defined(HAS_NO_INPUT_FORMATTER) +#if !defined(ISP2401) sh_css_sp_group.config.input_formatter.isp_2ppc = (uint8_t)two_ppc; #else (void)two_ppc; @@ -638,7 +636,7 @@ set_view_finder_buffer(const struct ia_css_frame *frame) { return 0; } -#if !defined(HAS_NO_INPUT_FORMATTER) +#if !defined(ISP2401) void sh_css_sp_set_if_configs( const input_formatter_cfg_t *config_a, const input_formatter_cfg_t *config_b, @@ -662,7 +660,7 @@ void sh_css_sp_set_if_configs( } #endif -#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) void sh_css_sp_program_input_circuit(int fmt_type, int ch_id, @@ -681,7 +679,7 @@ sh_css_sp_program_input_circuit(int fmt_type, } #endif -#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) void sh_css_sp_configure_sync_gen(int width, int height, int hblank_cycles, @@ -724,11 +722,7 @@ sh_css_sp_configure_enable_raw_pool_locking(bool lock_all) void sh_css_sp_enable_isys_event_queue(bool enable) { -#if !defined(HAS_NO_INPUT_SYSTEM) sh_css_sp_group.config.enable_isys_event_queue = enable; -#else - (void)enable; -#endif } void @@ -766,7 +760,7 @@ sh_css_sp_init_group(bool two_ppc, bool no_isp_sync, uint8_t if_config_index) { -#if !defined(HAS_NO_INPUT_FORMATTER) +#if !defined(ISP2401) sh_css_sp_group.config.input_formatter.isp_2ppc = two_ppc; #else (void)two_ppc; @@ -775,7 +769,7 @@ sh_css_sp_init_group(bool two_ppc, sh_css_sp_group.config.no_isp_sync = (uint8_t)no_isp_sync; /* decide whether the frame is processed online or offline */ if (if_config_index == SH_CSS_IF_CONFIG_NOT_NEEDED) return; -#if !defined(HAS_NO_INPUT_FORMATTER) +#if !defined(ISP2401) assert(if_config_index < SH_CSS_MAX_IF_CONFIGS); sh_css_sp_group.config.input_formatter.set[if_config_index].stream_format = input_format; @@ -940,7 +934,7 @@ sh_css_sp_init_stage(struct ia_css_binary *binary, return 0; } -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) (void)continuous; sh_css_sp_stage.deinterleaved = 0; #else @@ -1025,7 +1019,7 @@ sh_css_sp_init_stage(struct ia_css_binary *binary, if (err) return err; -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 if (stage == 0) { pipe = find_pipe_by_num(sh_css_sp_group.pipe[thread_id].pipe_num); if (!pipe) @@ -1206,9 +1200,7 @@ sh_css_sp_init_pipeline(struct ia_css_pipeline *me, enum ia_css_input_mode input_mode, const struct ia_css_metadata_config *md_config, const struct ia_css_metadata_info *md_info, -#if !defined(HAS_NO_INPUT_SYSTEM) const enum mipi_port_id port_id, -#endif const struct ia_css_coordinate *internal_frame_origin_bqs_on_sctbl, /* Origin of internal frame positioned on shading table at shading correction in ISP. */ @@ -1226,7 +1218,6 @@ sh_css_sp_init_pipeline(struct ia_css_pipeline *me, assert(me); -#if !defined(HAS_NO_INPUT_SYSTEM) assert(me->stages); first_binary = me->stages->binary; @@ -1245,10 +1236,6 @@ sh_css_sp_init_pipeline(struct ia_css_pipeline *me, { if_config_index = 0x0; } -#else - (void)input_mode; - if_config_index = SH_CSS_IF_CONFIG_NOT_NEEDED; -#endif ia_css_pipeline_get_sp_thread_id(pipe_num, &thread_id); memset(&sh_css_sp_group.pipe[thread_id], 0, sizeof(struct sh_css_sp_pipeline)); @@ -1268,12 +1255,10 @@ sh_css_sp_init_pipeline(struct ia_css_pipeline *me, offline, if_config_index); } /* if (first_binary != NULL) */ -#if defined(USE_INPUT_SYSTEM_VERSION_2401) || defined(USE_INPUT_SYSTEM_VERSION_2) /* Signal the host immediately after start for SP_ISYS_COPY only */ if ((me->num_stages == 1) && me->stages && (me->stages->sp_func == IA_CSS_PIPELINE_ISYS_COPY)) sh_css_sp_group.config.no_isp_sync = true; -#endif /* Init stage data */ sh_css_init_host2sp_frame_data(); @@ -1285,11 +1270,9 @@ sh_css_sp_init_pipeline(struct ia_css_pipeline *me, sh_css_sp_group.pipe[thread_id].num_execs = me->num_execs; sh_css_sp_group.pipe[thread_id].pipe_qos_config = me->pipe_qos_config; sh_css_sp_group.pipe[thread_id].required_bds_factor = required_bds_factor; -#if !defined(HAS_NO_INPUT_SYSTEM) sh_css_sp_group.pipe[thread_id].input_system_mode = (uint32_t)input_mode; sh_css_sp_group.pipe[thread_id].port_id = port_id; -#endif sh_css_sp_group.pipe[thread_id].dvs_frame_delay = (uint32_t)me->dvs_frame_delay; /* TODO: next indicates from which queues parameters need to be @@ -1482,7 +1465,6 @@ sh_css_update_host2sp_offline_frame( store_sp_array_uint(host_sp_com, offset, metadata ? metadata->address : 0); } -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) /* * @brief Update the mipi frame information in host_sp_communication. * Refer to "sh_css_sp.h" for more details. @@ -1547,7 +1529,6 @@ sh_css_update_host2sp_num_mipi_frames(unsigned int num_frames) store_sp_array_uint(host_sp_com, offset, num_frames); } -#endif void sh_css_update_host2sp_cont_num_raw_frames(unsigned int num_frames, diff --git a/drivers/staging/media/atomisp/pci/sh_css_sp.h b/drivers/staging/media/atomisp/pci/sh_css_sp.h index 153b005becda..832eed711525 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_sp.h +++ b/drivers/staging/media/atomisp/pci/sh_css_sp.h @@ -18,7 +18,7 @@ #include <system_global.h> #include <type_support.h> -#if !defined(HAS_NO_INPUT_FORMATTER) +#if !defined(ISP2401) #include "input_formatter.h" #endif @@ -66,9 +66,7 @@ sh_css_sp_init_pipeline(struct ia_css_pipeline *me, enum ia_css_input_mode input_mode, const struct ia_css_metadata_config *md_config, const struct ia_css_metadata_info *md_info, -#if !defined(HAS_NO_INPUT_SYSTEM) const enum mipi_port_id port_id, -#endif const struct ia_css_coordinate *internal_frame_origin_bqs_on_sctbl, /* Origin of internal frame positioned on shading table at shading correction in ISP. */ @@ -98,7 +96,6 @@ sh_css_update_host2sp_offline_frame( struct ia_css_frame *frame, struct ia_css_metadata *metadata); -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) /** * @brief Update the mipi frame information in host_sp_communication. * @@ -128,7 +125,6 @@ sh_css_update_host2sp_mipi_metadata( */ void sh_css_update_host2sp_num_mipi_frames(unsigned int num_frames); -#endif /** * @brief Update the nr of offline frames to use in host_sp_communication. @@ -158,7 +154,7 @@ sh_css_sp_get_debug_state(struct sh_css_sp_debug_state *state); #endif -#if !defined(HAS_NO_INPUT_FORMATTER) +#if !defined(ISP2401) void sh_css_sp_set_if_configs( const input_formatter_cfg_t *config_a, diff --git a/drivers/staging/media/atomisp/pci/sh_css_struct.h b/drivers/staging/media/atomisp/pci/sh_css_struct.h index bd260252317a..eb8960ebae34 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_struct.h +++ b/drivers/staging/media/atomisp/pci/sh_css_struct.h @@ -55,7 +55,6 @@ struct sh_css { bool check_system_idle; unsigned int num_cont_raw_frames; -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) unsigned int num_mipi_frames[N_CSI_PORTS]; struct ia_css_frame *mipi_frames[N_CSI_PORTS][NUM_MIPI_FRAMES_PER_STREAM]; @@ -64,7 +63,6 @@ struct sh_css { unsigned int mipi_sizes_for_check[N_CSI_PORTS][IA_CSS_MIPI_SIZE_CHECK_MAX_NOF_ENTRIES_PER_PORT]; unsigned int mipi_frame_size[N_CSI_PORTS]; -#endif ia_css_ptr sp_bin_addr; hrt_data page_table_base_index; diff --git a/drivers/staging/media/atomisp/pci/system_global.h b/drivers/staging/media/atomisp/pci/system_global.h index 90210f6943d2..9b22b8c168be 100644 --- a/drivers/staging/media/atomisp/pci/system_global.h +++ b/drivers/staging/media/atomisp/pci/system_global.h @@ -25,23 +25,6 @@ * N.B. the 3 input formatters are of 2 different classess */ -#define HAS_MMU_VERSION_2 -#define HAS_DMA_VERSION_2 -#define HAS_GDC_VERSION_2 -#define HAS_VAMEM_VERSION_2 -#define HAS_HMEM_VERSION_1 -#define HAS_BAMEM_VERSION_2 -#define HAS_IRQ_VERSION_2 -#define HAS_IRQ_MAP_VERSION_2 -#define HAS_INPUT_FORMATTER_VERSION_2 -#define HAS_INPUT_SYSTEM_VERSION_2 -#define HAS_BUFFERED_SENSOR -#define HAS_FIFO_MONITORS_VERSION_2 -#define HAS_GP_DEVICE_VERSION_2 -#define HAS_GPIO_VERSION_1 -#define HAS_TIMED_CTRL_VERSION_1 -#define HAS_RX_VERSION_2 - /* per-frame parameter handling support */ #define SH_CSS_ENABLE_PER_FRAME_PARAMS @@ -64,12 +47,6 @@ #define ISP2400_DMA_MAX_BURST_LENGTH 128 #define ISP2401_DMA_MAX_BURST_LENGTH 2 -#ifdef ISP2401 -# include "isp2401_system_global.h" -#else -# include "isp2400_system_global.h" -#endif - #include <hive_isp_css_defs.h> #include <type_support.h> |