|
(TAIPEI,
TAIWAN, 04.06,
2009) -Taiwan
Commate Computer Inc.(COMMELL), the worldwide leader of Industrial
Mini-ITX mainboard, introduced the Mini-ITX LV-67A that
mainboard incorporates an Intel LGA775 pin-out compatible
with Intel Core 2 Quad processor Q9400, Intel Core 2 Duo
processors E8400, E7400, E6400 and E4300, Intel Dual-Core processors
E5300 and E2160, and Intel Celeron processor 440 @
1333/1066/800 MHz System Bus, The LV-67A platform based on Q45
Express chipset, is ideal for developing high-performance systems
for industrial control and automation, retail and hospitality,
gaming, print imaging, digital signage, digital surveillance and
network security applications.
The LV-67A mainboard has
a built-in Intel Graphics Accelerator 4500 to deliver an
excellent blend of graphics performance and features, Delivers
integrated dual-display support and support for Microsoft DirectX 10
and OpenGL 2.0 enabling support c int tda18271c2_rf_cal_init(struct dvb_frontend *fe)
{
struct tda18271_priv *priv = fe->tuner_priv;
unsigned char *regs = priv->tda18271_regs;
int ret;
/* test RF_CAL_OK to see if we need init */
if ((regs[R_EP1] & 0x10) == 0)
priv->cal_initialized = false;
if (priv->cal_initialized)
return 0;
ret = tda18271_calc_rf_filter_curve(fe);
if (tda_fail(ret))
goto fail;
ret = tda18271_por(fe);
if (tda_fail(ret))
goto fail;
tda_info("tda18271: RF tracking filter calibration complete\n");
priv->cal_initialized = true;
goto end;
fail:
tda_info("tda18271: RF tracking filter calibration failed!\n");
end:
return ret;
}
static int tda18271c1_rf_tracking_filter_calibration(struct dvb_frontend *fe,
u32 freq, u32 bw)
{
struct tda18271_priv *priv = fe->tuner_priv;
unsigned char *regs = priv->tda18271_regs;
int ret;
u32 N = 0;
/* calculate bp filter */
tda18271_calc_bp_filter(fe, &freq);
tda18271_write_regs(fe, R_EP1, 1);
regs[R_EB4] &= 0x07;
regs[R_EB4] |= 0x60;
tda18271_write_regs(fe, R_EB4, 1);
regs[R_EB7] = 0x60;
tda18271_write_regs(fe, R_EB7, 1);
regs[R_EB14] = 0x00;
tda18271_write_regs(fe, R_EB14, 1);
regs[R_EB20] = 0xcc;
tda18271_write_regs(fe, R_EB20, 1);
/* set cal mode to RF tracking filter calibration */
regs[R_EP4] |= 0x03;
/* calculate cal pll */
switch (priv->mode) {
case TDA18271_ANALOG:
N = freq - 1250000;
break;
case TDA18271_DIGITAL:
N = freq + bw / 2;
break;
}
tda18271_calc_cal_pll(fe, N);
/* calculate main pll */
switch (priv->mode) {
case TDA18271_ANALOG:
N = freq - 250000;
break;
case TDA18271_DIGITAL:
N = freq + bw / 2 + 1000000;
break;
}
tda18271_calc_main_pll(fe, N);
ret = tda18271_write_regs(fe, R_EP3, 11);
if (tda_fail(ret))
return ret;
msleep(5); /* RF tracking filter calibration initialization */
/* search for K,M,CO for RF calibration */
tda18271_calc_km(fe, &freq);
tda18271_write_regs(fe, R_EB13, 1);
/* search for rf band */
tda18271_calc_rf_band(fe, &freq);
/* search for gain taper */
tda18271_calc_gain_taper(fe, &freq);
tda18271_write_regs(fe, R_EP2, 1);
tda18271_write_regs(fe, R_EP1, 1);
tda18271_write_regs(fe, R_EP2, 1);
tda18271_write_regs(fe, R_EP1, 1);
regs[R_EB4] &= 0x07;
regs[R_EB4] |= 0x40;
tda18271_write_regs(fe, R_EB4, 1);
regs[R_EB7] = 0x40;
tda18271_write_regs(fe, R_EB7, 1);
msleep(10); /* pll locking */
regs[R_EB20] = 0xec;
tda18271_write_regs(fe, R_EB20, 1);
msleep(60); /* RF tracking filter calibration completion */
regs[R_EP4] &= ~0x03; /* set cal mode to normal */
tda18271_write_regs(fe, R_EP4, 1);
tda18271_write_regs(fe, R_EP1, 1);
/* RF tracking filter correction for VHF_Low band */
if (0 == tda18271_calc_rf_cal(fe, &freq))
tda18271_write_regs(fe, R_EB14, 1);
return 0;
}
/* ------------------------------------------------------------------ */
static int tda18271_ir_cal_init(struct dvb_frontend *fe)
{
struct tda18271_priv *priv = fe->tuner_priv;
unsigned char *regs = priv->tda18271_regs;
int ret;
ret = tda18271_read_regs(fe);
if (tda_fail(ret))
goto fail;
/* test IR_CAL_OK to see if we need init */
if ((regs[R_EP1] & 0x08) == 0)
ret = tda18271_init_regs(fe);
fail:
return ret;
}
static int tda18271_init(struct dvb_frontend *fe)
{
struct tda18271_priv *priv = fe->tuner_priv;
int ret;
mutex_lock(&priv->lock);
/* full power up */
ret = tda18271_set_standby_mode(fe, 0, 0, 0);
if (tda_fail(ret))
goto fail;
/* initialization */
ret = tda18271_ir_cal_init(fe);
if (tda_fail(ret))
goto fail;
if (priv->id == TDA18271HDC2)
tda18271c2_rf_cal_init(fe);
fail:
mutex_unlock(&priv->lock);
return ret;
}
static int tda18271_sleep(struct dvb_frontend *fe)
{
struct tda18271_priv *priv = fe->tuner_priv;
int ret;
mutex_lock(&priv->lock);
/* enter standby mode, with required output features enabled */
ret = tda18271_toggle_output(fe, 1);
mutex_unlock(&priv->lock);
return ret;
}
/* ------------------------------------------------------------------ */
static int tda18271_agc(struct dvb_frontend *fe)
{
struct tda18271_priv *priv = fe->tuner_priv;
int ret = 0;
switch (priv->config) {
case 0:
/* no external agc configuration required */
if (tda18271_debug & DBG_ADV)
tda_dbg("no agc configuration provided\n");
break;
case 3:
/* switch with GPIO of saa713x */
tda_dbg("invoking callback\n");
if (fe->callback)
ret = fe->callback(priv->i2c_props.adap->algo_data,
DVB_FRONTEND_COMPONENT_TUNER,
TDA18271_CALLBACK_CMD_AGC_ENABLE,
priv->mode);
break;
case 1:
case 2:
default:
/* n/a - currently not supported */
tda_err("unsupported configuration: %d\n", priv->config);
ret = -EINVAL;
break;
}
return ret;
}
static int tda18271_tune(struct dvb_frontend *fe,
struct tda18271_std_map_item *map, u32 freq, u32 bw)
{
struct tda18271_priv *priv = fe->tuner_priv;
int ret;
tda_dbg("freq = %d, ifc = %d, bw = %d, agc_mode = %d, std = %d\n",
freq, map->if_freq, bw, map->agc_mode, map->std);
ret = tda18271_agc(fe);
if (tda_fail(ret))
tda_warn("failed to configure agc\n");
ret = tda18271_init(fe);
if (tda_fail(ret))
goto fail;
mutex_lock(&priv->lock);
switch (priv->id) {
case TDA18271HDC1:
tda18271c1_rf_tracking_filter_calibration(fe, freq, bw);
break;
case TDA18271HDC2:
tda18271c2_rf_tracking_filters_correction(fe, freq);
break;
}
ret = tda18271_channel_configuration(fe, map, freq, bw);
mutex_unlock(&priv->lock);
fail:
return ret;
}
/* ------------------------------------------------------------------ */
static int tda18271_set_params(struct dvb_frontend *fe,
struct dvb_frontend_parameters *params)
{
struct tda18271_priv *priv = fe->tuner_priv;
struct tda18271_std_map *std_map = &priv->std;
struct tda18271_std_map_item *map;
int ret;
u32 bw, freq = params->frequency;
priv->mode = TDA18271_DIGITAL;
if (fe->ops.info.type == FE_ATSC) {
switch (params->u.vsb.modulation) {
case VSB_8:
case VSB_16:
map = &std_map->atsc_6;
break;
case QAM_64:
case QAM_256:
map = &std_map->qam_6;
break;
default:
tda_warn("modulation not set!\n");
return -EINVAL;
}
#if 0 /* keep */
/* userspace request is already center adjusted */
freq += 1750000; /* Adjust to center (+1.75MHZ) */
#endif
bw = 6000000;
} else if (fe->ops.info.type == FE_OFDM) {
switch (params->u.ofdm.bandwidth) {
case BANDWIDTH_6_MHZ:
bw = 6000000;
map = &std_map->dvbt_6;
break;
case BANDWIDTH_7_MHZ:
bw = 7000000;
map = &std_map->dvbt_7;
break;
case BANDWIDTH_8_MHZ:
bw = 8000000;
map = &std_map->dvbt_8;
break;
default:
tda_warn("bandwidth not set!\n");
return -EINVAL;
}
} else {
tda_warn("modulation type not supported!\n");
return -EINVAL;
}
/* When tuning digital, the analog demod must be tri-stated */
if (fe->ops.analog_ops.standby)
fe->ops.analog_ops.standby(fe);
ret = tda18271_tune(fe, map, freq, bw);
if (tda_fail(ret))
goto fail;
priv->frequency = freq;
priv->bandwidth = (fe->ops.info.type == FE_OFDM) ?
params->u.ofdm.bandwidth : 0;
fail:
return ret;
}
static int tda18271_set_analog_params(struct dvb_frontend *fe,
struct analog_parameters *params)
{
struct tda18271_priv *priv = fe->tuner_priv;
struct tda18271_std_map *std_map = &priv->std;
struct tda18271_std_map_item *map;
char *mode;
int ret;
u32 freq = params->frequency * 125 *
((params->mode == V4L2_TUNER_RADIO) ? 1 : 1000) / 2;
priv->mode = TDA18271_ANALOG;
if (params->mode == V4L2_TUNER_RADIO) {
map = &std_map->fm_radio;
mode = "fm";
} else if (params->std & V4L2_STD_MN) {
map = &std_map->atv_mn;
mode = "MN";
} else if (params->std & V4L2_STD_B) {
map = &std_map->atv_b;
mode = "B";
} else if (params->std & V4L2_STD_GH) {
map = &std_map->atv_gh;
mode = "GH";
} else if (params->std & V4L2_STD_PAL_I) {
map = &std_map->atv_i;
mode = "I";
} else if (params->std & V4L2_STD_DK) {
map = &std_map->atv_dk;
mode = "DK";
} else if (params->std & V4L2_STD_SECAM_L) {
map = &std_map->atv_l;
mode = "L";
} else if (params->std & V4L2_STD_SECAM_LC) {
map = &std_map->atv_lc;
mode = "L'";
} else {
map = &std_map->atv_i;
mode = "xx";
}
tda_dbg("setting tda18271 to system %s\n", mode);
ret = tda18271_tune(fe, map, freq, 0);
if (tda_fail(ret))
goto fail;
priv->frequency = freq;
priv->bandwidth = 0;
fail:
return ret;
}
static int tda18271_release(struct dvb_frontend *fe)
{
struct tda18271_priv *priv = fe->tuner_priv;
mutex_lock(&tda18271_list_mutex);
if (priv)
hybrid_tuner_release_state(priv);
mutex_unlock(&tda18271_list_mutex);
fe->tuner_priv = NULL;
return 0;
}
static int tda18271_get_frequency(struct dvb_frontend *fe, u32 *frequency)
{
struct tda18271_priv *priv = fe->tuner_priv;
*frequency = priv->frequency;
return 0;
}
static int tda18271_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
{
struct tda18271_priv *priv = fe->tuner_priv;
*bandwidth = priv->bandwidth;
return 0;
}
/* ------------------------------------------------------------------ */
#define tda18271_update_std(std_cfg, name) do { \
if (map->std_cfg.if_freq + \
map->std_cfg.agc_mode + map->std_cfg.std + \
map->std_cfg.if_lvl + map->std_cfg.rfagc_top > 0) { \
tda_dbg("Using custom std config for %s\n", name); \
memcpy(&std->std_cfg, &map->std_cfg, \
sizeof(struct tda18271_std_map_item)); \
} } while (0)
#define tda18271_dump_std_item(std_cfg, name) do { \
tda_dbg("(%s) if_freq = %d, agc_mode = %d, std = %d, " \
"if_lvl = %d, rfagc_top = 0x%02x\n", \
name, std->std_cfg.if_freq, \
std->std_cfg.agc_mode, std->std_cfg.std, \
std->std_cfg.if_lvl, std->std_cfg.rfagc_top); \
} while (0)
static int tda18271_dump_std_map(struct dvb_frontend *fe)
{
struct tda18271_priv *priv = fe->tuner_priv;
struct tda18271_std_map *std = &priv->std;
tda_dbg("========== STANDARD MAP SETTINGS ==========\n");
tda18271_dump_std_item(fm_radio, " fm ");
tda18271_dump_std_item(atv_b, "atv b ");
tda18271_dump_std_item(atv_dk, "atv dk");
tda18271_dump_std_item(atv_gh, "atv gh");
tda18271_dump_std_item(atv_i, "atv i ");
tda18271_dump_std_item(atv_l, "atv l ");
tda18271_dump_std_item(atv_lc, "atv l'");
tda18271_dump_std_item(atv_mn, "atv mn");
tda18271_dump_std_item(atsc_6, "atsc 6");
tda18271_dump_std_item(dvbt_6, "dvbt 6");
tda18271_dump_std_item(dvbt_7, "dvbt 7");
tda18271_dump_std_item(dvbt_8, "dvbt 8");
tda18271_dump_std_item(qam_6, "qam 6 ");
tda18271_dump_std_item(qam_8, "qam 8 ");
return 0;
}
static int tda18271_update_std_map(struct dvb_frontend *fe,
struct tda18271_std_map *map)
{
struct tda18271_priv *priv = fe->tuner_priv;
struct tda18271_std_map *std = &priv->std;
if (!map)
return -EINVAL;
tda18271_update_std(fm_radio, "fm");
tda18271_update_std(atv_b, "atv b");
tda18271_update_std(atv_dk, "atv dk");
tda18271_update_std(atv_gh, "atv gh");
tda18271_update_std(atv_i, "atv i");
tda18271_update_std(atv_l, "atv l");
tda18271_update_std(atv_lc, "atv l'");
tda18271_update_std(atv_mn, "atv mn");
tda18271_update_std(atsc_6, "atsc 6");
tda18271_update_std(dvbt_6, "dvbt 6");
tda18271_update_std(dvbt_7, "dvbt 7");
tda18271_update_std(dvbt_8, "dvbt 8");
tda18271_update_std(qam_6, "qam 6");
tda18271_update_std(qam_8, "qam 8");
return 0;
}
static int tda18271_get_id(struct dvb_frontend *fe)
{
struct tda18271_priv *priv = fe->tuner_priv;
unsigned char *regs = priv->tda18271_regs;
char *name;
int ret = 0;
mutex_lock(&priv->lock);
tda18271_read_regs(fe);
mutex_unlock(&priv->lock);
switch (regs[R_ID] & 0x7f) {
case 3:
name = "TDA18271HD/C1";
priv->id = TDA18271HDC1;
break;
case 4:
name = "TDA18271HD/C2";
priv->id = TDA18271HDC2;
break;
default:
name = "Unknown device";
ret = -EINVAL;
break;
}
tda_info("%s detected @ %d-%04x%s\n", name,
i2c_adapter_id(priv->i2c_props.adap),
priv->i2c_props.addr,
(0 == ret) ? "" : ", device not supported.");
return ret;
}
static struct dvb_tuner_ops tda18271_tuner_ops = {
.info = {
.name = "NXP TDA18271HD",
.frequency_min = 45000000,
.frequency_max = 864000000,
.frequency_step = 62500
},
.init = tda18271_init,
.sleep = tda18271_sleep,
.set_params = tda18271_set_params,
.set_analog_params = tda18271_set_analog_params,
.release = tda18271_release,
.get_frequency = tda18271_get_frequency,
.get_bandwidth = tda18271_get_bandwidth,
};
struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr,
struct i2c_adapter *i2c,
struct tda18271_config *cfg)
{
struct tda18271_priv *priv = NULL;
int instance;
mutex_lock(&tda18271_list_mutex);
instance = hybrid_tuner_request_state(struct tda18271_priv, priv,
hybrid_tuner_instance_list,
i2c, addr, "tda18271");
switch (instance) {
case 0:
goto fail;
case 1:
{
/* new tuner instance */
int rf_cal_on_startup;
priv->gate = (cfg) ? cfg->gate : TDA18271_GATE_AUTO;
priv->role = (cfg) ? cfg->role : TDA18271_MASTER;
priv->config = (cfg) ? cfg->config : 0;
priv->small_i2c = (cfg) ? cfg->small_i2c : 0;
priv->output_opt = (cfg) ?
cfg->output_opt : TDA18271_OUTPUT_LT_XT_ON;
/* tda18271_cal_on_startup == -1 when cal
* module option is unset */
if (tda18271_cal_on_startup == -1) {
/* honor attach-time configuration */
rf_cal_on_startup =
((cfg) && (cfg->r |