diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-11-16 07:30:12 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-11-16 07:30:12 +0300 |
commit | 5d352e69c60e54b5f04d6e337a1d2bf0dbf3d94a (patch) | |
tree | 214e6b190715267ed02b6d415396c2bbcf2eaace /drivers/staging | |
parent | 93ea0eb7d77afab34657715630d692a78b8cea6a (diff) | |
parent | f2ecc3d0787e05d9145722feed01d4a11ab6bec1 (diff) | |
download | linux-5d352e69c60e54b5f04d6e337a1d2bf0dbf3d94a.tar.xz |
Merge tag 'media/v4.15-1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media updates from Mauro Carvalho Chehab:
- Documentation for digital TV (both kAPI and uAPI) are now in sync
with the implementation (except for legacy/deprecated ioctls). This
is a major step, as there were always a gap there
- New sensor driver: imx274
- New cec driver: cec-gpio
- New platform driver for rockship rga and tegra CEC
- New RC driver: tango-ir
- Several cleanups at atomisp driver
- Core improvements for RC, CEC, V4L2 async probing support and DVB
- Lots of drivers cleanup, fixes and improvements.
* tag 'media/v4.15-1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (332 commits)
dvb_frontend: don't use-after-free the frontend struct
media: dib0700: fix invalid dvb_detach argument
media: v4l2-ctrls: Don't validate BITMASK twice
media: s5p-mfc: fix lockdep warning
media: dvb-core: always call invoke_release() in fe_free()
media: usb: dvb-usb-v2: dvb_usb_core: remove redundant code in dvb_usb_fe_sleep
media: au0828: make const array addr_list static
media: cx88: make const arrays default_addr_list and pvr2000_addr_list static
media: drxd: make const array fastIncrDecLUT static
media: usb: fix spelling mistake: "synchronuously" -> "synchronously"
media: ddbridge: fix build warnings
media: av7110: avoid 2038 overflow in debug print
media: Don't do DMA on stack for firmware upload in the AS102 driver
media: v4l: async: fix unregister for implicitly registered sub-device notifiers
media: v4l: async: fix return of unitialized variable ret
media: imx274: fix missing return assignment from call to imx274_mode_regs
media: camss-vfe: always initialize reg at vfe_set_xbar_cfg()
media: atomisp: make function calls cleaner
media: atomisp: get rid of storage_class.h
media: atomisp: get rid of wrong stddef.h include
...
Diffstat (limited to 'drivers/staging')
214 files changed, 908 insertions, 19009 deletions
diff --git a/drivers/staging/media/atomisp/Kconfig b/drivers/staging/media/atomisp/Kconfig index 8eb13c3ba29c..27f078749148 100644 --- a/drivers/staging/media/atomisp/Kconfig +++ b/drivers/staging/media/atomisp/Kconfig @@ -1,9 +1,10 @@ menuconfig INTEL_ATOMISP - bool "Enable support to Intel MIPI camera drivers" - depends on X86 && EFI && MEDIA_CONTROLLER && PCI && ACPI - help - Enable support for the Intel ISP2 camera interfaces and MIPI - sensor drivers. + bool "Enable support to Intel MIPI camera drivers" + depends on X86 && EFI && MEDIA_CONTROLLER && PCI && ACPI + select COMMON_CLK + help + Enable support for the Intel ISP2 camera interfaces and MIPI + sensor drivers. if INTEL_ATOMISP source "drivers/staging/media/atomisp/pci/Kconfig" diff --git a/drivers/staging/media/atomisp/TODO b/drivers/staging/media/atomisp/TODO index 737452cbf8a0..255ce3630c2a 100644 --- a/drivers/staging/media/atomisp/TODO +++ b/drivers/staging/media/atomisp/TODO @@ -36,13 +36,23 @@ there are any specific things that can be done to fold in support for multiple firmware versions. +8. Switch to V4L2 async API to set up sensor, lens and flash devices. + Control those devices using V4L2 sub-device API without custom + extensions. -Limitations: +9. Switch to standard V4L2 sub-device API for sensor and lens. In + particular, the user space API needs to support V4L2 controls as + defined in the V4L2 spec and references to atomisp must be removed from + these drivers. + +10. Use LED flash API for flash LED drivers such as LM3554 (which already + has a LED class driver). -1. Currently the patch only support some camera sensors - gc2235/gc0310/0v2680/ov2722/ov5693/mt9m114... +11. Switch from videobuf1 to videobuf2. Videobuf1 is being removed! + +Limitations: -2. To test the patches, you also need the ISP firmware +1. To test the patches, you also need the ISP firmware for BYT:/lib/firmware/shisp_2400b0_v21.bin for CHT:/lib/firmware/shisp_2401a0_v21.bin @@ -51,14 +61,14 @@ Limitations: device but can also be extracted from the upgrade kit if you've managed to lose them somehow. -3. Without a 3A libary the capture behaviour is not very good. To take a good +2. Without a 3A libary the capture behaviour is not very good. To take a good picture, you need tune ISP parameters by IOCTL functions or use a 3A libary such as libxcam. -4. The driver is intended to drive the PCI exposed versions of the device. +3. The driver is intended to drive the PCI exposed versions of the device. It will not detect those devices enumerated via ACPI as a field of the i915 GPU driver. -5. The driver supports only v2 of the IPU/Camera. It will not work with the +4. The driver supports only v2 of the IPU/Camera. It will not work with the versions of the hardware in other SoCs. diff --git a/drivers/staging/media/atomisp/i2c/Kconfig b/drivers/staging/media/atomisp/i2c/Kconfig index b80d29d53e65..db054d3c7ed6 100644 --- a/drivers/staging/media/atomisp/i2c/Kconfig +++ b/drivers/staging/media/atomisp/i2c/Kconfig @@ -3,104 +3,96 @@ # source "drivers/staging/media/atomisp/i2c/ov5693/Kconfig" -source "drivers/staging/media/atomisp/i2c/imx/Kconfig" -config VIDEO_OV2722 +config VIDEO_ATOMISP_OV2722 tristate "OVT ov2722 sensor support" + depends on ACPI 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_GC2235 +config VIDEO_ATOMISP_GC2235 tristate "Galaxy gc2235 sensor support" + depends on ACPI 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_OV8858 +config VIDEO_ATOMISP_OV8858 tristate "Omnivision ov8858 sensor support" + depends on ACPI depends on I2C && VIDEO_V4L2 && VIDEO_ATOMISP ---help--- - This is a Video4Linux2 sensor-level driver for the Omnivision - ov8858 RAW sensor. + This is a Video4Linux2 sensor-level driver for the Omnivision + ov8858 RAW sensor. OV8858 is a 8M raw sensor. - It currently only works with the atomisp driver. + It currently only works with the atomisp driver. -config VIDEO_MSRLIST_HELPER +config VIDEO_ATOMISP_MSRLIST_HELPER 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_MT9M114 +config VIDEO_ATOMISP_MT9M114 tristate "Aptina mt9m114 sensor support" + depends on ACPI 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_AP1302 - tristate "AP1302 external ISP support" - depends on I2C && VIDEO_V4L2 - select REGMAP_I2C - ---help--- - This is a Video4Linux2 sensor-level driver for the external - ISP AP1302. - - AP1302 is an exteral ISP. - - It currently only works with the atomisp driver. - -config VIDEO_GC0310 +config VIDEO_ATOMISP_GC0310 tristate "GC0310 sensor support" - depends on I2C && VIDEO_V4L2 - ---help--- - This is a Video4Linux2 sensor-level driver for the Galaxycore - GC0310 0.3MP sensor. + depends on ACPI + depends on I2C && VIDEO_V4L2 + ---help--- + This is a Video4Linux2 sensor-level driver for the Galaxycore + GC0310 0.3MP sensor. -config VIDEO_OV2680 +config VIDEO_ATOMISP_OV2680 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. + This is a Video4Linux2 sensor-level driver for the Omnivision + OV2680 raw camera. - ov2680 is a 2M raw sensor. + ov2680 is a 2M raw sensor. - It currently only works with the atomisp driver. + It currently only works with the atomisp driver. # # Kconfig for flash drivers # -config VIDEO_LM3554 +config VIDEO_ATOMISP_LM3554 tristate "LM3554 flash light driver" + depends on ACPI depends on VIDEO_V4L2 && I2C ---help--- - This is a Video4Linux2 sub-dev driver for the LM3554 - flash light driver. - - To compile this driver as a module, choose M here: the - module will be called lm3554 - + This is a Video4Linux2 sub-dev driver for the LM3554 + flash light driver. + To compile this driver as a module, choose M here: the + module will be called lm3554 diff --git a/drivers/staging/media/atomisp/i2c/Makefile b/drivers/staging/media/atomisp/i2c/Makefile index 041a041718d2..99ea35c043fd 100644 --- a/drivers/staging/media/atomisp/i2c/Makefile +++ b/drivers/staging/media/atomisp/i2c/Makefile @@ -3,22 +3,19 @@ # Makefile for sensor drivers # -obj-$(CONFIG_VIDEO_IMX) += imx/ -obj-$(CONFIG_VIDEO_OV5693) += ov5693/ -obj-$(CONFIG_VIDEO_MT9M114) += mt9m114.o -obj-$(CONFIG_VIDEO_GC2235) += gc2235.o -obj-$(CONFIG_VIDEO_OV2722) += ov2722.o -obj-$(CONFIG_VIDEO_OV2680) += ov2680.o -obj-$(CONFIG_VIDEO_GC0310) += gc0310.o +obj-$(CONFIG_VIDEO_ATOMISP_OV5693) += ov5693/ +obj-$(CONFIG_VIDEO_ATOMISP_MT9M114) += atomisp-mt9m114.o +obj-$(CONFIG_VIDEO_ATOMISP_GC2235) += atomisp-gc2235.o +obj-$(CONFIG_VIDEO_ATOMISP_OV2722) += atomisp-ov2722.o +obj-$(CONFIG_VIDEO_ATOMISP_OV2680) += atomisp-ov2680.o +obj-$(CONFIG_VIDEO_ATOMISP_GC0310) += atomisp-gc0310.o -obj-$(CONFIG_VIDEO_MSRLIST_HELPER) += libmsrlisthelper.o - -obj-$(CONFIG_VIDEO_AP1302) += ap1302.o +obj-$(CONFIG_VIDEO_ATOMISP_MSRLIST_HELPER) += atomisp-libmsrlisthelper.o # Makefile for flash drivers # -obj-$(CONFIG_VIDEO_LM3554) += lm3554.o +obj-$(CONFIG_VIDEO_ATOMISP_LM3554) += atomisp-lm3554.o # HACK! While this driver is in bad shape, don't enable several warnings # that would be otherwise enabled with W=1 diff --git a/drivers/staging/media/atomisp/i2c/ap1302.c b/drivers/staging/media/atomisp/i2c/ap1302.c deleted file mode 100644 index 2f772a020c8b..000000000000 --- a/drivers/staging/media/atomisp/i2c/ap1302.c +++ /dev/null @@ -1,1255 +0,0 @@ -/* - * - * Copyright (c) 2013 Intel Corporation. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -#include "../include/linux/atomisp.h" -#include <linux/delay.h> -#include <linux/firmware.h> -#include <linux/i2c.h> -#include <linux/module.h> -#include <linux/moduleparam.h> -#include <linux/string.h> -#include <linux/types.h> -#include <media/v4l2-ctrls.h> -#include <media/v4l2-device.h> -#include "ap1302.h" - -#define to_ap1302_device(sub_dev) \ - container_of(sub_dev, struct ap1302_device, sd) - -/* Static definitions */ -static struct regmap_config ap1302_reg16_config = { - .reg_bits = 16, - .val_bits = 16, - .reg_format_endian = REGMAP_ENDIAN_BIG, - .val_format_endian = REGMAP_ENDIAN_BIG, -}; - -static struct regmap_config ap1302_reg32_config = { - .reg_bits = 16, - .val_bits = 32, - .reg_format_endian = REGMAP_ENDIAN_BIG, - .val_format_endian = REGMAP_ENDIAN_BIG, -}; - -static enum ap1302_contexts ap1302_cntx_mapping[] = { - CONTEXT_PREVIEW, /* Invalid atomisp run mode */ - CONTEXT_VIDEO, /* ATOMISP_RUN_MODE_VIDEO */ - CONTEXT_SNAPSHOT, /* ATOMISP_RUN_MODE_STILL_CAPTURE */ - CONTEXT_SNAPSHOT, /* ATOMISP_RUN_MODE_CONTINUOUS_CAPTURE */ - CONTEXT_PREVIEW, /* ATOMISP_RUN_MODE_PREVIEW */ -}; - -static struct ap1302_res_struct ap1302_preview_res[] = { - { - .width = 640, - .height = 480, - .fps = 30, - }, - { - .width = 720, - .height = 480, - .fps = 30, - }, - { - .width = 1280, - .height = 720, - .fps = 30, - }, - { - .width = 1920, - .height = 1080, - .fps = 30, - } -}; - -static struct ap1302_res_struct ap1302_snapshot_res[] = { - { - .width = 640, - .height = 480, - .fps = 30, - }, - { - .width = 720, - .height = 480, - .fps = 30, - }, - { - .width = 1280, - .height = 720, - .fps = 30, - }, - { - .width = 1920, - .height = 1080, - .fps = 30, - } -}; - -static struct ap1302_res_struct ap1302_video_res[] = { - { - .width = 640, - .height = 480, - .fps = 30, - }, - { - .width = 720, - .height = 480, - .fps = 30, - }, - { - .width = 1280, - .height = 720, - .fps = 30, - }, - { - .width = 1920, - .height = 1080, - .fps = 30, - } -}; - -static enum ap1302_contexts stream_to_context[] = { - CONTEXT_SNAPSHOT, - CONTEXT_PREVIEW, - CONTEXT_PREVIEW, - CONTEXT_VIDEO -}; - -static u16 aux_stream_config[CONTEXT_NUM][CONTEXT_NUM] = { - {0, 0, 0}, /* Preview: No aux streams. */ - {1, 0, 2}, /* Snapshot: 1 for postview. 2 for video */ - {1, 0, 0}, /* Video: 1 for preview. */ -}; - -static struct ap1302_context_info context_info[] = { - {CNTX_WIDTH, AP1302_REG16, "width"}, - {CNTX_HEIGHT, AP1302_REG16, "height"}, - {CNTX_ROI_X0, AP1302_REG16, "roi_x0"}, - {CNTX_ROI_X1, AP1302_REG16, "roi_x1"}, - {CNTX_ROI_Y0, AP1302_REG16, "roi_y0"}, - {CNTX_ROI_Y1, AP1302_REG16, "roi_y1"}, - {CNTX_ASPECT, AP1302_REG16, "aspect"}, - {CNTX_LOCK, AP1302_REG16, "lock"}, - {CNTX_ENABLE, AP1302_REG16, "enable"}, - {CNTX_OUT_FMT, AP1302_REG16, "out_fmt"}, - {CNTX_SENSOR_MODE, AP1302_REG16, "sensor_mode"}, - {CNTX_MIPI_CTRL, AP1302_REG16, "mipi_ctrl"}, - {CNTX_MIPI_II_CTRL, AP1302_REG16, "mipi_ii_ctrl"}, - {CNTX_LINE_TIME, AP1302_REG32, "line_time"}, - {CNTX_MAX_FPS, AP1302_REG16, "max_fps"}, - {CNTX_AE_USG, AP1302_REG16, "ae_usg"}, - {CNTX_AE_UPPER_ET, AP1302_REG32, "ae_upper_et"}, - {CNTX_AE_MAX_ET, AP1302_REG32, "ae_max_et"}, - {CNTX_SS, AP1302_REG16, "ss"}, - {CNTX_S1_SENSOR_MODE, AP1302_REG16, "s1_sensor_mode"}, - {CNTX_HINF_CTRL, AP1302_REG16, "hinf_ctrl"}, -}; - -/* This array stores the description list for metadata. - The metadata contains exposure settings and face - detection results. */ -static u16 ap1302_ss_list[] = { - 0xb01c, /* From 0x0186 with size 0x1C are exposure settings. */ - 0x0186, - 0xb002, /* 0x71c0 is for F-number */ - 0x71c0, - 0xb010, /* From 0x03dc with size 0x10 are face general infos. */ - 0x03dc, - 0xb0a0, /* From 0x03e4 with size 0xa0 are face detail infos. */ - 0x03e4, - 0xb020, /* From 0x0604 with size 0x20 are smile rate infos. */ - 0x0604, - 0x0000 -}; - -/* End of static definitions */ - -static int ap1302_i2c_read_reg(struct v4l2_subdev *sd, - u16 reg, u16 len, void *val) -{ - struct ap1302_device *dev = to_ap1302_device(sd); - struct i2c_client *client = v4l2_get_subdevdata(sd); - int ret; - - if (len == AP1302_REG16) - ret = regmap_read(dev->regmap16, reg, val); - else if (len == AP1302_REG32) - ret = regmap_read(dev->regmap32, reg, val); - else - ret = -EINVAL; - if (ret) { - dev_dbg(&client->dev, "Read reg failed. reg=0x%04X\n", reg); - return ret; - } - if (len == AP1302_REG16) - dev_dbg(&client->dev, "read_reg[0x%04X] = 0x%04X\n", - reg, *(u16 *)val); - else - dev_dbg(&client->dev, "read_reg[0x%04X] = 0x%08X\n", - reg, *(u32 *)val); - return ret; -} - -static int ap1302_i2c_write_reg(struct v4l2_subdev *sd, - u16 reg, u16 len, u32 val) -{ - struct ap1302_device *dev = to_ap1302_device(sd); - struct i2c_client *client = v4l2_get_subdevdata(sd); - int ret; - if (len == AP1302_REG16) - ret = regmap_write(dev->regmap16, reg, val); - else if (len == AP1302_REG32) - ret = regmap_write(dev->regmap32, reg, val); - else - ret = -EINVAL; - if (ret) { - dev_dbg(&client->dev, "Write reg failed. reg=0x%04X\n", reg); - return ret; - } - if (len == AP1302_REG16) - dev_dbg(&client->dev, "write_reg[0x%04X] = 0x%04X\n", - reg, (u16)val); - else - dev_dbg(&client->dev, "write_reg[0x%04X] = 0x%08X\n", - reg, (u32)val); - return ret; -} - -static u16 -ap1302_calculate_context_reg_addr(enum ap1302_contexts context, u16 offset) -{ - u16 reg_addr; - /* The register offset is defined according to preview/video registers. - Preview and video context have the same register definition. - But snapshot context does not have register S1_SENSOR_MODE. - When setting snapshot registers, if the offset exceeds - S1_SENSOR_MODE, the actual offset needs to minus 2. */ - if (context == CONTEXT_SNAPSHOT) { - if (offset == CNTX_S1_SENSOR_MODE) - return 0; - if (offset > CNTX_S1_SENSOR_MODE) - offset -= 2; - } - if (context == CONTEXT_PREVIEW) - reg_addr = REG_PREVIEW_BASE + offset; - else if (context == CONTEXT_VIDEO) - reg_addr = REG_VIDEO_BASE + offset; - else - reg_addr = REG_SNAPSHOT_BASE + offset; - return reg_addr; -} - -static int ap1302_read_context_reg(struct v4l2_subdev *sd, - enum ap1302_contexts context, u16 offset, u16 len) -{ - struct ap1302_device *dev = to_ap1302_device(sd); - u16 reg_addr = ap1302_calculate_context_reg_addr(context, offset); - if (reg_addr == 0) - return -EINVAL; - return ap1302_i2c_read_reg(sd, reg_addr, len, - ((u8 *)&dev->cntx_config[context]) + offset); -} - -static int ap1302_write_context_reg(struct v4l2_subdev *sd, - enum ap1302_contexts context, u16 offset, u16 len) -{ - struct ap1302_device *dev = to_ap1302_device(sd); - u16 reg_addr = ap1302_calculate_context_reg_addr(context, offset); - if (reg_addr == 0) - return -EINVAL; - return ap1302_i2c_write_reg(sd, reg_addr, len, - *(u32 *)(((u8 *)&dev->cntx_config[context]) + offset)); -} - -static int ap1302_dump_context_reg(struct v4l2_subdev *sd, - enum ap1302_contexts context) -{ - struct i2c_client *client = v4l2_get_subdevdata(sd); - struct ap1302_device *dev = to_ap1302_device(sd); - int i; - dev_dbg(&client->dev, "Dump registers for context[%d]:\n", context); - for (i = 0; i < ARRAY_SIZE(context_info); i++) { - struct ap1302_context_info *info = &context_info[i]; - u8 *var = (u8 *)&dev->cntx_config[context] + info->offset; - /* Snapshot context does not have s1_sensor_mode register. */ - if (context == CONTEXT_SNAPSHOT && - info->offset == CNTX_S1_SENSOR_MODE) - continue; - ap1302_read_context_reg(sd, context, info->offset, info->len); - if (info->len == AP1302_REG16) - dev_dbg(&client->dev, "context.%s = 0x%04X (%d)\n", - info->name, *(u16 *)var, *(u16 *)var); - else - dev_dbg(&client->dev, "context.%s = 0x%08X (%d)\n", - info->name, *(u32 *)var, *(u32 *)var); - } - return 0; -} - -static int ap1302_request_firmware(struct v4l2_subdev *sd) -{ - struct i2c_client *client = v4l2_get_subdevdata(sd); - struct ap1302_device *dev = to_ap1302_device(sd); - int ret; - ret = request_firmware(&dev->fw, "ap1302_fw.bin", &client->dev); - if (ret) - dev_err(&client->dev, - "ap1302_request_firmware failed. ret=%d\n", ret); - return ret; -} - -/* When loading firmware, host writes firmware data from address 0x8000. - When the address reaches 0x9FFF, the next address should return to 0x8000. - This function handles this address window and load firmware data to AP1302. - win_pos indicates the offset within this window. Firmware loading procedure - may call this function several times. win_pos records the current position - that has been written to.*/ -static int ap1302_write_fw_window(struct v4l2_subdev *sd, - u16 *win_pos, const u8 *buf, u32 len) -{ - struct ap1302_device *dev = to_ap1302_device(sd); - int ret; - u32 pos; - u32 sub_len; - for (pos = 0; pos < len; pos += sub_len) { - if (len - pos < AP1302_FW_WINDOW_SIZE - *win_pos) - sub_len = len - pos; - else - sub_len = AP1302_FW_WINDOW_SIZE - *win_pos; - ret = regmap_raw_write(dev->regmap16, - *win_pos + AP1302_FW_WINDOW_OFFSET, - buf + pos, sub_len); - if (ret) - return ret; - *win_pos += sub_len; - if (*win_pos >= AP1302_FW_WINDOW_SIZE) - *win_pos = 0; - } - return 0; -} - -static int ap1302_load_firmware(struct v4l2_subdev *sd) -{ - struct i2c_client *client = v4l2_get_subdevdata(sd); - struct ap1302_device *dev = to_ap1302_device(sd); - const struct ap1302_firmware *fw; - const u8 *fw_data; - u16 reg_val = 0; - u16 win_pos = 0; - int ret; - - dev_info(&client->dev, "Start to load firmware.\n"); - if (!dev->fw) { - dev_err(&client->dev, "firmware not requested.\n"); - return -EINVAL; - } - fw = (const struct ap1302_firmware *) dev->fw->data; - if (dev->fw->size != (sizeof(*fw) + fw->total_size)) { - dev_err(&client->dev, "firmware size does not match.\n"); - return -EINVAL; - } - /* The fw binary contains a header of struct ap1302_firmware. - Following the header is the bootdata of AP1302. - The bootdata pointer can be referenced as &fw[1]. */ - fw_data = (u8 *)&fw[1]; - - /* Clear crc register. */ - ret = ap1302_i2c_write_reg(sd, REG_SIP_CRC, AP1302_REG16, 0xFFFF); - if (ret) - return ret; - - /* Load FW data for PLL init stage. */ - ret = ap1302_write_fw_window(sd, &win_pos, fw_data, fw->pll_init_size); - if (ret) - return ret; - - /* Write 2 to bootdata_stage register to apply basic_init_hp - settings and enable PLL. */ - ret = ap1302_i2c_write_reg(sd, REG_BOOTDATA_STAGE, - AP1302_REG16, 0x0002); - if (ret) - return ret; - - /* Wait 1ms for PLL to lock. */ - msleep(20); - - /* Load the rest of bootdata content. */ - ret = ap1302_write_fw_window(sd, &win_pos, fw_data + fw->pll_init_size, - fw->total_size - fw->pll_init_size); - if (ret) - return ret; - - /* Check crc. */ - ret = ap1302_i2c_read_reg(sd, REG_SIP_CRC, AP1302_REG16, ®_val); - if (ret) - return ret; - if (reg_val != fw->crc) { - dev_err(&client->dev, - "crc does not match. T:0x%04X F:0x%04X\n", - fw->crc, reg_val); - return -EAGAIN; - } - - /* Write 0xFFFF to bootdata_stage register to indicate AP1302 that - the whole bootdata content has been loaded. */ - ret = ap1302_i2c_write_reg(sd, REG_BOOTDATA_STAGE, - AP1302_REG16, 0xFFFF); - if (ret) - return ret; - dev_info(&client->dev, "Load firmware successfully.\n"); - - return 0; -} - -static int __ap1302_s_power(struct v4l2_subdev *sd, int on, int load_fw) -{ - struct ap1302_device *dev = to_ap1302_device(sd); - struct i2c_client *client = v4l2_get_subdevdata(sd); - int ret, i; - u16 ss_ptr; - - dev_info(&client->dev, "ap1302_s_power is called.\n"); - ret = dev->platform_data->power_ctrl(sd, on); - if (ret) { - dev_err(&client->dev, - "ap1302_s_power error. on=%d ret=%d\n", on, ret); - return ret; - } - dev->power_on = on; - if (!on || !load_fw) - return 0; - /* Load firmware after power on. */ - ret = ap1302_load_firmware(sd); - if (ret) { - dev_err(&client->dev, - "ap1302_load_firmware failed. ret=%d\n", ret); - return ret; - } - ret = ap1302_i2c_read_reg(sd, REG_SS_HEAD_PT0, AP1302_REG16, &ss_ptr); - if (ret) - return ret; - for (i = 0; i < ARRAY_SIZE(ap1302_ss_list); i++) { - ret = ap1302_i2c_write_reg(sd, ss_ptr + i * 2, - AP1302_REG16, ap1302_ss_list[i]); - if (ret) - return ret; - } - return ret; -} - -static int ap1302_s_power(struct v4l2_subdev *sd, int on) -{ - struct ap1302_device *dev = to_ap1302_device(sd); - int ret; - - mutex_lock(&dev->input_lock); - ret = __ap1302_s_power(sd, on, 1); - dev->sys_activated = 0; - mutex_unlock(&dev->input_lock); - - return ret; -} - -static int ap1302_s_config(struct v4l2_subdev *sd, void *pdata) -{ - struct ap1302_device *dev = to_ap1302_device(sd); - struct i2c_client *client = v4l2_get_subdevdata(sd); - struct camera_mipi_info *mipi_info; - u16 reg_val = 0; - int ret; - - dev_info(&client->dev, "ap1302_s_config is called.\n"); - if (pdata == NULL) - return -ENODEV; - - dev->platform_data = pdata; - - mutex_lock(&dev->input_lock); - - if (dev->platform_data->platform_init) { - ret = dev->platform_data->platform_init(client); - if (ret) - goto fail_power; - } - - ret = __ap1302_s_power(sd, 1, 0); - if (ret) - goto fail_power; - - /* Detect for AP1302 */ - ret = ap1302_i2c_read_reg(sd, REG_CHIP_VERSION, AP1302_REG16, ®_val); - if (ret || (reg_val != AP1302_CHIP_ID)) { - dev_err(&client->dev, - "Chip version does no match. ret=%d ver=0x%04x\n", - ret, reg_val); - goto fail_config; - } - dev_info(&client->dev, "AP1302 Chip ID is 0x%X\n", reg_val); - - /* Detect revision for AP1302 */ - ret = ap1302_i2c_read_reg(sd, REG_CHIP_REV, AP1302_REG16, ®_val); - if (ret) - goto fail_config; - dev_info(&client->dev, "AP1302 Chip Rev is 0x%X\n", reg_val); - ret = dev->platform_data->csi_cfg(sd, 1); - if (ret) - goto fail_config; - - mipi_info = v4l2_get_subdev_hostdata(sd); - if (!mipi_info) - goto fail_config; - dev->num_lanes = mipi_info->num_lanes; - - ret = __ap1302_s_power(sd, 0, 0); - if (ret) - goto fail_power; - - mutex_unlock(&dev->input_lock); - - return ret; - -fail_config: - __ap1302_s_power(sd, 0, 0); -fail_power: - mutex_unlock(&dev->input_lock); - dev_err(&client->dev, "ap1302_s_config failed\n"); - return ret; -} - -static enum ap1302_contexts ap1302_get_context(struct v4l2_subdev *sd) -{ - struct ap1302_device *dev = to_ap1302_device(sd); - return dev->cur_context; -} - -static int ap1302_enum_mbus_code(struct v4l2_subdev *sd, - struct v4l2_subdev_pad_config *cfg, - struct v4l2_subdev_mbus_code_enum *code) -{ - if (code->index) - return -EINVAL; - - code->code = MEDIA_BUS_FMT_UYVY8_1X16; - - return 0; -} - -static int ap1302_match_resolution(struct ap1302_context_res *res, - struct v4l2_mbus_framefmt *fmt) -{ - s32 w0, h0, mismatch, distance; - s32 w1 = fmt->width; - s32 h1 = fmt->height; - s32 min_distance = INT_MAX; - s32 i, idx = -1; - - if (w1 == 0 || h1 == 0) - return -1; - - for (i = 0; i < res->res_num; i++) { - w0 = res->res_table[i].width; - h0 = res->res_table[i].height; - if (w0 < w1 || h0 < h1) - continue; - mismatch = abs(w0 * h1 - w1 * h0) * 8192 / w1 / h0; - if (mismatch > 8192 * AP1302_MAX_RATIO_MISMATCH / 100) - continue; - distance = (w0 * h1 + w1 * h0) * 8192 / w1 / h1; - if (distance < min_distance) { - min_distance = distance; - idx = i; - } - } - - return idx; -} - -static s32 ap1302_try_mbus_fmt_locked(struct v4l2_subdev *sd, - enum ap1302_contexts context, - struct v4l2_mbus_framefmt *fmt) -{ - struct ap1302_device *dev = to_ap1302_device(sd); - struct ap1302_res_struct *res_table; - s32 res_num, idx = -1; - - res_table = dev->cntx_res[context].res_table; - res_num = dev->cntx_res[context].res_num; - - if ((fmt->width <= res_table[res_num - 1].width) && - (fmt->height <= res_table[res_num - 1].height)) - idx = ap1302_match_resolution(&dev->cntx_res[context], fmt); - if (idx == -1) - idx = res_num - 1; - - fmt->width = res_table[idx].width; - fmt->height = res_table[idx].height; - fmt->code = MEDIA_BUS_FMT_UYVY8_1X16; - return idx; -} - - -static int ap1302_get_fmt(struct v4l2_subdev *sd, - struct v4l2_subdev_pad_config *cfg, - struct v4l2_subdev_format *format) - -{ - struct v4l2_mbus_framefmt *fmt = &format->format; - struct ap1302_device *dev = to_ap1302_device(sd); - enum ap1302_contexts context; - struct ap1302_res_struct *res_table; - s32 cur_res; - if (format->pad) - return -EINVAL; - mutex_lock(&dev->input_lock); - context = ap1302_get_context(sd); - res_table = dev->cntx_res[context].res_table; - cur_res = dev->cntx_res[context].cur_res; - fmt->code = MEDIA_BUS_FMT_UYVY8_1X16; - fmt->width = res_table[cur_res].width; - fmt->height = res_table[cur_res].height; - mutex_unlock(&dev->input_lock); - return 0; -} - -static int ap1302_set_fmt(struct v4l2_subdev *sd, - struct v4l2_subdev_pad_config *cfg, - struct v4l2_subdev_format *format) -{ - struct v4l2_mbus_framefmt *fmt = &format->format; - struct ap1302_device *dev = to_ap1302_device(sd); - struct i2c_client *client = v4l2_get_subdevdata(sd); - struct atomisp_input_stream_info *stream_info = - (struct atomisp_input_stream_info *)fmt->reserved; - enum ap1302_contexts context, main_context; - if (format->pad) - return -EINVAL; - if (!fmt) - return -EINVAL; - mutex_lock(&dev->input_lock); - if (format->which == V4L2_SUBDEV_FORMAT_TRY) { - context = ap1302_get_context(sd); - ap1302_try_mbus_fmt_locked(sd, context, fmt); - cfg->try_fmt = *fmt; - mutex_unlock(&dev->input_lock); - return 0; - } - context = stream_to_context[stream_info->stream]; - dev_dbg(&client->dev, "ap1302_set_mbus_fmt. stream=%d context=%d\n", - stream_info->stream, context); - dev->cntx_res[context].cur_res = - ap1302_try_mbus_fmt_locked(sd, context, fmt); - dev->cntx_config[context].width = fmt->width; - dev->cntx_config[context].height = fmt->height; - ap1302_write_context_reg(sd, context, CNTX_WIDTH, AP1302_REG16); - ap1302_write_context_reg(sd, context, CNTX_HEIGHT, AP1302_REG16); - ap1302_read_context_reg(sd, context, CNTX_OUT_FMT, AP1302_REG16); - dev->cntx_config[context].out_fmt &= ~OUT_FMT_TYPE_MASK; - dev->cntx_config[context].out_fmt |= AP1302_FMT_UYVY422; - ap1302_write_context_reg(sd, context, CNTX_OUT_FMT, AP1302_REG16); - - main_context = ap1302_get_context(sd); - if (context == main_context) { - ap1302_read_context_reg(sd, context, - CNTX_MIPI_CTRL, AP1302_REG16); - dev->cntx_config[context].mipi_ctrl &= ~MIPI_CTRL_IMGVC_MASK; - dev->cntx_config[context].mipi_ctrl |= - (context << MIPI_CTRL_IMGVC_OFFSET); - dev->cntx_config[context].mipi_ctrl &= ~MIPI_CTRL_SSVC_MASK; - dev->cntx_config[context].mipi_ctrl |= - (context << MIPI_CTRL_SSVC_OFFSET); - dev->cntx_config[context].mipi_ctrl &= ~MIPI_CTRL_SSTYPE_MASK; - dev->cntx_config[context].mipi_ctrl |= - (0x12 << MIPI_CTRL_SSTYPE_OFFSET); - ap1302_write_context_reg(sd, context, - CNTX_MIPI_CTRL, AP1302_REG16); - ap1302_read_context_reg(sd, context, - CNTX_SS, AP1302_REG16); - dev->cntx_config[context].ss = AP1302_SS_CTRL; - ap1302_write_context_reg(sd, context, - CNTX_SS, AP1302_REG16); - } else { - /* Configure aux stream */ - ap1302_read_context_reg(sd, context, - CNTX_MIPI_II_CTRL, AP1302_REG16); - dev->cntx_config[context].mipi_ii_ctrl &= ~MIPI_CTRL_IMGVC_MASK; - dev->cntx_config[context].mipi_ii_ctrl |= - (context << MIPI_CTRL_IMGVC_OFFSET); - ap1302_write_context_reg(sd, context, - CNTX_MIPI_II_CTRL, AP1302_REG16); - if (stream_info->enable) { - ap1302_read_context_reg(sd, main_context, - CNTX_OUT_FMT, AP1302_REG16); - dev->cntx_config[context].out_fmt |= - (aux_stream_config[main_context][context] - << OUT_FMT_IIS_OFFSET); - ap1302_write_context_reg(sd, main_context, - CNTX_OUT_FMT, AP1302_REG16); - } - } - stream_info->ch_id = context; - mutex_unlock(&dev->input_lock); - - return 0; -} - - -static int ap1302_g_frame_interval(struct v4l2_subdev *sd, - struct v4l2_subdev_frame_interval *interval) -{ - struct ap1302_device *dev = to_ap1302_device(sd); - enum ap1302_contexts context; - struct ap1302_res_struct *res_table; - u32 cur_res; - - mutex_lock(&dev->input_lock); - context = ap1302_get_context(sd); - res_table = dev->cntx_res[context].res_table; - cur_res = dev->cntx_res[context].cur_res; - interval->interval.denominator = res_table[cur_res].fps; - interval->interval.numerator = 1; - mutex_unlock(&dev->input_lock); - return 0; -} - -static int ap1302_enum_frame_size(struct v4l2_subdev *sd, - struct v4l2_subdev_pad_config *cfg, - struct v4l2_subdev_frame_size_enum *fse) -{ - struct ap1302_device *dev = to_ap1302_device(sd); - enum ap1302_contexts context; - struct ap1302_res_struct *res_table; - int index = fse->index; - - mutex_lock(&dev->input_lock); - context = ap1302_get_context(sd); - if (index >= dev->cntx_res[context].res_num) { - mutex_unlock(&dev->input_lock); - return -EINVAL; - } - - res_table = dev->cntx_res[context].res_table; - fse->min_width = res_table[index].width; - fse->min_height = res_table[index].height; - fse->max_width = res_table[index].width; - fse->max_height = res_table[index].height; - mutex_unlock(&dev->input_lock); - - return 0; -} - - -static int ap1302_g_skip_frames(struct v4l2_subdev *sd, u32 *frames) -{ - *frames = 0; - return 0; -} - -static int ap1302_s_stream(struct v4l2_subdev *sd, int enable) -{ - struct ap1302_device *dev = to_ap1302_device(sd); - struct i2c_client *client = v4l2_get_subdevdata(sd); - enum ap1302_contexts context; - u32 reg_val; - int ret; - - mutex_lock(&dev->input_lock); - context = ap1302_get_context(sd); - dev_dbg(&client->dev, "ap1302_s_stream. context=%d enable=%d\n", - context, enable); - /* Switch context */ - ap1302_i2c_read_reg(sd, REG_CTRL, - AP1302_REG16, ®_val); - reg_val &= ~CTRL_CNTX_MASK; - reg_val |= (context<<CTRL_CNTX_OFFSET); - ap1302_i2c_write_reg(sd, REG_CTRL, - AP1302_REG16, reg_val); - /* Select sensor */ - ap1302_i2c_read_reg(sd, REG_SENSOR_SELECT, - AP1302_REG16, ®_val); - reg_val &= ~SENSOR_SELECT_MASK; - reg_val |= (AP1302_SENSOR_PRI<<SENSOR_SELECT_OFFSET); - ap1302_i2c_write_reg(sd, REG_SENSOR_SELECT, - AP1302_REG16, reg_val); - if (enable) { - dev_info(&client->dev, "Start stream. context=%d\n", context); - ap1302_dump_context_reg(sd, context); - if (!dev->sys_activated) { - reg_val = AP1302_SYS_ACTIVATE; - dev->sys_activated = 1; - } else { - reg_val = AP1302_SYS_SWITCH; - } - } else { - dev_info(&client->dev, "Stop stream. context=%d\n", context); - reg_val = AP1302_SYS_SWITCH; - } - ret = ap1302_i2c_write_reg(sd, REG_SYS_START, AP1302_REG16, reg_val); - if (ret) - dev_err(&client->dev, - "AP1302 set stream failed. enable=%d\n", enable); - mutex_unlock(&dev->input_lock); - return ret; -} - -static u16 ap1302_ev_values[] = {0xfd00, 0xfe80, 0x0, 0x180, 0x300}; - -static int ap1302_set_exposure_off(struct v4l2_subdev *sd, s32 val) -{ - val -= AP1302_MIN_EV; - return ap1302_i2c_write_reg(sd, REG_AE_BV_OFF, AP1302_REG16, - ap1302_ev_values[val]); -} - -static u16 ap1302_wb_values[] = { - 0, /* V4L2_WHITE_BALANCE_MANUAL */ - 0xf, /* V4L2_WHITE_BALANCE_AUTO */ - 0x2, /* V4L2_WHITE_BALANCE_INCANDESCENT */ - 0x4, /* V4L2_WHITE_BALANCE_FLUORESCENT */ - 0x5, /* V4L2_WHITE_BALANCE_FLUORESCENT_H */ - 0x1, /* V4L2_WHITE_BALANCE_HORIZON */ - 0x5, /* V4L2_WHITE_BALANCE_DAYLIGHT */ - 0xf, /* V4L2_WHITE_BALANCE_FLASH */ - 0x6, /* V4L2_WHITE_BALANCE_CLOUDY */ - 0x6, /* V4L2_WHITE_BALANCE_SHADE */ -}; - -static int ap1302_set_wb_mode(struct v4l2_subdev *sd, s32 val) -{ - int ret = 0; - u16 reg_val; - - ret = ap1302_i2c_read_reg(sd, REG_AWB_CTRL, AP1302_REG16, ®_val); - if (ret) - return ret; - reg_val &= ~AWB_CTRL_MODE_MASK; - reg_val |= ap1302_wb_values[val] << AWB_CTRL_MODE_OFFSET; - if (val == V4L2_WHITE_BALANCE_FLASH) - reg_val |= AWB_CTRL_FLASH_MASK; - else - reg_val &= ~AWB_CTRL_FLASH_MASK; - ret = ap1302_i2c_write_reg(sd, REG_AWB_CTRL, AP1302_REG16, reg_val); - return ret; -} - -static int ap1302_set_zoom(struct v4l2_subdev *sd, s32 val) -{ - ap1302_i2c_write_reg(sd, REG_DZ_TGT_FCT, AP1302_REG16, - val * 4 + 0x100); - return 0; -} - -static u16 ap1302_sfx_values[] = { - 0x00, /* V4L2_COLORFX_NONE */ - 0x03, /* V4L2_COLORFX_BW */ - 0x0d, /* V4L2_COLORFX_SEPIA */ - 0x07, /* V4L2_COLORFX_NEGATIVE */ - 0x04, /* V4L2_COLORFX_EMBOSS */ - 0x0f, /* V4L2_COLORFX_SKETCH */ - 0x08, /* V4L2_COLORFX_SKY_BLUE */ - 0x09, /* V4L2_COLORFX_GRASS_GREEN */ - 0x0a, /* V4L2_COLORFX_SKIN_WHITEN */ - 0x00, /* V4L2_COLORFX_VIVID */ - 0x00, /* V4L2_COLORFX_AQUA */ - 0x00, /* V4L2_COLORFX_ART_FREEZE */ - 0x00, /* V4L2_COLORFX_SILHOUETTE */ - 0x10, /* V4L2_COLORFX_SOLARIZATION */ - 0x02, /* V4L2_COLORFX_ANTIQUE */ - 0x00, /* V4L2_COLORFX_SET_CBCR */ -}; - -static int ap1302_set_special_effect(struct v4l2_subdev *sd, s32 val) -{ - ap1302_i2c_write_reg(sd, REG_SFX_MODE, AP1302_REG16, - ap1302_sfx_values[val]); - return 0; -} - -static u16 ap1302_scene_mode_values[] = { - 0x00, /* V4L2_SCENE_MODE_NONE */ - 0x07, /* V4L2_SCENE_MODE_BACKLIGHT */ - 0x0a, /* V4L2_SCENE_MODE_BEACH_SNOW */ - 0x06, /* V4L2_SCENE_MODE_CANDLE_LIGHT */ - 0x00, /* V4L2_SCENE_MODE_DAWN_DUSK */ - 0x00, /* V4L2_SCENE_MODE_FALL_COLORS */ - 0x0d, /* V4L2_SCENE_MODE_FIREWORKS */ - 0x02, /* V4L2_SCENE_MODE_LANDSCAPE */ - 0x05, /* V4L2_SCENE_MODE_NIGHT */ - 0x0c, /* V4L2_SCENE_MODE_PARTY_INDOOR */ - 0x01, /* V4L2_SCENE_MODE_PORTRAIT */ - 0x03, /* V4L2_SCENE_MODE_SPORTS */ - 0x0e, /* V4L2_SCENE_MODE_SUNSET */ - 0x0b, /* V4L2_SCENE_MODE_TEXT */ -}; - -static int ap1302_set_scene_mode(struct v4l2_subdev *sd, s32 val) -{ - ap1302_i2c_write_reg(sd, REG_SCENE_CTRL, AP1302_REG16, - ap1302_scene_mode_values[val]); - return 0; -} - -static u16 ap1302_flicker_values[] = { - 0x0, /* OFF */ - 0x3201, /* 50HZ */ - 0x3c01, /* 60HZ */ - 0x2 /* AUTO */ -}; - -static int ap1302_set_flicker_freq(struct v4l2_subdev *sd, s32 val) -{ - ap1302_i2c_write_reg(sd, REG_FLICK_CTRL, AP1302_REG16, - ap1302_flicker_values[val]); - return 0; -} - -static int ap1302_s_ctrl(struct v4l2_ctrl *ctrl) -{ - struct ap1302_device *dev = container_of( - ctrl->handler, struct ap1302_device, ctrl_handler); - - switch (ctrl->id) { - case V4L2_CID_RUN_MODE: - dev->cur_context = ap1302_cntx_mapping[ctrl->val]; - break; - case V4L2_CID_EXPOSURE: - ap1302_set_exposure_off(&dev->sd, ctrl->val); - break; - case V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE: - ap1302_set_wb_mode(&dev->sd, ctrl->val); - break; - case V4L2_CID_ZOOM_ABSOLUTE: - ap1302_set_zoom(&dev->sd, ctrl->val); - break; - case V4L2_CID_COLORFX: - ap1302_set_special_effect(&dev->sd, ctrl->val); - break; - case V4L2_CID_SCENE_MODE: - ap1302_set_scene_mode(&dev->sd, ctrl->val); - break; - case V4L2_CID_POWER_LINE_FREQUENCY: - ap1302_set_flicker_freq(&dev->sd, ctrl->val); - break; - default: - return -EINVAL; - } - - return 0; -} - -static int ap1302_g_register(struct v4l2_subdev *sd, - struct v4l2_dbg_register *reg) -{ - struct ap1302_device *dev = to_ap1302_device(sd); - int ret; - u32 reg_val; - - if (reg->size != AP1302_REG16 && - reg->size != AP1302_REG32) - return -EINVAL; - - mutex_lock(&dev->input_lock); - if (dev->power_on) - ret = ap1302_i2c_read_reg(sd, reg->reg, reg->size, ®_val); - else - ret = -EIO; - mutex_unlock(&dev->input_lock); - if (ret) - return ret; - - reg->val = reg_val; - - return 0; -} - -static int ap1302_s_register(struct v4l2_subdev *sd, - const struct v4l2_dbg_register *reg) -{ - struct ap1302_device *dev = to_ap1302_device(sd); - int ret; - - if (reg->size != AP1302_REG16 && - reg->size != AP1302_REG32) - return -EINVAL; - - mutex_lock(&dev->input_lock); - if (dev->power_on) - ret = ap1302_i2c_write_reg(sd, reg->reg, reg->size, reg->val); - else - ret = -EIO; - mutex_unlock(&dev->input_lock); - return ret; -} - -static long ap1302_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg) -{ - long ret = 0; - switch (cmd) { - case VIDIOC_DBG_G_REGISTER: - ret = ap1302_g_register(sd, arg); - break; - case VIDIOC_DBG_S_REGISTER: - ret = ap1302_s_register(sd, arg); - break; - default: - ret = -EINVAL; - } - return ret; -} - -static const struct v4l2_ctrl_ops ctrl_ops = { - .s_ctrl = ap1302_s_ctrl, -}; - -static const char * const ctrl_run_mode_menu[] = { - NULL, - "Video", - "Still capture", - "Continuous capture", - "Preview", -}; - -static const struct v4l2_ctrl_config ctrls[] = { - { - .ops = &ctrl_ops, - .id = V4L2_CID_RUN_MODE, - .name = "Run Mode", - .type = V4L2_CTRL_TYPE_MENU, - .min = 1, - .def = 4, - .max = 4, - .qmenu = ctrl_run_mode_menu, - }, - { - .ops = &ctrl_ops, - .id = V4L2_CID_EXPOSURE, - .name = "Exposure", - .type = V4L2_CTRL_TYPE_INTEGER, - .min = AP1302_MIN_EV, - .def = 0, - .max = AP1302_MAX_EV, - .step = 1, - }, - { - .ops = &ctrl_ops, - .id = V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE, - .name = "White Balance", - .type = V4L2_CTRL_TYPE_INTEGER, - .min = 0, - .def = 0, - .max = 9, - .step = 1, - }, - { - .ops = &ctrl_ops, - .id = V4L2_CID_ZOOM_ABSOLUTE, - .name = "Zoom Absolute", - .type = V4L2_CTRL_TYPE_INTEGER, - .min = 0, - .def = 0, - .max = 1024, - .step = 1, - }, - { - .ops = &ctrl_ops, - .id = V4L2_CID_COLORFX, - .name = "Color Special Effect", - .type = V4L2_CTRL_TYPE_INTEGER, - .min = 0, - .def = 0, - .max = 15, - .step = 1, - }, - { - .ops = &ctrl_ops, - .id = V4L2_CID_SCENE_MODE, - .name = "Scene Mode", - .type = V4L2_CTRL_TYPE_INTEGER, - .min = 0, - .def = 0, - .max = 13, - .step = 1, - }, - { - .ops = &ctrl_ops, - .id = V4L2_CID_POWER_LINE_FREQUENCY, - .name = "Light frequency filter", - .type = V4L2_CTRL_TYPE_INTEGER, - .min = 0, - .def = 3, - .max = 3, - .step = 1, - }, -}; - -static const struct v4l2_subdev_sensor_ops ap1302_sensor_ops = { - .g_skip_frames = ap1302_g_skip_frames, -}; - -static const struct v4l2_subdev_video_ops ap1302_video_ops = { - .s_stream = ap1302_s_stream, - .g_frame_interval = ap1302_g_frame_interval, -}; - -static const struct v4l2_subdev_core_ops ap1302_core_ops = { - .s_power = ap1302_s_power, - .ioctl = ap1302_ioctl, -#ifdef CONFIG_VIDEO_ADV_DEBUG - .g_register = ap1302_g_register, - .s_register = ap1302_s_register, -#endif -}; - -static const struct v4l2_subdev_pad_ops ap1302_pad_ops = { - .enum_mbus_code = ap1302_enum_mbus_code, - .enum_frame_size = ap1302_enum_frame_size, - .get_fmt = ap1302_get_fmt, - .set_fmt = ap1302_set_fmt, -}; - -static const struct v4l2_subdev_ops ap1302_ops = { - .core = &ap1302_core_ops, - .pad = &ap1302_pad_ops, - .video = &ap1302_video_ops, - .sensor = &ap1302_sensor_ops -}; - -static int ap1302_remove(struct i2c_client *client) -{ - struct v4l2_subdev *sd = i2c_get_clientdata(client); - struct ap1302_device *dev = to_ap1302_device(sd); - - if (dev->platform_data->platform_deinit) - dev->platform_data->platform_deinit(); - - release_firmware(dev->fw); - - media_entity_cleanup(&dev->sd.entity); - dev->platform_data->csi_cfg(sd, 0); - v4l2_device_unregister_subdev(sd); - - return 0; -} - -static int ap1302_probe(struct i2c_client *client, - const struct i2c_device_id *id) -{ - struct ap1302_device *dev; - int ret; - unsigned int i; - - dev_info(&client->dev, "ap1302 probe called.\n"); - - /* allocate device & init sub device */ - dev = devm_kzalloc(&client->dev, sizeof(*dev), GFP_KERNEL); - if (!dev) { - dev_err(&client->dev, "%s: out of memory\n", __func__); - return -ENOMEM; - } - - mutex_init(&dev->input_lock); - - v4l2_i2c_subdev_init(&(dev->sd), client, &ap1302_ops); - - ret = ap1302_request_firmware(&(dev->sd)); - if (ret) { - dev_err(&client->dev, "Cannot request ap1302 firmware.\n"); - goto out_free; - } - - dev->regmap16 = devm_regmap_init_i2c(client, &ap1302_reg16_config); - if (IS_ERR(dev->regmap16)) { - ret = PTR_ERR(dev->regmap16); - dev_err(&client->dev, - "Failed to allocate 16bit register map: %d\n", ret); - return ret; - } - - dev->regmap32 = devm_regmap_init_i2c(client, &ap1302_reg32_config); - if (IS_ERR(dev->regmap32)) { - ret = PTR_ERR(dev->regmap32); - dev_err(&client->dev, - "Failed to allocate 32bit register map: %d\n", ret); - return ret; - } - - if (client->dev.platform_data) { - ret = ap1302_s_config(&dev->sd, client->dev.platform_data); - if (ret) - goto out_free; - } - - dev->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; - dev->pad.flags = MEDIA_PAD_FL_SOURCE; - dev->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR; - - dev->cntx_res[CONTEXT_PREVIEW].res_num = ARRAY_SIZE(ap1302_preview_res); - dev->cntx_res[CONTEXT_PREVIEW].res_table = ap1302_preview_res; - dev->cntx_res[CONTEXT_SNAPSHOT].res_num = - ARRAY_SIZE(ap1302_snapshot_res); - dev->cntx_res[CONTEXT_SNAPSHOT].res_table = ap1302_snapshot_res; - dev->cntx_res[CONTEXT_VIDEO].res_num = ARRAY_SIZE(ap1302_video_res); - dev->cntx_res[CONTEXT_VIDEO].res_table = ap1302_video_res; - - ret = v4l2_ctrl_handler_init(&dev->ctrl_handler, ARRAY_SIZE(ctrls)); - if (ret) { - ap1302_remove(client); - return ret; - } - - for (i = 0; i < ARRAY_SIZE(ctrls); i++) - v4l2_ctrl_new_custom(&dev->ctrl_handler, &ctrls[i], NULL); - - if (dev->ctrl_handler.error) { - ap1302_remove(client); - return dev->ctrl_handler.error; - } - - /* Use same lock for controls as for everything else. */ - dev->ctrl_handler.lock = &dev->input_lock; - dev->sd.ctrl_handler = &dev->ctrl_handler; - v4l2_ctrl_handler_setup(&dev->ctrl_handler); - - dev->run_mode = v4l2_ctrl_find(&dev->ctrl_handler, V4L2_CID_RUN_MODE); - v4l2_ctrl_s_ctrl(dev->run_mode, ATOMISP_RUN_MODE_PREVIEW); - - ret = media_entity_pads_init(&dev->sd.entity, 1, &dev->pad); - if (ret) - ap1302_remove(client); - return ret; -out_free: - v4l2_device_unregister_subdev(&dev->sd); - return ret; -} - -static const struct i2c_device_id ap1302_id[] = { - {AP1302_NAME, 0}, - {} -}; -MODULE_DEVICE_TABLE(i2c, ap1302_id); - -static struct i2c_driver ap1302_driver = { - .driver = { - .name = AP1302_NAME, - }, - .probe = ap1302_probe, - .remove = ap1302_remove, - .id_table = ap1302_id, -}; - -module_i2c_driver(ap1302_driver); - -MODULE_AUTHOR("Tianshu Qiu <tian.shu.qiu@intel.com>"); -MODULE_DESCRIPTION("AP1302 Driver"); -MODULE_LICENSE("GPL"); diff --git a/drivers/staging/media/atomisp/i2c/ap1302.h b/drivers/staging/media/atomisp/i2c/ap1302.h deleted file mode 100644 index 4d0b181a9671..000000000000 --- a/drivers/staging/media/atomisp/i2c/ap1302.h +++ /dev/null @@ -1,198 +0,0 @@ -/* - * - * Copyright (c) 2013 Intel Corporation. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. - * - */ - -#ifndef __AP1302_H__ -#define __AP1302_H__ - -#include "../include/linux/atomisp_platform.h" -#include <linux/regmap.h> -#include <linux/types.h> -#include <media/v4l2-ctrls.h> -#include <media/v4l2-subdev.h> - -#define AP1302_NAME "ap1302" -#define AP1302_CHIP_ID 0x265 -#define AP1302_I2C_MAX_LEN 65534 -#define AP1302_FW_WINDOW_OFFSET 0x8000 -#define AP1302_FW_WINDOW_SIZE 0x2000 - -#define AP1302_REG16 2 -#define AP1302_REG32 4 - -#define REG_CHIP_VERSION 0x0000 -#define REG_CHIP_REV 0x0050 -#define REG_MF_ID 0x0004 -#define REG_ERROR 0x0006 -#define REG_CTRL 0x1000 -#define REG_DZ_TGT_FCT 0x1010 -#define REG_SFX_MODE 0x1016 -#define REG_SS_HEAD_PT0 0x1174 -#define REG_AE_BV_OFF 0x5014 -#define REG_AE_BV_BIAS 0x5016 -#define REG_AWB_CTRL 0x5100 -#define REG_FLICK_CTRL 0x5440 -#define REG_SCENE_CTRL 0x5454 -#define REG_BOOTDATA_STAGE 0x6002 -#define REG_SENSOR_SELECT 0x600C -#define REG_SYS_START 0x601A -#define REG_SIP_CRC 0xF052 - -#define REG_PREVIEW_BASE 0x2000 -#define REG_SNAPSHOT_BASE 0x3000 -#define REG_VIDEO_BASE 0x4000 -#define CNTX_WIDTH 0x00 -#define CNTX_HEIGHT 0x02 -#define CNTX_ROI_X0 0x04 -#define CNTX_ROI_Y0 0x06 -#define CNTX_ROI_X1 0x08 -#define CNTX_ROI_Y1 0x0A -#define CNTX_ASPECT 0x0C -#define CNTX_LOCK 0x0E -#define CNTX_ENABLE 0x10 -#define CNTX_OUT_FMT 0x12 -#define CNTX_SENSOR_MODE 0x14 -#define CNTX_MIPI_CTRL 0x16 -#define CNTX_MIPI_II_CTRL 0x18 -#define CNTX_LINE_TIME 0x1C -#define CNTX_MAX_FPS 0x20 -#define CNTX_AE_USG 0x22 -#define CNTX_AE_UPPER_ET 0x24 -#define CNTX_AE_MAX_ET 0x28 -#define CNTX_SS 0x2C -#define CNTX_S1_SENSOR_MODE 0x2E -#define CNTX_HINF_CTRL 0x30 - -#define CTRL_CNTX_MASK 0x03 -#define CTRL_CNTX_OFFSET 0x00 -#define HINF_CTRL_LANE_MASK 0x07 -#define HINF_CTRL_LANE_OFFSET 0x00 -#define MIPI_CTRL_IMGVC_MASK 0xC0 -#define MIPI_CTRL_IMGVC_OFFSET 0x06 -#define MIPI_CTRL_IMGTYPE_AUTO 0x3F -#define MIPI_CTRL_SSVC_MASK 0xC000 -#define MIPI_CTRL_SSVC_OFFSET 0x0E -#define MIPI_CTRL_SSTYPE_MASK 0x3F00 -#define MIPI_CTRL_SSTYPE_OFFSET 0x08 -#define OUT_FMT_IIS_MASK 0x30 -#define OUT_FMT_IIS_OFFSET 0x08 -#define OUT_FMT_SS_MASK 0x1000 -#define OUT_FMT_SS_OFFSET 0x12 -#define OUT_FMT_TYPE_MASK 0xFF -#define SENSOR_SELECT_MASK 0x03 -#define SENSOR_SELECT_OFFSET 0x00 -#define AWB_CTRL_MODE_MASK 0x0F -#define AWB_CTRL_MODE_OFFSET 0x00 -#define AWB_CTRL_FLASH_MASK 0x100 - -#define AP1302_FMT_UYVY422 0x50 - -#define AP1302_SYS_ACTIVATE 0x8010 -#define AP1302_SYS_SWITCH 0x8140 -#define AP1302_SENSOR_PRI 0x01 -#define AP1302_SENSOR_SEC 0x02 -#define AP1302_SS_CTRL 0x31 - -#define AP1302_MAX_RATIO_MISMATCH 10 /* Unit in percentage */ -#define AP1302_MAX_EV 2 -#define AP1302_MIN_EV -2 - -enum ap1302_contexts { - CONTEXT_PREVIEW = 0, - CONTEXT_SNAPSHOT, - CONTEXT_VIDEO, - CONTEXT_NUM -}; - -/* The context registers are defined according to preview/video registers. - Preview and video context have the same register definition. - But snapshot context does not have register S1_SENSOR_MODE. - When setting snapshot registers, if the offset exceeds - S1_SENSOR_MODE, the actual offset needs to minus 2. */ -struct ap1302_context_config { - u16 width; - u16 height; - u16 roi_x0; - u16 roi_y0; - u16 roi_x1; - u16 roi_y1; - u16 aspect_factor; - u16 lock; - u16 enable; - u16 out_fmt; - u16 sensor_mode; - u16 mipi_ctrl; - u16 mipi_ii_ctrl; - u16 padding; - u32 line_time; - u16 max_fps; - u16 ae_usg; - u32 ae_upper_et; - u32 ae_max_et; - u16 ss; - u16 s1_sensor_mode; - u16 hinf_ctrl; - u32 reserved; -}; - -struct ap1302_res_struct { - u16 width; - u16 height; - u16 fps; -}; - -struct ap1302_context_res { - u32 res_num; - u32 cur_res; - struct ap1302_res_struct *res_table; -}; - -struct ap1302_device { - struct v4l2_subdev sd; - struct media_pad pad; - struct camera_sensor_platform_data *platform_data; - const struct firmware *fw; - struct mutex input_lock; /* serialize sensor's ioctl */ - struct v4l2_mbus_framefmt format; - struct v4l2_ctrl_handler ctrl_handler; - struct v4l2_ctrl *run_mode; - struct ap1302_context_config cntx_config[CONTEXT_NUM]; - struct ap1302_context_res cntx_res[CONTEXT_NUM]; - enum ap1302_contexts cur_context; - unsigned int num_lanes; - struct regmap *regmap16; - struct regmap *regmap32; - bool sys_activated; - bool power_on; -}; - -struct ap1302_firmware { - u32 crc; - u32 pll_init_size; - u32 total_size; - u32 reserved; -}; - -struct ap1302_context_info { - u16 offset; - u16 len; - char *name; -}; - -#endif diff --git a/drivers/staging/media/atomisp/i2c/gc0310.c b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c index 35ed51ffe944..e70d8afcc229 100644 --- a/drivers/staging/media/atomisp/i2c/gc0310.c +++ b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c @@ -26,7 +26,6 @@ #include <linux/delay.h> #include <linux/slab.h> #include <linux/i2c.h> -#include <linux/gpio.h> #include <linux/moduleparam.h> #include <media/v4l2-device.h> #include <linux/io.h> @@ -738,10 +737,6 @@ static int power_ctrl(struct v4l2_subdev *sd, bool flag) if (!dev || !dev->platform_data) return -ENODEV; - /* Non-gmin platforms use the legacy callback */ - if (dev->platform_data->power_ctrl) - return dev->platform_data->power_ctrl(sd, flag); - if (flag) { /* The upstream module driver (written to Crystal * Cove) had this logic to pulse the rails low first. @@ -772,10 +767,6 @@ static int gpio_ctrl(struct v4l2_subdev *sd, bool flag) if (!dev || !dev->platform_data) return -ENODEV; - /* Non-gmin platforms use the legacy callback */ - if (dev->platform_data->gpio_ctrl) - return dev->platform_data->gpio_ctrl(sd, flag); - /* GPIO0 == "reset" (active low), GPIO1 == "power down" */ if (flag) { /* Pulse reset, then release power down */ @@ -1165,13 +1156,6 @@ static int gc0310_s_config(struct v4l2_subdev *sd, (struct camera_sensor_platform_data *)platform_data; mutex_lock(&dev->input_lock); - if (dev->platform_data->platform_init) { - ret = dev->platform_data->platform_init(client); - if (ret) { - dev_err(&client->dev, "platform init err\n"); - goto platform_init_failed; - } - } /* power off the module, then power on it in future * as first power on by board may not fulfill the * power on sequqence needed by the module @@ -1216,9 +1200,6 @@ fail_power_on: power_down(sd); dev_err(&client->dev, "sensor power-gating failed\n"); fail_power_off: - if (dev->platform_data->platform_deinit) - dev->platform_data->platform_deinit(); -platform_init_failed: mutex_unlock(&dev->input_lock); return ret; } @@ -1362,9 +1343,6 @@ static int gc0310_remove(struct i2c_client *client) struct gc0310_device *dev = to_gc0310_sensor(sd); dev_dbg(&client->dev, "gc0310_remove...\n"); - if (dev->platform_data->platform_deinit) - dev->platform_data->platform_deinit(); - dev->platform_data->csi_cfg(sd, 0); v4l2_device_unregister_subdev(sd); @@ -1375,8 +1353,7 @@ static int gc0310_remove(struct i2c_client *client) return 0; } -static int gc0310_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static int gc0310_probe(struct i2c_client *client) { struct gc0310_device *dev; int ret; @@ -1385,10 +1362,8 @@ static int gc0310_probe(struct i2c_client *client, pr_info("%s S\n", __func__); dev = kzalloc(sizeof(*dev), GFP_KERNEL); - if (!dev) { - dev_err(&client->dev, "out of memory\n"); + if (!dev) return -ENOMEM; - } mutex_init(&dev->input_lock); @@ -1457,33 +1432,17 @@ static const struct acpi_device_id gc0310_acpi_match[] = { {"INT0310"}, {}, }; - MODULE_DEVICE_TABLE(acpi, gc0310_acpi_match); -MODULE_DEVICE_TABLE(i2c, gc0310_id); static struct i2c_driver gc0310_driver = { .driver = { - .name = GC0310_NAME, - .acpi_match_table = ACPI_PTR(gc0310_acpi_match), + .name = "gc0310", + .acpi_match_table = gc0310_acpi_match, }, - .probe = gc0310_probe, + .probe_new = gc0310_probe, .remove = gc0310_remove, - .id_table = gc0310_id, }; - -static int init_gc0310(void) -{ - return i2c_add_driver(&gc0310_driver); -} - -static void exit_gc0310(void) -{ - - i2c_del_driver(&gc0310_driver); -} - -module_init(init_gc0310); -module_exit(exit_gc0310); +module_i2c_driver(gc0310_driver); MODULE_AUTHOR("Lai, Angie <angie.lai@intel.com>"); MODULE_DESCRIPTION("A low-level driver for GalaxyCore GC0310 sensors"); diff --git a/drivers/staging/media/atomisp/i2c/gc2235.c b/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c index e43d31ea9676..85da5fe24033 100644 --- a/drivers/staging/media/atomisp/i2c/gc2235.c +++ b/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c @@ -26,7 +26,6 @@ #include <linux/delay.h> #include <linux/slab.h> #include <linux/i2c.h> -#include <linux/gpio.h> #include <linux/moduleparam.h> #include <media/v4l2-device.h> #include "../include/linux/atomisp_gmin_platform.h" @@ -548,10 +547,6 @@ static int power_ctrl(struct v4l2_subdev *sd, bool flag) if (!dev || !dev->platform_data) return -ENODEV; - /* Non-gmin platforms use the legacy callback */ - if (dev->platform_data->power_ctrl) - return dev->platform_data->power_ctrl(sd, flag); - if (flag) { ret = dev->platform_data->v1p8_ctrl(sd, 1); usleep_range(60, 90); @@ -572,10 +567,6 @@ static int gpio_ctrl(struct v4l2_subdev *sd, bool flag) if (!dev || !dev->platform_data) return -ENODEV; - /* Non-gmin platforms use the legacy callback */ - if (dev->platform_data->gpio_ctrl) - return dev->platform_data->gpio_ctrl(sd, flag); - ret |= dev->platform_data->gpio1_ctrl(sd, !flag); usleep_range(60, 90); return dev->platform_data->gpio0_ctrl(sd, flag); @@ -906,13 +897,6 @@ static int gc2235_s_config(struct v4l2_subdev *sd, (struct camera_sensor_platform_data *)platform_data; mutex_lock(&dev->input_lock); - if (dev->platform_data->platform_init) { - ret = dev->platform_data->platform_init(client); - if (ret) { - dev_err(&client->dev, "platform init err\n"); - goto platform_init_failed; - } - } /* power off the module, then power on it in future * as first power on by board may not fulfill the * power on sequqence needed by the module @@ -956,9 +940,6 @@ fail_power_on: power_down(sd); dev_err(&client->dev, "sensor power-gating failed\n"); fail_power_off: - if (dev->platform_data->platform_deinit) - dev->platform_data->platform_deinit(); -platform_init_failed: mutex_unlock(&dev->input_lock); return ret; } @@ -1101,9 +1082,6 @@ static int gc2235_remove(struct i2c_client *client) struct gc2235_device *dev = to_gc2235_sensor(sd); dev_dbg(&client->dev, "gc2235_remove...\n"); - if (dev->platform_data->platform_deinit) - dev->platform_data->platform_deinit(); - dev->platform_data->csi_cfg(sd, 0); v4l2_device_unregister_subdev(sd); @@ -1114,8 +1092,7 @@ static int gc2235_remove(struct i2c_client *client) return 0; } -static int gc2235_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static int gc2235_probe(struct i2c_client *client) { struct gc2235_device *dev; void *gcpdev; @@ -1123,10 +1100,8 @@ static int gc2235_probe(struct i2c_client *client, unsigned int i; dev = kzalloc(sizeof(*dev), GFP_KERNEL); - if (!dev) { - dev_err(&client->dev, "out of memory\n"); + if (!dev) return -ENOMEM; - } mutex_init(&dev->input_lock); @@ -1187,32 +1162,17 @@ static const struct acpi_device_id gc2235_acpi_match[] = { { "INT33F8" }, {}, }; - MODULE_DEVICE_TABLE(acpi, gc2235_acpi_match); -MODULE_DEVICE_TABLE(i2c, gc2235_id); + static struct i2c_driver gc2235_driver = { .driver = { - .name = GC2235_NAME, - .acpi_match_table = ACPI_PTR(gc2235_acpi_match), + .name = "gc2235", + .acpi_match_table = gc2235_acpi_match, }, - .probe = gc2235_probe, + .probe_new = gc2235_probe, .remove = gc2235_remove, - .id_table = gc2235_id, }; - -static int init_gc2235(void) -{ - return i2c_add_driver(&gc2235_driver); -} - -static void exit_gc2235(void) -{ - - i2c_del_driver(&gc2235_driver); -} - -module_init(init_gc2235); -module_exit(exit_gc2235); +module_i2c_driver(gc2235_driver); MODULE_AUTHOR("Shuguang Gong <Shuguang.Gong@intel.com>"); MODULE_DESCRIPTION("A low-level driver for GC2235 sensors"); diff --git a/drivers/staging/media/atomisp/i2c/libmsrlisthelper.c b/drivers/staging/media/atomisp/i2c/atomisp-libmsrlisthelper.c index decb65cfd7c9..81e5ec0c2b64 100644 --- a/drivers/staging/media/atomisp/i2c/libmsrlisthelper.c +++ b/drivers/staging/media/atomisp/i2c/atomisp-libmsrlisthelper.c @@ -10,10 +10,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ #include <linux/i2c.h> diff --git a/drivers/staging/media/atomisp/i2c/lm3554.c b/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c index 679176f7c542..4fd9f538ac95 100644 --- a/drivers/staging/media/atomisp/i2c/lm3554.c +++ b/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ #include <linux/module.h> @@ -171,10 +167,9 @@ static int lm3554_set_config1(struct lm3554 *flash) /* ----------------------------------------------------------------------------- * Hardware trigger */ -static void lm3554_flash_off_delay(long unsigned int arg) +static void lm3554_flash_off_delay(struct timer_list *t) { - struct v4l2_subdev *sd = i2c_get_clientdata((struct i2c_client *)arg); - struct lm3554 *flash = to_lm3554(sd); + struct lm3554 *flash = from_timer(flash, t, flash_off_delay); struct lm3554_platform_data *pdata = flash->pdata; gpio_set_value(pdata->gpio_strobe, 0); @@ -862,8 +857,7 @@ static void *lm3554_platform_data_func(struct i2c_client *client) return &platform_data; } -static int lm3554_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static int lm3554_probe(struct i2c_client *client) { int err = 0; struct lm3554 *flash; @@ -871,10 +865,8 @@ static int lm3554_probe(struct i2c_client *client, int ret; flash = kzalloc(sizeof(*flash), GFP_KERNEL); - if (!flash) { - dev_err(&client->dev, "out of memory\n"); + if (!flash) return -ENOMEM; - } flash->pdata = client->dev.platform_data; @@ -915,8 +907,7 @@ static int lm3554_probe(struct i2c_client *client, mutex_init(&flash->power_lock); - setup_timer(&flash->flash_off_delay, lm3554_flash_off_delay, - (unsigned long)client); + timer_setup(&flash->flash_off_delay, lm3554_flash_off_delay, 0); err = lm3554_gpio_init(client); if (err) { @@ -962,13 +953,6 @@ fail: return ret; } -static const struct i2c_device_id lm3554_id[] = { - {LM3554_NAME, 0}, - {}, -}; - -MODULE_DEVICE_TABLE(i2c, lm3554_id); - static const struct dev_pm_ops lm3554_pm_ops = { .suspend = lm3554_suspend, .resume = lm3554_resume, @@ -978,32 +962,19 @@ static const struct acpi_device_id lm3554_acpi_match[] = { { "INTCF1C" }, {}, }; - MODULE_DEVICE_TABLE(acpi, lm3554_acpi_match); static struct i2c_driver lm3554_driver = { .driver = { - .name = LM3554_NAME, + .name = "lm3554", .pm = &lm3554_pm_ops, - .acpi_match_table = ACPI_PTR(lm3554_acpi_match), + .acpi_match_table = lm3554_acpi_match, }, - .probe = lm3554_probe, + .probe_new = lm3554_probe, .remove = lm3554_remove, - .id_table = lm3554_id, }; +module_i2c_driver(lm3554_driver); -static __init int init_lm3554(void) -{ - return i2c_add_driver(&lm3554_driver); -} - -static __exit void exit_lm3554(void) -{ - i2c_del_driver(&lm3554_driver); -} - -module_init(init_lm3554); -module_exit(exit_lm3554); MODULE_AUTHOR("Jing Tao <jing.tao@intel.com>"); MODULE_DESCRIPTION("LED flash driver for LM3554"); MODULE_LICENSE("GPL"); diff --git a/drivers/staging/media/atomisp/i2c/mt9m114.c b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c index 3c837cb8859c..55882bea2049 100644 --- a/drivers/staging/media/atomisp/i2c/mt9m114.c +++ b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ @@ -32,7 +28,6 @@ #include <linux/slab.h> #include <linux/delay.h> #include <linux/i2c.h> -#include <linux/gpio.h> #include <linux/acpi.h> #include "../include/linux/atomisp_gmin_platform.h" #include <media/v4l2-device.h> @@ -455,10 +450,6 @@ static int power_ctrl(struct v4l2_subdev *sd, bool flag) if (!dev || !dev->platform_data) return -ENODEV; - /* Non-gmin platforms use the legacy callback */ - if (dev->platform_data->power_ctrl) - return dev->platform_data->power_ctrl(sd, flag); - if (flag) { ret = dev->platform_data->v2p8_ctrl(sd, 1); if (ret == 0) { @@ -481,10 +472,6 @@ static int gpio_ctrl(struct v4l2_subdev *sd, bool flag) if (!dev || !dev->platform_data) return -ENODEV; - /* Non-gmin platforms use the legacy callback */ - if (dev->platform_data->gpio_ctrl) - return dev->platform_data->gpio_ctrl(sd, flag); - /* Note: current modules wire only one GPIO signal (RESET#), * but the schematic wires up two to the connector. BIOS * versions have been unfortunately inconsistent with which @@ -1584,13 +1571,6 @@ mt9m114_s_config(struct v4l2_subdev *sd, int irq, void *platform_data) dev->platform_data = (struct camera_sensor_platform_data *)platform_data; - if (dev->platform_data->platform_init) { - ret = dev->platform_data->platform_init(client); - if (ret) { - v4l2_err(client, "mt9m114 platform init err\n"); - return ret; - } - } ret = power_up(sd); if (ret) { v4l2_err(client, "mt9m114 power-up err"); @@ -1844,8 +1824,6 @@ static int mt9m114_remove(struct i2c_client *client) dev = container_of(sd, struct mt9m114_device, sd); dev->platform_data->csi_cfg(sd, 0); - if (dev->platform_data->platform_deinit) - dev->platform_data->platform_deinit(); v4l2_device_unregister_subdev(sd); media_entity_cleanup(&dev->sd.entity); v4l2_ctrl_handler_free(&dev->ctrl_handler); @@ -1853,8 +1831,7 @@ static int mt9m114_remove(struct i2c_client *client) return 0; } -static int mt9m114_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static int mt9m114_probe(struct i2c_client *client) { struct mt9m114_device *dev; int ret = 0; @@ -1863,10 +1840,8 @@ static int mt9m114_probe(struct i2c_client *client, /* Setup sensor configuration structure */ dev = kzalloc(sizeof(*dev), GFP_KERNEL); - if (!dev) { - dev_err(&client->dev, "out of memory\n"); + if (!dev) return -ENOMEM; - } v4l2_i2c_subdev_init(&dev->sd, client, &mt9m114_ops); pdata = client->dev.platform_data; @@ -1926,38 +1901,22 @@ static int mt9m114_probe(struct i2c_client *client, return 0; } -MODULE_DEVICE_TABLE(i2c, mt9m114_id); - static const struct acpi_device_id mt9m114_acpi_match[] = { { "INT33F0" }, { "CRMT1040" }, {}, }; - MODULE_DEVICE_TABLE(acpi, mt9m114_acpi_match); static struct i2c_driver mt9m114_driver = { .driver = { .name = "mt9m114", - .acpi_match_table = ACPI_PTR(mt9m114_acpi_match), + .acpi_match_table = mt9m114_acpi_match, }, - .probe = mt9m114_probe, + .probe_new = mt9m114_probe, .remove = mt9m114_remove, - .id_table = mt9m114_id, }; - -static __init int init_mt9m114(void) -{ - return i2c_add_driver(&mt9m114_driver); -} - -static __exit void exit_mt9m114(void) -{ - i2c_del_driver(&mt9m114_driver); -} - -module_init(init_mt9m114); -module_exit(exit_mt9m114); +module_i2c_driver(mt9m114_driver); MODULE_AUTHOR("Shuguang Gong <Shuguang.gong@intel.com>"); MODULE_LICENSE("GPL"); diff --git a/drivers/staging/media/atomisp/i2c/ov2680.c b/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c index 51b7d61df0f5..cd67d38f183a 100644 --- a/drivers/staging/media/atomisp/i2c/ov2680.c +++ b/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c @@ -26,7 +26,6 @@ #include <linux/delay.h> #include <linux/slab.h> #include <linux/i2c.h> -#include <linux/gpio.h> #include <linux/moduleparam.h> #include <media/v4l2-device.h> #include <linux/io.h> @@ -253,8 +252,8 @@ static int ov2680_write_reg_array(struct i2c_client *client, if (!__ov2680_write_reg_is_consecutive(client, &ctrl, next)) { err = __ov2680_flush_reg_array(client, &ctrl); - if (err) - return err; + if (err) + return err; } err = __ov2680_buf_reg_array(client, &ctrl, next); if (err) { @@ -399,7 +398,9 @@ static long __ov2680_set_exposure(struct v4l2_subdev *sd, int coarse_itg, u16 vts,hts; int ret,exp_val; - dev_dbg(&client->dev, "+++++++__ov2680_set_exposure coarse_itg %d, gain %d, digitgain %d++\n",coarse_itg, gain, digitgain); + dev_dbg(&client->dev, + "+++++++__ov2680_set_exposure coarse_itg %d, gain %d, digitgain %d++\n", + coarse_itg, gain, digitgain); hts = ov2680_res[dev->fmt_idx].pixels_per_line; vts = ov2680_res[dev->fmt_idx].lines_per_frame; @@ -847,10 +848,6 @@ static int power_ctrl(struct v4l2_subdev *sd, bool flag) if (!dev || !dev->platform_data) return -ENODEV; - /* Non-gmin platforms use the legacy callback */ - if (dev->platform_data->power_ctrl) - return dev->platform_data->power_ctrl(sd, flag); - if (flag) { ret |= dev->platform_data->v1p8_ctrl(sd, 1); ret |= dev->platform_data->v2p8_ctrl(sd, 1); @@ -872,10 +869,6 @@ static int gpio_ctrl(struct v4l2_subdev *sd, bool flag) if (!dev || !dev->platform_data) return -ENODEV; - /* Non-gmin platforms use the legacy callback */ - if (dev->platform_data->gpio_ctrl) - return dev->platform_data->gpio_ctrl(sd, flag); - /* The OV2680 documents only one GPIO input (#XSHUTDN), but * existing integrations often wire two (reset/power_down) * because that is the way other sensors work. There is no @@ -1438,8 +1431,7 @@ static int ov2680_remove(struct i2c_client *client) return 0; } -static int ov2680_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static int ov2680_probe(struct i2c_client *client) { struct ov2680_device *dev; int ret; @@ -1447,10 +1439,8 @@ static int ov2680_probe(struct i2c_client *client, unsigned int i; dev = kzalloc(sizeof(*dev), GFP_KERNEL); - if (!dev) { - dev_err(&client->dev, "out of memory\n"); + if (!dev) return -ENOMEM; - } mutex_init(&dev->input_lock); @@ -1523,35 +1513,16 @@ static const struct acpi_device_id ov2680_acpi_match[] = { }; MODULE_DEVICE_TABLE(acpi, ov2680_acpi_match); - -MODULE_DEVICE_TABLE(i2c, ov2680_id); static struct i2c_driver ov2680_driver = { .driver = { - .owner = THIS_MODULE, - .name = OV2680_NAME, - .acpi_match_table = ACPI_PTR(ov2680_acpi_match), - + .name = "ov2680", + .acpi_match_table = ov2680_acpi_match, }, - .probe = ov2680_probe, + .probe_new = ov2680_probe, .remove = ov2680_remove, - .id_table = ov2680_id, }; - -static int init_ov2680(void) -{ - return i2c_add_driver(&ov2680_driver); -} - -static void exit_ov2680(void) -{ - - i2c_del_driver(&ov2680_driver); -} - -module_init(init_ov2680); -module_exit(exit_ov2680); +module_i2c_driver(ov2680_driver); MODULE_AUTHOR("Jacky Wang <Jacky_wang@ovt.com>"); MODULE_DESCRIPTION("A low-level driver for OmniVision 2680 sensors"); MODULE_LICENSE("GPL"); - diff --git a/drivers/staging/media/atomisp/i2c/ov2722.c b/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c index 10094ac56561..4df7eba8d375 100644 --- a/drivers/staging/media/atomisp/i2c/ov2722.c +++ b/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c @@ -26,7 +26,6 @@ #include <linux/delay.h> #include <linux/slab.h> #include <linux/i2c.h> -#include <linux/gpio.h> #include <linux/moduleparam.h> #include <media/v4l2-device.h> #include "../include/linux/atomisp_gmin_platform.h" @@ -651,10 +650,6 @@ static int power_ctrl(struct v4l2_subdev *sd, bool flag) if (!dev || !dev->platform_data) return -ENODEV; - /* Non-gmin platforms use the legacy callback */ - if (dev->platform_data->power_ctrl) - return dev->platform_data->power_ctrl(sd, flag); - if (flag) { ret = dev->platform_data->v1p8_ctrl(sd, 1); if (ret == 0) { @@ -678,10 +673,6 @@ static int gpio_ctrl(struct v4l2_subdev *sd, bool flag) if (!dev || !dev->platform_data) return -ENODEV; - /* Non-gmin platforms use the legacy callback */ - if (dev->platform_data->gpio_ctrl) - return dev->platform_data->gpio_ctrl(sd, flag); - /* Note: the GPIO order is asymmetric: always RESET# * before PWDN# when turning it on or off. */ @@ -1044,13 +1035,6 @@ static int ov2722_s_config(struct v4l2_subdev *sd, (struct camera_sensor_platform_data *)platform_data; mutex_lock(&dev->input_lock); - if (dev->platform_data->platform_init) { - ret = dev->platform_data->platform_init(client); - if (ret) { - dev_err(&client->dev, "platform init err\n"); - goto platform_init_failed; - } - } /* power off the module, then power on it in future * as first power on by board may not fulfill the @@ -1095,9 +1079,6 @@ fail_power_on: power_down(sd); dev_err(&client->dev, "sensor power-gating failed\n"); fail_power_off: - if (dev->platform_data->platform_deinit) - dev->platform_data->platform_deinit(); -platform_init_failed: mutex_unlock(&dev->input_lock); return ret; } @@ -1241,9 +1222,6 @@ static int ov2722_remove(struct i2c_client *client) struct ov2722_device *dev = to_ov2722_sensor(sd); dev_dbg(&client->dev, "ov2722_remove...\n"); - if (dev->platform_data->platform_deinit) - dev->platform_data->platform_deinit(); - dev->platform_data->csi_cfg(sd, 0); v4l2_ctrl_handler_free(&dev->ctrl_handler); v4l2_device_unregister_subdev(sd); @@ -1276,8 +1254,7 @@ static int __ov2722_init_ctrl_handler(struct ov2722_device *dev) return 0; } -static int ov2722_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static int ov2722_probe(struct i2c_client *client) { struct ov2722_device *dev; void *ovpdev; @@ -1285,10 +1262,8 @@ static int ov2722_probe(struct i2c_client *client, struct acpi_device *adev; dev = kzalloc(sizeof(*dev), GFP_KERNEL); - if (!dev) { - dev_err(&client->dev, "out of memory\n"); + if (!dev) return -ENOMEM; - } mutex_init(&dev->input_lock); @@ -1335,38 +1310,21 @@ out_free: return ret; } -MODULE_DEVICE_TABLE(i2c, ov2722_id); - static const struct acpi_device_id ov2722_acpi_match[] = { { "INT33FB" }, {}, }; - MODULE_DEVICE_TABLE(acpi, ov2722_acpi_match); static struct i2c_driver ov2722_driver = { .driver = { - .name = OV2722_NAME, - .acpi_match_table = ACPI_PTR(ov2722_acpi_match), + .name = "ov2722", + .acpi_match_table = ov2722_acpi_match, }, - .probe = ov2722_probe, + .probe_new = ov2722_probe, .remove = ov2722_remove, - .id_table = ov2722_id, }; - -static int init_ov2722(void) -{ - return i2c_add_driver(&ov2722_driver); -} - -static void exit_ov2722(void) -{ - - i2c_del_driver(&ov2722_driver); -} - -module_init(init_ov2722); -module_exit(exit_ov2722); +module_i2c_driver(ov2722_driver); MODULE_AUTHOR("Wei Liu <wei.liu@intel.com>"); MODULE_DESCRIPTION("A low-level driver for OmniVision 2722 sensors"); diff --git a/drivers/staging/media/atomisp/i2c/gc0310.h b/drivers/staging/media/atomisp/i2c/gc0310.h index 7d8a0aeecb6c..c422d0398fc7 100644 --- a/drivers/staging/media/atomisp/i2c/gc0310.h +++ b/drivers/staging/media/atomisp/i2c/gc0310.h @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ @@ -36,8 +32,6 @@ #include "../include/linux/atomisp_platform.h" -#define GC0310_NAME "gc0310" - /* Defines for register writes and register array processing */ #define I2C_MSG_LENGTH 1 #define I2C_RETRY_COUNT 5 @@ -196,11 +190,6 @@ struct gc0310_write_ctrl { struct gc0310_write_buffer buffer; }; -static const struct i2c_device_id gc0310_id[] = { - {GC0310_NAME, 0}, - {} -}; - /* * Register settings for various resolution */ diff --git a/drivers/staging/media/atomisp/i2c/gc2235.h b/drivers/staging/media/atomisp/i2c/gc2235.h index a8d6aa9c9a5d..3c30a05c3991 100644 --- a/drivers/staging/media/atomisp/i2c/gc2235.h +++ b/drivers/staging/media/atomisp/i2c/gc2235.h @@ -33,8 +33,6 @@ #include "../include/linux/atomisp_platform.h" -#define GC2235_NAME "gc2235" - /* Defines for register writes and register array processing */ #define I2C_MSG_LENGTH 0x2 #define I2C_RETRY_COUNT 5 @@ -200,11 +198,6 @@ struct gc2235_write_ctrl { struct gc2235_write_buffer buffer; }; -static const struct i2c_device_id gc2235_id[] = { - {GC2235_NAME, 0}, - {} -}; - static struct gc2235_reg const gc2235_stream_on[] = { { GC2235_8BIT, 0xfe, 0x03}, /* switch to P3 */ { GC2235_8BIT, 0x10, 0x91}, /* start mipi */ diff --git a/drivers/staging/media/atomisp/i2c/imx/Kconfig b/drivers/staging/media/atomisp/i2c/imx/Kconfig deleted file mode 100644 index a39eeb3b6ad4..000000000000 --- a/drivers/staging/media/atomisp/i2c/imx/Kconfig +++ /dev/null @@ -1,9 +0,0 @@ -config VIDEO_IMX - tristate "sony imx sensor support" - depends on I2C && VIDEO_V4L2 && VIDEO_MSRLIST_HELPER && m - ---help--- - This is a Video4Linux2 sensor-level driver for the Sony - IMX RAW sensor. - - It currently depends on internal V4L2 extensions defined in - atomisp driver. diff --git a/drivers/staging/media/atomisp/i2c/imx/Makefile b/drivers/staging/media/atomisp/i2c/imx/Makefile deleted file mode 100644 index c1a85e6e27a9..000000000000 --- a/drivers/staging/media/atomisp/i2c/imx/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -obj-$(CONFIG_VIDEO_IMX) += imx1x5.o - -imx1x5-objs := imx.o drv201.o ad5816g.o dw9714.o dw9719.o dw9718.o vcm.o otp.o otp_imx.o otp_brcc064_e2prom.o otp_e2prom.o - -ov8858_driver-objs := ../ov8858.o dw9718.o vcm.o -obj-$(CONFIG_VIDEO_OV8858) += ov8858_driver.o - -# HACK! While this driver is in bad shape, don't enable several warnings -# that would be otherwise enabled with W=1 -ccflags-y += $(call cc-disable-warning, unused-but-set-variable) -ccflags-y += $(call cc-disable-warning, unused-const-variable) -ccflags-y += $(call cc-disable-warning, missing-prototypes) -ccflags-y += $(call cc-disable-warning, missing-declarations) diff --git a/drivers/staging/media/atomisp/i2c/imx/ad5816g.c b/drivers/staging/media/atomisp/i2c/imx/ad5816g.c deleted file mode 100644 index fb74f14cbe5a..000000000000 --- a/drivers/staging/media/atomisp/i2c/imx/ad5816g.c +++ /dev/null @@ -1,217 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include <linux/bitops.h> -#include <linux/device.h> -#include <linux/delay.h> -#include <linux/errno.h> -#include <linux/fs.h> -#include <linux/gpio.h> -#include <linux/init.h> -#include <linux/i2c.h> -#include <linux/io.h> -#include <linux/kernel.h> -#include <linux/mm.h> -#include <linux/kmod.h> -#include <linux/module.h> -#include <linux/moduleparam.h> -#include <linux/string.h> -#include <linux/slab.h> -#include <linux/types.h> -#include <media/v4l2-device.h> - -#include "ad5816g.h" - -struct ad5816g_device ad5816g_dev; - -static int ad5816g_i2c_rd8(struct i2c_client *client, u8 reg, u8 *val) -{ - struct i2c_msg msg[2]; - u8 buf[2]; - buf[0] = reg; - buf[1] = 0; - - msg[0].addr = AD5816G_VCM_ADDR; - msg[0].flags = 0; - msg[0].len = 1; - msg[0].buf = &buf[0]; - - msg[1].addr = AD5816G_VCM_ADDR; - msg[1].flags = I2C_M_RD; - msg[1].len = 1; - msg[1].buf = &buf[1]; - *val = 0; - if (i2c_transfer(client->adapter, msg, 2) != 2) - return -EIO; - *val = buf[1]; - return 0; -} - -static int ad5816g_i2c_wr8(struct i2c_client *client, u8 reg, u8 val) -{ - struct i2c_msg msg; - u8 buf[2]; - buf[0] = reg; - buf[1] = val; - msg.addr = AD5816G_VCM_ADDR; - msg.flags = 0; - msg.len = 2; - msg.buf = &buf[0]; - if (i2c_transfer(client->adapter, &msg, 1) != 1) - return -EIO; - return 0; -} - -static int ad5816g_i2c_wr16(struct i2c_client *client, u8 reg, u16 val) -{ - struct i2c_msg msg; - u8 buf[3]; - buf[0] = reg; - buf[1] = (u8)(val >> 8); - buf[2] = (u8)(val & 0xff); - msg.addr = AD5816G_VCM_ADDR; - msg.flags = 0; - msg.len = 3; - msg.buf = &buf[0]; - if (i2c_transfer(client->adapter, &msg, 1) != 1) - return -EIO; - return 0; -} - -static int ad5816g_set_arc_mode(struct i2c_client *client) -{ - int ret; - - ret = ad5816g_i2c_wr8(client, AD5816G_CONTROL, AD5816G_ARC_EN); - if (ret) - return ret; - - ret = ad5816g_i2c_wr8(client, AD5816G_MODE, - AD5816G_MODE_2_5M_SWITCH_CLOCK); - if (ret) - return ret; - - ret = ad5816g_i2c_wr8(client, AD5816G_VCM_FREQ, AD5816G_DEF_FREQ); - return ret; -} - -int ad5816g_vcm_power_up(struct v4l2_subdev *sd) -{ - struct i2c_client *client = v4l2_get_subdevdata(sd); - int ret; - u8 ad5816g_id; - - /* Enable power */ - ret = ad5816g_dev.platform_data->power_ctrl(sd, 1); - if (ret) - return ret; - /* waiting time AD5816G(vcm) - t1 + t2 - * t1(1ms) -Time from VDD high to first i2c cmd - * t2(100us) - exit power-down mode time - */ - usleep_range(1100, 2200); - /* Detect device */ - ret = ad5816g_i2c_rd8(client, AD5816G_IC_INFO, &ad5816g_id); - if (ret < 0) - goto fail_powerdown; - if (ad5816g_id != AD5816G_ID) { - ret = -ENXIO; - goto fail_powerdown; - } - ret = ad5816g_set_arc_mode(client); - if (ret) - return ret; - - /* set the VCM_THRESHOLD */ - ret = ad5816g_i2c_wr8(client, AD5816G_VCM_THRESHOLD, - AD5816G_DEF_THRESHOLD); - - return ret; - -fail_powerdown: - ad5816g_dev.platform_data->power_ctrl(sd, 0); - return ret; -} - -int ad5816g_vcm_power_down(struct v4l2_subdev *sd) -{ - return ad5816g_dev.platform_data->power_ctrl(sd, 0); -} - - -static int ad5816g_t_focus_vcm(struct v4l2_subdev *sd, u16 val) -{ - struct i2c_client *client = v4l2_get_subdevdata(sd); - u16 data = val & VCM_CODE_MASK; - - return ad5816g_i2c_wr16(client, AD5816G_VCM_CODE_MSB, data); -} - -int ad5816g_t_focus_abs(struct v4l2_subdev *sd, s32 value) -{ - int ret; - - value = clamp(value, 0, AD5816G_MAX_FOCUS_POS); - ret = ad5816g_t_focus_vcm(sd, value); - if (ret == 0) { - ad5816g_dev.number_of_steps = value - ad5816g_dev.focus; - ad5816g_dev.focus = value; - getnstimeofday(&(ad5816g_dev.timestamp_t_focus_abs)); - } - - return ret; -} - -int ad5816g_t_focus_rel(struct v4l2_subdev *sd, s32 value) -{ - - return ad5816g_t_focus_abs(sd, ad5816g_dev.focus + value); -} - -int ad5816g_q_focus_status(struct v4l2_subdev *sd, s32 *value) -{ - u32 status = 0; - struct timespec temptime; - const struct timespec timedelay = { - 0, - min_t(u32, abs(ad5816g_dev.number_of_steps) * DELAY_PER_STEP_NS, - DELAY_MAX_PER_STEP_NS), - }; - - ktime_get_ts(&temptime); - - temptime = timespec_sub(temptime, (ad5816g_dev.timestamp_t_focus_abs)); - - if (timespec_compare(&temptime, &timedelay) <= 0) { - status |= ATOMISP_FOCUS_STATUS_MOVING; - status |= ATOMISP_FOCUS_HP_IN_PROGRESS; - } else { - status |= ATOMISP_FOCUS_STATUS_ACCEPTS_NEW_MOVE; - status |= ATOMISP_FOCUS_HP_COMPLETE; - } - *value = status; - - return 0; -} - -int ad5816g_q_focus_abs(struct v4l2_subdev *sd, s32 *value) -{ - s32 val; - - ad5816g_q_focus_status(sd, &val); - - if (val & ATOMISP_FOCUS_STATUS_MOVING) - *value = ad5816g_dev.focus - ad5816g_dev.number_of_steps; - else - *value = ad5816g_dev.focus; - - return 0; -} - -int ad5816g_t_vcm_slew(struct v4l2_subdev *sd, s32 value) -{ - return 0; -} - -int ad5816g_t_vcm_timing(struct v4l2_subdev *sd, s32 value) -{ - return 0; -} diff --git a/drivers/staging/media/atomisp/i2c/imx/ad5816g.h b/drivers/staging/media/atomisp/i2c/imx/ad5816g.h deleted file mode 100644 index e1396b00a0e1..000000000000 --- a/drivers/staging/media/atomisp/i2c/imx/ad5816g.h +++ /dev/null @@ -1,50 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __AD5816G_H__ -#define __AD5816G_H__ - -#include "../../include/linux/atomisp_platform.h" -#include <linux/types.h> -#include <linux/time.h> - -#define AD5816G_VCM_ADDR 0x0e - -/* ad5816g device structure */ -struct ad5816g_device { - const struct camera_af_platform_data *platform_data; - struct timespec timestamp_t_focus_abs; - struct timespec focus_time; /* Time when focus was last time set */ - s32 focus; /* Current focus value */ - s16 number_of_steps; -}; - -#define AD5816G_INVALID_CONFIG 0xffffffff -#define AD5816G_MAX_FOCUS_POS 1023 -#define DELAY_PER_STEP_NS 1000000 -#define DELAY_MAX_PER_STEP_NS (1000000 * 1023) - -/* Register Definitions */ -#define AD5816G_IC_INFO 0x00 -#define AD5816G_IC_VERSION 0x01 -#define AD5816G_CONTROL 0x02 -#define AD5816G_VCM_CODE_MSB 0x03 -#define AD5816G_VCM_CODE_LSB 0x04 -#define AD5816G_STATUS 0x05 -#define AD5816G_MODE 0x06 -#define AD5816G_VCM_FREQ 0x07 -#define AD5816G_VCM_THRESHOLD 0x08 - -/* ARC MODE ENABLE */ -#define AD5816G_ARC_EN 0x02 -/* ARC RES2 MODE */ -#define AD5816G_ARC_RES2 0x01 -/* ARC VCM FREQ - 78.1Hz */ -#define AD5816G_DEF_FREQ 0x7a -/* ARC VCM THRESHOLD - 0x08 << 1 */ -#define AD5816G_DEF_THRESHOLD 0x64 -#define AD5816G_ID 0x24 -#define VCM_CODE_MASK 0x03ff - -#define AD5816G_MODE_2_5M_SWITCH_CLOCK 0x14 - -#endif - diff --git a/drivers/staging/media/atomisp/i2c/imx/common.h b/drivers/staging/media/atomisp/i2c/imx/common.h deleted file mode 100644 index af2e3160df95..000000000000 --- a/drivers/staging/media/atomisp/i2c/imx/common.h +++ /dev/null @@ -1,66 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __COMMON_H__ -#define __COMMON_H__ - -#define MAX_FPS_OPTIONS_SUPPORTED 3 -#define I2C_MSG_LENGTH 0x2 -#define E2PROM_2ADDR 0x80000000 -#define E2PROM_ADDR_MASK 0x7fffffff - -/* Defines for register writes and register array processing */ -#define IMX_BYTE_MAX 32 -#define IMX_SHORT_MAX 16 -#define I2C_RETRY_COUNT 5 -#define IMX_TOK_MASK 0xfff0 - -enum imx_tok_type { - IMX_8BIT = 0x0001, - IMX_16BIT = 0x0002, - IMX_TOK_TERM = 0xf000, /* terminating token for reg list */ - IMX_TOK_DELAY = 0xfe00 /* delay token for reg list */ -}; - -/** - * struct imx_reg - MI sensor register format - * @type: type of the register - * @reg: 16-bit offset to register - * @val: 8/16/32-bit register value - * - * Define a structure for sensor register initialization values - */ -struct imx_reg { - enum imx_tok_type type; - u16 sreg; - u32 val; /* @set value for read/mod/write, @mask */ -}; - -struct imx_fps_setting { - int fps; - unsigned short pixels_per_line; - unsigned short lines_per_frame; - int mipi_freq; /* MIPI lane frequency in kHz */ - const struct imx_reg *regs; /* regs that the fps setting needs */ -}; - -struct imx_resolution { - const struct imx_fps_setting fps_options[MAX_FPS_OPTIONS_SUPPORTED]; - u8 *desc; - const struct imx_reg *regs; - int res; - int width; - int height; - int fps; - unsigned short pixels_per_line; - unsigned short lines_per_frame; - int mipi_freq; /* MIPI lane frequency in kHz */ - unsigned short skip_frames; - u8 bin_factor_x; - u8 bin_factor_y; - bool used; -}; - -#define GROUPED_PARAMETER_HOLD_ENABLE {IMX_8BIT, 0x0104, 0x1} -#define GROUPED_PARAMETER_HOLD_DISABLE {IMX_8BIT, 0x0104, 0x0} - -int imx_write_reg(struct i2c_client *client, u16 data_length, u16 reg, u16 val); -#endif diff --git a/drivers/staging/media/atomisp/i2c/imx/drv201.c b/drivers/staging/media/atomisp/i2c/imx/drv201.c deleted file mode 100644 index 221e4875ac49..000000000000 --- a/drivers/staging/media/atomisp/i2c/imx/drv201.c +++ /dev/null @@ -1,210 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include <linux/bitops.h> -#include <linux/device.h> -#include <linux/delay.h> -#include <linux/errno.h> -#include <linux/fs.h> -#include <linux/gpio.h> -#include <linux/init.h> -#include <linux/i2c.h> -#include <linux/io.h> -#include <linux/kernel.h> -#include <linux/mm.h> -#include <linux/kmod.h> -#include <linux/module.h> -#include <linux/moduleparam.h> -#include <linux/string.h> -#include <linux/slab.h> -#include <linux/types.h> -#include <media/v4l2-device.h> -#include <asm/intel-mid.h> - -#include "drv201.h" - -static struct drv201_device drv201_dev; - -static int drv201_i2c_rd8(struct i2c_client *client, u8 reg, u8 *val) -{ - struct i2c_msg msg[2]; - u8 buf[2]; - buf[0] = reg; - buf[1] = 0; - - msg[0].addr = DRV201_VCM_ADDR; - msg[0].flags = 0; - msg[0].len = 1; - msg[0].buf = &buf[0]; - - msg[1].addr = DRV201_VCM_ADDR; - msg[1].flags = I2C_M_RD; - msg[1].len = 1; - msg[1].buf = &buf[1]; - *val = 0; - if (i2c_transfer(client->adapter, msg, 2) != 2) - return -EIO; - *val = buf[1]; - return 0; -} - -static int drv201_i2c_wr8(struct i2c_client *client, u8 reg, u8 val) -{ - struct i2c_msg msg; - u8 buf[2]; - buf[0] = reg; - buf[1] = val; - msg.addr = DRV201_VCM_ADDR; - msg.flags = 0; - msg.len = 2; - msg.buf = &buf[0]; - if (i2c_transfer(client->adapter, &msg, 1) != 1) - return -EIO; - return 0; -} - -static int drv201_i2c_wr16(struct i2c_client *client, u8 reg, u16 val) -{ - struct i2c_msg msg; - u8 buf[3]; - buf[0] = reg; - buf[1] = (u8)(val >> 8); - buf[2] = (u8)(val & 0xff); - msg.addr = DRV201_VCM_ADDR; - msg.flags = 0; - msg.len = 3; - msg.buf = &buf[0]; - if (i2c_transfer(client->adapter, &msg, 1) != 1) - return -EIO; - return 0; -} - -int drv201_vcm_power_up(struct v4l2_subdev *sd) -{ - struct i2c_client *client = v4l2_get_subdevdata(sd); - int ret; - u8 value; - - /* Enable power */ - ret = drv201_dev.platform_data->power_ctrl(sd, 1); - if (ret) - return ret; - /* Wait for VBAT to stabilize */ - udelay(1); - /* - * Jiggle SCL pin to wake up device. - * Drv201 expect SCL from low to high to wake device up. - * So the 1st access to i2c would fail. - * Using following function to wake device up. - */ - drv201_i2c_wr8(client, DRV201_CONTROL, DRV201_RESET); - - /* Need 100us to transit from SHUTDOWN to STANDBY*/ - usleep_range(WAKEUP_DELAY_US, WAKEUP_DELAY_US * 10); - - /* Reset device */ - ret = drv201_i2c_wr8(client, DRV201_CONTROL, DRV201_RESET); - if (ret < 0) - goto fail_powerdown; - - /* Detect device */ - ret = drv201_i2c_rd8(client, DRV201_CONTROL, &value); - if (ret < 0) - goto fail_powerdown; - if (value != DEFAULT_CONTROL_VAL) { - ret = -ENXIO; - goto fail_powerdown; - } - - drv201_dev.focus = DRV201_MAX_FOCUS_POS; - drv201_dev.initialized = true; - - return 0; -fail_powerdown: - drv201_dev.platform_data->power_ctrl(sd, 0); - return ret; -} - -int drv201_vcm_power_down(struct v4l2_subdev *sd) -{ - return drv201_dev.platform_data->power_ctrl(sd, 0); -} - - -static int drv201_t_focus_vcm(struct v4l2_subdev *sd, u16 val) -{ - struct i2c_client *client = v4l2_get_subdevdata(sd); - u16 data = val & VCM_CODE_MASK; - - if (!drv201_dev.initialized) - return -ENODEV; - return drv201_i2c_wr16(client, DRV201_VCM_CURRENT, data); -} - -int drv201_t_focus_abs(struct v4l2_subdev *sd, s32 value) -{ - int ret; - - value = clamp(value, 0, DRV201_MAX_FOCUS_POS); - ret = drv201_t_focus_vcm(sd, value); - if (ret == 0) { - drv201_dev.number_of_steps = value - drv201_dev.focus; - drv201_dev.focus = value; - getnstimeofday(&(drv201_dev.timestamp_t_focus_abs)); - } - - return ret; -} - -int drv201_t_focus_rel(struct v4l2_subdev *sd, s32 value) -{ - return drv201_t_focus_abs(sd, drv201_dev.focus + value); -} - -int drv201_q_focus_status(struct v4l2_subdev *sd, s32 *value) -{ - u32 status = 0; - struct timespec temptime; - const struct timespec timedelay = { - 0, - min_t(u32, abs(drv201_dev.number_of_steps)*DELAY_PER_STEP_NS, - DELAY_MAX_PER_STEP_NS), - }; - - ktime_get_ts(&temptime); - - temptime = timespec_sub(temptime, (drv201_dev.timestamp_t_focus_abs)); - - if (timespec_compare(&temptime, &timedelay) <= 0) { - status |= ATOMISP_FOCUS_STATUS_MOVING; - status |= ATOMISP_FOCUS_HP_IN_PROGRESS; - } else { - status |= ATOMISP_FOCUS_STATUS_ACCEPTS_NEW_MOVE; - status |= ATOMISP_FOCUS_HP_COMPLETE; - } - *value = status; - - return 0; -} - -int drv201_q_focus_abs(struct v4l2_subdev *sd, s32 *value) -{ - s32 val; - - drv201_q_focus_status(sd, &val); - - if (val & ATOMISP_FOCUS_STATUS_MOVING) - *value = drv201_dev.focus - drv201_dev.number_of_steps; - else - *value = drv201_dev.focus; - - return 0; -} - -int drv201_t_vcm_slew(struct v4l2_subdev *sd, s32 value) -{ - return 0; -} - -int drv201_t_vcm_timing(struct v4l2_subdev *sd, s32 value) -{ - return 0; -} diff --git a/drivers/staging/media/atomisp/i2c/imx/drv201.h b/drivers/staging/media/atomisp/i2c/imx/drv201.h deleted file mode 100644 index 2ef8aafdf675..000000000000 --- a/drivers/staging/media/atomisp/i2c/imx/drv201.h +++ /dev/null @@ -1,39 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __DRV201_H__ -#define __DRV201_H__ - -#include "../../include/linux/atomisp_platform.h" -#include <linux/types.h> -#include <linux/time.h> - -#define DRV201_VCM_ADDR 0x0e - -/* drv201 device structure */ -struct drv201_device { - const struct camera_af_platform_data *platform_data; - struct timespec timestamp_t_focus_abs; - struct timespec focus_time; /* Time when focus was last time set */ - s32 focus; /* Current focus value */ - s16 number_of_steps; - bool initialized; /* true if drv201 is detected */ -}; - -#define DRV201_INVALID_CONFIG 0xffffffff -#define DRV201_MAX_FOCUS_POS 1023 -#define DELAY_PER_STEP_NS 1000000 -#define DELAY_MAX_PER_STEP_NS (1000000 * 1023) - -#define DRV201_CONTROL 2 -#define DRV201_VCM_CURRENT 3 -#define DRV201_STATUS 5 -#define DRV201_MODE 6 -#define DRV201_VCM_FREQ 7 - -#define DEFAULT_CONTROL_VAL 2 -#define DRV201_RESET 1 -#define WAKEUP_DELAY_US 100 -#define VCM_CODE_MASK 0x03ff - -#endif - - diff --git a/drivers/staging/media/atomisp/i2c/imx/dw9714.c b/drivers/staging/media/atomisp/i2c/imx/dw9714.c deleted file mode 100644 index f96855454313..000000000000 --- a/drivers/staging/media/atomisp/i2c/imx/dw9714.c +++ /dev/null @@ -1,224 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include <linux/bitops.h> -#include <linux/device.h> -#include <linux/delay.h> -#include <linux/errno.h> -#include <linux/fs.h> -#include <linux/gpio.h> -#include <linux/init.h> -#include <linux/i2c.h> -#include <linux/io.h> -#include <linux/kernel.h> -#include <linux/mm.h> -#include <linux/kmod.h> -#include <linux/module.h> -#include <linux/moduleparam.h> -#include <linux/string.h> -#include <linux/slab.h> -#include <linux/types.h> -#include <media/v4l2-device.h> -#include <asm/intel-mid.h> - -#include "dw9714.h" - -static struct dw9714_device dw9714_dev; -static int dw9714_i2c_write(struct i2c_client *client, u16 data) -{ - struct i2c_msg msg; - const int num_msg = 1; - int ret; - u16 val; - - val = cpu_to_be16(data); - msg.addr = DW9714_VCM_ADDR; - msg.flags = 0; - msg.len = DW9714_16BIT; - msg.buf = (u8 *)&val; - - ret = i2c_transfer(client->adapter, &msg, 1); - - return ret == num_msg ? 0 : -EIO; -} - -int dw9714_vcm_power_up(struct v4l2_subdev *sd) -{ - int ret; - - /* Enable power */ - ret = dw9714_dev.platform_data->power_ctrl(sd, 1); - /* waiting time requested by DW9714A(vcm) */ - usleep_range(12000, 12500); - return ret; -} - -int dw9714_vcm_power_down(struct v4l2_subdev *sd) -{ - return dw9714_dev.platform_data->power_ctrl(sd, 0); -} - - -static int dw9714_t_focus_vcm(struct v4l2_subdev *sd, u16 val) -{ - struct i2c_client *client = v4l2_get_subdevdata(sd); - int ret = -EINVAL; - u8 mclk = vcm_step_mclk(dw9714_dev.vcm_settings.step_setting); - u8 s = vcm_step_s(dw9714_dev.vcm_settings.step_setting); - - /* - * For different mode, VCM_PROTECTION_OFF/ON required by the - * control procedure. For DW9714_DIRECT/DLC mode, slew value is - * VCM_DEFAULT_S(0). - */ - switch (dw9714_dev.vcm_mode) { - case DW9714_DIRECT: - if (dw9714_dev.vcm_settings.update) { - ret = dw9714_i2c_write(client, VCM_PROTECTION_OFF); - if (ret) - return ret; - ret = dw9714_i2c_write(client, DIRECT_VCM); - if (ret) - return ret; - ret = dw9714_i2c_write(client, VCM_PROTECTION_ON); - if (ret) - return ret; - dw9714_dev.vcm_settings.update = false; - } - ret = dw9714_i2c_write(client, - vcm_val(val, VCM_DEFAULT_S)); - break; - case DW9714_LSC: - if (dw9714_dev.vcm_settings.update) { - ret = dw9714_i2c_write(client, VCM_PROTECTION_OFF); - if (ret) - return ret; - ret = dw9714_i2c_write(client, - vcm_dlc_mclk(DLC_DISABLE, mclk)); - if (ret) - return ret; - ret = dw9714_i2c_write(client, - vcm_tsrc(dw9714_dev.vcm_settings.t_src)); - if (ret) - return ret; - ret = dw9714_i2c_write(client, VCM_PROTECTION_ON); - if (ret) - return ret; - dw9714_dev.vcm_settings.update = false; - } - ret = dw9714_i2c_write(client, vcm_val(val, s)); - break; - case DW9714_DLC: - if (dw9714_dev.vcm_settings.update) { - ret = dw9714_i2c_write(client, VCM_PROTECTION_OFF); - if (ret) - return ret; - ret = dw9714_i2c_write(client, - vcm_dlc_mclk(DLC_ENABLE, mclk)); - if (ret) - return ret; - ret = dw9714_i2c_write(client, - vcm_tsrc(dw9714_dev.vcm_settings.t_src)); - if (ret) - return ret; - ret = dw9714_i2c_write(client, VCM_PROTECTION_ON); - if (ret) - return ret; - dw9714_dev.vcm_settings.update = false; - } - ret = dw9714_i2c_write(client, - vcm_val(val, VCM_DEFAULT_S)); - break; - } - return ret; -} - -int dw9714_t_focus_abs(struct v4l2_subdev *sd, s32 value) -{ - int ret; - - value = clamp(value, 0, DW9714_MAX_FOCUS_POS); - ret = dw9714_t_focus_vcm(sd, value); - if (ret == 0) { - dw9714_dev.number_of_steps = value - dw9714_dev.focus; - dw9714_dev.focus = value; - getnstimeofday(&(dw9714_dev.timestamp_t_focus_abs)); - } - - return ret; -} - -int dw9714_t_focus_abs_init(struct v4l2_subdev *sd) -{ - int ret; - - ret = dw9714_t_focus_vcm(sd, DW9714_DEFAULT_FOCUS_POS); - if (ret == 0) { - dw9714_dev.number_of_steps = - DW9714_DEFAULT_FOCUS_POS - dw9714_dev.focus; - dw9714_dev.focus = DW9714_DEFAULT_FOCUS_POS; - getnstimeofday(&(dw9714_dev.timestamp_t_focus_abs)); - } - - return ret; -} - -int dw9714_t_focus_rel(struct v4l2_subdev *sd, s32 value) -{ - - return dw9714_t_focus_abs(sd, dw9714_dev.focus + value); -} - -int dw9714_q_focus_status(struct v4l2_subdev *sd, s32 *value) -{ - u32 status = 0; - struct timespec temptime; - const struct timespec timedelay = { - 0, - min_t(u32, abs(dw9714_dev.number_of_steps)*DELAY_PER_STEP_NS, - DELAY_MAX_PER_STEP_NS), - }; - - ktime_get_ts(&temptime); - - temptime = timespec_sub(temptime, (dw9714_dev.timestamp_t_focus_abs)); - - if (timespec_compare(&temptime, &timedelay) <= 0) { - status |= ATOMISP_FOCUS_STATUS_MOVING; - status |= ATOMISP_FOCUS_HP_IN_PROGRESS; - } else { - status |= ATOMISP_FOCUS_STATUS_ACCEPTS_NEW_MOVE; - status |= ATOMISP_FOCUS_HP_COMPLETE; - } - *value = status; - - return 0; -} - -int dw9714_q_focus_abs(struct v4l2_subdev *sd, s32 *value) -{ - s32 val; - - dw9714_q_focus_status(sd, &val); - - if (val & ATOMISP_FOCUS_STATUS_MOVING) - *value = dw9714_dev.focus - dw9714_dev.number_of_steps; - else - *value = dw9714_dev.focus; - - return 0; -} - -int dw9714_t_vcm_slew(struct v4l2_subdev *sd, s32 value) -{ - dw9714_dev.vcm_settings.step_setting = value; - dw9714_dev.vcm_settings.update = true; - - return 0; -} - -int dw9714_t_vcm_timing(struct v4l2_subdev *sd, s32 value) -{ - dw9714_dev.vcm_settings.t_src = value; - dw9714_dev.vcm_settings.update = true; - - return 0; -} diff --git a/drivers/staging/media/atomisp/i2c/imx/dw9714.h b/drivers/staging/media/atomisp/i2c/imx/dw9714.h deleted file mode 100644 index aee560026b56..000000000000 --- a/drivers/staging/media/atomisp/i2c/imx/dw9714.h +++ /dev/null @@ -1,64 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __DW9714_H__ -#define __DW9714_H__ - -#include "../../include/linux/atomisp_platform.h" -#include <linux/types.h> - - -#define DW9714_VCM_ADDR 0x0c - -enum dw9714_tok_type { - DW9714_8BIT = 0x0001, - DW9714_16BIT = 0x0002, -}; - -struct dw9714_vcm_settings { - u16 code; /* bit[9:0]: Data[9:0] */ - u8 t_src; /* bit[4:0]: T_SRC[4:0] */ - u8 step_setting; /* bit[3:0]: S[3:0]/bit[5:4]: MCLK[1:0] */ - bool update; -}; - -enum dw9714_vcm_mode { - DW9714_DIRECT = 0x1, /* direct control */ - DW9714_LSC = 0x2, /* linear slope control */ - DW9714_DLC = 0x3, /* dual level control */ -}; - -/* dw9714 device structure */ -struct dw9714_device { - struct dw9714_vcm_settings vcm_settings; - struct timespec timestamp_t_focus_abs; - enum dw9714_vcm_mode vcm_mode; - s16 number_of_steps; - bool initialized; /* true if dw9714 is detected */ - s32 focus; /* Current focus value */ - struct timespec focus_time; /* Time when focus was last time set */ - __u8 buffer[4]; /* Used for i2c transactions */ - const struct camera_af_platform_data *platform_data; -}; - -#define DW9714_INVALID_CONFIG 0xffffffff -#define DW9714_MAX_FOCUS_POS 1023 -#define DW9714_DEFAULT_FOCUS_POS 290 - - -/* MCLK[1:0] = 01 T_SRC[4:0] = 00001 S[3:0] = 0111 */ -#define DELAY_PER_STEP_NS 1000000 -#define DELAY_MAX_PER_STEP_NS (1000000 * 1023) - -#define DLC_ENABLE 1 -#define DLC_DISABLE 0 -#define VCM_PROTECTION_OFF 0xeca3 -#define VCM_PROTECTION_ON 0xdc51 -#define VCM_DEFAULT_S 0x0 - -#define vcm_step_s(a) (u8)(a & 0xf) -#define vcm_step_mclk(a) (u8)((a >> 4) & 0x3) -#define vcm_dlc_mclk(dlc, mclk) (u16)((dlc << 3) | mclk | 0xa104) -#define vcm_tsrc(tsrc) (u16)(tsrc << 3 | 0xf200) -#define vcm_val(data, s) (u16)(data << 4 | s) -#define DIRECT_VCM vcm_dlc_mclk(0, 0) - -#endif diff --git a/drivers/staging/media/atomisp/i2c/imx/dw9718.c b/drivers/staging/media/atomisp/i2c/imx/dw9718.c deleted file mode 100644 index c02b9f0a2440..000000000000 --- a/drivers/staging/media/atomisp/i2c/imx/dw9718.c +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Support for dw9718 vcm driver. - * - * Copyright (c) 2014 Intel Corporation. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. - * - */ - -#include <linux/delay.h> -#include "dw9718.h" - -static struct dw9718_device dw9718_dev; - -static int dw9718_i2c_rd8(struct i2c_client *client, u8 reg, u8 *val) -{ - struct i2c_msg msg[2]; - u8 buf[2] = { reg }; - - msg[0].addr = DW9718_VCM_ADDR; - msg[0].flags = 0; - msg[0].len = 1; - msg[0].buf = buf; - - msg[1].addr = DW9718_VCM_ADDR; - msg[1].flags = I2C_M_RD; - msg[1].len = 1; - msg[1].buf = &buf[1]; - *val = 0; - - if (i2c_transfer(client->adapter, msg, 2) != 2) - return -EIO; - *val = buf[1]; - - return 0; -} - -static int dw9718_i2c_wr8(struct i2c_client *client, u8 reg, u8 val) -{ - struct i2c_msg msg; - u8 buf[2] = { reg, val}; - - msg.addr = DW9718_VCM_ADDR; - msg.flags = 0; - msg.len = sizeof(buf); - msg.buf = buf; - - if (i2c_transfer(client->adapter, &msg, 1) != 1) - return -EIO; - - return 0; -} - -static int dw9718_i2c_wr16(struct i2c_client *client, u8 reg, u16 val) -{ - struct i2c_msg msg; - u8 buf[3] = { reg, (u8)(val >> 8), (u8)(val & 0xff)}; - - msg.addr = DW9718_VCM_ADDR; - msg.flags = 0; - msg.len = sizeof(buf); - msg.buf = buf; - - if (i2c_transfer(client->adapter, &msg, 1) != 1) - return -EIO; - - return 0; -} - -int dw9718_t_focus_abs(struct v4l2_subdev *sd, s32 value) -{ - struct i2c_client *client = v4l2_get_subdevdata(sd); - int ret; - - value = clamp(value, 0, DW9718_MAX_FOCUS_POS); - ret = dw9718_i2c_wr16(client, DW9718_DATA_M, value); - /*pr_info("%s: value = %d\n", __func__, value);*/ - if (ret < 0) - return ret; - - getnstimeofday(&dw9718_dev.focus_time); - dw9718_dev.focus = value; - - return 0; -} - -int dw9718_vcm_power_up(struct v4l2_subdev *sd) -{ - struct i2c_client *client = v4l2_get_subdevdata(sd); - int ret; - u8 value; - - if (dw9718_dev.power_on) - return 0; - - /* Enable power */ - ret = dw9718_dev.platform_data->power_ctrl(sd, 1); - if (ret) { - dev_err(&client->dev, "DW9718_PD power_ctrl failed %d\n", ret); - return ret; - } - /* Wait for VBAT to stabilize */ - udelay(100); - - /* Detect device */ - ret = dw9718_i2c_rd8(client, DW9718_SACT, &value); - if (ret < 0) { - dev_err(&client->dev, "read DW9718_SACT failed %d\n", ret); - goto fail_powerdown; - } - /* - * WORKAROUND: for module P8V12F-203 which are used on - * Cherrytrail Refresh Davis Reef AoB, register SACT is not - * returning default value as spec. But VCM works as expected and - * root cause is still under discussion with vendor. - * workaround here to avoid aborting the power up sequence and just - * give a warning about this error. - */ - if (value != DW9718_SACT_DEFAULT_VAL) - dev_warn(&client->dev, "%s error, incorrect ID\n", __func__); - - /* Initialize according to recommended settings */ - ret = dw9718_i2c_wr8(client, DW9718_CONTROL, - DW9718_CONTROL_SW_LINEAR | - DW9718_CONTROL_S_SAC4 | - DW9718_CONTROL_OCP_DISABLE | - DW9718_CONTROL_UVLO_DISABLE); - if (ret < 0) { - dev_err(&client->dev, "write DW9718_CONTROL failed %d\n", ret); - goto fail_powerdown; - } - ret = dw9718_i2c_wr8(client, DW9718_SACT, - DW9718_SACT_MULT_TWO | - DW9718_SACT_PERIOD_8_8MS); - if (ret < 0) { - dev_err(&client->dev, "write DW9718_SACT failed %d\n", ret); - goto fail_powerdown; - } - - ret = dw9718_t_focus_abs(sd, dw9718_dev.focus); - if (ret) - return ret; - dw9718_dev.initialized = true; - dw9718_dev.power_on = 1; - - return 0; - -fail_powerdown: - dev_err(&client->dev, "%s error, powerup failed\n", __func__); - dw9718_dev.platform_data->power_ctrl(sd, 0); - return ret; -} - -int dw9718_vcm_power_down(struct v4l2_subdev *sd) -{ - struct i2c_client *client = v4l2_get_subdevdata(sd); - int ret; - - if (!dw9718_dev.power_on) - return 0; - - ret = dw9718_dev.platform_data->power_ctrl(sd, 0); - if (ret) { - dev_err(&client->dev, "%s power_ctrl failed\n", - __func__); - return ret; - } - dw9718_dev.power_on = 0; - - return 0; -} - -int dw9718_q_focus_status(struct v4l2_subdev *sd, s32 *value) -{ - static const struct timespec move_time = { - .tv_sec = 0, - .tv_nsec = 60000000 - }; - struct timespec current_time, finish_time, delta_time; - - getnstimeofday(¤t_time); - finish_time = timespec_add(dw9718_dev.focus_time, move_time); - delta_time = timespec_sub(current_time, finish_time); - if (delta_time.tv_sec >= 0 && delta_time.tv_nsec >= 0) { - *value = ATOMISP_FOCUS_HP_COMPLETE | - ATOMISP_FOCUS_STATUS_ACCEPTS_NEW_MOVE; - } else { - *value = ATOMISP_FOCUS_STATUS_MOVING | - ATOMISP_FOCUS_HP_IN_PROGRESS; - } - - return 0; -} - -int dw9718_t_focus_rel(struct v4l2_subdev *sd, s32 value) -{ - return dw9718_t_focus_abs(sd, dw9718_dev.focus + value); -} - -int dw9718_q_focus_abs(struct v4l2_subdev *sd, s32 *value) -{ - *value = dw9718_dev.focus; - return 0; -} -int dw9718_t_vcm_slew(struct v4l2_subdev *sd, s32 value) -{ - return 0; -} - -int dw9718_t_vcm_timing(struct v4l2_subdev *sd, s32 value) -{ - return 0; -} - -int dw9718_vcm_init(struct v4l2_subdev *sd) -{ - dw9718_dev.platform_data = camera_get_af_platform_data(); - dw9718_dev.focus = DW9718_DEFAULT_FOCUS_POSITION; - dw9718_dev.power_on = 0; - return (NULL == dw9718_dev.platform_data) ? -ENODEV : 0; -} diff --git a/drivers/staging/media/atomisp/i2c/imx/dw9718.h b/drivers/staging/media/atomisp/i2c/imx/dw9718.h deleted file mode 100644 index 4a1040c3149f..000000000000 --- a/drivers/staging/media/atomisp/i2c/imx/dw9718.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Support for dw9719 vcm driver. - * - * Copyright (c) 2014 Intel Corporation. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. - * - */ - -#ifndef __DW9718_H__ -#define __DW9718_H__ - -#include "../../include/linux/atomisp_platform.h" -#include <linux/types.h> - -#define DW9718_VCM_ADDR (0x18 >> 1) - -/* dw9718 device structure */ -struct dw9718_device { - struct timespec timestamp_t_focus_abs; - s16 number_of_steps; - bool initialized; /* true if dw9718 is detected */ - s32 focus; /* Current focus value */ - struct timespec focus_time; /* Time when focus was last time set */ - __u8 buffer[4]; /* Used for i2c transactions */ - const struct camera_af_platform_data *platform_data; - __u8 power_on; -}; - -#define DW9718_MAX_FOCUS_POS 1023 - -/* Register addresses */ -#define DW9718_PD 0x00 -#define DW9718_CONTROL 0x01 -#define DW9718_DATA_M 0x02 -#define DW9718_DATA_L 0x03 -#define DW9718_SW 0x04 -#define DW9718_SACT 0x05 -#define DW9718_FLAG 0x10 - -#define DW9718_CONTROL_SW_LINEAR BIT(0) -#define DW9718_CONTROL_S_SAC4 (BIT(1) | BIT(3)) -#define DW9718_CONTROL_OCP_DISABLE BIT(4) -#define DW9718_CONTROL_UVLO_DISABLE BIT(5) - -#define DW9718_SACT_MULT_TWO 0x00 -#define DW9718_SACT_PERIOD_8_8MS 0x19 -#define DW9718_SACT_DEFAULT_VAL 0x60 - -#define DW9718_DEFAULT_FOCUS_POSITION 300 - -#endif /* __DW9718_H__ */ diff --git a/drivers/staging/media/atomisp/i2c/imx/dw9719.c b/drivers/staging/media/atomisp/i2c/imx/dw9719.c deleted file mode 100644 index 565237796bb4..000000000000 --- a/drivers/staging/media/atomisp/i2c/imx/dw9719.c +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Support for dw9719 vcm driver. - * - * Copyright (c) 2012 Intel Corporation. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. - * - */ - -#include <linux/delay.h> -#include "dw9719.h" - -static struct dw9719_device dw9719_dev; - -static int dw9719_i2c_rd8(struct i2c_client *client, u8 reg, u8 *val) -{ - struct i2c_msg msg[2]; - u8 buf[2] = { reg }; - - msg[0].addr = DW9719_VCM_ADDR; - msg[0].flags = 0; - msg[0].len = 1; - msg[0].buf = buf; - - msg[1].addr = DW9719_VCM_ADDR; - msg[1].flags = I2C_M_RD; - msg[1].len = 1; - msg[1].buf = &buf[1]; - *val = 0; - - if (i2c_transfer(client->adapter, msg, 2) != 2) - return -EIO; - *val = buf[1]; - - return 0; -} - -static int dw9719_i2c_wr8(struct i2c_client *client, u8 reg, u8 val) -{ - struct i2c_msg msg; - u8 buf[2] = { reg, val }; - - msg.addr = DW9719_VCM_ADDR; - msg.flags = 0; - msg.len = sizeof(buf); - msg.buf = buf; - - if (i2c_transfer(client->adapter, &msg, 1) != 1) - return -EIO; - - return 0; -} - -static int dw9719_i2c_wr16(struct i2c_client *client, u8 reg, u16 val) -{ - struct i2c_msg msg; - u8 buf[3] = { reg, (u8)(val >> 8), (u8)(val & 0xff)}; - - msg.addr = DW9719_VCM_ADDR; - msg.flags = 0; - msg.len = sizeof(buf); - msg.buf = buf; - - if (i2c_transfer(client->adapter, &msg, 1) != 1) - return -EIO; - - return 0; -} - -int dw9719_vcm_power_up(struct v4l2_subdev *sd) -{ - struct i2c_client *client = v4l2_get_subdevdata(sd); - int ret; - u8 value; - - /* Enable power */ - ret = dw9719_dev.platform_data->power_ctrl(sd, 1); - /* waiting time requested by DW9714A(vcm) */ - if (ret) - return ret; - /* Wait for VBAT to stabilize */ - udelay(1); - - /* - * Jiggle SCL pin to wake up device. - */ - ret = dw9719_i2c_wr8(client, DW9719_CONTROL, 1); - /* Need 100us to transit from SHUTDOWN to STANDBY*/ - usleep_range(100, 1000); - - /* Enable the ringing compensation */ - ret = dw9719_i2c_wr8(client, DW9719_CONTROL, DW9719_ENABLE_RINGING); - if (ret < 0) - goto fail_powerdown; - - /* Use SAC3 mode */ - ret = dw9719_i2c_wr8(client, DW9719_MODE, DW9719_MODE_SAC3); - if (ret < 0) - goto fail_powerdown; - - /* Set the resonance frequency */ - ret = dw9719_i2c_wr8(client, DW9719_VCM_FREQ, DW9719_DEFAULT_VCM_FREQ); - if (ret < 0) - goto fail_powerdown; - - /* Detect device */ - ret = dw9719_i2c_rd8(client, DW9719_INFO, &value); - if (ret < 0) - goto fail_powerdown; - if (value != DW9719_ID) { - ret = -ENXIO; - goto fail_powerdown; - } - dw9719_dev.focus = 0; - dw9719_dev.initialized = true; - - return 0; - -fail_powerdown: - dw9719_dev.platform_data->power_ctrl(sd, 0); - return ret; -} - -int dw9719_vcm_power_down(struct v4l2_subdev *sd) -{ - return dw9719_dev.platform_data->power_ctrl(sd, 0); -} - -int dw9719_q_focus_status(struct v4l2_subdev *sd, s32 *value) -{ - static const struct timespec move_time = { - - .tv_sec = 0, - .tv_nsec = 60000000 - }; - struct timespec current_time, finish_time, delta_time; - - getnstimeofday(¤t_time); - finish_time = timespec_add(dw9719_dev.focus_time, move_time); - delta_time = timespec_sub(current_time, finish_time); - if (delta_time.tv_sec >= 0 && delta_time.tv_nsec >= 0) { - *value = ATOMISP_FOCUS_HP_COMPLETE | - ATOMISP_FOCUS_STATUS_ACCEPTS_NEW_MOVE; - } else { - *value = ATOMISP_FOCUS_STATUS_MOVING | - ATOMISP_FOCUS_HP_IN_PROGRESS; - } - - return 0; -} - -int dw9719_t_focus_abs(struct v4l2_subdev *sd, s32 value) -{ - struct i2c_client *client = v4l2_get_subdevdata(sd); - int ret; - - value = clamp(value, 0, DW9719_MAX_FOCUS_POS); - ret = dw9719_i2c_wr16(client, DW9719_VCM_CURRENT, value); - if (ret < 0) - return ret; - - getnstimeofday(&dw9719_dev.focus_time); - dw9719_dev.focus = value; - - return 0; -} - -int dw9719_t_focus_rel(struct v4l2_subdev *sd, s32 value) -{ - return dw9719_t_focus_abs(sd, dw9719_dev.focus + value); -} - -int dw9719_q_focus_abs(struct v4l2_subdev *sd, s32 *value) -{ - *value = dw9719_dev.focus; - return 0; -} -int dw9719_t_vcm_slew(struct v4l2_subdev *sd, s32 value) -{ - return 0; -} - -int dw9719_t_vcm_timing(struct v4l2_subdev *sd, s32 value) -{ - return 0; -} diff --git a/drivers/staging/media/atomisp/i2c/imx/dw9719.h b/drivers/staging/media/atomisp/i2c/imx/dw9719.h deleted file mode 100644 index 711f412aef2a..000000000000 --- a/drivers/staging/media/atomisp/i2c/imx/dw9719.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Support for dw9719 vcm driver. - * - * Copyright (c) 2012 Intel Corporation. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. - * - */ - -#ifndef __DW9719_H__ -#define __DW9719_H__ - -#include "../../include/linux/atomisp_platform.h" -#include <linux/types.h> - -#define DW9719_VCM_ADDR (0x18 >> 1) - -/* dw9719 device structure */ -struct dw9719_device { - struct timespec timestamp_t_focus_abs; - s16 number_of_steps; - bool initialized; /* true if dw9719 is detected */ - s32 focus; /* Current focus value */ - struct timespec focus_time; /* Time when focus was last time set */ - __u8 buffer[4]; /* Used for i2c transactions */ - const struct camera_af_platform_data *platform_data; -}; - -#define DW9719_INVALID_CONFIG 0xffffffff -#define DW9719_MAX_FOCUS_POS 1023 -#define DELAY_PER_STEP_NS 1000000 -#define DELAY_MAX_PER_STEP_NS (1000000 * 1023) - -#define DW9719_INFO 0 -#define DW9719_ID 0xF1 -#define DW9719_CONTROL 2 -#define DW9719_VCM_CURRENT 3 - -#define DW9719_MODE 6 -#define DW9719_VCM_FREQ 7 - -#define DW9719_MODE_SAC3 0x40 -#define DW9719_DEFAULT_VCM_FREQ 0x04 -#define DW9719_ENABLE_RINGING 0x02 - -#endif diff --git a/drivers/staging/media/atomisp/i2c/imx/imx.c b/drivers/staging/media/atomisp/i2c/imx/imx.c deleted file mode 100644 index 49ab0af87096..000000000000 --- a/drivers/staging/media/atomisp/i2c/imx/imx.c +++ /dev/null @@ -1,2480 +0,0 @@ -/* - * Support for Sony imx 8MP camera sensor. - * - * Copyright (c) 2012 Intel Corporation. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. - * - */ -#include <asm/intel-mid.h> -#include "../../include/linux/atomisp_platform.h" -#include <linux/bitops.h> -#include <linux/device.h> -#include <linux/delay.h> -#include <linux/errno.h> -#include <linux/fs.h> -#include <linux/gpio.h> -#include <linux/init.h> -#include <linux/i2c.h> -#include <linux/io.h> -#include <linux/kernel.h> -#include "../../include/linux/libmsrlisthelper.h" -#include <linux/mm.h> -#include <linux/kmod.h> -#include <linux/module.h> -#include <linux/moduleparam.h> -#include <linux/string.h> -#include <linux/slab.h> -#include <linux/types.h> -#include <media/v4l2-ctrls.h> -#include <media/v4l2-device.h> -#include "imx.h" - -/* - * The imx135 embedded data info: - * embedded data line num: 2 - * line 0 effective data size(byte): 76 - * line 1 effective data size(byte): 113 - */ -static const uint32_t - imx135_embedded_effective_size[IMX135_EMBEDDED_DATA_LINE_NUM] - = {76, 113}; - -static enum atomisp_bayer_order imx_bayer_order_mapping[] = { - atomisp_bayer_order_rggb, - atomisp_bayer_order_grbg, - atomisp_bayer_order_gbrg, - atomisp_bayer_order_bggr -}; - -static const unsigned int -IMX227_BRACKETING_LUT_FRAME_ENTRY[IMX_MAX_AE_LUT_LENGTH] = { - 0x0E10, 0x0E1E, 0x0E2C, 0x0E3A, 0x0E48}; - -static int -imx_read_reg(struct i2c_client *client, u16 len, u16 reg, u16 *val) -{ - struct i2c_msg msg[2]; - u16 data[IMX_SHORT_MAX]; - int ret, i; - int retry = 0; - - if (len > IMX_BYTE_MAX) { - dev_err(&client->dev, "%s error, invalid data length\n", - __func__); - return -EINVAL; - } - - do { - memset(msg, 0 , sizeof(msg)); - memset(data, 0 , sizeof(data)); - - msg[0].addr = client->addr; - msg[0].flags = 0; - msg[0].len = I2C_MSG_LENGTH; - msg[0].buf = (u8 *)data; - /* high byte goes first */ - data[0] = cpu_to_be16(reg); - - msg[1].addr = client->addr; - msg[1].len = len; - msg[1].flags = I2C_M_RD; - msg[1].buf = (u8 *)data; - - ret = i2c_transfer(client->adapter, msg, 2); - if (ret != 2) { - dev_err(&client->dev, - "retrying i2c read from offset 0x%x error %d... %d\n", - reg, ret, retry); - msleep(20); - } - } while (ret != 2 && retry++ < I2C_RETRY_COUNT); - - if (ret != 2) - return -EIO; - - /* high byte comes first */ - if (len == IMX_8BIT) { - *val = (u8)data[0]; - } else { - /* 16-bit access is default when len > 1 */ - for (i = 0; i < (len >> 1); i++) - val[i] = be16_to_cpu(data[i]); - } - - return 0; -} - -static int imx_i2c_write(struct i2c_client *client, u16 len, u8 *data) -{ - struct i2c_msg msg; - int ret; - int retry = 0; - - do { - msg.addr = client->addr; - msg.flags = 0; - msg.len = len; - msg.buf = data; - - ret = i2c_transfer(client->adapter, &msg, 1); - if (ret != 1) { - dev_err(&client->dev, - "retrying i2c write transfer... %d\n", retry); - msleep(20); - } - } while (ret != 1 && retry++ < I2C_RETRY_COUNT); - - return ret == 1 ? 0 : -EIO; -} - -int -imx_write_reg(struct i2c_client *client, u16 data_length, u16 reg, u16 val) -{ - int ret; - unsigned char data[4] = {0}; - u16 *wreg = (u16 *)data; - const u16 len = data_length + sizeof(u16); /* 16-bit address + data */ - - if (data_length != IMX_8BIT && data_length != IMX_16BIT) { - v4l2_err(client, "%s error, invalid data_length\n", __func__); - return -EINVAL; - } - - /* high byte goes out first */ - *wreg = cpu_to_be16(reg); - - if (data_length == IMX_8BIT) - data[2] = (u8)(val); - else { - /* IMX_16BIT */ - u16 *wdata = (u16 *)&data[2]; - *wdata = cpu_to_be16(val); - } - - ret = imx_i2c_write(client, len, data); - if (ret) - dev_err(&client->dev, - "write error: wrote 0x%x to offset 0x%x error %d", - val, reg, ret); - - return ret; -} - -/* - * imx_write_reg_array - Initializes a list of imx registers - * @client: i2c driver client structure - * @reglist: list of registers to be written - * - * This function initializes a list of registers. When consecutive addresses - * are found in a row on the list, this function creates a buffer and sends - * consecutive data in a single i2c_transfer(). - * - * __imx_flush_reg_array, __imx_buf_reg_array() and - * __imx_write_reg_is_consecutive() are internal functions to - * imx_write_reg_array_fast() and should be not used anywhere else. - * - */ - -static int __imx_flush_reg_array(struct i2c_client *client, - struct imx_write_ctrl *ctrl) -{ - u16 size; - - if (ctrl->index == 0) - return 0; - - size = sizeof(u16) + ctrl->index; /* 16-bit address + data */ - ctrl->buffer.addr = cpu_to_be16(ctrl->buffer.addr); - ctrl->index = 0; - - return imx_i2c_write(client, size, (u8 *)&ctrl->buffer); -} - -static int __imx_buf_reg_array(struct i2c_client *client, - struct imx_write_ctrl *ctrl, - const struct imx_reg *next) -{ - int size; - u16 *data16; - - switch (next->type) { - case IMX_8BIT: - size = 1; - ctrl->buffer.data[ctrl->index] = (u8)next->val; - break; - case IMX_16BIT: - size = 2; - data16 = (u16 *)&ctrl->buffer.data[ctrl->index]; - *data16 = cpu_to_be16((u16)next->val); - break; - default: - return -EINVAL; - } - - /* When first item is added, we need to store its starting address */ - if (ctrl->index == 0) - ctrl->buffer.addr = next->sreg; - - ctrl->index += size; - - /* - * Buffer cannot guarantee free space for u32? Better flush it to avoid - * possible lack of memory for next item. - */ - if (ctrl->index + sizeof(u16) >= IMX_MAX_WRITE_BUF_SIZE) - return __imx_flush_reg_array(client, ctrl); - - return 0; -} - -static int -__imx_write_reg_is_consecutive(struct i2c_client *client, - struct imx_write_ctrl *ctrl, - const struct imx_reg *next) -{ - if (ctrl->index == 0) - return 1; - - return ctrl->buffer.addr + ctrl->index == next->sreg; -} - -static int imx_write_reg_array(struct i2c_client *client, - const struct imx_reg *reglist) -{ - const struct imx_reg *next = reglist; - struct imx_write_ctrl ctrl; - int err; - - ctrl.index = 0; - for (; next->type != IMX_TOK_TERM; next++) { - switch (next->type & IMX_TOK_MASK) { - case IMX_TOK_DELAY: - err = __imx_flush_reg_array(client, &ctrl); - if (err) - return err; - msleep(next->val); - break; - - default: - /* - * If next address is not consecutive, data needs to be - * flushed before proceed. - */ - if (!__imx_write_reg_is_consecutive(client, &ctrl, - next)) { - err = __imx_flush_reg_array(client, &ctrl); - if (err) - return err; - } - err = __imx_buf_reg_array(client, &ctrl, next); - if (err) { - v4l2_err(client, "%s: write error, aborted\n", - __func__); - return err; - } - break; - } - } - - return __imx_flush_reg_array(client, &ctrl); -} - -static int __imx_min_fps_diff(int fps, const struct imx_fps_setting *fps_list) -{ - int diff = INT_MAX; - int i; - - if (fps == 0) - return 0; - - for (i = 0; i < MAX_FPS_OPTIONS_SUPPORTED; i++) { - if (!fps_list[i].fps) - break; - if (abs(fps_list[i].fps - fps) < diff) - diff = abs(fps_list[i].fps - fps); - } - - return diff; -} - -static int __imx_nearest_fps_index(int fps, - const struct imx_fps_setting *fps_list) -{ - int fps_index = 0; - int i; - - for (i = 0; i < MAX_FPS_OPTIONS_SUPPORTED; i++) { - if (!fps_list[i].fps) - break; - if (abs(fps_list[i].fps - fps) - < abs(fps_list[fps_index].fps - fps)) - fps_index = i; - } - return fps_index; -} - -/* - * This is to choose the nearest fps setting above the requested fps - * fps_list should be in ascendant order. - */ -static int __imx_above_nearest_fps_index(int fps, - const struct imx_fps_setting *fps_list) -{ - int fps_index = 0; - int i; - - for (i = 0; i < MAX_FPS_OPTIONS_SUPPORTED; i++) { - if (!fps_list[i].fps) - break; - if (fps <= fps_list[i].fps) { - fps_index = i; - break; - } - } - - return fps_index; -} - -static int imx_get_lanes(struct v4l2_subdev *sd) -{ - struct camera_mipi_info *imx_info = v4l2_get_subdev_hostdata(sd); - - if (!imx_info) - return -ENOSYS; - if (imx_info->num_lanes < 1 || imx_info->num_lanes > 4 || - imx_info->num_lanes == 3) - return -EINVAL; - - return imx_info->num_lanes; -} - -static int __imx_update_exposure_timing(struct i2c_client *client, u16 exposure, - u16 llp, u16 fll) -{ - struct v4l2_subdev *sd = i2c_get_clientdata(client); - struct imx_device *dev = to_imx_sensor(sd); - int ret = 0; - - if (dev->sensor_id != IMX227_ID) { - /* Increase the VTS to match exposure + margin */ - if (exposure > fll - IMX_INTEGRATION_TIME_MARGIN) - fll = exposure + IMX_INTEGRATION_TIME_MARGIN; - } - - ret = imx_write_reg(client, IMX_16BIT, - dev->reg_addr->line_length_pixels, llp); - if (ret) - return ret; - - ret = imx_write_reg(client, IMX_16BIT, - dev->reg_addr->frame_length_lines, fll); - if (ret) - return ret; - - if (exposure) - ret = imx_write_reg(client, IMX_16BIT, - dev->reg_addr->coarse_integration_time, exposure); - - return ret; -} - -static int __imx_update_gain(struct v4l2_subdev *sd, u16 gain) -{ - struct imx_device *dev = to_imx_sensor(sd); - struct i2c_client *client = v4l2_get_subdevdata(sd); - int ret; - - /* set global gain */ - ret = imx_write_reg(client, IMX_8BIT, dev->reg_addr->global_gain, gain); - if (ret) - return ret; - - /* set short analog gain */ - if (dev->sensor_id == IMX135_ID) - ret = imx_write_reg(client, IMX_8BIT, IMX_SHORT_AGC_GAIN, gain); - - return ret; -} - -static int __imx_update_digital_gain(struct i2c_client *client, u16 digitgain) -{ - struct v4l2_subdev *sd = i2c_get_clientdata(client); - struct imx_device *dev = to_imx_sensor(sd); - struct imx_write_buffer digit_gain; - - digit_gain.addr = cpu_to_be16(dev->reg_addr->dgc_adj); - digit_gain.data[0] = (digitgain >> 8) & 0xFF; - digit_gain.data[1] = digitgain & 0xFF; - - if (dev->sensor_id == IMX219_ID) { - return imx_i2c_write(client, IMX219_DGC_LEN, (u8 *)&digit_gain); - } else if (dev->sensor_id == IMX227_ID) { - return imx_i2c_write(client, IMX227_DGC_LEN, (u8 *)&digit_gain); - } else { - digit_gain.data[2] = (digitgain >> 8) & 0xFF; - digit_gain.data[3] = digitgain & 0xFF; - digit_gain.data[4] = (digitgain >> 8) & 0xFF; - digit_gain.data[5] = digitgain & 0xFF; - digit_gain.data[6] = (digitgain >> 8) & 0xFF; - digit_gain.data[7] = digitgain & 0xFF; - return imx_i2c_write(client, IMX_DGC_LEN, (u8 *)&digit_gain); - } - return 0; -} - -static int imx_set_exposure_gain(struct v4l2_subdev *sd, u16 coarse_itg, - u16 gain, u16 digitgain) -{ - struct imx_device *dev = to_imx_sensor(sd); - struct i2c_client *client = v4l2_get_subdevdata(sd); - int lanes = imx_get_lanes(sd); - unsigned int digitgain_scaled; - int ret = 0; - - /* Validate exposure: cannot exceed VTS-4 where VTS is 16bit */ - coarse_itg = clamp_t(u16, coarse_itg, 0, IMX_MAX_EXPOSURE_SUPPORTED); - - /* Validate gain: must not exceed maximum 8bit value */ - gain = clamp_t(u16, gain, 0, IMX_MAX_GLOBAL_GAIN_SUPPORTED); - - mutex_lock(&dev->input_lock); - - if (dev->sensor_id == IMX227_ID) { - ret = imx_write_reg_array(client, imx_param_hold); - if (ret) { - mutex_unlock(&dev->input_lock); - return ret; - } - } - - /* For imx175, setting gain must be delayed by one */ - if ((dev->sensor_id == IMX175_ID) && dev->digital_gain) - digitgain_scaled = dev->digital_gain; - else - digitgain_scaled = digitgain; - /* imx132 with two lanes needs more gain to saturate at max */ - if (dev->sensor_id == IMX132_ID && lanes > 1) { - digitgain_scaled *= IMX132_2LANES_GAINFACT; - digitgain_scaled >>= IMX132_2LANES_GAINFACT_SHIFT; - } - /* Validate digital gain: must not exceed 12 bit value*/ - digitgain_scaled = clamp_t(unsigned int, digitgain_scaled, - 0, IMX_MAX_DIGITAL_GAIN_SUPPORTED); - - ret = __imx_update_exposure_timing(client, coarse_itg, - dev->pixels_per_line, dev->lines_per_frame); - if (ret) - goto out; - dev->coarse_itg = coarse_itg; - - if (dev->sensor_id == IMX175_ID) - ret = __imx_update_gain(sd, dev->gain); - else - ret = __imx_update_gain(sd, gain); - if (ret) - goto out; - dev->gain = gain; - - ret = __imx_update_digital_gain(client, digitgain_scaled); - if (ret) - goto out; - dev->digital_gain = digitgain; - -out: - if (dev->sensor_id == IMX227_ID) - ret = imx_write_reg_array(client, imx_param_update); - mutex_unlock(&dev->input_lock); - return ret; -} - -static long imx_s_exposure(struct v4l2_subdev *sd, - struct atomisp_exposure *exposure) -{ - return imx_set_exposure_gain(sd, exposure->integration_time[0], - exposure->gain[0], exposure->gain[1]); -} - -/* FIXME -To be updated with real OTP reading */ -static int imx_g_priv_int_data(struct v4l2_subdev *sd, - struct v4l2_private_int_data *priv) -{ - struct i2c_client *client = v4l2_get_subdevdata(sd); - struct imx_device *dev = to_imx_sensor(sd); - u8 __user *to = priv->data; - u32 read_size = priv->size; - int ret; - - /* No need to copy data if size is 0 */ - if (!read_size) - goto out; - - if (IS_ERR(dev->otp_data)) { - dev_err(&client->dev, "OTP data not available"); - return PTR_ERR(dev->otp_data); - } - /* Correct read_size value only if bigger than maximum */ - if (read_size > dev->otp_driver->size) - read_size = dev->otp_driver->size; - - ret = copy_to_user(to, dev->otp_data, read_size); - if (ret) { - dev_err(&client->dev, "%s: failed to copy OTP data to user\n", - __func__); - return -EFAULT; - } -out: - /* Return correct size */ - priv->size = dev->otp_driver->size; - - return 0; -} - -static int __imx_init(struct v4l2_subdev *sd, u32 val) -{ - struct i2c_client *client = v4l2_get_subdevdata(sd); - struct imx_device *dev = to_imx_sensor(sd); - int lanes = imx_get_lanes(sd); - int ret; - - if (dev->sensor_id == IMX_ID_DEFAULT) - return 0; - - /* The default is no flip at sensor initialization */ - dev->h_flip->cur.val = 0; - dev->v_flip->cur.val = 0; - /* Sets the default FPS */ - dev->fps_index = 0; - dev->curr_res_table = dev->mode_tables->res_preview; - dev->entries_curr_table = dev->mode_tables->n_res_preview; - - ret = imx_write_reg_array(client, dev->mode_tables->init_settings); - if (ret) - return ret; - - if (dev->sensor_id == IMX132_ID && lanes > 0) { - static const u8 imx132_rglanesel[] = { - IMX132_RGLANESEL_1LANE, /* 1 lane */ - IMX132_RGLANESEL_2LANES, /* 2 lanes */ - IMX132_RGLANESEL_1LANE, /* undefined */ - IMX132_RGLANESEL_4LANES, /* 4 lanes */ - }; - ret = imx_write_reg(client, IMX_8BIT, - IMX132_RGLANESEL, imx132_rglanesel[lanes - 1]); - } - - return ret; -} - -static int imx_init(struct v4l2_subdev *sd, u32 val) -{ - struct imx_device *dev = to_imx_sensor(sd); - int ret = 0; - - mutex_lock(&dev->input_lock); - ret = __imx_init(sd, val); - mutex_unlock(&dev->input_lock); - - return ret; -} - -static long imx_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg) -{ - - switch (cmd) { - case ATOMISP_IOC_S_EXPOSURE: - return imx_s_exposure(sd, arg); - case ATOMISP_IOC_G_SENSOR_PRIV_INT_DATA: - return imx_g_priv_int_data(sd, arg); - default: - return -EINVAL; - } - return 0; -} - -static int power_up(struct v4l2_subdev *sd) -{ - struct i2c_client *client = v4l2_get_subdevdata(sd); - struct imx_device *dev = to_imx_sensor(sd); - int ret; - - /* power control */ - ret = dev->platform_data->power_ctrl(sd, 1); - if (ret) - goto fail_power; - - /* flis clock control */ - ret = dev->platform_data->flisclk_ctrl(sd, 1); - if (ret) - goto fail_clk; - - /* gpio ctrl */ - ret = dev->platform_data->gpio_ctrl(sd, 1); - if (ret) { - dev_err(&client->dev, "gpio failed\n"); - goto fail_gpio; - } - - return 0; -fail_gpio: - dev->platform_data->gpio_ctrl(sd, 0); -fail_clk: - dev->platform_data->flisclk_ctrl(sd, 0); -fail_power: - dev->platform_data->power_ctrl(sd, 0); - dev_err(&client->dev, "sensor power-up failed\n"); - - return ret; -} - -static int power_down(struct v4l2_subdev *sd) -{ - struct imx_device *dev = to_imx_sensor(sd); - struct i2c_client *client = v4l2_get_subdevdata(sd); - int ret; - - ret = dev->platform_data->flisclk_ctrl(sd, 0); - if (ret) - dev_err(&client->dev, "flisclk failed\n"); - - /* gpio ctrl */ - ret = dev->platform_data->gpio_ctrl(sd, 0); - if (ret) - dev_err(&client->dev, "gpio failed\n"); - - /* power control */ - ret = dev->platform_data->power_ctrl(sd, 0); - if (ret) - dev_err(&client->dev, "vprog failed.\n"); - - return ret; -} - -static int __imx_s_power(struct v4l2_subdev *sd, int on) -{ - struct imx_device *dev = to_imx_sensor(sd); - int ret = 0; - int r = 0; - - if (on == 0) { - ret = power_down(sd); - if (dev->vcm_driver && dev->vcm_driver->power_down) - r = dev->vcm_driver->power_down(sd); - if (ret == 0) - ret = r; - dev->power = 0; - } else { - if (dev->vcm_driver && dev->vcm_driver->power_up) - ret = dev->vcm_driver->power_up(sd); - if (ret) - return ret; - ret = power_up(sd); - if (!ret) { - dev->power = 1; - return __imx_init(sd, 0); - } - } - - return ret; -} - -static int imx_s_power(struct v4l2_subdev *sd, int on) -{ - int ret; - struct imx_device *dev = to_imx_sensor(sd); - - mutex_lock(&dev->input_lock); - ret = __imx_s_power(sd, on); - mutex_unlock(&dev->input_lock); - - return ret; -} - -static int imx_get_intg_factor(struct i2c_client *client, - struct camera_mipi_info *info, - const struct imx_reg *reglist) -{ - struct v4l2_subdev *sd = i2c_get_clientdata(client); - struct imx_device *dev = to_imx_sensor(sd); - int lanes = imx_get_lanes(sd); - u32 vt_pix_clk_div; - u32 vt_sys_clk_div; - u32 pre_pll_clk_div; - u32 pll_multiplier; - - const int ext_clk_freq_hz = 19200000; - struct atomisp_sensor_mode_data *buf = &info->data; - int ret; - u16 data[IMX_INTG_BUF_COUNT]; - - u32 vt_pix_clk_freq_mhz; - u32 coarse_integration_time_min; - u32 coarse_integration_time_max_margin; - u32 read_mode; - u32 div; - - if (info == NULL) - return -EINVAL; - - memset(data, 0, IMX_INTG_BUF_COUNT * sizeof(u16)); - ret = imx_read_reg(client, 1, IMX_VT_PIX_CLK_DIV, data); - if (ret) - return ret; - vt_pix_clk_div = data[0] & IMX_MASK_5BIT; - - if (dev->sensor_id == IMX132_ID || dev->sensor_id == IMX208_ID) { - static const int rgpltd[] = { 2, 4, 1, 1 }; - ret = imx_read_reg(client, 1, IMX132_208_VT_RGPLTD, data); - if (ret) - return ret; - vt_sys_clk_div = rgpltd[data[0] & IMX_MASK_2BIT]; - } else { - ret = imx_read_reg(client, 1, IMX_VT_SYS_CLK_DIV, data); - if (ret) - return ret; - vt_sys_clk_div = data[0] & IMX_MASK_2BIT; - } - ret = imx_read_reg(client, 1, IMX_PRE_PLL_CLK_DIV, data); - if (ret) - return ret; - pre_pll_clk_div = data[0] & IMX_MASK_4BIT; - - ret = imx_read_reg(client, 2, - (dev->sensor_id == IMX132_ID || - dev->sensor_id == IMX219_ID || - dev->sensor_id == IMX208_ID) ? - IMX132_208_219_PLL_MULTIPLIER : IMX_PLL_MULTIPLIER, data); - if (ret) - return ret; - pll_multiplier = data[0] & IMX_MASK_11BIT; - - memset(data, 0, IMX_INTG_BUF_COUNT * sizeof(u16)); - ret = imx_read_reg(client, 4, IMX_COARSE_INTG_TIME_MIN, data); - if (ret) - return ret; - coarse_integration_time_min = data[0]; - coarse_integration_time_max_margin = data[1]; - - /* Get the cropping and output resolution to ISP for this mode. */ - ret = imx_read_reg(client, 2, dev->reg_addr->horizontal_start_h, data); - if (ret) - return ret; - buf->crop_horizontal_start = data[0]; - - ret = imx_read_reg(client, 2, dev->reg_addr->vertical_start_h, data); - if (ret) - return ret; - buf->crop_vertical_start = data[0]; - - ret = imx_read_reg(client, 2, dev->reg_addr->horizontal_end_h, data); - if (ret) - return ret; - buf->crop_horizontal_end = data[0]; - - ret = imx_read_reg(client, 2, dev->reg_addr->vertical_end_h, data); - if (ret) - return ret; - buf->crop_vertical_end = data[0]; - - ret = imx_read_reg(client, 2, - dev->reg_addr->horizontal_output_size_h, data); - if (ret) - return ret; - buf->output_width = data[0]; - - ret = imx_read_reg(client, 2, - dev->reg_addr->vertical_output_size_h, data); - if (ret) - return ret; - buf->output_height = data[0]; - - memset(data, 0, IMX_INTG_BUF_COUNT * sizeof(u16)); - if (dev->sensor_id == IMX132_ID || dev->sensor_id == IMX208_ID || - dev->sensor_id == IMX219_ID) - read_mode = 0; - else { - if (dev->sensor_id == IMX227_ID) - ret = imx_read_reg(client, 1, IMX227_READ_MODE, data); - else - ret = imx_read_reg(client, 1, IMX_READ_MODE, data); - - if (ret) - return ret; - read_mode = data[0] & IMX_MASK_2BIT; - } - - div = pre_pll_clk_div*vt_sys_clk_div*vt_pix_clk_div; - if (div == 0) - return -EINVAL; - - if (dev->sensor_id == IMX132_ID || dev->sensor_id == IMX208_ID) - vt_pix_clk_freq_mhz = ext_clk_freq_hz / div; - else if (dev->sensor_id == IMX227_ID) { - /* according to IMX227 datasheet: - * vt_pix_freq_mhz = * num_of_vt_lanes(4) * ivt_pix_clk_freq_mhz - */ - vt_pix_clk_freq_mhz = - (u64)4 * ext_clk_freq_hz * pll_multiplier; - do_div(vt_pix_clk_freq_mhz, div); - } else - vt_pix_clk_freq_mhz = 2 * ext_clk_freq_hz / div; - - vt_pix_clk_freq_mhz *= pll_multiplier; - if (dev->sensor_id == IMX132_ID && lanes > 0) - vt_pix_clk_freq_mhz *= lanes; - - dev->vt_pix_clk_freq_mhz = vt_pix_clk_freq_mhz; - - buf->vt_pix_clk_freq_mhz = vt_pix_clk_freq_mhz; - buf->coarse_integration_time_min = coarse_integration_time_min; - buf->coarse_integration_time_max_margin = - coarse_integration_time_max_margin; - - buf->fine_integration_time_min = IMX_FINE_INTG_TIME; - buf->fine_integration_time_max_margin = IMX_FINE_INTG_TIME; - buf->fine_integration_time_def = IMX_FINE_INTG_TIME; - buf->frame_length_lines = dev->lines_per_frame; - buf->line_length_pck = dev->pixels_per_line; - buf->read_mode = read_mode; - - if (dev->sensor_id == IMX132_ID || dev->sensor_id == IMX208_ID || - dev->sensor_id == IMX219_ID) { - buf->binning_factor_x = 1; - buf->binning_factor_y = 1; - } else { - if (dev->sensor_id == IMX227_ID) - ret = imx_read_reg(client, 1, IMX227_BINNING_ENABLE, - data); - else - ret = imx_read_reg(client, 1, IMX_BINNING_ENABLE, data); - - if (ret) - return ret; - /* 1:binning enabled, 0:disabled */ - if (data[0] == 1) { - if (dev->sensor_id == IMX227_ID) - ret = imx_read_reg(client, 1, - IMX227_BINNING_TYPE, data); - else - ret = imx_read_reg(client, 1, - IMX_BINNING_TYPE, data); - - if (ret) - return ret; - buf->binning_factor_x = data[0] >> 4 & 0x0f; - if (!buf->binning_factor_x) - buf->binning_factor_x = 1; - buf->binning_factor_y = data[0] & 0xf; - if (!buf->binning_factor_y) - buf->binning_factor_y = 1; - /* WOWRKAROUND, NHD setting for IMX227 should have 4x4 - * binning but the register setting does not reflect - * this, I am asking vendor why this happens. this is - * workaround for INTEL BZ 216560. - */ - if (dev->sensor_id == IMX227_ID) { - if (dev->curr_res_table[dev->fmt_idx].width == - 376 && - dev->curr_res_table[dev->fmt_idx].height == - 656) { - buf->binning_factor_x = 4; - buf->binning_factor_y = 4; - } - } - } else { - buf->binning_factor_x = 1; - buf->binning_factor_y = 1; - } - } - - return 0; -} - -/* This returns the exposure time being used. This should only be used - for filling in EXIF data, not for actual image processing. */ -static int imx_q_exposure(struct v4l2_subdev *sd, s32 *value) -{ - struct i2c_client *client = v4l2_get_subdevdata(sd); - struct imx_device *dev = to_imx_sensor(sd); - u16 coarse; - int ret; - - /* the fine integration time is currently not calculated */ - ret = imx_read_reg(client, IMX_16BIT, - dev->reg_addr->coarse_integration_time, &coarse); - *value = coarse; - - return ret; -} - -static int imx_test_pattern(struct v4l2_subdev *sd) -{ - struct i2c_client *client = v4l2_get_subdevdata(sd); - struct imx_device *dev = to_imx_sensor(sd); - int ret; - - if (dev->power == 0) - return 0; - - ret = imx_write_reg(client, IMX_16BIT, IMX_TEST_PATTERN_COLOR_R, - (u16)(dev->tp_r->val >> 22)); - if (ret) - return ret; - - ret = imx_write_reg(client, IMX_16BIT, IMX_TEST_PATTERN_COLOR_GR, - (u16)(dev->tp_gr->val >> 22)); - if (ret) - return ret; - - ret = imx_write_reg(client, IMX_16BIT, IMX_TEST_PATTERN_COLOR_GB, - (u16)(dev->tp_gb->val >> 22)); - if (ret) - return ret; - - ret = imx_write_reg(client, IMX_16BIT, IMX_TEST_PATTERN_COLOR_B, - (u16)(dev->tp_b->val >> 22)); - if (ret) - return ret; - - return imx_write_reg(client, IMX_16BIT, IMX_TEST_PATTERN_MODE, - (u16)(dev->tp_mode->val)); -} - -static u32 imx_translate_bayer_order(enum atomisp_bayer_order code) -{ - switch (code) { - case atomisp_bayer_order_rggb: - return MEDIA_BUS_FMT_SRGGB10_1X10; - case atomisp_bayer_order_grbg: - return MEDIA_BUS_FMT_SGRBG10_1X10; - case atomisp_bayer_order_bggr: - return MEDIA_BUS_FMT_SBGGR10_1X10; - case atomisp_bayer_order_gbrg: - return MEDIA_BUS_FMT_SGBRG10_1X10; - } - return 0; -} - -static int imx_v_flip(struct v4l2_subdev *sd, s32 value) -{ - struct imx_device *dev = to_imx_sensor(sd); - struct camera_mipi_info *imx_info = NULL; - struct i2c_client *client = v4l2_get_subdevdata(sd); - int ret; - u16 val; - - if (dev->power == 0) - return -EIO; - - ret = imx_write_reg_array(client, dev->param_hold); - if (ret) - return ret; - - ret = imx_read_reg(client, IMX_8BIT, - dev->reg_addr->img_orientation, &val); - if (ret) - return ret; - if (value) - val |= IMX_VFLIP_BIT; - else - val &= ~IMX_VFLIP_BIT; - - ret = imx_write_reg(client, IMX_8BIT, - dev->reg_addr->img_orientation, val); - if (ret) - return ret; - - imx_info = v4l2_get_subdev_hostdata(sd); - if (imx_info) { - val &= (IMX_VFLIP_BIT|IMX_HFLIP_BIT); - imx_info->raw_bayer_order = imx_bayer_order_mapping[val]; - dev->format.code = imx_translate_bayer_order( - imx_info->raw_bayer_order); - } - - return imx_write_reg_array(client, dev->param_update); -} - -static int imx_h_flip(struct v4l2_subdev *sd, s32 value) -{ - struct imx_device *dev = to_imx_sensor(sd); - struct camera_mipi_info *imx_info = NULL; - struct i2c_client *client = v4l2_get_subdevdata(sd); - int ret; - u16 val; - - if (dev->power == 0) - return -EIO; - - ret = imx_write_reg_array(client, dev->param_hold); - if (ret) - return ret; - ret = imx_read_reg(client, IMX_8BIT, - dev->reg_addr->img_orientation, &val); - if (ret) - return ret; - if (value) - val |= IMX_HFLIP_BIT; - else - val &= ~IMX_HFLIP_BIT; - ret = imx_write_reg(client, IMX_8BIT, - dev->reg_addr->img_orientation, val); - if (ret) - return ret; - - imx_info = v4l2_get_subdev_hostdata(sd); - if (imx_info) { - val &= (IMX_VFLIP_BIT|IMX_HFLIP_BIT); - imx_info->raw_bayer_order = imx_bayer_order_mapping[val]; - dev->format.code = imx_translate_bayer_order( - imx_info->raw_bayer_order); - } - - return imx_write_reg_array(client, dev->param_update); -} - -static int imx_g_focal(struct v4l2_subdev *sd, s32 *val) -{ - *val = (IMX_FOCAL_LENGTH_NUM << 16) | IMX_FOCAL_LENGTH_DEM; - return 0; -} - -static int imx_g_fnumber(struct v4l2_subdev *sd, s32 *val) -{ - /*const f number for imx*/ - *val = (IMX_F_NUMBER_DEFAULT_NUM << 16) | IMX_F_NUMBER_DEM; - return 0; -} - -static int imx_g_fnumber_range(struct v4l2_subdev *sd, s32 *val) -{ - *val = (IMX_F_NUMBER_DEFAULT_NUM << 24) | - (IMX_F_NUMBER_DEM << 16) | - (IMX_F_NUMBER_DEFAULT_NUM << 8) | IMX_F_NUMBER_DEM; - return 0; -} - -static int imx_g_bin_factor_x(struct v4l2_subdev *sd, s32 *val) -{ - struct imx_device *dev = to_imx_sensor(sd); - - *val = dev->curr_res_table[dev->fmt_idx].bin_factor_x; - - return 0; -} - -static int imx_g_bin_factor_y(struct v4l2_subdev *sd, s32 *val) -{ - struct imx_device *dev = to_imx_sensor(sd); - - *val = dev->curr_res_table[dev->fmt_idx].bin_factor_y; - - return 0; -} - -static int imx_t_focus_abs(struct v4l2_subdev *sd, s32 value) -{ - struct imx_device *dev = to_imx_sensor(sd); - if (dev->vcm_driver && dev->vcm_driver->t_focus_abs) - return dev->vcm_driver->t_focus_abs(sd, value); - return 0; -} - -static int imx_t_focus_rel(struct v4l2_subdev *sd, s32 value) -{ - struct imx_device *dev = to_imx_sensor(sd); - if (dev->vcm_driver && dev->vcm_driver->t_focus_rel) - return dev->vcm_driver->t_focus_rel(sd, value); - return 0; -} - -static int imx_q_focus_status(struct v4l2_subdev *sd, s32 *value) -{ - struct imx_device *dev = to_imx_sensor(sd); - if (dev->vcm_driver && dev->vcm_driver->q_focus_status) - return dev->vcm_driver->q_focus_status(sd, value); - return 0; -} - -static int imx_q_focus_abs(struct v4l2_subdev *sd, s32 *value) -{ - struct imx_device *dev = to_imx_sensor(sd); - if (dev->vcm_driver && dev->vcm_driver->q_focus_abs) - return dev->vcm_driver->q_focus_abs(sd, value); - return 0; -} - -static int imx_t_vcm_slew(struct v4l2_subdev *sd, s32 value) -{ - struct imx_device *dev = to_imx_sensor(sd); - if (dev->vcm_driver && dev->vcm_driver->t_vcm_slew) - return dev->vcm_driver->t_vcm_slew(sd, value); - return 0; -} - -static int imx_t_vcm_timing(struct v4l2_subdev *sd, s32 value) -{ - struct imx_device *dev = to_imx_sensor(sd); - if (dev->vcm_driver && dev->vcm_driver->t_vcm_timing) - return dev->vcm_driver->t_vcm_timing(sd, value); - return 0; -} - -static int imx_s_ctrl(struct v4l2_ctrl *ctrl) -{ - struct imx_device *dev = container_of( - ctrl->handler, struct imx_device, ctrl_handler); - struct i2c_client *client = v4l2_get_subdevdata(&dev->sd); - int ret = 0; - - switch (ctrl->id) { - case V4L2_CID_TEST_PATTERN: - ret = imx_test_pattern(&dev->sd); - break; - case V4L2_CID_VFLIP: - dev_dbg(&client->dev, "%s: CID_VFLIP:%d.\n", - __func__, ctrl->val); - ret = imx_v_flip(&dev->sd, ctrl->val); - break; - case V4L2_CID_HFLIP: - dev_dbg(&client->dev, "%s: CID_HFLIP:%d.\n", - __func__, ctrl->val); - ret = imx_h_flip(&dev->sd, ctrl->val); - break; - case V4L2_CID_FOCUS_ABSOLUTE: - ret = imx_t_focus_abs(&dev->sd, ctrl->val); - break; - case V4L2_CID_FOCUS_RELATIVE: - ret = imx_t_focus_rel(&dev->sd, ctrl->val); - break; - case V4L2_CID_VCM_SLEW: - ret = imx_t_vcm_slew(&dev->sd, ctrl->val); - break; - case V4L2_CID_VCM_TIMEING: - ret = imx_t_vcm_timing(&dev->sd, ctrl->val); - break; - } - - return ret; -} - -static int imx_g_volatile_ctrl(struct v4l2_ctrl *ctrl) -{ - struct imx_device *dev = container_of( - ctrl->handler, struct imx_device, ctrl_handler); - int ret = 0; - unsigned int val; - - switch (ctrl->id) { - case V4L2_CID_EXPOSURE_ABSOLUTE: - ret = imx_q_exposure(&dev->sd, &ctrl->val); - break; - case V4L2_CID_FOCUS_ABSOLUTE: - ret = imx_q_focus_abs(&dev->sd, &ctrl->val); - break; - case V4L2_CID_FOCUS_STATUS: - ret = imx_q_focus_status(&dev->sd, &ctrl->val); - break; - case V4L2_CID_FOCAL_ABSOLUTE: - ret = imx_g_focal(&dev->sd, &ctrl->val); - break; - case V4L2_CID_FNUMBER_ABSOLUTE: - ret = imx_g_fnumber(&dev->sd, &ctrl->val); - break; - case V4L2_CID_FNUMBER_RANGE: - ret = imx_g_fnumber_range(&dev->sd, &ctrl->val); - break; - case V4L2_CID_BIN_FACTOR_HORZ: - ret = imx_g_bin_factor_x(&dev->sd, &ctrl->val); - break; - case V4L2_CID_BIN_FACTOR_VERT: - ret = imx_g_bin_factor_y(&dev->sd, &ctrl->val); - break; - case V4L2_CID_VBLANK: - ctrl->val = dev->lines_per_frame - - dev->curr_res_table[dev->fmt_idx].height; - break; - case V4L2_CID_HBLANK: - ctrl->val = dev->pixels_per_line - - dev->curr_res_table[dev->fmt_idx].width; - break; - case V4L2_CID_PIXEL_RATE: - ctrl->val = dev->vt_pix_clk_freq_mhz; - break; - case V4L2_CID_LINK_FREQ: - val = dev->curr_res_table[dev->fmt_idx]. - fps_options[dev->fps_index].mipi_freq; - if (val == 0) - val = dev->curr_res_table[dev->fmt_idx].mipi_freq; - if (val == 0) - return -EINVAL; - ctrl->val = val * 1000; /* To Hz */ - break; - default: - return -EINVAL; - } - - return ret; -} - -static const struct v4l2_ctrl_ops ctrl_ops = { - .s_ctrl = imx_s_ctrl, - .g_volatile_ctrl = imx_g_volatile_ctrl -}; - -static const struct v4l2_ctrl_config imx_controls[] = { - { - .ops = &ctrl_ops, - .id = V4L2_CID_EXPOSURE_ABSOLUTE, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "exposure", - .min = 0x0, - .max = 0xffff, - .step = 0x01, - .def = 0x00, - .flags = V4L2_CTRL_FLAG_VOLATILE, - }, - { - .ops = &ctrl_ops, - .id = V4L2_CID_TEST_PATTERN, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Test pattern", - .min = 0, - .max = 0xffff, - .step = 1, - .def = 0, - }, - { - .ops = &ctrl_ops, - .id = V4L2_CID_TEST_PATTERN_COLOR_R, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Test pattern solid color R", - .min = INT_MIN, - .max = INT_MAX, - .step = 1, - .def = 0, - }, - { - .ops = &ctrl_ops, - .id = V4L2_CID_TEST_PATTERN_COLOR_GR, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Test pattern solid color GR", - .min = INT_MIN, - .max = INT_MAX, - .step = 1, - .def = 0, - }, - { - .ops = &ctrl_ops, - .id = V4L2_CID_TEST_PATTERN_COLOR_GB, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Test pattern solid color GB", - .min = INT_MIN, - .max = INT_MAX, - .step = 1, - .def = 0, - }, - { - .ops = &ctrl_ops, - .id = V4L2_CID_TEST_PATTERN_COLOR_B, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Test pattern solid color B", - .min = INT_MIN, - .max = INT_MAX, - .step = 1, - .def = 0, - }, - { - .ops = &ctrl_ops, - .id = V4L2_CID_VFLIP, - .type = V4L2_CTRL_TYPE_BOOLEAN, - .name = "Flip", - .min = 0, - .max = 1, - .step = 1, - .def = 0, - }, - { - .ops = &ctrl_ops, - .id = V4L2_CID_HFLIP, - .type = V4L2_CTRL_TYPE_BOOLEAN, - .name = "Mirror", - .min = 0, - .max = 1, - .step = 1, - .def = 0, - }, - { - .ops = &ctrl_ops, - .id = V4L2_CID_FOCUS_ABSOLUTE, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "focus move absolute", - .min = 0, - .max = IMX_MAX_FOCUS_POS, - .step = 1, - .def = 0, - .flags = V4L2_CTRL_FLAG_VOLATILE, - }, - { - .ops = &ctrl_ops, - .id = V4L2_CID_FOCUS_RELATIVE, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "focus move relative", - .min = IMX_MAX_FOCUS_NEG, - .max = IMX_MAX_FOCUS_POS, - .step = 1, - .def = 0, - .flags = 0, - }, - { - .ops = &ctrl_ops, - .id = V4L2_CID_FOCUS_STATUS, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "focus status", - .min = 0, - .max = 100, /* allow enum to grow in the future */ - .step = 1, - .def = 0, - .flags = V4L2_CTRL_FLAG_VOLATILE, - }, - { - .ops = &ctrl_ops, - .id = V4L2_CID_VCM_SLEW, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "vcm slew", - .min = 0, - .max = IMX_VCM_SLEW_STEP_MAX, - .step = 1, - .def = 0, - .flags = 0, - }, - { - .ops = &ctrl_ops, - .id = V4L2_CID_VCM_TIMEING, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "vcm step time", - .min = 0, - .max = IMX_VCM_SLEW_TIME_MAX, - .step = 1, - .def = 0, - .flags = 0, - }, - { - .ops = &ctrl_ops, - .id = V4L2_CID_FOCAL_ABSOLUTE, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "focal length", - .min = IMX_FOCAL_LENGTH_DEFAULT, - .max = IMX_FOCAL_LENGTH_DEFAULT, - .step = 0x01, - .def = IMX_FOCAL_LENGTH_DEFAULT, - .flags = V4L2_CTRL_FLAG_VOLATILE, - }, - { - .ops = &ctrl_ops, - .id = V4L2_CID_FNUMBER_ABSOLUTE, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "f-number", - .min = IMX_F_NUMBER_DEFAULT, - .max = IMX_F_NUMBER_DEFAULT, - .step = 0x01, - .def = IMX_F_NUMBER_DEFAULT, - .flags = V4L2_CTRL_FLAG_VOLATILE, - }, - { - .ops = &ctrl_ops, - .id = V4L2_CID_FNUMBER_RANGE, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "f-number range", - .min = IMX_F_NUMBER_RANGE, - .max = IMX_F_NUMBER_RANGE, - .step = 0x01, - .def = IMX_F_NUMBER_RANGE, - .flags = V4L2_CTRL_FLAG_VOLATILE, - }, - { - .ops = &ctrl_ops, - .id = V4L2_CID_BIN_FACTOR_HORZ, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "horizontal binning factor", - .min = 0, - .max = IMX_BIN_FACTOR_MAX, - .step = 1, - .def = 0, - .flags = V4L2_CTRL_FLAG_VOLATILE, - }, - { - .ops = &ctrl_ops, - .id = V4L2_CID_BIN_FACTOR_VERT, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "vertical binning factor", - .min = 0, - .max = IMX_BIN_FACTOR_MAX, - .step = 1, - .def = 0, - .flags = V4L2_CTRL_FLAG_VOLATILE, - }, - { - .ops = &ctrl_ops, - .id = V4L2_CID_LINK_FREQ, - .name = "Link Frequency", - .type = V4L2_CTRL_TYPE_INTEGER, - .min = 1, - .max = 1500000 * 1000, - .step = 1, - .def = 1, - .flags = V4L2_CTRL_FLAG_VOLATILE | V4L2_CTRL_FLAG_READ_ONLY, - }, - { - .ops = &ctrl_ops, - .id = V4L2_CID_PIXEL_RATE, - .name = "Pixel Rate", - .type = V4L2_CTRL_TYPE_INTEGER, - .min = 0, - .max = INT_MAX, - .step = 1, - .def = 0, - .flags = V4L2_CTRL_FLAG_VOLATILE, - }, - { - .ops = &ctrl_ops, - .id = V4L2_CID_HBLANK, - .name = "Horizontal Blanking", - .type = V4L2_CTRL_TYPE_INTEGER, - .min = 0, - .max = SHRT_MAX, - .step = 1, - .def = 0, - .flags = V4L2_CTRL_FLAG_VOLATILE, - }, - { - .ops = &ctrl_ops, - .id = V4L2_CID_VBLANK, - .name = "Vertical Blanking", - .type = V4L2_CTRL_TYPE_INTEGER, - .min = 0, - .max = SHRT_MAX, - .step = 1, - .def = 0, - .flags = V4L2_CTRL_FLAG_VOLATILE, - }, - { - .ops = &ctrl_ops, - .id = V4L2_CID_HFLIP, - .name = "Horizontal Flip", - .type = V4L2_CTRL_TYPE_INTEGER, - .min = 0, - .max = 1, - .step = 1, - .def = 0, - .flags = 0, - }, - { - .ops = &ctrl_ops, - .id = V4L2_CID_VFLIP, - .name = "Vertical Flip", - .type = V4L2_CTRL_TYPE_INTEGER, - .min = 0, - .max = 1, - .step = 1, - .def = 0, - .flags = 0, - }, -}; - -/* - * distance - calculate the distance - * @res: resolution - * @w: width - * @h: height - * - * Get the gap between resolution and w/h. - * res->width/height smaller than w/h wouldn't be considered. - * Returns the value of gap or -1 if fail. - */ -#define LARGEST_ALLOWED_RATIO_MISMATCH 600 -static int distance(struct imx_resolution const *res, u32 w, u32 h, - bool keep_ratio) -{ - unsigned int w_ratio; - unsigned int h_ratio; - int match; - unsigned int allowed_ratio_mismatch = LARGEST_ALLOWED_RATIO_MISMATCH; - - if (!keep_ratio) - allowed_ratio_mismatch = ~0; - - if (w == 0) - return -1; - w_ratio = (res->width << 13) / w; - if (h == 0) - return -1; - h_ratio = (res->height << 13) / h; - if (h_ratio == 0) - return -1; - match = abs(((w_ratio << 13) / h_ratio) - ((int)8192)); - - if ((w_ratio < (int)8192) || (h_ratio < (int)8192) || - (match > allowed_ratio_mismatch)) - return -1; - - return w_ratio + h_ratio; -} - -/* Return the nearest higher resolution index */ -static int nearest_resolution_index(struct v4l2_subdev *sd, int w, int h) -{ - int i; - int idx = -1; - int dist; - int fps_diff; - int min_fps_diff = INT_MAX; - int min_dist = INT_MAX; - const struct imx_resolution *tmp_res = NULL; - struct imx_device *dev = to_imx_sensor(sd); - bool again = 1; -retry: - for (i = 0; i < dev->entries_curr_table; i++) { - tmp_res = &dev->curr_res_table[i]; - dist = distance(tmp_res, w, h, again); - if (dist == -1) - continue; - if (dist < min_dist) { - min_dist = dist; - idx = i; - } - if (dist == min_dist) { - fps_diff = __imx_min_fps_diff(dev->targetfps, - tmp_res->fps_options); - if (fps_diff < min_fps_diff) { - min_fps_diff = fps_diff; - idx = i; - } - } - } - - /* - * FIXME! - * only IMX135 for Saltbay and IMX227 use this algorithm - */ - if (idx == -1 && again == true && dev->new_res_sel_method) { - again = false; - goto retry; - } - return idx; -} - -/* Call with ctrl_handler.lock hold */ -static int __adjust_hvblank(struct v4l2_subdev *sd) -{ - struct i2c_client *client = v4l2_get_subdevdata(sd); - struct imx_device *dev = to_imx_sensor(sd); - u16 new_frame_length_lines, new_line_length_pck; - int ret; - - /* - * No need to adjust h/v blank if not set dbg value - * Note that there is no other checking on the h/v blank value, - * as h/v blank can be set to any value above zero for debug purpose - */ - if (!dev->v_blank->val || !dev->h_blank->val) - return 0; - - new_frame_length_lines = dev->curr_res_table[dev->fmt_idx].height + - dev->v_blank->val; - new_line_length_pck = dev->curr_res_table[dev->fmt_idx].width + - dev->h_blank->val; - - ret = imx_write_reg(client, IMX_16BIT, - dev->reg_addr->line_length_pixels, new_line_length_pck); - if (ret) - return ret; - ret = imx_write_reg(client, IMX_16BIT, - dev->reg_addr->frame_length_lines, new_frame_length_lines); - if (ret) - return ret; - - dev->lines_per_frame = new_frame_length_lines; - dev->pixels_per_line = new_line_length_pck; - - return 0; -} - -static int imx_set_fmt(struct v4l2_subdev *sd, - struct v4l2_subdev_pad_config *cfg, - struct v4l2_subdev_format *format) -{ - struct v4l2_mbus_framefmt *fmt = &format->format; - struct imx_device *dev = to_imx_sensor(sd); - struct camera_mipi_info *imx_info = NULL; - struct i2c_client *client = v4l2_get_subdevdata(sd); - const struct imx_resolution *res; - int lanes = imx_get_lanes(sd); - int ret; - u16 data, val; - int idx; - if (format->pad) - return -EINVAL; - if (!fmt) - return -EINVAL; - - imx_info = v4l2_get_subdev_hostdata(sd); - if (imx_info == NULL) - return -EINVAL; - if ((fmt->width > imx_max_res[dev->sensor_id].res_max_width) - || (fmt->height > imx_max_res[dev->sensor_id].res_max_height)) { - fmt->width = imx_max_res[dev->sensor_id].res_max_width; - fmt->height = imx_max_res[dev->sensor_id].res_max_height; - } else { - idx = nearest_resolution_index(sd, fmt->width, fmt->height); - - /* - * nearest_resolution_index() doesn't return smaller - * resolutions. If it fails, it means the requested - * resolution is higher than wecan support. Fallback - * to highest possible resolution in this case. - */ - if (idx == -1) - idx = dev->entries_curr_table - 1; - - fmt->width = dev->curr_res_table[idx].width; - fmt->height = dev->curr_res_table[idx].height; - } - - fmt->code = dev->format.code; - if(format->which == V4L2_SUBDEV_FORMAT_TRY) { - cfg->try_fmt = *fmt; - return 0; - } - mutex_lock(&dev->input_lock); - - dev->fmt_idx = nearest_resolution_index(sd, fmt->width, fmt->height); - if (dev->fmt_idx == -1) { - ret = -EINVAL; - goto out; - } - res = &dev->curr_res_table[dev->fmt_idx]; - - /* Adjust the FPS selection based on the resolution selected */ - dev->fps_index = __imx_nearest_fps_index(dev->targetfps, - res->fps_options); - dev->fps = res->fps_options[dev->fps_index].fps; - dev->regs = res->fps_options[dev->fps_index].regs; - if (!dev->regs) - dev->regs = res->regs; - - ret = imx_write_reg_array(client, dev->regs); - if (ret) - goto out; - - if (dev->sensor_id == IMX132_ID && lanes > 0) { - static const u8 imx132_rgpltd[] = { - 2, /* 1 lane: /1 */ - 0, /* 2 lanes: /2 */ - 0, /* undefined */ - 1, /* 4 lanes: /4 */ - }; - ret = imx_write_reg(client, IMX_8BIT, IMX132_208_VT_RGPLTD, - imx132_rgpltd[lanes - 1]); - if (ret) - goto out; - } - - dev->pixels_per_line = res->fps_options[dev->fps_index].pixels_per_line; - dev->lines_per_frame = res->fps_options[dev->fps_index].lines_per_frame; - - /* dbg h/v blank time */ - __adjust_hvblank(sd); - - ret = __imx_update_exposure_timing(client, dev->coarse_itg, - dev->pixels_per_line, dev->lines_per_frame); - if (ret) - goto out; - - ret = __imx_update_gain(sd, dev->gain); - if (ret) - goto out; - - ret = __imx_update_digital_gain(client, dev->digital_gain); - if (ret) - goto out; - - ret = imx_write_reg_array(client, dev->param_update); - if (ret) - goto out; - - ret = imx_get_intg_factor(client, imx_info, dev->regs); - if (ret) - goto out; - - ret = imx_read_reg(client, IMX_8BIT, - dev->reg_addr->img_orientation, &val); - if (ret) - goto out; - val &= (IMX_VFLIP_BIT|IMX_HFLIP_BIT); - imx_info->raw_bayer_order = imx_bayer_order_mapping[val]; - dev->format.code = imx_translate_bayer_order( - imx_info->raw_bayer_order); - - /* - * Fill meta data info. add imx135 metadata setting for RAW10 format - */ - switch (dev->sensor_id) { - case IMX135_ID: - ret = imx_read_reg(client, 2, - IMX135_OUTPUT_DATA_FORMAT_REG, &data); - if (ret) - goto out; - /* - * The IMX135 can support various resolutions like - * RAW6/8/10/12/14. - * 1.The data format is RAW10: - * matadata width = current resolution width(pixel) * 10 / 8 - * 2.The data format is RAW6 or RAW8: - * matadata width = current resolution width(pixel); - * 3.other data format(RAW12/14 etc): - * TBD. - */ - if (data == IMX135_OUTPUT_FORMAT_RAW10) - /* the data format is RAW10. */ - imx_info->metadata_width = res->width * 10 / 8; - else - /* The data format is RAW6/8/12/14/ etc. */ - imx_info->metadata_width = res->width; - - imx_info->metadata_height = IMX135_EMBEDDED_DATA_LINE_NUM; - - if (imx_info->metadata_effective_width == NULL) - imx_info->metadata_effective_width = - imx135_embedded_effective_size; - - break; - case IMX227_ID: - ret = imx_read_reg(client, 2, IMX227_OUTPUT_DATA_FORMAT_REG, - &data); - if (ret) - goto out; - if (data == IMX227_OUTPUT_FORMAT_RAW10) - /* the data format is RAW10. */ - imx_info->metadata_width = res->width * 10 / 8; - else - /* The data format is RAW6/8/12/14/ etc. */ - imx_info->metadata_width = res->width; - - imx_info->metadata_height = IMX227_EMBEDDED_DATA_LINE_NUM; - - if (imx_info->metadata_effective_width == NULL) - imx_info->metadata_effective_width = - imx227_embedded_effective_size; - - break; - default: - imx_info->metadata_width = 0; - imx_info->metadata_height = 0; - imx_info->metadata_effective_width = NULL; - break; - } - -out: - mutex_unlock(&dev->input_lock); - return ret; -} - - -static int imx_get_fmt(struct v4l2_subdev *sd, - struct v4l2_subdev_pad_config *cfg, - struct v4l2_subdev_format *format) -{ - struct v4l2_mbus_framefmt *fmt = &format->format; - struct imx_device *dev = to_imx_sensor(sd); - - if (format->pad) - return -EINVAL; - if (!fmt) - return -EINVAL; - - mutex_lock(&dev->input_lock); - fmt->width = dev->curr_res_table[dev->fmt_idx].width; - fmt->height = dev->curr_res_table[dev->fmt_idx].height; - fmt->code = dev->format.code; - mutex_unlock(&dev->input_lock); - return 0; -} - -static int imx_detect(struct i2c_client *client, u16 *id, u8 *revision) -{ - struct i2c_adapter *adapter = client->adapter; - - /* i2c check */ - if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) - return -ENODEV; - - /* check sensor chip ID */ - if (imx_read_reg(client, IMX_16BIT, IMX132_175_208_219_CHIP_ID, id)) { - v4l2_err(client, "sensor_id = 0x%x\n", *id); - return -ENODEV; - } - - if (*id == IMX132_ID || *id == IMX175_ID || - *id == IMX208_ID || *id == IMX219_ID) - goto found; - - if (imx_read_reg(client, IMX_16BIT, IMX134_135_227_CHIP_ID, id)) { - v4l2_err(client, "sensor_id = 0x%x\n", *id); - return -ENODEV; - } - if (*id != IMX134_ID && *id != IMX135_ID && *id != IMX227_ID) { - v4l2_err(client, "no imx sensor found\n"); - return -ENODEV; - } -found: - v4l2_info(client, "sensor_id = 0x%x\n", *id); - - /* TODO - need to be updated */ - *revision = 0; - - return 0; -} - -static void __imx_print_timing(struct v4l2_subdev *sd) -{ - struct imx_device *dev = to_imx_sensor(sd); - struct i2c_client *client = v4l2_get_subdevdata(sd); - u16 width = dev->curr_res_table[dev->fmt_idx].width; - u16 height = dev->curr_res_table[dev->fmt_idx].height; - - dev_dbg(&client->dev, "Dump imx timing in stream on:\n"); - dev_dbg(&client->dev, "width: %d:\n", width); - dev_dbg(&client->dev, "height: %d:\n", height); - dev_dbg(&client->dev, "pixels_per_line: %d:\n", dev->pixels_per_line); - dev_dbg(&client->dev, "line per frame: %d:\n", dev->lines_per_frame); - dev_dbg(&client->dev, "pix freq: %d:\n", dev->vt_pix_clk_freq_mhz); - dev_dbg(&client->dev, "init fps: %d:\n", dev->vt_pix_clk_freq_mhz / - dev->pixels_per_line / dev->lines_per_frame); - dev_dbg(&client->dev, "HBlank: %d nS:\n", - 1000 * (dev->pixels_per_line - width) / - (dev->vt_pix_clk_freq_mhz / 1000000)); - dev_dbg(&client->dev, "VBlank: %d uS:\n", - (dev->lines_per_frame - height) * dev->pixels_per_line / - (dev->vt_pix_clk_freq_mhz / 1000000)); -} - -/* - * imx stream on/off - */ -static int imx_s_stream(struct v4l2_subdev *sd, int enable) -{ - int ret; - struct i2c_client *client = v4l2_get_subdevdata(sd); - struct imx_device *dev = to_imx_sensor(sd); - - mutex_lock(&dev->input_lock); - if (enable) { - /* Noise reduction & dead pixel applied before streaming */ - if (dev->fw == NULL) { - dev_warn(&client->dev, "No MSR loaded from library"); - } else { - ret = apply_msr_data(client, dev->fw); - if (ret) { - mutex_unlock(&dev->input_lock); - return ret; - } - } - ret = imx_test_pattern(sd); - if (ret) { - v4l2_err(client, "Configure test pattern failed.\n"); - mutex_unlock(&dev->input_lock); - return ret; - } - __imx_print_timing(sd); - ret = imx_write_reg_array(client, imx_streaming); - if (ret != 0) { - v4l2_err(client, "write_reg_array err\n"); - mutex_unlock(&dev->input_lock); - return ret; - } - dev->streaming = 1; - if (dev->vcm_driver && dev->vcm_driver->t_focus_abs_init) - dev->vcm_driver->t_focus_abs_init(sd); - } else { - ret = imx_write_reg_array(client, imx_soft_standby); - if (ret != 0) { - v4l2_err(client, "write_reg_array err\n"); - mutex_unlock(&dev->input_lock); - return ret; - } - dev->streaming = 0; - dev->targetfps = 0; - } - mutex_unlock(&dev->input_lock); - - return 0; -} - -static int __update_imx_device_settings(struct imx_device *dev, u16 sensor_id) -{ - /* IMX on other platform is not supported yet */ - return -EINVAL; -} - -static int imx_s_config(struct v4l2_subdev *sd, - int irq, void *pdata) -{ - struct imx_device *dev = to_imx_sensor(sd); - struct i2c_client *client = v4l2_get_subdevdata(sd); - u8 sensor_revision; - u16 sensor_id; - int ret; - if (pdata == NULL) - return -ENODEV; - - dev->platform_data = pdata; - - mutex_lock(&dev->input_lock); - - if (dev->platform_data->platform_init) { - ret = dev->platform_data->platform_init(client); - if (ret) { - mutex_unlock(&dev->input_lock); - dev_err(&client->dev, "imx platform init err\n"); - return ret; - } - } - /* - * power off the module first. - * - * As first power on by board have undecided state of power/gpio pins. - */ - ret = __imx_s_power(sd, 0); - if (ret) { - v4l2_err(client, "imx power-down err.\n"); - mutex_unlock(&dev->input_lock); - return ret; - } - - ret = __imx_s_power(sd, 1); - if (ret) { - v4l2_err(client, "imx power-up err.\n"); - mutex_unlock(&dev->input_lock); - return ret; - } - - ret = dev->platform_data->csi_cfg(sd, 1); - if (ret) - goto fail_csi_cfg; - - /* config & detect sensor */ - ret = imx_detect(client, &sensor_id, &sensor_revision); - if (ret) { - v4l2_err(client, "imx_detect err s_config.\n"); - goto fail_detect; - } - - dev->sensor_id = sensor_id; - dev->sensor_revision = sensor_revision; - - /* Resolution settings depend on sensor type and platform */ - ret = __update_imx_device_settings(dev, dev->sensor_id); - if (ret) - goto fail_detect; - /* Read sensor's OTP data */ - dev->otp_data = dev->otp_driver->otp_read(sd, - dev->otp_driver->dev_addr, dev->otp_driver->start_addr, - dev->otp_driver->size); - - /* power off sensor */ - ret = __imx_s_power(sd, 0); - - mutex_unlock(&dev->input_lock); - if (ret) - v4l2_err(client, "imx power-down err.\n"); - - return ret; - -fail_detect: - dev->platform_data->csi_cfg(sd, 0); -fail_csi_cfg: - __imx_s_power(sd, 0); - if (dev->platform_data->platform_deinit) - dev->platform_data->platform_deinit(); - mutex_unlock(&dev->input_lock); - dev_err(&client->dev, "sensor power-gating failed\n"); - return ret; -} - -static int -imx_enum_mbus_code(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, - struct v4l2_subdev_mbus_code_enum *code) -{ - struct imx_device *dev = to_imx_sensor(sd); - if (code->index >= MAX_FMTS) - return -EINVAL; - - mutex_lock(&dev->input_lock); - code->code = dev->format.code; - mutex_unlock(&dev->input_lock); - return 0; -} - -static int -imx_enum_frame_size(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, - struct v4l2_subdev_frame_size_enum *fse) -{ - int index = fse->index; - struct imx_device *dev = to_imx_sensor(sd); - - mutex_lock(&dev->input_lock); - if (index >= dev->entries_curr_table) { - mutex_unlock(&dev->input_lock); - return -EINVAL; - } - - fse->min_width = dev->curr_res_table[index].width; - fse->min_height = dev->curr_res_table[index].height; - fse->max_width = dev->curr_res_table[index].width; - fse->max_height = dev->curr_res_table[index].height; - mutex_unlock(&dev->input_lock); - return 0; -} - -static int -imx_s_parm(struct v4l2_subdev *sd, struct v4l2_streamparm *param) -{ - struct imx_device *dev = to_imx_sensor(sd); - - mutex_lock(&dev->input_lock); - dev->run_mode = param->parm.capture.capturemode; - - switch (dev->run_mode) { - case CI_MODE_VIDEO: - dev->curr_res_table = dev->mode_tables->res_video; - dev->entries_curr_table = dev->mode_tables->n_res_video; - break; - case CI_MODE_STILL_CAPTURE: - dev->curr_res_table = dev->mode_tables->res_still; - dev->entries_curr_table = dev->mode_tables->n_res_still; - break; - default: - dev->curr_res_table = dev->mode_tables->res_preview; - dev->entries_curr_table = dev->mode_tables->n_res_preview; - } - mutex_unlock(&dev->input_lock); - return 0; -} - -static int imx_g_frame_interval(struct v4l2_subdev *sd, - struct v4l2_subdev_frame_interval *interval) -{ - struct imx_device *dev = to_imx_sensor(sd); - - mutex_lock(&dev->input_lock); - interval->interval.denominator = dev->fps; - interval->interval.numerator = 1; - mutex_unlock(&dev->input_lock); - return 0; -} - -static int __imx_s_frame_interval(struct v4l2_subdev *sd, - struct v4l2_subdev_frame_interval *interval) -{ - struct imx_device *dev = to_imx_sensor(sd); - struct i2c_client *client = v4l2_get_subdevdata(sd); - const struct imx_resolution *res = - &dev->curr_res_table[dev->fmt_idx]; - struct camera_mipi_info *imx_info = NULL; - unsigned short pixels_per_line; - unsigned short lines_per_frame; - unsigned int fps_index; - int fps; - int ret = 0; - - - imx_info = v4l2_get_subdev_hostdata(sd); - if (imx_info == NULL) - return -EINVAL; - - if (!interval->interval.numerator) - interval->interval.numerator = 1; - - fps = interval->interval.denominator / interval->interval.numerator; - - if (!fps) - return -EINVAL; - - dev->targetfps = fps; - /* No need to proceed further if we are not streaming */ - if (!dev->streaming) - return 0; - - /* Ignore if we are already using the required FPS. */ - if (fps == dev->fps) - return 0; - - /* - * Start here, sensor is already streaming, so adjust fps dynamically - */ - fps_index = __imx_above_nearest_fps_index(fps, res->fps_options); - if (fps > res->fps_options[fps_index].fps) { - /* - * if does not have high fps setting, not support increase fps - * by adjust lines per frame. - */ - dev_err(&client->dev, "Could not support fps: %d.\n", fps); - return -EINVAL; - } - - if (res->fps_options[fps_index].regs && - res->fps_options[fps_index].regs != dev->regs) { - /* - * if need a new setting, but the new setting has difference - * with current setting, not use this one, as may have - * unexpected result, e.g. PLL, IQ. - */ - dev_dbg(&client->dev, - "Sensor is streaming, not apply new sensor setting\n"); - if (fps > res->fps_options[dev->fps_index].fps) { - /* - * Does not support increase fps based on low fps - * setting, as the high fps setting could not be used, - * and fps requested is above current setting fps. - */ - dev_warn(&client->dev, - "Could not support fps: %d, keep current: %d.\n", - fps, dev->fps); - return 0; - } - } else { - dev->fps_index = fps_index; - dev->fps = res->fps_options[dev->fps_index].fps; - } - - /* Update the new frametimings based on FPS */ - pixels_per_line = res->fps_options[dev->fps_index].pixels_per_line; - lines_per_frame = res->fps_options[dev->fps_index].lines_per_frame; - - if (fps > res->fps_options[fps_index].fps) { - /* - * if does not have high fps setting, not support increase fps - * by adjust lines per frame. - */ - dev_warn(&client->dev, "Could not support fps: %d. Use:%d.\n", - fps, res->fps_options[fps_index].fps); - goto done; - } - - /* if the new setting does not match exactly */ - if (dev->fps != fps) { -#define MAX_LINES_PER_FRAME 0xffff - dev_dbg(&client->dev, "adjusting fps using lines_per_frame\n"); - /* - * FIXME! - * 1: check DS on max value of lines_per_frame - * 2: consider use pixel per line for more range? - */ - if (dev->lines_per_frame * dev->fps / fps > - MAX_LINES_PER_FRAME) { - dev_warn(&client->dev, - "adjust lines_per_frame out of range, try to use max value.\n"); - lines_per_frame = MAX_LINES_PER_FRAME; - } else { - lines_per_frame = lines_per_frame * dev->fps / fps; - } - } -done: - /* Update the new frametimings based on FPS */ - dev->pixels_per_line = pixels_per_line; - dev->lines_per_frame = lines_per_frame; - - /* Update the new values so that user side knows the current settings */ - ret = __imx_update_exposure_timing(client, - dev->coarse_itg, dev->pixels_per_line, dev->lines_per_frame); - if (ret) - return ret; - - dev->fps = fps; - - ret = imx_get_intg_factor(client, imx_info, dev->regs); - if (ret) - return ret; - - interval->interval.denominator = res->fps_options[dev->fps_index].fps; - interval->interval.numerator = 1; - __imx_print_timing(sd); - - return ret; -} - -static int imx_s_frame_interval(struct v4l2_subdev *sd, - struct v4l2_subdev_frame_interval *interval) -{ - struct imx_device *dev = to_imx_sensor(sd); - int ret; - - mutex_lock(&dev->input_lock); - ret = __imx_s_frame_interval(sd, interval); - mutex_unlock(&dev->input_lock); - - return ret; -} -static int imx_g_skip_frames(struct v4l2_subdev *sd, u32 *frames) -{ - struct imx_device *dev = to_imx_sensor(sd); - - mutex_lock(&dev->input_lock); - *frames = dev->curr_res_table[dev->fmt_idx].skip_frames; - mutex_unlock(&dev->input_lock); - - return 0; -} - -static const struct v4l2_subdev_sensor_ops imx_sensor_ops = { - .g_skip_frames = imx_g_skip_frames, -}; - -static const struct v4l2_subdev_video_ops imx_video_ops = { - .s_stream = imx_s_stream, - .s_parm = imx_s_parm, - .g_frame_interval = imx_g_frame_interval, - .s_frame_interval = imx_s_frame_interval, -}; - -static const struct v4l2_subdev_core_ops imx_core_ops = { - .s_power = imx_s_power, - .ioctl = imx_ioctl, - .init = imx_init, -}; - -static const struct v4l2_subdev_pad_ops imx_pad_ops = { - .enum_mbus_code = imx_enum_mbus_code, - .enum_frame_size = imx_enum_frame_size, - .get_fmt = imx_get_fmt, - .set_fmt = imx_set_fmt, -}; - -static const struct v4l2_subdev_ops imx_ops = { - .core = &imx_core_ops, - .video = &imx_video_ops, - .pad = &imx_pad_ops, - .sensor = &imx_sensor_ops, -}; - -static const struct media_entity_operations imx_entity_ops = { - .link_setup = NULL, -}; - -static int imx_remove(struct i2c_client *client) -{ - struct v4l2_subdev *sd = i2c_get_clientdata(client); - struct imx_device *dev = to_imx_sensor(sd); - - if (dev->platform_data->platform_deinit) - dev->platform_data->platform_deinit(); - - media_entity_cleanup(&dev->sd.entity); - v4l2_ctrl_handler_free(&dev->ctrl_handler); - dev->platform_data->csi_cfg(sd, 0); - v4l2_device_unregister_subdev(sd); - release_msr_list(client, dev->fw); - kfree(dev); - - return 0; -} - -static int __imx_init_ctrl_handler(struct imx_device *dev) -{ - struct v4l2_ctrl_handler *hdl; - int i; - - hdl = &dev->ctrl_handler; - - v4l2_ctrl_handler_init(&dev->ctrl_handler, ARRAY_SIZE(imx_controls)); - - for (i = 0; i < ARRAY_SIZE(imx_controls); i++) - v4l2_ctrl_new_custom(&dev->ctrl_handler, - &imx_controls[i], NULL); - - dev->pixel_rate = v4l2_ctrl_find(&dev->ctrl_handler, - V4L2_CID_PIXEL_RATE); - dev->h_blank = v4l2_ctrl_find(&dev->ctrl_handler, - V4L2_CID_HBLANK); - dev->v_blank = v4l2_ctrl_find(&dev->ctrl_handler, - V4L2_CID_VBLANK); - dev->link_freq = v4l2_ctrl_find(&dev->ctrl_handler, - V4L2_CID_LINK_FREQ); - dev->h_flip = v4l2_ctrl_find(&dev->ctrl_handler, - V4L2_CID_HFLIP); - dev->v_flip = v4l2_ctrl_find(&dev->ctrl_handler, - V4L2_CID_VFLIP); - dev->tp_mode = v4l2_ctrl_find(&dev->ctrl_handler, - V4L2_CID_TEST_PATTERN); - dev->tp_r = v4l2_ctrl_find(&dev->ctrl_handler, - V4L2_CID_TEST_PATTERN_COLOR_R); - dev->tp_gr = v4l2_ctrl_find(&dev->ctrl_handler, - V4L2_CID_TEST_PATTERN_COLOR_GR); - dev->tp_gb = v4l2_ctrl_find(&dev->ctrl_handler, - V4L2_CID_TEST_PATTERN_COLOR_GB); - dev->tp_b = v4l2_ctrl_find(&dev->ctrl_handler, - V4L2_CID_TEST_PATTERN_COLOR_B); - - if (dev->ctrl_handler.error || dev->pixel_rate == NULL - || dev->h_blank == NULL || dev->v_blank == NULL - || dev->h_flip == NULL || dev->v_flip == NULL - || dev->link_freq == NULL) { - return dev->ctrl_handler.error; - } - - dev->ctrl_handler.lock = &dev->input_lock; - dev->sd.ctrl_handler = hdl; - v4l2_ctrl_handler_setup(&dev->ctrl_handler); - - return 0; -} - -static void imx_update_reg_info(struct imx_device *dev) -{ - if (dev->sensor_id == IMX219_ID) { - dev->reg_addr = &imx219_addr; - dev->param_hold = imx219_param_hold; - dev->param_update = imx219_param_update; - } else { - dev->reg_addr = &imx_addr; - dev->param_hold = imx_param_hold; - dev->param_update = imx_param_update; - } -} - -static int imx_probe(struct i2c_client *client, - const struct i2c_device_id *id) -{ - struct imx_device *dev; - struct camera_mipi_info *imx_info = NULL; - int ret; - char *msr_file_name = NULL; - - /* allocate sensor device & init sub device */ - dev = kzalloc(sizeof(*dev), GFP_KERNEL); - if (!dev) { - v4l2_err(client, "%s: out of memory\n", __func__); - return -ENOMEM; - } - - mutex_init(&dev->input_lock); - - dev->i2c_id = id->driver_data; - dev->fmt_idx = 0; - dev->sensor_id = IMX_ID_DEFAULT; - dev->vcm_driver = &imx_vcms[IMX_ID_DEFAULT]; - dev->digital_gain = 256; - - v4l2_i2c_subdev_init(&(dev->sd), client, &imx_ops); - - if (client->dev.platform_data) { - ret = imx_s_config(&dev->sd, client->irq, - client->dev.platform_data); - if (ret) - goto out_free; - } - imx_info = v4l2_get_subdev_hostdata(&dev->sd); - - /* - * sd->name is updated with sensor driver name by the v4l2. - * change it to sensor name in this case. - */ - imx_update_reg_info(dev); - snprintf(dev->sd.name, sizeof(dev->sd.name), "%s%x %d-%04x", - IMX_SUBDEV_PREFIX, dev->sensor_id, - i2c_adapter_id(client->adapter), client->addr); - - ret = __imx_init_ctrl_handler(dev); - if (ret) - goto out_ctrl_handler_free; - - dev->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; - dev->pad.flags = MEDIA_PAD_FL_SOURCE; - dev->format.code = imx_translate_bayer_order( - imx_info->raw_bayer_order); - dev->sd.entity.ops = &imx_entity_ops; - dev->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR; - - ret = media_entity_pads_init(&dev->sd.entity, 1, &dev->pad); - if (ret) { - imx_remove(client); - return ret; - } - - /* Load the Noise reduction, Dead pixel registers from cpf file*/ - if (dev->platform_data->msr_file_name != NULL) - msr_file_name = dev->platform_data->msr_file_name(); - if (msr_file_name) { - ret = load_msr_list(client, msr_file_name, &dev->fw); - if (ret) { - imx_remove(client); - return ret; - } - } else { - dev_warn(&client->dev, "Drvb file not present"); - } - - return ret; - -out_ctrl_handler_free: - v4l2_ctrl_handler_free(&dev->ctrl_handler); - -out_free: - v4l2_device_unregister_subdev(&dev->sd); - kfree(dev); - return ret; -} - -static const struct i2c_device_id imx_ids[] = { - {IMX_NAME_175, IMX175_ID}, - {IMX_NAME_135, IMX135_ID}, - {IMX_NAME_135_FUJI, IMX135_FUJI_ID}, - {IMX_NAME_134, IMX134_ID}, - {IMX_NAME_132, IMX132_ID}, - {IMX_NAME_208, IMX208_ID}, - {IMX_NAME_219, IMX219_ID}, - {IMX_NAME_227, IMX227_ID}, - {} -}; - -MODULE_DEVICE_TABLE(i2c, imx_ids); - -static struct i2c_driver imx_driver = { - .driver = { - .name = IMX_DRIVER, - }, - .probe = imx_probe, - .remove = imx_remove, - .id_table = imx_ids, -}; - -static __init int init_imx(void) -{ - return i2c_add_driver(&imx_driver); -} - -static __exit void exit_imx(void) -{ - i2c_del_driver(&imx_driver); -} - -module_init(init_imx); -module_exit(exit_imx); - -MODULE_DESCRIPTION("A low-level driver for Sony IMX sensors"); -MODULE_AUTHOR("Shenbo Huang <shenbo.huang@intel.com>"); -MODULE_LICENSE("GPL"); - diff --git a/drivers/staging/media/atomisp/i2c/imx/imx.h b/drivers/staging/media/atomisp/i2c/imx/imx.h deleted file mode 100644 index 30beb2a0ed93..000000000000 --- a/drivers/staging/media/atomisp/i2c/imx/imx.h +++ /dev/null @@ -1,737 +0,0 @@ -/* - * Support for Sony IMX camera sensor. - * - * Copyright (c) 2010 Intel Corporation. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. - * - */ - -#ifndef __IMX_H__ -#define __IMX_H__ -#include "../../include/linux/atomisp_platform.h" -#include "../../include/linux/atomisp.h" -#include <linux/delay.h> -#include <linux/i2c.h> -#include <linux/kernel.h> -#include <linux/spinlock.h> -#include <linux/types.h> -#include <linux/videodev2.h> -#include <linux/v4l2-mediabus.h> -#include <media/media-entity.h> -#include <media/v4l2-ctrls.h> -#include <media/v4l2-device.h> -#include <media/v4l2-subdev.h> -#include "imx175.h" -#include "imx135.h" -#include "imx134.h" -#include "imx132.h" -#include "imx208.h" -#include "imx219.h" -#include "imx227.h" - -#define IMX_MCLK 192 - -/* TODO - This should be added into include/linux/videodev2.h */ -#ifndef V4L2_IDENT_IMX -#define V4L2_IDENT_IMX 8245 -#endif - -#define IMX_MAX_AE_LUT_LENGTH 5 -/* - * imx System control registers - */ -#define IMX_MASK_5BIT 0x1F -#define IMX_MASK_4BIT 0xF -#define IMX_MASK_3BIT 0x7 -#define IMX_MASK_2BIT 0x3 -#define IMX_MASK_8BIT 0xFF -#define IMX_MASK_11BIT 0x7FF -#define IMX_INTG_BUF_COUNT 2 - -#define IMX_FINE_INTG_TIME 0x1E8 - -#define IMX_VT_PIX_CLK_DIV 0x0301 -#define IMX_VT_SYS_CLK_DIV 0x0303 -#define IMX_PRE_PLL_CLK_DIV 0x0305 -#define IMX227_IOP_PRE_PLL_CLK_DIV 0x030D -#define IMX227_PLL_MULTIPLIER 0x0306 -#define IMX227_IOP_PLL_MULTIPLIER 0x030E -#define IMX227_PLL_MULTI_DRIVE 0x0310 -#define IMX227_OP_PIX_CLK_DIV 0x0309 -#define IMX227_OP_SYS_CLK_DIV 0x030B -#define IMX_PLL_MULTIPLIER 0x030C -#define IMX_OP_PIX_DIV 0x0309 -#define IMX_OP_SYS_DIV 0x030B -#define IMX_FRAME_LENGTH_LINES 0x0340 -#define IMX_LINE_LENGTH_PIXELS 0x0342 -#define IMX_COARSE_INTG_TIME_MIN 0x1004 -#define IMX_COARSE_INTG_TIME_MAX 0x1006 -#define IMX_BINNING_ENABLE 0x0390 -#define IMX227_BINNING_ENABLE 0x0900 -#define IMX_BINNING_TYPE 0x0391 -#define IMX227_BINNING_TYPE 0x0901 -#define IMX_READ_MODE 0x0390 -#define IMX227_READ_MODE 0x0900 - -#define IMX_HORIZONTAL_START_H 0x0344 -#define IMX_VERTICAL_START_H 0x0346 -#define IMX_HORIZONTAL_END_H 0x0348 -#define IMX_VERTICAL_END_H 0x034a -#define IMX_HORIZONTAL_OUTPUT_SIZE_H 0x034c -#define IMX_VERTICAL_OUTPUT_SIZE_H 0x034e - -/* Post Divider setting register for imx132 and imx208 */ -#define IMX132_208_VT_RGPLTD 0x30A4 - -/* Multiplier setting register for imx132, imx208, and imx219 */ -#define IMX132_208_219_PLL_MULTIPLIER 0x0306 - -#define IMX_COARSE_INTEGRATION_TIME 0x0202 -#define IMX_TEST_PATTERN_MODE 0x0600 -#define IMX_TEST_PATTERN_COLOR_R 0x0602 -#define IMX_TEST_PATTERN_COLOR_GR 0x0604 -#define IMX_TEST_PATTERN_COLOR_B 0x0606 -#define IMX_TEST_PATTERN_COLOR_GB 0x0608 -#define IMX_IMG_ORIENTATION 0x0101 -#define IMX_VFLIP_BIT 2 -#define IMX_HFLIP_BIT 1 -#define IMX_GLOBAL_GAIN 0x0205 -#define IMX_SHORT_AGC_GAIN 0x0233 -#define IMX_DGC_ADJ 0x020E -#define IMX_DGC_LEN 10 -#define IMX227_DGC_LEN 4 -#define IMX_MAX_EXPOSURE_SUPPORTED 0xfffb -#define IMX_MAX_GLOBAL_GAIN_SUPPORTED 0x00ff -#define IMX_MAX_DIGITAL_GAIN_SUPPORTED 0x0fff - -#define MAX_FMTS 1 -#define IMX_OTP_DATA_SIZE 1280 - -#define IMX_SUBDEV_PREFIX "imx" -#define IMX_DRIVER "imx1x5" - -/* Sensor ids from identification register */ -#define IMX_NAME_134 "imx134" -#define IMX_NAME_135 "imx135" -#define IMX_NAME_175 "imx175" -#define IMX_NAME_132 "imx132" -#define IMX_NAME_208 "imx208" -#define IMX_NAME_219 "imx219" -#define IMX_NAME_227 "imx227" -#define IMX175_ID 0x0175 -#define IMX135_ID 0x0135 -#define IMX134_ID 0x0134 -#define IMX132_ID 0x0132 -#define IMX208_ID 0x0208 -#define IMX219_ID 0x0219 -#define IMX227_ID 0x0227 - -/* Sensor id based on i2c_device_id table - * (Fuji module can not be detected based on sensor registers) */ -#define IMX135_FUJI_ID 0x0136 -#define IMX_NAME_135_FUJI "imx135fuji" - -/* imx175 - use dw9714 vcm */ -#define IMX175_MERRFLD 0x175 -#define IMX175_VALLEYVIEW 0x176 -#define IMX135_SALTBAY 0x135 -#define IMX135_VICTORIABAY 0x136 -#define IMX132_SALTBAY 0x132 -#define IMX134_VALLEYVIEW 0x134 -#define IMX208_MOFD_PD2 0x208 -#define IMX219_MFV0_PRH 0x219 -#define IMX227_SAND 0x227 - -/* otp - specific settings */ -#define E2PROM_ADDR 0xa0 -#define E2PROM_LITEON_12P1BA869D_ADDR 0xa0 -#define E2PROM_ABICO_SS89A839_ADDR 0xa8 -#define DEFAULT_OTP_SIZE 1280 -#define IMX135_OTP_SIZE 1280 -#define IMX219_OTP_SIZE 2048 -#define IMX227_OTP_SIZE 2560 -#define E2PROM_LITEON_12P1BA869D_SIZE 544 - -#define IMX_ID_DEFAULT 0x0000 -#define IMX132_175_208_219_CHIP_ID 0x0000 -#define IMX134_135_CHIP_ID 0x0016 -#define IMX134_135_227_CHIP_ID 0x0016 - -#define IMX175_RES_WIDTH_MAX 3280 -#define IMX175_RES_HEIGHT_MAX 2464 -#define IMX135_RES_WIDTH_MAX 4208 -#define IMX135_RES_HEIGHT_MAX 3120 -#define IMX132_RES_WIDTH_MAX 1936 -#define IMX132_RES_HEIGHT_MAX 1096 -#define IMX134_RES_WIDTH_MAX 3280 -#define IMX134_RES_HEIGHT_MAX 2464 -#define IMX208_RES_WIDTH_MAX 1936 -#define IMX208_RES_HEIGHT_MAX 1096 -#define IMX219_RES_WIDTH_MAX 3280 -#define IMX219_RES_HEIGHT_MAX 2464 -#define IMX227_RES_WIDTH_MAX 2400 -#define IMX227_RES_HEIGHT_MAX 2720 - -/* Defines for lens/VCM */ -#define IMX_FOCAL_LENGTH_NUM 369 /*3.69mm*/ -#define IMX_FOCAL_LENGTH_DEM 100 -#define IMX_F_NUMBER_DEFAULT_NUM 22 -#define IMX_F_NUMBER_DEM 10 -#define IMX_INVALID_CONFIG 0xffffffff -#define IMX_MAX_FOCUS_POS 1023 -#define IMX_MAX_FOCUS_NEG (-1023) -#define IMX_VCM_SLEW_STEP_MAX 0x3f -#define IMX_VCM_SLEW_TIME_MAX 0x1f - -#define IMX_BIN_FACTOR_MAX 4 -#define IMX_INTEGRATION_TIME_MARGIN 4 -/* - * focal length bits definition: - * bits 31-16: numerator, bits 15-0: denominator - */ -#define IMX_FOCAL_LENGTH_DEFAULT 0x1710064 - -/* - * current f-number bits definition: - * bits 31-16: numerator, bits 15-0: denominator - */ -#define IMX_F_NUMBER_DEFAULT 0x16000a - -/* - * f-number range bits definition: - * bits 31-24: max f-number numerator - * bits 23-16: max f-number denominator - * bits 15-8: min f-number numerator - * bits 7-0: min f-number denominator - */ -#define IMX_F_NUMBER_RANGE 0x160a160a - -struct imx_vcm { - int (*power_up)(struct v4l2_subdev *sd); - int (*power_down)(struct v4l2_subdev *sd); - int (*t_focus_abs)(struct v4l2_subdev *sd, s32 value); - int (*t_focus_abs_init)(struct v4l2_subdev *sd); - int (*t_focus_rel)(struct v4l2_subdev *sd, s32 value); - int (*q_focus_status)(struct v4l2_subdev *sd, s32 *value); - int (*q_focus_abs)(struct v4l2_subdev *sd, s32 *value); - int (*t_vcm_slew)(struct v4l2_subdev *sd, s32 value); - int (*t_vcm_timing)(struct v4l2_subdev *sd, s32 value); -}; - -struct imx_otp { - void * (*otp_read)(struct v4l2_subdev *sd, u8 dev_addr, - u32 start_addr, u32 size); - u32 start_addr; - u32 size; - u8 dev_addr; -}; - -struct max_res { - int res_max_width; - int res_max_height; -}; - -struct max_res imx_max_res[] = { - [IMX175_ID] = { - .res_max_width = IMX175_RES_WIDTH_MAX, - .res_max_height = IMX175_RES_HEIGHT_MAX, - }, - [IMX135_ID] = { - .res_max_width = IMX135_RES_WIDTH_MAX, - .res_max_height = IMX135_RES_HEIGHT_MAX, - }, - [IMX132_ID] = { - .res_max_width = IMX132_RES_WIDTH_MAX, - .res_max_height = IMX132_RES_HEIGHT_MAX, - }, - [IMX134_ID] = { - .res_max_width = IMX134_RES_WIDTH_MAX, - .res_max_height = IMX134_RES_HEIGHT_MAX, - }, - [IMX208_ID] = { - .res_max_width = IMX208_RES_WIDTH_MAX, - .res_max_height = IMX208_RES_HEIGHT_MAX, - }, - [IMX219_ID] = { - .res_max_width = IMX219_RES_WIDTH_MAX, - .res_max_height = IMX219_RES_HEIGHT_MAX, - }, - [IMX227_ID] = { - .res_max_width = IMX227_RES_WIDTH_MAX, - .res_max_height = IMX227_RES_HEIGHT_MAX, - }, -}; - -struct imx_settings { - struct imx_reg const *init_settings; - struct imx_resolution *res_preview; - struct imx_resolution *res_still; - struct imx_resolution *res_video; - int n_res_preview; - int n_res_still; - int n_res_video; -}; - -struct imx_settings imx_sets[] = { - [IMX175_MERRFLD] = { - .init_settings = imx175_init_settings, - .res_preview = imx175_res_preview, - .res_still = imx175_res_still, - .res_video = imx175_res_video, - .n_res_preview = ARRAY_SIZE(imx175_res_preview), - .n_res_still = ARRAY_SIZE(imx175_res_still), - .n_res_video = ARRAY_SIZE(imx175_res_video), - }, - [IMX175_VALLEYVIEW] = { - .init_settings = imx175_init_settings, - .res_preview = imx175_res_preview, - .res_still = imx175_res_still, - .res_video = imx175_res_video, - .n_res_preview = ARRAY_SIZE(imx175_res_preview), - .n_res_still = ARRAY_SIZE(imx175_res_still), - .n_res_video = ARRAY_SIZE(imx175_res_video), - }, - [IMX135_SALTBAY] = { - .init_settings = imx135_init_settings, - .res_preview = imx135_res_preview, - .res_still = imx135_res_still, - .res_video = imx135_res_video, - .n_res_preview = ARRAY_SIZE(imx135_res_preview), - .n_res_still = ARRAY_SIZE(imx135_res_still), - .n_res_video = ARRAY_SIZE(imx135_res_video), - }, - [IMX135_VICTORIABAY] = { - .init_settings = imx135_init_settings, - .res_preview = imx135_res_preview_mofd, - .res_still = imx135_res_still_mofd, - .res_video = imx135_res_video, - .n_res_preview = ARRAY_SIZE(imx135_res_preview_mofd), - .n_res_still = ARRAY_SIZE(imx135_res_still_mofd), - .n_res_video = ARRAY_SIZE(imx135_res_video), - }, - [IMX132_SALTBAY] = { - .init_settings = imx132_init_settings, - .res_preview = imx132_res_preview, - .res_still = imx132_res_still, - .res_video = imx132_res_video, - .n_res_preview = ARRAY_SIZE(imx132_res_preview), - .n_res_still = ARRAY_SIZE(imx132_res_still), - .n_res_video = ARRAY_SIZE(imx132_res_video), - }, - [IMX134_VALLEYVIEW] = { - .init_settings = imx134_init_settings, - .res_preview = imx134_res_preview, - .res_still = imx134_res_still, - .res_video = imx134_res_video, - .n_res_preview = ARRAY_SIZE(imx134_res_preview), - .n_res_still = ARRAY_SIZE(imx134_res_still), - .n_res_video = ARRAY_SIZE(imx134_res_video), - }, - [IMX208_MOFD_PD2] = { - .init_settings = imx208_init_settings, - .res_preview = imx208_res_preview, - .res_still = imx208_res_still, - .res_video = imx208_res_video, - .n_res_preview = ARRAY_SIZE(imx208_res_preview), - .n_res_still = ARRAY_SIZE(imx208_res_still), - .n_res_video = ARRAY_SIZE(imx208_res_video), - }, - [IMX219_MFV0_PRH] = { - .init_settings = imx219_init_settings, - .res_preview = imx219_res_preview, - .res_still = imx219_res_still, - .res_video = imx219_res_video, - .n_res_preview = ARRAY_SIZE(imx219_res_preview), - .n_res_still = ARRAY_SIZE(imx219_res_still), - .n_res_video = ARRAY_SIZE(imx219_res_video), - }, - [IMX227_SAND] = { - .init_settings = imx227_init_settings, - .res_preview = imx227_res_preview, - .res_still = imx227_res_still, - .res_video = imx227_res_video, - .n_res_preview = ARRAY_SIZE(imx227_res_preview), - .n_res_still = ARRAY_SIZE(imx227_res_still), - .n_res_video = ARRAY_SIZE(imx227_res_video), - }, -}; - -struct imx_reg_addr { - u16 frame_length_lines; - u16 line_length_pixels; - u16 horizontal_start_h; - u16 vertical_start_h; - u16 horizontal_end_h; - u16 vertical_end_h; - u16 horizontal_output_size_h; - u16 vertical_output_size_h; - u16 coarse_integration_time; - u16 img_orientation; - u16 global_gain; - u16 dgc_adj; -}; - -struct imx_reg_addr imx_addr = { - IMX_FRAME_LENGTH_LINES, - IMX_LINE_LENGTH_PIXELS, - IMX_HORIZONTAL_START_H, - IMX_VERTICAL_START_H, - IMX_HORIZONTAL_END_H, - IMX_VERTICAL_END_H, - IMX_HORIZONTAL_OUTPUT_SIZE_H, - IMX_VERTICAL_OUTPUT_SIZE_H, - IMX_COARSE_INTEGRATION_TIME, - IMX_IMG_ORIENTATION, - IMX_GLOBAL_GAIN, - IMX_DGC_ADJ, -}; - -struct imx_reg_addr imx219_addr = { - IMX219_FRAME_LENGTH_LINES, - IMX219_LINE_LENGTH_PIXELS, - IMX219_HORIZONTAL_START_H, - IMX219_VERTICAL_START_H, - IMX219_HORIZONTAL_END_H, - IMX219_VERTICAL_END_H, - IMX219_HORIZONTAL_OUTPUT_SIZE_H, - IMX219_VERTICAL_OUTPUT_SIZE_H, - IMX219_COARSE_INTEGRATION_TIME, - IMX219_IMG_ORIENTATION, - IMX219_GLOBAL_GAIN, - IMX219_DGC_ADJ, -}; - -#define v4l2_format_capture_type_entry(_width, _height, \ - _pixelformat, _bytesperline, _colorspace) \ - {\ - .type = V4L2_BUF_TYPE_VIDEO_CAPTURE,\ - .fmt.pix.width = (_width),\ - .fmt.pix.height = (_height),\ - .fmt.pix.pixelformat = (_pixelformat),\ - .fmt.pix.bytesperline = (_bytesperline),\ - .fmt.pix.colorspace = (_colorspace),\ - .fmt.pix.sizeimage = (_height)*(_bytesperline),\ - } - -#define s_output_format_entry(_width, _height, _pixelformat, \ - _bytesperline, _colorspace, _fps) \ - {\ - .v4l2_fmt = v4l2_format_capture_type_entry(_width, \ - _height, _pixelformat, _bytesperline, \ - _colorspace),\ - .fps = (_fps),\ - } - -#define s_output_format_reg_entry(_width, _height, _pixelformat, \ - _bytesperline, _colorspace, _fps, _reg_setting) \ - {\ - .s_fmt = s_output_format_entry(_width, _height,\ - _pixelformat, _bytesperline, \ - _colorspace, _fps),\ - .reg_setting = (_reg_setting),\ - } - -/* imx device structure */ -struct imx_device { - struct v4l2_subdev sd; - struct media_pad pad; - struct v4l2_mbus_framefmt format; - struct camera_sensor_platform_data *platform_data; - struct mutex input_lock; /* serialize sensor's ioctl */ - int fmt_idx; - int status; - int streaming; - int power; - int run_mode; - int vt_pix_clk_freq_mhz; - int fps_index; - u32 focus; - u16 sensor_id; /* Sensor id from registers */ - u16 i2c_id; /* Sensor id from i2c_device_id */ - u16 coarse_itg; - u16 fine_itg; - u16 digital_gain; - u16 gain; - u16 pixels_per_line; - u16 lines_per_frame; - u8 targetfps; - u8 fps; - const struct imx_reg *regs; - u8 res; - u8 type; - u8 sensor_revision; - u8 *otp_data; - struct imx_settings *mode_tables; - struct imx_vcm *vcm_driver; - struct imx_otp *otp_driver; - const struct imx_resolution *curr_res_table; - unsigned long entries_curr_table; - const struct firmware *fw; - struct imx_reg_addr *reg_addr; - const struct imx_reg *param_hold; - const struct imx_reg *param_update; - - /* used for h/b blank tuning */ - struct v4l2_ctrl_handler ctrl_handler; - struct v4l2_ctrl *pixel_rate; - struct v4l2_ctrl *h_blank; - struct v4l2_ctrl *v_blank; - struct v4l2_ctrl *link_freq; - struct v4l2_ctrl *h_flip; - struct v4l2_ctrl *v_flip; - - /* Test pattern control */ - struct v4l2_ctrl *tp_mode; - struct v4l2_ctrl *tp_r; - struct v4l2_ctrl *tp_gr; - struct v4l2_ctrl *tp_gb; - struct v4l2_ctrl *tp_b; - - /* FIXME! */ - bool new_res_sel_method; -}; - -#define to_imx_sensor(x) container_of(x, struct imx_device, sd) - -#define IMX_MAX_WRITE_BUF_SIZE 32 -struct imx_write_buffer { - u16 addr; - u8 data[IMX_MAX_WRITE_BUF_SIZE]; -}; - -struct imx_write_ctrl { - int index; - struct imx_write_buffer buffer; -}; - -static const struct imx_reg imx_soft_standby[] = { - {IMX_8BIT, 0x0100, 0x00}, - {IMX_TOK_TERM, 0, 0} -}; - -static const struct imx_reg imx_streaming[] = { - {IMX_8BIT, 0x0100, 0x01}, - {IMX_TOK_TERM, 0, 0} -}; - -static const struct imx_reg imx_param_hold[] = { - {IMX_8BIT, 0x0104, 0x01}, /* GROUPED_PARAMETER_HOLD */ - {IMX_TOK_TERM, 0, 0} -}; - -static const struct imx_reg imx_param_update[] = { - {IMX_8BIT, 0x0104, 0x00}, /* GROUPED_PARAMETER_HOLD */ - {IMX_TOK_TERM, 0, 0} -}; - -static const struct imx_reg imx219_param_hold[] = { - {IMX_TOK_TERM, 0, 0} -}; - -static const struct imx_reg imx219_param_update[] = { - {IMX_TOK_TERM, 0, 0} -}; - -extern int ad5816g_vcm_power_up(struct v4l2_subdev *sd); -extern int ad5816g_vcm_power_down(struct v4l2_subdev *sd); -extern int ad5816g_t_focus_abs(struct v4l2_subdev *sd, s32 value); -extern int ad5816g_t_focus_rel(struct v4l2_subdev *sd, s32 value); -extern int ad5816g_q_focus_status(struct v4l2_subdev *sd, s32 *value); -extern int ad5816g_q_focus_abs(struct v4l2_subdev *sd, s32 *value); -extern int ad5816g_t_vcm_slew(struct v4l2_subdev *sd, s32 value); -extern int ad5816g_t_vcm_timing(struct v4l2_subdev *sd, s32 value); - -extern int drv201_vcm_power_up(struct v4l2_subdev *sd); -extern int drv201_vcm_power_down(struct v4l2_subdev *sd); -extern int drv201_t_focus_abs(struct v4l2_subdev *sd, s32 value); -extern int drv201_t_focus_rel(struct v4l2_subdev *sd, s32 value); -extern int drv201_q_focus_status(struct v4l2_subdev *sd, s32 *value); -extern int drv201_q_focus_abs(struct v4l2_subdev *sd, s32 *value); -extern int drv201_t_vcm_slew(struct v4l2_subdev *sd, s32 value); -extern int drv201_t_vcm_timing(struct v4l2_subdev *sd, s32 value); - -extern int dw9714_vcm_power_up(struct v4l2_subdev *sd); -extern int dw9714_vcm_power_down(struct v4l2_subdev *sd); -extern int dw9714_t_focus_abs(struct v4l2_subdev *sd, s32 value); -extern int dw9714_t_focus_abs_init(struct v4l2_subdev *sd); -extern int dw9714_t_focus_rel(struct v4l2_subdev *sd, s32 value); -extern int dw9714_q_focus_status(struct v4l2_subdev *sd, s32 *value); -extern int dw9714_q_focus_abs(struct v4l2_subdev *sd, s32 *value); -extern int dw9714_t_vcm_slew(struct v4l2_subdev *sd, s32 value); -extern int dw9714_t_vcm_timing(struct v4l2_subdev *sd, s32 value); - -extern int dw9719_vcm_power_up(struct v4l2_subdev *sd); -extern int dw9719_vcm_power_down(struct v4l2_subdev *sd); -extern int dw9719_t_focus_abs(struct v4l2_subdev *sd, s32 value); -extern int dw9719_t_focus_rel(struct v4l2_subdev *sd, s32 value); -extern int dw9719_q_focus_status(struct v4l2_subdev *sd, s32 *value); -extern int dw9719_q_focus_abs(struct v4l2_subdev *sd, s32 *value); -extern int dw9719_t_vcm_slew(struct v4l2_subdev *sd, s32 value); -extern int dw9719_t_vcm_timing(struct v4l2_subdev *sd, s32 value); - -extern int dw9718_vcm_power_up(struct v4l2_subdev *sd); -extern int dw9718_vcm_power_down(struct v4l2_subdev *sd); -extern int dw9718_t_focus_abs(struct v4l2_subdev *sd, s32 value); -extern int dw9718_t_focus_rel(struct v4l2_subdev *sd, s32 value); -extern int dw9718_q_focus_status(struct v4l2_subdev *sd, s32 *value); -extern int dw9718_q_focus_abs(struct v4l2_subdev *sd, s32 *value); -extern int dw9718_t_vcm_slew(struct v4l2_subdev *sd, s32 value); -extern int dw9718_t_vcm_timing(struct v4l2_subdev *sd, s32 value); - -extern int vcm_power_up(struct v4l2_subdev *sd); -extern int vcm_power_down(struct v4l2_subdev *sd); - -struct imx_vcm imx_vcms[] = { - [IMX175_MERRFLD] = { - .power_up = drv201_vcm_power_up, - .power_down = drv201_vcm_power_down, - .t_focus_abs = drv201_t_focus_abs, - .t_focus_abs_init = NULL, - .t_focus_rel = drv201_t_focus_rel, - .q_focus_status = drv201_q_focus_status, - .q_focus_abs = drv201_q_focus_abs, - .t_vcm_slew = drv201_t_vcm_slew, - .t_vcm_timing = drv201_t_vcm_timing, - }, - [IMX175_VALLEYVIEW] = { - .power_up = dw9714_vcm_power_up, - .power_down = dw9714_vcm_power_down, - .t_focus_abs = dw9714_t_focus_abs, - .t_focus_abs_init = NULL, - .t_focus_rel = dw9714_t_focus_rel, - .q_focus_status = dw9714_q_focus_status, - .q_focus_abs = dw9714_q_focus_abs, - .t_vcm_slew = dw9714_t_vcm_slew, - .t_vcm_timing = dw9714_t_vcm_timing, - }, - [IMX135_SALTBAY] = { - .power_up = ad5816g_vcm_power_up, - .power_down = ad5816g_vcm_power_down, - .t_focus_abs = ad5816g_t_focus_abs, - .t_focus_abs_init = NULL, - .t_focus_rel = ad5816g_t_focus_rel, - .q_focus_status = ad5816g_q_focus_status, - .q_focus_abs = ad5816g_q_focus_abs, - .t_vcm_slew = ad5816g_t_vcm_slew, - .t_vcm_timing = ad5816g_t_vcm_timing, - }, - [IMX135_VICTORIABAY] = { - .power_up = dw9719_vcm_power_up, - .power_down = dw9719_vcm_power_down, - .t_focus_abs = dw9719_t_focus_abs, - .t_focus_abs_init = NULL, - .t_focus_rel = dw9719_t_focus_rel, - .q_focus_status = dw9719_q_focus_status, - .q_focus_abs = dw9719_q_focus_abs, - .t_vcm_slew = dw9719_t_vcm_slew, - .t_vcm_timing = dw9719_t_vcm_timing, - }, - [IMX134_VALLEYVIEW] = { - .power_up = dw9714_vcm_power_up, - .power_down = dw9714_vcm_power_down, - .t_focus_abs = dw9714_t_focus_abs, - .t_focus_abs_init = dw9714_t_focus_abs_init, - .t_focus_rel = dw9714_t_focus_rel, - .q_focus_status = dw9714_q_focus_status, - .q_focus_abs = dw9714_q_focus_abs, - .t_vcm_slew = dw9714_t_vcm_slew, - .t_vcm_timing = dw9714_t_vcm_timing, - }, - [IMX219_MFV0_PRH] = { - .power_up = dw9718_vcm_power_up, - .power_down = dw9718_vcm_power_down, - .t_focus_abs = dw9718_t_focus_abs, - .t_focus_abs_init = NULL, - .t_focus_rel = dw9718_t_focus_rel, - .q_focus_status = dw9718_q_focus_status, - .q_focus_abs = dw9718_q_focus_abs, - .t_vcm_slew = dw9718_t_vcm_slew, - .t_vcm_timing = dw9718_t_vcm_timing, - }, - [IMX_ID_DEFAULT] = { - .power_up = NULL, - .power_down = NULL, - .t_focus_abs_init = NULL, - }, -}; - -extern void *dummy_otp_read(struct v4l2_subdev *sd, u8 dev_addr, - u32 start_addr, u32 size); -extern void *imx_otp_read(struct v4l2_subdev *sd, u8 dev_addr, - u32 start_addr, u32 size); -extern void *e2prom_otp_read(struct v4l2_subdev *sd, u8 dev_addr, - u32 start_addr, u32 size); -extern void *brcc064_otp_read(struct v4l2_subdev *sd, u8 dev_addr, - u32 start_addr, u32 size); -extern void *imx227_otp_read(struct v4l2_subdev *sd, u8 dev_addr, - u32 start_addr, u32 size); -extern void *e2prom_otp_read(struct v4l2_subdev *sd, u8 dev_addr, - u32 start_addr, u32 size); -struct imx_otp imx_otps[] = { - [IMX175_MERRFLD] = { - .otp_read = imx_otp_read, - .dev_addr = E2PROM_ADDR, - .start_addr = 0, - .size = DEFAULT_OTP_SIZE, - }, - [IMX175_VALLEYVIEW] = { - .otp_read = e2prom_otp_read, - .dev_addr = E2PROM_ABICO_SS89A839_ADDR, - .start_addr = E2PROM_2ADDR, - .size = DEFAULT_OTP_SIZE, - }, - [IMX135_SALTBAY] = { - .otp_read = e2prom_otp_read, - .dev_addr = E2PROM_ADDR, - .start_addr = 0, - .size = DEFAULT_OTP_SIZE, - }, - [IMX135_VICTORIABAY] = { - .otp_read = imx_otp_read, - .size = DEFAULT_OTP_SIZE, - }, - [IMX134_VALLEYVIEW] = { - .otp_read = e2prom_otp_read, - .dev_addr = E2PROM_LITEON_12P1BA869D_ADDR, - .start_addr = 0, - .size = E2PROM_LITEON_12P1BA869D_SIZE, - }, - [IMX132_SALTBAY] = { - .otp_read = dummy_otp_read, - .size = DEFAULT_OTP_SIZE, - }, - [IMX208_MOFD_PD2] = { - .otp_read = dummy_otp_read, - .size = DEFAULT_OTP_SIZE, - }, - [IMX219_MFV0_PRH] = { - .otp_read = brcc064_otp_read, - .dev_addr = E2PROM_ADDR, - .start_addr = 0, - .size = IMX219_OTP_SIZE, - }, - [IMX227_SAND] = { - .otp_read = imx227_otp_read, - .size = IMX227_OTP_SIZE, - }, - [IMX_ID_DEFAULT] = { - .otp_read = dummy_otp_read, - .size = DEFAULT_OTP_SIZE, - }, -}; - -#endif - diff --git a/drivers/staging/media/atomisp/i2c/imx/imx132.h b/drivers/staging/media/atomisp/i2c/imx/imx132.h deleted file mode 100644 index 98f047b8a1ba..000000000000 --- a/drivers/staging/media/atomisp/i2c/imx/imx132.h +++ /dev/null @@ -1,566 +0,0 @@ -/* - * Support for Sony IMX camera sensor. - * - * Copyright (c) 2013 Intel Corporation. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. - * - */ - -#ifndef __IMX132_H__ -#define __IMX132_H__ -#include "common.h" - -/********************** registers define ********************************/ -#define IMX132_RGLANESEL 0x3301 /* Number of lanes */ -#define IMX132_RGLANESEL_1LANE 0x01 -#define IMX132_RGLANESEL_2LANES 0x00 -#define IMX132_RGLANESEL_4LANES 0x03 - -#define IMX132_2LANES_GAINFACT 2096 /* 524/256 * 2^10 */ -#define IMX132_2LANES_GAINFACT_SHIFT 10 - -/********************** settings for imx from vendor*********************/ -static struct imx_reg imx132_1080p_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - /* Global Settings */ - {IMX_8BIT, 0x3087, 0x53}, - {IMX_8BIT, 0x308B, 0x5A}, - {IMX_8BIT, 0x3094, 0x11}, - {IMX_8BIT, 0x309D, 0xA4}, - {IMX_8BIT, 0x30AA, 0x01}, - {IMX_8BIT, 0x30C6, 0x00}, - {IMX_8BIT, 0x30C7, 0x00}, - {IMX_8BIT, 0x3118, 0x2F}, - {IMX_8BIT, 0x312A, 0x00}, - {IMX_8BIT, 0x312B, 0x0B}, - {IMX_8BIT, 0x312C, 0x0B}, - {IMX_8BIT, 0x312D, 0x13}, - /* PLL setting */ - {IMX_8BIT, 0x0305, 0x02}, - {IMX_8BIT, 0x0307, 0x50}, - {IMX_8BIT, 0x30A4, 0x02}, - {IMX_8BIT, 0x303C, 0x3C}, - /* Mode setting */ - {IMX_8BIT, 0x0344, 0x00}, - {IMX_8BIT, 0x0345, 0x14}, - {IMX_8BIT, 0x0346, 0x00}, - {IMX_8BIT, 0x0347, 0x32}, - {IMX_8BIT, 0x0348, 0x07}, - {IMX_8BIT, 0x0349, 0xA3}, - {IMX_8BIT, 0x034A, 0x04}, - {IMX_8BIT, 0x034B, 0x79}, - {IMX_8BIT, 0x034C, 0x07}, - {IMX_8BIT, 0x034D, 0x90}, - {IMX_8BIT, 0x034E, 0x04}, - {IMX_8BIT, 0x034F, 0x48}, - {IMX_8BIT, 0x0381, 0x01}, - {IMX_8BIT, 0x0383, 0x01}, - {IMX_8BIT, 0x0385, 0x01}, - {IMX_8BIT, 0x0387, 0x01}, - {IMX_8BIT, 0x303D, 0x10}, - {IMX_8BIT, 0x303E, 0x5A}, - {IMX_8BIT, 0x3040, 0x00}, - {IMX_8BIT, 0x3041, 0x00}, - {IMX_8BIT, 0x3048, 0x00}, - {IMX_8BIT, 0x304C, 0x2F}, - {IMX_8BIT, 0x304D, 0x02}, - {IMX_8BIT, 0x3064, 0x92}, - {IMX_8BIT, 0x306A, 0x10}, - {IMX_8BIT, 0x309B, 0x00}, - {IMX_8BIT, 0x309E, 0x41}, - {IMX_8BIT, 0x30A0, 0x10}, - {IMX_8BIT, 0x30A1, 0x0B}, - {IMX_8BIT, 0x30B2, 0x00}, - {IMX_8BIT, 0x30D5, 0x00}, - {IMX_8BIT, 0x30D6, 0x00}, - {IMX_8BIT, 0x30D7, 0x00}, - {IMX_8BIT, 0x30D8, 0x00}, - {IMX_8BIT, 0x30D9, 0x00}, - {IMX_8BIT, 0x30DA, 0x00}, - {IMX_8BIT, 0x30DB, 0x00}, - {IMX_8BIT, 0x30DC, 0x00}, - {IMX_8BIT, 0x30DD, 0x00}, - {IMX_8BIT, 0x30DE, 0x00}, - {IMX_8BIT, 0x3102, 0x0C}, - {IMX_8BIT, 0x3103, 0x33}, - {IMX_8BIT, 0x3104, 0x18}, - {IMX_8BIT, 0x3105, 0x00}, - {IMX_8BIT, 0x3106, 0x65}, - {IMX_8BIT, 0x3107, 0x00}, - {IMX_8BIT, 0x3108, 0x06}, - {IMX_8BIT, 0x3109, 0x04}, - {IMX_8BIT, 0x310A, 0x04}, - {IMX_8BIT, 0x315C, 0x3D}, - {IMX_8BIT, 0x315D, 0x3C}, - {IMX_8BIT, 0x316E, 0x3E}, - {IMX_8BIT, 0x316F, 0x3D}, - /* Global timing */ - {IMX_8BIT, 0x3304, 0x07}, /* RGTLPX[5:0] TLPX */ - {IMX_8BIT, 0x3305, 0x06}, /* RGTCLKPREPARE[3:0] TCLK-PREPARE */ - {IMX_8BIT, 0x3306, 0x19}, /* RGTCLKZERO[5:0] TCLK-ZERO */ - {IMX_8BIT, 0x3307, 0x03}, /* RGTCLKPRE[5:0] TCLK-PRE */ - {IMX_8BIT, 0x3308, 0x0F}, /* RGTCLKPOST[5:0] TCLK-POST */ - {IMX_8BIT, 0x3309, 0x07}, /* RGTCLKTRAIL[3:0] TCLK-TRAIL */ - {IMX_8BIT, 0x330A, 0x0C}, /* RGTHSEXIT[5:0] THS-EXIT */ - {IMX_8BIT, 0x330B, 0x06}, /* RGTHSPREPARE[3:0] THS-PREPARE */ - {IMX_8BIT, 0x330C, 0x0B}, /* RGTHSZERO[5:0] THS-ZERO */ - {IMX_8BIT, 0x330D, 0x07}, /* RGTHSTRAIL[3:0] THS-TRAIL */ - {IMX_8BIT, 0x330E, 0x03}, - {IMX_8BIT, 0x3318, 0x62}, - {IMX_8BIT, 0x3322, 0x09}, - {IMX_8BIT, 0x3342, 0x00}, - {IMX_8BIT, 0x3348, 0xE0}, - - {IMX_TOK_TERM, 0, 0}, -}; - -static struct imx_reg imx132_1456x1096_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - /* Global Settings */ - {IMX_8BIT, 0x3087, 0x53}, - {IMX_8BIT, 0x308B, 0x5A}, - {IMX_8BIT, 0x3094, 0x11}, - {IMX_8BIT, 0x309D, 0xA4}, - {IMX_8BIT, 0x30AA, 0x01}, - {IMX_8BIT, 0x30C6, 0x00}, - {IMX_8BIT, 0x30C7, 0x00}, - {IMX_8BIT, 0x3118, 0x2F}, - {IMX_8BIT, 0x312A, 0x00}, - {IMX_8BIT, 0x312B, 0x0B}, - {IMX_8BIT, 0x312C, 0x0B}, - {IMX_8BIT, 0x312D, 0x13}, - /* PLL setting */ - {IMX_8BIT, 0x0305, 0x02}, - {IMX_8BIT, 0x0307, 0x50}, - {IMX_8BIT, 0x30A4, 0x02}, - {IMX_8BIT, 0x303C, 0x3C}, - /* Mode setting */ - {IMX_8BIT, 0x0344, 0x01}, - {IMX_8BIT, 0x0345, 0x04}, - {IMX_8BIT, 0x0346, 0x00}, - {IMX_8BIT, 0x0347, 0x32}, - {IMX_8BIT, 0x0348, 0x06}, - {IMX_8BIT, 0x0349, 0xB3}, - {IMX_8BIT, 0x034A, 0x04}, - {IMX_8BIT, 0x034B, 0x79}, - {IMX_8BIT, 0x034C, 0x05}, - {IMX_8BIT, 0x034D, 0xB0}, - {IMX_8BIT, 0x034E, 0x04}, - {IMX_8BIT, 0x034F, 0x48}, - {IMX_8BIT, 0x0381, 0x01}, - {IMX_8BIT, 0x0383, 0x01}, - {IMX_8BIT, 0x0385, 0x01}, - {IMX_8BIT, 0x0387, 0x01}, - {IMX_8BIT, 0x303D, 0x10}, - {IMX_8BIT, 0x303E, 0x5A}, - {IMX_8BIT, 0x3040, 0x00}, - {IMX_8BIT, 0x3041, 0x00}, - {IMX_8BIT, 0x3048, 0x00}, - {IMX_8BIT, 0x304C, 0x2F}, - {IMX_8BIT, 0x304D, 0x02}, - {IMX_8BIT, 0x3064, 0x92}, - {IMX_8BIT, 0x306A, 0x10}, - {IMX_8BIT, 0x309B, 0x00}, - {IMX_8BIT, 0x309E, 0x41}, - {IMX_8BIT, 0x30A0, 0x10}, - {IMX_8BIT, 0x30A1, 0x0B}, - {IMX_8BIT, 0x30B2, 0x00}, - {IMX_8BIT, 0x30D5, 0x00}, - {IMX_8BIT, 0x30D6, 0x00}, - {IMX_8BIT, 0x30D7, 0x00}, - {IMX_8BIT, 0x30D8, 0x00}, - {IMX_8BIT, 0x30D9, 0x00}, - {IMX_8BIT, 0x30DA, 0x00}, - {IMX_8BIT, 0x30DB, 0x00}, - {IMX_8BIT, 0x30DC, 0x00}, - {IMX_8BIT, 0x30DD, 0x00}, - {IMX_8BIT, 0x30DE, 0x00}, - {IMX_8BIT, 0x3102, 0x0C}, - {IMX_8BIT, 0x3103, 0x33}, - {IMX_8BIT, 0x3104, 0x18}, - {IMX_8BIT, 0x3105, 0x00}, - {IMX_8BIT, 0x3106, 0x65}, - {IMX_8BIT, 0x3107, 0x00}, - {IMX_8BIT, 0x3108, 0x06}, - {IMX_8BIT, 0x3109, 0x04}, - {IMX_8BIT, 0x310A, 0x04}, - {IMX_8BIT, 0x315C, 0x3D}, - {IMX_8BIT, 0x315D, 0x3C}, - {IMX_8BIT, 0x316E, 0x3E}, - {IMX_8BIT, 0x316F, 0x3D}, - /* Global timing */ - {IMX_8BIT, 0x3304, 0x07}, /* RGTLPX[5:0] TLPX */ - {IMX_8BIT, 0x3305, 0x06}, /* RGTCLKPREPARE[3:0] TCLK-PREPARE */ - {IMX_8BIT, 0x3306, 0x19}, /* RGTCLKZERO[5:0] TCLK-ZERO */ - {IMX_8BIT, 0x3307, 0x03}, /* RGTCLKPRE[5:0] TCLK-PRE */ - {IMX_8BIT, 0x3308, 0x0F}, /* RGTCLKPOST[5:0] TCLK-POST */ - {IMX_8BIT, 0x3309, 0x07}, /* RGTCLKTRAIL[3:0] TCLK-TRAIL */ - {IMX_8BIT, 0x330A, 0x0C}, /* RGTHSEXIT[5:0] THS-EXIT */ - {IMX_8BIT, 0x330B, 0x06}, /* RGTHSPREPARE[3:0] THS-PREPARE */ - {IMX_8BIT, 0x330C, 0x0B}, /* RGTHSZERO[5:0] THS-ZERO */ - {IMX_8BIT, 0x330D, 0x07}, /* RGTHSTRAIL[3:0] THS-TRAIL */ - {IMX_8BIT, 0x330E, 0x03}, - {IMX_8BIT, 0x3318, 0x62}, - {IMX_8BIT, 0x3322, 0x09}, - {IMX_8BIT, 0x3342, 0x00}, - {IMX_8BIT, 0x3348, 0xE0}, - - {IMX_TOK_TERM, 0, 0}, -}; - -static struct imx_reg imx132_1636x1096_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - /* Global Settings */ - {IMX_8BIT, 0x3087, 0x53}, - {IMX_8BIT, 0x308B, 0x5A}, - {IMX_8BIT, 0x3094, 0x11}, - {IMX_8BIT, 0x309D, 0xA4}, - {IMX_8BIT, 0x30AA, 0x01}, - {IMX_8BIT, 0x30C6, 0x00}, - {IMX_8BIT, 0x30C7, 0x00}, - {IMX_8BIT, 0x3118, 0x2F}, - {IMX_8BIT, 0x312A, 0x00}, - {IMX_8BIT, 0x312B, 0x0B}, - {IMX_8BIT, 0x312C, 0x0B}, - {IMX_8BIT, 0x312D, 0x13}, - /* PLL setting */ - {IMX_8BIT, 0x0305, 0x02}, - {IMX_8BIT, 0x0307, 0x50}, - {IMX_8BIT, 0x30A4, 0x02}, - {IMX_8BIT, 0x303C, 0x3C}, - /* Mode setting */ - {IMX_8BIT, 0x0344, 0x00}, - {IMX_8BIT, 0x0345, 0xAA}, - {IMX_8BIT, 0x0346, 0x00}, - {IMX_8BIT, 0x0347, 0x32}, - {IMX_8BIT, 0x0348, 0x07}, - {IMX_8BIT, 0x0349, 0x0D}, - {IMX_8BIT, 0x034A, 0x04}, - {IMX_8BIT, 0x034B, 0x79}, - {IMX_8BIT, 0x034C, 0x06}, - {IMX_8BIT, 0x034D, 0x64}, - {IMX_8BIT, 0x034E, 0x04}, - {IMX_8BIT, 0x034F, 0x48}, - {IMX_8BIT, 0x0381, 0x01}, - {IMX_8BIT, 0x0383, 0x01}, - {IMX_8BIT, 0x0385, 0x01}, - {IMX_8BIT, 0x0387, 0x01}, - {IMX_8BIT, 0x303D, 0x10}, - {IMX_8BIT, 0x303E, 0x5A}, - {IMX_8BIT, 0x3040, 0x00}, - {IMX_8BIT, 0x3041, 0x00}, - {IMX_8BIT, 0x3048, 0x00}, - {IMX_8BIT, 0x304C, 0x2F}, - {IMX_8BIT, 0x304D, 0x02}, - {IMX_8BIT, 0x3064, 0x92}, - {IMX_8BIT, 0x306A, 0x10}, - {IMX_8BIT, 0x309B, 0x00}, - {IMX_8BIT, 0x309E, 0x41}, - {IMX_8BIT, 0x30A0, 0x10}, - {IMX_8BIT, 0x30A1, 0x0B}, - {IMX_8BIT, 0x30B2, 0x00}, - {IMX_8BIT, 0x30D5, 0x00}, - {IMX_8BIT, 0x30D6, 0x00}, - {IMX_8BIT, 0x30D7, 0x00}, - {IMX_8BIT, 0x30D8, 0x00}, - {IMX_8BIT, 0x30D9, 0x00}, - {IMX_8BIT, 0x30DA, 0x00}, - {IMX_8BIT, 0x30DB, 0x00}, - {IMX_8BIT, 0x30DC, 0x00}, - {IMX_8BIT, 0x30DD, 0x00}, - {IMX_8BIT, 0x30DE, 0x00}, - {IMX_8BIT, 0x3102, 0x0C}, - {IMX_8BIT, 0x3103, 0x33}, - {IMX_8BIT, 0x3104, 0x18}, - {IMX_8BIT, 0x3105, 0x00}, - {IMX_8BIT, 0x3106, 0x65}, - {IMX_8BIT, 0x3107, 0x00}, - {IMX_8BIT, 0x3108, 0x06}, - {IMX_8BIT, 0x3109, 0x04}, - {IMX_8BIT, 0x310A, 0x04}, - {IMX_8BIT, 0x315C, 0x3D}, - {IMX_8BIT, 0x315D, 0x3C}, - {IMX_8BIT, 0x316E, 0x3E}, - {IMX_8BIT, 0x316F, 0x3D}, - /* Global timing */ - {IMX_8BIT, 0x3304, 0x07}, /* RGTLPX[5:0] TLPX */ - {IMX_8BIT, 0x3305, 0x06}, /* RGTCLKPREPARE[3:0] TCLK-PREPARE */ - {IMX_8BIT, 0x3306, 0x19}, /* RGTCLKZERO[5:0] TCLK-ZERO */ - {IMX_8BIT, 0x3307, 0x03}, /* RGTCLKPRE[5:0] TCLK-PRE */ - {IMX_8BIT, 0x3308, 0x0F}, /* RGTCLKPOST[5:0] TCLK-POST */ - {IMX_8BIT, 0x3309, 0x07}, /* RGTCLKTRAIL[3:0] TCLK-TRAIL */ - {IMX_8BIT, 0x330A, 0x0C}, /* RGTHSEXIT[5:0] THS-EXIT */ - {IMX_8BIT, 0x330B, 0x06}, /* RGTHSPREPARE[3:0] THS-PREPARE */ - {IMX_8BIT, 0x330C, 0x0B}, /* RGTHSZERO[5:0] THS-ZERO */ - {IMX_8BIT, 0x330D, 0x07}, /* RGTHSTRAIL[3:0] THS-TRAIL */ - {IMX_8BIT, 0x330E, 0x03}, - {IMX_8BIT, 0x3318, 0x62}, - {IMX_8BIT, 0x3322, 0x09}, - {IMX_8BIT, 0x3342, 0x00}, - {IMX_8BIT, 0x3348, 0xE0}, - - {IMX_TOK_TERM, 0, 0}, -}; - -static struct imx_reg imx132_1336x1096_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - /* Global Settings */ - {IMX_8BIT, 0x3087, 0x53}, - {IMX_8BIT, 0x308B, 0x5A}, - {IMX_8BIT, 0x3094, 0x11}, - {IMX_8BIT, 0x309D, 0xA4}, - {IMX_8BIT, 0x30AA, 0x01}, - {IMX_8BIT, 0x30C6, 0x00}, - {IMX_8BIT, 0x30C7, 0x00}, - {IMX_8BIT, 0x3118, 0x2F}, - {IMX_8BIT, 0x312A, 0x00}, - {IMX_8BIT, 0x312B, 0x0B}, - {IMX_8BIT, 0x312C, 0x0B}, - {IMX_8BIT, 0x312D, 0x13}, - /* PLL setting */ - {IMX_8BIT, 0x0305, 0x02}, - {IMX_8BIT, 0x0307, 0x50}, - {IMX_8BIT, 0x30A4, 0x02}, - {IMX_8BIT, 0x303C, 0x3C}, - /* Mode setting */ - {IMX_8BIT, 0x0344, 0x01}, - {IMX_8BIT, 0x0345, 0x2C}, - {IMX_8BIT, 0x0346, 0x00}, - {IMX_8BIT, 0x0347, 0x32}, - {IMX_8BIT, 0x0348, 0x06}, - {IMX_8BIT, 0x0349, 0x77}, - {IMX_8BIT, 0x034A, 0x04}, - {IMX_8BIT, 0x034B, 0x79}, - {IMX_8BIT, 0x034C, 0x05}, - {IMX_8BIT, 0x034D, 0x38}, - {IMX_8BIT, 0x034E, 0x04}, - {IMX_8BIT, 0x034F, 0x48}, - {IMX_8BIT, 0x0381, 0x01}, - {IMX_8BIT, 0x0383, 0x01}, - {IMX_8BIT, 0x0385, 0x01}, - {IMX_8BIT, 0x0387, 0x01}, - {IMX_8BIT, 0x303D, 0x10}, - {IMX_8BIT, 0x303E, 0x5A}, - {IMX_8BIT, 0x3040, 0x00}, - {IMX_8BIT, 0x3041, 0x00}, - {IMX_8BIT, 0x3048, 0x00}, - {IMX_8BIT, 0x304C, 0x2F}, - {IMX_8BIT, 0x304D, 0x02}, - {IMX_8BIT, 0x3064, 0x92}, - {IMX_8BIT, 0x306A, 0x10}, - {IMX_8BIT, 0x309B, 0x00}, - {IMX_8BIT, 0x309E, 0x41}, - {IMX_8BIT, 0x30A0, 0x10}, - {IMX_8BIT, 0x30A1, 0x0B}, - {IMX_8BIT, 0x30B2, 0x00}, - {IMX_8BIT, 0x30D5, 0x00}, - {IMX_8BIT, 0x30D6, 0x00}, - {IMX_8BIT, 0x30D7, 0x00}, - {IMX_8BIT, 0x30D8, 0x00}, - {IMX_8BIT, 0x30D9, 0x00}, - {IMX_8BIT, 0x30DA, 0x00}, - {IMX_8BIT, 0x30DB, 0x00}, - {IMX_8BIT, 0x30DC, 0x00}, - {IMX_8BIT, 0x30DD, 0x00}, - {IMX_8BIT, 0x30DE, 0x00}, - {IMX_8BIT, 0x3102, 0x0C}, - {IMX_8BIT, 0x3103, 0x33}, - {IMX_8BIT, 0x3104, 0x18}, - {IMX_8BIT, 0x3105, 0x00}, - {IMX_8BIT, 0x3106, 0x65}, - {IMX_8BIT, 0x3107, 0x00}, - {IMX_8BIT, 0x3108, 0x06}, - {IMX_8BIT, 0x3109, 0x04}, - {IMX_8BIT, 0x310A, 0x04}, - {IMX_8BIT, 0x315C, 0x3D}, - {IMX_8BIT, 0x315D, 0x3C}, - {IMX_8BIT, 0x316E, 0x3E}, - {IMX_8BIT, 0x316F, 0x3D}, - /* Global timing */ - {IMX_8BIT, 0x3304, 0x07}, /* RGTLPX[5:0] TLPX */ - {IMX_8BIT, 0x3305, 0x06}, /* RGTCLKPREPARE[3:0] TCLK-PREPARE */ - {IMX_8BIT, 0x3306, 0x19}, /* RGTCLKZERO[5:0] TCLK-ZERO */ - {IMX_8BIT, 0x3307, 0x03}, /* RGTCLKPRE[5:0] TCLK-PRE */ - {IMX_8BIT, 0x3308, 0x0F}, /* RGTCLKPOST[5:0] TCLK-POST */ - {IMX_8BIT, 0x3309, 0x07}, /* RGTCLKTRAIL[3:0] TCLK-TRAIL */ - {IMX_8BIT, 0x330A, 0x0C}, /* RGTHSEXIT[5:0] THS-EXIT */ - {IMX_8BIT, 0x330B, 0x06}, /* RGTHSPREPARE[3:0] THS-PREPARE */ - {IMX_8BIT, 0x330C, 0x0B}, /* RGTHSZERO[5:0] THS-ZERO */ - {IMX_8BIT, 0x330D, 0x07}, /* RGTHSTRAIL[3:0] THS-TRAIL */ - {IMX_8BIT, 0x330E, 0x03}, - {IMX_8BIT, 0x3318, 0x62}, - {IMX_8BIT, 0x3322, 0x09}, - {IMX_8BIT, 0x3342, 0x00}, - {IMX_8BIT, 0x3348, 0xE0}, - - {IMX_TOK_TERM, 0, 0}, -}; - -/********************** settings for imx - reference *********************/ -static struct imx_reg const imx132_init_settings[] = { - /* sw reset */ - { IMX_8BIT, 0x0100, 0x00 }, - { IMX_8BIT, 0x0103, 0x01 }, - { IMX_TOK_DELAY, 0, 5}, - { IMX_8BIT, 0x0103, 0x00 }, - GROUPED_PARAMETER_HOLD_ENABLE, - /* Global Settings */ - {IMX_8BIT, 0x3087, 0x53}, - {IMX_8BIT, 0x308B, 0x5A}, - {IMX_8BIT, 0x3094, 0x11}, - {IMX_8BIT, 0x309D, 0xA4}, - {IMX_8BIT, 0x30AA, 0x01}, - {IMX_8BIT, 0x30C6, 0x00}, - {IMX_8BIT, 0x30C7, 0x00}, - {IMX_8BIT, 0x3118, 0x2F}, - {IMX_8BIT, 0x312A, 0x00}, - {IMX_8BIT, 0x312B, 0x0B}, - {IMX_8BIT, 0x312C, 0x0B}, - {IMX_8BIT, 0x312D, 0x13}, - GROUPED_PARAMETER_HOLD_DISABLE, - { IMX_TOK_TERM, 0, 0} -}; - -struct imx_resolution imx132_res_preview[] = { - { - .desc = "imx132_1080p_30fps", - .regs = imx132_1080p_30fps, - .width = 1936, - .height = 1096, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x08F2, - .lines_per_frame = 0x045C, - }, - { - } - }, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - .skip_frames = 2, - .mipi_freq = 384000, - }, -}; - -struct imx_resolution imx132_res_still[] = { - { - .desc = "imx132_1080p_30fps", - .regs = imx132_1080p_30fps, - .width = 1936, - .height = 1096, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x08F2, - .lines_per_frame = 0x045C, - }, - { - } - }, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - .skip_frames = 2, - .mipi_freq = 384000, - }, -}; - -struct imx_resolution imx132_res_video[] = { - { - .desc = "imx132_1336x1096_30fps", - .regs = imx132_1336x1096_30fps, - .width = 1336, - .height = 1096, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x08F2, - .lines_per_frame = 0x045C, - }, - { - } - }, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - .skip_frames = 2, - .mipi_freq = 384000, - }, - { - .desc = "imx132_1456x1096_30fps", - .regs = imx132_1456x1096_30fps, - .width = 1456, - .height = 1096, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x08F2, - .lines_per_frame = 0x045C, - }, - { - } - }, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - .skip_frames = 2, - .mipi_freq = 384000, - }, - { - .desc = "imx132_1636x1096_30fps", - .regs = imx132_1636x1096_30fps, - .width = 1636, - .height = 1096, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x08F2, - .lines_per_frame = 0x045C, - }, - { - } - }, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - .skip_frames = 2, - .mipi_freq = 384000, - }, - { - .desc = "imx132_1080p_30fps", - .regs = imx132_1080p_30fps, - .width = 1936, - .height = 1096, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x08F2, - .lines_per_frame = 0x045C, - }, - { - } - }, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - .skip_frames = 2, - .mipi_freq = 384000, - }, -}; -#endif - diff --git a/drivers/staging/media/atomisp/i2c/imx/imx134.h b/drivers/staging/media/atomisp/i2c/imx/imx134.h deleted file mode 100644 index 9026e8ba5679..000000000000 --- a/drivers/staging/media/atomisp/i2c/imx/imx134.h +++ /dev/null @@ -1,2465 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __IMX134_H__ -#define __IMX134_H__ - -/********************** imx134 setting - version 1 *********************/ -static struct imx_reg const imx134_init_settings[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - /* Basic settings */ - { IMX_8BIT, 0x0105, 0x01 }, - { IMX_8BIT, 0x0220, 0x01 }, - { IMX_8BIT, 0x3302, 0x11 }, - { IMX_8BIT, 0x3833, 0x20 }, - { IMX_8BIT, 0x3893, 0x00 }, - { IMX_8BIT, 0x3906, 0x08 }, - { IMX_8BIT, 0x3907, 0x01 }, - { IMX_8BIT, 0x391B, 0x01 }, - { IMX_8BIT, 0x3C09, 0x01 }, - { IMX_8BIT, 0x600A, 0x00 }, - - /* Analog settings */ - { IMX_8BIT, 0x3008, 0xB0 }, - { IMX_8BIT, 0x320A, 0x01 }, - { IMX_8BIT, 0x320D, 0x10 }, - { IMX_8BIT, 0x3216, 0x2E }, - { IMX_8BIT, 0x322C, 0x02 }, - { IMX_8BIT, 0x3409, 0x0C }, - { IMX_8BIT, 0x340C, 0x2D }, - { IMX_8BIT, 0x3411, 0x39 }, - { IMX_8BIT, 0x3414, 0x1E }, - { IMX_8BIT, 0x3427, 0x04 }, - { IMX_8BIT, 0x3480, 0x1E }, - { IMX_8BIT, 0x3484, 0x1E }, - { IMX_8BIT, 0x3488, 0x1E }, - { IMX_8BIT, 0x348C, 0x1E }, - { IMX_8BIT, 0x3490, 0x1E }, - { IMX_8BIT, 0x3494, 0x1E }, - { IMX_8BIT, 0x3511, 0x8F }, - { IMX_8BIT, 0x3617, 0x2D }, - - GROUPED_PARAMETER_HOLD_DISABLE, - { IMX_TOK_TERM, 0, 0 } -}; - -/* 4 lane 3280x2464 8M 30fps, vendor provide */ -static struct imx_reg const imx134_8M_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - /* mode set clear */ - { IMX_8BIT, 0x3A43, 0x01 }, - /* clock setting */ - { IMX_8BIT, 0x011E, 0x13 }, - { IMX_8BIT, 0x011F, 0x33 }, - { IMX_8BIT, 0x0301, 0x05 }, - { IMX_8BIT, 0x0303, 0x01 }, - { IMX_8BIT, 0x0305, 0x0C }, - { IMX_8BIT, 0x0309, 0x05 }, - { IMX_8BIT, 0x030B, 0x01 }, - { IMX_8BIT, 0x030C, 0x01 }, - { IMX_8BIT, 0x030D, 0xA9 }, - { IMX_8BIT, 0x030E, 0x01 }, - { IMX_8BIT, 0x3A06, 0x11 }, - - /* Mode setting */ - { IMX_8BIT, 0x0108, 0x03 }, - { IMX_8BIT, 0x0112, 0x0A }, - { IMX_8BIT, 0x0113, 0x0A }, - { IMX_8BIT, 0x0381, 0x01 }, - { IMX_8BIT, 0x0383, 0x01 }, - { IMX_8BIT, 0x0385, 0x01 }, - { IMX_8BIT, 0x0387, 0x01 }, - { IMX_8BIT, 0x0390, 0x00 }, - { IMX_8BIT, 0x0391, 0x11 }, - { IMX_8BIT, 0x0392, 0x00 }, - { IMX_8BIT, 0x0401, 0x00 }, - { IMX_8BIT, 0x0404, 0x00 }, - { IMX_8BIT, 0x0405, 0x10 }, /* down scaling 16/16 = 1 */ - { IMX_8BIT, 0x4082, 0x01 }, - { IMX_8BIT, 0x4083, 0x01 }, - { IMX_8BIT, 0x7006, 0x04 }, - - /* optionnal Function setting */ - { IMX_8BIT, 0x0700, 0x00 }, - { IMX_8BIT, 0x3A63, 0x00 }, - { IMX_8BIT, 0x4100, 0xF8 }, - { IMX_8BIT, 0x4203, 0xFF }, - { IMX_8BIT, 0x4344, 0x00 }, - { IMX_8BIT, 0x441C, 0x01 }, - - /* Size setting */ - { IMX_8BIT, 0x0344, 0x00 }, /* x_addr_start[15:8]:0 */ - { IMX_8BIT, 0x0345, 0x00 }, /* x_addr_start[7:0] */ - { IMX_8BIT, 0x0346, 0x00 }, /* y_addr_start[15:8]:0 */ - { IMX_8BIT, 0x0347, 0x00 }, /* y_addr_start[7:0] */ - { IMX_8BIT, 0x0348, 0x0C }, /* x_addr_end[15:8]:3279 */ - { IMX_8BIT, 0x0349, 0xCF }, /* x_addr_end[7:0] */ - { IMX_8BIT, 0x034A, 0x09 }, /* y_addr_end[15:8]:2463 */ - { IMX_8BIT, 0x034B, 0x9F }, /* y_addr_end[7:0] */ - { IMX_8BIT, 0x034C, 0x0C }, /* x_output_size[15:8]: 3280*/ - { IMX_8BIT, 0x034D, 0xD0 }, /* x_output_size[7:0] */ - { IMX_8BIT, 0x034E, 0x09 }, /* y_output_size[15:8]:2464 */ - { IMX_8BIT, 0x034F, 0xA0 }, /* y_output_size[7:0] */ - { IMX_8BIT, 0x0350, 0x00 }, - { IMX_8BIT, 0x0351, 0x00 }, - { IMX_8BIT, 0x0352, 0x00 }, - { IMX_8BIT, 0x0353, 0x00 }, - { IMX_8BIT, 0x0354, 0x0C }, - { IMX_8BIT, 0x0355, 0xD0 }, - { IMX_8BIT, 0x0356, 0x09 }, - { IMX_8BIT, 0x0357, 0xA0 }, - { IMX_8BIT, 0x301D, 0x30 }, - { IMX_8BIT, 0x3310, 0x0C }, - { IMX_8BIT, 0x3311, 0xD0 }, - { IMX_8BIT, 0x3312, 0x09 }, - { IMX_8BIT, 0x3313, 0xA0 }, - { IMX_8BIT, 0x331C, 0x01 }, - { IMX_8BIT, 0x331D, 0xAE }, - { IMX_8BIT, 0x4084, 0x00 }, - { IMX_8BIT, 0x4085, 0x00 }, - { IMX_8BIT, 0x4086, 0x00 }, - { IMX_8BIT, 0x4087, 0x00 }, - { IMX_8BIT, 0x4400, 0x00 }, - - /* Global timing setting */ - { IMX_8BIT, 0x0830, 0x77 }, - { IMX_8BIT, 0x0831, 0x2F }, - { IMX_8BIT, 0x0832, 0x4F }, - { IMX_8BIT, 0x0833, 0x37 }, - { IMX_8BIT, 0x0834, 0x2F }, - { IMX_8BIT, 0x0835, 0x37 }, - { IMX_8BIT, 0x0836, 0xAF }, - { IMX_8BIT, 0x0837, 0x37 }, - { IMX_8BIT, 0x0839, 0x1F }, - { IMX_8BIT, 0x083A, 0x17 }, - { IMX_8BIT, 0x083B, 0x02 }, - - /* Integration time setting */ - { IMX_8BIT, 0x0202, 0x09 }, - { IMX_8BIT, 0x0203, 0xD2 }, - - /* HDR setting */ - { IMX_8BIT, 0x0230, 0x00 }, - { IMX_8BIT, 0x0231, 0x00 }, - { IMX_8BIT, 0x0233, 0x00 }, - { IMX_8BIT, 0x0234, 0x00 }, - { IMX_8BIT, 0x0235, 0x40 }, - { IMX_8BIT, 0x0238, 0x00 }, - { IMX_8BIT, 0x0239, 0x04 }, - { IMX_8BIT, 0x023B, 0x00 }, - { IMX_8BIT, 0x023C, 0x01 }, - { IMX_8BIT, 0x33B0, 0x04 }, - { IMX_8BIT, 0x33B1, 0x00 }, - { IMX_8BIT, 0x33B3, 0x00 }, - { IMX_8BIT, 0x33B4, 0x01 }, - { IMX_8BIT, 0x3800, 0x00 }, - { IMX_TOK_TERM, 0, 0 } -}; - -/* 4 lane, 1/2 binning 30fps 1640x1232, vendor provide */ -static struct imx_reg const imx134_1640_1232_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - /* mode set clear */ - { IMX_8BIT, 0x3A43, 0x01 }, - /* Clock Setting */ - { IMX_8BIT, 0x011E, 0x13 }, - { IMX_8BIT, 0x011F, 0x33 }, - { IMX_8BIT, 0x0301, 0x05 }, - { IMX_8BIT, 0x0303, 0x01 }, - { IMX_8BIT, 0x0305, 0x0C }, - { IMX_8BIT, 0x0309, 0x05 }, - { IMX_8BIT, 0x030B, 0x01 }, - { IMX_8BIT, 0x030C, 0x01 }, - { IMX_8BIT, 0x030D, 0xA9 }, - { IMX_8BIT, 0x030E, 0x01 }, - { IMX_8BIT, 0x3A06, 0x11 }, - - /* Mode setting */ - { IMX_8BIT, 0x0108, 0x03 }, - { IMX_8BIT, 0x0112, 0x0A }, - { IMX_8BIT, 0x0113, 0x0A }, - { IMX_8BIT, 0x0381, 0x01 }, - { IMX_8BIT, 0x0383, 0x01 }, - { IMX_8BIT, 0x0385, 0x01 }, - { IMX_8BIT, 0x0387, 0x01 }, - { IMX_8BIT, 0x0390, 0x01 }, /* binning */ - { IMX_8BIT, 0x0391, 0x22 }, /* 2x2 binning */ - { IMX_8BIT, 0x0392, 0x00 }, - { IMX_8BIT, 0x0401, 0x00 }, /* no resize */ - { IMX_8BIT, 0x0404, 0x00 }, - { IMX_8BIT, 0x0405, 0x10 }, - { IMX_8BIT, 0x4082, 0x01 }, - { IMX_8BIT, 0x4083, 0x01 }, - { IMX_8BIT, 0x7006, 0x04 }, - - /* Optionnal Function setting */ - { IMX_8BIT, 0x0700, 0x00 }, - { IMX_8BIT, 0x3A63, 0x00 }, - { IMX_8BIT, 0x4100, 0xF8 }, - { IMX_8BIT, 0x4203, 0xFF }, - { IMX_8BIT, 0x4344, 0x00 }, - { IMX_8BIT, 0x441C, 0x01 }, - - /* Size setting */ - { IMX_8BIT, 0x0344, 0x00 }, /* x_addr_start[15:8]:0 */ - { IMX_8BIT, 0x0345, 0x00 }, /* x_addr_start[7:0] */ - { IMX_8BIT, 0x0346, 0x00 }, /* y_addr_start[15:8]:0 */ - { IMX_8BIT, 0x0347, 0x00 }, /* y_addr_start[7:0] */ - { IMX_8BIT, 0x0348, 0x0C }, /* x_addr_end[15:8]:3279 */ - { IMX_8BIT, 0x0349, 0xCF }, /* x_addr_end[7:0] */ - { IMX_8BIT, 0x034A, 0x09 }, /* y_addr_end[15:8]:2463 */ - { IMX_8BIT, 0x034B, 0x9F }, /* y_addr_end[7:0] */ - { IMX_8BIT, 0x034C, 0x06 }, /* x_output_size[15:8]:1640 */ - { IMX_8BIT, 0x034D, 0x68 }, /* x_output_size[7:0] */ - { IMX_8BIT, 0x034E, 0x04 }, /* y_output_size[15:8]:1232 */ - { IMX_8BIT, 0x034F, 0xD0 }, /* y_output_size[7:0] */ - { IMX_8BIT, 0x0350, 0x00 }, - { IMX_8BIT, 0x0351, 0x00 }, - { IMX_8BIT, 0x0352, 0x00 }, - { IMX_8BIT, 0x0353, 0x00 }, - { IMX_8BIT, 0x0354, 0x06 }, - { IMX_8BIT, 0x0355, 0x68 }, - { IMX_8BIT, 0x0356, 0x04 }, - { IMX_8BIT, 0x0357, 0xD0 }, - - { IMX_8BIT, 0x301D, 0x30 }, - - { IMX_8BIT, 0x3310, 0x06 }, - { IMX_8BIT, 0x3311, 0x68 }, - { IMX_8BIT, 0x3312, 0x04 }, - { IMX_8BIT, 0x3313, 0xD0 }, - - { IMX_8BIT, 0x331C, 0x04 }, - { IMX_8BIT, 0x331D, 0x06 }, - { IMX_8BIT, 0x4084, 0x00 }, - { IMX_8BIT, 0x4085, 0x00 }, - { IMX_8BIT, 0x4086, 0x00 }, - { IMX_8BIT, 0x4087, 0x00 }, - { IMX_8BIT, 0x4400, 0x00 }, - - /* Global Timing Setting */ - { IMX_8BIT, 0x0830, 0x77 }, - { IMX_8BIT, 0x0831, 0x2F }, - { IMX_8BIT, 0x0832, 0x4F }, - { IMX_8BIT, 0x0833, 0x37 }, - { IMX_8BIT, 0x0834, 0x2F }, - { IMX_8BIT, 0x0835, 0x37 }, - { IMX_8BIT, 0x0836, 0xAF }, - { IMX_8BIT, 0x0837, 0x37 }, - { IMX_8BIT, 0x0839, 0x1F }, - { IMX_8BIT, 0x083A, 0x17 }, - { IMX_8BIT, 0x083B, 0x02 }, - - /* Integration Time Setting */ - { IMX_8BIT, 0x0202, 0x09 }, - { IMX_8BIT, 0x0203, 0xD2 }, - - /* HDR Setting */ - { IMX_8BIT, 0x0230, 0x00 }, - { IMX_8BIT, 0x0231, 0x00 }, - { IMX_8BIT, 0x0233, 0x00 }, - { IMX_8BIT, 0x0234, 0x00 }, - { IMX_8BIT, 0x0235, 0x40 }, - { IMX_8BIT, 0x0238, 0x00 }, - { IMX_8BIT, 0x0239, 0x04 }, - { IMX_8BIT, 0x023B, 0x00 }, - { IMX_8BIT, 0x023C, 0x01 }, - { IMX_8BIT, 0x33B0, 0x04 }, - { IMX_8BIT, 0x33B1, 0x00 }, - { IMX_8BIT, 0x33B3, 0x00 }, - { IMX_8BIT, 0x33B4, 0x01 }, - { IMX_8BIT, 0x3800, 0x00 }, - { IMX_TOK_TERM, 0, 0 } -}; - -/* 4 lane, 1/4 binning 30fps 820x616, vendor provide */ -static struct imx_reg const imx134_820_616_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - /* mode set clear */ - { IMX_8BIT, 0x3A43, 0x01 }, - /* Clock Setting */ - { IMX_8BIT, 0x011E, 0x13 }, - { IMX_8BIT, 0x011F, 0x33 }, - { IMX_8BIT, 0x0301, 0x05 }, - { IMX_8BIT, 0x0303, 0x01 }, - { IMX_8BIT, 0x0305, 0x0C }, - { IMX_8BIT, 0x0309, 0x05 }, - { IMX_8BIT, 0x030B, 0x01 }, - { IMX_8BIT, 0x030C, 0x01 }, - { IMX_8BIT, 0x030D, 0xA9 }, - { IMX_8BIT, 0x030E, 0x01 }, - { IMX_8BIT, 0x3A06, 0x11 }, - - /* Mode setting */ - { IMX_8BIT, 0x0108, 0x03 }, - { IMX_8BIT, 0x0112, 0x0A }, - { IMX_8BIT, 0x0113, 0x0A }, - { IMX_8BIT, 0x0381, 0x01 }, - { IMX_8BIT, 0x0383, 0x01 }, - { IMX_8BIT, 0x0385, 0x01 }, - { IMX_8BIT, 0x0387, 0x01 }, - { IMX_8BIT, 0x0390, 0x01 }, /* binning */ - { IMX_8BIT, 0x0391, 0x44 }, /* 4x4 binning */ - { IMX_8BIT, 0x0392, 0x00 }, - { IMX_8BIT, 0x0401, 0x00 }, /* no resize */ - { IMX_8BIT, 0x0404, 0x00 }, - { IMX_8BIT, 0x0405, 0x10 }, - { IMX_8BIT, 0x4082, 0x01 }, - { IMX_8BIT, 0x4083, 0x01 }, - { IMX_8BIT, 0x7006, 0x04 }, - - /* Optionnal Function setting */ - { IMX_8BIT, 0x0700, 0x00 }, - { IMX_8BIT, 0x3A63, 0x00 }, - { IMX_8BIT, 0x4100, 0xF8 }, - { IMX_8BIT, 0x4203, 0xFF }, - { IMX_8BIT, 0x4344, 0x00 }, - { IMX_8BIT, 0x441C, 0x01 }, - - /* Size setting */ - { IMX_8BIT, 0x0344, 0x00 }, /* x_addr_start[15:8]:0 */ - { IMX_8BIT, 0x0345, 0x00 }, /* x_addr_start[7:0] */ - { IMX_8BIT, 0x0346, 0x00 }, /* y_addr_start[15:8]:0 */ - { IMX_8BIT, 0x0347, 0x00 }, /* y_addr_start[7:0] */ - { IMX_8BIT, 0x0348, 0x0C }, /* x_addr_end[15:8]:3279 */ - { IMX_8BIT, 0x0349, 0xCF }, /* x_addr_end[7:0] */ - { IMX_8BIT, 0x034A, 0x09 }, /* y_addr_end[15:8]:2463 */ - { IMX_8BIT, 0x034B, 0x9F }, /* y_addr_end[7:0] */ - { IMX_8BIT, 0x034C, 0x03 }, /* x_output_size[15:8]:820 */ - { IMX_8BIT, 0x034D, 0x34 }, /* x_output_size[7:0] */ - { IMX_8BIT, 0x034E, 0x02 }, /* y_output_size[15:8]:616 */ - { IMX_8BIT, 0x034F, 0x68 }, /* y_output_size[7:0] */ - { IMX_8BIT, 0x0350, 0x00 }, - { IMX_8BIT, 0x0351, 0x00 }, - { IMX_8BIT, 0x0352, 0x00 }, - { IMX_8BIT, 0x0353, 0x00 }, - { IMX_8BIT, 0x0354, 0x03 }, - { IMX_8BIT, 0x0355, 0x34 }, - { IMX_8BIT, 0x0356, 0x02 }, - { IMX_8BIT, 0x0357, 0x68 }, - { IMX_8BIT, 0x301D, 0x30 }, - { IMX_8BIT, 0x3310, 0x03 }, - { IMX_8BIT, 0x3311, 0x34 }, - { IMX_8BIT, 0x3312, 0x02 }, - { IMX_8BIT, 0x3313, 0x68 }, - { IMX_8BIT, 0x331C, 0x02 }, - { IMX_8BIT, 0x331D, 0xD0 }, - { IMX_8BIT, 0x4084, 0x00 }, - { IMX_8BIT, 0x4085, 0x00 }, - { IMX_8BIT, 0x4086, 0x00 }, - { IMX_8BIT, 0x4087, 0x00 }, - { IMX_8BIT, 0x4400, 0x00 }, - - /* Global Timing Setting */ - { IMX_8BIT, 0x0830, 0x77 }, - { IMX_8BIT, 0x0831, 0x2F }, - { IMX_8BIT, 0x0832, 0x4F }, - { IMX_8BIT, 0x0833, 0x37 }, - { IMX_8BIT, 0x0834, 0x2F }, - { IMX_8BIT, 0x0835, 0x37 }, - { IMX_8BIT, 0x0836, 0xAF }, - { IMX_8BIT, 0x0837, 0x37 }, - { IMX_8BIT, 0x0839, 0x1F }, - { IMX_8BIT, 0x083A, 0x17 }, - { IMX_8BIT, 0x083B, 0x02 }, - - /* Integration Time Setting */ - { IMX_8BIT, 0x0202, 0x09 }, - { IMX_8BIT, 0x0203, 0xD2 }, - - /* HDR Setting */ - { IMX_8BIT, 0x0230, 0x00 }, - { IMX_8BIT, 0x0231, 0x00 }, - { IMX_8BIT, 0x0233, 0x00 }, - { IMX_8BIT, 0x0234, 0x00 }, - { IMX_8BIT, 0x0235, 0x40 }, - { IMX_8BIT, 0x0238, 0x00 }, - { IMX_8BIT, 0x0239, 0x04 }, - { IMX_8BIT, 0x023B, 0x00 }, - { IMX_8BIT, 0x023C, 0x01 }, - { IMX_8BIT, 0x33B0, 0x04 }, - { IMX_8BIT, 0x33B1, 0x00 }, - { IMX_8BIT, 0x33B3, 0x00 }, - { IMX_8BIT, 0x33B4, 0x01 }, - { IMX_8BIT, 0x3800, 0x00 }, - { IMX_TOK_TERM, 0, 0 } -}; - -/* 4 lane, 1/4 binning 30fps 820x552 */ -static struct imx_reg const imx134_820_552_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - /* mode set clear */ - { IMX_8BIT, 0x3A43, 0x01 }, - /* Clock Setting */ - { IMX_8BIT, 0x011E, 0x13 }, - { IMX_8BIT, 0x011F, 0x33 }, - { IMX_8BIT, 0x0301, 0x05 }, - { IMX_8BIT, 0x0303, 0x01 }, - { IMX_8BIT, 0x0305, 0x0C }, - { IMX_8BIT, 0x0309, 0x05 }, - { IMX_8BIT, 0x030B, 0x01 }, - { IMX_8BIT, 0x030C, 0x01 }, - { IMX_8BIT, 0x030D, 0xA9 }, - { IMX_8BIT, 0x030E, 0x01 }, - { IMX_8BIT, 0x3A06, 0x11 }, - - /* Mode setting */ - { IMX_8BIT, 0x0108, 0x03 }, - { IMX_8BIT, 0x0112, 0x0A }, - { IMX_8BIT, 0x0113, 0x0A }, - { IMX_8BIT, 0x0381, 0x01 }, - { IMX_8BIT, 0x0383, 0x01 }, - { IMX_8BIT, 0x0385, 0x01 }, - { IMX_8BIT, 0x0387, 0x01 }, - { IMX_8BIT, 0x0390, 0x01 }, /* binning */ - { IMX_8BIT, 0x0391, 0x44 }, /* 4x4 binning */ - { IMX_8BIT, 0x0392, 0x00 }, - { IMX_8BIT, 0x0401, 0x00 }, /* no resize */ - { IMX_8BIT, 0x0404, 0x00 }, - { IMX_8BIT, 0x0405, 0x10 }, - { IMX_8BIT, 0x4082, 0x01 }, - { IMX_8BIT, 0x4083, 0x01 }, - { IMX_8BIT, 0x7006, 0x04 }, - - /* Optionnal Function setting */ - { IMX_8BIT, 0x0700, 0x00 }, - { IMX_8BIT, 0x3A63, 0x00 }, - { IMX_8BIT, 0x4100, 0xF8 }, - { IMX_8BIT, 0x4203, 0xFF }, - { IMX_8BIT, 0x4344, 0x00 }, - { IMX_8BIT, 0x441C, 0x01 }, - - /* Size setting */ - { IMX_8BIT, 0x0344, 0x00 }, /* x_addr_start[15:8]:0 */ - { IMX_8BIT, 0x0345, 0x00 }, /* x_addr_start[7:0] */ - { IMX_8BIT, 0x0346, 0x00 }, /* y_addr_start[15:8]:128 */ - { IMX_8BIT, 0x0347, 0x80 }, /* y_addr_start[7:0] */ - { IMX_8BIT, 0x0348, 0x0C }, /* x_addr_end[15:8]:3280-1 */ - { IMX_8BIT, 0x0349, 0xCF }, /* x_addr_end[7:0] */ - { IMX_8BIT, 0x034A, 0x09 }, /* y_addr_end[15:8]:2208+128-1 */ - { IMX_8BIT, 0x034B, 0x1F }, /* y_addr_end[7:0] */ - { IMX_8BIT, 0x034C, 0x03 }, /* x_output_size[15:8]: */ - { IMX_8BIT, 0x034D, 0x34 }, /* x_output_size[7:0] */ - { IMX_8BIT, 0x034E, 0x02 }, /* y_output_size[15:8]:616 */ - { IMX_8BIT, 0x034F, 0x28 }, /* y_output_size[7:0] */ - { IMX_8BIT, 0x0350, 0x00 }, - { IMX_8BIT, 0x0351, 0x00 }, - { IMX_8BIT, 0x0352, 0x00 }, - { IMX_8BIT, 0x0353, 0x00 }, - { IMX_8BIT, 0x0354, 0x03 }, - { IMX_8BIT, 0x0355, 0x34 }, - { IMX_8BIT, 0x0356, 0x02 }, - { IMX_8BIT, 0x0357, 0x28 }, - { IMX_8BIT, 0x301D, 0x30 }, - { IMX_8BIT, 0x3310, 0x03 }, - { IMX_8BIT, 0x3311, 0x34 }, - { IMX_8BIT, 0x3312, 0x02 }, - { IMX_8BIT, 0x3313, 0x28 }, - { IMX_8BIT, 0x331C, 0x02 }, - { IMX_8BIT, 0x331D, 0xD0 }, - { IMX_8BIT, 0x4084, 0x00 }, - { IMX_8BIT, 0x4085, 0x00 }, - { IMX_8BIT, 0x4086, 0x00 }, - { IMX_8BIT, 0x4087, 0x00 }, - { IMX_8BIT, 0x4400, 0x00 }, - - /* Global Timing Setting */ - { IMX_8BIT, 0x0830, 0x77 }, - { IMX_8BIT, 0x0831, 0x2F }, - { IMX_8BIT, 0x0832, 0x4F }, - { IMX_8BIT, 0x0833, 0x37 }, - { IMX_8BIT, 0x0834, 0x2F }, - { IMX_8BIT, 0x0835, 0x37 }, - { IMX_8BIT, 0x0836, 0xAF }, - { IMX_8BIT, 0x0837, 0x37 }, - { IMX_8BIT, 0x0839, 0x1F }, - { IMX_8BIT, 0x083A, 0x17 }, - { IMX_8BIT, 0x083B, 0x02 }, - - /* Integration Time Setting */ - { IMX_8BIT, 0x0202, 0x09 }, - { IMX_8BIT, 0x0203, 0xD2 }, - - /* HDR Setting */ - { IMX_8BIT, 0x0230, 0x00 }, - { IMX_8BIT, 0x0231, 0x00 }, - { IMX_8BIT, 0x0233, 0x00 }, - { IMX_8BIT, 0x0234, 0x00 }, - { IMX_8BIT, 0x0235, 0x40 }, - { IMX_8BIT, 0x0238, 0x00 }, - { IMX_8BIT, 0x0239, 0x04 }, - { IMX_8BIT, 0x023B, 0x00 }, - { IMX_8BIT, 0x023C, 0x01 }, - { IMX_8BIT, 0x33B0, 0x04 }, - { IMX_8BIT, 0x33B1, 0x00 }, - { IMX_8BIT, 0x33B3, 0x00 }, - { IMX_8BIT, 0x33B4, 0x01 }, - { IMX_8BIT, 0x3800, 0x00 }, - { IMX_TOK_TERM, 0, 0 } -}; - -/* 4 lane, 1/4 binning 30fps 720x592 */ -static struct imx_reg const imx134_720_592_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - /* mode set clear */ - { IMX_8BIT, 0x3A43, 0x01 }, - /* Clock Setting */ - { IMX_8BIT, 0x011E, 0x13 }, - { IMX_8BIT, 0x011F, 0x33 }, - { IMX_8BIT, 0x0301, 0x05 }, - { IMX_8BIT, 0x0303, 0x01 }, - { IMX_8BIT, 0x0305, 0x0C }, - { IMX_8BIT, 0x0309, 0x05 }, - { IMX_8BIT, 0x030B, 0x01 }, - { IMX_8BIT, 0x030C, 0x01 }, - { IMX_8BIT, 0x030D, 0xA9 }, - { IMX_8BIT, 0x030E, 0x01 }, - { IMX_8BIT, 0x3A06, 0x11 }, - - /* Mode setting */ - { IMX_8BIT, 0x0108, 0x03 }, - { IMX_8BIT, 0x0112, 0x0A }, - { IMX_8BIT, 0x0113, 0x0A }, - { IMX_8BIT, 0x0381, 0x01 }, - { IMX_8BIT, 0x0383, 0x01 }, - { IMX_8BIT, 0x0385, 0x01 }, - { IMX_8BIT, 0x0387, 0x01 }, - { IMX_8BIT, 0x0390, 0x01 }, /* binning */ - { IMX_8BIT, 0x0391, 0x44 }, /* 4x4 binning */ - { IMX_8BIT, 0x0392, 0x00 }, - { IMX_8BIT, 0x0401, 0x00 }, /* no resize */ - { IMX_8BIT, 0x0404, 0x00 }, - { IMX_8BIT, 0x0405, 0x10 }, - { IMX_8BIT, 0x4082, 0x01 }, - { IMX_8BIT, 0x4083, 0x01 }, - { IMX_8BIT, 0x7006, 0x04 }, - - /* Optionnal Function setting */ - { IMX_8BIT, 0x0700, 0x00 }, - { IMX_8BIT, 0x3A63, 0x00 }, - { IMX_8BIT, 0x4100, 0xF8 }, - { IMX_8BIT, 0x4203, 0xFF }, - { IMX_8BIT, 0x4344, 0x00 }, - { IMX_8BIT, 0x441C, 0x01 }, - - /* Size setting */ - { IMX_8BIT, 0x0344, 0x00 }, /* x_addr_start[15:8]:200 */ - { IMX_8BIT, 0x0345, 0xC8 }, /* x_addr_start[7:0] */ - { IMX_8BIT, 0x0346, 0x00 }, /* y_addr_start[15:8]:40 */ - { IMX_8BIT, 0x0347, 0x28 }, /* y_addr_start[7:0] */ - { IMX_8BIT, 0x0348, 0x0C }, /* x_addr_end[15:8]:2880+200-1 */ - { IMX_8BIT, 0x0349, 0x07 }, /* x_addr_end[7:0] */ - { IMX_8BIT, 0x034A, 0x09 }, /* y_addr_end[15:8]:2368+40-1 */ - { IMX_8BIT, 0x034B, 0x67 }, /* y_addr_end[7:0] */ - { IMX_8BIT, 0x034C, 0x02 }, /* x_output_size[15:8]: */ - { IMX_8BIT, 0x034D, 0xD0 }, /* x_output_size[7:0] */ - { IMX_8BIT, 0x034E, 0x02 }, /* y_output_size[15:8]:616 */ - { IMX_8BIT, 0x034F, 0x50 }, /* y_output_size[7:0] */ - { IMX_8BIT, 0x0350, 0x00 }, - { IMX_8BIT, 0x0351, 0x00 }, - { IMX_8BIT, 0x0352, 0x00 }, - { IMX_8BIT, 0x0353, 0x00 }, - { IMX_8BIT, 0x0354, 0x02 }, - { IMX_8BIT, 0x0355, 0xD0 }, - { IMX_8BIT, 0x0356, 0x02 }, - { IMX_8BIT, 0x0357, 0x50 }, - { IMX_8BIT, 0x301D, 0x30 }, - { IMX_8BIT, 0x3310, 0x02 }, - { IMX_8BIT, 0x3311, 0xD0 }, - { IMX_8BIT, 0x3312, 0x02 }, - { IMX_8BIT, 0x3313, 0x50 }, - { IMX_8BIT, 0x331C, 0x02 }, - { IMX_8BIT, 0x331D, 0xD0 }, - { IMX_8BIT, 0x4084, 0x00 }, - { IMX_8BIT, 0x4085, 0x00 }, - { IMX_8BIT, 0x4086, 0x00 }, - { IMX_8BIT, 0x4087, 0x00 }, - { IMX_8BIT, 0x4400, 0x00 }, - - /* Global Timing Setting */ - { IMX_8BIT, 0x0830, 0x77 }, - { IMX_8BIT, 0x0831, 0x2F }, - { IMX_8BIT, 0x0832, 0x4F }, - { IMX_8BIT, 0x0833, 0x37 }, - { IMX_8BIT, 0x0834, 0x2F }, - { IMX_8BIT, 0x0835, 0x37 }, - { IMX_8BIT, 0x0836, 0xAF }, - { IMX_8BIT, 0x0837, 0x37 }, - { IMX_8BIT, 0x0839, 0x1F }, - { IMX_8BIT, 0x083A, 0x17 }, - { IMX_8BIT, 0x083B, 0x02 }, - - /* Integration Time Setting */ - { IMX_8BIT, 0x0202, 0x09 }, - { IMX_8BIT, 0x0203, 0xD2 }, - - /* HDR Setting */ - { IMX_8BIT, 0x0230, 0x00 }, - { IMX_8BIT, 0x0231, 0x00 }, - { IMX_8BIT, 0x0233, 0x00 }, - { IMX_8BIT, 0x0234, 0x00 }, - { IMX_8BIT, 0x0235, 0x40 }, - { IMX_8BIT, 0x0238, 0x00 }, - { IMX_8BIT, 0x0239, 0x04 }, - { IMX_8BIT, 0x023B, 0x00 }, - { IMX_8BIT, 0x023C, 0x01 }, - { IMX_8BIT, 0x33B0, 0x04 }, - { IMX_8BIT, 0x33B1, 0x00 }, - { IMX_8BIT, 0x33B3, 0x00 }, - { IMX_8BIT, 0x33B4, 0x01 }, - { IMX_8BIT, 0x3800, 0x00 }, - { IMX_TOK_TERM, 0, 0 } -}; - -static struct imx_reg const imx134_752_616_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - /* mode set clear */ - { IMX_8BIT, 0x3A43, 0x01 }, - /* Clock Setting */ - { IMX_8BIT, 0x011E, 0x13 }, - { IMX_8BIT, 0x011F, 0x33 }, - { IMX_8BIT, 0x0301, 0x05 }, - { IMX_8BIT, 0x0303, 0x01 }, - { IMX_8BIT, 0x0305, 0x0C }, - { IMX_8BIT, 0x0309, 0x05 }, - { IMX_8BIT, 0x030B, 0x01 }, - { IMX_8BIT, 0x030C, 0x01 }, - { IMX_8BIT, 0x030D, 0xA9 }, - { IMX_8BIT, 0x030E, 0x01 }, - { IMX_8BIT, 0x3A06, 0x11 }, - - /* Mode setting */ - { IMX_8BIT, 0x0108, 0x03 }, - { IMX_8BIT, 0x0112, 0x0A }, - { IMX_8BIT, 0x0113, 0x0A }, - { IMX_8BIT, 0x0381, 0x01 }, - { IMX_8BIT, 0x0383, 0x01 }, - { IMX_8BIT, 0x0385, 0x01 }, - { IMX_8BIT, 0x0387, 0x01 }, - { IMX_8BIT, 0x0390, 0x01 }, /* binning */ - { IMX_8BIT, 0x0391, 0x44 }, /* 4x4 binning */ - { IMX_8BIT, 0x0392, 0x00 }, - { IMX_8BIT, 0x0401, 0x00 }, /* no resize */ - { IMX_8BIT, 0x0404, 0x00 }, - { IMX_8BIT, 0x0405, 0x10 }, - { IMX_8BIT, 0x4082, 0x01 }, - { IMX_8BIT, 0x4083, 0x01 }, - { IMX_8BIT, 0x7006, 0x04 }, - - /* Optionnal Function setting */ - { IMX_8BIT, 0x0700, 0x00 }, - { IMX_8BIT, 0x3A63, 0x00 }, - { IMX_8BIT, 0x4100, 0xF8 }, - { IMX_8BIT, 0x4203, 0xFF }, - { IMX_8BIT, 0x4344, 0x00 }, - { IMX_8BIT, 0x441C, 0x01 }, - - /* Size setting */ - { IMX_8BIT, 0x0344, 0x00 }, /* x_addr_start[15:8]:136 */ - { IMX_8BIT, 0x0345, 0x88 }, /* x_addr_start[7:0] */ - { IMX_8BIT, 0x0346, 0x00 }, /* y_addr_start[15:8]:0 */ - { IMX_8BIT, 0x0347, 0x00 }, /* y_addr_start[7:0] */ - { IMX_8BIT, 0x0348, 0x0C }, /* x_addr_end[15:8]:3145+134-1 */ - { IMX_8BIT, 0x0349, 0x47 }, /* x_addr_end[7:0] */ - { IMX_8BIT, 0x034A, 0x09 }, /* y_addr_end[15:8]:2463 */ - { IMX_8BIT, 0x034B, 0x9F }, /* y_addr_end[7:0] */ - { IMX_8BIT, 0x034C, 0x02 }, /* x_output_size[15:8]: 752*/ - { IMX_8BIT, 0x034D, 0xF0 }, /* x_output_size[7:0] */ - { IMX_8BIT, 0x034E, 0x02 }, /* y_output_size[15:8]:616 */ - { IMX_8BIT, 0x034F, 0x68 }, /* y_output_size[7:0] */ - { IMX_8BIT, 0x0350, 0x00 }, - { IMX_8BIT, 0x0351, 0x00 }, - { IMX_8BIT, 0x0352, 0x00 }, - { IMX_8BIT, 0x0353, 0x00 }, - - { IMX_8BIT, 0x0354, 0x02 }, - { IMX_8BIT, 0x0355, 0xF0 }, - { IMX_8BIT, 0x0356, 0x02 }, - { IMX_8BIT, 0x0357, 0x68 }, - - { IMX_8BIT, 0x301D, 0x30 }, - - { IMX_8BIT, 0x3310, 0x02 }, - { IMX_8BIT, 0x3311, 0xF0 }, - { IMX_8BIT, 0x3312, 0x02 }, - { IMX_8BIT, 0x3313, 0x68 }, - - { IMX_8BIT, 0x331C, 0x02 }, - { IMX_8BIT, 0x331D, 0xD0 }, - { IMX_8BIT, 0x4084, 0x00 }, - { IMX_8BIT, 0x4085, 0x00 }, - { IMX_8BIT, 0x4086, 0x00 }, - { IMX_8BIT, 0x4087, 0x00 }, - { IMX_8BIT, 0x4400, 0x00 }, - - /* Global Timing Setting */ - { IMX_8BIT, 0x0830, 0x77 }, - { IMX_8BIT, 0x0831, 0x2F }, - { IMX_8BIT, 0x0832, 0x4F }, - { IMX_8BIT, 0x0833, 0x37 }, - { IMX_8BIT, 0x0834, 0x2F }, - { IMX_8BIT, 0x0835, 0x37 }, - { IMX_8BIT, 0x0836, 0xAF }, - { IMX_8BIT, 0x0837, 0x37 }, - { IMX_8BIT, 0x0839, 0x1F }, - { IMX_8BIT, 0x083A, 0x17 }, - { IMX_8BIT, 0x083B, 0x02 }, - - /* Integration Time Setting */ - { IMX_8BIT, 0x0202, 0x09 }, - { IMX_8BIT, 0x0203, 0xD2 }, - - /* HDR Setting */ - { IMX_8BIT, 0x0230, 0x00 }, - { IMX_8BIT, 0x0231, 0x00 }, - { IMX_8BIT, 0x0233, 0x00 }, - { IMX_8BIT, 0x0234, 0x00 }, - { IMX_8BIT, 0x0235, 0x40 }, - { IMX_8BIT, 0x0238, 0x00 }, - { IMX_8BIT, 0x0239, 0x04 }, - { IMX_8BIT, 0x023B, 0x00 }, - { IMX_8BIT, 0x023C, 0x01 }, - { IMX_8BIT, 0x33B0, 0x04 }, - { IMX_8BIT, 0x33B1, 0x00 }, - { IMX_8BIT, 0x33B3, 0x00 }, - { IMX_8BIT, 0x33B4, 0x01 }, - { IMX_8BIT, 0x3800, 0x00 }, - { IMX_TOK_TERM, 0, 0 } -}; - -/* 1424x1168 */ -static struct imx_reg const imx134_1424_1168_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - /* mode set clear */ - { IMX_8BIT, 0x3A43, 0x01 }, - /* Clock Setting */ - { IMX_8BIT, 0x011E, 0x13 }, - { IMX_8BIT, 0x011F, 0x33 }, - { IMX_8BIT, 0x0301, 0x05 }, - { IMX_8BIT, 0x0303, 0x01 }, - { IMX_8BIT, 0x0305, 0x0C }, - { IMX_8BIT, 0x0309, 0x05 }, - { IMX_8BIT, 0x030B, 0x01 }, - { IMX_8BIT, 0x030C, 0x01 }, - { IMX_8BIT, 0x030D, 0xA9 }, - { IMX_8BIT, 0x030E, 0x01 }, - { IMX_8BIT, 0x3A06, 0x11 }, - - /* Mode setting */ - { IMX_8BIT, 0x0108, 0x03 }, - { IMX_8BIT, 0x0112, 0x0A }, - { IMX_8BIT, 0x0113, 0x0A }, - { IMX_8BIT, 0x0381, 0x01 }, - { IMX_8BIT, 0x0383, 0x01 }, - { IMX_8BIT, 0x0385, 0x01 }, - { IMX_8BIT, 0x0387, 0x01 }, - { IMX_8BIT, 0x0390, 0x00 }, /* binning */ - { IMX_8BIT, 0x0391, 0x11 }, /* no binning */ - { IMX_8BIT, 0x0392, 0x00 }, - { IMX_8BIT, 0x0401, 0x02 }, /* resize */ - { IMX_8BIT, 0x0404, 0x00 }, - { IMX_8BIT, 0x0405, 0x22 }, /* 34/16=2.125 */ - { IMX_8BIT, 0x4082, 0x00 }, /* ?? */ - { IMX_8BIT, 0x4083, 0x00 }, /* ?? */ - { IMX_8BIT, 0x7006, 0x04 }, - - /* Optionnal Function setting */ - { IMX_8BIT, 0x0700, 0x00 }, - { IMX_8BIT, 0x3A63, 0x00 }, - { IMX_8BIT, 0x4100, 0xF8 }, - { IMX_8BIT, 0x4203, 0xFF }, - { IMX_8BIT, 0x4344, 0x00 }, - { IMX_8BIT, 0x441C, 0x01 }, - - /* Size setting */ - { IMX_8BIT, 0x0344, 0x00 }, /* x_addr_start[15:8]:136 */ - { IMX_8BIT, 0x0345, 0x80 }, /* x_addr_start[7:0] */ - { IMX_8BIT, 0x0346, 0x00 }, /* y_addr_start[15:8]:0 */ - { IMX_8BIT, 0x0347, 0x00 }, /* y_addr_start[7:0] */ - { IMX_8BIT, 0x0348, 0x0C }, /* x_addr_end[15:8]:3145+134-1 */ - { IMX_8BIT, 0x0349, 0x51 }, /* x_addr_end[7:0] */ - { IMX_8BIT, 0x034A, 0x09 }, /* y_addr_end[15:8]:2463 */ - { IMX_8BIT, 0x034B, 0xB1 }, /* y_addr_end[7:0] */ - { IMX_8BIT, 0x034C, 0x05 }, /* x_output_size[15:8]: 1424*/ - { IMX_8BIT, 0x034D, 0x90 }, /* x_output_size[7:0] */ - { IMX_8BIT, 0x034E, 0x04 }, /* y_output_size[15:8]:1168 */ - { IMX_8BIT, 0x034F, 0x90 }, /* y_output_size[7:0] */ - { IMX_8BIT, 0x0350, 0x00 }, - { IMX_8BIT, 0x0351, 0x00 }, - { IMX_8BIT, 0x0352, 0x00 }, - { IMX_8BIT, 0x0353, 0x00 }, - - { IMX_8BIT, 0x0354, 0x0B }, - { IMX_8BIT, 0x0355, 0xD2 }, - { IMX_8BIT, 0x0356, 0x09 }, - { IMX_8BIT, 0x0357, 0xB2 }, - - { IMX_8BIT, 0x301D, 0x30 }, - - { IMX_8BIT, 0x3310, 0x05 }, - { IMX_8BIT, 0x3311, 0x90 }, - { IMX_8BIT, 0x3312, 0x04 }, - { IMX_8BIT, 0x3313, 0x90 }, - - { IMX_8BIT, 0x331C, 0x02 }, - { IMX_8BIT, 0x331D, 0xD0 }, - { IMX_8BIT, 0x4084, 0x05 }, - { IMX_8BIT, 0x4085, 0x90 }, - { IMX_8BIT, 0x4086, 0x04 }, - { IMX_8BIT, 0x4087, 0x90 }, - { IMX_8BIT, 0x4400, 0x00 }, - - /* Global Timing Setting */ - { IMX_8BIT, 0x0830, 0x77 }, - { IMX_8BIT, 0x0831, 0x2F }, - { IMX_8BIT, 0x0832, 0x4F }, - { IMX_8BIT, 0x0833, 0x37 }, - { IMX_8BIT, 0x0834, 0x2F }, - { IMX_8BIT, 0x0835, 0x37 }, - { IMX_8BIT, 0x0836, 0xAF }, - { IMX_8BIT, 0x0837, 0x37 }, - { IMX_8BIT, 0x0839, 0x1F }, - { IMX_8BIT, 0x083A, 0x17 }, - { IMX_8BIT, 0x083B, 0x02 }, - - /* Integration Time Setting */ - { IMX_8BIT, 0x0202, 0x09 }, - { IMX_8BIT, 0x0203, 0xD2 }, - - /* HDR Setting */ - { IMX_8BIT, 0x0230, 0x00 }, - { IMX_8BIT, 0x0231, 0x00 }, - { IMX_8BIT, 0x0233, 0x00 }, - { IMX_8BIT, 0x0234, 0x00 }, - { IMX_8BIT, 0x0235, 0x40 }, - { IMX_8BIT, 0x0238, 0x00 }, - { IMX_8BIT, 0x0239, 0x04 }, - { IMX_8BIT, 0x023B, 0x00 }, - { IMX_8BIT, 0x023C, 0x01 }, - { IMX_8BIT, 0x33B0, 0x04 }, - { IMX_8BIT, 0x33B1, 0x00 }, - { IMX_8BIT, 0x33B3, 0x00 }, - { IMX_8BIT, 0x33B4, 0x01 }, - { IMX_8BIT, 0x3800, 0x00 }, - { IMX_TOK_TERM, 0, 0 } -}; - -/* 4 lane, 1/4 binning, 16/35 down scaling, 30fps, dvs */ -static struct imx_reg const imx134_240_196_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - /* mode set clear */ - { IMX_8BIT, 0x3A43, 0x01 }, - /* Clock Setting */ - { IMX_8BIT, 0x011E, 0x13 }, - { IMX_8BIT, 0x011F, 0x33 }, - { IMX_8BIT, 0x0301, 0x05 }, - { IMX_8BIT, 0x0303, 0x01 }, - { IMX_8BIT, 0x0305, 0x0C }, - { IMX_8BIT, 0x0309, 0x05 }, - { IMX_8BIT, 0x030B, 0x01 }, - { IMX_8BIT, 0x030C, 0x01 }, - { IMX_8BIT, 0x030D, 0xA9 }, - { IMX_8BIT, 0x030E, 0x01 }, - { IMX_8BIT, 0x3A06, 0x11 }, - - /* Mode setting */ - { IMX_8BIT, 0x0108, 0x03 }, - { IMX_8BIT, 0x0112, 0x0A }, - { IMX_8BIT, 0x0113, 0x0A }, - { IMX_8BIT, 0x0381, 0x01 }, - { IMX_8BIT, 0x0383, 0x01 }, - { IMX_8BIT, 0x0385, 0x01 }, - { IMX_8BIT, 0x0387, 0x01 }, - { IMX_8BIT, 0x0390, 0x01 }, /*4x4 binning */ - { IMX_8BIT, 0x0391, 0x44 }, - { IMX_8BIT, 0x0392, 0x00 }, - { IMX_8BIT, 0x0401, 0x02 }, /* resize */ - { IMX_8BIT, 0x0404, 0x00 }, - { IMX_8BIT, 0x0405, 0x23 }, /* down scaling = 16/35 */ - { IMX_8BIT, 0x4082, 0x00 }, - { IMX_8BIT, 0x4083, 0x00 }, - { IMX_8BIT, 0x7006, 0x04 }, - - /* Optionnal Function setting */ - { IMX_8BIT, 0x0700, 0x00 }, - { IMX_8BIT, 0x3A63, 0x00 }, - { IMX_8BIT, 0x4100, 0xF8 }, - { IMX_8BIT, 0x4203, 0xFF }, - { IMX_8BIT, 0x4344, 0x00 }, - { IMX_8BIT, 0x441C, 0x01 }, - - /* Size setting */ - { IMX_8BIT, 0x0344, 0x02 }, /* x_addr_start[15:8]:590 */ - { IMX_8BIT, 0x0345, 0x4E }, /* x_addr_start[7:0] */ - { IMX_8BIT, 0x0346, 0x01 }, /* y_addr_start[15:8]:366 */ - { IMX_8BIT, 0x0347, 0x6E }, /* y_addr_start[7:0] */ - { IMX_8BIT, 0x0348, 0x0A }, /* x_addr_end[15:8]:2104+590-1 */ - { IMX_8BIT, 0x0349, 0x85 }, /* x_addr_end[7:0] */ - { IMX_8BIT, 0x034A, 0x08 }, /* y_addr_end[15:8]:1720+366-1 */ - { IMX_8BIT, 0x034B, 0x25 }, /* y_addr_end[7:0] */ - { IMX_8BIT, 0x034C, 0x00 }, /* x_output_size[15:8]: 240*/ - { IMX_8BIT, 0x034D, 0xF0 }, /* x_output_size[7:0] */ - { IMX_8BIT, 0x034E, 0x00 }, /* y_output_size[15:8]:196 */ - { IMX_8BIT, 0x034F, 0xC4 }, /* y_output_size[7:0] */ - { IMX_8BIT, 0x0350, 0x00 }, - { IMX_8BIT, 0x0351, 0x00 }, - { IMX_8BIT, 0x0352, 0x00 }, - { IMX_8BIT, 0x0353, 0x00 }, - { IMX_8BIT, 0x0354, 0x02 }, /* crop_x: 526 */ - { IMX_8BIT, 0x0355, 0x0E }, - { IMX_8BIT, 0x0356, 0x01 }, /* crop_y: 430 */ - { IMX_8BIT, 0x0357, 0xAE }, - - { IMX_8BIT, 0x301D, 0x30 }, - - { IMX_8BIT, 0x3310, 0x00 }, - { IMX_8BIT, 0x3311, 0xF0 }, - { IMX_8BIT, 0x3312, 0x00 }, - { IMX_8BIT, 0x3313, 0xC4 }, - - { IMX_8BIT, 0x331C, 0x04 }, - { IMX_8BIT, 0x331D, 0x4C }, - - { IMX_8BIT, 0x4084, 0x00 }, - { IMX_8BIT, 0x4085, 0xF0 }, - { IMX_8BIT, 0x4086, 0x00 }, - { IMX_8BIT, 0x4087, 0xC4 }, - - { IMX_8BIT, 0x4400, 0x00 }, - - /* Global Timing Setting */ - { IMX_8BIT, 0x0830, 0x77 }, - { IMX_8BIT, 0x0831, 0x2F }, - { IMX_8BIT, 0x0832, 0x4F }, - { IMX_8BIT, 0x0833, 0x37 }, - { IMX_8BIT, 0x0834, 0x2F }, - { IMX_8BIT, 0x0835, 0x37 }, - { IMX_8BIT, 0x0836, 0xAF }, - { IMX_8BIT, 0x0837, 0x37 }, - { IMX_8BIT, 0x0839, 0x1F }, - { IMX_8BIT, 0x083A, 0x17 }, - { IMX_8BIT, 0x083B, 0x02 }, - - /* Integration Time Setting */ - { IMX_8BIT, 0x0202, 0x0A }, - { IMX_8BIT, 0x0203, 0x88 }, - - /* HDR Setting */ - { IMX_8BIT, 0x0230, 0x00 }, - { IMX_8BIT, 0x0231, 0x00 }, - { IMX_8BIT, 0x0233, 0x00 }, - { IMX_8BIT, 0x0234, 0x00 }, - { IMX_8BIT, 0x0235, 0x40 }, - { IMX_8BIT, 0x0238, 0x00 }, - { IMX_8BIT, 0x0239, 0x04 }, - { IMX_8BIT, 0x023B, 0x00 }, - { IMX_8BIT, 0x023C, 0x01 }, - { IMX_8BIT, 0x33B0, 0x04 }, - { IMX_8BIT, 0x33B1, 0x00 }, - { IMX_8BIT, 0x33B3, 0x00 }, - { IMX_8BIT, 0x33B4, 0x01 }, - { IMX_8BIT, 0x3800, 0x00 }, - { IMX_TOK_TERM, 0, 0 } -}; - -/* 4 lane, 1/2 binning, 16/38 downscaling, 30fps, dvs */ -static struct imx_reg const imx134_448_366_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - /* mode set clear */ - { IMX_8BIT, 0x3A43, 0x01 }, - /* Clock Setting */ - { IMX_8BIT, 0x011E, 0x13 }, - { IMX_8BIT, 0x011F, 0x33 }, - { IMX_8BIT, 0x0301, 0x05 }, - { IMX_8BIT, 0x0303, 0x01 }, - { IMX_8BIT, 0x0305, 0x0C }, - { IMX_8BIT, 0x0309, 0x05 }, - { IMX_8BIT, 0x030B, 0x01 }, - { IMX_8BIT, 0x030C, 0x01 }, - { IMX_8BIT, 0x030D, 0xA9 }, - { IMX_8BIT, 0x030E, 0x01 }, - { IMX_8BIT, 0x3A06, 0x11 }, - - /* Mode setting */ - { IMX_8BIT, 0x0108, 0x03 }, - { IMX_8BIT, 0x0112, 0x0A }, - { IMX_8BIT, 0x0113, 0x0A }, - { IMX_8BIT, 0x0381, 0x01 }, - { IMX_8BIT, 0x0383, 0x01 }, - { IMX_8BIT, 0x0385, 0x01 }, - { IMX_8BIT, 0x0387, 0x01 }, - { IMX_8BIT, 0x0390, 0x01 }, /* 2x2 binning */ - { IMX_8BIT, 0x0391, 0x22 }, - { IMX_8BIT, 0x0392, 0x00 }, - { IMX_8BIT, 0x0401, 0x02 }, /* resize */ - { IMX_8BIT, 0x0404, 0x00 }, - { IMX_8BIT, 0x0405, 0x26 }, /* down scaling = 16/38 */ - { IMX_8BIT, 0x4082, 0x00 }, - { IMX_8BIT, 0x4083, 0x00 }, - { IMX_8BIT, 0x7006, 0x04 }, - - /* Optionnal Function setting */ - { IMX_8BIT, 0x0700, 0x00 }, - { IMX_8BIT, 0x3A63, 0x00 }, - { IMX_8BIT, 0x4100, 0xF8 }, - { IMX_8BIT, 0x4203, 0xFF }, - { IMX_8BIT, 0x4344, 0x00 }, - { IMX_8BIT, 0x441C, 0x01 }, - - /* Size setting */ - { IMX_8BIT, 0x0344, 0x02 }, /* x_addr_start[15:8]:590 */ - { IMX_8BIT, 0x0345, 0x4E }, /* x_addr_start[7:0] */ - { IMX_8BIT, 0x0346, 0x01 }, /* y_addr_start[15:8]:366 */ - { IMX_8BIT, 0x0347, 0x6E }, /* y_addr_start[7:0] */ - { IMX_8BIT, 0x0348, 0x0A }, /* x_addr_end[15:8]:2128+590-1 */ - { IMX_8BIT, 0x0349, 0x9D }, /* x_addr_end[7:0] */ - { IMX_8BIT, 0x034A, 0x08 }, /* y_addr_end[15:8]:1740+366-1 */ - { IMX_8BIT, 0x034B, 0x39 }, /* y_addr_end[7:0] */ - { IMX_8BIT, 0x034C, 0x01 }, /* x_output_size[15:8]: 448*/ - { IMX_8BIT, 0x034D, 0xC0 }, /* x_output_size[7:0] */ - { IMX_8BIT, 0x034E, 0x01 }, /* y_output_size[15:8]:366 */ - { IMX_8BIT, 0x034F, 0x6E }, /* y_output_size[7:0] */ - { IMX_8BIT, 0x0350, 0x00 }, - { IMX_8BIT, 0x0351, 0x00 }, - { IMX_8BIT, 0x0352, 0x00 }, - { IMX_8BIT, 0x0353, 0x00 }, - { IMX_8BIT, 0x0354, 0x04 }, /* crop_x: 1064 */ - { IMX_8BIT, 0x0355, 0x28 }, - { IMX_8BIT, 0x0356, 0x03 }, /* crop_y: 870 */ - { IMX_8BIT, 0x0357, 0x66 }, - - { IMX_8BIT, 0x301D, 0x30 }, - - { IMX_8BIT, 0x3310, 0x01 }, - { IMX_8BIT, 0x3311, 0xC0 }, - { IMX_8BIT, 0x3312, 0x01 }, - { IMX_8BIT, 0x3313, 0x6E }, - - { IMX_8BIT, 0x331C, 0x02 }, - { IMX_8BIT, 0x331D, 0xD0 }, - - { IMX_8BIT, 0x4084, 0x01 }, - { IMX_8BIT, 0x4085, 0xC0 }, - { IMX_8BIT, 0x4086, 0x01 }, - { IMX_8BIT, 0x4087, 0x6E }, - { IMX_8BIT, 0x4400, 0x00 }, - - /* Global Timing Setting */ - { IMX_8BIT, 0x0830, 0x77 }, - { IMX_8BIT, 0x0831, 0x2F }, - { IMX_8BIT, 0x0832, 0x4F }, - { IMX_8BIT, 0x0833, 0x37 }, - { IMX_8BIT, 0x0834, 0x2F }, - { IMX_8BIT, 0x0835, 0x37 }, - { IMX_8BIT, 0x0836, 0xAF }, - { IMX_8BIT, 0x0837, 0x37 }, - { IMX_8BIT, 0x0839, 0x1F }, - { IMX_8BIT, 0x083A, 0x17 }, - { IMX_8BIT, 0x083B, 0x02 }, - - /* Integration Time Setting */ - { IMX_8BIT, 0x0202, 0x09 }, - { IMX_8BIT, 0x0203, 0xD2 }, - - /* HDR Setting */ - { IMX_8BIT, 0x0230, 0x00 }, - { IMX_8BIT, 0x0231, 0x00 }, - { IMX_8BIT, 0x0233, 0x00 }, - { IMX_8BIT, 0x0234, 0x00 }, - { IMX_8BIT, 0x0235, 0x40 }, - { IMX_8BIT, 0x0238, 0x00 }, - { IMX_8BIT, 0x0239, 0x04 }, - { IMX_8BIT, 0x023B, 0x00 }, - { IMX_8BIT, 0x023C, 0x01 }, - { IMX_8BIT, 0x33B0, 0x04 }, - { IMX_8BIT, 0x33B1, 0x00 }, - { IMX_8BIT, 0x33B3, 0x00 }, - { IMX_8BIT, 0x33B4, 0x01 }, - { IMX_8BIT, 0x3800, 0x00 }, - { IMX_TOK_TERM, 0, 0 } -}; - -/* 4 lane 2336x1312, 30fps, for 1080p dvs, vendor provide */ -static struct imx_reg const imx134_2336_1312_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - /* mode set clear */ - { IMX_8BIT, 0x3A43, 0x01 }, - /* Clock Setting */ - { IMX_8BIT, 0x011E, 0x13 }, - { IMX_8BIT, 0x011F, 0x33 }, - { IMX_8BIT, 0x0301, 0x05 }, - { IMX_8BIT, 0x0303, 0x01 }, - { IMX_8BIT, 0x0305, 0x0C }, - { IMX_8BIT, 0x0309, 0x05 }, - { IMX_8BIT, 0x030B, 0x01 }, - { IMX_8BIT, 0x030C, 0x01 }, - { IMX_8BIT, 0x030D, 0xA9 }, - { IMX_8BIT, 0x030E, 0x01 }, - { IMX_8BIT, 0x3A06, 0x11 }, - - /* Mode setting */ - { IMX_8BIT, 0x0108, 0x03 }, - { IMX_8BIT, 0x0112, 0x0A }, - { IMX_8BIT, 0x0113, 0x0A }, - { IMX_8BIT, 0x0381, 0x01 }, - { IMX_8BIT, 0x0383, 0x01 }, - { IMX_8BIT, 0x0385, 0x01 }, - { IMX_8BIT, 0x0387, 0x01 }, - { IMX_8BIT, 0x0390, 0x00 }, /* disable binning */ - { IMX_8BIT, 0x0391, 0x11 }, - { IMX_8BIT, 0x0392, 0x00 }, - { IMX_8BIT, 0x0401, 0x02 }, /* H/V resize */ - { IMX_8BIT, 0x0404, 0x00 }, - { IMX_8BIT, 0x0405, 0x16 }, /* down scaling = 16/22 = 8/11 */ - { IMX_8BIT, 0x4082, 0x00 }, - { IMX_8BIT, 0x4083, 0x00 }, - { IMX_8BIT, 0x7006, 0x04 }, - - /* Optionnal Function setting */ - { IMX_8BIT, 0x0700, 0x00 }, - { IMX_8BIT, 0x3A63, 0x00 }, - { IMX_8BIT, 0x4100, 0xF8 }, - { IMX_8BIT, 0x4203, 0xFF }, - { IMX_8BIT, 0x4344, 0x00 }, - { IMX_8BIT, 0x441C, 0x01 }, - - /* Size setting */ - { IMX_8BIT, 0x0344, 0x00 }, /* x_addr_start[15:8]:34 */ - { IMX_8BIT, 0x0345, 0x22 }, /* x_addr_start[7:0] */ - { IMX_8BIT, 0x0346, 0x01 }, /* y_addr_start[15:8]:332 */ - { IMX_8BIT, 0x0347, 0x4C }, /* y_addr_start[7:0] */ - { IMX_8BIT, 0x0348, 0x0C }, /* x_addr_end[15:8]:3245 */ - { IMX_8BIT, 0x0349, 0xAD }, /* x_addr_end[7:0] */ - { IMX_8BIT, 0x034A, 0x08 }, /* y_addr_end[15:8]:2135 */ - { IMX_8BIT, 0x034B, 0x57 }, /* y_addr_end[7:0] */ - { IMX_8BIT, 0x034C, 0x09 }, /* x_output_size[15:8]:2336 */ - { IMX_8BIT, 0x034D, 0x20 }, /* x_output_size[7:0] */ - { IMX_8BIT, 0x034E, 0x05 }, /* y_output_size[15:8]:1312 */ - { IMX_8BIT, 0x034F, 0x20 }, /* y_output_size[7:0] */ - { IMX_8BIT, 0x0350, 0x00 }, - { IMX_8BIT, 0x0351, 0x00 }, - { IMX_8BIT, 0x0352, 0x00 }, - { IMX_8BIT, 0x0353, 0x00 }, - { IMX_8BIT, 0x0354, 0x0C }, - { IMX_8BIT, 0x0355, 0x8C }, - { IMX_8BIT, 0x0356, 0x07 }, - { IMX_8BIT, 0x0357, 0x0C }, - { IMX_8BIT, 0x301D, 0x30 }, - { IMX_8BIT, 0x3310, 0x09 }, - { IMX_8BIT, 0x3311, 0x20 }, - { IMX_8BIT, 0x3312, 0x05 }, - { IMX_8BIT, 0x3313, 0x20 }, - { IMX_8BIT, 0x331C, 0x03 }, - { IMX_8BIT, 0x331D, 0xEB }, - { IMX_8BIT, 0x4084, 0x09 }, - { IMX_8BIT, 0x4085, 0x20 }, - { IMX_8BIT, 0x4086, 0x05 }, - { IMX_8BIT, 0x4087, 0x20 }, - { IMX_8BIT, 0x4400, 0x00 }, - - /* Global Timing Setting */ - { IMX_8BIT, 0x0830, 0x77 }, - { IMX_8BIT, 0x0831, 0x2F }, - { IMX_8BIT, 0x0832, 0x4F }, - { IMX_8BIT, 0x0833, 0x37 }, - { IMX_8BIT, 0x0834, 0x2F }, - { IMX_8BIT, 0x0835, 0x37 }, - { IMX_8BIT, 0x0836, 0xAF }, - { IMX_8BIT, 0x0837, 0x37 }, - { IMX_8BIT, 0x0839, 0x1F }, - { IMX_8BIT, 0x083A, 0x17 }, - { IMX_8BIT, 0x083B, 0x02 }, - - /* Integration Time Setting */ - { IMX_8BIT, 0x0202, 0x09 }, - { IMX_8BIT, 0x0203, 0xD2 }, - - /* HDR Setting */ - { IMX_8BIT, 0x0230, 0x00 }, - { IMX_8BIT, 0x0231, 0x00 }, - { IMX_8BIT, 0x0233, 0x00 }, - { IMX_8BIT, 0x0234, 0x00 }, - { IMX_8BIT, 0x0235, 0x40 }, - { IMX_8BIT, 0x0238, 0x00 }, - { IMX_8BIT, 0x0239, 0x04 }, - { IMX_8BIT, 0x023B, 0x00 }, - { IMX_8BIT, 0x023C, 0x01 }, - { IMX_8BIT, 0x33B0, 0x04 }, - { IMX_8BIT, 0x33B1, 0x00 }, - { IMX_8BIT, 0x33B3, 0x00 }, - { IMX_8BIT, 0x33B4, 0x01 }, - { IMX_8BIT, 0x3800, 0x00 }, - { IMX_TOK_TERM, 0, 0 } -}; - -/* 4 lane 1920x1080, 30fps, for 720p still capture */ -static struct imx_reg const imx134_1936_1096_30fps_v1[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - /* mode set clear */ - { IMX_8BIT, 0x3A43, 0x01 }, - /* Clock Setting */ - { IMX_8BIT, 0x011E, 0x13 }, - { IMX_8BIT, 0x011F, 0x33 }, - { IMX_8BIT, 0x0301, 0x05 }, - { IMX_8BIT, 0x0303, 0x01 }, - { IMX_8BIT, 0x0305, 0x0C }, - { IMX_8BIT, 0x0309, 0x05 }, - { IMX_8BIT, 0x030B, 0x01 }, - { IMX_8BIT, 0x030C, 0x01 }, - { IMX_8BIT, 0x030D, 0xA9 }, - { IMX_8BIT, 0x030E, 0x01 }, - { IMX_8BIT, 0x3A06, 0x11 }, - - /* Mode setting */ - { IMX_8BIT, 0x0108, 0x03 }, - { IMX_8BIT, 0x0112, 0x0A }, - { IMX_8BIT, 0x0113, 0x0A }, - { IMX_8BIT, 0x0381, 0x01 }, - { IMX_8BIT, 0x0383, 0x01 }, - { IMX_8BIT, 0x0385, 0x01 }, - { IMX_8BIT, 0x0387, 0x01 }, - { IMX_8BIT, 0x0390, 0x00 }, /* disable binning */ - { IMX_8BIT, 0x0391, 0x11 }, /* 2x2 binning */ - { IMX_8BIT, 0x0392, 0x00 }, - { IMX_8BIT, 0x0401, 0x02 }, /* H/V resize */ - { IMX_8BIT, 0x0404, 0x00 }, - { IMX_8BIT, 0x0405, 0x1A }, /* downscaling 16/26*/ - { IMX_8BIT, 0x4082, 0x00 }, - { IMX_8BIT, 0x4083, 0x00 }, - { IMX_8BIT, 0x7006, 0x04 }, - - /* Optionnal Function setting */ - { IMX_8BIT, 0x0700, 0x00 }, - { IMX_8BIT, 0x3A63, 0x00 }, - { IMX_8BIT, 0x4100, 0xF8 }, - { IMX_8BIT, 0x4203, 0xFF }, - { IMX_8BIT, 0x4344, 0x00 }, - { IMX_8BIT, 0x441C, 0x01 }, - - /* Size setting */ - { IMX_8BIT, 0x0344, 0x00 }, /* x_addr_start[15:8]:64 */ - { IMX_8BIT, 0x0345, 0x40 }, /* x_addr_start[7:0] */ - { IMX_8BIT, 0x0346, 0x01 }, /* y_addr_start[15:8]:340 */ - { IMX_8BIT, 0x0347, 0x54 }, /* y_addr_start[7:0] */ - { IMX_8BIT, 0x0348, 0x0C }, /* x_addr_end[15:8]:3209 */ - { IMX_8BIT, 0x0349, 0x89 }, /* x_addr_end[7:0] */ - { IMX_8BIT, 0x034A, 0x08 }, /* y_addr_end[15:8]:2121 */ - { IMX_8BIT, 0x034B, 0x49 }, /* y_addr_end[7:0] */ - { IMX_8BIT, 0x034C, 0x07 }, /* x_output_size[15:8]:1936 */ - { IMX_8BIT, 0x034D, 0x90 }, /* x_output_size[7:0] */ - { IMX_8BIT, 0x034E, 0x04 }, /* y_output_size[15:8]:1096 */ - { IMX_8BIT, 0x034F, 0x48 }, /* y_output_size[7:0] */ - { IMX_8BIT, 0x0350, 0x00 }, - { IMX_8BIT, 0x0351, 0x00 }, - { IMX_8BIT, 0x0352, 0x00 }, - { IMX_8BIT, 0x0353, 0x00 }, - { IMX_8BIT, 0x0354, 0x0C }, /* crop x:3146 */ - { IMX_8BIT, 0x0355, 0x4A }, - { IMX_8BIT, 0x0356, 0x06 }, /* xrop y:1782 */ - { IMX_8BIT, 0x0357, 0xF6 }, - { IMX_8BIT, 0x301D, 0x30 }, - { IMX_8BIT, 0x3310, 0x07 }, - { IMX_8BIT, 0x3311, 0x80 }, - { IMX_8BIT, 0x3312, 0x04 }, - { IMX_8BIT, 0x3313, 0x38 }, - { IMX_8BIT, 0x331C, 0x04 }, - { IMX_8BIT, 0x331D, 0x1E }, - { IMX_8BIT, 0x4084, 0x07 }, - { IMX_8BIT, 0x4085, 0x80 }, - { IMX_8BIT, 0x4086, 0x04 }, - { IMX_8BIT, 0x4087, 0x38 }, - { IMX_8BIT, 0x4400, 0x00 }, - - /* Global Timing Setting */ - { IMX_8BIT, 0x0830, 0x77 }, - { IMX_8BIT, 0x0831, 0x2F }, - { IMX_8BIT, 0x0832, 0x4F }, - { IMX_8BIT, 0x0833, 0x37 }, - { IMX_8BIT, 0x0834, 0x2F }, - { IMX_8BIT, 0x0835, 0x37 }, - { IMX_8BIT, 0x0836, 0xAF }, - { IMX_8BIT, 0x0837, 0x37 }, - { IMX_8BIT, 0x0839, 0x1F }, - { IMX_8BIT, 0x083A, 0x17 }, - { IMX_8BIT, 0x083B, 0x02 }, - - /* Integration Time Setting */ - { IMX_8BIT, 0x0202, 0x09 }, - { IMX_8BIT, 0x0203, 0xD2 }, - - /* HDR Setting */ - { IMX_8BIT, 0x0230, 0x00 }, - { IMX_8BIT, 0x0231, 0x00 }, - { IMX_8BIT, 0x0233, 0x00 }, - { IMX_8BIT, 0x0234, 0x00 }, - { IMX_8BIT, 0x0235, 0x40 }, - { IMX_8BIT, 0x0238, 0x00 }, - { IMX_8BIT, 0x0239, 0x04 }, - { IMX_8BIT, 0x023B, 0x00 }, - { IMX_8BIT, 0x023C, 0x01 }, - { IMX_8BIT, 0x33B0, 0x04 }, - { IMX_8BIT, 0x33B1, 0x00 }, - { IMX_8BIT, 0x33B3, 0x00 }, - { IMX_8BIT, 0x33B4, 0x01 }, - { IMX_8BIT, 0x3800, 0x00 }, - { IMX_TOK_TERM, 0, 0 } -}; - -/* 4 lane 1920x1080, 30fps, for 720p still capture, vendor provide */ -static struct imx_reg const imx134_1936_1096_30fps_v2[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - /* mode set clear */ - { IMX_8BIT, 0x3A43, 0x01 }, - /* Clock Setting */ - { IMX_8BIT, 0x011E, 0x13 }, - { IMX_8BIT, 0x011F, 0x33 }, - { IMX_8BIT, 0x0301, 0x05 }, - { IMX_8BIT, 0x0303, 0x01 }, - { IMX_8BIT, 0x0305, 0x0C }, - { IMX_8BIT, 0x0309, 0x05 }, - { IMX_8BIT, 0x030B, 0x01 }, - { IMX_8BIT, 0x030C, 0x01 }, - { IMX_8BIT, 0x030D, 0xA9 }, - { IMX_8BIT, 0x030E, 0x01 }, - { IMX_8BIT, 0x3A06, 0x11 }, - - /* Mode setting */ - { IMX_8BIT, 0x0108, 0x03 }, - { IMX_8BIT, 0x0112, 0x0A }, - { IMX_8BIT, 0x0113, 0x0A }, - { IMX_8BIT, 0x0381, 0x01 }, - { IMX_8BIT, 0x0383, 0x01 }, - { IMX_8BIT, 0x0385, 0x01 }, - { IMX_8BIT, 0x0387, 0x01 }, - { IMX_8BIT, 0x0390, 0x00 }, /* disable binning */ - { IMX_8BIT, 0x0391, 0x11 }, - { IMX_8BIT, 0x0392, 0x00 }, - { IMX_8BIT, 0x0401, 0x02 }, /* H/V resize */ - { IMX_8BIT, 0x0404, 0x00 }, - { IMX_8BIT, 0x0405, 0x1B }, /* downscaling 16/27*/ - { IMX_8BIT, 0x4082, 0x00 }, - { IMX_8BIT, 0x4083, 0x00 }, - { IMX_8BIT, 0x7006, 0x04 }, - - /* Optionnal Function setting */ - { IMX_8BIT, 0x0700, 0x00 }, - { IMX_8BIT, 0x3A63, 0x00 }, - { IMX_8BIT, 0x4100, 0xF8 }, - { IMX_8BIT, 0x4203, 0xFF }, - { IMX_8BIT, 0x4344, 0x00 }, - { IMX_8BIT, 0x441C, 0x01 }, - - /* Size setting */ - { IMX_8BIT, 0x0344, 0x00 }, /* x_addr_start[15:8]:64 */ - { IMX_8BIT, 0x0345, 0x06 }, /* x_addr_start[7:0] */ - { IMX_8BIT, 0x0346, 0x01 }, /* y_addr_start[15:8]:340 */ - { IMX_8BIT, 0x0347, 0x34 }, /* y_addr_start[7:0] */ - { IMX_8BIT, 0x0348, 0x0C }, /* x_addr_end[15:8]:3209 */ - { IMX_8BIT, 0x0349, 0xC9 }, /* x_addr_end[7:0] */ - { IMX_8BIT, 0x034A, 0x08 }, /* y_addr_end[15:8]:2121 */ - { IMX_8BIT, 0x034B, 0x6F }, /* y_addr_end[7:0] */ - { IMX_8BIT, 0x034C, 0x07 }, /* x_output_size[15:8]:1936 */ - { IMX_8BIT, 0x034D, 0x90 }, /* x_output_size[7:0] */ - { IMX_8BIT, 0x034E, 0x04 }, /* y_output_size[15:8]:1096 */ - { IMX_8BIT, 0x034F, 0x48 }, /* y_output_size[7:0] */ - { IMX_8BIT, 0x0350, 0x00 }, - { IMX_8BIT, 0x0351, 0x00 }, - { IMX_8BIT, 0x0352, 0x00 }, - { IMX_8BIT, 0x0353, 0x00 }, - { IMX_8BIT, 0x0354, 0x0C }, /* crop x:3146 */ - { IMX_8BIT, 0x0355, 0xC4 }, - { IMX_8BIT, 0x0356, 0x07 }, /* xrop y:1782 */ - { IMX_8BIT, 0x0357, 0x3A }, - { IMX_8BIT, 0x301D, 0x30 }, - { IMX_8BIT, 0x3310, 0x07 }, /* decide by mode and output size */ - { IMX_8BIT, 0x3311, 0x90 }, - { IMX_8BIT, 0x3312, 0x04 }, - { IMX_8BIT, 0x3313, 0x48 }, - { IMX_8BIT, 0x331C, 0x04 }, - { IMX_8BIT, 0x331D, 0x1E }, - { IMX_8BIT, 0x4084, 0x07 }, - { IMX_8BIT, 0x4085, 0x90 }, - { IMX_8BIT, 0x4086, 0x04 }, - { IMX_8BIT, 0x4087, 0x48 }, - { IMX_8BIT, 0x4400, 0x00 }, - - /* Global Timing Setting */ - { IMX_8BIT, 0x0830, 0x77 }, - { IMX_8BIT, 0x0831, 0x2F }, - { IMX_8BIT, 0x0832, 0x4F }, - { IMX_8BIT, 0x0833, 0x37 }, - { IMX_8BIT, 0x0834, 0x2F }, - { IMX_8BIT, 0x0835, 0x37 }, - { IMX_8BIT, 0x0836, 0xAF }, - { IMX_8BIT, 0x0837, 0x37 }, - { IMX_8BIT, 0x0839, 0x1F }, - { IMX_8BIT, 0x083A, 0x17 }, - { IMX_8BIT, 0x083B, 0x02 }, - - /* Integration Time Setting */ - { IMX_8BIT, 0x0202, 0x09 }, - { IMX_8BIT, 0x0203, 0xD2 }, - - /* HDR Setting */ - { IMX_8BIT, 0x0230, 0x00 }, - { IMX_8BIT, 0x0231, 0x00 }, - { IMX_8BIT, 0x0233, 0x00 }, - { IMX_8BIT, 0x0234, 0x00 }, - { IMX_8BIT, 0x0235, 0x40 }, - { IMX_8BIT, 0x0238, 0x00 }, - { IMX_8BIT, 0x0239, 0x04 }, - { IMX_8BIT, 0x023B, 0x00 }, - { IMX_8BIT, 0x023C, 0x01 }, - { IMX_8BIT, 0x33B0, 0x04 }, - { IMX_8BIT, 0x33B1, 0x00 }, - { IMX_8BIT, 0x33B3, 0x00 }, - { IMX_8BIT, 0x33B4, 0x01 }, - { IMX_8BIT, 0x3800, 0x00 }, - { IMX_TOK_TERM, 0, 0 } -}; - -/* 4 lane 1296x736, 30fps, for 720p still capture, vendor provide */ -static struct imx_reg const imx134_1296_736_30fps_v2[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - /* mode set clear */ - { IMX_8BIT, 0x3A43, 0x01 }, - /* Clock Setting */ - { IMX_8BIT, 0x011E, 0x13 }, - { IMX_8BIT, 0x011F, 0x33 }, - { IMX_8BIT, 0x0301, 0x05 }, - { IMX_8BIT, 0x0303, 0x01 }, - { IMX_8BIT, 0x0305, 0x0C }, - { IMX_8BIT, 0x0309, 0x05 }, - { IMX_8BIT, 0x030B, 0x01 }, - { IMX_8BIT, 0x030C, 0x01 }, - { IMX_8BIT, 0x030D, 0xA9 }, - { IMX_8BIT, 0x030E, 0x01 }, - { IMX_8BIT, 0x3A06, 0x11 }, - - /* Mode setting */ - { IMX_8BIT, 0x0108, 0x03 }, - { IMX_8BIT, 0x0112, 0x0A }, - { IMX_8BIT, 0x0113, 0x0A }, - { IMX_8BIT, 0x0381, 0x01 }, - { IMX_8BIT, 0x0383, 0x01 }, - { IMX_8BIT, 0x0385, 0x01 }, - { IMX_8BIT, 0x0387, 0x01 }, - { IMX_8BIT, 0x0390, 0x01 }, /* binning */ - { IMX_8BIT, 0x0391, 0x22 }, /* 2x2 binning */ - { IMX_8BIT, 0x0392, 0x00 }, - { IMX_8BIT, 0x0401, 0x02 }, /* H/V resize */ - { IMX_8BIT, 0x0404, 0x00 }, - { IMX_8BIT, 0x0405, 0x14 }, - { IMX_8BIT, 0x4082, 0x00 }, - { IMX_8BIT, 0x4083, 0x00 }, - { IMX_8BIT, 0x7006, 0x04 }, - - /* OptionnalFunction settig */ - { IMX_8BIT, 0x0700, 0x00 }, - { IMX_8BIT, 0x3A63, 0x00 }, - { IMX_8BIT, 0x4100, 0xF8 }, - { IMX_8BIT, 0x4203, 0xFF }, - { IMX_8BIT, 0x4344, 0x00 }, - { IMX_8BIT, 0x441C, 0x01 }, - - /* Size setting */ - { IMX_8BIT, 0x0344, 0x00 }, /* x_addr_start[15:8]:40 */ - { IMX_8BIT, 0x0345, 0x14 }, /* x_addr_start[7:0] */ - { IMX_8BIT, 0x0346, 0x01 }, /* y_addr_start[15:8]:332 */ - { IMX_8BIT, 0x0347, 0x38 }, /* y_addr_start[7:0] */ - { IMX_8BIT, 0x0348, 0x0C }, /* x_addr_end[15:8]:3239 */ - { IMX_8BIT, 0x0349, 0xBB }, /* x_addr_end[7:0] */ - { IMX_8BIT, 0x034A, 0x08 }, /* y_addr_end[15:8]:2131 */ - { IMX_8BIT, 0x034B, 0x67 }, /* y_addr_end[7:0] */ - { IMX_8BIT, 0x034C, 0x05 }, /* x_output_size[15:8]:1280 */ - { IMX_8BIT, 0x034D, 0x10 }, /* x_output_size[7:0] */ - { IMX_8BIT, 0x034E, 0x02 }, /* y_output_size[15:8]:720 */ - { IMX_8BIT, 0x034F, 0xE0 }, /* y_output_size[7:0] */ - { IMX_8BIT, 0x0350, 0x00 }, - { IMX_8BIT, 0x0351, 0x00 }, - { IMX_8BIT, 0x0352, 0x00 }, - { IMX_8BIT, 0x0353, 0x00 }, - { IMX_8BIT, 0x0354, 0x06 }, - { IMX_8BIT, 0x0355, 0x54 }, - { IMX_8BIT, 0x0356, 0x03 }, - { IMX_8BIT, 0x0357, 0x98 }, - { IMX_8BIT, 0x301D, 0x30 }, - { IMX_8BIT, 0x3310, 0x05 }, - { IMX_8BIT, 0x3311, 0x10 }, - { IMX_8BIT, 0x3312, 0x02 }, - { IMX_8BIT, 0x3313, 0xE0 }, - { IMX_8BIT, 0x331C, 0x01 }, - { IMX_8BIT, 0x331D, 0x10 }, - { IMX_8BIT, 0x4084, 0x05 }, - { IMX_8BIT, 0x4085, 0x10 }, - { IMX_8BIT, 0x4086, 0x02 }, - { IMX_8BIT, 0x4087, 0xE0 }, - { IMX_8BIT, 0x4400, 0x00 }, - - /* Global Timing Setting */ - { IMX_8BIT, 0x0830, 0x77 }, - { IMX_8BIT, 0x0831, 0x2F }, - { IMX_8BIT, 0x0832, 0x4F }, - { IMX_8BIT, 0x0833, 0x37 }, - { IMX_8BIT, 0x0834, 0x2F }, - { IMX_8BIT, 0x0835, 0x37 }, - { IMX_8BIT, 0x0836, 0xAF }, - { IMX_8BIT, 0x0837, 0x37 }, - { IMX_8BIT, 0x0839, 0x1F }, - { IMX_8BIT, 0x083A, 0x17 }, - { IMX_8BIT, 0x083B, 0x02 }, - - /* Integration Time Settin */ - { IMX_8BIT, 0x0202, 0x09 }, - { IMX_8BIT, 0x0203, 0xD2 }, - - /* HDR Setting */ - { IMX_8BIT, 0x0230, 0x00 }, - { IMX_8BIT, 0x0231, 0x00 }, - { IMX_8BIT, 0x0233, 0x00 }, - { IMX_8BIT, 0x0234, 0x00 }, - { IMX_8BIT, 0x0235, 0x40 }, - { IMX_8BIT, 0x0238, 0x00 }, - { IMX_8BIT, 0x0239, 0x04 }, - { IMX_8BIT, 0x023B, 0x00 }, - { IMX_8BIT, 0x023C, 0x01 }, - { IMX_8BIT, 0x33B0, 0x04 }, - { IMX_8BIT, 0x33B1, 0x00 }, - { IMX_8BIT, 0x33B3, 0x00 }, - { IMX_8BIT, 0x33B4, 0x01 }, - { IMX_8BIT, 0x3800, 0x00 }, - { IMX_TOK_TERM, 0, 0 } -}; - -/* 4 lane 1280x720, 30fps, for 720p dvs, vendor provide */ -static struct imx_reg const imx134_1568_880_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - /* mode set clear */ - { IMX_8BIT, 0x3A43, 0x01 }, - /* Clock Setting */ - { IMX_8BIT, 0x011E, 0x13 }, - { IMX_8BIT, 0x011F, 0x33 }, - { IMX_8BIT, 0x0301, 0x05 }, - { IMX_8BIT, 0x0303, 0x01 }, - { IMX_8BIT, 0x0305, 0x0C }, - { IMX_8BIT, 0x0309, 0x05 }, - { IMX_8BIT, 0x030B, 0x01 }, - { IMX_8BIT, 0x030C, 0x01 }, - { IMX_8BIT, 0x030D, 0xA9 }, - { IMX_8BIT, 0x030E, 0x01 }, - { IMX_8BIT, 0x3A06, 0x11 }, - - /* Mode setting */ - { IMX_8BIT, 0x0108, 0x03 }, - { IMX_8BIT, 0x0112, 0x0A }, - { IMX_8BIT, 0x0113, 0x0A }, - { IMX_8BIT, 0x0381, 0x01 }, - { IMX_8BIT, 0x0383, 0x01 }, - { IMX_8BIT, 0x0385, 0x01 }, - { IMX_8BIT, 0x0387, 0x01 }, - { IMX_8BIT, 0x0390, 0x01 }, /* binning*/ - { IMX_8BIT, 0x0391, 0x22 }, /* 2x2 binning */ - { IMX_8BIT, 0x0392, 0x00 }, - { IMX_8BIT, 0x0401, 0x02 }, /* H/V resize */ - { IMX_8BIT, 0x0404, 0x00 }, - { IMX_8BIT, 0x0405, 0x10 }, /* down scaling 16/16 = 1 */ - { IMX_8BIT, 0x4082, 0x01 }, - { IMX_8BIT, 0x4083, 0x01 }, - { IMX_8BIT, 0x7006, 0x04 }, - - /* OptionnalFunction settig */ - { IMX_8BIT, 0x0700, 0x00 }, - { IMX_8BIT, 0x3A63, 0x00 }, - { IMX_8BIT, 0x4100, 0xF8 }, - { IMX_8BIT, 0x4203, 0xFF }, - { IMX_8BIT, 0x4344, 0x00 }, - { IMX_8BIT, 0x441C, 0x01 }, - - /* Size setting */ - { IMX_8BIT, 0x0344, 0x00 }, /* x_addr_start[15:8]:72 */ - { IMX_8BIT, 0x0345, 0x48 }, /* x_addr_start[7:0] */ - { IMX_8BIT, 0x0346, 0x01 }, /* y_addr_start[15:8]:356 */ - { IMX_8BIT, 0x0347, 0x64 }, /* y_addr_start[7:0] */ - { IMX_8BIT, 0x0348, 0x0C }, /* x_addr_end[15:8]:3207 */ - { IMX_8BIT, 0x0349, 0x87 }, /* x_addr_end[7:0] */ - { IMX_8BIT, 0x034A, 0x08 }, /* y_addr_end[15:8]:2115 */ - { IMX_8BIT, 0x034B, 0x43 }, /* y_addr_end[7:0] */ - { IMX_8BIT, 0x034C, 0x06 }, /* x_output_size[15:8]:1568 */ - { IMX_8BIT, 0x034D, 0x20 }, /* x_output_size[7:0] */ - { IMX_8BIT, 0x034E, 0x03 }, /* y_output_size[15:8]:880 */ - { IMX_8BIT, 0x034F, 0x70 }, /* y_output_size[7:0] */ - { IMX_8BIT, 0x0350, 0x00 }, - { IMX_8BIT, 0x0351, 0x00 }, - { IMX_8BIT, 0x0352, 0x00 }, - { IMX_8BIT, 0x0353, 0x00 }, - { IMX_8BIT, 0x0354, 0x06 }, - { IMX_8BIT, 0x0355, 0x20 }, - { IMX_8BIT, 0x0356, 0x03 }, - { IMX_8BIT, 0x0357, 0x70 }, - { IMX_8BIT, 0x301D, 0x30 }, - { IMX_8BIT, 0x3310, 0x06 }, - { IMX_8BIT, 0x3311, 0x20 }, - { IMX_8BIT, 0x3312, 0x03 }, - { IMX_8BIT, 0x3313, 0x70 }, - { IMX_8BIT, 0x331C, 0x03 }, - { IMX_8BIT, 0x331D, 0xF2 }, - { IMX_8BIT, 0x4084, 0x00 }, - { IMX_8BIT, 0x4085, 0x00 }, - { IMX_8BIT, 0x4086, 0x00 }, - { IMX_8BIT, 0x4087, 0x00 }, - { IMX_8BIT, 0x4400, 0x00 }, - - /* Global Timing Setting */ - { IMX_8BIT, 0x0830, 0x77 }, - { IMX_8BIT, 0x0831, 0x2F }, - { IMX_8BIT, 0x0832, 0x4F }, - { IMX_8BIT, 0x0833, 0x37 }, - { IMX_8BIT, 0x0834, 0x2F }, - { IMX_8BIT, 0x0835, 0x37 }, - { IMX_8BIT, 0x0836, 0xAF }, - { IMX_8BIT, 0x0837, 0x37 }, - { IMX_8BIT, 0x0839, 0x1F }, - { IMX_8BIT, 0x083A, 0x17 }, - { IMX_8BIT, 0x083B, 0x02 }, - - /* Integration Time Settin */ - { IMX_8BIT, 0x0202, 0x09 }, - { IMX_8BIT, 0x0203, 0xD2 }, - - /* HDR Setting */ - { IMX_8BIT, 0x0230, 0x00 }, - { IMX_8BIT, 0x0231, 0x00 }, - { IMX_8BIT, 0x0233, 0x00 }, - { IMX_8BIT, 0x0234, 0x00 }, - { IMX_8BIT, 0x0235, 0x40 }, - { IMX_8BIT, 0x0238, 0x00 }, - { IMX_8BIT, 0x0239, 0x04 }, - { IMX_8BIT, 0x023B, 0x00 }, - { IMX_8BIT, 0x023C, 0x01 }, - { IMX_8BIT, 0x33B0, 0x04 }, - { IMX_8BIT, 0x33B1, 0x00 }, - { IMX_8BIT, 0x33B3, 0x00 }, - { IMX_8BIT, 0x33B4, 0x01 }, - { IMX_8BIT, 0x3800, 0x00 }, - { IMX_TOK_TERM, 0, 0 } -}; - -static struct imx_reg const imx134_1568_876_60fps_0625[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - /* mode set clear */ - { IMX_8BIT, 0x3A43, 0x01 }, - /* Clock Setting */ - { IMX_8BIT, 0x011E, 0x13 }, - { IMX_8BIT, 0x011F, 0x33 }, - { IMX_8BIT, 0x0301, 0x05 }, - { IMX_8BIT, 0x0303, 0x01 }, - { IMX_8BIT, 0x0305, 0x0C }, - { IMX_8BIT, 0x0309, 0x05 }, - { IMX_8BIT, 0x030B, 0x01 }, - { IMX_8BIT, 0x030C, 0x01 }, - { IMX_8BIT, 0x030D, 0x8F }, - { IMX_8BIT, 0x030E, 0x01 }, - { IMX_8BIT, 0x3A06, 0x11 }, - - /* Mode setting */ - { IMX_8BIT, 0x0108, 0x03 }, - { IMX_8BIT, 0x0112, 0x0A }, - { IMX_8BIT, 0x0113, 0x0A }, - { IMX_8BIT, 0x0381, 0x01 }, - { IMX_8BIT, 0x0383, 0x01 }, - { IMX_8BIT, 0x0385, 0x01 }, - { IMX_8BIT, 0x0387, 0x01 }, - { IMX_8BIT, 0x0390, 0x01 }, /* binning*/ - { IMX_8BIT, 0x0391, 0x22 }, /* 2x2 binning */ - { IMX_8BIT, 0x0392, 0x00 }, - { IMX_8BIT, 0x0401, 0x00 }, /* H/V resize */ - { IMX_8BIT, 0x0404, 0x00 }, - { IMX_8BIT, 0x0405, 0x10 }, /* down scaling 16/16 = 1 */ - { IMX_8BIT, 0x4082, 0x01 }, - { IMX_8BIT, 0x4083, 0x01 }, - { IMX_8BIT, 0x7006, 0x04 }, - - /* OptionnalFunction settig */ - { IMX_8BIT, 0x0700, 0x00 }, - { IMX_8BIT, 0x3A63, 0x00 }, - { IMX_8BIT, 0x4100, 0xF8 }, - { IMX_8BIT, 0x4203, 0xFF }, - { IMX_8BIT, 0x4344, 0x00 }, - { IMX_8BIT, 0x441C, 0x01 }, - - /* Size setting */ - { IMX_8BIT, 0x0344, 0x00 }, /* x_addr_start[15:8]:72 */ - { IMX_8BIT, 0x0345, 0x48 }, /* x_addr_start[7:0] */ - { IMX_8BIT, 0x0346, 0x01 }, /* y_addr_start[15:8]:356 */ - { IMX_8BIT, 0x0347, 0x64 }, /* y_addr_start[7:0] */ - { IMX_8BIT, 0x0348, 0x0C }, /* x_addr_end[15:8]:3207 */ - { IMX_8BIT, 0x0349, 0x87 }, /* x_addr_end[7:0] */ - { IMX_8BIT, 0x034A, 0x08 }, /* y_addr_end[15:8]:2115 */ - { IMX_8BIT, 0x034B, 0x3B }, /* y_addr_end[7:0] */ - { IMX_8BIT, 0x034C, 0x06 }, /* x_output_size[15:8]:1568 */ - { IMX_8BIT, 0x034D, 0x20 }, /* x_output_size[7:0] */ - { IMX_8BIT, 0x034E, 0x03 }, /* y_output_size[15:8]:880 */ - { IMX_8BIT, 0x034F, 0x6C }, /* y_output_size[7:0] */ - { IMX_8BIT, 0x0350, 0x00 }, - { IMX_8BIT, 0x0351, 0x00 }, - { IMX_8BIT, 0x0352, 0x00 }, - { IMX_8BIT, 0x0353, 0x00 }, - { IMX_8BIT, 0x0354, 0x06 }, - { IMX_8BIT, 0x0355, 0x20 }, - { IMX_8BIT, 0x0356, 0x03 }, - { IMX_8BIT, 0x0357, 0x6C }, - { IMX_8BIT, 0x301D, 0x30 }, - { IMX_8BIT, 0x3310, 0x06 }, - { IMX_8BIT, 0x3311, 0x20 }, - { IMX_8BIT, 0x3312, 0x03 }, - { IMX_8BIT, 0x3313, 0x6C }, - { IMX_8BIT, 0x331C, 0x03 }, - { IMX_8BIT, 0x331D, 0xF2 }, - { IMX_8BIT, 0x4084, 0x00 }, - { IMX_8BIT, 0x4085, 0x00 }, - { IMX_8BIT, 0x4086, 0x00 }, - { IMX_8BIT, 0x4087, 0x00 }, - { IMX_8BIT, 0x4400, 0x00 }, - - /* Global Timing Setting */ - { IMX_8BIT, 0x0830, 0x6F }, - { IMX_8BIT, 0x0831, 0x27 }, - { IMX_8BIT, 0x0832, 0x4F }, - { IMX_8BIT, 0x0833, 0x2F }, - { IMX_8BIT, 0x0834, 0x2F }, - { IMX_8BIT, 0x0835, 0x2F }, - { IMX_8BIT, 0x0836, 0x9F }, - { IMX_8BIT, 0x0837, 0x37 }, - { IMX_8BIT, 0x0839, 0x1F }, - { IMX_8BIT, 0x083A, 0x17 }, - { IMX_8BIT, 0x083B, 0x02 }, - - /* Integration Time Settin */ - { IMX_8BIT, 0x0202, 0x09 }, - { IMX_8BIT, 0x0203, 0xD2 }, - - /* HDR Setting */ - { IMX_8BIT, 0x0230, 0x00 }, - { IMX_8BIT, 0x0231, 0x00 }, - { IMX_8BIT, 0x0233, 0x00 }, - { IMX_8BIT, 0x0234, 0x00 }, - { IMX_8BIT, 0x0235, 0x40 }, - { IMX_8BIT, 0x0238, 0x00 }, - { IMX_8BIT, 0x0239, 0x04 }, - { IMX_8BIT, 0x023B, 0x00 }, - { IMX_8BIT, 0x023C, 0x01 }, - { IMX_8BIT, 0x33B0, 0x04 }, - { IMX_8BIT, 0x33B1, 0x00 }, - { IMX_8BIT, 0x33B3, 0x00 }, - { IMX_8BIT, 0x33B4, 0x01 }, - { IMX_8BIT, 0x3800, 0x00 }, - { IMX_TOK_TERM, 0, 0 } -}; - - -/* 4 lane for 720p dvs, vendor provide */ -static struct imx_reg const imx134_1568_880[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - /* mode set clear */ - { IMX_8BIT, 0x3A43, 0x01 }, - /* Clock Setting */ - { IMX_8BIT, 0x011E, 0x13 }, - { IMX_8BIT, 0x011F, 0x33 }, - { IMX_8BIT, 0x0301, 0x05 }, - { IMX_8BIT, 0x0303, 0x01 }, - { IMX_8BIT, 0x0305, 0x0C }, - { IMX_8BIT, 0x0309, 0x05 }, - { IMX_8BIT, 0x030B, 0x01 }, - { IMX_8BIT, 0x030C, 0x01 }, - { IMX_8BIT, 0x030D, 0xC8 }, - { IMX_8BIT, 0x030E, 0x01 }, - { IMX_8BIT, 0x3A06, 0x11 }, - - /* Mode setting */ - { IMX_8BIT, 0x0108, 0x03 }, - { IMX_8BIT, 0x0112, 0x0A }, - { IMX_8BIT, 0x0113, 0x0A }, - { IMX_8BIT, 0x0381, 0x01 }, - { IMX_8BIT, 0x0383, 0x01 }, - { IMX_8BIT, 0x0385, 0x01 }, - { IMX_8BIT, 0x0387, 0x01 }, - { IMX_8BIT, 0x0390, 0x01 }, /* binning*/ - { IMX_8BIT, 0x0391, 0x22 }, /* 2x2 binning */ - { IMX_8BIT, 0x0392, 0x00 }, - { IMX_8BIT, 0x0401, 0x00 }, /* H/V resize */ - { IMX_8BIT, 0x0404, 0x00 }, - { IMX_8BIT, 0x0405, 0x10 }, /* down scaling 16/16 = 1 */ - { IMX_8BIT, 0x4082, 0x01 }, - { IMX_8BIT, 0x4083, 0x01 }, - { IMX_8BIT, 0x7006, 0x04 }, - - /* OptionnalFunction settig */ - { IMX_8BIT, 0x0700, 0x00 }, - { IMX_8BIT, 0x3A63, 0x00 }, - { IMX_8BIT, 0x4100, 0xF8 }, - { IMX_8BIT, 0x4203, 0xFF }, - { IMX_8BIT, 0x4344, 0x00 }, - { IMX_8BIT, 0x441C, 0x01 }, - - /* Size setting */ - { IMX_8BIT, 0x0344, 0x00 }, /* x_addr_start[15:8]:72 */ - { IMX_8BIT, 0x0345, 0x48 }, /* x_addr_start[7:0] */ - { IMX_8BIT, 0x0346, 0x01 }, /* y_addr_start[15:8]:356 */ - { IMX_8BIT, 0x0347, 0x64 }, /* y_addr_start[7:0] */ - { IMX_8BIT, 0x0348, 0x0C }, /* x_addr_end[15:8]:3207 */ - { IMX_8BIT, 0x0349, 0x87 }, /* x_addr_end[7:0] */ - { IMX_8BIT, 0x034A, 0x08 }, /* y_addr_end[15:8]:2115 */ - { IMX_8BIT, 0x034B, 0x43 }, /* y_addr_end[7:0] */ - { IMX_8BIT, 0x034C, 0x06 }, /* x_output_size[15:8]:1568 */ - { IMX_8BIT, 0x034D, 0x20 }, /* x_output_size[7:0] */ - { IMX_8BIT, 0x034E, 0x03 }, /* y_output_size[15:8]:880 */ - { IMX_8BIT, 0x034F, 0x70 }, /* y_output_size[7:0] */ - { IMX_8BIT, 0x0350, 0x00 }, - { IMX_8BIT, 0x0351, 0x00 }, - { IMX_8BIT, 0x0352, 0x00 }, - { IMX_8BIT, 0x0353, 0x00 }, - { IMX_8BIT, 0x0354, 0x06 }, - { IMX_8BIT, 0x0355, 0x20 }, - { IMX_8BIT, 0x0356, 0x03 }, - { IMX_8BIT, 0x0357, 0x70 }, - { IMX_8BIT, 0x301D, 0x30 }, - { IMX_8BIT, 0x3310, 0x06 }, - { IMX_8BIT, 0x3311, 0x20 }, - { IMX_8BIT, 0x3312, 0x03 }, - { IMX_8BIT, 0x3313, 0x70 }, - { IMX_8BIT, 0x331C, 0x03 }, - { IMX_8BIT, 0x331D, 0xF2 }, - { IMX_8BIT, 0x4084, 0x00 }, - { IMX_8BIT, 0x4085, 0x00 }, - { IMX_8BIT, 0x4086, 0x00 }, - { IMX_8BIT, 0x4087, 0x00 }, - { IMX_8BIT, 0x4400, 0x00 }, - - /* Global Timing Setting */ - { IMX_8BIT, 0x0830, 0x77 }, - { IMX_8BIT, 0x0831, 0x2F }, - { IMX_8BIT, 0x0832, 0x5F }, - { IMX_8BIT, 0x0833, 0x37 }, - { IMX_8BIT, 0x0834, 0x37 }, - { IMX_8BIT, 0x0835, 0x37 }, - { IMX_8BIT, 0x0836, 0xBF }, - { IMX_8BIT, 0x0837, 0x3F }, - { IMX_8BIT, 0x0839, 0x1F }, - { IMX_8BIT, 0x083A, 0x17 }, - { IMX_8BIT, 0x083B, 0x02 }, - - - /* Integration Time Settin */ - { IMX_8BIT, 0x0202, 0x09 }, - { IMX_8BIT, 0x0203, 0xD2 }, - - /* HDR Setting */ - { IMX_8BIT, 0x0230, 0x00 }, - { IMX_8BIT, 0x0231, 0x00 }, - { IMX_8BIT, 0x0233, 0x00 }, - { IMX_8BIT, 0x0234, 0x00 }, - { IMX_8BIT, 0x0235, 0x40 }, - { IMX_8BIT, 0x0238, 0x00 }, - { IMX_8BIT, 0x0239, 0x04 }, - { IMX_8BIT, 0x023B, 0x00 }, - { IMX_8BIT, 0x023C, 0x01 }, - { IMX_8BIT, 0x33B0, 0x04 }, - { IMX_8BIT, 0x33B1, 0x00 }, - { IMX_8BIT, 0x33B3, 0x00 }, - { IMX_8BIT, 0x33B4, 0x01 }, - { IMX_8BIT, 0x3800, 0x00 }, - { IMX_TOK_TERM, 0, 0 } -}; -/* 4 lane for 480p dvs, default 60fps, vendor provide */ -static struct imx_reg const imx134_880_592[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - /* mode set clear */ - { IMX_8BIT, 0x3A43, 0x01 }, - /* Clock Setting */ - { IMX_8BIT, 0x011E, 0x13 }, - { IMX_8BIT, 0x011F, 0x33 }, - { IMX_8BIT, 0x0301, 0x05 }, - { IMX_8BIT, 0x0303, 0x01 }, - { IMX_8BIT, 0x0305, 0x0C }, - { IMX_8BIT, 0x0309, 0x05 }, - { IMX_8BIT, 0x030B, 0x01 }, - { IMX_8BIT, 0x030C, 0x01 }, - { IMX_8BIT, 0x030D, 0xC8 }, - { IMX_8BIT, 0x030E, 0x01 }, - { IMX_8BIT, 0x3A06, 0x11 }, - - /* Mode setting */ - { IMX_8BIT, 0x0108, 0x03 }, - { IMX_8BIT, 0x0112, 0x0A }, - { IMX_8BIT, 0x0113, 0x0A }, - { IMX_8BIT, 0x0381, 0x01 }, - { IMX_8BIT, 0x0383, 0x01 }, - { IMX_8BIT, 0x0385, 0x01 }, - { IMX_8BIT, 0x0387, 0x01 }, - { IMX_8BIT, 0x0390, 0x01 }, /* binning*/ - { IMX_8BIT, 0x0391, 0x22 }, /* 2x2 binning */ - { IMX_8BIT, 0x0392, 0x00 }, - { IMX_8BIT, 0x0401, 0x02 }, /* H/V resize */ - { IMX_8BIT, 0x0404, 0x00 }, - { IMX_8BIT, 0x0405, 0x1D }, /* downscaling ratio = 16/29 */ - { IMX_8BIT, 0x4082, 0x00 }, - { IMX_8BIT, 0x4083, 0x00 }, - { IMX_8BIT, 0x7006, 0x04 }, - - /* OptionnalFunction settig */ - { IMX_8BIT, 0x0700, 0x00 }, - { IMX_8BIT, 0x3A63, 0x00 }, - { IMX_8BIT, 0x4100, 0xF8 }, - { IMX_8BIT, 0x4203, 0xFF }, - { IMX_8BIT, 0x4344, 0x00 }, - { IMX_8BIT, 0x441C, 0x01 }, - - /* Size setting */ - { IMX_8BIT, 0x0344, 0x00 }, /* x_addr_start[15:8]:44 */ - { IMX_8BIT, 0x0345, 0x2C }, /* x_addr_start[7:0] */ - { IMX_8BIT, 0x0346, 0x00 }, /* y_addr_start[15:8]:160 */ - { IMX_8BIT, 0x0347, 0xA0 }, /* y_addr_start[7:0] */ - { IMX_8BIT, 0x0348, 0x0C }, /* x_addr_end[15:8]:3235 */ - { IMX_8BIT, 0x0349, 0xA3 }, /* x_addr_end[7:0] */ - { IMX_8BIT, 0x034A, 0x09 }, /* y_addr_end[15:8]:2307 */ - { IMX_8BIT, 0x034B, 0x03 }, /* y_addr_end[7:0] */ - { IMX_8BIT, 0x034C, 0x03 }, /* x_output_size[15:8]:880 */ - { IMX_8BIT, 0x034D, 0x70 }, /* x_output_size[7:0] */ - { IMX_8BIT, 0x034E, 0x02 }, /* y_output_size[15:8]:592 */ - { IMX_8BIT, 0x034F, 0x50 }, /* y_output_size[7:0] */ - { IMX_8BIT, 0x0350, 0x00 }, - { IMX_8BIT, 0x0351, 0x00 }, - { IMX_8BIT, 0x0352, 0x00 }, - { IMX_8BIT, 0x0353, 0x00 }, - { IMX_8BIT, 0x0354, 0x06 }, - { IMX_8BIT, 0x0355, 0x3C }, - { IMX_8BIT, 0x0356, 0x04 }, - { IMX_8BIT, 0x0357, 0x32 }, - { IMX_8BIT, 0x301D, 0x30 }, - { IMX_8BIT, 0x3310, 0x03 }, - { IMX_8BIT, 0x3311, 0x70 }, - { IMX_8BIT, 0x3312, 0x02 }, - { IMX_8BIT, 0x3313, 0x50 }, - { IMX_8BIT, 0x331C, 0x04 }, - { IMX_8BIT, 0x331D, 0x4C }, - { IMX_8BIT, 0x4084, 0x03 }, - { IMX_8BIT, 0x4085, 0x70 }, - { IMX_8BIT, 0x4086, 0x02 }, - { IMX_8BIT, 0x4087, 0x50 }, - { IMX_8BIT, 0x4400, 0x00 }, - - /* Global Timing Setting */ - { IMX_8BIT, 0x0830, 0x77 }, - { IMX_8BIT, 0x0831, 0x2F }, - { IMX_8BIT, 0x0832, 0x5F }, - { IMX_8BIT, 0x0833, 0x37 }, - { IMX_8BIT, 0x0834, 0x37 }, - { IMX_8BIT, 0x0835, 0x37 }, - { IMX_8BIT, 0x0836, 0xBF }, - { IMX_8BIT, 0x0837, 0x3F }, - { IMX_8BIT, 0x0839, 0x1F }, - { IMX_8BIT, 0x083A, 0x17 }, - { IMX_8BIT, 0x083B, 0x02 }, - - - /* Integration Time Settin */ - { IMX_8BIT, 0x0202, 0x05 }, - { IMX_8BIT, 0x0203, 0x42 }, - - /* HDR Setting */ - { IMX_8BIT, 0x0230, 0x00 }, - { IMX_8BIT, 0x0231, 0x00 }, - { IMX_8BIT, 0x0233, 0x00 }, - { IMX_8BIT, 0x0234, 0x00 }, - { IMX_8BIT, 0x0235, 0x40 }, - { IMX_8BIT, 0x0238, 0x00 }, - { IMX_8BIT, 0x0239, 0x04 }, - { IMX_8BIT, 0x023B, 0x00 }, - { IMX_8BIT, 0x023C, 0x01 }, - { IMX_8BIT, 0x33B0, 0x04 }, - { IMX_8BIT, 0x33B1, 0x00 }, - { IMX_8BIT, 0x33B3, 0x00 }, - { IMX_8BIT, 0x33B4, 0x01 }, - { IMX_8BIT, 0x3800, 0x00 }, - { IMX_TOK_TERM, 0, 0 } -}; -static struct imx_reg const imx134_2336_1308_60fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - /* mode set clear */ - { IMX_8BIT, 0x3A43, 0x01 }, - /* Clock Setting */ - { IMX_8BIT, 0x011E, 0x13 }, - { IMX_8BIT, 0x011F, 0x33 }, - { IMX_8BIT, 0x0301, 0x05 }, - { IMX_8BIT, 0x0303, 0x01 }, - { IMX_8BIT, 0x0305, 0x0C }, - { IMX_8BIT, 0x0309, 0x05 }, - { IMX_8BIT, 0x030B, 0x01 }, - { IMX_8BIT, 0x030C, 0x01 }, - { IMX_8BIT, 0x030D, 0xC8 }, - { IMX_8BIT, 0x030E, 0x01 }, - { IMX_8BIT, 0x3A06, 0x11 }, - - /* Mode setting */ - { IMX_8BIT, 0x0108, 0x03 }, - { IMX_8BIT, 0x0112, 0x0A }, - { IMX_8BIT, 0x0113, 0x0A }, - { IMX_8BIT, 0x0381, 0x01 }, - { IMX_8BIT, 0x0383, 0x01 }, - { IMX_8BIT, 0x0385, 0x01 }, - { IMX_8BIT, 0x0387, 0x01 }, - { IMX_8BIT, 0x0390, 0x00 }, /* binning*/ - { IMX_8BIT, 0x0391, 0x11 }, /* 2x2 binning */ - { IMX_8BIT, 0x0392, 0x00 }, - { IMX_8BIT, 0x0401, 0x00 }, /* H/V resize */ - { IMX_8BIT, 0x0404, 0x00 }, - { IMX_8BIT, 0x0405, 0x10 }, /* down scaling 16/16 = 1 */ - { IMX_8BIT, 0x4082, 0x01 }, - { IMX_8BIT, 0x4083, 0x01 }, - { IMX_8BIT, 0x7006, 0x04 }, - - /* OptionnalFunction settig */ - { IMX_8BIT, 0x0700, 0x00 }, - { IMX_8BIT, 0x3A63, 0x00 }, - { IMX_8BIT, 0x4100, 0xF8 }, - { IMX_8BIT, 0x4203, 0xFF }, - { IMX_8BIT, 0x4344, 0x00 }, - { IMX_8BIT, 0x441C, 0x01 }, - - /* Size setting */ - { IMX_8BIT, 0x0344, 0x01 }, /* x_addr_start[15:8]:72 */ - { IMX_8BIT, 0x0345, 0xD8 }, /* x_addr_start[7:0] */ - { IMX_8BIT, 0x0346, 0x02 }, /* y_addr_start[15:8]:356 */ - { IMX_8BIT, 0x0347, 0x44 }, /* y_addr_start[7:0] */ - { IMX_8BIT, 0x0348, 0x0A }, /* x_addr_end[15:8]:3207 */ - { IMX_8BIT, 0x0349, 0xF7 }, /* x_addr_end[7:0] */ - { IMX_8BIT, 0x034A, 0x07 }, /* y_addr_end[15:8]:2107 */ - { IMX_8BIT, 0x034B, 0x5F+4 }, /* y_addr_end[7:0] */ - { IMX_8BIT, 0x034C, 0x09 }, /* x_output_size[15:8]:1568 */ - { IMX_8BIT, 0x034D, 0x20 }, /* x_output_size[7:0] */ - { IMX_8BIT, 0x034E, 0x05 }, /* y_output_size[15:8]:876 */ - { IMX_8BIT, 0x034F, 0x1C+4 }, /* y_output_size[7:0] */ - { IMX_8BIT, 0x0350, 0x00 }, - { IMX_8BIT, 0x0351, 0x00 }, - { IMX_8BIT, 0x0352, 0x00 }, - { IMX_8BIT, 0x0353, 0x00 }, - { IMX_8BIT, 0x0354, 0x09 }, - { IMX_8BIT, 0x0355, 0x20 }, - { IMX_8BIT, 0x0356, 0x05 }, - { IMX_8BIT, 0x0357, 0x1C+4 }, - { IMX_8BIT, 0x301D, 0x30 }, - { IMX_8BIT, 0x3310, 0x09 }, - { IMX_8BIT, 0x3311, 0x20 }, - { IMX_8BIT, 0x3312, 0x05 }, - { IMX_8BIT, 0x3313, 0x1C+4 }, - { IMX_8BIT, 0x331C, 0x03 }, - { IMX_8BIT, 0x331D, 0xE8 }, - { IMX_8BIT, 0x4084, 0x00 }, - { IMX_8BIT, 0x4085, 0x00 }, - { IMX_8BIT, 0x4086, 0x00 }, - { IMX_8BIT, 0x4087, 0x00 }, - { IMX_8BIT, 0x4400, 0x00 }, - - /* Global Timing Setting */ - { IMX_8BIT, 0x0830, 0x77 }, - { IMX_8BIT, 0x0831, 0x2F }, - { IMX_8BIT, 0x0832, 0x5F }, - { IMX_8BIT, 0x0833, 0x37 }, - { IMX_8BIT, 0x0834, 0x37 }, - { IMX_8BIT, 0x0835, 0x37 }, - { IMX_8BIT, 0x0836, 0xBF }, - { IMX_8BIT, 0x0837, 0x3F }, - { IMX_8BIT, 0x0839, 0x1F }, - { IMX_8BIT, 0x083A, 0x17 }, - { IMX_8BIT, 0x083B, 0x02 }, - - /* Integration Time Settin */ - { IMX_8BIT, 0x0202, 0x05 }, - { IMX_8BIT, 0x0203, 0x42 }, - - /* HDR Setting */ - { IMX_8BIT, 0x0230, 0x00 }, - { IMX_8BIT, 0x0231, 0x00 }, - { IMX_8BIT, 0x0233, 0x00 }, - { IMX_8BIT, 0x0234, 0x00 }, - { IMX_8BIT, 0x0235, 0x40 }, - { IMX_8BIT, 0x0238, 0x00 }, - { IMX_8BIT, 0x0239, 0x04 }, - { IMX_8BIT, 0x023B, 0x00 }, - { IMX_8BIT, 0x023C, 0x01 }, - { IMX_8BIT, 0x33B0, 0x04 }, - { IMX_8BIT, 0x33B1, 0x00 }, - { IMX_8BIT, 0x33B3, 0x00 }, - { IMX_8BIT, 0x33B4, 0x01 }, - { IMX_8BIT, 0x3800, 0x00 }, - { IMX_TOK_TERM, 0, 0 } -}; - -struct imx_resolution imx134_res_preview[] = { - { - .desc = "imx134_CIF_30fps", - .regs = imx134_720_592_30fps, - .width = 720, - .height = 592, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 3600, - .lines_per_frame = 2518, - }, - { - } - }, - .bin_factor_x = 2, - .bin_factor_y = 2, - .used = 0, - }, - { - .desc = "imx134_820_552_30fps_preview", - .regs = imx134_820_552_30fps, - .width = 820, - .height = 552, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 3600, - .lines_per_frame = 2518, - }, - { - } - }, - .bin_factor_x = 2, - .bin_factor_y = 2, - .used = 0, - }, - { - .desc = "imx134_820_616_preview_30fps", - .regs = imx134_820_616_30fps, - .width = 820, - .height = 616, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 3600, - .lines_per_frame = 2518, - }, - { - } - }, - .bin_factor_x = 2, - .bin_factor_y = 2, - .used = 0, - }, - { - .desc = "imx134_1080p_preview_30fps", - .regs = imx134_1936_1096_30fps_v2, - .width = 1936, - .height = 1096, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 3600, - .lines_per_frame = 2518, - }, - { - } - }, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - }, - { - .desc = "imx134_1640_1232_preview_30fps", - .regs = imx134_1640_1232_30fps, - .width = 1640, - .height = 1232, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 3600, - .lines_per_frame = 2518, - }, - { - } - }, - .bin_factor_x = 1, - .bin_factor_y = 1, - .used = 0, - }, - { - .desc = "imx134_8M_preview_30fps", - .regs = imx134_8M_30fps, - .width = 3280, - .height = 2464, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 3600, - .lines_per_frame = 2518, - }, - { - } - }, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - }, -}; - -struct imx_resolution imx134_res_still[] = { - { - .desc = "imx134_CIF_30fps", - .regs = imx134_1424_1168_30fps, - .width = 1424, - .height = 1168, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 3600, - .lines_per_frame = 2518, - }, - { - } - }, - .bin_factor_x = 1, - .bin_factor_y = 1, - .used = 0, - }, - { - .desc = "imx134_VGA_still_30fps", - .regs = imx134_1640_1232_30fps, - .width = 1640, - .height = 1232, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 3600, - .lines_per_frame = 2518, - }, - { - } - }, - .bin_factor_x = 1, - .bin_factor_y = 1, - .used = 0, - }, - { - .desc = "imx134_1080p_still_30fps", - .regs = imx134_1936_1096_30fps_v2, - .width = 1936, - .height = 1096, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 3600, - .lines_per_frame = 2518, - }, - { - } - }, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - }, - { - .desc = "imx134_1640_1232_still_30fps", - .regs = imx134_1640_1232_30fps, - .width = 1640, - .height = 1232, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 3600, - .lines_per_frame = 2518, - }, - { - } - }, - .bin_factor_x = 1, - .bin_factor_y = 1, - .used = 0, - }, - { - .desc = "imx134_8M_still_30fps", - .regs = imx134_8M_30fps, - .width = 3280, - .height = 2464, - .fps_options = { - { - /* WORKAROUND for FW performance limitation */ - .fps = 8, - .pixels_per_line = 6400, - .lines_per_frame = 5312, - }, - { - .fps = 30, - .pixels_per_line = 3600, - .lines_per_frame = 2518, - }, - { - } - }, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - }, -}; - -struct imx_resolution imx134_res_video[] = { - { - .desc = "imx134_QCIF_DVS_30fps", - .regs = imx134_240_196_30fps, - .width = 240, - .height = 196, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 3600, - .lines_per_frame = 2518, - }, - { - } - }, - .bin_factor_x = 2, - .bin_factor_y = 2, - .used = 0, - }, - { - .desc = "imx134_CIF_DVS_30fps", - .regs = imx134_448_366_30fps, - .width = 448, - .height = 366, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 3600, - .lines_per_frame = 2518, - }, - { - } - }, - .bin_factor_x = 1, - .bin_factor_y = 1, - .used = 0, - }, - { - .desc = "imx134_VGA_30fps", - .regs = imx134_820_616_30fps, - .width = 820, - .height = 616, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 3600, - .lines_per_frame = 2518, - }, - { - } - }, - .bin_factor_x = 2, - .bin_factor_y = 2, - .used = 0, - }, - { - .desc = "imx134_480p", - .regs = imx134_880_592, - .width = 880, - .height = 592, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 3600, - .lines_per_frame = 2700, - }, - { - .fps = 60, - .pixels_per_line = 3600, - .lines_per_frame = 1350, - }, - { - } - }, - .bin_factor_x = 1, - .bin_factor_y = 1, - .used = 0, - }, - { - .desc = "imx134_1568_880", - .regs = imx134_1568_880, - .width = 1568, - .height = 880, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 3600, - .lines_per_frame = 2700, - }, - { - .fps = 60, - .pixels_per_line = 3600, - .lines_per_frame = 1350, - }, - { - } - }, - .bin_factor_x = 1, - .bin_factor_y = 1, - .used = 0, - }, - { - .desc = "imx134_1080p_dvs_30fps", - .regs = imx134_2336_1312_30fps, - .width = 2336, - .height = 1312, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 3600, - .lines_per_frame = 2518, - }, - { - } - }, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - }, - { - .desc = "imx134_1080p_dvs_60fps", - .regs = imx134_2336_1308_60fps, - .width = 2336, - .height = 1312, - .fps_options = { - { - .fps = 60, - .pixels_per_line = 3600, - .lines_per_frame = 1350, - }, - { - } - }, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - }, - { - /*This setting only be used for SDV mode*/ - .desc = "imx134_8M_sdv_30fps", - .regs = imx134_8M_30fps, - .width = 3280, - .height = 2464, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 3600, - .lines_per_frame = 2518, - }, - { - } - }, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - }, -}; - -#endif - diff --git a/drivers/staging/media/atomisp/i2c/imx/imx135.h b/drivers/staging/media/atomisp/i2c/imx/imx135.h deleted file mode 100644 index 58b43af909f2..000000000000 --- a/drivers/staging/media/atomisp/i2c/imx/imx135.h +++ /dev/null @@ -1,3374 +0,0 @@ -/* - * Support for Sony IMX camera sensor. - * - * Copyright (c) 2010 Intel Corporation. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. - * - */ - -#ifndef __IMX135_H__ -#define __IMX135_H__ - -#include "common.h" - -#define IMX_SC_CMMN_CHIP_ID_H 0x0016 -#define IMX_SC_CMMN_CHIP_ID_L 0x0017 - -/* - * focal length bits definition: - * bits 31-16: numerator, bits 15-0: denominator - */ -#define IMX_FOCAL_LENGTH_DEFAULT 0x1710064 - -/* - * current f-number bits definition: - * bits 31-16: numerator, bits 15-0: denominator - */ -#define IMX_F_NUMBER_DEFAULT 0x16000a - -/* - * f-number range bits definition: - * bits 31-24: max f-number numerator - * bits 23-16: max f-number denominator - * bits 15-8: min f-number numerator - * bits 7-0: min f-number denominator - */ -#define IMX_F_NUMBER_RANGE 0x160a160a - -#define GROUPED_PARAMETER_HOLD_ENABLE {IMX_8BIT, 0x0104, 0x1} -#define GROUPED_PARAMETER_HOLD_DISABLE {IMX_8BIT, 0x0104, 0x0} - -#define IMX135_EMBEDDED_DATA_LINE_NUM 2 -#define IMX135_OUTPUT_DATA_FORMAT_REG 0x0112 -#define IMX135_OUTPUT_FORMAT_RAW10 0x0a0a -/* - * We use three different MIPI rates for our modes based on the resolution and - * FPS requirements. So we have three PLL configurationa and these are based - * on the EMC friendly MIPI values. - * - * Maximum clock: Pix clock @ 360.96MHz MIPI @ 451.2MHz 902.4mbps - * Reduced clock: Pix clock @ 273.00MHz MIPI @ 342.0MHz 684.0mbps - * Binning modes: Pix clock @ 335.36MHz MIPI @ 209.6MHz 419.2mbps - * Global Timing registers are based on the data rates and these are part of - * the below clock definitions. - */ -/* MIPI 499.2MHz 998.4mbps PIXCLK: 399.36MHz */ -#define PLL_SETTINGS_FOR_MIPI_499_2MHZ_SALTBAY \ - {IMX_8BIT, 0x011e, 0x13}, \ - {IMX_8BIT, 0x011f, 0x33}, \ - {IMX_8BIT, 0x0301, 0x05}, \ - {IMX_8BIT, 0x0303, 0x01}, \ - {IMX_8BIT, 0x0305, 0x0c}, \ - {IMX_8BIT, 0x0309, 0x05}, \ - {IMX_8BIT, 0x030b, 0x01}, \ - {IMX_8BIT, 0x030c, 0x02}, \ - {IMX_8BIT, 0x030d, 0x70}, \ - {IMX_8BIT, 0x030e, 0x01}, \ - {IMX_8BIT, 0x3a06, 0x11}, \ - {IMX_8BIT, 0x0830, 0x7f}, \ - {IMX_8BIT, 0x0831, 0x37}, \ - {IMX_8BIT, 0x0832, 0x67}, \ - {IMX_8BIT, 0x0833, 0x3f}, \ - {IMX_8BIT, 0x0834, 0x3f}, \ - {IMX_8BIT, 0x0835, 0x47}, \ - {IMX_8BIT, 0x0836, 0xdf}, \ - {IMX_8BIT, 0x0837, 0x47}, \ - {IMX_8BIT, 0x0839, 0x1f}, \ - {IMX_8BIT, 0x083a, 0x17}, \ - {IMX_8BIT, 0x083b, 0x02} - -/* MIPI 451.2MHz 902.4mbps PIXCLK: 360.96MHz */ -#define PLL_SETTINGS_FOR_MIPI_451_2MHZ_SALTBAY \ - {IMX_8BIT, 0x011e, 0x13}, \ - {IMX_8BIT, 0x011f, 0x33}, \ - {IMX_8BIT, 0x0301, 0x05}, \ - {IMX_8BIT, 0x0303, 0x01}, \ - {IMX_8BIT, 0x0305, 0x0c}, \ - {IMX_8BIT, 0x0309, 0x05}, \ - {IMX_8BIT, 0x030b, 0x01}, \ - {IMX_8BIT, 0x030c, 0x02}, \ - {IMX_8BIT, 0x030d, 0x34}, \ - {IMX_8BIT, 0x030e, 0x01}, \ - {IMX_8BIT, 0x3a06, 0x11}, \ - {IMX_8BIT, 0x0830, 0x7f}, \ - {IMX_8BIT, 0x0831, 0x37}, \ - {IMX_8BIT, 0x0832, 0x67}, \ - {IMX_8BIT, 0x0833, 0x3f}, \ - {IMX_8BIT, 0x0834, 0x3f}, \ - {IMX_8BIT, 0x0835, 0x47}, \ - {IMX_8BIT, 0x0836, 0xdf}, \ - {IMX_8BIT, 0x0837, 0x47}, \ - {IMX_8BIT, 0x0839, 0x1f}, \ - {IMX_8BIT, 0x083a, 0x17}, \ - {IMX_8BIT, 0x083b, 0x02} - -/* MIPI 209.6MHz, 419.2mbps PIXCLK: 335.36 MHz */ -#define PLL_SETTINGS_FOR_MIPI_209_6MHZ_SALTBAY \ - {IMX_8BIT, 0x011e, 0x13}, \ - {IMX_8BIT, 0x011f, 0x33}, \ - {IMX_8BIT, 0x0301, 0x05}, \ - {IMX_8BIT, 0x0303, 0x01}, \ - {IMX_8BIT, 0x0305, 0x06}, \ - {IMX_8BIT, 0x0309, 0x05}, \ - {IMX_8BIT, 0x030b, 0x02}, \ - {IMX_8BIT, 0x030c, 0x01}, \ - {IMX_8BIT, 0x030d, 0x06}, \ - {IMX_8BIT, 0x030e, 0x01}, \ - {IMX_8BIT, 0x3a06, 0x12}, \ - {IMX_8BIT, 0x0830, 0x5f}, \ - {IMX_8BIT, 0x0831, 0x1f}, \ - {IMX_8BIT, 0x0832, 0x3f}, \ - {IMX_8BIT, 0x0833, 0x1f}, \ - {IMX_8BIT, 0x0834, 0x1f}, \ - {IMX_8BIT, 0x0835, 0x17}, \ - {IMX_8BIT, 0x0836, 0x67}, \ - {IMX_8BIT, 0x0837, 0x27}, \ - {IMX_8BIT, 0x0839, 0x1f}, \ - {IMX_8BIT, 0x083a, 0x17}, \ - {IMX_8BIT, 0x083b, 0x02} - -/* MIPI 342MHz 684mbps PIXCLK: 273.6MHz */ -#define PLL_SETTINGS_FOR_MIPI_342MHZ_SALTBAY \ - {IMX_8BIT, 0x011e, 0x13}, \ - {IMX_8BIT, 0x011f, 0x33}, \ - {IMX_8BIT, 0x0301, 0x05}, \ - {IMX_8BIT, 0x0303, 0x01}, \ - {IMX_8BIT, 0x0305, 0x08}, \ - {IMX_8BIT, 0x0309, 0x05}, \ - {IMX_8BIT, 0x030b, 0x01}, \ - {IMX_8BIT, 0x030c, 0x01}, \ - {IMX_8BIT, 0x030d, 0x1d}, \ - {IMX_8BIT, 0x030e, 0x01}, \ - {IMX_8BIT, 0x3a06, 0x11}, \ - {IMX_8BIT, 0x0830, 0x77}, \ - {IMX_8BIT, 0x0831, 0x2f}, \ - {IMX_8BIT, 0x0832, 0x4f}, \ - {IMX_8BIT, 0x0833, 0x37}, \ - {IMX_8BIT, 0x0834, 0x2f}, \ - {IMX_8BIT, 0x0835, 0x37}, \ - {IMX_8BIT, 0x0836, 0xa7}, \ - {IMX_8BIT, 0x0837, 0x37}, \ - {IMX_8BIT, 0x0839, 0x1f}, \ - {IMX_8BIT, 0x083a, 0x17}, \ - {IMX_8BIT, 0x083b, 0x02} - -/* Basic settings: Applied only once after the sensor power up */ -static struct imx_reg const imx135_init_settings[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - { IMX_8BIT, 0x0220, 0x01}, - { IMX_8BIT, 0x3008, 0xB0}, - { IMX_8BIT, 0x320A, 0x01}, - { IMX_8BIT, 0x320D, 0x10}, - { IMX_8BIT, 0x3216, 0x2E}, - { IMX_8BIT, 0x3230, 0x0A}, - { IMX_8BIT, 0x3228, 0x05}, - { IMX_8BIT, 0x3229, 0x02}, - { IMX_8BIT, 0x322C, 0x02}, - { IMX_8BIT, 0x3302, 0x10}, - { IMX_8BIT, 0x3390, 0x45}, - { IMX_8BIT, 0x3409, 0x0C}, - { IMX_8BIT, 0x340B, 0xF5}, - { IMX_8BIT, 0x340C, 0x2D}, - { IMX_8BIT, 0x3412, 0x41}, - { IMX_8BIT, 0x3413, 0xAD}, - { IMX_8BIT, 0x3414, 0x1E}, - { IMX_8BIT, 0x3427, 0x04}, - { IMX_8BIT, 0x3480, 0x1E}, - { IMX_8BIT, 0x3484, 0x1E}, - { IMX_8BIT, 0x3488, 0x1E}, - { IMX_8BIT, 0x348C, 0x1E}, - { IMX_8BIT, 0x3490, 0x1E}, - { IMX_8BIT, 0x3494, 0x1E}, - { IMX_8BIT, 0x349C, 0x38}, - { IMX_8BIT, 0x34A3, 0x38}, - { IMX_8BIT, 0x3511, 0x8F}, - { IMX_8BIT, 0x3518, 0x00}, - { IMX_8BIT, 0x3519, 0x94}, - { IMX_8BIT, 0x3833, 0x20}, - { IMX_8BIT, 0x3893, 0x01}, - { IMX_8BIT, 0x38C2, 0x08}, - { IMX_8BIT, 0x38C3, 0x08}, - { IMX_8BIT, 0x3C09, 0x01}, - { IMX_8BIT, 0x4000, 0x0E}, - { IMX_8BIT, 0x4300, 0x00}, - { IMX_8BIT, 0x4316, 0x12}, - { IMX_8BIT, 0x4317, 0x22}, - { IMX_8BIT, 0x4318, 0x00}, - { IMX_8BIT, 0x4319, 0x00}, - { IMX_8BIT, 0x431A, 0x00}, - { IMX_8BIT, 0x4324, 0x03}, - { IMX_8BIT, 0x4325, 0x20}, - { IMX_8BIT, 0x4326, 0x03}, - { IMX_8BIT, 0x4327, 0x84}, - { IMX_8BIT, 0x4328, 0x03}, - { IMX_8BIT, 0x4329, 0x20}, - { IMX_8BIT, 0x432A, 0x03}, - { IMX_8BIT, 0x432B, 0x84}, - { IMX_8BIT, 0x432C, 0x01}, - { IMX_8BIT, 0x4401, 0x3F}, - { IMX_8BIT, 0x4402, 0xFF}, - { IMX_8BIT, 0x4412, 0x3F}, - { IMX_8BIT, 0x4413, 0xFF}, - { IMX_8BIT, 0x441D, 0x28}, - { IMX_8BIT, 0x4444, 0x00}, - { IMX_8BIT, 0x4445, 0x00}, - { IMX_8BIT, 0x4446, 0x3F}, - { IMX_8BIT, 0x4447, 0xFF}, - { IMX_8BIT, 0x4452, 0x00}, - { IMX_8BIT, 0x4453, 0xA0}, - { IMX_8BIT, 0x4454, 0x08}, - { IMX_8BIT, 0x4455, 0x00}, - { IMX_8BIT, 0x4458, 0x18}, - { IMX_8BIT, 0x4459, 0x18}, - { IMX_8BIT, 0x445A, 0x3F}, - { IMX_8BIT, 0x445B, 0x3A}, - { IMX_8BIT, 0x4462, 0x00}, - { IMX_8BIT, 0x4463, 0x00}, - { IMX_8BIT, 0x4464, 0x00}, - { IMX_8BIT, 0x4465, 0x00}, - { IMX_8BIT, 0x446E, 0x01}, - { IMX_8BIT, 0x4500, 0x1F}, - { IMX_8BIT, 0x600a, 0x00}, - { IMX_8BIT, 0x380a, 0x00}, - { IMX_8BIT, 0x380b, 0x00}, - { IMX_8BIT, 0x4103, 0x00}, - { IMX_8BIT, 0x4243, 0x9a}, - { IMX_8BIT, 0x4330, 0x01}, - { IMX_8BIT, 0x4331, 0x90}, - { IMX_8BIT, 0x4332, 0x02}, - { IMX_8BIT, 0x4333, 0x58}, - { IMX_8BIT, 0x4334, 0x03}, - { IMX_8BIT, 0x4335, 0x20}, - { IMX_8BIT, 0x4336, 0x03}, - { IMX_8BIT, 0x4337, 0x84}, - { IMX_8BIT, 0x433C, 0x01}, - { IMX_8BIT, 0x4340, 0x02}, - { IMX_8BIT, 0x4341, 0x58}, - { IMX_8BIT, 0x4342, 0x03}, - { IMX_8BIT, 0x4343, 0x52}, - { IMX_8BIT, 0x4364, 0x0b}, - { IMX_8BIT, 0x4368, 0x00}, - { IMX_8BIT, 0x4369, 0x0f}, - { IMX_8BIT, 0x436a, 0x03}, - { IMX_8BIT, 0x436b, 0xa8}, - { IMX_8BIT, 0x436c, 0x00}, - { IMX_8BIT, 0x436d, 0x00}, - { IMX_8BIT, 0x436e, 0x00}, - { IMX_8BIT, 0x436f, 0x06}, - { IMX_8BIT, 0x4281, 0x21}, - { IMX_8BIT, 0x4282, 0x18}, - { IMX_8BIT, 0x4283, 0x04}, - { IMX_8BIT, 0x4284, 0x08}, - { IMX_8BIT, 0x4287, 0x7f}, - { IMX_8BIT, 0x4288, 0x08}, - { IMX_8BIT, 0x428c, 0x08}, - { IMX_8BIT, 0x4297, 0x00}, - { IMX_8BIT, 0x4299, 0x7E}, - { IMX_8BIT, 0x42A4, 0xFB}, - { IMX_8BIT, 0x42A5, 0x7E}, - { IMX_8BIT, 0x42A6, 0xDF}, - { IMX_8BIT, 0x42A7, 0xB7}, - { IMX_8BIT, 0x42AF, 0x03}, - { IMX_8BIT, 0x4207, 0x03}, - { IMX_8BIT, 0x4218, 0x00}, - { IMX_8BIT, 0x421B, 0x20}, - { IMX_8BIT, 0x421F, 0x04}, - { IMX_8BIT, 0x4222, 0x02}, - { IMX_8BIT, 0x4223, 0x22}, - { IMX_8BIT, 0x422E, 0x54}, - { IMX_8BIT, 0x422F, 0xFB}, - { IMX_8BIT, 0x4230, 0xFF}, - { IMX_8BIT, 0x4231, 0xFE}, - { IMX_8BIT, 0x4232, 0xFF}, - { IMX_8BIT, 0x4235, 0x58}, - { IMX_8BIT, 0x4236, 0xF7}, - { IMX_8BIT, 0x4237, 0xFD}, - { IMX_8BIT, 0x4239, 0x4E}, - { IMX_8BIT, 0x423A, 0xFC}, - { IMX_8BIT, 0x423B, 0xFD}, - { IMX_8BIT, 0x4300, 0x00}, - { IMX_8BIT, 0x4316, 0x12}, - { IMX_8BIT, 0x4317, 0x22}, - { IMX_8BIT, 0x4318, 0x00}, - { IMX_8BIT, 0x4319, 0x00}, - { IMX_8BIT, 0x431A, 0x00}, - { IMX_8BIT, 0x4324, 0x03}, - { IMX_8BIT, 0x4325, 0x20}, - { IMX_8BIT, 0x4326, 0x03}, - { IMX_8BIT, 0x4327, 0x84}, - { IMX_8BIT, 0x4328, 0x03}, - { IMX_8BIT, 0x4329, 0x20}, - { IMX_8BIT, 0x432A, 0x03}, - { IMX_8BIT, 0x432B, 0x20}, - { IMX_8BIT, 0x432C, 0x01}, - { IMX_8BIT, 0x432D, 0x01}, - { IMX_8BIT, 0x4338, 0x02}, - { IMX_8BIT, 0x4339, 0x00}, - { IMX_8BIT, 0x433A, 0x00}, - { IMX_8BIT, 0x433B, 0x02}, - { IMX_8BIT, 0x435A, 0x03}, - { IMX_8BIT, 0x435B, 0x84}, - { IMX_8BIT, 0x435E, 0x01}, - { IMX_8BIT, 0x435F, 0xFF}, - { IMX_8BIT, 0x4360, 0x01}, - { IMX_8BIT, 0x4361, 0xF4}, - { IMX_8BIT, 0x4362, 0x03}, - { IMX_8BIT, 0x4363, 0x84}, - { IMX_8BIT, 0x437B, 0x01}, - { IMX_8BIT, 0x4400, 0x00}, /* STATS off ISP do not support STATS*/ - { IMX_8BIT, 0x4401, 0x3F}, - { IMX_8BIT, 0x4402, 0xFF}, - { IMX_8BIT, 0x4404, 0x13}, - { IMX_8BIT, 0x4405, 0x26}, - { IMX_8BIT, 0x4406, 0x07}, - { IMX_8BIT, 0x4408, 0x20}, - { IMX_8BIT, 0x4409, 0xE5}, - { IMX_8BIT, 0x440A, 0xFB}, - { IMX_8BIT, 0x440C, 0xF6}, - { IMX_8BIT, 0x440D, 0xEA}, - { IMX_8BIT, 0x440E, 0x20}, - { IMX_8BIT, 0x4410, 0x00}, - { IMX_8BIT, 0x4411, 0x00}, - { IMX_8BIT, 0x4412, 0x3F}, - { IMX_8BIT, 0x4413, 0xFF}, - { IMX_8BIT, 0x4414, 0x1F}, - { IMX_8BIT, 0x4415, 0xFF}, - { IMX_8BIT, 0x4416, 0x20}, - { IMX_8BIT, 0x4417, 0x00}, - { IMX_8BIT, 0x4418, 0x1F}, - { IMX_8BIT, 0x4419, 0xFF}, - { IMX_8BIT, 0x441A, 0x20}, - { IMX_8BIT, 0x441B, 0x00}, - { IMX_8BIT, 0x441D, 0x40}, - { IMX_8BIT, 0x441E, 0x1E}, - { IMX_8BIT, 0x441F, 0x38}, - { IMX_8BIT, 0x4420, 0x01}, - { IMX_8BIT, 0x4444, 0x00}, - { IMX_8BIT, 0x4445, 0x00}, - { IMX_8BIT, 0x4446, 0x1D}, - { IMX_8BIT, 0x4447, 0xF9}, - { IMX_8BIT, 0x4452, 0x00}, - { IMX_8BIT, 0x4453, 0xA0}, - { IMX_8BIT, 0x4454, 0x08}, - { IMX_8BIT, 0x4455, 0x00}, - { IMX_8BIT, 0x4456, 0x0F}, - { IMX_8BIT, 0x4457, 0xFF}, - { IMX_8BIT, 0x4458, 0x18}, - { IMX_8BIT, 0x4459, 0x18}, - { IMX_8BIT, 0x445A, 0x3F}, - { IMX_8BIT, 0x445B, 0x3A}, - { IMX_8BIT, 0x445C, 0x00}, - { IMX_8BIT, 0x445D, 0x28}, - { IMX_8BIT, 0x445E, 0x01}, - { IMX_8BIT, 0x445F, 0x90}, - { IMX_8BIT, 0x4460, 0x00}, - { IMX_8BIT, 0x4461, 0x60}, - { IMX_8BIT, 0x4462, 0x00}, - { IMX_8BIT, 0x4463, 0x00}, - { IMX_8BIT, 0x4464, 0x00}, - { IMX_8BIT, 0x4465, 0x00}, - { IMX_8BIT, 0x446C, 0x00}, - { IMX_8BIT, 0x446D, 0x00}, - { IMX_8BIT, 0x446E, 0x00}, - { IMX_8BIT, 0x452A, 0x02}, - { IMX_8BIT, 0x0712, 0x01}, - { IMX_8BIT, 0x0713, 0x00}, - { IMX_8BIT, 0x0714, 0x01}, - { IMX_8BIT, 0x0715, 0x00}, - { IMX_8BIT, 0x0716, 0x01}, - { IMX_8BIT, 0x0717, 0x00}, - { IMX_8BIT, 0x0718, 0x01}, - { IMX_8BIT, 0x0719, 0x00}, - { IMX_8BIT, 0x4500, 0x1F }, - PLL_SETTINGS_FOR_MIPI_451_2MHZ_SALTBAY, - { IMX_8BIT, 0x0205, 0x00}, - { IMX_8BIT, 0x020E, 0x01}, - { IMX_8BIT, 0x020F, 0x00}, - { IMX_8BIT, 0x0210, 0x02}, - { IMX_8BIT, 0x0211, 0x00}, - { IMX_8BIT, 0x0212, 0x02}, - { IMX_8BIT, 0x0213, 0x00}, - { IMX_8BIT, 0x0214, 0x01}, - { IMX_8BIT, 0x0215, 0x00}, - /* HDR Setting */ - { IMX_8BIT, 0x0230, 0x00}, - { IMX_8BIT, 0x0231, 0x00}, - { IMX_8BIT, 0x0233, 0x00}, - { IMX_8BIT, 0x0234, 0x00}, - { IMX_8BIT, 0x0235, 0x40}, - { IMX_8BIT, 0x0238, 0x00}, - { IMX_8BIT, 0x0239, 0x04}, - { IMX_8BIT, 0x023B, 0x00}, - { IMX_8BIT, 0x023C, 0x01}, - { IMX_8BIT, 0x33B0, 0x04}, - { IMX_8BIT, 0x33B1, 0x00}, - { IMX_8BIT, 0x33B3, 0x00}, - { IMX_8BIT, 0x33B4, 0x01}, - { IMX_8BIT, 0x3800, 0x00}, - GROUPED_PARAMETER_HOLD_DISABLE, - { IMX_TOK_TERM, 0, 0} -}; - -/********* Preview, continuous capture and still modes *****************/ - -static struct imx_reg const imx135_13m[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - PLL_SETTINGS_FOR_MIPI_451_2MHZ_SALTBAY, - /* Mode setting */ - {IMX_8BIT, 0x0108, 0x03}, - {IMX_8BIT, 0x0112, 0x0A}, - {IMX_8BIT, 0x0113, 0x0A}, - {IMX_8BIT, 0x0381, 0x01}, - {IMX_8BIT, 0x0383, 0x01}, - {IMX_8BIT, 0x0385, 0x01}, - {IMX_8BIT, 0x0387, 0x01}, - {IMX_8BIT, 0x0390, 0x00}, - {IMX_8BIT, 0x0391, 0x11}, - {IMX_8BIT, 0x0392, 0x00}, - {IMX_8BIT, 0x0401, 0x00}, - {IMX_8BIT, 0x0404, 0x00}, - {IMX_8BIT, 0x0405, 0x10}, - {IMX_8BIT, 0x4082, 0x01}, - {IMX_8BIT, 0x4083, 0x01}, - {IMX_8BIT, 0x4203, 0xFF}, - {IMX_8BIT, 0x7006, 0x04}, - /* Size Setting */ - {IMX_8BIT, 0x0344, 0x00}, /* 0, 0, 4207,3119 4208x3120 */ - {IMX_8BIT, 0x0345, 0x00}, - {IMX_8BIT, 0x0346, 0x00}, - {IMX_8BIT, 0x0347, 0x00}, - {IMX_8BIT, 0x0348, 0x10}, - {IMX_8BIT, 0x0349, 0x6F}, - {IMX_8BIT, 0x034A, 0x0C}, - {IMX_8BIT, 0x034B, 0x2F}, - {IMX_8BIT, 0x034C, 0x10}, - {IMX_8BIT, 0x034D, 0x70}, - {IMX_8BIT, 0x034E, 0x0C}, - {IMX_8BIT, 0x034F, 0x30}, - {IMX_8BIT, 0x0350, 0x00}, - {IMX_8BIT, 0x0351, 0x00}, - {IMX_8BIT, 0x0352, 0x00}, - {IMX_8BIT, 0x0353, 0x00}, - {IMX_8BIT, 0x0354, 0x10}, /* 4208x3120 */ - {IMX_8BIT, 0x0355, 0x70}, - {IMX_8BIT, 0x0356, 0x0C}, - {IMX_8BIT, 0x0357, 0x30}, - {IMX_8BIT, 0x301D, 0x30}, - {IMX_8BIT, 0x3310, 0x10}, - {IMX_8BIT, 0x3311, 0x70}, - {IMX_8BIT, 0x3312, 0x0C}, - {IMX_8BIT, 0x3313, 0x30}, - {IMX_8BIT, 0x331C, 0x00}, - {IMX_8BIT, 0x331D, 0x10}, - {IMX_8BIT, 0x4084, 0x00}, /* If scaling, Fill this */ - {IMX_8BIT, 0x4085, 0x00}, - {IMX_8BIT, 0x4086, 0x00}, - {IMX_8BIT, 0x4087, 0x00}, - {IMX_8BIT, 0x4400, 0x00}, - {IMX_TOK_TERM, 0, 0}, -}; - -/* 13MP reduced pixel clock MIPI 342MHz is EMC friendly*/ -static struct imx_reg const imx135_13m_for_mipi_342[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - PLL_SETTINGS_FOR_MIPI_342MHZ_SALTBAY, - /* Mode setting */ - {IMX_8BIT, 0x0108, 0x03}, - {IMX_8BIT, 0x0112, 0x0A}, - {IMX_8BIT, 0x0113, 0x0A}, - {IMX_8BIT, 0x0381, 0x01}, - {IMX_8BIT, 0x0383, 0x01}, - {IMX_8BIT, 0x0385, 0x01}, - {IMX_8BIT, 0x0387, 0x01}, - {IMX_8BIT, 0x0390, 0x00}, - {IMX_8BIT, 0x0391, 0x11}, - {IMX_8BIT, 0x0392, 0x00}, - {IMX_8BIT, 0x0401, 0x00}, - {IMX_8BIT, 0x0404, 0x00}, - {IMX_8BIT, 0x0405, 0x10}, - {IMX_8BIT, 0x4082, 0x01}, - {IMX_8BIT, 0x4083, 0x01}, - {IMX_8BIT, 0x4203, 0xFF}, - {IMX_8BIT, 0x7006, 0x04}, - /* Size Setting */ - {IMX_8BIT, 0x0344, 0x00}, - {IMX_8BIT, 0x0345, 0x00}, - {IMX_8BIT, 0x0346, 0x00}, - {IMX_8BIT, 0x0347, 0x00}, - {IMX_8BIT, 0x0348, 0x10}, - {IMX_8BIT, 0x0349, 0x6F}, - {IMX_8BIT, 0x034A, 0x0C}, - {IMX_8BIT, 0x034B, 0x2F}, - {IMX_8BIT, 0x034C, 0x10}, - {IMX_8BIT, 0x034D, 0x70}, - {IMX_8BIT, 0x034E, 0x0C}, - {IMX_8BIT, 0x034F, 0x30}, - {IMX_8BIT, 0x0350, 0x00}, - {IMX_8BIT, 0x0351, 0x00}, - {IMX_8BIT, 0x0352, 0x00}, - {IMX_8BIT, 0x0353, 0x00}, - {IMX_8BIT, 0x0354, 0x10}, - {IMX_8BIT, 0x0355, 0x70}, - {IMX_8BIT, 0x0356, 0x0C}, - {IMX_8BIT, 0x0357, 0x30}, - {IMX_8BIT, 0x301D, 0x30}, - {IMX_8BIT, 0x3310, 0x10}, - {IMX_8BIT, 0x3311, 0x70}, - {IMX_8BIT, 0x3312, 0x0C}, - {IMX_8BIT, 0x3313, 0x30}, - {IMX_8BIT, 0x331C, 0x00}, - {IMX_8BIT, 0x331D, 0x10}, - {IMX_8BIT, 0x4084, 0x00}, /* If scaling, Fill this */ - {IMX_8BIT, 0x4085, 0x00}, - {IMX_8BIT, 0x4086, 0x00}, - {IMX_8BIT, 0x4087, 0x00}, - {IMX_8BIT, 0x4400, 0x00}, - {IMX_TOK_TERM, 0, 0}, -}; - -static struct imx_reg const imx135_10m[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - PLL_SETTINGS_FOR_MIPI_451_2MHZ_SALTBAY, - /* Mode setting */ - {IMX_8BIT, 0x0108, 0x03}, - {IMX_8BIT, 0x0112, 0x0A}, - {IMX_8BIT, 0x0113, 0x0A}, - {IMX_8BIT, 0x0381, 0x01}, - {IMX_8BIT, 0x0383, 0x01}, - {IMX_8BIT, 0x0385, 0x01}, - {IMX_8BIT, 0x0387, 0x01}, - {IMX_8BIT, 0x0390, 0x00}, - {IMX_8BIT, 0x0391, 0x11}, - {IMX_8BIT, 0x0392, 0x00}, - {IMX_8BIT, 0x0401, 0x00}, - {IMX_8BIT, 0x0404, 0x00}, - {IMX_8BIT, 0x0405, 0x10}, - {IMX_8BIT, 0x4082, 0x01}, - {IMX_8BIT, 0x4083, 0x01}, - {IMX_8BIT, 0x4203, 0xFF}, - {IMX_8BIT, 0x7006, 0x04}, - /* Size setting */ - {IMX_8BIT, 0x0344, 0x00}, /* 0, 376, 4207, 2743 */ - {IMX_8BIT, 0x0345, 0x00}, - {IMX_8BIT, 0x0346, 0x01}, - {IMX_8BIT, 0x0347, 0x78}, - {IMX_8BIT, 0x0348, 0x10}, - {IMX_8BIT, 0x0349, 0x6f}, - {IMX_8BIT, 0x034A, 0x0a}, - {IMX_8BIT, 0x034B, 0xb7}, - {IMX_8BIT, 0x034C, 0x10}, /* 4208x2368 */ - {IMX_8BIT, 0x034D, 0x70}, - {IMX_8BIT, 0x034E, 0x09}, - {IMX_8BIT, 0x034F, 0x40}, - {IMX_8BIT, 0x0350, 0x00}, - {IMX_8BIT, 0x0351, 0x00}, - {IMX_8BIT, 0x0352, 0x00}, - {IMX_8BIT, 0x0353, 0x00}, - {IMX_8BIT, 0x0354, 0x10}, - {IMX_8BIT, 0x0355, 0x70}, - {IMX_8BIT, 0x0356, 0x09}, - {IMX_8BIT, 0x0357, 0x40}, - {IMX_8BIT, 0x301D, 0x30}, - {IMX_8BIT, 0x3310, 0x10}, - {IMX_8BIT, 0x3311, 0x70}, - {IMX_8BIT, 0x3312, 0x09}, - {IMX_8BIT, 0x3313, 0x40}, - {IMX_8BIT, 0x331C, 0x01}, - {IMX_8BIT, 0x331D, 0x68}, - {IMX_8BIT, 0x4084, 0x00}, - {IMX_8BIT, 0x4085, 0x00}, - {IMX_8BIT, 0x4086, 0x00}, - {IMX_8BIT, 0x4087, 0x00}, - {IMX_8BIT, 0x4400, 0x00}, - {IMX_TOK_TERM, 0, 0}, -}; - -static struct imx_reg const imx135_10m_for_mipi_342[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - PLL_SETTINGS_FOR_MIPI_342MHZ_SALTBAY, - /* Mode setting */ - {IMX_8BIT, 0x0108, 0x03}, - {IMX_8BIT, 0x0112, 0x0A}, - {IMX_8BIT, 0x0113, 0x0A}, - {IMX_8BIT, 0x0381, 0x01}, - {IMX_8BIT, 0x0383, 0x01}, - {IMX_8BIT, 0x0385, 0x01}, - {IMX_8BIT, 0x0387, 0x01}, - {IMX_8BIT, 0x0390, 0x00}, - {IMX_8BIT, 0x0391, 0x11}, - {IMX_8BIT, 0x0392, 0x00}, - {IMX_8BIT, 0x0401, 0x00}, - {IMX_8BIT, 0x0404, 0x00}, - {IMX_8BIT, 0x0405, 0x10}, - {IMX_8BIT, 0x4082, 0x01}, - {IMX_8BIT, 0x4083, 0x01}, - {IMX_8BIT, 0x4203, 0xFF}, - {IMX_8BIT, 0x7006, 0x04}, - /* Size setting */ - {IMX_8BIT, 0x0344, 0x00}, /* 0, 376, 4207, 2743 */ - {IMX_8BIT, 0x0345, 0x00}, - {IMX_8BIT, 0x0346, 0x01}, - {IMX_8BIT, 0x0347, 0x78}, - {IMX_8BIT, 0x0348, 0x10}, - {IMX_8BIT, 0x0349, 0x6f}, - {IMX_8BIT, 0x034A, 0x0a}, - {IMX_8BIT, 0x034B, 0xb7}, - {IMX_8BIT, 0x034C, 0x10}, /* 4208x2368 */ - {IMX_8BIT, 0x034D, 0x70}, - {IMX_8BIT, 0x034E, 0x09}, - {IMX_8BIT, 0x034F, 0x40}, - {IMX_8BIT, 0x0350, 0x00}, - {IMX_8BIT, 0x0351, 0x00}, - {IMX_8BIT, 0x0352, 0x00}, - {IMX_8BIT, 0x0353, 0x00}, - {IMX_8BIT, 0x0354, 0x10}, - {IMX_8BIT, 0x0355, 0x70}, - {IMX_8BIT, 0x0356, 0x09}, - {IMX_8BIT, 0x0357, 0x40}, - {IMX_8BIT, 0x301D, 0x30}, - {IMX_8BIT, 0x3310, 0x10}, - {IMX_8BIT, 0x3311, 0x70}, - {IMX_8BIT, 0x3312, 0x09}, - {IMX_8BIT, 0x3313, 0x40}, - {IMX_8BIT, 0x331C, 0x01}, - {IMX_8BIT, 0x331D, 0x68}, - {IMX_8BIT, 0x4084, 0x00}, - {IMX_8BIT, 0x4085, 0x00}, - {IMX_8BIT, 0x4086, 0x00}, - {IMX_8BIT, 0x4087, 0x00}, - {IMX_8BIT, 0x4400, 0x00}, - {IMX_TOK_TERM, 0, 0}, -}; - -/* - * It is 8.5 DS from (3:2)8m cropped setting. - * - * The 8m(3:2) cropped setting is 2992x2448 effective res. - * The ISP effect cropped setting should be 1408x1152 effect res. - * - * Consider ISP 16x16 padding: - * sensor outputs 368x304 - * cropped region is 3128x2584 - */ -static struct imx_reg const imx135_368x304_cropped[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - PLL_SETTINGS_FOR_MIPI_209_6MHZ_SALTBAY, - /* Mode setting */ - {IMX_8BIT, 0x0108, 0x03}, - {IMX_8BIT, 0x0112, 0x0A}, - {IMX_8BIT, 0x0113, 0x0A}, - {IMX_8BIT, 0x0381, 0x01}, - {IMX_8BIT, 0x0383, 0x01}, - {IMX_8BIT, 0x0385, 0x01}, - {IMX_8BIT, 0x0387, 0x01}, - {IMX_8BIT, 0x0390, 0x00}, - {IMX_8BIT, 0x0391, 0x11}, /* no binning */ - {IMX_8BIT, 0x0392, 0x00}, - {IMX_8BIT, 0x0401, 0x02}, /* resize */ - {IMX_8BIT, 0x0404, 0x00}, - {IMX_8BIT, 0x0405, 0x88}, /* 136/16=8.5 */ - {IMX_8BIT, 0x4082, 0x00}, - {IMX_8BIT, 0x4083, 0x00}, - {IMX_8BIT, 0x4203, 0xFF}, - {IMX_8BIT, 0x7006, 0x04}, - /* Size setting */ - {IMX_8BIT, 0x0344, 0x02}, /* X_ADD_STA */ - {IMX_8BIT, 0x0345, 0x1C}, /* 540 */ - {IMX_8BIT, 0x0346, 0x01}, /* Y_ADD_STA */ - {IMX_8BIT, 0x0347, 0x0C}, /* 268 */ - {IMX_8BIT, 0x0348, 0x0E}, /* X_ADD_END */ - {IMX_8BIT, 0x0349, 0x53}, /* 3667 */ - {IMX_8BIT, 0x034A, 0x0B}, /* Y_ADD_END */ - {IMX_8BIT, 0x034B, 0x23}, /* 2851 */ - {IMX_8BIT, 0x034C, 0x01}, /* X_OUT_SIZE */ - {IMX_8BIT, 0x034D, 0x70}, /* 368 */ - {IMX_8BIT, 0x034E, 0x01}, /* Y_OUT_SIZE */ - {IMX_8BIT, 0x034F, 0x30}, /* 304 */ - {IMX_8BIT, 0x0350, 0x00}, /* No Dig crop */ - {IMX_8BIT, 0x0351, 0x00}, - {IMX_8BIT, 0x0352, 0x00}, - {IMX_8BIT, 0x0353, 0x00}, - {IMX_8BIT, 0x0354, 0x0C}, /* Cut out siz same as the size after crop */ - {IMX_8BIT, 0x0355, 0x38}, - {IMX_8BIT, 0x0356, 0x0A}, - {IMX_8BIT, 0x0357, 0x18}, - {IMX_8BIT, 0x301D, 0x30}, /* ?? */ - {IMX_8BIT, 0x3310, 0x01}, /* Write H and V size same as output size? */ - {IMX_8BIT, 0x3311, 0x70}, - {IMX_8BIT, 0x3312, 0x01}, - {IMX_8BIT, 0x3313, 0x30}, - {IMX_8BIT, 0x331C, 0x02}, /* ?? */ - {IMX_8BIT, 0x331D, 0xD0}, - {IMX_8BIT, 0x4084, 0x01}, /* Scaling related? */ - {IMX_8BIT, 0x4085, 0x70}, - {IMX_8BIT, 0x4086, 0x01}, - {IMX_8BIT, 0x4087, 0x30}, - {IMX_8BIT, 0x4400, 0x00}, /* STATS off */ - {IMX_TOK_TERM, 0, 0}, -}; - -/* - * It is 1/4 binning from 8m cropped setting. - * - * The 8m cropped setting is 3264x2448 effective res. - * The xga cropped setting should be 816x612 effect res. - * - * Consider ISP 16x16 padding: - * sensor outputs 832x628 - * cropped region is 3328x2512 - */ -static struct imx_reg const imx135_xga_cropped[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - PLL_SETTINGS_FOR_MIPI_209_6MHZ_SALTBAY, - /* Mode setting */ - {IMX_8BIT, 0x0108, 0x03}, - {IMX_8BIT, 0x0112, 0x0A}, - {IMX_8BIT, 0x0113, 0x0A}, - {IMX_8BIT, 0x0381, 0x01}, - {IMX_8BIT, 0x0383, 0x01}, - {IMX_8BIT, 0x0385, 0x01}, - {IMX_8BIT, 0x0387, 0x01}, - {IMX_8BIT, 0x0390, 0x01}, - {IMX_8BIT, 0x0391, 0x44}, - {IMX_8BIT, 0x0392, 0x00}, - {IMX_8BIT, 0x0401, 0x00}, - {IMX_8BIT, 0x0404, 0x00}, - {IMX_8BIT, 0x0405, 0x10}, - {IMX_8BIT, 0x4082, 0x00}, - {IMX_8BIT, 0x4083, 0x00}, -/* {IMX_8BIT, 0x4203, 0xFF}, */ - {IMX_8BIT, 0x7006, 0x04}, - /* Size setting */ - {IMX_8BIT, 0x0344, 0x01}, /* X_ADD_STA */ - {IMX_8BIT, 0x0345, 0xB8}, /* 440 */ - {IMX_8BIT, 0x0346, 0x01}, /* Y_ADD_STA */ - {IMX_8BIT, 0x0347, 0x30}, /* 304 */ - {IMX_8BIT, 0x0348, 0x0E}, /* X_ADD_END */ - {IMX_8BIT, 0x0349, 0xB7}, /* 4207-440=3767 */ - {IMX_8BIT, 0x034A, 0x0A}, /* Y_ADD_END */ - {IMX_8BIT, 0x034B, 0xFF}, /* 3119-304=2815 */ - {IMX_8BIT, 0x034C, 0x03}, /* X_OUT_SIZE */ - {IMX_8BIT, 0x034D, 0x40}, /* 832 */ - {IMX_8BIT, 0x034E, 0x02}, /* Y_OUT_SIZE */ - {IMX_8BIT, 0x034F, 0x74}, /* 628 */ - {IMX_8BIT, 0x0350, 0x00}, /* No Dig crop */ - {IMX_8BIT, 0x0351, 0x00}, - {IMX_8BIT, 0x0352, 0x00}, - {IMX_8BIT, 0x0353, 0x00}, - {IMX_8BIT, 0x0354, 0x03}, /* Cut out size same as the size after crop */ - {IMX_8BIT, 0x0355, 0x40}, - {IMX_8BIT, 0x0356, 0x02}, - {IMX_8BIT, 0x0357, 0x74}, - {IMX_8BIT, 0x301D, 0x30}, /* ?? */ - {IMX_8BIT, 0x3310, 0x03}, /* Write H and V size same as output size? */ - {IMX_8BIT, 0x3311, 0x40}, - {IMX_8BIT, 0x3312, 0x02}, - {IMX_8BIT, 0x3313, 0x74}, - {IMX_8BIT, 0x331C, 0x02}, /* ?? */ - {IMX_8BIT, 0x331D, 0x21}, - {IMX_8BIT, 0x4084, 0x03}, /* Scaling related? */ - {IMX_8BIT, 0x4085, 0x40}, - {IMX_8BIT, 0x4086, 0x02}, - {IMX_8BIT, 0x4087, 0x74}, - {IMX_8BIT, 0x4400, 0x00}, /* STATS off */ - {IMX_TOK_TERM, 0, 0}, -}; - -/* - * It is 28/16 DS from (16:9)8m cropped setting. - * - * The 8m(16:9) cropped setting is 3360x1890 effective res. - * - this is larger then the expected 3264x1836 FOV - * - * Consider ISP 16x16 padding: - * sensor outputs 1936x1096 - * cropped region is 3388x1918 - */ -static struct imx_reg const imx135_1936x1096_cropped[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - PLL_SETTINGS_FOR_MIPI_209_6MHZ_SALTBAY, - /* Mode setting */ - {IMX_8BIT, 0x0108, 0x03}, - {IMX_8BIT, 0x0112, 0x0A}, - {IMX_8BIT, 0x0113, 0x0A}, - {IMX_8BIT, 0x0381, 0x01}, - {IMX_8BIT, 0x0383, 0x01}, - {IMX_8BIT, 0x0385, 0x01}, - {IMX_8BIT, 0x0387, 0x01}, - {IMX_8BIT, 0x0390, 0x00}, - {IMX_8BIT, 0x0391, 0x11}, /* no binning */ - {IMX_8BIT, 0x0392, 0x00}, - {IMX_8BIT, 0x0401, 0x02}, /* resize */ - {IMX_8BIT, 0x0404, 0x00}, - {IMX_8BIT, 0x0405, 0x1C}, /* 28/16 */ - {IMX_8BIT, 0x4082, 0x00}, - {IMX_8BIT, 0x4083, 0x00}, - {IMX_8BIT, 0x4203, 0xFF}, - {IMX_8BIT, 0x7006, 0x04}, - /* Size setting */ - {IMX_8BIT, 0x0344, 0x01}, /* X_ADD_STA */ - {IMX_8BIT, 0x0345, 0x9A}, /* 410 */ - {IMX_8BIT, 0x0346, 0x02}, /* Y_ADD_STA */ - {IMX_8BIT, 0x0347, 0x58}, /* 600 */ - {IMX_8BIT, 0x0348, 0x0E}, /* X_ADD_END */ - {IMX_8BIT, 0x0349, 0xD5}, /* 3797 */ - {IMX_8BIT, 0x034A, 0x09}, /* Y_ADD_END */ - {IMX_8BIT, 0x034B, 0xD5}, /* 2517 */ - {IMX_8BIT, 0x034C, 0x07}, /* X_OUT_SIZE */ - {IMX_8BIT, 0x034D, 0x90}, /* 1936 */ - {IMX_8BIT, 0x034E, 0x04}, /* Y_OUT_SIZE */ - {IMX_8BIT, 0x034F, 0x48}, /* 1096 */ - {IMX_8BIT, 0x0350, 0x00}, /* No Dig crop */ - {IMX_8BIT, 0x0351, 0x00}, - {IMX_8BIT, 0x0352, 0x00}, - {IMX_8BIT, 0x0353, 0x00}, - {IMX_8BIT, 0x0354, 0x0D}, /* Cut out siz same as the size after crop */ - {IMX_8BIT, 0x0355, 0x3C}, - {IMX_8BIT, 0x0356, 0x07}, - {IMX_8BIT, 0x0357, 0x7E}, - {IMX_8BIT, 0x301D, 0x30}, /* ?? */ - {IMX_8BIT, 0x3310, 0x07}, /* Write H and V size same as output size? */ - {IMX_8BIT, 0x3311, 0x90}, - {IMX_8BIT, 0x3312, 0x04}, - {IMX_8BIT, 0x3313, 0x48}, - {IMX_8BIT, 0x331C, 0x00}, /* ?? */ - {IMX_8BIT, 0x331D, 0xAA}, - {IMX_8BIT, 0x4084, 0x07}, /* Scaling related? */ - {IMX_8BIT, 0x4085, 0x90}, - {IMX_8BIT, 0x4086, 0x04}, - {IMX_8BIT, 0x4087, 0x48}, - {IMX_8BIT, 0x4400, 0x00}, /* STATS off */ - {IMX_TOK_TERM, 0, 0}, -}; - -/* - * It is 2.125 DS from (3:2)8m cropped setting. - * - * The 8m(3:2) cropped setting is 2992x2448 effective res. - * The ISP effect cropped setting should be 1408x1152 effect res. - * - * Consider ISP 16x16 padding: - * sensor outputs 1424x1168 - * cropped region is 3026x2482 - */ -static struct imx_reg const imx135_1424x1168_cropped[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - PLL_SETTINGS_FOR_MIPI_209_6MHZ_SALTBAY, - /* Mode setting */ - {IMX_8BIT, 0x0108, 0x03}, - {IMX_8BIT, 0x0112, 0x0A}, - {IMX_8BIT, 0x0113, 0x0A}, - {IMX_8BIT, 0x0381, 0x01}, - {IMX_8BIT, 0x0383, 0x01}, - {IMX_8BIT, 0x0385, 0x01}, - {IMX_8BIT, 0x0387, 0x01}, - {IMX_8BIT, 0x0390, 0x00}, - {IMX_8BIT, 0x0391, 0x11}, /* no binning */ - {IMX_8BIT, 0x0392, 0x00}, - {IMX_8BIT, 0x0401, 0x02}, /* resize */ - {IMX_8BIT, 0x0404, 0x00}, - {IMX_8BIT, 0x0405, 0x22}, /* 34/16=2.125 */ - {IMX_8BIT, 0x4082, 0x00}, - {IMX_8BIT, 0x4083, 0x00}, - {IMX_8BIT, 0x4203, 0xFF}, - {IMX_8BIT, 0x7006, 0x04}, - /* Size setting */ - {IMX_8BIT, 0x0344, 0x02}, /* X_ADD_STA */ - {IMX_8BIT, 0x0345, 0x4E}, /* 590 */ - {IMX_8BIT, 0x0346, 0x01}, /* Y_ADD_STA */ - {IMX_8BIT, 0x0347, 0x3E}, /* 318 */ - {IMX_8BIT, 0x0348, 0x0E}, /* X_ADD_END */ - {IMX_8BIT, 0x0349, 0x1F}, /* 3615 */ - {IMX_8BIT, 0x034A, 0x0A}, /* Y_ADD_END */ - {IMX_8BIT, 0x034B, 0xEF}, /* 2799 */ - {IMX_8BIT, 0x034C, 0x05}, /* X_OUT_SIZE */ - {IMX_8BIT, 0x034D, 0x90}, /* 1424 */ - {IMX_8BIT, 0x034E, 0x04}, /* Y_OUT_SIZE */ - {IMX_8BIT, 0x034F, 0x90}, /* 1168 */ - {IMX_8BIT, 0x0350, 0x00}, /* No Dig crop */ - {IMX_8BIT, 0x0351, 0x00}, - {IMX_8BIT, 0x0352, 0x00}, - {IMX_8BIT, 0x0353, 0x00}, - {IMX_8BIT, 0x0354, 0x0B}, /* Cut out siz same as the size after crop */ - {IMX_8BIT, 0x0355, 0xD2}, - {IMX_8BIT, 0x0356, 0x09}, - {IMX_8BIT, 0x0357, 0xB2}, - {IMX_8BIT, 0x301D, 0x30}, /* ?? */ - {IMX_8BIT, 0x3310, 0x05}, /* Write H and V size same as output size? */ - {IMX_8BIT, 0x3311, 0x90}, - {IMX_8BIT, 0x3312, 0x04}, - {IMX_8BIT, 0x3313, 0x90}, - {IMX_8BIT, 0x331C, 0x00}, /* ?? */ - {IMX_8BIT, 0x331D, 0xAA}, - {IMX_8BIT, 0x4084, 0x05}, /* Scaling related? */ - {IMX_8BIT, 0x4085, 0x90}, - {IMX_8BIT, 0x4086, 0x04}, - {IMX_8BIT, 0x4087, 0x90}, - {IMX_8BIT, 0x4400, 0x00}, /* STATS off */ - {IMX_TOK_TERM, 0, 0}, -}; - -/* - * It is 1/2 binning from 8m cropped setting. - * - * The 8m cropped setting is 3264x2448 effective res. - * The 2m cropped setting should be 1632x1224 effect res. - * - * Consider ISP 16x16 padding: - * sensor outputs 1648x1240 - * cropped region is 3296x2480 - */ -static struct imx_reg const imx135_2m_cropped[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - PLL_SETTINGS_FOR_MIPI_209_6MHZ_SALTBAY, - /* Mode setting */ - {IMX_8BIT, 0x0108, 0x03}, - {IMX_8BIT, 0x0112, 0x0A}, - {IMX_8BIT, 0x0113, 0x0A}, - {IMX_8BIT, 0x0381, 0x01}, - {IMX_8BIT, 0x0383, 0x01}, - {IMX_8BIT, 0x0385, 0x01}, - {IMX_8BIT, 0x0387, 0x01}, - {IMX_8BIT, 0x0390, 0x01}, - {IMX_8BIT, 0x0391, 0x22}, - {IMX_8BIT, 0x0392, 0x00}, - {IMX_8BIT, 0x0401, 0x00}, - {IMX_8BIT, 0x0404, 0x00}, - {IMX_8BIT, 0x0405, 0x10}, - {IMX_8BIT, 0x4082, 0x01}, - {IMX_8BIT, 0x4083, 0x01}, - {IMX_8BIT, 0x4203, 0xFF}, - {IMX_8BIT, 0x7006, 0x04}, - /* Size setting */ - {IMX_8BIT, 0x0344, 0x01}, /* X_ADD_STA */ - {IMX_8BIT, 0x0345, 0xC8}, /* 464(1D0) -> 456(1C8)*/ - {IMX_8BIT, 0x0346, 0x01}, /* Y_ADD_STA */ - {IMX_8BIT, 0x0347, 0x40}, /* 320 */ - {IMX_8BIT, 0x0348, 0x0E}, /* X_ADD_END */ - {IMX_8BIT, 0x0349, 0xA7}, /* 4207-456=3751 */ - {IMX_8BIT, 0x034A, 0x0A}, /* Y_ADD_END */ - {IMX_8BIT, 0x034B, 0xEF}, /* 3119-320=2799 */ - {IMX_8BIT, 0x034C, 0x06}, /* X_OUT_SIZE */ - {IMX_8BIT, 0x034D, 0x70}, /* 1648 */ - {IMX_8BIT, 0x034E, 0x04}, /* Y_OUT_SIZE */ - {IMX_8BIT, 0x034F, 0xD8}, /* 1240 */ - {IMX_8BIT, 0x0350, 0x00}, /* No Dig crop */ - {IMX_8BIT, 0x0351, 0x00}, - {IMX_8BIT, 0x0352, 0x00}, - {IMX_8BIT, 0x0353, 0x00}, - {IMX_8BIT, 0x0354, 0x06}, /* Cut out size same as the size after crop */ - {IMX_8BIT, 0x0355, 0x70}, - {IMX_8BIT, 0x0356, 0x04}, - {IMX_8BIT, 0x0357, 0xD8}, - {IMX_8BIT, 0x301D, 0x30}, /* ?? */ - {IMX_8BIT, 0x3310, 0x06}, /* Write H and V size same as output size? */ - {IMX_8BIT, 0x3311, 0x70}, - {IMX_8BIT, 0x3312, 0x04}, - {IMX_8BIT, 0x3313, 0xD8}, - {IMX_8BIT, 0x331C, 0x00}, /* ?? */ - {IMX_8BIT, 0x331D, 0xAA}, - {IMX_8BIT, 0x4084, 0x00}, /* Scaling related? */ - {IMX_8BIT, 0x4085, 0x00}, - {IMX_8BIT, 0x4086, 0x00}, - {IMX_8BIT, 0x4087, 0x00}, - {IMX_8BIT, 0x4400, 0x00}, /* STATS off */ - {IMX_TOK_TERM, 0, 0}, -}; - -/* - * 8M Cropped 16:9 setting - * - * Effect res: 3264x1836 - * Sensor out: 3280x1852 - */ -static struct imx_reg const imx135_6m_cropped[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - PLL_SETTINGS_FOR_MIPI_451_2MHZ_SALTBAY, - /* Mode setting */ - {IMX_8BIT, 0x0108, 0x03}, - {IMX_8BIT, 0x0112, 0x0A}, - {IMX_8BIT, 0x0113, 0x0A}, - {IMX_8BIT, 0x0381, 0x01}, - {IMX_8BIT, 0x0383, 0x01}, - {IMX_8BIT, 0x0385, 0x01}, - {IMX_8BIT, 0x0387, 0x01}, - {IMX_8BIT, 0x0390, 0x00}, - {IMX_8BIT, 0x0391, 0x11}, - {IMX_8BIT, 0x0392, 0x00}, - {IMX_8BIT, 0x0401, 0x00}, - {IMX_8BIT, 0x0404, 0x00}, - {IMX_8BIT, 0x0405, 0x10}, - {IMX_8BIT, 0x4082, 0x01}, - {IMX_8BIT, 0x4083, 0x01}, - {IMX_8BIT, 0x4203, 0xFF}, - {IMX_8BIT, 0x7006, 0x04}, - /* Size setting */ - {IMX_8BIT, 0x0344, 0x01}, - {IMX_8BIT, 0x0345, 0xD0}, - {IMX_8BIT, 0x0346, 0x02}, /* 634 */ - {IMX_8BIT, 0x0347, 0x7A}, - {IMX_8BIT, 0x0348, 0x0E}, - {IMX_8BIT, 0x0349, 0x9F}, - {IMX_8BIT, 0x034A, 0x09}, /* 2485 */ - {IMX_8BIT, 0x034B, 0xB5}, - {IMX_8BIT, 0x034C, 0x0C}, /* 3280 */ - {IMX_8BIT, 0x034D, 0xD0}, - {IMX_8BIT, 0x034E, 0x07}, /* 1852 */ - {IMX_8BIT, 0x034F, 0x3C}, - {IMX_8BIT, 0x0350, 0x00}, /* No Dig crop */ - {IMX_8BIT, 0x0351, 0x00}, - {IMX_8BIT, 0x0352, 0x00}, - {IMX_8BIT, 0x0353, 0x00}, - {IMX_8BIT, 0x0354, 0x0C}, /* Cut out size same as the size after crop */ - {IMX_8BIT, 0x0355, 0xD0}, - {IMX_8BIT, 0x0356, 0x07}, - {IMX_8BIT, 0x0357, 0x3C}, - {IMX_8BIT, 0x301D, 0x30}, /* ?? */ - {IMX_8BIT, 0x3310, 0x0C}, /* Write H and V size same as output size? */ - {IMX_8BIT, 0x3311, 0xD0}, - {IMX_8BIT, 0x3312, 0x07}, - {IMX_8BIT, 0x3313, 0x3C}, - {IMX_8BIT, 0x331C, 0x00}, /* ?? */ - {IMX_8BIT, 0x331D, 0x10}, - {IMX_8BIT, 0x4084, 0x00}, /* Scaling related? */ - {IMX_8BIT, 0x4085, 0x00}, - {IMX_8BIT, 0x4086, 0x00}, - {IMX_8BIT, 0x4087, 0x00}, - {IMX_8BIT, 0x4400, 0x00}, /* STATS off */ - {IMX_TOK_TERM, 0, 0}, -}; - -static struct imx_reg const imx135_8m_cropped[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - PLL_SETTINGS_FOR_MIPI_451_2MHZ_SALTBAY, - /* Mode setting */ - {IMX_8BIT, 0x0108, 0x03}, - {IMX_8BIT, 0x0112, 0x0A}, - {IMX_8BIT, 0x0113, 0x0A}, - {IMX_8BIT, 0x0381, 0x01}, - {IMX_8BIT, 0x0383, 0x01}, - {IMX_8BIT, 0x0385, 0x01}, - {IMX_8BIT, 0x0387, 0x01}, - {IMX_8BIT, 0x0390, 0x00}, - {IMX_8BIT, 0x0391, 0x11}, - {IMX_8BIT, 0x0392, 0x00}, - {IMX_8BIT, 0x0401, 0x00}, - {IMX_8BIT, 0x0404, 0x00}, - {IMX_8BIT, 0x0405, 0x10}, - {IMX_8BIT, 0x4082, 0x01}, - {IMX_8BIT, 0x4083, 0x01}, - {IMX_8BIT, 0x4203, 0xFF}, - {IMX_8BIT, 0x7006, 0x04}, - /* Size setting */ - {IMX_8BIT, 0x0344, 0x01}, - {IMX_8BIT, 0x0345, 0xD0}, - {IMX_8BIT, 0x0346, 0x01}, - {IMX_8BIT, 0x0347, 0x48}, - {IMX_8BIT, 0x0348, 0x0E}, - {IMX_8BIT, 0x0349, 0x9F}, - {IMX_8BIT, 0x034A, 0x0A}, - {IMX_8BIT, 0x034B, 0xE7}, - {IMX_8BIT, 0x034C, 0x0C}, /* 3280 */ - {IMX_8BIT, 0x034D, 0xD0}, - {IMX_8BIT, 0x034E, 0x09}, /* 2464 */ - {IMX_8BIT, 0x034F, 0xA0}, - {IMX_8BIT, 0x0350, 0x00}, /* No Dig crop */ - {IMX_8BIT, 0x0351, 0x00}, - {IMX_8BIT, 0x0352, 0x00}, - {IMX_8BIT, 0x0353, 0x00}, - {IMX_8BIT, 0x0354, 0x0C}, /* Cut out size same as the size after crop */ - {IMX_8BIT, 0x0355, 0xD0}, - {IMX_8BIT, 0x0356, 0x09}, - {IMX_8BIT, 0x0357, 0xA0}, - {IMX_8BIT, 0x301D, 0x30}, /* ?? */ - {IMX_8BIT, 0x3310, 0x0C}, /* Write H and V size same as output size? */ - {IMX_8BIT, 0x3311, 0xD0}, - {IMX_8BIT, 0x3312, 0x09}, - {IMX_8BIT, 0x3313, 0xA0}, - {IMX_8BIT, 0x331C, 0x00}, /* ?? */ - {IMX_8BIT, 0x331D, 0x10}, - {IMX_8BIT, 0x4084, 0x00}, /* Scaling related? */ - {IMX_8BIT, 0x4085, 0x00}, - {IMX_8BIT, 0x4086, 0x00}, - {IMX_8BIT, 0x4087, 0x00}, - {IMX_8BIT, 0x4400, 0x00}, /* STATS off */ - {IMX_TOK_TERM, 0, 0}, -}; - -static struct imx_reg const imx135_8m_scaled_from_12m[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - PLL_SETTINGS_FOR_MIPI_451_2MHZ_SALTBAY, - /* Mode setting */ - {IMX_8BIT, 0x0108, 0x03}, - {IMX_8BIT, 0x0112, 0x0A}, - {IMX_8BIT, 0x0113, 0x0A}, - {IMX_8BIT, 0x0381, 0x01}, - {IMX_8BIT, 0x0383, 0x01}, - {IMX_8BIT, 0x0385, 0x01}, - {IMX_8BIT, 0x0387, 0x01}, - {IMX_8BIT, 0x0390, 0x00}, - {IMX_8BIT, 0x0391, 0x11}, - {IMX_8BIT, 0x0392, 0x00}, - {IMX_8BIT, 0x0401, 0x02}, /* Scaling */ - {IMX_8BIT, 0x0404, 0x00}, - {IMX_8BIT, 0x0405, 0x14}, - {IMX_8BIT, 0x4082, 0x00}, - {IMX_8BIT, 0x4083, 0x00}, - {IMX_8BIT, 0x4203, 0xFF}, - {IMX_8BIT, 0x7006, 0x04}, - /* Size setting */ - {IMX_8BIT, 0x0344, 0x00}, - {IMX_8BIT, 0x0345, 0x36}, - {IMX_8BIT, 0x0346, 0x00}, - {IMX_8BIT, 0x0347, 0x14}, - {IMX_8BIT, 0x0348, 0x10}, - {IMX_8BIT, 0x0349, 0x39}, - {IMX_8BIT, 0x034A, 0x0C}, - {IMX_8BIT, 0x034B, 0x1B}, - {IMX_8BIT, 0x034C, 0x0C}, /* 3280x2464 */ - {IMX_8BIT, 0x034D, 0xD0}, - {IMX_8BIT, 0x034E, 0x09}, - {IMX_8BIT, 0x034F, 0xA0}, - {IMX_8BIT, 0x0350, 0x00}, /* No Dig crop */ - {IMX_8BIT, 0x0351, 0x00}, - {IMX_8BIT, 0x0352, 0x00}, - {IMX_8BIT, 0x0353, 0x00}, - {IMX_8BIT, 0x0354, 0x10}, /* Cut out size same as the size after crop */ - {IMX_8BIT, 0x0355, 0x04}, - {IMX_8BIT, 0x0356, 0x0C}, - {IMX_8BIT, 0x0357, 0x08}, - {IMX_8BIT, 0x301D, 0x30}, /* ?? */ - {IMX_8BIT, 0x3310, 0x0C}, /* Write H and V size same as output size? */ - {IMX_8BIT, 0x3311, 0xD0}, - {IMX_8BIT, 0x3312, 0x09}, - {IMX_8BIT, 0x3313, 0xA0}, - {IMX_8BIT, 0x331C, 0x02}, /* ?? */ - {IMX_8BIT, 0x331D, 0xA0}, - {IMX_8BIT, 0x4084, 0x0C}, /* Scaling related? */ - {IMX_8BIT, 0x4085, 0xD0}, - {IMX_8BIT, 0x4086, 0x09}, - {IMX_8BIT, 0x4087, 0xA0}, - {IMX_8BIT, 0x4400, 0x00}, /* STATS off */ - {IMX_TOK_TERM, 0, 0}, -}; - -static struct imx_reg const imx135_8m_scaled_from_12m_for_mipi342[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - PLL_SETTINGS_FOR_MIPI_342MHZ_SALTBAY, - /* Mode setting */ - {IMX_8BIT, 0x0108, 0x03}, - {IMX_8BIT, 0x0112, 0x0A}, - {IMX_8BIT, 0x0113, 0x0A}, - {IMX_8BIT, 0x0381, 0x01}, - {IMX_8BIT, 0x0383, 0x01}, - {IMX_8BIT, 0x0385, 0x01}, - {IMX_8BIT, 0x0387, 0x01}, - {IMX_8BIT, 0x0390, 0x00}, - {IMX_8BIT, 0x0391, 0x11}, - {IMX_8BIT, 0x0392, 0x00}, - {IMX_8BIT, 0x0401, 0x02}, /* Scaling */ - {IMX_8BIT, 0x0404, 0x00}, - {IMX_8BIT, 0x0405, 0x14}, - {IMX_8BIT, 0x4082, 0x00}, - {IMX_8BIT, 0x4083, 0x00}, - {IMX_8BIT, 0x4203, 0xFF}, - {IMX_8BIT, 0x7006, 0x04}, - /* Size setting */ - {IMX_8BIT, 0x0344, 0x00}, - {IMX_8BIT, 0x0345, 0x36}, - {IMX_8BIT, 0x0346, 0x00}, - {IMX_8BIT, 0x0347, 0x14}, - {IMX_8BIT, 0x0348, 0x10}, - {IMX_8BIT, 0x0349, 0x39}, - {IMX_8BIT, 0x034A, 0x0C}, - {IMX_8BIT, 0x034B, 0x1B}, - {IMX_8BIT, 0x034C, 0x0C}, /* 3280x2464 */ - {IMX_8BIT, 0x034D, 0xD0}, - {IMX_8BIT, 0x034E, 0x09}, - {IMX_8BIT, 0x034F, 0xA0}, - {IMX_8BIT, 0x0350, 0x00}, /* No Dig crop */ - {IMX_8BIT, 0x0351, 0x00}, - {IMX_8BIT, 0x0352, 0x00}, - {IMX_8BIT, 0x0353, 0x00}, - {IMX_8BIT, 0x0354, 0x10}, /* Cut out size same as the size after crop */ - {IMX_8BIT, 0x0355, 0x04}, - {IMX_8BIT, 0x0356, 0x0C}, - {IMX_8BIT, 0x0357, 0x08}, - {IMX_8BIT, 0x301D, 0x30}, /* ?? */ - {IMX_8BIT, 0x3310, 0x0C}, /* Write H and V size same as output size? */ - {IMX_8BIT, 0x3311, 0xD0}, - {IMX_8BIT, 0x3312, 0x09}, - {IMX_8BIT, 0x3313, 0xA0}, - {IMX_8BIT, 0x331C, 0x02}, /* ?? */ - {IMX_8BIT, 0x331D, 0xA0}, - {IMX_8BIT, 0x4084, 0x0C}, /* Resize IMG Hand V size-> Scaling related?*/ - {IMX_8BIT, 0x4085, 0xD0}, - {IMX_8BIT, 0x4086, 0x09}, - {IMX_8BIT, 0x4087, 0xA0}, - {IMX_8BIT, 0x4400, 0x00}, /* STATS off */ - {IMX_TOK_TERM, 0, 0}, -}; - -static struct imx_reg const imx135_6m[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - PLL_SETTINGS_FOR_MIPI_451_2MHZ_SALTBAY, - /* Mode setting */ - {IMX_8BIT, 0x0108, 0x03}, - {IMX_8BIT, 0x0112, 0x0A}, - {IMX_8BIT, 0x0113, 0x0A}, - {IMX_8BIT, 0x0381, 0x01}, - {IMX_8BIT, 0x0383, 0x01}, - {IMX_8BIT, 0x0385, 0x01}, - {IMX_8BIT, 0x0387, 0x01}, - {IMX_8BIT, 0x0390, 0x00}, - {IMX_8BIT, 0x0391, 0x11}, - {IMX_8BIT, 0x0392, 0x00}, - {IMX_8BIT, 0x0401, 0x02}, - {IMX_8BIT, 0x0404, 0x00}, - {IMX_8BIT, 0x0405, 0x14}, - {IMX_8BIT, 0x4082, 0x00}, - {IMX_8BIT, 0x4083, 0x00}, - {IMX_8BIT, 0x4203, 0xFF}, - {IMX_8BIT, 0x7006, 0x04}, - /* Size setting */ - {IMX_8BIT, 0x0344, 0x00}, /* 36, 194, 1039, a9f 4100x2316 */ - {IMX_8BIT, 0x0345, 0x36}, - {IMX_8BIT, 0x0346, 0x01}, - {IMX_8BIT, 0x0347, 0x94}, - {IMX_8BIT, 0x0348, 0x10}, - {IMX_8BIT, 0x0349, 0x39}, - {IMX_8BIT, 0x034A, 0x0A}, - {IMX_8BIT, 0x034B, 0x9F}, - {IMX_8BIT, 0x034C, 0x0C}, /* 3280x1852 */ - {IMX_8BIT, 0x034D, 0xD0}, - {IMX_8BIT, 0x034E, 0x07}, - {IMX_8BIT, 0x034F, 0x3C}, - {IMX_8BIT, 0x0350, 0x00}, - {IMX_8BIT, 0x0351, 0x00}, - {IMX_8BIT, 0x0352, 0x00}, - {IMX_8BIT, 0x0353, 0x00}, - {IMX_8BIT, 0x0354, 0x10}, /* 4100x2316 */ - {IMX_8BIT, 0x0355, 0x04}, - {IMX_8BIT, 0x0356, 0x09}, - {IMX_8BIT, 0x0357, 0x0C}, - {IMX_8BIT, 0x301D, 0x30}, - {IMX_8BIT, 0x3310, 0x0C}, - {IMX_8BIT, 0x3311, 0xD0}, - {IMX_8BIT, 0x3312, 0x07}, - {IMX_8BIT, 0x3313, 0x3C}, - {IMX_8BIT, 0x331C, 0x02}, - {IMX_8BIT, 0x331D, 0xA0}, - {IMX_8BIT, 0x4084, 0x0C}, - {IMX_8BIT, 0x4085, 0xD0}, - {IMX_8BIT, 0x4086, 0x07}, - {IMX_8BIT, 0x4087, 0x3C}, - {IMX_8BIT, 0x4400, 0x00}, - {IMX_TOK_TERM, 0, 0}, -}; - -static struct imx_reg const imx135_6m_for_mipi_342[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - PLL_SETTINGS_FOR_MIPI_342MHZ_SALTBAY, - /* Mode setting */ - {IMX_8BIT, 0x0108, 0x03}, - {IMX_8BIT, 0x0112, 0x0A}, - {IMX_8BIT, 0x0113, 0x0A}, - {IMX_8BIT, 0x0381, 0x01}, - {IMX_8BIT, 0x0383, 0x01}, - {IMX_8BIT, 0x0385, 0x01}, - {IMX_8BIT, 0x0387, 0x01}, - {IMX_8BIT, 0x0390, 0x00}, - {IMX_8BIT, 0x0391, 0x11}, - {IMX_8BIT, 0x0392, 0x00}, - {IMX_8BIT, 0x0401, 0x02}, - {IMX_8BIT, 0x0404, 0x00}, - {IMX_8BIT, 0x0405, 0x14}, - {IMX_8BIT, 0x4082, 0x00}, - {IMX_8BIT, 0x4083, 0x00}, - {IMX_8BIT, 0x4203, 0xFF}, - {IMX_8BIT, 0x7006, 0x04}, - /* Size setting */ - {IMX_8BIT, 0x0344, 0x00}, /* 36, 194, 1039, a9f 4100x2316 */ - {IMX_8BIT, 0x0345, 0x36}, - {IMX_8BIT, 0x0346, 0x01}, - {IMX_8BIT, 0x0347, 0x94}, - {IMX_8BIT, 0x0348, 0x10}, - {IMX_8BIT, 0x0349, 0x39}, - {IMX_8BIT, 0x034A, 0x0A}, - {IMX_8BIT, 0x034B, 0x9F}, - {IMX_8BIT, 0x034C, 0x0C}, /* 3280x1852 */ - {IMX_8BIT, 0x034D, 0xD0}, - {IMX_8BIT, 0x034E, 0x07}, - {IMX_8BIT, 0x034F, 0x3C}, - {IMX_8BIT, 0x0350, 0x00}, - {IMX_8BIT, 0x0351, 0x00}, - {IMX_8BIT, 0x0352, 0x00}, - {IMX_8BIT, 0x0353, 0x00}, - {IMX_8BIT, 0x0354, 0x10}, /* 4100x2316 */ - {IMX_8BIT, 0x0355, 0x04}, - {IMX_8BIT, 0x0356, 0x09}, - {IMX_8BIT, 0x0357, 0x0C}, - {IMX_8BIT, 0x301D, 0x30}, - {IMX_8BIT, 0x3310, 0x0C}, - {IMX_8BIT, 0x3311, 0xD0}, - {IMX_8BIT, 0x3312, 0x07}, - {IMX_8BIT, 0x3313, 0x3C}, - {IMX_8BIT, 0x331C, 0x02}, - {IMX_8BIT, 0x331D, 0xA0}, - {IMX_8BIT, 0x4084, 0x0C}, - {IMX_8BIT, 0x4085, 0xD0}, - {IMX_8BIT, 0x4086, 0x07}, - {IMX_8BIT, 0x4087, 0x3C}, - {IMX_8BIT, 0x4400, 0x00}, - {IMX_TOK_TERM, 0, 0}, -}; - -/* - * FOV is: 3280x2464, larger then 3264x2448. - * Sensor output: 336x256 - * Cropping region: 3444x2624 - */ -static struct imx_reg const imx135_336x256[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - PLL_SETTINGS_FOR_MIPI_209_6MHZ_SALTBAY, - /* mode setting */ - {IMX_8BIT, 0x0108, 0x03}, - {IMX_8BIT, 0x0112, 0x0A}, - {IMX_8BIT, 0x0113, 0x0A}, - {IMX_8BIT, 0x0381, 0x01}, - {IMX_8BIT, 0x0383, 0x01}, - {IMX_8BIT, 0x0385, 0x01}, - {IMX_8BIT, 0x0387, 0x01}, - {IMX_8BIT, 0x0390, 0x01}, - {IMX_8BIT, 0x0391, 0x22}, - {IMX_8BIT, 0x0392, 0x00}, - {IMX_8BIT, 0x0401, 0x02}, /* 2x binning */ - {IMX_8BIT, 0x0404, 0x00}, - {IMX_8BIT, 0x0405, 0x52}, /* scaling: 82/16 */ - {IMX_8BIT, 0x4082, 0x00}, - {IMX_8BIT, 0x4083, 0x00}, - {IMX_8BIT, 0x4203, 0xFF}, - {IMX_8BIT, 0x7006, 0x04}, - /* Size setting */ - {IMX_8BIT, 0x0344, 0x01}, /* x_start: 374 */ - {IMX_8BIT, 0x0345, 0x76}, - {IMX_8BIT, 0x0346, 0x00}, /* y_start: 248 */ - {IMX_8BIT, 0x0347, 0xF8}, - {IMX_8BIT, 0x0348, 0x0E}, /* x_end: 3817 */ - {IMX_8BIT, 0x0349, 0xE9}, - {IMX_8BIT, 0x034A, 0x0B}, /* y_end: 2871 */ - {IMX_8BIT, 0x034B, 0x37}, - {IMX_8BIT, 0x034C, 0x01}, /* x_out: 336 */ - {IMX_8BIT, 0x034D, 0x50}, - {IMX_8BIT, 0x034E, 0x01}, /* y_out: 256 */ - {IMX_8BIT, 0x034F, 0x00}, - {IMX_8BIT, 0x0350, 0x00}, - {IMX_8BIT, 0x0351, 0x00}, - {IMX_8BIT, 0x0352, 0x00}, - {IMX_8BIT, 0x0353, 0x00}, - {IMX_8BIT, 0x0354, 0x06}, /* dig x_out: 1722 */ - {IMX_8BIT, 0x0355, 0xBA}, - {IMX_8BIT, 0x0356, 0x05}, /* dig y_out: 1312 */ - {IMX_8BIT, 0x0357, 0x20}, - {IMX_8BIT, 0x301D, 0x30}, - {IMX_8BIT, 0x3310, 0x01}, /* ?: x_out */ - {IMX_8BIT, 0x3311, 0x50}, - {IMX_8BIT, 0x3312, 0x01}, /* ?: y_out */ - {IMX_8BIT, 0x3313, 0x00}, - {IMX_8BIT, 0x331C, 0x02}, - {IMX_8BIT, 0x331D, 0x4E}, - {IMX_8BIT, 0x4084, 0x01}, /* ?: x_out */ - {IMX_8BIT, 0x4085, 0x50}, - {IMX_8BIT, 0x4086, 0x01}, /* ?: y_out */ - {IMX_8BIT, 0x4087, 0x00}, - {IMX_8BIT, 0x4400, 0x00}, - {IMX_TOK_TERM, 0, 0}, -}; - -static struct imx_reg const imx135_1m[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - PLL_SETTINGS_FOR_MIPI_209_6MHZ_SALTBAY, - /* mode setting */ - {IMX_8BIT, 0x0108, 0x03}, - {IMX_8BIT, 0x0112, 0x0A}, - {IMX_8BIT, 0x0113, 0x0A}, - {IMX_8BIT, 0x0381, 0x01}, - {IMX_8BIT, 0x0383, 0x01}, - {IMX_8BIT, 0x0385, 0x01}, - {IMX_8BIT, 0x0387, 0x01}, - {IMX_8BIT, 0x0390, 0x01}, - {IMX_8BIT, 0x0391, 0x22}, - {IMX_8BIT, 0x0392, 0x00}, - {IMX_8BIT, 0x0401, 0x02}, - {IMX_8BIT, 0x0404, 0x00}, - {IMX_8BIT, 0x0405, 0x1F}, - {IMX_8BIT, 0x4082, 0x00}, - {IMX_8BIT, 0x4083, 0x00}, - {IMX_8BIT, 0x4203, 0xFF}, - {IMX_8BIT, 0x7006, 0x04}, - /* Size setting */ - {IMX_8BIT, 0x0344, 0x00}, - {IMX_8BIT, 0x0345, 0x58}, - {IMX_8BIT, 0x0346, 0x00}, - {IMX_8BIT, 0x0347, 0x28}, - {IMX_8BIT, 0x0348, 0x10}, - {IMX_8BIT, 0x0349, 0x17}, - {IMX_8BIT, 0x034A, 0x0C}, - {IMX_8BIT, 0x034B, 0x07}, - {IMX_8BIT, 0x034C, 0x04}, - {IMX_8BIT, 0x034D, 0x10}, - {IMX_8BIT, 0x034E, 0x03}, - {IMX_8BIT, 0x034F, 0x10}, - {IMX_8BIT, 0x0350, 0x00}, - {IMX_8BIT, 0x0351, 0x00}, - {IMX_8BIT, 0x0352, 0x00}, - {IMX_8BIT, 0x0353, 0x00}, - {IMX_8BIT, 0x0354, 0x07}, - {IMX_8BIT, 0x0355, 0xE0}, - {IMX_8BIT, 0x0356, 0x05}, - {IMX_8BIT, 0x0357, 0xF0}, - {IMX_8BIT, 0x301D, 0x30}, - {IMX_8BIT, 0x3310, 0x04}, - {IMX_8BIT, 0x3311, 0x10}, - {IMX_8BIT, 0x3312, 0x03}, - {IMX_8BIT, 0x3313, 0x10}, - {IMX_8BIT, 0x331C, 0x02}, - {IMX_8BIT, 0x331D, 0x4E}, - {IMX_8BIT, 0x4084, 0x04}, - {IMX_8BIT, 0x4085, 0x10}, - {IMX_8BIT, 0x4086, 0x03}, - {IMX_8BIT, 0x4087, 0x10}, - {IMX_8BIT, 0x4400, 0x00}, - {IMX_TOK_TERM, 0, 0}, -}; - -static struct imx_reg const imx135_3m_binning[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - PLL_SETTINGS_FOR_MIPI_209_6MHZ_SALTBAY, - /* Mode setting */ - {IMX_8BIT, 0x0108, 0x03}, - {IMX_8BIT, 0x0112, 0x0A}, - {IMX_8BIT, 0x0113, 0x0A}, - {IMX_8BIT, 0x0381, 0x01}, - {IMX_8BIT, 0x0383, 0x01}, - {IMX_8BIT, 0x0385, 0x01}, - {IMX_8BIT, 0x0387, 0x01}, - {IMX_8BIT, 0x0390, 0x01}, /* Binning */ - {IMX_8BIT, 0x0391, 0x22}, /* 2x2 binning */ - {IMX_8BIT, 0x0392, 0x00}, /* average */ - {IMX_8BIT, 0x0401, 0x00}, - {IMX_8BIT, 0x0404, 0x00}, - {IMX_8BIT, 0x0405, 0x10}, - {IMX_8BIT, 0x4082, 0x01}, - {IMX_8BIT, 0x4083, 0x01}, - {IMX_8BIT, 0x4203, 0xFF}, - {IMX_8BIT, 0x7006, 0x04}, - /* Size setting */ - {IMX_8BIT, 0x0344, 0x00}, - {IMX_8BIT, 0x0345, 0x28}, - {IMX_8BIT, 0x0346, 0x00}, - {IMX_8BIT, 0x0347, 0x08}, - {IMX_8BIT, 0x0348, 0x10}, - {IMX_8BIT, 0x0349, 0x47}, - {IMX_8BIT, 0x034A, 0x0C}, - {IMX_8BIT, 0x034B, 0x27}, - {IMX_8BIT, 0x034C, 0x08}, - {IMX_8BIT, 0x034D, 0x10}, - {IMX_8BIT, 0x034E, 0x06}, - {IMX_8BIT, 0x034F, 0x10}, - {IMX_8BIT, 0x0350, 0x00}, - {IMX_8BIT, 0x0351, 0x00}, - {IMX_8BIT, 0x0352, 0x00}, - {IMX_8BIT, 0x0353, 0x00}, - {IMX_8BIT, 0x0354, 0x08}, - {IMX_8BIT, 0x0355, 0x10}, - {IMX_8BIT, 0x0356, 0x06}, - {IMX_8BIT, 0x0357, 0x10}, - {IMX_8BIT, 0x301D, 0x30}, - {IMX_8BIT, 0x3310, 0x08}, - {IMX_8BIT, 0x3311, 0x10}, - {IMX_8BIT, 0x3312, 0x06}, - {IMX_8BIT, 0x3313, 0x10}, - {IMX_8BIT, 0x331C, 0x00}, - {IMX_8BIT, 0x331D, 0xAA}, - {IMX_8BIT, 0x4084, 0x00}, - {IMX_8BIT, 0x4085, 0x00}, - {IMX_8BIT, 0x4086, 0x00}, - {IMX_8BIT, 0x4087, 0x00}, - {IMX_8BIT, 0x4400, 0x00}, - {IMX_TOK_TERM, 0, 0}, -}; - -/* 1080P 1936x1104 */ -static struct imx_reg const imx135_1080p_binning[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - PLL_SETTINGS_FOR_MIPI_209_6MHZ_SALTBAY, - /* Mode setting */ - {IMX_8BIT, 0x0108, 0x03}, - {IMX_8BIT, 0x0112, 0x0A}, - {IMX_8BIT, 0x0113, 0x0A}, - {IMX_8BIT, 0x0381, 0x01}, - {IMX_8BIT, 0x0383, 0x01}, - {IMX_8BIT, 0x0385, 0x01}, - {IMX_8BIT, 0x0387, 0x01}, - {IMX_8BIT, 0x0390, 0x01}, - {IMX_8BIT, 0x0391, 0x22}, - {IMX_8BIT, 0x0392, 0x00}, - {IMX_8BIT, 0x0401, 0x02}, - {IMX_8BIT, 0x0404, 0x00}, - {IMX_8BIT, 0x0405, 0x11}, - {IMX_8BIT, 0x4082, 0x00}, - {IMX_8BIT, 0x4083, 0x00}, - {IMX_8BIT, 0x7006, 0x04}, - /* Size setting */ - {IMX_8BIT, 0x0344, 0x00}, - {IMX_8BIT, 0x0345, 0x2E}, - {IMX_8BIT, 0x0346, 0x01}, - {IMX_8BIT, 0x0347, 0x84}, - {IMX_8BIT, 0x0348, 0x10}, - {IMX_8BIT, 0x0349, 0x41}, - {IMX_8BIT, 0x034A, 0x0A}, - {IMX_8BIT, 0x034B, 0xAF}, - {IMX_8BIT, 0x034C, 0x07}, - {IMX_8BIT, 0x034D, 0x90}, - {IMX_8BIT, 0x034E, 0x04}, - {IMX_8BIT, 0x034F, 0x50}, - {IMX_8BIT, 0x0350, 0x00}, - {IMX_8BIT, 0x0351, 0x00}, - {IMX_8BIT, 0x0352, 0x00}, - {IMX_8BIT, 0x0353, 0x00}, - {IMX_8BIT, 0x0354, 0x08}, - {IMX_8BIT, 0x0355, 0x0A}, - {IMX_8BIT, 0x0356, 0x04}, - {IMX_8BIT, 0x0357, 0x96}, - {IMX_8BIT, 0x301D, 0x30}, - {IMX_8BIT, 0x3310, 0x07}, - {IMX_8BIT, 0x3311, 0x90}, - {IMX_8BIT, 0x3312, 0x04}, - {IMX_8BIT, 0x3313, 0x50}, - {IMX_8BIT, 0x331C, 0x01}, - {IMX_8BIT, 0x331D, 0x00}, - {IMX_8BIT, 0x4084, 0x07}, - {IMX_8BIT, 0x4085, 0x90}, - {IMX_8BIT, 0x4086, 0x04}, - {IMX_8BIT, 0x4087, 0x50}, - {IMX_8BIT, 0x4400, 0x00}, - {IMX_TOK_TERM, 0, 0}, -}; - -static const struct imx_reg imx135_1080p_nodvs_fullfov_max_clock[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - PLL_SETTINGS_FOR_MIPI_451_2MHZ_SALTBAY, - /* mode setting */ - { IMX_8BIT, 0x0108, 0x03 }, - { IMX_8BIT, 0x0112, 0x0A }, - { IMX_8BIT, 0x0113, 0x0A }, - { IMX_8BIT, 0x0381, 0x01 }, - { IMX_8BIT, 0x0383, 0x01 }, - { IMX_8BIT, 0x0385, 0x01 }, - { IMX_8BIT, 0x0387, 0x01 }, - { IMX_8BIT, 0x0390, 0x01 }, - { IMX_8BIT, 0x0391, 0x22 }, - { IMX_8BIT, 0x0392, 0x00 }, - { IMX_8BIT, 0x0401, 0x00 }, - { IMX_8BIT, 0x0404, 0x00 }, - { IMX_8BIT, 0x0405, 0x10 }, - { IMX_8BIT, 0x4082, 0x01 }, - { IMX_8BIT, 0x4083, 0x01 }, - { IMX_8BIT, 0x7006, 0x04 }, - /* size setting */ - { IMX_8BIT, 0x0344, 0x00 }, /* 168,464,4039,2655: 3872x2192 */ - { IMX_8BIT, 0x0345, 0xA8 }, - { IMX_8BIT, 0x0346, 0x01 }, - { IMX_8BIT, 0x0347, 0xD0 }, - { IMX_8BIT, 0x0348, 0x0F }, - { IMX_8BIT, 0x0349, 0xC7 }, - { IMX_8BIT, 0x034A, 0x0A }, - { IMX_8BIT, 0x034B, 0x5F }, - { IMX_8BIT, 0x034C, 0x07 }, /*1936 x 1096 */ - { IMX_8BIT, 0x034D, 0x90 }, - { IMX_8BIT, 0x034E, 0x04 }, - { IMX_8BIT, 0x034F, 0x48 }, - { IMX_8BIT, 0x0350, 0x00 }, - { IMX_8BIT, 0x0351, 0x00 }, - { IMX_8BIT, 0x0352, 0x00 }, - { IMX_8BIT, 0x0353, 0x00 }, - { IMX_8BIT, 0x0354, 0x07 }, /*1936 x 1096 */ - { IMX_8BIT, 0x0355, 0x90 }, - { IMX_8BIT, 0x0356, 0x04 }, - { IMX_8BIT, 0x0357, 0x48 }, - { IMX_8BIT, 0x301D, 0x30 }, - { IMX_8BIT, 0x3310, 0x07 }, - { IMX_8BIT, 0x3311, 0x90 }, - { IMX_8BIT, 0x3312, 0x04 }, - { IMX_8BIT, 0x3313, 0x48 }, - { IMX_8BIT, 0x331C, 0x04 }, - { IMX_8BIT, 0x331D, 0xB0 }, - { IMX_8BIT, 0x4084, 0x07 }, - { IMX_8BIT, 0x4085, 0x90 }, - { IMX_8BIT, 0x4086, 0x04 }, - { IMX_8BIT, 0x4087, 0x48 }, - { IMX_8BIT, 0x4400, 0x00 }, - { IMX_TOK_TERM, 0, 0} -}; - -/* 1080P NODVS 1936x1096 */ -static const struct imx_reg imx135_1080p_nodvs_max_clock[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - PLL_SETTINGS_FOR_MIPI_451_2MHZ_SALTBAY, - /* mode setting */ - { IMX_8BIT, 0x0108, 0x03 }, - { IMX_8BIT, 0x0112, 0x0A }, - { IMX_8BIT, 0x0113, 0x0A }, - { IMX_8BIT, 0x0381, 0x01 }, - { IMX_8BIT, 0x0383, 0x01 }, - { IMX_8BIT, 0x0385, 0x01 }, - { IMX_8BIT, 0x0387, 0x01 }, - { IMX_8BIT, 0x0390, 0x01 }, - { IMX_8BIT, 0x0391, 0x22 }, - { IMX_8BIT, 0x0392, 0x00 }, - { IMX_8BIT, 0x0401, 0x02 }, - { IMX_8BIT, 0x0404, 0x00 }, - { IMX_8BIT, 0x0405, 0x11 }, - { IMX_8BIT, 0x4082, 0x00 }, - { IMX_8BIT, 0x4083, 0x00 }, - { IMX_8BIT, 0x7006, 0x04 }, - /* size setting */ - { IMX_8BIT, 0x0344, 0x00 }, /* 46,396,4161,2727: 4116x2332 */ - { IMX_8BIT, 0x0345, 0x2E }, - { IMX_8BIT, 0x0346, 0x01 }, - { IMX_8BIT, 0x0347, 0x8C }, - { IMX_8BIT, 0x0348, 0x10 }, - { IMX_8BIT, 0x0349, 0x41 }, - { IMX_8BIT, 0x034A, 0x0A }, - { IMX_8BIT, 0x034B, 0xA7 }, - { IMX_8BIT, 0x034C, 0x07 }, /*1936 x 1096 */ - { IMX_8BIT, 0x034D, 0x90 }, - { IMX_8BIT, 0x034E, 0x04 }, - { IMX_8BIT, 0x034F, 0x48 }, - { IMX_8BIT, 0x0350, 0x00 }, - { IMX_8BIT, 0x0351, 0x00 }, - { IMX_8BIT, 0x0352, 0x00 }, - { IMX_8BIT, 0x0353, 0x00 }, - { IMX_8BIT, 0x0354, 0x08 }, /* 2058x1166 */ - { IMX_8BIT, 0x0355, 0x0A }, - { IMX_8BIT, 0x0356, 0x04 }, - { IMX_8BIT, 0x0357, 0x8E }, - { IMX_8BIT, 0x301D, 0x30 }, - { IMX_8BIT, 0x3310, 0x07 }, - { IMX_8BIT, 0x3311, 0x90 }, - { IMX_8BIT, 0x3312, 0x04 }, - { IMX_8BIT, 0x3313, 0x48 }, - { IMX_8BIT, 0x331C, 0x04 }, - { IMX_8BIT, 0x331D, 0xB0 }, - { IMX_8BIT, 0x4084, 0x07 }, - { IMX_8BIT, 0x4085, 0x90 }, - { IMX_8BIT, 0x4086, 0x04 }, - { IMX_8BIT, 0x4087, 0x48 }, - { IMX_8BIT, 0x4400, 0x00 }, - { IMX_TOK_TERM, 0, 0} -}; - -/* 1080P 10%DVS 2104x1184 */ -static const struct imx_reg imx135_1080p_10_dvs_max_clock[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - PLL_SETTINGS_FOR_MIPI_451_2MHZ_SALTBAY, - /* mode setting */ - { IMX_8BIT, 0x0108, 0x03 }, - { IMX_8BIT, 0x0112, 0x0A }, - { IMX_8BIT, 0x0113, 0x0A }, - { IMX_8BIT, 0x0381, 0x01 }, - { IMX_8BIT, 0x0383, 0x01 }, - { IMX_8BIT, 0x0385, 0x01 }, - { IMX_8BIT, 0x0387, 0x01 }, - { IMX_8BIT, 0x0390, 0x01 }, - { IMX_8BIT, 0x0391, 0x22 }, - { IMX_8BIT, 0x0392, 0x00 }, - { IMX_8BIT, 0x0401, 0x00 }, - { IMX_8BIT, 0x0404, 0x00 }, - { IMX_8BIT, 0x0405, 0x10 }, - { IMX_8BIT, 0x4082, 0x01 }, - { IMX_8BIT, 0x4083, 0x01 }, - { IMX_8BIT, 0x7006, 0x04 }, - /* size setting */ - { IMX_8BIT, 0x0344, 0x00 }, /* 0,376,4207,2743: 4208x2368 */ - { IMX_8BIT, 0x0345, 0x00 }, - { IMX_8BIT, 0x0346, 0x01 }, - { IMX_8BIT, 0x0347, 0x78 }, - { IMX_8BIT, 0x0348, 0x10 }, - { IMX_8BIT, 0x0349, 0x6F }, - { IMX_8BIT, 0x034A, 0x0A }, - { IMX_8BIT, 0x034B, 0xB7 }, - { IMX_8BIT, 0x034C, 0x08 }, /* 2104 x 1184 */ - { IMX_8BIT, 0x034D, 0x38 }, - { IMX_8BIT, 0x034E, 0x04 }, - { IMX_8BIT, 0x034F, 0xA0 }, - { IMX_8BIT, 0x0350, 0x00 }, - { IMX_8BIT, 0x0351, 0x00 }, - { IMX_8BIT, 0x0352, 0x00 }, - { IMX_8BIT, 0x0353, 0x00 }, - { IMX_8BIT, 0x0354, 0x08 }, /* 2104 x 1184 */ - { IMX_8BIT, 0x0355, 0x38 }, - { IMX_8BIT, 0x0356, 0x04 }, - { IMX_8BIT, 0x0357, 0xA0 }, - { IMX_8BIT, 0x301D, 0x30 }, - { IMX_8BIT, 0x3310, 0x08 }, - { IMX_8BIT, 0x3311, 0x38 }, - { IMX_8BIT, 0x3312, 0x04 }, - { IMX_8BIT, 0x3313, 0xA0 }, - { IMX_8BIT, 0x331C, 0x04 }, - { IMX_8BIT, 0x331D, 0xB0 }, - { IMX_8BIT, 0x4084, 0x00 }, - { IMX_8BIT, 0x4085, 0x00 }, - { IMX_8BIT, 0x4086, 0x00 }, - { IMX_8BIT, 0x4087, 0x00 }, - { IMX_8BIT, 0x4400, 0x00 }, - { IMX_TOK_TERM, 0, 0} -}; - -static const struct imx_reg imx135_720pdvs_max_clock[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - PLL_SETTINGS_FOR_MIPI_451_2MHZ_SALTBAY, - /* mode setting */ - { IMX_8BIT, 0x0108, 0x03 }, - { IMX_8BIT, 0x0112, 0x0A }, - { IMX_8BIT, 0x0113, 0x0A }, - { IMX_8BIT, 0x0381, 0x01 }, - { IMX_8BIT, 0x0383, 0x01 }, - { IMX_8BIT, 0x0385, 0x01 }, - { IMX_8BIT, 0x0387, 0x01 }, - { IMX_8BIT, 0x0390, 0x01 }, - { IMX_8BIT, 0x0391, 0x22 }, - { IMX_8BIT, 0x0392, 0x00 }, - { IMX_8BIT, 0x0401, 0x02 }, - { IMX_8BIT, 0x0404, 0x00 }, - { IMX_8BIT, 0x0405, 0x15 }, - { IMX_8BIT, 0x4082, 0x00 }, - { IMX_8BIT, 0x4083, 0x00 }, - { IMX_8BIT, 0x7006, 0x04 }, - /* size setting */ - { IMX_8BIT, 0x0344, 0x00 }, /* 46,404,4161,2715: 4116x2312 */ - { IMX_8BIT, 0x0345, 0x2E }, - { IMX_8BIT, 0x0346, 0x01 }, - { IMX_8BIT, 0x0347, 0x94 }, - { IMX_8BIT, 0x0348, 0x10 }, - { IMX_8BIT, 0x0349, 0x41 }, - { IMX_8BIT, 0x034A, 0x0A }, - { IMX_8BIT, 0x034B, 0x9B }, - { IMX_8BIT, 0x034C, 0x06 }, /*1568 x 880 */ - { IMX_8BIT, 0x034D, 0x20 }, - { IMX_8BIT, 0x034E, 0x03 }, - { IMX_8BIT, 0x034F, 0x70 }, - { IMX_8BIT, 0x0350, 0x00 }, - { IMX_8BIT, 0x0351, 0x00 }, - { IMX_8BIT, 0x0352, 0x00 }, - { IMX_8BIT, 0x0353, 0x00 }, - { IMX_8BIT, 0x0354, 0x08 }, /*2058 x 1156 */ - { IMX_8BIT, 0x0355, 0x0A }, - { IMX_8BIT, 0x0356, 0x04 }, - { IMX_8BIT, 0x0357, 0x84 }, - { IMX_8BIT, 0x301D, 0x30 }, - { IMX_8BIT, 0x3310, 0x06 }, - { IMX_8BIT, 0x3311, 0x20 }, - { IMX_8BIT, 0x3312, 0x03 }, - { IMX_8BIT, 0x3313, 0x70 }, - { IMX_8BIT, 0x331C, 0x04 }, - { IMX_8BIT, 0x331D, 0x4C }, - { IMX_8BIT, 0x4084, 0x06 }, - { IMX_8BIT, 0x4085, 0x20 }, - { IMX_8BIT, 0x4086, 0x03 }, - { IMX_8BIT, 0x4087, 0x70 }, - { IMX_8BIT, 0x4400, 0x00 }, - { IMX_TOK_TERM, 0, 0} -}; - -/******************* Video Modes ******************/ - -/* 1080P DVS 2336x1320 */ -static const struct imx_reg imx135_2336x1320_max_clock[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - PLL_SETTINGS_FOR_MIPI_451_2MHZ_SALTBAY, - /* mode setting */ - { IMX_8BIT, 0x0108, 0x03 }, - { IMX_8BIT, 0x0112, 0x0A }, - { IMX_8BIT, 0x0113, 0x0A }, - { IMX_8BIT, 0x0381, 0x01 }, - { IMX_8BIT, 0x0383, 0x01 }, - { IMX_8BIT, 0x0385, 0x01 }, - { IMX_8BIT, 0x0387, 0x01 }, - { IMX_8BIT, 0x0390, 0x00 }, - { IMX_8BIT, 0x0391, 0x11 }, - { IMX_8BIT, 0x0392, 0x00 }, - { IMX_8BIT, 0x0401, 0x02 }, - { IMX_8BIT, 0x0404, 0x00 }, - { IMX_8BIT, 0x0405, 0x1C }, - { IMX_8BIT, 0x4082, 0x00 }, - { IMX_8BIT, 0x4083, 0x00 }, - { IMX_8BIT, 0x7006, 0x04 }, - /* size setting */ - { IMX_8BIT, 0x0344, 0x00 }, /* 60,404,4147,2715: 4088x2312 */ - { IMX_8BIT, 0x0345, 0x3C }, - { IMX_8BIT, 0x0346, 0x01 }, - { IMX_8BIT, 0x0347, 0x94 }, - { IMX_8BIT, 0x0348, 0x10 }, - { IMX_8BIT, 0x0349, 0x33 }, - { IMX_8BIT, 0x034A, 0x0A }, - { IMX_8BIT, 0x034B, 0x9B }, - { IMX_8BIT, 0x034C, 0x09 }, /*2336 x 1320 */ - { IMX_8BIT, 0x034D, 0x20 }, - { IMX_8BIT, 0x034E, 0x05 }, - { IMX_8BIT, 0x034F, 0x28 }, - { IMX_8BIT, 0x0350, 0x00 }, - { IMX_8BIT, 0x0351, 0x00 }, - { IMX_8BIT, 0x0352, 0x00 }, - { IMX_8BIT, 0x0353, 0x00 }, - { IMX_8BIT, 0x0354, 0x0F }, /* 4088x2312 */ - { IMX_8BIT, 0x0355, 0xF8 }, - { IMX_8BIT, 0x0356, 0x09 }, - { IMX_8BIT, 0x0357, 0x08 }, - { IMX_8BIT, 0x301D, 0x30 }, - { IMX_8BIT, 0x3310, 0x09 }, - { IMX_8BIT, 0x3311, 0x20 }, - { IMX_8BIT, 0x3312, 0x05 }, - { IMX_8BIT, 0x3313, 0x28 }, - { IMX_8BIT, 0x331C, 0x04 }, - { IMX_8BIT, 0x331D, 0xE2 }, - { IMX_8BIT, 0x4084, 0x09 }, - { IMX_8BIT, 0x4085, 0x20 }, - { IMX_8BIT, 0x4086, 0x05 }, - { IMX_8BIT, 0x4087, 0x28 }, - { IMX_8BIT, 0x4400, 0x00 }, - { IMX_TOK_TERM, 0, 0} -}; - -/* 1080P DVS 2336x1320 Cropped */ -static const struct imx_reg imx135_2336x1320_cropped_mipi499[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - PLL_SETTINGS_FOR_MIPI_499_2MHZ_SALTBAY, - /* mode setting */ - { IMX_8BIT, 0x0108, 0x03 }, - { IMX_8BIT, 0x0112, 0x0A }, - { IMX_8BIT, 0x0113, 0x0A }, - { IMX_8BIT, 0x0381, 0x01 }, - { IMX_8BIT, 0x0383, 0x01 }, - { IMX_8BIT, 0x0385, 0x01 }, - { IMX_8BIT, 0x0387, 0x01 }, - { IMX_8BIT, 0x0390, 0x00 }, - { IMX_8BIT, 0x0391, 0x11 }, - { IMX_8BIT, 0x0392, 0x00 }, - { IMX_8BIT, 0x0401, 0x02 }, - { IMX_8BIT, 0x0404, 0x00 }, - { IMX_8BIT, 0x0405, 0x1C }, - { IMX_8BIT, 0x4082, 0x01 }, - { IMX_8BIT, 0x4083, 0x01 }, - { IMX_8BIT, 0x7006, 0x04 }, - /* size setting */ - { IMX_8BIT, 0x0344, 0x03 }, /* 936,900,3271,2219: 2336x1320 */ - { IMX_8BIT, 0x0345, 0xA8 }, - { IMX_8BIT, 0x0346, 0x03 }, - { IMX_8BIT, 0x0347, 0x84 }, - { IMX_8BIT, 0x0348, 0x0C }, - { IMX_8BIT, 0x0349, 0xC7 }, - { IMX_8BIT, 0x034A, 0x08 }, - { IMX_8BIT, 0x034B, 0xAB }, - { IMX_8BIT, 0x034C, 0x09 }, /* 2336 x 1320 */ - { IMX_8BIT, 0x034D, 0x20 }, - { IMX_8BIT, 0x034E, 0x05 }, - { IMX_8BIT, 0x034F, 0x28 }, - { IMX_8BIT, 0x0350, 0x00 }, - { IMX_8BIT, 0x0351, 0x00 }, - { IMX_8BIT, 0x0352, 0x00 }, - { IMX_8BIT, 0x0353, 0x00 }, - { IMX_8BIT, 0x0354, 0x09 }, /* 2336 x 1320 */ - { IMX_8BIT, 0x0355, 0x20 }, - { IMX_8BIT, 0x0356, 0x05 }, - { IMX_8BIT, 0x0357, 0x28 }, - { IMX_8BIT, 0x301D, 0x30 }, - { IMX_8BIT, 0x3310, 0x09 }, - { IMX_8BIT, 0x3311, 0x20 }, - { IMX_8BIT, 0x3312, 0x05 }, - { IMX_8BIT, 0x3313, 0x28 }, - { IMX_8BIT, 0x331C, 0x00 }, - { IMX_8BIT, 0x331D, 0xB4 }, - { IMX_8BIT, 0x4084, 0x09 }, - { IMX_8BIT, 0x4085, 0x20 }, - { IMX_8BIT, 0x4086, 0x05 }, - { IMX_8BIT, 0x4087, 0x28 }, - { IMX_8BIT, 0x4400, 0x00 }, - { IMX_TOK_TERM, 0, 0} -}; - -/* 720P DVS 1568 x 880 */ -static const struct imx_reg imx135_720p_dvs_binning[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - PLL_SETTINGS_FOR_MIPI_209_6MHZ_SALTBAY, - /* mode setting */ - { IMX_8BIT, 0x0108, 0x03 }, - { IMX_8BIT, 0x0112, 0x0A }, - { IMX_8BIT, 0x0113, 0x0A }, - { IMX_8BIT, 0x0381, 0x01 }, - { IMX_8BIT, 0x0383, 0x01 }, - { IMX_8BIT, 0x0385, 0x01 }, - { IMX_8BIT, 0x0387, 0x01 }, - { IMX_8BIT, 0x0390, 0x01 }, - { IMX_8BIT, 0x0391, 0x22 }, - { IMX_8BIT, 0x0392, 0x00 }, - { IMX_8BIT, 0x0401, 0x02 }, - { IMX_8BIT, 0x0404, 0x00 }, - { IMX_8BIT, 0x0405, 0x15 }, - { IMX_8BIT, 0x4082, 0x00 }, - { IMX_8BIT, 0x4083, 0x00 }, - { IMX_8BIT, 0x7006, 0x04 }, - /* size setting */ - { IMX_8BIT, 0x0344, 0x00 }, /* 46,404,4161,2715: 4116x2312 */ - { IMX_8BIT, 0x0345, 0x2e }, - { IMX_8BIT, 0x0346, 0x01 }, - { IMX_8BIT, 0x0347, 0x94 }, - { IMX_8BIT, 0x0348, 0x10 }, - { IMX_8BIT, 0x0349, 0x41 }, - { IMX_8BIT, 0x034A, 0x0A }, - { IMX_8BIT, 0x034B, 0x9B }, - { IMX_8BIT, 0x034C, 0x06 }, /*1568 x 880 */ - { IMX_8BIT, 0x034D, 0x20 }, - { IMX_8BIT, 0x034E, 0x03 }, - { IMX_8BIT, 0x034F, 0x70 }, - { IMX_8BIT, 0x0350, 0x00 }, - { IMX_8BIT, 0x0351, 0x00 }, - { IMX_8BIT, 0x0352, 0x00 }, - { IMX_8BIT, 0x0353, 0x00 }, - { IMX_8BIT, 0x0354, 0x08 }, /* 2058x1156 */ - { IMX_8BIT, 0x0355, 0x0a }, - { IMX_8BIT, 0x0356, 0x04 }, - { IMX_8BIT, 0x0357, 0x84 }, - { IMX_8BIT, 0x301D, 0x30 }, /* TODO! */ - { IMX_8BIT, 0x3310, 0x06 }, - { IMX_8BIT, 0x3311, 0x20 }, - { IMX_8BIT, 0x3312, 0x03 }, - { IMX_8BIT, 0x3313, 0x70 }, - { IMX_8BIT, 0x331C, 0x01 }, /* TODO! */ - { IMX_8BIT, 0x331D, 0xd6 }, /* TODO! */ - { IMX_8BIT, 0x4084, 0x06 }, - { IMX_8BIT, 0x4085, 0x20 }, - { IMX_8BIT, 0x4086, 0x03 }, - { IMX_8BIT, 0x4087, 0x70 }, - { IMX_8BIT, 0x4400, 0x00 }, - { IMX_TOK_TERM, 0, 0} -}; - -/* wvga: H : 1640 V : 1024 */ -static const struct imx_reg imx135_wvga_dvs_binning[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - PLL_SETTINGS_FOR_MIPI_209_6MHZ_SALTBAY, - /* Mode setting */ - {IMX_8BIT, 0x0108, 0x03 }, - {IMX_8BIT, 0x0112, 0x0A }, - {IMX_8BIT, 0x0113, 0x0A }, - {IMX_8BIT, 0x0381, 0x01 }, - {IMX_8BIT, 0x0383, 0x01 }, - {IMX_8BIT, 0x0385, 0x01 }, - {IMX_8BIT, 0x0387, 0x01 }, - {IMX_8BIT, 0x0390, 0x01 }, - {IMX_8BIT, 0x0391, 0x22 }, - {IMX_8BIT, 0x0392, 0x00 }, - {IMX_8BIT, 0x0401, 0x02 }, - {IMX_8BIT, 0x0404, 0x00 }, - {IMX_8BIT, 0x0405, 0x14 }, - {IMX_8BIT, 0x4082, 0x00 }, - {IMX_8BIT, 0x4083, 0x00 }, - {IMX_8BIT, 0x7006, 0x04 }, - /* Size setting */ - {IMX_8BIT, 0x0344, 0x00 }, - {IMX_8BIT, 0x0345, 0x36 }, - {IMX_8BIT, 0x0346, 0x01 }, - {IMX_8BIT, 0x0347, 0x18 }, - {IMX_8BIT, 0x0348, 0x10 }, - {IMX_8BIT, 0x0349, 0x39 }, - {IMX_8BIT, 0x034A, 0x0B }, - {IMX_8BIT, 0x034B, 0x17 }, - {IMX_8BIT, 0x034C, 0x06 }, - {IMX_8BIT, 0x034D, 0x68 }, - {IMX_8BIT, 0x034E, 0x04 }, - {IMX_8BIT, 0x034F, 0x00 }, - {IMX_8BIT, 0x0350, 0x00 }, - {IMX_8BIT, 0x0351, 0x00 }, - {IMX_8BIT, 0x0352, 0x00 }, - {IMX_8BIT, 0x0353, 0x00 }, - {IMX_8BIT, 0x0354, 0x08 }, - {IMX_8BIT, 0x0355, 0x02 }, - {IMX_8BIT, 0x0356, 0x05 }, - {IMX_8BIT, 0x0357, 0x00 }, - {IMX_8BIT, 0x301D, 0x30 }, - {IMX_8BIT, 0x3310, 0x06 }, - {IMX_8BIT, 0x3311, 0x68 }, - {IMX_8BIT, 0x3312, 0x04 }, - {IMX_8BIT, 0x3313, 0x00 }, - {IMX_8BIT, 0x331C, 0x01 }, - {IMX_8BIT, 0x331D, 0xBD }, - {IMX_8BIT, 0x4084, 0x06 }, - {IMX_8BIT, 0x4085, 0x68 }, - {IMX_8BIT, 0x4086, 0x04 }, - {IMX_8BIT, 0x4087, 0x00 }, - {IMX_8BIT, 0x4400, 0x00 }, - {IMX_TOK_TERM, 0, 0} -}; - -/* 480P 1036 x 696 */ -static const struct imx_reg imx135_480p_binning[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - PLL_SETTINGS_FOR_MIPI_209_6MHZ_SALTBAY, - /* Mode setting */ - {IMX_8BIT, 0x0108, 0x03 }, - {IMX_8BIT, 0x0112, 0x0A }, - {IMX_8BIT, 0x0113, 0x0A }, - {IMX_8BIT, 0x0381, 0x01 }, - {IMX_8BIT, 0x0383, 0x01 }, - {IMX_8BIT, 0x0385, 0x01 }, - {IMX_8BIT, 0x0387, 0x01 }, - {IMX_8BIT, 0x0390, 0x01 }, - {IMX_8BIT, 0x0391, 0x44 }, - {IMX_8BIT, 0x0392, 0x00 }, - {IMX_8BIT, 0x0401, 0x00 }, - {IMX_8BIT, 0x0404, 0x00 }, - {IMX_8BIT, 0x0405, 0x10 },/* No scal */ - {IMX_8BIT, 0x4082, 0x00 }, - {IMX_8BIT, 0x4083, 0x00 }, - {IMX_8BIT, 0x7006, 0x04 }, - /* Size setting */ - {IMX_8BIT, 0x0344, 0x00 }, /* 52,20,4155, 3099 4144x2784*/ - {IMX_8BIT, 0x0345, 0x20 }, - {IMX_8BIT, 0x0346, 0x00 }, - {IMX_8BIT, 0x0347, 0xA8 }, - {IMX_8BIT, 0x0348, 0x10 }, - {IMX_8BIT, 0x0349, 0x4F }, - {IMX_8BIT, 0x034A, 0x0B }, - {IMX_8BIT, 0x034B, 0x88 }, - {IMX_8BIT, 0x034C, 0x04 }, /* 1036 * 696 */ - {IMX_8BIT, 0x034D, 0x0C }, - {IMX_8BIT, 0x034E, 0x02 }, - {IMX_8BIT, 0x034F, 0xB8 }, - {IMX_8BIT, 0x0350, 0x00 }, - {IMX_8BIT, 0x0351, 0x00 }, - {IMX_8BIT, 0x0352, 0x00 }, - {IMX_8BIT, 0x0353, 0x00 }, - {IMX_8BIT, 0x0354, 0x04 }, /* 1036x696 */ - {IMX_8BIT, 0x0355, 0x0C }, - {IMX_8BIT, 0x0356, 0x02 }, - {IMX_8BIT, 0x0357, 0xB8 }, - {IMX_8BIT, 0x301D, 0x30 }, - {IMX_8BIT, 0x3310, 0x04 }, - {IMX_8BIT, 0x3311, 0x0C }, - {IMX_8BIT, 0x3312, 0x02 }, - {IMX_8BIT, 0x3313, 0xB8 }, - {IMX_8BIT, 0x331C, 0x02 }, - {IMX_8BIT, 0x331D, 0x21 }, - {IMX_8BIT, 0x4084, 0x04 }, - {IMX_8BIT, 0x4085, 0x0C }, - {IMX_8BIT, 0x4086, 0x02 }, - {IMX_8BIT, 0x4087, 0xB8 }, - {IMX_8BIT, 0x4400, 0x00 }, - {IMX_TOK_TERM, 0, 0} -}; - -/* 480P DVS 936 x 602 */ -static const struct imx_reg imx135_480p_dvs_binning[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - PLL_SETTINGS_FOR_MIPI_209_6MHZ_SALTBAY, - /* mode setting */ - { IMX_8BIT, 0x0108, 0x03 }, - { IMX_8BIT, 0x0112, 0x0A }, - { IMX_8BIT, 0x0113, 0x0A }, - { IMX_8BIT, 0x0381, 0x01 }, - { IMX_8BIT, 0x0383, 0x01 }, - { IMX_8BIT, 0x0385, 0x01 }, - { IMX_8BIT, 0x0387, 0x01 }, - { IMX_8BIT, 0x0390, 0x01 }, - { IMX_8BIT, 0x0391, 0x22 }, - { IMX_8BIT, 0x0392, 0x00 }, - { IMX_8BIT, 0x0401, 0x02 }, - { IMX_8BIT, 0x0404, 0x00 }, - { IMX_8BIT, 0x0405, 0x23 }, - { IMX_8BIT, 0x4082, 0x00 }, - { IMX_8BIT, 0x4083, 0x00 }, - { IMX_8BIT, 0x7006, 0x04 }, - /* size setting */ - { IMX_8BIT, 0x0344, 0x00 }, /* 56,244,4151,2877: 4096x2634 */ - { IMX_8BIT, 0x0345, 0x38 }, - { IMX_8BIT, 0x0346, 0x00 }, - { IMX_8BIT, 0x0347, 0xf4 }, - { IMX_8BIT, 0x0348, 0x10 }, - { IMX_8BIT, 0x0349, 0x37 }, - { IMX_8BIT, 0x034A, 0x0b }, - { IMX_8BIT, 0x034B, 0x3d }, - { IMX_8BIT, 0x034C, 0x03 }, /* 936 x 602 */ - { IMX_8BIT, 0x034D, 0xa8 }, - { IMX_8BIT, 0x034E, 0x02 }, - { IMX_8BIT, 0x034F, 0x5a }, - { IMX_8BIT, 0x0350, 0x00 }, - { IMX_8BIT, 0x0351, 0x00 }, - { IMX_8BIT, 0x0352, 0x00 }, - { IMX_8BIT, 0x0353, 0x00 }, - { IMX_8BIT, 0x0354, 0x08 }, /* 2058x1156 */ - { IMX_8BIT, 0x0355, 0x00 }, - { IMX_8BIT, 0x0356, 0x05 }, - { IMX_8BIT, 0x0357, 0x25 }, - { IMX_8BIT, 0x301D, 0x30 }, /* TODO! */ - { IMX_8BIT, 0x3310, 0x03 }, - { IMX_8BIT, 0x3311, 0xa8 }, - { IMX_8BIT, 0x3312, 0x02 }, - { IMX_8BIT, 0x3313, 0x5a }, - { IMX_8BIT, 0x331C, 0x01 }, /* TODO! */ - { IMX_8BIT, 0x331D, 0xd6 }, - { IMX_8BIT, 0x4084, 0x03 }, - { IMX_8BIT, 0x4085, 0xa8 }, - { IMX_8BIT, 0x4086, 0x02 }, - { IMX_8BIT, 0x4087, 0x5a }, - { IMX_8BIT, 0x4400, 0x00 }, - { IMX_TOK_TERM, 0, 0} -}; - -/* VGA: H : 1036 V : 780 */ -static const struct imx_reg imx135_vga_binning[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - PLL_SETTINGS_FOR_MIPI_209_6MHZ_SALTBAY, - /* Mode setting */ - {IMX_8BIT, 0x0108, 0x03 }, - {IMX_8BIT, 0x0112, 0x0A }, - {IMX_8BIT, 0x0113, 0x0A }, - {IMX_8BIT, 0x0381, 0x01 }, - {IMX_8BIT, 0x0383, 0x01 }, - {IMX_8BIT, 0x0385, 0x01 }, - {IMX_8BIT, 0x0387, 0x01 }, - {IMX_8BIT, 0x0390, 0x01 }, - {IMX_8BIT, 0x0391, 0x44 }, - {IMX_8BIT, 0x0392, 0x00 }, - {IMX_8BIT, 0x0401, 0x00 }, - {IMX_8BIT, 0x0404, 0x00 }, - {IMX_8BIT, 0x0405, 0x10 }, - {IMX_8BIT, 0x4082, 0x00 }, - {IMX_8BIT, 0x4083, 0x00 }, - {IMX_8BIT, 0x7006, 0x04 }, - /* Size setting */ - {IMX_8BIT, 0x0344, 0x00 }, /* 52,20,4155, 3099 4144x3120*/ - {IMX_8BIT, 0x0345, 0x20 }, - {IMX_8BIT, 0x0346, 0x00 }, - {IMX_8BIT, 0x0347, 0x00 }, - {IMX_8BIT, 0x0348, 0x10 }, - {IMX_8BIT, 0x0349, 0x4F }, - {IMX_8BIT, 0x034A, 0x0C }, - {IMX_8BIT, 0x034B, 0x2F }, - {IMX_8BIT, 0x034C, 0x04 }, /* 1036x780 */ - {IMX_8BIT, 0x034D, 0x0C }, - {IMX_8BIT, 0x034E, 0x03 }, - {IMX_8BIT, 0x034F, 0x0C }, - {IMX_8BIT, 0x0350, 0x00 }, - {IMX_8BIT, 0x0351, 0x00 }, - {IMX_8BIT, 0x0352, 0x00 }, - {IMX_8BIT, 0x0353, 0x00 }, - {IMX_8BIT, 0x0354, 0x04 }, /* 1036x780 */ - {IMX_8BIT, 0x0355, 0x0C }, - {IMX_8BIT, 0x0356, 0x03 }, - {IMX_8BIT, 0x0357, 0x0C }, - {IMX_8BIT, 0x301D, 0x30 }, - {IMX_8BIT, 0x3310, 0x04 }, - {IMX_8BIT, 0x3311, 0x0C }, - {IMX_8BIT, 0x3312, 0x03 }, - {IMX_8BIT, 0x3313, 0x0C }, - {IMX_8BIT, 0x331C, 0x02 }, - {IMX_8BIT, 0x331D, 0x21 }, - {IMX_8BIT, 0x4084, 0x04 }, - {IMX_8BIT, 0x4085, 0x0C }, - {IMX_8BIT, 0x4086, 0x03 }, - {IMX_8BIT, 0x4087, 0x0C }, - {IMX_8BIT, 0x4400, 0x00 }, - {IMX_TOK_TERM, 0, 0} -}; - -/* VGA: H : 820 V : 616 */ -static const struct imx_reg imx135_vga_dvs_binning[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - PLL_SETTINGS_FOR_MIPI_209_6MHZ_SALTBAY, - /* Mode setting */ - {IMX_8BIT, 0x0108, 0x03 }, - {IMX_8BIT, 0x0112, 0x0A }, - {IMX_8BIT, 0x0113, 0x0A }, - {IMX_8BIT, 0x0381, 0x01 }, - {IMX_8BIT, 0x0383, 0x01 }, - {IMX_8BIT, 0x0385, 0x01 }, - {IMX_8BIT, 0x0387, 0x01 }, - {IMX_8BIT, 0x0390, 0x01 }, - {IMX_8BIT, 0x0391, 0x44 }, - {IMX_8BIT, 0x0392, 0x00 }, - {IMX_8BIT, 0x0401, 0x02 }, - {IMX_8BIT, 0x0404, 0x00 }, - {IMX_8BIT, 0x0405, 0x14 }, - {IMX_8BIT, 0x4082, 0x00 }, - {IMX_8BIT, 0x4083, 0x00 }, - {IMX_8BIT, 0x7006, 0x04 }, - /* Size setting */ - {IMX_8BIT, 0x0344, 0x00 }, /* 52,20,4155, 3099 4104x3080*/ - {IMX_8BIT, 0x0345, 0x34 }, - {IMX_8BIT, 0x0346, 0x00 }, - {IMX_8BIT, 0x0347, 0x14 }, - {IMX_8BIT, 0x0348, 0x10 }, - {IMX_8BIT, 0x0349, 0x3B }, - {IMX_8BIT, 0x034A, 0x0C }, - {IMX_8BIT, 0x034B, 0x1B }, - {IMX_8BIT, 0x034C, 0x03 }, /* 820x616 */ - {IMX_8BIT, 0x034D, 0x34 }, - {IMX_8BIT, 0x034E, 0x02 }, - {IMX_8BIT, 0x034F, 0x68 }, - {IMX_8BIT, 0x0350, 0x00 }, - {IMX_8BIT, 0x0351, 0x00 }, - {IMX_8BIT, 0x0352, 0x00 }, - {IMX_8BIT, 0x0353, 0x00 }, - {IMX_8BIT, 0x0354, 0x04 }, /* 1026x770 */ - {IMX_8BIT, 0x0355, 0x02 }, - {IMX_8BIT, 0x0356, 0x03 }, - {IMX_8BIT, 0x0357, 0x02 }, - {IMX_8BIT, 0x301D, 0x30 }, - {IMX_8BIT, 0x3310, 0x03 }, - {IMX_8BIT, 0x3311, 0x34 }, - {IMX_8BIT, 0x3312, 0x02 }, - {IMX_8BIT, 0x3313, 0x68 }, - {IMX_8BIT, 0x331C, 0x02 }, - {IMX_8BIT, 0x331D, 0x21 }, - {IMX_8BIT, 0x4084, 0x03 }, - {IMX_8BIT, 0x4085, 0x34 }, - {IMX_8BIT, 0x4086, 0x02 }, - {IMX_8BIT, 0x4087, 0x68 }, - {IMX_8BIT, 0x4400, 0x00 }, - {IMX_TOK_TERM, 0, 0} -}; - -/* VGA: H : 436 V : 360 */ -static const struct imx_reg imx135_436x360_binning[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - PLL_SETTINGS_FOR_MIPI_209_6MHZ_SALTBAY, - /* Mode setting */ - {IMX_8BIT, 0x0108, 0x03 }, - {IMX_8BIT, 0x0112, 0x0A }, - {IMX_8BIT, 0x0113, 0x0A }, - {IMX_8BIT, 0x0381, 0x01 }, - {IMX_8BIT, 0x0383, 0x01 }, - {IMX_8BIT, 0x0385, 0x01 }, - {IMX_8BIT, 0x0387, 0x01 }, - {IMX_8BIT, 0x0390, 0x01 }, - {IMX_8BIT, 0x0391, 0x44 }, - {IMX_8BIT, 0x0392, 0x00 }, - {IMX_8BIT, 0x0401, 0x02 }, - {IMX_8BIT, 0x0404, 0x00 }, - {IMX_8BIT, 0x0405, 0x22 }, - {IMX_8BIT, 0x4082, 0x00 }, - {IMX_8BIT, 0x4083, 0x00 }, - {IMX_8BIT, 0x7006, 0x04 }, - /* Size setting */ - {IMX_8BIT, 0x0344, 0x00 }, /* 212,0,3995,3119 3784x3120 */ - {IMX_8BIT, 0x0345, 0xD4 }, - {IMX_8BIT, 0x0346, 0x00 }, - {IMX_8BIT, 0x0347, 0x00 }, - {IMX_8BIT, 0x0348, 0x0F }, - {IMX_8BIT, 0x0349, 0x9B }, - {IMX_8BIT, 0x034A, 0x0C }, - {IMX_8BIT, 0x034B, 0x2F }, - - {IMX_8BIT, 0x034C, 0x01 }, /* 436x360 */ - {IMX_8BIT, 0x034D, 0xB4 }, - {IMX_8BIT, 0x034E, 0x01 }, - {IMX_8BIT, 0x034F, 0x68 }, - {IMX_8BIT, 0x0350, 0x00 }, - {IMX_8BIT, 0x0351, 0x12 }, - {IMX_8BIT, 0x0352, 0x00 }, - {IMX_8BIT, 0x0353, 0x0C }, - - {IMX_8BIT, 0x0354, 0x03 }, /* 928x768 crop from 946x780*/ - {IMX_8BIT, 0x0355, 0xA0 }, - {IMX_8BIT, 0x0356, 0x03 }, - {IMX_8BIT, 0x0357, 0x00 }, - - {IMX_8BIT, 0x301D, 0x30 }, - {IMX_8BIT, 0x3310, 0x01 }, - {IMX_8BIT, 0x3311, 0xB4 }, - {IMX_8BIT, 0x3312, 0x01 }, - {IMX_8BIT, 0x3313, 0x68 }, - {IMX_8BIT, 0x331C, 0x02 }, - {IMX_8BIT, 0x331D, 0x21 }, - {IMX_8BIT, 0x4084, 0x01 }, - {IMX_8BIT, 0x4085, 0xB4 }, - {IMX_8BIT, 0x4086, 0x01 }, - {IMX_8BIT, 0x4087, 0x68 }, - {IMX_8BIT, 0x4400, 0x00 }, - {IMX_TOK_TERM, 0, 0} -}; - -/* QVGA: H : 408 V : 308 */ -static const struct imx_reg imx135_qvga__dvs_binning[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - PLL_SETTINGS_FOR_MIPI_209_6MHZ_SALTBAY, - /* Mode setting */ - {IMX_8BIT, 0x0108, 0x03 }, - {IMX_8BIT, 0x0112, 0x0A }, - {IMX_8BIT, 0x0113, 0x0A }, - {IMX_8BIT, 0x0381, 0x01 }, - {IMX_8BIT, 0x0383, 0x01 }, - {IMX_8BIT, 0x0385, 0x01 }, - {IMX_8BIT, 0x0387, 0x01 }, - {IMX_8BIT, 0x0390, 0x01 }, - {IMX_8BIT, 0x0391, 0x44 }, - {IMX_8BIT, 0x0392, 0x00 }, - {IMX_8BIT, 0x0401, 0x02 }, - {IMX_8BIT, 0x0404, 0x00 }, - {IMX_8BIT, 0x0405, 0x28 }, - {IMX_8BIT, 0x4082, 0x00 }, - {IMX_8BIT, 0x4083, 0x00 }, - {IMX_8BIT, 0x7006, 0x04 }, - /* Size setting */ - {IMX_8BIT, 0x0344, 0x00 }, /* 64,20,4143,3099 4080x3080 */ - {IMX_8BIT, 0x0345, 0x40 }, - {IMX_8BIT, 0x0346, 0x00 }, - {IMX_8BIT, 0x0347, 0x14 }, - {IMX_8BIT, 0x0348, 0x10 }, - {IMX_8BIT, 0x0349, 0x2F }, - {IMX_8BIT, 0x034A, 0x0C }, - {IMX_8BIT, 0x034B, 0x1B }, - {IMX_8BIT, 0x034C, 0x01 }, /* 408x308 */ - {IMX_8BIT, 0x034D, 0x98 }, - {IMX_8BIT, 0x034E, 0x01 }, - {IMX_8BIT, 0x034F, 0x34 }, - {IMX_8BIT, 0x0350, 0x00 }, - {IMX_8BIT, 0x0351, 0x00 }, - {IMX_8BIT, 0x0352, 0x00 }, - {IMX_8BIT, 0x0353, 0x00 }, - {IMX_8BIT, 0x0354, 0x03 }, /* 1020x770 */ - {IMX_8BIT, 0x0355, 0xFC }, - {IMX_8BIT, 0x0356, 0x03 }, - {IMX_8BIT, 0x0357, 0x02 }, - {IMX_8BIT, 0x301D, 0x30 }, - {IMX_8BIT, 0x3310, 0x01 }, - {IMX_8BIT, 0x3311, 0x98 }, - {IMX_8BIT, 0x3312, 0x01 }, - {IMX_8BIT, 0x3313, 0x34 }, - {IMX_8BIT, 0x331C, 0x01 }, - {IMX_8BIT, 0x331D, 0x68 }, - {IMX_8BIT, 0x4084, 0x01 }, - {IMX_8BIT, 0x4085, 0x98 }, - {IMX_8BIT, 0x4086, 0x01 }, - {IMX_8BIT, 0x4087, 0x34 }, - {IMX_8BIT, 0x4400, 0x00 }, - {IMX_TOK_TERM, 0, 0} -}; - -/* CIF H : 368 V : 304 */ -static const struct imx_reg imx135_cif_binning[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - PLL_SETTINGS_FOR_MIPI_209_6MHZ_SALTBAY, - /* Mode setting */ - {IMX_8BIT, 0x0108, 0x03 }, - {IMX_8BIT, 0x0112, 0x0A }, - {IMX_8BIT, 0x0113, 0x0A }, - {IMX_8BIT, 0x0381, 0x01 }, - {IMX_8BIT, 0x0383, 0x01 }, - {IMX_8BIT, 0x0385, 0x01 }, - {IMX_8BIT, 0x0387, 0x01 }, - {IMX_8BIT, 0x0390, 0x01 }, - {IMX_8BIT, 0x0391, 0x44 }, - {IMX_8BIT, 0x0392, 0x00 }, - {IMX_8BIT, 0x0401, 0x02 }, - {IMX_8BIT, 0x0404, 0x00 }, - {IMX_8BIT, 0x0405, 0x28 }, - {IMX_8BIT, 0x4082, 0x00 }, - {IMX_8BIT, 0x4083, 0x00 }, - {IMX_8BIT, 0x7006, 0x04 }, - /* Size setting */ - {IMX_8BIT, 0x0344, 0x01 }, /* 264,42,3943,3081 3680x3040 */ - {IMX_8BIT, 0x0345, 0x08 }, - {IMX_8BIT, 0x0346, 0x00 }, - {IMX_8BIT, 0x0347, 0x2a }, - {IMX_8BIT, 0x0348, 0x0F }, - {IMX_8BIT, 0x0349, 0x67 }, - {IMX_8BIT, 0x034A, 0x0c }, - {IMX_8BIT, 0x034B, 0x09 }, - {IMX_8BIT, 0x034C, 0x01 }, /* 368x304 */ - {IMX_8BIT, 0x034D, 0x70 }, - {IMX_8BIT, 0x034E, 0x01 }, - {IMX_8BIT, 0x034F, 0x30 }, - {IMX_8BIT, 0x0350, 0x00 }, - {IMX_8BIT, 0x0351, 0x00 }, - {IMX_8BIT, 0x0352, 0x00 }, - {IMX_8BIT, 0x0353, 0x00 }, - {IMX_8BIT, 0x0354, 0x03 }, /* 920x760 */ - {IMX_8BIT, 0x0355, 0x98 }, - {IMX_8BIT, 0x0356, 0x02 }, - {IMX_8BIT, 0x0357, 0xf8 }, - {IMX_8BIT, 0x301D, 0x30 }, - {IMX_8BIT, 0x3310, 0x01 }, - {IMX_8BIT, 0x3311, 0x70 }, - {IMX_8BIT, 0x3312, 0x01 }, - {IMX_8BIT, 0x3313, 0x30 }, - {IMX_8BIT, 0x331C, 0x02 }, /* TODO! binning 4x4 must be 021c? */ - {IMX_8BIT, 0x331D, 0x1C }, - {IMX_8BIT, 0x4084, 0x01 }, - {IMX_8BIT, 0x4085, 0x70 }, - {IMX_8BIT, 0x4086, 0x01 }, - {IMX_8BIT, 0x4087, 0x30 }, - {IMX_8BIT, 0x4400, 0x00 }, - {IMX_TOK_TERM, 0, 0} -}; - -/* CIF H : 1888 V : 1548 */ -static const struct imx_reg imx135_cif_binning_1888x1548[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - PLL_SETTINGS_FOR_MIPI_209_6MHZ_SALTBAY, - /* Mode setting */ - {IMX_8BIT, 0x0108, 0x03 }, - {IMX_8BIT, 0x0112, 0x0A }, - {IMX_8BIT, 0x0113, 0x0A }, - {IMX_8BIT, 0x0381, 0x01 }, - {IMX_8BIT, 0x0383, 0x01 }, - {IMX_8BIT, 0x0385, 0x01 }, - {IMX_8BIT, 0x0387, 0x01 }, - {IMX_8BIT, 0x0390, 0x01 }, - {IMX_8BIT, 0x0391, 0x22 }, - {IMX_8BIT, 0x0392, 0x00 }, - {IMX_8BIT, 0x0401, 0x00 }, - {IMX_8BIT, 0x0404, 0x00 }, - {IMX_8BIT, 0x0405, 0x10 }, - {IMX_8BIT, 0x4082, 0x00 }, - {IMX_8BIT, 0x4083, 0x00 }, - {IMX_8BIT, 0x7006, 0x04 }, - /* Size setting */ - {IMX_8BIT, 0x0344, 0x00 }, /* 264,42, 3776x3096 */ - {IMX_8BIT, 0x0345, 0xD8 }, - {IMX_8BIT, 0x0346, 0x00 }, - {IMX_8BIT, 0x0347, 0x0C }, - {IMX_8BIT, 0x0348, 0x0F }, - {IMX_8BIT, 0x0349, 0x97 }, - {IMX_8BIT, 0x034A, 0x0C }, - {IMX_8BIT, 0x034B, 0x23 }, - {IMX_8BIT, 0x034C, 0x07 }, /* 1888x1548 */ - {IMX_8BIT, 0x034D, 0x60 }, - {IMX_8BIT, 0x034E, 0x06 }, - {IMX_8BIT, 0x034F, 0x0C }, - {IMX_8BIT, 0x0350, 0x00 }, - {IMX_8BIT, 0x0351, 0x00 }, - {IMX_8BIT, 0x0352, 0x00 }, - {IMX_8BIT, 0x0353, 0x00 }, - {IMX_8BIT, 0x0354, 0x07 }, /* 1888x1548 */ - {IMX_8BIT, 0x0355, 0x60 }, - {IMX_8BIT, 0x0356, 0x06 }, - {IMX_8BIT, 0x0357, 0x0C }, - {IMX_8BIT, 0x301D, 0x30 }, - {IMX_8BIT, 0x3310, 0x07 }, - {IMX_8BIT, 0x3311, 0x60 }, - {IMX_8BIT, 0x3312, 0x06 }, - {IMX_8BIT, 0x3313, 0x0C }, - {IMX_8BIT, 0x331C, 0x02 }, /* TODO! binning 4x4 must be 021c? */ - {IMX_8BIT, 0x331D, 0x1C }, - {IMX_8BIT, 0x4084, 0x07 }, - {IMX_8BIT, 0x4085, 0x60 }, - {IMX_8BIT, 0x4086, 0x06 }, - {IMX_8BIT, 0x4087, 0x0C }, - {IMX_8BIT, 0x4400, 0x00 }, - {IMX_TOK_TERM, 0, 0} -}; - -/* QCIF H : 216 V : 176 */ -static const struct imx_reg imx135_qcif_dvs_binning[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - PLL_SETTINGS_FOR_MIPI_209_6MHZ_SALTBAY, - /* Mode setting */ - {IMX_8BIT, 0x0108, 0x03 }, - {IMX_8BIT, 0x0112, 0x0A }, - {IMX_8BIT, 0x0113, 0x0A }, - {IMX_8BIT, 0x0381, 0x01 }, - {IMX_8BIT, 0x0383, 0x01 }, - {IMX_8BIT, 0x0385, 0x01 }, - {IMX_8BIT, 0x0387, 0x01 }, - {IMX_8BIT, 0x0390, 0x01 }, - {IMX_8BIT, 0x0391, 0x44 }, - {IMX_8BIT, 0x0392, 0x00 }, - {IMX_8BIT, 0x0401, 0x02 }, - {IMX_8BIT, 0x0404, 0x00 }, - {IMX_8BIT, 0x0405, 0x46 }, - {IMX_8BIT, 0x4082, 0x00 }, - {IMX_8BIT, 0x4083, 0x00 }, - {IMX_8BIT, 0x7006, 0x04 }, - /* Size setting */ - {IMX_8BIT, 0x0344, 0x00 }, /* 212,20,3995,3099 3784x3080 */ - {IMX_8BIT, 0x0345, 0xD4 }, - {IMX_8BIT, 0x0346, 0x00 }, - {IMX_8BIT, 0x0347, 0x14 }, - {IMX_8BIT, 0x0348, 0x0F }, - {IMX_8BIT, 0x0349, 0x9B }, - {IMX_8BIT, 0x034A, 0x0C }, - {IMX_8BIT, 0x034B, 0x1B }, - {IMX_8BIT, 0x034C, 0x00 }, /* 216x176 */ - {IMX_8BIT, 0x034D, 0xD8 }, - {IMX_8BIT, 0x034E, 0x00 }, - {IMX_8BIT, 0x034F, 0xB0 }, - {IMX_8BIT, 0x0350, 0x00 }, - {IMX_8BIT, 0x0351, 0x00 }, - {IMX_8BIT, 0x0352, 0x00 }, - {IMX_8BIT, 0x0353, 0x00 }, - {IMX_8BIT, 0x0354, 0x03 }, /* 946x770 */ - {IMX_8BIT, 0x0355, 0xB2 }, - {IMX_8BIT, 0x0356, 0x03 }, - {IMX_8BIT, 0x0357, 0x02 }, - {IMX_8BIT, 0x301D, 0x30 }, - {IMX_8BIT, 0x3310, 0x00 }, - {IMX_8BIT, 0x3311, 0xD8 }, - {IMX_8BIT, 0x3312, 0x00 }, - {IMX_8BIT, 0x3313, 0xB0 }, - {IMX_8BIT, 0x331C, 0x02 }, /* TODO! binning 4x4 must be 021c */ - {IMX_8BIT, 0x331D, 0x1C }, - {IMX_8BIT, 0x4084, 0x00 }, - {IMX_8BIT, 0x4085, 0xD8 }, - {IMX_8BIT, 0x4086, 0x00 }, - {IMX_8BIT, 0x4087, 0xB0 }, - {IMX_8BIT, 0x4400, 0x00 }, - {IMX_TOK_TERM, 0, 0} -}; - -/* - * ISP Scaling is now supported in offine capture use cases. Because of that - * we need only few modes to cover the different aspect ratios from the - * sensor and the ISP will scale it based on the requested resolution from HAL. - * - * There is a performance impact when continuous view finder option is chose - * for resolutions above 8MP. So 8MP and 6MP resolution are kept, so that lower - * than these take 8MP or 6MP espectively for down scaling based on the - * aspect ratio. - */ -struct imx_resolution imx135_res_preview_mofd[] = { - { - .desc = "imx135_cif_binning_preview", - .regs = imx135_cif_binning, - .width = 368, - .height = 304, - .fps_options = { - { /* Binning Pixel clock: 335.36MHz */ - .fps = 30, - .pixels_per_line = 9114, - .lines_per_frame = 1226, - }, - { - } - }, - .bin_factor_x = 2, - .bin_factor_y = 2, - .mipi_freq = 209600, - }, - { - .desc = "imx135_vga_binning_preview", - .regs = imx135_vga_binning, - .width = 1036, - .height = 780, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 9144, - .lines_per_frame = 1226, - }, - { - } - }, - .bin_factor_x = 2, - .bin_factor_y = 2, - .mipi_freq = 209600, - }, - { - .desc = "imx135_480p_preview", - .regs = imx135_480p_binning, - .width = 1036, - .height = 696, - .fps_options = { - { /* Binning Pixel clock: 335.36MHz */ - .fps = 30, - .pixels_per_line = 9144, - .lines_per_frame = 1226, - }, - { - } - }, - .bin_factor_x = 2, - .bin_factor_y = 2, - .mipi_freq = 209600, - }, - { - .desc = "imx135_1080p_binning_preview", - .regs = imx135_1080p_binning, - .width = 1936, - .height = 1104, - .fps_options = { - { /* Binning Pixel clock: 335.36MHz */ - .fps = 30, - .pixels_per_line = 5464, - .lines_per_frame = 2046, - }, - { - } - }, - .bin_factor_x = 1, - .bin_factor_y = 1, - .used = 0, - .mipi_freq = 209600, - }, - { - .desc = "imx135_3m__cont_cap", - .regs = imx135_3m_binning, - .width = 2064, - .height = 1552, - .fps_options = { - { /* Binning Pixel clock: 335.36MHz */ - .fps = 30, - .pixels_per_line = 5464, - .lines_per_frame = 2046, - }, - { - } - }, - .bin_factor_x = 1, - .bin_factor_y = 1, - .used = 0, - .mipi_freq = 209600, - }, - { - .desc = "imx135_6m_cont_cap", - .regs = imx135_6m, - .width = 3280, - .height = 1852, - .fps_options = { - { /* Binning Pixel clock: 360.96MHz */ - .fps = 30, - .pixels_per_line = 4572, - .lines_per_frame = 2624, - }, - { - } - }, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - .mipi_freq = 451200, - }, - { - .desc = "imx135_8m_scaled_from_12m__cont_cap", - .regs = imx135_8m_scaled_from_12m, - .width = 3280, - .height = 2464, - .fps_options = { - { /* Pixel clock: 360.96MHz */ - .fps = 24, - .pixels_per_line = 4572, - .lines_per_frame = 3280, - }, - { - } - }, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - .mipi_freq = 451200, - }, - { - .desc = "imx135_10m__cont_cap", - .regs = imx135_10m, - .width = 4208, - .height = 2368, - .fps_options = { - { /* Pixel clock: 360.96MHz */ - .fps = 30, - .pixels_per_line = 4572, - .lines_per_frame = 2632, - }, - { - } - }, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - .mipi_freq = 451200, - }, - { - .desc = "imx135_13m__cont_cap", - .regs = imx135_13m, - .width = 4208, - .height = 3120, - .fps_options = { - { /* Pixel clock: 360.96MHz */ - .fps = 24, - .pixels_per_line = 4572, - .lines_per_frame = 3290, - }, - { - } - }, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - .mipi_freq = 451200, - }, -}; - -struct imx_resolution imx135_res_preview[] = { - { - .desc = "imx135_xga_cropped_video", - .regs = imx135_xga_cropped, - .width = 832, - .height = 628, - .fps_options = { - { /* Binning Pixel clock: 335.36MHz */ - .fps = 30, - .pixels_per_line = 5464, - .lines_per_frame = 2046, - - }, - { - } - }, - .bin_factor_x = 2, - .bin_factor_y = 2, - .used = 0, - .mipi_freq = 209600, - }, - { - .desc = "imx135_2m_cropped_video", - .regs = imx135_2m_cropped, - .width = 1648, - .height = 1240, - .fps_options = { - { /* Pixel clock: 335.36MHz */ - .fps = 30, - .pixels_per_line = 5464, - .lines_per_frame = 2046, - - }, - { - } - }, - .bin_factor_x = 1, - .bin_factor_y = 1, - .used = 0, - .mipi_freq = 209600, - }, - { - .desc = "imx135_1936x1096_cropped", - .regs = imx135_1936x1096_cropped, - .width = 1936, - .height = 1096, - .fps_options = { - { /* Pixel clock: 335.36MHz */ - .fps = 30, - .pixels_per_line = 5464, - .lines_per_frame = 2046, - - }, - { - } - }, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - .mipi_freq = 209600, - }, - { - .desc = "imx135_8m_cropped_video", - .regs = imx135_8m_cropped, - .width = 3280, - .height = 2464, - .fps_options = { - { /* Pixel clock: 360.96MHz */ - .fps = 30, - .pixels_per_line = 4572, - .lines_per_frame = 2624, - }, - { - } - }, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - .mipi_freq = 451200, - }, -}; - -/* - * ISP Scaling is now supported in online capture use cases. Because of that - * we need only few modes to cover the different aspect ratios from the - * sensor and the ISP will scale it based on the requested resolution from HAL. - * - * There is a performance impact when continuous view finder option is chose - * for resolutions above 8MP. So 8MP and 6MP resolution are kept, so that lower - * than these take 8MP or 6MP espectively for down scaling based on the - * aspect ratio. - */ -struct imx_resolution imx135_res_still_mofd[] = { - { - .desc = "imx135_cif_binning_still", - .regs = imx135_cif_binning_1888x1548, - .width = 1888, - .height = 1548, - .fps_options = { - { /* Binning Pixel clock: 335.36MHz */ - .fps = 30, - .pixels_per_line = 5464, - .lines_per_frame = 2046, - }, - { - } - }, - .bin_factor_x = 1, - .bin_factor_y = 1, - .mipi_freq = 209600, - }, - { - .desc = "imx135_vga_binning_preview", - .regs = imx135_vga_binning, - .width = 1036, - .height = 780, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 9144, - .lines_per_frame = 1226, - }, - { - } - }, - .bin_factor_x = 2, - .bin_factor_y = 2, - .mipi_freq = 209600, - }, - { - .desc = "imx135_480p_preview", - .regs = imx135_480p_binning, - .width = 1036, - .height = 696, - .fps_options = { - { /* Binning Pixel clock: 335.36MHz */ - .fps = 30, - .pixels_per_line = 9144, - .lines_per_frame = 1226, - }, - { - } - }, - .bin_factor_x = 2, - .bin_factor_y = 2, - .mipi_freq = 209600, - }, - { - .desc = "imx135_1080p_binning_still", - .regs = imx135_1080p_binning, - .width = 1936, - .height = 1104, - .fps_options = { - { /* Binning Pixel clock: 335.36MHz */ - .fps = 15, - .pixels_per_line = 9114, - .lines_per_frame = 2453, - }, - { - } - }, - .bin_factor_x = 1, - .bin_factor_y = 1, - .used = 0, - .mipi_freq = 209600, - }, - { - .desc = "imx135_3m__still", - .regs = imx135_3m_binning, - .width = 2064, - .height = 1552, - .fps_options = { - { /* Binning Pixel clock: 335.36MHz */ - .fps = 15, - .pixels_per_line = 9114, - .lines_per_frame = 2453, - }, - { - } - }, - .bin_factor_x = 1, - .bin_factor_y = 1, - .used = 0, - .mipi_freq = 209600, - }, - { - .desc = "imx135_6m_for_mipi_342_still", - .regs = imx135_6m_for_mipi_342, - .width = 3280, - .height = 1852, - .fps_options = { - { /* Pixel clock: 273.6MHz */ - .fps = 11, - .pixels_per_line = 9114, - .lines_per_frame = 2664, - }, - { - } - }, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - .mipi_freq = 342000, - }, - { - .desc = "imx135_8m_scaled_from_12m_for_mipi342_still", - .regs = imx135_8m_scaled_from_12m_for_mipi342, - .width = 3280, - .height = 2464, - .fps_options = { - { /* Pixel clock: 273.6MHz */ - .fps = 8, - .pixels_per_line = 7672, - .lines_per_frame = 4458, - }, - { /* Pixel clock: 273.6MHz */ - .fps = 15, - .pixels_per_line = 5500, - .lines_per_frame = 3314, - }, - { - } - }, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - .mipi_freq = 342000, - }, - { - .desc = "imx135_10m_for_mipi_342_still", - .regs = imx135_10m_for_mipi_342, - .width = 4208, - .height = 2368, - .fps_options = { - { /* Pixel clock: 273.6MHz */ - .fps = 11, - .pixels_per_line = 9144, - .lines_per_frame = 2664, - }, - { - } - }, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - .mipi_freq = 342000, - }, - { - .desc = "imx135_13m_still", - .regs = imx135_13m_for_mipi_342, - .width = 4208, - .height = 3120, - .fps_options = { - { /* Pixel clock: 273.6MHz */ - .fps = 5, - .pixels_per_line = 9144, - .lines_per_frame = 5990, - }, - { - } - }, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - .mipi_freq = 342000, - }, -}; - -struct imx_resolution imx135_res_still[] = { - { - .desc = "imx135_qvga", - .regs = imx135_336x256, - .width = 336, - .height = 256, - .fps_options = { - { /* Pixel clock: 360.96MHz */ - .fps = 30, - .pixels_per_line = 4572, - .lines_per_frame = 2624, - }, - { - } - }, - .bin_factor_x = 1, - .bin_factor_y = 1, - .used = 0, - .mipi_freq = 451200, - }, - { - .desc = "imx135_cif", - .regs = imx135_368x304_cropped, - .width = 368, - .height = 304, - .fps_options = { - { /* Pixel clock: 360.96MHz */ - .fps = 30, - .pixels_per_line = 4572, - .lines_per_frame = 2624, - }, - { - } - }, - .bin_factor_x = 1, - .bin_factor_y = 1, - .used = 0, - .mipi_freq = 451200, - }, - { - .desc = "imx135_xga_cropped_video", - .regs = imx135_xga_cropped, - .width = 832, - .height = 628, - .fps_options = { - { /* Pixel clock: 360.96MHz */ - .fps = 30, - .pixels_per_line = 4572, - .lines_per_frame = 2624, - }, - { - } - }, - .bin_factor_x = 2, - .bin_factor_y = 2, - .used = 0, - .mipi_freq = 451200, - }, - { - .desc = "imx135_2M_for_11:9", - .regs = imx135_1424x1168_cropped, - .width = 1424, - .height = 1168, - .fps_options = { - { /* Pixel clock: 360.96MHz */ - .fps = 30, - .pixels_per_line = 4572, - .lines_per_frame = 2624, - }, - { - } - }, - .bin_factor_x = 1, - .bin_factor_y = 1, - .used = 0, - .mipi_freq = 451200, - }, - { - .desc = "imx135_2m_cropped_video", - .regs = imx135_2m_cropped, - .width = 1648, - .height = 1240, - .fps_options = { - { /* Pixel clock: 360.96MHz */ - .fps = 15, - .pixels_per_line = 6466, - .lines_per_frame = 3710, - }, - { - } - }, - .bin_factor_x = 1, - .bin_factor_y = 1, - .used = 0, - .mipi_freq = 451200, - }, - { - .desc = "imx135_6m_cropped_video", - .regs = imx135_6m_cropped, - .width = 3280, - .height = 1852, - .fps_options = { - { /* Pixel clock: 360.96MHz */ - .fps = 8, - .pixels_per_line = 8850, - .lines_per_frame = 5080, - }, - { - } - }, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - .mipi_freq = 451200, - }, - { - .desc = "imx135_8m_cropped_video", - .regs = imx135_8m_cropped, - .width = 3280, - .height = 2464, - .fps_options = { - { /* Pixel clock: 360.96MHz */ - .fps = 8, - .pixels_per_line = 8850, - .lines_per_frame = 5080, - }, - { - } - }, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - .mipi_freq = 451200, - }, -}; - -/* - * ISP scaling is not supported in case of video modes. So we need to have - * separate sensor mode for video use cases - */ -struct imx_resolution imx135_res_video[] = { - /* For binning modes pix clock is 335.36 MHz. */ - { - .desc = "imx135_qcif_dvs_binning_video", - .regs = imx135_qcif_dvs_binning, - .width = 216, - .height = 176, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 9144, - .lines_per_frame = 1226, - }, - { - } - }, - .bin_factor_x = 2, - .bin_factor_y = 2, - .mipi_freq = 209600, - }, - { - .desc = "imx135_cif_binning_video", - .regs = imx135_cif_binning, - .width = 368, - .height = 304, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 9144, - .lines_per_frame = 1226, - }, - { - } - }, - .bin_factor_x = 2, - .bin_factor_y = 2, - .mipi_freq = 209600, - }, - { - .desc = "imx135_qvga__dvs_binning_video", - .regs = imx135_qvga__dvs_binning, - .width = 408, - .height = 308, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 9144, - .lines_per_frame = 1226, - }, - { - } - }, - .bin_factor_x = 2, - .bin_factor_y = 2, - .mipi_freq = 209600, - }, - { - .desc = "imx135_436x360_binning_video", - .regs = imx135_436x360_binning, - .width = 436, - .height = 360, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 9144, - .lines_per_frame = 1226, - }, - { - } - }, - .bin_factor_x = 2, - .bin_factor_y = 2, - .mipi_freq = 209600, - }, - { - .desc = "imx135_vga_dvs_binning_video", - .regs = imx135_vga_dvs_binning, - .width = 820, - .height = 616, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 9144, - .lines_per_frame = 1226, - }, - { - } - }, - .bin_factor_x = 2, - .bin_factor_y = 2, - .mipi_freq = 209600, - }, - { - .desc = "imx135_480p_dvs_binning_video", - .regs = imx135_480p_dvs_binning, - .width = 936, - .height = 602, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 5464, - .lines_per_frame = 2046, - }, - { - } - }, - .bin_factor_x = 1, - .bin_factor_y = 1, - .mipi_freq = 209600, - }, - { - .desc = "imx135_720P_dvs_video", - .regs = imx135_720pdvs_max_clock, - .width = 1568, - .height = 880, - .fps_options = { - {/* Pixel Clock : 360.96 MHz */ - .fps = 30, - .pixels_per_line = 5850, - .lines_per_frame = 2000, - }, - {/* Pixel Clock : 360.96 MHz */ - .fps = 60, - .pixels_per_line = 4572, - .lines_per_frame = 1310, - }, - { - } - }, - .bin_factor_x = 1, - .bin_factor_y = 1, - .mipi_freq = 451200, - }, - { - .desc = "imx135_wvga_dvs_binning_video", - .regs = imx135_wvga_dvs_binning, - .width = 1640, - .height = 1024, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 5464, - .lines_per_frame = 2046, - }, - { - } - }, - .bin_factor_x = 1, - .bin_factor_y = 1, - .mipi_freq = 209600, - }, - { - .desc = "imx135_1936_1096_fullfov_max_clock", - .regs = imx135_1080p_nodvs_max_clock, - .width = 1936, - .height = 1096, - .fps_options = { - {/* Pixel Clock : 360.96 MHz */ - .fps = 30, - .pixels_per_line = 5850, - .lines_per_frame = 2000, - }, - {/* Pixel Clock : 360.96 MHz */ - .fps = 60, - .pixels_per_line = 4572, - .lines_per_frame = 1310, - }, - { - } - }, - .bin_factor_x = 1, - .bin_factor_y = 1, - .mipi_freq = 451200, - }, - { - .desc = "imx135_1080P_dvs_video", - .regs = imx135_2336x1320_max_clock, - .width = 2336, - .height = 1320, - .fps_options = { - {/* Pixel Clock : 360.96 MHz */ - .fps = 30, - .pixels_per_line = 4572, - .lines_per_frame = 2632, - .regs = imx135_2336x1320_max_clock, - .mipi_freq = 451200, - }, - {/* Pixel Clock : 399.36MHz */ - .fps = 60, - .pixels_per_line = 4754, - .lines_per_frame = 1400, - .regs = imx135_2336x1320_cropped_mipi499, - .mipi_freq = 499200, - }, - { - } - }, - .bin_factor_x = 0, - .bin_factor_y = 0, - .mipi_freq = 451200, - }, - { - .desc = "imx135_6m_cont_cap", - .regs = imx135_6m, - .width = 3280, - .height = 1852, - .fps_options = { - { /* Binning Pixel clock: 360.96MHz */ - .fps = 30, - .pixels_per_line = 4572, - .lines_per_frame = 2624, - }, - { - } - }, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - .mipi_freq = 451200, - }, - { - .desc = "imx135_8m_cropped_video", - .regs = imx135_8m_cropped, - .width = 3280, - .height = 2464, - .fps_options = { - { /* Pixel clock: 360.96MHz */ - .fps = 30, - .pixels_per_line = 4572, - .lines_per_frame = 2624, - }, - { - } - }, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - .mipi_freq = 451200, - }, -}; - -#endif diff --git a/drivers/staging/media/atomisp/i2c/imx/imx175.h b/drivers/staging/media/atomisp/i2c/imx/imx175.h deleted file mode 100644 index 5e082088cb37..000000000000 --- a/drivers/staging/media/atomisp/i2c/imx/imx175.h +++ /dev/null @@ -1,1960 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __IMX175_H__ -#define __IMX175_H__ -#include "common.h" - -/************************** settings for imx *************************/ -static struct imx_reg const imx_STILL_8M_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x0100, 0x00}, /* mode_select */ - /* shutter */ - {IMX_8BIT, 0x0202, 0x0A}, /* coarse _integration_time[15:8] */ - {IMX_8BIT, 0x0203, 0xFC}, /* coarse _integration_time[7:0] */ - /* pll */ - {IMX_8BIT, 0x0301, 0x05}, /* vt_pix_clk_div[7:0] */ - {IMX_8BIT, 0x0303, 0x01}, /* vt_sys_clk_div[7:0] */ - {IMX_8BIT, 0x0305, 0x09}, /* pre_pll_clk_div[7:0] */ - {IMX_8BIT, 0x0309, 0x05}, /* op_pix_clk_div[7:0] */ - {IMX_8BIT, 0x030B, 0x01}, /* op_sys_clk_div[7:0] */ - {IMX_8BIT, 0x030C, 0x01}, - {IMX_8BIT, 0x030D, 0x2c}, - /* image sizing */ - {IMX_8BIT, 0x0340, 0x09}, /* frame_length_lines[15:8] */ - {IMX_8BIT, 0x0341, 0xC4}, /* frame_length_lines[7:0] */ - {IMX_8BIT, 0x0342, 0x0D}, /* line_length_pck[15:8] */ - {IMX_8BIT, 0x0343, 0x66}, /* line_length_pck[7:0] */ - {IMX_8BIT, 0x0344, 0x00}, /* x_addr_start[15:8] */ - {IMX_8BIT, 0x0345, 0x00}, /* x_addr_start[7:0] */ - {IMX_8BIT, 0x0346, 0x00}, /* y_addr_start[15:8] */ - {IMX_8BIT, 0x0347, 0x00}, /* y_addr_start[7:0] */ - {IMX_8BIT, 0x0348, 0x0C}, /* x_addr_end[15:8] */ - {IMX_8BIT, 0x0349, 0xCF}, /* x_addr_end[7:0] */ - {IMX_8BIT, 0x034A, 0x09}, /* y_addr_end[15:8] */ - {IMX_8BIT, 0x034B, 0x9F}, /* y_addr_end[7:0] */ - {IMX_8BIT, 0x034C, 0x0C}, /* x_output_size[15:8] */ - {IMX_8BIT, 0x034D, 0xD0}, /* x_output_size[7:0] */ - {IMX_8BIT, 0x034E, 0x09}, /* y_output_size[15:8] */ - {IMX_8BIT, 0x034F, 0xA0}, /* y_output_size[7:0] */ - /* binning & scaling */ - {IMX_8BIT, 0x0390, 0x00}, /* binning mode */ - {IMX_8BIT, 0x0401, 0x00}, /* scaling mode*/ - {IMX_8BIT, 0x0405, 0x10}, /* scale_m[7:0] */ - /* timer */ - {IMX_8BIT, 0x3344, 0x57}, - {IMX_8BIT, 0x3345, 0x1F}, - /* timing */ - {IMX_8BIT, 0x3370, 0x77}, - {IMX_8BIT, 0x3371, 0x2F}, - {IMX_8BIT, 0x3372, 0x4F}, - {IMX_8BIT, 0x3373, 0x2F}, - {IMX_8BIT, 0x3374, 0x2F}, - {IMX_8BIT, 0x3375, 0x37}, - {IMX_8BIT, 0x3376, 0x9F}, - {IMX_8BIT, 0x3377, 0x37}, - {IMX_8BIT, 0x33C8, 0x01}, - {IMX_8BIT, 0x33D4, 0x0C}, - {IMX_8BIT, 0x33D5, 0xD0}, - {IMX_8BIT, 0x33D6, 0x09}, - {IMX_8BIT, 0x33D7, 0xA0}, - - {IMX_8BIT, 0x030e, 0x01}, - {IMX_8BIT, 0x41c0, 0x01}, - {IMX_TOK_TERM, 0, 0} -}; - -static struct imx_reg const imx_STILL_8M_15fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x0100, 0x00}, /* mode_select */ - /* shutter */ - {IMX_8BIT, 0x0202, 0x0A}, /* coarse _integration_time[15:8] */ - {IMX_8BIT, 0x0203, 0xFC}, /* coarse _integration_time[7:0] */ - /* pll */ - {IMX_8BIT, 0x0301, 0x05}, /* vt_pix_clk_div[7:0] */ - {IMX_8BIT, 0x0303, 0x01}, /* vt_sys_clk_div[7:0] */ - {IMX_8BIT, 0x0305, 0x09}, /* pre_pll_clk_div[7:0] */ - {IMX_8BIT, 0x0309, 0x05}, /* op_pix_clk_div[7:0] */ - {IMX_8BIT, 0x030B, 0x01}, /* op_sys_clk_div[7:0] */ - {IMX_8BIT, 0x030C, 0x01}, - {IMX_8BIT, 0x030D, 0x2c}, - /* image sizing */ - {IMX_8BIT, 0x0340, 0x0B}, /* frame_length_lines[15:8] */ - {IMX_8BIT, 0x0341, 0xB8}, /* frame_length_lines[7:0] */ - {IMX_8BIT, 0x0342, 0x16}, /* line_length_pck[15:8] */ - {IMX_8BIT, 0x0343, 0x44}, /* line_length_pck[7:0] */ - {IMX_8BIT, 0x0344, 0x00}, /* x_addr_start[15:8] */ - {IMX_8BIT, 0x0345, 0x00}, /* x_addr_start[7:0] */ - {IMX_8BIT, 0x0346, 0x00}, /* y_addr_start[15:8] */ - {IMX_8BIT, 0x0347, 0x00}, /* y_addr_start[7:0] */ - {IMX_8BIT, 0x0348, 0x0C}, /* x_addr_end[15:8] */ - {IMX_8BIT, 0x0349, 0xCF}, /* x_addr_end[7:0] */ - {IMX_8BIT, 0x034A, 0x09}, /* y_addr_end[15:8] */ - {IMX_8BIT, 0x034B, 0x9F}, /* y_addr_end[7:0] */ - {IMX_8BIT, 0x034C, 0x0C}, /* x_output_size[15:8] */ - {IMX_8BIT, 0x034D, 0xD0}, /* x_output_size[7:0] */ - {IMX_8BIT, 0x034E, 0x09}, /* y_output_size[15:8] */ - {IMX_8BIT, 0x034F, 0xA0}, /* y_output_size[7:0] */ - /* binning & scaling */ - {IMX_8BIT, 0x0390, 0x00}, /* binning mode */ - {IMX_8BIT, 0x0401, 0x00}, /* scaling mode*/ - {IMX_8BIT, 0x0405, 0x10}, /* scale_m[7:0] */ - /* timer */ - {IMX_8BIT, 0x3344, 0x57}, - {IMX_8BIT, 0x3345, 0x1F}, - /* timing */ - {IMX_8BIT, 0x3370, 0x77}, - {IMX_8BIT, 0x3371, 0x2F}, - {IMX_8BIT, 0x3372, 0x4F}, - {IMX_8BIT, 0x3373, 0x2F}, - {IMX_8BIT, 0x3374, 0x2F}, - {IMX_8BIT, 0x3375, 0x37}, - {IMX_8BIT, 0x3376, 0x9F}, - {IMX_8BIT, 0x3377, 0x37}, - {IMX_8BIT, 0x33C8, 0x01}, - {IMX_8BIT, 0x33D4, 0x0C}, - {IMX_8BIT, 0x33D5, 0xD0}, - {IMX_8BIT, 0x33D6, 0x09}, - {IMX_8BIT, 0x33D7, 0xA0}, - - {IMX_8BIT, 0x030e, 0x01}, - {IMX_8BIT, 0x41c0, 0x01}, - {IMX_TOK_TERM, 0, 0} -}; - -static struct imx_reg const imx_STILL_3M_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x0100, 0x00}, /* mode_select */ - /* shutter */ - {IMX_8BIT, 0x0202, 0x0A}, /* coarse _integration_time[15:8] */ - {IMX_8BIT, 0x0203, 0xEF}, /* coarse _integration_time[7:0] */ - /* pll */ - {IMX_8BIT, 0x0301, 0x05}, /* vt_pix_clk_div[7:0] */ - {IMX_8BIT, 0x0303, 0x01}, /* vt_sys_clk_div[7:0] */ - {IMX_8BIT, 0x0305, 0x09}, /* pre_pll_clk_div[7:0] */ - {IMX_8BIT, 0x0309, 0x05}, /* op_pix_clk_div[7:0] */ - {IMX_8BIT, 0x030B, 0x01}, /* op_sys_clk_div[7:0] */ - {IMX_8BIT, 0x030C, 0x01}, - {IMX_8BIT, 0x030D, 0x2c}, - /* image sizing */ - {IMX_8BIT, 0x0340, 0x09}, /* frame_length_lines[15:8] */ - {IMX_8BIT, 0x0341, 0xC4}, /* frame_length_lines[7:0] */ - {IMX_8BIT, 0x0342, 0x0D}, /* line_length_pck[15:8] */ - {IMX_8BIT, 0x0343, 0x66}, /* line_length_pck[7:0] */ - {IMX_8BIT, 0x0344, 0x00}, /* x_addr_start[15:8] */ - {IMX_8BIT, 0x0345, 0x00}, /* x_addr_start[7:0] */ - {IMX_8BIT, 0x0346, 0x00}, /* y_addr_start[15:8] */ - {IMX_8BIT, 0x0347, 0x00}, /* y_addr_start[7:0] */ - {IMX_8BIT, 0x0348, 0x0C}, /* x_addr_end[15:8] */ - {IMX_8BIT, 0x0349, 0xCF}, /* x_addr_end[7:0] */ - {IMX_8BIT, 0x034A, 0x09}, /* y_addr_end[15:8] */ - {IMX_8BIT, 0x034B, 0x9F}, /* y_addr_end[7:0] */ - {IMX_8BIT, 0x034C, 0x08}, /* x_output_size[15:8] */ - {IMX_8BIT, 0x034D, 0x10}, /* x_output_size[7:0] */ - {IMX_8BIT, 0x034E, 0x06}, /* y_output_size[15:8] */ - {IMX_8BIT, 0x034F, 0x10}, /* y_output_size[7:0] */ - /* binning & scaling */ - {IMX_8BIT, 0x0390, 0x00}, /* binning mode */ - {IMX_8BIT, 0x0401, 0x02}, /* scaling mode*/ - {IMX_8BIT, 0x0405, 0x19}, /* scale_m[7:0] */ - /* timer */ - {IMX_8BIT, 0x3344, 0x57}, - {IMX_8BIT, 0x3345, 0x1F}, - /* timing */ - {IMX_8BIT, 0x3370, 0x77}, - {IMX_8BIT, 0x3371, 0x2F}, - {IMX_8BIT, 0x3372, 0x4F}, - {IMX_8BIT, 0x3373, 0x2F}, - {IMX_8BIT, 0x3374, 0x2F}, - {IMX_8BIT, 0x3375, 0x37}, - {IMX_8BIT, 0x3376, 0x9F}, - {IMX_8BIT, 0x3377, 0x37}, - {IMX_8BIT, 0x33C8, 0x01}, - {IMX_8BIT, 0x33D4, 0x0C}, - {IMX_8BIT, 0x33D5, 0xD0}, - {IMX_8BIT, 0x33D6, 0x09}, - {IMX_8BIT, 0x33D7, 0xA0}, - - {IMX_8BIT, 0x030e, 0x01}, - {IMX_8BIT, 0x41c0, 0x01}, - {IMX_TOK_TERM, 0, 0} -}; - -static struct imx_reg const imx_STILL_3M_15fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x0100, 0x00}, /* mode_select */ - /* shutter */ - {IMX_8BIT, 0x0202, 0x0A}, /* coarse _integration_time[15:8] */ - {IMX_8BIT, 0x0203, 0xEF}, /* coarse _integration_time[7:0] */ - /* pll */ - {IMX_8BIT, 0x0301, 0x05}, /* vt_pix_clk_div[7:0] */ - {IMX_8BIT, 0x0303, 0x01}, /* vt_sys_clk_div[7:0] */ - {IMX_8BIT, 0x0305, 0x09}, /* pre_pll_clk_div[7:0] */ - {IMX_8BIT, 0x0309, 0x05}, /* op_pix_clk_div[7:0] */ - {IMX_8BIT, 0x030B, 0x01}, /* op_sys_clk_div[7:0] */ - {IMX_8BIT, 0x030C, 0x01}, - {IMX_8BIT, 0x030D, 0x2c}, - /* image sizing */ - {IMX_8BIT, 0x0340, 0x0B}, /* frame_length_lines[15:8] */ - {IMX_8BIT, 0x0341, 0xB8}, /* frame_length_lines[7:0] */ - {IMX_8BIT, 0x0342, 0x16}, /* line_length_pck[15:8] */ - {IMX_8BIT, 0x0343, 0x44}, /* line_length_pck[7:0] */ - {IMX_8BIT, 0x0344, 0x00}, /* x_addr_start[15:8] */ - {IMX_8BIT, 0x0345, 0x00}, /* x_addr_start[7:0] */ - {IMX_8BIT, 0x0346, 0x00}, /* y_addr_start[15:8] */ - {IMX_8BIT, 0x0347, 0x00}, /* y_addr_start[7:0] */ - {IMX_8BIT, 0x0348, 0x0C}, /* x_addr_end[15:8] */ - {IMX_8BIT, 0x0349, 0xCF}, /* x_addr_end[7:0] */ - {IMX_8BIT, 0x034A, 0x09}, /* y_addr_end[15:8] */ - {IMX_8BIT, 0x034B, 0x9F}, /* y_addr_end[7:0] */ - {IMX_8BIT, 0x034C, 0x08}, /* x_output_size[15:8] */ - {IMX_8BIT, 0x034D, 0x10}, /* x_output_size[7:0] */ - {IMX_8BIT, 0x034E, 0x06}, /* y_output_size[15:8] */ - {IMX_8BIT, 0x034F, 0x10}, /* y_output_size[7:0] */ - /* binning & scaling */ - {IMX_8BIT, 0x0390, 0x00}, /* binning mode */ - {IMX_8BIT, 0x0401, 0x02}, /* scaling mode*/ - {IMX_8BIT, 0x0405, 0x19}, /* scale_m[7:0] */ - /* timer */ - {IMX_8BIT, 0x3344, 0x57}, - {IMX_8BIT, 0x3345, 0x1F}, - /* timing */ - {IMX_8BIT, 0x3370, 0x77}, - {IMX_8BIT, 0x3371, 0x2F}, - {IMX_8BIT, 0x3372, 0x4F}, - {IMX_8BIT, 0x3373, 0x2F}, - {IMX_8BIT, 0x3374, 0x2F}, - {IMX_8BIT, 0x3375, 0x37}, - {IMX_8BIT, 0x3376, 0x9F}, - {IMX_8BIT, 0x3377, 0x37}, - {IMX_8BIT, 0x33C8, 0x01}, - {IMX_8BIT, 0x33D4, 0x0C}, - {IMX_8BIT, 0x33D5, 0xD0}, - {IMX_8BIT, 0x33D6, 0x09}, - {IMX_8BIT, 0x33D7, 0xA0}, - - {IMX_8BIT, 0x030e, 0x01}, - {IMX_8BIT, 0x41c0, 0x01}, - {IMX_TOK_TERM, 0, 0} -}; - - -static struct imx_reg const imx_STILL_5M_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x0100, 0x00}, /* mode_select */ - /* shutter */ - {IMX_8BIT, 0x0202, 0x0A}, /* coarse _integration_time[15:8] */ - {IMX_8BIT, 0x0203, 0xEF}, /* coarse _integration_time[7:0] */ - /* pll */ - {IMX_8BIT, 0x0301, 0x05}, /* vt_pix_clk_div[7:0] */ - {IMX_8BIT, 0x0303, 0x01}, /* vt_sys_clk_div[7:0] */ - {IMX_8BIT, 0x0305, 0x09}, /* pre_pll_clk_div[7:0] */ - {IMX_8BIT, 0x0309, 0x05}, /* op_pix_clk_div[7:0] */ - {IMX_8BIT, 0x030B, 0x01}, /* op_sys_clk_div[7:0] */ - {IMX_8BIT, 0x030C, 0x01}, - {IMX_8BIT, 0x030D, 0x2c}, - /* image sizing */ - {IMX_8BIT, 0x0340, 0x09}, /* frame_length_lines[15:8] */ - {IMX_8BIT, 0x0341, 0xC4}, /* frame_length_lines[7:0] */ - {IMX_8BIT, 0x0342, 0x0D}, /* line_length_pck[15:8] */ - {IMX_8BIT, 0x0343, 0x66}, /* line_length_pck[7:0] */ - {IMX_8BIT, 0x0344, 0x00}, /* x_addr_start[15:8] */ - {IMX_8BIT, 0x0345, 0x00}, /* x_addr_start[7:0] */ - {IMX_8BIT, 0x0346, 0x00}, /* y_addr_start[15:8] */ - {IMX_8BIT, 0x0347, 0x00}, /* y_addr_start[7:0] */ - {IMX_8BIT, 0x0348, 0x0C}, /* x_addr_end[15:8] */ - {IMX_8BIT, 0x0349, 0xCF}, /* x_addr_end[7:0] */ - {IMX_8BIT, 0x034A, 0x09}, /* y_addr_end[15:8] */ - {IMX_8BIT, 0x034B, 0x9F}, /* y_addr_end[7:0] */ - {IMX_8BIT, 0x034C, 0x0A}, /* x_output_size[15:8] */ - {IMX_8BIT, 0x034D, 0x10}, /* x_output_size[7:0] */ - {IMX_8BIT, 0x034E, 0x07}, /* y_output_size[15:8] */ - {IMX_8BIT, 0x034F, 0x90}, /* y_output_size[7:0] */ - /* binning & scaling */ - {IMX_8BIT, 0x0390, 0x00}, /* binning mode */ - {IMX_8BIT, 0x0401, 0x02}, /* scaling mode*/ - {IMX_8BIT, 0x0405, 0x14}, /* scale_m[7:0] */ - /* timer */ - {IMX_8BIT, 0x3344, 0x57}, - {IMX_8BIT, 0x3345, 0x1F}, - /* timing */ - {IMX_8BIT, 0x3370, 0x77}, - {IMX_8BIT, 0x3371, 0x2F}, - {IMX_8BIT, 0x3372, 0x4F}, - {IMX_8BIT, 0x3373, 0x2F}, - {IMX_8BIT, 0x3374, 0x2F}, - {IMX_8BIT, 0x3375, 0x37}, - {IMX_8BIT, 0x3376, 0x9F}, - {IMX_8BIT, 0x3377, 0x37}, - {IMX_8BIT, 0x33C8, 0x01}, - {IMX_8BIT, 0x33D4, 0x0C}, - {IMX_8BIT, 0x33D5, 0xD0}, - {IMX_8BIT, 0x33D6, 0x09}, - {IMX_8BIT, 0x33D7, 0xA0}, - - {IMX_8BIT, 0x030e, 0x01}, - {IMX_8BIT, 0x41c0, 0x01}, - {IMX_TOK_TERM, 0, 0} -}; - -static struct imx_reg const imx_STILL_5M_15fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x0100, 0x00}, /* mode_select */ - /* shutter */ - {IMX_8BIT, 0x0202, 0x0A}, /* coarse _integration_time[15:8] */ - {IMX_8BIT, 0x0203, 0xEF}, /* coarse _integration_time[7:0] */ - /* pll */ - {IMX_8BIT, 0x0301, 0x05}, /* vt_pix_clk_div[7:0] */ - {IMX_8BIT, 0x0303, 0x01}, /* vt_sys_clk_div[7:0] */ - {IMX_8BIT, 0x0305, 0x09}, /* pre_pll_clk_div[7:0] */ - {IMX_8BIT, 0x0309, 0x05}, /* op_pix_clk_div[7:0] */ - {IMX_8BIT, 0x030B, 0x01}, /* op_sys_clk_div[7:0] */ - {IMX_8BIT, 0x030C, 0x01}, - {IMX_8BIT, 0x030D, 0x2c}, - /* image sizing */ - {IMX_8BIT, 0x0340, 0x0B}, /* frame_length_lines[15:8] */ - {IMX_8BIT, 0x0341, 0xB8}, /* frame_length_lines[7:0] */ - {IMX_8BIT, 0x0342, 0x16}, /* line_length_pck[15:8] */ - {IMX_8BIT, 0x0343, 0x44}, /* line_length_pck[7:0] */ - {IMX_8BIT, 0x0344, 0x00}, /* x_addr_start[15:8] */ - {IMX_8BIT, 0x0345, 0x00}, /* x_addr_start[7:0] */ - {IMX_8BIT, 0x0346, 0x00}, /* y_addr_start[15:8] */ - {IMX_8BIT, 0x0347, 0x00}, /* y_addr_start[7:0] */ - {IMX_8BIT, 0x0348, 0x0C}, /* x_addr_end[15:8] */ - {IMX_8BIT, 0x0349, 0xCF}, /* x_addr_end[7:0] */ - {IMX_8BIT, 0x034A, 0x09}, /* y_addr_end[15:8] */ - {IMX_8BIT, 0x034B, 0x9F}, /* y_addr_end[7:0] */ - {IMX_8BIT, 0x034C, 0x0A}, /* x_output_size[15:8] */ - {IMX_8BIT, 0x034D, 0x10}, /* x_output_size[7:0] */ - {IMX_8BIT, 0x034E, 0x07}, /* y_output_size[15:8] */ - {IMX_8BIT, 0x034F, 0x90}, /* y_output_size[7:0] */ - /* binning & scaling */ - {IMX_8BIT, 0x0390, 0x00}, /* binning mode */ - {IMX_8BIT, 0x0401, 0x00}, /* scaling mode*/ - {IMX_8BIT, 0x0405, 0x14}, /* scale_m[7:0] */ - /* timer */ - {IMX_8BIT, 0x3344, 0x57}, - {IMX_8BIT, 0x3345, 0x1F}, - /* timing */ - {IMX_8BIT, 0x3370, 0x77}, - {IMX_8BIT, 0x3371, 0x2F}, - {IMX_8BIT, 0x3372, 0x4F}, - {IMX_8BIT, 0x3373, 0x2F}, - {IMX_8BIT, 0x3374, 0x2F}, - {IMX_8BIT, 0x3375, 0x37}, - {IMX_8BIT, 0x3376, 0x9F}, - {IMX_8BIT, 0x3377, 0x37}, - {IMX_8BIT, 0x33C8, 0x01}, - {IMX_8BIT, 0x33D4, 0x0C}, - {IMX_8BIT, 0x33D5, 0xD0}, - {IMX_8BIT, 0x33D6, 0x09}, - {IMX_8BIT, 0x33D7, 0xA0}, - - {IMX_8BIT, 0x030e, 0x01}, - {IMX_8BIT, 0x41c0, 0x01}, - {IMX_TOK_TERM, 0, 0} -}; - -static struct imx_reg const imx_STILL_6M_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x0100, 0x00}, /* mode_select */ - /* shutter */ - {IMX_8BIT, 0x0202, 0x0A}, /* coarse _integration_time[15:8] */ - {IMX_8BIT, 0x0203, 0xEF}, /* coarse _integration_time[7:0] */ - /* pll */ - {IMX_8BIT, 0x0301, 0x05}, /* vt_pix_clk_div[7:0] */ - {IMX_8BIT, 0x0303, 0x01}, /* vt_sys_clk_div[7:0] */ - {IMX_8BIT, 0x0305, 0x09}, /* pre_pll_clk_div[7:0] */ - {IMX_8BIT, 0x0309, 0x05}, /* op_pix_clk_div[7:0] */ - {IMX_8BIT, 0x030B, 0x01}, /* op_sys_clk_div[7:0] */ - {IMX_8BIT, 0x030C, 0x01}, - {IMX_8BIT, 0x030D, 0x2c}, - /* image sizing */ - {IMX_8BIT, 0x0340, 0x09}, /* frame_length_lines[15:8] */ - {IMX_8BIT, 0x0341, 0xC4}, /* frame_length_lines[7:0] */ - {IMX_8BIT, 0x0342, 0x0D}, /* line_length_pck[15:8] */ - {IMX_8BIT, 0x0343, 0x66}, /* line_length_pck[7:0] */ - {IMX_8BIT, 0x0344, 0x00}, /* x_addr_start[15:8] */ - {IMX_8BIT, 0x0345, 0x00}, /* x_addr_start[7:0] */ - {IMX_8BIT, 0x0346, 0x01}, /* y_addr_start[15:8] */ - {IMX_8BIT, 0x0347, 0x32}, /* y_addr_start[7:0] */ - {IMX_8BIT, 0x0348, 0x0C}, /* x_addr_end[15:8] */ - {IMX_8BIT, 0x0349, 0xCF}, /* x_addr_end[7:0] */ - {IMX_8BIT, 0x034A, 0x08}, /* y_addr_end[15:8] */ - {IMX_8BIT, 0x034B, 0x6D}, /* y_addr_end[7:0] */ - {IMX_8BIT, 0x034C, 0x0C}, /* x_output_size[15:8] */ - {IMX_8BIT, 0x034D, 0xD0}, /* x_output_size[7:0] */ - {IMX_8BIT, 0x034E, 0x07}, /* y_output_size[15:8] */ - {IMX_8BIT, 0x034F, 0x3C}, /* y_output_size[7:0] */ - /* binning & scaling */ - {IMX_8BIT, 0x0390, 0x00}, /* binning mode */ - {IMX_8BIT, 0x0401, 0x00}, /* scaling mode*/ - {IMX_8BIT, 0x0405, 0x10}, /* scale_m[7:0] */ - /* timer */ - {IMX_8BIT, 0x3344, 0x57}, - {IMX_8BIT, 0x3345, 0x1F}, - /* timing */ - {IMX_8BIT, 0x3370, 0x77}, - {IMX_8BIT, 0x3371, 0x2F}, - {IMX_8BIT, 0x3372, 0x4F}, - {IMX_8BIT, 0x3373, 0x2F}, - {IMX_8BIT, 0x3374, 0x2F}, - {IMX_8BIT, 0x3375, 0x37}, - {IMX_8BIT, 0x3376, 0x9F}, - {IMX_8BIT, 0x3377, 0x37}, - {IMX_8BIT, 0x33C8, 0x01}, - {IMX_8BIT, 0x33D4, 0x0C}, - {IMX_8BIT, 0x33D5, 0xD0}, - {IMX_8BIT, 0x33D6, 0x09}, - {IMX_8BIT, 0x33D7, 0xA0}, - - {IMX_8BIT, 0x030e, 0x01}, - {IMX_8BIT, 0x41c0, 0x01}, - {IMX_TOK_TERM, 0, 0} -}; - -static struct imx_reg const imx_STILL_6M_15fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x0100, 0x00}, /* mode_select */ - /* shutter */ - {IMX_8BIT, 0x0202, 0x0A}, /* coarse _integration_time[15:8] */ - {IMX_8BIT, 0x0203, 0xEF}, /* coarse _integration_time[7:0] */ - /* pll */ - {IMX_8BIT, 0x0301, 0x05}, /* vt_pix_clk_div[7:0] */ - {IMX_8BIT, 0x0303, 0x01}, /* vt_sys_clk_div[7:0] */ - {IMX_8BIT, 0x0305, 0x09}, /* pre_pll_clk_div[7:0] */ - {IMX_8BIT, 0x0309, 0x05}, /* op_pix_clk_div[7:0] */ - {IMX_8BIT, 0x030B, 0x01}, /* op_sys_clk_div[7:0] */ - {IMX_8BIT, 0x030C, 0x01}, - {IMX_8BIT, 0x030D, 0x2c}, - /* image sizing */ - {IMX_8BIT, 0x0340, 0x0B}, /* frame_length_lines[15:8] */ - {IMX_8BIT, 0x0341, 0xB8}, /* frame_length_lines[7:0] */ - {IMX_8BIT, 0x0342, 0x16}, /* line_length_pck[15:8] */ - {IMX_8BIT, 0x0343, 0x44}, /* line_length_pck[7:0] */ - {IMX_8BIT, 0x0344, 0x00}, /* x_addr_start[15:8] */ - {IMX_8BIT, 0x0345, 0x00}, /* x_addr_start[7:0] */ - {IMX_8BIT, 0x0346, 0x01}, /* y_addr_start[15:8] */ - {IMX_8BIT, 0x0347, 0x32}, /* y_addr_start[7:0] */ - {IMX_8BIT, 0x0348, 0x0C}, /* x_addr_end[15:8] */ - {IMX_8BIT, 0x0349, 0xCF}, /* x_addr_end[7:0] */ - {IMX_8BIT, 0x034A, 0x08}, /* y_addr_end[15:8] */ - {IMX_8BIT, 0x034B, 0x6D}, /* y_addr_end[7:0] */ - {IMX_8BIT, 0x034C, 0x0C}, /* x_output_size[15:8] */ - {IMX_8BIT, 0x034D, 0xD0}, /* x_output_size[7:0] */ - {IMX_8BIT, 0x034E, 0x07}, /* y_output_size[15:8] */ - {IMX_8BIT, 0x034F, 0x3C}, /* y_output_size[7:0] */ - /* binning & scaling */ - {IMX_8BIT, 0x0390, 0x00}, /* binning mode */ - {IMX_8BIT, 0x0401, 0x00}, /* scaling mode*/ - {IMX_8BIT, 0x0405, 0x10}, /* scale_m[7:0] */ - /* timer */ - {IMX_8BIT, 0x3344, 0x57}, - {IMX_8BIT, 0x3345, 0x1F}, - /* timing */ - {IMX_8BIT, 0x3370, 0x77}, - {IMX_8BIT, 0x3371, 0x2F}, - {IMX_8BIT, 0x3372, 0x4F}, - {IMX_8BIT, 0x3373, 0x2F}, - {IMX_8BIT, 0x3374, 0x2F}, - {IMX_8BIT, 0x3375, 0x37}, - {IMX_8BIT, 0x3376, 0x9F}, - {IMX_8BIT, 0x3377, 0x37}, - {IMX_8BIT, 0x33C8, 0x01}, - {IMX_8BIT, 0x33D4, 0x0C}, - {IMX_8BIT, 0x33D5, 0xD0}, - {IMX_8BIT, 0x33D6, 0x09}, - {IMX_8BIT, 0x33D7, 0xA0}, - - {IMX_8BIT, 0x030e, 0x01}, - {IMX_8BIT, 0x41c0, 0x01}, - {IMX_TOK_TERM, 0, 0} -}; - -static struct imx_reg const imx_STILL_2M_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x0100, 0x00}, /* mode_select */ - /* shutter */ - {IMX_8BIT, 0x0202, 0x0A}, /* coarse _integration_time[15:8] */ - {IMX_8BIT, 0x0203, 0x8C}, /* coarse _integration_time[7:0] */ - /* pll */ - {IMX_8BIT, 0x0301, 0x05}, /* vt_pix_clk_div[7:0] */ - {IMX_8BIT, 0x0303, 0x01}, /* vt_sys_clk_div[7:0] */ - {IMX_8BIT, 0x0305, 0x09}, /* pre_pll_clk_div[7:0] */ - {IMX_8BIT, 0x0309, 0x05}, /* op_pix_clk_div[7:0] */ - {IMX_8BIT, 0x030B, 0x01}, /* op_sys_clk_div[7:0] */ - {IMX_8BIT, 0x030C, 0x01}, - {IMX_8BIT, 0x030D, 0x2c}, - /* image sizing */ - {IMX_8BIT, 0x0340, 0x09}, /* frame_length_lines[15:8] */ - {IMX_8BIT, 0x0341, 0xC4}, /* frame_length_lines[7:0] */ - {IMX_8BIT, 0x0342, 0x0D}, /* line_length_pck[15:8] */ - {IMX_8BIT, 0x0343, 0x66}, /* line_length_pck[7:0] */ - {IMX_8BIT, 0x0344, 0x00}, /* x_addr_start[15:8] */ - {IMX_8BIT, 0x0345, 0x00}, /* x_addr_start[7:0] */ - {IMX_8BIT, 0x0346, 0x00}, /* y_addr_start[15:8] */ - {IMX_8BIT, 0x0347, 0x00}, /* y_addr_start[7:0] */ - {IMX_8BIT, 0x0348, 0x0C}, /* x_addr_end[15:8] */ - {IMX_8BIT, 0x0349, 0xCF}, /* x_addr_end[7:0] */ - {IMX_8BIT, 0x034A, 0x09}, /* y_addr_end[15:8] */ - {IMX_8BIT, 0x034B, 0x9F}, /* y_addr_end[7:0] */ - {IMX_8BIT, 0x034C, 0x06}, /* x_output_size[15:8] */ - {IMX_8BIT, 0x034D, 0x68}, /* x_output_size[7:0] */ - {IMX_8BIT, 0x034E, 0x04}, /* y_output_size[15:8] */ - {IMX_8BIT, 0x034F, 0xD0}, /* y_output_size[7:0] */ - /* binning & scaling */ - {IMX_8BIT, 0x0390, 0x01}, /* binning mode */ - {IMX_8BIT, 0x0401, 0x00}, /* scaling mode*/ - {IMX_8BIT, 0x0405, 0x10}, /* scale_m[7:0] */ - /* timer */ - {IMX_8BIT, 0x3344, 0x57}, - {IMX_8BIT, 0x3345, 0x1F}, - /* timing */ - {IMX_8BIT, 0x3370, 0x77}, - {IMX_8BIT, 0x3371, 0x2F}, - {IMX_8BIT, 0x3372, 0x4F}, - {IMX_8BIT, 0x3373, 0x2F}, - {IMX_8BIT, 0x3374, 0x2F}, - {IMX_8BIT, 0x3375, 0x37}, - {IMX_8BIT, 0x3376, 0x9F}, - {IMX_8BIT, 0x3377, 0x37}, - {IMX_8BIT, 0x33C8, 0x01}, - {IMX_8BIT, 0x33D4, 0x0C}, - {IMX_8BIT, 0x33D5, 0xD0}, - {IMX_8BIT, 0x33D6, 0x09}, - {IMX_8BIT, 0x33D7, 0xA0}, - - {IMX_8BIT, 0x030e, 0x01}, - {IMX_8BIT, 0x41c0, 0x01}, - {IMX_TOK_TERM, 0, 0} -}; - -static struct imx_reg const imx_STILL_2M_15fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x0100, 0x00}, /* mode_select */ - /* shutter */ - {IMX_8BIT, 0x0202, 0x0A}, /* coarse _integration_time[15:8] */ - {IMX_8BIT, 0x0203, 0x8C}, /* coarse _integration_time[7:0] */ - /* pll */ - {IMX_8BIT, 0x0301, 0x05}, /* vt_pix_clk_div[7:0] */ - {IMX_8BIT, 0x0303, 0x01}, /* vt_sys_clk_div[7:0] */ - {IMX_8BIT, 0x0305, 0x09}, /* pre_pll_clk_div[7:0] */ - {IMX_8BIT, 0x0309, 0x05}, /* op_pix_clk_div[7:0] */ - {IMX_8BIT, 0x030B, 0x01}, /* op_sys_clk_div[7:0] */ - {IMX_8BIT, 0x030C, 0x01}, - {IMX_8BIT, 0x030D, 0x2c}, - /* image sizing */ - {IMX_8BIT, 0x0340, 0x0B}, /* frame_length_lines[15:8] */ - {IMX_8BIT, 0x0341, 0xB8}, /* frame_length_lines[7:0] */ - {IMX_8BIT, 0x0342, 0x16}, /* line_length_pck[15:8] */ - {IMX_8BIT, 0x0343, 0x44}, /* line_length_pck[7:0] */ - {IMX_8BIT, 0x0344, 0x00}, /* x_addr_start[15:8] */ - {IMX_8BIT, 0x0345, 0x00}, /* x_addr_start[7:0] */ - {IMX_8BIT, 0x0346, 0x00}, /* y_addr_start[15:8] */ - {IMX_8BIT, 0x0347, 0x00}, /* y_addr_start[7:0] */ - {IMX_8BIT, 0x0348, 0x0C}, /* x_addr_end[15:8] */ - {IMX_8BIT, 0x0349, 0xCF}, /* x_addr_end[7:0] */ - {IMX_8BIT, 0x034A, 0x09}, /* y_addr_end[15:8] */ - {IMX_8BIT, 0x034B, 0x9F}, /* y_addr_end[7:0] */ - {IMX_8BIT, 0x034C, 0x06}, /* x_output_size[15:8] */ - {IMX_8BIT, 0x034D, 0x68}, /* x_output_size[7:0] */ - {IMX_8BIT, 0x034E, 0x04}, /* y_output_size[15:8] */ - {IMX_8BIT, 0x034F, 0xD0}, /* y_output_size[7:0] */ - /* binning & scaling */ - {IMX_8BIT, 0x0390, 0x01}, /* binning mode */ - {IMX_8BIT, 0x0401, 0x00}, /* scaling mode*/ - {IMX_8BIT, 0x0405, 0x10}, /* scale_m[7:0] */ - /* timer */ - {IMX_8BIT, 0x3344, 0x57}, - {IMX_8BIT, 0x3345, 0x1F}, - /* timing */ - {IMX_8BIT, 0x3370, 0x77}, - {IMX_8BIT, 0x3371, 0x2F}, - {IMX_8BIT, 0x3372, 0x4F}, - {IMX_8BIT, 0x3373, 0x2F}, - {IMX_8BIT, 0x3374, 0x2F}, - {IMX_8BIT, 0x3375, 0x37}, - {IMX_8BIT, 0x3376, 0x9F}, - {IMX_8BIT, 0x3377, 0x37}, - {IMX_8BIT, 0x33C8, 0x01}, - {IMX_8BIT, 0x33D4, 0x0C}, - {IMX_8BIT, 0x33D5, 0xD0}, - {IMX_8BIT, 0x33D6, 0x09}, - {IMX_8BIT, 0x33D7, 0xA0}, - - {IMX_8BIT, 0x030e, 0x01}, - {IMX_8BIT, 0x41c0, 0x01}, - {IMX_TOK_TERM, 0, 0} -}; - -static struct imx_reg const imx_PREVIEW_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x0100, 0x00}, /* mode_select */ - /* shutter */ - {IMX_8BIT, 0x0202, 0x05}, /* coarse _integration_time[15:8] */ - {IMX_8BIT, 0x0203, 0x44}, /* coarse _integration_time[7:0] */ - /* pll */ - {IMX_8BIT, 0x0301, 0x05}, /* vt_pix_clk_div[7:0] */ - {IMX_8BIT, 0x0303, 0x01}, /* vt_sys_clk_div[7:0] */ - {IMX_8BIT, 0x0305, 0x06}, /* pre_pll_clk_div[7:0] */ - {IMX_8BIT, 0x0309, 0x05}, /* op_pix_clk_div[7:0] */ - {IMX_8BIT, 0x030B, 0x01}, /* op_sys_clk_div[7:0] */ - {IMX_8BIT, 0x030C, 0x00}, - {IMX_8BIT, 0x030D, 0x6D}, - /* image sizing */ - {IMX_8BIT, 0x0340, 0x05}, /* frame_length_lines[15:8] */ - {IMX_8BIT, 0x0341, 0x48}, /* frame_length_lines[7:0] */ - {IMX_8BIT, 0x0342, 0x0D}, /* line_length_pck[15:8] */ - {IMX_8BIT, 0x0343, 0x70}, /* line_length_pck[7:0] */ - {IMX_8BIT, 0x0344, 0x00}, /* x_addr_start[15:8] */ - {IMX_8BIT, 0x0345, 0x00}, /* x_addr_start[7:0] */ - {IMX_8BIT, 0x0346, 0x00}, /* y_addr_start[15:8] */ - {IMX_8BIT, 0x0347, 0x00}, /* y_addr_start[7:0] */ - {IMX_8BIT, 0x0348, 0x0C}, /* x_addr_end[15:8] */ - {IMX_8BIT, 0x0349, 0xCF}, /* x_addr_end[7:0] */ - {IMX_8BIT, 0x034A, 0x09}, /* y_addr_end[15:8] */ - {IMX_8BIT, 0x034B, 0x9F}, /* y_addr_end[7:0] */ - {IMX_8BIT, 0x034C, 0x03}, /* x_output_size[15:8] */ - {IMX_8BIT, 0x034D, 0x34}, /* x_output_size[7:0] */ - {IMX_8BIT, 0x034E, 0x02}, /* y_output_size[15:8] */ - {IMX_8BIT, 0x034F, 0x68}, /* y_output_size[7:0] */ - /* binning & scaling */ - {IMX_8BIT, 0x0390, 0x02}, /* binning mode */ - {IMX_8BIT, 0x0401, 0x00}, /* scaling mode*/ - {IMX_8BIT, 0x0405, 0x10}, /* scale_m[7:0] */ - /* timer */ - {IMX_8BIT, 0x3344, 0x37}, - {IMX_8BIT, 0x3345, 0x1F}, - /* timing */ - {IMX_8BIT, 0x3370, 0x5F}, - {IMX_8BIT, 0x3371, 0x17}, - {IMX_8BIT, 0x3372, 0x37}, - {IMX_8BIT, 0x3373, 0x17}, - {IMX_8BIT, 0x3374, 0x17}, - {IMX_8BIT, 0x3375, 0x0F}, - {IMX_8BIT, 0x3376, 0x57}, - {IMX_8BIT, 0x3377, 0x27}, - {IMX_8BIT, 0x33C8, 0x01}, - {IMX_8BIT, 0x33D4, 0x03}, - {IMX_8BIT, 0x33D5, 0x34}, - {IMX_8BIT, 0x33D6, 0x02}, - {IMX_8BIT, 0x33D7, 0x68}, - {IMX_TOK_TERM, 0, 0} -}; - -static struct imx_reg const imx_WIDE_PREVIEW_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x0100, 0x00}, /* mode_select */ - /* shutter */ - {IMX_8BIT, 0x0202, 0x05}, /* coarse _integration_time[15:8] */ - {IMX_8BIT, 0x0203, 0x44}, /* coarse _integration_time[7:0] */ - /* pll */ - {IMX_8BIT, 0x0301, 0x05}, /* vt_pix_clk_div[7:0] */ - {IMX_8BIT, 0x0303, 0x01}, /* vt_sys_clk_div[7:0] */ - {IMX_8BIT, 0x0305, 0x06}, /* pre_pll_clk_div[7:0] */ - {IMX_8BIT, 0x0309, 0x05}, /* op_pix_clk_div[7:0] */ - {IMX_8BIT, 0x030B, 0x01}, /* op_sys_clk_div[7:0] */ - {IMX_8BIT, 0x030C, 0x00}, - {IMX_8BIT, 0x030D, 0x6D}, - /* image sizing */ - {IMX_8BIT, 0x0340, 0x0D}, /* frame_length_lines[15:8] */ - {IMX_8BIT, 0x0341, 0x70}, /* frame_length_lines[7:0] */ - {IMX_8BIT, 0x0342, 0x10}, /* line_length_pck[15:8] */ - {IMX_8BIT, 0x0343, 0x00}, /* line_length_pck[7:0] */ - {IMX_8BIT, 0x0344, 0x00}, /* x_addr_start[15:8] */ - {IMX_8BIT, 0x0345, 0x00}, /* x_addr_start[7:0] */ - {IMX_8BIT, 0x0346, 0x00}, /* y_addr_start[15:8] */ - {IMX_8BIT, 0x0347, 0x14}, /* y_addr_start[7:0] */ - {IMX_8BIT, 0x0348, 0x0C}, /* x_addr_end[15:8] */ - {IMX_8BIT, 0x0349, 0xCF}, /* x_addr_end[7:0] */ - {IMX_8BIT, 0x034A, 0x08}, /* y_addr_end[15:8] */ - {IMX_8BIT, 0x034B, 0x8C}, /* y_addr_end[7:0] */ - {IMX_8BIT, 0x034C, 0x06}, /* x_output_size[15:8] */ - {IMX_8BIT, 0x034D, 0x68}, /* x_output_size[7:0] */ - {IMX_8BIT, 0x034E, 0x03}, /* y_output_size[15:8] */ - {IMX_8BIT, 0x034F, 0xBC}, /* y_output_size[7:0] */ - /* binning & scaling */ - {IMX_8BIT, 0x0390, 0x01}, /* binning mode */ - {IMX_8BIT, 0x0401, 0x00}, /* scaling mode*/ - {IMX_8BIT, 0x0405, 0x10}, /* scale_m[7:0] */ - /* timer */ - {IMX_8BIT, 0x3344, 0x37}, - {IMX_8BIT, 0x3345, 0x1F}, - /* timing */ - {IMX_8BIT, 0x3370, 0x5F}, - {IMX_8BIT, 0x3371, 0x17}, - {IMX_8BIT, 0x3372, 0x37}, - {IMX_8BIT, 0x3373, 0x17}, - {IMX_8BIT, 0x3374, 0x17}, - {IMX_8BIT, 0x3375, 0x0F}, - {IMX_8BIT, 0x3376, 0x57}, - {IMX_8BIT, 0x3377, 0x27}, - {IMX_8BIT, 0x33C8, 0x01}, - {IMX_8BIT, 0x33D4, 0x06}, - {IMX_8BIT, 0x33D5, 0x68}, - {IMX_8BIT, 0x33D6, 0x03}, - {IMX_8BIT, 0x33D7, 0xBC}, - {IMX_TOK_TERM, 0, 0} -}; - -/*****************************video************************/ -static struct imx_reg const imx_1080p_strong_dvs_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x0100, 0x00}, /* mode_select */ - /* shutter */ - {IMX_8BIT, 0x0202, 0x06}, /* coarse _integration_time[15:8] */ - {IMX_8BIT, 0x0203, 0x4C}, /* coarse _integration_time[7:0] */ - /* pll */ - {IMX_8BIT, 0x0301, 0x05}, /* vt_pix_clk_div[7:0] */ - {IMX_8BIT, 0x0303, 0x01}, /* vt_sys_clk_div[7:0] */ - {IMX_8BIT, 0x0305, 0x09}, /* pre_pll_clk_div[7:0] */ - {IMX_8BIT, 0x0309, 0x05}, /* op_pix_clk_div[7:0] */ - {IMX_8BIT, 0x030B, 0x01}, /* op_sys_clk_div[7:0] */ - {IMX_8BIT, 0x030C, 0x01}, - {IMX_8BIT, 0x030D, 0x12}, - /* image sizing */ - {IMX_8BIT, 0x0340, 0x06}, /* frame_length_lines[15:8] */ - {IMX_8BIT, 0x0341, 0xA4}, /* frame_length_lines[7:0] */ - {IMX_8BIT, 0x0342, 0x11}, /* line_length_pck[15:8] */ - {IMX_8BIT, 0x0343, 0xC6}, /* line_length_pck[7:0] */ - {IMX_8BIT, 0x0344, 0x01}, /* x_addr_start[15:8] */ - {IMX_8BIT, 0x0345, 0xDB}, /* x_addr_start[7:0] */ - {IMX_8BIT, 0x0346, 0x02}, /* y_addr_start[15:8] */ - {IMX_8BIT, 0x0347, 0x42}, /* y_addr_start[7:0] */ - {IMX_8BIT, 0x0348, 0x0A}, /* x_addr_end[15:8] */ - {IMX_8BIT, 0x0349, 0xEA}, /* x_addr_end[7:0] */ - {IMX_8BIT, 0x034A, 0x07}, /* y_addr_end[15:8] */ - {IMX_8BIT, 0x034B, 0x61}, /* y_addr_end[7:0] */ - {IMX_8BIT, 0x034C, 0x09}, /* x_output_size[15:8] */ - {IMX_8BIT, 0x034D, 0x10}, /* x_output_size[7:0] */ - {IMX_8BIT, 0x034E, 0x05}, /* y_output_size[15:8] */ - {IMX_8BIT, 0x034F, 0x20}, /* y_output_size[7:0] */ - /* binning & scaling */ - {IMX_8BIT, 0x0390, 0x00}, /* binning mode */ - {IMX_8BIT, 0x0401, 0x00}, /* scaling mode*/ - {IMX_8BIT, 0x0405, 0x10}, /* scale_m[7:0] */ - /* timer */ - {IMX_8BIT, 0x3344, 0x57}, - {IMX_8BIT, 0x3345, 0x1F}, - /* timing */ - {IMX_8BIT, 0x3370, 0x6F}, - {IMX_8BIT, 0x3371, 0x27}, - {IMX_8BIT, 0x3372, 0x4F}, - {IMX_8BIT, 0x3373, 0x2F}, - {IMX_8BIT, 0x3374, 0x27}, - {IMX_8BIT, 0x3375, 0x2F}, - {IMX_8BIT, 0x3376, 0x97}, - {IMX_8BIT, 0x3377, 0x37}, - {IMX_8BIT, 0x33C8, 0x01}, - {IMX_8BIT, 0x33D4, 0x0C}, - {IMX_8BIT, 0x33D5, 0xD0}, - {IMX_8BIT, 0x33D6, 0x07}, - {IMX_8BIT, 0x33D7, 0x38}, - {IMX_TOK_TERM, 0, 0} -}; - -static struct imx_reg const imx_1080p_no_dvs_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x0100, 0x00}, /* mode_select */ - /* shutter */ - {IMX_8BIT, 0x0202, 0x08}, /* coarse _integration_time[15:8] */ - {IMX_8BIT, 0x0203, 0xD5}, /* coarse _integration_time[7:0] */ - /* pll */ - {IMX_8BIT, 0x0301, 0x05}, /* vt_pix_clk_div[7:0] */ - {IMX_8BIT, 0x0303, 0x01}, /* vt_sys_clk_div[7:0] */ - {IMX_8BIT, 0x0305, 0x09}, /* pre_pll_clk_div[7:0] */ - {IMX_8BIT, 0x0309, 0x05}, /* op_pix_clk_div[7:0] */ - {IMX_8BIT, 0x030B, 0x01}, /* op_sys_clk_div[7:0] */ - {IMX_8BIT, 0x030C, 0x01}, - {IMX_8BIT, 0x030D, 0x12}, - /* image sizing */ - {IMX_8BIT, 0x0340, 0x07}, /* frame_length_lines[15:8] */ - {IMX_8BIT, 0x0341, 0xD0}, /* frame_length_lines[7:0] */ - {IMX_8BIT, 0x0342, 0x0F}, /* line_length_pck[15:8] */ - {IMX_8BIT, 0x0343, 0x3C}, /* line_length_pck[7:0] */ - {IMX_8BIT, 0x0344, 0x00}, /* x_addr_start[15:8] */ - {IMX_8BIT, 0x0345, 0x00}, /* x_addr_start[7:0] */ - {IMX_8BIT, 0x0346, 0x01}, /* y_addr_start[15:8] */ - {IMX_8BIT, 0x0347, 0x34}, /* y_addr_start[7:0] */ - {IMX_8BIT, 0x0348, 0x0C}, /* x_addr_end[15:8] */ - {IMX_8BIT, 0x0349, 0xCF}, /* x_addr_end[7:0] */ - {IMX_8BIT, 0x034A, 0x08}, /* y_addr_end[15:8] */ - {IMX_8BIT, 0x034B, 0x6B}, /* y_addr_end[7:0] */ - {IMX_8BIT, 0x034C, 0x07}, /* x_output_size[15:8] */ - {IMX_8BIT, 0x034D, 0x94}, /* x_output_size[7:0] */ - {IMX_8BIT, 0x034E, 0x04}, /* y_output_size[15:8] */ - {IMX_8BIT, 0x034F, 0x44}, /* y_output_size[7:0] */ - /* binning & scaling */ - {IMX_8BIT, 0x0390, 0x00}, /* binning mode */ - {IMX_8BIT, 0x0401, 0x02}, /* scaling mode*/ - {IMX_8BIT, 0x0405, 0x1B}, /* scale_m[7:0] */ - /* timer */ - {IMX_8BIT, 0x3344, 0x57}, - {IMX_8BIT, 0x3345, 0x1F}, - /* timing */ - {IMX_8BIT, 0x3370, 0x6F}, - {IMX_8BIT, 0x3371, 0x27}, - {IMX_8BIT, 0x3372, 0x4F}, - {IMX_8BIT, 0x3373, 0x2F}, - {IMX_8BIT, 0x3374, 0x27}, - {IMX_8BIT, 0x3375, 0x2F}, - {IMX_8BIT, 0x3376, 0x97}, - {IMX_8BIT, 0x3377, 0x37}, - {IMX_8BIT, 0x33C8, 0x01}, - {IMX_8BIT, 0x33D4, 0x0C}, - {IMX_8BIT, 0x33D5, 0xD0}, - {IMX_8BIT, 0x33D6, 0x07}, - {IMX_8BIT, 0x33D7, 0x38}, - {IMX_TOK_TERM, 0, 0} -}; - -static struct imx_reg const imx_1080p_no_dvs_15fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x0100, 0x00}, /* mode_select */ - /* shutter */ - {IMX_8BIT, 0x0202, 0x08}, /* coarse _integration_time[15:8] */ - {IMX_8BIT, 0x0203, 0xD5}, /* coarse _integration_time[7:0] */ - /* pll */ - {IMX_8BIT, 0x0301, 0x05}, /* vt_pix_clk_div[7:0] */ - {IMX_8BIT, 0x0303, 0x01}, /* vt_sys_clk_div[7:0] */ - {IMX_8BIT, 0x0305, 0x09}, /* pre_pll_clk_div[7:0] */ - {IMX_8BIT, 0x0309, 0x05}, /* op_pix_clk_div[7:0] */ - {IMX_8BIT, 0x030B, 0x01}, /* op_sys_clk_div[7:0] */ - {IMX_8BIT, 0x030C, 0x01}, - {IMX_8BIT, 0x030D, 0x12}, - /* image sizing */ - {IMX_8BIT, 0x0340, 0x09}, /* frame_length_lines[15:8] */ - {IMX_8BIT, 0x0341, 0xA6}, /* frame_length_lines[7:0] */ - {IMX_8BIT, 0x0342, 0x18}, /* line_length_pck[15:8] */ - {IMX_8BIT, 0x0343, 0x9C}, /* line_length_pck[7:0] */ - {IMX_8BIT, 0x0344, 0x00}, /* x_addr_start[15:8] */ - {IMX_8BIT, 0x0345, 0x00}, /* x_addr_start[7:0] */ - {IMX_8BIT, 0x0346, 0x01}, /* y_addr_start[15:8] */ - {IMX_8BIT, 0x0347, 0x34}, /* y_addr_start[7:0] */ - {IMX_8BIT, 0x0348, 0x0C}, /* x_addr_end[15:8] */ - {IMX_8BIT, 0x0349, 0xCF}, /* x_addr_end[7:0] */ - {IMX_8BIT, 0x034A, 0x08}, /* y_addr_end[15:8] */ - {IMX_8BIT, 0x034B, 0x6B}, /* y_addr_end[7:0] */ - {IMX_8BIT, 0x034C, 0x07}, /* x_output_size[15:8] */ - {IMX_8BIT, 0x034D, 0x94}, /* x_output_size[7:0] */ - {IMX_8BIT, 0x034E, 0x04}, /* y_output_size[15:8] */ - {IMX_8BIT, 0x034F, 0x44}, /* y_output_size[7:0] */ - /* binning & scaling */ - {IMX_8BIT, 0x0390, 0x00}, /* binning mode */ - {IMX_8BIT, 0x0401, 0x02}, /* scaling mode*/ - {IMX_8BIT, 0x0405, 0x1B}, /* scale_m[7:0] */ - /* timer */ - {IMX_8BIT, 0x3344, 0x57}, - {IMX_8BIT, 0x3345, 0x1F}, - /* timing */ - {IMX_8BIT, 0x3370, 0x6F}, - {IMX_8BIT, 0x3371, 0x27}, - {IMX_8BIT, 0x3372, 0x4F}, - {IMX_8BIT, 0x3373, 0x2F}, - {IMX_8BIT, 0x3374, 0x27}, - {IMX_8BIT, 0x3375, 0x2F}, - {IMX_8BIT, 0x3376, 0x97}, - {IMX_8BIT, 0x3377, 0x37}, - {IMX_8BIT, 0x33C8, 0x01}, - {IMX_8BIT, 0x33D4, 0x0C}, - {IMX_8BIT, 0x33D5, 0xD0}, - {IMX_8BIT, 0x33D6, 0x07}, - {IMX_8BIT, 0x33D7, 0x38}, - {IMX_TOK_TERM, 0, 0} -}; -/*****************************video************************/ -static struct imx_reg const imx_720p_strong_dvs_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x0100, 0x00}, /* mode_select */ - /* shutter */ - {IMX_8BIT, 0x0202, 0x05}, /* coarse _integration_time[15:8] */ - {IMX_8BIT, 0x0203, 0xFC}, /* coarse _integration_time[7:0] */ - /* pll */ - {IMX_8BIT, 0x0301, 0x05}, /* vt_pix_clk_div[7:0] */ - {IMX_8BIT, 0x0303, 0x01}, /* vt_sys_clk_div[7:0] */ - {IMX_8BIT, 0x0305, 0x09}, /* pre_pll_clk_div[7:0] */ - {IMX_8BIT, 0x0309, 0x05}, /* op_pix_clk_div[7:0] */ - {IMX_8BIT, 0x030B, 0x01}, /* op_sys_clk_div[7:0] */ - {IMX_8BIT, 0x030C, 0x01}, - {IMX_8BIT, 0x030D, 0x12}, - /* image sizing */ - {IMX_8BIT, 0x0340, 0x06}, /* frame_length_lines[15:8] */ - {IMX_8BIT, 0x0341, 0x00}, /* frame_length_lines[7:0] */ - {IMX_8BIT, 0x0342, 0x13}, /* line_length_pck[15:8] */ - {IMX_8BIT, 0x0343, 0x9C}, /* line_length_pck[7:0] */ - {IMX_8BIT, 0x0344, 0x01}, /* x_addr_start[15:8] */ - {IMX_8BIT, 0x0345, 0xD7}, /* x_addr_start[7:0] */ - {IMX_8BIT, 0x0346, 0x02}, /* y_addr_start[15:8] */ - {IMX_8BIT, 0x0347, 0x3E}, /* y_addr_start[7:0] */ - {IMX_8BIT, 0x0348, 0x0A}, /* x_addr_end[15:8] */ - {IMX_8BIT, 0x0349, 0xEE}, /* x_addr_end[7:0] */ - {IMX_8BIT, 0x034A, 0x07}, /* y_addr_end[15:8] */ - {IMX_8BIT, 0x034B, 0x65}, /* y_addr_end[7:0] */ - {IMX_8BIT, 0x034C, 0x06}, /* x_output_size[15:8] */ - {IMX_8BIT, 0x034D, 0x10}, /* x_output_size[7:0] */ - {IMX_8BIT, 0x034E, 0x03}, /* y_output_size[15:8] */ - {IMX_8BIT, 0x034F, 0x70}, /* y_output_size[7:0] */ - /* binning & scaling */ - {IMX_8BIT, 0x0390, 0x00}, /* binning mode */ - {IMX_8BIT, 0x0401, 0x02}, /* scaling mode*/ - {IMX_8BIT, 0x0405, 0x18}, /* scale_m[7:0] */ - /* timer */ - {IMX_8BIT, 0x3344, 0x57}, - {IMX_8BIT, 0x3345, 0x1F}, - /* timing */ - {IMX_8BIT, 0x3370, 0x6F}, - {IMX_8BIT, 0x3371, 0x27}, - {IMX_8BIT, 0x3372, 0x4F}, - {IMX_8BIT, 0x3373, 0x2F}, - {IMX_8BIT, 0x3374, 0x27}, - {IMX_8BIT, 0x3375, 0x2F}, - {IMX_8BIT, 0x3376, 0x97}, - {IMX_8BIT, 0x3377, 0x37}, - {IMX_8BIT, 0x33C8, 0x01}, - {IMX_8BIT, 0x33D4, 0x0C}, - {IMX_8BIT, 0x33D5, 0xD0}, - {IMX_8BIT, 0x33D6, 0x07}, - {IMX_8BIT, 0x33D7, 0x38}, - {IMX_TOK_TERM, 0, 0} -}; - -static struct imx_reg const imx_480p_strong_dvs_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x0100, 0x00}, /* mode_select */ - /* shutter */ - {IMX_8BIT, 0x0202, 0x05}, /* coarse _integration_time[15:8] */ - {IMX_8BIT, 0x0203, 0xFC}, /* coarse _integration_time[7:0] */ - /* pll */ - {IMX_8BIT, 0x0301, 0x05}, /* vt_pix_clk_div[7:0] */ - {IMX_8BIT, 0x0303, 0x01}, /* vt_sys_clk_div[7:0] */ - {IMX_8BIT, 0x0305, 0x09}, /* pre_pll_clk_div[7:0] */ - {IMX_8BIT, 0x0309, 0x05}, /* op_pix_clk_div[7:0] */ - {IMX_8BIT, 0x030B, 0x01}, /* op_sys_clk_div[7:0] */ - {IMX_8BIT, 0x030C, 0x01}, - {IMX_8BIT, 0x030D, 0x12}, - /* image sizing */ - {IMX_8BIT, 0x0340, 0x06}, /* frame_length_lines[15:8] */ - {IMX_8BIT, 0x0341, 0x00}, /* frame_length_lines[7:0] */ - {IMX_8BIT, 0x0342, 0x13}, /* line_length_pck[15:8] */ - {IMX_8BIT, 0x0343, 0x9C}, /* line_length_pck[7:0] */ - {IMX_8BIT, 0x0344, 0x01}, /* x_addr_start[15:8] */ - {IMX_8BIT, 0x0345, 0xD4}, /* x_addr_start[7:0] */ - {IMX_8BIT, 0x0346, 0x01}, /* y_addr_start[15:8] */ - {IMX_8BIT, 0x0347, 0xC8}, /* y_addr_start[7:0] */ - {IMX_8BIT, 0x0348, 0x0A}, /* x_addr_end[15:8] */ - {IMX_8BIT, 0x0349, 0xF1}, /* x_addr_end[7:0] */ - {IMX_8BIT, 0x034A, 0x07}, /* y_addr_end[15:8] */ - {IMX_8BIT, 0x034B, 0xDB}, /* y_addr_end[7:0] */ - {IMX_8BIT, 0x034C, 0x03}, /* x_output_size[15:8] */ - {IMX_8BIT, 0x034D, 0x70}, /* x_output_size[7:0] */ - {IMX_8BIT, 0x034E, 0x02}, /* y_output_size[15:8] */ - {IMX_8BIT, 0x034F, 0x50}, /* y_output_size[7:0] */ - /* binning & scaling */ - {IMX_8BIT, 0x0390, 0x01}, /* binning mode */ - {IMX_8BIT, 0x0401, 0x02}, /* scaling mode*/ - {IMX_8BIT, 0x0405, 0x15}, /* scale_m[7:0] */ - /* timer */ - {IMX_8BIT, 0x3344, 0x57}, - {IMX_8BIT, 0x3345, 0x1F}, - /* timing */ - {IMX_8BIT, 0x3370, 0x6F}, - {IMX_8BIT, 0x3371, 0x27}, - {IMX_8BIT, 0x3372, 0x4F}, - {IMX_8BIT, 0x3373, 0x2F}, - {IMX_8BIT, 0x3374, 0x27}, - {IMX_8BIT, 0x3375, 0x2F}, - {IMX_8BIT, 0x3376, 0x97}, - {IMX_8BIT, 0x3377, 0x37}, - {IMX_8BIT, 0x33C8, 0x01}, - {IMX_8BIT, 0x33D4, 0x0C}, - {IMX_8BIT, 0x33D5, 0xD0}, - {IMX_8BIT, 0x33D6, 0x07}, - {IMX_8BIT, 0x33D7, 0x38}, - {IMX_TOK_TERM, 0, 0} -}; - -static struct imx_reg const imx_STILL_720p_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x0100, 0x00}, /* mode_select */ - /* shutter */ - {IMX_8BIT, 0x0202, 0x05}, /* coarse _integration_time[15:8] */ - {IMX_8BIT, 0x0203, 0x44}, /* coarse _integration_time[7:0] */ - /* pll */ - {IMX_8BIT, 0x0301, 0x05}, /* vt_pix_clk_div[7:0] */ - {IMX_8BIT, 0x0303, 0x01}, /* vt_sys_clk_div[7:0] */ - {IMX_8BIT, 0x0305, 0x04}, /* pre_pll_clk_div[7:0] */ - {IMX_8BIT, 0x0309, 0x05}, /* op_pix_clk_div[7:0] */ - {IMX_8BIT, 0x030B, 0x01}, /* op_sys_clk_div[7:0] */ - {IMX_8BIT, 0x030C, 0x00}, - {IMX_8BIT, 0x030D, 0x6D}, - /* image sizing */ - {IMX_8BIT, 0x0340, 0x05}, /* frame_length_lines[15:8] */ - {IMX_8BIT, 0x0341, 0x48}, /* frame_length_lines[7:0] */ - {IMX_8BIT, 0x0342, 0x14}, /* line_length_pck[15:8] */ - {IMX_8BIT, 0x0343, 0x28}, /* line_length_pck[7:0] */ - {IMX_8BIT, 0x0344, 0x00}, /* x_addr_start[15:8] */ - {IMX_8BIT, 0x0345, 0x48}, /* x_addr_start[7:0] */ - {IMX_8BIT, 0x0346, 0x01}, /* y_addr_start[15:8] */ - {IMX_8BIT, 0x0347, 0x64}, /* y_addr_start[7:0] */ - {IMX_8BIT, 0x0348, 0x0C}, /* x_addr_end[15:8] */ - {IMX_8BIT, 0x0349, 0x87}, /* x_addr_end[7:0] */ - {IMX_8BIT, 0x034A, 0x08}, /* y_addr_end[15:8] */ - {IMX_8BIT, 0x034B, 0x3B}, /* y_addr_end[7:0] */ - {IMX_8BIT, 0x034C, 0x06}, /* x_output_size[15:8] */ - {IMX_8BIT, 0x034D, 0x20}, /* x_output_size[7:0] */ - {IMX_8BIT, 0x034E, 0x03}, /* y_output_size[15:8] */ - {IMX_8BIT, 0x034F, 0x6C}, /* y_output_size[7:0] */ - /* binning & scaling */ - {IMX_8BIT, 0x0390, 0x01}, /* binning mode */ - {IMX_8BIT, 0x0401, 0x00}, /* scaling mode*/ - {IMX_8BIT, 0x0405, 0x10}, /* scale_m[7:0] */ - /* timer */ - {IMX_8BIT, 0x3344, 0x37}, - {IMX_8BIT, 0x3345, 0x1F}, - /* timing */ - {IMX_8BIT, 0x3370, 0x5F}, - {IMX_8BIT, 0x3371, 0x17}, - {IMX_8BIT, 0x3372, 0x37}, - {IMX_8BIT, 0x3373, 0x17}, - {IMX_8BIT, 0x3374, 0x17}, - {IMX_8BIT, 0x3375, 0x0F}, - {IMX_8BIT, 0x3376, 0x57}, - {IMX_8BIT, 0x3377, 0x27}, - {IMX_8BIT, 0x33C8, 0x01}, - {IMX_8BIT, 0x33D4, 0x06}, - {IMX_8BIT, 0x33D5, 0x20}, - {IMX_8BIT, 0x33D6, 0x03}, - {IMX_8BIT, 0x33D7, 0x6C}, - {IMX_TOK_TERM, 0, 0} -}; - -static struct imx_reg const imx_STILL_720p_15fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x0100, 0x00}, /* mode_select */ - /* shutter */ - {IMX_8BIT, 0x0202, 0x05}, /* coarse _integration_time[15:8] */ - {IMX_8BIT, 0x0203, 0x44}, /* coarse _integration_time[7:0] */ - /* pll */ - {IMX_8BIT, 0x0301, 0x05}, /* vt_pix_clk_div[7:0] */ - {IMX_8BIT, 0x0303, 0x01}, /* vt_sys_clk_div[7:0] */ - {IMX_8BIT, 0x0305, 0x04}, /* pre_pll_clk_div[7:0] */ - {IMX_8BIT, 0x0309, 0x05}, /* op_pix_clk_div[7:0] */ - {IMX_8BIT, 0x030B, 0x01}, /* op_sys_clk_div[7:0] */ - {IMX_8BIT, 0x030C, 0x00}, - {IMX_8BIT, 0x030D, 0x6D}, - /* image sizing */ - {IMX_8BIT, 0x0340, 0x08}, /* frame_length_lines[15:8] */ - {IMX_8BIT, 0x0341, 0xCA}, /* frame_length_lines[7:0] */ - {IMX_8BIT, 0x0342, 0x18}, /* line_length_pck[15:8] */ - {IMX_8BIT, 0x0343, 0x38}, /* line_length_pck[7:0] */ - {IMX_8BIT, 0x0344, 0x00}, /* x_addr_start[15:8] */ - {IMX_8BIT, 0x0345, 0x48}, /* x_addr_start[7:0] */ - {IMX_8BIT, 0x0346, 0x01}, /* y_addr_start[15:8] */ - {IMX_8BIT, 0x0347, 0x64}, /* y_addr_start[7:0] */ - {IMX_8BIT, 0x0348, 0x0C}, /* x_addr_end[15:8] */ - {IMX_8BIT, 0x0349, 0x87}, /* x_addr_end[7:0] */ - {IMX_8BIT, 0x034A, 0x08}, /* y_addr_end[15:8] */ - {IMX_8BIT, 0x034B, 0x3B}, /* y_addr_end[7:0] */ - {IMX_8BIT, 0x034C, 0x06}, /* x_output_size[15:8] */ - {IMX_8BIT, 0x034D, 0x20}, /* x_output_size[7:0] */ - {IMX_8BIT, 0x034E, 0x03}, /* y_output_size[15:8] */ - {IMX_8BIT, 0x034F, 0x6C}, /* y_output_size[7:0] */ - /* binning & scaling */ - {IMX_8BIT, 0x0390, 0x01}, /* binning mode */ - {IMX_8BIT, 0x0401, 0x00}, /* scaling mode*/ - {IMX_8BIT, 0x0405, 0x10}, /* scale_m[7:0] */ - /* timer */ - {IMX_8BIT, 0x3344, 0x37}, - {IMX_8BIT, 0x3345, 0x1F}, - /* timing */ - {IMX_8BIT, 0x3370, 0x5F}, - {IMX_8BIT, 0x3371, 0x17}, - {IMX_8BIT, 0x3372, 0x37}, - {IMX_8BIT, 0x3373, 0x17}, - {IMX_8BIT, 0x3374, 0x17}, - {IMX_8BIT, 0x3375, 0x0F}, - {IMX_8BIT, 0x3376, 0x57}, - {IMX_8BIT, 0x3377, 0x27}, - {IMX_8BIT, 0x33C8, 0x01}, - {IMX_8BIT, 0x33D4, 0x06}, - {IMX_8BIT, 0x33D5, 0x20}, - {IMX_8BIT, 0x33D6, 0x03}, - {IMX_8BIT, 0x33D7, 0x6C}, - {IMX_TOK_TERM, 0, 0} -}; - -static struct imx_reg const imx_WVGA_strong_dvs_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x0100, 0x00}, /* mode_select */ - /* shutter */ - {IMX_8BIT, 0x0202, 0x05}, /* coarse _integration_time[15:8] */ - {IMX_8BIT, 0x0203, 0xEC}, /* coarse _integration_time[7:0] */ - /* pll */ - {IMX_8BIT, 0x0301, 0x05}, /* vt_pix_clk_div[7:0] */ - {IMX_8BIT, 0x0303, 0x01}, /* vt_sys_clk_div[7:0] */ - {IMX_8BIT, 0x0305, 0x09}, /* pre_pll_clk_div[7:0] */ - {IMX_8BIT, 0x0309, 0x05}, /* op_pix_clk_div[7:0] */ - {IMX_8BIT, 0x030B, 0x01}, /* op_sys_clk_div[7:0] */ - {IMX_8BIT, 0x030C, 0x01}, - {IMX_8BIT, 0x030D, 0x12}, - /* image sizing */ - {IMX_8BIT, 0x0340, 0x06}, /* frame_length_lines[15:8] */ - {IMX_8BIT, 0x0341, 0x00}, /* frame_length_lines[7:0] */ - {IMX_8BIT, 0x0342, 0x13}, /* line_length_pck[15:8] */ - {IMX_8BIT, 0x0343, 0x9C}, /* line_length_pck[7:0] */ - {IMX_8BIT, 0x0344, 0x00}, /* x_addr_start[15:8] */ - {IMX_8BIT, 0x0345, 0x00}, /* x_addr_start[7:0] */ - {IMX_8BIT, 0x0346, 0x00}, /* y_addr_start[15:8] */ - {IMX_8BIT, 0x0347, 0xD0}, /* y_addr_start[7:0] */ - {IMX_8BIT, 0x0348, 0x0C}, /* x_addr_end[15:8] */ - {IMX_8BIT, 0x0349, 0xCF}, /* x_addr_end[7:0] */ - {IMX_8BIT, 0x034A, 0x08}, /* y_addr_end[15:8] */ - {IMX_8BIT, 0x034B, 0xCF}, /* y_addr_end[7:0] */ - {IMX_8BIT, 0x034C, 0x06}, /* x_output_size[15:8] */ - {IMX_8BIT, 0x034D, 0x68}, /* x_output_size[7:0] */ - {IMX_8BIT, 0x034E, 0x04}, /* y_output_size[15:8] */ - {IMX_8BIT, 0x034F, 0x00}, /* y_output_size[7:0] */ - /* binning & scaling */ - {IMX_8BIT, 0x0390, 0x01}, /* binning mode */ - {IMX_8BIT, 0x0401, 0x00}, /* scaling mode*/ - {IMX_8BIT, 0x0405, 0x10}, /* scale_m[7:0] */ - /* timer */ - {IMX_8BIT, 0x3344, 0x57}, - {IMX_8BIT, 0x3345, 0x1F}, - /* timing */ - {IMX_8BIT, 0x3370, 0x6F}, - {IMX_8BIT, 0x3371, 0x27}, - {IMX_8BIT, 0x3372, 0x4F}, - {IMX_8BIT, 0x3373, 0x2F}, - {IMX_8BIT, 0x3374, 0x27}, - {IMX_8BIT, 0x3375, 0x2F}, - {IMX_8BIT, 0x3376, 0x97}, - {IMX_8BIT, 0x3377, 0x37}, - {IMX_8BIT, 0x33C8, 0x01}, - {IMX_8BIT, 0x33D4, 0x0C}, - {IMX_8BIT, 0x33D5, 0xD0}, - {IMX_8BIT, 0x33D6, 0x07}, - {IMX_8BIT, 0x33D7, 0x38}, - {IMX_TOK_TERM, 0, 0} -}; -static struct imx_reg const imx_CIF_strong_dvs_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x0100, 0x00}, /* mode_select */ - /* shutter */ - {IMX_8BIT, 0x0202, 0x05}, /* coarse _integration_time[15:8] */ - {IMX_8BIT, 0x0203, 0xFC}, /* coarse _integration_time[7:0] */ - /* pll */ - {IMX_8BIT, 0x0301, 0x05}, /* vt_pix_clk_div[7:0] */ - {IMX_8BIT, 0x0303, 0x01}, /* vt_sys_clk_div[7:0] */ - {IMX_8BIT, 0x0305, 0x04}, /* pre_pll_clk_div[7:0] */ - {IMX_8BIT, 0x0309, 0x05}, /* op_pix_clk_div[7:0] */ - {IMX_8BIT, 0x030B, 0x01}, /* op_sys_clk_div[7:0] */ - {IMX_8BIT, 0x030C, 0x00}, - {IMX_8BIT, 0x030D, 0x6D}, - /* image sizing */ - {IMX_8BIT, 0x0340, 0x06}, /* frame_length_lines[15:8] */ - {IMX_8BIT, 0x0341, 0x00}, /* frame_length_lines[7:0] */ - {IMX_8BIT, 0x0342, 0x11}, /* line_length_pck[15:8] */ - {IMX_8BIT, 0x0343, 0xDB}, /* line_length_pck[7:0] */ - {IMX_8BIT, 0x0344, 0x00}, /* x_addr_start[15:8] */ - {IMX_8BIT, 0x0345, 0x00}, /* x_addr_start[7:0] */ - {IMX_8BIT, 0x0346, 0x00}, /* y_addr_start[15:8] */ - {IMX_8BIT, 0x0347, 0x00}, /* y_addr_start[7:0] */ - {IMX_8BIT, 0x0348, 0x0C}, /* x_addr_end[15:8] */ - {IMX_8BIT, 0x0349, 0xCF}, /* x_addr_end[7:0] */ - {IMX_8BIT, 0x034A, 0x09}, /* y_addr_end[15:8] */ - {IMX_8BIT, 0x034B, 0x9F}, /* y_addr_end[7:0] */ - {IMX_8BIT, 0x034C, 0x01}, /* x_output_size[15:8] */ - {IMX_8BIT, 0x034D, 0x70}, /* x_output_size[7:0] */ - {IMX_8BIT, 0x034E, 0x01}, /* y_output_size[15:8] */ - {IMX_8BIT, 0x034F, 0x30}, /* y_output_size[7:0] */ - /* binning & scaling */ - {IMX_8BIT, 0x0390, 0x02}, /* binning mode */ - {IMX_8BIT, 0x0401, 0x00}, /* scaling mode*/ - {IMX_8BIT, 0x0405, 0x10}, /* scale_m[7:0] */ - /* timer */ - {IMX_8BIT, 0x3344, 0x37}, - {IMX_8BIT, 0x3345, 0x1F}, - /* timing */ - {IMX_8BIT, 0x3370, 0x5F}, - {IMX_8BIT, 0x3371, 0x17}, - {IMX_8BIT, 0x3372, 0x37}, - {IMX_8BIT, 0x3373, 0x17}, - {IMX_8BIT, 0x3374, 0x17}, - {IMX_8BIT, 0x3375, 0x0F}, - {IMX_8BIT, 0x3376, 0x57}, - {IMX_8BIT, 0x3377, 0x27}, - {IMX_8BIT, 0x33C8, 0x01}, - {IMX_8BIT, 0x33D4, 0x06}, - {IMX_8BIT, 0x33D5, 0x20}, - {IMX_8BIT, 0x33D6, 0x03}, - {IMX_8BIT, 0x33D7, 0x6C}, - {IMX_TOK_TERM, 0, 0} -}; - -static struct imx_reg const imx_VGA_strong_dvs_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x0100, 0x00}, /* mode_select */ - /* shutter */ - {IMX_8BIT, 0x0202, 0x05}, /* coarse _integration_time[15:8] */ - {IMX_8BIT, 0x0203, 0xFC}, /* coarse _integration_time[7:0] */ - /* pll */ - {IMX_8BIT, 0x0301, 0x05}, /* vt_pix_clk_div[7:0] */ - {IMX_8BIT, 0x0303, 0x01}, /* vt_sys_clk_div[7:0] */ - {IMX_8BIT, 0x0305, 0x04}, /* pre_pll_clk_div[7:0] */ - {IMX_8BIT, 0x0309, 0x05}, /* op_pix_clk_div[7:0] */ - {IMX_8BIT, 0x030B, 0x01}, /* op_sys_clk_div[7:0] */ - {IMX_8BIT, 0x030C, 0x00}, - {IMX_8BIT, 0x030D, 0x6D}, - /* image sizing */ - {IMX_8BIT, 0x0340, 0x06}, /* frame_length_lines[15:8] */ - {IMX_8BIT, 0x0341, 0x00}, /* frame_length_lines[7:0] */ - {IMX_8BIT, 0x0342, 0x11}, /* line_length_pck[15:8] */ - {IMX_8BIT, 0x0343, 0x94}, /* line_length_pck[7:0] */ - {IMX_8BIT, 0x0344, 0x00}, /* x_addr_start[15:8] */ - {IMX_8BIT, 0x0345, 0x00}, /* x_addr_start[7:0] */ - {IMX_8BIT, 0x0346, 0x00}, /* y_addr_start[15:8] */ - {IMX_8BIT, 0x0347, 0x00}, /* y_addr_start[7:0] */ - {IMX_8BIT, 0x0348, 0x0C}, /* x_addr_end[15:8] */ - {IMX_8BIT, 0x0349, 0xCF}, /* x_addr_end[7:0] */ - {IMX_8BIT, 0x034A, 0x09}, /* y_addr_end[15:8] */ - {IMX_8BIT, 0x034B, 0x9F}, /* y_addr_end[7:0] */ - {IMX_8BIT, 0x034C, 0x03}, /* x_output_size[15:8] */ - {IMX_8BIT, 0x034D, 0x34}, /* x_output_size[7:0] */ - {IMX_8BIT, 0x034E, 0x02}, /* y_output_size[15:8] */ - {IMX_8BIT, 0x034F, 0x68}, /* y_output_size[7:0] */ - /* binning & scaling */ - {IMX_8BIT, 0x0390, 0x02}, /* binning mode */ - {IMX_8BIT, 0x0401, 0x00}, /* scaling mode*/ - {IMX_8BIT, 0x0405, 0x10}, /* scale_m[7:0] */ - /* timer */ - {IMX_8BIT, 0x3344, 0x37}, - {IMX_8BIT, 0x3345, 0x1F}, - /* timing */ - {IMX_8BIT, 0x3370, 0x5F}, - {IMX_8BIT, 0x3371, 0x17}, - {IMX_8BIT, 0x3372, 0x37}, - {IMX_8BIT, 0x3373, 0x17}, - {IMX_8BIT, 0x3374, 0x17}, - {IMX_8BIT, 0x3375, 0x0F}, - {IMX_8BIT, 0x3376, 0x57}, - {IMX_8BIT, 0x3377, 0x27}, - {IMX_8BIT, 0x33C8, 0x01}, - {IMX_8BIT, 0x33D4, 0x06}, - {IMX_8BIT, 0x33D5, 0x20}, - {IMX_8BIT, 0x33D6, 0x03}, - {IMX_8BIT, 0x33D7, 0x6C}, - {IMX_TOK_TERM, 0, 0} -}; - -static struct imx_reg const imx_VGA_strong_dvs_15fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x0100, 0x00}, /* mode_select */ - /* shutter */ - {IMX_8BIT, 0x0202, 0x05}, /* coarse _integration_time[15:8] */ - {IMX_8BIT, 0x0203, 0xFC}, /* coarse _integration_time[7:0] */ - /* pll */ - {IMX_8BIT, 0x0301, 0x05}, /* vt_pix_clk_div[7:0] */ - {IMX_8BIT, 0x0303, 0x01}, /* vt_sys_clk_div[7:0] */ - {IMX_8BIT, 0x0305, 0x04}, /* pre_pll_clk_div[7:0] */ - {IMX_8BIT, 0x0309, 0x05}, /* op_pix_clk_div[7:0] */ - {IMX_8BIT, 0x030B, 0x01}, /* op_sys_clk_div[7:0] */ - {IMX_8BIT, 0x030C, 0x00}, - {IMX_8BIT, 0x030D, 0x6D}, - /* image sizing */ - {IMX_8BIT, 0x0340, 0x07}, /* frame_length_lines[15:8] */ - {IMX_8BIT, 0x0341, 0x9E}, /* frame_length_lines[7:0] */ - {IMX_8BIT, 0x0342, 0x1C}, /* line_length_pck[15:8] */ - {IMX_8BIT, 0x0343, 0xB6}, /* line_length_pck[7:0] */ - {IMX_8BIT, 0x0344, 0x00}, /* x_addr_start[15:8] */ - {IMX_8BIT, 0x0345, 0x00}, /* x_addr_start[7:0] */ - {IMX_8BIT, 0x0346, 0x00}, /* y_addr_start[15:8] */ - {IMX_8BIT, 0x0347, 0x00}, /* y_addr_start[7:0] */ - {IMX_8BIT, 0x0348, 0x0C}, /* x_addr_end[15:8] */ - {IMX_8BIT, 0x0349, 0xCF}, /* x_addr_end[7:0] */ - {IMX_8BIT, 0x034A, 0x09}, /* y_addr_end[15:8] */ - {IMX_8BIT, 0x034B, 0x9F}, /* y_addr_end[7:0] */ - {IMX_8BIT, 0x034C, 0x03}, /* x_output_size[15:8] */ - {IMX_8BIT, 0x034D, 0x34}, /* x_output_size[7:0] */ - {IMX_8BIT, 0x034E, 0x02}, /* y_output_size[15:8] */ - {IMX_8BIT, 0x034F, 0x68}, /* y_output_size[7:0] */ - /* binning & scaling */ - {IMX_8BIT, 0x0390, 0x02}, /* binning mode */ - {IMX_8BIT, 0x0401, 0x00}, /* scaling mode*/ - {IMX_8BIT, 0x0405, 0x10}, /* scale_m[7:0] */ - /* timer */ - {IMX_8BIT, 0x3344, 0x37}, - {IMX_8BIT, 0x3345, 0x1F}, - /* timing */ - {IMX_8BIT, 0x3370, 0x5F}, - {IMX_8BIT, 0x3371, 0x17}, - {IMX_8BIT, 0x3372, 0x37}, - {IMX_8BIT, 0x3373, 0x17}, - {IMX_8BIT, 0x3374, 0x17}, - {IMX_8BIT, 0x3375, 0x0F}, - {IMX_8BIT, 0x3376, 0x57}, - {IMX_8BIT, 0x3377, 0x27}, - {IMX_8BIT, 0x33C8, 0x01}, - {IMX_8BIT, 0x33D4, 0x06}, - {IMX_8BIT, 0x33D5, 0x20}, - {IMX_8BIT, 0x33D6, 0x03}, - {IMX_8BIT, 0x33D7, 0x6C}, - {IMX_TOK_TERM, 0, 0} -}; - -static struct imx_reg const imx_QVGA_strong_dvs_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x0100, 0x00}, /* mode_select */ - /* shutter */ - {IMX_8BIT, 0x0202, 0x05}, /* coarse _integration_time[15:8] */ - {IMX_8BIT, 0x0203, 0x44}, /* coarse _integration_time[7:0] */ - /* pll */ - {IMX_8BIT, 0x0301, 0x05}, /* vt_pix_clk_div[7:0] */ - {IMX_8BIT, 0x0303, 0x01}, /* vt_sys_clk_div[7:0] */ - {IMX_8BIT, 0x0305, 0x06}, /* pre_pll_clk_div[7:0] */ - {IMX_8BIT, 0x0309, 0x05}, /* op_pix_clk_div[7:0] */ - {IMX_8BIT, 0x030B, 0x01}, /* op_sys_clk_div[7:0] */ - {IMX_8BIT, 0x030C, 0x00}, - {IMX_8BIT, 0x030D, 0x6D}, - /* image sizing */ - {IMX_8BIT, 0x0340, 0x05}, /* frame_length_lines[15:8] */ - {IMX_8BIT, 0x0341, 0x48}, /* frame_length_lines[7:0] */ - {IMX_8BIT, 0x0342, 0x0D}, /* line_length_pck[15:8] */ - {IMX_8BIT, 0x0343, 0x70}, /* line_length_pck[7:0] */ - {IMX_8BIT, 0x0344, 0x03}, /* x_addr_start[15:8] */ - {IMX_8BIT, 0x0345, 0x38}, /* x_addr_start[7:0] */ - {IMX_8BIT, 0x0346, 0x02}, /* y_addr_start[15:8] */ - {IMX_8BIT, 0x0347, 0x68}, /* y_addr_start[7:0] */ - {IMX_8BIT, 0x0348, 0x09}, /* x_addr_end[15:8] */ - {IMX_8BIT, 0x0349, 0x97}, /* x_addr_end[7:0] */ - {IMX_8BIT, 0x034A, 0x07}, /* y_addr_end[15:8] */ - {IMX_8BIT, 0x034B, 0x37}, /* y_addr_end[7:0] */ - {IMX_8BIT, 0x034C, 0x01}, /* x_output_size[15:8] */ - {IMX_8BIT, 0x034D, 0x98}, /* x_output_size[7:0] */ - {IMX_8BIT, 0x034E, 0x01}, /* y_output_size[15:8] */ - {IMX_8BIT, 0x034F, 0x34}, /* y_output_size[7:0] */ - /* binning & scaling */ - {IMX_8BIT, 0x0390, 0x02}, /* binning mode */ - {IMX_8BIT, 0x0401, 0x00}, /* scaling mode*/ - {IMX_8BIT, 0x0405, 0x10}, /* scale_m[7:0] */ - /* timer */ - {IMX_8BIT, 0x3344, 0x37}, - {IMX_8BIT, 0x3345, 0x1F}, - /* timing */ - {IMX_8BIT, 0x3370, 0x5F}, - {IMX_8BIT, 0x3371, 0x17}, - {IMX_8BIT, 0x3372, 0x37}, - {IMX_8BIT, 0x3373, 0x17}, - {IMX_8BIT, 0x3374, 0x17}, - {IMX_8BIT, 0x3375, 0x0F}, - {IMX_8BIT, 0x3376, 0x57}, - {IMX_8BIT, 0x3377, 0x27}, - {IMX_8BIT, 0x33C8, 0x01}, - {IMX_8BIT, 0x33D4, 0x01}, - {IMX_8BIT, 0x33D5, 0x98}, - {IMX_8BIT, 0x33D6, 0x01}, - {IMX_8BIT, 0x33D7, 0x34}, - {IMX_TOK_TERM, 0, 0} -}; - -static struct imx_reg const imx_QCIF_strong_dvs_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x0100, 0x00}, /* mode_select */ - /* shutter */ - {IMX_8BIT, 0x0202, 0x05}, /* coarse _integration_time[15:8] */ - {IMX_8BIT, 0x0203, 0x44}, /* coarse _integration_time[7:0] */ - /* pll */ - {IMX_8BIT, 0x0301, 0x05}, /* vt_pix_clk_div[7:0] */ - {IMX_8BIT, 0x0303, 0x01}, /* vt_sys_clk_div[7:0] */ - {IMX_8BIT, 0x0305, 0x06}, /* pre_pll_clk_div[7:0] */ - {IMX_8BIT, 0x0309, 0x05}, /* op_pix_clk_div[7:0] */ - {IMX_8BIT, 0x030B, 0x01}, /* op_sys_clk_div[7:0] */ - {IMX_8BIT, 0x030C, 0x00}, - {IMX_8BIT, 0x030D, 0x6D}, - /* image sizing */ - {IMX_8BIT, 0x0340, 0x05}, /* frame_length_lines[15:8] */ - {IMX_8BIT, 0x0341, 0x48}, /* frame_length_lines[7:0] */ - {IMX_8BIT, 0x0342, 0x0D}, /* line_length_pck[15:8] */ - {IMX_8BIT, 0x0343, 0x70}, /* line_length_pck[7:0] */ - {IMX_8BIT, 0x0344, 0x04}, /* x_addr_start[15:8] */ - {IMX_8BIT, 0x0345, 0xB8}, /* x_addr_start[7:0] */ - {IMX_8BIT, 0x0346, 0x03}, /* y_addr_start[15:8] */ - {IMX_8BIT, 0x0347, 0x70}, /* y_addr_start[7:0] */ - {IMX_8BIT, 0x0348, 0x08}, /* x_addr_end[15:8] */ - {IMX_8BIT, 0x0349, 0x17}, /* x_addr_end[7:0] */ - {IMX_8BIT, 0x034A, 0x06}, /* y_addr_end[15:8] */ - {IMX_8BIT, 0x034B, 0x2F}, /* y_addr_end[7:0] */ - {IMX_8BIT, 0x034C, 0x00}, /* x_output_size[15:8] */ - {IMX_8BIT, 0x034D, 0xD8}, /* x_output_size[7:0] */ - {IMX_8BIT, 0x034E, 0x00}, /* y_output_size[15:8] */ - {IMX_8BIT, 0x034F, 0xB0}, /* y_output_size[7:0] */ - /* binning & scaling */ - {IMX_8BIT, 0x0390, 0x02}, /* binning mode */ - {IMX_8BIT, 0x0401, 0x00}, /* scaling mode*/ - {IMX_8BIT, 0x0405, 0x10}, /* scale_m[7:0] */ - /* timer */ - {IMX_8BIT, 0x3344, 0x37}, - {IMX_8BIT, 0x3345, 0x1F}, - /* timing */ - {IMX_8BIT, 0x3370, 0x5F}, - {IMX_8BIT, 0x3371, 0x17}, - {IMX_8BIT, 0x3372, 0x37}, - {IMX_8BIT, 0x3373, 0x17}, - {IMX_8BIT, 0x3374, 0x17}, - {IMX_8BIT, 0x3375, 0x0F}, - {IMX_8BIT, 0x3376, 0x57}, - {IMX_8BIT, 0x3377, 0x27}, - {IMX_8BIT, 0x33C8, 0x01}, - {IMX_8BIT, 0x33D4, 0x00}, - {IMX_8BIT, 0x33D5, 0xD8}, - {IMX_8BIT, 0x33D6, 0x00}, - {IMX_8BIT, 0x33D7, 0xB0}, - {IMX_TOK_TERM, 0, 0} -}; - -static struct imx_reg const imx175_init_settings[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x0103, 0x01}, - /* misc control */ - {IMX_8BIT, 0x3020, 0x10}, - {IMX_8BIT, 0x302D, 0x02}, - {IMX_8BIT, 0x302F, 0x80}, - {IMX_8BIT, 0x3032, 0xA3}, - {IMX_8BIT, 0x3033, 0x20}, - {IMX_8BIT, 0x3034, 0x24}, - {IMX_8BIT, 0x3041, 0x15}, - {IMX_8BIT, 0x3042, 0x87}, - {IMX_8BIT, 0x3050, 0x35}, - {IMX_8BIT, 0x3056, 0x57}, - {IMX_8BIT, 0x305D, 0x41}, - {IMX_8BIT, 0x3097, 0x69}, - {IMX_8BIT, 0x3109, 0x41}, - {IMX_8BIT, 0x3148, 0x3F}, - {IMX_8BIT, 0x330F, 0x07}, - /* csi & inck */ - {IMX_8BIT, 0x3364, 0x00}, - {IMX_8BIT, 0x3368, 0x13}, - {IMX_8BIT, 0x3369, 0x33}, - /* znr */ - {IMX_8BIT, 0x4100, 0x0E}, - {IMX_8BIT, 0x4104, 0x32}, - {IMX_8BIT, 0x4105, 0x32}, - {IMX_8BIT, 0x4108, 0x01}, - {IMX_8BIT, 0x4109, 0x7C}, - {IMX_8BIT, 0x410A, 0x00}, - {IMX_8BIT, 0x410B, 0x00}, - GROUPED_PARAMETER_HOLD_DISABLE, - {IMX_TOK_TERM, 0, 0} -}; -/* TODO settings of preview/still/video will be updated with new use case */ -struct imx_resolution imx175_res_preview[] = { - { - .desc = "CIF_strong_dvs_30fps", - .regs = imx_CIF_strong_dvs_30fps, - .width = 368, - .height = 304, - .bin_factor_x = 4, - .bin_factor_y = 4, - .used = 0, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x11DB, - .lines_per_frame = 0x0600, - }, - { - } - }, - .mipi_freq = 261500, - - }, - { - .desc = "VGA_strong_dvs_30fps", - .regs = imx_VGA_strong_dvs_30fps, - .width = 820, - .height = 616, - .bin_factor_x = 4, - .bin_factor_y = 4, - .used = 0, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x11DB, - .lines_per_frame = 0x0600, - }, - { - } - }, - .mipi_freq = 261500, - }, - { - .desc = "WIDE_PREVIEW_30fps", - .regs = imx_WIDE_PREVIEW_30fps, - .width = 1640, - .height = 956, - .bin_factor_x = 2, - .bin_factor_y = 2, - .used = 0, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x1000, - .lines_per_frame = 0x0D70, - }, - { - } - }, - .mipi_freq = 174500, - }, - { - .desc = "STILL_720p_30fps", - .regs = imx_STILL_720p_30fps, - .width = 1568, - .height = 876, - .bin_factor_x = 2, - .bin_factor_y = 2, - .used = 0, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x1428, - .lines_per_frame = 0x0548, - }, - { - } - }, - .mipi_freq = 261500, - }, - { - .desc = "STILL_2M_30fps", - .regs = imx_STILL_2M_30fps, - .width = 1640, - .height = 1232, - .bin_factor_x = 2, - .bin_factor_y = 2, - .used = 0, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x0D66, - .lines_per_frame = 0x09C4, - }, - { - } - }, - .mipi_freq = 320000, - }, - { - .desc = "1080p_strong_dvs_30fps", - .regs = imx_1080p_no_dvs_30fps, - .width = 1940, - .height = 1092, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x0F3C, - .lines_per_frame = 0x07D0, - }, - { - } - }, - .mipi_freq = 292500, - }, - { - .desc = "STILL_3M_30fps", - .regs = imx_STILL_3M_30fps, - .width = 2064, - .height = 1552, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x0D66, - .lines_per_frame = 0x09C4, - }, - { - } - }, - .mipi_freq = 320000, - }, - { - .desc = "STILL_5M_30fps", - .regs = imx_STILL_5M_30fps, - .width = 2576, - .height = 1936, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x0D66, - .lines_per_frame = 0x09C4, - }, - { - } - }, - .mipi_freq = 320000, - }, - { - .desc = "STILL_6M_30fps", - .regs = imx_STILL_6M_30fps, - .width = 3280, - .height = 1852, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x0D66, - .lines_per_frame = 0x09C4, - }, - { - } - }, - .mipi_freq = 320000, - }, - { - .desc = "STILL_8M_30fps", - .regs = imx_STILL_8M_30fps, - .width = 3280, - .height = 2464, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x0D66, - .lines_per_frame = 0x09C4, - }, - { - } - }, - .mipi_freq = 320000, - }, -}; - -struct imx_resolution imx175_res_still[] = { - { - .desc = "CIF_strong_dvs_30fps", - .regs = imx_CIF_strong_dvs_30fps, - .width = 368, - .height = 304, - .bin_factor_x = 4, - .bin_factor_y = 4, - .used = 0, - .fps_options = { - { - .fps = 15, - .pixels_per_line = 0x11DB, - .lines_per_frame = 0x0600, - }, - { - } - }, - .mipi_freq = 261000, - }, - { - .desc = "VGA_strong_dvs_15fps", - .regs = imx_VGA_strong_dvs_15fps, - .width = 820, - .height = 616, - .bin_factor_x = 4, - .bin_factor_y = 4, - .used = 0, - .fps_options = { - { - .fps = 15, - .pixels_per_line = 0x1C86, - .lines_per_frame = 0x079E, - }, - { - } - }, - .mipi_freq = 261500, - }, - { - .desc = "imx_STILL_720p_15fps", - .regs = imx_STILL_720p_15fps, - .width = 1568, - .height = 876, - .bin_factor_x = 2, - .bin_factor_y = 2, - .used = 0, - .fps_options = { - { - .fps = 15, - .pixels_per_line = 0x1838, - .lines_per_frame = 0x08CA, - }, - { - } - }, - .mipi_freq = 261500, - }, - { - .desc = "STILL_2M_15fps", - .regs = imx_STILL_2M_15fps, - .width = 1640, - .height = 1232, - .bin_factor_x = 2, - .bin_factor_y = 2, - .used = 0, - .fps_options = { - { - .fps = 15, - .pixels_per_line = 0x1646, - .lines_per_frame = 0x0BB8, - }, - { - } - }, - .mipi_freq = 320000, - }, - { - .desc = "1080p_strong_dvs_15fps", - .regs = imx_1080p_no_dvs_15fps, - .width = 1940, - .height = 1092, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - .fps_options = { - { - .fps = 15, - .pixels_per_line = 0x189C, - .lines_per_frame = 0x09A6, - }, - { - } - }, - .mipi_freq = 292500, - }, - { - .desc = "STILL_3M_15fps", - .regs = imx_STILL_3M_15fps, - .width = 2064, - .height = 1552, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - .fps_options = { - { - .fps = 15, - .pixels_per_line = 0x1646, - .lines_per_frame = 0x0BB8, - }, - { - } - }, - .mipi_freq = 320000, - }, - { - .desc = "STILL_5M_15fps", - .regs = imx_STILL_5M_15fps, - .width = 2576, - .height = 1936, - .fps = 15, - .pixels_per_line = 0x1646, /* consistent with regs arrays */ - .lines_per_frame = 0x0BB8, /* consistent with regs arrays */ - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - .fps_options = { - { - .fps = 15, - .pixels_per_line = 0x1646, - .lines_per_frame = 0x0BB8, - }, - { - } - }, - .mipi_freq = 320000, - }, - { - .desc = "STILL_6M_15fps", - .regs = imx_STILL_6M_15fps, - .width = 3280, - .height = 1852, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - .fps_options = { - { - .fps = 15, - .pixels_per_line = 0x1646, - .lines_per_frame = 0x0BB8, - }, - { - } - }, - .mipi_freq = 320000, - }, - { - .desc = "STILL_8M_15fps", - .regs = imx_STILL_8M_15fps, - .width = 3280, - .height = 2464, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - .fps_options = { - { - .fps = 15, - .pixels_per_line = 0x1646, - .lines_per_frame = 0x0BB8, - }, - { - } - }, - .mipi_freq = 320000, - }, -}; - -struct imx_resolution imx175_res_video[] = { - { - .desc = "QCIF_strong_dvs_30fps", - .regs = imx_QCIF_strong_dvs_30fps, - .width = 216, - .height = 176, - .bin_factor_x = 4, - .bin_factor_y = 4, - .used = 0, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x0D70, - .lines_per_frame = 0x0548, - }, - { - } - }, - .mipi_freq = 174500, - }, - { - .desc = "QVGA_strong_dvs_30fps", - .regs = imx_QVGA_strong_dvs_30fps, - .width = 408, - .height = 308, - .bin_factor_x = 4, - .bin_factor_y = 4, - .used = 0, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x0D70, - .lines_per_frame = 0x0548, - }, - { - } - }, - .mipi_freq = 174500, - }, - { - .desc = "VGA_strong_dvs_30fps", - .regs = imx_VGA_strong_dvs_30fps, - .width = 820, - .height = 616, - .bin_factor_x = 4, - .bin_factor_y = 4, - .used = 0, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x1194, - .lines_per_frame = 0x0600, - }, - { - } - }, - .mipi_freq = 261500, - }, - { - .desc = "720p_strong_dvs_30fps", - .regs = imx_720p_strong_dvs_30fps, - .width = 1552, - .height = 880, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x139C, - .lines_per_frame = 0x0600, - }, - { - .fps = 60, - .pixels_per_line = 0xD70, - .lines_per_frame = 0x444, - }, - { - } - }, - .mipi_freq = 292500, - }, - { - .desc = "480p_strong_dvs_30fps", - .regs = imx_480p_strong_dvs_30fps, - .width = 880, - .height = 592, - .bin_factor_x = 2, - .bin_factor_y = 2, - .used = 0, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x139C, - .lines_per_frame = 0x0600, - }, - { - } - }, - .mipi_freq = 292500, - }, - { - .desc = "WVGA_strong_dvs_30fps", - .regs = imx_WVGA_strong_dvs_30fps, - .width = 1640, - .height = 1024, - .bin_factor_x = 2, - .bin_factor_y = 2, - .used = 0, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x139C, - .lines_per_frame = 0x0600, - }, - { - } - }, - .mipi_freq = 292500, - }, - { - .desc = "1080p_strong_dvs_30fps", - .regs = imx_1080p_strong_dvs_30fps, - .width = 2320, - .height = 1312, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x11C6, - .lines_per_frame = 0x06A4, - }, - { - } - }, - .mipi_freq = 292500, - }, -}; - -#endif diff --git a/drivers/staging/media/atomisp/i2c/imx/imx208.h b/drivers/staging/media/atomisp/i2c/imx/imx208.h deleted file mode 100644 index fed387f42f99..000000000000 --- a/drivers/staging/media/atomisp/i2c/imx/imx208.h +++ /dev/null @@ -1,550 +0,0 @@ -/* - * Support for Sony IMX camera sensor. - * - * Copyright (c) 2014 Intel Corporation. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. - * - */ - -#ifndef __IMX208_H__ -#define __IMX208_H__ -#include "common.h" - -/********************** settings for imx from vendor*********************/ -static struct imx_reg imx208_1080p_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x0305, 0x02}, /* PREPLLCK DIV */ - {IMX_8BIT, 0x0307, 0x54}, /* PLL MPY */ - {IMX_8BIT, 0x303C, 0x3C}, /* PLL oscillation stable wait time */ - {IMX_8BIT, 0x30A4, 0x02}, /* Default */ - {IMX_8BIT, 0x0112, 0x0A}, /* CCP_data_format : RAW 10bit */ - {IMX_8BIT, 0x0113, 0x0A}, /* CCP_data_format : RAW 10bit */ - {IMX_8BIT, 0x0340, 0x04}, /* frame length line [15:8] */ - {IMX_8BIT, 0x0341, 0xAA}, /* frame length line [7:0] */ - {IMX_8BIT, 0x0342, 0x08}, /* line length pck [15:8] */ - {IMX_8BIT, 0x0343, 0xC8}, /* line length pck [7:0] */ - {IMX_8BIT, 0x0344, 0x00}, /* x_addr_start[12:8] */ - {IMX_8BIT, 0x0345, 0x00}, /* x_addr_start[7:0] */ - {IMX_8BIT, 0x0346, 0x00}, /* y_addr_start[12:8] */ - {IMX_8BIT, 0x0347, 0x00}, /* y_addr_start[7:0] */ - {IMX_8BIT, 0x0348, 0x07}, /* x_addr_end [12:8] */ - {IMX_8BIT, 0x0349, 0x8F}, /* x_addr_end [7:0] */ - {IMX_8BIT, 0x034A, 0x04}, /* y_addr_end [12:8] */ - {IMX_8BIT, 0x034B, 0x47}, /* y_addr_end [7:0] */ - {IMX_8BIT, 0x034C, 0x07}, /* x_output_size [ 12:8] */ - {IMX_8BIT, 0x034D, 0x90}, /* x_output_size [7:0] */ - {IMX_8BIT, 0x034E, 0x04}, /* y_output_size [11:8] */ - {IMX_8BIT, 0x034F, 0x48}, /* y_output_size [7:0] */ - {IMX_8BIT, 0x0381, 0x01}, /* x_even_inc */ - {IMX_8BIT, 0x0383, 0x01}, /* x_odd_inc */ - {IMX_8BIT, 0x0385, 0x01}, /* y_even_inc */ - {IMX_8BIT, 0x0387, 0x01}, /* y_odd_inc */ - {IMX_8BIT, 0x3048, 0x00}, /* VMODEFDS binning operation */ - {IMX_8BIT, 0x304E, 0x0A}, /* VTPXCK_DIV */ - {IMX_8BIT, 0x3050, 0x02}, /* OPSYCK_DIV */ - {IMX_8BIT, 0x309B, 0x00}, /* RGDAFDSUMEN */ - {IMX_8BIT, 0x30D5, 0x00}, /* HADDEN ( binning ) */ - {IMX_8BIT, 0x3301, 0x01}, /* RGLANESEL */ - {IMX_8BIT, 0x3318, 0x61}, /* MIPI Global Timing */ - {IMX_8BIT, 0x0202, 0x01}, /* coarse integration time */ - {IMX_8BIT, 0x0203, 0x90}, /* coarse integration time */ - {IMX_8BIT, 0x0205, 0x00}, /* ana global gain */ - - {IMX_TOK_TERM, 0, 0}, -}; - -static struct imx_reg imx208_1296x736_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x0305, 0x02}, /* PREPLLCK DIV */ - {IMX_8BIT, 0x0307, 0x54}, /* PLL MPY */ - {IMX_8BIT, 0x303C, 0x3C}, /* PLL oscillation stable wait time */ - {IMX_8BIT, 0x30A4, 0x02}, /* Default */ - {IMX_8BIT, 0x0112, 0x0A}, /* CCP_data_format : RAW 10bit */ - {IMX_8BIT, 0x0113, 0x0A}, /* CCP_data_format : RAW 10bit */ - {IMX_8BIT, 0x0340, 0x04}, /* frame length line [15:8] */ - {IMX_8BIT, 0x0341, 0xAA}, /* frame length line [7:0] */ - {IMX_8BIT, 0x0342, 0x08}, /* line length pck [15:8] */ - {IMX_8BIT, 0x0343, 0xC8}, /* line length pck [7:0] */ - {IMX_8BIT, 0x0344, 0x01}, /* x_addr_start[12:8] */ - {IMX_8BIT, 0x0345, 0x40}, /* x_addr_start[7:0] */ - {IMX_8BIT, 0x0346, 0x00}, /* y_addr_start[12:8] */ - {IMX_8BIT, 0x0347, 0xB4}, /* y_addr_start[7:0] */ - {IMX_8BIT, 0x0348, 0x06}, /* x_addr_end [12:8] */ - {IMX_8BIT, 0x0349, 0x4F}, /* x_addr_end [7:0] */ - {IMX_8BIT, 0x034A, 0x03}, /* y_addr_end [12:8] */ - {IMX_8BIT, 0x034B, 0x93}, /* y_addr_end [7:0] */ - {IMX_8BIT, 0x034C, 0x05}, /* x_output_size [ 12:8] */ - {IMX_8BIT, 0x034D, 0x10}, /* x_output_size [7:0] */ - {IMX_8BIT, 0x034E, 0x02}, /* y_output_size [11:8] */ - {IMX_8BIT, 0x034F, 0xE0}, /* y_output_size [7:0] */ - {IMX_8BIT, 0x0381, 0x01}, /* x_even_inc */ - {IMX_8BIT, 0x0383, 0x01}, /* x_odd_inc */ - {IMX_8BIT, 0x0385, 0x01}, /* y_even_inc */ - {IMX_8BIT, 0x0387, 0x01}, /* y_odd_inc */ - {IMX_8BIT, 0x3048, 0x00}, /* VMODEFDS binning operation */ - {IMX_8BIT, 0x304E, 0x0A}, /* VTPXCK_DIV */ - {IMX_8BIT, 0x3050, 0x02}, /* OPSYCK_DIV */ - {IMX_8BIT, 0x309B, 0x00}, /* RGDAFDSUMEN */ - {IMX_8BIT, 0x30D5, 0x00}, /* HADDEN ( binning ) */ - {IMX_8BIT, 0x3301, 0x01}, /* RGLANESEL */ - {IMX_8BIT, 0x3318, 0x61}, /* MIPI Global Timing */ - {IMX_8BIT, 0x0202, 0x01}, /* coarse integration time */ - {IMX_8BIT, 0x0203, 0x90}, /* coarse integration time */ - {IMX_8BIT, 0x0205, 0x00}, /* ana global gain */ - - {IMX_TOK_TERM, 0, 0}, -}; - -static struct imx_reg imx208_1296x976_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x0305, 0x02}, /* PREPLLCK DIV */ - {IMX_8BIT, 0x0307, 0x54}, /* PLL MPY */ - {IMX_8BIT, 0x303C, 0x3C}, /* PLL oscillation stable wait time */ - {IMX_8BIT, 0x30A4, 0x02}, /* Default */ - {IMX_8BIT, 0x0112, 0x0A}, /* CCP_data_format : RAW 10bit */ - {IMX_8BIT, 0x0113, 0x0A}, /* CCP_data_format : RAW 10bit */ - {IMX_8BIT, 0x0340, 0x04}, /* frame length line [15:8] */ - {IMX_8BIT, 0x0341, 0xAA}, /* frame length line [7:0] */ - {IMX_8BIT, 0x0342, 0x08}, /* line length pck [15:8] */ - {IMX_8BIT, 0x0343, 0xC8}, /* line length pck [7:0] */ - {IMX_8BIT, 0x0344, 0x01}, /* x_addr_start[12:8] */ - {IMX_8BIT, 0x0345, 0x40}, /* x_addr_start[7:0] */ - {IMX_8BIT, 0x0346, 0x00}, /* y_addr_start[12:8] */ - {IMX_8BIT, 0x0347, 0x3C}, /* y_addr_start[7:0] */ - {IMX_8BIT, 0x0348, 0x06}, /* x_addr_end [12:8] */ - {IMX_8BIT, 0x0349, 0x4F}, /* x_addr_end [7:0] */ - {IMX_8BIT, 0x034A, 0x04}, /* y_addr_end [12:8] */ - {IMX_8BIT, 0x034B, 0x0B}, /* y_addr_end [7:0] */ - {IMX_8BIT, 0x034C, 0x05}, /* x_output_size [ 12:8] */ - {IMX_8BIT, 0x034D, 0x10}, /* x_output_size [7:0] */ - {IMX_8BIT, 0x034E, 0x03}, /* y_output_size [11:8] */ - {IMX_8BIT, 0x034F, 0xD0}, /* y_output_size [7:0] */ - {IMX_8BIT, 0x0381, 0x01}, /* x_even_inc */ - {IMX_8BIT, 0x0383, 0x01}, /* x_odd_inc */ - {IMX_8BIT, 0x0385, 0x01}, /* y_even_inc */ - {IMX_8BIT, 0x0387, 0x01}, /* y_odd_inc */ - {IMX_8BIT, 0x3048, 0x00}, /* VMODEFDS binning operation */ - {IMX_8BIT, 0x304E, 0x0A}, /* VTPXCK_DIV */ - {IMX_8BIT, 0x3050, 0x02}, /* OPSYCK_DIV */ - {IMX_8BIT, 0x309B, 0x00}, /* RGDAFDSUMEN */ - {IMX_8BIT, 0x30D5, 0x00}, /* HADDEN ( binning ) */ - {IMX_8BIT, 0x3301, 0x01}, /* RGLANESEL */ - {IMX_8BIT, 0x3318, 0x61}, /* MIPI Global Timing */ - {IMX_8BIT, 0x0202, 0x01}, /* coarse integration time */ - {IMX_8BIT, 0x0203, 0x90}, /* coarse integration time */ - {IMX_8BIT, 0x0205, 0x00}, /* ana global gain */ - - {IMX_TOK_TERM, 0, 0}, -}; - -static struct imx_reg imx208_336x256_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x0305, 0x02}, /* PREPLLCK DIV */ - {IMX_8BIT, 0x0307, 0x54}, /* PLL MPY */ - {IMX_8BIT, 0x303C, 0x3C}, /* PLL oscillation stable wait time */ - {IMX_8BIT, 0x30A4, 0x02}, /* Default */ - {IMX_8BIT, 0x0112, 0x0A}, /* CCP_data_format : RAW 10bit */ - {IMX_8BIT, 0x0113, 0x0A}, /* CCP_data_format : RAW 10bit */ - {IMX_8BIT, 0x0340, 0x04}, /* frame length line [15:8] */ - {IMX_8BIT, 0x0341, 0xAA}, /* frame length line [7:0] */ - {IMX_8BIT, 0x0342, 0x08}, /* line length pck [15:8] */ - {IMX_8BIT, 0x0343, 0xC8}, /* line length pck [7:0] */ - {IMX_8BIT, 0x0344, 0x02}, /* x_addr_start[12:8] */ - {IMX_8BIT, 0x0345, 0x78}, /* x_addr_start[7:0] */ - {IMX_8BIT, 0x0346, 0x01}, /* y_addr_start[12:8] */ - {IMX_8BIT, 0x0347, 0x24}, /* y_addr_start[7:0] */ - {IMX_8BIT, 0x0348, 0x05}, /* x_addr_end [12:8] */ - {IMX_8BIT, 0x0349, 0x17}, /* x_addr_end [7:0] */ - {IMX_8BIT, 0x034A, 0x03}, /* y_addr_end [12:8] */ - {IMX_8BIT, 0x034B, 0x23}, /* y_addr_end [7:0] */ - {IMX_8BIT, 0x034C, 0x01}, /* x_output_size [ 12:8] */ - {IMX_8BIT, 0x034D, 0x50}, /* x_output_size [7:0] */ - {IMX_8BIT, 0x034E, 0x01}, /* y_output_size [11:8] */ - {IMX_8BIT, 0x034F, 0x00}, /* y_output_size [7:0] */ - {IMX_8BIT, 0x0381, 0x01}, /* x_even_inc */ - {IMX_8BIT, 0x0383, 0x03}, /* x_odd_inc */ - {IMX_8BIT, 0x0385, 0x01}, /* y_even_inc */ - {IMX_8BIT, 0x0387, 0x03}, /* y_odd_inc */ - {IMX_8BIT, 0x3048, 0x01}, /* VMODEFDS binning operation */ - {IMX_8BIT, 0x304E, 0x0A}, /* VTPXCK_DIV */ - {IMX_8BIT, 0x3050, 0x02}, /* OPSYCK_DIV */ - {IMX_8BIT, 0x309B, 0x00}, /* RGDAFDSUMEN */ - {IMX_8BIT, 0x30D5, 0x03}, /* HADDEN ( binning ) */ - {IMX_8BIT, 0x3301, 0x01}, /* RGLANESEL */ - {IMX_8BIT, 0x3318, 0x66}, /* MIPI Global Timing */ - {IMX_8BIT, 0x0202, 0x01}, /* coarse integration time */ - {IMX_8BIT, 0x0203, 0x90}, /* coarse integration time */ - {IMX_8BIT, 0x0205, 0x00}, /* ana global gain */ - - {IMX_TOK_TERM, 0, 0}, -}; - -static struct imx_reg imx208_192x160_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x0305, 0x02}, /* PREPLLCK DIV */ - {IMX_8BIT, 0x0307, 0x54}, /* PLL MPY */ - {IMX_8BIT, 0x303C, 0x3C}, /* PLL oscillation stable wait time */ - {IMX_8BIT, 0x30A4, 0x02}, /* Default */ - {IMX_8BIT, 0x0112, 0x0A}, /* CCP_data_format : RAW 10bit */ - {IMX_8BIT, 0x0113, 0x0A}, /* CCP_data_format : RAW 10bit */ - {IMX_8BIT, 0x0340, 0x04}, /* frame length line [15:8] */ - {IMX_8BIT, 0x0341, 0xAA}, /* frame length line [7:0] */ - {IMX_8BIT, 0x0342, 0x08}, /* line length pck [15:8] */ - {IMX_8BIT, 0x0343, 0xC8}, /* line length pck [7:0] */ - {IMX_8BIT, 0x0344, 0x02}, /* x_addr_start[12:8] */ - {IMX_8BIT, 0x0345, 0x48}, /* x_addr_start[7:0] */ - {IMX_8BIT, 0x0346, 0x00}, /* y_addr_start[12:8] */ - {IMX_8BIT, 0x0347, 0xE4}, /* y_addr_start[7:0] */ - {IMX_8BIT, 0x0348, 0x05}, /* x_addr_end [12:8] */ - {IMX_8BIT, 0x0349, 0x47}, /* x_addr_end [7:0] */ - {IMX_8BIT, 0x034A, 0x03}, /* y_addr_end [12:8] */ - {IMX_8BIT, 0x034B, 0x63}, /* y_addr_end [7:0] */ - {IMX_8BIT, 0x034C, 0x00}, /* x_output_size [ 12:8] */ - {IMX_8BIT, 0x034D, 0xC0}, /* x_output_size [7:0] */ - {IMX_8BIT, 0x034E, 0x00}, /* y_output_size [11:8] */ - {IMX_8BIT, 0x034F, 0xA0}, /* y_output_size [7:0] */ - {IMX_8BIT, 0x0381, 0x03}, /* x_even_inc */ - {IMX_8BIT, 0x0383, 0x05}, /* x_odd_inc */ - {IMX_8BIT, 0x0385, 0x03}, /* y_even_inc */ - {IMX_8BIT, 0x0387, 0x05}, /* y_odd_inc */ - {IMX_8BIT, 0x3048, 0x01}, /* VMODEFDS binning operation */ - {IMX_8BIT, 0x304E, 0x0A}, /* VTPXCK_DIV */ - {IMX_8BIT, 0x3050, 0x02}, /* OPSYCK_DIV */ - {IMX_8BIT, 0x309B, 0x00}, /* RGDAFDSUMEN */ - {IMX_8BIT, 0x30D5, 0x03}, /* HADDEN ( binning ) */ - {IMX_8BIT, 0x3301, 0x11}, /* RGLANESEL */ - {IMX_8BIT, 0x3318, 0x74}, /* MIPI Global Timing */ - {IMX_8BIT, 0x0202, 0x01}, /* coarse integration time */ - {IMX_8BIT, 0x0203, 0x90}, /* coarse integration time */ - {IMX_8BIT, 0x0205, 0x00}, /* ana global gain */ - - {IMX_TOK_TERM, 0, 0}, -}; -/********************** settings for imx - reference *********************/ -static struct imx_reg const imx208_init_settings[] = { - { IMX_TOK_TERM, 0, 0} -}; - -struct imx_resolution imx208_res_preview[] = { - { - .desc = "imx208_1080p_30fps", - .regs = imx208_1080p_30fps, - .width = 1936, - .height = 1096, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x08C8, - .lines_per_frame = 0x04AA, - }, - { - } - }, - .bin_factor_x = 1, - .bin_factor_y = 1, - .used = 0, - .skip_frames = 2, - .mipi_freq = 403200, - }, - { - .desc = "imx208_1296x976_30fps", - .regs = imx208_1296x976_30fps, - .width = 1296, - .height = 976, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x08C8, - .lines_per_frame = 0x04AA, - }, - { - } - }, - .bin_factor_x = 1, - .bin_factor_y = 1, - .used = 0, - .skip_frames = 2, - .mipi_freq = 403200, - }, - { - .desc = "imx208_1296x736_30fps", - .regs = imx208_1296x736_30fps, - .width = 1296, - .height = 736, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x08C8, - .lines_per_frame = 0x04AA, - }, - { - } - }, - .bin_factor_x = 1, - .bin_factor_y = 1, - .used = 0, - .skip_frames = 2, - .mipi_freq = 403200, - }, - { - .desc = "imx208_336x256_30fps", - .regs = imx208_336x256_30fps, - .width = 336, - .height = 256, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x08C8, - .lines_per_frame = 0x04AA, - }, - { - } - }, - .bin_factor_x = 2, - .bin_factor_y = 2, - .used = 0, - .skip_frames = 2, - .mipi_freq = 201600, - }, - { - .desc = "imx208_192x160_30fps", - .regs = imx208_192x160_30fps, - .width = 192, - .height = 160, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x08C8, - .lines_per_frame = 0x04AA, - }, - { - } - }, - .bin_factor_x = 4, - .bin_factor_y = 4, - .used = 0, - .skip_frames = 2, - .mipi_freq = 100800, - }, -}; - -struct imx_resolution imx208_res_still[] = { - { - .desc = "imx208_1080p_30fps", - .regs = imx208_1080p_30fps, - .width = 1936, - .height = 1096, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x08C8, - .lines_per_frame = 0x04AA, - }, - { - } - }, - .bin_factor_x = 1, - .bin_factor_y = 1, - .used = 0, - .skip_frames = 2, - .mipi_freq = 403200, - }, - { - .desc = "imx208_1296x976_30fps", - .regs = imx208_1296x976_30fps, - .width = 1296, - .height = 976, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x08C8, - .lines_per_frame = 0x04AA, - }, - { - } - }, - .bin_factor_x = 1, - .bin_factor_y = 1, - .used = 0, - .skip_frames = 2, - .mipi_freq = 403200, - }, - { - .desc = "imx208_1296x736_30fps", - .regs = imx208_1296x736_30fps, - .width = 1296, - .height = 736, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x08C8, - .lines_per_frame = 0x04AA, - }, - { - } - }, - .bin_factor_x = 1, - .bin_factor_y = 1, - .used = 0, - .skip_frames = 2, - .mipi_freq = 403200, - }, - { - .desc = "imx208_336x256_30fps", - .regs = imx208_336x256_30fps, - .width = 336, - .height = 256, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x08C8, - .lines_per_frame = 0x04AA, - }, - { - } - }, - .bin_factor_x = 2, - .bin_factor_y = 2, - .used = 0, - .skip_frames = 2, - .mipi_freq = 201600, - }, - { - .desc = "imx208_192x160_30fps", - .regs = imx208_192x160_30fps, - .width = 192, - .height = 160, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x08C8, - .lines_per_frame = 0x04AA, - }, - { - } - }, - .bin_factor_x = 4, - .bin_factor_y = 4, - .used = 0, - .skip_frames = 2, - .mipi_freq = 100800, - }, -}; - -struct imx_resolution imx208_res_video[] = { - { - .desc = "imx208_1080p_30fps", - .regs = imx208_1080p_30fps, - .width = 1936, - .height = 1096, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x08C8, - .lines_per_frame = 0x04AA, - }, - { - } - }, - .bin_factor_x = 1, - .bin_factor_y = 1, - .used = 0, - .skip_frames = 2, - .mipi_freq = 403200, - }, - { - .desc = "imx208_1296x976_30fps", - .regs = imx208_1296x976_30fps, - .width = 1296, - .height = 976, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x08C8, - .lines_per_frame = 0x04AA, - }, - { - } - }, - .bin_factor_x = 1, - .bin_factor_y = 1, - .used = 0, - .skip_frames = 2, - .mipi_freq = 403200, - }, - { - .desc = "imx208_1296x736_30fps", - .regs = imx208_1296x736_30fps, - .width = 1296, - .height = 736, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x08C8, - .lines_per_frame = 0x04AA, - }, - { - } - }, - .bin_factor_x = 1, - .bin_factor_y = 1, - .used = 0, - .skip_frames = 2, - .mipi_freq = 403200, - }, - { - .desc = "imx208_336x256_30fps", - .regs = imx208_336x256_30fps, - .width = 336, - .height = 256, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x08C8, - .lines_per_frame = 0x04AA, - }, - { - } - }, - .bin_factor_x = 2, - .bin_factor_y = 2, - .used = 0, - .skip_frames = 2, - .mipi_freq = 201600, - }, - { - .desc = "imx208_192x160_30fps", - .regs = imx208_192x160_30fps, - .width = 192, - .height = 160, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x08C8, - .lines_per_frame = 0x04AA, - }, - { - } - }, - .bin_factor_x = 4, - .bin_factor_y = 4, - .used = 0, - .skip_frames = 2, - .mipi_freq = 100800, - }, -}; -#endif - diff --git a/drivers/staging/media/atomisp/i2c/imx/imx219.h b/drivers/staging/media/atomisp/i2c/imx/imx219.h deleted file mode 100644 index bbd515bf7279..000000000000 --- a/drivers/staging/media/atomisp/i2c/imx/imx219.h +++ /dev/null @@ -1,228 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __IMX219_H__ -#define __IMX219_H__ -#include "common.h" - -#define IMX219_FRAME_LENGTH_LINES 0x0160 -#define IMX219_LINE_LENGTH_PIXELS 0x0162 -#define IMX219_HORIZONTAL_START_H 0x0164 -#define IMX219_VERTICAL_START_H 0x0168 -#define IMX219_HORIZONTAL_END_H 0x0166 -#define IMX219_VERTICAL_END_H 0x016A -#define IMX219_HORIZONTAL_OUTPUT_SIZE_H 0x016c -#define IMX219_VERTICAL_OUTPUT_SIZE_H 0x016E -#define IMX219_COARSE_INTEGRATION_TIME 0x015A -#define IMX219_IMG_ORIENTATION 0x0172 -#define IMX219_GLOBAL_GAIN 0x0157 -#define IMX219_DGC_ADJ 0x0158 - -#define IMX219_DGC_LEN 4 - -/************************** settings for imx *************************/ -static struct imx_reg const imx219_STILL_8M_30fps[] = { - {IMX_8BIT, 0x30EB, 0x05}, /*Access Code for address over 0x3000*/ - {IMX_8BIT, 0x30EB, 0x0C}, /*Access Code for address over 0x3000*/ - {IMX_8BIT, 0x300A, 0xFF}, /*Access Code for address over 0x3000*/ - {IMX_8BIT, 0x300B, 0xFF}, /*Access Code for address over 0x3000*/ - {IMX_8BIT, 0x30EB, 0x05}, /*Access Code for address over 0x3000*/ - {IMX_8BIT, 0x30EB, 0x09}, /*Access Code for address over 0x3000*/ - {IMX_8BIT, 0x0114, 0x03}, /*CSI_LANE_MODE[1:0}*/ - {IMX_8BIT, 0x0128, 0x00}, /*DPHY_CNTRL*/ - {IMX_8BIT, 0x012A, 0x13}, /*EXCK_FREQ[15:8]*/ - {IMX_8BIT, 0x012B, 0x34}, /*EXCK_FREQ[7:0]*/ - {IMX_8BIT, 0x0160, 0x0A}, /*FRM_LENGTH_A[15:8]*/ - {IMX_8BIT, 0x0161, 0x94}, /*FRM_LENGTH_A[7:0]*/ - {IMX_8BIT, 0x0162, 0x0D}, /*LINE_LENGTH_A[15:8]*/ - {IMX_8BIT, 0x0163, 0x78}, /*LINE_LENGTH_A[7:0]*/ - {IMX_8BIT, 0x0164, 0x00}, /*X_ADD_STA_A[11:8]*/ - {IMX_8BIT, 0x0165, 0x00}, /*X_ADD_STA_A[7:0]*/ - {IMX_8BIT, 0x0166, 0x0C}, /*X_ADD_END_A[11:8]*/ - {IMX_8BIT, 0x0167, 0xCF}, /*X_ADD_END_A[7:0]*/ - {IMX_8BIT, 0x0168, 0x00}, /*Y_ADD_STA_A[11:8]*/ - {IMX_8BIT, 0x0169, 0x00}, /*Y_ADD_STA_A[7:0]*/ - {IMX_8BIT, 0x016A, 0x09}, /*Y_ADD_END_A[11:8]*/ - {IMX_8BIT, 0x016B, 0x9F}, /*Y_ADD_END_A[7:0]*/ - {IMX_8BIT, 0x016C, 0x0C}, /*X_OUTPUT_SIZE_A[11:8]*/ - {IMX_8BIT, 0x016D, 0xD0}, /*X_OUTPUT_SIZE_A[7:0]*/ - {IMX_8BIT, 0x016E, 0x09}, /*Y_OUTPUT_SIZE_A[11:8]*/ - {IMX_8BIT, 0x016F, 0xA0}, /*Y_OUTPUT_SIZE_A[7:0]*/ - {IMX_8BIT, 0x0170, 0x01}, /*X_ODD_INC_A[2:0]*/ - {IMX_8BIT, 0x0171, 0x01}, /*Y_ODD_INC_A[2:0]*/ - {IMX_8BIT, 0x0174, 0x00}, /*BINNING_MODE_H_A*/ - {IMX_8BIT, 0x0175, 0x00}, /*BINNING_MODE_V_A*/ - {IMX_8BIT, 0x018C, 0x0A}, /*CSI_DATA_FORMAT_A[15:8]*/ - {IMX_8BIT, 0x018D, 0x0A}, /*CSI_DATA_FORMAT_A[7:0]*/ - {IMX_8BIT, 0x0301, 0x05}, /*VTPXCK_DIV*/ - {IMX_8BIT, 0x0303, 0x01}, /*VTSYCK_DIV*/ - {IMX_8BIT, 0x0304, 0x02}, /*PREPLLCK_VT_DIV[3:0]*/ - {IMX_8BIT, 0x0305, 0x02}, /*PREPLLCK_OP_DIV[3:0]*/ - {IMX_8BIT, 0x0306, 0x00}, /*PLL_VT_MPY[10:8]*/ - {IMX_8BIT, 0x0307, 0x49}, /*PLL_VT_MPY[7:0]*/ - {IMX_8BIT, 0x0309, 0x0A}, /*OPPXCK_DIV[4:0]*/ - {IMX_8BIT, 0x030B, 0x01}, /*OPSYCK_DIV*/ - {IMX_8BIT, 0x030C, 0x00}, /*PLL_OP_MPY[10:8]*/ - {IMX_8BIT, 0x030D, 0x4C}, /*PLL_OP_MPY[7:0]*/ - {IMX_8BIT, 0x4767, 0x0F}, /*CIS Tuning*/ - {IMX_8BIT, 0x4750, 0x14}, /*CIS Tuning*/ - {IMX_8BIT, 0x47B4, 0x14}, /*CIS Tuning*/ - {IMX_TOK_TERM, 0, 0} -}; - -static struct imx_reg const imx219_STILL_6M_30fps[] = { - {IMX_8BIT, 0x30EB, 0x05}, /*Access Code for address over 0x3000*/ - {IMX_8BIT, 0x30EB, 0x0C}, /*Access Code for address over 0x3000*/ - {IMX_8BIT, 0x300A, 0xFF}, /*Access Code for address over 0x3000*/ - {IMX_8BIT, 0x300B, 0xFF}, /*Access Code for address over 0x3000*/ - {IMX_8BIT, 0x30EB, 0x05}, /*Access Code for address over 0x3000*/ - {IMX_8BIT, 0x30EB, 0x09}, /*Access Code for address over 0x3000*/ - {IMX_8BIT, 0x0114, 0x03}, /*CSI_LANE_MODE[1:0}*/ - {IMX_8BIT, 0x0128, 0x00}, /*DPHY_CNTRL*/ - {IMX_8BIT, 0x012A, 0x13}, /*EXCK_FREQ[15:8]*/ - {IMX_8BIT, 0x012B, 0x34}, /*EXCK_FREQ[7:0]*/ - {IMX_8BIT, 0x0160, 0x07}, /*FRM_LENGTH_A[15:8]*/ - {IMX_8BIT, 0x0161, 0x64}, /*FRM_LENGTH_A[7:0]*/ - {IMX_8BIT, 0x0162, 0x0D}, /*LINE_LENGTH_A[15:8]*/ - {IMX_8BIT, 0x0163, 0x78}, /*LINE_LENGTH_A[7:0]*/ - {IMX_8BIT, 0x0164, 0x00}, /*X_ADD_STA_A[11:8]*/ - {IMX_8BIT, 0x0165, 0x00}, /*X_ADD_STA_A[7:0]*/ - {IMX_8BIT, 0x0166, 0x0C}, /*X_ADD_END_A[11:8]*/ - {IMX_8BIT, 0x0167, 0xCF}, /*X_ADD_END_A[7:0]*/ - {IMX_8BIT, 0x0168, 0x01}, /*Y_ADD_STA_A[11:8]*/ - {IMX_8BIT, 0x0169, 0x32}, /*Y_ADD_STA_A[7:0]*/ - {IMX_8BIT, 0x016A, 0x08}, /*Y_ADD_END_A[11:8]*/ - {IMX_8BIT, 0x016B, 0x6D}, /*Y_ADD_END_A[7:0]*/ - {IMX_8BIT, 0x016C, 0x0C}, /*X_OUTPUT_SIZE_A[11:8]*/ - {IMX_8BIT, 0x016D, 0xD0}, /*X_OUTPUT_SIZE_A[7:0]*/ - {IMX_8BIT, 0x016E, 0x07}, /*Y_OUTPUT_SIZE_A[11:8]*/ - {IMX_8BIT, 0x016F, 0x3C}, /*Y_OUTPUT_SIZE_A[7:0]*/ - {IMX_8BIT, 0x0170, 0x01}, /*X_ODD_INC_A[2:0]*/ - {IMX_8BIT, 0x0171, 0x01}, /*Y_ODD_INC_A[2:0]*/ - {IMX_8BIT, 0x0174, 0x00}, /*BINNING_MODE_H_A*/ - {IMX_8BIT, 0x0175, 0x00}, /*BINNING_MODE_V_A*/ - {IMX_8BIT, 0x018C, 0x0A}, /*CSI_DATA_FORMAT_A[15:8]*/ - {IMX_8BIT, 0x018D, 0x0A}, /*CSI_DATA_FORMAT_A[7:0]*/ - {IMX_8BIT, 0x0301, 0x05}, /*VTPXCK_DIV*/ - {IMX_8BIT, 0x0303, 0x01}, /*VTSYCK_DIV*/ - {IMX_8BIT, 0x0304, 0x02}, /*PREPLLCK_VT_DIV[3:0]*/ - {IMX_8BIT, 0x0305, 0x02}, /*PREPLLCK_OP_DIV[3:0]*/ - {IMX_8BIT, 0x0306, 0x00}, /*PLL_VT_MPY[10:8]*/ - {IMX_8BIT, 0x0307, 0x33}, /*PLL_VT_MPY[7:0]*/ - {IMX_8BIT, 0x0309, 0x0A}, /*OPPXCK_DIV[4:0]*/ - {IMX_8BIT, 0x030B, 0x01}, /*OPSYCK_DIV*/ - {IMX_8BIT, 0x030C, 0x00}, /*PLL_OP_MPY[10:8]*/ - {IMX_8BIT, 0x030D, 0x36}, /*PLL_OP_MPY[7:0]*/ - {IMX_8BIT, 0x4767, 0x0F}, /*CIS Tuning*/ - {IMX_8BIT, 0x4750, 0x14}, /*CIS Tuning*/ - {IMX_8BIT, 0x47B4, 0x14}, /*CIS Tuning*/ - {IMX_TOK_TERM, 0, 0} -}; - -static struct imx_reg const imx219_init_settings[] = { - {IMX_TOK_TERM, 0, 0} -}; - -struct imx_resolution imx219_res_preview[] = { - { - .desc = "STILL_6M_30fps", - .regs = imx219_STILL_6M_30fps, - .width = 3280, - .height = 1852, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x0D78, - .lines_per_frame = 0x0764, - }, - { - } - }, - .mipi_freq = 259000, - }, - { - .desc = "STILL_8M_30fps", - .regs = imx219_STILL_8M_30fps, - .width = 3280, - .height = 2464, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x0D78, - .lines_per_frame = 0x0A94, - }, - { - } - }, - .mipi_freq = 365000, - }, -}; - -struct imx_resolution imx219_res_still[] = { - { - .desc = "STILL_6M_30fps", - .regs = imx219_STILL_6M_30fps, - .width = 3280, - .height = 1852, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x0D78, - .lines_per_frame = 0x0764, - }, - { - } - }, - .mipi_freq = 259000, - }, - { - .desc = "STILL_8M_30fps", - .regs = imx219_STILL_8M_30fps, - .width = 3280, - .height = 2464, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x0D78, - .lines_per_frame = 0x0A94, - }, - { - } - }, - .mipi_freq = 365000, - }, -}; - -struct imx_resolution imx219_res_video[] = { - { - .desc = "STILL_6M_30fps", - .regs = imx219_STILL_6M_30fps, - .width = 3280, - .height = 1852, - .bin_factor_x = 0, - .bin_factor_y = 0, - .used = 0, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x0D78, - .lines_per_frame = 0x0764, - }, - { - } - }, - .mipi_freq = 259000, - }, -}; - -#endif diff --git a/drivers/staging/media/atomisp/i2c/imx/imx227.h b/drivers/staging/media/atomisp/i2c/imx/imx227.h deleted file mode 100644 index 795fe017d01b..000000000000 --- a/drivers/staging/media/atomisp/i2c/imx/imx227.h +++ /dev/null @@ -1,727 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __IMX227_H__ -#define __IMX227_H__ - -#include "common.h" - -#define IMX227_EMBEDDED_DATA_LINE_NUM 2 -#define IMX227_OUTPUT_DATA_FORMAT_REG 0x0112 -#define IMX227_OUTPUT_FORMAT_RAW10 0x0a0a - -/* AE Bracketing Registers */ -#define IMX227_BRACKETING_LUT_MODE_BIT_CONTINUE_STREAMING 0x1 -#define IMX227_BRACKETING_LUT_MODE_BIT_LOOP_MODE 0x2 - -#define IMX227_BRACKETING_LUT_CONTROL 0x0E00 -#define IMX227_BRACKETING_LUT_MODE 0x0E01 -#define IMX227_BRACKETING_LUT_ENTRY_CONTROL 0x0E02 - -/* - * The imx135 embedded data info: - * embedded data line num: 2 - * line 0 effective data size(byte): 76 - * line 1 effective data size(byte): 113 - */ -static const uint32_t -imx227_embedded_effective_size[IMX227_EMBEDDED_DATA_LINE_NUM] = {160, 62}; - -/************************** settings for imx *************************/ -/* Full Output Mode */ -static struct imx_reg const imx_STILL_6_5M_25fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x6259, 0x06}, /* latency ctrl */ - {IMX_8BIT, 0x9004, 0xd0}, /* preset_sel */ - {IMX_8BIT, 0x9005, 0x3f}, /* preset_en */ - {IMX_8BIT, 0x0136, 0x13}, - {IMX_8BIT, 0x0137, 0x33}, - {IMX_TOK_TERM, 0, 0} -}; - -/* 4:3 Output Mode */ -static struct imx_reg const imx_STILL_5_5M_3X4_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x0344, 0x00}, - {IMX_8BIT, 0x0345, 0xb0}, - {IMX_8BIT, 0x0346, 0x00}, - {IMX_8BIT, 0x0347, 0x00}, - {IMX_8BIT, 0x0348, 0x08}, - {IMX_8BIT, 0x0349, 0xaf}, - {IMX_8BIT, 0x034a, 0x0a}, - {IMX_8BIT, 0x034b, 0x9f}, - {IMX_8BIT, 0x034c, 0x08}, - {IMX_8BIT, 0x034d, 0x00}, - {IMX_8BIT, 0x034e, 0x0a}, - {IMX_8BIT, 0x034f, 0xa0}, - - {IMX_8BIT, 0x6259, 0x05}, /* latency ctrl */ - {IMX_8BIT, 0x9004, 0xd8}, /* preset_sel */ - {IMX_8BIT, 0x9005, 0x3f}, /* preset_en */ - {IMX_8BIT, 0x0136, 0x13}, - {IMX_8BIT, 0x0137, 0x33}, - {IMX_TOK_TERM, 0, 0} -}; - -/* Square Output Mode */ -static struct imx_reg const imx_STILL_5_7M_1X1_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x0344, 0x00}, - {IMX_8BIT, 0x0345, 0x00}, - {IMX_8BIT, 0x0346, 0x00}, - {IMX_8BIT, 0x0347, 0xa0}, - {IMX_8BIT, 0x0348, 0x09}, - {IMX_8BIT, 0x0349, 0x5f}, - {IMX_8BIT, 0x034a, 0x09}, - {IMX_8BIT, 0x034b, 0xff}, - {IMX_8BIT, 0x034c, 0x09}, - {IMX_8BIT, 0x034d, 0x60}, - {IMX_8BIT, 0x034e, 0x09}, - {IMX_8BIT, 0x034f, 0x60}, - - {IMX_8BIT, 0x6259, 0x06}, /* latency ctrl */ - {IMX_8BIT, 0x9004, 0xd4}, /* preset_sel */ - {IMX_8BIT, 0x9005, 0x3f}, /* preset_en */ - {IMX_8BIT, 0x0136, 0x13}, - {IMX_8BIT, 0x0137, 0x33}, - {IMX_TOK_TERM, 0, 0} -}; - -/* Full Frame 1080P Mode (use ISP scaler)*/ -static struct imx_reg const imx_VIDEO_4M_9X16_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x6259, 0x05}, /* latency ctrl */ - {IMX_8BIT, 0x9004, 0xdc}, /* preset_sel */ - {IMX_8BIT, 0x9005, 0x3f}, /* preset_en */ - {IMX_8BIT, 0x0136, 0x13}, - {IMX_8BIT, 0x0137, 0x33}, - {IMX_TOK_TERM, 0, 0} -}; - -/* Cropped 1080P Mode */ -static struct imx_reg const imx_VIDEO_2M_9X16_45fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x0112, 0x0a}, - {IMX_8BIT, 0x0113, 0x0a}, - {IMX_8BIT, 0x0344, 0x02}, - {IMX_8BIT, 0x0345, 0x8a}, - {IMX_8BIT, 0x0346, 0x01}, - {IMX_8BIT, 0x0347, 0x88}, - {IMX_8BIT, 0x0348, 0x06}, - {IMX_8BIT, 0x0349, 0xd1}, - {IMX_8BIT, 0x034a, 0x09}, - {IMX_8BIT, 0x034b, 0x17}, - {IMX_8BIT, 0x034c, 0x04}, - {IMX_8BIT, 0x034d, 0x48}, - {IMX_8BIT, 0x034e, 0x07}, - {IMX_8BIT, 0x034f, 0x90}, - - {IMX_8BIT, 0x0380, 0x00}, - {IMX_8BIT, 0x0381, 0x01}, - {IMX_8BIT, 0x0382, 0x00}, - {IMX_8BIT, 0x0383, 0x01}, - {IMX_8BIT, 0x0384, 0x00}, - {IMX_8BIT, 0x0385, 0x01}, - {IMX_8BIT, 0x0386, 0x00}, - {IMX_8BIT, 0x0387, 0x01}, - - {IMX_8BIT, 0x0408, 0x00}, - {IMX_8BIT, 0x0409, 0x00}, - {IMX_8BIT, 0x040a, 0x00}, - {IMX_8BIT, 0x040b, 0x00}, - {IMX_8BIT, 0x040c, 0x04}, - {IMX_8BIT, 0x040d, 0x48}, - {IMX_8BIT, 0x040e, 0x07}, - {IMX_8BIT, 0x040f, 0x90}, - - {IMX_8BIT, 0x0900, 0x00}, - {IMX_8BIT, 0x0901, 0x00}, - - {IMX_8BIT, 0x6259, 0x05}, /* latency ctrl */ - {IMX_8BIT, 0x9004, 0xdc}, /* preset_sel */ - {IMX_8BIT, 0x9005, 0x3c}, /* preset_en */ - - {IMX_8BIT, 0x0136, 0x13}, - {IMX_8BIT, 0x0137, 0x33}, - {IMX_TOK_TERM, 0, 0} -}; - -/* Moment mode */ -static struct imx_reg const imx_VIDEO_1_3M_3X4_60fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x6259, 0x05}, /* latency ctrl */ - {IMX_8BIT, 0x9004, 0xd9}, /* preset_sel */ - {IMX_8BIT, 0x9005, 0x3f}, /* preset_en */ - {IMX_8BIT, 0x0136, 0x13}, - {IMX_8BIT, 0x0137, 0x33}, - {IMX_TOK_TERM, 0, 0} -}; - -/* High Speed 3:4 mode */ -static struct imx_reg const imx_VIDEO_VGA_3X4_120fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x9004, 0xca}, /* preset_sel */ - {IMX_8BIT, 0x9005, 0x3f}, /* preset_en */ - {IMX_8BIT, 0x0136, 0x13}, - {IMX_8BIT, 0x0137, 0x33}, - {IMX_TOK_TERM, 0, 0} -}; - - -/* Binned 720P mode */ -static struct imx_reg const imx_VIDEO_1M_9X16_60fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x0112, 0x0a}, - {IMX_8BIT, 0x0113, 0x0a}, - {IMX_8BIT, 0x0344, 0x01}, - {IMX_8BIT, 0x0345, 0xd0}, - {IMX_8BIT, 0x0346, 0x00}, - {IMX_8BIT, 0x0347, 0x40}, - {IMX_8BIT, 0x0348, 0x07}, - {IMX_8BIT, 0x0349, 0x8f}, - {IMX_8BIT, 0x034a, 0x0a}, - {IMX_8BIT, 0x034b, 0x5f}, - {IMX_8BIT, 0x034c, 0x02}, - {IMX_8BIT, 0x034d, 0xe0}, - {IMX_8BIT, 0x034e, 0x05}, - {IMX_8BIT, 0x034f, 0x10}, - - {IMX_8BIT, 0x0380, 0x00}, - {IMX_8BIT, 0x0381, 0x01}, - {IMX_8BIT, 0x0382, 0x00}, - {IMX_8BIT, 0x0383, 0x01}, - {IMX_8BIT, 0x0384, 0x00}, - {IMX_8BIT, 0x0385, 0x01}, - {IMX_8BIT, 0x0386, 0x00}, - {IMX_8BIT, 0x0387, 0x01}, - - {IMX_8BIT, 0x0408, 0x00}, - {IMX_8BIT, 0x0409, 0x00}, - {IMX_8BIT, 0x040a, 0x00}, - {IMX_8BIT, 0x040b, 0x00}, - {IMX_8BIT, 0x040c, 0x02}, - {IMX_8BIT, 0x040d, 0xe0}, - {IMX_8BIT, 0x040e, 0x05}, - {IMX_8BIT, 0x040f, 0x10}, - - {IMX_8BIT, 0x0900, 0x01}, - {IMX_8BIT, 0x0901, 0x22}, - - {IMX_8BIT, 0x6259, 0x05}, /* latency ctrl */ - {IMX_8BIT, 0x9004, 0xdd}, /* preset_sel */ - {IMX_8BIT, 0x9005, 0x3c}, /* preset_en */ - {IMX_8BIT, 0x0136, 0x13}, - {IMX_8BIT, 0x0137, 0x33}, - {IMX_TOK_TERM, 0, 0} -}; - -/* Binned 496x868 mode */ -static struct imx_reg const imx_VIDEO_496x868_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x0112, 0x0a}, - {IMX_8BIT, 0x0113, 0x0a}, - {IMX_8BIT, 0x0344, 0x02}, - {IMX_8BIT, 0x0345, 0xc0}, - {IMX_8BIT, 0x0346, 0x01}, - {IMX_8BIT, 0x0347, 0xec}, - {IMX_8BIT, 0x0348, 0x06}, - {IMX_8BIT, 0x0349, 0x9f}, - {IMX_8BIT, 0x034a, 0x08}, - {IMX_8BIT, 0x034b, 0xb3}, - {IMX_8BIT, 0x034c, 0x01}, - {IMX_8BIT, 0x034d, 0xf0}, - {IMX_8BIT, 0x034e, 0x03}, - {IMX_8BIT, 0x034f, 0x64}, - - {IMX_8BIT, 0x0380, 0x00}, - {IMX_8BIT, 0x0381, 0x01}, - {IMX_8BIT, 0x0382, 0x00}, - {IMX_8BIT, 0x0383, 0x01}, - {IMX_8BIT, 0x0384, 0x00}, - {IMX_8BIT, 0x0385, 0x01}, - {IMX_8BIT, 0x0386, 0x00}, - {IMX_8BIT, 0x0387, 0x01}, - - {IMX_8BIT, 0x0408, 0x00}, - {IMX_8BIT, 0x0409, 0x00}, - {IMX_8BIT, 0x040a, 0x00}, - {IMX_8BIT, 0x040b, 0x00}, - {IMX_8BIT, 0x040c, 0x01}, - {IMX_8BIT, 0x040d, 0xf0}, - {IMX_8BIT, 0x040e, 0x03}, - {IMX_8BIT, 0x040f, 0x64}, - - {IMX_8BIT, 0x0900, 0x01}, - {IMX_8BIT, 0x0901, 0x22}, - - {IMX_8BIT, 0x6259, 0x05}, /* latency ctrl */ - {IMX_8BIT, 0x9004, 0xdd}, /* preset_sel */ - {IMX_8BIT, 0x9005, 0x3c}, /* preset_en */ - {IMX_8BIT, 0x0136, 0x13}, - {IMX_8BIT, 0x0137, 0x33}, - {IMX_TOK_TERM, 0, 0} -}; - - -/* Hangout mode */ -static struct imx_reg const imx_PREVIEW_374X652_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x0112, 0x0a}, - {IMX_8BIT, 0x0113, 0x0a}, - {IMX_8BIT, 0x0344, 0x01}, - {IMX_8BIT, 0x0345, 0xc0}, - {IMX_8BIT, 0x0346, 0x00}, - {IMX_8BIT, 0x0347, 0x30}, - {IMX_8BIT, 0x0348, 0x07}, - {IMX_8BIT, 0x0349, 0x9f}, - {IMX_8BIT, 0x034a, 0x0a}, - {IMX_8BIT, 0x034b, 0x6f}, - {IMX_8BIT, 0x034c, 0x01}, - {IMX_8BIT, 0x034d, 0x78}, - {IMX_8BIT, 0x034e, 0x02}, - {IMX_8BIT, 0x034f, 0x90}, - - {IMX_8BIT, 0x0380, 0x00}, - {IMX_8BIT, 0x0381, 0x01}, - {IMX_8BIT, 0x0382, 0x00}, - {IMX_8BIT, 0x0383, 0x03}, - {IMX_8BIT, 0x0384, 0x00}, - {IMX_8BIT, 0x0385, 0x01}, - {IMX_8BIT, 0x0386, 0x00}, - {IMX_8BIT, 0x0387, 0x03}, - - {IMX_8BIT, 0x0408, 0x00}, - {IMX_8BIT, 0x0409, 0x00}, - {IMX_8BIT, 0x040a, 0x00}, - {IMX_8BIT, 0x040b, 0x02}, - {IMX_8BIT, 0x040c, 0x01}, - {IMX_8BIT, 0x040d, 0x76}, - {IMX_8BIT, 0x040e, 0x02}, - {IMX_8BIT, 0x040f, 0x8c}, - - {IMX_8BIT, 0x0900, 0x01}, - {IMX_8BIT, 0x0901, 0x22}, - - {IMX_8BIT, 0x6259, 0x05}, /* latency ctrl */ - {IMX_8BIT, 0x9004, 0xde}, /* preset_sel */ - {IMX_8BIT, 0x9005, 0x3c}, /* preset_en */ - {IMX_8BIT, 0x0136, 0x13}, - {IMX_8BIT, 0x0137, 0x33}, - {IMX_TOK_TERM, 0, 0} -}; - -static struct imx_reg const imx_VIDEO_NHD_9X16_30fps[] = { - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x0112, 0x0a}, - {IMX_8BIT, 0x0113, 0x0a}, - {IMX_8BIT, 0x0344, 0x01}, - {IMX_8BIT, 0x0345, 0xc0}, - {IMX_8BIT, 0x0346, 0x00}, - {IMX_8BIT, 0x0347, 0x30}, - {IMX_8BIT, 0x0348, 0x07}, - {IMX_8BIT, 0x0349, 0x9f}, - {IMX_8BIT, 0x034a, 0x0a}, - {IMX_8BIT, 0x034b, 0x6f}, - {IMX_8BIT, 0x034c, 0x01}, - {IMX_8BIT, 0x034d, 0x78}, - {IMX_8BIT, 0x034e, 0x02}, - {IMX_8BIT, 0x034f, 0x90}, - - {IMX_8BIT, 0x0380, 0x00}, - {IMX_8BIT, 0x0381, 0x01}, - {IMX_8BIT, 0x0382, 0x00}, - {IMX_8BIT, 0x0383, 0x03}, - {IMX_8BIT, 0x0384, 0x00}, - {IMX_8BIT, 0x0385, 0x01}, - {IMX_8BIT, 0x0386, 0x00}, - {IMX_8BIT, 0x0387, 0x03}, - - {IMX_8BIT, 0x0408, 0x00}, - {IMX_8BIT, 0x0409, 0x00}, - {IMX_8BIT, 0x040a, 0x00}, - {IMX_8BIT, 0x040b, 0x00}, - {IMX_8BIT, 0x040c, 0x01}, - {IMX_8BIT, 0x040d, 0x78}, - {IMX_8BIT, 0x040e, 0x02}, - {IMX_8BIT, 0x040f, 0x90}, - - {IMX_8BIT, 0x0900, 0x01}, - {IMX_8BIT, 0x0901, 0x22}, - - {IMX_8BIT, 0x6259, 0x05}, /* latency ctrl */ - {IMX_8BIT, 0x9004, 0xde}, /* preset_sel */ - {IMX_8BIT, 0x9005, 0x3c}, /* preset_en */ - {IMX_8BIT, 0x0136, 0x13}, - {IMX_8BIT, 0x0137, 0x33}, - {IMX_TOK_TERM, 0, 0} -}; - - -static struct imx_reg const imx227_init_settings[] = { - {IMX_8BIT, 0x0100, 0x00}, /* mode_select */ - GROUPED_PARAMETER_HOLD_ENABLE, - {IMX_8BIT, 0x0306, 0x00}, - {IMX_8BIT, 0x0307, 0xBB}, - {IMX_8BIT, 0x030E, 0x03}, - {IMX_8BIT, 0x030F, 0x0D}, - {IMX_8BIT, 0x463b, 0x30}, - {IMX_8BIT, 0x463e, 0x05}, - {IMX_8BIT, 0x4612, 0x66}, - {IMX_8BIT, 0x4815, 0x65}, - {IMX_8BIT, 0x4991, 0x00}, - {IMX_8BIT, 0x4992, 0x01}, - {IMX_8BIT, 0x4993, 0xff}, - {IMX_8BIT, 0x458b, 0x00}, - {IMX_8BIT, 0x452a, 0x02}, - {IMX_8BIT, 0x4a7c, 0x00}, - {IMX_8BIT, 0x4a7d, 0x1c}, - {IMX_8BIT, 0x4a7e, 0x00}, - {IMX_8BIT, 0x4a7f, 0x17}, - {IMX_8BIT, 0x462C, 0x2E}, - {IMX_8BIT, 0x461B, 0x28}, - {IMX_8BIT, 0x4663, 0x29}, - {IMX_8BIT, 0x461A, 0x7C}, - {IMX_8BIT, 0x4619, 0x28}, - {IMX_8BIT, 0x4667, 0x22}, - {IMX_8BIT, 0x466B, 0x23}, - {IMX_8BIT, 0x40AD, 0xFF}, - {IMX_8BIT, 0x40BE, 0x00}, - {IMX_8BIT, 0x40BF, 0x6E}, - {IMX_8BIT, 0x40CE, 0x00}, - {IMX_8BIT, 0x40CF, 0x0A}, - {IMX_8BIT, 0x40CA, 0x00}, - {IMX_8BIT, 0x40CB, 0x1F}, - {IMX_8BIT, 0x4D16, 0x00}, - {IMX_8BIT, 0x6204, 0x01}, - {IMX_8BIT, 0x6209, 0x00}, - {IMX_8BIT, 0x621F, 0x01}, - {IMX_8BIT, 0x621E, 0x10}, - GROUPED_PARAMETER_HOLD_DISABLE, - {IMX_TOK_TERM, 0, 0} -}; - -/* TODO settings of preview/still/video will be updated with new use case */ -struct imx_resolution imx227_res_preview[] = { - { - .desc = "imx_PREVIEW_374X652_30fps", - .regs = imx_PREVIEW_374X652_30fps, - .width = 374, - .height = 652, - .bin_factor_x = 2, - .bin_factor_y = 2, - .mipi_freq = 499000, - .used = 0, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x0E70, - .lines_per_frame = 0x0C0A, - }, - { - } - }, - }, - { - .desc = "imx_VIDEO_496x868_30fps", - .regs = imx_VIDEO_496x868_30fps, - .width = 496, - .height = 868, - .bin_factor_x = 1, - .bin_factor_y = 1, - .mipi_freq = 499000, - .used = 0, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x0E70, - .lines_per_frame = 0x0C08, - }, - { - } - }, - }, - { - .desc = "imx_STILL_5_5M_3X4_30fps", - .regs = imx_STILL_5_5M_3X4_30fps, - .width = 2048, - .height = 2720, - .bin_factor_x = 0, - .bin_factor_y = 0, - .mipi_freq = 499000, - .used = 0, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x0ED8, - .lines_per_frame = 0x0BB8, - }, - { - } - }, - - }, - { - .desc = "imx_STILL_5_7M_1X1_30fps", - .regs = imx_STILL_5_7M_1X1_30fps, - .width = 2400, - .height = 2400, - .bin_factor_x = 0, - .bin_factor_y = 0, - .mipi_freq = 499000, - .used = 0, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x1130, - .lines_per_frame = 0x0A1E, - }, - { - } - }, - - }, - { - .desc = "imx_STILL_6_5M_25fps", - .regs = imx_STILL_6_5M_25fps, - .width = 2400, - .height = 2720, - .bin_factor_x = 0, - .bin_factor_y = 0, - .mipi_freq = 499000, - .used = 0, - .fps_options = { - { - .fps = 25, - .pixels_per_line = 0x1130, - .lines_per_frame = 0x0C24, - }, - { - } - }, - } -}; - -struct imx_resolution imx227_res_still[] = { - { - .desc = "imx_STILL_5_5M_3X4_30fps", - .regs = imx_STILL_5_5M_3X4_30fps, - .width = 2048, - .height = 2720, - .bin_factor_x = 0, - .bin_factor_y = 0, - .mipi_freq = 499000, - .used = 0, - .fps_options = { - { - .fps = 6, - .pixels_per_line = 0x2130, - .lines_per_frame = 0x1A22, - }, - { - .fps = 30, - .pixels_per_line = 0x0ED8, - .lines_per_frame = 0x0BB8, - }, - { - } - }, - - }, - { - .desc = "imx_STILL_5_7M_1X1_30fps", - .regs = imx_STILL_5_7M_1X1_30fps, - .width = 2400, - .height = 2400, - .bin_factor_x = 0, - .bin_factor_y = 0, - .mipi_freq = 499000, - .used = 0, - .fps_options = { - { - .fps = 6, - .pixels_per_line = 0x266E, - .lines_per_frame = 0x1704, - }, - { - .fps = 30, - .pixels_per_line = 0x1130, - .lines_per_frame = 0x0A1E, - }, - { - } - }, - - }, - { - .desc = "imx_STILL_6_5M_25fps", - .regs = imx_STILL_6_5M_25fps, - .width = 2400, - .height = 2720, - .bin_factor_x = 0, - .bin_factor_y = 0, - .mipi_freq = 499000, - .used = 0, - .fps_options = { - { - .fps = 25, - .pixels_per_line = 0x1130, - .lines_per_frame = 0x0C24, - }, - { - } - }, - }, -}; - -struct imx_resolution imx227_res_video[] = { - { - .desc = "imx_VIDEO_4M_9X16_30fps", - .regs = imx_VIDEO_4M_9X16_30fps, - .width = 1536, - .height = 2720, - .bin_factor_x = 0, - .bin_factor_y = 0, - .mipi_freq = 499000, - .used = 0, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x0E70, - .lines_per_frame = 0x0C08, - }, - { - } - }, - - }, - { - .desc = "imx_VIDEO_2M_9X16_45fps", - .regs = imx_VIDEO_2M_9X16_45fps, - .width = 1096, - .height = 1936, - .bin_factor_x = 0, - .bin_factor_y = 0, - .mipi_freq = 499000, - .used = 0, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x0E70, - .lines_per_frame = 0x0C08, - }, - { - .fps = 45, - .pixels_per_line = 0x0E70, - .lines_per_frame = 0x0800, - }, - { - } - }, - - }, - { - .desc = "imx_VIDEO_1_3M_3X4_60fps", - .regs = imx_VIDEO_1_3M_3X4_60fps, - .width = 1024, - .height = 1360, - .bin_factor_x = 1, - .bin_factor_y = 1, - .mipi_freq = 499000, - .used = 0, - .fps_options = { - { - .fps = 60, - .pixels_per_line = 0x0E70, - .lines_per_frame = 0x0604, - }, - { - } - }, - }, - { - .desc = "imx_VIDEO_496x868_30fps", - .regs = imx_VIDEO_496x868_30fps, - .width = 496, - .height = 868, - .bin_factor_x = 1, - .bin_factor_y = 1, - .mipi_freq = 499000, - .used = 0, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x0E70, - .lines_per_frame = 0x0C08, - }, - { - } - }, - }, - { - .desc = "imx_VIDEO_1M_9X16_60fps", - .regs = imx_VIDEO_1M_9X16_60fps, - .width = 736, - .height = 1296, - .bin_factor_x = 1, - .bin_factor_y = 1, - .mipi_freq = 499000, - .used = 0, - .fps_options = { - { - .fps = 60, - .pixels_per_line = 0x0E70, - .lines_per_frame = 0x0604, - }, - { - .fps = 30, - .pixels_per_line = 0x0E70, - .lines_per_frame = 0x0C10, - }, - { - } - }, - }, - { - .desc = "imx_VIDEO_VGA_3X4_120fps", - .regs = imx_VIDEO_VGA_3X4_120fps, - .width = 512, - .height = 680, - .bin_factor_x = 2, - .bin_factor_y = 2, - .mipi_freq = 499000, - .used = 0, - .fps_options = { - { - .fps = 120, - .pixels_per_line = 0x0E70, - .lines_per_frame = 0x0302, - }, - { - .fps = 30, - .pixels_per_line = 0x0E70, - .lines_per_frame = 0x0C08, - }, - { - } - }, - }, - { - .desc = "imx_VIDEO_NHD_9X16_30fps", - .regs = imx_VIDEO_NHD_9X16_30fps, - .width = 376, - .height = 656, - .bin_factor_x = 2, - .bin_factor_y = 2, - .mipi_freq = 499000, - .used = 0, - .fps_options = { - { - .fps = 30, - .pixels_per_line = 0x0E70, - .lines_per_frame = 0x0C0A, - }, - { - } - }, - }, -}; - -#endif /* __IMX227_H__ */ diff --git a/drivers/staging/media/atomisp/i2c/imx/otp.c b/drivers/staging/media/atomisp/i2c/imx/otp.c deleted file mode 100644 index 462275038046..000000000000 --- a/drivers/staging/media/atomisp/i2c/imx/otp.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2013 Intel Corporation. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. - * - */ -#include <linux/device.h> -#include <linux/errno.h> -#include <linux/i2c.h> -#include <linux/kernel.h> -#include <linux/mm.h> -#include <linux/string.h> -#include <linux/types.h> -#include <media/v4l2-device.h> - -void *dummy_otp_read(struct v4l2_subdev *sd, u8 dev_addr, - u32 start_addr, u32 size) -{ - struct i2c_client *client = v4l2_get_subdevdata(sd); - u8 *buf; - - buf = devm_kzalloc(&client->dev, size, GFP_KERNEL); - if (!buf) - return ERR_PTR(-ENOMEM); - - return buf; -} diff --git a/drivers/staging/media/atomisp/i2c/imx/otp_brcc064_e2prom.c b/drivers/staging/media/atomisp/i2c/imx/otp_brcc064_e2prom.c deleted file mode 100644 index b11f90c5960c..000000000000 --- a/drivers/staging/media/atomisp/i2c/imx/otp_brcc064_e2prom.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013 Intel Corporation. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. - * - */ -#include <linux/bitops.h> -#include <linux/device.h> -#include <linux/errno.h> -#include <linux/fs.h> -#include <linux/init.h> -#include <linux/i2c.h> -#include <linux/io.h> -#include <linux/kernel.h> -#include <linux/mm.h> -#include <linux/slab.h> -#include <linux/string.h> -#include <linux/types.h> -#include <media/v4l2-device.h> -#include "common.h" - -/* - * Read EEPROM data from brcc064 and store - * it into a kmalloced buffer. On error return NULL. - * @size: set to the size of the returned EEPROM data. - */ -void *brcc064_otp_read(struct v4l2_subdev *sd, u8 dev_addr, - u32 start_addr, u32 size) -{ - struct i2c_client *client = v4l2_get_subdevdata(sd); - unsigned int e2prom_i2c_addr = dev_addr >> 1; - static const unsigned int max_read_size = 30; - int addr; - u32 s_addr = start_addr & E2PROM_ADDR_MASK; - unsigned char *buffer; - - buffer = devm_kzalloc(&client->dev, size, GFP_KERNEL); - if (!buffer) - return NULL; - - for (addr = s_addr; addr < size; addr += max_read_size) { - struct i2c_msg msg[2]; - unsigned int i2c_addr = e2prom_i2c_addr; - u16 addr_buf; - int r; - - msg[0].flags = 0; - msg[0].addr = i2c_addr; - addr_buf = cpu_to_be16(addr & 0xFFFF); - msg[0].len = 2; - msg[0].buf = (u8 *)&addr_buf; - - msg[1].addr = i2c_addr; - msg[1].flags = I2C_M_RD; - msg[1].len = min(max_read_size, size - addr); - msg[1].buf = &buffer[addr]; - - r = i2c_transfer(client->adapter, msg, ARRAY_SIZE(msg)); - if (r != ARRAY_SIZE(msg)) { - dev_err(&client->dev, "read failed at 0x%03x\n", addr); - return NULL; - } - } - return buffer; - -} - - diff --git a/drivers/staging/media/atomisp/i2c/imx/otp_e2prom.c b/drivers/staging/media/atomisp/i2c/imx/otp_e2prom.c deleted file mode 100644 index 73d041f97811..000000000000 --- a/drivers/staging/media/atomisp/i2c/imx/otp_e2prom.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2013 Intel Corporation. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. - * - */ -#include <linux/bitops.h> -#include <linux/device.h> -#include <linux/errno.h> -#include <linux/fs.h> -#include <linux/init.h> -#include <linux/i2c.h> -#include <linux/io.h> -#include <linux/kernel.h> -#include <linux/mm.h> -#include <linux/slab.h> -#include <linux/string.h> -#include <linux/types.h> -#include <media/v4l2-device.h> -#include "common.h" - -/* - * Read EEPROM data from the gerneral e2prom chip(eg. - * CAT24C08, CAT24C128, le24l042cs, and store - * it into a kmalloced buffer. On error return NULL. - * @size: set to the size of the returned EEPROM data. - */ -void *e2prom_otp_read(struct v4l2_subdev *sd, u8 dev_addr, - u32 start_addr, u32 size) -{ - struct i2c_client *client = v4l2_get_subdevdata(sd); - unsigned int e2prom_i2c_addr = dev_addr >> 1; - static const unsigned int max_read_size = 30; - int addr; - u32 s_addr = start_addr & E2PROM_ADDR_MASK; - bool two_addr = (start_addr & E2PROM_2ADDR) >> 31; - char *buffer; - - buffer = devm_kzalloc(&client->dev, size, GFP_KERNEL); - if (!buffer) - return NULL; - - for (addr = s_addr; addr < size; addr += max_read_size) { - struct i2c_msg msg[2]; - unsigned int i2c_addr = e2prom_i2c_addr; - u16 addr_buf; - int r; - - msg[0].flags = 0; - if (two_addr) { - msg[0].addr = i2c_addr; - addr_buf = cpu_to_be16(addr & 0xFFFF); - msg[0].len = 2; - msg[0].buf = (u8 *)&addr_buf; - } else { - i2c_addr |= (addr >> 8) & 0x7; - msg[0].addr = i2c_addr; - addr_buf = addr & 0xFF; - msg[0].len = 1; - msg[0].buf = (u8 *)&addr_buf; - } - - msg[1].addr = i2c_addr; - msg[1].flags = I2C_M_RD; - msg[1].len = min(max_read_size, size - addr); - msg[1].buf = &buffer[addr]; - - r = i2c_transfer(client->adapter, msg, ARRAY_SIZE(msg)); - if (r != ARRAY_SIZE(msg)) { - dev_err(&client->dev, "read failed at 0x%03x\n", addr); - return NULL; - } - } - return buffer; -} - - diff --git a/drivers/staging/media/atomisp/i2c/imx/otp_imx.c b/drivers/staging/media/atomisp/i2c/imx/otp_imx.c deleted file mode 100644 index 1ca27c26ef75..000000000000 --- a/drivers/staging/media/atomisp/i2c/imx/otp_imx.c +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright (c) 2013 Intel Corporation. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. - * - */ -#include <linux/bitops.h> -#include <linux/device.h> -#include <linux/delay.h> -#include <linux/errno.h> -#include <linux/fs.h> -#include <linux/init.h> -#include <linux/i2c.h> -#include <linux/io.h> -#include <linux/kernel.h> -#include <linux/mm.h> -#include <linux/string.h> -#include <linux/slab.h> -#include <linux/types.h> -#include <media/v4l2-device.h> -#include <asm/intel-mid.h> -#include "common.h" - -/* Defines for OTP Data Registers */ -#define IMX_OTP_START_ADDR 0x3B04 -#define IMX_OTP_PAGE_SIZE 64 -#define IMX_OTP_READY_REG 0x3B01 -#define IMX_OTP_PAGE_REG 0x3B02 -#define IMX_OTP_MODE_REG 0x3B00 -#define IMX_OTP_PAGE_MAX 20 -#define IMX_OTP_READY_REG_DONE 1 -#define IMX_OTP_READ_ONETIME 32 -#define IMX_OTP_MODE_READ 1 -#define IMX227_OTP_START_ADDR 0x0A04 -#define IMX227_OTP_ENABLE_REG 0x0A00 -#define IMX227_OTP_READY_REG 0x0A01 -#define IMX227_OTP_PAGE_REG 0x0A02 -#define IMX227_OTP_READY_REG_DONE 1 -#define IMX227_OTP_MODE_READ 1 - -static int -imx_read_otp_data(struct i2c_client *client, u16 len, u16 reg, void *val) -{ - struct i2c_msg msg[2]; - u16 data[IMX_SHORT_MAX] = { 0 }; - int err; - - if (len > IMX_BYTE_MAX) { - dev_err(&client->dev, "%s error, invalid data length\n", - __func__); - return -EINVAL; - } - - memset(msg, 0 , sizeof(msg)); - memset(data, 0 , sizeof(data)); - - msg[0].addr = client->addr; - msg[0].flags = 0; - msg[0].len = I2C_MSG_LENGTH; - msg[0].buf = (u8 *)data; - /* high byte goes first */ - data[0] = cpu_to_be16(reg); - - msg[1].addr = client->addr; - msg[1].len = len; - msg[1].flags = I2C_M_RD; - msg[1].buf = (u8 *)data; - - err = i2c_transfer(client->adapter, msg, 2); - if (err != 2) { - if (err >= 0) - err = -EIO; - goto error; - } - - memcpy(val, data, len); - return 0; - -error: - dev_err(&client->dev, "read from offset 0x%x error %d", reg, err); - return err; -} - -static int imx_read_otp_reg_array(struct i2c_client *client, u16 size, u16 addr, - u8 *buf) -{ - u16 index; - int ret; - - for (index = 0; index + IMX_OTP_READ_ONETIME <= size; - index += IMX_OTP_READ_ONETIME) { - ret = imx_read_otp_data(client, IMX_OTP_READ_ONETIME, - addr + index, &buf[index]); - if (ret) - return ret; - } - return 0; -} - -void *imx_otp_read(struct v4l2_subdev *sd, u8 dev_addr, - u32 start_addr, u32 size) -{ - struct i2c_client *client = v4l2_get_subdevdata(sd); - u8 *buf; - int ret; - int i; - - buf = devm_kzalloc(&client->dev, size, GFP_KERNEL); - if (!buf) - return ERR_PTR(-ENOMEM); - - for (i = 0; i < IMX_OTP_PAGE_MAX; i++) { - - /*set page NO.*/ - ret = imx_write_reg(client, IMX_8BIT, - IMX_OTP_PAGE_REG, i & 0xff); - if (ret) - goto fail; - - /*set read mode*/ - ret = imx_write_reg(client, IMX_8BIT, - IMX_OTP_MODE_REG, IMX_OTP_MODE_READ); - if (ret) - goto fail; - - /* Reading the OTP data array */ - ret = imx_read_otp_reg_array(client, IMX_OTP_PAGE_SIZE, - IMX_OTP_START_ADDR, buf + i * IMX_OTP_PAGE_SIZE); - if (ret) - goto fail; - } - - return buf; -fail: - /* Driver has failed to find valid data */ - dev_err(&client->dev, "sensor found no valid OTP data\n"); - return ERR_PTR(ret); -} - -void *imx227_otp_read(struct v4l2_subdev *sd, u8 dev_addr, - u32 start_addr, u32 size) -{ - struct i2c_client *client = v4l2_get_subdevdata(sd); - u8 *buf; - int ret; - int i; - - buf = devm_kzalloc(&client->dev, size, GFP_KERNEL); - if (!buf) - return ERR_PTR(-ENOMEM); - - for (i = 0; i < IMX_OTP_PAGE_MAX; i++) { - - /*set page NO.*/ - ret = imx_write_reg(client, IMX_8BIT, - IMX227_OTP_PAGE_REG, i & 0xff); - if (ret) - goto fail; - - /*set read mode*/ - ret = imx_write_reg(client, IMX_8BIT, - IMX227_OTP_ENABLE_REG, IMX227_OTP_MODE_READ); - if (ret) - goto fail; - - /* Reading the OTP data array */ - ret = imx_read_otp_reg_array(client, IMX_OTP_PAGE_SIZE, - IMX227_OTP_START_ADDR, buf + i * IMX_OTP_PAGE_SIZE); - if (ret) - goto fail; - } - - return buf; -fail: - /* Driver has failed to find valid data */ - dev_err(&client->dev, "sensor found no valid OTP data\n"); - return ERR_PTR(ret); -} - diff --git a/drivers/staging/media/atomisp/i2c/imx/vcm.c b/drivers/staging/media/atomisp/i2c/imx/vcm.c deleted file mode 100644 index 2d2df04c800a..000000000000 --- a/drivers/staging/media/atomisp/i2c/imx/vcm.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2012 Intel Corporation. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. - * - */ -#include <linux/errno.h> -#include <linux/kernel.h> -#include <linux/types.h> -#include <media/v4l2-device.h> -#include "../../include/linux/atomisp_platform.h" - -int vcm_power_up(struct v4l2_subdev *sd) -{ - const struct camera_af_platform_data *vcm_platform_data; - - vcm_platform_data = camera_get_af_platform_data(); - if (NULL == vcm_platform_data) - return -ENODEV; - /* Enable power */ - return vcm_platform_data->power_ctrl(sd, 1); -} - -int vcm_power_down(struct v4l2_subdev *sd) -{ - const struct camera_af_platform_data *vcm_platform_data; - - vcm_platform_data = camera_get_af_platform_data(); - if (NULL == vcm_platform_data) - return -ENODEV; - return vcm_platform_data->power_ctrl(sd, 0); -} - diff --git a/drivers/staging/media/atomisp/i2c/mt9m114.h b/drivers/staging/media/atomisp/i2c/mt9m114.h index 5e7d79d2e01b..0af79d77a404 100644 --- a/drivers/staging/media/atomisp/i2c/mt9m114.h +++ b/drivers/staging/media/atomisp/i2c/mt9m114.h @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ @@ -394,11 +390,6 @@ static struct mt9m114_res_struct mt9m114_res[] = { }; #define N_RES (ARRAY_SIZE(mt9m114_res)) -static const struct i2c_device_id mt9m114_id[] = { - {"mt9m114", 0}, - {} -}; - static struct misensor_reg const mt9m114_exitstandby[] = { {MISENSOR_16BIT, 0x098E, 0xDC00}, /* exit-standby */ diff --git a/drivers/staging/media/atomisp/i2c/ov2680.h b/drivers/staging/media/atomisp/i2c/ov2680.h index ab8907e6c9ef..bf4897347df7 100644 --- a/drivers/staging/media/atomisp/i2c/ov2680.h +++ b/drivers/staging/media/atomisp/i2c/ov2680.h @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ @@ -35,10 +31,6 @@ #include "../include/linux/atomisp_platform.h" -#define OV2680_NAME "ov2680" -#define OV2680B_NAME "ov2680b" -#define OV2680F_NAME "ov2680f" - /* Defines for register writes and register array processing */ #define I2C_MSG_LENGTH 0x2 #define I2C_RETRY_COUNT 5 @@ -227,12 +219,6 @@ struct ov2680_format { struct ov2680_write_buffer buffer; }; - static const struct i2c_device_id ov2680_id[] = { - {OV2680B_NAME, 0}, - {OV2680F_NAME, 0}, - {} - }; - static struct ov2680_reg const ov2680_global_setting[] = { {OV2680_8BIT, 0x0103, 0x01}, {OV2680_8BIT, 0x3002, 0x00}, diff --git a/drivers/staging/media/atomisp/i2c/ov2722.h b/drivers/staging/media/atomisp/i2c/ov2722.h index 73ecb1679718..d8a973d71699 100644 --- a/drivers/staging/media/atomisp/i2c/ov2722.h +++ b/drivers/staging/media/atomisp/i2c/ov2722.h @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ @@ -35,8 +31,6 @@ #include "../include/linux/atomisp_platform.h" -#define OV2722_NAME "ov2722" - #define OV2722_POWER_UP_RETRY_NUM 5 /* Defines for register writes and register array processing */ @@ -257,11 +251,6 @@ struct ov2722_write_ctrl { struct ov2722_write_buffer buffer; }; -static const struct i2c_device_id ov2722_id[] = { - {OV2722_NAME, 0}, - {} -}; - /* * Register settings for various resolution */ diff --git a/drivers/staging/media/atomisp/i2c/ov5693/Kconfig b/drivers/staging/media/atomisp/i2c/ov5693/Kconfig index 9fb1bffbe9b3..3f527f2047a7 100644 --- a/drivers/staging/media/atomisp/i2c/ov5693/Kconfig +++ b/drivers/staging/media/atomisp/i2c/ov5693/Kconfig @@ -1,11 +1,11 @@ -config VIDEO_OV5693 +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. + 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. + ov5693 is video camera sensor. + It currently only works with the atomisp driver. diff --git a/drivers/staging/media/atomisp/i2c/ov5693/Makefile b/drivers/staging/media/atomisp/i2c/ov5693/Makefile index facb70e6a93e..aa6be85c5a60 100644 --- a/drivers/staging/media/atomisp/i2c/ov5693/Makefile +++ b/drivers/staging/media/atomisp/i2c/ov5693/Makefile @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 -obj-$(CONFIG_VIDEO_OV5693) += ov5693.o +obj-$(CONFIG_VIDEO_ATOMISP_OV5693) += atomisp-ov5693.o # HACK! While this driver is in bad shape, don't enable several warnings # that would be otherwise enabled with W=1 diff --git a/drivers/staging/media/atomisp/i2c/ov5693/ad5823.h b/drivers/staging/media/atomisp/i2c/ov5693/ad5823.h index 2dd894989cd9..4de44569fe54 100644 --- a/drivers/staging/media/atomisp/i2c/ov5693/ad5823.h +++ b/drivers/staging/media/atomisp/i2c/ov5693/ad5823.h @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ diff --git a/drivers/staging/media/atomisp/i2c/ov5693/ov5693.c b/drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c index 123642557aa8..3e7c3851280f 100644 --- a/drivers/staging/media/atomisp/i2c/ov5693/ov5693.c +++ b/drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ @@ -31,7 +27,6 @@ #include <linux/delay.h> #include <linux/slab.h> #include <linux/i2c.h> -#include <linux/gpio.h> #include <linux/moduleparam.h> #include <media/v4l2-device.h> #include <linux/io.h> @@ -391,8 +386,8 @@ static int ov5693_write_reg_array(struct i2c_client *client, if (!__ov5693_write_reg_is_consecutive(client, &ctrl, next)) { err = __ov5693_flush_reg_array(client, &ctrl); - if (err) - return err; + if (err) + return err; } err = __ov5693_buf_reg_array(client, &ctrl, next); if (err) { @@ -945,12 +940,8 @@ static int ad5823_t_focus_vcm(struct v4l2_subdev *sd, u16 val) int ad5823_t_focus_abs(struct v4l2_subdev *sd, s32 value) { - int ret; - value = min(value, AD5823_MAX_FOCUS_POS); - ret = ad5823_t_focus_vcm(sd, value); - - return ret; + return ad5823_t_focus_vcm(sd, value); } static int ov5693_t_focus_abs(struct v4l2_subdev *sd, s32 value) @@ -1302,10 +1293,6 @@ static int power_ctrl(struct v4l2_subdev *sd, bool flag) if (!dev || !dev->platform_data) return -ENODEV; - /* Non-gmin platforms use the legacy callback */ - if (dev->platform_data->power_ctrl) - return dev->platform_data->power_ctrl(sd, flag); - /* This driver assumes "internal DVDD, PWDNB tied to DOVDD". * In this set up only gpio0 (XSHUTDN) should be available * but in some products (for example ECS) gpio1 (PWDNB) is @@ -1332,19 +1319,12 @@ static int power_ctrl(struct v4l2_subdev *sd, bool flag) static int gpio_ctrl(struct v4l2_subdev *sd, bool flag) { - int ret; struct ov5693_device *dev = to_ov5693_sensor(sd); if (!dev || !dev->platform_data) return -ENODEV; - /* Non-gmin platforms use the legacy callback */ - if (dev->platform_data->gpio_ctrl) - return dev->platform_data->gpio_ctrl(sd, flag); - - ret = dev->platform_data->gpio0_ctrl(sd, flag); - - return ret; + return dev->platform_data->gpio0_ctrl(sd, flag); } static int __power_up(struct v4l2_subdev *sd) @@ -1942,8 +1922,7 @@ static int ov5693_remove(struct i2c_client *client) return 0; } -static int ov5693_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static int ov5693_probe(struct i2c_client *client) { struct ov5693_device *dev; int i2c; @@ -1965,10 +1944,8 @@ static int ov5693_probe(struct i2c_client *client, } dev = kzalloc(sizeof(*dev), GFP_KERNEL); - if (!dev) { - dev_err(&client->dev, "out of memory\n"); + if (!dev) return -ENOMEM; - } mutex_init(&dev->input_lock); @@ -2030,8 +2007,6 @@ out_free: return ret; } -MODULE_DEVICE_TABLE(i2c, ov5693_id); - static const struct acpi_device_id ov5693_acpi_match[] = { {"INT33BE"}, {}, @@ -2040,27 +2015,13 @@ MODULE_DEVICE_TABLE(acpi, ov5693_acpi_match); static struct i2c_driver ov5693_driver = { .driver = { - .name = OV5693_NAME, - .acpi_match_table = ACPI_PTR(ov5693_acpi_match), + .name = "ov5693", + .acpi_match_table = ov5693_acpi_match, }, - .probe = ov5693_probe, + .probe_new = ov5693_probe, .remove = ov5693_remove, - .id_table = ov5693_id, }; - -static int init_ov5693(void) -{ - return i2c_add_driver(&ov5693_driver); -} - -static void exit_ov5693(void) -{ - - i2c_del_driver(&ov5693_driver); -} - -module_init(init_ov5693); -module_exit(exit_ov5693); +module_i2c_driver(ov5693_driver); MODULE_DESCRIPTION("A low-level driver for OmniVision 5693 sensors"); MODULE_LICENSE("GPL"); diff --git a/drivers/staging/media/atomisp/i2c/ov5693/ov5693.h b/drivers/staging/media/atomisp/i2c/ov5693/ov5693.h index 8c2e6794463b..2ea63807c56d 100644 --- a/drivers/staging/media/atomisp/i2c/ov5693/ov5693.h +++ b/drivers/staging/media/atomisp/i2c/ov5693/ov5693.h @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ @@ -35,8 +31,6 @@ #include "../../include/linux/atomisp_platform.h" -#define OV5693_NAME "ov5693" - #define OV5693_POWER_UP_RETRY_NUM 5 /* Defines for register writes and register array processing */ @@ -278,11 +272,6 @@ struct ov5693_write_ctrl { struct ov5693_write_buffer buffer; }; -static const struct i2c_device_id ov5693_id[] = { - {OV5693_NAME, 0}, - {} -}; - static struct ov5693_reg const ov5693_global_setting[] = { {OV5693_8BIT, 0x0103, 0x01}, {OV5693_8BIT, 0x3001, 0x0a}, diff --git a/drivers/staging/media/atomisp/i2c/ov8858.c b/drivers/staging/media/atomisp/i2c/ov8858.c index 43e1638fd674..ba147ac2e36f 100644 --- a/drivers/staging/media/atomisp/i2c/ov8858.c +++ b/drivers/staging/media/atomisp/i2c/ov8858.c @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ @@ -480,8 +476,6 @@ static int ov8858_priv_int_data_init(struct v4l2_subdev *sd) if (!dev->otp_data) { dev->otp_data = devm_kzalloc(&client->dev, size, GFP_KERNEL); if (!dev->otp_data) { - dev_err(&client->dev, "%s: can't allocate memory", - __func__); r = -ENOMEM; goto error3; } @@ -714,10 +708,6 @@ static int __power_ctrl(struct v4l2_subdev *sd, bool flag) if (!dev || !dev->platform_data) return -ENODEV; - /* Non-gmin platforms use the legacy callback */ - if (dev->platform_data->power_ctrl) - return dev->platform_data->power_ctrl(sd, flag); - if (dev->platform_data->v1p2_ctrl) { ret = dev->platform_data->v1p2_ctrl(sd, flag); if (ret) { @@ -769,10 +759,6 @@ static int __gpio_ctrl(struct v4l2_subdev *sd, bool flag) if (!client || !dev || !dev->platform_data) return -ENODEV; - /* Non-gmin platforms use the legacy callback */ - if (dev->platform_data->gpio_ctrl) - return dev->platform_data->gpio_ctrl(sd, flag); - if (dev->platform_data->gpio0_ctrl) return dev->platform_data->gpio0_ctrl(sd, flag); @@ -1575,15 +1561,6 @@ static int ov8858_s_config(struct v4l2_subdev *sd, mutex_lock(&dev->input_lock); - if (dev->platform_data->platform_init) { - ret = dev->platform_data->platform_init(client); - if (ret) { - mutex_unlock(&dev->input_lock); - dev_err(&client->dev, "platform init error %d!\n", ret); - return ret; - } - } - ret = __ov8858_s_power(sd, 1); if (ret) { dev_err(&client->dev, "power-up error %d!\n", ret); @@ -1628,8 +1605,6 @@ fail_detect: fail_csi_cfg: __ov8858_s_power(sd, 0); fail_update: - if (dev->platform_data->platform_deinit) - dev->platform_data->platform_deinit(); mutex_unlock(&dev->input_lock); dev_err(&client->dev, "sensor power-gating failed\n"); return ret; @@ -1930,8 +1905,6 @@ static int ov8858_remove(struct i2c_client *client) { struct v4l2_subdev *sd = i2c_get_clientdata(client); struct ov8858_device *dev = to_ov8858_sensor(sd); - if (dev->platform_data->platform_deinit) - dev->platform_data->platform_deinit(); media_entity_cleanup(&dev->sd.entity); v4l2_ctrl_handler_free(&dev->ctrl_handler); @@ -2082,8 +2055,7 @@ static const struct v4l2_ctrl_config ctrls[] = { } }; -static int ov8858_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static int ov8858_probe(struct i2c_client *client) { struct ov8858_device *dev; unsigned int i; @@ -2094,15 +2066,11 @@ static int ov8858_probe(struct i2c_client *client, /* allocate sensor device & init sub device */ dev = kzalloc(sizeof(*dev), GFP_KERNEL); - if (!dev) { - dev_err(&client->dev, "%s: out of memory\n", __func__); + if (!dev) return -ENOMEM; - } mutex_init(&dev->input_lock); - if (id) - dev->i2c_id = id->driver_data; dev->fmt_idx = 0; dev->sensor_id = OV_ID_DEFAULT; dev->vcm_driver = &ov8858_vcms[OV8858_ID_DEFAULT]; @@ -2182,40 +2150,21 @@ out_free: return ret; } -static const struct i2c_device_id ov8858_id[] = { - {OV8858_NAME, 0}, - {} -}; - -MODULE_DEVICE_TABLE(i2c, ov8858_id); - static const struct acpi_device_id ov8858_acpi_match[] = { {"INT3477"}, {}, }; +MODULE_DEVICE_TABLE(acpi, ov8858_acpi_match); static struct i2c_driver ov8858_driver = { .driver = { - .name = OV8858_NAME, - .acpi_match_table = ACPI_PTR(ov8858_acpi_match), + .name = "ov8858", + .acpi_match_table = ov8858_acpi_match, }, - .probe = ov8858_probe, + .probe_new = ov8858_probe, .remove = ov8858_remove, - .id_table = ov8858_id, }; - -static __init int ov8858_init_mod(void) -{ - return i2c_add_driver(&ov8858_driver); -} - -static __exit void ov8858_exit_mod(void) -{ - i2c_del_driver(&ov8858_driver); -} - -module_init(ov8858_init_mod); -module_exit(ov8858_exit_mod); +module_i2c_driver(ov8858_driver); MODULE_DESCRIPTION("A low-level driver for Omnivision OV8858 sensors"); MODULE_LICENSE("GPL"); diff --git a/drivers/staging/media/atomisp/i2c/ov8858.h b/drivers/staging/media/atomisp/i2c/ov8858.h index 638d1a803a2b..6c89568bb44e 100644 --- a/drivers/staging/media/atomisp/i2c/ov8858.h +++ b/drivers/staging/media/atomisp/i2c/ov8858.h @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ @@ -113,7 +109,6 @@ #define OV_SUBDEV_PREFIX "ov" #define OV_ID_DEFAULT 0x0000 -#define OV8858_NAME "ov8858" #define OV8858_CHIP_ID 0x8858 #define OV8858_LONG_EXPO 0x3500 diff --git a/drivers/staging/media/atomisp/i2c/ov8858_btns.h b/drivers/staging/media/atomisp/i2c/ov8858_btns.h index 7d74a8899fae..f81851306832 100644 --- a/drivers/staging/media/atomisp/i2c/ov8858_btns.h +++ b/drivers/staging/media/atomisp/i2c/ov8858_btns.h @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ @@ -113,7 +109,6 @@ #define OV_SUBDEV_PREFIX "ov" #define OV_ID_DEFAULT 0x0000 -#define OV8858_NAME "ov8858" #define OV8858_CHIP_ID 0x8858 #define OV8858_LONG_EXPO 0x3500 diff --git a/drivers/staging/media/atomisp/include/asm/intel_mid_pcihelpers.h b/drivers/staging/media/atomisp/include/asm/intel_mid_pcihelpers.h deleted file mode 100644 index dc7104470f5c..000000000000 --- a/drivers/staging/media/atomisp/include/asm/intel_mid_pcihelpers.h +++ /dev/null @@ -1,38 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Access to message bus through three registers - * in CUNIT(0:0:0) PCI configuration space. - * MSGBUS_CTRL_REG(0xD0): - * 31:24 = message bus opcode - * 23:16 = message bus port - * 15:8 = message bus address, low 8 bits. - * 7:4 = message bus byte enables - * MSGBUS_CTRL_EXT_REG(0xD8): - * 31:8 = message bus address, high 24 bits. - * MSGBUS_DATA_REG(0xD4): - * hold the data for write or read - */ -#define PCI_ROOT_MSGBUS_CTRL_REG 0xD0 -#define PCI_ROOT_MSGBUS_DATA_REG 0xD4 -#define PCI_ROOT_MSGBUS_CTRL_EXT_REG 0xD8 -#define PCI_ROOT_MSGBUS_READ 0x10 -#define PCI_ROOT_MSGBUS_WRITE 0x11 -#define PCI_ROOT_MSGBUS_DWORD_ENABLE 0xf0 - -/* In BYT platform for all internal PCI devices d3 delay - * of 3 ms is sufficient. Default value of 10 ms is overkill. - */ -#define INTERNAL_PCI_PM_D3_WAIT 3 - -#define ISP_SUB_CLASS 0x80 -#define SUB_CLASS_MASK 0xFF00 - -u32 intel_mid_msgbus_read32_raw(u32 cmd); -u32 intel_mid_msgbus_read32(u8 port, u32 addr); -void intel_mid_msgbus_write32_raw(u32 cmd, u32 data); -void intel_mid_msgbus_write32(u8 port, u32 addr, u32 data); -u32 intel_mid_msgbus_read32_raw_ext(u32 cmd, u32 cmd_ext); -void intel_mid_msgbus_write32_raw_ext(u32 cmd, u32 cmd_ext, u32 data); -u32 intel_mid_soc_stepping(void); -int intel_mid_dw_i2c_acquire_ownership(void); -int intel_mid_dw_i2c_release_ownership(void); diff --git a/drivers/staging/media/atomisp/include/linux/atomisp.h b/drivers/staging/media/atomisp/include/linux/atomisp.h index d67dd658cff9..b5533197226d 100644 --- a/drivers/staging/media/atomisp/include/linux/atomisp.h +++ b/drivers/staging/media/atomisp/include/linux/atomisp.h @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ #ifdef CSS15 diff --git a/drivers/staging/media/atomisp/include/linux/atomisp_gmin_platform.h b/drivers/staging/media/atomisp/include/linux/atomisp_gmin_platform.h index 5390b97ac6e7..7e3ca12dd4e9 100644 --- a/drivers/staging/media/atomisp/include/linux/atomisp_gmin_platform.h +++ b/drivers/staging/media/atomisp/include/linux/atomisp_gmin_platform.h @@ -17,9 +17,6 @@ #include "atomisp_platform.h" -const struct atomisp_camera_caps *atomisp_get_default_camera_caps(void); -const struct atomisp_platform_data *atomisp_get_platform_data(void); -const struct camera_af_platform_data *camera_get_af_platform_data(void); int atomisp_register_i2c_module(struct v4l2_subdev *subdev, struct camera_sensor_platform_data *plat_data, enum intel_v4l2_subdev_type type); diff --git a/drivers/staging/media/atomisp/include/linux/atomisp_platform.h b/drivers/staging/media/atomisp/include/linux/atomisp_platform.h index dbac2b777dad..e0f0c379e7ce 100644 --- a/drivers/staging/media/atomisp/include/linux/atomisp_platform.h +++ b/drivers/staging/media/atomisp/include/linux/atomisp_platform.h @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ #ifndef ATOMISP_PLATFORM_H_ @@ -205,20 +201,13 @@ struct camera_vcm_control { }; struct camera_sensor_platform_data { - int (*gpio_ctrl)(struct v4l2_subdev *subdev, int flag); int (*flisclk_ctrl)(struct v4l2_subdev *subdev, int flag); - int (*power_ctrl)(struct v4l2_subdev *subdev, int flag); int (*csi_cfg)(struct v4l2_subdev *subdev, int flag); - bool (*low_fps)(void); - int (*platform_init)(struct i2c_client *); - int (*platform_deinit)(void); - char *(*msr_file_name)(void); - struct atomisp_camera_caps *(*get_camera_caps)(void); - int (*gpio_intr_ctrl)(struct v4l2_subdev *subdev); - /* New G-Min power and GPIO interface, replaces - * power/gpio_ctrl with methods to control individual - * lines as implemented on all known camera modules. */ + /* + * New G-Min power and GPIO interface to control individual + * lines as implemented on all known camera modules. + */ int (*gpio0_ctrl)(struct v4l2_subdev *subdev, int on); int (*gpio1_ctrl)(struct v4l2_subdev *subdev, int on); int (*v1p8_ctrl)(struct v4l2_subdev *subdev, int on); @@ -228,12 +217,6 @@ struct camera_sensor_platform_data { char *module_id); }; -struct camera_af_platform_data { - int (*power_ctrl)(struct v4l2_subdev *subdev, int flag); -}; - -const struct camera_af_platform_data *camera_get_af_platform_data(void); - struct camera_mipi_info { enum atomisp_camera_port port; unsigned int num_lanes; diff --git a/drivers/staging/media/atomisp/include/linux/libmsrlisthelper.h b/drivers/staging/media/atomisp/include/linux/libmsrlisthelper.h index 589f4eae38ca..8988b37943b3 100644 --- a/drivers/staging/media/atomisp/include/linux/libmsrlisthelper.h +++ b/drivers/staging/media/atomisp/include/linux/libmsrlisthelper.h @@ -10,10 +10,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ #ifndef __LIBMSRLISTHELPER_H__ diff --git a/drivers/staging/media/atomisp/include/media/lm3554.h b/drivers/staging/media/atomisp/include/media/lm3554.h index 7d6a8c05dd52..9276ce44d907 100644 --- a/drivers/staging/media/atomisp/include/media/lm3554.h +++ b/drivers/staging/media/atomisp/include/media/lm3554.h @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ #ifndef _LM3554_H_ @@ -24,7 +20,6 @@ #include <linux/videodev2.h> #include <media/v4l2-subdev.h> -#define LM3554_NAME "lm3554" #define LM3554_ID 3554 #define v4l2_queryctrl_entry_integer(_id, _name,\ diff --git a/drivers/staging/media/atomisp/include/media/lm3642.h b/drivers/staging/media/atomisp/include/media/lm3642.h deleted file mode 100644 index 545d95763335..000000000000 --- a/drivers/staging/media/atomisp/include/media/lm3642.h +++ /dev/null @@ -1,153 +0,0 @@ -/* - * include/media/lm3642.h - * - * Copyright (c) 2010-2012 Intel Corporation. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. - */ - -#ifndef _LM3642_H_ -#define _LM3642_H_ - -#include <linux/videodev2.h> -#include <media/v4l2-subdev.h> - -#define LM3642_NAME "lm3642" -#define LM3642_ID 3642 - -#define v4l2_queryctrl_entry_integer(_id, _name,\ - _minimum, _maximum, _step, \ - _default_value, _flags) \ - {\ - .id = (_id), \ - .type = V4L2_CTRL_TYPE_INTEGER, \ - .name = _name, \ - .minimum = (_minimum), \ - .maximum = (_maximum), \ - .step = (_step), \ - .default_value = (_default_value),\ - .flags = (_flags),\ - } -#define v4l2_queryctrl_entry_boolean(_id, _name,\ - _default_value, _flags) \ - {\ - .id = (_id), \ - .type = V4L2_CTRL_TYPE_BOOLEAN, \ - .name = _name, \ - .minimum = 0, \ - .maximum = 1, \ - .step = 1, \ - .default_value = (_default_value),\ - .flags = (_flags),\ - } - -#define s_ctrl_id_entry_integer(_id, _name, \ - _minimum, _maximum, _step, \ - _default_value, _flags, \ - _s_ctrl, _g_ctrl) \ - {\ - .qc = v4l2_queryctrl_entry_integer(_id, _name,\ - _minimum, _maximum, _step,\ - _default_value, _flags), \ - .s_ctrl = _s_ctrl, \ - .g_ctrl = _g_ctrl, \ - } - -#define s_ctrl_id_entry_boolean(_id, _name, \ - _default_value, _flags, \ - _s_ctrl, _g_ctrl) \ - {\ - .qc = v4l2_queryctrl_entry_boolean(_id, _name,\ - _default_value, _flags), \ - .s_ctrl = _s_ctrl, \ - .g_ctrl = _g_ctrl, \ - } - - -/* Default Values */ -#define LM3642_DEFAULT_TIMEOUT 300U -#define LM3642_DEFAULT_RAMP_TIME 0x10 /* 1.024ms */ -#define LM3642_DEFAULT_INDICATOR_CURRENT 0x01 /* 1.88A */ -#define LM3642_DEFAULT_FLASH_CURRENT 0x0f /* 1500mA */ - -/* Value settings for Flash Time-out Duration*/ -#define LM3642_MIN_TIMEOUT 100U -#define LM3642_MAX_TIMEOUT 800U -#define LM3642_TIMEOUT_STEPSIZE 100U - -/* Flash modes */ -#define LM3642_MODE_SHUTDOWN 0 -#define LM3642_MODE_INDICATOR 1 -#define LM3642_MODE_TORCH 2 -#define LM3642_MODE_FLASH 3 - -/* timer delay time */ -#define LM3642_TIMER_DELAY 5 - -/* Percentage <-> value macros */ -#define LM3642_MIN_PERCENT 0U -#define LM3642_MAX_PERCENT 100U -#define LM3642_CLAMP_PERCENTAGE(val) \ - clamp(val, LM3642_MIN_PERCENT, LM3642_MAX_PERCENT) - -#define LM3642_VALUE_TO_PERCENT(v, step) \ - (((((unsigned long)((v)+1))*(step))+50)/100) -#define LM3642_PERCENT_TO_VALUE(p, step) \ - (((((unsigned long)(p))*100)+((step)>>1))/(step)-1) - -/* Product specific limits - * TODO: get these from platform data */ -#define LM3642_FLASH_MAX_LVL 0x0F /* 1500mA */ -#define LM3642_TORCH_MAX_LVL 0x07 /* 187mA */ -#define LM3642_INDICATOR_MAX_LVL 0x01 /* 1.88A */ - -/* Flash brightness, input is percentage, output is [0..15] */ -#define LM3642_FLASH_STEP \ - ((100ul*(LM3642_MAX_PERCENT) \ - +((LM3642_FLASH_MAX_LVL+1)>>1)) \ - /((LM3642_FLASH_MAX_LVL+1))) -#define LM3642_FLASH_DEFAULT_BRIGHTNESS \ - LM3642_VALUE_TO_PERCENT(15, LM3642_FLASH_STEP) - -/* Torch brightness, input is percentage, output is [0..7] */ -#define LM3642_TORCH_STEP \ - ((100ul*(LM3642_MAX_PERCENT) \ - +((LM3642_TORCH_MAX_LVL+1)>>1)) \ - /((LM3642_TORCH_MAX_LVL+1))) -#define LM3642_TORCH_DEFAULT_BRIGHTNESS \ - LM3642_VALUE_TO_PERCENT(0, LM3642_TORCH_STEP) - -/* Indicator brightness, input is percentage, output is [0..1] */ -#define LM3642_INDICATOR_STEP \ - ((100ul*(LM3642_MAX_PERCENT) \ - +((LM3642_INDICATOR_MAX_LVL+1)>>1)) \ - /((LM3642_INDICATOR_MAX_LVL+1))) -#define LM3642_INDICATOR_DEFAULT_BRIGHTNESS \ - LM3642_VALUE_TO_PERCENT(1, LM3642_INDICATOR_STEP) - -/* - * lm3642_platform_data - Flash controller platform data - */ -struct lm3642_platform_data { - int gpio_torch; - int gpio_strobe; - int (*power_ctrl)(struct v4l2_subdev *subdev, int on); - - unsigned int torch_en; - unsigned int flash_en; - unsigned int tx_en; - unsigned int ivfm_en; -}; - -#endif /* _LM3642_H_ */ - diff --git a/drivers/staging/media/atomisp/pci/Kconfig b/drivers/staging/media/atomisp/pci/Kconfig index a72421431c7a..41f116d52060 100644 --- a/drivers/staging/media/atomisp/pci/Kconfig +++ b/drivers/staging/media/atomisp/pci/Kconfig @@ -3,11 +3,12 @@ # config VIDEO_ATOMISP - tristate "Intel Atom Image Signal Processor Driver" - depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API - select VIDEOBUF_VMALLOC - ---help--- - Say Y here if your platform supports Intel Atom SoC - camera imaging subsystem. - To compile this driver as a module, choose M here: the - module will be called atomisp + tristate "Intel Atom Image Signal Processor Driver" + depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API + select IOSF_MBI + select VIDEOBUF_VMALLOC + ---help--- + Say Y here if your platform supports Intel Atom SoC + camera imaging subsystem. + To compile this driver as a module, choose M here: the + module will be called atomisp diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp-regs.h b/drivers/staging/media/atomisp/pci/atomisp2/atomisp-regs.h index 513a430ee01a..5d102a4f8aff 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp-regs.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp-regs.h @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_acc.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_acc.c index 1eac329339b7..a6638edee360 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_acc.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_acc.c @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_acc.h b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_acc.h index 5b58e7d9ca5b..56386154643b 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_acc.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_acc.h @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c index f48bf451c1f5..8a18c528cad4 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c @@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ #include <linux/firmware.h> @@ -27,7 +23,8 @@ #include <linux/kfifo.h> #include <linux/pm_runtime.h> #include <linux/timer.h> -#include <asm/intel-mid.h> + +#include <asm/iosf_mbi.h> #include <media/v4l2-event.h> #include <media/videobuf-vmalloc.h> @@ -143,36 +140,36 @@ static int write_target_freq_to_hw(struct atomisp_device *isp, unsigned int ratio, timeout, guar_ratio; u32 isp_sspm1 = 0; int i; + if (!isp->hpll_freq) { dev_err(isp->dev, "failed to get hpll_freq. no change to freq\n"); return -EINVAL; } - isp_sspm1 = intel_mid_msgbus_read32(PUNIT_PORT, ISPSSPM1); + iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, ISPSSPM1, &isp_sspm1); if (isp_sspm1 & ISP_FREQ_VALID_MASK) { dev_dbg(isp->dev, "clearing ISPSSPM1 valid bit.\n"); - intel_mid_msgbus_write32(PUNIT_PORT, ISPSSPM1, + iosf_mbi_write(BT_MBI_UNIT_PMC, MBI_REG_WRITE, ISPSSPM1, isp_sspm1 & ~(1 << ISP_FREQ_VALID_OFFSET)); } ratio = (2 * isp->hpll_freq + new_freq / 2) / new_freq - 1; guar_ratio = (2 * isp->hpll_freq + 200 / 2) / 200 - 1; - isp_sspm1 = intel_mid_msgbus_read32(PUNIT_PORT, ISPSSPM1); + iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, ISPSSPM1, &isp_sspm1); isp_sspm1 &= ~(0x1F << ISP_REQ_FREQ_OFFSET); for (i = 0; i < ISP_DFS_TRY_TIMES; i++) { - intel_mid_msgbus_write32(PUNIT_PORT, ISPSSPM1, + iosf_mbi_write(BT_MBI_UNIT_PMC, MBI_REG_WRITE, ISPSSPM1, isp_sspm1 | ratio << ISP_REQ_FREQ_OFFSET | 1 << ISP_FREQ_VALID_OFFSET | guar_ratio << ISP_REQ_GUAR_FREQ_OFFSET); - isp_sspm1 = intel_mid_msgbus_read32(PUNIT_PORT, ISPSSPM1); - + iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, ISPSSPM1, &isp_sspm1); timeout = 20; while ((isp_sspm1 & ISP_FREQ_VALID_MASK) && timeout) { - isp_sspm1 = intel_mid_msgbus_read32(PUNIT_PORT, ISPSSPM1); + iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, ISPSSPM1, &isp_sspm1); dev_dbg(isp->dev, "waiting for ISPSSPM1 valid bit to be 0.\n"); udelay(100); timeout--; @@ -187,10 +184,10 @@ static int write_target_freq_to_hw(struct atomisp_device *isp, return -EINVAL; } - isp_sspm1 = intel_mid_msgbus_read32(PUNIT_PORT, ISPSSPM1); + iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, ISPSSPM1, &isp_sspm1); timeout = 10; while (((isp_sspm1 >> ISP_FREQ_STAT_OFFSET) != ratio) && timeout) { - isp_sspm1 = intel_mid_msgbus_read32(PUNIT_PORT, ISPSSPM1); + iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, ISPSSPM1, &isp_sspm1); dev_dbg(isp->dev, "waiting for ISPSSPM1 status bit to be 0x%x.\n", new_freq); udelay(100); @@ -1660,20 +1657,15 @@ void atomisp_css_flush(struct atomisp_device *isp) dev_dbg(isp->dev, "atomisp css flush done\n"); } -#ifndef ISP2401 -void atomisp_wdt(unsigned long isp_addr) -#else -void atomisp_wdt(unsigned long pipe_addr) -#endif +void atomisp_wdt(struct timer_list *t) { #ifndef ISP2401 - struct atomisp_device *isp = (struct atomisp_device *)isp_addr; + struct atomisp_sub_device *asd = from_timer(asd, t, wdt); #else - struct atomisp_video_pipe *pipe = - (struct atomisp_video_pipe *)pipe_addr; + struct atomisp_video_pipe *pipe = from_timer(pipe, t, wdt); struct atomisp_sub_device *asd = pipe->asd; - struct atomisp_device *isp = asd->isp; #endif + struct atomisp_device *isp = asd->isp; #ifdef ISP2401 atomic_inc(&pipe->wdt_count); diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.h b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.h index 31ba4e613d13..bdc73862fb79 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.h @@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ @@ -85,11 +81,7 @@ static inline void __iomem *atomisp_get_io_virt_addr(unsigned int address) void atomisp_msi_irq_init(struct atomisp_device *isp, struct pci_dev *dev); void atomisp_msi_irq_uninit(struct atomisp_device *isp, struct pci_dev *dev); void atomisp_wdt_work(struct work_struct *work); -#ifndef ISP2401 -void atomisp_wdt(unsigned long isp_addr); -#else -void atomisp_wdt(unsigned long pipe_addr); -#endif +void atomisp_wdt(struct timer_list *t); void atomisp_setup_flash(struct atomisp_sub_device *asd); irqreturn_t atomisp_isr(int irq, void *dev); irqreturn_t atomisp_isr_thread(int irq, void *isp_ptr); diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_common.h b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_common.h index 69d1526da362..2558193045a6 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_common.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_common.h @@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat.h b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat.h index fb8b8fab4e92..3ef850cd25bd 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat.h @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c index 5027fd20d966..6e87aa5aab4c 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ @@ -4526,7 +4522,7 @@ int atomisp_css_isr_thread(struct atomisp_device *isp, for (i = 0; i < isp->num_of_streams; i++) atomisp_wdt_stop(&isp->asd[i], 0); #ifndef ISP2401 - atomisp_wdt((unsigned long)isp); + atomisp_wdt(&isp->asd[0].wdt); #else queue_work(isp->wdt_work_queue, &isp->wdt_work); #endif diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.h b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.h index b62ad9082018..b03711668eda 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.h @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c index 0592ac1f2832..44c21813a06e 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ #ifdef CONFIG_COMPAT diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.h b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.h index 750478f614d6..685da0f48bab 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.h @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ #ifndef __ATOMISP_COMPAT_IOCTL32_H__ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_csi2.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_csi2.c index 2c5036685447..fa03b78c3580 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_csi2.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_csi2.c @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_csi2.h b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_csi2.h index faa9cf7e05c0..0191d28a55bc 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_csi2.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_csi2.h @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ #ifndef __ATOMISP_CSI2_H__ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_dfs_tables.h b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_dfs_tables.h index 204d941cdb6c..54e28605b5de 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_dfs_tables.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_dfs_tables.h @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ #ifndef __ATOMISP_DFS_TABLES_H__ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_drvfs.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_drvfs.c index 1ae2358de8d4..7129b88456cb 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_drvfs.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_drvfs.c @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ @@ -162,7 +158,7 @@ static ssize_t iunit_dbgopt_store(struct device_driver *drv, const char *buf, return size; } -static struct driver_attribute iunit_drvfs_attrs[] = { +static const struct driver_attribute iunit_drvfs_attrs[] = { __ATTR(dbglvl, 0644, iunit_dbglvl_show, iunit_dbglvl_store), __ATTR(dbgfun, 0644, iunit_dbgfun_show, iunit_dbgfun_store), __ATTR(dbgopt, 0644, iunit_dbgopt_show, iunit_dbgopt_store), diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_drvfs.h b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_drvfs.h index 5cb717b0c1c2..b91bfef21639 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_drvfs.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_drvfs.h @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_file.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_file.c index c766119bf798..377ec2a9fa6d 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_file.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_file.c @@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_file.h b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_file.h index 1b86abd35c38..61fdeb5ee60a 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_file.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_file.h @@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c index d8cfed358d55..dd7596d8763d 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c @@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ @@ -1137,10 +1133,8 @@ static int remove_pad_from_frame(struct atomisp_device *isp, ia_css_ptr store = load; buffer = kmalloc(width*sizeof(load), GFP_KERNEL); - if (!buffer) { - dev_err(isp->dev, "out of memory.\n"); + if (!buffer) return -ENOMEM; - } load += ISP_LEFT_PAD; for (i = 0; i < height; i++) { diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.h b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.h index 8471e391501a..2faab3429d43 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.h @@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_helper.h b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_helper.h index e9650cb75ba5..55ba185b43a0 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_helper.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_helper.h @@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ #ifndef _atomisp_helper_h_ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_internal.h b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_internal.h index 7542a72f1d0f..52a6f8002048 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_internal.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_internal.h @@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ #ifndef __ATOMISP_INTERNAL_H__ @@ -29,9 +25,6 @@ #include <linux/pm_qos.h> #include <linux/idr.h> -#include <asm/intel-mid.h> -#include "../../include/asm/intel_mid_pcihelpers.h" - #include <media/media-device.h> #include <media/v4l2-subdev.h> diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.c index 717647951fb6..339b5d31e1f1 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.c @@ -14,17 +14,12 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ #include <linux/delay.h> #include <linux/pci.h> -#include <asm/intel-mid.h> #include <media/v4l2-ioctl.h> #include <media/v4l2-event.h> @@ -943,10 +938,8 @@ int atomisp_alloc_css_stat_bufs(struct atomisp_sub_device *asd, dev_dbg(isp->dev, "allocating %d 3a buffers\n", count); while (count--) { s3a_buf = kzalloc(sizeof(struct atomisp_s3a_buf), GFP_KERNEL); - if (!s3a_buf) { - dev_err(isp->dev, "s3a stat buf alloc failed\n"); + if (!s3a_buf) goto error; - } if (atomisp_css_allocate_stat_buffers( asd, stream_id, s3a_buf, NULL, NULL)) { @@ -965,7 +958,6 @@ int atomisp_alloc_css_stat_bufs(struct atomisp_sub_device *asd, while (count--) { dis_buf = kzalloc(sizeof(struct atomisp_dis_buf), GFP_KERNEL); if (!dis_buf) { - dev_err(isp->dev, "dis stat buf alloc failed\n"); kfree(s3a_buf); goto error; } @@ -990,10 +982,8 @@ int atomisp_alloc_css_stat_bufs(struct atomisp_sub_device *asd, while (count--) { md_buf = kzalloc(sizeof(struct atomisp_metadata_buf), GFP_KERNEL); - if (!md_buf) { - dev_err(isp->dev, "metadata buf alloc failed\n"); + if (!md_buf) goto error; - } if (atomisp_css_allocate_stat_buffers( asd, stream_id, NULL, NULL, md_buf)) { @@ -2943,13 +2933,15 @@ static long atomisp_vidioc_default(struct file *file, void *fh, #else if (isp->motor) #endif - err = v4l2_subdev_call( #ifndef ISP2401 + err = v4l2_subdev_call( isp->inputs[asd->input_curr].motor, + core, ioctl, cmd, arg); #else + err = v4l2_subdev_call( isp->motor, -#endif core, ioctl, cmd, arg); +#endif else err = v4l2_subdev_call( isp->inputs[asd->input_curr].camera, diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.h b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.h index fb5fadb5332b..0d2785b9ef99 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.h @@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_subdev.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_subdev.c index 744ab6eb42a0..70b53988553c 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_subdev.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_subdev.c @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ #include <linux/module.h> @@ -25,7 +21,6 @@ #include <linux/mm.h> #include <linux/sched.h> #include <linux/slab.h> -#include <asm/intel-mid.h> #include <media/v4l2-event.h> #include <media/v4l2-mediabus.h> diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_subdev.h b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_subdev.h index ba5c2ab14253..f3d61827ae8c 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_subdev.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_subdev.h @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ #ifndef __ATOMISP_SUBDEV_H__ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_tables.h b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_tables.h index af09218d8b71..319ded6a96da 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_tables.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_tables.h @@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ #ifndef __ATOMISP_TABLES_H__ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_tpg.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_tpg.c index 48b96048cab4..b71cc7bcdbab 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_tpg.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_tpg.c @@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_tpg.h b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_tpg.h index 64ab60f02e85..af354c4bfd3e 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_tpg.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_tpg.h @@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_trace_event.h b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_trace_event.h index 5ce282d6c939..462b296554c7 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_trace_event.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_trace_event.h @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ #undef TRACE_SYSTEM diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c index 663aa916e3ca..3c260f8b52e2 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c @@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ #include <linux/module.h> @@ -28,6 +24,8 @@ #include <linux/delay.h> #include <linux/interrupt.h> +#include <asm/iosf_mbi.h> + #include "../../include/linux/atomisp_gmin_platform.h" #include "atomisp_cmd.h" @@ -46,7 +44,6 @@ #include "hrt/hive_isp_css_mm_hrt.h" #include "device_access.h" -#include <asm/intel-mid.h> /* G-Min addition: pull this in from intel_mid_pm.h */ #define CSTATE_EXIT_LATENCY_C1 1 @@ -386,28 +383,23 @@ done: */ static void punit_ddr_dvfs_enable(bool enable) { - int reg = intel_mid_msgbus_read32(PUNIT_PORT, MRFLD_ISPSSDVFS); int door_bell = 1 << 8; int max_wait = 30; + int reg; + iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, MRFLD_ISPSSDVFS, ®); if (enable) { reg &= ~(MRFLD_BIT0 | MRFLD_BIT1); } else { reg |= (MRFLD_BIT1 | door_bell); reg &= ~(MRFLD_BIT0); } + iosf_mbi_write(BT_MBI_UNIT_PMC, MBI_REG_WRITE, MRFLD_ISPSSDVFS, reg); - intel_mid_msgbus_write32(PUNIT_PORT, MRFLD_ISPSSDVFS, reg); - - /*Check Req_ACK to see freq status, wait until door_bell is cleared*/ - if (reg & door_bell) { - while (max_wait--) { - if (0 == (intel_mid_msgbus_read32(PUNIT_PORT, - MRFLD_ISPSSDVFS) & door_bell)) - break; - - usleep_range(100, 500); - } + /* Check Req_ACK to see freq status, wait until door_bell is cleared */ + while ((reg & door_bell) && max_wait--) { + iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, MRFLD_ISPSSDVFS, ®); + usleep_range(100, 500); } if (max_wait == -1) @@ -421,10 +413,10 @@ int atomisp_mrfld_power_down(struct atomisp_device *isp) u32 reg_value; /* writing 0x3 to ISPSSPM0 bit[1:0] to power off the IUNIT */ - reg_value = intel_mid_msgbus_read32(PUNIT_PORT, MRFLD_ISPSSPM0); + iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, MRFLD_ISPSSPM0, ®_value); reg_value &= ~MRFLD_ISPSSPM0_ISPSSC_MASK; reg_value |= MRFLD_ISPSSPM0_IUNIT_POWER_OFF; - intel_mid_msgbus_write32(PUNIT_PORT, MRFLD_ISPSSPM0, reg_value); + iosf_mbi_write(BT_MBI_UNIT_PMC, MBI_REG_WRITE, MRFLD_ISPSSPM0, reg_value); /*WA:Enable DVFS*/ if (IS_CHT) @@ -437,8 +429,7 @@ int atomisp_mrfld_power_down(struct atomisp_device *isp) */ timeout = jiffies + msecs_to_jiffies(50); while (1) { - reg_value = intel_mid_msgbus_read32(PUNIT_PORT, - MRFLD_ISPSSPM0); + iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, MRFLD_ISPSSPM0, ®_value); dev_dbg(isp->dev, "power-off in progress, ISPSSPM0: 0x%x\n", reg_value); /* wait until ISPSSPM0 bit[25:24] shows 0x3 */ @@ -477,14 +468,14 @@ int atomisp_mrfld_power_up(struct atomisp_device *isp) msleep(10); /* writing 0x0 to ISPSSPM0 bit[1:0] to power off the IUNIT */ - reg_value = intel_mid_msgbus_read32(PUNIT_PORT, MRFLD_ISPSSPM0); + iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, MRFLD_ISPSSPM0, ®_value); reg_value &= ~MRFLD_ISPSSPM0_ISPSSC_MASK; - intel_mid_msgbus_write32(PUNIT_PORT, MRFLD_ISPSSPM0, reg_value); + iosf_mbi_write(BT_MBI_UNIT_PMC, MBI_REG_WRITE, MRFLD_ISPSSPM0, reg_value); /* FIXME: experienced value for delay */ timeout = jiffies + msecs_to_jiffies(50); while (1) { - reg_value = intel_mid_msgbus_read32(PUNIT_PORT, MRFLD_ISPSSPM0); + iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, MRFLD_ISPSSPM0, ®_value); dev_dbg(isp->dev, "power-on in progress, ISPSSPM0: 0x%x\n", reg_value); /* wait until ISPSSPM0 bit[25:24] shows 0x0 */ @@ -755,7 +746,6 @@ static int atomisp_subdev_probe(struct atomisp_device *isp) &subdevs->v4l2_subdev.board_info; struct i2c_adapter *adapter = i2c_get_adapter(subdevs->v4l2_subdev.i2c_adapter_id); - struct camera_sensor_platform_data *sensor_pdata; int sensor_num, i; if (adapter == NULL) { @@ -807,13 +797,7 @@ static int atomisp_subdev_probe(struct atomisp_device *isp) * pixel_format. */ isp->inputs[isp->input_cnt].frame_size.pixel_format = 0; - sensor_pdata = (struct camera_sensor_platform_data *) - board_info->platform_data; - if (sensor_pdata->get_camera_caps) - isp->inputs[isp->input_cnt].camera_caps = - sensor_pdata->get_camera_caps(); - else - isp->inputs[isp->input_cnt].camera_caps = + isp->inputs[isp->input_cnt].camera_caps = atomisp_get_default_camera_caps(); sensor_num = isp->inputs[isp->input_cnt] .camera_caps->sensor_num; @@ -1020,7 +1004,7 @@ csi_and_subdev_probe_failed: v4l2_device_unregister(&isp->v4l2_dev); v4l2_device_failed: media_device_unregister(&isp->media_dev); - media_device_cleanup(&isp->media_dev); + media_device_cleanup(&isp->media_dev); return ret; } @@ -1155,17 +1139,12 @@ static int init_atomisp_wdts(struct atomisp_device *isp) struct atomisp_sub_device *asd = &isp->asd[i]; asd = &isp->asd[i]; #ifndef ISP2401 - setup_timer(&asd->wdt, atomisp_wdt, (unsigned long)isp); + timer_setup(&asd->wdt, atomisp_wdt, 0); #else - setup_timer(&asd->video_out_capture.wdt, - atomisp_wdt, (unsigned long)&asd->video_out_capture); - setup_timer(&asd->video_out_preview.wdt, - atomisp_wdt, (unsigned long)&asd->video_out_preview); - setup_timer(&asd->video_out_vf.wdt, - atomisp_wdt, (unsigned long)&asd->video_out_vf); - setup_timer(&asd->video_out_video_capture.wdt, - atomisp_wdt, - (unsigned long)&asd->video_out_video_capture); + timer_setup(&asd->video_out_capture.wdt, atomisp_wdt, 0); + timer_setup(&asd->video_out_preview.wdt, atomisp_wdt, 0); + timer_setup(&asd->video_out_vf.wdt, atomisp_wdt, 0); + timer_setup(&asd->video_out_video_capture.wdt, atomisp_wdt, 0); #endif } return 0; @@ -1323,7 +1302,7 @@ static int atomisp_pci_probe(struct pci_dev *dev, isp->dfs = &dfs_config_cht; isp->pdev->d3cold_delay = 0; - val = intel_mid_msgbus_read32(CCK_PORT, CCK_FUSE_REG_0); + iosf_mbi_read(CCK_PORT, MBI_REG_READ, CCK_FUSE_REG_0, &val); switch (val & CCK_FUSE_HPLL_FREQ_MASK) { case 0x00: isp->hpll_freq = HPLL_FREQ_800MHZ; diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.h b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.h index 191b2e57a810..944a6cf40a2f 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.h @@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/base/circbuf/interface/ia_css_circbuf.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/base/circbuf/interface/ia_css_circbuf.h index 766218ed3649..914aa7f98700 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/base/circbuf/interface/ia_css_circbuf.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/base/circbuf/interface/ia_css_circbuf.h @@ -18,7 +18,6 @@ #include <sp.h> #include <type_support.h> #include <math_support.h> -#include <storage_class.h> #include <assert_support.h> #include <platform_support.h> #include "ia_css_circbuf_comm.h" @@ -45,7 +44,7 @@ struct ia_css_circbuf_s { * @param elems An array of elements. * @param desc The descriptor set to the size using ia_css_circbuf_desc_init(). */ -STORAGE_CLASS_EXTERN void ia_css_circbuf_create( +extern void ia_css_circbuf_create( ia_css_circbuf_t *cb, ia_css_circbuf_elem_t *elems, ia_css_circbuf_desc_t *desc); @@ -55,7 +54,7 @@ STORAGE_CLASS_EXTERN void ia_css_circbuf_create( * * @param cb The pointer to the circular buffer. */ -STORAGE_CLASS_EXTERN void ia_css_circbuf_destroy( +extern void ia_css_circbuf_destroy( ia_css_circbuf_t *cb); /** @@ -68,7 +67,7 @@ STORAGE_CLASS_EXTERN void ia_css_circbuf_destroy( * * @return the pop-out value. */ -STORAGE_CLASS_EXTERN uint32_t ia_css_circbuf_pop( +extern uint32_t ia_css_circbuf_pop( ia_css_circbuf_t *cb); /** @@ -82,7 +81,7 @@ STORAGE_CLASS_EXTERN uint32_t ia_css_circbuf_pop( * * @return the extracted value. */ -STORAGE_CLASS_EXTERN uint32_t ia_css_circbuf_extract( +extern uint32_t ia_css_circbuf_extract( ia_css_circbuf_t *cb, int offset); @@ -97,7 +96,7 @@ STORAGE_CLASS_EXTERN uint32_t ia_css_circbuf_extract( * @param elem The pointer to the element. * @param val The value to be set. */ -STORAGE_CLASS_INLINE void ia_css_circbuf_elem_set_val( +static inline void ia_css_circbuf_elem_set_val( ia_css_circbuf_elem_t *elem, uint32_t val) { @@ -111,7 +110,7 @@ STORAGE_CLASS_INLINE void ia_css_circbuf_elem_set_val( * * @param elem The pointer to the element. */ -STORAGE_CLASS_INLINE void ia_css_circbuf_elem_init( +static inline void ia_css_circbuf_elem_init( ia_css_circbuf_elem_t *elem) { OP___assert(elem != NULL); @@ -124,7 +123,7 @@ STORAGE_CLASS_INLINE void ia_css_circbuf_elem_init( * @param src The element as the copy source. * @param dest The element as the copy destination. */ -STORAGE_CLASS_INLINE void ia_css_circbuf_elem_cpy( +static inline void ia_css_circbuf_elem_cpy( ia_css_circbuf_elem_t *src, ia_css_circbuf_elem_t *dest) { @@ -143,7 +142,7 @@ STORAGE_CLASS_INLINE void ia_css_circbuf_elem_cpy( * * @return the position at offset. */ -STORAGE_CLASS_INLINE uint8_t ia_css_circbuf_get_pos_at_offset( +static inline uint8_t ia_css_circbuf_get_pos_at_offset( ia_css_circbuf_t *cb, uint32_t base, int offset) @@ -176,7 +175,7 @@ STORAGE_CLASS_INLINE uint8_t ia_css_circbuf_get_pos_at_offset( * * @return the offset. */ -STORAGE_CLASS_INLINE int ia_css_circbuf_get_offset( +static inline int ia_css_circbuf_get_offset( ia_css_circbuf_t *cb, uint32_t src_pos, uint32_t dest_pos) @@ -201,7 +200,7 @@ STORAGE_CLASS_INLINE int ia_css_circbuf_get_offset( * * TODO: Test this API. */ -STORAGE_CLASS_INLINE uint32_t ia_css_circbuf_get_size( +static inline uint32_t ia_css_circbuf_get_size( ia_css_circbuf_t *cb) { OP___assert(cb != NULL); @@ -217,7 +216,7 @@ STORAGE_CLASS_INLINE uint32_t ia_css_circbuf_get_size( * * @return the number of available elements. */ -STORAGE_CLASS_INLINE uint32_t ia_css_circbuf_get_num_elems( +static inline uint32_t ia_css_circbuf_get_num_elems( ia_css_circbuf_t *cb) { int num; @@ -239,7 +238,7 @@ STORAGE_CLASS_INLINE uint32_t ia_css_circbuf_get_num_elems( * - true when it is empty. * - false when it is not empty. */ -STORAGE_CLASS_INLINE bool ia_css_circbuf_is_empty( +static inline bool ia_css_circbuf_is_empty( ia_css_circbuf_t *cb) { OP___assert(cb != NULL); @@ -257,7 +256,7 @@ STORAGE_CLASS_INLINE bool ia_css_circbuf_is_empty( * - true when it is full. * - false when it is not full. */ -STORAGE_CLASS_INLINE bool ia_css_circbuf_is_full(ia_css_circbuf_t *cb) +static inline bool ia_css_circbuf_is_full(ia_css_circbuf_t *cb) { OP___assert(cb != NULL); OP___assert(cb->desc != NULL); @@ -274,7 +273,7 @@ STORAGE_CLASS_INLINE bool ia_css_circbuf_is_full(ia_css_circbuf_t *cb) * @param cb The pointer to the circular buffer. * @param elem The new element. */ -STORAGE_CLASS_INLINE void ia_css_circbuf_write( +static inline void ia_css_circbuf_write( ia_css_circbuf_t *cb, ia_css_circbuf_elem_t elem) { @@ -298,7 +297,7 @@ STORAGE_CLASS_INLINE void ia_css_circbuf_write( * @param cb The pointer to the circular buffer. * @param val The value to be pushed in. */ -STORAGE_CLASS_INLINE void ia_css_circbuf_push( +static inline void ia_css_circbuf_push( ia_css_circbuf_t *cb, uint32_t val) { @@ -321,7 +320,7 @@ STORAGE_CLASS_INLINE void ia_css_circbuf_push( * * @return: The number of free elements. */ -STORAGE_CLASS_INLINE uint32_t ia_css_circbuf_get_free_elems( +static inline uint32_t ia_css_circbuf_get_free_elems( ia_css_circbuf_t *cb) { OP___assert(cb != NULL); @@ -338,7 +337,7 @@ STORAGE_CLASS_INLINE uint32_t ia_css_circbuf_get_free_elems( * * @return the elements value. */ -STORAGE_CLASS_EXTERN uint32_t ia_css_circbuf_peek( +extern uint32_t ia_css_circbuf_peek( ia_css_circbuf_t *cb, int offset); @@ -350,7 +349,7 @@ STORAGE_CLASS_EXTERN uint32_t ia_css_circbuf_peek( * * @return the elements value. */ -STORAGE_CLASS_EXTERN uint32_t ia_css_circbuf_peek_from_start( +extern uint32_t ia_css_circbuf_peek_from_start( ia_css_circbuf_t *cb, int offset); @@ -369,7 +368,7 @@ STORAGE_CLASS_EXTERN uint32_t ia_css_circbuf_peek_from_start( * @return true on succesfully increasing the size * false on failure */ -STORAGE_CLASS_EXTERN bool ia_css_circbuf_increase_size( +extern bool ia_css_circbuf_increase_size( ia_css_circbuf_t *cb, unsigned int sz_delta, ia_css_circbuf_elem_t *elems); diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/base/circbuf/interface/ia_css_circbuf_desc.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/base/circbuf/interface/ia_css_circbuf_desc.h index a8447d409c31..8dd7cd6cd3d8 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/base/circbuf/interface/ia_css_circbuf_desc.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/base/circbuf/interface/ia_css_circbuf_desc.h @@ -17,7 +17,6 @@ #include <type_support.h> #include <math_support.h> -#include <storage_class.h> #include <platform_support.h> #include <sp.h> #include "ia_css_circbuf_comm.h" @@ -35,7 +34,7 @@ * - true when it is empty. * - false when it is not empty. */ -STORAGE_CLASS_INLINE bool ia_css_circbuf_desc_is_empty( +static inline bool ia_css_circbuf_desc_is_empty( ia_css_circbuf_desc_t *cb_desc) { OP___assert(cb_desc != NULL); @@ -52,7 +51,7 @@ STORAGE_CLASS_INLINE bool ia_css_circbuf_desc_is_empty( * - true when it is full. * - false when it is not full. */ -STORAGE_CLASS_INLINE bool ia_css_circbuf_desc_is_full( +static inline bool ia_css_circbuf_desc_is_full( ia_css_circbuf_desc_t *cb_desc) { OP___assert(cb_desc != NULL); @@ -65,7 +64,7 @@ STORAGE_CLASS_INLINE bool ia_css_circbuf_desc_is_full( * @param cb_desc The pointer circular buffer descriptor * @param size The size of the circular buffer */ -STORAGE_CLASS_INLINE void ia_css_circbuf_desc_init( +static inline void ia_css_circbuf_desc_init( ia_css_circbuf_desc_t *cb_desc, int8_t size) { @@ -82,7 +81,7 @@ STORAGE_CLASS_INLINE void ia_css_circbuf_desc_init( * * @return the position in the circular buffer descriptor. */ -STORAGE_CLASS_INLINE uint8_t ia_css_circbuf_desc_get_pos_at_offset( +static inline uint8_t ia_css_circbuf_desc_get_pos_at_offset( ia_css_circbuf_desc_t *cb_desc, uint32_t base, int offset) @@ -114,7 +113,7 @@ STORAGE_CLASS_INLINE uint8_t ia_css_circbuf_desc_get_pos_at_offset( * * @return the offset. */ -STORAGE_CLASS_INLINE int ia_css_circbuf_desc_get_offset( +static inline int ia_css_circbuf_desc_get_offset( ia_css_circbuf_desc_t *cb_desc, uint32_t src_pos, uint32_t dest_pos) @@ -135,7 +134,7 @@ STORAGE_CLASS_INLINE int ia_css_circbuf_desc_get_offset( * * @return The number of available elements. */ -STORAGE_CLASS_INLINE uint32_t ia_css_circbuf_desc_get_num_elems( +static inline uint32_t ia_css_circbuf_desc_get_num_elems( ia_css_circbuf_desc_t *cb_desc) { int num; @@ -155,7 +154,7 @@ STORAGE_CLASS_INLINE uint32_t ia_css_circbuf_desc_get_num_elems( * * @return: The number of free elements. */ -STORAGE_CLASS_INLINE uint32_t ia_css_circbuf_desc_get_free_elems( +static inline uint32_t ia_css_circbuf_desc_get_free_elems( ia_css_circbuf_desc_t *cb_desc) { uint32_t num; diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/camera/pipe/src/pipe_binarydesc.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/camera/pipe/src/pipe_binarydesc.c index 17d3b7de93ba..98a2a3e9b3e6 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/camera/pipe/src/pipe_binarydesc.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/camera/pipe/src/pipe_binarydesc.c @@ -22,6 +22,7 @@ #include <assert_support.h> /* HRT_GDC_N */ #include "gdc_device.h" +#include <linux/kernel.h> /* This module provides a binary descriptions to used to find a binary. Since, * every stage is associated with a binary, it implicity helps stage @@ -147,11 +148,9 @@ enum ia_css_err sh_css_bds_factor_get_numerator_denominator( unsigned int *bds_factor_denominator) { unsigned int i; - unsigned int bds_list_size = sizeof(bds_factors_list) / - sizeof(struct sh_css_bds_factor); /* Loop over all bds factors until a match is found */ - for (i = 0; i < bds_list_size; i++) { + for (i = 0; i < ARRAY_SIZE(bds_factors_list); i++) { if (bds_factors_list[i].bds_factor == bds_factor) { *bds_factor_numerator = bds_factors_list[i].numerator; *bds_factor_denominator = bds_factors_list[i].denominator; @@ -170,8 +169,6 @@ enum ia_css_err binarydesc_calculate_bds_factor( unsigned int *bds_factor) { unsigned int i; - unsigned int bds_list_size = sizeof(bds_factors_list) / - sizeof(struct sh_css_bds_factor); unsigned int in_w = input_res.width, in_h = input_res.height, out_w = output_res.width, out_h = output_res.height; @@ -186,7 +183,7 @@ enum ia_css_err binarydesc_calculate_bds_factor( assert(out_w != 0 && out_h != 0); /* Loop over all bds factors until a match is found */ - for (i = 0; i < bds_list_size; i++) { + for (i = 0; i < ARRAY_SIZE(bds_factors_list); i++) { unsigned num = bds_factors_list[i].numerator; unsigned den = bds_factors_list[i].denominator; diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/camera/util/src/util.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/camera/util/src/util.c index 08f486e20a65..54193789a809 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/camera/util/src/util.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/camera/util/src/util.c @@ -111,7 +111,7 @@ unsigned int ia_css_util_input_format_bpp( break; } -return rval; + return rval; } enum ia_css_err ia_css_util_check_vf_info( diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/input_formatter_subsystem_defs.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/input_formatter_subsystem_defs.h index 16bfe1d80bc9..7766f78cd123 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/input_formatter_subsystem_defs.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/input_formatter_subsystem_defs.h @@ -12,7 +12,7 @@ * more details. */ -#ifndef _if_subsystem_defs_h +#ifndef _if_subsystem_defs_h__ #define _if_subsystem_defs_h__ #define HIVE_IFMT_GP_REGS_INPUT_SWITCH_LUT_REG_0 0 diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/csi_rx_private.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/csi_rx_private.h index 5819bcff5e55..6720ab55d6f5 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/csi_rx_private.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/csi_rx_private.h @@ -34,7 +34,7 @@ * @brief Get the csi rx fe state. * Refer to "csi_rx_public.h" for details. */ -STORAGE_CLASS_CSI_RX_C void csi_rx_fe_ctrl_get_state( +static inline void csi_rx_fe_ctrl_get_state( const csi_rx_frontend_ID_t ID, csi_rx_fe_ctrl_state_t *state) { @@ -73,7 +73,7 @@ STORAGE_CLASS_CSI_RX_C void csi_rx_fe_ctrl_get_state( * @brief Get the state of the csi rx fe dlane process. * Refer to "csi_rx_public.h" for details. */ -STORAGE_CLASS_CSI_RX_C void csi_rx_fe_ctrl_get_dlane_state( +static inline void csi_rx_fe_ctrl_get_dlane_state( const csi_rx_frontend_ID_t ID, const uint32_t lane, csi_rx_fe_ctrl_lane_t *dlane_state) @@ -89,7 +89,7 @@ STORAGE_CLASS_CSI_RX_C void csi_rx_fe_ctrl_get_dlane_state( * @brief dump the csi rx fe state. * Refer to "csi_rx_public.h" for details. */ -STORAGE_CLASS_CSI_RX_C void csi_rx_fe_ctrl_dump_state( +static inline void csi_rx_fe_ctrl_dump_state( const csi_rx_frontend_ID_t ID, csi_rx_fe_ctrl_state_t *state) { @@ -118,7 +118,7 @@ STORAGE_CLASS_CSI_RX_C void csi_rx_fe_ctrl_dump_state( * @brief Get the csi rx be state. * Refer to "csi_rx_public.h" for details. */ -STORAGE_CLASS_CSI_RX_C void csi_rx_be_ctrl_get_state( +static inline void csi_rx_be_ctrl_get_state( const csi_rx_backend_ID_t ID, csi_rx_be_ctrl_state_t *state) { @@ -181,7 +181,7 @@ STORAGE_CLASS_CSI_RX_C void csi_rx_be_ctrl_get_state( * @brief Dump the csi rx be state. * Refer to "csi_rx_public.h" for details. */ -STORAGE_CLASS_CSI_RX_C void csi_rx_be_ctrl_dump_state( +static inline void csi_rx_be_ctrl_dump_state( const csi_rx_backend_ID_t ID, csi_rx_be_ctrl_state_t *state) { @@ -225,7 +225,7 @@ STORAGE_CLASS_CSI_RX_C void csi_rx_be_ctrl_dump_state( * @brief Load the register value. * Refer to "csi_rx_public.h" for details. */ -STORAGE_CLASS_CSI_RX_C hrt_data csi_rx_fe_ctrl_reg_load( +static inline hrt_data csi_rx_fe_ctrl_reg_load( const csi_rx_frontend_ID_t ID, const hrt_address reg) { @@ -239,7 +239,7 @@ STORAGE_CLASS_CSI_RX_C hrt_data csi_rx_fe_ctrl_reg_load( * @brief Store a value to the register. * Refer to "ibuf_ctrl_public.h" for details. */ -STORAGE_CLASS_CSI_RX_C void csi_rx_fe_ctrl_reg_store( +static inline void csi_rx_fe_ctrl_reg_store( const csi_rx_frontend_ID_t ID, const hrt_address reg, const hrt_data value) @@ -253,7 +253,7 @@ STORAGE_CLASS_CSI_RX_C void csi_rx_fe_ctrl_reg_store( * @brief Load the register value. * Refer to "csi_rx_public.h" for details. */ -STORAGE_CLASS_CSI_RX_C hrt_data csi_rx_be_ctrl_reg_load( +static inline hrt_data csi_rx_be_ctrl_reg_load( const csi_rx_backend_ID_t ID, const hrt_address reg) { @@ -267,7 +267,7 @@ STORAGE_CLASS_CSI_RX_C hrt_data csi_rx_be_ctrl_reg_load( * @brief Store a value to the register. * Refer to "ibuf_ctrl_public.h" for details. */ -STORAGE_CLASS_CSI_RX_C void csi_rx_be_ctrl_reg_store( +static inline void csi_rx_be_ctrl_reg_store( const csi_rx_backend_ID_t ID, const hrt_address reg, const hrt_data value) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/input_formatter_subsystem_defs.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/input_formatter_subsystem_defs.h index 16bfe1d80bc9..7766f78cd123 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/input_formatter_subsystem_defs.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/input_formatter_subsystem_defs.h @@ -12,7 +12,7 @@ * more details. */ -#ifndef _if_subsystem_defs_h +#ifndef _if_subsystem_defs_h__ #define _if_subsystem_defs_h__ #define HIVE_IFMT_GP_REGS_INPUT_SWITCH_LUT_REG_0 0 diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/input_formatter_subsystem_defs.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/input_formatter_subsystem_defs.h index 16bfe1d80bc9..7766f78cd123 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/input_formatter_subsystem_defs.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/input_formatter_subsystem_defs.h @@ -12,7 +12,7 @@ * more details. */ -#ifndef _if_subsystem_defs_h +#ifndef _if_subsystem_defs_h__ #define _if_subsystem_defs_h__ #define HIVE_IFMT_GP_REGS_INPUT_SWITCH_LUT_REG_0 0 diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/dma.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/dma.c index 87a25d4289ec..770db7dff5d3 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/dma.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/dma.c @@ -12,7 +12,7 @@ * more details. */ -#include <stddef.h> /* NULL */ +#include <linux/kernel.h> #include "dma.h" diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/event_fifo_private.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/event_fifo_private.h index 9d3a29696094..bcfb734c2ed3 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/event_fifo_private.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/event_fifo_private.h @@ -28,7 +28,7 @@ STORAGE_CLASS_EVENT_C void event_wait_for(const event_ID_t ID) assert(ID < N_EVENT_ID); assert(event_source_addr[ID] != ((hrt_address)-1)); (void)ia_css_device_load_uint32(event_source_addr[ID]); -return; + return; } STORAGE_CLASS_EVENT_C void cnd_event_wait_for(const event_ID_t ID, diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/fifo_monitor.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/fifo_monitor.c index 1087944d637f..1bf292401adc 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/fifo_monitor.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/fifo_monitor.c @@ -38,12 +38,12 @@ STORAGE_CLASS_FIFO_MONITOR_DATA unsigned int FIFO_SWITCH_ADDR[N_FIFO_SWITCH] = { #include "fifo_monitor_private.h" #endif /* __INLINE_FIFO_MONITOR__ */ -STORAGE_CLASS_INLINE bool fifo_monitor_status_valid ( +static inline bool fifo_monitor_status_valid ( const fifo_monitor_ID_t ID, const unsigned int reg, const unsigned int port_id); -STORAGE_CLASS_INLINE bool fifo_monitor_status_accept( +static inline bool fifo_monitor_status_accept( const fifo_monitor_ID_t ID, const unsigned int reg, const unsigned int port_id); @@ -546,7 +546,7 @@ void fifo_monitor_get_state( return; } -STORAGE_CLASS_INLINE bool fifo_monitor_status_valid ( +static inline bool fifo_monitor_status_valid ( const fifo_monitor_ID_t ID, const unsigned int reg, const unsigned int port_id) @@ -556,7 +556,7 @@ STORAGE_CLASS_INLINE bool fifo_monitor_status_valid ( return (data >> (((port_id * 2) + _hive_str_mon_valid_offset))) & 0x1; } -STORAGE_CLASS_INLINE bool fifo_monitor_status_accept( +static inline bool fifo_monitor_status_accept( const fifo_monitor_ID_t ID, const unsigned int reg, const unsigned int port_id) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/fifo_monitor_private.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/fifo_monitor_private.h index 618b2f7e9c75..d58cd7d1828d 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/fifo_monitor_private.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/fifo_monitor_private.h @@ -33,26 +33,26 @@ STORAGE_CLASS_FIFO_MONITOR_C void fifo_switch_set( const fifo_switch_t switch_id, const hrt_data sel) { -assert(ID == FIFO_MONITOR0_ID); -assert(FIFO_MONITOR_BASE[ID] != (hrt_address)-1); -assert(switch_id < N_FIFO_SWITCH); + assert(ID == FIFO_MONITOR0_ID); + assert(FIFO_MONITOR_BASE[ID] != (hrt_address)-1); + assert(switch_id < N_FIFO_SWITCH); (void)ID; gp_device_reg_store(GP_DEVICE0_ID, FIFO_SWITCH_ADDR[switch_id], sel); -return; + return; } STORAGE_CLASS_FIFO_MONITOR_C hrt_data fifo_switch_get( const fifo_monitor_ID_t ID, const fifo_switch_t switch_id) { -assert(ID == FIFO_MONITOR0_ID); -assert(FIFO_MONITOR_BASE[ID] != (hrt_address)-1); -assert(switch_id < N_FIFO_SWITCH); + assert(ID == FIFO_MONITOR0_ID); + assert(FIFO_MONITOR_BASE[ID] != (hrt_address)-1); + assert(switch_id < N_FIFO_SWITCH); (void)ID; -return gp_device_reg_load(GP_DEVICE0_ID, FIFO_SWITCH_ADDR[switch_id]); + return gp_device_reg_load(GP_DEVICE0_ID, FIFO_SWITCH_ADDR[switch_id]); } @@ -61,19 +61,19 @@ STORAGE_CLASS_FIFO_MONITOR_C void fifo_monitor_reg_store( const unsigned int reg, const hrt_data value) { -assert(ID < N_FIFO_MONITOR_ID); -assert(FIFO_MONITOR_BASE[ID] != (hrt_address)-1); + assert(ID < N_FIFO_MONITOR_ID); + assert(FIFO_MONITOR_BASE[ID] != (hrt_address)-1); ia_css_device_store_uint32(FIFO_MONITOR_BASE[ID] + reg*sizeof(hrt_data), value); -return; + return; } STORAGE_CLASS_FIFO_MONITOR_C hrt_data fifo_monitor_reg_load( const fifo_monitor_ID_t ID, const unsigned int reg) { -assert(ID < N_FIFO_MONITOR_ID); -assert(FIFO_MONITOR_BASE[ID] != (hrt_address)-1); -return ia_css_device_load_uint32(FIFO_MONITOR_BASE[ID] + reg*sizeof(hrt_data)); + assert(ID < N_FIFO_MONITOR_ID); + assert(FIFO_MONITOR_BASE[ID] != (hrt_address)-1); + return ia_css_device_load_uint32(FIFO_MONITOR_BASE[ID] + reg*sizeof(hrt_data)); } #endif /* __FIFO_MONITOR_PRIVATE_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gdc.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gdc.c index 69fa616889b1..1966b147f8ab 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gdc.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gdc.c @@ -22,12 +22,12 @@ /* * Local function declarations */ -STORAGE_CLASS_INLINE void gdc_reg_store( +static inline void gdc_reg_store( const gdc_ID_t ID, const unsigned int reg, const hrt_data value); -STORAGE_CLASS_INLINE hrt_data gdc_reg_load( +static inline hrt_data gdc_reg_load( const gdc_ID_t ID, const unsigned int reg); @@ -62,7 +62,7 @@ void gdc_lut_store( gdc_reg_store(ID, lut_offset++, word_0); gdc_reg_store(ID, lut_offset++, word_1); } -return; + return; } /* @@ -103,25 +103,25 @@ int gdc_get_unity( { assert(ID < N_GDC_ID); (void)ID; -return (int)(1UL << HRT_GDC_FRAC_BITS); + return (int)(1UL << HRT_GDC_FRAC_BITS); } /* * Local function implementations */ -STORAGE_CLASS_INLINE void gdc_reg_store( +static inline void gdc_reg_store( const gdc_ID_t ID, const unsigned int reg, const hrt_data value) { ia_css_device_store_uint32(GDC_BASE[ID] + reg*sizeof(hrt_data), value); -return; + return; } -STORAGE_CLASS_INLINE hrt_data gdc_reg_load( +static inline hrt_data gdc_reg_load( const gdc_ID_t ID, const unsigned int reg) { -return ia_css_device_load_uint32(GDC_BASE[ID] + reg*sizeof(hrt_data)); + return ia_css_device_load_uint32(GDC_BASE[ID] + reg*sizeof(hrt_data)); } diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gp_device.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gp_device.c index 9a34ac052adf..da88aa3af664 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gp_device.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gp_device.c @@ -104,5 +104,5 @@ void gp_device_get_state( _REG_GP_SYNCGEN_FRAME_CNT_ADDR); state->soft_reset = gp_device_reg_load(ID, _REG_GP_SOFT_RESET_ADDR); -return; + return; } diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gp_device_private.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gp_device_private.h index bce1fdf79114..7c0362c29411 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gp_device_private.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gp_device_private.h @@ -26,21 +26,21 @@ STORAGE_CLASS_GP_DEVICE_C void gp_device_reg_store( const unsigned int reg_addr, const hrt_data value) { -assert(ID < N_GP_DEVICE_ID); -assert(GP_DEVICE_BASE[ID] != (hrt_address)-1); -assert((reg_addr % sizeof(hrt_data)) == 0); + assert(ID < N_GP_DEVICE_ID); + assert(GP_DEVICE_BASE[ID] != (hrt_address)-1); + assert((reg_addr % sizeof(hrt_data)) == 0); ia_css_device_store_uint32(GP_DEVICE_BASE[ID] + reg_addr, value); -return; + return; } STORAGE_CLASS_GP_DEVICE_C hrt_data gp_device_reg_load( const gp_device_ID_t ID, const hrt_address reg_addr) { -assert(ID < N_GP_DEVICE_ID); -assert(GP_DEVICE_BASE[ID] != (hrt_address)-1); -assert((reg_addr % sizeof(hrt_data)) == 0); -return ia_css_device_load_uint32(GP_DEVICE_BASE[ID] + reg_addr); + assert(ID < N_GP_DEVICE_ID); + assert(GP_DEVICE_BASE[ID] != (hrt_address)-1); + assert((reg_addr % sizeof(hrt_data)) == 0); + return ia_css_device_load_uint32(GP_DEVICE_BASE[ID] + reg_addr); } #endif /* __GP_DEVICE_PRIVATE_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gpio_private.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gpio_private.h index 6ace2184b522..b6ebf34eaa9d 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gpio_private.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gpio_private.h @@ -29,7 +29,7 @@ STORAGE_CLASS_GPIO_C void gpio_reg_store( OP___assert(ID < N_GPIO_ID); OP___assert(GPIO_BASE[ID] != (hrt_address)-1); ia_css_device_store_uint32(GPIO_BASE[ID] + reg*sizeof(hrt_data), value); -return; + return; } STORAGE_CLASS_GPIO_C hrt_data gpio_reg_load( @@ -38,7 +38,7 @@ STORAGE_CLASS_GPIO_C hrt_data gpio_reg_load( { OP___assert(ID < N_GPIO_ID); OP___assert(GPIO_BASE[ID] != (hrt_address)-1); -return ia_css_device_load_uint32(GPIO_BASE[ID] + reg*sizeof(hrt_data)); + return ia_css_device_load_uint32(GPIO_BASE[ID] + reg*sizeof(hrt_data)); } #endif /* __GPIO_PRIVATE_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/hmem_private.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/hmem_private.h index 2b636e0e6482..32a780380e11 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/hmem_private.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/hmem_private.h @@ -22,9 +22,9 @@ STORAGE_CLASS_HMEM_C size_t sizeof_hmem( const hmem_ID_t ID) { -assert(ID < N_HMEM_ID); + assert(ID < N_HMEM_ID); (void)ID; -return HMEM_SIZE*sizeof(hmem_data_t); + return HMEM_SIZE*sizeof(hmem_data_t); } #endif /* __HMEM_PRIVATE_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_formatter_private.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_formatter_private.h index d34933e44aa9..2f42a9c2771c 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_formatter_private.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_formatter_private.h @@ -26,21 +26,21 @@ STORAGE_CLASS_INPUT_FORMATTER_C void input_formatter_reg_store( const hrt_address reg_addr, const hrt_data value) { -assert(ID < N_INPUT_FORMATTER_ID); -assert(INPUT_FORMATTER_BASE[ID] != (hrt_address)-1); -assert((reg_addr % sizeof(hrt_data)) == 0); + assert(ID < N_INPUT_FORMATTER_ID); + assert(INPUT_FORMATTER_BASE[ID] != (hrt_address)-1); + assert((reg_addr % sizeof(hrt_data)) == 0); ia_css_device_store_uint32(INPUT_FORMATTER_BASE[ID] + reg_addr, value); -return; + return; } STORAGE_CLASS_INPUT_FORMATTER_C hrt_data input_formatter_reg_load( const input_formatter_ID_t ID, const unsigned int reg_addr) { -assert(ID < N_INPUT_FORMATTER_ID); -assert(INPUT_FORMATTER_BASE[ID] != (hrt_address)-1); -assert((reg_addr % sizeof(hrt_data)) == 0); -return ia_css_device_load_uint32(INPUT_FORMATTER_BASE[ID] + reg_addr); + assert(ID < N_INPUT_FORMATTER_ID); + assert(INPUT_FORMATTER_BASE[ID] != (hrt_address)-1); + assert((reg_addr % sizeof(hrt_data)) == 0); + return ia_css_device_load_uint32(INPUT_FORMATTER_BASE[ID] + reg_addr); } #endif /* __INPUT_FORMATTER_PRIVATE_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_system.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_system.c index f35e18987b67..bd6821e436b2 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_system.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_system.c @@ -81,27 +81,27 @@ static input_system_error_t input_system_multiplexer_cfg( -STORAGE_CLASS_INLINE void capture_unit_get_state( +static inline void capture_unit_get_state( const input_system_ID_t ID, const sub_system_ID_t sub_id, capture_unit_state_t *state); -STORAGE_CLASS_INLINE void acquisition_unit_get_state( +static inline void acquisition_unit_get_state( const input_system_ID_t ID, const sub_system_ID_t sub_id, acquisition_unit_state_t *state); -STORAGE_CLASS_INLINE void ctrl_unit_get_state( +static inline void ctrl_unit_get_state( const input_system_ID_t ID, const sub_system_ID_t sub_id, ctrl_unit_state_t *state); -STORAGE_CLASS_INLINE void mipi_port_get_state( +static inline void mipi_port_get_state( const rx_ID_t ID, const mipi_port_ID_t port_ID, mipi_port_state_t *state); -STORAGE_CLASS_INLINE void rx_channel_get_state( +static inline void rx_channel_get_state( const rx_ID_t ID, const unsigned int ch_id, rx_channel_state_t *state); @@ -173,7 +173,7 @@ void input_system_get_state( &(state->ctrl_unit_state[sub_id - CTRL_UNIT0_ID])); } -return; + return; } void receiver_get_state( @@ -245,7 +245,7 @@ void receiver_get_state( state->be_irq_clear = receiver_reg_load(ID, _HRT_CSS_RECEIVER_BE_IRQ_CLEAR_REG_IDX); -return; + return; } bool is_mipi_format_yuv420( @@ -258,7 +258,7 @@ bool is_mipi_format_yuv420( (mipi_format == MIPI_FORMAT_YUV420_10_SHIFT)); /* MIPI_FORMAT_YUV420_8_LEGACY is not YUV420 */ -return is_yuv420; + return is_yuv420; } void receiver_set_compression( @@ -300,7 +300,7 @@ void receiver_set_compression( reg = ((field_id < 6)?(val << (field_id * 5)):(val << ((field_id - 6) * 5))); receiver_reg_store(ID, addr, reg); -return; + return; } void receiver_port_enable( @@ -319,7 +319,7 @@ void receiver_port_enable( receiver_port_reg_store(ID, port_ID, _HRT_CSS_RECEIVER_DEVICE_READY_REG_IDX, reg); -return; + return; } bool is_receiver_port_enabled( @@ -328,7 +328,7 @@ bool is_receiver_port_enabled( { hrt_data reg = receiver_port_reg_load(ID, port_ID, _HRT_CSS_RECEIVER_DEVICE_READY_REG_IDX); -return ((reg & 0x01) != 0); + return ((reg & 0x01) != 0); } void receiver_irq_enable( @@ -338,14 +338,14 @@ void receiver_irq_enable( { receiver_port_reg_store(ID, port_ID, _HRT_CSS_RECEIVER_IRQ_ENABLE_REG_IDX, irq_info); -return; + return; } rx_irq_info_t receiver_get_irq_info( const rx_ID_t ID, const mipi_port_ID_t port_ID) { -return receiver_port_reg_load(ID, + return receiver_port_reg_load(ID, port_ID, _HRT_CSS_RECEIVER_IRQ_STATUS_REG_IDX); } @@ -356,10 +356,10 @@ void receiver_irq_clear( { receiver_port_reg_store(ID, port_ID, _HRT_CSS_RECEIVER_IRQ_STATUS_REG_IDX, irq_info); -return; + return; } -STORAGE_CLASS_INLINE void capture_unit_get_state( +static inline void capture_unit_get_state( const input_system_ID_t ID, const sub_system_ID_t sub_id, capture_unit_state_t *state) @@ -418,10 +418,10 @@ STORAGE_CLASS_INLINE void capture_unit_get_state( sub_id, CAPT_FSM_STATE_INFO_REG_ID); -return; + return; } -STORAGE_CLASS_INLINE void acquisition_unit_get_state( +static inline void acquisition_unit_get_state( const input_system_ID_t ID, const sub_system_ID_t sub_id, acquisition_unit_state_t *state) @@ -468,10 +468,10 @@ STORAGE_CLASS_INLINE void acquisition_unit_get_state( sub_id, ACQ_INT_CNTR_INFO_REG_ID); -return; + return; } -STORAGE_CLASS_INLINE void ctrl_unit_get_state( +static inline void ctrl_unit_get_state( const input_system_ID_t ID, const sub_system_ID_t sub_id, ctrl_unit_state_t *state) @@ -551,10 +551,10 @@ STORAGE_CLASS_INLINE void ctrl_unit_get_state( sub_id, ISYS_CTRL_CAPT_RESERVE_ONE_MEM_REGION_REG_ID); -return; + return; } -STORAGE_CLASS_INLINE void mipi_port_get_state( +static inline void mipi_port_get_state( const rx_ID_t ID, const mipi_port_ID_t port_ID, mipi_port_state_t *state) @@ -587,10 +587,10 @@ STORAGE_CLASS_INLINE void mipi_port_get_state( state->lane_rx_count[i] = (uint8_t)((state->rx_count)>>(i*8)); } -return; + return; } -STORAGE_CLASS_INLINE void rx_channel_get_state( +static inline void rx_channel_get_state( const rx_ID_t ID, const unsigned int ch_id, rx_channel_state_t *state) @@ -602,30 +602,30 @@ STORAGE_CLASS_INLINE void rx_channel_get_state( assert(state != NULL); switch (ch_id) { - case 0: - state->comp_scheme0 = receiver_reg_load(ID, + case 0: + state->comp_scheme0 = receiver_reg_load(ID, _HRT_CSS_RECEIVER_2400_COMP_SCHEME_VC0_REG0_IDX); - state->comp_scheme1 = receiver_reg_load(ID, + state->comp_scheme1 = receiver_reg_load(ID, _HRT_CSS_RECEIVER_2400_COMP_SCHEME_VC0_REG1_IDX); - break; - case 1: - state->comp_scheme0 = receiver_reg_load(ID, + break; + case 1: + state->comp_scheme0 = receiver_reg_load(ID, _HRT_CSS_RECEIVER_2400_COMP_SCHEME_VC1_REG0_IDX); - state->comp_scheme1 = receiver_reg_load(ID, + state->comp_scheme1 = receiver_reg_load(ID, _HRT_CSS_RECEIVER_2400_COMP_SCHEME_VC1_REG1_IDX); - break; - case 2: - state->comp_scheme0 = receiver_reg_load(ID, + break; + case 2: + state->comp_scheme0 = receiver_reg_load(ID, _HRT_CSS_RECEIVER_2400_COMP_SCHEME_VC2_REG0_IDX); - state->comp_scheme1 = receiver_reg_load(ID, + state->comp_scheme1 = receiver_reg_load(ID, _HRT_CSS_RECEIVER_2400_COMP_SCHEME_VC2_REG1_IDX); - break; - case 3: - state->comp_scheme0 = receiver_reg_load(ID, + break; + case 3: + state->comp_scheme0 = receiver_reg_load(ID, _HRT_CSS_RECEIVER_2400_COMP_SCHEME_VC3_REG0_IDX); - state->comp_scheme1 = receiver_reg_load(ID, + state->comp_scheme1 = receiver_reg_load(ID, _HRT_CSS_RECEIVER_2400_COMP_SCHEME_VC3_REG1_IDX); - break; + break; } /* See Table 7.1.17,..., 7.1.24 */ @@ -640,7 +640,7 @@ STORAGE_CLASS_INLINE void rx_channel_get_state( state->pred[i] = (mipi_predictor_t)((val & 0x18) >> 3); } -return; + return; } // MW: "2400" in the name is not good, but this is to avoid a naming conflict diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_system_private.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_system_private.h index ed1b947b00f9..118185eb86e9 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_system_private.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_system_private.h @@ -26,19 +26,19 @@ STORAGE_CLASS_INPUT_SYSTEM_C void input_system_reg_store( const hrt_address reg, const hrt_data value) { -assert(ID < N_INPUT_SYSTEM_ID); -assert(INPUT_SYSTEM_BASE[ID] != (hrt_address)-1); + assert(ID < N_INPUT_SYSTEM_ID); + assert(INPUT_SYSTEM_BASE[ID] != (hrt_address)-1); ia_css_device_store_uint32(INPUT_SYSTEM_BASE[ID] + reg*sizeof(hrt_data), value); -return; + return; } STORAGE_CLASS_INPUT_SYSTEM_C hrt_data input_system_reg_load( const input_system_ID_t ID, const hrt_address reg) { -assert(ID < N_INPUT_SYSTEM_ID); -assert(INPUT_SYSTEM_BASE[ID] != (hrt_address)-1); -return ia_css_device_load_uint32(INPUT_SYSTEM_BASE[ID] + reg*sizeof(hrt_data)); + assert(ID < N_INPUT_SYSTEM_ID); + assert(INPUT_SYSTEM_BASE[ID] != (hrt_address)-1); + return ia_css_device_load_uint32(INPUT_SYSTEM_BASE[ID] + reg*sizeof(hrt_data)); } STORAGE_CLASS_INPUT_SYSTEM_C void receiver_reg_store( @@ -46,19 +46,19 @@ STORAGE_CLASS_INPUT_SYSTEM_C void receiver_reg_store( const hrt_address reg, const hrt_data value) { -assert(ID < N_RX_ID); -assert(RX_BASE[ID] != (hrt_address)-1); + assert(ID < N_RX_ID); + assert(RX_BASE[ID] != (hrt_address)-1); ia_css_device_store_uint32(RX_BASE[ID] + reg*sizeof(hrt_data), value); -return; + return; } STORAGE_CLASS_INPUT_SYSTEM_C hrt_data receiver_reg_load( const rx_ID_t ID, const hrt_address reg) { -assert(ID < N_RX_ID); -assert(RX_BASE[ID] != (hrt_address)-1); -return ia_css_device_load_uint32(RX_BASE[ID] + reg*sizeof(hrt_data)); + assert(ID < N_RX_ID); + assert(RX_BASE[ID] != (hrt_address)-1); + return ia_css_device_load_uint32(RX_BASE[ID] + reg*sizeof(hrt_data)); } STORAGE_CLASS_INPUT_SYSTEM_C void receiver_port_reg_store( @@ -67,12 +67,12 @@ STORAGE_CLASS_INPUT_SYSTEM_C void receiver_port_reg_store( const hrt_address reg, const hrt_data value) { -assert(ID < N_RX_ID); -assert(port_ID < N_MIPI_PORT_ID); -assert(RX_BASE[ID] != (hrt_address)-1); -assert(MIPI_PORT_OFFSET[port_ID] != (hrt_address)-1); + assert(ID < N_RX_ID); + assert(port_ID < N_MIPI_PORT_ID); + assert(RX_BASE[ID] != (hrt_address)-1); + assert(MIPI_PORT_OFFSET[port_ID] != (hrt_address)-1); ia_css_device_store_uint32(RX_BASE[ID] + MIPI_PORT_OFFSET[port_ID] + reg*sizeof(hrt_data), value); -return; + return; } STORAGE_CLASS_INPUT_SYSTEM_C hrt_data receiver_port_reg_load( @@ -80,11 +80,11 @@ STORAGE_CLASS_INPUT_SYSTEM_C hrt_data receiver_port_reg_load( const mipi_port_ID_t port_ID, const hrt_address reg) { -assert(ID < N_RX_ID); -assert(port_ID < N_MIPI_PORT_ID); -assert(RX_BASE[ID] != (hrt_address)-1); -assert(MIPI_PORT_OFFSET[port_ID] != (hrt_address)-1); -return ia_css_device_load_uint32(RX_BASE[ID] + MIPI_PORT_OFFSET[port_ID] + reg*sizeof(hrt_data)); + assert(ID < N_RX_ID); + assert(port_ID < N_MIPI_PORT_ID); + assert(RX_BASE[ID] != (hrt_address)-1); + assert(MIPI_PORT_OFFSET[port_ID] != (hrt_address)-1); + return ia_css_device_load_uint32(RX_BASE[ID] + MIPI_PORT_OFFSET[port_ID] + reg*sizeof(hrt_data)); } STORAGE_CLASS_INPUT_SYSTEM_C void input_system_sub_system_reg_store( @@ -93,12 +93,12 @@ STORAGE_CLASS_INPUT_SYSTEM_C void input_system_sub_system_reg_store( const hrt_address reg, const hrt_data value) { -assert(ID < N_INPUT_SYSTEM_ID); -assert(sub_ID < N_SUB_SYSTEM_ID); -assert(INPUT_SYSTEM_BASE[ID] != (hrt_address)-1); -assert(SUB_SYSTEM_OFFSET[sub_ID] != (hrt_address)-1); + assert(ID < N_INPUT_SYSTEM_ID); + assert(sub_ID < N_SUB_SYSTEM_ID); + assert(INPUT_SYSTEM_BASE[ID] != (hrt_address)-1); + assert(SUB_SYSTEM_OFFSET[sub_ID] != (hrt_address)-1); ia_css_device_store_uint32(INPUT_SYSTEM_BASE[ID] + SUB_SYSTEM_OFFSET[sub_ID] + reg*sizeof(hrt_data), value); -return; + return; } STORAGE_CLASS_INPUT_SYSTEM_C hrt_data input_system_sub_system_reg_load( @@ -106,11 +106,11 @@ STORAGE_CLASS_INPUT_SYSTEM_C hrt_data input_system_sub_system_reg_load( const sub_system_ID_t sub_ID, const hrt_address reg) { -assert(ID < N_INPUT_SYSTEM_ID); -assert(sub_ID < N_SUB_SYSTEM_ID); -assert(INPUT_SYSTEM_BASE[ID] != (hrt_address)-1); -assert(SUB_SYSTEM_OFFSET[sub_ID] != (hrt_address)-1); -return ia_css_device_load_uint32(INPUT_SYSTEM_BASE[ID] + SUB_SYSTEM_OFFSET[sub_ID] + reg*sizeof(hrt_data)); + assert(ID < N_INPUT_SYSTEM_ID); + assert(sub_ID < N_SUB_SYSTEM_ID); + assert(INPUT_SYSTEM_BASE[ID] != (hrt_address)-1); + assert(SUB_SYSTEM_OFFSET[sub_ID] != (hrt_address)-1); + return ia_css_device_load_uint32(INPUT_SYSTEM_BASE[ID] + SUB_SYSTEM_OFFSET[sub_ID] + reg*sizeof(hrt_data)); } #endif /* __INPUT_SYSTEM_PRIVATE_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/irq.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/irq.c index 6b58bc13dc1b..51daf76c2aea 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/irq.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/irq.c @@ -22,13 +22,13 @@ #include "platform_support.h" /* hrt_sleep() */ -STORAGE_CLASS_INLINE void irq_wait_for_write_complete( +static inline void irq_wait_for_write_complete( const irq_ID_t ID); -STORAGE_CLASS_INLINE bool any_irq_channel_enabled( +static inline bool any_irq_channel_enabled( const irq_ID_t ID); -STORAGE_CLASS_INLINE irq_ID_t virq_get_irq_id( +static inline irq_ID_t virq_get_irq_id( const virq_id_t irq_ID, unsigned int *channel_ID); @@ -69,7 +69,7 @@ void irq_clear_all( irq_reg_store(ID, _HRT_IRQ_CONTROLLER_CLEAR_REG_IDX, mask); -return; + return; } /* @@ -114,7 +114,7 @@ void irq_enable_channel( irq_wait_for_write_complete(ID); -return; + return; } void irq_enable_pulse( @@ -129,7 +129,7 @@ void irq_enable_pulse( /* output is given as edge, not pulse */ irq_reg_store(ID, _HRT_IRQ_CONTROLLER_EDGE_NOT_PULSE_REG_IDX, edge_out); -return; + return; } void irq_disable_channel( @@ -160,7 +160,7 @@ void irq_disable_channel( irq_wait_for_write_complete(ID); -return; + return; } enum hrt_isp_css_irq_status irq_get_channel_id( @@ -195,7 +195,7 @@ enum hrt_isp_css_irq_status irq_get_channel_id( if (irq_id != NULL) *irq_id = (unsigned int)idx; -return status; + return status; } static const hrt_address IRQ_REQUEST_ADDR[N_IRQ_SW_CHANNEL_ID] = { @@ -220,7 +220,7 @@ void irq_raise( (unsigned int)addr, 1); gp_device_reg_store(GP_DEVICE0_ID, (unsigned int)addr, 0); -return; + return; } void irq_controller_get_state( @@ -240,7 +240,7 @@ void irq_controller_get_state( _HRT_IRQ_CONTROLLER_ENABLE_REG_IDX); state->irq_level_not_pulse = irq_reg_load(ID, _HRT_IRQ_CONTROLLER_EDGE_NOT_PULSE_REG_IDX); -return; + return; } bool any_virq_signal(void) @@ -248,7 +248,7 @@ bool any_virq_signal(void) unsigned int irq_status = irq_reg_load(IRQ0_ID, _HRT_IRQ_CONTROLLER_STATUS_REG_IDX); -return (irq_status != 0); + return (irq_status != 0); } void cnd_virq_enable_channel( @@ -279,7 +279,7 @@ void cnd_virq_enable_channel( irq_disable_channel(IRQ0_ID, IRQ_NESTING_ID[ID]); } } -return; + return; } @@ -290,7 +290,7 @@ void virq_clear_all(void) for (irq_id = (irq_ID_t)0; irq_id < N_IRQ_ID; irq_id++) { irq_clear_all(irq_id); } -return; + return; } enum hrt_isp_css_irq_status virq_get_channel_signals( @@ -320,7 +320,7 @@ enum hrt_isp_css_irq_status virq_get_channel_signals( } } -return irq_status; + return irq_status; } void virq_clear_info( @@ -333,7 +333,7 @@ void virq_clear_info( for (ID = (irq_ID_t)0 ; ID < N_IRQ_ID; ID++) { irq_info->irq_status_reg[ID] = 0; } -return; + return; } enum hrt_isp_css_irq_status virq_get_channel_id( @@ -403,10 +403,10 @@ enum hrt_isp_css_irq_status virq_get_channel_id( if (irq_id != NULL) *irq_id = (virq_id_t)idx; -return status; + return status; } -STORAGE_CLASS_INLINE void irq_wait_for_write_complete( +static inline void irq_wait_for_write_complete( const irq_ID_t ID) { assert(ID < N_IRQ_ID); @@ -415,7 +415,7 @@ STORAGE_CLASS_INLINE void irq_wait_for_write_complete( _HRT_IRQ_CONTROLLER_ENABLE_REG_IDX*sizeof(hrt_data)); } -STORAGE_CLASS_INLINE bool any_irq_channel_enabled( +static inline bool any_irq_channel_enabled( const irq_ID_t ID) { hrt_data en_reg; @@ -425,10 +425,10 @@ STORAGE_CLASS_INLINE bool any_irq_channel_enabled( en_reg = irq_reg_load(ID, _HRT_IRQ_CONTROLLER_ENABLE_REG_IDX); -return (en_reg != 0); + return (en_reg != 0); } -STORAGE_CLASS_INLINE irq_ID_t virq_get_irq_id( +static inline irq_ID_t virq_get_irq_id( const virq_id_t irq_ID, unsigned int *channel_ID) { @@ -444,5 +444,5 @@ STORAGE_CLASS_INLINE irq_ID_t virq_get_irq_id( *channel_ID = (unsigned int)irq_ID - IRQ_N_ID_OFFSET[ID]; -return ID; + return ID; } diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/irq_private.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/irq_private.h index eb325e870e88..23a13ac696c2 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/irq_private.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/irq_private.h @@ -26,19 +26,19 @@ STORAGE_CLASS_IRQ_C void irq_reg_store( const unsigned int reg, const hrt_data value) { -assert(ID < N_IRQ_ID); -assert(IRQ_BASE[ID] != (hrt_address)-1); + assert(ID < N_IRQ_ID); + assert(IRQ_BASE[ID] != (hrt_address)-1); ia_css_device_store_uint32(IRQ_BASE[ID] + reg*sizeof(hrt_data), value); -return; + return; } STORAGE_CLASS_IRQ_C hrt_data irq_reg_load( const irq_ID_t ID, const unsigned int reg) { -assert(ID < N_IRQ_ID); -assert(IRQ_BASE[ID] != (hrt_address)-1); -return ia_css_device_load_uint32(IRQ_BASE[ID] + reg*sizeof(hrt_data)); + assert(ID < N_IRQ_ID); + assert(IRQ_BASE[ID] != (hrt_address)-1); + return ia_css_device_load_uint32(IRQ_BASE[ID] + reg*sizeof(hrt_data)); } #endif /* __IRQ_PRIVATE_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/isp.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/isp.c index 47c21e486c25..531c932a48f5 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/isp.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/isp.c @@ -34,7 +34,7 @@ void cnd_isp_irq_enable( isp_ctrl_clearbit(ID, ISP_IRQ_READY_REG, ISP_IRQ_READY_BIT); } -return; + return; } void isp_get_state( @@ -94,7 +94,7 @@ void isp_get_state( !isp_ctrl_getbit(ID, ISP_ICACHE_MT_SINK_REG, ISP_ICACHE_MT_SINK_BIT); */ -return; + return; } /* ISP functions to control the ISP state from the host, even in crun. */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/mmu.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/mmu.c index b75d0f85d524..a28b67eb66ea 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/mmu.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/mmu.c @@ -24,20 +24,20 @@ void mmu_set_page_table_base_index( const hrt_data base_index) { mmu_reg_store(ID, _HRT_MMU_PAGE_TABLE_BASE_ADDRESS_REG_IDX, base_index); -return; + return; } hrt_data mmu_get_page_table_base_index( const mmu_ID_t ID) { -return mmu_reg_load(ID, _HRT_MMU_PAGE_TABLE_BASE_ADDRESS_REG_IDX); + return mmu_reg_load(ID, _HRT_MMU_PAGE_TABLE_BASE_ADDRESS_REG_IDX); } void mmu_invalidate_cache( const mmu_ID_t ID) { mmu_reg_store(ID, _HRT_MMU_INVALIDATE_TLB_REG_IDX, 1); -return; + return; } void mmu_invalidate_cache_all(void) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/mmu_private.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/mmu_private.h index 392b6cc24e8f..7377666f6eb7 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/mmu_private.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/mmu_private.h @@ -26,19 +26,19 @@ STORAGE_CLASS_MMU_H void mmu_reg_store( const unsigned int reg, const hrt_data value) { -assert(ID < N_MMU_ID); -assert(MMU_BASE[ID] != (hrt_address)-1); + assert(ID < N_MMU_ID); + assert(MMU_BASE[ID] != (hrt_address)-1); ia_css_device_store_uint32(MMU_BASE[ID] + reg*sizeof(hrt_data), value); -return; + return; } STORAGE_CLASS_MMU_H hrt_data mmu_reg_load( const mmu_ID_t ID, const unsigned int reg) { -assert(ID < N_MMU_ID); -assert(MMU_BASE[ID] != (hrt_address)-1); -return ia_css_device_load_uint32(MMU_BASE[ID] + reg*sizeof(hrt_data)); + assert(ID < N_MMU_ID); + assert(MMU_BASE[ID] != (hrt_address)-1); + return ia_css_device_load_uint32(MMU_BASE[ID] + reg*sizeof(hrt_data)); } #endif /* __MMU_PRIVATE_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/sp_private.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/sp_private.h index e6283bf67ad3..5ea81c0e82d1 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/sp_private.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/sp_private.h @@ -26,19 +26,19 @@ STORAGE_CLASS_SP_C void sp_ctrl_store( const hrt_address reg, const hrt_data value) { -assert(ID < N_SP_ID); -assert(SP_CTRL_BASE[ID] != (hrt_address)-1); + assert(ID < N_SP_ID); + assert(SP_CTRL_BASE[ID] != (hrt_address)-1); ia_css_device_store_uint32(SP_CTRL_BASE[ID] + reg*sizeof(hrt_data), value); -return; + return; } STORAGE_CLASS_SP_C hrt_data sp_ctrl_load( const sp_ID_t ID, const hrt_address reg) { -assert(ID < N_SP_ID); -assert(SP_CTRL_BASE[ID] != (hrt_address)-1); -return ia_css_device_load_uint32(SP_CTRL_BASE[ID] + reg*sizeof(hrt_data)); + assert(ID < N_SP_ID); + assert(SP_CTRL_BASE[ID] != (hrt_address)-1); + return ia_css_device_load_uint32(SP_CTRL_BASE[ID] + reg*sizeof(hrt_data)); } STORAGE_CLASS_SP_C bool sp_ctrl_getbit( @@ -47,7 +47,7 @@ STORAGE_CLASS_SP_C bool sp_ctrl_getbit( const unsigned int bit) { hrt_data val = sp_ctrl_load(ID, reg); -return (val & (1UL << bit)) != 0; + return (val & (1UL << bit)) != 0; } STORAGE_CLASS_SP_C void sp_ctrl_setbit( @@ -57,7 +57,7 @@ STORAGE_CLASS_SP_C void sp_ctrl_setbit( { hrt_data data = sp_ctrl_load(ID, reg); sp_ctrl_store(ID, reg, (data | (1UL << bit))); -return; + return; } STORAGE_CLASS_SP_C void sp_ctrl_clearbit( @@ -67,7 +67,7 @@ STORAGE_CLASS_SP_C void sp_ctrl_clearbit( { hrt_data data = sp_ctrl_load(ID, reg); sp_ctrl_store(ID, reg, (data & ~(1UL << bit))); -return; + return; } STORAGE_CLASS_SP_C void sp_dmem_store( @@ -76,10 +76,10 @@ STORAGE_CLASS_SP_C void sp_dmem_store( const void *data, const size_t size) { -assert(ID < N_SP_ID); -assert(SP_DMEM_BASE[ID] != (hrt_address)-1); + assert(ID < N_SP_ID); + assert(SP_DMEM_BASE[ID] != (hrt_address)-1); ia_css_device_store(SP_DMEM_BASE[ID] + addr, data, size); -return; + return; } STORAGE_CLASS_SP_C void sp_dmem_load( @@ -88,10 +88,10 @@ STORAGE_CLASS_SP_C void sp_dmem_load( void *data, const size_t size) { -assert(ID < N_SP_ID); -assert(SP_DMEM_BASE[ID] != (hrt_address)-1); + assert(ID < N_SP_ID); + assert(SP_DMEM_BASE[ID] != (hrt_address)-1); ia_css_device_load(SP_DMEM_BASE[ID] + addr, data, size); -return; + return; } STORAGE_CLASS_SP_C void sp_dmem_store_uint8( @@ -99,11 +99,11 @@ STORAGE_CLASS_SP_C void sp_dmem_store_uint8( hrt_address addr, const uint8_t data) { -assert(ID < N_SP_ID); -assert(SP_DMEM_BASE[ID] != (hrt_address)-1); + assert(ID < N_SP_ID); + assert(SP_DMEM_BASE[ID] != (hrt_address)-1); (void)ID; ia_css_device_store_uint8(SP_DMEM_BASE[SP0_ID] + addr, data); -return; + return; } STORAGE_CLASS_SP_C void sp_dmem_store_uint16( @@ -111,11 +111,11 @@ STORAGE_CLASS_SP_C void sp_dmem_store_uint16( hrt_address addr, const uint16_t data) { -assert(ID < N_SP_ID); -assert(SP_DMEM_BASE[ID] != (hrt_address)-1); + assert(ID < N_SP_ID); + assert(SP_DMEM_BASE[ID] != (hrt_address)-1); (void)ID; ia_css_device_store_uint16(SP_DMEM_BASE[SP0_ID] + addr, data); -return; + return; } STORAGE_CLASS_SP_C void sp_dmem_store_uint32( @@ -123,19 +123,19 @@ STORAGE_CLASS_SP_C void sp_dmem_store_uint32( hrt_address addr, const uint32_t data) { -assert(ID < N_SP_ID); -assert(SP_DMEM_BASE[ID] != (hrt_address)-1); + assert(ID < N_SP_ID); + assert(SP_DMEM_BASE[ID] != (hrt_address)-1); (void)ID; ia_css_device_store_uint32(SP_DMEM_BASE[SP0_ID] + addr, data); -return; + return; } STORAGE_CLASS_SP_C uint8_t sp_dmem_load_uint8( const sp_ID_t ID, const hrt_address addr) { -assert(ID < N_SP_ID); -assert(SP_DMEM_BASE[ID] != (hrt_address)-1); + assert(ID < N_SP_ID); + assert(SP_DMEM_BASE[ID] != (hrt_address)-1); (void)ID; return ia_css_device_load_uint8(SP_DMEM_BASE[SP0_ID] + addr); } @@ -144,8 +144,8 @@ STORAGE_CLASS_SP_C uint16_t sp_dmem_load_uint16( const sp_ID_t ID, const hrt_address addr) { -assert(ID < N_SP_ID); -assert(SP_DMEM_BASE[ID] != (hrt_address)-1); + assert(ID < N_SP_ID); + assert(SP_DMEM_BASE[ID] != (hrt_address)-1); (void)ID; return ia_css_device_load_uint16(SP_DMEM_BASE[SP0_ID] + addr); } @@ -154,8 +154,8 @@ STORAGE_CLASS_SP_C uint32_t sp_dmem_load_uint32( const sp_ID_t ID, const hrt_address addr) { -assert(ID < N_SP_ID); -assert(SP_DMEM_BASE[ID] != (hrt_address)-1); + assert(ID < N_SP_ID); + assert(SP_DMEM_BASE[ID] != (hrt_address)-1); (void)ID; return ia_css_device_load_uint32(SP_DMEM_BASE[SP0_ID] + addr); } diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/assert_support.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/assert_support.h index 92fb15d04703..fd0d92e87c36 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/assert_support.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/assert_support.h @@ -15,7 +15,6 @@ #ifndef __ASSERT_SUPPORT_H_INCLUDED__ #define __ASSERT_SUPPORT_H_INCLUDED__ -#include "storage_class.h" /** * The following macro can help to test the size of a struct at compile @@ -92,7 +91,7 @@ * The implemenation for the pipe generation tool is in see support.isp.h */ #define OP___assert(cnd) assert(cnd) -STORAGE_CLASS_INLINE void compile_time_assert (unsigned cond) +static inline void compile_time_assert (unsigned cond) { /* Call undefined function if cond is false */ extern void _compile_time_assert (void); diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/bamem.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/bamem.h index d71e08f27a42..6928965cf513 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/bamem.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/bamem.h @@ -29,18 +29,17 @@ * - local: system and cell specific constants and identifiers */ -#include "storage_class.h" #include "system_local.h" #include "bamem_local.h" #ifndef __INLINE_BAMEM__ -#define STORAGE_CLASS_BAMEM_H STORAGE_CLASS_EXTERN +#define STORAGE_CLASS_BAMEM_H extern #define STORAGE_CLASS_BAMEM_C #include "bamem_public.h" #else /* __INLINE_BAMEM__ */ -#define STORAGE_CLASS_BAMEM_H STORAGE_CLASS_INLINE -#define STORAGE_CLASS_BAMEM_C STORAGE_CLASS_INLINE +#define STORAGE_CLASS_BAMEM_H static inline +#define STORAGE_CLASS_BAMEM_C static inline #include "bamem_private.h" #endif /* __INLINE_BAMEM__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/csi_rx.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/csi_rx.h index 0398f5802f05..917ee8cdb1d9 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/csi_rx.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/csi_rx.h @@ -30,18 +30,13 @@ * - local: system and cell specific constants and identifiers */ -#include "storage_class.h" #include "system_local.h" #include "csi_rx_local.h" #ifndef __INLINE_CSI_RX__ -#define STORAGE_CLASS_CSI_RX_H STORAGE_CLASS_EXTERN -#define STORAGE_CLASS_CSI_RX_C #include "csi_rx_public.h" #else /* __INLINE_CSI_RX__ */ -#define STORAGE_CLASS_CSI_RX_H STORAGE_CLASS_INLINE -#define STORAGE_CLASS_CSI_RX_C STORAGE_CLASS_INLINE #include "csi_rx_private.h" #endif /* __INLINE_CSI_RX__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/debug.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/debug.h index 7d8011735033..0aa22446e27e 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/debug.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/debug.h @@ -30,18 +30,17 @@ * */ -#include "storage_class.h" #include "system_local.h" #include "debug_local.h" #ifndef __INLINE_DEBUG__ -#define STORAGE_CLASS_DEBUG_H STORAGE_CLASS_EXTERN +#define STORAGE_CLASS_DEBUG_H extern #define STORAGE_CLASS_DEBUG_C #include "debug_public.h" #else /* __INLINE_DEBUG__ */ -#define STORAGE_CLASS_DEBUG_H STORAGE_CLASS_INLINE -#define STORAGE_CLASS_DEBUG_C STORAGE_CLASS_INLINE +#define STORAGE_CLASS_DEBUG_H static inline +#define STORAGE_CLASS_DEBUG_C static inline #include "debug_private.h" #endif /* __INLINE_DEBUG__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/dma.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/dma.h index b266191f21ef..d9dee691e3f8 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/dma.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/dma.h @@ -30,18 +30,17 @@ * */ -#include "storage_class.h" #include "system_local.h" #include "dma_local.h" #ifndef __INLINE_DMA__ -#define STORAGE_CLASS_DMA_H STORAGE_CLASS_EXTERN +#define STORAGE_CLASS_DMA_H extern #define STORAGE_CLASS_DMA_C #include "dma_public.h" #else /* __INLINE_DMA__ */ -#define STORAGE_CLASS_DMA_H STORAGE_CLASS_INLINE -#define STORAGE_CLASS_DMA_C STORAGE_CLASS_INLINE +#define STORAGE_CLASS_DMA_H static inline +#define STORAGE_CLASS_DMA_C static inline #include "dma_private.h" #endif /* __INLINE_DMA__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/event_fifo.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/event_fifo.h index 78827c554cc3..df579e902796 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/event_fifo.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/event_fifo.h @@ -29,18 +29,17 @@ * - local: system and cell specific constants and identifiers */ -#include "storage_class.h" #include "system_local.h" #include "event_fifo_local.h" #ifndef __INLINE_EVENT__ -#define STORAGE_CLASS_EVENT_H STORAGE_CLASS_EXTERN +#define STORAGE_CLASS_EVENT_H extern #define STORAGE_CLASS_EVENT_C #include "event_fifo_public.h" #else /* __INLINE_EVENT__ */ -#define STORAGE_CLASS_EVENT_H STORAGE_CLASS_INLINE -#define STORAGE_CLASS_EVENT_C STORAGE_CLASS_INLINE +#define STORAGE_CLASS_EVENT_H static inline +#define STORAGE_CLASS_EVENT_C static inline #include "event_fifo_private.h" #endif /* __INLINE_EVENT__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/fifo_monitor.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/fifo_monitor.h index 3bdd260bcaa5..f10c4fa2e32b 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/fifo_monitor.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/fifo_monitor.h @@ -29,18 +29,17 @@ * - local: system and cell specific constants and identifiers */ -#include "storage_class.h" #include "system_local.h" #include "fifo_monitor_local.h" #ifndef __INLINE_FIFO_MONITOR__ -#define STORAGE_CLASS_FIFO_MONITOR_H STORAGE_CLASS_EXTERN +#define STORAGE_CLASS_FIFO_MONITOR_H extern #define STORAGE_CLASS_FIFO_MONITOR_C #include "fifo_monitor_public.h" #else /* __INLINE_FIFO_MONITOR__ */ -#define STORAGE_CLASS_FIFO_MONITOR_H STORAGE_CLASS_INLINE -#define STORAGE_CLASS_FIFO_MONITOR_C STORAGE_CLASS_INLINE +#define STORAGE_CLASS_FIFO_MONITOR_H static inline +#define STORAGE_CLASS_FIFO_MONITOR_C static inline #include "fifo_monitor_private.h" #endif /* __INLINE_FIFO_MONITOR__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/gdc_device.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/gdc_device.h index 016132ba0b7f..75c6854c8e7b 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/gdc_device.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/gdc_device.h @@ -31,18 +31,17 @@ * - local: system and cell specific constants and identifiers */ -#include "storage_class.h" #include "system_local.h" #include "gdc_local.h" #ifndef __INLINE_GDC__ -#define STORAGE_CLASS_GDC_H STORAGE_CLASS_EXTERN +#define STORAGE_CLASS_GDC_H extern #define STORAGE_CLASS_GDC_C #include "gdc_public.h" #else /* __INLINE_GDC__ */ -#define STORAGE_CLASS_GDC_H STORAGE_CLASS_INLINE -#define STORAGE_CLASS_GDC_C STORAGE_CLASS_INLINE +#define STORAGE_CLASS_GDC_H static inline +#define STORAGE_CLASS_GDC_C static inline #include "gdc_private.h" #endif /* __INLINE_GDC__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/gp_device.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/gp_device.h index 766d2532d8f9..aba94e623043 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/gp_device.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/gp_device.h @@ -29,18 +29,17 @@ * - local: system and cell specific constants and identifiers */ -#include "storage_class.h" #include "system_local.h" #include "gp_device_local.h" #ifndef __INLINE_GP_DEVICE__ -#define STORAGE_CLASS_GP_DEVICE_H STORAGE_CLASS_EXTERN +#define STORAGE_CLASS_GP_DEVICE_H extern #define STORAGE_CLASS_GP_DEVICE_C #include "gp_device_public.h" #else /* __INLINE_GP_DEVICE__ */ -#define STORAGE_CLASS_GP_DEVICE_H STORAGE_CLASS_INLINE -#define STORAGE_CLASS_GP_DEVICE_C STORAGE_CLASS_INLINE +#define STORAGE_CLASS_GP_DEVICE_H static inline +#define STORAGE_CLASS_GP_DEVICE_C static inline #include "gp_device_private.h" #endif /* __INLINE_GP_DEVICE__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/gp_timer.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/gp_timer.h index ca70f5603bf8..d5d2df24e11a 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/gp_timer.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/gp_timer.h @@ -29,18 +29,17 @@ * - local: system and cell specific constants and identifiers */ -#include "storage_class.h" #include "system_local.h" /*GP_TIMER_BASE address */ #include "gp_timer_local.h" /*GP_TIMER register offsets */ #ifndef __INLINE_GP_TIMER__ -#define STORAGE_CLASS_GP_TIMER_H STORAGE_CLASS_EXTERN +#define STORAGE_CLASS_GP_TIMER_H extern #define STORAGE_CLASS_GP_TIMER_C #include "gp_timer_public.h" /* functions*/ #else /* __INLINE_GP_TIMER__ */ -#define STORAGE_CLASS_GP_TIMER_H STORAGE_CLASS_INLINE -#define STORAGE_CLASS_GP_TIMER_C STORAGE_CLASS_INLINE +#define STORAGE_CLASS_GP_TIMER_H static inline +#define STORAGE_CLASS_GP_TIMER_C static inline #include "gp_timer_private.h" /* inline functions*/ #endif /* __INLINE_GP_TIMER__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/gpio.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/gpio.h index dec21bcb6f47..d37f7166aa4a 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/gpio.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/gpio.h @@ -29,18 +29,17 @@ * - local: system and cell specific constants and identifiers */ -#include "storage_class.h" #include "system_local.h" #include "gpio_local.h" #ifndef __INLINE_GPIO__ -#define STORAGE_CLASS_GPIO_H STORAGE_CLASS_EXTERN +#define STORAGE_CLASS_GPIO_H extern #define STORAGE_CLASS_GPIO_C #include "gpio_public.h" #else /* __INLINE_GPIO__ */ -#define STORAGE_CLASS_GPIO_H STORAGE_CLASS_INLINE -#define STORAGE_CLASS_GPIO_C STORAGE_CLASS_INLINE +#define STORAGE_CLASS_GPIO_H static inline +#define STORAGE_CLASS_GPIO_C static inline #include "gpio_private.h" #endif /* __INLINE_GPIO__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/hmem.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/hmem.h index 671dd5b5fca6..a82fd3a21e98 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/hmem.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/hmem.h @@ -29,18 +29,17 @@ * - local: system and cell specific constants and identifiers */ -#include "storage_class.h" #include "system_local.h" #include "hmem_local.h" #ifndef __INLINE_HMEM__ -#define STORAGE_CLASS_HMEM_H STORAGE_CLASS_EXTERN +#define STORAGE_CLASS_HMEM_H extern #define STORAGE_CLASS_HMEM_C #include "hmem_public.h" #else /* __INLINE_HMEM__ */ -#define STORAGE_CLASS_HMEM_H STORAGE_CLASS_INLINE -#define STORAGE_CLASS_HMEM_C STORAGE_CLASS_INLINE +#define STORAGE_CLASS_HMEM_H static inline +#define STORAGE_CLASS_HMEM_C static inline #include "hmem_private.h" #endif /* __INLINE_HMEM__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/csi_rx_public.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/csi_rx_public.h index 396240954bed..3b5df85fc510 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/csi_rx_public.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/csi_rx_public.h @@ -28,7 +28,7 @@ * @param[in] id The global unique ID of the csi rx fe controller. * @param[out] state Point to the register-state. */ -STORAGE_CLASS_CSI_RX_H void csi_rx_fe_ctrl_get_state( +extern void csi_rx_fe_ctrl_get_state( const csi_rx_frontend_ID_t ID, csi_rx_fe_ctrl_state_t *state); /** @@ -38,7 +38,7 @@ STORAGE_CLASS_CSI_RX_H void csi_rx_fe_ctrl_get_state( * @param[in] id The global unique ID of the csi rx fe controller. * @param[in] state Point to the register-state. */ -STORAGE_CLASS_CSI_RX_H void csi_rx_fe_ctrl_dump_state( +extern void csi_rx_fe_ctrl_dump_state( const csi_rx_frontend_ID_t ID, csi_rx_fe_ctrl_state_t *state); /** @@ -49,7 +49,7 @@ STORAGE_CLASS_CSI_RX_H void csi_rx_fe_ctrl_dump_state( * @param[in] lane The lane ID. * @param[out] state Point to the dlane state. */ -STORAGE_CLASS_CSI_RX_H void csi_rx_fe_ctrl_get_dlane_state( +extern void csi_rx_fe_ctrl_get_dlane_state( const csi_rx_frontend_ID_t ID, const uint32_t lane, csi_rx_fe_ctrl_lane_t *dlane_state); @@ -60,7 +60,7 @@ STORAGE_CLASS_CSI_RX_H void csi_rx_fe_ctrl_get_dlane_state( * @param[in] id The global unique ID of the csi rx be controller. * @param[out] state Point to the register-state. */ -STORAGE_CLASS_CSI_RX_H void csi_rx_be_ctrl_get_state( +extern void csi_rx_be_ctrl_get_state( const csi_rx_backend_ID_t ID, csi_rx_be_ctrl_state_t *state); /** @@ -70,7 +70,7 @@ STORAGE_CLASS_CSI_RX_H void csi_rx_be_ctrl_get_state( * @param[in] id The global unique ID of the csi rx be controller. * @param[in] state Point to the register-state. */ -STORAGE_CLASS_CSI_RX_H void csi_rx_be_ctrl_dump_state( +extern void csi_rx_be_ctrl_dump_state( const csi_rx_backend_ID_t ID, csi_rx_be_ctrl_state_t *state); /** end of NCI */ @@ -89,7 +89,7 @@ STORAGE_CLASS_CSI_RX_H void csi_rx_be_ctrl_dump_state( * * @return the value of the register. */ -STORAGE_CLASS_CSI_RX_H hrt_data csi_rx_fe_ctrl_reg_load( +extern hrt_data csi_rx_fe_ctrl_reg_load( const csi_rx_frontend_ID_t ID, const hrt_address reg); /** @@ -101,7 +101,7 @@ STORAGE_CLASS_CSI_RX_H hrt_data csi_rx_fe_ctrl_reg_load( * @param[in] value The value to be stored. * */ -STORAGE_CLASS_CSI_RX_H void csi_rx_fe_ctrl_reg_store( +extern void csi_rx_fe_ctrl_reg_store( const csi_rx_frontend_ID_t ID, const hrt_address reg, const hrt_data value); @@ -114,7 +114,7 @@ STORAGE_CLASS_CSI_RX_H void csi_rx_fe_ctrl_reg_store( * * @return the value of the register. */ -STORAGE_CLASS_CSI_RX_H hrt_data csi_rx_be_ctrl_reg_load( +extern hrt_data csi_rx_be_ctrl_reg_load( const csi_rx_backend_ID_t ID, const hrt_address reg); /** @@ -126,7 +126,7 @@ STORAGE_CLASS_CSI_RX_H hrt_data csi_rx_be_ctrl_reg_load( * @param[in] value The value to be stored. * */ -STORAGE_CLASS_CSI_RX_H void csi_rx_be_ctrl_reg_store( +extern void csi_rx_be_ctrl_reg_store( const csi_rx_backend_ID_t ID, const hrt_address reg, const hrt_data value); diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/gdc_public.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/gdc_public.h index d27f87a719db..d09d1e320306 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/gdc_public.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/gdc_public.h @@ -33,7 +33,7 @@ \return none, GDC[ID].lut[0...3][0...HRT_GDC_N-1] = data */ -STORAGE_CLASS_EXTERN void gdc_lut_store( +extern void gdc_lut_store( const gdc_ID_t ID, const int data[4][HRT_GDC_N]); @@ -43,7 +43,7 @@ STORAGE_CLASS_EXTERN void gdc_lut_store( \param in_lut[in] The data matrix to be converted \param out_lut[out] The data matrix as the output of conversion */ -STORAGE_CLASS_EXTERN void gdc_lut_convert_to_isp_format( +extern void gdc_lut_convert_to_isp_format( const int in_lut[4][HRT_GDC_N], int out_lut[4][HRT_GDC_N]); @@ -53,7 +53,7 @@ STORAGE_CLASS_EXTERN void gdc_lut_convert_to_isp_format( \return unity */ -STORAGE_CLASS_EXTERN int gdc_get_unity( +extern int gdc_get_unity( const gdc_ID_t ID); #endif /* __GDC_PUBLIC_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/hmem_public.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/hmem_public.h index 9b8e7c92442d..8538f86ab5e6 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/hmem_public.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/hmem_public.h @@ -15,10 +15,10 @@ #ifndef __HMEM_PUBLIC_H_INCLUDED__ #define __HMEM_PUBLIC_H_INCLUDED__ -#include <stddef.h> /* size_t */ +#include <linux/types.h> /* size_t */ /*! Return the size of HMEM[ID] - + \param ID[in] HMEM identifier \Note: The size is the byte size of the area it occupies diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isp_op1w.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isp_op1w.h index 2251f372145b..a025ad562bd2 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isp_op1w.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isp_op1w.h @@ -27,14 +27,13 @@ * Prerequisites: * */ -#include "storage_class.h" #ifdef INLINE_ISP_OP1W -#define STORAGE_CLASS_ISP_OP1W_FUNC_H STORAGE_CLASS_INLINE -#define STORAGE_CLASS_ISP_OP1W_DATA_H STORAGE_CLASS_INLINE_DATA +#define STORAGE_CLASS_ISP_OP1W_FUNC_H static inline +#define STORAGE_CLASS_ISP_OP1W_DATA_H static inline_DATA #else /* INLINE_ISP_OP1W */ -#define STORAGE_CLASS_ISP_OP1W_FUNC_H STORAGE_CLASS_EXTERN -#define STORAGE_CLASS_ISP_OP1W_DATA_H STORAGE_CLASS_EXTERN_DATA +#define STORAGE_CLASS_ISP_OP1W_FUNC_H extern +#define STORAGE_CLASS_ISP_OP1W_DATA_H extern_DATA #endif /* INLINE_ISP_OP1W */ /* diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isp_op2w.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isp_op2w.h index 1cfe6d717283..cf7e7314842d 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isp_op2w.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isp_op2w.h @@ -27,14 +27,13 @@ * Prerequisites: * */ -#include "storage_class.h" #ifdef INLINE_ISP_OP2W -#define STORAGE_CLASS_ISP_OP2W_FUNC_H STORAGE_CLASS_INLINE -#define STORAGE_CLASS_ISP_OP2W_DATA_H STORAGE_CLASS_INLINE_DATA +#define STORAGE_CLASS_ISP_OP2W_FUNC_H static inline +#define STORAGE_CLASS_ISP_OP2W_DATA_H static inline_DATA #else /* INLINE_ISP_OP2W */ -#define STORAGE_CLASS_ISP_OP2W_FUNC_H STORAGE_CLASS_EXTERN -#define STORAGE_CLASS_ISP_OP2W_DATA_H STORAGE_CLASS_EXTERN_DATA +#define STORAGE_CLASS_ISP_OP2W_FUNC_H extern +#define STORAGE_CLASS_ISP_OP2W_DATA_H extern_DATA #endif /* INLINE_ISP_OP2W */ /* diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/mmu_public.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/mmu_public.h index 4258fa872087..0a13eda73607 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/mmu_public.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/mmu_public.h @@ -24,7 +24,7 @@ \return none, MMU[ID].page_table_base_index = base_index */ -STORAGE_CLASS_EXTERN void mmu_set_page_table_base_index( +extern void mmu_set_page_table_base_index( const mmu_ID_t ID, const hrt_data base_index); @@ -35,7 +35,7 @@ STORAGE_CLASS_EXTERN void mmu_set_page_table_base_index( \return MMU[ID].page_table_base_index */ -STORAGE_CLASS_EXTERN hrt_data mmu_get_page_table_base_index( +extern hrt_data mmu_get_page_table_base_index( const mmu_ID_t ID); /*! Invalidate the page table cache of MMU[ID] @@ -44,7 +44,7 @@ STORAGE_CLASS_EXTERN hrt_data mmu_get_page_table_base_index( \return none */ -STORAGE_CLASS_EXTERN void mmu_invalidate_cache( +extern void mmu_invalidate_cache( const mmu_ID_t ID); @@ -52,7 +52,7 @@ STORAGE_CLASS_EXTERN void mmu_invalidate_cache( \return none */ -STORAGE_CLASS_EXTERN void mmu_invalidate_cache_all(void); +extern void mmu_invalidate_cache_all(void); /*! Write to a control register of MMU[ID] diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/ref_vector_func.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/ref_vector_func.h index 3e955fca2a94..a202d6dce106 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/ref_vector_func.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/ref_vector_func.h @@ -15,14 +15,13 @@ #ifndef _REF_VECTOR_FUNC_H_INCLUDED_ #define _REF_VECTOR_FUNC_H_INCLUDED_ -#include "storage_class.h" #ifdef INLINE_VECTOR_FUNC -#define STORAGE_CLASS_REF_VECTOR_FUNC_H STORAGE_CLASS_INLINE -#define STORAGE_CLASS_REF_VECTOR_DATA_H STORAGE_CLASS_INLINE_DATA +#define STORAGE_CLASS_REF_VECTOR_FUNC_H static inline +#define STORAGE_CLASS_REF_VECTOR_DATA_H static inline_DATA #else /* INLINE_VECTOR_FUNC */ -#define STORAGE_CLASS_REF_VECTOR_FUNC_H STORAGE_CLASS_EXTERN -#define STORAGE_CLASS_REF_VECTOR_DATA_H STORAGE_CLASS_EXTERN_DATA +#define STORAGE_CLASS_REF_VECTOR_FUNC_H extern +#define STORAGE_CLASS_REF_VECTOR_DATA_H extern_DATA #endif /* INLINE_VECTOR_FUNC */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/ibuf_ctrl.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/ibuf_ctrl.h index f5de0df7981e..c7d9095472b1 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/ibuf_ctrl.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/ibuf_ctrl.h @@ -31,18 +31,17 @@ * - local: system and cell specific constants and identifiers */ -#include "storage_class.h" #include "system_local.h" #include "ibuf_ctrl_local.h" #ifndef __INLINE_IBUF_CTRL__ -#define STORAGE_CLASS_IBUF_CTRL_H STORAGE_CLASS_EXTERN +#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 STORAGE_CLASS_INLINE -#define STORAGE_CLASS_IBUF_CTRL_C STORAGE_CLASS_INLINE +#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__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/input_formatter.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/input_formatter.h index 041c8b660aa4..eeaaecdd57ba 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/input_formatter.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/input_formatter.h @@ -29,18 +29,17 @@ * - local: system and cell specific constants and identifiers */ -#include "storage_class.h" #include "system_local.h" #include "input_formatter_local.h" #ifndef __INLINE_INPUT_FORMATTER__ -#define STORAGE_CLASS_INPUT_FORMATTER_H STORAGE_CLASS_EXTERN +#define STORAGE_CLASS_INPUT_FORMATTER_H extern #define STORAGE_CLASS_INPUT_FORMATTER_C #include "input_formatter_public.h" #else /* __INLINE_INPUT_FORMATTER__ */ -#define STORAGE_CLASS_INPUT_FORMATTER_H STORAGE_CLASS_INLINE -#define STORAGE_CLASS_INPUT_FORMATTER_C STORAGE_CLASS_INLINE +#define STORAGE_CLASS_INPUT_FORMATTER_H static inline +#define STORAGE_CLASS_INPUT_FORMATTER_C static inline #include "input_formatter_private.h" #endif /* __INLINE_INPUT_FORMATTER__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/input_system.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/input_system.h index 182867367b48..3f02d9ec9588 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/input_system.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/input_system.h @@ -29,18 +29,17 @@ * - local: system and cell specific constants and identifiers */ -#include "storage_class.h" #include "system_local.h" #include "input_system_local.h" #ifndef __INLINE_INPUT_SYSTEM__ -#define STORAGE_CLASS_INPUT_SYSTEM_H STORAGE_CLASS_EXTERN +#define STORAGE_CLASS_INPUT_SYSTEM_H extern #define STORAGE_CLASS_INPUT_SYSTEM_C #include "input_system_public.h" #else /* __INLINE_INPUT_SYSTEM__ */ -#define STORAGE_CLASS_INPUT_SYSTEM_H STORAGE_CLASS_INLINE -#define STORAGE_CLASS_INPUT_SYSTEM_C STORAGE_CLASS_INLINE +#define STORAGE_CLASS_INPUT_SYSTEM_H static inline +#define STORAGE_CLASS_INPUT_SYSTEM_C static inline #include "input_system_private.h" #endif /* __INLINE_INPUT_SYSTEM__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/irq.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/irq.h index 1dc443892cc5..e1446388dee5 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/irq.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/irq.h @@ -29,18 +29,17 @@ * - local: system and cell specific constants and identifiers */ -#include "storage_class.h" #include "system_local.h" #include "irq_local.h" #ifndef __INLINE_IRQ__ -#define STORAGE_CLASS_IRQ_H STORAGE_CLASS_EXTERN +#define STORAGE_CLASS_IRQ_H extern #define STORAGE_CLASS_IRQ_C #include "irq_public.h" #else /* __INLINE_IRQ__ */ -#define STORAGE_CLASS_IRQ_H STORAGE_CLASS_INLINE -#define STORAGE_CLASS_IRQ_C STORAGE_CLASS_INLINE +#define STORAGE_CLASS_IRQ_H static inline +#define STORAGE_CLASS_IRQ_C static inline #include "irq_private.h" #endif /* __INLINE_IRQ__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/isp.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/isp.h index 49190d0abc30..b916953e7f47 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/isp.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/isp.h @@ -29,18 +29,17 @@ * - local: system and cell specific constants and identifiers */ -#include "storage_class.h" #include "system_local.h" #include "isp_local.h" #ifndef __INLINE_ISP__ -#define STORAGE_CLASS_ISP_H STORAGE_CLASS_EXTERN +#define STORAGE_CLASS_ISP_H extern #define STORAGE_CLASS_ISP_C #include "isp_public.h" #else /* __INLINE_iSP__ */ -#define STORAGE_CLASS_ISP_H STORAGE_CLASS_INLINE -#define STORAGE_CLASS_ISP_C STORAGE_CLASS_INLINE +#define STORAGE_CLASS_ISP_H static inline +#define STORAGE_CLASS_ISP_C static inline #include "isp_private.h" #endif /* __INLINE_ISP__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/isys_dma.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/isys_dma.h index 9a608f07adcb..76aba114a5c1 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/isys_dma.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/isys_dma.h @@ -31,18 +31,17 @@ * - local: system and cell specific constants and identifiers */ -#include "storage_class.h" #include "system_local.h" #include "isys_dma_local.h" #ifndef __INLINE_ISYS2401_DMA__ -#define STORAGE_CLASS_ISYS2401_DMA_H STORAGE_CLASS_EXTERN +#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 STORAGE_CLASS_INLINE -#define STORAGE_CLASS_ISYS2401_DMA_C STORAGE_CLASS_INLINE +#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__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/isys_irq.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/isys_irq.h index cf858bcc8e45..d3f64cfd0b7d 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/isys_irq.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/isys_irq.h @@ -16,21 +16,20 @@ #define __IA_CSS_ISYS_IRQ_H__ #include <type_support.h> -#include <storage_class.h> #include <system_local.h> #if defined(USE_INPUT_SYSTEM_VERSION_2401) #ifndef __INLINE_ISYS2401_IRQ__ -#define STORAGE_CLASS_ISYS2401_IRQ_H STORAGE_CLASS_EXTERN -#define STORAGE_CLASS_ISYS2401_IRQ_C STORAGE_CLASS_EXTERN +#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 STORAGE_CLASS_INLINE -#define STORAGE_CLASS_ISYS2401_IRQ_C STORAGE_CLASS_INLINE +#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__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/isys_stream2mmio.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/isys_stream2mmio.h index 3e8cfe555ad5..16fbf9d25eba 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/isys_stream2mmio.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/isys_stream2mmio.h @@ -31,18 +31,17 @@ * - local: system and cell specific constants and identifiers */ -#include "storage_class.h" #include "system_local.h" #include "isys_stream2mmio_local.h" #ifndef __INLINE_STREAM2MMIO__ -#define STORAGE_CLASS_STREAM2MMIO_H STORAGE_CLASS_EXTERN +#define STORAGE_CLASS_STREAM2MMIO_H extern #define STORAGE_CLASS_STREAM2MMIO_C #include "isys_stream2mmio_public.h" #else /* __INLINE_STREAM2MMIO__ */ -#define STORAGE_CLASS_STREAM2MMIO_H STORAGE_CLASS_INLINE -#define STORAGE_CLASS_STREAM2MMIO_C STORAGE_CLASS_INLINE +#define STORAGE_CLASS_STREAM2MMIO_H static inline +#define STORAGE_CLASS_STREAM2MMIO_C static inline #include "isys_stream2mmio_private.h" #endif /* __INLINE_STREAM2MMIO__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/math_support.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/math_support.h index f74b405b0f39..e85e5c889c15 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/math_support.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/math_support.h @@ -15,7 +15,6 @@ #ifndef __MATH_SUPPORT_H #define __MATH_SUPPORT_H -#include "storage_class.h" /* for STORAGE_CLASS_INLINE */ #if defined(__KERNEL__) #include <linux/kernel.h> /* Override the definition of max/min from linux kernel*/ #endif /*__KERNEL__*/ @@ -110,60 +109,60 @@ Leaving out the other math utility functions as they are newly added #else /* !defined(INLINE_MATH_SUPPORT_UTILS) */ -STORAGE_CLASS_INLINE int max(int a, int b) +static inline int max(int a, int b) { return MAX(a, b); } -STORAGE_CLASS_INLINE int min(int a, int b) +static inline int min(int a, int b) { return MIN(a, b); } -STORAGE_CLASS_INLINE unsigned int ceil_div(unsigned int a, unsigned int b) +static inline unsigned int ceil_div(unsigned int a, unsigned int b) { return CEIL_DIV(a, b); } #endif /* !defined(INLINE_MATH_SUPPORT_UTILS) */ -STORAGE_CLASS_INLINE unsigned int umax(unsigned int a, unsigned int b) +static inline unsigned int umax(unsigned int a, unsigned int b) { return MAX(a, b); } -STORAGE_CLASS_INLINE unsigned int umin(unsigned int a, unsigned int b) +static inline unsigned int umin(unsigned int a, unsigned int b) { return MIN(a, b); } -STORAGE_CLASS_INLINE unsigned int ceil_mul(unsigned int a, unsigned int b) +static inline unsigned int ceil_mul(unsigned int a, unsigned int b) { return CEIL_MUL(a, b); } -STORAGE_CLASS_INLINE unsigned int ceil_mul2(unsigned int a, unsigned int b) +static inline unsigned int ceil_mul2(unsigned int a, unsigned int b) { return CEIL_MUL2(a, b); } -STORAGE_CLASS_INLINE unsigned int ceil_shift(unsigned int a, unsigned int b) +static inline unsigned int ceil_shift(unsigned int a, unsigned int b) { return CEIL_SHIFT(a, b); } -STORAGE_CLASS_INLINE unsigned int ceil_shift_mul(unsigned int a, unsigned int b) +static inline unsigned int ceil_shift_mul(unsigned int a, unsigned int b) { return CEIL_SHIFT_MUL(a, b); } #ifdef ISP2401 -STORAGE_CLASS_INLINE unsigned int round_half_down_div(unsigned int a, unsigned int b) +static inline unsigned int round_half_down_div(unsigned int a, unsigned int b) { return ROUND_HALF_DOWN_DIV(a, b); } -STORAGE_CLASS_INLINE unsigned int round_half_down_mul(unsigned int a, unsigned int b) +static inline unsigned int round_half_down_mul(unsigned int a, unsigned int b) { return ROUND_HALF_DOWN_MUL(a, b); } @@ -187,7 +186,7 @@ STORAGE_CLASS_INLINE unsigned int round_half_down_mul(unsigned int a, unsigned i * */ -STORAGE_CLASS_INLINE unsigned int ceil_pow2(unsigned int a) +static inline unsigned int ceil_pow2(unsigned int a) { if (a == 0) { return 1; diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/mmu_device.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/mmu_device.h index 1b2017b029f2..519e850ec390 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/mmu_device.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/mmu_device.h @@ -31,18 +31,17 @@ * - local: system and cell specific constants and identifiers */ -#include "storage_class.h" #include "system_local.h" #include "mmu_local.h" #ifndef __INLINE_MMU__ -#define STORAGE_CLASS_MMU_H STORAGE_CLASS_EXTERN +#define STORAGE_CLASS_MMU_H extern #define STORAGE_CLASS_MMU_C #include "mmu_public.h" #else /* __INLINE_MMU__ */ -#define STORAGE_CLASS_MMU_H STORAGE_CLASS_INLINE -#define STORAGE_CLASS_MMU_C STORAGE_CLASS_INLINE +#define STORAGE_CLASS_MMU_H static inline +#define STORAGE_CLASS_MMU_C static inline #include "mmu_private.h" #endif /* __INLINE_MMU__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/mpmath.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/mpmath.h index 565983aafa4d..cd938375e02e 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/mpmath.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/mpmath.h @@ -15,14 +15,13 @@ #ifndef __MPMATH_H_INCLUDED__ #define __MPMATH_H_INCLUDED__ -#include "storage_class.h" #ifdef INLINE_MPMATH -#define STORAGE_CLASS_MPMATH_FUNC_H STORAGE_CLASS_INLINE -#define STORAGE_CLASS_MPMATH_DATA_H STORAGE_CLASS_INLINE_DATA +#define STORAGE_CLASS_MPMATH_FUNC_H static inline +#define STORAGE_CLASS_MPMATH_DATA_H static inline_DATA #else /* INLINE_MPMATH */ -#define STORAGE_CLASS_MPMATH_FUNC_H STORAGE_CLASS_EXTERN -#define STORAGE_CLASS_MPMATH_DATA_H STORAGE_CLASS_EXTERN_DATA +#define STORAGE_CLASS_MPMATH_FUNC_H extern +#define STORAGE_CLASS_MPMATH_DATA_H extern_DATA #endif /* INLINE_MPMATH */ #include <type_support.h> diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/osys.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/osys.h index 6e48ea9afc29..a607242c5f1a 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/osys.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/osys.h @@ -30,18 +30,17 @@ * */ -#include "storage_class.h" #include "system_local.h" #include "osys_local.h" #ifndef __INLINE_OSYS__ -#define STORAGE_CLASS_OSYS_H STORAGE_CLASS_EXTERN +#define STORAGE_CLASS_OSYS_H extern #define STORAGE_CLASS_OSYS_C #include "osys_public.h" #else /* __INLINE_OSYS__ */ -#define STORAGE_CLASS_OSYS_H STORAGE_CLASS_INLINE -#define STORAGE_CLASS_OSYS_C STORAGE_CLASS_INLINE +#define STORAGE_CLASS_OSYS_H static inline +#define STORAGE_CLASS_OSYS_C static inline #include "osys_private.h" #endif /* __INLINE_OSYS__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/pixelgen.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/pixelgen.h index 67f7f3a14231..418d02382d76 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/pixelgen.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/pixelgen.h @@ -31,18 +31,17 @@ * - local: system and cell specific constants and identifiers */ -#include "storage_class.h" #include "system_local.h" #include "pixelgen_local.h" #ifndef __INLINE_PIXELGEN__ -#define STORAGE_CLASS_PIXELGEN_H STORAGE_CLASS_EXTERN +#define STORAGE_CLASS_PIXELGEN_H extern #define STORAGE_CLASS_PIXELGEN_C #include "pixelgen_public.h" #else /* __INLINE_PIXELGEN__ */ -#define STORAGE_CLASS_PIXELGEN_H STORAGE_CLASS_INLINE -#define STORAGE_CLASS_PIXELGEN_C STORAGE_CLASS_INLINE +#define STORAGE_CLASS_PIXELGEN_H static inline +#define STORAGE_CLASS_PIXELGEN_C static inline #include "pixelgen_private.h" #endif /* __INLINE_PIXELGEN__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/platform_support.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/platform_support.h index 02f9eee67ff3..39a125ba563d 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/platform_support.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/platform_support.h @@ -20,7 +20,6 @@ * Platform specific includes and functionality. */ -#include "storage_class.h" #include <linux/delay.h> #include <linux/kernel.h> #include <linux/string.h> diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/print_support.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/print_support.h index cfbc222ea0c1..ca0fbbb57788 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/print_support.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/print_support.h @@ -15,7 +15,6 @@ #ifndef __PRINT_SUPPORT_H_INCLUDED__ #define __PRINT_SUPPORT_H_INCLUDED__ -#include "storage_class.h" #include <stdarg.h> #if !defined(__KERNEL__) @@ -24,7 +23,7 @@ extern int (*sh_css_printf) (const char *fmt, va_list args); /* depends on host supplied print function in ia_css_init() */ -STORAGE_CLASS_INLINE void ia_css_print(const char *fmt, ...) +static inline void ia_css_print(const char *fmt, ...) { va_list ap; if (sh_css_printf) { diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/queue.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/queue.h index a3d874b9516a..aa5fadf5aadb 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/queue.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/queue.h @@ -29,18 +29,17 @@ * */ -#include <storage_class.h> #include "queue_local.h" #ifndef __INLINE_QUEUE__ -#define STORAGE_CLASS_QUEUE_H STORAGE_CLASS_EXTERN +#define STORAGE_CLASS_QUEUE_H extern #define STORAGE_CLASS_QUEUE_C /* #include "queue_public.h" */ #include "ia_css_queue.h" #else /* __INLINE_QUEUE__ */ -#define STORAGE_CLASS_QUEUE_H STORAGE_CLASS_INLINE -#define STORAGE_CLASS_QUEUE_C STORAGE_CLASS_INLINE +#define STORAGE_CLASS_QUEUE_H static inline +#define STORAGE_CLASS_QUEUE_C static inline #include "queue_private.h" #endif /* __INLINE_QUEUE__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/resource.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/resource.h index 82c55acd0380..bd9f53e6b680 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/resource.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/resource.h @@ -30,18 +30,17 @@ * */ -#include "storage_class.h" #include "system_local.h" #include "resource_local.h" #ifndef __INLINE_RESOURCE__ -#define STORAGE_CLASS_RESOURCE_H STORAGE_CLASS_EXTERN +#define STORAGE_CLASS_RESOURCE_H extern #define STORAGE_CLASS_RESOURCE_C #include "resource_public.h" #else /* __INLINE_RESOURCE__ */ -#define STORAGE_CLASS_RESOURCE_H STORAGE_CLASS_INLINE -#define STORAGE_CLASS_RESOURCE_C STORAGE_CLASS_INLINE +#define STORAGE_CLASS_RESOURCE_H static inline +#define STORAGE_CLASS_RESOURCE_C static inline #include "resource_private.h" #endif /* __INLINE_RESOURCE__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/socket.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/socket.h index c34c2e75c51f..43cfb0cb4aa8 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/socket.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/socket.h @@ -30,18 +30,17 @@ * */ -#include "storage_class.h" #include "system_local.h" #include "socket_local.h" #ifndef __INLINE_SOCKET__ -#define STORAGE_CLASS_SOCKET_H STORAGE_CLASS_EXTERN +#define STORAGE_CLASS_SOCKET_H extern #define STORAGE_CLASS_SOCKET_C #include "socket_public.h" #else /* __INLINE_SOCKET__ */ -#define STORAGE_CLASS_SOCKET_H STORAGE_CLASS_INLINE -#define STORAGE_CLASS_SOCKET_C STORAGE_CLASS_INLINE +#define STORAGE_CLASS_SOCKET_H static inline +#define STORAGE_CLASS_SOCKET_C static inline #include "socket_private.h" #endif /* __INLINE_SOCKET__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/sp.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/sp.h index 150fc2f6129b..8f57f2060791 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/sp.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/sp.h @@ -29,18 +29,17 @@ * - local: system and cell specific constants and identifiers */ -#include "storage_class.h" #include "system_local.h" #include "sp_local.h" #ifndef __INLINE_SP__ -#define STORAGE_CLASS_SP_H STORAGE_CLASS_EXTERN +#define STORAGE_CLASS_SP_H extern #define STORAGE_CLASS_SP_C #include "sp_public.h" #else /* __INLINE_SP__ */ -#define STORAGE_CLASS_SP_H STORAGE_CLASS_INLINE -#define STORAGE_CLASS_SP_C STORAGE_CLASS_INLINE +#define STORAGE_CLASS_SP_H static inline +#define STORAGE_CLASS_SP_C static inline #include "sp_private.h" #endif /* __INLINE_SP__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/storage_class.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/storage_class.h deleted file mode 100644 index 3908e668dacd..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/storage_class.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - */ - -#ifndef __STORAGE_CLASS_H_INCLUDED__ -#define __STORAGE_CLASS_H_INCLUDED__ - -/** -* @file -* Platform specific includes and functionality. -*/ - -#define STORAGE_CLASS_EXTERN extern - -#if defined(_MSC_VER) -#define STORAGE_CLASS_INLINE static __inline -#else -#define STORAGE_CLASS_INLINE static inline -#endif - -#define STORAGE_CLASS_EXTERN_DATA extern const -#define STORAGE_CLASS_INLINE_DATA static const - -#endif /* __STORAGE_CLASS_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/stream_buffer.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/stream_buffer.h index 8e41f60b5d39..53d535e4f2ae 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/stream_buffer.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/stream_buffer.h @@ -30,18 +30,17 @@ * */ -#include "storage_class.h" #include "system_local.h" #include "stream_buffer_local.h" #ifndef __INLINE_STREAM_BUFFER__ -#define STORAGE_CLASS_STREAM_BUFFER_H STORAGE_CLASS_EXTERN +#define STORAGE_CLASS_STREAM_BUFFER_H extern #define STORAGE_CLASS_STREAM_BUFFER_C #include "stream_buffer_public.h" #else /* __INLINE_STREAM_BUFFER__ */ -#define STORAGE_CLASS_STREAM_BUFFER_H STORAGE_CLASS_INLINE -#define STORAGE_CLASS_STREAM_BUFFER_C STORAGE_CLASS_INLINE +#define STORAGE_CLASS_STREAM_BUFFER_H static inline +#define STORAGE_CLASS_STREAM_BUFFER_C static inline #include "stream_buffer_private.h" #endif /* __INLINE_STREAM_BUFFER__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/string_support.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/string_support.h index c53241a7a281..d80437c58bde 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/string_support.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/string_support.h @@ -16,7 +16,6 @@ #define __STRING_SUPPORT_H_INCLUDED__ #include <platform_support.h> #include <type_support.h> -#include <storage_class.h> #if !defined(_MSC_VER) /* @@ -34,7 +33,7 @@ * @return EINVAL on Invalid arguments * @return ERANGE on Destination size too small */ -STORAGE_CLASS_INLINE int memcpy_s( +static inline int memcpy_s( void* dest_buf, size_t dest_size, const void* src_buf, @@ -89,7 +88,7 @@ static size_t strnlen_s( * @return Returns EINVAL on invalid arguments * @return Returns ERANGE on destination size too small */ -STORAGE_CLASS_INLINE int strncpy_s( +static inline int strncpy_s( char* dest_str, size_t dest_size, const char* src_str, @@ -130,7 +129,7 @@ STORAGE_CLASS_INLINE int strncpy_s( * @return Returns EINVAL on invalid arguments * @return Returns ERANGE on destination size too small */ -STORAGE_CLASS_INLINE int strcpy_s( +static inline int strcpy_s( char* dest_str, size_t dest_size, const char* src_str) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/tag.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/tag.h index 7385fd11c95f..ace695643369 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/tag.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/tag.h @@ -29,17 +29,16 @@ * */ -#include "storage_class.h" #include "tag_local.h" #ifndef __INLINE_TAG__ -#define STORAGE_CLASS_TAG_H STORAGE_CLASS_EXTERN +#define STORAGE_CLASS_TAG_H extern #define STORAGE_CLASS_TAG_C #include "tag_public.h" #else /* __INLINE_TAG__ */ -#define STORAGE_CLASS_TAG_H STORAGE_CLASS_INLINE -#define STORAGE_CLASS_TAG_C STORAGE_CLASS_INLINE +#define STORAGE_CLASS_TAG_H static inline +#define STORAGE_CLASS_TAG_C static inline #include "tag_private.h" #endif /* __INLINE_TAG__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/timed_ctrl.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/timed_ctrl.h index ed13451c9261..f6bc1c47553f 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/timed_ctrl.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/timed_ctrl.h @@ -29,18 +29,17 @@ * - local: system and cell specific constants and identifiers */ -#include "storage_class.h" #include "system_local.h" #include "timed_ctrl_local.h" #ifndef __INLINE_TIMED_CTRL__ -#define STORAGE_CLASS_TIMED_CTRL_H STORAGE_CLASS_EXTERN +#define STORAGE_CLASS_TIMED_CTRL_H extern #define STORAGE_CLASS_TIMED_CTRL_C #include "timed_ctrl_public.h" #else /* __INLINE_TIMED_CTRL__ */ -#define STORAGE_CLASS_TIMED_CTRL_H STORAGE_CLASS_INLINE -#define STORAGE_CLASS_TIMED_CTRL_C STORAGE_CLASS_INLINE +#define STORAGE_CLASS_TIMED_CTRL_H static inline +#define STORAGE_CLASS_TIMED_CTRL_C static inline #include "timed_ctrl_private.h" #endif /* __INLINE_TIMED_CTRL__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/type_support.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/type_support.h index b82fa3eba79f..bc77537fa73a 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/type_support.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/type_support.h @@ -30,27 +30,6 @@ #define IA_CSS_INT32_T_BITS 32 #define IA_CSS_UINT64_T_BITS 64 -#if defined(_MSC_VER) -#include <stdint.h> -/* For ATE compilation define the bool */ -#if defined(_ATE_) -#define bool int -#define true 1 -#define false 0 -#else -#include <stdbool.h> -#endif -#include <stddef.h> -#include <limits.h> -#include <errno.h> -#if defined(_M_X64) -#define HOST_ADDRESS(x) (unsigned long long)(x) -#else -#define HOST_ADDRESS(x) (unsigned long)(x) -#endif - -#elif defined(__KERNEL__) - #define CHAR_BIT (8) #include <linux/types.h> @@ -58,25 +37,4 @@ #include <linux/errno.h> #define HOST_ADDRESS(x) (unsigned long)(x) -#elif defined(__GNUC__) -#ifndef __STDC_LIMIT_MACROS -#define __STDC_LIMIT_MACROS 1 -#endif -#include <stdint.h> -#include <stdbool.h> -#include <stddef.h> -#include <limits.h> -#include <errno.h> -#define HOST_ADDRESS(x) (unsigned long)(x) - -#else /* default is for the FIST environment */ -#include <stdint.h> -#include <stdbool.h> -#include <stddef.h> -#include <limits.h> -#include <errno.h> -#define HOST_ADDRESS(x) (unsigned long)(x) - -#endif - #endif /* __TYPE_SUPPORT_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/vamem.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/vamem.h index acf932e1f563..82d447bf9704 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/vamem.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/vamem.h @@ -29,18 +29,17 @@ * - local: system and cell specific constants and identifiers */ -#include "storage_class.h" #include "system_local.h" #include "vamem_local.h" #ifndef __INLINE_VAMEM__ -#define STORAGE_CLASS_VAMEM_H STORAGE_CLASS_EXTERN +#define STORAGE_CLASS_VAMEM_H extern #define STORAGE_CLASS_VAMEM_C #include "vamem_public.h" #else /* __INLINE_VAMEM__ */ -#define STORAGE_CLASS_VAMEM_H STORAGE_CLASS_INLINE -#define STORAGE_CLASS_VAMEM_C STORAGE_CLASS_INLINE +#define STORAGE_CLASS_VAMEM_H static inline +#define STORAGE_CLASS_VAMEM_C static inline #include "vamem_private.h" #endif /* __INLINE_VAMEM__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/vector_func.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/vector_func.h index 5d3be31759e4..5368b9062897 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/vector_func.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/vector_func.h @@ -15,7 +15,6 @@ #ifndef __VECTOR_FUNC_H_INCLUDED__ #define __VECTOR_FUNC_H_INCLUDED__ -#include "storage_class.h" /* TODO: Later filters will be moved to types directory, * and we should only include matrix_MxN types */ @@ -27,12 +26,12 @@ #include "vector_func_local.h" #ifndef __INLINE_VECTOR_FUNC__ -#define STORAGE_CLASS_VECTOR_FUNC_H STORAGE_CLASS_EXTERN +#define STORAGE_CLASS_VECTOR_FUNC_H extern #define STORAGE_CLASS_VECTOR_FUNC_C #include "vector_func_public.h" #else /* __INLINE_VECTOR_FUNC__ */ -#define STORAGE_CLASS_VECTOR_FUNC_H STORAGE_CLASS_INLINE -#define STORAGE_CLASS_VECTOR_FUNC_C STORAGE_CLASS_INLINE +#define STORAGE_CLASS_VECTOR_FUNC_H static inline +#define STORAGE_CLASS_VECTOR_FUNC_C static inline #include "vector_func_private.h" #endif /* __INLINE_VECTOR_FUNC__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/vector_ops.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/vector_ops.h index 261f87378ce5..4923f2d5518b 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/vector_ops.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/vector_ops.h @@ -15,17 +15,16 @@ #ifndef __VECTOR_OPS_H_INCLUDED__ #define __VECTOR_OPS_H_INCLUDED__ -#include "storage_class.h" #include "vector_ops_local.h" #ifndef __INLINE_VECTOR_OPS__ -#define STORAGE_CLASS_VECTOR_OPS_H STORAGE_CLASS_EXTERN +#define STORAGE_CLASS_VECTOR_OPS_H extern #define STORAGE_CLASS_VECTOR_OPS_C #include "vector_ops_public.h" #else /* __INLINE_VECTOR_OPS__ */ -#define STORAGE_CLASS_VECTOR_OPS_H STORAGE_CLASS_INLINE -#define STORAGE_CLASS_VECTOR_OPS_C STORAGE_CLASS_INLINE +#define STORAGE_CLASS_VECTOR_OPS_H static inline +#define STORAGE_CLASS_VECTOR_OPS_C static inline #include "vector_ops_private.h" #endif /* __INLINE_VECTOR_OPS__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/vmem.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/vmem.h index 79a36755bfd9..d3375729c441 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/vmem.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/vmem.h @@ -29,18 +29,17 @@ * - local: system and cell specific constants and identifiers */ -#include "storage_class.h" #include "system_local.h" #include "vmem_local.h" #ifndef __INLINE_VMEM__ -#define STORAGE_CLASS_VMEM_H STORAGE_CLASS_EXTERN +#define STORAGE_CLASS_VMEM_H extern #define STORAGE_CLASS_VMEM_C #include "vmem_public.h" #else /* __INLINE_VMEM__ */ -#define STORAGE_CLASS_VMEM_H STORAGE_CLASS_INLINE -#define STORAGE_CLASS_VMEM_C STORAGE_CLASS_INLINE +#define STORAGE_CLASS_VMEM_H static inline +#define STORAGE_CLASS_VMEM_C static inline #include "vmem_private.h" #endif /* __INLINE_VMEM__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/xmem.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/xmem.h index 9169e04f9b4b..13083fe55141 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/xmem.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/xmem.h @@ -29,18 +29,17 @@ * - local: system and cell specific constants and identifiers */ -#include "storage_class.h" #include "system_local.h" #include "xmem_local.h" #ifndef __INLINE_XMEM__ -#define STORAGE_CLASS_XMEM_H STORAGE_CLASS_EXTERN +#define STORAGE_CLASS_XMEM_H extern #define STORAGE_CLASS_XMEM_C #include "xmem_public.h" #else /* __INLINE_XMEM__ */ -#define STORAGE_CLASS_XMEM_H STORAGE_CLASS_INLINE -#define STORAGE_CLASS_XMEM_C STORAGE_CLASS_INLINE +#define STORAGE_CLASS_XMEM_H static inline +#define STORAGE_CLASS_XMEM_C static inline #include "xmem_private.h" #endif /* __INLINE_XMEM__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/s3a/s3a_1.0/ia_css_s3a.host.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/s3a/s3a_1.0/ia_css_s3a.host.c index 8ef6c54ee813..aa733674f42b 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/s3a/s3a_1.0/ia_css_s3a.host.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/s3a/s3a_1.0/ia_css_s3a.host.c @@ -321,7 +321,7 @@ ia_css_s3a_dmem_decode( } /* MW: this is an ISP function */ -STORAGE_CLASS_INLINE int +static inline int merge_hi_lo_14(unsigned short hi, unsigned short lo) { int val = (int) ((((unsigned int) hi << 14) & 0xfffc000) | diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/binary/src/binary.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/binary/src/binary.c index 9f8a125f0d74..e028e460ae4c 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/binary/src/binary.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/binary/src/binary.c @@ -1697,11 +1697,11 @@ ia_css_binary_find(struct ia_css_binary_descr *descr, } #endif if (xcandidate->num_output_pins > 1 && /* in case we have a second output pin, */ - req_vf_info && /* and we need vf output. */ + req_vf_info && /* and we need vf output. */ /* check if the required vf format is supported. */ - !binary_supports_output_format(xcandidate, req_vf_info->format)) { - ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, + !binary_supports_output_format(xcandidate, req_vf_info->format)) { + ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "ia_css_binary_find() [%d] continue: (%d > %d) && (%p != NULL) && !%d\n", __LINE__, xcandidate->num_output_pins, 1, req_vf_info, @@ -1711,8 +1711,8 @@ ia_css_binary_find(struct ia_css_binary_descr *descr, /* Check if vf_veceven supports the requested vf format */ if (xcandidate->num_output_pins == 1 && - req_vf_info && candidate->enable.vf_veceven && - !binary_supports_vf_format(xcandidate, req_vf_info->format)) { + req_vf_info && candidate->enable.vf_veceven && + !binary_supports_vf_format(xcandidate, req_vf_info->format)) { ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "ia_css_binary_find() [%d] continue: (%d == %d) && (%p != NULL) && %d && !%d\n", __LINE__, xcandidate->num_output_pins, 1, @@ -1723,7 +1723,7 @@ ia_css_binary_find(struct ia_css_binary_descr *descr, /* Check if vf_veceven supports the requested vf width */ if (xcandidate->num_output_pins == 1 && - req_vf_info && candidate->enable.vf_veceven) { /* and we need vf output. */ + req_vf_info && candidate->enable.vf_veceven) { /* and we need vf output. */ if (req_vf_info->res.width > candidate->output.max_width) { ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "ia_css_binary_find() [%d] continue: (%d < %d)\n", diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/bufq/src/bufq.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/bufq/src/bufq.c index 5d40afd482f5..42d9a8508858 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/bufq/src/bufq.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/bufq/src/bufq.c @@ -280,7 +280,7 @@ static ia_css_queue_t *bufq_get_qhandle( /* Local function to initialize a buffer queue. This reduces * the chances of copy-paste errors or typos. */ -STORAGE_CLASS_INLINE void +static inline void init_bufq(unsigned int desc_offset, unsigned int elems_offset, ia_css_queue_t *handle) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/interface/ia_css_debug.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/interface/ia_css_debug.h index 91c105cc6204..3c8dcfd4bbc6 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/interface/ia_css_debug.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/interface/ia_css_debug.h @@ -130,7 +130,7 @@ enum ia_css_debug_enable_param_dump { * @param[in] fmt printf like format string * @param[in] args arguments for the format string */ -STORAGE_CLASS_INLINE void +static inline void ia_css_debug_vdtrace(unsigned int level, const char *fmt, va_list args) { if (ia_css_debug_trace_level >= level) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/ifmtr/src/ifmtr.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/ifmtr/src/ifmtr.c index a7c6bba7e094..11d3995ba0db 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/ifmtr/src/ifmtr.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/ifmtr/src/ifmtr.c @@ -29,6 +29,7 @@ more details. #endif #include "system_global.h" +#include <linux/kernel.h> #ifdef USE_INPUT_SYSTEM_VERSION_2 @@ -487,7 +488,7 @@ static void ifmtr_set_if_blocking_mode( { int i; bool block[] = { false, false, false, false }; - assert(N_INPUT_FORMATTER_ID <= (sizeof(block) / sizeof(block[0]))); + assert(N_INPUT_FORMATTER_ID <= (ARRAY_SIZE(block))); #if !defined(IS_ISP_2400_SYSTEM) #error "ifmtr_set_if_blocking_mode: ISP_SYSTEM must be one of {IS_ISP_2400_SYSTEM}" diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/inputfifo/src/inputfifo.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/inputfifo/src/inputfifo.c index cf02970d4f59..d9a5f3e9283a 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/inputfifo/src/inputfifo.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/inputfifo/src/inputfifo.c @@ -105,7 +105,7 @@ static struct inputfifo_instance /* Streaming to MIPI */ static unsigned inputfifo_wrap_marker( -/* STORAGE_CLASS_INLINE unsigned inputfifo_wrap_marker( */ +/* static inline unsigned inputfifo_wrap_marker( */ unsigned marker) { return marker | @@ -113,7 +113,7 @@ static unsigned inputfifo_wrap_marker( (inputfifo_curr_fmt_type << _HIVE_STR_TO_MIPI_FMT_TYPE_LSB); } -STORAGE_CLASS_INLINE void +static inline void _sh_css_fifo_snd(unsigned token) { while (!can_event_send_token(STR2MIPI_EVENT_ID)) @@ -123,7 +123,7 @@ _sh_css_fifo_snd(unsigned token) } static void inputfifo_send_data_a( -/* STORAGE_CLASS_INLINE void inputfifo_send_data_a( */ +/* static inline void inputfifo_send_data_a( */ unsigned int data) { unsigned int token = (1 << HIVE_STR_TO_MIPI_VALID_A_BIT) | @@ -135,7 +135,7 @@ unsigned int data) static void inputfifo_send_data_b( -/* STORAGE_CLASS_INLINE void inputfifo_send_data_b( */ +/* static inline void inputfifo_send_data_b( */ unsigned int data) { unsigned int token = (1 << HIVE_STR_TO_MIPI_VALID_B_BIT) | @@ -147,7 +147,7 @@ static void inputfifo_send_data_b( static void inputfifo_send_data( -/* STORAGE_CLASS_INLINE void inputfifo_send_data( */ +/* static inline void inputfifo_send_data( */ unsigned int a, unsigned int b) { @@ -162,7 +162,7 @@ static void inputfifo_send_data( static void inputfifo_send_sol(void) -/* STORAGE_CLASS_INLINE void inputfifo_send_sol(void) */ +/* static inline void inputfifo_send_sol(void) */ { hrt_data token = inputfifo_wrap_marker( 1 << HIVE_STR_TO_MIPI_SOL_BIT); @@ -174,7 +174,7 @@ static void inputfifo_send_sol(void) static void inputfifo_send_eol(void) -/* STORAGE_CLASS_INLINE void inputfifo_send_eol(void) */ +/* static inline void inputfifo_send_eol(void) */ { hrt_data token = inputfifo_wrap_marker( 1 << HIVE_STR_TO_MIPI_EOL_BIT); @@ -185,7 +185,7 @@ static void inputfifo_send_eol(void) static void inputfifo_send_sof(void) -/* STORAGE_CLASS_INLINE void inputfifo_send_sof(void) */ +/* static inline void inputfifo_send_sof(void) */ { hrt_data token = inputfifo_wrap_marker( 1 << HIVE_STR_TO_MIPI_SOF_BIT); @@ -197,7 +197,7 @@ static void inputfifo_send_sof(void) static void inputfifo_send_eof(void) -/* STORAGE_CLASS_INLINE void inputfifo_send_eof(void) */ +/* static inline void inputfifo_send_eof(void) */ { hrt_data token = inputfifo_wrap_marker( 1 << HIVE_STR_TO_MIPI_EOF_BIT); @@ -209,7 +209,7 @@ static void inputfifo_send_eof(void) #ifdef __ON__ static void inputfifo_send_ch_id( -/* STORAGE_CLASS_INLINE void inputfifo_send_ch_id( */ +/* static inline void inputfifo_send_ch_id( */ unsigned int ch_id) { hrt_data token; @@ -223,7 +223,7 @@ static void inputfifo_send_ch_id( } static void inputfifo_send_fmt_type( -/* STORAGE_CLASS_INLINE void inputfifo_send_fmt_type( */ +/* static inline void inputfifo_send_fmt_type( */ unsigned int fmt_type) { hrt_data token; @@ -240,7 +240,7 @@ static void inputfifo_send_fmt_type( static void inputfifo_send_ch_id_and_fmt_type( -/* STORAGE_CLASS_INLINE +/* static inline void inputfifo_send_ch_id_and_fmt_type( */ unsigned int ch_id, unsigned int fmt_type) @@ -259,7 +259,7 @@ void inputfifo_send_ch_id_and_fmt_type( */ static void inputfifo_send_empty_token(void) -/* STORAGE_CLASS_INLINE void inputfifo_send_empty_token(void) */ +/* static inline void inputfifo_send_empty_token(void) */ { hrt_data token = inputfifo_wrap_marker(0); _sh_css_fifo_snd(token); @@ -269,7 +269,7 @@ static void inputfifo_send_empty_token(void) static void inputfifo_start_frame( -/* STORAGE_CLASS_INLINE void inputfifo_start_frame( */ +/* static inline void inputfifo_start_frame( */ unsigned int ch_id, unsigned int fmt_type) { diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/pipeline/src/pipeline.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/pipeline/src/pipeline.c index 95542fc82217..62d13978475d 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/pipeline/src/pipeline.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/pipeline/src/pipeline.c @@ -603,7 +603,7 @@ static enum ia_css_err pipeline_stage_create( /* Verify input parameters*/ if (!(stage_desc->in_frame) && !(stage_desc->firmware) && (stage_desc->binary) && !(stage_desc->binary->online)) { - err = IA_CSS_ERR_INTERNAL_ERROR; + err = IA_CSS_ERR_INTERNAL_ERROR; goto ERR; } diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/rmgr/interface/ia_css_rmgr.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/rmgr/interface/ia_css_rmgr.h index a0bb9f663ce6..9f78e709b3d0 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/rmgr/interface/ia_css_rmgr.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/rmgr/interface/ia_css_rmgr.h @@ -31,15 +31,14 @@ more details. #ifndef _IA_CSS_RMGR_H #define _IA_CSS_RMGR_H -#include "storage_class.h" #include <ia_css_err.h> #ifndef __INLINE_RMGR__ -#define STORAGE_CLASS_RMGR_H STORAGE_CLASS_EXTERN +#define STORAGE_CLASS_RMGR_H extern #define STORAGE_CLASS_RMGR_C #else /* __INLINE_RMGR__ */ -#define STORAGE_CLASS_RMGR_H STORAGE_CLASS_INLINE -#define STORAGE_CLASS_RMGR_C STORAGE_CLASS_INLINE +#define STORAGE_CLASS_RMGR_H static inline +#define STORAGE_CLASS_RMGR_C static inline #endif /* __INLINE_RMGR__ */ /** diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/rmgr/src/rmgr_vbuf.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/rmgr/src/rmgr_vbuf.c index fa92d8da8f1c..e56006c07ee8 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/rmgr/src/rmgr_vbuf.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/rmgr/src/rmgr_vbuf.c @@ -174,7 +174,7 @@ void ia_css_rmgr_uninit_vbuf(struct ia_css_rmgr_vbuf_pool *pool) ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "ia_css_rmgr_uninit_vbuf()\n"); if (pool == NULL) { ia_css_debug_dtrace(IA_CSS_DEBUG_ERROR, "ia_css_rmgr_uninit_vbuf(): NULL argument\n"); - return; + return; } if (pool->handles != NULL) { /* free the hmm buffers */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/spctrl/src/spctrl.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/spctrl/src/spctrl.c index d9178e80dab2..6d9bceb60196 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/spctrl/src/spctrl.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/spctrl/src/spctrl.c @@ -37,7 +37,7 @@ more details. #include "ia_css_spctrl.h" #include "ia_css_debug.h" -typedef struct { +struct spctrl_context_info { struct ia_css_sp_init_dmem_cfg dmem_config; uint32_t spctrl_config_dmem_addr; /** location of dmem_cfg in SP dmem */ uint32_t spctrl_state_dmem_addr; @@ -45,9 +45,9 @@ typedef struct { hrt_vaddress code_addr; /* sp firmware location in host mem-DDR*/ uint32_t code_size; char *program_name; /* used in case of PLATFORM_SIM */ -} spctrl_context_info; +}; -static spctrl_context_info spctrl_cofig_info[N_SP_ID]; +static struct spctrl_context_info spctrl_cofig_info[N_SP_ID]; static bool spctrl_loaded[N_SP_ID] = {0}; /* Load firmware */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c index e882b5596813..f92b6a9f77eb 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c @@ -451,8 +451,6 @@ static enum ia_css_frame_format yuv422_copy_formats[] = { IA_CSS_FRAME_FORMAT_YUYV }; -#define array_length(array) (sizeof(array)/sizeof(array[0])) - /* Verify whether the selected output format is can be produced * by the copy binary given the stream format. * */ @@ -468,7 +466,7 @@ verify_copy_out_frame_format(struct ia_css_pipe *pipe) switch (pipe->stream->config.input_config.format) { case IA_CSS_STREAM_FORMAT_YUV420_8_LEGACY: case IA_CSS_STREAM_FORMAT_YUV420_8: - for (i=0; i<array_length(yuv420_copy_formats) && !found; i++) + for (i=0; i<ARRAY_SIZE(yuv420_copy_formats) && !found; i++) found = (out_fmt == yuv420_copy_formats[i]); break; case IA_CSS_STREAM_FORMAT_YUV420_10: @@ -476,7 +474,7 @@ verify_copy_out_frame_format(struct ia_css_pipe *pipe) found = (out_fmt == IA_CSS_FRAME_FORMAT_YUV420_16); break; case IA_CSS_STREAM_FORMAT_YUV422_8: - for (i=0; i<array_length(yuv422_copy_formats) && !found; i++) + for (i=0; i<ARRAY_SIZE(yuv422_copy_formats) && !found; i++) found = (out_fmt == yuv422_copy_formats[i]); break; case IA_CSS_STREAM_FORMAT_YUV422_10: @@ -3781,6 +3779,7 @@ static enum ia_css_err create_host_acc_pipeline(struct ia_css_pipe *pipe) { enum ia_css_err err = IA_CSS_SUCCESS; + const struct ia_css_fw_info *fw; unsigned int i; IA_CSS_ENTER_PRIVATE("pipe = %p", pipe); @@ -3794,14 +3793,12 @@ create_host_acc_pipeline(struct ia_css_pipe *pipe) if (pipe->config.acc_extension) pipe->pipeline.pipe_qos_config = 0; -{ - const struct ia_css_fw_info *fw = pipe->vf_stage; + fw = pipe->vf_stage; for (i = 0; fw; fw = fw->next){ err = sh_css_pipeline_add_acc_stage(&pipe->pipeline, fw); if (err != IA_CSS_SUCCESS) goto ERR; } -} for (i=0; i<pipe->config.num_acc_stages; i++) { struct ia_css_fw_info *fw = pipe->config.acc_stages[i]; @@ -4333,12 +4330,13 @@ ia_css_pipe_enqueue_buffer(struct ia_css_pipe *pipe, } } } else if ((buf_type == IA_CSS_BUFFER_TYPE_INPUT_FRAME) - || (buf_type == IA_CSS_BUFFER_TYPE_OUTPUT_FRAME) - || (buf_type == IA_CSS_BUFFER_TYPE_VF_OUTPUT_FRAME) - || (buf_type == IA_CSS_BUFFER_TYPE_SEC_OUTPUT_FRAME) - || (buf_type == IA_CSS_BUFFER_TYPE_SEC_VF_OUTPUT_FRAME) - || (buf_type == IA_CSS_BUFFER_TYPE_METADATA)) { - return_err = ia_css_bufq_enqueue_buffer(thread_id, + || (buf_type == IA_CSS_BUFFER_TYPE_OUTPUT_FRAME) + || (buf_type == IA_CSS_BUFFER_TYPE_VF_OUTPUT_FRAME) + || (buf_type == IA_CSS_BUFFER_TYPE_SEC_OUTPUT_FRAME) + || (buf_type == IA_CSS_BUFFER_TYPE_SEC_VF_OUTPUT_FRAME) + || (buf_type == IA_CSS_BUFFER_TYPE_METADATA)) { + + return_err = ia_css_bufq_enqueue_buffer(thread_id, queue_id, (uint32_t)h_vbuf->vptr); #if defined(SH_CSS_ENABLE_PER_FRAME_PARAMS) @@ -5607,13 +5605,13 @@ static enum ia_css_err load_video_binaries(struct ia_css_pipe *pipe) mycs->num_yuv_scaler = cas_scaler_descr.num_stage; mycs->yuv_scaler_binary = kzalloc(cas_scaler_descr.num_stage * sizeof(struct ia_css_binary), GFP_KERNEL); - if (mycs->yuv_scaler_binary == NULL) { + if (!mycs->yuv_scaler_binary) { err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; return err; } mycs->is_output_stage = kzalloc(cas_scaler_descr.num_stage * sizeof(bool), GFP_KERNEL); - if (mycs->is_output_stage == NULL) { + if (!mycs->is_output_stage) { err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; return err; } @@ -5797,13 +5795,15 @@ static enum ia_css_err load_video_binaries(struct ia_css_pipe *pipe) #endif /* Make tnr reference buffers output block height align */ - tnr_info.res.height = #ifndef ISP2401 + tnr_info.res.height = CEIL_MUL(tnr_info.res.height, + mycs->video_binary.info->sp.block.output_block_height); #else + tnr_info.res.height = CEIL_MUL(tnr_height, + mycs->video_binary.info->sp.block.output_block_height); #endif - mycs->video_binary.info->sp.block.output_block_height); } else { tnr_info = mycs->video_binary.internal_frame_info; } @@ -6027,7 +6027,7 @@ sh_css_pipe_configure_viewfinder(struct ia_css_pipe *pipe, unsigned int width, err = ia_css_util_check_res(width, height); if (err != IA_CSS_SUCCESS) { - IA_CSS_LEAVE_ERR_PRIVATE(err); + IA_CSS_LEAVE_ERR_PRIVATE(err); return err; } if (pipe->vf_output_info[idx].res.width != width || @@ -6258,14 +6258,14 @@ static enum ia_css_err load_primary_binaries( mycs->num_yuv_scaler = cas_scaler_descr.num_stage; mycs->yuv_scaler_binary = kzalloc(cas_scaler_descr.num_stage * sizeof(struct ia_css_binary), GFP_KERNEL); - if (mycs->yuv_scaler_binary == NULL) { + if (!mycs->yuv_scaler_binary) { err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; IA_CSS_LEAVE_ERR_PRIVATE(err); return err; } mycs->is_output_stage = kzalloc(cas_scaler_descr.num_stage * sizeof(bool), GFP_KERNEL); - if (mycs->is_output_stage == NULL) { + if (!mycs->is_output_stage) { err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; IA_CSS_LEAVE_ERR_PRIVATE(err); return err; @@ -6982,27 +6982,27 @@ static enum ia_css_err ia_css_pipe_create_cas_scaler_desc_single_output( } descr->in_info = kmalloc(descr->num_stage * sizeof(struct ia_css_frame_info), GFP_KERNEL); - if (descr->in_info == NULL) { + if (!descr->in_info) { err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; goto ERR; } descr->internal_out_info = kmalloc(descr->num_stage * sizeof(struct ia_css_frame_info), GFP_KERNEL); - if (descr->internal_out_info == NULL) { + if (!descr->internal_out_info) { err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; goto ERR; } descr->out_info = kmalloc(descr->num_stage * sizeof(struct ia_css_frame_info), GFP_KERNEL); - if (descr->out_info == NULL) { + if (!descr->out_info) { err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; goto ERR; } descr->vf_info = kmalloc(descr->num_stage * sizeof(struct ia_css_frame_info), GFP_KERNEL); - if (descr->vf_info == NULL) { + if (!descr->vf_info) { err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; goto ERR; } descr->is_output_stage = kmalloc(descr->num_stage * sizeof(bool), GFP_KERNEL); - if (descr->is_output_stage == NULL) { + if (!descr->is_output_stage) { err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; goto ERR; } @@ -7118,22 +7118,22 @@ static enum ia_css_err ia_css_pipe_create_cas_scaler_desc(struct ia_css_pipe *pi descr->num_stage = num_stages; descr->in_info = kmalloc(descr->num_stage * sizeof(struct ia_css_frame_info), GFP_KERNEL); - if (descr->in_info == NULL) { + if (!descr->in_info) { err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; goto ERR; } descr->internal_out_info = kmalloc(descr->num_stage * sizeof(struct ia_css_frame_info), GFP_KERNEL); - if (descr->internal_out_info == NULL) { + if (!descr->internal_out_info) { err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; goto ERR; } descr->out_info = kmalloc(descr->num_stage * sizeof(struct ia_css_frame_info), GFP_KERNEL); - if (descr->out_info == NULL) { + if (!descr->out_info) { err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; goto ERR; } descr->vf_info = kmalloc(descr->num_stage * sizeof(struct ia_css_frame_info), GFP_KERNEL); - if (descr->vf_info == NULL) { + if (!descr->vf_info) { err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; goto ERR; } @@ -7276,13 +7276,13 @@ load_yuvpp_binaries(struct ia_css_pipe *pipe) mycs->num_yuv_scaler = cas_scaler_descr.num_stage; mycs->yuv_scaler_binary = kzalloc(cas_scaler_descr.num_stage * sizeof(struct ia_css_binary), GFP_KERNEL); - if (mycs->yuv_scaler_binary == NULL) { + if (!mycs->yuv_scaler_binary) { err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; goto ERR; } mycs->is_output_stage = kzalloc(cas_scaler_descr.num_stage * sizeof(bool), GFP_KERNEL); - if (mycs->is_output_stage == NULL) { + if (!mycs->is_output_stage) { err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; goto ERR; } @@ -7383,7 +7383,7 @@ load_yuvpp_binaries(struct ia_css_pipe *pipe) } mycs->vf_pp_binary = kzalloc(mycs->num_vf_pp * sizeof(struct ia_css_binary), GFP_KERNEL); - if (mycs->vf_pp_binary == NULL) { + if (!mycs->vf_pp_binary) { err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; goto ERR; } @@ -8689,9 +8689,9 @@ enum ia_css_err ia_css_stream_capture( /* Check if the tag descriptor is valid */ if (num_captures < SH_CSS_MINIMUM_TAG_ID) { - ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, - "ia_css_stream_capture() leave: return_err=%d\n", - IA_CSS_ERR_INVALID_ARGUMENTS); + ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, + "ia_css_stream_capture() leave: return_err=%d\n", + IA_CSS_ERR_INVALID_ARGUMENTS); return IA_CSS_ERR_INVALID_ARGUMENTS; } @@ -9445,7 +9445,7 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, /* allocate the stream instance */ curr_stream = kmalloc(sizeof(struct ia_css_stream), GFP_KERNEL); - if (curr_stream == NULL) { + if (!curr_stream) { err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; IA_CSS_LEAVE_ERR(err); return err; @@ -9457,7 +9457,7 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, /* allocate pipes */ curr_stream->num_pipes = num_pipes; curr_stream->pipes = kzalloc(num_pipes * sizeof(struct ia_css_pipe *), GFP_KERNEL); - if (curr_stream->pipes == NULL) { + if (!curr_stream->pipes) { curr_stream->num_pipes = 0; kfree(curr_stream); curr_stream = NULL; @@ -9780,23 +9780,22 @@ ERR: if (err == IA_CSS_SUCCESS) { /* working mode: enter into the seed list */ - if (my_css_save.mode == sh_css_mode_working) - for(i = 0; i < MAX_ACTIVE_STREAMS; i++) - if (my_css_save.stream_seeds[i].stream == NULL) - { - IA_CSS_LOG("entered stream into loc=%d", i); - my_css_save.stream_seeds[i].orig_stream = stream; - my_css_save.stream_seeds[i].stream = curr_stream; - my_css_save.stream_seeds[i].num_pipes = num_pipes; - my_css_save.stream_seeds[i].stream_config = *stream_config; - for(j = 0; j < num_pipes; j++) - { - my_css_save.stream_seeds[i].pipe_config[j] = pipes[j]->config; - my_css_save.stream_seeds[i].pipes[j] = pipes[j]; - my_css_save.stream_seeds[i].orig_pipes[j] = &pipes[j]; - } - break; + if (my_css_save.mode == sh_css_mode_working) { + for (i = 0; i < MAX_ACTIVE_STREAMS; i++) + if (!my_css_save.stream_seeds[i].stream) { + IA_CSS_LOG("entered stream into loc=%d", i); + my_css_save.stream_seeds[i].orig_stream = stream; + my_css_save.stream_seeds[i].stream = curr_stream; + my_css_save.stream_seeds[i].num_pipes = num_pipes; + my_css_save.stream_seeds[i].stream_config = *stream_config; + for (j = 0; j < num_pipes; j++) { + my_css_save.stream_seeds[i].pipe_config[j] = pipes[j]->config; + my_css_save.stream_seeds[i].pipes[j] = pipes[j]; + my_css_save.stream_seeds[i].orig_pipes[j] = &pipes[j]; + } + break; } + } #else if (err == IA_CSS_SUCCESS) { err = ia_css_save_stream(curr_stream); @@ -9970,32 +9969,32 @@ ia_css_stream_load(struct ia_css_stream *stream) enum ia_css_err err; assert(stream != NULL); ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "ia_css_stream_load() enter, \n"); - for(i=0;i<MAX_ACTIVE_STREAMS;i++) - if (my_css_save.stream_seeds[i].stream == stream) - { + for (i = 0; i < MAX_ACTIVE_STREAMS; i++) { + if (my_css_save.stream_seeds[i].stream == stream) { int j; - for(j=0;j<my_css_save.stream_seeds[i].num_pipes;j++) - if ((err = ia_css_pipe_create(&(my_css_save.stream_seeds[i].pipe_config[j]), &my_css_save.stream_seeds[i].pipes[j])) != IA_CSS_SUCCESS) - { - if (j) - { + for ( j = 0; j < my_css_save.stream_seeds[i].num_pipes; j++) { + if ((err = ia_css_pipe_create(&(my_css_save.stream_seeds[i].pipe_config[j]), &my_css_save.stream_seeds[i].pipes[j])) != IA_CSS_SUCCESS) { + if (j) { int k; for(k=0;k<j;k++) ia_css_pipe_destroy(my_css_save.stream_seeds[i].pipes[k]); } return err; } - err = ia_css_stream_create(&(my_css_save.stream_seeds[i].stream_config), my_css_save.stream_seeds[i].num_pipes, - my_css_save.stream_seeds[i].pipes, &(my_css_save.stream_seeds[i].stream)); - if (err != IA_CSS_SUCCESS) - { + } + err = ia_css_stream_create(&(my_css_save.stream_seeds[i].stream_config), + my_css_save.stream_seeds[i].num_pipes, + my_css_save.stream_seeds[i].pipes, + &(my_css_save.stream_seeds[i].stream)); + if (err != IA_CSS_SUCCESS) { ia_css_stream_destroy(stream); - for(j=0;j<my_css_save.stream_seeds[i].num_pipes;j++) + for (j = 0; j < my_css_save.stream_seeds[i].num_pipes; j++) ia_css_pipe_destroy(my_css_save.stream_seeds[i].pipes[j]); return err; } break; } + } ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "ia_css_stream_load() exit, \n"); return IA_CSS_SUCCESS; #else @@ -10524,7 +10523,7 @@ ia_css_update_continuous_frames(struct ia_css_stream *stream) ia_css_debug_dtrace( IA_CSS_DEBUG_TRACE, "sh_css_update_continuous_frames() leave: invalid stream, return_void\n"); - return IA_CSS_ERR_INVALID_ARGUMENTS; + return IA_CSS_ERR_INVALID_ARGUMENTS; } pipe = stream->continuous_pipe; diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c index 53a7891111f9..8158ea40d069 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c @@ -147,7 +147,7 @@ sh_css_load_blob_info(const char *fw, const struct ia_css_fw_info *bi, struct ia char *parambuf = kmalloc(paramstruct_size + configstruct_size + statestruct_size, GFP_KERNEL); - if (parambuf == NULL) + if (!parambuf) return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; bd->mem_offsets.array[IA_CSS_PARAM_CLASS_PARAM].ptr = NULL; @@ -229,14 +229,15 @@ sh_css_load_firmware(const char *fw_data, sh_css_blob_info = kmalloc( (sh_css_num_binaries - NUM_OF_SPS) * sizeof(*sh_css_blob_info), GFP_KERNEL); - if (sh_css_blob_info == NULL) + if (!sh_css_blob_info) return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; } else { sh_css_blob_info = NULL; } - fw_minibuffer = kzalloc(sh_css_num_binaries * sizeof(struct fw_param), GFP_KERNEL); - if (fw_minibuffer == NULL) + fw_minibuffer = kcalloc(sh_css_num_binaries, sizeof(struct fw_param), + GFP_KERNEL); + if (!fw_minibuffer) return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; for (i = 0; i < sh_css_num_binaries; i++) { @@ -295,10 +296,8 @@ void sh_css_unload_firmware(void) } memset(&sh_css_sp_fw, 0, sizeof(sh_css_sp_fw)); - if (sh_css_blob_info) { - kfree(sh_css_blob_info); - sh_css_blob_info = NULL; - } + kfree(sh_css_blob_info); + sh_css_blob_info = NULL; sh_css_num_binaries = 0; } diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_hrt.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_hrt.c index 0bfebced63af..716d808d56db 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_hrt.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_hrt.c @@ -80,5 +80,5 @@ enum ia_css_err sh_css_hrt_sp_wait(void) hrt_sleep(); } -return IA_CSS_SUCCESS; + return IA_CSS_SUCCESS; } diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_internal.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_internal.h index 5b2b78f96dc5..0910021286a4 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_internal.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_internal.h @@ -961,7 +961,7 @@ struct host_sp_queues { extern int (*sh_css_printf)(const char *fmt, va_list args); -STORAGE_CLASS_INLINE void +static inline void sh_css_print(const char *fmt, ...) { va_list ap; @@ -973,7 +973,7 @@ sh_css_print(const char *fmt, ...) } } -STORAGE_CLASS_INLINE void +static inline void sh_css_vprint(const char *fmt, va_list args) { if (sh_css_printf) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_param_shading.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_param_shading.c index eaf60e7b2dac..e6ebd1b08f0d 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_param_shading.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_param_shading.c @@ -365,10 +365,8 @@ ia_css_shading_table_alloc( IA_CSS_ENTER(""); me = kmalloc(sizeof(*me), GFP_KERNEL); - if (me == NULL) { - IA_CSS_ERROR("out of memory"); + if (!me) return me; - } me->width = width; me->height = height; diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_params.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_params.c index 48224370b8bf..fbb36112fe3c 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_params.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_params.c @@ -4266,33 +4266,33 @@ sh_css_params_write_to_ddr_internal( size_t *virt_size_tetra_y[ IA_CSS_MORPH_TABLE_NUM_PLANES]; - virt_addr_tetra_x[0] = &ddr_map->tetra_r_x; - virt_addr_tetra_x[1] = &ddr_map->tetra_gr_x; - virt_addr_tetra_x[2] = &ddr_map->tetra_gb_x; - virt_addr_tetra_x[3] = &ddr_map->tetra_b_x; - virt_addr_tetra_x[4] = &ddr_map->tetra_ratb_x; - virt_addr_tetra_x[5] = &ddr_map->tetra_batr_x; - - virt_size_tetra_x[0] = &ddr_map_size->tetra_r_x; - virt_size_tetra_x[1] = &ddr_map_size->tetra_gr_x; - virt_size_tetra_x[2] = &ddr_map_size->tetra_gb_x; - virt_size_tetra_x[3] = &ddr_map_size->tetra_b_x; - virt_size_tetra_x[4] = &ddr_map_size->tetra_ratb_x; - virt_size_tetra_x[5] = &ddr_map_size->tetra_batr_x; - - virt_addr_tetra_y[0] = &ddr_map->tetra_r_y; - virt_addr_tetra_y[1] = &ddr_map->tetra_gr_y; - virt_addr_tetra_y[2] = &ddr_map->tetra_gb_y; - virt_addr_tetra_y[3] = &ddr_map->tetra_b_y; - virt_addr_tetra_y[4] = &ddr_map->tetra_ratb_y; - virt_addr_tetra_y[5] = &ddr_map->tetra_batr_y; - - virt_size_tetra_y[0] = &ddr_map_size->tetra_r_y; - virt_size_tetra_y[1] = &ddr_map_size->tetra_gr_y; - virt_size_tetra_y[2] = &ddr_map_size->tetra_gb_y; - virt_size_tetra_y[3] = &ddr_map_size->tetra_b_y; - virt_size_tetra_y[4] = &ddr_map_size->tetra_ratb_y; - virt_size_tetra_y[5] = &ddr_map_size->tetra_batr_y; + virt_addr_tetra_x[0] = &ddr_map->tetra_r_x; + virt_addr_tetra_x[1] = &ddr_map->tetra_gr_x; + virt_addr_tetra_x[2] = &ddr_map->tetra_gb_x; + virt_addr_tetra_x[3] = &ddr_map->tetra_b_x; + virt_addr_tetra_x[4] = &ddr_map->tetra_ratb_x; + virt_addr_tetra_x[5] = &ddr_map->tetra_batr_x; + + virt_size_tetra_x[0] = &ddr_map_size->tetra_r_x; + virt_size_tetra_x[1] = &ddr_map_size->tetra_gr_x; + virt_size_tetra_x[2] = &ddr_map_size->tetra_gb_x; + virt_size_tetra_x[3] = &ddr_map_size->tetra_b_x; + virt_size_tetra_x[4] = &ddr_map_size->tetra_ratb_x; + virt_size_tetra_x[5] = &ddr_map_size->tetra_batr_x; + + virt_addr_tetra_y[0] = &ddr_map->tetra_r_y; + virt_addr_tetra_y[1] = &ddr_map->tetra_gr_y; + virt_addr_tetra_y[2] = &ddr_map->tetra_gb_y; + virt_addr_tetra_y[3] = &ddr_map->tetra_b_y; + virt_addr_tetra_y[4] = &ddr_map->tetra_ratb_y; + virt_addr_tetra_y[5] = &ddr_map->tetra_batr_y; + + virt_size_tetra_y[0] = &ddr_map_size->tetra_r_y; + virt_size_tetra_y[1] = &ddr_map_size->tetra_gr_y; + virt_size_tetra_y[2] = &ddr_map_size->tetra_gb_y; + virt_size_tetra_y[3] = &ddr_map_size->tetra_b_y; + virt_size_tetra_y[4] = &ddr_map_size->tetra_ratb_y; + virt_size_tetra_y[5] = &ddr_map_size->tetra_batr_y; buff_realloced = false; for (i = 0; i < IA_CSS_MORPH_TABLE_NUM_PLANES; i++) { diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c index b8aae4ba5a78..a1c81c12718c 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c @@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ /* diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c index 5232327f5d9c..6e2dce7a5a2d 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c @@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ /* @@ -58,7 +54,7 @@ static unsigned int nr_to_order_bottom(unsigned int nr) return fls(nr) - 1; } -struct hmm_buffer_object *__bo_alloc(struct kmem_cache *bo_cache) +static struct hmm_buffer_object *__bo_alloc(struct kmem_cache *bo_cache) { struct hmm_buffer_object *bo; @@ -99,7 +95,7 @@ static int __bo_init(struct hmm_bo_device *bdev, struct hmm_buffer_object *bo, return 0; } -struct hmm_buffer_object *__bo_search_and_remove_from_free_rbtree( +static struct hmm_buffer_object *__bo_search_and_remove_from_free_rbtree( struct rb_node *node, unsigned int pgnr) { struct hmm_buffer_object *this, *ret_bo, *temp_bo; @@ -150,7 +146,7 @@ remove_bo_and_return: return temp_bo; } -struct hmm_buffer_object *__bo_search_by_addr(struct rb_root *root, +static struct hmm_buffer_object *__bo_search_by_addr(struct rb_root *root, ia_css_ptr start) { struct rb_node *n = root->rb_node; @@ -175,8 +171,8 @@ struct hmm_buffer_object *__bo_search_by_addr(struct rb_root *root, return NULL; } -struct hmm_buffer_object *__bo_search_by_addr_in_range(struct rb_root *root, - unsigned int start) +static struct hmm_buffer_object *__bo_search_by_addr_in_range( + struct rb_root *root, unsigned int start) { struct rb_node *n = root->rb_node; struct hmm_buffer_object *bo; @@ -258,7 +254,7 @@ static void __bo_insert_to_alloc_rbtree(struct rb_root *root, rb_insert_color(&bo->node, root); } -struct hmm_buffer_object *__bo_break_up(struct hmm_bo_device *bdev, +static struct hmm_buffer_object *__bo_break_up(struct hmm_bo_device *bdev, struct hmm_buffer_object *bo, unsigned int pgnr) { @@ -331,7 +327,7 @@ static void __bo_take_off_handling(struct hmm_buffer_object *bo) } } -struct hmm_buffer_object *__bo_merge(struct hmm_buffer_object *bo, +static struct hmm_buffer_object *__bo_merge(struct hmm_buffer_object *bo, struct hmm_buffer_object *next_bo) { struct hmm_bo_device *bdev; @@ -727,10 +723,8 @@ static int alloc_private_pages(struct hmm_buffer_object *bo, bo->page_obj = kmalloc_array(pgnr, sizeof(struct hmm_page_object), GFP_KERNEL); - if (unlikely(!bo->page_obj)) { - dev_err(atomisp_dev, "out of memory for bo->page_obj\n"); + if (unlikely(!bo->page_obj)) return -ENOMEM; - } i = 0; alloc_pgnr = 0; @@ -991,15 +985,12 @@ static int alloc_user_pages(struct hmm_buffer_object *bo, struct page **pages; pages = kmalloc_array(bo->pgnr, sizeof(struct page *), GFP_KERNEL); - if (unlikely(!pages)) { - dev_err(atomisp_dev, "out of memory for pages...\n"); + if (unlikely(!pages)) return -ENOMEM; - } bo->page_obj = kmalloc_array(bo->pgnr, sizeof(struct hmm_page_object), GFP_KERNEL); if (unlikely(!bo->page_obj)) { - dev_err(atomisp_dev, "out of memory for bo->page_obj...\n"); kfree(pages); return -ENOMEM; } @@ -1168,13 +1159,9 @@ status_err2: int hmm_bo_page_allocated(struct hmm_buffer_object *bo) { - int ret; - check_bo_null_return(bo, 0); - ret = bo->status & HMM_BO_PAGE_ALLOCED; - - return ret; + return bo->status & HMM_BO_PAGE_ALLOCED; } /* @@ -1366,7 +1353,6 @@ void *hmm_bo_vmap(struct hmm_buffer_object *bo, bool cached) pages = kmalloc_array(bo->pgnr, sizeof(*pages), GFP_KERNEL); if (unlikely(!pages)) { mutex_unlock(&bo->mutex); - dev_err(atomisp_dev, "out of memory for pages...\n"); return NULL; } diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_dynamic_pool.c b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_dynamic_pool.c index 19e0e9ee37de..f59fd9908257 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_dynamic_pool.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_dynamic_pool.c @@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ /* @@ -116,8 +112,6 @@ static void free_pages_to_dynamic_pool(void *pool, hmm_page = kmem_cache_zalloc(dypool_info->pgptr_cache, GFP_KERNEL); if (!hmm_page) { - dev_err(atomisp_dev, "out of memory for hmm_page.\n"); - /* free page directly */ ret = set_pages_wb(page_obj->page, 1); if (ret) @@ -151,10 +145,8 @@ static int hmm_dynamic_pool_init(void **pool, unsigned int pool_size) dypool_info = kmalloc(sizeof(struct hmm_dynamic_pool_info), GFP_KERNEL); - if (unlikely(!dypool_info)) { - dev_err(atomisp_dev, "out of memory for repool_info.\n"); + if (unlikely(!dypool_info)) return -ENOMEM; - } dypool_info->pgptr_cache = kmem_cache_create("pgptr_cache", sizeof(struct hmm_page), 0, diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_reserved_pool.c b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_reserved_pool.c index bf6586805f7f..f300e7547997 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_reserved_pool.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_reserved_pool.c @@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ /* @@ -92,15 +88,12 @@ static int hmm_reserved_pool_setup(struct hmm_reserved_pool_info **repool_info, pool_info = kmalloc(sizeof(struct hmm_reserved_pool_info), GFP_KERNEL); - if (unlikely(!pool_info)) { - dev_err(atomisp_dev, "out of memory for repool_info.\n"); + if (unlikely(!pool_info)) return -ENOMEM; - } pool_info->pages = kmalloc(sizeof(struct page *) * pool_size, GFP_KERNEL); if (unlikely(!pool_info->pages)) { - dev_err(atomisp_dev, "out of memory for repool_info->pages.\n"); kfree(pool_info); return -ENOMEM; } diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_vm.c b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_vm.c index 0722a68a49e7..0df96e661983 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_vm.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_vm.c @@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ /* @@ -89,10 +85,8 @@ static struct hmm_vm_node *alloc_hmm_vm_node(unsigned int pgnr, struct hmm_vm_node *node; node = kmem_cache_alloc(vm->cache, GFP_KERNEL); - if (!node) { - dev_err(atomisp_dev, "out of memory.\n"); + if (!node) return NULL; - } INIT_LIST_HEAD(&node->list); node->pgnr = pgnr; diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hrt/hive_isp_css_custom_host_hrt.h b/drivers/staging/media/atomisp/pci/atomisp2/hrt/hive_isp_css_custom_host_hrt.h index 46a5d29e2d3a..fb38fc540b81 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/hrt/hive_isp_css_custom_host_hrt.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/hrt/hive_isp_css_custom_host_hrt.h @@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ #ifndef _hive_isp_css_custom_host_hrt_h_ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hrt/hive_isp_css_mm_hrt.c b/drivers/staging/media/atomisp/pci/atomisp2/hrt/hive_isp_css_mm_hrt.c index 2e78976bb2ac..a94958bde718 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/hrt/hive_isp_css_mm_hrt.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/hrt/hive_isp_css_mm_hrt.c @@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hrt/hive_isp_css_mm_hrt.h b/drivers/staging/media/atomisp/pci/atomisp2/hrt/hive_isp_css_mm_hrt.h index 1328944a7afd..15c2dfb6794e 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/hrt/hive_isp_css_mm_hrt.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/hrt/hive_isp_css_mm_hrt.h @@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/include/hmm/hmm.h b/drivers/staging/media/atomisp/pci/atomisp2/include/hmm/hmm.h index 6b9fb1b2caaf..1e135c7c6d9b 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/include/hmm/hmm.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/include/hmm/hmm.h @@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/include/hmm/hmm_bo.h b/drivers/staging/media/atomisp/pci/atomisp2/include/hmm/hmm_bo.h index dffd6e9cf693..bd44ebbc427c 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/include/hmm/hmm_bo.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/include/hmm/hmm_bo.h @@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/include/hmm/hmm_bo_dev.h b/drivers/staging/media/atomisp/pci/atomisp2/include/hmm/hmm_bo_dev.h index a9446adb4c70..9e51a657ece4 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/include/hmm/hmm_bo_dev.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/include/hmm/hmm_bo_dev.h @@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/include/hmm/hmm_common.h b/drivers/staging/media/atomisp/pci/atomisp2/include/hmm/hmm_common.h index f1593aa38ce1..00885203fb14 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/include/hmm/hmm_common.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/include/hmm/hmm_common.h @@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/include/hmm/hmm_pool.h b/drivers/staging/media/atomisp/pci/atomisp2/include/hmm/hmm_pool.h index 1ba360433d88..bf24e44462bc 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/include/hmm/hmm_pool.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/include/hmm/hmm_pool.h @@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ #ifndef __HMM_POOL_H__ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/include/hmm/hmm_vm.h b/drivers/staging/media/atomisp/pci/atomisp2/include/hmm/hmm_vm.h index 07d40662de32..52098161082d 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/include/hmm/hmm_vm.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/include/hmm/hmm_vm.h @@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/include/mmu/isp_mmu.h b/drivers/staging/media/atomisp/pci/atomisp2/include/mmu/isp_mmu.h index 6b4eefc929e2..560014add005 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/include/mmu/isp_mmu.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/include/mmu/isp_mmu.h @@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ /* diff --git a/drivers/staging/media/atomisp/pci/atomisp2/include/mmu/sh_mmu.h b/drivers/staging/media/atomisp/pci/atomisp2/include/mmu/sh_mmu.h index 06041e94cbb2..031c0398bf65 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/include/mmu/sh_mmu.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/include/mmu/sh_mmu.h @@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ #ifndef SH_MMU_H_ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/include/mmu/sh_mmu_mrfld.h b/drivers/staging/media/atomisp/pci/atomisp2/include/mmu/sh_mmu_mrfld.h index b9bad9f06235..662e98f41da2 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/include/mmu/sh_mmu_mrfld.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/include/mmu/sh_mmu_mrfld.h @@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/mmu/isp_mmu.c b/drivers/staging/media/atomisp/pci/atomisp2/mmu/isp_mmu.c index 706bd43e8b1b..e36c2a33b41a 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/mmu/isp_mmu.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/mmu/isp_mmu.c @@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ /* diff --git a/drivers/staging/media/atomisp/pci/atomisp2/mmu/sh_mmu_mrfld.c b/drivers/staging/media/atomisp/pci/atomisp2/mmu/sh_mmu_mrfld.c index 97546bd124cd..c59bcc982966 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/mmu/sh_mmu_mrfld.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/mmu/sh_mmu_mrfld.c @@ -14,10 +14,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. * */ #include "type_support.h" diff --git a/drivers/staging/media/atomisp/platform/Makefile b/drivers/staging/media/atomisp/platform/Makefile index df157630bda9..0e3b7e1c81c6 100644 --- a/drivers/staging/media/atomisp/platform/Makefile +++ b/drivers/staging/media/atomisp/platform/Makefile @@ -2,5 +2,4 @@ # Makefile for camera drivers. # -obj-$(CONFIG_INTEL_ATOMISP) += clock/ obj-$(CONFIG_INTEL_ATOMISP) += intel-mid/ diff --git a/drivers/staging/media/atomisp/platform/clock/Makefile b/drivers/staging/media/atomisp/platform/clock/Makefile deleted file mode 100644 index 82fbe8b6968a..000000000000 --- a/drivers/staging/media/atomisp/platform/clock/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -# -# Makefile for clock devices. -# - -obj-$(CONFIG_INTEL_ATOMISP) += vlv2_plat_clock.o -obj-$(CONFIG_INTEL_ATOMISP) += platform_vlv2_plat_clk.o diff --git a/drivers/staging/media/atomisp/platform/clock/platform_vlv2_plat_clk.c b/drivers/staging/media/atomisp/platform/clock/platform_vlv2_plat_clk.c deleted file mode 100644 index 0aae9b0283bb..000000000000 --- a/drivers/staging/media/atomisp/platform/clock/platform_vlv2_plat_clk.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * platform_vlv2_plat_clk.c - VLV2 platform clock driver - * Copyright (C) 2013 Intel Corporation - * - * Author: Asutosh Pathak <asutosh.pathak@intel.com> - * Author: Chandra Sekhar Anagani <chandra.sekhar.anagani@intel.com> - * Author: Sergio Aguirre <sergio.a.aguirre.rodriguez@intel.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - */ - -#include <linux/device.h> -#include <linux/err.h> -#include <linux/module.h> -#include <linux/platform_device.h> -#include <linux/printk.h> - -static int __init vlv2_plat_clk_init(void) -{ - struct platform_device *pdev; - - pdev = platform_device_register_simple("vlv2_plat_clk", -1, NULL, 0); - if (IS_ERR(pdev)) { - pr_err("platform_vlv2_plat_clk:register failed: %ld\n", - PTR_ERR(pdev)); - return PTR_ERR(pdev); - } - - return 0; -} - -device_initcall(vlv2_plat_clk_init); diff --git a/drivers/staging/media/atomisp/platform/clock/platform_vlv2_plat_clk.h b/drivers/staging/media/atomisp/platform/clock/platform_vlv2_plat_clk.h deleted file mode 100644 index b730ab0e8223..000000000000 --- a/drivers/staging/media/atomisp/platform/clock/platform_vlv2_plat_clk.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * platform_vlv2_plat_clk.h: platform clock driver library header file - * Copyright (C) 2013 Intel Corporation - * - * Author: Asutosh Pathak <asutosh.pathak@intel.com> - * Author: Chandra Sekhar Anagani <chandra.sekhar.anagani@intel.com> - * Author: Sergio Aguirre <sergio.a.aguirre.rodriguez@intel.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - */ -#ifndef _PLATFORM_VLV2_PLAT_CLK_H_ -#define _PLATFORM_VLV2_PLAT_CLK_H_ - -#include <linux/sfi.h> -#include <asm/intel-mid.h> - -extern void __init *vlv2_plat_clk_device_platform_data( - void *info) __attribute__((weak)); -#endif diff --git a/drivers/staging/media/atomisp/platform/clock/vlv2_plat_clock.c b/drivers/staging/media/atomisp/platform/clock/vlv2_plat_clock.c deleted file mode 100644 index f96789a31819..000000000000 --- a/drivers/staging/media/atomisp/platform/clock/vlv2_plat_clock.c +++ /dev/null @@ -1,247 +0,0 @@ -/* - * vlv2_plat_clock.c - VLV2 platform clock driver - * Copyright (C) 2013 Intel Corporation - * - * Author: Asutosh Pathak <asutosh.pathak@intel.com> - * Author: Chandra Sekhar Anagani <chandra.sekhar.anagani@intel.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -#include <linux/err.h> -#include <linux/io.h> -#include <linux/init.h> -#include <linux/platform_device.h> -#include "../../include/linux/vlv2_plat_clock.h" - -/* NOTE: Most of below constants could come from platform data. - * To be fixed when appropriate ACPI support comes. - */ -#define VLV2_PMC_CLK_BASE_ADDRESS 0xfed03060 -#define PLT_CLK_CTL_OFFSET(x) (0x04 * (x)) - -#define CLK_CONFG_BIT_POS 0 -#define CLK_CONFG_BIT_LEN 2 -#define CLK_CONFG_D3_GATED 0 -#define CLK_CONFG_FORCE_ON 1 -#define CLK_CONFG_FORCE_OFF 2 - -#define CLK_FREQ_TYPE_BIT_POS 2 -#define CLK_FREQ_TYPE_BIT_LEN 1 -#define CLK_FREQ_TYPE_XTAL 0 /* 25 MHz */ -#define CLK_FREQ_TYPE_PLL 1 /* 19.2 MHz */ - -#define MAX_CLK_COUNT 5 - -/* Helper macros to manipulate bitfields */ -#define REG_MASK(n) (((1 << (n##_BIT_LEN)) - 1) << (n##_BIT_POS)) -#define REG_SET_FIELD(r, n, v) (((r) & ~REG_MASK(n)) | \ - (((v) << (n##_BIT_POS)) & REG_MASK(n))) -#define REG_GET_FIELD(r, n) (((r) & REG_MASK(n)) >> n##_BIT_POS) -/* - * vlv2 platform has 6 platform clocks, controlled by 4 byte registers - * Total size required for mapping is 6*4 = 24 bytes - */ -#define PMC_MAP_SIZE 24 - -static DEFINE_MUTEX(clk_mutex); -static void __iomem *pmc_base; - -/* - * vlv2_plat_set_clock_freq - Set clock frequency to a specified platform clock - * @clk_num: Platform clock number (i.e. 0, 1, 2, ...,5) - * @freq_type: Clock frequency (0-25 MHz(XTAL), 1-19.2 MHz(PLL) ) - */ -int vlv2_plat_set_clock_freq(int clk_num, int freq_type) -{ - void __iomem *addr; - - if (clk_num < 0 || clk_num >= MAX_CLK_COUNT) { - pr_err("Clock number out of range (%d)\n", clk_num); - return -EINVAL; - } - - if (freq_type != CLK_FREQ_TYPE_XTAL && - freq_type != CLK_FREQ_TYPE_PLL) { - pr_err("wrong clock type\n"); - return -EINVAL; - } - - if (!pmc_base) { - pr_err("memio map is not set\n"); - return -EINVAL; - } - - addr = pmc_base + PLT_CLK_CTL_OFFSET(clk_num); - - mutex_lock(&clk_mutex); - writel(REG_SET_FIELD(readl(addr), CLK_FREQ_TYPE, freq_type), addr); - mutex_unlock(&clk_mutex); - - return 0; -} -EXPORT_SYMBOL_GPL(vlv2_plat_set_clock_freq); - -/* - * vlv2_plat_get_clock_freq - Get the status of specified platform clock - * @clk_num: Platform clock number (i.e. 0, 1, 2, ...,5) - * - * Returns 0 for 25 MHz(XTAL) and 1 for 19.2 MHz(PLL) - */ -int vlv2_plat_get_clock_freq(int clk_num) -{ - u32 ret; - - if (clk_num < 0 || clk_num >= MAX_CLK_COUNT) { - pr_err("Clock number out of range (%d)\n", clk_num); - return -EINVAL; - } - - if (!pmc_base) { - pr_err("memio map is not set\n"); - return -EINVAL; - } - - mutex_lock(&clk_mutex); - ret = REG_GET_FIELD(readl(pmc_base + PLT_CLK_CTL_OFFSET(clk_num)), - CLK_FREQ_TYPE); - mutex_unlock(&clk_mutex); - return ret; -} -EXPORT_SYMBOL_GPL(vlv2_plat_get_clock_freq); - -/* - * vlv2_plat_configure_clock - Configure the specified platform clock - * @clk_num: Platform clock number (i.e. 0, 1, 2, ...,5) - * @conf: Clock gating: - * 0 - Clock gated on D3 state - * 1 - Force on - * 2,3 - Force off - */ -int vlv2_plat_configure_clock(int clk_num, u32 conf) -{ - void __iomem *addr; - - if (clk_num < 0 || clk_num >= MAX_CLK_COUNT) { - pr_err("Clock number out of range (%d)\n", clk_num); - return -EINVAL; - } - - if (conf != CLK_CONFG_D3_GATED && - conf != CLK_CONFG_FORCE_ON && - conf != CLK_CONFG_FORCE_OFF) { - pr_err("Invalid clock configuration requested\n"); - return -EINVAL; - } - - if (!pmc_base) { - pr_err("memio map is not set\n"); - return -EINVAL; - } - - addr = pmc_base + PLT_CLK_CTL_OFFSET(clk_num); - - mutex_lock(&clk_mutex); - writel(REG_SET_FIELD(readl(addr), CLK_CONFG, conf), addr); - mutex_unlock(&clk_mutex); - return 0; -} -EXPORT_SYMBOL_GPL(vlv2_plat_configure_clock); - -/* - * vlv2_plat_get_clock_status - Get the status of specified platform clock - * @clk_num: Platform clock number (i.e. 0, 1, 2, ...,5) - * - * Returns 1 - On, 0 - Off - */ -int vlv2_plat_get_clock_status(int clk_num) -{ - int ret; - - if (clk_num < 0 || clk_num >= MAX_CLK_COUNT) { - pr_err("Clock number out of range (%d)\n", clk_num); - return -EINVAL; - } - - if (!pmc_base) { - pr_err("memio map is not set\n"); - return -EINVAL; - } - - mutex_lock(&clk_mutex); - ret = (int)REG_GET_FIELD(readl(pmc_base + PLT_CLK_CTL_OFFSET(clk_num)), - CLK_CONFG); - mutex_unlock(&clk_mutex); - return ret; -} -EXPORT_SYMBOL_GPL(vlv2_plat_get_clock_status); - -static int vlv2_plat_clk_probe(struct platform_device *pdev) -{ - int i = 0; - - pmc_base = ioremap_nocache(VLV2_PMC_CLK_BASE_ADDRESS, PMC_MAP_SIZE); - if (!pmc_base) { - dev_err(&pdev->dev, "I/O memory remapping failed\n"); - return -ENOMEM; - } - - /* Initialize all clocks as disabled */ - for (i = 0; i < MAX_CLK_COUNT; i++) - vlv2_plat_configure_clock(i, CLK_CONFG_FORCE_OFF); - - dev_info(&pdev->dev, "vlv2_plat_clk initialized\n"); - return 0; -} - -static const struct platform_device_id vlv2_plat_clk_id[] = { - {"vlv2_plat_clk", 0}, - {} -}; - -static int vlv2_resume(struct device *device) -{ - int i; - - /* Initialize all clocks as disabled */ - for (i = 0; i < MAX_CLK_COUNT; i++) - vlv2_plat_configure_clock(i, CLK_CONFG_FORCE_OFF); - - return 0; -} - -static int vlv2_suspend(struct device *device) -{ - return 0; -} - -static const struct dev_pm_ops vlv2_pm_ops = { - .suspend = vlv2_suspend, - .resume = vlv2_resume, -}; - -static struct platform_driver vlv2_plat_clk_driver = { - .probe = vlv2_plat_clk_probe, - .id_table = vlv2_plat_clk_id, - .driver = { - .name = "vlv2_plat_clk", - .pm = &vlv2_pm_ops, - }, -}; - -static int __init vlv2_plat_clk_init(void) -{ - return platform_driver_register(&vlv2_plat_clk_driver); -} -arch_initcall(vlv2_plat_clk_init); diff --git a/drivers/staging/media/atomisp/platform/intel-mid/Makefile b/drivers/staging/media/atomisp/platform/intel-mid/Makefile index 4621261c35db..c53db1364e21 100644 --- a/drivers/staging/media/atomisp/platform/intel-mid/Makefile +++ b/drivers/staging/media/atomisp/platform/intel-mid/Makefile @@ -1,5 +1,4 @@ # # Makefile for intel-mid devices. # -obj-$(CONFIG_INTEL_ATOMISP) += intel_mid_pcihelpers.o obj-$(CONFIG_INTEL_ATOMISP) += atomisp_gmin_platform.o diff --git a/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c b/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c index edaae93af8f9..bf9f34b7ad72 100644 --- a/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c +++ b/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c @@ -4,10 +4,10 @@ #include <linux/efi.h> #include <linux/pci.h> #include <linux/acpi.h> +#include <linux/clk.h> #include <linux/delay.h> #include <media/v4l2-subdev.h> #include <linux/mfd/intel_soc_pmic.h> -#include "../../include/linux/vlv2_plat_clock.h" #include <linux/regulator/consumer.h> #include <linux/gpio/consumer.h> #include <linux/gpio.h> @@ -17,11 +17,7 @@ #define MAX_SUBDEVS 8 -/* Should be defined in vlv2_plat_clock API, isn't: */ -#define VLV2_CLK_PLL_19P2MHZ 1 -#define VLV2_CLK_XTAL_19P2MHZ 0 -#define VLV2_CLK_ON 1 -#define VLV2_CLK_OFF 2 +#define VLV2_CLK_PLL_19P2MHZ 1 /* XTAL on CHT */ #define ELDO1_SEL_REG 0x19 #define ELDO1_1P8V 0x16 #define ELDO1_CTRL_SHIFT 0x00 @@ -33,6 +29,8 @@ struct gmin_subdev { struct v4l2_subdev *subdev; int clock_num; int clock_src; + bool clock_on; + struct clk *pmc_clk; struct gpio_desc *gpio0; struct gpio_desc *gpio1; struct regulator *v1p8_reg; @@ -108,49 +106,6 @@ const struct atomisp_platform_data *atomisp_get_platform_data(void) } EXPORT_SYMBOL_GPL(atomisp_get_platform_data); -static int af_power_ctrl(struct v4l2_subdev *subdev, int flag) -{ - struct gmin_subdev *gs = find_gmin_subdev(subdev); - - if (gs && gs->v2p8_vcm_on == flag) - return 0; - gs->v2p8_vcm_on = flag; - - /* - * The power here is used for dw9817, - * regulator is from rear sensor - */ - if (gs->v2p8_vcm_reg) { - if (flag) - return regulator_enable(gs->v2p8_vcm_reg); - else - return regulator_disable(gs->v2p8_vcm_reg); - } - return 0; -} - -/* - * Used in a handful of modules. Focus motor control, I think. Note - * that there is no configurability in the API, so this needs to be - * fixed where it is used. - * - * struct camera_af_platform_data { - * int (*power_ctrl)(struct v4l2_subdev *subdev, int flag); - * }; - * - * Note that the implementation in MCG platform_camera.c is stubbed - * out anyway (i.e. returns zero from the callback) on BYT. So - * neither needed on gmin platforms or supported upstream. - */ -const struct camera_af_platform_data *camera_get_af_platform_data(void) -{ - static struct camera_af_platform_data afpd = { - .power_ctrl = af_power_ctrl, - }; - return &afpd; -} -EXPORT_SYMBOL_GPL(camera_get_af_platform_data); - int atomisp_register_i2c_module(struct v4l2_subdev *subdev, struct camera_sensor_platform_data *plat_data, enum intel_v4l2_subdev_type type) @@ -334,15 +289,8 @@ static const struct { #define CFG_VAR_NAME_MAX 64 -static int gmin_platform_init(struct i2c_client *client) -{ - return 0; -} - -static int gmin_platform_deinit(void) -{ - return 0; -} +#define GMIN_PMC_CLK_NAME 14 /* "pmc_plt_clk_[0..5]" */ +static char gmin_pmc_clk_name[GMIN_PMC_CLK_NAME]; static struct gmin_subdev *gmin_subdev_add(struct v4l2_subdev *subdev) { @@ -377,21 +325,42 @@ static struct gmin_subdev *gmin_subdev_add(struct v4l2_subdev *subdev) gmin_subdevs[i].gpio0 = gpiod_get_index(dev, NULL, 0, GPIOD_OUT_LOW); gmin_subdevs[i].gpio1 = gpiod_get_index(dev, NULL, 1, GPIOD_OUT_LOW); - if (!IS_ERR(gmin_subdevs[i].gpio0)) { - ret = gpiod_direction_output(gmin_subdevs[i].gpio0, 0); - if (ret) - dev_err(dev, "gpio0 set output failed: %d\n", ret); - } else { - gmin_subdevs[i].gpio0 = NULL; + /* get PMC clock with clock framework */ + snprintf(gmin_pmc_clk_name, + sizeof(gmin_pmc_clk_name), + "%s_%d", "pmc_plt_clk", gmin_subdevs[i].clock_num); + + gmin_subdevs[i].pmc_clk = devm_clk_get(dev, gmin_pmc_clk_name); + if (IS_ERR(gmin_subdevs[i].pmc_clk)) { + ret = PTR_ERR(gmin_subdevs[i].pmc_clk); + + dev_err(dev, + "Failed to get clk from %s : %d\n", + gmin_pmc_clk_name, + ret); + + return NULL; } - if (!IS_ERR(gmin_subdevs[i].gpio1)) { - ret = gpiod_direction_output(gmin_subdevs[i].gpio1, 0); - if (ret) - dev_err(dev, "gpio1 set output failed: %d\n", ret); - } else { + /* + * The firmware might enable the clock at + * boot (this information may or may not + * be reflected in the enable clock register). + * To change the rate we must disable the clock + * first to cover these cases. Due to common + * clock framework restrictions that do not allow + * to disable a clock that has not been enabled, + * we need to enable the clock first. + */ + ret = clk_prepare_enable(gmin_subdevs[i].pmc_clk); + if (!ret) + clk_disable_unprepare(gmin_subdevs[i].pmc_clk); + + if (IS_ERR(gmin_subdevs[i].gpio0)) + gmin_subdevs[i].gpio0 = NULL; + + if (IS_ERR(gmin_subdevs[i].gpio1)) gmin_subdevs[i].gpio1 = NULL; - } if (pmic_id == PMIC_REGULATOR) { gmin_subdevs[i].v1p8_reg = regulator_get(dev, "V1P8SX"); @@ -539,13 +508,27 @@ static int gmin_flisclk_ctrl(struct v4l2_subdev *subdev, int on) { int ret = 0; struct gmin_subdev *gs = find_gmin_subdev(subdev); + struct i2c_client *client = v4l2_get_subdevdata(subdev); + + if (gs->clock_on == !!on) + return 0; + + if (on) { + ret = clk_set_rate(gs->pmc_clk, gs->clock_src); + + if (ret) + dev_err(&client->dev, "unable to set PMC rate %d\n", + gs->clock_src); + + ret = clk_prepare_enable(gs->pmc_clk); + if (ret == 0) + gs->clock_on = true; + } else { + clk_disable_unprepare(gs->pmc_clk); + gs->clock_on = false; + } - if (on) - ret = vlv2_plat_set_clock_freq(gs->clock_num, gs->clock_src); - if (ret) - return ret; - return vlv2_plat_configure_clock(gs->clock_num, - on ? VLV2_CLK_ON : VLV2_CLK_OFF); + return ret; } static int gmin_csi_cfg(struct v4l2_subdev *sd, int flag) @@ -592,8 +575,6 @@ static struct camera_sensor_platform_data gmin_plat = { .v2p8_ctrl = gmin_v2p8_ctrl, .v1p2_ctrl = gmin_v1p2_ctrl, .flisclk_ctrl = gmin_flisclk_ctrl, - .platform_init = gmin_platform_init, - .platform_deinit = gmin_platform_deinit, .csi_cfg = gmin_csi_cfg, .get_vcm_ctrl = gmin_get_vcm_ctrl, }; @@ -739,10 +720,8 @@ int camera_sensor_csi(struct v4l2_subdev *sd, u32 port, if (flag) { csi = kzalloc(sizeof(*csi), GFP_KERNEL); - if (!csi) { - dev_err(&client->dev, "out of memory\n"); + if (!csi) return -ENOMEM; - } csi->port = port; csi->num_lanes = lanes; csi->input_format = format; diff --git a/drivers/staging/media/atomisp/platform/intel-mid/intel_mid_pcihelpers.c b/drivers/staging/media/atomisp/platform/intel-mid/intel_mid_pcihelpers.c deleted file mode 100644 index 4631b1d39bb4..000000000000 --- a/drivers/staging/media/atomisp/platform/intel-mid/intel_mid_pcihelpers.c +++ /dev/null @@ -1,298 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include <linux/export.h> -#include <linux/pci.h> -#include <linux/pm_qos.h> -#include <linux/delay.h> - -/* G-Min addition: "platform_is()" lives in intel_mid_pm.h in the MCG - * tree, but it's just platform ID info and we don't want to pull in - * the whole SFI-based PM architecture. - */ -#define INTEL_ATOM_MRST 0x26 -#define INTEL_ATOM_MFLD 0x27 -#define INTEL_ATOM_CLV 0x35 -#define INTEL_ATOM_MRFLD 0x4a -#define INTEL_ATOM_BYT 0x37 -#define INTEL_ATOM_MOORFLD 0x5a -#define INTEL_ATOM_CHT 0x4c -/* synchronization for sharing the I2C controller */ -#define PUNIT_PORT 0x04 -#define PUNIT_DOORBELL_OPCODE (0xE0) -#define PUNIT_DOORBELL_REG (0x0) -#ifndef CSTATE_EXIT_LATENCY -#define CSTATE_EXIT_LATENCY_C1 1 -#endif -static inline int platform_is(u8 model) -{ - return (boot_cpu_data.x86_model == model); -} - -#include "../../include/asm/intel_mid_pcihelpers.h" - -/* Unified message bus read/write operation */ -static DEFINE_SPINLOCK(msgbus_lock); - -static struct pci_dev *pci_root; -static struct pm_qos_request pm_qos; - -#define DW_I2C_NEED_QOS (platform_is(INTEL_ATOM_BYT)) - -static int intel_mid_msgbus_init(void) -{ - pci_root = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0)); - if (!pci_root) { - pr_err("%s: Error: msgbus PCI handle NULL\n", __func__); - return -ENODEV; - } - - if (DW_I2C_NEED_QOS) { - pm_qos_add_request(&pm_qos, - PM_QOS_CPU_DMA_LATENCY, - PM_QOS_DEFAULT_VALUE); - } - return 0; -} -fs_initcall(intel_mid_msgbus_init); - -u32 intel_mid_msgbus_read32_raw(u32 cmd) -{ - unsigned long irq_flags; - u32 data; - - spin_lock_irqsave(&msgbus_lock, irq_flags); - pci_write_config_dword(pci_root, PCI_ROOT_MSGBUS_CTRL_REG, cmd); - pci_read_config_dword(pci_root, PCI_ROOT_MSGBUS_DATA_REG, &data); - spin_unlock_irqrestore(&msgbus_lock, irq_flags); - - return data; -} -EXPORT_SYMBOL(intel_mid_msgbus_read32_raw); - -/* - * GU: this function is only used by the VISA and 'VXD' drivers. - */ -u32 intel_mid_msgbus_read32_raw_ext(u32 cmd, u32 cmd_ext) -{ - unsigned long irq_flags; - u32 data; - - spin_lock_irqsave(&msgbus_lock, irq_flags); - pci_write_config_dword(pci_root, PCI_ROOT_MSGBUS_CTRL_EXT_REG, cmd_ext); - pci_write_config_dword(pci_root, PCI_ROOT_MSGBUS_CTRL_REG, cmd); - pci_read_config_dword(pci_root, PCI_ROOT_MSGBUS_DATA_REG, &data); - spin_unlock_irqrestore(&msgbus_lock, irq_flags); - - return data; -} -EXPORT_SYMBOL(intel_mid_msgbus_read32_raw_ext); - -void intel_mid_msgbus_write32_raw(u32 cmd, u32 data) -{ - unsigned long irq_flags; - - spin_lock_irqsave(&msgbus_lock, irq_flags); - pci_write_config_dword(pci_root, PCI_ROOT_MSGBUS_DATA_REG, data); - pci_write_config_dword(pci_root, PCI_ROOT_MSGBUS_CTRL_REG, cmd); - spin_unlock_irqrestore(&msgbus_lock, irq_flags); -} -EXPORT_SYMBOL(intel_mid_msgbus_write32_raw); - -/* - * GU: this function is only used by the VISA and 'VXD' drivers. - */ -void intel_mid_msgbus_write32_raw_ext(u32 cmd, u32 cmd_ext, u32 data) -{ - unsigned long irq_flags; - - spin_lock_irqsave(&msgbus_lock, irq_flags); - pci_write_config_dword(pci_root, PCI_ROOT_MSGBUS_DATA_REG, data); - pci_write_config_dword(pci_root, PCI_ROOT_MSGBUS_CTRL_EXT_REG, cmd_ext); - pci_write_config_dword(pci_root, PCI_ROOT_MSGBUS_CTRL_REG, cmd); - spin_unlock_irqrestore(&msgbus_lock, irq_flags); -} -EXPORT_SYMBOL(intel_mid_msgbus_write32_raw_ext); - -u32 intel_mid_msgbus_read32(u8 port, u32 addr) -{ - unsigned long irq_flags; - u32 data; - u32 cmd; - u32 cmdext; - - cmd = (PCI_ROOT_MSGBUS_READ << 24) | (port << 16) | - ((addr & 0xff) << 8) | PCI_ROOT_MSGBUS_DWORD_ENABLE; - cmdext = addr & 0xffffff00; - - spin_lock_irqsave(&msgbus_lock, irq_flags); - - if (cmdext) { - /* This resets to 0 automatically, no need to write 0 */ - pci_write_config_dword(pci_root, PCI_ROOT_MSGBUS_CTRL_EXT_REG, - cmdext); - } - - pci_write_config_dword(pci_root, PCI_ROOT_MSGBUS_CTRL_REG, cmd); - pci_read_config_dword(pci_root, PCI_ROOT_MSGBUS_DATA_REG, &data); - spin_unlock_irqrestore(&msgbus_lock, irq_flags); - - return data; -} -EXPORT_SYMBOL(intel_mid_msgbus_read32); - -void intel_mid_msgbus_write32(u8 port, u32 addr, u32 data) -{ - unsigned long irq_flags; - u32 cmd; - u32 cmdext; - - cmd = (PCI_ROOT_MSGBUS_WRITE << 24) | (port << 16) | - ((addr & 0xFF) << 8) | PCI_ROOT_MSGBUS_DWORD_ENABLE; - cmdext = addr & 0xffffff00; - - spin_lock_irqsave(&msgbus_lock, irq_flags); - pci_write_config_dword(pci_root, PCI_ROOT_MSGBUS_DATA_REG, data); - - if (cmdext) { - /* This resets to 0 automatically, no need to write 0 */ - pci_write_config_dword(pci_root, PCI_ROOT_MSGBUS_CTRL_EXT_REG, - cmdext); - } - - pci_write_config_dword(pci_root, PCI_ROOT_MSGBUS_CTRL_REG, cmd); - spin_unlock_irqrestore(&msgbus_lock, irq_flags); -} -EXPORT_SYMBOL(intel_mid_msgbus_write32); - -/* called only from where is later then fs_initcall */ -u32 intel_mid_soc_stepping(void) -{ - return pci_root->revision; -} -EXPORT_SYMBOL(intel_mid_soc_stepping); - -static bool is_south_complex_device(struct pci_dev *dev) -{ - unsigned int base_class = dev->class >> 16; - unsigned int sub_class = (dev->class & SUB_CLASS_MASK) >> 8; - - /* other than camera, pci bridges and display, - * everything else are south complex devices. - */ - if (((base_class == PCI_BASE_CLASS_MULTIMEDIA) && - (sub_class == ISP_SUB_CLASS)) || - (base_class == PCI_BASE_CLASS_BRIDGE) || - ((base_class == PCI_BASE_CLASS_DISPLAY) && !sub_class)) - return false; - else - return true; -} - -/* In BYT platform, d3_delay for internal south complex devices, - * they are not subject to 10 ms d3 to d0 delay required by pci spec. - */ -static void pci_d3_delay_fixup(struct pci_dev *dev) -{ - if (platform_is(INTEL_ATOM_BYT) || - platform_is(INTEL_ATOM_CHT)) { - /* All internal devices are in bus 0. */ - if (dev->bus->number == 0 && is_south_complex_device(dev)) { - dev->d3_delay = INTERNAL_PCI_PM_D3_WAIT; - dev->d3cold_delay = INTERNAL_PCI_PM_D3_WAIT; - } - } -} -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, pci_d3_delay_fixup); - -#define PUNIT_SEMAPHORE (platform_is(INTEL_ATOM_BYT) ? 0x7 : 0x10E) -#define GET_SEM() (intel_mid_msgbus_read32(PUNIT_PORT, PUNIT_SEMAPHORE) & 0x1) - -static void reset_semaphore(void) -{ - u32 data; - - data = intel_mid_msgbus_read32(PUNIT_PORT, PUNIT_SEMAPHORE); - smp_mb(); - data = data & 0xfffffffc; - intel_mid_msgbus_write32(PUNIT_PORT, PUNIT_SEMAPHORE, data); - smp_mb(); - -} - -int intel_mid_dw_i2c_acquire_ownership(void) -{ - u32 ret = 0; - u32 data = 0; /* data sent to PUNIT */ - u32 cmd; - u32 cmdext; - int timeout = 1000; - - if (DW_I2C_NEED_QOS) - pm_qos_update_request(&pm_qos, CSTATE_EXIT_LATENCY_C1 - 1); - - /* - * We need disable irq. Otherwise, the main thread - * might be preempted and the other thread jumps to - * disable irq for a long time. Another case is - * some irq handlers might trigger power voltage change - */ - BUG_ON(irqs_disabled()); - local_irq_disable(); - - /* host driver writes 0x2 to side band register 0x7 */ - intel_mid_msgbus_write32(PUNIT_PORT, PUNIT_SEMAPHORE, 0x2); - smp_mb(); - - /* host driver sends 0xE0 opcode to PUNIT and writes 0 register */ - cmd = (PUNIT_DOORBELL_OPCODE << 24) | (PUNIT_PORT << 16) | - ((PUNIT_DOORBELL_REG & 0xFF) << 8) | PCI_ROOT_MSGBUS_DWORD_ENABLE; - cmdext = PUNIT_DOORBELL_REG & 0xffffff00; - - if (cmdext) - intel_mid_msgbus_write32_raw_ext(cmd, cmdext, data); - else - intel_mid_msgbus_write32_raw(cmd, data); - - /* host driver waits for bit 0 to be set in side band 0x7 */ - while (GET_SEM() != 0x1) { - udelay(100); - timeout--; - if (timeout <= 0) { - pr_err("Timeout: semaphore timed out, reset sem\n"); - ret = -ETIMEDOUT; - reset_semaphore(); - /*Delay 1ms in case race with punit*/ - udelay(1000); - if (GET_SEM() != 0) { - /*Reset again as kernel might race with punit*/ - reset_semaphore(); - } - pr_err("PUNIT SEM: %d\n", - intel_mid_msgbus_read32(PUNIT_PORT, - PUNIT_SEMAPHORE)); - local_irq_enable(); - - if (DW_I2C_NEED_QOS) { - pm_qos_update_request(&pm_qos, - PM_QOS_DEFAULT_VALUE); - } - - return ret; - } - } - smp_mb(); - - return ret; -} -EXPORT_SYMBOL(intel_mid_dw_i2c_acquire_ownership); - -int intel_mid_dw_i2c_release_ownership(void) -{ - reset_semaphore(); - local_irq_enable(); - - if (DW_I2C_NEED_QOS) - pm_qos_update_request(&pm_qos, PM_QOS_DEFAULT_VALUE); - - return 0; -} -EXPORT_SYMBOL(intel_mid_dw_i2c_release_ownership); diff --git a/drivers/staging/media/imx/imx-ic-prp.c b/drivers/staging/media/imx/imx-ic-prp.c index c2bb5ef2acb4..9e41987f9884 100644 --- a/drivers/staging/media/imx/imx-ic-prp.c +++ b/drivers/staging/media/imx/imx-ic-prp.c @@ -320,9 +320,10 @@ static int prp_link_validate(struct v4l2_subdev *sd, * the ->PRPENC link cannot be enabled if the source * is the VDIC */ - if (priv->sink_sd_prpenc) + if (priv->sink_sd_prpenc) { ret = -EINVAL; - goto out; + goto out; + } } else { /* the source is a CSI */ if (!csi) { diff --git a/drivers/staging/media/imx/imx-media-dev.c b/drivers/staging/media/imx/imx-media-dev.c index b55e5ebba8b4..47c4c954fed5 100644 --- a/drivers/staging/media/imx/imx-media-dev.c +++ b/drivers/staging/media/imx/imx-media-dev.c @@ -440,6 +440,11 @@ unlock: return media_device_register(&imxmd->md); } +static const struct v4l2_async_notifier_operations imx_media_subdev_ops = { + .bound = imx_media_subdev_bound, + .complete = imx_media_probe_complete, +}; + /* * adds controls to a video device from an entity subdevice. * Continues upstream from the entity's sink pads. @@ -608,8 +613,7 @@ static int imx_media_probe(struct platform_device *pdev) /* prepare the async subdev notifier and register it */ imxmd->subdev_notifier.subdevs = imxmd->async_ptrs; - imxmd->subdev_notifier.bound = imx_media_subdev_bound; - imxmd->subdev_notifier.complete = imx_media_probe_complete; + imxmd->subdev_notifier.ops = &imx_media_subdev_ops; ret = v4l2_async_notifier_register(&imxmd->v4l2_dev, &imxmd->subdev_notifier); if (ret) { diff --git a/drivers/staging/media/lirc/lirc_zilog.c b/drivers/staging/media/lirc/lirc_zilog.c index 71af13bd0ebd..6bd0717bf76e 100644 --- a/drivers/staging/media/lirc/lirc_zilog.c +++ b/drivers/staging/media/lirc/lirc_zilog.c @@ -99,13 +99,14 @@ struct IR { struct kref ref; struct list_head list; - /* FIXME spinlock access to l.features */ - struct lirc_driver l; + /* FIXME spinlock access to l->features */ + struct lirc_dev *l; struct lirc_buffer rbuf; struct mutex ir_lock; atomic_t open_count; + struct device *dev; struct i2c_adapter *adapter; spinlock_t rx_ref_lock; /* struct IR_rx kref get()/put() */ @@ -183,10 +184,8 @@ static void release_ir_device(struct kref *ref) * ir->open_count == 0 - happens on final close() * ir_lock, tx_ref_lock, rx_ref_lock, all released */ - if (ir->l.minor >= 0) { - lirc_unregister_driver(ir->l.minor); - ir->l.minor = -1; - } + if (ir->l) + lirc_unregister_device(ir->l); if (kfifo_initialized(&ir->rbuf.fifo)) lirc_buffer_free(&ir->rbuf); @@ -243,7 +242,7 @@ static void release_ir_rx(struct kref *ref) * and releasing the ir reference can cause a sleep. That work is * performed by put_ir_rx() */ - ir->l.features &= ~LIRC_CAN_REC_LIRCCODE; + ir->l->features &= ~LIRC_CAN_REC_LIRCCODE; /* Don't put_ir_device(rx->ir) here; lock can't be freed yet */ ir->rx = NULL; /* Don't do the kfree(rx) here; we still need to kill the poll thread */ @@ -288,7 +287,7 @@ static void release_ir_tx(struct kref *ref) struct IR_tx *tx = container_of(ref, struct IR_tx, ref); struct IR *ir = tx->ir; - ir->l.features &= ~LIRC_CAN_SEND_LIRCCODE; + ir->l->features &= ~LIRC_CAN_SEND_LIRCCODE; /* Don't put_ir_device(tx->ir) here, so our lock doesn't get freed */ ir->tx = NULL; kfree(tx); @@ -317,12 +316,12 @@ static int add_to_buf(struct IR *ir) int ret; int failures = 0; unsigned char sendbuf[1] = { 0 }; - struct lirc_buffer *rbuf = ir->l.rbuf; + struct lirc_buffer *rbuf = ir->l->buf; struct IR_rx *rx; struct IR_tx *tx; if (lirc_buffer_full(rbuf)) { - dev_dbg(ir->l.dev, "buffer overflow\n"); + dev_dbg(ir->dev, "buffer overflow\n"); return -EOVERFLOW; } @@ -368,17 +367,17 @@ static int add_to_buf(struct IR *ir) */ ret = i2c_master_send(rx->c, sendbuf, 1); if (ret != 1) { - dev_err(ir->l.dev, "i2c_master_send failed with %d\n", + dev_err(ir->dev, "i2c_master_send failed with %d\n", ret); if (failures >= 3) { mutex_unlock(&ir->ir_lock); - dev_err(ir->l.dev, + dev_err(ir->dev, "unable to read from the IR chip after 3 resets, giving up\n"); break; } /* Looks like the chip crashed, reset it */ - dev_err(ir->l.dev, + dev_err(ir->dev, "polling the IR receiver chip failed, trying reset\n"); set_current_state(TASK_UNINTERRUPTIBLE); @@ -405,14 +404,14 @@ static int add_to_buf(struct IR *ir) ret = i2c_master_recv(rx->c, keybuf, sizeof(keybuf)); mutex_unlock(&ir->ir_lock); if (ret != sizeof(keybuf)) { - dev_err(ir->l.dev, + dev_err(ir->dev, "i2c_master_recv failed with %d -- keeping last read buffer\n", ret); } else { rx->b[0] = keybuf[3]; rx->b[1] = keybuf[4]; rx->b[2] = keybuf[5]; - dev_dbg(ir->l.dev, + dev_dbg(ir->dev, "key (0x%02x/0x%02x)\n", rx->b[0], rx->b[1]); } @@ -463,9 +462,9 @@ static int add_to_buf(struct IR *ir) static int lirc_thread(void *arg) { struct IR *ir = arg; - struct lirc_buffer *rbuf = ir->l.rbuf; + struct lirc_buffer *rbuf = ir->l->buf; - dev_dbg(ir->l.dev, "poll thread started\n"); + dev_dbg(ir->dev, "poll thread started\n"); while (!kthread_should_stop()) { set_current_state(TASK_INTERRUPTIBLE); @@ -493,7 +492,7 @@ static int lirc_thread(void *arg) wake_up_interruptible(&rbuf->wait_poll); } - dev_dbg(ir->l.dev, "poll thread ended\n"); + dev_dbg(ir->dev, "poll thread ended\n"); return 0; } @@ -646,10 +645,10 @@ static int send_data_block(struct IR_tx *tx, unsigned char *data_block) buf[0] = (unsigned char)(i + 1); for (j = 0; j < tosend; ++j) buf[1 + j] = data_block[i + j]; - dev_dbg(tx->ir->l.dev, "%*ph", 5, buf); + dev_dbg(tx->ir->dev, "%*ph", 5, buf); ret = i2c_master_send(tx->c, buf, tosend + 1); if (ret != tosend + 1) { - dev_err(tx->ir->l.dev, + dev_err(tx->ir->dev, "i2c_master_send failed with %d\n", ret); return ret < 0 ? ret : -EFAULT; } @@ -674,7 +673,7 @@ static int send_boot_data(struct IR_tx *tx) buf[1] = 0x20; ret = i2c_master_send(tx->c, buf, 2); if (ret != 2) { - dev_err(tx->ir->l.dev, "i2c_master_send failed with %d\n", ret); + dev_err(tx->ir->dev, "i2c_master_send failed with %d\n", ret); return ret < 0 ? ret : -EFAULT; } @@ -691,22 +690,22 @@ static int send_boot_data(struct IR_tx *tx) } if (ret != 1) { - dev_err(tx->ir->l.dev, "i2c_master_send failed with %d\n", ret); + dev_err(tx->ir->dev, "i2c_master_send failed with %d\n", ret); return ret < 0 ? ret : -EFAULT; } /* Here comes the firmware version... (hopefully) */ ret = i2c_master_recv(tx->c, buf, 4); if (ret != 4) { - dev_err(tx->ir->l.dev, "i2c_master_recv failed with %d\n", ret); + dev_err(tx->ir->dev, "i2c_master_recv failed with %d\n", ret); return 0; } if ((buf[0] != 0x80) && (buf[0] != 0xa0)) { - dev_err(tx->ir->l.dev, "unexpected IR TX init response: %02x\n", + dev_err(tx->ir->dev, "unexpected IR TX init response: %02x\n", buf[0]); return 0; } - dev_notice(tx->ir->l.dev, + dev_notice(tx->ir->dev, "Zilog/Hauppauge IR blaster firmware version %d.%d.%d loaded\n", buf[1], buf[2], buf[3]); @@ -751,15 +750,15 @@ static int fw_load(struct IR_tx *tx) } /* Request codeset data file */ - ret = request_firmware(&fw_entry, "haup-ir-blaster.bin", tx->ir->l.dev); + ret = request_firmware(&fw_entry, "haup-ir-blaster.bin", tx->ir->dev); if (ret != 0) { - dev_err(tx->ir->l.dev, + dev_err(tx->ir->dev, "firmware haup-ir-blaster.bin not available (%d)\n", ret); ret = ret < 0 ? ret : -EFAULT; goto out; } - dev_dbg(tx->ir->l.dev, "firmware of size %zu loaded\n", fw_entry->size); + dev_dbg(tx->ir->dev, "firmware of size %zu loaded\n", fw_entry->size); /* Parse the file */ tx_data = vmalloc(sizeof(*tx_data)); @@ -787,7 +786,7 @@ static int fw_load(struct IR_tx *tx) if (!read_uint8(&data, tx_data->endp, &version)) goto corrupt; if (version != 1) { - dev_err(tx->ir->l.dev, + dev_err(tx->ir->dev, "unsupported code set file version (%u, expected 1) -- please upgrade to a newer driver\n", version); fw_unload_locked(); @@ -804,7 +803,7 @@ static int fw_load(struct IR_tx *tx) &tx_data->num_code_sets)) goto corrupt; - dev_dbg(tx->ir->l.dev, "%u IR blaster codesets loaded\n", + dev_dbg(tx->ir->dev, "%u IR blaster codesets loaded\n", tx_data->num_code_sets); tx_data->code_sets = vmalloc( @@ -869,7 +868,7 @@ static int fw_load(struct IR_tx *tx) goto out; corrupt: - dev_err(tx->ir->l.dev, "firmware is corrupt\n"); + dev_err(tx->ir->dev, "firmware is corrupt\n"); fw_unload_locked(); ret = -EFAULT; @@ -882,16 +881,16 @@ out: static ssize_t read(struct file *filep, char __user *outbuf, size_t n, loff_t *ppos) { - struct IR *ir = filep->private_data; + struct IR *ir = lirc_get_pdata(filep); struct IR_rx *rx; - struct lirc_buffer *rbuf = ir->l.rbuf; + struct lirc_buffer *rbuf = ir->l->buf; int ret = 0, written = 0, retries = 0; unsigned int m; DECLARE_WAITQUEUE(wait, current); - dev_dbg(ir->l.dev, "read called\n"); + dev_dbg(ir->dev, "read called\n"); if (n % rbuf->chunk_size) { - dev_dbg(ir->l.dev, "read result = -EINVAL\n"); + dev_dbg(ir->dev, "read result = -EINVAL\n"); return -EINVAL; } @@ -935,7 +934,7 @@ static ssize_t read(struct file *filep, char __user *outbuf, size_t n, unsigned char buf[MAX_XFER_SIZE]; if (rbuf->chunk_size > sizeof(buf)) { - dev_err(ir->l.dev, + dev_err(ir->dev, "chunk_size is too big (%d)!\n", rbuf->chunk_size); ret = -EINVAL; @@ -950,7 +949,7 @@ static ssize_t read(struct file *filep, char __user *outbuf, size_t n, retries++; } if (retries >= 5) { - dev_err(ir->l.dev, "Buffer read failed!\n"); + dev_err(ir->dev, "Buffer read failed!\n"); ret = -EIO; } } @@ -960,7 +959,7 @@ static ssize_t read(struct file *filep, char __user *outbuf, size_t n, put_ir_rx(rx, false); set_current_state(TASK_RUNNING); - dev_dbg(ir->l.dev, "read result = %d (%s)\n", ret, + dev_dbg(ir->dev, "read result = %d (%s)\n", ret, ret ? "Error" : "OK"); return ret ? ret : written; @@ -977,7 +976,7 @@ static int send_code(struct IR_tx *tx, unsigned int code, unsigned int key) ret = get_key_data(data_block, code, key); if (ret == -EPROTO) { - dev_err(tx->ir->l.dev, + dev_err(tx->ir->dev, "failed to get data for code %u, key %u -- check lircd.conf entries\n", code, key); return ret; @@ -995,7 +994,7 @@ static int send_code(struct IR_tx *tx, unsigned int code, unsigned int key) buf[1] = 0x40; ret = i2c_master_send(tx->c, buf, 2); if (ret != 2) { - dev_err(tx->ir->l.dev, "i2c_master_send failed with %d\n", ret); + dev_err(tx->ir->dev, "i2c_master_send failed with %d\n", ret); return ret < 0 ? ret : -EFAULT; } @@ -1008,18 +1007,18 @@ static int send_code(struct IR_tx *tx, unsigned int code, unsigned int key) } if (ret != 1) { - dev_err(tx->ir->l.dev, "i2c_master_send failed with %d\n", ret); + dev_err(tx->ir->dev, "i2c_master_send failed with %d\n", ret); return ret < 0 ? ret : -EFAULT; } /* Send finished download? */ ret = i2c_master_recv(tx->c, buf, 1); if (ret != 1) { - dev_err(tx->ir->l.dev, "i2c_master_recv failed with %d\n", ret); + dev_err(tx->ir->dev, "i2c_master_recv failed with %d\n", ret); return ret < 0 ? ret : -EFAULT; } if (buf[0] != 0xA0) { - dev_err(tx->ir->l.dev, "unexpected IR TX response #1: %02x\n", + dev_err(tx->ir->dev, "unexpected IR TX response #1: %02x\n", buf[0]); return -EFAULT; } @@ -1029,7 +1028,7 @@ static int send_code(struct IR_tx *tx, unsigned int code, unsigned int key) buf[1] = 0x80; ret = i2c_master_send(tx->c, buf, 2); if (ret != 2) { - dev_err(tx->ir->l.dev, "i2c_master_send failed with %d\n", ret); + dev_err(tx->ir->dev, "i2c_master_send failed with %d\n", ret); return ret < 0 ? ret : -EFAULT; } @@ -1039,7 +1038,7 @@ static int send_code(struct IR_tx *tx, unsigned int code, unsigned int key) * going to skip this whole mess and say we're done on the HD PVR */ if (!tx->post_tx_ready_poll) { - dev_dbg(tx->ir->l.dev, "sent code %u, key %u\n", code, key); + dev_dbg(tx->ir->dev, "sent code %u, key %u\n", code, key); return 0; } @@ -1055,12 +1054,12 @@ static int send_code(struct IR_tx *tx, unsigned int code, unsigned int key) ret = i2c_master_send(tx->c, buf, 1); if (ret == 1) break; - dev_dbg(tx->ir->l.dev, + dev_dbg(tx->ir->dev, "NAK expected: i2c_master_send failed with %d (try %d)\n", ret, i + 1); } if (ret != 1) { - dev_err(tx->ir->l.dev, + dev_err(tx->ir->dev, "IR TX chip never got ready: last i2c_master_send failed with %d\n", ret); return ret < 0 ? ret : -EFAULT; @@ -1069,17 +1068,17 @@ static int send_code(struct IR_tx *tx, unsigned int code, unsigned int key) /* Seems to be an 'ok' response */ i = i2c_master_recv(tx->c, buf, 1); if (i != 1) { - dev_err(tx->ir->l.dev, "i2c_master_recv failed with %d\n", ret); + dev_err(tx->ir->dev, "i2c_master_recv failed with %d\n", ret); return -EFAULT; } if (buf[0] != 0x80) { - dev_err(tx->ir->l.dev, "unexpected IR TX response #2: %02x\n", + dev_err(tx->ir->dev, "unexpected IR TX response #2: %02x\n", buf[0]); return -EFAULT; } /* Oh good, it worked */ - dev_dbg(tx->ir->l.dev, "sent code %u, key %u\n", code, key); + dev_dbg(tx->ir->dev, "sent code %u, key %u\n", code, key); return 0; } @@ -1092,7 +1091,7 @@ static int send_code(struct IR_tx *tx, unsigned int code, unsigned int key) static ssize_t write(struct file *filep, const char __user *buf, size_t n, loff_t *ppos) { - struct IR *ir = filep->private_data; + struct IR *ir = lirc_get_pdata(filep); struct IR_tx *tx; size_t i; int failures = 0; @@ -1165,11 +1164,11 @@ static ssize_t write(struct file *filep, const char __user *buf, size_t n, */ if (ret != 0) { /* Looks like the chip crashed, reset it */ - dev_err(tx->ir->l.dev, + dev_err(tx->ir->dev, "sending to the IR transmitter chip failed, trying reset\n"); if (failures >= 3) { - dev_err(tx->ir->l.dev, + dev_err(tx->ir->dev, "unable to send to the IR chip after 3 resets, giving up\n"); mutex_unlock(&ir->ir_lock); mutex_unlock(&tx->client_lock); @@ -1200,12 +1199,12 @@ static ssize_t write(struct file *filep, const char __user *buf, size_t n, /* copied from lirc_dev */ static unsigned int poll(struct file *filep, poll_table *wait) { - struct IR *ir = filep->private_data; + struct IR *ir = lirc_get_pdata(filep); struct IR_rx *rx; - struct lirc_buffer *rbuf = ir->l.rbuf; + struct lirc_buffer *rbuf = ir->l->buf; unsigned int ret; - dev_dbg(ir->l.dev, "%s called\n", __func__); + dev_dbg(ir->dev, "%s called\n", __func__); rx = get_ir_rx(ir); if (!rx) { @@ -1213,7 +1212,7 @@ static unsigned int poll(struct file *filep, poll_table *wait) * Revisit this, if our poll function ever reports writeable * status for Tx */ - dev_dbg(ir->l.dev, "%s result = POLLERR\n", __func__); + dev_dbg(ir->dev, "%s result = POLLERR\n", __func__); return POLLERR; } @@ -1226,19 +1225,19 @@ static unsigned int poll(struct file *filep, poll_table *wait) /* Indicate what ops could happen immediately without blocking */ ret = lirc_buffer_empty(rbuf) ? 0 : (POLLIN | POLLRDNORM); - dev_dbg(ir->l.dev, "%s result = %s\n", __func__, + dev_dbg(ir->dev, "%s result = %s\n", __func__, ret ? "POLLIN|POLLRDNORM" : "none"); return ret; } static long ioctl(struct file *filep, unsigned int cmd, unsigned long arg) { - struct IR *ir = filep->private_data; + struct IR *ir = lirc_get_pdata(filep); unsigned long __user *uptr = (unsigned long __user *)arg; int result; unsigned long mode, features; - features = ir->l.features; + features = ir->l->features; switch (cmd) { case LIRC_GET_LENGTH: @@ -1283,46 +1282,18 @@ static long ioctl(struct file *filep, unsigned int cmd, unsigned long arg) return result; } -static struct IR *get_ir_device_by_minor(unsigned int minor) -{ - struct IR *ir; - struct IR *ret = NULL; - - mutex_lock(&ir_devices_lock); - - if (!list_empty(&ir_devices_list)) { - list_for_each_entry(ir, &ir_devices_list, list) { - if (ir->l.minor == minor) { - ret = get_ir_device(ir, true); - break; - } - } - } - - mutex_unlock(&ir_devices_lock); - return ret; -} - /* - * Open the IR device. Get hold of our IR structure and - * stash it in private_data for the file + * Open the IR device. */ static int open(struct inode *node, struct file *filep) { struct IR *ir; - unsigned int minor = MINOR(node->i_rdev); - /* find our IR struct */ - ir = get_ir_device_by_minor(minor); - - if (!ir) - return -ENODEV; + lirc_init_pdata(node, filep); + ir = lirc_get_pdata(filep); atomic_inc(&ir->open_count); - /* stash our IR struct */ - filep->private_data = ir; - nonseekable_open(node, filep); return 0; } @@ -1330,14 +1301,7 @@ static int open(struct inode *node, struct file *filep) /* Close the IR device */ static int close(struct inode *node, struct file *filep) { - /* find our IR struct */ - struct IR *ir = filep->private_data; - - if (!ir) { - pr_err("ir: %s: no private_data attached to the file!\n", - __func__); - return -ENODEV; - } + struct IR *ir = lirc_get_pdata(filep); atomic_dec(&ir->open_count); @@ -1383,16 +1347,6 @@ static const struct file_operations lirc_fops = { .release = close }; -static struct lirc_driver lirc_template = { - .name = "lirc_zilog", - .minor = -1, - .code_length = 13, - .buffer_size = BUFLEN / 2, - .chunk_size = 2, - .fops = &lirc_fops, - .owner = THIS_MODULE, -}; - static int ir_remove(struct i2c_client *client) { if (strncmp("ir_tx_z8", client->name, 8) == 0) { @@ -1476,27 +1430,42 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) list_add_tail(&ir->list, &ir_devices_list); ir->adapter = adap; + ir->dev = &adap->dev; mutex_init(&ir->ir_lock); atomic_set(&ir->open_count, 0); spin_lock_init(&ir->tx_ref_lock); spin_lock_init(&ir->rx_ref_lock); /* set lirc_dev stuff */ - memcpy(&ir->l, &lirc_template, sizeof(struct lirc_driver)); + ir->l = lirc_allocate_device(); + if (!ir->l) { + ret = -ENOMEM; + goto out_put_ir; + } + + snprintf(ir->l->name, sizeof(ir->l->name), "lirc_zilog"); + ir->l->code_length = 13; + ir->l->fops = &lirc_fops; + ir->l->owner = THIS_MODULE; + ir->l->dev.parent = &adap->dev; + /* * FIXME this is a pointer reference to us, but no refcount. * * This OK for now, since lirc_dev currently won't touch this * buffer as we provide our own lirc_fops. * - * Currently our own lirc_fops rely on this ir->l.rbuf pointer + * Currently our own lirc_fops rely on this ir->l->buf pointer */ - ir->l.rbuf = &ir->rbuf; - ir->l.dev = &adap->dev; - ret = lirc_buffer_init(ir->l.rbuf, - ir->l.chunk_size, ir->l.buffer_size); - if (ret) + ir->l->buf = &ir->rbuf; + /* This will be returned by lirc_get_pdata() */ + ir->l->data = ir; + ret = lirc_buffer_init(ir->l->buf, 2, BUFLEN / 2); + if (ret) { + lirc_free_device(ir->l); + ir->l = NULL; goto out_put_ir; + } } if (tx_probe) { @@ -1512,7 +1481,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) kref_init(&tx->ref); ir->tx = tx; - ir->l.features |= LIRC_CAN_SEND_LIRCCODE; + ir->l->features |= LIRC_CAN_SEND_LIRCCODE; mutex_init(&tx->client_lock); tx->c = client; tx->need_boot = 1; @@ -1538,7 +1507,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) /* Proceed only if the Rx client is also ready or not needed */ if (!rx && !tx_only) { - dev_info(tx->ir->l.dev, + dev_info(tx->ir->dev, "probe of IR Tx on %s (i2c-%d) done. Waiting on IR Rx.\n", adap->name, adap->nr); goto out_ok; @@ -1556,7 +1525,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) kref_init(&rx->ref); ir->rx = rx; - ir->l.features |= LIRC_CAN_REC_LIRCCODE; + ir->l->features |= LIRC_CAN_REC_LIRCCODE; mutex_init(&rx->client_lock); rx->c = client; rx->hdpvr_data_fmt = @@ -1578,7 +1547,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) "zilog-rx-i2c-%d", adap->nr); if (IS_ERR(rx->task)) { ret = PTR_ERR(rx->task); - dev_err(tx->ir->l.dev, + dev_err(tx->ir->dev, "%s: could not start IR Rx polling thread\n", __func__); /* Failed kthread, so put back the ir ref */ @@ -1586,7 +1555,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) /* Failure exit, so put back rx ref from i2c_client */ i2c_set_clientdata(client, NULL); put_ir_rx(rx, true); - ir->l.features &= ~LIRC_CAN_REC_LIRCCODE; + ir->l->features &= ~LIRC_CAN_REC_LIRCCODE; goto out_put_tx; } @@ -1599,17 +1568,19 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) } /* register with lirc */ - ir->l.minor = lirc_register_driver(&ir->l); - if (ir->l.minor < 0) { - dev_err(tx->ir->l.dev, - "%s: lirc_register_driver() failed: %i\n", - __func__, ir->l.minor); - ret = -EBADRQC; + ret = lirc_register_device(ir->l); + if (ret < 0) { + dev_err(tx->ir->dev, + "%s: lirc_register_device() failed: %i\n", + __func__, ret); + lirc_free_device(ir->l); + ir->l = NULL; goto out_put_xx; } - dev_info(ir->l.dev, + + dev_info(ir->dev, "IR unit on %s (i2c-%d) registered as lirc%d and ready\n", - adap->name, adap->nr, ir->l.minor); + adap->name, adap->nr, ir->l->minor); out_ok: if (rx) @@ -1617,7 +1588,7 @@ out_ok: if (tx) put_ir_tx(tx, true); put_ir_device(ir, true); - dev_info(ir->l.dev, + dev_info(ir->dev, "probe of IR %s on %s (i2c-%d) done\n", tx_probe ? "Tx" : "Rx", adap->name, adap->nr); mutex_unlock(&ir_devices_lock); |