예제 #1
0
파일: cmd_i2c.c 프로젝트: 32bitmicro/xvisor
static int cmd_i2c_list(struct vmm_chardev *cdev,
			int __unused argc,
			char __unused **argv)
{
	vmm_cprintf(cdev, "----------------------------------------"
			  "----------------------------------------\n");
	vmm_cprintf(cdev, "%-2s %-16s %-16s %-16s\n", "ID", "Name", "Type",
		    "Parent");
	vmm_cprintf(cdev, "----------------------------------------"
			  "----------------------------------------\n");
	i2c_for_each_dev(cdev, i2c_print_dev);
	vmm_cprintf(cdev, "----------------------------------------"
			  "----------------------------------------\n");

	return 0;
}
/*Find all lm75 devices and return sum of temperatures.*/
static ssize_t get_sys_temp(struct device *dev, struct device_attribute *da,
                            char *buf)
{
    ssize_t ret = 0;
    struct as7712_32x_fan_data *data = as7712_32x_fan_update_device(dev);

    data->system_temp=0;
    data->sensors_found=0;
    i2c_for_each_dev(data, _find_lm75_device);
    if (NUM_THERMAL_SENSORS != data->sensors_found)
    {
        dev_dbg(dev,"only %d of %d temps are found\n",
                data->sensors_found, NUM_THERMAL_SENSORS);
        data->system_temp = INT_MAX;
    }
    ret = sprintf(buf, "%d\n",data->system_temp);
    return ret;
}
예제 #3
0
파일: ddc.c 프로젝트: magestik/glasses3d
void i2c_dev_init(void) {
	int res;
	/*
	printk(KERN_INFO "i2c /dev entries driver\n");
	res = register_chrdev(I2C_MAJOR, "i2c", &i2cdev_fops);
	if (res)
		goto out;
	*/
	i2c_dev_class = class_create(THIS_MODULE, "i2c-dev");
	if (IS_ERR(i2c_dev_class)) {
		res = PTR_ERR(i2c_dev_class);
		return;
		//goto out_unreg_chrdev;
	}
	
	/* Keep track of adapters which will be added or removed later */
	res = bus_register_notifier(&i2c_bus_type, &i2cdev_notifier);
	if (res)
		return;
		
	/* Bind to already existing adapters right away */
	i2c_for_each_dev(NULL, i2cdev_attach_adapter);
}
예제 #4
0
파일: ddc.c 프로젝트: magestik/glasses3d
void i2c_dev_exit(void) {
	bus_unregister_notifier(&i2c_bus_type, &i2cdev_notifier);
	i2c_for_each_dev(NULL, i2cdev_detach_adapter);
	class_destroy(i2c_dev_class);
	//unregister_chrdev(I2C_MAJOR, "i2c");
}