linux/drivers/media/radio/wl128x/fmdrv_common.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 *  FM Driver for Connectivity chip of Texas Instruments.
 *  FM Common module header file
 *
 *  Copyright (C) 2011 Texas Instruments
 */

#ifndef _FMDRV_COMMON_H
#define _FMDRV_COMMON_H

#define FM_ST_REG_TIMEOUT
#define FM_PKT_LOGICAL_CHAN_NUMBER

#define REG_RD
#define REG_WR

struct fm_reg_table {};

#define STEREO_GET
#define RSSI_LVL_GET
#define IF_COUNT_GET
#define FLAG_GET
#define RDS_SYNC_GET
#define RDS_DATA_GET
#define FREQ_SET
#define AF_FREQ_SET
#define MOST_MODE_SET
#define MOST_BLEND_SET
#define DEMPH_MODE_SET
#define SEARCH_LVL_SET
#define BAND_SET
#define MUTE_STATUS_SET
#define RDS_PAUSE_LVL_SET
#define RDS_PAUSE_DUR_SET
#define RDS_MEM_SET
#define RDS_BLK_B_SET
#define RDS_MSK_B_SET
#define RDS_PI_MASK_SET
#define RDS_PI_SET
#define RDS_SYSTEM_SET
#define INT_MASK_SET
#define SEARCH_DIR_SET
#define VOLUME_SET
#define AUDIO_ENABLE_SET
#define PCM_MODE_SET
#define I2S_MODE_CONFIG_SET
#define POWER_SET
#define INTX_CONFIG_SET
#define PULL_EN_SET
#define HILO_SET
#define SWITCH2FREF
#define FREQ_DRIFT_REPORT

#define PCE_GET
#define FIRM_VER_GET
#define ASIC_VER_GET
#define ASIC_ID_GET
#define MAN_ID_GET
#define TUNER_MODE_SET
#define STOP_SEARCH
#define RDS_CNTRL_SET

#define WRITE_HARDWARE_REG
#define CODE_DOWNLOAD
#define RESET

#define FM_POWER_MODE
#define FM_INTERRUPT

/* Transmitter API */

#define CHANL_SET
#define CHANL_BW_SET
#define REF_SET
#define POWER_ENB_SET
#define POWER_ATT_SET
#define POWER_LEV_SET
#define AUDIO_DEV_SET
#define PILOT_DEV_SET
#define RDS_DEV_SET
#define TX_BAND_SET
#define PUPD_SET
#define AUDIO_IO_SET
#define PREMPH_SET
#define MONO_SET
#define MUTE
#define MPX_LMT_ENABLE
#define PI_SET
#define ECC_SET
#define PTY
#define AF
#define DISPLAY_MODE
#define RDS_REP_SET
#define RDS_CONFIG_DATA_SET
#define RDS_DATA_SET
#define RDS_DATA_ENB
#define TA_SET
#define TP_SET
#define DI_SET
#define MS_SET
#define PS_SCROLL_SPEED
#define TX_AUDIO_LEVEL_TEST
#define TX_AUDIO_LEVEL_TEST_THRESHOLD
#define TX_AUDIO_INPUT_LEVEL_RANGE_SET
#define RX_ANTENNA_SELECT
#define I2C_DEV_ADDR_SET
#define REF_ERR_CALIB_PARAM_SET
#define REF_ERR_CALIB_PERIODICITY_SET
#define SOC_INT_TRIGGER
#define SOC_AUDIO_PATH_SET
#define SOC_PCMI_OVERRIDE
#define SOC_I2S_OVERRIDE
#define RSSI_BLOCK_SCAN_FREQ_SET
#define RSSI_BLOCK_SCAN_START
#define RSSI_BLOCK_SCAN_DATA_GET
#define READ_FMANT_TUNE_VALUE

/* SKB helpers */
struct fm_skb_cb {};

#define fm_cb(skb)

/* FM Channel-8 command message format */
struct fm_cmd_msg_hdr {} __attribute__ ((packed));

#define FM_CMD_MSG_HDR_SIZE

/* FM Channel-8 event messgage format */
struct fm_event_msg_hdr {} __attribute__ ((packed));

#define FM_EVT_MSG_HDR_SIZE

/* TI's magic number in firmware file */
#define FM_FW_FILE_HEADER_MAGIC

#define FM_ENABLE
#define FM_DISABLE

