19cb0d516SEtienne Carriere /* SPDX-License-Identifier: BSD-2-Clause */ 29cb0d516SEtienne Carriere /* 3*e948a48eSEtienne Carriere * Copyright (c) 2021-2024, STMicroelectronics 49cb0d516SEtienne Carriere */ 59cb0d516SEtienne Carriere 69cb0d516SEtienne Carriere #ifndef __DRIVERS_STPMIC1_REGULATOR_H 79cb0d516SEtienne Carriere #define __DRIVERS_STPMIC1_REGULATOR_H 89cb0d516SEtienne Carriere 9*e948a48eSEtienne Carriere #include <stdbool.h> 10*e948a48eSEtienne Carriere #include <stddef.h> 119cb0d516SEtienne Carriere #include <stdint.h> 129cb0d516SEtienne Carriere 139cb0d516SEtienne Carriere /* 149cb0d516SEtienne Carriere * Return true if @name refers to a knwon regulator, return false otherwise 159cb0d516SEtienne Carriere */ 169cb0d516SEtienne Carriere bool stpmic1_regulator_is_valid(const char *name); 179cb0d516SEtienne Carriere 189cb0d516SEtienne Carriere /* 199cb0d516SEtienne Carriere * Enable STPMIC1 regulator identified by @name. 209cb0d516SEtienne Carriere * Return 0 on success and a non-0 value if failing 219cb0d516SEtienne Carriere */ 229cb0d516SEtienne Carriere int stpmic1_regulator_enable(const char *name); 239cb0d516SEtienne Carriere 249cb0d516SEtienne Carriere /* 259cb0d516SEtienne Carriere * Disable STPMIC1 regulator identified by @name. 269cb0d516SEtienne Carriere * Return 0 on success and a non-0 value if failing 279cb0d516SEtienne Carriere */ 289cb0d516SEtienne Carriere int stpmic1_regulator_disable(const char *name); 299cb0d516SEtienne Carriere 309cb0d516SEtienne Carriere /* 319cb0d516SEtienne Carriere * Return true if regulator identified by @name is enabled and false otherwise. 329cb0d516SEtienne Carriere * Return 0 on success and a non-0 value if failing 339cb0d516SEtienne Carriere */ 349cb0d516SEtienne Carriere bool stpmic1_is_regulator_enabled(const char *name); 359cb0d516SEtienne Carriere 369cb0d516SEtienne Carriere /* 379cb0d516SEtienne Carriere * Retrieve regulator levels array (in millivolts) and/or levels count 389cb0d516SEtienne Carriere * @name: regulator identifier 399cb0d516SEtienne Carriere * @levels: output reference for an arrays of the supported levels, or NULL 409cb0d516SEtienne Carriere * @levels_count: output reference for number of supported levels, or NULL 419cb0d516SEtienne Carriere */ 429cb0d516SEtienne Carriere void stpmic1_regulator_levels_mv(const char *name, const uint16_t **levels, 439cb0d516SEtienne Carriere size_t *levels_count); 449cb0d516SEtienne Carriere 459cb0d516SEtienne Carriere /* 469cb0d516SEtienne Carriere * Set voltage level @millivolt for target regulator @name 479cb0d516SEtienne Carriere * @name: regulator identifier 489cb0d516SEtienne Carriere * @millivot: target voltage level, in mV 499cb0d516SEtienne Carriere */ 509cb0d516SEtienne Carriere int stpmic1_regulator_voltage_set(const char *name, uint16_t millivolts); 519cb0d516SEtienne Carriere 529cb0d516SEtienne Carriere /* 539cb0d516SEtienne Carriere * Get current voltage level (in millivolt) for target regulator @name 549cb0d516SEtienne Carriere * @name: regulator identifier 559cb0d516SEtienne Carriere * Return a positive millivolt level on success or a negative value on error 569cb0d516SEtienne Carriere */ 579cb0d516SEtienne Carriere int stpmic1_regulator_voltage_get(const char *name); 589cb0d516SEtienne Carriere 599cb0d516SEtienne Carriere #endif /*__DRIVERS_STPMIC1_REGULATOR_H*/ 60