diff options
Diffstat (limited to 'include/linux/power')
-rw-r--r-- | include/linux/power/bq2415x_charger.h | 48 | ||||
-rw-r--r-- | include/linux/power/charger-manager.h | 34 | ||||
-rw-r--r-- | include/linux/power/isp1704_charger.h | 1 |
3 files changed, 27 insertions, 56 deletions
diff --git a/include/linux/power/bq2415x_charger.h b/include/linux/power/bq2415x_charger.h index 8dcc0f46fc0..50762af8b83 100644 --- a/include/linux/power/bq2415x_charger.h +++ b/include/linux/power/bq2415x_charger.h @@ -1,7 +1,7 @@ /* * bq2415x charger driver * - * Copyright (C) 2011-2012 Pali Rohár <pali.rohar@gmail.com> + * Copyright (C) 2011-2013 Pali Rohár <pali.rohar@gmail.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 @@ -31,46 +31,9 @@ * termination current. It it is less or equal to zero, configuring charge * and termination current will not be possible. * - * Function set_mode_hook is needed for automode (setting correct current - * limit when charger is connected/disconnected or setting boost mode). - * When is NULL, automode function is disabled. When is not NULL, it must - * have this prototype: - * - * int (*set_mode_hook)( - * void (*hook)(enum bq2415x_mode mode, void *data), - * void *data) - * - * hook is hook function (see below) and data is pointer to driver private - * data - * - * bq2415x driver will call it as: - * - * platform_data->set_mode_hook(bq2415x_hook_function, bq2415x_device); - * - * Board/platform function set_mode_hook return non zero value when hook - * function was successful registered. Platform code should call that hook - * function (which get from pointer, with data) every time when charger - * was connected/disconnected or require to enable boost mode. bq2415x - * driver then will set correct current limit, enable/disable charger or - * boost mode. - * - * Hook function has this prototype: - * - * void hook(enum bq2415x_mode mode, void *data); - * - * mode is bq2415x mode (charger or boost) - * data is pointer to driver private data (which get from - * set_charger_type_hook) - * - * When bq driver is being unloaded, it call function: - * - * platform_data->set_mode_hook(NULL, NULL); - * - * (hook function and driver private data are NULL) - * - * After that board/platform code must not call driver hook function! It - * is possible that pointer to hook function will not be valid and calling - * will cause undefined result. + * For automode support is needed to provide name of power supply device + * in value notify_device. Device driver must immediately report property + * POWER_SUPPLY_PROP_CURRENT_MAX when current changed. */ /* Supported modes with maximal current limit */ @@ -89,8 +52,7 @@ struct bq2415x_platform_data { int charge_current; /* mA */ int termination_current; /* mA */ int resistor_sense; /* m ohm */ - int (*set_mode_hook)(void (*hook)(enum bq2415x_mode mode, void *data), - void *data); + const char *notify_device; /* name */ }; #endif diff --git a/include/linux/power/charger-manager.h b/include/linux/power/charger-manager.h index 0e86840eb60..07e7945a1ff 100644 --- a/include/linux/power/charger-manager.h +++ b/include/linux/power/charger-manager.h @@ -37,6 +37,8 @@ enum cm_event_types { CM_EVENT_BATT_FULL, CM_EVENT_BATT_IN, CM_EVENT_BATT_OUT, + CM_EVENT_BATT_OVERHEAT, + CM_EVENT_BATT_COLD, CM_EVENT_EXT_PWR_IN_OUT, CM_EVENT_CHG_START_STOP, CM_EVENT_OTHERS, @@ -173,11 +175,10 @@ struct charger_regulator { * @num_charger_regulator: the number of entries in charger_regulators * @charger_regulators: array of charger regulators * @psy_fuel_gauge: the name of power-supply for fuel gauge - * @temperature_out_of_range: - * Determine whether the status is overheat or cold or normal. - * return_value > 0: overheat - * return_value == 0: normal - * return_value < 0: cold + * @thermal_zone : the name of thermal zone for battery + * @temp_min : Minimum battery temperature for charging. + * @temp_max : Maximum battery temperature for charging. + * @temp_diff : Temperature diffential to restart charging. * @measure_battery_temp: * true: measure battery temperature * false: measure ambient temperature @@ -190,7 +191,7 @@ struct charger_regulator { * max_duration_ms', cm start charging. */ struct charger_desc { - char *psy_name; + const char *psy_name; enum polling_modes polling_mode; unsigned int polling_interval_ms; @@ -203,18 +204,23 @@ struct charger_desc { enum data_source battery_present; - char **psy_charger_stat; + const char **psy_charger_stat; int num_charger_regulators; struct charger_regulator *charger_regulators; - char *psy_fuel_gauge; + const char *psy_fuel_gauge; + + const char *thermal_zone; + + int temp_min; + int temp_max; + int temp_diff; - int (*temperature_out_of_range)(int *mC); bool measure_battery_temp; - u64 charging_max_duration_ms; - u64 discharging_max_duration_ms; + u32 charging_max_duration_ms; + u32 discharging_max_duration_ms; }; #define PSY_NAME_MAX 30 @@ -226,13 +232,13 @@ struct charger_desc { * @desc: instance of charger_desc * @fuel_gauge: power_supply for fuel gauge * @charger_stat: array of power_supply for chargers + * @tzd_batt : thermal zone device for battery * @charger_enabled: the state of charger * @fullbatt_vchk_jiffies_at: * jiffies at the time full battery check will occur. * @fullbatt_vchk_work: work queue for full battery check * @emergency_stop: * When setting true, stop charging - * @last_temp_mC: the measured temperature in milli-Celsius * @psy_name_buf: the name of power-supply-class for charger manager * @charger_psy: power_supply for charger manager * @status_save_ext_pwr_inserted: @@ -250,13 +256,15 @@ struct charger_manager { struct power_supply *fuel_gauge; struct power_supply **charger_stat; +#ifdef CONFIG_THERMAL + struct thermal_zone_device *tzd_batt; +#endif bool charger_enabled; unsigned long fullbatt_vchk_jiffies_at; struct delayed_work fullbatt_vchk_work; int emergency_stop; - int last_temp_mC; char psy_name_buf[PSY_NAME_MAX + 1]; struct power_supply charger_psy; diff --git a/include/linux/power/isp1704_charger.h b/include/linux/power/isp1704_charger.h index 68096a6aa2d..0105d9e7af8 100644 --- a/include/linux/power/isp1704_charger.h +++ b/include/linux/power/isp1704_charger.h @@ -24,6 +24,7 @@ struct isp1704_charger_data { void (*set_power)(bool on); + int enable_gpio; }; #endif |