BigW Consortium Gitlab

Commit 28823699 by David Frey

Cleanup formatting of battery code

parent dbe1e4b4
......@@ -2,7 +2,7 @@ export MANGOH_ROOT = $(shell pwd)
MKSYS_ARGS_COMMON = -s $(MANGOH_ROOT)/apps/GpioExpander/gpioExpanderService
MKSYS_ARGS_GREEN =
MKSYS_ARGS_RED = -s $(MANGOH_ROOT)/apps/RedSensorToCloud -i $(MANGOH_ROOT)/apps/BatteryService
MKSYS_ARGS_RED = -s $(MANGOH_ROOT)/apps/RedSensorToCloud
# The comments below are for Developer Studio integration. Do not remove them.
# DS_CLONE_ROOT(MANGOH_ROOT)
......
Subproject commit a4e1056b756ea8ef63941b5d3a7f0c917a4fa823
Subproject commit cba3d131ca6fe030598fb8e2c1684c84ba8177ec
sources:
{
bq24190-charger.c
bq24190-charger.c
}
......@@ -1289,7 +1289,7 @@ static int bq24190_hw_init(struct bq24190_dev_info *bdi)
pm_runtime_get_sync(bdi->dev);
/* First check that the device really is what its supposed to be */
/* First check that the device really is what its supposed to be */
ret = bq24190_read_mask(bdi, BQ24190_REG_VPRS,
BQ24190_REG_VPRS_PN_MASK,
BQ24190_REG_VPRS_PN_SHIFT,
......@@ -1301,7 +1301,7 @@ static int bq24190_hw_init(struct bq24190_dev_info *bdi)
ret = -ENODEV;
goto out;
}
ret = bq24190_register_reset(bdi);
if (ret < 0)
goto out;
......@@ -1364,50 +1364,37 @@ static int bq24190_probe(struct i2c_client *client,
struct bq24190_platform_data *pdata = client->dev.platform_data;
struct bq24190_dev_info *bdi;
int ret;
dev_err(&client->dev,"checking status at %d\n",__LINE__);
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) {
dev_err(dev, "No support for SMBUS_BYTE_DATA\n");
return -ENODEV;
}
dev_err(&client->dev,"checking status at %d\n",__LINE__);
bdi = devm_kzalloc(dev, sizeof(*bdi), GFP_KERNEL);
dev_err(&client->dev,"checking status at %d\n",__LINE__);
if (!bdi) {
dev_err(dev, "Can't alloc bdi struct\n");
return -ENOMEM;
}
dev_err(&client->dev,"checking status at %d\n",__LINE__);
bdi->client = client;
bdi->dev = dev;
bdi->model = id->driver_data;
dev_err(&client->dev,"checking status at %d\n",__LINE__);
strncpy(bdi->model_name, id->name, I2C_NAME_SIZE);
dev_err(&client->dev,"checking status at %d\n",__LINE__);
mutex_init(&bdi->f_reg_lock);
bdi->first_time = true;
bdi->charger_health_valid = false;
bdi->battery_health_valid = false;
bdi->battery_status_valid = false;
dev_err(&client->dev,"checking status at %d\n",__LINE__);
i2c_set_clientdata(client, bdi);
dev_err(&client->dev,"checking status at %d\n",__LINE__);
if (dev->of_node){
dev_err(&client->dev,"checking status at %d\n",__LINE__);
ret = bq24190_setup_dt(bdi);}
else{
dev_err(&client->dev,"checking status at %d\n",__LINE__);
ret = bq24190_setup_pdata(bdi, pdata);}
dev_err(&client->dev,"checking status at %d\n",__LINE__);
if (dev->of_node) {
ret = bq24190_setup_dt(bdi);
} else {
ret = bq24190_setup_pdata(bdi, pdata);
}
if (ret) {
dev_err(&client->dev, "Can't get irq info\n");
dev_err(&client->dev,"checking status at %d\n",__LINE__);
return -EINVAL;
}
dev_err(&client->dev,"checking status at %d\n",__LINE__);
ret = devm_request_threaded_irq(dev, bdi->irq, NULL,
bq24190_irq_handler_thread,
IRQF_TRIGGER_RISING | IRQF_ONESHOT,
......@@ -1425,7 +1412,7 @@ static int bq24190_probe(struct i2c_client *client,
dev_err(dev, "Hardware init failed\n");
goto out2;
}
bq24190_charger_init(&bdi->charger);
ret = power_supply_register(dev, &bdi->charger);
......@@ -1441,9 +1428,7 @@ static int bq24190_probe(struct i2c_client *client,
dev_err(dev, "Can't register battery\n");
goto out3;
}
dev_err(&client->dev,"checking status at %d\n",__LINE__);
ret = bq24190_sysfs_create_group(bdi);
dev_err(&client->dev,"checking status at %d\n",__LINE__);
if (ret) {
dev_err(dev, "Can't create sysfs entries\n");
goto out4;
......
......@@ -423,31 +423,23 @@ static int ltc294x_i2c_probe(struct i2c_client *client,
u32 prescaler_exp;
u8 status;
info = devm_kzalloc(&client->dev, sizeof(*info), GFP_KERNEL);
info = devm_kzalloc(&client->dev, sizeof(*info), GFP_KERNEL);
if (info == NULL)
return -ENOMEM;
dev_err(&client->dev, "reached line at %d\n", __LINE__);
i2c_set_clientdata(client, info);
dev_err(&client->dev, "reached line at %d\n", __LINE__);
// DF
platform_data = client->dev.platform_data;
dev_err(&client->dev, "reached line at %d\n", __LINE__);
info->id = platform_data->chip_id;
dev_err(&client->dev, "reached line at %d\n", __LINE__);
info->supply.name = platform_data->name;
dev_err(&client->dev, "reached line at %d\n", __LINE__);
/* r_sense can be negative, when sense+ is connected to the battery
* instead of the sense-. This results in reversed measurements. */
info->r_sense = platform_data->r_sense;
dev_err(&client->dev, "reached line at %d\n", __LINE__);
prescaler_exp = platform_data->prescaler_exp;
dev_err(&client->dev, "reached line at %d\n", __LINE__);
if (info->id == LTC2943_ID) {
if (prescaler_exp > LTC2943_MAX_PRESCALER_EXP)
......@@ -461,7 +453,6 @@ static int ltc294x_i2c_probe(struct i2c_client *client,
(128 / (1 << prescaler_exp));
}
dev_err(&client->dev, "reached line at %d\n", __LINE__);
/* Read status register to check for LTC2942 */
if (info->id == LTC2941_ID || info->id == LTC2942_ID) {
ret = ltc294x_read_regs(client, LTC294X_REG_STATUS, &status, 1);
......@@ -495,7 +486,6 @@ static int ltc294x_i2c_probe(struct i2c_client *client,
ARRAY_SIZE(ltc294x_properties) - 3;
break;
}
dev_err(&client->dev, "reached line at %d\n", __LINE__);
info->supply.get_property = ltc294x_get_property;
info->supply.set_property = ltc294x_set_property;
info->supply.property_is_writeable = ltc294x_property_is_writeable;
......
......@@ -12,9 +12,9 @@ enum ltc294x_id {
struct ltc294x_platform_data
{
enum ltc294x_id chip_id;
int r_sense;
int r_sense;
u32 prescaler_exp;
const char *name;
const char *name;
};
#endif /* LTC294X_PLATFORM_DATA_H */
......
......@@ -2,7 +2,6 @@ cflags:
{
// Needed for lsm6ds3 platform data type definition
-I${MANGOH_ROOT}/linux_kernel_modules/lsm6ds3
-I${MANGOH_ROOT}/linux_kernel_modules/ltc294x
}
......
......@@ -78,6 +78,6 @@ kernelModules:
// Only on mangOH Red DV4
$MANGOH_ROOT/linux_kernel_modules/ltc294x/0-ltc294x.mdef
// Required for BQ24296
// Required for BQ24296
$MANGOH_ROOT/linux_kernel_modules/bq24296/0-bq24296.mdef
}
Subproject commit 7ace92fdf34d51c58def5883ffd31dca4eef7b1f
Subproject commit 9fa6a660e8bce919e336345069102739674f21c4
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment