1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * cxd2880_io.h 4 * Sony CXD2880 DVB-T2/T tuner + demodulator driver 5 * register I/O interface definitions 6 * 7 * Copyright (C) 2016, 2017, 2018 Sony Semiconductor Solutions Corporation 8 */ 9 10 #ifndef CXD2880_IO_H 11 #define CXD2880_IO_H 12 13 #include "cxd2880_common.h" 14 15 enum cxd2880_io_tgt { 16 CXD2880_IO_TGT_SYS, 17 CXD2880_IO_TGT_DMD 18 }; 19 20 struct cxd2880_reg_value { 21 u8 addr; 22 u8 value; 23 }; 24 25 struct cxd2880_io { 26 int (*read_regs)(struct cxd2880_io *io, 27 enum cxd2880_io_tgt tgt, u8 sub_address, 28 u8 *data, u32 size); 29 int (*write_regs)(struct cxd2880_io *io, 30 enum cxd2880_io_tgt tgt, u8 sub_address, 31 const u8 *data, u32 size); 32 int (*write_reg)(struct cxd2880_io *io, 33 enum cxd2880_io_tgt tgt, u8 sub_address, 34 u8 data); 35 void *if_object; 36 u8 i2c_address_sys; 37 u8 i2c_address_demod; 38 u8 slave_select; 39 void *user; 40 }; 41 42 int cxd2880_io_common_write_one_reg(struct cxd2880_io *io, 43 enum cxd2880_io_tgt tgt, 44 u8 sub_address, u8 data); 45 46 int cxd2880_io_set_reg_bits(struct cxd2880_io *io, 47 enum cxd2880_io_tgt tgt, 48 u8 sub_address, u8 data, u8 mask); 49 50 int cxd2880_io_write_multi_regs(struct cxd2880_io *io, 51 enum cxd2880_io_tgt tgt, 52 const struct cxd2880_reg_value reg_value[], 53 u8 size); 54 #endif 55