adding drivers for front surface camera

This commit is contained in:
Jake Day 2017-08-16 18:28:20 -04:00
parent 848b0c53fa
commit d5eb1581de
10 changed files with 3646 additions and 35 deletions

View file

@ -565,6 +565,17 @@ config VIDEO_OV5647
To compile this driver as a module, choose M here: the
module will be called ov5647.
config VIDEO_OV5693
tristate "Omnivision OV5693 sensor support"
depends on I2C && VIDEO_V4L2
---help---
This is a Video4Linux2 sensor-level driver for the Micron
ov5693 5 Mpixel camera.
ov5693 is video camera sensor.
It currently only works with the atomisp driver.
config VIDEO_OV7640
tristate "OmniVision OV7640 sensor support"
depends on I2C && VIDEO_V4L2

View file

@ -60,6 +60,7 @@ obj-$(CONFIG_VIDEO_UPD64083) += upd64083.o
obj-$(CONFIG_VIDEO_OV2640) += ov2640.o
obj-$(CONFIG_VIDEO_OV5645) += ov5645.o
obj-$(CONFIG_VIDEO_OV5647) += ov5647.o
obj-$(CONFIG_VIDEO_OV5693) += ov5693.o
obj-$(CONFIG_VIDEO_OV7640) += ov7640.o
obj-$(CONFIG_VIDEO_OV7670) += ov7670.o
obj-$(CONFIG_VIDEO_OV8865) += ov8865.o

View file

