type
stringclasses
5 values
content
stringlengths
9
163k
functions
int __power_supply_find_supply_from_node(struct device *dev, void *data) { struct device_node *np = (struct device_node *)data; struct power_supply *epsy = dev_get_drvdata(dev); /* return error breaks out of class_for_each_device loop */ if (epsy->of_node == np) return -EINVAL; return 0; }
functions
int power_supply_find_supply_from_node(struct device_node *supply_node) { int error; struct device *dev; struct class_dev_iter iter; /* * Use iterator to see if any other device is registered. * This is required since class_for_each_device returns 0 * if there are no devices registered. */ class_dev_iter_...
functions
int power_supply_check_supplies(struct power_supply *psy) { struct device_node *np; int cnt = 0; /* If there is already a list honor it */ if (psy->supplied_from && psy->num_supplies > 0) return 0; /* No device node found, nothing to do */ if (!psy->of_node) return 0; do { int ret; np = of_parse_phan...
functions
int power_supply_check_supplies(struct power_supply *psy) { return 0; }
functions
int __power_supply_am_i_supplied(struct device *dev, void *data) { union power_supply_propval ret = {0,}
functions
int power_supply_am_i_supplied(struct power_supply *psy) { int error; error = class_for_each_device(power_supply_class, NULL, psy, __power_supply_am_i_supplied); dev_dbg(psy->dev, "%s %d\n", __func__, error); return error; }
functions
int __power_supply_is_system_supplied(struct device *dev, void *data) { union power_supply_propval ret = {0,}
functions
int power_supply_is_system_supplied(void) { int error; unsigned int count = 0; error = class_for_each_device(power_supply_class, NULL, &count, __power_supply_is_system_supplied); /* * If no power class device was found at all, most probably we are * running on a desktop system, so assume we are on m...
functions
int power_supply_set_battery_charged(struct power_supply *psy) { if (psy->type == POWER_SUPPLY_TYPE_BATTERY && psy->set_charged) { psy->set_charged(psy); return 0; }
functions
int power_supply_match_device_by_name(struct device *dev, const void *data) { const char *name = data; struct power_supply *psy = dev_get_drvdata(dev); return strcmp(psy->name, name) == 0; }
functions
int power_supply_match_device_node(struct device *dev, const void *data) { return dev->parent && dev->parent->of_node == data; }
functions
int power_supply_powers(struct power_supply *psy, struct device *dev) { return sysfs_create_link(&psy->dev->kobj, &dev->kobj, "powers"); }
functions
void power_supply_dev_release(struct device *dev) { pr_debug("device: '%s': %s\n", dev_name(dev), __func__); kfree(dev); }
functions
int power_supply_reg_notifier(struct notifier_block *nb) { return atomic_notifier_chain_register(&power_supply_notifier, nb); }
functions
void power_supply_unreg_notifier(struct notifier_block *nb) { atomic_notifier_chain_unregister(&power_supply_notifier, nb); }
functions
int power_supply_read_temp(struct thermal_zone_device *tzd, unsigned long *temp) { struct power_supply *psy; union power_supply_propval val; int ret; WARN_ON(tzd == NULL); psy = tzd->devdata; ret = psy->get_property(psy, POWER_SUPPLY_PROP_TEMP, &val); /* Convert tenths of degree Celsius to milli degree Celsi...
functions
int psy_register_thermal(struct power_supply *psy) { int i; /* Register battery zone device psy reports temperature */ for (i = 0; i < psy->num_properties; i++) { if (psy->properties[i] == POWER_SUPPLY_PROP_TEMP) { psy->tzd = thermal_zone_device_register(psy->name, 0, 0, psy, &psy_tzd_ops, NULL, 0, 0); ...
functions
void psy_unregister_thermal(struct power_supply *psy) { if (IS_ERR_OR_NULL(psy->tzd)) return; thermal_zone_device_unregister(psy->tzd); }
functions
int ps_get_max_charge_cntl_limit(struct thermal_cooling_device *tcd, unsigned long *state) { struct power_supply *psy; union power_supply_propval val; int ret; psy = tcd->devdata; ret = psy->get_property(psy, POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT_MAX, &val); if (!ret) *state = val.intval; return ret;...
functions
int ps_get_cur_chrage_cntl_limit(struct thermal_cooling_device *tcd, unsigned long *state) { struct power_supply *psy; union power_supply_propval val; int ret; psy = tcd->devdata; ret = psy->get_property(psy, POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT, &val); if (!ret) *state = val.intval; return ret; }
functions
int ps_set_cur_charge_cntl_limit(struct thermal_cooling_device *tcd, unsigned long state) { struct power_supply *psy; union power_supply_propval val; int ret; psy = tcd->devdata; val.intval = state; ret = psy->set_property(psy, POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT, &val); return ret; }
functions
int psy_register_cooler(struct power_supply *psy) { int i; /* Register for cooling device if psy can control charging */ for (i = 0; i < psy->num_properties; i++) { if (psy->properties[i] == POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT) { psy->tcd = thermal_cooling_device_register( (char *)psy->name, ...
functions
void psy_unregister_cooler(struct power_supply *psy) { if (IS_ERR_OR_NULL(psy->tcd)) return; thermal_cooling_device_unregister(psy->tcd); }
functions
int psy_register_thermal(struct power_supply *psy) { return 0; }
functions
void psy_unregister_thermal(struct power_supply *psy) { }
functions
int psy_register_cooler(struct power_supply *psy) { return 0; }
functions
void psy_unregister_cooler(struct power_supply *psy) { }
functions
int power_supply_register(struct device *parent, struct power_supply *psy) { struct device *dev; int rc; dev = kzalloc(sizeof(*dev), GFP_KERNEL); if (!dev) return -ENOMEM; device_initialize(dev); dev->class = power_supply_class; dev->type = &power_supply_dev_type; dev->parent = parent; dev->release = powe...
functions
void power_supply_unregister(struct power_supply *psy) { cancel_work_sync(&psy->changed_work); sysfs_remove_link(&psy->dev->kobj, "powers"); power_supply_remove_triggers(psy); psy_unregister_cooler(psy); psy_unregister_thermal(psy); device_init_wakeup(psy->dev, false); device_unregister(psy->dev); }
functions
__init power_supply_class_init(void) { power_supply_class = class_create(THIS_MODULE, "power_supply"); if (IS_ERR(power_supply_class)) return PTR_ERR(power_supply_class); power_supply_class->dev_uevent = power_supply_uevent; power_supply_init_attrs(&power_supply_dev_type); return 0; }
functions
__exit power_supply_class_exit(void) { class_destroy(power_supply_class); }
includes
#include <linux/module.h>
includes
#include <linux/kernel.h>
includes
#include <linux/sched.h>
includes
#include <linux/interrupt.h>
includes
#include <linux/proc_fs.h>
includes
#include <linux/seq_file.h>
includes
#include <linux/init.h>
includes
#include <linux/vmalloc.h>
includes
#include <linux/mm.h>
includes
#include <linux/sysctl.h>
includes
#include <linux/list.h>
includes
#include <linux/file.h>
includes
#include <linux/poll.h>
includes
#include <linux/vfs.h>
includes
#include <linux/smp.h>
includes
#include <linux/pagemap.h>
includes
#include <linux/mount.h>
includes
#include <linux/bitops.h>
includes
#include <linux/capability.h>
includes
#include <linux/rcupdate.h>
includes
#include <linux/completion.h>
includes
#include <linux/tracehook.h>
includes
#include <linux/slab.h>
includes
#include <asm/errno.h>
includes
#include <asm/intrinsics.h>
includes
#include <asm/page.h>
includes
#include <asm/perfmon.h>
includes
#include <asm/processor.h>
includes
#include <asm/signal.h>
includes
#include <asm/system.h>
includes
#include <asm/uaccess.h>
includes
#include <asm/delay.h>
defines
#define PFM_CTX_UNLOADED 1 /* context is not loaded onto any task */
defines
#define PFM_CTX_LOADED 2 /* context is loaded onto a task */
defines
#define PFM_CTX_MASKED 3 /* context is loaded but monitoring is masked due to overflow */
defines
#define PFM_CTX_ZOMBIE 4 /* owner of the context is closing it */
defines
#define PFM_INVALID_ACTIVATION (~0UL)
defines
#define PFM_NUM_PMC_REGS 64 /* PMC save area for ctxsw */
defines
#define PFM_NUM_PMD_REGS 64 /* PMD save area for ctxsw */
defines
#define PFM_MAX_MSGS 32
defines
#define PFM_CTXQ_EMPTY(g) ((g)->ctx_msgq_head == (g)->ctx_msgq_tail)
defines
#define PFM_REG_NOTIMPL 0x0 /* not implemented at all */
defines
#define PFM_REG_IMPL 0x1 /* register implemented */
defines
#define PFM_REG_END 0x2 /* end marker */
defines
#define PFM_REG_MONITOR (0x1<<4|PFM_REG_IMPL) /* a PMC with a pmc.pm field only */
defines
#define PFM_REG_COUNTING (0x2<<4|PFM_REG_MONITOR) /* a monitor + pmc.oi+ PMD used as a counter */
defines
#define PFM_REG_CONTROL (0x4<<4|PFM_REG_IMPL) /* PMU control register */
defines
#define PFM_REG_CONFIG (0x8<<4|PFM_REG_IMPL) /* configuration register */
defines
#define PFM_REG_BUFFER (0xc<<4|PFM_REG_IMPL) /* PMD used as buffer */
defines
#define PMC_IS_LAST(i) (pmu_conf->pmc_desc[i].type & PFM_REG_END)
defines
#define PMD_IS_LAST(i) (pmu_conf->pmd_desc[i].type & PFM_REG_END)
defines
#define PMC_OVFL_NOTIFY(ctx, i) ((ctx)->ctx_pmds[i].flags & PFM_REGFL_OVFL_NOTIFY)
defines
#define PMC_IS_IMPL(i) (i< PMU_MAX_PMCS && (pmu_conf->pmc_desc[i].type & PFM_REG_IMPL))
defines
#define PMD_IS_IMPL(i) (i< PMU_MAX_PMDS && (pmu_conf->pmd_desc[i].type & PFM_REG_IMPL))
defines
#define PMD_IS_COUNTING(i) ((pmu_conf->pmd_desc[i].type & PFM_REG_COUNTING) == PFM_REG_COUNTING)
defines
#define PMC_IS_COUNTING(i) ((pmu_conf->pmc_desc[i].type & PFM_REG_COUNTING) == PFM_REG_COUNTING)
defines
#define PMC_IS_MONITOR(i) ((pmu_conf->pmc_desc[i].type & PFM_REG_MONITOR) == PFM_REG_MONITOR)
defines
#define PMC_IS_CONTROL(i) ((pmu_conf->pmc_desc[i].type & PFM_REG_CONTROL) == PFM_REG_CONTROL)
defines
#define PMC_DFL_VAL(i) pmu_conf->pmc_desc[i].default_value
defines
#define PMC_RSVD_MASK(i) pmu_conf->pmc_desc[i].reserved_mask
defines
#define PMD_PMD_DEP(i) pmu_conf->pmd_desc[i].dep_pmd[0]
defines
#define PMC_PMD_DEP(i) pmu_conf->pmc_desc[i].dep_pmd[0]
defines
#define PFM_NUM_IBRS IA64_NUM_DBG_REGS
defines
#define PFM_NUM_DBRS IA64_NUM_DBG_REGS
defines
#define CTX_OVFL_NOBLOCK(c) ((c)->ctx_fl_block == 0)
defines
#define CTX_HAS_SMPL(c) ((c)->ctx_fl_is_sampling)
defines
#define PFM_CTX_TASK(h) (h)->ctx_task
defines
#define PMU_PMC_OI 5 /* position of pmc.oi bit */
defines
#define CTX_USED_PMD(ctx, mask) (ctx)->ctx_used_pmds[0] |= (mask)