/* FLAG_GET register bits */
#define FM_FR_EVENT
#define FM_BL_EVENT
#define FM_RDS_EVENT
#define FM_BBLK_EVENT
#define FM_LSYNC_EVENT
#define FM_LEV_EVENT
#define FM_IFFR_EVENT
#define FM_PI_EVENT
#define FM_PD_EVENT
#define FM_STIC_EVENT
#define FM_MAL_EVENT
#define FM_POW_ENB_EVENT

/*
 * Firmware files of FM. ASIC ID and ASIC version will be appened to this,
 * later.
 */
#define FM_FMC_FW_FILE_START
#define FM_RX_FW_FILE_START
#define FM_TX_FW_FILE_START

#define FM_UNDEFINED_FREQ

/* Band types */
#define FM_BAND_EUROPE_US
#define FM_BAND_JAPAN

/* Seek directions */
#define FM_SEARCH_DIRECTION_DOWN
#define FM_SEARCH_DIRECTION_UP

/* Tunner modes */
#define FM_TUNER_STOP_SEARCH_MODE
#define FM_TUNER_PRESET_MODE
#define FM_TUNER_AUTONOMOUS_SEARCH_MODE
#define FM_TUNER_AF_JUMP_MODE

/* Min and Max volume */
#define FM_RX_VOLUME_MIN
#define FM_RX_VOLUME_MAX

/* Volume gain step */
#define FM_RX_VOLUME_GAIN_STEP

/* Mute modes */
#define FM_MUTE_ON
#define FM_MUTE_OFF
#define FM_MUTE_ATTENUATE

#define FM_RX_UNMUTE_MODE
#define FM_RX_RF_DEP_MODE
#define FM_RX_AC_MUTE_MODE
#define FM_RX_HARD_MUTE_LEFT_MODE
#define FM_RX_HARD_MUTE_RIGHT_MODE
#define FM_RX_SOFT_MUTE_FORCE_MODE

/* RF dependent mute mode */
#define FM_RX_RF_DEPENDENT_MUTE_ON
#define FM_RX_RF_DEPENDENT_MUTE_OFF

/* RSSI threshold min and max */
#define FM_RX_RSSI_THRESHOLD_MIN
#define FM_RX_RSSI_THRESHOLD_MAX

/* Stereo/Mono mode */
#define FM_STEREO_MODE
#define FM_MONO_MODE
#define FM_STEREO_SOFT_BLEND

/* FM RX De-emphasis filter modes */
#define FM_RX_EMPHASIS_FILTER_50_USEC
#define FM_RX_EMPHASIS_FILTER_75_USEC

/* FM RDS modes */
#define FM_RDS_DISABLE
#define FM_RDS_ENABLE

#define FM_NO_PI_CODE

/* FM and RX RDS block enable/disable  */
#define FM_RX_PWR_SET_FM_ON_RDS_OFF
#define FM_RX_PWR_SET_FM_AND_RDS_BLK_ON
#define FM_RX_PWR_SET_FM_AND_RDS_BLK_OFF

/* RX RDS */
#define FM_RX_RDS_FLUSH_FIFO
#define FM_RX_RDS_FIFO_THRESHOLD
#define FM_RDS_BLK_SIZE

/* RDS block types */
#define FM_RDS_BLOCK_A
#define FM_RDS_BLOCK_B
#define FM_RDS_BLOCK_C
#define FM_RDS_BLOCK_Ctag
#define FM_RDS_BLOCK_D
#define FM_RDS_BLOCK_E

#define FM_RDS_BLK_IDX_A
#define FM_RDS_BLK_IDX_B
#define FM_RDS_BLK_IDX_C
#define FM_RDS_BLK_IDX_D
#define FM_RDS_BLK_IDX_UNKNOWN

#define FM_RDS_STATUS_ERR_MASK

/*
 * Represents an RDS group type & version.
 * There are 15 groups, each group has 2 versions: A and B.
 */
