#include <linux/module.h>
#include <linux/err.h>
#include <linux/i2c.h>
#include <linux/platform_device.h>
#include <linux/regulator/driver.h>
#include <linux/slab.h>
#include <linux/regulator/max8660.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/regulator/of_regulator.h>
#define MAX8660_DCDC_MIN_UV …
#define MAX8660_DCDC_MAX_UV …
#define MAX8660_DCDC_STEP …
#define MAX8660_DCDC_MAX_SEL …
#define MAX8660_LDO5_MIN_UV …
#define MAX8660_LDO5_MAX_UV …
#define MAX8660_LDO5_STEP …
#define MAX8660_LDO5_MAX_SEL …
#define MAX8660_LDO67_MIN_UV …
#define MAX8660_LDO67_MAX_UV …
#define MAX8660_LDO67_STEP …
#define MAX8660_LDO67_MAX_SEL …
enum { … };
struct max8660 { … };
static int max8660_write(struct max8660 *max8660, u8 reg, u8 mask, u8 val)
{ … }
static int max8660_dcdc_is_enabled(struct regulator_dev *rdev)
{ … }
static int max8660_dcdc_enable(struct regulator_dev *rdev)
{ … }
static int max8660_dcdc_disable(struct regulator_dev *rdev)
{ … }
static int max8660_dcdc_get_voltage_sel(struct regulator_dev *rdev)
{ … }
static int max8660_dcdc_set_voltage_sel(struct regulator_dev *rdev,
unsigned int selector)
{ … }
static struct regulator_ops max8660_dcdc_ops = …;
static int max8660_ldo5_get_voltage_sel(struct regulator_dev *rdev)
{ … }
static int max8660_ldo5_set_voltage_sel(struct regulator_dev *rdev,
unsigned int selector)
{ … }
static const struct regulator_ops max8660_ldo5_ops = …;
static int max8660_ldo67_is_enabled(struct regulator_dev *rdev)
{ … }
static int max8660_ldo67_enable(struct regulator_dev *rdev)
{ … }
static int max8660_ldo67_disable(struct regulator_dev *rdev)
{ … }
static int max8660_ldo67_get_voltage_sel(struct regulator_dev *rdev)
{ … }
static int max8660_ldo67_set_voltage_sel(struct regulator_dev *rdev,
unsigned int selector)
{ … }
static const struct regulator_ops max8660_ldo67_ops = …;
static const struct regulator_desc max8660_reg[] = …;
enum { … };
#ifdef CONFIG_OF
static const struct of_device_id max8660_dt_ids[] = …;
MODULE_DEVICE_TABLE(of, max8660_dt_ids);
static int max8660_pdata_from_dt(struct device *dev,
struct device_node **of_node,
struct max8660_platform_data *pdata)
{ … }
#else
static inline int max8660_pdata_from_dt(struct device *dev,
struct device_node **of_node,
struct max8660_platform_data *pdata)
{
return 0;
}
#endif
static int max8660_probe(struct i2c_client *client)
{ … }
static const struct i2c_device_id max8660_id[] = …;
MODULE_DEVICE_TABLE(i2c, max8660_id);
static struct i2c_driver max8660_driver = …;
static int __init max8660_init(void)
{ … }
subsys_initcall(max8660_init);
static void __exit max8660_exit(void)
{ … }
module_exit(max8660_exit);
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;