linux/drivers/media/tuners/xc4000.c

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

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

#include <media/dvb_frontend.h>

#include "xc4000.h"
#include "tuner-i2c.h"
#include "xc2028-types.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 int audio_std;
module_param(audio_std, int, 0644);
MODULE_PARM_DESC();

static char firmware_name[30];
module_param_string();
MODULE_PARM_DESC();

static DEFINE_MUTEX(xc4000_list_mutex);
static LIST_HEAD(hybrid_tuner_instance_list);

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

/* struct for storing firmware table */
struct firmware_description {};

struct firmware_properties {};

struct xc4000_priv {};

#define XC4000_AUDIO_STD_B
#define XC4000_AUDIO_STD_A2
#define XC4000_AUDIO_STD_K3
#define XC4000_AUDIO_STD_L
#define XC4000_AUDIO_STD_INPUT1
#define XC4000_AUDIO_STD_MONO

#define XC4000_DEFAULT_FIRMWARE
#define XC4000_DEFAULT_FIRMWARE_NEW

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

/* 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_XC4000
#define XC_PRODUCT_ID_XC4100

/* Registers (Write-only) */
#define XREG_INIT
#define XREG_VIDEO_MODE
#define XREG_AUDIO_MODE
#define XREG_RF_FREQ
#define XREG_D_CODE
#define XREG_DIRECTSITTING_MODE
#define XREG_SEEK_MODE
#define XREG_POWER_DOWN
#define XREG_SIGNALSOURCE
#define XREG_SMOOTHEDCVBS
#define XREG_AMPLITUDE

/* Registers (Read-only) */
#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_SIGNAL_LEVEL
#define XREG_NOISE_LEVEL

/*
   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 XC4000_MN_NTSC_PAL_BTSC
#define XC4000_MN_NTSC_PAL_A2
#define XC4000_MN_NTSC_PAL_EIAJ
#define XC4000_MN_NTSC_PAL_Mono
#define XC4000_BG_PAL_A2
#define XC4000_BG_PAL_NICAM
#define XC4000_BG_PAL_MONO
#define XC4000_I_PAL_NICAM
#define XC4000_I_PAL_NICAM_MONO
#define XC4000_DK_PAL_A2
#define XC4000_DK_PAL_NICAM
#define XC4000_DK_PAL_MONO
#define XC4000_DK_SECAM_A2DK1
#define XC4000_DK_SECAM_A2LDK3
#define XC4000_DK_SECAM_A2MONO
#define XC4000_DK_SECAM_NICAM
#define XC4000_L_SECAM_NICAM
#define XC4000_LC_SECAM_NICAM
#define XC4000_DTV6
#define XC4000_DTV8
#define XC4000_DTV7_8
#define XC4000_DTV7
#define XC4000_FM_Radio_INPUT2
#define XC4000_FM_Radio_INPUT1

static struct XC_TV_STANDARD xc4000_standard[MAX_TV_STANDARD] =;

static int xc4000_readreg(struct xc4000_priv *priv, u16 reg, u16 *val);
static int xc4000_tuner_reset(struct dvb_frontend *fe);
static void xc_debug_dump(struct xc4000_priv *priv);

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

static int xc4000_tuner_reset(struct dvb_frontend *fe)
{}

static int xc_write_reg(struct xc4000_priv *priv, u16 regAddr, u16 i2cData)
{}

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

static int xc_set_tv_standard(struct xc4000_priv *priv,
	u16 video_mode, u16 audio_mode)
{}

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

static const struct dvb_tuner_ops xc4000_tuner_ops;

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

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

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

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

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

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

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

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

static int xc_get_signal_level(struct xc4000_priv *priv, u16 *signal)
{}

static int xc_get_noise_level(struct xc4000_priv *priv, u16 *noise)
{}

static u16 xc_wait_for_lock(struct xc4000_priv *priv)
{}

static int xc_tune_channel(struct xc4000_priv *priv, u32 freq_hz)
{}

static int xc4000_readreg(struct xc4000_priv *priv, u16 reg, u16 *val)
{}

#define dump_firm_type(t)
static void dump_firm_type_and_int_freq(unsigned int type, u16 int_freq)
{}

static int seek_firmware(struct dvb_frontend *fe, unsigned int type,
			 v4l2_std_id *id)
{}

static int load_firmware(struct dvb_frontend *fe, unsigned int type,
			 v4l2_std_id *id)
{}

static int xc4000_fwupload(struct dvb_frontend *fe)
{}

static int load_scode(struct dvb_frontend *fe, unsigned int type,
			 v4l2_std_id *id, __u16 int_freq, int scode)
{}

static int check_firmware(struct dvb_frontend *fe, unsigned int type,
			  v4l2_std_id std, __u16 int_freq)
{}

static void xc_debug_dump(struct xc4000_priv *priv)
{}

static int xc4000_set_params(struct dvb_frontend *fe)
{}

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

static int xc4000_get_signal(struct dvb_frontend *fe, u16 *strength)
{}

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

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

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

static int xc4000_sleep(struct dvb_frontend *fe)
{}

static int xc4000_init(struct dvb_frontend *fe)
{}

static void xc4000_release(struct dvb_frontend *fe)
{}

static const struct dvb_tuner_ops xc4000_tuner_ops =;

struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe,
				   struct i2c_adapter *i2c,
				   struct xc4000_config *cfg)
{}
EXPORT_SYMBOL_GPL();

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