Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
n9: add missing camera related header files
Signed-off-by: Filip Matijević <filip.matijevic.pz@gmail.com>
  • Loading branch information
filippz committed May 7, 2014
1 parent d48cfab commit dcbba82
Show file tree
Hide file tree
Showing 5 changed files with 384 additions and 0 deletions.
114 changes: 114 additions & 0 deletions include/linux/ad58xx.h
@@ -0,0 +1,114 @@
/**
* include/linux/ad58xx.h
*
* Copyright (C) 2010 Nokia Corporation
*
* Contact: Atanas Filipov <atanasf@mm-sol.com>
*
* 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 St, Fifth Floor, Boston, MA
* 02110-1301 USA
*/

#ifndef __AD58XX_USER_H_
#define __AD58XX_USER_H_

#include <linux/videodev2.h>

/* AD58XX Focus modes */
enum v4l2_ad58xx_focus_mode {
AD58XX_FOCUS_MODE_IM = 0,
AD58XX_FOCUS_MODE_SFSS = 1,
AD58XX_FOCUS_MODE_SFMSP1 = 2,
AD58XX_FOCUS_MODE_MFMSP1 = 3,
AD58XX_FOCUS_MODE_SFMSP2 = 4,
AD58XX_FOCUS_MODE_MFMSP2 = 5,
};

/* AD58XX Ringing control modes */
enum v4l2_ad58xx_rc_mode {
AD58XX_VCM_MODE_ARC_RES01 = 0,
AD58XX_VCM_MODE_ARC_ESRC = 1,
AD58XX_VCM_MODE_ARC_RES05 = 2,
AD58XX_VCM_MODE_ARC_RES02 = 3,
};

/* AD5817 Output drive modes */
enum v4l2_ad58xx_lin_mode {
AD5817_LIN_MODE_FULL_PWM = 0,
AD5817_LIN_MODE_FULL_LINEAR = 1,
AD5817_LIN_MODE_AUTO_MODE0 = 2,
AD5817_LIN_MODE_AUTO_MODE1 = 3,
};

/* AD5817 Master clock */
enum v4l2_ad58xx_set_clk {
AD5817_SET_CLK_INT_CLK = 0,
AD5817_SET_CLK_EXT_CLK_4_8 = 1,
AD5817_SET_CLK_EXT_CLK_9_6 = 2,
AD5817_SET_CLK_EXT_CLK_19_2 = 3,
};

/* BU8051GWZ Output voltage */
enum v4l2_ad58xx_gainsel {
BU8051GWZ_GAINSEL_2_70 = 0,
BU8051GWZ_GAINSEL_2_75 = 1,
BU8051GWZ_GAINSEL_2_80 = 2,
BU8051GWZ_GAINSEL_2_85 = 3,
};

/* Control IDs specific to the AD58XX driver */
#define V4L2_CID_AD58XX_FOCUS_MODE (V4L2_CID_CAMERA_CLASS_BASE + 1000)
#define V4L2_CID_AD58XX_FOCUS_RINGCTRL (V4L2_CID_CAMERA_CLASS_BASE + 1001)
#define V4L2_CID_AD58XX_FOCUS_SW_RESET (V4L2_CID_CAMERA_CLASS_BASE + 1002)
#define V4L2_CID_AD58XX_CHANGE_NUM_P1 (V4L2_CID_CAMERA_CLASS_BASE + 1003)
#define V4L2_CID_AD58XX_CHANGE_NUM_P2 (V4L2_CID_CAMERA_CLASS_BASE + 1004)
#define V4L2_CID_AD58XX_STROBE_CNT_P1 (V4L2_CID_CAMERA_CLASS_BASE + 1005)
#define V4L2_CID_AD58XX_STROBE_CNT_P2 (V4L2_CID_CAMERA_CLASS_BASE + 1006)
#define V4L2_CID_AD58XX_VCM_MOVE_TIME (V4L2_CID_CAMERA_CLASS_BASE + 1007)
#define V4L2_CID_AD58XX_VCM_THRESHOLD (V4L2_CID_CAMERA_CLASS_BASE + 1008)
#define V4L2_CID_AD58XX_VCM_MODE_ARC (V4L2_CID_CAMERA_CLASS_BASE + 1009)
#define V4L2_CID_AD58XX_VCM_MODE_ADJ (V4L2_CID_CAMERA_CLASS_BASE + 1010)

