Merge branch 'for-3.20/core' of git://git.kernel.dk/linux-block
[firefly-linux-kernel-4.4.55.git] / drivers / media / i2c / smiapp / smiapp-quirk.h
index 46e9ea8bfa0806c0bb1bd95663c70d2640196c18..dac5566a2f7ad2d0afb6434a9f287325c785716e 100644 (file)
  * 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., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
  */
 
 #ifndef __SMIAPP_QUIRK__
@@ -35,6 +29,9 @@ struct smiapp_sensor;
  * @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.
  *
@@ -53,6 +50,7 @@ struct smiapp_quirk {
        int (*pre_streamon)(struct smiapp_sensor *sensor);
        int (*post_streamoff)(struct smiapp_sensor *sensor);
        unsigned long (*pll_flags)(struct smiapp_sensor *sensor);
+       int (*init)(struct smiapp_sensor *sensor);
        int (*reg_access)(struct smiapp_sensor *sensor, bool write, u32 *reg,
                          u32 *val);
        unsigned long flags;
@@ -74,14 +72,14 @@ void smiapp_replace_limit(struct smiapp_sensor *sensor,
                .val = _val,            \
        }
 
-#define smiapp_call_quirk(_sensor, _quirk, ...)                                \
-       (_sensor->minfo.quirk &&                                        \
-        _sensor->minfo.quirk->_quirk ?                                 \
-        _sensor->minfo.quirk->_quirk(_sensor, ##__VA_ARGS__) : 0)
+#define smiapp_call_quirk(sensor, _quirk, ...)                         \
+       ((sensor)->minfo.quirk &&                                       \
+        (sensor)->minfo.quirk->_quirk ?                                \
+        (sensor)->minfo.quirk->_quirk(sensor, ##__VA_ARGS__) : 0)
 
-#define smiapp_needs_quirk(_sensor, _quirk)            \
-       (_sensor->minfo.quirk ?                         \
-        _sensor->minfo.quirk->flags & _quirk : 0)
+#define smiapp_needs_quirk(sensor, _quirk)             \
+       ((sensor)->minfo.quirk ?                        \
+        (sensor)->minfo.quirk->flags & _quirk : 0)
 
 extern const struct smiapp_quirk smiapp_jt8ev1_quirk;
 extern const struct smiapp_quirk smiapp_imx125es_quirk;