diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-08-14 15:23:43 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-08-15 15:42:14 -0400 |
commit | cb7a01ac324bf2ee2c666f37ac867e4135f9785a (patch) | |
tree | 7246b915a9334d4bc823c93ba9acab65ef882678 /drivers/media/i2c/smiapp/smiapp-quirk.h | |
parent | f0af8fa4dad0839f844fd0633e1936493f6d685a (diff) |
[media] move i2c files into drivers/media/i2c
Move ancillary I2C drivers into drivers/media/i2c, in order to
better organize them.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/i2c/smiapp/smiapp-quirk.h')
-rw-r--r-- | drivers/media/i2c/smiapp/smiapp-quirk.h | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/drivers/media/i2c/smiapp/smiapp-quirk.h b/drivers/media/i2c/smiapp/smiapp-quirk.h new file mode 100644 index 000000000000..86fd3e8bfb0f --- /dev/null +++ b/drivers/media/i2c/smiapp/smiapp-quirk.h | |||
@@ -0,0 +1,83 @@ | |||
1 | /* | ||
2 | * drivers/media/i2c/smiapp/smiapp-quirk.h | ||
3 | * | ||
4 | * Generic driver for SMIA/SMIA++ compliant camera modules | ||
5 | * | ||
6 | * Copyright (C) 2011--2012 Nokia Corporation | ||
7 | * Contact: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | ||
10 | * modify it under the terms of the GNU General Public License | ||
11 | * version 2 as published by the Free Software Foundation. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, but | ||
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
16 | * General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
21 | * 02110-1301 USA | ||
22 | * | ||
23 | */ | ||
24 | |||
25 | #ifndef __SMIAPP_QUIRK__ | ||
26 | #define __SMIAPP_QUIRK__ | ||
27 | |||
28 | struct smiapp_sensor; | ||
29 | |||
30 | /** | ||
31 | * struct smiapp_quirk - quirks for sensors that deviate from SMIA++ standard | ||
32 | * | ||
33 | * @limits: Replace sensor->limits with values which can't be read from | ||
34 | * sensor registers. Called the first time the sensor is powered up. | ||
35 | * @post_poweron: Called always after the sensor has been fully powered on. | ||
36 | * @pre_streamon: Called just before streaming is enabled. | ||
37 | * @post_streamon: Called right after stopping streaming. | ||
38 | */ | ||
39 | struct smiapp_quirk { | ||
40 | int (*limits)(struct smiapp_sensor *sensor); | ||
41 | int (*post_poweron)(struct smiapp_sensor *sensor); | ||
42 | int (*pre_streamon)(struct smiapp_sensor *sensor); | ||
43 | int (*post_streamoff)(struct smiapp_sensor *sensor); | ||
44 | const struct smia_reg *regs; | ||
45 | unsigned long flags; | ||
46 | }; | ||
47 | |||
48 | /* op pix clock is for all lanes in total normally */ | ||
49 | #define SMIAPP_QUIRK_FLAG_OP_PIX_CLOCK_PER_LANE (1 << 0) | ||
50 | #define SMIAPP_QUIRK_FLAG_8BIT_READ_ONLY (1 << 1) | ||
51 | |||
52 | struct smiapp_reg_8 { | ||
53 | u16 reg; | ||
54 | u8 val; | ||
55 | }; | ||
56 | |||
57 | void smiapp_replace_limit(struct smiapp_sensor *sensor, | ||
58 | u32 limit, u32 val); | ||
59 | bool smiapp_quirk_reg(struct smiapp_sensor *sensor, | ||
60 | u32 reg, u32 *val); | ||
61 | |||
62 | #define SMIAPP_MK_QUIRK_REG(_reg, _val) \ | ||
63 | { \ | ||
64 | .type = (_reg >> 16), \ | ||
65 | .reg = (u16)_reg, \ | ||
66 | .val = _val, \ | ||
67 | } | ||
68 | |||
69 | #define smiapp_call_quirk(_sensor, _quirk, ...) \ | ||
70 | (_sensor->minfo.quirk && \ | ||
71 | _sensor->minfo.quirk->_quirk ? \ | ||
72 | _sensor->minfo.quirk->_quirk(_sensor, ##__VA_ARGS__) : 0) | ||
73 | |||
74 | #define smiapp_needs_quirk(_sensor, _quirk) \ | ||
75 | (_sensor->minfo.quirk ? \ | ||
76 | _sensor->minfo.quirk->flags & _quirk : 0) | ||
77 | |||
78 | extern const struct smiapp_quirk smiapp_jt8ev1_quirk; | ||
79 | extern const struct smiapp_quirk smiapp_imx125es_quirk; | ||
80 | extern const struct smiapp_quirk smiapp_jt8ew9_quirk; | ||
81 | extern const struct smiapp_quirk smiapp_tcm8500md_quirk; | ||
82 | |||
83 | #endif /* __SMIAPP_QUIRK__ */ | ||