#include <linux/bug.h>
#include <linux/err.h>
#include <linux/gpio/consumer.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/regulator/driver.h>
#include <linux/regulator/machine.h>
#include <linux/mfd/max8997.h>
#include <linux/mfd/max8997-private.h>
#include <linux/regulator/of_regulator.h>
struct max8997_data { … };
static const unsigned int safeoutvolt[] = …;
static inline void max8997_set_gpio(struct max8997_data *max8997)
{ … }
struct voltage_map_desc { … };
static const struct voltage_map_desc ldo_voltage_map_desc = …;
static const struct voltage_map_desc buck1245_voltage_map_desc = …;
static const struct voltage_map_desc buck37_voltage_map_desc = …;
static const struct voltage_map_desc charger_current_map_desc = …;
static const struct voltage_map_desc topoff_current_map_desc = …;
static const struct voltage_map_desc *reg_voltage_map[] = …;
static int max8997_list_voltage_charger_cv(struct regulator_dev *rdev,
unsigned int selector)
{ … }
static int max8997_list_voltage(struct regulator_dev *rdev,
unsigned int selector)
{ … }
static int max8997_get_enable_register(struct regulator_dev *rdev,
int *reg, int *mask, int *pattern)
{ … }
static int max8997_reg_is_enabled(struct regulator_dev *rdev)
{ … }
static int max8997_reg_enable(struct regulator_dev *rdev)
{ … }
static int max8997_reg_disable(struct regulator_dev *rdev)
{ … }
static int max8997_get_voltage_register(struct regulator_dev *rdev,
int *_reg, int *_shift, int *_mask)
{ … }
static int max8997_get_voltage_sel(struct regulator_dev *rdev)
{ … }
static inline int max8997_get_voltage_proper_val(
const struct voltage_map_desc *desc,
int min_vol, int max_vol)
{ … }
static int max8997_set_voltage_charger_cv(struct regulator_dev *rdev,
int min_uV, int max_uV, unsigned *selector)
{ … }
static int max8997_set_voltage_ldobuck(struct regulator_dev *rdev,
int min_uV, int max_uV, unsigned *selector)
{ … }
static int max8997_set_voltage_buck_time_sel(struct regulator_dev *rdev,
unsigned int old_selector,
unsigned int new_selector)
{ … }
static int max8997_assess_side_effect(struct regulator_dev *rdev,
u8 new_val, int *best)
{ … }
static int max8997_set_voltage_buck(struct regulator_dev *rdev,
int min_uV, int max_uV, unsigned *selector)
{ … }
static int max8997_set_voltage_safeout_sel(struct regulator_dev *rdev,
unsigned selector)
{ … }
static int max8997_reg_disable_suspend(struct regulator_dev *rdev)
{ … }
static const struct regulator_ops max8997_ldo_ops = …;
static const struct regulator_ops max8997_buck_ops = …;
static const struct regulator_ops max8997_fixedvolt_ops = …;
static const struct regulator_ops max8997_safeout_ops = …;
static const struct regulator_ops max8997_fixedstate_ops = …;
static int max8997_set_current_limit(struct regulator_dev *rdev,
int min_uA, int max_uA)
{ … }
static int max8997_get_current_limit(struct regulator_dev *rdev)
{ … }
static const struct regulator_ops max8997_charger_ops = …;
static const struct regulator_ops max8997_charger_fixedstate_ops = …;
#define MAX8997_VOLTAGE_REGULATOR(_name, _ops) …
#define MAX8997_CURRENT_REGULATOR(_name, _ops) …
static struct regulator_desc regulators[] = …;
#ifdef CONFIG_OF
static int max8997_pmic_dt_parse_pdata(struct platform_device *pdev,
struct max8997_platform_data *pdata)
{ … }
#else
static int max8997_pmic_dt_parse_pdata(struct platform_device *pdev,
struct max8997_platform_data *pdata)
{
return 0;
}
#endif
static int max8997_pmic_probe(struct platform_device *pdev)
{ … }
static const struct platform_device_id max8997_pmic_id[] = …;
MODULE_DEVICE_TABLE(platform, max8997_pmic_id);
static struct platform_driver max8997_pmic_driver = …;
static int __init max8997_pmic_init(void)
{ … }
subsys_initcall(max8997_pmic_init);
static void __exit max8997_pmic_cleanup(void)
{ … }
module_exit(max8997_pmic_cleanup);
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;