linux/drivers/power/supply/ds2780_battery.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * 1-wire client/driver for the Maxim/Dallas DS2780 Stand-Alone Fuel Gauge IC
 *
 * Copyright (C) 2010 Indesign, LLC
 *
 * Author: Clifton Barnes <[email protected]>
 *
 * Based on ds2760_battery and ds2782_battery drivers
 */

#include <linux/module.h>
#include <linux/slab.h>
#include <linux/param.h>
#include <linux/pm.h>
#include <linux/platform_device.h>
#include <linux/power_supply.h>
#include <linux/idr.h>

#include <linux/w1.h>
#include "../../w1/slaves/w1_ds2780.h"

/* Current unit measurement in uA for a 1 milli-ohm sense resistor */
#define DS2780_CURRENT_UNITS
/* Charge unit measurement in uAh for a 1 milli-ohm sense resistor */
#define DS2780_CHARGE_UNITS
/* Number of bytes in user EEPROM space */
#define DS2780_USER_EEPROM_SIZE
/* Number of bytes in parameter EEPROM space */
#define DS2780_PARAM_EEPROM_SIZE

struct ds2780_device_info {};

enum current_types {};

static const char model[] =;
static const char manufacturer[] =;

static inline struct ds2780_device_info *
to_ds2780_device_info(struct power_supply *psy)
{}

static inline int ds2780_battery_io(struct ds2780_device_info *dev_info,
	char *buf, int addr, size_t count, int io)
{}

static inline int ds2780_read8(struct ds2780_device_info *dev_info, u8 *val,
	int addr)
{}

static int ds2780_read16(struct ds2780_device_info *dev_info, s16 *val,
	int addr)
{}

static inline int ds2780_read_block(struct ds2780_device_info *dev_info,
	u8 *val, int addr, size_t count)
{}

static inline int ds2780_write(struct ds2780_device_info *dev_info, u8 *val,
	int addr, size_t count)
{}

static inline int ds2780_store_eeprom(struct device *dev, int addr)
{}

static inline int ds2780_recall_eeprom(struct device *dev, int addr)
{}

static int ds2780_save_eeprom(struct ds2780_device_info *dev_info, int reg)
{}

/* Set sense resistor value in mhos */
static int ds2780_set_sense_register(struct ds2780_device_info *dev_info,
	u8 conductance)
{}

/* Get RSGAIN value from 0 to 1.999 in steps of 0.001 */
static int ds2780_get_rsgain_register(struct ds2780_device_info *dev_info,
	u16 *rsgain)
{}

/* Set RSGAIN value from 0 to 1.999 in steps of 0.001 */
static int ds2780_set_rsgain_register(struct ds2780_device_info *dev_info,
	u16 rsgain)
{}

static int ds2780_get_voltage(struct ds2780_device_info *dev_info,
	int *voltage_uV)
{}

static int ds2780_get_temperature(struct ds2780_device_info *dev_info,
	int *temperature)
{}

static int ds2780_get_current(struct ds2780_device_info *dev_info,
	enum current_types type, int *current_uA)
{}

static int ds2780_get_accumulated_current(struct ds2780_device_info *dev_info,
	int *accumulated_current)
{}

static int ds2780_get_capacity(struct ds2780_device_info *dev_info,
	int *capacity)
{}

static int ds2780_get_status(struct ds2780_device_info *dev_info, int *status)
{}

static int ds2780_get_charge_now(struct ds2780_device_info *dev_info,
	int *charge_now)
{}

static int ds2780_get_control_register(struct ds2780_device_info *dev_info,
	u8 *control_reg)
{}

static int ds2780_set_control_register(struct ds2780_device_info *dev_info,
	u8 control_reg)
{}

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

static enum power_supply_property ds2780_battery_props[] =;

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

static ssize_t ds2780_set_pmod_enabled(struct device *dev,
	struct device_attribute *attr,
	const char *buf,
	size_t count)
{}

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

static ssize_t ds2780_set_sense_resistor_value(struct device *dev,
	struct device_attribute *attr,
	const char *buf,
	size_t count)
{}

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

static ssize_t ds2780_set_rsgain_setting(struct device *dev,
	struct device_attribute *attr,
	const char *buf,
	size_t count)
{}

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

static ssize_t ds2780_set_pio_pin(struct device *dev,
	struct device_attribute *attr,
	const char *buf,
	size_t count)
{}

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

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

static struct bin_attribute ds2780_param_eeprom_bin_attr =;

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

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

static struct bin_attribute ds2780_user_eeprom_bin_attr =;

static DEVICE_ATTR(pmod_enabled, S_IRUGO | S_IWUSR, ds2780_get_pmod_enabled,
	ds2780_set_pmod_enabled);
static DEVICE_ATTR(sense_resistor_value, S_IRUGO | S_IWUSR,
	ds2780_get_sense_resistor_value, ds2780_set_sense_resistor_value);
static DEVICE_ATTR(rsgain_setting, S_IRUGO | S_IWUSR, ds2780_get_rsgain_setting,
	ds2780_set_rsgain_setting);
static DEVICE_ATTR(pio_pin, S_IRUGO | S_IWUSR, ds2780_get_pio_pin,
	ds2780_set_pio_pin);

static struct attribute *ds2780_sysfs_attrs[] =;

static struct bin_attribute *ds2780_sysfs_bin_attrs[] =;

static const struct attribute_group ds2780_sysfs_group =;

static const struct attribute_group *ds2780_sysfs_groups[] =;

static int ds2780_battery_probe(struct platform_device *pdev)
{}

static struct platform_driver ds2780_battery_driver =;

module_platform_driver();

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