linux/drivers/regulator/tps65090-regulator.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Regulator driver for tps65090 power management chip.
 *
 * Copyright (c) 2012, NVIDIA CORPORATION.  All rights reserved.

 */

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

#define MAX_CTRL_READ_TRIES
#define MAX_FET_ENABLE_TRIES

#define CTRL_EN_BIT
#define CTRL_WT_BIT
#define CTRL_PG_BIT
#define CTRL_TO_BIT

#define MAX_OVERCURRENT_WAIT

/**
 * struct tps65090_regulator - Per-regulator data for a tps65090 regulator
 *
 * @dev: Pointer to our device.
 * @desc: The struct regulator_desc for the regulator.
 * @rdev: The struct regulator_dev for the regulator.
 * @overcurrent_wait_valid: True if overcurrent_wait is valid.
 * @overcurrent_wait: For FETs, the value to put in the WTFET bitfield.
 */

struct tps65090_regulator {};

static const struct regulator_ops tps65090_ext_control_ops =;

/**
 * tps65090_reg_set_overcurrent_wait - Setup overcurrent wait
 *
 * This will set the overcurrent wait time based on what's in the regulator
 * info.
 *
 * @ri:		Overall regulator data
 * @rdev:	Regulator device
 *
 * Return: 0 if no error, non-zero if there was an error writing the register.
 */
static int tps65090_reg_set_overcurrent_wait(struct tps65090_regulator *ri,
					     struct regulator_dev *rdev)
{}

/**
 * tps65090_try_enable_fet - Try to enable a FET
 *
 * @rdev:	Regulator device
 *
 * Return: 0 if ok, -ENOTRECOVERABLE if the FET power good bit did not get
 * set, or some other -ve value if another error occurred (e.g. i2c error)
 */
static int tps65090_try_enable_fet(struct regulator_dev *rdev)
{}

/**
 * tps65090_fet_enable - Enable a FET, trying a few times if it fails
 *
 * Some versions of the tps65090 have issues when turning on the FETs.
 * This function goes through several steps to ensure the best chance of the
 * FET going on.  Specifically:
 * - We'll make sure that we bump the "overcurrent wait" to the maximum, which
 *   increases the chances that we'll turn on properly.
 * - We'll retry turning the FET on multiple times (turning off in between).
 *
 * @rdev:	Regulator device
 *
 * Return: 0 if ok, non-zero if it fails.
 */
static int tps65090_fet_enable(struct regulator_dev *rdev)
{}

static const struct regulator_ops tps65090_reg_control_ops =;

static const struct regulator_ops tps65090_fet_control_ops =;

static const struct regulator_ops tps65090_ldo_ops =;

#define tps65090_REG_DESC(_id, _sname, _en_reg, _en_bits, _nvolt, _volt, _ops)

#define tps65090_REG_FIXEDV(_id, _sname, en_reg, _en_bits, _volt, _ops)

#define tps65090_REG_SWITCH(_id, _sname, en_reg, _en_bits, _ops)

static struct regulator_desc tps65090_regulator_desc[] =;

static inline bool is_dcdc(int id)
{}

static int tps65090_config_ext_control(
	struct tps65090_regulator *ri, bool enable)
{}

static int tps65090_regulator_disable_ext_control(
		struct tps65090_regulator *ri,
		struct tps65090_regulator_plat_data *tps_pdata)
{}

#ifdef CONFIG_OF
static struct of_regulator_match tps65090_matches[] =;

static struct tps65090_platform_data *tps65090_parse_dt_reg_data(
		struct platform_device *pdev,
		struct of_regulator_match **tps65090_reg_matches)
{}
#else
static inline struct tps65090_platform_data *tps65090_parse_dt_reg_data(
			struct platform_device *pdev,
			struct of_regulator_match **tps65090_reg_matches)
{
	*tps65090_reg_matches = NULL;
	return NULL;
}
#endif

static int tps65090_regulator_probe(struct platform_device *pdev)
{}

static struct platform_driver tps65090_regulator_driver =;

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

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

MODULE_DESCRIPTION();
MODULE_AUTHOR();
MODULE_LICENSE();
MODULE_ALIAS();