#define FM_RDS_GROUP_TYPE_MASK_0A
#define FM_RDS_GROUP_TYPE_MASK_0B
#define FM_RDS_GROUP_TYPE_MASK_1A
#define FM_RDS_GROUP_TYPE_MASK_1B
#define FM_RDS_GROUP_TYPE_MASK_2A
#define FM_RDS_GROUP_TYPE_MASK_2B
#define FM_RDS_GROUP_TYPE_MASK_3A
#define FM_RDS_GROUP_TYPE_MASK_3B
#define FM_RDS_GROUP_TYPE_MASK_4A
#define FM_RDS_GROUP_TYPE_MASK_4B
#define FM_RDS_GROUP_TYPE_MASK_5A
#define FM_RDS_GROUP_TYPE_MASK_5B
#define FM_RDS_GROUP_TYPE_MASK_6A
#define FM_RDS_GROUP_TYPE_MASK_6B
#define FM_RDS_GROUP_TYPE_MASK_7A
#define FM_RDS_GROUP_TYPE_MASK_7B
#define FM_RDS_GROUP_TYPE_MASK_8A
#define FM_RDS_GROUP_TYPE_MASK_8B
#define FM_RDS_GROUP_TYPE_MASK_9A
#define FM_RDS_GROUP_TYPE_MASK_9B
#define FM_RDS_GROUP_TYPE_MASK_10A
#define FM_RDS_GROUP_TYPE_MASK_10B
#define FM_RDS_GROUP_TYPE_MASK_11A
#define FM_RDS_GROUP_TYPE_MASK_11B
#define FM_RDS_GROUP_TYPE_MASK_12A
#define FM_RDS_GROUP_TYPE_MASK_12B
#define FM_RDS_GROUP_TYPE_MASK_13A
#define FM_RDS_GROUP_TYPE_MASK_13B
#define FM_RDS_GROUP_TYPE_MASK_14A
#define FM_RDS_GROUP_TYPE_MASK_14B
#define FM_RDS_GROUP_TYPE_MASK_15A
#define FM_RDS_GROUP_TYPE_MASK_15B

/* RX Alternate Frequency info */
#define FM_RDS_MIN_AF
#define FM_RDS_MAX_AF
#define FM_RDS_MAX_AF_JAPAN
#define FM_RDS_1_AF_FOLLOWS
#define FM_RDS_25_AF_FOLLOWS

/* RDS system type (RDS/RBDS) */
#define FM_RDS_SYSTEM_RDS
#define FM_RDS_SYSTEM_RBDS

/* AF on/off */
#define FM_RX_RDS_AF_SWITCH_MODE_ON
#define FM_RX_RDS_AF_SWITCH_MODE_OFF

/* Retry count when interrupt process goes wrong */
#define FM_IRQ_TIMEOUT_RETRY_MAX

/* Audio IO set values */
#define FM_RX_AUDIO_ENABLE_I2S
#define FM_RX_AUDIO_ENABLE_ANALOG
#define FM_RX_AUDIO_ENABLE_I2S_AND_ANALOG
#define FM_RX_AUDIO_ENABLE_DISABLE

/* HI/LO set values */
#define FM_RX_IFFREQ_TO_HI_SIDE
#define FM_RX_IFFREQ_TO_LO_SIDE
#define FM_RX_IFFREQ_HILO_AUTOMATIC

/*
 * Default RX mode configuration. Chip will be configured
 * with this default values after loading RX firmware.
 */
#define FM_DEFAULT_RX_VOLUME
#define FM_DEFAULT_RSSI_THRESHOLD

/* Range for TX power level in units for dB/uV */
#define FM_PWR_LVL_LOW
#define FM_PWR_LVL_HIGH

/* Chip specific default TX power level value */
#define FM_PWR_LVL_DEF

/* FM TX Pre-emphasis filter values */
#define FM_TX_PREEMPH_OFF
#define FM_TX_PREEMPH_50US
#define FM_TX_PREEMPH_75US

/* FM TX antenna impedance values */
#define FM_TX_ANT_IMP_50
#define FM_TX_ANT_IMP_200
#define FM_TX_ANT_IMP_500

/* Functions exported by FM common sub-module */
int fmc_prepare(struct fmdev *);
int fmc_release(struct fmdev *);

void fmc_update_region_info(struct fmdev *, u8);
int fmc_send_cmd(struct fmdev *, u8, u16,
				void *, unsigned int, void *, int *);
int fmc_is_rds_data_available(struct fmdev *, struct file *,
				struct poll_table_struct *);
int fmc_transfer_rds_from_internal_buff(struct fmdev *, struct file *,
					u8 __user *, size_t);

int fmc_set_freq(struct fmdev *, u32);
int fmc_set_mode(struct fmdev *, u8);
int fmc_set_region(struct fmdev *, u8);
int fmc_set_mute_mode(struct fmdev *, u8);
int fmc_set_stereo_mono(struct fmdev *, u16);
int fmc_set_rds_mode(struct fmdev *, u8);

int fmc_get_freq(struct fmdev *, u32 *);
int fmc_get_region(struct fmdev *, u8 *);
int fmc_get_mode(struct fmdev *, u8 *);

/*
 * channel spacing
 */
#define FM_CHANNEL_SPACING_50KHZ
#define FM_CHANNEL_SPACING_100KHZ
#define FM_CHANNEL_SPACING_200KHZ
#define FM_FREQ_MUL

#endif