blob: 8fda6ed5668c2a5faf273e957ee610b770acfbb7 [file] [log] [blame]
David Brazdil0f672f62019-12-10 10:32:29 +00001/* SPDX-License-Identifier: GPL-2.0-only */
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002/*
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>
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009 */
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
28struct smiapp_sensor;
29
30int smiapp_read_no_quirk(struct smiapp_sensor *sensor, u32 reg, u32 *val);
31int smiapp_read(struct smiapp_sensor *sensor, u32 reg, u32 *val);
32int smiapp_read_8only(struct smiapp_sensor *sensor, u32 reg, u32 *val);
33int smiapp_write_no_quirk(struct smiapp_sensor *sensor, u32 reg, u32 val);
34int smiapp_write(struct smiapp_sensor *sensor, u32 reg, u32 val);
35
36#endif