diff options
author | Syed Rafiuddin <srafiuddin@nvidia.com> | 2013-03-01 14:10:03 +0530 |
---|---|---|
committer | Mrutyunjay Sawant <msawant@nvidia.com> | 2013-03-06 06:22:59 -0800 |
commit | b2183dca8729336665f97a19a0e6edfd588a248e (patch) | |
tree | b86af25e0808ca2cf4b5dea68e8fc991d12c2a50 /include | |
parent | 8e1d798187c653c0802e9462fc3ed8d6d59b4c77 (diff) |
power: bq2419x: Implement WDT timer
BQ2419X support the WDT timer which reset the configuration
on expiration. Handling the WDT timer to proper functiong of device.
Following are details of changes:
- Implement WDT reset in kthread with high priority.
- Configure WDT time based on platform data,
- Merge the VBUS regulator in the charger driver itself as
charger or VBUS can happen mutually.
- Displaying the charging fault when happens.
- Other cleanups to reduce code size and make better readability.
- Related chnages in board file.
Bug 1240114
Change-Id: Iefa79b7c0c791e8a1d69b44d9399aab7730a2da9
Signed-off-by: Syed Rafiuddin <srafiuddin@nvidia.com>
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/205495
Reviewed-by: Mrutyunjay Sawant <msawant@nvidia.com>
Tested-by: Mrutyunjay Sawant <msawant@nvidia.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/power/bq2419x-charger.h | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/include/linux/power/bq2419x-charger.h b/include/linux/power/bq2419x-charger.h new file mode 100644 index 000000000000..577777e6c0ec --- /dev/null +++ b/include/linux/power/bq2419x-charger.h @@ -0,0 +1,122 @@ +/* + * bq2419x-charger.h -- BQ24190/BQ24192/BQ24192i/BQ24193 Charger driver + * + * Copyright (C) 2012 - 2013 NVIDIA Corporation + + * Author: Laxman Dewangan <ldewangan@nvidia.com> + * Author: Syed Rafiuddin <srafiuddin@nvidia.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef __LINUX_POWER_BQ2419X_CHARGER_H +#define __LINUX_POWER_BQ2419X_CHARGER_H + + +/* Register definitions */ +#define BQ2419X_INPUT_SRC_REG 0x00 +#define BQ2419X_PWR_ON_REG 0x01 +#define BQ2419X_CHRG_CTRL_REG 0x02 +#define BQ2419X_CHRG_TERM_REG 0x03 +#define BQ2419X_VOLT_CTRL_REG 0x04 +#define BQ2419X_TIME_CTRL_REG 0x05 +#define BQ2419X_THERM_REG 0x06 +#define BQ2419X_MISC_OPER_REG 0x07 +#define BQ2419X_SYS_STAT_REG 0x08 +#define BQ2419X_FAULT_REG 0x09 +#define BQ2419X_REVISION_REG 0x0a + +#define BQ24190_IC_VER 0x40 +#define BQ24192_IC_VER 0x28 +#define BQ24192i_IC_VER 0x18 + +#define BQ2419X_ENABLE_CHARGE_MASK 0x30 +#define BQ2419X_ENABLE_CHARGE 0x10 +#define BQ2419X_ENABLE_VBUS 0x20 + +#define BQ2419X_REG0 0x0 +#define BQ2419X_EN_HIZ BIT(7) + +#define BQ2419X_WD 0x5 +#define BQ2419X_WD_MASK 0x30 +#define BQ2419X_WD_DISABLE 0x00 +#define BQ2419X_WD_40ms 0x10 +#define BQ2419X_WD_80ms 0x20 +#define BQ2419X_WD_160ms 0x30 + +#define BQ2419x_VBUS_STAT 0xc0 +#define BQ2419x_VBUS_UNKNOWN 0x00 +#define BQ2419x_VBUS_USB 0x40 +#define BQ2419x_VBUS_AC 0x80 + +#define BQ2419x_CHRG_STATE_MASK 0x30 +#define BQ2419x_CHRG_STATE_NOTCHARGING 0x00 +#define BQ2419x_CHRG_STATE_PRE_CHARGE 0x10 +#define BQ2419x_CHRG_STATE_POST_CHARGE 0x20 +#define BQ2419x_CHRG_STATE_CHARGE_DONE 0x30 + +#define BQ2419x_FAULT_WATCHDOG_FAULT BIT(7) +#define BQ2419x_FAULT_BOOST_FAULT BIT(6) +#define BQ2419x_FAULT_CHRG_FAULT_MASK 0x30 +#define BQ2419x_FAULT_CHRG_NORMAL 0x00 +#define BQ2419x_FAULT_CHRG_INPUT 0x10 +#define BQ2419x_FAULT_CHRG_THERMAL 0x20 +#define BQ2419x_FAULT_CHRG_SAFTY 0x30 + +#define BQ2419x_FAULT_NTC_FAULT 0x07 + +#define BQ2419x_CONFIG_MASK 0x7 +#define BQ2419X_MAX_REGS (BQ2419X_REVISION_REG + 1) + +/* + * struct bq2419x_vbus_platform_data - bq2419x VBUS platform data. + * + * @gpio_otg_iusb: GPIO number for OTG/IUSB + * @num_consumer_supplies: Number fo consumer for vbus regulators. + * @consumer_supplies: List of consumer suppliers. + */ +struct bq2419x_vbus_platform_data { + int gpio_otg_iusb; + int num_consumer_supplies; + struct regulator_consumer_supply *consumer_supplies; +}; + +/* + * struct bq2419x_charger_platform_data - bq2419x charger platform data. + */ +struct bq2419x_charger_platform_data { + unsigned use_mains:1; + unsigned use_usb:1; + void (*update_status)(int, int); + int (*battery_check)(void); + + int max_charge_volt_mV; + int max_charge_current_mA; + int charging_term_current_mA; + int wdt_timeout; + int num_consumer_supplies; + struct regulator_consumer_supply *consumer_supplies; +}; + +/* + * struct bq2419x_platform_data - bq2419x platform data. + */ +struct bq2419x_platform_data { + struct bq2419x_vbus_platform_data *vbus_pdata; + struct bq2419x_charger_platform_data *bcharger_pdata; +}; + +#endif /* __LINUX_POWER_BQ2419X_CHARGER_H */ |