예제 #1
0
static int lnb_newprobe(struct i2c_client *client, const struct i2c_device_id *id)
{
	if (lnb_client)
	{
		dprintk(10, "Failure, client already registered\n");
		return -ENODEV;
	}

	dprintk(10, "I2C device found at address 0x%02x\n", client->addr);

	switch(devType)
	{
		case A8293:
		{
			a8293_init(client);
			break;
		}
		case LNB24:
		{
			lnb24_init(client);
			break;
		}
		case LNB_PIO:
		{
			lnb_pio_init();
			break;
		}
		default:
		{
			return -ENODEV;
		}
	}
	lnb_client = client;
	return 0;
}
예제 #2
0
int __init lnb_init(void)
{
	int res, err;
	const char *name;

	struct i2c_board_info info;
	err = lnb_detect(NULL, -1, &info);
	name = info.type;

	if (err)
	{
		dprintk(1, "Unknown LNB type\n");
		return err;
	}

	if (devType == LNB_PIO)
	{
		res = lnb_pio_init();
		if (res)
		{
			dprintk(1, "Init LNB PIO failed\n");
			return res;
		}
	}
	else
	{
		res = i2c_add_driver(&lnb_i2c_driver);
		if (res)
		{
			dprintk(1, "Adding i2c driver failed\n");
			return res;
		}
	}

	if (!lnb_client)
	{
		dprintk(1, "No client found\n");
		i2c_del_driver(&lnb_i2c_driver);
		return -EIO;
	}
	
	if (register_chrdev(LNB_MAJOR, "LNB", &lnb_fops) < 0)
	{
		dprintk(1, "Unable to register device\n");
		if (devType == LNB_PIO)
		{
			lnb_pio_exit();
		}
		else
		{
			i2c_del_driver(&lnb_i2c_driver);
		}
		return -EIO;
	}
	dprintk(1,"module lnb loaded, type: %s\n", name);
	return 0;
}
예제 #3
0
파일: lnb_core.c 프로젝트: Greder/ACC
int __init lnb_init(void)
{
	int res, err;
	const char *name;

#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)
	err = lnb_detect(NULL, -1, &name);
#else
	struct i2c_board_info info;
	err = lnb_detect(NULL, -1, &info);
	name = info.type;
#endif

	if (err) {
		printk("[LNB]: Error detecting lnb type!\n");
		return err;
	}

	dprintk("[LNB] lnb power control handling, type: %s\n", name);

	if(devType == LNB_PIO) {
		if ((res = lnb_pio_init())) {
			dprintk("[LNB] init lnb pio failed\n");
			return res;
		}
	} else {
		if ((res = i2c_add_driver(&lnb_i2c_driver))) {
			dprintk("[LNB] i2c add driver failed\n");
			return res;
		}

		if (!lnb_client) {
			printk(KERN_ERR "[LNB] no client found\n");
			i2c_del_driver(&lnb_i2c_driver);
			return -EIO;
		}
	}

	if (register_chrdev(LNB_MAJOR,"LNB",&lnb_fops)<0) {
		printk(KERN_ERR "[LNB] unable to register device\n");
		if(devType == LNB_PIO)
			lnb_pio_exit();
		else
			i2c_del_driver(&lnb_i2c_driver);
		return -EIO;
	}

	return 0;
}
예제 #4
0
파일: lnb_core.c 프로젝트: Greder/ACC
static int lnb_newprobe(struct i2c_client *client, const struct i2c_device_id *id)
{
	if (lnb_client) {
		dprintk("[LNB]: failure, client already registered\n");
		return -ENODEV;
	}

	dprintk("[LNB]: chip found @ 0x%x\n", client->addr);

	switch(devType)
	{
	case A8293:   a8293_init(client);   break;
	case LNB24:   lnb24_init(client);   break;
	case LNB_PIO: lnb_pio_init();		break;
	default: return -ENODEV;
	}
	lnb_client = client;
	return 0;
}