#define V4L2_CID_AD5817_LIN_MODE (V4L2_CID_CAMERA_CLASS_BASE + 1011)
#define V4L2_CID_AD5817_CLK_DIV (V4L2_CID_CAMERA_CLASS_BASE + 1012)
#define V4L2_CID_AD5817_FORCE_DISK (V4L2_CID_CAMERA_CLASS_BASE + 1013)
#define V4L2_CID_AD5817_LDO_VANA_DSBL (V4L2_CID_CAMERA_CLASS_BASE + 1014)
#define V4L2_CID_AD5817_CP_DISABLE (V4L2_CID_CAMERA_CLASS_BASE + 1015)
#define V4L2_CID_AD5817_LDO_VANA (V4L2_CID_CAMERA_CLASS_BASE + 1016)

/* Control IDs specific to the BU8051GWZ driver */
#define V4L2_CID_BU8051GWZ_OP1 (V4L2_CID_CAMERA_CLASS_BASE + 1017)
#define V4L2_CID_BU8051GWZ_OP2 (V4L2_CID_CAMERA_CLASS_BASE + 1018)
#define V4L2_CID_BU8051GWZ_OP3 (V4L2_CID_CAMERA_CLASS_BASE + 1019)
#define V4L2_CID_BU8051GWZ_OP4 (V4L2_CID_CAMERA_CLASS_BASE + 1020)
#define V4L2_CID_BU8051GWZ_GAINSEL (V4L2_CID_CAMERA_CLASS_BASE + 1021)
#define V4L2_CID_BU8051GWZ_GAINSELEN (V4L2_CID_CAMERA_CLASS_BASE + 1022)
#define V4L2_CID_BU8051GWZ_SCO (V4L2_CID_CAMERA_CLASS_BASE + 1023)
#define V4L2_CID_BU8051GWZ_SF (V4L2_CID_CAMERA_CLASS_BASE + 1024)
#define V4L2_CID_BU8051GWZ_PWM (V4L2_CID_CAMERA_CLASS_BASE + 1025)

/** Temporary backward compatibility for AD5836 */
#define V4L2_CID_AD5836_FOCUS_MODE V4L2_CID_AD58XX_FOCUS_MODE
#define V4L2_CID_AD5836_FOCUS_RINGCTRL V4L2_CID_AD58XX_FOCUS_RINGCTRL
#define V4L2_CID_AD5836_FOCUS_SW_RESET V4L2_CID_AD58XX_FOCUS_SW_RESET
#define V4L2_CID_AD5836_CHANGE_NUM_P1 V4L2_CID_AD58XX_CHANGE_NUM_P1
#define V4L2_CID_AD5836_CHANGE_NUM_P2 V4L2_CID_AD58XX_CHANGE_NUM_P2
#define V4L2_CID_AD5836_STROBE_CNT_P1 V4L2_CID_AD58XX_STROBE_CNT_P1
#define V4L2_CID_AD5836_STROBE_CNT_P2 V4L2_CID_AD58XX_STROBE_CNT_P2
#define V4L2_CID_AD5836_VCM_MOVE_TIME V4L2_CID_AD58XX_VCM_MOVE_TIME
#define V4L2_CID_AD5836_VCM_THRESHOLD V4L2_CID_AD58XX_VCM_THRESHOLD
#define V4L2_CID_AD5836_VCM_MODE_ARC V4L2_CID_AD58XX_VCM_MODE_ARC
#define V4L2_CID_AD5836_VCM_MODE_ADJ V4L2_CID_AD58XX_VCM_MODE_ADJ

