// SPDX-License-Identifier: GPL-2.0 /* * Linux driver for digital TV devices equipped with B2C2 FlexcopII(b)/III * flexcop-fe-tuner.c - methods for frontend attachment and DiSEqC controlling * see flexcop.c for copyright information
*/ #include <media/tuner.h> #include"flexcop.h" #include"mt312.h" #include"stv0299.h" #include"s5h1420.h" #include"itd1000.h" #include"cx24113.h" #include"cx24123.h" #include"isl6421.h" #include"cx24120.h" #include"mt352.h" #include"bcm3510.h" #include"nxt200x.h" #include"dvb-pll.h" #include"lgdt330x.h" #include"tuner-simple.h" #include"stv0297.h"
/* Can we use the specified front-end? Remember that if we are compiled
* into the kernel we can't call code that's in modules. */ #define FE_SUPPORTED(fe) IS_REACHABLE(CONFIG_DVB_ ## fe)
staticvoid flexcop_diseqc_send_byte(struct dvb_frontend* fe, int data)
{ int i, par = 1, d; for (i = 7; i >= 0; i--) {
d = (data >> i) & 1;
par ^= d;
flexcop_diseqc_send_bit(fe, d);
}
flexcop_diseqc_send_bit(fe, par);
}
staticint flexcop_send_diseqc_msg(struct dvb_frontend *fe, int len, u8 *msg, unsignedlong burst)
{ int i;
flexcop_set_tone(fe, SEC_TONE_OFF);
mdelay(16);
for (i = 0; i < len; i++)
flexcop_diseqc_send_byte(fe,msg[i]);
mdelay(16);
/* enable no_base_addr - no repeated start when reading */
fc->fc_i2c_adap[2].no_base_addr = 1; if (!dvb_attach(isl6421_attach, fc->fe, &fc->fc_i2c_adap[2].i2c_adap,
0x08, 1, 1, false)) {
err("ISL6421 could NOT be attached"); goto fail_isl;
}
info("ISL6421 successfully attached");
/* the ITD1000 requires a lower i2c clock - is it a problem ? */
r108.raw = 0x00000506;
fc->write_ibi_reg(fc, tw_sm_c_108, r108); if (!dvb_attach(itd1000_attach, fc->fe, i2c_tuner,
&skystar2_rev2_7_itd1000_config)) {
err("ITD1000 could NOT be attached"); /* Should i2c clock be restored? */ goto fail_isl;
}
info("ITD1000 successfully attached");
return 1;
fail_isl:
fc->fc_i2c_adap[2].no_base_addr = 0;
fail: /* for the next devices we need it again */
fc->fc_i2c_adap[0].no_base_addr = 0; return 0;
} #else #define skystar2_rev27_attach NULL #endif
fc->fe = dvb_attach(cx24123_attach, &skystar2_rev2_8_cx24123_config,
i2c); if (!fc->fe) return 0;
i2c_tuner = cx24123_get_tuner_i2c_adapter(fc->fe); if (!i2c_tuner) return 0;
if (!dvb_attach(cx24113_attach, fc->fe, &skystar2_rev2_8_cx24113_config,
i2c_tuner)) {
err("CX24113 could NOT be attached"); return 0;
}
info("CX24113 successfully attached");
fc->fc_i2c_adap[2].no_base_addr = 1; if (!dvb_attach(isl6421_attach, fc->fe, &fc->fc_i2c_adap[2].i2c_adap,
0x08, 0, 0, false)) {
err("ISL6421 could NOT be attached");
fc->fc_i2c_adap[2].no_base_addr = 0; return 0;
}
info("ISL6421 successfully attached"); /* TODO on i2c_adap[1] addr 0x11 (EEPROM) there seems to be an
* IR-receiver (PIC16F818) - but the card has no input for that ??? */ return 1;
} #else #define skystar2_rev28_attach NULL #endif
/* This tuner doesn't use the stv0297's I2C gate, but instead the
* tuner is connected to a different flexcop I2C adapter. */ if (fc->fe->ops.i2c_gate_ctrl)
fc->fe->ops.i2c_gate_ctrl(fc->fe, 0);
fc->fe->ops.i2c_gate_ctrl = NULL;
if (!dvb_attach(dvb_pll_attach, fc->fe, 0x61,
&fc->fc_i2c_adap[2].i2c_adap, DVB_PLL_TDEE4)) goto fail;
return 1;
fail: /* Reset for next frontend to try */
fc->fc_i2c_adap[0].no_base_addr = 0; return 0;
} #else #define cablestar2_attach NULL #endif
/* try to figure out the frontend */ int flexcop_frontend_init(struct flexcop_device *fc)
{ int i; for (i = 0; i < ARRAY_SIZE(flexcop_frontends); i++) { if (!flexcop_frontends[i].attach) continue; /* type needs to be set before, because of some workarounds
* done based on the probed card type */
fc->dev_type = flexcop_frontends[i].type; if (flexcop_frontends[i].attach(fc, &fc->fc_i2c_adap[0].i2c_adap)) goto fe_found; /* Clean up partially attached frontend */ if (fc->fe) {
dvb_frontend_detach(fc->fe);
fc->fe = NULL;
}
}
fc->dev_type = FC_UNK;
err("no frontend driver found for this B2C2/FlexCop adapter"); return -ENODEV;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.