summaryrefslogtreecommitdiff
path: root/drivers/media/i2c/ccs/ccs-reg-access.h
blob: 9fdf5659ed09ec9b23707d252ad4592622b7b38b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * include/media/ccs/ccs-reg-access.h
 *
 * Generic driver for MIPI CCS/SMIA/SMIA++ compliant camera sensors
 *
 * Copyright (C) 2020 Intel Corporation
 * Copyright (C) 2011--2012 Nokia Corporation
 * Contact: Sakari Ailus <sakari.ailus@iki.fi>
 */

#ifndef SMIAPP_REGS_H
#define SMIAPP_REGS_H

#include <linux/i2c.h>
#include <linux/types.h>

#include "ccs-regs.h"

#define CCS_REG_ADDR(reg)		((u16)reg)

struct ccs_sensor;

int ccs_read_addr_no_quirk(struct ccs_sensor *sensor, u32 reg, u32 *val);
int ccs_read_addr(struct ccs_sensor *sensor, u32 reg, u32 *val);
int ccs_read_addr_8only(struct ccs_sensor *sensor, u32 reg, u32 *val);
int ccs_write_addr_no_quirk(struct ccs_sensor *sensor, u32 reg, u32 val);
int ccs_write_addr(struct ccs_sensor *sensor, u32 reg, u32 val);

unsigned int ccs_reg_width(u32 reg);

#define ccs_read(sensor, reg_name, val) \
	ccs_read_addr(sensor, CCS_R_##reg_name, val)

#define ccs_write(sensor, reg_name, val) \
	ccs_write_addr(sensor, CCS_R_##reg_name, val)

#endif