#endif /* __AD58XX_USER_H_ */
36 changes: 36 additions & 0 deletions include/linux/as3645a.h
@@ -0,0 +1,36 @@
/**
* include/linux/as3645a.h
*
* Copyright (C) 2010 Nokia Corporation
*
* Contact: Ivan T. Ivanov <iivanov@mm-sol.com>
*
* 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 St, Fifth Floor, Boston, MA
* 02110-1301 USA
*/

#ifndef __AS3645A_USER_H_
#define __AS3645A_USER_H_

#include <linux/videodev2.h>

#define V4L2_EVENT_AS3645A_CLASS (V4L2_EVENT_PRIVATE_START | 0x200)
#define V4L2_EVENT_STATUS_CHANGED (V4L2_EVENT_AS3645A_CLASS | 1)

enum v4l2_flash_events {
V4L2_FLASH_READY = 0,
V4L2_FLASH_COOLDOWN = 1,
};

#endif /* __AS3645A_USER_H_ */
58 changes: 58 additions & 0 deletions include/media/ad58xx.h
@@ -0,0 +1,58 @@
/**
* drivers/media/video/ad58xx.h
*
* Copyright (C) 2008 Nokia Corporation
* Copyright (C) 2007 Texas Instruments
*
* Contact: Atanas Filipov <atanasf@mm-sol.com>
*
* Based on ad5807.c by
* Vimarsh Zutshi <vimarsh.zutshi@nokia.com>
*
* Based on ad5820.c by
* Tuukka Toivonen <tuukka.o.toivonen@nokia.com>
* Sakari Ailus <sakari.ailus@nokia.com>
*
* 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 St, Fifth Floor, Boston, MA
* 02110-1301 USA
*/

#ifndef __AD58XX_H_
#define __AD58XX_H_

#include <media/v4l2-subdev.h>

#define AD5836_NAME "ad5836"
#define AD5836_I2C_ADDR (0x1c >> 1)

#define AD58XX_NAME "ad58xx"
#define AD58XX_I2C_ADDR (0x1c >> 1)

/*
* struct ad58xx_module_ident - Lens module identification
*/
struct ad58xx_module_ident {
u8 id; /* module manufacturer / device id */
char *name;
};

/* When no activity on EXTCLK, the AD58XX enters power-down mode */
struct ad58xx_platform_data {
unsigned int ext_clk;
int (*set_xclk)(struct v4l2_subdev *sd, u32 hz);
int (*use_iclk)(void);
int (*use_protection)(void);
};

#endif /* __AD58XX_H_ */
31 changes: 31 additions & 0 deletions include/media/smiapp-power.h
@@ -0,0 +1,31 @@
/*
* include/media/smiapp-power.h
*
* Copyright (C) 2010 Nokia Corporation
*
* Contact: Antti Koskipaa <antti.koskipaa@nokia.com>
*
* 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 St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/

#ifndef SMIAPP_POWER_H
#define SMIAPP_POWER_H

#include <linux/regulator/consumer.h>

int smiapp_power_set_power(struct regulator *reg, int on);

#endif
145 changes: 145 additions & 0 deletions include/media/smiapp-regs.h
@@ -0,0 +1,145 @@
/*
* include/media/smiapp-regs.h
*
* Copyright (C) 2008 Nokia Corporation
*
* Contact: Sakari Ailus <sakari.ailus@nokia.com>
* Tuukka Toivonen <tuukka.o.toivonen@nokia.com>
*
* 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 St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/

#ifndef SMIAPP_REGS_H
#define SMIAPP_REGS_H

#include <linux/i2c.h>
#include <linux/types.h>
#include <linux/videodev2.h>
#include <linux/v4l2-subdev.h>

struct v4l2_mbus_framefmt;
struct v4l2_subdev_pad_mbus_code_enum;

#define SMIA_MAGIC 0x531A0002

struct smia_mode {
/* Physical sensor resolution and current image window */
__u16 sensor_width;
__u16 sensor_height;
__u16 sensor_window_origin_x;
__u16 sensor_window_origin_y;
__u16 sensor_window_width;
__u16 sensor_window_height;

