From 849369d6c66d3054688672f97d31fceb8e8230fb Mon Sep 17 00:00:00 2001 From: root Date: Fri, 25 Dec 2015 04:40:36 +0000 Subject: initial_commit --- include/linux/power/bq20z75.h | 39 +++++++ include/linux/power/bq27x00_battery.h | 19 ++++ include/linux/power/gpio-charger.h | 41 +++++++ include/linux/power/isp1704_charger.h | 29 +++++ include/linux/power/jz4740-battery.h | 24 +++++ include/linux/power/max17042_battery.h | 30 ++++++ include/linux/power/max8903_battery.h | 62 +++++++++++ include/linux/power/max8903_charger.h | 61 +++++++++++ include/linux/power/ricoh619_battery.h | 159 ++++++++++++++++++++++++++++ include/linux/power/ricoh619_standby.h | 9 ++ include/linux/power/ricoh61x_battery_init.h | 35 ++++++ include/linux/power/sabresd_battery.h | 63 +++++++++++ 12 files changed, 571 insertions(+) create mode 100644 include/linux/power/bq20z75.h create mode 100644 include/linux/power/bq27x00_battery.h create mode 100644 include/linux/power/gpio-charger.h create mode 100644 include/linux/power/isp1704_charger.h create mode 100644 include/linux/power/jz4740-battery.h create mode 100644 include/linux/power/max17042_battery.h create mode 100755 include/linux/power/max8903_battery.h create mode 100644 include/linux/power/max8903_charger.h create mode 100755 include/linux/power/ricoh619_battery.h create mode 100755 include/linux/power/ricoh619_standby.h create mode 100755 include/linux/power/ricoh61x_battery_init.h create mode 100644 include/linux/power/sabresd_battery.h (limited to 'include/linux/power') diff --git a/include/linux/power/bq20z75.h b/include/linux/power/bq20z75.h new file mode 100644 index 00000000..b0843b68 --- /dev/null +++ b/include/linux/power/bq20z75.h @@ -0,0 +1,39 @@ +/* + * Gas Gauge driver for TI's BQ20Z75 + * + * Copyright (c) 2010, NVIDIA Corporation. + * + * 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_BQ20Z75_H_ +#define __LINUX_POWER_BQ20Z75_H_ + +#include +#include + +/** + * struct bq20z75_platform_data - platform data for bq20z75 devices + * @battery_detect: GPIO which is used to detect battery presence + * @battery_detect_present: gpio state when battery is present (0 / 1) + * @i2c_retry_count: # of times to retry on i2c IO failure + */ +struct bq20z75_platform_data { + int battery_detect; + int battery_detect_present; + int i2c_retry_count; +}; + +#endif diff --git a/include/linux/power/bq27x00_battery.h b/include/linux/power/bq27x00_battery.h new file mode 100644 index 00000000..a857f719 --- /dev/null +++ b/include/linux/power/bq27x00_battery.h @@ -0,0 +1,19 @@ +#ifndef __LINUX_BQ27X00_BATTERY_H__ +#define __LINUX_BQ27X00_BATTERY_H__ + +/** + * struct bq27000_plaform_data - Platform data for bq27000 devices + * @name: Name of the battery. If NULL the driver will fallback to "bq27000". + * @read: HDQ read callback. + * This function should provide access to the HDQ bus the battery is + * connected to. + * The first parameter is a pointer to the battery device, the second the + * register to be read. The return value should either be the content of + * the passed register or an error value. + */ +struct bq27000_platform_data { + const char *name; + int (*read)(struct device *dev, unsigned int); +}; + +#endif diff --git a/include/linux/power/gpio-charger.h b/include/linux/power/gpio-charger.h new file mode 100644 index 00000000..de1dfe09 --- /dev/null +++ b/include/linux/power/gpio-charger.h @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2010, Lars-Peter Clausen + * + * 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. + * + * 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., + * 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __LINUX_POWER_GPIO_CHARGER_H__ +#define __LINUX_POWER_GPIO_CHARGER_H__ + +#include +#include + +/** + * struct gpio_charger_platform_data - platform_data for gpio_charger devices + * @name: Name for the chargers power_supply device + * @type: Type of the charger + * @gpio: GPIO which is used to indicate the chargers status + * @gpio_active_low: Should be set to 1 if the GPIO is active low otherwise 0 + * @supplied_to: Array of battery names to which this chargers supplies power + * @num_supplicants: Number of entries in the supplied_to array + */ +struct gpio_charger_platform_data { + const char *name; + enum power_supply_type type; + + int gpio; + int gpio_active_low; + + char **supplied_to; + size_t num_supplicants; +}; + +#endif diff --git a/include/linux/power/isp1704_charger.h b/include/linux/power/isp1704_charger.h new file mode 100644 index 00000000..68096a6a --- /dev/null +++ b/include/linux/power/isp1704_charger.h @@ -0,0 +1,29 @@ +/* + * ISP1704 USB Charger Detection driver + * + * Copyright (C) 2011 Nokia Corporation + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + +#ifndef __ISP1704_CHARGER_H +#define __ISP1704_CHARGER_H + +struct isp1704_charger_data { + void (*set_power)(bool on); +}; + +#endif diff --git a/include/linux/power/jz4740-battery.h b/include/linux/power/jz4740-battery.h new file mode 100644 index 00000000..19c9610c --- /dev/null +++ b/include/linux/power/jz4740-battery.h @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2009, Jiejing Zhang + * + * 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. + * + * 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., + * 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __JZ4740_BATTERY_H +#define __JZ4740_BATTERY_H + +struct jz_battery_platform_data { + struct power_supply_info info; + int gpio_charge; /* GPIO port of Charger state */ + int gpio_charge_active_low; +}; + +#endif diff --git a/include/linux/power/max17042_battery.h b/include/linux/power/max17042_battery.h new file mode 100644 index 00000000..7995deb8 --- /dev/null +++ b/include/linux/power/max17042_battery.h @@ -0,0 +1,30 @@ +/* + * Fuel gauge driver for Maxim 17042 / 8966 / 8997 + * Note that Maxim 8966 and 8997 are mfd and this is its subdevice. + * + * Copyright (C) 2011 Samsung Electronics + * MyungJoo Ham + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __MAX17042_BATTERY_H_ +#define __MAX17042_BATTERY_H_ + +struct max17042_platform_data { + bool enable_current_sense; +}; + +#endif /* __MAX17042_BATTERY_H_ */ diff --git a/include/linux/power/max8903_battery.h b/include/linux/power/max8903_battery.h new file mode 100755 index 00000000..b2828705 --- /dev/null +++ b/include/linux/power/max8903_battery.h @@ -0,0 +1,62 @@ +/* + * max8903_battery.h - Maxim 8903 USB/Adapter Charger Driver + * + * Copyright (C) 2011 Samsung Electronics + * Copyright (C) 2011-2012 Freescale Semiconductor, Inc. + * Based on max8903_charger.h + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef __MAX8903_BATTERY_H__ +#define __MAX8903_BATTERY_H__ + +struct max8903_pdata { + /* + * GPIOs + * cen, chg, flt, and usus are optional. + * dok, dcm, and uok are not optional depending on the status of + * dc_valid and usb_valid. + */ + int cen; /* Charger Enable input */ + int dok; /* DC(Adapter) Power OK output */ + int uok; /* USB Power OK output */ + int chg; /* Charger status output */ + int flt; /* Fault output */ + int dcm; /* Current-Limit Mode input (1: DC, 2: USB) */ + int usus; /* USB Suspend Input (1: suspended) */ + + /* DCM wired to Logic High + Set this true when DCM pin connect to Logic high.*/ + bool dcm_always_high; + + /* + * DC(Adapter/TA) is wired + * When dc_valid is true, + * dok and dcm should be valid. + * + * At least one of dc_valid or usb_valid should be true. + */ + bool dc_valid; + /* + * USB is wired + * When usb_valid is true, + * uok should be valid. + */ + bool usb_valid; +}; + +#endif /* __MAX8903_BATTERY_H__ */ diff --git a/include/linux/power/max8903_charger.h b/include/linux/power/max8903_charger.h new file mode 100644 index 00000000..ea5b6267 --- /dev/null +++ b/include/linux/power/max8903_charger.h @@ -0,0 +1,61 @@ +/* + * max8903_charger.h - Maxim 8903 USB/Adapter Charger Driver + * + * Copyright (C) 2011 Samsung Electronics + * MyungJoo Ham + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef __MAX8903_CHARGER_H__ +#define __MAX8903_CHARGER_H__ + +struct max8903_pdata { + /* + * GPIOs + * cen, chg, flt, and usus are optional. + * dok, dcm, and uok are not optional depending on the status of + * dc_valid and usb_valid. + */ + int cen; /* Charger Enable input */ + int dok; /* DC(Adapter) Power OK output */ + int uok; /* USB Power OK output */ + int chg; /* Charger status output */ + int flt; /* Fault output */ + int dcm; /* Current-Limit Mode input (1: DC, 2: USB) */ + int usus; /* USB Suspend Input (1: suspended) */ + + /* DCM wired to Logic High + Set this true when DCM pin connect to Logic high.*/ + bool dcm_always_high; + + /* + * DC(Adapter/TA) is wired + * When dc_valid is true, + * dok and dcm should be valid. + * + * At least one of dc_valid or usb_valid should be true. + */ + bool dc_valid; + /* + * USB is wired + * When usb_valid is true, + * uok should be valid. + */ + bool usb_valid; +}; + +#endif /* __MAX8903_CHARGER_H__ */ diff --git a/include/linux/power/ricoh619_battery.h b/include/linux/power/ricoh619_battery.h new file mode 100755 index 00000000..c197f7a4 --- /dev/null +++ b/include/linux/power/ricoh619_battery.h @@ -0,0 +1,159 @@ +/* + * include/linux/power/ricoh619_battery.h + * + * RICOH RC5T619 Charger Driver + * + * Copyright (C) 2012-2014 RICOH COMPANY,LTD + * + * 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, see . + * + */ +#ifndef __LINUX_POWER_RICOH619_H_ +#define __LINUX_POWER_RICOH619_H_ + +/* #include */ +/* #include */ + +/* Defined battery information */ +#define ADC_VDD_MV 2800 +#define MIN_VOLTAGE 3100 +#define MAX_VOLTAGE 4200 +#define B_VALUE 3435 + + +/* RICOH61x Register information */ +/* bank 0 */ +#define PSWR_REG 0x07 +#define VINDAC_REG 0x03 +/* for ADC */ +#define INTEN_REG 0x9D +#define EN_ADCIR3_REG 0x8A +#define ADCCNT3_REG 0x66 +#define VBATDATAH_REG 0x6A +#define VBATDATAL_REG 0x6B + +#define VSYSDATAH_REG 0x70 +#define VSYSDATAL_REG 0x71 + +#define CHGCTL1_REG 0xB3 +#define REGISET1_REG 0xB6 +#define REGISET2_REG 0xB7 +#define CHGISET_REG 0xB8 +#define TIMSET_REG 0xB9 +#define BATSET1_REG 0xBA +#define BATSET2_REG 0xBB + +#define CHGSTATE_REG 0xBD + +#define FG_CTRL_REG 0xE0 +#define SOC_REG 0xE1 +#define RE_CAP_H_REG 0xE2 +#define RE_CAP_L_REG 0xE3 +#define FA_CAP_H_REG 0xE4 +#define FA_CAP_L_REG 0xE5 +#define TT_EMPTY_H_REG 0xE7 +#define TT_EMPTY_L_REG 0xE8 +#define TT_FULL_H_REG 0xE9 +#define TT_FULL_L_REG 0xEA +#define VOLTAGE_1_REG 0xEB +#define VOLTAGE_2_REG 0xEC +#define TEMP_1_REG 0xED +#define TEMP_2_REG 0xEE + +#define CC_CTRL_REG 0xEF +#define CC_SUMREG3_REG 0xF3 +#define CC_SUMREG2_REG 0xF4 +#define CC_SUMREG1_REG 0xF5 +#define CC_SUMREG0_REG 0xF6 +#define CC_AVERAGE1_REG 0xFB +#define CC_AVERAGE0_REG 0xFC + +/* bank 1 */ +/* Top address for battery initial setting */ +#define BAT_TEST_EN_REG 0xB0 +#define BAT_ADD1B2_REG 0xB2 +#define BAT_ADD1B3_REG 0xB3 +#define BAT_ADD1DD_REG 0xDD + +#define BAT_INIT_TOP_REG 0xBC +#define TEMP_GAIN_H_REG 0xD6 +#define TEMP_OFF_H_REG 0xD8 +#define BAT_REL_SEL_REG 0xDA +#define BAT_TA_SEL_REG 0xDB +/**************************/ + +/* detailed status in CHGSTATE (0xBD) */ +enum ChargeState { + CHG_STATE_CHG_OFF = 0, + CHG_STATE_CHG_READY_VADP, + CHG_STATE_CHG_TRICKLE, + CHG_STATE_CHG_RAPID, + CHG_STATE_CHG_COMPLETE, + CHG_STATE_SUSPEND, + CHG_STATE_VCHG_OVER_VOL, + CHG_STATE_BAT_ERROR, + CHG_STATE_NO_BAT, + CHG_STATE_BAT_OVER_VOL, + CHG_STATE_BAT_TEMP_ERR, + CHG_STATE_DIE_ERR, + CHG_STATE_DIE_SHUTDOWN, + CHG_STATE_NO_BAT2, + CHG_STATE_CHG_READY_VUSB, +}; + +enum SupplyState { + SUPPLY_STATE_BAT = 0, + SUPPLY_STATE_ADP, + SUPPLY_STATE_USB, +} ; + +struct ricoh619_battery_type_data { + int ch_vfchg; + int ch_vrchg; + int ch_vbatovset; + int ch_ichg; + int ch_icchg; + int ch_ilim_adp; + int ch_ilim_usb; + int fg_target_vsys; + int fg_target_ibat; + int fg_poff_vbat; + int jt_en; + int jt_hw_sw; + int jt_temp_h; + int jt_temp_l; + int jt_vfchg_h; + int jt_vfchg_l; + int jt_ichg_h; + int jt_ichg_l; +}; + +#define BATTERY_TYPE_NUM 1 +struct ricoh619_battery_platform_data { + int irq; + int alarm_vol_mv; + int multiple; + unsigned long monitor_time; + struct ricoh619_battery_type_data type[BATTERY_TYPE_NUM]; +}; + + +// return value of ricoh619_charger_detect() . +#define NO_CHARGER_PLUGGED 0 +#define UNKOWN_CHARGER 0x0101 +#define SDP_CHARGER 0x0001 +#define CDP_CHARGER 0x0011 +#define DCP_CHARGER 0x0021 + +#endif diff --git a/include/linux/power/ricoh619_standby.h b/include/linux/power/ricoh619_standby.h new file mode 100755 index 00000000..4e02f940 --- /dev/null +++ b/include/linux/power/ricoh619_standby.h @@ -0,0 +1,9 @@ + +int fl_level; // If FL is on, value is 0-100. If FL is off, value is 0; +int fl_current; // Unit is 1uA. If FL is off, value is 0; +int slp_state; // 0:Suspend, 1:Hibernate +int idle_current; // Unit is 1uA. +int sus_current; // Unit is 1uA. +int hiber_current; // Unit is 1uA. +bool bat_alert_req_flg; // 0:Normal, 1:Re-synchronize request from system + diff --git a/include/linux/power/ricoh61x_battery_init.h b/include/linux/power/ricoh61x_battery_init.h new file mode 100755 index 00000000..e07f465c --- /dev/null +++ b/include/linux/power/ricoh61x_battery_init.h @@ -0,0 +1,35 @@ +/* + * include/linux/power/ricoh61x_battery_init.h + * + * Battery initial parameter for RICOH RN5T618/619 power management chip. + * + * Copyright (C) 2013 RICOH COMPANY,LTD + * + * 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_RICOH61X_BATTERY_INIT_H +#define __LINUX_POWER_RICOH61X_BATTERY_INIT_H + + +uint8_t battery_init_para[][32] = { + { + 0x0B, 0x74, 0x0B, 0xCC, 0x0B, 0xFA, 0x0C, 0x0E, 0x0C, 0x1F, 0x0C, 0x37, 0x0C, 0x69, 0x0C, 0x9C, + 0x0C, 0xD0, 0x0D, 0x10, 0x0D, 0x62, 0x05, 0xE6, 0x00, 0x59, 0x0F, 0xC8, 0x05, 0x2C, 0x22, 0x56 + } +}; +#endif + + diff --git a/include/linux/power/sabresd_battery.h b/include/linux/power/sabresd_battery.h new file mode 100644 index 00000000..463fa90a --- /dev/null +++ b/include/linux/power/sabresd_battery.h @@ -0,0 +1,63 @@ +/* + * sabresd_battery.h - Maxim 8903 USB/Adapter Charger Driver + * + * Copyright (C) 2011 Samsung Electronics + * Copyright (C) 2011-2012 Freescale Semiconductor, Inc. + * Based on max8903_charger.h + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef __MAX8903_SABRESD_H__ +#define __MAX8903_SABRESD_H__ + +struct max8903_pdata { + /* + * GPIOs + * cen, chg, flt, and usus are optional. + * dok, dcm, and uok are not optional depending on the status of + * dc_valid and usb_valid. + */ + int cen; /* Charger Enable input */ + int dok; /* DC(Adapter) Power OK output */ + int uok; /* USB Power OK output */ + int chg; /* Charger status output */ + int flt; /* Fault output */ + int dcm; /* Current-Limit Mode input (1: DC, 2: USB) */ + int usus; /* USB Suspend Input (1: suspended) */ + int feature_flag;/*battery capacity feature(0:enable, 1:disable)*/ + + /* DCM wired to Logic High + Set this true when DCM pin connect to Logic high.*/ + bool dcm_always_high; + + /* + * DC(Adapter/TA) is wired + * When dc_valid is true, + * dok and dcm should be valid. + * + * At least one of dc_valid or usb_valid should be true. + */ + bool dc_valid; + /* + * USB is wired + * When usb_valid is true, + * uok should be valid. + */ + bool usb_valid; +}; + +#endif /* __SABRESD_BATTERY_H__ */ -- cgit v1.2.3