#include <linux/bits.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/regulator/driver.h>
#include <linux/regulator/machine.h>
#include <linux/regulator/of_regulator.h>
#define RT5120_REG_PGSTAT …
#define RT5120_REG_CH1VID …
#define RT5120_REG_CH1SLPVID …
#define RT5120_REG_ENABLE …
#define RT5120_REG_MODECTL …
#define RT5120_REG_UVOVPROT …
#define RT5120_REG_SLPCTL …
#define RT5120_REG_INTSTAT …
#define RT5120_REG_DISCHG …
#define RT5120_OUTPG_MASK(rid) …
#define RT5120_OUTUV_MASK(rid) …
#define RT5120_OUTOV_MASK(rid) …
#define RT5120_CH1VID_MASK …
#define RT5120_RIDEN_MASK(rid) …
#define RT5120_RADEN_MASK(rid) …
#define RT5120_FPWM_MASK(rid) …
#define RT5120_UVHICCUP_MASK …
#define RT5120_OVHICCUP_MASK …
#define RT5120_HOTDIE_MASK …
#define RT5120_BUCK1_MINUV …
#define RT5120_BUCK1_MAXUV …
#define RT5120_BUCK1_STEPUV …
#define RT5120_BUCK1_NUM_VOLT …
#define RT5120_AUTO_MODE …
#define RT5120_FPWM_MODE …
enum { … };
struct rt5120_priv { … };
static int rt5120_buck_set_mode(struct regulator_dev *rdev, unsigned int mode)
{ … }
static unsigned int rt5120_buck_get_mode(struct regulator_dev *rdev)
{ … }
static int rt5120_regulator_get_error_flags(struct regulator_dev *rdev,
unsigned int *flags)
{ … }
static int rt5120_buck1_set_suspend_voltage(struct regulator_dev *rdev, int uV)
{ … }
static int rt5120_regulator_set_suspend_enable(struct regulator_dev *rdev)
{ … }
static int rt5120_regulator_set_suspend_disable(struct regulator_dev *rdev)
{ … }
static const struct regulator_ops rt5120_buck1_ops = …;
static const struct regulator_ops rt5120_buck234_ops = …;
static const struct regulator_ops rt5120_ldo_ops = …;
static const struct regulator_ops rt5120_exten_ops = …;
static unsigned int rt5120_buck_of_map_mode(unsigned int mode)
{ … }
static void rt5120_fillin_regulator_desc(struct regulator_desc *desc, int rid)
{ … }
static int rt5120_of_parse_cb(struct rt5120_priv *priv, int rid,
struct of_regulator_match *match)
{ … }
static struct of_regulator_match rt5120_regu_match[RT5120_MAX_REGULATOR] = …;
static int rt5120_parse_regulator_dt_data(struct rt5120_priv *priv)
{ … }
static int rt5120_device_property_init(struct rt5120_priv *priv)
{ … }
static int rt5120_regulator_probe(struct platform_device *pdev)
{ … }
static const struct platform_device_id rt5120_regulator_dev_table[] = …;
MODULE_DEVICE_TABLE(platform, rt5120_regulator_dev_table);
static struct platform_driver rt5120_regulator_driver = …;
module_platform_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;