@ -22,7 +22,6 @@
#ifndef __AD5823_H__
#define __AD5823_H__
#include <linux/atomisp_platform.h>
#include <linux/types.h>
@ -46,6 +45,7 @@
#define AD5823_HIGH_FREQ_RANGE 0x80
#define VCM_CODE_MSB_MASK 0xfc
#define AD5823_INIT_FOCUS_POS 350
enum ad5823_tok_type {
AD5823_8BIT = 0x1,
@ -60,33 +60,8 @@ enum ad5823_vcm_mode {
AD5823_DIRECT = 0x4, /* Direct control */
};
/* ad5823 device structure */
struct ad5823_device {
struct timespec timestamp_t_focus_abs;
enum ad5823_vcm_mode vcm_mode;
s16 number_of_steps;
bool initialized; /* true if ad5823 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 AD5823_INVALID_CONFIG 0xffffffff
#define AD5823_MAX_FOCUS_POS 1023
#define DELAY_PER_STEP_NS 1000000
#define DELAY_MAX_PER_STEP_NS (1000000 * 1023)
int ad5823_vcm_power_up(struct v4l2_subdev *sd);
int ad5823_vcm_power_down(struct v4l2_subdev *sd);
int ad5823_vcm_init(struct v4l2_subdev *sd);
int ad5823_t_focus_vcm(struct v4l2_subdev *sd, u16 val);
int ad5823_t_focus_abs(struct v4l2_subdev *sd, s32 value);
int ad5823_t_focus_rel(struct v4l2_subdev *sd, s32 value);
int ad5823_q_focus_status(struct v4l2_subdev *sd, s32 *value);
int ad5823_q_focus_abs(struct v4l2_subdev *sd, s32 *value);
#endif

2066
drivers/media/i2c/ov5693.c Normal file

File diff suppressed because it is too large Load diff

1381
drivers/media/i2c/ov5693.h Normal file

File diff suppressed because it is too large Load diff

View file

@ -307,6 +307,7 @@ struct atomisp_3a_statistics {
struct atomisp_3a_output __user *data;
struct atomisp_3a_rgby_output __user *rgby_data;
uint32_t exp_id; /* exposure ID */
uint32_t isp_config_id; /* isp config ID */
};
/**
@ -551,6 +552,14 @@ struct atomisp_parameters {
* frame, driver will send this id back with output frame together.
*/
uint32_t isp_config_id;
/*
* Switch to control per_frame setting:
* 0: this is a global setting
* 1: this is a per_frame setting
* PLEASE KEEP THIS AT THE END OF THE STRUCTURE!!
*/
uint32_t per_frame_setting;
};
#define ATOMISP_GAMMA_TABLE_SIZE 1024
@ -670,7 +679,7 @@ struct atomisp_sensor_mode_data {
unsigned int output_height;
uint8_t binning_factor_x; /* horizontal binning factor used */
uint8_t binning_factor_y; /* vertical binning factor used */
uint8_t reserved[2];
uint16_t hts;
};
struct atomisp_exposure {
@ -886,6 +895,12 @@ struct atomisp_acc_fw_load_to_pipe {
__u32 type; /* Binary type */
__u32 reserved[3]; /* Set to zero */
};
/*
* Set Senor run mode
*/
struct atomisp_s_runmode {
__u32 mode;
};
#define ATOMISP_ACC_FW_LOAD_FL_PREVIEW (1 << 0)
#define ATOMISP_ACC_FW_LOAD_FL_COPY (1 << 1)
@ -916,6 +931,13 @@ struct atomisp_acc_state {
unsigned int fw_handle;
};
struct atomisp_update_exposure {
unsigned int gain;
unsigned int digi_gain;
unsigned int update_gain;
unsigned int update_digi_gain;
};
/*
* V4L2 private internal data interface.
* -----------------------------------------------------------------------------
@ -1193,9 +1215,21 @@ struct atomisp_sensor_ae_bracketing_lut {
#define ATOMISP_IOC_G_INVALID_FRAME_NUM \
_IOR('v', BASE_VIDIOC_PRIVATE + 44, unsigned int)
#define ATOMISP_IOC_G_EFFECTIVE_RESOLUTION \
_IOR('v', BASE_VIDIOC_PRIVATE + 45, struct atomisp_resolution)
#define ATOMISP_IOC_S_ARRAY_RESOLUTION \
_IOW('v', BASE_VIDIOC_PRIVATE + 45, struct atomisp_resolution)
/* for depth mode sensor frame sync compensation */
#define ATOMISP_IOC_G_DEPTH_SYNC_COMP \
_IOR('v', BASE_VIDIOC_PRIVATE + 46, unsigned int)
#define ATOMISP_IOC_S_SENSOR_EE_CONFIG \
_IOW('v', BASE_VIDIOC_PRIVATE + 47, unsigned int)
#define ATOMISP_IOC_S_SENSOR_RUNMODE \
_IOW('v', BASE_VIDIOC_PRIVATE + 48, struct atomisp_s_runmode)
#define ATOMISP_IOC_G_UPDATE_EXPOSURE \
_IOWR('v', BASE_VIDIOC_PRIVATE + 49, struct atomisp_update_exposure)
/*
* Reserved ioctls. We have customer implementing it internally.
@ -1301,6 +1335,8 @@ struct atomisp_sensor_ae_bracketing_lut {
#define V4L2_CID_TEST_PATTERN_COLOR_GB (V4L2_CID_CAMERA_LASTP1 + 35)
#define V4L2_CID_TEST_PATTERN_COLOR_B (V4L2_CID_CAMERA_LASTP1 + 36)
#define V4L2_CID_ATOMISP_SELECT_ISP_VERSION (V4L2_CID_CAMERA_LASTP1 + 38)
#define V4L2_BUF_FLAG_BUFFER_INVALID 0x0400
#define V4L2_BUF_FLAG_BUFFER_VALID 0x0800
@ -1310,7 +1346,8 @@ struct atomisp_sensor_ae_bracketing_lut {
#define V4L2_EVENT_ATOMISP_METADATA_READY (V4L2_EVENT_PRIVATE_START + 2)
#define V4L2_EVENT_ATOMISP_RAW_BUFFERS_ALLOC_DONE (V4L2_EVENT_PRIVATE_START + 3)
#define V4L2_EVENT_ATOMISP_ACC_COMPLETE (V4L2_EVENT_PRIVATE_START + 4)
#define V4L2_EVENT_ATOMISP_PAUSE_BUFFER (V4L2_EVENT_PRIVATE_START + 5)
#define V4L2_EVENT_ATOMISP_CSS_RESET (V4L2_EVENT_PRIVATE_START + 6)
/* Nonstandard color effects for V4L2_CID_COLORFX */
enum {
V4L2_COLORFX_SKIN_WHITEN_LOW = 1001,

View file

@ -0,0 +1,40 @@
/*
* Support for Intel MID SoC Camera Imaging ISP subsystem.
*
* Copyright (c) 2014 Intel Corporation. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version
* 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef ATOMISP_GMIN_PLATFORM_H_
#define ATOMISP_GMIN_PLATFORM_H_
#include "atomisp_platform.h"
const struct atomisp_camera_caps *atomisp_get_default_camera_caps(void);
const struct atomisp_platform_data *atomisp_get_platform_data(void);
const struct camera_af_platform_data *camera_get_af_platform_data(void);
int atomisp_register_i2c_module(struct v4l2_subdev *subdev,
struct camera_sensor_platform_data *plat_data,
enum intel_v4l2_subdev_type type);
struct v4l2_subdev *atomisp_gmin_find_subdev(struct i2c_adapter *adapter,
struct i2c_board_info *board_info);
int atomisp_gmin_remove_subdev(struct v4l2_subdev *sd);
int gmin_get_config_var(struct device *dev, const char *var, char *out, size_t *out_len);
int gmin_get_var_int(struct device *dev, const char *var, int def);
int camera_sensor_csi(struct v4l2_subdev *sd, u32 port,
u32 lanes, u32 format, u32 bayer_order, int flag);
struct camera_sensor_platform_data *gmin_camera_platform_data(
struct v4l2_subdev *subdev,
enum atomisp_input_format csi_format,
enum atomisp_bayer_order csi_bayer);
int atomisp_gmin_register_vcm_control(struct camera_vcm_control *);
#endif

View file

@ -18,9 +18,6 @@
* 02110-1301, USA.
*
*/
#ifdef CSS15
#include <linux/atomisp_platform_css15.h>
#else
#ifndef ATOMISP_PLATFORM_H_
#define ATOMISP_PLATFORM_H_
@ -32,6 +29,8 @@
#define MAX_SENSORS_PER_PORT 4
#define MAX_STREAMS_PER_CHANNEL 2
#define CAMERA_MODULE_ID_LEN 64
enum atomisp_bayer_order {
atomisp_bayer_order_grbg,
atomisp_bayer_order_rggb,
@ -134,11 +133,11 @@ struct intel_v4l2_subdev_table {
struct intel_v4l2_subdev_i2c_board_info v4l2_subdev;
enum intel_v4l2_subdev_type type;
enum atomisp_camera_port port;
struct v4l2_subdev *subdev;
};
struct atomisp_platform_data {
struct intel_v4l2_subdev_table *subdevs;
const struct soft_platform_id *spid;
};
/* Describe the capacities of one single sensor. */
@ -186,6 +185,25 @@ struct atomisp_input_stream_info {
struct atomisp_isys_config_info isys_info[MAX_STREAMS_PER_CHANNEL];
};
struct camera_vcm_control;
struct camera_vcm_ops {
int (*power_up)(struct v4l2_subdev *sd, struct camera_vcm_control *vcm);
int (*power_down)(struct v4l2_subdev *sd,
struct camera_vcm_control *vcm);
int (*queryctrl)(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc,
struct camera_vcm_control *vcm);
int (*g_ctrl)(struct v4l2_subdev *sd, struct v4l2_control *ctrl,
struct camera_vcm_control *vcm);
int (*s_ctrl)(struct v4l2_subdev *sd, struct v4l2_control *ctrl,
struct camera_vcm_control *vcm);
};
struct camera_vcm_control {
char camera_module[CAMERA_MODULE_ID_LEN];
struct camera_vcm_ops *ops;
struct list_head list;
};
struct camera_sensor_platform_data {
int (*gpio_ctrl)(struct v4l2_subdev *subdev, int flag);
int (*flisclk_ctrl)(struct v4l2_subdev *subdev, int flag);
@ -197,6 +215,17 @@ struct camera_sensor_platform_data {
char *(*msr_file_name)(void);
struct atomisp_camera_caps *(*get_camera_caps)(void);
int (*gpio_intr_ctrl)(struct v4l2_subdev *subdev);
/* New G-Min power and GPIO interface, replaces
* power/gpio_ctrl with methods to control individual
* lines as implemented on all known camera modules. */
int (*gpio0_ctrl)(struct v4l2_subdev *subdev, int on);
int (*gpio1_ctrl)(struct v4l2_subdev *subdev, int on);
int (*v1p8_ctrl)(struct v4l2_subdev *subdev, int on);
int (*v2p8_ctrl)(struct v4l2_subdev *subdev, int on);
int (*v1p2_ctrl)(struct v4l2_subdev *subdev, int on);
struct camera_vcm_control * (*get_vcm_ctrl)(struct v4l2_subdev *subdev,
char *module_id);
};
struct camera_af_platform_data {
@ -220,5 +249,14 @@ struct camera_mipi_info {
extern const struct atomisp_platform_data *atomisp_get_platform_data(void);
extern const struct atomisp_camera_caps *atomisp_get_default_camera_caps(void);
/* API from old platform_camera.h, new CPUID implementation */
#define __IS_SOC(x) (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL && \
boot_cpu_data.x86 == 6 && \
boot_cpu_data.x86_model == x)
#define IS_MFLD __IS_SOC(0x27)
#define IS_BYT __IS_SOC(0x37)
#define IS_CHT __IS_SOC(0x4C)
#define IS_MOFD __IS_SOC(0x5A)
#endif /* ATOMISP_PLATFORM_H_ */
#endif

View file

@ -0,0 +1,32 @@
/*
* 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 __LIBMSRLISTHELPER_H__
#define __LIBMSRLISTHELPER_H__
struct i2c_client;
struct firmware;
extern int load_msr_list(struct i2c_client *client, char *path,
const struct firmware **fw);
extern int apply_msr_data(struct i2c_client *client, const struct firmware *fw);
extern void release_msr_list(struct i2c_client *client,
const struct firmware *fw);
#endif /* ifndef __LIBMSRLISTHELPER_H__ */

View file

@ -0,0 +1,30 @@
/*
* vlv2_plat_clock.h
*
* Copyright (C) 2013 Intel Corp
* Author: Asutosh Pathak <asutosh.pathak@intel.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
#ifndef __VLV2_PLAT_CLOCK_H
#define __VLV2_PLAT_CLOCK_H
int vlv2_plat_set_clock_freq(int clock_num, int freq_type);
int vlv2_plat_get_clock_freq(int clock_num);
int vlv2_plat_configure_clock(int clock_num, u32 conf);
int vlv2_plat_get_clock_status(int clock_num);
#endif /* __VLV2_PLAT_CLOCK_H */