linux/drivers/regulator/max1586.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * max1586.c  --  Voltage and current regulation for the Maxim 1586
 *
 * Copyright (C) 2008 Robert Jarzmik
 */
#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/max1586.h>
#include <linux/of.h>
#include <linux/regulator/of_regulator.h>

#define MAX1586_V3_MAX_VSEL
#define MAX1586_V6_MAX_VSEL

#define MAX1586_V3_MIN_UV
#define MAX1586_V3_MAX_UV

#define MAX1586_V6_MIN_UV
#define MAX1586_V6_MAX_UV

#define I2C_V3_SELECT
#define I2C_V6_SELECT

struct max1586_data {};

/*
 * V6 voltage
 * On I2C bus, sending a "x" byte to the max1586 means :
 *   set V6 to either 0V, 1.8V, 2.5V, 3V depending on (x & 0x3)
 * As regulator framework doesn't accept voltages to be 0V, we use 1uV.
 */
static const unsigned int v6_voltages_uv[] =;

/*
 * V3 voltage
 * On I2C bus, sending a "x" byte to the max1586 means :
 *   set V3 to 0.700V + (x & 0x1f) * 0.025V
 * This voltage can be increased by external resistors
 * R24 and R25=100kOhm as described in the data sheet.
 * The gain is approximately: 1 + R24/R25 + R24/185.5kOhm
 */
static int max1586_v3_get_voltage_sel(struct regulator_dev *rdev)
{}

static int max1586_v3_set_voltage_sel(struct regulator_dev *rdev,
				      unsigned selector)
{}

static int max1586_v6_get_voltage_sel(struct regulator_dev *rdev)
{}

static int max1586_v6_set_voltage_sel(struct regulator_dev *rdev,
				      unsigned int selector)
{}

/*
 * The Maxim 1586 controls V3 and V6 voltages, but offers no way of reading back
 * the set up value.
 */
static const struct regulator_ops max1586_v3_ops =;

static const struct regulator_ops max1586_v6_ops =;

static struct regulator_desc max1586_reg[] =;

static int of_get_max1586_platform_data(struct device *dev,
				 struct max1586_platform_data *pdata)
{}

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

static int max1586_pmic_probe(struct i2c_client *client)
{}

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

static struct i2c_driver max1586_pmic_driver =;

static int __init max1586_pmic_init(void)
{}
subsys_initcall(max1586_pmic_init);

static void __exit max1586_pmic_exit(void)
{}
module_exit(max1586_pmic_exit);

/* Module information */
MODULE_DESCRIPTION();
MODULE_AUTHOR();
MODULE_LICENSE();