GNU Linux-libre 5.10.153-gnu1
[releases.git] / drivers / media / i2c / smiapp / smiapp-regs.h
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * include/media/smiapp/smiapp-regs.h
4  *
5  * Generic driver for SMIA/SMIA++ compliant camera modules
6  *
7  * Copyright (C) 2011--2012 Nokia Corporation
8  * Contact: Sakari Ailus <sakari.ailus@iki.fi>
9  */
10
11 #ifndef SMIAPP_REGS_H
12 #define SMIAPP_REGS_H
13
14 #include <linux/i2c.h>
15 #include <linux/types.h>
16
17 #define SMIAPP_REG_ADDR(reg)            ((u16)reg)
18 #define SMIAPP_REG_WIDTH(reg)           ((u8)(reg >> 16))
19 #define SMIAPP_REG_FLAGS(reg)           ((u8)(reg >> 24))
20
21 /* Use upper 8 bits of the type field for flags */
22 #define SMIAPP_REG_FLAG_FLOAT           (1 << 24)
23
24 #define SMIAPP_REG_8BIT                 1
25 #define SMIAPP_REG_16BIT                2
26 #define SMIAPP_REG_32BIT                4
27
28 struct smiapp_sensor;
29
30 int smiapp_read_no_quirk(struct smiapp_sensor *sensor, u32 reg, u32 *val);
31 int smiapp_read(struct smiapp_sensor *sensor, u32 reg, u32 *val);
32 int smiapp_read_8only(struct smiapp_sensor *sensor, u32 reg, u32 *val);
33 int smiapp_write_no_quirk(struct smiapp_sensor *sensor, u32 reg, u32 val);
34 int smiapp_write(struct smiapp_sensor *sensor, u32 reg, u32 val);
35
36 #endif