2019-06-03 10:24:32 +03:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
/* Copyright (C) 2018 ROHM Semiconductors */
|
|
|
|
|
|
|
|
#ifndef __LINUX_MFD_ROHM_H__
|
|
|
|
#define __LINUX_MFD_ROHM_H__
|
|
|
|
|
2020-01-20 16:44:45 +03:00
|
|
|
#include <linux/regmap.h>
|
|
|
|
#include <linux/regulator/driver.h>
|
|
|
|
|
2020-01-20 16:42:38 +03:00
|
|
|
enum rohm_chip_type {
|
2021-04-05 14:42:34 +03:00
|
|
|
ROHM_CHIP_TYPE_BD9571,
|
2021-04-14 18:01:10 +03:00
|
|
|
ROHM_CHIP_TYPE_BD9573,
|
2021-04-05 14:42:34 +03:00
|
|
|
ROHM_CHIP_TYPE_BD9574,
|
2021-03-10 11:06:05 +03:00
|
|
|
ROHM_CHIP_TYPE_BD9576,
|
2021-04-05 14:42:13 +03:00
|
|
|
ROHM_CHIP_TYPE_BD71815,
|
2020-01-20 16:43:28 +03:00
|
|
|
ROHM_CHIP_TYPE_BD71828,
|
2021-04-05 14:42:34 +03:00
|
|
|
ROHM_CHIP_TYPE_BD71837,
|
|
|
|
ROHM_CHIP_TYPE_BD71847,
|
2019-06-03 10:24:32 +03:00
|
|
|
ROHM_CHIP_TYPE_AMOUNT
|
|
|
|
};
|
|
|
|
|
|
|
|
struct rohm_regmap_dev {
|
|
|
|
struct device *dev;
|
|
|
|
struct regmap *regmap;
|
|
|
|
};
|
|
|
|
|
2021-02-12 11:00:23 +03:00
|
|
|
#define ROHM_DVS_LEVEL_RUN BIT(0)
|
|
|
|
#define ROHM_DVS_LEVEL_IDLE BIT(1)
|
|
|
|
#define ROHM_DVS_LEVEL_SUSPEND BIT(2)
|
|
|
|
#define ROHM_DVS_LEVEL_LPSR BIT(3)
|
2021-04-05 14:43:44 +03:00
|
|
|
#define ROHM_DVS_LEVEL_SNVS BIT(4)
|
|
|
|
#define ROHM_DVS_LEVEL_VALID_AMOUNT 5
|
2021-02-12 11:00:23 +03:00
|
|
|
#define ROHM_DVS_LEVEL_UNKNOWN 0
|
2020-01-20 16:44:45 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* struct rohm_dvs_config - dynamic voltage scaling register descriptions
|
|
|
|
*
|
|
|
|
* @level_map: bitmap representing supported run-levels for this
|
|
|
|
* regulator
|
|
|
|
* @run_reg: register address for regulator config at 'run' state
|
|
|
|
* @run_mask: value mask for regulator voltages at 'run' state
|
|
|
|
* @run_on_mask: enable mask for regulator at 'run' state
|
|
|
|
* @idle_reg: register address for regulator config at 'idle' state
|
|
|
|
* @idle_mask: value mask for regulator voltages at 'idle' state
|
|
|
|
* @idle_on_mask: enable mask for regulator at 'idle' state
|
|
|
|
* @suspend_reg: register address for regulator config at 'suspend' state
|
|
|
|
* @suspend_mask: value mask for regulator voltages at 'suspend' state
|
|
|
|
* @suspend_on_mask: enable mask for regulator at 'suspend' state
|
|
|
|
* @lpsr_reg: register address for regulator config at 'lpsr' state
|
|
|
|
* @lpsr_mask: value mask for regulator voltages at 'lpsr' state
|
|
|
|
* @lpsr_on_mask: enable mask for regulator at 'lpsr' state
|
|
|
|
*
|
|
|
|
* Description of ROHM PMICs voltage configuration registers for different
|
|
|
|
* system states. This is used to correctly configure the PMIC at startup
|
|
|
|
* based on values read from DT.
|
|
|
|
*/
|
|
|
|
struct rohm_dvs_config {
|
|
|
|
uint64_t level_map;
|
|
|
|
unsigned int run_reg;
|
|
|
|
unsigned int run_mask;
|
|
|
|
unsigned int run_on_mask;
|
|
|
|
unsigned int idle_reg;
|
|
|
|
unsigned int idle_mask;
|
|
|
|
unsigned int idle_on_mask;
|
|
|
|
unsigned int suspend_reg;
|
|
|
|
unsigned int suspend_mask;
|
|
|
|
unsigned int suspend_on_mask;
|
|
|
|
unsigned int lpsr_reg;
|
|
|
|
unsigned int lpsr_mask;
|
|
|
|
unsigned int lpsr_on_mask;
|
2021-04-05 14:43:44 +03:00
|
|
|
unsigned int snvs_reg;
|
|
|
|
unsigned int snvs_mask;
|
|
|
|
unsigned int snvs_on_mask;
|
2020-01-20 16:44:45 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#if IS_ENABLED(CONFIG_REGULATOR_ROHM)
|
|
|
|
int rohm_regulator_set_dvs_levels(const struct rohm_dvs_config *dvs,
|
|
|
|
struct device_node *np,
|
|
|
|
const struct regulator_desc *desc,
|
|
|
|
struct regmap *regmap);
|
|
|
|
|
2021-11-18 14:48:47 +03:00
|
|
|
int rohm_regulator_set_voltage_sel_restricted(struct regulator_dev *rdev,
|
|
|
|
unsigned int sel);
|
2020-01-20 16:44:45 +03:00
|
|
|
#endif
|
|
|
|
|
2019-06-03 10:24:32 +03:00
|
|
|
#endif
|