linux/drivers/power/supply/rt9467-charger.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (C) 2022 Richtek Technology Corp.
 *
 * Author: ChiYuan Huang <[email protected]>
 *         ChiaEn Wu <[email protected]>
 */

#include <linux/bits.h>
#include <linux/bitfield.h>
#include <linux/completion.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/kstrtox.h>
#include <linux/linear_range.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/mutex.h>
#include <linux/of.h>
#include <linux/power_supply.h>
#include <linux/regmap.h>
#include <linux/regulator/driver.h>
#include <linux/units.h>
#include <linux/sysfs.h>

#define RT9467_REG_CORE_CTRL0
#define RT9467_REG_CHG_CTRL1
#define RT9467_REG_CHG_CTRL2
#define RT9467_REG_CHG_CTRL3
#define RT9467_REG_CHG_CTRL4
#define RT9467_REG_CHG_CTRL5
#define RT9467_REG_CHG_CTRL6
#define RT9467_REG_CHG_CTRL7
#define RT9467_REG_CHG_CTRL8
#define RT9467_REG_CHG_CTRL9
#define RT9467_REG_CHG_CTRL10
#define RT9467_REG_CHG_CTRL12
#define RT9467_REG_CHG_CTRL13
#define RT9467_REG_CHG_CTRL14
#define RT9467_REG_CHG_ADC
#define RT9467_REG_CHG_DPDM1
#define RT9467_REG_CHG_DPDM2
#define RT9467_REG_DEVICE_ID
#define RT9467_REG_CHG_STAT
#define RT9467_REG_ADC_DATA_H
#define RT9467_REG_CHG_STATC
#define RT9467_REG_CHG_IRQ1
#define RT9467_REG_CHG_STATC_CTRL
#define RT9467_REG_CHG_IRQ1_CTRL

#define RT9467_MASK_PWR_RDY
#define RT9467_MASK_MIVR_STAT
#define RT9467_MASK_OTG_CSEL
#define RT9467_MASK_OTG_VSEL
#define RT9467_MASK_OTG_EN
#define RT9467_MASK_ADC_IN_SEL
#define RT9467_MASK_ADC_START

#define RT9467_NUM_IRQ_REGS
#define RT9467_ICHG_MIN_uA
#define RT9467_ICHG_MAX_uA
#define RT9467_CV_MAX_uV
#define RT9467_OTG_MIN_uV
#define RT9467_OTG_MAX_uV
#define RT9467_OTG_STEP_uV
#define RT9467_NUM_VOTG
#define RT9467_AICLVTH_GAP_uV
#define RT9467_ADCCONV_TIME_MS

#define RT9466_VID
#define RT9467_VID

/* IRQ number */
#define RT9467_IRQ_TS_STATC
#define RT9467_IRQ_CHG_FAULT
#define RT9467_IRQ_CHG_STATC
#define RT9467_IRQ_CHG_TMR
#define RT9467_IRQ_CHG_BATABS
#define RT9467_IRQ_CHG_ADPBAD
#define RT9467_IRQ_CHG_RVP
#define RT9467_IRQ_OTP

#define RT9467_IRQ_CHG_AICLM
#define RT9467_IRQ_CHG_ICHGM
#define RT9467_IRQ_WDTMR
#define RT9467_IRQ_SSFINISH
#define RT9467_IRQ_CHG_RECHG
#define RT9467_IRQ_CHG_TERM
#define RT9467_IRQ_CHG_IEOC

#define RT9467_IRQ_ADC_DONE
#define RT9467_IRQ_PUMPX_DONE
#define RT9467_IRQ_BST_BATUV
#define RT9467_IRQ_BST_MIDOV
#define RT9467_IRQ_BST_OLP

#define RT9467_IRQ_ATTACH
#define RT9467_IRQ_DETACH
#define RT9467_IRQ_HVDCP_DET
#define RT9467_IRQ_CHGDET
#define RT9467_IRQ_DCDT

enum rt9467_fields {};

static const struct regmap_irq rt9467_irqs[] =;

