diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/power/bq2415x_charger.h | 48 |
1 files changed, 5 insertions, 43 deletions
diff --git a/include/linux/power/bq2415x_charger.h b/include/linux/power/bq2415x_charger.h index 8dcc0f46fc0a..50762af8b834 100644 --- a/include/linux/power/bq2415x_charger.h +++ b/include/linux/power/bq2415x_charger.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * bq2415x charger driver | 2 | * bq2415x charger driver |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2011-2012 Pali Rohár <pali.rohar@gmail.com> | 4 | * Copyright (C) 2011-2013 Pali Rohár <pali.rohar@gmail.com> |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
| @@ -31,46 +31,9 @@ | |||
| 31 | * termination current. It it is less or equal to zero, configuring charge | 31 | * termination current. It it is less or equal to zero, configuring charge |
| 32 | * and termination current will not be possible. | 32 | * and termination current will not be possible. |
| 33 | * | 33 | * |
| 34 | * Function set_mode_hook is needed for automode (setting correct current | 34 | * For automode support is needed to provide name of power supply device |
| 35 | * limit when charger is connected/disconnected or setting boost mode). | 35 | * in value notify_device. Device driver must immediately report property |
| 36 | * When is NULL, automode function is disabled. When is not NULL, it must | 36 | * POWER_SUPPLY_PROP_CURRENT_MAX when current changed. |
| 37 | * have this prototype: | ||
| 38 | * | ||
| 39 | * int (*set_mode_hook)( | ||
| 40 | * void (*hook)(enum bq2415x_mode mode, void *data), | ||
| 41 | * void *data) | ||
| 42 | * | ||
| 43 | * hook is hook function (see below) and data is pointer to driver private | ||
| 44 | * data | ||
| 45 | * | ||
| 46 | * bq2415x driver will call it as: | ||
| 47 | * | ||
| 48 | * platform_data->set_mode_hook(bq2415x_hook_function, bq2415x_device); | ||
| 49 | * | ||
| 50 | * Board/platform function set_mode_hook return non zero value when hook | ||
| 51 | * function was successful registered. Platform code should call that hook | ||
| 52 | * function (which get from pointer, with data) every time when charger | ||
| 53 | * was connected/disconnected or require to enable boost mode. bq2415x | ||
| 54 | * driver then will set correct current limit, enable/disable charger or | ||
| 55 | * boost mode. | ||
| 56 | * | ||
| 57 | * Hook function has this prototype: | ||
| 58 | * | ||
| 59 | * void hook(enum bq2415x_mode mode, void *data); | ||
| 60 | * | ||
| 61 | * mode is bq2415x mode (charger or boost) | ||
| 62 | * data is pointer to driver private data (which get from | ||
| 63 | * set_charger_type_hook) | ||
| 64 | * | ||
| 65 | * When bq driver is being unloaded, it call function: | ||
| 66 | * | ||
| 67 | * platform_data->set_mode_hook(NULL, NULL); | ||
| 68 | * | ||
| 69 | * (hook function and driver private data are NULL) | ||
| 70 | * | ||
| 71 | * After that board/platform code must not call driver hook function! It | ||
| 72 | * is possible that pointer to hook function will not be valid and calling | ||
| 73 | * will cause undefined result. | ||
| 74 | */ | 37 | */ |
| 75 | 38 | ||
| 76 | /* Supported modes with maximal current limit */ | 39 | /* Supported modes with maximal current limit */ |
| @@ -89,8 +52,7 @@ struct bq2415x_platform_data { | |||
| 89 | int charge_current; /* mA */ | 52 | int charge_current; /* mA */ |
| 90 | int termination_current; /* mA */ | 53 | int termination_current; /* mA */ |
| 91 | int resistor_sense; /* m ohm */ | 54 | int resistor_sense; /* m ohm */ |
| 92 | int (*set_mode_hook)(void (*hook)(enum bq2415x_mode mode, void *data), | 55 | const char *notify_device; /* name */ |
| 93 | void *data); | ||
| 94 | }; | 56 | }; |
| 95 | 57 | ||
| 96 | #endif | 58 | #endif |
