Commit 3a81c766 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Mauro Carvalho Chehab

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: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent ef674997
......@@ -3,7 +3,6 @@
#
source "drivers/staging/media/atomisp/i2c/ov5693/Kconfig"
source "drivers/staging/media/atomisp/i2c/imx/Kconfig"
config VIDEO_ATOMISP_OV2722
tristate "OVT ov2722 sensor support"
......
......@@ -2,7 +2,6 @@
# Makefile for sensor drivers
#
obj-$(CONFIG_VIDEO_ATOMISP_IMX) += imx/
obj-$(CONFIG_VIDEO_ATOMISP_OV5693) += ov5693/
obj-$(CONFIG_VIDEO_ATOMISP_MT9M114) += atomisp-mt9m114.o
obj-$(CONFIG_VIDEO_ATOMISP_GC2235) += atomisp-gc2235.o
......
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.
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)
#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;
}
#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
#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
#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;
}
#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
#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;
}
#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
/*
* 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;
}
/*
* 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__ */
/*
* 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;
}
/*
* 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
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#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
This diff is collapsed.
/*
* 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;
}
This diff is collapsed.
This diff is collapsed.
/*
* 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);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment