linux/drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd.h

/* SPDX-License-Identifier: GPL-2.0 */
/*
 * cxd2880_tnrdmd.h
 * Sony CXD2880 DVB-T2/T tuner + demodulator driver
 * common control interface
 *
 * Copyright (C) 2016, 2017, 2018 Sony Semiconductor Solutions Corporation
 */

#ifndef CXD2880_TNRDMD_H
#define CXD2880_TNRDMD_H

#include <linux/atomic.h>

#include "cxd2880_common.h"
#include "cxd2880_io.h"
#include "cxd2880_dtv.h"
#include "cxd2880_dvbt.h"
#include "cxd2880_dvbt2.h"

#define CXD2880_TNRDMD_MAX_CFG_MEM_COUNT

#define slvt_unfreeze_reg(tnr_dmd)

#define CXD2880_TNRDMD_INTERRUPT_TYPE_BUF_UNDERFLOW
#define CXD2880_TNRDMD_INTERRUPT_TYPE_BUF_OVERFLOW
#define CXD2880_TNRDMD_INTERRUPT_TYPE_BUF_ALMOST_EMPTY
#define CXD2880_TNRDMD_INTERRUPT_TYPE_BUF_ALMOST_FULL
#define CXD2880_TNRDMD_INTERRUPT_TYPE_BUF_RRDY
#define CXD2880_TNRDMD_INTERRUPT_TYPE_ILLEGAL_COMMAND
#define CXD2880_TNRDMD_INTERRUPT_TYPE_ILLEGAL_ACCESS
#define CXD2880_TNRDMD_INTERRUPT_TYPE_CPU_ERROR
#define CXD2880_TNRDMD_INTERRUPT_TYPE_LOCK
#define CXD2880_TNRDMD_INTERRUPT_TYPE_INV_LOCK
#define CXD2880_TNRDMD_INTERRUPT_TYPE_NOOFDM
#define CXD2880_TNRDMD_INTERRUPT_TYPE_EWS
#define CXD2880_TNRDMD_INTERRUPT_TYPE_EEW
#define CXD2880_TNRDMD_INTERRUPT_TYPE_FEC_FAIL

#define CXD2880_TNRDMD_INTERRUPT_LOCK_SEL_L1POST_OK
#define CXD2880_TNRDMD_INTERRUPT_LOCK_SEL_DMD_LOCK
#define CXD2880_TNRDMD_INTERRUPT_LOCK_SEL_TS_LOCK

enum cxd2880_tnrdmd_chip_id {};

#define CXD2880_TNRDMD_CHIP_ID_VALID(chip_id)

enum cxd2880_tnrdmd_state {};

enum cxd2880_tnrdmd_divermode {};

enum cxd2880_tnrdmd_clockmode {};

enum cxd2880_tnrdmd_tsout_if {};

enum cxd2880_tnrdmd_xtal_share {};

enum cxd2880_tnrdmd_spectrum_sense {};

enum cxd2880_tnrdmd_cfg_id {};

enum cxd2880_tnrdmd_lock_result {};

enum cxd2880_tnrdmd_gpio_mode {};

enum cxd2880_tnrdmd_serial_ts_clk {};

struct cxd2880_tnrdmd_cfg_mem {};

struct cxd2880_tnrdmd_pid_cfg {};

struct cxd2880_tnrdmd_pid_ftr_cfg {};

struct cxd2880_tnrdmd_lna_thrs {};

struct cxd2880_tnrdmd_lna_thrs_tbl_air {};

struct cxd2880_tnrdmd_lna_thrs_tbl_cable {};

struct cxd2880_tnrdmd_create_param {};

struct cxd2880_tnrdmd_diver_create_param {};

struct cxd2880_tnrdmd {};

int cxd2880_tnrdmd_create(struct cxd2880_tnrdmd *tnr_dmd,
			  struct cxd2880_io *io,
			  struct cxd2880_tnrdmd_create_param
			  *create_param);

int cxd2880_tnrdmd_diver_create(struct cxd2880_tnrdmd
				*tnr_dmd_main,
				struct cxd2880_io *io_main,
				struct cxd2880_tnrdmd *tnr_dmd_sub,
				struct cxd2880_io *io_sub,
				struct
				cxd2880_tnrdmd_diver_create_param
				*create_param);

int cxd2880_tnrdmd_init1(struct cxd2880_tnrdmd *tnr_dmd);

int cxd2880_tnrdmd_init2(struct cxd2880_tnrdmd *tnr_dmd);

int cxd2880_tnrdmd_check_internal_cpu_status(struct cxd2880_tnrdmd
					     *tnr_dmd,
					     u8 *task_completed);

