linux/drivers/regulator/bd71815-regulator.c

// SPDX-License-Identifier: GPL-2.0-only
//
// Copyright 2014 Embest Technology Co. Ltd. Inc.
// bd71815-regulator.c ROHM BD71815 regulator driver
//
// Author: Tony Luo <[email protected]>
//
// Partially rewritten at 2021 by
// Matti Vaittinen <[email protected]>

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/err.h>
#include <linux/platform_device.h>
#include <linux/of.h>
#include <linux/gpio/consumer.h>
#include <linux/regulator/driver.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/mfd/rohm-generic.h>
#include <linux/mfd/rohm-bd71815.h>
#include <linux/regulator/of_regulator.h>

struct bd71815_regulator {};

static const int bd7181x_wled_currents[] =;

static const struct rohm_dvs_config buck1_dvs =;

static const struct rohm_dvs_config buck2_dvs =;

static const struct rohm_dvs_config buck3_dvs =;

static const struct rohm_dvs_config buck4_dvs =;

static const struct rohm_dvs_config ldo1_dvs =;

static const struct rohm_dvs_config ldo2_dvs =;

static const struct rohm_dvs_config ldo3_dvs =;

static const struct rohm_dvs_config ldo4_dvs =;

static const struct rohm_dvs_config ldo5_dvs =;

static const struct rohm_dvs_config dvref_dvs =;

static const struct rohm_dvs_config ldolpsr_dvs =;

static const struct rohm_dvs_config buck5_dvs =;

static int set_hw_dvs_levels(struct device_node *np,
			     const struct regulator_desc *desc,
			     struct regulator_config *cfg)
{}

/*
 * Bucks 1 and 2 have two voltage selection registers where selected
 * voltage can be set. Which of the registers is used can be either controlled
 * by a control bit in register - or by HW state. If HW state specific voltages
 * are given - then we assume HW state based control should be used.
 *
 * If volatge value is updated to currently selected register - then output
 * voltage is immediately changed no matter what is set as ramp rate. Thus we
 * default changing voltage by writing new value to inactive register and
 * then updating the 'register selection' bit. This naturally only works when
 * HW state machine is not used to select the voltage.
 */
static int buck12_set_hw_dvs_levels(struct device_node *np,
				    const struct regulator_desc *desc,
				    struct regulator_config *cfg)
{}

/*
 * BUCK1/2
 * BUCK1RAMPRATE[1:0] BUCK1 DVS ramp rate setting
 * 00: 10.00mV/usec	10mV 1uS
 * 01: 5.00mV/usec	10mV 2uS
 * 10: 2.50mV/usec	10mV 4uS
 * 11: 1.25mV/usec	10mV 8uS
 */
static const unsigned int bd7181x_ramp_table[] =;

static int bd7181x_led_set_current_limit(struct regulator_dev *rdev,
					int min_uA, int max_uA)
{}

static int bd7181x_buck12_get_voltage_sel(struct regulator_dev *rdev)
{}

/*
 * For Buck 1/2.
 */
static int bd7181x_buck12_set_voltage_sel(struct regulator_dev *rdev,
					  unsigned int sel)
{}

static const struct regulator_ops bd7181x_ldo_regulator_ops =;

static const struct regulator_ops bd7181x_fixed_regulator_ops =;

static const struct regulator_ops bd7181x_buck_regulator_ops =;

static const struct regulator_ops bd7181x_buck12_regulator_ops =;

static const struct regulator_ops bd7181x_led_regulator_ops =;

#define BD71815_FIXED_REG(_name, _id, ereg, emsk, voltage, _dvs)

#define BD71815_BUCK_REG(_name, _id, vsel, ereg, min, max, step, _dvs)

#define BD71815_BUCK12_REG(_name, _id, vsel, ereg, min, max, step,	\
			   _dvs)

#define BD71815_LED_REG(_name, _id, csel, mask, ereg, emsk, currents)

#define BD71815_LDO_REG(_name, _id, vsel, ereg, emsk, min, max, step,	\
			_dvs)

static const struct bd71815_regulator bd71815_regulators[] =;

static int bd7181x_probe(struct platform_device *pdev)
{}

static const struct platform_device_id bd7181x_pmic_id[] =;
MODULE_DEVICE_TABLE(platform, bd7181x_pmic_id);

static struct platform_driver bd7181x_regulator =;
module_platform_driver();

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