162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci Mantis VP-1041 driver 462306a36Sopenharmony_ci 562306a36Sopenharmony_ci Copyright (C) Manu Abraham (abraham.manu@gmail.com) 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci*/ 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#include <linux/signal.h> 1062306a36Sopenharmony_ci#include <linux/sched.h> 1162306a36Sopenharmony_ci#include <linux/interrupt.h> 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ci#include <media/dmxdev.h> 1462306a36Sopenharmony_ci#include <media/dvbdev.h> 1562306a36Sopenharmony_ci#include <media/dvb_demux.h> 1662306a36Sopenharmony_ci#include <media/dvb_frontend.h> 1762306a36Sopenharmony_ci#include <media/dvb_net.h> 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ci#include "mantis_common.h" 2062306a36Sopenharmony_ci#include "mantis_ioc.h" 2162306a36Sopenharmony_ci#include "mantis_dvb.h" 2262306a36Sopenharmony_ci#include "mantis_vp1041.h" 2362306a36Sopenharmony_ci#include "stb0899_reg.h" 2462306a36Sopenharmony_ci#include "stb0899_drv.h" 2562306a36Sopenharmony_ci#include "stb0899_cfg.h" 2662306a36Sopenharmony_ci#include "stb6100_cfg.h" 2762306a36Sopenharmony_ci#include "stb6100.h" 2862306a36Sopenharmony_ci#include "lnbp21.h" 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_ci#define MANTIS_MODEL_NAME "VP-1041" 3162306a36Sopenharmony_ci#define MANTIS_DEV_TYPE "DSS/DVB-S/DVB-S2" 3262306a36Sopenharmony_ci 3362306a36Sopenharmony_cistatic const struct stb0899_s1_reg vp1041_stb0899_s1_init_1[] = { 3462306a36Sopenharmony_ci 3562306a36Sopenharmony_ci /* 0x0000000b, *//* SYSREG */ 3662306a36Sopenharmony_ci { STB0899_DEV_ID , 0x30 }, 3762306a36Sopenharmony_ci { STB0899_DISCNTRL1 , 0x32 }, 3862306a36Sopenharmony_ci { STB0899_DISCNTRL2 , 0x80 }, 3962306a36Sopenharmony_ci { STB0899_DISRX_ST0 , 0x04 }, 4062306a36Sopenharmony_ci { STB0899_DISRX_ST1 , 0x00 }, 4162306a36Sopenharmony_ci { STB0899_DISPARITY , 0x00 }, 4262306a36Sopenharmony_ci { STB0899_DISSTATUS , 0x20 }, 4362306a36Sopenharmony_ci { STB0899_DISF22 , 0x99 }, 4462306a36Sopenharmony_ci { STB0899_DISF22RX , 0xa8 }, 4562306a36Sopenharmony_ci /* SYSREG ? */ 4662306a36Sopenharmony_ci { STB0899_ACRPRESC , 0x11 }, 4762306a36Sopenharmony_ci { STB0899_ACRDIV1 , 0x0a }, 4862306a36Sopenharmony_ci { STB0899_ACRDIV2 , 0x05 }, 4962306a36Sopenharmony_ci { STB0899_DACR1 , 0x00 }, 5062306a36Sopenharmony_ci { STB0899_DACR2 , 0x00 }, 5162306a36Sopenharmony_ci { STB0899_OUTCFG , 0x00 }, 5262306a36Sopenharmony_ci { STB0899_MODECFG , 0x00 }, 5362306a36Sopenharmony_ci { STB0899_IRQSTATUS_3 , 0xfe }, 5462306a36Sopenharmony_ci { STB0899_IRQSTATUS_2 , 0x03 }, 5562306a36Sopenharmony_ci { STB0899_IRQSTATUS_1 , 0x7c }, 5662306a36Sopenharmony_ci { STB0899_IRQSTATUS_0 , 0xf4 }, 5762306a36Sopenharmony_ci { STB0899_IRQMSK_3 , 0xf3 }, 5862306a36Sopenharmony_ci { STB0899_IRQMSK_2 , 0xfc }, 5962306a36Sopenharmony_ci { STB0899_IRQMSK_1 , 0xff }, 6062306a36Sopenharmony_ci { STB0899_IRQMSK_0 , 0xff }, 6162306a36Sopenharmony_ci { STB0899_IRQCFG , 0x00 }, 6262306a36Sopenharmony_ci { STB0899_I2CCFG , 0x88 }, 6362306a36Sopenharmony_ci { STB0899_I2CRPT , 0x58 }, 6462306a36Sopenharmony_ci { STB0899_IOPVALUE5 , 0x00 }, 6562306a36Sopenharmony_ci { STB0899_IOPVALUE4 , 0x33 }, 6662306a36Sopenharmony_ci { STB0899_IOPVALUE3 , 0x6d }, 6762306a36Sopenharmony_ci { STB0899_IOPVALUE2 , 0x90 }, 6862306a36Sopenharmony_ci { STB0899_IOPVALUE1 , 0x60 }, 6962306a36Sopenharmony_ci { STB0899_IOPVALUE0 , 0x00 }, 7062306a36Sopenharmony_ci { STB0899_GPIO00CFG , 0x82 }, 7162306a36Sopenharmony_ci { STB0899_GPIO01CFG , 0x82 }, 7262306a36Sopenharmony_ci { STB0899_GPIO02CFG , 0x82 }, 7362306a36Sopenharmony_ci { STB0899_GPIO03CFG , 0x82 }, 7462306a36Sopenharmony_ci { STB0899_GPIO04CFG , 0x82 }, 7562306a36Sopenharmony_ci { STB0899_GPIO05CFG , 0x82 }, 7662306a36Sopenharmony_ci { STB0899_GPIO06CFG , 0x82 }, 7762306a36Sopenharmony_ci { STB0899_GPIO07CFG , 0x82 }, 7862306a36Sopenharmony_ci { STB0899_GPIO08CFG , 0x82 }, 7962306a36Sopenharmony_ci { STB0899_GPIO09CFG , 0x82 }, 8062306a36Sopenharmony_ci { STB0899_GPIO10CFG , 0x82 }, 8162306a36Sopenharmony_ci { STB0899_GPIO11CFG , 0x82 }, 8262306a36Sopenharmony_ci { STB0899_GPIO12CFG , 0x82 }, 8362306a36Sopenharmony_ci { STB0899_GPIO13CFG , 0x82 }, 8462306a36Sopenharmony_ci { STB0899_GPIO14CFG , 0x82 }, 8562306a36Sopenharmony_ci { STB0899_GPIO15CFG , 0x82 }, 8662306a36Sopenharmony_ci { STB0899_GPIO16CFG , 0x82 }, 8762306a36Sopenharmony_ci { STB0899_GPIO17CFG , 0x82 }, 8862306a36Sopenharmony_ci { STB0899_GPIO18CFG , 0x82 }, 8962306a36Sopenharmony_ci { STB0899_GPIO19CFG , 0x82 }, 9062306a36Sopenharmony_ci { STB0899_GPIO20CFG , 0x82 }, 9162306a36Sopenharmony_ci { STB0899_SDATCFG , 0xb8 }, 9262306a36Sopenharmony_ci { STB0899_SCLTCFG , 0xba }, 9362306a36Sopenharmony_ci { STB0899_AGCRFCFG , 0x1c }, /* 0x11 */ 9462306a36Sopenharmony_ci { STB0899_GPIO22 , 0x82 }, /* AGCBB2CFG */ 9562306a36Sopenharmony_ci { STB0899_GPIO21 , 0x91 }, /* AGCBB1CFG */ 9662306a36Sopenharmony_ci { STB0899_DIRCLKCFG , 0x82 }, 9762306a36Sopenharmony_ci { STB0899_CLKOUT27CFG , 0x7e }, 9862306a36Sopenharmony_ci { STB0899_STDBYCFG , 0x82 }, 9962306a36Sopenharmony_ci { STB0899_CS0CFG , 0x82 }, 10062306a36Sopenharmony_ci { STB0899_CS1CFG , 0x82 }, 10162306a36Sopenharmony_ci { STB0899_DISEQCOCFG , 0x20 }, 10262306a36Sopenharmony_ci { STB0899_GPIO32CFG , 0x82 }, 10362306a36Sopenharmony_ci { STB0899_GPIO33CFG , 0x82 }, 10462306a36Sopenharmony_ci { STB0899_GPIO34CFG , 0x82 }, 10562306a36Sopenharmony_ci { STB0899_GPIO35CFG , 0x82 }, 10662306a36Sopenharmony_ci { STB0899_GPIO36CFG , 0x82 }, 10762306a36Sopenharmony_ci { STB0899_GPIO37CFG , 0x82 }, 10862306a36Sopenharmony_ci { STB0899_GPIO38CFG , 0x82 }, 10962306a36Sopenharmony_ci { STB0899_GPIO39CFG , 0x82 }, 11062306a36Sopenharmony_ci { STB0899_NCOARSE , 0x17 }, /* 0x15 = 27 Mhz Clock, F/3 = 198MHz, F/6 = 99MHz */ 11162306a36Sopenharmony_ci { STB0899_SYNTCTRL , 0x02 }, /* 0x00 = CLK from CLKI, 0x02 = CLK from XTALI */ 11262306a36Sopenharmony_ci { STB0899_FILTCTRL , 0x00 }, 11362306a36Sopenharmony_ci { STB0899_SYSCTRL , 0x01 }, 11462306a36Sopenharmony_ci { STB0899_STOPCLK1 , 0x20 }, 11562306a36Sopenharmony_ci { STB0899_STOPCLK2 , 0x00 }, 11662306a36Sopenharmony_ci { STB0899_INTBUFSTATUS , 0x00 }, 11762306a36Sopenharmony_ci { STB0899_INTBUFCTRL , 0x0a }, 11862306a36Sopenharmony_ci { 0xffff , 0xff }, 11962306a36Sopenharmony_ci}; 12062306a36Sopenharmony_ci 12162306a36Sopenharmony_cistatic const struct stb0899_s1_reg vp1041_stb0899_s1_init_3[] = { 12262306a36Sopenharmony_ci { STB0899_DEMOD , 0x00 }, 12362306a36Sopenharmony_ci { STB0899_RCOMPC , 0xc9 }, 12462306a36Sopenharmony_ci { STB0899_AGC1CN , 0x01 }, 12562306a36Sopenharmony_ci { STB0899_AGC1REF , 0x10 }, 12662306a36Sopenharmony_ci { STB0899_RTC , 0x23 }, 12762306a36Sopenharmony_ci { STB0899_TMGCFG , 0x4e }, 12862306a36Sopenharmony_ci { STB0899_AGC2REF , 0x34 }, 12962306a36Sopenharmony_ci { STB0899_TLSR , 0x84 }, 13062306a36Sopenharmony_ci { STB0899_CFD , 0xf7 }, 13162306a36Sopenharmony_ci { STB0899_ACLC , 0x87 }, 13262306a36Sopenharmony_ci { STB0899_BCLC , 0x94 }, 13362306a36Sopenharmony_ci { STB0899_EQON , 0x41 }, 13462306a36Sopenharmony_ci { STB0899_LDT , 0xf1 }, 13562306a36Sopenharmony_ci { STB0899_LDT2 , 0xe3 }, 13662306a36Sopenharmony_ci { STB0899_EQUALREF , 0xb4 }, 13762306a36Sopenharmony_ci { STB0899_TMGRAMP , 0x10 }, 13862306a36Sopenharmony_ci { STB0899_TMGTHD , 0x30 }, 13962306a36Sopenharmony_ci { STB0899_IDCCOMP , 0xfd }, 14062306a36Sopenharmony_ci { STB0899_QDCCOMP , 0xff }, 14162306a36Sopenharmony_ci { STB0899_POWERI , 0x0c }, 14262306a36Sopenharmony_ci { STB0899_POWERQ , 0x0f }, 14362306a36Sopenharmony_ci { STB0899_RCOMP , 0x6c }, 14462306a36Sopenharmony_ci { STB0899_AGCIQIN , 0x80 }, 14562306a36Sopenharmony_ci { STB0899_AGC2I1 , 0x06 }, 14662306a36Sopenharmony_ci { STB0899_AGC2I2 , 0x00 }, 14762306a36Sopenharmony_ci { STB0899_TLIR , 0x30 }, 14862306a36Sopenharmony_ci { STB0899_RTF , 0x7f }, 14962306a36Sopenharmony_ci { STB0899_DSTATUS , 0x00 }, 15062306a36Sopenharmony_ci { STB0899_LDI , 0xbc }, 15162306a36Sopenharmony_ci { STB0899_CFRM , 0xea }, 15262306a36Sopenharmony_ci { STB0899_CFRL , 0x31 }, 15362306a36Sopenharmony_ci { STB0899_NIRM , 0x2b }, 15462306a36Sopenharmony_ci { STB0899_NIRL , 0x80 }, 15562306a36Sopenharmony_ci { STB0899_ISYMB , 0x1d }, 15662306a36Sopenharmony_ci { STB0899_QSYMB , 0xa6 }, 15762306a36Sopenharmony_ci { STB0899_SFRH , 0x2f }, 15862306a36Sopenharmony_ci { STB0899_SFRM , 0x68 }, 15962306a36Sopenharmony_ci { STB0899_SFRL , 0x40 }, 16062306a36Sopenharmony_ci { STB0899_SFRUPH , 0x2f }, 16162306a36Sopenharmony_ci { STB0899_SFRUPM , 0x68 }, 16262306a36Sopenharmony_ci { STB0899_SFRUPL , 0x40 }, 16362306a36Sopenharmony_ci { STB0899_EQUAI1 , 0x02 }, 16462306a36Sopenharmony_ci { STB0899_EQUAQ1 , 0xff }, 16562306a36Sopenharmony_ci { STB0899_EQUAI2 , 0x04 }, 16662306a36Sopenharmony_ci { STB0899_EQUAQ2 , 0x05 }, 16762306a36Sopenharmony_ci { STB0899_EQUAI3 , 0x02 }, 16862306a36Sopenharmony_ci { STB0899_EQUAQ3 , 0xfd }, 16962306a36Sopenharmony_ci { STB0899_EQUAI4 , 0x03 }, 17062306a36Sopenharmony_ci { STB0899_EQUAQ4 , 0x07 }, 17162306a36Sopenharmony_ci { STB0899_EQUAI5 , 0x08 }, 17262306a36Sopenharmony_ci { STB0899_EQUAQ5 , 0xf5 }, 17362306a36Sopenharmony_ci { STB0899_DSTATUS2 , 0x00 }, 17462306a36Sopenharmony_ci { STB0899_VSTATUS , 0x00 }, 17562306a36Sopenharmony_ci { STB0899_VERROR , 0x86 }, 17662306a36Sopenharmony_ci { STB0899_IQSWAP , 0x2a }, 17762306a36Sopenharmony_ci { STB0899_ECNT1M , 0x00 }, 17862306a36Sopenharmony_ci { STB0899_ECNT1L , 0x00 }, 17962306a36Sopenharmony_ci { STB0899_ECNT2M , 0x00 }, 18062306a36Sopenharmony_ci { STB0899_ECNT2L , 0x00 }, 18162306a36Sopenharmony_ci { STB0899_ECNT3M , 0x0a }, 18262306a36Sopenharmony_ci { STB0899_ECNT3L , 0xad }, 18362306a36Sopenharmony_ci { STB0899_FECAUTO1 , 0x06 }, 18462306a36Sopenharmony_ci { STB0899_FECM , 0x01 }, 18562306a36Sopenharmony_ci { STB0899_VTH12 , 0xb0 }, 18662306a36Sopenharmony_ci { STB0899_VTH23 , 0x7a }, 18762306a36Sopenharmony_ci { STB0899_VTH34 , 0x58 }, 18862306a36Sopenharmony_ci { STB0899_VTH56 , 0x38 }, 18962306a36Sopenharmony_ci { STB0899_VTH67 , 0x34 }, 19062306a36Sopenharmony_ci { STB0899_VTH78 , 0x24 }, 19162306a36Sopenharmony_ci { STB0899_PRVIT , 0xff }, 19262306a36Sopenharmony_ci { STB0899_VITSYNC , 0x19 }, 19362306a36Sopenharmony_ci { STB0899_RSULC , 0xb1 }, /* DVB = 0xb1, DSS = 0xa1 */ 19462306a36Sopenharmony_ci { STB0899_TSULC , 0x42 }, 19562306a36Sopenharmony_ci { STB0899_RSLLC , 0x41 }, 19662306a36Sopenharmony_ci { STB0899_TSLPL , 0x12 }, 19762306a36Sopenharmony_ci { STB0899_TSCFGH , 0x0c }, 19862306a36Sopenharmony_ci { STB0899_TSCFGM , 0x00 }, 19962306a36Sopenharmony_ci { STB0899_TSCFGL , 0x00 }, 20062306a36Sopenharmony_ci { STB0899_TSOUT , 0x69 }, /* 0x0d for CAM */ 20162306a36Sopenharmony_ci { STB0899_RSSYNCDEL , 0x00 }, 20262306a36Sopenharmony_ci { STB0899_TSINHDELH , 0x02 }, 20362306a36Sopenharmony_ci { STB0899_TSINHDELM , 0x00 }, 20462306a36Sopenharmony_ci { STB0899_TSINHDELL , 0x00 }, 20562306a36Sopenharmony_ci { STB0899_TSLLSTKM , 0x1b }, 20662306a36Sopenharmony_ci { STB0899_TSLLSTKL , 0xb3 }, 20762306a36Sopenharmony_ci { STB0899_TSULSTKM , 0x00 }, 20862306a36Sopenharmony_ci { STB0899_TSULSTKL , 0x00 }, 20962306a36Sopenharmony_ci { STB0899_PCKLENUL , 0xbc }, 21062306a36Sopenharmony_ci { STB0899_PCKLENLL , 0xcc }, 21162306a36Sopenharmony_ci { STB0899_RSPCKLEN , 0xbd }, 21262306a36Sopenharmony_ci { STB0899_TSSTATUS , 0x90 }, 21362306a36Sopenharmony_ci { STB0899_ERRCTRL1 , 0xb6 }, 21462306a36Sopenharmony_ci { STB0899_ERRCTRL2 , 0x95 }, 21562306a36Sopenharmony_ci { STB0899_ERRCTRL3 , 0x8d }, 21662306a36Sopenharmony_ci { STB0899_DMONMSK1 , 0x27 }, 21762306a36Sopenharmony_ci { STB0899_DMONMSK0 , 0x03 }, 21862306a36Sopenharmony_ci { STB0899_DEMAPVIT , 0x5c }, 21962306a36Sopenharmony_ci { STB0899_PLPARM , 0x19 }, 22062306a36Sopenharmony_ci { STB0899_PDELCTRL , 0x48 }, 22162306a36Sopenharmony_ci { STB0899_PDELCTRL2 , 0x00 }, 22262306a36Sopenharmony_ci { STB0899_BBHCTRL1 , 0x00 }, 22362306a36Sopenharmony_ci { STB0899_BBHCTRL2 , 0x00 }, 22462306a36Sopenharmony_ci { STB0899_HYSTTHRESH , 0x77 }, 22562306a36Sopenharmony_ci { STB0899_MATCSTM , 0x00 }, 22662306a36Sopenharmony_ci { STB0899_MATCSTL , 0x00 }, 22762306a36Sopenharmony_ci { STB0899_UPLCSTM , 0x00 }, 22862306a36Sopenharmony_ci { STB0899_UPLCSTL , 0x00 }, 22962306a36Sopenharmony_ci { STB0899_DFLCSTM , 0x00 }, 23062306a36Sopenharmony_ci { STB0899_DFLCSTL , 0x00 }, 23162306a36Sopenharmony_ci { STB0899_SYNCCST , 0x00 }, 23262306a36Sopenharmony_ci { STB0899_SYNCDCSTM , 0x00 }, 23362306a36Sopenharmony_ci { STB0899_SYNCDCSTL , 0x00 }, 23462306a36Sopenharmony_ci { STB0899_ISI_ENTRY , 0x00 }, 23562306a36Sopenharmony_ci { STB0899_ISI_BIT_EN , 0x00 }, 23662306a36Sopenharmony_ci { STB0899_MATSTRM , 0xf0 }, 23762306a36Sopenharmony_ci { STB0899_MATSTRL , 0x02 }, 23862306a36Sopenharmony_ci { STB0899_UPLSTRM , 0x45 }, 23962306a36Sopenharmony_ci { STB0899_UPLSTRL , 0x60 }, 24062306a36Sopenharmony_ci { STB0899_DFLSTRM , 0xe3 }, 24162306a36Sopenharmony_ci { STB0899_DFLSTRL , 0x00 }, 24262306a36Sopenharmony_ci { STB0899_SYNCSTR , 0x47 }, 24362306a36Sopenharmony_ci { STB0899_SYNCDSTRM , 0x05 }, 24462306a36Sopenharmony_ci { STB0899_SYNCDSTRL , 0x18 }, 24562306a36Sopenharmony_ci { STB0899_CFGPDELSTATUS1 , 0x19 }, 24662306a36Sopenharmony_ci { STB0899_CFGPDELSTATUS2 , 0x2b }, 24762306a36Sopenharmony_ci { STB0899_BBFERRORM , 0x00 }, 24862306a36Sopenharmony_ci { STB0899_BBFERRORL , 0x01 }, 24962306a36Sopenharmony_ci { STB0899_UPKTERRORM , 0x00 }, 25062306a36Sopenharmony_ci { STB0899_UPKTERRORL , 0x00 }, 25162306a36Sopenharmony_ci { 0xffff , 0xff }, 25262306a36Sopenharmony_ci}; 25362306a36Sopenharmony_ci 25462306a36Sopenharmony_cistatic struct stb0899_config vp1041_stb0899_config = { 25562306a36Sopenharmony_ci .init_dev = vp1041_stb0899_s1_init_1, 25662306a36Sopenharmony_ci .init_s2_demod = stb0899_s2_init_2, 25762306a36Sopenharmony_ci .init_s1_demod = vp1041_stb0899_s1_init_3, 25862306a36Sopenharmony_ci .init_s2_fec = stb0899_s2_init_4, 25962306a36Sopenharmony_ci .init_tst = stb0899_s1_init_5, 26062306a36Sopenharmony_ci 26162306a36Sopenharmony_ci .demod_address = 0x68, /* 0xd0 >> 1 */ 26262306a36Sopenharmony_ci 26362306a36Sopenharmony_ci .xtal_freq = 27000000, 26462306a36Sopenharmony_ci .inversion = IQ_SWAP_ON, 26562306a36Sopenharmony_ci 26662306a36Sopenharmony_ci .lo_clk = 76500000, 26762306a36Sopenharmony_ci .hi_clk = 99000000, 26862306a36Sopenharmony_ci 26962306a36Sopenharmony_ci .esno_ave = STB0899_DVBS2_ESNO_AVE, 27062306a36Sopenharmony_ci .esno_quant = STB0899_DVBS2_ESNO_QUANT, 27162306a36Sopenharmony_ci .avframes_coarse = STB0899_DVBS2_AVFRAMES_COARSE, 27262306a36Sopenharmony_ci .avframes_fine = STB0899_DVBS2_AVFRAMES_FINE, 27362306a36Sopenharmony_ci .miss_threshold = STB0899_DVBS2_MISS_THRESHOLD, 27462306a36Sopenharmony_ci .uwp_threshold_acq = STB0899_DVBS2_UWP_THRESHOLD_ACQ, 27562306a36Sopenharmony_ci .uwp_threshold_track = STB0899_DVBS2_UWP_THRESHOLD_TRACK, 27662306a36Sopenharmony_ci .uwp_threshold_sof = STB0899_DVBS2_UWP_THRESHOLD_SOF, 27762306a36Sopenharmony_ci .sof_search_timeout = STB0899_DVBS2_SOF_SEARCH_TIMEOUT, 27862306a36Sopenharmony_ci 27962306a36Sopenharmony_ci .btr_nco_bits = STB0899_DVBS2_BTR_NCO_BITS, 28062306a36Sopenharmony_ci .btr_gain_shift_offset = STB0899_DVBS2_BTR_GAIN_SHIFT_OFFSET, 28162306a36Sopenharmony_ci .crl_nco_bits = STB0899_DVBS2_CRL_NCO_BITS, 28262306a36Sopenharmony_ci .ldpc_max_iter = STB0899_DVBS2_LDPC_MAX_ITER, 28362306a36Sopenharmony_ci 28462306a36Sopenharmony_ci .tuner_get_frequency = stb6100_get_frequency, 28562306a36Sopenharmony_ci .tuner_set_frequency = stb6100_set_frequency, 28662306a36Sopenharmony_ci .tuner_set_bandwidth = stb6100_set_bandwidth, 28762306a36Sopenharmony_ci .tuner_get_bandwidth = stb6100_get_bandwidth, 28862306a36Sopenharmony_ci .tuner_set_rfsiggain = NULL, 28962306a36Sopenharmony_ci}; 29062306a36Sopenharmony_ci 29162306a36Sopenharmony_cistatic struct stb6100_config vp1041_stb6100_config = { 29262306a36Sopenharmony_ci .tuner_address = 0x60, 29362306a36Sopenharmony_ci .refclock = 27000000, 29462306a36Sopenharmony_ci}; 29562306a36Sopenharmony_ci 29662306a36Sopenharmony_cistatic int vp1041_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *fe) 29762306a36Sopenharmony_ci{ 29862306a36Sopenharmony_ci struct i2c_adapter *adapter = &mantis->adapter; 29962306a36Sopenharmony_ci 30062306a36Sopenharmony_ci int err = 0; 30162306a36Sopenharmony_ci 30262306a36Sopenharmony_ci err = mantis_frontend_power(mantis, POWER_ON); 30362306a36Sopenharmony_ci if (err == 0) { 30462306a36Sopenharmony_ci mantis_frontend_soft_reset(mantis); 30562306a36Sopenharmony_ci msleep(250); 30662306a36Sopenharmony_ci mantis->fe = dvb_attach(stb0899_attach, &vp1041_stb0899_config, adapter); 30762306a36Sopenharmony_ci if (mantis->fe) { 30862306a36Sopenharmony_ci dprintk(MANTIS_ERROR, 1, 30962306a36Sopenharmony_ci "found STB0899 DVB-S/DVB-S2 frontend @0x%02x", 31062306a36Sopenharmony_ci vp1041_stb0899_config.demod_address); 31162306a36Sopenharmony_ci 31262306a36Sopenharmony_ci if (dvb_attach(stb6100_attach, mantis->fe, &vp1041_stb6100_config, adapter)) { 31362306a36Sopenharmony_ci if (!dvb_attach(lnbp21_attach, mantis->fe, adapter, 0, 0)) 31462306a36Sopenharmony_ci dprintk(MANTIS_ERROR, 1, "No LNBP21 found!"); 31562306a36Sopenharmony_ci } 31662306a36Sopenharmony_ci } else { 31762306a36Sopenharmony_ci return -EREMOTEIO; 31862306a36Sopenharmony_ci } 31962306a36Sopenharmony_ci } else { 32062306a36Sopenharmony_ci dprintk(MANTIS_ERROR, 1, "Frontend on <%s> POWER ON failed! <%d>", 32162306a36Sopenharmony_ci adapter->name, 32262306a36Sopenharmony_ci err); 32362306a36Sopenharmony_ci 32462306a36Sopenharmony_ci return -EIO; 32562306a36Sopenharmony_ci } 32662306a36Sopenharmony_ci 32762306a36Sopenharmony_ci 32862306a36Sopenharmony_ci dprintk(MANTIS_ERROR, 1, "Done!"); 32962306a36Sopenharmony_ci 33062306a36Sopenharmony_ci return 0; 33162306a36Sopenharmony_ci} 33262306a36Sopenharmony_ci 33362306a36Sopenharmony_cistruct mantis_hwconfig vp1041_config = { 33462306a36Sopenharmony_ci .model_name = MANTIS_MODEL_NAME, 33562306a36Sopenharmony_ci .dev_type = MANTIS_DEV_TYPE, 33662306a36Sopenharmony_ci .ts_size = MANTIS_TS_188, 33762306a36Sopenharmony_ci 33862306a36Sopenharmony_ci .baud_rate = MANTIS_BAUD_9600, 33962306a36Sopenharmony_ci .parity = MANTIS_PARITY_NONE, 34062306a36Sopenharmony_ci .bytes = 0, 34162306a36Sopenharmony_ci 34262306a36Sopenharmony_ci .frontend_init = vp1041_frontend_init, 34362306a36Sopenharmony_ci .power = GPIF_A12, 34462306a36Sopenharmony_ci .reset = GPIF_A13, 34562306a36Sopenharmony_ci}; 346