media: staging: atomisp: Remove IMX sensor support

This sensor is not used by any known ACPI-enabled platform
(and no kernel users for it so far).

Just remove it for good until we get a platform which actually uses it.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This commit is contained in:
Andy Shevchenko 2017-09-27 14:24:56 -04:00 committed by Mauro Carvalho Chehab
parent ef674997e4
commit 3a81c7660f
29 changed files with 0 additions and 14961 deletions

View File

@ -3,7 +3,6 @@
# #
source "drivers/staging/media/atomisp/i2c/ov5693/Kconfig" source "drivers/staging/media/atomisp/i2c/ov5693/Kconfig"
source "drivers/staging/media/atomisp/i2c/imx/Kconfig"
config VIDEO_ATOMISP_OV2722 config VIDEO_ATOMISP_OV2722
tristate "OVT ov2722 sensor support" tristate "OVT ov2722 sensor support"

View File

@ -2,7 +2,6 @@
# Makefile for sensor drivers # Makefile for sensor drivers
# #
obj-$(CONFIG_VIDEO_ATOMISP_IMX) += imx/
obj-$(CONFIG_VIDEO_ATOMISP_OV5693) += ov5693/ obj-$(CONFIG_VIDEO_ATOMISP_OV5693) += ov5693/
obj-$(CONFIG_VIDEO_ATOMISP_MT9M114) += atomisp-mt9m114.o obj-$(CONFIG_VIDEO_ATOMISP_MT9M114) += atomisp-mt9m114.o
obj-$(CONFIG_VIDEO_ATOMISP_GC2235) += atomisp-gc2235.o obj-$(CONFIG_VIDEO_ATOMISP_GC2235) += atomisp-gc2235.o

View File

@ -1,9 +0,0 @@
config VIDEO_ATOMISP_IMX
tristate "sony imx sensor support"
depends on I2C && VIDEO_V4L2 && VIDEO_ATOMISP_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.

View File

@ -1,13 +0,0 @@
obj-$(CONFIG_VIDEO_ATOMISP_IMX) += atomisp-imx1x5.o
atomisp-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
atomisp-ov8858-objs := ../ov8858.o dw9718.o vcm.o
obj-$(CONFIG_VIDEO_ATOMISP_OV8858) += atomisp-ov8858.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)

View File

@ -1,216 +0,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;
}

View File

@ -1,49 +0,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

View File

@ -1,65 +0,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

View File

@ -1,208 +0,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 "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;
}

View File

@ -1,38 +0,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

View File

@ -1,222 +0,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 "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;
}

View File

@ -1,63 +0,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

View File

@ -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(&current_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;
}

View File

@ -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__ */

View File

@ -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(&current_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;
}

View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -1,227 +0,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

View File

@ -1,726 +0,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__ */

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -1,190 +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 "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);
}

View File

@ -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);
}