ina2xx.c (cb54b53adae70701bdd77d848cea4b9b39b61cf9) | ina2xx.c (a8b3a3a53f9a814e9938ea9cc179086ff5c0a387) |
---|---|
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: --- 218 unchanged lines hidden (view full) --- 227 228 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WORD_DATA)) 229 return -ENODEV; 230 231 data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); 232 if (!data) 233 return -ENOMEM; 234 | 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: --- 218 unchanged lines hidden (view full) --- 227 228 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WORD_DATA)) 229 return -ENODEV; 230 231 data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); 232 if (!data) 233 return -ENOMEM; 234 |
235 if (client->dev.platform_data) { | 235 if (dev_get_platdata(&client->dev)) { |
236 pdata = | 236 pdata = |
237 (struct ina2xx_platform_data *)client->dev.platform_data; | 237 (struct ina2xx_platform_data *)dev_get_platdata(&client->dev); |
238 shunt = pdata->shunt_uohms; 239 } else if (!of_property_read_u32(client->dev.of_node, 240 "shunt-resistor", &val)) { 241 shunt = val; 242 } 243 244 if (shunt <= 0) 245 return -ENODEV; --- 69 unchanged lines hidden --- | 238 shunt = pdata->shunt_uohms; 239 } else if (!of_property_read_u32(client->dev.of_node, 240 "shunt-resistor", &val)) { 241 shunt = val; 242 } 243 244 if (shunt <= 0) 245 return -ENODEV; --- 69 unchanged lines hidden --- |