1/* 2 * Summit Microelectronics SMB347 Battery Charger Driver 3 * 4 * Copyright (C) 2011, Intel Corporation 5 * 6 * Authors: Bruce E. Robertson <bruce.e.robertson@intel.com> 7 * Mika Westerberg <mika.westerberg@linux.intel.com> 8 * 9 * This program is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License version 2 as 11 * published by the Free Software Foundation. 12 */ 13 14#ifndef SMB347_CHARGER_H 15#define SMB347_CHARGER_H 16 17#include <linux/types.h> 18#include <linux/power_supply.h> 19 20enum { 21 /* use the default compensation method */ 22 SMB347_SOFT_TEMP_COMPENSATE_DEFAULT = -1, 23 24 SMB347_SOFT_TEMP_COMPENSATE_NONE, 25 SMB347_SOFT_TEMP_COMPENSATE_CURRENT, 26 SMB347_SOFT_TEMP_COMPENSATE_VOLTAGE, 27}; 28 29/* Use default factory programmed value for hard/soft temperature limit */ 30#define SMB347_TEMP_USE_DEFAULT -273 31 32/* 33 * Charging enable can be controlled by software (via i2c) by 34 * smb347-charger driver or by EN pin (active low/high). 35 */ 36enum smb347_chg_enable { 37 SMB347_CHG_ENABLE_SW, 38 SMB347_CHG_ENABLE_PIN_ACTIVE_LOW, 39 SMB347_CHG_ENABLE_PIN_ACTIVE_HIGH, 40}; 41 42/** 43 * struct smb347_charger_platform_data - platform data for SMB347 charger 44 * @battery_info: Information about the battery 45 * @max_charge_current: maximum current (in uA) the battery can be charged 46 * @max_charge_voltage: maximum voltage (in uV) the battery can be charged 47 * @pre_charge_current: current (in uA) to use in pre-charging phase 48 * @termination_current: current (in uA) used to determine when the 49 * charging cycle terminates 50 * @pre_to_fast_voltage: voltage (in uV) treshold used for transitioning to 51 * pre-charge to fast charge mode 52 * @mains_current_limit: maximum input current drawn from AC/DC input (in uA) 53 * @usb_hc_current_limit: maximum input high current (in uA) drawn from USB 54 * input 55 * @chip_temp_threshold: die temperature where device starts limiting charge 56 * current [%100 - %130] (in degree C) 57 * @soft_cold_temp_limit: soft cold temperature limit [%0 - %15] (in degree C), 58 * granularity is 5 deg C. 59 * @soft_hot_temp_limit: soft hot temperature limit [%40 - %55] (in degree C), 60 * granularity is 5 deg C. 61 * @hard_cold_temp_limit: hard cold temperature limit [%-5 - %10] (in degree C), 62 * granularity is 5 deg C. 63 * @hard_hot_temp_limit: hard hot temperature limit [%50 - %65] (in degree C), 64 * granularity is 5 deg C. 65 * @suspend_on_hard_temp_limit: suspend charging when hard limit is hit 66 * @soft_temp_limit_compensation: compensation method when soft temperature 67 * limit is hit 68 * @charge_current_compensation: current (in uA) for charging compensation 69 * current when temperature hits soft limits 70 * @use_mains: AC/DC input can be used 71 * @use_usb: USB input can be used 72 * @use_usb_otg: USB OTG output can be used (not implemented yet) 73 * @irq_gpio: GPIO number used for interrupts (%-1 if not used) 74 * @enable_control: how charging enable/disable is controlled 75 * (driver/pin controls) 76 * 77 * @use_main, @use_usb, and @use_usb_otg are means to enable/disable 78 * hardware support for these. This is useful when we want to have for 79 * example OTG charging controlled via OTG transceiver driver and not by 80 * the SMB347 hardware. 81 * 82 * Hard and soft temperature limit values are given as described in the 83 * device data sheet and assuming NTC beta value is %3750. Even if this is 84 * not the case, these values should be used. They can be mapped to the 85 * corresponding NTC beta values with the help of table %2 in the data 86 * sheet. So for example if NTC beta is %3375 and we want to program hard 87 * hot limit to be %53 deg C, @hard_hot_temp_limit should be set to %50. 88 * 89 * If zero value is given in any of the current and voltage values, the 90 * factory programmed default will be used. For soft/hard temperature 91 * values, pass in %SMB347_TEMP_USE_DEFAULT instead. 92 */ 93struct smb347_charger_platform_data { 94 struct power_supply_info battery_info; 95 unsigned int max_charge_current; 96 unsigned int max_charge_voltage; 97 unsigned int pre_charge_current; 98 unsigned int termination_current; 99 unsigned int pre_to_fast_voltage; 100 unsigned int mains_current_limit; 101 unsigned int usb_hc_current_limit; 102 unsigned int chip_temp_threshold; 103 int soft_cold_temp_limit; 104 int soft_hot_temp_limit; 105 int hard_cold_temp_limit; 106 int hard_hot_temp_limit; 107 bool suspend_on_hard_temp_limit; 108 unsigned int soft_temp_limit_compensation; 109 unsigned int charge_current_compensation; 110 bool use_mains; 111 bool use_usb; 112 bool use_usb_otg; 113 int irq_gpio; 114 enum smb347_chg_enable enable_control; 115}; 116 117#endif /* SMB347_CHARGER_H */ 118