Beispiel #1
0
struct dvb_frontend *microtune_attach(struct dvb_frontend *fe,
                                      struct i2c_adapter* i2c_adap,
                                      u8 i2c_addr)
{
    struct microtune_priv *priv = NULL;
    char *name;
    unsigned char buf[21];
    int company_code;

    priv = kzalloc(sizeof(struct microtune_priv), GFP_KERNEL);
    if (priv == NULL)
        return NULL;
    fe->tuner_priv = priv;

    priv->i2c_props.addr = i2c_addr;
    priv->i2c_props.adap = i2c_adap;
    priv->i2c_props.name = "mt20xx";

    //priv->radio_if2 = 10700 * 1000;	/* 10.7MHz - FM radio */

    memset(buf,0,sizeof(buf));

    name = "unknown";

    tuner_i2c_xfer_send(&priv->i2c_props,buf,1);
    tuner_i2c_xfer_recv(&priv->i2c_props,buf,21);
    if (debug)
        tuner_dbg("MT20xx hexdump: %*ph\n", 21, buf);

    company_code = buf[0x11] << 8 | buf[0x12];
    tuner_info("microtune: companycode=%04x part=%02x rev=%02x\n",
               company_code,buf[0x13],buf[0x14]);


    if (buf[0x13] < ARRAY_SIZE(microtune_part) &&
            NULL != microtune_part[buf[0x13]])
        name = microtune_part[buf[0x13]];
    switch (buf[0x13]) {
    case MT2032:
        mt2032_init(fe);
        break;
    case MT2050:
        mt2050_init(fe);
        break;
    default:
        tuner_info("microtune %s found, not (yet?) supported, sorry :-/\n",
                   name);
        return NULL;
    }

    strlcpy(fe->ops.tuner_ops.info.name, name,
            sizeof(fe->ops.tuner_ops.info.name));
    tuner_info("microtune %s found, OK\n",name);
    return fe;
}
Beispiel #2
0
int microtune_init(struct i2c_client *c)
{
	struct tuner *t = i2c_get_clientdata(c);
	char *name;
        unsigned char buf[21];
	int company_code;

	memset(buf,0,sizeof(buf));
	t->tv_freq    = NULL;
	t->radio_freq = NULL;
	t->standby    = NULL;
	name = "unknown";

        i2c_master_send(c,buf,1);
        i2c_master_recv(c,buf,21);
        if (tuner_debug) {
                int i;
		tuner_dbg("MT20xx hexdump:");
                for(i=0;i<21;i++) {
                        printk(" %02x",buf[i]);
                        if(((i+1)%8)==0) printk(" ");
                }
                printk("\n");
        }
	company_code = buf[0x11] << 8 | buf[0x12];
	tuner_info("microtune: companycode=%04x part=%02x rev=%02x\n",
		   company_code,buf[0x13],buf[0x14]);


	if (buf[0x13] < ARRAY_SIZE(microtune_part) &&
	    NULL != microtune_part[buf[0x13]])
		name = microtune_part[buf[0x13]];
	switch (buf[0x13]) {
	case MT2032:
		mt2032_init(c);
		break;
	case MT2050:
		mt2050_init(c);
		break;
	default:
		tuner_info("microtune %s found, not (yet?) supported, sorry :-/\n",
			   name);
                return 0;
        }

	strlcpy(c->name, name, sizeof(c->name));
	tuner_info("microtune %s found, OK\n",name);
	return 0;
}