aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/ovcamchip/ovcamchip_priv.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /drivers/media/video/ovcamchip/ovcamchip_priv.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'drivers/media/video/ovcamchip/ovcamchip_priv.h')
-rw-r--r--drivers/media/video/ovcamchip/ovcamchip_priv.h87
1 files changed, 87 insertions, 0 deletions
diff --git a/drivers/media/video/ovcamchip/ovcamchip_priv.h b/drivers/media/video/ovcamchip/ovcamchip_priv.h
new file mode 100644
index 000000000000..575e612a5546
--- /dev/null
+++ b/drivers/media/video/ovcamchip/ovcamchip_priv.h
@@ -0,0 +1,87 @@
1/* OmniVision* camera chip driver private definitions for core code and
2 * chip-specific code
3 *
4 * Copyright (c) 1999-2004 Mark McClelland
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. NO WARRANTY OF ANY KIND is expressed or implied.
10 *
11 * * OmniVision is a trademark of OmniVision Technologies, Inc. This driver
12 * is not sponsored or developed by them.
13 */
14
15#ifndef __LINUX_OVCAMCHIP_PRIV_H
16#define __LINUX_OVCAMCHIP_PRIV_H
17
18#include <media/ovcamchip.h>
19
20#ifdef DEBUG
21extern int ovcamchip_debug;
22#endif
23
24#define PDEBUG(level, fmt, args...) \
25 if (ovcamchip_debug >= (level)) pr_debug("[%s:%d] " fmt "\n", \
26 __FUNCTION__, __LINE__ , ## args)
27
28#define DDEBUG(level, dev, fmt, args...) \
29 if (ovcamchip_debug >= (level)) dev_dbg(dev, "[%s:%d] " fmt "\n", \
30 __FUNCTION__, __LINE__ , ## args)
31
32/* Number of times to retry chip detection. Increase this if you are getting
33 * "Failed to init camera chip" */
34#define I2C_DETECT_RETRIES 10
35
36struct ovcamchip_regvals {
37 unsigned char reg;
38 unsigned char val;
39};
40
41struct ovcamchip_ops {
42 int (*init)(struct i2c_client *);
43 int (*free)(struct i2c_client *);
44 int (*command)(struct i2c_client *, unsigned int, void *);
45};
46
47struct ovcamchip {
48 struct ovcamchip_ops *sops;
49 void *spriv; /* Private data for OV7x10.c etc... */
50 int subtype; /* = SEN_OV7610 etc... */
51 int mono; /* Monochrome chip? (invalid until init) */
52 int initialized; /* OVCAMCHIP_CMD_INITIALIZE was successful */
53};
54
55/* --------------------------------- */
56/* I2C I/O */
57/* --------------------------------- */
58
59static inline int ov_read(struct i2c_client *c, unsigned char reg,
60 unsigned char *value)
61{
62 int rc;
63
64 rc = i2c_smbus_read_byte_data(c, reg);
65 *value = (unsigned char) rc;
66 return rc;
67}
68
69static inline int ov_write(struct i2c_client *c, unsigned char reg,
70 unsigned char value )
71{
72 return i2c_smbus_write_byte_data(c, reg, value);
73}
74
75/* --------------------------------- */
76/* FUNCTION PROTOTYPES */
77/* --------------------------------- */
78
79/* Functions in ovcamchip_core.c */
80
81extern int ov_write_regvals(struct i2c_client *c,
82 struct ovcamchip_regvals *rvals);
83
84extern int ov_write_mask(struct i2c_client *c, unsigned char reg,
85 unsigned char value, unsigned char mask);
86
87#endif