#include <linux/module.h>
#include <linux/types.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/notifier.h>
#include <linux/err.h>
#include <linux/of.h>
#include <linux/power_supply.h>
#include <linux/property.h>
#include <linux/thermal.h>
#include <linux/fixp-arith.h>
#include "power_supply.h"
#include "samsung-sdi-battery.h"
static const struct class power_supply_class = …;
static BLOCKING_NOTIFIER_HEAD(power_supply_notifier);
static const struct device_type power_supply_dev_type = …;
#define POWER_SUPPLY_DEFERRED_REGISTER_TIME …
static bool __power_supply_is_supplied_by(struct power_supply *supplier,
struct power_supply *supply)
{ … }
static int __power_supply_changed_work(struct device *dev, void *data)
{ … }
static void power_supply_changed_work(struct work_struct *work)
{ … }
int power_supply_for_each_device(void *data, int (*fn)(struct device *dev, void *data))
{ … }
EXPORT_SYMBOL_GPL(…);
void power_supply_changed(struct power_supply *psy)
{ … }
EXPORT_SYMBOL_GPL(…);
static void power_supply_deferred_register_work(struct work_struct *work)
{ … }
#ifdef CONFIG_OF
static int __power_supply_populate_supplied_from(struct device *dev,
void *data)
{ … }
static int power_supply_populate_supplied_from(struct power_supply *psy)
{ … }
static int __power_supply_find_supply_from_node(struct device *dev,
void *data)
{ … }
static int power_supply_find_supply_from_node(struct device_node *supply_node)
{ … }
static int power_supply_check_supplies(struct power_supply *psy)
{ … }
#else
static int power_supply_check_supplies(struct power_supply *psy)
{
int nval, ret;
if (!psy->dev.parent)
return 0;
nval = device_property_string_array_count(psy->dev.parent, "supplied-from");
if (nval <= 0)
return 0;
psy->supplied_from = devm_kmalloc_array(&psy->dev, nval,
sizeof(char *), GFP_KERNEL);
if (!psy->supplied_from)
return -ENOMEM;
ret = device_property_read_string_array(psy->dev.parent,
"supplied-from", (const char **)psy->supplied_from, nval);
if (ret < 0)
return ret;
psy->num_supplies = nval;
return 0;
}
#endif
struct psy_am_i_supplied_data { … };
static int __power_supply_am_i_supplied(struct device *dev, void *_data)
{ … }
int power_supply_am_i_supplied(struct power_supply *psy)
{ … }
EXPORT_SYMBOL_GPL(…);
static int __power_supply_is_system_supplied(struct device *dev, void *data)
{ … }
int power_supply_is_system_supplied(void)
{ … }
EXPORT_SYMBOL_GPL(…);
struct psy_get_supplier_prop_data { … };
static int __power_supply_get_supplier_property(struct device *dev, void *_data)
{ … }
int power_supply_get_property_from_supplier(struct power_supply *psy,
enum power_supply_property psp,
union power_supply_propval *val)
{ … }
EXPORT_SYMBOL_GPL(…);
int power_supply_set_battery_charged(struct power_supply *psy)
{ … }
EXPORT_SYMBOL_GPL(…);
static int power_supply_match_device_by_name(struct device *dev, const void *data)
{ … }
struct power_supply *power_supply_get_by_name(const char *name)
{ … }
EXPORT_SYMBOL_GPL(…);
void power_supply_put(struct power_supply *psy)
{ … }
EXPORT_SYMBOL_GPL(…);
#ifdef CONFIG_OF
static int power_supply_match_device_node(struct device *dev, const void *data)
{ … }
struct power_supply *power_supply_get_by_phandle(struct device_node *np,
const char *property)
{ … }
EXPORT_SYMBOL_GPL(…);
static void devm_power_supply_put(struct device *dev, void *res)
{ … }
struct power_supply *devm_power_supply_get_by_phandle(struct device *dev,
const char *property)
{ … }
EXPORT_SYMBOL_GPL(…);
#endif
int power_supply_get_battery_info(struct power_supply *psy,
struct power_supply_battery_info **info_out)
{ … }
EXPORT_SYMBOL_GPL(…);
void power_supply_put_battery_info(struct power_supply *psy,
struct power_supply_battery_info *info)
{ … }
EXPORT_SYMBOL_GPL(…);
const enum power_supply_property power_supply_battery_info_properties[] = …;
EXPORT_SYMBOL_GPL(…);
const size_t power_supply_battery_info_properties_size = …;
EXPORT_SYMBOL_GPL(…);
bool power_supply_battery_info_has_prop(struct power_supply_battery_info *info,
enum power_supply_property psp)
{ … }
EXPORT_SYMBOL_GPL(…);
int power_supply_battery_info_get_prop(struct power_supply_battery_info *info,
enum power_supply_property psp,
union power_supply_propval *val)
{ … }
EXPORT_SYMBOL_GPL(…);
int power_supply_temp2resist_simple(struct power_supply_resistance_temp_table *table,
int table_len, int temp)
{ … }
EXPORT_SYMBOL_GPL(…);
int power_supply_vbat2ri(struct power_supply_battery_info *info,
int vbat_uv, bool charging)
{ … }
EXPORT_SYMBOL_GPL(…);
const struct power_supply_maintenance_charge_table *
power_supply_get_maintenance_charging_setting(struct power_supply_battery_info *info,
int index)
{ … }
EXPORT_SYMBOL_GPL(…);
int power_supply_ocv2cap_simple(struct power_supply_battery_ocv_table *table,
int table_len, int ocv)
{ … }
EXPORT_SYMBOL_GPL(…);
struct power_supply_battery_ocv_table *
power_supply_find_ocv2cap_table(struct power_supply_battery_info *info,
int temp, int *table_len)
{ … }
EXPORT_SYMBOL_GPL(…);
int power_supply_batinfo_ocv2cap(struct power_supply_battery_info *info,
int ocv, int temp)
{ … }
EXPORT_SYMBOL_GPL(…);
bool power_supply_battery_bti_in_range(struct power_supply_battery_info *info,
int resistance)
{ … }
EXPORT_SYMBOL_GPL(…);
static bool psy_has_property(const struct power_supply_desc *psy_desc,
enum power_supply_property psp)
{ … }
int power_supply_get_property(struct power_supply *psy,
enum power_supply_property psp,
union power_supply_propval *val)
{ … }
EXPORT_SYMBOL_GPL(…);
int power_supply_set_property(struct power_supply *psy,
enum power_supply_property psp,
const union power_supply_propval *val)
{ … }
EXPORT_SYMBOL_GPL(…);
int power_supply_property_is_writeable(struct power_supply *psy,
enum power_supply_property psp)
{ … }
EXPORT_SYMBOL_GPL(…);
void power_supply_external_power_changed(struct power_supply *psy)
{ … }
EXPORT_SYMBOL_GPL(…);
int power_supply_powers(struct power_supply *psy, struct device *dev)
{ … }
EXPORT_SYMBOL_GPL(…);
static void power_supply_dev_release(struct device *dev)
{ … }
int power_supply_reg_notifier(struct notifier_block *nb)
{ … }
EXPORT_SYMBOL_GPL(…);
void power_supply_unreg_notifier(struct notifier_block *nb)
{ … }
EXPORT_SYMBOL_GPL(…);
#ifdef CONFIG_THERMAL
static int power_supply_read_temp(struct thermal_zone_device *tzd,
int *temp)
{ … }
static struct thermal_zone_device_ops psy_tzd_ops = …;
static int psy_register_thermal(struct power_supply *psy)
{ … }
static void psy_unregister_thermal(struct power_supply *psy)
{ … }
#else
static int psy_register_thermal(struct power_supply *psy)
{
return 0;
}
static void psy_unregister_thermal(struct power_supply *psy)
{
}
#endif
static struct power_supply *__must_check
__power_supply_register(struct device *parent,
const struct power_supply_desc *desc,
const struct power_supply_config *cfg,
bool ws)
{ … }
struct power_supply *__must_check power_supply_register(struct device *parent,
const struct power_supply_desc *desc,
const struct power_supply_config *cfg)
{ … }
EXPORT_SYMBOL_GPL(…);
struct power_supply *__must_check
power_supply_register_no_ws(struct device *parent,
const struct power_supply_desc *desc,
const struct power_supply_config *cfg)
{ … }
EXPORT_SYMBOL_GPL(…);
static void devm_power_supply_release(struct device *dev, void *res)
{ … }
struct power_supply *__must_check
devm_power_supply_register(struct device *parent,
const struct power_supply_desc *desc,
const struct power_supply_config *cfg)
{ … }
EXPORT_SYMBOL_GPL(…);
struct power_supply *__must_check
devm_power_supply_register_no_ws(struct device *parent,
const struct power_supply_desc *desc,
const struct power_supply_config *cfg)
{ … }
EXPORT_SYMBOL_GPL(…);
void power_supply_unregister(struct power_supply *psy)
{ … }
EXPORT_SYMBOL_GPL(…);
void *power_supply_get_drvdata(struct power_supply *psy)
{ … }
EXPORT_SYMBOL_GPL(…);
static int __init power_supply_class_init(void)
{ … }
static void __exit power_supply_class_exit(void)
{ … }
subsys_initcall(power_supply_class_init);
module_exit(power_supply_class_exit);
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;