linux/drivers/power/supply/olpc_battery.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Battery driver for One Laptop Per Child board.
 *
 *	Copyright © 2006-2010  David Woodhouse <[email protected]>
 */

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/types.h>
#include <linux/err.h>
#include <linux/device.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/power_supply.h>
#include <linux/jiffies.h>
#include <linux/sched.h>
#include <linux/olpc-ec.h>


#define EC_BAT_VOLTAGE
#define EC_BAT_CURRENT
#define EC_BAT_ACR
#define EC_BAT_TEMP
#define EC_AMB_TEMP
#define EC_BAT_STATUS
#define EC_BAT_SOC
#define EC_BAT_SERIAL
#define EC_BAT_EEPROM
#define EC_BAT_ERRCODE

#define BAT_STAT_PRESENT
#define BAT_STAT_FULL
#define BAT_STAT_LOW
#define BAT_STAT_DESTROY
#define BAT_STAT_AC
#define BAT_STAT_CHARGING
#define BAT_STAT_DISCHARGING
#define BAT_STAT_TRICKLE

#define BAT_ERR_INFOFAIL
#define BAT_ERR_OVERVOLTAGE
#define BAT_ERR_OVERTEMP
#define BAT_ERR_GAUGESTOP
#define BAT_ERR_OUT_OF_CONTROL
#define BAT_ERR_ID_FAIL
#define BAT_ERR_ACR_FAIL

#define BAT_ADDR_MFR_TYPE

struct olpc_battery_data {};

/*********************************************************************
 *		Power
 *********************************************************************/

static int olpc_ac_get_prop(struct power_supply *psy,
			    enum power_supply_property psp,
			    union power_supply_propval *val)
{}

static enum power_supply_property olpc_ac_props[] =;

static const struct power_supply_desc olpc_ac_desc =;

static int olpc_bat_get_status(struct olpc_battery_data *data,
		union power_supply_propval *val, uint8_t ec_byte)
{}

static int olpc_bat_get_health(union power_supply_propval *val)
{}

static int olpc_bat_get_mfr(union power_supply_propval *val)
{}

static int olpc_bat_get_tech(union power_supply_propval *val)
{}

static int olpc_bat_get_charge_full_design(union power_supply_propval *val)
{}

static int olpc_bat_get_charge_now(union power_supply_propval *val)
{}

static int olpc_bat_get_voltage_max_design(union power_supply_propval *val)
{}

static u16 ecword_to_cpu(struct olpc_battery_data *data, u16 ec_word)
{}

/*********************************************************************
 *		Battery properties
 *********************************************************************/
static int olpc_bat_get_property(struct power_supply *psy,
				 enum power_supply_property psp,
				 union power_supply_propval *val)
{}

static enum power_supply_property olpc_xo1_bat_props[] =;

/* XO-1.5 does not have ambient temperature property */
static enum power_supply_property olpc_xo15_bat_props[] =;

/* EEPROM reading goes completely around the power_supply API, sadly */

#define EEPROM_START
#define EEPROM_END
#define EEPROM_SIZE

static ssize_t olpc_bat_eeprom_read(struct file *filp, struct kobject *kobj,
		struct bin_attribute *attr, char *buf, loff_t off, size_t count)
{}

static struct bin_attribute olpc_bat_eeprom =;

/* Allow userspace to see the specific error value pulled from the EC */

static ssize_t olpc_bat_error_read(struct device *dev,
		struct device_attribute *attr, char *buf)
{}

static struct device_attribute olpc_bat_error =;

static struct attribute *olpc_bat_sysfs_attrs[] =;

static struct bin_attribute *olpc_bat_sysfs_bin_attrs[] =;

static const struct attribute_group olpc_bat_sysfs_group =;

static const struct attribute_group *olpc_bat_sysfs_groups[] =;

/*********************************************************************
 *		Initialisation
 *********************************************************************/

static struct power_supply_desc olpc_bat_desc =;

static int olpc_battery_suspend(struct platform_device *pdev,
				pm_message_t state)
{}

static int olpc_battery_probe(struct platform_device *pdev)
{}

static const struct of_device_id olpc_battery_ids[] =;
MODULE_DEVICE_TABLE(of, olpc_battery_ids);

static struct platform_driver olpc_battery_driver =;

module_platform_driver();

MODULE_AUTHOR();
MODULE_LICENSE();
MODULE_DESCRIPTION();