linux/drivers/power/supply/sbs-manager.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Driver for SBS compliant Smart Battery System Managers
 *
 * The device communicates via i2c at address 0x0a and multiplexes access to up
 * to four smart batteries at address 0x0b.
 *
 * Via sysfs interface the online state and charge type are presented.
 *
 * Datasheet SBSM:    http://sbs-forum.org/specs/sbsm100b.pdf
 * Datasheet LTC1760: http://cds.linear.com/docs/en/datasheet/1760fb.pdf
 *
 * Karl-Heinz Schneider <karl-heinz@schneider-inet.de>
 */

#include <linux/gpio/driver.h>
#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/i2c-mux.h>
#include <linux/power_supply.h>
#include <linux/property.h>

#define SBSM_MAX_BATS
#define SBSM_RETRY_CNT

/* registers addresses */
#define SBSM_CMD_BATSYSSTATE
#define SBSM_CMD_BATSYSSTATECONT
#define SBSM_CMD_BATSYSINFO
#define SBSM_CMD_LTC

#define SBSM_MASK_BAT_SUPPORTED
#define SBSM_MASK_CHARGE_BAT
#define SBSM_BIT_AC_PRESENT
#define SBSM_BIT_TURBO

#define SBSM_SMB_BAT_OFFSET
struct sbsm_data {};

static enum power_supply_property sbsm_props[] =;

static int sbsm_read_word(struct i2c_client *client, u8 address)
{}

static int sbsm_write_word(struct i2c_client *client, u8 address, u16 word)
{}

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

static int sbsm_prop_is_writeable(struct power_supply *psy,
				  enum power_supply_property psp)
{}

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

/*
 * Switch to battery
 * Parameter chan is directly the content of SMB_BAT* nibble
 */
static int sbsm_select(struct i2c_mux_core *muxc, u32 chan)
{}

static int sbsm_gpio_get_value(struct gpio_chip *gc, unsigned int off)
{}

/*
 * This needs to be defined or the GPIO lib fails to register the pin.
 * But the 'gpio' is always an input.
 */
static int sbsm_gpio_direction_input(struct gpio_chip *gc, unsigned int off)
{}

static int sbsm_do_alert(struct device *dev, void *d)
{}

static void sbsm_alert(struct i2c_client *client, enum i2c_alert_protocol prot,
		       unsigned int d)
{}

static int sbsm_gpio_setup(struct sbsm_data *data)
{}

static const struct power_supply_desc sbsm_default_psy_desc =;

static void sbsm_del_mux_adapter(void *data)
{}

static int sbsm_probe(struct i2c_client *client)
{}

static const struct i2c_device_id sbsm_ids[] =;
MODULE_DEVICE_TABLE(i2c, sbsm_ids);

#ifdef CONFIG_OF
static const struct of_device_id sbsm_dt_ids[] =;
MODULE_DEVICE_TABLE(of, sbsm_dt_ids);
#endif

static struct i2c_driver sbsm_driver =;
module_i2c_driver();

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