ina2xx.c (5d389b125186cf254ad5b8015763ac07c151aea4) | ina2xx.c (0c4c5860e9983eb3da7a3d73ca987643c3ed034b) |
---|---|
1/* 2 * Driver for Texas Instruments INA219, INA226 power monitor chips 3 * 4 * INA219: 5 * Zero Drift Bi-Directional Current/Power Monitor with I2C Interface 6 * Datasheet: http://www.ti.com/product/ina219 7 * 8 * INA220: --- 440 unchanged lines hidden (view full) --- 449 chip = id->driver_data; 450 451 data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); 452 if (!data) 453 return -ENOMEM; 454 455 /* set the device type */ 456 data->config = &ina2xx_config[chip]; | 1/* 2 * Driver for Texas Instruments INA219, INA226 power monitor chips 3 * 4 * INA219: 5 * Zero Drift Bi-Directional Current/Power Monitor with I2C Interface 6 * Datasheet: http://www.ti.com/product/ina219 7 * 8 * INA220: --- 440 unchanged lines hidden (view full) --- 449 chip = id->driver_data; 450 451 data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); 452 if (!data) 453 return -ENOMEM; 454 455 /* set the device type */ 456 data->config = &ina2xx_config[chip]; |
457 mutex_init(&data->config_lock); |
|
457 458 if (of_property_read_u32(dev->of_node, "shunt-resistor", &val) < 0) { 459 struct ina2xx_platform_data *pdata = dev_get_platdata(dev); 460 461 if (pdata) 462 val = pdata->shunt_uohms; 463 else 464 val = INA2XX_RSHUNT_DEFAULT; --- 10 unchanged lines hidden (view full) --- 475 } 476 477 ret = ina2xx_init(data); 478 if (ret < 0) { 479 dev_err(dev, "error configuring the device: %d\n", ret); 480 return -ENODEV; 481 } 482 | 458 459 if (of_property_read_u32(dev->of_node, "shunt-resistor", &val) < 0) { 460 struct ina2xx_platform_data *pdata = dev_get_platdata(dev); 461 462 if (pdata) 463 val = pdata->shunt_uohms; 464 else 465 val = INA2XX_RSHUNT_DEFAULT; --- 10 unchanged lines hidden (view full) --- 476 } 477 478 ret = ina2xx_init(data); 479 if (ret < 0) { 480 dev_err(dev, "error configuring the device: %d\n", ret); 481 return -ENODEV; 482 } 483 |
483 mutex_init(&data->config_lock); 484 | |
485 data->groups[group++] = &ina2xx_group; 486 if (id->driver_data == ina226) 487 data->groups[group++] = &ina226_group; 488 489 hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name, 490 data, data->groups); 491 if (IS_ERR(hwmon_dev)) 492 return PTR_ERR(hwmon_dev); --- 56 unchanged lines hidden --- | 484 data->groups[group++] = &ina2xx_group; 485 if (id->driver_data == ina226) 486 data->groups[group++] = &ina226_group; 487 488 hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name, 489 data, data->groups); 490 if (IS_ERR(hwmon_dev)) 491 return PTR_ERR(hwmon_dev); --- 56 unchanged lines hidden --- |