summaryrefslogtreecommitdiff
path: root/drivers/media/i2c/smiapp/ccs-quirk.h
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@linux.intel.com>2020-02-11 14:19:13 +0100
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2020-12-02 15:39:44 +0100
commit161cc847370a92f2d39f79edc640b599a497c862 (patch)
treea104e41c5647c337629f465432581681264e97ca /drivers/media/i2c/smiapp/ccs-quirk.h
parent47ff2ff267ee4f259154ddd578b25224393d306b (diff)
media: smiapp: Internal rename to CCS
Rename internal names to reflect the driver's new reference. The module name remains the same. Also fix trivial coding style issues on the way related to e.g. alignment changes due to the rename. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/media/i2c/smiapp/ccs-quirk.h')
-rw-r--r--drivers/media/i2c/smiapp/ccs-quirk.h78
1 files changed, 78 insertions, 0 deletions
diff --git a/drivers/media/i2c/smiapp/ccs-quirk.h b/drivers/media/i2c/smiapp/ccs-quirk.h
new file mode 100644
index 000000000000..d208379158f2
--- /dev/null
+++ b/drivers/media/i2c/smiapp/ccs-quirk.h
@@ -0,0 +1,78 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * drivers/media/i2c/smiapp/ccs-quirk.h
+ *
+ * Generic driver for SMIA/SMIA++ compliant camera modules
+ *
+ * Copyright (C) 2011--2012 Nokia Corporation
+ * Contact: Sakari Ailus <sakari.ailus@iki.fi>
+ */
+
+#ifndef __CCS_QUIRK__
+#define __CCS_QUIRK__
+
+struct ccs_sensor;
+
+/**
+ * struct ccs_quirk - quirks for sensors that deviate from SMIA++ standard
+ *
+ * @limits: Replace sensor->limits with values which can't be read from
+ * sensor registers. Called the first time the sensor is powered up.
+ * @post_poweron: Called always after the sensor has been fully powered on.
+ * @pre_streamon: Called just before streaming is enabled.
+ * @post_streamon: Called right after stopping streaming.
+ * @pll_flags: Return flags for the PLL calculator.
+ * @init: Quirk initialisation, called the last in probe(). This is
+ * also appropriate for adding sensor specific controls, for instance.
+ * @reg_access: Register access quirk. The quirk may divert the access
+ * to another register, or no register at all.
+ *
+ * @write: Is this read (false) or write (true) access?
+ * @reg: Pointer to the register to access
+ * @value: Register value, set by the caller on write, or
+ * by the quirk on read
+ *
+ * @return: 0 on success, -ENOIOCTLCMD if no register
+ * access may be done by the caller (default read
+ * value is zero), else negative error code on error
+ */
+struct ccs_quirk {
+ int (*limits)(struct ccs_sensor *sensor);
+ int (*post_poweron)(struct ccs_sensor *sensor);
+ int (*pre_streamon)(struct ccs_sensor *sensor);
+ int (*post_streamoff)(struct ccs_sensor *sensor);
+ unsigned long (*pll_flags)(struct ccs_sensor *sensor);
+ int (*init)(struct ccs_sensor *sensor);
+ int (*reg_access)(struct ccs_sensor *sensor, bool write, u32 *reg,
+ u32 *val);
+ unsigned long flags;
+};
+
+#define CCS_QUIRK_FLAG_8BIT_READ_ONLY (1 << 0)
+
+struct ccs_reg_8 {
+ u16 reg;
+ u8 val;
+};
+
+#define CCS_MK_QUIRK_REG_8(_reg, _val) \
+ { \
+ .reg = (u16)_reg, \
+ .val = _val, \
+ }
+
+#define ccs_call_quirk(sensor, _quirk, ...) \
+ ((sensor)->minfo.quirk && \
+ (sensor)->minfo.quirk->_quirk ? \
+ (sensor)->minfo.quirk->_quirk(sensor, ##__VA_ARGS__) : 0)
+
+#define ccs_needs_quirk(sensor, _quirk) \
+ ((sensor)->minfo.quirk ? \
+ (sensor)->minfo.quirk->flags & _quirk : 0)
+
+extern const struct ccs_quirk smiapp_jt8ev1_quirk;
+extern const struct ccs_quirk smiapp_imx125es_quirk;
+extern const struct ccs_quirk smiapp_jt8ew9_quirk;
+extern const struct ccs_quirk smiapp_tcm8500md_quirk;
+
+#endif /* __CCS_QUIRK__ */