summaryrefslogtreecommitdiff
path: root/include/media
diff options
context:
space:
mode:
authorErik Lilliebjerg <elilliebjerg@nvidia.com>2011-11-23 03:12:24 -0700
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:50:21 -0800
commit6deb074c3731c132f486b27a51872e86e95bb799 (patch)
treeb565e777caced9ad3d825b5f093b41482e08d880 /include/media
parentd4133ca4ed7d17a6ba8b04fce71a5349fbc01a1d (diff)
media: common camera header
This is the common header for the camera devices: imager, focuser, and torch. Bug 852480 Change-Id: I0a7d7486ca71e97f1ff7f923795146b3e151eb12 Signed-off-by: Erik Lilliebjerg <elilliebjerg@nvidia.com> Reviewed-on: http://git-master/r/66419 Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com> Reviewed-by: Sachin Nikam <snikam@nvidia.com> Tested-by: Gerrit_Virtual_Submit Rebase-Id: R812b8f9b958706565a512380abe4e1be3a567c6b
Diffstat (limited to 'include/media')
-rw-r--r--include/media/nvc.h145
1 files changed, 145 insertions, 0 deletions
diff --git a/include/media/nvc.h b/include/media/nvc.h
new file mode 100644
index 000000000000..35bd6e2470d1
--- /dev/null
+++ b/include/media/nvc.h
@@ -0,0 +1,145 @@
+/* Copyright (C) 2011 NVIDIA Corporation.
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA
+ * 02111-1307, USA
+ */
+
+#ifndef __NVC_H__
+#define __NVC_H__
+
+#include <linux/ioctl.h>
+
+struct nvc_param {
+ int param;
+ __u32 sizeofvalue;
+ void *p_value;
+} __packed;
+
+#define NVC_PARAM_EXPOSURE 0
+#define NVC_PARAM_GAIN 1
+#define NVC_PARAM_FRAMERATE 2
+#define NVC_PARAM_MAX_FRAMERATE 3
+#define NVC_PARAM_INPUT_CLOCK 4
+#define NVC_PARAM_LOCUS 5
+#define NVC_PARAM_FLASH_CAPS 6
+#define NVC_PARAM_FLASH_LEVEL 7
+#define NVC_PARAM_FLASH_PIN_STATE 8
+#define NVC_PARAM_TORCH_CAPS 9
+#define NVC_PARAM_TORCH_LEVEL 10
+#define NVC_PARAM_FOCAL_LEN 11
+#define NVC_PARAM_MAX_APERTURE 12
+#define NVC_PARAM_FNUMBER 13
+#define NVC_PARAM_EXPOSURE_LIMITS 14
+#define NVC_PARAM_GAIN_LIMITS 15
+#define NVC_PARAM_FRAMERATE_LIMITS 16
+#define NVC_PARAM_FRAME_RATES 17
+#define NVC_PARAM_EXP_LATCH_TIME 19
+#define NVC_PARAM_REGION_USED 20
+#define NVC_PARAM_SELF_TEST 23
+#define NVC_PARAM_STS 24
+#define NVC_PARAM_TESTMODE 25
+#define NVC_PARAM_EXPECTED_VALUES 26
+#define NVC_PARAM_RESET 27
+#define NVC_PARAM_OPTIMIZE_RES 28
+#define NVC_PARAM_LINES_PER_SEC 30
+#define NVC_PARAM_CAPS 31
+#define NVC_PARAM_STEREO_CAP 33
+#define NVC_PARAM_FOCUS_STEREO 34
+#define NVC_PARAM_STEREO 35
+#define NVC_PARAM_INHERENT_GAIN 36
+#define NVC_PARAM_VIEW_ANGLE_H 37
+#define NVC_PARAM_VIEW_ANGLE_V 38
+#define NVC_PARAM_DEV_ID 46
+#define NVC_PARAM_TEST_PATTERN 0x10000002
+#define NVC_PARAM_SENSOR_TYPE 0x10000006
+#define NVC_PARAM_I2C 1001
+
+/* sync off */
+#define NVC_SYNC_OFF 0
+/* use only this device (the one receiving the call) */
+#define NVC_SYNC_MASTER 1
+/* use only the synced device (the "other" device) */
+#define NVC_SYNC_SLAVE 2
+/* use both synced devices at the same time */
+#define NVC_SYNC_STEREO 3
+
+#define NVC_RESET_HARD 0
+#define NVC_RESET_SOFT 1
+
+#define NVC_IOCTL_PWR_WR _IOW('o', 102, int)
+#define NVC_IOCTL_PWR_RD _IOW('o', 103, int)
+#define NVC_IOCTL_PARAM_WR _IOW('o', 104, struct nvc_param)
+#define NVC_IOCTL_PARAM_RD _IOWR('o', 105, struct nvc_param)
+
+
+#ifdef __KERNEL__
+
+#include <linux/regulator/consumer.h>
+
+/* The NVC_CFG_ defines are for the .cfg entry in the
+ * platform data structure.
+ */
+/* Device not registered if not found */
+#define NVC_CFG_NODEV (1 << 0)
+/* Don't return errors */
+#define NVC_CFG_NOERR (1 << 1)
+/* Always go to _PWR_STDBY instead of _PWR_OFF */
+#define NVC_CFG_OFF2STDBY (1 << 2)
+/* Init device at sys boot */
+#define NVC_CFG_BOOT_INIT (1 << 3)
+/* Sync mode uses an I2C MUX to send at same time */
+#define NVC_CFG_SYNC_I2C_MUX (1 << 4)
+
+/* Expected higher level power calls are:
+ * 1 = OFF
+ * 2 = STANDBY
+ * 3 = ON
+ * These will be multiplied by 2 before given to the driver's PM code that
+ * uses the _PWR_ defines. This allows us to insert defines to give more power
+ * granularity and still remain linear with regards to the power usage and
+ * full power state transition latency for easy implementation of PM
+ * algorithms.
+ * The PM actions:
+ * _PWR_ERR = Non-valid state.
+ * _PWR_OFF_DELAYED = _PWR_OFF is called after a period of time.
+ * _PWR_OFF = Device, regulators, clocks, etc is turned off. The longest
+ * transition time to _PWR_ON is from this state.
+ * _PWR_STDBY_OFF = Device is useless but powered. No communication possible.
+ * Device does not retain programming. Main purpose is for
+ * faster return to _PWR_ON without regulator delays.
+ * _PWR_STDBY = Device is in standby. Device retains programming.
+ * _PWR_COMM = Device is powered enough to communicate with the device.
+ * _PWR_ON = Device is at full power with active output.
+ *
+ * The kernel drivers treat these calls as guaranteed level of service.
+ */
+
+#define NVC_PWR_ERR 0
+#define NVC_PWR_OFF_DELAYED 1
+#define NVC_PWR_OFF 2
+#define NVC_PWR_STDBY_OFF 3
+#define NVC_PWR_STDBY 4
+#define NVC_PWR_COMM 5
+#define NVC_PWR_ON 6
+
+struct nvc_regulator {
+ bool vreg_flag;
+ struct regulator *vreg;
+ const char *vreg_name;
+};
+
+#endif /* __KERNEL__ */
+
+#endif /* __NVC_H__ */
+