linux/drivers/regulator/twl6030-regulator.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Split TWL6030 logic from twl-regulator.c:
 * Copyright (C) 2008 David Brownell
 *
 * Copyright (C) 2016 Nicolae Rosia <[email protected]>
 */

#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>

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
/* TWL6030 register offsets */
#define VREG_TRANS
#define VREG_STATE
#define VREG_VOLTAGE
#define VREG_VOLTAGE_SMPS
/* TWL6030 Misc register offsets */
#define VREG_BC_ALL
#define VREG_BC_REF
#define VREG_BC_PROC
#define VREG_BC_CLK_RST

/* TWL6030 LDO register values for VREG_VOLTAGE */
#define TWL6030_VREG_VOLTAGE_WR_S

/* TWL6030 LDO register values for CFG_STATE */
#define TWL6030_CFG_STATE_OFF
#define TWL6030_CFG_STATE_ON
#define TWL6030_CFG_STATE_OFF2
#define TWL6030_CFG_STATE_SLEEP
#define TWL6030_CFG_STATE_GRP_SHIFT
#define TWL6030_CFG_STATE_APP_SHIFT
#define TWL6030_CFG_STATE_MASK
#define TWL6030_CFG_STATE_APP_MASK
#define TWL6030_CFG_STATE_APP(v)

/* Flags for SMPS Voltage reading and LDO reading*/
#define SMPS_OFFSET_EN
#define SMPS_EXTENDED_EN
#define TWL_6030_WARM_RESET

/* twl6032 SMPS EPROM values */
#define TWL6030_SMPS_OFFSET
#define TWL6030_SMPS_MULT
#define SMPS_MULTOFFSET_SMPS4
#define SMPS_MULTOFFSET_VIO
#define SMPS_MULTOFFSET_SMPS3

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 6030 family */
#define P3_GRP_6030
#define P2_GRP_6030
#define P1_GRP_6030

static int twl6030reg_is_enabled(struct regulator_dev *rdev)
{}

#define PB_I2C_BUSY
#define PB_I2C_BWEN


static int twl6030reg_enable(struct regulator_dev *rdev)
{}

static int twl6030reg_disable(struct regulator_dev *rdev)
{}

static int twl6030reg_get_status(struct regulator_dev *rdev)
{}

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

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

static int twl6030coresmps_get_voltage(struct regulator_dev *rdev)
{}

static const struct regulator_ops twl6030coresmps_ops =;

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

static int twl6030ldo_get_voltage_sel(struct regulator_dev *rdev)
{}

static const struct regulator_ops twl6030ldo_ops =;

static const struct regulator_ops twl6030fixed_ops =;

/*
 * SMPS status and control
 */

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

static int twl6030smps_map_voltage(struct regulator_dev *rdev, int min_uV,
				   int max_uV)
{}

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

static int twl6030smps_get_voltage_sel(struct regulator_dev *rdev)
{}

static const struct regulator_ops twlsmps_ops =;

/*----------------------------------------------------------------------*/
static const struct linear_range twl6030ldo_linear_range[] =;

#define TWL6030_ADJUSTABLE_SMPS(label)

#define TWL6030_ADJUSTABLE_LDO(label, offset)

#define TWL6032_ADJUSTABLE_LDO(label, offset)

#define TWL6030_FIXED_LDO(label, offset, mVolts, turnon_delay)

#define TWL6032_ADJUSTABLE_SMPS(label, offset)

/* VUSBCP is managed *only* by the USB subchip */
/* 6030 REG with base as PMC Slave Misc : 0x0030 */
/* Turnon-delay and remap configuration values for 6030 are not
   verified since the specification is not public */
TWL6030_ADJUSTABLE_SMPS();
TWL6030_ADJUSTABLE_SMPS();
TWL6030_ADJUSTABLE_SMPS();
TWL6030_ADJUSTABLE_LDO();
TWL6030_ADJUSTABLE_LDO();
TWL6030_ADJUSTABLE_LDO();
TWL6030_ADJUSTABLE_LDO();
TWL6030_ADJUSTABLE_LDO();
TWL6030_ADJUSTABLE_LDO();
/* 6025 are renamed compared to 6030 versions */
TWL6032_ADJUSTABLE_LDO();
TWL6032_ADJUSTABLE_LDO();
TWL6032_ADJUSTABLE_LDO();
TWL6032_ADJUSTABLE_LDO();
TWL6032_ADJUSTABLE_LDO();
TWL6032_ADJUSTABLE_LDO();
TWL6032_ADJUSTABLE_LDO();
TWL6032_ADJUSTABLE_LDO();
TWL6032_ADJUSTABLE_LDO();
TWL6030_FIXED_LDO();
TWL6030_FIXED_LDO();
TWL6030_FIXED_LDO();
TWL6030_FIXED_LDO();
TWL6030_FIXED_LDO();
TWL6030_FIXED_LDO();
TWL6032_ADJUSTABLE_SMPS();
TWL6032_ADJUSTABLE_SMPS();
TWL6032_ADJUSTABLE_SMPS();

static u8 twl_get_smps_offset(void)
{}

static u8 twl_get_smps_mult(void)
{}

#define TWL_OF_MATCH(comp, family, 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();