/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* bsru6 . h - ALPS BSRU6 tuner support ( moved from budget - ci . c )
*
* the project ' s page is at https : //linuxtv.org
*/
#ifndef BSRU6_H
#define BSRU6_H
static u8 alps_bsru6_inittab[] = {
0 x01, 0 x15,
0 x02, 0 x30,
0 x03, 0 x00,
0 x04, 0 x7d, /* F22FR = 0x7d, F22 = f_VCO / 128 / 0x7d = 22 kHz */
0 x05, 0 x35, /* I2CT = 0, SCLT = 1, SDAT = 1 */
0 x06, 0 x40, /* DAC not used, set to high impendance mode */
0 x07, 0 x00, /* DAC LSB */
0 x08, 0 x40, /* DiSEqC off, LNB power on OP2/LOCK pin on */
0 x09, 0 x00, /* FIFO */
0 x0c, 0 x51, /* OP1 ctl = Normal, OP1 val = 1 (LNB Power ON) */
0 x0d, 0 x82, /* DC offset compensation = ON, beta_agc1 = 2 */
0 x0e, 0 x23, /* alpha_tmg = 2, beta_tmg = 3 */
0 x10, 0 x3f, // AGC2 0x3d
0 x11, 0 x84,
0 x12, 0 xb9,
0 x15, 0 xc9, // lock detector threshold
0 x16, 0 x00,
0 x17, 0 x00,
0 x18, 0 x00,
0 x19, 0 x00,
0 x1a, 0 x00,
0 x1f, 0 x50,
0 x20, 0 x00,
0 x21, 0 x00,
0 x22, 0 x00,
0 x23, 0 x00,
0 x28, 0 x00, // out imp: normal out type: parallel FEC mode:0
0 x29, 0 x1e, // 1/2 threshold
0 x2a, 0 x14, // 2/3 threshold
0 x2b, 0 x0f, // 3/4 threshold
0 x2c, 0 x09, // 5/6 threshold
0 x2d, 0 x05, // 7/8 threshold
0 x2e, 0 x01,
0 x31, 0 x1f, // test all FECs
0 x32, 0 x19, // viterbi and synchro search
0 x33, 0 xfc, // rs control
0 x34, 0 x93, // error control
0 x0f, 0 x52,
0 xff, 0 xff
};
static int alps_bsru6_set_symbol_rate(struct dvb_frontend *fe, u32 srate, u32 ratio)
{
u8 aclk = 0 ;
u8 bclk = 0 ;
if (srate < 1500000 ) {
aclk = 0 xb7;
bclk = 0 x47;
} else if (srate < 3000000 ) {
aclk = 0 xb7;
bclk = 0 x4b;
} else if (srate < 7000000 ) {
aclk = 0 xb7;
bclk = 0 x4f;
} else if (srate < 14000000 ) {
aclk = 0 xb7;
bclk = 0 x53;
} else if (srate < 30000000 ) {
aclk = 0 xb6;
bclk = 0 x53;
} else if (srate < 45000000 ) {
aclk = 0 xb4;
bclk = 0 x51;
}
stv0299_writereg(fe, 0 x13, aclk);
stv0299_writereg(fe, 0 x14, bclk);
stv0299_writereg(fe, 0 x1f, (ratio >> 16 ) & 0 xff);
stv0299_writereg(fe, 0 x20, (ratio >> 8 ) & 0 xff);
stv0299_writereg(fe, 0 x21, ratio & 0 xf0);
return 0 ;
}
static int alps_bsru6_tuner_set_params(struct dvb_frontend *fe)
{
struct dtv_frontend_properties *p = &fe->dtv_property_cache;
u8 buf[4 ];
u32 div;
struct i2c_msg msg = { .addr = 0 x61, .flags = 0 , .buf = buf, .len = sizeof (buf) };
struct i2c_adapter *i2c = fe->tuner_priv;
if ((p->frequency < 950000 ) || (p->frequency > 2150000 ))
return -EINVAL;
div = (p->frequency + (125 - 1 )) / 125 ; /* round correctly */
buf[0 ] = (div >> 8 ) & 0 x7f;
buf[1 ] = div & 0 xff;
buf[2 ] = 0 x80 | ((div & 0 x18000) >> 10 ) | 4 ;
buf[3 ] = 0 xC4;
if (p->frequency > 1530000 )
buf[3 ] = 0 xc0;
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 1 );
if (i2c_transfer(i2c, &msg, 1 ) != 1 )
return -EIO;
return 0 ;
}
static struct stv0299_config alps_bsru6_config = {
.demod_address = 0 x68,
.inittab = alps_bsru6_inittab,
.mclk = 88000000 UL,
.invert = 1 ,
.skip_reinit = 0 ,
.lock_output = STV0299_LOCKOUTPUT_1,
.volt13_op0_op1 = STV0299_VOLT13_OP1,
.min_delay_ms = 100 ,
.set_symbol_rate = alps_bsru6_set_symbol_rate,
};
#endif
Messung V0.5 in Prozent C=96 H=92 G=93
¤ Dauer der Verarbeitung: 0.3 Sekunden
¤
*© Formatika GbR, Deutschland