linux/drivers/power/supply/bq25890_charger.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * TI BQ25890 charger driver
 *
 * Copyright (C) 2015 Intel Corporation
 */

#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/power_supply.h>
#include <linux/power/bq25890_charger.h>
#include <linux/regmap.h>
#include <linux/regulator/driver.h>
#include <linux/types.h>
#include <linux/gpio/consumer.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/usb/phy.h>

#include <linux/acpi.h>
#include <linux/of.h>

#define BQ25890_MANUFACTURER
#define BQ25890_IRQ_PIN

#define BQ25890_ID
#define BQ25895_ID
#define BQ25896_ID

#define PUMP_EXPRESS_START_DELAY
#define PUMP_EXPRESS_MAX_TRIES
#define PUMP_EXPRESS_VBUS_MARGIN_uV

enum bq25890_chip_version {};

static const char *const bq25890_chip_name[] =;

enum bq25890_fields {};

/* initial field values, converted to register values */
struct bq25890_init_data {};

struct bq25890_state {};

struct bq25890_device {};

static DEFINE_IDR(bq25890_id);
static DEFINE_MUTEX(bq25890_id_mutex);

static const struct regmap_range bq25890_readonly_reg_ranges[] =;

static const struct regmap_access_table bq25890_writeable_regs =;

static const struct regmap_range bq25890_volatile_reg_ranges[] =;

static const struct regmap_access_table bq25890_volatile_regs =;

static const struct regmap_config bq25890_regmap_config =;

static const struct reg_field bq25890_reg_fields[] =;

/*
 * Most of the val -> idx conversions can be computed, given the minimum,
 * maximum and the step between values. For the rest of conversions, we use
 * lookup tables.
 */
enum bq25890_table_ids {};

/* Thermal Regulation Threshold lookup table, in degrees Celsius */
static const u32 bq25890_treg_tbl[] =;

#define BQ25890_TREG_TBL_SIZE

/* Boost mode current limit lookup table, in uA */
static const u32 bq25890_boosti_tbl[] =;

#define BQ25890_BOOSTI_TBL_SIZE

/* NTC 10K temperature lookup table in tenths of a degree */
static const u32 bq25890_tspct_tbl[] =;

#define BQ25890_TSPCT_TBL_SIZE

struct bq25890_range {};

struct bq25890_lookup {};

static const union {} bq25890_tables[] =;

static int bq25890_field_read(struct bq25890_device *bq,
			      enum bq25890_fields field_id)
{}

static int bq25890_field_write(struct bq25890_device *bq,
			       enum bq25890_fields field_id, u8 val)
{}

static u8 bq25890_find_idx(u32 value, enum bq25890_table_ids id)
{}

static u32 bq25890_find_val(u8 idx, enum bq25890_table_ids id)
{}

enum bq25890_status {};

enum bq25890_chrg_fault {};

enum bq25890_ntc_fault {};

static bool bq25890_is_adc_property(enum power_supply_property psp)
{}

static irqreturn_t __bq25890_handle_irq(struct bq25890_device *bq);

static int bq25890_get_vbus_voltage(struct bq25890_device *bq)
{}

static void bq25890_update_state(struct bq25890_device *bq,
				 enum power_supply_property psp,
				 struct bq25890_state *state)
{}

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

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

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

/*
 * If there are multiple chargers the maximum current the external power-supply
 * can deliver needs to be divided over the chargers. This is done according
 * to the bq->iinlim_percentage setting.
 */
static int bq25890_charger_get_scaled_iinlim_regval(struct bq25890_device *bq,
						    int iinlim_ua)
{}

/* On the BQ25892 try to get charger-type info from our supplier */
static void bq25890_charger_external_power_changed(struct power_supply *psy)
{}

static int bq25890_get_chip_state(struct bq25890_device *bq,
				  struct bq25890_state *state)
{}

static irqreturn_t __bq25890_handle_irq(struct bq25890_device *bq)
{}

static irqreturn_t bq25890_irq_handler_thread(int irq, void *private)
{}

static int bq25890_chip_reset(struct bq25890_device *bq)
{}

static int bq25890_rw_init_data(struct bq25890_device *bq)
{}

static int bq25890_hw_init(struct bq25890_device *bq)
{}

static const enum power_supply_property bq25890_power_supply_props[] =;

static char *bq25890_charger_supplied_to[] =;

static const struct power_supply_desc bq25890_power_supply_desc =;

static int bq25890_power_supply_init(struct bq25890_device *bq)
{}

static int bq25890_set_otg_cfg(struct bq25890_device *bq, u8 val)
{}

static void bq25890_pump_express_work(struct work_struct *data)
{}

static void bq25890_usb_work(struct work_struct *data)
{}

static int bq25890_usb_notifier(struct notifier_block *nb, unsigned long val,
				void *priv)
{}

#ifdef CONFIG_REGULATOR
static int bq25890_vbus_enable(struct regulator_dev *rdev)
{}

static int bq25890_vbus_disable(struct regulator_dev *rdev)
{}

static int bq25890_vbus_is_enabled(struct regulator_dev *rdev)
{}

static int bq25890_vbus_get_voltage(struct regulator_dev *rdev)
{}

static int bq25890_vsys_get_voltage(struct regulator_dev *rdev)
{}

static const struct regulator_ops bq25890_vbus_ops =;

static const struct regulator_desc bq25890_vbus_desc =;

static const struct regulator_ops bq25890_vsys_ops =;

static const struct regulator_desc bq25890_vsys_desc =;

static int bq25890_register_regulator(struct bq25890_device *bq)
{}
#else
static inline int
bq25890_register_regulator(struct bq25890_device *bq)
{
	return 0;
}
#endif

static int bq25890_get_chip_version(struct bq25890_device *bq)
{}

static int bq25890_irq_probe(struct bq25890_device *bq)
{}

static int bq25890_fw_read_u32_props(struct bq25890_device *bq)
{}

static int bq25890_fw_probe(struct bq25890_device *bq)
{}

static void bq25890_non_devm_cleanup(void *data)
{}

static int bq25890_probe(struct i2c_client *client)
{}

static void bq25890_remove(struct i2c_client *client)
{}

static void bq25890_shutdown(struct i2c_client *client)
{}

#ifdef CONFIG_PM_SLEEP
static int bq25890_suspend(struct device *dev)
{}

static int bq25890_resume(struct device *dev)
{}
#endif

static const struct dev_pm_ops bq25890_pm =;

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

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

#ifdef CONFIG_ACPI
static const struct acpi_device_id bq25890_acpi_match[] =;
MODULE_DEVICE_TABLE(acpi, bq25890_acpi_match);
#endif

static struct i2c_driver bq25890_driver =;
module_i2c_driver();

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