static const struct regmap_irq_chip rt9467_irq_chip =;

enum rt9467_ranges {};

static const struct linear_range rt9467_ranges[RT9467_RANGES_MAX] =;

static const struct reg_field rt9467_chg_fields[] =;

enum {};

enum rt9467_adc_chan {};

enum rt9467_chg_type {};

enum rt9467_iin_limit_sel {};

struct rt9467_chg_data {};

static int rt9467_otg_of_parse_cb(struct device_node *of,
				  const struct regulator_desc *desc,
				  struct regulator_config *cfg)
{}

static const struct regulator_ops rt9467_otg_regulator_ops =;

static const u32 rt9467_otg_microamp[] =;

static const struct regulator_desc rt9467_otg_desc =;

static int rt9467_register_otg_regulator(struct rt9467_chg_data *data)
{}

static int rt9467_get_value_from_ranges(struct rt9467_chg_data *data,
					enum rt9467_fields field,
					enum rt9467_ranges rsel,
					int *value)
{}

static int rt9467_set_value_from_ranges(struct rt9467_chg_data *data,
					enum rt9467_fields field,
					enum rt9467_ranges rsel,
					int value)
{}

static int rt9467_get_adc_sel(enum rt9467_adc_chan chan, int *sel)
{}

static int rt9467_get_adc_raw_data(struct rt9467_chg_data *data,
				   enum rt9467_adc_chan chan, int *val)
{}

static int rt9467_get_adc(struct rt9467_chg_data *data,
			  enum rt9467_adc_chan chan, int *val)
{}

static int rt9467_psy_get_status(struct rt9467_chg_data *data, int *state)
{}

static int rt9467_psy_set_ichg(struct rt9467_chg_data *data, int microamp)
{}

static int rt9467_run_aicl(struct rt9467_chg_data *data)
{}

static int rt9467_psy_set_ieoc(struct rt9467_chg_data *data, int microamp)
{}

static const enum power_supply_usb_type rt9467_chg_usb_types[] =;

static const enum power_supply_property rt9467_chg_properties[] =;

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

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

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

static const struct power_supply_desc rt9467_chg_psy_desc =;

static inline struct rt9467_chg_data *psy_device_to_chip(struct device *dev)
{}

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

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

static DEVICE_ATTR_RW(sysoff_enable);

static struct attribute *rt9467_sysfs_attrs[] =;

ATTRIBUTE_GROUPS();

static int rt9467_register_psy(struct rt9467_chg_data *data)
{}

static int rt9467_mivr_handler(struct rt9467_chg_data *data)
{}

static irqreturn_t rt9467_statc_handler(int irq, void *priv)
{}

static irqreturn_t rt9467_wdt_handler(int irq, void *priv)
{}

static int rt9467_report_usb_state(struct rt9467_chg_data *data)
{}

static irqreturn_t rt9467_usb_state_handler(int irq, void *priv)
{}

static irqreturn_t rt9467_aiclmeas_handler(int irq, void *priv)
{}

#define RT9467_IRQ_DESC(_name, _handler_func, _hwirq)

static int rt9467_request_interrupt(struct rt9467_chg_data *data)
{}

static int rt9467_do_charger_init(struct rt9467_chg_data *data)
{}

static bool rt9467_is_accessible_reg(struct device *dev, unsigned int reg)
{}

static const struct regmap_config rt9467_regmap_config =;

static int rt9467_check_vendor_info(struct rt9467_chg_data *data)
{}

static int rt9467_reset_chip(struct rt9467_chg_data *data)
{}

static void rt9467_chg_destroy_adc_lock(void *data)
{}

static void rt9467_chg_destroy_attach_lock(void *data)
{}

static void rt9467_chg_destroy_ichg_ieoc_lock(void *data)
{}

static void rt9467_chg_complete_aicl_done(void *data)
{}

static int rt9467_charger_probe(struct i2c_client *i2c)
{}

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

static struct i2c_driver rt9467_charger_driver =;
module_i2c_driver();

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