#define pr_fmt(fmt) …
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include <linux/mutex.h>
#include <asm/div64.h>
#include <linux/int_log.h>
#include <media/dvb_frontend.h>
#include "dib8000.h"
#define LAYER_ALL …
#define LAYER_A …
#define LAYER_B …
#define LAYER_C …
#define MAX_NUMBER_OF_FRONTENDS …
static int debug;
module_param(debug, int, 0644);
MODULE_PARM_DESC(…) …;
#define dprintk(fmt, arg...) …
struct i2c_device { … };
enum param_loop_step { … };
enum dib8000_autosearch_step { … };
enum timeout_mode { … };
struct dib8000_state { … };
enum dib8000_power_mode { … };
static u16 dib8000_i2c_read16(struct i2c_device *i2c, u16 reg)
{ … }
static u16 __dib8000_read_word(struct dib8000_state *state, u16 reg)
{ … }
static u16 dib8000_read_word(struct dib8000_state *state, u16 reg)
{ … }
static u32 dib8000_read32(struct dib8000_state *state, u16 reg)
{ … }
static int dib8000_i2c_write16(struct i2c_device *i2c, u16 reg, u16 val)
{ … }
static int dib8000_write_word(struct dib8000_state *state, u16 reg, u16 val)
{ … }
static const s16 coeff_2k_sb_1seg_dqpsk[8] = …;
static const s16 coeff_2k_sb_1seg[8] = …;
static const s16 coeff_2k_sb_3seg_0dqpsk_1dqpsk[8] = …;
static const s16 coeff_2k_sb_3seg_0dqpsk[8] = …;
static const s16 coeff_2k_sb_3seg_1dqpsk[8] = …;
static const s16 coeff_2k_sb_3seg[8] = …;
static const s16 coeff_4k_sb_1seg_dqpsk[8] = …;
static const s16 coeff_4k_sb_1seg[8] = …;
static const s16 coeff_4k_sb_3seg_0dqpsk_1dqpsk[8] = …;
static const s16 coeff_4k_sb_3seg_0dqpsk[8] = …;
static const s16 coeff_4k_sb_3seg_1dqpsk[8] = …;
static const s16 coeff_4k_sb_3seg[8] = …;
static const s16 coeff_8k_sb_1seg_dqpsk[8] = …;
static const s16 coeff_8k_sb_1seg[8] = …;
static const s16 coeff_8k_sb_3seg_0dqpsk_1dqpsk[8] = …;
static const s16 coeff_8k_sb_3seg_0dqpsk[8] = …;
static const s16 coeff_8k_sb_3seg_1dqpsk[8] = …;
static const s16 coeff_8k_sb_3seg[8] = …;
static const s16 ana_fe_coeff_3seg[24] = …;
static const s16 ana_fe_coeff_1seg[24] = …;
static const s16 ana_fe_coeff_13seg[24] = …;
static u16 fft_to_mode(struct dib8000_state *state)
{ … }
static void dib8000_set_acquisition_mode(struct dib8000_state *state)
{ … }
static int dib8000_set_output_mode(struct dvb_frontend *fe, int mode)
{ … }
static int dib8000_set_diversity_in(struct dvb_frontend *fe, int onoff)
{ … }
static void dib8000_set_power_mode(struct dib8000_state *state, enum dib8000_power_mode mode)
{ … }
static int dib8000_set_adc_state(struct dib8000_state *state, enum dibx000_adc_states no)
{ … }
static int dib8000_set_bandwidth(struct dvb_frontend *fe, u32 bw)
{ … }
static int dib8000_sad_calib(struct dib8000_state *state)
{ … }
static int dib8000_set_wbd_ref(struct dvb_frontend *fe, u16 value)
{ … }
static void dib8000_reset_pll_common(struct dib8000_state *state, const struct dibx000_bandwidth_config *bw)
{ … }
static void dib8000_reset_pll(struct dib8000_state *state)
{ … }
static int dib8000_update_pll(struct dvb_frontend *fe,
struct dibx000_bandwidth_config *pll, u32 bw, u8 ratio)
{ … }
static int dib8000_reset_gpio(struct dib8000_state *st)
{ … }
static int dib8000_cfg_gpio(struct dib8000_state *st, u8 num, u8 dir, u8 val)
{ … }
static int dib8000_set_gpio(struct dvb_frontend *fe, u8 num, u8 dir, u8 val)
{ … }
static const u16 dib8000_defaults[] = …;
static u16 dib8000_identify(struct i2c_device *client)
{ … }
static int dib8000_read_unc_blocks(struct dvb_frontend *fe, u32 *unc);
static void dib8000_reset_stats(struct dvb_frontend *fe)
{ … }
static int dib8000_reset(struct dvb_frontend *fe)
{ … }
static void dib8000_restart_agc(struct dib8000_state *state)
{ … }
static int dib8000_update_lna(struct dib8000_state *state)
{ … }
static int dib8000_set_agc_config(struct dib8000_state *state, u8 band)
{ … }
static void dib8000_pwm_agc_reset(struct dvb_frontend *fe)
{ … }
static int dib8000_agc_soft_split(struct dib8000_state *state)
{ … }
static int dib8000_agc_startup(struct dvb_frontend *fe)
{ … }
static void dib8096p_host_bus_drive(struct dib8000_state *state, u8 drive)
{ … }
static u32 dib8096p_calcSyncFreq(u32 P_Kin, u32 P_Kout,
u32 insertExtSynchro, u32 syncSize)
{ … }
static void dib8096p_cfg_DibTx(struct dib8000_state *state, u32 P_Kin,
u32 P_Kout, u32 insertExtSynchro, u32 synchroMode,
u32 syncWord, u32 syncSize)
{ … }
static void dib8096p_cfg_DibRx(struct dib8000_state *state, u32 P_Kin,
u32 P_Kout, u32 synchroMode, u32 insertExtSynchro,
u32 syncWord, u32 syncSize, u32 dataOutRate)
{ … }
static void dib8096p_enMpegMux(struct dib8000_state *state, int onoff)
{ … }
static void dib8096p_configMpegMux(struct dib8000_state *state,
u16 pulseWidth, u16 enSerialMode, u16 enSerialClkDiv2)
{ … }
static void dib8096p_setDibTxMux(struct dib8000_state *state, int mode)
{ … }
static void dib8096p_setHostBusMux(struct dib8000_state *state, int mode)
{ … }
static int dib8096p_set_diversity_in(struct dvb_frontend *fe, int onoff)
{ … }
static int dib8096p_set_output_mode(struct dvb_frontend *fe, int mode)
{ … }
static int map_addr_to_serpar_number(struct i2c_msg *msg)
{ … }
static int dib8096p_tuner_write_serpar(struct i2c_adapter *i2c_adap,
struct i2c_msg msg[], int num)
{ … }
static int dib8096p_tuner_read_serpar(struct i2c_adapter *i2c_adap,
struct i2c_msg msg[], int num)
{ … }
static int dib8096p_tuner_rw_serpar(struct i2c_adapter *i2c_adap,
struct i2c_msg msg[], int num)
{ … }
static int dib8096p_rw_on_apb(struct i2c_adapter *i2c_adap,
struct i2c_msg msg[], int num, u16 apb_address)
{ … }
static int dib8096p_tuner_xfer(struct i2c_adapter *i2c_adap,
struct i2c_msg msg[], int num)
{ … }
static u32 dib8096p_i2c_func(struct i2c_adapter *adapter)
{ … }
static const struct i2c_algorithm dib8096p_tuner_xfer_algo = …;
static struct i2c_adapter *dib8096p_get_i2c_tuner(struct dvb_frontend *fe)
{ … }
static int dib8096p_tuner_sleep(struct dvb_frontend *fe, int onoff)
{ … }
static const s32 lut_1000ln_mant[] = …;
static s32 dib8000_get_adc_power(struct dvb_frontend *fe, u8 mode)
{ … }
static int dib8090p_get_dc_power(struct dvb_frontend *fe, u8 IQ)
{ … }
static void dib8000_update_timf(struct dib8000_state *state)
{ … }
static u32 dib8000_ctrl_timf(struct dvb_frontend *fe, uint8_t op, uint32_t timf)
{ … }
static const u16 adc_target_16dB[11] = …;
static const u8 permu_seg[] = …;
static u16 dib8000_set_layer(struct dib8000_state *state, u8 layer_index, u16 max_constellation)
{ … }
static const u16 adp_Q64[4] = …;
static const u16 adp_Q16[4] = …;
static const u16 adp_Qdefault[4] = …;
static u16 dib8000_adp_fine_tune(struct dib8000_state *state, u16 max_constellation)
{ … }
static void dib8000_update_ana_gain(struct dib8000_state *state, u16 ana_gain)
{ … }
static void dib8000_load_ana_fe_coefs(struct dib8000_state *state, const s16 *ana_fe)
{ … }
static const u16 lut_prbs_2k[13] = …;
static const u16 lut_prbs_4k[13] = …;
static const u16 lut_prbs_8k[13] = …;
static u16 dib8000_get_init_prbs(struct dib8000_state *state, u16 subchannel)
{ … }
static void dib8000_set_13seg_channel(struct dib8000_state *state)
{ … }
static void dib8000_set_subchannel_prbs(struct dib8000_state *state, u16 init_prbs)
{ … }
static void dib8000_small_fine_tune(struct dib8000_state *state)
{ … }
static const u16 coff_thres_1seg[3] = …;
static const u16 coff_thres_3seg[3] = …;
static void dib8000_set_sb_channel(struct dib8000_state *state)
{ … }
static void dib8000_set_isdbt_common_channel(struct dib8000_state *state, u8 seq, u8 autosearching)
{ … }
static u32 dib8000_wait_lock(struct dib8000_state *state, u32 internal,
u32 wait0_ms, u32 wait1_ms, u32 wait2_ms)
{ … }
static int dib8000_autosearch_start(struct dvb_frontend *fe)
{ … }
static int dib8000_autosearch_irq(struct dvb_frontend *fe)
{ … }
static void dib8000_viterbi_state(struct dib8000_state *state, u8 onoff)
{ … }
static void dib8000_set_dds(struct dib8000_state *state, s32 offset_khz)
{ … }
static void dib8000_set_frequency_offset(struct dib8000_state *state)
{ … }
static u16 LUT_isdbt_symbol_duration[4] = …;
static u32 dib8000_get_symbol_duration(struct dib8000_state *state)
{ … }
static void dib8000_set_isdbt_loop_params(struct dib8000_state *state, enum param_loop_step loop_step)
{ … }
static void dib8000_demod_restart(struct dib8000_state *state)
{ … }
static void dib8000_set_sync_wait(struct dib8000_state *state)
{ … }
static unsigned long dib8000_get_timeout(struct dib8000_state *state, u32 delay, enum timeout_mode mode)
{ … }
static s32 dib8000_get_status(struct dvb_frontend *fe)
{ … }
static enum frontend_tune_state dib8000_get_tune_state(struct dvb_frontend *fe)
{ … }
static int dib8000_set_tune_state(struct dvb_frontend *fe, enum frontend_tune_state tune_state)
{ … }
static int dib8000_tune_restart_from_demod(struct dvb_frontend *fe)
{ … }
static u16 dib8000_read_lock(struct dvb_frontend *fe)
{ … }
static int dib8090p_init_sdram(struct dib8000_state *state)
{ … }
static int is_manual_mode(struct dtv_frontend_properties *c)
{ … }
static int dib8000_tune(struct dvb_frontend *fe)
{ … }
static int dib8000_wakeup(struct dvb_frontend *fe)
{ … }
static int dib8000_sleep(struct dvb_frontend *fe)
{ … }
static int dib8000_read_status(struct dvb_frontend *fe, enum fe_status *stat);
static int dib8000_get_frontend(struct dvb_frontend *fe,
struct dtv_frontend_properties *c)
{ … }
static int dib8000_set_frontend(struct dvb_frontend *fe)
{ … }
static int dib8000_get_stats(struct dvb_frontend *fe, enum fe_status stat);
static int dib8000_read_status(struct dvb_frontend *fe, enum fe_status *stat)
{ … }
static int dib8000_read_ber(struct dvb_frontend *fe, u32 * ber)
{ … }
static int dib8000_read_unc_blocks(struct dvb_frontend *fe, u32 * unc)
{ … }
static int dib8000_read_signal_strength(struct dvb_frontend *fe, u16 * strength)
{ … }
static u32 dib8000_get_snr(struct dvb_frontend *fe)
{ … }
static int dib8000_read_snr(struct dvb_frontend *fe, u16 * snr)
{ … }
struct per_layer_regs { … };
static const struct per_layer_regs per_layer_regs[] = …;
struct linear_segments { … };
static struct linear_segments strength_to_db_table[] = …;
static u32 interpolate_value(u32 value, struct linear_segments *segments,
unsigned len)
{ … }
static u32 dib8000_get_time_us(struct dvb_frontend *fe, int layer)
{ … }
static int dib8000_get_stats(struct dvb_frontend *fe, enum fe_status stat)
{ … }
static int dib8000_set_slave_frontend(struct dvb_frontend *fe, struct dvb_frontend *fe_slave)
{ … }
static struct dvb_frontend *dib8000_get_slave_frontend(struct dvb_frontend *fe, int slave_index)
{ … }
static int dib8000_i2c_enumeration(struct i2c_adapter *host, int no_of_demods,
u8 default_addr, u8 first_addr, u8 is_dib8096p)
{ … }
static int dib8000_fe_get_tune_settings(struct dvb_frontend *fe, struct dvb_frontend_tune_settings *tune)
{ … }
static void dib8000_release(struct dvb_frontend *fe)
{ … }
static struct i2c_adapter *dib8000_get_i2c_master(struct dvb_frontend *fe, enum dibx000_i2c_interface intf, int gating)
{ … }
static int dib8000_pid_filter_ctrl(struct dvb_frontend *fe, u8 onoff)
{ … }
static int dib8000_pid_filter(struct dvb_frontend *fe, u8 id, u16 pid, u8 onoff)
{ … }
static const struct dvb_frontend_ops dib8000_ops = …;
static struct dvb_frontend *dib8000_init(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib8000_config *cfg)
{ … }
void *dib8000_attach(struct dib8000_ops *ops)
{ … }
EXPORT_SYMBOL_GPL(…);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;