/* Image data coming from sensor (after scaling) */
__u16 width;
__u16 height;
__u16 window_origin_x;
__u16 window_origin_y;
__u16 window_width;
__u16 window_height;

__u32 pixel_clock; /* in Hz */
__u32 opsys_clock; /* in Hz */
__u32 ext_clock; /* in Hz */
struct v4l2_fract timeperframe;
__u32 max_exp; /* Maximum exposure value */
__u32 pixel_format; /* V4L2_PIX_FMT_xxx */
__u32 sensitivity; /* 16.16 fixed point */
};

#define SMIA_REG_8BIT 1
#define SMIA_REG_16BIT 2
#define SMIA_REG_32BIT 4
#define SMIA_REG_DELAY 100
#define SMIA_REG_TERM 0xff
struct smia_reg {
u16 type;
u16 reg; /* 16-bit offset */
u32 val; /* 8/16/32-bit value */
};

/* Possible struct smia_reglist types. */
#define SMIA_REGLIST_STANDBY 0
#define SMIA_REGLIST_POWERON 1
#define SMIA_REGLIST_RESUME 2
#define SMIA_REGLIST_STREAMON 3
#define SMIA_REGLIST_STREAMOFF 4
#define SMIA_REGLIST_DISABLED 5

#define SMIA_REGLIST_MODE 10

#define SMIA_REGLIST_LSC_ENABLE 100
#define SMIA_REGLIST_LSC_DISABLE 101
#define SMIA_REGLIST_ANR_ENABLE 102
#define SMIA_REGLIST_ANR_DISABLE 103

struct smia_reglist {
u32 type;
struct smia_mode mode;
struct smia_reg regs[];
};

#define SMIA_MAX_LEN 32
struct smia_meta_reglist {
u32 magic;
char version[SMIA_MAX_LEN];
/*
* When we generate a reglist, the objcopy program will put
* here the list of addresses to reglists local to that object
* file.
*
* In the kernel they serve as offsets inside the the register
* list binary.
*
* The list must be NULL-terminated. That is expected by the
* drivers.
*/
union {
uintptr_t offset;
struct smia_reglist *ptr;
} reglist[];
};

int smia_reglist_import(struct smia_meta_reglist *meta);
struct smia_reglist *smia_reglist_find_type(struct smia_meta_reglist *meta,
u16 type);
struct smia_reglist **smia_reglist_first(struct smia_meta_reglist *meta);
struct smia_reglist *smia_reglist_find_mode_fmt(struct smia_meta_reglist *meta,
struct v4l2_mbus_framefmt *fmt);
struct smia_reglist *smia_reglist_find_mode_ival(
struct smia_meta_reglist *meta,
struct smia_reglist *current_reglist,
struct v4l2_fract *timeperframe);
int smia_reglist_enum_mbus_code(struct smia_meta_reglist *meta,
struct v4l2_subdev_mbus_code_enum *code);
int smia_reglist_enum_frame_size(struct smia_meta_reglist *meta,
struct v4l2_subdev_frame_size_enum *fse);
int smia_reglist_enum_frame_ival(struct smia_meta_reglist *meta,
struct v4l2_subdev_frame_interval_enum *fie);
void smia_reglist_to_mbus(const struct smia_reglist *reglist,
struct v4l2_mbus_framefmt *fmt);

int smia_i2c_read_reg(struct i2c_client *client, u16 data_length,
u16 reg, u32 *val);
int smia_i2c_write_reg(struct i2c_client *client, u16 data_length, u16 reg,
u32 val);
int smia_i2c_write_regs(struct i2c_client *client,
const struct smia_reg reglist[]);
int smia_i2c_reglist_find_write(struct i2c_client *client,
struct smia_meta_reglist *meta, u16 type);

#endif

0 comments on commit dcbba82

Please sign in to comment.