linux/drivers/regulator/max8973-regulator.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * max8973-regulator.c -- Maxim max8973A
 *
 * Regulator driver for MAXIM 8973A DC-DC step-down switching regulator.
 *
 * Copyright (c) 2012, NVIDIA Corporation.
 *
 * Author: Laxman Dewangan <[email protected]>
 */

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/err.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/regulator/driver.h>
#include <linux/regulator/machine.h>
#include <linux/regulator/max8973-regulator.h>
#include <linux/regulator/of_regulator.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/slab.h>
#include <linux/regmap.h>
#include <linux/thermal.h>
#include <linux/irq.h>
#include <linux/interrupt.h>

/* Register definitions */
#define MAX8973_VOUT
#define MAX8973_VOUT_DVS
#define MAX8973_CONTROL1
#define MAX8973_CONTROL2
#define MAX8973_CHIPID1
#define MAX8973_CHIPID2

#define MAX8973_MAX_VOUT_REG

/* MAX8973_VOUT */
#define MAX8973_VOUT_ENABLE
#define MAX8973_VOUT_MASK

/* MAX8973_VOUT_DVS */
#define MAX8973_DVS_VOUT_MASK

/* MAX8973_CONTROL1 */
#define MAX8973_SNS_ENABLE
#define MAX8973_FPWM_EN_M
#define MAX8973_NFSR_ENABLE
#define MAX8973_AD_ENABLE
#define MAX8973_BIAS_ENABLE
#define MAX8973_FREQSHIFT_9PER

#define MAX8973_RAMP_12mV_PER_US
#define MAX8973_RAMP_25mV_PER_US
#define MAX8973_RAMP_50mV_PER_US
#define MAX8973_RAMP_200mV_PER_US
#define MAX8973_RAMP_MASK

/* MAX8973_CONTROL2 */
#define MAX8973_WDTMR_ENABLE
#define MAX8973_DISCH_ENBABLE
#define MAX8973_FT_ENABLE
#define MAX77621_T_JUNCTION_120

#define MAX8973_CKKADV_TRIP_MASK
#define MAX8973_CKKADV_TRIP_DISABLE
#define MAX8973_CKKADV_TRIP_75mV_PER_US
#define MAX8973_CKKADV_TRIP_150mV_PER_US
#define MAX8973_CKKADV_TRIP_75mV_PER_US_HIST_DIS
#define MAX8973_CONTROL_CLKADV_TRIP_MASK

#define MAX8973_INDUCTOR_MIN_30_PER
#define MAX8973_INDUCTOR_NOMINAL
#define MAX8973_INDUCTOR_PLUS_30_PER
#define MAX8973_INDUCTOR_PLUS_60_PER
#define MAX8973_CONTROL_INDUCTOR_VALUE_MASK

#define MAX8973_MIN_VOLATGE
#define MAX8973_MAX_VOLATGE
#define MAX8973_VOLATGE_STEP
#define MAX8973_BUCK_N_VOLTAGE

#define MAX77621_CHIPID_TJINT_S

#define MAX77621_NORMAL_OPERATING_TEMP
#define MAX77621_TJINT_WARNING_TEMP_120
#define MAX77621_TJINT_WARNING_TEMP_140

enum device_id {};

/* Maxim 8973 chip information */
struct max8973_chip {};

/*
 * find_voltage_set_register: Find new voltage configuration register (VOUT).
 * The finding of the new VOUT register will be based on the LRU mechanism.
 * Each VOUT register will have different voltage configured . This
 * Function will look if any of the VOUT register have requested voltage set
 * or not.
 *     - If it is already there then it will make that register as most
 *       recently used and return as found so that caller need not to set
 *       the VOUT register but need to set the proper gpios to select this
 *       VOUT register.
 *     - If requested voltage is not found then it will use the least
 *       recently mechanism to get new VOUT register for new configuration
 *       and will return not_found so that caller need to set new VOUT
 *       register and then gpios (both).
 */
static bool find_voltage_set_register(struct max8973_chip *tps,
		int req_vsel, int *vout_reg, int *gpio_val)
{}

static int max8973_dcdc_get_voltage_sel(struct regulator_dev *rdev)
{}

static int max8973_dcdc_set_voltage_sel(struct regulator_dev *rdev,
	     unsigned vsel)
{}

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

static unsigned int max8973_dcdc_get_mode(struct regulator_dev *rdev)
{}

static int max8973_set_current_limit(struct regulator_dev *rdev,
		int min_ua, int max_ua)
{}

static int max8973_get_current_limit(struct regulator_dev *rdev)
{}

static const unsigned int max8973_buck_ramp_table[] =;

static const struct regulator_ops max8973_dcdc_ops =;

static int max8973_init_dcdc(struct max8973_chip *max,
			     struct max8973_regulator_platform_data *pdata)
{}

static int max8973_thermal_read_temp(struct thermal_zone_device *tz, int *temp)
{}

static irqreturn_t max8973_thermal_irq(int irq, void *data)
{}

static const struct thermal_zone_device_ops max77621_tz_ops =;

static int max8973_thermal_init(struct max8973_chip *mchip)
{}

static const struct regmap_config max8973_regmap_config =;

static struct max8973_regulator_platform_data *max8973_parse_dt(
		struct device *dev)
{}

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

static int max8973_probe(struct i2c_client *client)
{}

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

static struct i2c_driver max8973_i2c_driver =;

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

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

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