BigW Consortium Gitlab

Commit a6833e90 by Ashish Syal

Updated bq24296 driver for mangOH Red

parent b049a36f
sources:
{
bq24190-charger.c
}
......@@ -18,7 +18,7 @@
#include <linux/gpio.h>
#include <linux/i2c.h>
#include <linux/power/bq24190_charger.h>
#include "bq24190-platform-data.h"
#define BQ24190_MANUFACTURER "Texas Instruments"
......@@ -129,9 +129,9 @@
#define BQ24190_REG_F_NTC_FAULT_SHIFT 0
#define BQ24190_REG_VPRS 0x0A /* Vendor/Part/Revision Status */
#define BQ24190_REG_VPRS_PN_MASK (BIT(5) | BIT(4) | BIT(3))
#define BQ24190_REG_VPRS_PN_SHIFT 3
#define BQ24190_REG_VPRS_PN_24190 0x4
#define BQ24190_REG_VPRS_PN_MASK (BIT(7) | BIT(6) | BIT(5))
#define BQ24190_REG_VPRS_PN_SHIFT 5
#define BQ24190_REG_VPRS_PN_24190 0x1
#define BQ24190_REG_VPRS_PN_24192 0x5 /* Also 24193 */
#define BQ24190_REG_VPRS_PN_24192I 0x3
#define BQ24190_REG_VPRS_TS_PROFILE_MASK BIT(2)
......@@ -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,
......@@ -1364,40 +1364,50 @@ 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)
ret = bq24190_setup_dt(bdi);
else
ret = bq24190_setup_pdata(bdi, pdata);
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 (ret) {
dev_err(dev, "Can't get irq info\n");
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,
......@@ -1431,8 +1441,9 @@ 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;
......
......@@ -6,11 +6,11 @@
* published by the Free Software Foundation.
*/
#ifndef _BQ24190_CHARGER_H_
#define _BQ24190_CHARGER_H_
#ifndef BQ24190_PLATFORM_DATA_H_
#define BQ24190_PLATFORM_DATA_H_
struct bq24190_platform_data {
unsigned int gpio_int; /* GPIO pin that's connected to INT# */
int gpio_int; /* GPIO pin that's connected to INT# */
};
#endif
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