1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 3 * include/media/ccs/ccs-reg-access.h 4 * 5 * Generic driver for MIPI CCS/SMIA/SMIA++ compliant camera sensors 6 * 7 * Copyright (C) 2020 Intel Corporation 8 * Copyright (C) 2011--2012 Nokia Corporation 9 * Contact: Sakari Ailus <sakari.ailus@linux.intel.com> 10 */ 11 12 #ifndef SMIAPP_REGS_H 13 #define SMIAPP_REGS_H 14 15 #include <linux/i2c.h> 16 #include <linux/types.h> 17 18 #include "ccs-regs.h" 19 20 #define CCS_REG_ADDR(reg) ((u16)reg) 21 22 struct ccs_sensor; 23 24 int ccs_read_addr_no_quirk(struct ccs_sensor *sensor, u32 reg, u32 *val); 25 int ccs_read_addr(struct ccs_sensor *sensor, u32 reg, u32 *val); 26 int ccs_read_addr_8only(struct ccs_sensor *sensor, u32 reg, u32 *val); 27 int ccs_read_addr_noconv(struct ccs_sensor *sensor, u32 reg, u32 *val); 28 int ccs_write_addr_no_quirk(struct ccs_sensor *sensor, u32 reg, u32 val); 29 int ccs_write_addr(struct ccs_sensor *sensor, u32 reg, u32 val); 30 int ccs_write_data_regs(struct ccs_sensor *sensor, struct ccs_reg *regs, 31 size_t num_regs); 32 33 unsigned int ccs_reg_width(u32 reg); 34 u32 ccs_reg_conv(struct ccs_sensor *sensor, u32 reg, u32 val); 35 36 #define ccs_read(sensor, reg_name, val) \ 37 ccs_read_addr(sensor, CCS_R_##reg_name, val) 38 39 #define ccs_write(sensor, reg_name, val) \ 40 ccs_write_addr(sensor, CCS_R_##reg_name, val) 41 42 #endif 43