1
2
3
4
5
6
7
8
9
10
11 #ifndef __SMIAPP_QUIRK__
12 #define __SMIAPP_QUIRK__
13
14 struct smiapp_sensor;
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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 unsigned long (*pll_flags)(struct smiapp_sensor *sensor);
45 int (*init)(struct smiapp_sensor *sensor);
46 int (*reg_access)(struct smiapp_sensor *sensor, bool write, u32 *reg,
47 u32 *val);
48 unsigned long flags;
49 };
50
51 #define SMIAPP_QUIRK_FLAG_8BIT_READ_ONLY (1 << 0)
52
53 struct smiapp_reg_8 {
54 u16 reg;
55 u8 val;
56 };
57
58 void smiapp_replace_limit(struct smiapp_sensor *sensor,
59 u32 limit, u32 val);
60
61 #define SMIAPP_MK_QUIRK_REG_8(_reg, _val) \
62 { \
63 .reg = (u16)_reg, \
64 .val = _val, \
65 }
66
67 #define smiapp_call_quirk(sensor, _quirk, ...) \
68 ((sensor)->minfo.quirk && \
69 (sensor)->minfo.quirk->_quirk ? \
70 (sensor)->minfo.quirk->_quirk(sensor, ##__VA_ARGS__) : 0)
71
72 #define smiapp_needs_quirk(sensor, _quirk) \
73 ((sensor)->minfo.quirk ? \
74 (sensor)->minfo.quirk->flags & _quirk : 0)
75
76 extern const struct smiapp_quirk smiapp_jt8ev1_quirk;
77 extern const struct smiapp_quirk smiapp_imx125es_quirk;
78 extern const struct smiapp_quirk smiapp_jt8ew9_quirk;
79 extern const struct smiapp_quirk smiapp_tcm8500md_quirk;
80
81 #endif