linux/drivers/media/tuners/xc5000.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *  Driver for Xceive XC5000 "QAM/8VSB single chip tuner"
 *
 *  Copyright (c) 2007 Xceive Corporation
 *  Copyright (c) 2007 Steven Toth <[email protected]>
 *  Copyright (c) 2009 Devin Heitmueller <[email protected]>
 */

#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/videodev2.h>
#include <linux/delay.h>
#include <linux/workqueue.h>
#include <linux/dvb/frontend.h>
#include <linux/i2c.h>

#include <media/dvb_frontend.h>

#include "xc5000.h"
#include "tuner-i2c.h"

static int debug;
module_param(debug, int, 0644);
MODULE_PARM_DESC();

static int no_poweroff;
module_param(no_poweroff, int, 0644);
MODULE_PARM_DESC();

static DEFINE_MUTEX(xc5000_list_mutex);
static LIST_HEAD(hybrid_tuner_instance_list);

#define dprintk(level, fmt, arg...)

struct xc5000_priv {};

/* Misc Defines */
#define MAX_TV_STANDARD
#define XC_MAX_I2C_WRITE_LENGTH

/* Time to suspend after the .sleep callback is called */
#define XC5000_SLEEP_TIME

/* Signal Types */
#define XC_RF_MODE_AIR
#define XC_RF_MODE_CABLE

/* Product id */
#define XC_PRODUCT_ID_FW_NOT_LOADED
#define XC_PRODUCT_ID_FW_LOADED

/* Registers */
#define XREG_INIT
#define XREG_VIDEO_MODE
#define XREG_AUDIO_MODE
#define XREG_RF_FREQ
#define XREG_D_CODE
#define XREG_IF_OUT
#define XREG_SEEK_MODE
#define XREG_POWER_DOWN
/* Set the output amplitude - SIF for analog, DTVP/DTVN for digital */
#define XREG_OUTPUT_AMP
#define XREG_SIGNALSOURCE
#define XREG_SMOOTHEDCVBS
#define XREG_XTALFREQ
#define XREG_FINERFREQ
#define XREG_DDIMODE

#define XREG_ADC_ENV
#define XREG_QUALITY
#define XREG_FRAME_LINES
#define XREG_HSYNC_FREQ
#define XREG_LOCK
#define XREG_FREQ_ERROR
#define XREG_SNR
#define XREG_VERSION
#define XREG_PRODUCT_ID
#define XREG_BUSY
#define XREG_BUILD
#define XREG_TOTALGAIN
#define XREG_FW_CHECKSUM
#define XREG_INIT_STATUS

/*
   Basic firmware description. This will remain with
   the driver for documentation purposes.

   This represents an I2C firmware file encoded as a
   string of unsigned char. Format is as follows:

   char[0  ]=len0_MSB  -> len = len_MSB * 256 + len_LSB
   char[1  ]=len0_LSB  -> length of first write transaction
   char[2  ]=data0 -> first byte to be sent
   char[3  ]=data1
   char[4  ]=data2
   char[   ]=...
   char[M  ]=dataN  -> last byte to be sent
   char[M+1]=len1_MSB  -> len = len_MSB * 256 + len_LSB
   char[M+2]=len1_LSB  -> length of second write transaction
   char[M+3]=data0
   char[M+4]=data1
   ...
   etc.

   The [len] value should be interpreted as follows:

   len= len_MSB _ len_LSB
   len=1111_1111_1111_1111   : End of I2C_SEQUENCE
   len=0000_0000_0000_0000   : Reset command: Do hardware reset
   len=0NNN_NNNN_NNNN_NNNN   : Normal transaction: number of bytes = {1:32767)
   len=1WWW_WWWW_WWWW_WWWW   : Wait command: wait for {1:32767} ms

   For the RESET and WAIT commands, the two following bytes will contain
   immediately the length of the following transaction.

*/
struct XC_TV_STANDARD {};

/* Tuner standards */
#define MN_NTSC_PAL_BTSC
#define MN_NTSC_PAL_A2
#define MN_NTSC_PAL_EIAJ
#define MN_NTSC_PAL_MONO
#define BG_PAL_A2
#define BG_PAL_NICAM
#define BG_PAL_MONO
#define I_PAL_NICAM
#define I_PAL_NICAM_MONO
#define DK_PAL_A2
#define DK_PAL_NICAM
#define DK_PAL_MONO
#define DK_SECAM_A2DK1
#define DK_SECAM_A2LDK3
#define DK_SECAM_A2MONO
#define L_SECAM_NICAM
#define LC_SECAM_NICAM
#define DTV6
#define DTV8
#define DTV7_8
#define DTV7
#define FM_RADIO_INPUT2
#define FM_RADIO_INPUT1
#define FM_RADIO_INPUT1_MONO

static struct XC_TV_STANDARD xc5000_standard[MAX_TV_STANDARD] =;


struct xc5000_fw_cfg {};

#define XC5000A_FIRMWARE
static const struct xc5000_fw_cfg xc5000a_1_6_114 =;

#define XC5000C_FIRMWARE
static const struct xc5000_fw_cfg xc5000c_41_024_5 =;

static inline const struct xc5000_fw_cfg *xc5000_assign_firmware(int chip_id)
{}

static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe, int force);
static int xc5000_is_firmware_loaded(struct dvb_frontend *fe);
static int xc5000_readreg(struct xc5000_priv *priv, u16 reg, u16 *val);
static int xc5000_tuner_reset(struct dvb_frontend *fe);

