linux/drivers/regulator/twl-regulator.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * twl-regulator.c -- support regulators in twl4030/twl6030 family chips
 *
 * Copyright (C) 2008 David Brownell
 */

#include <linux/module.h>
#include <linux/string.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/err.h>
#include <linux/platform_device.h>
#include <linux/of.h>
#include <linux/regulator/driver.h>
#include <linux/regulator/machine.h>
#include <linux/regulator/of_regulator.h>
#include <linux/mfd/twl.h>
#include <linux/delay.h>

/*
 * The TWL4030/TW5030/TPS659x0 family chips include power management, a
 * USB OTG transceiver, an RTC, ADC, PWM, and lots more.  Some versions
 * include an audio codec, battery charger, and more voltage regulators.
 * These chips are often used in OMAP-based systems.
 *
 * This driver implements software-based resource control for various
 * voltage regulators.  This is usually augmented with state machine
 * based control.
 */

struct twlreg_info {};


/* LDO control registers ... offset is from the base of its register bank.
 * The first three registers of all power resource banks help hardware to
 * manage the various resource groups.
 */
/* Common offset in TWL4030/6030 */
#define VREG_GRP
/* TWL4030 register offsets */
#define VREG_TYPE
#define VREG_REMAP
#define VREG_DEDICATED
#define VREG_VOLTAGE_SMPS_4030
/* TWL6030 register offsets */
#define VREG_TRANS
#define VREG_STATE
#define VREG_VOLTAGE
#define VREG_VOLTAGE_SMPS

static inline int
twlreg_read(struct twlreg_info *info, unsigned slave_subgp, unsigned offset)
{}

static inline int
twlreg_write(struct twlreg_info *info, unsigned slave_subgp, unsigned offset,
						 u8 value)
{}

/*----------------------------------------------------------------------*/

/* generic power resource operations, which work on all regulators */

static int twlreg_grp(struct regulator_dev *rdev)
{}

/*
 * Enable/disable regulators by joining/leaving the P1 (processor) group.
 * We assume nobody else is updating the DEV_GRP registers.
 */
/* definition for 4030 family */
#define P3_GRP_4030
#define P2_GRP_4030
#define P1_GRP_4030
/* definition for 6030 family */
#define P3_GRP_6030
#define P2_GRP_6030
#define P1_GRP_6030

static int twl4030reg_is_enabled(struct regulator_dev *rdev)
{}

#define PB_I2C_BUSY
#define PB_I2C_BWEN

/* Wait until buffer empty/ready to send a word on power bus. */
static int twl4030_wait_pb_ready(void)
{}

/* Send a word over the powerbus */
static int twl4030_send_pb_msg(unsigned msg)
{}

static int twl4030reg_enable(struct regulator_dev *rdev)
{}

static int twl4030reg_disable(struct regulator_dev *rdev)
{}

static int twl4030reg_get_status(struct regulator_dev *rdev)
{}

static int twl4030reg_set_mode(struct regulator_dev *rdev, unsigned mode)
{}

static inline unsigned int twl4030reg_map_mode(unsigned int mode)
{}

/*----------------------------------------------------------------------*/

/*
 * Support for adjustable-voltage LDOs uses a four bit (or less) voltage
 * select field in its control register.   We use tables indexed by VSEL
 * to record voltages in milliVolts.  (Accuracy is about three percent.)
 *
 * Note that VSEL values for VAUX2 changed in twl5030 and newer silicon;
 * currently handled by listing two slightly different VAUX2 regulators,
 * only one of which will be configured.
 *
 * VSEL values documented as "TI cannot support these values" are flagged
 * in these tables as UNSUP() values; we normally won't assign them.
 *
 * VAUX3 at 3V is incorrectly listed in some TI manuals as unsupported.
 * TI are revising the twl5030/tps659x0 specs to support that 3.0V setting.
 */
#define UNSUP_MASK

#define UNSUP(x)
#define IS_UNSUP(info, x)
#define LDO_MV(x)


static const u16 VAUX1_VSEL_table[] =;
static const u16 VAUX2_4030_VSEL_table[] =;
static const u16 VAUX2_VSEL_table[] =;
static const u16 VAUX3_VSEL_table[] =;
static const u16 VAUX4_VSEL_table[] =;
static const u16 VMMC1_VSEL_table[] =;
static const u16 VMMC2_VSEL_table[] =;
static const u16 VPLL1_VSEL_table[] =;
static const u16 VPLL2_VSEL_table[] =;
static const u16 VSIM_VSEL_table[] =;
static const u16 VDAC_VSEL_table[] =;
static const u16 VIO_VSEL_table[] =;
static const u16 VINTANA2_VSEL_table[] =;

/* 600mV to 1450mV in 12.5 mV steps */
static const struct linear_range VDD1_ranges[] =;

/* 600mV to 1450mV in 12.5 mV steps, everything above = 1500mV */
static const struct linear_range VDD2_ranges[] =;

static int twl4030ldo_list_voltage(struct regulator_dev *rdev, unsigned index)
{}

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

static int twl4030ldo_get_voltage_sel(struct regulator_dev *rdev)
{}

static const struct regulator_ops twl4030ldo_ops =;

static int
twl4030smps_set_voltage(struct regulator_dev *rdev, int min_uV, int max_uV,
			unsigned *selector)
{}

static int twl4030smps_get_voltage(struct regulator_dev *rdev)
{}

static const struct regulator_ops twl4030smps_ops =;

/*----------------------------------------------------------------------*/

static const struct regulator_ops twl4030fixed_ops =;

/*----------------------------------------------------------------------*/

#define TWL4030_ADJUSTABLE_LDO(label, offset, num, turnon_delay, remap_conf)

#define TWL4030_ADJUSTABLE_SMPS(label, offset, num, turnon_delay, remap_conf, \
		n_volt)

#define TWL4030_FIXED_LDO(label, offset, mVolts, num, turnon_delay, \
			remap_conf)

/*
 * We list regulators here if systems need some level of
 * software control over them after boot.
 */
TWL4030_ADJUSTABLE_LDO();
TWL4030_ADJUSTABLE_LDO();
TWL4030_ADJUSTABLE_LDO();
TWL4030_ADJUSTABLE_LDO();
TWL4030_ADJUSTABLE_LDO();
TWL4030_ADJUSTABLE_LDO();
TWL4030_ADJUSTABLE_LDO();
TWL4030_ADJUSTABLE_LDO();
TWL4030_ADJUSTABLE_LDO();
TWL4030_ADJUSTABLE_LDO();
TWL4030_ADJUSTABLE_LDO();
TWL4030_ADJUSTABLE_LDO();
TWL4030_ADJUSTABLE_LDO();
TWL4030_ADJUSTABLE_SMPS();
TWL4030_ADJUSTABLE_SMPS();
/* VUSBCP is managed *only* by the USB subchip */
TWL4030_FIXED_LDO();
TWL4030_FIXED_LDO();
TWL4030_FIXED_LDO();
TWL4030_FIXED_LDO();
TWL4030_FIXED_LDO();

#define TWL_OF_MATCH(comp, family, label)

#define TWL4030_OF_MATCH(comp, label)
#define TWL6030_OF_MATCH(comp, label)
#define TWL6032_OF_MATCH(comp, label)
#define TWLFIXED_OF_MATCH(comp, label)
#define TWLSMPS_OF_MATCH(comp, label)

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

static int twlreg_probe(struct platform_device *pdev)
{}

MODULE_ALIAS();

static struct platform_driver twlreg_driver =;

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

static void __exit twlreg_exit(void)
{}
module_exit()

MODULE_DESCRIPTION();
MODULE_LICENSE();