int cxd2880_tnrdmd_common_tune_setting1(struct cxd2880_tnrdmd
					*tnr_dmd,
					enum cxd2880_dtv_sys sys,
					u32 frequency_khz,
					enum cxd2880_dtv_bandwidth
					bandwidth, u8 one_seg_opt,
					u8 one_seg_opt_shft_dir);

int cxd2880_tnrdmd_common_tune_setting2(struct cxd2880_tnrdmd
					*tnr_dmd,
					enum cxd2880_dtv_sys sys,
					u8 en_fef_intmtnt_ctrl);

int cxd2880_tnrdmd_sleep(struct cxd2880_tnrdmd *tnr_dmd);

int cxd2880_tnrdmd_set_cfg(struct cxd2880_tnrdmd *tnr_dmd,
			   enum cxd2880_tnrdmd_cfg_id id,
			   int value);

int cxd2880_tnrdmd_gpio_set_cfg(struct cxd2880_tnrdmd *tnr_dmd,
				u8 id,
				u8 en,
				enum cxd2880_tnrdmd_gpio_mode mode,
				u8 open_drain, u8 invert);

int cxd2880_tnrdmd_gpio_set_cfg_sub(struct cxd2880_tnrdmd *tnr_dmd,
				    u8 id,
				    u8 en,
				    enum cxd2880_tnrdmd_gpio_mode
				    mode, u8 open_drain,
				    u8 invert);

int cxd2880_tnrdmd_gpio_read(struct cxd2880_tnrdmd *tnr_dmd,
			     u8 id, u8 *value);

int cxd2880_tnrdmd_gpio_read_sub(struct cxd2880_tnrdmd *tnr_dmd,
				 u8 id, u8 *value);

int cxd2880_tnrdmd_gpio_write(struct cxd2880_tnrdmd *tnr_dmd,
			      u8 id, u8 value);

int cxd2880_tnrdmd_gpio_write_sub(struct cxd2880_tnrdmd *tnr_dmd,
				  u8 id, u8 value);

int cxd2880_tnrdmd_interrupt_read(struct cxd2880_tnrdmd *tnr_dmd,
				  u16 *value);

int cxd2880_tnrdmd_interrupt_clear(struct cxd2880_tnrdmd *tnr_dmd,
				   u16 value);

int cxd2880_tnrdmd_ts_buf_clear(struct cxd2880_tnrdmd *tnr_dmd,
				u8 clear_overflow_flag,
				u8 clear_underflow_flag,
				u8 clear_buf);

int cxd2880_tnrdmd_chip_id(struct cxd2880_tnrdmd *tnr_dmd,
			   enum cxd2880_tnrdmd_chip_id *chip_id);

int cxd2880_tnrdmd_set_and_save_reg_bits(struct cxd2880_tnrdmd
					 *tnr_dmd,
					 enum cxd2880_io_tgt tgt,
					 u8 bank, u8 address,
					 u8 value, u8 bit_mask);

int cxd2880_tnrdmd_set_scan_mode(struct cxd2880_tnrdmd *tnr_dmd,
				 enum cxd2880_dtv_sys sys,
				 u8 scan_mode_end);

int cxd2880_tnrdmd_set_pid_ftr(struct cxd2880_tnrdmd *tnr_dmd,
			       struct cxd2880_tnrdmd_pid_ftr_cfg
			       *pid_ftr_cfg);

int cxd2880_tnrdmd_set_rf_lvl_cmpstn(struct cxd2880_tnrdmd
				     *tnr_dmd,
				     int (*rf_lvl_cmpstn)
				     (struct cxd2880_tnrdmd *,
				     int *));

int cxd2880_tnrdmd_set_rf_lvl_cmpstn_sub(struct cxd2880_tnrdmd *tnr_dmd,
					 int (*rf_lvl_cmpstn)
					 (struct cxd2880_tnrdmd *,
					 int *));

int cxd2880_tnrdmd_set_lna_thrs(struct cxd2880_tnrdmd *tnr_dmd,
				struct
				cxd2880_tnrdmd_lna_thrs_tbl_air
				*tbl_air,
				struct
				cxd2880_tnrdmd_lna_thrs_tbl_cable
				*tbl_cable);

int cxd2880_tnrdmd_set_lna_thrs_sub(struct cxd2880_tnrdmd *tnr_dmd,
				    struct
				    cxd2880_tnrdmd_lna_thrs_tbl_air
				    *tbl_air,
				    struct
				    cxd2880_tnrdmd_lna_thrs_tbl_cable
				    *tbl_cable);

int cxd2880_tnrdmd_set_ts_pin_high_low(struct cxd2880_tnrdmd
				       *tnr_dmd, u8 en, u8 value);

int cxd2880_tnrdmd_set_ts_output(struct cxd2880_tnrdmd *tnr_dmd,
				 u8 en);

int slvt_freeze_reg(struct cxd2880_tnrdmd *tnr_dmd);

#endif