static int xc_send_i2c_data(struct xc5000_priv *priv, u8 *buf, int len)
{}

#if 0
/* This routine is never used because the only time we read data from the
   i2c bus is when we read registers, and we want that to be an atomic i2c
   transaction in case we are on a multi-master bus */
static int xc_read_i2c_data(struct xc5000_priv *priv, u8 *buf, int len)
{
	struct i2c_msg msg = { .addr = priv->i2c_props.addr,
		.flags = I2C_M_RD, .buf = buf, .len = len };

	if (i2c_transfer(priv->i2c_props.adap, &msg, 1) != 1) {
		printk(KERN_ERR "xc5000 I2C read failed (len=%i)\n", len);
		return -EREMOTEIO;
	}
	return 0;
}
#endif

static int xc5000_readreg(struct xc5000_priv *priv, u16 reg, u16 *val)
{}

static int xc5000_tuner_reset(struct dvb_frontend *fe)
{}

static int xc_write_reg(struct xc5000_priv *priv, u16 reg_addr, u16 i2c_data)
{}

static int xc_load_i2c_sequence(struct dvb_frontend *fe, const u8 *i2c_sequence)
{}

static int xc_initialize(struct xc5000_priv *priv)
{}

static int xc_set_tv_standard(struct xc5000_priv *priv,
	u16 video_mode, u16 audio_mode, u8 radio_mode)
{}

static int xc_set_signal_source(struct xc5000_priv *priv, u16 rf_mode)
{}

static const struct dvb_tuner_ops xc5000_tuner_ops;

static int xc_set_rf_frequency(struct xc5000_priv *priv, u32 freq_hz)
{}


static int xc_set_IF_frequency(struct xc5000_priv *priv, u32 freq_khz)
{}


static int xc_get_adc_envelope(struct xc5000_priv *priv, u16 *adc_envelope)
{}

static int xc_get_frequency_error(struct xc5000_priv *priv, u32 *freq_error_hz)
{}

static int xc_get_lock_status(struct xc5000_priv *priv, u16 *lock_status)
{}

static int xc_get_version(struct xc5000_priv *priv,
	u8 *hw_majorversion, u8 *hw_minorversion,
	u8 *fw_majorversion, u8 *fw_minorversion)
{}

static int xc_get_buildversion(struct xc5000_priv *priv, u16 *buildrev)
{}

static int xc_get_hsync_freq(struct xc5000_priv *priv, u32 *hsync_freq_hz)
{}

static int xc_get_frame_lines(struct xc5000_priv *priv, u16 *frame_lines)
{}

static int xc_get_quality(struct xc5000_priv *priv, u16 *quality)
{}

static int xc_get_analogsnr(struct xc5000_priv *priv, u16 *snr)
{}

static int xc_get_totalgain(struct xc5000_priv *priv, u16 *totalgain)
{}

#define XC_TUNE_ANALOG
#define XC_TUNE_DIGITAL
static int xc_tune_channel(struct xc5000_priv *priv, u32 freq_hz, int mode)
{}

static int xc_set_xtal(struct dvb_frontend *fe)
{}

static int xc5000_fwupload(struct dvb_frontend *fe,
			   const struct xc5000_fw_cfg *desired_fw,
			   const struct firmware *fw)
{}

static void xc_debug_dump(struct xc5000_priv *priv)
{}

static int xc5000_tune_digital(struct dvb_frontend *fe)
{}

static int xc5000_set_digital_params(struct dvb_frontend *fe)
{}

static int xc5000_is_firmware_loaded(struct dvb_frontend *fe)
{}

static void xc5000_config_tv(struct dvb_frontend *fe,
			     struct analog_parameters *params)
{}

static int xc5000_set_tv_freq(struct dvb_frontend *fe)
{}

static int xc5000_config_radio(struct dvb_frontend *fe,
			       struct analog_parameters *params)

{}

static int xc5000_set_radio_freq(struct dvb_frontend *fe)
{}

static int xc5000_set_params(struct dvb_frontend *fe)
{}

static int xc5000_set_analog_params(struct dvb_frontend *fe,
			     struct analog_parameters *params)
{}

static int xc5000_get_frequency(struct dvb_frontend *fe, u32 *freq)
{}

static int xc5000_get_if_frequency(struct dvb_frontend *fe, u32 *freq)
{}

static int xc5000_get_bandwidth(struct dvb_frontend *fe, u32 *bw)
{}

static int xc5000_get_status(struct dvb_frontend *fe, u32 *status)
{}

static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe, int force)
{}

static void xc5000_do_timer_sleep(struct work_struct *timer_sleep)
{}

static int xc5000_sleep(struct dvb_frontend *fe)
{}

static int xc5000_suspend(struct dvb_frontend *fe)
{}

static int xc5000_resume(struct dvb_frontend *fe)
{}

static int xc5000_init(struct dvb_frontend *fe)
{}

static void xc5000_release(struct dvb_frontend *fe)
{}

static int xc5000_set_config(struct dvb_frontend *fe, void *priv_cfg)
{}


static const struct dvb_tuner_ops xc5000_tuner_ops =;

struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe,
				   struct i2c_adapter *i2c,
				   const struct xc5000_config *cfg)
{}
EXPORT_SYMBOL_GPL();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();