drivers: regulator: drop regulator_count_modes

The regulator_count_modes was an API that was not useful. Unlike with
voltages where the interface guarantees they are zero-indexed, modes can
take an arbitrary identifier. So counting supported modes doesn't
provide any useful information such as if a mode is allowed.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
Gerard Marull-Paretas 2022-12-01 11:19:20 +01:00 committed by Carles Cufí
commit aab28d735f
2 changed files with 0 additions and 35 deletions

View file

@ -271,18 +271,6 @@ static unsigned int regulator_pca9420_count_voltages(const struct device *dev)
config->desc->num_ranges);
}
/**
* Part of the extended regulator consumer API
* Counts the number of modes supported by a regulator
*/
static int regulator_pca9420_count_modes(const struct device *dev)
{
const struct regulator_pca9420_config *config = dev->config;
const struct regulator_pca9420_common_config *cconfig = config->parent->config;
return cconfig->allowed_modes_cnt;
}
/**
* Part of the extended regulator consumer API
* Returns the supported voltage in uV for a given selector value
@ -548,7 +536,6 @@ static const struct regulator_driver_api api = {
.enable = regulator_pca9420_enable,
.disable = regulator_pca9420_disable,
.count_voltages = regulator_pca9420_count_voltages,
.count_modes = regulator_pca9420_count_modes,
.list_voltages = regulator_pca9420_list_voltages,
.is_supported_voltage = regulator_pca9420_is_supported_voltage,
.set_voltage = regulator_pca9420_set_voltage,

View file

@ -32,7 +32,6 @@ __subsystem struct regulator_driver_api {
int (*enable)(const struct device *dev);
int (*disable)(const struct device *dev);
unsigned int (*count_voltages)(const struct device *dev);
int (*count_modes)(const struct device *dev);
int32_t (*list_voltages)(const struct device *dev,
unsigned int selector);
int (*is_supported_voltage)(const struct device *dev, int32_t min_uv,
@ -129,27 +128,6 @@ static inline unsigned int regulator_count_voltages(const struct device *dev)
return api->count_voltages(dev);
}
/**
* @brief Obtain the number of supported modes.
*
* @param dev Regulator device instance.
*
* @return Number of supported modes.
*
* @see regulator_set_mode()
*/
static inline int regulator_count_modes(const struct device *dev)
{
const struct regulator_driver_api *api =
(const struct regulator_driver_api *)dev->api;
if (api->count_modes == NULL) {
return 0;
}
return api->count_modes(dev);
}
/**
* @brief Obtain supported voltages.
*